@redsift/table 10.3.0-alpha.1 → 10.3.0-alpha.10

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.
@@ -21647,14 +21688,14 @@ const TooltipContent = /*#__PURE__*/forwardRef((props, ref) => {
21647
21688
  }, isOpen && /*#__PURE__*/React__default.createElement(StyledTooltipContent, _extends$2({
21648
21689
  className: classNames(TooltipContent.className, className),
21649
21690
  ref: popoverRef,
21650
- $theme: theme,
21691
+ $theme: theme
21692
+ }, getFloatingProps(props), {
21651
21693
  style: _objectSpread2({
21652
21694
  position: strategy,
21653
21695
  top: y !== null && y !== void 0 ? y : 0,
21654
21696
  left: x !== null && x !== void 0 ? x : 0,
21655
21697
  visibility: x == null ? 'hidden' : 'visible'
21656
- }, style)
21657
- }, getFloatingProps(props), {
21698
+ }, style),
21658
21699
  $placement: placement
21659
21700
  }), /*#__PURE__*/React__default.createElement("div", {
21660
21701
  ref: arrowRef,
@@ -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.
@@ -21687,31 +21726,62 @@ const TooltipTrigger = /*#__PURE__*/forwardRef((props, ref) => {
21687
21726
  getReferenceProps,
21688
21727
  refs,
21689
21728
  tooltipId,
21690
- triggerClassName
21729
+ triggerClassName,
21730
+ color
21691
21731
  } = useTooltipContext();
21692
21732
  const childrenRef = children.ref;
21693
21733
  const triggerRef = useMergeRefs([refs.setReference, ref, childrenRef]);
21694
21734
  if ( /*#__PURE__*/React__default.isValidElement(children)) {
21695
21735
  var _children$props$child;
21696
- return /*#__PURE__*/React__default.cloneElement(children, _objectSpread2({}, getReferenceProps(_objectSpread2(_objectSpread2(_objectSpread2({
21736
+ return /*#__PURE__*/React__default.cloneElement(children, _objectSpread2(_objectSpread2({}, getReferenceProps(_objectSpread2(_objectSpread2(_objectSpread2({
21697
21737
  ref: triggerRef
21698
21738
  }, props), {}, {
21699
21739
  'aria-describedby': tooltipId
21700
21740
  }, children.props), {}, {
21701
- children: (_children$props$child = children.props.children) !== null && _children$props$child !== void 0 ? _children$props$child : '',
21702
- className: classNames(children.props.className, triggerClassName)
21703
- }))));
21741
+ children: (_children$props$child = children.props.children) !== null && _children$props$child !== void 0 ? _children$props$child : ''
21742
+ }))), {}, {
21743
+ className: classNames(children.props.className, triggerClassName),
21744
+ color: color !== null && color !== void 0 ? color : children.props.color
21745
+ }));
21704
21746
  }
21705
21747
  return /*#__PURE__*/React__default.createElement("span", _extends$2({
21706
21748
  ref: triggerRef
21707
21749
  }, getReferenceProps(props)), children);
21708
21750
  });
21709
21751
  TooltipTrigger.className = CLASSNAME$4;
21710
- TooltipTrigger.defaultProps = DEFAULT_PROPS$3;
21711
21752
  TooltipTrigger.displayName = COMPONENT_NAME$4;
21712
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
+
21713
21782
  function useTooltip(_ref) {
21714
21783
  let {
21784
+ color,
21715
21785
  defaultOpen,
21716
21786
  delay,
21717
21787
  placement,
@@ -21764,13 +21834,14 @@ function useTooltip(_ref) {
21764
21834
  });
21765
21835
  const interactions = useInteractions([hover, focus, dismiss, role]);
21766
21836
  return React__default.useMemo(() => _objectSpread2(_objectSpread2(_objectSpread2({
21837
+ color,
21767
21838
  isOpen,
21768
21839
  handleOpen
21769
21840
  }, interactions), data), {}, {
21770
21841
  arrowRef,
21771
21842
  tooltipId,
21772
21843
  triggerClassName
21773
- }), [isOpen, handleOpen, interactions, data, arrowRef, tooltipId, triggerClassName]);
21844
+ }), [color, isOpen, handleOpen, interactions, data, arrowRef, tooltipId, triggerClassName]);
21774
21845
  }
21775
21846
 
21776
21847
  const ThemeContext = /*#__PURE__*/React__default.createContext(null);
@@ -21778,10 +21849,6 @@ const ThemeProvider = ThemeContext.Provider;
21778
21849
 
21779
21850
  const COMPONENT_NAME$3 = 'Tooltip';
