@redsift/table 10.2.0-muiv5 → 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 +10 -7
- package/index.js +440 -372
- package/index.js.map +1 -1
- package/package.json +4 -4
package/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { GRID_DETAIL_PANEL_TOGGLE_COL_DEF, getGridNumericOperators as getGridNumericOperators$1, GridFilterInputMultipleValue, getGridStringOperators as getGridStringOperators$1, GridToolbarContainer, GridToolbarFilterButton, GridToolbarColumnsButton, GridToolbarDensitySelector, GridToolbarExport,
|
|
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
|
+
export * from '@mui/x-data-grid-pro';
|
|
2
3
|
export { getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators } from '@mui/x-data-grid-pro';
|
|
3
4
|
import * as React from 'react';
|
|
4
|
-
import React__default, { Children, isValidElement, cloneElement, useLayoutEffect, useEffect, useRef, forwardRef, useState, useCallback, createElement, useMemo } from 'react';
|
|
5
|
-
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';
|
|
6
7
|
import { mdiSync, mdiFilterVariant, mdiViewColumn, mdiChevronUp, mdiChevronDown, mdiViewHeadline, mdiViewSequential, mdiViewStream, mdiChevronRight, mdiTrayArrowDown } from '@redsift/icons';
|
|
7
8
|
import emStyled from '@emotion/styled';
|
|
8
9
|
import { Global, ThemeContext as ThemeContext$3, keyframes } from '@emotion/react';
|
|
@@ -17639,7 +17640,7 @@ const isBetweenOperator = {
|
|
|
17639
17640
|
label: 'is between',
|
|
17640
17641
|
value: 'isBetween',
|
|
17641
17642
|
getApplyFilterFn: filterItem => {
|
|
17642
|
-
if (!filterItem.
|
|
17643
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
17643
17644
|
return null;
|
|
17644
17645
|
}
|
|
17645
17646
|
if (!Array.isArray(filterItem.value) || filterItem.value.length !== 2) {
|
|
@@ -17652,7 +17653,7 @@ const isBetweenOperator = {
|
|
|
17652
17653
|
return null;
|
|
17653
17654
|
}
|
|
17654
17655
|
return params => {
|
|
17655
|
-
return params.value !== null && filterItem.value[0] <= params.value && params.value <= filterItem.value[1];
|
|
17656
|
+
return params.value !== null && params.value !== undefined && filterItem.value[0] <= params.value && params.value <= filterItem.value[1];
|
|
17656
17657
|
};
|
|
17657
17658
|
},
|
|
17658
17659
|
InputComponent: InputNumberInterval
|
|
@@ -17665,7 +17666,7 @@ const containsAnyOfOperator = {
|
|
|
17665
17666
|
label: 'contains any of',
|
|
17666
17667
|
value: 'containsAnyOf',
|
|
17667
17668
|
getApplyFilterFn: filterItem => {
|
|
17668
|
-
if (!filterItem.
|
|
17669
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
17669
17670
|
return null;
|
|
17670
17671
|
}
|
|
17671
17672
|
return params => {
|
|
@@ -17688,7 +17689,7 @@ const containsAnyOfCIOperator = {
|
|
|
17688
17689
|
label: 'contains any of (case insensitive)',
|
|
17689
17690
|
value: 'containsAnyOf',
|
|
17690
17691
|
getApplyFilterFn: filterItem => {
|
|
17691
|
-
if (!filterItem.
|
|
17692
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
17692
17693
|
return null;
|
|
17693
17694
|
}
|
|
17694
17695
|
return params => {
|
|
@@ -17715,7 +17716,7 @@ const endsWithAnyOfOperator = {
|
|
|
17715
17716
|
label: 'ends with any of',
|
|
17716
17717
|
value: 'endsWithAnyOf',
|
|
17717
17718
|
getApplyFilterFn: filterItem => {
|
|
17718
|
-
if (!filterItem.
|
|
17719
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
17719
17720
|
return null;
|
|
17720
17721
|
}
|
|
17721
17722
|
return params => {
|
|
@@ -17742,7 +17743,7 @@ const isAnyOfOperator = {
|
|
|
17742
17743
|
label: 'is any of',
|
|
17743
17744
|
value: 'isAnyOf',
|
|
17744
17745
|
getApplyFilterFn: filterItem => {
|
|
17745
|
-
if (!filterItem.
|
|
17746
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
17746
17747
|
return null;
|
|
17747
17748
|
}
|
|
17748
17749
|
return params => {
|
|
@@ -17766,7 +17767,7 @@ const isNotAnyOfOperator = {
|
|
|
17766
17767
|
label: 'is not any of',
|
|
17767
17768
|
value: 'isNotAnyOf',
|
|
17768
17769
|
getApplyFilterFn: filterItem => {
|
|
17769
|
-
if (!filterItem.
|
|
17770
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
17770
17771
|
return null;
|
|
17771
17772
|
}
|
|
17772
17773
|
return params => {
|
|
@@ -17790,7 +17791,7 @@ const startsWithAnyOfOperator = {
|
|
|
17790
17791
|
label: 'starts with any of',
|
|
17791
17792
|
value: 'startsWithAnyOf',
|
|
17792
17793
|
getApplyFilterFn: filterItem => {
|
|
17793
|
-
if (!filterItem.
|
|
17794
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
17794
17795
|
return null;
|
|
17795
17796
|
}
|
|
17796
17797
|
return params => {
|
|
@@ -17819,7 +17820,7 @@ const getGridStringOperators = () => [...getGridStringOperators$1(), ...getGridS
|
|
|
17819
17820
|
|
|
17820
17821
|
const API_URL = 'https://api.openai.com/v1/chat/completions';
|
|
17821
17822
|
async function getCompletion(text, role, openai_api_key) {
|
|
17822
|
-
let model = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'gpt-3.5-turbo-
|
|
17823
|
+
let model = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'gpt-3.5-turbo-1106';
|
|
17823
17824
|
try {
|
|
17824
17825
|
const messages = [{
|
|
17825
17826
|
role: 'system',
|
|
@@ -17870,76 +17871,6 @@ class LicenseInfo {
|
|
|
17870
17871
|
}
|
|
17871
17872
|
}
|
|
17872
17873
|
|
|
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
|
-
|
|
17943
17874
|
/**
|
|
17944
17875
|
* Component style.
|
|
17945
17876
|
*/
|
|
@@ -21684,6 +21615,7 @@ const TooltipContent = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
21684
21615
|
style,
|
|
21685
21616
|
theme: propsTheme
|
|
21686
21617
|
} = props;
|
|
21618
|
+
const appContainerState = useContext(AppContainerContext);
|
|
21687
21619
|
const {
|
|
21688
21620
|
getFloatingProps,
|
|
21689
21621
|
isOpen,
|
|
@@ -21711,7 +21643,7 @@ const TooltipContent = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
21711
21643
|
left: 'right'
|
|
21712
21644
|
}[placement.split('-')[0]];
|
|
21713
21645
|
return /*#__PURE__*/React__default.createElement(FloatingPortal, {
|
|
21714
|
-
|
|
21646
|
+
root: appContainerState === null || appContainerState === void 0 ? void 0 : appContainerState.appContainerRef.current
|
|
21715
21647
|
}, isOpen && /*#__PURE__*/React__default.createElement(StyledTooltipContent, _extends$2({
|
|
21716
21648
|
className: classNames(TooltipContent.className, className),
|
|
21717
21649
|
ref: popoverRef,
|
|
@@ -21754,7 +21686,8 @@ const TooltipTrigger = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
21754
21686
|
const {
|
|
21755
21687
|
getReferenceProps,
|
|
21756
21688
|
refs,
|
|
21757
|
-
tooltipId
|
|
21689
|
+
tooltipId,
|
|
21690
|
+
triggerClassName
|
|
21758
21691
|
} = useTooltipContext();
|
|
21759
21692
|
const childrenRef = children.ref;
|
|
21760
21693
|
const triggerRef = useMergeRefs([refs.setReference, ref, childrenRef]);
|
|
@@ -21765,7 +21698,8 @@ const TooltipTrigger = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
21765
21698
|
}, props), {}, {
|
|
21766
21699
|
'aria-describedby': tooltipId
|
|
21767
21700
|
}, children.props), {}, {
|
|
21768
|
-
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)
|
|
21769
21703
|
}))));
|
|
21770
21704
|
}
|
|
21771
21705
|
return /*#__PURE__*/React__default.createElement("span", _extends$2({
|
|
@@ -21783,7 +21717,8 @@ function useTooltip(_ref) {
|
|
|
21783
21717
|
placement,
|
|
21784
21718
|
isOpen: propsIsOpen,
|
|
21785
21719
|
onOpen,
|
|
21786
|
-
tooltipId: propsTooltipId
|
|
21720
|
+
tooltipId: propsTooltipId,
|
|
21721
|
+
triggerClassName
|
|
21787
21722
|
} = _ref;
|
|
21788
21723
|
const arrowRef = useRef(null);
|
|
21789
21724
|
const [isOpen, setIsOpen] = useState(propsIsOpen !== null && propsIsOpen !== void 0 ? propsIsOpen : defaultOpen);
|
|
@@ -21833,8 +21768,9 @@ function useTooltip(_ref) {
|
|
|
21833
21768
|
handleOpen
|
|
21834
21769
|
}, interactions), data), {}, {
|
|
21835
21770
|
arrowRef,
|
|
21836
|
-
tooltipId
|
|
21837
|
-
|
|
21771
|
+
tooltipId,
|
|
21772
|
+
triggerClassName
|
|
21773
|
+
}), [isOpen, handleOpen, interactions, data, arrowRef, tooltipId, triggerClassName]);
|
|
21838
21774
|
}
|
|
21839
21775
|
|
|
21840
21776
|
const ThemeContext = /*#__PURE__*/React__default.createContext(null);
|
|
@@ -21859,7 +21795,8 @@ const BaseTooltip = props => {
|
|
|
21859
21795
|
onOpen,
|
|
21860
21796
|
placement,
|
|
21861
21797
|
tooltipId,
|
|
21862
|
-
theme: propsTheme
|
|
21798
|
+
theme: propsTheme,
|
|
21799
|
+
triggerClassName
|
|
21863
21800
|
} = props;
|
|
21864
21801
|
const theme = useTheme$4 ? useTheme$4(propsTheme) : undefined;
|
|
21865
21802
|
const tooltip = useTooltip({
|
|
@@ -21869,7 +21806,8 @@ const BaseTooltip = props => {
|
|
|
21869
21806
|
isOpen,
|
|
21870
21807
|
onOpen,
|
|
21871
21808
|
tooltipId,
|
|
21872
|
-
theme
|
|
21809
|
+
theme,
|
|
21810
|
+
triggerClassName
|
|
21873
21811
|
});
|
|
21874
21812
|
const [[trigger], [content]] = partitionComponents(React__default.Children.toArray(children), [isComponent('TooltipTrigger'), isComponent('TooltipContent')]);
|
|
21875
21813
|
return /*#__PURE__*/React__default.createElement(ThemeProvider, {
|
|
@@ -21917,10 +21855,10 @@ const COMPONENT_NAME$2 = 'GridToolbarFilterSemanticField';
|
|
|
21917
21855
|
const CLASSNAME$2 = 'redsift-datagrid-toolbar-nlp-filter-field';
|
|
21918
21856
|
const DEFAULT_PROPS$1 = {
|
|
21919
21857
|
dateFormat: 'yyyy-mm-dd',
|
|
21920
|
-
defaultModel: 'gpt-4-
|
|
21858
|
+
defaultModel: 'gpt-4-1106-preview',
|
|
21921
21859
|
defaultFilter: {
|
|
21922
21860
|
items: [],
|
|
21923
|
-
|
|
21861
|
+
logicOperator: 'and'
|
|
21924
21862
|
},
|
|
21925
21863
|
disablePower: false,
|
|
21926
21864
|
localeText: {
|
|
@@ -21961,16 +21899,16 @@ const getRole = (config, dateFormat) => {
|
|
|
21961
21899
|
}).join('\n');
|
|
21962
21900
|
return `The AI assistant parses user input to generate a JSON object that will be used as a row filter for a data table MUI Data Grid.
|
|
21963
21901
|
The filter supports mulitple conditions using only two logical operator "and", "or". It only allows "and" between all conditions or "or" between all conditions. It can't mix the two types.
|
|
21964
|
-
The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "
|
|
21965
|
-
- "
|
|
21966
|
-
- "items": a list of conditions, each is an object with exactly the three keys "
|
|
21967
|
-
- "
|
|
21902
|
+
The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "logicOperator" and "items":
|
|
21903
|
+
- "logicOperator": the logical operator, only "and" or "or" are allowed. If there is only one condition in the "items", use "and".
|
|
21904
|
+
- "items": a list of conditions, each is an object with exactly the three keys "field", "operator" and "value":
|
|
21905
|
+
- "field": the column name, must be one of ${columns}
|
|
21968
21906
|
- "value":
|
|
21969
|
-
- this can be skipped if the "
|
|
21970
|
-
- a list of multiple values if the "
|
|
21907
|
+
- this can be skipped if the "operator" is either "isEmpty" or "isNotEmpty"
|
|
21908
|
+
- a list of multiple values if the "operator" ends with "AnyOf"
|
|
21971
21909
|
- otherwise, it's a single value represented as a string: "true" instead of true, "false" instead of false, "0.6" instead of 0.6.
|
|
21972
21910
|
For "date" data type, use ${dateFormat}. If relative date is input, convert to the actual date given today is ${today}.
|
|
21973
|
-
- "
|
|
21911
|
+
- "operator": the comparison operator, accepted values depend on the data type of the column
|
|
21974
21912
|
${operators}
|
|
21975
21913
|
|
|
21976
21914
|
Below is the datatype in square bracket, constraints on the data range if any, followed by the description of each column used in the data table:
|
|
@@ -22077,7 +22015,7 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
22077
22015
|
value: prompt
|
|
22078
22016
|
}), /*#__PURE__*/React__default.createElement(Button, {
|
|
22079
22017
|
variant: "primary",
|
|
22080
|
-
"
|
|
22018
|
+
"aria-label": buttonAriaLabel,
|
|
22081
22019
|
type: "submit",
|
|
22082
22020
|
isLoading: isLoading
|
|
22083
22021
|
}, buttonText)), !disablePower && /*#__PURE__*/React__default.createElement(Tooltip, null, /*#__PURE__*/React__default.createElement(Tooltip.Trigger, null, /*#__PURE__*/React__default.createElement(Switch, {
|
|
@@ -22139,7 +22077,7 @@ const Toolbar$3 = props => {
|
|
|
22139
22077
|
let {
|
|
22140
22078
|
apiRef
|
|
22141
22079
|
} = _ref;
|
|
22142
|
-
return
|
|
22080
|
+
return gridExpandedSortedRowIdsSelector(apiRef);
|
|
22143
22081
|
}
|
|
22144
22082
|
},
|
|
22145
22083
|
printOptions: {
|
|
@@ -22153,33 +22091,7 @@ const Toolbar$3 = props => {
|
|
|
22153
22091
|
}, semanticFilterProps ? /*#__PURE__*/React__default.createElement(GridToolbarFilterSemanticField, semanticFilterProps) : null)));
|
|
22154
22092
|
};
|
|
22155
22093
|
|
|
22156
|
-
const _excluded$d = ["
|
|
22157
|
-
const muiIconToDSIcon = {
|
|
22158
|
-
ColumnFilteredIcon: mdiFilterVariant,
|
|
22159
|
-
ColumnSelectorIcon: mdiViewColumn,
|
|
22160
|
-
ColumnSortedAscendingIcon: mdiChevronUp,
|
|
22161
|
-
ColumnSortedDescendingIcon: mdiChevronDown,
|
|
22162
|
-
DensityCompactIcon: mdiViewHeadline,
|
|
22163
|
-
DensityStandardIcon: mdiViewSequential,
|
|
22164
|
-
DensityComfortableIcon: mdiViewStream,
|
|
22165
|
-
DetailPanelCollapseIcon: mdiChevronDown,
|
|
22166
|
-
DetailPanelExpandIcon: mdiChevronRight,
|
|
22167
|
-
ExportIcon: mdiTrayArrowDown,
|
|
22168
|
-
OpenFilterButtonIcon: mdiFilterVariant
|
|
22169
|
-
};
|
|
22170
|
-
const BaseIcon = /*#__PURE__*/forwardRef((props, ref) => {
|
|
22171
|
-
const {
|
|
22172
|
-
displayName
|
|
22173
|
-
} = props,
|
|
22174
|
-
forwardedProps = _objectWithoutProperties(props, _excluded$d);
|
|
22175
|
-
return /*#__PURE__*/React__default.createElement(Icon, _extends$2({}, forwardedProps, forwardedProps.inputProps, {
|
|
22176
|
-
ref: ref,
|
|
22177
|
-
size: forwardedProps.fontSize,
|
|
22178
|
-
icon: muiIconToDSIcon[displayName]
|
|
22179
|
-
}));
|
|
22180
|
-
});
|
|
22181
|
-
|
|
22182
|
-
const _excluded$c = ["children", "color", "onClick", "startIcon"];
|
|
22094
|
+
const _excluded$d = ["children", "color", "onClick", "startIcon"];
|
|
22183
22095
|
const BaseButton = /*#__PURE__*/forwardRef((props, ref) => {
|
|
22184
22096
|
var _props$className;
|
|
22185
22097
|
const {
|
|
@@ -22188,7 +22100,7 @@ const BaseButton = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
22188
22100
|
onClick,
|
|
22189
22101
|
startIcon
|
|
22190
22102
|
} = props,
|
|
22191
|
-
forwardedProps = _objectWithoutProperties(props, _excluded$
|
|
22103
|
+
forwardedProps = _objectWithoutProperties(props, _excluded$d);
|
|
22192
22104
|
const color = Object.keys(ButtonsColorPalette).includes(propsColor) ? propsColor : 'primary';
|
|
22193
22105
|
if ((_props$className = props.className) !== null && _props$className !== void 0 && _props$className.includes('redsift-condensed')) {
|
|
22194
22106
|
return /*#__PURE__*/React__default.createElement(IconButton$2, _extends$2({}, forwardedProps, {
|
|
@@ -22214,7 +22126,7 @@ const BaseButton = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
22214
22126
|
}), children);
|
|
22215
22127
|
});
|
|
22216
22128
|
|
|
22217
|
-
const _excluded$
|
|
22129
|
+
const _excluded$c = ["checked", "indeterminate", "disabled", "onChange"];
|
|
22218
22130
|
const BaseCheckbox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
22219
22131
|
const {
|
|
22220
22132
|
checked,
|
|
@@ -22222,7 +22134,7 @@ const BaseCheckbox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
22222
22134
|
disabled,
|
|
22223
22135
|
onChange
|
|
22224
22136
|
} = props,
|
|
22225
|
-
forwardedProps = _objectWithoutProperties(props, _excluded$
|
|
22137
|
+
forwardedProps = _objectWithoutProperties(props, _excluded$c);
|
|
22226
22138
|
return /*#__PURE__*/React__default.createElement(Checkbox, _extends$2({}, forwardedProps, forwardedProps.inputProps, {
|
|
22227
22139
|
isSelected: checked && !indeterminate,
|
|
22228
22140
|
isDisabled: disabled,
|
|
@@ -22232,6 +22144,32 @@ const BaseCheckbox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
22232
22144
|
}));
|
|
22233
22145
|
});
|
|
22234
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
|
+
|
|
22235
22173
|
const _excluded$a = ["anchorEl", "component", "components", "componentsProps", "container", "disablePortal", "keepMounted", "modifiers", "open", "placement", "popperOptions", "popperRef", "transition", "slots", "slotProps"];
|
|
22236
22174
|
const PopperRoot = styled$1(BasePopper$1, {
|
|
22237
22175
|
name: 'MuiPopper',
|
|
@@ -22433,6 +22371,86 @@ const BasePopper = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
22433
22371
|
}));
|
|
22434
22372
|
});
|
|
22435
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
|
+
|
|
22436
22454
|
function Ripple(props) {
|
|
22437
22455
|
const {
|
|
22438
22456
|
className,
|
|
@@ -24591,14 +24609,151 @@ process.env.NODE_ENV !== "production" ? TablePagination.propTypes /* remove-prop
|
|
|
24591
24609
|
} : void 0;
|
|
24592
24610
|
var TablePagination$1 = TablePagination;
|
|
24593
24611
|
|
|
24594
|
-
const
|
|
24595
|
-
|
|
24596
|
-
|
|
24597
|
-
|
|
24598
|
-
|
|
24599
|
-
|
|
24600
|
-
|
|
24612
|
+
const ControlledPagination$1 = _ref => {
|
|
24613
|
+
let {
|
|
24614
|
+
apiRef,
|
|
24615
|
+
selectionStatus,
|
|
24616
|
+
setSelectionStatusType,
|
|
24617
|
+
selectionStatusType,
|
|
24618
|
+
displaySelection,
|
|
24619
|
+
displayPagination,
|
|
24620
|
+
paginationModel,
|
|
24621
|
+
onPaginationModelChange,
|
|
24622
|
+
pageSizeOptions,
|
|
24623
|
+
displayRowsPerPage,
|
|
24624
|
+
paginationProps,
|
|
24625
|
+
rowCount
|
|
24626
|
+
} = _ref;
|
|
24627
|
+
const totalNumberOfRowsInTable = rowCount;
|
|
24628
|
+
const totalRowsLabel = `${selectionStatus.numberOfSelectedRows} row${selectionStatus.numberOfSelectedRows > 1 ? 's' : ''} selected`;
|
|
24629
|
+
const pageRowsLabel = `All ${selectionStatus.numberOfSelectedRowsInPage} selectable rows on this page are selected${selectionStatus.numberOfSelectedRows != selectionStatus.numberOfSelectedRowsInPage ? ` (${selectionStatus.numberOfSelectedRows} row${selectionStatus.numberOfSelectedRows > 1 ? 's' : ''} selected in total)` : ''}.`;
|
|
24630
|
+
return /*#__PURE__*/React__default.createElement(Flexbox, {
|
|
24631
|
+
flexDirection: "row",
|
|
24632
|
+
alignItems: "center",
|
|
24633
|
+
justifyContent: "space-between",
|
|
24634
|
+
marginBottom: "7px"
|
|
24635
|
+
}, displaySelection ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, selectionStatusType === 'table' ? /*#__PURE__*/React__default.createElement(Text, {
|
|
24636
|
+
fontSize: "14px"
|
|
24637
|
+
}, "All selectable rows in the table are selected.", ' ', /*#__PURE__*/React__default.createElement(LinkButton, {
|
|
24638
|
+
onClick: () => {
|
|
24639
|
+
setSelectionStatusType('none');
|
|
24640
|
+
apiRef.current.selectRows([], false, true);
|
|
24641
|
+
}
|
|
24642
|
+
}, "Clear selection.")) : selectionStatus.type === 'page' && selectionStatus.numberOfSelectedRowsInPage != 0 ? /*#__PURE__*/React__default.createElement(Text, {
|
|
24643
|
+
fontSize: "14px"
|
|
24644
|
+
}, pageRowsLabel, ' ', /*#__PURE__*/React__default.createElement(LinkButton, {
|
|
24645
|
+
onClick: () => {
|
|
24646
|
+
setSelectionStatusType('table');
|
|
24647
|
+
}
|
|
24648
|
+
}, "Select all selectable rows in the table.")) : selectionStatus.type === 'other' ? /*#__PURE__*/React__default.createElement(Text, {
|
|
24649
|
+
fontSize: "14px"
|
|
24650
|
+
}, totalRowsLabel) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$2({
|
|
24651
|
+
component: "div",
|
|
24652
|
+
count: totalNumberOfRowsInTable,
|
|
24653
|
+
page: paginationModel.page,
|
|
24654
|
+
onPageChange: (event, page) => onPaginationModelChange({
|
|
24655
|
+
page,
|
|
24656
|
+
pageSize: paginationModel.pageSize
|
|
24657
|
+
}),
|
|
24658
|
+
rowsPerPage: paginationModel.pageSize,
|
|
24659
|
+
onRowsPerPageChange: event => onPaginationModelChange({
|
|
24660
|
+
page: paginationModel.page,
|
|
24661
|
+
pageSize: parseInt(event.target.value, 10)
|
|
24662
|
+
}),
|
|
24663
|
+
rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
|
|
24664
|
+
}, paginationProps)) : null);
|
|
24665
|
+
};
|
|
24666
|
+
|
|
24667
|
+
const onServerSideSelectionStatusChange = _ref => {
|
|
24668
|
+
let {
|
|
24669
|
+
newSelectionModel,
|
|
24670
|
+
apiRef,
|
|
24671
|
+
selectionStatus,
|
|
24672
|
+
selectionStatusType,
|
|
24673
|
+
setSelectionStatusType,
|
|
24674
|
+
isRowSelectable,
|
|
24675
|
+
page,
|
|
24676
|
+
pageSize
|
|
24677
|
+
} = _ref;
|
|
24678
|
+
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref2 => {
|
|
24679
|
+
let {
|
|
24680
|
+
model
|
|
24681
|
+
} = _ref2;
|
|
24682
|
+
return isRowSelectable({
|
|
24683
|
+
row: model
|
|
24684
|
+
});
|
|
24685
|
+
}).map(_ref3 => {
|
|
24686
|
+
let {
|
|
24687
|
+
id
|
|
24688
|
+
} = _ref3;
|
|
24689
|
+
return id;
|
|
24690
|
+
}) : gridPaginatedVisibleSortedGridRowIdsSelector(apiRef);
|
|
24691
|
+
const numberOfSelectableRowsInPage = selectableRowsInPage.length;
|
|
24692
|
+
const numberOfSelectedRows = newSelectionModel.length;
|
|
24693
|
+
const selectedRowsInPage = selectableRowsInPage.filter(rowId => newSelectionModel.includes(rowId));
|
|
24694
|
+
const numberOfSelectedRowsInPage = selectedRowsInPage.length;
|
|
24695
|
+
const isSamePage = (selectionStatus === null || selectionStatus === void 0 ? void 0 : selectionStatus.current.page) == page;
|
|
24696
|
+
const isSamePageSize = (selectionStatus === null || selectionStatus === void 0 ? void 0 : selectionStatus.current.pageSize) == pageSize;
|
|
24697
|
+
if (selectionStatusType === 'table') {
|
|
24698
|
+
// if we just move across page or pageSize
|
|
24699
|
+
if (!isSamePage || !isSamePageSize) {
|
|
24700
|
+
selectionStatus.current = {
|
|
24701
|
+
type: 'table',
|
|
24702
|
+
numberOfSelectedRows,
|
|
24703
|
+
numberOfSelectedRowsInPage,
|
|
24704
|
+
page,
|
|
24705
|
+
pageSize
|
|
24706
|
+
};
|
|
24707
|
+
}
|
|
24708
|
+
// if we selected all selectable rows (as effect of the previous if condition)
|
|
24709
|
+
else if (numberOfSelectedRows > 0) {
|
|
24710
|
+
setSelectionStatusType('none');
|
|
24711
|
+
selectionStatus.current = {
|
|
24712
|
+
type: 'none',
|
|
24713
|
+
numberOfSelectedRows,
|
|
24714
|
+
numberOfSelectedRowsInPage,
|
|
24715
|
+
page,
|
|
24716
|
+
pageSize
|
|
24717
|
+
};
|
|
24718
|
+
apiRef.current.selectRows([], false, true);
|
|
24719
|
+
}
|
|
24720
|
+
return;
|
|
24721
|
+
}
|
|
24722
|
+
if (selectionStatusType === 'page' && isSamePage && isSamePageSize && numberOfSelectedRowsInPage === numberOfSelectableRowsInPage) {
|
|
24723
|
+
setTimeout(() => {
|
|
24724
|
+
apiRef.current.selectRows(selectedRowsInPage, false, false);
|
|
24725
|
+
}, 0);
|
|
24726
|
+
}
|
|
24727
|
+
if (numberOfSelectedRowsInPage === numberOfSelectableRowsInPage && numberOfSelectableRowsInPage != 0) {
|
|
24728
|
+
setSelectionStatusType('page');
|
|
24729
|
+
selectionStatus.current = {
|
|
24730
|
+
type: 'page',
|
|
24731
|
+
numberOfSelectedRows,
|
|
24732
|
+
numberOfSelectedRowsInPage,
|
|
24733
|
+
page,
|
|
24734
|
+
pageSize
|
|
24735
|
+
};
|
|
24736
|
+
} else if (numberOfSelectedRows > 0) {
|
|
24737
|
+
setSelectionStatusType('other');
|
|
24738
|
+
selectionStatus.current = {
|
|
24739
|
+
type: 'other',
|
|
24740
|
+
numberOfSelectedRows,
|
|
24741
|
+
numberOfSelectedRowsInPage,
|
|
24742
|
+
page,
|
|
24743
|
+
pageSize
|
|
24744
|
+
};
|
|
24745
|
+
} else {
|
|
24746
|
+
setSelectionStatusType('none');
|
|
24747
|
+
selectionStatus.current = {
|
|
24748
|
+
type: 'none',
|
|
24749
|
+
numberOfSelectedRows,
|
|
24750
|
+
numberOfSelectedRowsInPage,
|
|
24751
|
+
page,
|
|
24752
|
+
pageSize
|
|
24753
|
+
};
|
|
24754
|
+
}
|
|
24601
24755
|
};
|
|
24756
|
+
|
|
24602
24757
|
const getSelectableRowsInTable = (apiRef, isRowSelectable) => {
|
|
24603
24758
|
return isRowSelectable && typeof isRowSelectable === 'function' ? gridFilteredSortedRowEntriesSelector(apiRef).filter(_ref => {
|
|
24604
24759
|
let {
|
|
@@ -24614,21 +24769,20 @@ const getSelectableRowsInTable = (apiRef, isRowSelectable) => {
|
|
|
24614
24769
|
return id;
|
|
24615
24770
|
}) : gridFilteredSortedRowIdsSelector(apiRef);
|
|
24616
24771
|
};
|
|
24617
|
-
|
|
24772
|
+
|
|
24773
|
+
const ControlledPagination = _ref => {
|
|
24618
24774
|
let {
|
|
24619
24775
|
displaySelection = false,
|
|
24620
24776
|
displayRowsPerPage = false,
|
|
24621
24777
|
displayPagination = false,
|
|
24622
24778
|
selectionStatus,
|
|
24623
24779
|
apiRef,
|
|
24624
|
-
|
|
24625
|
-
|
|
24626
|
-
|
|
24627
|
-
onPageSizeChange,
|
|
24628
|
-
rowsPerPageOptions,
|
|
24780
|
+
paginationModel,
|
|
24781
|
+
onPaginationModelChange,
|
|
24782
|
+
pageSizeOptions,
|
|
24629
24783
|
isRowSelectable,
|
|
24630
24784
|
paginationProps
|
|
24631
|
-
} =
|
|
24785
|
+
} = _ref;
|
|
24632
24786
|
const filteredRowsInTable = getSelectableRowsInTable(apiRef);
|
|
24633
24787
|
const selectableRowsInTable = getSelectableRowsInTable(apiRef, isRowSelectable);
|
|
24634
24788
|
const numberOfFilteredRowsInTable = filteredRowsInTable.length;
|
|
@@ -24655,88 +24809,63 @@ const ControlledPagination = _ref3 => {
|
|
|
24655
24809
|
}, `${selectionStatus.numberOfSelectedRows} row${selectionStatus.numberOfSelectedRows > 1 ? 's' : ''} selected`) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$2({
|
|
24656
24810
|
component: "div",
|
|
24657
24811
|
count: numberOfFilteredRowsInTable,
|
|
24658
|
-
page: page,
|
|
24659
|
-
onPageChange: (event,
|
|
24660
|
-
|
|
24661
|
-
|
|
24662
|
-
|
|
24663
|
-
|
|
24664
|
-
|
|
24812
|
+
page: paginationModel.page,
|
|
24813
|
+
onPageChange: (event, page) => onPaginationModelChange({
|
|
24814
|
+
page,
|
|
24815
|
+
pageSize: paginationModel.pageSize
|
|
24816
|
+
}),
|
|
24817
|
+
rowsPerPage: paginationModel.pageSize,
|
|
24818
|
+
onRowsPerPageChange: event => onPaginationModelChange({
|
|
24819
|
+
page: paginationModel.page,
|
|
24820
|
+
pageSize: parseInt(event.target.value, 10)
|
|
24821
|
+
}),
|
|
24822
|
+
rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
|
|
24665
24823
|
}, paginationProps)) : null);
|
|
24666
24824
|
};
|
|
24667
|
-
|
|
24668
|
-
|
|
24669
|
-
|
|
24670
|
-
|
|
24671
|
-
|
|
24672
|
-
|
|
24673
|
-
|
|
24674
|
-
|
|
24675
|
-
onPageSizeChange,
|
|
24676
|
-
displayRowsPerPage,
|
|
24677
|
-
rowsPerPageOptions,
|
|
24678
|
-
paginationProps,
|
|
24679
|
-
rowCount
|
|
24680
|
-
} = _ref4;
|
|
24681
|
-
const totalNumberOfRowsInTable = rowCount;
|
|
24682
|
-
const totalRowsLabel = `${selectionStatus.numberOfSelectedRows} row${selectionStatus.numberOfSelectedRows > 1 ? 's' : ''} selected`;
|
|
24683
|
-
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)` : ''}.`;
|
|
24684
|
-
return /*#__PURE__*/React__default.createElement(Flexbox, {
|
|
24685
|
-
flexDirection: "row",
|
|
24686
|
-
alignItems: "center",
|
|
24687
|
-
justifyContent: "space-between",
|
|
24688
|
-
marginBottom: "7px"
|
|
24689
|
-
}, displaySelection ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, selectionStatus.type === 'page' && selectionStatus.numberOfSelectedRowsInPage != 0 ? /*#__PURE__*/React__default.createElement(Text, {
|
|
24690
|
-
fontSize: "14px"
|
|
24691
|
-
}, pageRowsLabel) : selectionStatus.type === 'other' ? /*#__PURE__*/React__default.createElement(Text, {
|
|
24692
|
-
fontSize: "14px"
|
|
24693
|
-
}, totalRowsLabel) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$2({
|
|
24694
|
-
component: "div",
|
|
24695
|
-
count: totalNumberOfRowsInTable,
|
|
24696
|
-
page: page,
|
|
24697
|
-
onPageChange: (event, newPage) => onPageChange(newPage),
|
|
24698
|
-
rowsPerPage: pageSize,
|
|
24699
|
-
onRowsPerPageChange: event => {
|
|
24700
|
-
onPageSizeChange(parseInt(event.target.value, 10));
|
|
24701
|
-
},
|
|
24702
|
-
rowsPerPageOptions: displayRowsPerPage ? rowsPerPageOptions : []
|
|
24703
|
-
}, 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'
|
|
24704
24833
|
};
|
|
24705
|
-
const Toolbar =
|
|
24834
|
+
const Toolbar = _ref => {
|
|
24706
24835
|
let {
|
|
24707
24836
|
hideToolbar,
|
|
24708
24837
|
RenderedToolbar,
|
|
24709
24838
|
filterModel,
|
|
24710
24839
|
onFilterModelChange,
|
|
24711
24840
|
pagination,
|
|
24712
|
-
ControlledPagination,
|
|
24713
24841
|
paginationPlacement,
|
|
24714
24842
|
selectionStatus,
|
|
24843
|
+
selectionStatusType,
|
|
24844
|
+
setSelectionStatusType,
|
|
24715
24845
|
apiRef,
|
|
24716
24846
|
isRowSelectable,
|
|
24717
|
-
|
|
24718
|
-
|
|
24719
|
-
|
|
24720
|
-
onPageSizeChange,
|
|
24721
|
-
rowsPerPageOptions,
|
|
24847
|
+
paginationModel,
|
|
24848
|
+
onPaginationModelChange,
|
|
24849
|
+
pageSizeOptions,
|
|
24722
24850
|
paginationProps,
|
|
24723
24851
|
paginationMode = 'client',
|
|
24724
24852
|
rowCount
|
|
24725
|
-
} =
|
|
24726
|
-
forwardedProps = _objectWithoutProperties(
|
|
24853
|
+
} = _ref,
|
|
24854
|
+
forwardedProps = _objectWithoutProperties(_ref, _excluded$1);
|
|
24727
24855
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, !hideToolbar ? /*#__PURE__*/React__default.createElement(RenderedToolbar, _extends$2({}, forwardedProps, {
|
|
24728
24856
|
filterModel: filterModel,
|
|
24729
24857
|
onFilterModelChange: onFilterModelChange
|
|
24730
|
-
})) : null, pagination ? paginationMode
|
|
24858
|
+
})) : null, pagination ? paginationMode === 'server' ? /*#__PURE__*/React__default.createElement(ControlledPagination$1, {
|
|
24859
|
+
apiRef: apiRef,
|
|
24731
24860
|
displaySelection: true,
|
|
24732
24861
|
displayRowsPerPage: false,
|
|
24733
24862
|
displayPagination: ['top', 'both'].includes(paginationPlacement),
|
|
24734
24863
|
selectionStatus: selectionStatus.current,
|
|
24735
|
-
|
|
24736
|
-
|
|
24737
|
-
|
|
24738
|
-
|
|
24739
|
-
|
|
24864
|
+
setSelectionStatusType: setSelectionStatusType,
|
|
24865
|
+
selectionStatusType: selectionStatusType,
|
|
24866
|
+
paginationModel: paginationModel,
|
|
24867
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
24868
|
+
pageSizeOptions: pageSizeOptions,
|
|
24740
24869
|
paginationProps: paginationProps,
|
|
24741
24870
|
rowCount: rowCount
|
|
24742
24871
|
}) : /*#__PURE__*/React__default.createElement(ControlledPagination, {
|
|
@@ -24746,78 +24875,21 @@ const Toolbar = _ref5 => {
|
|
|
24746
24875
|
selectionStatus: selectionStatus.current,
|
|
24747
24876
|
apiRef: apiRef,
|
|
24748
24877
|
isRowSelectable: isRowSelectable,
|
|
24749
|
-
|
|
24750
|
-
|
|
24751
|
-
|
|
24752
|
-
onPageSizeChange: onPageSizeChange,
|
|
24753
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
24878
|
+
paginationModel: paginationModel,
|
|
24879
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
24880
|
+
pageSizeOptions: pageSizeOptions,
|
|
24754
24881
|
paginationProps: paginationProps
|
|
24755
24882
|
}) : null);
|
|
24756
24883
|
};
|
|
24757
|
-
const onServerSideSelectionStatusChange = (newSelectionModel, apiRef, selectionStatus, isRowSelectable, page, pageSize) => {
|
|
24758
|
-
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref6 => {
|
|
24759
|
-
let {
|
|
24760
|
-
model
|
|
24761
|
-
} = _ref6;
|
|
24762
|
-
return isRowSelectable({
|
|
24763
|
-
row: model
|
|
24764
|
-
});
|
|
24765
|
-
}).map(_ref7 => {
|
|
24766
|
-
let {
|
|
24767
|
-
id
|
|
24768
|
-
} = _ref7;
|
|
24769
|
-
return id;
|
|
24770
|
-
}) : gridPaginatedVisibleSortedGridRowIdsSelector(apiRef);
|
|
24771
|
-
const numberOfSelectableRowsInPage = selectableRowsInPage.length;
|
|
24772
|
-
const numberOfSelectedRows = newSelectionModel.length;
|
|
24773
|
-
const selectedRowsInPage = selectableRowsInPage.filter(rowId => newSelectionModel.includes(rowId));
|
|
24774
|
-
const numberOfSelectedRowsInPage = selectedRowsInPage.length;
|
|
24775
|
-
const isSamePage = (selectionStatus === null || selectionStatus === void 0 ? void 0 : selectionStatus.current.page) == page;
|
|
24776
|
-
const isSamePageSize = (selectionStatus === null || selectionStatus === void 0 ? void 0 : selectionStatus.current.pageSize) == pageSize;
|
|
24777
|
-
|
|
24778
|
-
// if previous status is `page`,
|
|
24779
|
-
// if page and pageSize didn't change
|
|
24780
|
-
// and all the rows are selected, deselect all row
|
|
24781
|
-
if (selectionStatus.current.type === 'page' && isSamePage && isSamePageSize && numberOfSelectedRowsInPage === numberOfSelectableRowsInPage) {
|
|
24782
|
-
setTimeout(() => {
|
|
24783
|
-
apiRef.current.selectRows(selectedRowsInPage, false, false);
|
|
24784
|
-
}, 0);
|
|
24785
|
-
}
|
|
24786
|
-
if (numberOfSelectedRowsInPage === numberOfSelectableRowsInPage && numberOfSelectableRowsInPage != 0) {
|
|
24787
|
-
selectionStatus.current = {
|
|
24788
|
-
type: 'page',
|
|
24789
|
-
numberOfSelectedRows,
|
|
24790
|
-
numberOfSelectedRowsInPage,
|
|
24791
|
-
page,
|
|
24792
|
-
pageSize
|
|
24793
|
-
};
|
|
24794
|
-
} else if (numberOfSelectedRows > 0) {
|
|
24795
|
-
selectionStatus.current = {
|
|
24796
|
-
type: 'other',
|
|
24797
|
-
numberOfSelectedRows,
|
|
24798
|
-
numberOfSelectedRowsInPage,
|
|
24799
|
-
page,
|
|
24800
|
-
pageSize
|
|
24801
|
-
};
|
|
24802
|
-
} else {
|
|
24803
|
-
selectionStatus.current = {
|
|
24804
|
-
type: 'none',
|
|
24805
|
-
numberOfSelectedRows,
|
|
24806
|
-
numberOfSelectedRowsInPage,
|
|
24807
|
-
page,
|
|
24808
|
-
pageSize
|
|
24809
|
-
};
|
|
24810
|
-
}
|
|
24811
|
-
};
|
|
24812
24884
|
const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
24813
|
-
var _initialState$paginat, _initialState$paginat2;
|
|
24885
|
+
var _ref2, _ref3, _initialState$paginat, _initialState$paginat2, _initialState$paginat3, _pageSizeOptions$, _ref4, _initialState$paginat4, _initialState$paginat5, _initialState$paginat6;
|
|
24814
24886
|
const datagridRef = ref || useRef();
|
|
24815
24887
|
const {
|
|
24816
24888
|
apiRef: propsApiRef,
|
|
24817
24889
|
autoHeight,
|
|
24818
24890
|
className,
|
|
24819
|
-
|
|
24820
|
-
|
|
24891
|
+
slots,
|
|
24892
|
+
slotProps,
|
|
24821
24893
|
filterModel: propsFilterModel,
|
|
24822
24894
|
height: propsHeight,
|
|
24823
24895
|
hideToolbar,
|
|
@@ -24825,27 +24897,26 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24825
24897
|
isRowSelectable,
|
|
24826
24898
|
license,
|
|
24827
24899
|
onFilterModelChange: propsOnFilterModelChange,
|
|
24828
|
-
|
|
24829
|
-
|
|
24830
|
-
|
|
24831
|
-
|
|
24832
|
-
|
|
24833
|
-
pageSize: propsPageSize,
|
|
24900
|
+
paginationModel: propsPaginationModel,
|
|
24901
|
+
onPaginationModelChange: propsOnPaginationModelChange,
|
|
24902
|
+
pageSizeOptions,
|
|
24903
|
+
rowSelectionModel: propsRowSelectionModel,
|
|
24904
|
+
onRowSelectionModelChange,
|
|
24834
24905
|
pagination,
|
|
24835
24906
|
paginationPlacement,
|
|
24836
24907
|
paginationProps,
|
|
24837
24908
|
rows,
|
|
24838
|
-
rowsPerPageOptions,
|
|
24839
24909
|
sx,
|
|
24840
24910
|
theme: propsTheme,
|
|
24841
24911
|
paginationMode = 'client',
|
|
24842
|
-
rowCount
|
|
24912
|
+
rowCount,
|
|
24913
|
+
onSelectionStatusChange: propsOnSelectionStatusChange
|
|
24843
24914
|
} = props,
|
|
24844
24915
|
forwardedProps = _objectWithoutProperties(props, _excluded2);
|
|
24845
24916
|
const theme = useTheme$4(propsTheme);
|
|
24846
24917
|
const _apiRef = useGridApiRef();
|
|
24847
24918
|
const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
|
|
24848
|
-
const RenderedToolbar =
|
|
24919
|
+
const RenderedToolbar = slots !== null && slots !== void 0 && slots.toolbar ? slots.toolbar : Toolbar$3;
|
|
24849
24920
|
LicenseInfo.setLicenseKey(license);
|
|
24850
24921
|
const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
|
|
24851
24922
|
const [filterModel, setFilterModel] = useState(propsFilterModel);
|
|
@@ -24859,55 +24930,63 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24859
24930
|
setFilterModel(model);
|
|
24860
24931
|
}
|
|
24861
24932
|
};
|
|
24862
|
-
const [
|
|
24933
|
+
const [rowSelectionModel, setRowSelectionModel] = useState(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
24863
24934
|
useEffect(() => {
|
|
24864
|
-
|
|
24865
|
-
}, [
|
|
24866
|
-
const [
|
|
24867
|
-
|
|
24868
|
-
|
|
24869
|
-
type: 'none',
|
|
24870
|
-
numberOfSelectedRows: 0,
|
|
24871
|
-
numberOfSelectedRowsInPage: 0,
|
|
24872
|
-
page,
|
|
24873
|
-
pageSize
|
|
24935
|
+
setRowSelectionModel(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
24936
|
+
}, [propsRowSelectionModel]);
|
|
24937
|
+
const [paginationModel, setPaginationModel] = useState({
|
|
24938
|
+
pageSize: (_ref2 = (_ref3 = (_initialState$paginat = initialState === null || initialState === void 0 ? void 0 : (_initialState$paginat2 = initialState.pagination) === null || _initialState$paginat2 === void 0 ? void 0 : (_initialState$paginat3 = _initialState$paginat2.paginationModel) === null || _initialState$paginat3 === void 0 ? void 0 : _initialState$paginat3.pageSize) !== null && _initialState$paginat !== void 0 ? _initialState$paginat : propsPaginationModel === null || propsPaginationModel === void 0 ? void 0 : propsPaginationModel.pageSize) !== null && _ref3 !== void 0 ? _ref3 : typeof (pageSizeOptions === null || pageSizeOptions === void 0 ? void 0 : pageSizeOptions[0]) === 'number' ? pageSizeOptions === null || pageSizeOptions === void 0 ? void 0 : pageSizeOptions[0] : pageSizeOptions === null || pageSizeOptions === void 0 ? void 0 : (_pageSizeOptions$ = pageSizeOptions[0]) === null || _pageSizeOptions$ === void 0 ? void 0 : _pageSizeOptions$.value) !== null && _ref2 !== void 0 ? _ref2 : 100,
|
|
24939
|
+
page: (_ref4 = (_initialState$paginat4 = initialState === null || initialState === void 0 ? void 0 : (_initialState$paginat5 = initialState.pagination) === null || _initialState$paginat5 === void 0 ? void 0 : (_initialState$paginat6 = _initialState$paginat5.paginationModel) === null || _initialState$paginat6 === void 0 ? void 0 : _initialState$paginat6.page) !== null && _initialState$paginat4 !== void 0 ? _initialState$paginat4 : propsPaginationModel === null || propsPaginationModel === void 0 ? void 0 : propsPaginationModel.page) !== null && _ref4 !== void 0 ? _ref4 : 0
|
|
24874
24940
|
});
|
|
24875
|
-
const
|
|
24876
|
-
if (
|
|
24877
|
-
|
|
24941
|
+
const onPaginationModelChange = model => {
|
|
24942
|
+
if (propsOnPaginationModelChange) {
|
|
24943
|
+
propsOnPaginationModelChange(model, undefined);
|
|
24878
24944
|
} else {
|
|
24879
|
-
|
|
24945
|
+
setPaginationModel(model);
|
|
24880
24946
|
}
|
|
24881
24947
|
};
|
|
24882
24948
|
useEffect(() => {
|
|
24883
|
-
if (
|
|
24884
|
-
|
|
24885
|
-
}
|
|
24886
|
-
}, [
|
|
24887
|
-
const
|
|
24888
|
-
|
|
24889
|
-
|
|
24890
|
-
|
|
24891
|
-
|
|
24892
|
-
|
|
24949
|
+
if (propsPaginationModel) {
|
|
24950
|
+
setPaginationModel(propsPaginationModel);
|
|
24951
|
+
}
|
|
24952
|
+
}, [propsPaginationModel]);
|
|
24953
|
+
const [selectionStatusType, setSelectionStatusType] = useState('none');
|
|
24954
|
+
const selectionStatus = useRef({
|
|
24955
|
+
type: selectionStatusType,
|
|
24956
|
+
numberOfSelectedRows: 0,
|
|
24957
|
+
numberOfSelectedRowsInPage: 0,
|
|
24958
|
+
page: paginationModel.page,
|
|
24959
|
+
pageSize: paginationModel.pageSize
|
|
24960
|
+
});
|
|
24961
|
+
const onSelectionStatusChange = selectionStatusType => {
|
|
24962
|
+
if (propsOnSelectionStatusChange) {
|
|
24963
|
+
propsOnSelectionStatusChange(selectionStatusType);
|
|
24893
24964
|
}
|
|
24894
24965
|
};
|
|
24895
24966
|
useEffect(() => {
|
|
24896
|
-
|
|
24897
|
-
|
|
24898
|
-
}
|
|
24899
|
-
}, [propsPageSize]);
|
|
24967
|
+
onSelectionStatusChange(selectionStatusType);
|
|
24968
|
+
}, [selectionStatusType]);
|
|
24900
24969
|
|
|
24901
24970
|
// in server-side pagination we want to update the selection status
|
|
24902
24971
|
// every time we navigate between pages, resize our page or select something
|
|
24903
24972
|
useEffect(() => {
|
|
24904
|
-
if (paginationMode
|
|
24905
|
-
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
|
+
});
|
|
24906
24984
|
}
|
|
24907
|
-
}, [
|
|
24985
|
+
}, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
|
|
24908
24986
|
if (!Array.isArray(rows)) {
|
|
24909
24987
|
return null;
|
|
24910
24988
|
}
|
|
24989
|
+
const isServerTableSelection = paginationMode === 'server' && selectionStatusType === 'table';
|
|
24911
24990
|
const muiTheme = useMemo(() => createTheme({
|
|
24912
24991
|
palette: {
|
|
24913
24992
|
mode: theme,
|
|
@@ -24934,56 +25013,54 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24934
25013
|
apiRef: apiRef,
|
|
24935
25014
|
autoHeight: autoHeight,
|
|
24936
25015
|
checkboxSelectionVisibleOnly: Boolean(pagination),
|
|
24937
|
-
|
|
24938
|
-
BaseButton,
|
|
24939
|
-
BaseCheckbox,
|
|
24940
|
-
//
|
|
24941
|
-
BasePopper,
|
|
24942
|
-
|
|
25016
|
+
slots: _objectSpread2(_objectSpread2({
|
|
25017
|
+
baseButton: BaseButton,
|
|
25018
|
+
baseCheckbox: BaseCheckbox,
|
|
25019
|
+
// baseTextField,
|
|
25020
|
+
basePopper: BasePopper,
|
|
25021
|
+
columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24943
25022
|
displayName: "ColumnFilteredIcon"
|
|
24944
25023
|
})),
|
|
24945
|
-
|
|
25024
|
+
columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24946
25025
|
displayName: "ColumnSelectorIcon"
|
|
24947
25026
|
})),
|
|
24948
|
-
|
|
25027
|
+
columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24949
25028
|
displayName: "ColumnSortedAscendingIcon"
|
|
24950
25029
|
})),
|
|
24951
|
-
|
|
25030
|
+
columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24952
25031
|
displayName: "ColumnSortedDescendingIcon"
|
|
24953
25032
|
})),
|
|
24954
|
-
|
|
25033
|
+
densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24955
25034
|
displayName: "DensityCompactIcon"
|
|
24956
25035
|
})),
|
|
24957
|
-
|
|
25036
|
+
densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24958
25037
|
displayName: "DensityStandardIcon"
|
|
24959
25038
|
})),
|
|
24960
|
-
|
|
25039
|
+
densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24961
25040
|
displayName: "DensityComfortableIcon"
|
|
24962
25041
|
})),
|
|
24963
|
-
|
|
25042
|
+
detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24964
25043
|
displayName: "DetailPanelCollapseIcon"
|
|
24965
25044
|
})),
|
|
24966
|
-
|
|
25045
|
+
detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24967
25046
|
displayName: "DetailPanelExpandIcon"
|
|
24968
25047
|
})),
|
|
24969
|
-
|
|
25048
|
+
exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24970
25049
|
displayName: "ExportIcon"
|
|
24971
25050
|
})),
|
|
24972
|
-
|
|
25051
|
+
openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({
|
|
24973
25052
|
displayName: "OpenFilterButtonIcon"
|
|
24974
25053
|
}, props))
|
|
24975
|
-
},
|
|
24976
|
-
|
|
24977
|
-
|
|
25054
|
+
}, slots), {}, {
|
|
25055
|
+
toolbar: Toolbar,
|
|
25056
|
+
pagination: props => pagination ? paginationMode === 'server' ? /*#__PURE__*/React__default.createElement(ControlledPagination$1, _extends$2({}, props, {
|
|
24978
25057
|
displaySelection: false,
|
|
24979
25058
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
24980
25059
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
24981
25060
|
selectionStatus: selectionStatus.current,
|
|
24982
|
-
|
|
24983
|
-
|
|
24984
|
-
|
|
24985
|
-
onPageSizeChange: onPageSizeChange,
|
|
24986
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
25061
|
+
paginationModel: paginationModel,
|
|
25062
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
25063
|
+
pageSizeOptions: pageSizeOptions,
|
|
24987
25064
|
paginationProps: paginationProps,
|
|
24988
25065
|
paginationMode: paginationMode,
|
|
24989
25066
|
rowCount: rowCount
|
|
@@ -24994,79 +25071,74 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24994
25071
|
selectionStatus: selectionStatus.current,
|
|
24995
25072
|
apiRef: apiRef,
|
|
24996
25073
|
isRowSelectable: isRowSelectable,
|
|
24997
|
-
|
|
24998
|
-
|
|
24999
|
-
|
|
25000
|
-
onPageSizeChange: onPageSizeChange,
|
|
25001
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
25074
|
+
paginationModel: paginationModel,
|
|
25075
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
25076
|
+
pageSizeOptions: pageSizeOptions,
|
|
25002
25077
|
paginationProps: paginationProps,
|
|
25003
25078
|
paginationMode: paginationMode,
|
|
25004
25079
|
rowCount: rowCount
|
|
25005
25080
|
})) : null
|
|
25006
25081
|
}),
|
|
25007
|
-
|
|
25082
|
+
slotProps: _objectSpread2(_objectSpread2({}, slotProps), {}, {
|
|
25008
25083
|
toolbar: _objectSpread2({
|
|
25009
25084
|
hideToolbar,
|
|
25010
25085
|
RenderedToolbar,
|
|
25011
25086
|
filterModel,
|
|
25012
25087
|
onFilterModelChange,
|
|
25013
25088
|
pagination,
|
|
25014
|
-
ControlledPagination: paginationMode == 'server' ? ServerSideControlledPagination : ControlledPagination,
|
|
25015
25089
|
paginationPlacement,
|
|
25016
25090
|
selectionStatus,
|
|
25091
|
+
selectionStatusType,
|
|
25092
|
+
setSelectionStatusType,
|
|
25017
25093
|
apiRef,
|
|
25018
25094
|
isRowSelectable,
|
|
25019
|
-
|
|
25020
|
-
|
|
25021
|
-
|
|
25022
|
-
onPageSizeChange,
|
|
25023
|
-
rowsPerPageOptions,
|
|
25095
|
+
paginationModel,
|
|
25096
|
+
onPaginationModelChange,
|
|
25097
|
+
pageSizeOptions,
|
|
25024
25098
|
paginationProps,
|
|
25025
25099
|
paginationMode,
|
|
25026
25100
|
rowCount
|
|
25027
|
-
},
|
|
25101
|
+
}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar)
|
|
25028
25102
|
}),
|
|
25029
25103
|
filterModel: filterModel,
|
|
25030
25104
|
initialState: initialState,
|
|
25031
|
-
isRowSelectable: isRowSelectable,
|
|
25105
|
+
isRowSelectable: !isServerTableSelection ? isRowSelectable : () => false,
|
|
25032
25106
|
onFilterModelChange: onFilterModelChange,
|
|
25033
25107
|
pagination: pagination,
|
|
25034
25108
|
paginationMode: paginationMode,
|
|
25035
|
-
keepNonExistentRowsSelected: paginationMode
|
|
25109
|
+
keepNonExistentRowsSelected: paginationMode === 'server',
|
|
25036
25110
|
rows: rows,
|
|
25037
|
-
|
|
25038
|
-
|
|
25039
|
-
|
|
25040
|
-
|
|
25041
|
-
|
|
25042
|
-
selectionModel: selectionModel,
|
|
25043
|
-
onSelectionModelChange: (newSelectionModel, details) => {
|
|
25111
|
+
paginationModel: paginationModel,
|
|
25112
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
25113
|
+
pageSizeOptions: pageSizeOptions,
|
|
25114
|
+
rowSelectionModel: isServerTableSelection ? getSelectableRowsInTable(apiRef, isRowSelectable) : rowSelectionModel,
|
|
25115
|
+
onRowSelectionModelChange: (newSelectionModel, details) => {
|
|
25044
25116
|
if (pagination && paginationMode != 'server') {
|
|
25045
|
-
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(
|
|
25117
|
+
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref5 => {
|
|
25046
25118
|
let {
|
|
25047
25119
|
model
|
|
25048
|
-
} =
|
|
25120
|
+
} = _ref5;
|
|
25049
25121
|
return isRowSelectable({
|
|
25050
25122
|
row: model
|
|
25051
25123
|
});
|
|
25052
|
-
}).map(
|
|
25124
|
+
}).map(_ref6 => {
|
|
25053
25125
|
let {
|
|
25054
25126
|
id
|
|
25055
|
-
} =
|
|
25127
|
+
} = _ref6;
|
|
25056
25128
|
return id;
|
|
25057
25129
|
}) : gridPaginatedVisibleSortedGridRowIdsSelector(apiRef);
|
|
25058
25130
|
const numberOfSelectableRowsInPage = selectableRowsInPage.length;
|
|
25059
|
-
const selectableRowsInTable = isRowSelectable ? gridFilteredSortedRowEntriesSelector(apiRef).filter(
|
|
25131
|
+
const selectableRowsInTable = isRowSelectable ? gridFilteredSortedRowEntriesSelector(apiRef).filter(_ref7 => {
|
|
25060
25132
|
let {
|
|
25061
25133
|
model
|
|
25062
|
-
} =
|
|
25134
|
+
} = _ref7;
|
|
25063
25135
|
return isRowSelectable({
|
|
25064
25136
|
row: model
|
|
25065
25137
|
});
|
|
25066
|
-
}).map(
|
|
25138
|
+
}).map(_ref8 => {
|
|
25067
25139
|
let {
|
|
25068
25140
|
id
|
|
25069
|
-
} =
|
|
25141
|
+
} = _ref8;
|
|
25070
25142
|
return id;
|
|
25071
25143
|
}) : gridFilteredSortedRowIdsSelector(apiRef);
|
|
25072
25144
|
const numberOfSelectableRowsInTable = selectableRowsInTable.length;
|
|
@@ -25077,38 +25149,34 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
25077
25149
|
}, 0);
|
|
25078
25150
|
}
|
|
25079
25151
|
if (numberOfSelectedRows === numberOfSelectableRowsInPage && numberOfSelectableRowsInPage < numberOfSelectableRowsInTable) {
|
|
25152
|
+
setSelectionStatusType('page');
|
|
25080
25153
|
selectionStatus.current = {
|
|
25081
25154
|
type: 'page',
|
|
25082
25155
|
numberOfSelectedRows
|
|
25083
25156
|
};
|
|
25084
25157
|
} else if (numberOfSelectedRows === numberOfSelectableRowsInTable && numberOfSelectableRowsInPage < numberOfSelectableRowsInTable) {
|
|
25158
|
+
setSelectionStatusType('table');
|
|
25085
25159
|
selectionStatus.current = {
|
|
25086
25160
|
type: 'table',
|
|
25087
25161
|
numberOfSelectedRows
|
|
25088
25162
|
};
|
|
25089
25163
|
} else if (numberOfSelectedRows > 0) {
|
|
25164
|
+
setSelectionStatusType('other');
|
|
25090
25165
|
selectionStatus.current = {
|
|
25091
25166
|
type: 'other',
|
|
25092
25167
|
numberOfSelectedRows
|
|
25093
25168
|
};
|
|
25094
25169
|
} else {
|
|
25170
|
+
setSelectionStatusType('none');
|
|
25095
25171
|
selectionStatus.current = {
|
|
25096
25172
|
type: 'none',
|
|
25097
25173
|
numberOfSelectedRows
|
|
25098
25174
|
};
|
|
25099
25175
|
}
|
|
25100
25176
|
}
|
|
25101
|
-
|
|
25177
|
+
onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
|
|
25102
25178
|
},
|
|
25103
|
-
sx: _objectSpread2(_objectSpread2({}, sx),
|
|
25104
|
-
'.MuiDataGrid-columnHeaders': {
|
|
25105
|
-
flexDirection: 'column',
|
|
25106
|
-
alignItems: 'normal'
|
|
25107
|
-
},
|
|
25108
|
-
'.MuiDataGrid-selectedRowCount': {
|
|
25109
|
-
margin: 'none'
|
|
25110
|
-
}
|
|
25111
|
-
})
|
|
25179
|
+
sx: _objectSpread2(_objectSpread2({}, sx), defaultSxStyle)
|
|
25112
25180
|
})))));
|
|
25113
25181
|
});
|
|
25114
25182
|
DataGrid.className = CLASSNAME$1;
|