@redsift/table 11.0.0-alpha.1 → 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 +119 -42
- package/index.js +1348 -921
- package/index.js.map +1 -1
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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, GridFilterModel, GridSortModel, GridSortItem, GridColumnVisibilityModel, 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 React, { ReactNode, ComponentProps, RefObject } from 'react';
|
|
4
|
+
import React, { ReactNode, ComponentProps, MutableRefObject, RefObject } from 'react';
|
|
6
5
|
import { TablePaginationProps } from '@mui/material';
|
|
7
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
|
|
|
@@ -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';
|
|
@@ -157,6 +147,23 @@ type StyledDataGridProps = {
|
|
|
157
147
|
|
|
158
148
|
declare const DataGrid: Comp<DataGridProps, HTMLDivElement>;
|
|
159
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
|
+
|
|
160
167
|
type OperatorValue = string | string[];
|
|
161
168
|
declare const decodeValue: (value: string) => OperatorValue;
|
|
162
169
|
declare const encodeValue: (value: string | undefined) => string;
|
|
@@ -165,10 +172,16 @@ declare const numberOperatorEncoder: Record<string, string>;
|
|
|
165
172
|
declare const numberOperatorDecoder: Record<string, string>;
|
|
166
173
|
declare const isOperatorValueValid: (field: string, operator: OperatorValue, columns: DataGridProps['columns']) => boolean;
|
|
167
174
|
declare const isValueValid: (value: OperatorValue, field: string, columns: DataGridProps['columns'], operator: OperatorValue) => boolean;
|
|
175
|
+
/** FILTERS */
|
|
168
176
|
declare const getFilterModelFromString: (searchString: string, columns: DataGridProps['columns']) => GridFilterModel;
|
|
169
177
|
declare const getSearchParamsFromFilterModel: (filterModel: GridFilterModel) => URLSearchParams;
|
|
170
|
-
|
|
178
|
+
/** SORT */
|
|
179
|
+
declare const getSortingFromString: (searchString: string, columns: DataGridProps['columns']) => GridSortModel | null;
|
|
171
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 */
|
|
172
185
|
declare const getSearchParamsFromColumnVisibility: (columnVisibility: GridColumnVisibilityModel, columns: DataGridProps['columns']) => URLSearchParams;
|
|
173
186
|
declare const getColumnVisibilityFromString: (notParsed: string, tableColumns: DataGridProps['columns']) => GridColumnVisibilityModel | null;
|
|
174
187
|
declare const getPinnedColumnsFromString: (notParsed: string, tableColumns: DataGridProps['columns']) => PinnedColumns | null;
|
|
@@ -177,12 +190,13 @@ declare const getSearchParamsFromTab: (search: string) => URLSearchParams;
|
|
|
177
190
|
type FinalSearchInput = {
|
|
178
191
|
filterModel: GridFilterModel;
|
|
179
192
|
sortModel: GridSortModel;
|
|
193
|
+
paginationModel: ExtendedGridPaginationModel;
|
|
180
194
|
columnsVisibilityModel: GridColumnVisibilityModel;
|
|
181
195
|
pinnedColumnsModel: GridPinnedColumns;
|
|
182
196
|
search: string;
|
|
183
197
|
columns: DataGridProps['columns'];
|
|
184
198
|
};
|
|
185
|
-
declare const getFinalSearch: ({ search, filterModel, sortModel, columnsVisibilityModel, pinnedColumnsModel, columns, }: FinalSearchInput) => URLSearchParams;
|
|
199
|
+
declare const getFinalSearch: ({ search, filterModel, sortModel, paginationModel, columnsVisibilityModel, pinnedColumnsModel, columns, }: FinalSearchInput) => URLSearchParams;
|
|
186
200
|
type PinnedColumns = {
|
|
187
201
|
left: string[];
|
|
188
202
|
right: string[];
|
|
@@ -192,6 +206,8 @@ type ModelsLocalStorage = {
|
|
|
192
206
|
setLocalStorageFilters: (search: string) => void;
|
|
193
207
|
localStorageSorting: string;
|
|
194
208
|
setLocalStorageSorting: (search: string) => void;
|
|
209
|
+
localStoragePagination: string;
|
|
210
|
+
setLocalStoragePagination: (search: string) => void;
|
|
195
211
|
localStorageColumnsVisibility: string;
|
|
196
212
|
setLocalStorageColumnsVisibility: (search: string) => void;
|
|
197
213
|
localStoragePinnedColumns: string;
|
|
@@ -200,6 +216,7 @@ type ModelsLocalStorage = {
|
|
|
200
216
|
type ModelsTable = {
|
|
201
217
|
filterModel: GridFilterModel;
|
|
202
218
|
sortModel: GridSortModel;
|
|
219
|
+
paginationModel: ExtendedGridPaginationModel;
|
|
203
220
|
columnVisibilityModel: GridColumnVisibilityModel;
|
|
204
221
|
pinnedColumnsModel: PinnedColumns;
|
|
205
222
|
};
|
|
@@ -208,12 +225,24 @@ declare const getModelsParsedOrUpdateLocalStorage: (search: string, columns: Dat
|
|
|
208
225
|
type DataGridModel = {
|
|
209
226
|
filterModel: GridFilterModel;
|
|
210
227
|
sortModel: GridSortModel;
|
|
228
|
+
paginationModel: ExtendedGridPaginationModel;
|
|
211
229
|
columnsModel: GridColumnVisibilityModel;
|
|
212
230
|
pinnedColumnsModel: GridPinnedColumns;
|
|
213
231
|
};
|
|
214
|
-
declare const updateUrl: ({ filterModel, sortModel, columnsModel: columnsVisibilityModel, pinnedColumnsModel }: DataGridModel, search: string, historyReplace: (newSearch: string) => void, columns: DataGridProps['columns']) => void;
|
|
232
|
+
declare const updateUrl: ({ filterModel, sortModel, paginationModel, columnsModel: columnsVisibilityModel, pinnedColumnsModel }: DataGridModel, search: string, historyReplace: (newSearch: string) => void, columns: DataGridProps['columns']) => void;
|
|
215
233
|
declare const areFilterModelsEquivalent: (filterModel: GridFilterModel, filterModelToMatch: GridFilterModel) => boolean;
|
|
216
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
|
+
|
|
217
246
|
interface CompletionResponseItem {
|
|
218
247
|
field: string;
|
|
219
248
|
operator: string;
|
|
@@ -260,6 +289,61 @@ declare const DEFAULT_OPERATORS: {
|
|
|
260
289
|
*/
|
|
261
290
|
declare const GridToolbarFilterSemanticField: Comp<GridToolbarFilterSemanticFieldProps, HTMLFormElement>;
|
|
262
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
|
+
|
|
263
347
|
type GridToolbarColumnsProps = Omit<typeof GridToolbarColumnsButton, 'ref'>;
|
|
264
348
|
type GridToolbarDensityProps = Omit<typeof GridToolbarDensitySelector, 'ref'>;
|
|
265
349
|
type GridToolbarFilterSemanticProps = Omit<GridToolbarFilterSemanticFieldProps, 'ref'>;
|
|
@@ -309,30 +393,23 @@ declare global {
|
|
|
309
393
|
/** ------ */
|
|
310
394
|
declare const Toolbar: React.FC<ToolbarProps>;
|
|
311
395
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
shieldVariant?: ShieldVariant;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
/**
|
|
334
|
-
* The Cell component.
|
|
335
|
-
*/
|
|
336
|
-
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>;
|
|
337
414
|
|
|
338
|
-
export { CATEGORIES, CONTAINS_ANY_OF, CONTAINS_ANY_OF_I, Category, CompletionResponse, 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, StyledDataGridProps, TextCell, Toolbar, VISIBILITY_MODEL_KEY, areFilterModelsEquivalent, buildStorageKey, clearPreviousVersionStorage, customColumnTypes, decodeValue, encodeValue, getColumnVisibilityFromString, getCompletion, getFilterModelFromString, getFinalSearch, getGridNumericOperators, getGridStringArrayOperators, getGridStringOperators, getModelsParsedOrUpdateLocalStorage, getPinnedColumnsFromString, getRsNumberColumnType, getRsStringColumnType, getSearchParamsFromColumnVisibility, getSearchParamsFromFilterModel, getSearchParamsFromPinnedColumns, getSearchParamsFromSorting, getSearchParamsFromTab, getSortingFromString, isOperatorValueValid, isValueValid, numberOperatorDecoder, numberOperatorEncoder, operatorList, updateUrl, urlSearchParamsToString };
|
|
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 };
|