@redsift/table 10.2.0 → 10.3.0-muiv5-alpha.0
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 +161 -138
- 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,9 +1,8 @@
|
|
|
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
|
-
import React__default, { Children, isValidElement, cloneElement, useLayoutEffect, useEffect, useRef, forwardRef, useState, useCallback, createElement, useMemo } from 'react';
|
|
6
|
-
import { Icon, baseContainer, Theme, useTheme as useTheme$4, useId as useId$2, partitionComponents, isComponent, Flexbox, TextField as TextField$2, Button, Switch, Text, ButtonsColorPalette, IconButton as IconButton$2, Checkbox, ThemeProvider as ThemeProvider$4, LinkButton, RedsiftColorBlueN, RedsiftColorNeutralXDarkGrey, RedsiftColorNeutralWhite, Shield } from '@redsift/design-system';
|
|
4
|
+
import React__default, { Children, isValidElement, cloneElement, useLayoutEffect, useEffect, useRef, forwardRef, useContext, useState, useCallback, createElement, useMemo } from 'react';
|
|
5
|
+
import { Icon, baseContainer, Theme, AppContainerContext, useTheme as useTheme$4, useId as useId$2, partitionComponents, isComponent, Flexbox, TextField as TextField$2, Button, Switch, Text, ButtonsColorPalette, IconButton as IconButton$2, Checkbox, ThemeProvider as ThemeProvider$4, LinkButton, RedsiftColorBlueN, RedsiftColorNeutralXDarkGrey, RedsiftColorNeutralWhite, Shield } from '@redsift/design-system';
|
|
7
6
|
import { mdiSync, mdiFilterVariant, mdiViewColumn, mdiChevronUp, mdiChevronDown, mdiViewHeadline, mdiViewSequential, mdiViewStream, mdiChevronRight, mdiTrayArrowDown } from '@redsift/icons';
|
|
8
7
|
import emStyled from '@emotion/styled';
|
|
9
8
|
import { Global, ThemeContext as ThemeContext$3, keyframes } from '@emotion/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',
|
|
@@ -21685,6 +21684,7 @@ const TooltipContent = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
21685
21684
|
style,
|
|
21686
21685
|
theme: propsTheme
|
|
21687
21686
|
} = props;
|
|
21687
|
+
const appContainerState = useContext(AppContainerContext);
|
|
21688
21688
|
const {
|
|
21689
21689
|
getFloatingProps,
|
|
21690
21690
|
isOpen,
|
|
@@ -21712,7 +21712,7 @@ const TooltipContent = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
21712
21712
|
left: 'right'
|
|
21713
21713
|
}[placement.split('-')[0]];
|
|
21714
21714
|
return /*#__PURE__*/React__default.createElement(FloatingPortal, {
|
|
21715
|
-
|
|
21715
|
+
root: appContainerState === null || appContainerState === void 0 ? void 0 : appContainerState.appContainerRef.current
|
|
21716
21716
|
}, isOpen && /*#__PURE__*/React__default.createElement(StyledTooltipContent, _extends$2({
|
|
21717
21717
|
className: classNames(TooltipContent.className, className),
|
|
21718
21718
|
ref: popoverRef,
|
|
@@ -21918,10 +21918,10 @@ const COMPONENT_NAME$2 = 'GridToolbarFilterSemanticField';
|
|
|
21918
21918
|
const CLASSNAME$2 = 'redsift-datagrid-toolbar-nlp-filter-field';
|
|
21919
21919
|
const DEFAULT_PROPS$1 = {
|
|
21920
21920
|
dateFormat: 'yyyy-mm-dd',
|
|
21921
|
-
defaultModel: 'gpt-4-
|
|
21921
|
+
defaultModel: 'gpt-4-0613',
|
|
21922
21922
|
defaultFilter: {
|
|
21923
21923
|
items: [],
|
|
21924
|
-
|
|
21924
|
+
linkOperator: 'and'
|
|
21925
21925
|
},
|
|
21926
21926
|
disablePower: false,
|
|
21927
21927
|
localeText: {
|
|
@@ -21962,16 +21962,16 @@ const getRole = (config, dateFormat) => {
|
|
|
21962
21962
|
}).join('\n');
|
|
21963
21963
|
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.
|
|
21964
21964
|
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.
|
|
21965
|
-
The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "
|
|
21966
|
-
- "
|
|
21967
|
-
- "items": a list of conditions, each is an object with exactly the three keys "
|
|
21968
|
-
- "
|
|
21965
|
+
The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "linkOperator" and "items":
|
|
21966
|
+
- "linkOperator": the logical operator, only "and" or "or" are allowed. If there is only one condition in the "items", use "and".
|
|
21967
|
+
- "items": a list of conditions, each is an object with exactly the three keys "columnField", "operatorValue" and "value":
|
|
21968
|
+
- "columnField": the column name, must be one of ${columns}
|
|
21969
21969
|
- "value":
|
|
21970
|
-
- this can be skipped if the "
|
|
21971
|
-
- a list of multiple values if the "
|
|
21970
|
+
- this can be skipped if the "operatorValue" is either "isEmpty" or "isNotEmpty"
|
|
21971
|
+
- a list of multiple values if the "operatorValue" ends with "AnyOf"
|
|
21972
21972
|
- otherwise, it's a single value represented as a string: "true" instead of true, "false" instead of false, "0.6" instead of 0.6.
|
|
21973
21973
|
For "date" data type, use ${dateFormat}. If relative date is input, convert to the actual date given today is ${today}.
|
|
21974
|
-
- "
|
|
21974
|
+
- "operatorValue": the comparison operator, accepted values depend on the data type of the column
|
|
21975
21975
|
${operators}
|
|
21976
21976
|
|
|
21977
21977
|
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:
|
|
@@ -22078,7 +22078,7 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
22078
22078
|
value: prompt
|
|
22079
22079
|
}), /*#__PURE__*/React__default.createElement(Button, {
|
|
22080
22080
|
variant: "primary",
|
|
22081
|
-
"
|
|
22081
|
+
"aira-label": buttonAriaLabel,
|
|
22082
22082
|
type: "submit",
|
|
22083
22083
|
isLoading: isLoading
|
|
22084
22084
|
}, buttonText)), !disablePower && /*#__PURE__*/React__default.createElement(Tooltip, null, /*#__PURE__*/React__default.createElement(Tooltip.Trigger, null, /*#__PURE__*/React__default.createElement(Switch, {
|
|
@@ -22140,7 +22140,7 @@ const Toolbar$3 = props => {
|
|
|
22140
22140
|
let {
|
|
22141
22141
|
apiRef
|
|
22142
22142
|
} = _ref;
|
|
22143
|
-
return
|
|
22143
|
+
return gridVisibleSortedRowIdsSelector(apiRef);
|
|
22144
22144
|
}
|
|
22145
22145
|
},
|
|
22146
22146
|
printOptions: {
|
|
@@ -24592,8 +24592,8 @@ process.env.NODE_ENV !== "production" ? TablePagination.propTypes /* remove-prop
|
|
|
24592
24592
|
} : void 0;
|
|
24593
24593
|
var TablePagination$1 = TablePagination;
|
|
24594
24594
|
|
|
24595
|
-
const _excluded$1 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "ControlledPagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "
|
|
24596
|
-
_excluded2 = ["apiRef", "autoHeight", "className", "
|
|
24595
|
+
const _excluded$1 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "ControlledPagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "page", "onPageChange", "pageSize", "onPageSizeChange", "rowsPerPageOptions", "paginationProps", "paginationMode", "rowCount"],
|
|
24596
|
+
_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
24597
|
const COMPONENT_NAME$1 = 'DataGrid';
|
|
24598
24598
|
const CLASSNAME$1 = 'redsift-datagrid';
|
|
24599
24599
|
const DEFAULT_PROPS = {
|
|
@@ -24622,9 +24622,11 @@ const ControlledPagination = _ref3 => {
|
|
|
24622
24622
|
displayPagination = false,
|
|
24623
24623
|
selectionStatus,
|
|
24624
24624
|
apiRef,
|
|
24625
|
-
|
|
24626
|
-
|
|
24627
|
-
|
|
24625
|
+
page,
|
|
24626
|
+
onPageChange,
|
|
24627
|
+
pageSize,
|
|
24628
|
+
onPageSizeChange,
|
|
24629
|
+
rowsPerPageOptions,
|
|
24628
24630
|
isRowSelectable,
|
|
24629
24631
|
paginationProps
|
|
24630
24632
|
} = _ref3;
|
|
@@ -24654,17 +24656,13 @@ const ControlledPagination = _ref3 => {
|
|
|
24654
24656
|
}, `${selectionStatus.numberOfSelectedRows} row${selectionStatus.numberOfSelectedRows > 1 ? 's' : ''} selected`) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$2({
|
|
24655
24657
|
component: "div",
|
|
24656
24658
|
count: numberOfFilteredRowsInTable,
|
|
24657
|
-
page:
|
|
24658
|
-
onPageChange: (event,
|
|
24659
|
-
|
|
24660
|
-
|
|
24661
|
-
|
|
24662
|
-
|
|
24663
|
-
|
|
24664
|
-
page: paginationModel.page,
|
|
24665
|
-
pageSize: parseInt(event.target.value, 10)
|
|
24666
|
-
}),
|
|
24667
|
-
rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
|
|
24659
|
+
page: page,
|
|
24660
|
+
onPageChange: (event, newPage) => onPageChange(newPage),
|
|
24661
|
+
rowsPerPage: pageSize,
|
|
24662
|
+
onRowsPerPageChange: event => {
|
|
24663
|
+
onPageSizeChange(parseInt(event.target.value, 10));
|
|
24664
|
+
},
|
|
24665
|
+
rowsPerPageOptions: displayRowsPerPage ? rowsPerPageOptions : []
|
|
24668
24666
|
}, paginationProps)) : null);
|
|
24669
24667
|
};
|
|
24670
24668
|
const ServerSideControlledPagination = _ref4 => {
|
|
@@ -24672,10 +24670,12 @@ const ServerSideControlledPagination = _ref4 => {
|
|
|
24672
24670
|
selectionStatus,
|
|
24673
24671
|
displaySelection,
|
|
24674
24672
|
displayPagination,
|
|
24675
|
-
|
|
24676
|
-
|
|
24677
|
-
|
|
24673
|
+
page,
|
|
24674
|
+
onPageChange,
|
|
24675
|
+
pageSize,
|
|
24676
|
+
onPageSizeChange,
|
|
24678
24677
|
displayRowsPerPage,
|
|
24678
|
+
rowsPerPageOptions,
|
|
24679
24679
|
paginationProps,
|
|
24680
24680
|
rowCount
|
|
24681
24681
|
} = _ref4;
|
|
@@ -24694,17 +24694,13 @@ const ServerSideControlledPagination = _ref4 => {
|
|
|
24694
24694
|
}, totalRowsLabel) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$2({
|
|
24695
24695
|
component: "div",
|
|
24696
24696
|
count: totalNumberOfRowsInTable,
|
|
24697
|
-
page:
|
|
24698
|
-
onPageChange: (event,
|
|
24699
|
-
|
|
24700
|
-
|
|
24701
|
-
|
|
24702
|
-
|
|
24703
|
-
|
|
24704
|
-
page: paginationModel.page,
|
|
24705
|
-
pageSize: parseInt(event.target.value, 10)
|
|
24706
|
-
}),
|
|
24707
|
-
rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
|
|
24697
|
+
page: page,
|
|
24698
|
+
onPageChange: (event, newPage) => onPageChange(newPage),
|
|
24699
|
+
rowsPerPage: pageSize,
|
|
24700
|
+
onRowsPerPageChange: event => {
|
|
24701
|
+
onPageSizeChange(parseInt(event.target.value, 10));
|
|
24702
|
+
},
|
|
24703
|
+
rowsPerPageOptions: displayRowsPerPage ? rowsPerPageOptions : []
|
|
24708
24704
|
}, paginationProps)) : null);
|
|
24709
24705
|
};
|
|
24710
24706
|
const Toolbar = _ref5 => {
|
|
@@ -24719,9 +24715,11 @@ const Toolbar = _ref5 => {
|
|
|
24719
24715
|
selectionStatus,
|
|
24720
24716
|
apiRef,
|
|
24721
24717
|
isRowSelectable,
|
|
24722
|
-
|
|
24723
|
-
|
|
24724
|
-
|
|
24718
|
+
page,
|
|
24719
|
+
onPageChange,
|
|
24720
|
+
pageSize,
|
|
24721
|
+
onPageSizeChange,
|
|
24722
|
+
rowsPerPageOptions,
|
|
24725
24723
|
paginationProps,
|
|
24726
24724
|
paginationMode = 'client',
|
|
24727
24725
|
rowCount
|
|
@@ -24735,9 +24733,11 @@ const Toolbar = _ref5 => {
|
|
|
24735
24733
|
displayRowsPerPage: false,
|
|
24736
24734
|
displayPagination: ['top', 'both'].includes(paginationPlacement),
|
|
24737
24735
|
selectionStatus: selectionStatus.current,
|
|
24738
|
-
|
|
24739
|
-
|
|
24740
|
-
|
|
24736
|
+
page: page,
|
|
24737
|
+
onPageChange: onPageChange,
|
|
24738
|
+
pageSize: pageSize,
|
|
24739
|
+
onPageSizeChange: onPageSizeChange,
|
|
24740
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
24741
24741
|
paginationProps: paginationProps,
|
|
24742
24742
|
rowCount: rowCount
|
|
24743
24743
|
}) : /*#__PURE__*/React__default.createElement(ControlledPagination, {
|
|
@@ -24747,9 +24747,11 @@ const Toolbar = _ref5 => {
|
|
|
24747
24747
|
selectionStatus: selectionStatus.current,
|
|
24748
24748
|
apiRef: apiRef,
|
|
24749
24749
|
isRowSelectable: isRowSelectable,
|
|
24750
|
-
|
|
24751
|
-
|
|
24752
|
-
|
|
24750
|
+
page: page,
|
|
24751
|
+
onPageChange: onPageChange,
|
|
24752
|
+
pageSize: pageSize,
|
|
24753
|
+
onPageSizeChange: onPageSizeChange,
|
|
24754
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
24753
24755
|
paginationProps: paginationProps
|
|
24754
24756
|
}) : null);
|
|
24755
24757
|
};
|
|
@@ -24809,14 +24811,14 @@ const onServerSideSelectionStatusChange = (newSelectionModel, apiRef, selectionS
|
|
|
24809
24811
|
}
|
|
24810
24812
|
};
|
|
24811
24813
|
const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
24812
|
-
var
|
|
24814
|
+
var _initialState$paginat, _initialState$paginat2;
|
|
24813
24815
|
const datagridRef = ref || useRef();
|
|
24814
24816
|
const {
|
|
24815
24817
|
apiRef: propsApiRef,
|
|
24816
24818
|
autoHeight,
|
|
24817
24819
|
className,
|
|
24818
|
-
|
|
24819
|
-
|
|
24820
|
+
components,
|
|
24821
|
+
componentsProps,
|
|
24820
24822
|
filterModel: propsFilterModel,
|
|
24821
24823
|
height: propsHeight,
|
|
24822
24824
|
hideToolbar,
|
|
@@ -24824,15 +24826,17 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24824
24826
|
isRowSelectable,
|
|
24825
24827
|
license,
|
|
24826
24828
|
onFilterModelChange: propsOnFilterModelChange,
|
|
24827
|
-
|
|
24828
|
-
|
|
24829
|
-
|
|
24830
|
-
|
|
24829
|
+
onPageChange: propsOnPageChange,
|
|
24830
|
+
onPageSizeChange: propsOnPageSizeChange,
|
|
24831
|
+
selectionModel: propsSelectionModel,
|
|
24832
|
+
onSelectionModelChange,
|
|
24833
|
+
page: propsPage,
|
|
24834
|
+
pageSize: propsPageSize,
|
|
24831
24835
|
pagination,
|
|
24832
24836
|
paginationPlacement,
|
|
24833
24837
|
paginationProps,
|
|
24834
24838
|
rows,
|
|
24835
|
-
|
|
24839
|
+
rowsPerPageOptions,
|
|
24836
24840
|
sx,
|
|
24837
24841
|
theme: propsTheme,
|
|
24838
24842
|
paginationMode = 'client',
|
|
@@ -24842,7 +24846,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24842
24846
|
const theme = useTheme$4(propsTheme);
|
|
24843
24847
|
const _apiRef = useGridApiRef();
|
|
24844
24848
|
const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
|
|
24845
|
-
const RenderedToolbar =
|
|
24849
|
+
const RenderedToolbar = components !== null && components !== void 0 && components.Toolbar ? components.Toolbar : Toolbar$3;
|
|
24846
24850
|
LicenseInfo.setLicenseKey(license);
|
|
24847
24851
|
const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
|
|
24848
24852
|
const [filterModel, setFilterModel] = useState(propsFilterModel);
|
|
@@ -24856,41 +24860,52 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24856
24860
|
setFilterModel(model);
|
|
24857
24861
|
}
|
|
24858
24862
|
};
|
|
24859
|
-
const [
|
|
24863
|
+
const [selectionModel, setSelectionModel] = useState(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
|
|
24860
24864
|
useEffect(() => {
|
|
24861
|
-
|
|
24865
|
+
setSelectionModel(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
|
|
24862
24866
|
}, [propsSelectionModel]);
|
|
24863
|
-
const [
|
|
24864
|
-
|
|
24865
|
-
|
|
24867
|
+
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);
|
|
24868
|
+
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);
|
|
24869
|
+
const selectionStatus = useRef({
|
|
24870
|
+
type: 'none',
|
|
24871
|
+
numberOfSelectedRows: 0,
|
|
24872
|
+
numberOfSelectedRowsInPage: 0,
|
|
24873
|
+
page,
|
|
24874
|
+
pageSize
|
|
24866
24875
|
});
|
|
24867
|
-
const
|
|
24868
|
-
if (
|
|
24869
|
-
|
|
24876
|
+
const onPageChange = page => {
|
|
24877
|
+
if (propsOnPageChange) {
|
|
24878
|
+
propsOnPageChange(page, undefined);
|
|
24870
24879
|
} else {
|
|
24871
|
-
|
|
24880
|
+
setPage(page);
|
|
24872
24881
|
}
|
|
24873
24882
|
};
|
|
24874
24883
|
useEffect(() => {
|
|
24875
|
-
if (
|
|
24876
|
-
|
|
24884
|
+
if (propsPage || propsPage === 0) {
|
|
24885
|
+
setPage(propsPage);
|
|
24886
|
+
}
|
|
24887
|
+
}, [propsPage]);
|
|
24888
|
+
const onPageSizeChange = pageSize => {
|
|
24889
|
+
onPageChange(0);
|
|
24890
|
+
if (propsOnPageSizeChange) {
|
|
24891
|
+
propsOnPageSizeChange(pageSize, undefined);
|
|
24892
|
+
} else {
|
|
24893
|
+
setPageSize(pageSize);
|
|
24877
24894
|
}
|
|
24878
|
-
}
|
|
24879
|
-
|
|
24880
|
-
|
|
24881
|
-
|
|
24882
|
-
|
|
24883
|
-
|
|
24884
|
-
pageSize: paginationModel.pageSize
|
|
24885
|
-
});
|
|
24895
|
+
};
|
|
24896
|
+
useEffect(() => {
|
|
24897
|
+
if (propsPageSize) {
|
|
24898
|
+
setPageSize(propsPageSize);
|
|
24899
|
+
}
|
|
24900
|
+
}, [propsPageSize]);
|
|
24886
24901
|
|
|
24887
24902
|
// in server-side pagination we want to update the selection status
|
|
24888
24903
|
// every time we navigate between pages, resize our page or select something
|
|
24889
24904
|
useEffect(() => {
|
|
24890
24905
|
if (paginationMode == 'server') {
|
|
24891
|
-
onServerSideSelectionStatusChange(Array.isArray(
|
|
24906
|
+
onServerSideSelectionStatusChange(Array.isArray(selectionModel) ? selectionModel : [selectionModel], apiRef, selectionStatus, isRowSelectable, page, pageSize);
|
|
24892
24907
|
}
|
|
24893
|
-
}, [
|
|
24908
|
+
}, [selectionModel, page, pageSize]);
|
|
24894
24909
|
if (!Array.isArray(rows)) {
|
|
24895
24910
|
return null;
|
|
24896
24911
|
}
|
|
@@ -24920,54 +24935,56 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24920
24935
|
apiRef: apiRef,
|
|
24921
24936
|
autoHeight: autoHeight,
|
|
24922
24937
|
checkboxSelectionVisibleOnly: Boolean(pagination),
|
|
24923
|
-
|
|
24924
|
-
|
|
24925
|
-
|
|
24926
|
-
//
|
|
24927
|
-
|
|
24928
|
-
|
|
24938
|
+
components: _objectSpread2(_objectSpread2({
|
|
24939
|
+
BaseButton,
|
|
24940
|
+
BaseCheckbox,
|
|
24941
|
+
// BaseTextField,
|
|
24942
|
+
BasePopper,
|
|
24943
|
+
ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24929
24944
|
displayName: "ColumnFilteredIcon"
|
|
24930
24945
|
})),
|
|
24931
|
-
|
|
24946
|
+
ColumnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24932
24947
|
displayName: "ColumnSelectorIcon"
|
|
24933
24948
|
})),
|
|
24934
|
-
|
|
24949
|
+
ColumnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24935
24950
|
displayName: "ColumnSortedAscendingIcon"
|
|
24936
24951
|
})),
|
|
24937
|
-
|
|
24952
|
+
ColumnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24938
24953
|
displayName: "ColumnSortedDescendingIcon"
|
|
24939
24954
|
})),
|
|
24940
|
-
|
|
24955
|
+
DensityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24941
24956
|
displayName: "DensityCompactIcon"
|
|
24942
24957
|
})),
|
|
24943
|
-
|
|
24958
|
+
DensityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24944
24959
|
displayName: "DensityStandardIcon"
|
|
24945
24960
|
})),
|
|
24946
|
-
|
|
24961
|
+
DensityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24947
24962
|
displayName: "DensityComfortableIcon"
|
|
24948
24963
|
})),
|
|
24949
|
-
|
|
24964
|
+
DetailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24950
24965
|
displayName: "DetailPanelCollapseIcon"
|
|
24951
24966
|
})),
|
|
24952
|
-
|
|
24967
|
+
DetailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24953
24968
|
displayName: "DetailPanelExpandIcon"
|
|
24954
24969
|
})),
|
|
24955
|
-
|
|
24970
|
+
ExportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24956
24971
|
displayName: "ExportIcon"
|
|
24957
24972
|
})),
|
|
24958
|
-
|
|
24973
|
+
OpenFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({
|
|
24959
24974
|
displayName: "OpenFilterButtonIcon"
|
|
24960
24975
|
}, props))
|
|
24961
|
-
},
|
|
24962
|
-
|
|
24963
|
-
|
|
24976
|
+
}, components), {}, {
|
|
24977
|
+
Toolbar: Toolbar,
|
|
24978
|
+
Pagination: props => pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$2({}, props, {
|
|
24964
24979
|
displaySelection: false,
|
|
24965
24980
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
24966
24981
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
24967
24982
|
selectionStatus: selectionStatus.current,
|
|
24968
|
-
|
|
24969
|
-
|
|
24970
|
-
|
|
24983
|
+
page: page,
|
|
24984
|
+
onPageChange: onPageChange,
|
|
24985
|
+
pageSize: pageSize,
|
|
24986
|
+
onPageSizeChange: onPageSizeChange,
|
|
24987
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
24971
24988
|
paginationProps: paginationProps,
|
|
24972
24989
|
paginationMode: paginationMode,
|
|
24973
24990
|
rowCount: rowCount
|
|
@@ -24978,15 +24995,17 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24978
24995
|
selectionStatus: selectionStatus.current,
|
|
24979
24996
|
apiRef: apiRef,
|
|
24980
24997
|
isRowSelectable: isRowSelectable,
|
|
24981
|
-
|
|
24982
|
-
|
|
24983
|
-
|
|
24998
|
+
page: page,
|
|
24999
|
+
onPageChange: onPageChange,
|
|
25000
|
+
pageSize: pageSize,
|
|
25001
|
+
onPageSizeChange: onPageSizeChange,
|
|
25002
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
24984
25003
|
paginationProps: paginationProps,
|
|
24985
25004
|
paginationMode: paginationMode,
|
|
24986
25005
|
rowCount: rowCount
|
|
24987
25006
|
})) : null
|
|
24988
25007
|
}),
|
|
24989
|
-
|
|
25008
|
+
componentsProps: _objectSpread2(_objectSpread2({}, componentsProps), {}, {
|
|
24990
25009
|
toolbar: _objectSpread2({
|
|
24991
25010
|
hideToolbar,
|
|
24992
25011
|
RenderedToolbar,
|
|
@@ -24998,13 +25017,15 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24998
25017
|
selectionStatus,
|
|
24999
25018
|
apiRef,
|
|
25000
25019
|
isRowSelectable,
|
|
25001
|
-
|
|
25002
|
-
|
|
25003
|
-
|
|
25020
|
+
page,
|
|
25021
|
+
onPageChange,
|
|
25022
|
+
pageSize,
|
|
25023
|
+
onPageSizeChange,
|
|
25024
|
+
rowsPerPageOptions,
|
|
25004
25025
|
paginationProps,
|
|
25005
25026
|
paginationMode,
|
|
25006
25027
|
rowCount
|
|
25007
|
-
},
|
|
25028
|
+
}, componentsProps === null || componentsProps === void 0 ? void 0 : componentsProps.toolbar)
|
|
25008
25029
|
}),
|
|
25009
25030
|
filterModel: filterModel,
|
|
25010
25031
|
initialState: initialState,
|
|
@@ -25014,37 +25035,39 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
25014
25035
|
paginationMode: paginationMode,
|
|
25015
25036
|
keepNonExistentRowsSelected: paginationMode == 'server',
|
|
25016
25037
|
rows: rows,
|
|
25017
|
-
|
|
25018
|
-
|
|
25019
|
-
|
|
25020
|
-
|
|
25021
|
-
|
|
25038
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
25039
|
+
page: page,
|
|
25040
|
+
onPageChange: onPageChange,
|
|
25041
|
+
pageSize: pageSize,
|
|
25042
|
+
onPageSizeChange: onPageSizeChange,
|
|
25043
|
+
selectionModel: selectionModel,
|
|
25044
|
+
onSelectionModelChange: (newSelectionModel, details) => {
|
|
25022
25045
|
if (pagination && paginationMode != 'server') {
|
|
25023
|
-
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(
|
|
25046
|
+
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref8 => {
|
|
25024
25047
|
let {
|
|
25025
25048
|
model
|
|
25026
|
-
} =
|
|
25049
|
+
} = _ref8;
|
|
25027
25050
|
return isRowSelectable({
|
|
25028
25051
|
row: model
|
|
25029
25052
|
});
|
|
25030
|
-
}).map(
|
|
25053
|
+
}).map(_ref9 => {
|
|
25031
25054
|
let {
|
|
25032
25055
|
id
|
|
25033
|
-
} =
|
|
25056
|
+
} = _ref9;
|
|
25034
25057
|
return id;
|
|
25035
25058
|
}) : gridPaginatedVisibleSortedGridRowIdsSelector(apiRef);
|
|
25036
25059
|
const numberOfSelectableRowsInPage = selectableRowsInPage.length;
|
|
25037
|
-
const selectableRowsInTable = isRowSelectable ? gridFilteredSortedRowEntriesSelector(apiRef).filter(
|
|
25060
|
+
const selectableRowsInTable = isRowSelectable ? gridFilteredSortedRowEntriesSelector(apiRef).filter(_ref10 => {
|
|
25038
25061
|
let {
|
|
25039
25062
|
model
|
|
25040
|
-
} =
|
|
25063
|
+
} = _ref10;
|
|
25041
25064
|
return isRowSelectable({
|
|
25042
25065
|
row: model
|
|
25043
25066
|
});
|
|
25044
|
-
}).map(
|
|
25067
|
+
}).map(_ref11 => {
|
|
25045
25068
|
let {
|
|
25046
25069
|
id
|
|
25047
|
-
} =
|
|
25070
|
+
} = _ref11;
|
|
25048
25071
|
return id;
|
|
25049
25072
|
}) : gridFilteredSortedRowIdsSelector(apiRef);
|
|
25050
25073
|
const numberOfSelectableRowsInTable = selectableRowsInTable.length;
|
|
@@ -25076,7 +25099,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
25076
25099
|
};
|
|
25077
25100
|
}
|
|
25078
25101
|
}
|
|
25079
|
-
|
|
25102
|
+
onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(newSelectionModel, details);
|
|
25080
25103
|
},
|
|
25081
25104
|
sx: _objectSpread2(_objectSpread2({}, sx), {}, {
|
|
25082
25105
|
'.MuiDataGrid-columnHeaders': {
|