@redsift/table 9.6.0 → 9.6.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.
package/index.js CHANGED
@@ -1,5 +1,4 @@
1
- import { GRID_DETAIL_PANEL_TOGGLE_COL_DEF, getGridNumericOperators as getGridNumericOperators$1, GridFilterInputMultipleValue, getGridStringOperators as getGridStringOperators$1, GridToolbarContainer, GridToolbarFilterButton, GridToolbarColumnsButton, GridToolbarDensitySelector, GridToolbarExport, gridExpandedSortedRowIdsSelector, useGridApiRef, DataGridPro, gridPaginatedVisibleSortedGridRowEntriesSelector, gridPaginatedVisibleSortedGridRowIdsSelector, gridFilteredSortedRowEntriesSelector, gridFilteredSortedRowIdsSelector } from '@mui/x-data-grid-pro';
2
- export * from '@mui/x-data-grid-pro';
1
+ import { GRID_DETAIL_PANEL_TOGGLE_COL_DEF, getGridNumericOperators as getGridNumericOperators$1, GridFilterInputMultipleValue, getGridStringOperators as getGridStringOperators$1, GridToolbarContainer, GridToolbarFilterButton, GridToolbarColumnsButton, GridToolbarDensitySelector, GridToolbarExport, gridVisibleSortedRowIdsSelector, useGridApiRef, DataGridPro, gridPaginatedVisibleSortedGridRowEntriesSelector, gridPaginatedVisibleSortedGridRowIdsSelector, gridFilteredSortedRowEntriesSelector, gridFilteredSortedRowIdsSelector } from '@mui/x-data-grid-pro';
3
2
  export { getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators } from '@mui/x-data-grid-pro';
4
3
  import * as React from 'react';
5
4
  import React__default, { Children, isValidElement, cloneElement, useLayoutEffect, useEffect, useRef, forwardRef, useState, useCallback, createElement } from 'react';
