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