UNPKG

110 kBJavaScriptView Raw
1/*
2Copyright (c) NAVER Corp.
3name: @egjs/infinitegrid
4license: MIT
5author: NAVER Corp.
6repository: https://github.com/naver/egjs-infinitegrid
7version: 4.11.1
8*/
9import Component, { ComponentEvent } from '@egjs/component';
10import Grid, { GRID_PROPERTY_TYPES, GridItem, MOUNT_STATE, UPDATE_STATE, PROPERTY_TYPE, GetterSetter, DEFAULT_GRID_OPTIONS, getUpdatedItems, ContainerManager, ItemRenderer, MasonryGrid, JustifiedGrid, FrameGrid, PackingGrid } from '@egjs/grid';
11import { withClassMethods, findTarget } from '@cfcs/core';
12import { diff } from '@egjs/list-differ';
13
14/******************************************************************************
15Copyright (c) Microsoft Corporation.
16
17Permission to use, copy, modify, and/or distribute this software for any
18purpose with or without fee is hereby granted.
19
20THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
21REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
22AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
23INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
24LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
25OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
26PERFORMANCE OF THIS SOFTWARE.
27***************************************************************************** */
28/* global Reflect, Promise, SuppressedError, Symbol */
29
30var extendStatics = function (d, b) {
31 extendStatics = Object.setPrototypeOf || {
32 __proto__: []
33 } instanceof Array && function (d, b) {
34 d.__proto__ = b;
35 } || function (d, b) {
36 for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
37 };
38 return extendStatics(d, b);
39};
40function __extends(d, b) {
41 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
42 extendStatics(d, b);
43 function __() {
44 this.constructor = d;
45 }
46 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
47}
48var __assign = function () {
49 __assign = Object.assign || function __assign(t) {
50 for (var s, i = 1, n = arguments.length; i < n; i++) {
51 s = arguments[i];
52 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
53 }
54 return t;
55 };
56 return __assign.apply(this, arguments);
57};
58function __rest(s, e) {
59 var t = {};
60 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
61 if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
62 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
63 }
64 return t;
65}
66function __decorate(decorators, target, key, desc) {
67 var c = arguments.length,
68 r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
69 d;
70 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
71 return c > 3 && r && Object.defineProperty(target, key, r), r;
72}
73function __spreadArray(to, from, pack) {
74 if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
75 if (ar || !(i in from)) {
76 if (!ar) ar = Array.prototype.slice.call(from, 0, i);
77 ar[i] = from[i];
78 }
79 }
80 return to.concat(ar || Array.prototype.slice.call(from));
81}
82var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
83 var e = new Error(message);
84 return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
85};
86
87var ua = typeof window !== "undefined" ? window.navigator.userAgent : "";
88var IS_IOS = /iPhone|iPad/.test(ua);
89var CONTAINER_CLASS_NAME = "infinitegrid-container";
90var IGNORE_PROPERITES_MAP = {
91 renderOnPropertyChange: true,
92 useFit: true,
93 autoResize: true
94};
95var INFINITEGRID_PROPERTY_TYPES = __assign({}, GRID_PROPERTY_TYPES);
96var DIRECTION = {
97 START: "start",
98 END: "end",
99 NONE: ""
100};
101var INFINITEGRID_EVENTS = {
102 CHANGE_SCROLL: "changeScroll",
103 REQUEST_APPEND: "requestAppend",
104 REQUEST_PREPEND: "requestPrepend",
105 RENDER_COMPLETE: "renderComplete",
106 CONTENT_ERROR: "contentError"
107};
108var ITEM_INFO_PROPERTIES = {
109 type: true,
110 groupKey: true,
111 key: true,
112 element: true,
113 html: true,
114 data: true,
115 inserted: true,
116 attributes: true
117};
118var INFINITEGRID_METHODS = ["insertByGroupIndex", "updateItems", "getItems", "getVisibleItems", "getGroups", "getVisibleGroups", "renderItems", "getContainerElement", "getScrollContainerElement", "getWrapperElement", "setStatus", "getStatus", "removePlaceholders", "prependPlaceholders", "appendPlaceholders", "getStartCursor", "getEndCursor", "setCursors"];
119var GROUP_TYPE;
120(function (GROUP_TYPE) {
121 GROUP_TYPE[GROUP_TYPE["NORMAL"] = 0] = "NORMAL";
122 GROUP_TYPE[GROUP_TYPE["VIRTUAL"] = 1] = "VIRTUAL";
123 GROUP_TYPE[GROUP_TYPE["LOADING"] = 2] = "LOADING";
124})(GROUP_TYPE || (GROUP_TYPE = {}));
125var ITEM_TYPE;
126(function (ITEM_TYPE) {
127 ITEM_TYPE[ITEM_TYPE["NORMAL"] = 0] = "NORMAL";
128 ITEM_TYPE[ITEM_TYPE["VIRTUAL"] = 1] = "VIRTUAL";
129 ITEM_TYPE[ITEM_TYPE["LOADING"] = 2] = "LOADING";
130})(ITEM_TYPE || (ITEM_TYPE = {}));
131var STATUS_TYPE;
132(function (STATUS_TYPE) {
133 // does not remove anything.
134 STATUS_TYPE[STATUS_TYPE["NOT_REMOVE"] = 0] = "NOT_REMOVE";
135 // Minimize information on invisible items
136 STATUS_TYPE[STATUS_TYPE["MINIMIZE_INVISIBLE_ITEMS"] = 1] = "MINIMIZE_INVISIBLE_ITEMS";
137 // Minimize information on invisible groups
138 STATUS_TYPE[STATUS_TYPE["MINIMIZE_INVISIBLE_GROUPS"] = 2] = "MINIMIZE_INVISIBLE_GROUPS";
139 // remove invisible groups
140 STATUS_TYPE[STATUS_TYPE["REMOVE_INVISIBLE_GROUPS"] = 3] = "REMOVE_INVISIBLE_GROUPS";
141})(STATUS_TYPE || (STATUS_TYPE = {}));
142var INVISIBLE_POS = -9999;
143
144/**
145 * @extends Grid.GridItem
146 */
147var InfiniteGridItem = /*#__PURE__*/function (_super) {
148 __extends(InfiniteGridItem, _super);
149 function InfiniteGridItem(horizontal, itemStatus) {
150 var _this = _super.call(this, horizontal, __assign({
151 html: "",
152 type: ITEM_TYPE.NORMAL,
153 cssRect: {
154 top: INVISIBLE_POS,
155 left: INVISIBLE_POS
156 }
157 }, itemStatus)) || this;
158 if (_this.type === ITEM_TYPE.VIRTUAL) {
159 if (_this.rect.width || _this.rect.height) {
160 _this.mountState = MOUNT_STATE.UNMOUNTED;
161 }
162 var orgRect = _this.orgRect;
163 var rect = _this.rect;
164 var cssRect = _this.cssRect;
165 if (cssRect.width) {
166 rect.width = cssRect.width;
167 } else if (orgRect.width) {
168 rect.width = orgRect.width;
169 }
170 if (cssRect.height) {
171 rect.height = cssRect.height;
172 } else if (orgRect.height) {
173 rect.height = orgRect.height;
174 }
175 }
176 return _this;
177 }
178 var __proto = InfiniteGridItem.prototype;
179 __proto.getVirtualStatus = function () {
180 return {
181 type: ITEM_TYPE.VIRTUAL,
182 groupKey: this.groupKey,
183 key: this.key,
184 orgRect: this.orgRect,
185 rect: this.rect,
186 cssRect: this.cssRect,
187 attributes: this.attributes
188 };
189 };
190 __proto.getMinimizedStatus = function () {
191 var status = __assign(__assign({}, _super.prototype.getMinimizedStatus.call(this)), {
192 type: ITEM_TYPE.NORMAL,
193 groupKey: this.groupKey
194 });
195 if (this.html) {
196 status.html = this.html;
197 }
198 return status;
199 };
200 return InfiniteGridItem;
201}(GridItem);
202
203var LOADING_GROUP_KEY = "__INFINITEGRID__LOADING_GRID";
204var LOADING_ITEM_KEY = "__INFINITEGRID__LOADING_ITEM";
205var LoadingGrid = /*#__PURE__*/function (_super) {
206 __extends(LoadingGrid, _super);
207 function LoadingGrid() {
208 var _this = _super !== null && _super.apply(this, arguments) || this;
209 _this.type = "";
210 return _this;
211 }
212 var __proto = LoadingGrid.prototype;
213 __proto.getLoadingItem = function () {
214 return this.items[0] || null;
215 };
216 __proto.setLoadingItem = function (item) {
217 if (item) {
218 var loadingItem = this.getLoadingItem();
219 if (!loadingItem) {
220 this.items = [new InfiniteGridItem(this.options.horizontal, __assign(__assign({}, item), {
221 type: ITEM_TYPE.LOADING,
222 key: LOADING_ITEM_KEY
223 }))];
224 } else {
225 for (var name in item) {
226 loadingItem[name] = item[name];
227 }
228 }
229 } else {
230 this.items = [];
231 }
232 };
233 __proto.applyGrid = function (items, direction, outline) {
234 if (!items.length) {
235 return {
236 start: outline,
237 end: outline
238 };
239 }
240 var nextOutline = outline.length ? __spreadArray([], outline, true) : [0];
241 var item = items[0];
242 var offset = item.contentSize + this.gap;
243 item.cssInlinePos = this.getContainerInlineSize() / 2 - item.inlineSize / 2;
244 if (direction === "end") {
245 var maxPos = Math.max.apply(Math, nextOutline);
246 item.cssContentPos = maxPos;
247 return {
248 start: nextOutline,
249 end: nextOutline.map(function (pos) {
250 return pos + offset;
251 })
252 };
253 } else {
254 var minPos = Math.min.apply(Math, nextOutline);
255 item.cssContentPos = minPos - offset;
256 return {
257 start: nextOutline.map(function (pos) {
258 return pos - offset;
259 }),
260 end: nextOutline
261 };
262 }
263 };
264 return LoadingGrid;
265}(Grid);
266
267function isWindow(el) {
268 return el === window;
269}
270function isNumber(val) {
271 return typeof val === "number";
272}
273function isString(val) {
274 return typeof val === "string";
275}
276function isObject(val) {
277 return typeof val === "object";
278}
279function flat(arr) {
280 return arr.reduce(function (prev, cur) {
281 return __spreadArray(__spreadArray([], prev, true), cur, true);
282 }, []);
283}
284function splitOptions(options) {
285 var gridOptions = options.gridOptions,
286 otherOptions = __rest(options, ["gridOptions"]);
287 return __assign(__assign({}, splitGridOptions(gridOptions)), otherOptions);
288}
289function splitGridOptions(options) {
290 var nextOptions = {};
291 var gridOptions = {};
292 var defaultOptions = Grid.defaultOptions;
293 for (var name in options) {
294 var value = options[name];
295 if (!(name in IGNORE_PROPERITES_MAP)) {
296 gridOptions[name] = value;
297 }
298 if (name in defaultOptions) {
299 nextOptions[name] = value;
300 }
301 }
302 return __assign(__assign({}, nextOptions), {
303 gridOptions: gridOptions
304 });
305}
306function categorize(items) {
307 var groups = [];
308 var groupKeys = {};
309 var registeredGroupKeys = {};
310 items.filter(function (item) {
311 return item.groupKey != null;
312 }).forEach(function (_a) {
313 var groupKey = _a.groupKey;
314 registeredGroupKeys[groupKey] = true;
315 });
316 var generatedGroupKey;
317 var isContinuousGroupKey = false;
318 items.forEach(function (item, i) {
319 if (item.groupKey != null) {
320 isContinuousGroupKey = false;
321 } else if (!item.inserted && items[i - 1]) {
322 // In case of framework, inserted is false.
323 // If groupKey is not set, the group key of the previous item is followed.
324 item.groupKey = items[i - 1].groupKey;
325 isContinuousGroupKey = false;
326 } else {
327 if (!isContinuousGroupKey) {
328 generatedGroupKey = makeKey(registeredGroupKeys);
329 isContinuousGroupKey = true;
330 registeredGroupKeys[generatedGroupKey] = true;
331 }
332 item.groupKey = generatedGroupKey;
333 }
334 var groupKey = item.groupKey;
335 var group = groupKeys[groupKey];
336 if (!group) {
337 group = {
338 groupKey: groupKey,
339 items: []
340 };
341 groupKeys[groupKey] = group;
342 groups.push(group);
343 }
344 group.items.push(item);
345 });
346 return groups;
347}
348function getNextCursors(prevKeys, nextKeys, prevStartCursor, prevEndCursor) {
349 var result = diff(prevKeys, nextKeys, function (key) {
350 return key;
351 });
352 var nextStartCursor = -1;
353 var nextEndCursor = -1;
354 // sync cursors
355 result.maintained.forEach(function (_a) {
356 var prevIndex = _a[0],
357 nextIndex = _a[1];
358 if (prevStartCursor <= prevIndex && prevIndex <= prevEndCursor) {
359 if (nextStartCursor === -1) {
360 nextStartCursor = nextIndex;
361 nextEndCursor = nextIndex;
362 } else {
363 nextStartCursor = Math.min(nextStartCursor, nextIndex);
364 nextEndCursor = Math.max(nextEndCursor, nextIndex);
365 }
366 }
367 });
368 return {
369 startCursor: nextStartCursor,
370 endCursor: nextEndCursor
371 };
372}
373function splitVirtualGroups(groups, direction, nextGroups) {
374 var virtualGroups = [];
375 if (direction === "start") {
376 var index = findIndex(groups, function (group) {
377 return group.type === GROUP_TYPE.NORMAL;
378 });
379 if (index === -1) {
380 return [];
381 }
382 // Get the virtual group maintained in the group from the next group.
383 var endMaintainedIndex = findIndex(groups, function (group) {
384 return findIndex(nextGroups, function (nextGroup) {
385 return nextGroup.groupKey === group.groupKey;
386 }) >= 0;
387 });
388 var endIndex = endMaintainedIndex >= 0 ? Math.min(index, endMaintainedIndex) : index;
389 virtualGroups = groups.slice(0, endIndex);
390 } else {
391 var index = findLastIndex(groups, function (group) {
392 return group.type === GROUP_TYPE.NORMAL;
393 });
394 if (index === -1) {
395 return [];
396 }
397 var startMaintainedIndex = findLastIndex(groups, function (group) {
398 return findIndex(nextGroups, function (nextGroup) {
399 return nextGroup.groupKey === group.groupKey;
400 }) >= 0;
401 });
402 var startIndex = startMaintainedIndex >= 0 ? Math.max(index, startMaintainedIndex) : index;
403 virtualGroups = groups.slice(startIndex + 1);
404 }
405 return virtualGroups;
406}
407function getFirstRenderingItems(nextItems, horizontal) {
408 var groups = categorize(nextItems);
409 if (!groups[0]) {
410 return [];
411 }
412 return groups[0].items.map(function (item) {
413 return new InfiniteGridItem(horizontal, __assign({}, item));
414 });
415}
416function getRenderingItemsByStatus(groupManagerStatus, nextItems, usePlaceholder, horizontal) {
417 var prevGroups = groupManagerStatus.groups;
418 var groups = categorize(nextItems);
419 var startVirtualGroups = splitVirtualGroups(prevGroups, "start", groups);
420 var endVirtualGroups = splitVirtualGroups(prevGroups, "end", groups);
421 var nextGroups = __spreadArray(__spreadArray(__spreadArray([], startVirtualGroups, true), groups, true), endVirtualGroups, true);
422 var _a = getNextCursors(prevGroups.map(function (group) {
423 return group.groupKey;
424 }), nextGroups.map(function (group) {
425 return group.groupKey;
426 }), groupManagerStatus.cursors[0], groupManagerStatus.cursors[1]),
427 startCursor = _a.startCursor,
428 endCursor = _a.endCursor;
429 var nextVisibleItems = flat(nextGroups.slice(startCursor, endCursor + 1).map(function (group) {
430 return group.items.map(function (item) {
431 return new InfiniteGridItem(horizontal, __assign({}, item));
432 });
433 }));
434 if (!usePlaceholder) {
435 nextVisibleItems = nextVisibleItems.filter(function (item) {
436 return item.type !== ITEM_TYPE.VIRTUAL;
437 });
438 }
439 return nextVisibleItems;
440}
441function mountRenderingItems(items, options) {
442 var grid = options.grid,
443 usePlaceholder = options.usePlaceholder,
444 useLoading = options.useLoading,
445 useFirstRender = options.useFirstRender,
446 status = options.status;
447 if (!grid) {
448 return;
449 }
450 if (usePlaceholder) {
451 grid.setPlaceholder({});
452 }
453 if (useLoading) {
454 grid.setLoading({});
455 }
456 if (status) {
457 grid.setStatus(status, true);
458 }
459 grid.syncItems(items);
460 if (useFirstRender && !status && grid.getGroups().length) {
461 grid.setCursors(0, 0, true);
462 }
463}
464function getRenderingItems(items, options) {
465 var status = options.status,
466 usePlaceholder = options.usePlaceholder,
467 useLoading = options.useLoading,
468 horizontal = options.horizontal,
469 useFirstRender = options.useFirstRender,
470 grid = options.grid;
471 var visibleItems = [];
472 if (grid) {
473 grid.setPlaceholder(usePlaceholder ? {} : null);
474 grid.setLoading(useLoading ? {} : null);
475 grid.syncItems(items);
476 visibleItems = grid.getRenderingItems();
477 } else if (status) {
478 visibleItems = getRenderingItemsByStatus(status.groupManager, items, !!usePlaceholder, !!horizontal);
479 } else if (useFirstRender) {
480 visibleItems = getFirstRenderingItems(items, !!horizontal);
481 }
482 return visibleItems;
483}
484/* Class Decorator */
485function InfiniteGridGetterSetter(component) {
486 var prototype = component.prototype,
487 propertyTypes = component.propertyTypes;
488 var _loop_1 = function (name) {
489 var attributes = {
490 enumerable: true,
491 configurable: true,
492 get: function () {
493 var options = this.groupManager.options;
494 if (name in options) {
495 return options[name];
496 } else {
497 return options.gridOptions[name];
498 }
499 },
500 set: function (value) {
501 var _a;
502 var prevValue = this.groupManager[name];
503 if (prevValue === value) {
504 return;
505 }
506 this.groupManager.gridOptions = (_a = {}, _a[name] = value, _a);
507 }
508 };
509 Object.defineProperty(prototype, name, attributes);
510 };
511 for (var name in propertyTypes) {
512 _loop_1(name);
513 }
514}
515function makeKey(registeredKeys, prefix) {
516 if (prefix === void 0) {
517 prefix = "";
518 }
519 var index = 0;
520 // eslint-disable-next-line no-constant-condition
521 while (true) {
522 var key = "infinitegrid_".concat(prefix).concat(index++);
523 if (!(key in registeredKeys)) {
524 return key;
525 }
526 }
527}
528function convertHTMLtoElement(html) {
529 var dummy = document.createElement("div");
530 dummy.innerHTML = html;
531 return toArray(dummy.children);
532}
533function convertInsertedItems(items, groupKey) {
534 var insertedItems;
535 if (isString(items)) {
536 insertedItems = convertHTMLtoElement(items);
537 } else {
538 insertedItems = items;
539 }
540 return insertedItems.map(function (item) {
541 var element;
542 var html = "";
543 var key;
544 if (isString(item)) {
545 html = item;
546 } else if ("parentNode" in item) {
547 element = item;
548 html = item.outerHTML;
549 } else {
550 // inserted is true when adding via a method.
551 return __assign({
552 groupKey: groupKey,
553 inserted: true
554 }, item);
555 }
556 // inserted is true when adding via a method.
557 return {
558 key: key,
559 groupKey: groupKey,
560 html: html,
561 element: element,
562 inserted: true
563 };
564 });
565}
566function toArray(nodes) {
567 var array = [];
568 if (nodes) {
569 var length = nodes.length;
570 for (var i = 0; i < length; i++) {
571 array.push(nodes[i]);
572 }
573 }
574 return array;
575}
576function findIndex(arr, callback) {
577 var length = arr.length;
578 for (var i = 0; i < length; ++i) {
579 if (callback(arr[i], i)) {
580 return i;
581 }
582 }
583 return -1;
584}
585function findLastIndex(arr, callback) {
586 var length = arr.length;
587 for (var i = length - 1; i >= 0; --i) {
588 if (callback(arr[i], i)) {
589 return i;
590 }
591 }
592 return -1;
593}
594function getItemInfo(info) {
595 var nextInfo = {};
596 for (var name in info) {
597 if (name in ITEM_INFO_PROPERTIES) {
598 nextInfo[name] = info[name];
599 }
600 }
601 return nextInfo;
602}
603function setPlaceholder(item, info) {
604 for (var name in info) {
605 var value = info[name];
606 if (isObject(value)) {
607 item[name] = __assign(__assign({}, item[name]), value);
608 } else {
609 item[name] = info[name];
610 }
611 }
612}
613function isFlatOutline(start, end) {
614 return start.length === end.length && start.every(function (pos, i) {
615 return end[i] === pos;
616 });
617}
618function range(length) {
619 var arr = [];
620 for (var i = 0; i < length; ++i) {
621 arr.push(i);
622 }
623 return arr;
624}
625function flatGroups(groups) {
626 return flat(groups.map(function (_a) {
627 var grid = _a.grid;
628 return grid.getItems();
629 }));
630}
631function filterVirtuals(items, includePlaceholders) {
632 if (includePlaceholders) {
633 return __spreadArray([], items, true);
634 } else {
635 return items.filter(function (item) {
636 return item.type !== ITEM_TYPE.VIRTUAL;
637 });
638 }
639}
640/**
641 * Decorator that makes the method of InfiniteGrid available in the framework.
642 * @ko 프레임워크에서 InfiniteGrid의 메소드를 사용할 수 있게 하는 데코레이터.
643 * @private
644 * @example
645 * ```js
646 * import { withInfiniteGridMethods } from "@egjs/infinitegrid";
647 *
648 * class Grid extends React.Component<Partial<InfiniteGridProps & InfiniteGridOptions>> {
649 * &#64;withInfiniteGridMethods
650 * private grid: NativeGrid;
651 * }
652 * ```
653 */
654var withInfiniteGridMethods = withClassMethods(INFINITEGRID_METHODS);
655
656var GroupManager = /*#__PURE__*/function (_super) {
657 __extends(GroupManager, _super);
658 function GroupManager(container, options) {
659 var _this = _super.call(this, container, splitOptions(options)) || this;
660 _this.groupItems = [];
661 _this.groups = [];
662 _this.itemKeys = {};
663 _this.groupKeys = {};
664 _this.startCursor = 0;
665 _this.endCursor = 0;
666 _this._placeholder = null;
667 _this._loadingGrid = new LoadingGrid(container, {
668 externalContainerManager: _this.containerManager,
669 useFit: false,
670 autoResize: false,
671 renderOnPropertyChange: false,
672 gap: _this.gap
673 });
674 _this._mainGrid = _this._makeGrid();
675 return _this;
676 }
677 var __proto = GroupManager.prototype;
678 Object.defineProperty(__proto, "gridOptions", {
679 set: function (options) {
680 var _a = splitGridOptions(options),
681 gridOptions = _a.gridOptions,
682 otherOptions = __rest(_a, ["gridOptions"]);
683 var shouldRender = this._checkShouldRender(options);
684 this.options.gridOptions = __assign(__assign({}, this.options.gridOptions), gridOptions);
685 __spreadArray([this._mainGrid], this.groups.map(function (_a) {
686 var grid = _a.grid;
687 return grid;
688 }), true).forEach(function (grid) {
689 for (var name in options) {
690 grid[name] = options[name];
691 }
692 });
693 for (var name in otherOptions) {
694 this[name] = otherOptions[name];
695 }
696 this._loadingGrid.gap = this.gap;
697 if (shouldRender) {
698 this.scheduleRender();
699 }
700 },
701 enumerable: false,
702 configurable: true
703 });
704 __proto.getItemByKey = function (key) {
705 return this.itemKeys[key] || null;
706 };
707 __proto.getGroupItems = function (includePlaceholders) {
708 return filterVirtuals(this.groupItems, includePlaceholders);
709 };
710 __proto.getVisibleItems = function (includePlaceholders) {
711 return filterVirtuals(this.items, includePlaceholders);
712 };
713 __proto.getRenderingItems = function () {
714 if (this.hasPlaceholder()) {
715 return this.items;
716 } else {
717 return this.items.filter(function (item) {
718 return item.type !== ITEM_TYPE.VIRTUAL;
719 });
720 }
721 };
722 __proto.getGroups = function (includePlaceholders) {
723 return filterVirtuals(this.groups, includePlaceholders);
724 };
725 __proto.hasVisibleVirtualGroups = function () {
726 return this.getVisibleGroups(true).some(function (group) {
727 return group.type === GROUP_TYPE.VIRTUAL;
728 });
729 };
730 __proto.hasPlaceholder = function () {
731 return !!this._placeholder;
732 };
733 __proto.hasLoadingItem = function () {
734 return !!this._getLoadingItem();
735 };
736 __proto.updateItems = function (items, options) {
737 if (items === void 0) {
738 items = this.groupItems;
739 }
740 return _super.prototype.updateItems.call(this, items, options);
741 };
742 __proto.setPlaceholder = function (placeholder) {
743 this._placeholder = placeholder;
744 this._updatePlaceholder();
745 };
746 __proto.getLoadingType = function () {
747 return this._loadingGrid.type;
748 };
749 __proto.startLoading = function (type) {
750 this._loadingGrid.type = type;
751 this.items = this._getRenderingItems();
752 return true;
753 };
754 __proto.endLoading = function () {
755 var prevType = this._loadingGrid.type;
756 this._loadingGrid.type = "";
757 this.items = this._getRenderingItems();
758 return !!prevType;
759 };
760 __proto.setLoading = function (loading) {
761 this._loadingGrid.setLoadingItem(loading);
762 this.items = this._getRenderingItems();
763 };
764 __proto.getVisibleGroups = function (includePlaceholders) {
765 var groups = this.groups.slice(this.startCursor, this.endCursor + 1);
766 return filterVirtuals(groups, includePlaceholders);
767 };
768 __proto.getComputedOutlineLength = function (items) {
769 if (items === void 0) {
770 items = this.items;
771 }
772 return this._mainGrid.getComputedOutlineLength(items);
773 };
774 __proto.getComputedOutlineSize = function (items) {
775 if (items === void 0) {
776 items = this.items;
777 }
778 return this._mainGrid.getComputedOutlineSize(items);
779 };
780 __proto.applyGrid = function (items, direction, outline) {
781 var _this = this;
782 var renderingGroups = this.groups.slice();
783 if (!renderingGroups.length) {
784 return {
785 start: [],
786 end: []
787 };
788 }
789 var loadingGrid = this._loadingGrid;
790 if (loadingGrid.getLoadingItem()) {
791 if (loadingGrid.type === "start") {
792 renderingGroups.unshift(this._getLoadingGroup());
793 } else if (loadingGrid.type === "end") {
794 renderingGroups.push(this._getLoadingGroup());
795 }
796 }
797 var groups = renderingGroups.slice();
798 var nextOutline = outline;
799 if (direction === "start") {
800 groups.reverse();
801 }
802 var appliedItemChecker = this.options.appliedItemChecker;
803 var groupItems = this.groupItems;
804 var outlineLength = this.getComputedOutlineLength(groupItems);
805 var outlineSize = this.getComputedOutlineSize(groupItems);
806 var itemRenderer = this.itemRenderer;
807 groups.forEach(function (group) {
808 var grid = group.grid;
809 var gridItems = grid.getItems();
810 var isVirtual = group.type === GROUP_TYPE.VIRTUAL && !gridItems[0];
811 grid.outlineLength = outlineLength;
812 grid.outlineSize = outlineSize;
813 var appliedItems = gridItems.filter(function (item) {
814 if (item.mountState === MOUNT_STATE.UNCHECKED || !item.rect.width) {
815 itemRenderer.updateItem(item, true);
816 }
817 return item.orgRect.width && item.rect.width || appliedItemChecker(item, grid);
818 });
819 var gridOutlines;
820 if (isVirtual) {
821 gridOutlines = _this._applyVirtualGrid(grid, direction, nextOutline);
822 } else if (appliedItems.length) {
823 gridOutlines = grid.applyGrid(appliedItems, direction, nextOutline);
824 } else {
825 gridOutlines = {
826 start: __spreadArray([], nextOutline, true),
827 end: __spreadArray([], nextOutline, true)
828 };
829 }
830 grid.setOutlines(gridOutlines);
831 nextOutline = gridOutlines[direction];
832 });
833 return {
834 start: renderingGroups[0].grid.getOutlines().start,
835 end: renderingGroups[renderingGroups.length - 1].grid.getOutlines().end
836 };
837 };
838 __proto.syncItems = function (nextItemInfos) {
839 var _this = this;
840 var prevItemKeys = this.itemKeys;
841 this.itemKeys = {};
842 var nextItems = this._syncItemInfos(nextItemInfos.map(function (info) {
843 return getItemInfo(info);
844 }), prevItemKeys);
845 var prevGroupKeys = this.groupKeys;
846 var nextManagerGroups = categorize(nextItems);
847 var startVirtualGroups = this._splitVirtualGroups("start", nextManagerGroups);
848 var endVirtualGroups = this._splitVirtualGroups("end", nextManagerGroups);
849 nextManagerGroups = __spreadArray(__spreadArray(__spreadArray([], startVirtualGroups, true), this._mergeVirtualGroups(nextManagerGroups), true), endVirtualGroups, true);
850 var nextGroups = nextManagerGroups.map(function (_a) {
851 var _b, _c;
852 var groupKey = _a.groupKey,
853 items = _a.items;
854 var isVirtual = !items[0] || items[0].type === ITEM_TYPE.VIRTUAL;
855 var grid = (_c = (_b = prevGroupKeys[groupKey]) === null || _b === void 0 ? void 0 : _b.grid) !== null && _c !== void 0 ? _c : _this._makeGrid();
856 var gridItems = isVirtual ? items : items.filter(function (_a) {
857 var type = _a.type;
858 return type === ITEM_TYPE.NORMAL;
859 });
860 grid.setItems(gridItems);
861 return {
862 type: isVirtual ? GROUP_TYPE.VIRTUAL : GROUP_TYPE.NORMAL,
863 groupKey: groupKey,
864 grid: grid,
865 items: gridItems,
866 renderItems: items
867 };
868 });
869 this._registerGroups(nextGroups);
870 };
871 __proto.renderItems = function (options) {
872 if (options === void 0) {
873 options = {};
874 }
875 if (options.useResize) {
876 this.groupItems.forEach(function (item) {
877 item.updateState = UPDATE_STATE.NEED_UPDATE;
878 });
879 var loadingItem = this._getLoadingItem();
880 if (loadingItem) {
881 loadingItem.updateState = UPDATE_STATE.NEED_UPDATE;
882 }
883 }
884 return _super.prototype.renderItems.call(this, options);
885 };
886 __proto.setCursors = function (startCursor, endCursor) {
887 this.startCursor = startCursor;
888 this.endCursor = endCursor;
889 this.items = this._getRenderingItems();
890 };
891 __proto.getStartCursor = function () {
892 return this.startCursor;
893 };
894 __proto.getEndCursor = function () {
895 return this.endCursor;
896 };
897 __proto.getGroupStatus = function (type, includePlaceholders) {
898 var orgStartCursor = this.startCursor;
899 var orgEndCursor = this.endCursor;
900 var orgGroups = this.groups;
901 var startGroup = orgGroups[orgStartCursor];
902 var endGroup = orgGroups[orgEndCursor];
903 var startCursor = orgStartCursor;
904 var endCursor = orgEndCursor;
905 var isMinimizeItems = type === STATUS_TYPE.MINIMIZE_INVISIBLE_ITEMS;
906 var isMinimizeGroups = type === STATUS_TYPE.MINIMIZE_INVISIBLE_GROUPS;
907 var groups;
908 if (type === STATUS_TYPE.REMOVE_INVISIBLE_GROUPS) {
909 groups = this.getVisibleGroups(includePlaceholders);
910 endCursor = groups.length - 1;
911 startCursor = 0;
912 } else {
913 groups = this.getGroups(includePlaceholders);
914 if (!includePlaceholders) {
915 startCursor = -1;
916 endCursor = -1;
917 for (var orgIndex = orgStartCursor; orgIndex <= orgEndCursor; ++orgIndex) {
918 var orgGroup = orgGroups[orgIndex];
919 if (orgGroup && orgGroup.type !== GROUP_TYPE.VIRTUAL) {
920 startCursor = groups.indexOf(orgGroup);
921 break;
922 }
923 }
924 for (var orgIndex = orgEndCursor; orgIndex >= orgStartCursor; --orgIndex) {
925 var orgGroup = orgGroups[orgIndex];
926 if (orgGroup && orgGroup.type !== GROUP_TYPE.VIRTUAL) {
927 endCursor = groups.lastIndexOf(orgGroup);
928 break;
929 }
930 }
931 }
932 }
933 var groupStatus = groups.map(function (_a, i) {
934 var grid = _a.grid,
935 groupKey = _a.groupKey;
936 var isOutsideCursor = i < startCursor || endCursor < i;
937 var isVirtualItems = isMinimizeItems && isOutsideCursor;
938 var isVirtualGroup = isMinimizeGroups && isOutsideCursor;
939 var gridItems = grid.getItems();
940 var items = isVirtualGroup ? [] : gridItems.map(function (item) {
941 return isVirtualItems ? item.getVirtualStatus() : item.getMinimizedStatus();
942 });
943 return {
944 type: isVirtualGroup || isVirtualItems ? GROUP_TYPE.VIRTUAL : GROUP_TYPE.NORMAL,
945 groupKey: groupKey,
946 outlines: grid.getOutlines(),
947 items: items
948 };
949 });
950 var totalItems = this.getGroupItems();
951 var itemStartCursor = totalItems.indexOf(startGroup === null || startGroup === void 0 ? void 0 : startGroup.items[0]);
952 var itemEndCursor = totalItems.indexOf(endGroup === null || endGroup === void 0 ? void 0 : endGroup.items.slice().reverse()[0]);
953 return {
954 cursors: [startCursor, endCursor],
955 orgCursors: [orgStartCursor, orgEndCursor],
956 itemCursors: [itemStartCursor, itemEndCursor],
957 startGroupKey: startGroup === null || startGroup === void 0 ? void 0 : startGroup.groupKey,
958 endGroupKey: endGroup === null || endGroup === void 0 ? void 0 : endGroup.groupKey,
959 groups: groupStatus,
960 outlines: this.outlines
961 };
962 };
963 __proto.fitOutlines = function (useFit) {
964 if (useFit === void 0) {
965 useFit = this.useFit;
966 }
967 var groups = this.groups;
968 var firstGroup = groups[0];
969 if (!firstGroup) {
970 return;
971 }
972 var outlines = firstGroup.grid.getOutlines();
973 var startOutline = outlines.start;
974 var outlineOffset = startOutline.length ? Math.min.apply(Math, startOutline) : 0;
975 // If the outline is less than 0, a fit occurs forcibly.
976 if (!useFit && outlineOffset > 0) {
977 return;
978 }
979 groups.forEach(function (_a) {
980 var grid = _a.grid;
981 var _b = grid.getOutlines(),
982 start = _b.start,
983 end = _b.end;
984 grid.setOutlines({
985 start: start.map(function (point) {
986 return point - outlineOffset;
987 }),
988 end: end.map(function (point) {
989 return point - outlineOffset;
990 })
991 });
992 });
993 this.groupItems.forEach(function (item) {
994 var contentPos = item.cssContentPos;
995 if (!isNumber(contentPos)) {
996 return;
997 }
998 item.cssContentPos = contentPos - outlineOffset;
999 });
1000 };
1001 __proto.setGroupStatus = function (status) {
1002 var _this = this;
1003 this.itemKeys = {};
1004 this.groupItems = [];
1005 this.items = [];
1006 var prevGroupKeys = this.groupKeys;
1007 var nextGroups = status.groups.map(function (_a) {
1008 var _b, _c;
1009 var type = _a.type,
1010 groupKey = _a.groupKey,
1011 items = _a.items,
1012 outlines = _a.outlines;
1013 var nextItems = _this._syncItemInfos(items);
1014 var grid = (_c = (_b = prevGroupKeys[groupKey]) === null || _b === void 0 ? void 0 : _b.grid) !== null && _c !== void 0 ? _c : _this._makeGrid();
1015 grid.setOutlines(outlines);
1016 grid.setItems(nextItems);
1017 return {
1018 type: type,
1019 groupKey: groupKey,
1020 grid: grid,
1021 items: nextItems,
1022 renderItems: nextItems
1023 };
1024 });
1025 this.setOutlines(status.outlines);
1026 this._registerGroups(nextGroups);
1027 this._updatePlaceholder();
1028 this.setCursors(status.cursors[0], status.cursors[1]);
1029 };
1030 __proto.appendPlaceholders = function (items, groupKey) {
1031 return this.insertPlaceholders("end", items, groupKey);
1032 };
1033 __proto.prependPlaceholders = function (items, groupKey) {
1034 return this.insertPlaceholders("start", items, groupKey);
1035 };
1036 __proto.removePlaceholders = function (type) {
1037 var groups = this.groups;
1038 var length = groups.length;
1039 if (type === "start") {
1040 var index = findIndex(groups, function (group) {
1041 return group.type === GROUP_TYPE.NORMAL;
1042 });
1043 groups.splice(0, index);
1044 } else if (type === "end") {
1045 var index = findLastIndex(groups, function (group) {
1046 return group.type === GROUP_TYPE.NORMAL;
1047 });
1048 groups.splice(index + 1, length - index - 1);
1049 } else {
1050 var groupKey_1 = type.groupKey;
1051 var index = findIndex(groups, function (group) {
1052 return group.groupKey === groupKey_1;
1053 });
1054 if (index > -1) {
1055 groups.splice(index, 1);
1056 }
1057 }
1058 this.syncItems(flatGroups(this.getGroups()));
1059 };
1060 __proto.insertPlaceholders = function (direction, items, groupKey) {
1061 var _a, _b;
1062 if (groupKey === void 0) {
1063 groupKey = makeKey(this.groupKeys, "virtual_");
1064 }
1065 var infos = [];
1066 if (isNumber(items)) {
1067 infos = range(items).map(function () {
1068 return {
1069 type: ITEM_TYPE.VIRTUAL,
1070 groupKey: groupKey
1071 };
1072 });
1073 } else if (Array.isArray(items)) {
1074 infos = items.map(function (status) {
1075 return __assign(__assign({
1076 groupKey: groupKey
1077 }, status), {
1078 type: ITEM_TYPE.VIRTUAL
1079 });
1080 });
1081 }
1082 var grid = this._makeGrid();
1083 var nextItems = this._syncItemInfos(infos, this.itemKeys);
1084 this._updatePlaceholder(nextItems);
1085 grid.setItems(nextItems);
1086 var group = {
1087 type: GROUP_TYPE.VIRTUAL,
1088 groupKey: groupKey,
1089 grid: grid,
1090 items: nextItems,
1091 renderItems: nextItems
1092 };
1093 this.groupKeys[groupKey] = group;
1094 if (direction === "end") {
1095 this.groups.push(group);
1096 (_a = this.groupItems).push.apply(_a, nextItems);
1097 } else {
1098 this.groups.splice(0, 0, group);
1099 (_b = this.groupItems).splice.apply(_b, __spreadArray([0, 0], nextItems, false));
1100 if (this.startCursor > -1) {
1101 ++this.startCursor;
1102 ++this.endCursor;
1103 }
1104 }
1105 return {
1106 group: group,
1107 items: nextItems
1108 };
1109 };
1110 __proto.shouldRerenderItems = function () {
1111 var isRerender = false;
1112 this.getVisibleGroups().forEach(function (group) {
1113 var items = group.items;
1114 if (items.length === group.renderItems.length || items.every(function (item) {
1115 return item.mountState === MOUNT_STATE.UNCHECKED;
1116 })) {
1117 return;
1118 }
1119 isRerender = true;
1120 group.renderItems = __spreadArray([], items, true);
1121 });
1122 if (isRerender) {
1123 this.items = this._getRenderingItems();
1124 }
1125 return isRerender;
1126 };
1127 __proto._updateItems = function (items) {
1128 this.itemRenderer.updateEqualSizeItems(items, this.groupItems);
1129 };
1130 __proto._getGroupItems = function () {
1131 return flatGroups(this.getGroups(true));
1132 };
1133 __proto._getRenderingItems = function () {
1134 var items = flat(this.getVisibleGroups(true).map(function (item) {
1135 return item.renderItems;
1136 }));
1137 var loadingGrid = this._loadingGrid;
1138 var loadingItem = loadingGrid.getLoadingItem();
1139 if (loadingItem) {
1140 if (loadingGrid.type === "end") {
1141 items.push(loadingItem);
1142 } else if (loadingGrid.type === "start") {
1143 items.unshift(loadingItem);
1144 }
1145 }
1146 return items;
1147 };
1148 __proto._checkShouldRender = function (options) {
1149 var GridConstructor = this.options.gridConstructor;
1150 var prevOptions = this.gridOptions;
1151 var propertyTypes = GridConstructor.propertyTypes;
1152 for (var name in prevOptions) {
1153 if (!(name in options) && propertyTypes[name] === PROPERTY_TYPE.RENDER_PROPERTY) {
1154 return true;
1155 }
1156 }
1157 for (var name in options) {
1158 if (prevOptions[name] !== options[name] && propertyTypes[name] === PROPERTY_TYPE.RENDER_PROPERTY) {
1159 return true;
1160 }
1161 }
1162 return false;
1163 };
1164 __proto._applyVirtualGrid = function (grid, direction, outline) {
1165 var startOutline = outline.length ? __spreadArray([], outline, true) : [0];
1166 var prevOutlines = grid.getOutlines();
1167 var prevOutline = prevOutlines[direction === "end" ? "start" : "end"];
1168 if (prevOutline.length !== startOutline.length || prevOutline.some(function (value, i) {
1169 return value !== startOutline[i];
1170 })) {
1171 return {
1172 start: __spreadArray([], startOutline, true),
1173 end: __spreadArray([], startOutline, true)
1174 };
1175 }
1176 return prevOutlines;
1177 };
1178 __proto._syncItemInfos = function (nextItemInfos, prevItemKeys) {
1179 if (prevItemKeys === void 0) {
1180 prevItemKeys = {};
1181 }
1182 var horizontal = this.options.horizontal;
1183 var nextItemKeys = this.itemKeys;
1184 nextItemInfos.filter(function (info) {
1185 return info.key != null;
1186 }).forEach(function (info) {
1187 var key = info.key;
1188 var prevItem = prevItemKeys[key];
1189 if (!prevItem) {
1190 nextItemKeys[key] = new InfiniteGridItem(horizontal, __assign({}, info));
1191 } else if (prevItem.type === ITEM_TYPE.VIRTUAL && info.type !== ITEM_TYPE.VIRTUAL) {
1192 nextItemKeys[key] = new InfiniteGridItem(horizontal, __assign({
1193 orgRect: prevItem.orgRect,
1194 rect: prevItem.rect
1195 }, info));
1196 } else {
1197 if (info.data) {
1198 prevItem.data = info.data;
1199 }
1200 if (info.groupKey != null) {
1201 prevItem.groupKey = info.groupKey;
1202 }
1203 if (info.element) {
1204 prevItem.element = info.element;
1205 }
1206 nextItemKeys[key] = prevItem;
1207 }
1208 });
1209 var nextItems = nextItemInfos.map(function (info) {
1210 var key = info.key;
1211 if (info.key == null) {
1212 key = makeKey(nextItemKeys, info.type === ITEM_TYPE.VIRTUAL ? "virtual_" : "");
1213 }
1214 var item = nextItemKeys[key];
1215 if (!item) {
1216 var prevItem = prevItemKeys[key];
1217 if (prevItem) {
1218 item = prevItem;
1219 if (info.data) {
1220 item.data = info.data;
1221 }
1222 if (info.element) {
1223 item.element = info.element;
1224 }
1225 } else {
1226 item = new InfiniteGridItem(horizontal, __assign(__assign({}, info), {
1227 key: key
1228 }));
1229 }
1230 nextItemKeys[key] = item;
1231 }
1232 return item;
1233 });
1234 return nextItems;
1235 };
1236 __proto._registerGroups = function (groups) {
1237 var nextGroupKeys = {};
1238 groups.forEach(function (group) {
1239 nextGroupKeys[group.groupKey] = group;
1240 });
1241 this.groups = groups;
1242 this.groupKeys = nextGroupKeys;
1243 this.groupItems = this._getGroupItems();
1244 };
1245 __proto._splitVirtualGroups = function (direction, nextGroups) {
1246 var groups = splitVirtualGroups(this.groups, direction, nextGroups);
1247 var itemKeys = this.itemKeys;
1248 groups.forEach(function (_a) {
1249 var renderItems = _a.renderItems;
1250 renderItems.forEach(function (item) {
1251 itemKeys[item.key] = item;
1252 });
1253 });
1254 return groups;
1255 };
1256 __proto._mergeVirtualGroups = function (groups) {
1257 var itemKeys = this.itemKeys;
1258 var groupKeys = this.groupKeys;
1259 groups.forEach(function (group) {
1260 var prevGroup = groupKeys[group.groupKey];
1261 if (!prevGroup) {
1262 return;
1263 }
1264 var items = group.items;
1265 if (items.every(function (item) {
1266 return item.mountState === MOUNT_STATE.UNCHECKED;
1267 })) {
1268 prevGroup.renderItems.forEach(function (item) {
1269 if (item.type === ITEM_TYPE.VIRTUAL && !itemKeys[item.key]) {
1270 items.push(item);
1271 itemKeys[item.key] = item;
1272 }
1273 });
1274 }
1275 });
1276 return groups;
1277 };
1278 __proto._updatePlaceholder = function (items) {
1279 if (items === void 0) {
1280 items = this.groupItems;
1281 }
1282 var placeholder = this._placeholder;
1283 if (!placeholder) {
1284 return;
1285 }
1286 items.filter(function (item) {
1287 return item.type === ITEM_TYPE.VIRTUAL;
1288 }).forEach(function (item) {
1289 setPlaceholder(item, placeholder);
1290 });
1291 };
1292 __proto._makeGrid = function () {
1293 var GridConstructor = this.options.gridConstructor;
1294 var gridOptions = this.gridOptions;
1295 var container = this.containerElement;
1296 return new GridConstructor(container, __assign(__assign({}, gridOptions), {
1297 useFit: false,
1298 autoResize: false,
1299 useResizeObserver: false,
1300 observeChildren: false,
1301 renderOnPropertyChange: false,
1302 externalContainerManager: this.containerManager,
1303 externalItemRenderer: this.itemRenderer
1304 }));
1305 };
1306 __proto._getLoadingGroup = function () {
1307 var loadingGrid = this._loadingGrid;
1308 var items = loadingGrid.getItems();
1309 return {
1310 groupKey: LOADING_GROUP_KEY,
1311 type: GROUP_TYPE.NORMAL,
1312 grid: loadingGrid,
1313 items: items,
1314 renderItems: items
1315 };
1316 };
1317 __proto._getLoadingItem = function () {
1318 return this._loadingGrid.getLoadingItem();
1319 };
1320 GroupManager.defaultOptions = __assign(__assign({}, Grid.defaultOptions), {
1321 appliedItemChecker: function () {
1322 return false;
1323 },
1324 gridConstructor: null,
1325 gridOptions: {}
1326 });
1327 GroupManager.propertyTypes = __assign(__assign({}, Grid.propertyTypes), {
1328 gridConstructor: PROPERTY_TYPE.PROPERTY,
1329 gridOptions: PROPERTY_TYPE.PROPERTY
1330 });
1331 GroupManager = __decorate([GetterSetter], GroupManager);
1332 return GroupManager;
1333}(Grid);
1334
1335var Infinite = /*#__PURE__*/function (_super) {
1336 __extends(Infinite, _super);
1337 function Infinite(options) {
1338 var _this = _super.call(this) || this;
1339 _this.startCursor = -1;
1340 _this.endCursor = -1;
1341 _this.size = 0;
1342 _this.items = [];
1343 _this.itemKeys = {};
1344 _this.options = __assign({
1345 threshold: 0,
1346 useRecycle: true,
1347 defaultDirection: "end"
1348 }, options);
1349 return _this;
1350 }
1351 var __proto = Infinite.prototype;
1352 __proto.scroll = function (scrollPos) {
1353 var _a, _b;
1354 var prevStartCursor = this.startCursor;
1355 var prevEndCursor = this.endCursor;
1356 var items = this.items;
1357 var length = items.length;
1358 var size = this.size;
1359 var _c = this.options,
1360 defaultDirection = _c.defaultDirection,
1361 threshold = _c.threshold,
1362 useRecycle = _c.useRecycle;
1363 var isDirectionEnd = defaultDirection === "end";
1364 if (!length) {
1365 this.trigger(isDirectionEnd ? "requestAppend" : "requestPrepend", {
1366 key: undefined,
1367 isVirtual: false
1368 });
1369 return;
1370 } else if (prevStartCursor === -1 || prevEndCursor === -1) {
1371 var nextCursor = isDirectionEnd ? 0 : length - 1;
1372 this.trigger("change", {
1373 prevStartCursor: prevStartCursor,
1374 prevEndCursor: prevEndCursor,
1375 nextStartCursor: nextCursor,
1376 nextEndCursor: nextCursor
1377 });
1378 return;
1379 }
1380 var endScrollPos = scrollPos + size;
1381 var startEdgePos = Math.max.apply(Math, items[prevStartCursor].startOutline);
1382 var endEdgePos = Math.min.apply(Math, items[prevEndCursor].endOutline);
1383 var visibles = items.map(function (item) {
1384 var startOutline = item.startOutline,
1385 endOutline = item.endOutline;
1386 if (!startOutline.length || !endOutline.length || isFlatOutline(startOutline, endOutline)) {
1387 return false;
1388 }
1389 var startPos = Math.min.apply(Math, startOutline);
1390 var endPos = Math.max.apply(Math, endOutline);
1391 if (startPos - threshold <= endScrollPos && scrollPos <= endPos + threshold) {
1392 return true;
1393 }
1394 return false;
1395 });
1396 var hasStartItems = 0 < prevStartCursor;
1397 var hasEndItems = prevEndCursor < length - 1;
1398 var isStart = scrollPos <= startEdgePos + threshold;
1399 var isEnd = endScrollPos >= endEdgePos - threshold;
1400 var nextStartCursor = visibles.indexOf(true);
1401 var nextEndCursor = visibles.lastIndexOf(true);
1402 if (nextStartCursor === -1) {
1403 nextStartCursor = prevStartCursor;
1404 nextEndCursor = prevEndCursor;
1405 }
1406 if (!useRecycle) {
1407 nextStartCursor = Math.min(nextStartCursor, prevStartCursor);
1408 nextEndCursor = Math.max(nextEndCursor, prevEndCursor);
1409 }
1410 if (nextStartCursor === prevStartCursor && hasStartItems && isStart) {
1411 nextStartCursor -= 1;
1412 }
1413 if (nextEndCursor === prevEndCursor && hasEndItems && isEnd) {
1414 nextEndCursor += 1;
1415 }
1416 var nextVisibleItems = items.slice(nextStartCursor, nextEndCursor + 1);
1417 // It must contain no virtual items.
1418 if (nextVisibleItems.every(function (item) {
1419 return item.isVirtual === true;
1420 })) {
1421 // The real item can be in either the start or end direction.
1422 var hasRealItem = false;
1423 for (var i = nextStartCursor - 1; i >= 0; --i) {
1424 if (!items[i].isVirtual) {
1425 nextStartCursor = i;
1426 hasRealItem = true;
1427 break;
1428 }
1429 }
1430 if (!hasRealItem) {
1431 for (var i = nextEndCursor + 1; i < length; ++i) {
1432 if (!items[i].isVirtual) {
1433 nextEndCursor = i;
1434 hasRealItem = true;
1435 break;
1436 }
1437 }
1438 }
1439 if (hasRealItem) {
1440 nextVisibleItems = items.slice(nextStartCursor, nextEndCursor + 1);
1441 }
1442 }
1443 var hasVirtualItems = nextVisibleItems.some(function (item) {
1444 return item.isVirtual === true;
1445 });
1446 if (prevStartCursor !== nextStartCursor || prevEndCursor !== nextEndCursor) {
1447 this.trigger("change", {
1448 prevStartCursor: prevStartCursor,
1449 prevEndCursor: prevEndCursor,
1450 nextStartCursor: nextStartCursor,
1451 nextEndCursor: nextEndCursor
1452 });
1453 if (!hasVirtualItems) {
1454 return;
1455 }
1456 }
1457 // If a virtual item is included, a requestPrepend (or requestAppend) event is triggered.
1458 if (hasVirtualItems) {
1459 var isStartVirtual = (_a = nextVisibleItems[0]) === null || _a === void 0 ? void 0 : _a.isVirtual;
1460 var isEndVirtual = (_b = nextVisibleItems[nextVisibleItems.length - 1]) === null || _b === void 0 ? void 0 : _b.isVirtual;
1461 if ((!isDirectionEnd || !isEnd) && isStartVirtual) {
1462 var realItemIndex = findIndex(nextVisibleItems, function (item) {
1463 return !item.isVirtual;
1464 });
1465 var endVirtualItemIndex = (realItemIndex === -1 ? nextVisibleItems.length : realItemIndex) - 1;
1466 if (nextVisibleItems[endVirtualItemIndex]) {
1467 this.trigger("requestPrepend", {
1468 key: realItemIndex > -1 ? nextVisibleItems[realItemIndex].key : undefined,
1469 nextKey: nextVisibleItems[endVirtualItemIndex].key,
1470 nextKeys: nextVisibleItems.slice(0, endVirtualItemIndex + 1).map(function (item) {
1471 return item.key;
1472 }),
1473 isVirtual: true
1474 });
1475 }
1476 } else if ((isDirectionEnd || !isStart) && isEndVirtual) {
1477 var realItemIndex = findLastIndex(nextVisibleItems, function (item) {
1478 return !item.isVirtual;
1479 });
1480 var startVirtualItemIndex = realItemIndex + 1;
1481 if (nextVisibleItems[startVirtualItemIndex]) {
1482 this.trigger("requestAppend", {
1483 key: realItemIndex > -1 ? nextVisibleItems[realItemIndex].key : undefined,
1484 nextKey: nextVisibleItems[startVirtualItemIndex].key,
1485 nextKeys: nextVisibleItems.slice(startVirtualItemIndex).map(function (item) {
1486 return item.key;
1487 }),
1488 isVirtual: true
1489 });
1490 }
1491 }
1492 } else if (!this._requestVirtualItems()) {
1493 if ((!isDirectionEnd || !isEnd) && isStart) {
1494 this.trigger("requestPrepend", {
1495 key: items[prevStartCursor].key,
1496 isVirtual: false
1497 });
1498 } else if ((isDirectionEnd || !isStart) && isEnd) {
1499 this.trigger("requestAppend", {
1500 key: items[prevEndCursor].key,
1501 isVirtual: false
1502 });
1503 }
1504 }
1505 };
1506 /**
1507 * Call the requestAppend or requestPrepend event to fill the virtual items.
1508 * @ko virtual item을 채우기 위해 requestAppend 또는 requestPrepend 이벤트를 호출합니다.
1509 * @return - Whether the event is called. <ko>이벤트를 호출했는지 여부.</ko>
1510 */
1511 __proto._requestVirtualItems = function () {
1512 var isDirectionEnd = this.options.defaultDirection === "end";
1513 var items = this.items;
1514 var totalVisibleItems = this.getVisibleItems();
1515 var visibleItems = totalVisibleItems.filter(function (item) {
1516 return !item.isVirtual;
1517 });
1518 var totalVisibleLength = totalVisibleItems.length;
1519 var visibleLength = visibleItems.length;
1520 var startCursor = this.getStartCursor();
1521 var endCursor = this.getEndCursor();
1522 if (visibleLength === totalVisibleLength) {
1523 return false;
1524 } else if (visibleLength) {
1525 var startKey_1 = visibleItems[0].key;
1526 var endKey_1 = visibleItems[visibleLength - 1].key;
1527 var startIndex = findIndex(items, function (item) {
1528 return item.key === startKey_1;
1529 }) - 1;
1530 var endIndex = findIndex(items, function (item) {
1531 return item.key === endKey_1;
1532 }) + 1;
1533 var isEnd = endIndex <= endCursor;
1534 var isStart = startIndex >= startCursor;
1535 // Fill the placeholder with the original item.
1536 if ((isDirectionEnd || !isStart) && isEnd) {
1537 this.trigger("requestAppend", {
1538 key: endKey_1,
1539 nextKey: items[endIndex].key,
1540 isVirtual: true
1541 });
1542 return true;
1543 } else if ((!isDirectionEnd || !isEnd) && isStart) {
1544 this.trigger("requestPrepend", {
1545 key: startKey_1,
1546 nextKey: items[startIndex].key,
1547 isVirtual: true
1548 });
1549 return true;
1550 }
1551 } else if (totalVisibleLength) {
1552 var lastItem = totalVisibleItems[totalVisibleLength - 1];
1553 if (isDirectionEnd) {
1554 this.trigger("requestAppend", {
1555 nextKey: totalVisibleItems[0].key,
1556 isVirtual: true
1557 });
1558 } else {
1559 this.trigger("requestPrepend", {
1560 nextKey: lastItem.key,
1561 isVirtual: true
1562 });
1563 }
1564 return true;
1565 }
1566 return false;
1567 };
1568 __proto.setCursors = function (startCursor, endCursor) {
1569 this.startCursor = startCursor;
1570 this.endCursor = endCursor;
1571 };
1572 __proto.setSize = function (size) {
1573 this.size = size;
1574 };
1575 __proto.getStartCursor = function () {
1576 return this.startCursor;
1577 };
1578 __proto.getEndCursor = function () {
1579 return this.endCursor;
1580 };
1581 __proto.isLoading = function (direction) {
1582 var startCursor = this.startCursor;
1583 var endCursor = this.endCursor;
1584 var items = this.items;
1585 var firstItem = items[startCursor];
1586 var lastItem = items[endCursor];
1587 var length = items.length;
1588 if (direction === DIRECTION.END && endCursor > -1 && endCursor < length - 1 && !lastItem.isVirtual && !isFlatOutline(lastItem.startOutline, lastItem.endOutline)) {
1589 return false;
1590 }
1591 if (direction === DIRECTION.START && startCursor > 0 && !firstItem.isVirtual && !isFlatOutline(firstItem.startOutline, firstItem.endOutline)) {
1592 return false;
1593 }
1594 return true;
1595 };
1596 __proto.setItems = function (nextItems) {
1597 this.items = nextItems;
1598 var itemKeys = {};
1599 nextItems.forEach(function (item) {
1600 itemKeys[item.key] = item;
1601 });
1602 this.itemKeys = itemKeys;
1603 };
1604 __proto.syncItems = function (nextItems) {
1605 var prevItems = this.items;
1606 var prevStartCursor = this.startCursor;
1607 var prevEndCursor = this.endCursor;
1608 var _a = getNextCursors(this.items.map(function (item) {
1609 return item.key;
1610 }), nextItems.map(function (item) {
1611 return item.key;
1612 }), prevStartCursor, prevEndCursor),
1613 nextStartCursor = _a.startCursor,
1614 nextEndCursor = _a.endCursor;
1615 // sync items between cursors
1616 var isChange = nextEndCursor - nextStartCursor !== prevEndCursor - prevStartCursor || prevStartCursor === -1 || nextStartCursor === -1;
1617 if (!isChange) {
1618 var prevVisibleItems = prevItems.slice(prevStartCursor, prevEndCursor + 1);
1619 var nextVisibleItems = nextItems.slice(nextStartCursor, nextEndCursor + 1);
1620 var visibleResult = diff(prevVisibleItems, nextVisibleItems, function (item) {
1621 return item.key;
1622 });
1623 isChange = visibleResult.added.length > 0 || visibleResult.removed.length > 0 || visibleResult.changed.length > 0;
1624 }
1625 this.setItems(nextItems);
1626 this.setCursors(nextStartCursor, nextEndCursor);
1627 return isChange;
1628 };
1629 __proto.getItems = function () {
1630 return this.items;
1631 };
1632 __proto.getVisibleItems = function () {
1633 var startCursor = this.startCursor;
1634 var endCursor = this.endCursor;
1635 if (startCursor === -1) {
1636 return [];
1637 }
1638 return this.items.slice(startCursor, endCursor + 1);
1639 };
1640 __proto.getItemByKey = function (key) {
1641 return this.itemKeys[key];
1642 };
1643 __proto.getRenderedVisibleItems = function () {
1644 var items = this.getVisibleItems();
1645 var rendered = items.map(function (_a) {
1646 var startOutline = _a.startOutline,
1647 endOutline = _a.endOutline;
1648 var length = startOutline.length;
1649 if (length === 0 || length !== endOutline.length) {
1650 return false;
1651 }
1652 return startOutline.some(function (pos, i) {
1653 return endOutline[i] !== pos;
1654 });
1655 });
1656 var startIndex = rendered.indexOf(true);
1657 var endIndex = rendered.lastIndexOf(true);
1658 return endIndex === -1 ? [] : items.slice(startIndex, endIndex + 1);
1659 };
1660 __proto.destroy = function () {
1661 this.off();
1662 this.startCursor = -1;
1663 this.endCursor = -1;
1664 this.items = [];
1665 this.size = 0;
1666 };
1667 return Infinite;
1668}(Component);
1669
1670var Renderer = /*#__PURE__*/function (_super) {
1671 __extends(Renderer, _super);
1672 function Renderer() {
1673 var _this = _super !== null && _super.apply(this, arguments) || this;
1674 _this.items = [];
1675 _this.container = null;
1676 _this.rendererKey = 0;
1677 _this._updateTimer = 0;
1678 _this._state = {};
1679 _this._isItemChanged = false;
1680 return _this;
1681 }
1682 var __proto = Renderer.prototype;
1683 __proto.updateKey = function () {
1684 this.rendererKey = Date.now();
1685 };
1686 __proto.getItems = function () {
1687 return this.items;
1688 };
1689 __proto.setContainer = function (container) {
1690 this.container = container;
1691 };
1692 __proto.render = function (nextItems, state) {
1693 return this.syncItems(nextItems, state);
1694 };
1695 __proto.update = function (state) {
1696 var _this = this;
1697 if (state === void 0) {
1698 state = {};
1699 }
1700 this._state = __assign(__assign({}, this._state), state);
1701 this.trigger("update", {
1702 state: state
1703 });
1704 clearTimeout(this._updateTimer);
1705 this._updateTimer = window.setTimeout(function () {
1706 _this.trigger("requestUpdate", {
1707 state: state
1708 });
1709 });
1710 };
1711 __proto.updated = function (nextElements) {
1712 var _a, _b;
1713 if (nextElements === void 0) {
1714 nextElements = (_b = (_a = this.container) === null || _a === void 0 ? void 0 : _a.children) !== null && _b !== void 0 ? _b : [];
1715 }
1716 var diffResult = this._diffResult;
1717 var isChanged = !!(diffResult.added.length || diffResult.removed.length || diffResult.changed.length);
1718 var state = this._state;
1719 var isItemChanged = this._isItemChanged;
1720 var nextItems = diffResult.list;
1721 this._isItemChanged = false;
1722 this._state = {};
1723 this.items = nextItems;
1724 nextItems.forEach(function (item, i) {
1725 item.element = nextElements[i];
1726 });
1727 this.trigger("updated", {
1728 items: nextItems,
1729 elements: toArray(nextElements),
1730 diffResult: this._diffResult,
1731 state: state,
1732 isItemChanged: isItemChanged,
1733 isChanged: isChanged
1734 });
1735 return isChanged;
1736 };
1737 __proto.syncItems = function (items, state) {
1738 if (state === void 0) {
1739 state = {};
1740 }
1741 var rendererKey = this.rendererKey;
1742 var prevItems = this.items;
1743 var nextItems = items.map(function (item) {
1744 return __assign(__assign({}, item), {
1745 renderKey: "".concat(rendererKey, "_").concat(item.key)
1746 });
1747 });
1748 var result = diff(prevItems, nextItems, function (item) {
1749 return item.renderKey;
1750 });
1751 this._isItemChanged = !!result.added.length || !!result.removed.length || !!result.changed.length;
1752 this._state = __assign(__assign({}, this._state), state);
1753 this._diffResult = result;
1754 return result;
1755 };
1756 __proto.destroy = function () {
1757 this.off();
1758 };
1759 return Renderer;
1760}(Component);
1761
1762var VanillaRenderer = /*#__PURE__*/function (_super) {
1763 __extends(VanillaRenderer, _super);
1764 function VanillaRenderer() {
1765 return _super !== null && _super.apply(this, arguments) || this;
1766 }
1767 var __proto = VanillaRenderer.prototype;
1768 __proto.render = function (nextItems, state) {
1769 var container = this.container;
1770 var result = _super.prototype.render.call(this, nextItems, state);
1771 var prevList = result.prevList,
1772 removed = result.removed,
1773 ordered = result.ordered,
1774 added = result.added,
1775 list = result.list;
1776 var diffList = __spreadArray([], prevList, true);
1777 removed.forEach(function (index) {
1778 diffList.splice(index, 1);
1779 container.removeChild(prevList[index].element);
1780 });
1781 ordered.forEach(function (_a) {
1782 var _b, _c;
1783 var prevIndex = _a[0],
1784 nextIndex = _a[1];
1785 var item = diffList.splice(prevIndex, 1)[0];
1786 diffList.splice(nextIndex, 0, item);
1787 container.insertBefore(item.element, (_c = (_b = diffList[nextIndex + 1]) === null || _b === void 0 ? void 0 : _b.element) !== null && _c !== void 0 ? _c : null);
1788 });
1789 added.forEach(function (index) {
1790 var _a, _b;
1791 var item = list[index];
1792 diffList.splice(index, 0, item);
1793 container.insertBefore(item.element, (_b = (_a = diffList[index + 1]) === null || _a === void 0 ? void 0 : _a.element) !== null && _b !== void 0 ? _b : null);
1794 });
1795 this.updated(container.children);
1796 return result;
1797 };
1798 return VanillaRenderer;
1799}(Renderer);
1800
1801var VanillaGridRenderer = /*#__PURE__*/function (_super) {
1802 __extends(VanillaGridRenderer, _super);
1803 function VanillaGridRenderer() {
1804 return _super !== null && _super.apply(this, arguments) || this;
1805 }
1806 var __proto = VanillaGridRenderer.prototype;
1807 __proto.syncItems = function (nextItems) {
1808 var result = _super.prototype.syncItems.call(this, nextItems);
1809 var added = result.added,
1810 list = result.list;
1811 added.forEach(function (index) {
1812 var orgItem = nextItems[index].orgItem;
1813 if (orgItem.html && !orgItem.element) {
1814 orgItem.element = convertHTMLtoElement(orgItem.html)[0];
1815 }
1816 list[index].element = orgItem.element;
1817 });
1818 return result;
1819 };
1820 return VanillaGridRenderer;
1821}(VanillaRenderer);
1822
1823var ScrollManager = /*#__PURE__*/function (_super) {
1824 __extends(ScrollManager, _super);
1825 function ScrollManager(wrapper, options) {
1826 var _this = _super.call(this) || this;
1827 _this.wrapper = wrapper;
1828 _this.prevScrollPos = null;
1829 _this.scrollOffset = 0;
1830 _this.contentSize = 0;
1831 _this._isScrollIssue = IS_IOS;
1832 _this._onCheck = function () {
1833 var prevScrollPos = _this.getScrollPos();
1834 var nextScrollPos = _this.getOrgScrollPos();
1835 _this.setScrollPos(nextScrollPos);
1836 if (prevScrollPos === null || _this._isScrollIssue && nextScrollPos === 0 || prevScrollPos === nextScrollPos) {
1837 nextScrollPos && (_this._isScrollIssue = false);
1838 return;
1839 }
1840 _this._isScrollIssue = false;
1841 _this.trigger(new ComponentEvent("scroll", {
1842 direction: prevScrollPos < nextScrollPos ? "end" : "start",
1843 scrollPos: nextScrollPos,
1844 relativeScrollPos: _this.getRelativeScrollPos()
1845 }));
1846 };
1847 _this.options = __assign({
1848 container: false,
1849 containerTag: "div",
1850 horizontal: false,
1851 scrollContainer: null
1852 }, options);
1853 _this._init();
1854 return _this;
1855 }
1856 var __proto = ScrollManager.prototype;
1857 __proto.getWrapper = function () {
1858 return this.wrapper;
1859 };
1860 __proto.getContainer = function () {
1861 return this.container;
1862 };
1863 __proto.getScrollContainer = function () {
1864 return this.scrollContainer;
1865 };
1866 __proto.getScrollOffset = function () {
1867 return this.scrollOffset;
1868 };
1869 __proto.getContentSize = function () {
1870 return this.contentSize;
1871 };
1872 __proto.getRelativeScrollPos = function () {
1873 return (this.prevScrollPos || 0) - this.scrollOffset;
1874 };
1875 __proto.getScrollPos = function () {
1876 return this.prevScrollPos;
1877 };
1878 __proto.setScrollPos = function (pos) {
1879 this.prevScrollPos = pos;
1880 };
1881 __proto.getOrgScrollPos = function () {
1882 var eventTarget = this.eventTarget;
1883 var horizontal = this.options.horizontal;
1884 var prop = "scroll".concat(horizontal ? "Left" : "Top");
1885 if (isWindow(eventTarget)) {
1886 return window[horizontal ? "pageXOffset" : "pageYOffset"] || document.documentElement[prop] || document.body[prop];
1887 } else {
1888 return eventTarget[prop];
1889 }
1890 };
1891 __proto.setStatus = function (status) {
1892 this.contentSize = status.contentSize;
1893 this.scrollOffset = status.scrollOffset;
1894 this.prevScrollPos = status.prevScrollPos;
1895 this.scrollTo(this.prevScrollPos);
1896 };
1897 __proto.getStatus = function () {
1898 return {
1899 contentSize: this.contentSize,
1900 scrollOffset: this.scrollOffset,
1901 prevScrollPos: this.prevScrollPos
1902 };
1903 };
1904 __proto.scrollTo = function (pos) {
1905 var eventTarget = this.eventTarget;
1906 var horizontal = this.options.horizontal;
1907 var _a = horizontal ? [pos, 0] : [0, pos],
1908 x = _a[0],
1909 y = _a[1];
1910 if (isWindow(eventTarget)) {
1911 eventTarget.scroll(x, y);
1912 } else {
1913 eventTarget.scrollLeft = x;
1914 eventTarget.scrollTop = y;
1915 }
1916 };
1917 __proto.scrollBy = function (pos) {
1918 if (!pos) {
1919 return;
1920 }
1921 var eventTarget = this.eventTarget;
1922 var horizontal = this.options.horizontal;
1923 var _a = horizontal ? [pos, 0] : [0, pos],
1924 x = _a[0],
1925 y = _a[1];
1926 this.prevScrollPos += pos;
1927 if (isWindow(eventTarget)) {
1928 eventTarget.scrollBy(x, y);
1929 } else {
1930 eventTarget.scrollLeft += x;
1931 eventTarget.scrollTop += y;
1932 }
1933 };
1934 __proto.resize = function () {
1935 var scrollContainer = this.scrollContainer;
1936 var horizontal = this.options.horizontal;
1937 var isBody = scrollContainer === document.body;
1938 var scrollContainerRect = isBody ? {
1939 top: 0,
1940 left: 0
1941 } : scrollContainer.getBoundingClientRect();
1942 var containerRect = this.container.getBoundingClientRect();
1943 this.scrollOffset = (this.prevScrollPos || 0) + (horizontal ? containerRect.left - scrollContainerRect.left : containerRect.top - scrollContainerRect.top);
1944 if (isBody) {
1945 this.contentSize = horizontal ? window.innerWidth : window.innerHeight;
1946 } else {
1947 this.contentSize = horizontal ? scrollContainer.offsetWidth : scrollContainer.offsetHeight;
1948 }
1949 };
1950 __proto.destroy = function () {
1951 var container = this.container;
1952 this.eventTarget.removeEventListener("scroll", this._onCheck);
1953 if (this._isCreateElement) {
1954 var scrollContainer = this.scrollContainer;
1955 var fragment_1 = document.createDocumentFragment();
1956 var childNodes = toArray(container.childNodes);
1957 scrollContainer.removeChild(container);
1958 childNodes.forEach(function (childNode) {
1959 fragment_1.appendChild(childNode);
1960 });
1961 scrollContainer.appendChild(fragment_1);
1962 } else if (this.options.container) {
1963 container.style.cssText = this._orgCSSText;
1964 }
1965 };
1966 __proto._init = function () {
1967 var _a;
1968 var _b = this.options,
1969 containerOption = _b.container,
1970 containerTag = _b.containerTag,
1971 horizontal = _b.horizontal,
1972 scrollContainerOption = _b.scrollContainer;
1973 var wrapper = this.wrapper;
1974 var scrollContainer = wrapper;
1975 var container = wrapper;
1976 var containerCSSText = "";
1977 if (!containerOption) {
1978 scrollContainer = findTarget(scrollContainerOption) || document.body;
1979 containerCSSText = container.style.cssText;
1980 } else {
1981 if (containerOption === true) {
1982 // Create Container
1983 container = document.createElement(containerTag);
1984 container.style.position = "relative";
1985 container.className = CONTAINER_CLASS_NAME;
1986 var childNodes = toArray(scrollContainer.childNodes);
1987 childNodes.forEach(function (childNode) {
1988 container.appendChild(childNode);
1989 });
1990 scrollContainer.appendChild(container);
1991 this._isCreateElement = true;
1992 } else {
1993 // Find Container
1994 container = findTarget(containerOption);
1995 }
1996 containerCSSText = container.style.cssText;
1997 var style = scrollContainer.style;
1998 _a = horizontal ? ["scroll", "hidden"] : ["hidden", "scroll"], style.overflowX = _a[0], style.overflowY = _a[1];
1999 if (horizontal) {
2000 container.style.height = "100%";
2001 }
2002 }
2003 var eventTarget = scrollContainer === document.body ? window : scrollContainer;
2004 eventTarget.addEventListener("scroll", this._onCheck);
2005 this._orgCSSText = containerCSSText;
2006 this.container = container;
2007 this.scrollContainer = scrollContainer;
2008 this.eventTarget = eventTarget;
2009 this.resize();
2010 this.setScrollPos(this.getOrgScrollPos());
2011 };
2012 return ScrollManager;
2013}(Component);
2014
2015/**
2016 * 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
2017 * @ko 콘텐츠가 있는 아이템을 레이아웃 타입에 따라 무한으로 배치하는 모듈. 다양한 크기의 아이템을 다양한 레이아웃으로 배치할 수 있다. 아이템의 개수가 계속 늘어나도 모듈이 처리하는 DOM의 개수를 일정하게 유지해 최적의 성능을 보장한다
2018 * @extends Component
2019 * @support {"ie": "9+(with polyfill)", "ch" : "latest", "ff" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "4.X+"}
2020 * @example
2021```html
2022<ul id="grid">
2023 <li class="card">
2024 <div>test1</div>
2025 </li>
2026 <li class="card">
2027 <div>test2</div>
2028 </li>
2029 <li class="card">
2030 <div>test3</div>
2031 </li>
2032 <li class="card">
2033 <div>test4</div>
2034 </li>
2035 <li class="card">
2036 <div>test5</div>
2037 </li>
2038 <li class="card">
2039 <div>test6</div>
2040 </li>
2041</ul>
2042<script>
2043import { MasonryInfiniteGrid } from "@egjs/infinitegrid";
2044var some = new MasonryInfiniteGrid("#grid").on("renderComplete", function(e) {
2045 // ...
2046});
2047// If you already have items in the container, call "layout" method.
2048some.renderItems();
2049</script>
2050```
2051 */
2052var InfiniteGrid = /*#__PURE__*/function (_super) {
2053 __extends(InfiniteGrid, _super);
2054 /**
2055 * @param - A base element for a module <ko>모듈을 적용할 기준 엘리먼트</ko>
2056 * @param - The option object of the InfiniteGrid module <ko>eg.InfiniteGrid 모듈의 옵션 객체</ko>
2057 */
2058 function InfiniteGrid(wrapper, options) {
2059 var _this = _super.call(this) || this;
2060 _this._waitType = "";
2061 _this._onScroll = function (_a) {
2062 var direction = _a.direction,
2063 scrollPos = _a.scrollPos,
2064 relativeScrollPos = _a.relativeScrollPos;
2065 _this._scroll();
2066 /**
2067 * This event is fired when scrolling.
2068 * @ko 스크롤하면 발생하는 이벤트이다.
2069 * @event InfiniteGrid#changeScroll
2070 * @param {InfiniteGrid.OnChangeScroll} e - The object of data to be sent to an event <ko>이벤트에 전달되는 데이터 객체</ko>
2071 */
2072 _this.trigger(new ComponentEvent(INFINITEGRID_EVENTS.CHANGE_SCROLL, {
2073 direction: direction,
2074 scrollPos: scrollPos,
2075 relativeScrollPos: relativeScrollPos
2076 }));
2077 };
2078 _this._onChange = function (e) {
2079 _this.setCursors(e.nextStartCursor, e.nextEndCursor);
2080 };
2081 _this._onRendererUpdated = function (e) {
2082 var renderedItems = e.items;
2083 renderedItems.forEach(function (item) {
2084 // set grid element
2085 var gridItem = item.orgItem;
2086 gridItem.element = item.element;
2087 });
2088 if (!e.isChanged) {
2089 _this._checkEndLoading();
2090 _this._scroll();
2091 return;
2092 }
2093 var _a = e.diffResult,
2094 added = _a.added,
2095 removed = _a.removed,
2096 prevList = _a.prevList,
2097 list = _a.list;
2098 removed.forEach(function (index) {
2099 var orgItem = prevList[index].orgItem;
2100 if (orgItem.mountState !== MOUNT_STATE.UNCHECKED) {
2101 orgItem.mountState = MOUNT_STATE.UNMOUNTED;
2102 }
2103 });
2104 var horizontal = _this.options.horizontal;
2105 var addedItems = added.map(function (index) {
2106 var gridItem = list[index].orgItem;
2107 var element = gridItem.element;
2108 if (gridItem.type === ITEM_TYPE.VIRTUAL) {
2109 var cssRect = __assign({}, gridItem.cssRect);
2110 var rect = gridItem.rect;
2111 if (!cssRect.width && rect.width) {
2112 cssRect.width = rect.width;
2113 }
2114 if (!cssRect.height && rect.height) {
2115 cssRect.height = rect.height;
2116 }
2117 // virtual item
2118 return new GridItem(horizontal, {
2119 element: element,
2120 cssRect: cssRect
2121 });
2122 }
2123 return gridItem;
2124 });
2125 var containerManager = _this.containerManager;
2126 if (_this.options.observeChildren) {
2127 containerManager.unobserveChildren(removed.map(function (index) {
2128 return prevList[index].element;
2129 }));
2130 containerManager.observeChildren(added.map(function (index) {
2131 return list[index].element;
2132 }));
2133 }
2134 var _b = e.state,
2135 isRestore = _b.isRestore,
2136 isResize = _b.isResize;
2137 _this.itemRenderer.renderItems(addedItems);
2138 if (isRestore) {
2139 _this._onRenderComplete({
2140 mounted: added.map(function (index) {
2141 return list[index].orgItem;
2142 }),
2143 updated: [],
2144 isResize: false,
2145 direction: _this.defaultDirection
2146 });
2147 }
2148 if (!isRestore || isResize || e.isItemChanged) {
2149 _this.groupManager.renderItems();
2150 }
2151 };
2152 _this._onResize = function (e) {
2153 if (e.isResizeContainer) {
2154 _this._renderItems({
2155 useResize: true
2156 }, true);
2157 } else {
2158 var updatedItems = getUpdatedItems(_this.getVisibleItems(), e.childEntries);
2159 if (updatedItems.length > 0) {
2160 _this.updateItems(updatedItems);
2161 }
2162 }
2163 };
2164 _this._onRequestAppend = function (e) {
2165 /**
2166 * The event is fired when scrolling reaches the end or when data for a virtual group is required.
2167 * @ko 스크롤이 끝에 도달하거나 virtual 그룹에 대한 데이터가 필요한 경우 이벤트가 발생한다.
2168 * @event InfiniteGrid#requestAppend
2169 * @param {InfiniteGrid.OnRequestAppend} e - The object of data to be sent to an event <ko>이벤트에 전달되는 데이터 객체</ko>
2170 */
2171 _this._onRequestInsert(DIRECTION.END, INFINITEGRID_EVENTS.REQUEST_APPEND, e);
2172 };
2173 _this._onRequestPrepend = function (e) {
2174 /**
2175 * The event is fired when scrolling reaches the start or when data for a virtual group is required.
2176 * @ko 스크롤이 끝에 도달하거나 virtual 그룹에 대한 데이터가 필요한 경우 이벤트가 발생한다.
2177 * @event InfiniteGrid#requestPrepend
2178 * @param {InfiniteGrid.OnRequestPrepend} e - The object of data to be sent to an event <ko>이벤트에 전달되는 데이터 객체</ko>
2179 */
2180 _this._onRequestInsert(DIRECTION.START, INFINITEGRID_EVENTS.REQUEST_PREPEND, e);
2181 };
2182 _this._onContentError = function (_a) {
2183 var element = _a.element,
2184 target = _a.target,
2185 item = _a.item,
2186 update = _a.update;
2187 /**
2188 * The event is fired when scrolling reaches the start or when data for a virtual group is required.
2189 * @ko 스크롤이 끝에 도달하거나 virtual 그룹에 대한 데이터가 필요한 경우 이벤트가 발생한다.
2190 * @event InfiniteGrid#contentError
2191 * @param {InfiniteGrid.OnContentError} e - The object of data to be sent to an event <ko>이벤트에 전달되는 데이터 객체</ko>
2192 */
2193 _this.trigger(new ComponentEvent(INFINITEGRID_EVENTS.CONTENT_ERROR, {
2194 element: element,
2195 target: target,
2196 item: item,
2197 update: update,
2198 remove: function () {
2199 _this.removeByKey(item.key);
2200 }
2201 }));
2202 };
2203 _this._onRenderComplete = function (_a) {
2204 var isResize = _a.isResize,
2205 mounted = _a.mounted,
2206 updated = _a.updated,
2207 direction = _a.direction;
2208 var infinite = _this.infinite;
2209 var prevRenderedGroups = infinite.getRenderedVisibleItems();
2210 var length = prevRenderedGroups.length;
2211 var isDirectionEnd = direction === DIRECTION.END;
2212 _this._syncInfinite();
2213 if (length) {
2214 var prevStandardGroup = prevRenderedGroups[isDirectionEnd ? 0 : length - 1];
2215 var nextStandardGroup = infinite.getItemByKey(prevStandardGroup.key);
2216 var offset = isDirectionEnd ? Math.min.apply(Math, nextStandardGroup.startOutline) - Math.min.apply(Math, prevStandardGroup.startOutline) : Math.max.apply(Math, nextStandardGroup.endOutline) - Math.max.apply(Math, prevStandardGroup.endOutline);
2217 _this.scrollManager.scrollBy(offset);
2218 }
2219 /**
2220 * This event is fired when the InfiniteGrid has completed rendering.
2221 * @ko InfiniteGrid가 렌더링이 완료됐을 때 이벤트가 발생한다.
2222 * @event InfiniteGrid#renderComplete
2223 * @param {InfiniteGrid.OnRenderComplete} e - The object of data to be sent to an event <ko>이벤트에 전달되는 데이터 객체</ko>
2224 */
2225 _this.trigger(new ComponentEvent(INFINITEGRID_EVENTS.RENDER_COMPLETE, {
2226 isResize: isResize,
2227 direction: direction,
2228 mounted: mounted.filter(function (item) {
2229 return item.type !== ITEM_TYPE.LOADING;
2230 }),
2231 updated: updated.filter(function (item) {
2232 return item.type !== ITEM_TYPE.LOADING;
2233 }),
2234 startCursor: _this.getStartCursor(),
2235 endCursor: _this.getEndCursor(),
2236 items: _this.getVisibleItems(true),
2237 groups: _this.getVisibleGroups(true)
2238 }));
2239 if (_this.groupManager.shouldRerenderItems()) {
2240 _this._update();
2241 } else {
2242 _this._checkEndLoading();
2243 _this._scroll();
2244 }
2245 };
2246 _this.options = __assign(__assign(__assign({}, _this.constructor.defaultOptions), {
2247 renderer: new VanillaGridRenderer().on("requestUpdate", function () {
2248 return _this._render();
2249 })
2250 }), options);
2251 var _a = _this.options,
2252 gridConstructor = _a.gridConstructor,
2253 containerTag = _a.containerTag,
2254 container = _a.container,
2255 renderer = _a.renderer,
2256 threshold = _a.threshold,
2257 useRecycle = _a.useRecycle,
2258 scrollContainer = _a.scrollContainer,
2259 appliedItemChecker = _a.appliedItemChecker,
2260 gridOptions = __rest(_a, ["gridConstructor", "containerTag", "container", "renderer", "threshold", "useRecycle", "scrollContainer", "appliedItemChecker"]);
2261 // options.container === false, wrapper = container, scrollContainer = document.body
2262 // options.container === true, wrapper = scrollContainer, container = wrapper's child
2263 // options.container === string,
2264 var horizontal = gridOptions.horizontal,
2265 attributePrefix = gridOptions.attributePrefix,
2266 useTransform = gridOptions.useTransform,
2267 percentage = gridOptions.percentage,
2268 isConstantSize = gridOptions.isConstantSize,
2269 isEqualSize = gridOptions.isEqualSize,
2270 autoResize = gridOptions.autoResize,
2271 useResizeObserver = gridOptions.useResizeObserver,
2272 resizeDebounce = gridOptions.resizeDebounce,
2273 maxResizeDebounce = gridOptions.maxResizeDebounce,
2274 defaultDirection = gridOptions.defaultDirection;
2275 var wrapperElement = isString(wrapper) ? document.querySelector(wrapper) : wrapper;
2276 var scrollManager = new ScrollManager(wrapperElement, {
2277 scrollContainer: scrollContainer,
2278 container: container,
2279 containerTag: containerTag,
2280 horizontal: horizontal
2281 }).on({
2282 scroll: _this._onScroll
2283 });
2284 var containerElement = scrollManager.getContainer();
2285 var containerManager = new ContainerManager(containerElement, {
2286 horizontal: horizontal,
2287 autoResize: autoResize,
2288 resizeDebounce: resizeDebounce,
2289 maxResizeDebounce: maxResizeDebounce,
2290 useResizeObserver: useResizeObserver
2291 }).on("resize", _this._onResize);
2292 var itemRenderer = new ItemRenderer({
2293 attributePrefix: attributePrefix,
2294 horizontal: horizontal,
2295 useTransform: useTransform,
2296 percentage: percentage,
2297 isEqualSize: isEqualSize,
2298 isConstantSize: isConstantSize
2299 });
2300 var infinite = new Infinite({
2301 defaultDirection: defaultDirection,
2302 useRecycle: useRecycle,
2303 threshold: threshold
2304 }).on({
2305 "change": _this._onChange,
2306 "requestAppend": _this._onRequestAppend,
2307 "requestPrepend": _this._onRequestPrepend
2308 });
2309 infinite.setSize(scrollManager.getContentSize());
2310 var groupManager = new GroupManager(containerElement, {
2311 appliedItemChecker: appliedItemChecker,
2312 gridConstructor: gridConstructor,
2313 externalItemRenderer: itemRenderer,
2314 externalContainerManager: containerManager,
2315 gridOptions: gridOptions
2316 });
2317 groupManager.on({
2318 "renderComplete": _this._onRenderComplete,
2319 "contentError": _this._onContentError
2320 });
2321 renderer.setContainer(containerElement);
2322 renderer.on("updated", _this._onRendererUpdated);
2323 _this.itemRenderer = itemRenderer;
2324 _this.groupManager = groupManager;
2325 _this.wrapperElement = wrapperElement;
2326 _this.scrollManager = scrollManager;
2327 _this.containerManager = containerManager;
2328 _this.infinite = infinite;
2329 _this.containerManager.resize();
2330 return _this;
2331 }
2332 var __proto = InfiniteGrid.prototype;
2333 InfiniteGrid_1 = InfiniteGrid;
2334 /**
2335 * Rearrange items to fit the grid and render them. When rearrange is complete, the `renderComplete` event is fired.
2336 * @ko grid에 맞게 아이템을 재배치하고 렌더링을 한다. 배치가 완료되면 `renderComplete` 이벤트가 발생한다.
2337 * @param - Options for rendering. <ko>렌더링을 하기 위한 옵션.</ko>
2338 * @example
2339 * ```ts
2340 * import { MasonryInfiniteGrid } from "@egjs/infinitegrid";
2341 * const grid = new MasonryInfiniteGrid();
2342 *
2343 * grid.on("renderComplete", e => {
2344 * console.log(e);
2345 * });
2346 * grid.renderItems();
2347 * ```
2348 */
2349 __proto.renderItems = function (options) {
2350 if (options === void 0) {
2351 options = {};
2352 }
2353 this._renderItems(options);
2354 return this;
2355 };
2356 /**
2357 * Returns the wrapper element specified by the user.
2358 * @ko 컨테이너 엘리먼트를 반환한다.
2359 */
2360 __proto.getWrapperElement = function () {
2361 return this.scrollManager.getWrapper();
2362 };
2363 /**
2364 * Returns the container element corresponding to the scroll area.
2365 * @ko 스크롤 영역에 해당하는 컨테이너 엘리먼트를 반환한다.
2366 */
2367 __proto.getScrollContainerElement = function () {
2368 return this.scrollManager.getScrollContainer();
2369 };
2370 /**
2371 * Returns the container element containing item elements.
2372 * @ko 아이템 엘리먼트들을 담긴 컨테이너 엘리먼트를 반환한다.
2373 */
2374 __proto.getContainerElement = function () {
2375 return this.scrollManager.getContainer();
2376 };
2377 /**
2378 * When items change, it synchronizes and renders items.
2379 * @ko items가 바뀐 경우 동기화를 하고 렌더링을 한다.
2380 * @param - Options for rendering. <ko>렌더링을 하기 위한 옵션.</ko>
2381 */
2382 __proto.syncItems = function (items) {
2383 this.groupManager.syncItems(items);
2384 this._syncGroups();
2385 return this;
2386 };
2387 /**
2388 * Change the currently visible groups.
2389 * @ko 현재 보이는 그룹들을 바꾼다.
2390 * @param - first index of visible groups. <ko>보이는 그룹의 첫번째 index.</ko>
2391 * @param - last index of visible groups. <ko>보이는 그룹의 마지막 index.</ko>
2392 * @param - Whether the first rendering has already been done. <ko>첫 렌더링이 이미 되어있는지 여부.</ko>
2393 */
2394 __proto.setCursors = function (startCursor, endCursor, useFirstRender) {
2395 this.groupManager.setCursors(startCursor, endCursor);
2396 this.infinite.setCursors(startCursor, endCursor);
2397 if (useFirstRender) {
2398 this._syncItems();
2399 } else {
2400 this._update();
2401 this._checkEndLoading();
2402 }
2403 return this;
2404 };
2405 /**
2406 * Returns the first index of visible groups.
2407 * @ko 보이는 그룹들의 첫번째 index를 반환한다.
2408 */
2409 __proto.getStartCursor = function () {
2410 return this.infinite.getStartCursor();
2411 };
2412 /**
2413 * Returns the last index of visible groups.
2414 * @ko 보이는 그룹들의 마지막 index를 반환한다.
2415 */
2416 __proto.getEndCursor = function () {
2417 return this.infinite.getEndCursor();
2418 };
2419 /**
2420 * Add items at the bottom(right) of the grid.
2421 * @ko 아이템들을 grid 아래(오른쪽)에 추가한다.
2422 * @param - items to be added <ko>추가할 아이템들</ko>
2423 * @param - The group key to be configured in items. It is automatically generated by default. <ko>추가할 아이템에 설정할 그룹 키. 생략하면 값이 자동으로 생성된다.</ko>
2424 * @return - An instance of a module itself<ko>모듈 자신의 인스턴스</ko>
2425 * @example
2426 * ```js
2427 * ig.append(`<div class="item">test1</div><div class="item">test2</div>`);
2428 * ig.append([`<div class="item">test1</div>`, `<div class="item">test2</div>`]);
2429 * ig.append([HTMLElement1, HTMLElement2]);
2430 * ```
2431 */
2432 __proto.append = function (items, groupKey) {
2433 return this.insert(-1, items, groupKey);
2434 };
2435 /**
2436 * Add items at the top(left) of the grid.
2437 * @ko 아이템들을 grid 위(왼쪽)에 추가한다.
2438 * @param - items to be added <ko>추가할 아이템들</ko>
2439 * @param - The group key to be configured in items. It is automatically generated by default. <ko>추가할 아이템에 설정할 그룹 키. 생략하면 값이 자동으로 생성된다.</ko>
2440 * @return - An instance of a module itself<ko>모듈 자신의 인스턴스</ko>
2441 * @example
2442 * ```ts
2443 * ig.prepend(`<div class="item">test1</div><div class="item">test2</div>`);
2444 * ig.prepend([`<div class="item">test1</div>`, `<div class="item">test2</div>`]);
2445 * ig.prepend([HTMLElement1, HTMLElement2]);
2446 * ```
2447 */
2448 __proto.prepend = function (items, groupKey) {
2449 return this.insert(0, items, groupKey);
2450 };
2451 /**
2452 * Add items to a specific index.
2453 * @ko 아이템들을 특정 index에 추가한다.
2454 * @param - index to add <ko>추가하기 위한 index</ko>
2455 * @param - items to be added <ko>추가할 아이템들</ko>
2456 * @param - The group key to be configured in items. It is automatically generated by default. <ko>추가할 아이템에 설정할 그룹 키. 생략하면 값이 자동으로 생성된다.</ko>
2457 * @return - An instance of a module itself<ko>모듈 자신의 인스턴스</ko>
2458 * @example
2459 * ```ts
2460 * ig.insert(2, `<div class="item">test1</div><div class="item">test2</div>`);
2461 * ig.insert(3, [`<div class="item">test1</div>`, `<div class="item">test2</div>`]);
2462 * ig.insert(4, [HTMLElement1, HTMLElement2]);
2463 * ```
2464 */
2465 __proto.insert = function (index, items, groupKey) {
2466 var nextItemInfos = this.groupManager.getGroupItems();
2467 var itemInfos = convertInsertedItems(items, groupKey);
2468 if (index === -1) {
2469 nextItemInfos.push.apply(nextItemInfos, itemInfos);
2470 } else {
2471 nextItemInfos.splice.apply(nextItemInfos, __spreadArray([index, 0], itemInfos, false));
2472 }
2473 return this.syncItems(nextItemInfos);
2474 };
2475 /**
2476 * Add items based on group index.
2477 * @ko group의 index 기준으로 item들을 추가한다.
2478 * @param - group index to add <ko>추가하기 위한 group의 index</ko>
2479 * @param - items to be added <ko>추가할 아이템들</ko>
2480 * @param - The group key to be configured in items. It is automatically generated by default. <ko>추가할 아이템에 설정할 그룹 키. 생략하면 값이 자동으로 생성된다.</ko>
2481 * @return - An instance of a module itself<ko>모듈 자신의 인스턴스</ko>
2482 * @example
2483 * ```ts
2484 * ig.insertByGroupIndex(2, `<div class="item">test1</div><div class="item">test2</div>`);
2485 * ig.insertByGroupIndex(3, [`<div class="item">test1</div>`, `<div class="item">test2</div>`]);
2486 * ig.insertByGroupIndex(4, [HTMLElement1, HTMLElement2]);
2487 * ```
2488 */
2489 __proto.insertByGroupIndex = function (groupIndex, items, groupKey) {
2490 var nextGroupInfos = this.groupManager.getGroups();
2491 var rightGroup = nextGroupInfos[groupIndex];
2492 if (!rightGroup) {
2493 return this.append(items, groupKey);
2494 }
2495 var nextItemInfos = this.groupManager.getGroupItems();
2496 var rightGroupKey = rightGroup.groupKey;
2497 var rightItemIndex = findIndex(nextItemInfos, function (item) {
2498 return item.groupKey === rightGroupKey;
2499 });
2500 return this.insert(rightItemIndex, items, groupKey);
2501 };
2502 /**
2503 * 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.
2504 * @ko 아이템의 위치 정보 등 모듈의 현재 상태 정보를 반환한다. 이 메서드가 반환한 정보를 저장해 두었다가 setStatus() 메서드로 복원할 수 있다
2505 * @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. <ko> STATUS_TYPE.NOT_REMOVE = 모든 아이템들의 정보를 가져온다. STATUS_TYPE.REMOVE_INVISIBLE_ITEMS = 보이는 아이템들의 정보만 가져온다. STATUS_TYPE.MINIMIZE_INVISIBLE_ITEMS = 안보이는 아이템들을 압축한다. placeholder로 대체가 가능하다. STATUS_TYPE.MINIMIZE_INVISIBLE_GROUPS = 안보이는 그룹을 압축한다.</ko>
2506 * @param - Whether to include items corresponding to placeholders. <ko>placeholder에 해당하는 아이템들을 포함할지 여부.</ko>
2507 */
2508 __proto.getStatus = function (type, includePlaceholders) {
2509 return {
2510 containerManager: this.containerManager.getStatus(),
2511 itemRenderer: this.itemRenderer.getStatus(),
2512 groupManager: this.groupManager.getGroupStatus(type, includePlaceholders),
2513 scrollManager: this.scrollManager.getStatus()
2514 };
2515 };
2516 /**
2517 * You can set placeholders to restore status or wait for items to be added.
2518 * @ko status 복구 또는 아이템 추가 대기를 위한 placeholder를 설정할 수 있다.
2519 * @param - The placeholder status. <ko>placeholder의 status</ko>
2520 */
2521 __proto.setPlaceholder = function (info) {
2522 this.groupManager.setPlaceholder(info);
2523 return this;
2524 };
2525 /**
2526 * You can set placeholders to restore status or wait for items to be added.
2527 * @ko status 복구 또는 아이템 추가 대기를 위한 placeholder를 설정할 수 있다.
2528 * @param - The placeholder status. <ko>placeholder의 status</ko>
2529 */
2530 __proto.setLoading = function (info) {
2531 this.groupManager.setLoading(info);
2532 return this;
2533 };
2534 /**
2535 * Add the placeholder at the end.
2536 * @ko placeholder들을 마지막에 추가한다.
2537 * @param - Items that correspond to placeholders. If it is a number, it duplicates the number of copies. <ko>placeholder에 해당하는 아이템들. 숫자면 갯수만큼 복제를 한다.</ko>
2538 * @param - The group key to be configured in items. It is automatically generated by default. <ko>추가할 아이템에 설정할 그룹 키. 생략하면 값이 자동으로 생성된다.</ko>
2539 */
2540 __proto.appendPlaceholders = function (items, groupKey) {
2541 var _this = this;
2542 var result = this.groupManager.appendPlaceholders(items, groupKey);
2543 this._syncGroups(true);
2544 return __assign(__assign({}, result), {
2545 remove: function () {
2546 _this.removePlaceholders({
2547 groupKey: result.group.groupKey
2548 });
2549 }
2550 });
2551 };
2552 /**
2553 * Add the placeholder at the start.
2554 * @ko placeholder들을 처음에 추가한다.
2555 * @param - Items that correspond to placeholders. If it is a number, it duplicates the number of copies. <ko>placeholder에 해당하는 아이템들. 숫자면 갯수만큼 복제를 한다.</ko>
2556 * @param - The group key to be configured in items. It is automatically generated by default. <ko>추가할 아이템에 설정할 그룹 키. 생략하면 값이 자동으로 생성된다.</ko>
2557 */
2558 __proto.prependPlaceholders = function (items, groupKey) {
2559 var _this = this;
2560 var result = this.groupManager.prependPlaceholders(items, groupKey);
2561 this._syncGroups(true);
2562 return __assign(__assign({}, result), {
2563 remove: function () {
2564 _this.removePlaceholders({
2565 groupKey: result.group.groupKey
2566 });
2567 }
2568 });
2569 };
2570 /**
2571 * Remove placeholders
2572 * @ko placeholder들을 삭제한다.
2573 * @param type - Remove the placeholders corresponding to the groupkey. When "start" or "end", remove all placeholders in that direction. <ko>groupkey에 해당하는 placeholder들을 삭제한다. "start" 또는 "end" 일 때 해당 방향의 모든 placeholder들을 삭제한다.</ko>
2574 */
2575 __proto.removePlaceholders = function (type) {
2576 this.groupManager.removePlaceholders(type);
2577 this._syncGroups(true);
2578 };
2579 /**
2580 * Sets the status of the InfiniteGrid module with the information returned through a call to the getStatus() method.
2581 * @ko getStatus() 메서드가 저장한 정보로 InfiniteGrid 모듈의 상태를 설정한다.
2582 * @param - status object of the InfiniteGrid module. <ko>InfiniteGrid 모듈의 status 객체.</ko>
2583 * @param - Whether the first rendering has already been done. <ko>첫 렌더링이 이미 되어있는지 여부.</ko>
2584 */
2585 __proto.setStatus = function (status, useFirstRender) {
2586 this.itemRenderer.setStatus(status.itemRenderer);
2587 this.containerManager.setStatus(status.containerManager);
2588 this.scrollManager.setStatus(status.scrollManager);
2589 var groupManager = this.groupManager;
2590 var prevInlineSize = this.containerManager.getInlineSize();
2591 groupManager.setGroupStatus(status.groupManager);
2592 this._syncInfinite();
2593 this.infinite.setCursors(groupManager.getStartCursor(), groupManager.getEndCursor());
2594 this._getRenderer().updateKey();
2595 var state = {
2596 isResize: this.containerManager.getInlineSize() !== prevInlineSize,
2597 isRestore: true
2598 };
2599 if (useFirstRender) {
2600 this._syncItems(state);
2601 } else {
2602 this._update(state);
2603 }
2604 return this;
2605 };
2606 /**
2607 * Removes the group corresponding to index.
2608 * @ko index에 해당하는 그룹을 제거 한다.
2609 */
2610 __proto.removeGroupByIndex = function (index) {
2611 var nextGroups = this.getGroups();
2612 return this.removeGroupByKey(nextGroups[index].groupKey);
2613 };
2614 /**
2615 * Removes the group corresponding to key.
2616 * @ko key에 해당하는 그룹을 제거 한다.
2617 */
2618 __proto.removeGroupByKey = function (key) {
2619 var nextItemInfos = this.getItems();
2620 var firstIndex = findIndex(nextItemInfos, function (item) {
2621 return item.groupKey === key;
2622 });
2623 var lastIndex = findLastIndex(nextItemInfos, function (item) {
2624 return item.groupKey === key;
2625 });
2626 if (firstIndex === -1) {
2627 return this;
2628 }
2629 nextItemInfos.splice(firstIndex, lastIndex - firstIndex + 1);
2630 return this.syncItems(nextItemInfos);
2631 };
2632 /**
2633 * Removes the item corresponding to index.
2634 * @ko index에 해당하는 아이템을 제거 한다.
2635 */
2636 __proto.removeByIndex = function (index) {
2637 var nextItemInfos = this.getItems(true);
2638 nextItemInfos.splice(index, 1);
2639 return this.syncItems(nextItemInfos);
2640 };
2641 /**
2642 * Removes the item corresponding to key.
2643 * @ko key에 해당하는 아이템을 제거 한다.
2644 */
2645 __proto.removeByKey = function (key) {
2646 var nextItemInfos = this.getItems(true);
2647 var index = findIndex(nextItemInfos, function (item) {
2648 return item.key === key;
2649 });
2650 return this.removeByIndex(index);
2651 };
2652 /**
2653 * Update the size of the items and render them.
2654 * @ko 아이템들의 사이즈를 업데이트하고 렌더링을 한다.
2655 * @param - Items to be updated. <ko>업데이트할 아이템들.</ko>
2656 * @param - Options for rendering. <ko>렌더링을 하기 위한 옵션.</ko>
2657 */
2658 __proto.updateItems = function (items, options) {
2659 if (options === void 0) {
2660 options = {};
2661 }
2662 this.groupManager.updateItems(items, options);
2663 return this;
2664 };
2665 /**
2666 * Return all items of InfiniteGrid.
2667 * @ko InfiniteGrid의 모든 아이템들을 반환한다.
2668 * @param - Whether to include items corresponding to placeholders. <ko>placeholder에 해당하는 아이템들을 포함할지 여부.</ko>
2669 */
2670 __proto.getItems = function (includePlaceholders) {
2671 return this.groupManager.getGroupItems(includePlaceholders);
2672 };
2673 /**
2674 * Return visible items of InfiniteGrid.
2675 * @ko InfiniteGrid의 보이는 아이템들을 반환한다.
2676 * @param - Whether to include items corresponding to placeholders. <ko>placeholder에 해당하는 아이템들을 포함할지 여부.</ko>
2677 */
2678 __proto.getVisibleItems = function (includePlaceholders) {
2679 return this.groupManager.getVisibleItems(includePlaceholders);
2680 };
2681 /**
2682 * Return rendering items of InfiniteGrid.
2683 * @ko InfiniteGrid의 렌더링 아이템들을 반환한다.
2684 */
2685 __proto.getRenderingItems = function () {
2686 return this.groupManager.getRenderingItems();
2687 };
2688 /**
2689 * Return all groups of InfiniteGrid.
2690 * @ko InfiniteGrid의 모든 그룹들을 반환한다.
2691 * @param - Whether to include groups corresponding to placeholders. <ko>placeholder에 해당하는 그룹들을 포함할지 여부.</ko>
2692 */
2693 __proto.getGroups = function (includePlaceholders) {
2694 return this.groupManager.getGroups(includePlaceholders);
2695 };
2696 /**
2697 * Return visible groups of InfiniteGrid.
2698 * @ko InfiniteGrid의 보이는 그룹들을 반환한다.
2699 * @param - Whether to include groups corresponding to placeholders. <ko>placeholder에 해당하는 그룹들을 포함할지 여부.</ko>
2700 */
2701 __proto.getVisibleGroups = function (includePlaceholders) {
2702 return this.groupManager.getVisibleGroups(includePlaceholders);
2703 };
2704 /**
2705 * Set to wait to request data.
2706 * @ko 데이터를 요청하기 위해 대기 상태로 설정한다.
2707 * @param direction - direction in which data will be added. <ko>데이터를 추가하기 위한 방향.</ko>
2708 */
2709 __proto.wait = function (direction) {
2710 if (direction === void 0) {
2711 direction = DIRECTION.END;
2712 }
2713 this._waitType = direction;
2714 this._checkStartLoading(direction);
2715 };
2716 /**
2717 * When the data request is complete, it is set to ready state.
2718 * @ko 데이터 요청이 끝났다면 준비 상태로 설정한다.
2719 */
2720 __proto.ready = function () {
2721 this._waitType = "";
2722 };
2723 /**
2724 * Returns whether it is set to wait to request data.
2725 * @ko 데이터를 요청하기 위해 대기 상태로 설정되어 있는지 여부를 반환한다.
2726 */
2727 __proto.isWait = function () {
2728 return !!this._waitType;
2729 };
2730 /**
2731 * Releases the instnace and events and returns the CSS of the container and elements.
2732 * @ko 인스턴스와 이벤트를 해제하고 컨테이너와 엘리먼트들의 CSS를 되돌린다.
2733 */
2734 __proto.destroy = function () {
2735 this.off();
2736 this._getRenderer().destroy();
2737 this.containerManager.destroy();
2738 this.groupManager.destroy();
2739 this.scrollManager.destroy();
2740 this.infinite.destroy();
2741 };
2742 __proto._getRenderer = function () {
2743 return this.options.renderer;
2744 };
2745 __proto._getRendererItems = function () {
2746 return this.getRenderingItems().map(function (item) {
2747 return {
2748 element: item.element,
2749 key: "".concat(item.type, "_").concat(item.key),
2750 orgItem: item
2751 };
2752 });
2753 };
2754 __proto._syncItems = function (state) {
2755 this._getRenderer().syncItems(this._getRendererItems(), state);
2756 };
2757 __proto._render = function (state) {
2758 this._getRenderer().render(this._getRendererItems(), state);
2759 };
2760 __proto._update = function (state) {
2761 if (state === void 0) {
2762 state = {};
2763 }
2764 this._getRenderer().update(state);
2765 };
2766 __proto._resizeScroll = function () {
2767 var scrollManager = this.scrollManager;
2768 scrollManager.resize();
2769 this.infinite.setSize(scrollManager.getContentSize());
2770 };
2771 __proto._syncGroups = function (isUpdate) {
2772 var infinite = this.infinite;
2773 var scrollManager = this.scrollManager;
2774 if (!scrollManager.getContentSize()) {
2775 this._resizeScroll();
2776 }
2777 this._syncInfinite();
2778 this.groupManager.setCursors(infinite.getStartCursor(), infinite.getEndCursor());
2779 if (isUpdate) {
2780 this._update();
2781 } else {
2782 this._render();
2783 }
2784 };
2785 __proto._syncInfinite = function () {
2786 this.infinite.syncItems(this.getGroups(true).map(function (_a) {
2787 var groupKey = _a.groupKey,
2788 grid = _a.grid,
2789 type = _a.type;
2790 var outlines = grid.getOutlines();
2791 return {
2792 key: groupKey,
2793 isVirtual: type === GROUP_TYPE.VIRTUAL,
2794 startOutline: outlines.start,
2795 endOutline: outlines.end
2796 };
2797 }));
2798 };
2799 __proto._scroll = function () {
2800 this.infinite.scroll(this.scrollManager.getRelativeScrollPos());
2801 };
2802 __proto._onRequestInsert = function (direction, eventType, e) {
2803 var _this = this;
2804 if (this._waitType) {
2805 this._checkStartLoading(this._waitType);
2806 return;
2807 }
2808 this.trigger(new ComponentEvent(eventType, {
2809 groupKey: e.key,
2810 nextGroupKey: e.nextKey,
2811 nextGroupKeys: e.nextKeys || [],
2812 isVirtual: e.isVirtual,
2813 wait: function () {
2814 _this.wait(direction);
2815 },
2816 ready: function () {
2817 _this.ready();
2818 }
2819 }));
2820 };
2821 __proto._renderItems = function (options, isTrusted) {
2822 if (options === void 0) {
2823 options = {};
2824 }
2825 if (!isTrusted && options.useResize) {
2826 this.containerManager.resize();
2827 }
2828 this._resizeScroll();
2829 if (!this.getRenderingItems().length) {
2830 var children = toArray(this.getContainerElement().children);
2831 if (children.length > 0) {
2832 // no items, but has children
2833 this.groupManager.syncItems(convertInsertedItems(children));
2834 this._syncInfinite();
2835 this.setCursors(0, 0, true);
2836 this._getRenderer().updated();
2837 } else {
2838 this.infinite.scroll(0);
2839 }
2840 return this;
2841 }
2842 if (!this.getVisibleGroups(true).length) {
2843 this.setCursors(0, 0);
2844 } else {
2845 this.groupManager.renderItems(options);
2846 }
2847 return this;
2848 };
2849 __proto._checkStartLoading = function (direction) {
2850 var groupManager = this.groupManager;
2851 var infinite = this.infinite;
2852 if (!groupManager.getLoadingType() && infinite.isLoading(direction) && groupManager.startLoading(direction) && groupManager.hasLoadingItem()) {
2853 this._update();
2854 }
2855 };
2856 __proto._checkEndLoading = function () {
2857 var groupManager = this.groupManager;
2858 var loadingType = this.groupManager.getLoadingType();
2859 if (loadingType && (!this._waitType || !this.infinite.isLoading(loadingType)) && groupManager.endLoading() && groupManager.hasLoadingItem()) {
2860 this._update();
2861 }
2862 };
2863 var InfiniteGrid_1;
2864 InfiniteGrid.defaultOptions = __assign(__assign({}, DEFAULT_GRID_OPTIONS), {
2865 container: false,
2866 containerTag: "div",
2867 renderer: null,
2868 threshold: 100,
2869 useRecycle: true,
2870 scrollContainer: null,
2871 appliedItemChecker: function () {
2872 return false;
2873 }
2874 });
2875 InfiniteGrid.propertyTypes = INFINITEGRID_PROPERTY_TYPES;
2876 InfiniteGrid = InfiniteGrid_1 = __decorate([InfiniteGridGetterSetter], InfiniteGrid);
2877 return InfiniteGrid;
2878}(Component);
2879
2880/**
2881 * 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.
2882 * @ko MasonryInfiniteGrid는 벽돌을 쌓아 올린 모양처럼 동일한 너비를 가진 아이템을 쌓는 레이아웃이다. 모든 이미지의 너비를 동일한 크기로 조정하고, 가장 높이가 낮은 열을 찾아 새로운 이미지를 삽입한다. 따라서 배치된 아이템 사이에 빈 공간이 생기지는 않지만 배치된 레이아웃의 아래쪽은 울퉁불퉁해진다.
2883 * @param {HTMLElement | string} container - A base element for a module <ko>모듈을 적용할 기준 엘리먼트</ko>
2884 * @param {MasonryInfiniteGridOptions} options - The option object of the MasonryInfiniteGrid module <ko>MasonryInfiniteGrid 모듈의 옵션 객체</ko>
2885 */
2886var MasonryInfiniteGrid = /*#__PURE__*/function (_super) {
2887 __extends(MasonryInfiniteGrid, _super);
2888 function MasonryInfiniteGrid() {
2889 return _super !== null && _super.apply(this, arguments) || this;
2890 }
2891 MasonryInfiniteGrid.propertyTypes = __assign(__assign({}, InfiniteGrid.propertyTypes), MasonryGrid.propertyTypes);
2892 MasonryInfiniteGrid.defaultOptions = __assign(__assign(__assign({}, InfiniteGrid.defaultOptions), MasonryGrid.defaultOptions), {
2893 gridConstructor: MasonryGrid,
2894 appliedItemChecker: function (item, grid) {
2895 var column = parseFloat(item.attributes.column) || 0;
2896 return column >= grid.outlineLength;
2897 }
2898 });
2899 MasonryInfiniteGrid = __decorate([InfiniteGridGetterSetter], MasonryInfiniteGrid);
2900 return MasonryInfiniteGrid;
2901}(InfiniteGrid);
2902
2903/**
2904 * '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.
2905 * If 'data-grid-inline-offset' or 'data-grid-content-offset' are set for item element, the ratio is maintained except for the offset value.
2906 * 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.
2907 * @ko 'justified'는 '1행의 너비에 맞게 꼭 들어찬'이라는 의미를 가진 인쇄 용어다. JustifiedInfiniteGrid는 용어의 의미대로 너비가 주어진 사이즈를 기준으로 아이템가 가득 차도록 배치하는 Grid다.
2908 * 아이템 엘리먼트에 'data-grid-inline-offset' 또는 'data-grid-content-offset'를 설정하면 offset 값을 제외하고 비율을 유지한다.
2909 * 비율을 유지하고 싶은 엘리먼트에 'data-grid-maintained-target'을 설정한다면 해당 엘리먼트의 비율을 유지하면서 아이템이 렌더링이 된다.
2910 * @param {HTMLElement | string} container - A base element for a module <ko>모듈을 적용할 기준 엘리먼트</ko>
2911 * @param {JustifiedInfiniteGridOptions} options - The option object of the JustifiedInfiniteGrid module <ko>JustifiedInfiniteGrid 모듈의 옵션 객체</ko>
2912 */
2913var JustifiedInfiniteGrid = /*#__PURE__*/function (_super) {
2914 __extends(JustifiedInfiniteGrid, _super);
2915 function JustifiedInfiniteGrid() {
2916 return _super !== null && _super.apply(this, arguments) || this;
2917 }
2918 JustifiedInfiniteGrid.propertyTypes = __assign(__assign({}, InfiniteGrid.propertyTypes), JustifiedGrid.propertyTypes);
2919 JustifiedInfiniteGrid.defaultOptions = __assign(__assign(__assign({}, InfiniteGrid.defaultOptions), JustifiedGrid.defaultOptions), {
2920 gridConstructor: JustifiedGrid
2921 });
2922 JustifiedInfiniteGrid = __decorate([InfiniteGridGetterSetter], JustifiedInfiniteGrid);
2923 return JustifiedInfiniteGrid;
2924}(InfiniteGrid);
2925
2926/**
2927 * '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.
2928 * @ko 'Frame'는 '1행의 너비에 맞게 꼭 들어찬'이라는 의미를 가진 인쇄 용어다. FrameInfiniteGrid는 용어의 의미대로 너비가 주어진 사이즈를 기준으로 아이템이 가득 차도록 배치하는 Grid다.
2929 * @param {HTMLElement | string} container - A base element for a module <ko>모듈을 적용할 기준 엘리먼트</ko>
2930 * @param {FrameInfiniteGridOptions} options - The option object of the FrameInfiniteGrid module <ko>FrameGrid 모듈의 옵션 객체</ko>
2931 */
2932var FrameInfiniteGrid = /*#__PURE__*/function (_super) {
2933 __extends(FrameInfiniteGrid, _super);
2934 function FrameInfiniteGrid() {
2935 return _super !== null && _super.apply(this, arguments) || this;
2936 }
2937 FrameInfiniteGrid.propertyTypes = __assign(__assign({}, InfiniteGrid.propertyTypes), FrameGrid.propertyTypes);
2938 FrameInfiniteGrid.defaultOptions = __assign(__assign(__assign({}, InfiniteGrid.defaultOptions), FrameGrid.defaultOptions), {
2939 gridConstructor: FrameGrid
2940 });
2941 FrameInfiniteGrid = __decorate([InfiniteGridGetterSetter], FrameInfiniteGrid);
2942 return FrameInfiniteGrid;
2943}(InfiniteGrid);
2944
2945/**
2946 * The PackingInfiniteGrid is a grid that shows the important items bigger without sacrificing the weight of the items.
2947 * Rows and columns are separated so that items are dynamically placed within the horizontal and vertical space rather than arranged in an orderly fashion.
2948 * If `sizeWeight` is higher than `ratioWeight`, the size of items is preserved as much as possible.
2949 * Conversely, if `ratioWeight` is higher than `sizeWeight`, the ratio of items is preserved as much as possible.
2950 * @ko PackingInfiniteGrid는 아이템의 본래 크기에 따른 비중을 해치지 않으면서 중요한 카드는 더 크게 보여 주는 레이아웃이다.
2951 * 행과 열이 구분돼 아이템을 정돈되게 배치하는 대신 가로세로 일정 공간 내에서 동적으로 아이템을 배치한다.
2952 * `sizeWeight`가 `ratioWeight`보다 높으면 아이템들의 size가 최대한 보존이 된다.
2953 * 반대로 `ratioWeight`가 `sizeWeight`보다 높으면 아이템들의 비율이 최대한 보존이 된다.
2954 * @param {HTMLElement | string} container - A base element for a module <ko>모듈을 적용할 기준 엘리먼트</ko>
2955 * @param {PackingInfiniteGridOptions} options - The option object of the PackingInfiniteGrid module <ko>PackingInfiniteGrid 모듈의 옵션 객체</ko>
2956 */
2957var PackingInfiniteGrid = /*#__PURE__*/function (_super) {
2958 __extends(PackingInfiniteGrid, _super);
2959 function PackingInfiniteGrid() {
2960 return _super !== null && _super.apply(this, arguments) || this;
2961 }
2962 PackingInfiniteGrid.propertyTypes = __assign(__assign({}, InfiniteGrid.propertyTypes), PackingGrid.propertyTypes);
2963 PackingInfiniteGrid.defaultOptions = __assign(__assign(__assign({}, InfiniteGrid.defaultOptions), PackingGrid.defaultOptions), {
2964 gridConstructor: PackingGrid
2965 });
2966 PackingInfiniteGrid = __decorate([InfiniteGridGetterSetter], PackingInfiniteGrid);
2967 return PackingInfiniteGrid;
2968}(InfiniteGrid);
2969
2970export default InfiniteGrid;
2971export { CONTAINER_CLASS_NAME, DIRECTION, FrameInfiniteGrid, GROUP_TYPE, IGNORE_PROPERITES_MAP, INFINITEGRID_EVENTS, INFINITEGRID_METHODS, INFINITEGRID_PROPERTY_TYPES, INVISIBLE_POS, IS_IOS, ITEM_INFO_PROPERTIES, ITEM_TYPE, InfiniteGridItem, JustifiedInfiniteGrid, MasonryInfiniteGrid, PackingInfiniteGrid, Renderer, STATUS_TYPE, getRenderingItems, mountRenderingItems, withInfiniteGridMethods };
2972//# sourceMappingURL=infinitegrid.esm.js.map