@redsift/table 10.8.2-muiv5 → 10.8.2

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.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as _mui_x_data_grid_pro from '@mui/x-data-grid-pro';
2
2
  import { GridFilterItem, GridCellParams, GridFilterOperator, GridFilterInputMultipleValue, DataGridProProps, GridFilterModel, GridToolbarExportProps, GridToolbarFilterButtonProps, GridToolbarColumnsButton, GridToolbarDensitySelector } from '@mui/x-data-grid-pro';
3
- export { GridAlignment, GridColDef, GridColumns, GridFilterItem, GridFilterModel, GridSelectionModel, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators } from '@mui/x-data-grid-pro';
3
+ export * from '@mui/x-data-grid-pro';
4
+ export { GridAlignment, GridColDef, GridFilterItem, GridFilterModel, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators } from '@mui/x-data-grid-pro';
4
5
  import { Theme, Comp, IconProps, NotificationsColorPalette, ProductColorPalette, ShieldVariant } from '@redsift/design-system';
5
6
  import React, { ReactNode, ComponentProps, RefObject } from 'react';
6
7
  import { TablePaginationProps } from '@mui/material';
@@ -10,7 +11,7 @@ declare const DETAIL_PANEL_TOGGLE_COL_DEF: _mui_x_data_grid_pro.GridColDef<any,
10
11
  declare const IS_BETWEEN: {
11
12
  label: string;
12
13
  value: string;
13
- getApplyFilterFn: (filterItem: GridFilterItem) => ((params: GridCellParams) => boolean) | null;
14
+ getApplyFilterFn: (filterItem: GridFilterItem) => ((params: GridCellParams<any, any>) => boolean) | null;
14
15
  InputComponent: (props: any) => JSX.Element;
15
16
  };
16
17
 
