@redsift/table 11.0.1 → 11.0.2-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 +41 -25
  2. package/index.js +331 -253
  3. package/index.js.map +1 -1
  4. package/package.json +6 -6
package/index.d.ts CHANGED
@@ -1,6 +1,6 @@
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
4
  import React, { ReactNode, ComponentProps, MutableRefObject, RefObject } from 'react';
5
5
  import { TablePaginationProps } from '@mui/material';
6
6
  import { Theme, Comp, IconProps, NotificationsColorPalette, ProductColorPalette, ShieldVariant } from '@redsift/design-system';
@@ -9,19 +9,19 @@ import { GridApiPro } from '@mui/x-data-grid-pro/models/gridApiPro';
9
9
  declare const DETAIL_PANEL_TOGGLE_COL_DEF: _mui_x_data_grid_pro.GridColDef<any, any, any>;
10
10
 
11
11
  declare const getRsStringColumnType: () => {
12
- type: string;
12
+ extendType: GridNativeColTypes;
13
13
  filterOperators: _mui_x_data_grid_pro.GridFilterOperator<any, string | number | null, any>[];
14
14
  };
15
15
  declare const getRsNumberColumnType: () => {
16
- type: string;
16
+ extendType: GridNativeColTypes;
17
17
  filterOperators: _mui_x_data_grid_pro.GridFilterOperator<any, string | number | null, any>[];
18
18
  };
19
- declare const customColumnTypes: Partial<GridColumnTypesRecord>;
19
+ declare const customColumnTypes: GridColumnTypesRecord;
20
20
 
21
21
  declare const IS_BETWEEN: {
22
22
  label: string;
23
23
  value: string;
24
- getApplyFilterFn: (filterItem: GridFilterItem) => ((params: GridCellParams<any, any>) => boolean) | null;
24
+ getApplyFilterFn: (filterItem: GridFilterItem) => ((params: GridCellParams) => boolean) | null;
25
25
  InputComponent: (props: any) => JSX.Element;
26
26
  };
27
27
 
@@ -90,8 +90,8 @@ declare const operatorList: {
90
90
  string: _mui_x_data_grid_pro.GridFilterOperator<any, string | number | null, any>[];
91
91
  number: _mui_x_data_grid_pro.GridFilterOperator<any, string | number | null, any>[];
92
92
  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>[];
93
+ date: _mui_x_data_grid_pro.GridFilterOperator<any, string | Date, any>[];
94
+ dateTime: _mui_x_data_grid_pro.GridFilterOperator<any, string | Date, any>[];
95
95
  singleSelect: _mui_x_data_grid_pro.GridFilterOperator<any, any, any>[];
96
96
  rsString: _mui_x_data_grid_pro.GridFilterOperator<any, string | number | null, any>[];
97
97
  rsNumber: _mui_x_data_grid_pro.GridFilterOperator<any, string | number | null, any>[];
@@ -131,6 +131,16 @@ interface DataGridProps extends Partial<Pick<DataGridProProps, 'rows'>>, Omit<Da
131
131
  paginationProps?: Omit<TablePaginationProps, 'component' | 'count' | 'page' | 'onPageChange' | 'rowsPerPage' | 'onRowsPerPageChange' | 'rowsPerPageOptions' | 'paginationMode'>;
132
132
  /** Theme. */
133
133
  theme?: Theme;
134
+ /** If set, the DataGrid configuration will be stored and synced in the URL and the local storage. useRouter prop should be defined. */
135
+ isStateful?: boolean;
136
+ /** Hook returning pathname, search params and a method to update query params. Used in stateful mode only. */
137
+ useRouter?: () => {
138
+ pathname: string;
139
+ search: string;
140
+ historyReplace: (newSearch: string) => void;
141
+ };
142
+ /** Pinned custom columns. */
143
+ pinnedCustomColumns?: Required<GridPinnedColumns>;
134
144
  }
