1 | import Grid, { GridFunction, GridOptions, GridOutlines, Properties, PROPERTY_TYPE, RenderOptions } from "@egjs/grid";
|
2 | import { GROUP_TYPE, STATUS_TYPE } from "./consts";
|
3 | import { InfiniteGridItem, InfiniteGridItemStatus } from "./InfiniteGridItem";
|
4 | import { InfiniteGridGroup, InfiniteGridItemInfo } from "./types";
|
5 | export interface InfiniteGridGroupStatus {
|
6 | type: GROUP_TYPE;
|
7 | groupKey: string | number;
|
8 | items: InfiniteGridItemStatus[];
|
9 | outlines: GridOutlines;
|
10 | }
|
11 | export interface GroupManagerOptions extends GridOptions {
|
12 | gridConstructor: GridFunction | null;
|
13 | gridOptions: Record<string, any>;
|
14 | }
|
15 | export interface GroupManagerStatus {
|
16 | cursors: [number, number];
|
17 | orgCursors: [number, number];
|
18 | itemCursors: [number, number];
|
19 | startGroupKey: number | string;
|
20 | endGroupKey: number | string;
|
21 | groups: InfiniteGridGroupStatus[];
|
22 | outlines: GridOutlines;
|
23 | }
|
24 | export declare class GroupManager extends Grid<GroupManagerOptions> {
|
25 | static defaultOptions: Required<GroupManagerOptions>;
|
26 | static propertyTypes: {
|
27 | readonly gridConstructor: PROPERTY_TYPE.PROPERTY;
|
28 | readonly gridOptions: PROPERTY_TYPE.PROPERTY;
|
29 | readonly gap: PROPERTY_TYPE;
|
30 | readonly defaultDirection: PROPERTY_TYPE;
|
31 | readonly renderOnPropertyChange: PROPERTY_TYPE;
|
32 | readonly preserveUIOnDestroy: PROPERTY_TYPE;
|
33 | readonly useFit: PROPERTY_TYPE;
|
34 | };
|
35 | protected items: InfiniteGridItem[];
|
36 | protected groupItems: InfiniteGridItem[];
|
37 | protected groups: InfiniteGridGroup[];
|
38 | protected itemKeys: Record<string | number, InfiniteGridItem>;
|
39 | protected groupKeys: Record<string | number, InfiniteGridGroup>;
|
40 | protected startCursor: number;
|
41 | protected endCursor: number;
|
42 | private _placeholder;
|
43 | private _loadingGrid;
|
44 | constructor(container: HTMLElement, options: GroupManagerOptions);
|
45 | set gridOptions(options: Record<string, any>);
|
46 | getItemByKey(key: string | number): InfiniteGridItem | null;
|
47 | getGroupItems(includePlaceholders?: boolean): InfiniteGridItem[];
|
48 | getVisibleItems(includePlaceholders?: boolean): InfiniteGridItem[];
|
49 | getRenderingItems(): InfiniteGridItem[];
|
50 | getGroups(includePlaceholders?: boolean): InfiniteGridGroup[];
|
51 | hasVisibleVirtualGroups(): boolean;
|
52 | hasPlaceholder(): boolean;
|
53 | hasLoadingItem(): boolean;
|
54 | setPlaceholder(placeholder: Partial<InfiniteGridItemStatus> | null): void;
|
55 | getLoadingType(): "" | "end" | "start";
|
56 | startLoading(type: "start" | "end"): boolean;
|
57 | endLoading(): boolean;
|
58 | setLoading(loading: Partial<InfiniteGridItemStatus> | null): void;
|
59 | getVisibleGroups(includePlaceholders?: boolean): InfiniteGridGroup[];
|
60 | applyGrid(items: InfiniteGridItem[], direction: "end" | "start", outline: number[]): GridOutlines;
|
61 | syncItems(nextItemInfos: InfiniteGridItemInfo[]): void;
|
62 | renderItems(options?: RenderOptions): this;
|
63 | setCursors(startCursor: number, endCursor: number): void;
|
64 | getStartCursor(): number;
|
65 | getEndCursor(): number;
|
66 | getGroupStatus(type?: STATUS_TYPE): GroupManagerStatus;
|
67 | setGroupStatus(status: GroupManagerStatus): void;
|
68 | appendPlaceholders(items: number | InfiniteGridItemStatus[], groupKey?: string | number): {
|
69 | group: {
|
70 | type: GROUP_TYPE;
|
71 | groupKey: string | number;
|
72 | grid: Grid<GridOptions>;
|
73 | items: InfiniteGridItem[];
|
74 | renderItems: InfiniteGridItem[];
|
75 | };
|
76 | items: InfiniteGridItem[];
|
77 | };
|
78 | prependPlaceholders(items: number | InfiniteGridItemStatus[], groupKey?: string | number): {
|
79 | group: {
|
80 | type: GROUP_TYPE;
|
81 | groupKey: string | number;
|
82 | grid: Grid<GridOptions>;
|
83 | items: InfiniteGridItem[];
|
84 | renderItems: InfiniteGridItem[];
|
85 | };
|
86 | items: InfiniteGridItem[];
|
87 | };
|
88 | removePlaceholders(type: "start" | "end" | {
|
89 | groupKey: string | number;
|
90 | }): void;
|
91 | insertPlaceholders(direction: "start" | "end", items: number | InfiniteGridItemStatus[], groupKey?: string | number): {
|
92 | group: {
|
93 | type: GROUP_TYPE;
|
94 | groupKey: string | number;
|
95 | grid: Grid<GridOptions>;
|
96 | items: InfiniteGridItem[];
|
97 | renderItems: InfiniteGridItem[];
|
98 | };
|
99 | items: InfiniteGridItem[];
|
100 | };
|
101 | shouldRerenderItems(): boolean;
|
102 | private _getGroupItems;
|
103 | private _getRenderingItems;
|
104 | private _checkShouldRender;
|
105 | private _applyVirtualGrid;
|
106 | private _syncItemInfos;
|
107 | private _registerGroups;
|
108 | private _splitVirtualGroups;
|
109 | private _mergeVirtualGroups;
|
110 | private _updatePlaceholder;
|
111 | private _makeGrid;
|
112 | private _getLoadingGroup;
|
113 | private _getLoadingItem;
|
114 | }
|
115 | export interface GroupManager extends Properties<typeof GroupManager> {
|
116 | getItems(): InfiniteGridItem[];
|
117 | }
|