@redsift/table 11.0.0-muiv5-alpha.4 → 11.0.0

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 +25 -41
  2. package/index.js +256 -327
  3. package/index.js.map +1 -1
  4. package/package.json +4 -4
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 { 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';
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';
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
- extendType: GridNativeColTypes;
12
+ type: string;
13
13
  filterOperators: _mui_x_data_grid_pro.GridFilterOperator<any, string | number | null, any>[];
14
14
  };
15
15
  declare const getRsNumberColumnType: () => {
16
- extendType: GridNativeColTypes;
16
+ type: string;
17
17
  filterOperators: _mui_x_data_grid_pro.GridFilterOperator<any, string | number | null, any>[];
18
18
  };
19
- declare const customColumnTypes: GridColumnTypesRecord;
19
+ declare const customColumnTypes: Partial<GridColumnTypesRecord>;
20
20
 
21
21
  declare const IS_BETWEEN: {
22
22
  label: string;
23
23
  value: string;
24
- getApplyFilterFn: (filterItem: GridFilterItem) => ((params: GridCellParams) => boolean) | null;
24
+ getApplyFilterFn: (filterItem: GridFilterItem) => ((params: GridCellParams<any, any>) => 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, string | Date, any>[];
94
- dateTime: _mui_x_data_grid_pro.GridFilterOperator<any, string | Date, any>[];
93
+ date: _mui_x_data_grid_pro.GridFilterOperator<any, Date, any>[];
94
+ dateTime: _mui_x_data_grid_pro.GridFilterOperator<any, 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,16 +131,6 @@ 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>;
144
134
  }
145
135
  type SelectionStatus = {
146
136
  type: 'page' | 'table' | 'other' | 'none';
@@ -172,9 +162,7 @@ interface StatefulDataGridProps extends DataGridProps {
172
162
 
173
163
  declare const StatefulDataGrid: Comp<StatefulDataGridProps, HTMLDivElement>;
174
164
 
175
- interface ExtendedGridPaginationModel {
176
- page: number;
177
- pageSize: number;
165
+ interface ExtendedGridPaginationModel extends GridPaginationModel {
178
166
  direction?: 'next' | 'back';
179
167
  }
180
168
 
@@ -184,6 +172,8 @@ declare const encodeValue: (value: string | undefined) => string;
184
172
  declare const urlSearchParamsToString: (searchParams: URLSearchParams) => string;
185
173
  declare const numberOperatorEncoder: Record<string, string>;
186
174
  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;
187
177
  /** FILTERS */
188
178
  declare const getFilterModelFromString: (searchString: string, columns: DataGridProps['columns']) => GridFilterModel;
189
179
  declare const getSearchParamsFromFilterModel: (filterModel: GridFilterModel) => URLSearchParams;
@@ -256,12 +246,12 @@ declare const BasePopper: React.JSXElementConstructor<any>;
256
246
  declare const BaseTextField: React.JSXElementConstructor<any>;
257
247
 
258
248
  interface CompletionResponseItem {
259
- columnField: string;
260
- operatorValue: string;
249
+ field: string;
250
+ operator: string;
261
251
  value?: string;
262
252
  }
263
253
  type CompletionResponse = {
264
- linkOperator: 'and' | 'or';
254
+ logicOperator: 'and' | 'or';
265
255
  items: CompletionResponseItem[];
266
256
  };
267
257
  interface LocaleText {
@@ -307,11 +297,9 @@ type ControlledPaginationProps = {
307
297
  displayPagination?: boolean;
308
298
  selectionStatus: SelectionStatus;
309
299
  apiRef: MutableRefObject<GridApiPro>;
310
- page: number;
311
- onPageChange: (page: number) => void;
312
- pageSize: number;
313
- onPageSizeChange: (pageSize: number) => void;
314
- rowsPerPageOptions?: number[];
300
+ paginationModel: GridPaginationModel;
301
+ onPaginationModelChange: (model: GridPaginationModel) => void;
302
+ pageSizeOptions?: number[];
315
303
  isRowSelectable?: DataGridProps['isRowSelectable'];
316
304
  paginationProps?: DataGridProps['paginationProps'];
317
305
  };
@@ -322,16 +310,14 @@ type ServerSideControlledPaginationProps = {
322
310
  displayRowsPerPage?: boolean;
323
311
  displayPagination?: boolean;
324
312
  selectionStatus: SelectionStatus;
325
- page: number;
326
- onPageChange: (page: number) => void;
327
- pageSize: number;
328
- onPageSizeChange: (pageSize: number) => void;
329
- rowsPerPageOptions?: number[];
313
+ paginationModel: GridPaginationModel;
314
+ onPaginationModelChange: (model: GridPaginationModel) => void;
315
+ pageSizeOptions?: number[];
330
316
  paginationProps?: DataGridProps['paginationProps'];
331
317
  rowCount: number;
332
318
  loading?: boolean;
333
319
  };
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;
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
321
  declare const ServerSideControlledPagination: React.FC<ServerSideControlledPaginationProps>;
336
322
 
337
323
  interface TextCellProps extends ComponentProps<'div'> {
@@ -419,15 +405,13 @@ type ToolbarWrapperProps = {
419
405
  selectionStatus: React.MutableRefObject<SelectionStatus>;
420
406
  apiRef: DataGridProps['apiRef'];
421
407
  isRowSelectable: DataGridProps['isRowSelectable'];
422
- page: DataGridProps['page'];
423
- onPageChange: DataGridProps['onPageChange'];
424
- pageSize: DataGridProps['pageSize'];
425
- onPageSizeChange: DataGridProps['onPageSizeChange'];
426
- rowsPerPageOptions: DataGridProps['rowsPerPageOptions'];
408
+ paginationModel: DataGridProps['paginationModel'];
409
+ onPaginationModelChange: DataGridProps['onPaginationModelChange'];
410
+ pageSizeOptions: DataGridProps['pageSizeOptions'];
427
411
  paginationProps: DataGridProps['paginationProps'];
428
412
  paginationMode?: DataGridProps['paginationMode'];
429
413
  rowCount?: DataGridProps['rowCount'];
430
414
  };
431
415
  declare const ToolbarWrapper: React.FC<ToolbarWrapperProps>;
432
416
 
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 };
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 };