@redsift/table 10.3.0-alpha.5 → 10.3.0-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,9 +1,9 @@
1
- import { GRID_DETAIL_PANEL_TOGGLE_COL_DEF, getGridNumericOperators as getGridNumericOperators$1, GridFilterInputMultipleValue, getGridStringOperators as getGridStringOperators$1, GridToolbarContainer, GridToolbarFilterButton, GridToolbarColumnsButton, GridToolbarDensitySelector, GridToolbarExport, gridExpandedSortedRowIdsSelector, gridPaginatedVisibleSortedGridRowEntriesSelector, gridPaginatedVisibleSortedGridRowIdsSelector, gridFilteredSortedRowEntriesSelector, gridFilteredSortedRowIdsSelector, useGridApiRef, DataGridPro } 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
2
  export * from '@mui/x-data-grid-pro';
3
3
  export { getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators } from '@mui/x-data-grid-pro';
4
4
  import * as React from 'react';
5
5
  import React__default, { Children, isValidElement, cloneElement, useLayoutEffect, useEffect, useRef, forwardRef, useContext, useState, useCallback, createElement, useMemo } from 'react';
6
- import { Icon, baseContainer, Theme, AppContainerContext, useTheme as useTheme$4, useId as useId$2, partitionComponents, isComponent, Flexbox, TextField as TextField$2, Button, Switch, Text, ButtonsColorPalette, IconButton as IconButton$2, Checkbox, LinkButton, ThemeProvider as ThemeProvider$4, RedsiftColorBlueN, RedsiftColorNeutralXDarkGrey, RedsiftColorNeutralWhite, Shield } from '@redsift/design-system';
6
+ import { Icon, baseContainer, Theme, AppContainerContext, useTheme as useTheme$4, useId as useId$2, partitionComponents, isComponent, Flexbox, TextField as TextField$2, Button, Switch, Text, ButtonsColorPalette, IconButton as IconButton$2, Checkbox, ThemeProvider as ThemeProvider$4, LinkButton, RedsiftColorBlueN, RedsiftColorNeutralXDarkGrey, RedsiftColorNeutralWhite, Shield } from '@redsift/design-system';
7
7
  import { mdiSync, mdiFilterVariant, mdiViewColumn, mdiChevronUp, mdiChevronDown, mdiViewHeadline, mdiViewSequential, mdiViewStream, mdiChevronRight, mdiTrayArrowDown } from '@redsift/icons';
8
8
  import emStyled from '@emotion/styled';
9
9
  import { Global, ThemeContext as ThemeContext$3, keyframes } from '@emotion/react';
@@ -17871,6 +17871,76 @@ class LicenseInfo {
17871
17871
  }
17872
17872
  }
17873
17873
 
17874
+ /**
17875
+ * Component style.
17876
+ */
17877
+ const StyledDataGrid = styled$3.div`
17878
+ ${_ref => {
17879
+ let {
17880
+ $height
17881
+ } = _ref;
17882
+ return $height ? css`
17883
+ height: ${$height};
17884
+ ` : '';
17885
+ }}
17886
+
17887
+ width: 100%;
17888
+
17889
+ .MuiDataGrid-root {
17890
+ font-family: var(--redsift-typography-datagrid-header-font-family);
17891
+ border: none;
17892
+ }
17893
+
17894
+ .MuiDataGrid-row {
17895
+ font-family: var(--redsift-typography-datagrid-cell-font-family);
17896
+ font-size: var(--redsift-typography-datagrid-cell-font-size);
17897
+ font-weight: var(--redsift-typography-datagrid-cell-font-weight);
17898
+ }
17899
+
17900
+ .MuiDataGrid-columnHeaderTitle {
17901
+ font-family: var(--redsift-typography-datagrid-header-font-family);
17902
+ font-size: var(--redsift-typography-datagrid-header-font-size);
17903
+ font-weight: var(--redsift-typography-datagrid-header-font-weight);
17904
+ }
17905
+
17906
+ .MuiDataGrid-columnHeaders {
17907
+ border-bottom-color: var(--redsift-color-primary-n);
17908
+ }
17909
+
17910
+ .MuiDataGrid-columnSeparator {
17911
+ display: none;
17912
+ }
17913
+
17914
+ .MuiTablePagination-root {
17915
+ .MuiTablePagination-selectLabel {
17916
+ font-family: var(--redsift-typography-datagrid-header-font-family);
17917
+ }
17918
+ .MuiTablePagination-displayedRows {
17919
+ font-family: var(--redsift-typography-datagrid-cell-font-family);
17920
+ }
17921
+
17922
+ .MuiInputBase-root {
17923
+ font-family: var(--redsift-typography-datagrid-cell-font-family);
17924
+ }
17925
+ }
17926
+
17927
+ .Mui-checked {
17928
+ color: var(--redsift-color-primary-n);
17929
+ }
17930
+
17931
+ .MuiDataGrid-rowCount {
17932
+ font-family: var(--redsift-typography-datagrid-cell-font-family);
17933
+ }
17934
+
17935
+ .MuiTablePagination-displayedRows {
17936
+ font-family: var(--redsift-typography-datagrid-cell-font-family);
17937
+ }
17938
+
17939
+ .MuiBadge-standard {
17940
+ font-family: var(--redsift-typography-datagrid-cell-font-family);
17941
+ }
17942
+ `;
17943
+
17874
17944
  /**
17875
17945
  * Component style.
17876
17946
  */
@@ -21452,34 +21522,6 @@ const useInteractions = function (propsList) {
21452
21522
  }), [getReferenceProps, getFloatingProps, getItemProps]);
21453
21523
  };
21454
21524
 
21455
- const TooltipContext = /*#__PURE__*/React__default.createContext(null);
21456
-
21457
- /**
21458
- * Context props.
21459
- */
21460
-
21461
- /**
21462
- * Component variant.
21463
- */
21464
- const TooltipPlacement = {
21465
- top: 'top',
21466
- right: 'right',
21467
- bottom: 'bottom',
21468
- left: 'left',
21469
- 'top-start': 'top-start',
21470
- 'top-end': 'top-end',
21471
- 'right-start': 'right-start',
21472
- 'right-end': 'right-end',
21473
- 'bottom-start': 'bottom-start',
21474
- 'bottom-end': 'bottom-end',
21475
- 'left-start': 'left-start',
21476
- 'left-end': 'left-end'
21477
- };
21478
-
21479
- /**
21480
- * Component props.
21481
- */
21482
-
21483
21525
  /**
21484
21526
  * Component style.
21485
21527
  */
