UNPKG

3.94 kBTypeScriptView Raw
1import { GRID_PROPERTY_TYPES } from "@egjs/grid";
2import { GROUP_TYPE } from "./consts";
3import { GroupManagerStatus } from "./GroupManager";
4import InfiniteGrid from "./InfiniteGrid";
5import { InfiniteGridItem, InfiniteGridItemStatus } from "./InfiniteGridItem";
6import { CategorizedGroup, InfiniteGridGroup, InfiniteGridInsertedItems, InfiniteGridItemInfo, RenderingOptions } from "./types";
7export declare function isWindow(el: Window | Element): el is Window;
8export declare function isNumber(val: any): val is number;
9export declare function isString(val: any): val is string;
10export declare function isObject(val: any): val is object;
11export declare function flat<T>(arr: T[][]): T[];
12export declare function splitOptions(options: Record<string, any>): {
13 gridOptions: Record<string, any>;
14};
15export declare function splitGridOptions(options: Record<string, any>): {
16 gridOptions: Record<string, any>;
17};
18export declare function categorize<Item extends InfiniteGridItemInfo = InfiniteGridItem>(items: Item[]): CategorizedGroup<Item>[];
19export declare function getNextCursors(prevKeys: Array<string | number>, nextKeys: Array<string | number>, prevStartCursor: number, prevEndCursor: number): {
20 startCursor: number;
21 endCursor: number;
22};
23export declare function splitVirtualGroups<Group extends {
24 type: GROUP_TYPE;
25 groupKey: string | number;
26}>(groups: Group[], direction: "start" | "end", nextGroups: CategorizedGroup<InfiniteGridItemStatus>[]): Group[];
27export declare function getFirstRenderingItems(nextItems: InfiniteGridItemStatus[], horizontal: boolean): InfiniteGridItem[];
28export declare function getRenderingItemsByStatus(groupManagerStatus: GroupManagerStatus, nextItems: InfiniteGridItemStatus[], usePlaceholder: boolean, horizontal: boolean): InfiniteGridItem[];
29export declare function mountRenderingItems(items: InfiniteGridItemInfo[], options: RenderingOptions): void;
30export declare function getRenderingItems(items: InfiniteGridItemInfo[], options: RenderingOptions): InfiniteGridItem[];
31export declare function InfiniteGridGetterSetter(component: {
32 prototype: InfiniteGrid<any>;
33 propertyTypes: typeof GRID_PROPERTY_TYPES;
34}): void;
35export declare function makeKey(registeredKeys: Record<string, any>): string;
36export declare function convertHTMLtoElement(html: string): HTMLElement[];
37export declare function convertInsertedItems(items: InfiniteGridInsertedItems, groupKey?: string | number): InfiniteGridItemInfo[];
38export declare function toArray(nodes: HTMLCollection): HTMLElement[];
39export declare function toArray<T>(nodes: {
40 length: number;
41 [key: number]: T;
42}): T[];
43export declare function findIndex<T>(arr: T[], callback: (value: T, index: number) => boolean): number;
44export declare function findLastIndex<T>(arr: T[], callback: (value: T, index: number) => boolean): number;
45export declare function getItemInfo(info: InfiniteGridItemInfo): InfiniteGridItemInfo;
46export declare function setPlaceholder(item: InfiniteGridItem, info: InfiniteGridItemStatus): void;
47export declare function isFlatOutline(start: number[], end: number[]): boolean;
48export declare function range(length: number): number[];
49export declare function flatGroups(groups: InfiniteGridGroup[]): InfiniteGridItem[];
50export declare function filterVirtuals<T extends InfiniteGridItem | InfiniteGridGroup>(items: T[], includePlaceholders?: boolean): T[];
51/**
52 * Decorator that makes the method of InfiniteGrid available in the framework.
53 * @ko 프레임워크에서 InfiniteGrid의 메소드를 사용할 수 있게 하는 데코레이터.
54 * @private
55 * @example
56 * ```js
57 * import { withInfiniteGridMethods } from "@egjs/infinitegrid";
58 *
59 * class Grid extends React.Component<Partial<InfiniteGridProps & InfiniteGridOptions>> {
60 * &#64;withInfiniteGridMethods
61 * private grid: NativeGrid;
62 * }
63 * ```
64 */
65export declare const withInfiniteGridMethods: (prototype: any, memberName: string) => void;