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