135
145
  type SelectionStatus = {
136
146
  type: 'page' | 'table' | 'other' | 'none';
@@ -162,7 +172,9 @@ interface StatefulDataGridProps extends DataGridProps {
162
172
 
163
173
  declare const StatefulDataGrid: Comp<StatefulDataGridProps, HTMLDivElement>;
164
174
 
165
- interface ExtendedGridPaginationModel extends GridPaginationModel {
175
+ interface ExtendedGridPaginationModel {
176
+ page: number;
177
+ pageSize: number;
166
178
  direction?: 'next' | 'back';
167
179
  }
168
180
 
@@ -172,8 +184,6 @@ declare const encodeValue: (value: string | undefined) => string;
172
184
  declare const urlSearchParamsToString: (searchParams: URLSearchParams) => string;
173
185
  declare const numberOperatorEncoder: Record<string, string>;
174
186
  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
187
  /** FILTERS */
178
188
  declare const getFilterModelFromString: (searchString: string, columns: DataGridProps['columns']) => GridFilterModel;
179
189
  declare const getSearchParamsFromFilterModel: (filterModel: GridFilterModel) => URLSearchParams;
@@ -246,12 +256,12 @@ declare const BasePopper: React.JSXElementConstructor<any>;
246
256
  declare const BaseTextField: React.JSXElementConstructor<any>;
247
257
 
248
258
  interface CompletionResponseItem {
249
- field: string;
250
- operator: string;
259
+ columnField: string;
260
+ operatorValue: string;
251
261
  value?: string;
252
262
  }
253
263
  type CompletionResponse = {
254
- logicOperator: 'and' | 'or';
264
+ linkOperator: 'and' | 'or';
255
265
  items: CompletionResponseItem[];
256
266
  };
257
267
  interface LocaleText {
@@ -297,9 +307,11 @@ type ControlledPaginationProps = {
297
307
  displayPagination?: boolean;
298
308
  selectionStatus: SelectionStatus;
299
309
  apiRef: MutableRefObject<GridApiPro>;
300
- paginationModel: GridPaginationModel;
301
- onPaginationModelChange: (model: GridPaginationModel) => void;
302
- pageSizeOptions?: number[];
310
+ page: number;
311
+ onPageChange: (page: number) => void;
312
+ pageSize: number;
313
+ onPageSizeChange: (pageSize: number) => void;
314
+ rowsPerPageOptions?: number[];
303
315
  isRowSelectable?: DataGridProps['isRowSelectable'];
304
316
  paginationProps?: DataGridProps['paginationProps'];
305
317
  };
@@ -310,14 +322,16 @@ type ServerSideControlledPaginationProps = {
310
322
  displayRowsPerPage?: boolean;
311
323
  displayPagination?: boolean;
312
324
  selectionStatus: SelectionStatus;
313
- paginationModel: GridPaginationModel;
314
- onPaginationModelChange: (model: GridPaginationModel) => void;
315
- pageSizeOptions?: number[];
325
+ page: number;
326
+ onPageChange: (page: number) => void;
327
+ pageSize: number;
328
+ onPageSizeChange: (pageSize: number) => void;
329
+ rowsPerPageOptions?: number[];
316
330
  paginationProps?: DataGridProps['paginationProps'];
317
331
  rowCount: number;
318
332
  loading?: boolean;
319
333
  };
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;
334
+ 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
335
  declare const ServerSideControlledPagination: React.FC<ServerSideControlledPaginationProps>;
322
336
 
323
337
  interface TextCellProps extends ComponentProps<'div'> {
@@ -405,13 +419,15 @@ type ToolbarWrapperProps = {
405
419
  selectionStatus: React.MutableRefObject<SelectionStatus>;
406
420
  apiRef: DataGridProps['apiRef'];
407
421
  isRowSelectable: DataGridProps['isRowSelectable'];
408
- paginationModel: DataGridProps['paginationModel'];
409
- onPaginationModelChange: DataGridProps['onPaginationModelChange'];
410
- pageSizeOptions: DataGridProps['pageSizeOptions'];
422
+ page: DataGridProps['page'];
423
+ onPageChange: DataGridProps['onPageChange'];
424
+ pageSize: DataGridProps['pageSize'];
425
+ onPageSizeChange: DataGridProps['onPageSizeChange'];
426
+ rowsPerPageOptions: DataGridProps['rowsPerPageOptions'];
411
427
  paginationProps: DataGridProps['paginationProps'];
412
428
  paginationMode?: DataGridProps['paginationMode'];
413
429
  rowCount?: DataGridProps['rowCount'];
414
430
  };
415
431
  declare const ToolbarWrapper: React.FC<ToolbarWrapperProps>;
416
432
 
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 };
433
+ 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 };