@redsift/table 11.3.0-muiv5 → 11.3.1-alpha.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.
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, 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,14 +18131,22 @@ const getFilterModelFromString = (searchString, columns) => {
18134
18131
  if (!searchString) {
18135
18132
  return 'invalid';
18136
18133
  }
18137
- let linkOperator = GridLinkOperator.And;
18134
+ let logicOperator = GridLogicOperator.And;
18135
+ let quickFilterValues = [];
18138
18136
  const searchParams = new URLSearchParams();
18139
18137
  for (const [key, value] of new URLSearchParams(searchString)) {
18140
- if (key.startsWith('_') && !['_logicOperator', '_sortColumn', '_pinnedColumnsLeft', '_pinnedColumnsRight', '_columnVisibility', '_pagination'].includes(key)) {
18138
+ if (key.startsWith('_') && !['_logicOperator', '_sortColumn', '_pinnedColumnsLeft', '_pinnedColumnsRight', '_columnVisibility', '_pagination', '_quickFilterValues'].includes(key)) {
18141
18139
  searchParams.set(key, value);
18142
18140
  }
18143
18141
  if (key === '_logicOperator') {
18144
- linkOperator = value;
18142
+ logicOperator = value === GridLogicOperator.And || value === GridLogicOperator.Or ? value : GridLogicOperator.And;
18143
+ }
18144
+ if (key === '_quickFilterValues') {
18145
+ try {
18146
+ quickFilterValues = JSON.parse(decodeURIComponent(value));
18147
+ } catch {
18148
+ quickFilterValues = [];
18149
+ }
18145
18150
  }
18146
18151
  }
18147
18152
  let id = 5000;
@@ -18153,7 +18158,7 @@ const getFilterModelFromString = (searchString, columns) => {
18153
18158
  if (isInvalid) {
18154
18159
  return;
18155
18160
  }
18156
- const field = key.split('[')[0].slice(1); // Slice to remove the _ at the beginning
18161
+ const field = key.split('[')[0].slice(1);
18157
18162
  if (!fields.includes(field)) {
18158
18163
  return;
18159
18164
  }
@@ -18170,7 +18175,6 @@ const getFilterModelFromString = (searchString, columns) => {
18170
18175
  return;
18171
18176
  }
18172
18177
  const operator = splitRight[0];
18173
- // if the operator is not part of the valid operators invalidate the URL
18174
18178
  if (!isOperatorValueValid(field, operator, columns) || Array.isArray(operator)) {
18175
18179
  isInvalid = true;
18176
18180
  return;
@@ -18182,41 +18186,42 @@ const getFilterModelFromString = (searchString, columns) => {
18182
18186
  return;
18183
18187
  }
18184
18188
  items.push({
18185
- columnField: field,
18186
- 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,
18187
18191
  id,
18188
18192
  value: listOperators.includes(operator) && decodedValue === '' ? [] : decodedValue,
18189
18193
  type
18190
18194
  });
18191
18195
  });
18192
-
18193
- // If we found some condition that results in an invalid URL,
18194
- // return the empty filterModel (this will trigger the localStorage)
18195
- // and will pick up the last valid search
18196
18196
  if (isInvalid) {
18197
18197
  return 'invalid';
18198
18198
  }
18199
18199
  return {
18200
18200
  items,
18201
- linkOperator
18201
+ logicOperator,
18202
+ quickFilterValues
18202
18203
  };
18203
18204
  };
18204
18205
  const getSearchParamsFromFilterModel = filterModel => {
18206
+ var _filterModel$quickFil;
18205
18207
  const searchParams = new URLSearchParams();
18206
- searchParams.set('_logicOperator', filterModel['linkOperator'] || '');
18208
+ searchParams.set('_logicOperator', filterModel['logicOperator'] || '');
18207
18209
  filterModel['items'].forEach(item => {
18208
18210
  const {
18209
- columnField,
18210
- operatorValue,
18211
+ field,
18212
+ operator,
18211
18213
  value,
18212
18214
  type
18213
18215
  } = item;
18214
- if (Object.keys(numberOperatorEncoder).includes(operatorValue)) {
18215
- 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));
18216
18218
  } else {
18217
- searchParams.set(`_${columnField}[${encodeValue(operatorValue)},${encodeValue(type)}]`, encodeValue(value));
18219
+ searchParams.set(`_${field}[${encodeValue(operator)},${encodeValue(type)}]`, encodeValue(value));
18218
18220
  }
18219
18221
  });
18222
+ if ((_filterModel$quickFil = filterModel.quickFilterValues) !== null && _filterModel$quickFil !== void 0 && _filterModel$quickFil.length) {
18223
+ searchParams.set('_quickFilterValues', encodeURIComponent(JSON.stringify(filterModel.quickFilterValues)));
18224
+ }
18220
18225
  return searchParams;
18221
18226
  };
18222
18227
 
@@ -18227,7 +18232,7 @@ const getSearchParamsFromFilterModel = filterModel => {
18227
18232
  const getFilterModel = (search, columns, localStorageFilters, setLocalStorageFilters, initialState, isNewVersion) => {
18228
18233
  const defaultValue = initialState && initialState.filter && initialState.filter.filterModel ? initialState.filter.filterModel : {
18229
18234
  items: [],
18230
- linkOperator: GridLinkOperator.And
18235
+ logicOperator: GridLogicOperator.And
18231
18236
  };
18232
18237
  if (isNewVersion) {
18233
18238
  return defaultValue;
@@ -18366,13 +18371,38 @@ const getPaginationModel = (search, localStoragePagination, setLocalStoragePagin
18366
18371
 
18367
18372
  /** COLUMN VISIBILITY */
18368
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
+ };
18369
18399
  const getSearchParamsFromColumnVisibility = (columnVisibility, columns) => {
18370
18400
  const searchParams = new URLSearchParams();
18371
- const columnFields = columns.map(column => column.field);
18401
+ const fields = columns.map(column => column.field);
18372
18402
 
18373
18403
  // if column visibility model is empty, show all columns
18374
18404
  if (Object.keys(columnVisibility).length == 0) {
18375
- searchParams.set('_columnVisibility', `[${columnFields.join(',')}]`);
18405
+ searchParams.set('_columnVisibility', `[${fields.join(',')}]`);
18376
18406
  return searchParams;
18377
18407
  }
18378
18408
  const finalColumnVisibility = columns.filter(c => {
@@ -18383,63 +18413,10 @@ const getSearchParamsFromColumnVisibility = (columnVisibility, columns) => {
18383
18413
  [colName]: true
18384
18414
  });
18385
18415
  }, 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
- });
18416
+ const visibleColumns = fields.filter(column => finalColumnVisibility[column] !== false);
18397
18417
  searchParams.set('_columnVisibility', `[${visibleColumns.join(',')}]`);
18398
18418
  return searchParams;
18399
18419
  };
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
18420
 
18444
18421
  // Rules:
18445
18422
  // - if we have something in the URL, use that info
@@ -18495,8 +18472,8 @@ const getPinnedColumnsFromString = (notParsed, tableColumns) => {
18495
18472
  if (typeof encodedValues !== 'string') {
18496
18473
  continue;
18497
18474
  }
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));
18475
+ const fields = [...tableColumns.map(column => column.field), '__check__'];
18476
+ const columns = encodedValues.split(',').map(value => decodeValue(value)).filter(val => typeof val === 'string' && fields.includes(val));
18500
18477
  if (fieldURL === '_pinnedColumnsLeft') {
18501
18478
  pinnedColumns['left'] = columns;
18502
18479
  }
