@redsift/table 11.2.2 → 11.3.0-muiv5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +39 -30
- package/index.js +506 -383
- package/index.js.map +1 -1
- package/package.json +6 -6
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GRID_DETAIL_PANEL_TOGGLE_COL_DEF, getGridNumericOperators as getGridNumericOperators$1, GridFilterInputValue, GridFilterInputMultipleValue, getGridStringOperators as getGridStringOperators$1, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators,
|
|
1
|
+
import { GRID_DETAIL_PANEL_TOGGLE_COL_DEF, getGridNumericOperators as getGridNumericOperators$1, GridFilterInputValue, GridFilterInputMultipleValue, getGridStringOperators as getGridStringOperators$1, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators, GridLinkOperator, GridToolbarContainer, GridToolbarFilterButton, GridToolbarColumnsButton, GridToolbarDensitySelector, GridToolbarExport, gridVisibleSortedRowIdsSelector, gridPaginatedVisibleSortedGridRowEntriesSelector, gridPaginatedVisibleSortedGridRowIdsSelector, gridFilteredSortedRowEntriesSelector, gridFilteredSortedRowIdsSelector, useGridApiRef, DataGridPro } from '@mui/x-data-grid-pro';
|
|
2
2
|
export { getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators } from '@mui/x-data-grid-pro';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import React__default, { Children, isValidElement, cloneElement, forwardRef, useLayoutEffect, useEffect, useRef, useContext, useState, useCallback, createElement, useMemo } from 'react';
|
|
@@ -17639,7 +17639,7 @@ const isBetweenOperator = {
|
|
|
17639
17639
|
label: 'is between',
|
|
17640
17640
|
value: 'isBetween',
|
|
17641
17641
|
getApplyFilterFn: filterItem => {
|
|
17642
|
-
if (!filterItem.
|
|
17642
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17643
17643
|
return null;
|
|
17644
17644
|
}
|
|
17645
17645
|
if (!Array.isArray(filterItem.value) || filterItem.value.length !== 2) {
|
|
@@ -17652,7 +17652,7 @@ const isBetweenOperator = {
|
|
|
17652
17652
|
return null;
|
|
17653
17653
|
}
|
|
17654
17654
|
return params => {
|
|
17655
|
-
return params.value !== null &&
|
|
17655
|
+
return params.value !== null && filterItem.value[0] <= params.value && params.value <= filterItem.value[1];
|
|
17656
17656
|
};
|
|
17657
17657
|
},
|
|
17658
17658
|
InputComponent: InputNumberInterval
|
|
@@ -17665,7 +17665,7 @@ const doesNotEqual = {
|
|
|
17665
17665
|
label: 'does not equal',
|
|
17666
17666
|
value: 'doesNotEqual',
|
|
17667
17667
|
getApplyFilterFn: filterItem => {
|
|
17668
|
-
if (!filterItem.
|
|
17668
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17669
17669
|
return null;
|
|
17670
17670
|
}
|
|
17671
17671
|
return params => {
|
|
@@ -17686,7 +17686,7 @@ const doesNotContain = {
|
|
|
17686
17686
|
label: 'does not contain',
|
|
17687
17687
|
value: 'doesNotContain',
|
|
17688
17688
|
getApplyFilterFn: filterItem => {
|
|
17689
|
-
if (!filterItem.
|
|
17689
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17690
17690
|
return null;
|
|
17691
17691
|
}
|
|
17692
17692
|
return params => {
|
|
@@ -17707,7 +17707,7 @@ const containsAnyOfOperator = {
|
|
|
17707
17707
|
label: 'contains any of',
|
|
17708
17708
|
value: 'containsAnyOf',
|
|
17709
17709
|
getApplyFilterFn: filterItem => {
|
|
17710
|
-
if (!filterItem.
|
|
17710
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17711
17711
|
return null;
|
|
17712
17712
|
}
|
|
17713
17713
|
return params => {
|
|
@@ -17730,7 +17730,7 @@ const containsAnyOfCIOperator = {
|
|
|
17730
17730
|
label: 'contains any of (case insensitive)',
|
|
17731
17731
|
value: 'containsAnyOf',
|
|
17732
17732
|
getApplyFilterFn: filterItem => {
|
|
17733
|
-
if (!filterItem.
|
|
17733
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17734
17734
|
return null;
|
|
17735
17735
|
}
|
|
17736
17736
|
return params => {
|
|
@@ -17757,7 +17757,7 @@ const endsWithAnyOfOperator = {
|
|
|
17757
17757
|
label: 'ends with any of',
|
|
17758
17758
|
value: 'endsWithAnyOf',
|
|
17759
17759
|
getApplyFilterFn: filterItem => {
|
|
17760
|
-
if (!filterItem.
|
|
17760
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17761
17761
|
return null;
|
|
17762
17762
|
}
|
|
17763
17763
|
return params => {
|
|
@@ -17784,7 +17784,7 @@ const isAnyOfOperator = {
|
|
|
17784
17784
|
label: 'is any of',
|
|
17785
17785
|
value: 'isAnyOf',
|
|
17786
17786
|
getApplyFilterFn: filterItem => {
|
|
17787
|
-
if (!filterItem.
|
|
17787
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17788
17788
|
return null;
|
|
17789
17789
|
}
|
|
17790
17790
|
return params => {
|
|
@@ -17808,7 +17808,7 @@ const isNotAnyOfOperator = {
|
|
|
17808
17808
|
label: 'is not any of',
|
|
17809
17809
|
value: 'isNotAnyOf',
|
|
17810
17810
|
getApplyFilterFn: filterItem => {
|
|
17811
|
-
if (!filterItem.
|
|
17811
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17812
17812
|
return null;
|
|
17813
17813
|
}
|
|
17814
17814
|
return params => {
|
|
@@ -17832,7 +17832,7 @@ const startsWithAnyOfOperator = {
|
|
|
17832
17832
|
label: 'starts with any of',
|
|
17833
17833
|
value: 'startsWithAnyOf',
|
|
17834
17834
|
getApplyFilterFn: filterItem => {
|
|
17835
|
-
if (!filterItem.
|
|
17835
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17836
17836
|
return null;
|
|
17837
17837
|
}
|
|
17838
17838
|
return params => {
|
|
@@ -17877,13 +17877,13 @@ const operatorList = {
|
|
|
17877
17877
|
|
|
17878
17878
|
const getRsStringColumnType = () => {
|
|
17879
17879
|
return {
|
|
17880
|
-
|
|
17880
|
+
extendType: 'string',
|
|
17881
17881
|
filterOperators: operatorList.rsString
|
|
17882
17882
|
};
|
|
17883
17883
|
};
|
|
17884
17884
|
const getRsNumberColumnType = () => {
|
|
17885
17885
|
return {
|
|
17886
|
-
|
|
17886
|
+
extendType: 'number',
|
|
17887
17887
|
filterOperators: operatorList.rsNumber
|
|
17888
17888
|
};
|
|
17889
17889
|
};
|
|
@@ -17894,7 +17894,7 @@ const customColumnTypes = {
|
|
|
17894
17894
|
|
|
17895
17895
|
const API_URL = 'https://api.openai.com/v1/chat/completions';
|
|
17896
17896
|
async function getCompletion(text, role, openai_api_key) {
|
|
17897
|
-
let model = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'gpt-3.5-turbo-
|
|
17897
|
+
let model = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'gpt-3.5-turbo-0613';
|
|
17898
17898
|
try {
|
|
17899
17899
|
const messages = [{
|
|
17900
17900
|
role: 'system',
|
|
@@ -17939,45 +17939,43 @@ const buildStorageKey = _ref => {
|
|
|
17939
17939
|
} = _ref;
|
|
17940
17940
|
return `${id}:${version}:${category}`;
|
|
17941
17941
|
};
|
|
17942
|
-
const clearPreviousVersionStorage = (id,
|
|
17943
|
-
const
|
|
17944
|
-
|
|
17945
|
-
|
|
17946
|
-
|
|
17947
|
-
|
|
17948
|
-
|
|
17949
|
-
|
|
17950
|
-
|
|
17951
|
-
|
|
17952
|
-
|
|
17953
|
-
|
|
17954
|
-
|
|
17955
|
-
|
|
17956
|
-
|
|
17957
|
-
|
|
17958
|
-
|
|
17959
|
-
|
|
17960
|
-
|
|
17961
|
-
|
|
17962
|
-
|
|
17963
|
-
|
|
17964
|
-
|
|
17965
|
-
|
|
17966
|
-
|
|
17967
|
-
|
|
17968
|
-
|
|
17969
|
-
|
|
17970
|
-
|
|
17971
|
-
|
|
17972
|
-
|
|
17973
|
-
|
|
17974
|
-
|
|
17975
|
-
|
|
17976
|
-
|
|
17977
|
-
|
|
17978
|
-
|
|
17979
|
-
} catch (e) {
|
|
17980
|
-
// Ignore
|
|
17942
|
+
const clearPreviousVersionStorage = (id, previousLocalStorageVersions) => {
|
|
17943
|
+
for (const version of previousLocalStorageVersions) {
|
|
17944
|
+
const keysToDelete = [buildStorageKey({
|
|
17945
|
+
id,
|
|
17946
|
+
version,
|
|
17947
|
+
category: PAGINATION_MODEL_KEY
|
|
17948
|
+
}), buildStorageKey({
|
|
17949
|
+
id,
|
|
17950
|
+
version,
|
|
17951
|
+
category: SORT_MODEL_KEY
|
|
17952
|
+
}), buildStorageKey({
|
|
17953
|
+
id,
|
|
17954
|
+
version,
|
|
17955
|
+
category: FILTER_MODEL_KEY
|
|
17956
|
+
}), buildStorageKey({
|
|
17957
|
+
id,
|
|
17958
|
+
version,
|
|
17959
|
+
category: VISIBILITY_MODEL_KEY
|
|
17960
|
+
}), buildStorageKey({
|
|
17961
|
+
id,
|
|
17962
|
+
version,
|
|
17963
|
+
category: PINNED_COLUMNS
|
|
17964
|
+
}), buildStorageKey({
|
|
17965
|
+
id,
|
|
17966
|
+
version,
|
|
17967
|
+
category: FILTER_SEARCH_KEY
|
|
17968
|
+
}), buildStorageKey({
|
|
17969
|
+
id,
|
|
17970
|
+
version,
|
|
17971
|
+
category: DIMENSION_MODEL_KEY
|
|
17972
|
+
})];
|
|
17973
|
+
for (const keyToDelete of keysToDelete) {
|
|
17974
|
+
try {
|
|
17975
|
+
window.localStorage.removeItem(keyToDelete);
|
|
17976
|
+
} catch (e) {
|
|
17977
|
+
// Ignore
|
|
17978
|
+
}
|
|
17981
17979
|
}
|
|
17982
17980
|
}
|
|
17983
17981
|
};
|
|
@@ -18063,39 +18061,42 @@ const numberOperatorDecoder = {
|
|
|
18063
18061
|
lt: '<',
|
|
18064
18062
|
lte: '<='
|
|
18065
18063
|
};
|
|
18066
|
-
const isOperatorValueValid = (
|
|
18067
|
-
const column = columns.find(column => column.field ===
|
|
18064
|
+
const isOperatorValueValid = (columnField, operatorValue, columns) => {
|
|
18065
|
+
const column = columns.find(column => column.field === columnField);
|
|
18068
18066
|
if (!column) {
|
|
18069
18067
|
return false;
|
|
18070
18068
|
}
|
|
18071
18069
|
const columnType = (column === null || column === void 0 ? void 0 : column.type) || 'string';
|
|
18072
|
-
const operators =
|
|
18070
|
+
const operators = operatorList[columnType];
|
|
18073
18071
|
if (!operators) {
|
|
18074
18072
|
return false;
|
|
18075
18073
|
}
|
|
18076
|
-
|
|
18074
|
+
if ('filterOperators' in operators) {
|
|
18075
|
+
return !!operators.filterOperators.find(op => columnType === 'number' && Object.keys(numberOperatorEncoder).includes(op.value) ? numberOperatorEncoder[op.value] === operatorValue : op['value'] === operatorValue);
|
|
18076
|
+
}
|
|
18077
|
+
return !!operators.find(op => ['number', 'rsNumber'].includes(columnType) && Object.keys(numberOperatorEncoder).includes(op.value) ? numberOperatorEncoder[op.value] === operatorValue : op['value'] === operatorValue);
|
|
18077
18078
|
};
|
|
18078
18079
|
const listOperators = ['containsAnyOf', 'endsWithAnyOf', 'isAnyOf', 'isNotAnyOf', 'startsWithAnyOf'];
|
|
18079
18080
|
|
|
18080
18081
|
// Check if the value doesn't break
|
|
18081
|
-
const isValueValid = (value,
|
|
18082
|
+
const isValueValid = (value, columnField, columns, operatorValue) => {
|
|
18082
18083
|
var _column$type;
|
|
18083
18084
|
// every field accepts undefined as value for default
|
|
18084
18085
|
if (value === undefined || value === '') {
|
|
18085
18086
|
return true;
|
|
18086
18087
|
}
|
|
18087
18088
|
|
|
18088
|
-
// xxxAnyOf accepts as value only lists, and we are
|
|
18089
|
+
// xxxAnyOf accepts as value only lists, and we are declearing them in the
|
|
18089
18090
|
// URL as `list=[...]`
|
|
18090
|
-
if (listOperators.includes(
|
|
18091
|
+
if (listOperators.includes(operatorValue)) {
|
|
18091
18092
|
return Array.isArray(value) || value === '';
|
|
18092
18093
|
}
|
|
18093
18094
|
|
|
18094
18095
|
// We are accepting arrays only if they are of the 'xxxAnyOf' type
|
|
18095
|
-
if (Array.isArray(value) && !listOperators.includes(
|
|
18096
|
+
if (Array.isArray(value) && !listOperators.includes(operatorValue)) {
|
|
18096
18097
|
return false;
|
|
18097
18098
|
}
|
|
18098
|
-
const column = columns.find(column => column.field ===
|
|
18099
|
+
const column = columns.find(column => column.field === columnField);
|
|
18099
18100
|
if (!column) {
|
|
18100
18101
|
return false;
|
|
18101
18102
|
}
|
|
@@ -18133,14 +18134,14 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
18133
18134
|
if (!searchString) {
|
|
18134
18135
|
return 'invalid';
|
|
18135
18136
|
}
|
|
18136
|
-
let
|
|
18137
|
+
let linkOperator = GridLinkOperator.And;
|
|
18137
18138
|
const searchParams = new URLSearchParams();
|
|
18138
18139
|
for (const [key, value] of new URLSearchParams(searchString)) {
|
|
18139
18140
|
if (key.startsWith('_') && !['_logicOperator', '_sortColumn', '_pinnedColumnsLeft', '_pinnedColumnsRight', '_columnVisibility', '_pagination'].includes(key)) {
|
|
18140
18141
|
searchParams.set(key, value);
|
|
18141
18142
|
}
|
|
18142
18143
|
if (key === '_logicOperator') {
|
|
18143
|
-
|
|
18144
|
+
linkOperator = value;
|
|
18144
18145
|
}
|
|
18145
18146
|
}
|
|
18146
18147
|
let id = 5000;
|
|
@@ -18181,8 +18182,8 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
18181
18182
|
return;
|
|
18182
18183
|
}
|
|
18183
18184
|
items.push({
|
|
18184
|
-
field,
|
|
18185
|
-
|
|
18185
|
+
columnField: field,
|
|
18186
|
+
operatorValue: ['number', 'rsNumber'].includes(columnType) && Object.keys(numberOperatorDecoder).includes(operator) ? numberOperatorDecoder[operator] : operator,
|
|
18186
18187
|
id,
|
|
18187
18188
|
value: listOperators.includes(operator) && decodedValue === '' ? [] : decodedValue,
|
|
18188
18189
|
type
|
|
@@ -18197,23 +18198,23 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
18197
18198
|
}
|
|
18198
18199
|
return {
|
|
18199
18200
|
items,
|
|
18200
|
-
|
|
18201
|
+
linkOperator
|
|
18201
18202
|
};
|
|
18202
18203
|
};
|
|
18203
18204
|
const getSearchParamsFromFilterModel = filterModel => {
|
|
18204
18205
|
const searchParams = new URLSearchParams();
|
|
18205
|
-
searchParams.set('_logicOperator', filterModel['
|
|
18206
|
+
searchParams.set('_logicOperator', filterModel['linkOperator'] || '');
|
|
18206
18207
|
filterModel['items'].forEach(item => {
|
|
18207
18208
|
const {
|
|
18208
|
-
|
|
18209
|
-
|
|
18209
|
+
columnField,
|
|
18210
|
+
operatorValue,
|
|
18210
18211
|
value,
|
|
18211
18212
|
type
|
|
18212
18213
|
} = item;
|
|
18213
|
-
if (Object.keys(numberOperatorEncoder).includes(
|
|
18214
|
-
searchParams.set(`_${
|
|
18214
|
+
if (Object.keys(numberOperatorEncoder).includes(operatorValue)) {
|
|
18215
|
+
searchParams.set(`_${columnField}[${numberOperatorEncoder[operatorValue]},${encodeValue(type)}]`, encodeValue(value));
|
|
18215
18216
|
} else {
|
|
18216
|
-
searchParams.set(`_${
|
|
18217
|
+
searchParams.set(`_${columnField}[${encodeValue(operatorValue)},${encodeValue(type)}]`, encodeValue(value));
|
|
18217
18218
|
}
|
|
18218
18219
|
});
|
|
18219
18220
|
return searchParams;
|
|
@@ -18223,7 +18224,14 @@ const getSearchParamsFromFilterModel = filterModel => {
|
|
|
18223
18224
|
// - if we have something in the URL, use that info
|
|
18224
18225
|
// - if we don't have that, use the localStorage and update the URL
|
|
18225
18226
|
// - if we don't have that, return an empty FilterModel
|
|
18226
|
-
const getFilterModel = (search, columns, localStorageFilters, setLocalStorageFilters, initialState) => {
|
|
18227
|
+
const getFilterModel = (search, columns, localStorageFilters, setLocalStorageFilters, initialState, isNewVersion) => {
|
|
18228
|
+
const defaultValue = initialState && initialState.filter && initialState.filter.filterModel ? initialState.filter.filterModel : {
|
|
18229
|
+
items: [],
|
|
18230
|
+
linkOperator: GridLinkOperator.And
|
|
18231
|
+
};
|
|
18232
|
+
if (isNewVersion) {
|
|
18233
|
+
return defaultValue;
|
|
18234
|
+
}
|
|
18227
18235
|
const filterModelFromSearch = getFilterModelFromString(search, columns);
|
|
18228
18236
|
if (filterModelFromSearch !== 'invalid') {
|
|
18229
18237
|
const searchFromFilterModel = getSearchParamsFromFilterModel(filterModelFromSearch);
|
|
@@ -18237,10 +18245,7 @@ const getFilterModel = (search, columns, localStorageFilters, setLocalStorageFil
|
|
|
18237
18245
|
if (filterModelFromLocalStorage !== 'invalid') {
|
|
18238
18246
|
return filterModelFromLocalStorage;
|
|
18239
18247
|
}
|
|
18240
|
-
return
|
|
18241
|
-
items: [],
|
|
18242
|
-
logicOperator: GridLogicOperator.And
|
|
18243
|
-
};
|
|
18248
|
+
return defaultValue;
|
|
18244
18249
|
};
|
|
18245
18250
|
|
|
18246
18251
|
/** SORT */
|
|
@@ -18274,8 +18279,12 @@ const getSearchParamsFromSorting = sorting => {
|
|
|
18274
18279
|
// - if we have something in the URL, use that info
|
|
18275
18280
|
// - if we don't have that, use the localStorage and update the URL
|
|
18276
18281
|
// - if we don't have that, return an empty SortModel
|
|
18277
|
-
const getSortModel = (search, columns, localStorageSorting, setLocalStorageSorting, initialState) => {
|
|
18282
|
+
const getSortModel = (search, columns, localStorageSorting, setLocalStorageSorting, initialState, isNewVersion) => {
|
|
18278
18283
|
var _initialState$sorting;
|
|
18284
|
+
const defaultValue = initialState !== null && initialState !== void 0 && (_initialState$sorting = initialState.sorting) !== null && _initialState$sorting !== void 0 && _initialState$sorting.sortModel ? initialState.sorting.sortModel : [];
|
|
18285
|
+
if (isNewVersion) {
|
|
18286
|
+
return defaultValue;
|
|
18287
|
+
}
|
|
18279
18288
|
const sorting = getSortingFromString(search, columns);
|
|
18280
18289
|
if (sorting !== 'invalid') {
|
|
18281
18290
|
const searchFromSortModel = getSearchParamsFromSorting(sorting);
|
|
@@ -18289,7 +18298,7 @@ const getSortModel = (search, columns, localStorageSorting, setLocalStorageSorti
|
|
|
18289
18298
|
if (sortModelFromLocalStorage !== 'invalid') {
|
|
18290
18299
|
return sortModelFromLocalStorage;
|
|
18291
18300
|
}
|
|
18292
|
-
return
|
|
18301
|
+
return defaultValue;
|
|
18293
18302
|
};
|
|
18294
18303
|
|
|
18295
18304
|
/** PAGINATION */
|
|
@@ -18326,8 +18335,19 @@ const getSearchParamsFromPagination = pagination => {
|
|
|
18326
18335
|
// - if we have something in the URL, use that info
|
|
18327
18336
|
// - if we don't have that, use the localStorage and update the URL
|
|
18328
18337
|
// - if we don't have that, return an empty PaginationModel
|
|
18329
|
-
const getPaginationModel = (search, localStoragePagination, setLocalStoragePagination, initialState) => {
|
|
18330
|
-
|
|
18338
|
+
const getPaginationModel = (search, localStoragePagination, setLocalStoragePagination, initialState, isNewVersion) => {
|
|
18339
|
+
const defaultValue = initialState !== null && initialState !== void 0 && initialState.pagination ? _objectSpread2({
|
|
18340
|
+
page: 0,
|
|
18341
|
+
pageSize: 25,
|
|
18342
|
+
direction: 'next'
|
|
18343
|
+
}, initialState.pagination) : {
|
|
18344
|
+
page: 0,
|
|
18345
|
+
pageSize: 25,
|
|
18346
|
+
direction: 'next'
|
|
18347
|
+
};
|
|
18348
|
+
if (isNewVersion) {
|
|
18349
|
+
return defaultValue;
|
|
18350
|
+
}
|
|
18331
18351
|
const pagination = getPaginationFromString(search);
|
|
18332
18352
|
if (pagination !== 'invalid') {
|
|
18333
18353
|
const searchFromPaginationModel = getSearchParamsFromPagination(pagination);
|
|
@@ -18341,51 +18361,18 @@ const getPaginationModel = (search, localStoragePagination, setLocalStoragePagin
|
|
|
18341
18361
|
if (paginationModelFromLocalStorage !== 'invalid') {
|
|
18342
18362
|
return paginationModelFromLocalStorage;
|
|
18343
18363
|
}
|
|
18344
|
-
return
|
|
18345
|
-
page: 0,
|
|
18346
|
-
pageSize: 25,
|
|
18347
|
-
direction: 'next'
|
|
18348
|
-
}, initialState.pagination.paginationModel) : {
|
|
18349
|
-
page: 0,
|
|
18350
|
-
pageSize: 25,
|
|
18351
|
-
direction: 'next'
|
|
18352
|
-
};
|
|
18364
|
+
return defaultValue;
|
|
18353
18365
|
};
|
|
18354
18366
|
|
|
18355
18367
|
/** COLUMN VISIBILITY */
|
|
18356
18368
|
|
|
18357
|
-
const getColumnVisibilityFromString = (searchString, columns) => {
|
|
18358
|
-
if (!searchString) {
|
|
18359
|
-
return 'invalid';
|
|
18360
|
-
}
|
|
18361
|
-
const searchParams = new URLSearchParams(searchString);
|
|
18362
|
-
const value = searchParams.get('_columnVisibility');
|
|
18363
|
-
if (value === '' || value === null || value === '[]') {
|
|
18364
|
-
return 'invalid';
|
|
18365
|
-
}
|
|
18366
|
-
const parsedFields = value.slice(1, value.length - 1).split(',');
|
|
18367
|
-
const fields = columns.map(column => column.field);
|
|
18368
|
-
const visibility = {};
|
|
18369
|
-
for (const field of fields) {
|
|
18370
|
-
visibility[field] = false;
|
|
18371
|
-
}
|
|
18372
|
-
for (const parsedField of parsedFields) {
|
|
18373
|
-
if (fields.includes(parsedField)) {
|
|
18374
|
-
visibility[parsedField] = true;
|
|
18375
|
-
}
|
|
18376
|
-
}
|
|
18377
|
-
if (Object.values(visibility).filter(v => v === true).length === 0) {
|
|
18378
|
-
return 'invalid';
|
|
18379
|
-
}
|
|
18380
|
-
return visibility;
|
|
18381
|
-
};
|
|
18382
18369
|
const getSearchParamsFromColumnVisibility = (columnVisibility, columns) => {
|
|
18383
18370
|
const searchParams = new URLSearchParams();
|
|
18384
|
-
const
|
|
18371
|
+
const columnFields = columns.map(column => column.field);
|
|
18385
18372
|
|
|
18386
18373
|
// if column visibility model is empty, show all columns
|
|
18387
18374
|
if (Object.keys(columnVisibility).length == 0) {
|
|
18388
|
-
searchParams.set('_columnVisibility', `[${
|
|
18375
|
+
searchParams.set('_columnVisibility', `[${columnFields.join(',')}]`);
|
|
18389
18376
|
return searchParams;
|
|
18390
18377
|
}
|
|
18391
18378
|
const finalColumnVisibility = columns.filter(c => {
|
|
@@ -18396,10 +18383,63 @@ const getSearchParamsFromColumnVisibility = (columnVisibility, columns) => {
|
|
|
18396
18383
|
[colName]: true
|
|
18397
18384
|
});
|
|
18398
18385
|
}, columnVisibility);
|
|
18399
|
-
const visibleColumns =
|
|
18386
|
+
const visibleColumns = Object.entries(finalColumnVisibility)
|
|
18387
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
18388
|
+
.filter(_ref => {
|
|
18389
|
+
let [_, visible] = _ref;
|
|
18390
|
+
return visible;
|
|
18391
|
+
})
|
|
18392
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
18393
|
+
.map(_ref2 => {
|
|
18394
|
+
let [column, _] = _ref2;
|
|
18395
|
+
return encodeValue(column);
|
|
18396
|
+
});
|
|
18400
18397
|
searchParams.set('_columnVisibility', `[${visibleColumns.join(',')}]`);
|
|
18401
18398
|
return searchParams;
|
|
18402
18399
|
};
|
|
18400
|
+
const getColumnVisibilityFromString = (notParsed, tableColumns) => {
|
|
18401
|
+
if (!notParsed || notParsed.length === 1 && notParsed[0] === '?') {
|
|
18402
|
+
return 'invalid';
|
|
18403
|
+
}
|
|
18404
|
+
// remove the initial ? if present
|
|
18405
|
+
const parsed = notParsed[0] === '?' ? notParsed.slice(1) : notParsed;
|
|
18406
|
+
const visibility = {};
|
|
18407
|
+
let exist = false;
|
|
18408
|
+
let visibleColumnsCount = 0;
|
|
18409
|
+
for (const item of parsed.split('&')) {
|
|
18410
|
+
// if it's not column visibility field, skip
|
|
18411
|
+
const fieldURL = item.split('=')[0];
|
|
18412
|
+
if (fieldURL !== '_columnVisibility') {
|
|
18413
|
+
continue;
|
|
18414
|
+
}
|
|
18415
|
+
// e.g. item = _columnVisibility[abc,def]
|
|
18416
|
+
const left = item.split(']')[0];
|
|
18417
|
+
if (left.split('[').length < 2) {
|
|
18418
|
+
continue;
|
|
18419
|
+
}
|
|
18420
|
+
const encodedValues = item.split('[')[1].split(']')[0];
|
|
18421
|
+
if (typeof encodedValues !== 'string') {
|
|
18422
|
+
continue;
|
|
18423
|
+
}
|
|
18424
|
+
exist = true;
|
|
18425
|
+
const columnFields = tableColumns.map(column => column.field);
|
|
18426
|
+
// TODO: Add validation that , is present
|
|
18427
|
+
const columns = encodedValues.split(',').map(value => decodeValue(value));
|
|
18428
|
+
|
|
18429
|
+
// for each column, check if it's visible and add it to visibility model
|
|
18430
|
+
for (const column of columnFields) {
|
|
18431
|
+
const isColumnVisible = columns.includes(column);
|
|
18432
|
+
visibility[column] = isColumnVisible;
|
|
18433
|
+
if (isColumnVisible) {
|
|
18434
|
+
visibleColumnsCount += 1;
|
|
18435
|
+
}
|
|
18436
|
+
}
|
|
18437
|
+
}
|
|
18438
|
+
if (visibleColumnsCount === 0 && !exist) {
|
|
18439
|
+
return 'invalid';
|
|
18440
|
+
}
|
|
18441
|
+
return visibility;
|
|
18442
|
+
};
|
|
18403
18443
|
|
|
18404
18444
|
// Rules:
|
|
18405
18445
|
// - if we have something in the URL, use that info
|
|
@@ -18407,8 +18447,17 @@ const getSearchParamsFromColumnVisibility = (columnVisibility, columns) => {
|
|
|
18407
18447
|
// - if we don't have that, return an empty ColumnVisibilityModel (which is all columns)
|
|
18408
18448
|
// NOTE: the `defaultHidden` is a custom field and not standard DataGrid
|
|
18409
18449
|
// The reason is the following bug: https://github.com/mui/mui-x/issues/8407
|
|
18410
|
-
const getColumnsVisibility = (search, columns, localStorageColumnsVisibility, setLocalStorageColumnsVisibility, initialState) => {
|
|
18450
|
+
const getColumnsVisibility = (search, columns, localStorageColumnsVisibility, setLocalStorageColumnsVisibility, initialState, isNewVersion) => {
|
|
18411
18451
|
var _initialState$columns;
|
|
18452
|
+
const defaultValue = {};
|
|
18453
|
+
for (const column of columns) {
|
|
18454
|
+
const field = column.field;
|
|
18455
|
+
defaultValue[field] = column.defaultHidden !== true; // undefined will be true
|
|
18456
|
+
}
|
|
18457
|
+
|
|
18458
|
+
if (isNewVersion) {
|
|
18459
|
+
return defaultValue;
|
|
18460
|
+
}
|
|
18412
18461
|
const columnVisibility = getColumnVisibilityFromString(search, columns);
|
|
18413
18462
|
if (columnVisibility !== 'invalid') {
|
|
18414
18463
|
const searchColumnVisibility = getSearchParamsFromColumnVisibility(columnVisibility, columns);
|
|
@@ -18424,15 +18473,7 @@ const getColumnsVisibility = (search, columns, localStorageColumnsVisibility, se
|
|
|
18424
18473
|
if (initialState !== null && initialState !== void 0 && (_initialState$columns = initialState.columns) !== null && _initialState$columns !== void 0 && _initialState$columns.columnVisibilityModel) {
|
|
18425
18474
|
return initialState.columns.columnVisibilityModel;
|
|
18426
18475
|
}
|
|
18427
|
-
|
|
18428
|
-
// No columns in URL or localStorage, just show them all expect the hidden ones
|
|
18429
|
-
const res = {};
|
|
18430
|
-
for (const column of columns) {
|
|
18431
|
-
const field = column.field;
|
|
18432
|
-
res[field] = column.defaultHidden !== true; // undefined will be true
|
|
18433
|
-
}
|
|
18434
|
-
|
|
18435
|
-
return res;
|
|
18476
|
+
return defaultValue;
|
|
18436
18477
|
};
|
|
18437
18478
|
const getPinnedColumnsFromString = (notParsed, tableColumns) => {
|
|
18438
18479
|
if (!notParsed || notParsed.length === 1 && notParsed[0] === '?') {
|
|
@@ -18454,8 +18495,8 @@ const getPinnedColumnsFromString = (notParsed, tableColumns) => {
|
|
|
18454
18495
|
if (typeof encodedValues !== 'string') {
|
|
18455
18496
|
continue;
|
|
18456
18497
|
}
|
|
18457
|
-
const
|
|
18458
|
-
const columns = encodedValues.split(',').map(value => decodeValue(value)).filter(val => typeof val === 'string' &&
|
|
18498
|
+
const columnFields = [...tableColumns.map(column => column.field), '__check__'];
|
|
18499
|
+
const columns = encodedValues.split(',').map(value => decodeValue(value)).filter(val => typeof val === 'string' && columnFields.includes(val));
|
|
18459
18500
|
if (fieldURL === '_pinnedColumnsLeft') {
|
|
18460
18501
|
pinnedColumns['left'] = columns;
|
|
18461
18502
|
}
|
|
@@ -18463,9 +18504,9 @@ const getPinnedColumnsFromString = (notParsed, tableColumns) => {
|
|
|
18463
18504
|
pinnedColumns['right'] = columns;
|
|
18464
18505
|
}
|
|
18465
18506
|
}
|
|
18466
|
-
return pinnedColumns
|
|
18467
|
-
left: pinnedColumns
|
|
18468
|
-
right: pinnedColumns
|
|
18507
|
+
return pinnedColumns['left'] || pinnedColumns['right'] ? {
|
|
18508
|
+
left: pinnedColumns['left'] || [],
|
|
18509
|
+
right: pinnedColumns['right'] || []
|
|
18469
18510
|
} : 'invalid';
|
|
18470
18511
|
};
|
|
18471
18512
|
const getSearchParamsFromPinnedColumns = pinnedColumns => {
|
|
@@ -18482,7 +18523,17 @@ const getSearchParamsFromPinnedColumns = pinnedColumns => {
|
|
|
18482
18523
|
// - if we have something in the URL, use that info
|
|
18483
18524
|
// - if we don't have that, use the localStorage and update the URL
|
|
18484
18525
|
// - if we don't have that, return an empty ColumnVisibilityModel (which is all columns)
|
|
18485
|
-
const getPinnedColumns = (search, columns, localStoragePinnedColumns, setLocalStoragePinnedColumns, initialState) => {
|
|
18526
|
+
const getPinnedColumns = (search, columns, localStoragePinnedColumns, setLocalStoragePinnedColumns, initialState, isNewVersion) => {
|
|
18527
|
+
const defaultValue = initialState !== null && initialState !== void 0 && initialState.pinnedColumns ? {
|
|
18528
|
+
left: (initialState === null || initialState === void 0 ? void 0 : initialState.pinnedColumns['left']) || [],
|
|
18529
|
+
right: (initialState === null || initialState === void 0 ? void 0 : initialState.pinnedColumns['right']) || []
|
|
18530
|
+
} : {
|
|
18531
|
+
left: [],
|
|
18532
|
+
right: []
|
|
18533
|
+
};
|
|
18534
|
+
if (isNewVersion) {
|
|
18535
|
+
return defaultValue;
|
|
18536
|
+
}
|
|
18486
18537
|
const pinnedColumns = getPinnedColumnsFromString(search, columns);
|
|
18487
18538
|
if (pinnedColumns !== 'invalid') {
|
|
18488
18539
|
const searchPinnedColumns = getSearchParamsFromPinnedColumns(pinnedColumns);
|
|
@@ -18495,19 +18546,7 @@ const getPinnedColumns = (search, columns, localStoragePinnedColumns, setLocalSt
|
|
|
18495
18546
|
if (pinnedColumnsFromLocalStorage !== 'invalid') {
|
|
18496
18547
|
return pinnedColumnsFromLocalStorage;
|
|
18497
18548
|
}
|
|
18498
|
-
|
|
18499
|
-
return {
|
|
18500
|
-
left: (initialState === null || initialState === void 0 ? void 0 : initialState.pinnedColumns['left']) || [],
|
|
18501
|
-
right: (initialState === null || initialState === void 0 ? void 0 : initialState.pinnedColumns['right']) || []
|
|
18502
|
-
};
|
|
18503
|
-
}
|
|
18504
|
-
|
|
18505
|
-
// No pinnedColumn in URL or localStorage, TODO: decide what is the default state
|
|
18506
|
-
const res = {
|
|
18507
|
-
left: [],
|
|
18508
|
-
right: []
|
|
18509
|
-
};
|
|
18510
|
-
return res;
|
|
18549
|
+
return defaultValue;
|
|
18511
18550
|
};
|
|
18512
18551
|
const getSearchParamsFromTab = search => {
|
|
18513
18552
|
const searchParams = new URLSearchParams();
|
|
@@ -18517,16 +18556,17 @@ const getSearchParamsFromTab = search => {
|
|
|
18517
18556
|
}
|
|
18518
18557
|
return searchParams;
|
|
18519
18558
|
};
|
|
18520
|
-
const getFinalSearch =
|
|
18559
|
+
const getFinalSearch = _ref3 => {
|
|
18521
18560
|
let {
|
|
18522
18561
|
search,
|
|
18562
|
+
localStorageVersion,
|
|
18523
18563
|
filterModel,
|
|
18524
18564
|
sortModel,
|
|
18525
18565
|
paginationModel,
|
|
18526
18566
|
columnsVisibilityModel,
|
|
18527
18567
|
pinnedColumnsModel,
|
|
18528
18568
|
columns
|
|
18529
|
-
} =
|
|
18569
|
+
} = _ref3;
|
|
18530
18570
|
const filterModelSearch = getSearchParamsFromFilterModel(filterModel);
|
|
18531
18571
|
const sortModelSearch = getSearchParamsFromSorting(sortModel);
|
|
18532
18572
|
const paginationModelSearch = getSearchParamsFromPagination(paginationModel);
|
|
@@ -18539,10 +18579,13 @@ const getFinalSearch = _ref => {
|
|
|
18539
18579
|
searchParams.set(key, value);
|
|
18540
18580
|
}
|
|
18541
18581
|
}
|
|
18582
|
+
searchParams.set('v', `${localStorageVersion}`);
|
|
18542
18583
|
return new URLSearchParams([...searchParams, ...filterModelSearch, ...sortModelSearch, ...paginationModelSearch, ...tabSearch, ...pinnedColumnsModelSearch, ...columnVisibilityModelSearch]);
|
|
18543
18584
|
};
|
|
18544
18585
|
/** Return the state of the table given the URL and the local storage state */
|
|
18545
|
-
const getModelsParsedOrUpdateLocalStorage = (search, columns, historyReplace, initialState, localStorage) => {
|
|
18586
|
+
const getModelsParsedOrUpdateLocalStorage = (search, localStorageVersion, columns, historyReplace, initialState, localStorage) => {
|
|
18587
|
+
const currentVersion = new URLSearchParams(search).get('v');
|
|
18588
|
+
const isNewVersion = !currentVersion || Number(currentVersion) !== localStorageVersion;
|
|
18546
18589
|
const {
|
|
18547
18590
|
localStorageFilters,
|
|
18548
18591
|
setLocalStorageFilters,
|
|
@@ -18555,12 +18598,13 @@ const getModelsParsedOrUpdateLocalStorage = (search, columns, historyReplace, in
|
|
|
18555
18598
|
localStoragePinnedColumns,
|
|
18556
18599
|
setLocalStoragePinnedColumns
|
|
18557
18600
|
} = localStorage;
|
|
18558
|
-
const filterModel = getFilterModel(search, columns, localStorageFilters, setLocalStorageFilters, initialState);
|
|
18559
|
-
const sortModel = getSortModel(search, columns, localStorageSorting, setLocalStorageSorting, initialState);
|
|
18560
|
-
const paginationModel = getPaginationModel(search, localStoragePagination, setLocalStoragePagination, initialState);
|
|
18561
|
-
const columnVisibilityModel = getColumnsVisibility(search, columns, localStorageColumnsVisibility, setLocalStorageColumnsVisibility, initialState);
|
|
18562
|
-
const pinnedColumnsModel = getPinnedColumns(search, columns, localStoragePinnedColumns, setLocalStoragePinnedColumns, initialState);
|
|
18601
|
+
const filterModel = getFilterModel(search, columns, localStorageFilters, setLocalStorageFilters, initialState, isNewVersion);
|
|
18602
|
+
const sortModel = getSortModel(search, columns, localStorageSorting, setLocalStorageSorting, initialState, isNewVersion);
|
|
18603
|
+
const paginationModel = getPaginationModel(search, localStoragePagination, setLocalStoragePagination, initialState, isNewVersion);
|
|
18604
|
+
const columnVisibilityModel = getColumnsVisibility(search, columns, localStorageColumnsVisibility, setLocalStorageColumnsVisibility, initialState, isNewVersion);
|
|
18605
|
+
const pinnedColumnsModel = getPinnedColumns(search, columns, localStoragePinnedColumns, setLocalStoragePinnedColumns, initialState, isNewVersion);
|
|
18563
18606
|
const finalSearch = getFinalSearch({
|
|
18607
|
+
localStorageVersion,
|
|
18564
18608
|
search,
|
|
18565
18609
|
filterModel,
|
|
18566
18610
|
sortModel,
|
|
@@ -18581,16 +18625,17 @@ const getModelsParsedOrUpdateLocalStorage = (search, columns, historyReplace, in
|
|
|
18581
18625
|
pinnedColumnsModel
|
|
18582
18626
|
};
|
|
18583
18627
|
};
|
|
18584
|
-
const updateUrl = (
|
|
18628
|
+
const updateUrl = (_ref4, search, localStorageVersion, historyReplace, columns) => {
|
|
18585
18629
|
let {
|
|
18586
18630
|
filterModel,
|
|
18587
18631
|
sortModel,
|
|
18588
18632
|
paginationModel,
|
|
18589
18633
|
columnsModel: columnsVisibilityModel,
|
|
18590
18634
|
pinnedColumnsModel
|
|
18591
|
-
} =
|
|
18635
|
+
} = _ref4;
|
|
18592
18636
|
const newSearch = getFinalSearch({
|
|
18593
18637
|
search,
|
|
18638
|
+
localStorageVersion,
|
|
18594
18639
|
filterModel,
|
|
18595
18640
|
sortModel,
|
|
18596
18641
|
paginationModel,
|
|
@@ -18608,17 +18653,17 @@ const updateUrl = (_ref2, search, historyReplace, columns) => {
|
|
|
18608
18653
|
// do not use it for equivalence (e.g. with value `3` and undefined we
|
|
18609
18654
|
// will get 0).
|
|
18610
18655
|
const compareFilters = (firstFilter, secondFilter) => {
|
|
18611
|
-
if (firstFilter.
|
|
18656
|
+
if (firstFilter.columnField < secondFilter.columnField) {
|
|
18612
18657
|
return -1;
|
|
18613
|
-
} else if (firstFilter.
|
|
18658
|
+
} else if (firstFilter.columnField > secondFilter.columnField) {
|
|
18614
18659
|
return 1;
|
|
18615
18660
|
}
|
|
18616
|
-
if (firstFilter.
|
|
18661
|
+
if (firstFilter.operatorValue === undefined || secondFilter.operatorValue === undefined) {
|
|
18617
18662
|
return 0;
|
|
18618
18663
|
}
|
|
18619
|
-
if (firstFilter.
|
|
18664
|
+
if (firstFilter.operatorValue < secondFilter.operatorValue) {
|
|
18620
18665
|
return -1;
|
|
18621
|
-
} else if (firstFilter.
|
|
18666
|
+
} else if (firstFilter.operatorValue > secondFilter.operatorValue) {
|
|
18622
18667
|
return 1;
|
|
18623
18668
|
}
|
|
18624
18669
|
if (firstFilter.value < secondFilter.value) {
|
|
@@ -18629,18 +18674,18 @@ const compareFilters = (firstFilter, secondFilter) => {
|
|
|
18629
18674
|
return 0;
|
|
18630
18675
|
};
|
|
18631
18676
|
const areFiltersEquivalent = (firstFilter, secondFilter) => {
|
|
18632
|
-
return firstFilter.
|
|
18677
|
+
return firstFilter.columnField === secondFilter.columnField && firstFilter.operatorValue === secondFilter.operatorValue && firstFilter.value === secondFilter.value;
|
|
18633
18678
|
};
|
|
18634
18679
|
const areFilterModelsEquivalent = (filterModel, filterModelToMatch) => {
|
|
18635
18680
|
const {
|
|
18636
18681
|
items,
|
|
18637
|
-
|
|
18682
|
+
linkOperator
|
|
18638
18683
|
} = filterModel;
|
|
18639
18684
|
const {
|
|
18640
18685
|
items: itemsToMatch,
|
|
18641
|
-
|
|
18686
|
+
linkOperator: linkOperatorToMatch
|
|
18642
18687
|
} = filterModelToMatch;
|
|
18643
|
-
if (
|
|
18688
|
+
if (linkOperator !== linkOperatorToMatch) {
|
|
18644
18689
|
return false;
|
|
18645
18690
|
}
|
|
18646
18691
|
if (items.length !== itemsToMatch.length) {
|
|
@@ -18653,7 +18698,7 @@ const areFilterModelsEquivalent = (filterModel, filterModelToMatch) => {
|
|
|
18653
18698
|
const filterToCompare = itemsToMatch[i];
|
|
18654
18699
|
|
|
18655
18700
|
// compareFilters return 0 if and only if the filters have the same
|
|
18656
|
-
//
|
|
18701
|
+
// columnField, operatorValue, and value
|
|
18657
18702
|
if (!areFiltersEquivalent(filter, filterToCompare)) {
|
|
18658
18703
|
return false;
|
|
18659
18704
|
}
|
|
@@ -24464,16 +24509,16 @@ const getRole = (config, dateFormat) => {
|
|
|
24464
24509
|
}).join('\n');
|
|
24465
24510
|
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.
|
|
24466
24511
|
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.
|
|
24467
|
-
The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "
|
|
24468
|
-
- "
|
|
24469
|
-
- "items": a list of conditions, each is an object with exactly the three keys "
|
|
24470
|
-
- "
|
|
24512
|
+
The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "linkOperator" and "items":
|
|
24513
|
+
- "linkOperator": the logical operator, only "and" or "or" are allowed. If there is only one condition in the "items", use "and".
|
|
24514
|
+
- "items": a list of conditions, each is an object with exactly the three keys "columnField", "operatorValue" and "value":
|
|
24515
|
+
- "columnField": the column name, must be one of ${columns}
|
|
24471
24516
|
- "value":
|
|
24472
|
-
- this can be skipped if the "
|
|
24473
|
-
- a list of multiple values if the "
|
|
24517
|
+
- this can be skipped if the "operatorValue" is either "isEmpty" or "isNotEmpty"
|
|
24518
|
+
- a list of multiple values if the "operatorValue" ends with "AnyOf"
|
|
24474
24519
|
- otherwise, it's a single value represented as a string: "true" instead of true, "false" instead of false, "0.6" instead of 0.6.
|
|
24475
24520
|
For "date" data type, use ${dateFormat}. If relative date is input, convert to the actual date given today is ${today}.
|
|
24476
|
-
- "
|
|
24521
|
+
- "operatorValue": the comparison operator, accepted values depend on the data type of the column
|
|
24477
24522
|
${operators}
|
|
24478
24523
|
|
|
24479
24524
|
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:
|
|
@@ -24510,10 +24555,10 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24510
24555
|
nlpFilterConfig,
|
|
24511
24556
|
onFilterModelChange,
|
|
24512
24557
|
dateFormat = 'yyyy-mm-dd',
|
|
24513
|
-
defaultModel = 'gpt-4-
|
|
24558
|
+
defaultModel = 'gpt-4-0613',
|
|
24514
24559
|
defaultFilter = {
|
|
24515
24560
|
items: [],
|
|
24516
|
-
|
|
24561
|
+
linkOperator: 'and'
|
|
24517
24562
|
},
|
|
24518
24563
|
disablePower = false,
|
|
24519
24564
|
localeText
|
|
@@ -24591,7 +24636,7 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24591
24636
|
value: prompt
|
|
24592
24637
|
}), /*#__PURE__*/React__default.createElement(Button, {
|
|
24593
24638
|
variant: "primary",
|
|
24594
|
-
"
|
|
24639
|
+
"aira-label": buttonAriaLabel,
|
|
24595
24640
|
type: "submit",
|
|
24596
24641
|
isLoading: isLoading
|
|
24597
24642
|
}, buttonText)), !disablePower && /*#__PURE__*/React__default.createElement(Tooltip, null, /*#__PURE__*/React__default.createElement(Tooltip.Trigger, null, /*#__PURE__*/React__default.createElement(Switch, {
|
|
@@ -24652,7 +24697,7 @@ const Toolbar$2 = props => {
|
|
|
24652
24697
|
let {
|
|
24653
24698
|
apiRef
|
|
24654
24699
|
} = _ref;
|
|
24655
|
-
return
|
|
24700
|
+
return gridVisibleSortedRowIdsSelector(apiRef);
|
|
24656
24701
|
}
|
|
24657
24702
|
},
|
|
24658
24703
|
printOptions: {
|
|
@@ -26884,10 +26929,12 @@ const ServerSideControlledPagination = _ref3 => {
|
|
|
26884
26929
|
selectionStatus,
|
|
26885
26930
|
displaySelection,
|
|
26886
26931
|
displayPagination,
|
|
26887
|
-
|
|
26888
|
-
|
|
26889
|
-
|
|
26932
|
+
page,
|
|
26933
|
+
onPageChange,
|
|
26934
|
+
pageSize,
|
|
26935
|
+
onPageSizeChange,
|
|
26890
26936
|
displayRowsPerPage,
|
|
26937
|
+
rowsPerPageOptions,
|
|
26891
26938
|
paginationProps,
|
|
26892
26939
|
rowCount
|
|
26893
26940
|
} = _ref3;
|
|
@@ -26906,17 +26953,13 @@ const ServerSideControlledPagination = _ref3 => {
|
|
|
26906
26953
|
}, totalRowsLabel) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$1({
|
|
26907
26954
|
component: "div",
|
|
26908
26955
|
count: totalNumberOfRowsInTable,
|
|
26909
|
-
page:
|
|
26910
|
-
onPageChange: (event,
|
|
26911
|
-
|
|
26912
|
-
|
|
26913
|
-
|
|
26914
|
-
|
|
26915
|
-
|
|
26916
|
-
page: paginationModel.page,
|
|
26917
|
-
pageSize: parseInt(event.target.value, 10)
|
|
26918
|
-
}),
|
|
26919
|
-
rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
|
|
26956
|
+
page: page,
|
|
26957
|
+
onPageChange: (event, newPage) => onPageChange(newPage),
|
|
26958
|
+
rowsPerPage: pageSize,
|
|
26959
|
+
onRowsPerPageChange: event => {
|
|
26960
|
+
onPageSizeChange(parseInt(event.target.value, 10));
|
|
26961
|
+
},
|
|
26962
|
+
rowsPerPageOptions: displayRowsPerPage ? rowsPerPageOptions : []
|
|
26920
26963
|
}, paginationProps)) : null);
|
|
26921
26964
|
};
|
|
26922
26965
|
|
|
@@ -26942,9 +26985,11 @@ const ControlledPagination = _ref3 => {
|
|
|
26942
26985
|
displayPagination = false,
|
|
26943
26986
|
selectionStatus,
|
|
26944
26987
|
apiRef,
|
|
26945
|
-
|
|
26946
|
-
|
|
26947
|
-
|
|
26988
|
+
page,
|
|
26989
|
+
onPageChange,
|
|
26990
|
+
pageSize,
|
|
26991
|
+
onPageSizeChange,
|
|
26992
|
+
rowsPerPageOptions,
|
|
26948
26993
|
isRowSelectable,
|
|
26949
26994
|
paginationProps
|
|
26950
26995
|
} = _ref3;
|
|
@@ -26974,25 +27019,17 @@ const ControlledPagination = _ref3 => {
|
|
|
26974
27019
|
}, `${selectionStatus.numberOfSelectedRows} row${selectionStatus.numberOfSelectedRows > 1 ? 's' : ''} selected`) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$1({
|
|
26975
27020
|
component: "div",
|
|
26976
27021
|
count: numberOfFilteredRowsInTable,
|
|
26977
|
-
page:
|
|
26978
|
-
onPageChange: (event,
|
|
26979
|
-
|
|
26980
|
-
page,
|
|
26981
|
-
pageSize: paginationModel.pageSize
|
|
26982
|
-
});
|
|
26983
|
-
},
|
|
26984
|
-
rowsPerPage: paginationModel.pageSize,
|
|
27022
|
+
page: page,
|
|
27023
|
+
onPageChange: (event, newPage) => onPageChange(newPage),
|
|
27024
|
+
rowsPerPage: pageSize,
|
|
26985
27025
|
onRowsPerPageChange: event => {
|
|
26986
|
-
|
|
26987
|
-
page: paginationModel.page,
|
|
26988
|
-
pageSize: parseInt(event.target.value, 10)
|
|
26989
|
-
});
|
|
27026
|
+
onPageSizeChange(parseInt(event.target.value, 10));
|
|
26990
27027
|
},
|
|
26991
|
-
rowsPerPageOptions: displayRowsPerPage ?
|
|
27028
|
+
rowsPerPageOptions: displayRowsPerPage ? rowsPerPageOptions : []
|
|
26992
27029
|
}, paginationProps)) : null);
|
|
26993
27030
|
};
|
|
26994
27031
|
|
|
26995
|
-
const _excluded$3 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "
|
|
27032
|
+
const _excluded$3 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "page", "onPageChange", "pageSize", "onPageSizeChange", "rowsPerPageOptions", "paginationProps", "paginationMode", "rowCount"];
|
|
26996
27033
|
const ToolbarWrapper = _ref => {
|
|
26997
27034
|
let {
|
|
26998
27035
|
hideToolbar,
|
|
@@ -27004,9 +27041,11 @@ const ToolbarWrapper = _ref => {
|
|
|
27004
27041
|
selectionStatus,
|
|
27005
27042
|
apiRef,
|
|
27006
27043
|
isRowSelectable,
|
|
27007
|
-
|
|
27008
|
-
|
|
27009
|
-
|
|
27044
|
+
page,
|
|
27045
|
+
onPageChange,
|
|
27046
|
+
pageSize,
|
|
27047
|
+
onPageSizeChange,
|
|
27048
|
+
rowsPerPageOptions,
|
|
27010
27049
|
paginationProps,
|
|
27011
27050
|
paginationMode = 'client',
|
|
27012
27051
|
rowCount
|
|
@@ -27020,9 +27059,11 @@ const ToolbarWrapper = _ref => {
|
|
|
27020
27059
|
displayRowsPerPage: false,
|
|
27021
27060
|
displayPagination: ['top', 'both'].includes(paginationPlacement),
|
|
27022
27061
|
selectionStatus: selectionStatus.current,
|
|
27023
|
-
|
|
27024
|
-
|
|
27025
|
-
|
|
27062
|
+
page: page,
|
|
27063
|
+
onPageChange: onPageChange,
|
|
27064
|
+
pageSize: pageSize,
|
|
27065
|
+
onPageSizeChange: onPageSizeChange,
|
|
27066
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
27026
27067
|
paginationProps: paginationProps,
|
|
27027
27068
|
rowCount: rowCount
|
|
27028
27069
|
}) : /*#__PURE__*/React__default.createElement(ControlledPagination, {
|
|
@@ -27032,26 +27073,30 @@ const ToolbarWrapper = _ref => {
|
|
|
27032
27073
|
selectionStatus: selectionStatus.current,
|
|
27033
27074
|
apiRef: apiRef,
|
|
27034
27075
|
isRowSelectable: isRowSelectable,
|
|
27035
|
-
|
|
27036
|
-
|
|
27037
|
-
|
|
27076
|
+
page: page,
|
|
27077
|
+
onPageChange: onPageChange,
|
|
27078
|
+
pageSize: pageSize,
|
|
27079
|
+
onPageSizeChange: onPageSizeChange,
|
|
27080
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
27038
27081
|
paginationProps: paginationProps
|
|
27039
27082
|
}) : null);
|
|
27040
27083
|
};
|
|
27041
27084
|
|
|
27042
27085
|
const useControlledDatagridState = _ref => {
|
|
27043
|
-
var
|
|
27086
|
+
var _initialState$paginat, _initialState$paginat2;
|
|
27044
27087
|
let {
|
|
27045
27088
|
initialState,
|
|
27046
|
-
|
|
27089
|
+
rowsPerPageOptions,
|
|
27047
27090
|
propsColumnVisibilityModel,
|
|
27048
27091
|
propsFilterModel,
|
|
27049
27092
|
propsOnColumnVisibilityModelChange,
|
|
27050
27093
|
propsOnFilterModelChange,
|
|
27051
|
-
|
|
27094
|
+
propsOnPageChange,
|
|
27095
|
+
propsOnPageSizeChange,
|
|
27052
27096
|
propsOnPinnedColumnsChange,
|
|
27053
27097
|
propsOnSortModelChange,
|
|
27054
|
-
|
|
27098
|
+
propsPage,
|
|
27099
|
+
propsPageSize,
|
|
27055
27100
|
propsPinnedColumns,
|
|
27056
27101
|
propsSortModel
|
|
27057
27102
|
} = _ref;
|
|
@@ -27099,22 +27144,33 @@ const useControlledDatagridState = _ref => {
|
|
|
27099
27144
|
setSortModel(model);
|
|
27100
27145
|
}
|
|
27101
27146
|
};
|
|
27102
|
-
const [
|
|
27103
|
-
|
|
27104
|
-
|
|
27105
|
-
|
|
27106
|
-
|
|
27107
|
-
if (propsOnPaginationModelChange) {
|
|
27108
|
-
propsOnPaginationModelChange(model, details);
|
|
27147
|
+
const [page, setPage] = useState((initialState === null || initialState === void 0 ? void 0 : (_initialState$paginat = initialState.pagination) === null || _initialState$paginat === void 0 ? void 0 : _initialState$paginat.page) || propsPage || 0);
|
|
27148
|
+
const [pageSize, setPageSize] = useState((initialState === null || initialState === void 0 ? void 0 : (_initialState$paginat2 = initialState.pagination) === null || _initialState$paginat2 === void 0 ? void 0 : _initialState$paginat2.pageSize) || propsPageSize || (rowsPerPageOptions === null || rowsPerPageOptions === void 0 ? void 0 : rowsPerPageOptions[0]) || 25);
|
|
27149
|
+
const onPageChange = page => {
|
|
27150
|
+
if (propsOnPageChange) {
|
|
27151
|
+
propsOnPageChange(page, undefined);
|
|
27109
27152
|
} else {
|
|
27110
|
-
|
|
27153
|
+
setPage(page);
|
|
27111
27154
|
}
|
|
27112
27155
|
};
|
|
27113
27156
|
useEffect(() => {
|
|
27114
|
-
if (
|
|
27115
|
-
|
|
27157
|
+
if (propsPage || propsPage === 0) {
|
|
27158
|
+
setPage(propsPage);
|
|
27159
|
+
}
|
|
27160
|
+
}, [propsPage]);
|
|
27161
|
+
const onPageSizeChange = pageSize => {
|
|
27162
|
+
onPageChange(0);
|
|
27163
|
+
if (propsOnPageSizeChange) {
|
|
27164
|
+
propsOnPageSizeChange(pageSize, undefined);
|
|
27165
|
+
} else {
|
|
27166
|
+
setPageSize(pageSize);
|
|
27116
27167
|
}
|
|
27117
|
-
}
|
|
27168
|
+
};
|
|
27169
|
+
useEffect(() => {
|
|
27170
|
+
if (propsPageSize) {
|
|
27171
|
+
setPageSize(propsPageSize);
|
|
27172
|
+
}
|
|
27173
|
+
}, [propsPageSize]);
|
|
27118
27174
|
return {
|
|
27119
27175
|
filterModel,
|
|
27120
27176
|
onFilterModelChange,
|
|
@@ -27124,12 +27180,14 @@ const useControlledDatagridState = _ref => {
|
|
|
27124
27180
|
onPinnedColumnsChange,
|
|
27125
27181
|
sortModel,
|
|
27126
27182
|
onSortModelChange,
|
|
27127
|
-
|
|
27128
|
-
|
|
27183
|
+
page,
|
|
27184
|
+
pageSize,
|
|
27185
|
+
onPageChange,
|
|
27186
|
+
onPageSizeChange
|
|
27129
27187
|
};
|
|
27130
27188
|
};
|
|
27131
27189
|
|
|
27132
|
-
const _excluded$2 = ["apiRef", "autoHeight", "className", "
|
|
27190
|
+
const _excluded$2 = ["apiRef", "autoHeight", "className", "columnTypes", "components", "componentsProps", "filterModel", "columnVisibilityModel", "pinnedColumns", "sortModel", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "onFilterModelChange", "onPageChange", "onPageSizeChange", "onColumnVisibilityModelChange", "onPinnedColumnsChange", "onSortModelChange", "selectionModel", "onSelectionModelChange", "page", "pageSize", "pagination", "paginationPlacement", "paginationProps", "rows", "rowsPerPageOptions", "sx", "theme", "paginationMode", "rowCount"];
|
|
27133
27191
|
const COMPONENT_NAME$2 = 'DataGrid';
|
|
27134
27192
|
const CLASSNAME$2 = 'redsift-datagrid';
|
|
27135
27193
|
const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
@@ -27138,30 +27196,33 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27138
27196
|
apiRef: propsApiRef,
|
|
27139
27197
|
autoHeight,
|
|
27140
27198
|
className,
|
|
27141
|
-
|
|
27142
|
-
|
|
27199
|
+
columnTypes: propsColumnTypes,
|
|
27200
|
+
components,
|
|
27201
|
+
componentsProps,
|
|
27143
27202
|
filterModel: propsFilterModel,
|
|
27144
27203
|
columnVisibilityModel: propsColumnVisibilityModel,
|
|
27145
27204
|
pinnedColumns: propsPinnedColumns,
|
|
27146
27205
|
sortModel: propsSortModel,
|
|
27147
|
-
paginationModel: propsPaginationModel,
|
|
27148
27206
|
height: propsHeight,
|
|
27149
27207
|
hideToolbar,
|
|
27150
27208
|
initialState,
|
|
27151
27209
|
isRowSelectable,
|
|
27152
27210
|
license = process.env.MUI_LICENSE_KEY,
|
|
27153
27211
|
onFilterModelChange: propsOnFilterModelChange,
|
|
27154
|
-
|
|
27155
|
-
|
|
27156
|
-
onRowSelectionModelChange: propsOnRowSelectionModelChange,
|
|
27212
|
+
onPageChange: propsOnPageChange,
|
|
27213
|
+
onPageSizeChange: propsOnPageSizeChange,
|
|
27157
27214
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
27158
27215
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
27159
27216
|
onSortModelChange: propsOnSortModelChange,
|
|
27217
|
+
selectionModel: propsSelectionModel,
|
|
27218
|
+
onSelectionModelChange: propsOnSelectionModelChange,
|
|
27219
|
+
page: propsPage,
|
|
27220
|
+
pageSize: propsPageSize,
|
|
27160
27221
|
pagination,
|
|
27161
27222
|
paginationPlacement = 'both',
|
|
27162
27223
|
paginationProps,
|
|
27163
27224
|
rows,
|
|
27164
|
-
|
|
27225
|
+
rowsPerPageOptions,
|
|
27165
27226
|
sx,
|
|
27166
27227
|
theme: propsTheme,
|
|
27167
27228
|
paginationMode = 'client',
|
|
@@ -27171,7 +27232,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27171
27232
|
const theme = useTheme$4(propsTheme);
|
|
27172
27233
|
const _apiRef = useGridApiRef();
|
|
27173
27234
|
const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
|
|
27174
|
-
const RenderedToolbar =
|
|
27235
|
+
const RenderedToolbar = components !== null && components !== void 0 && components.Toolbar ? components.Toolbar : Toolbar$2;
|
|
27175
27236
|
LicenseInfo.setLicenseKey(license);
|
|
27176
27237
|
const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
|
|
27177
27238
|
const {
|
|
@@ -27179,52 +27240,56 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27179
27240
|
filterModel,
|
|
27180
27241
|
onColumnVisibilityModelChange,
|
|
27181
27242
|
onFilterModelChange,
|
|
27182
|
-
|
|
27243
|
+
onPageChange,
|
|
27244
|
+
onPageSizeChange,
|
|
27183
27245
|
onPinnedColumnsChange,
|
|
27184
27246
|
onSortModelChange,
|
|
27185
|
-
|
|
27247
|
+
page,
|
|
27248
|
+
pageSize,
|
|
27186
27249
|
pinnedColumns,
|
|
27187
27250
|
sortModel
|
|
27188
27251
|
} = useControlledDatagridState({
|
|
27189
27252
|
initialState,
|
|
27190
|
-
|
|
27253
|
+
rowsPerPageOptions,
|
|
27191
27254
|
propsColumnVisibilityModel,
|
|
27192
27255
|
propsFilterModel,
|
|
27193
27256
|
propsOnColumnVisibilityModelChange,
|
|
27194
27257
|
propsOnFilterModelChange,
|
|
27195
27258
|
propsOnPinnedColumnsChange,
|
|
27196
27259
|
propsOnSortModelChange,
|
|
27197
|
-
|
|
27260
|
+
propsPage,
|
|
27261
|
+
propsPageSize,
|
|
27198
27262
|
propsPinnedColumns,
|
|
27199
27263
|
propsSortModel,
|
|
27200
|
-
|
|
27264
|
+
propsOnPageChange,
|
|
27265
|
+
propsOnPageSizeChange
|
|
27201
27266
|
});
|
|
27202
|
-
const [
|
|
27267
|
+
const [selectionModel, setSelectionModel] = useState(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
|
|
27203
27268
|
useEffect(() => {
|
|
27204
|
-
|
|
27205
|
-
}, [
|
|
27206
|
-
const
|
|
27207
|
-
if (
|
|
27208
|
-
|
|
27269
|
+
setSelectionModel(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
|
|
27270
|
+
}, [propsSelectionModel]);
|
|
27271
|
+
const onSelectionModelChange = (selectionModel, details) => {
|
|
27272
|
+
if (propsOnSelectionModelChange) {
|
|
27273
|
+
propsOnSelectionModelChange(selectionModel, details);
|
|
27209
27274
|
} else {
|
|
27210
|
-
|
|
27275
|
+
setSelectionModel(selectionModel);
|
|
27211
27276
|
}
|
|
27212
27277
|
};
|
|
27213
27278
|
const selectionStatus = useRef({
|
|
27214
27279
|
type: 'none',
|
|
27215
27280
|
numberOfSelectedRows: 0,
|
|
27216
27281
|
numberOfSelectedRowsInPage: 0,
|
|
27217
|
-
page
|
|
27218
|
-
pageSize
|
|
27282
|
+
page,
|
|
27283
|
+
pageSize
|
|
27219
27284
|
});
|
|
27220
27285
|
|
|
27221
27286
|
// in server-side pagination we want to update the selection status
|
|
27222
27287
|
// every time we navigate between pages, resize our page or select something
|
|
27223
27288
|
useEffect(() => {
|
|
27224
27289
|
if (paginationMode == 'server') {
|
|
27225
|
-
onServerSideSelectionStatusChange(Array.isArray(
|
|
27290
|
+
onServerSideSelectionStatusChange(Array.isArray(selectionModel) ? selectionModel : [selectionModel], apiRef, selectionStatus, isRowSelectable, page, pageSize);
|
|
27226
27291
|
}
|
|
27227
|
-
}, [
|
|
27292
|
+
}, [selectionModel, page, pageSize]);
|
|
27228
27293
|
if (!Array.isArray(rows)) {
|
|
27229
27294
|
return null;
|
|
27230
27295
|
}
|
|
@@ -27255,54 +27320,57 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27255
27320
|
apiRef: apiRef,
|
|
27256
27321
|
autoHeight: autoHeight,
|
|
27257
27322
|
checkboxSelectionVisibleOnly: Boolean(pagination),
|
|
27258
|
-
|
|
27259
|
-
|
|
27260
|
-
|
|
27261
|
-
|
|
27262
|
-
|
|
27263
|
-
|
|
27323
|
+
columnTypes: _objectSpread2(_objectSpread2({}, customColumnTypes), propsColumnTypes),
|
|
27324
|
+
components: _objectSpread2(_objectSpread2({
|
|
27325
|
+
BaseButton,
|
|
27326
|
+
BaseCheckbox,
|
|
27327
|
+
// BaseTextField,
|
|
27328
|
+
BasePopper,
|
|
27329
|
+
ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27264
27330
|
displayName: "ColumnFilteredIcon"
|
|
27265
27331
|
})),
|
|
27266
|
-
|
|
27332
|
+
ColumnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27267
27333
|
displayName: "ColumnSelectorIcon"
|
|
27268
27334
|
})),
|
|
27269
|
-
|
|
27335
|
+
ColumnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27270
27336
|
displayName: "ColumnSortedAscendingIcon"
|
|
27271
27337
|
})),
|
|
27272
|
-
|
|
27338
|
+
ColumnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27273
27339
|
displayName: "ColumnSortedDescendingIcon"
|
|
27274
27340
|
})),
|
|
27275
|
-
|
|
27341
|
+
DensityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27276
27342
|
displayName: "DensityCompactIcon"
|
|
27277
27343
|
})),
|
|
27278
|
-
|
|
27344
|
+
DensityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27279
27345
|
displayName: "DensityStandardIcon"
|
|
27280
27346
|
})),
|
|
27281
|
-
|
|
27347
|
+
DensityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27282
27348
|
displayName: "DensityComfortableIcon"
|
|
27283
27349
|
})),
|
|
27284
|
-
|
|
27350
|
+
DetailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27285
27351
|
displayName: "DetailPanelCollapseIcon"
|
|
27286
27352
|
})),
|
|
27287
|
-
|
|
27353
|
+
DetailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27288
27354
|
displayName: "DetailPanelExpandIcon"
|
|
27289
27355
|
})),
|
|
27290
|
-
|
|
27356
|
+
ExportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27291
27357
|
displayName: "ExportIcon"
|
|
27292
27358
|
})),
|
|
27293
|
-
|
|
27359
|
+
OpenFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
|
|
27294
27360
|
displayName: "OpenFilterButtonIcon"
|
|
27295
27361
|
}, props))
|
|
27296
|
-
},
|
|
27297
|
-
|
|
27298
|
-
|
|
27362
|
+
}, components), {}, {
|
|
27363
|
+
Toolbar: ToolbarWrapper,
|
|
27364
|
+
Pagination: props => pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$1({}, props, {
|
|
27299
27365
|
displaySelection: false,
|
|
27300
27366
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
27301
27367
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
27302
27368
|
selectionStatus: selectionStatus.current,
|
|
27303
|
-
|
|
27304
|
-
|
|
27305
|
-
|
|
27369
|
+
page: page,
|
|
27370
|
+
onPageChange: onPageChange,
|
|
27371
|
+
pageSize: pageSize,
|
|
27372
|
+
onPageSizeChange: onPageSizeChange,
|
|
27373
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
27306
27374
|
paginationProps: paginationProps,
|
|
27307
27375
|
paginationMode: paginationMode,
|
|
27308
27376
|
rowCount: rowCount
|
|
@@ -27313,14 +27381,16 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27313
27381
|
selectionStatus: selectionStatus.current,
|
|
27314
27382
|
apiRef: apiRef,
|
|
27315
27383
|
isRowSelectable: isRowSelectable,
|
|
27316
|
-
|
|
27317
|
-
|
|
27318
|
-
|
|
27384
|
+
page: page,
|
|
27385
|
+
onPageChange: onPageChange,
|
|
27386
|
+
pageSize: pageSize,
|
|
27387
|
+
onPageSizeChange: onPageSizeChange,
|
|
27388
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
27319
27389
|
paginationProps: paginationProps,
|
|
27320
27390
|
paginationMode: paginationMode
|
|
27321
27391
|
})) : null
|
|
27322
27392
|
}),
|
|
27323
|
-
|
|
27393
|
+
componentsProps: _objectSpread2(_objectSpread2({}, componentsProps), {}, {
|
|
27324
27394
|
toolbar: _objectSpread2({
|
|
27325
27395
|
hideToolbar,
|
|
27326
27396
|
RenderedToolbar,
|
|
@@ -27331,13 +27401,15 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27331
27401
|
selectionStatus,
|
|
27332
27402
|
apiRef,
|
|
27333
27403
|
isRowSelectable,
|
|
27334
|
-
|
|
27335
|
-
|
|
27336
|
-
|
|
27404
|
+
page,
|
|
27405
|
+
onPageChange,
|
|
27406
|
+
pageSize,
|
|
27407
|
+
onPageSizeChange,
|
|
27408
|
+
rowsPerPageOptions,
|
|
27337
27409
|
paginationProps,
|
|
27338
27410
|
paginationMode,
|
|
27339
27411
|
rowCount
|
|
27340
|
-
},
|
|
27412
|
+
}, componentsProps === null || componentsProps === void 0 ? void 0 : componentsProps.toolbar)
|
|
27341
27413
|
}),
|
|
27342
27414
|
filterModel: filterModel,
|
|
27343
27415
|
columnVisibilityModel: columnVisibilityModel,
|
|
@@ -27353,11 +27425,13 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27353
27425
|
paginationMode: paginationMode,
|
|
27354
27426
|
keepNonExistentRowsSelected: paginationMode == 'server',
|
|
27355
27427
|
rows: rows,
|
|
27356
|
-
|
|
27357
|
-
|
|
27358
|
-
|
|
27359
|
-
|
|
27360
|
-
|
|
27428
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
27429
|
+
page: page,
|
|
27430
|
+
onPageChange: onPageChange,
|
|
27431
|
+
pageSize: pageSize,
|
|
27432
|
+
onPageSizeChange: onPageSizeChange,
|
|
27433
|
+
selectionModel: selectionModel,
|
|
27434
|
+
onSelectionModelChange: (newSelectionModel, details) => {
|
|
27361
27435
|
if (pagination && paginationMode != 'server') {
|
|
27362
27436
|
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
|
|
27363
27437
|
let {
|
|
@@ -27415,7 +27489,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27415
27489
|
};
|
|
27416
27490
|
}
|
|
27417
27491
|
}
|
|
27418
|
-
|
|
27492
|
+
onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(newSelectionModel, details);
|
|
27419
27493
|
},
|
|
27420
27494
|
sx: _objectSpread2(_objectSpread2({}, sx), {}, {
|
|
27421
27495
|
'.MuiDataGrid-columnHeaders': {
|
|
@@ -27432,6 +27506,8 @@ DataGrid.className = CLASSNAME$2;
|
|
|
27432
27506
|
DataGrid.displayName = COMPONENT_NAME$2;
|
|
27433
27507
|
|
|
27434
27508
|
// Get and Set data from LocalStorage WITHOUT useState
|
|
27509
|
+
|
|
27510
|
+
// triggering a state update and consecutive re-render
|
|
27435
27511
|
const useFetchState = (defaultValue, key) => {
|
|
27436
27512
|
let stickyValue = null;
|
|
27437
27513
|
try {
|
|
@@ -27439,7 +27515,16 @@ const useFetchState = (defaultValue, key) => {
|
|
|
27439
27515
|
} catch (e) {
|
|
27440
27516
|
console.error('StatefulDataGrid: error getting item from local storage: ', e);
|
|
27441
27517
|
}
|
|
27442
|
-
|
|
27518
|
+
let parsedValue = stickyValue !== null && stickyValue !== undefined && stickyValue !== 'undefined' ? JSON.parse(stickyValue) : defaultValue;
|
|
27519
|
+
|
|
27520
|
+
// TODO: temporary workaround to avoid clashes when someone had sorting on the now-removed screenshot field (renamed to num_annotations)
|
|
27521
|
+
// 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
|
|
27522
|
+
if (parsedValue instanceof Array) {
|
|
27523
|
+
const fields = (parsedValue || []).map(item => item.field);
|
|
27524
|
+
if (fields.includes('screenshot') || fields.includes('diffs')) {
|
|
27525
|
+
parsedValue = defaultValue;
|
|
27526
|
+
}
|
|
27527
|
+
}
|
|
27443
27528
|
const updateValue = useCallback(value => {
|
|
27444
27529
|
try {
|
|
27445
27530
|
window.localStorage.setItem(key, JSON.stringify(value));
|
|
@@ -27450,8 +27535,6 @@ const useFetchState = (defaultValue, key) => {
|
|
|
27450
27535
|
return [parsedValue, updateValue];
|
|
27451
27536
|
};
|
|
27452
27537
|
|
|
27453
|
-
// import useLocalStorage from './useLocalStorage';
|
|
27454
|
-
|
|
27455
27538
|
const useTableStates = (id, version) => {
|
|
27456
27539
|
const [paginationModel, setPaginationModel] = useFetchState('', buildStorageKey({
|
|
27457
27540
|
id,
|
|
@@ -27508,11 +27591,13 @@ const useStatefulTable = props => {
|
|
|
27508
27591
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
27509
27592
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
27510
27593
|
onFilterModelChange: propsOnFilterModelChange,
|
|
27511
|
-
|
|
27594
|
+
onPageChange: propsOnPageChange,
|
|
27595
|
+
onPageSizeChange: propsOnPageSizeChange,
|
|
27512
27596
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
27513
27597
|
onSortModelChange: propsOnSortModelChange,
|
|
27514
27598
|
useRouter,
|
|
27515
|
-
localStorageVersion =
|
|
27599
|
+
localStorageVersion = 1,
|
|
27600
|
+
previousLocalStorageVersions = []
|
|
27516
27601
|
} = props;
|
|
27517
27602
|
const {
|
|
27518
27603
|
search,
|
|
@@ -27537,8 +27622,8 @@ const useStatefulTable = props => {
|
|
|
27537
27622
|
setDimensionModel
|
|
27538
27623
|
} = useTableStates(id, localStorageVersion);
|
|
27539
27624
|
|
|
27540
|
-
// clearing up old version keys
|
|
27541
|
-
useEffect(() => clearPreviousVersionStorage(id,
|
|
27625
|
+
// clearing up old version keys
|
|
27626
|
+
useEffect(() => clearPreviousVersionStorage(id, previousLocalStorageVersions), [id, previousLocalStorageVersions]);
|
|
27542
27627
|
const onColumnDimensionChange = useCallback(_ref => {
|
|
27543
27628
|
let {
|
|
27544
27629
|
newWidth,
|
|
@@ -27554,7 +27639,7 @@ const useStatefulTable = props => {
|
|
|
27554
27639
|
paginationModel: paginationModelParsed,
|
|
27555
27640
|
columnVisibilityModel: visibilityModel,
|
|
27556
27641
|
pinnedColumnsModel
|
|
27557
|
-
} = getModelsParsedOrUpdateLocalStorage(search || '', propsColumns, historyReplace, initialState, {
|
|
27642
|
+
} = getModelsParsedOrUpdateLocalStorage(search || '', localStorageVersion, propsColumns, historyReplace, initialState, {
|
|
27558
27643
|
localStorageFilters,
|
|
27559
27644
|
setLocalStorageFilters,
|
|
27560
27645
|
localStorageSorting: sortModel,
|
|
@@ -27570,6 +27655,7 @@ const useStatefulTable = props => {
|
|
|
27570
27655
|
column.width = dimensionModel[column.field] || column.width || 100;
|
|
27571
27656
|
return column;
|
|
27572
27657
|
}), [propsColumns, dimensionModel]);
|
|
27658
|
+
|
|
27573
27659
|
/** Add resetPage method to apiRef. */
|
|
27574
27660
|
apiRef.current.resetPage = () => {
|
|
27575
27661
|
apiRef.current.setPage(0);
|
|
@@ -27580,7 +27666,7 @@ const useStatefulTable = props => {
|
|
|
27580
27666
|
onFilterModelChange: (model, details) => {
|
|
27581
27667
|
const filterModel = _objectSpread2(_objectSpread2({}, model), {}, {
|
|
27582
27668
|
items: model.items.map(item => {
|
|
27583
|
-
const column = apiRef.current.getColumn(item.
|
|
27669
|
+
const column = apiRef.current.getColumn(item.columnField);
|
|
27584
27670
|
item.type = column.type || 'string';
|
|
27585
27671
|
return item;
|
|
27586
27672
|
})
|
|
@@ -27592,7 +27678,7 @@ const useStatefulTable = props => {
|
|
|
27592
27678
|
paginationModel: paginationModelParsed,
|
|
27593
27679
|
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
27594
27680
|
pinnedColumnsModel: pinnedColumnsModel
|
|
27595
|
-
}, search, historyReplace, columns);
|
|
27681
|
+
}, search, localStorageVersion, historyReplace, columns);
|
|
27596
27682
|
},
|
|
27597
27683
|
filterModel: filterParsed,
|
|
27598
27684
|
onSortModelChange: (model, details) => {
|
|
@@ -27603,7 +27689,7 @@ const useStatefulTable = props => {
|
|
|
27603
27689
|
paginationModel: paginationModelParsed,
|
|
27604
27690
|
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
27605
27691
|
pinnedColumnsModel: pinnedColumnsModel
|
|
27606
|
-
}, search, historyReplace, columns);
|
|
27692
|
+
}, search, localStorageVersion, historyReplace, columns);
|
|
27607
27693
|
},
|
|
27608
27694
|
sortModel: sortModelParsed,
|
|
27609
27695
|
onPinnedColumnsChange: (pinnedColumns, details) => {
|
|
@@ -27614,22 +27700,39 @@ const useStatefulTable = props => {
|
|
|
27614
27700
|
paginationModel: paginationModelParsed,
|
|
27615
27701
|
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
27616
27702
|
pinnedColumnsModel: pinnedColumns
|
|
27617
|
-
}, search, historyReplace, columns);
|
|
27703
|
+
}, search, localStorageVersion, historyReplace, columns);
|
|
27618
27704
|
},
|
|
27619
27705
|
pinnedColumns: pinnedColumnsModel,
|
|
27620
|
-
|
|
27621
|
-
|
|
27622
|
-
|
|
27623
|
-
|
|
27624
|
-
|
|
27625
|
-
propsOnPaginationModelChange === null || propsOnPaginationModelChange === void 0 ? void 0 : propsOnPaginationModelChange(paginationModel, details);
|
|
27706
|
+
page: paginationModelParsed.page,
|
|
27707
|
+
pageSize: paginationModelParsed.pageSize,
|
|
27708
|
+
onPageChange: (page, details) => {
|
|
27709
|
+
const direction = paginationModelParsed.page < page ? 'next' : 'back';
|
|
27710
|
+
propsOnPageChange === null || propsOnPageChange === void 0 ? void 0 : propsOnPageChange(page, details);
|
|
27626
27711
|
updateUrl({
|
|
27627
27712
|
filterModel: filterParsed,
|
|
27628
27713
|
sortModel: sortModelParsed,
|
|
27629
|
-
paginationModel:
|
|
27714
|
+
paginationModel: {
|
|
27715
|
+
page,
|
|
27716
|
+
pageSize: paginationModelParsed.pageSize,
|
|
27717
|
+
direction
|
|
27718
|
+
},
|
|
27630
27719
|
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
27631
27720
|
pinnedColumnsModel: pinnedColumnsModel
|
|
27632
|
-
}, search, historyReplace, columns);
|
|
27721
|
+
}, search, localStorageVersion, historyReplace, columns);
|
|
27722
|
+
},
|
|
27723
|
+
onPageSizeChange: (pageSize, details) => {
|
|
27724
|
+
propsOnPageSizeChange === null || propsOnPageSizeChange === void 0 ? void 0 : propsOnPageSizeChange(pageSize, details);
|
|
27725
|
+
updateUrl({
|
|
27726
|
+
filterModel: filterParsed,
|
|
27727
|
+
sortModel: sortModelParsed,
|
|
27728
|
+
paginationModel: {
|
|
27729
|
+
page: paginationModelParsed.page,
|
|
27730
|
+
pageSize,
|
|
27731
|
+
direction: paginationModelParsed.direction
|
|
27732
|
+
},
|
|
27733
|
+
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
27734
|
+
pinnedColumnsModel: pinnedColumnsModel
|
|
27735
|
+
}, search, localStorageVersion, historyReplace, columns);
|
|
27633
27736
|
},
|
|
27634
27737
|
columnVisibilityModel: visibilityModel,
|
|
27635
27738
|
onColumnVisibilityModelChange: (columnsVisibilityModel, details) => {
|
|
@@ -27640,7 +27743,7 @@ const useStatefulTable = props => {
|
|
|
27640
27743
|
paginationModel: paginationModelParsed,
|
|
27641
27744
|
columnsModel: columnsVisibilityModel,
|
|
27642
27745
|
pinnedColumnsModel: pinnedColumnsModel
|
|
27643
|
-
}, search, historyReplace, columns);
|
|
27746
|
+
}, search, localStorageVersion, historyReplace, columns);
|
|
27644
27747
|
},
|
|
27645
27748
|
onColumnWidthChange: (params, event, details) => {
|
|
27646
27749
|
propsOnColumnWidthChange === null || propsOnColumnWidthChange === void 0 ? void 0 : propsOnColumnWidthChange(params, event, details);
|
|
@@ -27652,7 +27755,7 @@ const useStatefulTable = props => {
|
|
|
27652
27755
|
};
|
|
27653
27756
|
};
|
|
27654
27757
|
|
|
27655
|
-
const _excluded$1 = ["apiRef", "autoHeight", "className", "columns", "
|
|
27758
|
+
const _excluded$1 = ["apiRef", "autoHeight", "className", "columns", "columnTypes", "components", "componentsProps", "filterModel", "columnVisibilityModel", "pinnedColumns", "sortModel", "page", "pageSize", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "localStorageVersion", "previousLocalStorageVersions", "onFilterModelChange", "selectionModel", "onColumnWidthChange", "onPageChange", "onPageSizeChange", "onSelectionModelChange", "onColumnVisibilityModelChange", "onPinnedColumnsChange", "onSortModelChange", "pagination", "paginationPlacement", "paginationProps", "rows", "rowsPerPageOptions", "sx", "theme", "useRouter", "paginationMode", "rowCount"];
|
|
27656
27759
|
const COMPONENT_NAME$1 = 'DataGrid';
|
|
27657
27760
|
const CLASSNAME$1 = 'redsift-datagrid';
|
|
27658
27761
|
const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
@@ -27662,24 +27765,28 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27662
27765
|
autoHeight,
|
|
27663
27766
|
className,
|
|
27664
27767
|
columns,
|
|
27665
|
-
|
|
27666
|
-
|
|
27768
|
+
columnTypes: propsColumnTypes,
|
|
27769
|
+
components,
|
|
27770
|
+
componentsProps,
|
|
27667
27771
|
filterModel: propsFilterModel,
|
|
27668
27772
|
columnVisibilityModel: propsColumnVisibilityModel,
|
|
27669
27773
|
pinnedColumns: propsPinnedColumns,
|
|
27670
27774
|
sortModel: propsSortModel,
|
|
27671
|
-
|
|
27775
|
+
page: propsPage,
|
|
27776
|
+
pageSize: propsPageSize,
|
|
27672
27777
|
height: propsHeight,
|
|
27673
27778
|
hideToolbar,
|
|
27674
27779
|
initialState,
|
|
27675
27780
|
isRowSelectable,
|
|
27676
27781
|
license = process.env.MUI_LICENSE_KEY,
|
|
27677
27782
|
localStorageVersion,
|
|
27783
|
+
previousLocalStorageVersions,
|
|
27678
27784
|
onFilterModelChange: propsOnFilterModelChange,
|
|
27679
|
-
|
|
27785
|
+
selectionModel: propsSelectionModel,
|
|
27680
27786
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
27681
|
-
|
|
27682
|
-
|
|
27787
|
+
onPageChange: propsOnPageChange,
|
|
27788
|
+
onPageSizeChange: propsOnPageSizeChange,
|
|
27789
|
+
onSelectionModelChange: propsOnSelectionModelChange,
|
|
27683
27790
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
27684
27791
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
27685
27792
|
onSortModelChange: propsOnSortModelChange,
|
|
@@ -27687,7 +27794,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27687
27794
|
paginationPlacement = 'both',
|
|
27688
27795
|
paginationProps,
|
|
27689
27796
|
rows,
|
|
27690
|
-
|
|
27797
|
+
rowsPerPageOptions,
|
|
27691
27798
|
sx,
|
|
27692
27799
|
theme: propsTheme,
|
|
27693
27800
|
useRouter,
|
|
@@ -27698,38 +27805,43 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27698
27805
|
const theme = useTheme$4(propsTheme);
|
|
27699
27806
|
const _apiRef = useGridApiRef();
|
|
27700
27807
|
const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
|
|
27701
|
-
const RenderedToolbar =
|
|
27808
|
+
const RenderedToolbar = components !== null && components !== void 0 && components.Toolbar ? components.Toolbar : Toolbar$2;
|
|
27702
27809
|
LicenseInfo.setLicenseKey(license);
|
|
27703
27810
|
const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
|
|
27704
27811
|
const {
|
|
27705
27812
|
onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
|
|
27706
27813
|
onFilterModelChange: controlledOnFilterModelChange,
|
|
27707
|
-
|
|
27814
|
+
onPageChange: controlledOnPageChange,
|
|
27815
|
+
onPageSizeChange: controlledOnPageSizeChange,
|
|
27708
27816
|
onPinnedColumnsChange: controlledOnPinnedColumnsChange,
|
|
27709
27817
|
onSortModelChange: controlledOnSortModelChange
|
|
27710
27818
|
} = useControlledDatagridState({
|
|
27711
27819
|
initialState,
|
|
27712
|
-
|
|
27820
|
+
rowsPerPageOptions,
|
|
27713
27821
|
propsColumnVisibilityModel,
|
|
27714
27822
|
propsFilterModel,
|
|
27715
27823
|
propsOnColumnVisibilityModelChange,
|
|
27716
27824
|
propsOnFilterModelChange,
|
|
27717
27825
|
propsOnPinnedColumnsChange,
|
|
27718
27826
|
propsOnSortModelChange,
|
|
27719
|
-
|
|
27827
|
+
propsPage,
|
|
27828
|
+
propsPageSize,
|
|
27720
27829
|
propsPinnedColumns,
|
|
27721
27830
|
propsSortModel,
|
|
27722
|
-
|
|
27831
|
+
propsOnPageChange,
|
|
27832
|
+
propsOnPageSizeChange
|
|
27723
27833
|
});
|
|
27724
27834
|
const {
|
|
27725
27835
|
columnVisibilityModel,
|
|
27726
27836
|
filterModel,
|
|
27727
27837
|
onColumnVisibilityModelChange,
|
|
27728
27838
|
onFilterModelChange,
|
|
27729
|
-
|
|
27839
|
+
onPageChange,
|
|
27840
|
+
onPageSizeChange,
|
|
27730
27841
|
onPinnedColumnsChange,
|
|
27731
27842
|
onSortModelChange,
|
|
27732
|
-
|
|
27843
|
+
page,
|
|
27844
|
+
pageSize,
|
|
27733
27845
|
pinnedColumns,
|
|
27734
27846
|
sortModel,
|
|
27735
27847
|
onColumnWidthChange
|
|
@@ -27740,38 +27852,40 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27740
27852
|
onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
|
|
27741
27853
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
27742
27854
|
onFilterModelChange: controlledOnFilterModelChange,
|
|
27743
|
-
|
|
27855
|
+
onPageChange: controlledOnPageChange,
|
|
27856
|
+
onPageSizeChange: controlledOnPageSizeChange,
|
|
27744
27857
|
onPinnedColumnsChange: controlledOnPinnedColumnsChange,
|
|
27745
27858
|
onSortModelChange: controlledOnSortModelChange,
|
|
27746
27859
|
useRouter: useRouter,
|
|
27747
|
-
localStorageVersion
|
|
27860
|
+
localStorageVersion,
|
|
27861
|
+
previousLocalStorageVersions
|
|
27748
27862
|
});
|
|
27749
|
-
const [
|
|
27863
|
+
const [selectionModel, setSelectionModel] = useState(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
|
|
27750
27864
|
useEffect(() => {
|
|
27751
|
-
|
|
27752
|
-
}, [
|
|
27753
|
-
const
|
|
27754
|
-
if (
|
|
27755
|
-
|
|
27865
|
+
setSelectionModel(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
|
|
27866
|
+
}, [propsSelectionModel]);
|
|
27867
|
+
const onSelectionModelChange = (selectionModel, details) => {
|
|
27868
|
+
if (propsOnSelectionModelChange) {
|
|
27869
|
+
propsOnSelectionModelChange(selectionModel, details);
|
|
27756
27870
|
} else {
|
|
27757
|
-
|
|
27871
|
+
setSelectionModel(selectionModel);
|
|
27758
27872
|
}
|
|
27759
27873
|
};
|
|
27760
27874
|
const selectionStatus = useRef({
|
|
27761
27875
|
type: 'none',
|
|
27762
27876
|
numberOfSelectedRows: 0,
|
|
27763
27877
|
numberOfSelectedRowsInPage: 0,
|
|
27764
|
-
page
|
|
27765
|
-
pageSize:
|
|
27878
|
+
page,
|
|
27879
|
+
pageSize: pageSize
|
|
27766
27880
|
});
|
|
27767
27881
|
|
|
27768
27882
|
// in server-side pagination we want to update the selection status
|
|
27769
27883
|
// every time we navigate between pages, resize our page or select something
|
|
27770
27884
|
useEffect(() => {
|
|
27771
27885
|
if (paginationMode == 'server') {
|
|
27772
|
-
onServerSideSelectionStatusChange(Array.isArray(
|
|
27886
|
+
onServerSideSelectionStatusChange(Array.isArray(selectionModel) ? selectionModel : [selectionModel], apiRef, selectionStatus, isRowSelectable, page, pageSize);
|
|
27773
27887
|
}
|
|
27774
|
-
}, [
|
|
27888
|
+
}, [selectionModel, page, pageSize]);
|
|
27775
27889
|
if (!Array.isArray(rows)) {
|
|
27776
27890
|
return null;
|
|
27777
27891
|
}
|
|
@@ -27804,13 +27918,15 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27804
27918
|
filterModel: filterModel,
|
|
27805
27919
|
onColumnVisibilityModelChange: onColumnVisibilityModelChange,
|
|
27806
27920
|
onFilterModelChange: onFilterModelChange,
|
|
27807
|
-
|
|
27921
|
+
onPageChange: onPageChange,
|
|
27922
|
+
onPageSizeChange: onPageSizeChange,
|
|
27808
27923
|
onPinnedColumnsChange: onPinnedColumnsChange,
|
|
27809
27924
|
onSortModelChange: onSortModelChange,
|
|
27810
|
-
|
|
27925
|
+
page: page,
|
|
27926
|
+
pageSize: pageSize,
|
|
27811
27927
|
pinnedColumns: pinnedColumns,
|
|
27812
27928
|
sortModel: sortModel,
|
|
27813
|
-
|
|
27929
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
27814
27930
|
onColumnWidthChange: onColumnWidthChange,
|
|
27815
27931
|
initialState: initialState,
|
|
27816
27932
|
isRowSelectable: isRowSelectable,
|
|
@@ -27821,55 +27937,58 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27821
27937
|
rowCount: rowCount,
|
|
27822
27938
|
autoHeight: autoHeight,
|
|
27823
27939
|
checkboxSelectionVisibleOnly: Boolean(pagination),
|
|
27824
|
-
|
|
27825
|
-
|
|
27826
|
-
|
|
27827
|
-
|
|
27828
|
-
|
|
27829
|
-
|
|
27940
|
+
columnTypes: _objectSpread2(_objectSpread2({}, customColumnTypes), propsColumnTypes),
|
|
27941
|
+
components: _objectSpread2(_objectSpread2({
|
|
27942
|
+
BaseButton,
|
|
27943
|
+
BaseCheckbox,
|
|
27944
|
+
// BaseTextField,
|
|
27945
|
+
BasePopper,
|
|
27946
|
+
ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27830
27947
|
displayName: "ColumnFilteredIcon"
|
|
27831
27948
|
})),
|
|
27832
|
-
|
|
27949
|
+
ColumnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27833
27950
|
displayName: "ColumnSelectorIcon"
|
|
27834
27951
|
})),
|
|
27835
|
-
|
|
27952
|
+
ColumnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27836
27953
|
displayName: "ColumnSortedAscendingIcon"
|
|
27837
27954
|
})),
|
|
27838
|
-
|
|
27955
|
+
ColumnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27839
27956
|
displayName: "ColumnSortedDescendingIcon"
|
|
27840
27957
|
})),
|
|
27841
|
-
|
|
27958
|
+
DensityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27842
27959
|
displayName: "DensityCompactIcon"
|
|
27843
27960
|
})),
|
|
27844
|
-
|
|
27961
|
+
DensityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27845
27962
|
displayName: "DensityStandardIcon"
|
|
27846
27963
|
})),
|
|
27847
|
-
|
|
27964
|
+
DensityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27848
27965
|
displayName: "DensityComfortableIcon"
|
|
27849
27966
|
})),
|
|
27850
|
-
|
|
27967
|
+
DetailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27851
27968
|
displayName: "DetailPanelCollapseIcon"
|
|
27852
27969
|
})),
|
|
27853
|
-
|
|
27970
|
+
DetailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27854
27971
|
displayName: "DetailPanelExpandIcon"
|
|
27855
27972
|
})),
|
|
27856
|
-
|
|
27973
|
+
ExportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27857
27974
|
displayName: "ExportIcon"
|
|
27858
27975
|
})),
|
|
27859
|
-
|
|
27976
|
+
OpenFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
|
|
27860
27977
|
displayName: "OpenFilterButtonIcon"
|
|
27861
27978
|
}, props))
|
|
27862
|
-
},
|
|
27863
|
-
|
|
27864
|
-
|
|
27979
|
+
}, components), {}, {
|
|
27980
|
+
Toolbar: ToolbarWrapper,
|
|
27981
|
+
Pagination: props => {
|
|
27865
27982
|
return pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$1({}, props, {
|
|
27866
27983
|
displaySelection: false,
|
|
27867
27984
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
27868
27985
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
27869
27986
|
selectionStatus: selectionStatus.current,
|
|
27870
|
-
|
|
27871
|
-
|
|
27872
|
-
|
|
27987
|
+
page: page,
|
|
27988
|
+
pageSize: pageSize,
|
|
27989
|
+
onPageChange: onPageChange,
|
|
27990
|
+
onPageSizeChange: onPageSizeChange,
|
|
27991
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
27873
27992
|
paginationProps: paginationProps,
|
|
27874
27993
|
paginationMode: paginationMode,
|
|
27875
27994
|
rowCount: rowCount
|
|
@@ -27880,15 +27999,17 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27880
27999
|
selectionStatus: selectionStatus.current,
|
|
27881
28000
|
apiRef: apiRef,
|
|
27882
28001
|
isRowSelectable: isRowSelectable,
|
|
27883
|
-
|
|
27884
|
-
|
|
27885
|
-
|
|
28002
|
+
page: page,
|
|
28003
|
+
pageSize: pageSize,
|
|
28004
|
+
onPageChange: onPageChange,
|
|
28005
|
+
onPageSizeChange: onPageSizeChange,
|
|
28006
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
27886
28007
|
paginationProps: paginationProps,
|
|
27887
28008
|
paginationMode: paginationMode
|
|
27888
28009
|
})) : null;
|
|
27889
28010
|
}
|
|
27890
28011
|
}),
|
|
27891
|
-
|
|
28012
|
+
componentsProps: _objectSpread2(_objectSpread2({}, componentsProps), {}, {
|
|
27892
28013
|
toolbar: _objectSpread2({
|
|
27893
28014
|
hideToolbar,
|
|
27894
28015
|
RenderedToolbar,
|
|
@@ -27899,16 +28020,18 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27899
28020
|
selectionStatus,
|
|
27900
28021
|
apiRef,
|
|
27901
28022
|
isRowSelectable,
|
|
27902
|
-
|
|
27903
|
-
|
|
27904
|
-
|
|
28023
|
+
page,
|
|
28024
|
+
pageSize,
|
|
28025
|
+
onPageChange,
|
|
28026
|
+
onPageSizeChange,
|
|
28027
|
+
rowsPerPageOptions,
|
|
27905
28028
|
paginationProps,
|
|
27906
28029
|
paginationMode,
|
|
27907
28030
|
rowCount
|
|
27908
|
-
},
|
|
28031
|
+
}, componentsProps === null || componentsProps === void 0 ? void 0 : componentsProps.toolbar)
|
|
27909
28032
|
}),
|
|
27910
|
-
|
|
27911
|
-
|
|
28033
|
+
selectionModel: selectionModel,
|
|
28034
|
+
onSelectionModelChange: (newSelectionModel, details) => {
|
|
27912
28035
|
if (pagination && paginationMode != 'server') {
|
|
27913
28036
|
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
|
|
27914
28037
|
let {
|
|
@@ -27966,7 +28089,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27966
28089
|
};
|
|
27967
28090
|
}
|
|
27968
28091
|
}
|
|
27969
|
-
|
|
28092
|
+
onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(newSelectionModel, details);
|
|
27970
28093
|
},
|
|
27971
28094
|
sx: _objectSpread2(_objectSpread2({}, sx), {}, {
|
|
27972
28095
|
'.MuiDataGrid-columnHeaders': {
|
|
@@ -28040,5 +28163,5 @@ const TextCell = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
28040
28163
|
TextCell.className = CLASSNAME;
|
|
28041
28164
|
TextCell.displayName = COMPONENT_NAME;
|
|
28042
28165
|
|
|
28043
|
-
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, DataGrid, ENDS_WITH_ANY_OF, FILTER_MODEL_KEY, FILTER_SEARCH_KEY, GridToolbarFilterSemanticField, IS_ANY_OF, IS_BETWEEN, IS_NOT_ANY_OF, 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, getRsNumberColumnType, getRsStringColumnType, getSearchParamsFromColumnVisibility, getSearchParamsFromFilterModel, getSearchParamsFromPagination, getSearchParamsFromPinnedColumns, getSearchParamsFromSorting, getSearchParamsFromTab, getSortingFromString,
|
|
28166
|
+
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, DataGrid, ENDS_WITH_ANY_OF, FILTER_MODEL_KEY, FILTER_SEARCH_KEY, GridToolbarFilterSemanticField, IS_ANY_OF, IS_BETWEEN, IS_NOT_ANY_OF, 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, getRsNumberColumnType, getRsStringColumnType, getSearchParamsFromColumnVisibility, getSearchParamsFromFilterModel, getSearchParamsFromPagination, getSearchParamsFromPinnedColumns, getSearchParamsFromSorting, getSearchParamsFromTab, getSortingFromString, muiIconToDSIcon, numberOperatorDecoder, numberOperatorEncoder, onServerSideSelectionStatusChange, operatorList, updateUrl, urlSearchParamsToString };
|
|
28044
28167
|
//# sourceMappingURL=index.js.map
|