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