21780
21851
  const CLASSNAME$3 = 'redsift-tooltip';
21781
- const DEFAULT_PROPS$2 = {
21782
- delay: 500,
21783
- placement: TooltipPlacement.top
21784
- };
21785
21852
 
21786
21853
  /**
21787
21854
  * The Tooltip component.
@@ -21789,17 +21856,19 @@ const DEFAULT_PROPS$2 = {
21789
21856
  const BaseTooltip = props => {
21790
21857
  const {
21791
21858
  children,
21859
+ color,
21792
21860
  defaultOpen,
21793
- delay,
21861
+ delay = 500,
21794
21862
  isOpen,
21795
21863
  onOpen,
21796
- placement,
21797
- tooltipId,
21864
+ placement = TooltipPlacement.top,
21798
21865
  theme: propsTheme,
21866
+ tooltipId,
21799
21867
  triggerClassName
21800
21868
  } = props;
21801
21869
  const theme = useTheme$4 ? useTheme$4(propsTheme) : undefined;
21802
21870
  const tooltip = useTooltip({
21871
+ color,
21803
21872
  defaultOpen,
21804
21873
  delay,
21805
21874
  placement,
@@ -21819,7 +21888,6 @@ const BaseTooltip = props => {
21819
21888
  }, trigger && isComponent('TooltipTrigger')(trigger) ? trigger : null, content && isComponent('TooltipContent')(content) ? content : null));
21820
21889
  };
21821
21890
  BaseTooltip.className = CLASSNAME$3;
21822
- BaseTooltip.defaultProps = DEFAULT_PROPS$2;
21823
21891
  BaseTooltip.displayName = COMPONENT_NAME$3;
21824
21892
  const Tooltip = Object.assign(BaseTooltip, {
21825
21893
  Trigger: TooltipTrigger,
@@ -21853,24 +21921,6 @@ const StyledGridToolbarFilterSemanticField = styled$3.form`
21853
21921
  const _excluded$e = ["className", "nlpFilterConfig", "onFilterModelChange", "dateFormat", "defaultModel", "defaultFilter", "disablePower", "localeText"];
21854
21922
  const COMPONENT_NAME$2 = 'GridToolbarFilterSemanticField';
21855
21923
  const CLASSNAME$2 = 'redsift-datagrid-toolbar-nlp-filter-field';
21856
- const DEFAULT_PROPS$1 = {
21857
- dateFormat: 'yyyy-mm-dd',
21858
- defaultModel: 'gpt-4-1106-preview',
21859
- defaultFilter: {
21860
- items: [],
21861
- logicOperator: 'and'
21862
- },
21863
- disablePower: false,
21864
- localeText: {
21865
- textLabel: 'Semantic filtering',
21866
- textPlaceholder: 'Describe here how you would like to filter this datagrid.',
21867
- buttonAriaLabel: 'Submit',
21868
- buttonText: 'Run',
21869
- powerText: 'Power mode',
21870
- powerTooltipContent: 'The Power mode can get better results but is slower.',
21871
- errorText: 'Unable to find a valid filter, please try again with a more specific prompt.'
21872
- }
21873
- };
21874
21924
  const DEFAULT_OPERATORS = {
21875
21925
  string: ['contains', 'equals', 'startsWith', 'endsWith', 'isEmpty', 'isNotEmpty', 'isAnyOf'],
21876
21926
  number: ['=', '!=', '>', '>=', '<', '<=', 'isEmpty', 'isNotEmpty', 'isAnyOf'],
@@ -21944,10 +21994,13 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
21944
21994
  className,
21945
21995
  nlpFilterConfig,
21946
21996
  onFilterModelChange,
21947
- dateFormat = DEFAULT_PROPS$1.dateFormat,
21948
- defaultModel = DEFAULT_PROPS$1.defaultModel,
21949
- defaultFilter = DEFAULT_PROPS$1.defaultFilter,
21950
- 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,
21951
22004
  localeText
21952
22005
  } = props,
21953
22006
  forwardedProps = _objectWithoutProperties(props, _excluded$e);
@@ -21959,7 +22012,15 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
21959
22012
  powerText,
21960
22013
  powerTooltipContent,
21961
22014
  errorText
21962
- } = _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);
21963
22024
  const [prompt, setPrompt] = useState('');
21964
22025
  const modelRef = useRef(defaultModel);
21965
22026
  const showErrorRef = useRef(false);
@@ -22028,7 +22089,6 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
22028
22089
  }, errorText));
22029
22090
  });
22030
22091
  GridToolbarFilterSemanticField.className = CLASSNAME$2;
22031
- GridToolbarFilterSemanticField.defaultProps = DEFAULT_PROPS$1;
22032
22092
  GridToolbarFilterSemanticField.displayName = COMPONENT_NAME$2;
22033
22093
 
22034
22094
  /**
@@ -22091,7 +22151,33 @@ const Toolbar$3 = props => {
22091
22151
  }, semanticFilterProps ? /*#__PURE__*/React__default.createElement(GridToolbarFilterSemanticField, semanticFilterProps) : null)));
