@redsift/table 11.3.2-alpha.2 → 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 +117 -76
- package/index.js +425 -309
- 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,10 +17764,13 @@ 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 => {
|
|
17771
|
+
if (Array.isArray(params.value)) {
|
|
17772
|
+
return false;
|
|
17773
|
+
}
|
|
17771
17774
|
return String(params.value) === filterItem.value;
|
|
17772
17775
|
};
|
|
17773
17776
|
},
|
|
@@ -17782,10 +17785,13 @@ const isNotOperator = {
|
|
|
17782
17785
|
label: 'is not',
|
|
17783
17786
|
value: 'isNot',
|
|
17784
17787
|
getApplyFilterFn: filterItem => {
|
|
17785
|
-
if (!filterItem.
|
|
17788
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17786
17789
|
return null;
|
|
17787
17790
|
}
|
|
17788
17791
|
return params => {
|
|
17792
|
+
if (Array.isArray(params.value)) {
|
|
17793
|
+
return true;
|
|
17794
|
+
}
|
|
17789
17795
|
return String(params.value) !== filterItem.value;
|
|
17790
17796
|
};
|
|
17791
17797
|
},
|
|
@@ -17800,7 +17806,7 @@ const containsAnyOfOperator = {
|
|
|
17800
17806
|
label: 'contains any of',
|
|
17801
17807
|
value: 'containsAnyOf',
|
|
17802
17808
|
getApplyFilterFn: filterItem => {
|
|
17803
|
-
if (!filterItem.
|
|
17809
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17804
17810
|
return null;
|
|
17805
17811
|
}
|
|
17806
17812
|
return params => {
|
|
@@ -17810,9 +17816,11 @@ const containsAnyOfOperator = {
|
|
|
17810
17816
|
const paramValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
17811
17817
|
let match = false;
|
|
17812
17818
|
filterItem.value.forEach(filteredValue => {
|
|
17813
|
-
|
|
17814
|
-
|
|
17815
|
-
|
|
17819
|
+
paramValues.forEach(paramValue => {
|
|
17820
|
+
if (String(paramValue).indexOf(filteredValue) !== -1) {
|
|
17821
|
+
match = true;
|
|
17822
|
+
}
|
|
17823
|
+
});
|
|
17816
17824
|
});
|
|
17817
17825
|
return match;
|
|
17818
17826
|
};
|
|
@@ -17823,7 +17831,7 @@ const containsAnyOfCIOperator = {
|
|
|
17823
17831
|
label: 'contains any of (case insensitive)',
|
|
17824
17832
|
value: 'containsAnyOf',
|
|
17825
17833
|
getApplyFilterFn: filterItem => {
|
|
17826
|
-
if (!filterItem.
|
|
17834
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17827
17835
|
return null;
|
|
17828
17836
|
}
|
|
17829
17837
|
return params => {
|
|
@@ -17850,7 +17858,7 @@ const endsWithAnyOfOperator = {
|
|
|
17850
17858
|
label: 'ends with any of',
|
|
17851
17859
|
value: 'endsWithAnyOf',
|
|
17852
17860
|
getApplyFilterFn: filterItem => {
|
|
17853
|
-
if (!filterItem.
|
|
17861
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17854
17862
|
return null;
|
|
17855
17863
|
}
|
|
17856
17864
|
return params => {
|
|
@@ -17877,7 +17885,7 @@ const isAnyOfOperator = {
|
|
|
17877
17885
|
label: 'is any of',
|
|
17878
17886
|
value: 'isAnyOf',
|
|
17879
17887
|
getApplyFilterFn: filterItem => {
|
|
17880
|
-
if (!filterItem.
|
|
17888
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17881
17889
|
return null;
|
|
17882
17890
|
}
|
|
17883
17891
|
return params => {
|
|
@@ -17904,7 +17912,7 @@ const hasAnyOfOperator = {
|
|
|
17904
17912
|
label: 'has any of',
|
|
17905
17913
|
value: 'hasAnyOf',
|
|
17906
17914
|
getApplyFilterFn: filterItem => {
|
|
17907
|
-
if (!filterItem.
|
|
17915
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17908
17916
|
return null;
|
|
17909
17917
|
}
|
|
17910
17918
|
return params => {
|
|
@@ -17927,7 +17935,7 @@ const isNotAnyOfOperator = {
|
|
|
17927
17935
|
label: 'is not any of',
|
|
17928
17936
|
value: 'isNotAnyOf',
|
|
17929
17937
|
getApplyFilterFn: filterItem => {
|
|
17930
|
-
if (!filterItem.
|
|
17938
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17931
17939
|
return null;
|
|
17932
17940
|
}
|
|
17933
17941
|
return params => {
|
|
@@ -17946,15 +17954,12 @@ const isNotAnyOfOperator = {
|
|
|
17946
17954
|
InputComponent: GridFilterInputMultipleValue
|
|
17947
17955
|
};
|
|
17948
17956
|
const IS_NOT_ANY_OF = isNotAnyOfOperator;
|
|
17949
|
-
const IS_NOT_ANY_OF_WITH_SELECT = _objectSpread2(_objectSpread2({}, IS_NOT_ANY_OF), {}, {
|
|
17950
|
-
InputComponent: GridFilterInputMultipleSingleSelect
|
|
17951
|
-
});
|
|
17952
17957
|
|
|
17953
17958
|
const startsWithAnyOfOperator = {
|
|
17954
17959
|
label: 'starts with any of',
|
|
17955
17960
|
value: 'startsWithAnyOf',
|
|
17956
17961
|
getApplyFilterFn: filterItem => {
|
|
17957
|
-
if (!filterItem.
|
|
17962
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17958
17963
|
return null;
|
|
17959
17964
|
}
|
|
17960
17965
|
return params => {
|
|
@@ -17965,7 +17970,7 @@ const startsWithAnyOfOperator = {
|
|
|
17965
17970
|
let match = false;
|
|
17966
17971
|
filterItem.value.forEach(filteredValue => {
|
|
17967
17972
|
paramValues.forEach(paramValue => {
|
|
17968
|
-
if (String(paramValue).
|
|
17973
|
+
if (String(paramValue).startsWith(filteredValue)) {
|
|
17969
17974
|
match = true;
|
|
17970
17975
|
}
|
|
17971
17976
|
});
|
|
@@ -17981,7 +17986,7 @@ const doesNotHaveAnyOf = {
|
|
|
17981
17986
|
label: "doesn't have any of",
|
|
17982
17987
|
value: 'doesNotHaveAnyOf',
|
|
17983
17988
|
getApplyFilterFn: filterItem => {
|
|
17984
|
-
if (!filterItem.
|
|
17989
|
+
if (!filterItem.columnField || !filterItem.value || !Array.isArray(filterItem.value) || filterItem.value.length === 0) {
|
|
17985
17990
|
return null;
|
|
17986
17991
|
}
|
|
17987
17992
|
return params => {
|
|
@@ -18016,9 +18021,9 @@ const operatorList = {
|
|
|
18016
18021
|
// Extended types
|
|
18017
18022
|
rsString: getGridStringOperators(),
|
|
18018
18023
|
rsNumber: getGridNumericOperators(),
|
|
18019
|
-
rsSingleSelect:
|
|
18024
|
+
rsSingleSelect: [CONTAINS_ANY_OF, ENDS_WITH_ANY_OF, IS_ANY_OF_WITH_SELECT, IS_NOT_WITH_SELECT, IS_WITH_SELECT, STARTS_WITH_ANY_OF],
|
|
18020
18025
|
rsSingleSelectWithShortOperatorList: [IS_WITH_SELECT, IS_NOT_WITH_SELECT, IS_ANY_OF_WITH_SELECT],
|
|
18021
|
-
rsMultipleSelect:
|
|
18026
|
+
rsMultipleSelect: [HAS_WITH_SELECT, HAS_ANY_OF_WITH_SELECT, HAS_ONLY_WITH_SELECT, DOES_NOT_HAVE_WITH_SELECT, DOES_NOT_HAVE_ANY_OF_WITH_SELECT],
|
|
18022
18027
|
rsMultipleSelectWithShortOperatorList: [HAS_WITH_SELECT, DOES_NOT_HAVE_WITH_SELECT, HAS_ANY_OF_WITH_SELECT],
|
|
18023
18028
|
// Custom types
|
|
18024
18029
|
rsStringArray: getGridStringArrayOperators()
|
|
@@ -18026,37 +18031,37 @@ const operatorList = {
|
|
|
18026
18031
|
|
|
18027
18032
|
const getRsStringColumnType = () => {
|
|
18028
18033
|
return {
|
|
18029
|
-
|
|
18034
|
+
extendType: 'string',
|
|
18030
18035
|
filterOperators: operatorList.rsString
|
|
18031
18036
|
};
|
|
18032
18037
|
};
|
|
18033
18038
|
const getRsNumberColumnType = () => {
|
|
18034
18039
|
return {
|
|
18035
|
-
|
|
18040
|
+
extendType: 'number',
|
|
18036
18041
|
filterOperators: operatorList.rsNumber
|
|
18037
18042
|
};
|
|
18038
18043
|
};
|
|
18039
18044
|
const getRsSingleSelectColumnType = () => {
|
|
18040
18045
|
return {
|
|
18041
|
-
|
|
18046
|
+
extendType: 'singleSelect',
|
|
18042
18047
|
filterOperators: operatorList.rsSingleSelect
|
|
18043
18048
|
};
|
|
18044
18049
|
};
|
|
18045
18050
|
const getRsSingleSelectWithShortOperatorListColumnType = () => {
|
|
18046
18051
|
return {
|
|
18047
|
-
|
|
18052
|
+
extendType: 'singleSelect',
|
|
18048
18053
|
filterOperators: operatorList.rsSingleSelectWithShortOperatorList
|
|
18049
18054
|
};
|
|
18050
18055
|
};
|
|
18051
18056
|
const getRsMultipleSelectColumnType = () => {
|
|
18052
18057
|
return {
|
|
18053
|
-
|
|
18058
|
+
extendType: 'singleSelect',
|
|
18054
18059
|
filterOperators: operatorList.rsMultipleSelect
|
|
18055
18060
|
};
|
|
18056
18061
|
};
|
|
18057
18062
|
const getRsMultipleSelectWithShortOperatorListColumnType = () => {
|
|
18058
18063
|
return {
|
|
18059
|
-
|
|
18064
|
+
extendType: 'singleSelect',
|
|
18060
18065
|
filterOperators: operatorList.rsMultipleSelectWithShortOperatorList
|
|
18061
18066
|
};
|
|
18062
18067
|
};
|
|
@@ -18071,7 +18076,7 @@ const customColumnTypes = {
|
|
|
18071
18076
|
|
|
18072
18077
|
const API_URL = 'https://api.openai.com/v1/chat/completions';
|
|
18073
18078
|
async function getCompletion(text, role, openai_api_key) {
|
|
18074
|
-
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';
|
|
18075
18080
|
try {
|
|
18076
18081
|
const messages = [{
|
|
18077
18082
|
role: 'system',
|
|
@@ -18238,39 +18243,42 @@ const numberOperatorDecoder = {
|
|
|
18238
18243
|
lt: '<',
|
|
18239
18244
|
lte: '<='
|
|
18240
18245
|
};
|
|
18241
|
-
const isOperatorValueValid = (
|
|
18242
|
-
const column = columns.find(column => column.field ===
|
|
18246
|
+
const isOperatorValueValid = (columnField, operatorValue, columns) => {
|
|
18247
|
+
const column = columns.find(column => column.field === columnField);
|
|
18243
18248
|
if (!column) {
|
|
18244
18249
|
return false;
|
|
18245
18250
|
}
|
|
18246
18251
|
const columnType = (column === null || column === void 0 ? void 0 : column.type) || 'string';
|
|
18247
|
-
const operators =
|
|
18252
|
+
const operators = operatorList[columnType];
|
|
18248
18253
|
if (!operators) {
|
|
18249
18254
|
return false;
|
|
18250
18255
|
}
|
|
18251
|
-
|
|
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);
|
|
18252
18260
|
};
|
|
18253
18261
|
const listOperators = ['containsAnyOf', 'doesNotContainAnyOf', 'endsWithAnyOf', 'doesNotEndWithAnyOf', 'hasAnyOf', 'doesNotHaveAnyOf', 'isAnyOf', 'isNotAnyOf', 'startsWithAnyOf', 'doesNotStartWithAnyOf'];
|
|
18254
18262
|
|
|
18255
18263
|
// Check if the value doesn't break
|
|
18256
|
-
const isValueValid = (value,
|
|
18264
|
+
const isValueValid = (value, columnField, columns, operatorValue) => {
|
|
18257
18265
|
var _column$type;
|
|
18258
18266
|
// every field accepts undefined as value for default
|
|
18259
18267
|
if (value === undefined || value === '') {
|
|
18260
18268
|
return true;
|
|
18261
18269
|
}
|
|
18262
18270
|
|
|
18263
|
-
// xxxAnyOf accepts as value only lists, and we are
|
|
18271
|
+
// xxxAnyOf accepts as value only lists, and we are declearing them in the
|
|
18264
18272
|
// URL as `list=[...]`
|
|
18265
|
-
if (listOperators.includes(
|
|
18273
|
+
if (listOperators.includes(operatorValue)) {
|
|
18266
18274
|
return Array.isArray(value) || value === '';
|
|
18267
18275
|
}
|
|
18268
18276
|
|
|
18269
18277
|
// We are accepting arrays only if they are of the 'xxxAnyOf' type
|
|
18270
|
-
if (Array.isArray(value) && !listOperators.includes(
|
|
18278
|
+
if (Array.isArray(value) && !listOperators.includes(operatorValue)) {
|
|
18271
18279
|
return false;
|
|
18272
18280
|
}
|
|
18273
|
-
const column = columns.find(column => column.field ===
|
|
18281
|
+
const column = columns.find(column => column.field === columnField);
|
|
18274
18282
|
if (!column) {
|
|
18275
18283
|
return false;
|
|
18276
18284
|
}
|
|
@@ -18308,7 +18316,7 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
18308
18316
|
if (!searchString) {
|
|
18309
18317
|
return 'invalid';
|
|
18310
18318
|
}
|
|
18311
|
-
let
|
|
18319
|
+
let linkOperator = GridLinkOperator.And;
|
|
18312
18320
|
let quickFilterValues = [];
|
|
18313
18321
|
const searchParams = new URLSearchParams();
|
|
18314
18322
|
for (const [key, value] of new URLSearchParams(searchString)) {
|
|
@@ -18316,7 +18324,7 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
18316
18324
|
searchParams.set(key, value);
|
|
18317
18325
|
}
|
|
18318
18326
|
if (key === '_logicOperator') {
|
|
18319
|
-
|
|
18327
|
+
linkOperator = value;
|
|
18320
18328
|
}
|
|
18321
18329
|
if (key === '_quickFilterValues') {
|
|
18322
18330
|
try {
|
|
@@ -18335,7 +18343,7 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
18335
18343
|
if (isInvalid) {
|
|
18336
18344
|
return;
|
|
18337
18345
|
}
|
|
18338
|
-
const field = key.split('[')[0].slice(1);
|
|
18346
|
+
const field = key.split('[')[0].slice(1); // Slice to remove the _ at the beginning
|
|
18339
18347
|
if (!fields.includes(field)) {
|
|
18340
18348
|
return;
|
|
18341
18349
|
}
|
|
@@ -18352,6 +18360,7 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
18352
18360
|
return;
|
|
18353
18361
|
}
|
|
18354
18362
|
const operator = splitRight[0];
|
|
18363
|
+
// if the operator is not part of the valid operators invalidate the URL
|
|
18355
18364
|
if (!isOperatorValueValid(field, operator, columns) || Array.isArray(operator)) {
|
|
18356
18365
|
isInvalid = true;
|
|
18357
18366
|
return;
|
|
@@ -18363,37 +18372,41 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
18363
18372
|
return;
|
|
18364
18373
|
}
|
|
18365
18374
|
items.push({
|
|
18366
|
-
field,
|
|
18367
|
-
|
|
18375
|
+
columnField: field,
|
|
18376
|
+
operatorValue: ['number', 'rsNumber'].includes(columnType) && Object.keys(numberOperatorDecoder).includes(operator) ? numberOperatorDecoder[operator] : operator,
|
|
18368
18377
|
id,
|
|
18369
18378
|
value: listOperators.includes(operator) && decodedValue === '' ? [] : decodedValue,
|
|
18370
18379
|
type
|
|
18371
18380
|
});
|
|
18372
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
|
|
18373
18386
|
if (isInvalid) {
|
|
18374
18387
|
return 'invalid';
|
|
18375
18388
|
}
|
|
18376
18389
|
return {
|
|
18377
18390
|
items,
|
|
18378
|
-
|
|
18391
|
+
linkOperator,
|
|
18379
18392
|
quickFilterValues
|
|
18380
18393
|
};
|
|
18381
18394
|
};
|
|
18382
18395
|
const getSearchParamsFromFilterModel = filterModel => {
|
|
18383
18396
|
var _filterModel$quickFil;
|
|
18384
18397
|
const searchParams = new URLSearchParams();
|
|
18385
|
-
searchParams.set('_logicOperator', filterModel['
|
|
18398
|
+
searchParams.set('_logicOperator', filterModel['linkOperator'] || '');
|
|
18386
18399
|
filterModel['items'].forEach(item => {
|
|
18387
18400
|
const {
|
|
18388
|
-
|
|
18389
|
-
|
|
18401
|
+
columnField,
|
|
18402
|
+
operatorValue,
|
|
18390
18403
|
value,
|
|
18391
18404
|
type
|
|
18392
18405
|
} = item;
|
|
18393
|
-
if (Object.keys(numberOperatorEncoder).includes(
|
|
18394
|
-
searchParams.set(`_${
|
|
18406
|
+
if (Object.keys(numberOperatorEncoder).includes(operatorValue)) {
|
|
18407
|
+
searchParams.set(`_${columnField}[${numberOperatorEncoder[operatorValue]},${encodeValue(type)}]`, encodeValue(value));
|
|
18395
18408
|
} else {
|
|
18396
|
-
searchParams.set(`_${
|
|
18409
|
+
searchParams.set(`_${columnField}[${encodeValue(operatorValue)},${encodeValue(type)}]`, encodeValue(value));
|
|
18397
18410
|
}
|
|
18398
18411
|
});
|
|
18399
18412
|
if ((_filterModel$quickFil = filterModel.quickFilterValues) !== null && _filterModel$quickFil !== void 0 && _filterModel$quickFil.length) {
|
|
@@ -18409,7 +18422,7 @@ const getSearchParamsFromFilterModel = filterModel => {
|
|
|
18409
18422
|
const getFilterModel = (search, columns, localStorageFilters, setLocalStorageFilters, initialState, isNewVersion) => {
|
|
18410
18423
|
const defaultValue = initialState && initialState.filter && initialState.filter.filterModel ? initialState.filter.filterModel : {
|
|
18411
18424
|
items: [],
|
|
18412
|
-
|
|
18425
|
+
linkOperator: GridLinkOperator.And
|
|
18413
18426
|
};
|
|
18414
18427
|
if (isNewVersion) {
|
|
18415
18428
|
return defaultValue;
|
|
@@ -18548,38 +18561,13 @@ const getPaginationModel = (search, localStoragePagination, setLocalStoragePagin
|
|
|
18548
18561
|
|
|
18549
18562
|
/** COLUMN VISIBILITY */
|
|
18550
18563
|
|
|
18551
|
-
const getColumnVisibilityFromString = (searchString, columns) => {
|
|
18552
|
-
if (!searchString) {
|
|
18553
|
-
return 'invalid';
|
|
18554
|
-
}
|
|
18555
|
-
const searchParams = new URLSearchParams(searchString);
|
|
18556
|
-
const value = searchParams.get('_columnVisibility');
|
|
18557
|
-
if (value === '' || value === null || value === '[]') {
|
|
18558
|
-
return 'invalid';
|
|
18559
|
-
}
|
|
18560
|
-
const parsedFields = value.slice(1, value.length - 1).split(',');
|
|
18561
|
-
const fields = columns.map(column => column.field);
|
|
18562
|
-
const visibility = {};
|
|
18563
|
-
for (const field of fields) {
|
|
18564
|
-
visibility[field] = false;
|
|
18565
|
-
}
|
|
18566
|
-
for (const parsedField of parsedFields) {
|
|
18567
|
-
if (fields.includes(parsedField)) {
|
|
18568
|
-
visibility[parsedField] = true;
|
|
18569
|
-
}
|
|
18570
|
-
}
|
|
18571
|
-
if (Object.values(visibility).filter(v => v === true).length === 0) {
|
|
18572
|
-
return 'invalid';
|
|
18573
|
-
}
|
|
18574
|
-
return visibility;
|
|
18575
|
-
};
|
|
18576
18564
|
const getSearchParamsFromColumnVisibility = (columnVisibility, columns) => {
|
|
18577
18565
|
const searchParams = new URLSearchParams();
|
|
18578
|
-
const
|
|
18566
|
+
const columnFields = columns.map(column => column.field);
|
|
18579
18567
|
|
|
18580
18568
|
// if column visibility model is empty, show all columns
|
|
18581
18569
|
if (Object.keys(columnVisibility).length == 0) {
|
|
18582
|
-
searchParams.set('_columnVisibility', `[${
|
|
18570
|
+
searchParams.set('_columnVisibility', `[${columnFields.join(',')}]`);
|
|
18583
18571
|
return searchParams;
|
|
18584
18572
|
}
|
|
18585
18573
|
const finalColumnVisibility = columns.filter(c => {
|
|
@@ -18590,10 +18578,63 @@ const getSearchParamsFromColumnVisibility = (columnVisibility, columns) => {
|
|
|
18590
18578
|
[colName]: true
|
|
18591
18579
|
});
|
|
18592
18580
|
}, columnVisibility);
|
|
18593
|
-
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
|
+
});
|
|
18594
18592
|
searchParams.set('_columnVisibility', `[${visibleColumns.join(',')}]`);
|
|
18595
18593
|
return searchParams;
|
|
18596
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
|
+
};
|
|
18597
18638
|
|
|
18598
18639
|
// Rules:
|
|
18599
18640
|
// - if we have something in the URL, use that info
|
|
@@ -18654,8 +18695,8 @@ const getPinnedColumnsFromString = (notParsed, tableColumns) => {
|
|
|
18654
18695
|
if (typeof encodedValues !== 'string') {
|
|
18655
18696
|
continue;
|
|
18656
18697
|
}
|
|
18657
|
-
const
|
|
18658
|
-
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));
|
|
18659
18700
|
if (fieldURL === '_pinnedColumnsLeft') {
|
|
18660
18701
|
pinnedColumns['left'] = columns;
|
|
18661
18702
|
}
|
|
@@ -18663,9 +18704,9 @@ const getPinnedColumnsFromString = (notParsed, tableColumns) => {
|
|
|
18663
18704
|
pinnedColumns['right'] = columns;
|
|
18664
18705
|
}
|
|
18665
18706
|
}
|
|
18666
|
-
return pinnedColumns
|
|
18667
|
-
left: pinnedColumns
|
|
18668
|
-
right: pinnedColumns
|
|
18707
|
+
return pinnedColumns['left'] || pinnedColumns['right'] ? {
|
|
18708
|
+
left: pinnedColumns['left'] || [],
|
|
18709
|
+
right: pinnedColumns['right'] || []
|
|
18669
18710
|
} : 'invalid';
|
|
18670
18711
|
};
|
|
18671
18712
|
const getSearchParamsFromPinnedColumns = pinnedColumns => {
|
|
@@ -18715,7 +18756,7 @@ const getSearchParamsFromTab = search => {
|
|
|
18715
18756
|
}
|
|
18716
18757
|
return searchParams;
|
|
18717
18758
|
};
|
|
18718
|
-
const getFinalSearch =
|
|
18759
|
+
const getFinalSearch = _ref3 => {
|
|
18719
18760
|
let {
|
|
18720
18761
|
search,
|
|
18721
18762
|
localStorageVersion,
|
|
@@ -18725,7 +18766,7 @@ const getFinalSearch = _ref => {
|
|
|
18725
18766
|
columnsVisibilityModel,
|
|
18726
18767
|
pinnedColumnsModel,
|
|
18727
18768
|
columns
|
|
18728
|
-
} =
|
|
18769
|
+
} = _ref3;
|
|
18729
18770
|
const filterModelSearch = getSearchParamsFromFilterModel(filterModel);
|
|
18730
18771
|
const sortModelSearch = getSearchParamsFromSorting(sortModel);
|
|
18731
18772
|
const paginationModelSearch = getSearchParamsFromPagination(paginationModel);
|
|
@@ -18790,14 +18831,14 @@ const getModelsParsedOrUpdateLocalStorage = (search, localStorageVersion, column
|
|
|
18790
18831
|
pinnedColumnsModel
|
|
18791
18832
|
};
|
|
18792
18833
|
};
|
|
18793
|
-
const updateUrl = (
|
|
18834
|
+
const updateUrl = (_ref4, search, localStorageVersion, historyReplace, columns) => {
|
|
18794
18835
|
let {
|
|
18795
18836
|
filterModel,
|
|
18796
18837
|
sortModel,
|
|
18797
18838
|
paginationModel,
|
|
18798
18839
|
columnsModel: columnsVisibilityModel,
|
|
18799
18840
|
pinnedColumnsModel
|
|
18800
|
-
} =
|
|
18841
|
+
} = _ref4;
|
|
18801
18842
|
const newSearch = getFinalSearch({
|
|
18802
18843
|
search,
|
|
18803
18844
|
localStorageVersion,
|
|
@@ -18818,17 +18859,17 @@ const updateUrl = (_ref2, search, localStorageVersion, historyReplace, columns)
|
|
|
18818
18859
|
// do not use it for equivalence (e.g. with value `3` and undefined we
|
|
18819
18860
|
// will get 0).
|
|
18820
18861
|
const compareFilters = (firstFilter, secondFilter) => {
|
|
18821
|
-
if (firstFilter.
|
|
18862
|
+
if (firstFilter.columnField < secondFilter.columnField) {
|
|
18822
18863
|
return -1;
|
|
18823
|
-
} else if (firstFilter.
|
|
18864
|
+
} else if (firstFilter.columnField > secondFilter.columnField) {
|
|
18824
18865
|
return 1;
|
|
18825
18866
|
}
|
|
18826
|
-
if (firstFilter.
|
|
18867
|
+
if (firstFilter.operatorValue === undefined || secondFilter.operatorValue === undefined) {
|
|
18827
18868
|
return 0;
|
|
18828
18869
|
}
|
|
18829
|
-
if (firstFilter.
|
|
18870
|
+
if (firstFilter.operatorValue < secondFilter.operatorValue) {
|
|
18830
18871
|
return -1;
|
|
18831
|
-
} else if (firstFilter.
|
|
18872
|
+
} else if (firstFilter.operatorValue > secondFilter.operatorValue) {
|
|
18832
18873
|
return 1;
|
|
18833
18874
|
}
|
|
18834
18875
|
if (firstFilter.value < secondFilter.value) {
|
|
@@ -18839,18 +18880,18 @@ const compareFilters = (firstFilter, secondFilter) => {
|
|
|
18839
18880
|
return 0;
|
|
18840
18881
|
};
|
|
18841
18882
|
const areFiltersEquivalent = (firstFilter, secondFilter) => {
|
|
18842
|
-
return firstFilter.
|
|
18883
|
+
return firstFilter.columnField === secondFilter.columnField && firstFilter.operatorValue === secondFilter.operatorValue && firstFilter.value === secondFilter.value;
|
|
18843
18884
|
};
|
|
18844
18885
|
const areFilterModelsEquivalent = (filterModel, filterModelToMatch) => {
|
|
18845
18886
|
const {
|
|
18846
18887
|
items,
|
|
18847
|
-
|
|
18888
|
+
linkOperator
|
|
18848
18889
|
} = filterModel;
|
|
18849
18890
|
const {
|
|
18850
18891
|
items: itemsToMatch,
|
|
18851
|
-
|
|
18892
|
+
linkOperator: linkOperatorToMatch
|
|
18852
18893
|
} = filterModelToMatch;
|
|
18853
|
-
if (
|
|
18894
|
+
if (linkOperator !== linkOperatorToMatch) {
|
|
18854
18895
|
return false;
|
|
18855
18896
|
}
|
|
18856
18897
|
if (items.length !== itemsToMatch.length) {
|
|
@@ -18863,7 +18904,7 @@ const areFilterModelsEquivalent = (filterModel, filterModelToMatch) => {
|
|
|
18863
18904
|
const filterToCompare = itemsToMatch[i];
|
|
18864
18905
|
|
|
18865
18906
|
// compareFilters return 0 if and only if the filters have the same
|
|
18866
|
-
//
|
|
18907
|
+
// columnField, operatorValue, and value
|
|
18867
18908
|
if (!areFiltersEquivalent(filter, filterToCompare)) {
|
|
18868
18909
|
return false;
|
|
18869
18910
|
}
|
|
@@ -24674,16 +24715,16 @@ const getRole = (config, dateFormat) => {
|
|
|
24674
24715
|
}).join('\n');
|
|
24675
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.
|
|
24676
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.
|
|
24677
|
-
The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "
|
|
24678
|
-
- "
|
|
24679
|
-
- "items": a list of conditions, each is an object with exactly the three keys "
|
|
24680
|
-
- "
|
|
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}
|
|
24681
24722
|
- "value":
|
|
24682
|
-
- this can be skipped if the "
|
|
24683
|
-
- 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"
|
|
24684
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.
|
|
24685
24726
|
For "date" data type, use ${dateFormat}. If relative date is input, convert to the actual date given today is ${today}.
|
|
24686
|
-
- "
|
|
24727
|
+
- "operatorValue": the comparison operator, accepted values depend on the data type of the column
|
|
24687
24728
|
${operators}
|
|
24688
24729
|
|
|
24689
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:
|
|
@@ -24720,10 +24761,10 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24720
24761
|
nlpFilterConfig,
|
|
24721
24762
|
onFilterModelChange,
|
|
24722
24763
|
dateFormat = 'yyyy-mm-dd',
|
|
24723
|
-
defaultModel = 'gpt-4-
|
|
24764
|
+
defaultModel = 'gpt-4-0613',
|
|
24724
24765
|
defaultFilter = {
|
|
24725
24766
|
items: [],
|
|
24726
|
-
|
|
24767
|
+
linkOperator: 'and'
|
|
24727
24768
|
},
|
|
24728
24769
|
disablePower = false,
|
|
24729
24770
|
localeText
|
|
@@ -24801,7 +24842,7 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24801
24842
|
value: prompt
|
|
24802
24843
|
}), /*#__PURE__*/React__default.createElement(Button, {
|
|
24803
24844
|
variant: "primary",
|
|
24804
|
-
"
|
|
24845
|
+
"aira-label": buttonAriaLabel,
|
|
24805
24846
|
type: "submit",
|
|
24806
24847
|
isLoading: isLoading
|
|
24807
24848
|
}, buttonText)), !disablePower && /*#__PURE__*/React__default.createElement(Tooltip, null, /*#__PURE__*/React__default.createElement(Tooltip.Trigger, null, /*#__PURE__*/React__default.createElement(Switch, {
|
|
@@ -24863,7 +24904,7 @@ const Toolbar$2 = props => {
|
|
|
24863
24904
|
let {
|
|
24864
24905
|
apiRef
|
|
24865
24906
|
} = _ref;
|
|
24866
|
-
return
|
|
24907
|
+
return gridVisibleSortedRowIdsSelector(apiRef);
|
|
24867
24908
|
}
|
|
24868
24909
|
},
|
|
24869
24910
|
printOptions: {
|
|
@@ -27097,10 +27138,12 @@ const ServerSideControlledPagination = _ref3 => {
|
|
|
27097
27138
|
selectionStatus,
|
|
27098
27139
|
displaySelection,
|
|
27099
27140
|
displayPagination,
|
|
27100
|
-
|
|
27101
|
-
|
|
27102
|
-
|
|
27141
|
+
page,
|
|
27142
|
+
onPageChange,
|
|
27143
|
+
pageSize,
|
|
27144
|
+
onPageSizeChange,
|
|
27103
27145
|
displayRowsPerPage,
|
|
27146
|
+
rowsPerPageOptions,
|
|
27104
27147
|
paginationProps,
|
|
27105
27148
|
rowCount
|
|
27106
27149
|
} = _ref3;
|
|
@@ -27119,17 +27162,13 @@ const ServerSideControlledPagination = _ref3 => {
|
|
|
27119
27162
|
}, totalRowsLabel) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$1({
|
|
27120
27163
|
component: "div",
|
|
27121
27164
|
count: totalNumberOfRowsInTable,
|
|
27122
|
-
page:
|
|
27123
|
-
onPageChange: (event,
|
|
27124
|
-
|
|
27125
|
-
|
|
27126
|
-
|
|
27127
|
-
|
|
27128
|
-
|
|
27129
|
-
page: paginationModel.page,
|
|
27130
|
-
pageSize: parseInt(event.target.value, 10)
|
|
27131
|
-
}),
|
|
27132
|
-
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 : []
|
|
27133
27172
|
}, paginationProps)) : null);
|
|
27134
27173
|
};
|
|
27135
27174
|
|
|
@@ -27155,9 +27194,11 @@ const ControlledPagination = _ref3 => {
|
|
|
27155
27194
|
displayPagination = false,
|
|
27156
27195
|
selectionStatus,
|
|
27157
27196
|
apiRef,
|
|
27158
|
-
|
|
27159
|
-
|
|
27160
|
-
|
|
27197
|
+
page,
|
|
27198
|
+
onPageChange,
|
|
27199
|
+
pageSize,
|
|
27200
|
+
onPageSizeChange,
|
|
27201
|
+
rowsPerPageOptions,
|
|
27161
27202
|
isRowSelectable,
|
|
27162
27203
|
paginationProps
|
|
27163
27204
|
} = _ref3;
|
|
@@ -27187,25 +27228,17 @@ const ControlledPagination = _ref3 => {
|
|
|
27187
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({
|
|
27188
27229
|
component: "div",
|
|
27189
27230
|
count: numberOfFilteredRowsInTable,
|
|
27190
|
-
page:
|
|
27191
|
-
onPageChange: (event,
|
|
27192
|
-
|
|
27193
|
-
page,
|
|
27194
|
-
pageSize: paginationModel.pageSize
|
|
27195
|
-
});
|
|
27196
|
-
},
|
|
27197
|
-
rowsPerPage: paginationModel.pageSize,
|
|
27231
|
+
page: page,
|
|
27232
|
+
onPageChange: (event, newPage) => onPageChange(newPage),
|
|
27233
|
+
rowsPerPage: pageSize,
|
|
27198
27234
|
onRowsPerPageChange: event => {
|
|
27199
|
-
|
|
27200
|
-
page: paginationModel.page,
|
|
27201
|
-
pageSize: parseInt(event.target.value, 10)
|
|
27202
|
-
});
|
|
27235
|
+
onPageSizeChange(parseInt(event.target.value, 10));
|
|
27203
27236
|
},
|
|
27204
|
-
rowsPerPageOptions: displayRowsPerPage ?
|
|
27237
|
+
rowsPerPageOptions: displayRowsPerPage ? rowsPerPageOptions : []
|
|
27205
27238
|
}, paginationProps)) : null);
|
|
27206
27239
|
};
|
|
27207
27240
|
|
|
27208
|
-
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"];
|
|
27209
27242
|
const ToolbarWrapper = _ref => {
|
|
27210
27243
|
let {
|
|
27211
27244
|
hideToolbar,
|
|
@@ -27217,9 +27250,11 @@ const ToolbarWrapper = _ref => {
|
|
|
27217
27250
|
selectionStatus,
|
|
27218
27251
|
apiRef,
|
|
27219
27252
|
isRowSelectable,
|
|
27220
|
-
|
|
27221
|
-
|
|
27222
|
-
|
|
27253
|
+
page,
|
|
27254
|
+
onPageChange,
|
|
27255
|
+
pageSize,
|
|
27256
|
+
onPageSizeChange,
|
|
27257
|
+
rowsPerPageOptions,
|
|
27223
27258
|
paginationProps,
|
|
27224
27259
|
paginationMode = 'client',
|
|
27225
27260
|
rowCount
|
|
@@ -27233,9 +27268,11 @@ const ToolbarWrapper = _ref => {
|
|
|
27233
27268
|
displayRowsPerPage: false,
|
|
27234
27269
|
displayPagination: ['top', 'both'].includes(paginationPlacement),
|
|
27235
27270
|
selectionStatus: selectionStatus.current,
|
|
27236
|
-
|
|
27237
|
-
|
|
27238
|
-
|
|
27271
|
+
page: page,
|
|
27272
|
+
onPageChange: onPageChange,
|
|
27273
|
+
pageSize: pageSize,
|
|
27274
|
+
onPageSizeChange: onPageSizeChange,
|
|
27275
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
27239
27276
|
paginationProps: paginationProps,
|
|
27240
27277
|
rowCount: rowCount
|
|
27241
27278
|
}) : /*#__PURE__*/React__default.createElement(ControlledPagination, {
|
|
@@ -27245,26 +27282,30 @@ const ToolbarWrapper = _ref => {
|
|
|
27245
27282
|
selectionStatus: selectionStatus.current,
|
|
27246
27283
|
apiRef: apiRef,
|
|
27247
27284
|
isRowSelectable: isRowSelectable,
|
|
27248
|
-
|
|
27249
|
-
|
|
27250
|
-
|
|
27285
|
+
page: page,
|
|
27286
|
+
onPageChange: onPageChange,
|
|
27287
|
+
pageSize: pageSize,
|
|
27288
|
+
onPageSizeChange: onPageSizeChange,
|
|
27289
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
27251
27290
|
paginationProps: paginationProps
|
|
27252
27291
|
}) : null);
|
|
27253
27292
|
};
|
|
27254
27293
|
|
|
27255
27294
|
const useControlledDatagridState = _ref => {
|
|
27256
|
-
var
|
|
27295
|
+
var _initialState$paginat, _initialState$paginat2;
|
|
27257
27296
|
let {
|
|
27258
27297
|
initialState,
|
|
27259
|
-
|
|
27298
|
+
rowsPerPageOptions,
|
|
27260
27299
|
propsColumnVisibilityModel,
|
|
27261
27300
|
propsFilterModel,
|
|
27262
27301
|
propsOnColumnVisibilityModelChange,
|
|
27263
27302
|
propsOnFilterModelChange,
|
|
27264
|
-
|
|
27303
|
+
propsOnPageChange,
|
|
27304
|
+
propsOnPageSizeChange,
|
|
27265
27305
|
propsOnPinnedColumnsChange,
|
|
27266
27306
|
propsOnSortModelChange,
|
|
27267
|
-
|
|
27307
|
+
propsPage,
|
|
27308
|
+
propsPageSize,
|
|
27268
27309
|
propsPinnedColumns,
|
|
27269
27310
|
propsSortModel
|
|
27270
27311
|
} = _ref;
|
|
@@ -27312,22 +27353,33 @@ const useControlledDatagridState = _ref => {
|
|
|
27312
27353
|
setSortModel(model);
|
|
27313
27354
|
}
|
|
27314
27355
|
};
|
|
27315
|
-
const [
|
|
27316
|
-
|
|
27317
|
-
|
|
27318
|
-
|
|
27319
|
-
|
|
27320
|
-
if (propsOnPaginationModelChange) {
|
|
27321
|
-
propsOnPaginationModelChange(model, details);
|
|
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);
|
|
27322
27361
|
} else {
|
|
27323
|
-
|
|
27362
|
+
setPage(page);
|
|
27324
27363
|
}
|
|
27325
27364
|
};
|
|
27326
27365
|
useEffect(() => {
|
|
27327
|
-
if (
|
|
27328
|
-
|
|
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);
|
|
27374
|
+
} else {
|
|
27375
|
+
setPageSize(pageSize);
|
|
27329
27376
|
}
|
|
27330
|
-
}
|
|
27377
|
+
};
|
|
27378
|
+
useEffect(() => {
|
|
27379
|
+
if (propsPageSize) {
|
|
27380
|
+
setPageSize(propsPageSize);
|
|
27381
|
+
}
|
|
27382
|
+
}, [propsPageSize]);
|
|
27331
27383
|
return {
|
|
27332
27384
|
filterModel,
|
|
27333
27385
|
onFilterModelChange,
|
|
@@ -27337,12 +27389,14 @@ const useControlledDatagridState = _ref => {
|
|
|
27337
27389
|
onPinnedColumnsChange,
|
|
27338
27390
|
sortModel,
|
|
27339
27391
|
onSortModelChange,
|
|
27340
|
-
|
|
27341
|
-
|
|
27392
|
+
page,
|
|
27393
|
+
pageSize,
|
|
27394
|
+
onPageChange,
|
|
27395
|
+
onPageSizeChange
|
|
27342
27396
|
};
|
|
27343
27397
|
};
|
|
27344
27398
|
|
|
27345
|
-
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"];
|
|
27346
27400
|
const COMPONENT_NAME$2 = 'DataGrid';
|
|
27347
27401
|
const CLASSNAME$2 = 'redsift-datagrid';
|
|
27348
27402
|
const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
@@ -27351,30 +27405,33 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27351
27405
|
apiRef: propsApiRef,
|
|
27352
27406
|
autoHeight,
|
|
27353
27407
|
className,
|
|
27354
|
-
|
|
27355
|
-
|
|
27408
|
+
columnTypes: propsColumnTypes,
|
|
27409
|
+
components,
|
|
27410
|
+
componentsProps,
|
|
27356
27411
|
filterModel: propsFilterModel,
|
|
27357
27412
|
columnVisibilityModel: propsColumnVisibilityModel,
|
|
27358
27413
|
pinnedColumns: propsPinnedColumns,
|
|
27359
27414
|
sortModel: propsSortModel,
|
|
27360
|
-
paginationModel: propsPaginationModel,
|
|
27361
27415
|
height: propsHeight,
|
|
27362
27416
|
hideToolbar,
|
|
27363
27417
|
initialState,
|
|
27364
27418
|
isRowSelectable,
|
|
27365
27419
|
license = process.env.MUI_LICENSE_KEY,
|
|
27366
27420
|
onFilterModelChange: propsOnFilterModelChange,
|
|
27367
|
-
|
|
27368
|
-
|
|
27369
|
-
onRowSelectionModelChange: propsOnRowSelectionModelChange,
|
|
27421
|
+
onPageChange: propsOnPageChange,
|
|
27422
|
+
onPageSizeChange: propsOnPageSizeChange,
|
|
27370
27423
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
27371
27424
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
27372
27425
|
onSortModelChange: propsOnSortModelChange,
|
|
27426
|
+
selectionModel: propsSelectionModel,
|
|
27427
|
+
onSelectionModelChange: propsOnSelectionModelChange,
|
|
27428
|
+
page: propsPage,
|
|
27429
|
+
pageSize: propsPageSize,
|
|
27373
27430
|
pagination,
|
|
27374
27431
|
paginationPlacement = 'both',
|
|
27375
27432
|
paginationProps,
|
|
27376
27433
|
rows,
|
|
27377
|
-
|
|
27434
|
+
rowsPerPageOptions,
|
|
27378
27435
|
sx,
|
|
27379
27436
|
theme: propsTheme,
|
|
27380
27437
|
paginationMode = 'client',
|
|
@@ -27384,7 +27441,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27384
27441
|
const theme = useTheme$4(propsTheme);
|
|
27385
27442
|
const _apiRef = useGridApiRef();
|
|
27386
27443
|
const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
|
|
27387
|
-
const RenderedToolbar =
|
|
27444
|
+
const RenderedToolbar = components !== null && components !== void 0 && components.Toolbar ? components.Toolbar : Toolbar$2;
|
|
27388
27445
|
LicenseInfo.setLicenseKey(license);
|
|
27389
27446
|
const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
|
|
27390
27447
|
const {
|
|
@@ -27392,52 +27449,56 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27392
27449
|
filterModel,
|
|
27393
27450
|
onColumnVisibilityModelChange,
|
|
27394
27451
|
onFilterModelChange,
|
|
27395
|
-
|
|
27452
|
+
onPageChange,
|
|
27453
|
+
onPageSizeChange,
|
|
27396
27454
|
onPinnedColumnsChange,
|
|
27397
27455
|
onSortModelChange,
|
|
27398
|
-
|
|
27456
|
+
page,
|
|
27457
|
+
pageSize,
|
|
27399
27458
|
pinnedColumns,
|
|
27400
27459
|
sortModel
|
|
27401
27460
|
} = useControlledDatagridState({
|
|
27402
27461
|
initialState,
|
|
27403
|
-
|
|
27462
|
+
rowsPerPageOptions,
|
|
27404
27463
|
propsColumnVisibilityModel,
|
|
27405
27464
|
propsFilterModel,
|
|
27406
27465
|
propsOnColumnVisibilityModelChange,
|
|
27407
27466
|
propsOnFilterModelChange,
|
|
27408
27467
|
propsOnPinnedColumnsChange,
|
|
27409
27468
|
propsOnSortModelChange,
|
|
27410
|
-
|
|
27469
|
+
propsPage,
|
|
27470
|
+
propsPageSize,
|
|
27411
27471
|
propsPinnedColumns,
|
|
27412
27472
|
propsSortModel,
|
|
27413
|
-
|
|
27473
|
+
propsOnPageChange,
|
|
27474
|
+
propsOnPageSizeChange
|
|
27414
27475
|
});
|
|
27415
|
-
const [
|
|
27476
|
+
const [selectionModel, setSelectionModel] = useState(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
|
|
27416
27477
|
useEffect(() => {
|
|
27417
|
-
|
|
27418
|
-
}, [
|
|
27419
|
-
const
|
|
27420
|
-
if (
|
|
27421
|
-
|
|
27478
|
+
setSelectionModel(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
|
|
27479
|
+
}, [propsSelectionModel]);
|
|
27480
|
+
const onSelectionModelChange = (selectionModel, details) => {
|
|
27481
|
+
if (propsOnSelectionModelChange) {
|
|
27482
|
+
propsOnSelectionModelChange(selectionModel, details);
|
|
27422
27483
|
} else {
|
|
27423
|
-
|
|
27484
|
+
setSelectionModel(selectionModel);
|
|
27424
27485
|
}
|
|
27425
27486
|
};
|
|
27426
27487
|
const selectionStatus = useRef({
|
|
27427
27488
|
type: 'none',
|
|
27428
27489
|
numberOfSelectedRows: 0,
|
|
27429
27490
|
numberOfSelectedRowsInPage: 0,
|
|
27430
|
-
page
|
|
27431
|
-
pageSize
|
|
27491
|
+
page,
|
|
27492
|
+
pageSize
|
|
27432
27493
|
});
|
|
27433
27494
|
|
|
27434
27495
|
// in server-side pagination we want to update the selection status
|
|
27435
27496
|
// every time we navigate between pages, resize our page or select something
|
|
27436
27497
|
useEffect(() => {
|
|
27437
27498
|
if (paginationMode == 'server') {
|
|
27438
|
-
onServerSideSelectionStatusChange(Array.isArray(
|
|
27499
|
+
onServerSideSelectionStatusChange(Array.isArray(selectionModel) ? selectionModel : [selectionModel], apiRef, selectionStatus, isRowSelectable, page, pageSize);
|
|
27439
27500
|
}
|
|
27440
|
-
}, [
|
|
27501
|
+
}, [selectionModel, page, pageSize]);
|
|
27441
27502
|
if (!Array.isArray(rows)) {
|
|
27442
27503
|
return null;
|
|
27443
27504
|
}
|
|
@@ -27468,54 +27529,57 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27468
27529
|
apiRef: apiRef,
|
|
27469
27530
|
autoHeight: autoHeight,
|
|
27470
27531
|
checkboxSelectionVisibleOnly: Boolean(pagination),
|
|
27471
|
-
|
|
27472
|
-
|
|
27473
|
-
|
|
27474
|
-
|
|
27475
|
-
|
|
27476
|
-
|
|
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, {
|
|
27477
27539
|
displayName: "ColumnFilteredIcon"
|
|
27478
27540
|
})),
|
|
27479
|
-
|
|
27541
|
+
ColumnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27480
27542
|
displayName: "ColumnSelectorIcon"
|
|
27481
27543
|
})),
|
|
27482
|
-
|
|
27544
|
+
ColumnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27483
27545
|
displayName: "ColumnSortedAscendingIcon"
|
|
27484
27546
|
})),
|
|
27485
|
-
|
|
27547
|
+
ColumnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27486
27548
|
displayName: "ColumnSortedDescendingIcon"
|
|
27487
27549
|
})),
|
|
27488
|
-
|
|
27550
|
+
DensityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27489
27551
|
displayName: "DensityCompactIcon"
|
|
27490
27552
|
})),
|
|
27491
|
-
|
|
27553
|
+
DensityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27492
27554
|
displayName: "DensityStandardIcon"
|
|
27493
27555
|
})),
|
|
27494
|
-
|
|
27556
|
+
DensityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27495
27557
|
displayName: "DensityComfortableIcon"
|
|
27496
27558
|
})),
|
|
27497
|
-
|
|
27559
|
+
DetailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27498
27560
|
displayName: "DetailPanelCollapseIcon"
|
|
27499
27561
|
})),
|
|
27500
|
-
|
|
27562
|
+
DetailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27501
27563
|
displayName: "DetailPanelExpandIcon"
|
|
27502
27564
|
})),
|
|
27503
|
-
|
|
27565
|
+
ExportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27504
27566
|
displayName: "ExportIcon"
|
|
27505
27567
|
})),
|
|
27506
|
-
|
|
27568
|
+
OpenFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
|
|
27507
27569
|
displayName: "OpenFilterButtonIcon"
|
|
27508
27570
|
}, props))
|
|
27509
|
-
},
|
|
27510
|
-
|
|
27511
|
-
|
|
27571
|
+
}, components), {}, {
|
|
27572
|
+
Toolbar: ToolbarWrapper,
|
|
27573
|
+
Pagination: props => pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$1({}, props, {
|
|
27512
27574
|
displaySelection: false,
|
|
27513
27575
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
27514
27576
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
27515
27577
|
selectionStatus: selectionStatus.current,
|
|
27516
|
-
|
|
27517
|
-
|
|
27518
|
-
|
|
27578
|
+
page: page,
|
|
27579
|
+
onPageChange: onPageChange,
|
|
27580
|
+
pageSize: pageSize,
|
|
27581
|
+
onPageSizeChange: onPageSizeChange,
|
|
27582
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
27519
27583
|
paginationProps: paginationProps,
|
|
27520
27584
|
paginationMode: paginationMode,
|
|
27521
27585
|
rowCount: rowCount
|
|
@@ -27526,14 +27590,16 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27526
27590
|
selectionStatus: selectionStatus.current,
|
|
27527
27591
|
apiRef: apiRef,
|
|
27528
27592
|
isRowSelectable: isRowSelectable,
|
|
27529
|
-
|
|
27530
|
-
|
|
27531
|
-
|
|
27593
|
+
page: page,
|
|
27594
|
+
onPageChange: onPageChange,
|
|
27595
|
+
pageSize: pageSize,
|
|
27596
|
+
onPageSizeChange: onPageSizeChange,
|
|
27597
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
27532
27598
|
paginationProps: paginationProps,
|
|
27533
27599
|
paginationMode: paginationMode
|
|
27534
27600
|
})) : null
|
|
27535
27601
|
}),
|
|
27536
|
-
|
|
27602
|
+
componentsProps: _objectSpread2(_objectSpread2({}, componentsProps), {}, {
|
|
27537
27603
|
toolbar: _objectSpread2({
|
|
27538
27604
|
hideToolbar,
|
|
27539
27605
|
RenderedToolbar,
|
|
@@ -27544,13 +27610,15 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27544
27610
|
selectionStatus,
|
|
27545
27611
|
apiRef,
|
|
27546
27612
|
isRowSelectable,
|
|
27547
|
-
|
|
27548
|
-
|
|
27549
|
-
|
|
27613
|
+
page,
|
|
27614
|
+
onPageChange,
|
|
27615
|
+
pageSize,
|
|
27616
|
+
onPageSizeChange,
|
|
27617
|
+
rowsPerPageOptions,
|
|
27550
27618
|
paginationProps,
|
|
27551
27619
|
paginationMode,
|
|
27552
27620
|
rowCount
|
|
27553
|
-
},
|
|
27621
|
+
}, componentsProps === null || componentsProps === void 0 ? void 0 : componentsProps.toolbar)
|
|
27554
27622
|
}),
|
|
27555
27623
|
filterModel: filterModel,
|
|
27556
27624
|
columnVisibilityModel: columnVisibilityModel,
|
|
@@ -27566,11 +27634,13 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27566
27634
|
paginationMode: paginationMode,
|
|
27567
27635
|
keepNonExistentRowsSelected: paginationMode == 'server',
|
|
27568
27636
|
rows: rows,
|
|
27569
|
-
|
|
27570
|
-
|
|
27571
|
-
|
|
27572
|
-
|
|
27573
|
-
|
|
27637
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
27638
|
+
page: page,
|
|
27639
|
+
onPageChange: onPageChange,
|
|
27640
|
+
pageSize: pageSize,
|
|
27641
|
+
onPageSizeChange: onPageSizeChange,
|
|
27642
|
+
selectionModel: selectionModel,
|
|
27643
|
+
onSelectionModelChange: (newSelectionModel, details) => {
|
|
27574
27644
|
if (pagination && paginationMode != 'server') {
|
|
27575
27645
|
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
|
|
27576
27646
|
let {
|
|
@@ -27628,7 +27698,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27628
27698
|
};
|
|
27629
27699
|
}
|
|
27630
27700
|
}
|
|
27631
|
-
|
|
27701
|
+
onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(newSelectionModel, details);
|
|
27632
27702
|
},
|
|
27633
27703
|
sx: _objectSpread2(_objectSpread2({}, sx), {}, {
|
|
27634
27704
|
'.MuiDataGrid-columnHeaders': {
|
|
@@ -27645,6 +27715,8 @@ DataGrid.className = CLASSNAME$2;
|
|
|
27645
27715
|
DataGrid.displayName = COMPONENT_NAME$2;
|
|
27646
27716
|
|
|
27647
27717
|
// Get and Set data from LocalStorage WITHOUT useState
|
|
27718
|
+
|
|
27719
|
+
// triggering a state update and consecutive re-render
|
|
27648
27720
|
const useFetchState = (defaultValue, key) => {
|
|
27649
27721
|
let stickyValue = null;
|
|
27650
27722
|
try {
|
|
@@ -27652,7 +27724,16 @@ const useFetchState = (defaultValue, key) => {
|
|
|
27652
27724
|
} catch (e) {
|
|
27653
27725
|
console.error('StatefulDataGrid: error getting item from local storage: ', e);
|
|
27654
27726
|
}
|
|
27655
|
-
|
|
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
|
+
}
|
|
27656
27737
|
const updateValue = useCallback(value => {
|
|
27657
27738
|
try {
|
|
27658
27739
|
window.localStorage.setItem(key, JSON.stringify(value));
|
|
@@ -27663,8 +27744,6 @@ const useFetchState = (defaultValue, key) => {
|
|
|
27663
27744
|
return [parsedValue, updateValue];
|
|
27664
27745
|
};
|
|
27665
27746
|
|
|
27666
|
-
// import useLocalStorage from './useLocalStorage';
|
|
27667
|
-
|
|
27668
27747
|
const useTableStates = (id, version) => {
|
|
27669
27748
|
const [paginationModel, setPaginationModel] = useFetchState('', buildStorageKey({
|
|
27670
27749
|
id,
|
|
@@ -27721,7 +27800,8 @@ const useStatefulTable = props => {
|
|
|
27721
27800
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
27722
27801
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
27723
27802
|
onFilterModelChange: propsOnFilterModelChange,
|
|
27724
|
-
|
|
27803
|
+
onPageChange: propsOnPageChange,
|
|
27804
|
+
onPageSizeChange: propsOnPageSizeChange,
|
|
27725
27805
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
27726
27806
|
onSortModelChange: propsOnSortModelChange,
|
|
27727
27807
|
useRouter,
|
|
@@ -27751,7 +27831,7 @@ const useStatefulTable = props => {
|
|
|
27751
27831
|
setDimensionModel
|
|
27752
27832
|
} = useTableStates(id, localStorageVersion);
|
|
27753
27833
|
|
|
27754
|
-
// clearing up old version keys
|
|
27834
|
+
// clearing up old version keys
|
|
27755
27835
|
useEffect(() => clearPreviousVersionStorage(id, previousLocalStorageVersions), [id, previousLocalStorageVersions]);
|
|
27756
27836
|
const onColumnDimensionChange = useCallback(_ref => {
|
|
27757
27837
|
let {
|
|
@@ -27784,6 +27864,7 @@ const useStatefulTable = props => {
|
|
|
27784
27864
|
column.width = dimensionModel[column.field] || column.width || 100;
|
|
27785
27865
|
return column;
|
|
27786
27866
|
}), [propsColumns, dimensionModel]);
|
|
27867
|
+
|
|
27787
27868
|
/** Add resetPage method to apiRef. */
|
|
27788
27869
|
apiRef.current.resetPage = () => {
|
|
27789
27870
|
apiRef.current.setPage(0);
|
|
@@ -27794,7 +27875,7 @@ const useStatefulTable = props => {
|
|
|
27794
27875
|
onFilterModelChange: (model, details) => {
|
|
27795
27876
|
const filterModel = _objectSpread2(_objectSpread2({}, model), {}, {
|
|
27796
27877
|
items: model.items.map(item => {
|
|
27797
|
-
const column = apiRef.current.getColumn(item.
|
|
27878
|
+
const column = apiRef.current.getColumn(item.columnField);
|
|
27798
27879
|
item.type = column.type || 'string';
|
|
27799
27880
|
return item;
|
|
27800
27881
|
}),
|
|
@@ -27832,16 +27913,33 @@ const useStatefulTable = props => {
|
|
|
27832
27913
|
}, search, localStorageVersion, historyReplace, columns);
|
|
27833
27914
|
},
|
|
27834
27915
|
pinnedColumns: pinnedColumnsModel,
|
|
27835
|
-
|
|
27836
|
-
|
|
27837
|
-
|
|
27838
|
-
|
|
27839
|
-
|
|
27840
|
-
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);
|
|
27841
27921
|
updateUrl({
|
|
27842
27922
|
filterModel: filterParsed,
|
|
27843
27923
|
sortModel: sortModelParsed,
|
|
27844
|
-
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
|
+
},
|
|
27845
27943
|
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
27846
27944
|
pinnedColumnsModel: pinnedColumnsModel
|
|
27847
27945
|
}, search, localStorageVersion, historyReplace, columns);
|
|
@@ -27867,7 +27965,7 @@ const useStatefulTable = props => {
|
|
|
27867
27965
|
};
|
|
27868
27966
|
};
|
|
27869
27967
|
|
|
27870
|
-
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"];
|
|
27871
27969
|
const COMPONENT_NAME$1 = 'DataGrid';
|
|
27872
27970
|
const CLASSNAME$1 = 'redsift-datagrid';
|
|
27873
27971
|
const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
@@ -27877,13 +27975,15 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27877
27975
|
autoHeight,
|
|
27878
27976
|
className,
|
|
27879
27977
|
columns,
|
|
27880
|
-
|
|
27881
|
-
|
|
27978
|
+
columnTypes: propsColumnTypes,
|
|
27979
|
+
components,
|
|
27980
|
+
componentsProps,
|
|
27882
27981
|
filterModel: propsFilterModel,
|
|
27883
27982
|
columnVisibilityModel: propsColumnVisibilityModel,
|
|
27884
27983
|
pinnedColumns: propsPinnedColumns,
|
|
27885
27984
|
sortModel: propsSortModel,
|
|
27886
|
-
|
|
27985
|
+
page: propsPage,
|
|
27986
|
+
pageSize: propsPageSize,
|
|
27887
27987
|
height: propsHeight,
|
|
27888
27988
|
hideToolbar,
|
|
27889
27989
|
initialState,
|
|
@@ -27892,10 +27992,11 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27892
27992
|
localStorageVersion,
|
|
27893
27993
|
previousLocalStorageVersions,
|
|
27894
27994
|
onFilterModelChange: propsOnFilterModelChange,
|
|
27895
|
-
|
|
27995
|
+
selectionModel: propsSelectionModel,
|
|
27896
27996
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
27897
|
-
|
|
27898
|
-
|
|
27997
|
+
onPageChange: propsOnPageChange,
|
|
27998
|
+
onPageSizeChange: propsOnPageSizeChange,
|
|
27999
|
+
onSelectionModelChange: propsOnSelectionModelChange,
|
|
27899
28000
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
27900
28001
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
27901
28002
|
onSortModelChange: propsOnSortModelChange,
|
|
@@ -27903,7 +28004,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27903
28004
|
paginationPlacement = 'both',
|
|
27904
28005
|
paginationProps,
|
|
27905
28006
|
rows,
|
|
27906
|
-
|
|
28007
|
+
rowsPerPageOptions,
|
|
27907
28008
|
sx,
|
|
27908
28009
|
theme: propsTheme,
|
|
27909
28010
|
useRouter,
|
|
@@ -27914,38 +28015,43 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27914
28015
|
const theme = useTheme$4(propsTheme);
|
|
27915
28016
|
const _apiRef = useGridApiRef();
|
|
27916
28017
|
const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
|
|
27917
|
-
const RenderedToolbar =
|
|
28018
|
+
const RenderedToolbar = components !== null && components !== void 0 && components.Toolbar ? components.Toolbar : Toolbar$2;
|
|
27918
28019
|
LicenseInfo.setLicenseKey(license);
|
|
27919
28020
|
const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
|
|
27920
28021
|
const {
|
|
27921
28022
|
onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
|
|
27922
28023
|
onFilterModelChange: controlledOnFilterModelChange,
|
|
27923
|
-
|
|
28024
|
+
onPageChange: controlledOnPageChange,
|
|
28025
|
+
onPageSizeChange: controlledOnPageSizeChange,
|
|
27924
28026
|
onPinnedColumnsChange: controlledOnPinnedColumnsChange,
|
|
27925
28027
|
onSortModelChange: controlledOnSortModelChange
|
|
27926
28028
|
} = useControlledDatagridState({
|
|
27927
28029
|
initialState,
|
|
27928
|
-
|
|
28030
|
+
rowsPerPageOptions,
|
|
27929
28031
|
propsColumnVisibilityModel,
|
|
27930
28032
|
propsFilterModel,
|
|
27931
28033
|
propsOnColumnVisibilityModelChange,
|
|
27932
28034
|
propsOnFilterModelChange,
|
|
27933
28035
|
propsOnPinnedColumnsChange,
|
|
27934
28036
|
propsOnSortModelChange,
|
|
27935
|
-
|
|
28037
|
+
propsPage,
|
|
28038
|
+
propsPageSize,
|
|
27936
28039
|
propsPinnedColumns,
|
|
27937
28040
|
propsSortModel,
|
|
27938
|
-
|
|
28041
|
+
propsOnPageChange,
|
|
28042
|
+
propsOnPageSizeChange
|
|
27939
28043
|
});
|
|
27940
28044
|
const {
|
|
27941
28045
|
columnVisibilityModel,
|
|
27942
28046
|
filterModel,
|
|
27943
28047
|
onColumnVisibilityModelChange,
|
|
27944
28048
|
onFilterModelChange,
|
|
27945
|
-
|
|
28049
|
+
onPageChange,
|
|
28050
|
+
onPageSizeChange,
|
|
27946
28051
|
onPinnedColumnsChange,
|
|
27947
28052
|
onSortModelChange,
|
|
27948
|
-
|
|
28053
|
+
page,
|
|
28054
|
+
pageSize,
|
|
27949
28055
|
pinnedColumns,
|
|
27950
28056
|
sortModel,
|
|
27951
28057
|
onColumnWidthChange
|
|
@@ -27956,39 +28062,40 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27956
28062
|
onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
|
|
27957
28063
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
27958
28064
|
onFilterModelChange: controlledOnFilterModelChange,
|
|
27959
|
-
|
|
28065
|
+
onPageChange: controlledOnPageChange,
|
|
28066
|
+
onPageSizeChange: controlledOnPageSizeChange,
|
|
27960
28067
|
onPinnedColumnsChange: controlledOnPinnedColumnsChange,
|
|
27961
28068
|
onSortModelChange: controlledOnSortModelChange,
|
|
27962
28069
|
useRouter: useRouter,
|
|
27963
28070
|
localStorageVersion,
|
|
27964
28071
|
previousLocalStorageVersions
|
|
27965
28072
|
});
|
|
27966
|
-
const [
|
|
28073
|
+
const [selectionModel, setSelectionModel] = useState(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
|
|
27967
28074
|
useEffect(() => {
|
|
27968
|
-
|
|
27969
|
-
}, [
|
|
27970
|
-
const
|
|
27971
|
-
if (
|
|
27972
|
-
|
|
28075
|
+
setSelectionModel(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
|
|
28076
|
+
}, [propsSelectionModel]);
|
|
28077
|
+
const onSelectionModelChange = (selectionModel, details) => {
|
|
28078
|
+
if (propsOnSelectionModelChange) {
|
|
28079
|
+
propsOnSelectionModelChange(selectionModel, details);
|
|
27973
28080
|
} else {
|
|
27974
|
-
|
|
28081
|
+
setSelectionModel(selectionModel);
|
|
27975
28082
|
}
|
|
27976
28083
|
};
|
|
27977
28084
|
const selectionStatus = useRef({
|
|
27978
28085
|
type: 'none',
|
|
27979
28086
|
numberOfSelectedRows: 0,
|
|
27980
28087
|
numberOfSelectedRowsInPage: 0,
|
|
27981
|
-
page
|
|
27982
|
-
pageSize:
|
|
28088
|
+
page,
|
|
28089
|
+
pageSize: pageSize
|
|
27983
28090
|
});
|
|
27984
28091
|
|
|
27985
28092
|
// in server-side pagination we want to update the selection status
|
|
27986
28093
|
// every time we navigate between pages, resize our page or select something
|
|
27987
28094
|
useEffect(() => {
|
|
27988
28095
|
if (paginationMode == 'server') {
|
|
27989
|
-
onServerSideSelectionStatusChange(Array.isArray(
|
|
28096
|
+
onServerSideSelectionStatusChange(Array.isArray(selectionModel) ? selectionModel : [selectionModel], apiRef, selectionStatus, isRowSelectable, page, pageSize);
|
|
27990
28097
|
}
|
|
27991
|
-
}, [
|
|
28098
|
+
}, [selectionModel, page, pageSize]);
|
|
27992
28099
|
if (!Array.isArray(rows)) {
|
|
27993
28100
|
return null;
|
|
27994
28101
|
}
|
|
@@ -28021,13 +28128,15 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
28021
28128
|
filterModel: filterModel,
|
|
28022
28129
|
onColumnVisibilityModelChange: onColumnVisibilityModelChange,
|
|
28023
28130
|
onFilterModelChange: onFilterModelChange,
|
|
28024
|
-
|
|
28131
|
+
onPageChange: onPageChange,
|
|
28132
|
+
onPageSizeChange: onPageSizeChange,
|
|
28025
28133
|
onPinnedColumnsChange: onPinnedColumnsChange,
|
|
28026
28134
|
onSortModelChange: onSortModelChange,
|
|
28027
|
-
|
|
28135
|
+
page: page,
|
|
28136
|
+
pageSize: pageSize,
|
|
28028
28137
|
pinnedColumns: pinnedColumns,
|
|
28029
28138
|
sortModel: sortModel,
|
|
28030
|
-
|
|
28139
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
28031
28140
|
onColumnWidthChange: onColumnWidthChange,
|
|
28032
28141
|
initialState: initialState,
|
|
28033
28142
|
isRowSelectable: isRowSelectable,
|
|
@@ -28038,55 +28147,58 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
28038
28147
|
rowCount: rowCount,
|
|
28039
28148
|
autoHeight: autoHeight,
|
|
28040
28149
|
checkboxSelectionVisibleOnly: Boolean(pagination),
|
|
28041
|
-
|
|
28042
|
-
|
|
28043
|
-
|
|
28044
|
-
|
|
28045
|
-
|
|
28046
|
-
|
|
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, {
|
|
28047
28157
|
displayName: "ColumnFilteredIcon"
|
|
28048
28158
|
})),
|
|
28049
|
-
|
|
28159
|
+
ColumnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
28050
28160
|
displayName: "ColumnSelectorIcon"
|
|
28051
28161
|
})),
|
|
28052
|
-
|
|
28162
|
+
ColumnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
28053
28163
|
displayName: "ColumnSortedAscendingIcon"
|
|
28054
28164
|
})),
|
|
28055
|
-
|
|
28165
|
+
ColumnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
28056
28166
|
displayName: "ColumnSortedDescendingIcon"
|
|
28057
28167
|
})),
|
|
28058
|
-
|
|
28168
|
+
DensityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
28059
28169
|
displayName: "DensityCompactIcon"
|
|
28060
28170
|
})),
|
|
28061
|
-
|
|
28171
|
+
DensityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
28062
28172
|
displayName: "DensityStandardIcon"
|
|
28063
28173
|
})),
|
|
28064
|
-
|
|
28174
|
+
DensityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
28065
28175
|
displayName: "DensityComfortableIcon"
|
|
28066
28176
|
})),
|
|
28067
|
-
|
|
28177
|
+
DetailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
28068
28178
|
displayName: "DetailPanelCollapseIcon"
|
|
28069
28179
|
})),
|
|
28070
|
-
|
|
28180
|
+
DetailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
28071
28181
|
displayName: "DetailPanelExpandIcon"
|
|
28072
28182
|
})),
|
|
28073
|
-
|
|
28183
|
+
ExportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
28074
28184
|
displayName: "ExportIcon"
|
|
28075
28185
|
})),
|
|
28076
|
-
|
|
28186
|
+
OpenFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
|
|
28077
28187
|
displayName: "OpenFilterButtonIcon"
|
|
28078
28188
|
}, props))
|
|
28079
|
-
},
|
|
28080
|
-
|
|
28081
|
-
|
|
28189
|
+
}, components), {}, {
|
|
28190
|
+
Toolbar: ToolbarWrapper,
|
|
28191
|
+
Pagination: props => {
|
|
28082
28192
|
return pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$1({}, props, {
|
|
28083
28193
|
displaySelection: false,
|
|
28084
28194
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
28085
28195
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
28086
28196
|
selectionStatus: selectionStatus.current,
|
|
28087
|
-
|
|
28088
|
-
|
|
28089
|
-
|
|
28197
|
+
page: page,
|
|
28198
|
+
pageSize: pageSize,
|
|
28199
|
+
onPageChange: onPageChange,
|
|
28200
|
+
onPageSizeChange: onPageSizeChange,
|
|
28201
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
28090
28202
|
paginationProps: paginationProps,
|
|
28091
28203
|
paginationMode: paginationMode,
|
|
28092
28204
|
rowCount: rowCount
|
|
@@ -28097,15 +28209,17 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
28097
28209
|
selectionStatus: selectionStatus.current,
|
|
28098
28210
|
apiRef: apiRef,
|
|
28099
28211
|
isRowSelectable: isRowSelectable,
|
|
28100
|
-
|
|
28101
|
-
|
|
28102
|
-
|
|
28212
|
+
page: page,
|
|
28213
|
+
pageSize: pageSize,
|
|
28214
|
+
onPageChange: onPageChange,
|
|
28215
|
+
onPageSizeChange: onPageSizeChange,
|
|
28216
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
28103
28217
|
paginationProps: paginationProps,
|
|
28104
28218
|
paginationMode: paginationMode
|
|
28105
28219
|
})) : null;
|
|
28106
28220
|
}
|
|
28107
28221
|
}),
|
|
28108
|
-
|
|
28222
|
+
componentsProps: _objectSpread2(_objectSpread2({}, componentsProps), {}, {
|
|
28109
28223
|
toolbar: _objectSpread2({
|
|
28110
28224
|
hideToolbar,
|
|
28111
28225
|
RenderedToolbar,
|
|
@@ -28116,16 +28230,18 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
28116
28230
|
selectionStatus,
|
|
28117
28231
|
apiRef,
|
|
28118
28232
|
isRowSelectable,
|
|
28119
|
-
|
|
28120
|
-
|
|
28121
|
-
|
|
28233
|
+
page,
|
|
28234
|
+
pageSize,
|
|
28235
|
+
onPageChange,
|
|
28236
|
+
onPageSizeChange,
|
|
28237
|
+
rowsPerPageOptions,
|
|
28122
28238
|
paginationProps,
|
|
28123
28239
|
paginationMode,
|
|
28124
28240
|
rowCount
|
|
28125
|
-
},
|
|
28241
|
+
}, componentsProps === null || componentsProps === void 0 ? void 0 : componentsProps.toolbar)
|
|
28126
28242
|
}),
|
|
28127
|
-
|
|
28128
|
-
|
|
28243
|
+
selectionModel: selectionModel,
|
|
28244
|
+
onSelectionModelChange: (newSelectionModel, details) => {
|
|
28129
28245
|
if (pagination && paginationMode != 'server') {
|
|
28130
28246
|
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
|
|
28131
28247
|
let {
|
|
@@ -28183,7 +28299,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
28183
28299
|
};
|
|
28184
28300
|
}
|
|
28185
28301
|
}
|
|
28186
|
-
|
|
28302
|
+
onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(newSelectionModel, details);
|
|
28187
28303
|
},
|
|
28188
28304
|
sx: _objectSpread2(_objectSpread2({}, sx), {}, {
|
|
28189
28305
|
'.MuiDataGrid-columnHeaders': {
|
|
@@ -28257,5 +28373,5 @@ const TextCell = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
28257
28373
|
TextCell.className = CLASSNAME;
|
|
28258
28374
|
TextCell.displayName = COMPONENT_NAME;
|
|
28259
28375
|
|
|
28260
|
-
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 };
|
|
28261
28377
|
//# sourceMappingURL=index.js.map
|