UNPKG

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