UNPKG

6.83 kBTypeScriptView Raw
1import type { BaseCellEditor, BaseDate, BaseDateParams, BaseFilter, BaseFilterParams, BaseFloatingFilter, BaseMenuItem, BaseMenuItemParams, BaseToolPanelParams, ICellEditorParams, ICellRendererParams, IDetailCellRendererParams, IFilter, IFloatingFilterParams, IGroupCellRendererParams, IHeaderGroupParams, IHeaderParams, ILoadingCellRendererParams, ILoadingOverlayParams, INoRowsOverlayParams, IStatusPanelParams, ITooltipParams } from 'ag-grid-community';
2/** Props provided to custom cell editor components */
3export interface CustomCellEditorProps<TData = any, TValue = any, TContext = any> extends ICellEditorParams<TData, TValue, TContext> {
4 /** The value in the cell when editing started. */
5 initialValue: TValue | null | undefined;
6 /** The current value for the editor. */
7 value: TValue | null | undefined;
8 /** Callback that should be called every time the value in the editor changes. */
9 onValueChange: (value: TValue | null | undefined) => void;
10}
11/** Props provided to custom date components */
12export interface CustomDateProps<TData = any, TContext = any> extends BaseDateParams<TData, TContext> {
13 /** The current date for the component. */
14 date: Date | null;
15 /** Callback that should be called every time the date in the component changes. */
16 onDateChange: (date: Date | null) => void;
17}
18/** Props provided to custom filter components */
19export interface CustomFilterProps<TData = any, TContext = any, TModel = any> extends BaseFilterParams<TData, TContext> {
20 /** The current filter model for the component. */
21 model: TModel | null;
22 /** Callback that should be called every time the model in the component changes. */
23 onModelChange: (model: TModel | null) => void;
24 /**
25 * Callback that can be optionally called every time the filter UI changes.
26 * The grid will respond with emitting a FilterModifiedEvent.
27 * Apart from emitting the event, the grid takes no further action.
28 */
29 onUiChange: () => void;
30}
31/** Props provided to custom floating filter components */
32export interface CustomFloatingFilterProps<P = IFilter, TData = any, TContext = any, TModel = any> extends IFloatingFilterParams<P, TData, TContext> {
33 /** The current filter model for the component. */
34 model: TModel | null;
35 /** Callback that should be called every time the model in the component changes. */
36 onModelChange: (model: TModel | null) => void;
37}
38/** Props provided to custom tool panel components */
39export interface CustomToolPanelProps<TData = any, TContext = any, TState = any> extends BaseToolPanelParams<TData, TContext, TState> {
40 /**
41 * The current state for the component (used in grid state).
42 * Initially set to the same value as `initialState`
43 */
44 state: TState | undefined;
45 /**
46 * If using grid state, callback that should be called every time the state in the component changes.
47 * If not using grid state, not required.
48 */
49 onStateChange: (model: TState | undefined) => void;
50}
51/** Props provided to custom menu item components */
52export interface CustomMenuItemProps<TData = any, TContext = any> extends BaseMenuItemParams<TData, TContext> {
53 /** The active status of the item (is it currently hovered with the mouse, or navigated to via the keyboard). */
54 active: boolean;
55 /** If the item is a sub menu, whether it is currently opened or closed. */
56 expanded: boolean;
57 /** Callback that should be called every time the active status is updated (if providing custom behaviour). */
58 onActiveChange: (active: boolean) => void;
59}
60/** Props provided to custom loading overlay component */
61export interface CustomLoadingOverlayProps<TData = any, TContext = any> extends ILoadingOverlayParams<TData, TContext> {
62}
63/** Props provided to custom no-rows overlay component */
64export interface CustomNoRowsOverlayProps<TData = any, TContext = any> extends INoRowsOverlayParams<TData, TContext> {
65}
66/** Props provided to custom status panel components */
67export interface CustomStatusPanelProps<TData = any, TContext = any> extends IStatusPanelParams<TData, TContext> {
68}
69/** Props provided to custom cell renderer components */
70export interface CustomCellRendererProps<TData = any, TValue = any, TContext = any> extends ICellRendererParams<TData, TValue, TContext> {
71}
72/** Props provided to custom detail cell renderer components */
73export interface CustomDetailCellRendererProps<TData = any, TDetail = any> extends IDetailCellRendererParams<TData, TDetail> {
74}
75/** Props provided to custom group cell renderer components */
76export interface CustomGroupCellRendererProps<TData = any, TValue = any> extends IGroupCellRendererParams<TData, TValue> {
77}
78/** Props provided to custom header components */
79export interface CustomHeaderProps<TData = any, TContext = any> extends IHeaderParams<TData, TContext> {
80}
81/** Props provided to custom header group components */
82export interface CustomHeaderGroupProps<TData = any, TContext = any> extends IHeaderGroupParams<TData, TContext> {
83}
84/** Props provided to custom loading cell renderer components */
85export interface CustomLoadingCellRendererProps<TData = any, TContext = any> extends ILoadingCellRendererParams<TData, TContext> {
86}
87/** Props provided to custom tooltip components */
88export interface CustomTooltipProps<TData = any, TValue = any, TContext = any> extends ITooltipParams<TData, TValue, TContext> {
89}
90/** Callbacks for custom cell editor components */
91export interface CustomCellEditorCallbacks extends BaseCellEditor {
92}
93/** Callbacks for custom date components */
94export interface CustomDateCallbacks extends BaseDate {
95}
96/** Callbacks for custom filter components */
97export interface CustomFilterCallbacks extends BaseFilter {
98}
99/** Callbacks for custom floating filter components */
100export interface CustomFloatingFilterCallbacks extends BaseFloatingFilter {
101}
102/** Callbacks for custom menu item components */
103export interface CustomMenuItemCallbacks extends BaseMenuItem {
104}
105/** Hook to allow custom cell editor component callbacks to be provided to the grid */
106export declare function useGridCellEditor(callbacks: CustomCellEditorCallbacks): void;
107/** Hook to allow custom date component callbacks to be provided to the grid */
108export declare function useGridDate(callbacks: CustomDateCallbacks): void;
109/** Hook to allow custom filter component callbacks to be provided to the grid */
110export declare function useGridFilter(callbacks: CustomFilterCallbacks): void;
111/** Hook to allow custom floating filter component callbacks to be provided to the grid */
112export declare function useGridFloatingFilter(callbacks: CustomFloatingFilterCallbacks): void;
113/** Hook to allow custom menu item component callbacks to be provided to the grid */
114export declare function useGridMenuItem(callbacks: CustomMenuItemCallbacks): void;