@redsift/table 11.3.1-alpha.0 → 11.3.1-muiv5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/index.d.ts +32 -26
  2. package/index.js +408 -292
  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, GridLogicOperator, GridToolbarContainer, GridToolbarFilterButton, GridToolbarColumnsButton, GridToolbarDensitySelector, GridToolbarExport, gridExpandedSortedRowIdsSelector, GridToolbarQuickFilter, gridPaginatedVisibleSortedGridRowEntriesSelector, gridPaginatedVisibleSortedGridRowIdsSelector, gridFilteredSortedRowEntriesSelector, gridFilteredSortedRowIdsSelector, useGridApiRef, DataGridPro } from '@mui/x-data-grid-pro';
1
+ import { GRID_DETAIL_PANEL_TOGGLE_COL_DEF, getGridNumericOperators as getGridNumericOperators$1, GridFilterInputValue, GridFilterInputMultipleValue, getGridStringOperators as getGridStringOperators$1, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators, GridLinkOperator, GridToolbarContainer, GridToolbarFilterButton, GridToolbarColumnsButton, GridToolbarDensitySelector, GridToolbarExport, gridVisibleSortedRowIdsSelector, 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.field || !filterItem.value || !filterItem.operator) {
17642
+ if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17643
17643
  return null;
17644
17644
  }
17645
17645
  if (!Array.isArray(filterItem.value) || filterItem.value.length !== 2) {
@@ -17652,7 +17652,7 @@ const isBetweenOperator = {
17652
17652
  return null;
17653
17653
  }
17654
17654
  return params => {
17655
- return params.value !== null && params.value !== undefined && filterItem.value[0] <= params.value && params.value <= filterItem.value[1];
17655
+ return params.value !== null && filterItem.value[0] <= params.value && params.value <= filterItem.value[1];
17656
17656
  };
17657
17657
  },
17658
17658
  InputComponent: InputNumberInterval
