1 | import Component from "@egjs/component";
|
2 | import { ContainerManager, Properties, RenderOptions, ItemRenderer } from "@egjs/grid";
|
3 | import { STATUS_TYPE } from "./consts";
|
4 | import { GroupManager } from "./GroupManager";
|
5 | import { Infinite } from "./Infinite";
|
6 | import { InfiniteGridItem, InfiniteGridItemStatus } from "./InfiniteGridItem";
|
7 | import { ScrollManager } from "./ScrollManager";
|
8 | import { InfiniteGridEvents, InfiniteGridGroup, InfiniteGridInsertedItems, InfiniteGridItemInfo, InfiniteGridOptions, InfiniteGridStatus, InsertedPlaceholdersResult } from "./types";
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 | declare class InfiniteGrid<Options extends InfiniteGridOptions = InfiniteGridOptions> extends Component<InfiniteGridEvents> {
|
47 | static defaultOptions: Required<InfiniteGridOptions>;
|
48 | static propertyTypes: {
|
49 | gap: import("@egjs/grid").PROPERTY_TYPE;
|
50 | defaultDirection: import("@egjs/grid").PROPERTY_TYPE;
|
51 | renderOnPropertyChange: import("@egjs/grid").PROPERTY_TYPE;
|
52 | preserveUIOnDestroy: import("@egjs/grid").PROPERTY_TYPE;
|
53 | useFit: import("@egjs/grid").PROPERTY_TYPE;
|
54 | outlineSize: import("@egjs/grid").PROPERTY_TYPE;
|
55 | outlineLength: import("@egjs/grid").PROPERTY_TYPE;
|
56 | };
|
57 | protected wrapperElement: HTMLElement;
|
58 | protected scrollManager: ScrollManager;
|
59 | protected itemRenderer: ItemRenderer;
|
60 | protected containerManager: ContainerManager;
|
61 | protected infinite: Infinite;
|
62 | protected groupManager: GroupManager;
|
63 | protected options: Required<Options>;
|
64 | private _waitType;
|
65 | |
66 |
|
67 |
|
68 |
|
69 | constructor(wrapper: HTMLElement | string, options: Options);
|
70 | /**
|
71 | * Rearrange items to fit the grid and render them. When rearrange is complete, the `renderComplete` event is fired.
|
72 | * @ko grid에 맞게 아이템을 재배치하고 렌더링을 한다. 배치가 완료되면 `renderComplete` 이벤트가 발생한다.
|
73 | * @param - Options for rendering. <ko>렌더링을 하기 위한 옵션.</ko>
|
74 | * @example
|
75 | * ```ts
|
76 | * import { MasonryInfiniteGrid } from "@egjs/infinitegrid";
|
77 | * const grid = new MasonryInfiniteGrid();
|
78 | *
|
79 | * grid.on("renderComplete", e => {
|
80 | * console.log(e);
|
81 | * });
|
82 | * grid.renderItems();
|
83 | * ```
|
84 | */
|
85 | renderItems(options?: RenderOptions): this;
|
86 | /**
|
87 | * Returns the wrapper element specified by the user.
|
88 | * @ko 컨테이너 엘리먼트를 반환한다.
|
89 | */
|
90 | getWrapperElement(): HTMLElement;
|
91 | /**
|
92 | * Returns the container element corresponding to the scroll area.
|
93 | * @ko 스크롤 영역에 해당하는 컨테이너 엘리먼트를 반환한다.
|
94 | */
|
95 | getScrollContainerElement(): HTMLElement;
|
96 | /**
|
97 | * Returns the container element containing item elements.
|
98 | * @ko 아이템 엘리먼트들을 담긴 컨테이너 엘리먼트를 반환한다.
|
99 | */
|
100 | getContainerElement(): HTMLElement;
|
101 | /**
|
102 | * When items change, it synchronizes and renders items.
|
103 | * @ko items가 바뀐 경우 동기화를 하고 렌더링을 한다.
|
104 | * @param - Options for rendering. <ko>렌더링을 하기 위한 옵션.</ko>
|
105 | */
|
106 | syncItems(items: InfiniteGridItemInfo[]): this;
|
107 | /**
|
108 | * Change the currently visible groups.
|
109 | * @ko 현재 보이는 그룹들을 바꾼다.
|
110 | * @param - first index of visible groups. <ko>보이는 그룹의 첫번째 index.</ko>
|
111 | * @param - last index of visible groups. <ko>보이는 그룹의 마지막 index.</ko>
|
112 | * @param - Whether the first rendering has already been done. <ko>첫 렌더링이 이미 되어있는지 여부.</ko>
|
113 | */
|
114 | setCursors(startCursor: number, endCursor: number, useFirstRender?: boolean): this;
|
115 | /**
|
116 | * Returns the first index of visible groups.
|
117 | * @ko 보이는 그룹들의 첫번째 index를 반환한다.
|
118 | */
|
119 | getStartCursor(): number;
|
120 | /**
|
121 | * Returns the last index of visible groups.
|
122 | * @ko 보이는 그룹들의 마지막 index를 반환한다.
|
123 | */
|
124 | getEndCursor(): number;
|
125 | /**
|
126 | * Add items at the bottom(right) of the grid.
|
127 | * @ko 아이템들을 grid 아래(오른쪽)에 추가한다.
|
128 | * @param - items to be added <ko>추가할 아이템들</ko>
|
129 | * @param - The group key to be configured in items. It is automatically generated by default. <ko>추가할 아이템에 설정할 그룹 키. 생략하면 값이 자동으로 생성된다.</ko>
|
130 | * @return - An instance of a module itself<ko>모듈 자신의 인스턴스</ko>
|
131 | * @example
|
132 | * ```js
|
133 | * ig.append(`<div class="item">test1</div><div class="item">test2</div>`);
|
134 | * ig.append([`<div class="item">test1</div>`, `<div class="item">test2</div>`]);
|
135 | * ig.append([HTMLElement1, HTMLElement2]);
|
136 | * ```
|
137 | */
|
138 | append(items: InfiniteGridInsertedItems, groupKey?: string | number): this;
|
139 | /**
|
140 | * Add items at the top(left) of the grid.
|
141 | * @ko 아이템들을 grid 위(왼쪽)에 추가한다.
|
142 | * @param - items to be added <ko>추가할 아이템들</ko>
|
143 | * @param - The group key to be configured in items. It is automatically generated by default. <ko>추가할 아이템에 설정할 그룹 키. 생략하면 값이 자동으로 생성된다.</ko>
|
144 | * @return - An instance of a module itself<ko>모듈 자신의 인스턴스</ko>
|
145 | * @example
|
146 | * ```ts
|
147 | * ig.prepend(`<div class="item">test1</div><div class="item">test2</div>`);
|
148 | * ig.prepend([`<div class="item">test1</div>`, `<div class="item">test2</div>`]);
|
149 | * ig.prepend([HTMLElement1, HTMLElement2]);
|
150 | * ```
|
151 | */
|
152 | prepend(items: InfiniteGridInsertedItems, groupKey?: string | number): this;
|
153 | /**
|
154 | * Add items to a specific index.
|
155 | * @ko 아이템들을 특정 index에 추가한다.
|
156 | * @param - index to add <ko>추가하기 위한 index</ko>
|
157 | * @param - items to be added <ko>추가할 아이템들</ko>
|
158 | * @param - The group key to be configured in items. It is automatically generated by default. <ko>추가할 아이템에 설정할 그룹 키. 생략하면 값이 자동으로 생성된다.</ko>
|
159 | * @return - An instance of a module itself<ko>모듈 자신의 인스턴스</ko>
|
160 | * @example
|
161 | * ```ts
|
162 | * ig.insert(2, `<div class="item">test1</div><div class="item">test2</div>`);
|
163 | * ig.insert(3, [`<div class="item">test1</div>`, `<div class="item">test2</div>`]);
|
164 | * ig.insert(4, [HTMLElement1, HTMLElement2]);
|
165 | * ```
|
166 | */
|
167 | insert(index: number, items: InfiniteGridInsertedItems, groupKey?: string | number): this;
|
168 | /**
|
169 | * Add items based on group index.
|
170 | * @ko group의 index 기준으로 item들을 추가한다.
|
171 | * @param - group index to add <ko>추가하기 위한 group의 index</ko>
|
172 | * @param - items to be added <ko>추가할 아이템들</ko>
|
173 | * @param - The group key to be configured in items. It is automatically generated by default. <ko>추가할 아이템에 설정할 그룹 키. 생략하면 값이 자동으로 생성된다.</ko>
|
174 | * @return - An instance of a module itself<ko>모듈 자신의 인스턴스</ko>
|
175 | * @example
|
176 | * ```ts
|
177 | * ig.insertByGroupIndex(2, `<div class="item">test1</div><div class="item">test2</div>`);
|
178 | * ig.insertByGroupIndex(3, [`<div class="item">test1</div>`, `<div class="item">test2</div>`]);
|
179 | * ig.insertByGroupIndex(4, [HTMLElement1, HTMLElement2]);
|
180 | * ```
|
181 | */
|
182 | insertByGroupIndex(groupIndex: number, items: InfiniteGridInsertedItems, groupKey?: string | number): this;
|
183 | /**
|
184 | * 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.
|
185 | * @ko 아이템의 위치 정보 등 모듈의 현재 상태 정보를 반환한다. 이 메서드가 반환한 정보를 저장해 두었다가 setStatus() 메서드로 복원할 수 있다
|
186 | * @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>
|
187 | * @param - Whether to include items corresponding to placeholders. <ko>placeholder에 해당하는 아이템들을 포함할지 여부.</ko>
|
188 | */
|
189 | getStatus(type?: STATUS_TYPE, includePlaceholders?: boolean): InfiniteGridStatus;
|
190 | /**
|
191 | * You can set placeholders to restore status or wait for items to be added.
|
192 | * @ko status 복구 또는 아이템 추가 대기를 위한 placeholder를 설정할 수 있다.
|
193 | * @param - The placeholder status. <ko>placeholder의 status</ko>
|
194 | */
|
195 | setPlaceholder(info: Partial<InfiniteGridItemStatus> | null): this;
|
196 | /**
|
197 | * You can set placeholders to restore status or wait for items to be added.
|
198 | * @ko status 복구 또는 아이템 추가 대기를 위한 placeholder를 설정할 수 있다.
|
199 | * @param - The placeholder status. <ko>placeholder의 status</ko>
|
200 | */
|
201 | setLoading(info: Partial<InfiniteGridItemStatus> | null): this;
|
202 | /**
|
203 | * Add the placeholder at the end.
|
204 | * @ko placeholder들을 마지막에 추가한다.
|
205 | * @param - Items that correspond to placeholders. If it is a number, it duplicates the number of copies. <ko>placeholder에 해당하는 아이템들. 숫자면 갯수만큼 복제를 한다.</ko>
|
206 | * @param - The group key to be configured in items. It is automatically generated by default. <ko>추가할 아이템에 설정할 그룹 키. 생략하면 값이 자동으로 생성된다.</ko>
|
207 | */
|
208 | appendPlaceholders(items: number | InfiniteGridItemStatus[], groupKey?: string | number): InsertedPlaceholdersResult;
|
209 | /**
|
210 | * Add the placeholder at the start.
|
211 | * @ko placeholder들을 처음에 추가한다.
|
212 | * @param - Items that correspond to placeholders. If it is a number, it duplicates the number of copies. <ko>placeholder에 해당하는 아이템들. 숫자면 갯수만큼 복제를 한다.</ko>
|
213 | * @param - The group key to be configured in items. It is automatically generated by default. <ko>추가할 아이템에 설정할 그룹 키. 생략하면 값이 자동으로 생성된다.</ko>
|
214 | */
|
215 | prependPlaceholders(items: number | InfiniteGridItemStatus[], groupKey?: string | number): InsertedPlaceholdersResult;
|
216 | /**
|
217 | * Remove placeholders
|
218 | * @ko placeholder들을 삭제한다.
|
219 | * @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>
|
220 | */
|
221 | removePlaceholders(type: "start" | "end" | {
|
222 | groupKey: string | number;
|
223 | }): void;
|
224 | /**
|
225 | * Sets the status of the InfiniteGrid module with the information returned through a call to the getStatus() method.
|
226 | * @ko getStatus() 메서드가 저장한 정보로 InfiniteGrid 모듈의 상태를 설정한다.
|
227 | * @param - status object of the InfiniteGrid module. <ko>InfiniteGrid 모듈의 status 객체.</ko>
|
228 | * @param - Whether the first rendering has already been done. <ko>첫 렌더링이 이미 되어있는지 여부.</ko>
|
229 | */
|
230 | setStatus(status: InfiniteGridStatus, useFirstRender?: boolean): this;
|
231 | /**
|
232 | * Removes the group corresponding to index.
|
233 | * @ko index에 해당하는 그룹을 제거 한다.
|
234 | */
|
235 | removeGroupByIndex(index: number): this;
|
236 | /**
|
237 | * Removes the group corresponding to key.
|
238 | * @ko key에 해당하는 그룹을 제거 한다.
|
239 | */
|
240 | removeGroupByKey(key: number | string): this;
|
241 | /**
|
242 | * Removes the item corresponding to index.
|
243 | * @ko index에 해당하는 아이템을 제거 한다.
|
244 | */
|
245 | removeByIndex(index: number): this;
|
246 | /**
|
247 | * Removes the item corresponding to key.
|
248 | * @ko key에 해당하는 아이템을 제거 한다.
|
249 | */
|
250 | removeByKey(key: string | number): this;
|
251 | /**
|
252 | * Update the size of the items and render them.
|
253 | * @ko 아이템들의 사이즈를 업데이트하고 렌더링을 한다.
|
254 | * @param - Items to be updated. <ko>업데이트할 아이템들.</ko>
|
255 | * @param - Options for rendering. <ko>렌더링을 하기 위한 옵션.</ko>
|
256 | */
|
257 | updateItems(items?: InfiniteGridItem[], options?: RenderOptions): this;
|
258 | /**
|
259 | * Return all items of InfiniteGrid.
|
260 | * @ko InfiniteGrid의 모든 아이템들을 반환한다.
|
261 | * @param - Whether to include items corresponding to placeholders. <ko>placeholder에 해당하는 아이템들을 포함할지 여부.</ko>
|
262 | */
|
263 | getItems(includePlaceholders?: boolean): InfiniteGridItem[];
|
264 | /**
|
265 | * Return visible items of InfiniteGrid.
|
266 | * @ko InfiniteGrid의 보이는 아이템들을 반환한다.
|
267 | * @param - Whether to include items corresponding to placeholders. <ko>placeholder에 해당하는 아이템들을 포함할지 여부.</ko>
|
268 | */
|
269 | getVisibleItems(includePlaceholders?: boolean): InfiniteGridItem[];
|
270 | /**
|
271 | * Return rendering items of InfiniteGrid.
|
272 | * @ko InfiniteGrid의 렌더링 아이템들을 반환한다.
|
273 | */
|
274 | getRenderingItems(): InfiniteGridItem[];
|
275 | /**
|
276 | * Return all groups of InfiniteGrid.
|
277 | * @ko InfiniteGrid의 모든 그룹들을 반환한다.
|
278 | * @param - Whether to include groups corresponding to placeholders. <ko>placeholder에 해당하는 그룹들을 포함할지 여부.</ko>
|
279 | */
|
280 | getGroups(includePlaceholders?: boolean): InfiniteGridGroup[];
|
281 | /**
|
282 | * Return visible groups of InfiniteGrid.
|
283 | * @ko InfiniteGrid의 보이는 그룹들을 반환한다.
|
284 | * @param - Whether to include groups corresponding to placeholders. <ko>placeholder에 해당하는 그룹들을 포함할지 여부.</ko>
|
285 | */
|
286 | getVisibleGroups(includePlaceholders?: boolean): InfiniteGridGroup[];
|
287 | /**
|
288 | * Set to wait to request data.
|
289 | * @ko 데이터를 요청하기 위해 대기 상태로 설정한다.
|
290 | * @param direction - direction in which data will be added. <ko>데이터를 추가하기 위한 방향.</ko>
|
291 | */
|
292 | wait(direction?: "start" | "end"): void;
|
293 | /**
|
294 | * When the data request is complete, it is set to ready state.
|
295 | * @ko 데이터 요청이 끝났다면 준비 상태로 설정한다.
|
296 | */
|
297 | ready(): void;
|
298 | /**
|
299 | * Returns whether it is set to wait to request data.
|
300 | * @ko 데이터를 요청하기 위해 대기 상태로 설정되어 있는지 여부를 반환한다.
|
301 | */
|
302 | isWait(): boolean;
|
303 | /**
|
304 | * Releases the instnace and events and returns the CSS of the container and elements.
|
305 | * @ko 인스턴스와 이벤트를 해제하고 컨테이너와 엘리먼트들의 CSS를 되돌린다.
|
306 | */
|
307 | destroy(): void;
|
308 | private _getRenderer;
|
309 | private _getRendererItems;
|
310 | private _syncItems;
|
311 | private _render;
|
312 | private _update;
|
313 | private _resizeScroll;
|
314 | private _syncGroups;
|
315 | private _syncInfinite;
|
316 | private _scroll;
|
317 | private _onScroll;
|
318 | private _onChange;
|
319 | private _onRendererUpdated;
|
320 | private _onResize;
|
321 | private _onRequestAppend;
|
322 | private _onRequestPrepend;
|
323 | private _onRequestInsert;
|
324 | private _onContentError;
|
325 | private _onRenderComplete;
|
326 | private _renderItems;
|
327 | private _checkStartLoading;
|
328 | private _checkEndLoading;
|
329 | }
|
330 | interface InfiniteGrid extends Properties<typeof InfiniteGrid> {
|
331 | }
|
332 | export default InfiniteGrid;
|
333 |
|
\ | No newline at end of file |