@redsift/table 11.0.0-alpha.0 → 11.0.0-alpha.2
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/index.d.ts +200 -40
- package/index.js +7667 -7143
- package/index.js.map +1 -1
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
import * as _mui_x_data_grid_pro from '@mui/x-data-grid-pro';
|
|
2
|
-
import { GridFilterItem, GridCellParams, GridFilterOperator, GridFilterInputValue, GridFilterInputMultipleValue, DataGridProProps, GridPinnedColumns, GridFilterModel, GridToolbarExportProps, GridToolbarFilterButtonProps, GridToolbarColumnsButton, GridToolbarDensitySelector } from '@mui/x-data-grid-pro';
|
|
3
|
-
export * 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';
|
|
4
3
|
export { GridAlignment, GridColDef, GridFilterItem, GridFilterModel, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators } from '@mui/x-data-grid-pro';
|
|
5
|
-
import
|
|
6
|
-
import React, { ReactNode, ComponentProps, RefObject } from 'react';
|
|
4
|
+
import React, { ReactNode, ComponentProps, MutableRefObject, RefObject } from 'react';
|
|
7
5
|
import { TablePaginationProps } from '@mui/material';
|
|
6
|
+
import { Theme, Comp, IconProps, NotificationsColorPalette, ProductColorPalette, ShieldVariant } from '@redsift/design-system';
|
|
7
|
+
import { GridApiPro } from '@mui/x-data-grid-pro/models/gridApiPro';
|
|
8
8
|
|
|
9
9
|
declare const DETAIL_PANEL_TOGGLE_COL_DEF: _mui_x_data_grid_pro.GridColDef<any, any, any>;
|
|
10
10
|
|
|
11
|
+
declare const getRsStringColumnType: () => {
|
|
12
|
+
type: string;
|
|
13
|
+
filterOperators: _mui_x_data_grid_pro.GridFilterOperator<any, string | number | null, any>[];
|
|
14
|
+
};
|
|
15
|
+
declare const getRsNumberColumnType: () => {
|
|
16
|
+
type: string;
|
|
17
|
+
filterOperators: _mui_x_data_grid_pro.GridFilterOperator<any, string | number | null, any>[];
|
|
18
|
+
};
|
|
19
|
+
declare const customColumnTypes: Partial<GridColumnTypesRecord>;
|
|
20
|
+
|
|
11
21
|
declare const IS_BETWEEN: {
|
|
12
22
|
label: string;
|
|
13
23
|
value: string;
|
|
@@ -90,6 +100,22 @@ declare const operatorList: {
|
|
|
90
100
|
|
|
91
101
|
declare function getCompletion(text: string, role: string, openai_api_key: string | undefined, model?: string): Promise<string>;
|
|
92
102
|
|
|
103
|
+
declare const PAGINATION_MODEL_KEY = "paginationModel";
|
|
104
|
+
declare const FILTER_MODEL_KEY = "filterModel";
|
|
105
|
+
declare const SORT_MODEL_KEY = "sortModel";
|
|
106
|
+
declare const VISIBILITY_MODEL_KEY = "visibilityModel";
|
|
107
|
+
declare const PINNED_COLUMNS = "pinnedColumns";
|
|
108
|
+
declare const DIMENSION_MODEL_KEY = "dimension";
|
|
109
|
+
declare const FILTER_SEARCH_KEY = "searchModel";
|
|
110
|
+
declare const CATEGORIES: readonly ["paginationModel", "filterModel", "sortModel", "visibilityModel", "dimension", "searchModel", "pinnedColumns"];
|
|
111
|
+
type Category = (typeof CATEGORIES)[number];
|
|
112
|
+
declare const buildStorageKey: ({ id, version, category }: {
|
|
113
|
+
id: string;
|
|
114
|
+
version: number;
|
|
115
|
+
category: Category;
|
|
116
|
+
}) => `${string}:${number}:paginationModel` | `${string}:${number}:filterModel` | `${string}:${number}:sortModel` | `${string}:${number}:visibilityModel` | `${string}:${number}:pinnedColumns` | `${string}:${number}:dimension` | `${string}:${number}:searchModel`;
|
|
117
|
+
declare const clearPreviousVersionStorage: (id: string, currentVersion: number) => void;
|
|
118
|
+
|
|
93
119
|
interface DataGridProps extends Partial<Pick<DataGridProProps, 'rows'>>, Omit<DataGridProProps, 'rows'> {
|
|
94
120
|
/** License key for MUI Datagrid Pro. */
|
|
95
121
|
license?: string;
|
|
@@ -105,16 +131,6 @@ interface DataGridProps extends Partial<Pick<DataGridProProps, 'rows'>>, Omit<Da
|
|
|
105
131
|
paginationProps?: Omit<TablePaginationProps, 'component' | 'count' | 'page' | 'onPageChange' | 'rowsPerPage' | 'onRowsPerPageChange' | 'rowsPerPageOptions' | 'paginationMode'>;
|
|
106
132
|
/** Theme. */
|
|
107
133
|
theme?: Theme;
|
|
108
|
-
/** If set, the DataGrid configuration will be stored and synced in the URL and the local storage. useRouter prop should be defined. */
|
|
109
|
-
isStateful?: boolean;
|
|
110
|
-
/** Hook returning pathname, search params and a method to update query params. Used in stateful mode only. */
|
|
111
|
-
useRouter?: () => {
|
|
112
|
-
pathname: string;
|
|
113
|
-
search: string;
|
|
114
|
-
historyReplace: (newSearch: string) => void;
|
|
115
|
-
};
|
|
116
|
-
/** Pinned custom columns. */
|
|
117
|
-
pinnedCustomColumns?: Required<GridPinnedColumns>;
|
|
118
134
|
}
|
|
119
135
|
type SelectionStatus = {
|
|
120
136
|
type: 'page' | 'table' | 'other' | 'none';
|
|
@@ -131,6 +147,102 @@ type StyledDataGridProps = {
|
|
|
131
147
|
|
|
132
148
|
declare const DataGrid: Comp<DataGridProps, HTMLDivElement>;
|
|
133
149
|
|
|
150
|
+
interface StatefulDataGridProps extends DataGridProps {
|
|
151
|
+
/** Hook returning pathname, search params and a method to update query params. */
|
|
152
|
+
useRouter: () => {
|
|
153
|
+
pathname: string;
|
|
154
|
+
search: string;
|
|
155
|
+
historyReplace: (newSearch: string) => void;
|
|
156
|
+
};
|
|
157
|
+
/** Pinned custom columns. */
|
|
158
|
+
pinnedCustomColumns?: Required<GridPinnedColumns>;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
declare const StatefulDataGrid: Comp<StatefulDataGridProps, HTMLDivElement>;
|
|
162
|
+
|
|
163
|
+
interface ExtendedGridPaginationModel extends GridPaginationModel {
|
|
164
|
+
direction?: 'next' | 'back';
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
type OperatorValue = string | string[];
|
|
168
|
+
declare const decodeValue: (value: string) => OperatorValue;
|
|
169
|
+
declare const encodeValue: (value: string | undefined) => string;
|
|
170
|
+
declare const urlSearchParamsToString: (searchParams: URLSearchParams) => string;
|
|
171
|
+
declare const numberOperatorEncoder: Record<string, string>;
|
|
172
|
+
declare const numberOperatorDecoder: Record<string, string>;
|
|
173
|
+
declare const isOperatorValueValid: (field: string, operator: OperatorValue, columns: DataGridProps['columns']) => boolean;
|
|
174
|
+
declare const isValueValid: (value: OperatorValue, field: string, columns: DataGridProps['columns'], operator: OperatorValue) => boolean;
|
|
175
|
+
/** FILTERS */
|
|
176
|
+
declare const getFilterModelFromString: (searchString: string, columns: DataGridProps['columns']) => GridFilterModel;
|
|
177
|
+
declare const getSearchParamsFromFilterModel: (filterModel: GridFilterModel) => URLSearchParams;
|
|
178
|
+
/** SORT */
|
|
179
|
+
declare const getSortingFromString: (searchString: string, columns: DataGridProps['columns']) => GridSortModel | null;
|
|
180
|
+
declare const getSearchParamsFromSorting: (sorting: GridSortItem[]) => URLSearchParams;
|
|
181
|
+
/** PAGINATION */
|
|
182
|
+
declare const getPaginationFromString: (searchString: string) => ExtendedGridPaginationModel | null;
|
|
183
|
+
declare const getSearchParamsFromPagination: (pagination: ExtendedGridPaginationModel) => URLSearchParams;
|
|
184
|
+
/** COLUMN VISIBILITY */
|
|
185
|
+
declare const getSearchParamsFromColumnVisibility: (columnVisibility: GridColumnVisibilityModel, columns: DataGridProps['columns']) => URLSearchParams;
|
|
186
|
+
declare const getColumnVisibilityFromString: (notParsed: string, tableColumns: DataGridProps['columns']) => GridColumnVisibilityModel | null;
|
|
187
|
+
declare const getPinnedColumnsFromString: (notParsed: string, tableColumns: DataGridProps['columns']) => PinnedColumns | null;
|
|
188
|
+
declare const getSearchParamsFromPinnedColumns: (pinnedColumns: GridPinnedColumns) => URLSearchParams;
|
|
189
|
+
declare const getSearchParamsFromTab: (search: string) => URLSearchParams;
|
|
190
|
+
type FinalSearchInput = {
|
|
191
|
+
filterModel: GridFilterModel;
|
|
192
|
+
sortModel: GridSortModel;
|
|
193
|
+
paginationModel: ExtendedGridPaginationModel;
|
|
194
|
+
columnsVisibilityModel: GridColumnVisibilityModel;
|
|
195
|
+
pinnedColumnsModel: GridPinnedColumns;
|
|
196
|
+
search: string;
|
|
197
|
+
columns: DataGridProps['columns'];
|
|
198
|
+
};
|
|
199
|
+
declare const getFinalSearch: ({ search, filterModel, sortModel, paginationModel, columnsVisibilityModel, pinnedColumnsModel, columns, }: FinalSearchInput) => URLSearchParams;
|
|
200
|
+
type PinnedColumns = {
|
|
201
|
+
left: string[];
|
|
202
|
+
right: string[];
|
|
203
|
+
};
|
|
204
|
+
type ModelsLocalStorage = {
|
|
205
|
+
localStorageFilters: string;
|
|
206
|
+
setLocalStorageFilters: (search: string) => void;
|
|
207
|
+
localStorageSorting: string;
|
|
208
|
+
setLocalStorageSorting: (search: string) => void;
|
|
209
|
+
localStoragePagination: string;
|
|
210
|
+
setLocalStoragePagination: (search: string) => void;
|
|
211
|
+
localStorageColumnsVisibility: string;
|
|
212
|
+
setLocalStorageColumnsVisibility: (search: string) => void;
|
|
213
|
+
localStoragePinnedColumns: string;
|
|
214
|
+
setLocalStoragePinnedColumns: (search: string) => void;
|
|
215
|
+
};
|
|
216
|
+
type ModelsTable = {
|
|
217
|
+
filterModel: GridFilterModel;
|
|
218
|
+
sortModel: GridSortModel;
|
|
219
|
+
paginationModel: ExtendedGridPaginationModel;
|
|
220
|
+
columnVisibilityModel: GridColumnVisibilityModel;
|
|
221
|
+
pinnedColumnsModel: PinnedColumns;
|
|
222
|
+
};
|
|
223
|
+
/** Return the state of the table given the URL and the local storage state */
|
|
224
|
+
declare const getModelsParsedOrUpdateLocalStorage: (search: string, columns: DataGridProps['columns'], historyReplace: (newSearch: string) => void, localStorage: ModelsLocalStorage) => ModelsTable;
|
|
225
|
+
type DataGridModel = {
|
|
226
|
+
filterModel: GridFilterModel;
|
|
227
|
+
sortModel: GridSortModel;
|
|
228
|
+
paginationModel: ExtendedGridPaginationModel;
|
|
229
|
+
columnsModel: GridColumnVisibilityModel;
|
|
230
|
+
pinnedColumnsModel: GridPinnedColumns;
|
|
231
|
+
};
|
|
232
|
+
declare const updateUrl: ({ filterModel, sortModel, paginationModel, columnsModel: columnsVisibilityModel, pinnedColumnsModel }: DataGridModel, search: string, historyReplace: (newSearch: string) => void, columns: DataGridProps['columns']) => void;
|
|
233
|
+
declare const areFilterModelsEquivalent: (filterModel: GridFilterModel, filterModelToMatch: GridFilterModel) => boolean;
|
|
234
|
+
|
|
235
|
+
declare const BaseButton: React.JSXElementConstructor<any>;
|
|
236
|
+
|
|
237
|
+
declare const BaseCheckbox: React.JSXElementConstructor<any>;
|
|
238
|
+
|
|
239
|
+
declare const muiIconToDSIcon: Partial<Record<keyof GridSlotsComponent, string>>;
|
|
240
|
+
declare const BaseIcon: React.JSXElementConstructor<any>;
|
|
241
|
+
|
|
242
|
+
declare const BasePopper: React.JSXElementConstructor<any>;
|
|
243
|
+
|
|
244
|
+
declare const BaseTextField: React.JSXElementConstructor<any>;
|
|
245
|
+
|
|
134
246
|
interface CompletionResponseItem {
|
|
135
247
|
field: string;
|
|
136
248
|
operator: string;
|
|
@@ -177,6 +289,61 @@ declare const DEFAULT_OPERATORS: {
|
|
|
177
289
|
*/
|
|
178
290
|
declare const GridToolbarFilterSemanticField: Comp<GridToolbarFilterSemanticFieldProps, HTMLFormElement>;
|
|
179
291
|
|
|
292
|
+
type ControlledPaginationProps = {
|
|
293
|
+
displaySelection?: boolean;
|
|
294
|
+
displayRowsPerPage?: boolean;
|
|
295
|
+
displayPagination?: boolean;
|
|
296
|
+
selectionStatus: SelectionStatus;
|
|
297
|
+
apiRef: MutableRefObject<GridApiPro>;
|
|
298
|
+
paginationModel: GridPaginationModel;
|
|
299
|
+
onPaginationModelChange: (model: GridPaginationModel) => void;
|
|
300
|
+
pageSizeOptions?: number[];
|
|
301
|
+
isRowSelectable?: DataGridProps['isRowSelectable'];
|
|
302
|
+
paginationProps?: DataGridProps['paginationProps'];
|
|
303
|
+
};
|
|
304
|
+
declare const ControlledPagination: React.FC<ControlledPaginationProps>;
|
|
305
|
+
|
|
306
|
+
type ServerSideControlledPaginationProps = {
|
|
307
|
+
displaySelection?: boolean;
|
|
308
|
+
displayRowsPerPage?: boolean;
|
|
309
|
+
displayPagination?: boolean;
|
|
310
|
+
selectionStatus: SelectionStatus;
|
|
311
|
+
paginationModel: GridPaginationModel;
|
|
312
|
+
onPaginationModelChange: (model: GridPaginationModel) => void;
|
|
313
|
+
pageSizeOptions?: number[];
|
|
314
|
+
paginationProps?: DataGridProps['paginationProps'];
|
|
315
|
+
rowCount: number;
|
|
316
|
+
loading?: boolean;
|
|
317
|
+
};
|
|
318
|
+
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;
|
|
319
|
+
declare const ServerSideControlledPagination: React.FC<ServerSideControlledPaginationProps>;
|
|
320
|
+
|
|
321
|
+
interface TextCellProps extends ComponentProps<'div'> {
|
|
322
|
+
/** Including Badge Component. */
|
|
323
|
+
badge?: ReactNode;
|
|
324
|
+
/**
|
|
325
|
+
* Can be a string or an array of strings containing `d` property of the `path` SVG element.<br />
|
|
326
|
+
* Can also be a ReactElement.
|
|
327
|
+
*/
|
|
328
|
+
leftIcon?: IconProps['icon'];
|
|
329
|
+
/** Left Icon Color variant. */
|
|
330
|
+
leftIconColor?: NotificationsColorPalette | ProductColorPalette | (string & {});
|
|
331
|
+
/**
|
|
332
|
+
* Can be a string or an array of strings containing `d` property of the `path` SVG element.<br />
|
|
333
|
+
* Can also be a ReactElement.
|
|
334
|
+
*/
|
|
335
|
+
rightIcon?: IconProps['icon'];
|
|
336
|
+
/** Right Icon Color variant. */
|
|
337
|
+
rightIconColor?: NotificationsColorPalette | ProductColorPalette | (string & {});
|
|
338
|
+
/** Shield variant. */
|
|
339
|
+
shieldVariant?: ShieldVariant;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* The Cell component.
|
|
344
|
+
*/
|
|
345
|
+
declare const TextCell: Comp<TextCellProps, HTMLDivElement>;
|
|
346
|
+
|
|
180
347
|
type GridToolbarColumnsProps = Omit<typeof GridToolbarColumnsButton, 'ref'>;
|
|
181
348
|
type GridToolbarDensityProps = Omit<typeof GridToolbarDensitySelector, 'ref'>;
|
|
182
349
|
type GridToolbarFilterSemanticProps = Omit<GridToolbarFilterSemanticFieldProps, 'ref'>;
|
|
@@ -226,30 +393,23 @@ declare global {
|
|
|
226
393
|
/** ------ */
|
|
227
394
|
declare const Toolbar: React.FC<ToolbarProps>;
|
|
228
395
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
shieldVariant?: ShieldVariant;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* The Cell component.
|
|
252
|
-
*/
|
|
253
|
-
declare const TextCell: Comp<TextCellProps, HTMLDivElement>;
|
|
396
|
+
type ToolbarWrapperProps = {
|
|
397
|
+
hideToolbar: DataGridProps['hideToolbar'];
|
|
398
|
+
RenderedToolbar: React.JSXElementConstructor<any>;
|
|
399
|
+
filterModel: DataGridProps['filterModel'];
|
|
400
|
+
onFilterModelChange: DataGridProps['onFilterModelChange'];
|
|
401
|
+
pagination: DataGridProps['pagination'];
|
|
402
|
+
paginationPlacement: DataGridProps['paginationPlacement'];
|
|
403
|
+
selectionStatus: React.MutableRefObject<SelectionStatus>;
|
|
404
|
+
apiRef: DataGridProps['apiRef'];
|
|
405
|
+
isRowSelectable: DataGridProps['isRowSelectable'];
|
|
406
|
+
paginationModel: DataGridProps['paginationModel'];
|
|
407
|
+
onPaginationModelChange: DataGridProps['onPaginationModelChange'];
|
|
408
|
+
pageSizeOptions: DataGridProps['pageSizeOptions'];
|
|
409
|
+
paginationProps: DataGridProps['paginationProps'];
|
|
410
|
+
paginationMode?: DataGridProps['paginationMode'];
|
|
411
|
+
rowCount?: DataGridProps['rowCount'];
|
|
412
|
+
};
|
|
413
|
+
declare const ToolbarWrapper: React.FC<ToolbarWrapperProps>;
|
|
254
414
|
|
|
255
|
-
export { CONTAINS_ANY_OF, CONTAINS_ANY_OF_I, CompletionResponse, DEFAULT_OPERATORS, DETAIL_PANEL_TOGGLE_COL_DEF, DOES_NOT_CONTAIN, DOES_NOT_EQUAL, DataGrid, DataGridProps, ENDS_WITH_ANY_OF, FilterConfig, GridToolbarFilterSemanticField, GridToolbarFilterSemanticFieldProps, IS_ANY_OF, IS_BETWEEN, IS_NOT_ANY_OF, STARTS_WITH_ANY_OF, SelectionStatus, StyledDataGridProps, TextCell, Toolbar, getCompletion, getGridNumericOperators, getGridStringArrayOperators, getGridStringOperators, operatorList };
|
|
415
|
+
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 };
|