@redsift/table 11.3.0-muiv5 → 11.3.0

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 +288 -394
  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, 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, 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,14 +18131,14 @@ 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
  const searchParams = new URLSearchParams();
18139
18136
  for (const [key, value] of new URLSearchParams(searchString)) {
18140
18137
  if (key.startsWith('_') && !['_logicOperator', '_sortColumn', '_pinnedColumnsLeft', '_pinnedColumnsRight', '_columnVisibility', '_pagination'].includes(key)) {
18141
18138
  searchParams.set(key, value);
18142
18139
  }
18143
18140
  if (key === '_logicOperator') {
18144
- linkOperator = value;
18141
+ logicOperator = value === GridLogicOperator.And || value === GridLogicOperator.Or ? value : GridLogicOperator.And;
18145
18142
  }
18146
18143
  }
18147
18144
  let id = 5000;
@@ -18182,8 +18179,8 @@ const getFilterModelFromString = (searchString, columns) => {
18182
18179
  return;
18183
18180
  }
18184
18181
  items.push({
18185
- columnField: field,
18186
- operatorValue: ['number', 'rsNumber'].includes(columnType) && Object.keys(numberOperatorDecoder).includes(operator) ? numberOperatorDecoder[operator] : operator,
18182
+ field,
18183
+ operator: columnType === 'number' && Object.keys(numberOperatorDecoder).includes(operator) ? numberOperatorDecoder[operator] : operator,
18187
18184
  id,
18188
18185
  value: listOperators.includes(operator) && decodedValue === '' ? [] : decodedValue,
18189
18186
  type
@@ -18198,23 +18195,23 @@ const getFilterModelFromString = (searchString, columns) => {
18198
18195
  }
18199
18196
  return {
18200
18197
  items,
18201
- linkOperator
18198
+ logicOperator
18202
18199
  };
18203
18200
  };
18204
18201
  const getSearchParamsFromFilterModel = filterModel => {
18205
18202
  const searchParams = new URLSearchParams();
18206
- searchParams.set('_logicOperator', filterModel['linkOperator'] || '');
18203
+ searchParams.set('_logicOperator', filterModel['logicOperator'] || '');
18207
18204
  filterModel['items'].forEach(item => {
18208
18205
  const {
18209
- columnField,
18210
- operatorValue,
18206
+ field,
18207
+ operator,
18211
18208
  value,
18212
18209
  type
18213
18210
  } = item;
18214
- if (Object.keys(numberOperatorEncoder).includes(operatorValue)) {
18215
- searchParams.set(`_${columnField}[${numberOperatorEncoder[operatorValue]},${encodeValue(type)}]`, encodeValue(value));
18211
+ if (Object.keys(numberOperatorEncoder).includes(operator)) {
18212
+ searchParams.set(`_${field}[${numberOperatorEncoder[operator]},${encodeValue(type)}]`, encodeValue(value));
18216
18213
  } else {
18217
- searchParams.set(`_${columnField}[${encodeValue(operatorValue)},${encodeValue(type)}]`, encodeValue(value));
18214
+ searchParams.set(`_${field}[${encodeValue(operator)},${encodeValue(type)}]`, encodeValue(value));
18218
18215
  }
18219
18216
  });
18220
18217
  return searchParams;
@@ -18227,7 +18224,7 @@ const getSearchParamsFromFilterModel = filterModel => {
18227
18224
  const getFilterModel = (search, columns, localStorageFilters, setLocalStorageFilters, initialState, isNewVersion) => {
18228
18225
  const defaultValue = initialState && initialState.filter && initialState.filter.filterModel ? initialState.filter.filterModel : {
18229
18226
  items: [],
18230
- linkOperator: GridLinkOperator.And
18227
+ logicOperator: GridLogicOperator.And
18231
18228
  };
18232
18229
  if (isNewVersion) {
18233
18230
  return defaultValue;
@@ -18366,13 +18363,38 @@ const getPaginationModel = (search, localStoragePagination, setLocalStoragePagin
18366
18363
 
18367
18364
  /** COLUMN VISIBILITY */
18368
18365
 
18366
+ const getColumnVisibilityFromString = (searchString, columns) => {
18367
+ if (!searchString) {
18368
+ return 'invalid';
18369
+ }
18370
+ const searchParams = new URLSearchParams(searchString);
18371
+ const value = searchParams.get('_columnVisibility');
18372
+ if (value === '' || value === null || value === '[]') {
18373
+ return 'invalid';
18374
+ }
18375
+ const parsedFields = value.slice(1, value.length - 1).split(',');
18376
+ const fields = columns.map(column => column.field);
18377
+ const visibility = {};
18378
+ for (const field of fields) {
18379
+ visibility[field] = false;
18380
+ }
18381
+ for (const parsedField of parsedFields) {
18382
+ if (fields.includes(parsedField)) {
18383
+ visibility[parsedField] = true;
18384
+ }
18385
+ }
18386
+ if (Object.values(visibility).filter(v => v === true).length === 0) {
18387
+ return 'invalid';
18388
+ }
18389
+ return visibility;
18390
+ };
18369
18391
  const getSearchParamsFromColumnVisibility = (columnVisibility, columns) => {
18370
18392
  const searchParams = new URLSearchParams();
18371
- const columnFields = columns.map(column => column.field);
18393
+ const fields = columns.map(column => column.field);
18372
18394
 
18373
18395
  // if column visibility model is empty, show all columns
18374
18396
  if (Object.keys(columnVisibility).length == 0) {
18375
- searchParams.set('_columnVisibility', `[${columnFields.join(',')}]`);
18397
+ searchParams.set('_columnVisibility', `[${fields.join(',')}]`);
18376
18398
  return searchParams;
18377
18399
  }
18378
18400
  const finalColumnVisibility = columns.filter(c => {
@@ -18383,63 +18405,10 @@ const getSearchParamsFromColumnVisibility = (columnVisibility, columns) => {
18383
18405
  [colName]: true
18384
18406
  });
18385
18407
  }, columnVisibility);
18386
- const visibleColumns = Object.entries(finalColumnVisibility)
18387
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
18388
- .filter(_ref => {
18389
- let [_, visible] = _ref;
18390
- return visible;
18391
- })
18392
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
18393
- .map(_ref2 => {
18394
- let [column, _] = _ref2;
18395
- return encodeValue(column);
18396
- });
18408
+ const visibleColumns = fields.filter(column => finalColumnVisibility[column] !== false);
18397
18409
  searchParams.set('_columnVisibility', `[${visibleColumns.join(',')}]`);
18398
18410
  return searchParams;
18399
18411
  };
18400
- const getColumnVisibilityFromString = (notParsed, tableColumns) => {
18401
- if (!notParsed || notParsed.length === 1 && notParsed[0] === '?') {
18402
- return 'invalid';
18403
- }
18404
- // remove the initial ? if present
18405
- const parsed = notParsed[0] === '?' ? notParsed.slice(1) : notParsed;
18406
- const visibility = {};
18407
- let exist = false;
18408
- let visibleColumnsCount = 0;
18409
- for (const item of parsed.split('&')) {
18410
- // if it's not column visibility field, skip
18411
- const fieldURL = item.split('=')[0];
18412
- if (fieldURL !== '_columnVisibility') {
18413
- continue;
18414
- }
18415
- // e.g. item = _columnVisibility[abc,def]
18416
- const left = item.split(']')[0];
18417
- if (left.split('[').length < 2) {
18418
- continue;
18419
- }
18420
- const encodedValues = item.split('[')[1].split(']')[0];
18421
- if (typeof encodedValues !== 'string') {
18422
- continue;
18423
- }
18424
- exist = true;
18425
- const columnFields = tableColumns.map(column => column.field);
18426
- // TODO: Add validation that , is present
18427
- const columns = encodedValues.split(',').map(value => decodeValue(value));
18428
-
18429
- // for each column, check if it's visible and add it to visibility model
18430
- for (const column of columnFields) {
18431
- const isColumnVisible = columns.includes(column);
18432
- visibility[column] = isColumnVisible;
18433
- if (isColumnVisible) {
18434
- visibleColumnsCount += 1;
18435
- }
18436
- }
18437
- }
18438
- if (visibleColumnsCount === 0 && !exist) {
18439
- return 'invalid';
18440
- }
18441
- return visibility;
18442
- };
18443
18412
 
18444
18413
  // Rules:
18445
18414
  // - if we have something in the URL, use that info
@@ -18495,8 +18464,8 @@ const getPinnedColumnsFromString = (notParsed, tableColumns) => {
18495
18464
  if (typeof encodedValues !== 'string') {
18496
18465
  continue;
18497
18466
  }
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));
18467
+ const fields = [...tableColumns.map(column => column.field), '__check__'];
18468
+ const columns = encodedValues.split(',').map(value => decodeValue(value)).filter(val => typeof val === 'string' && fields.includes(val));
18500
18469
  if (fieldURL === '_pinnedColumnsLeft') {
18501
18470
  pinnedColumns['left'] = columns;
18502
18471
  }
@@ -18504,9 +18473,9 @@ const getPinnedColumnsFromString = (notParsed, tableColumns) => {
18504
18473
  pinnedColumns['right'] = columns;
18505
18474
  }
18506
18475
  }
18507
- return pinnedColumns['left'] || pinnedColumns['right'] ? {
18508
- left: pinnedColumns['left'] || [],
18509
- right: pinnedColumns['right'] || []
18476
+ return pinnedColumns.left && pinnedColumns.left.length > 0 || pinnedColumns.right && pinnedColumns.right.length > 0 ? {
18477
+ left: pinnedColumns.left || [],
18478
+ right: pinnedColumns.right || []
18510
18479
  } : 'invalid';
18511
18480
  };
18512
18481
  const getSearchParamsFromPinnedColumns = pinnedColumns => {
@@ -18556,7 +18525,7 @@ const getSearchParamsFromTab = search => {
18556
18525
  }
18557
18526
  return searchParams;
18558
18527
  };
18559
- const getFinalSearch = _ref3 => {
18528
+ const getFinalSearch = _ref => {
18560
18529
  let {
18561
18530
  search,
18562
18531
  localStorageVersion,
@@ -18566,7 +18535,7 @@ const getFinalSearch = _ref3 => {
18566
18535
  columnsVisibilityModel,
18567
18536
  pinnedColumnsModel,
18568
18537
  columns
18569
- } = _ref3;
18538
+ } = _ref;
18570
18539
  const filterModelSearch = getSearchParamsFromFilterModel(filterModel);
18571
18540
  const sortModelSearch = getSearchParamsFromSorting(sortModel);
18572
18541
  const paginationModelSearch = getSearchParamsFromPagination(paginationModel);
@@ -18625,14 +18594,14 @@ const getModelsParsedOrUpdateLocalStorage = (search, localStorageVersion, column
18625
18594
  pinnedColumnsModel
18626
18595
  };
18627
18596
  };
18628
- const updateUrl = (_ref4, search, localStorageVersion, historyReplace, columns) => {
18597
+ const updateUrl = (_ref2, search, localStorageVersion, historyReplace, columns) => {
18629
18598
  let {
18630
18599
  filterModel,
18631
18600
  sortModel,
18632
18601
  paginationModel,
18633
18602
  columnsModel: columnsVisibilityModel,
18634
18603
  pinnedColumnsModel
18635
- } = _ref4;
18604
+ } = _ref2;
18636
18605
  const newSearch = getFinalSearch({
18637
18606
  search,
18638
18607
  localStorageVersion,
@@ -18653,17 +18622,17 @@ const updateUrl = (_ref4, search, localStorageVersion, historyReplace, columns)
18653
18622
  // do not use it for equivalence (e.g. with value `3` and undefined we
18654
18623
  // will get 0).
18655
18624
  const compareFilters = (firstFilter, secondFilter) => {
18656
- if (firstFilter.columnField < secondFilter.columnField) {
18625
+ if (firstFilter.field < secondFilter.field) {
18657
18626
  return -1;
18658
- } else if (firstFilter.columnField > secondFilter.columnField) {
18627
+ } else if (firstFilter.field > secondFilter.field) {
18659
18628
  return 1;
18660
18629
  }
18661
- if (firstFilter.operatorValue === undefined || secondFilter.operatorValue === undefined) {
18630
+ if (firstFilter.operator === undefined || secondFilter.operator === undefined) {
18662
18631
  return 0;
18663
18632
  }
18664
- if (firstFilter.operatorValue < secondFilter.operatorValue) {
18633
+ if (firstFilter.operator < secondFilter.operator) {
18665
18634
  return -1;
18666
- } else if (firstFilter.operatorValue > secondFilter.operatorValue) {
18635
+ } else if (firstFilter.operator > secondFilter.operator) {
18667
18636
  return 1;
18668
18637
  }
18669
18638
  if (firstFilter.value < secondFilter.value) {
@@ -18674,18 +18643,18 @@ const compareFilters = (firstFilter, secondFilter) => {
18674
18643
  return 0;
18675
18644
  };
18676
18645
  const areFiltersEquivalent = (firstFilter, secondFilter) => {
18677
- return firstFilter.columnField === secondFilter.columnField && firstFilter.operatorValue === secondFilter.operatorValue && firstFilter.value === secondFilter.value;
18646
+ return firstFilter.field === secondFilter.field && firstFilter.operator === secondFilter.operator && firstFilter.value === secondFilter.value;
18678
18647
  };
18679
18648
  const areFilterModelsEquivalent = (filterModel, filterModelToMatch) => {
18680
18649
  const {
18681
18650
  items,
18682
- linkOperator
18651
+ logicOperator
18683
18652
  } = filterModel;
18684
18653
  const {
18685
18654
  items: itemsToMatch,
18686
- linkOperator: linkOperatorToMatch
18655
+ logicOperator: logicOperatorToMatch
18687
18656
  } = filterModelToMatch;
18688
- if (linkOperator !== linkOperatorToMatch) {
18657
+ if (logicOperator !== logicOperatorToMatch) {
18689
18658
  return false;
18690
18659
  }
18691
18660
  if (items.length !== itemsToMatch.length) {
@@ -18698,7 +18667,7 @@ const areFilterModelsEquivalent = (filterModel, filterModelToMatch) => {
18698
18667
  const filterToCompare = itemsToMatch[i];
18699
18668
 
18700
18669
  // compareFilters return 0 if and only if the filters have the same
18701
- // columnField, operatorValue, and value
18670
+ // field, operator, and value
18702
18671
  if (!areFiltersEquivalent(filter, filterToCompare)) {
18703
18672
  return false;
18704
18673
  }
@@ -24509,16 +24478,16 @@ const getRole = (config, dateFormat) => {
24509
24478
  }).join('\n');
24510
24479
  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.
24511
24480
  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.
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}
24481
+ The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "logicOperator" and "items":
24482
+ - "logicOperator": the logical operator, only "and" or "or" are allowed. If there is only one condition in the "items", use "and".
24483
+ - "items": a list of conditions, each is an object with exactly the three keys "field", "operator" and "value":
24484
+ - "field": the column name, must be one of ${columns}
24516
24485
  - "value":
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"
24486
+ - this can be skipped if the "operator" is either "isEmpty" or "isNotEmpty"
24487
+ - a list of multiple values if the "operator" ends with "AnyOf"
24519
24488
  - otherwise, it's a single value represented as a string: "true" instead of true, "false" instead of false, "0.6" instead of 0.6.
24520
24489
  For "date" data type, use ${dateFormat}. If relative date is input, convert to the actual date given today is ${today}.
24521
- - "operatorValue": the comparison operator, accepted values depend on the data type of the column
24490
+ - "operator": the comparison operator, accepted values depend on the data type of the column
24522
24491
  ${operators}
24523
24492
 
24524
24493
  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:
@@ -24555,10 +24524,10 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
24555
24524
  nlpFilterConfig,
24556
24525
  onFilterModelChange,
24557
24526
  dateFormat = 'yyyy-mm-dd',
24558
- defaultModel = 'gpt-4-0613',
24527
+ defaultModel = 'gpt-4-1106-preview',
24559
24528
  defaultFilter = {
24560
24529
  items: [],
24561
- linkOperator: 'and'
24530
+ logicOperator: 'and'
24562
24531
  },
24563
24532
  disablePower = false,
24564
24533
  localeText
@@ -24636,7 +24605,7 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
24636
24605
  value: prompt
24637
24606
  }), /*#__PURE__*/React__default.createElement(Button, {
24638
24607
  variant: "primary",
24639
- "aira-label": buttonAriaLabel,
24608
+ "aria-label": buttonAriaLabel,
24640
24609
  type: "submit",
24641
24610
  isLoading: isLoading
24642
24611
  }, buttonText)), !disablePower && /*#__PURE__*/React__default.createElement(Tooltip, null, /*#__PURE__*/React__default.createElement(Tooltip.Trigger, null, /*#__PURE__*/React__default.createElement(Switch, {
@@ -24697,7 +24666,7 @@ const Toolbar$2 = props => {
24697
24666
  let {
24698
24667
  apiRef
24699
24668
  } = _ref;
24700
- return gridVisibleSortedRowIdsSelector(apiRef);
24669
+ return gridExpandedSortedRowIdsSelector(apiRef);
24701
24670
  }
24702
24671
  },
24703
24672
  printOptions: {
@@ -26929,12 +26898,10 @@ const ServerSideControlledPagination = _ref3 => {
26929
26898
  selectionStatus,
26930
26899
  displaySelection,
26931
26900
  displayPagination,
26932
- page,
26933
- onPageChange,
26934
- pageSize,
26935
- onPageSizeChange,
26901
+ paginationModel,
26902
+ onPaginationModelChange,
26903
+ pageSizeOptions,
26936
26904
  displayRowsPerPage,
26937
- rowsPerPageOptions,
26938
26905
  paginationProps,
26939
26906
  rowCount
26940
26907
  } = _ref3;
@@ -26953,13 +26920,17 @@ const ServerSideControlledPagination = _ref3 => {
26953
26920
  }, totalRowsLabel) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$1({
26954
26921
  component: "div",
26955
26922
  count: totalNumberOfRowsInTable,
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 : []
26923
+ page: paginationModel.page,
26924
+ onPageChange: (event, page) => onPaginationModelChange({
26925
+ page,
26926
+ pageSize: paginationModel.pageSize
26927
+ }),
26928
+ rowsPerPage: paginationModel.pageSize,
26929
+ onRowsPerPageChange: event => onPaginationModelChange({
26930
+ page: paginationModel.page,
26931
+ pageSize: parseInt(event.target.value, 10)
26932
+ }),
26933
+ rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
26963
26934
  }, paginationProps)) : null);
26964
26935
  };
26965
26936
 
@@ -26985,11 +26956,9 @@ const ControlledPagination = _ref3 => {
26985
26956
  displayPagination = false,
26986
26957
  selectionStatus,
26987
26958
  apiRef,
26988
- page,
26989
- onPageChange,
26990
- pageSize,
26991
- onPageSizeChange,
26992
- rowsPerPageOptions,
26959
+ paginationModel,
26960
+ onPaginationModelChange,
26961
+ pageSizeOptions,
26993
26962
  isRowSelectable,
26994
26963
  paginationProps
26995
26964
  } = _ref3;
@@ -27019,17 +26988,25 @@ const ControlledPagination = _ref3 => {
27019
26988
  }, `${selectionStatus.numberOfSelectedRows} row${selectionStatus.numberOfSelectedRows > 1 ? 's' : ''} selected`) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$1({
27020
26989
  component: "div",
27021
26990
  count: numberOfFilteredRowsInTable,
27022
- page: page,
27023
- onPageChange: (event, newPage) => onPageChange(newPage),
27024
- rowsPerPage: pageSize,
26991
+ page: paginationModel.page,
26992
+ onPageChange: (event, page) => {
26993
+ onPaginationModelChange({
26994
+ page,
26995
+ pageSize: paginationModel.pageSize
26996
+ });
26997
+ },
26998
+ rowsPerPage: paginationModel.pageSize,
27025
26999
  onRowsPerPageChange: event => {
27026
- onPageSizeChange(parseInt(event.target.value, 10));
27000
+ onPaginationModelChange({
27001
+ page: paginationModel.page,
27002
+ pageSize: parseInt(event.target.value, 10)
27003
+ });
27027
27004
  },
27028
- rowsPerPageOptions: displayRowsPerPage ? rowsPerPageOptions : []
27005
+ rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
27029
27006
  }, paginationProps)) : null);
27030
27007
  };
27031
27008
 
27032
- const _excluded$3 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "page", "onPageChange", "pageSize", "onPageSizeChange", "rowsPerPageOptions", "paginationProps", "paginationMode", "rowCount"];
27009
+ const _excluded$3 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "paginationModel", "onPaginationModelChange", "pageSizeOptions", "paginationProps", "paginationMode", "rowCount"];
27033
27010
  const ToolbarWrapper = _ref => {
27034
27011
  let {
27035
27012
  hideToolbar,
@@ -27041,11 +27018,9 @@ const ToolbarWrapper = _ref => {
27041
27018
  selectionStatus,
27042
27019
  apiRef,
27043
27020
  isRowSelectable,
27044
- page,
27045
- onPageChange,
27046
- pageSize,
27047
- onPageSizeChange,
27048
- rowsPerPageOptions,
27021
+ paginationModel,
27022
+ onPaginationModelChange,
27023
+ pageSizeOptions,
27049
27024
  paginationProps,
27050
27025
  paginationMode = 'client',
27051
27026
  rowCount
@@ -27059,11 +27034,9 @@ const ToolbarWrapper = _ref => {
27059
27034
  displayRowsPerPage: false,
27060
27035
  displayPagination: ['top', 'both'].includes(paginationPlacement),
27061
27036
  selectionStatus: selectionStatus.current,
27062
- page: page,
27063
- onPageChange: onPageChange,
27064
- pageSize: pageSize,
27065
- onPageSizeChange: onPageSizeChange,
27066
- rowsPerPageOptions: rowsPerPageOptions,
27037
+ paginationModel: paginationModel,
27038
+ onPaginationModelChange: onPaginationModelChange,
27039
+ pageSizeOptions: pageSizeOptions,
27067
27040
  paginationProps: paginationProps,
27068
27041
  rowCount: rowCount
27069
27042
  }) : /*#__PURE__*/React__default.createElement(ControlledPagination, {
@@ -27073,30 +27046,26 @@ const ToolbarWrapper = _ref => {
27073
27046
  selectionStatus: selectionStatus.current,
27074
27047
  apiRef: apiRef,
27075
27048
  isRowSelectable: isRowSelectable,
27076
- page: page,
27077
- onPageChange: onPageChange,
27078
- pageSize: pageSize,
27079
- onPageSizeChange: onPageSizeChange,
27080
- rowsPerPageOptions: rowsPerPageOptions,
27049
+ paginationModel: paginationModel,
27050
+ onPaginationModelChange: onPaginationModelChange,
27051
+ pageSizeOptions: pageSizeOptions,
27081
27052
  paginationProps: paginationProps
27082
27053
  }) : null);
27083
27054
  };
27084
27055
 
27085
27056
  const useControlledDatagridState = _ref => {
27086
- var _initialState$paginat, _initialState$paginat2;
27057
+ var _ref2, _ref3, _propsPaginationModel, _initialState$paginat, _initialState$paginat2, _pageSizeOptions$, _ref4, _propsPaginationModel2, _initialState$paginat3, _initialState$paginat4;
27087
27058
  let {
27088
27059
  initialState,
27089
- rowsPerPageOptions,
27060
+ pageSizeOptions,
27090
27061
  propsColumnVisibilityModel,
27091
27062
  propsFilterModel,
27092
27063
  propsOnColumnVisibilityModelChange,
27093
27064
  propsOnFilterModelChange,
27094
- propsOnPageChange,
27095
- propsOnPageSizeChange,
27065
+ propsOnPaginationModelChange,
27096
27066
  propsOnPinnedColumnsChange,
27097
27067
  propsOnSortModelChange,
27098
- propsPage,
27099
- propsPageSize,
27068
+ propsPaginationModel,
27100
27069
  propsPinnedColumns,
27101
27070
  propsSortModel
27102
27071
  } = _ref;
@@ -27144,33 +27113,22 @@ const useControlledDatagridState = _ref => {
27144
27113
  setSortModel(model);
27145
27114
  }
27146
27115
  };
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);
27152
- } else {
27153
- setPage(page);
27154
- }
27155
- };
27156
- useEffect(() => {
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);
27116
+ const [paginationModel, setPaginationModel] = useState({
27117
+ 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,
27118
+ 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
27119
+ });
27120
+ const onPaginationModelChange = (model, details) => {
27121
+ if (propsOnPaginationModelChange) {
27122
+ propsOnPaginationModelChange(model, details);
27165
27123
  } else {
27166
- setPageSize(pageSize);
27124
+ setPaginationModel(model);
27167
27125
  }
27168
27126
  };
27169
27127
  useEffect(() => {
27170
- if (propsPageSize) {
27171
- setPageSize(propsPageSize);
27128
+ if (propsPaginationModel) {
27129
+ setPaginationModel(propsPaginationModel);
27172
27130
  }
27173
- }, [propsPageSize]);
27131
+ }, [propsPaginationModel]);
27174
27132
  return {
27175
27133
  filterModel,
27176
27134
  onFilterModelChange,
@@ -27180,14 +27138,12 @@ const useControlledDatagridState = _ref => {
27180
27138
  onPinnedColumnsChange,
27181
27139
  sortModel,
27182
27140
  onSortModelChange,
27183
- page,
27184
- pageSize,
27185
- onPageChange,
27186
- onPageSizeChange
27141
+ paginationModel,
27142
+ onPaginationModelChange
27187
27143
  };
27188
27144
  };
27189
27145
 
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"];
27146
+ 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"];
27191
27147
  const COMPONENT_NAME$2 = 'DataGrid';
27192
27148
  const CLASSNAME$2 = 'redsift-datagrid';
27193
27149
  const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
@@ -27196,33 +27152,30 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27196
27152
  apiRef: propsApiRef,
27197
27153
  autoHeight,
27198
27154
  className,
27199
- columnTypes: propsColumnTypes,
27200
- components,
27201
- componentsProps,
27155
+ slots,
27156
+ slotProps,
27202
27157
  filterModel: propsFilterModel,
27203
27158
  columnVisibilityModel: propsColumnVisibilityModel,
27204
27159
  pinnedColumns: propsPinnedColumns,
27205
27160
  sortModel: propsSortModel,
27161
+ paginationModel: propsPaginationModel,
27206
27162
  height: propsHeight,
27207
27163
  hideToolbar,
27208
27164
  initialState,
27209
27165
  isRowSelectable,
27210
27166
  license = process.env.MUI_LICENSE_KEY,
27211
27167
  onFilterModelChange: propsOnFilterModelChange,
27212
- onPageChange: propsOnPageChange,
27213
- onPageSizeChange: propsOnPageSizeChange,
27168
+ rowSelectionModel: propsRowSelectionModel,
27169
+ onPaginationModelChange: propsOnPaginationModelChange,
27170
+ onRowSelectionModelChange: propsOnRowSelectionModelChange,
27214
27171
  onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
27215
27172
  onPinnedColumnsChange: propsOnPinnedColumnsChange,
27216
27173
  onSortModelChange: propsOnSortModelChange,
27217
- selectionModel: propsSelectionModel,
27218
- onSelectionModelChange: propsOnSelectionModelChange,
27219
- page: propsPage,
27220
- pageSize: propsPageSize,
27221
27174
  pagination,
27222
27175
  paginationPlacement = 'both',
27223
27176
  paginationProps,
27224
27177
  rows,
27225
- rowsPerPageOptions,
27178
+ pageSizeOptions,
27226
27179
  sx,
27227
27180
  theme: propsTheme,
27228
27181
  paginationMode = 'client',
@@ -27232,7 +27185,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27232
27185
  const theme = useTheme$4(propsTheme);
27233
27186
  const _apiRef = useGridApiRef();
27234
27187
  const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
27235
- const RenderedToolbar = components !== null && components !== void 0 && components.Toolbar ? components.Toolbar : Toolbar$2;
27188
+ const RenderedToolbar = slots !== null && slots !== void 0 && slots.toolbar ? slots.toolbar : Toolbar$2;
27236
27189
  LicenseInfo.setLicenseKey(license);
27237
27190
  const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
27238
27191
  const {
@@ -27240,56 +27193,52 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27240
27193
  filterModel,
27241
27194
  onColumnVisibilityModelChange,
27242
27195
  onFilterModelChange,
27243
- onPageChange,
27244
- onPageSizeChange,
27196
+ onPaginationModelChange,
27245
27197
  onPinnedColumnsChange,
27246
27198
  onSortModelChange,
27247
- page,
27248
- pageSize,
27199
+ paginationModel,
27249
27200
  pinnedColumns,
27250
27201
  sortModel
27251
27202
  } = useControlledDatagridState({
27252
27203
  initialState,
27253
- rowsPerPageOptions,
27204
+ pageSizeOptions,
27254
27205
  propsColumnVisibilityModel,
27255
27206
  propsFilterModel,
27256
27207
  propsOnColumnVisibilityModelChange,
27257
27208
  propsOnFilterModelChange,
27258
27209
  propsOnPinnedColumnsChange,
27259
27210
  propsOnSortModelChange,
27260
- propsPage,
27261
- propsPageSize,
27211
+ propsPaginationModel,
27262
27212
  propsPinnedColumns,
27263
27213
  propsSortModel,
27264
- propsOnPageChange,
27265
- propsOnPageSizeChange
27214
+ propsOnPaginationModelChange
27266
27215
  });
27267
- const [selectionModel, setSelectionModel] = useState(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
27216
+ const [rowSelectionModel, setRowSelectionModel] = useState(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
27268
27217
  useEffect(() => {
27269
- setSelectionModel(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
27270
- }, [propsSelectionModel]);
27271
- const onSelectionModelChange = (selectionModel, details) => {
27272
- if (propsOnSelectionModelChange) {
27273
- propsOnSelectionModelChange(selectionModel, details);
27218
+ setRowSelectionModel(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
27219
+ }, [propsRowSelectionModel]);
27220
+ const onRowSelectionModelChange = (selectionModel, details) => {
27221
+ if (propsOnRowSelectionModelChange) {
27222
+ propsOnRowSelectionModelChange(selectionModel, details);
27274
27223
  } else {
27275
- setSelectionModel(selectionModel);
27224
+ setRowSelectionModel(selectionModel);
27276
27225
  }
27277
27226
  };
27278
27227
  const selectionStatus = useRef({
27279
27228
  type: 'none',
27280
27229
  numberOfSelectedRows: 0,
27281
27230
  numberOfSelectedRowsInPage: 0,
27282
- page,
27283
- pageSize
27231
+ page: paginationModel.page,
27232
+ pageSize: paginationModel.pageSize
27284
27233
  });
27285
27234
 
27286
27235
  // in server-side pagination we want to update the selection status
27287
27236
  // every time we navigate between pages, resize our page or select something
27288
27237
  useEffect(() => {
27289
27238
  if (paginationMode == 'server') {
27290
- onServerSideSelectionStatusChange(Array.isArray(selectionModel) ? selectionModel : [selectionModel], apiRef, selectionStatus, isRowSelectable, page, pageSize);
27239
+ onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatus, isRowSelectable, paginationModel.page, paginationModel.pageSize);
27291
27240
  }
27292
- }, [selectionModel, page, pageSize]);
27241
+ }, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
27293
27242
  if (!Array.isArray(rows)) {
27294
27243
  return null;
27295
27244
  }
@@ -27320,57 +27269,54 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27320
27269
  apiRef: apiRef,
27321
27270
  autoHeight: autoHeight,
27322
27271
  checkboxSelectionVisibleOnly: Boolean(pagination),
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, {
27272
+ slots: _objectSpread2(_objectSpread2({
27273
+ baseButton: BaseButton,
27274
+ baseCheckbox: BaseCheckbox,
27275
+ // baseTextField,
27276
+ basePopper: BasePopper,
27277
+ columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27330
27278
  displayName: "ColumnFilteredIcon"
27331
27279
  })),
27332
- ColumnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27280
+ columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27333
27281
  displayName: "ColumnSelectorIcon"
27334
27282
  })),
27335
- ColumnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27283
+ columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27336
27284
  displayName: "ColumnSortedAscendingIcon"
27337
27285
  })),
27338
- ColumnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27286
+ columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27339
27287
  displayName: "ColumnSortedDescendingIcon"
27340
27288
  })),
