@redsift/table 11.3.1-muiv5 → 11.3.1

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 +26 -32
  2. package/index.js +289 -400
  3. package/index.js.map +1 -1
  4. package/package.json +4 -4
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, GridLinkOperator, GridToolbarContainer, GridToolbarFilterButton, GridToolbarColumnsButton, GridToolbarDensitySelector, GridToolbarExport, gridVisibleSortedRowIdsSelector, GridToolbarQuickFilter, 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, GridLogicOperator, GridToolbarContainer, GridToolbarFilterButton, GridToolbarColumnsButton, GridToolbarDensitySelector, GridToolbarExport, gridExpandedSortedRowIdsSelector, GridToolbarQuickFilter, 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.columnField || !filterItem.value || !filterItem.operatorValue) {
17642
+ if (!filterItem.field || !filterItem.value || !filterItem.operator) {
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 && filterItem.value[0] <= params.value && params.value <= filterItem.value[1];
17655
+ return params.value !== null && params.value !== undefined && 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.columnField || !filterItem.value || !filterItem.operatorValue) {
17668
+ if (!filterItem.field || !filterItem.value || !filterItem.value) {
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.columnField || !filterItem.value || !filterItem.operatorValue) {
17689
+ if (!filterItem.field || !filterItem.value || !filterItem.operator) {
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.columnField || !filterItem.value || !filterItem.operatorValue) {
17710
+ if (!filterItem.field || !filterItem.value || !filterItem.operator) {
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.columnField || !filterItem.value || !filterItem.operatorValue) {
17733
+ if (!filterItem.field || !filterItem.value || !filterItem.operator) {
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.columnField || !filterItem.value || !filterItem.operatorValue) {
17760
+ if (!filterItem.field || !filterItem.value || !filterItem.operator) {
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.columnField || !filterItem.value || !filterItem.operatorValue) {
17787
+ if (!filterItem.field || !filterItem.value || !filterItem.operator) {
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.columnField || !filterItem.value || !filterItem.operatorValue) {
17811
+ if (!filterItem.field || !filterItem.value || !filterItem.operator) {
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.columnField || !filterItem.value || !filterItem.operatorValue) {
17835
+ if (!filterItem.field || !filterItem.value || !filterItem.operator) {
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
- extendType: 'string',
17880
+ type: 'string',
17881
17881
  filterOperators: operatorList.rsString
17882
17882
  };
17883
17883
  };
17884
17884
  const getRsNumberColumnType = () => {
17885
17885
  return {
17886
- extendType: 'number',
17886
+ type: '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-0613';
17897
+ let model = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'gpt-3.5-turbo-1106';
17898
17898
  try {
17899
17899
  const messages = [{
17900
17900
  role: 'system',
@@ -18061,42 +18061,39 @@ const numberOperatorDecoder = {
18061
18061
  lt: '<',
18062
18062
  lte: '<='
18063
18063
  };
18064
- const isOperatorValueValid = (columnField, operatorValue, columns) => {
18065
- const column = columns.find(column => column.field === columnField);
18064
+ const isOperatorValueValid = (field, operator, columns) => {
18065
+ const column = columns.find(column => column.field === field);
18066
18066
  if (!column) {
18067
18067
  return false;
18068
18068
  }
18069
18069
  const columnType = (column === null || column === void 0 ? void 0 : column.type) || 'string';
18070
- const operators = operatorList[columnType];
18070
+ const operators = column.filterOperators || operatorList[columnType];
18071
18071
  if (!operators) {
18072
18072
  return false;
18073
18073
  }
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);
18074
+ return !!operators.find(op => columnType === 'number' && Object.keys(numberOperatorEncoder).includes(op.value) ? numberOperatorEncoder[op.value] === operator : op.value === operator);
18078
18075
  };
18079
18076
  const listOperators = ['containsAnyOf', 'endsWithAnyOf', 'isAnyOf', 'isNotAnyOf', 'startsWithAnyOf'];
18080
18077
 
18081
18078
  // Check if the value doesn't break
18082
- const isValueValid = (value, columnField, columns, operatorValue) => {
18079
+ const isValueValid = (value, field, columns, operator) => {
18083
18080
  var _column$type;
18084
18081
  // every field accepts undefined as value for default
18085
18082
  if (value === undefined || value === '') {
18086
18083
  return true;
18087
18084
  }
18088
18085
 
18089
- // xxxAnyOf accepts as value only lists, and we are declearing them in the
18086
+ // xxxAnyOf accepts as value only lists, and we are declaring them in the
18090
18087
  // URL as `list=[...]`
18091
- if (listOperators.includes(operatorValue)) {
18088
+ if (listOperators.includes(operator)) {
18092
18089
  return Array.isArray(value) || value === '';
18093
18090
  }
18094
18091
 
18095
18092
  // We are accepting arrays only if they are of the 'xxxAnyOf' type
18096
- if (Array.isArray(value) && !listOperators.includes(operatorValue)) {
18093
+ if (Array.isArray(value) && !listOperators.includes(operator)) {
18097
18094
  return false;
18098
18095
  }
18099
- const column = columns.find(column => column.field === columnField);
18096
+ const column = columns.find(column => column.field === field);
18100
18097
  if (!column) {
18101
18098
  return false;
18102
18099
  }
@@ -18134,7 +18131,7 @@ const getFilterModelFromString = (searchString, columns) => {
18134
18131
  if (!searchString) {
18135
18132
  return 'invalid';
18136
18133
  }
18137
- let linkOperator = GridLinkOperator.And;
18134
+ let logicOperator = GridLogicOperator.And;
18138
18135
  let quickFilterValues = [];
18139
18136
  const searchParams = new URLSearchParams();
18140
18137
  for (const [key, value] of new URLSearchParams(searchString)) {
@@ -18142,7 +18139,7 @@ const getFilterModelFromString = (searchString, columns) => {
18142
18139
  searchParams.set(key, value);
18143
18140
  }
18144
18141
  if (key === '_logicOperator') {
18145
- linkOperator = value;
18142
+ logicOperator = value === GridLogicOperator.And || value === GridLogicOperator.Or ? value : GridLogicOperator.And;
18146
18143
  }
18147
18144
  if (key === '_quickFilterValues') {
18148
18145
  try {
@@ -18161,7 +18158,7 @@ const getFilterModelFromString = (searchString, columns) => {
18161
18158
  if (isInvalid) {
18162
18159
  return;
18163
18160
  }
18164
- const field = key.split('[')[0].slice(1); // Slice to remove the _ at the beginning
18161
+ const field = key.split('[')[0].slice(1);
18165
18162
  if (!fields.includes(field)) {
18166
18163
  return;
18167
18164
  }
@@ -18178,7 +18175,6 @@ const getFilterModelFromString = (searchString, columns) => {
18178
18175
  return;
18179
18176
  }
18180
18177
  const operator = splitRight[0];
18181
- // if the operator is not part of the valid operators invalidate the URL
18182
18178
  if (!isOperatorValueValid(field, operator, columns) || Array.isArray(operator)) {
18183
18179
  isInvalid = true;
18184
18180
  return;
@@ -18190,41 +18186,37 @@ const getFilterModelFromString = (searchString, columns) => {
18190
18186
  return;
18191
18187
  }
18192
18188
  items.push({
18193
- columnField: field,
18194
- operatorValue: ['number', 'rsNumber'].includes(columnType) && Object.keys(numberOperatorDecoder).includes(operator) ? numberOperatorDecoder[operator] : operator,
18189
+ field,
18190
+ operator: columnType === 'number' && Object.keys(numberOperatorDecoder).includes(operator) ? numberOperatorDecoder[operator] : operator,
18195
18191
  id,
18196
18192
  value: listOperators.includes(operator) && decodedValue === '' ? [] : decodedValue,
18197
18193
  type
18198
18194
  });
18199
18195
  });
18200
-
18201
- // If we found some condition that results in an invalid URL,
18202
- // return the empty filterModel (this will trigger the localStorage)
18203
- // and will pick up the last valid search
18204
18196
  if (isInvalid) {
18205
18197
  return 'invalid';
18206
18198
  }
18207
18199
  return {
18208
18200
  items,
18209
- linkOperator,
18201
+ logicOperator,
18210
18202
  quickFilterValues
18211
18203
  };
18212
18204
  };
18213
18205
  const getSearchParamsFromFilterModel = filterModel => {
18214
18206
  var _filterModel$quickFil;
18215
18207
  const searchParams = new URLSearchParams();
18216
- searchParams.set('_logicOperator', filterModel['linkOperator'] || '');
18208
+ searchParams.set('_logicOperator', filterModel['logicOperator'] || '');
18217
18209
  filterModel['items'].forEach(item => {
18218
18210
  const {
18219
- columnField,
18220
- operatorValue,
18211
+ field,
18212
+ operator,
18221
18213
  value,
18222
18214
  type
18223
18215
  } = item;
18224
- if (Object.keys(numberOperatorEncoder).includes(operatorValue)) {
18225
- searchParams.set(`_${columnField}[${numberOperatorEncoder[operatorValue]},${encodeValue(type)}]`, encodeValue(value));
18216
+ if (Object.keys(numberOperatorEncoder).includes(operator)) {
18217
+ searchParams.set(`_${field}[${numberOperatorEncoder[operator]},${encodeValue(type)}]`, encodeValue(value));
18226
18218
  } else {
18227
- searchParams.set(`_${columnField}[${encodeValue(operatorValue)},${encodeValue(type)}]`, encodeValue(value));
18219
+ searchParams.set(`_${field}[${encodeValue(operator)},${encodeValue(type)}]`, encodeValue(value));
18228
18220
  }
18229
18221
  });
18230
18222
  if ((_filterModel$quickFil = filterModel.quickFilterValues) !== null && _filterModel$quickFil !== void 0 && _filterModel$quickFil.length) {
@@ -18240,7 +18232,7 @@ const getSearchParamsFromFilterModel = filterModel => {
18240
18232
  const getFilterModel = (search, columns, localStorageFilters, setLocalStorageFilters, initialState, isNewVersion) => {
18241
18233
  const defaultValue = initialState && initialState.filter && initialState.filter.filterModel ? initialState.filter.filterModel : {
18242
18234
  items: [],
18243
- linkOperator: GridLinkOperator.And
18235
+ logicOperator: GridLogicOperator.And
18244
18236
  };
18245
18237
  if (isNewVersion) {
18246
18238
  return defaultValue;
@@ -18379,13 +18371,38 @@ const getPaginationModel = (search, localStoragePagination, setLocalStoragePagin
18379
18371
 
18380
18372
  /** COLUMN VISIBILITY */
18381
18373
 
18374
+ const getColumnVisibilityFromString = (searchString, columns) => {
18375
+ if (!searchString) {
18376
+ return 'invalid';
18377
+ }
18378
+ const searchParams = new URLSearchParams(searchString);
18379
+ const value = searchParams.get('_columnVisibility');
18380
+ if (value === '' || value === null || value === '[]') {
18381
+ return 'invalid';
18382
+ }
18383
+ const parsedFields = value.slice(1, value.length - 1).split(',');
18384
+ const fields = columns.map(column => column.field);
18385
+ const visibility = {};
18386
+ for (const field of fields) {
18387
+ visibility[field] = false;
18388
+ }
18389
+ for (const parsedField of parsedFields) {
18390
+ if (fields.includes(parsedField)) {
18391
+ visibility[parsedField] = true;
18392
+ }
18393
+ }
18394
+ if (Object.values(visibility).filter(v => v === true).length === 0) {
18395
+ return 'invalid';
18396
+ }
18397
+ return visibility;
18398
+ };
18382
18399
  const getSearchParamsFromColumnVisibility = (columnVisibility, columns) => {
18383
18400
  const searchParams = new URLSearchParams();
18384
- const columnFields = columns.map(column => column.field);
18401
+ const fields = columns.map(column => column.field);
18385
18402
 
18386
18403
  // if column visibility model is empty, show all columns
18387
18404
  if (Object.keys(columnVisibility).length == 0) {
18388
- searchParams.set('_columnVisibility', `[${columnFields.join(',')}]`);
18405
+ searchParams.set('_columnVisibility', `[${fields.join(',')}]`);
18389
18406
  return searchParams;
18390
18407
  }
18391
18408
  const finalColumnVisibility = columns.filter(c => {
@@ -18396,63 +18413,10 @@ const getSearchParamsFromColumnVisibility = (columnVisibility, columns) => {
18396
18413
  [colName]: true
18397
18414
  });
18398
18415
  }, columnVisibility);
18399
- const visibleColumns = Object.entries(finalColumnVisibility)
18400
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
18401
- .filter(_ref => {
18402
- let [_, visible] = _ref;
18403
- return visible;
18404
- })
18405
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
18406
- .map(_ref2 => {
18407
- let [column, _] = _ref2;
18408
- return encodeValue(column);
18409
- });
18416
+ const visibleColumns = fields.filter(column => finalColumnVisibility[column] !== false);
18410
18417
  searchParams.set('_columnVisibility', `[${visibleColumns.join(',')}]`);
18411
18418
  return searchParams;
18412
18419
  };
18413
- const getColumnVisibilityFromString = (notParsed, tableColumns) => {
18414
- if (!notParsed || notParsed.length === 1 && notParsed[0] === '?') {
18415
- return 'invalid';
18416
- }
18417
- // remove the initial ? if present
18418
- const parsed = notParsed[0] === '?' ? notParsed.slice(1) : notParsed;
18419
- const visibility = {};
18420
- let exist = false;
18421
- let visibleColumnsCount = 0;
18422
- for (const item of parsed.split('&')) {
18423
- // if it's not column visibility field, skip
18424
- const fieldURL = item.split('=')[0];
18425
- if (fieldURL !== '_columnVisibility') {
18426
- continue;
18427
- }
18428
- // e.g. item = _columnVisibility[abc,def]
18429
- const left = item.split(']')[0];
18430
- if (left.split('[').length < 2) {
18431
- continue;
18432
- }
18433
- const encodedValues = item.split('[')[1].split(']')[0];
18434
- if (typeof encodedValues !== 'string') {
18435
- continue;
18436
- }
18437
- exist = true;
18438
- const columnFields = tableColumns.map(column => column.field);
18439
- // TODO: Add validation that , is present
18440
- const columns = encodedValues.split(',').map(value => decodeValue(value));
18441
-
18442
- // for each column, check if it's visible and add it to visibility model
18443
- for (const column of columnFields) {
18444
- const isColumnVisible = columns.includes(column);
18445
- visibility[column] = isColumnVisible;
18446
- if (isColumnVisible) {
18447
- visibleColumnsCount += 1;
18448
- }
18449
- }
18450
- }
18451
- if (visibleColumnsCount === 0 && !exist) {
18452
- return 'invalid';
18453
- }
18454
- return visibility;
18455
- };
18456
18420
 
18457
18421
  // Rules:
18458
18422
  // - if we have something in the URL, use that info
@@ -18513,8 +18477,8 @@ const getPinnedColumnsFromString = (notParsed, tableColumns) => {
18513
18477
  if (typeof encodedValues !== 'string') {
18514
18478
  continue;
18515
18479
  }
18516
- const columnFields = [...tableColumns.map(column => column.field), '__check__'];
18517
- const columns = encodedValues.split(',').map(value => decodeValue(value)).filter(val => typeof val === 'string' && columnFields.includes(val));
18480
+ const fields = [...tableColumns.map(column => column.field), '__check__'];
18481
+ const columns = encodedValues.split(',').map(value => decodeValue(value)).filter(val => typeof val === 'string' && fields.includes(val));
18518
18482
  if (fieldURL === '_pinnedColumnsLeft') {
18519
18483
  pinnedColumns['left'] = columns;
18520
18484
  }
@@ -18522,9 +18486,9 @@ const getPinnedColumnsFromString = (notParsed, tableColumns) => {
18522
18486
  pinnedColumns['right'] = columns;
18523
18487
  }
18524
18488
  }
18525
- return pinnedColumns['left'] || pinnedColumns['right'] ? {
18526
- left: pinnedColumns['left'] || [],
18527
- right: pinnedColumns['right'] || []
18489
+ return pinnedColumns.left && pinnedColumns.left.length > 0 || pinnedColumns.right && pinnedColumns.right.length > 0 ? {
18490
+ left: pinnedColumns.left || [],
18491
+ right: pinnedColumns.right || []
18528
18492
  } : 'invalid';
18529
18493
  };
18530
18494
  const getSearchParamsFromPinnedColumns = pinnedColumns => {
@@ -18574,7 +18538,7 @@ const getSearchParamsFromTab = search => {
18574
18538
  }
18575
18539
  return searchParams;
18576
18540
  };
18577
- const getFinalSearch = _ref3 => {
18541
+ const getFinalSearch = _ref => {
18578
18542
  let {
18579
18543
  search,
18580
18544
  localStorageVersion,
@@ -18584,7 +18548,7 @@ const getFinalSearch = _ref3 => {
18584
18548
  columnsVisibilityModel,
18585
18549
  pinnedColumnsModel,
18586
18550
  columns
18587
- } = _ref3;
18551
+ } = _ref;
18588
18552
  const filterModelSearch = getSearchParamsFromFilterModel(filterModel);
18589
18553
  const sortModelSearch = getSearchParamsFromSorting(sortModel);
18590
18554
  const paginationModelSearch = getSearchParamsFromPagination(paginationModel);
@@ -18649,14 +18613,14 @@ const getModelsParsedOrUpdateLocalStorage = (search, localStorageVersion, column
18649
18613
  pinnedColumnsModel
18650
18614
  };
18651
18615
  };
18652
- const updateUrl = (_ref4, search, localStorageVersion, historyReplace, columns) => {
18616
+ const updateUrl = (_ref2, search, localStorageVersion, historyReplace, columns) => {
18653
18617
  let {
18654
18618
  filterModel,
18655
18619
  sortModel,
18656
18620
  paginationModel,
18657
18621
  columnsModel: columnsVisibilityModel,
18658
18622
  pinnedColumnsModel
18659
- } = _ref4;
18623
+ } = _ref2;
18660
18624
  const newSearch = getFinalSearch({
18661
18625
  search,
18662
18626
  localStorageVersion,
@@ -18677,17 +18641,17 @@ const updateUrl = (_ref4, search, localStorageVersion, historyReplace, columns)
18677
18641
  // do not use it for equivalence (e.g. with value `3` and undefined we
18678
18642
  // will get 0).
18679
18643
  const compareFilters = (firstFilter, secondFilter) => {
18680
- if (firstFilter.columnField < secondFilter.columnField) {
18644
+ if (firstFilter.field < secondFilter.field) {
18681
18645
  return -1;
18682
- } else if (firstFilter.columnField > secondFilter.columnField) {
18646
+ } else if (firstFilter.field > secondFilter.field) {
18683
18647
  return 1;
18684
18648
  }
18685
- if (firstFilter.operatorValue === undefined || secondFilter.operatorValue === undefined) {
18649
+ if (firstFilter.operator === undefined || secondFilter.operator === undefined) {
18686
18650
  return 0;
18687
18651
  }
18688
- if (firstFilter.operatorValue < secondFilter.operatorValue) {
18652
+ if (firstFilter.operator < secondFilter.operator) {
18689
18653
  return -1;
18690
- } else if (firstFilter.operatorValue > secondFilter.operatorValue) {
18654
+ } else if (firstFilter.operator > secondFilter.operator) {
18691
18655
  return 1;
18692
18656
  }
18693
18657
  if (firstFilter.value < secondFilter.value) {
@@ -18698,18 +18662,18 @@ const compareFilters = (firstFilter, secondFilter) => {
18698
18662
  return 0;
18699
18663
  };
18700
18664
  const areFiltersEquivalent = (firstFilter, secondFilter) => {
18701
- return firstFilter.columnField === secondFilter.columnField && firstFilter.operatorValue === secondFilter.operatorValue && firstFilter.value === secondFilter.value;
18665
+ return firstFilter.field === secondFilter.field && firstFilter.operator === secondFilter.operator && firstFilter.value === secondFilter.value;
18702
18666
  };
18703
18667
  const areFilterModelsEquivalent = (filterModel, filterModelToMatch) => {
18704
18668
  const {
18705
18669
  items,
18706
- linkOperator
18670
+ logicOperator
18707
18671
  } = filterModel;
18708
18672
  const {
18709
18673
  items: itemsToMatch,
18710
- linkOperator: linkOperatorToMatch
18674
+ logicOperator: logicOperatorToMatch
18711
18675
  } = filterModelToMatch;
18712
- if (linkOperator !== linkOperatorToMatch) {
18676
+ if (logicOperator !== logicOperatorToMatch) {
18713
18677
  return false;
18714
18678
  }
18715
18679
  if (items.length !== itemsToMatch.length) {
@@ -18722,7 +18686,7 @@ const areFilterModelsEquivalent = (filterModel, filterModelToMatch) => {
18722
18686
  const filterToCompare = itemsToMatch[i];
18723
18687
 
18724
18688
  // compareFilters return 0 if and only if the filters have the same
18725
- // columnField, operatorValue, and value
18689
+ // field, operator, and value
18726
18690
  if (!areFiltersEquivalent(filter, filterToCompare)) {
18727
18691
  return false;
18728
18692
  }
@@ -24533,16 +24497,16 @@ const getRole = (config, dateFormat) => {
24533
24497
  }).join('\n');
24534
24498
  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.
24535
24499
  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.
24536
- The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "linkOperator" and "items":
24537
- - "linkOperator": the logical operator, only "and" or "or" are allowed. If there is only one condition in the "items", use "and".
24538
- - "items": a list of conditions, each is an object with exactly the three keys "columnField", "operatorValue" and "value":
24539
- - "columnField": the column name, must be one of ${columns}
24500
+ The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "logicOperator" and "items":
24501
+ - "logicOperator": the logical operator, only "and" or "or" are allowed. If there is only one condition in the "items", use "and".
24502
+ - "items": a list of conditions, each is an object with exactly the three keys "field", "operator" and "value":
24503
+ - "field": the column name, must be one of ${columns}
24540
24504
  - "value":
24541
- - this can be skipped if the "operatorValue" is either "isEmpty" or "isNotEmpty"
24542
- - a list of multiple values if the "operatorValue" ends with "AnyOf"
24505
+ - this can be skipped if the "operator" is either "isEmpty" or "isNotEmpty"
24506
+ - a list of multiple values if the "operator" ends with "AnyOf"
24543
24507
  - otherwise, it's a single value represented as a string: "true" instead of true, "false" instead of false, "0.6" instead of 0.6.
24544
24508
  For "date" data type, use ${dateFormat}. If relative date is input, convert to the actual date given today is ${today}.
24545
- - "operatorValue": the comparison operator, accepted values depend on the data type of the column
24509
+ - "operator": the comparison operator, accepted values depend on the data type of the column
24546
24510
  ${operators}
24547
24511
 
24548
24512
  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:
@@ -24579,10 +24543,10 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
24579
24543
  nlpFilterConfig,
24580
24544
  onFilterModelChange,
24581
24545
  dateFormat = 'yyyy-mm-dd',
24582
- defaultModel = 'gpt-4-0613',
24546
+ defaultModel = 'gpt-4-1106-preview',
24583
24547
  defaultFilter = {
24584
24548
  items: [],
24585
- linkOperator: 'and'
24549
+ logicOperator: 'and'
24586
24550
  },
24587
24551
  disablePower = false,
24588
24552
  localeText
@@ -24660,7 +24624,7 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
24660
24624
  value: prompt
24661
24625
  }), /*#__PURE__*/React__default.createElement(Button, {
24662
24626
  variant: "primary",
24663
- "aira-label": buttonAriaLabel,
24627
+ "aria-label": buttonAriaLabel,
24664
24628
  type: "submit",
24665
24629
  isLoading: isLoading
24666
24630
  }, buttonText)), !disablePower && /*#__PURE__*/React__default.createElement(Tooltip, null, /*#__PURE__*/React__default.createElement(Tooltip.Trigger, null, /*#__PURE__*/React__default.createElement(Switch, {
@@ -24722,7 +24686,7 @@ const Toolbar$2 = props => {
24722
24686
  let {
24723
24687
  apiRef
24724
24688
  } = _ref;
24725
- return gridVisibleSortedRowIdsSelector(apiRef);
24689
+ return gridExpandedSortedRowIdsSelector(apiRef);
24726
24690
  }
24727
24691
  },
24728
24692
  printOptions: {
@@ -26956,12 +26920,10 @@ const ServerSideControlledPagination = _ref3 => {
26956
26920
  selectionStatus,
26957
26921
  displaySelection,
26958
26922
  displayPagination,
26959
- page,
26960
- onPageChange,
26961
- pageSize,
26962
- onPageSizeChange,
26923
+ paginationModel,
26924
+ onPaginationModelChange,
26925
+ pageSizeOptions,
26963
26926
  displayRowsPerPage,
26964
- rowsPerPageOptions,
26965
26927
  paginationProps,
26966
26928
  rowCount
26967
26929
  } = _ref3;
@@ -26980,13 +26942,17 @@ const ServerSideControlledPagination = _ref3 => {
26980
26942
  }, totalRowsLabel) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$1({
26981
26943
  component: "div",
26982
26944
  count: totalNumberOfRowsInTable,
26983
- page: page,
26984
- onPageChange: (event, newPage) => onPageChange(newPage),
26985
- rowsPerPage: pageSize,
26986
- onRowsPerPageChange: event => {
26987
- onPageSizeChange(parseInt(event.target.value, 10));
26988
- },
26989
- rowsPerPageOptions: displayRowsPerPage ? rowsPerPageOptions : []
26945
+ page: paginationModel.page,
26946
+ onPageChange: (event, page) => onPaginationModelChange({
26947
+ page,
26948
+ pageSize: paginationModel.pageSize
26949
+ }),
26950
+ rowsPerPage: paginationModel.pageSize,
26951
+ onRowsPerPageChange: event => onPaginationModelChange({
26952
+ page: paginationModel.page,
26953
+ pageSize: parseInt(event.target.value, 10)
26954
+ }),
26955
+ rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
26990
26956
  }, paginationProps)) : null);
26991
26957
  };
26992
26958
 
@@ -27012,11 +26978,9 @@ const ControlledPagination = _ref3 => {
27012
26978
  displayPagination = false,
27013
26979
  selectionStatus,
27014
26980
  apiRef,
27015
- page,
27016
- onPageChange,
27017
- pageSize,
27018
- onPageSizeChange,
27019
- rowsPerPageOptions,
26981
+ paginationModel,
26982
+ onPaginationModelChange,
26983
+ pageSizeOptions,
27020
26984
  isRowSelectable,
27021
26985
  paginationProps
27022
26986
  } = _ref3;
@@ -27046,17 +27010,25 @@ const ControlledPagination = _ref3 => {
27046
27010
  }, `${selectionStatus.numberOfSelectedRows} row${selectionStatus.numberOfSelectedRows > 1 ? 's' : ''} selected`) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$1({
27047
27011
  component: "div",
27048
27012
  count: numberOfFilteredRowsInTable,
27049
- page: page,
27050
- onPageChange: (event, newPage) => onPageChange(newPage),
27051
- rowsPerPage: pageSize,
27013
+ page: paginationModel.page,
27014
+ onPageChange: (event, page) => {
27015
+ onPaginationModelChange({
27016
+ page,
27017
+ pageSize: paginationModel.pageSize
27018
+ });
27019
+ },
27020
+ rowsPerPage: paginationModel.pageSize,
27052
27021
  onRowsPerPageChange: event => {
27053
- onPageSizeChange(parseInt(event.target.value, 10));
27022
+ onPaginationModelChange({
27023
+ page: paginationModel.page,
27024
+ pageSize: parseInt(event.target.value, 10)
27025
+ });
27054
27026
  },
27055
- rowsPerPageOptions: displayRowsPerPage ? rowsPerPageOptions : []
27027
+ rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
27056
27028
  }, paginationProps)) : null);
27057
27029
  };
27058
27030
 
27059
- const _excluded$3 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "page", "onPageChange", "pageSize", "onPageSizeChange", "rowsPerPageOptions", "paginationProps", "paginationMode", "rowCount"];
27031
+ const _excluded$3 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "paginationModel", "onPaginationModelChange", "pageSizeOptions", "paginationProps", "paginationMode", "rowCount"];
27060
27032
  const ToolbarWrapper = _ref => {
27061
27033
  let {
27062
27034
  hideToolbar,
@@ -27068,11 +27040,9 @@ const ToolbarWrapper = _ref => {
27068
27040
  selectionStatus,
27069
27041
  apiRef,
27070
27042
  isRowSelectable,
27071
- page,
27072
- onPageChange,
27073
- pageSize,
27074
- onPageSizeChange,
27075
- rowsPerPageOptions,
27043
+ paginationModel,
27044
+ onPaginationModelChange,
27045
+ pageSizeOptions,
27076
27046
  paginationProps,
27077
27047
  paginationMode = 'client',
27078
27048
  rowCount
@@ -27086,11 +27056,9 @@ const ToolbarWrapper = _ref => {
27086
27056
  displayRowsPerPage: false,
27087
27057
  displayPagination: ['top', 'both'].includes(paginationPlacement),
27088
27058
  selectionStatus: selectionStatus.current,
27089
- page: page,
27090
- onPageChange: onPageChange,
27091
- pageSize: pageSize,
27092
- onPageSizeChange: onPageSizeChange,
27093
- rowsPerPageOptions: rowsPerPageOptions,
27059
+ paginationModel: paginationModel,
27060
+ onPaginationModelChange: onPaginationModelChange,
27061
+ pageSizeOptions: pageSizeOptions,
27094
27062
  paginationProps: paginationProps,
27095
27063
  rowCount: rowCount
27096
27064
  }) : /*#__PURE__*/React__default.createElement(ControlledPagination, {
@@ -27100,30 +27068,26 @@ const ToolbarWrapper = _ref => {
27100
27068
  selectionStatus: selectionStatus.current,
27101
27069
  apiRef: apiRef,
27102
27070
  isRowSelectable: isRowSelectable,
27103
- page: page,
27104
- onPageChange: onPageChange,
27105
- pageSize: pageSize,
27106
- onPageSizeChange: onPageSizeChange,
27107
- rowsPerPageOptions: rowsPerPageOptions,
27071
+ paginationModel: paginationModel,
27072
+ onPaginationModelChange: onPaginationModelChange,
27073
+ pageSizeOptions: pageSizeOptions,
27108
27074
  paginationProps: paginationProps
27109
27075
  }) : null);
27110
27076
  };
27111
27077
 
27112
27078
  const useControlledDatagridState = _ref => {
27113
- var _initialState$paginat, _initialState$paginat2;
27079
+ var _ref2, _ref3, _propsPaginationModel, _initialState$paginat, _initialState$paginat2, _pageSizeOptions$, _ref4, _propsPaginationModel2, _initialState$paginat3, _initialState$paginat4;
27114
27080
  let {
27115
27081
  initialState,
27116
- rowsPerPageOptions,
27082
+ pageSizeOptions,
27117
27083
  propsColumnVisibilityModel,
27118
27084
  propsFilterModel,
27119
27085
  propsOnColumnVisibilityModelChange,
27120
27086
  propsOnFilterModelChange,
27121
- propsOnPageChange,
27122
- propsOnPageSizeChange,
27087
+ propsOnPaginationModelChange,
27123
27088
  propsOnPinnedColumnsChange,
27124
27089
  propsOnSortModelChange,
27125
- propsPage,
27126
- propsPageSize,
27090
+ propsPaginationModel,
27127
27091
  propsPinnedColumns,
27128
27092
  propsSortModel
27129
27093
  } = _ref;
@@ -27171,33 +27135,22 @@ const useControlledDatagridState = _ref => {
27171
27135
  setSortModel(model);
27172
27136
  }
27173
27137
  };
27174
- 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);
27175
- 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);
27176
- const onPageChange = page => {
27177
- if (propsOnPageChange) {
27178
- propsOnPageChange(page, undefined);
27179
- } else {
27180
- setPage(page);
27181
- }
27182
- };
27183
- useEffect(() => {
27184
- if (propsPage || propsPage === 0) {
27185
- setPage(propsPage);
27186
- }
27187
- }, [propsPage]);
27188
- const onPageSizeChange = pageSize => {
27189
- onPageChange(0);
27190
- if (propsOnPageSizeChange) {
27191
- propsOnPageSizeChange(pageSize, undefined);
27138
+ const [paginationModel, setPaginationModel] = useState({
27139
+ 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,
27140
+ 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
27141
+ });
27142
+ const onPaginationModelChange = (model, details) => {
27143
+ if (propsOnPaginationModelChange) {
27144
+ propsOnPaginationModelChange(model, details);
27192
27145
  } else {
27193
- setPageSize(pageSize);
27146
+ setPaginationModel(model);
27194
27147
  }
27195
27148
  };
27196
27149
  useEffect(() => {
27197
- if (propsPageSize) {
27198
- setPageSize(propsPageSize);
27150
+ if (propsPaginationModel) {
27151
+ setPaginationModel(propsPaginationModel);
27199
27152
  }
27200
- }, [propsPageSize]);
27153
+ }, [propsPaginationModel]);
27201
27154
  return {
27202
27155
  filterModel,
27203
27156
  onFilterModelChange,
@@ -27207,14 +27160,12 @@ const useControlledDatagridState = _ref => {
27207
27160
  onPinnedColumnsChange,
27208
27161
  sortModel,
27209
27162
  onSortModelChange,
27210
- page,
27211
- pageSize,
27212
- onPageChange,
27213
- onPageSizeChange
27163
+ paginationModel,
27164
+ onPaginationModelChange
27214
27165
  };
27215
27166
  };
27216
27167
 
27217
- 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"];
27168
+ 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"];
27218
27169
  const COMPONENT_NAME$2 = 'DataGrid';
27219
27170
  const CLASSNAME$2 = 'redsift-datagrid';
27220
27171
  const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
@@ -27223,33 +27174,30 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27223
27174
  apiRef: propsApiRef,
27224
27175
  autoHeight,
27225
27176
  className,
27226
- columnTypes: propsColumnTypes,
27227
- components,
27228
- componentsProps,
27177
+ slots,
27178
+ slotProps,
27229
27179
  filterModel: propsFilterModel,
27230
27180
  columnVisibilityModel: propsColumnVisibilityModel,
27231
27181
  pinnedColumns: propsPinnedColumns,
27232
27182
  sortModel: propsSortModel,
27183
+ paginationModel: propsPaginationModel,
27233
27184
  height: propsHeight,
27234
27185
  hideToolbar,
27235
27186
  initialState,
27236
27187
  isRowSelectable,
27237
27188
  license = process.env.MUI_LICENSE_KEY,
27238
27189
  onFilterModelChange: propsOnFilterModelChange,
27239
- onPageChange: propsOnPageChange,
27240
- onPageSizeChange: propsOnPageSizeChange,
27190
+ rowSelectionModel: propsRowSelectionModel,
27191
+ onPaginationModelChange: propsOnPaginationModelChange,
27192
+ onRowSelectionModelChange: propsOnRowSelectionModelChange,
27241
27193
  onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
27242
27194
  onPinnedColumnsChange: propsOnPinnedColumnsChange,
27243
27195
  onSortModelChange: propsOnSortModelChange,
27244
- selectionModel: propsSelectionModel,
27245
- onSelectionModelChange: propsOnSelectionModelChange,
27246
- page: propsPage,
27247
- pageSize: propsPageSize,
27248
27196
  pagination,
27249
27197
  paginationPlacement = 'both',
27250
27198
  paginationProps,
27251
27199
  rows,
27252
- rowsPerPageOptions,
27200
+ pageSizeOptions,
27253
27201
  sx,
27254
27202
  theme: propsTheme,
27255
27203
  paginationMode = 'client',
@@ -27259,7 +27207,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27259
27207
  const theme = useTheme$4(propsTheme);
27260
27208
  const _apiRef = useGridApiRef();
27261
27209
  const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
27262
- const RenderedToolbar = components !== null && components !== void 0 && components.Toolbar ? components.Toolbar : Toolbar$2;
27210
+ const RenderedToolbar = slots !== null && slots !== void 0 && slots.toolbar ? slots.toolbar : Toolbar$2;
27263
27211
  LicenseInfo.setLicenseKey(license);
27264
27212
  const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
27265
27213
  const {
@@ -27267,56 +27215,52 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27267
27215
  filterModel,
27268
27216
  onColumnVisibilityModelChange,
27269
27217
  onFilterModelChange,
27270
- onPageChange,
27271
- onPageSizeChange,
27218
+ onPaginationModelChange,
27272
27219
  onPinnedColumnsChange,
27273
27220
  onSortModelChange,
27274
- page,
27275
- pageSize,
27221
+ paginationModel,
27276
27222
  pinnedColumns,
27277
27223
  sortModel
27278
27224
  } = useControlledDatagridState({
27279
27225
  initialState,
27280
- rowsPerPageOptions,
27226
+ pageSizeOptions,
27281
27227
  propsColumnVisibilityModel,
27282
27228
  propsFilterModel,
27283
27229
  propsOnColumnVisibilityModelChange,
27284
27230
  propsOnFilterModelChange,
27285
27231
  propsOnPinnedColumnsChange,
27286
27232
  propsOnSortModelChange,
27287
- propsPage,
27288
- propsPageSize,
27233
+ propsPaginationModel,
27289
27234
  propsPinnedColumns,
27290
27235
  propsSortModel,
27291
- propsOnPageChange,
27292
- propsOnPageSizeChange
27236
+ propsOnPaginationModelChange
27293
27237
  });
27294
- const [selectionModel, setSelectionModel] = useState(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
27238
+ const [rowSelectionModel, setRowSelectionModel] = useState(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
27295
27239
  useEffect(() => {
27296
- setSelectionModel(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
27297
- }, [propsSelectionModel]);
27298
- const onSelectionModelChange = (selectionModel, details) => {
27299
- if (propsOnSelectionModelChange) {
27300
- propsOnSelectionModelChange(selectionModel, details);
27240
+ setRowSelectionModel(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
27241
+ }, [propsRowSelectionModel]);
27242
+ const onRowSelectionModelChange = (selectionModel, details) => {
27243
+ if (propsOnRowSelectionModelChange) {
27244
+ propsOnRowSelectionModelChange(selectionModel, details);
27301
27245
  } else {
27302
- setSelectionModel(selectionModel);
27246
+ setRowSelectionModel(selectionModel);
27303
27247
  }
27304
27248
  };
27305
27249
  const selectionStatus = useRef({
27306
27250
  type: 'none',
27307
27251
  numberOfSelectedRows: 0,
27308
27252
  numberOfSelectedRowsInPage: 0,
27309
- page,
27310
- pageSize
27253
+ page: paginationModel.page,
27254
+ pageSize: paginationModel.pageSize
27311
27255
  });
27312
27256
 
27313
27257
  // in server-side pagination we want to update the selection status
27314
27258
  // every time we navigate between pages, resize our page or select something
27315
27259
  useEffect(() => {
27316
27260
  if (paginationMode == 'server') {
27317
- onServerSideSelectionStatusChange(Array.isArray(selectionModel) ? selectionModel : [selectionModel], apiRef, selectionStatus, isRowSelectable, page, pageSize);
27261
+ onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatus, isRowSelectable, paginationModel.page, paginationModel.pageSize);
27318
27262
  }
27319
- }, [selectionModel, page, pageSize]);
27263
+ }, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
27320
27264
  if (!Array.isArray(rows)) {
27321
27265
  return null;
27322
27266
  }
@@ -27347,57 +27291,54 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27347
27291
  apiRef: apiRef,
27348
27292
  autoHeight: autoHeight,
27349
27293
  checkboxSelectionVisibleOnly: Boolean(pagination),
27350
- columnTypes: _objectSpread2(_objectSpread2({}, customColumnTypes), propsColumnTypes),
27351
- components: _objectSpread2(_objectSpread2({
27352
- BaseButton,
27353
- BaseCheckbox,
27354
- // BaseTextField,
27355
- BasePopper,
27356
- ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27294
+ slots: _objectSpread2(_objectSpread2({
27295
+ baseButton: BaseButton,
27296
+ baseCheckbox: BaseCheckbox,
27297
+ // baseTextField,
27298
+ basePopper: BasePopper,
27299
+ columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27357
27300
  displayName: "ColumnFilteredIcon"
27358
27301
  })),
27359
- ColumnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27302
+ columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27360
27303
  displayName: "ColumnSelectorIcon"
27361
27304
  })),
27362
- ColumnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27305
+ columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27363
27306
  displayName: "ColumnSortedAscendingIcon"
27364
27307
  })),
27365
- ColumnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27308
+ columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27366
27309
  displayName: "ColumnSortedDescendingIcon"
27367
27310
  })),
27368
- DensityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27311
+ densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27369
27312
  displayName: "DensityCompactIcon"
27370
27313
  })),
27371
- DensityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27314
+ densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27372
27315
  displayName: "DensityStandardIcon"
27373
27316
  })),
27374
- DensityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27317
+ densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27375
27318
  displayName: "DensityComfortableIcon"
27376
27319
  })),
27377
- DetailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27320
+ detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27378
27321
  displayName: "DetailPanelCollapseIcon"
27379
27322
  })),
27380
- DetailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27323
+ detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27381
27324
  displayName: "DetailPanelExpandIcon"
27382
27325
  })),
27383
- ExportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27326
+ exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27384
27327
  displayName: "ExportIcon"
27385
27328
  })),
27386
- OpenFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
27329
+ openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
27387
27330
  displayName: "OpenFilterButtonIcon"
27388
27331
  }, props))
27389
- }, components), {}, {
27390
- Toolbar: ToolbarWrapper,
27391
- Pagination: props => pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$1({}, props, {
27332
+ }, slots), {}, {
27333
+ toolbar: ToolbarWrapper,
27334
+ pagination: props => pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$1({}, props, {
27392
27335
  displaySelection: false,
27393
27336
  displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
27394
27337
  displayPagination: ['bottom', 'both'].includes(paginationPlacement),
27395
27338
  selectionStatus: selectionStatus.current,
27396
- page: page,
27397
- onPageChange: onPageChange,
27398
- pageSize: pageSize,
27399
- onPageSizeChange: onPageSizeChange,
27400
- rowsPerPageOptions: rowsPerPageOptions,
27339
+ paginationModel: paginationModel,
27340
+ onPaginationModelChange: onPaginationModelChange,
27341
+ pageSizeOptions: pageSizeOptions,
27401
27342
  paginationProps: paginationProps,
27402
27343
  paginationMode: paginationMode,
27403
27344
  rowCount: rowCount
@@ -27408,16 +27349,14 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27408
27349
  selectionStatus: selectionStatus.current,
27409
27350
  apiRef: apiRef,
27410
27351
  isRowSelectable: isRowSelectable,
27411
- page: page,
27412
- onPageChange: onPageChange,
27413
- pageSize: pageSize,
27414
- onPageSizeChange: onPageSizeChange,
27415
- rowsPerPageOptions: rowsPerPageOptions,
27352
+ paginationModel: paginationModel,
27353
+ onPaginationModelChange: onPaginationModelChange,
27354
+ pageSizeOptions: pageSizeOptions,
27416
27355
  paginationProps: paginationProps,
27417
27356
  paginationMode: paginationMode
27418
27357
  })) : null
27419
27358
  }),
27420
- componentsProps: _objectSpread2(_objectSpread2({}, componentsProps), {}, {
27359
+ slotProps: _objectSpread2(_objectSpread2({}, slotProps), {}, {
27421
27360
  toolbar: _objectSpread2({
27422
27361
  hideToolbar,
27423
27362
  RenderedToolbar,
@@ -27428,15 +27367,13 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27428
27367
  selectionStatus,
27429
27368
  apiRef,
27430
27369
  isRowSelectable,
27431
- page,
27432
- onPageChange,
27433
- pageSize,
27434
- onPageSizeChange,
27435
- rowsPerPageOptions,
27370
+ paginationModel,
27371
+ onPaginationModelChange,
27372
+ pageSizeOptions,
27436
27373
  paginationProps,
27437
27374
  paginationMode,
27438
27375
  rowCount
27439
- }, componentsProps === null || componentsProps === void 0 ? void 0 : componentsProps.toolbar)
27376
+ }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar)
27440
27377
  }),
27441
27378
  filterModel: filterModel,
27442
27379
  columnVisibilityModel: columnVisibilityModel,
@@ -27452,13 +27389,11 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27452
27389
  paginationMode: paginationMode,
27453
27390
  keepNonExistentRowsSelected: paginationMode == 'server',
27454
27391
  rows: rows,
27455
- rowsPerPageOptions: rowsPerPageOptions,
27456
- page: page,
27457
- onPageChange: onPageChange,
27458
- pageSize: pageSize,
27459
- onPageSizeChange: onPageSizeChange,
27460
- selectionModel: selectionModel,
27461
- onSelectionModelChange: (newSelectionModel, details) => {
27392
+ pageSizeOptions: pageSizeOptions,
27393
+ paginationModel: paginationModel,
27394
+ onPaginationModelChange: onPaginationModelChange,
27395
+ rowSelectionModel: rowSelectionModel,
27396
+ onRowSelectionModelChange: (newSelectionModel, details) => {
27462
27397
  if (pagination && paginationMode != 'server') {
27463
27398
  const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
27464
27399
  let {
@@ -27516,7 +27451,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27516
27451
  };
27517
27452
  }
27518
27453
  }
27519
- onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(newSelectionModel, details);
27454
+ onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
27520
27455
  },
27521
27456
  sx: _objectSpread2(_objectSpread2({}, sx), {}, {
27522
27457
  '.MuiDataGrid-columnHeaders': {
@@ -27533,8 +27468,6 @@ DataGrid.className = CLASSNAME$2;
27533
27468
  DataGrid.displayName = COMPONENT_NAME$2;
27534
27469
 
27535
27470
  // Get and Set data from LocalStorage WITHOUT useState
27536
-
27537
- // triggering a state update and consecutive re-render
27538
27471
  const useFetchState = (defaultValue, key) => {
27539
27472
  let stickyValue = null;
27540
27473
  try {
@@ -27542,16 +27475,7 @@ const useFetchState = (defaultValue, key) => {
27542
27475
  } catch (e) {
27543
27476
  console.error('StatefulDataGrid: error getting item from local storage: ', e);
27544
27477
  }
27545
- let parsedValue = stickyValue !== null && stickyValue !== undefined && stickyValue !== 'undefined' ? JSON.parse(stickyValue) : defaultValue;
27546
-
27547
- // TODO: temporary workaround to avoid clashes when someone had sorting on the now-removed screenshot field (renamed to num_annotations)
27548
- // 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
27549
- if (parsedValue instanceof Array) {
27550
- const fields = (parsedValue || []).map(item => item.field);
27551
- if (fields.includes('screenshot') || fields.includes('diffs')) {
27552
- parsedValue = defaultValue;
27553
- }
27554
- }
27478
+ const parsedValue = stickyValue !== null && stickyValue !== undefined && stickyValue !== 'undefined' ? JSON.parse(stickyValue) : defaultValue;
27555
27479
  const updateValue = useCallback(value => {
27556
27480
  try {
27557
27481
  window.localStorage.setItem(key, JSON.stringify(value));
@@ -27562,6 +27486,8 @@ const useFetchState = (defaultValue, key) => {
27562
27486
  return [parsedValue, updateValue];
27563
27487
  };
27564
27488
 
27489
+ // import useLocalStorage from './useLocalStorage';
27490
+
27565
27491
  const useTableStates = (id, version) => {
27566
27492
  const [paginationModel, setPaginationModel] = useFetchState('', buildStorageKey({
27567
27493
  id,
@@ -27618,8 +27544,7 @@ const useStatefulTable = props => {
27618
27544
  onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
27619
27545
  onColumnWidthChange: propsOnColumnWidthChange,
27620
27546
  onFilterModelChange: propsOnFilterModelChange,
27621
- onPageChange: propsOnPageChange,
27622
- onPageSizeChange: propsOnPageSizeChange,
27547
+ onPaginationModelChange: propsOnPaginationModelChange,
27623
27548
  onPinnedColumnsChange: propsOnPinnedColumnsChange,
27624
27549
  onSortModelChange: propsOnSortModelChange,
27625
27550
  useRouter,
@@ -27649,7 +27574,7 @@ const useStatefulTable = props => {
27649
27574
  setDimensionModel
27650
27575
  } = useTableStates(id, localStorageVersion);
27651
27576
 
27652
- // clearing up old version keys
27577
+ // clearing up old version keys, triggering only on first render
27653
27578
  useEffect(() => clearPreviousVersionStorage(id, previousLocalStorageVersions), [id, previousLocalStorageVersions]);
27654
27579
  const onColumnDimensionChange = useCallback(_ref => {
27655
27580
  let {
@@ -27682,7 +27607,6 @@ const useStatefulTable = props => {
27682
27607
  column.width = dimensionModel[column.field] || column.width || 100;
27683
27608
  return column;
27684
27609
  }), [propsColumns, dimensionModel]);
27685
-
27686
27610
  /** Add resetPage method to apiRef. */
27687
27611
  apiRef.current.resetPage = () => {
27688
27612
  apiRef.current.setPage(0);
@@ -27693,7 +27617,7 @@ const useStatefulTable = props => {
27693
27617
  onFilterModelChange: (model, details) => {
27694
27618
  const filterModel = _objectSpread2(_objectSpread2({}, model), {}, {
27695
27619
  items: model.items.map(item => {
27696
- const column = apiRef.current.getColumn(item.columnField);
27620
+ const column = apiRef.current.getColumn(item.field);
27697
27621
  item.type = column.type || 'string';
27698
27622
  return item;
27699
27623
  }),
@@ -27731,33 +27655,16 @@ const useStatefulTable = props => {
27731
27655
  }, search, localStorageVersion, historyReplace, columns);
27732
27656
  },
27733
27657
  pinnedColumns: pinnedColumnsModel,
27734
- page: paginationModelParsed.page,
27735
- pageSize: paginationModelParsed.pageSize,
27736
- onPageChange: (page, details) => {
27737
- const direction = paginationModelParsed.page < page ? 'next' : 'back';
27738
- propsOnPageChange === null || propsOnPageChange === void 0 ? void 0 : propsOnPageChange(page, details);
27739
- updateUrl({
27740
- filterModel: filterParsed,
27741
- sortModel: sortModelParsed,
27742
- paginationModel: {
27743
- page,
27744
- pageSize: paginationModelParsed.pageSize,
27745
- direction
27746
- },
27747
- columnsModel: apiRef.current.state.columns.columnVisibilityModel,
27748
- pinnedColumnsModel: pinnedColumnsModel
27749
- }, search, localStorageVersion, historyReplace, columns);
27750
- },
27751
- onPageSizeChange: (pageSize, details) => {
27752
- propsOnPageSizeChange === null || propsOnPageSizeChange === void 0 ? void 0 : propsOnPageSizeChange(pageSize, details);
27658
+ paginationModel: paginationModelParsed,
27659
+ onPaginationModelChange: (model, details) => {
27660
+ const paginationModel = _objectSpread2(_objectSpread2({}, model), {}, {
27661
+ direction: paginationModelParsed.page < model.page ? 'next' : 'back'
27662
+ });
27663
+ propsOnPaginationModelChange === null || propsOnPaginationModelChange === void 0 ? void 0 : propsOnPaginationModelChange(paginationModel, details);
27753
27664
  updateUrl({
27754
27665
  filterModel: filterParsed,
27755
27666
  sortModel: sortModelParsed,
27756
- paginationModel: {
27757
- page: paginationModelParsed.page,
27758
- pageSize,
27759
- direction: paginationModelParsed.direction
27760
- },
27667
+ paginationModel: paginationModel,
27761
27668
  columnsModel: apiRef.current.state.columns.columnVisibilityModel,
27762
27669
  pinnedColumnsModel: pinnedColumnsModel
27763
27670
  }, search, localStorageVersion, historyReplace, columns);
@@ -27783,7 +27690,7 @@ const useStatefulTable = props => {
27783
27690
  };
27784
27691
  };
27785
27692
 
27786
- 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"];
27693
+ const _excluded$1 = ["apiRef", "autoHeight", "className", "columns", "slots", "slotProps", "filterModel", "columnVisibilityModel", "pinnedColumns", "sortModel", "paginationModel", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "localStorageVersion", "previousLocalStorageVersions", "onFilterModelChange", "rowSelectionModel", "onColumnWidthChange", "onPaginationModelChange", "onRowSelectionModelChange", "onColumnVisibilityModelChange", "onPinnedColumnsChange", "onSortModelChange", "pagination", "paginationPlacement", "paginationProps", "rows", "pageSizeOptions", "sx", "theme", "useRouter", "paginationMode", "rowCount"];
27787
27694
  const COMPONENT_NAME$1 = 'DataGrid';
27788
27695
  const CLASSNAME$1 = 'redsift-datagrid';
27789
27696
  const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
@@ -27793,15 +27700,13 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27793
27700
  autoHeight,
27794
27701
  className,
27795
27702
  columns,
27796
- columnTypes: propsColumnTypes,
27797
- components,
27798
- componentsProps,
27703
+ slots,
27704
+ slotProps,
27799
27705
  filterModel: propsFilterModel,
27800
27706
  columnVisibilityModel: propsColumnVisibilityModel,
27801
27707
  pinnedColumns: propsPinnedColumns,
27802
27708
  sortModel: propsSortModel,
27803
- page: propsPage,
27804
- pageSize: propsPageSize,
27709
+ paginationModel: propsPaginationModel,
27805
27710
  height: propsHeight,
27806
27711
  hideToolbar,
27807
27712
  initialState,
@@ -27810,11 +27715,10 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27810
27715
  localStorageVersion,
27811
27716
  previousLocalStorageVersions,
27812
27717
  onFilterModelChange: propsOnFilterModelChange,
27813
- selectionModel: propsSelectionModel,
27718
+ rowSelectionModel: propsRowSelectionModel,
27814
27719
  onColumnWidthChange: propsOnColumnWidthChange,
27815
- onPageChange: propsOnPageChange,
27816
- onPageSizeChange: propsOnPageSizeChange,
27817
- onSelectionModelChange: propsOnSelectionModelChange,
27720
+ onPaginationModelChange: propsOnPaginationModelChange,
27721
+ onRowSelectionModelChange: propsOnRowSelectionModelChange,
27818
27722
  onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
27819
27723
  onPinnedColumnsChange: propsOnPinnedColumnsChange,
27820
27724
  onSortModelChange: propsOnSortModelChange,
@@ -27822,7 +27726,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27822
27726
  paginationPlacement = 'both',
27823
27727
  paginationProps,
27824
27728
  rows,
27825
- rowsPerPageOptions,
27729
+ pageSizeOptions,
27826
27730
  sx,
27827
27731
  theme: propsTheme,
27828
27732
  useRouter,
@@ -27833,43 +27737,38 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27833
27737
  const theme = useTheme$4(propsTheme);
27834
27738
  const _apiRef = useGridApiRef();
27835
27739
  const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
27836
- const RenderedToolbar = components !== null && components !== void 0 && components.Toolbar ? components.Toolbar : Toolbar$2;
27740
+ const RenderedToolbar = slots !== null && slots !== void 0 && slots.toolbar ? slots.toolbar : Toolbar$2;
27837
27741
  LicenseInfo.setLicenseKey(license);
27838
27742
  const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
27839
27743
  const {
27840
27744
  onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
27841
27745
  onFilterModelChange: controlledOnFilterModelChange,
27842
- onPageChange: controlledOnPageChange,
27843
- onPageSizeChange: controlledOnPageSizeChange,
27746
+ onPaginationModelChange: controlledOnPaginationModelChange,
27844
27747
  onPinnedColumnsChange: controlledOnPinnedColumnsChange,
27845
27748
  onSortModelChange: controlledOnSortModelChange
27846
27749
  } = useControlledDatagridState({
27847
27750
  initialState,
27848
- rowsPerPageOptions,
27751
+ pageSizeOptions,
27849
27752
  propsColumnVisibilityModel,
27850
27753
  propsFilterModel,
27851
27754
  propsOnColumnVisibilityModelChange,
27852
27755
  propsOnFilterModelChange,
27853
27756
  propsOnPinnedColumnsChange,
27854
27757
  propsOnSortModelChange,
27855
- propsPage,
27856
- propsPageSize,
27758
+ propsPaginationModel,
27857
27759
  propsPinnedColumns,
27858
27760
  propsSortModel,
27859
- propsOnPageChange,
27860
- propsOnPageSizeChange
27761
+ propsOnPaginationModelChange
27861
27762
  });
27862
27763
  const {
27863
27764
  columnVisibilityModel,
27864
27765
  filterModel,
27865
27766
  onColumnVisibilityModelChange,
27866
27767
  onFilterModelChange,
27867
- onPageChange,
27868
- onPageSizeChange,
27768
+ onPaginationModelChange,
27869
27769
  onPinnedColumnsChange,
27870
27770
  onSortModelChange,
27871
- page,
27872
- pageSize,
27771
+ paginationModel,
27873
27772
  pinnedColumns,
27874
27773
  sortModel,
27875
27774
  onColumnWidthChange
@@ -27880,40 +27779,39 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27880
27779
  onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
27881
27780
  onColumnWidthChange: propsOnColumnWidthChange,
27882
27781
  onFilterModelChange: controlledOnFilterModelChange,
27883
- onPageChange: controlledOnPageChange,
27884
- onPageSizeChange: controlledOnPageSizeChange,
27782
+ onPaginationModelChange: controlledOnPaginationModelChange,
27885
27783
  onPinnedColumnsChange: controlledOnPinnedColumnsChange,
27886
27784
  onSortModelChange: controlledOnSortModelChange,
27887
27785
  useRouter: useRouter,
27888
27786
  localStorageVersion,
27889
27787
  previousLocalStorageVersions
27890
27788
  });
27891
- const [selectionModel, setSelectionModel] = useState(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
27789
+ const [rowSelectionModel, setRowSelectionModel] = useState(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
27892
27790
  useEffect(() => {
27893
- setSelectionModel(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
27894
- }, [propsSelectionModel]);
27895
- const onSelectionModelChange = (selectionModel, details) => {
27896
- if (propsOnSelectionModelChange) {
27897
- propsOnSelectionModelChange(selectionModel, details);
27791
+ setRowSelectionModel(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
27792
+ }, [propsRowSelectionModel]);
27793
+ const onRowSelectionModelChange = (selectionModel, details) => {
27794
+ if (propsOnRowSelectionModelChange) {
27795
+ propsOnRowSelectionModelChange(selectionModel, details);
27898
27796
  } else {
27899
- setSelectionModel(selectionModel);
27797
+ setRowSelectionModel(selectionModel);
27900
27798
  }
27901
27799
  };
27902
27800
  const selectionStatus = useRef({
27903
27801
  type: 'none',
27904
27802
  numberOfSelectedRows: 0,
27905
27803
  numberOfSelectedRowsInPage: 0,
27906
- page,
27907
- pageSize: pageSize
27804
+ page: paginationModel.page,
27805
+ pageSize: paginationModel.pageSize
27908
27806
  });
27909
27807
 
27910
27808
  // in server-side pagination we want to update the selection status
27911
27809
  // every time we navigate between pages, resize our page or select something
27912
27810
  useEffect(() => {
27913
27811
  if (paginationMode == 'server') {
27914
- onServerSideSelectionStatusChange(Array.isArray(selectionModel) ? selectionModel : [selectionModel], apiRef, selectionStatus, isRowSelectable, page, pageSize);
27812
+ onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatus, isRowSelectable, paginationModel.page, paginationModel.pageSize);
27915
27813
  }
27916
- }, [selectionModel, page, pageSize]);
27814
+ }, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
27917
27815
  if (!Array.isArray(rows)) {
27918
27816
  return null;
27919
27817
  }
@@ -27946,15 +27844,13 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27946
27844
  filterModel: filterModel,
27947
27845
  onColumnVisibilityModelChange: onColumnVisibilityModelChange,
27948
27846
  onFilterModelChange: onFilterModelChange,
27949
- onPageChange: onPageChange,
27950
- onPageSizeChange: onPageSizeChange,
27847
+ onPaginationModelChange: onPaginationModelChange,
27951
27848
  onPinnedColumnsChange: onPinnedColumnsChange,
27952
27849
  onSortModelChange: onSortModelChange,
27953
- page: page,
27954
- pageSize: pageSize,
27850
+ paginationModel: paginationModel,
27955
27851
  pinnedColumns: pinnedColumns,
27956
27852
  sortModel: sortModel,
27957
- rowsPerPageOptions: rowsPerPageOptions,
27853
+ pageSizeOptions: pageSizeOptions,
27958
27854
  onColumnWidthChange: onColumnWidthChange,
27959
27855
  initialState: initialState,
27960
27856
  isRowSelectable: isRowSelectable,
@@ -27965,58 +27861,55 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27965
27861
  rowCount: rowCount,
27966
27862
  autoHeight: autoHeight,
27967
27863
  checkboxSelectionVisibleOnly: Boolean(pagination),
27968
- columnTypes: _objectSpread2(_objectSpread2({}, customColumnTypes), propsColumnTypes),
27969
- components: _objectSpread2(_objectSpread2({
27970
- BaseButton,
27971
- BaseCheckbox,
27972
- // BaseTextField,
27973
- BasePopper,
27974
- ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27864
+ slots: _objectSpread2(_objectSpread2({
27865
+ baseButton: BaseButton,
27866
+ baseCheckbox: BaseCheckbox,
27867
+ // baseTextField,
27868
+ basePopper: BasePopper,
27869
+ columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27975
27870
  displayName: "ColumnFilteredIcon"
27976
27871
  })),
27977
- ColumnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27872
+ columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27978
27873
  displayName: "ColumnSelectorIcon"
27979
27874
  })),
27980
- ColumnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27875
+ columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27981
27876
  displayName: "ColumnSortedAscendingIcon"
27982
27877
  })),
27983
- ColumnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27878
+ columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27984
27879
  displayName: "ColumnSortedDescendingIcon"
27985
27880
  })),
27986
- DensityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27881
+ densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27987
27882
  displayName: "DensityCompactIcon"
27988
27883
  })),
27989
- DensityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27884
+ densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27990
27885
  displayName: "DensityStandardIcon"
27991
27886
  })),
27992
- DensityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27887
+ densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27993
27888
  displayName: "DensityComfortableIcon"
27994
27889
  })),
27995
- DetailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27890
+ detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27996
27891
  displayName: "DetailPanelCollapseIcon"
27997
27892
  })),
27998
- DetailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27893
+ detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27999
27894
  displayName: "DetailPanelExpandIcon"
28000
27895
  })),
