@redsift/table 11.3.2-alpha.3 → 11.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 +56 -54
- package/index.js +417 -307
- package/index.js.map +1 -1
- package/package.json +4 -4
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GRID_DETAIL_PANEL_TOGGLE_COL_DEF, getGridNumericOperators as getGridNumericOperators$1, GridFilterInputValue, GridFilterInputSingleSelect, GridFilterInputMultipleValue, GridFilterInputMultipleSingleSelect, getGridStringOperators as getGridStringOperators$1, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators,
|
|
1
|
+
import { GRID_DETAIL_PANEL_TOGGLE_COL_DEF, getGridNumericOperators as getGridNumericOperators$1, GridFilterInputValue, GridFilterInputSingleSelect, GridFilterInputMultipleValue, GridFilterInputMultipleSingleSelect, getGridStringOperators as getGridStringOperators$1, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators, GridLinkOperator, GridToolbarContainer, GridToolbarFilterButton, GridToolbarColumnsButton, GridToolbarDensitySelector, GridToolbarExport, gridVisibleSortedRowIdsSelector, GridToolbarQuickFilter, gridPaginatedVisibleSortedGridRowEntriesSelector, gridPaginatedVisibleSortedGridRowIdsSelector, gridFilteredSortedRowEntriesSelector, gridFilteredSortedRowIdsSelector, useGridApiRef, DataGridPro } from '@mui/x-data-grid-pro';
|
|
2
2
|
export { getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators } from '@mui/x-data-grid-pro';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import React__default, { Children, isValidElement, cloneElement, forwardRef, useLayoutEffect, useEffect, useRef, useContext, useState, useCallback, createElement, useMemo } from 'react';
|
|
@@ -17639,7 +17639,7 @@ const isBetweenOperator = {
|
|
|
17639
17639
|
label: 'is between',
|
|
17640
17640
|
value: 'isBetween',
|
|
17641
17641
|
getApplyFilterFn: filterItem => {
|
|
17642
|
-
if (!filterItem.
|
|
17642
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17643
17643
|
return null;
|
|
17644
17644
|
}
|
|
17645
17645
|
if (!Array.isArray(filterItem.value) || filterItem.value.length !== 2) {
|
|
@@ -17652,7 +17652,7 @@ const isBetweenOperator = {
|
|
|
17652
17652
|
return null;
|
|
17653
17653
|
}
|
|
17654
17654
|
return params => {
|
|
17655
|
-
return params.value !== null &&
|
|
17655
|
+
return params.value !== null && filterItem.value[0] <= params.value && params.value <= filterItem.value[1];
|
|
17656
17656
|
};
|
|
17657
17657
|
},
|
|
17658
17658
|
InputComponent: InputNumberInterval
|
|
@@ -17665,7 +17665,7 @@ const doesNotContain = {
|
|
|
17665
17665
|
label: 'does not contain',
|
|
17666
17666
|
value: 'doesNotContain',
|
|
17667
17667
|
getApplyFilterFn: filterItem => {
|
|
17668
|
-
if (!filterItem.
|
|
17668
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17669
17669
|
return null;
|
|
17670
17670
|
}
|
|
17671
17671
|
return params => {
|
|
@@ -17686,7 +17686,7 @@ const doesNotEqual = {
|
|
|
17686
17686
|
label: 'does not equal',
|
|
17687
17687
|
value: 'doesNotEqual',
|
|
17688
17688
|
getApplyFilterFn: filterItem => {
|
|
17689
|
-
if (!filterItem.
|
|
17689
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17690
17690
|
return null;
|
|
17691
17691
|
}
|
|
17692
17692
|
return params => {
|
|
@@ -17707,7 +17707,7 @@ const doesNotHaveOperator = {
|
|
|
17707
17707
|
label: "doesn't have",
|
|
17708
17708
|
value: 'doesNotHave',
|
|
17709
17709
|
getApplyFilterFn: filterItem => {
|
|
17710
|
-
if (!filterItem.
|
|
17710
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17711
17711
|
return null;
|
|
17712
17712
|
}
|
|
17713
17713
|
return params => {
|
|
@@ -17726,7 +17726,7 @@ const hasOperator = {
|
|
|
17726
17726
|
label: 'has',
|
|
17727
17727
|
value: 'has',
|
|
17728
17728
|
getApplyFilterFn: filterItem => {
|
|
17729
|
-
if (!filterItem.
|
|
17729
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17730
17730
|
return null;
|
|
17731
17731
|
}
|
|
17732
17732
|
return params => {
|
|
@@ -17745,7 +17745,7 @@ const hasOnlyOperator = {
|
|
|
17745
17745
|
label: 'has only',
|
|
17746
17746
|
value: 'hasOnly',
|
|
17747
17747
|
getApplyFilterFn: filterItem => {
|
|
17748
|
-
if (!filterItem.
|
|
17748
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17749
17749
|
return null;
|
|
17750
17750
|
}
|
|
17751
17751
|
return params => {
|
|
@@ -17764,7 +17764,7 @@ const isOperator = {
|
|
|
17764
17764
|
label: 'is',
|
|
17765
17765
|
value: 'is',
|
|
17766
17766
|
getApplyFilterFn: filterItem => {
|
|
17767
|
-
if (!filterItem.
|
|
17767
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17768
17768
|
return null;
|
|
17769
17769
|
}
|
|
17770
17770
|
return params => {
|
|
@@ -17785,7 +17785,7 @@ const isNotOperator = {
|
|
|
17785
17785
|
label: 'is not',
|
|
17786
17786
|
value: 'isNot',
|
|
17787
17787
|
getApplyFilterFn: filterItem => {
|
|
17788
|
-
if (!filterItem.
|
|
17788
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17789
17789
|
return null;
|
|
17790
17790
|
}
|
|
17791
17791
|
return params => {
|
|
@@ -17806,7 +17806,7 @@ const containsAnyOfOperator = {
|
|
|
17806
17806
|
label: 'contains any of',
|
|
17807
17807
|
value: 'containsAnyOf',
|
|
17808
17808
|
getApplyFilterFn: filterItem => {
|
|
17809
|
-
if (!filterItem.
|
|
17809
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17810
17810
|
return null;
|
|
17811
17811
|
}
|
|
17812
17812
|
return params => {
|
|
@@ -17831,7 +17831,7 @@ const containsAnyOfCIOperator = {
|
|
|
17831
17831
|
label: 'contains any of (case insensitive)',
|
|
17832
17832
|
value: 'containsAnyOf',
|
|
17833
17833
|
getApplyFilterFn: filterItem => {
|
|
17834
|
-
if (!filterItem.
|
|
17834
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17835
17835
|
return null;
|
|
17836
17836
|
}
|
|
17837
17837
|
return params => {
|
|
@@ -17858,7 +17858,7 @@ const endsWithAnyOfOperator = {
|
|
|
17858
17858
|
label: 'ends with any of',
|
|
17859
17859
|
value: 'endsWithAnyOf',
|
|
17860
17860
|
getApplyFilterFn: filterItem => {
|
|
17861
|
-
if (!filterItem.
|
|
17861
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17862
17862
|
return null;
|
|
17863
17863
|
}
|
|
17864
17864
|
return params => {
|
|
@@ -17885,7 +17885,7 @@ const isAnyOfOperator = {
|
|
|
17885
17885
|
label: 'is any of',
|
|
17886
17886
|
value: 'isAnyOf',
|
|
17887
17887
|
getApplyFilterFn: filterItem => {
|
|
17888
|
-
if (!filterItem.
|
|
17888
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17889
17889
|
return null;
|
|
17890
17890
|
}
|
|
17891
17891
|
return params => {
|
|
@@ -17912,7 +17912,7 @@ const hasAnyOfOperator = {
|
|
|
17912
17912
|
label: 'has any of',
|
|
17913
17913
|
value: 'hasAnyOf',
|
|
17914
17914
|
getApplyFilterFn: filterItem => {
|
|
17915
|
-
if (!filterItem.
|
|
17915
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17916
17916
|
return null;
|
|
17917
17917
|
}
|
|
17918
17918
|
return params => {
|
|
@@ -17935,7 +17935,7 @@ const isNotAnyOfOperator = {
|
|
|
17935
17935
|
label: 'is not any of',
|
|
17936
17936
|
value: 'isNotAnyOf',
|
|
17937
17937
|
getApplyFilterFn: filterItem => {
|
|
17938
|
-
if (!filterItem.
|
|
17938
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17939
17939
|
return null;
|
|
17940
17940
|
}
|
|
17941
17941
|
return params => {
|
|
@@ -17954,15 +17954,12 @@ const isNotAnyOfOperator = {
|
|
|
17954
17954
|
InputComponent: GridFilterInputMultipleValue
|
|
17955
17955
|
};
|
|
17956
17956
|
const IS_NOT_ANY_OF = isNotAnyOfOperator;
|
|
17957
|
-
const IS_NOT_ANY_OF_WITH_SELECT = _objectSpread2(_objectSpread2({}, IS_NOT_ANY_OF), {}, {
|
|
17958
|
-
InputComponent: GridFilterInputMultipleSingleSelect
|
|
17959
|
-
});
|
|
17960
17957
|
|
|
17961
17958
|
const startsWithAnyOfOperator = {
|
|
17962
17959
|
label: 'starts with any of',
|
|
17963
17960
|
value: 'startsWithAnyOf',
|
|
17964
17961
|
getApplyFilterFn: filterItem => {
|
|
17965
|
-
if (!filterItem.
|
|
17962
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17966
17963
|
return null;
|
|
17967
17964
|
}
|
|
17968
17965
|
return params => {
|
|
@@ -17985,15 +17982,11 @@ const startsWithAnyOfOperator = {
|
|
|
17985
17982
|
};
|
|
17986
17983
|
const STARTS_WITH_ANY_OF = startsWithAnyOfOperator;
|
|
17987
17984
|
|
|
17988
|
-
const getGridStringArrayOperators = () => [CONTAINS_ANY_OF, ENDS_WITH_ANY_OF, IS_ANY_OF, IS_NOT_ANY_OF, STARTS_WITH_ANY_OF];
|
|
17989
|
-
|
|
17990
|
-
const getGridStringOperators = () => [...getGridStringOperators$1().filter(operator => !['isAnyOf'].includes(operator.value)), DOES_NOT_CONTAIN, DOES_NOT_EQUAL, ...getGridStringArrayOperators()];
|
|
17991
|
-
|
|
17992
17985
|
const doesNotHaveAnyOf = {
|
|
17993
17986
|
label: "doesn't have any of",
|
|
17994
17987
|
value: 'doesNotHaveAnyOf',
|
|
17995
17988
|
getApplyFilterFn: filterItem => {
|
|
17996
|
-
if (!filterItem.
|
|
17989
|
+
if (!filterItem.columnField || !filterItem.value || !Array.isArray(filterItem.value) || filterItem.value.length === 0) {
|
|
17997
17990
|
return null;
|
|
17998
17991
|
}
|
|
17999
17992
|
return params => {
|
|
@@ -18010,6 +18003,12 @@ const DOES_NOT_HAVE_ANY_OF_WITH_SELECT = _objectSpread2(_objectSpread2({}, DOES_
|
|
|
18010
18003
|
InputComponent: GridFilterInputMultipleSingleSelect
|
|
18011
18004
|
});
|
|
18012
18005
|
|
|
18006
|
+
const getGridStringArrayOperators = () => [CONTAINS_ANY_OF, ENDS_WITH_ANY_OF, IS_ANY_OF, IS_NOT_ANY_OF, STARTS_WITH_ANY_OF];
|
|
18007
|
+
const getGridStringArrayOperatorsWithSelect = () => [CONTAINS_ANY_OF, ENDS_WITH_ANY_OF, IS_ANY_OF_WITH_SELECT, IS_ANY_OF_WITH_SELECT, IS_NOT_WITH_SELECT, IS_WITH_SELECT, STARTS_WITH_ANY_OF];
|
|
18008
|
+
const getGridStringArrayOperatorsWithSelectOnStringArrayColumns = () => [HAS_WITH_SELECT, HAS_ANY_OF_WITH_SELECT, HAS_ONLY_WITH_SELECT, DOES_NOT_HAVE_WITH_SELECT, DOES_NOT_HAVE_ANY_OF_WITH_SELECT];
|
|
18009
|
+
|
|
18010
|
+
const getGridStringOperators = () => [...getGridStringOperators$1().filter(operator => !['isAnyOf'].includes(operator.value)), DOES_NOT_CONTAIN, DOES_NOT_EQUAL, ...getGridStringArrayOperators()];
|
|
18011
|
+
|
|
18013
18012
|
// istanbul ignore file
|
|
18014
18013
|
const operatorList = {
|
|
18015
18014
|
// Default types
|
|
@@ -18032,37 +18031,37 @@ const operatorList = {
|
|
|
18032
18031
|
|
|
18033
18032
|
const getRsStringColumnType = () => {
|
|
18034
18033
|
return {
|
|
18035
|
-
|
|
18034
|
+
extendType: 'string',
|
|
18036
18035
|
filterOperators: operatorList.rsString
|
|
18037
18036
|
};
|
|
18038
18037
|
};
|
|
18039
18038
|
const getRsNumberColumnType = () => {
|
|
18040
18039
|
return {
|
|
18041
|
-
|
|
18040
|
+
extendType: 'number',
|
|
18042
18041
|
filterOperators: operatorList.rsNumber
|
|
18043
18042
|
};
|
|
18044
18043
|
};
|
|
18045
18044
|
const getRsSingleSelectColumnType = () => {
|
|
18046
18045
|
return {
|
|
18047
|
-
|
|
18046
|
+
extendType: 'singleSelect',
|
|
18048
18047
|
filterOperators: operatorList.rsSingleSelect
|
|
18049
18048
|
};
|
|
18050
18049
|
};
|
|
18051
18050
|
const getRsSingleSelectWithShortOperatorListColumnType = () => {
|
|
18052
18051
|
return {
|
|
18053
|
-
|
|
18052
|
+
extendType: 'singleSelect',
|
|
18054
18053
|
filterOperators: operatorList.rsSingleSelectWithShortOperatorList
|
|
18055
18054
|
};
|
|
18056
18055
|
};
|
|
18057
18056
|
const getRsMultipleSelectColumnType = () => {
|
|
18058
18057
|
return {
|
|
18059
|
-
|
|
18058
|
+
extendType: 'singleSelect',
|
|
18060
18059
|
filterOperators: operatorList.rsMultipleSelect
|
|
18061
18060
|
};
|
|
18062
18061
|
};
|
|
18063
18062
|
const getRsMultipleSelectWithShortOperatorListColumnType = () => {
|
|
18064
18063
|
return {
|
|
18065
|
-
|
|
18064
|
+
extendType: 'singleSelect',
|
|
18066
18065
|
filterOperators: operatorList.rsMultipleSelectWithShortOperatorList
|
|
18067
18066
|
};
|
|
18068
18067
|
};
|
|
@@ -18077,7 +18076,7 @@ const customColumnTypes = {
|
|
|
18077
18076
|
|
|
18078
18077
|
const API_URL = 'https://api.openai.com/v1/chat/completions';
|
|
18079
18078
|
async function getCompletion(text, role, openai_api_key) {
|
|
18080
|
-
let model = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'gpt-3.5-turbo-
|
|
18079
|
+
let model = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'gpt-3.5-turbo-0613';
|
|
18081
18080
|
try {
|
|
18082
18081
|
const messages = [{
|
|
18083
18082
|
role: 'system',
|
|
@@ -18244,39 +18243,42 @@ const numberOperatorDecoder = {
|
|
|
18244
18243
|
lt: '<',
|
|
18245
18244
|
lte: '<='
|
|
18246
18245
|
};
|
|
18247
|
-
const isOperatorValueValid = (
|
|
18248
|
-
const column = columns.find(column => column.field ===
|
|
18246
|
+
const isOperatorValueValid = (columnField, operatorValue, columns) => {
|
|
18247
|
+
const column = columns.find(column => column.field === columnField);
|
|
18249
18248
|
if (!column) {
|
|
18250
18249
|
return false;
|
|
18251
18250
|
}
|
|
18252
18251
|
const columnType = (column === null || column === void 0 ? void 0 : column.type) || 'string';
|
|
18253
|
-
const operators =
|
|
18252
|
+
const operators = operatorList[columnType];
|
|
18254
18253
|
if (!operators) {
|
|
18255
18254
|
return false;
|
|
18256
18255
|
}
|
|
18257
|
-
|
|
18256
|
+
if ('filterOperators' in operators) {
|
|
18257
|
+
return !!operators.filterOperators.find(op => columnType === 'number' && Object.keys(numberOperatorEncoder).includes(op.value) ? numberOperatorEncoder[op.value] === operatorValue : op['value'] === operatorValue);
|
|
18258
|
+
}
|
|
18259
|
+
return !!operators.find(op => ['number', 'rsNumber'].includes(columnType) && Object.keys(numberOperatorEncoder).includes(op.value) ? numberOperatorEncoder[op.value] === operatorValue : op['value'] === operatorValue);
|
|
18258
18260
|
};
|
|
18259
18261
|
const listOperators = ['containsAnyOf', 'doesNotContainAnyOf', 'endsWithAnyOf', 'doesNotEndWithAnyOf', 'hasAnyOf', 'doesNotHaveAnyOf', 'isAnyOf', 'isNotAnyOf', 'startsWithAnyOf', 'doesNotStartWithAnyOf'];
|
|
18260
18262
|
|
|
18261
18263
|
// Check if the value doesn't break
|
|
18262
|
-
const isValueValid = (value,
|
|
18264
|
+
const isValueValid = (value, columnField, columns, operatorValue) => {
|
|
18263
18265
|
var _column$type;
|
|
18264
18266
|
// every field accepts undefined as value for default
|
|
18265
18267
|
if (value === undefined || value === '') {
|
|
18266
18268
|
return true;
|
|
18267
18269
|
}
|
|
18268
18270
|
|
|
18269
|
-
// xxxAnyOf accepts as value only lists, and we are
|
|
18271
|
+
// xxxAnyOf accepts as value only lists, and we are declearing them in the
|
|
18270
18272
|
// URL as `list=[...]`
|
|
18271
|
-
if (listOperators.includes(
|
|
18273
|
+
if (listOperators.includes(operatorValue)) {
|
|
18272
18274
|
return Array.isArray(value) || value === '';
|
|
18273
18275
|
}
|
|
18274
18276
|
|
|
18275
18277
|
// We are accepting arrays only if they are of the 'xxxAnyOf' type
|
|
18276
|
-
if (Array.isArray(value) && !listOperators.includes(
|
|
18278
|
+
if (Array.isArray(value) && !listOperators.includes(operatorValue)) {
|
|
18277
18279
|
return false;
|
|
18278
18280
|
}
|
|
18279
|
-
const column = columns.find(column => column.field ===
|
|
18281
|
+
const column = columns.find(column => column.field === columnField);
|
|
18280
18282
|
if (!column) {
|
|
18281
18283
|
return false;
|
|
18282
18284
|
}
|
|
@@ -18314,7 +18316,7 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
18314
18316
|
if (!searchString) {
|
|
18315
18317
|
return 'invalid';
|
|
18316
18318
|
}
|
|
18317
|
-
let
|
|
18319
|
+
let linkOperator = GridLinkOperator.And;
|
|
18318
18320
|
let quickFilterValues = [];
|
|
18319
18321
|
const searchParams = new URLSearchParams();
|
|
18320
18322
|
for (const [key, value] of new URLSearchParams(searchString)) {
|
|
@@ -18322,7 +18324,7 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
18322
18324
|
searchParams.set(key, value);
|
|
18323
18325
|
}
|
|
18324
18326
|
if (key === '_logicOperator') {
|
|
18325
|
-
|
|
18327
|
+
linkOperator = value;
|
|
18326
18328
|
}
|
|
18327
18329
|
if (key === '_quickFilterValues') {
|
|
18328
18330
|
try {
|
|
@@ -18341,7 +18343,7 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
18341
18343
|
if (isInvalid) {
|
|
18342
18344
|
return;
|
|
18343
18345
|
}
|
|
18344
|
-
const field = key.split('[')[0].slice(1);
|
|
18346
|
+
const field = key.split('[')[0].slice(1); // Slice to remove the _ at the beginning
|
|
18345
18347
|
if (!fields.includes(field)) {
|
|
18346
18348
|
return;
|
|
18347
18349
|
}
|
|
@@ -18358,6 +18360,7 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
18358
18360
|
return;
|
|
18359
18361
|
}
|
|
18360
18362
|
const operator = splitRight[0];
|
|
18363
|
+
// if the operator is not part of the valid operators invalidate the URL
|
|
18361
18364
|
if (!isOperatorValueValid(field, operator, columns) || Array.isArray(operator)) {
|
|
18362
18365
|
isInvalid = true;
|
|
18363
18366
|
return;
|
|
@@ -18369,37 +18372,41 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
18369
18372
|
return;
|
|
18370
18373
|
}
|
|
18371
18374
|
items.push({
|
|
18372
|
-
field,
|
|
18373
|
-
|
|
18375
|
+
columnField: field,
|
|
18376
|
+
operatorValue: ['number', 'rsNumber'].includes(columnType) && Object.keys(numberOperatorDecoder).includes(operator) ? numberOperatorDecoder[operator] : operator,
|
|
18374
18377
|
id,
|
|
18375
18378
|
value: listOperators.includes(operator) && decodedValue === '' ? [] : decodedValue,
|
|
18376
18379
|
type
|
|
18377
18380
|
});
|
|
18378
18381
|
});
|
|
18382
|
+
|
|
18383
|
+
// If we found some condition that results in an invalid URL,
|
|
18384
|
+
// return the empty filterModel (this will trigger the localStorage)
|
|
18385
|
+
// and will pick up the last valid search
|
|
18379
18386
|
if (isInvalid) {
|
|
18380
18387
|
return 'invalid';
|
|
18381
18388
|
}
|
|
18382
18389
|
return {
|
|
18383
18390
|
items,
|
|
18384
|
-
|
|
18391
|
+
linkOperator,
|
|
18385
18392
|
quickFilterValues
|
|
18386
18393
|
};
|
|
18387
18394
|
};
|
|
18388
18395
|
const getSearchParamsFromFilterModel = filterModel => {
|
|
18389
18396
|
var _filterModel$quickFil;
|
|
18390
18397
|
const searchParams = new URLSearchParams();
|
|
18391
|
-
searchParams.set('_logicOperator', filterModel['
|
|
18398
|
+
searchParams.set('_logicOperator', filterModel['linkOperator'] || '');
|
|
18392
18399
|
filterModel['items'].forEach(item => {
|
|
18393
18400
|
const {
|
|
18394
|
-
|
|
18395
|
-
|
|
18401
|
+
columnField,
|
|
18402
|
+
operatorValue,
|
|
18396
18403
|
value,
|
|
18397
18404
|
type
|
|
18398
18405
|
} = item;
|
|
18399
|
-
if (Object.keys(numberOperatorEncoder).includes(
|
|
18400
|
-
searchParams.set(`_${
|
|
18406
|
+
if (Object.keys(numberOperatorEncoder).includes(operatorValue)) {
|
|
18407
|
+
searchParams.set(`_${columnField}[${numberOperatorEncoder[operatorValue]},${encodeValue(type)}]`, encodeValue(value));
|
|
18401
18408
|
} else {
|
|
18402
|
-
searchParams.set(`_${
|
|
18409
|
+
searchParams.set(`_${columnField}[${encodeValue(operatorValue)},${encodeValue(type)}]`, encodeValue(value));
|
|
18403
18410
|
}
|
|
18404
18411
|
});
|
|
18405
18412
|
if ((_filterModel$quickFil = filterModel.quickFilterValues) !== null && _filterModel$quickFil !== void 0 && _filterModel$quickFil.length) {
|
|
@@ -18415,7 +18422,7 @@ const getSearchParamsFromFilterModel = filterModel => {
|
|
|
18415
18422
|
const getFilterModel = (search, columns, localStorageFilters, setLocalStorageFilters, initialState, isNewVersion) => {
|
|
18416
18423
|
const defaultValue = initialState && initialState.filter && initialState.filter.filterModel ? initialState.filter.filterModel : {
|
|
18417
18424
|
items: [],
|
|
18418
|
-
|
|
18425
|
+
linkOperator: GridLinkOperator.And
|
|
18419
18426
|
};
|
|
18420
18427
|
if (isNewVersion) {
|
|
18421
18428
|
return defaultValue;
|
|
@@ -18554,38 +18561,13 @@ const getPaginationModel = (search, localStoragePagination, setLocalStoragePagin
|
|
|
18554
18561
|
|
|
18555
18562
|
/** COLUMN VISIBILITY */
|
|
18556
18563
|
|
|
18557
|
-
const getColumnVisibilityFromString = (searchString, columns) => {
|
|
18558
|
-
if (!searchString) {
|
|
18559
|
-
return 'invalid';
|
|
18560
|
-
}
|
|
18561
|
-
const searchParams = new URLSearchParams(searchString);
|
|
18562
|
-
const value = searchParams.get('_columnVisibility');
|
|
18563
|
-
if (value === '' || value === null || value === '[]') {
|
|
18564
|
-
return 'invalid';
|
|
18565
|
-
}
|
|
18566
|
-
const parsedFields = value.slice(1, value.length - 1).split(',');
|
|
18567
|
-
const fields = columns.map(column => column.field);
|
|
18568
|
-
const visibility = {};
|
|
18569
|
-
for (const field of fields) {
|
|
18570
|
-
visibility[field] = false;
|
|
18571
|
-
}
|
|
18572
|
-
for (const parsedField of parsedFields) {
|
|
18573
|
-
if (fields.includes(parsedField)) {
|
|
18574
|
-
visibility[parsedField] = true;
|
|
18575
|
-
}
|
|
18576
|
-
}
|
|
18577
|
-
if (Object.values(visibility).filter(v => v === true).length === 0) {
|
|
18578
|
-
return 'invalid';
|
|
18579
|
-
}
|
|
18580
|
-
return visibility;
|
|
18581
|
-
};
|
|
18582
18564
|
const getSearchParamsFromColumnVisibility = (columnVisibility, columns) => {
|
|
18583
18565
|
const searchParams = new URLSearchParams();
|
|
18584
|
-
const
|
|
18566
|
+
const columnFields = columns.map(column => column.field);
|
|
18585
18567
|
|
|
18586
18568
|
// if column visibility model is empty, show all columns
|
|
18587
18569
|
if (Object.keys(columnVisibility).length == 0) {
|
|
18588
|
-
searchParams.set('_columnVisibility', `[${
|
|
18570
|
+
searchParams.set('_columnVisibility', `[${columnFields.join(',')}]`);
|
|
18589
18571
|
return searchParams;
|
|
18590
18572
|
}
|
|
18591
18573
|
const finalColumnVisibility = columns.filter(c => {
|
|
@@ -18596,10 +18578,63 @@ const getSearchParamsFromColumnVisibility = (columnVisibility, columns) => {
|
|
|
18596
18578
|
[colName]: true
|
|
18597
18579
|
});
|
|
18598
18580
|
}, columnVisibility);
|
|
18599
|
-
const visibleColumns =
|
|
18581
|
+
const visibleColumns = Object.entries(finalColumnVisibility)
|
|
18582
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
18583
|
+
.filter(_ref => {
|
|
18584
|
+
let [_, visible] = _ref;
|
|
18585
|
+
return visible;
|
|
18586
|
+
})
|
|
18587
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
18588
|
+
.map(_ref2 => {
|
|
18589
|
+
let [column, _] = _ref2;
|
|
18590
|
+
return encodeValue(column);
|
|
18591
|
+
});
|
|
18600
18592
|
searchParams.set('_columnVisibility', `[${visibleColumns.join(',')}]`);
|
|
18601
18593
|
return searchParams;
|
|
18602
18594
|
};
|
|
18595
|
+
const getColumnVisibilityFromString = (notParsed, tableColumns) => {
|
|
18596
|
+
if (!notParsed || notParsed.length === 1 && notParsed[0] === '?') {
|
|
18597
|
+
return 'invalid';
|
|
18598
|
+
}
|
|
18599
|
+
// remove the initial ? if present
|
|
18600
|
+
const parsed = notParsed[0] === '?' ? notParsed.slice(1) : notParsed;
|
|
18601
|
+
const visibility = {};
|
|
18602
|
+
let exist = false;
|
|
18603
|
+
let visibleColumnsCount = 0;
|
|
18604
|
+
for (const item of parsed.split('&')) {
|
|
18605
|
+
// if it's not column visibility field, skip
|
|
18606
|
+
const fieldURL = item.split('=')[0];
|
|
18607
|
+
if (fieldURL !== '_columnVisibility') {
|
|
18608
|
+
continue;
|
|
18609
|
+
}
|
|
18610
|
+
// e.g. item = _columnVisibility[abc,def]
|
|
18611
|
+
const left = item.split(']')[0];
|
|
18612
|
+
if (left.split('[').length < 2) {
|
|
18613
|
+
continue;
|
|
18614
|
+
}
|
|
18615
|
+
const encodedValues = item.split('[')[1].split(']')[0];
|
|
18616
|
+
if (typeof encodedValues !== 'string') {
|
|
18617
|
+
continue;
|
|
18618
|
+
}
|
|
18619
|
+
exist = true;
|
|
18620
|
+
const columnFields = tableColumns.map(column => column.field);
|
|
18621
|
+
// TODO: Add validation that , is present
|
|
18622
|
+
const columns = encodedValues.split(',').map(value => decodeValue(value));
|
|
18623
|
+
|
|
18624
|
+
// for each column, check if it's visible and add it to visibility model
|
|
18625
|
+
for (const column of columnFields) {
|
|
18626
|
+
const isColumnVisible = columns.includes(column);
|
|
18627
|
+
visibility[column] = isColumnVisible;
|
|
18628
|
+
if (isColumnVisible) {
|
|
18629
|
+
visibleColumnsCount += 1;
|
|
18630
|
+
}
|
|
18631
|
+
}
|
|
18632
|
+
}
|
|
18633
|
+
if (visibleColumnsCount === 0 && !exist) {
|
|
18634
|
+
return 'invalid';
|
|
18635
|
+
}
|
|
18636
|
+
return visibility;
|
|
18637
|
+
};
|
|
18603
18638
|
|
|
18604
18639
|
// Rules:
|
|
18605
18640
|
// - if we have something in the URL, use that info
|
|
@@ -18660,8 +18695,8 @@ const getPinnedColumnsFromString = (notParsed, tableColumns) => {
|
|
|
18660
18695
|
if (typeof encodedValues !== 'string') {
|
|
18661
18696
|
continue;
|
|
18662
18697
|
}
|
|
18663
|
-
const
|
|
18664
|
-
const columns = encodedValues.split(',').map(value => decodeValue(value)).filter(val => typeof val === 'string' &&
|
|
18698
|
+
const columnFields = [...tableColumns.map(column => column.field), '__check__'];
|
|
18699
|
+
const columns = encodedValues.split(',').map(value => decodeValue(value)).filter(val => typeof val === 'string' && columnFields.includes(val));
|
|
18665
18700
|
if (fieldURL === '_pinnedColumnsLeft') {
|
|
18666
18701
|
pinnedColumns['left'] = columns;
|
|
18667
18702
|
}
|
|
@@ -18669,9 +18704,9 @@ const getPinnedColumnsFromString = (notParsed, tableColumns) => {
|
|
|
18669
18704
|
pinnedColumns['right'] = columns;
|
|
18670
18705
|
}
|
|
18671
18706
|
}
|
|
18672
|
-
return pinnedColumns
|
|
18673
|
-
left: pinnedColumns
|
|
18674
|
-
right: pinnedColumns
|
|
18707
|
+
return pinnedColumns['left'] || pinnedColumns['right'] ? {
|
|
18708
|
+
left: pinnedColumns['left'] || [],
|
|
18709
|
+
right: pinnedColumns['right'] || []
|
|
18675
18710
|
} : 'invalid';
|
|
18676
18711
|
};
|
|
18677
18712
|
const getSearchParamsFromPinnedColumns = pinnedColumns => {
|
|
@@ -18721,7 +18756,7 @@ const getSearchParamsFromTab = search => {
|
|
|
18721
18756
|
}
|
|
18722
18757
|
return searchParams;
|
|
18723
18758
|
};
|
|
18724
|
-
const getFinalSearch =
|
|
18759
|
+
const getFinalSearch = _ref3 => {
|
|
18725
18760
|
let {
|
|
18726
18761
|
search,
|
|
18727
18762
|
localStorageVersion,
|
|
@@ -18731,7 +18766,7 @@ const getFinalSearch = _ref => {
|
|
|
18731
18766
|
columnsVisibilityModel,
|
|
18732
18767
|
pinnedColumnsModel,
|
|
18733
18768
|
columns
|
|
18734
|
-
} =
|
|
18769
|
+
} = _ref3;
|
|
18735
18770
|
const filterModelSearch = getSearchParamsFromFilterModel(filterModel);
|
|
18736
18771
|
const sortModelSearch = getSearchParamsFromSorting(sortModel);
|
|
18737
18772
|
const paginationModelSearch = getSearchParamsFromPagination(paginationModel);
|
|
@@ -18796,14 +18831,14 @@ const getModelsParsedOrUpdateLocalStorage = (search, localStorageVersion, column
|
|
|
18796
18831
|
pinnedColumnsModel
|
|
18797
18832
|
};
|
|
18798
18833
|
};
|
|
18799
|
-
const updateUrl = (
|
|
18834
|
+
const updateUrl = (_ref4, search, localStorageVersion, historyReplace, columns) => {
|
|
18800
18835
|
let {
|
|
18801
18836
|
filterModel,
|
|
18802
18837
|
sortModel,
|
|
18803
18838
|
paginationModel,
|
|
18804
18839
|
columnsModel: columnsVisibilityModel,
|
|
18805
18840
|
pinnedColumnsModel
|
|
18806
|
-
} =
|
|
18841
|
+
} = _ref4;
|
|
18807
18842
|
const newSearch = getFinalSearch({
|
|
18808
18843
|
search,
|
|
18809
18844
|
localStorageVersion,
|
|
@@ -18824,17 +18859,17 @@ const updateUrl = (_ref2, search, localStorageVersion, historyReplace, columns)
|
|
|
18824
18859
|
// do not use it for equivalence (e.g. with value `3` and undefined we
|
|
18825
18860
|
// will get 0).
|
|
18826
18861
|
const compareFilters = (firstFilter, secondFilter) => {
|
|
18827
|
-
if (firstFilter.
|
|
18862
|
+
if (firstFilter.columnField < secondFilter.columnField) {
|
|
18828
18863
|
return -1;
|
|
18829
|
-
} else if (firstFilter.
|
|
18864
|
+
} else if (firstFilter.columnField > secondFilter.columnField) {
|
|
18830
18865
|
return 1;
|
|
18831
18866
|
}
|
|
18832
|
-
if (firstFilter.
|
|
18867
|
+
if (firstFilter.operatorValue === undefined || secondFilter.operatorValue === undefined) {
|
|
18833
18868
|
return 0;
|
|
18834
18869
|
}
|
|
18835
|
-
if (firstFilter.
|
|
18870
|
+
if (firstFilter.operatorValue < secondFilter.operatorValue) {
|
|
18836
18871
|
return -1;
|
|
18837
|
-
} else if (firstFilter.
|
|
18872
|
+
} else if (firstFilter.operatorValue > secondFilter.operatorValue) {
|
|
18838
18873
|
return 1;
|
|
18839
18874
|
}
|
|
18840
18875
|
if (firstFilter.value < secondFilter.value) {
|
|
@@ -18845,18 +18880,18 @@ const compareFilters = (firstFilter, secondFilter) => {
|
|
|
18845
18880
|
return 0;
|
|
18846
18881
|
};
|
|
18847
18882
|
const areFiltersEquivalent = (firstFilter, secondFilter) => {
|
|
18848
|
-
return firstFilter.
|
|
18883
|
+
return firstFilter.columnField === secondFilter.columnField && firstFilter.operatorValue === secondFilter.operatorValue && firstFilter.value === secondFilter.value;
|
|
18849
18884
|
};
|
|
18850
18885
|
const areFilterModelsEquivalent = (filterModel, filterModelToMatch) => {
|
|
18851
18886
|
const {
|
|
18852
18887
|
items,
|
|
18853
|
-
|
|
18888
|
+
linkOperator
|
|
18854
18889
|
} = filterModel;
|
|
18855
18890
|
const {
|
|
18856
18891
|
items: itemsToMatch,
|
|
18857
|
-
|
|
18892
|
+
linkOperator: linkOperatorToMatch
|
|
18858
18893
|
} = filterModelToMatch;
|
|
18859
|
-
if (
|
|
18894
|
+
if (linkOperator !== linkOperatorToMatch) {
|
|
18860
18895
|
return false;
|
|
18861
18896
|
}
|
|
18862
18897
|
if (items.length !== itemsToMatch.length) {
|
|
@@ -18869,7 +18904,7 @@ const areFilterModelsEquivalent = (filterModel, filterModelToMatch) => {
|
|
|
18869
18904
|
const filterToCompare = itemsToMatch[i];
|
|
18870
18905
|
|
|
18871
18906
|
// compareFilters return 0 if and only if the filters have the same
|
|
18872
|
-
//
|
|
18907
|
+
// columnField, operatorValue, and value
|
|
18873
18908
|
if (!areFiltersEquivalent(filter, filterToCompare)) {
|
|
18874
18909
|
return false;
|
|
18875
18910
|
}
|
|
@@ -24680,16 +24715,16 @@ const getRole = (config, dateFormat) => {
|
|
|
24680
24715
|
}).join('\n');
|
|
24681
24716
|
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.
|
|
24682
24717
|
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.
|
|
24683
|
-
The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "
|
|
24684
|
-
- "
|
|
24685
|
-
- "items": a list of conditions, each is an object with exactly the three keys "
|
|
24686
|
-
- "
|
|
24718
|
+
The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "linkOperator" and "items":
|
|
24719
|
+
- "linkOperator": the logical operator, only "and" or "or" are allowed. If there is only one condition in the "items", use "and".
|
|
24720
|
+
- "items": a list of conditions, each is an object with exactly the three keys "columnField", "operatorValue" and "value":
|
|
24721
|
+
- "columnField": the column name, must be one of ${columns}
|
|
24687
24722
|
- "value":
|
|
24688
|
-
- this can be skipped if the "
|
|
24689
|
-
- a list of multiple values if the "
|
|
24723
|
+
- this can be skipped if the "operatorValue" is either "isEmpty" or "isNotEmpty"
|
|
24724
|
+
- a list of multiple values if the "operatorValue" ends with "AnyOf"
|
|
24690
24725
|
- otherwise, it's a single value represented as a string: "true" instead of true, "false" instead of false, "0.6" instead of 0.6.
|
|
24691
24726
|
For "date" data type, use ${dateFormat}. If relative date is input, convert to the actual date given today is ${today}.
|
|
24692
|
-
- "
|
|
24727
|
+
- "operatorValue": the comparison operator, accepted values depend on the data type of the column
|
|
24693
24728
|
${operators}
|
|
24694
24729
|
|
|
24695
24730
|
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:
|
|
@@ -24726,10 +24761,10 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24726
24761
|
nlpFilterConfig,
|
|
24727
24762
|
onFilterModelChange,
|
|
24728
24763
|
dateFormat = 'yyyy-mm-dd',
|
|
24729
|
-
defaultModel = 'gpt-4-
|
|
24764
|
+
defaultModel = 'gpt-4-0613',
|
|
24730
24765
|
defaultFilter = {
|
|
24731
24766
|
items: [],
|
|
24732
|
-
|
|
24767
|
+
linkOperator: 'and'
|
|
24733
24768
|
},
|
|
24734
24769
|
disablePower = false,
|
|
24735
24770
|
localeText
|
|
@@ -24807,7 +24842,7 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24807
24842
|
value: prompt
|
|
24808
24843
|
}), /*#__PURE__*/React__default.createElement(Button, {
|
|
24809
24844
|
variant: "primary",
|
|
24810
|
-
"
|
|
24845
|
+
"aira-label": buttonAriaLabel,
|
|
24811
24846
|
type: "submit",
|
|
24812
24847
|
isLoading: isLoading
|
|
24813
24848
|
}, buttonText)), !disablePower && /*#__PURE__*/React__default.createElement(Tooltip, null, /*#__PURE__*/React__default.createElement(Tooltip.Trigger, null, /*#__PURE__*/React__default.createElement(Switch, {
|
|
@@ -24869,7 +24904,7 @@ const Toolbar$2 = props => {
|
|
|
24869
24904
|
let {
|
|
24870
24905
|
apiRef
|
|
24871
24906
|
} = _ref;
|
|
24872
|
-
return
|
|
24907
|
+
return gridVisibleSortedRowIdsSelector(apiRef);
|
|
24873
24908
|
}
|
|
24874
24909
|
},
|
|
24875
24910
|
printOptions: {
|
|
@@ -27103,10 +27138,12 @@ const ServerSideControlledPagination = _ref3 => {
|
|
|
27103
27138
|
selectionStatus,
|
|
27104
27139
|
displaySelection,
|
|
27105
27140
|
displayPagination,
|
|
27106
|
-
|
|
27107
|
-
|
|
27108
|
-
|
|
27141
|
+
page,
|
|
27142
|
+
onPageChange,
|
|
27143
|
+
pageSize,
|
|
27144
|
+
onPageSizeChange,
|
|
27109
27145
|
displayRowsPerPage,
|
|
27146
|
+
rowsPerPageOptions,
|
|
27110
27147
|
paginationProps,
|
|
27111
27148
|
rowCount
|
|
27112
27149
|
} = _ref3;
|
|
@@ -27125,17 +27162,13 @@ const ServerSideControlledPagination = _ref3 => {
|
|
|
27125
27162
|
}, totalRowsLabel) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$1({
|
|
27126
27163
|
component: "div",
|
|
27127
27164
|
count: totalNumberOfRowsInTable,
|
|
27128
|
-
page:
|
|
27129
|
-
onPageChange: (event,
|
|
27130
|
-
|
|
27131
|
-
|
|
27132
|
-
|
|
27133
|
-
|
|
27134
|
-
|
|
27135
|
-
page: paginationModel.page,
|
|
27136
|
-
pageSize: parseInt(event.target.value, 10)
|
|
27137
|
-
}),
|
|
27138
|
-
rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
|
|
27165
|
+
page: page,
|
|
27166
|
+
onPageChange: (event, newPage) => onPageChange(newPage),
|
|
27167
|
+
rowsPerPage: pageSize,
|
|
27168
|
+
onRowsPerPageChange: event => {
|
|
27169
|
+
onPageSizeChange(parseInt(event.target.value, 10));
|
|
27170
|
+
},
|
|
27171
|
+
rowsPerPageOptions: displayRowsPerPage ? rowsPerPageOptions : []
|
|
27139
27172
|
}, paginationProps)) : null);
|
|
27140
27173
|
};
|
|
27141
27174
|
|
|
@@ -27161,9 +27194,11 @@ const ControlledPagination = _ref3 => {
|
|
|
27161
27194
|
displayPagination = false,
|
|
27162
27195
|
selectionStatus,
|
|
27163
27196
|
apiRef,
|
|
27164
|
-
|
|
27165
|
-
|
|
27166
|
-
|
|
27197
|
+
page,
|
|
27198
|
+
onPageChange,
|
|
27199
|
+
pageSize,
|
|
27200
|
+
onPageSizeChange,
|
|
27201
|
+
rowsPerPageOptions,
|
|
27167
27202
|
isRowSelectable,
|
|
27168
27203
|
paginationProps
|
|
27169
27204
|
} = _ref3;
|
|
@@ -27193,25 +27228,17 @@ const ControlledPagination = _ref3 => {
|
|
|
27193
27228
|
}, `${selectionStatus.numberOfSelectedRows} row${selectionStatus.numberOfSelectedRows > 1 ? 's' : ''} selected`) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$1({
|
|
27194
27229
|
component: "div",
|
|
27195
27230
|
count: numberOfFilteredRowsInTable,
|
|
27196
|
-
page:
|
|
27197
|
-
onPageChange: (event,
|
|
27198
|
-
|
|
27199
|
-
page,
|
|
27200
|
-
pageSize: paginationModel.pageSize
|
|
27201
|
-
});
|
|
27202
|
-
},
|
|
27203
|
-
rowsPerPage: paginationModel.pageSize,
|
|
27231
|
+
page: page,
|
|
27232
|
+
onPageChange: (event, newPage) => onPageChange(newPage),
|
|
27233
|
+
rowsPerPage: pageSize,
|
|
27204
27234
|
onRowsPerPageChange: event => {
|
|
27205
|
-
|
|
27206
|
-
page: paginationModel.page,
|
|
27207
|
-
pageSize: parseInt(event.target.value, 10)
|
|
27208
|
-
});
|
|
27235
|
+
onPageSizeChange(parseInt(event.target.value, 10));
|
|
27209
27236
|
},
|
|
27210
|
-
rowsPerPageOptions: displayRowsPerPage ?
|
|
27237
|
+
rowsPerPageOptions: displayRowsPerPage ? rowsPerPageOptions : []
|
|
27211
27238
|
}, paginationProps)) : null);
|
|
27212
27239
|
};
|
|
27213
27240
|
|
|
27214
|
-
const _excluded$3 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "
|
|
27241
|
+
const _excluded$3 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "page", "onPageChange", "pageSize", "onPageSizeChange", "rowsPerPageOptions", "paginationProps", "paginationMode", "rowCount"];
|
|
27215
27242
|
const ToolbarWrapper = _ref => {
|
|
27216
27243
|
let {
|
|
27217
27244
|
hideToolbar,
|
|
@@ -27223,9 +27250,11 @@ const ToolbarWrapper = _ref => {
|
|
|
27223
27250
|
selectionStatus,
|
|
27224
27251
|
apiRef,
|
|
27225
27252
|
isRowSelectable,
|
|
27226
|
-
|
|
27227
|
-
|
|
27228
|
-
|
|
27253
|
+
page,
|
|
27254
|
+
onPageChange,
|
|
27255
|
+
pageSize,
|
|
27256
|
+
onPageSizeChange,
|
|
27257
|
+
rowsPerPageOptions,
|
|
27229
27258
|
paginationProps,
|
|
27230
27259
|
paginationMode = 'client',
|
|
27231
27260
|
rowCount
|
|
@@ -27239,9 +27268,11 @@ const ToolbarWrapper = _ref => {
|
|
|
27239
27268
|
displayRowsPerPage: false,
|
|
27240
27269
|
displayPagination: ['top', 'both'].includes(paginationPlacement),
|
|
27241
27270
|
selectionStatus: selectionStatus.current,
|
|
27242
|
-
|
|
27243
|
-
|
|
27244
|
-
|
|
27271
|
+
page: page,
|
|
27272
|
+
onPageChange: onPageChange,
|
|
27273
|
+
pageSize: pageSize,
|
|
27274
|
+
onPageSizeChange: onPageSizeChange,
|
|
27275
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
27245
27276
|
paginationProps: paginationProps,
|
|
27246
27277
|
rowCount: rowCount
|
|
27247
27278
|
}) : /*#__PURE__*/React__default.createElement(ControlledPagination, {
|
|
@@ -27251,26 +27282,30 @@ const ToolbarWrapper = _ref => {
|
|
|
27251
27282
|
selectionStatus: selectionStatus.current,
|
|
27252
27283
|
apiRef: apiRef,
|
|
27253
27284
|
isRowSelectable: isRowSelectable,
|
|
27254
|
-
|
|
27255
|
-
|
|
27256
|
-
|
|
27285
|
+
page: page,
|
|
27286
|
+
onPageChange: onPageChange,
|
|
27287
|
+
pageSize: pageSize,
|
|
27288
|
+
onPageSizeChange: onPageSizeChange,
|
|
27289
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
27257
27290
|
paginationProps: paginationProps
|
|
27258
27291
|
}) : null);
|
|
27259
27292
|
};
|
|
27260
27293
|
|
|
27261
27294
|
const useControlledDatagridState = _ref => {
|
|
27262
|
-
var
|
|
27295
|
+
var _initialState$paginat, _initialState$paginat2;
|
|
27263
27296
|
let {
|
|
27264
27297
|
initialState,
|
|
27265
|
-
|
|
27298
|
+
rowsPerPageOptions,
|
|
27266
27299
|
propsColumnVisibilityModel,
|
|
27267
27300
|
propsFilterModel,
|
|
27268
27301
|
propsOnColumnVisibilityModelChange,
|
|
27269
27302
|
propsOnFilterModelChange,
|
|
27270
|
-
|
|
27303
|
+
propsOnPageChange,
|
|
27304
|
+
propsOnPageSizeChange,
|
|
27271
27305
|
propsOnPinnedColumnsChange,
|
|
27272
27306
|
propsOnSortModelChange,
|
|
27273
|
-
|
|
27307
|
+
propsPage,
|
|
27308
|
+
propsPageSize,
|
|
27274
27309
|
propsPinnedColumns,
|
|
27275
27310
|
propsSortModel
|
|
27276
27311
|
} = _ref;
|
|
@@ -27318,22 +27353,33 @@ const useControlledDatagridState = _ref => {
|
|
|
27318
27353
|
setSortModel(model);
|
|
27319
27354
|
}
|
|
27320
27355
|
};
|
|
27321
|
-
const [
|
|
27322
|
-
|
|
27323
|
-
|
|
27324
|
-
|
|
27325
|
-
|
|
27326
|
-
|
|
27327
|
-
|
|
27356
|
+
const [page, setPage] = useState((initialState === null || initialState === void 0 ? void 0 : (_initialState$paginat = initialState.pagination) === null || _initialState$paginat === void 0 ? void 0 : _initialState$paginat.page) || propsPage || 0);
|
|
27357
|
+
const [pageSize, setPageSize] = 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]) || 25);
|
|
27358
|
+
const onPageChange = page => {
|
|
27359
|
+
if (propsOnPageChange) {
|
|
27360
|
+
propsOnPageChange(page, undefined);
|
|
27361
|
+
} else {
|
|
27362
|
+
setPage(page);
|
|
27363
|
+
}
|
|
27364
|
+
};
|
|
27365
|
+
useEffect(() => {
|
|
27366
|
+
if (propsPage || propsPage === 0) {
|
|
27367
|
+
setPage(propsPage);
|
|
27368
|
+
}
|
|
27369
|
+
}, [propsPage]);
|
|
27370
|
+
const onPageSizeChange = pageSize => {
|
|
27371
|
+
onPageChange(0);
|
|
27372
|
+
if (propsOnPageSizeChange) {
|
|
27373
|
+
propsOnPageSizeChange(pageSize, undefined);
|
|
27328
27374
|
} else {
|
|
27329
|
-
|
|
27375
|
+
setPageSize(pageSize);
|
|
27330
27376
|
}
|
|
27331
27377
|
};
|
|
27332
27378
|
useEffect(() => {
|
|
27333
|
-
if (
|
|
27334
|
-
|
|
27379
|
+
if (propsPageSize) {
|
|
27380
|
+
setPageSize(propsPageSize);
|
|
27335
27381
|
}
|
|
27336
|
-
}, [
|
|
27382
|
+
}, [propsPageSize]);
|
|
27337
27383
|
return {
|
|
27338
27384
|
filterModel,
|
|
27339
27385
|
onFilterModelChange,
|
|
@@ -27343,12 +27389,14 @@ const useControlledDatagridState = _ref => {
|
|
|
27343
27389
|
onPinnedColumnsChange,
|
|
27344
27390
|
sortModel,
|
|
27345
27391
|
onSortModelChange,
|
|
27346
|
-
|
|
27347
|
-
|
|
27392
|
+
page,
|
|
27393
|
+
pageSize,
|
|
27394
|
+
onPageChange,
|
|
27395
|
+
onPageSizeChange
|
|
27348
27396
|
};
|
|
27349
27397
|
};
|
|
27350
27398
|
|
|
27351
|
-
const _excluded$2 = ["apiRef", "autoHeight", "className", "
|
|
27399
|
+
const _excluded$2 = ["apiRef", "autoHeight", "className", "columnTypes", "components", "componentsProps", "filterModel", "columnVisibilityModel", "pinnedColumns", "sortModel", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "onFilterModelChange", "onPageChange", "onPageSizeChange", "onColumnVisibilityModelChange", "onPinnedColumnsChange", "onSortModelChange", "selectionModel", "onSelectionModelChange", "page", "pageSize", "pagination", "paginationPlacement", "paginationProps", "rows", "rowsPerPageOptions", "sx", "theme", "paginationMode", "rowCount"];
|
|
27352
27400
|
const COMPONENT_NAME$2 = 'DataGrid';
|
|
27353
27401
|
const CLASSNAME$2 = 'redsift-datagrid';
|
|
27354
27402
|
const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
@@ -27357,30 +27405,33 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27357
27405
|
apiRef: propsApiRef,
|
|
27358
27406
|
autoHeight,
|
|
27359
27407
|
className,
|
|
27360
|
-
|
|
27361
|
-
|
|
27408
|
+
columnTypes: propsColumnTypes,
|
|
27409
|
+
components,
|
|
27410
|
+
componentsProps,
|
|
27362
27411
|
filterModel: propsFilterModel,
|
|
27363
27412
|
columnVisibilityModel: propsColumnVisibilityModel,
|
|
27364
27413
|
pinnedColumns: propsPinnedColumns,
|
|
27365
27414
|
sortModel: propsSortModel,
|
|
27366
|
-
paginationModel: propsPaginationModel,
|
|
27367
27415
|
height: propsHeight,
|
|
27368
27416
|
hideToolbar,
|
|
27369
27417
|
initialState,
|
|
27370
27418
|
isRowSelectable,
|
|
27371
27419
|
license = process.env.MUI_LICENSE_KEY,
|
|
27372
27420
|
onFilterModelChange: propsOnFilterModelChange,
|
|
27373
|
-
|
|
27374
|
-
|
|
27375
|
-
onRowSelectionModelChange: propsOnRowSelectionModelChange,
|
|
27421
|
+
onPageChange: propsOnPageChange,
|
|
27422
|
+
onPageSizeChange: propsOnPageSizeChange,
|
|
27376
27423
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
27377
27424
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
27378
27425
|
onSortModelChange: propsOnSortModelChange,
|
|
27426
|
+
selectionModel: propsSelectionModel,
|
|
27427
|
+
onSelectionModelChange: propsOnSelectionModelChange,
|
|
27428
|
+
page: propsPage,
|
|
27429
|
+
pageSize: propsPageSize,
|
|
27379
27430
|
pagination,
|
|
27380
27431
|
paginationPlacement = 'both',
|
|
27381
27432
|
paginationProps,
|
|
27382
27433
|
rows,
|
|
27383
|
-
|
|
27434
|
+
rowsPerPageOptions,
|
|
27384
27435
|
sx,
|
|
27385
27436
|
theme: propsTheme,
|
|
27386
27437
|
paginationMode = 'client',
|
|
@@ -27390,7 +27441,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27390
27441
|
const theme = useTheme$4(propsTheme);
|
|
27391
27442
|
const _apiRef = useGridApiRef();
|
|
27392
27443
|
const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
|
|
27393
|
-
const RenderedToolbar =
|
|
27444
|
+
const RenderedToolbar = components !== null && components !== void 0 && components.Toolbar ? components.Toolbar : Toolbar$2;
|
|
27394
27445
|
LicenseInfo.setLicenseKey(license);
|
|
27395
27446
|
const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
|
|
27396
27447
|
const {
|
|
@@ -27398,52 +27449,56 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27398
27449
|
filterModel,
|
|
27399
27450
|
onColumnVisibilityModelChange,
|
|
27400
27451
|
onFilterModelChange,
|
|
27401
|
-
|
|
27452
|
+
onPageChange,
|
|
27453
|
+
onPageSizeChange,
|
|
27402
27454
|
onPinnedColumnsChange,
|
|
27403
27455
|
onSortModelChange,
|
|
27404
|
-
|
|
27456
|
+
page,
|
|
27457
|
+
pageSize,
|
|
27405
27458
|
pinnedColumns,
|
|
27406
27459
|
sortModel
|
|
27407
27460
|
} = useControlledDatagridState({
|
|
27408
27461
|
initialState,
|
|
27409
|
-
|
|
27462
|
+
rowsPerPageOptions,
|
|
27410
27463
|
propsColumnVisibilityModel,
|
|
27411
27464
|
propsFilterModel,
|
|
27412
27465
|
propsOnColumnVisibilityModelChange,
|
|
27413
27466
|
propsOnFilterModelChange,
|
|
27414
27467
|
propsOnPinnedColumnsChange,
|
|
27415
27468
|
propsOnSortModelChange,
|
|
27416
|
-
|
|
27469
|
+
propsPage,
|
|
27470
|
+
propsPageSize,
|
|
27417
27471
|
propsPinnedColumns,
|
|
27418
27472
|
propsSortModel,
|
|
27419
|
-
|
|
27473
|
+
propsOnPageChange,
|
|
27474
|
+
propsOnPageSizeChange
|
|
27420
27475
|
});
|
|
27421
|
-
const [
|
|
27476
|
+
const [selectionModel, setSelectionModel] = useState(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
|
|
27422
27477
|
useEffect(() => {
|
|
27423
|
-
|
|
27424
|
-
}, [
|
|
27425
|
-
const
|
|
27426
|
-
if (
|
|
27427
|
-
|
|
27478
|
+
setSelectionModel(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
|
|
27479
|
+
}, [propsSelectionModel]);
|
|
27480
|
+
const onSelectionModelChange = (selectionModel, details) => {
|
|
27481
|
+
if (propsOnSelectionModelChange) {
|
|
27482
|
+
propsOnSelectionModelChange(selectionModel, details);
|
|
27428
27483
|
} else {
|
|
27429
|
-
|
|
27484
|
+
setSelectionModel(selectionModel);
|
|
27430
27485
|
}
|
|
27431
27486
|
};
|
|
27432
27487
|
const selectionStatus = useRef({
|
|
27433
27488
|
type: 'none',
|
|
27434
27489
|
numberOfSelectedRows: 0,
|
|
27435
27490
|
numberOfSelectedRowsInPage: 0,
|
|
27436
|
-
page
|
|
27437
|
-
pageSize
|
|
27491
|
+
page,
|
|
27492
|
+
pageSize
|
|
27438
27493
|
});
|
|
27439
27494
|
|
|
27440
27495
|
// in server-side pagination we want to update the selection status
|
|
27441
27496
|
// every time we navigate between pages, resize our page or select something
|
|
27442
27497
|
useEffect(() => {
|
|
27443
27498
|
if (paginationMode == 'server') {
|
|
27444
|
-
onServerSideSelectionStatusChange(Array.isArray(
|
|
27499
|
+
onServerSideSelectionStatusChange(Array.isArray(selectionModel) ? selectionModel : [selectionModel], apiRef, selectionStatus, isRowSelectable, page, pageSize);
|
|
27445
27500
|
}
|
|
27446
|
-
}, [
|
|
27501
|
+
}, [selectionModel, page, pageSize]);
|
|
27447
27502
|
if (!Array.isArray(rows)) {
|
|
27448
27503
|
return null;
|
|
27449
27504
|
}
|
|
@@ -27474,54 +27529,57 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27474
27529
|
apiRef: apiRef,
|
|
27475
27530
|
autoHeight: autoHeight,
|
|
27476
27531
|
checkboxSelectionVisibleOnly: Boolean(pagination),
|
|
27477
|
-
|
|
27478
|
-
|
|
27479
|
-
|
|
27480
|
-
|
|
27481
|
-
|
|
27482
|
-
|
|
27532
|
+
columnTypes: _objectSpread2(_objectSpread2({}, customColumnTypes), propsColumnTypes),
|
|
27533
|
+
components: _objectSpread2(_objectSpread2({
|
|
27534
|
+
BaseButton,
|
|
27535
|
+
BaseCheckbox,
|
|
27536
|
+
// BaseTextField,
|
|
27537
|
+
BasePopper,
|
|
27538
|
+
ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27483
27539
|
displayName: "ColumnFilteredIcon"
|
|
27484
27540
|
})),
|
|
27485
|
-
|
|
27541
|
+
ColumnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27486
27542
|
displayName: "ColumnSelectorIcon"
|
|
27487
27543
|
})),
|
|
27488
|
-
|
|
27544
|
+
ColumnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27489
27545
|
displayName: "ColumnSortedAscendingIcon"
|
|
27490
27546
|
})),
|
|
27491
|
-
|
|
27547
|
+
ColumnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27492
27548
|
displayName: "ColumnSortedDescendingIcon"
|
|
27493
27549
|
})),
|
|
27494
|
-
|
|
27550
|
+
DensityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27495
27551
|
displayName: "DensityCompactIcon"
|
|
27496
27552
|
})),
|
|
27497
|
-
|
|
27553
|
+
DensityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27498
27554
|
displayName: "DensityStandardIcon"
|
|
27499
27555
|
})),
|
|
27500
|
-
|
|
27556
|
+
DensityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27501
27557
|
displayName: "DensityComfortableIcon"
|
|
27502
27558
|
})),
|
|
27503
|
-
|
|
27559
|
+
DetailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27504
27560
|
displayName: "DetailPanelCollapseIcon"
|
|
27505
27561
|
})),
|
|
27506
|
-
|
|
27562
|
+
DetailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27507
27563
|
displayName: "DetailPanelExpandIcon"
|
|
27508
27564
|
})),
|
|
27509
|
-
|
|
27565
|
+
ExportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27510
27566
|
displayName: "ExportIcon"
|
|
27511
27567
|
})),
|
|
27512
|
-
|
|
27568
|
+
OpenFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
|
|
27513
27569
|
displayName: "OpenFilterButtonIcon"
|
|
27514
27570
|
}, props))
|
|
27515
|
-
},
|
|
27516
|
-
|
|
27517
|
-
|
|
27571
|
+
}, components), {}, {
|
|
27572
|
+
Toolbar: ToolbarWrapper,
|
|
27573
|
+
Pagination: props => pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$1({}, props, {
|
|
27518
27574
|
displaySelection: false,
|
|
27519
27575
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
27520
27576
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
27521
27577
|
selectionStatus: selectionStatus.current,
|
|
27522
|
-
|
|
27523
|
-
|
|
27524
|
-
|
|
27578
|
+
page: page,
|
|
27579
|
+
onPageChange: onPageChange,
|
|
27580
|
+
pageSize: pageSize,
|
|
27581
|
+
onPageSizeChange: onPageSizeChange,
|
|
27582
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
27525
27583
|
paginationProps: paginationProps,
|
|
27526
27584
|
paginationMode: paginationMode,
|
|
27527
27585
|
rowCount: rowCount
|
|
@@ -27532,14 +27590,16 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27532
27590
|
selectionStatus: selectionStatus.current,
|
|
27533
27591
|
apiRef: apiRef,
|
|
27534
27592
|
isRowSelectable: isRowSelectable,
|
|
27535
|
-
|
|
27536
|
-
|
|
27537
|
-
|
|
27593
|
+
page: page,
|
|
27594
|
+
onPageChange: onPageChange,
|
|
27595
|
+
pageSize: pageSize,
|
|
27596
|
+
onPageSizeChange: onPageSizeChange,
|
|
27597
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
27538
27598
|
paginationProps: paginationProps,
|
|
27539
27599
|
paginationMode: paginationMode
|
|
27540
27600
|
})) : null
|
|
27541
27601
|
}),
|
|
27542
|
-
|
|
27602
|
+
componentsProps: _objectSpread2(_objectSpread2({}, componentsProps), {}, {
|
|
27543
27603
|
toolbar: _objectSpread2({
|
|
27544
27604
|
hideToolbar,
|
|
27545
27605
|
RenderedToolbar,
|
|
@@ -27550,13 +27610,15 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27550
27610
|
selectionStatus,
|
|
27551
27611
|
apiRef,
|
|
27552
27612
|
isRowSelectable,
|
|
27553
|
-
|
|
27554
|
-
|
|
27555
|
-
|
|
27613
|
+
page,
|
|
27614
|
+
onPageChange,
|
|
27615
|
+
pageSize,
|
|
27616
|
+
onPageSizeChange,
|
|
27617
|
+
rowsPerPageOptions,
|
|
27556
27618
|
paginationProps,
|
|
27557
27619
|
paginationMode,
|
|
27558
27620
|
rowCount
|
|
27559
|
-
},
|
|
27621
|
+
}, componentsProps === null || componentsProps === void 0 ? void 0 : componentsProps.toolbar)
|
|
27560
27622
|
}),
|
|
27561
27623
|
filterModel: filterModel,
|
|
27562
27624
|
columnVisibilityModel: columnVisibilityModel,
|
|
@@ -27572,11 +27634,13 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27572
27634
|
paginationMode: paginationMode,
|
|
27573
27635
|
keepNonExistentRowsSelected: paginationMode == 'server',
|
|
27574
27636
|
rows: rows,
|
|
27575
|
-
|
|
27576
|
-
|
|
27577
|
-
|
|
27578
|
-
|
|
27579
|
-
|
|
27637
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
27638
|
+
page: page,
|
|
27639
|
+
onPageChange: onPageChange,
|
|
27640
|
+
pageSize: pageSize,
|
|
27641
|
+
onPageSizeChange: onPageSizeChange,
|
|
27642
|
+
selectionModel: selectionModel,
|
|
27643
|
+
onSelectionModelChange: (newSelectionModel, details) => {
|
|
27580
27644
|
if (pagination && paginationMode != 'server') {
|
|
27581
27645
|
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
|
|
27582
27646
|
let {
|
|
@@ -27634,7 +27698,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27634
27698
|
};
|
|
27635
27699
|
}
|
|
27636
27700
|
}
|
|
27637
|
-
|
|
27701
|
+
onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(newSelectionModel, details);
|
|
27638
27702
|
},
|
|
27639
27703
|
sx: _objectSpread2(_objectSpread2({}, sx), {}, {
|
|
27640
27704
|
'.MuiDataGrid-columnHeaders': {
|
|
@@ -27651,6 +27715,8 @@ DataGrid.className = CLASSNAME$2;
|
|
|
27651
27715
|
DataGrid.displayName = COMPONENT_NAME$2;
|
|
27652
27716
|
|
|
27653
27717
|
// Get and Set data from LocalStorage WITHOUT useState
|
|
27718
|
+
|
|
27719
|
+
// triggering a state update and consecutive re-render
|
|
27654
27720
|
const useFetchState = (defaultValue, key) => {
|
|
27655
27721
|
let stickyValue = null;
|
|
27656
27722
|
try {
|
|
@@ -27658,7 +27724,16 @@ const useFetchState = (defaultValue, key) => {
|
|
|
27658
27724
|
} catch (e) {
|
|
27659
27725
|
console.error('StatefulDataGrid: error getting item from local storage: ', e);
|
|
27660
27726
|
}
|
|
27661
|
-
|
|
27727
|
+
let parsedValue = stickyValue !== null && stickyValue !== undefined && stickyValue !== 'undefined' ? JSON.parse(stickyValue) : defaultValue;
|
|
27728
|
+
|
|
27729
|
+
// TODO: temporary workaround to avoid clashes when someone had sorting on the now-removed screenshot field (renamed to num_annotations)
|
|
27730
|
+
// Consider upgrading the Datagrid component library as the exception handling was added in this PR: https://github.com/mui-org/material-ui-x/pull/3224
|
|
27731
|
+
if (parsedValue instanceof Array) {
|
|
27732
|
+
const fields = (parsedValue || []).map(item => item.field);
|
|
27733
|
+
if (fields.includes('screenshot') || fields.includes('diffs')) {
|
|
27734
|
+
parsedValue = defaultValue;
|
|
27735
|
+
}
|
|
27736
|
+
}
|
|
27662
27737
|
const updateValue = useCallback(value => {
|
|
27663
27738
|
try {
|
|
27664
27739
|
window.localStorage.setItem(key, JSON.stringify(value));
|
|
@@ -27669,8 +27744,6 @@ const useFetchState = (defaultValue, key) => {
|
|
|
27669
27744
|
return [parsedValue, updateValue];
|
|
27670
27745
|
};
|
|
27671
27746
|
|
|
27672
|
-
// import useLocalStorage from './useLocalStorage';
|
|
27673
|
-
|
|
27674
27747
|
const useTableStates = (id, version) => {
|
|
27675
27748
|
const [paginationModel, setPaginationModel] = useFetchState('', buildStorageKey({
|
|
27676
27749
|
id,
|
|
@@ -27727,7 +27800,8 @@ const useStatefulTable = props => {
|
|
|
27727
27800
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
27728
27801
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
27729
27802
|
onFilterModelChange: propsOnFilterModelChange,
|
|
27730
|
-
|
|
27803
|
+
onPageChange: propsOnPageChange,
|
|
27804
|
+
onPageSizeChange: propsOnPageSizeChange,
|
|
27731
27805
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
27732
27806
|
onSortModelChange: propsOnSortModelChange,
|
|
27733
27807
|
useRouter,
|
|
@@ -27757,7 +27831,7 @@ const useStatefulTable = props => {
|
|
|
27757
27831
|
setDimensionModel
|
|
27758
27832
|
} = useTableStates(id, localStorageVersion);
|
|
27759
27833
|
|
|
27760
|
-
// clearing up old version keys
|
|
27834
|
+
// clearing up old version keys
|
|
27761
27835
|
useEffect(() => clearPreviousVersionStorage(id, previousLocalStorageVersions), [id, previousLocalStorageVersions]);
|
|
27762
27836
|
const onColumnDimensionChange = useCallback(_ref => {
|
|
27763
27837
|
let {
|
|
@@ -27790,6 +27864,7 @@ const useStatefulTable = props => {
|
|
|
27790
27864
|
column.width = dimensionModel[column.field] || column.width || 100;
|
|
27791
27865
|
return column;
|
|
27792
27866
|
}), [propsColumns, dimensionModel]);
|
|
27867
|
+
|
|
27793
27868
|
/** Add resetPage method to apiRef. */
|
|
27794
27869
|
apiRef.current.resetPage = () => {
|
|
27795
27870
|
apiRef.current.setPage(0);
|
|
@@ -27800,7 +27875,7 @@ const useStatefulTable = props => {
|
|
|
27800
27875
|
onFilterModelChange: (model, details) => {
|
|
27801
27876
|
const filterModel = _objectSpread2(_objectSpread2({}, model), {}, {
|
|
27802
27877
|
items: model.items.map(item => {
|
|
27803
|
-
const column = apiRef.current.getColumn(item.
|
|
27878
|
+
const column = apiRef.current.getColumn(item.columnField);
|
|
27804
27879
|
item.type = column.type || 'string';
|
|
27805
27880
|
return item;
|
|
27806
27881
|
}),
|
|
@@ -27838,16 +27913,33 @@ const useStatefulTable = props => {
|
|
|
27838
27913
|
}, search, localStorageVersion, historyReplace, columns);
|
|
27839
27914
|
},
|
|
27840
27915
|
pinnedColumns: pinnedColumnsModel,
|
|
27841
|
-
|
|
27842
|
-
|
|
27843
|
-
|
|
27844
|
-
|
|
27845
|
-
|
|
27846
|
-
propsOnPaginationModelChange === null || propsOnPaginationModelChange === void 0 ? void 0 : propsOnPaginationModelChange(paginationModel, details);
|
|
27916
|
+
page: paginationModelParsed.page,
|
|
27917
|
+
pageSize: paginationModelParsed.pageSize,
|
|
27918
|
+
onPageChange: (page, details) => {
|
|
27919
|
+
const direction = paginationModelParsed.page < page ? 'next' : 'back';
|
|
27920
|
+
propsOnPageChange === null || propsOnPageChange === void 0 ? void 0 : propsOnPageChange(page, details);
|
|
27847
27921
|
updateUrl({
|
|
27848
27922
|
filterModel: filterParsed,
|
|
27849
27923
|
sortModel: sortModelParsed,
|
|
27850
|
-
paginationModel:
|
|
27924
|
+
paginationModel: {
|
|
27925
|
+
page,
|
|
27926
|
+
pageSize: paginationModelParsed.pageSize,
|
|
27927
|
+
direction
|
|
27928
|
+
},
|
|
27929
|
+
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
27930
|
+
pinnedColumnsModel: pinnedColumnsModel
|
|
27931
|
+
}, search, localStorageVersion, historyReplace, columns);
|
|
27932
|
+
},
|
|
27933
|
+
onPageSizeChange: (pageSize, details) => {
|
|
27934
|
+
propsOnPageSizeChange === null || propsOnPageSizeChange === void 0 ? void 0 : propsOnPageSizeChange(pageSize, details);
|
|
27935
|
+
updateUrl({
|
|
27936
|
+
filterModel: filterParsed,
|
|
27937
|
+
sortModel: sortModelParsed,
|
|
27938
|
+
paginationModel: {
|
|
27939
|
+
page: paginationModelParsed.page,
|
|
27940
|
+
pageSize,
|
|
27941
|
+
direction: paginationModelParsed.direction
|
|
27942
|
+
},
|
|
27851
27943
|
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
27852
27944
|
pinnedColumnsModel: pinnedColumnsModel
|
|
27853
27945
|
}, search, localStorageVersion, historyReplace, columns);
|
|
@@ -27873,7 +27965,7 @@ const useStatefulTable = props => {
|
|
|
27873
27965
|
};
|
|
27874
27966
|
};
|
|
27875
27967
|
|
|
27876
|
-
const _excluded$1 = ["apiRef", "autoHeight", "className", "columns", "
|
|
27968
|
+
const _excluded$1 = ["apiRef", "autoHeight", "className", "columns", "columnTypes", "components", "componentsProps", "filterModel", "columnVisibilityModel", "pinnedColumns", "sortModel", "page", "pageSize", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "localStorageVersion", "previousLocalStorageVersions", "onFilterModelChange", "selectionModel", "onColumnWidthChange", "onPageChange", "onPageSizeChange", "onSelectionModelChange", "onColumnVisibilityModelChange", "onPinnedColumnsChange", "onSortModelChange", "pagination", "paginationPlacement", "paginationProps", "rows", "rowsPerPageOptions", "sx", "theme", "useRouter", "paginationMode", "rowCount"];
|
|
27877
27969
|
const COMPONENT_NAME$1 = 'DataGrid';
|
|
27878
27970
|
const CLASSNAME$1 = 'redsift-datagrid';
|
|
27879
27971
|
const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
@@ -27883,13 +27975,15 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27883
27975
|
autoHeight,
|
|
27884
27976
|
className,
|
|
27885
27977
|
columns,
|
|
27886
|
-
|
|
27887
|
-
|
|
27978
|
+
columnTypes: propsColumnTypes,
|
|
27979
|
+
components,
|
|
27980
|
+
componentsProps,
|
|
27888
27981
|
filterModel: propsFilterModel,
|
|
27889
27982
|
columnVisibilityModel: propsColumnVisibilityModel,
|
|
27890
27983
|
pinnedColumns: propsPinnedColumns,
|
|
27891
27984
|
sortModel: propsSortModel,
|
|
27892
|
-
|
|
27985
|
+
page: propsPage,
|
|
27986
|
+
pageSize: propsPageSize,
|
|
27893
27987
|
height: propsHeight,
|
|
27894
27988
|
hideToolbar,
|
|
27895
27989
|
initialState,
|
|
@@ -27898,10 +27992,11 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27898
27992
|
localStorageVersion,
|
|
27899
27993
|
previousLocalStorageVersions,
|
|
27900
27994
|
onFilterModelChange: propsOnFilterModelChange,
|
|
27901
|
-
|
|
27995
|
+
selectionModel: propsSelectionModel,
|
|
27902
27996
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
27903
|
-
|
|
27904
|
-
|
|
27997
|
+
onPageChange: propsOnPageChange,
|
|
27998
|
+
onPageSizeChange: propsOnPageSizeChange,
|
|
27999
|
+
onSelectionModelChange: propsOnSelectionModelChange,
|
|
27905
28000
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
27906
28001
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
27907
28002
|
onSortModelChange: propsOnSortModelChange,
|
|
@@ -27909,7 +28004,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27909
28004
|
paginationPlacement = 'both',
|
|
27910
28005
|
paginationProps,
|
|
27911
28006
|
rows,
|
|
27912
|
-
|
|
28007
|
+
rowsPerPageOptions,
|
|
27913
28008
|
sx,
|
|
27914
28009
|
theme: propsTheme,
|
|
27915
28010
|
useRouter,
|
|
@@ -27920,38 +28015,43 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27920
28015
|
const theme = useTheme$4(propsTheme);
|
|
27921
28016
|
const _apiRef = useGridApiRef();
|
|
27922
28017
|
const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
|
|
27923
|
-
const RenderedToolbar =
|
|
28018
|
+
const RenderedToolbar = components !== null && components !== void 0 && components.Toolbar ? components.Toolbar : Toolbar$2;
|
|
27924
28019
|
LicenseInfo.setLicenseKey(license);
|
|
27925
28020
|
const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
|
|
27926
28021
|
const {
|
|
27927
28022
|
onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
|
|
27928
28023
|
onFilterModelChange: controlledOnFilterModelChange,
|
|
27929
|
-
|
|
28024
|
+
onPageChange: controlledOnPageChange,
|
|
28025
|
+
onPageSizeChange: controlledOnPageSizeChange,
|
|
27930
28026
|
onPinnedColumnsChange: controlledOnPinnedColumnsChange,
|
|
27931
28027
|
onSortModelChange: controlledOnSortModelChange
|
|
27932
28028
|
} = useControlledDatagridState({
|
|
27933
28029
|
initialState,
|
|
27934
|
-
|
|
28030
|
+
rowsPerPageOptions,
|
|
27935
28031
|
propsColumnVisibilityModel,
|
|
27936
28032
|
propsFilterModel,
|
|
27937
28033
|
propsOnColumnVisibilityModelChange,
|
|
27938
28034
|
propsOnFilterModelChange,
|
|
27939
28035
|
propsOnPinnedColumnsChange,
|
|
27940
28036
|
propsOnSortModelChange,
|
|
27941
|
-
|
|
28037
|
+
propsPage,
|
|
28038
|
+
propsPageSize,
|
|
27942
28039
|
propsPinnedColumns,
|
|
27943
28040
|
propsSortModel,
|
|
27944
|
-
|
|
28041
|
+
propsOnPageChange,
|
|
28042
|
+
propsOnPageSizeChange
|
|
27945
28043
|
});
|
|
27946
28044
|
const {
|
|
27947
28045
|
columnVisibilityModel,
|
|
27948
28046
|
filterModel,
|
|
27949
28047
|
onColumnVisibilityModelChange,
|
|
27950
28048
|
onFilterModelChange,
|
|
27951
|
-
|
|
28049
|
+
onPageChange,
|
|
28050
|
+
onPageSizeChange,
|
|
27952
28051
|
onPinnedColumnsChange,
|
|
27953
28052
|
onSortModelChange,
|
|
27954
|
-
|
|
28053
|
+
page,
|
|
28054
|
+
pageSize,
|
|
27955
28055
|
pinnedColumns,
|
|
27956
28056
|
sortModel,
|
|
27957
28057
|
onColumnWidthChange
|
|
@@ -27962,39 +28062,40 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27962
28062
|
onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
|
|
27963
28063
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
27964
28064
|
onFilterModelChange: controlledOnFilterModelChange,
|
|
27965
|
-
|
|
28065
|
+
onPageChange: controlledOnPageChange,
|
|
28066
|
+
onPageSizeChange: controlledOnPageSizeChange,
|
|
27966
28067
|
onPinnedColumnsChange: controlledOnPinnedColumnsChange,
|
|
27967
28068
|
onSortModelChange: controlledOnSortModelChange,
|
|
27968
28069
|
useRouter: useRouter,
|
|
27969
28070
|
localStorageVersion,
|
|
27970
28071
|
previousLocalStorageVersions
|
|
27971
28072
|
});
|
|
27972
|
-
const [
|
|
28073
|
+
const [selectionModel, setSelectionModel] = useState(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
|
|
27973
28074
|
useEffect(() => {
|
|
27974
|
-
|
|
27975
|
-
}, [
|
|
27976
|
-
const
|
|
27977
|
-
if (
|
|
27978
|
-
|
|
28075
|
+
setSelectionModel(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
|
|
28076
|
+
}, [propsSelectionModel]);
|
|
28077
|
+
const onSelectionModelChange = (selectionModel, details) => {
|
|
28078
|
+
if (propsOnSelectionModelChange) {
|
|
28079
|
+
propsOnSelectionModelChange(selectionModel, details);
|
|
27979
28080
|
} else {
|
|
27980
|
-
|
|
28081
|
+
setSelectionModel(selectionModel);
|
|
27981
28082
|
}
|
|
27982
28083
|
};
|
|
27983
28084
|
const selectionStatus = useRef({
|
|
27984
28085
|
type: 'none',
|
|
27985
28086
|
numberOfSelectedRows: 0,
|
|
27986
28087
|
numberOfSelectedRowsInPage: 0,
|
|
27987
|
-
page
|
|
27988
|
-
pageSize:
|
|
28088
|
+
page,
|
|
28089
|
+
pageSize: pageSize
|
|
27989
28090
|
});
|
|
27990
28091
|
|
|
27991
28092
|
// in server-side pagination we want to update the selection status
|
|
27992
28093
|
// every time we navigate between pages, resize our page or select something
|
|
27993
28094
|
useEffect(() => {
|
|
27994
28095
|
if (paginationMode == 'server') {
|
|
27995
|
-
onServerSideSelectionStatusChange(Array.isArray(
|
|
28096
|
+
onServerSideSelectionStatusChange(Array.isArray(selectionModel) ? selectionModel : [selectionModel], apiRef, selectionStatus, isRowSelectable, page, pageSize);
|
|
27996
28097
|
}
|
|
27997
|
-
}, [
|
|
28098
|
+
}, [selectionModel, page, pageSize]);
|
|
27998
28099
|
if (!Array.isArray(rows)) {
|
|
27999
28100
|
return null;
|
|
28000
28101
|
}
|
|
@@ -28027,13 +28128,15 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
28027
28128
|
filterModel: filterModel,
|
|
28028
28129
|
onColumnVisibilityModelChange: onColumnVisibilityModelChange,
|
|
28029
28130
|
onFilterModelChange: onFilterModelChange,
|
|
28030
|
-
|
|
28131
|
+
onPageChange: onPageChange,
|
|
28132
|
+
onPageSizeChange: onPageSizeChange,
|
|
28031
28133
|
onPinnedColumnsChange: onPinnedColumnsChange,
|
|
28032
28134
|
onSortModelChange: onSortModelChange,
|
|
28033
|
-
|
|
28135
|
+
page: page,
|
|
28136
|
+
pageSize: pageSize,
|
|
28034
28137
|
pinnedColumns: pinnedColumns,
|
|
28035
28138
|
sortModel: sortModel,
|
|
28036
|
-
|
|
28139
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
28037
28140
|
onColumnWidthChange: onColumnWidthChange,
|
|
28038
28141
|
initialState: initialState,
|
|
28039
28142
|
isRowSelectable: isRowSelectable,
|
|
@@ -28044,55 +28147,58 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
28044
28147
|
rowCount: rowCount,
|
|
28045
28148
|
autoHeight: autoHeight,
|
|
28046
28149
|
checkboxSelectionVisibleOnly: Boolean(pagination),
|
|
28047
|
-
|
|
28048
|
-
|
|
28049
|
-
|
|
28050
|
-
|
|
28051
|
-
|
|
28052
|
-
|
|
28150
|
+
columnTypes: _objectSpread2(_objectSpread2({}, customColumnTypes), propsColumnTypes),
|
|
28151
|
+
components: _objectSpread2(_objectSpread2({
|
|
28152
|
+
BaseButton,
|
|
28153
|
+
BaseCheckbox,
|
|
28154
|
+
// BaseTextField,
|
|
28155
|
+
BasePopper,
|
|
28156
|
+
ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
28053
28157
|
displayName: "ColumnFilteredIcon"
|
|
28054
28158
|
})),
|
|
28055
|
-
|
|
28159
|
+
ColumnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
28056
28160
|
displayName: "ColumnSelectorIcon"
|
|
28057
28161
|
})),
|
|
28058
|
-
|
|
28162
|
+
ColumnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
28059
28163
|
displayName: "ColumnSortedAscendingIcon"
|
|
28060
28164
|
})),
|
|
28061
|
-
|
|
28165
|
+
ColumnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
28062
28166
|
displayName: "ColumnSortedDescendingIcon"
|
|
28063
28167
|
})),
|
|
28064
|
-
|
|
28168
|
+
DensityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
28065
28169
|
displayName: "DensityCompactIcon"
|
|
28066
28170
|
})),
|
|
28067
|
-
|
|
28171
|
+
DensityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
28068
28172
|
displayName: "DensityStandardIcon"
|
|
28069
28173
|
})),
|
|
28070
|
-
|
|
28174
|
+
DensityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
28071
28175
|
displayName: "DensityComfortableIcon"
|
|
28072
28176
|
})),
|
|
28073
|
-
|
|
28177
|
+
DetailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
28074
28178
|
displayName: "DetailPanelCollapseIcon"
|
|
28075
28179
|
})),
|
|
28076
|
-
|
|
28180
|
+
DetailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
28077
28181
|
displayName: "DetailPanelExpandIcon"
|
|
28078
28182
|
})),
|
|
28079
|
-
|
|
28183
|
+
ExportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
28080
28184
|
displayName: "ExportIcon"
|
|
28081
28185
|
})),
|
|
28082
|
-
|
|
28186
|
+
OpenFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
|
|
28083
28187
|
displayName: "OpenFilterButtonIcon"
|
|
28084
28188
|
}, props))
|
|
28085
|
-
},
|
|
28086
|
-
|
|
28087
|
-
|
|
28189
|
+
}, components), {}, {
|
|
28190
|
+
Toolbar: ToolbarWrapper,
|
|
28191
|
+
Pagination: props => {
|
|
28088
28192
|
return pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$1({}, props, {
|
|
28089
28193
|
displaySelection: false,
|
|
28090
28194
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
28091
28195
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
28092
28196
|
selectionStatus: selectionStatus.current,
|
|
28093
|
-
|
|
28094
|
-
|
|
28095
|
-
|
|
28197
|
+
page: page,
|
|
28198
|
+
pageSize: pageSize,
|
|
28199
|
+
onPageChange: onPageChange,
|
|
28200
|
+
onPageSizeChange: onPageSizeChange,
|
|
28201
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
28096
28202
|
paginationProps: paginationProps,
|
|
28097
28203
|
paginationMode: paginationMode,
|
|
28098
28204
|
rowCount: rowCount
|
|
@@ -28103,15 +28209,17 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
28103
28209
|
selectionStatus: selectionStatus.current,
|
|
28104
28210
|
apiRef: apiRef,
|
|
28105
28211
|
isRowSelectable: isRowSelectable,
|
|
28106
|
-
|
|
28107
|
-
|
|
28108
|
-
|
|
28212
|
+
page: page,
|
|
28213
|
+
pageSize: pageSize,
|
|
28214
|
+
onPageChange: onPageChange,
|
|
28215
|
+
onPageSizeChange: onPageSizeChange,
|
|
28216
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
28109
28217
|
paginationProps: paginationProps,
|
|
28110
28218
|
paginationMode: paginationMode
|
|
28111
28219
|
})) : null;
|
|
28112
28220
|
}
|
|
28113
28221
|
}),
|
|
28114
|
-
|
|
28222
|
+
componentsProps: _objectSpread2(_objectSpread2({}, componentsProps), {}, {
|
|
28115
28223
|
toolbar: _objectSpread2({
|
|
28116
28224
|
hideToolbar,
|
|
28117
28225
|
RenderedToolbar,
|
|
@@ -28122,16 +28230,18 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
28122
28230
|
selectionStatus,
|
|
28123
28231
|
apiRef,
|
|
28124
28232
|
isRowSelectable,
|
|
28125
|
-
|
|
28126
|
-
|
|
28127
|
-
|
|
28233
|
+
page,
|
|
28234
|
+
pageSize,
|
|
28235
|
+
onPageChange,
|
|
28236
|
+
onPageSizeChange,
|
|
28237
|
+
rowsPerPageOptions,
|
|
28128
28238
|
paginationProps,
|
|
28129
28239
|
paginationMode,
|
|
28130
28240
|
rowCount
|
|
28131
|
-
},
|
|
28241
|
+
}, componentsProps === null || componentsProps === void 0 ? void 0 : componentsProps.toolbar)
|
|
28132
28242
|
}),
|
|
28133
|
-
|
|
28134
|
-
|
|
28243
|
+
selectionModel: selectionModel,
|
|
28244
|
+
onSelectionModelChange: (newSelectionModel, details) => {
|
|
28135
28245
|
if (pagination && paginationMode != 'server') {
|
|
28136
28246
|
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
|
|
28137
28247
|
let {
|
|
@@ -28189,7 +28299,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
28189
28299
|
};
|
|
28190
28300
|
}
|
|
28191
28301
|
}
|
|
28192
|
-
|
|
28302
|
+
onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(newSelectionModel, details);
|
|
28193
28303
|
},
|
|
28194
28304
|
sx: _objectSpread2(_objectSpread2({}, sx), {}, {
|
|
28195
28305
|
'.MuiDataGrid-columnHeaders': {
|
|
@@ -28263,5 +28373,5 @@ const TextCell = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
28263
28373
|
TextCell.className = CLASSNAME;
|
|
28264
28374
|
TextCell.displayName = COMPONENT_NAME;
|
|
28265
28375
|
|
|
28266
|
-
export { BaseButton, BaseCheckbox, BaseIcon, BasePopper, BaseTextField, CATEGORIES, CONTAINS_ANY_OF, CONTAINS_ANY_OF_I, ControlledPagination, DEFAULT_OPERATORS, DETAIL_PANEL_TOGGLE_COL_DEF, DIMENSION_MODEL_KEY, DOES_NOT_CONTAIN, DOES_NOT_EQUAL, DOES_NOT_HAVE, DOES_NOT_HAVE_WITH_SELECT, DataGrid, ENDS_WITH_ANY_OF, FILTER_MODEL_KEY, FILTER_SEARCH_KEY, GridToolbarFilterSemanticField, HAS, HAS_ANY_OF, HAS_ANY_OF_WITH_SELECT, HAS_ONLY, HAS_ONLY_WITH_SELECT, HAS_WITH_SELECT, IS, IS_ANY_OF, IS_ANY_OF_WITH_SELECT, IS_BETWEEN, IS_NOT, IS_NOT_ANY_OF,
|
|
28376
|
+
export { BaseButton, BaseCheckbox, BaseIcon, BasePopper, BaseTextField, CATEGORIES, CONTAINS_ANY_OF, CONTAINS_ANY_OF_I, ControlledPagination, DEFAULT_OPERATORS, DETAIL_PANEL_TOGGLE_COL_DEF, DIMENSION_MODEL_KEY, DOES_NOT_CONTAIN, DOES_NOT_EQUAL, DOES_NOT_HAVE, DOES_NOT_HAVE_WITH_SELECT, DataGrid, ENDS_WITH_ANY_OF, FILTER_MODEL_KEY, FILTER_SEARCH_KEY, GridToolbarFilterSemanticField, HAS, HAS_ANY_OF, HAS_ANY_OF_WITH_SELECT, HAS_ONLY, HAS_ONLY_WITH_SELECT, HAS_WITH_SELECT, IS, IS_ANY_OF, IS_ANY_OF_WITH_SELECT, IS_BETWEEN, IS_NOT, IS_NOT_ANY_OF, IS_NOT_WITH_SELECT, IS_WITH_SELECT, PAGINATION_MODEL_KEY, PINNED_COLUMNS, SORT_MODEL_KEY, STARTS_WITH_ANY_OF, ServerSideControlledPagination, StatefulDataGrid, TextCell, Toolbar$2 as Toolbar, ToolbarWrapper, VISIBILITY_MODEL_KEY, areFilterModelsEquivalent, buildStorageKey, clearPreviousVersionStorage, customColumnTypes, decodeValue, encodeValue, getColumnVisibilityFromString, getCompletion, getFilterModelFromString, getFinalSearch, getGridNumericOperators, getGridStringArrayOperators, getGridStringArrayOperatorsWithSelect, getGridStringArrayOperatorsWithSelectOnStringArrayColumns, getGridStringOperators, getModelsParsedOrUpdateLocalStorage, getPaginationFromString, getPinnedColumnsFromString, getRsMultipleSelectColumnType, getRsMultipleSelectWithShortOperatorListColumnType, getRsNumberColumnType, getRsSingleSelectColumnType, getRsSingleSelectWithShortOperatorListColumnType, getRsStringColumnType, getSearchParamsFromColumnVisibility, getSearchParamsFromFilterModel, getSearchParamsFromPagination, getSearchParamsFromPinnedColumns, getSearchParamsFromSorting, getSearchParamsFromTab, getSortingFromString, muiIconToDSIcon, numberOperatorDecoder, numberOperatorEncoder, onServerSideSelectionStatusChange, operatorList, updateUrl, urlSearchParamsToString };
|
|
28267
28377
|
//# sourceMappingURL=index.js.map
|