@@ -17467,7 +17466,7 @@ const isBetweenOperator = {
17467
17466
  label: 'is between',
17468
17467
  value: 'isBetween',
17469
17468
  getApplyFilterFn: filterItem => {
17470
- if (!filterItem.field || !filterItem.value || !filterItem.operator) {
17469
+ if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17471
17470
  return null;
17472
17471
  }
17473
17472
  if (!Array.isArray(filterItem.value) || filterItem.value.length !== 2) {
@@ -17480,7 +17479,7 @@ const isBetweenOperator = {
17480
17479
  return null;
17481
17480
  }
17482
17481
  return params => {
17483
- return params.value !== null && params.value !== undefined && filterItem.value[0] <= params.value && params.value <= filterItem.value[1];
17482
+ return params.value !== null && filterItem.value[0] <= params.value && params.value <= filterItem.value[1];
17484
17483
  };
17485
17484
  },
17486
17485
  InputComponent: InputNumberInterval
@@ -17493,7 +17492,7 @@ const containsAnyOfOperator = {
17493
17492
  label: 'contains any of',
17494
17493
  value: 'containsAnyOf',
17495
17494
  getApplyFilterFn: filterItem => {
17496
- if (!filterItem.field || !filterItem.value || !filterItem.operator) {
17495
+ if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17497
17496
  return null;
17498
17497
  }
17499
17498
  return params => {
@@ -17516,7 +17515,7 @@ const containsAnyOfCIOperator = {
17516
17515
  label: 'contains any of (case insensitive)',
17517
17516
  value: 'containsAnyOf',
17518
17517
  getApplyFilterFn: filterItem => {
17519
- if (!filterItem.field || !filterItem.value || !filterItem.operator) {
17518
+ if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17520
17519
  return null;
17521
17520
  }
17522
17521
  return params => {
@@ -17543,7 +17542,7 @@ const endsWithAnyOfOperator = {
17543
17542
  label: 'ends with any of',
17544
17543
  value: 'endsWithAnyOf',
17545
17544
  getApplyFilterFn: filterItem => {
17546
- if (!filterItem.field || !filterItem.value || !filterItem.operator) {
17545
+ if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17547
17546
  return null;
17548
17547
  }
17549
17548
  return params => {
@@ -17570,7 +17569,7 @@ const isAnyOfOperator = {
17570
17569
  label: 'is any of',
17571
17570
  value: 'isAnyOf',
17572
17571
  getApplyFilterFn: filterItem => {
17573
- if (!filterItem.field || !filterItem.value || !filterItem.operator) {
17572
+ if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17574
17573
  return null;
17575
17574
  }
17576
17575
  return params => {
@@ -17594,7 +17593,7 @@ const isNotAnyOfOperator = {
17594
17593
  label: 'is not any of',
17595
17594
  value: 'isNotAnyOf',
17596
17595
  getApplyFilterFn: filterItem => {
17597
- if (!filterItem.field || !filterItem.value || !filterItem.operator) {
17596
+ if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17598
17597
  return null;
17599
17598
  }
17600
17599
  return params => {
@@ -17618,7 +17617,7 @@ const startsWithAnyOfOperator = {
17618
17617
  label: 'starts with any of',
17619
17618
  value: 'startsWithAnyOf',
17620
17619
  getApplyFilterFn: filterItem => {
17621
- if (!filterItem.field || !filterItem.value || !filterItem.operator) {
17620
+ if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17622
17621
  return null;
17623
17622
  }
17624
17623
  return params => {
@@ -17647,7 +17646,7 @@ const getGridStringOperators = () => [...getGridStringOperators$1(), ...getGridS
17647
17646
 
17648
17647
  const API_URL = 'https://api.openai.com/v1/chat/completions';
17649
17648
  async function getCompletion(text, role, openai_api_key) {
17650
- let model = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'gpt-3.5-turbo-1106';
17649
+ let model = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'gpt-3.5-turbo-0613';
17651
17650
  try {
17652
17651
  const messages = [{
17653
17652
  role: 'system',
@@ -21694,10 +21693,10 @@ const COMPONENT_NAME$2 = 'GridToolbarFilterSemanticField';
21694
21693
  const CLASSNAME$2 = 'redsift-datagrid-toolbar-nlp-filter-field';
21695
21694
  const DEFAULT_PROPS$1 = {
21696
21695
  dateFormat: 'yyyy-mm-dd',
21697
- defaultModel: 'gpt-4-1106-preview',
21696
+ defaultModel: 'gpt-4-0613',
21698
21697
  defaultFilter: {
21699
21698
  items: [],
21700
- logicOperator: 'and'
21699
+ linkOperator: 'and'
21701
21700
  },
21702
21701
  disablePower: false,
21703
21702
  localeText: {
@@ -21738,16 +21737,16 @@ const getRole = (config, dateFormat) => {
21738
21737
  }).join('\n');
21739
21738
  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.
21740
21739
  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.
21741
- The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "logicOperator" and "items":
21742
- - "logicOperator": the logical operator, only "and" or "or" are allowed. If there is only one condition in the "items", use "and".
21743
- - "items": a list of conditions, each is an object with exactly the three keys "field", "operator" and "value":
21744
- - "field": the column name, must be one of ${columns}
21740
+ The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "linkOperator" and "items":
21741
+ - "linkOperator": the logical operator, only "and" or "or" are allowed. If there is only one condition in the "items", use "and".
21742
+ - "items": a list of conditions, each is an object with exactly the three keys "columnField", "operatorValue" and "value":
21743
+ - "columnField": the column name, must be one of ${columns}
21745
21744
  - "value":
21746
- - this can be skipped if the "operator" is either "isEmpty" or "isNotEmpty"
21747
- - a list of multiple values if the "operator" ends with "AnyOf"
21745
+ - this can be skipped if the "operatorValue" is either "isEmpty" or "isNotEmpty"
21746
+ - a list of multiple values if the "operatorValue" ends with "AnyOf"
21748
21747
  - otherwise, it's a single value represented as a string: "true" instead of true, "false" instead of false, "0.6" instead of 0.6.
21749
21748
  For "date" data type, use ${dateFormat}. If relative date is input, convert to the actual date given today is ${today}.
21750
- - "operator": the comparison operator, accepted values depend on the data type of the column
21749
+ - "operatorValue": the comparison operator, accepted values depend on the data type of the column
21751
21750
  ${operators}
21752
21751
 
21753
21752
  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:
@@ -21859,8 +21858,8 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
21859
21858
  isLoading: isLoading
21860
21859
  }, buttonText)), !disablePower && /*#__PURE__*/React__default.createElement(Tooltip, null, /*#__PURE__*/React__default.createElement(Tooltip.Trigger, null, /*#__PURE__*/React__default.createElement(Switch, {
21861
21860
  width: "175px",
21862
- isSelected: modelRef.current === 'gpt-4-1106-preview',
21863
- onChange: value => modelRef.current = value ? 'gpt-4-1106-preview' : 'gpt-3.5-turbo-1106'
21861
+ isSelected: modelRef.current === 'gpt-4-0613',
21862
+ onChange: value => modelRef.current = value ? 'gpt-4-0613' : 'gpt-3.5-turbo-0613'
21864
21863
  }, powerText)), /*#__PURE__*/React__default.createElement(Tooltip.Content, null, powerTooltipContent))), showErrorRef.current && /*#__PURE__*/React__default.createElement(Text, {
21865
21864
  color: "error",
21866
21865
  marginLeft: "8px"
@@ -21916,7 +21915,7 @@ const Toolbar$3 = props => {
21916
21915
  let {
21917
21916
  apiRef
21918
21917
  } = _ref;
21919
- return gridExpandedSortedRowIdsSelector(apiRef);
21918
+ return gridVisibleSortedRowIdsSelector(apiRef);
21920
21919
  }
21921
21920
  },
21922
21921
  printOptions: {
@@ -24368,8 +24367,8 @@ process.env.NODE_ENV !== "production" ? TablePagination.propTypes /* remove-prop
24368
24367
  } : void 0;
24369
24368
  var TablePagination$1 = TablePagination;
24370
24369
 
24371
- const _excluded$1 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "ControlledPagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "paginationModel", "onPaginationModelChange", "pageSizeOptions", "paginationProps", "paginationMode", "rowCount"],
24372
- _excluded2 = ["apiRef", "autoHeight", "className", "slots", "slotProps", "filterModel", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "onFilterModelChange", "rowSelectionModel", "paginationModel", "onPaginationModelChange", "onRowSelectionModelChange", "pagination", "paginationPlacement", "paginationProps", "rows", "pageSizeOptions", "sx", "paginationMode", "rowCount"];
24370
+ const _excluded$1 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "ControlledPagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "page", "onPageChange", "pageSize", "onPageSizeChange", "rowsPerPageOptions", "paginationProps", "paginationMode", "rowCount"],
24371
+ _excluded2 = ["apiRef", "autoHeight", "className", "components", "componentsProps", "filterModel", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "onFilterModelChange", "onPageChange", "onPageSizeChange", "selectionModel", "onSelectionModelChange", "page", "pageSize", "pagination", "paginationPlacement", "paginationProps", "rows", "rowsPerPageOptions", "sx", "paginationMode", "rowCount"];
24373
24372
  const COMPONENT_NAME$1 = 'DataGrid';
24374
24373
  const CLASSNAME$1 = 'redsift-datagrid';
24375
24374
  const DEFAULT_PROPS = {
@@ -24398,25 +24397,18 @@ const ControlledPagination = _ref3 => {
24398
24397
  displayPagination = false,
24399
24398
  selectionStatus,
24400
24399
  apiRef,
24401
- paginationModel,
24402
- onPaginationModelChange,
24403
- pageSizeOptions,
24400
+ page,
24401
+ onPageChange,
24402
+ pageSize,
24403
+ onPageSizeChange,
24404
+ rowsPerPageOptions,
24404
24405
  isRowSelectable,
24405
- paginationProps,
24406
- paginationMode = 'client',
24407
- rowCount
24406
+ paginationProps
24408
24407
  } = _ref3;
24409
- // This values are only used to compute the number of rows on client-side pagination
24410
24408
  const filteredRowsInTable = getSelectableRowsInTable(apiRef);
24411
24409
  const selectableRowsInTable = getSelectableRowsInTable(apiRef, isRowSelectable);
24412
-
24413
- // in order to have server side pagination, we need to provide rowCount
24414
- const isServerPagination = paginationMode === 'server' && rowCount;
24415
-
24416
- // server side pagination assumes rows to be already filtered and selectable
24417
- const numberOfFilteredRowsInTable = isServerPagination ? rowCount : filteredRowsInTable.length;
24418
- const numberOfSelectableRowsInTable = isServerPagination ? rowCount : selectableRowsInTable.length;
24419
- const totalNumberOfRowsInTable = isServerPagination ? rowCount : apiRef.current.getRowsCount();
24410
+ const numberOfFilteredRowsInTable = filteredRowsInTable.length;
24411
+ const numberOfSelectableRowsInTable = selectableRowsInTable.length;
24420
24412
  return /*#__PURE__*/React__default.createElement(Flexbox, {
24421
24413
  flexDirection: "row",
24422
24414
  alignItems: "center",
@@ -24428,8 +24420,7 @@ const ControlledPagination = _ref3 => {
24428
24420
  onClick: () => {
24429
24421
  apiRef.current.selectRows(numberOfSelectableRowsInTable ? selectableRowsInTable : apiRef.current.getAllRowIds());
24430
24422
  }
24431
- }, `Select all ${numberOfSelectableRowsInTable}
24432
- ${numberOfFilteredRowsInTable !== numberOfSelectableRowsInTable ? ' selectable' : ''} rows in the table.`)) : selectionStatus.type === 'table' ? /*#__PURE__*/React__default.createElement(Text, {
24423
+ }, "Select all ", numberOfSelectableRowsInTable, numberOfFilteredRowsInTable !== numberOfSelectableRowsInTable ? ' selectable' : '', " rows in the table.")) : selectionStatus.type === 'table' ? /*#__PURE__*/React__default.createElement(Text, {
24433
24424
  fontSize: "14px"
24434
24425
  }, `All ${selectionStatus.numberOfSelectedRows}${numberOfFilteredRowsInTable !== numberOfSelectableRowsInTable ? ' selectable' : ''} rows in the table are selected. `, /*#__PURE__*/React__default.createElement(LinkButton, {
24435
24426
  onClick: () => {
@@ -24439,18 +24430,14 @@ const ControlledPagination = _ref3 => {
24439
24430
  fontSize: "14px"
24440
24431
  }, `${selectionStatus.numberOfSelectedRows} row${selectionStatus.numberOfSelectedRows > 1 ? 's' : ''} selected`) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$2({
24441
24432
  component: "div",
24442
- count: totalNumberOfRowsInTable,
24443
- page: paginationModel.page,
24444
- onPageChange: (event, page) => onPaginationModelChange({
24445
- page,
24446
- pageSize: paginationModel.pageSize
24447
- }),
24448
- rowsPerPage: paginationModel.pageSize,
24449
- onRowsPerPageChange: event => onPaginationModelChange({
24450
- page: paginationModel.page,
24451
- pageSize: parseInt(event.target.value, 10)
24452
- }),
24453
- rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
24433
+ count: numberOfFilteredRowsInTable,
24434
+ page: page,
24435
+ onPageChange: (event, newPage) => onPageChange(newPage),
24436
+ rowsPerPage: pageSize,
24437
+ onRowsPerPageChange: event => {
24438
+ onPageSizeChange(parseInt(event.target.value, 10));
24439
+ },
24440
+ rowsPerPageOptions: displayRowsPerPage ? rowsPerPageOptions : []
24454
24441
  }, paginationProps)) : null);
24455
24442
  };
24456
24443
  const ServerSideControlledPagination = _ref4 => {
@@ -24458,10 +24445,12 @@ const ServerSideControlledPagination = _ref4 => {
24458
24445
  selectionStatus,
24459
24446
  displaySelection,
24460
24447
  displayPagination,
24461
- paginationModel,
24462
- onPaginationModelChange,
24463
- pageSizeOptions,
24448
+ page,
24449
+ onPageChange,
24450
+ pageSize,
24451
+ onPageSizeChange,
24464
24452
  displayRowsPerPage,
24453
+ rowsPerPageOptions,
24465
24454
  paginationProps,
24466
24455
  rowCount
24467
24456
  } = _ref4;
@@ -24480,17 +24469,13 @@ const ServerSideControlledPagination = _ref4 => {
24480
24469
  }, totalRowsLabel) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$2({
24481
24470
  component: "div",
24482
24471
  count: totalNumberOfRowsInTable,
24483
- page: paginationModel.page,
24484
- onPageChange: (event, page) => onPaginationModelChange({
24485
- page,
24486
- pageSize: paginationModel.pageSize
24487
- }),
24488
- rowsPerPage: paginationModel.pageSize,
24489
- onRowsPerPageChange: event => onPaginationModelChange({
24490
- page: paginationModel.page,
24491
- pageSize: parseInt(event.target.value, 10)
24492
- }),
24493
- rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
24472
+ page: page,
24473
+ onPageChange: (event, newPage) => onPageChange(newPage),
24474
+ rowsPerPage: pageSize,
24475
+ onRowsPerPageChange: event => {
24476
+ onPageSizeChange(parseInt(event.target.value, 10));
24477
+ },
24478
+ rowsPerPageOptions: displayRowsPerPage ? rowsPerPageOptions : []
24494
24479
  }, paginationProps)) : null);
24495
24480
  };
24496
24481
  const Toolbar = _ref5 => {
@@ -24505,9 +24490,11 @@ const Toolbar = _ref5 => {
24505
24490
  selectionStatus,
24506
24491
  apiRef,
24507
24492
  isRowSelectable,
24508
- paginationModel,
24509
- onPaginationModelChange,
24510
- pageSizeOptions,
24493
+ page,
24494
+ onPageChange,
24495
+ pageSize,
24496
+ onPageSizeChange,
24497
+ rowsPerPageOptions,
24511
24498
  paginationProps,
24512
24499
  paginationMode = 'client',
24513
24500
  rowCount
@@ -24521,9 +24508,11 @@ const Toolbar = _ref5 => {
24521
24508
  displayRowsPerPage: false,
24522
24509
  displayPagination: ['top', 'both'].includes(paginationPlacement),
24523
24510
  selectionStatus: selectionStatus.current,
24524
- paginationModel: paginationModel,
24525
- onPaginationModelChange: onPaginationModelChange,
24526
- pageSizeOptions: pageSizeOptions,
24511
+ page: page,
24512
+ onPageChange: onPageChange,
24513
+ pageSize: pageSize,
24514
+ onPageSizeChange: onPageSizeChange,
24515
+ rowsPerPageOptions: rowsPerPageOptions,
24527
24516
  paginationProps: paginationProps,
24528
24517
  rowCount: rowCount
24529
24518
  }) : /*#__PURE__*/React__default.createElement(ControlledPagination, {
@@ -24533,9 +24522,11 @@ const Toolbar = _ref5 => {
24533
24522
  selectionStatus: selectionStatus.current,
24534
24523
  apiRef: apiRef,
24535
24524
  isRowSelectable: isRowSelectable,
24536
- paginationModel: paginationModel,
24537
- onPaginationModelChange: onPaginationModelChange,
24538
- pageSizeOptions: pageSizeOptions,
24525
+ page: page,
24526
+ onPageChange: onPageChange,
24527
+ pageSize: pageSize,
24528
+ onPageSizeChange: onPageSizeChange,
24529
+ rowsPerPageOptions: rowsPerPageOptions,
24539
24530
  paginationProps: paginationProps
24540
24531
  }) : null);
24541
24532
  };
@@ -24595,14 +24586,14 @@ const onServerSideSelectionStatusChange = (newSelectionModel, apiRef, selectionS
24595
24586
  }
24596
24587
  };
24597
24588
  const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
24598
- var _ref8, _ref9, _initialState$paginat, _initialState$paginat2, _initialState$paginat3, _pageSizeOptions$, _ref10, _initialState$paginat4, _initialState$paginat5, _initialState$paginat6;
24589
+ var _initialState$paginat, _initialState$paginat2;
24599
24590
  const datagridRef = ref || useRef();
24600
24591
  const {
24601
24592
  apiRef: propsApiRef,
24602
24593
  autoHeight,
24603
24594
  className,
24604
- slots,
24605
- slotProps,
24595
+ components,
24596
+ componentsProps,
24606
24597
  filterModel: propsFilterModel,
24607
24598
  height: propsHeight,
24608
24599
  hideToolbar,
@@ -24610,15 +24601,17 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
24610
24601
  isRowSelectable,
24611
24602
  license,
24612
24603
  onFilterModelChange: propsOnFilterModelChange,
24613
- rowSelectionModel: propsSelectionModel,
24614
- paginationModel: propsPaginationModel,
24615
- onPaginationModelChange: propsOnPaginationModelChange,
24616
- onRowSelectionModelChange,
24604
+ onPageChange: propsOnPageChange,
24605
+ onPageSizeChange: propsOnPageSizeChange,
24606
+ selectionModel: propsSelectionModel,
24607
+ onSelectionModelChange,
24608
+ page: propsPage,
24609
+ pageSize: propsPageSize,
24617
24610
  pagination,
24618
24611
  paginationPlacement,
24619
24612
  paginationProps,
24620
24613
  rows,
24621
- pageSizeOptions,
24614
+ rowsPerPageOptions,
24622
24615
  sx,
24623
24616
  paginationMode = 'client',
24624
24617
  rowCount
@@ -24626,7 +24619,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
24626
24619
  forwardedProps = _objectWithoutProperties(props, _excluded2);
24627
24620
  const _apiRef = useGridApiRef();
24628
24621
  const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
24629
- const RenderedToolbar = slots !== null && slots !== void 0 && slots.toolbar ? slots.toolbar : Toolbar$3;
24622
+ const RenderedToolbar = components !== null && components !== void 0 && components.Toolbar ? components.Toolbar : Toolbar$3;
24630
24623
  LicenseInfo.setLicenseKey(license);
24631
24624
  const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
24632
24625
  const [filterModel, setFilterModel] = useState(propsFilterModel);
@@ -24640,41 +24633,52 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
24640
24633
  setFilterModel(model);
24641
24634
  }
24642
24635
  };
24643
- const [rowSelectionModel, setRowSelectionModel] = useState(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
24636
+ const [selectionModel, setSelectionModel] = useState(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
24644
24637
  useEffect(() => {
24645
- setRowSelectionModel(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
24638
+ setSelectionModel(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
24646
24639
  }, [propsSelectionModel]);
24647
- const [paginationModel, setPaginationModel] = useState({
24648
- pageSize: (_ref8 = (_ref9 = (_initialState$paginat = initialState === null || initialState === void 0 ? void 0 : (_initialState$paginat2 = initialState.pagination) === null || _initialState$paginat2 === void 0 ? void 0 : (_initialState$paginat3 = _initialState$paginat2.paginationModel) === null || _initialState$paginat3 === void 0 ? void 0 : _initialState$paginat3.pageSize) !== null && _initialState$paginat !== void 0 ? _initialState$paginat : propsPaginationModel === null || propsPaginationModel === void 0 ? void 0 : propsPaginationModel.pageSize) !== null && _ref9 !== void 0 ? _ref9 : 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 && _ref8 !== void 0 ? _ref8 : 100,
24649
- page: (_ref10 = (_initialState$paginat4 = initialState === null || initialState === void 0 ? void 0 : (_initialState$paginat5 = initialState.pagination) === null || _initialState$paginat5 === void 0 ? void 0 : (_initialState$paginat6 = _initialState$paginat5.paginationModel) === null || _initialState$paginat6 === void 0 ? void 0 : _initialState$paginat6.page) !== null && _initialState$paginat4 !== void 0 ? _initialState$paginat4 : propsPaginationModel === null || propsPaginationModel === void 0 ? void 0 : propsPaginationModel.page) !== null && _ref10 !== void 0 ? _ref10 : 0
24640
+ const [page, setPage] = React__default.useState((initialState === null || initialState === void 0 ? void 0 : (_initialState$paginat = initialState.pagination) === null || _initialState$paginat === void 0 ? void 0 : _initialState$paginat.page) || propsPage || 0);
24641
+ const [pageSize, setPageSize] = React__default.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]) || 100);
24642
+ const selectionStatus = useRef({
24643
+ type: 'none',
24644
+ numberOfSelectedRows: 0,
24645
+ numberOfSelectedRowsInPage: 0,
24646
+ page,
24647
+ pageSize
24650
24648
  });
24651
- const onPaginationModelChange = model => {
24652
- if (propsOnPaginationModelChange) {
24653
- propsOnPaginationModelChange(model, undefined);
24649
+ const onPageChange = page => {
24650
+ if (propsOnPageChange) {
24651
+ propsOnPageChange(page, undefined);
24654
24652
  } else {
24655
- setPaginationModel(model);
24653
+ setPage(page);
24656
24654
  }
24657
24655
  };
24658
24656
  useEffect(() => {
24659
- if (propsPaginationModel) {
24660
- setPaginationModel(propsPaginationModel);
24657
+ if (propsPage || propsPage === 0) {
24658
+ setPage(propsPage);
24659
+ }
24660
+ }, [propsPage]);
24661
+ const onPageSizeChange = pageSize => {
24662
+ onPageChange(0);
24663
+ if (propsOnPageSizeChange) {
24664
+ propsOnPageSizeChange(pageSize, undefined);
24665
+ } else {
24666
+ setPageSize(pageSize);
24661
24667
  }
24662
- }, [propsPaginationModel]);
24663
- const selectionStatus = useRef({
24664
- type: 'none',
24665
- numberOfSelectedRows: 0,
24666
- numberOfSelectedRowsInPage: 0,
24667
- page: paginationModel.page,
24668
- pageSize: paginationModel.pageSize
24669
- });
24668
+ };
24669
+ useEffect(() => {
24670
+ if (propsPageSize) {
24671
+ setPageSize(propsPageSize);
24672
+ }
24673
+ }, [propsPageSize]);
24670
24674
 
24671
24675
  // in server-side pagination we want to update the selection status
24672
24676
  // every time we navigate between pages, resize our page or select something
24673
24677
  useEffect(() => {
24674
24678
  if (paginationMode == 'server') {
24675
- onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatus, isRowSelectable, paginationModel.page, paginationModel.pageSize);
24679
+ onServerSideSelectionStatusChange(Array.isArray(selectionModel) ? selectionModel : [selectionModel], apiRef, selectionStatus, isRowSelectable, page, pageSize);
24676
24680
  }
24677
- }, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
24681
+ }, [selectionModel, page, pageSize]);
24678
24682
  if (!Array.isArray(rows)) {
24679
24683
  return null;
24680
24684
  }
@@ -24686,54 +24690,56 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
24686
24690
  apiRef: apiRef,
24687
24691
  autoHeight: autoHeight,
24688
24692
  checkboxSelectionVisibleOnly: Boolean(pagination),
24689
- slots: _objectSpread2(_objectSpread2({
24690
- baseButton: BaseButton,
24691
- baseCheckbox: BaseCheckbox,
24692
- // baseTextField,
24693
- basePopper: BasePopper,
24694
- columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24693
+ components: _objectSpread2(_objectSpread2({
24694
+ BaseButton,
24695
+ BaseCheckbox,
24696
+ // BaseTextField,
24697
+ BasePopper,
24698
+ ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24695
24699
  displayName: "ColumnFilteredIcon"
24696
24700
  })),
24697
- columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24701
+ ColumnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24698
24702
  displayName: "ColumnSelectorIcon"
24699
24703
  })),
24700
- columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24704
+ ColumnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24701
24705
  displayName: "ColumnSortedAscendingIcon"
24702
24706
  })),
24703
- columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24707
+ ColumnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24704
24708
  displayName: "ColumnSortedDescendingIcon"
24705
24709
  })),
24706
- densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24710
+ DensityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24707
24711
  displayName: "DensityCompactIcon"
24708
24712
  })),
24709
- densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24713
+ DensityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24710
24714
  displayName: "DensityStandardIcon"
24711
24715
  })),
24712
- densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24716
+ DensityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24713
24717
  displayName: "DensityComfortableIcon"
24714
24718
  })),
24715
- detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24719
+ DetailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24716
24720
  displayName: "DetailPanelCollapseIcon"
24717
24721
  })),
24718
- detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24722
+ DetailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24719
24723
  displayName: "DetailPanelExpandIcon"
24720
24724
  })),
