@data-c/pro 0.2.54 → 0.2.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,15 +1,30 @@
1
- import * as react from 'react';
2
- import { ReactNode } from 'react';
3
1
  import * as _mui_x_data_grid_pro from '@mui/x-data-grid-pro';
4
2
  import { DataGridProProps, GridRowsProp, GridRowSelectionModel, GridCallbackDetails, GridColDef as GridColDef$1, GridActionsCellItemProps } from '@mui/x-data-grid-pro';
5
- import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import * as react from 'react';
4
+ import { ReactNode } from 'react';
5
+ import { GridApiPro } from '@mui/x-data-grid-pro/models';
6
6
  import { StackProps, Breakpoint, ButtonProps as ButtonProps$1, TableFooterProps, TypographyProps } from '@mui/material';
7
+ import * as react_jsx_runtime from 'react/jsx-runtime';
7
8
  import { PaginationProps as PaginationProps$1 } from '@data-c/hooks';
8
9
 
10
+ type GridViewState = ReturnType<GridApiPro['exportState']>;
11
+ type ColumnChangeMeta = {
12
+ reason: 'order';
13
+ } | {
14
+ reason: 'width';
15
+ } | {
16
+ reason: 'visibility';
17
+ };
18
+ type GridWrapperApi = {
19
+ apiRef: GridApiPro | null;
20
+ restoreState: (state: unknown) => void;
21
+ exportState: () => unknown;
22
+ };
23
+
9
24
  type GridColDef = GridColDef$1 & {
10
25
  enableStickyColumns?: boolean;
11
26
  };
12
- interface TableProps<T> extends Omit<DataGridProProps, 'onCellKeyDown' | 'onRowDoubleClick'> {
27
+ interface DataTableProps extends Omit<DataGridProProps, 'onCellKeyDown' | 'onRowDoubleClick'> {
13
28
  data?: GridRowsProp<{
14
29
  [key: string | symbol]: any;
15
30
  }>;
@@ -18,13 +33,17 @@ interface TableProps<T> extends Omit<DataGridProProps, 'onCellKeyDown' | 'onRowD
18
33
  isLoading?: boolean;
19
34
  isFetching?: boolean;
20
35
  stackProps?: StackProps;
36
+ onColumnChange?: (payload: {
37
+ state: GridViewState;
38
+ meta: ColumnChangeMeta;
39
+ }) => void;
21
40
  controlledRowsSelectedId?: GridRowSelectionModel;
22
41
  onCellKeyDown?: (event: 'edit' | 'delete', id: number | string) => void;
23
42
  onRowDoubleClick?: (event: 'edit' | 'delete', id: number | string) => void;
24
43
  onClearRowsSelectedId?: (rowsSelectedId: GridRowSelectionModel) => void;
25
44
  onRowSelectionChange?: (rowSelectionModel: GridRowSelectionModel, details: GridCallbackDetails) => void;
45
+ restoreFromState?: GridViewState | null;
26
46
  }
27
- declare function Table<T>(props: TableProps<T>): react_jsx_runtime.JSX.Element;
28
47
 
29
48
  type DataTableActionProps = {} & GridActionsCellItemProps;
30
49
  declare function DataTableAction(props: DataTableActionProps): react_jsx_runtime.JSX.Element;
@@ -44,6 +63,11 @@ declare function Actions({ children, breakpoints }: ActionsProps): react_jsx_run
44
63
  type DataTableActionTransportProps = {} & Omit<GridActionsCellItemProps, 'icon' | 'label'>;
45
64
  declare function DataTableActionTransport(props: DataTableActionTransportProps): react_jsx_runtime.JSX.Element;
46
65
 
66
+ interface DataTableAddPanelTriggerProps {
67
+ onClick?: React.MouseEventHandler<HTMLElement> | undefined;
68
+ }
69
+ declare function DataTableAddPanelTrigger({ onClick, }: DataTableAddPanelTriggerProps): react_jsx_runtime.JSX.Element;
70
+
47
71
  type ButtonProps = {
48
72
  isLoading?: boolean;
49
73
  } & ButtonProps$1;
@@ -82,6 +106,8 @@ interface CellActionTransportProps {
82
106
  }
83
107
  declare function CellActionTransport({ onClick, ...rest }: CellActionTransportProps): react_jsx_runtime.JSX.Element;
84
108
 
109
+ declare function DataTableColumnsPanelTrigger(): react_jsx_runtime.JSX.Element;
110
+
85
111
  declare function Content(props: StackProps): react_jsx_runtime.JSX.Element;
86
112
 
87
113
  declare function ExportCsvButton(): react_jsx_runtime.JSX.Element;
@@ -115,6 +141,11 @@ interface ToolbarProps {
115
141
  }
116
142
  declare function Toolbar({ children }: ToolbarProps): react_jsx_runtime.JSX.Element;
117
143
 
144
+ interface ToolbarActionsContainerProps {
145
+ children?: ReactNode;
146
+ }
147
+ declare function ToolbarActionsContainer({ children, }: ToolbarActionsContainerProps): react_jsx_runtime.JSX.Element;
148
+
118
149
  declare const DataTable: {
119
150
  CellActionTransport: typeof CellActionTransport;
120
151
  SelectionCounter: typeof SelectionCounter;
@@ -126,17 +157,19 @@ declare const DataTable: {
126
157
  Pagination: typeof Pagination;
127
158
  Actions: typeof Actions;
128
159
  Toolbar: typeof Toolbar;
160
+ ToolbarActionsContainer: typeof ToolbarActionsContainer;
129
161
  Content: typeof Content;
130
162
  Button: typeof DataTableButton;
131
163
  Footer: typeof Footer;
132
- Table: typeof Table;
164
+ Table: react.ForwardRefExoticComponent<DataTableProps & react.RefAttributes<GridWrapperApi>>;
133
165
  Title: typeof Title;
134
166
  Root: typeof Root;
135
167
  Action: typeof DataTableAction;
136
168
  ActionEdit: typeof DataTableActionEdit;
137
169
  ActionDelete: typeof DataTableActionDelete;
138
170
  ActionTransport: typeof DataTableActionTransport;
139
- ColumnsPanelTrigger: react.ForwardRefExoticComponent<_mui_x_data_grid_pro.ColumnsPanelTriggerProps> | react.ForwardRefExoticComponent<Omit<_mui_x_data_grid_pro.ColumnsPanelTriggerProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
171
+ ColumnsPanelTrigger: typeof DataTableColumnsPanelTrigger;
172
+ AddPanelTrigger: typeof DataTableAddPanelTrigger;
140
173
  useGridApiRef: () => react.MutableRefObject<_mui_x_data_grid_pro.GridApiPro | null>;
141
174
  };
142
175