@@ -17665,7 +17665,7 @@ const doesNotEqual = {
17665
17665
  label: 'does not equal',
17666
17666
  value: 'doesNotEqual',
17667
17667
  getApplyFilterFn: filterItem => {
17668
- if (!filterItem.field || !filterItem.value || !filterItem.value) {
17668
+ if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17669
17669
  return null;
17670
17670
  }
17671
17671
  return params => {
@@ -17686,7 +17686,7 @@ const doesNotContain = {
17686
17686
  label: 'does not contain',
17687
17687
  value: 'doesNotContain',
17688
17688
  getApplyFilterFn: filterItem => {
17689
- if (!filterItem.field || !filterItem.value || !filterItem.operator) {
17689
+ if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17690
17690
  return null;
17691
17691
  }
17692
17692
  return params => {
@@ -17707,7 +17707,7 @@ const containsAnyOfOperator = {
17707
17707
  label: 'contains any of',
17708
17708
  value: 'containsAnyOf',
17709
17709
  getApplyFilterFn: filterItem => {
17710
- if (!filterItem.field || !filterItem.value || !filterItem.operator) {
17710
+ if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17711
17711
  return null;
17712
17712
  }
17713
17713
  return params => {
@@ -17730,7 +17730,7 @@ const containsAnyOfCIOperator = {
17730
17730
  label: 'contains any of (case insensitive)',
17731
17731
  value: 'containsAnyOf',
17732
17732
  getApplyFilterFn: filterItem => {
17733
- if (!filterItem.field || !filterItem.value || !filterItem.operator) {
17733
+ if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17734
17734
  return null;
17735
17735
  }
17736
17736
  return params => {
@@ -17757,7 +17757,7 @@ const endsWithAnyOfOperator = {
17757
17757
  label: 'ends with any of',
17758
17758
  value: 'endsWithAnyOf',
17759
17759
  getApplyFilterFn: filterItem => {
17760
- if (!filterItem.field || !filterItem.value || !filterItem.operator) {
17760
+ if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17761
17761
  return null;
17762
17762
  }
17763
17763
  return params => {
@@ -17784,7 +17784,7 @@ const isAnyOfOperator = {
17784
17784
  label: 'is any of',
17785
17785
  value: 'isAnyOf',
17786
17786
  getApplyFilterFn: filterItem => {
17787
- if (!filterItem.field || !filterItem.value || !filterItem.operator) {
17787
+ if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17788
17788
  return null;
17789
17789
  }
17790
17790
  return params => {
@@ -17808,7 +17808,7 @@ const isNotAnyOfOperator = {
17808
17808
  label: 'is not any of',
17809
17809
  value: 'isNotAnyOf',
17810
17810
  getApplyFilterFn: filterItem => {
17811
- if (!filterItem.field || !filterItem.value || !filterItem.operator) {
17811
+ if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17812
17812
  return null;
17813
17813
  }
17814
17814
  return params => {
@@ -17832,7 +17832,7 @@ const startsWithAnyOfOperator = {
17832
17832
  label: 'starts with any of',
17833
17833
  value: 'startsWithAnyOf',
17834
17834
  getApplyFilterFn: filterItem => {
17835
- if (!filterItem.field || !filterItem.value || !filterItem.operator) {
17835
+ if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17836
17836
  return null;
17837
17837
  }
17838
17838
  return params => {
@@ -17877,13 +17877,13 @@ const operatorList = {
17877
17877
 
17878
17878
  const getRsStringColumnType = () => {
17879
17879
  return {
17880
- type: 'string',
17880
+ extendType: 'string',
17881
17881
  filterOperators: operatorList.rsString
17882
17882
  };
17883
17883
  };
17884
17884
  const getRsNumberColumnType = () => {
17885
17885
  return {
17886
- type: 'number',
17886
+ extendType: 'number',
17887
17887
  filterOperators: operatorList.rsNumber
17888
17888
  };
17889
17889
  };
@@ -17894,7 +17894,7 @@ const customColumnTypes = {
17894
17894
 
17895
17895
  const API_URL = 'https://api.openai.com/v1/chat/completions';
17896
17896
  async function getCompletion(text, role, openai_api_key) {
17897
- let model = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'gpt-3.5-turbo-1106';
17897
+ let model = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'gpt-3.5-turbo-0613';
17898
17898
  try {
17899
17899
  const messages = [{
17900
17900
  role: 'system',
@@ -18061,39 +18061,42 @@ const numberOperatorDecoder = {
18061
18061
  lt: '<',
18062
18062
  lte: '<='
18063
18063
  };
18064
- const isOperatorValueValid = (field, operator, columns) => {
18065
- const column = columns.find(column => column.field === field);
18064
+ const isOperatorValueValid = (columnField, operatorValue, columns) => {
18065
+ const column = columns.find(column => column.field === columnField);
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 = column.filterOperators || operatorList[columnType];
18070
+ const operators = operatorList[columnType];
18071
18071
  if (!operators) {
18072
18072
  return false;
18073
18073
  }
18074
- return !!operators.find(op => columnType === 'number' && Object.keys(numberOperatorEncoder).includes(op.value) ? numberOperatorEncoder[op.value] === operator : op.value === operator);
18074
+ if ('filterOperators' in operators) {
18075
+ return !!operators.filterOperators.find(op => columnType === 'number' && Object.keys(numberOperatorEncoder).includes(op.value) ? numberOperatorEncoder[op.value] === operatorValue : op['value'] === operatorValue);
18076
+ }
18077
+ return !!operators.find(op => ['number', 'rsNumber'].includes(columnType) && Object.keys(numberOperatorEncoder).includes(op.value) ? numberOperatorEncoder[op.value] === operatorValue : op['value'] === operatorValue);
18075
18078
  };
18076
18079
  const listOperators = ['containsAnyOf', 'endsWithAnyOf', 'isAnyOf', 'isNotAnyOf', 'startsWithAnyOf'];
18077
18080
 
18078
18081
  // Check if the value doesn't break
18079
- const isValueValid = (value, field, columns, operator) => {
18082
+ const isValueValid = (value, columnField, columns, operatorValue) => {
18080
18083
  var _column$type;
18081
18084
  // every field accepts undefined as value for default
18082
18085
  if (value === undefined || value === '') {
18083
18086
  return true;
18084
18087
  }
18085
18088
 
18086
- // xxxAnyOf accepts as value only lists, and we are declaring them in the
18089
+ // xxxAnyOf accepts as value only lists, and we are declearing them in the
18087
18090
  // URL as `list=[...]`
18088
- if (listOperators.includes(operator)) {
18091
+ if (listOperators.includes(operatorValue)) {
18089
18092
  return Array.isArray(value) || value === '';
18090
18093
  }
18091
18094
 
18092
18095
  // We are accepting arrays only if they are of the 'xxxAnyOf' type
18093
- if (Array.isArray(value) && !listOperators.includes(operator)) {
18096
+ if (Array.isArray(value) && !listOperators.includes(operatorValue)) {
18094
18097
  return false;
18095
18098
  }
18096
- const column = columns.find(column => column.field === field);
18099
+ const column = columns.find(column => column.field === columnField);
18097
18100
  if (!column) {
18098
18101
  return false;
18099
18102
  }
@@ -18131,7 +18134,7 @@ const getFilterModelFromString = (searchString, columns) => {
18131
18134
  if (!searchString) {
18132
18135
  return 'invalid';
18133
18136
  }
18134
- let logicOperator = GridLogicOperator.And;
18137
+ let linkOperator = GridLinkOperator.And;
18135
18138
  let quickFilterValues = [];
18136
18139
  const searchParams = new URLSearchParams();
18137
18140
  for (const [key, value] of new URLSearchParams(searchString)) {
@@ -18139,7 +18142,7 @@ const getFilterModelFromString = (searchString, columns) => {
18139
18142
  searchParams.set(key, value);
18140
18143
  }
18141
18144
  if (key === '_logicOperator') {
18142
- logicOperator = value === GridLogicOperator.And || value === GridLogicOperator.Or ? value : GridLogicOperator.And;
18145
+ linkOperator = value;
18143
18146
  }
18144
18147
  if (key === '_quickFilterValues') {
18145
18148
  try {
@@ -18158,7 +18161,7 @@ const getFilterModelFromString = (searchString, columns) => {
18158
18161
  if (isInvalid) {
18159
18162
  return;
18160
18163
  }
18161
- const field = key.split('[')[0].slice(1);
18164
+ const field = key.split('[')[0].slice(1); // Slice to remove the _ at the beginning
18162
18165
  if (!fields.includes(field)) {
18163
18166
  return;
18164
18167
  }
@@ -18175,6 +18178,7 @@ const getFilterModelFromString = (searchString, columns) => {
18175
18178
  return;
18176
18179
  }
18177
18180
  const operator = splitRight[0];
18181
+ // if the operator is not part of the valid operators invalidate the URL
18178
18182
  if (!isOperatorValueValid(field, operator, columns) || Array.isArray(operator)) {
18179
18183
  isInvalid = true;
18180
18184
  return;
@@ -18186,37 +18190,41 @@ const getFilterModelFromString = (searchString, columns) => {
18186
18190
  return;
18187
18191
  }
18188
18192
  items.push({
18189
- field,
18190
- operator: columnType === 'number' && Object.keys(numberOperatorDecoder).includes(operator) ? numberOperatorDecoder[operator] : operator,
18193
+ columnField: field,
18194
+ operatorValue: ['number', 'rsNumber'].includes(columnType) && Object.keys(numberOperatorDecoder).includes(operator) ? numberOperatorDecoder[operator] : operator,
18191
18195
  id,
18192
18196
  value: listOperators.includes(operator) && decodedValue === '' ? [] : decodedValue,
18193
18197
  type
18194
18198
  });
18195
18199
  });
18200
+
18201
+ // If we found some condition that results in an invalid URL,
18202
+ // return the empty filterModel (this will trigger the localStorage)
18203
+ // and will pick up the last valid search
18196
18204
  if (isInvalid) {
18197
18205
  return 'invalid';
18198
18206
  }
18199
18207
  return {
18200
18208
  items,
18201
- logicOperator,
18209
+ linkOperator,
18202
18210
  quickFilterValues
18203
18211
  };
18204
18212
  };
18205
18213
  const getSearchParamsFromFilterModel = filterModel => {
18206
18214
  var _filterModel$quickFil;
18207
18215
  const searchParams = new URLSearchParams();
18208
- searchParams.set('_logicOperator', filterModel['logicOperator'] || '');
18216
+ searchParams.set('_logicOperator', filterModel['linkOperator'] || '');
18209
18217
  filterModel['items'].forEach(item => {
18210
18218
  const {
18211
- field,
18212
- operator,
18219
+ columnField,
18220
+ operatorValue,
18213
18221
  value,
18214
18222
  type
18215
18223
  } = item;
18216
- if (Object.keys(numberOperatorEncoder).includes(operator)) {
18217
- searchParams.set(`_${field}[${numberOperatorEncoder[operator]},${encodeValue(type)}]`, encodeValue(value));
18224
+ if (Object.keys(numberOperatorEncoder).includes(operatorValue)) {
18225
+ searchParams.set(`_${columnField}[${numberOperatorEncoder[operatorValue]},${encodeValue(type)}]`, encodeValue(value));
18218
18226
  } else {
18219
- searchParams.set(`_${field}[${encodeValue(operator)},${encodeValue(type)}]`, encodeValue(value));
18227
+ searchParams.set(`_${columnField}[${encodeValue(operatorValue)},${encodeValue(type)}]`, encodeValue(value));
18220
18228
  }
18221
18229
  });
18222
18230
  if ((_filterModel$quickFil = filterModel.quickFilterValues) !== null && _filterModel$quickFil !== void 0 && _filterModel$quickFil.length) {
@@ -18232,7 +18240,7 @@ const getSearchParamsFromFilterModel = filterModel => {
18232
18240
  const getFilterModel = (search, columns, localStorageFilters, setLocalStorageFilters, initialState, isNewVersion) => {
18233
18241
  const defaultValue = initialState && initialState.filter && initialState.filter.filterModel ? initialState.filter.filterModel : {
18234
18242
  items: [],
18235
- logicOperator: GridLogicOperator.And
18243
+ linkOperator: GridLinkOperator.And
18236
18244
  };
18237
18245
  if (isNewVersion) {
18238
18246
  return defaultValue;
@@ -18371,38 +18379,13 @@ const getPaginationModel = (search, localStoragePagination, setLocalStoragePagin
18371
18379
 
18372
18380
  /** COLUMN VISIBILITY */
18373
18381
 
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
- };
18399
18382
  const getSearchParamsFromColumnVisibility = (columnVisibility, columns) => {
18400
18383
  const searchParams = new URLSearchParams();
18401
- const fields = columns.map(column => column.field);
18384
+ const columnFields = columns.map(column => column.field);
18402
18385
 
18403
18386
  // if column visibility model is empty, show all columns
18404
18387
  if (Object.keys(columnVisibility).length == 0) {
18405
- searchParams.set('_columnVisibility', `[${fields.join(',')}]`);
18388
+ searchParams.set('_columnVisibility', `[${columnFields.join(',')}]`);
18406
18389
  return searchParams;
18407
18390
  }
18408
18391
  const finalColumnVisibility = columns.filter(c => {
@@ -18413,10 +18396,63 @@ const getSearchParamsFromColumnVisibility = (columnVisibility, columns) => {
18413
18396
  [colName]: true
18414
18397
  });
18415
18398
  }, columnVisibility);
18416
- const visibleColumns = fields.filter(column => finalColumnVisibility[column] !== false);
18399
+ const visibleColumns = Object.entries(finalColumnVisibility)
18400
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
18401
+ .filter(_ref => {
18402
+ let [_, visible] = _ref;
18403
+ return visible;
18404
+ })
18405
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
18406
+ .map(_ref2 => {
18407
+ let [column, _] = _ref2;
18408
+ return encodeValue(column);
18409
+ });
18417
18410
  searchParams.set('_columnVisibility', `[${visibleColumns.join(',')}]`);
18418
18411
  return searchParams;
18419
18412
  };
18413
+ const getColumnVisibilityFromString = (notParsed, tableColumns) => {
18414
+ if (!notParsed || notParsed.length === 1 && notParsed[0] === '?') {
18415
+ return 'invalid';
18416
+ }
18417
+ // remove the initial ? if present
18418
+ const parsed = notParsed[0] === '?' ? notParsed.slice(1) : notParsed;
18419
+ const visibility = {};
18420
+ let exist = false;
18421
+ let visibleColumnsCount = 0;
18422
+ for (const item of parsed.split('&')) {
18423
+ // if it's not column visibility field, skip
18424
+ const fieldURL = item.split('=')[0];
18425
+ if (fieldURL !== '_columnVisibility') {
18426
+ continue;
18427
+ }
18428
+ // e.g. item = _columnVisibility[abc,def]
18429
+ const left = item.split(']')[0];
18430
+ if (left.split('[').length < 2) {
18431
+ continue;
18432
+ }
18433
+ const encodedValues = item.split('[')[1].split(']')[0];
18434
+ if (typeof encodedValues !== 'string') {
18435
+ continue;
18436
+ }
18437
+ exist = true;
18438
+ const columnFields = tableColumns.map(column => column.field);
18439
+ // TODO: Add validation that , is present
18440
+ const columns = encodedValues.split(',').map(value => decodeValue(value));
18441
+
18442
+ // for each column, check if it's visible and add it to visibility model
18443
+ for (const column of columnFields) {
18444
+ const isColumnVisible = columns.includes(column);
18445
+ visibility[column] = isColumnVisible;
18446
+ if (isColumnVisible) {
18447
+ visibleColumnsCount += 1;
18448
+ }
18449
+ }
18450
+ }
18451
+ if (visibleColumnsCount === 0 && !exist) {
18452
+ return 'invalid';
18453
+ }
18454
+ return visibility;
18455
+ };
18420
18456
 
18421
18457
  // Rules:
18422
18458
  // - if we have something in the URL, use that info
@@ -18425,11 +18461,16 @@ const getSearchParamsFromColumnVisibility = (columnVisibility, columns) => {
18425
18461
  // NOTE: the `defaultHidden` is a custom field and not standard DataGrid
18426
18462
  // The reason is the following bug: https://github.com/mui/mui-x/issues/8407
18427
18463
  const getColumnsVisibility = (search, columns, localStorageColumnsVisibility, setLocalStorageColumnsVisibility, initialState, isNewVersion) => {
18428
- var _initialState$columns;
18464
+ var _initialState$columns3;
18429
18465
  const defaultValue = {};
18430
18466
  for (const column of columns) {
18467
+ var _initialState$columns, _initialState$columns2;
18431
18468
  const field = column.field;
18432
- defaultValue[field] = column.defaultHidden !== true; // undefined will be true
18469
+ if ((initialState === null || initialState === void 0 ? void 0 : (_initialState$columns = initialState.columns) === null || _initialState$columns === void 0 ? void 0 : (_initialState$columns2 = _initialState$columns.columnVisibilityModel) === null || _initialState$columns2 === void 0 ? void 0 : _initialState$columns2[field]) !== undefined) {
18470
+ defaultValue[field] = initialState.columns.columnVisibilityModel[field];
18471
+ } else {
18472
+ defaultValue[field] = column.defaultHidden !== true; // undefined will be true
18473
+ }
18433
18474
  }
18434
18475
 
18435
18476
  if (isNewVersion) {
@@ -18447,7 +18488,7 @@ const getColumnsVisibility = (search, columns, localStorageColumnsVisibility, se
18447
18488
  if (columnVisibilityFromLocalStorage !== 'invalid') {
18448
18489
  return columnVisibilityFromLocalStorage;
18449
18490
  }
18450
- if (initialState !== null && initialState !== void 0 && (_initialState$columns = initialState.columns) !== null && _initialState$columns !== void 0 && _initialState$columns.columnVisibilityModel) {
18491
+ if (initialState !== null && initialState !== void 0 && (_initialState$columns3 = initialState.columns) !== null && _initialState$columns3 !== void 0 && _initialState$columns3.columnVisibilityModel) {
18451
18492
  return initialState.columns.columnVisibilityModel;
18452
18493
  }
18453
18494
  return defaultValue;
@@ -18472,8 +18513,8 @@ const getPinnedColumnsFromString = (notParsed, tableColumns) => {
18472
18513
  if (typeof encodedValues !== 'string') {
18473
18514
  continue;
18474
18515
  }
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));
18516
+ const columnFields = [...tableColumns.map(column => column.field), '__check__'];
18517
+ const columns = encodedValues.split(',').map(value => decodeValue(value)).filter(val => typeof val === 'string' && columnFields.includes(val));
18477
18518
  if (fieldURL === '_pinnedColumnsLeft') {
18478
18519
  pinnedColumns['left'] = columns;
18479
18520
  }
@@ -18481,9 +18522,9 @@ const getPinnedColumnsFromString = (notParsed, tableColumns) => {
18481
18522
  pinnedColumns['right'] = columns;
18482
18523
  }
18483
18524
  }
18484
- return pinnedColumns.left && pinnedColumns.left.length > 0 || pinnedColumns.right && pinnedColumns.right.length > 0 ? {
18485
- left: pinnedColumns.left || [],
18486
- right: pinnedColumns.right || []
18525
+ return pinnedColumns['left'] || pinnedColumns['right'] ? {
18526
+ left: pinnedColumns['left'] || [],
18527
+ right: pinnedColumns['right'] || []
18487
18528
  } : 'invalid';
18488
18529
  };
18489
18530
  const getSearchParamsFromPinnedColumns = pinnedColumns => {
@@ -18533,7 +18574,7 @@ const getSearchParamsFromTab = search => {
18533
18574
  }
18534
18575
  return searchParams;
18535
18576
  };
18536
- const getFinalSearch = _ref => {
18577
+ const getFinalSearch = _ref3 => {
18537
18578
  let {
18538
18579
  search,
18539
18580
  localStorageVersion,
@@ -18543,7 +18584,7 @@ const getFinalSearch = _ref => {
18543
18584
  columnsVisibilityModel,
18544
18585
  pinnedColumnsModel,
18545
18586
  columns
18546
- } = _ref;
18587
+ } = _ref3;
18547
18588
  const filterModelSearch = getSearchParamsFromFilterModel(filterModel);
18548
18589
  const sortModelSearch = getSearchParamsFromSorting(sortModel);
18549
18590
  const paginationModelSearch = getSearchParamsFromPagination(paginationModel);
@@ -18608,14 +18649,14 @@ const getModelsParsedOrUpdateLocalStorage = (search, localStorageVersion, column
18608
18649
  pinnedColumnsModel
18609
18650
  };
18610
18651
  };
18611
- const updateUrl = (_ref2, search, localStorageVersion, historyReplace, columns) => {
18652
+ const updateUrl = (_ref4, search, localStorageVersion, historyReplace, columns) => {
18612
18653
  let {
18613
18654
  filterModel,
18614
18655
  sortModel,
18615
18656
  paginationModel,
18616
18657
  columnsModel: columnsVisibilityModel,
18617
18658
  pinnedColumnsModel
18618
- } = _ref2;
18659
+ } = _ref4;
18619
18660
  const newSearch = getFinalSearch({
18620
18661
  search,
18621
18662
  localStorageVersion,
@@ -18636,17 +18677,17 @@ const updateUrl = (_ref2, search, localStorageVersion, historyReplace, columns)
18636
18677
  // do not use it for equivalence (e.g. with value `3` and undefined we
18637
18678
  // will get 0).
18638
18679
  const compareFilters = (firstFilter, secondFilter) => {
18639
- if (firstFilter.field < secondFilter.field) {
18680
+ if (firstFilter.columnField < secondFilter.columnField) {
18640
18681
  return -1;
18641
- } else if (firstFilter.field > secondFilter.field) {
18682
+ } else if (firstFilter.columnField > secondFilter.columnField) {
18642
18683
  return 1;
18643
18684
  }
18644
- if (firstFilter.operator === undefined || secondFilter.operator === undefined) {
18685
+ if (firstFilter.operatorValue === undefined || secondFilter.operatorValue === undefined) {
18645
18686
  return 0;
18646
18687
  }
18647
- if (firstFilter.operator < secondFilter.operator) {
18688
+ if (firstFilter.operatorValue < secondFilter.operatorValue) {
18648
18689
  return -1;
18649
- } else if (firstFilter.operator > secondFilter.operator) {
18690
+ } else if (firstFilter.operatorValue > secondFilter.operatorValue) {
18650
18691
  return 1;
18651
18692
  }
18652
18693
  if (firstFilter.value < secondFilter.value) {
@@ -18657,18 +18698,18 @@ const compareFilters = (firstFilter, secondFilter) => {
18657
18698
  return 0;
18658
18699
  };
18659
18700
  const areFiltersEquivalent = (firstFilter, secondFilter) => {
18660
- return firstFilter.field === secondFilter.field && firstFilter.operator === secondFilter.operator && firstFilter.value === secondFilter.value;
18701
+ return firstFilter.columnField === secondFilter.columnField && firstFilter.operatorValue === secondFilter.operatorValue && firstFilter.value === secondFilter.value;
18661
18702
  };
18662
18703
  const areFilterModelsEquivalent = (filterModel, filterModelToMatch) => {
18663
18704
  const {
18664
18705
  items,
18665
- logicOperator
18706
+ linkOperator
18666
18707
  } = filterModel;
18667
18708
  const {
18668
18709
  items: itemsToMatch,
18669
- logicOperator: logicOperatorToMatch
18710
+ linkOperator: linkOperatorToMatch
18670
18711
  } = filterModelToMatch;
18671
- if (logicOperator !== logicOperatorToMatch) {
18712
+ if (linkOperator !== linkOperatorToMatch) {
18672
18713
  return false;
18673
18714
  }
18674
18715
  if (items.length !== itemsToMatch.length) {
@@ -18681,7 +18722,7 @@ const areFilterModelsEquivalent = (filterModel, filterModelToMatch) => {
18681
18722
  const filterToCompare = itemsToMatch[i];
18682
18723
 
18683
18724
  // compareFilters return 0 if and only if the filters have the same
18684
- // field, operator, and value
18725
+ // columnField, operatorValue, and value
18685
18726
  if (!areFiltersEquivalent(filter, filterToCompare)) {
18686
18727
  return false;
18687
18728
  }
@@ -24492,16 +24533,16 @@ const getRole = (config, dateFormat) => {
24492
24533
  }).join('\n');
24493
24534
  return `The AI assistant parses user input to generate a JSON object that will be used as a row filter for a data table MUI Data Grid.
24494
24535
  The filter supports mulitple conditions using only two logical operator "and", "or". It only allows "and" between all conditions or "or" between all conditions. It can't mix the two types.
24495
- The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "logicOperator" and "items":
24496
- - "logicOperator": the logical operator, only "and" or "or" are allowed. If there is only one condition in the "items", use "and".
24497
- - "items": a list of conditions, each is an object with exactly the three keys "field", "operator" and "value":
24498
- - "field": the column name, must be one of ${columns}
24536
+ The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "linkOperator" and "items":
24537
+ - "linkOperator": the logical operator, only "and" or "or" are allowed. If there is only one condition in the "items", use "and".
24538
+ - "items": a list of conditions, each is an object with exactly the three keys "columnField", "operatorValue" and "value":
24539
+ - "columnField": the column name, must be one of ${columns}
24499
24540
  - "value":
24500
- - this can be skipped if the "operator" is either "isEmpty" or "isNotEmpty"
24501
- - a list of multiple values if the "operator" ends with "AnyOf"
24541
+ - this can be skipped if the "operatorValue" is either "isEmpty" or "isNotEmpty"
24542
+ - a list of multiple values if the "operatorValue" ends with "AnyOf"
24502
24543
  - otherwise, it's a single value represented as a string: "true" instead of true, "false" instead of false, "0.6" instead of 0.6.
24503
24544
  For "date" data type, use ${dateFormat}. If relative date is input, convert to the actual date given today is ${today}.
24504
- - "operator": the comparison operator, accepted values depend on the data type of the column
24545
+ - "operatorValue": the comparison operator, accepted values depend on the data type of the column
24505
24546
  ${operators}
24506
24547
 
24507
24548
  Below is the datatype in square bracket, constraints on the data range if any, followed by the description of each column used in the data table:
@@ -24538,10 +24579,10 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
24538
24579
  nlpFilterConfig,
24539
24580
  onFilterModelChange,
24540
24581
  dateFormat = 'yyyy-mm-dd',
24541
- defaultModel = 'gpt-4-1106-preview',
24582
+ defaultModel = 'gpt-4-0613',
24542
24583
  defaultFilter = {
24543
24584
  items: [],
24544
- logicOperator: 'and'
24585
+ linkOperator: 'and'
24545
24586
  },
24546
24587
  disablePower = false,
24547
24588
  localeText
@@ -24619,7 +24660,7 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
24619
24660
  value: prompt
24620
24661
  }), /*#__PURE__*/React__default.createElement(Button, {
24621
24662
  variant: "primary",
24622
- "aria-label": buttonAriaLabel,
24663
+ "aira-label": buttonAriaLabel,
24623
24664
  type: "submit",
24624
24665
  isLoading: isLoading
24625
24666
  }, buttonText)), !disablePower && /*#__PURE__*/React__default.createElement(Tooltip, null, /*#__PURE__*/React__default.createElement(Tooltip.Trigger, null, /*#__PURE__*/React__default.createElement(Switch, {
@@ -24681,7 +24722,7 @@ const Toolbar$2 = props => {
24681
24722
  let {
24682
24723
  apiRef
24683
24724
  } = _ref;
24684
- return gridExpandedSortedRowIdsSelector(apiRef);
24725
+ return gridVisibleSortedRowIdsSelector(apiRef);
24685
24726
  }
24686
24727
  },
24687
24728
  printOptions: {
@@ -26915,10 +26956,12 @@ const ServerSideControlledPagination = _ref3 => {
26915
26956
  selectionStatus,
26916
26957
  displaySelection,
26917
26958
  displayPagination,
26918
- paginationModel,
26919
- onPaginationModelChange,
26920
- pageSizeOptions,
26959
+ page,
26960
+ onPageChange,
26961
+ pageSize,
26962
+ onPageSizeChange,
26921
26963
  displayRowsPerPage,
26964
+ rowsPerPageOptions,
26922
26965
  paginationProps,
26923
26966
  rowCount
26924
26967
  } = _ref3;
@@ -26937,17 +26980,13 @@ const ServerSideControlledPagination = _ref3 => {
26937
26980
  }, totalRowsLabel) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$1({
26938
26981
  component: "div",
26939
26982
  count: totalNumberOfRowsInTable,
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 : []
26983
+ page: page,
26984
+ onPageChange: (event, newPage) => onPageChange(newPage),
26985
+ rowsPerPage: pageSize,
26986
+ onRowsPerPageChange: event => {
26987
+ onPageSizeChange(parseInt(event.target.value, 10));
26988
+ },
26989
+ rowsPerPageOptions: displayRowsPerPage ? rowsPerPageOptions : []
26951
26990
  }, paginationProps)) : null);
26952
26991
  };
26953
26992
 
@@ -26973,9 +27012,11 @@ const ControlledPagination = _ref3 => {
26973
27012
  displayPagination = false,
26974
27013
  selectionStatus,
26975
27014
  apiRef,
26976
- paginationModel,
26977
- onPaginationModelChange,
26978
- pageSizeOptions,
27015
+ page,
27016
+ onPageChange,
27017
+ pageSize,
27018
+ onPageSizeChange,
27019
+ rowsPerPageOptions,
26979
27020
  isRowSelectable,
26980
27021
  paginationProps
26981
27022
  } = _ref3;
@@ -27005,25 +27046,17 @@ const ControlledPagination = _ref3 => {
27005
27046
  }, `${selectionStatus.numberOfSelectedRows} row${selectionStatus.numberOfSelectedRows > 1 ? 's' : ''} selected`) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$1({
27006
27047
  component: "div",
27007
27048
  count: numberOfFilteredRowsInTable,
27008
- page: paginationModel.page,
27009
- onPageChange: (event, page) => {
27010
- onPaginationModelChange({
27011
- page,
27012
- pageSize: paginationModel.pageSize
27013
- });
27014
- },
27015
- rowsPerPage: paginationModel.pageSize,
27049
+ page: page,
27050
+ onPageChange: (event, newPage) => onPageChange(newPage),
27051
+ rowsPerPage: pageSize,
27016
27052
  onRowsPerPageChange: event => {
27017
- onPaginationModelChange({
27018
- page: paginationModel.page,
27019
- pageSize: parseInt(event.target.value, 10)
27020
- });
27053
+ onPageSizeChange(parseInt(event.target.value, 10));
27021
27054
  },
27022
- rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
27055
+ rowsPerPageOptions: displayRowsPerPage ? rowsPerPageOptions : []
27023
27056
  }, paginationProps)) : null);
27024
27057
  };
27025
27058
 
27026
- const _excluded$3 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "paginationModel", "onPaginationModelChange", "pageSizeOptions", "paginationProps", "paginationMode", "rowCount"];
27059
+ const _excluded$3 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "page", "onPageChange", "pageSize", "onPageSizeChange", "rowsPerPageOptions", "paginationProps", "paginationMode", "rowCount"];
27027
27060
  const ToolbarWrapper = _ref => {
27028
27061
  let {
27029
27062
  hideToolbar,
@@ -27035,9 +27068,11 @@ const ToolbarWrapper = _ref => {
27035
27068
  selectionStatus,
27036
27069
  apiRef,
27037
27070
  isRowSelectable,
27038
- paginationModel,
27039
- onPaginationModelChange,
27040
- pageSizeOptions,
27071
+ page,
27072
+ onPageChange,
27073
+ pageSize,
27074
+ onPageSizeChange,
27075
+ rowsPerPageOptions,
27041
27076
  paginationProps,
27042
27077
  paginationMode = 'client',
27043
27078
  rowCount
@@ -27051,9 +27086,11 @@ const ToolbarWrapper = _ref => {
27051
27086
  displayRowsPerPage: false,
27052
27087
  displayPagination: ['top', 'both'].includes(paginationPlacement),
27053
27088
  selectionStatus: selectionStatus.current,
27054
- paginationModel: paginationModel,
27055
- onPaginationModelChange: onPaginationModelChange,
27056
- pageSizeOptions: pageSizeOptions,
27089
+ page: page,
27090
+ onPageChange: onPageChange,
27091
+ pageSize: pageSize,
27092
+ onPageSizeChange: onPageSizeChange,
27093
+ rowsPerPageOptions: rowsPerPageOptions,
27057
27094
  paginationProps: paginationProps,
27058
27095
  rowCount: rowCount
27059
27096
  }) : /*#__PURE__*/React__default.createElement(ControlledPagination, {
@@ -27063,26 +27100,30 @@ const ToolbarWrapper = _ref => {
27063
27100
  selectionStatus: selectionStatus.current,
27064
27101
  apiRef: apiRef,
27065
27102
  isRowSelectable: isRowSelectable,
27066
- paginationModel: paginationModel,
27067
- onPaginationModelChange: onPaginationModelChange,
27068
- pageSizeOptions: pageSizeOptions,
27103
+ page: page,
27104
+ onPageChange: onPageChange,
27105
+ pageSize: pageSize,
27106
+ onPageSizeChange: onPageSizeChange,
27107
+ rowsPerPageOptions: rowsPerPageOptions,
27069
27108
  paginationProps: paginationProps
27070
27109
  }) : null);
27071
27110
  };
27072
27111
 
27073
27112
  const useControlledDatagridState = _ref => {
27074
- var _ref2, _ref3, _propsPaginationModel, _initialState$paginat, _initialState$paginat2, _pageSizeOptions$, _ref4, _propsPaginationModel2, _initialState$paginat3, _initialState$paginat4;
27113
+ var _initialState$paginat, _initialState$paginat2;
27075
27114
  let {
27076
27115
  initialState,
27077
- pageSizeOptions,
27116
+ rowsPerPageOptions,
27078
27117
  propsColumnVisibilityModel,
27079
27118
  propsFilterModel,
27080
27119
  propsOnColumnVisibilityModelChange,
27081
27120
  propsOnFilterModelChange,
27082
- propsOnPaginationModelChange,
27121
+ propsOnPageChange,
27122
+ propsOnPageSizeChange,
27083
27123
  propsOnPinnedColumnsChange,
27084
27124
  propsOnSortModelChange,
27085
- propsPaginationModel,
27125
+ propsPage,
27126
+ propsPageSize,
27086
27127
  propsPinnedColumns,
27087
27128
  propsSortModel
27088
27129
  } = _ref;
@@ -27130,22 +27171,33 @@ const useControlledDatagridState = _ref => {
27130
27171
  setSortModel(model);
27131
27172
  }
27132
27173
  };
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);
27174
+ const [page, setPage] = useState((initialState === null || initialState === void 0 ? void 0 : (_initialState$paginat = initialState.pagination) === null || _initialState$paginat === void 0 ? void 0 : _initialState$paginat.page) || propsPage || 0);
27175
+ const [pageSize, setPageSize] = useState((initialState === null || initialState === void 0 ? void 0 : (_initialState$paginat2 = initialState.pagination) === null || _initialState$paginat2 === void 0 ? void 0 : _initialState$paginat2.pageSize) || propsPageSize || (rowsPerPageOptions === null || rowsPerPageOptions === void 0 ? void 0 : rowsPerPageOptions[0]) || 25);
27176
+ const onPageChange = page => {
27177
+ if (propsOnPageChange) {
27178
+ propsOnPageChange(page, undefined);
27140
27179
  } else {
27141
- setPaginationModel(model);
27180
+ setPage(page);
27142
27181
  }
27143
27182
  };
27144
27183
  useEffect(() => {
27145
- if (propsPaginationModel) {
27146
- setPaginationModel(propsPaginationModel);
27184
+ if (propsPage || propsPage === 0) {
27185
+ setPage(propsPage);
27186
+ }
27187
+ }, [propsPage]);
27188
+ const onPageSizeChange = pageSize => {
27189
+ onPageChange(0);
27190
+ if (propsOnPageSizeChange) {
27191
+ propsOnPageSizeChange(pageSize, undefined);
27192
+ } else {
27193
+ setPageSize(pageSize);
27147
27194
  }
27148
- }, [propsPaginationModel]);
27195
+ };
27196
+ useEffect(() => {
27197
+ if (propsPageSize) {
27198
+ setPageSize(propsPageSize);
27199
+ }
27200
+ }, [propsPageSize]);
27149
27201
  return {
27150
27202
  filterModel,
27151
27203
  onFilterModelChange,
@@ -27155,12 +27207,14 @@ const useControlledDatagridState = _ref => {
27155
27207
  onPinnedColumnsChange,
27156
27208
  sortModel,
27157
27209
  onSortModelChange,
27158
- paginationModel,
27159
- onPaginationModelChange
27210
+ page,
27211
+ pageSize,
27212
+ onPageChange,
27213
+ onPageSizeChange
27160
27214
  };
27161
27215
  };
27162
27216
 
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"];
27217
+ const _excluded$2 = ["apiRef", "autoHeight", "className", "columnTypes", "components", "componentsProps", "filterModel", "columnVisibilityModel", "pinnedColumns", "sortModel", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "onFilterModelChange", "onPageChange", "onPageSizeChange", "onColumnVisibilityModelChange", "onPinnedColumnsChange", "onSortModelChange", "selectionModel", "onSelectionModelChange", "page", "pageSize", "pagination", "paginationPlacement", "paginationProps", "rows", "rowsPerPageOptions", "sx", "theme", "paginationMode", "rowCount"];
27164
27218
  const COMPONENT_NAME$2 = 'DataGrid';
27165
27219
  const CLASSNAME$2 = 'redsift-datagrid';
27166
27220
  const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
@@ -27169,30 +27223,33 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27169
27223
  apiRef: propsApiRef,
27170
27224
  autoHeight,
27171
27225
  className,
27172
- slots,
27173
- slotProps,
27226
+ columnTypes: propsColumnTypes,
27227
+ components,
27228
+ componentsProps,
27174
27229
  filterModel: propsFilterModel,
27175
27230
  columnVisibilityModel: propsColumnVisibilityModel,
27176
27231
  pinnedColumns: propsPinnedColumns,
27177
27232
  sortModel: propsSortModel,
27178
- paginationModel: propsPaginationModel,
27179
27233
  height: propsHeight,
27180
27234
  hideToolbar,
27181
27235
  initialState,
27182
27236
  isRowSelectable,
27183
27237
  license = process.env.MUI_LICENSE_KEY,
27184
27238
  onFilterModelChange: propsOnFilterModelChange,
27185
- rowSelectionModel: propsRowSelectionModel,
27186
- onPaginationModelChange: propsOnPaginationModelChange,
27187
- onRowSelectionModelChange: propsOnRowSelectionModelChange,
27239
+ onPageChange: propsOnPageChange,
27240
+ onPageSizeChange: propsOnPageSizeChange,
27188
27241
  onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
27189
27242
  onPinnedColumnsChange: propsOnPinnedColumnsChange,
27190
27243
  onSortModelChange: propsOnSortModelChange,
27244
+ selectionModel: propsSelectionModel,
27245
+ onSelectionModelChange: propsOnSelectionModelChange,
27246
+ page: propsPage,
27247
+ pageSize: propsPageSize,
27191
27248
  pagination,
27192
27249
  paginationPlacement = 'both',
27193
27250
  paginationProps,
27194
27251
  rows,
27195
- pageSizeOptions,
27252
+ rowsPerPageOptions,
27196
27253
  sx,
27197
27254
  theme: propsTheme,
27198
27255
  paginationMode = 'client',
@@ -27202,7 +27259,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27202
27259
  const theme = useTheme$4(propsTheme);
27203
27260
  const _apiRef = useGridApiRef();
27204
27261
  const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
27205
- const RenderedToolbar = slots !== null && slots !== void 0 && slots.toolbar ? slots.toolbar : Toolbar$2;
27262
+ const RenderedToolbar = components !== null && components !== void 0 && components.Toolbar ? components.Toolbar : Toolbar$2;
27206
27263
  LicenseInfo.setLicenseKey(license);
27207
27264
  const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
27208
27265
  const {
@@ -27210,52 +27267,56 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27210
27267
  filterModel,
27211
27268
  onColumnVisibilityModelChange,
27212
27269
  onFilterModelChange,
27213
- onPaginationModelChange,
27270
+ onPageChange,
27271
+ onPageSizeChange,
27214
27272
  onPinnedColumnsChange,
27215
27273
  onSortModelChange,
27216
- paginationModel,
27274
+ page,
27275
+ pageSize,
27217
27276
  pinnedColumns,
27218
27277
  sortModel
27219
27278
  } = useControlledDatagridState({
27220
27279
  initialState,
27221
- pageSizeOptions,
27280
+ rowsPerPageOptions,
27222
27281
  propsColumnVisibilityModel,
27223
27282
  propsFilterModel,
27224
27283
  propsOnColumnVisibilityModelChange,
27225
27284
  propsOnFilterModelChange,
27226
27285
  propsOnPinnedColumnsChange,
27227
27286
  propsOnSortModelChange,
27228
- propsPaginationModel,
27287
+ propsPage,
27288
+ propsPageSize,
27229
27289
  propsPinnedColumns,
27230
27290
  propsSortModel,
27231
- propsOnPaginationModelChange
27291
+ propsOnPageChange,
27292
+ propsOnPageSizeChange
27232
27293
  });
27233
- const [rowSelectionModel, setRowSelectionModel] = useState(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
27294
+ const [selectionModel, setSelectionModel] = useState(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
27234
27295
  useEffect(() => {
27235
- setRowSelectionModel(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
27236
- }, [propsRowSelectionModel]);
27237
- const onRowSelectionModelChange = (selectionModel, details) => {
27238
- if (propsOnRowSelectionModelChange) {
27239
- propsOnRowSelectionModelChange(selectionModel, details);
27296
+ setSelectionModel(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
27297
+ }, [propsSelectionModel]);
27298
+ const onSelectionModelChange = (selectionModel, details) => {
27299
+ if (propsOnSelectionModelChange) {
27300
+ propsOnSelectionModelChange(selectionModel, details);
27240
27301
  } else {
27241
- setRowSelectionModel(selectionModel);
27302
+ setSelectionModel(selectionModel);
27242
27303
  }
27243
27304
  };
27244
27305
  const selectionStatus = useRef({
27245
27306
  type: 'none',
27246
27307
  numberOfSelectedRows: 0,
27247
27308
  numberOfSelectedRowsInPage: 0,
27248
- page: paginationModel.page,
27249
- pageSize: paginationModel.pageSize
27309
+ page,
27310
+ pageSize
27250
27311
  });
27251
27312
 
27252
27313
  // in server-side pagination we want to update the selection status
27253
27314
  // every time we navigate between pages, resize our page or select something
27254
27315
  useEffect(() => {
27255
27316
  if (paginationMode == 'server') {
27256
- onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatus, isRowSelectable, paginationModel.page, paginationModel.pageSize);
27317
+ onServerSideSelectionStatusChange(Array.isArray(selectionModel) ? selectionModel : [selectionModel], apiRef, selectionStatus, isRowSelectable, page, pageSize);
27257
27318
  }
27258
- }, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
27319
+ }, [selectionModel, page, pageSize]);
27259
27320
  if (!Array.isArray(rows)) {
27260
27321
  return null;
27261
27322
  }
@@ -27286,54 +27347,57 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27286
27347
  apiRef: apiRef,
27287
27348
  autoHeight: autoHeight,
27288
27349
  checkboxSelectionVisibleOnly: Boolean(pagination),
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, {
27350
+ columnTypes: _objectSpread2(_objectSpread2({}, customColumnTypes), propsColumnTypes),
27351
+ components: _objectSpread2(_objectSpread2({
27352
+ BaseButton,
27353
+ BaseCheckbox,
27354
+ // BaseTextField,
27355
+ BasePopper,
27356
+ ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27295
27357
  displayName: "ColumnFilteredIcon"
27296
27358
  })),
27297
- columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27359
+ ColumnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27298
27360
  displayName: "ColumnSelectorIcon"
27299
27361
  })),
27300
- columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27362
+ ColumnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27301
27363
  displayName: "ColumnSortedAscendingIcon"
27302
27364
  })),
27303
- columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27365
+ ColumnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27304
27366
  displayName: "ColumnSortedDescendingIcon"
27305
27367
  })),
27306
- densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27368
+ DensityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27307
27369
  displayName: "DensityCompactIcon"
27308
27370
  })),
27309
- densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27371
+ DensityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27310
27372
  displayName: "DensityStandardIcon"
27311
27373
  })),
27312
- densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27374
+ DensityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27313
27375
  displayName: "DensityComfortableIcon"
27314
27376
  })),
27315
- detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27377
+ DetailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27316
27378
  displayName: "DetailPanelCollapseIcon"
27317
27379
  })),
27318
- detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27380
+ DetailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27319
27381
  displayName: "DetailPanelExpandIcon"
27320
27382
  })),
27321
- exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27383
+ ExportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27322
27384
  displayName: "ExportIcon"
27323
27385
  })),
27324
- openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
27386
+ OpenFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
27325
27387
  displayName: "OpenFilterButtonIcon"
27326
27388
  }, props))
27327
- }, slots), {}, {
27328
- toolbar: ToolbarWrapper,
27329
- pagination: props => pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$1({}, props, {
27389
+ }, components), {}, {
27390
+ Toolbar: ToolbarWrapper,
27391
+ Pagination: props => pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$1({}, props, {
27330
27392
  displaySelection: false,
27331
27393
  displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
27332
27394
  displayPagination: ['bottom', 'both'].includes(paginationPlacement),
27333
27395
  selectionStatus: selectionStatus.current,
27334
- paginationModel: paginationModel,
27335
- onPaginationModelChange: onPaginationModelChange,
27336
- pageSizeOptions: pageSizeOptions,
27396
+ page: page,
27397
+ onPageChange: onPageChange,
27398
+ pageSize: pageSize,
27399
+ onPageSizeChange: onPageSizeChange,
27400
+ rowsPerPageOptions: rowsPerPageOptions,
27337
27401
  paginationProps: paginationProps,
27338
27402
  paginationMode: paginationMode,
27339
27403
  rowCount: rowCount
@@ -27344,14 +27408,16 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27344
27408
  selectionStatus: selectionStatus.current,
27345
27409
  apiRef: apiRef,
27346
27410
  isRowSelectable: isRowSelectable,
27347
- paginationModel: paginationModel,
27348
- onPaginationModelChange: onPaginationModelChange,
27349
- pageSizeOptions: pageSizeOptions,
27411
+ page: page,
27412
+ onPageChange: onPageChange,
27413
+ pageSize: pageSize,
27414
+ onPageSizeChange: onPageSizeChange,
27415
+ rowsPerPageOptions: rowsPerPageOptions,
27350
27416
  paginationProps: paginationProps,
27351
27417
  paginationMode: paginationMode
27352
27418
  })) : null
27353
27419
  }),
27354
- slotProps: _objectSpread2(_objectSpread2({}, slotProps), {}, {
27420
+ componentsProps: _objectSpread2(_objectSpread2({}, componentsProps), {}, {
27355
27421
  toolbar: _objectSpread2({
27356
27422
  hideToolbar,
27357
27423
  RenderedToolbar,
@@ -27362,13 +27428,15 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27362
27428
  selectionStatus,
27363
27429
  apiRef,
27364
27430
  isRowSelectable,
27365
- paginationModel,
27366
- onPaginationModelChange,
27367
- pageSizeOptions,
27431
+ page,
27432
+ onPageChange,
27433
+ pageSize,
27434
+ onPageSizeChange,
27435
+ rowsPerPageOptions,
27368
27436
  paginationProps,
27369
27437
  paginationMode,
27370
27438
  rowCount
27371
- }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar)
27439
+ }, componentsProps === null || componentsProps === void 0 ? void 0 : componentsProps.toolbar)
27372
27440
  }),
27373
27441
  filterModel: filterModel,
27374
27442
  columnVisibilityModel: columnVisibilityModel,
@@ -27384,11 +27452,13 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27384
27452
  paginationMode: paginationMode,
27385
27453
  keepNonExistentRowsSelected: paginationMode == 'server',
27386
27454
  rows: rows,
27387
- pageSizeOptions: pageSizeOptions,
27388
- paginationModel: paginationModel,
27389
- onPaginationModelChange: onPaginationModelChange,
27390
- rowSelectionModel: rowSelectionModel,
27391
- onRowSelectionModelChange: (newSelectionModel, details) => {
27455
+ rowsPerPageOptions: rowsPerPageOptions,
27456
+ page: page,
27457
+ onPageChange: onPageChange,
27458
+ pageSize: pageSize,
27459
+ onPageSizeChange: onPageSizeChange,
27460
+ selectionModel: selectionModel,
27461
+ onSelectionModelChange: (newSelectionModel, details) => {
27392
27462
  if (pagination && paginationMode != 'server') {
27393
27463
  const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
27394
27464
  let {
@@ -27446,7 +27516,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27446
27516
  };
27447
27517
  }
27448
27518
  }
27449
- onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
27519
+ onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(newSelectionModel, details);
27450
27520
  },
27451
27521
  sx: _objectSpread2(_objectSpread2({}, sx), {}, {
27452
27522
  '.MuiDataGrid-columnHeaders': {
@@ -27463,6 +27533,8 @@ DataGrid.className = CLASSNAME$2;
27463
27533
  DataGrid.displayName = COMPONENT_NAME$2;
27464
27534
 
27465
27535
  // Get and Set data from LocalStorage WITHOUT useState
27536
+
27537
+ // triggering a state update and consecutive re-render
27466
27538
  const useFetchState = (defaultValue, key) => {
27467
27539
  let stickyValue = null;
27468
27540
  try {
@@ -27470,7 +27542,16 @@ const useFetchState = (defaultValue, key) => {
27470
27542
  } catch (e) {
27471
27543
  console.error('StatefulDataGrid: error getting item from local storage: ', e);
27472
27544
  }
27473
- const parsedValue = stickyValue !== null && stickyValue !== undefined && stickyValue !== 'undefined' ? JSON.parse(stickyValue) : defaultValue;
27545
+ let parsedValue = stickyValue !== null && stickyValue !== undefined && stickyValue !== 'undefined' ? JSON.parse(stickyValue) : defaultValue;
27546
+
27547
+ // TODO: temporary workaround to avoid clashes when someone had sorting on the now-removed screenshot field (renamed to num_annotations)
27548
+ // Consider upgrading the Datagrid component library as the exception handling was added in this PR: https://github.com/mui-org/material-ui-x/pull/3224
27549
+ if (parsedValue instanceof Array) {
27550
+ const fields = (parsedValue || []).map(item => item.field);
27551
+ if (fields.includes('screenshot') || fields.includes('diffs')) {
27552
+ parsedValue = defaultValue;
27553
+ }
27554
+ }
27474
27555
  const updateValue = useCallback(value => {
27475
27556
  try {
27476
27557
  window.localStorage.setItem(key, JSON.stringify(value));
@@ -27481,8 +27562,6 @@ const useFetchState = (defaultValue, key) => {
27481
27562
  return [parsedValue, updateValue];
27482
27563
  };
27483
27564
 
27484
- // import useLocalStorage from './useLocalStorage';
27485
-
27486
27565
  const useTableStates = (id, version) => {
27487
27566
  const [paginationModel, setPaginationModel] = useFetchState('', buildStorageKey({
27488
27567
  id,
@@ -27539,7 +27618,8 @@ const useStatefulTable = props => {
27539
27618
  onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
27540
27619
  onColumnWidthChange: propsOnColumnWidthChange,
27541
27620
  onFilterModelChange: propsOnFilterModelChange,
27542
- onPaginationModelChange: propsOnPaginationModelChange,
27621
+ onPageChange: propsOnPageChange,
27622
+ onPageSizeChange: propsOnPageSizeChange,
27543
27623
  onPinnedColumnsChange: propsOnPinnedColumnsChange,
27544
27624
  onSortModelChange: propsOnSortModelChange,
27545
27625
  useRouter,
@@ -27569,7 +27649,7 @@ const useStatefulTable = props => {
27569
27649
  setDimensionModel
27570
27650
  } = useTableStates(id, localStorageVersion);
27571
27651
 
27572
- // clearing up old version keys, triggering only on first render
27652
+ // clearing up old version keys
27573
27653
  useEffect(() => clearPreviousVersionStorage(id, previousLocalStorageVersions), [id, previousLocalStorageVersions]);
27574
27654
  const onColumnDimensionChange = useCallback(_ref => {
27575
27655
  let {
@@ -27602,6 +27682,7 @@ const useStatefulTable = props => {
27602
27682
  column.width = dimensionModel[column.field] || column.width || 100;
27603
27683
  return column;
27604
27684
  }), [propsColumns, dimensionModel]);
27685
+
27605
27686
  /** Add resetPage method to apiRef. */
27606
27687
  apiRef.current.resetPage = () => {
27607
27688
  apiRef.current.setPage(0);
@@ -27612,7 +27693,7 @@ const useStatefulTable = props => {
27612
27693
  onFilterModelChange: (model, details) => {
27613
27694
  const filterModel = _objectSpread2(_objectSpread2({}, model), {}, {
27614
27695
  items: model.items.map(item => {
27615
- const column = apiRef.current.getColumn(item.field);
27696
+ const column = apiRef.current.getColumn(item.columnField);
27616
27697
  item.type = column.type || 'string';
27617
27698
  return item;
27618
27699
  }),
@@ -27650,16 +27731,33 @@ const useStatefulTable = props => {
27650
27731
  }, search, localStorageVersion, historyReplace, columns);
27651
27732
  },
27652
27733
  pinnedColumns: pinnedColumnsModel,
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);
27734
+ page: paginationModelParsed.page,
27735
+ pageSize: paginationModelParsed.pageSize,
27736
+ onPageChange: (page, details) => {
27737
+ const direction = paginationModelParsed.page < page ? 'next' : 'back';
27738
+ propsOnPageChange === null || propsOnPageChange === void 0 ? void 0 : propsOnPageChange(page, details);
27659
27739
  updateUrl({
27660
27740
  filterModel: filterParsed,
27661
27741
  sortModel: sortModelParsed,
27662
- paginationModel: paginationModel,
27742
+ paginationModel: {
27743
+ page,
27744
+ pageSize: paginationModelParsed.pageSize,
27745
+ direction
27746
+ },
27747
+ columnsModel: apiRef.current.state.columns.columnVisibilityModel,
27748
+ pinnedColumnsModel: pinnedColumnsModel
27749
+ }, search, localStorageVersion, historyReplace, columns);
27750
+ },
27751
+ onPageSizeChange: (pageSize, details) => {
27752
+ propsOnPageSizeChange === null || propsOnPageSizeChange === void 0 ? void 0 : propsOnPageSizeChange(pageSize, details);
27753
+ updateUrl({
27754
+ filterModel: filterParsed,
27755
+ sortModel: sortModelParsed,
27756
+ paginationModel: {
27757
+ page: paginationModelParsed.page,
27758
+ pageSize,
27759
+ direction: paginationModelParsed.direction
27760
+ },
27663
27761
  columnsModel: apiRef.current.state.columns.columnVisibilityModel,
27664
27762
  pinnedColumnsModel: pinnedColumnsModel
27665
27763
  }, search, localStorageVersion, historyReplace, columns);
@@ -27685,7 +27783,7 @@ const useStatefulTable = props => {
27685
27783
  };
27686
27784
  };
27687
27785
 
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"];
27786
+ const _excluded$1 = ["apiRef", "autoHeight", "className", "columns", "columnTypes", "components", "componentsProps", "filterModel", "columnVisibilityModel", "pinnedColumns", "sortModel", "page", "pageSize", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "localStorageVersion", "previousLocalStorageVersions", "onFilterModelChange", "selectionModel", "onColumnWidthChange", "onPageChange", "onPageSizeChange", "onSelectionModelChange", "onColumnVisibilityModelChange", "onPinnedColumnsChange", "onSortModelChange", "pagination", "paginationPlacement", "paginationProps", "rows", "rowsPerPageOptions", "sx", "theme", "useRouter", "paginationMode", "rowCount"];
27689
27787
  const COMPONENT_NAME$1 = 'DataGrid';
27690
27788
  const CLASSNAME$1 = 'redsift-datagrid';
27691
27789
  const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
@@ -27695,13 +27793,15 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27695
27793
  autoHeight,
27696
27794
  className,
27697
27795
  columns,
27698
- slots,
27699
- slotProps,
27796
+ columnTypes: propsColumnTypes,
27797
+ components,
27798
+ componentsProps,
27700
27799
  filterModel: propsFilterModel,
27701
27800
  columnVisibilityModel: propsColumnVisibilityModel,
27702
27801
  pinnedColumns: propsPinnedColumns,
27703
27802
  sortModel: propsSortModel,
27704
- paginationModel: propsPaginationModel,
27803
+ page: propsPage,
27804
+ pageSize: propsPageSize,
27705
27805
  height: propsHeight,
27706
27806
  hideToolbar,
27707
27807
  initialState,
@@ -27710,10 +27810,11 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27710
27810
  localStorageVersion,
27711
27811
  previousLocalStorageVersions,
27712
27812
  onFilterModelChange: propsOnFilterModelChange,
27713
- rowSelectionModel: propsRowSelectionModel,
27813
+ selectionModel: propsSelectionModel,
27714
27814
  onColumnWidthChange: propsOnColumnWidthChange,
27715
- onPaginationModelChange: propsOnPaginationModelChange,
27716
- onRowSelectionModelChange: propsOnRowSelectionModelChange,
27815
+ onPageChange: propsOnPageChange,
27816
+ onPageSizeChange: propsOnPageSizeChange,
27817
+ onSelectionModelChange: propsOnSelectionModelChange,
27717
27818
  onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
27718
27819
  onPinnedColumnsChange: propsOnPinnedColumnsChange,
27719
27820
  onSortModelChange: propsOnSortModelChange,
@@ -27721,7 +27822,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27721
27822
  paginationPlacement = 'both',
27722
27823
  paginationProps,
27723
27824
  rows,
27724
- pageSizeOptions,
27825
+ rowsPerPageOptions,
27725
27826
  sx,
27726
27827
  theme: propsTheme,
27727
27828
  useRouter,
@@ -27732,38 +27833,43 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27732
27833
  const theme = useTheme$4(propsTheme);
27733
27834
  const _apiRef = useGridApiRef();
27734
27835
  const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
27735
- const RenderedToolbar = slots !== null && slots !== void 0 && slots.toolbar ? slots.toolbar : Toolbar$2;
27836
+ const RenderedToolbar = components !== null && components !== void 0 && components.Toolbar ? components.Toolbar : Toolbar$2;
27736
27837
  LicenseInfo.setLicenseKey(license);
27737
27838
  const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
27738
27839
  const {
27739
27840
  onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
27740
27841
  onFilterModelChange: controlledOnFilterModelChange,
27741
- onPaginationModelChange: controlledOnPaginationModelChange,
27842
+ onPageChange: controlledOnPageChange,
27843
+ onPageSizeChange: controlledOnPageSizeChange,
27742
27844
  onPinnedColumnsChange: controlledOnPinnedColumnsChange,
27743
27845
  onSortModelChange: controlledOnSortModelChange
27744
27846
  } = useControlledDatagridState({
27745
27847
  initialState,
27746
- pageSizeOptions,
27848
+ rowsPerPageOptions,
27747
27849
  propsColumnVisibilityModel,
27748
27850
  propsFilterModel,
27749
27851
  propsOnColumnVisibilityModelChange,
27750
27852
  propsOnFilterModelChange,
27751
27853
  propsOnPinnedColumnsChange,
27752
27854
  propsOnSortModelChange,
27753
- propsPaginationModel,
27855
+ propsPage,
27856
+ propsPageSize,
27754
27857
  propsPinnedColumns,
27755
27858
  propsSortModel,
27756
- propsOnPaginationModelChange
27859
+ propsOnPageChange,
27860
+ propsOnPageSizeChange
27757
27861
  });
27758
27862
  const {
27759
27863
  columnVisibilityModel,
27760
27864
  filterModel,
27761
27865
  onColumnVisibilityModelChange,
27762
27866
  onFilterModelChange,
27763
- onPaginationModelChange,
27867
+ onPageChange,
27868
+ onPageSizeChange,
27764
27869
  onPinnedColumnsChange,
27765
27870
  onSortModelChange,
27766
- paginationModel,
27871
+ page,
27872
+ pageSize,
27767
27873
  pinnedColumns,
27768
27874
  sortModel,
27769
27875
  onColumnWidthChange
@@ -27774,39 +27880,40 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27774
27880
  onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
27775
27881
  onColumnWidthChange: propsOnColumnWidthChange,
27776
27882
  onFilterModelChange: controlledOnFilterModelChange,
27777
- onPaginationModelChange: controlledOnPaginationModelChange,
27883
+ onPageChange: controlledOnPageChange,
27884
+ onPageSizeChange: controlledOnPageSizeChange,
27778
27885
  onPinnedColumnsChange: controlledOnPinnedColumnsChange,
27779
27886
  onSortModelChange: controlledOnSortModelChange,
27780
27887
  useRouter: useRouter,
27781
27888
  localStorageVersion,
27782
27889
  previousLocalStorageVersions
27783
27890
  });
27784
- const [rowSelectionModel, setRowSelectionModel] = useState(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
27891
+ const [selectionModel, setSelectionModel] = useState(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
27785
27892
  useEffect(() => {
27786
- setRowSelectionModel(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
27787
- }, [propsRowSelectionModel]);
27788
- const onRowSelectionModelChange = (selectionModel, details) => {
27789
- if (propsOnRowSelectionModelChange) {
27790
- propsOnRowSelectionModelChange(selectionModel, details);
27893
+ setSelectionModel(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
27894
+ }, [propsSelectionModel]);
27895
+ const onSelectionModelChange = (selectionModel, details) => {
27896
+ if (propsOnSelectionModelChange) {
27897
+ propsOnSelectionModelChange(selectionModel, details);
27791
27898
  } else {
27792
- setRowSelectionModel(selectionModel);
27899
+ setSelectionModel(selectionModel);
27793
27900
  }
27794
27901
  };
27795
27902
  const selectionStatus = useRef({
27796
27903
  type: 'none',
27797
27904
  numberOfSelectedRows: 0,
27798
27905
  numberOfSelectedRowsInPage: 0,
27799
- page: paginationModel.page,
27800
- pageSize: paginationModel.pageSize
27906
+ page,
27907
+ pageSize: pageSize
27801
27908
  });
27802
27909
 
27803
27910
  // in server-side pagination we want to update the selection status
27804
27911
  // every time we navigate between pages, resize our page or select something
27805
27912
  useEffect(() => {
27806
27913
  if (paginationMode == 'server') {
27807
- onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatus, isRowSelectable, paginationModel.page, paginationModel.pageSize);
27914
+ onServerSideSelectionStatusChange(Array.isArray(selectionModel) ? selectionModel : [selectionModel], apiRef, selectionStatus, isRowSelectable, page, pageSize);
27808
27915
  }
27809
- }, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
27916
+ }, [selectionModel, page, pageSize]);
27810
27917
  if (!Array.isArray(rows)) {
27811
27918
  return null;
27812
27919
  }
@@ -27839,13 +27946,15 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27839
27946
  filterModel: filterModel,
27840
27947
  onColumnVisibilityModelChange: onColumnVisibilityModelChange,
27841
27948
  onFilterModelChange: onFilterModelChange,
27842
- onPaginationModelChange: onPaginationModelChange,
27949
+ onPageChange: onPageChange,
27950
+ onPageSizeChange: onPageSizeChange,
27843
27951
  onPinnedColumnsChange: onPinnedColumnsChange,
27844
27952
  onSortModelChange: onSortModelChange,
27845
- paginationModel: paginationModel,
27953
+ page: page,
27954
+ pageSize: pageSize,
27846
27955
  pinnedColumns: pinnedColumns,
27847
27956
  sortModel: sortModel,
27848
- pageSizeOptions: pageSizeOptions,
27957
+ rowsPerPageOptions: rowsPerPageOptions,
27849
27958
  onColumnWidthChange: onColumnWidthChange,
27850
27959
  initialState: initialState,
27851
27960
  isRowSelectable: isRowSelectable,
@@ -27856,55 +27965,58 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27856
27965
  rowCount: rowCount,
27857
27966
  autoHeight: autoHeight,
27858
27967
  checkboxSelectionVisibleOnly: Boolean(pagination),
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, {
27968
+ columnTypes: _objectSpread2(_objectSpread2({}, customColumnTypes), propsColumnTypes),
27969
+ components: _objectSpread2(_objectSpread2({
27970
+ BaseButton,
27971
+ BaseCheckbox,
27972
+ // BaseTextField,
27973
+ BasePopper,
27974
+ ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27865
27975
  displayName: "ColumnFilteredIcon"
27866
27976
  })),
27867
- columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27977
+ ColumnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27868
27978
  displayName: "ColumnSelectorIcon"
27869
27979
  })),
27870
- columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27980
+ ColumnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27871
27981
  displayName: "ColumnSortedAscendingIcon"
27872
27982
  })),
27873
- columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27983
+ ColumnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27874
27984
  displayName: "ColumnSortedDescendingIcon"
27875
27985
  })),
27876
- densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27986
+ DensityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27877
27987
  displayName: "DensityCompactIcon"
27878
27988
  })),
27879
- densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27989
+ DensityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27880
27990
  displayName: "DensityStandardIcon"
27881
27991
  })),
27882
- densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27992
+ DensityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27883
27993
  displayName: "DensityComfortableIcon"
27884
27994
  })),
27885
- detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27995
+ DetailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27886
27996
  displayName: "DetailPanelCollapseIcon"
27887
27997
  })),
27888
- detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27998
+ DetailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27889
27999
  displayName: "DetailPanelExpandIcon"
27890
28000
  })),
27891
- exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
28001
+ ExportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
27892
28002
  displayName: "ExportIcon"
27893
28003
  })),
27894
- openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
28004
+ OpenFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
27895
28005
  displayName: "OpenFilterButtonIcon"
27896
28006
  }, props))
27897
- }, slots), {}, {
27898
- toolbar: ToolbarWrapper,
27899
- pagination: props => {
28007
+ }, components), {}, {
28008
+ Toolbar: ToolbarWrapper,
28009
+ Pagination: props => {
27900
28010
  return pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$1({}, props, {
27901
28011
  displaySelection: false,
27902
28012
  displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
27903
28013
  displayPagination: ['bottom', 'both'].includes(paginationPlacement),
27904
28014
  selectionStatus: selectionStatus.current,
27905
- paginationModel: paginationModel,
27906
- onPaginationModelChange: onPaginationModelChange,
27907
- pageSizeOptions: pageSizeOptions,
28015
+ page: page,
28016
+ pageSize: pageSize,
28017
+ onPageChange: onPageChange,
28018
+ onPageSizeChange: onPageSizeChange,
28019
+ rowsPerPageOptions: rowsPerPageOptions,
27908
28020
  paginationProps: paginationProps,
27909
28021
  paginationMode: paginationMode,
27910
28022
  rowCount: rowCount
@@ -27915,15 +28027,17 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27915
28027
  selectionStatus: selectionStatus.current,
27916
28028
  apiRef: apiRef,
27917
28029
  isRowSelectable: isRowSelectable,
27918
- paginationModel: paginationModel,
27919
- onPaginationModelChange: onPaginationModelChange,
27920
- pageSizeOptions: pageSizeOptions,
28030
+ page: page,
28031
+ pageSize: pageSize,
28032
+ onPageChange: onPageChange,
28033
+ onPageSizeChange: onPageSizeChange,
28034
+ rowsPerPageOptions: rowsPerPageOptions,
27921
28035
  paginationProps: paginationProps,
27922
28036
  paginationMode: paginationMode
27923
28037
  })) : null;
27924
28038
  }
27925
28039
  }),
27926
- slotProps: _objectSpread2(_objectSpread2({}, slotProps), {}, {
28040
+ componentsProps: _objectSpread2(_objectSpread2({}, componentsProps), {}, {
27927
28041
  toolbar: _objectSpread2({
27928
28042
  hideToolbar,
27929
28043
  RenderedToolbar,
@@ -27934,16 +28048,18 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
27934
28048
  selectionStatus,
27935
28049
  apiRef,
27936
28050
  isRowSelectable,
27937
- paginationModel,
27938
- onPaginationModelChange,
27939
- pageSizeOptions,
28051
+ page,
28052
+ pageSize,
28053
+ onPageChange,
28054
+ onPageSizeChange,
28055
+ rowsPerPageOptions,
27940
28056
  paginationProps,
27941
28057
  paginationMode,
27942
28058
  rowCount
27943
- }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar)
28059
+ }, componentsProps === null || componentsProps === void 0 ? void 0 : componentsProps.toolbar)
27944
28060
  }),
27945
- rowSelectionModel: rowSelectionModel,
27946
- onRowSelectionModelChange: (newSelectionModel, details) => {
28061
+ selectionModel: selectionModel,
28062
+ onSelectionModelChange: (newSelectionModel, details) => {
27947
28063
  if (pagination && paginationMode != 'server') {
27948
28064
  const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
27949
28065
  let {
@@ -28001,7 +28117,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
28001
28117
  };
28002
28118
  }
28003
28119
  }
28004
- onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
28120
+ onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(newSelectionModel, details);
28005
28121
  },
28006
28122
  sx: _objectSpread2(_objectSpread2({}, sx), {}, {
28007
28123
  '.MuiDataGrid-columnHeaders': {
@@ -28075,5 +28191,5 @@ const TextCell = /*#__PURE__*/forwardRef((props, ref) => {
28075
28191
  TextCell.className = CLASSNAME;
28076
28192
  TextCell.displayName = COMPONENT_NAME;
28077
28193
 
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 };
28194
+ export { BaseButton, BaseCheckbox, BaseIcon, BasePopper, BaseTextField, CATEGORIES, CONTAINS_ANY_OF, CONTAINS_ANY_OF_I, ControlledPagination, DEFAULT_OPERATORS, DETAIL_PANEL_TOGGLE_COL_DEF, DIMENSION_MODEL_KEY, DOES_NOT_CONTAIN, DOES_NOT_EQUAL, DataGrid, ENDS_WITH_ANY_OF, FILTER_MODEL_KEY, FILTER_SEARCH_KEY, GridToolbarFilterSemanticField, IS_ANY_OF, IS_BETWEEN, IS_NOT_ANY_OF, PAGINATION_MODEL_KEY, PINNED_COLUMNS, SORT_MODEL_KEY, STARTS_WITH_ANY_OF, ServerSideControlledPagination, StatefulDataGrid, TextCell, Toolbar$2 as Toolbar, ToolbarWrapper, VISIBILITY_MODEL_KEY, areFilterModelsEquivalent, buildStorageKey, clearPreviousVersionStorage, customColumnTypes, decodeValue, encodeValue, getColumnVisibilityFromString, getCompletion, getFilterModelFromString, getFinalSearch, getGridNumericOperators, getGridStringArrayOperators, getGridStringOperators, getModelsParsedOrUpdateLocalStorage, getPaginationFromString, getPinnedColumnsFromString, getRsNumberColumnType, getRsStringColumnType, getSearchParamsFromColumnVisibility, getSearchParamsFromFilterModel, getSearchParamsFromPagination, getSearchParamsFromPinnedColumns, getSearchParamsFromSorting, getSearchParamsFromTab, getSortingFromString, muiIconToDSIcon, numberOperatorDecoder, numberOperatorEncoder, onServerSideSelectionStatusChange, operatorList, updateUrl, urlSearchParamsToString };
28079
28195
  //# sourceMappingURL=index.js.map