28001
- ExportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27896
+ exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
28002
27897
  displayName: "ExportIcon"
28003
27898
  })),
28004
- OpenFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
27899
+ openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
28005
27900
  displayName: "OpenFilterButtonIcon"
28006
27901
  }, props))
28007
- }, components), {}, {
28008
- Toolbar: ToolbarWrapper,
28009
- Pagination: props => {
27902
+ }, slots), {}, {
27903
+ toolbar: ToolbarWrapper,
27904
+ pagination: props => {
28010
27905
  return pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$1({}, props, {
28011
27906
  displaySelection: false,
28012
27907
  displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
28013
27908
  displayPagination: ['bottom', 'both'].includes(paginationPlacement),
28014
27909
  selectionStatus: selectionStatus.current,
28015
- page: page,
28016
- pageSize: pageSize,
28017
- onPageChange: onPageChange,
28018
- onPageSizeChange: onPageSizeChange,
28019
- rowsPerPageOptions: rowsPerPageOptions,
27910
+ paginationModel: paginationModel,
27911
+ onPaginationModelChange: onPaginationModelChange,
27912
+ pageSizeOptions: pageSizeOptions,
28020
27913
  paginationProps: paginationProps,
28021
27914
  paginationMode: paginationMode,
28022
27915
  rowCount: rowCount
@@ -28027,17 +27920,15 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
28027
27920
  selectionStatus: selectionStatus.current,
28028
27921
  apiRef: apiRef,
28029
27922
  isRowSelectable: isRowSelectable,
28030
- page: page,
28031
- pageSize: pageSize,
28032
- onPageChange: onPageChange,
28033
- onPageSizeChange: onPageSizeChange,
28034
- rowsPerPageOptions: rowsPerPageOptions,
27923
+ paginationModel: paginationModel,
27924
+ onPaginationModelChange: onPaginationModelChange,
27925
+ pageSizeOptions: pageSizeOptions,
28035
27926
  paginationProps: paginationProps,
28036
27927
  paginationMode: paginationMode
28037
27928
  })) : null;
28038
27929
  }
