@redsift/table 11.1.3 → 11.2.0-muiv5

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.
Files changed (4) hide show
  1. package/index.d.ts +43 -26
  2. package/index.js +3586 -2107
  3. package/index.js.map +1 -1
  4. package/package.json +6 -6
package/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as _mui_x_data_grid_pro from '@mui/x-data-grid-pro';
2
- import { GridColumnTypesRecord, GridFilterItem, GridCellParams, GridFilterOperator, GridFilterInputValue, GridFilterInputMultipleValue, DataGridProProps, GridPinnedColumns, GridPaginationModel, GridFilterModel, GridSortModel, GridSortItem, GridColumnVisibilityModel, GridSlotsComponent, GridRowSelectionModel, GridApiPro as GridApiPro$1, GridRowParams, GridToolbarExportProps, GridToolbarFilterButtonProps, GridToolbarColumnsButton, GridToolbarDensitySelector } from '@mui/x-data-grid-pro';
3
- export { GridAlignment, GridColDef, GridFilterItem, GridFilterModel, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators } from '@mui/x-data-grid-pro';
2
+ import { GridNativeColTypes, GridColumnTypesRecord, GridFilterItem, GridCellParams, GridFilterOperator, GridFilterInputValue, GridFilterInputMultipleValue, DataGridProProps, GridPinnedColumns, GridFilterModel, GridSortModel, GridSortItem, GridColumnVisibilityModel, GridSlotsComponent, GridSelectionModel, GridRowParams, GridToolbarExportProps, GridToolbarFilterButtonProps, GridToolbarColumnsButton, GridToolbarDensitySelector } from '@mui/x-data-grid-pro';
3
+ export { GridAlignment, GridColDef, GridColumns, GridFilterItem, GridFilterModel, GridSelectionModel, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators } from '@mui/x-data-grid-pro';
4
+ import { GridInitialStatePro } from '@mui/x-data-grid-pro/models/gridStatePro';
4
5
  import React, { ReactNode, ComponentProps, MutableRefObject, RefObject } from 'react';
5
6
  import { TablePaginationProps } from '@mui/material';
6
7
  import { Theme, Comp, IconProps, NotificationsColorPalette, ProductColorPalette, ShieldVariant } from '@redsift/design-system';
@@ -9,19 +10,19 @@ import { GridApiPro } from '@mui/x-data-grid-pro/models/gridApiPro';
9
10
  declare const DETAIL_PANEL_TOGGLE_COL_DEF: _mui_x_data_grid_pro.GridColDef<any, any, any>;
10
11
 
11
12
  declare const getRsStringColumnType: () => {
12
- type: string;
13
+ extendType: GridNativeColTypes;
13
14
  filterOperators: _mui_x_data_grid_pro.GridFilterOperator<any, string | number | null, any>[];
14
15
  };
15
16
  declare const getRsNumberColumnType: () => {
16
- type: string;
17
+ extendType: GridNativeColTypes;
17
18
  filterOperators: _mui_x_data_grid_pro.GridFilterOperator<any, string | number | null, any>[];
18
19
  };
19
- declare const customColumnTypes: Partial<GridColumnTypesRecord>;
20
+ declare const customColumnTypes: GridColumnTypesRecord;
20
21
 
21
22
  declare const IS_BETWEEN: {
22
23
  label: string;
23
24
  value: string;
24
- getApplyFilterFn: (filterItem: GridFilterItem) => ((params: GridCellParams<any, any>) => boolean) | null;
25
+ getApplyFilterFn: (filterItem: GridFilterItem) => ((params: GridCellParams) => boolean) | null;
25
26
  InputComponent: (props: any) => JSX.Element;
26
27
  };
27
28
 
