@redsift/table 11.2.2-patch.0 → 11.3.0-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 +38 -29
  2. package/index.js +451 -356
  3. package/index.js.map +1 -1
  4. package/package.json +6 -6
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { GRID_DETAIL_PANEL_TOGGLE_COL_DEF, getGridNumericOperators as getGridNumericOperators$1, GridFilterInputValue, GridFilterInputMultipleValue, getGridStringOperators as getGridStringOperators$1, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators, GridLogicOperator, GridToolbarContainer, GridToolbarFilterButton, GridToolbarColumnsButton, GridToolbarDensitySelector, GridToolbarExport, gridExpandedSortedRowIdsSelector, gridPaginatedVisibleSortedGridRowEntriesSelector, gridPaginatedVisibleSortedGridRowIdsSelector, gridFilteredSortedRowEntriesSelector, gridFilteredSortedRowIdsSelector, useGridApiRef, DataGridPro } from '@mui/x-data-grid-pro';
1
+ import { GRID_DETAIL_PANEL_TOGGLE_COL_DEF, getGridNumericOperators as getGridNumericOperators$1, GridFilterInputValue, GridFilterInputMultipleValue, getGridStringOperators as getGridStringOperators$1, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators, GridLinkOperator, GridToolbarContainer, GridToolbarFilterButton, GridToolbarColumnsButton, GridToolbarDensitySelector, GridToolbarExport, gridVisibleSortedRowIdsSelector, gridPaginatedVisibleSortedGridRowEntriesSelector, gridPaginatedVisibleSortedGridRowIdsSelector, gridFilteredSortedRowEntriesSelector, gridFilteredSortedRowIdsSelector, useGridApiRef, DataGridPro } from '@mui/x-data-grid-pro';
2
2
  export { getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators } from '@mui/x-data-grid-pro';
3
3
  import * as React from 'react';
4
4
  import React__default, { Children, isValidElement, cloneElement, forwardRef, useLayoutEffect, useEffect, useRef, useContext, useState, useCallback, createElement, useMemo } from 'react';