24721
- exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24725
+ ExportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24722
24726
  displayName: "ExportIcon"
24723
24727
  })),
24724
- openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({
24728
+ OpenFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({
24725
24729
  displayName: "OpenFilterButtonIcon"
24726
24730
  }, props))
24727
- }, slots), {}, {
24728
- toolbar: Toolbar,
24729
- pagination: props => pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$2({}, props, {
24731
+ }, components), {}, {
24732
+ Toolbar: Toolbar,
24733
+ Pagination: props => pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$2({}, props, {
24730
24734
  displaySelection: false,
24731
24735
  displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
24732
24736
  displayPagination: ['bottom', 'both'].includes(paginationPlacement),
24733
24737
  selectionStatus: selectionStatus.current,
24734
- paginationModel: paginationModel,
24735
- onPaginationModelChange: onPaginationModelChange,
24736
- pageSizeOptions: pageSizeOptions,
24738
+ page: page,
24739
+ onPageChange: onPageChange,
24740
+ pageSize: pageSize,
24741
+ onPageSizeChange: onPageSizeChange,
24742
+ rowsPerPageOptions: rowsPerPageOptions,
24737
24743
  paginationProps: paginationProps,
24738
24744
  paginationMode: paginationMode,
24739
24745
  rowCount: rowCount
@@ -24744,15 +24750,17 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
24744
24750
  selectionStatus: selectionStatus.current,
24745
24751
  apiRef: apiRef,
24746
24752
  isRowSelectable: isRowSelectable,
24747
- paginationModel: paginationModel,
24748
- onPaginationModelChange: onPaginationModelChange,
24749
- pageSizeOptions: pageSizeOptions,
24753
+ page: page,
24754
+ onPageChange: onPageChange,
24755
+ pageSize: pageSize,
24756
+ onPageSizeChange: onPageSizeChange,
24757
+ rowsPerPageOptions: rowsPerPageOptions,
24750
24758
  paginationProps: paginationProps,
24751
24759
  paginationMode: paginationMode,
24752
24760
  rowCount: rowCount
24753
24761
  })) : null
24754
24762
  }),