27341
- DensityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27289
+ densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27342
27290
  displayName: "DensityCompactIcon"
27343
27291
  })),
27344
- DensityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27292
+ densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27345
27293
  displayName: "DensityStandardIcon"
27346
27294
  })),
27347
- DensityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27295
+ densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27348
27296
  displayName: "DensityComfortableIcon"
27349
27297
  })),
27350
- DetailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27298
+ detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27351
27299
  displayName: "DetailPanelCollapseIcon"
27352
27300
  })),
27353
- DetailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27301
+ detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27354
27302
  displayName: "DetailPanelExpandIcon"
27355
27303
  })),
27356
- ExportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27304
+ exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27357
27305
  displayName: "ExportIcon"
27358
27306
  })),
27359
- OpenFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
27307
+ openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
27360
27308
  displayName: "OpenFilterButtonIcon"
27361
27309
  }, props))
27362
- }, components), {}, {
27363
- Toolbar: ToolbarWrapper,
27364
- Pagination: props => pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$1({}, props, {
27310
+ }, slots), {}, {
27311
+ toolbar: ToolbarWrapper,
27312
+ pagination: props => pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$1({}, props, {
27365
27313
  displaySelection: false,
27366
27314
  displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
27367
27315
  displayPagination: ['bottom', 'both'].includes(paginationPlacement),
27368
27316
  selectionStatus: selectionStatus.current,
27369
- page: page,
27370
- onPageChange: onPageChange,
27371
- pageSize: pageSize,
27372
- onPageSizeChange: onPageSizeChange,
27373
- rowsPerPageOptions: rowsPerPageOptions,
27317
+ paginationModel: paginationModel,
27318
+ onPaginationModelChange: onPaginationModelChange,
27319
+ pageSizeOptions: pageSizeOptions,
27374
27320
  paginationProps: paginationProps,
27375
27321
  paginationMode: paginationMode,
27376
27322
  rowCount: rowCount
@@ -27381,16 +27327,14 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27381
27327
  selectionStatus: selectionStatus.current,
27382
27328
  apiRef: apiRef,
27383
27329
  isRowSelectable: isRowSelectable,
27384
- page: page,
27385
- onPageChange: onPageChange,
27386
- pageSize: pageSize,
27387
- onPageSizeChange: onPageSizeChange,
27388
- rowsPerPageOptions: rowsPerPageOptions,
27330
+ paginationModel: paginationModel,
27331
+ onPaginationModelChange: onPaginationModelChange,
27332
+ pageSizeOptions: pageSizeOptions,
27389
27333
  paginationProps: paginationProps,
27390
27334
  paginationMode: paginationMode
27391
27335
  })) : null
27392
27336
  }),
