@etsoo/materialui
Version:
TypeScript Material-UI Implementation
45 lines (44 loc) • 1.75 kB
TypeScript
import { GridLoadDataProps, GridLoaderStates } from "@etsoo/react";
import { DataTypes } from "@etsoo/shared";
import { GridDataCacheType } from "./GridDataCacheType";
/**
* Grid utilities
*/
export declare namespace GridUtils {
/**
* Create data loader
* @param props Props
* @param template Field template
* @param cacheKey Cache key
* @param keepSource Keep source or not
* @returns Request data
*/
function createLoader<const F>(props: GridLoadDataProps, template?: F, cacheKey?: string, keepSource?: boolean): DataTypes.BasicTemplateType<{ [k in keyof F]: F[k] extends "date" ? "string" | "date" : F[k] extends "string" | "number" | "bigint" | "boolean" | "date" | "number[]" | "bigint[]" | "date[]" | "boolean[]" | "string[]" | "unknown[]" ? F[k] : never; }> & {
queryPaging: import("@etsoo/appscript").QueryPagingData;
};
/**
* Get cache data
* @param cacheKey Cache key
* @param cacheMinutes Cache minutes
* @returns
*/
function getCacheData<T>(cacheKey: string, cacheMinutes: number): GridDataCacheType<T> | undefined;
/**
* Get search data
* @param cacheKey Cache key
* @returns Result
*/
function getSearchData(cacheKey?: string): any;
/**
* Get update rows handler
* @param cacheKey Cache key
* @returns Handler
*/
function getUpdateRowsHandler<T extends object>(cacheKey?: string): (rows: T[], state: GridLoaderStates<T>) => void;
/**
* Merget search date to state
* @param state State
* @param searchData Search data
*/
function mergeSearchData<T, F extends DataTypes.BasicTemplate>(state: GridLoaderStates<T>, searchData?: DataTypes.BasicTemplateType<F>): void;
}