24755
- slotProps: _objectSpread2(_objectSpread2({}, slotProps), {}, {
24763
+ componentsProps: _objectSpread2(_objectSpread2({}, componentsProps), {}, {
24756
24764
  toolbar: _objectSpread2({
24757
24765
  hideToolbar,
24758
24766
  RenderedToolbar,
@@ -24764,13 +24772,15 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
24764
24772
  selectionStatus,
24765
24773
  apiRef,
24766
24774
  isRowSelectable,
24767
- paginationModel,
24768
- onPaginationModelChange,
24769
- pageSizeOptions,
24775
+ page,
24776
+ onPageChange,
24777
+ pageSize,
24778
+ onPageSizeChange,
24779
+ rowsPerPageOptions,
24770
24780
  paginationProps,
24771
24781
  paginationMode,
24772
24782
  rowCount
24773
- }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar)
24783
+ }, componentsProps === null || componentsProps === void 0 ? void 0 : componentsProps.toolbar)
24774
24784
  }),
24775
24785
  filterModel: filterModel,
24776
24786
  initialState: initialState,
@@ -24780,37 +24790,39 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
24780
24790
  paginationMode: paginationMode,
24781
24791
  keepNonExistentRowsSelected: paginationMode == 'server',
24782
24792
  rows: rows,