@@ -18504,9 +18481,9 @@ const getPinnedColumnsFromString = (notParsed, tableColumns) => {
18504
18481
  pinnedColumns['right'] = columns;
18505
18482
  }
18506
18483
  }
18507
- return pinnedColumns['left'] || pinnedColumns['right'] ? {
18508
- left: pinnedColumns['left'] || [],
18509
- right: pinnedColumns['right'] || []
18484
+ return pinnedColumns.left && pinnedColumns.left.length > 0 || pinnedColumns.right && pinnedColumns.right.length > 0 ? {
18485
+ left: pinnedColumns.left || [],
18486
+ right: pinnedColumns.right || []
18510
18487
  } : 'invalid';
18511
18488
  };
18512
18489
  const getSearchParamsFromPinnedColumns = pinnedColumns => {
@@ -18556,7 +18533,7 @@ const getSearchParamsFromTab = search => {
18556
18533
  }
18557
18534
  return searchParams;
18558
18535
  };
18559
- const getFinalSearch = _ref3 => {
18536
+ const getFinalSearch = _ref => {
18560
18537
  let {
18561
18538
  search,
18562
18539
  localStorageVersion,
@@ -18566,7 +18543,7 @@ const getFinalSearch = _ref3 => {
18566
18543
  columnsVisibilityModel,
18567
18544
  pinnedColumnsModel,
18568
18545
  columns
18569
- } = _ref3;
18546
+ } = _ref;
18570
18547
  const filterModelSearch = getSearchParamsFromFilterModel(filterModel);
18571
18548
  const sortModelSearch = getSearchParamsFromSorting(sortModel);
18572
18549
  const paginationModelSearch = getSearchParamsFromPagination(paginationModel);
@@ -18580,6 +18557,12 @@ const getFinalSearch = _ref3 => {
18580
18557
  }
18581
18558
  }
18582
18559
  searchParams.set('v', `${localStorageVersion}`);
18560
+
18561
+ // Add quickFilterValues explicitly if present in filterModel
18562
+ if (filterModel.quickFilterValues && filterModel.quickFilterValues.length > 0) {
18563
+ // Encode array as JSON string to preserve all values in one param
18564
+ searchParams.set('_quickFilterValues', encodeURIComponent(JSON.stringify(filterModel.quickFilterValues)));
18565
+ }
18583
18566
  return new URLSearchParams([...searchParams, ...filterModelSearch, ...sortModelSearch, ...paginationModelSearch, ...tabSearch, ...pinnedColumnsModelSearch, ...columnVisibilityModelSearch]);
18584
18567
  };
18585
18568
  /** Return the state of the table given the URL and the local storage state */
@@ -18625,14 +18608,14 @@ const getModelsParsedOrUpdateLocalStorage = (search, localStorageVersion, column
18625
18608
  pinnedColumnsModel
18626
18609
  };
18627
18610
  };