27393
- componentsProps: _objectSpread2(_objectSpread2({}, componentsProps), {}, {
27337
+ slotProps: _objectSpread2(_objectSpread2({}, slotProps), {}, {
27394
27338
  toolbar: _objectSpread2({
27395
27339
  hideToolbar,
27396
27340
  RenderedToolbar,
@@ -27401,15 +27345,13 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27401
27345
  selectionStatus,
27402
27346
  apiRef,
27403
27347
  isRowSelectable,
27404
- page,
27405
- onPageChange,
27406
- pageSize,
27407
- onPageSizeChange,
27408
- rowsPerPageOptions,
27348
+ paginationModel,
27349
+ onPaginationModelChange,
27350
+ pageSizeOptions,
27409
27351
  paginationProps,
27410
27352
  paginationMode,
27411
27353
  rowCount
27412
- }, componentsProps === null || componentsProps === void 0 ? void 0 : componentsProps.toolbar)
27354
+ }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar)
27413
27355
  }),
27414
27356
  filterModel: filterModel,
27415
27357
  columnVisibilityModel: columnVisibilityModel,
@@ -27425,13 +27367,11 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27425
27367
  paginationMode: paginationMode,
27426
27368
  keepNonExistentRowsSelected: paginationMode == 'server',
27427
27369
  rows: rows,