@@ -21603,7 +21645,6 @@ const StyledTooltipContent = styled$3.div`
21603
21645
 
21604
21646
  const COMPONENT_NAME$5 = 'TooltipContent';
21605
21647
  const CLASSNAME$5 = 'redsift-tooltip-content';
21606
- const DEFAULT_PROPS$4 = {};
21607
21648
 
21608
21649
  /**
21609
21650
  * The TooltipContent component.
@@ -21669,12 +21710,10 @@ const TooltipContent = /*#__PURE__*/forwardRef((props, ref) => {
21669
21710
  }, children)));
21670
21711
  });
21671
21712
  TooltipContent.className = CLASSNAME$5;
21672
- TooltipContent.defaultProps = DEFAULT_PROPS$4;
21673
21713
  TooltipContent.displayName = COMPONENT_NAME$5;
21674
21714
 
21675
21715
  const COMPONENT_NAME$4 = 'TooltipTrigger';
21676
21716
  const CLASSNAME$4 = 'redsift-tooltip-trigger';
21677
- const DEFAULT_PROPS$3 = {};
21678
21717
 
21679
21718
  /**
21680
21719
  * The TooltipTrigger component.
@@ -21710,9 +21749,36 @@ const TooltipTrigger = /*#__PURE__*/forwardRef((props, ref) => {
21710
21749
  }, getReferenceProps(props)), children);
21711
21750
  });
21712
21751
  TooltipTrigger.className = CLASSNAME$4;
21713
- TooltipTrigger.defaultProps = DEFAULT_PROPS$3;
21714
21752
  TooltipTrigger.displayName = COMPONENT_NAME$4;
21715
21753
 
21754
+ const TooltipContext = /*#__PURE__*/React__default.createContext(null);
21755
+
21756
+ /**
21757
+ * Context props.
21758
+ */
21759
+
21760
+ /**
21761
+ * Component variant.
21762
+ */
21763
+ const TooltipPlacement = {
21764
+ top: 'top',
21765
+ right: 'right',
21766
+ bottom: 'bottom',
21767
+ left: 'left',
21768
+ 'top-start': 'top-start',
21769
+ 'top-end': 'top-end',
21770
+ 'right-start': 'right-start',
21771
+ 'right-end': 'right-end',
21772
+ 'bottom-start': 'bottom-start',
21773
+ 'bottom-end': 'bottom-end',
21774
+ 'left-start': 'left-start',
21775
+ 'left-end': 'left-end'
21776
+ };
21777
+
21778
+ /**
21779
+ * Component props.
21780
+ */
21781
+
21716
21782
  function useTooltip(_ref) {
21717
21783
  let {
21718
21784
  color,
@@ -21783,25 +21849,21 @@ const ThemeProvider = ThemeContext.Provider;
21783
21849
 
21784
21850
  const COMPONENT_NAME$3 = 'Tooltip';
21785
21851
  const CLASSNAME$3 = 'redsift-tooltip';
21786
- const DEFAULT_PROPS$2 = {
21787
- delay: 500,
21788
- placement: TooltipPlacement.top
21789
- };
21790
21852
 
21791
21853
  /**
21792
21854
  * The Tooltip component.
21793
21855
  */
21794
21856
  const BaseTooltip = props => {
21795
21857
  const {
21796
- color,
21797
21858
  children,
21859
+ color,
21798
21860
  defaultOpen,
21799
- delay,
21861
+ delay = 500,
21800
21862
  isOpen,
21801
21863
  onOpen,
21802
- placement,
21803
- tooltipId,
21864
+ placement = TooltipPlacement.top,
21804
21865
  theme: propsTheme,
21866
+ tooltipId,
21805
21867
  triggerClassName
21806
21868
  } = props;
21807
21869
  const theme = useTheme$4 ? useTheme$4(propsTheme) : undefined;
@@ -21826,7 +21888,6 @@ const BaseTooltip = props => {
21826
21888
  }, trigger && isComponent('TooltipTrigger')(trigger) ? trigger : null, content && isComponent('TooltipContent')(content) ? content : null));
21827
21889
  };
21828
21890
  BaseTooltip.className = CLASSNAME$3;
21829
- BaseTooltip.defaultProps = DEFAULT_PROPS$2;
21830
21891
  BaseTooltip.displayName = COMPONENT_NAME$3;
21831
21892
  const Tooltip = Object.assign(BaseTooltip, {
21832
21893
  Trigger: TooltipTrigger,
@@ -21860,24 +21921,6 @@ const StyledGridToolbarFilterSemanticField = styled$3.form`
21860
21921
  const _excluded$e = ["className", "nlpFilterConfig", "onFilterModelChange", "dateFormat", "defaultModel", "defaultFilter", "disablePower", "localeText"];
21861
21922
  const COMPONENT_NAME$2 = 'GridToolbarFilterSemanticField';
21862
21923
  const CLASSNAME$2 = 'redsift-datagrid-toolbar-nlp-filter-field';
21863
- const DEFAULT_PROPS$1 = {
21864
- dateFormat: 'yyyy-mm-dd',
21865
- defaultModel: 'gpt-4-1106-preview',
21866
- defaultFilter: {
21867
- items: [],
21868
- logicOperator: 'and'
21869
- },
21870
- disablePower: false,
21871
- localeText: {
21872
- textLabel: 'Semantic filtering',
21873
- textPlaceholder: 'Describe here how you would like to filter this datagrid.',
21874
- buttonAriaLabel: 'Submit',
21875
- buttonText: 'Run',
21876
- powerText: 'Power mode',
21877
- powerTooltipContent: 'The Power mode can get better results but is slower.',
21878
- errorText: 'Unable to find a valid filter, please try again with a more specific prompt.'
21879
- }
21880
- };
21881
21924
  const DEFAULT_OPERATORS = {
21882
21925
  string: ['contains', 'equals', 'startsWith', 'endsWith', 'isEmpty', 'isNotEmpty', 'isAnyOf'],
21883
21926
  number: ['=', '!=', '>', '>=', '<', '<=', 'isEmpty', 'isNotEmpty', 'isAnyOf'],
@@ -21951,10 +21994,13 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
21951
21994
  className,
21952
21995
  nlpFilterConfig,
21953
21996
  onFilterModelChange,
21954
- dateFormat = DEFAULT_PROPS$1.dateFormat,
21955
- defaultModel = DEFAULT_PROPS$1.defaultModel,
21956
- defaultFilter = DEFAULT_PROPS$1.defaultFilter,
21957
- disablePower = DEFAULT_PROPS$1.disablePower,
21997
+ dateFormat = 'yyyy-mm-dd',
21998
+ defaultModel = 'gpt-4-1106-preview',
21999
+ defaultFilter = {
22000
+ items: [],
22001
+ logicOperator: 'and'
22002
+ },
22003
+ disablePower = false,
21958
22004
  localeText
21959
22005
  } = props,
