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