27428
- rowsPerPageOptions: rowsPerPageOptions,
27429
- page: page,
27430
- onPageChange: onPageChange,
27431
- pageSize: pageSize,
27432
- onPageSizeChange: onPageSizeChange,
27433
- selectionModel: selectionModel,
27434
- onSelectionModelChange: (newSelectionModel, details) => {
27370
+ pageSizeOptions: pageSizeOptions,
27371
+ paginationModel: paginationModel,
27372
+ onPaginationModelChange: onPaginationModelChange,
27373
+ rowSelectionModel: rowSelectionModel,
27374
+ onRowSelectionModelChange: (newSelectionModel, details) => {
27435
27375
  if (pagination && paginationMode != 'server') {
27436
27376
  const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
27437
27377
  let {
@@ -27489,7 +27429,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27489
27429
  };
27490
27430
  }
27491
27431
  }
27492
- onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(newSelectionModel, details);
27432
+ onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
27493
27433
  },
27494
27434
  sx: _objectSpread2(_objectSpread2({}, sx), {}, {
27495
27435
  '.MuiDataGrid-columnHeaders': {
@@ -27506,8 +27446,6 @@ DataGrid.className = CLASSNAME$2;
27506
27446
  DataGrid.displayName = COMPONENT_NAME$2;
27507
27447
 
27508
27448
  // Get and Set data from LocalStorage WITHOUT useState
27509
-
27510
- // triggering a state update and consecutive re-render
27511
27449
  const useFetchState = (defaultValue, key) => {
27512
27450
  let stickyValue = null;
27513
27451
  try {
@@ -27515,16 +27453,7 @@ const useFetchState = (defaultValue, key) => {
27515
27453
  } catch (e) {
27516
27454
  console.error('StatefulDataGrid: error getting item from local storage: ', e);
27517
27455
  }
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
- }
27456
+ const parsedValue = stickyValue !== null && stickyValue !== undefined && stickyValue !== 'undefined' ? JSON.parse(stickyValue) : defaultValue;
27528
27457
  const updateValue = useCallback(value => {
27529
27458
  try {
27530
27459
  window.localStorage.setItem(key, JSON.stringify(value));
@@ -27535,6 +27464,8 @@ const useFetchState = (defaultValue, key) => {
27535
27464
  return [parsedValue, updateValue];
27536
27465
  };
27537
27466
 
27467
+ // import useLocalStorage from './useLocalStorage';
27468
+
27538
27469
  const useTableStates = (id, version) => {
27539
27470
  const [paginationModel, setPaginationModel] = useFetchState('', buildStorageKey({
27540
27471
  id,
@@ -27591,8 +27522,7 @@ const useStatefulTable = props => {
27591
27522
  onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
27592
27523
  onColumnWidthChange: propsOnColumnWidthChange,
27593
27524
  onFilterModelChange: propsOnFilterModelChange,
27594
- onPageChange: propsOnPageChange,
27595
- onPageSizeChange: propsOnPageSizeChange,
27525
+ onPaginationModelChange: propsOnPaginationModelChange,
27596
27526
  onPinnedColumnsChange: propsOnPinnedColumnsChange,
27597
27527
  onSortModelChange: propsOnSortModelChange,
27598
27528
  useRouter,
@@ -27622,7 +27552,7 @@ const useStatefulTable = props => {
27622
27552
  setDimensionModel
27623
27553
  } = useTableStates(id, localStorageVersion);
27624
27554
 
27625
- // clearing up old version keys
27555
+ // clearing up old version keys, triggering only on first render
27626
27556
  useEffect(() => clearPreviousVersionStorage(id, previousLocalStorageVersions), [id, previousLocalStorageVersions]);
27627
27557
  const onColumnDimensionChange = useCallback(_ref => {
27628
27558
  let {
@@ -27655,7 +27585,6 @@ const useStatefulTable = props => {
27655
27585
  column.width = dimensionModel[column.field] || column.width || 100;
27656
27586
  return column;
27657
27587
  }), [propsColumns, dimensionModel]);
27658
-
27659
27588
  /** Add resetPage method to apiRef. */
27660
27589
  apiRef.current.resetPage = () => {
27661
27590
  apiRef.current.setPage(0);
@@ -27666,7 +27595,7 @@ const useStatefulTable = props => {
27666
27595
  onFilterModelChange: (model, details) => {
27667
27596
  const filterModel = _objectSpread2(_objectSpread2({}, model), {}, {
27668
27597
  items: model.items.map(item => {
27669
- const column = apiRef.current.getColumn(item.columnField);
27598
+ const column = apiRef.current.getColumn(item.field);
27670
27599
  item.type = column.type || 'string';
27671
27600
  return item;
27672
27601
  })
@@ -27703,33 +27632,16 @@ const useStatefulTable = props => {
27703
27632
  }, search, localStorageVersion, historyReplace, columns);
27704
27633
  },
27705
27634
  pinnedColumns: pinnedColumnsModel,
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);
27711
- updateUrl({
27712
- filterModel: filterParsed,
27713
- sortModel: sortModelParsed,
27714
- paginationModel: {
27715
- page,
27716
- pageSize: paginationModelParsed.pageSize,
27717
- direction
27718
- },
27719
- columnsModel: apiRef.current.state.columns.columnVisibilityModel,
27720
- pinnedColumnsModel: pinnedColumnsModel
27721
- }, search, localStorageVersion, historyReplace, columns);
27722
- },
27723
- onPageSizeChange: (pageSize, details) => {
27724
- propsOnPageSizeChange === null || propsOnPageSizeChange === void 0 ? void 0 : propsOnPageSizeChange(pageSize, details);
27635
+ paginationModel: paginationModelParsed,
27636
+ onPaginationModelChange: (model, details) => {
27637
+ const paginationModel = _objectSpread2(_objectSpread2({}, model), {}, {
27638
+ direction: paginationModelParsed.page < model.page ? 'next' : 'back'
27639
+ });
27640
+ propsOnPaginationModelChange === null || propsOnPaginationModelChange === void 0 ? void 0 : propsOnPaginationModelChange(paginationModel, details);
27725
27641
  updateUrl({
27726
27642
  filterModel: filterParsed,
27727
27643
  sortModel: sortModelParsed,
27728
- paginationModel: {
27729
- page: paginationModelParsed.page,
27730
- pageSize,
27731
- direction: paginationModelParsed.direction
27732
- },
27644
+ paginationModel: paginationModel,
27733
27645
  columnsModel: apiRef.current.state.columns.columnVisibilityModel,
27734
27646
  pinnedColumnsModel: pinnedColumnsModel
27735
27647
  }, search, localStorageVersion, historyReplace, columns);
@@ -27755,7 +27667,7 @@ const useStatefulTable = props => {
27755
27667
  };
27756
27668
  };
27757
27669
 
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"];
27670
+ 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"];
27759
27671
  const COMPONENT_NAME$1 = 'DataGrid';
27760
27672
  const CLASSNAME$1 = 'redsift-datagrid';
27761
27673
  const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
@@ -27765,15 +27677,13 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27765
27677
  autoHeight,
27766
27678
  className,
27767
27679
  columns,
27768
- columnTypes: propsColumnTypes,
27769
- components,
27770
- componentsProps,
27680
+ slots,
27681
+ slotProps,
27771
27682
  filterModel: propsFilterModel,
27772
27683
  columnVisibilityModel: propsColumnVisibilityModel,
27773
27684
  pinnedColumns: propsPinnedColumns,
27774
27685
  sortModel: propsSortModel,
27775
- page: propsPage,
27776
- pageSize: propsPageSize,
27686
+ paginationModel: propsPaginationModel,
27777
27687
  height: propsHeight,
27778
27688
  hideToolbar,
27779
27689
  initialState,
@@ -27782,11 +27692,10 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27782
27692
  localStorageVersion,
27783
27693
  previousLocalStorageVersions,
27784
27694
  onFilterModelChange: propsOnFilterModelChange,
27785
- selectionModel: propsSelectionModel,
27695
+ rowSelectionModel: propsRowSelectionModel,
27786
27696
  onColumnWidthChange: propsOnColumnWidthChange,
27787
- onPageChange: propsOnPageChange,
27788
- onPageSizeChange: propsOnPageSizeChange,
27789
- onSelectionModelChange: propsOnSelectionModelChange,
27697
+ onPaginationModelChange: propsOnPaginationModelChange,
27698
+ onRowSelectionModelChange: propsOnRowSelectionModelChange,
27790
27699
  onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
27791
27700
  onPinnedColumnsChange: propsOnPinnedColumnsChange,
27792
27701
  onSortModelChange: propsOnSortModelChange,
@@ -27794,7 +27703,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27794
27703
  paginationPlacement = 'both',
27795
27704
  paginationProps,
27796
27705
  rows,
27797
- rowsPerPageOptions,
27706
+ pageSizeOptions,
27798
27707
  sx,
27799
27708
  theme: propsTheme,
27800
27709
  useRouter,
@@ -27805,43 +27714,38 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27805
27714
  const theme = useTheme$4(propsTheme);
27806
27715
  const _apiRef = useGridApiRef();
27807
27716
  const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
27808
- const RenderedToolbar = components !== null && components !== void 0 && components.Toolbar ? components.Toolbar : Toolbar$2;
27717
+ const RenderedToolbar = slots !== null && slots !== void 0 && slots.toolbar ? slots.toolbar : Toolbar$2;
27809
27718
  LicenseInfo.setLicenseKey(license);
27810
27719
  const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
27811
27720
  const {
27812
27721
  onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
27813
27722
  onFilterModelChange: controlledOnFilterModelChange,
27814
- onPageChange: controlledOnPageChange,
27815
- onPageSizeChange: controlledOnPageSizeChange,
27723
+ onPaginationModelChange: controlledOnPaginationModelChange,
27816
27724
  onPinnedColumnsChange: controlledOnPinnedColumnsChange,
27817
27725
  onSortModelChange: controlledOnSortModelChange
27818
27726
  } = useControlledDatagridState({
27819
27727
  initialState,
27820
- rowsPerPageOptions,
27728
+ pageSizeOptions,
27821
27729
  propsColumnVisibilityModel,
27822
27730
  propsFilterModel,
27823
27731
  propsOnColumnVisibilityModelChange,
27824
27732
  propsOnFilterModelChange,
27825
27733
  propsOnPinnedColumnsChange,
27826
27734
  propsOnSortModelChange,
27827
- propsPage,
27828
- propsPageSize,
27735
+ propsPaginationModel,
27829
27736
  propsPinnedColumns,
27830
27737
  propsSortModel,
27831
- propsOnPageChange,
27832
- propsOnPageSizeChange
27738
+ propsOnPaginationModelChange
27833
27739
  });
27834
27740
  const {
27835
27741
  columnVisibilityModel,
27836
27742
  filterModel,
27837
27743
  onColumnVisibilityModelChange,
27838
27744
  onFilterModelChange,
27839
- onPageChange,
27840
- onPageSizeChange,
27745
+ onPaginationModelChange,
27841
27746
  onPinnedColumnsChange,
27842
27747
  onSortModelChange,
27843
- page,
27844
- pageSize,
27748
+ paginationModel,
27845
27749
  pinnedColumns,
27846
27750
  sortModel,
27847
27751
  onColumnWidthChange
@@ -27852,40 +27756,39 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27852
27756
  onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
27853
27757
  onColumnWidthChange: propsOnColumnWidthChange,
27854
27758
  onFilterModelChange: controlledOnFilterModelChange,
27855
- onPageChange: controlledOnPageChange,
27856
- onPageSizeChange: controlledOnPageSizeChange,
27759
+ onPaginationModelChange: controlledOnPaginationModelChange,
27857
27760
  onPinnedColumnsChange: controlledOnPinnedColumnsChange,
27858
27761
  onSortModelChange: controlledOnSortModelChange,
27859
27762
  useRouter: useRouter,
27860
27763
  localStorageVersion,
27861
27764
  previousLocalStorageVersions
27862
27765
  });
27863
- const [selectionModel, setSelectionModel] = useState(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
27766
+ const [rowSelectionModel, setRowSelectionModel] = useState(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
27864
27767
  useEffect(() => {
27865
- setSelectionModel(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
27866
- }, [propsSelectionModel]);
27867
- const onSelectionModelChange = (selectionModel, details) => {
27868
- if (propsOnSelectionModelChange) {
27869
- propsOnSelectionModelChange(selectionModel, details);
27768
+ setRowSelectionModel(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
27769
+ }, [propsRowSelectionModel]);
27770
+ const onRowSelectionModelChange = (selectionModel, details) => {
27771
+ if (propsOnRowSelectionModelChange) {
27772
+ propsOnRowSelectionModelChange(selectionModel, details);
27870
27773
  } else {
27871
- setSelectionModel(selectionModel);
27774
+ setRowSelectionModel(selectionModel);
27872
27775
  }
27873
27776
  };
27874
27777
  const selectionStatus = useRef({
27875
27778
  type: 'none',
27876
27779
  numberOfSelectedRows: 0,
27877
27780
  numberOfSelectedRowsInPage: 0,
27878
- page,
27879
- pageSize: pageSize
27781
+ page: paginationModel.page,
27782
+ pageSize: paginationModel.pageSize
27880
27783
  });
27881
27784
 
27882
27785
  // in server-side pagination we want to update the selection status
27883
27786
  // every time we navigate between pages, resize our page or select something
27884
27787
  useEffect(() => {
27885
27788
  if (paginationMode == 'server') {
27886
- onServerSideSelectionStatusChange(Array.isArray(selectionModel) ? selectionModel : [selectionModel], apiRef, selectionStatus, isRowSelectable, page, pageSize);
27789
+ onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatus, isRowSelectable, paginationModel.page, paginationModel.pageSize);
27887
27790
  }
27888
- }, [selectionModel, page, pageSize]);
27791
+ }, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
27889
27792
  if (!Array.isArray(rows)) {
27890
27793
  return null;
27891
27794
  }
@@ -27918,15 +27821,13 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27918
27821
  filterModel: filterModel,
27919
27822
  onColumnVisibilityModelChange: onColumnVisibilityModelChange,
27920
27823
  onFilterModelChange: onFilterModelChange,
27921
- onPageChange: onPageChange,
27922
- onPageSizeChange: onPageSizeChange,
27824
+ onPaginationModelChange: onPaginationModelChange,
27923
27825
  onPinnedColumnsChange: onPinnedColumnsChange,
27924
27826
  onSortModelChange: onSortModelChange,
27925
- page: page,
27926
- pageSize: pageSize,
27827
+ paginationModel: paginationModel,
27927
27828
  pinnedColumns: pinnedColumns,
27928
27829
  sortModel: sortModel,
27929
- rowsPerPageOptions: rowsPerPageOptions,
27830
+ pageSizeOptions: pageSizeOptions,
27930
27831
  onColumnWidthChange: onColumnWidthChange,
27931
27832
  initialState: initialState,
27932
27833
  isRowSelectable: isRowSelectable,
@@ -27937,58 +27838,55 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27937
27838
  rowCount: rowCount,
27938
27839
  autoHeight: autoHeight,
27939
27840
  checkboxSelectionVisibleOnly: Boolean(pagination),
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, {
27841
+ slots: _objectSpread2(_objectSpread2({
27842
+ baseButton: BaseButton,
27843
+ baseCheckbox: BaseCheckbox,
27844
+ // baseTextField,
27845
+ basePopper: BasePopper,
27846
+ columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27947
27847
  displayName: "ColumnFilteredIcon"
27948
27848
  })),
27949
- ColumnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27849
+ columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27950
27850
  displayName: "ColumnSelectorIcon"
27951
27851
  })),
27952
- ColumnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27852
+ columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27953
27853
  displayName: "ColumnSortedAscendingIcon"
27954
27854
  })),
27955
- ColumnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27855
+ columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27956
27856
  displayName: "ColumnSortedDescendingIcon"
27957
27857
  })),
27958
- DensityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27858
+ densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27959
27859
  displayName: "DensityCompactIcon"
27960
27860
  })),
27961
- DensityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27861
+ densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27962
27862
  displayName: "DensityStandardIcon"
27963
27863
  })),
27964
- DensityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27864
+ densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27965
27865
  displayName: "DensityComfortableIcon"
27966
27866
  })),
