@redsift/table 11.2.2-muiv5 → 11.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +25 -31
- package/index.js +259 -336
- package/index.js.map +1 -1
- package/package.json +4 -4
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GRID_DETAIL_PANEL_TOGGLE_COL_DEF, getGridNumericOperators as getGridNumericOperators$1, GridFilterInputValue, 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, GridLogicOperator, GridToolbarContainer, GridToolbarFilterButton, GridToolbarColumnsButton, GridToolbarDensitySelector, GridToolbarExport, gridExpandedSortedRowIdsSelector, gridPaginatedVisibleSortedGridRowEntriesSelector, gridPaginatedVisibleSortedGridRowIdsSelector, gridFilteredSortedRowEntriesSelector, gridFilteredSortedRowIdsSelector, useGridApiRef, DataGridPro } from '@mui/x-data-grid-pro';
|
|
2
2
|
export { getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators } from '@mui/x-data-grid-pro';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import React__default, { Children, isValidElement, cloneElement, forwardRef, useLayoutEffect, useEffect, useRef, useContext, useState, useCallback, createElement, useMemo } from 'react';
|
|
@@ -17639,7 +17639,7 @@ const isBetweenOperator = {
|
|
|
17639
17639
|
label: 'is between',
|
|
17640
17640
|
value: 'isBetween',
|
|
17641
17641
|
getApplyFilterFn: filterItem => {
|
|
17642
|
-
if (!filterItem.
|
|
17642
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
17643
17643
|
return null;
|
|
17644
17644
|
}
|
|
17645
17645
|
if (!Array.isArray(filterItem.value) || filterItem.value.length !== 2) {
|
|
@@ -17652,7 +17652,7 @@ const isBetweenOperator = {
|
|
|
17652
17652
|
return null;
|
|
17653
17653
|
}
|
|
17654
17654
|
return params => {
|
|
17655
|
-
return params.value !== null && filterItem.value[0] <= params.value && params.value <= filterItem.value[1];
|
|
17655
|
+
return params.value !== null && params.value !== undefined && filterItem.value[0] <= params.value && params.value <= filterItem.value[1];
|
|
17656
17656
|
};
|
|
17657
17657
|
},
|
|
17658
17658
|
InputComponent: InputNumberInterval
|
|
@@ -17665,7 +17665,7 @@ const doesNotEqual = {
|
|
|
17665
17665
|
label: 'does not equal',
|
|
17666
17666
|
value: 'doesNotEqual',
|
|
17667
17667
|
getApplyFilterFn: filterItem => {
|
|
17668
|
-
if (!filterItem.
|
|
17668
|
+
if (!filterItem.field || !filterItem.value || !filterItem.value) {
|
|
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.field || !filterItem.value || !filterItem.operator) {
|
|
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.field || !filterItem.value || !filterItem.operator) {
|
|
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.field || !filterItem.value || !filterItem.operator) {
|
|
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.field || !filterItem.value || !filterItem.operator) {
|
|
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.field || !filterItem.value || !filterItem.operator) {
|
|
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.field || !filterItem.value || !filterItem.operator) {
|
|
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.field || !filterItem.value || !filterItem.operator) {
|
|
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
|
+
type: 'string',
|
|
17881
17881
|
filterOperators: operatorList.rsString
|
|
17882
17882
|
};
|
|
17883
17883
|
};
|
|
17884
17884
|
const getRsNumberColumnType = () => {
|
|
17885
17885
|
return {
|
|
17886
|
-
|
|
17886
|
+
type: '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-1106';
|
|
17898
17898
|
try {
|
|
17899
17899
|
const messages = [{
|
|
17900
17900
|
role: 'system',
|
|
@@ -18063,42 +18063,39 @@ const numberOperatorDecoder = {
|
|
|
18063
18063
|
lt: '<',
|
|
18064
18064
|
lte: '<='
|
|
18065
18065
|
};
|
|
18066
|
-
const isOperatorValueValid = (
|
|
18067
|
-
const column = columns.find(column => column.field ===
|
|
18066
|
+
const isOperatorValueValid = (field, operator, columns) => {
|
|
18067
|
+
const column = columns.find(column => column.field === field);
|
|
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 = operatorList[columnType];
|
|
18072
|
+
const operators = column.filterOperators || operatorList[columnType];
|
|
18073
18073
|
if (!operators) {
|
|
18074
18074
|
return false;
|
|
18075
18075
|
}
|
|
18076
|
-
|
|
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);
|
|
18076
|
+
return !!operators.find(op => columnType === 'number' && Object.keys(numberOperatorEncoder).includes(op.value) ? numberOperatorEncoder[op.value] === operator : op.value === operator);
|
|
18080
18077
|
};
|
|
18081
18078
|
const listOperators = ['containsAnyOf', 'endsWithAnyOf', 'isAnyOf', 'isNotAnyOf', 'startsWithAnyOf'];
|
|
18082
18079
|
|
|
18083
18080
|
// Check if the value doesn't break
|
|
18084
|
-
const isValueValid = (value,
|
|
18081
|
+
const isValueValid = (value, field, columns, operator) => {
|
|
18085
18082
|
var _column$type;
|
|
18086
18083
|
// every field accepts undefined as value for default
|
|
18087
18084
|
if (value === undefined || value === '') {
|
|
18088
18085
|
return true;
|
|
18089
18086
|
}
|
|
18090
18087
|
|
|
18091
|
-
// xxxAnyOf accepts as value only lists, and we are
|
|
18088
|
+
// xxxAnyOf accepts as value only lists, and we are declaring them in the
|
|
18092
18089
|
// URL as `list=[...]`
|
|
18093
|
-
if (listOperators.includes(
|
|
18090
|
+
if (listOperators.includes(operator)) {
|
|
18094
18091
|
return Array.isArray(value) || value === '';
|
|
18095
18092
|
}
|
|
18096
18093
|
|
|
18097
18094
|
// We are accepting arrays only if they are of the 'xxxAnyOf' type
|
|
18098
|
-
if (Array.isArray(value) && !listOperators.includes(
|
|
18095
|
+
if (Array.isArray(value) && !listOperators.includes(operator)) {
|
|
18099
18096
|
return false;
|
|
18100
18097
|
}
|
|
18101
|
-
const column = columns.find(column => column.field ===
|
|
18098
|
+
const column = columns.find(column => column.field === field);
|
|
18102
18099
|
if (!column) {
|
|
18103
18100
|
return false;
|
|
18104
18101
|
}
|
|
@@ -18136,14 +18133,14 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
18136
18133
|
if (!searchString) {
|
|
18137
18134
|
return 'invalid';
|
|
18138
18135
|
}
|
|
18139
|
-
let
|
|
18136
|
+
let logicOperator = GridLogicOperator.And;
|
|
18140
18137
|
const searchParams = new URLSearchParams();
|
|
18141
18138
|
for (const [key, value] of new URLSearchParams(searchString)) {
|
|
18142
18139
|
if (key.startsWith('_') && !['_logicOperator', '_sortColumn', '_pinnedColumnsLeft', '_pinnedColumnsRight', '_columnVisibility', '_pagination'].includes(key)) {
|
|
18143
18140
|
searchParams.set(key, value);
|
|
18144
18141
|
}
|
|
18145
18142
|
if (key === '_logicOperator') {
|
|
18146
|
-
|
|
18143
|
+
logicOperator = value === GridLogicOperator.And || value === GridLogicOperator.Or ? value : GridLogicOperator.And;
|
|
18147
18144
|
}
|
|
18148
18145
|
}
|
|
18149
18146
|
let id = 5000;
|
|
@@ -18184,8 +18181,8 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
18184
18181
|
return;
|
|
18185
18182
|
}
|
|
18186
18183
|
items.push({
|
|
18187
|
-
|
|
18188
|
-
|
|
18184
|
+
field,
|
|
18185
|
+
operator: columnType === 'number' && Object.keys(numberOperatorDecoder).includes(operator) ? numberOperatorDecoder[operator] : operator,
|
|
18189
18186
|
id,
|
|
18190
18187
|
value: listOperators.includes(operator) && decodedValue === '' ? [] : decodedValue,
|
|
18191
18188
|
type
|
|
@@ -18200,23 +18197,23 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
18200
18197
|
}
|
|
18201
18198
|
return {
|
|
18202
18199
|
items,
|
|
18203
|
-
|
|
18200
|
+
logicOperator
|
|
18204
18201
|
};
|
|
18205
18202
|
};
|
|
18206
18203
|
const getSearchParamsFromFilterModel = filterModel => {
|
|
18207
18204
|
const searchParams = new URLSearchParams();
|
|
18208
|
-
searchParams.set('_logicOperator', filterModel['
|
|
18205
|
+
searchParams.set('_logicOperator', filterModel['logicOperator'] || '');
|
|
18209
18206
|
filterModel['items'].forEach(item => {
|
|
18210
18207
|
const {
|
|
18211
|
-
|
|
18212
|
-
|
|
18208
|
+
field,
|
|
18209
|
+
operator,
|
|
18213
18210
|
value,
|
|
18214
18211
|
type
|
|
18215
18212
|
} = item;
|
|
18216
|
-
if (Object.keys(numberOperatorEncoder).includes(
|
|
18217
|
-
searchParams.set(`_${
|
|
18213
|
+
if (Object.keys(numberOperatorEncoder).includes(operator)) {
|
|
18214
|
+
searchParams.set(`_${field}[${numberOperatorEncoder[operator]},${encodeValue(type)}]`, encodeValue(value));
|
|
18218
18215
|
} else {
|
|
18219
|
-
searchParams.set(`_${
|
|
18216
|
+
searchParams.set(`_${field}[${encodeValue(operator)},${encodeValue(type)}]`, encodeValue(value));
|
|
18220
18217
|
}
|
|
18221
18218
|
});
|
|
18222
18219
|
return searchParams;
|
|
@@ -18242,7 +18239,7 @@ const getFilterModel = (search, columns, localStorageFilters, setLocalStorageFil
|
|
|
18242
18239
|
}
|
|
18243
18240
|
return initialState && initialState.filter && initialState.filter.filterModel ? initialState.filter.filterModel : {
|
|
18244
18241
|
items: [],
|
|
18245
|
-
|
|
18242
|
+
logicOperator: GridLogicOperator.And
|
|
18246
18243
|
};
|
|
18247
18244
|
};
|
|
18248
18245
|
|
|
@@ -18255,7 +18252,7 @@ const getSortingFromString = (searchString, columns) => {
|
|
|
18255
18252
|
const searchParams = new URLSearchParams(searchString);
|
|
18256
18253
|
const value = searchParams.get('_sortColumn');
|
|
18257
18254
|
if (value === '' || value === null || value === '[]') {
|
|
18258
|
-
return
|
|
18255
|
+
return [];
|
|
18259
18256
|
}
|
|
18260
18257
|
const fields = columns.map(column => column.field);
|
|
18261
18258
|
const [column, order] = value.slice(1, value.length - 1).split(',');
|
|
@@ -18330,6 +18327,7 @@ const getSearchParamsFromPagination = pagination => {
|
|
|
18330
18327
|
// - if we don't have that, use the localStorage and update the URL
|
|
18331
18328
|
// - if we don't have that, return an empty PaginationModel
|
|
18332
18329
|
const getPaginationModel = (search, localStoragePagination, setLocalStoragePagination, initialState) => {
|
|
18330
|
+
var _initialState$paginat;
|
|
18333
18331
|
const pagination = getPaginationFromString(search);
|
|
18334
18332
|
if (pagination !== 'invalid') {
|
|
18335
18333
|
const searchFromPaginationModel = getSearchParamsFromPagination(pagination);
|
|
@@ -18343,11 +18341,11 @@ const getPaginationModel = (search, localStoragePagination, setLocalStoragePagin
|
|
|
18343
18341
|
if (paginationModelFromLocalStorage !== 'invalid') {
|
|
18344
18342
|
return paginationModelFromLocalStorage;
|
|
18345
18343
|
}
|
|
18346
|
-
return initialState !== null && initialState !== void 0 && initialState.pagination ? _objectSpread2({
|
|
18344
|
+
return initialState !== null && initialState !== void 0 && (_initialState$paginat = initialState.pagination) !== null && _initialState$paginat !== void 0 && _initialState$paginat.paginationModel ? _objectSpread2({
|
|
18347
18345
|
page: 0,
|
|
18348
18346
|
pageSize: 25,
|
|
18349
18347
|
direction: 'next'
|
|
18350
|
-
}, initialState.pagination) : {
|
|
18348
|
+
}, initialState.pagination.paginationModel) : {
|
|
18351
18349
|
page: 0,
|
|
18352
18350
|
pageSize: 25,
|
|
18353
18351
|
direction: 'next'
|
|
@@ -18383,11 +18381,11 @@ const getColumnVisibilityFromString = (searchString, columns) => {
|
|
|
18383
18381
|
};
|
|
18384
18382
|
const getSearchParamsFromColumnVisibility = (columnVisibility, columns) => {
|
|
18385
18383
|
const searchParams = new URLSearchParams();
|
|
18386
|
-
const
|
|
18384
|
+
const fields = columns.map(column => column.field);
|
|
18387
18385
|
|
|
18388
18386
|
// if column visibility model is empty, show all columns
|
|
18389
18387
|
if (Object.keys(columnVisibility).length == 0) {
|
|
18390
|
-
searchParams.set('_columnVisibility', `[${
|
|
18388
|
+
searchParams.set('_columnVisibility', `[${fields.join(',')}]`);
|
|
18391
18389
|
return searchParams;
|
|
18392
18390
|
}
|
|
18393
18391
|
const finalColumnVisibility = columns.filter(c => {
|
|
@@ -18398,7 +18396,7 @@ const getSearchParamsFromColumnVisibility = (columnVisibility, columns) => {
|
|
|
18398
18396
|
[colName]: true
|
|
18399
18397
|
});
|
|
18400
18398
|
}, columnVisibility);
|
|
18401
|
-
const visibleColumns =
|
|
18399
|
+
const visibleColumns = fields.filter(column => finalColumnVisibility[column] !== false);
|
|
18402
18400
|
searchParams.set('_columnVisibility', `[${visibleColumns.join(',')}]`);
|
|
18403
18401
|
return searchParams;
|
|
18404
18402
|
};
|
|
@@ -18456,8 +18454,8 @@ const getPinnedColumnsFromString = (notParsed, tableColumns) => {
|
|
|
18456
18454
|
if (typeof encodedValues !== 'string') {
|
|
18457
18455
|
continue;
|
|
18458
18456
|
}
|
|
18459
|
-
const
|
|
18460
|
-
const columns = encodedValues.split(',').map(value => decodeValue(value)).filter(val => typeof val === 'string' &&
|
|
18457
|
+
const fields = [...tableColumns.map(column => column.field), '__check__'];
|
|
18458
|
+
const columns = encodedValues.split(',').map(value => decodeValue(value)).filter(val => typeof val === 'string' && fields.includes(val));
|
|
18461
18459
|
if (fieldURL === '_pinnedColumnsLeft') {
|
|
18462
18460
|
pinnedColumns['left'] = columns;
|
|
18463
18461
|
}
|
|
@@ -18610,17 +18608,17 @@ const updateUrl = (_ref2, search, historyReplace, columns) => {
|
|
|
18610
18608
|
// do not use it for equivalence (e.g. with value `3` and undefined we
|
|
18611
18609
|
// will get 0).
|
|
18612
18610
|
const compareFilters = (firstFilter, secondFilter) => {
|
|
18613
|
-
if (firstFilter.
|
|
18611
|
+
if (firstFilter.field < secondFilter.field) {
|
|
18614
18612
|
return -1;
|
|
18615
|
-
} else if (firstFilter.
|
|
18613
|
+
} else if (firstFilter.field > secondFilter.field) {
|
|
18616
18614
|
return 1;
|
|
18617
18615
|
}
|
|
18618
|
-
if (firstFilter.
|
|
18616
|
+
if (firstFilter.operator === undefined || secondFilter.operator === undefined) {
|
|
18619
18617
|
return 0;
|
|
18620
18618
|
}
|
|
18621
|
-
if (firstFilter.
|
|
18619
|
+
if (firstFilter.operator < secondFilter.operator) {
|
|
18622
18620
|
return -1;
|
|
18623
|
-
} else if (firstFilter.
|
|
18621
|
+
} else if (firstFilter.operator > secondFilter.operator) {
|
|
18624
18622
|
return 1;
|
|
18625
18623
|
}
|
|
18626
18624
|
if (firstFilter.value < secondFilter.value) {
|
|
@@ -18631,18 +18629,18 @@ const compareFilters = (firstFilter, secondFilter) => {
|
|
|
18631
18629
|
return 0;
|
|
18632
18630
|
};
|
|
18633
18631
|
const areFiltersEquivalent = (firstFilter, secondFilter) => {
|
|
18634
|
-
return firstFilter.
|
|
18632
|
+
return firstFilter.field === secondFilter.field && firstFilter.operator === secondFilter.operator && firstFilter.value === secondFilter.value;
|
|
18635
18633
|
};
|
|
18636
18634
|
const areFilterModelsEquivalent = (filterModel, filterModelToMatch) => {
|
|
18637
18635
|
const {
|
|
18638
18636
|
items,
|
|
18639
|
-
|
|
18637
|
+
logicOperator
|
|
18640
18638
|
} = filterModel;
|
|
18641
18639
|
const {
|
|
18642
18640
|
items: itemsToMatch,
|
|
18643
|
-
|
|
18641
|
+
logicOperator: logicOperatorToMatch
|
|
18644
18642
|
} = filterModelToMatch;
|
|
18645
|
-
if (
|
|
18643
|
+
if (logicOperator !== logicOperatorToMatch) {
|
|
18646
18644
|
return false;
|
|
18647
18645
|
}
|
|
18648
18646
|
if (items.length !== itemsToMatch.length) {
|
|
@@ -18655,7 +18653,7 @@ const areFilterModelsEquivalent = (filterModel, filterModelToMatch) => {
|
|
|
18655
18653
|
const filterToCompare = itemsToMatch[i];
|
|
18656
18654
|
|
|
18657
18655
|
// compareFilters return 0 if and only if the filters have the same
|
|
18658
|
-
//
|
|
18656
|
+
// field, operator, and value
|
|
18659
18657
|
if (!areFiltersEquivalent(filter, filterToCompare)) {
|
|
18660
18658
|
return false;
|
|
18661
18659
|
}
|
|
@@ -24466,16 +24464,16 @@ const getRole = (config, dateFormat) => {
|
|
|
24466
24464
|
}).join('\n');
|
|
24467
24465
|
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.
|
|
24468
24466
|
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.
|
|
24469
|
-
The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "
|
|
24470
|
-
- "
|
|
24471
|
-
- "items": a list of conditions, each is an object with exactly the three keys "
|
|
24472
|
-
- "
|
|
24467
|
+
The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "logicOperator" and "items":
|
|
24468
|
+
- "logicOperator": the logical operator, only "and" or "or" are allowed. If there is only one condition in the "items", use "and".
|
|
24469
|
+
- "items": a list of conditions, each is an object with exactly the three keys "field", "operator" and "value":
|
|
24470
|
+
- "field": the column name, must be one of ${columns}
|
|
24473
24471
|
- "value":
|
|
24474
|
-
- this can be skipped if the "
|
|
24475
|
-
- a list of multiple values if the "
|
|
24472
|
+
- this can be skipped if the "operator" is either "isEmpty" or "isNotEmpty"
|
|
24473
|
+
- a list of multiple values if the "operator" ends with "AnyOf"
|
|
24476
24474
|
- otherwise, it's a single value represented as a string: "true" instead of true, "false" instead of false, "0.6" instead of 0.6.
|
|
24477
24475
|
For "date" data type, use ${dateFormat}. If relative date is input, convert to the actual date given today is ${today}.
|
|
24478
|
-
- "
|
|
24476
|
+
- "operator": the comparison operator, accepted values depend on the data type of the column
|
|
24479
24477
|
${operators}
|
|
24480
24478
|
|
|
24481
24479
|
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:
|
|
@@ -24512,10 +24510,10 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24512
24510
|
nlpFilterConfig,
|
|
24513
24511
|
onFilterModelChange,
|
|
24514
24512
|
dateFormat = 'yyyy-mm-dd',
|
|
24515
|
-
defaultModel = 'gpt-4-
|
|
24513
|
+
defaultModel = 'gpt-4-1106-preview',
|
|
24516
24514
|
defaultFilter = {
|
|
24517
24515
|
items: [],
|
|
24518
|
-
|
|
24516
|
+
logicOperator: 'and'
|
|
24519
24517
|
},
|
|
24520
24518
|
disablePower = false,
|
|
24521
24519
|
localeText
|
|
@@ -24593,7 +24591,7 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24593
24591
|
value: prompt
|
|
24594
24592
|
}), /*#__PURE__*/React__default.createElement(Button, {
|
|
24595
24593
|
variant: "primary",
|
|
24596
|
-
"
|
|
24594
|
+
"aria-label": buttonAriaLabel,
|
|
24597
24595
|
type: "submit",
|
|
24598
24596
|
isLoading: isLoading
|
|
24599
24597
|
}, buttonText)), !disablePower && /*#__PURE__*/React__default.createElement(Tooltip, null, /*#__PURE__*/React__default.createElement(Tooltip.Trigger, null, /*#__PURE__*/React__default.createElement(Switch, {
|
|
@@ -24654,7 +24652,7 @@ const Toolbar$2 = props => {
|
|
|
24654
24652
|
let {
|
|
24655
24653
|
apiRef
|
|
24656
24654
|
} = _ref;
|
|
24657
|
-
return
|
|
24655
|
+
return gridExpandedSortedRowIdsSelector(apiRef);
|
|
24658
24656
|
}
|
|
24659
24657
|
},
|
|
24660
24658
|
printOptions: {
|
|
@@ -26886,12 +26884,10 @@ const ServerSideControlledPagination = _ref3 => {
|
|
|
26886
26884
|
selectionStatus,
|
|
26887
26885
|
displaySelection,
|
|
26888
26886
|
displayPagination,
|
|
26889
|
-
|
|
26890
|
-
|
|
26891
|
-
|
|
26892
|
-
onPageSizeChange,
|
|
26887
|
+
paginationModel,
|
|
26888
|
+
onPaginationModelChange,
|
|
26889
|
+
pageSizeOptions,
|
|
26893
26890
|
displayRowsPerPage,
|
|
26894
|
-
rowsPerPageOptions,
|
|
26895
26891
|
paginationProps,
|
|
26896
26892
|
rowCount
|
|
26897
26893
|
} = _ref3;
|
|
@@ -26910,13 +26906,17 @@ const ServerSideControlledPagination = _ref3 => {
|
|
|
26910
26906
|
}, totalRowsLabel) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$1({
|
|
26911
26907
|
component: "div",
|
|
26912
26908
|
count: totalNumberOfRowsInTable,
|
|
26913
|
-
page: page,
|
|
26914
|
-
onPageChange: (event,
|
|
26915
|
-
|
|
26916
|
-
|
|
26917
|
-
|
|
26918
|
-
|
|
26919
|
-
|
|
26909
|
+
page: paginationModel.page,
|
|
26910
|
+
onPageChange: (event, page) => onPaginationModelChange({
|
|
26911
|
+
page,
|
|
26912
|
+
pageSize: paginationModel.pageSize
|
|
26913
|
+
}),
|
|
26914
|
+
rowsPerPage: paginationModel.pageSize,
|
|
26915
|
+
onRowsPerPageChange: event => onPaginationModelChange({
|
|
26916
|
+
page: paginationModel.page,
|
|
26917
|
+
pageSize: parseInt(event.target.value, 10)
|
|
26918
|
+
}),
|
|
26919
|
+
rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
|
|
26920
26920
|
}, paginationProps)) : null);
|
|
26921
26921
|
};
|
|
26922
26922
|
|
|
@@ -26942,11 +26942,9 @@ const ControlledPagination = _ref3 => {
|
|
|
26942
26942
|
displayPagination = false,
|
|
26943
26943
|
selectionStatus,
|
|
26944
26944
|
apiRef,
|
|
26945
|
-
|
|
26946
|
-
|
|
26947
|
-
|
|
26948
|
-
onPageSizeChange,
|
|
26949
|
-
rowsPerPageOptions,
|
|
26945
|
+
paginationModel,
|
|
26946
|
+
onPaginationModelChange,
|
|
26947
|
+
pageSizeOptions,
|
|
26950
26948
|
isRowSelectable,
|
|
26951
26949
|
paginationProps
|
|
26952
26950
|
} = _ref3;
|
|
@@ -26976,17 +26974,25 @@ const ControlledPagination = _ref3 => {
|
|
|
26976
26974
|
}, `${selectionStatus.numberOfSelectedRows} row${selectionStatus.numberOfSelectedRows > 1 ? 's' : ''} selected`) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$1({
|
|
26977
26975
|
component: "div",
|
|
26978
26976
|
count: numberOfFilteredRowsInTable,
|
|
26979
|
-
page: page,
|
|
26980
|
-
onPageChange: (event,
|
|
26981
|
-
|
|
26977
|
+
page: paginationModel.page,
|
|
26978
|
+
onPageChange: (event, page) => {
|
|
26979
|
+
onPaginationModelChange({
|
|
26980
|
+
page,
|
|
26981
|
+
pageSize: paginationModel.pageSize
|
|
26982
|
+
});
|
|
26983
|
+
},
|
|
26984
|
+
rowsPerPage: paginationModel.pageSize,
|
|
26982
26985
|
onRowsPerPageChange: event => {
|
|
26983
|
-
|
|
26986
|
+
onPaginationModelChange({
|
|
26987
|
+
page: paginationModel.page,
|
|
26988
|
+
pageSize: parseInt(event.target.value, 10)
|
|
26989
|
+
});
|
|
26984
26990
|
},
|
|
26985
|
-
rowsPerPageOptions: displayRowsPerPage ?
|
|
26991
|
+
rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
|
|
26986
26992
|
}, paginationProps)) : null);
|
|
26987
26993
|
};
|
|
26988
26994
|
|
|
26989
|
-
const _excluded$3 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "
|
|
26995
|
+
const _excluded$3 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "paginationModel", "onPaginationModelChange", "pageSizeOptions", "paginationProps", "paginationMode", "rowCount"];
|
|
26990
26996
|
const ToolbarWrapper = _ref => {
|
|
26991
26997
|
let {
|
|
26992
26998
|
hideToolbar,
|
|
@@ -26998,11 +27004,9 @@ const ToolbarWrapper = _ref => {
|
|
|
26998
27004
|
selectionStatus,
|
|
26999
27005
|
apiRef,
|
|
27000
27006
|
isRowSelectable,
|
|
27001
|
-
|
|
27002
|
-
|
|
27003
|
-
|
|
27004
|
-
onPageSizeChange,
|
|
27005
|
-
rowsPerPageOptions,
|
|
27007
|
+
paginationModel,
|
|
27008
|
+
onPaginationModelChange,
|
|
27009
|
+
pageSizeOptions,
|
|
27006
27010
|
paginationProps,
|
|
27007
27011
|
paginationMode = 'client',
|
|
27008
27012
|
rowCount
|
|
@@ -27016,11 +27020,9 @@ const ToolbarWrapper = _ref => {
|
|
|
27016
27020
|
displayRowsPerPage: false,
|
|
27017
27021
|
displayPagination: ['top', 'both'].includes(paginationPlacement),
|
|
27018
27022
|
selectionStatus: selectionStatus.current,
|
|
27019
|
-
|
|
27020
|
-
|
|
27021
|
-
|
|
27022
|
-
onPageSizeChange: onPageSizeChange,
|
|
27023
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
27023
|
+
paginationModel: paginationModel,
|
|
27024
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
27025
|
+
pageSizeOptions: pageSizeOptions,
|
|
27024
27026
|
paginationProps: paginationProps,
|
|
27025
27027
|
rowCount: rowCount
|
|
27026
27028
|
}) : /*#__PURE__*/React__default.createElement(ControlledPagination, {
|
|
@@ -27030,30 +27032,26 @@ const ToolbarWrapper = _ref => {
|
|
|
27030
27032
|
selectionStatus: selectionStatus.current,
|
|
27031
27033
|
apiRef: apiRef,
|
|
27032
27034
|
isRowSelectable: isRowSelectable,
|
|
27033
|
-
|
|
27034
|
-
|
|
27035
|
-
|
|
27036
|
-
onPageSizeChange: onPageSizeChange,
|
|
27037
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
27035
|
+
paginationModel: paginationModel,
|
|
27036
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
27037
|
+
pageSizeOptions: pageSizeOptions,
|
|
27038
27038
|
paginationProps: paginationProps
|
|
27039
27039
|
}) : null);
|
|
27040
27040
|
};
|
|
27041
27041
|
|
|
27042
27042
|
const useControlledDatagridState = _ref => {
|
|
27043
|
-
var _initialState$paginat, _initialState$paginat2;
|
|
27043
|
+
var _ref2, _ref3, _propsPaginationModel, _initialState$paginat, _initialState$paginat2, _pageSizeOptions$, _ref4, _propsPaginationModel2, _initialState$paginat3, _initialState$paginat4;
|
|
27044
27044
|
let {
|
|
27045
27045
|
initialState,
|
|
27046
|
-
|
|
27046
|
+
pageSizeOptions,
|
|
27047
27047
|
propsColumnVisibilityModel,
|
|
27048
27048
|
propsFilterModel,
|
|
27049
27049
|
propsOnColumnVisibilityModelChange,
|
|
27050
27050
|
propsOnFilterModelChange,
|
|
27051
|
-
|
|
27052
|
-
propsOnPageSizeChange,
|
|
27051
|
+
propsOnPaginationModelChange,
|
|
27053
27052
|
propsOnPinnedColumnsChange,
|
|
27054
27053
|
propsOnSortModelChange,
|
|
27055
|
-
|
|
27056
|
-
propsPageSize,
|
|
27054
|
+
propsPaginationModel,
|
|
27057
27055
|
propsPinnedColumns,
|
|
27058
27056
|
propsSortModel
|
|
27059
27057
|
} = _ref;
|
|
@@ -27101,33 +27099,22 @@ const useControlledDatagridState = _ref => {
|
|
|
27101
27099
|
setSortModel(model);
|
|
27102
27100
|
}
|
|
27103
27101
|
};
|
|
27104
|
-
const [
|
|
27105
|
-
|
|
27106
|
-
|
|
27107
|
-
|
|
27108
|
-
|
|
27109
|
-
|
|
27110
|
-
|
|
27111
|
-
}
|
|
27112
|
-
};
|
|
27113
|
-
useEffect(() => {
|
|
27114
|
-
if (propsPage || propsPage === 0) {
|
|
27115
|
-
setPage(propsPage);
|
|
27116
|
-
}
|
|
27117
|
-
}, [propsPage]);
|
|
27118
|
-
const onPageSizeChange = pageSize => {
|
|
27119
|
-
onPageChange(0);
|
|
27120
|
-
if (propsOnPageSizeChange) {
|
|
27121
|
-
propsOnPageSizeChange(pageSize, undefined);
|
|
27102
|
+
const [paginationModel, setPaginationModel] = useState({
|
|
27103
|
+
pageSize: (_ref2 = (_ref3 = (_propsPaginationModel = propsPaginationModel === null || propsPaginationModel === void 0 ? void 0 : propsPaginationModel.pageSize) !== null && _propsPaginationModel !== void 0 ? _propsPaginationModel : initialState === null || initialState === void 0 ? void 0 : (_initialState$paginat = initialState.pagination) === null || _initialState$paginat === void 0 ? void 0 : (_initialState$paginat2 = _initialState$paginat.paginationModel) === null || _initialState$paginat2 === void 0 ? void 0 : _initialState$paginat2.pageSize) !== null && _ref3 !== void 0 ? _ref3 : typeof (pageSizeOptions === null || pageSizeOptions === void 0 ? void 0 : pageSizeOptions[0]) === 'number' ? pageSizeOptions === null || pageSizeOptions === void 0 ? void 0 : pageSizeOptions[0] : pageSizeOptions === null || pageSizeOptions === void 0 ? void 0 : (_pageSizeOptions$ = pageSizeOptions[0]) === null || _pageSizeOptions$ === void 0 ? void 0 : _pageSizeOptions$.value) !== null && _ref2 !== void 0 ? _ref2 : 25,
|
|
27104
|
+
page: (_ref4 = (_propsPaginationModel2 = propsPaginationModel === null || propsPaginationModel === void 0 ? void 0 : propsPaginationModel.page) !== null && _propsPaginationModel2 !== void 0 ? _propsPaginationModel2 : initialState === null || initialState === void 0 ? void 0 : (_initialState$paginat3 = initialState.pagination) === null || _initialState$paginat3 === void 0 ? void 0 : (_initialState$paginat4 = _initialState$paginat3.paginationModel) === null || _initialState$paginat4 === void 0 ? void 0 : _initialState$paginat4.page) !== null && _ref4 !== void 0 ? _ref4 : 0
|
|
27105
|
+
});
|
|
27106
|
+
const onPaginationModelChange = (model, details) => {
|
|
27107
|
+
if (propsOnPaginationModelChange) {
|
|
27108
|
+
propsOnPaginationModelChange(model, details);
|
|
27122
27109
|
} else {
|
|
27123
|
-
|
|
27110
|
+
setPaginationModel(model);
|
|
27124
27111
|
}
|
|
27125
27112
|
};
|
|
27126
27113
|
useEffect(() => {
|
|
27127
|
-
if (
|
|
27128
|
-
|
|
27114
|
+
if (propsPaginationModel) {
|
|
27115
|
+
setPaginationModel(propsPaginationModel);
|
|
27129
27116
|
}
|
|
27130
|
-
}, [
|
|
27117
|
+
}, [propsPaginationModel]);
|
|
27131
27118
|
return {
|
|
27132
27119
|
filterModel,
|
|
27133
27120
|
onFilterModelChange,
|
|
@@ -27137,14 +27124,12 @@ const useControlledDatagridState = _ref => {
|
|
|
27137
27124
|
onPinnedColumnsChange,
|
|
27138
27125
|
sortModel,
|
|
27139
27126
|
onSortModelChange,
|
|
27140
|
-
|
|
27141
|
-
|
|
27142
|
-
onPageChange,
|
|
27143
|
-
onPageSizeChange
|
|
27127
|
+
paginationModel,
|
|
27128
|
+
onPaginationModelChange
|
|
27144
27129
|
};
|
|
27145
27130
|
};
|
|
27146
27131
|
|
|
27147
|
-
const _excluded$2 = ["apiRef", "autoHeight", "className", "
|
|
27132
|
+
const _excluded$2 = ["apiRef", "autoHeight", "className", "slots", "slotProps", "filterModel", "columnVisibilityModel", "pinnedColumns", "sortModel", "paginationModel", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "onFilterModelChange", "rowSelectionModel", "onPaginationModelChange", "onRowSelectionModelChange", "onColumnVisibilityModelChange", "onPinnedColumnsChange", "onSortModelChange", "pagination", "paginationPlacement", "paginationProps", "rows", "pageSizeOptions", "sx", "theme", "paginationMode", "rowCount"];
|
|
27148
27133
|
const COMPONENT_NAME$2 = 'DataGrid';
|
|
27149
27134
|
const CLASSNAME$2 = 'redsift-datagrid';
|
|
27150
27135
|
const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
@@ -27153,33 +27138,30 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27153
27138
|
apiRef: propsApiRef,
|
|
27154
27139
|
autoHeight,
|
|
27155
27140
|
className,
|
|
27156
|
-
|
|
27157
|
-
|
|
27158
|
-
componentsProps,
|
|
27141
|
+
slots,
|
|
27142
|
+
slotProps,
|
|
27159
27143
|
filterModel: propsFilterModel,
|
|
27160
27144
|
columnVisibilityModel: propsColumnVisibilityModel,
|
|
27161
27145
|
pinnedColumns: propsPinnedColumns,
|
|
27162
27146
|
sortModel: propsSortModel,
|
|
27147
|
+
paginationModel: propsPaginationModel,
|
|
27163
27148
|
height: propsHeight,
|
|
27164
27149
|
hideToolbar,
|
|
27165
27150
|
initialState,
|
|
27166
27151
|
isRowSelectable,
|
|
27167
27152
|
license = process.env.MUI_LICENSE_KEY,
|
|
27168
27153
|
onFilterModelChange: propsOnFilterModelChange,
|
|
27169
|
-
|
|
27170
|
-
|
|
27154
|
+
rowSelectionModel: propsRowSelectionModel,
|
|
27155
|
+
onPaginationModelChange: propsOnPaginationModelChange,
|
|
27156
|
+
onRowSelectionModelChange: propsOnRowSelectionModelChange,
|
|
27171
27157
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
27172
27158
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
27173
27159
|
onSortModelChange: propsOnSortModelChange,
|
|
27174
|
-
selectionModel: propsSelectionModel,
|
|
27175
|
-
onSelectionModelChange: propsOnSelectionModelChange,
|
|
27176
|
-
page: propsPage,
|
|
27177
|
-
pageSize: propsPageSize,
|
|
27178
27160
|
pagination,
|
|
27179
27161
|
paginationPlacement = 'both',
|
|
27180
27162
|
paginationProps,
|
|
27181
27163
|
rows,
|
|
27182
|
-
|
|
27164
|
+
pageSizeOptions,
|
|
27183
27165
|
sx,
|
|
27184
27166
|
theme: propsTheme,
|
|
27185
27167
|
paginationMode = 'client',
|
|
@@ -27189,7 +27171,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27189
27171
|
const theme = useTheme$4(propsTheme);
|
|
27190
27172
|
const _apiRef = useGridApiRef();
|
|
27191
27173
|
const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
|
|
27192
|
-
const RenderedToolbar =
|
|
27174
|
+
const RenderedToolbar = slots !== null && slots !== void 0 && slots.toolbar ? slots.toolbar : Toolbar$2;
|
|
27193
27175
|
LicenseInfo.setLicenseKey(license);
|
|
27194
27176
|
const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
|
|
27195
27177
|
const {
|
|
@@ -27197,56 +27179,52 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27197
27179
|
filterModel,
|
|
27198
27180
|
onColumnVisibilityModelChange,
|
|
27199
27181
|
onFilterModelChange,
|
|
27200
|
-
|
|
27201
|
-
onPageSizeChange,
|
|
27182
|
+
onPaginationModelChange,
|
|
27202
27183
|
onPinnedColumnsChange,
|
|
27203
27184
|
onSortModelChange,
|
|
27204
|
-
|
|
27205
|
-
pageSize,
|
|
27185
|
+
paginationModel,
|
|
27206
27186
|
pinnedColumns,
|
|
27207
27187
|
sortModel
|
|
27208
27188
|
} = useControlledDatagridState({
|
|
27209
27189
|
initialState,
|
|
27210
|
-
|
|
27190
|
+
pageSizeOptions,
|
|
27211
27191
|
propsColumnVisibilityModel,
|
|
27212
27192
|
propsFilterModel,
|
|
27213
27193
|
propsOnColumnVisibilityModelChange,
|
|
27214
27194
|
propsOnFilterModelChange,
|
|
27215
27195
|
propsOnPinnedColumnsChange,
|
|
27216
27196
|
propsOnSortModelChange,
|
|
27217
|
-
|
|
27218
|
-
propsPageSize,
|
|
27197
|
+
propsPaginationModel,
|
|
27219
27198
|
propsPinnedColumns,
|
|
27220
27199
|
propsSortModel,
|
|
27221
|
-
|
|
27222
|
-
propsOnPageSizeChange
|
|
27200
|
+
propsOnPaginationModelChange
|
|
27223
27201
|
});
|
|
27224
|
-
const [
|
|
27202
|
+
const [rowSelectionModel, setRowSelectionModel] = useState(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
27225
27203
|
useEffect(() => {
|
|
27226
|
-
|
|
27227
|
-
}, [
|
|
27228
|
-
const
|
|
27229
|
-
if (
|
|
27230
|
-
|
|
27204
|
+
setRowSelectionModel(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
27205
|
+
}, [propsRowSelectionModel]);
|
|
27206
|
+
const onRowSelectionModelChange = (selectionModel, details) => {
|
|
27207
|
+
if (propsOnRowSelectionModelChange) {
|
|
27208
|
+
propsOnRowSelectionModelChange(selectionModel, details);
|
|
27231
27209
|
} else {
|
|
27232
|
-
|
|
27210
|
+
setRowSelectionModel(selectionModel);
|
|
27233
27211
|
}
|
|
27234
27212
|
};
|
|
27235
27213
|
const selectionStatus = useRef({
|
|
27236
27214
|
type: 'none',
|
|
27237
27215
|
numberOfSelectedRows: 0,
|
|
27238
27216
|
numberOfSelectedRowsInPage: 0,
|
|
27239
|
-
page,
|
|
27240
|
-
pageSize
|
|
27217
|
+
page: paginationModel.page,
|
|
27218
|
+
pageSize: paginationModel.pageSize
|
|
27241
27219
|
});
|
|
27242
27220
|
|
|
27243
27221
|
// in server-side pagination we want to update the selection status
|
|
27244
27222
|
// every time we navigate between pages, resize our page or select something
|
|
27245
27223
|
useEffect(() => {
|
|
27246
27224
|
if (paginationMode == 'server') {
|
|
27247
|
-
onServerSideSelectionStatusChange(Array.isArray(
|
|
27225
|
+
onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatus, isRowSelectable, paginationModel.page, paginationModel.pageSize);
|
|
27248
27226
|
}
|
|
27249
|
-
}, [
|
|
27227
|
+
}, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
|
|
27250
27228
|
if (!Array.isArray(rows)) {
|
|
27251
27229
|
return null;
|
|
27252
27230
|
}
|
|
@@ -27277,57 +27255,54 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27277
27255
|
apiRef: apiRef,
|
|
27278
27256
|
autoHeight: autoHeight,
|
|
27279
27257
|
checkboxSelectionVisibleOnly: Boolean(pagination),
|
|
27280
|
-
|
|
27281
|
-
|
|
27282
|
-
|
|
27283
|
-
|
|
27284
|
-
|
|
27285
|
-
|
|
27286
|
-
ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27258
|
+
slots: _objectSpread2(_objectSpread2({
|
|
27259
|
+
baseButton: BaseButton,
|
|
27260
|
+
baseCheckbox: BaseCheckbox,
|
|
27261
|
+
// baseTextField,
|
|
27262
|
+
basePopper: BasePopper,
|
|
27263
|
+
columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27287
27264
|
displayName: "ColumnFilteredIcon"
|
|
27288
27265
|
})),
|
|
27289
|
-
|
|
27266
|
+
columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27290
27267
|
displayName: "ColumnSelectorIcon"
|
|
27291
27268
|
})),
|
|
27292
|
-
|
|
27269
|
+
columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27293
27270
|
displayName: "ColumnSortedAscendingIcon"
|
|
27294
27271
|
})),
|
|
27295
|
-
|
|
27272
|
+
columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27296
27273
|
displayName: "ColumnSortedDescendingIcon"
|
|
27297
27274
|
})),
|
|
27298
|
-
|
|
27275
|
+
densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27299
27276
|
displayName: "DensityCompactIcon"
|
|
27300
27277
|
})),
|
|
27301
|
-
|
|
27278
|
+
densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27302
27279
|
displayName: "DensityStandardIcon"
|
|
27303
27280
|
})),
|
|
27304
|
-
|
|
27281
|
+
densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27305
27282
|
displayName: "DensityComfortableIcon"
|
|
27306
27283
|
})),
|
|
27307
|
-
|
|
27284
|
+
detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27308
27285
|
displayName: "DetailPanelCollapseIcon"
|
|
27309
27286
|
})),
|
|
27310
|
-
|
|
27287
|
+
detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27311
27288
|
displayName: "DetailPanelExpandIcon"
|
|
27312
27289
|
})),
|
|
27313
|
-
|
|
27290
|
+
exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27314
27291
|
displayName: "ExportIcon"
|
|
27315
27292
|
})),
|
|
27316
|
-
|
|
27293
|
+
openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
|
|
27317
27294
|
displayName: "OpenFilterButtonIcon"
|
|
27318
27295
|
}, props))
|
|
27319
|
-
},
|
|
27320
|
-
|
|
27321
|
-
|
|
27296
|
+
}, slots), {}, {
|
|
27297
|
+
toolbar: ToolbarWrapper,
|
|
27298
|
+
pagination: props => pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$1({}, props, {
|
|
27322
27299
|
displaySelection: false,
|
|
27323
27300
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
27324
27301
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
27325
27302
|
selectionStatus: selectionStatus.current,
|
|
27326
|
-
|
|
27327
|
-
|
|
27328
|
-
|
|
27329
|
-
onPageSizeChange: onPageSizeChange,
|
|
27330
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
27303
|
+
paginationModel: paginationModel,
|
|
27304
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
27305
|
+
pageSizeOptions: pageSizeOptions,
|
|
27331
27306
|
paginationProps: paginationProps,
|
|
27332
27307
|
paginationMode: paginationMode,
|
|
27333
27308
|
rowCount: rowCount
|
|
@@ -27338,16 +27313,14 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27338
27313
|
selectionStatus: selectionStatus.current,
|
|
27339
27314
|
apiRef: apiRef,
|
|
27340
27315
|
isRowSelectable: isRowSelectable,
|
|
27341
|
-
|
|
27342
|
-
|
|
27343
|
-
|
|
27344
|
-
onPageSizeChange: onPageSizeChange,
|
|
27345
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
27316
|
+
paginationModel: paginationModel,
|
|
27317
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
27318
|
+
pageSizeOptions: pageSizeOptions,
|
|
27346
27319
|
paginationProps: paginationProps,
|
|
27347
27320
|
paginationMode: paginationMode
|
|
27348
27321
|
})) : null
|
|
27349
27322
|
}),
|
|
27350
|
-
|
|
27323
|
+
slotProps: _objectSpread2(_objectSpread2({}, slotProps), {}, {
|
|
27351
27324
|
toolbar: _objectSpread2({
|
|
27352
27325
|
hideToolbar,
|
|
27353
27326
|
RenderedToolbar,
|
|
@@ -27358,15 +27331,13 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27358
27331
|
selectionStatus,
|
|
27359
27332
|
apiRef,
|
|
27360
27333
|
isRowSelectable,
|
|
27361
|
-
|
|
27362
|
-
|
|
27363
|
-
|
|
27364
|
-
onPageSizeChange,
|
|
27365
|
-
rowsPerPageOptions,
|
|
27334
|
+
paginationModel,
|
|
27335
|
+
onPaginationModelChange,
|
|
27336
|
+
pageSizeOptions,
|
|
27366
27337
|
paginationProps,
|
|
27367
27338
|
paginationMode,
|
|
27368
27339
|
rowCount
|
|
27369
|
-
},
|
|
27340
|
+
}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar)
|
|
27370
27341
|
}),
|
|
27371
27342
|
filterModel: filterModel,
|
|
27372
27343
|
columnVisibilityModel: columnVisibilityModel,
|
|
@@ -27382,13 +27353,11 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27382
27353
|
paginationMode: paginationMode,
|
|
27383
27354
|
keepNonExistentRowsSelected: paginationMode == 'server',
|
|
27384
27355
|
rows: rows,
|
|
27385
|
-
|
|
27386
|
-
|
|
27387
|
-
|
|
27388
|
-
|
|
27389
|
-
|
|
27390
|
-
selectionModel: selectionModel,
|
|
27391
|
-
onSelectionModelChange: (newSelectionModel, details) => {
|
|
27356
|
+
pageSizeOptions: pageSizeOptions,
|
|
27357
|
+
paginationModel: paginationModel,
|
|
27358
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
27359
|
+
rowSelectionModel: rowSelectionModel,
|
|
27360
|
+
onRowSelectionModelChange: (newSelectionModel, details) => {
|
|
27392
27361
|
if (pagination && paginationMode != 'server') {
|
|
27393
27362
|
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
|
|
27394
27363
|
let {
|
|
@@ -27446,7 +27415,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27446
27415
|
};
|
|
27447
27416
|
}
|
|
27448
27417
|
}
|
|
27449
|
-
|
|
27418
|
+
onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
|
|
27450
27419
|
},
|
|
27451
27420
|
sx: _objectSpread2(_objectSpread2({}, sx), {}, {
|
|
27452
27421
|
'.MuiDataGrid-columnHeaders': {
|
|
@@ -27463,8 +27432,6 @@ DataGrid.className = CLASSNAME$2;
|
|
|
27463
27432
|
DataGrid.displayName = COMPONENT_NAME$2;
|
|
27464
27433
|
|
|
27465
27434
|
// Get and Set data from LocalStorage WITHOUT useState
|
|
27466
|
-
|
|
27467
|
-
// triggering a state update and consecutive re-render
|
|
27468
27435
|
const useFetchState = (defaultValue, key) => {
|
|
27469
27436
|
let stickyValue = null;
|
|
27470
27437
|
try {
|
|
@@ -27472,16 +27439,7 @@ const useFetchState = (defaultValue, key) => {
|
|
|
27472
27439
|
} catch (e) {
|
|
27473
27440
|
console.error('StatefulDataGrid: error getting item from local storage: ', e);
|
|
27474
27441
|
}
|
|
27475
|
-
|
|
27476
|
-
|
|
27477
|
-
// TODO: temporary workaround to avoid clashes when someone had sorting on the now-removed screenshot field (renamed to num_annotations)
|
|
27478
|
-
// 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
|
|
27479
|
-
if (parsedValue instanceof Array) {
|
|
27480
|
-
const fields = (parsedValue || []).map(item => item.field);
|
|
27481
|
-
if (fields.includes('screenshot') || fields.includes('diffs')) {
|
|
27482
|
-
parsedValue = defaultValue;
|
|
27483
|
-
}
|
|
27484
|
-
}
|
|
27442
|
+
const parsedValue = stickyValue !== null && stickyValue !== undefined && stickyValue !== 'undefined' ? JSON.parse(stickyValue) : defaultValue;
|
|
27485
27443
|
const updateValue = useCallback(value => {
|
|
27486
27444
|
try {
|
|
27487
27445
|
window.localStorage.setItem(key, JSON.stringify(value));
|
|
@@ -27492,6 +27450,8 @@ const useFetchState = (defaultValue, key) => {
|
|
|
27492
27450
|
return [parsedValue, updateValue];
|
|
27493
27451
|
};
|
|
27494
27452
|
|
|
27453
|
+
// import useLocalStorage from './useLocalStorage';
|
|
27454
|
+
|
|
27495
27455
|
const useTableStates = (id, version) => {
|
|
27496
27456
|
const [paginationModel, setPaginationModel] = useFetchState('', buildStorageKey({
|
|
27497
27457
|
id,
|
|
@@ -27548,8 +27508,7 @@ const useStatefulTable = props => {
|
|
|
27548
27508
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
27549
27509
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
27550
27510
|
onFilterModelChange: propsOnFilterModelChange,
|
|
27551
|
-
|
|
27552
|
-
onPageSizeChange: propsOnPageSizeChange,
|
|
27511
|
+
onPaginationModelChange: propsOnPaginationModelChange,
|
|
27553
27512
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
27554
27513
|
onSortModelChange: propsOnSortModelChange,
|
|
27555
27514
|
useRouter,
|
|
@@ -27611,7 +27570,6 @@ const useStatefulTable = props => {
|
|
|
27611
27570
|
column.width = dimensionModel[column.field] || column.width || 100;
|
|
27612
27571
|
return column;
|
|
27613
27572
|
}), [propsColumns, dimensionModel]);
|
|
27614
|
-
|
|
27615
27573
|
/** Add resetPage method to apiRef. */
|
|
27616
27574
|
apiRef.current.resetPage = () => {
|
|
27617
27575
|
apiRef.current.setPage(0);
|
|
@@ -27622,7 +27580,7 @@ const useStatefulTable = props => {
|
|
|
27622
27580
|
onFilterModelChange: (model, details) => {
|
|
27623
27581
|
const filterModel = _objectSpread2(_objectSpread2({}, model), {}, {
|
|
27624
27582
|
items: model.items.map(item => {
|
|
27625
|
-
const column = apiRef.current.getColumn(item.
|
|
27583
|
+
const column = apiRef.current.getColumn(item.field);
|
|
27626
27584
|
item.type = column.type || 'string';
|
|
27627
27585
|
return item;
|
|
27628
27586
|
})
|
|
@@ -27659,33 +27617,16 @@ const useStatefulTable = props => {
|
|
|
27659
27617
|
}, search, historyReplace, columns);
|
|
27660
27618
|
},
|
|
27661
27619
|
pinnedColumns: pinnedColumnsModel,
|
|
27662
|
-
|
|
27663
|
-
|
|
27664
|
-
|
|
27665
|
-
|
|
27666
|
-
|
|
27667
|
-
|
|
27668
|
-
filterModel: filterParsed,
|
|
27669
|
-
sortModel: sortModelParsed,
|
|
27670
|
-
paginationModel: {
|
|
27671
|
-
page,
|
|
27672
|
-
pageSize: paginationModelParsed.pageSize,
|
|
27673
|
-
direction
|
|
27674
|
-
},
|
|
27675
|
-
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
27676
|
-
pinnedColumnsModel: pinnedColumnsModel
|
|
27677
|
-
}, search, historyReplace, columns);
|
|
27678
|
-
},
|
|
27679
|
-
onPageSizeChange: (pageSize, details) => {
|
|
27680
|
-
propsOnPageSizeChange === null || propsOnPageSizeChange === void 0 ? void 0 : propsOnPageSizeChange(pageSize, details);
|
|
27620
|
+
paginationModel: paginationModelParsed,
|
|
27621
|
+
onPaginationModelChange: (model, details) => {
|
|
27622
|
+
const paginationModel = _objectSpread2(_objectSpread2({}, model), {}, {
|
|
27623
|
+
direction: paginationModelParsed.page < model.page ? 'next' : 'back'
|
|
27624
|
+
});
|
|
27625
|
+
propsOnPaginationModelChange === null || propsOnPaginationModelChange === void 0 ? void 0 : propsOnPaginationModelChange(paginationModel, details);
|
|
27681
27626
|
updateUrl({
|
|
27682
27627
|
filterModel: filterParsed,
|
|
27683
27628
|
sortModel: sortModelParsed,
|
|
27684
|
-
paginationModel:
|
|
27685
|
-
page: paginationModelParsed.page,
|
|
27686
|
-
pageSize,
|
|
27687
|
-
direction: paginationModelParsed.direction
|
|
27688
|
-
},
|
|
27629
|
+
paginationModel: paginationModel,
|
|
27689
27630
|
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
27690
27631
|
pinnedColumnsModel: pinnedColumnsModel
|
|
27691
27632
|
}, search, historyReplace, columns);
|
|
@@ -27711,7 +27652,7 @@ const useStatefulTable = props => {
|
|
|
27711
27652
|
};
|
|
27712
27653
|
};
|
|
27713
27654
|
|
|
27714
|
-
const _excluded$1 = ["apiRef", "autoHeight", "className", "columns", "
|
|
27655
|
+
const _excluded$1 = ["apiRef", "autoHeight", "className", "columns", "slots", "slotProps", "filterModel", "columnVisibilityModel", "pinnedColumns", "sortModel", "paginationModel", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "localStorageVersion", "onFilterModelChange", "rowSelectionModel", "onColumnWidthChange", "onPaginationModelChange", "onRowSelectionModelChange", "onColumnVisibilityModelChange", "onPinnedColumnsChange", "onSortModelChange", "pagination", "paginationPlacement", "paginationProps", "rows", "pageSizeOptions", "sx", "theme", "useRouter", "paginationMode", "rowCount"];
|
|
27715
27656
|
const COMPONENT_NAME$1 = 'DataGrid';
|
|
27716
27657
|
const CLASSNAME$1 = 'redsift-datagrid';
|
|
27717
27658
|
const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
@@ -27721,15 +27662,13 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27721
27662
|
autoHeight,
|
|
27722
27663
|
className,
|
|
27723
27664
|
columns,
|
|
27724
|
-
|
|
27725
|
-
|
|
27726
|
-
componentsProps,
|
|
27665
|
+
slots,
|
|
27666
|
+
slotProps,
|
|
27727
27667
|
filterModel: propsFilterModel,
|
|
27728
27668
|
columnVisibilityModel: propsColumnVisibilityModel,
|
|
27729
27669
|
pinnedColumns: propsPinnedColumns,
|
|
27730
27670
|
sortModel: propsSortModel,
|
|
27731
|
-
|
|
27732
|
-
pageSize: propsPageSize,
|
|
27671
|
+
paginationModel: propsPaginationModel,
|
|
27733
27672
|
height: propsHeight,
|
|
27734
27673
|
hideToolbar,
|
|
27735
27674
|
initialState,
|
|
@@ -27737,11 +27676,10 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27737
27676
|
license = process.env.MUI_LICENSE_KEY,
|
|
27738
27677
|
localStorageVersion,
|
|
27739
27678
|
onFilterModelChange: propsOnFilterModelChange,
|
|
27740
|
-
|
|
27679
|
+
rowSelectionModel: propsRowSelectionModel,
|
|
27741
27680
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
27742
|
-
|
|
27743
|
-
|
|
27744
|
-
onSelectionModelChange: propsOnSelectionModelChange,
|
|
27681
|
+
onPaginationModelChange: propsOnPaginationModelChange,
|
|
27682
|
+
onRowSelectionModelChange: propsOnRowSelectionModelChange,
|
|
27745
27683
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
27746
27684
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
27747
27685
|
onSortModelChange: propsOnSortModelChange,
|
|
@@ -27749,7 +27687,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27749
27687
|
paginationPlacement = 'both',
|
|
27750
27688
|
paginationProps,
|
|
27751
27689
|
rows,
|
|
27752
|
-
|
|
27690
|
+
pageSizeOptions,
|
|
27753
27691
|
sx,
|
|
27754
27692
|
theme: propsTheme,
|
|
27755
27693
|
useRouter,
|
|
@@ -27760,43 +27698,38 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27760
27698
|
const theme = useTheme$4(propsTheme);
|
|
27761
27699
|
const _apiRef = useGridApiRef();
|
|
27762
27700
|
const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
|
|
27763
|
-
const RenderedToolbar =
|
|
27701
|
+
const RenderedToolbar = slots !== null && slots !== void 0 && slots.toolbar ? slots.toolbar : Toolbar$2;
|
|
27764
27702
|
LicenseInfo.setLicenseKey(license);
|
|
27765
27703
|
const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
|
|
27766
27704
|
const {
|
|
27767
27705
|
onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
|
|
27768
27706
|
onFilterModelChange: controlledOnFilterModelChange,
|
|
27769
|
-
|
|
27770
|
-
onPageSizeChange: controlledOnPageSizeChange,
|
|
27707
|
+
onPaginationModelChange: controlledOnPaginationModelChange,
|
|
27771
27708
|
onPinnedColumnsChange: controlledOnPinnedColumnsChange,
|
|
27772
27709
|
onSortModelChange: controlledOnSortModelChange
|
|
27773
27710
|
} = useControlledDatagridState({
|
|
27774
27711
|
initialState,
|
|
27775
|
-
|
|
27712
|
+
pageSizeOptions,
|
|
27776
27713
|
propsColumnVisibilityModel,
|
|
27777
27714
|
propsFilterModel,
|
|
27778
27715
|
propsOnColumnVisibilityModelChange,
|
|
27779
27716
|
propsOnFilterModelChange,
|
|
27780
27717
|
propsOnPinnedColumnsChange,
|
|
27781
27718
|
propsOnSortModelChange,
|
|
27782
|
-
|
|
27783
|
-
propsPageSize,
|
|
27719
|
+
propsPaginationModel,
|
|
27784
27720
|
propsPinnedColumns,
|
|
27785
27721
|
propsSortModel,
|
|
27786
|
-
|
|
27787
|
-
propsOnPageSizeChange
|
|
27722
|
+
propsOnPaginationModelChange
|
|
27788
27723
|
});
|
|
27789
27724
|
const {
|
|
27790
27725
|
columnVisibilityModel,
|
|
27791
27726
|
filterModel,
|
|
27792
27727
|
onColumnVisibilityModelChange,
|
|
27793
27728
|
onFilterModelChange,
|
|
27794
|
-
|
|
27795
|
-
onPageSizeChange,
|
|
27729
|
+
onPaginationModelChange,
|
|
27796
27730
|
onPinnedColumnsChange,
|
|
27797
27731
|
onSortModelChange,
|
|
27798
|
-
|
|
27799
|
-
pageSize,
|
|
27732
|
+
paginationModel,
|
|
27800
27733
|
pinnedColumns,
|
|
27801
27734
|
sortModel,
|
|
27802
27735
|
onColumnWidthChange
|
|
@@ -27807,39 +27740,38 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27807
27740
|
onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
|
|
27808
27741
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
27809
27742
|
onFilterModelChange: controlledOnFilterModelChange,
|
|
27810
|
-
|
|
27811
|
-
onPageSizeChange: controlledOnPageSizeChange,
|
|
27743
|
+
onPaginationModelChange: controlledOnPaginationModelChange,
|
|
27812
27744
|
onPinnedColumnsChange: controlledOnPinnedColumnsChange,
|
|
27813
27745
|
onSortModelChange: controlledOnSortModelChange,
|
|
27814
27746
|
useRouter: useRouter,
|
|
27815
27747
|
localStorageVersion
|
|
27816
27748
|
});
|
|
27817
|
-
const [
|
|
27749
|
+
const [rowSelectionModel, setRowSelectionModel] = useState(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
27818
27750
|
useEffect(() => {
|
|
27819
|
-
|
|
27820
|
-
}, [
|
|
27821
|
-
const
|
|
27822
|
-
if (
|
|
27823
|
-
|
|
27751
|
+
setRowSelectionModel(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
27752
|
+
}, [propsRowSelectionModel]);
|
|
27753
|
+
const onRowSelectionModelChange = (selectionModel, details) => {
|
|
27754
|
+
if (propsOnRowSelectionModelChange) {
|
|
27755
|
+
propsOnRowSelectionModelChange(selectionModel, details);
|
|
27824
27756
|
} else {
|
|
27825
|
-
|
|
27757
|
+
setRowSelectionModel(selectionModel);
|
|
27826
27758
|
}
|
|
27827
27759
|
};
|
|
27828
27760
|
const selectionStatus = useRef({
|
|
27829
27761
|
type: 'none',
|
|
27830
27762
|
numberOfSelectedRows: 0,
|
|
27831
27763
|
numberOfSelectedRowsInPage: 0,
|
|
27832
|
-
page,
|
|
27833
|
-
pageSize: pageSize
|
|
27764
|
+
page: paginationModel.page,
|
|
27765
|
+
pageSize: paginationModel.pageSize
|
|
27834
27766
|
});
|
|
27835
27767
|
|
|
27836
27768
|
// in server-side pagination we want to update the selection status
|
|
27837
27769
|
// every time we navigate between pages, resize our page or select something
|
|
27838
27770
|
useEffect(() => {
|
|
27839
27771
|
if (paginationMode == 'server') {
|
|
27840
|
-
onServerSideSelectionStatusChange(Array.isArray(
|
|
27772
|
+
onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatus, isRowSelectable, paginationModel.page, paginationModel.pageSize);
|
|
27841
27773
|
}
|
|
27842
|
-
}, [
|
|
27774
|
+
}, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
|
|
27843
27775
|
if (!Array.isArray(rows)) {
|
|
27844
27776
|
return null;
|
|
27845
27777
|
}
|
|
@@ -27872,15 +27804,13 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27872
27804
|
filterModel: filterModel,
|
|
27873
27805
|
onColumnVisibilityModelChange: onColumnVisibilityModelChange,
|
|
27874
27806
|
onFilterModelChange: onFilterModelChange,
|
|
27875
|
-
|
|
27876
|
-
onPageSizeChange: onPageSizeChange,
|
|
27807
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
27877
27808
|
onPinnedColumnsChange: onPinnedColumnsChange,
|
|
27878
27809
|
onSortModelChange: onSortModelChange,
|
|
27879
|
-
|
|
27880
|
-
pageSize: pageSize,
|
|
27810
|
+
paginationModel: paginationModel,
|
|
27881
27811
|
pinnedColumns: pinnedColumns,
|
|
27882
27812
|
sortModel: sortModel,
|
|
27883
|
-
|
|
27813
|
+
pageSizeOptions: pageSizeOptions,
|
|
27884
27814
|
onColumnWidthChange: onColumnWidthChange,
|
|
27885
27815
|
initialState: initialState,
|
|
27886
27816
|
isRowSelectable: isRowSelectable,
|
|
@@ -27891,58 +27821,55 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27891
27821
|
rowCount: rowCount,
|
|
27892
27822
|
autoHeight: autoHeight,
|
|
27893
27823
|
checkboxSelectionVisibleOnly: Boolean(pagination),
|
|
27894
|
-
|
|
27895
|
-
|
|
27896
|
-
|
|
27897
|
-
|
|
27898
|
-
|
|
27899
|
-
|
|
27900
|
-
ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27824
|
+
slots: _objectSpread2(_objectSpread2({
|
|
27825
|
+
baseButton: BaseButton,
|
|
27826
|
+
baseCheckbox: BaseCheckbox,
|
|
27827
|
+
// baseTextField,
|
|
27828
|
+
basePopper: BasePopper,
|
|
27829
|
+
columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27901
27830
|
displayName: "ColumnFilteredIcon"
|
|
27902
27831
|
})),
|
|
27903
|
-
|
|
27832
|
+
columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27904
27833
|
displayName: "ColumnSelectorIcon"
|
|
27905
27834
|
})),
|
|
27906
|
-
|
|
27835
|
+
columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27907
27836
|
displayName: "ColumnSortedAscendingIcon"
|
|
27908
27837
|
})),
|
|
27909
|
-
|
|
27838
|
+
columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27910
27839
|
displayName: "ColumnSortedDescendingIcon"
|
|
27911
27840
|
})),
|
|
27912
|
-
|
|
27841
|
+
densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27913
27842
|
displayName: "DensityCompactIcon"
|
|
27914
27843
|
})),
|
|
27915
|
-
|
|
27844
|
+
densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27916
27845
|
displayName: "DensityStandardIcon"
|
|
27917
27846
|
})),
|
|
27918
|
-
|
|
27847
|
+
densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27919
27848
|
displayName: "DensityComfortableIcon"
|
|
27920
27849
|
})),
|
|
27921
|
-
|
|
27850
|
+
detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27922
27851
|
displayName: "DetailPanelCollapseIcon"
|
|
27923
27852
|
})),
|
|
27924
|
-
|
|
27853
|
+
detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27925
27854
|
displayName: "DetailPanelExpandIcon"
|
|
27926
27855
|
})),
|
|
27927
|
-
|
|
27856
|
+
exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27928
27857
|
displayName: "ExportIcon"
|
|
27929
27858
|
})),
|
|
27930
|
-
|
|
27859
|
+
openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
|
|
27931
27860
|
displayName: "OpenFilterButtonIcon"
|
|
27932
27861
|
}, props))
|
|
27933
|
-
},
|
|
27934
|
-
|
|
27935
|
-
|
|
27862
|
+
}, slots), {}, {
|
|
27863
|
+
toolbar: ToolbarWrapper,
|
|
27864
|
+
pagination: props => {
|
|
27936
27865
|
return pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$1({}, props, {
|
|
27937
27866
|
displaySelection: false,
|
|
27938
27867
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
27939
27868
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
27940
27869
|
selectionStatus: selectionStatus.current,
|
|
27941
|
-
|
|
27942
|
-
|
|
27943
|
-
|
|
27944
|
-
onPageSizeChange: onPageSizeChange,
|
|
27945
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
27870
|
+
paginationModel: paginationModel,
|
|
27871
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
27872
|
+
pageSizeOptions: pageSizeOptions,
|
|
27946
27873
|
paginationProps: paginationProps,
|
|
27947
27874
|
paginationMode: paginationMode,
|
|
27948
27875
|
rowCount: rowCount
|
|
@@ -27953,17 +27880,15 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27953
27880
|
selectionStatus: selectionStatus.current,
|
|
27954
27881
|
apiRef: apiRef,
|
|
27955
27882
|
isRowSelectable: isRowSelectable,
|
|
27956
|
-
|
|
27957
|
-
|
|
27958
|
-
|
|
27959
|
-
onPageSizeChange: onPageSizeChange,
|
|
27960
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
27883
|
+
paginationModel: paginationModel,
|
|
27884
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
27885
|
+
pageSizeOptions: pageSizeOptions,
|
|
27961
27886
|
paginationProps: paginationProps,
|
|
27962
27887
|
paginationMode: paginationMode
|
|
27963
27888
|
})) : null;
|
|
27964
27889
|
}
|
|
27965
27890
|
}),
|
|
27966
|
-
|
|
27891
|
+
slotProps: _objectSpread2(_objectSpread2({}, slotProps), {}, {
|
|
27967
27892
|
toolbar: _objectSpread2({
|
|
27968
27893
|
hideToolbar,
|
|
27969
27894
|
RenderedToolbar,
|
|
@@ -27974,18 +27899,16 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27974
27899
|
selectionStatus,
|
|
27975
27900
|
apiRef,
|
|
27976
27901
|
isRowSelectable,
|
|
27977
|
-
|
|
27978
|
-
|
|
27979
|
-
|
|
27980
|
-
onPageSizeChange,
|
|
27981
|
-
rowsPerPageOptions,
|
|
27902
|
+
paginationModel,
|
|
27903
|
+
onPaginationModelChange,
|
|
27904
|
+
pageSizeOptions,
|
|
27982
27905
|
paginationProps,
|
|
27983
27906
|
paginationMode,
|
|
27984
27907
|
rowCount
|
|
27985
|
-
},
|
|
27908
|
+
}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar)
|
|
27986
27909
|
}),
|
|
27987
|
-
|
|
27988
|
-
|
|
27910
|
+
rowSelectionModel: rowSelectionModel,
|
|
27911
|
+
onRowSelectionModelChange: (newSelectionModel, details) => {
|
|
27989
27912
|
if (pagination && paginationMode != 'server') {
|
|
27990
27913
|
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
|
|
27991
27914
|
let {
|
|
@@ -28043,7 +27966,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
28043
27966
|
};
|
|
28044
27967
|
}
|
|
28045
27968
|
}
|
|
28046
|
-
|
|
27969
|
+
onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
|
|
28047
27970
|
},
|
|
28048
27971
|
sx: _objectSpread2(_objectSpread2({}, sx), {}, {
|
|
28049
27972
|
'.MuiDataGrid-columnHeaders': {
|
|
@@ -28117,5 +28040,5 @@ const TextCell = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
28117
28040
|
TextCell.className = CLASSNAME;
|
|
28118
28041
|
TextCell.displayName = COMPONENT_NAME;
|
|
28119
28042
|
|
|
28120
|
-
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 };
|
|
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, isOperatorValueValid, isValueValid, muiIconToDSIcon, numberOperatorDecoder, numberOperatorEncoder, onServerSideSelectionStatusChange, operatorList, updateUrl, urlSearchParamsToString };
|
|
28121
28044
|
//# sourceMappingURL=index.js.map
|