@redsift/table 9.3.0 → 9.3.2-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 +22 -6
- package/index.js +139 -117
- package/index.js.map +1 -1
- package/package.json +5 -4
package/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as _mui_x_data_grid_pro from '@mui/x-data-grid-pro';
|
|
2
|
-
import { GridFilterItem, GridCellParams, GridFilterOperator, GridFilterInputMultipleValue, DataGridProProps, GridToolbarExportProps, GridToolbarFilterButtonProps,
|
|
3
|
-
export
|
|
4
|
-
export { GridAlignment, GridColDef, GridFilterItem, GridFilterModel, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators } from '@mui/x-data-grid-pro';
|
|
2
|
+
import { GridFilterItem, GridCellParams, GridFilterOperator, GridFilterInputMultipleValue, DataGridProProps, GridFilterModel, GridToolbarExportProps, GridToolbarFilterButtonProps, GridToolbarColumnsButton, GridToolbarDensitySelector } 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
|
-
import React, { ReactNode,
|
|
5
|
+
import React, { ReactNode, ComponentProps, RefObject } from 'react';
|
|
7
6
|
import { TablePaginationProps } from '@mui/material';
|
|
8
7
|
|
|
9
8
|
declare const DETAIL_PANEL_TOGGLE_COL_DEF: _mui_x_data_grid_pro.GridColDef<any, any, any>;
|
|
@@ -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
|
|
|
@@ -62,6 +61,8 @@ declare const STARTS_WITH_ANY_OF: {
|
|
|
62
61
|
|
|
63
62
|
declare const getGridStringArrayOperators: () => GridFilterOperator<any, number | string | null, any>[];
|
|
64
63
|
|
|
64
|
+
declare function getCompletion(text: string, role: string, openai_api_key: string | undefined, model?: string): Promise<string>;
|
|
65
|
+
|
|
65
66
|
interface DataGridProps extends Partial<Pick<DataGridProProps, 'rows'>>, Omit<DataGridProProps, 'rows'> {
|
|
66
67
|
/** License key for MUI Datagrid Pro. */
|
|
67
68
|
license?: string;
|
|
@@ -100,6 +101,21 @@ interface FilterConfig {
|
|
|
100
101
|
openaiApiKey?: string;
|
|
101
102
|
completionFunc?: (nlpFilterConfig: FilterConfig, prompt: string, model: string) => Promise<CompletionResponse>;
|
|
102
103
|
}
|
|
104
|
+
interface GridToolbarFilterSemanticFieldProps extends ComponentProps<'form'> {
|
|
105
|
+
nlpFilterConfig: FilterConfig;
|
|
106
|
+
onFilterModelChange: (filterModel: GridFilterModel) => void;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
declare const DEFAULT_OPERATORS: {
|
|
110
|
+
string: string[];
|
|
111
|
+
number: string[];
|
|
112
|
+
boolean: string[];
|
|
113
|
+
date: string[];
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* The GridToolbarFilterSemanticField component.
|
|
117
|
+
*/
|
|
118
|
+
declare const GridToolbarFilterSemanticField: Comp<GridToolbarFilterSemanticFieldProps, HTMLFormElement>;
|
|
103
119
|
|
|
104
120
|
type GridToolbarColumnsProps = Omit<typeof GridToolbarColumnsButton, 'ref'>;
|
|
105
121
|
type GridToolbarDensityProps = Omit<typeof GridToolbarDensitySelector, 'ref'>;
|
|
@@ -175,4 +191,4 @@ interface TextCellProps extends ComponentProps<'div'> {
|
|
|
175
191
|
*/
|
|
176
192
|
declare const TextCell: Comp<TextCellProps, HTMLDivElement>;
|
|
177
193
|
|
|
178
|
-
export { CONTAINS_ANY_OF, CONTAINS_ANY_OF_I, DETAIL_PANEL_TOGGLE_COL_DEF, DataGrid, DataGridProps, ENDS_WITH_ANY_OF, IS_ANY_OF, IS_BETWEEN, IS_NOT_ANY_OF, STARTS_WITH_ANY_OF, StyledDataGridProps, TextCell, Toolbar, getGridNumericOperators, getGridStringArrayOperators, getGridStringOperators };
|
|
194
|
+
export { CONTAINS_ANY_OF, CONTAINS_ANY_OF_I, CompletionResponse, DEFAULT_OPERATORS, DETAIL_PANEL_TOGGLE_COL_DEF, DataGrid, DataGridProps, ENDS_WITH_ANY_OF, FilterConfig, GridToolbarFilterSemanticField, GridToolbarFilterSemanticFieldProps, IS_ANY_OF, IS_BETWEEN, IS_NOT_ANY_OF, STARTS_WITH_ANY_OF, StyledDataGridProps, TextCell, Toolbar, getCompletion, getGridNumericOperators, getGridStringArrayOperators, getGridStringOperators };
|
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 => {
|
|
@@ -17645,6 +17644,37 @@ const getGridStringArrayOperators = () => [CONTAINS_ANY_OF, ENDS_WITH_ANY_OF, IS
|
|
|
17645
17644
|
|
|
17646
17645
|
const getGridStringOperators = () => [...getGridStringOperators$1(), ...getGridStringArrayOperators()];
|
|
17647
17646
|
|
|
17647
|
+
const API_URL = 'https://api.openai.com/v1/chat/completions';
|
|
17648
|
+
async function getCompletion(text, role, openai_api_key) {
|
|
17649
|
+
let model = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'gpt-3.5-turbo-0613';
|
|
17650
|
+
try {
|
|
17651
|
+
const messages = [{
|
|
17652
|
+
role: 'system',
|
|
17653
|
+
content: role
|
|
17654
|
+
}, {
|
|
17655
|
+
role: 'user',
|
|
17656
|
+
content: text
|
|
17657
|
+
}];
|
|
17658
|
+
const url = API_URL;
|
|
17659
|
+
const response = await fetch(url, {
|
|
17660
|
+
method: 'POST',
|
|
17661
|
+
headers: {
|
|
17662
|
+
'Content-Type': 'application/json',
|
|
17663
|
+
Authorization: `Bearer ${openai_api_key}`
|
|
17664
|
+
},
|
|
17665
|
+
body: JSON.stringify({
|
|
17666
|
+
messages: messages,
|
|
17667
|
+
temperature: 0,
|
|
17668
|
+
model: model
|
|
17669
|
+
})
|
|
17670
|
+
});
|
|
17671
|
+
const data = await response.json();
|
|
17672
|
+
return data.choices[0].message.content;
|
|
17673
|
+
} catch (error) {
|
|
17674
|
+
return '';
|
|
17675
|
+
}
|
|
17676
|
+
}
|
|
17677
|
+
|
|
17648
17678
|
// Store the license information in a global, so it can be shared
|
|
17649
17679
|
// when module duplication occurs. The duplication of the modules can happen
|
|
17650
17680
|
// if using multiple version of MUI X at the same time of the bundler
|
|
@@ -21658,37 +21688,6 @@ const StyledGridToolbarFilterSemanticField = styled$3.form`
|
|
|
21658
21688
|
}
|
|
21659
21689
|
`;
|
|
21660
21690
|
|
|
21661
|
-
const API_URL = 'https://api.openai.com/v1/chat/completions';
|
|
21662
|
-
async function getCompletion(text, role, openai_api_key) {
|
|
21663
|
-
let model = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'gpt-3.5-turbo-0613';
|
|
21664
|
-
try {
|
|
21665
|
-
const messages = [{
|
|
21666
|
-
role: 'system',
|
|
21667
|
-
content: role
|
|
21668
|
-
}, {
|
|
21669
|
-
role: 'user',
|
|
21670
|
-
content: text
|
|
21671
|
-
}];
|
|
21672
|
-
const url = API_URL;
|
|
21673
|
-
const response = await fetch(url, {
|
|
21674
|
-
method: 'POST',
|
|
21675
|
-
headers: {
|
|
21676
|
-
'Content-Type': 'application/json',
|
|
21677
|
-
Authorization: `Bearer ${openai_api_key}`
|
|
21678
|
-
},
|
|
21679
|
-
body: JSON.stringify({
|
|
21680
|
-
messages: messages,
|
|
21681
|
-
temperature: 0,
|
|
21682
|
-
model: model
|
|
21683
|
-
})
|
|
21684
|
-
});
|
|
21685
|
-
const data = await response.json();
|
|
21686
|
-
return data.choices[0].message.content;
|
|
21687
|
-
} catch (error) {
|
|
21688
|
-
return '';
|
|
21689
|
-
}
|
|
21690
|
-
}
|
|
21691
|
-
|
|
21692
21691
|
const _excluded$e = ["className", "nlpFilterConfig", "onFilterModelChange"];
|
|
21693
21692
|
const COMPONENT_NAME$2 = 'GridToolbarFilterSemanticField';
|
|
21694
21693
|
const CLASSNAME$2 = 'redsift-datagrid-toolbar-nlp-filter-field';
|
|
@@ -21697,6 +21696,12 @@ const DEFAULT_GPT_MODEL = 'gpt-4-0613';
|
|
|
21697
21696
|
const DEFAULT_FILTER = {
|
|
21698
21697
|
items: []
|
|
21699
21698
|
};
|
|
21699
|
+
const DEFAULT_OPERATORS = {
|
|
21700
|
+
string: ['contains', 'equals', 'startsWith', 'endsWith', 'isEmpty', 'isNotEmpty', 'isAnyOf'],
|
|
21701
|
+
number: ['=', '!=', '>', '>=', '<', '<=', 'isEmpty', 'isNotEmpty', 'isAnyOf'],
|
|
21702
|
+
boolean: ['is'],
|
|
21703
|
+
date: ['is', 'not', 'after', 'onOrAfter', 'before', 'onOrBefore', 'isEmpty', 'isNotEmpty']
|
|
21704
|
+
};
|
|
21700
21705
|
const getRole = config => {
|
|
21701
21706
|
const today = new Date().toDateString();
|
|
21702
21707
|
const columns = `[${config.columns.map(_ref => {
|
|
@@ -21879,7 +21884,7 @@ const Toolbar$2 = props => {
|
|
|
21879
21884
|
let {
|
|
21880
21885
|
apiRef
|
|
21881
21886
|
} = _ref;
|
|
21882
|
-
return
|
|
21887
|
+
return gridVisibleSortedRowIdsSelector(apiRef);
|
|
21883
21888
|
}
|
|
21884
21889
|
},
|
|
21885
21890
|
printOptions: {
|
|
@@ -24334,7 +24339,7 @@ process.env.NODE_ENV !== "production" ? TablePagination.propTypes /* remove-prop
|
|
|
24334
24339
|
} : void 0;
|
|
24335
24340
|
var TablePagination$1 = TablePagination;
|
|
24336
24341
|
|
|
24337
|
-
const _excluded$1 = ["apiRef", "autoHeight", "className", "
|
|
24342
|
+
const _excluded$1 = ["apiRef", "autoHeight", "className", "components", "componentsProps", "filterModel", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "onFilterModelChange", "onPageChange", "onPageSizeChange", "onSelectionModelChange", "page", "pageSize", "pagination", "paginationPlacement", "paginationProps", "rows", "rowsPerPageOptions", "sx"];
|
|
24338
24343
|
const COMPONENT_NAME$1 = 'DataGrid';
|
|
24339
24344
|
const CLASSNAME$1 = 'redsift-datagrid';
|
|
24340
24345
|
const DEFAULT_PROPS = {
|
|
@@ -24363,9 +24368,11 @@ const ControlledPagination = _ref3 => {
|
|
|
24363
24368
|
displayPagination = false,
|
|
24364
24369
|
selectionStatus,
|
|
24365
24370
|
apiRef,
|
|
24366
|
-
|
|
24367
|
-
|
|
24368
|
-
|
|
24371
|
+
page,
|
|
24372
|
+
onPageChange,
|
|
24373
|
+
pageSize,
|
|
24374
|
+
onPageSizeChange,
|
|
24375
|
+
rowsPerPageOptions,
|
|
24369
24376
|
isRowSelectable,
|
|
24370
24377
|
paginationProps
|
|
24371
24378
|
} = _ref3;
|
|
@@ -24395,28 +24402,24 @@ const ControlledPagination = _ref3 => {
|
|
|
24395
24402
|
}, `${selectionStatus.numberOfSelectedRows} row${selectionStatus.numberOfSelectedRows > 1 ? 's' : ''} selected`) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$2({
|
|
24396
24403
|
component: "div",
|
|
24397
24404
|
count: numberOfFilteredRowsInTable,
|
|
24398
|
-
page:
|
|
24399
|
-
onPageChange: (event,
|
|
24400
|
-
|
|
24401
|
-
|
|
24402
|
-
|
|
24403
|
-
|
|
24404
|
-
|
|
24405
|
-
page: paginationModel.page,
|
|
24406
|
-
pageSize: parseInt(event.target.value, 10)
|
|
24407
|
-
}),
|
|
24408
|
-
rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
|
|
24405
|
+
page: page,
|
|
24406
|
+
onPageChange: (event, newPage) => onPageChange(newPage),
|
|
24407
|
+
rowsPerPage: pageSize,
|
|
24408
|
+
onRowsPerPageChange: event => {
|
|
24409
|
+
onPageSizeChange(parseInt(event.target.value, 10));
|
|
24410
|
+
},
|
|
24411
|
+
rowsPerPageOptions: displayRowsPerPage ? rowsPerPageOptions : []
|
|
24409
24412
|
}, paginationProps)) : null);
|
|
24410
24413
|
};
|
|
24411
24414
|
const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
24412
|
-
var
|
|
24415
|
+
var _initialState$paginat, _initialState$paginat2;
|
|
24413
24416
|
const datagridRef = ref || useRef();
|
|
24414
24417
|
const {
|
|
24415
24418
|
apiRef: propsApiRef,
|
|
24416
24419
|
autoHeight,
|
|
24417
24420
|
className,
|
|
24418
|
-
|
|
24419
|
-
|
|
24421
|
+
components,
|
|
24422
|
+
componentsProps,
|
|
24420
24423
|
filterModel: propsFilterModel,
|
|
24421
24424
|
height: propsHeight,
|
|
24422
24425
|
hideToolbar,
|
|
@@ -24424,20 +24427,22 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24424
24427
|
isRowSelectable,
|
|
24425
24428
|
license,
|
|
24426
24429
|
onFilterModelChange: propsOnFilterModelChange,
|
|
24427
|
-
|
|
24428
|
-
|
|
24429
|
-
|
|
24430
|
+
onPageChange: propsOnPageChange,
|
|
24431
|
+
onPageSizeChange: propsOnPageSizeChange,
|
|
24432
|
+
onSelectionModelChange,
|
|
24433
|
+
page: propsPage,
|
|
24434
|
+
pageSize: propsPageSize,
|
|
24430
24435
|
pagination,
|
|
24431
24436
|
paginationPlacement,
|
|
24432
24437
|
paginationProps,
|
|
24433
24438
|
rows,
|
|
24434
|
-
|
|
24439
|
+
rowsPerPageOptions,
|
|
24435
24440
|
sx
|
|
24436
24441
|
} = props,
|
|
24437
24442
|
forwardedProps = _objectWithoutProperties(props, _excluded$1);
|
|
24438
24443
|
const _apiRef = useGridApiRef();
|
|
24439
24444
|
const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
|
|
24440
|
-
const RenderedToolbar =
|
|
24445
|
+
const RenderedToolbar = components !== null && components !== void 0 && components.Toolbar ? components.Toolbar : Toolbar$2;
|
|
24441
24446
|
LicenseInfo.setLicenseKey(license);
|
|
24442
24447
|
const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
|
|
24443
24448
|
const selectionStatus = useRef({
|
|
@@ -24455,22 +24460,33 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24455
24460
|
setFilterModel(model);
|
|
24456
24461
|
}
|
|
24457
24462
|
};
|
|
24458
|
-
const [
|
|
24459
|
-
|
|
24460
|
-
|
|
24461
|
-
|
|
24462
|
-
|
|
24463
|
-
|
|
24464
|
-
|
|
24463
|
+
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);
|
|
24464
|
+
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);
|
|
24465
|
+
const onPageChange = page => {
|
|
24466
|
+
if (propsOnPageChange) {
|
|
24467
|
+
propsOnPageChange(page, undefined);
|
|
24468
|
+
} else {
|
|
24469
|
+
setPage(page);
|
|
24470
|
+
}
|
|
24471
|
+
};
|
|
24472
|
+
useEffect(() => {
|
|
24473
|
+
if (propsPage || propsPage === 0) {
|
|
24474
|
+
setPage(propsPage);
|
|
24475
|
+
}
|
|
24476
|
+
}, [propsPage]);
|
|
24477
|
+
const onPageSizeChange = pageSize => {
|
|
24478
|
+
onPageChange(0);
|
|
24479
|
+
if (propsOnPageSizeChange) {
|
|
24480
|
+
propsOnPageSizeChange(pageSize, undefined);
|
|
24465
24481
|
} else {
|
|
24466
|
-
|
|
24482
|
+
setPageSize(pageSize);
|
|
24467
24483
|
}
|
|
24468
24484
|
};
|
|
24469
24485
|
useEffect(() => {
|
|
24470
|
-
if (
|
|
24471
|
-
|
|
24486
|
+
if (propsPageSize) {
|
|
24487
|
+
setPageSize(propsPageSize);
|
|
24472
24488
|
}
|
|
24473
|
-
}, [
|
|
24489
|
+
}, [propsPageSize]);
|
|
24474
24490
|
if (!Array.isArray(rows)) {
|
|
24475
24491
|
return null;
|
|
24476
24492
|
}
|
|
@@ -24482,46 +24498,46 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24482
24498
|
apiRef: apiRef,
|
|
24483
24499
|
autoHeight: autoHeight,
|
|
24484
24500
|
checkboxSelectionVisibleOnly: Boolean(pagination),
|
|
24485
|
-
|
|
24486
|
-
|
|
24487
|
-
|
|
24488
|
-
//
|
|
24489
|
-
|
|
24490
|
-
|
|
24501
|
+
components: _objectSpread2(_objectSpread2({
|
|
24502
|
+
BaseButton,
|
|
24503
|
+
BaseCheckbox,
|
|
24504
|
+
// BaseTextField,
|
|
24505
|
+
BasePopper,
|
|
24506
|
+
ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24491
24507
|
displayName: "ColumnFilteredIcon"
|
|
24492
24508
|
})),
|
|
24493
|
-
|
|
24509
|
+
ColumnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24494
24510
|
displayName: "ColumnSelectorIcon"
|
|
24495
24511
|
})),
|
|
24496
|
-
|
|
24512
|
+
ColumnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24497
24513
|
displayName: "ColumnSortedAscendingIcon"
|
|
24498
24514
|
})),
|
|
24499
|
-
|
|
24515
|
+
ColumnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24500
24516
|
displayName: "ColumnSortedDescendingIcon"
|
|
24501
24517
|
})),
|
|
24502
|
-
|
|
24518
|
+
DensityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24503
24519
|
displayName: "DensityCompactIcon"
|
|
24504
24520
|
})),
|
|
24505
|
-
|
|
24521
|
+
DensityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24506
24522
|
displayName: "DensityStandardIcon"
|
|
24507
24523
|
})),
|
|
24508
|
-
|
|
24524
|
+
DensityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24509
24525
|
displayName: "DensityComfortableIcon"
|
|
24510
24526
|
})),
|
|
24511
|
-
|
|
24527
|
+
DetailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24512
24528
|
displayName: "DetailPanelCollapseIcon"
|
|
24513
24529
|
})),
|
|
24514
|
-
|
|
24530
|
+
DetailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24515
24531
|
displayName: "DetailPanelExpandIcon"
|
|
24516
24532
|
})),
|
|
24517
|
-
|
|
24533
|
+
ExportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
24518
24534
|
displayName: "ExportIcon"
|
|
24519
24535
|
})),
|
|
24520
|
-
|
|
24536
|
+
OpenFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({
|
|
24521
24537
|
displayName: "OpenFilterButtonIcon"
|
|
24522
24538
|
}, props))
|
|
24523
|
-
},
|
|
24524
|
-
|
|
24539
|
+
}, components), {}, {
|
|
24540
|
+
Toolbar: props => {
|
|
24525
24541
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, !hideToolbar ? /*#__PURE__*/React__default.createElement(RenderedToolbar, _extends$2({}, props, {
|
|
24526
24542
|
filterModel: filterModel,
|
|
24527
24543
|
onFilterModelChange: onFilterModelChange
|
|
@@ -24532,27 +24548,31 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24532
24548
|
selectionStatus: selectionStatus.current,
|
|
24533
24549
|
apiRef: apiRef,
|
|
24534
24550
|
isRowSelectable: isRowSelectable,
|
|
24535
|
-
|
|
24536
|
-
|
|
24537
|
-
|
|
24551
|
+
page: page,
|
|
24552
|
+
onPageChange: onPageChange,
|
|
24553
|
+
pageSize: pageSize,
|
|
24554
|
+
onPageSizeChange: onPageSizeChange,
|
|
24555
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
24538
24556
|
paginationProps: paginationProps
|
|
24539
24557
|
}) : null);
|
|
24540
24558
|
},
|
|
24541
|
-
|
|
24559
|
+
Pagination: props => pagination ? /*#__PURE__*/React__default.createElement(ControlledPagination, _extends$2({}, props, {
|
|
24542
24560
|
displaySelection: false,
|
|
24543
24561
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
24544
24562
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
24545
24563
|
selectionStatus: selectionStatus.current,
|
|
24546
24564
|
apiRef: apiRef,
|
|
24547
24565
|
isRowSelectable: isRowSelectable,
|
|
24548
|
-
|
|
24549
|
-
|
|
24550
|
-
|
|
24566
|
+
page: page,
|
|
24567
|
+
onPageChange: onPageChange,
|
|
24568
|
+
pageSize: pageSize,
|
|
24569
|
+
onPageSizeChange: onPageSizeChange,
|
|
24570
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
24551
24571
|
paginationProps: paginationProps
|
|
24552
24572
|
})) : null
|
|
24553
24573
|
}),
|
|
24554
|
-
|
|
24555
|
-
toolbar: _objectSpread2({},
|
|
24574
|
+
componentsProps: _objectSpread2(_objectSpread2({}, componentsProps), {}, {
|
|
24575
|
+
toolbar: _objectSpread2({}, componentsProps === null || componentsProps === void 0 ? void 0 : componentsProps.toolbar)
|
|
24556
24576
|
}),
|
|
24557
24577
|
filterModel: filterModel,
|
|
24558
24578
|
initialState: initialState,
|
|
@@ -24560,38 +24580,40 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24560
24580
|
onFilterModelChange: onFilterModelChange,
|
|
24561
24581
|
pagination: pagination,
|
|
24562
24582
|
rows: rows,
|
|
24563
|
-
|
|
24564
|
-
|
|
24565
|
-
|
|
24566
|
-
|
|
24583
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
24584
|
+
page: page,
|
|
24585
|
+
onPageChange: onPageChange,
|
|
24586
|
+
pageSize: pageSize,
|
|
24587
|
+
onPageSizeChange: onPageSizeChange,
|
|
24588
|
+
onSelectionModelChange: (newSelectionModel, details) => {
|
|
24567
24589
|
if (pagination) {
|
|
24568
|
-
const selectableRowsInPage = props.isRowSelectable && typeof props.isRowSelectable === 'function' ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(
|
|
24590
|
+
const selectableRowsInPage = props.isRowSelectable && typeof props.isRowSelectable === 'function' ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref4 => {
|
|
24569
24591
|
var _props$isRowSelectabl;
|
|
24570
24592
|
let {
|
|
24571
24593
|
model
|
|
24572
|
-
} =
|
|
24594
|
+
} = _ref4;
|
|
24573
24595
|
return (_props$isRowSelectabl = props.isRowSelectable) === null || _props$isRowSelectabl === void 0 ? void 0 : _props$isRowSelectabl.call(props, {
|
|
24574
24596
|
row: model
|
|
24575
24597
|
});
|
|
24576
|
-
}).map(
|
|
24598
|
+
}).map(_ref5 => {
|
|
24577
24599
|
let {
|
|
24578
24600
|
id
|
|
24579
|
-
} =
|
|
24601
|
+
} = _ref5;
|
|
24580
24602
|
return id;
|
|
24581
24603
|
}) : gridPaginatedVisibleSortedGridRowIdsSelector(apiRef);
|
|
24582
24604
|
const numberOfSelectableRowsInPage = selectableRowsInPage.length;
|
|
24583
|
-
const selectableRowsInTable = props.isRowSelectable && typeof props.isRowSelectable === 'function' ? gridFilteredSortedRowEntriesSelector(apiRef).filter(
|
|
24605
|
+
const selectableRowsInTable = props.isRowSelectable && typeof props.isRowSelectable === 'function' ? gridFilteredSortedRowEntriesSelector(apiRef).filter(_ref6 => {
|
|
24584
24606
|
var _props$isRowSelectabl2;
|
|
24585
24607
|
let {
|
|
24586
24608
|
model
|
|
24587
|
-
} =
|
|
24609
|
+
} = _ref6;
|
|
24588
24610
|
return (_props$isRowSelectabl2 = props.isRowSelectable) === null || _props$isRowSelectabl2 === void 0 ? void 0 : _props$isRowSelectabl2.call(props, {
|
|
24589
24611
|
row: model
|
|
24590
24612
|
});
|
|
24591
|
-
}).map(
|
|
24613
|
+
}).map(_ref7 => {
|
|
24592
24614
|
let {
|
|
24593
24615
|
id
|
|
24594
|
-
} =
|
|
24616
|
+
} = _ref7;
|
|
24595
24617
|
return id;
|
|
24596
24618
|
}) : gridFilteredSortedRowIdsSelector(apiRef);
|
|
24597
24619
|
const numberOfSelectableRowsInTable = selectableRowsInTable.length;
|
|
@@ -24623,7 +24645,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24623
24645
|
};
|
|
24624
24646
|
}
|
|
24625
24647
|
}
|
|
24626
|
-
|
|
24648
|
+
onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(newSelectionModel, details);
|
|
24627
24649
|
},
|
|
24628
24650
|
sx: _objectSpread2(_objectSpread2({}, sx), {}, {
|
|
24629
24651
|
'.MuiDataGrid-columnHeaders': {
|
|
@@ -24698,5 +24720,5 @@ const TextCell = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24698
24720
|
TextCell.className = CLASSNAME;
|
|
24699
24721
|
TextCell.displayName = COMPONENT_NAME;
|
|
24700
24722
|
|
|
24701
|
-
export { CONTAINS_ANY_OF, CONTAINS_ANY_OF_I, DETAIL_PANEL_TOGGLE_COL_DEF, DataGrid, ENDS_WITH_ANY_OF, IS_ANY_OF, IS_BETWEEN, IS_NOT_ANY_OF, STARTS_WITH_ANY_OF, TextCell, Toolbar$2 as Toolbar, getGridNumericOperators, getGridStringArrayOperators, getGridStringOperators };
|
|
24723
|
+
export { CONTAINS_ANY_OF, CONTAINS_ANY_OF_I, DEFAULT_OPERATORS, DETAIL_PANEL_TOGGLE_COL_DEF, DataGrid, ENDS_WITH_ANY_OF, GridToolbarFilterSemanticField, IS_ANY_OF, IS_BETWEEN, IS_NOT_ANY_OF, STARTS_WITH_ANY_OF, TextCell, Toolbar$2 as Toolbar, getCompletion, getGridNumericOperators, getGridStringArrayOperators, getGridStringOperators };
|
|
24702
24724
|
//# sourceMappingURL=index.js.map
|