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