@redsift/table 10.9.2-muiv5 → 10.9.2
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 +6 -5
- package/index.js +139 -161
- package/index.js.map +1 -1
- package/package.json +4 -4
package/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as _mui_x_data_grid_pro from '@mui/x-data-grid-pro';
|
|
2
2
|
import { GridFilterItem, GridCellParams, GridFilterOperator, GridFilterInputMultipleValue, DataGridProProps, GridFilterModel, GridToolbarExportProps, GridToolbarFilterButtonProps, GridToolbarColumnsButton, GridToolbarDensitySelector } from '@mui/x-data-grid-pro';
|
|
3
|
-
export
|
|
3
|
+
export * from '@mui/x-data-grid-pro';
|
|
4
|
+
export { GridAlignment, GridColDef, GridFilterItem, GridFilterModel, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators } from '@mui/x-data-grid-pro';
|
|
4
5
|
import { Theme, Comp, IconProps, NotificationsColorPalette, ProductColorPalette, ShieldVariant } from '@redsift/design-system';
|
|
5
6
|
import React, { ReactNode, ComponentProps, RefObject } from 'react';
|
|
6
7
|
import { TablePaginationProps } from '@mui/material';
|
|
@@ -10,7 +11,7 @@ declare const DETAIL_PANEL_TOGGLE_COL_DEF: _mui_x_data_grid_pro.GridColDef<any,
|
|
|
10
11
|
declare const IS_BETWEEN: {
|
|
11
12
|
label: string;
|
|
12
13
|
value: string;
|
|
13
|
-
getApplyFilterFn: (filterItem: GridFilterItem) => ((params: GridCellParams) => boolean) | null;
|
|
14
|
+
getApplyFilterFn: (filterItem: GridFilterItem) => ((params: GridCellParams<any, any>) => boolean) | null;
|
|
14
15
|
InputComponent: (props: any) => JSX.Element;
|
|
15
16
|
};
|
|
16
17
|
|
|
@@ -95,12 +96,12 @@ type StyledDataGridProps = {
|
|
|
95
96
|
declare const DataGrid: Comp<DataGridProps, HTMLDivElement>;
|
|
96
97
|
|
|
97
98
|
interface CompletionResponseItem {
|
|
98
|
-
|
|
99
|
-
|
|
99
|
+
field: string;
|
|
100
|
+
operator: string;
|
|
100
101
|
value?: string;
|
|
101
102
|
}
|
|
102
103
|
type CompletionResponse = {
|
|
103
|
-
|
|
104
|
+
logicOperator: 'and' | 'or';
|
|
104
105
|
items: CompletionResponseItem[];
|
|
105
106
|
};
|
|
106
107
|
interface LocaleText {
|
package/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
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, useGridApiRef, DataGridPro, gridPaginatedVisibleSortedGridRowEntriesSelector, gridPaginatedVisibleSortedGridRowIdsSelector, gridFilteredSortedRowEntriesSelector, gridFilteredSortedRowIdsSelector } 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
5
|
import React__default, { Children, isValidElement, cloneElement, useLayoutEffect, useEffect, useRef, forwardRef, useContext, useState, useCallback, createElement, useMemo } from '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',
|
|
@@ -21951,16 +21952,16 @@ const getRole = (config, dateFormat) => {
|
|
|
21951
21952
|
}).join('\n');
|
|
21952
21953
|
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.
|
|
21953
21954
|
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.
|
|
21954
|
-
The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "
|
|
21955
|
-
- "
|
|
21956
|
-
- "items": a list of conditions, each is an object with exactly the three keys "
|
|
21957
|
-
- "
|
|
21955
|
+
The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "logicOperator" and "items":
|
|
21956
|
+
- "logicOperator": the logical operator, only "and" or "or" are allowed. If there is only one condition in the "items", use "and".
|
|
21957
|
+
- "items": a list of conditions, each is an object with exactly the three keys "field", "operator" and "value":
|
|
21958
|
+
- "field": the column name, must be one of ${columns}
|
|
21958
21959
|
- "value":
|
|
21959
|
-
- this can be skipped if the "
|
|
21960
|
-
- a list of multiple values if the "
|
|
21960
|
+
- this can be skipped if the "operator" is either "isEmpty" or "isNotEmpty"
|
|
21961
|
+
- a list of multiple values if the "operator" ends with "AnyOf"
|
|
21961
21962
|
- otherwise, it's a single value represented as a string: "true" instead of true, "false" instead of false, "0.6" instead of 0.6.
|
|
21962
21963
|
For "date" data type, use ${dateFormat}. If relative date is input, convert to the actual date given today is ${today}.
|
|
21963
|
-
- "
|
|
21964
|
+
- "operator": the comparison operator, accepted values depend on the data type of the column
|
|
21964
21965
|
${operators}
|
|
21965
21966
|
|
|
21966
21967
|
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:
|
|
@@ -21997,10 +21998,10 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
21997
21998
|
nlpFilterConfig,
|
|
21998
21999
|
onFilterModelChange,
|
|
21999
22000
|
dateFormat = 'yyyy-mm-dd',
|
|
22000
|
-
defaultModel = 'gpt-4-
|
|
22001
|
+
defaultModel = 'gpt-4-1106-preview',
|
|
22001
22002
|
defaultFilter = {
|
|
22002
22003
|
items: [],
|
|
22003
|
-
|
|
22004
|
+
logicOperator: 'and'
|
|
22004
22005
|
},
|
|
22005
22006
|
disablePower = false,
|
|
22006
22007
|
localeText
|
|
@@ -22078,7 +22079,7 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
22078
22079
|
value: prompt
|
|
22079
22080
|
}), /*#__PURE__*/React__default.createElement(Button, {
|
|
22080
22081
|
variant: "primary",
|
|
22081
|
-
"
|
|
22082
|
+
"aria-label": buttonAriaLabel,
|
|
22082
22083
|
type: "submit",
|
|
22083
22084
|
isLoading: isLoading
|
|
22084
22085
|
}, buttonText)), !disablePower && /*#__PURE__*/React__default.createElement(Tooltip, null, /*#__PURE__*/React__default.createElement(Tooltip.Trigger, null, /*#__PURE__*/React__default.createElement(Switch, {
|
|
@@ -22139,7 +22140,7 @@ const Toolbar$3 = props => {
|
|
|
22139
22140
|
let {
|
|
22140
22141
|
apiRef
|
|
22141
22142
|
} = _ref;
|
|
22142
|
-
return
|
|
22143
|
+
return gridExpandedSortedRowIdsSelector(apiRef);
|
|
22143
22144
|
}
|
|
22144
22145
|
},
|
|
22145
22146
|
printOptions: {
|
|
@@ -24591,8 +24592,8 @@ process.env.NODE_ENV !== "production" ? TablePagination.propTypes /* remove-prop
|
|
|
24591
24592
|
} : void 0;
|
|
24592
24593
|
var TablePagination$1 = TablePagination;
|
|
24593
24594
|
|
|
24594
|
-
const _excluded$1 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "ControlledPagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "
|
|
24595
|
-
_excluded2 = ["apiRef", "autoHeight", "className", "
|
|
24595
|
+
const _excluded$1 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "ControlledPagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "paginationModel", "onPaginationModelChange", "pageSizeOptions", "paginationProps", "paginationMode", "rowCount"],
|
|
24596
|
+
_excluded2 = ["apiRef", "autoHeight", "className", "slots", "slotProps", "filterModel", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "onFilterModelChange", "rowSelectionModel", "paginationModel", "onPaginationModelChange", "onRowSelectionModelChange", "pagination", "paginationPlacement", "paginationProps", "rows", "pageSizeOptions", "sx", "theme", "paginationMode", "rowCount"];
|
|
24596
24597
|
const COMPONENT_NAME$1 = 'DataGrid';
|
|
24597
24598
|
const CLASSNAME$1 = 'redsift-datagrid';
|
|
24598
24599
|
const getSelectableRowsInTable = (apiRef, isRowSelectable) => {
|
|
@@ -24617,11 +24618,9 @@ const ControlledPagination = _ref3 => {
|
|
|
24617
24618
|
displayPagination = false,
|
|
24618
24619
|
selectionStatus,
|
|
24619
24620
|
apiRef,
|
|
24620
|
-
|
|
24621
|
-
|
|
24622
|
-
|
|
24623
|
-
onPageSizeChange,
|
|
24624
|
-
rowsPerPageOptions,
|
|
24621
|
+
paginationModel,
|
|
24622
|
+
onPaginationModelChange,
|
|
24623
|
+
pageSizeOptions,
|
|
24625
24624
|
isRowSelectable,
|
|
24626
24625
|
paginationProps
|
|
24627
24626
|
} = _ref3;
|
|
@@ -24651,13 +24650,17 @@ const ControlledPagination = _ref3 => {
|
|
|
24651
24650
|
}, `${selectionStatus.numberOfSelectedRows} row${selectionStatus.numberOfSelectedRows > 1 ? 's' : ''} selected`) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$2({
|
|
24652
24651
|
component: "div",
|
|
24653
24652
|
count: numberOfFilteredRowsInTable,
|
|
24654
|
-
page: page,
|
|
24655
|
-
onPageChange: (event,
|
|
24656
|
-
|
|
24657
|
-
|
|
24658
|
-
|
|
24659
|
-
|
|
24660
|
-
|
|
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 : []
|
|
24661
24664
|
}, paginationProps)) : null);
|
|
24662
24665
|
};
|
|
24663
24666
|
const ServerSideControlledPagination = _ref4 => {
|
|
@@ -24665,12 +24668,10 @@ const ServerSideControlledPagination = _ref4 => {
|
|
|
24665
24668
|
selectionStatus,
|
|
24666
24669
|
displaySelection,
|
|
24667
24670
|
displayPagination,
|
|
24668
|
-
|
|
24669
|
-
|
|
24670
|
-
|
|
24671
|
-
onPageSizeChange,
|
|
24671
|
+
paginationModel,
|
|
24672
|
+
onPaginationModelChange,
|
|
24673
|
+
pageSizeOptions,
|
|
24672
24674
|
displayRowsPerPage,
|
|
24673
|
-
rowsPerPageOptions,
|
|
24674
24675
|
paginationProps,
|
|
24675
24676
|
rowCount
|
|
24676
24677
|
} = _ref4;
|
|
@@ -24689,13 +24690,17 @@ const ServerSideControlledPagination = _ref4 => {
|
|
|
24689
24690
|
}, totalRowsLabel) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$2({
|
|
24690
24691
|
component: "div",
|
|
24691
24692
|
count: totalNumberOfRowsInTable,
|
|
24692
|
-
page: page,
|
|
24693
|
-
onPageChange: (event,
|
|
24694
|
-
|
|
24695
|
-
|
|
24696
|
-
|
|
24697
|
-
|
|
24698
|
-
|
|
24693
|
+
page: paginationModel.page,
|
|
24694
|
+
onPageChange: (event, page) => onPaginationModelChange({
|
|
24695
|
+
page,
|
|
24696
|
+
pageSize: paginationModel.pageSize
|
|
24697
|
+
}),
|
|
24698
|
+
rowsPerPage: paginationModel.pageSize,
|
|
24699
|
+
onRowsPerPageChange: event => onPaginationModelChange({
|
|
24700
|
+
page: paginationModel.page,
|
|
24701
|
+
pageSize: parseInt(event.target.value, 10)
|
|
24702
|
+
}),
|
|
24703
|
+
rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
|
|
24699
24704
|
}, paginationProps)) : null);
|
|
24700
24705
|
};
|
|
24701
24706
|
const Toolbar = _ref5 => {
|
|
@@ -24710,11 +24715,9 @@ const Toolbar = _ref5 => {
|
|
|
24710
24715
|
selectionStatus,
|
|
24711
24716
|
apiRef,
|
|
24712
24717
|
isRowSelectable,
|
|
24713
|
-
|
|
24714
|
-
|
|
24715
|
-
|
|
24716
|
-
onPageSizeChange,
|
|
24717
|
-
rowsPerPageOptions,
|
|
24718
|
+
paginationModel,
|
|
24719
|
+
onPaginationModelChange,
|
|
24720
|
+
pageSizeOptions,
|
|
24718
24721
|
paginationProps,
|
|
24719
24722
|
paginationMode = 'client',
|
|
24720
24723
|
rowCount
|
|
@@ -24728,11 +24731,9 @@ const Toolbar = _ref5 => {
|
|
|
24728
24731
|
displayRowsPerPage: false,
|
|
24729
24732
|
displayPagination: ['top', 'both'].includes(paginationPlacement),
|
|
24730
24733
|
selectionStatus: selectionStatus.current,
|
|
24731
|
-
|
|
24732
|
-
|
|
24733
|
-
|
|
24734
|
-
onPageSizeChange: onPageSizeChange,
|
|
24735
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
24734
|
+
paginationModel: paginationModel,
|
|
24735
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
24736
|
+
pageSizeOptions: pageSizeOptions,
|
|
24736
24737
|
paginationProps: paginationProps,
|
|
24737
24738
|
rowCount: rowCount
|
|
24738
24739
|
}) : /*#__PURE__*/React__default.createElement(ControlledPagination, {
|
|
@@ -24742,11 +24743,9 @@ const Toolbar = _ref5 => {
|
|
|
24742
24743
|
selectionStatus: selectionStatus.current,
|
|
24743
24744
|
apiRef: apiRef,
|
|
24744
24745
|
isRowSelectable: isRowSelectable,
|
|
24745
|
-
|
|
24746
|
-
|
|
24747
|
-
|
|
24748
|
-
onPageSizeChange: onPageSizeChange,
|
|
24749
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
24746
|
+
paginationModel: paginationModel,
|
|
24747
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
24748
|
+
pageSizeOptions: pageSizeOptions,
|
|
24750
24749
|
paginationProps: paginationProps
|
|
24751
24750
|
}) : null);
|
|
24752
24751
|
};
|
|
@@ -24806,14 +24805,14 @@ const onServerSideSelectionStatusChange = (newSelectionModel, apiRef, selectionS
|
|
|
24806
24805
|
}
|
|
24807
24806
|
};
|
|
24808
24807
|
const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
24809
|
-
var _initialState$paginat, _initialState$paginat2;
|
|
24808
|
+
var _ref8, _ref9, _initialState$paginat, _initialState$paginat2, _initialState$paginat3, _pageSizeOptions$, _ref10, _initialState$paginat4, _initialState$paginat5, _initialState$paginat6;
|
|
24810
24809
|
const datagridRef = ref || useRef();
|
|
24811
24810
|
const {
|
|
24812
24811
|
apiRef: propsApiRef,
|
|
24813
24812
|
autoHeight,
|
|
24814
24813
|
className,
|
|
24815
|
-
|
|
24816
|
-
|
|
24814
|
+
slots,
|
|
24815
|
+
slotProps,
|
|
24817
24816
|
filterModel: propsFilterModel,
|
|
24818
24817
|
height: propsHeight,
|
|
24819
24818
|
hideToolbar,
|
|
@@ -24821,17 +24820,15 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24821
24820
|
isRowSelectable,
|
|
24822
24821
|
license = process.env.MUI_LICENSE_KEY,
|
|
24823
24822
|
onFilterModelChange: propsOnFilterModelChange,
|
|
24824
|
-
|
|
24825
|
-
|
|
24826
|
-
|
|
24827
|
-
|
|
24828
|
-
page: propsPage,
|
|
24829
|
-
pageSize: propsPageSize,
|
|
24823
|
+
rowSelectionModel: propsSelectionModel,
|
|
24824
|
+
paginationModel: propsPaginationModel,
|
|
24825
|
+
onPaginationModelChange: propsOnPaginationModelChange,
|
|
24826
|
+
onRowSelectionModelChange: propsOnRowSelectionModelChange,
|
|
24830
24827
|
pagination,
|
|
24831
24828
|
paginationPlacement = 'both',
|
|
24832
24829
|
paginationProps,
|
|
24833
24830
|
rows,
|
|
24834
|
-
|
|
24831
|
+
pageSizeOptions,
|
|
24835
24832
|
sx,
|
|
24836
24833
|
theme: propsTheme,
|
|
24837
24834
|
paginationMode = 'client',
|
|
@@ -24841,7 +24838,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24841
24838
|
const theme = useTheme$4(propsTheme);
|
|
24842
24839
|
const _apiRef = useGridApiRef();
|
|
24843
24840
|
const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
|
|
24844
|
-
const RenderedToolbar =
|
|
24841
|
+
const RenderedToolbar = slots !== null && slots !== void 0 && slots.toolbar ? slots.toolbar : Toolbar$3;
|
|
24845
24842
|
LicenseInfo.setLicenseKey(license);
|
|
24846
24843
|
const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
|
|
24847
24844
|
const [filterModel, setFilterModel] = useState(propsFilterModel);
|
|
@@ -24855,59 +24852,48 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24855
24852
|
setFilterModel(model);
|
|
24856
24853
|
}
|
|
24857
24854
|
};
|
|
24858
|
-
const [
|
|
24855
|
+
const [rowSelectionModel, setRowSelectionModel] = useState(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
|
|
24859
24856
|
useEffect(() => {
|
|
24860
|
-
|
|
24857
|
+
setRowSelectionModel(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
|
|
24861
24858
|
}, [propsSelectionModel]);
|
|
24862
|
-
const
|
|
24863
|
-
if (
|
|
24864
|
-
|
|
24859
|
+
const onRowSelectionModelChange = (selectionModel, details) => {
|
|
24860
|
+
if (propsOnRowSelectionModelChange) {
|
|
24861
|
+
propsOnRowSelectionModelChange(selectionModel, details);
|
|
24865
24862
|
} else {
|
|
24866
|
-
|
|
24863
|
+
setRowSelectionModel(selectionModel);
|
|
24867
24864
|
}
|
|
24868
24865
|
};
|
|
24869
|
-
const [
|
|
24870
|
-
|
|
24871
|
-
|
|
24872
|
-
type: 'none',
|
|
24873
|
-
numberOfSelectedRows: 0,
|
|
24874
|
-
numberOfSelectedRowsInPage: 0,
|
|
24875
|
-
page,
|
|
24876
|
-
pageSize
|
|
24866
|
+
const [paginationModel, setPaginationModel] = useState({
|
|
24867
|
+
pageSize: (_ref8 = (_ref9 = (_initialState$paginat = initialState === null || initialState === void 0 ? void 0 : (_initialState$paginat2 = initialState.pagination) === null || _initialState$paginat2 === void 0 ? void 0 : (_initialState$paginat3 = _initialState$paginat2.paginationModel) === null || _initialState$paginat3 === void 0 ? void 0 : _initialState$paginat3.pageSize) !== null && _initialState$paginat !== void 0 ? _initialState$paginat : propsPaginationModel === null || propsPaginationModel === void 0 ? void 0 : propsPaginationModel.pageSize) !== null && _ref9 !== void 0 ? _ref9 : typeof (pageSizeOptions === null || pageSizeOptions === void 0 ? void 0 : pageSizeOptions[0]) === 'number' ? pageSizeOptions === null || pageSizeOptions === void 0 ? void 0 : pageSizeOptions[0] : pageSizeOptions === null || pageSizeOptions === void 0 ? void 0 : (_pageSizeOptions$ = pageSizeOptions[0]) === null || _pageSizeOptions$ === void 0 ? void 0 : _pageSizeOptions$.value) !== null && _ref8 !== void 0 ? _ref8 : 100,
|
|
24868
|
+
page: (_ref10 = (_initialState$paginat4 = initialState === null || initialState === void 0 ? void 0 : (_initialState$paginat5 = initialState.pagination) === null || _initialState$paginat5 === void 0 ? void 0 : (_initialState$paginat6 = _initialState$paginat5.paginationModel) === null || _initialState$paginat6 === void 0 ? void 0 : _initialState$paginat6.page) !== null && _initialState$paginat4 !== void 0 ? _initialState$paginat4 : propsPaginationModel === null || propsPaginationModel === void 0 ? void 0 : propsPaginationModel.page) !== null && _ref10 !== void 0 ? _ref10 : 0
|
|
24877
24869
|
});
|
|
24878
|
-
const
|
|
24879
|
-
if (
|
|
24880
|
-
|
|
24881
|
-
} else {
|
|
24882
|
-
setPage(page);
|
|
24883
|
-
}
|
|
24884
|
-
};
|
|
24885
|
-
useEffect(() => {
|
|
24886
|
-
if (propsPage || propsPage === 0) {
|
|
24887
|
-
setPage(propsPage);
|
|
24888
|
-
}
|
|
24889
|
-
}, [propsPage]);
|
|
24890
|
-
const onPageSizeChange = pageSize => {
|
|
24891
|
-
onPageChange(0);
|
|
24892
|
-
if (propsOnPageSizeChange) {
|
|
24893
|
-
propsOnPageSizeChange(pageSize, undefined);
|
|
24870
|
+
const onPaginationModelChange = model => {
|
|
24871
|
+
if (propsOnPaginationModelChange) {
|
|
24872
|
+
propsOnPaginationModelChange(model, undefined);
|
|
24894
24873
|
} else {
|
|
24895
|
-
|
|
24874
|
+
setPaginationModel(model);
|
|
24896
24875
|
}
|
|
24897
24876
|
};
|
|
24898
24877
|
useEffect(() => {
|
|
24899
|
-
if (
|
|
24900
|
-
|
|
24878
|
+
if (propsPaginationModel) {
|
|
24879
|
+
setPaginationModel(propsPaginationModel);
|
|
24901
24880
|
}
|
|
24902
|
-
}, [
|
|
24881
|
+
}, [propsPaginationModel]);
|
|
24882
|
+
const selectionStatus = useRef({
|
|
24883
|
+
type: 'none',
|
|
24884
|
+
numberOfSelectedRows: 0,
|
|
24885
|
+
numberOfSelectedRowsInPage: 0,
|
|
24886
|
+
page: paginationModel.page,
|
|
24887
|
+
pageSize: paginationModel.pageSize
|
|
24888
|
+
});
|
|
24903
24889
|
|
|
24904
24890
|
// in server-side pagination we want to update the selection status
|
|
24905
24891
|
// every time we navigate between pages, resize our page or select something
|
|
24906
24892
|
useEffect(() => {
|
|
24907
24893
|
if (paginationMode == 'server') {
|
|
24908
|
-
onServerSideSelectionStatusChange(Array.isArray(
|
|
24894
|
+
onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatus, isRowSelectable, paginationModel.page, paginationModel.pageSize);
|
|
24909
24895
|
}
|
|
24910
|
-
}, [
|
|
24896
|
+
}, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
|
|
24911
24897
|
if (!Array.isArray(rows)) {
|
|
24912
24898
|
return null;
|
|
24913
24899
|
}
|
|
@@ -24938,56 +24924,54 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24938
24924
|
apiRef: apiRef,
|
|
24939
24925
|
autoHeight: autoHeight,
|
|
24940
24926
|
checkboxSelectionVisibleOnly: Boolean(pagination),
|
|
24941
|
-
|
|
24942
|
-
BaseButton,
|
|
24943
|
-
BaseCheckbox,
|
|
24944
|
-
//
|
|
24945
|
-
BasePopper,
|
|
24946
|
-
|
|
24927
|
+
slots: _objectSpread2(_objectSpread2({
|
|
24928
|
+
baseButton: BaseButton,
|
|
24929
|
+
baseCheckbox: BaseCheckbox,
|
|
24930
|
+
// baseTextField,
|
|
24931
|
+
basePopper: BasePopper,
|
|
24932
|
+
columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24947
24933
|
displayName: "ColumnFilteredIcon"
|
|
24948
24934
|
})),
|
|
24949
|
-
|
|
24935
|
+
columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24950
24936
|
displayName: "ColumnSelectorIcon"
|
|
24951
24937
|
})),
|
|
24952
|
-
|
|
24938
|
+
columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24953
24939
|
displayName: "ColumnSortedAscendingIcon"
|
|
24954
24940
|
})),
|
|
24955
|
-
|
|
24941
|
+
columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24956
24942
|
displayName: "ColumnSortedDescendingIcon"
|
|
24957
24943
|
})),
|
|
24958
|
-
|
|
24944
|
+
densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24959
24945
|
displayName: "DensityCompactIcon"
|
|
24960
24946
|
})),
|
|
24961
|
-
|
|
24947
|
+
densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24962
24948
|
displayName: "DensityStandardIcon"
|
|
24963
24949
|
})),
|
|
24964
|
-
|
|
24950
|
+
densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24965
24951
|
displayName: "DensityComfortableIcon"
|
|
24966
24952
|
})),
|
|
24967
|
-
|
|
24953
|
+
detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24968
24954
|
displayName: "DetailPanelCollapseIcon"
|
|
24969
24955
|
})),
|
|
24970
|
-
|
|
24956
|
+
detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24971
24957
|
displayName: "DetailPanelExpandIcon"
|
|
24972
24958
|
})),
|
|
24973
|
-
|
|
24959
|
+
exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24974
24960
|
displayName: "ExportIcon"
|
|
24975
24961
|
})),
|
|
24976
|
-
|
|
24962
|
+
openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({
|
|
24977
24963
|
displayName: "OpenFilterButtonIcon"
|
|
24978
24964
|
}, props))
|
|
24979
|
-
},
|
|
24980
|
-
|
|
24981
|
-
|
|
24965
|
+
}, slots), {}, {
|
|
24966
|
+
toolbar: Toolbar,
|
|
24967
|
+
pagination: props => pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$2({}, props, {
|
|
24982
24968
|
displaySelection: false,
|
|
24983
24969
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
24984
24970
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
24985
24971
|
selectionStatus: selectionStatus.current,
|
|
24986
|
-
|
|
24987
|
-
|
|
24988
|
-
|
|
24989
|
-
onPageSizeChange: onPageSizeChange,
|
|
24990
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
24972
|
+
paginationModel: paginationModel,
|
|
24973
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
24974
|
+
pageSizeOptions: pageSizeOptions,
|
|
24991
24975
|
paginationProps: paginationProps,
|
|
24992
24976
|
paginationMode: paginationMode,
|
|
24993
24977
|
rowCount: rowCount
|
|
@@ -24998,16 +24982,14 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24998
24982
|
selectionStatus: selectionStatus.current,
|
|
24999
24983
|
apiRef: apiRef,
|
|
25000
24984
|
isRowSelectable: isRowSelectable,
|
|
25001
|
-
|
|
25002
|
-
|
|
25003
|
-
|
|
25004
|
-
onPageSizeChange: onPageSizeChange,
|
|
25005
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
24985
|
+
paginationModel: paginationModel,
|
|
24986
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
24987
|
+
pageSizeOptions: pageSizeOptions,
|
|
25006
24988
|
paginationProps: paginationProps,
|
|
25007
24989
|
paginationMode: paginationMode
|
|
25008
24990
|
})) : null
|
|
25009
24991
|
}),
|
|
25010
|
-
|
|
24992
|
+
slotProps: _objectSpread2(_objectSpread2({}, slotProps), {}, {
|
|
25011
24993
|
toolbar: _objectSpread2({
|
|
25012
24994
|
hideToolbar,
|
|
25013
24995
|
RenderedToolbar,
|
|
@@ -25019,15 +25001,13 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
25019
25001
|
selectionStatus,
|
|
25020
25002
|
apiRef,
|
|
25021
25003
|
isRowSelectable,
|
|
25022
|
-
|
|
25023
|
-
|
|
25024
|
-
|
|
25025
|
-
onPageSizeChange,
|
|
25026
|
-
rowsPerPageOptions,
|
|
25004
|
+
paginationModel,
|
|
25005
|
+
onPaginationModelChange,
|
|
25006
|
+
pageSizeOptions,
|
|
25027
25007
|
paginationProps,
|
|
25028
25008
|
paginationMode,
|
|
25029
25009
|
rowCount
|
|
25030
|
-
},
|
|
25010
|
+
}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar)
|
|
25031
25011
|
}),
|
|
25032
25012
|
filterModel: filterModel,
|
|
25033
25013
|
initialState: initialState,
|
|
@@ -25037,39 +25017,37 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
25037
25017
|
paginationMode: paginationMode,
|
|
25038
25018
|
keepNonExistentRowsSelected: paginationMode == 'server',
|
|
25039
25019
|
rows: rows,
|
|
25040
|
-
|
|
25041
|
-
|
|
25042
|
-
|
|
25043
|
-
|
|
25044
|
-
|
|
25045
|
-
selectionModel: selectionModel,
|
|
25046
|
-
onSelectionModelChange: (newSelectionModel, details) => {
|
|
25020
|
+
pageSizeOptions: pageSizeOptions,
|
|
25021
|
+
paginationModel: paginationModel,
|
|
25022
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
25023
|
+
rowSelectionModel: rowSelectionModel,
|
|
25024
|
+
onRowSelectionModelChange: (newSelectionModel, details) => {
|
|
25047
25025
|
if (pagination && paginationMode != 'server') {
|
|
25048
|
-
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(
|
|
25026
|
+
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref11 => {
|
|
25049
25027
|
let {
|
|
25050
25028
|
model
|
|
25051
|
-
} =
|
|
25029
|
+
} = _ref11;
|
|
25052
25030
|
return isRowSelectable({
|
|
25053
25031
|
row: model
|
|
25054
25032
|
});
|
|
25055
|
-
}).map(
|
|
25033
|
+
}).map(_ref12 => {
|
|
25056
25034
|
let {
|
|
25057
25035
|
id
|
|
25058
|
-
} =
|
|
25036
|
+
} = _ref12;
|
|
25059
25037
|
return id;
|
|
25060
25038
|
}) : gridPaginatedVisibleSortedGridRowIdsSelector(apiRef);
|
|
25061
25039
|
const numberOfSelectableRowsInPage = selectableRowsInPage.length;
|
|
25062
|
-
const selectableRowsInTable = isRowSelectable ? gridFilteredSortedRowEntriesSelector(apiRef).filter(
|
|
25040
|
+
const selectableRowsInTable = isRowSelectable ? gridFilteredSortedRowEntriesSelector(apiRef).filter(_ref13 => {
|
|
25063
25041
|
let {
|
|
25064
25042
|
model
|
|
25065
|
-
} =
|
|
25043
|
+
} = _ref13;
|
|
25066
25044
|
return isRowSelectable({
|
|
25067
25045
|
row: model
|
|
25068
25046
|
});
|
|
25069
|
-
}).map(
|
|
25047
|
+
}).map(_ref14 => {
|
|
25070
25048
|
let {
|
|
25071
25049
|
id
|
|
25072
|
-
} =
|
|
25050
|
+
} = _ref14;
|
|
25073
25051
|
return id;
|
|
25074
25052
|
}) : gridFilteredSortedRowIdsSelector(apiRef);
|
|
25075
25053
|
const numberOfSelectableRowsInTable = selectableRowsInTable.length;
|
|
@@ -25101,7 +25079,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
25101
25079
|
};
|
|
25102
25080
|
}
|
|
25103
25081
|
}
|
|
25104
|
-
|
|
25082
|
+
onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
|
|
25105
25083
|
},
|
|
25106
25084
|
sx: _objectSpread2(_objectSpread2({}, sx), {}, {
|
|
25107
25085
|
'.MuiDataGrid-columnHeaders': {
|