@egjs/deview-infinite
Advanced tools
Comparing version 0.0.2 to 0.0.3
import Infinite from "./Infinite"; | ||
export default Infinite; | ||
export * from "./consts"; | ||
export * from "./types"; |
import Component from "@egjs/component"; | ||
import { DiffResult } from "@egjs/list-differ"; | ||
import { InifniteOptions, Item } from "./types"; | ||
import { InfiniteOptions, Item } from "./types"; | ||
export default class Infinite extends Component { | ||
private container; | ||
options: InifniteOptions; | ||
options: InfiniteOptions; | ||
private items; | ||
@@ -11,3 +11,3 @@ private containerOffset; | ||
private scrollHeight; | ||
constructor(container: HTMLElement, options?: Partial<InifniteOptions>); | ||
constructor(container: HTMLElement, options?: Partial<InfiniteOptions>); | ||
insert(index: number, data: HTMLElement | string): Item; | ||
@@ -14,0 +14,0 @@ remove(index: number): Item; |
@@ -1,2 +0,2 @@ | ||
export interface InifniteOptions { | ||
export interface InfiniteOptions { | ||
renderExternal: boolean; | ||
@@ -3,0 +3,0 @@ overflow: boolean; |
@@ -7,3 +7,3 @@ /* | ||
repository: git+https://github.com/NAVER-FEPlatform/deview2019-demo.git | ||
version: 0.0.2 | ||
version: 0.0.3 | ||
*/ | ||
@@ -235,3 +235,12 @@ 'use strict'; | ||
var DEFAULT_OPTIONS = { | ||
threshold: 100, | ||
margin: 0, | ||
renderExternal: false, | ||
overflow: false | ||
}; | ||
Infinite.DEFAULT_OPTIONS = DEFAULT_OPTIONS; | ||
exports.default = Infinite; | ||
//# sourceMappingURL=infinite.cjs.js.map |
@@ -7,3 +7,3 @@ /* | ||
repository: git+https://github.com/NAVER-FEPlatform/deview2019-demo.git | ||
version: 0.0.2 | ||
version: 0.0.3 | ||
*/ | ||
@@ -233,3 +233,11 @@ import Component from '@egjs/component'; | ||
var DEFAULT_OPTIONS = { | ||
threshold: 100, | ||
margin: 0, | ||
renderExternal: false, | ||
overflow: false | ||
}; | ||
export default Infinite; | ||
export { DEFAULT_OPTIONS }; | ||
//# sourceMappingURL=infinite.esm.js.map |
@@ -7,3 +7,3 @@ /* | ||
repository: git+https://github.com/NAVER-FEPlatform/deview2019-demo.git | ||
version: 0.0.2 | ||
version: 0.0.3 | ||
*/ | ||
@@ -528,2 +528,11 @@ (function (global, factory) { | ||
var DEFAULT_OPTIONS = { | ||
threshold: 100, | ||
margin: 0, | ||
renderExternal: false, | ||
overflow: false | ||
}; | ||
Infinite.DEFAULT_OPTIONS = DEFAULT_OPTIONS; | ||
return Infinite; | ||
@@ -530,0 +539,0 @@ |
@@ -7,5 +7,5 @@ /* | ||
repository: git+https://github.com/NAVER-FEPlatform/deview2019-demo.git | ||
version: 0.0.2 | ||
version: 0.0.3 | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Infinite=e()}(this,function(){"use strict";var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};var i=function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function f(t){return void 0===t}return function(o){function t(t,e){void 0===e&&(e={});var n=o.call(this)||this;return n.container=t,n.items=[],n.containerOffset=0,n.containerHeight=0,n.scrollHeight=0,n.onScroll=function(){var t=n.options,e=t.threshold;(t.overflow?n.container.scrollTop:document.documentElement.scrollTop)-n.containerOffset>n.scrollHeight-n.containerHeight-e&&n.trigger("append",{requestIndex:n.items.length})},n.onResize=function(){n.containerOffset=n.options.overflow?0:n.container.getBoundingClientRect().top,n.containerHeight=n.container.offsetHeight,n.items.forEach(function(t){t.size=0}),n.layout()},n.options=i({threshold:100,margin:0,renderExternal:!1,overflow:!1},e),e.overflow&&(t.style.overflow="scroll"),(e.overflow?t:window).addEventListener("scroll",n.onScroll),window.addEventListener("resize",n.onResize),n.onResize(),n.onScroll(),n}!function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(t,o);var e=t.prototype;return e.insert=function(t,e){var n=this.options,o=this.items,r={el:"object"==typeof e?e:function(t){var e=document.createElement("div");return e.innerHTML=t,e.children[0]}(e),size:0,pos:0};if(o.splice(t,0,r),!n.renderExternal){var i=o[t+1];this.container.insertBefore(r.el,i?i.el:null),this.layout()}return r},e.remove=function(t){var e=this.options,n=this.items.splice(t,1)[0];return e.renderExternal||(this.container.removeChild(n.el),this.layout()),n},e.layout=function(){var t=this.options,e=t.overflow,n=t.margin,o=void 0===n?0:n,r=0;return this.items.forEach(function(t){t.size||(t.size=t.el.offsetHeight),t.pos=r,r+=t.size+o}),e||(this.container.style.height=r+"px"),this.scrollHeight=r,this.items.forEach(function(t){t.el.style.cssText+="position: absolute;top: "+t.pos+"px;"}),this.onScroll(),this},e.sync=function(t){var r=this,e=t.removed,n=t.ordered,o=t.added,i=t.list;return e.forEach(function(t){r.remove(t)}),n.forEach(function(t){var e=t[0],n=t[1],o=r.remove(e);r.insert(n,o.el).size=o.size}),o.forEach(function(t){r.insert(t,i[t])}),this.layout(),this},e.append=function(t){return this.insert(this.items.length,t),this},e.destroy=function(){(this.options.overflow?this.container:window).removeEventListener("scroll",this.onScroll),window.removeEventListener("resize",this.onResize)},t}(function(){var t=function(){function t(){this._eventHandler={},this.options={}}var e=t.prototype;return e.trigger=function(t,e){void 0===e&&(e={});var n=this._eventHandler[t]||[];if(!(0<n.length))return!0;n=n.concat(),e.eventType=t;var o=!1,r=[e],i=0;e.stop=function(){o=!0},e.currentTarget=this;for(var s=arguments.length,f=new Array(2<s?s-2:0),c=2;c<s;c++)f[c-2]=arguments[c];for(1<=f.length&&(r=r.concat(f)),i=0;n[i];i++)n[i].apply(this,r);return!o},e.once=function(r,i){if("object"==typeof r&&f(i)){var t,e=r;for(t in e)this.once(t,e[t]);return this}if("string"==typeof r&&"function"==typeof i){var s=this;this.on(r,function t(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];i.apply(s,n),s.off(r,t)})}return this},e.hasOn=function(t){return!!this._eventHandler[t]},e.on=function(t,e){if("object"==typeof t&&f(e)){var n,o=t;for(n in o)this.on(n,o[n]);return this}if("string"==typeof t&&"function"==typeof e){var r=this._eventHandler[t];f(r)&&(this._eventHandler[t]=[],r=this._eventHandler[t]),r.push(e)}return this},e.off=function(t,e){if(f(t))return this._eventHandler={},this;if(f(e)){if("string"==typeof t)return this._eventHandler[t]=void 0,this;var n,o=t;for(n in o)this.off(n,o[n]);return this}var r,i,s=this._eventHandler[t];if(s)for(r=0;void 0!==(i=s[r]);r++)if(i===e){s=s.splice(r,1);break}return this},t}();return t.VERSION="2.1.2",t}())}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Infinite=e()}(this,function(){"use strict";var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};var i=function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function f(t){return void 0===t}var t=function(o){function t(t,e){void 0===e&&(e={});var n=o.call(this)||this;return n.container=t,n.items=[],n.containerOffset=0,n.containerHeight=0,n.scrollHeight=0,n.onScroll=function(){var t=n.options,e=t.threshold;(t.overflow?n.container.scrollTop:document.documentElement.scrollTop)-n.containerOffset>n.scrollHeight-n.containerHeight-e&&n.trigger("append",{requestIndex:n.items.length})},n.onResize=function(){n.containerOffset=n.options.overflow?0:n.container.getBoundingClientRect().top,n.containerHeight=n.container.offsetHeight,n.items.forEach(function(t){t.size=0}),n.layout()},n.options=i({threshold:100,margin:0,renderExternal:!1,overflow:!1},e),e.overflow&&(t.style.overflow="scroll"),(e.overflow?t:window).addEventListener("scroll",n.onScroll),window.addEventListener("resize",n.onResize),n.onResize(),n.onScroll(),n}!function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(t,o);var e=t.prototype;return e.insert=function(t,e){var n=this.options,o=this.items,r={el:"object"==typeof e?e:function(t){var e=document.createElement("div");return e.innerHTML=t,e.children[0]}(e),size:0,pos:0};if(o.splice(t,0,r),!n.renderExternal){var i=o[t+1];this.container.insertBefore(r.el,i?i.el:null),this.layout()}return r},e.remove=function(t){var e=this.options,n=this.items.splice(t,1)[0];return e.renderExternal||(this.container.removeChild(n.el),this.layout()),n},e.layout=function(){var t=this.options,e=t.overflow,n=t.margin,o=void 0===n?0:n,r=0;return this.items.forEach(function(t){t.size||(t.size=t.el.offsetHeight),t.pos=r,r+=t.size+o}),e||(this.container.style.height=r+"px"),this.scrollHeight=r,this.items.forEach(function(t){t.el.style.cssText+="position: absolute;top: "+t.pos+"px;"}),this.onScroll(),this},e.sync=function(t){var r=this,e=t.removed,n=t.ordered,o=t.added,i=t.list;return e.forEach(function(t){r.remove(t)}),n.forEach(function(t){var e=t[0],n=t[1],o=r.remove(e);r.insert(n,o.el).size=o.size}),o.forEach(function(t){r.insert(t,i[t])}),this.layout(),this},e.append=function(t){return this.insert(this.items.length,t),this},e.destroy=function(){(this.options.overflow?this.container:window).removeEventListener("scroll",this.onScroll),window.removeEventListener("resize",this.onResize)},t}(function(){var t=function(){function t(){this._eventHandler={},this.options={}}var e=t.prototype;return e.trigger=function(t,e){void 0===e&&(e={});var n=this._eventHandler[t]||[];if(!(0<n.length))return!0;n=n.concat(),e.eventType=t;var o=!1,r=[e],i=0;e.stop=function(){o=!0},e.currentTarget=this;for(var s=arguments.length,f=new Array(2<s?s-2:0),c=2;c<s;c++)f[c-2]=arguments[c];for(1<=f.length&&(r=r.concat(f)),i=0;n[i];i++)n[i].apply(this,r);return!o},e.once=function(r,i){if("object"==typeof r&&f(i)){var t,e=r;for(t in e)this.once(t,e[t]);return this}if("string"==typeof r&&"function"==typeof i){var s=this;this.on(r,function t(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];i.apply(s,n),s.off(r,t)})}return this},e.hasOn=function(t){return!!this._eventHandler[t]},e.on=function(t,e){if("object"==typeof t&&f(e)){var n,o=t;for(n in o)this.on(n,o[n]);return this}if("string"==typeof t&&"function"==typeof e){var r=this._eventHandler[t];f(r)&&(this._eventHandler[t]=[],r=this._eventHandler[t]),r.push(e)}return this},e.off=function(t,e){if(f(t))return this._eventHandler={},this;if(f(e)){if("string"==typeof t)return this._eventHandler[t]=void 0,this;var n,o=t;for(n in o)this.off(n,o[n]);return this}var r,i,s=this._eventHandler[t];if(s)for(r=0;void 0!==(i=s[r]);r++)if(i===e){s=s.splice(r,1);break}return this},t}();return t.VERSION="2.1.2",t}());return t.DEFAULT_OPTIONS={threshold:100,margin:0,renderExternal:!1,overflow:!1},t}); | ||
//# sourceMappingURL=infinite.min.js.map |
{ | ||
"name": "@egjs/deview-infinite", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./dist/infinite.cjs.js", |
import Infinite from "./Infinite"; | ||
export default Infinite; | ||
export * from "./types"; | ||
export * from "./consts"; | ||
export * from "./types"; |
import Infinite from "./Infinite"; | ||
import { DEFAULT_OPTIONS } from "./consts"; | ||
(Infinite as any).DEFAULT_OPTIONS = DEFAULT_OPTIONS; | ||
export default Infinite; |
import Component from "@egjs/component"; | ||
import { DiffResult } from "@egjs/list-differ"; | ||
import { InifniteOptions, Item } from "./types"; | ||
import { InfiniteOptions, Item } from "./types"; | ||
@@ -13,3 +13,3 @@ function makeElement(html: string) { | ||
export default class Infinite extends Component { | ||
public options!: InifniteOptions; | ||
public options!: InfiniteOptions; | ||
private items: Item[] = []; | ||
@@ -21,3 +21,3 @@ private containerOffset = 0; | ||
private container: HTMLElement, | ||
options: Partial<InifniteOptions> = {}, | ||
options: Partial<InfiniteOptions> = {}, | ||
) { | ||
@@ -24,0 +24,0 @@ super(); |
@@ -1,2 +0,2 @@ | ||
export interface InifniteOptions { | ||
export interface InfiniteOptions { | ||
renderExternal: boolean; | ||
@@ -3,0 +3,0 @@ overflow: boolean; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
105364
24
1153