@redsift/table 10.2.0-muiv5-alpha.6 → 10.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.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, 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',
@@ -21917,10 +21918,10 @@ const COMPONENT_NAME$2 = 'GridToolbarFilterSemanticField';
21917
21918
  const CLASSNAME$2 = 'redsift-datagrid-toolbar-nlp-filter-field';
21918
21919
  const DEFAULT_PROPS$1 = {
21919
21920
  dateFormat: 'yyyy-mm-dd',
21920
- defaultModel: 'gpt-4-0613',
21921
+ defaultModel: 'gpt-4-1106-preview',
21921
21922
  defaultFilter: {
21922
21923
  items: [],
21923
- linkOperator: 'and'
21924
+ logicOperator: 'and'
21924
21925
  },
21925
21926
  disablePower: false,
21926
21927
  localeText: {
@@ -21961,16 +21962,16 @@ const getRole = (config, dateFormat) => {
21961
21962
  }).join('\n');
21962
21963
  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.
21963
21964
  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.
21964
- The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "linkOperator" and "items":
21965
- - "linkOperator": the logical operator, only "and" or "or" are allowed. If there is only one condition in the "items", use "and".
21966
- - "items": a list of conditions, each is an object with exactly the three keys "columnField", "operatorValue" and "value":
21967
- - "columnField": the column name, must be one of ${columns}
21965
+ The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "logicOperator" and "items":
21966
+ - "logicOperator": the logical operator, only "and" or "or" are allowed. If there is only one condition in the "items", use "and".
21967
+ - "items": a list of conditions, each is an object with exactly the three keys "field", "operator" and "value":
21968
+ - "field": the column name, must be one of ${columns}
21968
21969
  - "value":
21969
- - this can be skipped if the "operatorValue" is either "isEmpty" or "isNotEmpty"
21970
- - a list of multiple values if the "operatorValue" ends with "AnyOf"
21970
+ - this can be skipped if the "operator" is either "isEmpty" or "isNotEmpty"
21971
+ - a list of multiple values if the "operator" ends with "AnyOf"
21971
21972
  - otherwise, it's a single value represented as a string: "true" instead of true, "false" instead of false, "0.6" instead of 0.6.
21972
21973
  For "date" data type, use ${dateFormat}. If relative date is input, convert to the actual date given today is ${today}.
21973
- - "operatorValue": the comparison operator, accepted values depend on the data type of the column
21974
+ - "operator": the comparison operator, accepted values depend on the data type of the column
21974
21975
  ${operators}
21975
21976
 
21976
21977
  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:
@@ -22077,7 +22078,7 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
22077
22078
  value: prompt
22078
22079
  }), /*#__PURE__*/React__default.createElement(Button, {
22079
22080
  variant: "primary",
22080
- "aira-label": buttonAriaLabel,
22081
+ "aria-label": buttonAriaLabel,
22081
22082
  type: "submit",
22082
22083
  isLoading: isLoading
22083
22084
  }, 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 DEFAULT_PROPS = {
@@ -24621,11 +24622,9 @@ const ControlledPagination = _ref3 => {
24621
24622
  displayPagination = false,
24622
24623
  selectionStatus,
24623
24624
  apiRef,
24624
- page,
24625
- onPageChange,
24626
- pageSize,
24627
- onPageSizeChange,
24628
- rowsPerPageOptions,
24625
+ paginationModel,
24626
+ onPaginationModelChange,
24627
+ pageSizeOptions,
24629
24628
  isRowSelectable,
24630
24629
  paginationProps
24631
24630
  } = _ref3;
@@ -24655,13 +24654,17 @@ const ControlledPagination = _ref3 => {
24655
24654
  }, `${selectionStatus.numberOfSelectedRows} row${selectionStatus.numberOfSelectedRows > 1 ? 's' : ''} selected`) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$2({
24656
24655
  component: "div",
24657
24656
  count: numberOfFilteredRowsInTable,
24658
- page: page,
24659
- onPageChange: (event, newPage) => onPageChange(newPage),
24660
- rowsPerPage: pageSize,
24661
- onRowsPerPageChange: event => {
24662
- onPageSizeChange(parseInt(event.target.value, 10));
24663
- },
24664
- rowsPerPageOptions: displayRowsPerPage ? rowsPerPageOptions : []
24657
+ page: paginationModel.page,
24658
+ onPageChange: (event, page) => onPaginationModelChange({
24659
+ page,
24660
+ pageSize: paginationModel.pageSize
24661
+ }),
24662
+ rowsPerPage: paginationModel.pageSize,
24663
+ onRowsPerPageChange: event => onPaginationModelChange({
24664
+ page: paginationModel.page,
24665
+ pageSize: parseInt(event.target.value, 10)
24666
+ }),
24667
+ rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
24665
24668
  }, paginationProps)) : null);