28039
27930
  }),
28040
- componentsProps: _objectSpread2(_objectSpread2({}, componentsProps), {}, {
27931
+ slotProps: _objectSpread2(_objectSpread2({}, slotProps), {}, {
28041
27932
  toolbar: _objectSpread2({
28042
27933
  hideToolbar,
28043
27934
  RenderedToolbar,
@@ -28048,18 +27939,16 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
28048
27939
  selectionStatus,
28049
27940
  apiRef,
28050
27941
  isRowSelectable,
28051
- page,
28052
- pageSize,
28053
- onPageChange,
28054
- onPageSizeChange,
28055
- rowsPerPageOptions,
27942
+ paginationModel,
27943
+ onPaginationModelChange,
27944
+ pageSizeOptions,
28056
27945
  paginationProps,
28057
27946
  paginationMode,
28058
27947
  rowCount
28059
- }, componentsProps === null || componentsProps === void 0 ? void 0 : componentsProps.toolbar)
27948
+ }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar)
28060
27949
  }),
28061
- selectionModel: selectionModel,
28062
- onSelectionModelChange: (newSelectionModel, details) => {
27950
+ rowSelectionModel: rowSelectionModel,
27951
+ onRowSelectionModelChange: (newSelectionModel, details) => {
28063
27952
  if (pagination && paginationMode != 'server') {
28064
27953
  const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
28065
27954
  let {
@@ -28117,7 +28006,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
28117
28006
  };
28118
28007
  }
28119
28008
  }
28120
- onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(newSelectionModel, details);
28009
+ onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
28121
28010
  },
28122
28011
  sx: _objectSpread2(_objectSpread2({}, sx), {}, {
28123
28012
  '.MuiDataGrid-columnHeaders': {
@@ -28191,5 +28080,5 @@ const TextCell = /*#__PURE__*/forwardRef((props, ref) => {
28191
28080
  TextCell.className = CLASSNAME;
28192
28081
  TextCell.displayName = COMPONENT_NAME;
28193
28082
 
28194
- 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 };
28083
+ 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 };
28195
28084
  //# sourceMappingURL=index.js.map