18628
- const updateUrl = (_ref4, search, localStorageVersion, historyReplace, columns) => {
18611
+ const updateUrl = (_ref2, search, localStorageVersion, historyReplace, columns) => {
18629
18612
  let {
18630
18613
  filterModel,
18631
18614
  sortModel,
18632
18615
  paginationModel,
18633
18616
  columnsModel: columnsVisibilityModel,
18634
18617
  pinnedColumnsModel
18635
- } = _ref4;
18618
+ } = _ref2;
18636
18619
  const newSearch = getFinalSearch({
18637
18620
  search,
18638
18621
  localStorageVersion,
@@ -18653,17 +18636,17 @@ const updateUrl = (_ref4, search, localStorageVersion, historyReplace, columns)
18653
18636
  // do not use it for equivalence (e.g. with value `3` and undefined we
18654
18637
  // will get 0).
18655
18638
  const compareFilters = (firstFilter, secondFilter) => {
18656
- if (firstFilter.columnField < secondFilter.columnField) {
18639
+ if (firstFilter.field < secondFilter.field) {
18657
18640
  return -1;
18658
- } else if (firstFilter.columnField > secondFilter.columnField) {
18641
+ } else if (firstFilter.field > secondFilter.field) {
18659
18642
  return 1;
18660
18643
  }
18661
- if (firstFilter.operatorValue === undefined || secondFilter.operatorValue === undefined) {
18644
+ if (firstFilter.operator === undefined || secondFilter.operator === undefined) {
18662
18645
  return 0;
18663
18646
  }
18664
- if (firstFilter.operatorValue < secondFilter.operatorValue) {
18647
+ if (firstFilter.operator < secondFilter.operator) {
18665
18648
  return -1;
18666
- } else if (firstFilter.operatorValue > secondFilter.operatorValue) {
18649
+ } else if (firstFilter.operator > secondFilter.operator) {
18667
18650
  return 1;
18668
18651
  }
18669
18652
  if (firstFilter.value < secondFilter.value) {
@@ -18674,18 +18657,18 @@ const compareFilters = (firstFilter, secondFilter) => {
18674
18657
  return 0;
18675
18658
  };
18676
18659
  const areFiltersEquivalent = (firstFilter, secondFilter) => {
18677
- return firstFilter.columnField === secondFilter.columnField && firstFilter.operatorValue === secondFilter.operatorValue && firstFilter.value === secondFilter.value;
18660
+ return firstFilter.field === secondFilter.field && firstFilter.operator === secondFilter.operator && firstFilter.value === secondFilter.value;
18678
18661
  };
18679
18662
  const areFilterModelsEquivalent = (filterModel, filterModelToMatch) => {
18680
18663
  const {
18681
18664
  items,
18682
- linkOperator
18665
+ logicOperator
18683
18666
  } = filterModel;
18684
18667
  const {
18685
18668
  items: itemsToMatch,
18686
- linkOperator: linkOperatorToMatch
18669
+ logicOperator: logicOperatorToMatch
18687
18670
  } = filterModelToMatch;
18688
- if (linkOperator !== linkOperatorToMatch) {
18671
+ if (logicOperator !== logicOperatorToMatch) {
18689
18672
  return false;
18690
18673
  }
18691
18674
  if (items.length !== itemsToMatch.length) {
@@ -18698,7 +18681,7 @@ const areFilterModelsEquivalent = (filterModel, filterModelToMatch) => {
18698
18681
  const filterToCompare = itemsToMatch[i];
18699
18682
 
18700
18683
  // compareFilters return 0 if and only if the filters have the same
18701
- // columnField, operatorValue, and value
18684
+ // field, operator, and value
18702
18685
  if (!areFiltersEquivalent(filter, filterToCompare)) {
18703
18686
  return false;
18704
18687
  }
@@ -24509,16 +24492,16 @@ const getRole = (config, dateFormat) => {
24509
24492
  }).join('\n');
24510
24493
  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
24494
  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}
24495
+ The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "logicOperator" and "items":
24496
+ - "logicOperator": the logical operator, only "and" or "or" are allowed. If there is only one condition in the "items", use "and".
24497
+ - "items": a list of conditions, each is an object with exactly the three keys "field", "operator" and "value":
24498
+ - "field": the column name, must be one of ${columns}
24516
24499
  - "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"
24500
+ - this can be skipped if the "operator" is either "isEmpty" or "isNotEmpty"
24501
+ - a list of multiple values if the "operator" ends with "AnyOf"
24519
24502
  - 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
24503
  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
24504
+ - "operator": the comparison operator, accepted values depend on the data type of the column
24522
24505
  ${operators}
24523
24506
 
24524
24507
  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 +24538,10 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
24555
24538
  nlpFilterConfig,
24556
24539
  onFilterModelChange,
24557
24540
  dateFormat = 'yyyy-mm-dd',
24558
- defaultModel = 'gpt-4-0613',
24541
+ defaultModel = 'gpt-4-1106-preview',
24559
24542
  defaultFilter = {
24560
24543
  items: [],
24561
- linkOperator: 'and'
24544
+ logicOperator: 'and'
24562
24545
  },
24563
24546
  disablePower = false,
24564
24547
  localeText
@@ -24636,7 +24619,7 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
24636
24619
  value: prompt
24637
24620
  }), /*#__PURE__*/React__default.createElement(Button, {
24638
24621
  variant: "primary",
24639
- "aira-label": buttonAriaLabel,
24622
+ "aria-label": buttonAriaLabel,
24640
24623
  type: "submit",
24641
24624
  isLoading: isLoading
24642
24625
  }, buttonText)), !disablePower && /*#__PURE__*/React__default.createElement(Tooltip, null, /*#__PURE__*/React__default.createElement(Tooltip.Trigger, null, /*#__PURE__*/React__default.createElement(Switch, {
@@ -24673,7 +24656,8 @@ const Toolbar$2 = props => {
24673
24656
  densityButtonProps,
24674
24657
  densityButtonRef,
24675
24658
  onFilterModelChange,
24676
- semanticFilterProps = undefined
24659
+ semanticFilterProps = undefined,
24660
+ showQuickFilter
24677
24661
  } = props;
24678
24662
  if (semanticFilterProps && onFilterModelChange) {
24679
24663
  semanticFilterProps.onFilterModelChange = onFilterModelChange;
@@ -24697,7 +24681,7 @@ const Toolbar$2 = props => {
24697
24681
  let {
24698
24682
  apiRef
24699
24683
  } = _ref;
24700
- return gridVisibleSortedRowIdsSelector(apiRef);
24684
+ return gridExpandedSortedRowIdsSelector(apiRef);
24701
24685
  }
24702
24686
  },
24703
24687
  printOptions: {
@@ -24706,7 +24690,9 @@ const Toolbar$2 = props => {
24706
24690
  }, exportButtonProps, {
24707
24691
  ref: exportButtonRef,
24708
24692
  className: filterButtonProps !== null && filterButtonProps !== void 0 && filterButtonProps.className ? `${filterButtonProps === null || filterButtonProps === void 0 ? void 0 : filterButtonProps.className} redsift-condensed` : 'redsift-condensed'
24709
- })) : null), /*#__PURE__*/React__default.createElement(Flexbox, {
24693
+ })) : null, /*#__PURE__*/React__default.createElement(Flexbox, {
24694
+ marginLeft: "8px"
24695
+ }, showQuickFilter ? /*#__PURE__*/React__default.createElement(GridToolbarQuickFilter, null) : null)), /*#__PURE__*/React__default.createElement(Flexbox, {
24710
24696
  flexGrow: 3
24711
24697
  }, semanticFilterProps ? /*#__PURE__*/React__default.createElement(GridToolbarFilterSemanticField, semanticFilterProps) : null)));
24712
24698
  };
@@ -26929,12 +26915,10 @@ const ServerSideControlledPagination = _ref3 => {
26929
26915
  selectionStatus,
26930
26916
  displaySelection,
26931
26917
  displayPagination,
26932
- page,
26933
- onPageChange,
26934
- pageSize,
26935
- onPageSizeChange,
26918
+ paginationModel,
26919
+ onPaginationModelChange,
26920
+ pageSizeOptions,
26936
26921
  displayRowsPerPage,
26937
- rowsPerPageOptions,
26938
26922
  paginationProps,
26939
26923
  rowCount
26940
26924
  } = _ref3;
@@ -26953,13 +26937,17 @@ const ServerSideControlledPagination = _ref3 => {
26953
26937
  }, totalRowsLabel) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$1({
26954
26938
  component: "div",
26955
26939
  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 : []
26940
+ page: paginationModel.page,
26941
+ onPageChange: (event, page) => onPaginationModelChange({
26942
+ page,
26943
+ pageSize: paginationModel.pageSize
26944
+ }),
26945
+ rowsPerPage: paginationModel.pageSize,
26946
+ onRowsPerPageChange: event => onPaginationModelChange({
26947
+ page: paginationModel.page,
26948
+ pageSize: parseInt(event.target.value, 10)
26949
+ }),
26950
+ rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
26963
26951
  }, paginationProps)) : null);
26964
26952
  };
26965
26953
 
@@ -26985,11 +26973,9 @@ const ControlledPagination = _ref3 => {
26985
26973
  displayPagination = false,
26986
26974
  selectionStatus,
26987
26975
  apiRef,
26988
- page,
26989
- onPageChange,
26990
- pageSize,
26991
- onPageSizeChange,
26992
- rowsPerPageOptions,
26976
+ paginationModel,
26977
+ onPaginationModelChange,
26978
+ pageSizeOptions,
26993
26979
  isRowSelectable,
26994
26980
  paginationProps
26995
26981
  } = _ref3;