24666
24669
  };
24667
24670
  const ServerSideControlledPagination = _ref4 => {
@@ -24669,12 +24672,10 @@ const ServerSideControlledPagination = _ref4 => {
24669
24672
  selectionStatus,
24670
24673
  displaySelection,
24671
24674
  displayPagination,
24672
- page,
24673
- onPageChange,
24674
- pageSize,
24675
- onPageSizeChange,
24675
+ paginationModel,
24676
+ onPaginationModelChange,
24677
+ pageSizeOptions,
24676
24678
  displayRowsPerPage,
24677
- rowsPerPageOptions,
24678
24679
  paginationProps,
24679
24680
  rowCount
24680
24681
  } = _ref4;
@@ -24693,13 +24694,17 @@ const ServerSideControlledPagination = _ref4 => {
24693
24694
  }, totalRowsLabel) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$2({
24694
24695
  component: "div",
24695
24696
  count: totalNumberOfRowsInTable,
24696
- page: page,
24697
- onPageChange: (event, newPage) => onPageChange(newPage),
24698
- rowsPerPage: pageSize,
24699
- onRowsPerPageChange: event => {
24700
- onPageSizeChange(parseInt(event.target.value, 10));
24701
- },
24702
- rowsPerPageOptions: displayRowsPerPage ? rowsPerPageOptions : []
24697
+ page: paginationModel.page,
24698
+ onPageChange: (event, page) => onPaginationModelChange({
24699
+ page,
24700
+ pageSize: paginationModel.pageSize
24701
+ }),
24702
+ rowsPerPage: paginationModel.pageSize,
24703
+ onRowsPerPageChange: event => onPaginationModelChange({
24704
+ page: paginationModel.page,
24705
+ pageSize: parseInt(event.target.value, 10)
24706
+ }),
24707
+ rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
24703
24708
  }, paginationProps)) : null);
24704
24709
  };
24705
24710
  const Toolbar = _ref5 => {
@@ -24714,11 +24719,9 @@ const Toolbar = _ref5 => {
24714
24719
  selectionStatus,
24715
24720
  apiRef,
24716
24721
  isRowSelectable,
24717
- page,
24718
- onPageChange,
24719
- pageSize,
24720
- onPageSizeChange,
24721
- rowsPerPageOptions,
24722
+ paginationModel,
24723
+ onPaginationModelChange,
24724
+ pageSizeOptions,
24722
24725
  paginationProps,
24723
24726
  paginationMode = 'client',
24724
24727
  rowCount
@@ -24732,11 +24735,9 @@ const Toolbar = _ref5 => {
24732
24735
  displayRowsPerPage: false,
24733
24736
  displayPagination: ['top', 'both'].includes(paginationPlacement),
24734
24737
  selectionStatus: selectionStatus.current,
24735
- page: page,
24736
- onPageChange: onPageChange,
24737
- pageSize: pageSize,
24738
- onPageSizeChange: onPageSizeChange,
24739
- rowsPerPageOptions: rowsPerPageOptions,
24738
+ paginationModel: paginationModel,
24739
+ onPaginationModelChange: onPaginationModelChange,
24740
+ pageSizeOptions: pageSizeOptions,
24740
24741
  paginationProps: paginationProps,
24741
24742
  rowCount: rowCount
24742
24743
  }) : /*#__PURE__*/React__default.createElement(ControlledPagination, {
@@ -24746,11 +24747,9 @@ const Toolbar = _ref5 => {
24746
24747
  selectionStatus: selectionStatus.current,
24747
24748
  apiRef: apiRef,
24748
24749
  isRowSelectable: isRowSelectable,
24749
- page: page,
24750
- onPageChange: onPageChange,
24751
- pageSize: pageSize,
24752
- onPageSizeChange: onPageSizeChange,
24753
- rowsPerPageOptions: rowsPerPageOptions,
24750
+ paginationModel: paginationModel,
24751
+ onPaginationModelChange: onPaginationModelChange,
24752
+ pageSizeOptions: pageSizeOptions,
24754
24753
  paginationProps: paginationProps
24755
24754
  }) : null);
24756
24755
  };