@@ -90,8 +91,8 @@ declare const operatorList: {
90
91
  string: _mui_x_data_grid_pro.GridFilterOperator<any, string | number | null, any>[];
91
92
  number: _mui_x_data_grid_pro.GridFilterOperator<any, string | number | null, any>[];
92
93
  boolean: _mui_x_data_grid_pro.GridFilterOperator<any, boolean | null, any>[];
93
- date: _mui_x_data_grid_pro.GridFilterOperator<any, Date, any>[];
94
- dateTime: _mui_x_data_grid_pro.GridFilterOperator<any, Date, any>[];
94
+ date: _mui_x_data_grid_pro.GridFilterOperator<any, string | Date, any>[];
95
+ dateTime: _mui_x_data_grid_pro.GridFilterOperator<any, string | Date, any>[];
95
96
  singleSelect: _mui_x_data_grid_pro.GridFilterOperator<any, any, any>[];
96
97
  rsString: _mui_x_data_grid_pro.GridFilterOperator<any, string | number | null, any>[];
97
98
  rsNumber: _mui_x_data_grid_pro.GridFilterOperator<any, string | number | null, any>[];
@@ -131,6 +132,16 @@ interface DataGridProps extends Partial<Pick<DataGridProProps, 'rows'>>, Omit<Da
131
132
  paginationProps?: Omit<TablePaginationProps, 'component' | 'count' | 'page' | 'onPageChange' | 'rowsPerPage' | 'onRowsPerPageChange' | 'rowsPerPageOptions' | 'paginationMode'>;
132
133
  /** Theme. */
133
134
  theme?: Theme;
135
+ /** If set, the DataGrid configuration will be stored and synced in the URL and the local storage. useRouter prop should be defined. */
136
+ isStateful?: boolean;
137
+ /** Hook returning pathname, search params and a method to update query params. Used in stateful mode only. */
138
+ useRouter?: () => {
139
+ pathname: string;
140
+ search: string;
141
+ historyReplace: (newSearch: string) => void;
142
+ };
143
+ /** Pinned custom columns. */
144
+ pinnedCustomColumns?: Required<GridPinnedColumns>;
134
145
  }