27967
- DetailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27867
+ detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27968
27868
  displayName: "DetailPanelCollapseIcon"
27969
27869
  })),
27970
- DetailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27870
+ detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27971
27871
  displayName: "DetailPanelExpandIcon"
27972
27872
  })),
27973
- ExportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27873
+ exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27974
27874
  displayName: "ExportIcon"
27975
27875
  })),
27976
- OpenFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
27876
+ openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
27977
27877
  displayName: "OpenFilterButtonIcon"
27978
27878
  }, props))
27979
- }, components), {}, {
27980
- Toolbar: ToolbarWrapper,
27981
- Pagination: props => {
27879
+ }, slots), {}, {
27880
+ toolbar: ToolbarWrapper,
27881
+ pagination: props => {
27982
27882
  return pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$1({}, props, {
27983
27883
  displaySelection: false,
27984
27884
  displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
27985
27885
  displayPagination: ['bottom', 'both'].includes(paginationPlacement),
27986
27886
  selectionStatus: selectionStatus.current,
27987
- page: page,
27988
- pageSize: pageSize,
27989
- onPageChange: onPageChange,
27990
- onPageSizeChange: onPageSizeChange,
27991
- rowsPerPageOptions: rowsPerPageOptions,
27887
+ paginationModel: paginationModel,
27888
+ onPaginationModelChange: onPaginationModelChange,
27889
+ pageSizeOptions: pageSizeOptions,
27992
27890
  paginationProps: paginationProps,
27993
27891
  paginationMode: paginationMode,
27994
27892
  rowCount: rowCount
@@ -27999,17 +27897,15 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27999
27897
  selectionStatus: selectionStatus.current,
28000
27898
  apiRef: apiRef,
28001
27899
  isRowSelectable: isRowSelectable,
28002
- page: page,
28003
- pageSize: pageSize,
28004
- onPageChange: onPageChange,
28005
- onPageSizeChange: onPageSizeChange,
28006
- rowsPerPageOptions: rowsPerPageOptions,
27900
+ paginationModel: paginationModel,
27901
+ onPaginationModelChange: onPaginationModelChange,
27902
+ pageSizeOptions: pageSizeOptions,
28007
27903
  paginationProps: paginationProps,
28008
27904
  paginationMode: paginationMode
28009
27905
  })) : null;
28010
27906
  }
