@redsift/table 10.2.0 → 10.3.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +4 -2
- package/index.js +344 -254
- package/index.js.map +1 -1
- package/package.json +2 -2
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,
|
|
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';
|
|
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
|
-
import React__default, { Children, isValidElement, cloneElement, useLayoutEffect, useEffect, useRef, forwardRef, useState, useCallback, createElement, useMemo } from 'react';
|
|
6
|
-
import { Icon, baseContainer, Theme, 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,
|
|
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';
|
|
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,76 +17871,6 @@ 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
|
-
|
|
17944
17874
|
/**
|
|
17945
17875
|
* Component style.
|
|
17946
17876
|
*/
|
|
@@ -21685,6 +21615,7 @@ const TooltipContent = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
21685
21615
|
style,
|
|
21686
21616
|
theme: propsTheme
|
|
21687
21617
|
} = props;
|
|
21618
|
+
const appContainerState = useContext(AppContainerContext);
|
|
21688
21619
|
const {
|
|
21689
21620
|
getFloatingProps,
|
|
21690
21621
|
isOpen,
|
|
@@ -21712,7 +21643,7 @@ const TooltipContent = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
21712
21643
|
left: 'right'
|
|
21713
21644
|
}[placement.split('-')[0]];
|
|
21714
21645
|
return /*#__PURE__*/React__default.createElement(FloatingPortal, {
|
|
21715
|
-
|
|
21646
|
+
root: appContainerState === null || appContainerState === void 0 ? void 0 : appContainerState.appContainerRef.current
|
|
21716
21647
|
}, isOpen && /*#__PURE__*/React__default.createElement(StyledTooltipContent, _extends$2({
|
|
21717
21648
|
className: classNames(TooltipContent.className, className),
|
|
21718
21649
|
ref: popoverRef,
|
|
@@ -21755,7 +21686,8 @@ const TooltipTrigger = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
21755
21686
|
const {
|
|
21756
21687
|
getReferenceProps,
|
|
21757
21688
|
refs,
|
|
21758
|
-
tooltipId
|
|
21689
|
+
tooltipId,
|
|
21690
|
+
triggerClassName
|
|
21759
21691
|
} = useTooltipContext();
|
|
21760
21692
|
const childrenRef = children.ref;
|
|
21761
21693
|
const triggerRef = useMergeRefs([refs.setReference, ref, childrenRef]);
|
|
@@ -21766,7 +21698,8 @@ const TooltipTrigger = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
21766
21698
|
}, props), {}, {
|
|
21767
21699
|
'aria-describedby': tooltipId
|
|
21768
21700
|
}, children.props), {}, {
|
|
21769
|
-
children: (_children$props$child = children.props.children) !== null && _children$props$child !== void 0 ? _children$props$child : ''
|
|
21701
|
+
children: (_children$props$child = children.props.children) !== null && _children$props$child !== void 0 ? _children$props$child : '',
|
|
21702
|
+
className: classNames(children.props.className, triggerClassName)
|
|
21770
21703
|
}))));
|
|
21771
21704
|
}
|
|
21772
21705
|
return /*#__PURE__*/React__default.createElement("span", _extends$2({
|
|
@@ -21784,7 +21717,8 @@ function useTooltip(_ref) {
|
|
|
21784
21717
|
placement,
|
|
21785
21718
|
isOpen: propsIsOpen,
|
|
21786
21719
|
onOpen,
|
|
21787
|
-
tooltipId: propsTooltipId
|
|
21720
|
+
tooltipId: propsTooltipId,
|
|
21721
|
+
triggerClassName
|
|
21788
21722
|
} = _ref;
|
|
21789
21723
|
const arrowRef = useRef(null);
|
|
21790
21724
|
const [isOpen, setIsOpen] = useState(propsIsOpen !== null && propsIsOpen !== void 0 ? propsIsOpen : defaultOpen);
|
|
@@ -21834,8 +21768,9 @@ function useTooltip(_ref) {
|
|
|
21834
21768
|
handleOpen
|
|
21835
21769
|
}, interactions), data), {}, {
|
|
21836
21770
|
arrowRef,
|
|
21837
|
-
tooltipId
|
|
21838
|
-
|
|
21771
|
+
tooltipId,
|
|
21772
|
+
triggerClassName
|
|
21773
|
+
}), [isOpen, handleOpen, interactions, data, arrowRef, tooltipId, triggerClassName]);
|
|
21839
21774
|
}
|
|
21840
21775
|
|
|
21841
21776
|
const ThemeContext = /*#__PURE__*/React__default.createContext(null);
|
|
@@ -21860,7 +21795,8 @@ const BaseTooltip = props => {
|
|
|
21860
21795
|
onOpen,
|
|
21861
21796
|
placement,
|
|
21862
21797
|
tooltipId,
|
|
21863
|
-
theme: propsTheme
|
|
21798
|
+
theme: propsTheme,
|
|
21799
|
+
triggerClassName
|
|
21864
21800
|
} = props;
|
|
21865
21801
|
const theme = useTheme$4 ? useTheme$4(propsTheme) : undefined;
|
|
21866
21802
|
const tooltip = useTooltip({
|
|
@@ -21870,7 +21806,8 @@ const BaseTooltip = props => {
|
|
|
21870
21806
|
isOpen,
|
|
21871
21807
|
onOpen,
|
|
21872
21808
|
tooltipId,
|
|
21873
|
-
theme
|
|
21809
|
+
theme,
|
|
21810
|
+
triggerClassName
|
|
21874
21811
|
});
|
|
21875
21812
|
const [[trigger], [content]] = partitionComponents(React__default.Children.toArray(children), [isComponent('TooltipTrigger'), isComponent('TooltipContent')]);
|
|
21876
21813
|
return /*#__PURE__*/React__default.createElement(ThemeProvider, {
|
|
@@ -22154,33 +22091,7 @@ const Toolbar$3 = props => {
|
|
|
22154
22091
|
}, semanticFilterProps ? /*#__PURE__*/React__default.createElement(GridToolbarFilterSemanticField, semanticFilterProps) : null)));
|
|
22155
22092
|
};
|
|
22156
22093
|
|
|
22157
|
-
const _excluded$d = ["
|
|
22158
|
-
const muiIconToDSIcon = {
|
|
22159
|
-
ColumnFilteredIcon: mdiFilterVariant,
|
|
22160
|
-
ColumnSelectorIcon: mdiViewColumn,
|
|
22161
|
-
ColumnSortedAscendingIcon: mdiChevronUp,
|
|
22162
|
-
ColumnSortedDescendingIcon: mdiChevronDown,
|
|
22163
|
-
DensityCompactIcon: mdiViewHeadline,
|
|
22164
|
-
DensityStandardIcon: mdiViewSequential,
|
|
22165
|
-
DensityComfortableIcon: mdiViewStream,
|
|
22166
|
-
DetailPanelCollapseIcon: mdiChevronDown,
|
|
22167
|
-
DetailPanelExpandIcon: mdiChevronRight,
|
|
22168
|
-
ExportIcon: mdiTrayArrowDown,
|
|
22169
|
-
OpenFilterButtonIcon: mdiFilterVariant
|
|
22170
|
-
};
|
|
22171
|
-
const BaseIcon = /*#__PURE__*/forwardRef((props, ref) => {
|
|
22172
|
-
const {
|
|
22173
|
-
displayName
|
|
22174
|
-
} = props,
|
|
22175
|
-
forwardedProps = _objectWithoutProperties(props, _excluded$d);
|
|
22176
|
-
return /*#__PURE__*/React__default.createElement(Icon, _extends$2({}, forwardedProps, forwardedProps.inputProps, {
|
|
22177
|
-
ref: ref,
|
|
22178
|
-
size: forwardedProps.fontSize,
|
|
22179
|
-
icon: muiIconToDSIcon[displayName]
|
|
22180
|
-
}));
|
|
22181
|
-
});
|
|
22182
|
-
|
|
22183
|
-
const _excluded$c = ["children", "color", "onClick", "startIcon"];
|
|
22094
|
+
const _excluded$d = ["children", "color", "onClick", "startIcon"];
|
|
22184
22095
|
const BaseButton = /*#__PURE__*/forwardRef((props, ref) => {
|
|
22185
22096
|
var _props$className;
|
|
22186
22097
|
const {
|
|
@@ -22189,7 +22100,7 @@ const BaseButton = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
22189
22100
|
onClick,
|
|
22190
22101
|
startIcon
|
|
22191
22102
|
} = props,
|
|
22192
|
-
forwardedProps = _objectWithoutProperties(props, _excluded$
|
|
22103
|
+
forwardedProps = _objectWithoutProperties(props, _excluded$d);
|
|
22193
22104
|
const color = Object.keys(ButtonsColorPalette).includes(propsColor) ? propsColor : 'primary';
|
|
22194
22105
|
if ((_props$className = props.className) !== null && _props$className !== void 0 && _props$className.includes('redsift-condensed')) {
|
|
22195
22106
|
return /*#__PURE__*/React__default.createElement(IconButton$2, _extends$2({}, forwardedProps, {
|
|
@@ -22215,7 +22126,7 @@ const BaseButton = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
22215
22126
|
}), children);
|
|
22216
22127
|
});
|
|
22217
22128
|
|
|
22218
|
-
const _excluded$
|
|
22129
|
+
const _excluded$c = ["checked", "indeterminate", "disabled", "onChange"];
|
|
22219
22130
|
const BaseCheckbox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
22220
22131
|
const {
|
|
22221
22132
|
checked,
|
|
@@ -22223,7 +22134,7 @@ const BaseCheckbox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
22223
22134
|
disabled,
|
|
22224
22135
|
onChange
|
|
22225
22136
|
} = props,
|
|
22226
|
-
forwardedProps = _objectWithoutProperties(props, _excluded$
|
|
22137
|
+
forwardedProps = _objectWithoutProperties(props, _excluded$c);
|
|
22227
22138
|
return /*#__PURE__*/React__default.createElement(Checkbox, _extends$2({}, forwardedProps, forwardedProps.inputProps, {
|
|
22228
22139
|
isSelected: checked && !indeterminate,
|
|
22229
22140
|
isDisabled: disabled,
|
|
@@ -22233,6 +22144,32 @@ const BaseCheckbox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
22233
22144
|
}));
|
|
22234
22145
|
});
|
|
22235
22146
|
|
|
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
|
+
|
|
22236
22173
|
const _excluded$a = ["anchorEl", "component", "components", "componentsProps", "container", "disablePortal", "keepMounted", "modifiers", "open", "placement", "popperOptions", "popperRef", "transition", "slots", "slotProps"];
|
|
22237
22174
|
const PopperRoot = styled$1(BasePopper$1, {
|
|
22238
22175
|
name: 'MuiPopper',
|
|
@@ -22434,6 +22371,86 @@ const BasePopper = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
22434
22371
|
}));
|
|
22435
22372
|
});
|
|
22436
22373
|
|
|
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
|
+
|
|
22437
22454
|
function Ripple(props) {
|
|
22438
22455
|
const {
|
|
22439
22456
|
className,
|
|
@@ -24592,14 +24609,151 @@ process.env.NODE_ENV !== "production" ? TablePagination.propTypes /* remove-prop
|
|
|
24592
24609
|
} : void 0;
|
|
24593
24610
|
var TablePagination$1 = TablePagination;
|
|
24594
24611
|
|
|
24595
|
-
const
|
|
24596
|
-
|
|
24597
|
-
|
|
24598
|
-
|
|
24599
|
-
|
|
24600
|
-
|
|
24601
|
-
|
|
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);
|
|
24602
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
|
+
|
|
24603
24757
|
const getSelectableRowsInTable = (apiRef, isRowSelectable) => {
|
|
24604
24758
|
return isRowSelectable && typeof isRowSelectable === 'function' ? gridFilteredSortedRowEntriesSelector(apiRef).filter(_ref => {
|
|
24605
24759
|
let {
|
|
@@ -24615,7 +24769,8 @@ const getSelectableRowsInTable = (apiRef, isRowSelectable) => {
|
|
|
24615
24769
|
return id;
|
|
24616
24770
|
}) : gridFilteredSortedRowIdsSelector(apiRef);
|
|
24617
24771
|
};
|
|
24618
|
-
|
|
24772
|
+
|
|
24773
|
+
const ControlledPagination = _ref => {
|
|
24619
24774
|
let {
|
|
24620
24775
|
displaySelection = false,
|
|
24621
24776
|
displayRowsPerPage = false,
|
|
@@ -24627,7 +24782,7 @@ const ControlledPagination = _ref3 => {
|
|
|
24627
24782
|
pageSizeOptions,
|
|
24628
24783
|
isRowSelectable,
|
|
24629
24784
|
paginationProps
|
|
24630
|
-
} =
|
|
24785
|
+
} = _ref;
|
|
24631
24786
|
const filteredRowsInTable = getSelectableRowsInTable(apiRef);
|
|
24632
24787
|
const selectableRowsInTable = getSelectableRowsInTable(apiRef, isRowSelectable);
|
|
24633
24788
|
const numberOfFilteredRowsInTable = filteredRowsInTable.length;
|
|
@@ -24667,56 +24822,26 @@ const ControlledPagination = _ref3 => {
|
|
|
24667
24822
|
rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
|
|
24668
24823
|
}, paginationProps)) : null);
|
|
24669
24824
|
};
|
|
24670
|
-
|
|
24671
|
-
|
|
24672
|
-
|
|
24673
|
-
|
|
24674
|
-
|
|
24675
|
-
|
|
24676
|
-
|
|
24677
|
-
|
|
24678
|
-
displayRowsPerPage,
|
|
24679
|
-
paginationProps,
|
|
24680
|
-
rowCount
|
|
24681
|
-
} = _ref4;
|
|
24682
|
-
const totalNumberOfRowsInTable = rowCount;
|
|
24683
|
-
const totalRowsLabel = `${selectionStatus.numberOfSelectedRows} row${selectionStatus.numberOfSelectedRows > 1 ? 's' : ''} selected`;
|
|
24684
|
-
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)` : ''}.`;
|
|
24685
|
-
return /*#__PURE__*/React__default.createElement(Flexbox, {
|
|
24686
|
-
flexDirection: "row",
|
|
24687
|
-
alignItems: "center",
|
|
24688
|
-
justifyContent: "space-between",
|
|
24689
|
-
marginBottom: "7px"
|
|
24690
|
-
}, displaySelection ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, selectionStatus.type === 'page' && selectionStatus.numberOfSelectedRowsInPage != 0 ? /*#__PURE__*/React__default.createElement(Text, {
|
|
24691
|
-
fontSize: "14px"
|
|
24692
|
-
}, pageRowsLabel) : selectionStatus.type === 'other' ? /*#__PURE__*/React__default.createElement(Text, {
|
|
24693
|
-
fontSize: "14px"
|
|
24694
|
-
}, totalRowsLabel) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$2({
|
|
24695
|
-
component: "div",
|
|
24696
|
-
count: totalNumberOfRowsInTable,
|
|
24697
|
-
page: paginationModel.page,
|
|
24698
|
-
onPageChange: (event, page) => onPaginationModelChange({
|
|
24699
|
-
page,
|
|
24700
|
-
pageSize: paginationModel.pageSize
|
|
24701
|
-
}),
|
|
24702
|
-
rowsPerPage: paginationModel.pageSize,
|
|
24703
|
-
onRowsPerPageChange: event => onPaginationModelChange({
|
|
24704
|
-
page: paginationModel.page,
|
|
24705
|
-
pageSize: parseInt(event.target.value, 10)
|
|
24706
|
-
}),
|
|
24707
|
-
rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
|
|
24708
|
-
}, paginationProps)) : null);
|
|
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'
|
|
24709
24833
|
};
|
|
24710
|
-
const Toolbar =
|
|
24834
|
+
const Toolbar = _ref => {
|
|
24711
24835
|
let {
|
|
24712
24836
|
hideToolbar,
|
|
24713
24837
|
RenderedToolbar,
|
|
24714
24838
|
filterModel,
|
|
24715
24839
|
onFilterModelChange,
|
|
24716
24840
|
pagination,
|
|
24717
|
-
ControlledPagination,
|
|
24718
24841
|
paginationPlacement,
|
|
24719
24842
|
selectionStatus,
|
|
24843
|
+
selectionStatusType,
|
|
24844
|
+
setSelectionStatusType,
|
|
24720
24845
|
apiRef,
|
|
24721
24846
|
isRowSelectable,
|
|
24722
24847
|
paginationModel,
|
|
@@ -24725,16 +24850,19 @@ const Toolbar = _ref5 => {
|
|
|
24725
24850
|
paginationProps,
|
|
24726
24851
|
paginationMode = 'client',
|
|
24727
24852
|
rowCount
|
|
24728
|
-
} =
|
|
24729
|
-
forwardedProps = _objectWithoutProperties(
|
|
24853
|
+
} = _ref,
|
|
24854
|
+
forwardedProps = _objectWithoutProperties(_ref, _excluded$1);
|
|
24730
24855
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, !hideToolbar ? /*#__PURE__*/React__default.createElement(RenderedToolbar, _extends$2({}, forwardedProps, {
|
|
24731
24856
|
filterModel: filterModel,
|
|
24732
24857
|
onFilterModelChange: onFilterModelChange
|
|
24733
|
-
})) : null, pagination ? paginationMode
|
|
24858
|
+
})) : null, pagination ? paginationMode === 'server' ? /*#__PURE__*/React__default.createElement(ControlledPagination$1, {
|
|
24859
|
+
apiRef: apiRef,
|
|
24734
24860
|
displaySelection: true,
|
|
24735
24861
|
displayRowsPerPage: false,
|
|
24736
24862
|
displayPagination: ['top', 'both'].includes(paginationPlacement),
|
|
24737
24863
|
selectionStatus: selectionStatus.current,
|
|
24864
|
+
setSelectionStatusType: setSelectionStatusType,
|
|
24865
|
+
selectionStatusType: selectionStatusType,
|
|
24738
24866
|
paginationModel: paginationModel,
|
|
24739
24867
|
onPaginationModelChange: onPaginationModelChange,
|
|
24740
24868
|
pageSizeOptions: pageSizeOptions,
|
|
@@ -24753,63 +24881,8 @@ const Toolbar = _ref5 => {
|
|
|
24753
24881
|
paginationProps: paginationProps
|
|
24754
24882
|
}) : null);
|
|
24755
24883
|
};
|
|
24756
|
-
const onServerSideSelectionStatusChange = (newSelectionModel, apiRef, selectionStatus, isRowSelectable, page, pageSize) => {
|
|
24757
|
-
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref6 => {
|
|
24758
|
-
let {
|
|
24759
|
-
model
|
|
24760
|
-
} = _ref6;
|
|
24761
|
-
return isRowSelectable({
|
|
24762
|
-
row: model
|
|
24763
|
-
});
|
|
24764
|
-
}).map(_ref7 => {
|
|
24765
|
-
let {
|
|
24766
|
-
id
|
|
24767
|
-
} = _ref7;
|
|
24768
|
-
return id;
|
|
24769
|
-
}) : gridPaginatedVisibleSortedGridRowIdsSelector(apiRef);
|
|
24770
|
-
const numberOfSelectableRowsInPage = selectableRowsInPage.length;
|
|
24771
|
-
const numberOfSelectedRows = newSelectionModel.length;
|
|
24772
|
-
const selectedRowsInPage = selectableRowsInPage.filter(rowId => newSelectionModel.includes(rowId));
|
|
24773
|
-
const numberOfSelectedRowsInPage = selectedRowsInPage.length;
|
|
24774
|
-
const isSamePage = (selectionStatus === null || selectionStatus === void 0 ? void 0 : selectionStatus.current.page) == page;
|
|
24775
|
-
const isSamePageSize = (selectionStatus === null || selectionStatus === void 0 ? void 0 : selectionStatus.current.pageSize) == pageSize;
|
|
24776
|
-
|
|
24777
|
-
// if previous status is `page`,
|
|
24778
|
-
// if page and pageSize didn't change
|
|
24779
|
-
// and all the rows are selected, deselect all row
|
|
24780
|
-
if (selectionStatus.current.type === 'page' && isSamePage && isSamePageSize && numberOfSelectedRowsInPage === numberOfSelectableRowsInPage) {
|
|
24781
|
-
setTimeout(() => {
|
|
24782
|
-
apiRef.current.selectRows(selectedRowsInPage, false, false);
|
|
24783
|
-
}, 0);
|
|
24784
|
-
}
|
|
24785
|
-
if (numberOfSelectedRowsInPage === numberOfSelectableRowsInPage && numberOfSelectableRowsInPage != 0) {
|
|
24786
|
-
selectionStatus.current = {
|
|
24787
|
-
type: 'page',
|
|
24788
|
-
numberOfSelectedRows,
|
|
24789
|
-
numberOfSelectedRowsInPage,
|
|
24790
|
-
page,
|
|
24791
|
-
pageSize
|
|
24792
|
-
};
|
|
24793
|
-
} else if (numberOfSelectedRows > 0) {
|
|
24794
|
-
selectionStatus.current = {
|
|
24795
|
-
type: 'other',
|
|
24796
|
-
numberOfSelectedRows,
|
|
24797
|
-
numberOfSelectedRowsInPage,
|
|
24798
|
-
page,
|
|
24799
|
-
pageSize
|
|
24800
|
-
};
|
|
24801
|
-
} else {
|
|
24802
|
-
selectionStatus.current = {
|
|
24803
|
-
type: 'none',
|
|
24804
|
-
numberOfSelectedRows,
|
|
24805
|
-
numberOfSelectedRowsInPage,
|
|
24806
|
-
page,
|
|
24807
|
-
pageSize
|
|
24808
|
-
};
|
|
24809
|
-
}
|
|
24810
|
-
};
|
|
24811
24884
|
const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
24812
|
-
var
|
|
24885
|
+
var _ref2, _ref3, _initialState$paginat, _initialState$paginat2, _initialState$paginat3, _pageSizeOptions$, _ref4, _initialState$paginat4, _initialState$paginat5, _initialState$paginat6;
|
|
24813
24886
|
const datagridRef = ref || useRef();
|
|
24814
24887
|
const {
|
|
24815
24888
|
apiRef: propsApiRef,
|
|
@@ -24824,19 +24897,20 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24824
24897
|
isRowSelectable,
|
|
24825
24898
|
license,
|
|
24826
24899
|
onFilterModelChange: propsOnFilterModelChange,
|
|
24827
|
-
rowSelectionModel: propsSelectionModel,
|
|
24828
24900
|
paginationModel: propsPaginationModel,
|
|
24829
24901
|
onPaginationModelChange: propsOnPaginationModelChange,
|
|
24902
|
+
pageSizeOptions,
|
|
24903
|
+
rowSelectionModel: propsRowSelectionModel,
|
|
24830
24904
|
onRowSelectionModelChange,
|
|
24831
24905
|
pagination,
|
|
24832
24906
|
paginationPlacement,
|
|
24833
24907
|
paginationProps,
|
|
24834
24908
|
rows,
|
|
24835
|
-
pageSizeOptions,
|
|
24836
24909
|
sx,
|
|
24837
24910
|
theme: propsTheme,
|
|
24838
24911
|
paginationMode = 'client',
|
|
24839
|
-
rowCount
|
|
24912
|
+
rowCount,
|
|
24913
|
+
onSelectionStatusChange: propsOnSelectionStatusChange
|
|
24840
24914
|
} = props,
|
|
24841
24915
|
forwardedProps = _objectWithoutProperties(props, _excluded2);
|
|
24842
24916
|
const theme = useTheme$4(propsTheme);
|
|
@@ -24856,13 +24930,13 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24856
24930
|
setFilterModel(model);
|
|
24857
24931
|
}
|
|
24858
24932
|
};
|
|
24859
|
-
const [rowSelectionModel, setRowSelectionModel] = useState(
|
|
24933
|
+
const [rowSelectionModel, setRowSelectionModel] = useState(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
24860
24934
|
useEffect(() => {
|
|
24861
|
-
setRowSelectionModel(
|
|
24862
|
-
}, [
|
|
24935
|
+
setRowSelectionModel(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
24936
|
+
}, [propsRowSelectionModel]);
|
|
24863
24937
|
const [paginationModel, setPaginationModel] = useState({
|
|
24864
|
-
pageSize: (
|
|
24865
|
-
page: (
|
|
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
|
|
24866
24940
|
});
|
|
24867
24941
|
const onPaginationModelChange = model => {
|
|
24868
24942
|
if (propsOnPaginationModelChange) {
|
|
@@ -24876,24 +24950,43 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24876
24950
|
setPaginationModel(propsPaginationModel);
|
|
24877
24951
|
}
|
|
24878
24952
|
}, [propsPaginationModel]);
|
|
24953
|
+
const [selectionStatusType, setSelectionStatusType] = useState('none');
|
|
24879
24954
|
const selectionStatus = useRef({
|
|
24880
|
-
type:
|
|
24955
|
+
type: selectionStatusType,
|
|
24881
24956
|
numberOfSelectedRows: 0,
|
|
24882
24957
|
numberOfSelectedRowsInPage: 0,
|
|
24883
24958
|
page: paginationModel.page,
|
|
24884
24959
|
pageSize: paginationModel.pageSize
|
|
24885
24960
|
});
|
|
24961
|
+
const onSelectionStatusChange = selectionStatusType => {
|
|
24962
|
+
if (propsOnSelectionStatusChange) {
|
|
24963
|
+
propsOnSelectionStatusChange(selectionStatusType);
|
|
24964
|
+
}
|
|
24965
|
+
};
|
|
24966
|
+
useEffect(() => {
|
|
24967
|
+
onSelectionStatusChange(selectionStatusType);
|
|
24968
|
+
}, [selectionStatusType]);
|
|
24886
24969
|
|
|
24887
24970
|
// in server-side pagination we want to update the selection status
|
|
24888
24971
|
// every time we navigate between pages, resize our page or select something
|
|
24889
24972
|
useEffect(() => {
|
|
24890
|
-
if (paginationMode
|
|
24891
|
-
onServerSideSelectionStatusChange(
|
|
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
|
+
});
|
|
24892
24984
|
}
|
|
24893
24985
|
}, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
|
|
24894
24986
|
if (!Array.isArray(rows)) {
|
|
24895
24987
|
return null;
|
|
24896
24988
|
}
|
|
24989
|
+
const isServerTableSelection = paginationMode === 'server' && selectionStatusType === 'table';
|
|
24897
24990
|
const muiTheme = useMemo(() => createTheme({
|
|
24898
24991
|
palette: {
|
|
24899
24992
|
mode: theme,
|
|
@@ -24960,7 +25053,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24960
25053
|
}, props))
|
|
24961
25054
|
}, slots), {}, {
|
|
24962
25055
|
toolbar: Toolbar,
|
|
24963
|
-
pagination: props => pagination ? paginationMode
|
|
25056
|
+
pagination: props => pagination ? paginationMode === 'server' ? /*#__PURE__*/React__default.createElement(ControlledPagination$1, _extends$2({}, props, {
|
|
24964
25057
|
displaySelection: false,
|
|
24965
25058
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
24966
25059
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
@@ -24993,9 +25086,10 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24993
25086
|
filterModel,
|
|
24994
25087
|
onFilterModelChange,
|
|
24995
25088
|
pagination,
|
|
24996
|
-
ControlledPagination: paginationMode == 'server' ? ServerSideControlledPagination : ControlledPagination,
|
|
24997
25089
|
paginationPlacement,
|
|
24998
25090
|
selectionStatus,
|
|
25091
|
+
selectionStatusType,
|
|
25092
|
+
setSelectionStatusType,
|
|
24999
25093
|
apiRef,
|
|
25000
25094
|
isRowSelectable,
|
|
25001
25095
|
paginationModel,
|
|
@@ -25008,43 +25102,43 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
25008
25102
|
}),
|
|
25009
25103
|
filterModel: filterModel,
|
|
25010
25104
|
initialState: initialState,
|
|
25011
|
-
isRowSelectable: isRowSelectable,
|
|
25105
|
+
isRowSelectable: !isServerTableSelection ? isRowSelectable : () => false,
|
|
25012
25106
|
onFilterModelChange: onFilterModelChange,
|
|
25013
25107
|
pagination: pagination,
|
|
25014
25108
|
paginationMode: paginationMode,
|
|
25015
|
-
keepNonExistentRowsSelected: paginationMode
|
|
25109
|
+
keepNonExistentRowsSelected: paginationMode === 'server',
|
|
25016
25110
|
rows: rows,
|
|
25017
|
-
pageSizeOptions: pageSizeOptions,
|
|
25018
25111
|
paginationModel: paginationModel,
|
|
25019
25112
|
onPaginationModelChange: onPaginationModelChange,
|
|
25020
|
-
|
|
25113
|
+
pageSizeOptions: pageSizeOptions,
|
|
25114
|
+
rowSelectionModel: isServerTableSelection ? getSelectableRowsInTable(apiRef, isRowSelectable) : rowSelectionModel,
|
|
25021
25115
|
onRowSelectionModelChange: (newSelectionModel, details) => {
|
|
25022
25116
|
if (pagination && paginationMode != 'server') {
|
|
25023
|
-
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(
|
|
25117
|
+
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref5 => {
|
|
25024
25118
|
let {
|
|
25025
25119
|
model
|
|
25026
|
-
} =
|
|
25120
|
+
} = _ref5;
|
|
25027
25121
|
return isRowSelectable({
|
|
25028
25122
|
row: model
|
|
25029
25123
|
});
|
|
25030
|
-
}).map(
|
|
25124
|
+
}).map(_ref6 => {
|
|
25031
25125
|
let {
|
|
25032
25126
|
id
|
|
25033
|
-
} =
|
|
25127
|
+
} = _ref6;
|
|
25034
25128
|
return id;
|
|
25035
25129
|
}) : gridPaginatedVisibleSortedGridRowIdsSelector(apiRef);
|
|
25036
25130
|
const numberOfSelectableRowsInPage = selectableRowsInPage.length;
|
|
25037
|
-
const selectableRowsInTable = isRowSelectable ? gridFilteredSortedRowEntriesSelector(apiRef).filter(
|
|
25131
|
+
const selectableRowsInTable = isRowSelectable ? gridFilteredSortedRowEntriesSelector(apiRef).filter(_ref7 => {
|
|
25038
25132
|
let {
|
|
25039
25133
|
model
|
|
25040
|
-
} =
|
|
25134
|
+
} = _ref7;
|
|
25041
25135
|
return isRowSelectable({
|
|
25042
25136
|
row: model
|
|
25043
25137
|
});
|
|
25044
|
-
}).map(
|
|
25138
|
+
}).map(_ref8 => {
|
|
25045
25139
|
let {
|
|
25046
25140
|
id
|
|
25047
|
-
} =
|
|
25141
|
+
} = _ref8;
|
|
25048
25142
|
return id;
|
|
25049
25143
|
}) : gridFilteredSortedRowIdsSelector(apiRef);
|
|
25050
25144
|
const numberOfSelectableRowsInTable = selectableRowsInTable.length;
|
|
@@ -25055,21 +25149,25 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
25055
25149
|
}, 0);
|
|
25056
25150
|
}
|
|
25057
25151
|
if (numberOfSelectedRows === numberOfSelectableRowsInPage && numberOfSelectableRowsInPage < numberOfSelectableRowsInTable) {
|
|
25152
|
+
setSelectionStatusType('page');
|
|
25058
25153
|
selectionStatus.current = {
|
|
25059
25154
|
type: 'page',
|
|
25060
25155
|
numberOfSelectedRows
|
|
25061
25156
|
};
|
|
25062
25157
|
} else if (numberOfSelectedRows === numberOfSelectableRowsInTable && numberOfSelectableRowsInPage < numberOfSelectableRowsInTable) {
|
|
25158
|
+
setSelectionStatusType('table');
|
|
25063
25159
|
selectionStatus.current = {
|
|
25064
25160
|
type: 'table',
|
|
25065
25161
|
numberOfSelectedRows
|
|
25066
25162
|
};
|
|
25067
25163
|
} else if (numberOfSelectedRows > 0) {
|
|
25164
|
+
setSelectionStatusType('other');
|
|
25068
25165
|
selectionStatus.current = {
|
|
25069
25166
|
type: 'other',
|
|
25070
25167
|
numberOfSelectedRows
|
|
25071
25168
|
};
|
|
25072
25169
|
} else {
|
|
25170
|
+
setSelectionStatusType('none');
|
|
25073
25171
|
selectionStatus.current = {
|
|
25074
25172
|
type: 'none',
|
|
25075
25173
|
numberOfSelectedRows
|
|
@@ -25078,15 +25176,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
25078
25176
|
}
|
|
25079
25177
|
onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
|
|
25080
25178
|
},
|
|
25081
|
-
sx: _objectSpread2(_objectSpread2({}, sx),
|
|
25082
|
-
'.MuiDataGrid-columnHeaders': {
|
|
25083
|
-
flexDirection: 'column',
|
|
25084
|
-
alignItems: 'normal'
|
|
25085
|
-
},
|
|
25086
|
-
'.MuiDataGrid-selectedRowCount': {
|
|
25087
|
-
margin: 'none'
|
|
25088
|
-
}
|
|
25089
|
-
})
|
|
25179
|
+
sx: _objectSpread2(_objectSpread2({}, sx), defaultSxStyle)
|
|
25090
25180
|
})))));
|
|
25091
25181
|
});
|
|
25092
25182
|
DataGrid.className = CLASSNAME$1;
|