@redsift/table 11.2.0 → 11.2.1-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 +35 -31
- package/index.js +383 -316
- 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',
|
|
@@ -18063,39 +18063,42 @@ const numberOperatorDecoder = {
|
|
|
18063
18063
|
lt: '<',
|
|
18064
18064
|
lte: '<='
|
|
18065
18065
|
};
|
|
18066
|
-
const isOperatorValueValid = (
|
|
18067
|
-
const column = columns.find(column => column.field ===
|
|
18066
|
+
const isOperatorValueValid = (columnField, operatorValue, columns) => {
|
|
18067
|
+
const column = columns.find(column => column.field === columnField);
|
|
18068
18068
|
if (!column) {
|
|
18069
18069
|
return false;
|
|
18070
18070
|
}
|
|
18071
18071
|
const columnType = (column === null || column === void 0 ? void 0 : column.type) || 'string';
|
|
18072
|
-
const operators =
|
|
18072
|
+
const operators = operatorList[columnType];
|
|
18073
18073
|
if (!operators) {
|
|
18074
18074
|
return false;
|
|
18075
18075
|
}
|
|
18076
|
-
|
|
18076
|
+
if ('filterOperators' in operators) {
|
|
18077
|
+
return !!operators.filterOperators.find(op => columnType === 'number' && Object.keys(numberOperatorEncoder).includes(op.value) ? numberOperatorEncoder[op.value] === operatorValue : op['value'] === operatorValue);
|
|
18078
|
+
}
|
|
18079
|
+
return !!operators.find(op => ['number', 'rsNumber'].includes(columnType) && Object.keys(numberOperatorEncoder).includes(op.value) ? numberOperatorEncoder[op.value] === operatorValue : op['value'] === operatorValue);
|
|
18077
18080
|
};
|
|
18078
18081
|
const listOperators = ['containsAnyOf', 'endsWithAnyOf', 'isAnyOf', 'isNotAnyOf', 'startsWithAnyOf'];
|
|
18079
18082
|
|
|
18080
18083
|
// Check if the value doesn't break
|
|
18081
|
-
const isValueValid = (value,
|
|
18084
|
+
const isValueValid = (value, columnField, columns, operatorValue) => {
|
|
18082
18085
|
var _column$type;
|
|
18083
18086
|
// every field accepts undefined as value for default
|
|
18084
18087
|
if (value === undefined || value === '') {
|
|
18085
18088
|
return true;
|
|
18086
18089
|
}
|
|
18087
18090
|
|
|
18088
|
-
// xxxAnyOf accepts as value only lists, and we are
|
|
18091
|
+
// xxxAnyOf accepts as value only lists, and we are declearing them in the
|
|
18089
18092
|
// URL as `list=[...]`
|
|
18090
|
-
if (listOperators.includes(
|
|
18093
|
+
if (listOperators.includes(operatorValue)) {
|
|
18091
18094
|
return Array.isArray(value) || value === '';
|
|
18092
18095
|
}
|
|
18093
18096
|
|
|
18094
18097
|
// We are accepting arrays only if they are of the 'xxxAnyOf' type
|
|
18095
|
-
if (Array.isArray(value) && !listOperators.includes(
|
|
18098
|
+
if (Array.isArray(value) && !listOperators.includes(operatorValue)) {
|
|
18096
18099
|
return false;
|
|
18097
18100
|
}
|
|
18098
|
-
const column = columns.find(column => column.field ===
|
|
18101
|
+
const column = columns.find(column => column.field === columnField);
|
|
18099
18102
|
if (!column) {
|
|
18100
18103
|
return false;
|
|
18101
18104
|
}
|
|
@@ -18133,14 +18136,14 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
18133
18136
|
if (!searchString) {
|
|
18134
18137
|
return 'invalid';
|
|
18135
18138
|
}
|
|
18136
|
-
let
|
|
18139
|
+
let linkOperator = GridLinkOperator.And;
|
|
18137
18140
|
const searchParams = new URLSearchParams();
|
|
18138
18141
|
for (const [key, value] of new URLSearchParams(searchString)) {
|
|
18139
18142
|
if (key.startsWith('_') && !['_logicOperator', '_sortColumn', '_pinnedColumnsLeft', '_pinnedColumnsRight', '_columnVisibility', '_pagination'].includes(key)) {
|
|
18140
18143
|
searchParams.set(key, value);
|
|
18141
18144
|
}
|
|
18142
18145
|
if (key === '_logicOperator') {
|
|
18143
|
-
|
|
18146
|
+
linkOperator = value;
|
|
18144
18147
|
}
|
|
18145
18148
|
}
|
|
18146
18149
|
let id = 5000;
|
|
@@ -18181,8 +18184,8 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
18181
18184
|
return;
|
|
18182
18185
|
}
|
|
18183
18186
|
items.push({
|
|
18184
|
-
field,
|
|
18185
|
-
|
|
18187
|
+
columnField: field,
|
|
18188
|
+
operatorValue: ['number', 'rsNumber'].includes(columnType) && Object.keys(numberOperatorDecoder).includes(operator) ? numberOperatorDecoder[operator] : operator,
|
|
18186
18189
|
id,
|
|
18187
18190
|
value: listOperators.includes(operator) && decodedValue === '' ? [] : decodedValue,
|
|
18188
18191
|
type
|
|
@@ -18197,23 +18200,23 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
18197
18200
|
}
|
|
18198
18201
|
return {
|
|
18199
18202
|
items,
|
|
18200
|
-
|
|
18203
|
+
linkOperator
|
|
18201
18204
|
};
|
|
18202
18205
|
};
|
|
18203
18206
|
const getSearchParamsFromFilterModel = filterModel => {
|
|
18204
18207
|
const searchParams = new URLSearchParams();
|
|
18205
|
-
searchParams.set('_logicOperator', filterModel['
|
|
18208
|
+
searchParams.set('_logicOperator', filterModel['linkOperator'] || '');
|
|
18206
18209
|
filterModel['items'].forEach(item => {
|
|
18207
18210
|
const {
|
|
18208
|
-
|
|
18209
|
-
|
|
18211
|
+
columnField,
|
|
18212
|
+
operatorValue,
|
|
18210
18213
|
value,
|
|
18211
18214
|
type
|
|
18212
18215
|
} = item;
|
|
18213
|
-
if (Object.keys(numberOperatorEncoder).includes(
|
|
18214
|
-
searchParams.set(`_${
|
|
18216
|
+
if (Object.keys(numberOperatorEncoder).includes(operatorValue)) {
|
|
18217
|
+
searchParams.set(`_${columnField}[${numberOperatorEncoder[operatorValue]},${encodeValue(type)}]`, encodeValue(value));
|
|
18215
18218
|
} else {
|
|
18216
|
-
searchParams.set(`_${
|
|
18219
|
+
searchParams.set(`_${columnField}[${encodeValue(operatorValue)},${encodeValue(type)}]`, encodeValue(value));
|
|
18217
18220
|
}
|
|
18218
18221
|
});
|
|
18219
18222
|
return searchParams;
|
|
@@ -18239,7 +18242,7 @@ const getFilterModel = (search, columns, localStorageFilters, setLocalStorageFil
|
|
|
18239
18242
|
}
|
|
18240
18243
|
return initialState && initialState.filter && initialState.filter.filterModel ? initialState.filter.filterModel : {
|
|
18241
18244
|
items: [],
|
|
18242
|
-
|
|
18245
|
+
linkOperator: GridLinkOperator.And
|
|
18243
18246
|
};
|
|
18244
18247
|
};
|
|
18245
18248
|
|
|
@@ -18247,7 +18250,7 @@ const getFilterModel = (search, columns, localStorageFilters, setLocalStorageFil
|
|
|
18247
18250
|
|
|
18248
18251
|
const getSortingFromString = (searchString, columns) => {
|
|
18249
18252
|
if (!searchString) {
|
|
18250
|
-
return
|
|
18253
|
+
return 'invalid';
|
|
18251
18254
|
}
|
|
18252
18255
|
const searchParams = new URLSearchParams(searchString);
|
|
18253
18256
|
const value = searchParams.get('_sortColumn');
|
|
@@ -18262,7 +18265,7 @@ const getSortingFromString = (searchString, columns) => {
|
|
|
18262
18265
|
sort: order
|
|
18263
18266
|
}];
|
|
18264
18267
|
}
|
|
18265
|
-
return
|
|
18268
|
+
return 'invalid';
|
|
18266
18269
|
};
|
|
18267
18270
|
const getSearchParamsFromSorting = sorting => {
|
|
18268
18271
|
const searchParams = new URLSearchParams();
|
|
@@ -18274,9 +18277,10 @@ const getSearchParamsFromSorting = sorting => {
|
|
|
18274
18277
|
// - if we have something in the URL, use that info
|
|
18275
18278
|
// - if we don't have that, use the localStorage and update the URL
|
|
18276
18279
|
// - if we don't have that, return an empty SortModel
|
|
18277
|
-
const getSortModel = (search, columns, localStorageSorting, setLocalStorageSorting) => {
|
|
18280
|
+
const getSortModel = (search, columns, localStorageSorting, setLocalStorageSorting, initialState) => {
|
|
18281
|
+
var _initialState$sorting;
|
|
18278
18282
|
const sorting = getSortingFromString(search, columns);
|
|
18279
|
-
if (sorting) {
|
|
18283
|
+
if (sorting !== 'invalid') {
|
|
18280
18284
|
const searchFromSortModel = getSearchParamsFromSorting(sorting);
|
|
18281
18285
|
const searchString = urlSearchParamsToString(searchFromSortModel);
|
|
18282
18286
|
if (searchString !== localStorageSorting) {
|
|
@@ -18285,30 +18289,22 @@ const getSortModel = (search, columns, localStorageSorting, setLocalStorageSorti
|
|
|
18285
18289
|
return sorting;
|
|
18286
18290
|
}
|
|
18287
18291
|
const sortModelFromLocalStorage = getSortingFromString(localStorageSorting, columns);
|
|
18288
|
-
if (sortModelFromLocalStorage) {
|
|
18292
|
+
if (sortModelFromLocalStorage !== 'invalid') {
|
|
18289
18293
|
return sortModelFromLocalStorage;
|
|
18290
18294
|
}
|
|
18291
|
-
return [];
|
|
18295
|
+
return initialState !== null && initialState !== void 0 && (_initialState$sorting = initialState.sorting) !== null && _initialState$sorting !== void 0 && _initialState$sorting.sortModel ? initialState.sorting.sortModel : [];
|
|
18292
18296
|
};
|
|
18293
18297
|
|
|
18294
18298
|
/** PAGINATION */
|
|
18295
18299
|
|
|
18296
18300
|
const getPaginationFromString = searchString => {
|
|
18297
18301
|
if (!searchString) {
|
|
18298
|
-
return
|
|
18299
|
-
page: 0,
|
|
18300
|
-
pageSize: 25,
|
|
18301
|
-
direction: 'next'
|
|
18302
|
-
};
|
|
18302
|
+
return 'invalid';
|
|
18303
18303
|
}
|
|
18304
18304
|
const searchParams = new URLSearchParams(searchString);
|
|
18305
18305
|
const value = searchParams.get('_pagination');
|
|
18306
18306
|
if (value === '' || value === null || value === '[]') {
|
|
18307
|
-
return
|
|
18308
|
-
page: 0,
|
|
18309
|
-
pageSize: 25,
|
|
18310
|
-
direction: 'next'
|
|
18311
|
-
};
|
|
18307
|
+
return 'invalid';
|
|
18312
18308
|
}
|
|
18313
18309
|
const pagination = value.slice(1, value.length - 1).split(',');
|
|
18314
18310
|
const page = parseFloat(pagination[0]);
|
|
@@ -18321,11 +18317,7 @@ const getPaginationFromString = searchString => {
|
|
|
18321
18317
|
direction: direction
|
|
18322
18318
|
};
|
|
18323
18319
|
}
|
|
18324
|
-
return
|
|
18325
|
-
page: 0,
|
|
18326
|
-
pageSize: 25,
|
|
18327
|
-
direction: 'next'
|
|
18328
|
-
};
|
|
18320
|
+
return 'invalid';
|
|
18329
18321
|
};
|
|
18330
18322
|
const getSearchParamsFromPagination = pagination => {
|
|
18331
18323
|
const searchParams = new URLSearchParams();
|
|
@@ -18337,9 +18329,9 @@ const getSearchParamsFromPagination = pagination => {
|
|
|
18337
18329
|
// - if we have something in the URL, use that info
|
|
18338
18330
|
// - if we don't have that, use the localStorage and update the URL
|
|
18339
18331
|
// - if we don't have that, return an empty PaginationModel
|
|
18340
|
-
const getPaginationModel = (search, localStoragePagination, setLocalStoragePagination) => {
|
|
18332
|
+
const getPaginationModel = (search, localStoragePagination, setLocalStoragePagination, initialState) => {
|
|
18341
18333
|
const pagination = getPaginationFromString(search);
|
|
18342
|
-
if (pagination) {
|
|
18334
|
+
if (pagination !== 'invalid') {
|
|
18343
18335
|
const searchFromPaginationModel = getSearchParamsFromPagination(pagination);
|
|
18344
18336
|
const searchString = urlSearchParamsToString(searchFromPaginationModel);
|
|
18345
18337
|
if (searchString !== localStoragePagination) {
|
|
@@ -18348,10 +18340,14 @@ const getPaginationModel = (search, localStoragePagination, setLocalStoragePagin
|
|
|
18348
18340
|
return pagination;
|
|
18349
18341
|
}
|
|
18350
18342
|
const paginationModelFromLocalStorage = getPaginationFromString(localStoragePagination);
|
|
18351
|
-
if (paginationModelFromLocalStorage) {
|
|
18343
|
+
if (paginationModelFromLocalStorage !== 'invalid') {
|
|
18352
18344
|
return paginationModelFromLocalStorage;
|
|
18353
18345
|
}
|
|
18354
|
-
return {
|
|
18346
|
+
return initialState !== null && initialState !== void 0 && initialState.pagination ? _objectSpread2({
|
|
18347
|
+
page: 0,
|
|
18348
|
+
pageSize: 25,
|
|
18349
|
+
direction: 'next'
|
|
18350
|
+
}, initialState.pagination) : {
|
|
18355
18351
|
page: 0,
|
|
18356
18352
|
pageSize: 25,
|
|
18357
18353
|
direction: 'next'
|
|
@@ -18362,11 +18358,11 @@ const getPaginationModel = (search, localStoragePagination, setLocalStoragePagin
|
|
|
18362
18358
|
|
|
18363
18359
|
const getSearchParamsFromColumnVisibility = (columnVisibility, columns) => {
|
|
18364
18360
|
const searchParams = new URLSearchParams();
|
|
18365
|
-
const
|
|
18361
|
+
const columnFields = columns.map(column => column.field);
|
|
18366
18362
|
|
|
18367
18363
|
// if column visibility model is empty, show all columns
|
|
18368
18364
|
if (Object.keys(columnVisibility).length == 0) {
|
|
18369
|
-
searchParams.set('_columnVisibility', `[${
|
|
18365
|
+
searchParams.set('_columnVisibility', `[${columnFields.join(',')}]`);
|
|
18370
18366
|
return searchParams;
|
|
18371
18367
|
}
|
|
18372
18368
|
const finalColumnVisibility = columns.filter(c => {
|
|
@@ -18393,7 +18389,7 @@ const getSearchParamsFromColumnVisibility = (columnVisibility, columns) => {
|
|
|
18393
18389
|
};
|
|
18394
18390
|
const getColumnVisibilityFromString = (notParsed, tableColumns) => {
|
|
18395
18391
|
if (!notParsed || notParsed.length === 1 && notParsed[0] === '?') {
|
|
18396
|
-
return
|
|
18392
|
+
return 'invalid';
|
|
18397
18393
|
}
|
|
18398
18394
|
// remove the initial ? if present
|
|
18399
18395
|
const parsed = notParsed[0] === '?' ? notParsed.slice(1) : notParsed;
|
|
@@ -18416,12 +18412,12 @@ const getColumnVisibilityFromString = (notParsed, tableColumns) => {
|
|
|
18416
18412
|
continue;
|
|
18417
18413
|
}
|
|
18418
18414
|
exist = true;
|
|
18419
|
-
const
|
|
18415
|
+
const columnFields = tableColumns.map(column => column.field);
|
|
18420
18416
|
// TODO: Add validation that , is present
|
|
18421
18417
|
const columns = encodedValues.split(',').map(value => decodeValue(value));
|
|
18422
18418
|
|
|
18423
18419
|
// for each column, check if it's visible and add it to visibility model
|
|
18424
|
-
for (const column of
|
|
18420
|
+
for (const column of columnFields) {
|
|
18425
18421
|
const isColumnVisible = columns.includes(column);
|
|
18426
18422
|
visibility[column] = isColumnVisible;
|
|
18427
18423
|
if (isColumnVisible) {
|
|
@@ -18430,7 +18426,7 @@ const getColumnVisibilityFromString = (notParsed, tableColumns) => {
|
|
|
18430
18426
|
}
|
|
18431
18427
|
}
|
|
18432
18428
|
if (visibleColumnsCount === 0 && !exist) {
|
|
18433
|
-
return
|
|
18429
|
+
return 'invalid';
|
|
18434
18430
|
}
|
|
18435
18431
|
return visibility;
|
|
18436
18432
|
};
|
|
@@ -18441,9 +18437,10 @@ const getColumnVisibilityFromString = (notParsed, tableColumns) => {
|
|
|
18441
18437
|
// - if we don't have that, return an empty ColumnVisibilityModel (which is all columns)
|
|
18442
18438
|
// NOTE: the `defaultHidden` is a custom field and not standard DataGrid
|
|
18443
18439
|
// The reason is the following bug: https://github.com/mui/mui-x/issues/8407
|
|
18444
|
-
const getColumnsVisibility = (search, columns, localStorageColumnsVisibility, setLocalStorageColumnsVisibility) => {
|
|
18440
|
+
const getColumnsVisibility = (search, columns, localStorageColumnsVisibility, setLocalStorageColumnsVisibility, initialState) => {
|
|
18441
|
+
var _initialState$columns;
|
|
18445
18442
|
const columnVisibility = getColumnVisibilityFromString(search, columns);
|
|
18446
|
-
if (columnVisibility) {
|
|
18443
|
+
if (columnVisibility !== 'invalid') {
|
|
18447
18444
|
const searchColumnVisibility = getSearchParamsFromColumnVisibility(columnVisibility, columns);
|
|
18448
18445
|
if (searchColumnVisibility.toString() !== localStorageColumnsVisibility) {
|
|
18449
18446
|
setLocalStorageColumnsVisibility(searchColumnVisibility.toString());
|
|
@@ -18451,9 +18448,12 @@ const getColumnsVisibility = (search, columns, localStorageColumnsVisibility, se
|
|
|
18451
18448
|
return columnVisibility;
|
|
18452
18449
|
}
|
|
18453
18450
|
const columnVisibilityFromLocalStorage = getColumnVisibilityFromString(localStorageColumnsVisibility, columns);
|
|
18454
|
-
if (columnVisibilityFromLocalStorage) {
|
|
18451
|
+
if (columnVisibilityFromLocalStorage !== 'invalid') {
|
|
18455
18452
|
return columnVisibilityFromLocalStorage;
|
|
18456
18453
|
}
|
|
18454
|
+
if (initialState !== null && initialState !== void 0 && (_initialState$columns = initialState.columns) !== null && _initialState$columns !== void 0 && _initialState$columns.columnVisibilityModel) {
|
|
18455
|
+
return initialState.columns.columnVisibilityModel;
|
|
18456
|
+
}
|
|
18457
18457
|
|
|
18458
18458
|
// No columns in URL or localStorage, just show them all expect the hidden ones
|
|
18459
18459
|
const res = {};
|
|
@@ -18466,7 +18466,7 @@ const getColumnsVisibility = (search, columns, localStorageColumnsVisibility, se
|
|
|
18466
18466
|
};
|
|
18467
18467
|
const getPinnedColumnsFromString = (notParsed, tableColumns) => {
|
|
18468
18468
|
if (!notParsed || notParsed.length === 1 && notParsed[0] === '?') {
|
|
18469
|
-
return
|
|
18469
|
+
return 'invalid';
|
|
18470
18470
|
}
|
|
18471
18471
|
// remove the initial ? if present
|
|
18472
18472
|
const parsed = notParsed[0] === '?' ? notParsed.slice(1) : notParsed;
|
|
@@ -18484,8 +18484,8 @@ const getPinnedColumnsFromString = (notParsed, tableColumns) => {
|
|
|
18484
18484
|
if (typeof encodedValues !== 'string') {
|
|
18485
18485
|
continue;
|
|
18486
18486
|
}
|
|
18487
|
-
const
|
|
18488
|
-
const columns = encodedValues.split(',').map(value => decodeValue(value)).filter(val => typeof val === 'string' &&
|
|
18487
|
+
const columnFields = [...tableColumns.map(column => column.field), '__check__'];
|
|
18488
|
+
const columns = encodedValues.split(',').map(value => decodeValue(value)).filter(val => typeof val === 'string' && columnFields.includes(val));
|
|
18489
18489
|
if (fieldURL === '_pinnedColumnsLeft') {
|
|
18490
18490
|
pinnedColumns['left'] = columns;
|
|
18491
18491
|
}
|
|
@@ -18493,13 +18493,10 @@ const getPinnedColumnsFromString = (notParsed, tableColumns) => {
|
|
|
18493
18493
|
pinnedColumns['right'] = columns;
|
|
18494
18494
|
}
|
|
18495
18495
|
}
|
|
18496
|
-
|
|
18497
|
-
|
|
18498
|
-
|
|
18499
|
-
|
|
18500
|
-
};
|
|
18501
|
-
}
|
|
18502
|
-
return null;
|
|
18496
|
+
return pinnedColumns['left'] || pinnedColumns['right'] ? {
|
|
18497
|
+
left: pinnedColumns['left'] || [],
|
|
18498
|
+
right: pinnedColumns['right'] || []
|
|
18499
|
+
} : 'invalid';
|
|
18503
18500
|
};
|
|
18504
18501
|
const getSearchParamsFromPinnedColumns = pinnedColumns => {
|
|
18505
18502
|
var _pinnedColumns$left, _pinnedColumns$right;
|
|
@@ -18515,9 +18512,9 @@ const getSearchParamsFromPinnedColumns = pinnedColumns => {
|
|
|
18515
18512
|
// - if we have something in the URL, use that info
|
|
18516
18513
|
// - if we don't have that, use the localStorage and update the URL
|
|
18517
18514
|
// - if we don't have that, return an empty ColumnVisibilityModel (which is all columns)
|
|
18518
|
-
const getPinnedColumns = (search, columns, localStoragePinnedColumns, setLocalStoragePinnedColumns) => {
|
|
18515
|
+
const getPinnedColumns = (search, columns, localStoragePinnedColumns, setLocalStoragePinnedColumns, initialState) => {
|
|
18519
18516
|
const pinnedColumns = getPinnedColumnsFromString(search, columns);
|
|
18520
|
-
if (pinnedColumns) {
|
|
18517
|
+
if (pinnedColumns !== 'invalid') {
|
|
18521
18518
|
const searchPinnedColumns = getSearchParamsFromPinnedColumns(pinnedColumns);
|
|
18522
18519
|
if (searchPinnedColumns.toString() !== localStoragePinnedColumns) {
|
|
18523
18520
|
setLocalStoragePinnedColumns(searchPinnedColumns.toString());
|
|
@@ -18525,9 +18522,15 @@ const getPinnedColumns = (search, columns, localStoragePinnedColumns, setLocalSt
|
|
|
18525
18522
|
return pinnedColumns;
|
|
18526
18523
|
}
|
|
18527
18524
|
const pinnedColumnsFromLocalStorage = getPinnedColumnsFromString(localStoragePinnedColumns, columns);
|
|
18528
|
-
if (pinnedColumnsFromLocalStorage) {
|
|
18525
|
+
if (pinnedColumnsFromLocalStorage !== 'invalid') {
|
|
18529
18526
|
return pinnedColumnsFromLocalStorage;
|
|
18530
18527
|
}
|
|
18528
|
+
if (initialState !== null && initialState !== void 0 && initialState.pinnedColumns) {
|
|
18529
|
+
return {
|
|
18530
|
+
left: (initialState === null || initialState === void 0 ? void 0 : initialState.pinnedColumns['left']) || [],
|
|
18531
|
+
right: (initialState === null || initialState === void 0 ? void 0 : initialState.pinnedColumns['right']) || []
|
|
18532
|
+
};
|
|
18533
|
+
}
|
|
18531
18534
|
|
|
18532
18535
|
// No pinnedColumn in URL or localStorage, TODO: decide what is the default state
|
|
18533
18536
|
const res = {
|
|
@@ -18583,10 +18586,10 @@ const getModelsParsedOrUpdateLocalStorage = (search, columns, historyReplace, in
|
|
|
18583
18586
|
setLocalStoragePinnedColumns
|
|
18584
18587
|
} = localStorage;
|
|
18585
18588
|
const filterModel = getFilterModel(search, columns, localStorageFilters, setLocalStorageFilters, initialState);
|
|
18586
|
-
const sortModel = getSortModel(search, columns, localStorageSorting, setLocalStorageSorting);
|
|
18587
|
-
const paginationModel = getPaginationModel(search, localStoragePagination, setLocalStoragePagination);
|
|
18588
|
-
const columnVisibilityModel = getColumnsVisibility(search, columns, localStorageColumnsVisibility, setLocalStorageColumnsVisibility);
|
|
18589
|
-
const pinnedColumnsModel = getPinnedColumns(search, columns, localStoragePinnedColumns, setLocalStoragePinnedColumns);
|
|
18589
|
+
const sortModel = getSortModel(search, columns, localStorageSorting, setLocalStorageSorting, initialState);
|
|
18590
|
+
const paginationModel = getPaginationModel(search, localStoragePagination, setLocalStoragePagination, initialState);
|
|
18591
|
+
const columnVisibilityModel = getColumnsVisibility(search, columns, localStorageColumnsVisibility, setLocalStorageColumnsVisibility, initialState);
|
|
18592
|
+
const pinnedColumnsModel = getPinnedColumns(search, columns, localStoragePinnedColumns, setLocalStoragePinnedColumns, initialState);
|
|
18590
18593
|
const finalSearch = getFinalSearch({
|
|
18591
18594
|
search,
|
|
18592
18595
|
filterModel,
|
|
@@ -18635,17 +18638,17 @@ const updateUrl = (_ref4, search, historyReplace, columns) => {
|
|
|
18635
18638
|
// do not use it for equivalence (e.g. with value `3` and undefined we
|
|
18636
18639
|
// will get 0).
|
|
18637
18640
|
const compareFilters = (firstFilter, secondFilter) => {
|
|
18638
|
-
if (firstFilter.
|
|
18641
|
+
if (firstFilter.columnField < secondFilter.columnField) {
|
|
18639
18642
|
return -1;
|
|
18640
|
-
} else if (firstFilter.
|
|
18643
|
+
} else if (firstFilter.columnField > secondFilter.columnField) {
|
|
18641
18644
|
return 1;
|
|
18642
18645
|
}
|
|
18643
|
-
if (firstFilter.
|
|
18646
|
+
if (firstFilter.operatorValue === undefined || secondFilter.operatorValue === undefined) {
|
|
18644
18647
|
return 0;
|
|
18645
18648
|
}
|
|
18646
|
-
if (firstFilter.
|
|
18649
|
+
if (firstFilter.operatorValue < secondFilter.operatorValue) {
|
|
18647
18650
|
return -1;
|
|
18648
|
-
} else if (firstFilter.
|
|
18651
|
+
} else if (firstFilter.operatorValue > secondFilter.operatorValue) {
|
|
18649
18652
|
return 1;
|
|
18650
18653
|
}
|
|
18651
18654
|
if (firstFilter.value < secondFilter.value) {
|
|
@@ -18656,18 +18659,18 @@ const compareFilters = (firstFilter, secondFilter) => {
|
|
|
18656
18659
|
return 0;
|
|
18657
18660
|
};
|
|
18658
18661
|
const areFiltersEquivalent = (firstFilter, secondFilter) => {
|
|
18659
|
-
return firstFilter.
|
|
18662
|
+
return firstFilter.columnField === secondFilter.columnField && firstFilter.operatorValue === secondFilter.operatorValue && firstFilter.value === secondFilter.value;
|
|
18660
18663
|
};
|
|
18661
18664
|
const areFilterModelsEquivalent = (filterModel, filterModelToMatch) => {
|
|
18662
18665
|
const {
|
|
18663
18666
|
items,
|
|
18664
|
-
|
|
18667
|
+
linkOperator
|
|
18665
18668
|
} = filterModel;
|
|
18666
18669
|
const {
|
|
18667
18670
|
items: itemsToMatch,
|
|
18668
|
-
|
|
18671
|
+
linkOperator: linkOperatorToMatch
|
|
18669
18672
|
} = filterModelToMatch;
|
|
18670
|
-
if (
|
|
18673
|
+
if (linkOperator !== linkOperatorToMatch) {
|
|
18671
18674
|
return false;
|
|
18672
18675
|
}
|
|
18673
18676
|
if (items.length !== itemsToMatch.length) {
|
|
@@ -18680,7 +18683,7 @@ const areFilterModelsEquivalent = (filterModel, filterModelToMatch) => {
|
|
|
18680
18683
|
const filterToCompare = itemsToMatch[i];
|
|
18681
18684
|
|
|
18682
18685
|
// compareFilters return 0 if and only if the filters have the same
|
|
18683
|
-
//
|
|
18686
|
+
// columnField, operatorValue, and value
|
|
18684
18687
|
if (!areFiltersEquivalent(filter, filterToCompare)) {
|
|
18685
18688
|
return false;
|
|
18686
18689
|
}
|
|
@@ -24491,16 +24494,16 @@ const getRole = (config, dateFormat) => {
|
|
|
24491
24494
|
}).join('\n');
|
|
24492
24495
|
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.
|
|
24493
24496
|
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.
|
|
24494
|
-
The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "
|
|
24495
|
-
- "
|
|
24496
|
-
- "items": a list of conditions, each is an object with exactly the three keys "
|
|
24497
|
-
- "
|
|
24497
|
+
The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "linkOperator" and "items":
|
|
24498
|
+
- "linkOperator": the logical operator, only "and" or "or" are allowed. If there is only one condition in the "items", use "and".
|
|
24499
|
+
- "items": a list of conditions, each is an object with exactly the three keys "columnField", "operatorValue" and "value":
|
|
24500
|
+
- "columnField": the column name, must be one of ${columns}
|
|
24498
24501
|
- "value":
|
|
24499
|
-
- this can be skipped if the "
|
|
24500
|
-
- a list of multiple values if the "
|
|
24502
|
+
- this can be skipped if the "operatorValue" is either "isEmpty" or "isNotEmpty"
|
|
24503
|
+
- a list of multiple values if the "operatorValue" ends with "AnyOf"
|
|
24501
24504
|
- otherwise, it's a single value represented as a string: "true" instead of true, "false" instead of false, "0.6" instead of 0.6.
|
|
24502
24505
|
For "date" data type, use ${dateFormat}. If relative date is input, convert to the actual date given today is ${today}.
|
|
24503
|
-
- "
|
|
24506
|
+
- "operatorValue": the comparison operator, accepted values depend on the data type of the column
|
|
24504
24507
|
${operators}
|
|
24505
24508
|
|
|
24506
24509
|
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:
|
|
@@ -24537,10 +24540,10 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24537
24540
|
nlpFilterConfig,
|
|
24538
24541
|
onFilterModelChange,
|
|
24539
24542
|
dateFormat = 'yyyy-mm-dd',
|
|
24540
|
-
defaultModel = 'gpt-4-
|
|
24543
|
+
defaultModel = 'gpt-4-0613',
|
|
24541
24544
|
defaultFilter = {
|
|
24542
24545
|
items: [],
|
|
24543
|
-
|
|
24546
|
+
linkOperator: 'and'
|
|
24544
24547
|
},
|
|
24545
24548
|
disablePower = false,
|
|
24546
24549
|
localeText
|
|
@@ -24618,7 +24621,7 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24618
24621
|
value: prompt
|
|
24619
24622
|
}), /*#__PURE__*/React__default.createElement(Button, {
|
|
24620
24623
|
variant: "primary",
|
|
24621
|
-
"
|
|
24624
|
+
"aira-label": buttonAriaLabel,
|
|
24622
24625
|
type: "submit",
|
|
24623
24626
|
isLoading: isLoading
|
|
24624
24627
|
}, buttonText)), !disablePower && /*#__PURE__*/React__default.createElement(Tooltip, null, /*#__PURE__*/React__default.createElement(Tooltip.Trigger, null, /*#__PURE__*/React__default.createElement(Switch, {
|
|
@@ -24679,7 +24682,7 @@ const Toolbar$2 = props => {
|
|
|
24679
24682
|
let {
|
|
24680
24683
|
apiRef
|
|
24681
24684
|
} = _ref;
|
|
24682
|
-
return
|
|
24685
|
+
return gridVisibleSortedRowIdsSelector(apiRef);
|
|
24683
24686
|
}
|
|
24684
24687
|
},
|
|
24685
24688
|
printOptions: {
|
|
@@ -26911,10 +26914,12 @@ const ServerSideControlledPagination = _ref3 => {
|
|
|
26911
26914
|
selectionStatus,
|
|
26912
26915
|
displaySelection,
|
|
26913
26916
|
displayPagination,
|
|
26914
|
-
|
|
26915
|
-
|
|
26916
|
-
|
|
26917
|
+
page,
|
|
26918
|
+
onPageChange,
|
|
26919
|
+
pageSize,
|
|
26920
|
+
onPageSizeChange,
|
|
26917
26921
|
displayRowsPerPage,
|
|
26922
|
+
rowsPerPageOptions,
|
|
26918
26923
|
paginationProps,
|
|
26919
26924
|
rowCount
|
|
26920
26925
|
} = _ref3;
|
|
@@ -26933,17 +26938,13 @@ const ServerSideControlledPagination = _ref3 => {
|
|
|
26933
26938
|
}, totalRowsLabel) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$1({
|
|
26934
26939
|
component: "div",
|
|
26935
26940
|
count: totalNumberOfRowsInTable,
|
|
26936
|
-
page:
|
|
26937
|
-
onPageChange: (event,
|
|
26938
|
-
|
|
26939
|
-
|
|
26940
|
-
|
|
26941
|
-
|
|
26942
|
-
|
|
26943
|
-
page: paginationModel.page,
|
|
26944
|
-
pageSize: parseInt(event.target.value, 10)
|
|
26945
|
-
}),
|
|
26946
|
-
rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
|
|
26941
|
+
page: page,
|
|
26942
|
+
onPageChange: (event, newPage) => onPageChange(newPage),
|
|
26943
|
+
rowsPerPage: pageSize,
|
|
26944
|
+
onRowsPerPageChange: event => {
|
|
26945
|
+
onPageSizeChange(parseInt(event.target.value, 10));
|
|
26946
|
+
},
|
|
26947
|
+
rowsPerPageOptions: displayRowsPerPage ? rowsPerPageOptions : []
|
|
26947
26948
|
}, paginationProps)) : null);
|
|
26948
26949
|
};
|
|
26949
26950
|
|
|
@@ -26969,9 +26970,11 @@ const ControlledPagination = _ref3 => {
|
|
|
26969
26970
|
displayPagination = false,
|
|
26970
26971
|
selectionStatus,
|
|
26971
26972
|
apiRef,
|
|
26972
|
-
|
|
26973
|
-
|
|
26974
|
-
|
|
26973
|
+
page,
|
|
26974
|
+
onPageChange,
|
|
26975
|
+
pageSize,
|
|
26976
|
+
onPageSizeChange,
|
|
26977
|
+
rowsPerPageOptions,
|
|
26975
26978
|
isRowSelectable,
|
|
26976
26979
|
paginationProps
|
|
26977
26980
|
} = _ref3;
|
|
@@ -27001,25 +27004,17 @@ const ControlledPagination = _ref3 => {
|
|
|
27001
27004
|
}, `${selectionStatus.numberOfSelectedRows} row${selectionStatus.numberOfSelectedRows > 1 ? 's' : ''} selected`) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$1({
|
|
27002
27005
|
component: "div",
|
|
27003
27006
|
count: numberOfFilteredRowsInTable,
|
|
27004
|
-
page:
|
|
27005
|
-
onPageChange: (event,
|
|
27006
|
-
|
|
27007
|
-
page,
|
|
27008
|
-
pageSize: paginationModel.pageSize
|
|
27009
|
-
});
|
|
27010
|
-
},
|
|
27011
|
-
rowsPerPage: paginationModel.pageSize,
|
|
27007
|
+
page: page,
|
|
27008
|
+
onPageChange: (event, newPage) => onPageChange(newPage),
|
|
27009
|
+
rowsPerPage: pageSize,
|
|
27012
27010
|
onRowsPerPageChange: event => {
|
|
27013
|
-
|
|
27014
|
-
page: paginationModel.page,
|
|
27015
|
-
pageSize: parseInt(event.target.value, 10)
|
|
27016
|
-
});
|
|
27011
|
+
onPageSizeChange(parseInt(event.target.value, 10));
|
|
27017
27012
|
},
|
|
27018
|
-
rowsPerPageOptions: displayRowsPerPage ?
|
|
27013
|
+
rowsPerPageOptions: displayRowsPerPage ? rowsPerPageOptions : []
|
|
27019
27014
|
}, paginationProps)) : null);
|
|
27020
27015
|
};
|
|
27021
27016
|
|
|
27022
|
-
const _excluded$3 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "
|
|
27017
|
+
const _excluded$3 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "page", "onPageChange", "pageSize", "onPageSizeChange", "rowsPerPageOptions", "paginationProps", "paginationMode", "rowCount"];
|
|
27023
27018
|
const ToolbarWrapper = _ref => {
|
|
27024
27019
|
let {
|
|
27025
27020
|
hideToolbar,
|
|
@@ -27031,9 +27026,11 @@ const ToolbarWrapper = _ref => {
|
|
|
27031
27026
|
selectionStatus,
|
|
27032
27027
|
apiRef,
|
|
27033
27028
|
isRowSelectable,
|
|
27034
|
-
|
|
27035
|
-
|
|
27036
|
-
|
|
27029
|
+
page,
|
|
27030
|
+
onPageChange,
|
|
27031
|
+
pageSize,
|
|
27032
|
+
onPageSizeChange,
|
|
27033
|
+
rowsPerPageOptions,
|
|
27037
27034
|
paginationProps,
|
|
27038
27035
|
paginationMode = 'client',
|
|
27039
27036
|
rowCount
|
|
@@ -27047,9 +27044,11 @@ const ToolbarWrapper = _ref => {
|
|
|
27047
27044
|
displayRowsPerPage: false,
|
|
27048
27045
|
displayPagination: ['top', 'both'].includes(paginationPlacement),
|
|
27049
27046
|
selectionStatus: selectionStatus.current,
|
|
27050
|
-
|
|
27051
|
-
|
|
27052
|
-
|
|
27047
|
+
page: page,
|
|
27048
|
+
onPageChange: onPageChange,
|
|
27049
|
+
pageSize: pageSize,
|
|
27050
|
+
onPageSizeChange: onPageSizeChange,
|
|
27051
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
27053
27052
|
paginationProps: paginationProps,
|
|
27054
27053
|
rowCount: rowCount
|
|
27055
27054
|
}) : /*#__PURE__*/React__default.createElement(ControlledPagination, {
|
|
@@ -27059,26 +27058,30 @@ const ToolbarWrapper = _ref => {
|
|
|
27059
27058
|
selectionStatus: selectionStatus.current,
|
|
27060
27059
|
apiRef: apiRef,
|
|
27061
27060
|
isRowSelectable: isRowSelectable,
|
|
27062
|
-
|
|
27063
|
-
|
|
27064
|
-
|
|
27061
|
+
page: page,
|
|
27062
|
+
onPageChange: onPageChange,
|
|
27063
|
+
pageSize: pageSize,
|
|
27064
|
+
onPageSizeChange: onPageSizeChange,
|
|
27065
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
27065
27066
|
paginationProps: paginationProps
|
|
27066
27067
|
}) : null);
|
|
27067
27068
|
};
|
|
27068
27069
|
|
|
27069
27070
|
const useControlledDatagridState = _ref => {
|
|
27070
|
-
var
|
|
27071
|
+
var _initialState$paginat, _initialState$paginat2;
|
|
27071
27072
|
let {
|
|
27072
27073
|
initialState,
|
|
27073
|
-
|
|
27074
|
+
rowsPerPageOptions,
|
|
27074
27075
|
propsColumnVisibilityModel,
|
|
27075
27076
|
propsFilterModel,
|
|
27076
27077
|
propsOnColumnVisibilityModelChange,
|
|
27077
27078
|
propsOnFilterModelChange,
|
|
27078
|
-
|
|
27079
|
+
propsOnPageChange,
|
|
27080
|
+
propsOnPageSizeChange,
|
|
27079
27081
|
propsOnPinnedColumnsChange,
|
|
27080
27082
|
propsOnSortModelChange,
|
|
27081
|
-
|
|
27083
|
+
propsPage,
|
|
27084
|
+
propsPageSize,
|
|
27082
27085
|
propsPinnedColumns,
|
|
27083
27086
|
propsSortModel
|
|
27084
27087
|
} = _ref;
|
|
@@ -27126,22 +27129,33 @@ const useControlledDatagridState = _ref => {
|
|
|
27126
27129
|
setSortModel(model);
|
|
27127
27130
|
}
|
|
27128
27131
|
};
|
|
27129
|
-
const [
|
|
27130
|
-
|
|
27131
|
-
|
|
27132
|
-
|
|
27133
|
-
|
|
27134
|
-
|
|
27135
|
-
|
|
27132
|
+
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);
|
|
27133
|
+
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);
|
|
27134
|
+
const onPageChange = page => {
|
|
27135
|
+
if (propsOnPageChange) {
|
|
27136
|
+
propsOnPageChange(page, undefined);
|
|
27137
|
+
} else {
|
|
27138
|
+
setPage(page);
|
|
27139
|
+
}
|
|
27140
|
+
};
|
|
27141
|
+
useEffect(() => {
|
|
27142
|
+
if (propsPage || propsPage === 0) {
|
|
27143
|
+
setPage(propsPage);
|
|
27144
|
+
}
|
|
27145
|
+
}, [propsPage]);
|
|
27146
|
+
const onPageSizeChange = pageSize => {
|
|
27147
|
+
onPageChange(0);
|
|
27148
|
+
if (propsOnPageSizeChange) {
|
|
27149
|
+
propsOnPageSizeChange(pageSize, undefined);
|
|
27136
27150
|
} else {
|
|
27137
|
-
|
|
27151
|
+
setPageSize(pageSize);
|
|
27138
27152
|
}
|
|
27139
27153
|
};
|
|
27140
27154
|
useEffect(() => {
|
|
27141
|
-
if (
|
|
27142
|
-
|
|
27155
|
+
if (propsPageSize) {
|
|
27156
|
+
setPageSize(propsPageSize);
|
|
27143
27157
|
}
|
|
27144
|
-
}, [
|
|
27158
|
+
}, [propsPageSize]);
|
|
27145
27159
|
return {
|
|
27146
27160
|
filterModel,
|
|
27147
27161
|
onFilterModelChange,
|
|
@@ -27151,12 +27165,14 @@ const useControlledDatagridState = _ref => {
|
|
|
27151
27165
|
onPinnedColumnsChange,
|
|
27152
27166
|
sortModel,
|
|
27153
27167
|
onSortModelChange,
|
|
27154
|
-
|
|
27155
|
-
|
|
27168
|
+
page,
|
|
27169
|
+
pageSize,
|
|
27170
|
+
onPageChange,
|
|
27171
|
+
onPageSizeChange
|
|
27156
27172
|
};
|
|
27157
27173
|
};
|
|
27158
27174
|
|
|
27159
|
-
const _excluded$2 = ["apiRef", "autoHeight", "className", "
|
|
27175
|
+
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"];
|
|
27160
27176
|
const COMPONENT_NAME$2 = 'DataGrid';
|
|
27161
27177
|
const CLASSNAME$2 = 'redsift-datagrid';
|
|
27162
27178
|
const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
@@ -27165,30 +27181,33 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27165
27181
|
apiRef: propsApiRef,
|
|
27166
27182
|
autoHeight,
|
|
27167
27183
|
className,
|
|
27168
|
-
|
|
27169
|
-
|
|
27184
|
+
columnTypes: propsColumnTypes,
|
|
27185
|
+
components,
|
|
27186
|
+
componentsProps,
|
|
27170
27187
|
filterModel: propsFilterModel,
|
|
27171
27188
|
columnVisibilityModel: propsColumnVisibilityModel,
|
|
27172
27189
|
pinnedColumns: propsPinnedColumns,
|
|
27173
27190
|
sortModel: propsSortModel,
|
|
27174
|
-
paginationModel: propsPaginationModel,
|
|
27175
27191
|
height: propsHeight,
|
|
27176
27192
|
hideToolbar,
|
|
27177
27193
|
initialState,
|
|
27178
27194
|
isRowSelectable,
|
|
27179
27195
|
license = process.env.MUI_LICENSE_KEY,
|
|
27180
27196
|
onFilterModelChange: propsOnFilterModelChange,
|
|
27181
|
-
|
|
27182
|
-
|
|
27183
|
-
onRowSelectionModelChange: propsOnRowSelectionModelChange,
|
|
27197
|
+
onPageChange: propsOnPageChange,
|
|
27198
|
+
onPageSizeChange: propsOnPageSizeChange,
|
|
27184
27199
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
27185
27200
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
27186
27201
|
onSortModelChange: propsOnSortModelChange,
|
|
27202
|
+
selectionModel: propsSelectionModel,
|
|
27203
|
+
onSelectionModelChange: propsOnSelectionModelChange,
|
|
27204
|
+
page: propsPage,
|
|
27205
|
+
pageSize: propsPageSize,
|
|
27187
27206
|
pagination,
|
|
27188
27207
|
paginationPlacement = 'both',
|
|
27189
27208
|
paginationProps,
|
|
27190
27209
|
rows,
|
|
27191
|
-
|
|
27210
|
+
rowsPerPageOptions,
|
|
27192
27211
|
sx,
|
|
27193
27212
|
theme: propsTheme,
|
|
27194
27213
|
paginationMode = 'client',
|
|
@@ -27198,7 +27217,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27198
27217
|
const theme = useTheme$4(propsTheme);
|
|
27199
27218
|
const _apiRef = useGridApiRef();
|
|
27200
27219
|
const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
|
|
27201
|
-
const RenderedToolbar =
|
|
27220
|
+
const RenderedToolbar = components !== null && components !== void 0 && components.Toolbar ? components.Toolbar : Toolbar$2;
|
|
27202
27221
|
LicenseInfo.setLicenseKey(license);
|
|
27203
27222
|
const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
|
|
27204
27223
|
const {
|
|
@@ -27206,52 +27225,56 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27206
27225
|
filterModel,
|
|
27207
27226
|
onColumnVisibilityModelChange,
|
|
27208
27227
|
onFilterModelChange,
|
|
27209
|
-
|
|
27228
|
+
onPageChange,
|
|
27229
|
+
onPageSizeChange,
|
|
27210
27230
|
onPinnedColumnsChange,
|
|
27211
27231
|
onSortModelChange,
|
|
27212
|
-
|
|
27232
|
+
page,
|
|
27233
|
+
pageSize,
|
|
27213
27234
|
pinnedColumns,
|
|
27214
27235
|
sortModel
|
|
27215
27236
|
} = useControlledDatagridState({
|
|
27216
27237
|
initialState,
|
|
27217
|
-
|
|
27238
|
+
rowsPerPageOptions,
|
|
27218
27239
|
propsColumnVisibilityModel,
|
|
27219
27240
|
propsFilterModel,
|
|
27220
27241
|
propsOnColumnVisibilityModelChange,
|
|
27221
27242
|
propsOnFilterModelChange,
|
|
27222
27243
|
propsOnPinnedColumnsChange,
|
|
27223
27244
|
propsOnSortModelChange,
|
|
27224
|
-
|
|
27245
|
+
propsPage,
|
|
27246
|
+
propsPageSize,
|
|
27225
27247
|
propsPinnedColumns,
|
|
27226
27248
|
propsSortModel,
|
|
27227
|
-
|
|
27249
|
+
propsOnPageChange,
|
|
27250
|
+
propsOnPageSizeChange
|
|
27228
27251
|
});
|
|
27229
|
-
const [
|
|
27252
|
+
const [selectionModel, setSelectionModel] = useState(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
|
|
27230
27253
|
useEffect(() => {
|
|
27231
|
-
|
|
27232
|
-
}, [
|
|
27233
|
-
const
|
|
27234
|
-
if (
|
|
27235
|
-
|
|
27254
|
+
setSelectionModel(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
|
|
27255
|
+
}, [propsSelectionModel]);
|
|
27256
|
+
const onSelectionModelChange = (selectionModel, details) => {
|
|
27257
|
+
if (propsOnSelectionModelChange) {
|
|
27258
|
+
propsOnSelectionModelChange(selectionModel, details);
|
|
27236
27259
|
} else {
|
|
27237
|
-
|
|
27260
|
+
setSelectionModel(selectionModel);
|
|
27238
27261
|
}
|
|
27239
27262
|
};
|
|
27240
27263
|
const selectionStatus = useRef({
|
|
27241
27264
|
type: 'none',
|
|
27242
27265
|
numberOfSelectedRows: 0,
|
|
27243
27266
|
numberOfSelectedRowsInPage: 0,
|
|
27244
|
-
page
|
|
27245
|
-
pageSize
|
|
27267
|
+
page,
|
|
27268
|
+
pageSize
|
|
27246
27269
|
});
|
|
27247
27270
|
|
|
27248
27271
|
// in server-side pagination we want to update the selection status
|
|
27249
27272
|
// every time we navigate between pages, resize our page or select something
|
|
27250
27273
|
useEffect(() => {
|
|
27251
27274
|
if (paginationMode == 'server') {
|
|
27252
|
-
onServerSideSelectionStatusChange(Array.isArray(
|
|
27275
|
+
onServerSideSelectionStatusChange(Array.isArray(selectionModel) ? selectionModel : [selectionModel], apiRef, selectionStatus, isRowSelectable, page, pageSize);
|
|
27253
27276
|
}
|
|
27254
|
-
}, [
|
|
27277
|
+
}, [selectionModel, page, pageSize]);
|
|
27255
27278
|
if (!Array.isArray(rows)) {
|
|
27256
27279
|
return null;
|
|
27257
27280
|
}
|
|
@@ -27282,54 +27305,57 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27282
27305
|
apiRef: apiRef,
|
|
27283
27306
|
autoHeight: autoHeight,
|
|
27284
27307
|
checkboxSelectionVisibleOnly: Boolean(pagination),
|
|
27285
|
-
|
|
27286
|
-
|
|
27287
|
-
|
|
27288
|
-
|
|
27289
|
-
|
|
27290
|
-
|
|
27308
|
+
columnTypes: _objectSpread2(_objectSpread2({}, customColumnTypes), propsColumnTypes),
|
|
27309
|
+
components: _objectSpread2(_objectSpread2({
|
|
27310
|
+
BaseButton,
|
|
27311
|
+
BaseCheckbox,
|
|
27312
|
+
// BaseTextField,
|
|
27313
|
+
BasePopper,
|
|
27314
|
+
ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27291
27315
|
displayName: "ColumnFilteredIcon"
|
|
27292
27316
|
})),
|
|
27293
|
-
|
|
27317
|
+
ColumnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27294
27318
|
displayName: "ColumnSelectorIcon"
|
|
27295
27319
|
})),
|
|
27296
|
-
|
|
27320
|
+
ColumnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27297
27321
|
displayName: "ColumnSortedAscendingIcon"
|
|
27298
27322
|
})),
|
|
27299
|
-
|
|
27323
|
+
ColumnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27300
27324
|
displayName: "ColumnSortedDescendingIcon"
|
|
27301
27325
|
})),
|
|
27302
|
-
|
|
27326
|
+
DensityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27303
27327
|
displayName: "DensityCompactIcon"
|
|
27304
27328
|
})),
|
|
27305
|
-
|
|
27329
|
+
DensityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27306
27330
|
displayName: "DensityStandardIcon"
|
|
27307
27331
|
})),
|
|
27308
|
-
|
|
27332
|
+
DensityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27309
27333
|
displayName: "DensityComfortableIcon"
|
|
27310
27334
|
})),
|
|
27311
|
-
|
|
27335
|
+
DetailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27312
27336
|
displayName: "DetailPanelCollapseIcon"
|
|
27313
27337
|
})),
|
|
27314
|
-
|
|
27338
|
+
DetailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27315
27339
|
displayName: "DetailPanelExpandIcon"
|
|
27316
27340
|
})),
|
|
27317
|
-
|
|
27341
|
+
ExportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27318
27342
|
displayName: "ExportIcon"
|
|
27319
27343
|
})),
|
|
27320
|
-
|
|
27344
|
+
OpenFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
|
|
27321
27345
|
displayName: "OpenFilterButtonIcon"
|
|
27322
27346
|
}, props))
|
|
27323
|
-
},
|
|
27324
|
-
|
|
27325
|
-
|
|
27347
|
+
}, components), {}, {
|
|
27348
|
+
Toolbar: ToolbarWrapper,
|
|
27349
|
+
Pagination: props => pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$1({}, props, {
|
|
27326
27350
|
displaySelection: false,
|
|
27327
27351
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
27328
27352
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
27329
27353
|
selectionStatus: selectionStatus.current,
|
|
27330
|
-
|
|
27331
|
-
|
|
27332
|
-
|
|
27354
|
+
page: page,
|
|
27355
|
+
onPageChange: onPageChange,
|
|
27356
|
+
pageSize: pageSize,
|
|
27357
|
+
onPageSizeChange: onPageSizeChange,
|
|
27358
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
27333
27359
|
paginationProps: paginationProps,
|
|
27334
27360
|
paginationMode: paginationMode,
|
|
27335
27361
|
rowCount: rowCount
|
|
@@ -27340,14 +27366,16 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27340
27366
|
selectionStatus: selectionStatus.current,
|
|
27341
27367
|
apiRef: apiRef,
|
|
27342
27368
|
isRowSelectable: isRowSelectable,
|
|
27343
|
-
|
|
27344
|
-
|
|
27345
|
-
|
|
27369
|
+
page: page,
|
|
27370
|
+
onPageChange: onPageChange,
|
|
27371
|
+
pageSize: pageSize,
|
|
27372
|
+
onPageSizeChange: onPageSizeChange,
|
|
27373
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
27346
27374
|
paginationProps: paginationProps,
|
|
27347
27375
|
paginationMode: paginationMode
|
|
27348
27376
|
})) : null
|
|
27349
27377
|
}),
|
|
27350
|
-
|
|
27378
|
+
componentsProps: _objectSpread2(_objectSpread2({}, componentsProps), {}, {
|
|
27351
27379
|
toolbar: _objectSpread2({
|
|
27352
27380
|
hideToolbar,
|
|
27353
27381
|
RenderedToolbar,
|
|
@@ -27358,13 +27386,15 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27358
27386
|
selectionStatus,
|
|
27359
27387
|
apiRef,
|
|
27360
27388
|
isRowSelectable,
|
|
27361
|
-
|
|
27362
|
-
|
|
27363
|
-
|
|
27389
|
+
page,
|
|
27390
|
+
onPageChange,
|
|
27391
|
+
pageSize,
|
|
27392
|
+
onPageSizeChange,
|
|
27393
|
+
rowsPerPageOptions,
|
|
27364
27394
|
paginationProps,
|
|
27365
27395
|
paginationMode,
|
|
27366
27396
|
rowCount
|
|
27367
|
-
},
|
|
27397
|
+
}, componentsProps === null || componentsProps === void 0 ? void 0 : componentsProps.toolbar)
|
|
27368
27398
|
}),
|
|
27369
27399
|
filterModel: filterModel,
|
|
27370
27400
|
columnVisibilityModel: columnVisibilityModel,
|
|
@@ -27380,11 +27410,13 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27380
27410
|
paginationMode: paginationMode,
|
|
27381
27411
|
keepNonExistentRowsSelected: paginationMode == 'server',
|
|
27382
27412
|
rows: rows,
|
|
27383
|
-
|
|
27384
|
-
|
|
27385
|
-
|
|
27386
|
-
|
|
27387
|
-
|
|
27413
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
27414
|
+
page: page,
|
|
27415
|
+
onPageChange: onPageChange,
|
|
27416
|
+
pageSize: pageSize,
|
|
27417
|
+
onPageSizeChange: onPageSizeChange,
|
|
27418
|
+
selectionModel: selectionModel,
|
|
27419
|
+
onSelectionModelChange: (newSelectionModel, details) => {
|
|
27388
27420
|
if (pagination && paginationMode != 'server') {
|
|
27389
27421
|
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
|
|
27390
27422
|
let {
|
|
@@ -27442,7 +27474,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27442
27474
|
};
|
|
27443
27475
|
}
|
|
27444
27476
|
}
|
|
27445
|
-
|
|
27477
|
+
onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(newSelectionModel, details);
|
|
27446
27478
|
},
|
|
27447
27479
|
sx: _objectSpread2(_objectSpread2({}, sx), {}, {
|
|
27448
27480
|
'.MuiDataGrid-columnHeaders': {
|
|
@@ -27459,6 +27491,8 @@ DataGrid.className = CLASSNAME$2;
|
|
|
27459
27491
|
DataGrid.displayName = COMPONENT_NAME$2;
|
|
27460
27492
|
|
|
27461
27493
|
// Get and Set data from LocalStorage WITHOUT useState
|
|
27494
|
+
|
|
27495
|
+
// triggering a state update and consecutive re-render
|
|
27462
27496
|
const useFetchState = (defaultValue, key) => {
|
|
27463
27497
|
let stickyValue = null;
|
|
27464
27498
|
try {
|
|
@@ -27466,7 +27500,16 @@ const useFetchState = (defaultValue, key) => {
|
|
|
27466
27500
|
} catch (e) {
|
|
27467
27501
|
console.error('StatefulDataGrid: error getting item from local storage: ', e);
|
|
27468
27502
|
}
|
|
27469
|
-
|
|
27503
|
+
let parsedValue = stickyValue !== null && stickyValue !== undefined && stickyValue !== 'undefined' ? JSON.parse(stickyValue) : defaultValue;
|
|
27504
|
+
|
|
27505
|
+
// TODO: temporary workaround to avoid clashes when someone had sorting on the now-removed screenshot field (renamed to num_annotations)
|
|
27506
|
+
// 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
|
|
27507
|
+
if (parsedValue instanceof Array) {
|
|
27508
|
+
const fields = (parsedValue || []).map(item => item.field);
|
|
27509
|
+
if (fields.includes('screenshot') || fields.includes('diffs')) {
|
|
27510
|
+
parsedValue = defaultValue;
|
|
27511
|
+
}
|
|
27512
|
+
}
|
|
27470
27513
|
const updateValue = useCallback(value => {
|
|
27471
27514
|
try {
|
|
27472
27515
|
window.localStorage.setItem(key, JSON.stringify(value));
|
|
@@ -27477,15 +27520,13 @@ const useFetchState = (defaultValue, key) => {
|
|
|
27477
27520
|
return [parsedValue, updateValue];
|
|
27478
27521
|
};
|
|
27479
27522
|
|
|
27480
|
-
|
|
27481
|
-
|
|
27482
|
-
const useTableStates = (id, version, customDefaults) => {
|
|
27523
|
+
const useTableStates = (id, version) => {
|
|
27483
27524
|
const [paginationModel, setPaginationModel] = useFetchState('', buildStorageKey({
|
|
27484
27525
|
id,
|
|
27485
27526
|
version,
|
|
27486
27527
|
category: PAGINATION_MODEL_KEY
|
|
27487
27528
|
}));
|
|
27488
|
-
const [sortModel, setSortModel] = useFetchState(
|
|
27529
|
+
const [sortModel, setSortModel] = useFetchState('', buildStorageKey({
|
|
27489
27530
|
id,
|
|
27490
27531
|
version,
|
|
27491
27532
|
category: SORT_MODEL_KEY
|
|
@@ -27500,7 +27541,7 @@ const useTableStates = (id, version, customDefaults) => {
|
|
|
27500
27541
|
version,
|
|
27501
27542
|
category: VISIBILITY_MODEL_KEY
|
|
27502
27543
|
}));
|
|
27503
|
-
const [pinnedColumns, setPinnedColumns] = useFetchState(
|
|
27544
|
+
const [pinnedColumns, setPinnedColumns] = useFetchState('_pinnedColumnsLeft=[]&_pinnedColumnsRight=[]', buildStorageKey({
|
|
27504
27545
|
id,
|
|
27505
27546
|
version,
|
|
27506
27547
|
category: PINNED_COLUMNS
|
|
@@ -27535,13 +27576,10 @@ const useStatefulTable = props => {
|
|
|
27535
27576
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
27536
27577
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
27537
27578
|
onFilterModelChange: propsOnFilterModelChange,
|
|
27538
|
-
|
|
27579
|
+
onPageChange: propsOnPageChange,
|
|
27580
|
+
onPageSizeChange: propsOnPageSizeChange,
|
|
27539
27581
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
27540
27582
|
onSortModelChange: propsOnSortModelChange,
|
|
27541
|
-
pinnedCustomColumns = {
|
|
27542
|
-
left: [],
|
|
27543
|
-
right: []
|
|
27544
|
-
},
|
|
27545
27583
|
useRouter,
|
|
27546
27584
|
localStorageVersion = 2
|
|
27547
27585
|
} = props;
|
|
@@ -27551,11 +27589,6 @@ const useStatefulTable = props => {
|
|
|
27551
27589
|
historyReplace
|
|
27552
27590
|
} = useRouter();
|
|
27553
27591
|
const id = pathname;
|
|
27554
|
-
const customDefaults = useMemo(() => {
|
|
27555
|
-
return {
|
|
27556
|
-
pinnedColumns: `_pinnedColumnsLeft=[${[GRID_CHECKBOX_SELECTION_COL_DEF.field, ...pinnedCustomColumns.left].join(',')}]&_pinnedColumnsRight=[${pinnedCustomColumns.right.join(',')}]`
|
|
27557
|
-
};
|
|
27558
|
-
}, [pinnedCustomColumns]);
|
|
27559
27592
|
|
|
27560
27593
|
// States and setters persisted in the local storage for this table
|
|
27561
27594
|
const {
|
|
@@ -27571,7 +27604,7 @@ const useStatefulTable = props => {
|
|
|
27571
27604
|
setPinnedColumns,
|
|
27572
27605
|
dimensionModel,
|
|
27573
27606
|
setDimensionModel
|
|
27574
|
-
} = useTableStates(id, localStorageVersion
|
|
27607
|
+
} = useTableStates(id, localStorageVersion);
|
|
27575
27608
|
|
|
27576
27609
|
// clearing up old version keys, triggering only on first render
|
|
27577
27610
|
useEffect(() => clearPreviousVersionStorage(id, localStorageVersion), [id, localStorageVersion]);
|
|
@@ -27606,6 +27639,7 @@ const useStatefulTable = props => {
|
|
|
27606
27639
|
column.width = dimensionModel[column.field] || column.width || 100;
|
|
27607
27640
|
return column;
|
|
27608
27641
|
}), [propsColumns, dimensionModel]);
|
|
27642
|
+
|
|
27609
27643
|
/** Add resetPage method to apiRef. */
|
|
27610
27644
|
apiRef.current.resetPage = () => {
|
|
27611
27645
|
apiRef.current.setPage(0);
|
|
@@ -27616,7 +27650,7 @@ const useStatefulTable = props => {
|
|
|
27616
27650
|
onFilterModelChange: (model, details) => {
|
|
27617
27651
|
const filterModel = _objectSpread2(_objectSpread2({}, model), {}, {
|
|
27618
27652
|
items: model.items.map(item => {
|
|
27619
|
-
const column = apiRef.current.getColumn(item.
|
|
27653
|
+
const column = apiRef.current.getColumn(item.columnField);
|
|
27620
27654
|
item.type = column.type || 'string';
|
|
27621
27655
|
return item;
|
|
27622
27656
|
})
|
|
@@ -27653,16 +27687,33 @@ const useStatefulTable = props => {
|
|
|
27653
27687
|
}, search, historyReplace, columns);
|
|
27654
27688
|
},
|
|
27655
27689
|
pinnedColumns: pinnedColumnsModel,
|
|
27656
|
-
|
|
27657
|
-
|
|
27658
|
-
|
|
27659
|
-
|
|
27660
|
-
|
|
27661
|
-
propsOnPaginationModelChange === null || propsOnPaginationModelChange === void 0 ? void 0 : propsOnPaginationModelChange(paginationModel, details);
|
|
27690
|
+
page: paginationModelParsed.page,
|
|
27691
|
+
pageSize: paginationModelParsed.pageSize,
|
|
27692
|
+
onPageChange: (page, details) => {
|
|
27693
|
+
const direction = paginationModelParsed.page < page ? 'next' : 'back';
|
|
27694
|
+
propsOnPageChange === null || propsOnPageChange === void 0 ? void 0 : propsOnPageChange(page, details);
|
|
27662
27695
|
updateUrl({
|
|
27663
27696
|
filterModel: filterParsed,
|
|
27664
27697
|
sortModel: sortModelParsed,
|
|
27665
|
-
paginationModel:
|
|
27698
|
+
paginationModel: {
|
|
27699
|
+
page,
|
|
27700
|
+
pageSize: paginationModelParsed.pageSize,
|
|
27701
|
+
direction
|
|
27702
|
+
},
|
|
27703
|
+
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
27704
|
+
pinnedColumnsModel: pinnedColumnsModel
|
|
27705
|
+
}, search, historyReplace, columns);
|
|
27706
|
+
},
|
|
27707
|
+
onPageSizeChange: (pageSize, details) => {
|
|
27708
|
+
propsOnPageSizeChange === null || propsOnPageSizeChange === void 0 ? void 0 : propsOnPageSizeChange(pageSize, details);
|
|
27709
|
+
updateUrl({
|
|
27710
|
+
filterModel: filterParsed,
|
|
27711
|
+
sortModel: sortModelParsed,
|
|
27712
|
+
paginationModel: {
|
|
27713
|
+
page: paginationModelParsed.page,
|
|
27714
|
+
pageSize,
|
|
27715
|
+
direction: paginationModelParsed.direction
|
|
27716
|
+
},
|
|
27666
27717
|
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
27667
27718
|
pinnedColumnsModel: pinnedColumnsModel
|
|
27668
27719
|
}, search, historyReplace, columns);
|
|
@@ -27688,7 +27739,7 @@ const useStatefulTable = props => {
|
|
|
27688
27739
|
};
|
|
27689
27740
|
};
|
|
27690
27741
|
|
|
27691
|
-
const _excluded$1 = ["apiRef", "autoHeight", "className", "columns", "
|
|
27742
|
+
const _excluded$1 = ["apiRef", "autoHeight", "className", "columns", "columnTypes", "components", "componentsProps", "filterModel", "columnVisibilityModel", "pinnedColumns", "sortModel", "page", "pageSize", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "localStorageVersion", "onFilterModelChange", "selectionModel", "onColumnWidthChange", "onPageChange", "onPageSizeChange", "onSelectionModelChange", "onColumnVisibilityModelChange", "onPinnedColumnsChange", "onSortModelChange", "pagination", "paginationPlacement", "paginationProps", "rows", "rowsPerPageOptions", "sx", "theme", "useRouter", "paginationMode", "rowCount"];
|
|
27692
27743
|
const COMPONENT_NAME$1 = 'DataGrid';
|
|
27693
27744
|
const CLASSNAME$1 = 'redsift-datagrid';
|
|
27694
27745
|
const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
@@ -27698,13 +27749,15 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27698
27749
|
autoHeight,
|
|
27699
27750
|
className,
|
|
27700
27751
|
columns,
|
|
27701
|
-
|
|
27702
|
-
|
|
27752
|
+
columnTypes: propsColumnTypes,
|
|
27753
|
+
components,
|
|
27754
|
+
componentsProps,
|
|
27703
27755
|
filterModel: propsFilterModel,
|
|
27704
27756
|
columnVisibilityModel: propsColumnVisibilityModel,
|
|
27705
27757
|
pinnedColumns: propsPinnedColumns,
|
|
27706
27758
|
sortModel: propsSortModel,
|
|
27707
|
-
|
|
27759
|
+
page: propsPage,
|
|
27760
|
+
pageSize: propsPageSize,
|
|
27708
27761
|
height: propsHeight,
|
|
27709
27762
|
hideToolbar,
|
|
27710
27763
|
initialState,
|
|
@@ -27712,19 +27765,19 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27712
27765
|
license = process.env.MUI_LICENSE_KEY,
|
|
27713
27766
|
localStorageVersion,
|
|
27714
27767
|
onFilterModelChange: propsOnFilterModelChange,
|
|
27715
|
-
|
|
27768
|
+
selectionModel: propsSelectionModel,
|
|
27716
27769
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
27717
|
-
|
|
27718
|
-
|
|
27770
|
+
onPageChange: propsOnPageChange,
|
|
27771
|
+
onPageSizeChange: propsOnPageSizeChange,
|
|
27772
|
+
onSelectionModelChange: propsOnSelectionModelChange,
|
|
27719
27773
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
27720
27774
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
27721
27775
|
onSortModelChange: propsOnSortModelChange,
|
|
27722
27776
|
pagination,
|
|
27723
27777
|
paginationPlacement = 'both',
|
|
27724
27778
|
paginationProps,
|
|
27725
|
-
pinnedCustomColumns,
|
|
27726
27779
|
rows,
|
|
27727
|
-
|
|
27780
|
+
rowsPerPageOptions,
|
|
27728
27781
|
sx,
|
|
27729
27782
|
theme: propsTheme,
|
|
27730
27783
|
useRouter,
|
|
@@ -27735,38 +27788,43 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27735
27788
|
const theme = useTheme$4(propsTheme);
|
|
27736
27789
|
const _apiRef = useGridApiRef();
|
|
27737
27790
|
const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
|
|
27738
|
-
const RenderedToolbar =
|
|
27791
|
+
const RenderedToolbar = components !== null && components !== void 0 && components.Toolbar ? components.Toolbar : Toolbar$2;
|
|
27739
27792
|
LicenseInfo.setLicenseKey(license);
|
|
27740
27793
|
const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
|
|
27741
27794
|
const {
|
|
27742
27795
|
onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
|
|
27743
27796
|
onFilterModelChange: controlledOnFilterModelChange,
|
|
27744
|
-
|
|
27797
|
+
onPageChange: controlledOnPageChange,
|
|
27798
|
+
onPageSizeChange: controlledOnPageSizeChange,
|
|
27745
27799
|
onPinnedColumnsChange: controlledOnPinnedColumnsChange,
|
|
27746
27800
|
onSortModelChange: controlledOnSortModelChange
|
|
27747
27801
|
} = useControlledDatagridState({
|
|
27748
27802
|
initialState,
|
|
27749
|
-
|
|
27803
|
+
rowsPerPageOptions,
|
|
27750
27804
|
propsColumnVisibilityModel,
|
|
27751
27805
|
propsFilterModel,
|
|
27752
27806
|
propsOnColumnVisibilityModelChange,
|
|
27753
27807
|
propsOnFilterModelChange,
|
|
27754
27808
|
propsOnPinnedColumnsChange,
|
|
27755
27809
|
propsOnSortModelChange,
|
|
27756
|
-
|
|
27810
|
+
propsPage,
|
|
27811
|
+
propsPageSize,
|
|
27757
27812
|
propsPinnedColumns,
|
|
27758
27813
|
propsSortModel,
|
|
27759
|
-
|
|
27814
|
+
propsOnPageChange,
|
|
27815
|
+
propsOnPageSizeChange
|
|
27760
27816
|
});
|
|
27761
27817
|
const {
|
|
27762
27818
|
columnVisibilityModel,
|
|
27763
27819
|
filterModel,
|
|
27764
27820
|
onColumnVisibilityModelChange,
|
|
27765
27821
|
onFilterModelChange,
|
|
27766
|
-
|
|
27822
|
+
onPageChange,
|
|
27823
|
+
onPageSizeChange,
|
|
27767
27824
|
onPinnedColumnsChange,
|
|
27768
27825
|
onSortModelChange,
|
|
27769
|
-
|
|
27826
|
+
page,
|
|
27827
|
+
pageSize,
|
|
27770
27828
|
pinnedColumns,
|
|
27771
27829
|
sortModel,
|
|
27772
27830
|
onColumnWidthChange
|
|
@@ -27777,39 +27835,39 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27777
27835
|
onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
|
|
27778
27836
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
27779
27837
|
onFilterModelChange: controlledOnFilterModelChange,
|
|
27780
|
-
|
|
27838
|
+
onPageChange: controlledOnPageChange,
|
|
27839
|
+
onPageSizeChange: controlledOnPageSizeChange,
|
|
27781
27840
|
onPinnedColumnsChange: controlledOnPinnedColumnsChange,
|
|
27782
27841
|
onSortModelChange: controlledOnSortModelChange,
|
|
27783
|
-
pinnedCustomColumns,
|
|
27784
27842
|
useRouter: useRouter,
|
|
27785
27843
|
localStorageVersion
|
|
27786
27844
|
});
|
|
27787
|
-
const [
|
|
27845
|
+
const [selectionModel, setSelectionModel] = useState(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
|
|
27788
27846
|
useEffect(() => {
|
|
27789
|
-
|
|
27790
|
-
}, [
|
|
27791
|
-
const
|
|
27792
|
-
if (
|
|
27793
|
-
|
|
27847
|
+
setSelectionModel(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
|
|
27848
|
+
}, [propsSelectionModel]);
|
|
27849
|
+
const onSelectionModelChange = (selectionModel, details) => {
|
|
27850
|
+
if (propsOnSelectionModelChange) {
|
|
27851
|
+
propsOnSelectionModelChange(selectionModel, details);
|
|
27794
27852
|
} else {
|
|
27795
|
-
|
|
27853
|
+
setSelectionModel(selectionModel);
|
|
27796
27854
|
}
|
|
27797
27855
|
};
|
|
27798
27856
|
const selectionStatus = useRef({
|
|
27799
27857
|
type: 'none',
|
|
27800
27858
|
numberOfSelectedRows: 0,
|
|
27801
27859
|
numberOfSelectedRowsInPage: 0,
|
|
27802
|
-
page
|
|
27803
|
-
pageSize:
|
|
27860
|
+
page,
|
|
27861
|
+
pageSize: pageSize
|
|
27804
27862
|
});
|
|
27805
27863
|
|
|
27806
27864
|
// in server-side pagination we want to update the selection status
|
|
27807
27865
|
// every time we navigate between pages, resize our page or select something
|
|
27808
27866
|
useEffect(() => {
|
|
27809
27867
|
if (paginationMode == 'server') {
|
|
27810
|
-
onServerSideSelectionStatusChange(Array.isArray(
|
|
27868
|
+
onServerSideSelectionStatusChange(Array.isArray(selectionModel) ? selectionModel : [selectionModel], apiRef, selectionStatus, isRowSelectable, page, pageSize);
|
|
27811
27869
|
}
|
|
27812
|
-
}, [
|
|
27870
|
+
}, [selectionModel, page, pageSize]);
|
|
27813
27871
|
if (!Array.isArray(rows)) {
|
|
27814
27872
|
return null;
|
|
27815
27873
|
}
|
|
@@ -27842,13 +27900,15 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27842
27900
|
filterModel: filterModel,
|
|
27843
27901
|
onColumnVisibilityModelChange: onColumnVisibilityModelChange,
|
|
27844
27902
|
onFilterModelChange: onFilterModelChange,
|
|
27845
|
-
|
|
27903
|
+
onPageChange: onPageChange,
|
|
27904
|
+
onPageSizeChange: onPageSizeChange,
|
|
27846
27905
|
onPinnedColumnsChange: onPinnedColumnsChange,
|
|
27847
27906
|
onSortModelChange: onSortModelChange,
|
|
27848
|
-
|
|
27907
|
+
page: page,
|
|
27908
|
+
pageSize: pageSize,
|
|
27849
27909
|
pinnedColumns: pinnedColumns,
|
|
27850
27910
|
sortModel: sortModel,
|
|
27851
|
-
|
|
27911
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
27852
27912
|
onColumnWidthChange: onColumnWidthChange,
|
|
27853
27913
|
initialState: initialState,
|
|
27854
27914
|
isRowSelectable: isRowSelectable,
|
|
@@ -27859,55 +27919,58 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27859
27919
|
rowCount: rowCount,
|
|
27860
27920
|
autoHeight: autoHeight,
|
|
27861
27921
|
checkboxSelectionVisibleOnly: Boolean(pagination),
|
|
27862
|
-
|
|
27863
|
-
|
|
27864
|
-
|
|
27865
|
-
|
|
27866
|
-
|
|
27867
|
-
|
|
27922
|
+
columnTypes: _objectSpread2(_objectSpread2({}, customColumnTypes), propsColumnTypes),
|
|
27923
|
+
components: _objectSpread2(_objectSpread2({
|
|
27924
|
+
BaseButton,
|
|
27925
|
+
BaseCheckbox,
|
|
27926
|
+
// BaseTextField,
|
|
27927
|
+
BasePopper,
|
|
27928
|
+
ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27868
27929
|
displayName: "ColumnFilteredIcon"
|
|
27869
27930
|
})),
|
|
27870
|
-
|
|
27931
|
+
ColumnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27871
27932
|
displayName: "ColumnSelectorIcon"
|
|
27872
27933
|
})),
|
|
27873
|
-
|
|
27934
|
+
ColumnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27874
27935
|
displayName: "ColumnSortedAscendingIcon"
|
|
27875
27936
|
})),
|
|
27876
|
-
|
|
27937
|
+
ColumnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27877
27938
|
displayName: "ColumnSortedDescendingIcon"
|
|
27878
27939
|
})),
|
|
27879
|
-
|
|
27940
|
+
DensityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27880
27941
|
displayName: "DensityCompactIcon"
|
|
27881
27942
|
})),
|
|
27882
|
-
|
|
27943
|
+
DensityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27883
27944
|
displayName: "DensityStandardIcon"
|
|
27884
27945
|
})),
|
|
27885
|
-
|
|
27946
|
+
DensityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27886
27947
|
displayName: "DensityComfortableIcon"
|
|
27887
27948
|
})),
|
|
27888
|
-
|
|
27949
|
+
DetailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27889
27950
|
displayName: "DetailPanelCollapseIcon"
|
|
27890
27951
|
})),
|
|
27891
|
-
|
|
27952
|
+
DetailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27892
27953
|
displayName: "DetailPanelExpandIcon"
|
|
27893
27954
|
})),
|
|
27894
|
-
|
|
27955
|
+
ExportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27895
27956
|
displayName: "ExportIcon"
|
|
27896
27957
|
})),
|
|
27897
|
-
|
|
27958
|
+
OpenFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
|
|
27898
27959
|
displayName: "OpenFilterButtonIcon"
|
|
27899
27960
|
}, props))
|
|
27900
|
-
},
|
|
27901
|
-
|
|
27902
|
-
|
|
27961
|
+
}, components), {}, {
|
|
27962
|
+
Toolbar: ToolbarWrapper,
|
|
27963
|
+
Pagination: props => {
|
|
27903
27964
|
return pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$1({}, props, {
|
|
27904
27965
|
displaySelection: false,
|
|
27905
27966
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
27906
27967
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
27907
27968
|
selectionStatus: selectionStatus.current,
|
|
27908
|
-
|
|
27909
|
-
|
|
27910
|
-
|
|
27969
|
+
page: page,
|
|
27970
|
+
pageSize: pageSize,
|
|
27971
|
+
onPageChange: onPageChange,
|
|
27972
|
+
onPageSizeChange: onPageSizeChange,
|
|
27973
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
27911
27974
|
paginationProps: paginationProps,
|
|
27912
27975
|
paginationMode: paginationMode,
|
|
27913
27976
|
rowCount: rowCount
|
|
@@ -27918,15 +27981,17 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27918
27981
|
selectionStatus: selectionStatus.current,
|
|
27919
27982
|
apiRef: apiRef,
|
|
27920
27983
|
isRowSelectable: isRowSelectable,
|
|
27921
|
-
|
|
27922
|
-
|
|
27923
|
-
|
|
27984
|
+
page: page,
|
|
27985
|
+
pageSize: pageSize,
|
|
27986
|
+
onPageChange: onPageChange,
|
|
27987
|
+
onPageSizeChange: onPageSizeChange,
|
|
27988
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
27924
27989
|
paginationProps: paginationProps,
|
|
27925
27990
|
paginationMode: paginationMode
|
|
27926
27991
|
})) : null;
|
|
27927
27992
|
}
|
|
27928
27993
|
}),
|
|
27929
|
-
|
|
27994
|
+
componentsProps: _objectSpread2(_objectSpread2({}, componentsProps), {}, {
|
|
27930
27995
|
toolbar: _objectSpread2({
|
|
27931
27996
|
hideToolbar,
|
|
27932
27997
|
RenderedToolbar,
|
|
@@ -27937,16 +28002,18 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27937
28002
|
selectionStatus,
|
|
27938
28003
|
apiRef,
|
|
27939
28004
|
isRowSelectable,
|
|
27940
|
-
|
|
27941
|
-
|
|
27942
|
-
|
|
28005
|
+
page,
|
|
28006
|
+
pageSize,
|
|
28007
|
+
onPageChange,
|
|
28008
|
+
onPageSizeChange,
|
|
28009
|
+
rowsPerPageOptions,
|
|
27943
28010
|
paginationProps,
|
|
27944
28011
|
paginationMode,
|
|
27945
28012
|
rowCount
|
|
27946
|
-
},
|
|
28013
|
+
}, componentsProps === null || componentsProps === void 0 ? void 0 : componentsProps.toolbar)
|
|
27947
28014
|
}),
|
|
27948
|
-
|
|
27949
|
-
|
|
28015
|
+
selectionModel: selectionModel,
|
|
28016
|
+
onSelectionModelChange: (newSelectionModel, details) => {
|
|
27950
28017
|
if (pagination && paginationMode != 'server') {
|
|
27951
28018
|
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
|
|
27952
28019
|
let {
|
|
@@ -28004,7 +28071,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
28004
28071
|
};
|
|
28005
28072
|
}
|
|
28006
28073
|
}
|
|
28007
|
-
|
|
28074
|
+
onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(newSelectionModel, details);
|
|
28008
28075
|
},
|
|
28009
28076
|
sx: _objectSpread2(_objectSpread2({}, sx), {}, {
|
|
28010
28077
|
'.MuiDataGrid-columnHeaders': {
|
|
@@ -28078,5 +28145,5 @@ const TextCell = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
28078
28145
|
TextCell.className = CLASSNAME;
|
|
28079
28146
|
TextCell.displayName = COMPONENT_NAME;
|
|
28080
28147
|
|
|
28081
|
-
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,
|
|
28148
|
+
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 };
|
|
28082
28149
|
//# sourceMappingURL=index.js.map
|