28011
27907
  }),
28012
- componentsProps: _objectSpread2(_objectSpread2({}, componentsProps), {}, {
27908
+ slotProps: _objectSpread2(_objectSpread2({}, slotProps), {}, {
28013
27909
  toolbar: _objectSpread2({
28014
27910
  hideToolbar,
28015
27911
  RenderedToolbar,
@@ -28020,18 +27916,16 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
28020
27916
  selectionStatus,
28021
27917
  apiRef,
28022
27918
  isRowSelectable,
28023
- page,
28024
- pageSize,
28025
- onPageChange,
28026
- onPageSizeChange,
28027
- rowsPerPageOptions,
27919
+ paginationModel,
27920
+ onPaginationModelChange,
27921
+ pageSizeOptions,
28028
27922
  paginationProps,
28029
27923
  paginationMode,
28030
27924
  rowCount
28031
- }, componentsProps === null || componentsProps === void 0 ? void 0 : componentsProps.toolbar)
27925
+ }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar)
28032
27926
  }),
28033
- selectionModel: selectionModel,
28034
- onSelectionModelChange: (newSelectionModel, details) => {
27927
+ rowSelectionModel: rowSelectionModel,
27928
+ onRowSelectionModelChange: (newSelectionModel, details) => {
28035
27929
  if (pagination && paginationMode != 'server') {
28036
27930
  const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
28037
27931
  let {
@@ -28089,7 +27983,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
28089
27983
  };
28090
27984
  }
28091
27985
  }
28092
- onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(newSelectionModel, details);
27986
+ onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
28093
27987
  },
28094
27988
  sx: _objectSpread2(_objectSpread2({}, sx), {}, {
28095
27989
  '.MuiDataGrid-columnHeaders': {
@@ -28163,5 +28057,5 @@ const TextCell = /*#__PURE__*/forwardRef((props, ref) => {
28163
28057
  TextCell.className = CLASSNAME;
28164
28058
  TextCell.displayName = COMPONENT_NAME;
28165
28059
 
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 };
28060
+ 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 };
28167
28061
  //# sourceMappingURL=index.js.map