@redsift/table 11.0.0-muiv5-alpha.1 → 11.0.0-muiv5-alpha.3

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 +127 -31
  2. package/index.js +1457 -996
  3. package/index.js.map +1 -1
  4. package/package.json +2 -2
package/index.d.ts CHANGED
@@ -1,9 +1,10 @@
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, GridToolbarExportProps, GridToolbarFilterButtonProps, GridToolbarColumnsButton, GridToolbarDensitySelector } 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
3
  export { GridAlignment, GridColDef, GridColumns, GridFilterItem, GridFilterModel, GridSelectionModel, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators } from '@mui/x-data-grid-pro';
4
- import React, { ReactNode, ComponentProps, RefObject } from 'react';
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';
7
+ import { GridApiPro } from '@mui/x-data-grid-pro/models/gridApiPro';
7
8
 
8
9
  declare const DETAIL_PANEL_TOGGLE_COL_DEF: _mui_x_data_grid_pro.GridColDef<any, any, any>;
9
10
 
@@ -156,16 +157,28 @@ type StyledDataGridProps = {
156
157
 
157
158
  declare const DataGrid: Comp<DataGridProps, HTMLDivElement>;
158
159
 
160
+ interface ExtendedGridPaginationModel {
161
+ page: number;
162
+ pageSize: number;
163
+ direction?: 'next' | 'back';
164
+ }
165
+
159
166
  type OperatorValue = string | string[];
160
167
  declare const decodeValue: (value: string) => OperatorValue;
161
168
  declare const encodeValue: (value: string | undefined) => string;
162
169
  declare const urlSearchParamsToString: (searchParams: URLSearchParams) => string;
163
170
  declare const numberOperatorEncoder: Record<string, string>;
164
171
  declare const numberOperatorDecoder: Record<string, string>;
172
+ /** FILTERS */
165
173
  declare const getFilterModelFromString: (searchString: string, columns: DataGridProps['columns']) => GridFilterModel;
166
174
  declare const getSearchParamsFromFilterModel: (filterModel: GridFilterModel) => URLSearchParams;
167
- declare const getSortingFromString: (notParsed: string, columns: DataGridProps['columns']) => GridSortModel | null;
175
+ /** SORT */
176
+ declare const getSortingFromString: (searchString: string, columns: DataGridProps['columns']) => GridSortModel | null;
168
177
  declare const getSearchParamsFromSorting: (sorting: GridSortItem[]) => URLSearchParams;
178
+ /** PAGINATION */
179
+ declare const getPaginationFromString: (searchString: string) => ExtendedGridPaginationModel | null;
180
+ declare const getSearchParamsFromPagination: (pagination: ExtendedGridPaginationModel) => URLSearchParams;
181
+ /** COLUMN VISIBILITY */
169
182
  declare const getSearchParamsFromColumnVisibility: (columnVisibility: GridColumnVisibilityModel, columns: DataGridProps['columns']) => URLSearchParams;
170
183
  declare const getColumnVisibilityFromString: (notParsed: string, tableColumns: DataGridProps['columns']) => GridColumnVisibilityModel | null;
171
184
  declare const getPinnedColumnsFromString: (notParsed: string, tableColumns: DataGridProps['columns']) => PinnedColumns | null;
@@ -174,12 +187,13 @@ declare const getSearchParamsFromTab: (search: string) => URLSearchParams;
174
187
  type FinalSearchInput = {
175
188
  filterModel: GridFilterModel;
176
189
  sortModel: GridSortModel;
190
+ paginationModel: ExtendedGridPaginationModel;
177
191
  columnsVisibilityModel: GridColumnVisibilityModel;
178
192
  pinnedColumnsModel: GridPinnedColumns;
179
193
  search: string;
180
194
  columns: DataGridProps['columns'];
181
195
  };
182
- declare const getFinalSearch: ({ search, filterModel, sortModel, columnsVisibilityModel, pinnedColumnsModel, columns, }: FinalSearchInput) => URLSearchParams;
196
+ declare const getFinalSearch: ({ search, filterModel, sortModel, paginationModel, columnsVisibilityModel, pinnedColumnsModel, columns, }: FinalSearchInput) => URLSearchParams;
183
197
  type PinnedColumns = {
184
198
  left: string[];
185
199
  right: string[];
@@ -189,6 +203,8 @@ type ModelsLocalStorage = {
189
203
  setLocalStorageFilters: (search: string) => void;
190
204
  localStorageSorting: string;
191
205
  setLocalStorageSorting: (search: string) => void;
206
+ localStoragePagination: string;
207
+ setLocalStoragePagination: (search: string) => void;
192
208
  localStorageColumnsVisibility: string;
193
209
  setLocalStorageColumnsVisibility: (search: string) => void;
194
210
  localStoragePinnedColumns: string;
@@ -197,6 +213,7 @@ type ModelsLocalStorage = {
197
213
  type ModelsTable = {
198
214
  filterModel: GridFilterModel;
199
215
  sortModel: GridSortModel;
216
+ paginationModel: ExtendedGridPaginationModel;
200
217
  columnVisibilityModel: GridColumnVisibilityModel;
201
218
  pinnedColumnsModel: PinnedColumns;
202
219
  };
@@ -205,12 +222,24 @@ declare const getModelsParsedOrUpdateLocalStorage: (search: string, columns: Dat
205
222
  type DataGridModel = {
206
223
  filterModel: GridFilterModel;
207
224
  sortModel: GridSortModel;
225
+ paginationModel: ExtendedGridPaginationModel;
208
226
  columnsModel: GridColumnVisibilityModel;
209
227
  pinnedColumnsModel: GridPinnedColumns;
210
228
  };
211
- declare const updateUrl: ({ filterModel, sortModel, columnsModel: columnsVisibilityModel, pinnedColumnsModel }: DataGridModel, search: string, historyReplace: (newSearch: string) => void, columns: DataGridProps['columns']) => void;
229
+ declare const updateUrl: ({ filterModel, sortModel, paginationModel, columnsModel: columnsVisibilityModel, pinnedColumnsModel }: DataGridModel, search: string, historyReplace: (newSearch: string) => void, columns: DataGridProps['columns']) => void;
212
230
  declare const areFilterModelsEquivalent: (filterModel: GridFilterModel, filterModelToMatch: GridFilterModel) => boolean;
213
231
 
232
+ declare const BaseButton: React.JSXElementConstructor<any>;
233
+
234
+ declare const BaseCheckbox: React.JSXElementConstructor<any>;
235
+
236
+ declare const muiIconToDSIcon: Partial<Record<keyof GridSlotsComponent, string>>;
237
+ declare const BaseIcon: React.JSXElementConstructor<any>;
238
+
239
+ declare const BasePopper: React.JSXElementConstructor<any>;
240
+
241
+ declare const BaseTextField: React.JSXElementConstructor<any>;
242
+
214
243
  interface CompletionResponseItem {
215
244
  columnField: string;
216
245
  operatorValue: string;
@@ -257,6 +286,78 @@ declare const DEFAULT_OPERATORS: {
257
286
  */
258
287
  declare const GridToolbarFilterSemanticField: Comp<GridToolbarFilterSemanticFieldProps, HTMLFormElement>;
259
288
 
289
+ type ControlledPaginationProps = {
290
+ displaySelection?: boolean;
291
+ displayRowsPerPage?: boolean;
292
+ displayPagination?: boolean;
293
+ selectionStatus: SelectionStatus;
294
+ apiRef: MutableRefObject<GridApiPro>;
295
+ page: number;
296
+ onPageChange: (page: number) => void;
297
+ pageSize: number;
298
+ onPageSizeChange: (pageSize: number) => void;
299
+ rowsPerPageOptions?: number[];
300
+ isRowSelectable?: DataGridProps['isRowSelectable'];
301
+ paginationProps?: DataGridProps['paginationProps'];
302
+ };
303
+ declare const ControlledPagination: React.FC<ControlledPaginationProps>;
304
+
305
+ type ServerSideControlledPaginationProps = {
306
+ displaySelection?: boolean;
307
+ displayRowsPerPage?: boolean;
308
+ displayPagination?: boolean;
309
+ selectionStatus: SelectionStatus;
310
+ page: number;
311
+ onPageChange: (page: number) => void;
312
+ pageSize: number;
313
+ onPageSizeChange: (pageSize: number) => void;
314
+ rowsPerPageOptions?: number[];
315
+ paginationProps?: DataGridProps['paginationProps'];
316
+ rowCount: number;
317
+ loading?: boolean;
318
+ };
319
+ 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 ServerSideControlledPagination: React.FC<ServerSideControlledPaginationProps>;
321
+
322
+ interface StatefulDataGridProps extends DataGridProps {
323
+ /** Hook returning pathname, search params and a method to update query params. */
324
+ useRouter: () => {
325
+ pathname: string;
326
+ search: string;
327
+ historyReplace: (newSearch: string) => void;
328
+ };
329
+ /** Pinned custom columns. */
330
+ pinnedCustomColumns?: Required<GridPinnedColumns>;
331
+ }
332
+
333
+ declare const StatefulDataGrid: Comp<StatefulDataGridProps, HTMLDivElement>;
334
+
335
+ interface TextCellProps extends ComponentProps<'div'> {
336
+ /** Including Badge Component. */
337
+ badge?: ReactNode;
338
+ /**
339
+ * Can be a string or an array of strings containing `d` property of the `path` SVG element.<br />
340
+ * Can also be a ReactElement.
341
+ */
342
+ leftIcon?: IconProps['icon'];
343
+ /** Left Icon Color variant. */
344
+ leftIconColor?: NotificationsColorPalette | ProductColorPalette | (string & {});
345
+ /**
346
+ * Can be a string or an array of strings containing `d` property of the `path` SVG element.<br />
347
+ * Can also be a ReactElement.
348
+ */
349
+ rightIcon?: IconProps['icon'];
350
+ /** Right Icon Color variant. */
351
+ rightIconColor?: NotificationsColorPalette | ProductColorPalette | (string & {});
352
+ /** Shield variant. */
353
+ shieldVariant?: ShieldVariant;
354
+ }
355
+
356
+ /**
357
+ * The Cell component.
358
+ */
359
+ declare const TextCell: Comp<TextCellProps, HTMLDivElement>;
360
+
260
361
  type GridToolbarColumnsProps = Omit<typeof GridToolbarColumnsButton, 'ref'>;
261
362
  type GridToolbarDensityProps = Omit<typeof GridToolbarDensitySelector, 'ref'>;
262
363
  type GridToolbarFilterSemanticProps = Omit<GridToolbarFilterSemanticFieldProps, 'ref'>;
@@ -306,30 +407,25 @@ declare global {
306
407
  /** ------ */
307
408
  declare const Toolbar: React.FC<ToolbarProps>;
308
409
 
309
- interface TextCellProps extends ComponentProps<'div'> {
310
- /** Including Badge Component. */
311
- badge?: ReactNode;
312
- /**
313
- * Can be a string or an array of strings containing `d` property of the `path` SVG element.<br />
314
- * Can also be a ReactElement.
315
- */
316
- leftIcon?: IconProps['icon'];
317
- /** Left Icon Color variant. */
318
- leftIconColor?: NotificationsColorPalette | ProductColorPalette | (string & {});
319
- /**
320
- * Can be a string or an array of strings containing `d` property of the `path` SVG element.<br />
321
- * Can also be a ReactElement.
322
- */
323
- rightIcon?: IconProps['icon'];
324
- /** Right Icon Color variant. */
325
- rightIconColor?: NotificationsColorPalette | ProductColorPalette | (string & {});
326
- /** Shield variant. */
327
- shieldVariant?: ShieldVariant;
328
- }
329
-
330
- /**
331
- * The Cell component.
332
- */
333
- declare const TextCell: Comp<TextCellProps, HTMLDivElement>;
410
+ type ToolbarWrapperProps = {
411
+ hideToolbar: DataGridProps['hideToolbar'];
412
+ RenderedToolbar: React.JSXElementConstructor<any>;
413
+ filterModel: DataGridProps['filterModel'];
414
+ onFilterModelChange: DataGridProps['onFilterModelChange'];
415
+ pagination: DataGridProps['pagination'];
416
+ paginationPlacement: DataGridProps['paginationPlacement'];
417
+ selectionStatus: React.MutableRefObject<SelectionStatus>;
418
+ apiRef: DataGridProps['apiRef'];
419
+ isRowSelectable: DataGridProps['isRowSelectable'];
420
+ page: DataGridProps['page'];
421
+ onPageChange: DataGridProps['onPageChange'];
422
+ pageSize: DataGridProps['pageSize'];
423
+ onPageSizeChange: DataGridProps['onPageSizeChange'];
424
+ rowsPerPageOptions: DataGridProps['rowsPerPageOptions'];
425
+ paginationProps: DataGridProps['paginationProps'];
426
+ paginationMode?: DataGridProps['paginationMode'];
427
+ rowCount?: DataGridProps['rowCount'];
428
+ };
429
+ declare const ToolbarWrapper: React.FC<ToolbarWrapperProps>;
334
430
 
335
- 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, numberOperatorDecoder, numberOperatorEncoder, operatorList, updateUrl, urlSearchParamsToString };
431
+ 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 };