21960
22006
  forwardedProps = _objectWithoutProperties(props, _excluded$e);
@@ -21966,7 +22012,15 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
21966
22012
  powerText,
21967
22013
  powerTooltipContent,
21968
22014
  errorText
21969
- } = _objectSpread2(_objectSpread2({}, DEFAULT_PROPS$1.localeText), localeText);
22015
+ } = _objectSpread2({
22016
+ textLabel: 'Semantic filtering',
22017
+ textPlaceholder: 'Describe here how you would like to filter this datagrid.',
22018
+ buttonAriaLabel: 'Submit',
22019
+ buttonText: 'Run',
22020
+ powerText: 'Power mode',
22021
+ powerTooltipContent: 'The Power mode can get better results but is slower.',
22022
+ errorText: 'Unable to find a valid filter, please try again with a more specific prompt.'
22023
+ }, localeText);
21970
22024
  const [prompt, setPrompt] = useState('');
21971
22025
  const modelRef = useRef(defaultModel);
21972
22026
  const showErrorRef = useRef(false);
@@ -22035,7 +22089,6 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
22035
22089
  }, errorText));
22036
22090
  });
22037
22091
  GridToolbarFilterSemanticField.className = CLASSNAME$2;
22038
- GridToolbarFilterSemanticField.defaultProps = DEFAULT_PROPS$1;
22039
22092
  GridToolbarFilterSemanticField.displayName = COMPONENT_NAME$2;
22040
22093
 
22041
22094
  /**
@@ -22098,7 +22151,33 @@ const Toolbar$3 = props => {
22098
22151
  }, semanticFilterProps ? /*#__PURE__*/React__default.createElement(GridToolbarFilterSemanticField, semanticFilterProps) : null)));
22099
22152
  };
22100
22153
 