@@ -95,12 +96,12 @@ type StyledDataGridProps = {
95
96
  declare const DataGrid: Comp<DataGridProps, HTMLDivElement>;
96
97
 
97
98
  interface CompletionResponseItem {
98
- columnField: string;
99
- operatorValue: string;
99
+ field: string;
100
+ operator: string;
100
101
  value?: string;
101
102
  }
102
103
  type CompletionResponse = {
103
- linkOperator: 'and' | 'or';
104
+ logicOperator: 'and' | 'or';
104
105
  items: CompletionResponseItem[];
105
106
  };
106
107
  interface LocaleText {
package/index.js CHANGED
@@ -1,4 +1,5 @@
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';
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';
2
3
  export { getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators } from '@mui/x-data-grid-pro';
3
4
  import * as React from 'react';
4
5
  import React__default, { Children, isValidElement, cloneElement, useLayoutEffect, useEffect, useRef, forwardRef, useContext, useState, useCallback, createElement, useMemo } from 'react';
@@ -17639,7 +17640,7 @@ const isBetweenOperator = {
17639
17640
  label: 'is between',
17640
17641
  value: 'isBetween',
17641
17642
  getApplyFilterFn: filterItem => {
17642
- if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17643
+ if (!filterItem.field || !filterItem.value || !filterItem.operator) {
17643
17644
  return null;
17644
17645
  }
17645
17646
  if (!Array.isArray(filterItem.value) || filterItem.value.length !== 2) {
@@ -17652,7 +17653,7 @@ const isBetweenOperator = {
17652
17653
  return null;
17653
17654
  }
17654
17655
  return params => {
17655
- return params.value !== null && filterItem.value[0] <= params.value && params.value <= filterItem.value[1];
17656
+ return params.value !== null && params.value !== undefined && filterItem.value[0] <= params.value && params.value <= filterItem.value[1];
17656
17657
  };
17657
17658
  },
17658
17659
  InputComponent: InputNumberInterval
@@ -17665,7 +17666,7 @@ const containsAnyOfOperator = {
17665
17666
  label: 'contains any of',
17666
17667
  value: 'containsAnyOf',
17667
17668
  getApplyFilterFn: filterItem => {
17668
- if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17669
+ if (!filterItem.field || !filterItem.value || !filterItem.operator) {
17669
17670
  return null;
17670
17671
  }
17671
17672
  return params => {
@@ -17688,7 +17689,7 @@ const containsAnyOfCIOperator = {
17688
17689
  label: 'contains any of (case insensitive)',
17689
17690
  value: 'containsAnyOf',
17690
17691
  getApplyFilterFn: filterItem => {
17691
- if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17692
+ if (!filterItem.field || !filterItem.value || !filterItem.operator) {
17692
17693
  return null;
17693
17694
  }
17694
17695
  return params => {
@@ -17715,7 +17716,7 @@ const endsWithAnyOfOperator = {
17715
17716
  label: 'ends with any of',
17716
17717
  value: 'endsWithAnyOf',
17717
17718
  getApplyFilterFn: filterItem => {
17718
- if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17719
+ if (!filterItem.field || !filterItem.value || !filterItem.operator) {
17719
17720
  return null;
17720
17721
  }
17721
17722
  return params => {
@@ -17742,7 +17743,7 @@ const isAnyOfOperator = {
17742
17743
  label: 'is any of',
17743
17744
  value: 'isAnyOf',
17744
17745
  getApplyFilterFn: filterItem => {
17745
- if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17746
+ if (!filterItem.field || !filterItem.value || !filterItem.operator) {
17746
17747
  return null;
17747
17748
  }
17748
17749
  return params => {
@@ -17766,7 +17767,7 @@ const isNotAnyOfOperator = {
17766
17767
  label: 'is not any of',
17767
17768
  value: 'isNotAnyOf',
17768
17769
  getApplyFilterFn: filterItem => {
17769
- if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17770
+ if (!filterItem.field || !filterItem.value || !filterItem.operator) {
17770
17771
  return null;
17771
17772
  }
17772
17773
  return params => {
@@ -17790,7 +17791,7 @@ const startsWithAnyOfOperator = {
17790
17791
  label: 'starts with any of',
17791
17792
  value: 'startsWithAnyOf',
17792
17793
  getApplyFilterFn: filterItem => {
17793
- if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17794
+ if (!filterItem.field || !filterItem.value || !filterItem.operator) {
17794
17795
  return null;
17795
17796
  }
17796
17797
  return params => {
@@ -17819,7 +17820,7 @@ const getGridStringOperators = () => [...getGridStringOperators$1(), ...getGridS
17819
17820
 
17820
17821
  const API_URL = 'https://api.openai.com/v1/chat/completions';
17821
17822
  async function getCompletion(text, role, openai_api_key) {
17822
- let model = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'gpt-3.5-turbo-0613';
17823
+ let model = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'gpt-3.5-turbo-1106';
17823
17824
  try {
17824
17825
  const messages = [{
17825
17826
  role: 'system',
@@ -21951,16 +21952,16 @@ const getRole = (config, dateFormat) => {
21951
21952
  }).join('\n');
21952
21953
  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.
21953
21954
  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.
21954
- The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "linkOperator" and "items":
21955
- - "linkOperator": the logical operator, only "and" or "or" are allowed. If there is only one condition in the "items", use "and".
21956
- - "items": a list of conditions, each is an object with exactly the three keys "columnField", "operatorValue" and "value":
21957
- - "columnField": the column name, must be one of ${columns}
21955
+ The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "logicOperator" and "items":
21956
+ - "logicOperator": the logical operator, only "and" or "or" are allowed. If there is only one condition in the "items", use "and".
21957
+ - "items": a list of conditions, each is an object with exactly the three keys "field", "operator" and "value":
21958
+ - "field": the column name, must be one of ${columns}
21958
21959
  - "value":
21959
- - this can be skipped if the "operatorValue" is either "isEmpty" or "isNotEmpty"
21960
- - a list of multiple values if the "operatorValue" ends with "AnyOf"
21960
+ - this can be skipped if the "operator" is either "isEmpty" or "isNotEmpty"
21961
+ - a list of multiple values if the "operator" ends with "AnyOf"
21961
21962
  - otherwise, it's a single value represented as a string: "true" instead of true, "false" instead of false, "0.6" instead of 0.6.
21962
21963
  For "date" data type, use ${dateFormat}. If relative date is input, convert to the actual date given today is ${today}.
21963
- - "operatorValue": the comparison operator, accepted values depend on the data type of the column
21964
+ - "operator": the comparison operator, accepted values depend on the data type of the column
21964
21965
  ${operators}
21965
21966
 
21966
21967
  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:
@@ -21997,10 +21998,10 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
21997
21998
  nlpFilterConfig,
21998
21999
  onFilterModelChange,
21999
22000
  dateFormat = 'yyyy-mm-dd',
22000
- defaultModel = 'gpt-4-0613',
22001
+ defaultModel = 'gpt-4-1106-preview',
22001
22002
  defaultFilter = {
22002
22003
  items: [],
22003
- linkOperator: 'and'
22004
+ logicOperator: 'and'
22004
22005
  },
22005
22006
  disablePower = false,
22006
22007
  localeText
@@ -22078,7 +22079,7 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
22078
22079
  value: prompt
22079
22080
  }), /*#__PURE__*/React__default.createElement(Button, {
22080
22081
  variant: "primary",
22081
- "aira-label": buttonAriaLabel,
22082
+ "aria-label": buttonAriaLabel,
22082
22083
  type: "submit",
22083
22084
  isLoading: isLoading
22084
22085
  }, buttonText)), !disablePower && /*#__PURE__*/React__default.createElement(Tooltip, null, /*#__PURE__*/React__default.createElement(Tooltip.Trigger, null, /*#__PURE__*/React__default.createElement(Switch, {
@@ -22139,7 +22140,7 @@ const Toolbar$3 = props => {
22139
22140
  let {
22140
22141
  apiRef
22141
22142
  } = _ref;
22142
- return gridVisibleSortedRowIdsSelector(apiRef);
22143
+ return gridExpandedSortedRowIdsSelector(apiRef);
22143
22144
  }
22144
22145
  },
22145
22146
  printOptions: {
@@ -24591,8 +24592,8 @@ process.env.NODE_ENV !== "production" ? TablePagination.propTypes /* remove-prop
24591
24592
  } : void 0;
24592
24593
  var TablePagination$1 = TablePagination;
24593
24594
 
24594
- const _excluded$1 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "ControlledPagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "page", "onPageChange", "pageSize", "onPageSizeChange", "rowsPerPageOptions", "paginationProps", "paginationMode", "rowCount"],
24595
- _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", "theme", "paginationMode", "rowCount"];
24595
+ const _excluded$1 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "ControlledPagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "paginationModel", "onPaginationModelChange", "pageSizeOptions", "paginationProps", "paginationMode", "rowCount"],
24596
+ _excluded2 = ["apiRef", "autoHeight", "className", "slots", "slotProps", "filterModel", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "onFilterModelChange", "rowSelectionModel", "paginationModel", "onPaginationModelChange", "onRowSelectionModelChange", "pagination", "paginationPlacement", "paginationProps", "rows", "pageSizeOptions", "sx", "theme", "paginationMode", "rowCount"];
24596
24597
  const COMPONENT_NAME$1 = 'DataGrid';
24597
24598
  const CLASSNAME$1 = 'redsift-datagrid';
24598
24599
  const getSelectableRowsInTable = (apiRef, isRowSelectable) => {
@@ -24617,11 +24618,9 @@ const ControlledPagination = _ref3 => {
24617
24618
  displayPagination = false,
24618
24619
  selectionStatus,
24619
24620
  apiRef,
24620
- page,
24621
- onPageChange,
24622
- pageSize,
24623
- onPageSizeChange,
24624
- rowsPerPageOptions,
24621
+ paginationModel,
24622
+ onPaginationModelChange,
24623
+ pageSizeOptions,
24625
24624
  isRowSelectable,
24626
24625
  paginationProps
24627
24626
  } = _ref3;
@@ -24651,13 +24650,17 @@ const ControlledPagination = _ref3 => {
24651
24650
  }, `${selectionStatus.numberOfSelectedRows} row${selectionStatus.numberOfSelectedRows > 1 ? 's' : ''} selected`) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$2({
24652
24651
  component: "div",
24653
24652
  count: numberOfFilteredRowsInTable,
24654
- page: page,
24655
- onPageChange: (event, newPage) => onPageChange(newPage),
24656
- rowsPerPage: pageSize,
24657
- onRowsPerPageChange: event => {
24658
- onPageSizeChange(parseInt(event.target.value, 10));
24659
- },
24660
- rowsPerPageOptions: displayRowsPerPage ? rowsPerPageOptions : []
24653
+ page: paginationModel.page,
24654
+ onPageChange: (event, page) => onPaginationModelChange({
24655
+ page,
24656
+ pageSize: paginationModel.pageSize
24657
+ }),
24658
+ rowsPerPage: paginationModel.pageSize,
24659
+ onRowsPerPageChange: event => onPaginationModelChange({
24660
+ page: paginationModel.page,
24661
+ pageSize: parseInt(event.target.value, 10)
24662
+ }),
24663
+ rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
24661
24664
  }, paginationProps)) : null);
24662
24665
  };
24663
24666
  const ServerSideControlledPagination = _ref4 => {
@@ -24665,12 +24668,10 @@ const ServerSideControlledPagination = _ref4 => {
24665
24668
  selectionStatus,
24666
24669
  displaySelection,
24667
24670
  displayPagination,
24668
- page,
24669
- onPageChange,
24670
- pageSize,
24671
- onPageSizeChange,
24671
+ paginationModel,
24672
+ onPaginationModelChange,
24673
+ pageSizeOptions,
24672
24674
  displayRowsPerPage,
24673
- rowsPerPageOptions,
24674
24675
  paginationProps,
24675
24676
  rowCount
24676
24677
  } = _ref4;
@@ -24689,13 +24690,17 @@ const ServerSideControlledPagination = _ref4 => {
24689
24690
  }, totalRowsLabel) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$2({
24690
24691
  component: "div",
24691
24692
  count: totalNumberOfRowsInTable,
24692
- page: page,
24693
- onPageChange: (event, newPage) => onPageChange(newPage),
24694
- rowsPerPage: pageSize,
24695
- onRowsPerPageChange: event => {
24696
- onPageSizeChange(parseInt(event.target.value, 10));
24697
- },
24698
- rowsPerPageOptions: displayRowsPerPage ? rowsPerPageOptions : []
24693
+ page: paginationModel.page,
24694
+ onPageChange: (event, page) => onPaginationModelChange({
24695
+ page,
24696
+ pageSize: paginationModel.pageSize
24697
+ }),
24698
+ rowsPerPage: paginationModel.pageSize,
24699
+ onRowsPerPageChange: event => onPaginationModelChange({
24700
+ page: paginationModel.page,
24701
+ pageSize: parseInt(event.target.value, 10)
24702
+ }),
24703
+ rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
24699
24704
  }, paginationProps)) : null);
24700
24705
  };
24701
24706
  const Toolbar = _ref5 => {
@@ -24710,11 +24715,9 @@ const Toolbar = _ref5 => {
24710
24715
  selectionStatus,
24711
24716
  apiRef,
24712
24717
  isRowSelectable,
24713
- page,
24714
- onPageChange,
24715
- pageSize,
24716
- onPageSizeChange,
24717
- rowsPerPageOptions,
24718
+ paginationModel,
24719
+ onPaginationModelChange,
24720
+ pageSizeOptions,
24718
24721
  paginationProps,
24719
24722
  paginationMode = 'client',
24720
24723
  rowCount
@@ -24728,11 +24731,9 @@ const Toolbar = _ref5 => {
24728
24731
  displayRowsPerPage: false,
24729
24732
  displayPagination: ['top', 'both'].includes(paginationPlacement),
24730
24733
  selectionStatus: selectionStatus.current,
24731
- page: page,
24732
- onPageChange: onPageChange,
24733
- pageSize: pageSize,
24734
- onPageSizeChange: onPageSizeChange,
24735
- rowsPerPageOptions: rowsPerPageOptions,
24734
+ paginationModel: paginationModel,
24735
+ onPaginationModelChange: onPaginationModelChange,
24736
+ pageSizeOptions: pageSizeOptions,
24736
24737
  paginationProps: paginationProps,
24737
24738
  rowCount: rowCount
24738
24739
  }) : /*#__PURE__*/React__default.createElement(ControlledPagination, {
@@ -24742,11 +24743,9 @@ const Toolbar = _ref5 => {
24742
24743
  selectionStatus: selectionStatus.current,
24743
24744
  apiRef: apiRef,
24744
24745
  isRowSelectable: isRowSelectable,
24745
- page: page,
24746
- onPageChange: onPageChange,
24747
- pageSize: pageSize,
24748
- onPageSizeChange: onPageSizeChange,
24749
- rowsPerPageOptions: rowsPerPageOptions,
24746
+ paginationModel: paginationModel,
24747
+ onPaginationModelChange: onPaginationModelChange,
24748
+ pageSizeOptions: pageSizeOptions,
24750
24749
  paginationProps: paginationProps
24751
24750
  }) : null);
24752
24751
  };
@@ -24806,14 +24805,14 @@ const onServerSideSelectionStatusChange = (newSelectionModel, apiRef, selectionS
24806
24805
  }
24807
24806
  };
24808
24807
  const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
24809
- var _initialState$paginat, _initialState$paginat2;
24808
+ var _ref8, _ref9, _initialState$paginat, _initialState$paginat2, _initialState$paginat3, _pageSizeOptions$, _ref10, _initialState$paginat4, _initialState$paginat5, _initialState$paginat6;
24810
24809
  const datagridRef = ref || useRef();
24811
24810
  const {
24812
24811
  apiRef: propsApiRef,
24813
24812
  autoHeight,
24814
24813
  className,
24815
- components,
24816
- componentsProps,
24814
+ slots,
24815
+ slotProps,
24817
24816
  filterModel: propsFilterModel,
24818
24817
  height: propsHeight,
24819
24818
  hideToolbar,
@@ -24821,17 +24820,15 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
24821
24820
  isRowSelectable,
24822
24821
  license = process.env.MUI_LICENSE_KEY,
24823
24822
  onFilterModelChange: propsOnFilterModelChange,
24824
- onPageChange: propsOnPageChange,
24825
- onPageSizeChange: propsOnPageSizeChange,
24826
- selectionModel: propsSelectionModel,
24827
- onSelectionModelChange,
24828
- page: propsPage,
24829
- pageSize: propsPageSize,
24823
+ rowSelectionModel: propsSelectionModel,
24824
+ paginationModel: propsPaginationModel,
24825
+ onPaginationModelChange: propsOnPaginationModelChange,
24826
+ onRowSelectionModelChange,
24830
24827
  pagination,
24831
24828
  paginationPlacement = 'both',
24832
24829
  paginationProps,
24833
24830
  rows,
24834
- rowsPerPageOptions,
24831
+ pageSizeOptions,
24835
24832
  sx,
24836
24833
  theme: propsTheme,
24837
24834
  paginationMode = 'client',
@@ -24841,7 +24838,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
24841
24838
  const theme = useTheme$4(propsTheme);
24842
24839
  const _apiRef = useGridApiRef();
24843
24840
  const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
24844
- const RenderedToolbar = components !== null && components !== void 0 && components.Toolbar ? components.Toolbar : Toolbar$3;
24841
+ const RenderedToolbar = slots !== null && slots !== void 0 && slots.toolbar ? slots.toolbar : Toolbar$3;
24845
24842
  LicenseInfo.setLicenseKey(license);
24846
24843
  const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
24847
24844
  const [filterModel, setFilterModel] = useState(propsFilterModel);
@@ -24855,52 +24852,41 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
24855
24852
  setFilterModel(model);
24856
24853
  }
24857
24854
  };
24858
- const [selectionModel, setSelectionModel] = useState(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
24855
+ const [rowSelectionModel, setRowSelectionModel] = useState(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
24859
24856
  useEffect(() => {
24860
- setSelectionModel(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
24857
+ setRowSelectionModel(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
24861
24858
  }, [propsSelectionModel]);
24862
- 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);
24863
- 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);
24864
- const selectionStatus = useRef({
24865
- type: 'none',
24866
- numberOfSelectedRows: 0,
24867
- numberOfSelectedRowsInPage: 0,
24868
- page,
24869
- pageSize
24859
+ const [paginationModel, setPaginationModel] = useState({
24860
+ 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,
24861
+ 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
24870
24862
  });
24871
- const onPageChange = page => {
24872
- if (propsOnPageChange) {
24873
- propsOnPageChange(page, undefined);
24874
- } else {
24875
- setPage(page);
24876
- }
24877
- };
24878
- useEffect(() => {
24879
- if (propsPage || propsPage === 0) {
24880
- setPage(propsPage);
24881
- }
24882
- }, [propsPage]);
24883
- const onPageSizeChange = pageSize => {
24884
- onPageChange(0);
24885
- if (propsOnPageSizeChange) {
24886
- propsOnPageSizeChange(pageSize, undefined);
24863
+ const onPaginationModelChange = model => {
24864
+ if (propsOnPaginationModelChange) {
24865
+ propsOnPaginationModelChange(model, undefined);
24887
24866
  } else {
24888
- setPageSize(pageSize);
24867
+ setPaginationModel(model);
24889
24868
  }
24890
24869
  };
24891
24870
  useEffect(() => {
24892
- if (propsPageSize) {
24893
- setPageSize(propsPageSize);
24871
+ if (propsPaginationModel) {
24872
+ setPaginationModel(propsPaginationModel);
24894
24873
  }
24895
- }, [propsPageSize]);
24874
+ }, [propsPaginationModel]);
24875
+ const selectionStatus = useRef({
24876
+ type: 'none',
24877
+ numberOfSelectedRows: 0,
24878
+ numberOfSelectedRowsInPage: 0,
24879
+ page: paginationModel.page,
24880
+ pageSize: paginationModel.pageSize
24881
+ });
24896
24882
 
24897
24883
  // in server-side pagination we want to update the selection status
24898
24884
  // every time we navigate between pages, resize our page or select something
24899
24885
  useEffect(() => {
24900
24886
  if (paginationMode == 'server') {
24901
- onServerSideSelectionStatusChange(Array.isArray(selectionModel) ? selectionModel : [selectionModel], apiRef, selectionStatus, isRowSelectable, page, pageSize);
24887
+ onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatus, isRowSelectable, paginationModel.page, paginationModel.pageSize);
24902
24888
  }
24903
- }, [selectionModel, page, pageSize]);
24889
+ }, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
24904
24890
  if (!Array.isArray(rows)) {
24905
24891
  return null;
24906
24892
  }
@@ -24931,56 +24917,54 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
24931
24917
  apiRef: apiRef,
24932
24918
  autoHeight: autoHeight,
24933
24919
  checkboxSelectionVisibleOnly: Boolean(pagination),
24934
- components: _objectSpread2(_objectSpread2({
24935
- BaseButton,
24936
- BaseCheckbox,
24937
- // BaseTextField,
24938
- BasePopper,
24939
- ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24920
+ slots: _objectSpread2(_objectSpread2({
24921
+ baseButton: BaseButton,
24922
+ baseCheckbox: BaseCheckbox,
24923
+ // baseTextField,
24924
+ basePopper: BasePopper,
24925
+ columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24940
24926
  displayName: "ColumnFilteredIcon"
24941
24927
  })),
24942
- ColumnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24928
+ columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24943
24929
  displayName: "ColumnSelectorIcon"
24944
24930
  })),
24945
- ColumnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24931
+ columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24946
24932
  displayName: "ColumnSortedAscendingIcon"
24947
24933
  })),
24948
- ColumnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24934
+ columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24949
24935
  displayName: "ColumnSortedDescendingIcon"
24950
24936
  })),
24951
- DensityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24937
+ densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24952
24938
  displayName: "DensityCompactIcon"
24953
24939
  })),
24954
- DensityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24940
+ densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24955
24941
  displayName: "DensityStandardIcon"
24956
24942
  })),
24957
- DensityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24943
+ densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24958
24944
  displayName: "DensityComfortableIcon"
24959
24945
  })),
24960
- DetailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24946
+ detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24961
24947
  displayName: "DetailPanelCollapseIcon"
24962
24948
  })),
24963
- DetailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24949
+ detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24964
24950
  displayName: "DetailPanelExpandIcon"
24965
24951
  })),
24966
- ExportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24952
+ exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24967
24953
  displayName: "ExportIcon"
24968
24954
  })),
24969
- OpenFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({
24955
+ openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({
24970
24956
  displayName: "OpenFilterButtonIcon"
24971
24957
  }, props))
24972
- }, components), {}, {
24973
- Toolbar: Toolbar,
24974
- Pagination: props => pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$2({}, props, {
24958
+ }, slots), {}, {
24959
+ toolbar: Toolbar,
24960
+ pagination: props => pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$2({}, props, {
24975
24961
  displaySelection: false,
24976
24962
  displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
24977
24963
  displayPagination: ['bottom', 'both'].includes(paginationPlacement),
24978
24964
  selectionStatus: selectionStatus.current,
24979
- page: page,
24980
- onPageChange: onPageChange,
24981
- pageSize: pageSize,
24982
- onPageSizeChange: onPageSizeChange,
24983
- rowsPerPageOptions: rowsPerPageOptions,
24965
+ paginationModel: paginationModel,
24966
+ onPaginationModelChange: onPaginationModelChange,
24967
+ pageSizeOptions: pageSizeOptions,
24984
24968
  paginationProps: paginationProps,
24985
24969
  paginationMode: paginationMode,
24986
24970
  rowCount: rowCount
@@ -24991,16 +24975,14 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
24991
24975
  selectionStatus: selectionStatus.current,
24992
24976
  apiRef: apiRef,
24993
24977
  isRowSelectable: isRowSelectable,
24994
- page: page,
24995
- onPageChange: onPageChange,
24996
- pageSize: pageSize,
24997
- onPageSizeChange: onPageSizeChange,
24998
- rowsPerPageOptions: rowsPerPageOptions,
24978
+ paginationModel: paginationModel,
24979
+ onPaginationModelChange: onPaginationModelChange,
24980
+ pageSizeOptions: pageSizeOptions,
24999
24981
  paginationProps: paginationProps,
25000
24982
  paginationMode: paginationMode
25001
24983
  })) : null
25002
24984
  }),
25003
- componentsProps: _objectSpread2(_objectSpread2({}, componentsProps), {}, {
24985
+ slotProps: _objectSpread2(_objectSpread2({}, slotProps), {}, {
25004
24986
  toolbar: _objectSpread2({
25005
24987
  hideToolbar,
25006
24988
  RenderedToolbar,
@@ -25012,15 +24994,13 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
25012
24994
  selectionStatus,
25013
24995
  apiRef,
25014
24996
  isRowSelectable,
25015
- page,
25016
- onPageChange,
25017
- pageSize,
25018
- onPageSizeChange,
25019
- rowsPerPageOptions,
24997
+ paginationModel,
24998
+ onPaginationModelChange,
24999
+ pageSizeOptions,
25020
25000
  paginationProps,
25021
25001
  paginationMode,
25022
25002
  rowCount
25023
- }, componentsProps === null || componentsProps === void 0 ? void 0 : componentsProps.toolbar)
25003
+ }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar)
25024
25004
  }),
25025
25005
  filterModel: filterModel,
25026
25006
  initialState: initialState,
@@ -25030,39 +25010,37 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
25030
25010
  paginationMode: paginationMode,
25031
25011
  keepNonExistentRowsSelected: paginationMode == 'server',
25032
25012
  rows: rows,
25033
- rowsPerPageOptions: rowsPerPageOptions,
25034
- page: page,
25035
- onPageChange: onPageChange,
25036
- pageSize: pageSize,
25037
- onPageSizeChange: onPageSizeChange,
25038
- selectionModel: selectionModel,
25039
- onSelectionModelChange: (newSelectionModel, details) => {
25013
+ pageSizeOptions: pageSizeOptions,
25014
+ paginationModel: paginationModel,
25015
+ onPaginationModelChange: onPaginationModelChange,
25016
+ rowSelectionModel: rowSelectionModel,
25017
+ onRowSelectionModelChange: (newSelectionModel, details) => {
25040
25018
  if (pagination && paginationMode != 'server') {
25041
- const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref8 => {
25019
+ const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref11 => {
25042
25020
  let {
25043
25021
  model
25044
- } = _ref8;
25022
+ } = _ref11;
25045
25023
  return isRowSelectable({
25046
25024
  row: model
25047
25025
  });
25048
- }).map(_ref9 => {
25026
+ }).map(_ref12 => {
25049
25027
  let {
25050
25028
  id
25051
- } = _ref9;
25029
+ } = _ref12;
25052
25030
  return id;
25053
25031
  }) : gridPaginatedVisibleSortedGridRowIdsSelector(apiRef);
25054
25032
  const numberOfSelectableRowsInPage = selectableRowsInPage.length;
25055
- const selectableRowsInTable = isRowSelectable ? gridFilteredSortedRowEntriesSelector(apiRef).filter(_ref10 => {
25033
+ const selectableRowsInTable = isRowSelectable ? gridFilteredSortedRowEntriesSelector(apiRef).filter(_ref13 => {
25056
25034
  let {
25057
25035
  model
25058
- } = _ref10;
25036
+ } = _ref13;
25059
25037
  return isRowSelectable({
25060
25038
  row: model
25061
25039
  });
25062
- }).map(_ref11 => {
25040
+ }).map(_ref14 => {
25063
25041
  let {
25064
25042
  id
25065
- } = _ref11;
25043
+ } = _ref14;
25066
25044
  return id;
25067
25045
  }) : gridFilteredSortedRowIdsSelector(apiRef);
25068
25046
  const numberOfSelectableRowsInTable = selectableRowsInTable.length;
@@ -25094,7 +25072,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
25094
25072
  };
25095
25073
  }
25096
25074
  }
25097
- onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(newSelectionModel, details);
25075
+ onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
25098
25076
  },
25099
25077
  sx: _objectSpread2(_objectSpread2({}, sx), {}, {
25100
25078
  '.MuiDataGrid-columnHeaders': {