@firecms/core
Version:
Awesome Firebase/Firestore-based headless open-source CMS
44 lines (43 loc) • 1.75 kB
TypeScript
import { Entity, EntityCollection, EntityTableController, FilterValues, User } from "../../types";
import { ScrollRestorationController } from "./useScrollRestoration";
export type DataSourceTableControllerProps<M extends Record<string, any> = any> = {
/**
* Full path where the data of this table is located
*/
fullPath: string;
/**
* The collection that is represented by this config.
*/
collection: EntityCollection<M>;
/**
* List of entities that will be displayed on top, no matter the ordering.
* This is used for reference fields selection
*/
entitiesDisplayedFirst?: Entity<M>[];
lastDeleteTimestamp?: number;
/**
* Force filter to be applied to the table.
*/
forceFilter?: FilterValues<string>;
scrollRestoration?: ScrollRestorationController;
/**
* When set to true the filters and sort will be updated in the URL
*/
updateUrl?: boolean;
};
/**
* Use this hook to build a controller for the {@link EntityCollectionTable}.
* This controller is bound to data in a path in your specified datasource.
*
* Note that you can build your own hook returning a {@link EntityTableController}
* if you would like to display different data.
*
* @param fullPath
* @param collection
* @param scrollRestoration
* @param entitiesDisplayedFirst
* @param lastDeleteTimestamp
* @param forceFilterFromProps
* @param updateUrl
*/
export declare function useDataSourceTableController<M extends Record<string, any> = any, USER extends User = User>({ fullPath, collection, scrollRestoration, entitiesDisplayedFirst, lastDeleteTimestamp, forceFilter: forceFilterFromProps, updateUrl }: DataSourceTableControllerProps<M>): EntityTableController<M>;