22092
22152
  };
22093
22153
 
22094
- 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"];
22095
22181
  const BaseButton = /*#__PURE__*/forwardRef((props, ref) => {
22096
22182
  var _props$className;
22097
22183
  const {
@@ -22100,7 +22186,7 @@ const BaseButton = /*#__PURE__*/forwardRef((props, ref) => {
22100
22186
  onClick,
22101
22187
  startIcon
22102
22188
  } = props,
22103
- forwardedProps = _objectWithoutProperties(props, _excluded$d);
22189
+ forwardedProps = _objectWithoutProperties(props, _excluded$c);
22104
22190
  const color = Object.keys(ButtonsColorPalette).includes(propsColor) ? propsColor : 'primary';
22105
22191
  if ((_props$className = props.className) !== null && _props$className !== void 0 && _props$className.includes('redsift-condensed')) {
22106
22192
  return /*#__PURE__*/React__default.createElement(IconButton$2, _extends$2({}, forwardedProps, {
@@ -22126,7 +22212,7 @@ const BaseButton = /*#__PURE__*/forwardRef((props, ref) => {
22126
22212
  }), children);
22127
22213
  });
22128
22214
 
22129
- const _excluded$c = ["checked", "indeterminate", "disabled", "onChange"];
22215
+ const _excluded$b = ["checked", "indeterminate", "disabled", "onChange"];
22130
22216
  const BaseCheckbox = /*#__PURE__*/forwardRef((props, ref) => {
22131
22217
  const {
22132
22218
  checked,
@@ -22134,7 +22220,7 @@ const BaseCheckbox = /*#__PURE__*/forwardRef((props, ref) => {
22134
22220
  disabled,
22135
22221
  onChange
22136
22222
  } = props,
22137
- forwardedProps = _objectWithoutProperties(props, _excluded$c);
22223
+ forwardedProps = _objectWithoutProperties(props, _excluded$b);
22138
22224
  return /*#__PURE__*/React__default.createElement(Checkbox, _extends$2({}, forwardedProps, forwardedProps.inputProps, {
22139
22225
  isSelected: checked && !indeterminate,
22140
22226
  isDisabled: disabled,
@@ -22144,32 +22230,6 @@ const BaseCheckbox = /*#__PURE__*/forwardRef((props, ref) => {
22144
22230
  }));
22145
22231
  });
22146
22232
 
22147
- const _excluded$b = ["displayName"];
22148
- const muiIconToDSIcon = {
22149
- ColumnFilteredIcon: mdiFilterVariant,
22150
- ColumnSelectorIcon: mdiViewColumn,
22151
- ColumnSortedAscendingIcon: mdiChevronUp,
22152
- ColumnSortedDescendingIcon: mdiChevronDown,
22153
- DensityCompactIcon: mdiViewHeadline,
22154
- DensityStandardIcon: mdiViewSequential,
22155
- DensityComfortableIcon: mdiViewStream,
22156
- DetailPanelCollapseIcon: mdiChevronDown,
22157
- DetailPanelExpandIcon: mdiChevronRight,
22158
- ExportIcon: mdiTrayArrowDown,
22159
- OpenFilterButtonIcon: mdiFilterVariant
22160
- };
22161
- const BaseIcon = /*#__PURE__*/forwardRef((props, ref) => {
22162
- const {
22163
- displayName
22164
- } = props,
22165
- forwardedProps = _objectWithoutProperties(props, _excluded$b);
22166
- return /*#__PURE__*/React__default.createElement(Icon, _extends$2({}, forwardedProps, forwardedProps.inputProps, {
22167
- ref: ref,
22168
- size: forwardedProps.fontSize,
22169
- icon: muiIconToDSIcon[displayName]
22170
- }));
22171
- });
22172
-
22173
22233
  const _excluded$a = ["anchorEl", "component", "components", "componentsProps", "container", "disablePortal", "keepMounted", "modifiers", "open", "placement", "popperOptions", "popperRef", "transition", "slots", "slotProps"];
22174
22234
  const PopperRoot = styled$1(BasePopper$1, {
22175
22235
  name: 'MuiPopper',
@@ -22371,86 +22431,6 @@ const BasePopper = /*#__PURE__*/forwardRef((props, ref) => {
22371
22431
  }));
22372
22432
  });
22373
22433
 
22374
- const defaultSxStyle = {
22375
- '.MuiDataGrid-columnHeaders': {
22376
- flexDirection: 'column',
22377
- alignItems: 'normal'
22378
- },
22379
- '.MuiDataGrid-selectedRowCount': {
22380
- margin: 'none'
22381
- }
22382
- };
22383
-
22384
- /**
22385
- * Component style.
22386
- */
22387
- const StyledDataGrid = styled$3.div`
22388
- ${_ref => {
22389
- let {
22390
- $height
22391
- } = _ref;
22392
- return $height ? css`
22393
- height: ${$height};
22394
- ` : '';
22395
- }}
22396
-
22397
- width: 100%;
22398
-
22399
- .MuiDataGrid-root {
22400
- font-family: var(--redsift-typography-datagrid-header-font-family);
22401
- border: none;
22402
- }
22403
-
22404
- .MuiDataGrid-row {
22405
- font-family: var(--redsift-typography-datagrid-cell-font-family);
22406
- font-size: var(--redsift-typography-datagrid-cell-font-size);
22407
- font-weight: var(--redsift-typography-datagrid-cell-font-weight);
22408
- }
22409
-
22410
- .MuiDataGrid-columnHeaderTitle {
22411
- font-family: var(--redsift-typography-datagrid-header-font-family);
22412
- font-size: var(--redsift-typography-datagrid-header-font-size);
22413
- font-weight: var(--redsift-typography-datagrid-header-font-weight);
22414
- }
22415
-
22416
- .MuiDataGrid-columnHeaders {
22417
- border-bottom-color: var(--redsift-color-primary-n);
22418
- }
22419
-
22420
- .MuiDataGrid-columnSeparator {
22421
- display: none;
22422
- }
22423
-
22424
- .MuiTablePagination-root {
22425
- .MuiTablePagination-selectLabel {
22426
- font-family: var(--redsift-typography-datagrid-header-font-family);
22427
- }
22428
- .MuiTablePagination-displayedRows {
22429
- font-family: var(--redsift-typography-datagrid-cell-font-family);
22430
- }
22431
-
22432
- .MuiInputBase-root {
22433
- font-family: var(--redsift-typography-datagrid-cell-font-family);
22434
- }
22435
- }
22436
-
22437
- .Mui-checked {
22438
- color: var(--redsift-color-primary-n);
22439
- }
22440
-
22441
- .MuiDataGrid-rowCount {
22442
- font-family: var(--redsift-typography-datagrid-cell-font-family);
22443
- }
22444
-
22445
- .MuiTablePagination-displayedRows {
22446
- font-family: var(--redsift-typography-datagrid-cell-font-family);
22447
- }
22448
-
22449
- .MuiBadge-standard {
22450
- font-family: var(--redsift-typography-datagrid-cell-font-family);
22451
- }
22452
- `;
22453
-
22454
22434
  function Ripple(props) {
22455
22435
  const {
22456
22436
  className,
@@ -24609,151 +24589,10 @@ process.env.NODE_ENV !== "production" ? TablePagination.propTypes /* remove-prop
24609
24589
  } : void 0;
24610
24590
  var TablePagination$1 = TablePagination;
24611
24591
 
24612
- const ControlledPagination$1 = _ref => {
24613
- let {
24614
- apiRef,
24615
- selectionStatus,
24616
- setSelectionStatusType,
24617
- selectionStatusType,
24618
- displaySelection,
24619
- displayPagination,
24620
- paginationModel,
24621
- onPaginationModelChange,
24622
- pageSizeOptions,
24623
- displayRowsPerPage,
24624
- paginationProps,
24625
- rowCount
24626
- } = _ref;
24627
- const totalNumberOfRowsInTable = rowCount;
24628
- const totalRowsLabel = `${selectionStatus.numberOfSelectedRows} row${selectionStatus.numberOfSelectedRows > 1 ? 's' : ''} selected`;
24629
- 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)` : ''}.`;
24630
- return /*#__PURE__*/React__default.createElement(Flexbox, {
24631
- flexDirection: "row",
24632
- alignItems: "center",
24633
- justifyContent: "space-between",
24634
- marginBottom: "7px"
24635
- }, displaySelection ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, selectionStatusType === 'table' ? /*#__PURE__*/React__default.createElement(Text, {
24636
- fontSize: "14px"
24637
- }, "All selectable rows in the table are selected.", ' ', /*#__PURE__*/React__default.createElement(LinkButton, {
24638
- onClick: () => {
24639
- setSelectionStatusType('none');
24640
- apiRef.current.selectRows([], false, true);
24641
- }
24642
- }, "Clear selection.")) : selectionStatus.type === 'page' && selectionStatus.numberOfSelectedRowsInPage != 0 ? /*#__PURE__*/React__default.createElement(Text, {
24643
- fontSize: "14px"
24644
- }, pageRowsLabel, ' ', /*#__PURE__*/React__default.createElement(LinkButton, {
24645
- onClick: () => {
24646
- setSelectionStatusType('table');
24647
- }
24648
- }, "Select all selectable rows in the table.")) : selectionStatus.type === 'other' ? /*#__PURE__*/React__default.createElement(Text, {
24649
- fontSize: "14px"
24650
- }, totalRowsLabel) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$2({
24651
- component: "div",
24652
- count: totalNumberOfRowsInTable,
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 : []
24664
- }, paginationProps)) : null);
24665
- };
24666
-
24667
- const onServerSideSelectionStatusChange = _ref => {
24668
- let {
24669
- newSelectionModel,
24670
- apiRef,
24671
- selectionStatus,
24672
- selectionStatusType,
24673
- setSelectionStatusType,
24674
- isRowSelectable,
24675
- page,
24676
- pageSize
24677
- } = _ref;
24678
- const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref2 => {
24679
- let {
24680
- model
24681
- } = _ref2;
24682
- return isRowSelectable({
24683
- row: model
24684
- });
24685
- }).map(_ref3 => {
24686
- let {
24687
- id
24688
- } = _ref3;
24689
- return id;
24690
- }) : gridPaginatedVisibleSortedGridRowIdsSelector(apiRef);
24691
- const numberOfSelectableRowsInPage = selectableRowsInPage.length;
24692
- const numberOfSelectedRows = newSelectionModel.length;
24693
- const selectedRowsInPage = selectableRowsInPage.filter(rowId => newSelectionModel.includes(rowId));
24694
- const numberOfSelectedRowsInPage = selectedRowsInPage.length;
24695
- const isSamePage = (selectionStatus === null || selectionStatus === void 0 ? void 0 : selectionStatus.current.page) == page;
24696
- const isSamePageSize = (selectionStatus === null || selectionStatus === void 0 ? void 0 : selectionStatus.current.pageSize) == pageSize;
24697
- if (selectionStatusType === 'table') {
24698
- // if we just move across page or pageSize
24699
- if (!isSamePage || !isSamePageSize) {
24700
- selectionStatus.current = {
24701
- type: 'table',
24702
- numberOfSelectedRows,
24703
- numberOfSelectedRowsInPage,
24704
- page,
24705
- pageSize
24706
- };
24707
- }
24708
- // if we selected all selectable rows (as effect of the previous if condition)
24709
- else if (numberOfSelectedRows > 0) {
24710
- setSelectionStatusType('none');
24711
- selectionStatus.current = {
24712
- type: 'none',
24713
- numberOfSelectedRows,
24714
- numberOfSelectedRowsInPage,
24715
- page,
24716
- pageSize
24717
- };
24718
- apiRef.current.selectRows([], false, true);
24719
- }
24720
- return;
24721
- }
24722
- if (selectionStatusType === 'page' && isSamePage && isSamePageSize && numberOfSelectedRowsInPage === numberOfSelectableRowsInPage) {
24723
- setTimeout(() => {
24724
- apiRef.current.selectRows(selectedRowsInPage, false, false);
24725
- }, 0);
24726
- }
24727
- if (numberOfSelectedRowsInPage === numberOfSelectableRowsInPage && numberOfSelectableRowsInPage != 0) {
24728
- setSelectionStatusType('page');
24729
- selectionStatus.current = {
24730
- type: 'page',
24731
- numberOfSelectedRows,
24732
- numberOfSelectedRowsInPage,
24733
- page,
24734
- pageSize
24735
- };
24736
- } else if (numberOfSelectedRows > 0) {
24737
- setSelectionStatusType('other');
24738
- selectionStatus.current = {
24739
- type: 'other',
24740
- numberOfSelectedRows,
24741
- numberOfSelectedRowsInPage,
24742
- page,
24743
- pageSize
24744
- };
24745
- } else {
24746
- setSelectionStatusType('none');
24747
- selectionStatus.current = {
24748
- type: 'none',
24749
- numberOfSelectedRows,
24750
- numberOfSelectedRowsInPage,
24751
- page,
24752
- pageSize
24753
- };
24754
- }
24755
- };
24756
-
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';
24757
24596
  const getSelectableRowsInTable = (apiRef, isRowSelectable) => {
24758
24597
  return isRowSelectable && typeof isRowSelectable === 'function' ? gridFilteredSortedRowEntriesSelector(apiRef).filter(_ref => {
24759
24598
  let {
@@ -24769,8 +24608,7 @@ const getSelectableRowsInTable = (apiRef, isRowSelectable) => {
24769
24608
  return id;
24770
24609
  }) : gridFilteredSortedRowIdsSelector(apiRef);
24771
24610
  };
24772
-
24773
- const ControlledPagination = _ref => {
24611
+ const ControlledPagination = _ref3 => {
24774
24612
  let {
24775
24613
  displaySelection = false,
24776
24614
  displayRowsPerPage = false,
@@ -24782,7 +24620,7 @@ const ControlledPagination = _ref => {
24782
24620
  pageSizeOptions,
24783
24621
  isRowSelectable,
24784
24622
  paginationProps
24785
- } = _ref;
24623
+ } = _ref3;
24786
24624
  const filteredRowsInTable = getSelectableRowsInTable(apiRef);
24787
24625
  const selectableRowsInTable = getSelectableRowsInTable(apiRef, isRowSelectable);
24788
24626
  const numberOfFilteredRowsInTable = filteredRowsInTable.length;
@@ -24822,26 +24660,56 @@ const ControlledPagination = _ref => {
24822
24660
  rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
24823
24661
  }, paginationProps)) : null);
24824
24662
  };
24825
-
24826
- const _excluded$1 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "paginationPlacement", "selectionStatus", "selectionStatusType", "setSelectionStatusType", "apiRef", "isRowSelectable", "paginationModel", "onPaginationModelChange", "pageSizeOptions", "paginationProps", "paginationMode", "rowCount"],
24827
- _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"];
24828
- const COMPONENT_NAME$1 = 'DataGrid';
24829
- const CLASSNAME$1 = 'redsift-datagrid';
24830
- const DEFAULT_PROPS = {
24831
- license: process.env.MUI_LICENSE_KEY,
24832
- 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);
24833
24702
  };
24834
- const Toolbar = _ref => {
24703
+ const Toolbar = _ref5 => {
24835
24704
  let {
24836
24705
  hideToolbar,
24837
24706
  RenderedToolbar,
24838
24707
  filterModel,
24839
24708
  onFilterModelChange,
24840
24709
  pagination,
24710
+ ControlledPagination,
24841
24711
  paginationPlacement,
24842
24712
  selectionStatus,
24843
- selectionStatusType,
24844
- setSelectionStatusType,
24845
24713
  apiRef,
24846
24714
  isRowSelectable,
24847
24715
  paginationModel,
@@ -24850,19 +24718,16 @@ const Toolbar = _ref => {
24850
24718
  paginationProps,
24851
24719
  paginationMode = 'client',
24852
24720
  rowCount
24853
- } = _ref,
24854
- forwardedProps = _objectWithoutProperties(_ref, _excluded$1);
24721
+ } = _ref5,
24722
+ forwardedProps = _objectWithoutProperties(_ref5, _excluded$1);
24855
24723
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, !hideToolbar ? /*#__PURE__*/React__default.createElement(RenderedToolbar, _extends$2({}, forwardedProps, {
24856
24724
  filterModel: filterModel,
24857
24725
  onFilterModelChange: onFilterModelChange
24858
- })) : null, pagination ? paginationMode === 'server' ? /*#__PURE__*/React__default.createElement(ControlledPagination$1, {
24859
- apiRef: apiRef,
24726
+ })) : null, pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, {
24860
24727
  displaySelection: true,
24861
24728
  displayRowsPerPage: false,
24862
24729
  displayPagination: ['top', 'both'].includes(paginationPlacement),
24863
24730
  selectionStatus: selectionStatus.current,
24864
- setSelectionStatusType: setSelectionStatusType,
24865
- selectionStatusType: selectionStatusType,
24866
24731
  paginationModel: paginationModel,
24867
24732
  onPaginationModelChange: onPaginationModelChange,
24868
24733
  pageSizeOptions: pageSizeOptions,
@@ -24881,8 +24746,63 @@ const Toolbar = _ref => {
24881
24746
  paginationProps: paginationProps
24882
24747
  }) : null);
24883
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
+ };
24884
24804
  const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
24885
- 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;
24886
24806
  const datagridRef = ref || useRef();
24887
24807
  const {
24888
24808
  apiRef: propsApiRef,
@@ -24895,22 +24815,21 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
24895
24815
  hideToolbar,
24896
24816
  initialState,
24897
24817
  isRowSelectable,
24898
- license,
24818
+ license = process.env.MUI_LICENSE_KEY,
24899
24819
  onFilterModelChange: propsOnFilterModelChange,
24820
+ rowSelectionModel: propsSelectionModel,
24900
24821
  paginationModel: propsPaginationModel,
24901
24822
  onPaginationModelChange: propsOnPaginationModelChange,
24902
- pageSizeOptions,
24903
- rowSelectionModel: propsRowSelectionModel,
24904
24823
  onRowSelectionModelChange,
24905
24824
  pagination,
24906
- paginationPlacement,
24825
+ paginationPlacement = 'both',
24907
24826
  paginationProps,
24908
24827
  rows,
24828
+ pageSizeOptions,
24909
24829
  sx,
24910
24830
  theme: propsTheme,
24911
24831
  paginationMode = 'client',
24912
- rowCount,
24913
- onSelectionStatusChange: propsOnSelectionStatusChange
24832
+ rowCount
24914
24833
  } = props,
24915
24834
  forwardedProps = _objectWithoutProperties(props, _excluded2);
24916
24835
  const theme = useTheme$4(propsTheme);
@@ -24930,13 +24849,13 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
24930
24849
  setFilterModel(model);
24931
24850
  }
24932
24851
  };
24933
- const [rowSelectionModel, setRowSelectionModel] = useState(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
24852
+ const [rowSelectionModel, setRowSelectionModel] = useState(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
24934
24853
  useEffect(() => {
24935
- setRowSelectionModel(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
24936
- }, [propsRowSelectionModel]);
24854
+ setRowSelectionModel(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
24855
+ }, [propsSelectionModel]);
24937
24856
  const [paginationModel, setPaginationModel] = useState({
24938
- 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,
24939
- 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
24940
24859
  });
24941
24860
  const onPaginationModelChange = model => {
24942
24861
  if (propsOnPaginationModelChange) {
@@ -24950,43 +24869,24 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
24950
24869
  setPaginationModel(propsPaginationModel);
24951
24870
  }
24952
24871
  }, [propsPaginationModel]);
24953
- const [selectionStatusType, setSelectionStatusType] = useState('none');
24954
24872
  const selectionStatus = useRef({
24955
- type: selectionStatusType,
24873
+ type: 'none',
24956
24874
  numberOfSelectedRows: 0,
24957
24875
  numberOfSelectedRowsInPage: 0,
24958
24876
  page: paginationModel.page,
24959
24877
  pageSize: paginationModel.pageSize
24960
24878
  });
24961
- const onSelectionStatusChange = selectionStatusType => {
24962
- if (propsOnSelectionStatusChange) {
24963
- propsOnSelectionStatusChange(selectionStatusType);
24964
- }
24965
- };
24966
- useEffect(() => {
24967
- onSelectionStatusChange(selectionStatusType);
24968
- }, [selectionStatusType]);
24969
24879
 
24970
24880
  // in server-side pagination we want to update the selection status
24971
24881
  // every time we navigate between pages, resize our page or select something
24972
24882
  useEffect(() => {
24973
- if (paginationMode === 'server') {
24974
- onServerSideSelectionStatusChange({
24975
- newSelectionModel: Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel],
24976
- apiRef,
24977
- selectionStatus,
24978
- selectionStatusType,
24979
- setSelectionStatusType,
24980
- isRowSelectable,
24981
- page: paginationModel.page,
24982
- pageSize: paginationModel.pageSize
24983
- });
24883
+ if (paginationMode == 'server') {
24884
+ onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatus, isRowSelectable, paginationModel.page, paginationModel.pageSize);
24984
24885
  }
24985
24886
  }, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
24986
24887
  if (!Array.isArray(rows)) {
24987
24888
  return null;
24988
24889
  }
24989
- const isServerTableSelection = paginationMode === 'server' && selectionStatusType === 'table';
24990
24890
  const muiTheme = useMemo(() => createTheme({
24991
24891
  palette: {
24992
24892
  mode: theme,
@@ -25053,7 +24953,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
25053
24953
  }, props))
25054
24954
  }, slots), {}, {
25055
24955
  toolbar: Toolbar,
25056
- 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, {
25057
24957
  displaySelection: false,
25058
24958
  displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
25059
24959
  displayPagination: ['bottom', 'both'].includes(paginationPlacement),
@@ -25086,10 +24986,9 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
25086
24986
  filterModel,
25087
24987
  onFilterModelChange,
25088
24988
  pagination,
24989
+ ControlledPagination: paginationMode == 'server' ? ServerSideControlledPagination : ControlledPagination,
25089
24990
  paginationPlacement,
25090
24991
  selectionStatus,
25091
- selectionStatusType,
25092
- setSelectionStatusType,
25093
24992
  apiRef,
25094
24993
  isRowSelectable,
25095
24994
  paginationModel,
@@ -25102,43 +25001,43 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
25102
25001
  }),
25103
25002
  filterModel: filterModel,
25104
25003
  initialState: initialState,
25105
- isRowSelectable: !isServerTableSelection ? isRowSelectable : () => false,
25004
+ isRowSelectable: isRowSelectable,
25106
25005
  onFilterModelChange: onFilterModelChange,
25107
25006
  pagination: pagination,
25108
25007
  paginationMode: paginationMode,
25109
- keepNonExistentRowsSelected: paginationMode === 'server',
25008
+ keepNonExistentRowsSelected: paginationMode == 'server',
25110
25009
  rows: rows,
25010
+ pageSizeOptions: pageSizeOptions,
25111
25011
  paginationModel: paginationModel,
25112
25012
  onPaginationModelChange: onPaginationModelChange,
25113
- pageSizeOptions: pageSizeOptions,
25114
- rowSelectionModel: isServerTableSelection ? getSelectableRowsInTable(apiRef, isRowSelectable) : rowSelectionModel,
25013
+ rowSelectionModel: rowSelectionModel,
25115
25014
  onRowSelectionModelChange: (newSelectionModel, details) => {
25116
25015
  if (pagination && paginationMode != 'server') {
25117
- const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref5 => {
25016
+ const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref11 => {
25118
25017
  let {
25119
25018
  model
25120
- } = _ref5;
25019
+ } = _ref11;
25121
25020
  return isRowSelectable({
25122
25021
  row: model
25123
25022
  });
25124
- }).map(_ref6 => {
25023
+ }).map(_ref12 => {
25125
25024
  let {
25126
25025
  id
25127
- } = _ref6;
25026
+ } = _ref12;
25128
25027
  return id;
25129
25028
  }) : gridPaginatedVisibleSortedGridRowIdsSelector(apiRef);
25130
25029
  const numberOfSelectableRowsInPage = selectableRowsInPage.length;
25131
- const selectableRowsInTable = isRowSelectable ? gridFilteredSortedRowEntriesSelector(apiRef).filter(_ref7 => {
25030
+ const selectableRowsInTable = isRowSelectable ? gridFilteredSortedRowEntriesSelector(apiRef).filter(_ref13 => {
25132
25031
  let {
25133
25032
  model
25134
- } = _ref7;
25033
+ } = _ref13;
25135
25034
  return isRowSelectable({
25136
25035
  row: model
25137
25036
  });
25138
- }).map(_ref8 => {
25037
+ }).map(_ref14 => {
25139
25038
  let {
25140
25039
  id
25141
- } = _ref8;
25040
+ } = _ref14;
25142
25041
  return id;
25143
25042
  }) : gridFilteredSortedRowIdsSelector(apiRef);
25144
25043
  const numberOfSelectableRowsInTable = selectableRowsInTable.length;
@@ -25149,25 +25048,21 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
25149
25048
  }, 0);