@@ -17639,7 +17639,7 @@ const isBetweenOperator = {
17639
17639
  label: 'is between',
17640
17640
  value: 'isBetween',
17641
17641
  getApplyFilterFn: filterItem => {
17642
- if (!filterItem.field || !filterItem.value || !filterItem.operator) {
17642
+ if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17643
17643
  return null;
17644
17644
  }
17645
17645
  if (!Array.isArray(filterItem.value) || filterItem.value.length !== 2) {
@@ -17652,7 +17652,7 @@ const isBetweenOperator = {
17652
17652
  return null;
17653
17653
  }
17654
17654
  return params => {
17655
- return params.value !== null && params.value !== undefined && filterItem.value[0] <= params.value && params.value <= filterItem.value[1];
17655
+ return params.value !== null && filterItem.value[0] <= params.value && params.value <= filterItem.value[1];
17656
17656
  };
17657
17657
  },
17658
17658
  InputComponent: InputNumberInterval
@@ -17665,7 +17665,7 @@ const doesNotEqual = {
17665
17665
  label: 'does not equal',
17666
17666
  value: 'doesNotEqual',
17667
17667
  getApplyFilterFn: filterItem => {
17668
- if (!filterItem.field || !filterItem.value || !filterItem.value) {
17668
+ if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17669
17669
  return null;
17670
17670
  }
17671
17671
  return params => {
@@ -17686,7 +17686,7 @@ const doesNotContain = {
17686
17686
  label: 'does not contain',
17687
17687
  value: 'doesNotContain',
17688
17688
  getApplyFilterFn: filterItem => {
17689
- if (!filterItem.field || !filterItem.value || !filterItem.operator) {
17689
+ if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17690
17690
  return null;
17691
17691
  }
17692
17692
  return params => {
@@ -17707,7 +17707,7 @@ const containsAnyOfOperator = {
17707
17707
  label: 'contains any of',
17708
17708
  value: 'containsAnyOf',
17709
17709
  getApplyFilterFn: filterItem => {
17710
- if (!filterItem.field || !filterItem.value || !filterItem.operator) {
17710
+ if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17711
17711
  return null;
17712
17712
  }
17713
17713
  return params => {
@@ -17730,7 +17730,7 @@ const containsAnyOfCIOperator = {
17730
17730
  label: 'contains any of (case insensitive)',
17731
17731
  value: 'containsAnyOf',
17732
17732
  getApplyFilterFn: filterItem => {
17733
- if (!filterItem.field || !filterItem.value || !filterItem.operator) {
17733
+ if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17734
17734
  return null;
17735
17735
  }
17736
17736
  return params => {
@@ -17757,7 +17757,7 @@ const endsWithAnyOfOperator = {
17757
17757
  label: 'ends with any of',
17758
17758
  value: 'endsWithAnyOf',
17759
17759
  getApplyFilterFn: filterItem => {
17760
- if (!filterItem.field || !filterItem.value || !filterItem.operator) {
17760
+ if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17761
17761
  return null;
17762
17762
  }
17763
17763
  return params => {
@@ -17784,7 +17784,7 @@ const isAnyOfOperator = {
17784
17784
  label: 'is any of',
17785
17785
  value: 'isAnyOf',
17786
17786
  getApplyFilterFn: filterItem => {
17787
- if (!filterItem.field || !filterItem.value || !filterItem.operator) {
17787
+ if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17788
17788
  return null;
17789
17789
  }
17790
17790
  return params => {
@@ -17808,7 +17808,7 @@ const isNotAnyOfOperator = {
17808
17808
  label: 'is not any of',
17809
17809
  value: 'isNotAnyOf',
17810
17810
  getApplyFilterFn: filterItem => {
17811
- if (!filterItem.field || !filterItem.value || !filterItem.operator) {
17811
+ if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17812
17812
  return null;
17813
17813
  }
17814
17814
  return params => {
@@ -17832,7 +17832,7 @@ const startsWithAnyOfOperator = {
17832
17832
  label: 'starts with any of',
17833
17833
  value: 'startsWithAnyOf',
17834
17834
  getApplyFilterFn: filterItem => {
17835
- if (!filterItem.field || !filterItem.value || !filterItem.operator) {
17835
+ if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17836
17836
  return null;
17837
17837
  }
17838
17838
  return params => {
@@ -17877,13 +17877,13 @@ const operatorList = {
17877
17877
 
17878
17878
  const getRsStringColumnType = () => {
17879
17879
  return {
17880
- type: 'string',
17880
+ extendType: 'string',
17881
17881
  filterOperators: operatorList.rsString
17882
17882
  };
17883
17883
  };
17884
17884
  const getRsNumberColumnType = () => {
17885
17885
  return {
17886
- type: 'number',
17886
+ extendType: 'number',
17887
17887
  filterOperators: operatorList.rsNumber
17888
17888
  };
17889
17889
  };
@@ -17894,7 +17894,7 @@ const customColumnTypes = {
17894
17894
 
17895
17895
  const API_URL = 'https://api.openai.com/v1/chat/completions';
17896
17896
  async function getCompletion(text, role, openai_api_key) {
17897
- let model = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'gpt-3.5-turbo-1106';
17897
+ let model = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'gpt-3.5-turbo-0613';
17898
17898
  try {
17899
17899
  const messages = [{
17900
17900
  role: 'system',
@@ -17939,45 +17939,43 @@ const buildStorageKey = _ref => {
17939
17939
  } = _ref;
17940
17940
  return `${id}:${version}:${category}`;
17941
17941
  };
17942
- const clearPreviousVersionStorage = (id, currentVersion) => {
17943
- const previousVersion = currentVersion - 1;
17944
- if (previousVersion < 1) {
17945
- return;
17946
- }
17947
- const keysToDelete = [buildStorageKey({
17948
- id,
17949
- version: previousVersion,
17950
- category: PAGINATION_MODEL_KEY
17951
- }), buildStorageKey({
17952
- id,
17953
- version: previousVersion,
17954
- category: SORT_MODEL_KEY
17955
- }), buildStorageKey({
17956
- id,
17957
- version: previousVersion,
17958
- category: FILTER_MODEL_KEY
17959
- }), buildStorageKey({
17960
- id,
17961
- version: previousVersion,
17962
- category: VISIBILITY_MODEL_KEY
17963
- }), buildStorageKey({
17964
- id,
17965
- version: previousVersion,
17966
- category: PINNED_COLUMNS
17967
- }), buildStorageKey({
17968
- id,
17969
- version: previousVersion,
17970
- category: FILTER_SEARCH_KEY
17971
- }), buildStorageKey({
17972
- id,
17973
- version: previousVersion,
17974
- category: DIMENSION_MODEL_KEY
17975
- })];
17976
- for (const keyToDelete of keysToDelete) {
17977
- try {
17978
- window.localStorage.removeItem(keyToDelete);
17979
- } catch (e) {
17980
- // Ignore
17942
+ const clearPreviousVersionStorage = (id, previousLocalStorageVersions) => {
17943
+ for (const version of previousLocalStorageVersions) {
17944
+ const keysToDelete = [buildStorageKey({
17945
+ id,
17946
+ version,
17947
+ category: PAGINATION_MODEL_KEY
17948
+ }), buildStorageKey({
17949
+ id,
17950
+ version,
17951
+ category: SORT_MODEL_KEY
17952
+ }), buildStorageKey({
17953
+ id,
17954
+ version,
17955
+ category: FILTER_MODEL_KEY
17956
+ }), buildStorageKey({
17957
+ id,
17958
+ version,
17959
+ category: VISIBILITY_MODEL_KEY
17960
+ }), buildStorageKey({
17961
+ id,
17962
+ version,
17963
+ category: PINNED_COLUMNS
17964
+ }), buildStorageKey({
17965
+ id,
17966
+ version,
17967
+ category: FILTER_SEARCH_KEY
17968
+ }), buildStorageKey({
17969
+ id,
17970
+ version,
17971
+ category: DIMENSION_MODEL_KEY
17972
+ })];
17973
+ for (const keyToDelete of keysToDelete) {
17974
+ try {
17975
+ window.localStorage.removeItem(keyToDelete);
17976
+ } catch (e) {
17977
+ // Ignore
17978
+ }
17981
17979
  }
17982
17980
  }
17983
17981
  };
@@ -18063,39 +18061,42 @@ const numberOperatorDecoder = {
18063
18061
  lt: '<',
18064
18062
  lte: '<='
18065
18063
  };
18066
- const isOperatorValueValid = (field, operator, columns) => {
18067
- const column = columns.find(column => column.field === field);
18064
+ const isOperatorValueValid = (columnField, operatorValue, columns) => {
18065
+ const column = columns.find(column => column.field === columnField);
18068
18066
  if (!column) {
18069
18067
  return false;
18070
18068
  }
18071
18069
  const columnType = (column === null || column === void 0 ? void 0 : column.type) || 'string';
18072
- const operators = column.filterOperators || operatorList[columnType];
18070
+ const operators = operatorList[columnType];
18073
18071
  if (!operators) {
18074
18072
  return false;
18075
18073
  }
18076
- return !!operators.find(op => columnType === 'number' && Object.keys(numberOperatorEncoder).includes(op.value) ? numberOperatorEncoder[op.value] === operator : op.value === operator);
18074
+ if ('filterOperators' in operators) {
18075
+ return !!operators.filterOperators.find(op => columnType === 'number' && Object.keys(numberOperatorEncoder).includes(op.value) ? numberOperatorEncoder[op.value] === operatorValue : op['value'] === operatorValue);
18076
+ }
18077
+ return !!operators.find(op => ['number', 'rsNumber'].includes(columnType) && Object.keys(numberOperatorEncoder).includes(op.value) ? numberOperatorEncoder[op.value] === operatorValue : op['value'] === operatorValue);
18077
18078
  };
18078
18079
  const listOperators = ['containsAnyOf', 'endsWithAnyOf', 'isAnyOf', 'isNotAnyOf', 'startsWithAnyOf'];
18079
18080
 
18080
18081
  // Check if the value doesn't break
18081
- const isValueValid = (value, field, columns, operator) => {
18082
+ const isValueValid = (value, columnField, columns, operatorValue) => {
18082
18083
  var _column$type;
18083
18084
  // every field accepts undefined as value for default
18084
18085
  if (value === undefined || value === '') {
18085
18086
  return true;
18086
18087
  }
18087
18088
 
18088
- // xxxAnyOf accepts as value only lists, and we are declaring them in the
18089
+ // xxxAnyOf accepts as value only lists, and we are declearing them in the
18089
18090
  // URL as `list=[...]`
18090
- if (listOperators.includes(operator)) {
18091
+ if (listOperators.includes(operatorValue)) {
18091
18092
  return Array.isArray(value) || value === '';
18092
18093
  }
18093
18094
 
18094
18095
  // We are accepting arrays only if they are of the 'xxxAnyOf' type
18095
- if (Array.isArray(value) && !listOperators.includes(operator)) {
18096
+ if (Array.isArray(value) && !listOperators.includes(operatorValue)) {
18096
18097
  return false;
18097
18098
  }
18098
- const column = columns.find(column => column.field === field);
18099
+ const column = columns.find(column => column.field === columnField);
18099
18100
  if (!column) {
18100
18101
  return false;
18101
18102
  }
@@ -18133,14 +18134,14 @@ const getFilterModelFromString = (searchString, columns) => {
18133
18134
  if (!searchString) {
18134
18135
  return 'invalid';
18135
18136
  }
18136
- let logicOperator = GridLogicOperator.And;
18137
+ let linkOperator = GridLinkOperator.And;
18137
18138
  const searchParams = new URLSearchParams();
18138
18139
  for (const [key, value] of new URLSearchParams(searchString)) {
18139
18140
  if (key.startsWith('_') && !['_logicOperator', '_sortColumn', '_pinnedColumnsLeft', '_pinnedColumnsRight', '_columnVisibility', '_pagination'].includes(key)) {
18140
18141
  searchParams.set(key, value);
18141
18142
  }
18142
18143
  if (key === '_logicOperator') {
18143
- logicOperator = value === GridLogicOperator.And || value === GridLogicOperator.Or ? value : GridLogicOperator.And;
18144
+ linkOperator = value;
18144
18145
  }
18145
18146
  }
18146
18147
  let id = 5000;
@@ -18181,8 +18182,8 @@ const getFilterModelFromString = (searchString, columns) => {
18181
18182
  return;
18182
18183
  }
18183
18184
  items.push({
18184
- field,
18185
- operator: columnType === 'number' && Object.keys(numberOperatorDecoder).includes(operator) ? numberOperatorDecoder[operator] : operator,
18185
+ columnField: field,
18186
+ operatorValue: ['number', 'rsNumber'].includes(columnType) && Object.keys(numberOperatorDecoder).includes(operator) ? numberOperatorDecoder[operator] : operator,
18186
18187
  id,
18187
18188
  value: listOperators.includes(operator) && decodedValue === '' ? [] : decodedValue,
18188
18189
  type
@@ -18197,23 +18198,23 @@ const getFilterModelFromString = (searchString, columns) => {
18197
18198
  }
18198
18199
  return {
18199
18200
  items,
18200
- logicOperator
18201
+ linkOperator
18201
18202
  };
18202
18203
  };
18203
18204
  const getSearchParamsFromFilterModel = filterModel => {
18204
18205
  const searchParams = new URLSearchParams();
18205
- searchParams.set('_logicOperator', filterModel['logicOperator'] || '');
18206
+ searchParams.set('_logicOperator', filterModel['linkOperator'] || '');
18206
18207
  filterModel['items'].forEach(item => {
18207
18208
  const {
18208
- field,
18209
- operator,
18209
+ columnField,
18210
+ operatorValue,
18210
18211
  value,
18211
18212
  type
18212
18213
  } = item;
18213
- if (Object.keys(numberOperatorEncoder).includes(operator)) {
18214
- searchParams.set(`_${field}[${numberOperatorEncoder[operator]},${encodeValue(type)}]`, encodeValue(value));
18214
+ if (Object.keys(numberOperatorEncoder).includes(operatorValue)) {
18215
+ searchParams.set(`_${columnField}[${numberOperatorEncoder[operatorValue]},${encodeValue(type)}]`, encodeValue(value));
18215
18216
  } else {
18216
- searchParams.set(`_${field}[${encodeValue(operator)},${encodeValue(type)}]`, encodeValue(value));
18217
+ searchParams.set(`_${columnField}[${encodeValue(operatorValue)},${encodeValue(type)}]`, encodeValue(value));
18217
18218
  }
18218
18219
  });
18219
18220
  return searchParams;
@@ -18223,7 +18224,14 @@ const getSearchParamsFromFilterModel = filterModel => {
18223
18224
  // - if we have something in the URL, use that info
18224
18225
  // - if we don't have that, use the localStorage and update the URL
18225
18226
  // - if we don't have that, return an empty FilterModel
18226
- const getFilterModel = (search, columns, localStorageFilters, setLocalStorageFilters, initialState) => {
18227
+ const getFilterModel = (search, columns, localStorageFilters, setLocalStorageFilters, initialState, isNewVersion) => {
18228
+ const defaultValue = initialState && initialState.filter && initialState.filter.filterModel ? initialState.filter.filterModel : {
18229
+ items: [],
18230
+ linkOperator: GridLinkOperator.And
18231
+ };
18232
+ if (isNewVersion) {
18233
+ return defaultValue;
18234
+ }
18227
18235
  const filterModelFromSearch = getFilterModelFromString(search, columns);
18228
18236
  if (filterModelFromSearch !== 'invalid') {
18229
18237
  const searchFromFilterModel = getSearchParamsFromFilterModel(filterModelFromSearch);
@@ -18237,10 +18245,7 @@ const getFilterModel = (search, columns, localStorageFilters, setLocalStorageFil
18237
18245
  if (filterModelFromLocalStorage !== 'invalid') {
18238
18246
  return filterModelFromLocalStorage;
18239
18247
  }
18240
- return initialState && initialState.filter && initialState.filter.filterModel ? initialState.filter.filterModel : {
18241
- items: [],
18242
- logicOperator: GridLogicOperator.And
18243
- };
18248
+ return defaultValue;
18244
18249
  };
18245
18250
 
18246
18251
  /** SORT */
@@ -18274,8 +18279,12 @@ const getSearchParamsFromSorting = sorting => {
18274
18279
  // - if we have something in the URL, use that info
18275
18280
  // - if we don't have that, use the localStorage and update the URL
18276
18281
  // - if we don't have that, return an empty SortModel
18277
- const getSortModel = (search, columns, localStorageSorting, setLocalStorageSorting, initialState) => {
18282
+ const getSortModel = (search, columns, localStorageSorting, setLocalStorageSorting, initialState, isNewVersion) => {
18278
18283
  var _initialState$sorting;
18284
+ const defaultValue = initialState !== null && initialState !== void 0 && (_initialState$sorting = initialState.sorting) !== null && _initialState$sorting !== void 0 && _initialState$sorting.sortModel ? initialState.sorting.sortModel : [];
18285
+ if (isNewVersion) {
18286
+ return defaultValue;
18287
+ }
18279
18288
  const sorting = getSortingFromString(search, columns);
18280
18289
  if (sorting !== 'invalid') {
18281
18290
  const searchFromSortModel = getSearchParamsFromSorting(sorting);
@@ -18289,7 +18298,7 @@ const getSortModel = (search, columns, localStorageSorting, setLocalStorageSorti
18289
18298
  if (sortModelFromLocalStorage !== 'invalid') {
18290
18299
  return sortModelFromLocalStorage;
18291
18300
  }
18292
- return initialState !== null && initialState !== void 0 && (_initialState$sorting = initialState.sorting) !== null && _initialState$sorting !== void 0 && _initialState$sorting.sortModel ? initialState.sorting.sortModel : [];
18301
+ return defaultValue;
18293
18302
  };
18294
18303
 
18295
18304
  /** PAGINATION */
@@ -18326,8 +18335,19 @@ const getSearchParamsFromPagination = pagination => {
18326
18335
  // - if we have something in the URL, use that info
18327
18336
  // - if we don't have that, use the localStorage and update the URL
18328
18337
  // - if we don't have that, return an empty PaginationModel
18329
- const getPaginationModel = (search, localStoragePagination, setLocalStoragePagination, initialState) => {
18330
- var _initialState$paginat;
18338
+ const getPaginationModel = (search, localStoragePagination, setLocalStoragePagination, initialState, isNewVersion) => {
18339
+ const defaultValue = initialState !== null && initialState !== void 0 && initialState.pagination ? _objectSpread2({
18340
+ page: 0,
18341
+ pageSize: 25,
18342
+ direction: 'next'
18343
+ }, initialState.pagination) : {
18344
+ page: 0,
18345
+ pageSize: 25,
18346
+ direction: 'next'
18347
+ };
18348
+ if (isNewVersion) {
18349
+ return defaultValue;
18350
+ }
18331
18351
  const pagination = getPaginationFromString(search);
18332
18352
  if (pagination !== 'invalid') {
18333
18353
  const searchFromPaginationModel = getSearchParamsFromPagination(pagination);
@@ -18341,26 +18361,18 @@ const getPaginationModel = (search, localStoragePagination, setLocalStoragePagin
18341
18361
  if (paginationModelFromLocalStorage !== 'invalid') {
18342
18362
  return paginationModelFromLocalStorage;
18343
18363
  }
18344
- return initialState !== null && initialState !== void 0 && (_initialState$paginat = initialState.pagination) !== null && _initialState$paginat !== void 0 && _initialState$paginat.paginationModel ? _objectSpread2({
18345
- page: 0,
18346
- pageSize: 25,
18347
- direction: 'next'
18348
- }, initialState.pagination.paginationModel) : {
18349
- page: 0,
18350
- pageSize: 25,
18351
- direction: 'next'
18352
- };
18364
+ return defaultValue;
18353
18365
  };
18354
18366
 
18355
18367
  /** COLUMN VISIBILITY */
18356
18368
 
18357
18369
  const getSearchParamsFromColumnVisibility = (columnVisibility, columns) => {
18358
18370
  const searchParams = new URLSearchParams();
18359
- const fields = columns.map(column => column.field);
18371
+ const columnFields = columns.map(column => column.field);
18360
18372
 
18361
18373
  // if column visibility model is empty, show all columns
18362
18374
  if (Object.keys(columnVisibility).length == 0) {
18363
- searchParams.set('_columnVisibility', `[${fields.join(',')}]`);
18375
+ searchParams.set('_columnVisibility', `[${columnFields.join(',')}]`);
18364
18376
  return searchParams;
18365
18377
  }
18366
18378
  const finalColumnVisibility = columns.filter(c => {
@@ -18410,12 +18422,12 @@ const getColumnVisibilityFromString = (notParsed, tableColumns) => {
18410
18422
  continue;
18411
18423
  }
18412
18424
  exist = true;
18413
- const fields = tableColumns.map(column => column.field);
18425
+ const columnFields = tableColumns.map(column => column.field);
18414
18426
  // TODO: Add validation that , is present
18415
18427
  const columns = encodedValues.split(',').map(value => decodeValue(value));
18416
18428
 
18417
18429
  // for each column, check if it's visible and add it to visibility model
18418
- for (const column of fields) {
18430
+ for (const column of columnFields) {
18419
18431
  const isColumnVisible = columns.includes(column);
18420
18432
  visibility[column] = isColumnVisible;
18421
18433
  if (isColumnVisible) {
@@ -18435,8 +18447,17 @@ const getColumnVisibilityFromString = (notParsed, tableColumns) => {
18435
18447
  // - if we don't have that, return an empty ColumnVisibilityModel (which is all columns)
18436
18448
  // NOTE: the `defaultHidden` is a custom field and not standard DataGrid
18437
18449
  // The reason is the following bug: https://github.com/mui/mui-x/issues/8407
18438
- const getColumnsVisibility = (search, columns, localStorageColumnsVisibility, setLocalStorageColumnsVisibility, initialState) => {
18450
+ const getColumnsVisibility = (search, columns, localStorageColumnsVisibility, setLocalStorageColumnsVisibility, initialState, isNewVersion) => {
18439
18451
  var _initialState$columns;
18452
+ const defaultValue = {};
18453
+ for (const column of columns) {
18454
+ const field = column.field;
18455
+ defaultValue[field] = column.defaultHidden !== true; // undefined will be true
18456
+ }
18457
+
18458
+ if (isNewVersion) {
18459
+ return defaultValue;
18460
+ }
18440
18461
  const columnVisibility = getColumnVisibilityFromString(search, columns);
18441
18462
  if (columnVisibility !== 'invalid') {
18442
18463
  const searchColumnVisibility = getSearchParamsFromColumnVisibility(columnVisibility, columns);
@@ -18452,15 +18473,7 @@ const getColumnsVisibility = (search, columns, localStorageColumnsVisibility, se
18452
18473
  if (initialState !== null && initialState !== void 0 && (_initialState$columns = initialState.columns) !== null && _initialState$columns !== void 0 && _initialState$columns.columnVisibilityModel) {
18453
18474
  return initialState.columns.columnVisibilityModel;
18454
18475
  }
18455
-
18456
- // No columns in URL or localStorage, just show them all expect the hidden ones
18457
- const res = {};
18458
- for (const column of columns) {
18459
- const field = column.field;
18460
- res[field] = column.defaultHidden !== true; // undefined will be true
18461
- }
18462
-
18463
- return res;
18476
+ return defaultValue;
18464
18477
  };
18465
18478
  const getPinnedColumnsFromString = (notParsed, tableColumns) => {
18466
18479
  if (!notParsed || notParsed.length === 1 && notParsed[0] === '?') {
@@ -18482,8 +18495,8 @@ const getPinnedColumnsFromString = (notParsed, tableColumns) => {
18482
18495
  if (typeof encodedValues !== 'string') {
18483
18496
  continue;
18484
18497
  }
18485
- const fields = [...tableColumns.map(column => column.field), '__check__'];
18486
- const columns = encodedValues.split(',').map(value => decodeValue(value)).filter(val => typeof val === 'string' && fields.includes(val));
18498
+ const columnFields = [...tableColumns.map(column => column.field), '__check__'];
18499
+ const columns = encodedValues.split(',').map(value => decodeValue(value)).filter(val => typeof val === 'string' && columnFields.includes(val));
18487
18500
  if (fieldURL === '_pinnedColumnsLeft') {
18488
18501
  pinnedColumns['left'] = columns;
18489
18502
  }
@@ -18491,9 +18504,9 @@ const getPinnedColumnsFromString = (notParsed, tableColumns) => {
18491
18504
  pinnedColumns['right'] = columns;
18492
18505
  }
18493
18506
  }
18494
- return pinnedColumns.left && pinnedColumns.left.length > 0 || pinnedColumns.right && pinnedColumns.right.length > 0 ? {
18495
- left: pinnedColumns.left || [],
18496
- right: pinnedColumns.right || []
18507
+ return pinnedColumns['left'] || pinnedColumns['right'] ? {
18508
+ left: pinnedColumns['left'] || [],
18509
+ right: pinnedColumns['right'] || []
18497
18510
  } : 'invalid';
18498
18511
  };
18499
18512
  const getSearchParamsFromPinnedColumns = pinnedColumns => {
@@ -18510,7 +18523,17 @@ const getSearchParamsFromPinnedColumns = pinnedColumns => {
18510
18523
  // - if we have something in the URL, use that info
18511
18524
  // - if we don't have that, use the localStorage and update the URL
18512
18525
  // - if we don't have that, return an empty ColumnVisibilityModel (which is all columns)
18513
- const getPinnedColumns = (search, columns, localStoragePinnedColumns, setLocalStoragePinnedColumns, initialState) => {
18526
+ const getPinnedColumns = (search, columns, localStoragePinnedColumns, setLocalStoragePinnedColumns, initialState, isNewVersion) => {
18527
+ const defaultValue = initialState !== null && initialState !== void 0 && initialState.pinnedColumns ? {
18528
+ left: (initialState === null || initialState === void 0 ? void 0 : initialState.pinnedColumns['left']) || [],
18529
+ right: (initialState === null || initialState === void 0 ? void 0 : initialState.pinnedColumns['right']) || []
18530
+ } : {
18531
+ left: [],
18532
+ right: []
18533
+ };
18534
+ if (isNewVersion) {
18535
+ return defaultValue;
18536
+ }
18514
18537
  const pinnedColumns = getPinnedColumnsFromString(search, columns);
18515
18538
  if (pinnedColumns !== 'invalid') {
18516
18539
  const searchPinnedColumns = getSearchParamsFromPinnedColumns(pinnedColumns);
@@ -18523,19 +18546,7 @@ const getPinnedColumns = (search, columns, localStoragePinnedColumns, setLocalSt
18523
18546
  if (pinnedColumnsFromLocalStorage !== 'invalid') {
18524
18547
  return pinnedColumnsFromLocalStorage;
18525
18548
  }
18526
- if (initialState !== null && initialState !== void 0 && initialState.pinnedColumns) {
18527
- return {
18528
- left: (initialState === null || initialState === void 0 ? void 0 : initialState.pinnedColumns['left']) || [],
18529
- right: (initialState === null || initialState === void 0 ? void 0 : initialState.pinnedColumns['right']) || []
18530
- };
18531
- }
18532
-
18533
- // No pinnedColumn in URL or localStorage, TODO: decide what is the default state
18534
- const res = {
18535
- left: [],
18536
- right: []
18537
- };
18538
- return res;
18549
+ return defaultValue;
18539
18550
  };
18540
18551
  const getSearchParamsFromTab = search => {
18541
18552
  const searchParams = new URLSearchParams();
@@ -18548,6 +18559,7 @@ const getSearchParamsFromTab = search => {
18548
18559
  const getFinalSearch = _ref3 => {
18549
18560
  let {
18550
18561
  search,
18562
+ localStorageVersion,
18551
18563
  filterModel,
18552
18564
  sortModel,
18553
18565
  paginationModel,
@@ -18567,10 +18579,13 @@ const getFinalSearch = _ref3 => {
18567
18579
  searchParams.set(key, value);
18568
18580
  }
18569
18581
  }
18582
+ searchParams.set('v', `${localStorageVersion}`);
18570
18583
  return new URLSearchParams([...searchParams, ...filterModelSearch, ...sortModelSearch, ...paginationModelSearch, ...tabSearch, ...pinnedColumnsModelSearch, ...columnVisibilityModelSearch]);
18571
18584
  };
18572
18585
  /** Return the state of the table given the URL and the local storage state */
18573
- const getModelsParsedOrUpdateLocalStorage = (search, columns, historyReplace, initialState, localStorage) => {
18586
+ const getModelsParsedOrUpdateLocalStorage = (search, localStorageVersion, columns, historyReplace, initialState, localStorage) => {
18587
+ const currentVersion = new URLSearchParams(search).get('v');
18588
+ const isNewVersion = !currentVersion || Number(currentVersion) !== localStorageVersion;
18574
18589
  const {
18575
18590
  localStorageFilters,
18576
18591
  setLocalStorageFilters,
@@ -18583,12 +18598,13 @@ const getModelsParsedOrUpdateLocalStorage = (search, columns, historyReplace, in
18583
18598
  localStoragePinnedColumns,
18584
18599
  setLocalStoragePinnedColumns
18585
18600
  } = localStorage;
18586
- const filterModel = getFilterModel(search, columns, localStorageFilters, setLocalStorageFilters, initialState);
18587
- const sortModel = getSortModel(search, columns, localStorageSorting, setLocalStorageSorting, initialState);
18588
- const paginationModel = getPaginationModel(search, localStoragePagination, setLocalStoragePagination, initialState);
18589
- const columnVisibilityModel = getColumnsVisibility(search, columns, localStorageColumnsVisibility, setLocalStorageColumnsVisibility, initialState);
18590
- const pinnedColumnsModel = getPinnedColumns(search, columns, localStoragePinnedColumns, setLocalStoragePinnedColumns, initialState);
18601
+ const filterModel = getFilterModel(search, columns, localStorageFilters, setLocalStorageFilters, initialState, isNewVersion);
18602
+ const sortModel = getSortModel(search, columns, localStorageSorting, setLocalStorageSorting, initialState, isNewVersion);
18603
+ const paginationModel = getPaginationModel(search, localStoragePagination, setLocalStoragePagination, initialState, isNewVersion);
18604
+ const columnVisibilityModel = getColumnsVisibility(search, columns, localStorageColumnsVisibility, setLocalStorageColumnsVisibility, initialState, isNewVersion);
18605
+ const pinnedColumnsModel = getPinnedColumns(search, columns, localStoragePinnedColumns, setLocalStoragePinnedColumns, initialState, isNewVersion);
18591
18606
  const finalSearch = getFinalSearch({
18607
+ localStorageVersion,
18592
18608
  search,
18593
18609
  filterModel,
18594
18610
  sortModel,
@@ -18609,7 +18625,7 @@ const getModelsParsedOrUpdateLocalStorage = (search, columns, historyReplace, in
18609
18625
  pinnedColumnsModel
18610
18626
  };
18611
18627
  };
18612
- const updateUrl = (_ref4, search, historyReplace, columns) => {
18628
+ const updateUrl = (_ref4, search, localStorageVersion, historyReplace, columns) => {
18613
18629
  let {
18614
18630
  filterModel,
18615
18631
  sortModel,
@@ -18619,6 +18635,7 @@ const updateUrl = (_ref4, search, historyReplace, columns) => {
18619
18635
  } = _ref4;
18620
18636
  const newSearch = getFinalSearch({
18621
18637
  search,
18638
+ localStorageVersion,
18622
18639
  filterModel,
18623
18640
  sortModel,
18624
18641
  paginationModel,
@@ -18636,17 +18653,17 @@ const updateUrl = (_ref4, search, historyReplace, columns) => {
18636
18653
  // do not use it for equivalence (e.g. with value `3` and undefined we
18637
18654
  // will get 0).
18638
18655
  const compareFilters = (firstFilter, secondFilter) => {
18639
- if (firstFilter.field < secondFilter.field) {
18656
+ if (firstFilter.columnField < secondFilter.columnField) {
18640
18657
  return -1;
18641
- } else if (firstFilter.field > secondFilter.field) {
18658
+ } else if (firstFilter.columnField > secondFilter.columnField) {
18642
18659
  return 1;
18643
18660
  }
18644
- if (firstFilter.operator === undefined || secondFilter.operator === undefined) {
18661
+ if (firstFilter.operatorValue === undefined || secondFilter.operatorValue === undefined) {
18645
18662
  return 0;
18646
18663
  }
18647
- if (firstFilter.operator < secondFilter.operator) {
18664
+ if (firstFilter.operatorValue < secondFilter.operatorValue) {
18648
18665
  return -1;
18649
- } else if (firstFilter.operator > secondFilter.operator) {
18666
+ } else if (firstFilter.operatorValue > secondFilter.operatorValue) {
18650
18667
  return 1;
18651
18668
  }
18652
18669
  if (firstFilter.value < secondFilter.value) {
@@ -18657,18 +18674,18 @@ const compareFilters = (firstFilter, secondFilter) => {
18657
18674
  return 0;
18658
18675
  };
18659
18676
  const areFiltersEquivalent = (firstFilter, secondFilter) => {
18660
- return firstFilter.field === secondFilter.field && firstFilter.operator === secondFilter.operator && firstFilter.value === secondFilter.value;
18677
+ return firstFilter.columnField === secondFilter.columnField && firstFilter.operatorValue === secondFilter.operatorValue && firstFilter.value === secondFilter.value;
18661
18678
  };
18662
18679
  const areFilterModelsEquivalent = (filterModel, filterModelToMatch) => {
18663
18680
  const {
18664
18681
  items,
18665
- logicOperator
18682
+ linkOperator
18666
18683
  } = filterModel;
18667
18684
  const {
18668
18685
  items: itemsToMatch,
18669
- logicOperator: logicOperatorToMatch
18686
+ linkOperator: linkOperatorToMatch
18670
18687
  } = filterModelToMatch;
18671
- if (logicOperator !== logicOperatorToMatch) {
18688
+ if (linkOperator !== linkOperatorToMatch) {
18672
18689
  return false;
18673
18690
  }
18674
18691
  if (items.length !== itemsToMatch.length) {
@@ -18681,7 +18698,7 @@ const areFilterModelsEquivalent = (filterModel, filterModelToMatch) => {
18681
18698
  const filterToCompare = itemsToMatch[i];
18682
18699
 
18683
18700
  // compareFilters return 0 if and only if the filters have the same
18684
- // field, operator, and value
18701
+ // columnField, operatorValue, and value
18685
18702
  if (!areFiltersEquivalent(filter, filterToCompare)) {
18686
18703
  return false;
18687
18704
  }
@@ -24492,16 +24509,16 @@ const getRole = (config, dateFormat) => {
24492
24509
  }).join('\n');
24493
24510
  return `The AI assistant parses user input to generate a JSON object that will be used as a row filter for a data table MUI Data Grid.
24494
24511
  The filter supports mulitple conditions using only two logical operator "and", "or". It only allows "and" between all conditions or "or" between all conditions. It can't mix the two types.
24495
- The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "logicOperator" and "items":
24496
- - "logicOperator": the logical operator, only "and" or "or" are allowed. If there is only one condition in the "items", use "and".
24497
- - "items": a list of conditions, each is an object with exactly the three keys "field", "operator" and "value":
24498
- - "field": the column name, must be one of ${columns}
24512
+ The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "linkOperator" and "items":
24513
+ - "linkOperator": the logical operator, only "and" or "or" are allowed. If there is only one condition in the "items", use "and".
24514
+ - "items": a list of conditions, each is an object with exactly the three keys "columnField", "operatorValue" and "value":
24515
+ - "columnField": the column name, must be one of ${columns}
24499
24516
  - "value":
24500
- - this can be skipped if the "operator" is either "isEmpty" or "isNotEmpty"
24501
- - a list of multiple values if the "operator" ends with "AnyOf"
24517
+ - this can be skipped if the "operatorValue" is either "isEmpty" or "isNotEmpty"
24518
+ - a list of multiple values if the "operatorValue" ends with "AnyOf"
24502
24519
  - otherwise, it's a single value represented as a string: "true" instead of true, "false" instead of false, "0.6" instead of 0.6.
24503
24520
  For "date" data type, use ${dateFormat}. If relative date is input, convert to the actual date given today is ${today}.
24504
- - "operator": the comparison operator, accepted values depend on the data type of the column
24521
+ - "operatorValue": the comparison operator, accepted values depend on the data type of the column
24505
24522
  ${operators}
24506
24523
 
24507
24524
  Below is the datatype in square bracket, constraints on the data range if any, followed by the description of each column used in the data table:
@@ -24538,10 +24555,10 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
24538
24555
  nlpFilterConfig,
24539
24556
  onFilterModelChange,
24540
24557
  dateFormat = 'yyyy-mm-dd',
24541
- defaultModel = 'gpt-4-1106-preview',
24558
+ defaultModel = 'gpt-4-0613',
24542
24559
  defaultFilter = {
24543
24560
  items: [],
24544
- logicOperator: 'and'
24561
+ linkOperator: 'and'
24545
24562
  },
24546
24563
  disablePower = false,
24547
24564
  localeText
@@ -24619,7 +24636,7 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
24619
24636
  value: prompt
24620
24637
  }), /*#__PURE__*/React__default.createElement(Button, {
24621
24638
  variant: "primary",
24622
- "aria-label": buttonAriaLabel,
24639
+ "aira-label": buttonAriaLabel,
24623
24640
  type: "submit",
24624
24641
  isLoading: isLoading
24625
24642
  }, buttonText)), !disablePower && /*#__PURE__*/React__default.createElement(Tooltip, null, /*#__PURE__*/React__default.createElement(Tooltip.Trigger, null, /*#__PURE__*/React__default.createElement(Switch, {
@@ -24680,7 +24697,7 @@ const Toolbar$2 = props => {
24680
24697
  let {
24681
24698
  apiRef
24682
24699
  } = _ref;
24683
- return gridExpandedSortedRowIdsSelector(apiRef);
24700
+ return gridVisibleSortedRowIdsSelector(apiRef);
24684
24701
  }
24685
24702
  },
24686
24703
  printOptions: {
@@ -26912,10 +26929,12 @@ const ServerSideControlledPagination = _ref3 => {
26912
26929
  selectionStatus,
26913
26930
  displaySelection,
26914
26931
  displayPagination,
26915
- paginationModel,
26916
- onPaginationModelChange,
26917
- pageSizeOptions,
26932
+ page,
26933
+ onPageChange,
26934
+ pageSize,
26935
+ onPageSizeChange,
26918
26936
  displayRowsPerPage,
26937
+ rowsPerPageOptions,
26919
26938
  paginationProps,
26920
26939
  rowCount
26921
26940
  } = _ref3;
@@ -26934,17 +26953,13 @@ const ServerSideControlledPagination = _ref3 => {
26934
26953
  }, totalRowsLabel) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$1({
26935
26954
  component: "div",
26936
26955
  count: totalNumberOfRowsInTable,
26937
- page: paginationModel.page,
26938
- onPageChange: (event, page) => onPaginationModelChange({
26939
- page,
26940
- pageSize: paginationModel.pageSize
26941
- }),
26942
- rowsPerPage: paginationModel.pageSize,
26943
- onRowsPerPageChange: event => onPaginationModelChange({
26944
- page: paginationModel.page,
26945
- pageSize: parseInt(event.target.value, 10)
26946
- }),
26947
- rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
26956
+ page: page,
26957
+ onPageChange: (event, newPage) => onPageChange(newPage),
26958
+ rowsPerPage: pageSize,
26959
+ onRowsPerPageChange: event => {
26960
+ onPageSizeChange(parseInt(event.target.value, 10));
26961
+ },
26962
+ rowsPerPageOptions: displayRowsPerPage ? rowsPerPageOptions : []
26948
26963
  }, paginationProps)) : null);
26949
26964
  };
26950
26965
 
@@ -26970,9 +26985,11 @@ const ControlledPagination = _ref3 => {
26970
26985
  displayPagination = false,
26971
26986
  selectionStatus,
26972
26987
  apiRef,
26973
- paginationModel,
26974
- onPaginationModelChange,
26975
- pageSizeOptions,
26988
+ page,
26989
+ onPageChange,
26990
+ pageSize,
26991
+ onPageSizeChange,
26992
+ rowsPerPageOptions,
26976
26993
  isRowSelectable,
26977
26994
  paginationProps
26978
26995
  } = _ref3;
@@ -27002,25 +27019,17 @@ const ControlledPagination = _ref3 => {
27002
27019
  }, `${selectionStatus.numberOfSelectedRows} row${selectionStatus.numberOfSelectedRows > 1 ? 's' : ''} selected`) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$1({
27003
27020
  component: "div",
27004
27021
  count: numberOfFilteredRowsInTable,
27005
- page: paginationModel.page,
27006
- onPageChange: (event, page) => {
27007
- onPaginationModelChange({
27008
- page,
27009
- pageSize: paginationModel.pageSize
27010
- });
27011
- },
27012
- rowsPerPage: paginationModel.pageSize,
27022
+ page: page,
27023
+ onPageChange: (event, newPage) => onPageChange(newPage),
27024
+ rowsPerPage: pageSize,
27013
27025
  onRowsPerPageChange: event => {
27014
- onPaginationModelChange({
27015
- page: paginationModel.page,
27016
- pageSize: parseInt(event.target.value, 10)
27017
- });
27026
+ onPageSizeChange(parseInt(event.target.value, 10));
27018
27027
  },
27019
- rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
27028
+ rowsPerPageOptions: displayRowsPerPage ? rowsPerPageOptions : []
27020
27029
  }, paginationProps)) : null);
27021
27030
  };
27022
27031
 
27023
- const _excluded$3 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "paginationModel", "onPaginationModelChange", "pageSizeOptions", "paginationProps", "paginationMode", "rowCount"];
27032
+ const _excluded$3 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "page", "onPageChange", "pageSize", "onPageSizeChange", "rowsPerPageOptions", "paginationProps", "paginationMode", "rowCount"];
27024
27033
  const ToolbarWrapper = _ref => {
27025
27034
  let {
27026
27035
  hideToolbar,
@@ -27032,9 +27041,11 @@ const ToolbarWrapper = _ref => {
27032
27041
  selectionStatus,
27033
27042
  apiRef,
27034
27043
  isRowSelectable,
27035
- paginationModel,
27036
- onPaginationModelChange,
27037
- pageSizeOptions,
27044
+ page,
27045
+ onPageChange,
27046
+ pageSize,
27047
+ onPageSizeChange,
27048
+ rowsPerPageOptions,
27038
27049
  paginationProps,
27039
27050
  paginationMode = 'client',
27040
27051
  rowCount
@@ -27048,9 +27059,11 @@ const ToolbarWrapper = _ref => {
27048
27059
  displayRowsPerPage: false,
27049
27060
  displayPagination: ['top', 'both'].includes(paginationPlacement),
27050
27061
  selectionStatus: selectionStatus.current,
27051
- paginationModel: paginationModel,
27052
- onPaginationModelChange: onPaginationModelChange,
27053
- pageSizeOptions: pageSizeOptions,
27062
+ page: page,
27063
+ onPageChange: onPageChange,
27064
+ pageSize: pageSize,
27065
+ onPageSizeChange: onPageSizeChange,
27066
+ rowsPerPageOptions: rowsPerPageOptions,
27054
27067
  paginationProps: paginationProps,
27055
27068
  rowCount: rowCount
27056
27069
  }) : /*#__PURE__*/React__default.createElement(ControlledPagination, {
@@ -27060,26 +27073,30 @@ const ToolbarWrapper = _ref => {
27060
27073
  selectionStatus: selectionStatus.current,
27061
27074
  apiRef: apiRef,
27062
27075
  isRowSelectable: isRowSelectable,
27063
- paginationModel: paginationModel,
27064
- onPaginationModelChange: onPaginationModelChange,
27065
- pageSizeOptions: pageSizeOptions,
27076
+ page: page,
27077
+ onPageChange: onPageChange,
27078
+ pageSize: pageSize,
27079
+ onPageSizeChange: onPageSizeChange,
27080
+ rowsPerPageOptions: rowsPerPageOptions,
27066
27081
  paginationProps: paginationProps
27067
27082
  }) : null);
27068
27083
  };
27069
27084
 
27070
27085
  const useControlledDatagridState = _ref => {
27071
- var _ref2, _ref3, _propsPaginationModel, _initialState$paginat, _initialState$paginat2, _pageSizeOptions$, _ref4, _propsPaginationModel2, _initialState$paginat3, _initialState$paginat4;
27086
+ var _initialState$paginat, _initialState$paginat2;
27072
27087
  let {
27073
27088
  initialState,
27074
- pageSizeOptions,
27089
+ rowsPerPageOptions,
27075
27090
  propsColumnVisibilityModel,
27076
27091
  propsFilterModel,
27077
27092
  propsOnColumnVisibilityModelChange,
27078
27093
  propsOnFilterModelChange,
27079
- propsOnPaginationModelChange,
27094
+ propsOnPageChange,
27095
+ propsOnPageSizeChange,
27080
27096
  propsOnPinnedColumnsChange,
27081
27097
  propsOnSortModelChange,
27082
- propsPaginationModel,
27098
+ propsPage,
27099
+ propsPageSize,
27083
27100
  propsPinnedColumns,
27084
27101
  propsSortModel
27085
27102
  } = _ref;
@@ -27127,22 +27144,33 @@ const useControlledDatagridState = _ref => {
27127
27144
  setSortModel(model);
27128
27145
  }
27129
27146
  };
27130
- const [paginationModel, setPaginationModel] = useState({
27131
- pageSize: (_ref2 = (_ref3 = (_propsPaginationModel = propsPaginationModel === null || propsPaginationModel === void 0 ? void 0 : propsPaginationModel.pageSize) !== null && _propsPaginationModel !== void 0 ? _propsPaginationModel : initialState === null || initialState === void 0 ? void 0 : (_initialState$paginat = initialState.pagination) === null || _initialState$paginat === void 0 ? void 0 : (_initialState$paginat2 = _initialState$paginat.paginationModel) === null || _initialState$paginat2 === void 0 ? void 0 : _initialState$paginat2.pageSize) !== null && _ref3 !== void 0 ? _ref3 : typeof (pageSizeOptions === null || pageSizeOptions === void 0 ? void 0 : pageSizeOptions[0]) === 'number' ? pageSizeOptions === null || pageSizeOptions === void 0 ? void 0 : pageSizeOptions[0] : pageSizeOptions === null || pageSizeOptions === void 0 ? void 0 : (_pageSizeOptions$ = pageSizeOptions[0]) === null || _pageSizeOptions$ === void 0 ? void 0 : _pageSizeOptions$.value) !== null && _ref2 !== void 0 ? _ref2 : 25,
27132
- page: (_ref4 = (_propsPaginationModel2 = propsPaginationModel === null || propsPaginationModel === void 0 ? void 0 : propsPaginationModel.page) !== null && _propsPaginationModel2 !== void 0 ? _propsPaginationModel2 : initialState === null || initialState === void 0 ? void 0 : (_initialState$paginat3 = initialState.pagination) === null || _initialState$paginat3 === void 0 ? void 0 : (_initialState$paginat4 = _initialState$paginat3.paginationModel) === null || _initialState$paginat4 === void 0 ? void 0 : _initialState$paginat4.page) !== null && _ref4 !== void 0 ? _ref4 : 0
27133
- });
27134
- const onPaginationModelChange = (model, details) => {
27135
- if (propsOnPaginationModelChange) {
27136
- propsOnPaginationModelChange(model, details);
27147
+ const [page, setPage] = useState((initialState === null || initialState === void 0 ? void 0 : (_initialState$paginat = initialState.pagination) === null || _initialState$paginat === void 0 ? void 0 : _initialState$paginat.page) || propsPage || 0);
27148
+ const [pageSize, setPageSize] = useState((initialState === null || initialState === void 0 ? void 0 : (_initialState$paginat2 = initialState.pagination) === null || _initialState$paginat2 === void 0 ? void 0 : _initialState$paginat2.pageSize) || propsPageSize || (rowsPerPageOptions === null || rowsPerPageOptions === void 0 ? void 0 : rowsPerPageOptions[0]) || 25);
27149
+ const onPageChange = page => {
27150
+ if (propsOnPageChange) {
27151
+ propsOnPageChange(page, undefined);
27137
27152
  } else {
27138
- setPaginationModel(model);
27153
+ setPage(page);
27139
27154
  }
27140
27155
  };
27141
27156
  useEffect(() => {
27142
- if (propsPaginationModel) {
27143
- setPaginationModel(propsPaginationModel);
27157
+ if (propsPage || propsPage === 0) {
27158
+ setPage(propsPage);
27159
+ }
27160
+ }, [propsPage]);
27161
+ const onPageSizeChange = pageSize => {
27162
+ onPageChange(0);
27163
+ if (propsOnPageSizeChange) {
27164
+ propsOnPageSizeChange(pageSize, undefined);
27165
+ } else {
27166
+ setPageSize(pageSize);
27144
27167
  }
27145
- }, [propsPaginationModel]);
27168
+ };
27169
+ useEffect(() => {
27170
+ if (propsPageSize) {
27171
+ setPageSize(propsPageSize);
27172
+ }
27173
+ }, [propsPageSize]);
27146
27174
  return {
27147
27175
  filterModel,
27148
27176
  onFilterModelChange,
@@ -27152,12 +27180,14 @@ const useControlledDatagridState = _ref => {
27152
27180
  onPinnedColumnsChange,
27153
27181
  sortModel,
27154
27182
  onSortModelChange,
27155
- paginationModel,
27156
- onPaginationModelChange
27183
+ page,
27184
+ pageSize,
27185
+ onPageChange,
27186
+ onPageSizeChange
27157
27187
  };
27158
27188
  };
27159
27189
 
27160
- const _excluded$2 = ["apiRef", "autoHeight", "className", "slots", "slotProps", "filterModel", "columnVisibilityModel", "pinnedColumns", "sortModel", "paginationModel", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "onFilterModelChange", "rowSelectionModel", "onPaginationModelChange", "onRowSelectionModelChange", "onColumnVisibilityModelChange", "onPinnedColumnsChange", "onSortModelChange", "pagination", "paginationPlacement", "paginationProps", "rows", "pageSizeOptions", "sx", "theme", "paginationMode", "rowCount"];
27190
+ const _excluded$2 = ["apiRef", "autoHeight", "className", "columnTypes", "components", "componentsProps", "filterModel", "columnVisibilityModel", "pinnedColumns", "sortModel", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "onFilterModelChange", "onPageChange", "onPageSizeChange", "onColumnVisibilityModelChange", "onPinnedColumnsChange", "onSortModelChange", "selectionModel", "onSelectionModelChange", "page", "pageSize", "pagination", "paginationPlacement", "paginationProps", "rows", "rowsPerPageOptions", "sx", "theme", "paginationMode", "rowCount"];
27161
27191
  const COMPONENT_NAME$2 = 'DataGrid';
27162
27192
  const CLASSNAME$2 = 'redsift-datagrid';
27163
27193
  const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
@@ -27166,30 +27196,33 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27166
27196
  apiRef: propsApiRef,
27167
27197
  autoHeight,
27168
27198
  className,
27169
- slots,
27170
- slotProps,
27199
+ columnTypes: propsColumnTypes,
27200
+ components,
27201
+ componentsProps,
27171
27202
  filterModel: propsFilterModel,
27172
27203
  columnVisibilityModel: propsColumnVisibilityModel,
27173
27204
  pinnedColumns: propsPinnedColumns,
27174
27205
  sortModel: propsSortModel,
27175
- paginationModel: propsPaginationModel,
27176
27206
  height: propsHeight,
27177
27207
  hideToolbar,
27178
27208
  initialState,
27179
27209
  isRowSelectable,
27180
27210
  license = process.env.MUI_LICENSE_KEY,
27181
27211
  onFilterModelChange: propsOnFilterModelChange,
27182
- rowSelectionModel: propsRowSelectionModel,
27183
- onPaginationModelChange: propsOnPaginationModelChange,
27184
- onRowSelectionModelChange: propsOnRowSelectionModelChange,
27212
+ onPageChange: propsOnPageChange,
27213
+ onPageSizeChange: propsOnPageSizeChange,
27185
27214
  onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
27186
27215
  onPinnedColumnsChange: propsOnPinnedColumnsChange,
27187
27216
  onSortModelChange: propsOnSortModelChange,
27217
+ selectionModel: propsSelectionModel,
27218
+ onSelectionModelChange: propsOnSelectionModelChange,
27219
+ page: propsPage,
27220
+ pageSize: propsPageSize,
27188
27221
  pagination,
27189
27222
  paginationPlacement = 'both',
27190
27223
  paginationProps,
27191
27224
  rows,
27192
- pageSizeOptions,
27225
+ rowsPerPageOptions,
27193
27226
  sx,
27194
27227
  theme: propsTheme,
27195
27228
  paginationMode = 'client',
@@ -27199,7 +27232,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27199
27232
  const theme = useTheme$4(propsTheme);
27200
27233
  const _apiRef = useGridApiRef();
27201
27234
  const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
27202
- const RenderedToolbar = slots !== null && slots !== void 0 && slots.toolbar ? slots.toolbar : Toolbar$2;
27235
+ const RenderedToolbar = components !== null && components !== void 0 && components.Toolbar ? components.Toolbar : Toolbar$2;
27203
27236
  LicenseInfo.setLicenseKey(license);
27204
27237
  const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
27205
27238
  const {
@@ -27207,52 +27240,56 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27207
27240
  filterModel,
27208
27241
  onColumnVisibilityModelChange,
27209
27242
  onFilterModelChange,
27210
- onPaginationModelChange,
27243
+ onPageChange,
27244
+ onPageSizeChange,
27211
27245
  onPinnedColumnsChange,
27212
27246
  onSortModelChange,
27213
- paginationModel,
27247
+ page,
27248
+ pageSize,
27214
27249
  pinnedColumns,
27215
27250
  sortModel
27216
27251
  } = useControlledDatagridState({
27217
27252
  initialState,
27218
- pageSizeOptions,
27253
+ rowsPerPageOptions,
27219
27254
  propsColumnVisibilityModel,
27220
27255
  propsFilterModel,
27221
27256
  propsOnColumnVisibilityModelChange,
27222
27257
  propsOnFilterModelChange,
27223
27258
  propsOnPinnedColumnsChange,
27224
27259
  propsOnSortModelChange,
27225
- propsPaginationModel,
27260
+ propsPage,
27261
+ propsPageSize,
27226
27262
  propsPinnedColumns,
27227
27263
  propsSortModel,
27228
- propsOnPaginationModelChange
27264
+ propsOnPageChange,
27265
+ propsOnPageSizeChange
27229
27266
  });
27230
- const [rowSelectionModel, setRowSelectionModel] = useState(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
27267
+ const [selectionModel, setSelectionModel] = useState(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
27231
27268
  useEffect(() => {
27232
- setRowSelectionModel(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
27233
- }, [propsRowSelectionModel]);
27234
- const onRowSelectionModelChange = (selectionModel, details) => {
27235
- if (propsOnRowSelectionModelChange) {
27236
- propsOnRowSelectionModelChange(selectionModel, details);
27269
+ setSelectionModel(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
27270
+ }, [propsSelectionModel]);
27271
+ const onSelectionModelChange = (selectionModel, details) => {
27272
+ if (propsOnSelectionModelChange) {
27273
+ propsOnSelectionModelChange(selectionModel, details);
27237
27274
  } else {
27238
- setRowSelectionModel(selectionModel);
27275
+ setSelectionModel(selectionModel);
27239
27276
  }
27240
27277
  };
27241
27278
  const selectionStatus = useRef({
27242
27279
  type: 'none',
27243
27280
  numberOfSelectedRows: 0,
27244
27281
  numberOfSelectedRowsInPage: 0,
27245
- page: paginationModel.page,
27246
- pageSize: paginationModel.pageSize
27282
+ page,
27283
+ pageSize
27247
27284
  });
27248
27285
 
27249
27286
  // in server-side pagination we want to update the selection status
27250
27287
  // every time we navigate between pages, resize our page or select something
27251
27288
  useEffect(() => {
27252
27289
  if (paginationMode == 'server') {
27253
- onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatus, isRowSelectable, paginationModel.page, paginationModel.pageSize);
27290
+ onServerSideSelectionStatusChange(Array.isArray(selectionModel) ? selectionModel : [selectionModel], apiRef, selectionStatus, isRowSelectable, page, pageSize);
27254
27291
  }
27255
- }, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
27292
+ }, [selectionModel, page, pageSize]);
27256
27293
  if (!Array.isArray(rows)) {
27257
27294
  return null;
27258
27295
  }
@@ -27283,54 +27320,57 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27283
27320
  apiRef: apiRef,
27284
27321
  autoHeight: autoHeight,
27285
27322
  checkboxSelectionVisibleOnly: Boolean(pagination),
27286
- slots: _objectSpread2(_objectSpread2({
27287
- baseButton: BaseButton,
27288
- baseCheckbox: BaseCheckbox,
27289
- // baseTextField,
27290
- basePopper: BasePopper,
27291
- columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27323
+ columnTypes: _objectSpread2(_objectSpread2({}, customColumnTypes), propsColumnTypes),
27324
+ components: _objectSpread2(_objectSpread2({
27325
+ BaseButton,
27326
+ BaseCheckbox,
27327
+ // BaseTextField,
27328
+ BasePopper,
27329
+ ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27292
27330
  displayName: "ColumnFilteredIcon"
27293
27331
  })),
27294
- columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27332
+ ColumnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27295
27333
  displayName: "ColumnSelectorIcon"
27296
27334
  })),
27297
- columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27335
+ ColumnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27298
27336
  displayName: "ColumnSortedAscendingIcon"
27299
27337
  })),
27300
- columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27338
+ ColumnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27301
27339
  displayName: "ColumnSortedDescendingIcon"
27302
27340
  })),
27303
- densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27341
+ DensityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27304
27342
  displayName: "DensityCompactIcon"
27305
27343
  })),
27306
- densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27344
+ DensityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27307
27345
  displayName: "DensityStandardIcon"
27308
27346
  })),
27309
- densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27347
+ DensityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27310
27348
  displayName: "DensityComfortableIcon"
27311
27349
  })),
27312
- detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27350
+ DetailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27313
27351
  displayName: "DetailPanelCollapseIcon"
27314
27352
  })),
27315
- detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27353
+ DetailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27316
27354
  displayName: "DetailPanelExpandIcon"
27317
27355
  })),
27318
- exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27356
+ ExportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27319
27357
  displayName: "ExportIcon"
27320
27358
  })),
27321
- openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
27359
+ OpenFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
27322
27360
  displayName: "OpenFilterButtonIcon"
27323
27361
  }, props))
27324
- }, slots), {}, {
27325
- toolbar: ToolbarWrapper,
27326
- pagination: props => pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$1({}, props, {
27362
+ }, components), {}, {
27363
+ Toolbar: ToolbarWrapper,
27364
+ Pagination: props => pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$1({}, props, {
27327
27365
  displaySelection: false,
27328
27366
  displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
27329
27367
  displayPagination: ['bottom', 'both'].includes(paginationPlacement),
27330
27368
  selectionStatus: selectionStatus.current,
27331
- paginationModel: paginationModel,
27332
- onPaginationModelChange: onPaginationModelChange,
27333
- pageSizeOptions: pageSizeOptions,
27369
+ page: page,
27370
+ onPageChange: onPageChange,
27371
+ pageSize: pageSize,
27372
+ onPageSizeChange: onPageSizeChange,
27373
+ rowsPerPageOptions: rowsPerPageOptions,
27334
27374
  paginationProps: paginationProps,
27335
27375
  paginationMode: paginationMode,
27336
27376
  rowCount: rowCount
@@ -27341,14 +27381,16 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27341
27381
  selectionStatus: selectionStatus.current,
27342
27382
  apiRef: apiRef,
27343
27383
  isRowSelectable: isRowSelectable,
27344
- paginationModel: paginationModel,
27345
- onPaginationModelChange: onPaginationModelChange,
27346
- pageSizeOptions: pageSizeOptions,
27384
+ page: page,
27385
+ onPageChange: onPageChange,
27386
+ pageSize: pageSize,
27387
+ onPageSizeChange: onPageSizeChange,
27388
+ rowsPerPageOptions: rowsPerPageOptions,
27347
27389
  paginationProps: paginationProps,
27348
27390
  paginationMode: paginationMode
27349
27391
  })) : null
27350
27392
  }),
27351
- slotProps: _objectSpread2(_objectSpread2({}, slotProps), {}, {
27393
+ componentsProps: _objectSpread2(_objectSpread2({}, componentsProps), {}, {
27352
27394
  toolbar: _objectSpread2({
27353
27395
  hideToolbar,
27354
27396
  RenderedToolbar,
@@ -27359,13 +27401,15 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27359
27401
  selectionStatus,
27360
27402
  apiRef,
27361
27403
  isRowSelectable,
27362
- paginationModel,
27363
- onPaginationModelChange,
27364
- pageSizeOptions,
27404
+ page,
27405
+ onPageChange,
27406
+ pageSize,
27407
+ onPageSizeChange,
27408
+ rowsPerPageOptions,
27365
27409
  paginationProps,
27366
27410
  paginationMode,
27367
27411
  rowCount
27368
- }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar)
27412
+ }, componentsProps === null || componentsProps === void 0 ? void 0 : componentsProps.toolbar)
27369
27413
  }),
27370
27414
  filterModel: filterModel,
27371
27415
  columnVisibilityModel: columnVisibilityModel,
@@ -27381,11 +27425,13 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27381
27425
  paginationMode: paginationMode,
27382
27426
  keepNonExistentRowsSelected: paginationMode == 'server',
27383
27427
  rows: rows,
27384
- pageSizeOptions: pageSizeOptions,
27385
- paginationModel: paginationModel,
27386
- onPaginationModelChange: onPaginationModelChange,
27387
- rowSelectionModel: rowSelectionModel,
27388
- onRowSelectionModelChange: (newSelectionModel, details) => {
27428
+ rowsPerPageOptions: rowsPerPageOptions,
27429
+ page: page,
27430
+ onPageChange: onPageChange,
27431
+ pageSize: pageSize,
27432
+ onPageSizeChange: onPageSizeChange,
27433
+ selectionModel: selectionModel,
27434
+ onSelectionModelChange: (newSelectionModel, details) => {
27389
27435
  if (pagination && paginationMode != 'server') {
27390
27436
  const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
27391
27437
  let {
@@ -27443,7 +27489,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27443
27489
  };
27444
27490
  }
27445
27491
  }
27446
- onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
27492
+ onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(newSelectionModel, details);
27447
27493
  },
27448
27494
  sx: _objectSpread2(_objectSpread2({}, sx), {}, {
27449
27495
  '.MuiDataGrid-columnHeaders': {
@@ -27460,6 +27506,8 @@ DataGrid.className = CLASSNAME$2;
27460
27506
  DataGrid.displayName = COMPONENT_NAME$2;
27461
27507
 
27462
27508
  // Get and Set data from LocalStorage WITHOUT useState
27509
+
27510
+ // triggering a state update and consecutive re-render
27463
27511
  const useFetchState = (defaultValue, key) => {
27464
27512
  let stickyValue = null;
27465
27513
  try {
@@ -27467,7 +27515,16 @@ const useFetchState = (defaultValue, key) => {
27467
27515
  } catch (e) {
27468
27516
  console.error('StatefulDataGrid: error getting item from local storage: ', e);
27469
27517
  }
27470
- const parsedValue = stickyValue !== null && stickyValue !== undefined && stickyValue !== 'undefined' ? JSON.parse(stickyValue) : defaultValue;
27518
+ let parsedValue = stickyValue !== null && stickyValue !== undefined && stickyValue !== 'undefined' ? JSON.parse(stickyValue) : defaultValue;
27519
+
27520
+ // TODO: temporary workaround to avoid clashes when someone had sorting on the now-removed screenshot field (renamed to num_annotations)
27521
+ // Consider upgrading the Datagrid component library as the exception handling was added in this PR: https://github.com/mui-org/material-ui-x/pull/3224
27522
+ if (parsedValue instanceof Array) {
27523
+ const fields = (parsedValue || []).map(item => item.field);
27524
+ if (fields.includes('screenshot') || fields.includes('diffs')) {
27525
+ parsedValue = defaultValue;
27526
+ }
27527
+ }
27471
27528
  const updateValue = useCallback(value => {
27472
27529
  try {
27473
27530
  window.localStorage.setItem(key, JSON.stringify(value));
@@ -27478,8 +27535,6 @@ const useFetchState = (defaultValue, key) => {
27478
27535
  return [parsedValue, updateValue];
27479
27536
  };
27480
27537
 
27481
- // import useLocalStorage from './useLocalStorage';
27482
-
27483
27538
  const useTableStates = (id, version) => {
27484
27539
  const [paginationModel, setPaginationModel] = useFetchState('', buildStorageKey({
27485
27540
  id,
@@ -27536,11 +27591,13 @@ const useStatefulTable = props => {
27536
27591
  onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
27537
27592
  onColumnWidthChange: propsOnColumnWidthChange,
27538
27593
  onFilterModelChange: propsOnFilterModelChange,
27539
- onPaginationModelChange: propsOnPaginationModelChange,
27594
+ onPageChange: propsOnPageChange,
27595
+ onPageSizeChange: propsOnPageSizeChange,
27540
27596
  onPinnedColumnsChange: propsOnPinnedColumnsChange,
27541
27597
  onSortModelChange: propsOnSortModelChange,
27542
27598
  useRouter,
27543
- localStorageVersion = 2
27599
+ localStorageVersion = 1,
27600
+ previousLocalStorageVersions = []
27544
27601
  } = props;
27545
27602
  const {
27546
27603
  search,
@@ -27565,8 +27622,8 @@ const useStatefulTable = props => {
27565
27622
  setDimensionModel
27566
27623
  } = useTableStates(id, localStorageVersion);
27567
27624
 
27568
- // clearing up old version keys, triggering only on first render
27569
- useEffect(() => clearPreviousVersionStorage(id, localStorageVersion), [id, localStorageVersion]);
27625
+ // clearing up old version keys
27626
+ useEffect(() => clearPreviousVersionStorage(id, previousLocalStorageVersions), [id, previousLocalStorageVersions]);
27570
27627
  const onColumnDimensionChange = useCallback(_ref => {
27571
27628
  let {
27572
27629
  newWidth,
@@ -27582,7 +27639,7 @@ const useStatefulTable = props => {
27582
27639
  paginationModel: paginationModelParsed,
27583
27640
  columnVisibilityModel: visibilityModel,
27584
27641
  pinnedColumnsModel
27585
- } = getModelsParsedOrUpdateLocalStorage(search || '', propsColumns, historyReplace, initialState, {
27642
+ } = getModelsParsedOrUpdateLocalStorage(search || '', localStorageVersion, propsColumns, historyReplace, initialState, {
27586
27643
  localStorageFilters,
27587
27644
  setLocalStorageFilters,
27588
27645
  localStorageSorting: sortModel,
@@ -27598,6 +27655,7 @@ const useStatefulTable = props => {
27598
27655
  column.width = dimensionModel[column.field] || column.width || 100;
27599
27656
  return column;
27600
27657
  }), [propsColumns, dimensionModel]);
27658
+
27601
27659
  /** Add resetPage method to apiRef. */
27602
27660
  apiRef.current.resetPage = () => {
27603
27661
  apiRef.current.setPage(0);
@@ -27608,7 +27666,7 @@ const useStatefulTable = props => {
27608
27666
  onFilterModelChange: (model, details) => {
27609
27667
  const filterModel = _objectSpread2(_objectSpread2({}, model), {}, {
27610
27668
  items: model.items.map(item => {
27611
- const column = apiRef.current.getColumn(item.field);
27669
+ const column = apiRef.current.getColumn(item.columnField);
27612
27670
  item.type = column.type || 'string';
27613
27671
  return item;
27614
27672
  })
@@ -27620,7 +27678,7 @@ const useStatefulTable = props => {
27620
27678
  paginationModel: paginationModelParsed,
27621
27679
  columnsModel: apiRef.current.state.columns.columnVisibilityModel,
27622
27680
  pinnedColumnsModel: pinnedColumnsModel
27623
- }, search, historyReplace, columns);
27681
+ }, search, localStorageVersion, historyReplace, columns);
27624
27682
  },
27625
27683
  filterModel: filterParsed,
27626
27684
  onSortModelChange: (model, details) => {
@@ -27631,7 +27689,7 @@ const useStatefulTable = props => {
27631
27689
  paginationModel: paginationModelParsed,
27632
27690
  columnsModel: apiRef.current.state.columns.columnVisibilityModel,
27633
27691
  pinnedColumnsModel: pinnedColumnsModel
27634
- }, search, historyReplace, columns);
27692
+ }, search, localStorageVersion, historyReplace, columns);
27635
27693
  },
27636
27694
  sortModel: sortModelParsed,
27637
27695
  onPinnedColumnsChange: (pinnedColumns, details) => {
@@ -27642,22 +27700,39 @@ const useStatefulTable = props => {
27642
27700
  paginationModel: paginationModelParsed,
27643
27701
  columnsModel: apiRef.current.state.columns.columnVisibilityModel,
27644
27702
  pinnedColumnsModel: pinnedColumns
27645
- }, search, historyReplace, columns);
27703
+ }, search, localStorageVersion, historyReplace, columns);
27646
27704
  },
27647
27705
  pinnedColumns: pinnedColumnsModel,
27648
- paginationModel: paginationModelParsed,
27649
- onPaginationModelChange: (model, details) => {
27650
- const paginationModel = _objectSpread2(_objectSpread2({}, model), {}, {
27651
- direction: paginationModelParsed.page < model.page ? 'next' : 'back'
27652
- });
27653
- propsOnPaginationModelChange === null || propsOnPaginationModelChange === void 0 ? void 0 : propsOnPaginationModelChange(paginationModel, details);
27706
+ page: paginationModelParsed.page,
27707
+ pageSize: paginationModelParsed.pageSize,
27708
+ onPageChange: (page, details) => {
27709
+ const direction = paginationModelParsed.page < page ? 'next' : 'back';
27710
+ propsOnPageChange === null || propsOnPageChange === void 0 ? void 0 : propsOnPageChange(page, details);
27654
27711
  updateUrl({
27655
27712
  filterModel: filterParsed,
27656
27713
  sortModel: sortModelParsed,
27657
- paginationModel: paginationModel,
27714
+ paginationModel: {
27715
+ page,
27716
+ pageSize: paginationModelParsed.pageSize,
27717
+ direction
27718
+ },
27658
27719
  columnsModel: apiRef.current.state.columns.columnVisibilityModel,
27659
27720
  pinnedColumnsModel: pinnedColumnsModel
27660
- }, search, historyReplace, columns);
27721
+ }, search, localStorageVersion, historyReplace, columns);
27722
+ },
27723
+ onPageSizeChange: (pageSize, details) => {
27724
+ propsOnPageSizeChange === null || propsOnPageSizeChange === void 0 ? void 0 : propsOnPageSizeChange(pageSize, details);
27725
+ updateUrl({
27726
+ filterModel: filterParsed,
27727
+ sortModel: sortModelParsed,
27728
+ paginationModel: {
27729
+ page: paginationModelParsed.page,
27730
+ pageSize,
27731
+ direction: paginationModelParsed.direction
27732
+ },
27733
+ columnsModel: apiRef.current.state.columns.columnVisibilityModel,
27734
+ pinnedColumnsModel: pinnedColumnsModel
27735
+ }, search, localStorageVersion, historyReplace, columns);
27661
27736
  },
27662
27737
  columnVisibilityModel: visibilityModel,
27663
27738
  onColumnVisibilityModelChange: (columnsVisibilityModel, details) => {
@@ -27668,7 +27743,7 @@ const useStatefulTable = props => {
27668
27743
  paginationModel: paginationModelParsed,
27669
27744
  columnsModel: columnsVisibilityModel,
27670
27745
  pinnedColumnsModel: pinnedColumnsModel
27671
- }, search, historyReplace, columns);
27746
+ }, search, localStorageVersion, historyReplace, columns);
27672
27747
  },
27673
27748
  onColumnWidthChange: (params, event, details) => {
27674
27749
  propsOnColumnWidthChange === null || propsOnColumnWidthChange === void 0 ? void 0 : propsOnColumnWidthChange(params, event, details);
@@ -27680,7 +27755,7 @@ const useStatefulTable = props => {
27680
27755
  };
27681
27756
  };
27682
27757
 
27683
- const _excluded$1 = ["apiRef", "autoHeight", "className", "columns", "slots", "slotProps", "filterModel", "columnVisibilityModel", "pinnedColumns", "sortModel", "paginationModel", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "localStorageVersion", "onFilterModelChange", "rowSelectionModel", "onColumnWidthChange", "onPaginationModelChange", "onRowSelectionModelChange", "onColumnVisibilityModelChange", "onPinnedColumnsChange", "onSortModelChange", "pagination", "paginationPlacement", "paginationProps", "rows", "pageSizeOptions", "sx", "theme", "useRouter", "paginationMode", "rowCount"];
27758
+ const _excluded$1 = ["apiRef", "autoHeight", "className", "columns", "columnTypes", "components", "componentsProps", "filterModel", "columnVisibilityModel", "pinnedColumns", "sortModel", "page", "pageSize", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "localStorageVersion", "previousLocalStorageVersions", "onFilterModelChange", "selectionModel", "onColumnWidthChange", "onPageChange", "onPageSizeChange", "onSelectionModelChange", "onColumnVisibilityModelChange", "onPinnedColumnsChange", "onSortModelChange", "pagination", "paginationPlacement", "paginationProps", "rows", "rowsPerPageOptions", "sx", "theme", "useRouter", "paginationMode", "rowCount"];
27684
27759
  const COMPONENT_NAME$1 = 'DataGrid';
27685
27760
  const CLASSNAME$1 = 'redsift-datagrid';
27686
27761
  const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
@@ -27690,24 +27765,28 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27690
27765
  autoHeight,
27691
27766
  className,
27692
27767
  columns,
27693
- slots,
27694
- slotProps,
27768
+ columnTypes: propsColumnTypes,
27769
+ components,
27770
+ componentsProps,
27695
27771
  filterModel: propsFilterModel,
27696
27772
  columnVisibilityModel: propsColumnVisibilityModel,
27697
27773
  pinnedColumns: propsPinnedColumns,
27698
27774
  sortModel: propsSortModel,
27699
- paginationModel: propsPaginationModel,
27775
+ page: propsPage,
27776
+ pageSize: propsPageSize,
27700
27777
  height: propsHeight,
27701
27778
  hideToolbar,
27702
27779
  initialState,
27703
27780
  isRowSelectable,
27704
27781
  license = process.env.MUI_LICENSE_KEY,
27705
27782
  localStorageVersion,
27783
+ previousLocalStorageVersions,
27706
27784
  onFilterModelChange: propsOnFilterModelChange,
27707
- rowSelectionModel: propsRowSelectionModel,
27785
+ selectionModel: propsSelectionModel,
27708
27786
  onColumnWidthChange: propsOnColumnWidthChange,
27709
- onPaginationModelChange: propsOnPaginationModelChange,
27710
- onRowSelectionModelChange: propsOnRowSelectionModelChange,
27787
+ onPageChange: propsOnPageChange,
27788
+ onPageSizeChange: propsOnPageSizeChange,
27789
+ onSelectionModelChange: propsOnSelectionModelChange,
27711
27790
  onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
27712
27791
  onPinnedColumnsChange: propsOnPinnedColumnsChange,
27713
27792
  onSortModelChange: propsOnSortModelChange,
@@ -27715,7 +27794,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27715
27794
  paginationPlacement = 'both',
27716
27795
  paginationProps,
27717
27796
  rows,
27718
- pageSizeOptions,
27797
+ rowsPerPageOptions,
27719
27798
  sx,
27720
27799
  theme: propsTheme,
27721
27800
  useRouter,
@@ -27726,38 +27805,43 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27726
27805
  const theme = useTheme$4(propsTheme);
27727
27806
  const _apiRef = useGridApiRef();
27728
27807
  const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
27729
- const RenderedToolbar = slots !== null && slots !== void 0 && slots.toolbar ? slots.toolbar : Toolbar$2;
27808
+ const RenderedToolbar = components !== null && components !== void 0 && components.Toolbar ? components.Toolbar : Toolbar$2;
27730
27809
  LicenseInfo.setLicenseKey(license);
27731
27810
  const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
27732
27811
  const {
27733
27812
  onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
27734
27813
  onFilterModelChange: controlledOnFilterModelChange,
27735
- onPaginationModelChange: controlledOnPaginationModelChange,
27814
+ onPageChange: controlledOnPageChange,
27815
+ onPageSizeChange: controlledOnPageSizeChange,
27736
27816
  onPinnedColumnsChange: controlledOnPinnedColumnsChange,
27737
27817
  onSortModelChange: controlledOnSortModelChange
27738
27818
  } = useControlledDatagridState({
27739
27819
  initialState,
27740
- pageSizeOptions,
27820
+ rowsPerPageOptions,
27741
27821
  propsColumnVisibilityModel,
27742
27822
  propsFilterModel,
27743
27823
  propsOnColumnVisibilityModelChange,
27744
27824
  propsOnFilterModelChange,
27745
27825
  propsOnPinnedColumnsChange,
27746
27826
  propsOnSortModelChange,
27747
- propsPaginationModel,
27827
+ propsPage,
27828
+ propsPageSize,
27748
27829
  propsPinnedColumns,
27749
27830
  propsSortModel,
27750
- propsOnPaginationModelChange
27831
+ propsOnPageChange,
27832
+ propsOnPageSizeChange
27751
27833
  });
27752
27834
  const {
27753
27835
  columnVisibilityModel,
27754
27836
  filterModel,
27755
27837
  onColumnVisibilityModelChange,
27756
27838
  onFilterModelChange,
27757
- onPaginationModelChange,
27839
+ onPageChange,
27840
+ onPageSizeChange,
27758
27841
  onPinnedColumnsChange,
27759
27842
  onSortModelChange,
27760
- paginationModel,
27843
+ page,
27844
+ pageSize,
27761
27845
  pinnedColumns,
27762
27846
  sortModel,
27763
27847
  onColumnWidthChange
@@ -27768,38 +27852,40 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27768
27852
  onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
27769
27853
  onColumnWidthChange: propsOnColumnWidthChange,
27770
27854
  onFilterModelChange: controlledOnFilterModelChange,
27771
- onPaginationModelChange: controlledOnPaginationModelChange,
27855
+ onPageChange: controlledOnPageChange,
27856
+ onPageSizeChange: controlledOnPageSizeChange,
27772
27857
  onPinnedColumnsChange: controlledOnPinnedColumnsChange,
27773
27858
  onSortModelChange: controlledOnSortModelChange,
27774
27859
  useRouter: useRouter,
27775
- localStorageVersion
27860
+ localStorageVersion,
27861
+ previousLocalStorageVersions
27776
27862
  });
27777
- const [rowSelectionModel, setRowSelectionModel] = useState(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
27863
+ const [selectionModel, setSelectionModel] = useState(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
27778
27864
  useEffect(() => {
27779
- setRowSelectionModel(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
27780
- }, [propsRowSelectionModel]);
27781
- const onRowSelectionModelChange = (selectionModel, details) => {
27782
- if (propsOnRowSelectionModelChange) {
27783
- propsOnRowSelectionModelChange(selectionModel, details);
27865
+ setSelectionModel(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
27866
+ }, [propsSelectionModel]);
27867
+ const onSelectionModelChange = (selectionModel, details) => {
27868
+ if (propsOnSelectionModelChange) {
27869
+ propsOnSelectionModelChange(selectionModel, details);
27784
27870
  } else {
27785
- setRowSelectionModel(selectionModel);
27871
+ setSelectionModel(selectionModel);
27786
27872
  }
27787
27873
  };
27788
27874
  const selectionStatus = useRef({
27789
27875
  type: 'none',
27790
27876
  numberOfSelectedRows: 0,
27791
27877
  numberOfSelectedRowsInPage: 0,
27792
- page: paginationModel.page,
27793
- pageSize: paginationModel.pageSize
27878
+ page,
27879
+ pageSize: pageSize
27794
27880
  });
27795
27881
 
27796
27882
  // in server-side pagination we want to update the selection status
27797
27883
  // every time we navigate between pages, resize our page or select something
27798
27884
  useEffect(() => {
27799
27885
  if (paginationMode == 'server') {
27800
- onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatus, isRowSelectable, paginationModel.page, paginationModel.pageSize);
27886
+ onServerSideSelectionStatusChange(Array.isArray(selectionModel) ? selectionModel : [selectionModel], apiRef, selectionStatus, isRowSelectable, page, pageSize);
27801
27887
  }
27802
- }, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
27888
+ }, [selectionModel, page, pageSize]);
27803
27889
  if (!Array.isArray(rows)) {
27804
27890
  return null;
27805
27891
  }
@@ -27832,13 +27918,15 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27832
27918
  filterModel: filterModel,
27833
27919
  onColumnVisibilityModelChange: onColumnVisibilityModelChange,
27834
27920
  onFilterModelChange: onFilterModelChange,
27835
- onPaginationModelChange: onPaginationModelChange,
27921
+ onPageChange: onPageChange,
27922
+ onPageSizeChange: onPageSizeChange,
27836
27923
  onPinnedColumnsChange: onPinnedColumnsChange,
27837
27924
  onSortModelChange: onSortModelChange,
27838
- paginationModel: paginationModel,
27925
+ page: page,
27926
+ pageSize: pageSize,
27839
27927
  pinnedColumns: pinnedColumns,
27840
27928
  sortModel: sortModel,
27841
- pageSizeOptions: pageSizeOptions,
27929
+ rowsPerPageOptions: rowsPerPageOptions,
27842
27930
  onColumnWidthChange: onColumnWidthChange,
27843
27931
  initialState: initialState,
27844
27932
  isRowSelectable: isRowSelectable,
@@ -27849,55 +27937,58 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27849
27937
  rowCount: rowCount,
27850
27938
  autoHeight: autoHeight,
27851
27939
  checkboxSelectionVisibleOnly: Boolean(pagination),
27852
- slots: _objectSpread2(_objectSpread2({
27853
- baseButton: BaseButton,
27854
- baseCheckbox: BaseCheckbox,
27855
- // baseTextField,
27856
- basePopper: BasePopper,
27857
- columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27940
+ columnTypes: _objectSpread2(_objectSpread2({}, customColumnTypes), propsColumnTypes),
27941
+ components: _objectSpread2(_objectSpread2({
27942
+ BaseButton,
27943
+ BaseCheckbox,
27944
+ // BaseTextField,
27945
+ BasePopper,
27946
+ ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27858
27947
  displayName: "ColumnFilteredIcon"
27859
27948
  })),
27860
- columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27949
+ ColumnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27861
27950
  displayName: "ColumnSelectorIcon"
27862
27951
  })),
27863
- columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27952
+ ColumnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27864
27953
  displayName: "ColumnSortedAscendingIcon"
27865
27954
  })),
27866
- columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27955
+ ColumnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27867
27956
  displayName: "ColumnSortedDescendingIcon"
27868
27957
  })),
27869
- densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27958
+ DensityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27870
27959
  displayName: "DensityCompactIcon"
27871
27960
  })),
27872
- densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27961
+ DensityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27873
27962
  displayName: "DensityStandardIcon"
27874
27963
  })),
27875
- densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27964
+ DensityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27876
27965
  displayName: "DensityComfortableIcon"
27877
27966
  })),
27878
- detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27967
+ DetailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27879
27968
  displayName: "DetailPanelCollapseIcon"
27880
27969
  })),
27881
- detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27970
+ DetailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27882
27971
  displayName: "DetailPanelExpandIcon"
27883
27972
  })),
27884
- exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27973
+ ExportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27885
27974
  displayName: "ExportIcon"
27886
27975
  })),
27887
- openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
27976
+ OpenFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
27888
27977
  displayName: "OpenFilterButtonIcon"
27889
27978
  }, props))
27890
- }, slots), {}, {
27891
- toolbar: ToolbarWrapper,
27892
- pagination: props => {
27979
+ }, components), {}, {
27980
+ Toolbar: ToolbarWrapper,
27981
+ Pagination: props => {
27893
27982
  return pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$1({}, props, {
27894
27983
  displaySelection: false,
27895
27984
  displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
27896
27985
  displayPagination: ['bottom', 'both'].includes(paginationPlacement),
27897
27986
  selectionStatus: selectionStatus.current,
27898
- paginationModel: paginationModel,
27899
- onPaginationModelChange: onPaginationModelChange,
27900
- pageSizeOptions: pageSizeOptions,
27987
+ page: page,
27988
+ pageSize: pageSize,
27989
+ onPageChange: onPageChange,
27990
+ onPageSizeChange: onPageSizeChange,
27991
+ rowsPerPageOptions: rowsPerPageOptions,
27901
27992
  paginationProps: paginationProps,
27902
27993
  paginationMode: paginationMode,
27903
27994
  rowCount: rowCount
@@ -27908,15 +27999,17 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27908
27999
  selectionStatus: selectionStatus.current,
27909
28000
  apiRef: apiRef,
27910
28001
  isRowSelectable: isRowSelectable,
27911
- paginationModel: paginationModel,
27912
- onPaginationModelChange: onPaginationModelChange,
27913
- pageSizeOptions: pageSizeOptions,
28002
+ page: page,
28003
+ pageSize: pageSize,
28004
+ onPageChange: onPageChange,
28005
+ onPageSizeChange: onPageSizeChange,
28006
+ rowsPerPageOptions: rowsPerPageOptions,
27914
28007
  paginationProps: paginationProps,
27915
28008
  paginationMode: paginationMode
27916
28009
  })) : null;
27917
28010
  }
27918
28011
  }),
27919
- slotProps: _objectSpread2(_objectSpread2({}, slotProps), {}, {
28012
+ componentsProps: _objectSpread2(_objectSpread2({}, componentsProps), {}, {
27920
28013
  toolbar: _objectSpread2({
27921
28014
  hideToolbar,
27922
28015
  RenderedToolbar,
@@ -27927,16 +28020,18 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27927
28020
  selectionStatus,
27928
28021
  apiRef,
27929
28022
  isRowSelectable,
27930
- paginationModel,
27931
- onPaginationModelChange,
27932
- pageSizeOptions,
28023
+ page,
28024
+ pageSize,
28025
+ onPageChange,
28026
+ onPageSizeChange,
28027
+ rowsPerPageOptions,
27933
28028
  paginationProps,
27934
28029
  paginationMode,
27935
28030
  rowCount
27936
- }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar)
28031
+ }, componentsProps === null || componentsProps === void 0 ? void 0 : componentsProps.toolbar)
27937
28032
  }),
27938
- rowSelectionModel: rowSelectionModel,
27939
- onRowSelectionModelChange: (newSelectionModel, details) => {
28033
+ selectionModel: selectionModel,
28034
+ onSelectionModelChange: (newSelectionModel, details) => {
27940
28035
  if (pagination && paginationMode != 'server') {
27941
28036
  const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
27942
28037
  let {
@@ -27994,7 +28089,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27994
28089
  };
27995
28090
  }
27996
28091
  }
27997
- onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
28092
+ onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(newSelectionModel, details);
27998
28093
  },
27999
28094
  sx: _objectSpread2(_objectSpread2({}, sx), {}, {
28000
28095
  '.MuiDataGrid-columnHeaders': {
@@ -28068,5 +28163,5 @@ const TextCell = /*#__PURE__*/forwardRef((props, ref) => {
28068
28163
  TextCell.className = CLASSNAME;
28069
28164
  TextCell.displayName = COMPONENT_NAME;
28070
28165
 
28071
- export { BaseButton, BaseCheckbox, BaseIcon, BasePopper, BaseTextField, CATEGORIES, CONTAINS_ANY_OF, CONTAINS_ANY_OF_I, ControlledPagination, DEFAULT_OPERATORS, DETAIL_PANEL_TOGGLE_COL_DEF, DIMENSION_MODEL_KEY, DOES_NOT_CONTAIN, DOES_NOT_EQUAL, DataGrid, ENDS_WITH_ANY_OF, FILTER_MODEL_KEY, FILTER_SEARCH_KEY, GridToolbarFilterSemanticField, IS_ANY_OF, IS_BETWEEN, IS_NOT_ANY_OF, PAGINATION_MODEL_KEY, PINNED_COLUMNS, SORT_MODEL_KEY, STARTS_WITH_ANY_OF, ServerSideControlledPagination, StatefulDataGrid, TextCell, Toolbar$2 as Toolbar, ToolbarWrapper, 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 };
28166
+ export { BaseButton, BaseCheckbox, BaseIcon, BasePopper, BaseTextField, CATEGORIES, CONTAINS_ANY_OF, CONTAINS_ANY_OF_I, ControlledPagination, DEFAULT_OPERATORS, DETAIL_PANEL_TOGGLE_COL_DEF, DIMENSION_MODEL_KEY, DOES_NOT_CONTAIN, DOES_NOT_EQUAL, DataGrid, ENDS_WITH_ANY_OF, FILTER_MODEL_KEY, FILTER_SEARCH_KEY, GridToolbarFilterSemanticField, IS_ANY_OF, IS_BETWEEN, IS_NOT_ANY_OF, PAGINATION_MODEL_KEY, PINNED_COLUMNS, SORT_MODEL_KEY, STARTS_WITH_ANY_OF, ServerSideControlledPagination, StatefulDataGrid, TextCell, Toolbar$2 as Toolbar, ToolbarWrapper, 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 };
28072
28167
  //# sourceMappingURL=index.js.map