{"version":3,"file":"infinitegrid.cjs.js","sources":["../src/consts.ts","../src/InfiniteGridItem.ts","../src/LoadingGrid.ts","../src/utils.ts","../src/GroupManager.ts","../src/Infinite.ts","../src/Renderer/Renderer.ts","../src/Renderer/VanillaRenderer.ts","../src/Renderer/VanillaGridRenderer.ts","../src/ScrollManager.ts","../src/InfiniteGrid.ts","../src/grids/MasonryInfiniteGrid.ts","../src/grids/JustifiedInfiniteGrid.ts","../src/grids/FrameInfiniteGrid.ts","../src/grids/PackingInfiniteGrid.ts","../src/index.cjs.ts"],"sourcesContent":["import { GRID_PROPERTY_TYPES } from \"@egjs/grid\";\n\nconst ua = typeof window !== \"undefined\" ? window.navigator.userAgent : \"\";\n\nexport const IS_IOS = /iPhone|iPad/.test(ua);\nexport const CONTAINER_CLASS_NAME = \"infinitegrid-container\";\nexport const IGNORE_PROPERITES_MAP = {\n renderOnPropertyChange: true,\n useFit: true,\n autoResize: true,\n} as const;\n\n\nexport const INFINITEGRID_PROPERTY_TYPES = {\n ...GRID_PROPERTY_TYPES,\n};\n\nexport const DIRECTION = {\n START: \"start\",\n END: \"end\",\n NONE: \"\",\n} as const;\n\nexport const INFINITEGRID_EVENTS = {\n CHANGE_SCROLL: \"changeScroll\",\n REQUEST_APPEND: \"requestAppend\",\n REQUEST_PREPEND: \"requestPrepend\",\n RENDER_COMPLETE: \"renderComplete\",\n CONTENT_ERROR: \"contentError\",\n} as const;\n\n// type?: ITEM_TYPE;\n// groupKey?: string | number;\n// key?: string | number;\n// element?: HTMLElement | null;\n// html?: string;\n// data?: Record;\nexport const ITEM_INFO_PROPERTIES = {\n type: true,\n groupKey: true,\n key: true,\n element: true,\n html: true,\n data: true,\n};\n\n\nexport const INFINITEGRID_METHODS = [\n \"insertByGroupIndex\",\n \"updateItems\",\n \"getItems\",\n \"getVisibleItems\",\n \"getGroups\",\n \"getVisibleGroups\",\n \"renderItems\",\n \"getContainerElement\",\n \"getScrollContainerElement\",\n \"getWrapperElement\",\n \"setStatus\",\n \"getStatus\",\n \"removePlaceholders\",\n \"prependPlaceholders\",\n \"appendPlaceholders\",\n \"getStartCursor\",\n \"getEndCursor\",\n \"setCursors\",\n] as const;\n\n\nexport enum GROUP_TYPE {\n NORMAL = 0,\n VIRTUAL = 1,\n LOADING = 2,\n}\n\nexport enum ITEM_TYPE {\n NORMAL = 0,\n VIRTUAL = 1,\n LOADING = 2,\n}\n\nexport enum STATUS_TYPE {\n // does not remove anything.\n NOT_REMOVE = 0,\n // Minimize information on invisible items\n MINIMIZE_INVISIBLE_ITEMS = 1,\n // Minimize information on invisible groups\n MINIMIZE_INVISIBLE_GROUPS = 2,\n // remove invisible groups\n REMOVE_INVISIBLE_GROUPS = 3,\n}\n\n\nexport const INVISIBLE_POS = -9999;\n","import { GridItem, GridItemStatus, MOUNT_STATE } from \"@egjs/grid\";\nimport { INVISIBLE_POS, ITEM_TYPE } from \"./consts\";\nimport { InfiniteGridItemInfo } from \"./types\";\n\n\nexport interface InfiniteGridItemStatus extends GridItemStatus {\n type?: ITEM_TYPE;\n groupKey?: string | number;\n key?: string | number;\n html?: string;\n}\n\n/**\n * @extends Grid.GridItem\n */\nexport class InfiniteGridItem extends GridItem implements Required {\n public groupKey: string | number;\n public readonly html: string;\n constructor(horizontal: boolean, itemStatus?: Partial) {\n super(horizontal, {\n html: \"\",\n type: ITEM_TYPE.NORMAL,\n cssRect: { top: INVISIBLE_POS, left: INVISIBLE_POS },\n ...itemStatus,\n } as GridItemStatus);\n\n if (this.type === ITEM_TYPE.VIRTUAL) {\n if (this.rect.width || this.rect.height) {\n this.mountState = MOUNT_STATE.UNMOUNTED;\n }\n const orgRect = this.orgRect;\n const rect = this.rect;\n const cssRect = this.cssRect;\n\n if (cssRect.width) {\n rect.width = cssRect.width;\n } else if (orgRect.width) {\n rect.width = orgRect.width;\n }\n if (cssRect.height) {\n rect.height = cssRect.height;\n } else if (orgRect.height) {\n rect.height = orgRect.height;\n }\n }\n }\n public getVirtualStatus(): Partial {\n return {\n type: ITEM_TYPE.VIRTUAL,\n groupKey: this.groupKey,\n key: this.key,\n orgRect: this.orgRect,\n rect: this.rect,\n cssRect: this.cssRect,\n attributes: this.attributes,\n };\n }\n public getMinimizedStatus(): Partial {\n const status: Partial = {\n ...super.getMinimizedStatus(),\n type: ITEM_TYPE.NORMAL,\n groupKey: this.groupKey,\n };\n if (this.html) {\n status.html = this.html;\n }\n return status;\n }\n}\n\nexport interface InfiniteGridItem extends Required {}\n","import Grid, { GridItem, GridOutlines } from \"@egjs/grid\";\nimport { ITEM_TYPE } from \"./consts\";\nimport { InfiniteGridItem, InfiniteGridItemStatus } from \"./InfiniteGridItem\";\n\nexport const LOADING_GROUP_KEY = \"__INFINITEGRID__LOADING_GRID\";\nexport const LOADING_ITEM_KEY = \"__INFINITEGRID__LOADING_ITEM\";\n\nexport class LoadingGrid extends Grid {\n public type: \"start\" | \"end\" | \"\" = \"\";\n public getLoadingItem(): InfiniteGridItem | null {\n return this.items[0] as InfiniteGridItem || null;\n }\n public setLoadingItem(item: Partial | null) {\n if (item) {\n const loadingItem = this.getLoadingItem();\n\n if (!loadingItem) {\n this.items = [new InfiniteGridItem(this.options.horizontal, {\n ...item,\n type: ITEM_TYPE.LOADING,\n key: LOADING_ITEM_KEY,\n })];\n } else {\n for (const name in item) {\n loadingItem[name] = item[name];\n }\n }\n } else {\n this.items = [];\n }\n }\n public applyGrid(items: GridItem[], direction: \"start\" | \"end\", outline: number[]): GridOutlines {\n if (!items.length) {\n return {\n start: outline,\n end: outline,\n };\n }\n const nextOutline = outline.length ? [...outline] : [0];\n const item = items[0];\n const offset = item.contentSize + this.gap;\n\n item.cssInlinePos = this.getContainerInlineSize() / 2 - item.inlineSize / 2;\n\n if (direction === \"end\") {\n const maxPos = Math.max(...nextOutline);\n\n item.cssContentPos = maxPos;\n\n return {\n start: nextOutline,\n end: nextOutline.map((pos) => pos + offset),\n };\n } else {\n const minPos = Math.min(...nextOutline);\n\n item.cssContentPos = minPos - offset;\n\n return {\n start: nextOutline.map((pos) => pos - offset),\n end: nextOutline,\n };\n }\n }\n}\n","import Grid, { GRID_PROPERTY_TYPES, withMethods } from \"@egjs/grid\";\nimport { diff } from \"@egjs/list-differ\";\nimport { GROUP_TYPE, IGNORE_PROPERITES_MAP, INFINITEGRID_METHODS, ITEM_INFO_PROPERTIES, ITEM_TYPE } from \"./consts\";\nimport { GroupManagerStatus, InfiniteGridGroupStatus } from \"./GroupManager\";\nimport InfiniteGrid from \"./InfiniteGrid\";\nimport { InfiniteGridItem, InfiniteGridItemStatus } from \"./InfiniteGridItem\";\nimport {\n CategorizedGroup, InfiniteGridGroup, InfiniteGridInsertedItems,\n InfiniteGridItemInfo,\n RenderingOptions,\n} from \"./types\";\n\nexport function isWindow(el: Window | Element): el is Window {\n return el === window;\n}\n\nexport function isNumber(val: any): val is number {\n return typeof val === \"number\";\n}\n\nexport function isString(val: any): val is string {\n return typeof val === \"string\";\n}\nexport function isObject(val: any): val is object {\n return typeof val === \"object\";\n}\n\nexport function flat(arr: T[][]): T[] {\n return arr.reduce((prev, cur) => {\n return [...prev, ...cur];\n }, []);\n}\nexport function splitOptions(options: Record) {\n const {\n gridOptions,\n ...otherOptions\n } = options;\n\n return {\n ...splitGridOptions(gridOptions),\n ...otherOptions,\n };\n}\nexport function splitGridOptions(options: Record) {\n const nextOptions: Record = {};\n const gridOptions: Record = {};\n const defaultOptions = Grid.defaultOptions;\n\n for (const name in options) {\n const value = options[name];\n\n if (!(name in IGNORE_PROPERITES_MAP)) {\n gridOptions[name] = value;\n }\n\n if (name in defaultOptions) {\n nextOptions[name] = value;\n }\n }\n return {\n ...nextOptions,\n gridOptions,\n };\n}\n\nexport function categorize(items: Item[]) {\n const groups: Array> = [];\n const groupKeys: Record> = {};\n const registeredGroupKeys: Record = {};\n\n items.filter((item) => item.groupKey != null).forEach(({ groupKey }) => {\n registeredGroupKeys[groupKey!] = true;\n });\n\n let generatedGroupKey: number | string;\n let isContinuousGroupKey = false;\n\n items.forEach((item) => {\n if (item.groupKey != null) {\n isContinuousGroupKey = false;\n } else {\n if (!isContinuousGroupKey) {\n generatedGroupKey = makeKey(registeredGroupKeys);\n isContinuousGroupKey = true;\n registeredGroupKeys[generatedGroupKey] = true;\n }\n item.groupKey = generatedGroupKey;\n }\n\n const groupKey = item.groupKey;\n let group = groupKeys[groupKey];\n\n if (!group) {\n group = {\n groupKey,\n items: [],\n };\n groupKeys[groupKey] = group;\n groups.push(group);\n }\n\n group.items.push(item);\n });\n return groups;\n}\n\nexport function getNextCursors(\n prevKeys: Array,\n nextKeys: Array,\n prevStartCursor: number,\n prevEndCursor: number,\n) {\n const result = diff(prevKeys, nextKeys, (key) => key);\n let nextStartCursor = -1;\n let nextEndCursor = -1;\n\n // sync cursors\n result.maintained.forEach(([prevIndex, nextIndex]) => {\n if (prevStartCursor <= prevIndex && prevIndex <= prevEndCursor) {\n if (nextStartCursor === -1) {\n nextStartCursor = nextIndex;\n nextEndCursor = nextIndex;\n } else {\n nextStartCursor = Math.min(nextStartCursor, nextIndex);\n nextEndCursor = Math.max(nextEndCursor, nextIndex);\n }\n }\n });\n return {\n startCursor: nextStartCursor,\n endCursor: nextEndCursor,\n };\n}\nexport function splitVirtualGroups(\n groups: Group[],\n direction: \"start\" | \"end\",\n nextGroups: CategorizedGroup[],\n) {\n let virtualGroups: Group[] = [];\n\n if (direction === \"start\") {\n const index = findIndex(groups, (group) => group.type === GROUP_TYPE.NORMAL);\n\n if (index === -1) {\n return [];\n }\n // Get the virtual group maintained in the group from the next group.\n const endMaintainedIndex = findIndex(groups, (group) => {\n return findIndex(nextGroups, (nextGroup) => nextGroup.groupKey === group.groupKey) >= 0;\n });\n const endIndex = endMaintainedIndex >= 0 ? Math.min(index, endMaintainedIndex) : index;\n\n virtualGroups = groups.slice(0, endIndex);\n } else {\n const index = findLastIndex(groups, (group) => group.type === GROUP_TYPE.NORMAL);\n\n if (index === -1) {\n return [];\n }\n const startMaintainedIndex = findLastIndex(groups, (group) => {\n return findIndex(nextGroups, (nextGroup) => nextGroup.groupKey === group.groupKey) >= 0;\n });\n const startIndex = startMaintainedIndex >= 0 ? Math.max(index, startMaintainedIndex) : index;\n\n virtualGroups = groups.slice(startIndex + 1);\n }\n\n return virtualGroups;\n}\n\nexport function getFirstRenderingItems(\n nextItems: InfiniteGridItemStatus[],\n horizontal: boolean,\n) {\n const groups = categorize(nextItems);\n\n if (!groups[0]) {\n return [];\n }\n return groups[0].items.map((item) => {\n return new InfiniteGridItem(horizontal, {\n ...item,\n });\n });\n}\nexport function getRenderingItemsByStatus(\n groupManagerStatus: GroupManagerStatus,\n nextItems: InfiniteGridItemStatus[],\n usePlaceholder: boolean,\n horizontal: boolean,\n) {\n const prevGroups = groupManagerStatus.groups;\n const groups = categorize(nextItems);\n\n const startVirtualGroups = splitVirtualGroups(prevGroups, \"start\", groups);\n const endVirtualGroups = splitVirtualGroups(prevGroups, \"end\", groups);\n const nextGroups = [\n ...startVirtualGroups,\n ...groups,\n ...endVirtualGroups,\n ] as Array>;\n const {\n startCursor,\n endCursor,\n } = getNextCursors(\n prevGroups.map((group) => group.groupKey),\n nextGroups.map((group) => group.groupKey),\n groupManagerStatus.cursors[0],\n groupManagerStatus.cursors[1],\n );\n\n let nextVisibleItems = flat(nextGroups.slice(startCursor, endCursor + 1).map((group) => {\n return group.items.map((item) => {\n return new InfiniteGridItem(horizontal, { ...item });\n });\n }));\n\n if (!usePlaceholder) {\n nextVisibleItems = nextVisibleItems.filter((item) => {\n return item.type !== ITEM_TYPE.VIRTUAL;\n });\n }\n\n return nextVisibleItems;\n}\n\nexport function mountRenderingItems(items: InfiniteGridItemInfo[], options: RenderingOptions) {\n const {\n grid,\n usePlaceholder,\n useLoading,\n useFirstRender,\n status,\n } = options;\n if (!grid) {\n return;\n }\n if (usePlaceholder) {\n grid.setPlaceholder({});\n }\n if (useLoading) {\n grid.setLoading({});\n }\n if (status) {\n grid.setStatus(status, true);\n }\n\n grid.syncItems(items);\n\n if (useFirstRender && !status && grid.getGroups().length) {\n grid.setCursors(0, 0, true);\n }\n}\nexport function getRenderingItems(items: InfiniteGridItemInfo[], options: RenderingOptions) {\n const {\n status,\n usePlaceholder,\n useLoading,\n horizontal,\n useFirstRender,\n grid,\n } = options;\n let visibleItems: InfiniteGridItem[] = [];\n\n if (grid) {\n grid.setPlaceholder(usePlaceholder ? {} : null);\n grid.setLoading(useLoading ? {} : null);\n grid.syncItems(items);\n\n visibleItems = grid.getRenderingItems();\n } else if (status) {\n visibleItems = getRenderingItemsByStatus(status.groupManager, items, !!usePlaceholder, !!horizontal);\n } else if (useFirstRender) {\n visibleItems = getFirstRenderingItems(items, !!horizontal);\n }\n\n return visibleItems;\n}\n\n/* Class Decorator */\nexport function InfiniteGridGetterSetter(component: {\n prototype: InfiniteGrid,\n propertyTypes: typeof GRID_PROPERTY_TYPES,\n}) {\n const {\n prototype,\n propertyTypes,\n } = component;\n for (const name in propertyTypes) {\n const attributes: Record = {\n enumerable: true,\n configurable: true,\n get(this: InfiniteGrid) {\n const options = this.groupManager.options;\n if (name in options) {\n return options[name];\n } else {\n return options.gridOptions[name];\n }\n },\n set(this: InfiniteGrid, value: any) {\n const prevValue = this.groupManager[name];\n\n if (prevValue === value) {\n return;\n }\n this.groupManager.gridOptions = {\n [name]: value,\n };\n },\n };\n Object.defineProperty(prototype, name, attributes);\n }\n}\n\nexport function makeKey(registeredKeys: Record) {\n let index = 0;\n // eslint-disable-next-line no-constant-condition\n while (true) {\n const key = `infinitegrid_${index++}`;\n\n if (!(key in registeredKeys)) {\n return key;\n }\n }\n}\n\nexport function convertHTMLtoElement(html: string) {\n const dummy = document.createElement(\"div\");\n\n dummy.innerHTML = html;\n return toArray(dummy.children);\n}\n\nexport function convertInsertedItems(\n items: InfiniteGridInsertedItems,\n groupKey?: string | number,\n): InfiniteGridItemInfo[] {\n let insertedItems: Array;\n\n if (isString(items)) {\n insertedItems = convertHTMLtoElement(items);\n } else {\n insertedItems = items;\n }\n return insertedItems.map((item) => {\n let element!: HTMLElement;\n let html = \"\";\n let key!: string | number;\n\n if (isString(item)) {\n html = item;\n } else if (\"parentNode\" in item) {\n element = item;\n html = item.outerHTML;\n } else {\n return { groupKey, ...item };\n }\n\n return {\n key,\n groupKey,\n html,\n element,\n };\n });\n}\nexport function toArray(nodes: HTMLCollection): HTMLElement[];\nexport function toArray(nodes: { length: number, [key: number]: T }): T[];\nexport function toArray(nodes: { length: number, [key: number]: T }): T[] {\n const array: T[] = [];\n\n if (nodes) {\n const length = nodes.length;\n\n for (let i = 0; i < length; i++) {\n array.push(nodes[i]);\n }\n }\n return array;\n}\n\n\nexport function findIndex(arr: T[], callback: (value: T, index: number) => boolean) {\n const length = arr.length;\n for (let i = 0; i < length; ++i) {\n if (callback(arr[i], i)) {\n return i;\n }\n }\n\n return -1;\n}\n\nexport function findLastIndex(arr: T[], callback: (value: T, index: number) => boolean) {\n const length = arr.length;\n for (let i = length - 1; i >= 0; --i) {\n if (callback(arr[i], i)) {\n return i;\n }\n }\n\n return -1;\n}\n\nexport function getItemInfo(info: InfiniteGridItemInfo) {\n const nextInfo: InfiniteGridItemInfo = {};\n\n for (const name in info) {\n if (name in ITEM_INFO_PROPERTIES) {\n nextInfo[name] = info[name];\n }\n }\n\n return nextInfo;\n}\n\nexport function setPlaceholder(item: InfiniteGridItem, info: InfiniteGridItemStatus) {\n for (const name in info) {\n const value = info[name];\n\n if (isObject(value)) {\n item[name] = {\n ...item[name],\n ...value,\n };\n } else {\n item[name] = info[name];\n }\n }\n}\n\nexport function isFlatOutline(start: number[], end: number[]) {\n return start.length === end.length && start.every((pos, i) => end[i] === pos);\n}\n\nexport function range(length: number): number[] {\n const arr: number[] = [];\n for (let i = 0; i < length; ++i) {\n arr.push(i);\n }\n return arr;\n}\n\nexport function flatGroups(groups: InfiniteGridGroup[]) {\n return flat(groups.map(({ grid }) => grid.getItems() as InfiniteGridItem[]));\n}\n\n\nexport function filterVirtuals(\n items: T[],\n includePlaceholders?: boolean\n): T[] {\n if (includePlaceholders) {\n return items;\n } else {\n return items.filter((item) => item.type !== ITEM_TYPE.VIRTUAL);\n }\n}\n\n/**\n * Decorator that makes the method of InfiniteGrid available in the framework.\n * @ko 프레임워크에서 InfiniteGrid의 메소드를 사용할 수 있게 하는 데코레이터.\n * @private\n * @example\n * ```js\n * import { withInfiniteGridMethods } from \"@egjs/infinitegrid\";\n *\n * class Grid extends React.Component> {\n * @withInfiniteGridMethods\n * private grid: NativeGrid;\n * }\n * ```\n */\nexport const withInfiniteGridMethods = withMethods(INFINITEGRID_METHODS);\n\n","import Grid, {\n GetterSetter,\n GridFunction, GridOptions,\n GridOutlines, MOUNT_STATE, Properties, PROPERTY_TYPE,\n RenderOptions, UPDATE_STATE,\n} from \"@egjs/grid\";\nimport { GROUP_TYPE, ITEM_TYPE, STATUS_TYPE } from \"./consts\";\nimport { InfiniteGridItem, InfiniteGridItemStatus } from \"./InfiniteGridItem\";\nimport { LoadingGrid, LOADING_GROUP_KEY } from \"./LoadingGrid\";\nimport { CategorizedGroup, InfiniteGridGroup, InfiniteGridItemInfo } from \"./types\";\nimport {\n categorize, filterVirtuals, findIndex, findLastIndex,\n flat,\n flatGroups, getItemInfo, isNumber, makeKey,\n range,\n setPlaceholder,\n splitGridOptions, splitOptions, splitVirtualGroups,\n} from \"./utils\";\n\nexport interface InfiniteGridGroupStatus {\n type: GROUP_TYPE;\n groupKey: string | number;\n items: InfiniteGridItemStatus[];\n outlines: GridOutlines;\n}\n\nexport interface GroupManagerOptions extends GridOptions {\n gridConstructor: GridFunction | null;\n gridOptions: Record;\n}\n\nexport interface GroupManagerStatus {\n cursors: [number, number];\n orgCursors: [number, number];\n itemCursors: [number, number];\n startGroupKey: number | string;\n endGroupKey: number | string;\n groups: InfiniteGridGroupStatus[];\n outlines: GridOutlines;\n}\n\n@GetterSetter\nexport class GroupManager extends Grid {\n public static defaultOptions: Required = {\n ...Grid.defaultOptions,\n gridConstructor: null,\n gridOptions: {},\n };\n public static propertyTypes = {\n ...Grid.propertyTypes,\n gridConstructor: PROPERTY_TYPE.PROPERTY,\n gridOptions: PROPERTY_TYPE.PROPERTY,\n } as const;\n protected items: InfiniteGridItem[];\n protected groupItems: InfiniteGridItem[] = [];\n protected groups: InfiniteGridGroup[] = [];\n protected itemKeys: Record = {};\n protected groupKeys: Record = {};\n protected startCursor = 0;\n protected endCursor = 0;\n private _placeholder: Partial | null = null;\n private _loadingGrid!: LoadingGrid;\n private _mainGrid!: Grid;\n\n constructor(container: HTMLElement, options: GroupManagerOptions) {\n super(container, splitOptions(options));\n\n this._loadingGrid = new LoadingGrid(container, {\n externalContainerManager: this.containerManager,\n useFit: false,\n autoResize: false,\n renderOnPropertyChange: false,\n gap: this.gap,\n });\n this._mainGrid = this._makeGrid();\n }\n public set gridOptions(options: Record) {\n const {\n gridOptions,\n ...otherOptions\n } = splitGridOptions(options);\n\n const shouldRender = this._checkShouldRender(options);\n this.options.gridOptions = {\n ...this.options.gridOptions,\n ...gridOptions,\n };\n [this._mainGrid, ...this.groups.map(({ grid }) => grid)].forEach((grid) => {\n for (const name in options) {\n (grid as any)[name] = options[name];\n }\n });\n for (const name in otherOptions) {\n this[name] = otherOptions[name];\n }\n\n this._loadingGrid.gap = this.gap;\n if (shouldRender) {\n this.scheduleRender();\n }\n }\n\n public getItemByKey(key: string | number): InfiniteGridItem | null {\n return this.itemKeys[key] || null;\n }\n\n public getGroupItems(includePlaceholders?: boolean) {\n return filterVirtuals(this.groupItems, includePlaceholders);\n }\n public getVisibleItems(includePlaceholders?: boolean) {\n return filterVirtuals(this.items, includePlaceholders);\n }\n\n public getRenderingItems() {\n if (this.hasPlaceholder()) {\n return this.items;\n } else {\n return this.items.filter((item) => item.type !== ITEM_TYPE.VIRTUAL);\n }\n }\n\n public getGroups(includePlaceholders?: boolean): InfiniteGridGroup[] {\n return filterVirtuals(this.groups, includePlaceholders);\n }\n\n public hasVisibleVirtualGroups() {\n return this.getVisibleGroups(true).some((group) => group.type === GROUP_TYPE.VIRTUAL);\n }\n public hasPlaceholder() {\n return !!this._placeholder;\n }\n public hasLoadingItem() {\n return !!this._getLoadingItem();\n }\n\n public updateItems(items = this.groupItems, options?: RenderOptions) {\n return super.updateItems(items, options);\n }\n public setPlaceholder(placeholder: Partial | null) {\n this._placeholder = placeholder;\n this._updatePlaceholder();\n }\n\n public getLoadingType() {\n return this._loadingGrid.type;\n }\n\n public startLoading(type: \"start\" | \"end\") {\n this._loadingGrid.type = type;\n this.items = this._getRenderingItems();\n\n return true;\n }\n\n public endLoading() {\n const prevType = this._loadingGrid.type;\n\n this._loadingGrid.type = \"\";\n this.items = this._getRenderingItems();\n return !!prevType;\n }\n\n public setLoading(loading: Partial | null) {\n this._loadingGrid.setLoadingItem(loading);\n this.items = this._getRenderingItems();\n }\n\n public getVisibleGroups(includePlaceholders?: boolean): InfiniteGridGroup[] {\n const groups = this.groups.slice(this.startCursor, this.endCursor + 1);\n\n return filterVirtuals(groups, includePlaceholders);\n }\n\n public getComputedOutlineLength(items = this.items) {\n return this._mainGrid.getComputedOutlineLength(items);\n }\n public getComputedOutlineSize(items = this.items) {\n return this._mainGrid.getComputedOutlineSize(items);\n }\n\n public applyGrid(items: InfiniteGridItem[], direction: \"end\" | \"start\", outline: number[]): GridOutlines {\n const renderingGroups = this.groups.slice();\n\n if (!renderingGroups.length) {\n return {\n start: [],\n end: [],\n };\n }\n\n\n const loadingGrid = this._loadingGrid;\n\n if (loadingGrid.getLoadingItem()) {\n if (loadingGrid.type === \"start\") {\n renderingGroups.unshift(this._getLoadingGroup());\n } else if (loadingGrid.type === \"end\") {\n renderingGroups.push(this._getLoadingGroup());\n }\n }\n\n const groups = renderingGroups.slice();\n\n let nextOutline = outline;\n\n if (direction === \"start\") {\n groups.reverse();\n }\n\n const groupItems = this.groupItems;\n const outlineLength = this.getComputedOutlineLength(groupItems);\n const outlineSize = this.getComputedOutlineSize(groupItems);\n\n groups.forEach((group) => {\n const grid = group.grid;\n const gridItems = grid.getItems();\n const isVirtual = group.type === GROUP_TYPE.VIRTUAL && !gridItems[0];\n const appliedItems = gridItems.filter((item) => item.mountState !== MOUNT_STATE.UNCHECKED && item.rect.width);\n let gridOutlines: GridOutlines;\n\n grid.outlineLength = outlineLength;\n grid.outlineSize = outlineSize;\n\n if (isVirtual) {\n gridOutlines = this._applyVirtualGrid(grid, direction, nextOutline);\n } else if (appliedItems.length) {\n gridOutlines = grid.applyGrid(appliedItems, direction, nextOutline);\n } else {\n gridOutlines = {\n start: [...nextOutline],\n end: [...nextOutline],\n };\n }\n grid.setOutlines(gridOutlines);\n nextOutline = gridOutlines[direction];\n });\n\n return {\n start: renderingGroups[0].grid.getOutlines().start,\n end: renderingGroups[renderingGroups.length - 1].grid.getOutlines().end,\n };\n }\n\n public syncItems(nextItemInfos: InfiniteGridItemInfo[]) {\n const prevItemKeys = this.itemKeys;\n\n this.itemKeys = {};\n const nextItems = this._syncItemInfos(nextItemInfos.map((info) => getItemInfo(info)), prevItemKeys);\n const prevGroupKeys = this.groupKeys;\n let nextManagerGroups = categorize(nextItems);\n\n const startVirtualGroups = this._splitVirtualGroups(\"start\", nextManagerGroups);\n const endVirtualGroups = this._splitVirtualGroups(\"end\", nextManagerGroups);\n nextManagerGroups = [...startVirtualGroups, ...this._mergeVirtualGroups(nextManagerGroups), ...endVirtualGroups];\n\n const nextGroups: InfiniteGridGroup[] = nextManagerGroups.map(({ groupKey, items }) => {\n const isVirtual = !items[0] || items[0].type === ITEM_TYPE.VIRTUAL;\n const grid = prevGroupKeys[groupKey]?.grid ?? this._makeGrid();\n const gridItems = isVirtual ? items : items.filter(({ type }) => type === ITEM_TYPE.NORMAL);\n\n grid.setItems(gridItems);\n\n return {\n type: isVirtual ? GROUP_TYPE.VIRTUAL : GROUP_TYPE.NORMAL,\n groupKey,\n grid,\n items: gridItems,\n renderItems: items,\n };\n });\n\n this._registerGroups(nextGroups);\n }\n\n public renderItems(options: RenderOptions = {}) {\n if (options.useResize) {\n this.groupItems.forEach((item) => {\n item.updateState = UPDATE_STATE.NEED_UPDATE;\n });\n const loadingItem = this._getLoadingItem();\n\n if (loadingItem) {\n loadingItem.updateState = UPDATE_STATE.NEED_UPDATE;\n }\n }\n return super.renderItems(options);\n }\n\n public setCursors(startCursor: number, endCursor: number) {\n this.startCursor = startCursor;\n this.endCursor = endCursor;\n this.items = this._getRenderingItems();\n }\n\n public getStartCursor() {\n return this.startCursor;\n }\n\n public getEndCursor() {\n return this.endCursor;\n }\n\n public getGroupStatus(type?: STATUS_TYPE, includePlaceholders?: boolean): GroupManagerStatus {\n const orgStartCursor = this.startCursor;\n const orgEndCursor = this.endCursor;\n const orgGroups = this.groups;\n const startGroup = orgGroups[orgStartCursor];\n const endGroup = orgGroups[orgEndCursor];\n\n let startCursor = orgStartCursor;\n let endCursor = orgEndCursor;\n\n const isMinimizeItems = type === STATUS_TYPE.MINIMIZE_INVISIBLE_ITEMS;\n const isMinimizeGroups = type === STATUS_TYPE.MINIMIZE_INVISIBLE_GROUPS;\n let groups: InfiniteGridGroup[];\n\n if (type === STATUS_TYPE.REMOVE_INVISIBLE_GROUPS) {\n groups = this.getVisibleGroups(includePlaceholders);\n endCursor = groups.length - 1;\n startCursor = 0;\n } else {\n groups = this.getGroups(includePlaceholders);\n\n if (!includePlaceholders) {\n startCursor = -1;\n endCursor = -1;\n\n for (let orgIndex = orgStartCursor; orgIndex <= orgEndCursor; ++orgIndex) {\n const orgGroup = orgGroups[orgIndex];\n\n if (orgGroup && orgGroup.type !== GROUP_TYPE.VIRTUAL) {\n startCursor = groups.indexOf(orgGroup);\n break;\n }\n }\n for (let orgIndex = orgEndCursor; orgIndex >= orgStartCursor; --orgIndex) {\n const orgGroup = orgGroups[orgIndex];\n\n if (orgGroup && orgGroup.type !== GROUP_TYPE.VIRTUAL) {\n endCursor = groups.lastIndexOf(orgGroup);\n break;\n }\n }\n }\n }\n\n const groupStatus: InfiniteGridGroupStatus[] = groups.map(({ grid, groupKey }, i) => {\n const isOutsideCursor = i < startCursor || endCursor < i;\n const isVirtualItems = isMinimizeItems && isOutsideCursor;\n const isVirtualGroup = isMinimizeGroups && isOutsideCursor;\n const gridItems = grid.getItems() as InfiniteGridItem[];\n const items = isVirtualGroup\n ? []\n : gridItems.map((item) => isVirtualItems ? item.getVirtualStatus() : item.getMinimizedStatus());\n\n return {\n type: isVirtualGroup || isVirtualItems ? GROUP_TYPE.VIRTUAL : GROUP_TYPE.NORMAL,\n groupKey: groupKey,\n outlines: grid.getOutlines(),\n items,\n };\n });\n\n\n const totalItems = this.getGroupItems();\n\n const itemStartCursor = totalItems.indexOf(startGroup?.items[0]);\n const itemEndCursor = totalItems.indexOf(endGroup?.items.slice().reverse()[0]);\n\n return {\n cursors: [startCursor, endCursor],\n orgCursors: [orgStartCursor, orgEndCursor],\n itemCursors: [itemStartCursor, itemEndCursor],\n startGroupKey: startGroup?.groupKey,\n endGroupKey: endGroup?.groupKey,\n groups: groupStatus,\n outlines: this.outlines,\n };\n }\n protected fitOutlines(useFit = this.useFit) {\n const groups = this.groups;\n const firstGroup = groups[0];\n\n if (!firstGroup) {\n return;\n }\n const outlines = firstGroup.grid.getOutlines();\n const startOutline = outlines.start;\n const outlineOffset = startOutline.length ? Math.min(...startOutline) : 0;\n\n // If the outline is less than 0, a fit occurs forcibly.\n if (!useFit && outlineOffset > 0) {\n return;\n }\n\n groups.forEach(({ grid }) => {\n const { start, end } = grid.getOutlines();\n\n grid.setOutlines({\n start: start.map((point) => point - outlineOffset),\n end: end.map((point) => point - outlineOffset),\n });\n });\n\n this.groupItems.forEach((item) => {\n const contentPos = item.cssContentPos;\n\n if (!isNumber(contentPos)) {\n return;\n }\n item.cssContentPos = contentPos - outlineOffset;\n });\n }\n public setGroupStatus(status: GroupManagerStatus) {\n this.itemKeys = {};\n this.groupItems = [];\n this.items = [];\n const prevGroupKeys = this.groupKeys;\n\n const nextGroups: InfiniteGridGroup[] = status.groups.map(({\n type,\n groupKey,\n items,\n outlines,\n }) => {\n const nextItems = this._syncItemInfos(items);\n const grid = prevGroupKeys[groupKey]?.grid ?? this._makeGrid();\n\n grid.setOutlines(outlines);\n grid.setItems(nextItems);\n\n return {\n type,\n groupKey,\n grid,\n items: nextItems,\n renderItems: nextItems,\n };\n });\n\n this.setOutlines(status.outlines);\n this._registerGroups(nextGroups);\n this._updatePlaceholder();\n this.setCursors(status.cursors[0], status.cursors[1]);\n }\n public appendPlaceholders(items: number | InfiniteGridItemStatus[], groupKey?: string | number) {\n return this.insertPlaceholders(\"end\", items, groupKey);\n }\n public prependPlaceholders(items: number | InfiniteGridItemStatus[], groupKey?: string | number) {\n return this.insertPlaceholders(\"start\", items, groupKey);\n }\n public removePlaceholders(type: \"start\" | \"end\" | { groupKey: string | number }) {\n const groups = this.groups;\n const length = groups.length;\n\n if (type === \"start\") {\n const index = findIndex(groups, (group) => group.type === GROUP_TYPE.NORMAL);\n\n groups.splice(0, index);\n\n } else if (type === \"end\") {\n const index = findLastIndex(groups, (group) => group.type === GROUP_TYPE.NORMAL);\n\n groups.splice(index + 1, length - index - 1);\n } else {\n const groupKey = type.groupKey;\n\n const index = findIndex(groups, (group) => group.groupKey === groupKey);\n\n if (index > -1) {\n groups.splice(index, 1);\n }\n }\n\n this.syncItems(flatGroups(this.getGroups()));\n }\n public insertPlaceholders(\n direction: \"start\" | \"end\",\n items: number | InfiniteGridItemStatus[],\n groupKey: string | number = makeKey(this.groupKeys),\n ) {\n\n let infos: InfiniteGridItemInfo[] = [];\n\n if (isNumber(items)) {\n infos = range(items).map(() => ({ type: ITEM_TYPE.VIRTUAL, groupKey }));\n } else if (Array.isArray(items)) {\n infos = items.map((status) => ({\n groupKey,\n ...status,\n type: ITEM_TYPE.VIRTUAL,\n }));\n }\n const grid = this._makeGrid();\n const nextItems = this._syncItemInfos(infos, this.itemKeys);\n\n this._updatePlaceholder(nextItems);\n grid.setItems(nextItems);\n\n const group = {\n type: GROUP_TYPE.VIRTUAL,\n groupKey,\n grid,\n items: nextItems,\n renderItems: nextItems,\n };\n\n this.groupKeys[groupKey] = group;\n\n if (direction === \"end\") {\n this.groups.push(group);\n this.groupItems.push(...nextItems);\n } else {\n this.groups.splice(0, 0, group);\n this.groupItems.splice(0, 0, ...nextItems);\n if (this.startCursor > -1) {\n ++this.startCursor;\n ++this.endCursor;\n }\n }\n\n\n return {\n group,\n items: nextItems,\n };\n }\n\n public shouldRerenderItems() {\n let isRerender = false;\n\n this.getVisibleGroups().forEach((group) => {\n const items = group.items;\n\n if (\n items.length === group.renderItems.length\n || items.every((item) => item.mountState === MOUNT_STATE.UNCHECKED)\n ) {\n return;\n }\n isRerender = true;\n group.renderItems = [...items];\n });\n if (isRerender) {\n this.items = this._getRenderingItems();\n }\n return isRerender;\n }\n\n private _getGroupItems() {\n return flatGroups(this.getGroups(true));\n }\n\n private _getRenderingItems() {\n const items = flat(this.getVisibleGroups(true).map((item) => item.renderItems));\n\n\n const loadingGrid = this._loadingGrid;\n const loadingItem = loadingGrid.getLoadingItem();\n\n if (loadingItem) {\n if (loadingGrid.type === \"end\") {\n items.push(loadingItem);\n } else if (loadingGrid.type === \"start\") {\n items.unshift(loadingItem);\n }\n }\n\n return items;\n }\n\n private _checkShouldRender(options: Record) {\n const GridConstructor = this.options.gridConstructor!;\n const prevOptions = this.gridOptions;\n const propertyTypes = GridConstructor.propertyTypes;\n\n for (const name in prevOptions) {\n if (!(name in options) && propertyTypes[name] === PROPERTY_TYPE.RENDER_PROPERTY) {\n return true;\n }\n }\n for (const name in options) {\n if (prevOptions[name] !== options[name] && propertyTypes[name] === PROPERTY_TYPE.RENDER_PROPERTY) {\n return true;\n }\n }\n return false;\n }\n private _applyVirtualGrid(grid: Grid, direction: \"start\" | \"end\", outline: number[]) {\n const startOutline = outline.length ? [...outline] : [0];\n const prevOutlines = grid.getOutlines();\n const prevOutline = prevOutlines[direction === \"end\" ? \"start\" : \"end\"];\n\n if (\n prevOutline.length !== startOutline.length\n || prevOutline.some((value, i) => value !== startOutline[i])\n ) {\n return {\n start: [...startOutline],\n end: [...startOutline],\n };\n }\n return prevOutlines;\n }\n private _syncItemInfos(\n nextItemInfos: InfiniteGridItemStatus[],\n prevItemKeys: Record = {},\n ) {\n const horizontal = this.options.horizontal;\n const nextItemKeys = this.itemKeys;\n\n nextItemInfos.filter((info) => info.key != null).forEach((info) => {\n const key = info.key!;\n const prevItem = prevItemKeys[key];\n\n if (!prevItem) {\n nextItemKeys[key] = new InfiniteGridItem(horizontal, {\n ...info,\n });\n } else if (prevItem.type === ITEM_TYPE.VIRTUAL && info.type !== ITEM_TYPE.VIRTUAL) {\n nextItemKeys[key] = new InfiniteGridItem(horizontal, {\n orgRect: prevItem.orgRect,\n rect: prevItem.rect,\n ...info,\n });\n } else {\n if (info.data) {\n prevItem.data = info.data;\n }\n nextItemKeys[key] = prevItem;\n }\n });\n const nextItems = nextItemInfos.map((info) => {\n let key = info.key!;\n\n if (info.key == null) {\n key = makeKey(nextItemKeys);\n }\n let item = nextItemKeys[key];\n\n if (!item) {\n const prevItem = prevItemKeys[key];\n\n if (prevItem) {\n item = prevItem;\n\n if (info.data) {\n item.data = info.data;\n }\n } else {\n item = new InfiniteGridItem(horizontal, {\n ...info,\n key,\n });\n }\n nextItemKeys[key] = item;\n }\n return item;\n });\n return nextItems;\n }\n private _registerGroups(groups: InfiniteGridGroup[]) {\n const nextGroupKeys: Record = {};\n\n groups.forEach((group) => {\n nextGroupKeys[group.groupKey] = group;\n });\n\n this.groups = groups;\n this.groupKeys = nextGroupKeys;\n this.groupItems = this._getGroupItems();\n }\n private _splitVirtualGroups(direction: \"start\" | \"end\", nextGroups: CategorizedGroup[]) {\n const groups = splitVirtualGroups(this.groups, direction, nextGroups);\n const itemKeys = this.itemKeys;\n\n groups.forEach(({ renderItems }) => {\n renderItems.forEach((item) => {\n itemKeys[item.key] = item;\n });\n });\n\n return groups;\n }\n private _mergeVirtualGroups(groups: Array>) {\n const itemKeys = this.itemKeys;\n const groupKeys = this.groupKeys;\n\n groups.forEach((group) => {\n const prevGroup = groupKeys[group.groupKey];\n\n if (!prevGroup) {\n return;\n }\n const items = group.items;\n\n if (items.every((item) => item.mountState === MOUNT_STATE.UNCHECKED)) {\n prevGroup.renderItems.forEach((item) => {\n if (item.type === ITEM_TYPE.VIRTUAL && !itemKeys[item.key]) {\n items.push(item);\n itemKeys[item.key] = item;\n }\n });\n }\n });\n return groups;\n }\n\n private _updatePlaceholder(items = this.groupItems) {\n const placeholder = this._placeholder;\n\n if (!placeholder) {\n return;\n }\n\n items.filter((item) => item.type === ITEM_TYPE.VIRTUAL).forEach((item) => {\n setPlaceholder(item, placeholder);\n });\n }\n private _makeGrid() {\n const GridConstructor = this.options.gridConstructor!;\n const gridOptions = this.gridOptions;\n const container = this.containerElement;\n\n return new GridConstructor(container, {\n ...gridOptions,\n useFit: false,\n autoResize: false,\n useResizeObserver: false,\n observeChildren: false,\n renderOnPropertyChange: false,\n externalContainerManager: this.containerManager,\n externalItemRenderer: this.itemRenderer,\n });\n }\n private _getLoadingGroup(): InfiniteGridGroup {\n const loadingGrid = this._loadingGrid;\n const items = loadingGrid.getItems() as InfiniteGridItem[];\n\n return {\n groupKey: LOADING_GROUP_KEY,\n type: GROUP_TYPE.NORMAL,\n grid: loadingGrid,\n items,\n renderItems: items,\n };\n }\n private _getLoadingItem() {\n return this._loadingGrid.getLoadingItem();\n }\n}\n\nexport interface GroupManager extends Properties {\n getItems(): InfiniteGridItem[];\n}\n","import Component from \"@egjs/component\";\nimport { diff } from \"@egjs/list-differ\";\nimport { DIRECTION } from \"./consts\";\nimport { findIndex, findLastIndex, getNextCursors, isFlatOutline } from \"./utils\";\n\nexport interface OnInfiniteRequestAppend {\n key?: string | number | undefined;\n nextKey?: string | number | undefined;\n nextKeys?: Array;\n isVirtual: boolean;\n}\n\nexport interface OnInfiniteRequestPrepend {\n key?: string | number;\n nextKey?: string | number;\n nextKeys?: Array;\n isVirtual: boolean;\n}\n\nexport interface OnInfiniteChange {\n prevStartCursor: number;\n prevEndCursor: number;\n nextStartCursor: number;\n nextEndCursor: number;\n}\n\nexport interface InfiniteEvents {\n requestAppend: OnInfiniteRequestAppend;\n requestPrepend: OnInfiniteRequestPrepend;\n change: OnInfiniteChange;\n}\n\nexport interface InfiniteOptions {\n useRecycle?: boolean;\n threshold?: number;\n defaultDirection?: \"start\" | \"end\";\n}\n\nexport interface InfiniteItem {\n key: string | number;\n startOutline: number[];\n endOutline: number[];\n isVirtual?: boolean;\n}\n\nexport class Infinite extends Component {\n public options: Required;\n protected startCursor = -1;\n protected endCursor = -1;\n protected size = 0;\n protected items: InfiniteItem[] = [];\n protected itemKeys: Record = {};\n constructor(options: InfiniteOptions) {\n super();\n this.options = {\n threshold: 0,\n useRecycle: true,\n defaultDirection: \"end\",\n ...options,\n };\n }\n public scroll(scrollPos: number) {\n const prevStartCursor = this.startCursor;\n const prevEndCursor = this.endCursor;\n const items = this.items;\n const length = items.length;\n const size = this.size;\n const {\n defaultDirection,\n threshold,\n useRecycle,\n } = this.options;\n const isDirectionEnd = defaultDirection === \"end\";\n\n if (!length) {\n this.trigger(isDirectionEnd ? \"requestAppend\" : \"requestPrepend\", {\n key: undefined,\n isVirtual: false,\n });\n return;\n } else if (prevStartCursor === -1 || prevEndCursor === -1) {\n const nextCursor = isDirectionEnd ? 0 : length - 1;\n this.trigger(\"change\", {\n prevStartCursor,\n prevEndCursor,\n nextStartCursor: nextCursor,\n nextEndCursor: nextCursor,\n });\n return;\n }\n\n const endScrollPos = scrollPos + size;\n const startEdgePos = Math.max(...items[prevStartCursor].startOutline);\n const endEdgePos = Math.min(...items[prevEndCursor].endOutline);\n const visibles = items.map((item) => {\n const {\n startOutline,\n endOutline,\n } = item;\n\n if (!startOutline.length || !endOutline.length) {\n return false;\n }\n const startPos = Math.min(...startOutline);\n const endPos = Math.max(...endOutline);\n\n if (startPos - threshold <= endScrollPos && scrollPos <= endPos + threshold) {\n return true;\n }\n return false;\n });\n const hasStartItems = 0 < prevStartCursor;\n const hasEndItems = prevEndCursor < length - 1;\n const isStart = scrollPos <= startEdgePos + threshold;\n const isEnd = endScrollPos >= endEdgePos - threshold;\n let nextStartCursor = visibles.indexOf(true);\n let nextEndCursor = visibles.lastIndexOf(true);\n\n if (nextStartCursor === -1) {\n nextStartCursor = prevStartCursor;\n nextEndCursor = prevEndCursor;\n }\n\n if (!useRecycle) {\n nextStartCursor = Math.min(nextStartCursor, prevStartCursor);\n nextEndCursor = Math.max(nextEndCursor, prevEndCursor);\n }\n if (nextStartCursor === prevStartCursor && hasStartItems && isStart) {\n nextStartCursor -= 1;\n }\n if (nextEndCursor === prevEndCursor && hasEndItems && isEnd) {\n nextEndCursor += 1;\n }\n let nextVisibleItems = items.slice(nextStartCursor, nextEndCursor + 1);\n\n // It must contain no virtual items.\n if (nextVisibleItems.every((item) => item.isVirtual === true)) {\n // The real item can be in either the start or end direction.\n let hasRealItem = false;\n\n for (let i = nextStartCursor - 1; i >= 0; --i) {\n if (!items[i].isVirtual) {\n nextStartCursor = i;\n hasRealItem = true;\n break;\n }\n }\n if (!hasRealItem) {\n for (let i = nextEndCursor + 1; i < length; ++i) {\n if (!items[i].isVirtual) {\n nextEndCursor = i;\n hasRealItem = true;\n break;\n }\n }\n }\n if (hasRealItem) {\n nextVisibleItems = items.slice(nextStartCursor, nextEndCursor + 1);\n }\n }\n\n const hasVirtualItems = nextVisibleItems.some((item) => item.isVirtual === true);\n\n if (prevStartCursor !== nextStartCursor || prevEndCursor !== nextEndCursor) {\n this.trigger(\"change\", {\n prevStartCursor,\n prevEndCursor,\n nextStartCursor,\n nextEndCursor,\n });\n\n if (!hasVirtualItems) {\n return;\n }\n }\n\n // If a virtual item is included, a requestPrepend (or requestAppend) event is triggered.\n if (hasVirtualItems) {\n const isStartVirtual = nextVisibleItems[0]?.isVirtual;\n const isEndVirtual = nextVisibleItems[nextVisibleItems.length - 1]?.isVirtual;\n\n if ((!isDirectionEnd || !isEnd) && isStartVirtual) {\n const realItemIndex = findIndex(nextVisibleItems, (item) => !item.isVirtual);\n const endVirtualItemIndex = (realItemIndex === -1 ? nextVisibleItems.length : realItemIndex) - 1;\n\n if (nextVisibleItems[endVirtualItemIndex]) {\n this.trigger(\"requestPrepend\", {\n key: nextVisibleItems[realItemIndex].key,\n nextKey: nextVisibleItems[endVirtualItemIndex].key,\n nextKeys: nextVisibleItems.slice(0, endVirtualItemIndex + 1).map((item) => item.key),\n isVirtual: true,\n });\n }\n } else if ((isDirectionEnd || !isStart) && isEndVirtual) {\n const realItemIndex = findLastIndex(nextVisibleItems, (item) => !item.isVirtual);\n const startVirtualItemIndex = realItemIndex + 1;\n\n if (nextVisibleItems[startVirtualItemIndex]) {\n this.trigger(\"requestAppend\", {\n key: nextVisibleItems[realItemIndex].key,\n nextKey: nextVisibleItems[startVirtualItemIndex].key,\n nextKeys: nextVisibleItems.slice(startVirtualItemIndex).map((item) => item.key),\n isVirtual: true,\n });\n }\n }\n } else if (!this._requestVirtualItems()) {\n if ((!isDirectionEnd || !isEnd) && isStart) {\n this.trigger(\"requestPrepend\", {\n key: items[prevStartCursor].key,\n isVirtual: false,\n });\n } else if ((isDirectionEnd || !isStart) && isEnd) {\n this.trigger(\"requestAppend\", {\n key: items[prevEndCursor].key,\n isVirtual: false,\n });\n }\n }\n }\n\n /**\n * Call the requestAppend or requestPrepend event to fill the virtual items.\n * @ko virtual item을 채우기 위해 requestAppend 또는 requestPrepend 이벤트를 호출합니다.\n * @return - Whether the event is called. 이벤트를 호출했는지 여부.\n */\n public _requestVirtualItems() {\n const isDirectionEnd = this.options.defaultDirection === \"end\";\n const items = this.items;\n const totalVisibleItems = this.getVisibleItems();\n const visibleItems = totalVisibleItems.filter((item) => !item.isVirtual);\n const totalVisibleLength = totalVisibleItems.length;\n const visibleLength = visibleItems.length;\n const startCursor = this.getStartCursor();\n const endCursor = this.getEndCursor();\n\n if (visibleLength === totalVisibleLength) {\n return false;\n } else if (visibleLength) {\n const startKey = visibleItems[0].key;\n const endKey = visibleItems[visibleLength - 1].key;\n const startIndex = findIndex(items, (item) => item.key === startKey) - 1;\n const endIndex = findIndex(items, (item) => item.key === endKey) + 1;\n\n const isEnd = endIndex <= endCursor;\n const isStart = startIndex >= startCursor;\n\n // Fill the placeholder with the original item.\n if ((isDirectionEnd || !isStart) && isEnd) {\n this.trigger(\"requestAppend\", {\n key: endKey,\n nextKey: items[endIndex].key,\n isVirtual: true,\n });\n return true;\n } else if ((!isDirectionEnd || !isEnd) && isStart) {\n this.trigger(\"requestPrepend\", {\n key: startKey,\n nextKey: items[startIndex].key,\n isVirtual: true,\n });\n return true;\n }\n } else if (totalVisibleLength) {\n const lastItem = totalVisibleItems[totalVisibleLength - 1];\n\n if (isDirectionEnd) {\n this.trigger(\"requestAppend\", {\n nextKey: totalVisibleItems[0].key,\n isVirtual: true,\n });\n } else {\n this.trigger(\"requestPrepend\", {\n nextKey: lastItem.key,\n isVirtual: true,\n });\n }\n return true;\n }\n return false;\n }\n public setCursors(startCursor: number, endCursor: number) {\n this.startCursor = startCursor;\n this.endCursor = endCursor;\n }\n public setSize(size: number) {\n this.size = size;\n }\n public getStartCursor() {\n return this.startCursor;\n }\n public getEndCursor() {\n return this.endCursor;\n }\n public isLoading(direction: \"start\" | \"end\") {\n const startCursor = this.startCursor;\n const endCursor = this.endCursor;\n const items = this.items;\n const firstItem = items[startCursor]!;\n const lastItem = items[endCursor]!;\n const length = items.length;\n\n if (\n direction === DIRECTION.END\n && endCursor > -1\n && endCursor < length - 1\n && !lastItem.isVirtual\n && !isFlatOutline(lastItem.startOutline, lastItem.endOutline)\n ) {\n return false;\n }\n if (\n direction === DIRECTION.START\n && startCursor > 0\n && !firstItem.isVirtual\n && !isFlatOutline(firstItem.startOutline, firstItem.endOutline)\n ) {\n return false;\n }\n return true;\n }\n public setItems(nextItems: InfiniteItem[]) {\n this.items = nextItems;\n\n const itemKeys: Record = {};\n\n nextItems.forEach((item) => {\n itemKeys[item.key] = item;\n });\n this.itemKeys = itemKeys;\n }\n public syncItems(nextItems: InfiniteItem[]) {\n const prevItems = this.items;\n const prevStartCursor = this.startCursor;\n const prevEndCursor = this.endCursor;\n const {\n startCursor: nextStartCursor,\n endCursor: nextEndCursor,\n } = getNextCursors(\n this.items.map((item) => item.key),\n nextItems.map((item) => item.key),\n prevStartCursor,\n prevEndCursor,\n );\n // sync items between cursors\n let isChange = nextEndCursor - nextStartCursor !== prevEndCursor - prevStartCursor\n || (prevStartCursor === -1 || nextStartCursor === -1);\n\n if (!isChange) {\n const prevVisibleItems = prevItems.slice(prevStartCursor, prevEndCursor + 1);\n const nextVisibleItems = nextItems.slice(nextStartCursor, nextEndCursor + 1);\n const visibleResult = diff(prevVisibleItems, nextVisibleItems, (item) => item.key);\n\n isChange = visibleResult.added.length > 0\n || visibleResult.removed.length > 0\n || visibleResult.changed.length > 0;\n }\n this.setItems(nextItems);\n this.setCursors(nextStartCursor, nextEndCursor);\n return isChange;\n }\n public getItems() {\n return this.items;\n }\n public getVisibleItems() {\n const startCursor = this.startCursor;\n const endCursor = this.endCursor;\n\n if (startCursor === -1) {\n return [];\n }\n return this.items.slice(startCursor, endCursor + 1);\n }\n public getItemByKey(key: string | number) {\n return this.itemKeys[key];\n }\n public getRenderedVisibleItems() {\n const items = this.getVisibleItems();\n const rendered = items.map(({ startOutline, endOutline }) => {\n const length = startOutline.length;\n\n if (length === 0 || length !== endOutline.length) {\n return false;\n }\n return startOutline.some((pos, i) => endOutline[i] !== pos);\n });\n const startIndex = rendered.indexOf(true);\n const endIndex = rendered.lastIndexOf(true);\n\n return endIndex === -1 ? [] : items.slice(startIndex, endIndex + 1);\n }\n public destroy() {\n this.off();\n this.startCursor = -1;\n this.endCursor = -1;\n this.items = [];\n this.size = 0;\n }\n}\n","import Component from \"@egjs/component\";\nimport { diff, DiffResult } from \"@egjs/list-differ\";\nimport { toArray } from \"../utils\";\n\nexport interface RendererItem {\n key: string | number;\n renderKey?: string;\n element?: Element | null;\n}\n\nexport interface OnRendererUpdated {\n items: T[];\n elements: Element[];\n isChanged: boolean;\n isItemChanged: boolean;\n state: Record;\n diffResult: DiffResult;\n}\n\nexport interface OnRendererUpdate {\n state: Record;\n}\nexport interface RendererEvents {\n update: OnRendererUpdate;\n updated: OnRendererUpdated;\n requestUpdate: OnRendererUpdate;\n}\n\nexport class Renderer extends Component {\n protected items: Item[] = [];\n protected container: Element | null = null;\n protected rendererKey = 0;\n private _diffResult: DiffResult;\n private _updateTimer = 0;\n private _state: Record = {};\n private _isItemChanged = false;\n\n public updateKey() {\n this.rendererKey = Date.now();\n }\n\n public getItems() {\n return this.items;\n }\n public setContainer(container: Element) {\n this.container = container;\n }\n public render(nextItems: Item[], state?: Record) {\n return this.syncItems(nextItems, state);\n }\n public update(state: Record = {}) {\n this._state = { ...this._state, ...state };\n this.trigger(\"update\", {\n state,\n });\n\n clearTimeout(this._updateTimer);\n this._updateTimer = window.setTimeout(() => {\n this.trigger(\"requestUpdate\", {\n state,\n });\n });\n }\n public updated(nextElements: ArrayLike = this.container?.children ?? []) {\n const diffResult = this._diffResult;\n const isChanged = !!(diffResult.added.length || diffResult.removed.length || diffResult.changed.length);\n const state = this._state;\n const isItemChanged = this._isItemChanged;\n const nextItems = diffResult.list;\n\n\n this._isItemChanged = false;\n this._state = {};\n this.items = nextItems;\n nextItems.forEach((item, i) => {\n item.element = nextElements[i];\n });\n\n\n this.trigger(\"updated\", {\n items: nextItems,\n elements: toArray(nextElements),\n diffResult: this._diffResult,\n state,\n isItemChanged,\n isChanged,\n });\n\n return isChanged;\n }\n public syncItems(items: Item[], state: Record = {}) {\n const rendererKey = this.rendererKey;\n const prevItems = this.items;\n const nextItems = items.map((item) => ({\n ...item,\n renderKey: `${rendererKey}_${item.key}`,\n }));\n const result = diff(prevItems, nextItems, (item) => item.renderKey!);\n\n this._isItemChanged = !!result.added.length || !!result.removed.length || !!result.changed.length;\n this._state = { ...this._state, ...state };\n this._diffResult = result;\n\n return result;\n }\n public destroy() {\n this.off();\n }\n}\n","import { Renderer, RendererItem } from \"./Renderer\";\n\nexport class VanillaRenderer extends Renderer {\n public render(nextItems: Item[], state?: Record) {\n const container = this.container!;\n const result = super.render(nextItems, state);\n const {\n prevList,\n removed,\n ordered,\n added,\n list,\n } = result;\n const diffList = [...prevList];\n\n\n removed.forEach((index) => {\n diffList.splice(index, 1);\n container.removeChild(prevList[index].element!);\n });\n ordered.forEach(([prevIndex, nextIndex]) => {\n const item = diffList.splice(prevIndex, 1)[0];\n\n diffList.splice(nextIndex, 0, item);\n container.insertBefore(item.element!, diffList[nextIndex + 1]?.element ?? null);\n });\n added.forEach((index) => {\n const item = list[index];\n\n diffList.splice(index, 0, item);\n container.insertBefore(item.element!, diffList[index + 1]?.element ?? null);\n });\n\n this.updated(container.children);\n return result;\n }\n}\n","import { InfiniteGridItem } from \"../InfiniteGridItem\";\nimport { convertHTMLtoElement } from \"../utils\";\nimport { RendererItem } from \"./Renderer\";\nimport { VanillaRenderer } from \"./VanillaRenderer\";\n\nexport interface GridRendererItem extends RendererItem {\n orgItem: InfiniteGridItem;\n}\n\nexport class VanillaGridRenderer extends VanillaRenderer {\n public syncItems(nextItems: GridRendererItem[]) {\n const result = super.syncItems(nextItems);\n const {\n added,\n list,\n } = result;\n added.forEach((index) => {\n const orgItem = nextItems[index].orgItem;\n\n if (orgItem.html && !orgItem.element) {\n orgItem.element = convertHTMLtoElement(orgItem.html)[0];\n }\n list[index].element = orgItem.element!;\n });\n\n return result;\n }\n}\n","import Component, { ComponentEvent } from \"@egjs/component\";\nimport { CONTAINER_CLASS_NAME, IS_IOS } from \"./consts\";\nimport { OnChangeScroll } from \"./types\";\nimport { isWindow, toArray } from \"./utils\";\n\nexport interface ScrollManagerOptions {\n container?: HTMLElement | boolean | string;\n containerTag?: string;\n horizontal?: boolean;\n}\n\nexport interface ScrollManagerStatus {\n contentSize: number;\n scrollOffset: number;\n prevScrollPos: number;\n}\n\n\nexport interface ScrollManagerEvents {\n scroll: OnChangeScroll;\n}\n\nexport class ScrollManager extends Component {\n public options: Required;\n protected prevScrollPos: number | null = null;\n protected eventTarget: HTMLElement | Window;\n protected scrollOffset = 0;\n protected contentSize = 0;\n protected container: HTMLElement;\n protected scrollContainer: HTMLElement;\n private _orgCSSText: string;\n private _isScrollIssue = IS_IOS;\n private _isCreateElement: boolean;\n\n constructor(\n protected wrapper: HTMLElement,\n options: ScrollManagerOptions,\n ) {\n super();\n this.options = {\n container: false,\n containerTag: \"div\",\n horizontal: false,\n ...options,\n };\n\n this._init();\n }\n public getWrapper() {\n return this.wrapper;\n }\n public getContainer() {\n return this.container;\n }\n public getScrollContainer() {\n return this.scrollContainer;\n }\n public getScrollOffset() {\n return this.scrollOffset;\n }\n public getContentSize() {\n return this.contentSize;\n }\n public getRelativeScrollPos() {\n return (this.prevScrollPos || 0) - this.scrollOffset;\n }\n public getScrollPos() {\n return this.prevScrollPos;\n }\n public setScrollPos(pos: number) {\n this.prevScrollPos = pos;\n }\n public getOrgScrollPos() {\n const eventTarget = this.eventTarget;\n const horizontal = this.options.horizontal;\n\n const prop = `scroll${horizontal ? \"Left\" : \"Top\"}` as \"scrollLeft\" | \"scrollTop\";\n\n if (isWindow(eventTarget)) {\n return window[horizontal ? \"pageXOffset\" : \"pageYOffset\"]\n || document.documentElement[prop] || document.body[prop];\n } else {\n return eventTarget[prop];\n }\n }\n public setStatus(status: ScrollManagerStatus) {\n this.contentSize = status.contentSize;\n this.scrollOffset = status.scrollOffset;\n this.prevScrollPos = status.prevScrollPos;\n\n this.scrollTo(this.prevScrollPos);\n }\n public getStatus(): ScrollManagerStatus {\n return {\n contentSize: this.contentSize,\n scrollOffset: this.scrollOffset,\n prevScrollPos: this.prevScrollPos!,\n };\n }\n public scrollTo(pos: number) {\n const eventTarget = this.eventTarget;\n const horizontal = this.options.horizontal;\n const [x, y] = horizontal ? [pos, 0] : [0, pos];\n\n if (isWindow(eventTarget)) {\n eventTarget.scroll(x, y);\n } else {\n eventTarget.scrollLeft = x;\n eventTarget.scrollTop = y;\n }\n }\n public scrollBy(pos: number) {\n if (!pos) {\n return;\n }\n const eventTarget = this.eventTarget;\n const horizontal = this.options.horizontal;\n const [x, y] = horizontal ? [pos, 0] : [0, pos];\n\n\n this.prevScrollPos! += pos;\n\n if (isWindow(eventTarget)) {\n eventTarget.scrollBy(x, y);\n } else {\n eventTarget.scrollLeft += x;\n eventTarget.scrollTop += y;\n }\n }\n public resize() {\n const scrollContainer = this.scrollContainer;\n const horizontal = this.options.horizontal;\n const isBody = scrollContainer === document.body;\n const scrollContainerRect = isBody\n ? { top: 0, left: 0 }\n : scrollContainer.getBoundingClientRect();\n const containerRect = this.container.getBoundingClientRect();\n\n this.scrollOffset = (this.prevScrollPos! || 0) + (horizontal\n ? containerRect.left - scrollContainerRect.left\n : containerRect.top - scrollContainerRect.top);\n\n if (isBody) {\n this.contentSize = horizontal ? window.innerWidth : window.innerHeight;\n } else {\n this.contentSize = horizontal ? scrollContainer.offsetWidth : scrollContainer.offsetHeight;\n }\n }\n public destroy() {\n const container = this.container;\n\n this.eventTarget.removeEventListener(\"scroll\", this._onCheck);\n\n if (this._isCreateElement) {\n const scrollContainer = this.scrollContainer;\n\n const fragment = document.createDocumentFragment();\n const childNodes = toArray(container.childNodes);\n\n scrollContainer.removeChild(container);\n childNodes.forEach((childNode) => {\n fragment.appendChild(childNode);\n });\n scrollContainer.appendChild(fragment);\n } else if (this.options.container) {\n container.style.cssText = this._orgCSSText;\n }\n }\n private _init() {\n const {\n container: containerOption,\n containerTag,\n horizontal,\n } = this.options;\n const wrapper = this.wrapper;\n let scrollContainer = wrapper;\n let container = wrapper;\n let containerCSSText = \"\";\n\n if (!containerOption) {\n scrollContainer = document.body;\n containerCSSText = container.style.cssText;\n } else {\n if (containerOption instanceof HTMLElement) {\n // Container that already exists\n container = containerOption;\n } else if (containerOption === true) {\n // Create Container\n container = document.createElement(containerTag) as HTMLElement;\n\n container.style.position = \"relative\";\n container.className = CONTAINER_CLASS_NAME;\n const childNodes = toArray(scrollContainer.childNodes);\n\n childNodes.forEach((childNode) => {\n container.appendChild(childNode);\n });\n scrollContainer.appendChild(container);\n\n this._isCreateElement = true;\n } else {\n // Find Container by Selector\n container = scrollContainer.querySelector(containerOption) as HTMLElement;\n }\n containerCSSText = container.style.cssText;\n\n const style = scrollContainer.style;\n\n [style.overflowX, style.overflowY] = horizontal ? [\"scroll\", \"hidden\"] : [\"hidden\", \"scroll\"];\n\n if (horizontal) {\n container.style.height = \"100%\";\n }\n }\n const eventTarget = scrollContainer === document.body ? window : scrollContainer;\n\n eventTarget.addEventListener(\"scroll\", this._onCheck);\n this._orgCSSText = containerCSSText;\n this.container = container;\n this.scrollContainer = scrollContainer;\n this.eventTarget = eventTarget;\n this.resize();\n this.setScrollPos(this.getOrgScrollPos());\n }\n private _onCheck = () => {\n const prevScrollPos = this.getScrollPos();\n const nextScrollPos = this.getOrgScrollPos();\n\n this.setScrollPos(nextScrollPos);\n\n if (prevScrollPos === null || (this._isScrollIssue && nextScrollPos === 0) || prevScrollPos === nextScrollPos) {\n nextScrollPos && (this._isScrollIssue = false);\n return;\n }\n this._isScrollIssue = false;\n this.trigger(new ComponentEvent(\"scroll\", {\n direction: prevScrollPos < nextScrollPos ? \"end\" : \"start\",\n scrollPos: nextScrollPos,\n relativeScrollPos: this.getRelativeScrollPos(),\n }));\n }\n}\n","import Component, { ComponentEvent } from \"@egjs/component\";\nimport {\n ContainerManager,\n DEFAULT_GRID_OPTIONS,\n Properties,\n RenderOptions,\n MOUNT_STATE,\n OnContentError,\n ItemRenderer,\n GridItem,\n ResizeWatcherResizeEvent,\n getUpdatedItems,\n} from \"@egjs/grid\";\nimport {\n DIRECTION,\n GROUP_TYPE,\n INFINITEGRID_EVENTS, INFINITEGRID_PROPERTY_TYPES,\n ITEM_TYPE, STATUS_TYPE,\n} from \"./consts\";\nimport { GroupManager } from \"./GroupManager\";\nimport {\n Infinite,\n OnInfiniteChange,\n OnInfiniteRequestAppend,\n OnInfiniteRequestPrepend,\n} from \"./Infinite\";\nimport { InfiniteGridItem, InfiniteGridItemStatus } from \"./InfiniteGridItem\";\nimport { OnRendererUpdated } from \"./Renderer/Renderer\";\nimport { GridRendererItem, VanillaGridRenderer } from \"./Renderer/VanillaGridRenderer\";\nimport { ScrollManager } from \"./ScrollManager\";\nimport {\n InfiniteGridEvents, InfiniteGridGroup,\n InfiniteGridInsertedItems, InfiniteGridItemInfo,\n InfiniteGridOptions,\n InfiniteGridStatus,\n InsertedPlaceholdersResult,\n OnPickedRenderComplete,\n OnRequestInsert,\n OnChangeScroll,\n} from \"./types\";\nimport {\n InfiniteGridGetterSetter, toArray, convertInsertedItems, findIndex,\n findLastIndex, isString,\n} from \"./utils\";\n\n\n/**\n * A module used to arrange items including content infinitely according to layout type. With this module, you can implement various layouts composed of different items whose sizes vary. It guarantees performance by maintaining the number of DOMs the module is handling under any circumstance\n * @ko 콘텐츠가 있는 아이템을 레이아웃 타입에 따라 무한으로 배치하는 모듈. 다양한 크기의 아이템을 다양한 레이아웃으로 배치할 수 있다. 아이템의 개수가 계속 늘어나도 모듈이 처리하는 DOM의 개수를 일정하게 유지해 최적의 성능을 보장한다\n * @extends Component\n * @support {\"ie\": \"9+(with polyfill)\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"4.X+\"}\n * @example\n```html\n
    \n
  • \n
    test1
    \n
  • \n
  • \n
    test2
    \n
  • \n
  • \n
    test3
    \n
  • \n
  • \n
    test4
    \n
  • \n
  • \n
    test5
    \n
  • \n
  • \n
    test6
    \n
  • \n
\n\n```\n */\n@InfiniteGridGetterSetter\nclass InfiniteGrid extends Component {\n public static defaultOptions = {\n ...DEFAULT_GRID_OPTIONS,\n container: false,\n containerTag: \"div\",\n renderer: null,\n threshold: 100,\n useRecycle: true,\n } as Required;\n public static propertyTypes = INFINITEGRID_PROPERTY_TYPES;\n protected wrapperElement: HTMLElement;\n protected scrollManager: ScrollManager;\n protected itemRenderer: ItemRenderer;\n protected containerManager: ContainerManager;\n protected infinite: Infinite;\n protected groupManager: GroupManager;\n protected options: Required;\n private _waitType: \"\" | \"start\" | \"end\" = \"\";\n /**\n * @param - A base element for a module 모듈을 적용할 기준 엘리먼트\n * @param - The option object of the InfiniteGrid module eg.InfiniteGrid 모듈의 옵션 객체\n */\n constructor(wrapper: HTMLElement | string, options: Options) {\n super();\n this.options = {\n ...((this.constructor as typeof InfiniteGrid).defaultOptions as Required),\n renderer: new VanillaGridRenderer().on(\"requestUpdate\", () => this._render()),\n ...options,\n };\n\n const {\n gridConstructor,\n containerTag,\n container,\n renderer,\n threshold,\n useRecycle,\n ...gridOptions\n } = this.options;\n // options.container === false, wrapper = container, scrollContainer = document.body\n // options.container === true, wrapper = scrollContainer, container = wrapper's child\n // options.container === string,\n const {\n horizontal,\n attributePrefix,\n useTransform,\n percentage,\n isConstantSize,\n isEqualSize,\n autoResize,\n useResizeObserver,\n resizeDebounce,\n maxResizeDebounce,\n defaultDirection,\n } = gridOptions;\n const wrapperElement = isString(wrapper) ? document.querySelector(wrapper) as HTMLElement : wrapper;\n const scrollManager = new ScrollManager(wrapperElement, {\n container,\n containerTag,\n horizontal,\n }).on({\n scroll: this._onScroll,\n });\n const containerElement = scrollManager.getContainer();\n const containerManager = new ContainerManager(containerElement, {\n horizontal,\n autoResize,\n resizeDebounce,\n maxResizeDebounce,\n useResizeObserver,\n }).on(\"resize\", this._onResize);\n const itemRenderer = new ItemRenderer({\n attributePrefix,\n horizontal,\n useTransform,\n percentage,\n isEqualSize,\n isConstantSize,\n });\n const infinite = new Infinite({\n defaultDirection,\n useRecycle,\n threshold,\n }).on({\n \"change\": this._onChange,\n \"requestAppend\": this._onRequestAppend,\n \"requestPrepend\": this._onRequestPrepend,\n });\n\n infinite.setSize(scrollManager.getContentSize());\n const groupManager = new GroupManager(containerElement, {\n gridConstructor: gridConstructor!,\n externalItemRenderer: itemRenderer,\n externalContainerManager: containerManager,\n gridOptions,\n });\n\n groupManager.on({\n \"renderComplete\": this._onRenderComplete,\n \"contentError\": this._onContentError,\n });\n\n renderer!.setContainer(containerElement);\n renderer!.on(\"updated\", this._onRendererUpdated);\n\n this.itemRenderer = itemRenderer;\n this.groupManager = groupManager;\n this.wrapperElement = wrapperElement;\n this.scrollManager = scrollManager;\n this.containerManager = containerManager;\n this.infinite = infinite;\n\n this.containerManager.resize();\n }\n /**\n * Rearrange items to fit the grid and render them. When rearrange is complete, the `renderComplete` event is fired.\n * @ko grid에 맞게 아이템을 재배치하고 렌더링을 한다. 배치가 완료되면 `renderComplete` 이벤트가 발생한다.\n * @param - Options for rendering. 렌더링을 하기 위한 옵션.\n * @example\n * ```ts\n * import { MasonryInfiniteGrid } from \"@egjs/infinitegrid\";\n * const grid = new MasonryInfiniteGrid();\n *\n * grid.on(\"renderComplete\", e => {\n * console.log(e);\n * });\n * grid.renderItems();\n * ```\n */\n public renderItems(options: RenderOptions = {}) {\n this._renderItems(options);\n return this;\n }\n /**\n * Returns the wrapper element specified by the user.\n * @ko 컨테이너 엘리먼트를 반환한다.\n */\n public getWrapperElement() {\n return this.scrollManager.getWrapper();\n }\n /**\n * Returns the container element corresponding to the scroll area.\n * @ko 스크롤 영역에 해당하는 컨테이너 엘리먼트를 반환한다.\n */\n public getScrollContainerElement() {\n return this.scrollManager.getScrollContainer();\n }\n /**\n * Returns the container element containing item elements.\n * @ko 아이템 엘리먼트들을 담긴 컨테이너 엘리먼트를 반환한다.\n */\n public getContainerElement() {\n return this.scrollManager.getContainer();\n }\n /**\n * When items change, it synchronizes and renders items.\n * @ko items가 바뀐 경우 동기화를 하고 렌더링을 한다.\n * @param - Options for rendering. 렌더링을 하기 위한 옵션.\n */\n public syncItems(items: InfiniteGridItemInfo[]): this {\n this.groupManager.syncItems(items);\n this._syncGroups();\n\n return this;\n }\n /**\n * Change the currently visible groups.\n * @ko 현재 보이는 그룹들을 바꾼다.\n * @param - first index of visible groups. 보이는 그룹의 첫번째 index.\n * @param - last index of visible groups. 보이는 그룹의 마지막 index.\n * @param - Whether the first rendering has already been done. 첫 렌더링이 이미 되어있는지 여부.\n */\n public setCursors(startCursor: number, endCursor: number, useFirstRender?: boolean): this {\n this.groupManager.setCursors(startCursor, endCursor);\n this.infinite.setCursors(startCursor, endCursor);\n\n if (useFirstRender) {\n this._syncItems();\n } else {\n this._update();\n this._checkEndLoading();\n }\n return this;\n }\n /**\n * Returns the first index of visible groups.\n * @ko 보이는 그룹들의 첫번째 index를 반환한다.\n */\n public getStartCursor(): number {\n return this.infinite.getStartCursor();\n }\n /**\n * Returns the last index of visible groups.\n * @ko 보이는 그룹들의 마지막 index를 반환한다.\n */\n public getEndCursor(): number {\n return this.infinite.getEndCursor();\n }\n /**\n * Add items at the bottom(right) of the grid.\n * @ko 아이템들을 grid 아래(오른쪽)에 추가한다.\n * @param - items to be added 추가할 아이템들\n * @param - The group key to be configured in items. It is automatically generated by default. 추가할 아이템에 설정할 그룹 키. 생략하면 값이 자동으로 생성된다.\n * @return - An instance of a module itself모듈 자신의 인스턴스\n * @example\n * ```js\n * ig.append(`
test1
test2
`);\n * ig.append([`
test1
`, `
test2
`]);\n * ig.append([HTMLElement1, HTMLElement2]);\n * ```\n */\n public append(items: InfiniteGridInsertedItems, groupKey?: string | number): this {\n return this.insert(-1, items, groupKey);\n }\n /**\n * Add items at the top(left) of the grid.\n * @ko 아이템들을 grid 위(왼쪽)에 추가한다.\n * @param - items to be added 추가할 아이템들\n * @param - The group key to be configured in items. It is automatically generated by default. 추가할 아이템에 설정할 그룹 키. 생략하면 값이 자동으로 생성된다.\n * @return - An instance of a module itself모듈 자신의 인스턴스\n * @example\n * ```ts\n * ig.prepend(`
test1
test2
`);\n * ig.prepend([`
test1
`, `
test2
`]);\n * ig.prepend([HTMLElement1, HTMLElement2]);\n * ```\n */\n public prepend(items: InfiniteGridInsertedItems, groupKey?: string | number): this {\n return this.insert(0, items, groupKey);\n }\n /**\n * Add items to a specific index.\n * @ko 아이템들을 특정 index에 추가한다.\n * @param - index to add 추가하기 위한 index\n * @param - items to be added 추가할 아이템들\n * @param - The group key to be configured in items. It is automatically generated by default. 추가할 아이템에 설정할 그룹 키. 생략하면 값이 자동으로 생성된다.\n * @return - An instance of a module itself모듈 자신의 인스턴스\n * @example\n * ```ts\n * ig.insert(2, `
test1
test2
`);\n * ig.insert(3, [`
test1
`, `
test2
`]);\n * ig.insert(4, [HTMLElement1, HTMLElement2]);\n * ```\n */\n public insert(index: number, items: InfiniteGridInsertedItems, groupKey?: string | number): this {\n const nextItemInfos: InfiniteGridItemInfo[] = this.groupManager.getGroupItems();\n const itemInfos = convertInsertedItems(items, groupKey);\n\n if (index === -1) {\n nextItemInfos.push(...itemInfos);\n } else {\n nextItemInfos.splice(index, 0, ...itemInfos);\n }\n return this.syncItems(nextItemInfos);\n }\n /**\n * Add items based on group index.\n * @ko group의 index 기준으로 item들을 추가한다.\n * @param - group index to add 추가하기 위한 group의 index\n * @param - items to be added 추가할 아이템들\n * @param - The group key to be configured in items. It is automatically generated by default. 추가할 아이템에 설정할 그룹 키. 생략하면 값이 자동으로 생성된다.\n * @return - An instance of a module itself모듈 자신의 인스턴스\n * @example\n * ```ts\n * ig.insertByGroupIndex(2, `
test1
test2
`);\n * ig.insertByGroupIndex(3, [`
test1
`, `
test2
`]);\n * ig.insertByGroupIndex(4, [HTMLElement1, HTMLElement2]);\n * ```\n */\n public insertByGroupIndex(groupIndex: number, items: InfiniteGridInsertedItems, groupKey?: string | number): this {\n const nextGroupInfos: InfiniteGridGroup[] = this.groupManager.getGroups();\n const rightGroup = nextGroupInfos[groupIndex];\n\n if (!rightGroup) {\n return this.append(items, groupKey);\n }\n const nextItemInfos: InfiniteGridItemInfo[] = this.groupManager.getGroupItems();\n const rightGroupKey = rightGroup.groupKey;\n const rightItemIndex = findIndex(nextItemInfos, (item) => item.groupKey === rightGroupKey);\n\n return this.insert(rightItemIndex, items, groupKey);\n }\n /**\n * Returns the current state of a module such as location information. You can use the setStatus() method to restore the information returned through a call to this method.\n * @ko 아이템의 위치 정보 등 모듈의 현재 상태 정보를 반환한다. 이 메서드가 반환한 정보를 저장해 두었다가 setStatus() 메서드로 복원할 수 있다\n * @param - STATUS_TYPE.NOT_REMOVE = Get all information about items. STATUS_TYPE.REMOVE_INVISIBLE_ITEMS = Get information on visible items only. STATUS_TYPE.MINIMIZE_INVISIBLE_ITEMS = Compress invisible items. You can replace it with a placeholder. STATUS_TYPE.MINIMIZE_INVISIBLE_GROUPS = Compress invisible groups. STATUS_TYPE.NOT_REMOVE = 모든 아이템들의 정보를 가져온다. STATUS_TYPE.REMOVE_INVISIBLE_ITEMS = 보이는 아이템들의 정보만 가져온다. STATUS_TYPE.MINIMIZE_INVISIBLE_ITEMS = 안보이는 아이템들을 압축한다. placeholder로 대체가 가능하다. STATUS_TYPE.MINIMIZE_INVISIBLE_GROUPS = 안보이는 그룹을 압축한다.\n * @param - Whether to include items corresponding to placeholders. placeholder에 해당하는 아이템들을 포함할지 여부.\n */\n public getStatus(type?: STATUS_TYPE, includePlaceholders?: boolean): InfiniteGridStatus {\n return {\n containerManager: this.containerManager.getStatus(),\n itemRenderer: this.itemRenderer.getStatus(),\n groupManager: this.groupManager.getGroupStatus(type, includePlaceholders),\n scrollManager: this.scrollManager.getStatus(),\n };\n }\n\n /**\n * You can set placeholders to restore status or wait for items to be added.\n * @ko status 복구 또는 아이템 추가 대기를 위한 placeholder를 설정할 수 있다.\n * @param - The placeholder status. placeholder의 status\n */\n public setPlaceholder(info: Partial | null): this {\n this.groupManager.setPlaceholder(info);\n return this;\n }\n /**\n * You can set placeholders to restore status or wait for items to be added.\n * @ko status 복구 또는 아이템 추가 대기를 위한 placeholder를 설정할 수 있다.\n * @param - The placeholder status. placeholder의 status\n */\n public setLoading(info: Partial | null): this {\n this.groupManager.setLoading(info);\n return this;\n }\n /**\n * Add the placeholder at the end.\n * @ko placeholder들을 마지막에 추가한다.\n * @param - Items that correspond to placeholders. If it is a number, it duplicates the number of copies. placeholder에 해당하는 아이템들. 숫자면 갯수만큼 복제를 한다.\n * @param - The group key to be configured in items. It is automatically generated by default. 추가할 아이템에 설정할 그룹 키. 생략하면 값이 자동으로 생성된다.\n */\n public appendPlaceholders(\n items: number | InfiniteGridItemStatus[],\n groupKey?: string | number,\n ): InsertedPlaceholdersResult {\n const result = this.groupManager.appendPlaceholders(items, groupKey);\n\n this._syncGroups(true);\n return {\n ...result,\n remove: () => {\n this.removePlaceholders({ groupKey: result.group.groupKey });\n },\n };\n }\n /**\n * Add the placeholder at the start.\n * @ko placeholder들을 처음에 추가한다.\n * @param - Items that correspond to placeholders. If it is a number, it duplicates the number of copies. placeholder에 해당하는 아이템들. 숫자면 갯수만큼 복제를 한다.\n * @param - The group key to be configured in items. It is automatically generated by default. 추가할 아이템에 설정할 그룹 키. 생략하면 값이 자동으로 생성된다.\n */\n public prependPlaceholders(\n items: number | InfiniteGridItemStatus[],\n groupKey?: string | number,\n ): InsertedPlaceholdersResult {\n const result = this.groupManager.prependPlaceholders(items, groupKey);\n\n this._syncGroups(true);\n return {\n ...result,\n remove: () => {\n this.removePlaceholders({ groupKey: result.group.groupKey });\n },\n };\n }\n\n /**\n * Remove placeholders\n * @ko placeholder들을 삭제한다.\n * @param type - Remove the placeholders corresponding to the groupkey. When \"start\" or \"end\", remove all placeholders in that direction. groupkey에 해당하는 placeholder들을 삭제한다. \"start\" 또는 \"end\" 일 때 해당 방향의 모든 placeholder들을 삭제한다.\n */\n public removePlaceholders(type: \"start\" | \"end\" | { groupKey: string | number }) {\n this.groupManager.removePlaceholders(type);\n this._syncGroups(true);\n }\n\n /**\n * Sets the status of the InfiniteGrid module with the information returned through a call to the getStatus() method.\n * @ko getStatus() 메서드가 저장한 정보로 InfiniteGrid 모듈의 상태를 설정한다.\n * @param - status object of the InfiniteGrid module. InfiniteGrid 모듈의 status 객체.\n * @param - Whether the first rendering has already been done. 첫 렌더링이 이미 되어있는지 여부.\n */\n public setStatus(status: InfiniteGridStatus, useFirstRender?: boolean): this {\n this.itemRenderer.setStatus(status.itemRenderer);\n this.containerManager.setStatus(status.containerManager);\n this.scrollManager.setStatus(status.scrollManager);\n const groupManager = this.groupManager;\n const prevInlineSize = this.containerManager.getInlineSize();\n\n groupManager.setGroupStatus(status.groupManager);\n this._syncInfinite();\n this.infinite.setCursors(groupManager.getStartCursor(), groupManager.getEndCursor());\n\n this._getRenderer().updateKey();\n\n const state = {\n isResize: this.containerManager.getInlineSize() !== prevInlineSize,\n isRestore: true,\n };\n if (useFirstRender) {\n this._syncItems(state);\n } else {\n this._update(state);\n }\n return this;\n }\n /**\n * Removes the group corresponding to index.\n * @ko index에 해당하는 그룹을 제거 한다.\n */\n public removeGroupByIndex(index: number): this {\n const nextGroups = this.getGroups();\n\n return this.removeGroupByKey(nextGroups[index].groupKey);\n }\n /**\n * Removes the group corresponding to key.\n * @ko key에 해당하는 그룹을 제거 한다.\n */\n public removeGroupByKey(key: number | string): this {\n const nextItemInfos = this.getItems();\n\n const firstIndex = findIndex(nextItemInfos, (item) => item.groupKey === key);\n const lastIndex = findLastIndex(nextItemInfos, (item) => item.groupKey === key);\n\n if (firstIndex === -1) {\n return this;\n }\n nextItemInfos.splice(firstIndex, lastIndex - firstIndex + 1);\n return this.syncItems(nextItemInfos);\n }\n /**\n * Removes the item corresponding to index.\n * @ko index에 해당하는 아이템을 제거 한다.\n */\n public removeByIndex(index: number): this {\n const nextItemInfos = this.getItems(true);\n\n nextItemInfos.splice(index, 1);\n\n return this.syncItems(nextItemInfos);\n }\n /**\n * Removes the item corresponding to key.\n * @ko key에 해당하는 아이템을 제거 한다.\n */\n public removeByKey(key: string | number): this {\n const nextItemInfos = this.getItems(true);\n const index = findIndex(nextItemInfos, (item) => item.key === key);\n\n return this.removeByIndex(index);\n }\n /**\n * Update the size of the items and render them.\n * @ko 아이템들의 사이즈를 업데이트하고 렌더링을 한다.\n * @param - Items to be updated. 업데이트할 아이템들.\n * @param - Options for rendering. 렌더링을 하기 위한 옵션.\n */\n public updateItems(items?: InfiniteGridItem[], options: RenderOptions = {}) {\n this.groupManager.updateItems(items, options);\n return this;\n }\n /**\n * Return all items of InfiniteGrid.\n * @ko InfiniteGrid의 모든 아이템들을 반환한다.\n * @param - Whether to include items corresponding to placeholders. placeholder에 해당하는 아이템들을 포함할지 여부.\n */\n public getItems(includePlaceholders?: boolean): InfiniteGridItem[] {\n return this.groupManager.getGroupItems(includePlaceholders);\n }\n /**\n * Return visible items of InfiniteGrid.\n * @ko InfiniteGrid의 보이는 아이템들을 반환한다.\n * @param - Whether to include items corresponding to placeholders. placeholder에 해당하는 아이템들을 포함할지 여부.\n */\n public getVisibleItems(includePlaceholders?: boolean): InfiniteGridItem[] {\n return this.groupManager.getVisibleItems(includePlaceholders);\n }\n\n /**\n * Return rendering items of InfiniteGrid.\n * @ko InfiniteGrid의 렌더링 아이템들을 반환한다.\n */\n public getRenderingItems(): InfiniteGridItem[] {\n return this.groupManager.getRenderingItems();\n }\n /**\n * Return all groups of InfiniteGrid.\n * @ko InfiniteGrid의 모든 그룹들을 반환한다.\n * @param - Whether to include groups corresponding to placeholders. placeholder에 해당하는 그룹들을 포함할지 여부.\n */\n public getGroups(includePlaceholders?: boolean): InfiniteGridGroup[] {\n return this.groupManager.getGroups(includePlaceholders);\n }\n /**\n * Return visible groups of InfiniteGrid.\n * @ko InfiniteGrid의 보이는 그룹들을 반환한다.\n * @param - Whether to include groups corresponding to placeholders. placeholder에 해당하는 그룹들을 포함할지 여부.\n */\n public getVisibleGroups(includePlaceholders?: boolean): InfiniteGridGroup[] {\n return this.groupManager.getVisibleGroups(includePlaceholders);\n }\n /**\n * Set to wait to request data.\n * @ko 데이터를 요청하기 위해 대기 상태로 설정한다.\n * @param direction - direction in which data will be added. 데이터를 추가하기 위한 방향.\n */\n public wait(direction: \"start\" | \"end\" = DIRECTION.END) {\n this._waitType = direction;\n this._checkStartLoading(direction);\n }\n /**\n * When the data request is complete, it is set to ready state.\n * @ko 데이터 요청이 끝났다면 준비 상태로 설정한다.\n */\n public ready() {\n this._waitType = \"\";\n }\n /**\n * Returns whether it is set to wait to request data.\n * @ko 데이터를 요청하기 위해 대기 상태로 설정되어 있는지 여부를 반환한다.\n */\n public isWait() {\n return !!this._waitType;\n }\n /**\n * Releases the instnace and events and returns the CSS of the container and elements.\n * @ko 인스턴스와 이벤트를 해제하고 컨테이너와 엘리먼트들의 CSS를 되돌린다.\n */\n public destroy(): void {\n this.off();\n this._getRenderer().destroy();\n this.containerManager.destroy();\n this.groupManager.destroy();\n this.scrollManager.destroy();\n this.infinite.destroy();\n }\n\n private _getRenderer() {\n return this.options.renderer!;\n }\n private _getRendererItems() {\n return this.getRenderingItems().map((item) => {\n return {\n element: item.element,\n key: `${item.type}_${item.key}`,\n orgItem: item,\n };\n });\n }\n private _syncItems(state?: Record): void {\n this._getRenderer().syncItems(this._getRendererItems(), state);\n }\n private _render(state?: Record): void {\n this._getRenderer().render(this._getRendererItems(), state);\n }\n private _update(state: Record = {}): void {\n this._getRenderer().update(state);\n }\n private _resizeScroll() {\n const scrollManager = this.scrollManager;\n\n scrollManager.resize();\n\n this.infinite.setSize(scrollManager.getContentSize());\n }\n private _syncGroups(isUpdate?: boolean) {\n const infinite = this.infinite;\n const scrollManager = this.scrollManager;\n\n if (!scrollManager.getContentSize()) {\n this._resizeScroll();\n }\n this._syncInfinite();\n this.groupManager.setCursors(infinite.getStartCursor(), infinite.getEndCursor());\n if (isUpdate) {\n this._update();\n } else {\n this._render();\n }\n }\n private _syncInfinite() {\n this.infinite.syncItems(this.getGroups(true).map(({ groupKey, grid, type }) => {\n const outlines = grid.getOutlines();\n \n return {\n key: groupKey,\n isVirtual: type === GROUP_TYPE.VIRTUAL,\n startOutline: outlines.start,\n endOutline: outlines.end,\n };\n }));\n }\n private _scroll() {\n this.infinite.scroll(this.scrollManager.getRelativeScrollPos());\n }\n private _onScroll = ({ direction, scrollPos, relativeScrollPos }: OnChangeScroll): void => {\n this._scroll();\n /**\n * This event is fired when scrolling.\n * @ko 스크롤하면 발생하는 이벤트이다.\n * @event InfiniteGrid#changeScroll\n * @param {InfiniteGrid.OnChangeScroll} e - The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n */\n this.trigger(new ComponentEvent(INFINITEGRID_EVENTS.CHANGE_SCROLL, {\n direction,\n scrollPos,\n relativeScrollPos,\n }));\n }\n\n private _onChange = (e: OnInfiniteChange): void => {\n this.setCursors(e.nextStartCursor, e.nextEndCursor);\n }\n private _onRendererUpdated = (e: OnRendererUpdated): void => {\n if (!e.isChanged) {\n this._checkEndLoading();\n this._scroll();\n return;\n }\n const renderedItems = e.items;\n\n const {\n added,\n removed,\n prevList,\n list,\n } = e.diffResult;\n\n removed.forEach((index) => {\n const orgItem = prevList[index].orgItem;\n\n if (orgItem.mountState !== MOUNT_STATE.UNCHECKED) {\n orgItem.mountState = MOUNT_STATE.UNMOUNTED;\n }\n });\n\n renderedItems.forEach((item) => {\n // set grid element\n const gridItem = item.orgItem;\n\n gridItem.element = item.element as HTMLElement;\n });\n\n const horizontal = this.options.horizontal;\n const addedItems = added.map((index) => {\n const gridItem = list[index].orgItem;\n const element = gridItem.element!;\n\n if (gridItem.type === ITEM_TYPE.VIRTUAL) {\n const cssRect = { ...gridItem.cssRect };\n const rect = gridItem.rect;\n\n if (!cssRect.width && rect.width) {\n cssRect.width = rect.width;\n }\n if (!cssRect.height && rect.height) {\n cssRect.height = rect.height;\n }\n // virtual item\n return new GridItem(horizontal!, {\n element,\n cssRect,\n });\n }\n return gridItem;\n });\n\n const containerManager = this.containerManager;\n if (this.options.observeChildren) {\n containerManager.observeChildren(added.map((index) => list[index].element!));\n containerManager.unobserveChildren(removed.map((index) => prevList[index].element!));\n }\n\n const {\n isRestore,\n isResize,\n } = e.state;\n\n this.itemRenderer.renderItems(addedItems);\n\n if (isRestore) {\n this._onRenderComplete({\n mounted: added.map((index) => list[index].orgItem),\n updated: [],\n isResize: false,\n direction: this.defaultDirection,\n });\n }\n if (!isRestore || isResize || e.isItemChanged) {\n this.groupManager.renderItems();\n }\n }\n\n private _onResize = (e: ResizeWatcherResizeEvent) => {\n if (e.isResizeContainer) {\n this._renderItems({ useResize: true }, true);\n } else {\n const updatedItems = getUpdatedItems(this.getVisibleItems(), e.childEntries) as InfiniteGridItem[];\n\n if (updatedItems.length > 0) {\n this.updateItems(updatedItems);\n }\n }\n }\n\n private _onRequestAppend = (e: OnRequestInsert): void => {\n /**\n * The event is fired when scrolling reaches the end or when data for a virtual group is required.\n * @ko 스크롤이 끝에 도달하거나 virtual 그룹에 대한 데이터가 필요한 경우 이벤트가 발생한다.\n * @event InfiniteGrid#requestAppend\n * @param {InfiniteGrid.OnRequestAppend} e - The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n */\n this._onRequestInsert(DIRECTION.END, INFINITEGRID_EVENTS.REQUEST_APPEND, e);\n }\n\n private _onRequestPrepend = (e: OnInfiniteRequestPrepend): void => {\n /**\n * The event is fired when scrolling reaches the start or when data for a virtual group is required.\n * @ko 스크롤이 끝에 도달하거나 virtual 그룹에 대한 데이터가 필요한 경우 이벤트가 발생한다.\n * @event InfiniteGrid#requestPrepend\n * @param {InfiniteGrid.OnRequestPrepend} e - The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n */\n this._onRequestInsert(DIRECTION.START, INFINITEGRID_EVENTS.REQUEST_PREPEND, e);\n }\n\n private _onRequestInsert(\n direction: \"start\" | \"end\",\n eventType: \"requestAppend\" | \"requestPrepend\",\n e: OnInfiniteRequestAppend | OnInfiniteRequestPrepend,\n ) {\n if (this._waitType) {\n this._checkStartLoading(this._waitType);\n return;\n }\n this.trigger(new ComponentEvent(eventType, {\n groupKey: e.key,\n nextGroupKey: e.nextKey,\n nextGroupKeys: e.nextKeys || [],\n isVirtual: e.isVirtual,\n wait: () => {\n this.wait(direction);\n },\n ready: () => {\n this.ready();\n },\n }));\n }\n\n private _onContentError = ({ element, target, item, update }: OnContentError): void => {\n /**\n * The event is fired when scrolling reaches the start or when data for a virtual group is required.\n * @ko 스크롤이 끝에 도달하거나 virtual 그룹에 대한 데이터가 필요한 경우 이벤트가 발생한다.\n * @event InfiniteGrid#contentError\n * @param {InfiniteGrid.OnContentError} e - The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n */\n this.trigger(new ComponentEvent(INFINITEGRID_EVENTS.CONTENT_ERROR, {\n element,\n target,\n item: item as InfiniteGridItem,\n update,\n remove: () => {\n this.removeByKey(item.key!);\n },\n }));\n }\n\n private _onRenderComplete = ({ isResize, mounted, updated, direction }: OnPickedRenderComplete): void => {\n const infinite = this.infinite;\n const prevRenderedGroups = infinite.getRenderedVisibleItems();\n const length = prevRenderedGroups.length;\n const isDirectionEnd = direction === DIRECTION.END;\n\n this._syncInfinite();\n\n if (length) {\n const prevStandardGroup = prevRenderedGroups[isDirectionEnd ? 0 : length - 1];\n const nextStandardGroup = infinite.getItemByKey(prevStandardGroup.key);\n const offset = isDirectionEnd\n ? Math.min(...nextStandardGroup.startOutline) - Math.min(...prevStandardGroup.startOutline)\n : Math.max(...nextStandardGroup.endOutline) - Math.max(...prevStandardGroup.endOutline);\n\n this.scrollManager.scrollBy(offset);\n }\n\n /**\n * This event is fired when the InfiniteGrid has completed rendering.\n * @ko InfiniteGrid가 렌더링이 완료됐을 때 이벤트가 발생한다.\n * @event InfiniteGrid#renderComplete\n * @param {InfiniteGrid.OnRenderComplete} e - The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n */\n this.trigger(new ComponentEvent(INFINITEGRID_EVENTS.RENDER_COMPLETE, {\n isResize,\n direction,\n mounted: (mounted as InfiniteGridItem[]).filter((item) => item.type !== ITEM_TYPE.LOADING),\n updated: (updated as InfiniteGridItem[]).filter((item) => item.type !== ITEM_TYPE.LOADING),\n startCursor: this.getStartCursor(),\n endCursor: this.getEndCursor(),\n items: this.getVisibleItems(true),\n groups: this.getVisibleGroups(true),\n }));\n\n if (this.groupManager.shouldRerenderItems()) {\n this._update();\n } else {\n this._checkEndLoading();\n this._scroll();\n }\n }\n private _renderItems(options: RenderOptions = {}, isTrusted?: boolean) {\n if (!isTrusted && options.useResize) {\n this.containerManager.resize();\n }\n this._resizeScroll();\n if (!this.getRenderingItems().length) {\n const children = toArray(this.getContainerElement().children);\n if (children.length > 0) {\n // no items, but has children\n this.groupManager.syncItems(convertInsertedItems(children));\n this._syncInfinite();\n this.setCursors(0, 0, true);\n this._getRenderer().updated();\n } else {\n this.infinite.scroll(0);\n }\n return this;\n }\n if (!this.getVisibleGroups(true).length) {\n this.setCursors(0, 0);\n } else {\n this.groupManager.renderItems(options);\n }\n return this;\n }\n private _checkStartLoading(direction: \"start\" | \"end\") {\n const groupManager = this.groupManager;\n const infinite = this.infinite;\n\n if (\n !groupManager.getLoadingType()\n && infinite.isLoading(direction)\n && groupManager.startLoading(direction)\n && groupManager.hasLoadingItem()\n ) {\n this._update();\n }\n }\n private _checkEndLoading() {\n const groupManager = this.groupManager;\n const loadingType = this.groupManager.getLoadingType();\n\n if (\n loadingType\n && (!this._waitType || !this.infinite.isLoading(loadingType))\n && groupManager.endLoading()\n && groupManager.hasLoadingItem()\n ) {\n this._update();\n }\n }\n}\n\ninterface InfiniteGrid extends Properties { }\n\nexport default InfiniteGrid;\n","import { MasonryGrid, MasonryGridOptions } from \"@egjs/grid\";\nimport InfiniteGrid from \"../InfiniteGrid\";\nimport { InfiniteGridOptions } from \"../types\";\nimport { InfiniteGridGetterSetter } from \"../utils\";\n\n/**\n * @typedef\n * @extends InfiniteGridOptions\n * @extends Grid.MasonryGrid.MasonryGridOptions\n */\nexport interface MasonryInfiniteGridOptions extends MasonryGridOptions, InfiniteGridOptions {\n}\n\n/**\n * MasonryInfiniteGrid is a grid that stacks items with the same width as a stack of bricks. Adjust the width of all images to the same size, find the lowest height column, and insert a new item.\n * @ko MasonryInfiniteGrid는 벽돌을 쌓아 올린 모양처럼 동일한 너비를 가진 아이템을 쌓는 레이아웃이다. 모든 이미지의 너비를 동일한 크기로 조정하고, 가장 높이가 낮은 열을 찾아 새로운 이미지를 삽입한다. 따라서 배치된 아이템 사이에 빈 공간이 생기지는 않지만 배치된 레이아웃의 아래쪽은 울퉁불퉁해진다.\n * @param {HTMLElement | string} container - A base element for a module 모듈을 적용할 기준 엘리먼트\n * @param {MasonryInfiniteGridOptions} options - The option object of the MasonryInfiniteGrid module MasonryInfiniteGrid 모듈의 옵션 객체\n */\n@InfiniteGridGetterSetter\nexport class MasonryInfiniteGrid extends InfiniteGrid {\n public static propertyTypes = {\n ...InfiniteGrid.propertyTypes,\n ...MasonryGrid.propertyTypes,\n };\n public static defaultOptions: Required = {\n ...InfiniteGrid.defaultOptions,\n ...MasonryGrid.defaultOptions,\n gridConstructor: MasonryGrid,\n } as const;\n}\n","import { JustifiedGrid, JustifiedGridOptions } from \"@egjs/grid\";\nimport InfiniteGrid from \"../InfiniteGrid\";\nimport { InfiniteGridOptions } from \"../types\";\nimport { InfiniteGridGetterSetter } from \"../utils\";\n\n/**\n * @typedef\n * @extends InfiniteGridOptions\n * @extends Grid.JustifiedGrid.JustifiedGridOptions\n */\nexport interface JustifiedInfiniteGridOptions extends JustifiedGridOptions, InfiniteGridOptions {\n}\n\n/**\n * 'justified' is a printing term with the meaning that 'it fits in one row wide'. JustifiedInfiniteGrid is a grid that the item is filled up on the basis of a line given a size.\n * If 'data-grid-inline-offset' or 'data-grid-content-offset' are set for item element, the ratio is maintained except for the offset value.\n * If 'data-grid-maintained-target' is set for an element whose ratio is to be maintained, the item is rendered while maintaining the ratio of the element.\n * @ko 'justified'는 '1행의 너비에 맞게 꼭 들어찬'이라는 의미를 가진 인쇄 용어다. JustifiedInfiniteGrid는 용어의 의미대로 너비가 주어진 사이즈를 기준으로 아이템가 가득 차도록 배치하는 Grid다.\n * 아이템 엘리먼트에 'data-grid-inline-offset' 또는 'data-grid-content-offset'를 설정하면 offset 값을 제외하고 비율을 유지한다.\n * 비율을 유지하고 싶은 엘리먼트에 'data-grid-maintained-target'을 설정한다면 해당 엘리먼트의 비율을 유지하면서 아이템이 렌더링이 된다.\n * @param {HTMLElement | string} container - A base element for a module 모듈을 적용할 기준 엘리먼트\n * @param {JustifiedInfiniteGridOptions} options - The option object of the JustifiedInfiniteGrid module JustifiedInfiniteGrid 모듈의 옵션 객체\n */\n@InfiniteGridGetterSetter\nexport class JustifiedInfiniteGrid extends InfiniteGrid {\n public static propertyTypes = {\n ...InfiniteGrid.propertyTypes,\n ...JustifiedGrid.propertyTypes,\n };\n public static defaultOptions: Required = {\n ...InfiniteGrid.defaultOptions,\n ...JustifiedGrid.defaultOptions,\n gridConstructor: JustifiedGrid,\n } as const;\n}\n","import { FrameGrid, FrameGridOptions } from \"@egjs/grid\";\nimport InfiniteGrid from \"../InfiniteGrid\";\nimport { InfiniteGridOptions } from \"../types\";\nimport { InfiniteGridGetterSetter } from \"../utils\";\n\n/**\n * @typedef\n * @extends InfiniteGridOptions\n * @extends Grid.FrameGrid.FrameGridOptions\n */\nexport interface FrameInfiniteGridOptions extends FrameGridOptions, InfiniteGridOptions {\n}\n\n/**\n * 'Frame' is a printing term with the meaning that 'it fits in one row wide'. FrameInfiniteGrid is a grid that the item is filled up on the basis of a line given a size.\n * @ko 'Frame'는 '1행의 너비에 맞게 꼭 들어찬'이라는 의미를 가진 인쇄 용어다. FrameInfiniteGrid는 용어의 의미대로 너비가 주어진 사이즈를 기준으로 아이템이 가득 차도록 배치하는 Grid다.\n * @param {HTMLElement | string} container - A base element for a module 모듈을 적용할 기준 엘리먼트\n * @param {FrameInfiniteGridOptions} options - The option object of the FrameInfiniteGrid module FrameGrid 모듈의 옵션 객체\n */\n@InfiniteGridGetterSetter\nexport class FrameInfiniteGrid extends InfiniteGrid {\n public static propertyTypes = {\n ...InfiniteGrid.propertyTypes,\n ...FrameGrid.propertyTypes,\n };\n public static defaultOptions: Required = {\n ...InfiniteGrid.defaultOptions,\n ...FrameGrid.defaultOptions,\n gridConstructor: FrameGrid,\n } as const;\n}\n","import { PackingGrid, PackingGridOptions } from \"@egjs/grid\";\nimport InfiniteGrid from \"../InfiniteGrid\";\nimport { InfiniteGridOptions } from \"../types\";\nimport { InfiniteGridGetterSetter } from \"../utils\";\n\n/**\n * @typedef\n * @extends InfiniteGridOptions\n * @extends Grid.PackingGrid.PackingGridOptions\n */\nexport interface PackingInfiniteGridOptions extends PackingGridOptions, InfiniteGridOptions {\n}\n\n/**\n * The PackingInfiniteGrid is a grid that shows the important items bigger without sacrificing the weight of the items.\n * Rows and columns are separated so that items are dynamically placed within the horizontal and vertical space rather than arranged in an orderly fashion.\n * If `sizeWeight` is higher than `ratioWeight`, the size of items is preserved as much as possible.\n * Conversely, if `ratioWeight` is higher than `sizeWeight`, the ratio of items is preserved as much as possible.\n * @ko PackingInfiniteGrid는 아이템의 본래 크기에 따른 비중을 해치지 않으면서 중요한 카드는 더 크게 보여 주는 레이아웃이다.\n * 행과 열이 구분돼 아이템을 정돈되게 배치하는 대신 가로세로 일정 공간 내에서 동적으로 아이템을 배치한다.\n * `sizeWeight`가 `ratioWeight`보다 높으면 아이템들의 size가 최대한 보존이 된다.\n * 반대로 `ratioWeight`가 `sizeWeight`보다 높으면 아이템들의 비율이 최대한 보존이 된다.\n * @param {HTMLElement | string} container - A base element for a module 모듈을 적용할 기준 엘리먼트\n * @param {PackingInfiniteGridOptions} options - The option object of the PackingInfiniteGrid module PackingInfiniteGrid 모듈의 옵션 객체\n */\n@InfiniteGridGetterSetter\nexport class PackingInfiniteGrid extends InfiniteGrid {\n public static propertyTypes = {\n ...InfiniteGrid.propertyTypes,\n ...PackingGrid.propertyTypes,\n };\n public static defaultOptions: Required = {\n ...InfiniteGrid.defaultOptions,\n ...PackingGrid.defaultOptions,\n gridConstructor: PackingGrid,\n };\n}\n","import InfiniteGrid, * as modules from \"./index\";\n\nfor (const name in modules) {\n (InfiniteGrid as any)[name] = (modules as any)[name];\n}\n\ndeclare const module: any;\nmodule.exports = InfiniteGrid;\nexport default InfiniteGrid;\nexport * from \"./index\";\n"],"names":["ua","window","navigator","userAgent","IS_IOS","test","CONTAINER_CLASS_NAME","IGNORE_PROPERITES_MAP","renderOnPropertyChange","useFit","autoResize","INFINITEGRID_PROPERTY_TYPES","GRID_PROPERTY_TYPES","DIRECTION","START","END","NONE","INFINITEGRID_EVENTS","CHANGE_SCROLL","REQUEST_APPEND","REQUEST_PREPEND","RENDER_COMPLETE","CONTENT_ERROR","ITEM_INFO_PROPERTIES","type","groupKey","key","element","html","data","INFINITEGRID_METHODS","GROUP_TYPE","ITEM_TYPE","STATUS_TYPE","INVISIBLE_POS","__extends","horizontal","itemStatus","_super","__assign","NORMAL","cssRect","top","left","_this","VIRTUAL","rect","width","height","mountState","MOUNT_STATE","UNMOUNTED","orgRect","attributes","status","getMinimizedStatus","GridItem","LOADING_GROUP_KEY","LOADING_ITEM_KEY","items","item","loadingItem","getLoadingItem","InfiniteGridItem","options","LOADING","name","direction","outline","length","start","end","nextOutline","offset","contentSize","gap","cssInlinePos","getContainerInlineSize","inlineSize","maxPos","Math","max","cssContentPos","map","pos","minPos","min","Grid","isWindow","el","isNumber","val","isString","isObject","flat","arr","reduce","prev","cur","splitOptions","gridOptions","otherOptions","splitGridOptions","nextOptions","defaultOptions","value","categorize","groups","groupKeys","registeredGroupKeys","filter","forEach","_a","generatedGroupKey","isContinuousGroupKey","makeKey","group","push","getNextCursors","prevKeys","nextKeys","prevStartCursor","prevEndCursor","result","diff","nextStartCursor","nextEndCursor","maintained","prevIndex","nextIndex","startCursor","endCursor","splitVirtualGroups","nextGroups","virtualGroups","index","findIndex","endMaintainedIndex","nextGroup","endIndex","slice","findLastIndex","startMaintainedIndex","startIndex","getFirstRenderingItems","nextItems","getRenderingItemsByStatus","groupManagerStatus","usePlaceholder","prevGroups","startVirtualGroups","endVirtualGroups","__spreadArrays","cursors","nextVisibleItems","mountRenderingItems","grid","useLoading","useFirstRender","setPlaceholder","setLoading","setStatus","syncItems","getGroups","setCursors","getRenderingItems","visibleItems","groupManager","InfiniteGridGetterSetter","component","prototype","propertyTypes","enumerable","configurable","get","set","prevValue","Object","defineProperty","registeredKeys","convertHTMLtoElement","dummy","document","createElement","innerHTML","toArray","children","convertInsertedItems","insertedItems","outerHTML","nodes","array","i","callback","getItemInfo","info","nextInfo","isFlatOutline","every","range","flatGroups","getItems","filterVirtuals","includePlaceholders","withInfiniteGridMethods","withMethods","container","_loadingGrid","LoadingGrid","externalContainerManager","containerManager","_mainGrid","_makeGrid","shouldRender","_checkShouldRender","scheduleRender","itemKeys","groupItems","hasPlaceholder","getVisibleGroups","some","_placeholder","_getLoadingItem","updateItems","placeholder","_updatePlaceholder","_getRenderingItems","prevType","loading","setLoadingItem","getComputedOutlineLength","getComputedOutlineSize","renderingGroups","loadingGrid","unshift","_getLoadingGroup","reverse","outlineLength","outlineSize","gridItems","isVirtual","appliedItems","UNCHECKED","gridOutlines","_applyVirtualGrid","applyGrid","setOutlines","getOutlines","nextItemInfos","prevItemKeys","_syncItemInfos","prevGroupKeys","nextManagerGroups","_splitVirtualGroups","_mergeVirtualGroups","setItems","renderItems","_registerGroups","useResize","updateState","UPDATE_STATE","NEED_UPDATE","orgStartCursor","orgEndCursor","orgGroups","startGroup","endGroup","isMinimizeItems","MINIMIZE_INVISIBLE_ITEMS","isMinimizeGroups","MINIMIZE_INVISIBLE_GROUPS","REMOVE_INVISIBLE_GROUPS","orgIndex","orgGroup","indexOf","lastIndexOf","groupStatus","isOutsideCursor","isVirtualItems","isVirtualGroup","getVirtualStatus","outlines","totalItems","getGroupItems","itemStartCursor","itemEndCursor","orgCursors","itemCursors","startGroupKey","endGroupKey","firstGroup","startOutline","outlineOffset","_b","point","contentPos","insertPlaceholders","splice","groupKey_1","infos","Array","isArray","isRerender","GridConstructor","gridConstructor","prevOptions","PROPERTY_TYPE","RENDER_PROPERTY","prevOutlines","prevOutline","nextItemKeys","prevItem","nextGroupKeys","_getGroupItems","prevGroup","containerElement","useResizeObserver","observeChildren","externalItemRenderer","itemRenderer","GroupManager","PROPERTY","GetterSetter","threshold","useRecycle","defaultDirection","scrollPos","size","_c","isDirectionEnd","trigger","undefined","nextCursor","endScrollPos","startEdgePos","endEdgePos","endOutline","visibles","startPos","endPos","hasStartItems","hasEndItems","isStart","isEnd","hasRealItem","hasVirtualItems","isStartVirtual","isEndVirtual","realItemIndex","endVirtualItemIndex","nextKey","startVirtualItemIndex","_requestVirtualItems","totalVisibleItems","getVisibleItems","totalVisibleLength","visibleLength","getStartCursor","getEndCursor","startKey_1","endKey_1","lastItem","firstItem","prevItems","isChange","prevVisibleItems","visibleResult","added","removed","changed","rendered","off","Component","rendererKey","Date","now","state","_state","clearTimeout","_updateTimer","setTimeout","nextElements","diffResult","_diffResult","isChanged","isItemChanged","_isItemChanged","list","elements","renderKey","render","prevList","ordered","diffList","removeChild","insertBefore","updated","Renderer","orgItem","VanillaRenderer","wrapper","prevScrollPos","getScrollPos","nextScrollPos","getOrgScrollPos","setScrollPos","_isScrollIssue","ComponentEvent","relativeScrollPos","getRelativeScrollPos","containerTag","_init","scrollContainer","scrollOffset","eventTarget","prop","documentElement","body","scrollTo","x","y","scroll","scrollLeft","scrollTop","scrollBy","isBody","scrollContainerRect","getBoundingClientRect","containerRect","innerWidth","innerHeight","offsetWidth","offsetHeight","removeEventListener","_onCheck","_isCreateElement","fragment_1","createDocumentFragment","childNodes","childNode","appendChild","style","cssText","_orgCSSText","containerOption","containerCSSText","HTMLElement","position","className","querySelector","overflowX","overflowY","addEventListener","resize","_scroll","e","_checkEndLoading","renderedItems","gridItem","addedItems","unobserveChildren","isRestore","isResize","_onRenderComplete","mounted","isResizeContainer","_renderItems","updatedItems","getUpdatedItems","childEntries","_onRequestInsert","target","update","remove","removeByKey","infinite","prevRenderedGroups","getRenderedVisibleItems","_syncInfinite","prevStandardGroup","nextStandardGroup","getItemByKey","scrollManager","shouldRerenderItems","_update","constructor","renderer","VanillaGridRenderer","on","_render","attributePrefix","useTransform","percentage","isConstantSize","isEqualSize","resizeDebounce","maxResizeDebounce","wrapperElement","ScrollManager","_onScroll","getContainer","ContainerManager","_onResize","ItemRenderer","Infinite","_onChange","_onRequestAppend","_onRequestPrepend","setSize","getContentSize","_onContentError","setContainer","_onRendererUpdated","InfiniteGrid","getWrapper","getScrollContainer","_syncGroups","_syncItems","insert","itemInfos","groupIndex","nextGroupInfos","rightGroup","append","rightGroupKey","rightItemIndex","getStatus","getGroupStatus","appendPlaceholders","removePlaceholders","prependPlaceholders","prevInlineSize","getInlineSize","setGroupStatus","_getRenderer","updateKey","removeGroupByKey","firstIndex","lastIndex","removeByIndex","_waitType","_checkStartLoading","destroy","_getRendererItems","isUpdate","_resizeScroll","eventType","nextGroupKey","wait","ready","isTrusted","getContainerElement","getLoadingType","isLoading","startLoading","hasLoadingItem","loadingType","endLoading","DEFAULT_GRID_OPTIONS","MasonryInfiniteGrid","MasonryGrid","JustifiedInfiniteGrid","JustifiedGrid","FrameInfiniteGrid","FrameGrid","PackingInfiniteGrid","PackingGrid","modules","module","exports"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,EAAE,GAAG,OAAOC,MAAP,KAAkB,WAAlB,GAAgCA,MAAM,CAACC,SAAP,CAAiBC,SAAjD,GAA6D,EAAxE;IAEaC,MAAM,GAAG,cAAcC,IAAd,CAAmBL,EAAnB;IACTM,oBAAoB,GAAG;IACvBC,qBAAqB,GAAG;AACnCC,EAAAA,sBAAsB,EAAE,IADW;AAEnCC,EAAAA,MAAM,EAAE,IAF2B;AAGnCC,EAAAA,UAAU,EAAE;AAHuB;IAOxBC,2BAA2B,gBACnCC;IAGQC,SAAS,GAAG;AACvBC,EAAAA,KAAK,EAAE,OADgB;AAEvBC,EAAAA,GAAG,EAAE,KAFkB;AAGvBC,EAAAA,IAAI,EAAE;AAHiB;IAMZC,mBAAmB,GAAG;AACjCC,EAAAA,aAAa,EAAE,cADkB;AAEjCC,EAAAA,cAAc,EAAE,eAFiB;AAGjCC,EAAAA,eAAe,EAAE,gBAHgB;AAIjCC,EAAAA,eAAe,EAAE,gBAJgB;AAKjCC,EAAAA,aAAa,EAAE;AALkB;AASnC;AACA;AACA;AACA;AACA;;IACaC,oBAAoB,GAAG;AAClCC,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