25150
25049
  }
25151
25050
  if (numberOfSelectedRows === numberOfSelectableRowsInPage && numberOfSelectableRowsInPage < numberOfSelectableRowsInTable) {
25152
- setSelectionStatusType('page');
25153
25051
  selectionStatus.current = {
25154
25052
  type: 'page',
25155
25053
  numberOfSelectedRows
25156
25054
  };
25157
25055
  } else if (numberOfSelectedRows === numberOfSelectableRowsInTable && numberOfSelectableRowsInPage < numberOfSelectableRowsInTable) {
25158
- setSelectionStatusType('table');
25159
25056
  selectionStatus.current = {
25160
25057
  type: 'table',
25161
25058
  numberOfSelectedRows
25162
25059
  };
25163
25060
  } else if (numberOfSelectedRows > 0) {
25164
- setSelectionStatusType('other');
25165
25061
  selectionStatus.current = {
25166
25062
  type: 'other',
25167
25063
  numberOfSelectedRows
25168
25064
  };
25169
25065
  } else {
25170
- setSelectionStatusType('none');
25171
25066
  selectionStatus.current = {
25172
25067
  type: 'none',
25173
25068
  numberOfSelectedRows
@@ -25176,11 +25071,18 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
25176
25071
  }
25177
25072
  onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
25178
25073
  },
25179
- 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
+ })
25180
25083
  })))));
25181
25084
  });
25182
25085
  DataGrid.className = CLASSNAME$1;
25183
- DataGrid.defaultProps = DEFAULT_PROPS;
25184
25086
  DataGrid.displayName = COMPONENT_NAME$1;
25185
25087
 
25186
25088
  const StyledTextCell = styled$3.div`