135
146
  type SelectionStatus = {
136
147
  type: 'page' | 'table' | 'other' | 'none';
@@ -162,7 +173,9 @@ interface StatefulDataGridProps extends DataGridProps {
162
173
 
163
174
  declare const StatefulDataGrid: Comp<StatefulDataGridProps, HTMLDivElement>;
164
175
 
165
- interface ExtendedGridPaginationModel extends GridPaginationModel {
176
+ interface ExtendedGridPaginationModel {
177
+ page: number;
178
+ pageSize: number;
166
179
  direction?: 'next' | 'back';
167
180
  }
168
181
 
@@ -172,8 +185,6 @@ declare const encodeValue: (value: string | undefined) => string;
172
185
  declare const urlSearchParamsToString: (searchParams: URLSearchParams) => string;
173
186
  declare const numberOperatorEncoder: Record<string, string>;
174
187
  declare const numberOperatorDecoder: Record<string, string>;
175
- declare const isOperatorValueValid: (field: string, operator: OperatorValue, columns: DataGridProps['columns']) => boolean;
176
- declare const isValueValid: (value: OperatorValue, field: string, columns: DataGridProps['columns'], operator: OperatorValue) => boolean;
177
188
  /** FILTERS */
178
189
  declare const getFilterModelFromString: (searchString: string, columns: DataGridProps['columns']) => GridFilterModel | 'invalid';
179
190
  declare const getSearchParamsFromFilterModel: (filterModel: GridFilterModel) => URLSearchParams;
@@ -223,7 +234,7 @@ type ModelsTable = {
223
234
  pinnedColumnsModel: PinnedColumns;
224
235
  };
225
236
  /** Return the state of the table given the URL and the local storage state */
226
- declare const getModelsParsedOrUpdateLocalStorage: (search: string, columns: DataGridProps['columns'], historyReplace: (newSearch: string) => void, localStorage: ModelsLocalStorage) => ModelsTable;
237
+ declare const getModelsParsedOrUpdateLocalStorage: (search: string, columns: DataGridProps['columns'], historyReplace: (newSearch: string) => void, initialState: GridInitialStatePro | undefined, localStorage: ModelsLocalStorage) => ModelsTable;
227
238
  type DataGridModel = {
228
239
  filterModel: GridFilterModel;
229
240
  sortModel: GridSortModel;
@@ -246,12 +257,12 @@ declare const BasePopper: React.JSXElementConstructor<any>;
246
257
  declare const BaseTextField: React.JSXElementConstructor<any>;
247
258
 
248
259
  interface CompletionResponseItem {
249
- field: string;
250
- operator: string;
260
+ columnField: string;
261
+ operatorValue: string;
251
262
  value?: string;
252
263
  }
253
264
  type CompletionResponse = {
254
- logicOperator: 'and' | 'or';
265
+ linkOperator: 'and' | 'or';
255
266
  items: CompletionResponseItem[];
256
267
  };
257
268
  interface LocaleText {
@@ -297,9 +308,11 @@ type ControlledPaginationProps = {
297
308
  displayPagination?: boolean;
298
309
  selectionStatus: SelectionStatus;
299
310
  apiRef: MutableRefObject<GridApiPro>;
300
- paginationModel: GridPaginationModel;
301
- onPaginationModelChange: (model: GridPaginationModel) => void;
302
- pageSizeOptions?: number[];
311
+ page: number;
312
+ onPageChange: (page: number) => void;
313
+ pageSize: number;
314
+ onPageSizeChange: (pageSize: number) => void;
315
+ rowsPerPageOptions?: number[];
303
316
  isRowSelectable?: DataGridProps['isRowSelectable'];
304
317
  paginationProps?: DataGridProps['paginationProps'];
305
318
  };
@@ -310,14 +323,16 @@ type ServerSideControlledPaginationProps = {
310
323
  displayRowsPerPage?: boolean;
311
324
  displayPagination?: boolean;
312
325
  selectionStatus: SelectionStatus;
313
- paginationModel: GridPaginationModel;
314
- onPaginationModelChange: (model: GridPaginationModel) => void;
315
- pageSizeOptions?: number[];
326
+ page: number;
327
+ onPageChange: (page: number) => void;
328
+ pageSize: number;
329
+ onPageSizeChange: (pageSize: number) => void;
330
+ rowsPerPageOptions?: number[];
316
331
  paginationProps?: DataGridProps['paginationProps'];
317
332
  rowCount: number;
318
333
  loading?: boolean;
319
334
  };
320
- declare const onServerSideSelectionStatusChange: (newSelectionModel: GridRowSelectionModel, apiRef: React.MutableRefObject<GridApiPro$1>, selectionStatus: React.MutableRefObject<SelectionStatus>, isRowSelectable: ((params: GridRowParams<any>) => boolean) | undefined, page: number, pageSize: number) => void;
335
+ declare const onServerSideSelectionStatusChange: (newSelectionModel: GridSelectionModel, apiRef: React.MutableRefObject<GridApiPro>, selectionStatus: React.MutableRefObject<SelectionStatus>, isRowSelectable: ((params: GridRowParams<any>) => boolean) | undefined, page: number, pageSize: number) => void;
321
336
  declare const ServerSideControlledPagination: React.FC<ServerSideControlledPaginationProps>;
322
337
 
323
338
  interface TextCellProps extends ComponentProps<'div'> {
@@ -405,13 +420,15 @@ type ToolbarWrapperProps = {
405
420
  selectionStatus: React.MutableRefObject<SelectionStatus>;
406
421
  apiRef: DataGridProps['apiRef'];
407
422
  isRowSelectable: DataGridProps['isRowSelectable'];
408
- paginationModel: DataGridProps['paginationModel'];
409
- onPaginationModelChange: DataGridProps['onPaginationModelChange'];
410
- pageSizeOptions: DataGridProps['pageSizeOptions'];
423
+ page: DataGridProps['page'];
424
+ onPageChange: DataGridProps['onPageChange'];
425
+ pageSize: DataGridProps['pageSize'];
426
+ onPageSizeChange: DataGridProps['onPageSizeChange'];
427
+ rowsPerPageOptions: DataGridProps['rowsPerPageOptions'];
411
428
  paginationProps: DataGridProps['paginationProps'];
412
429
  paginationMode?: DataGridProps['paginationMode'];
413
430
  rowCount?: DataGridProps['rowCount'];
414
431
  };
415
432
  declare const ToolbarWrapper: React.FC<ToolbarWrapperProps>;
416
433
 
417
- export { BaseButton, BaseCheckbox, BaseIcon, BasePopper, BaseTextField, CATEGORIES, CONTAINS_ANY_OF, CONTAINS_ANY_OF_I, Category, CompletionResponse, ControlledPagination, ControlledPaginationProps, DEFAULT_OPERATORS, DETAIL_PANEL_TOGGLE_COL_DEF, DIMENSION_MODEL_KEY, DOES_NOT_CONTAIN, DOES_NOT_EQUAL, DataGrid, DataGridModel, DataGridProps, ENDS_WITH_ANY_OF, FILTER_MODEL_KEY, FILTER_SEARCH_KEY, FilterConfig, GridToolbarFilterSemanticField, GridToolbarFilterSemanticFieldProps, IS_ANY_OF, IS_BETWEEN, IS_NOT_ANY_OF, PAGINATION_MODEL_KEY, PINNED_COLUMNS, PinnedColumns, SORT_MODEL_KEY, STARTS_WITH_ANY_OF, SelectionStatus, ServerSideControlledPagination, ServerSideControlledPaginationProps, StatefulDataGrid, StatefulDataGridProps, StyledDataGridProps, TextCell, Toolbar, ToolbarWrapper, ToolbarWrapperProps, VISIBILITY_MODEL_KEY, areFilterModelsEquivalent, buildStorageKey, clearPreviousVersionStorage, customColumnTypes, decodeValue, encodeValue, getColumnVisibilityFromString, getCompletion, getFilterModelFromString, getFinalSearch, getGridNumericOperators, getGridStringArrayOperators, getGridStringOperators, getModelsParsedOrUpdateLocalStorage, getPaginationFromString, getPinnedColumnsFromString, getRsNumberColumnType, getRsStringColumnType, getSearchParamsFromColumnVisibility, getSearchParamsFromFilterModel, getSearchParamsFromPagination, getSearchParamsFromPinnedColumns, getSearchParamsFromSorting, getSearchParamsFromTab, getSortingFromString, isOperatorValueValid, isValueValid, muiIconToDSIcon, numberOperatorDecoder, numberOperatorEncoder, onServerSideSelectionStatusChange, operatorList, updateUrl, urlSearchParamsToString };
434
+ export { BaseButton, BaseCheckbox, BaseIcon, BasePopper, BaseTextField, CATEGORIES, CONTAINS_ANY_OF, CONTAINS_ANY_OF_I, Category, CompletionResponse, ControlledPagination, ControlledPaginationProps, DEFAULT_OPERATORS, DETAIL_PANEL_TOGGLE_COL_DEF, DIMENSION_MODEL_KEY, DOES_NOT_CONTAIN, DOES_NOT_EQUAL, DataGrid, DataGridModel, DataGridProps, ENDS_WITH_ANY_OF, FILTER_MODEL_KEY, FILTER_SEARCH_KEY, FilterConfig, GridToolbarFilterSemanticField, GridToolbarFilterSemanticFieldProps, IS_ANY_OF, IS_BETWEEN, IS_NOT_ANY_OF, PAGINATION_MODEL_KEY, PINNED_COLUMNS, PinnedColumns, SORT_MODEL_KEY, STARTS_WITH_ANY_OF, SelectionStatus, ServerSideControlledPagination, ServerSideControlledPaginationProps, StatefulDataGrid, StatefulDataGridProps, StyledDataGridProps, TextCell, Toolbar, ToolbarWrapper, ToolbarWrapperProps, VISIBILITY_MODEL_KEY, areFilterModelsEquivalent, buildStorageKey, clearPreviousVersionStorage, customColumnTypes, decodeValue, encodeValue, getColumnVisibilityFromString, getCompletion, getFilterModelFromString, getFinalSearch, getGridNumericOperators, getGridStringArrayOperators, getGridStringOperators, getModelsParsedOrUpdateLocalStorage, getPaginationFromString, getPinnedColumnsFromString, getRsNumberColumnType, getRsStringColumnType, getSearchParamsFromColumnVisibility, getSearchParamsFromFilterModel, getSearchParamsFromPagination, getSearchParamsFromPinnedColumns, getSearchParamsFromSorting, getSearchParamsFromTab, getSortingFromString, muiIconToDSIcon, numberOperatorDecoder, numberOperatorEncoder, onServerSideSelectionStatusChange, operatorList, updateUrl, urlSearchParamsToString };