24783
- pageSizeOptions: pageSizeOptions,
24784
- paginationModel: paginationModel,
24785
- onPaginationModelChange: onPaginationModelChange,
24786
- rowSelectionModel: rowSelectionModel,
24787
- onRowSelectionModelChange: (newSelectionModel, details) => {
24793
+ rowsPerPageOptions: rowsPerPageOptions,
24794
+ page: page,
24795
+ onPageChange: onPageChange,
24796
+ pageSize: pageSize,
24797
+ onPageSizeChange: onPageSizeChange,
24798
+ selectionModel: selectionModel,
24799
+ onSelectionModelChange: (newSelectionModel, details) => {
24788
24800
  if (pagination && paginationMode != 'server') {
24789
- const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref11 => {
24801
+ const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref8 => {
24790
24802
  let {
24791
24803
  model
24792
- } = _ref11;
24804
+ } = _ref8;
24793
24805
  return isRowSelectable({
24794
24806
  row: model
24795
24807
  });
24796
- }).map(_ref12 => {
24808
+ }).map(_ref9 => {
24797
24809
  let {
24798
24810
  id
24799
- } = _ref12;
24811
+ } = _ref9;
24800
24812
  return id;
24801
24813
  }) : gridPaginatedVisibleSortedGridRowIdsSelector(apiRef);
24802
24814
  const numberOfSelectableRowsInPage = selectableRowsInPage.length;
24803
- const selectableRowsInTable = isRowSelectable ? gridFilteredSortedRowEntriesSelector(apiRef).filter(_ref13 => {
24815
+ const selectableRowsInTable = isRowSelectable ? gridFilteredSortedRowEntriesSelector(apiRef).filter(_ref10 => {
24804
24816
  let {
24805
24817
  model
24806
- } = _ref13;
24818
+ } = _ref10;
24807
24819
  return isRowSelectable({
24808
24820
  row: model
24809
24821
  });
24810
- }).map(_ref14 => {
24822
+ }).map(_ref11 => {
24811
24823
  let {
24812
24824
  id
24813
- } = _ref14;
24825
+ } = _ref11;
24814
24826
  return id;
24815
24827
  }) : gridFilteredSortedRowIdsSelector(apiRef);
24816
24828
  const numberOfSelectableRowsInTable = selectableRowsInTable.length;
@@ -24842,7 +24854,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
24842
24854
  };
24843
24855
  }
24844
24856
  }
24845
- onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
24857
+ onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(newSelectionModel, details);
24846
24858
  },
24847
24859
  sx: _objectSpread2(_objectSpread2({}, sx), {}, {
24848
24860
  '.MuiDataGrid-columnHeaders': {