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