@@ -24810,14 +24809,14 @@ const onServerSideSelectionStatusChange = (newSelectionModel, apiRef, selectionS
24810
24809
  }
24811
24810
  };
24812
24811
  const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
24813
- var _initialState$paginat, _initialState$paginat2;
24812
+ var _ref8, _ref9, _initialState$paginat, _initialState$paginat2, _initialState$paginat3, _pageSizeOptions$, _ref10, _initialState$paginat4, _initialState$paginat5, _initialState$paginat6;
24814
24813
  const datagridRef = ref || useRef();
24815
24814
  const {
24816
24815
  apiRef: propsApiRef,
24817
24816
  autoHeight,
24818
24817
  className,
24819
- components,
24820
- componentsProps,
24818
+ slots,
24819
+ slotProps,
24821
24820
  filterModel: propsFilterModel,
24822
24821
  height: propsHeight,
24823
24822
  hideToolbar,
@@ -24825,17 +24824,15 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
24825
24824
  isRowSelectable,
24826
24825
  license,
24827
24826
  onFilterModelChange: propsOnFilterModelChange,
24828
- onPageChange: propsOnPageChange,
24829
- onPageSizeChange: propsOnPageSizeChange,
24830
- selectionModel: propsSelectionModel,
24831
- onSelectionModelChange,
24832
- page: propsPage,
24833
- pageSize: propsPageSize,
24827
+ rowSelectionModel: propsSelectionModel,
24828
+ paginationModel: propsPaginationModel,
24829
+ onPaginationModelChange: propsOnPaginationModelChange,
24830
+ onRowSelectionModelChange,
24834
24831
  pagination,
24835
24832
  paginationPlacement,
24836
24833
  paginationProps,
24837
24834
  rows,
24838
- rowsPerPageOptions,
24835
+ pageSizeOptions,
24839
24836
  sx,
24840
24837
  theme: propsTheme,
24841
24838
  paginationMode = 'client',
@@ -24845,7 +24842,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
24845
24842
  const theme = useTheme$4(propsTheme);
24846
24843
  const _apiRef = useGridApiRef();
24847
24844
  const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
24848
- const RenderedToolbar = components !== null && components !== void 0 && components.Toolbar ? components.Toolbar : Toolbar$3;
24845
+ const RenderedToolbar = slots !== null && slots !== void 0 && slots.toolbar ? slots.toolbar : Toolbar$3;
24849
24846
  LicenseInfo.setLicenseKey(license);
24850
24847
  const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
24851
24848
  const [filterModel, setFilterModel] = useState(propsFilterModel);
@@ -24859,52 +24856,41 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
24859
24856
  setFilterModel(model);
24860
24857
  }
24861
24858
  };
