@egjs/infinitegrid
Version:
A module used to arrange elements including content infinitely according to grid type. With this module, you can implement various grids composed of different card elements whose sizes vary. It guarantees performance by maintaining the number of DOMs the
68 lines (67 loc) • 4.09 kB
TypeScript
import { GRID_PROPERTY_TYPES } from "@egjs/grid";
import { GROUP_TYPE } from "./consts";
import { GroupManagerStatus } from "./GroupManager";
import InfiniteGrid from "./InfiniteGrid";
import { InfiniteGridItem, InfiniteGridItemStatus } from "./InfiniteGridItem";
import { CategorizedGroup, InfiniteGridGroup, InfiniteGridInsertedItems, InfiniteGridItemInfo, RenderingOptions } from "./types";
export declare function isWindow(el: Window | Element): el is Window;
export declare function isNumber(val: any): val is number;
export declare function isString(val: any): val is string;
export declare function isObject(val: any): val is object;
export declare function flat<T>(arr: T[][]): T[];
export declare function splitOptions(options: Record<string, any>): {
gridOptions: Record<string, any>;
};
export declare function splitGridOptions(options: Record<string, any>): {
gridOptions: Record<string, any>;
};
export declare function categorize<Item extends InfiniteGridItemInfo = InfiniteGridItem>(items: Item[]): CategorizedGroup<Item>[];
export declare function getNextCursors(prevKeys: Array<string | number>, nextKeys: Array<string | number>, prevStartCursor: number, prevEndCursor: number): {
startCursor: number;
endCursor: number;
};
export declare function splitVirtualGroups<Group extends {
type: GROUP_TYPE;
groupKey: string | number;
}>(groups: Group[], direction: "start" | "end", nextGroups: CategorizedGroup<InfiniteGridItemStatus>[]): Group[];
export declare function getFirstRenderingItems(nextItems: InfiniteGridItemStatus[], horizontal: boolean): InfiniteGridItem[];
export declare function getRenderingItemsByStatus(groupManagerStatus: GroupManagerStatus, nextItems: InfiniteGridItemStatus[], usePlaceholder: boolean, horizontal: boolean): InfiniteGridItem[];
export declare function mountRenderingItems(items: InfiniteGridItemInfo[], options: RenderingOptions): void;
export declare function getRenderingItems(items: InfiniteGridItemInfo[], options: RenderingOptions): InfiniteGridItem[];
export declare function InfiniteGridGetterSetter(component: {
prototype: InfiniteGrid<any>;
propertyTypes: typeof GRID_PROPERTY_TYPES;
infinitegridTypes: any;
}): void;
export declare function makeKey(registeredKeys: Record<string, any>, prefix?: string): string;
export declare function convertHTMLtoElement(html: string): HTMLElement[];
export declare function convertInsertedItems(items: InfiniteGridInsertedItems, groupKey?: string | number): InfiniteGridItemInfo[];
export declare function toArray(nodes: HTMLCollection): HTMLElement[];
export declare function toArray<T>(nodes: {
length: number;
[key: number]: T;
}): T[];
export declare function find<T>(arr: T[], callback: (value: T, index: number) => boolean): T | null;
export declare function findIndex<T>(arr: T[], callback: (value: T, index: number) => boolean): number;
export declare function findLastIndex<T>(arr: T[], callback: (value: T, index: number) => boolean): number;
export declare function getItemInfo(info: InfiniteGridItemInfo): InfiniteGridItemInfo;
export declare function setPlaceholder(item: InfiniteGridItem, info: InfiniteGridItemStatus): void;
export declare function isFlatOutline(start: number[], end: number[]): boolean;
export declare function range(length: number): number[];
export declare function flatGroups(groups: InfiniteGridGroup[]): InfiniteGridItem[];
export declare function filterVirtuals<T extends InfiniteGridItem | InfiniteGridGroup>(items: T[], includePlaceholders?: boolean): T[];
/**
* Decorator that makes the method of InfiniteGrid available in the framework.
* @ko 프레임워크에서 InfiniteGrid의 메소드를 사용할 수 있게 하는 데코레이터.
* @private
* @example
* ```js
* import { withInfiniteGridMethods } from "@egjs/infinitegrid";
*
* class Grid extends React.Component<Partial<InfiniteGridProps & InfiniteGridOptions>> {
* @withInfiniteGridMethods
* private grid: NativeGrid;
* }
* ```
*/
export declare const withInfiniteGridMethods: (prototype: any, memberName: string) => void;