@redsift/table 9.6.2 → 9.6.3-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 +158 -136
- 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 { 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
|
|
|
@@ -93,12 +92,12 @@ type StyledDataGridProps = {
|
|
|
93
92
|
declare const DataGrid: Comp<DataGridProps, HTMLDivElement>;
|
|
94
93
|
|
|
95
94
|
interface CompletionResponseItem {
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
columnField: string;
|
|
96
|
+
operatorValue: string;
|
|
98
97
|
value?: string;
|
|
99
98
|
}
|
|
100
99
|
type CompletionResponse = {
|
|
101
|
-
|
|
100
|
+
linkOperator: 'and' | 'or';
|
|
102
101
|
items: CompletionResponseItem[];
|
|
103
102
|
};
|
|
104
103
|
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, useState, useCallback, createElement } from 'react';
|
|
@@ -17467,7 +17466,7 @@ const isBetweenOperator = {
|
|
|
17467
17466
|
label: 'is between',
|
|
17468
17467
|
value: 'isBetween',
|
|
17469
17468
|
getApplyFilterFn: filterItem => {
|
|
17470
|
-
if (!filterItem.
|
|
17469
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17471
17470
|
return null;
|
|
17472
17471
|
}
|
|
17473
17472
|
if (!Array.isArray(filterItem.value) || filterItem.value.length !== 2) {
|
|
@@ -17480,7 +17479,7 @@ const isBetweenOperator = {
|
|
|
17480
17479
|
return null;
|
|
17481
17480
|
}
|
|
17482
17481
|
return params => {
|
|
17483
|
-
return params.value !== null &&
|
|
17482
|
+
return params.value !== null && filterItem.value[0] <= params.value && params.value <= filterItem.value[1];
|
|
17484
17483
|
};
|
|
17485
17484
|
},
|
|
17486
17485
|
InputComponent: InputNumberInterval
|
|
@@ -17493,7 +17492,7 @@ const containsAnyOfOperator = {
|
|
|
17493
17492
|
label: 'contains any of',
|
|
17494
17493
|
value: 'containsAnyOf',
|
|
17495
17494
|
getApplyFilterFn: filterItem => {
|
|
17496
|
-
if (!filterItem.
|
|
17495
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17497
17496
|
return null;
|
|
17498
17497
|
}
|
|
17499
17498
|
return params => {
|
|
@@ -17516,7 +17515,7 @@ const containsAnyOfCIOperator = {
|
|
|
17516
17515
|
label: 'contains any of (case insensitive)',
|
|
17517
17516
|
value: 'containsAnyOf',
|
|
17518
17517
|
getApplyFilterFn: filterItem => {
|
|
17519
|
-
if (!filterItem.
|
|
17518
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17520
17519
|
return null;
|
|
17521
17520
|
}
|
|
17522
17521
|
return params => {
|
|
@@ -17543,7 +17542,7 @@ const endsWithAnyOfOperator = {
|
|
|
17543
17542
|
label: 'ends with any of',
|
|
17544
17543
|
value: 'endsWithAnyOf',
|
|
17545
17544
|
getApplyFilterFn: filterItem => {
|
|
17546
|
-
if (!filterItem.
|
|
17545
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17547
17546
|
return null;
|
|
17548
17547
|
}
|
|
17549
17548
|
return params => {
|
|
@@ -17570,7 +17569,7 @@ const isAnyOfOperator = {
|
|
|
17570
17569
|
label: 'is any of',
|
|
17571
17570
|
value: 'isAnyOf',
|
|
17572
17571
|
getApplyFilterFn: filterItem => {
|
|
17573
|
-
if (!filterItem.
|
|
17572
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17574
17573
|
return null;
|
|
17575
17574
|
}
|
|
17576
17575
|
return params => {
|
|
@@ -17594,7 +17593,7 @@ const isNotAnyOfOperator = {
|
|
|
17594
17593
|
label: 'is not any of',
|
|
17595
17594
|
value: 'isNotAnyOf',
|
|
17596
17595
|
getApplyFilterFn: filterItem => {
|
|
17597
|
-
if (!filterItem.
|
|
17596
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17598
17597
|
return null;
|
|
17599
17598
|
}
|
|
17600
17599
|
return params => {
|
|
@@ -17618,7 +17617,7 @@ const startsWithAnyOfOperator = {
|
|
|
17618
17617
|
label: 'starts with any of',
|
|
17619
17618
|
value: 'startsWithAnyOf',
|
|
17620
17619
|
getApplyFilterFn: filterItem => {
|
|
17621
|
-
if (!filterItem.
|
|
17620
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17622
17621
|
return null;
|
|
17623
17622
|
}
|
|
17624
17623
|
return params => {
|
|
@@ -17647,7 +17646,7 @@ const getGridStringOperators = () => [...getGridStringOperators$1(), ...getGridS
|
|
|
17647
17646
|
|
|
17648
17647
|
const API_URL = 'https://api.openai.com/v1/chat/completions';
|
|
17649
17648
|
async function getCompletion(text, role, openai_api_key) {
|
|
17650
|
-
let model = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'gpt-3.5-turbo-
|
|
17649
|
+
let model = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'gpt-3.5-turbo-0613';
|
|
17651
17650
|
try {
|
|
17652
17651
|
const messages = [{
|
|
17653
17652
|
role: 'system',
|
|
@@ -21694,10 +21693,10 @@ const COMPONENT_NAME$2 = 'GridToolbarFilterSemanticField';
|
|
|
21694
21693
|
const CLASSNAME$2 = 'redsift-datagrid-toolbar-nlp-filter-field';
|
|
21695
21694
|
const DEFAULT_PROPS$1 = {
|
|
21696
21695
|
dateFormat: 'yyyy-mm-dd',
|
|
21697
|
-
defaultModel: 'gpt-4-
|
|
21696
|
+
defaultModel: 'gpt-4-0613',
|
|
21698
21697
|
defaultFilter: {
|
|
21699
21698
|
items: [],
|
|
21700
|
-
|
|
21699
|
+
linkOperator: 'and'
|
|
21701
21700
|
},
|
|
21702
21701
|
disablePower: false,
|
|
21703
21702
|
localeText: {
|
|
@@ -21738,16 +21737,16 @@ const getRole = (config, dateFormat) => {
|
|
|
21738
21737
|
}).join('\n');
|
|
21739
21738
|
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.
|
|
21740
21739
|
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.
|
|
21741
|
-
The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "
|
|
21742
|
-
- "
|
|
21743
|
-
- "items": a list of conditions, each is an object with exactly the three keys "
|
|
21744
|
-
- "
|
|
21740
|
+
The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "linkOperator" and "items":
|
|
21741
|
+
- "linkOperator": the logical operator, only "and" or "or" are allowed. If there is only one condition in the "items", use "and".
|
|
21742
|
+
- "items": a list of conditions, each is an object with exactly the three keys "columnField", "operatorValue" and "value":
|
|
21743
|
+
- "columnField": the column name, must be one of ${columns}
|
|
21745
21744
|
- "value":
|
|
21746
|
-
- this can be skipped if the "
|
|
21747
|
-
- a list of multiple values if the "
|
|
21745
|
+
- this can be skipped if the "operatorValue" is either "isEmpty" or "isNotEmpty"
|
|
21746
|
+
- a list of multiple values if the "operatorValue" ends with "AnyOf"
|
|
21748
21747
|
- otherwise, it's a single value represented as a string: "true" instead of true, "false" instead of false, "0.6" instead of 0.6.
|
|
21749
21748
|
For "date" data type, use ${dateFormat}. If relative date is input, convert to the actual date given today is ${today}.
|
|
21750
|
-
- "
|
|
21749
|
+
- "operatorValue": the comparison operator, accepted values depend on the data type of the column
|
|
21751
21750
|
${operators}
|
|
21752
21751
|
|
|
21753
21752
|
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:
|
|
@@ -21859,8 +21858,8 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
21859
21858
|
isLoading: isLoading
|
|
21860
21859
|
}, buttonText)), !disablePower && /*#__PURE__*/React__default.createElement(Tooltip, null, /*#__PURE__*/React__default.createElement(Tooltip.Trigger, null, /*#__PURE__*/React__default.createElement(Switch, {
|
|
21861
21860
|
width: "175px",
|
|
21862
|
-
isSelected: modelRef.current === 'gpt-4-
|
|
21863
|
-
onChange: value => modelRef.current = value ? 'gpt-4-
|
|
21861
|
+
isSelected: modelRef.current === 'gpt-4-0613',
|
|
21862
|
+
onChange: value => modelRef.current = value ? 'gpt-4-0613' : 'gpt-3.5-turbo-0613'
|
|
21864
21863
|
}, powerText)), /*#__PURE__*/React__default.createElement(Tooltip.Content, null, powerTooltipContent))), showErrorRef.current && /*#__PURE__*/React__default.createElement(Text, {
|
|
21865
21864
|
color: "error",
|
|
21866
21865
|
marginLeft: "8px"
|
|
@@ -21916,7 +21915,7 @@ const Toolbar$3 = props => {
|
|
|
21916
21915
|
let {
|
|
21917
21916
|
apiRef
|
|
21918
21917
|
} = _ref;
|
|
21919
|
-
return
|
|
21918
|
+
return gridVisibleSortedRowIdsSelector(apiRef);
|
|
21920
21919
|
}
|
|
21921
21920
|
},
|
|
21922
21921
|
printOptions: {
|
|
@@ -24368,8 +24367,8 @@ process.env.NODE_ENV !== "production" ? TablePagination.propTypes /* remove-prop
|
|
|
24368
24367
|
} : void 0;
|
|
24369
24368
|
var TablePagination$1 = TablePagination;
|
|
24370
24369
|
|
|
24371
|
-
const _excluded$1 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "ControlledPagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "
|
|
24372
|
-
_excluded2 = ["apiRef", "autoHeight", "className", "
|
|
24370
|
+
const _excluded$1 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "ControlledPagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "page", "onPageChange", "pageSize", "onPageSizeChange", "rowsPerPageOptions", "paginationProps", "paginationMode", "rowCount"],
|
|
24371
|
+
_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", "paginationMode", "rowCount"];
|
|
24373
24372
|
const COMPONENT_NAME$1 = 'DataGrid';
|
|
24374
24373
|
const CLASSNAME$1 = 'redsift-datagrid';
|
|
24375
24374
|
const DEFAULT_PROPS = {
|
|
@@ -24398,9 +24397,11 @@ const ControlledPagination = _ref3 => {
|
|
|
24398
24397
|
displayPagination = false,
|
|
24399
24398
|
selectionStatus,
|
|
24400
24399
|
apiRef,
|
|
24401
|
-
|
|
24402
|
-
|
|
24403
|
-
|
|
24400
|
+
page,
|
|
24401
|
+
onPageChange,
|
|
24402
|
+
pageSize,
|
|
24403
|
+
onPageSizeChange,
|
|
24404
|
+
rowsPerPageOptions,
|
|
24404
24405
|
isRowSelectable,
|
|
24405
24406
|
paginationProps
|
|
24406
24407
|
} = _ref3;
|
|
@@ -24430,17 +24431,13 @@ const ControlledPagination = _ref3 => {
|
|
|
24430
24431
|
}, `${selectionStatus.numberOfSelectedRows} row${selectionStatus.numberOfSelectedRows > 1 ? 's' : ''} selected`) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$2({
|
|
24431
24432
|
component: "div",
|
|
24432
24433
|
count: numberOfFilteredRowsInTable,
|
|
24433
|
-
page:
|
|
24434
|
-
onPageChange: (event,
|
|
24435
|
-
|
|
24436
|
-
|
|
24437
|
-
|
|
24438
|
-
|
|
24439
|
-
|
|
24440
|
-
page: paginationModel.page,
|
|
24441
|
-
pageSize: parseInt(event.target.value, 10)
|
|
24442
|
-
}),
|
|
24443
|
-
rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
|
|
24434
|
+
page: page,
|
|
24435
|
+
onPageChange: (event, newPage) => onPageChange(newPage),
|
|
24436
|
+
rowsPerPage: pageSize,
|
|
24437
|
+
onRowsPerPageChange: event => {
|
|
24438
|
+
onPageSizeChange(parseInt(event.target.value, 10));
|
|
24439
|
+
},
|
|
24440
|
+
rowsPerPageOptions: displayRowsPerPage ? rowsPerPageOptions : []
|
|
24444
24441
|
}, paginationProps)) : null);
|
|
24445
24442
|
};
|
|
24446
24443
|
const ServerSideControlledPagination = _ref4 => {
|
|
@@ -24448,10 +24445,12 @@ const ServerSideControlledPagination = _ref4 => {
|
|
|
24448
24445
|
selectionStatus,
|
|
24449
24446
|
displaySelection,
|
|
24450
24447
|
displayPagination,
|
|
24451
|
-
|
|
24452
|
-
|
|
24453
|
-
|
|
24448
|
+
page,
|
|
24449
|
+
onPageChange,
|
|
24450
|
+
pageSize,
|
|
24451
|
+
onPageSizeChange,
|
|
24454
24452
|
displayRowsPerPage,
|
|
24453
|
+
rowsPerPageOptions,
|
|
24455
24454
|
paginationProps,
|
|
24456
24455
|
rowCount
|
|
24457
24456
|
} = _ref4;
|
|
@@ -24470,17 +24469,13 @@ const ServerSideControlledPagination = _ref4 => {
|
|
|
24470
24469
|
}, totalRowsLabel) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$2({
|
|
24471
24470
|
component: "div",
|
|
24472
24471
|
count: totalNumberOfRowsInTable,
|
|
24473
|
-
page:
|
|
24474
|
-
onPageChange: (event,
|
|
24475
|
-
|
|
24476
|
-
|
|
24477
|
-
|
|
24478
|
-
|
|
24479
|
-
|
|
24480
|
-
page: paginationModel.page,
|
|
24481
|
-
pageSize: parseInt(event.target.value, 10)
|
|
24482
|
-
}),
|
|
24483
|
-
rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
|
|
24472
|
+
page: page,
|
|
24473
|
+
onPageChange: (event, newPage) => onPageChange(newPage),
|
|
24474
|
+
rowsPerPage: pageSize,
|
|
24475
|
+
onRowsPerPageChange: event => {
|
|
24476
|
+
onPageSizeChange(parseInt(event.target.value, 10));
|
|
24477
|
+
},
|
|
24478
|
+
rowsPerPageOptions: displayRowsPerPage ? rowsPerPageOptions : []
|
|
24484
24479
|
}, paginationProps)) : null);
|
|
24485
24480
|
};
|
|
24486
24481
|
const Toolbar = _ref5 => {
|
|
@@ -24495,9 +24490,11 @@ const Toolbar = _ref5 => {
|
|
|
24495
24490
|
selectionStatus,
|
|
24496
24491
|
apiRef,
|
|
24497
24492
|
isRowSelectable,
|
|
24498
|
-
|
|
24499
|
-
|
|
24500
|
-
|
|
24493
|
+
page,
|
|
24494
|
+
onPageChange,
|
|
24495
|
+
pageSize,
|
|
24496
|
+
onPageSizeChange,
|
|
24497
|
+
rowsPerPageOptions,
|
|
24501
24498
|
paginationProps,
|
|
24502
24499
|
paginationMode = 'client',
|
|
24503
24500
|
rowCount
|
|
@@ -24511,9 +24508,11 @@ const Toolbar = _ref5 => {
|
|
|
24511
24508
|
displayRowsPerPage: false,
|
|
24512
24509
|
displayPagination: ['top', 'both'].includes(paginationPlacement),
|
|
24513
24510
|
selectionStatus: selectionStatus.current,
|
|
24514
|
-
|
|
24515
|
-
|
|
24516
|
-
|
|
24511
|
+
page: page,
|
|
24512
|
+
onPageChange: onPageChange,
|
|
24513
|
+
pageSize: pageSize,
|
|
24514
|
+
onPageSizeChange: onPageSizeChange,
|
|
24515
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
24517
24516
|
paginationProps: paginationProps,
|
|
24518
24517
|
rowCount: rowCount
|
|
24519
24518
|
}) : /*#__PURE__*/React__default.createElement(ControlledPagination, {
|
|
@@ -24523,9 +24522,11 @@ const Toolbar = _ref5 => {
|
|
|
24523
24522
|
selectionStatus: selectionStatus.current,
|
|
24524
24523
|
apiRef: apiRef,
|
|
24525
24524
|
isRowSelectable: isRowSelectable,
|
|
24526
|
-
|
|
24527
|
-
|
|
24528
|
-
|
|
24525
|
+
page: page,
|
|
24526
|
+
onPageChange: onPageChange,
|
|
24527
|
+
pageSize: pageSize,
|
|
24528
|
+
onPageSizeChange: onPageSizeChange,
|
|
24529
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
24529
24530
|
paginationProps: paginationProps
|
|
24530
24531
|
}) : null);
|
|
24531
24532
|
};
|
|
@@ -24585,14 +24586,14 @@ const onServerSideSelectionStatusChange = (newSelectionModel, apiRef, selectionS
|
|
|
24585
24586
|
}
|
|
24586
24587
|
};
|
|
24587
24588
|
const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
24588
|
-
var
|
|
24589
|
+
var _initialState$paginat, _initialState$paginat2;
|
|
24589
24590
|
const datagridRef = ref || useRef();
|
|
24590
24591
|
const {
|
|
24591
24592
|
apiRef: propsApiRef,
|
|
24592
24593
|
autoHeight,
|
|
24593
24594
|
className,
|
|
24594
|
-
|
|
24595
|
-
|
|
24595
|
+
components,
|
|
24596
|
+
componentsProps,
|
|
24596
24597
|
filterModel: propsFilterModel,
|
|
24597
24598
|
height: propsHeight,
|
|
24598
24599
|
hideToolbar,
|
|
@@ -24600,15 +24601,17 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24600
24601
|
isRowSelectable,
|
|
24601
24602
|
license,
|
|
24602
24603
|
onFilterModelChange: propsOnFilterModelChange,
|
|
24603
|
-
|
|
24604
|
-
|
|
24605
|
-
|
|
24606
|
-
|
|
24604
|
+
onPageChange: propsOnPageChange,
|
|
24605
|
+
onPageSizeChange: propsOnPageSizeChange,
|
|
24606
|
+
selectionModel: propsSelectionModel,
|
|
24607
|
+
onSelectionModelChange,
|
|
24608
|
+
page: propsPage,
|
|
24609
|
+
pageSize: propsPageSize,
|
|
24607
24610
|
pagination,
|
|
24608
24611
|
paginationPlacement,
|
|
24609
24612
|
paginationProps,
|
|
24610
24613
|
rows,
|
|
24611
|
-
|
|
24614
|
+
rowsPerPageOptions,
|
|
24612
24615
|
sx,
|
|
24613
24616
|
paginationMode = 'client',
|
|
24614
24617
|
rowCount
|
|
@@ -24616,7 +24619,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24616
24619
|
forwardedProps = _objectWithoutProperties(props, _excluded2);
|
|
24617
24620
|
const _apiRef = useGridApiRef();
|
|
24618
24621
|
const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
|
|
24619
|
-
const RenderedToolbar =
|
|
24622
|
+
const RenderedToolbar = components !== null && components !== void 0 && components.Toolbar ? components.Toolbar : Toolbar$3;
|
|
24620
24623
|
LicenseInfo.setLicenseKey(license);
|
|
24621
24624
|
const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
|
|
24622
24625
|
const [filterModel, setFilterModel] = useState(propsFilterModel);
|
|
@@ -24630,41 +24633,52 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24630
24633
|
setFilterModel(model);
|
|
24631
24634
|
}
|
|
24632
24635
|
};
|
|
24633
|
-
const [
|
|
24636
|
+
const [selectionModel, setSelectionModel] = useState(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
|
|
24634
24637
|
useEffect(() => {
|
|
24635
|
-
|
|
24638
|
+
setSelectionModel(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
|
|
24636
24639
|
}, [propsSelectionModel]);
|
|
24637
|
-
const [
|
|
24638
|
-
|
|
24639
|
-
|
|
24640
|
+
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);
|
|
24641
|
+
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);
|
|
24642
|
+
const selectionStatus = useRef({
|
|
24643
|
+
type: 'none',
|
|
24644
|
+
numberOfSelectedRows: 0,
|
|
24645
|
+
numberOfSelectedRowsInPage: 0,
|
|
24646
|
+
page,
|
|
24647
|
+
pageSize
|
|
24640
24648
|
});
|
|
24641
|
-
const
|
|
24642
|
-
if (
|
|
24643
|
-
|
|
24649
|
+
const onPageChange = page => {
|
|
24650
|
+
if (propsOnPageChange) {
|
|
24651
|
+
propsOnPageChange(page, undefined);
|
|
24644
24652
|
} else {
|
|
24645
|
-
|
|
24653
|
+
setPage(page);
|
|
24646
24654
|
}
|
|
24647
24655
|
};
|
|
24648
24656
|
useEffect(() => {
|
|
24649
|
-
if (
|
|
24650
|
-
|
|
24657
|
+
if (propsPage || propsPage === 0) {
|
|
24658
|
+
setPage(propsPage);
|
|
24659
|
+
}
|
|
24660
|
+
}, [propsPage]);
|
|
24661
|
+
const onPageSizeChange = pageSize => {
|
|
24662
|
+
onPageChange(0);
|
|
24663
|
+
if (propsOnPageSizeChange) {
|
|
24664
|
+
propsOnPageSizeChange(pageSize, undefined);
|
|
24665
|
+
} else {
|
|
24666
|
+
setPageSize(pageSize);
|
|
24651
24667
|
}
|
|
24652
|
-
}
|
|
24653
|
-
|
|
24654
|
-
|
|
24655
|
-
|
|
24656
|
-
|
|
24657
|
-
|
|
24658
|
-
pageSize: paginationModel.pageSize
|
|
24659
|
-
});
|
|
24668
|
+
};
|
|
24669
|
+
useEffect(() => {
|
|
24670
|
+
if (propsPageSize) {
|
|
24671
|
+
setPageSize(propsPageSize);
|
|
24672
|
+
}
|
|
24673
|
+
}, [propsPageSize]);
|
|
24660
24674
|
|
|
24661
24675
|
// in server-side pagination we want to update the selection status
|
|
24662
24676
|
// every time we navigate between pages, resize our page or select something
|
|
24663
24677
|
useEffect(() => {
|
|
24664
24678
|
if (paginationMode == 'server') {
|
|
24665
|
-
onServerSideSelectionStatusChange(Array.isArray(
|
|
24679
|
+
onServerSideSelectionStatusChange(Array.isArray(selectionModel) ? selectionModel : [selectionModel], apiRef, selectionStatus, isRowSelectable, page, pageSize);
|
|
24666
24680
|
}
|
|
24667
|
-
}, [
|
|
24681
|
+
}, [selectionModel, page, pageSize]);
|
|
24668
24682
|
if (!Array.isArray(rows)) {
|
|
24669
24683
|
return null;
|
|
24670
24684
|
}
|
|
@@ -24676,54 +24690,56 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24676
24690
|
apiRef: apiRef,
|
|
24677
24691
|
autoHeight: autoHeight,
|
|
24678
24692
|
checkboxSelectionVisibleOnly: Boolean(pagination),
|
|
24679
|
-
|
|
24680
|
-
|
|
24681
|
-
|
|
24682
|
-
//
|
|
24683
|
-
|
|
24684
|
-
|
|
24693
|
+
components: _objectSpread2(_objectSpread2({
|
|
24694
|
+
BaseButton,
|
|
24695
|
+
BaseCheckbox,
|
|
24696
|
+
// BaseTextField,
|
|
24697
|
+
BasePopper,
|
|
24698
|
+
ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24685
24699
|
displayName: "ColumnFilteredIcon"
|
|
24686
24700
|
})),
|
|
24687
|
-
|
|
24701
|
+
ColumnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24688
24702
|
displayName: "ColumnSelectorIcon"
|
|
24689
24703
|
})),
|
|
24690
|
-
|
|
24704
|
+
ColumnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24691
24705
|
displayName: "ColumnSortedAscendingIcon"
|
|
24692
24706
|
})),
|
|
24693
|
-
|
|
24707
|
+
ColumnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24694
24708
|
displayName: "ColumnSortedDescendingIcon"
|
|
24695
24709
|
})),
|
|
24696
|
-
|
|
24710
|
+
DensityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24697
24711
|
displayName: "DensityCompactIcon"
|
|
24698
24712
|
})),
|
|
24699
|
-
|
|
24713
|
+
DensityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24700
24714
|
displayName: "DensityStandardIcon"
|
|
24701
24715
|
})),
|
|
24702
|
-
|
|
24716
|
+
DensityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24703
24717
|
displayName: "DensityComfortableIcon"
|
|
24704
24718
|
})),
|
|
24705
|
-
|
|
24719
|
+
DetailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24706
24720
|
displayName: "DetailPanelCollapseIcon"
|
|
24707
24721
|
})),
|
|
24708
|
-
|
|
24722
|
+
DetailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24709
24723
|
displayName: "DetailPanelExpandIcon"
|
|
24710
24724
|
})),
|
|
24711
|
-
|
|
24725
|
+
ExportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24712
24726
|
displayName: "ExportIcon"
|
|
24713
24727
|
})),
|
|
24714
|
-
|
|
24728
|
+
OpenFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({
|
|
24715
24729
|
displayName: "OpenFilterButtonIcon"
|
|
24716
24730
|
}, props))
|
|
24717
|
-
},
|
|
24718
|
-
|
|
24719
|
-
|
|
24731
|
+
}, components), {}, {
|
|
24732
|
+
Toolbar: Toolbar,
|
|
24733
|
+
Pagination: props => pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$2({}, props, {
|
|
24720
24734
|
displaySelection: false,
|
|
24721
24735
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
24722
24736
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
24723
24737
|
selectionStatus: selectionStatus.current,
|
|
24724
|
-
|
|
24725
|
-
|
|
24726
|
-
|
|
24738
|
+
page: page,
|
|
24739
|
+
onPageChange: onPageChange,
|
|
24740
|
+
pageSize: pageSize,
|
|
24741
|
+
onPageSizeChange: onPageSizeChange,
|
|
24742
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
24727
24743
|
paginationProps: paginationProps,
|
|
24728
24744
|
paginationMode: paginationMode,
|
|
24729
24745
|
rowCount: rowCount
|
|
@@ -24734,15 +24750,17 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24734
24750
|
selectionStatus: selectionStatus.current,
|
|
24735
24751
|
apiRef: apiRef,
|
|
24736
24752
|
isRowSelectable: isRowSelectable,
|
|
24737
|
-
|
|
24738
|
-
|
|
24739
|
-
|
|
24753
|
+
page: page,
|
|
24754
|
+
onPageChange: onPageChange,
|
|
24755
|
+
pageSize: pageSize,
|
|
24756
|
+
onPageSizeChange: onPageSizeChange,
|
|
24757
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
24740
24758
|
paginationProps: paginationProps,
|
|
24741
24759
|
paginationMode: paginationMode,
|
|
24742
24760
|
rowCount: rowCount
|
|
24743
24761
|
})) : null
|
|
24744
24762
|
}),
|
|
24745
|
-
|
|
24763
|
+
componentsProps: _objectSpread2(_objectSpread2({}, componentsProps), {}, {
|
|
24746
24764
|
toolbar: _objectSpread2({
|
|
24747
24765
|
hideToolbar,
|
|
24748
24766
|
RenderedToolbar,
|
|
@@ -24754,13 +24772,15 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24754
24772
|
selectionStatus,
|
|
24755
24773
|
apiRef,
|
|
24756
24774
|
isRowSelectable,
|
|
24757
|
-
|
|
24758
|
-
|
|
24759
|
-
|
|
24775
|
+
page,
|
|
24776
|
+
onPageChange,
|
|
24777
|
+
pageSize,
|
|
24778
|
+
onPageSizeChange,
|
|
24779
|
+
rowsPerPageOptions,
|
|
24760
24780
|
paginationProps,
|
|
24761
24781
|
paginationMode,
|
|
24762
24782
|
rowCount
|
|
24763
|
-
},
|
|
24783
|
+
}, componentsProps === null || componentsProps === void 0 ? void 0 : componentsProps.toolbar)
|
|
24764
24784
|
}),
|
|
24765
24785
|
filterModel: filterModel,
|
|
24766
24786
|
initialState: initialState,
|
|
@@ -24770,37 +24790,39 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24770
24790
|
paginationMode: paginationMode,
|
|
24771
24791
|
keepNonExistentRowsSelected: paginationMode == 'server',
|
|
24772
24792
|
rows: rows,
|
|
24773
|
-
|
|
24774
|
-
|
|
24775
|
-
|
|
24776
|
-
|
|
24777
|
-
|
|
24793
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
24794
|
+
page: page,
|
|
24795
|
+
onPageChange: onPageChange,
|
|
24796
|
+
pageSize: pageSize,
|
|
24797
|
+
onPageSizeChange: onPageSizeChange,
|
|
24798
|
+
selectionModel: selectionModel,
|
|
24799
|
+
onSelectionModelChange: (newSelectionModel, details) => {
|
|
24778
24800
|
if (pagination && paginationMode != 'server') {
|
|
24779
|
-
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(
|
|
24801
|
+
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref8 => {
|
|
24780
24802
|
let {
|
|
24781
24803
|
model
|
|
24782
|
-
} =
|
|
24804
|
+
} = _ref8;
|
|
24783
24805
|
return isRowSelectable({
|
|
24784
24806
|
row: model
|
|
24785
24807
|
});
|
|
24786
|
-
}).map(
|
|
24808
|
+
}).map(_ref9 => {
|
|
24787
24809
|
let {
|
|
24788
24810
|
id
|
|
24789
|
-
} =
|
|
24811
|
+
} = _ref9;
|
|
24790
24812
|
return id;
|
|
24791
24813
|
}) : gridPaginatedVisibleSortedGridRowIdsSelector(apiRef);
|
|
24792
24814
|
const numberOfSelectableRowsInPage = selectableRowsInPage.length;
|
|
24793
|
-
const selectableRowsInTable = isRowSelectable ? gridFilteredSortedRowEntriesSelector(apiRef).filter(
|
|
24815
|
+
const selectableRowsInTable = isRowSelectable ? gridFilteredSortedRowEntriesSelector(apiRef).filter(_ref10 => {
|
|
24794
24816
|
let {
|
|
24795
24817
|
model
|
|
24796
|
-
} =
|
|
24818
|
+
} = _ref10;
|
|
24797
24819
|
return isRowSelectable({
|
|
24798
24820
|
row: model
|
|
24799
24821
|
});
|
|
24800
|
-
}).map(
|
|
24822
|
+
}).map(_ref11 => {
|
|
24801
24823
|
let {
|
|
24802
24824
|
id
|
|
24803
|
-
} =
|
|
24825
|
+
} = _ref11;
|
|
24804
24826
|
return id;
|
|
24805
24827
|
}) : gridFilteredSortedRowIdsSelector(apiRef);
|
|
24806
24828
|
const numberOfSelectableRowsInTable = selectableRowsInTable.length;
|
|
@@ -24832,7 +24854,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24832
24854
|
};
|
|
24833
24855
|
}
|
|
24834
24856
|
}
|
|
24835
|
-
|
|
24857
|
+
onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(newSelectionModel, details);
|
|
24836
24858
|
},
|
|
24837
24859
|
sx: _objectSpread2(_objectSpread2({}, sx), {}, {
|
|
24838
24860
|
'.MuiDataGrid-columnHeaders': {
|