@redsift/table 11.2.2-muiv5-patch.0 → 11.2.2-patch.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +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
|
|
|
@@ -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'
|
|
@@ -18358,11 +18356,11 @@ const getPaginationModel = (search, localStoragePagination, setLocalStoragePagin
|
|
|
18358
18356
|
|
|
18359
18357
|
const getSearchParamsFromColumnVisibility = (columnVisibility, columns) => {
|
|
18360
18358
|
const searchParams = new URLSearchParams();
|
|
18361
|
-
const
|
|
18359
|
+
const fields = columns.map(column => column.field);
|
|
18362
18360
|
|
|
18363
18361
|
// if column visibility model is empty, show all columns
|
|
18364
18362
|
if (Object.keys(columnVisibility).length == 0) {
|
|
18365
|
-
searchParams.set('_columnVisibility', `[${
|
|
18363
|
+
searchParams.set('_columnVisibility', `[${fields.join(',')}]`);
|
|
18366
18364
|
return searchParams;
|
|
18367
18365
|
}
|
|
18368
18366
|
const finalColumnVisibility = columns.filter(c => {
|
|
@@ -18412,12 +18410,12 @@ const getColumnVisibilityFromString = (notParsed, tableColumns) => {
|
|
|
18412
18410
|
continue;
|
|
18413
18411
|
}
|
|
18414
18412
|
exist = true;
|
|
18415
|
-
const
|
|
18413
|
+
const fields = tableColumns.map(column => column.field);
|
|
18416
18414
|
// TODO: Add validation that , is present
|
|
18417
18415
|
const columns = encodedValues.split(',').map(value => decodeValue(value));
|
|
18418
18416
|
|
|
18419
18417
|
// for each column, check if it's visible and add it to visibility model
|
|
18420
|
-
for (const column of
|
|
18418
|
+
for (const column of fields) {
|
|
18421
18419
|
const isColumnVisible = columns.includes(column);
|
|
18422
18420
|
visibility[column] = isColumnVisible;
|
|
18423
18421
|
if (isColumnVisible) {
|
|
@@ -18484,8 +18482,8 @@ const getPinnedColumnsFromString = (notParsed, tableColumns) => {
|
|
|
18484
18482
|
if (typeof encodedValues !== 'string') {
|
|
18485
18483
|
continue;
|
|
18486
18484
|
}
|
|
18487
|
-
const
|
|
18488
|
-
const columns = encodedValues.split(',').map(value => decodeValue(value)).filter(val => typeof val === 'string' &&
|
|
18485
|
+
const fields = [...tableColumns.map(column => column.field), '__check__'];
|
|
18486
|
+
const columns = encodedValues.split(',').map(value => decodeValue(value)).filter(val => typeof val === 'string' && fields.includes(val));
|
|
18489
18487
|
if (fieldURL === '_pinnedColumnsLeft') {
|
|
18490
18488
|
pinnedColumns['left'] = columns;
|
|
18491
18489
|
}
|
|
@@ -18638,17 +18636,17 @@ const updateUrl = (_ref4, search, historyReplace, columns) => {
|
|
|
18638
18636
|
// do not use it for equivalence (e.g. with value `3` and undefined we
|
|
18639
18637
|
// will get 0).
|
|
18640
18638
|
const compareFilters = (firstFilter, secondFilter) => {
|
|
18641
|
-
if (firstFilter.
|
|
18639
|
+
if (firstFilter.field < secondFilter.field) {
|
|
18642
18640
|
return -1;
|
|
18643
|
-
} else if (firstFilter.
|
|
18641
|
+
} else if (firstFilter.field > secondFilter.field) {
|
|
18644
18642
|
return 1;
|
|
18645
18643
|
}
|
|
18646
|
-
if (firstFilter.
|
|
18644
|
+
if (firstFilter.operator === undefined || secondFilter.operator === undefined) {
|
|
18647
18645
|
return 0;
|
|
18648
18646
|
}
|
|
18649
|
-
if (firstFilter.
|
|
18647
|
+
if (firstFilter.operator < secondFilter.operator) {
|
|
18650
18648
|
return -1;
|
|
18651
|
-
} else if (firstFilter.
|
|
18649
|
+
} else if (firstFilter.operator > secondFilter.operator) {
|
|
18652
18650
|
return 1;
|
|
18653
18651
|
}
|
|
18654
18652
|
if (firstFilter.value < secondFilter.value) {
|
|
@@ -18659,18 +18657,18 @@ const compareFilters = (firstFilter, secondFilter) => {
|
|
|
18659
18657
|
return 0;
|
|
18660
18658
|
};
|
|
18661
18659
|
const areFiltersEquivalent = (firstFilter, secondFilter) => {
|
|
18662
|
-
return firstFilter.
|
|
18660
|
+
return firstFilter.field === secondFilter.field && firstFilter.operator === secondFilter.operator && firstFilter.value === secondFilter.value;
|
|
18663
18661
|
};
|
|
18664
18662
|
const areFilterModelsEquivalent = (filterModel, filterModelToMatch) => {
|
|
18665
18663
|
const {
|
|
18666
18664
|
items,
|
|
18667
|
-
|
|
18665
|
+
logicOperator
|
|
18668
18666
|
} = filterModel;
|
|
18669
18667
|
const {
|
|
18670
18668
|
items: itemsToMatch,
|
|
18671
|
-
|
|
18669
|
+
logicOperator: logicOperatorToMatch
|
|
18672
18670
|
} = filterModelToMatch;
|
|
18673
|
-
if (
|
|
18671
|
+
if (logicOperator !== logicOperatorToMatch) {
|
|
18674
18672
|
return false;
|
|
18675
18673
|
}
|
|
18676
18674
|
if (items.length !== itemsToMatch.length) {
|
|
@@ -18683,7 +18681,7 @@ const areFilterModelsEquivalent = (filterModel, filterModelToMatch) => {
|
|
|
18683
18681
|
const filterToCompare = itemsToMatch[i];
|
|
18684
18682
|
|
|
18685
18683
|
// compareFilters return 0 if and only if the filters have the same
|
|
18686
|
-
//
|
|
18684
|
+
// field, operator, and value
|
|
18687
18685
|
if (!areFiltersEquivalent(filter, filterToCompare)) {
|
|
18688
18686
|
return false;
|
|
18689
18687
|
}
|
|
@@ -24494,16 +24492,16 @@ const getRole = (config, dateFormat) => {
|
|
|
24494
24492
|
}).join('\n');
|
|
24495
24493
|
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.
|
|
24496
24494
|
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.
|
|
24497
|
-
The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "
|
|
24498
|
-
- "
|
|
24499
|
-
- "items": a list of conditions, each is an object with exactly the three keys "
|
|
24500
|
-
- "
|
|
24495
|
+
The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "logicOperator" and "items":
|
|
24496
|
+
- "logicOperator": the logical operator, only "and" or "or" are allowed. If there is only one condition in the "items", use "and".
|
|
24497
|
+
- "items": a list of conditions, each is an object with exactly the three keys "field", "operator" and "value":
|
|
24498
|
+
- "field": the column name, must be one of ${columns}
|
|
24501
24499
|
- "value":
|
|
24502
|
-
- this can be skipped if the "
|
|
24503
|
-
- a list of multiple values if the "
|
|
24500
|
+
- this can be skipped if the "operator" is either "isEmpty" or "isNotEmpty"
|
|
24501
|
+
- a list of multiple values if the "operator" ends with "AnyOf"
|
|
24504
24502
|
- otherwise, it's a single value represented as a string: "true" instead of true, "false" instead of false, "0.6" instead of 0.6.
|
|
24505
24503
|
For "date" data type, use ${dateFormat}. If relative date is input, convert to the actual date given today is ${today}.
|
|
24506
|
-
- "
|
|
24504
|
+
- "operator": the comparison operator, accepted values depend on the data type of the column
|
|
24507
24505
|
${operators}
|
|
24508
24506
|
|
|
24509
24507
|
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:
|
|
@@ -24540,10 +24538,10 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24540
24538
|
nlpFilterConfig,
|
|
24541
24539
|
onFilterModelChange,
|
|
24542
24540
|
dateFormat = 'yyyy-mm-dd',
|
|
24543
|
-
defaultModel = 'gpt-4-
|
|
24541
|
+
defaultModel = 'gpt-4-1106-preview',
|
|
24544
24542
|
defaultFilter = {
|
|
24545
24543
|
items: [],
|
|
24546
|
-
|
|
24544
|
+
logicOperator: 'and'
|
|
24547
24545
|
},
|
|
24548
24546
|
disablePower = false,
|
|
24549
24547
|
localeText
|
|
@@ -24621,7 +24619,7 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24621
24619
|
value: prompt
|
|
24622
24620
|
}), /*#__PURE__*/React__default.createElement(Button, {
|
|
24623
24621
|
variant: "primary",
|
|
24624
|
-
"
|
|
24622
|
+
"aria-label": buttonAriaLabel,
|
|
24625
24623
|
type: "submit",
|
|
24626
24624
|
isLoading: isLoading
|
|
24627
24625
|
}, buttonText)), !disablePower && /*#__PURE__*/React__default.createElement(Tooltip, null, /*#__PURE__*/React__default.createElement(Tooltip.Trigger, null, /*#__PURE__*/React__default.createElement(Switch, {
|
|
@@ -24682,7 +24680,7 @@ const Toolbar$2 = props => {
|
|
|
24682
24680
|
let {
|
|
24683
24681
|
apiRef
|
|
24684
24682
|
} = _ref;
|
|
24685
|
-
return
|
|
24683
|
+
return gridExpandedSortedRowIdsSelector(apiRef);
|
|
24686
24684
|
}
|
|
24687
24685
|
},
|
|
24688
24686
|
printOptions: {
|
|
@@ -26914,12 +26912,10 @@ const ServerSideControlledPagination = _ref3 => {
|
|
|
26914
26912
|
selectionStatus,
|
|
26915
26913
|
displaySelection,
|
|
26916
26914
|
displayPagination,
|
|
26917
|
-
|
|
26918
|
-
|
|
26919
|
-
|
|
26920
|
-
onPageSizeChange,
|
|
26915
|
+
paginationModel,
|
|
26916
|
+
onPaginationModelChange,
|
|
26917
|
+
pageSizeOptions,
|
|
26921
26918
|
displayRowsPerPage,
|
|
26922
|
-
rowsPerPageOptions,
|
|
26923
26919
|
paginationProps,
|
|
26924
26920
|
rowCount
|
|
26925
26921
|
} = _ref3;
|
|
@@ -26938,13 +26934,17 @@ const ServerSideControlledPagination = _ref3 => {
|
|
|
26938
26934
|
}, totalRowsLabel) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$1({
|
|
26939
26935
|
component: "div",
|
|
26940
26936
|
count: totalNumberOfRowsInTable,
|
|
26941
|
-
page: page,
|
|
26942
|
-
onPageChange: (event,
|
|
26943
|
-
|
|
26944
|
-
|
|
26945
|
-
|
|
26946
|
-
|
|
26947
|
-
|
|
26937
|
+
page: paginationModel.page,
|
|
26938
|
+
onPageChange: (event, page) => onPaginationModelChange({
|
|
26939
|
+
page,
|
|
26940
|
+
pageSize: paginationModel.pageSize
|
|
26941
|
+
}),
|
|
26942
|
+
rowsPerPage: paginationModel.pageSize,
|
|
26943
|
+
onRowsPerPageChange: event => onPaginationModelChange({
|
|
26944
|
+
page: paginationModel.page,
|
|
26945
|
+
pageSize: parseInt(event.target.value, 10)
|
|
26946
|
+
}),
|
|
26947
|
+
rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
|
|
26948
26948
|
}, paginationProps)) : null);
|
|
26949
26949
|
};
|
|
26950
26950
|
|
|
@@ -26970,11 +26970,9 @@ const ControlledPagination = _ref3 => {
|
|
|
26970
26970
|
displayPagination = false,
|
|
26971
26971
|
selectionStatus,
|
|
26972
26972
|
apiRef,
|
|
26973
|
-
|
|
26974
|
-
|
|
26975
|
-
|
|
26976
|
-
onPageSizeChange,
|
|
26977
|
-
rowsPerPageOptions,
|
|
26973
|
+
paginationModel,
|
|
26974
|
+
onPaginationModelChange,
|
|
26975
|
+
pageSizeOptions,
|
|
26978
26976
|
isRowSelectable,
|
|
26979
26977
|
paginationProps
|
|
26980
26978
|
} = _ref3;
|
|
@@ -27004,17 +27002,25 @@ const ControlledPagination = _ref3 => {
|
|
|
27004
27002
|
}, `${selectionStatus.numberOfSelectedRows} row${selectionStatus.numberOfSelectedRows > 1 ? 's' : ''} selected`) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$1({
|
|
27005
27003
|
component: "div",
|
|
27006
27004
|
count: numberOfFilteredRowsInTable,
|
|
27007
|
-
page: page,
|
|
27008
|
-
onPageChange: (event,
|
|
27009
|
-
|
|
27005
|
+
page: paginationModel.page,
|
|
27006
|
+
onPageChange: (event, page) => {
|
|
27007
|
+
onPaginationModelChange({
|
|
27008
|
+
page,
|
|
27009
|
+
pageSize: paginationModel.pageSize
|
|
27010
|
+
});
|
|
27011
|
+
},
|
|
27012
|
+
rowsPerPage: paginationModel.pageSize,
|
|
27010
27013
|
onRowsPerPageChange: event => {
|
|
27011
|
-
|
|
27014
|
+
onPaginationModelChange({
|
|
27015
|
+
page: paginationModel.page,
|
|
27016
|
+
pageSize: parseInt(event.target.value, 10)
|
|
27017
|
+
});
|
|
27012
27018
|
},
|
|
27013
|
-
rowsPerPageOptions: displayRowsPerPage ?
|
|
27019
|
+
rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
|
|
27014
27020
|
}, paginationProps)) : null);
|
|
27015
27021
|
};
|
|
27016
27022
|
|
|
27017
|
-
const _excluded$3 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "
|
|
27023
|
+
const _excluded$3 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "paginationModel", "onPaginationModelChange", "pageSizeOptions", "paginationProps", "paginationMode", "rowCount"];
|
|
27018
27024
|
const ToolbarWrapper = _ref => {
|
|
27019
27025
|
let {
|
|
27020
27026
|
hideToolbar,
|
|
@@ -27026,11 +27032,9 @@ const ToolbarWrapper = _ref => {
|
|
|
27026
27032
|
selectionStatus,
|
|
27027
27033
|
apiRef,
|
|
27028
27034
|
isRowSelectable,
|
|
27029
|
-
|
|
27030
|
-
|
|
27031
|
-
|
|
27032
|
-
onPageSizeChange,
|
|
27033
|
-
rowsPerPageOptions,
|
|
27035
|
+
paginationModel,
|
|
27036
|
+
onPaginationModelChange,
|
|
27037
|
+
pageSizeOptions,
|
|
27034
27038
|
paginationProps,
|
|
27035
27039
|
paginationMode = 'client',
|
|
27036
27040
|
rowCount
|
|
@@ -27044,11 +27048,9 @@ const ToolbarWrapper = _ref => {
|
|
|
27044
27048
|
displayRowsPerPage: false,
|
|
27045
27049
|
displayPagination: ['top', 'both'].includes(paginationPlacement),
|
|
27046
27050
|
selectionStatus: selectionStatus.current,
|
|
27047
|
-
|
|
27048
|
-
|
|
27049
|
-
|
|
27050
|
-
onPageSizeChange: onPageSizeChange,
|
|
27051
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
27051
|
+
paginationModel: paginationModel,
|
|
27052
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
27053
|
+
pageSizeOptions: pageSizeOptions,
|
|
27052
27054
|
paginationProps: paginationProps,
|
|
27053
27055
|
rowCount: rowCount
|
|
27054
27056
|
}) : /*#__PURE__*/React__default.createElement(ControlledPagination, {
|
|
@@ -27058,30 +27060,26 @@ const ToolbarWrapper = _ref => {
|
|
|
27058
27060
|
selectionStatus: selectionStatus.current,
|
|
27059
27061
|
apiRef: apiRef,
|
|
27060
27062
|
isRowSelectable: isRowSelectable,
|
|
27061
|
-
|
|
27062
|
-
|
|
27063
|
-
|
|
27064
|
-
onPageSizeChange: onPageSizeChange,
|
|
27065
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
27063
|
+
paginationModel: paginationModel,
|
|
27064
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
27065
|
+
pageSizeOptions: pageSizeOptions,
|
|
27066
27066
|
paginationProps: paginationProps
|
|
27067
27067
|
}) : null);
|
|
27068
27068
|
};
|
|
27069
27069
|
|
|
27070
27070
|
const useControlledDatagridState = _ref => {
|
|
27071
|
-
var _initialState$paginat, _initialState$paginat2;
|
|
27071
|
+
var _ref2, _ref3, _propsPaginationModel, _initialState$paginat, _initialState$paginat2, _pageSizeOptions$, _ref4, _propsPaginationModel2, _initialState$paginat3, _initialState$paginat4;
|
|
27072
27072
|
let {
|
|
27073
27073
|
initialState,
|
|
27074
|
-
|
|
27074
|
+
pageSizeOptions,
|
|
27075
27075
|
propsColumnVisibilityModel,
|
|
27076
27076
|
propsFilterModel,
|
|
27077
27077
|
propsOnColumnVisibilityModelChange,
|
|
27078
27078
|
propsOnFilterModelChange,
|
|
27079
|
-
|
|
27080
|
-
propsOnPageSizeChange,
|
|
27079
|
+
propsOnPaginationModelChange,
|
|
27081
27080
|
propsOnPinnedColumnsChange,
|
|
27082
27081
|
propsOnSortModelChange,
|
|
27083
|
-
|
|
27084
|
-
propsPageSize,
|
|
27082
|
+
propsPaginationModel,
|
|
27085
27083
|
propsPinnedColumns,
|
|
27086
27084
|
propsSortModel
|
|
27087
27085
|
} = _ref;
|
|
@@ -27129,33 +27127,22 @@ const useControlledDatagridState = _ref => {
|
|
|
27129
27127
|
setSortModel(model);
|
|
27130
27128
|
}
|
|
27131
27129
|
};
|
|
27132
|
-
const [
|
|
27133
|
-
|
|
27134
|
-
|
|
27135
|
-
|
|
27136
|
-
|
|
27137
|
-
|
|
27138
|
-
|
|
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);
|
|
27130
|
+
const [paginationModel, setPaginationModel] = useState({
|
|
27131
|
+
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,
|
|
27132
|
+
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
|
|
27133
|
+
});
|
|
27134
|
+
const onPaginationModelChange = (model, details) => {
|
|
27135
|
+
if (propsOnPaginationModelChange) {
|
|
27136
|
+
propsOnPaginationModelChange(model, details);
|
|
27150
27137
|
} else {
|
|
27151
|
-
|
|
27138
|
+
setPaginationModel(model);
|
|
27152
27139
|
}
|
|
27153
27140
|
};
|
|
27154
27141
|
useEffect(() => {
|
|
27155
|
-
if (
|
|
27156
|
-
|
|
27142
|
+
if (propsPaginationModel) {
|
|
27143
|
+
setPaginationModel(propsPaginationModel);
|
|
27157
27144
|
}
|
|
27158
|
-
}, [
|
|
27145
|
+
}, [propsPaginationModel]);
|
|
27159
27146
|
return {
|
|
27160
27147
|
filterModel,
|
|
27161
27148
|
onFilterModelChange,
|
|
@@ -27165,14 +27152,12 @@ const useControlledDatagridState = _ref => {
|
|
|
27165
27152
|
onPinnedColumnsChange,
|
|
27166
27153
|
sortModel,
|
|
27167
27154
|
onSortModelChange,
|
|
27168
|
-
|
|
27169
|
-
|
|
27170
|
-
onPageChange,
|
|
27171
|
-
onPageSizeChange
|
|
27155
|
+
paginationModel,
|
|
27156
|
+
onPaginationModelChange
|
|
27172
27157
|
};
|
|
27173
27158
|
};
|
|
27174
27159
|
|
|
27175
|
-
const _excluded$2 = ["apiRef", "autoHeight", "className", "
|
|
27160
|
+
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"];
|
|
27176
27161
|
const COMPONENT_NAME$2 = 'DataGrid';
|
|
27177
27162
|
const CLASSNAME$2 = 'redsift-datagrid';
|
|
27178
27163
|
const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
@@ -27181,33 +27166,30 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27181
27166
|
apiRef: propsApiRef,
|
|
27182
27167
|
autoHeight,
|
|
27183
27168
|
className,
|
|
27184
|
-
|
|
27185
|
-
|
|
27186
|
-
componentsProps,
|
|
27169
|
+
slots,
|
|
27170
|
+
slotProps,
|
|
27187
27171
|
filterModel: propsFilterModel,
|
|
27188
27172
|
columnVisibilityModel: propsColumnVisibilityModel,
|
|
27189
27173
|
pinnedColumns: propsPinnedColumns,
|
|
27190
27174
|
sortModel: propsSortModel,
|
|
27175
|
+
paginationModel: propsPaginationModel,
|
|
27191
27176
|
height: propsHeight,
|
|
27192
27177
|
hideToolbar,
|
|
27193
27178
|
initialState,
|
|
27194
27179
|
isRowSelectable,
|
|
27195
27180
|
license = process.env.MUI_LICENSE_KEY,
|
|
27196
27181
|
onFilterModelChange: propsOnFilterModelChange,
|
|
27197
|
-
|
|
27198
|
-
|
|
27182
|
+
rowSelectionModel: propsRowSelectionModel,
|
|
27183
|
+
onPaginationModelChange: propsOnPaginationModelChange,
|
|
27184
|
+
onRowSelectionModelChange: propsOnRowSelectionModelChange,
|
|
27199
27185
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
27200
27186
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
27201
27187
|
onSortModelChange: propsOnSortModelChange,
|
|
27202
|
-
selectionModel: propsSelectionModel,
|
|
27203
|
-
onSelectionModelChange: propsOnSelectionModelChange,
|
|
27204
|
-
page: propsPage,
|
|
27205
|
-
pageSize: propsPageSize,
|
|
27206
27188
|
pagination,
|
|
27207
27189
|
paginationPlacement = 'both',
|
|
27208
27190
|
paginationProps,
|
|
27209
27191
|
rows,
|
|
27210
|
-
|
|
27192
|
+
pageSizeOptions,
|
|
27211
27193
|
sx,
|
|
27212
27194
|
theme: propsTheme,
|
|
27213
27195
|
paginationMode = 'client',
|
|
@@ -27217,7 +27199,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27217
27199
|
const theme = useTheme$4(propsTheme);
|
|
27218
27200
|
const _apiRef = useGridApiRef();
|
|
27219
27201
|
const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
|
|
27220
|
-
const RenderedToolbar =
|
|
27202
|
+
const RenderedToolbar = slots !== null && slots !== void 0 && slots.toolbar ? slots.toolbar : Toolbar$2;
|
|
27221
27203
|
LicenseInfo.setLicenseKey(license);
|
|
27222
27204
|
const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
|
|
27223
27205
|
const {
|
|
@@ -27225,56 +27207,52 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27225
27207
|
filterModel,
|
|
27226
27208
|
onColumnVisibilityModelChange,
|
|
27227
27209
|
onFilterModelChange,
|
|
27228
|
-
|
|
27229
|
-
onPageSizeChange,
|
|
27210
|
+
onPaginationModelChange,
|
|
27230
27211
|
onPinnedColumnsChange,
|
|
27231
27212
|
onSortModelChange,
|
|
27232
|
-
|
|
27233
|
-
pageSize,
|
|
27213
|
+
paginationModel,
|
|
27234
27214
|
pinnedColumns,
|
|
27235
27215
|
sortModel
|
|
27236
27216
|
} = useControlledDatagridState({
|
|
27237
27217
|
initialState,
|
|
27238
|
-
|
|
27218
|
+
pageSizeOptions,
|
|
27239
27219
|
propsColumnVisibilityModel,
|
|
27240
27220
|
propsFilterModel,
|
|
27241
27221
|
propsOnColumnVisibilityModelChange,
|
|
27242
27222
|
propsOnFilterModelChange,
|
|
27243
27223
|
propsOnPinnedColumnsChange,
|
|
27244
27224
|
propsOnSortModelChange,
|
|
27245
|
-
|
|
27246
|
-
propsPageSize,
|
|
27225
|
+
propsPaginationModel,
|
|
27247
27226
|
propsPinnedColumns,
|
|
27248
27227
|
propsSortModel,
|
|
27249
|
-
|
|
27250
|
-
propsOnPageSizeChange
|
|
27228
|
+
propsOnPaginationModelChange
|
|
27251
27229
|
});
|
|
27252
|
-
const [
|
|
27230
|
+
const [rowSelectionModel, setRowSelectionModel] = useState(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
27253
27231
|
useEffect(() => {
|
|
27254
|
-
|
|
27255
|
-
}, [
|
|
27256
|
-
const
|
|
27257
|
-
if (
|
|
27258
|
-
|
|
27232
|
+
setRowSelectionModel(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
27233
|
+
}, [propsRowSelectionModel]);
|
|
27234
|
+
const onRowSelectionModelChange = (selectionModel, details) => {
|
|
27235
|
+
if (propsOnRowSelectionModelChange) {
|
|
27236
|
+
propsOnRowSelectionModelChange(selectionModel, details);
|
|
27259
27237
|
} else {
|
|
27260
|
-
|
|
27238
|
+
setRowSelectionModel(selectionModel);
|
|
27261
27239
|
}
|
|
27262
27240
|
};
|
|
27263
27241
|
const selectionStatus = useRef({
|
|
27264
27242
|
type: 'none',
|
|
27265
27243
|
numberOfSelectedRows: 0,
|
|
27266
27244
|
numberOfSelectedRowsInPage: 0,
|
|
27267
|
-
page,
|
|
27268
|
-
pageSize
|
|
27245
|
+
page: paginationModel.page,
|
|
27246
|
+
pageSize: paginationModel.pageSize
|
|
27269
27247
|
});
|
|
27270
27248
|
|
|
27271
27249
|
// in server-side pagination we want to update the selection status
|
|
27272
27250
|
// every time we navigate between pages, resize our page or select something
|
|
27273
27251
|
useEffect(() => {
|
|
27274
27252
|
if (paginationMode == 'server') {
|
|
27275
|
-
onServerSideSelectionStatusChange(Array.isArray(
|
|
27253
|
+
onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatus, isRowSelectable, paginationModel.page, paginationModel.pageSize);
|
|
27276
27254
|
}
|
|
27277
|
-
}, [
|
|
27255
|
+
}, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
|
|
27278
27256
|
if (!Array.isArray(rows)) {
|
|
27279
27257
|
return null;
|
|
27280
27258
|
}
|
|
@@ -27305,57 +27283,54 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27305
27283
|
apiRef: apiRef,
|
|
27306
27284
|
autoHeight: autoHeight,
|
|
27307
27285
|
checkboxSelectionVisibleOnly: Boolean(pagination),
|
|
27308
|
-
|
|
27309
|
-
|
|
27310
|
-
|
|
27311
|
-
|
|
27312
|
-
|
|
27313
|
-
|
|
27314
|
-
ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27286
|
+
slots: _objectSpread2(_objectSpread2({
|
|
27287
|
+
baseButton: BaseButton,
|
|
27288
|
+
baseCheckbox: BaseCheckbox,
|
|
27289
|
+
// baseTextField,
|
|
27290
|
+
basePopper: BasePopper,
|
|
27291
|
+
columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27315
27292
|
displayName: "ColumnFilteredIcon"
|
|
27316
27293
|
})),
|
|
27317
|
-
|
|
27294
|
+
columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27318
27295
|
displayName: "ColumnSelectorIcon"
|
|
27319
27296
|
})),
|
|
27320
|
-
|
|
27297
|
+
columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27321
27298
|
displayName: "ColumnSortedAscendingIcon"
|
|
27322
27299
|
})),
|
|
27323
|
-
|
|
27300
|
+
columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27324
27301
|
displayName: "ColumnSortedDescendingIcon"
|
|
27325
27302
|
})),
|
|
27326
|
-
|
|
27303
|
+
densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27327
27304
|
displayName: "DensityCompactIcon"
|
|
27328
27305
|
})),
|
|
27329
|
-
|
|
27306
|
+
densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27330
27307
|
displayName: "DensityStandardIcon"
|
|
27331
27308
|
})),
|
|
27332
|
-
|
|
27309
|
+
densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27333
27310
|
displayName: "DensityComfortableIcon"
|
|
27334
27311
|
})),
|
|
27335
|
-
|
|
27312
|
+
detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27336
27313
|
displayName: "DetailPanelCollapseIcon"
|
|
27337
27314
|
})),
|
|
27338
|
-
|
|
27315
|
+
detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27339
27316
|
displayName: "DetailPanelExpandIcon"
|
|
27340
27317
|
})),
|
|
27341
|
-
|
|
27318
|
+
exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27342
27319
|
displayName: "ExportIcon"
|
|
27343
27320
|
})),
|
|
27344
|
-
|
|
27321
|
+
openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
|
|
27345
27322
|
displayName: "OpenFilterButtonIcon"
|
|
27346
27323
|
}, props))
|
|
27347
|
-
},
|
|
27348
|
-
|
|
27349
|
-
|
|
27324
|
+
}, slots), {}, {
|
|
27325
|
+
toolbar: ToolbarWrapper,
|
|
27326
|
+
pagination: props => pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$1({}, props, {
|
|
27350
27327
|
displaySelection: false,
|
|
27351
27328
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
27352
27329
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
27353
27330
|
selectionStatus: selectionStatus.current,
|
|
27354
|
-
|
|
27355
|
-
|
|
27356
|
-
|
|
27357
|
-
onPageSizeChange: onPageSizeChange,
|
|
27358
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
27331
|
+
paginationModel: paginationModel,
|
|
27332
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
27333
|
+
pageSizeOptions: pageSizeOptions,
|
|
27359
27334
|
paginationProps: paginationProps,
|
|
27360
27335
|
paginationMode: paginationMode,
|
|
27361
27336
|
rowCount: rowCount
|
|
@@ -27366,16 +27341,14 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27366
27341
|
selectionStatus: selectionStatus.current,
|
|
27367
27342
|
apiRef: apiRef,
|
|
27368
27343
|
isRowSelectable: isRowSelectable,
|
|
27369
|
-
|
|
27370
|
-
|
|
27371
|
-
|
|
27372
|
-
onPageSizeChange: onPageSizeChange,
|
|
27373
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
27344
|
+
paginationModel: paginationModel,
|
|
27345
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
27346
|
+
pageSizeOptions: pageSizeOptions,
|
|
27374
27347
|
paginationProps: paginationProps,
|
|
27375
27348
|
paginationMode: paginationMode
|
|
27376
27349
|
})) : null
|
|
27377
27350
|
}),
|
|
27378
|
-
|
|
27351
|
+
slotProps: _objectSpread2(_objectSpread2({}, slotProps), {}, {
|
|
27379
27352
|
toolbar: _objectSpread2({
|
|
27380
27353
|
hideToolbar,
|
|
27381
27354
|
RenderedToolbar,
|
|
@@ -27386,15 +27359,13 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27386
27359
|
selectionStatus,
|
|
27387
27360
|
apiRef,
|
|
27388
27361
|
isRowSelectable,
|
|
27389
|
-
|
|
27390
|
-
|
|
27391
|
-
|
|
27392
|
-
onPageSizeChange,
|
|
27393
|
-
rowsPerPageOptions,
|
|
27362
|
+
paginationModel,
|
|
27363
|
+
onPaginationModelChange,
|
|
27364
|
+
pageSizeOptions,
|
|
27394
27365
|
paginationProps,
|
|
27395
27366
|
paginationMode,
|
|
27396
27367
|
rowCount
|
|
27397
|
-
},
|
|
27368
|
+
}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar)
|
|
27398
27369
|
}),
|
|
27399
27370
|
filterModel: filterModel,
|
|
27400
27371
|
columnVisibilityModel: columnVisibilityModel,
|
|
@@ -27410,13 +27381,11 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27410
27381
|
paginationMode: paginationMode,
|
|
27411
27382
|
keepNonExistentRowsSelected: paginationMode == 'server',
|
|
27412
27383
|
rows: rows,
|
|
27413
|
-
|
|
27414
|
-
|
|
27415
|
-
|
|
27416
|
-
|
|
27417
|
-
|
|
27418
|
-
selectionModel: selectionModel,
|
|
27419
|
-
onSelectionModelChange: (newSelectionModel, details) => {
|
|
27384
|
+
pageSizeOptions: pageSizeOptions,
|
|
27385
|
+
paginationModel: paginationModel,
|
|
27386
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
27387
|
+
rowSelectionModel: rowSelectionModel,
|
|
27388
|
+
onRowSelectionModelChange: (newSelectionModel, details) => {
|
|
27420
27389
|
if (pagination && paginationMode != 'server') {
|
|
27421
27390
|
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
|
|
27422
27391
|
let {
|
|
@@ -27474,7 +27443,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27474
27443
|
};
|
|
27475
27444
|
}
|
|
27476
27445
|
}
|
|
27477
|
-
|
|
27446
|
+
onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
|
|
27478
27447
|
},
|
|
27479
27448
|
sx: _objectSpread2(_objectSpread2({}, sx), {}, {
|
|
27480
27449
|
'.MuiDataGrid-columnHeaders': {
|
|
@@ -27491,8 +27460,6 @@ DataGrid.className = CLASSNAME$2;
|
|
|
27491
27460
|
DataGrid.displayName = COMPONENT_NAME$2;
|
|
27492
27461
|
|
|
27493
27462
|
// Get and Set data from LocalStorage WITHOUT useState
|
|
27494
|
-
|
|
27495
|
-
// triggering a state update and consecutive re-render
|
|
27496
27463
|
const useFetchState = (defaultValue, key) => {
|
|
27497
27464
|
let stickyValue = null;
|
|
27498
27465
|
try {
|
|
@@ -27500,16 +27467,7 @@ const useFetchState = (defaultValue, key) => {
|
|
|
27500
27467
|
} catch (e) {
|
|
27501
27468
|
console.error('StatefulDataGrid: error getting item from local storage: ', e);
|
|
27502
27469
|
}
|
|
27503
|
-
|
|
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
|
+
const parsedValue = stickyValue !== null && stickyValue !== undefined && stickyValue !== 'undefined' ? JSON.parse(stickyValue) : defaultValue;
|
|
27513
27471
|
const updateValue = useCallback(value => {
|
|
27514
27472
|
try {
|
|
27515
27473
|
window.localStorage.setItem(key, JSON.stringify(value));
|
|
@@ -27520,6 +27478,8 @@ const useFetchState = (defaultValue, key) => {
|
|
|
27520
27478
|
return [parsedValue, updateValue];
|
|
27521
27479
|
};
|
|
27522
27480
|
|
|
27481
|
+
// import useLocalStorage from './useLocalStorage';
|
|
27482
|
+
|
|
27523
27483
|
const useTableStates = (id, version) => {
|
|
27524
27484
|
const [paginationModel, setPaginationModel] = useFetchState('', buildStorageKey({
|
|
27525
27485
|
id,
|
|
@@ -27576,8 +27536,7 @@ const useStatefulTable = props => {
|
|
|
27576
27536
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
27577
27537
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
27578
27538
|
onFilterModelChange: propsOnFilterModelChange,
|
|
27579
|
-
|
|
27580
|
-
onPageSizeChange: propsOnPageSizeChange,
|
|
27539
|
+
onPaginationModelChange: propsOnPaginationModelChange,
|
|
27581
27540
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
27582
27541
|
onSortModelChange: propsOnSortModelChange,
|
|
27583
27542
|
useRouter,
|
|
@@ -27639,7 +27598,6 @@ const useStatefulTable = props => {
|
|
|
27639
27598
|
column.width = dimensionModel[column.field] || column.width || 100;
|
|
27640
27599
|
return column;
|
|
27641
27600
|
}), [propsColumns, dimensionModel]);
|
|
27642
|
-
|
|
27643
27601
|
/** Add resetPage method to apiRef. */
|
|
27644
27602
|
apiRef.current.resetPage = () => {
|
|
27645
27603
|
apiRef.current.setPage(0);
|
|
@@ -27650,7 +27608,7 @@ const useStatefulTable = props => {
|
|
|
27650
27608
|
onFilterModelChange: (model, details) => {
|
|
27651
27609
|
const filterModel = _objectSpread2(_objectSpread2({}, model), {}, {
|
|
27652
27610
|
items: model.items.map(item => {
|
|
27653
|
-
const column = apiRef.current.getColumn(item.
|
|
27611
|
+
const column = apiRef.current.getColumn(item.field);
|
|
27654
27612
|
item.type = column.type || 'string';
|
|
27655
27613
|
return item;
|
|
27656
27614
|
})
|
|
@@ -27687,33 +27645,16 @@ const useStatefulTable = props => {
|
|
|
27687
27645
|
}, search, historyReplace, columns);
|
|
27688
27646
|
},
|
|
27689
27647
|
pinnedColumns: pinnedColumnsModel,
|
|
27690
|
-
|
|
27691
|
-
|
|
27692
|
-
|
|
27693
|
-
|
|
27694
|
-
|
|
27695
|
-
|
|
27696
|
-
filterModel: filterParsed,
|
|
27697
|
-
sortModel: sortModelParsed,
|
|
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);
|
|
27648
|
+
paginationModel: paginationModelParsed,
|
|
27649
|
+
onPaginationModelChange: (model, details) => {
|
|
27650
|
+
const paginationModel = _objectSpread2(_objectSpread2({}, model), {}, {
|
|
27651
|
+
direction: paginationModelParsed.page < model.page ? 'next' : 'back'
|
|
27652
|
+
});
|
|
27653
|
+
propsOnPaginationModelChange === null || propsOnPaginationModelChange === void 0 ? void 0 : propsOnPaginationModelChange(paginationModel, details);
|
|
27709
27654
|
updateUrl({
|
|
27710
27655
|
filterModel: filterParsed,
|
|
27711
27656
|
sortModel: sortModelParsed,
|
|
27712
|
-
paginationModel:
|
|
27713
|
-
page: paginationModelParsed.page,
|
|
27714
|
-
pageSize,
|
|
27715
|
-
direction: paginationModelParsed.direction
|
|
27716
|
-
},
|
|
27657
|
+
paginationModel: paginationModel,
|
|
27717
27658
|
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
27718
27659
|
pinnedColumnsModel: pinnedColumnsModel
|
|
27719
27660
|
}, search, historyReplace, columns);
|
|
@@ -27739,7 +27680,7 @@ const useStatefulTable = props => {
|
|
|
27739
27680
|
};
|
|
27740
27681
|
};
|
|
27741
27682
|
|
|
27742
|
-
const _excluded$1 = ["apiRef", "autoHeight", "className", "columns", "
|
|
27683
|
+
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"];
|
|
27743
27684
|
const COMPONENT_NAME$1 = 'DataGrid';
|
|
27744
27685
|
const CLASSNAME$1 = 'redsift-datagrid';
|
|
27745
27686
|
const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
@@ -27749,15 +27690,13 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27749
27690
|
autoHeight,
|
|
27750
27691
|
className,
|
|
27751
27692
|
columns,
|
|
27752
|
-
|
|
27753
|
-
|
|
27754
|
-
componentsProps,
|
|
27693
|
+
slots,
|
|
27694
|
+
slotProps,
|
|
27755
27695
|
filterModel: propsFilterModel,
|
|
27756
27696
|
columnVisibilityModel: propsColumnVisibilityModel,
|
|
27757
27697
|
pinnedColumns: propsPinnedColumns,
|
|
27758
27698
|
sortModel: propsSortModel,
|
|
27759
|
-
|
|
27760
|
-
pageSize: propsPageSize,
|
|
27699
|
+
paginationModel: propsPaginationModel,
|
|
27761
27700
|
height: propsHeight,
|
|
27762
27701
|
hideToolbar,
|
|
27763
27702
|
initialState,
|
|
@@ -27765,11 +27704,10 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27765
27704
|
license = process.env.MUI_LICENSE_KEY,
|
|
27766
27705
|
localStorageVersion,
|
|
27767
27706
|
onFilterModelChange: propsOnFilterModelChange,
|
|
27768
|
-
|
|
27707
|
+
rowSelectionModel: propsRowSelectionModel,
|
|
27769
27708
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
27770
|
-
|
|
27771
|
-
|
|
27772
|
-
onSelectionModelChange: propsOnSelectionModelChange,
|
|
27709
|
+
onPaginationModelChange: propsOnPaginationModelChange,
|
|
27710
|
+
onRowSelectionModelChange: propsOnRowSelectionModelChange,
|
|
27773
27711
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
27774
27712
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
27775
27713
|
onSortModelChange: propsOnSortModelChange,
|
|
@@ -27777,7 +27715,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27777
27715
|
paginationPlacement = 'both',
|
|
27778
27716
|
paginationProps,
|
|
27779
27717
|
rows,
|
|
27780
|
-
|
|
27718
|
+
pageSizeOptions,
|
|
27781
27719
|
sx,
|
|
27782
27720
|
theme: propsTheme,
|
|
27783
27721
|
useRouter,
|
|
@@ -27788,43 +27726,38 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27788
27726
|
const theme = useTheme$4(propsTheme);
|
|
27789
27727
|
const _apiRef = useGridApiRef();
|
|
27790
27728
|
const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
|
|
27791
|
-
const RenderedToolbar =
|
|
27729
|
+
const RenderedToolbar = slots !== null && slots !== void 0 && slots.toolbar ? slots.toolbar : Toolbar$2;
|
|
27792
27730
|
LicenseInfo.setLicenseKey(license);
|
|
27793
27731
|
const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
|
|
27794
27732
|
const {
|
|
27795
27733
|
onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
|
|
27796
27734
|
onFilterModelChange: controlledOnFilterModelChange,
|
|
27797
|
-
|
|
27798
|
-
onPageSizeChange: controlledOnPageSizeChange,
|
|
27735
|
+
onPaginationModelChange: controlledOnPaginationModelChange,
|
|
27799
27736
|
onPinnedColumnsChange: controlledOnPinnedColumnsChange,
|
|
27800
27737
|
onSortModelChange: controlledOnSortModelChange
|
|
27801
27738
|
} = useControlledDatagridState({
|
|
27802
27739
|
initialState,
|
|
27803
|
-
|
|
27740
|
+
pageSizeOptions,
|
|
27804
27741
|
propsColumnVisibilityModel,
|
|
27805
27742
|
propsFilterModel,
|
|
27806
27743
|
propsOnColumnVisibilityModelChange,
|
|
27807
27744
|
propsOnFilterModelChange,
|
|
27808
27745
|
propsOnPinnedColumnsChange,
|
|
27809
27746
|
propsOnSortModelChange,
|
|
27810
|
-
|
|
27811
|
-
propsPageSize,
|
|
27747
|
+
propsPaginationModel,
|
|
27812
27748
|
propsPinnedColumns,
|
|
27813
27749
|
propsSortModel,
|
|
27814
|
-
|
|
27815
|
-
propsOnPageSizeChange
|
|
27750
|
+
propsOnPaginationModelChange
|
|
27816
27751
|
});
|
|
27817
27752
|
const {
|
|
27818
27753
|
columnVisibilityModel,
|
|
27819
27754
|
filterModel,
|
|
27820
27755
|
onColumnVisibilityModelChange,
|
|
27821
27756
|
onFilterModelChange,
|
|
27822
|
-
|
|
27823
|
-
onPageSizeChange,
|
|
27757
|
+
onPaginationModelChange,
|
|
27824
27758
|
onPinnedColumnsChange,
|
|
27825
27759
|
onSortModelChange,
|
|
27826
|
-
|
|
27827
|
-
pageSize,
|
|
27760
|
+
paginationModel,
|
|
27828
27761
|
pinnedColumns,
|
|
27829
27762
|
sortModel,
|
|
27830
27763
|
onColumnWidthChange
|
|
@@ -27835,39 +27768,38 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27835
27768
|
onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
|
|
27836
27769
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
27837
27770
|
onFilterModelChange: controlledOnFilterModelChange,
|
|
27838
|
-
|
|
27839
|
-
onPageSizeChange: controlledOnPageSizeChange,
|
|
27771
|
+
onPaginationModelChange: controlledOnPaginationModelChange,
|
|
27840
27772
|
onPinnedColumnsChange: controlledOnPinnedColumnsChange,
|
|
27841
27773
|
onSortModelChange: controlledOnSortModelChange,
|
|
27842
27774
|
useRouter: useRouter,
|
|
27843
27775
|
localStorageVersion
|
|
27844
27776
|
});
|
|
27845
|
-
const [
|
|
27777
|
+
const [rowSelectionModel, setRowSelectionModel] = useState(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
27846
27778
|
useEffect(() => {
|
|
27847
|
-
|
|
27848
|
-
}, [
|
|
27849
|
-
const
|
|
27850
|
-
if (
|
|
27851
|
-
|
|
27779
|
+
setRowSelectionModel(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
27780
|
+
}, [propsRowSelectionModel]);
|
|
27781
|
+
const onRowSelectionModelChange = (selectionModel, details) => {
|
|
27782
|
+
if (propsOnRowSelectionModelChange) {
|
|
27783
|
+
propsOnRowSelectionModelChange(selectionModel, details);
|
|
27852
27784
|
} else {
|
|
27853
|
-
|
|
27785
|
+
setRowSelectionModel(selectionModel);
|
|
27854
27786
|
}
|
|
27855
27787
|
};
|
|
27856
27788
|
const selectionStatus = useRef({
|
|
27857
27789
|
type: 'none',
|
|
27858
27790
|
numberOfSelectedRows: 0,
|
|
27859
27791
|
numberOfSelectedRowsInPage: 0,
|
|
27860
|
-
page,
|
|
27861
|
-
pageSize: pageSize
|
|
27792
|
+
page: paginationModel.page,
|
|
27793
|
+
pageSize: paginationModel.pageSize
|
|
27862
27794
|
});
|
|
27863
27795
|
|
|
27864
27796
|
// in server-side pagination we want to update the selection status
|
|
27865
27797
|
// every time we navigate between pages, resize our page or select something
|
|
27866
27798
|
useEffect(() => {
|
|
27867
27799
|
if (paginationMode == 'server') {
|
|
27868
|
-
onServerSideSelectionStatusChange(Array.isArray(
|
|
27800
|
+
onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatus, isRowSelectable, paginationModel.page, paginationModel.pageSize);
|
|
27869
27801
|
}
|
|
27870
|
-
}, [
|
|
27802
|
+
}, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
|
|
27871
27803
|
if (!Array.isArray(rows)) {
|
|
27872
27804
|
return null;
|
|
27873
27805
|
}
|
|
@@ -27900,15 +27832,13 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27900
27832
|
filterModel: filterModel,
|
|
27901
27833
|
onColumnVisibilityModelChange: onColumnVisibilityModelChange,
|
|
27902
27834
|
onFilterModelChange: onFilterModelChange,
|
|
27903
|
-
|
|
27904
|
-
onPageSizeChange: onPageSizeChange,
|
|
27835
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
27905
27836
|
onPinnedColumnsChange: onPinnedColumnsChange,
|
|
27906
27837
|
onSortModelChange: onSortModelChange,
|
|
27907
|
-
|
|
27908
|
-
pageSize: pageSize,
|
|
27838
|
+
paginationModel: paginationModel,
|
|
27909
27839
|
pinnedColumns: pinnedColumns,
|
|
27910
27840
|
sortModel: sortModel,
|
|
27911
|
-
|
|
27841
|
+
pageSizeOptions: pageSizeOptions,
|
|
27912
27842
|
onColumnWidthChange: onColumnWidthChange,
|
|
27913
27843
|
initialState: initialState,
|
|
27914
27844
|
isRowSelectable: isRowSelectable,
|
|
@@ -27919,58 +27849,55 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27919
27849
|
rowCount: rowCount,
|
|
27920
27850
|
autoHeight: autoHeight,
|
|
27921
27851
|
checkboxSelectionVisibleOnly: Boolean(pagination),
|
|
27922
|
-
|
|
27923
|
-
|
|
27924
|
-
|
|
27925
|
-
|
|
27926
|
-
|
|
27927
|
-
|
|
27928
|
-
ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27852
|
+
slots: _objectSpread2(_objectSpread2({
|
|
27853
|
+
baseButton: BaseButton,
|
|
27854
|
+
baseCheckbox: BaseCheckbox,
|
|
27855
|
+
// baseTextField,
|
|
27856
|
+
basePopper: BasePopper,
|
|
27857
|
+
columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27929
27858
|
displayName: "ColumnFilteredIcon"
|
|
27930
27859
|
})),
|
|
27931
|
-
|
|
27860
|
+
columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27932
27861
|
displayName: "ColumnSelectorIcon"
|
|
27933
27862
|
})),
|
|
27934
|
-
|
|
27863
|
+
columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27935
27864
|
displayName: "ColumnSortedAscendingIcon"
|
|
27936
27865
|
})),
|
|
27937
|
-
|
|
27866
|
+
columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27938
27867
|
displayName: "ColumnSortedDescendingIcon"
|
|
27939
27868
|
})),
|
|
27940
|
-
|
|
27869
|
+
densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27941
27870
|
displayName: "DensityCompactIcon"
|
|
27942
27871
|
})),
|
|
27943
|
-
|
|
27872
|
+
densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27944
27873
|
displayName: "DensityStandardIcon"
|
|
27945
27874
|
})),
|
|
27946
|
-
|
|
27875
|
+
densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27947
27876
|
displayName: "DensityComfortableIcon"
|
|
27948
27877
|
})),
|
|
27949
|
-
|
|
27878
|
+
detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27950
27879
|
displayName: "DetailPanelCollapseIcon"
|
|
27951
27880
|
})),
|
|
27952
|
-
|
|
27881
|
+
detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27953
27882
|
displayName: "DetailPanelExpandIcon"
|
|
27954
27883
|
})),
|
|
27955
|
-
|
|
27884
|
+
exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27956
27885
|
displayName: "ExportIcon"
|
|
27957
27886
|
})),
|
|
27958
|
-
|
|
27887
|
+
openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
|
|
27959
27888
|
displayName: "OpenFilterButtonIcon"
|
|
27960
27889
|
}, props))
|
|
27961
|
-
},
|
|
27962
|
-
|
|
27963
|
-
|
|
27890
|
+
}, slots), {}, {
|
|
27891
|
+
toolbar: ToolbarWrapper,
|
|
27892
|
+
pagination: props => {
|
|
27964
27893
|
return pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$1({}, props, {
|
|
27965
27894
|
displaySelection: false,
|
|
27966
27895
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
27967
27896
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
27968
27897
|
selectionStatus: selectionStatus.current,
|
|
27969
|
-
|
|
27970
|
-
|
|
27971
|
-
|
|
27972
|
-
onPageSizeChange: onPageSizeChange,
|
|
27973
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
27898
|
+
paginationModel: paginationModel,
|
|
27899
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
27900
|
+
pageSizeOptions: pageSizeOptions,
|
|
27974
27901
|
paginationProps: paginationProps,
|
|
27975
27902
|
paginationMode: paginationMode,
|
|
27976
27903
|
rowCount: rowCount
|
|
@@ -27981,17 +27908,15 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27981
27908
|
selectionStatus: selectionStatus.current,
|
|
27982
27909
|
apiRef: apiRef,
|
|
27983
27910
|
isRowSelectable: isRowSelectable,
|
|
27984
|
-
|
|
27985
|
-
|
|
27986
|
-
|
|
27987
|
-
onPageSizeChange: onPageSizeChange,
|
|
27988
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
27911
|
+
paginationModel: paginationModel,
|
|
27912
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
27913
|
+
pageSizeOptions: pageSizeOptions,
|
|
27989
27914
|
paginationProps: paginationProps,
|
|
27990
27915
|
paginationMode: paginationMode
|
|
27991
27916
|
})) : null;
|
|
27992
27917
|
}
|
|
27993
27918
|
}),
|
|
27994
|
-
|
|
27919
|
+
slotProps: _objectSpread2(_objectSpread2({}, slotProps), {}, {
|
|
27995
27920
|
toolbar: _objectSpread2({
|
|
27996
27921
|
hideToolbar,
|
|
27997
27922
|
RenderedToolbar,
|
|
@@ -28002,18 +27927,16 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
28002
27927
|
selectionStatus,
|
|
28003
27928
|
apiRef,
|
|
28004
27929
|
isRowSelectable,
|
|
28005
|
-
|
|
28006
|
-
|
|
28007
|
-
|
|
28008
|
-
onPageSizeChange,
|
|
28009
|
-
rowsPerPageOptions,
|
|
27930
|
+
paginationModel,
|
|
27931
|
+
onPaginationModelChange,
|
|
27932
|
+
pageSizeOptions,
|
|
28010
27933
|
paginationProps,
|
|
28011
27934
|
paginationMode,
|
|
28012
27935
|
rowCount
|
|
28013
|
-
},
|
|
27936
|
+
}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar)
|
|
28014
27937
|
}),
|
|
28015
|
-
|
|
28016
|
-
|
|
27938
|
+
rowSelectionModel: rowSelectionModel,
|
|
27939
|
+
onRowSelectionModelChange: (newSelectionModel, details) => {
|
|
28017
27940
|
if (pagination && paginationMode != 'server') {
|
|
28018
27941
|
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
|
|
28019
27942
|
let {
|
|
@@ -28071,7 +27994,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
28071
27994
|
};
|
|
28072
27995
|
}
|
|
28073
27996
|
}
|
|
28074
|
-
|
|
27997
|
+
onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
|
|
28075
27998
|
},
|
|
28076
27999
|
sx: _objectSpread2(_objectSpread2({}, sx), {}, {
|
|
28077
28000
|
'.MuiDataGrid-columnHeaders': {
|
|
@@ -28145,5 +28068,5 @@ const TextCell = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
28145
28068
|
TextCell.className = CLASSNAME;
|
|
28146
28069
|
TextCell.displayName = COMPONENT_NAME;
|
|
28147
28070
|
|
|
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 };
|
|
28071
|
+
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 };
|
|
28149
28072
|
//# sourceMappingURL=index.js.map
|