24862
- const [selectionModel, setSelectionModel] = useState(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
24859
+ const [rowSelectionModel, setRowSelectionModel] = useState(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
24863
24860
  useEffect(() => {
24864
- setSelectionModel(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
24861
+ setRowSelectionModel(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
24865
24862
  }, [propsSelectionModel]);
24866
- 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);
24867
- 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);
24868
- const selectionStatus = useRef({
24869
- type: 'none',
24870
- numberOfSelectedRows: 0,
24871
- numberOfSelectedRowsInPage: 0,
24872
- page,
24873
- pageSize
24863
+ const [paginationModel, setPaginationModel] = useState({
24864
+ 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,
24865
+ 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
24874
24866
  });
24875
- const onPageChange = page => {
24876
- if (propsOnPageChange) {
24877
- propsOnPageChange(page, undefined);
24878
- } else {
24879
- setPage(page);
24880
- }
24881
- };
24882
- useEffect(() => {
24883
- if (propsPage || propsPage === 0) {
24884
- setPage(propsPage);
24885
- }
24886
- }, [propsPage]);
24887
- const onPageSizeChange = pageSize => {
24888
- onPageChange(0);
24889
- if (propsOnPageSizeChange) {
24890
- propsOnPageSizeChange(pageSize, undefined);
24867
+ const onPaginationModelChange = model => {
24868
+ if (propsOnPaginationModelChange) {
24869
+ propsOnPaginationModelChange(model, undefined);
24891
24870
  } else {
24892
- setPageSize(pageSize);
24871
+ setPaginationModel(model);
24893
24872
  }
24894
24873
  };
24895
24874
  useEffect(() => {
24896
- if (propsPageSize) {
24897
- setPageSize(propsPageSize);
24875
+ if (propsPaginationModel) {
24876
+ setPaginationModel(propsPaginationModel);
24898
24877
  }
24899
- }, [propsPageSize]);
24878
+ }, [propsPaginationModel]);
24879
+ const selectionStatus = useRef({
24880
+ type: 'none',
24881
+ numberOfSelectedRows: 0,
24882
+ numberOfSelectedRowsInPage: 0,
24883
+ page: paginationModel.page,
24884
+ pageSize: paginationModel.pageSize
24885
+ });
24900
24886
 
24901
24887
  // in server-side pagination we want to update the selection status
24902
24888
  // every time we navigate between pages, resize our page or select something
24903
24889
  useEffect(() => {
24904
24890
  if (paginationMode == 'server') {
24905
- onServerSideSelectionStatusChange(Array.isArray(selectionModel) ? selectionModel : [selectionModel], apiRef, selectionStatus, isRowSelectable, page, pageSize);
24891
+ onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatus, isRowSelectable, paginationModel.page, paginationModel.pageSize);
24906
24892
  }
24907
- }, [selectionModel, page, pageSize]);
24893
+ }, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
24908
24894
  if (!Array.isArray(rows)) {
24909
24895
  return null;
24910
24896
  }
@@ -24934,56 +24920,54 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
24934
24920
  apiRef: apiRef,
24935
24921
  autoHeight: autoHeight,
24936
24922
  checkboxSelectionVisibleOnly: Boolean(pagination),
24937
- components: _objectSpread2(_objectSpread2({
24938
- BaseButton,
24939
- BaseCheckbox,
24940
- // BaseTextField,
24941
- BasePopper,
24942
- ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24923
+ slots: _objectSpread2(_objectSpread2({
24924
+ baseButton: BaseButton,
24925
+ baseCheckbox: BaseCheckbox,
24926
+ // baseTextField,
24927
+ basePopper: BasePopper,
24928
+ columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24943
24929
  displayName: "ColumnFilteredIcon"
24944
24930
  })),
24945
- ColumnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24931
+ columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24946
24932
  displayName: "ColumnSelectorIcon"
24947
24933
  })),
24948
- ColumnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24934
+ columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24949
24935
  displayName: "ColumnSortedAscendingIcon"
24950
24936
  })),
24951
- ColumnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24937
+ columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24952
24938
  displayName: "ColumnSortedDescendingIcon"
24953
24939
  })),
24954
- DensityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24940
+ densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24955
24941
  displayName: "DensityCompactIcon"
24956
24942
  })),
24957
- DensityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24943
+ densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24958
24944
  displayName: "DensityStandardIcon"
24959
24945
  })),
24960
- DensityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24946
+ densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24961
24947
  displayName: "DensityComfortableIcon"
24962
24948
  })),
24963
- DetailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24949
+ detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24964
24950
  displayName: "DetailPanelCollapseIcon"
24965
24951
  })),
24966
- DetailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24952
+ detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24967
24953
  displayName: "DetailPanelExpandIcon"
24968
24954
  })),
24969
- ExportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24955
+ exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24970
24956
  displayName: "ExportIcon"
24971
24957
  })),
24972
- OpenFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({
24958
+ openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({
24973
24959
  displayName: "OpenFilterButtonIcon"
24974
24960
  }, props))
24975
- }, components), {}, {
24976
- Toolbar: Toolbar,
24977
- Pagination: props => pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$2({}, props, {
24961
+ }, slots), {}, {
24962
+ toolbar: Toolbar,
24963
+ pagination: props => pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$2({}, props, {
24978
24964
  displaySelection: false,
24979
24965
  displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
24980
24966
  displayPagination: ['bottom', 'both'].includes(paginationPlacement),
24981
24967
  selectionStatus: selectionStatus.current,
24982
- page: page,
24983
- onPageChange: onPageChange,
24984
- pageSize: pageSize,
24985
- onPageSizeChange: onPageSizeChange,
24986
- rowsPerPageOptions: rowsPerPageOptions,
24968
+ paginationModel: paginationModel,
24969
+ onPaginationModelChange: onPaginationModelChange,
24970
+ pageSizeOptions: pageSizeOptions,
24987
24971
  paginationProps: paginationProps,
24988
24972
  paginationMode: paginationMode,
24989
24973
  rowCount: rowCount
@@ -24994,17 +24978,15 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
24994
24978
  selectionStatus: selectionStatus.current,
24995
24979
  apiRef: apiRef,
24996
24980
  isRowSelectable: isRowSelectable,
24997
- page: page,
24998
- onPageChange: onPageChange,
24999
- pageSize: pageSize,
25000
- onPageSizeChange: onPageSizeChange,
25001
- rowsPerPageOptions: rowsPerPageOptions,
24981
+ paginationModel: paginationModel,
24982
+ onPaginationModelChange: onPaginationModelChange,
24983
+ pageSizeOptions: pageSizeOptions,
25002
24984
  paginationProps: paginationProps,
25003
24985
  paginationMode: paginationMode,
25004
24986
  rowCount: rowCount
25005
24987
  })) : null
25006
24988
  }),