@@ -27019,17 +27005,25 @@ const ControlledPagination = _ref3 => {
27019
27005
  }, `${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
27006
  component: "div",
27021
27007
  count: numberOfFilteredRowsInTable,
27022
- page: page,
27023
- onPageChange: (event, newPage) => onPageChange(newPage),
27024
- rowsPerPage: pageSize,
27008
+ page: paginationModel.page,
27009
+ onPageChange: (event, page) => {
27010
+ onPaginationModelChange({
27011
+ page,
27012
+ pageSize: paginationModel.pageSize
27013
+ });
27014
+ },
27015
+ rowsPerPage: paginationModel.pageSize,
27025
27016
  onRowsPerPageChange: event => {
27026
- onPageSizeChange(parseInt(event.target.value, 10));
27017
+ onPaginationModelChange({
27018
+ page: paginationModel.page,
27019
+ pageSize: parseInt(event.target.value, 10)
27020
+ });
27027
27021
  },
27028
- rowsPerPageOptions: displayRowsPerPage ? rowsPerPageOptions : []
27022
+ rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
27029
27023
  }, paginationProps)) : null);
27030
27024
  };
27031
27025
 
27032
- const _excluded$3 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "page", "onPageChange", "pageSize", "onPageSizeChange", "rowsPerPageOptions", "paginationProps", "paginationMode", "rowCount"];
27026
+ const _excluded$3 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "paginationModel", "onPaginationModelChange", "pageSizeOptions", "paginationProps", "paginationMode", "rowCount"];
27033
27027
  const ToolbarWrapper = _ref => {
27034
27028
  let {
27035
27029
  hideToolbar,
@@ -27041,11 +27035,9 @@ const ToolbarWrapper = _ref => {
27041
27035
  selectionStatus,
27042
27036
  apiRef,
27043
27037
  isRowSelectable,
27044
- page,
27045
- onPageChange,
27046
- pageSize,
27047
- onPageSizeChange,
27048
- rowsPerPageOptions,
27038
+ paginationModel,
27039
+ onPaginationModelChange,
27040
+ pageSizeOptions,
27049
27041
  paginationProps,
27050
27042
  paginationMode = 'client',
27051
27043
  rowCount
@@ -27059,11 +27051,9 @@ const ToolbarWrapper = _ref => {
27059
27051
  displayRowsPerPage: false,
27060
27052
  displayPagination: ['top', 'both'].includes(paginationPlacement),
27061
27053
  selectionStatus: selectionStatus.current,
27062
- page: page,
27063
- onPageChange: onPageChange,
27064
- pageSize: pageSize,
27065
- onPageSizeChange: onPageSizeChange,
27066
- rowsPerPageOptions: rowsPerPageOptions,
27054
+ paginationModel: paginationModel,
27055
+ onPaginationModelChange: onPaginationModelChange,
27056
+ pageSizeOptions: pageSizeOptions,
27067
27057
  paginationProps: paginationProps,
27068
27058
  rowCount: rowCount
27069
27059
  }) : /*#__PURE__*/React__default.createElement(ControlledPagination, {
@@ -27073,30 +27063,26 @@ const ToolbarWrapper = _ref => {
27073
27063
  selectionStatus: selectionStatus.current,
27074
27064
  apiRef: apiRef,
27075
27065
  isRowSelectable: isRowSelectable,
27076
- page: page,
27077
- onPageChange: onPageChange,
27078
- pageSize: pageSize,
27079
- onPageSizeChange: onPageSizeChange,
27080
- rowsPerPageOptions: rowsPerPageOptions,
27066
+ paginationModel: paginationModel,
27067
+ onPaginationModelChange: onPaginationModelChange,
27068
+ pageSizeOptions: pageSizeOptions,
27081
27069
  paginationProps: paginationProps
27082
27070
  }) : null);
27083
27071
  };
27084
27072
 
27085
27073
  const useControlledDatagridState = _ref => {
27086
- var _initialState$paginat, _initialState$paginat2;
27074
+ var _ref2, _ref3, _propsPaginationModel, _initialState$paginat, _initialState$paginat2, _pageSizeOptions$, _ref4, _propsPaginationModel2, _initialState$paginat3, _initialState$paginat4;
27087
27075
  let {
27088
27076
  initialState,
27089
- rowsPerPageOptions,
27077
+ pageSizeOptions,
27090
27078
  propsColumnVisibilityModel,
27091
27079
  propsFilterModel,
27092
27080
  propsOnColumnVisibilityModelChange,
27093
27081
  propsOnFilterModelChange,
27094
- propsOnPageChange,
27095
- propsOnPageSizeChange,
27082
+ propsOnPaginationModelChange,
27096
27083
  propsOnPinnedColumnsChange,
27097
27084
  propsOnSortModelChange,
27098
- propsPage,
27099
- propsPageSize,
27085
+ propsPaginationModel,
27100
27086
  propsPinnedColumns,
27101
27087
  propsSortModel
27102
27088
  } = _ref;
@@ -27144,33 +27130,22 @@ const useControlledDatagridState = _ref => {
27144
27130
  setSortModel(model);
27145
27131
  }
27146
27132
  };
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);
27133
+ const [paginationModel, setPaginationModel] = useState({
27134
+ 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,
27135
+ 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
27136
+ });
27137
+ const onPaginationModelChange = (model, details) => {
27138
+ if (propsOnPaginationModelChange) {
27139
+ propsOnPaginationModelChange(model, details);
27165
27140
  } else {
27166
- setPageSize(pageSize);
27141
+ setPaginationModel(model);
27167
27142
  }
27168
27143
  };
27169
27144
  useEffect(() => {
27170
- if (propsPageSize) {
27171
- setPageSize(propsPageSize);
27145
+ if (propsPaginationModel) {
27146
+ setPaginationModel(propsPaginationModel);
27172
27147
  }
27173
- }, [propsPageSize]);
27148
+ }, [propsPaginationModel]);
27174
27149
  return {
27175
27150
  filterModel,
27176
27151
  onFilterModelChange,
@@ -27180,14 +27155,12 @@ const useControlledDatagridState = _ref => {
27180
27155
  onPinnedColumnsChange,
27181
27156
  sortModel,
27182
27157
  onSortModelChange,
27183
- page,
27184
- pageSize,
27185
- onPageChange,
27186
- onPageSizeChange
27158
+ paginationModel,
27159
+ onPaginationModelChange
27187
27160
  };
27188
27161
  };
27189
27162
 
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"];
27163
+ 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
27164
  const COMPONENT_NAME$2 = 'DataGrid';
27192
27165
  const CLASSNAME$2 = 'redsift-datagrid';
27193
27166
  const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
@@ -27196,33 +27169,30 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27196
27169
  apiRef: propsApiRef,
27197
27170
  autoHeight,
27198
27171
  className,
27199
- columnTypes: propsColumnTypes,
27200
- components,
27201
- componentsProps,
27172
+ slots,
27173
+ slotProps,
27202
27174
  filterModel: propsFilterModel,
27203
27175
  columnVisibilityModel: propsColumnVisibilityModel,
27204
27176
  pinnedColumns: propsPinnedColumns,
27205
27177
  sortModel: propsSortModel,
27178
+ paginationModel: propsPaginationModel,
27206
27179
  height: propsHeight,
27207
27180
  hideToolbar,
27208
27181
  initialState,
27209
27182
  isRowSelectable,
27210
27183
  license = process.env.MUI_LICENSE_KEY,
27211
27184
  onFilterModelChange: propsOnFilterModelChange,
27212
- onPageChange: propsOnPageChange,
27213
- onPageSizeChange: propsOnPageSizeChange,
27185
+ rowSelectionModel: propsRowSelectionModel,
27186
+ onPaginationModelChange: propsOnPaginationModelChange,
27187
+ onRowSelectionModelChange: propsOnRowSelectionModelChange,
27214
27188
  onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
27215
27189
  onPinnedColumnsChange: propsOnPinnedColumnsChange,
27216
27190
  onSortModelChange: propsOnSortModelChange,
27217
- selectionModel: propsSelectionModel,
27218
- onSelectionModelChange: propsOnSelectionModelChange,
27219
- page: propsPage,
27220
- pageSize: propsPageSize,
27221
27191
  pagination,
27222
27192
  paginationPlacement = 'both',
27223
27193
  paginationProps,
27224
27194
  rows,
27225
- rowsPerPageOptions,
27195
+ pageSizeOptions,
27226
27196
  sx,
27227
27197
  theme: propsTheme,
27228
27198
  paginationMode = 'client',
@@ -27232,7 +27202,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27232
27202
  const theme = useTheme$4(propsTheme);
27233
27203
  const _apiRef = useGridApiRef();
27234
27204
  const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
27235
- const RenderedToolbar = components !== null && components !== void 0 && components.Toolbar ? components.Toolbar : Toolbar$2;
27205
+ const RenderedToolbar = slots !== null && slots !== void 0 && slots.toolbar ? slots.toolbar : Toolbar$2;
27236
27206
  LicenseInfo.setLicenseKey(license);
27237
27207
  const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
27238
27208
  const {
@@ -27240,56 +27210,52 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27240
27210
  filterModel,
27241
27211
  onColumnVisibilityModelChange,
27242
27212
  onFilterModelChange,
27243
- onPageChange,
27244
- onPageSizeChange,
27213
+ onPaginationModelChange,
27245
27214
  onPinnedColumnsChange,
27246
27215
  onSortModelChange,
27247
- page,
27248
- pageSize,
27216
+ paginationModel,
27249
27217
  pinnedColumns,
27250
27218
  sortModel
27251
27219
  } = useControlledDatagridState({
27252
27220
  initialState,
27253
- rowsPerPageOptions,
27221
+ pageSizeOptions,
27254
27222
  propsColumnVisibilityModel,
27255
27223
  propsFilterModel,
27256
27224
  propsOnColumnVisibilityModelChange,
27257
27225
  propsOnFilterModelChange,
27258
27226
  propsOnPinnedColumnsChange,
27259
27227
  propsOnSortModelChange,
27260
- propsPage,
27261
- propsPageSize,
27228
+ propsPaginationModel,
27262
27229
  propsPinnedColumns,
27263
27230
  propsSortModel,
27264
- propsOnPageChange,
27265
- propsOnPageSizeChange
27231
+ propsOnPaginationModelChange
27266
27232
  });
27267
- const [selectionModel, setSelectionModel] = useState(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
27233
+ const [rowSelectionModel, setRowSelectionModel] = useState(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
27268
27234
  useEffect(() => {
27269
- setSelectionModel(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
27270
- }, [propsSelectionModel]);
27271
- const onSelectionModelChange = (selectionModel, details) => {
27272
- if (propsOnSelectionModelChange) {
27273
- propsOnSelectionModelChange(selectionModel, details);
27235
+ setRowSelectionModel(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
27236
+ }, [propsRowSelectionModel]);
27237
+ const onRowSelectionModelChange = (selectionModel, details) => {
27238
+ if (propsOnRowSelectionModelChange) {
27239
+ propsOnRowSelectionModelChange(selectionModel, details);
27274
27240
  } else {
27275
- setSelectionModel(selectionModel);
27241
+ setRowSelectionModel(selectionModel);
27276
27242
  }
27277
27243
  };
27278
27244
  const selectionStatus = useRef({
27279
27245
  type: 'none',
27280
27246
  numberOfSelectedRows: 0,
27281
27247
  numberOfSelectedRowsInPage: 0,
27282
- page,
27283
- pageSize
27248
+ page: paginationModel.page,
27249
+ pageSize: paginationModel.pageSize
27284
27250
  });
27285
27251
 
27286
27252
  // in server-side pagination we want to update the selection status
27287
27253
  // every time we navigate between pages, resize our page or select something
27288
27254
  useEffect(() => {
27289
27255
  if (paginationMode == 'server') {
27290
- onServerSideSelectionStatusChange(Array.isArray(selectionModel) ? selectionModel : [selectionModel], apiRef, selectionStatus, isRowSelectable, page, pageSize);
27256
+ onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatus, isRowSelectable, paginationModel.page, paginationModel.pageSize);
27291
27257
  }
27292
- }, [selectionModel, page, pageSize]);
27258
+ }, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
27293
27259
  if (!Array.isArray(rows)) {
27294
27260
  return null;
27295
27261
  }
@@ -27320,57 +27286,54 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27320
27286
  apiRef: apiRef,
27321
27287
  autoHeight: autoHeight,
27322
27288
  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, {
27289
+ slots: _objectSpread2(_objectSpread2({
27290
+ baseButton: BaseButton,
27291
+ baseCheckbox: BaseCheckbox,
27292
+ // baseTextField,
27293
+ basePopper: BasePopper,
27294
+ columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27330
27295
  displayName: "ColumnFilteredIcon"
27331
27296
  })),
27332
- ColumnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27297
+ columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27333
27298
  displayName: "ColumnSelectorIcon"
27334
27299
  })),
27335
- ColumnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27300
+ columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27336
27301
  displayName: "ColumnSortedAscendingIcon"
27337
27302
  })),
27338
- ColumnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27303
+ columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27339
27304
  displayName: "ColumnSortedDescendingIcon"
27340
27305
  })),
27341
- DensityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27306
+ densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27342
27307
  displayName: "DensityCompactIcon"
27343
27308
  })),
27344
- DensityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27309
+ densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27345
27310
  displayName: "DensityStandardIcon"
27346
27311
  })),
27347
- DensityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27312
+ densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27348
27313
  displayName: "DensityComfortableIcon"
27349
27314
  })),
27350
- DetailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27315
+ detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27351
27316
  displayName: "DetailPanelCollapseIcon"
27352
27317
  })),
27353
- DetailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27318
+ detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27354
27319
  displayName: "DetailPanelExpandIcon"
27355
27320
  })),
27356
- ExportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27321
+ exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27357
27322
  displayName: "ExportIcon"
27358
27323
  })),
27359
- OpenFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
27324
+ openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
27360
27325
  displayName: "OpenFilterButtonIcon"
27361
27326
  }, props))
27362
- }, components), {}, {
27363
- Toolbar: ToolbarWrapper,
27364
- Pagination: props => pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$1({}, props, {
27327
+ }, slots), {}, {
27328
+ toolbar: ToolbarWrapper,
27329
+ pagination: props => pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$1({}, props, {
27365
27330
  displaySelection: false,
27366
27331
  displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
27367
27332
  displayPagination: ['bottom', 'both'].includes(paginationPlacement),
27368
27333
  selectionStatus: selectionStatus.current,
27369
- page: page,
27370
- onPageChange: onPageChange,
27371
- pageSize: pageSize,
27372
- onPageSizeChange: onPageSizeChange,
27373
- rowsPerPageOptions: rowsPerPageOptions,
27334
+ paginationModel: paginationModel,
27335
+ onPaginationModelChange: onPaginationModelChange,
27336
+ pageSizeOptions: pageSizeOptions,
27374
27337
  paginationProps: paginationProps,
27375
27338
  paginationMode: paginationMode,
27376
27339
  rowCount: rowCount
@@ -27381,16 +27344,14 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27381
27344
  selectionStatus: selectionStatus.current,
27382
27345
  apiRef: apiRef,
27383
27346
  isRowSelectable: isRowSelectable,
27384
- page: page,
27385
- onPageChange: onPageChange,
27386
- pageSize: pageSize,
27387
- onPageSizeChange: onPageSizeChange,
27388
- rowsPerPageOptions: rowsPerPageOptions,
27347
+ paginationModel: paginationModel,
27348
+ onPaginationModelChange: onPaginationModelChange,
27349
+ pageSizeOptions: pageSizeOptions,
27389
27350
  paginationProps: paginationProps,
27390
27351
  paginationMode: paginationMode
27391
27352
  })) : null
27392
27353
  }),
27393
- componentsProps: _objectSpread2(_objectSpread2({}, componentsProps), {}, {
27354
+ slotProps: _objectSpread2(_objectSpread2({}, slotProps), {}, {
27394
27355
  toolbar: _objectSpread2({
27395
27356
  hideToolbar,
27396
27357
  RenderedToolbar,
@@ -27401,15 +27362,13 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27401
27362
  selectionStatus,
27402
27363
  apiRef,
27403
27364
  isRowSelectable,
27404
- page,
27405
- onPageChange,
27406
- pageSize,
27407
- onPageSizeChange,
27408
- rowsPerPageOptions,
27365
+ paginationModel,
27366
+ onPaginationModelChange,
27367
+ pageSizeOptions,
27409
27368
  paginationProps,
27410
27369
  paginationMode,
27411
27370
  rowCount
27412
- }, componentsProps === null || componentsProps === void 0 ? void 0 : componentsProps.toolbar)
27371
+ }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar)
27413
27372
  }),
27414
27373
  filterModel: filterModel,
27415
27374
  columnVisibilityModel: columnVisibilityModel,
@@ -27425,13 +27384,11 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27425
27384
  paginationMode: paginationMode,
27426
27385
  keepNonExistentRowsSelected: paginationMode == 'server',
27427
27386
  rows: rows,
27428
- rowsPerPageOptions: rowsPerPageOptions,
27429
- page: page,
27430
- onPageChange: onPageChange,
27431
- pageSize: pageSize,
27432
- onPageSizeChange: onPageSizeChange,
27433
- selectionModel: selectionModel,
27434
- onSelectionModelChange: (newSelectionModel, details) => {
27387
+ pageSizeOptions: pageSizeOptions,
27388
+ paginationModel: paginationModel,
27389
+ onPaginationModelChange: onPaginationModelChange,
27390
+ rowSelectionModel: rowSelectionModel,
27391
+ onRowSelectionModelChange: (newSelectionModel, details) => {
27435
27392
  if (pagination && paginationMode != 'server') {
27436
27393
  const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
27437
27394
  let {
@@ -27489,7 +27446,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27489
27446
  };
27490
27447
  }
27491
27448
  }
27492
- onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(newSelectionModel, details);
27449
+ onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
27493
27450
  },
27494
27451
  sx: _objectSpread2(_objectSpread2({}, sx), {}, {
27495
27452
  '.MuiDataGrid-columnHeaders': {
@@ -27506,8 +27463,6 @@ DataGrid.className = CLASSNAME$2;
27506
27463
  DataGrid.displayName = COMPONENT_NAME$2;
27507
27464
 
27508
27465
  // Get and Set data from LocalStorage WITHOUT useState
27509
-
27510
- // triggering a state update and consecutive re-render
27511
27466
  const useFetchState = (defaultValue, key) => {
27512
27467
  let stickyValue = null;
27513
27468
  try {
@@ -27515,16 +27470,7 @@ const useFetchState = (defaultValue, key) => {
27515
27470
  } catch (e) {
27516
27471
  console.error('StatefulDataGrid: error getting item from local storage: ', e);
27517
27472
  }
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
- }
27473
+ const parsedValue = stickyValue !== null && stickyValue !== undefined && stickyValue !== 'undefined' ? JSON.parse(stickyValue) : defaultValue;
27528
27474
  const updateValue = useCallback(value => {
27529
27475
  try {
27530
27476
  window.localStorage.setItem(key, JSON.stringify(value));
@@ -27535,6 +27481,8 @@ const useFetchState = (defaultValue, key) => {
27535
27481
  return [parsedValue, updateValue];
27536
27482
  };
27537
27483
 
27484
+ // import useLocalStorage from './useLocalStorage';
27485
+
27538
27486
  const useTableStates = (id, version) => {
27539
27487
  const [paginationModel, setPaginationModel] = useFetchState('', buildStorageKey({
27540
27488
  id,
@@ -27591,8 +27539,7 @@ const useStatefulTable = props => {
27591
27539
  onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
27592
27540
  onColumnWidthChange: propsOnColumnWidthChange,
27593
27541
  onFilterModelChange: propsOnFilterModelChange,
27594
- onPageChange: propsOnPageChange,
27595
- onPageSizeChange: propsOnPageSizeChange,
27542
+ onPaginationModelChange: propsOnPaginationModelChange,
27596
27543
  onPinnedColumnsChange: propsOnPinnedColumnsChange,
27597
27544
  onSortModelChange: propsOnSortModelChange,
27598
27545
  useRouter,
@@ -27622,7 +27569,7 @@ const useStatefulTable = props => {
27622
27569
  setDimensionModel
27623
27570
  } = useTableStates(id, localStorageVersion);
27624
27571
 
27625
- // clearing up old version keys
27572
+ // clearing up old version keys, triggering only on first render
27626
27573
  useEffect(() => clearPreviousVersionStorage(id, previousLocalStorageVersions), [id, previousLocalStorageVersions]);
27627
27574
  const onColumnDimensionChange = useCallback(_ref => {
27628
27575
  let {
@@ -27655,7 +27602,6 @@ const useStatefulTable = props => {
27655
27602
  column.width = dimensionModel[column.field] || column.width || 100;
27656
27603
  return column;
27657
27604
  }), [propsColumns, dimensionModel]);
27658
-
27659
27605
  /** Add resetPage method to apiRef. */
27660
27606
  apiRef.current.resetPage = () => {
27661
27607
  apiRef.current.setPage(0);
@@ -27666,10 +27612,11 @@ const useStatefulTable = props => {
27666
27612
  onFilterModelChange: (model, details) => {
27667
27613
  const filterModel = _objectSpread2(_objectSpread2({}, model), {}, {
27668
27614
  items: model.items.map(item => {
27669
- const column = apiRef.current.getColumn(item.columnField);
27615
+ const column = apiRef.current.getColumn(item.field);
27670
27616
  item.type = column.type || 'string';
27671
27617
  return item;
27672
- })
27618
+ }),
27619
+ quickFilterValues: model.quickFilterValues || []
27673
27620
  });
27674
27621
  propsOnFilterModelChange === null || propsOnFilterModelChange === void 0 ? void 0 : propsOnFilterModelChange(filterModel, details);
27675
27622
  updateUrl({
@@ -27703,33 +27650,16 @@ const useStatefulTable = props => {
27703
27650
  }, search, localStorageVersion, historyReplace, columns);
27704
27651
  },
27705
27652
  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);
27653
+ paginationModel: paginationModelParsed,
27654
+ onPaginationModelChange: (model, details) => {
27655
+ const paginationModel = _objectSpread2(_objectSpread2({}, model), {}, {
27656
+ direction: paginationModelParsed.page < model.page ? 'next' : 'back'
27657
+ });
27658
+ propsOnPaginationModelChange === null || propsOnPaginationModelChange === void 0 ? void 0 : propsOnPaginationModelChange(paginationModel, details);
27725
27659
  updateUrl({
27726
27660
  filterModel: filterParsed,
27727
27661
  sortModel: sortModelParsed,
27728
- paginationModel: {
27729
- page: paginationModelParsed.page,
27730
- pageSize,
27731
- direction: paginationModelParsed.direction
27732
- },
27662
+ paginationModel: paginationModel,
27733
27663
  columnsModel: apiRef.current.state.columns.columnVisibilityModel,
27734
27664
  pinnedColumnsModel: pinnedColumnsModel
27735
27665
  }, search, localStorageVersion, historyReplace, columns);
@@ -27755,7 +27685,7 @@ const useStatefulTable = props => {
27755
27685
  };
27756
27686
  };
27757
27687
 
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"];
27688
+ 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
27689
  const COMPONENT_NAME$1 = 'DataGrid';
27760
27690
  const CLASSNAME$1 = 'redsift-datagrid';
27761
27691
  const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
@@ -27765,15 +27695,13 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27765
27695
  autoHeight,
27766
27696
  className,
27767
27697
  columns,
27768
- columnTypes: propsColumnTypes,
27769
- components,
27770
- componentsProps,
27698
+ slots,
27699
+ slotProps,
27771
27700
  filterModel: propsFilterModel,
27772
27701
  columnVisibilityModel: propsColumnVisibilityModel,
27773
27702
  pinnedColumns: propsPinnedColumns,
27774
27703
  sortModel: propsSortModel,
27775
- page: propsPage,
27776
- pageSize: propsPageSize,
27704
+ paginationModel: propsPaginationModel,
27777
27705
  height: propsHeight,
27778
27706
  hideToolbar,
27779
27707
  initialState,
@@ -27782,11 +27710,10 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27782
27710
  localStorageVersion,
27783
27711
  previousLocalStorageVersions,
27784
27712
  onFilterModelChange: propsOnFilterModelChange,
27785
- selectionModel: propsSelectionModel,
27713
+ rowSelectionModel: propsRowSelectionModel,
27786
27714
  onColumnWidthChange: propsOnColumnWidthChange,
27787
- onPageChange: propsOnPageChange,
27788
- onPageSizeChange: propsOnPageSizeChange,
27789
- onSelectionModelChange: propsOnSelectionModelChange,
27715
+ onPaginationModelChange: propsOnPaginationModelChange,
27716
+ onRowSelectionModelChange: propsOnRowSelectionModelChange,
27790
27717
  onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
27791
27718
  onPinnedColumnsChange: propsOnPinnedColumnsChange,
27792
27719
  onSortModelChange: propsOnSortModelChange,
@@ -27794,7 +27721,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27794
27721
  paginationPlacement = 'both',
27795
27722
  paginationProps,
27796
27723
  rows,
27797
- rowsPerPageOptions,
27724
+ pageSizeOptions,
27798
27725
  sx,
27799
27726
  theme: propsTheme,
27800
27727
  useRouter,
@@ -27805,43 +27732,38 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27805
27732
  const theme = useTheme$4(propsTheme);
27806
27733
  const _apiRef = useGridApiRef();
27807
27734
  const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
27808
- const RenderedToolbar = components !== null && components !== void 0 && components.Toolbar ? components.Toolbar : Toolbar$2;
27735
+ const RenderedToolbar = slots !== null && slots !== void 0 && slots.toolbar ? slots.toolbar : Toolbar$2;
27809
27736
  LicenseInfo.setLicenseKey(license);
27810
27737
  const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
27811
27738
  const {
27812
27739
  onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
27813
27740
  onFilterModelChange: controlledOnFilterModelChange,
27814
- onPageChange: controlledOnPageChange,
27815
- onPageSizeChange: controlledOnPageSizeChange,
27741
+ onPaginationModelChange: controlledOnPaginationModelChange,
27816
27742
  onPinnedColumnsChange: controlledOnPinnedColumnsChange,
27817
27743
  onSortModelChange: controlledOnSortModelChange
27818
27744
  } = useControlledDatagridState({
27819
27745
  initialState,
27820
- rowsPerPageOptions,
27746
+ pageSizeOptions,
27821
27747
  propsColumnVisibilityModel,
27822
27748
  propsFilterModel,
27823
27749
  propsOnColumnVisibilityModelChange,
27824
27750
  propsOnFilterModelChange,
27825
27751
  propsOnPinnedColumnsChange,
27826
27752
  propsOnSortModelChange,
27827
- propsPage,
27828
- propsPageSize,
27753
+ propsPaginationModel,
27829
27754
  propsPinnedColumns,
27830
27755
  propsSortModel,
27831
- propsOnPageChange,
27832
- propsOnPageSizeChange
27756
+ propsOnPaginationModelChange
27833
27757
  });
27834
27758
  const {
27835
27759
  columnVisibilityModel,
27836
27760
  filterModel,
27837
27761
  onColumnVisibilityModelChange,
27838
27762
  onFilterModelChange,
27839
- onPageChange,
27840
- onPageSizeChange,
27763
+ onPaginationModelChange,
27841
27764
  onPinnedColumnsChange,
27842
27765
  onSortModelChange,
27843
- page,
27844
- pageSize,
27766
+ paginationModel,
27845
27767
  pinnedColumns,
27846
27768
  sortModel,
27847
27769
  onColumnWidthChange
@@ -27852,40 +27774,39 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27852
27774
  onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
27853
27775
  onColumnWidthChange: propsOnColumnWidthChange,
27854
27776
  onFilterModelChange: controlledOnFilterModelChange,
27855
- onPageChange: controlledOnPageChange,
27856
- onPageSizeChange: controlledOnPageSizeChange,
27777
+ onPaginationModelChange: controlledOnPaginationModelChange,
27857
27778
  onPinnedColumnsChange: controlledOnPinnedColumnsChange,
27858
27779
  onSortModelChange: controlledOnSortModelChange,
27859
27780
  useRouter: useRouter,
27860
27781
  localStorageVersion,
27861
27782
  previousLocalStorageVersions
27862
27783
  });
27863
- const [selectionModel, setSelectionModel] = useState(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
27784
+ const [rowSelectionModel, setRowSelectionModel] = useState(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
27864
27785
  useEffect(() => {
27865
- setSelectionModel(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
27866
- }, [propsSelectionModel]);
27867
- const onSelectionModelChange = (selectionModel, details) => {
27868
- if (propsOnSelectionModelChange) {
27869
- propsOnSelectionModelChange(selectionModel, details);
27786
+ setRowSelectionModel(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
27787
+ }, [propsRowSelectionModel]);
27788
+ const onRowSelectionModelChange = (selectionModel, details) => {
27789
+ if (propsOnRowSelectionModelChange) {
27790
+ propsOnRowSelectionModelChange(selectionModel, details);
27870
27791
  } else {
27871
- setSelectionModel(selectionModel);
27792
+ setRowSelectionModel(selectionModel);
27872
27793
  }
27873
27794
  };
27874
27795
  const selectionStatus = useRef({
27875
27796
  type: 'none',
27876
27797
  numberOfSelectedRows: 0,
27877
27798
  numberOfSelectedRowsInPage: 0,
27878
- page,
27879
- pageSize: pageSize
27799
+ page: paginationModel.page,
27800
+ pageSize: paginationModel.pageSize
27880
27801
  });
27881
27802
 
27882
27803
  // in server-side pagination we want to update the selection status
27883
27804
  // every time we navigate between pages, resize our page or select something
27884
27805
  useEffect(() => {
27885
27806
  if (paginationMode == 'server') {
27886
- onServerSideSelectionStatusChange(Array.isArray(selectionModel) ? selectionModel : [selectionModel], apiRef, selectionStatus, isRowSelectable, page, pageSize);
27807
+ onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatus, isRowSelectable, paginationModel.page, paginationModel.pageSize);
27887
27808
  }
27888
- }, [selectionModel, page, pageSize]);
27809
+ }, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
27889
27810
  if (!Array.isArray(rows)) {
27890
27811
  return null;
27891
27812
  }
@@ -27918,15 +27839,13 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27918
27839
  filterModel: filterModel,
27919
27840
  onColumnVisibilityModelChange: onColumnVisibilityModelChange,
27920
27841
  onFilterModelChange: onFilterModelChange,
27921
- onPageChange: onPageChange,
27922
- onPageSizeChange: onPageSizeChange,
27842
+ onPaginationModelChange: onPaginationModelChange,
27923
27843
  onPinnedColumnsChange: onPinnedColumnsChange,
27924
27844
  onSortModelChange: onSortModelChange,
27925
- page: page,
27926
- pageSize: pageSize,
27845
+ paginationModel: paginationModel,
27927
27846
  pinnedColumns: pinnedColumns,
27928
27847
  sortModel: sortModel,
27929
- rowsPerPageOptions: rowsPerPageOptions,
27848
+ pageSizeOptions: pageSizeOptions,
27930
27849
  onColumnWidthChange: onColumnWidthChange,
27931
27850
  initialState: initialState,
27932
27851
  isRowSelectable: isRowSelectable,
@@ -27937,58 +27856,55 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27937
27856
  rowCount: rowCount,
27938
27857
  autoHeight: autoHeight,
27939
27858
  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, {
27859
+ slots: _objectSpread2(_objectSpread2({
27860
+ baseButton: BaseButton,
27861
+ baseCheckbox: BaseCheckbox,
27862
+ // baseTextField,
27863
+ basePopper: BasePopper,
27864
+ columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27947
27865
  displayName: "ColumnFilteredIcon"
27948
27866
  })),
27949
- ColumnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27867
+ columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27950
27868
  displayName: "ColumnSelectorIcon"
27951
27869
  })),
27952
- ColumnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27870
+ columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27953
27871
  displayName: "ColumnSortedAscendingIcon"
27954
27872
  })),
27955
- ColumnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27873
+ columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27956
27874
  displayName: "ColumnSortedDescendingIcon"
27957
27875
  })),
27958
- DensityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27876
+ densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27959
27877
  displayName: "DensityCompactIcon"
27960
27878
  })),
27961
- DensityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27879
+ densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27962
27880
  displayName: "DensityStandardIcon"
27963
27881
  })),
27964
- DensityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27882
+ densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27965
27883
  displayName: "DensityComfortableIcon"
27966
27884
  })),
27967
- DetailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27885
+ detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27968
27886
  displayName: "DetailPanelCollapseIcon"
27969
27887
  })),
27970
- DetailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27888
+ detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27971
27889
  displayName: "DetailPanelExpandIcon"
27972
27890
  })),
27973
- ExportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27891
+ exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27974
27892
  displayName: "ExportIcon"
27975
27893
  })),
27976
- OpenFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
27894
+ openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
27977
27895
  displayName: "OpenFilterButtonIcon"
27978
27896
  }, props))
27979
- }, components), {}, {
27980
- Toolbar: ToolbarWrapper,
27981
- Pagination: props => {
27897
+ }, slots), {}, {
27898
+ toolbar: ToolbarWrapper,
27899
+ pagination: props => {
27982
27900
  return pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$1({}, props, {
27983
27901
  displaySelection: false,
27984
27902
  displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
27985
27903
  displayPagination: ['bottom', 'both'].includes(paginationPlacement),
27986
27904
  selectionStatus: selectionStatus.current,
27987
- page: page,
27988
- pageSize: pageSize,
27989
- onPageChange: onPageChange,
27990
- onPageSizeChange: onPageSizeChange,
27991
- rowsPerPageOptions: rowsPerPageOptions,
27905
+ paginationModel: paginationModel,
27906
+ onPaginationModelChange: onPaginationModelChange,
27907
+ pageSizeOptions: pageSizeOptions,
27992
27908
  paginationProps: paginationProps,
27993
27909
  paginationMode: paginationMode,
27994
27910
  rowCount: rowCount
@@ -27999,17 +27915,15 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27999
27915
  selectionStatus: selectionStatus.current,
28000
27916
  apiRef: apiRef,
28001
27917
  isRowSelectable: isRowSelectable,
28002
- page: page,
28003
- pageSize: pageSize,
28004
- onPageChange: onPageChange,
28005
- onPageSizeChange: onPageSizeChange,
28006
- rowsPerPageOptions: rowsPerPageOptions,
27918
+ paginationModel: paginationModel,
27919
+ onPaginationModelChange: onPaginationModelChange,
27920
+ pageSizeOptions: pageSizeOptions,
28007
27921
  paginationProps: paginationProps,
28008
27922
  paginationMode: paginationMode
28009
27923
  })) : null;
28010
27924
  }
28011
27925
  }),
28012
- componentsProps: _objectSpread2(_objectSpread2({}, componentsProps), {}, {
27926
+ slotProps: _objectSpread2(_objectSpread2({}, slotProps), {}, {
28013
27927
  toolbar: _objectSpread2({
28014
27928
  hideToolbar,
28015
27929
  RenderedToolbar,
@@ -28020,18 +27934,16 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
28020
27934
  selectionStatus,
28021
27935
  apiRef,
28022
27936
  isRowSelectable,
28023
- page,
28024
- pageSize,
28025
- onPageChange,
28026
- onPageSizeChange,
28027
- rowsPerPageOptions,
27937
+ paginationModel,
27938
+ onPaginationModelChange,
27939
+ pageSizeOptions,
28028
27940
  paginationProps,
28029
27941
  paginationMode,
28030
27942
  rowCount
28031
- }, componentsProps === null || componentsProps === void 0 ? void 0 : componentsProps.toolbar)
27943
+ }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar)
28032
27944
  }),
28033
- selectionModel: selectionModel,
28034
- onSelectionModelChange: (newSelectionModel, details) => {
27945
+ rowSelectionModel: rowSelectionModel,
27946
+ onRowSelectionModelChange: (newSelectionModel, details) => {
28035
27947
  if (pagination && paginationMode != 'server') {
28036
27948
  const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
28037
27949
  let {
@@ -28089,7 +28001,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
28089
28001
  };
28090
28002
  }
28091
28003
  }
28092
- onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(newSelectionModel, details);
28004
+ onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
28093
28005
  },
28094
28006
  sx: _objectSpread2(_objectSpread2({}, sx), {}, {
28095
28007
  '.MuiDataGrid-columnHeaders': {
@@ -28163,5 +28075,5 @@ const TextCell = /*#__PURE__*/forwardRef((props, ref) => {
28163
28075
  TextCell.className = CLASSNAME;
28164
28076
  TextCell.displayName = COMPONENT_NAME;
28165
28077
 
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 };
28078
+ 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
28079
  //# sourceMappingURL=index.js.map