22101
- const _excluded$d = ["children", "color", "onClick", "startIcon"];
22154
+ const _excluded$d = ["displayName"];
22155
+ const muiIconToDSIcon = {
22156
+ ColumnFilteredIcon: mdiFilterVariant,
22157
+ ColumnSelectorIcon: mdiViewColumn,
22158
+ ColumnSortedAscendingIcon: mdiChevronUp,
22159
+ ColumnSortedDescendingIcon: mdiChevronDown,
22160
+ DensityCompactIcon: mdiViewHeadline,
22161
+ DensityStandardIcon: mdiViewSequential,
22162
+ DensityComfortableIcon: mdiViewStream,
22163
+ DetailPanelCollapseIcon: mdiChevronDown,
22164
+ DetailPanelExpandIcon: mdiChevronRight,
22165
+ ExportIcon: mdiTrayArrowDown,
22166
+ OpenFilterButtonIcon: mdiFilterVariant
22167
+ };
22168
+ const BaseIcon = /*#__PURE__*/forwardRef((props, ref) => {
22169
+ const {
22170
+ displayName
22171
+ } = props,
22172
+ forwardedProps = _objectWithoutProperties(props, _excluded$d);
22173
+ return /*#__PURE__*/React__default.createElement(Icon, _extends$2({}, forwardedProps, forwardedProps.inputProps, {
22174
+ ref: ref,
22175
+ size: forwardedProps.fontSize,
22176
+ icon: muiIconToDSIcon[displayName]
22177
+ }));
22178
+ });
22179
+
22180
+ const _excluded$c = ["children", "color", "onClick", "startIcon"];
22102
22181
  const BaseButton = /*#__PURE__*/forwardRef((props, ref) => {
22103
22182
  var _props$className;
22104
22183
  const {
@@ -22107,7 +22186,7 @@ const BaseButton = /*#__PURE__*/forwardRef((props, ref) => {
22107
22186
  onClick,
22108
22187
  startIcon
22109
22188
  } = props,
22110
- forwardedProps = _objectWithoutProperties(props, _excluded$d);
22189
+ forwardedProps = _objectWithoutProperties(props, _excluded$c);
22111
22190
  const color = Object.keys(ButtonsColorPalette).includes(propsColor) ? propsColor : 'primary';
22112
22191
  if ((_props$className = props.className) !== null && _props$className !== void 0 && _props$className.includes('redsift-condensed')) {
22113
22192
  return /*#__PURE__*/React__default.createElement(IconButton$2, _extends$2({}, forwardedProps, {
@@ -22133,7 +22212,7 @@ const BaseButton = /*#__PURE__*/forwardRef((props, ref) => {
22133
22212
  }), children);
22134
22213
  });
22135
22214
 
22136
- const _excluded$c = ["checked", "indeterminate", "disabled", "onChange"];
22215
+ const _excluded$b = ["checked", "indeterminate", "disabled", "onChange"];
22137
22216
  const BaseCheckbox = /*#__PURE__*/forwardRef((props, ref) => {
22138
22217
  const {
22139
22218
  checked,
@@ -22141,7 +22220,7 @@ const BaseCheckbox = /*#__PURE__*/forwardRef((props, ref) => {
22141
22220
  disabled,
22142
22221
  onChange
22143
22222
  } = props,
22144
- forwardedProps = _objectWithoutProperties(props, _excluded$c);
22223
+ forwardedProps = _objectWithoutProperties(props, _excluded$b);
22145
22224
  return /*#__PURE__*/React__default.createElement(Checkbox, _extends$2({}, forwardedProps, forwardedProps.inputProps, {
22146
22225
  isSelected: checked && !indeterminate,
22147
22226
  isDisabled: disabled,
@@ -22151,32 +22230,6 @@ const BaseCheckbox = /*#__PURE__*/forwardRef((props, ref) => {
22151
22230
  }));
22152
22231
  });
22153
22232
 
22154
- const _excluded$b = ["displayName"];
22155
- const muiIconToDSIcon = {
22156
- ColumnFilteredIcon: mdiFilterVariant,
22157
- ColumnSelectorIcon: mdiViewColumn,
22158
- ColumnSortedAscendingIcon: mdiChevronUp,
22159
- ColumnSortedDescendingIcon: mdiChevronDown,
22160
- DensityCompactIcon: mdiViewHeadline,
22161
- DensityStandardIcon: mdiViewSequential,
22162
- DensityComfortableIcon: mdiViewStream,
22163
- DetailPanelCollapseIcon: mdiChevronDown,
22164
- DetailPanelExpandIcon: mdiChevronRight,
22165
- ExportIcon: mdiTrayArrowDown,
22166
- OpenFilterButtonIcon: mdiFilterVariant
22167
- };
22168
- const BaseIcon = /*#__PURE__*/forwardRef((props, ref) => {
22169
- const {
22170
- displayName
22171
- } = props,
22172
- forwardedProps = _objectWithoutProperties(props, _excluded$b);
22173
- return /*#__PURE__*/React__default.createElement(Icon, _extends$2({}, forwardedProps, forwardedProps.inputProps, {
22174
- ref: ref,
22175
- size: forwardedProps.fontSize,
22176
- icon: muiIconToDSIcon[displayName]
22177
- }));
22178
- });
22179
-
22180
22233
  const _excluded$a = ["anchorEl", "component", "components", "componentsProps", "container", "disablePortal", "keepMounted", "modifiers", "open", "placement", "popperOptions", "popperRef", "transition", "slots", "slotProps"];
22181
22234
  const PopperRoot = styled$1(BasePopper$1, {
22182
22235
  name: 'MuiPopper',
@@ -22378,86 +22431,6 @@ const BasePopper = /*#__PURE__*/forwardRef((props, ref) => {
22378
22431
  }));
22379
22432
  });
22380
22433
 
22381
- const defaultSxStyle = {
22382
- '.MuiDataGrid-columnHeaders': {
22383
- flexDirection: 'column',
22384
- alignItems: 'normal'
22385
- },
22386
- '.MuiDataGrid-selectedRowCount': {
22387
- margin: 'none'
22388
- }
22389
- };
22390
-
22391
- /**
22392
- * Component style.
22393
- */
22394
- const StyledDataGrid = styled$3.div`
22395
- ${_ref => {
22396
- let {
22397
- $height
22398
- } = _ref;
22399
- return $height ? css`
22400
- height: ${$height};
22401
- ` : '';
22402
- }}
22403
-
22404
- width: 100%;
22405
-
22406
- .MuiDataGrid-root {
22407
- font-family: var(--redsift-typography-datagrid-header-font-family);
22408
- border: none;
22409
- }
22410
-
22411
- .MuiDataGrid-row {
22412
- font-family: var(--redsift-typography-datagrid-cell-font-family);
22413
- font-size: var(--redsift-typography-datagrid-cell-font-size);
22414
- font-weight: var(--redsift-typography-datagrid-cell-font-weight);
22415
- }
22416
-
22417
- .MuiDataGrid-columnHeaderTitle {
22418
- font-family: var(--redsift-typography-datagrid-header-font-family);
22419
- font-size: var(--redsift-typography-datagrid-header-font-size);
22420
- font-weight: var(--redsift-typography-datagrid-header-font-weight);
22421
- }
22422
-
22423
- .MuiDataGrid-columnHeaders {
22424
- border-bottom-color: var(--redsift-color-primary-n);
22425
- }
22426
-
22427
- .MuiDataGrid-columnSeparator {
22428
- display: none;
22429
- }
22430
-
22431
- .MuiTablePagination-root {
22432
- .MuiTablePagination-selectLabel {
22433
- font-family: var(--redsift-typography-datagrid-header-font-family);
22434
- }
22435
- .MuiTablePagination-displayedRows {
22436
- font-family: var(--redsift-typography-datagrid-cell-font-family);
22437
- }
22438
-
22439
- .MuiInputBase-root {
22440
- font-family: var(--redsift-typography-datagrid-cell-font-family);
22441
- }
22442
- }
22443
-
22444
- .Mui-checked {
22445
- color: var(--redsift-color-primary-n);
22446
- }
22447
-
22448
- .MuiDataGrid-rowCount {
22449
- font-family: var(--redsift-typography-datagrid-cell-font-family);
22450
- }
22451
-
22452
- .MuiTablePagination-displayedRows {
22453
- font-family: var(--redsift-typography-datagrid-cell-font-family);
22454
- }
22455
-
22456
- .MuiBadge-standard {
22457
- font-family: var(--redsift-typography-datagrid-cell-font-family);
22458
- }
22459
- `;
22460
-
22461
22434
  function Ripple(props) {
22462
22435
  const {
22463
22436
  className,
@@ -24616,163 +24589,10 @@ process.env.NODE_ENV !== "production" ? TablePagination.propTypes /* remove-prop
24616
24589
  } : void 0;
24617
24590
  var TablePagination$1 = TablePagination;
24618
24591
 
24619
- const ControlledPagination$1 = _ref => {
24620
- let {
24621
- apiRef,
24622
- selectionStatus,
24623
- setSelectionStatusType,
24624
- selectionStatusType,
24625
- displaySelection,
24626
- displayPagination,
24627
- paginationModel,
24628
- onPaginationModelChange,
24629
- pageSizeOptions,
24630
- displayRowsPerPage,
24631
- paginationProps,
24632
- rowCount
24633
- } = _ref;
24634
- const totalNumberOfRowsInTable = rowCount;
24635
- const totalRowsLabel = `${selectionStatus.numberOfSelectedRows} row${selectionStatus.numberOfSelectedRows > 1 ? 's' : ''} selected`;
24636
- const pageRowsLabel = `All ${selectionStatus.numberOfSelectedRowsInPage} selectable rows on this page are selected${selectionStatus.numberOfSelectedRows != selectionStatus.numberOfSelectedRowsInPage ? ` (${selectionStatus.numberOfSelectedRows} row${selectionStatus.numberOfSelectedRows > 1 ? 's' : ''} selected in total)` : ''}.`;
24637
- return /*#__PURE__*/React__default.createElement(Flexbox, {
24638
- flexDirection: "row",
24639
- alignItems: "center",
24640
- justifyContent: "space-between",
24641
- marginBottom: "7px"
24642
- }, displaySelection ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, selectionStatusType === 'table' ? /*#__PURE__*/React__default.createElement(Text, {
24643
- fontSize: "14px"
24644
- }, "All selectable rows in the table are selected.", ' ', /*#__PURE__*/React__default.createElement(LinkButton, {
24645
- onClick: () => {
24646
- setSelectionStatusType('none');
24647
- apiRef.current.selectRows([], false, true);
24648
- }
24649
- }, "Clear selection.")) : selectionStatus.type === 'page' && selectionStatus.numberOfSelectedRowsInPage != 0 ? /*#__PURE__*/React__default.createElement(Text, {
24650
- fontSize: "14px"
24651
- }, pageRowsLabel, ' ', /*#__PURE__*/React__default.createElement(LinkButton, {
24652
- onClick: () => {
24653
- setSelectionStatusType('table');
24654
- }
24655
- }, "Select all selectable rows in the table.")) : selectionStatus.type === 'other' ? /*#__PURE__*/React__default.createElement(Text, {
24656
- fontSize: "14px"
24657
- }, totalRowsLabel) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$2({
24658
- component: "div",
24659
- count: totalNumberOfRowsInTable,
24660
- page: paginationModel.page,
24661
- onPageChange: (event, page) => onPaginationModelChange({
24662
- page,
24663
- pageSize: paginationModel.pageSize
24664
- }),
24665
- rowsPerPage: paginationModel.pageSize,
24666
- onRowsPerPageChange: event => onPaginationModelChange({
24667
- page: paginationModel.page,
24668
- pageSize: parseInt(event.target.value, 10)
24669
- }),
24670
- rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
24671
- }, paginationProps)) : null);
24672
- };
24673
-
24674
- const onServerSideSelectionStatusChange = _ref => {
24675
- let {
24676
- newSelectionModel,
24677
- apiRef,
24678
- selectionStatus,
24679
- selectionStatusType,
24680
- setSelectionStatusType,
24681
- isRowSelectable,
24682
- page,
24683
- pageSize
24684
- } = _ref;
24685
- const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref2 => {
24686
- let {
24687
- model
24688
- } = _ref2;
24689
- return isRowSelectable({
24690
- row: model
24691
- });
24692
- }).map(_ref3 => {
24693
- let {
24694
- id
24695
- } = _ref3;
24696
- return id;
24697
- }) : gridPaginatedVisibleSortedGridRowIdsSelector(apiRef);
24698
- const numberOfSelectableRowsInPage = selectableRowsInPage.length;
24699
- const numberOfSelectedRows = newSelectionModel.length;
24700
- const selectedRowsInPage = selectableRowsInPage.filter(rowId => newSelectionModel.includes(rowId));
24701
- const numberOfSelectedRowsInPage = selectedRowsInPage.length;
24702
- const isSamePage = (selectionStatus === null || selectionStatus === void 0 ? void 0 : selectionStatus.current.page) == page;
24703
- const isSamePageSize = (selectionStatus === null || selectionStatus === void 0 ? void 0 : selectionStatus.current.pageSize) == pageSize;
24704
- if (selectionStatusType === 'table') {
24705
- // if we just move across page or pageSize
24706
- if (!isSamePage || !isSamePageSize) {
24707
- selectionStatus.current = {
24708
- type: 'table',
24709
- numberOfSelectedRows,
24710
- numberOfSelectedRowsInPage,
24711
- page,
24712
- pageSize
24713
- };
24714
- }
24715
- // if we selected all selectable rows (as effect of the previous if condition)
24716
- else if (numberOfSelectedRows > 0) {
24717
- setSelectionStatusType('none');
24718
- selectionStatus.current = {
24719
- type: 'none',
24720
- numberOfSelectedRows,
24721
- numberOfSelectedRowsInPage,
24722
- page,
24723
- pageSize
24724
- };
24725
- apiRef.current.selectRows([], false, true);
24726
- }
24727
- return;
24728
- }
24729
- if (selectionStatusType === 'page' && isSamePage && isSamePageSize && numberOfSelectedRowsInPage === numberOfSelectableRowsInPage) {
24730
- setSelectionStatusType('none');
24731
- selectionStatus.current = {
24732
- type: 'none',
24733
- numberOfSelectedRows,
24734
- numberOfSelectedRowsInPage,
24735
- page,
24736
- pageSize
24737
- };
24738
- setTimeout(() => {
24739
- apiRef.current.selectRows(selectedRowsInPage, false, false);
24740
- }, 0);
24741
- return;
24742
- }
24743
- if (numberOfSelectedRowsInPage === numberOfSelectableRowsInPage && numberOfSelectableRowsInPage != 0) {
24744
- setSelectionStatusType('page');
24745
- selectionStatus.current = {
24746
- type: 'page',
24747
- numberOfSelectedRows,
24748
- numberOfSelectedRowsInPage,
24749
- page,
24750
- pageSize
24751
- };
24752
- return;
24753
- }
24754
- if (numberOfSelectedRows > 0) {
24755
- setSelectionStatusType('other');
24756
- selectionStatus.current = {
24757
- type: 'other',
24758
- numberOfSelectedRows,
24759
- numberOfSelectedRowsInPage,
24760
- page,
24761
- pageSize
24762
- };
24763
- return;
24764
- }
24765
- setSelectionStatusType('none');
24766
- selectionStatus.current = {
24767
- type: 'none',
24768
- numberOfSelectedRows,
24769
- numberOfSelectedRowsInPage,
24770
- page,
24771
- pageSize
24772
- };
24773
- return;
24774
- };
24775
-
24592
+ const _excluded$1 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "ControlledPagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "paginationModel", "onPaginationModelChange", "pageSizeOptions", "paginationProps", "paginationMode", "rowCount"],
24593
+ _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 COMPONENT_NAME$1 = 'DataGrid';
24595
+ const CLASSNAME$1 = 'redsift-datagrid';
24776
24596
  const getSelectableRowsInTable = (apiRef, isRowSelectable) => {
24777
24597
  return isRowSelectable && typeof isRowSelectable === 'function' ? gridFilteredSortedRowEntriesSelector(apiRef).filter(_ref => {
24778
24598
  let {
@@ -24788,8 +24608,7 @@ const getSelectableRowsInTable = (apiRef, isRowSelectable) => {
24788
24608
  return id;
24789
24609
  }) : gridFilteredSortedRowIdsSelector(apiRef);
24790
24610
  };
24791
-
24792
- const ControlledPagination = _ref => {
24611
+ const ControlledPagination = _ref3 => {
24793
24612
  let {
24794
24613
  displaySelection = false,
24795
24614
  displayRowsPerPage = false,
@@ -24801,7 +24620,7 @@ const ControlledPagination = _ref => {
24801
24620
  pageSizeOptions,
24802
24621
  isRowSelectable,
24803
24622
  paginationProps
24804
- } = _ref;
24623
+ } = _ref3;
24805
24624
  const filteredRowsInTable = getSelectableRowsInTable(apiRef);
24806
24625
  const selectableRowsInTable = getSelectableRowsInTable(apiRef, isRowSelectable);
24807
24626
  const numberOfFilteredRowsInTable = filteredRowsInTable.length;
@@ -24841,26 +24660,56 @@ const ControlledPagination = _ref => {
24841
24660
  rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
24842
24661
  }, paginationProps)) : null);
24843
24662
  };
24844
-
24845
- const _excluded$1 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "paginationPlacement", "selectionStatus", "selectionStatusType", "setSelectionStatusType", "apiRef", "isRowSelectable", "paginationModel", "onPaginationModelChange", "pageSizeOptions", "paginationProps", "paginationMode", "rowCount"],
24846
- _excluded2 = ["apiRef", "autoHeight", "className", "slots", "slotProps", "filterModel", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "onFilterModelChange", "paginationModel", "onPaginationModelChange", "pageSizeOptions", "rowSelectionModel", "onRowSelectionModelChange", "pagination", "paginationPlacement", "paginationProps", "rows", "sx", "theme", "paginationMode", "rowCount", "onSelectionStatusChange", "isPreviousData"];
24847
- const COMPONENT_NAME$1 = 'DataGrid';
24848
- const CLASSNAME$1 = 'redsift-datagrid';
24849
- const DEFAULT_PROPS = {
24850
- license: process.env.MUI_LICENSE_KEY,
24851
- paginationPlacement: 'both'
24663
+ const ServerSideControlledPagination = _ref4 => {
24664
+ let {
24665
+ selectionStatus,
24666
+ displaySelection,
24667
+ displayPagination,
24668
+ paginationModel,
24669
+ onPaginationModelChange,
24670
+ pageSizeOptions,
24671
+ displayRowsPerPage,
24672
+ paginationProps,
24673
+ rowCount
24674
+ } = _ref4;
24675
+ const totalNumberOfRowsInTable = rowCount;
24676
+ const totalRowsLabel = `${selectionStatus.numberOfSelectedRows} row${selectionStatus.numberOfSelectedRows > 1 ? 's' : ''} selected`;
24677
+ const pageRowsLabel = `All ${selectionStatus.numberOfSelectedRowsInPage} selectable rows on this page are selected${selectionStatus.numberOfSelectedRows != selectionStatus.numberOfSelectedRowsInPage ? ` (${selectionStatus.numberOfSelectedRows} row${selectionStatus.numberOfSelectedRows > 1 ? 's' : ''} selected in total)` : ''}.`;
24678
+ return /*#__PURE__*/React__default.createElement(Flexbox, {
24679
+ flexDirection: "row",
24680
+ alignItems: "center",
24681
+ justifyContent: "space-between",
24682
+ marginBottom: "7px"
24683
+ }, displaySelection ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, selectionStatus.type === 'page' && selectionStatus.numberOfSelectedRowsInPage != 0 ? /*#__PURE__*/React__default.createElement(Text, {
24684
+ fontSize: "14px"
24685
+ }, pageRowsLabel) : selectionStatus.type === 'other' ? /*#__PURE__*/React__default.createElement(Text, {
24686
+ fontSize: "14px"
24687
+ }, totalRowsLabel) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$2({
24688
+ component: "div",
24689
+ count: totalNumberOfRowsInTable,
24690
+ page: paginationModel.page,
24691
+ onPageChange: (event, page) => onPaginationModelChange({
24692
+ page,
24693
+ pageSize: paginationModel.pageSize
24694
+ }),
24695
+ rowsPerPage: paginationModel.pageSize,
24696
+ onRowsPerPageChange: event => onPaginationModelChange({
24697
+ page: paginationModel.page,
24698
+ pageSize: parseInt(event.target.value, 10)
24699
+ }),
24700
+ rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
24701
+ }, paginationProps)) : null);
24852
24702
  };
24853
- const Toolbar = _ref => {
24703
+ const Toolbar = _ref5 => {
24854
24704
  let {
24855
24705
  hideToolbar,
24856
24706
  RenderedToolbar,
24857
24707
  filterModel,
24858
24708
  onFilterModelChange,
24859
24709
  pagination,
24710
+ ControlledPagination,
24860
24711
  paginationPlacement,
24861
24712
  selectionStatus,
24862
- selectionStatusType,
24863
- setSelectionStatusType,
24864
24713
  apiRef,
24865
24714
  isRowSelectable,
24866
24715
  paginationModel,
@@ -24869,19 +24718,16 @@ const Toolbar = _ref => {
24869
24718
  paginationProps,
24870
24719
  paginationMode = 'client',
24871
24720
  rowCount
24872
- } = _ref,
24873
- forwardedProps = _objectWithoutProperties(_ref, _excluded$1);
24721
+ } = _ref5,
24722
+ forwardedProps = _objectWithoutProperties(_ref5, _excluded$1);
24874
24723
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, !hideToolbar ? /*#__PURE__*/React__default.createElement(RenderedToolbar, _extends$2({}, forwardedProps, {
24875
24724
  filterModel: filterModel,
24876
24725
  onFilterModelChange: onFilterModelChange
24877
- })) : null, pagination ? paginationMode === 'server' ? /*#__PURE__*/React__default.createElement(ControlledPagination$1, {
24878
- apiRef: apiRef,
24726
+ })) : null, pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, {
24879
24727
  displaySelection: true,
24880
24728
  displayRowsPerPage: false,
24881
24729
  displayPagination: ['top', 'both'].includes(paginationPlacement),
24882
24730
  selectionStatus: selectionStatus.current,
24883
- setSelectionStatusType: setSelectionStatusType,
24884
- selectionStatusType: selectionStatusType,
24885
24731
  paginationModel: paginationModel,
24886
24732
  onPaginationModelChange: onPaginationModelChange,
24887
24733
  pageSizeOptions: pageSizeOptions,
@@ -24900,8 +24746,63 @@ const Toolbar = _ref => {
24900
24746
  paginationProps: paginationProps
24901
24747
  }) : null);
24902
24748
  };
24749
+ const onServerSideSelectionStatusChange = (newSelectionModel, apiRef, selectionStatus, isRowSelectable, page, pageSize) => {
24750
+ const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref6 => {
24751
+ let {
24752
+ model
24753
+ } = _ref6;
24754
+ return isRowSelectable({
24755
+ row: model
24756
+ });
24757
+ }).map(_ref7 => {
24758
+ let {
24759
+ id
24760
+ } = _ref7;
24761
+ return id;
24762
+ }) : gridPaginatedVisibleSortedGridRowIdsSelector(apiRef);
24763
+ const numberOfSelectableRowsInPage = selectableRowsInPage.length;
24764
+ const numberOfSelectedRows = newSelectionModel.length;
24765
+ const selectedRowsInPage = selectableRowsInPage.filter(rowId => newSelectionModel.includes(rowId));
24766
+ const numberOfSelectedRowsInPage = selectedRowsInPage.length;
24767
+ const isSamePage = (selectionStatus === null || selectionStatus === void 0 ? void 0 : selectionStatus.current.page) == page;
24768
+ const isSamePageSize = (selectionStatus === null || selectionStatus === void 0 ? void 0 : selectionStatus.current.pageSize) == pageSize;
24769
+
24770
+ // if previous status is `page`,
24771
+ // if page and pageSize didn't change
24772
+ // and all the rows are selected, deselect all row
24773
+ if (selectionStatus.current.type === 'page' && isSamePage && isSamePageSize && numberOfSelectedRowsInPage === numberOfSelectableRowsInPage) {
24774
+ setTimeout(() => {
24775
+ apiRef.current.selectRows(selectedRowsInPage, false, false);
24776
+ }, 0);
24777
+ }
24778
+ if (numberOfSelectedRowsInPage === numberOfSelectableRowsInPage && numberOfSelectableRowsInPage != 0) {
24779
+ selectionStatus.current = {
24780
+ type: 'page',
24781
+ numberOfSelectedRows,
24782
+ numberOfSelectedRowsInPage,
24783
+ page,
24784
+ pageSize
24785
+ };
24786
+ } else if (numberOfSelectedRows > 0) {
24787
+ selectionStatus.current = {
24788
+ type: 'other',
24789
+ numberOfSelectedRows,
24790
+ numberOfSelectedRowsInPage,
24791
+ page,
24792
+ pageSize
24793
+ };
24794
+ } else {
24795
+ selectionStatus.current = {
24796
+ type: 'none',
24797
+ numberOfSelectedRows,
24798
+ numberOfSelectedRowsInPage,
24799
+ page,
24800
+ pageSize
24801
+ };
24802
+ }
24803
+ };
24903
24804
  const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
24904
- var _ref2, _ref3, _initialState$paginat, _initialState$paginat2, _initialState$paginat3, _pageSizeOptions$, _ref4, _initialState$paginat4, _initialState$paginat5, _initialState$paginat6;
24805
+ var _ref8, _ref9, _initialState$paginat, _initialState$paginat2, _initialState$paginat3, _pageSizeOptions$, _ref10, _initialState$paginat4, _initialState$paginat5, _initialState$paginat6;
24905
24806
  const datagridRef = ref || useRef();
24906
24807
  const {
24907
24808
  apiRef: propsApiRef,
@@ -24914,23 +24815,21 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
24914
24815
  hideToolbar,
24915
24816
  initialState,
24916
24817
  isRowSelectable,
24917
- license,
24818
+ license = process.env.MUI_LICENSE_KEY,
24918
24819
  onFilterModelChange: propsOnFilterModelChange,
24820
+ rowSelectionModel: propsSelectionModel,
24919
24821
  paginationModel: propsPaginationModel,
24920
24822
  onPaginationModelChange: propsOnPaginationModelChange,
24921
- pageSizeOptions,
24922
- rowSelectionModel: propsRowSelectionModel,
24923
24823
  onRowSelectionModelChange,
24924
24824
  pagination,
24925
- paginationPlacement,
24825
+ paginationPlacement = 'both',
24926
24826
  paginationProps,
24927
24827
  rows,
24828
+ pageSizeOptions,
24928
24829
  sx,
24929
24830
  theme: propsTheme,
24930
24831
  paginationMode = 'client',
24931
- rowCount,
24932
- onSelectionStatusChange: propsOnSelectionStatusChange,
24933
- isPreviousData
24832
+ rowCount
24934
24833
  } = props,
24935
24834
  forwardedProps = _objectWithoutProperties(props, _excluded2);
24936
24835
  const theme = useTheme$4(propsTheme);
@@ -24950,13 +24849,13 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
24950
24849
  setFilterModel(model);
24951
24850
  }
24952
24851
  };
24953
- const [rowSelectionModel, setRowSelectionModel] = useState(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
24852
+ const [rowSelectionModel, setRowSelectionModel] = useState(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
24954
24853
  useEffect(() => {
24955
- setRowSelectionModel(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
24956
- }, [propsRowSelectionModel]);
24854
+ setRowSelectionModel(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
24855
+ }, [propsSelectionModel]);
24957
24856
  const [paginationModel, setPaginationModel] = useState({
24958
- pageSize: (_ref2 = (_ref3 = (_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 && _ref3 !== void 0 ? _ref3 : typeof (pageSizeOptions === null || pageSizeOptions === void 0 ? void 0 : pageSizeOptions[0]) === 'number' ? pageSizeOptions === null || pageSizeOptions === void 0 ? void 0 : pageSizeOptions[0] : pageSizeOptions === null || pageSizeOptions === void 0 ? void 0 : (_pageSizeOptions$ = pageSizeOptions[0]) === null || _pageSizeOptions$ === void 0 ? void 0 : _pageSizeOptions$.value) !== null && _ref2 !== void 0 ? _ref2 : 100,
24959
- page: (_ref4 = (_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 && _ref4 !== void 0 ? _ref4 : 0
24857
+ 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,
24858
+ 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
24960
24859
  });
24961
24860
  const onPaginationModelChange = model => {
24962
24861
  if (propsOnPaginationModelChange) {
@@ -24970,48 +24869,24 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
24970
24869
  setPaginationModel(propsPaginationModel);
24971
24870
  }
24972
24871
  }, [propsPaginationModel]);
24973
- const [selectionStatusType, setSelectionStatusType] = useState('none');
24974
24872
  const selectionStatus = useRef({
24975
- type: selectionStatusType,
24873
+ type: 'none',
24976
24874
  numberOfSelectedRows: 0,
24977
24875
  numberOfSelectedRowsInPage: 0,
24978
24876
  page: paginationModel.page,
24979
24877
  pageSize: paginationModel.pageSize
24980
24878
  });
24981
- useEffect(() => {
24982
- if (propsOnSelectionStatusChange) {
24983
- propsOnSelectionStatusChange(selectionStatusType);
24984
- }
24985
- }, [selectionStatusType]);
24986
24879
 
24987
24880
  // in server-side pagination we want to update the selection status
24988
24881
  // every time we navigate between pages, resize our page or select something
24989
24882
  useEffect(() => {
24990
- if (paginationMode === 'server') {
24991
- onServerSideSelectionStatusChange({
24992
- newSelectionModel: Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel],
24993
- apiRef,
24994
- selectionStatus,
24995
- selectionStatusType,
24996
- setSelectionStatusType,
24997
- isRowSelectable,
24998
- page: paginationModel.page,
24999
- pageSize: paginationModel.pageSize
25000
- });
24883
+ if (paginationMode == 'server') {
24884
+ onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatus, isRowSelectable, paginationModel.page, paginationModel.pageSize);
25001
24885
  }
25002
24886
  }, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
25003
- useEffect(() => {
25004
- if (paginationMode === 'server' && selectionStatusType === 'table' && !isPreviousData) {
25005
- const selectableRowsInPage = getSelectableRowsInTable(apiRef, isRowSelectable);
25006
- setTimeout(() => {
25007
- apiRef.current.selectRows(selectableRowsInPage, false, true);
25008
- }, 0);
25009
- }
25010
- }, [isPreviousData]);
25011
24887
  if (!Array.isArray(rows)) {
25012
24888
  return null;
25013
24889
  }
25014
- const isServerTableSelection = paginationMode === 'server' && selectionStatusType === 'table';
25015
24890
  const muiTheme = useMemo(() => createTheme({
25016
24891
  palette: {
25017
24892
  mode: theme,
@@ -25078,7 +24953,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
25078
24953
  }, props))
25079
24954
  }, slots), {}, {
25080
24955
  toolbar: Toolbar,
25081
- pagination: props => pagination ? paginationMode === 'server' ? /*#__PURE__*/React__default.createElement(ControlledPagination$1, _extends$2({}, props, {
24956
+ pagination: props => pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$2({}, props, {
25082
24957
  displaySelection: false,
25083
24958
  displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
25084
24959
  displayPagination: ['bottom', 'both'].includes(paginationPlacement),
@@ -25111,10 +24986,9 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
25111
24986
  filterModel,
25112
24987
  onFilterModelChange,
25113
24988
  pagination,
24989
+ ControlledPagination: paginationMode == 'server' ? ServerSideControlledPagination : ControlledPagination,
25114
24990
  paginationPlacement,
25115
24991
  selectionStatus,
25116
- selectionStatusType,
25117
- setSelectionStatusType,
25118
24992
  apiRef,
25119
24993
  isRowSelectable,
25120
24994
  paginationModel,
@@ -25127,43 +25001,43 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
25127
25001
  }),
25128
25002
  filterModel: filterModel,
25129
25003
  initialState: initialState,
25130
- isRowSelectable: !isServerTableSelection ? isRowSelectable : () => false,
25004
+ isRowSelectable: isRowSelectable,
25131
25005
  onFilterModelChange: onFilterModelChange,
25132
25006
  pagination: pagination,
25133
25007
  paginationMode: paginationMode,
25134
- keepNonExistentRowsSelected: paginationMode === 'server',
25008
+ keepNonExistentRowsSelected: paginationMode == 'server',
25135
25009
  rows: rows,
25010
+ pageSizeOptions: pageSizeOptions,
25136
25011
  paginationModel: paginationModel,
25137
25012
  onPaginationModelChange: onPaginationModelChange,
25138
- pageSizeOptions: pageSizeOptions,
25139
- rowSelectionModel: isServerTableSelection ? getSelectableRowsInTable(apiRef, isRowSelectable) : rowSelectionModel,
25013
+ rowSelectionModel: rowSelectionModel,
25140
25014
  onRowSelectionModelChange: (newSelectionModel, details) => {
25141
25015
  if (pagination && paginationMode != 'server') {
25142
- const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref5 => {
25016
+ const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref11 => {
25143
25017
  let {
25144
25018
  model
25145
- } = _ref5;
25019
+ } = _ref11;
25146
25020
  return isRowSelectable({
25147
25021
  row: model
25148
25022
  });
25149
- }).map(_ref6 => {
25023
+ }).map(_ref12 => {
25150
25024
  let {
25151
25025
  id
25152
- } = _ref6;
25026
+ } = _ref12;
25153
25027
  return id;
25154
25028
  }) : gridPaginatedVisibleSortedGridRowIdsSelector(apiRef);
25155
25029
  const numberOfSelectableRowsInPage = selectableRowsInPage.length;
25156
- const selectableRowsInTable = isRowSelectable ? gridFilteredSortedRowEntriesSelector(apiRef).filter(_ref7 => {
25030
+ const selectableRowsInTable = isRowSelectable ? gridFilteredSortedRowEntriesSelector(apiRef).filter(_ref13 => {
25157
25031
  let {
25158
25032
  model
25159
- } = _ref7;
25033
+ } = _ref13;
25160
25034
  return isRowSelectable({
25161
25035
  row: model
25162
25036
  });
25163
- }).map(_ref8 => {
25037
+ }).map(_ref14 => {
25164
25038
  let {
25165
25039
  id
25166
- } = _ref8;
25040
+ } = _ref14;
25167
25041
  return id;
25168
25042
  }) : gridFilteredSortedRowIdsSelector(apiRef);
25169
25043
  const numberOfSelectableRowsInTable = selectableRowsInTable.length;
@@ -25174,25 +25048,21 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
25174
25048
  }, 0);
25175
25049
  }
25176
25050
  if (numberOfSelectedRows === numberOfSelectableRowsInPage && numberOfSelectableRowsInPage < numberOfSelectableRowsInTable) {
25177
- setSelectionStatusType('page');
25178
25051
  selectionStatus.current = {
25179
25052
  type: 'page',
25180
25053
  numberOfSelectedRows
25181
25054
  };
25182
25055
  } else if (numberOfSelectedRows === numberOfSelectableRowsInTable && numberOfSelectableRowsInPage < numberOfSelectableRowsInTable) {
25183
- setSelectionStatusType('table');
25184
25056
  selectionStatus.current = {
25185
25057
  type: 'table',
25186
25058
  numberOfSelectedRows
25187
25059
  };
25188
25060
  } else if (numberOfSelectedRows > 0) {
25189
- setSelectionStatusType('other');
25190
25061
  selectionStatus.current = {
25191
25062
  type: 'other',
25192
25063
  numberOfSelectedRows
25193
25064
  };
25194
25065
  } else {
25195
- setSelectionStatusType('none');
25196
25066
  selectionStatus.current = {
25197
25067
  type: 'none',
25198
25068
  numberOfSelectedRows
@@ -25201,11 +25071,18 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
25201
25071
  }
25202
25072
  onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
25203
25073
  },
25204
- sx: _objectSpread2(_objectSpread2({}, sx), defaultSxStyle)
25074
+ sx: _objectSpread2(_objectSpread2({}, sx), {}, {
25075
+ '.MuiDataGrid-columnHeaders': {
25076
+ flexDirection: 'column',
25077
+ alignItems: 'normal'
25078
+ },
25079
+ '.MuiDataGrid-selectedRowCount': {
25080
+ margin: 'none'
25081
+ }
25082
+ })
25205
25083
  })))));
25206
25084
  });
25207
25085
  DataGrid.className = CLASSNAME$1;
25208
- DataGrid.defaultProps = DEFAULT_PROPS;
25209
25086
  DataGrid.displayName = COMPONENT_NAME$1;
25210
25087
 
25211
25088
  const StyledTextCell = styled$3.div`