25007
- componentsProps: _objectSpread2(_objectSpread2({}, componentsProps), {}, {
24989
+ slotProps: _objectSpread2(_objectSpread2({}, slotProps), {}, {
25008
24990
  toolbar: _objectSpread2({
25009
24991
  hideToolbar,
25010
24992
  RenderedToolbar,
@@ -25016,15 +24998,13 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
25016
24998
  selectionStatus,
25017
24999
  apiRef,
25018
25000
  isRowSelectable,
25019
- page,
25020
- onPageChange,
25021
- pageSize,
25022
- onPageSizeChange,
25023
- rowsPerPageOptions,
25001
+ paginationModel,
25002
+ onPaginationModelChange,
25003
+ pageSizeOptions,
25024
25004
  paginationProps,
25025
25005
  paginationMode,
25026
25006
  rowCount
25027
- }, componentsProps === null || componentsProps === void 0 ? void 0 : componentsProps.toolbar)
25007
+ }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar)
25028
25008
  }),
25029
25009
  filterModel: filterModel,
25030
25010
  initialState: initialState,
@@ -25034,39 +25014,37 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
25034
25014
  paginationMode: paginationMode,
25035
25015
  keepNonExistentRowsSelected: paginationMode == 'server',
25036
25016
  rows: rows,
25037
- rowsPerPageOptions: rowsPerPageOptions,
25038
- page: page,
25039
- onPageChange: onPageChange,
25040
- pageSize: pageSize,
25041
- onPageSizeChange: onPageSizeChange,
25042
- selectionModel: selectionModel,
25043
- onSelectionModelChange: (newSelectionModel, details) => {
25017
+ pageSizeOptions: pageSizeOptions,
25018
+ paginationModel: paginationModel,
25019
+ onPaginationModelChange: onPaginationModelChange,
25020
+ rowSelectionModel: rowSelectionModel,
25021
+ onRowSelectionModelChange: (newSelectionModel, details) => {
25044
25022
  if (pagination && paginationMode != 'server') {
25045
- const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref8 => {
25023
+ const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref11 => {
25046
25024
  let {
25047
25025
  model
25048
- } = _ref8;
25026
+ } = _ref11;
25049
25027
  return isRowSelectable({
25050
25028
  row: model
25051
25029
  });
25052
- }).map(_ref9 => {
25030
+ }).map(_ref12 => {
25053
25031
  let {
25054
25032
  id
25055
- } = _ref9;
25033
+ } = _ref12;
25056
25034
  return id;
25057
25035
  }) : gridPaginatedVisibleSortedGridRowIdsSelector(apiRef);
25058
25036
  const numberOfSelectableRowsInPage = selectableRowsInPage.length;
25059
- const selectableRowsInTable = isRowSelectable ? gridFilteredSortedRowEntriesSelector(apiRef).filter(_ref10 => {
25037
+ const selectableRowsInTable = isRowSelectable ? gridFilteredSortedRowEntriesSelector(apiRef).filter(_ref13 => {
25060
25038
  let {
25061
25039
  model
25062
- } = _ref10;
25040
+ } = _ref13;
25063
25041
  return isRowSelectable({
25064
25042
  row: model
25065
25043
  });
25066
- }).map(_ref11 => {
25044
+ }).map(_ref14 => {
25067
25045
  let {
25068
25046
  id
25069
- } = _ref11;
25047
+ } = _ref14;
25070
25048
  return id;
25071
25049
  }) : gridFilteredSortedRowIdsSelector(apiRef);
25072
25050
  const numberOfSelectableRowsInTable = selectableRowsInTable.length;
@@ -25098,7 +25076,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
25098
25076
  };
25099
25077
  }
25100
25078
  }
25101
- onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(newSelectionModel, details);
25079
+ onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
25102
25080
  },
25103
25081
  sx: _objectSpread2(_objectSpread2({}, sx), {}, {
25104
25082
  '.MuiDataGrid-columnHeaders': {