@redsift/table 11.1.2 → 11.1.3-muiv5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +42 -26
- package/index.js +338 -266
- package/index.js.map +1 -1
- package/package.json +6 -6
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GRID_DETAIL_PANEL_TOGGLE_COL_DEF, getGridNumericOperators as getGridNumericOperators$1, GridFilterInputValue, GridFilterInputMultipleValue, getGridStringOperators as getGridStringOperators$1, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators,
|
|
1
|
+
import { GRID_DETAIL_PANEL_TOGGLE_COL_DEF, getGridNumericOperators as getGridNumericOperators$1, GridFilterInputValue, GridFilterInputMultipleValue, getGridStringOperators as getGridStringOperators$1, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators, GridLinkOperator, GridToolbarContainer, GridToolbarFilterButton, GridToolbarColumnsButton, GridToolbarDensitySelector, GridToolbarExport, gridVisibleSortedRowIdsSelector, gridPaginatedVisibleSortedGridRowEntriesSelector, gridPaginatedVisibleSortedGridRowIdsSelector, gridFilteredSortedRowEntriesSelector, gridFilteredSortedRowIdsSelector, useGridApiRef, DataGridPro, GRID_CHECKBOX_SELECTION_COL_DEF } from '@mui/x-data-grid-pro';
|
|
2
2
|
export { getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators } from '@mui/x-data-grid-pro';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import React__default, { Children, isValidElement, cloneElement, forwardRef, useLayoutEffect, useEffect, useRef, useContext, useState, useCallback, createElement, useMemo } from 'react';
|
|
@@ -17639,7 +17639,7 @@ const isBetweenOperator = {
|
|
|
17639
17639
|
label: 'is between',
|
|
17640
17640
|
value: 'isBetween',
|
|
17641
17641
|
getApplyFilterFn: filterItem => {
|
|
17642
|
-
if (!filterItem.
|
|
17642
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17643
17643
|
return null;
|
|
17644
17644
|
}
|
|
17645
17645
|
if (!Array.isArray(filterItem.value) || filterItem.value.length !== 2) {
|
|
@@ -17652,7 +17652,7 @@ const isBetweenOperator = {
|
|
|
17652
17652
|
return null;
|
|
17653
17653
|
}
|
|
17654
17654
|
return params => {
|
|
17655
|
-
return params.value !== null &&
|
|
17655
|
+
return params.value !== null && filterItem.value[0] <= params.value && params.value <= filterItem.value[1];
|
|
17656
17656
|
};
|
|
17657
17657
|
},
|
|
17658
17658
|
InputComponent: InputNumberInterval
|
|
@@ -17665,7 +17665,7 @@ const doesNotEqual = {
|
|
|
17665
17665
|
label: 'does not equal',
|
|
17666
17666
|
value: 'doesNotEqual',
|
|
17667
17667
|
getApplyFilterFn: filterItem => {
|
|
17668
|
-
if (!filterItem.
|
|
17668
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17669
17669
|
return null;
|
|
17670
17670
|
}
|
|
17671
17671
|
return params => {
|
|
@@ -17686,7 +17686,7 @@ const doesNotContain = {
|
|
|
17686
17686
|
label: 'does not contain',
|
|
17687
17687
|
value: 'doesNotContain',
|
|
17688
17688
|
getApplyFilterFn: filterItem => {
|
|
17689
|
-
if (!filterItem.
|
|
17689
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17690
17690
|
return null;
|
|
17691
17691
|
}
|
|
17692
17692
|
return params => {
|
|
@@ -17707,7 +17707,7 @@ const containsAnyOfOperator = {
|
|
|
17707
17707
|
label: 'contains any of',
|
|
17708
17708
|
value: 'containsAnyOf',
|
|
17709
17709
|
getApplyFilterFn: filterItem => {
|
|
17710
|
-
if (!filterItem.
|
|
17710
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17711
17711
|
return null;
|
|
17712
17712
|
}
|
|
17713
17713
|
return params => {
|
|
@@ -17730,7 +17730,7 @@ const containsAnyOfCIOperator = {
|
|
|
17730
17730
|
label: 'contains any of (case insensitive)',
|
|
17731
17731
|
value: 'containsAnyOf',
|
|
17732
17732
|
getApplyFilterFn: filterItem => {
|
|
17733
|
-
if (!filterItem.
|
|
17733
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17734
17734
|
return null;
|
|
17735
17735
|
}
|
|
17736
17736
|
return params => {
|
|
@@ -17757,7 +17757,7 @@ const endsWithAnyOfOperator = {
|
|
|
17757
17757
|
label: 'ends with any of',
|
|
17758
17758
|
value: 'endsWithAnyOf',
|
|
17759
17759
|
getApplyFilterFn: filterItem => {
|
|
17760
|
-
if (!filterItem.
|
|
17760
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17761
17761
|
return null;
|
|
17762
17762
|
}
|
|
17763
17763
|
return params => {
|
|
@@ -17784,7 +17784,7 @@ const isAnyOfOperator = {
|
|
|
17784
17784
|
label: 'is any of',
|
|
17785
17785
|
value: 'isAnyOf',
|
|
17786
17786
|
getApplyFilterFn: filterItem => {
|
|
17787
|
-
if (!filterItem.
|
|
17787
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17788
17788
|
return null;
|
|
17789
17789
|
}
|
|
17790
17790
|
return params => {
|
|
@@ -17808,7 +17808,7 @@ const isNotAnyOfOperator = {
|
|
|
17808
17808
|
label: 'is not any of',
|
|
17809
17809
|
value: 'isNotAnyOf',
|
|
17810
17810
|
getApplyFilterFn: filterItem => {
|
|
17811
|
-
if (!filterItem.
|
|
17811
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17812
17812
|
return null;
|
|
17813
17813
|
}
|
|
17814
17814
|
return params => {
|
|
@@ -17832,7 +17832,7 @@ const startsWithAnyOfOperator = {
|
|
|
17832
17832
|
label: 'starts with any of',
|
|
17833
17833
|
value: 'startsWithAnyOf',
|
|
17834
17834
|
getApplyFilterFn: filterItem => {
|
|
17835
|
-
if (!filterItem.
|
|
17835
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17836
17836
|
return null;
|
|
17837
17837
|
}
|
|
17838
17838
|
return params => {
|
|
@@ -17877,13 +17877,13 @@ const operatorList = {
|
|
|
17877
17877
|
|
|
17878
17878
|
const getRsStringColumnType = () => {
|
|
17879
17879
|
return {
|
|
17880
|
-
|
|
17880
|
+
extendType: 'string',
|
|
17881
17881
|
filterOperators: operatorList.rsString
|
|
17882
17882
|
};
|
|
17883
17883
|
};
|
|
17884
17884
|
const getRsNumberColumnType = () => {
|
|
17885
17885
|
return {
|
|
17886
|
-
|
|
17886
|
+
extendType: 'number',
|
|
17887
17887
|
filterOperators: operatorList.rsNumber
|
|
17888
17888
|
};
|
|
17889
17889
|
};
|
|
@@ -17894,7 +17894,7 @@ const customColumnTypes = {
|
|
|
17894
17894
|
|
|
17895
17895
|
const API_URL = 'https://api.openai.com/v1/chat/completions';
|
|
17896
17896
|
async function getCompletion(text, role, openai_api_key) {
|
|
17897
|
-
let model = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'gpt-3.5-turbo-
|
|
17897
|
+
let model = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'gpt-3.5-turbo-0613';
|
|
17898
17898
|
try {
|
|
17899
17899
|
const messages = [{
|
|
17900
17900
|
role: 'system',
|
|
@@ -18063,39 +18063,42 @@ const numberOperatorDecoder = {
|
|
|
18063
18063
|
lt: '<',
|
|
18064
18064
|
lte: '<='
|
|
18065
18065
|
};
|
|
18066
|
-
const isOperatorValueValid = (
|
|
18067
|
-
const column = columns.find(column => column.field ===
|
|
18066
|
+
const isOperatorValueValid = (columnField, operatorValue, columns) => {
|
|
18067
|
+
const column = columns.find(column => column.field === columnField);
|
|
18068
18068
|
if (!column) {
|
|
18069
18069
|
return false;
|
|
18070
18070
|
}
|
|
18071
18071
|
const columnType = (column === null || column === void 0 ? void 0 : column.type) || 'string';
|
|
18072
|
-
const operators =
|
|
18072
|
+
const operators = operatorList[columnType];
|
|
18073
18073
|
if (!operators) {
|
|
18074
18074
|
return false;
|
|
18075
18075
|
}
|
|
18076
|
-
|
|
18076
|
+
if ('filterOperators' in operators) {
|
|
18077
|
+
return !!operators.filterOperators.find(op => columnType === 'number' && Object.keys(numberOperatorEncoder).includes(op.value) ? numberOperatorEncoder[op.value] === operatorValue : op['value'] === operatorValue);
|
|
18078
|
+
}
|
|
18079
|
+
return !!operators.find(op => ['number', 'rsNumber'].includes(columnType) && Object.keys(numberOperatorEncoder).includes(op.value) ? numberOperatorEncoder[op.value] === operatorValue : op['value'] === operatorValue);
|
|
18077
18080
|
};
|
|
18078
18081
|
const listOperators = ['containsAnyOf', 'endsWithAnyOf', 'isAnyOf', 'isNotAnyOf', 'startsWithAnyOf'];
|
|
18079
18082
|
|
|
18080
18083
|
// Check if the value doesn't break
|
|
18081
|
-
const isValueValid = (value,
|
|
18084
|
+
const isValueValid = (value, columnField, columns, operatorValue) => {
|
|
18082
18085
|
var _column$type;
|
|
18083
18086
|
// every field accepts undefined as value for default
|
|
18084
18087
|
if (value === undefined || value === '') {
|
|
18085
18088
|
return true;
|
|
18086
18089
|
}
|
|
18087
18090
|
|
|
18088
|
-
// xxxAnyOf accepts as value only lists, and we are
|
|
18091
|
+
// xxxAnyOf accepts as value only lists, and we are declearing them in the
|
|
18089
18092
|
// URL as `list=[...]`
|
|
18090
|
-
if (listOperators.includes(
|
|
18093
|
+
if (listOperators.includes(operatorValue)) {
|
|
18091
18094
|
return Array.isArray(value) || value === '';
|
|
18092
18095
|
}
|
|
18093
18096
|
|
|
18094
18097
|
// We are accepting arrays only if they are of the 'xxxAnyOf' type
|
|
18095
|
-
if (Array.isArray(value) && !listOperators.includes(
|
|
18098
|
+
if (Array.isArray(value) && !listOperators.includes(operatorValue)) {
|
|
18096
18099
|
return false;
|
|
18097
18100
|
}
|
|
18098
|
-
const column = columns.find(column => column.field ===
|
|
18101
|
+
const column = columns.find(column => column.field === columnField);
|
|
18099
18102
|
if (!column) {
|
|
18100
18103
|
return false;
|
|
18101
18104
|
}
|
|
@@ -18131,19 +18134,16 @@ const isValueValid = (value, field, columns, operator) => {
|
|
|
18131
18134
|
// unicodeDomain[contains]=a&unicodeDomain[contains]=dsa&logicOperator=and&tab=ignored
|
|
18132
18135
|
const getFilterModelFromString = (searchString, columns) => {
|
|
18133
18136
|
if (!searchString) {
|
|
18134
|
-
return
|
|
18135
|
-
items: [],
|
|
18136
|
-
logicOperator: GridLogicOperator.And
|
|
18137
|
-
};
|
|
18137
|
+
return 'invalid';
|
|
18138
18138
|
}
|
|
18139
|
-
let
|
|
18139
|
+
let linkOperator = GridLinkOperator.And;
|
|
18140
18140
|
const searchParams = new URLSearchParams();
|
|
18141
18141
|
for (const [key, value] of new URLSearchParams(searchString)) {
|
|
18142
18142
|
if (key.startsWith('_') && !['_logicOperator', '_sortColumn', '_pinnedColumnsLeft', '_pinnedColumnsRight', '_columnVisibility', '_pagination'].includes(key)) {
|
|
18143
18143
|
searchParams.set(key, value);
|
|
18144
18144
|
}
|
|
18145
18145
|
if (key === '_logicOperator') {
|
|
18146
|
-
|
|
18146
|
+
linkOperator = value;
|
|
18147
18147
|
}
|
|
18148
18148
|
}
|
|
18149
18149
|
let id = 5000;
|
|
@@ -18184,8 +18184,8 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
18184
18184
|
return;
|
|
18185
18185
|
}
|
|
18186
18186
|
items.push({
|
|
18187
|
-
field,
|
|
18188
|
-
|
|
18187
|
+
columnField: field,
|
|
18188
|
+
operatorValue: ['number', 'rsNumber'].includes(columnType) && Object.keys(numberOperatorDecoder).includes(operator) ? numberOperatorDecoder[operator] : operator,
|
|
18189
18189
|
id,
|
|
18190
18190
|
value: listOperators.includes(operator) && decodedValue === '' ? [] : decodedValue,
|
|
18191
18191
|
type
|
|
@@ -18196,30 +18196,27 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
18196
18196
|
// return the empty filterModel (this will trigger the localStorage)
|
|
18197
18197
|
// and will pick up the last valid search
|
|
18198
18198
|
if (isInvalid) {
|
|
18199
|
-
return
|
|
18200
|
-
items: [],
|
|
18201
|
-
logicOperator: GridLogicOperator.And
|
|
18202
|
-
};
|
|
18199
|
+
return 'invalid';
|
|
18203
18200
|
}
|
|
18204
18201
|
return {
|
|
18205
18202
|
items,
|
|
18206
|
-
|
|
18203
|
+
linkOperator
|
|
18207
18204
|
};
|
|
18208
18205
|
};
|
|
18209
18206
|
const getSearchParamsFromFilterModel = filterModel => {
|
|
18210
18207
|
const searchParams = new URLSearchParams();
|
|
18211
|
-
searchParams.set('_logicOperator', filterModel['
|
|
18208
|
+
searchParams.set('_logicOperator', filterModel['linkOperator'] || '');
|
|
18212
18209
|
filterModel['items'].forEach(item => {
|
|
18213
18210
|
const {
|
|
18214
|
-
|
|
18215
|
-
|
|
18211
|
+
columnField,
|
|
18212
|
+
operatorValue,
|
|
18216
18213
|
value,
|
|
18217
18214
|
type
|
|
18218
18215
|
} = item;
|
|
18219
|
-
if (Object.keys(numberOperatorEncoder).includes(
|
|
18220
|
-
searchParams.set(`_${
|
|
18216
|
+
if (Object.keys(numberOperatorEncoder).includes(operatorValue)) {
|
|
18217
|
+
searchParams.set(`_${columnField}[${numberOperatorEncoder[operatorValue]},${encodeValue(type)}]`, encodeValue(value));
|
|
18221
18218
|
} else {
|
|
18222
|
-
searchParams.set(`_${
|
|
18219
|
+
searchParams.set(`_${columnField}[${encodeValue(operatorValue)},${encodeValue(type)}]`, encodeValue(value));
|
|
18223
18220
|
}
|
|
18224
18221
|
});
|
|
18225
18222
|
return searchParams;
|
|
@@ -18231,7 +18228,7 @@ const getSearchParamsFromFilterModel = filterModel => {
|
|
|
18231
18228
|
// - if we don't have that, return an empty FilterModel
|
|
18232
18229
|
const getFilterModel = (search, columns, localStorageFilters, setLocalStorageFilters) => {
|
|
18233
18230
|
const filterModelFromSearch = getFilterModelFromString(search, columns);
|
|
18234
|
-
if (filterModelFromSearch
|
|
18231
|
+
if (filterModelFromSearch !== 'invalid') {
|
|
18235
18232
|
const searchFromFilterModel = getSearchParamsFromFilterModel(filterModelFromSearch);
|
|
18236
18233
|
const searchString = urlSearchParamsToString(searchFromFilterModel);
|
|
18237
18234
|
if (searchString !== localStorageFilters) {
|
|
@@ -18240,12 +18237,12 @@ const getFilterModel = (search, columns, localStorageFilters, setLocalStorageFil
|
|
|
18240
18237
|
return filterModelFromSearch;
|
|
18241
18238
|
}
|
|
18242
18239
|
const filterModelFromLocalStorage = getFilterModelFromString(localStorageFilters, columns);
|
|
18243
|
-
if (filterModelFromLocalStorage) {
|
|
18240
|
+
if (filterModelFromLocalStorage !== 'invalid') {
|
|
18244
18241
|
return filterModelFromLocalStorage;
|
|
18245
18242
|
}
|
|
18246
18243
|
return {
|
|
18247
18244
|
items: [],
|
|
18248
|
-
|
|
18245
|
+
linkOperator: GridLinkOperator.And
|
|
18249
18246
|
};
|
|
18250
18247
|
};
|
|
18251
18248
|
|
|
@@ -18368,11 +18365,11 @@ const getPaginationModel = (search, localStoragePagination, setLocalStoragePagin
|
|
|
18368
18365
|
|
|
18369
18366
|
const getSearchParamsFromColumnVisibility = (columnVisibility, columns) => {
|
|
18370
18367
|
const searchParams = new URLSearchParams();
|
|
18371
|
-
const
|
|
18368
|
+
const columnFields = columns.map(column => column.field);
|
|
18372
18369
|
|
|
18373
18370
|
// if column visibility model is empty, show all columns
|
|
18374
18371
|
if (Object.keys(columnVisibility).length == 0) {
|
|
18375
|
-
searchParams.set('_columnVisibility', `[${
|
|
18372
|
+
searchParams.set('_columnVisibility', `[${columnFields.join(',')}]`);
|
|
18376
18373
|
return searchParams;
|
|
18377
18374
|
}
|
|
18378
18375
|
const finalColumnVisibility = columns.filter(c => {
|
|
@@ -18422,12 +18419,12 @@ const getColumnVisibilityFromString = (notParsed, tableColumns) => {
|
|
|
18422
18419
|
continue;
|
|
18423
18420
|
}
|
|
18424
18421
|
exist = true;
|
|
18425
|
-
const
|
|
18422
|
+
const columnFields = tableColumns.map(column => column.field);
|
|
18426
18423
|
// TODO: Add validation that , is present
|
|
18427
18424
|
const columns = encodedValues.split(',').map(value => decodeValue(value));
|
|
18428
18425
|
|
|
18429
18426
|
// for each column, check if it's visible and add it to visibility model
|
|
18430
|
-
for (const column of
|
|
18427
|
+
for (const column of columnFields) {
|
|
18431
18428
|
const isColumnVisible = columns.includes(column);
|
|
18432
18429
|
visibility[column] = isColumnVisible;
|
|
18433
18430
|
if (isColumnVisible) {
|
|
@@ -18490,8 +18487,8 @@ const getPinnedColumnsFromString = (notParsed, tableColumns) => {
|
|
|
18490
18487
|
if (typeof encodedValues !== 'string') {
|
|
18491
18488
|
continue;
|
|
18492
18489
|
}
|
|
18493
|
-
const
|
|
18494
|
-
const columns = encodedValues.split(',').map(value => decodeValue(value)).filter(val => typeof val === 'string' &&
|
|
18490
|
+
const columnFields = [...tableColumns.map(column => column.field), '__check__'];
|
|
18491
|
+
const columns = encodedValues.split(',').map(value => decodeValue(value)).filter(val => typeof val === 'string' && columnFields.includes(val));
|
|
18495
18492
|
if (fieldURL === '_pinnedColumnsLeft') {
|
|
18496
18493
|
pinnedColumns['left'] = columns;
|
|
18497
18494
|
}
|
|
@@ -18641,17 +18638,17 @@ const updateUrl = (_ref4, search, historyReplace, columns) => {
|
|
|
18641
18638
|
// do not use it for equivalence (e.g. with value `3` and undefined we
|
|
18642
18639
|
// will get 0).
|
|
18643
18640
|
const compareFilters = (firstFilter, secondFilter) => {
|
|
18644
|
-
if (firstFilter.
|
|
18641
|
+
if (firstFilter.columnField < secondFilter.columnField) {
|
|
18645
18642
|
return -1;
|
|
18646
|
-
} else if (firstFilter.
|
|
18643
|
+
} else if (firstFilter.columnField > secondFilter.columnField) {
|
|
18647
18644
|
return 1;
|
|
18648
18645
|
}
|
|
18649
|
-
if (firstFilter.
|
|
18646
|
+
if (firstFilter.operatorValue === undefined || secondFilter.operatorValue === undefined) {
|
|
18650
18647
|
return 0;
|
|
18651
18648
|
}
|
|
18652
|
-
if (firstFilter.
|
|
18649
|
+
if (firstFilter.operatorValue < secondFilter.operatorValue) {
|
|
18653
18650
|
return -1;
|
|
18654
|
-
} else if (firstFilter.
|
|
18651
|
+
} else if (firstFilter.operatorValue > secondFilter.operatorValue) {
|
|
18655
18652
|
return 1;
|
|
18656
18653
|
}
|
|
18657
18654
|
if (firstFilter.value < secondFilter.value) {
|
|
@@ -18662,18 +18659,18 @@ const compareFilters = (firstFilter, secondFilter) => {
|
|
|
18662
18659
|
return 0;
|
|
18663
18660
|
};
|
|
18664
18661
|
const areFiltersEquivalent = (firstFilter, secondFilter) => {
|
|
18665
|
-
return firstFilter.
|
|
18662
|
+
return firstFilter.columnField === secondFilter.columnField && firstFilter.operatorValue === secondFilter.operatorValue && firstFilter.value === secondFilter.value;
|
|
18666
18663
|
};
|
|
18667
18664
|
const areFilterModelsEquivalent = (filterModel, filterModelToMatch) => {
|
|
18668
18665
|
const {
|
|
18669
18666
|
items,
|
|
18670
|
-
|
|
18667
|
+
linkOperator
|
|
18671
18668
|
} = filterModel;
|
|
18672
18669
|
const {
|
|
18673
18670
|
items: itemsToMatch,
|
|
18674
|
-
|
|
18671
|
+
linkOperator: linkOperatorToMatch
|
|
18675
18672
|
} = filterModelToMatch;
|
|
18676
|
-
if (
|
|
18673
|
+
if (linkOperator !== linkOperatorToMatch) {
|
|
18677
18674
|
return false;
|
|
18678
18675
|
}
|
|
18679
18676
|
if (items.length !== itemsToMatch.length) {
|
|
@@ -18686,7 +18683,7 @@ const areFilterModelsEquivalent = (filterModel, filterModelToMatch) => {
|
|
|
18686
18683
|
const filterToCompare = itemsToMatch[i];
|
|
18687
18684
|
|
|
18688
18685
|
// compareFilters return 0 if and only if the filters have the same
|
|
18689
|
-
//
|
|
18686
|
+
// columnField, operatorValue, and value
|
|
18690
18687
|
if (!areFiltersEquivalent(filter, filterToCompare)) {
|
|
18691
18688
|
return false;
|
|
18692
18689
|
}
|
|
@@ -23098,16 +23095,16 @@ const getRole = (config, dateFormat) => {
|
|
|
23098
23095
|
}).join('\n');
|
|
23099
23096
|
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.
|
|
23100
23097
|
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.
|
|
23101
|
-
The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "
|
|
23102
|
-
- "
|
|
23103
|
-
- "items": a list of conditions, each is an object with exactly the three keys "
|
|
23104
|
-
- "
|
|
23098
|
+
The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "linkOperator" and "items":
|
|
23099
|
+
- "linkOperator": the logical operator, only "and" or "or" are allowed. If there is only one condition in the "items", use "and".
|
|
23100
|
+
- "items": a list of conditions, each is an object with exactly the three keys "columnField", "operatorValue" and "value":
|
|
23101
|
+
- "columnField": the column name, must be one of ${columns}
|
|
23105
23102
|
- "value":
|
|
23106
|
-
- this can be skipped if the "
|
|
23107
|
-
- a list of multiple values if the "
|
|
23103
|
+
- this can be skipped if the "operatorValue" is either "isEmpty" or "isNotEmpty"
|
|
23104
|
+
- a list of multiple values if the "operatorValue" ends with "AnyOf"
|
|
23108
23105
|
- otherwise, it's a single value represented as a string: "true" instead of true, "false" instead of false, "0.6" instead of 0.6.
|
|
23109
23106
|
For "date" data type, use ${dateFormat}. If relative date is input, convert to the actual date given today is ${today}.
|
|
23110
|
-
- "
|
|
23107
|
+
- "operatorValue": the comparison operator, accepted values depend on the data type of the column
|
|
23111
23108
|
${operators}
|
|
23112
23109
|
|
|
23113
23110
|
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:
|
|
@@ -23144,10 +23141,10 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
23144
23141
|
nlpFilterConfig,
|
|
23145
23142
|
onFilterModelChange,
|
|
23146
23143
|
dateFormat = 'yyyy-mm-dd',
|
|
23147
|
-
defaultModel = 'gpt-4-
|
|
23144
|
+
defaultModel = 'gpt-4-0613',
|
|
23148
23145
|
defaultFilter = {
|
|
23149
23146
|
items: [],
|
|
23150
|
-
|
|
23147
|
+
linkOperator: 'and'
|
|
23151
23148
|
},
|
|
23152
23149
|
disablePower = false,
|
|
23153
23150
|
localeText
|
|
@@ -23225,7 +23222,7 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
23225
23222
|
value: prompt
|
|
23226
23223
|
}), /*#__PURE__*/React__default.createElement(Button, {
|
|
23227
23224
|
variant: "primary",
|
|
23228
|
-
"
|
|
23225
|
+
"aira-label": buttonAriaLabel,
|
|
23229
23226
|
type: "submit",
|
|
23230
23227
|
isLoading: isLoading
|
|
23231
23228
|
}, buttonText)), !disablePower && /*#__PURE__*/React__default.createElement(Tooltip, null, /*#__PURE__*/React__default.createElement(Tooltip.Trigger, null, /*#__PURE__*/React__default.createElement(Switch, {
|
|
@@ -23286,7 +23283,7 @@ const Toolbar$2 = props => {
|
|
|
23286
23283
|
let {
|
|
23287
23284
|
apiRef
|
|
23288
23285
|
} = _ref;
|
|
23289
|
-
return
|
|
23286
|
+
return gridVisibleSortedRowIdsSelector(apiRef);
|
|
23290
23287
|
}
|
|
23291
23288
|
},
|
|
23292
23289
|
printOptions: {
|
|
@@ -25518,10 +25515,12 @@ const ServerSideControlledPagination = _ref3 => {
|
|
|
25518
25515
|
selectionStatus,
|
|
25519
25516
|
displaySelection,
|
|
25520
25517
|
displayPagination,
|
|
25521
|
-
|
|
25522
|
-
|
|
25523
|
-
|
|
25518
|
+
page,
|
|
25519
|
+
onPageChange,
|
|
25520
|
+
pageSize,
|
|
25521
|
+
onPageSizeChange,
|
|
25524
25522
|
displayRowsPerPage,
|
|
25523
|
+
rowsPerPageOptions,
|
|
25525
25524
|
paginationProps,
|
|
25526
25525
|
rowCount
|
|
25527
25526
|
} = _ref3;
|
|
@@ -25540,17 +25539,13 @@ const ServerSideControlledPagination = _ref3 => {
|
|
|
25540
25539
|
}, totalRowsLabel) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$2({
|
|
25541
25540
|
component: "div",
|
|
25542
25541
|
count: totalNumberOfRowsInTable,
|
|
25543
|
-
page:
|
|
25544
|
-
onPageChange: (event,
|
|
25545
|
-
|
|
25546
|
-
|
|
25547
|
-
|
|
25548
|
-
|
|
25549
|
-
|
|
25550
|
-
page: paginationModel.page,
|
|
25551
|
-
pageSize: parseInt(event.target.value, 10)
|
|
25552
|
-
}),
|
|
25553
|
-
rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
|
|
25542
|
+
page: page,
|
|
25543
|
+
onPageChange: (event, newPage) => onPageChange(newPage),
|
|
25544
|
+
rowsPerPage: pageSize,
|
|
25545
|
+
onRowsPerPageChange: event => {
|
|
25546
|
+
onPageSizeChange(parseInt(event.target.value, 10));
|
|
25547
|
+
},
|
|
25548
|
+
rowsPerPageOptions: displayRowsPerPage ? rowsPerPageOptions : []
|
|
25554
25549
|
}, paginationProps)) : null);
|
|
25555
25550
|
};
|
|
25556
25551
|
|
|
@@ -25576,9 +25571,11 @@ const ControlledPagination = _ref3 => {
|
|
|
25576
25571
|
displayPagination = false,
|
|
25577
25572
|
selectionStatus,
|
|
25578
25573
|
apiRef,
|
|
25579
|
-
|
|
25580
|
-
|
|
25581
|
-
|
|
25574
|
+
page,
|
|
25575
|
+
onPageChange,
|
|
25576
|
+
pageSize,
|
|
25577
|
+
onPageSizeChange,
|
|
25578
|
+
rowsPerPageOptions,
|
|
25582
25579
|
isRowSelectable,
|
|
25583
25580
|
paginationProps
|
|
25584
25581
|
} = _ref3;
|
|
@@ -25608,25 +25605,17 @@ const ControlledPagination = _ref3 => {
|
|
|
25608
25605
|
}, `${selectionStatus.numberOfSelectedRows} row${selectionStatus.numberOfSelectedRows > 1 ? 's' : ''} selected`) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$2({
|
|
25609
25606
|
component: "div",
|
|
25610
25607
|
count: numberOfFilteredRowsInTable,
|
|
25611
|
-
page:
|
|
25612
|
-
onPageChange: (event,
|
|
25613
|
-
|
|
25614
|
-
page,
|
|
25615
|
-
pageSize: paginationModel.pageSize
|
|
25616
|
-
});
|
|
25617
|
-
},
|
|
25618
|
-
rowsPerPage: paginationModel.pageSize,
|
|
25608
|
+
page: page,
|
|
25609
|
+
onPageChange: (event, newPage) => onPageChange(newPage),
|
|
25610
|
+
rowsPerPage: pageSize,
|
|
25619
25611
|
onRowsPerPageChange: event => {
|
|
25620
|
-
|
|
25621
|
-
page: paginationModel.page,
|
|
25622
|
-
pageSize: parseInt(event.target.value, 10)
|
|
25623
|
-
});
|
|
25612
|
+
onPageSizeChange(parseInt(event.target.value, 10));
|
|
25624
25613
|
},
|
|
25625
|
-
rowsPerPageOptions: displayRowsPerPage ?
|
|
25614
|
+
rowsPerPageOptions: displayRowsPerPage ? rowsPerPageOptions : []
|
|
25626
25615
|
}, paginationProps)) : null);
|
|
25627
25616
|
};
|
|
25628
25617
|
|
|
25629
|
-
const _excluded$3 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "
|
|
25618
|
+
const _excluded$3 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "page", "onPageChange", "pageSize", "onPageSizeChange", "rowsPerPageOptions", "paginationProps", "paginationMode", "rowCount"];
|
|
25630
25619
|
const ToolbarWrapper = _ref => {
|
|
25631
25620
|
let {
|
|
25632
25621
|
hideToolbar,
|
|
@@ -25638,9 +25627,11 @@ const ToolbarWrapper = _ref => {
|
|
|
25638
25627
|
selectionStatus,
|
|
25639
25628
|
apiRef,
|
|
25640
25629
|
isRowSelectable,
|
|
25641
|
-
|
|
25642
|
-
|
|
25643
|
-
|
|
25630
|
+
page,
|
|
25631
|
+
onPageChange,
|
|
25632
|
+
pageSize,
|
|
25633
|
+
onPageSizeChange,
|
|
25634
|
+
rowsPerPageOptions,
|
|
25644
25635
|
paginationProps,
|
|
25645
25636
|
paginationMode = 'client',
|
|
25646
25637
|
rowCount
|
|
@@ -25654,9 +25645,11 @@ const ToolbarWrapper = _ref => {
|
|
|
25654
25645
|
displayRowsPerPage: false,
|
|
25655
25646
|
displayPagination: ['top', 'both'].includes(paginationPlacement),
|
|
25656
25647
|
selectionStatus: selectionStatus.current,
|
|
25657
|
-
|
|
25658
|
-
|
|
25659
|
-
|
|
25648
|
+
page: page,
|
|
25649
|
+
onPageChange: onPageChange,
|
|
25650
|
+
pageSize: pageSize,
|
|
25651
|
+
onPageSizeChange: onPageSizeChange,
|
|
25652
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
25660
25653
|
paginationProps: paginationProps,
|
|
25661
25654
|
rowCount: rowCount
|
|
25662
25655
|
}) : /*#__PURE__*/React__default.createElement(ControlledPagination, {
|
|
@@ -25666,26 +25659,30 @@ const ToolbarWrapper = _ref => {
|
|
|
25666
25659
|
selectionStatus: selectionStatus.current,
|
|
25667
25660
|
apiRef: apiRef,
|
|
25668
25661
|
isRowSelectable: isRowSelectable,
|
|
25669
|
-
|
|
25670
|
-
|
|
25671
|
-
|
|
25662
|
+
page: page,
|
|
25663
|
+
onPageChange: onPageChange,
|
|
25664
|
+
pageSize: pageSize,
|
|
25665
|
+
onPageSizeChange: onPageSizeChange,
|
|
25666
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
25672
25667
|
paginationProps: paginationProps
|
|
25673
25668
|
}) : null);
|
|
25674
25669
|
};
|
|
25675
25670
|
|
|
25676
25671
|
const useControlledDatagridState = _ref => {
|
|
25677
|
-
var
|
|
25672
|
+
var _initialState$paginat, _initialState$paginat2;
|
|
25678
25673
|
let {
|
|
25679
25674
|
initialState,
|
|
25680
|
-
|
|
25675
|
+
rowsPerPageOptions,
|
|
25681
25676
|
propsColumnVisibilityModel,
|
|
25682
25677
|
propsFilterModel,
|
|
25683
25678
|
propsOnColumnVisibilityModelChange,
|
|
25684
25679
|
propsOnFilterModelChange,
|
|
25685
|
-
|
|
25680
|
+
propsOnPageChange,
|
|
25681
|
+
propsOnPageSizeChange,
|
|
25686
25682
|
propsOnPinnedColumnsChange,
|
|
25687
25683
|
propsOnSortModelChange,
|
|
25688
|
-
|
|
25684
|
+
propsPage,
|
|
25685
|
+
propsPageSize,
|
|
25689
25686
|
propsPinnedColumns,
|
|
25690
25687
|
propsSortModel
|
|
25691
25688
|
} = _ref;
|
|
@@ -25733,22 +25730,33 @@ const useControlledDatagridState = _ref => {
|
|
|
25733
25730
|
setSortModel(model);
|
|
25734
25731
|
}
|
|
25735
25732
|
};
|
|
25736
|
-
const [
|
|
25737
|
-
|
|
25738
|
-
|
|
25739
|
-
|
|
25740
|
-
|
|
25741
|
-
if (propsOnPaginationModelChange) {
|
|
25742
|
-
propsOnPaginationModelChange(model, details);
|
|
25733
|
+
const [page, setPage] = useState((initialState === null || initialState === void 0 ? void 0 : (_initialState$paginat = initialState.pagination) === null || _initialState$paginat === void 0 ? void 0 : _initialState$paginat.page) || propsPage || 0);
|
|
25734
|
+
const [pageSize, setPageSize] = useState((initialState === null || initialState === void 0 ? void 0 : (_initialState$paginat2 = initialState.pagination) === null || _initialState$paginat2 === void 0 ? void 0 : _initialState$paginat2.pageSize) || propsPageSize || (rowsPerPageOptions === null || rowsPerPageOptions === void 0 ? void 0 : rowsPerPageOptions[0]) || 25);
|
|
25735
|
+
const onPageChange = page => {
|
|
25736
|
+
if (propsOnPageChange) {
|
|
25737
|
+
propsOnPageChange(page, undefined);
|
|
25743
25738
|
} else {
|
|
25744
|
-
|
|
25739
|
+
setPage(page);
|
|
25745
25740
|
}
|
|
25746
25741
|
};
|
|
25747
25742
|
useEffect(() => {
|
|
25748
|
-
if (
|
|
25749
|
-
|
|
25743
|
+
if (propsPage || propsPage === 0) {
|
|
25744
|
+
setPage(propsPage);
|
|
25745
|
+
}
|
|
25746
|
+
}, [propsPage]);
|
|
25747
|
+
const onPageSizeChange = pageSize => {
|
|
25748
|
+
onPageChange(0);
|
|
25749
|
+
if (propsOnPageSizeChange) {
|
|
25750
|
+
propsOnPageSizeChange(pageSize, undefined);
|
|
25751
|
+
} else {
|
|
25752
|
+
setPageSize(pageSize);
|
|
25750
25753
|
}
|
|
25751
|
-
}
|
|
25754
|
+
};
|
|
25755
|
+
useEffect(() => {
|
|
25756
|
+
if (propsPageSize) {
|
|
25757
|
+
setPageSize(propsPageSize);
|
|
25758
|
+
}
|
|
25759
|
+
}, [propsPageSize]);
|
|
25752
25760
|
return {
|
|
25753
25761
|
filterModel,
|
|
25754
25762
|
onFilterModelChange,
|
|
@@ -25758,12 +25766,14 @@ const useControlledDatagridState = _ref => {
|
|
|
25758
25766
|
onPinnedColumnsChange,
|
|
25759
25767
|
sortModel,
|
|
25760
25768
|
onSortModelChange,
|
|
25761
|
-
|
|
25762
|
-
|
|
25769
|
+
page,
|
|
25770
|
+
pageSize,
|
|
25771
|
+
onPageChange,
|
|
25772
|
+
onPageSizeChange
|
|
25763
25773
|
};
|
|
25764
25774
|
};
|
|
25765
25775
|
|
|
25766
|
-
const _excluded$2 = ["apiRef", "autoHeight", "className", "
|
|
25776
|
+
const _excluded$2 = ["apiRef", "autoHeight", "className", "columnTypes", "components", "componentsProps", "filterModel", "columnVisibilityModel", "pinnedColumns", "sortModel", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "onFilterModelChange", "onPageChange", "onPageSizeChange", "onColumnVisibilityModelChange", "onPinnedColumnsChange", "onSortModelChange", "selectionModel", "onSelectionModelChange", "page", "pageSize", "pagination", "paginationPlacement", "paginationProps", "rows", "rowsPerPageOptions", "sx", "theme", "paginationMode", "rowCount"];
|
|
25767
25777
|
const COMPONENT_NAME$2 = 'DataGrid';
|
|
25768
25778
|
const CLASSNAME$2 = 'redsift-datagrid';
|
|
25769
25779
|
const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
@@ -25772,30 +25782,33 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
25772
25782
|
apiRef: propsApiRef,
|
|
25773
25783
|
autoHeight,
|
|
25774
25784
|
className,
|
|
25775
|
-
|
|
25776
|
-
|
|
25785
|
+
columnTypes: propsColumnTypes,
|
|
25786
|
+
components,
|
|
25787
|
+
componentsProps,
|
|
25777
25788
|
filterModel: propsFilterModel,
|
|
25778
25789
|
columnVisibilityModel: propsColumnVisibilityModel,
|
|
25779
25790
|
pinnedColumns: propsPinnedColumns,
|
|
25780
25791
|
sortModel: propsSortModel,
|
|
25781
|
-
paginationModel: propsPaginationModel,
|
|
25782
25792
|
height: propsHeight,
|
|
25783
25793
|
hideToolbar,
|
|
25784
25794
|
initialState,
|
|
25785
25795
|
isRowSelectable,
|
|
25786
25796
|
license = process.env.MUI_LICENSE_KEY,
|
|
25787
25797
|
onFilterModelChange: propsOnFilterModelChange,
|
|
25788
|
-
|
|
25789
|
-
|
|
25790
|
-
onRowSelectionModelChange: propsOnRowSelectionModelChange,
|
|
25798
|
+
onPageChange: propsOnPageChange,
|
|
25799
|
+
onPageSizeChange: propsOnPageSizeChange,
|
|
25791
25800
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
25792
25801
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
25793
25802
|
onSortModelChange: propsOnSortModelChange,
|
|
25803
|
+
selectionModel: propsSelectionModel,
|
|
25804
|
+
onSelectionModelChange: propsOnSelectionModelChange,
|
|
25805
|
+
page: propsPage,
|
|
25806
|
+
pageSize: propsPageSize,
|
|
25794
25807
|
pagination,
|
|
25795
25808
|
paginationPlacement = 'both',
|
|
25796
25809
|
paginationProps,
|
|
25797
25810
|
rows,
|
|
25798
|
-
|
|
25811
|
+
rowsPerPageOptions,
|
|
25799
25812
|
sx,
|
|
25800
25813
|
theme: propsTheme,
|
|
25801
25814
|
paginationMode = 'client',
|
|
@@ -25805,7 +25818,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
25805
25818
|
const theme = useTheme$4(propsTheme);
|
|
25806
25819
|
const _apiRef = useGridApiRef();
|
|
25807
25820
|
const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
|
|
25808
|
-
const RenderedToolbar =
|
|
25821
|
+
const RenderedToolbar = components !== null && components !== void 0 && components.Toolbar ? components.Toolbar : Toolbar$2;
|
|
25809
25822
|
LicenseInfo.setLicenseKey(license);
|
|
25810
25823
|
const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
|
|
25811
25824
|
const {
|
|
@@ -25813,52 +25826,56 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
25813
25826
|
filterModel,
|
|
25814
25827
|
onColumnVisibilityModelChange,
|
|
25815
25828
|
onFilterModelChange,
|
|
25816
|
-
|
|
25829
|
+
onPageChange,
|
|
25830
|
+
onPageSizeChange,
|
|
25817
25831
|
onPinnedColumnsChange,
|
|
25818
25832
|
onSortModelChange,
|
|
25819
|
-
|
|
25833
|
+
page,
|
|
25834
|
+
pageSize,
|
|
25820
25835
|
pinnedColumns,
|
|
25821
25836
|
sortModel
|
|
25822
25837
|
} = useControlledDatagridState({
|
|
25823
25838
|
initialState,
|
|
25824
|
-
|
|
25839
|
+
rowsPerPageOptions,
|
|
25825
25840
|
propsColumnVisibilityModel,
|
|
25826
25841
|
propsFilterModel,
|
|
25827
25842
|
propsOnColumnVisibilityModelChange,
|
|
25828
25843
|
propsOnFilterModelChange,
|
|
25829
25844
|
propsOnPinnedColumnsChange,
|
|
25830
25845
|
propsOnSortModelChange,
|
|
25831
|
-
|
|
25846
|
+
propsPage,
|
|
25847
|
+
propsPageSize,
|
|
25832
25848
|
propsPinnedColumns,
|
|
25833
25849
|
propsSortModel,
|
|
25834
|
-
|
|
25850
|
+
propsOnPageChange,
|
|
25851
|
+
propsOnPageSizeChange
|
|
25835
25852
|
});
|
|
25836
|
-
const [
|
|
25853
|
+
const [selectionModel, setSelectionModel] = useState(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
|
|
25837
25854
|
useEffect(() => {
|
|
25838
|
-
|
|
25839
|
-
}, [
|
|
25840
|
-
const
|
|
25841
|
-
if (
|
|
25842
|
-
|
|
25855
|
+
setSelectionModel(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
|
|
25856
|
+
}, [propsSelectionModel]);
|
|
25857
|
+
const onSelectionModelChange = (selectionModel, details) => {
|
|
25858
|
+
if (propsOnSelectionModelChange) {
|
|
25859
|
+
propsOnSelectionModelChange(selectionModel, details);
|
|
25843
25860
|
} else {
|
|
25844
|
-
|
|
25861
|
+
setSelectionModel(selectionModel);
|
|
25845
25862
|
}
|
|
25846
25863
|
};
|
|
25847
25864
|
const selectionStatus = useRef({
|
|
25848
25865
|
type: 'none',
|
|
25849
25866
|
numberOfSelectedRows: 0,
|
|
25850
25867
|
numberOfSelectedRowsInPage: 0,
|
|
25851
|
-
page
|
|
25852
|
-
pageSize
|
|
25868
|
+
page,
|
|
25869
|
+
pageSize
|
|
25853
25870
|
});
|
|
25854
25871
|
|
|
25855
25872
|
// in server-side pagination we want to update the selection status
|
|
25856
25873
|
// every time we navigate between pages, resize our page or select something
|
|
25857
25874
|
useEffect(() => {
|
|
25858
25875
|
if (paginationMode == 'server') {
|
|
25859
|
-
onServerSideSelectionStatusChange(Array.isArray(
|
|
25876
|
+
onServerSideSelectionStatusChange(Array.isArray(selectionModel) ? selectionModel : [selectionModel], apiRef, selectionStatus, isRowSelectable, page, pageSize);
|
|
25860
25877
|
}
|
|
25861
|
-
}, [
|
|
25878
|
+
}, [selectionModel, page, pageSize]);
|
|
25862
25879
|
if (!Array.isArray(rows)) {
|
|
25863
25880
|
return null;
|
|
25864
25881
|
}
|
|
@@ -25889,54 +25906,57 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
25889
25906
|
apiRef: apiRef,
|
|
25890
25907
|
autoHeight: autoHeight,
|
|
25891
25908
|
checkboxSelectionVisibleOnly: Boolean(pagination),
|
|
25892
|
-
|
|
25893
|
-
|
|
25894
|
-
|
|
25895
|
-
|
|
25896
|
-
|
|
25897
|
-
|
|
25909
|
+
columnTypes: _objectSpread2(_objectSpread2({}, customColumnTypes), propsColumnTypes),
|
|
25910
|
+
components: _objectSpread2(_objectSpread2({
|
|
25911
|
+
BaseButton,
|
|
25912
|
+
BaseCheckbox,
|
|
25913
|
+
// BaseTextField,
|
|
25914
|
+
BasePopper,
|
|
25915
|
+
ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
25898
25916
|
displayName: "ColumnFilteredIcon"
|
|
25899
25917
|
})),
|
|
25900
|
-
|
|
25918
|
+
ColumnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
25901
25919
|
displayName: "ColumnSelectorIcon"
|
|
25902
25920
|
})),
|
|
25903
|
-
|
|
25921
|
+
ColumnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
25904
25922
|
displayName: "ColumnSortedAscendingIcon"
|
|
25905
25923
|
})),
|
|
25906
|
-
|
|
25924
|
+
ColumnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
25907
25925
|
displayName: "ColumnSortedDescendingIcon"
|
|
25908
25926
|
})),
|
|
25909
|
-
|
|
25927
|
+
DensityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
25910
25928
|
displayName: "DensityCompactIcon"
|
|
25911
25929
|
})),
|
|
25912
|
-
|
|
25930
|
+
DensityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
25913
25931
|
displayName: "DensityStandardIcon"
|
|
25914
25932
|
})),
|
|
25915
|
-
|
|
25933
|
+
DensityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
25916
25934
|
displayName: "DensityComfortableIcon"
|
|
25917
25935
|
})),
|
|
25918
|
-
|
|
25936
|
+
DetailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
25919
25937
|
displayName: "DetailPanelCollapseIcon"
|
|
25920
25938
|
})),
|
|
25921
|
-
|
|
25939
|
+
DetailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
25922
25940
|
displayName: "DetailPanelExpandIcon"
|
|
25923
25941
|
})),
|
|
25924
|
-
|
|
25942
|
+
ExportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
25925
25943
|
displayName: "ExportIcon"
|
|
25926
25944
|
})),
|
|
25927
|
-
|
|
25945
|
+
OpenFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({
|
|
25928
25946
|
displayName: "OpenFilterButtonIcon"
|
|
25929
25947
|
}, props))
|
|
25930
|
-
},
|
|
25931
|
-
|
|
25932
|
-
|
|
25948
|
+
}, components), {}, {
|
|
25949
|
+
Toolbar: ToolbarWrapper,
|
|
25950
|
+
Pagination: props => pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$2({}, props, {
|
|
25933
25951
|
displaySelection: false,
|
|
25934
25952
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
25935
25953
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
25936
25954
|
selectionStatus: selectionStatus.current,
|
|
25937
|
-
|
|
25938
|
-
|
|
25939
|
-
|
|
25955
|
+
page: page,
|
|
25956
|
+
onPageChange: onPageChange,
|
|
25957
|
+
pageSize: pageSize,
|
|
25958
|
+
onPageSizeChange: onPageSizeChange,
|
|
25959
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
25940
25960
|
paginationProps: paginationProps,
|
|
25941
25961
|
paginationMode: paginationMode,
|
|
25942
25962
|
rowCount: rowCount
|
|
@@ -25947,14 +25967,16 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
25947
25967
|
selectionStatus: selectionStatus.current,
|
|
25948
25968
|
apiRef: apiRef,
|
|
25949
25969
|
isRowSelectable: isRowSelectable,
|
|
25950
|
-
|
|
25951
|
-
|
|
25952
|
-
|
|
25970
|
+
page: page,
|
|
25971
|
+
onPageChange: onPageChange,
|
|
25972
|
+
pageSize: pageSize,
|
|
25973
|
+
onPageSizeChange: onPageSizeChange,
|
|
25974
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
25953
25975
|
paginationProps: paginationProps,
|
|
25954
25976
|
paginationMode: paginationMode
|
|
25955
25977
|
})) : null
|
|
25956
25978
|
}),
|
|
25957
|
-
|
|
25979
|
+
componentsProps: _objectSpread2(_objectSpread2({}, componentsProps), {}, {
|
|
25958
25980
|
toolbar: _objectSpread2({
|
|
25959
25981
|
hideToolbar,
|
|
25960
25982
|
RenderedToolbar,
|
|
@@ -25965,13 +25987,15 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
25965
25987
|
selectionStatus,
|
|
25966
25988
|
apiRef,
|
|
25967
25989
|
isRowSelectable,
|
|
25968
|
-
|
|
25969
|
-
|
|
25970
|
-
|
|
25990
|
+
page,
|
|
25991
|
+
onPageChange,
|
|
25992
|
+
pageSize,
|
|
25993
|
+
onPageSizeChange,
|
|
25994
|
+
rowsPerPageOptions,
|
|
25971
25995
|
paginationProps,
|
|
25972
25996
|
paginationMode,
|
|
25973
25997
|
rowCount
|
|
25974
|
-
},
|
|
25998
|
+
}, componentsProps === null || componentsProps === void 0 ? void 0 : componentsProps.toolbar)
|
|
25975
25999
|
}),
|
|
25976
26000
|
filterModel: filterModel,
|
|
25977
26001
|
columnVisibilityModel: columnVisibilityModel,
|
|
@@ -25987,11 +26011,13 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
25987
26011
|
paginationMode: paginationMode,
|
|
25988
26012
|
keepNonExistentRowsSelected: paginationMode == 'server',
|
|
25989
26013
|
rows: rows,
|
|
25990
|
-
|
|
25991
|
-
|
|
25992
|
-
|
|
25993
|
-
|
|
25994
|
-
|
|
26014
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
26015
|
+
page: page,
|
|
26016
|
+
onPageChange: onPageChange,
|
|
26017
|
+
pageSize: pageSize,
|
|
26018
|
+
onPageSizeChange: onPageSizeChange,
|
|
26019
|
+
selectionModel: selectionModel,
|
|
26020
|
+
onSelectionModelChange: (newSelectionModel, details) => {
|
|
25995
26021
|
if (pagination && paginationMode != 'server') {
|
|
25996
26022
|
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
|
|
25997
26023
|
let {
|
|
@@ -26049,7 +26075,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26049
26075
|
};
|
|
26050
26076
|
}
|
|
26051
26077
|
}
|
|
26052
|
-
|
|
26078
|
+
onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(newSelectionModel, details);
|
|
26053
26079
|
},
|
|
26054
26080
|
sx: _objectSpread2(_objectSpread2({}, sx), {}, {
|
|
26055
26081
|
'.MuiDataGrid-columnHeaders': {
|
|
@@ -26066,6 +26092,8 @@ DataGrid.className = CLASSNAME$2;
|
|
|
26066
26092
|
DataGrid.displayName = COMPONENT_NAME$2;
|
|
26067
26093
|
|
|
26068
26094
|
// Get and Set data from LocalStorage WITHOUT useState
|
|
26095
|
+
|
|
26096
|
+
// triggering a state update and consecutive re-render
|
|
26069
26097
|
const useFetchState = (defaultValue, key) => {
|
|
26070
26098
|
let stickyValue = null;
|
|
26071
26099
|
try {
|
|
@@ -26073,7 +26101,16 @@ const useFetchState = (defaultValue, key) => {
|
|
|
26073
26101
|
} catch (e) {
|
|
26074
26102
|
console.error('StatefulDataGrid: error getting item from local storage: ', e);
|
|
26075
26103
|
}
|
|
26076
|
-
|
|
26104
|
+
let parsedValue = stickyValue !== null && stickyValue !== undefined && stickyValue !== 'undefined' ? JSON.parse(stickyValue) : defaultValue;
|
|
26105
|
+
|
|
26106
|
+
// TODO: temporary workaround to avoid clashes when someone had sorting on the now-removed screenshot field (renamed to num_annotations)
|
|
26107
|
+
// 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
|
|
26108
|
+
if (parsedValue instanceof Array) {
|
|
26109
|
+
const fields = (parsedValue || []).map(item => item.field);
|
|
26110
|
+
if (fields.includes('screenshot') || fields.includes('diffs')) {
|
|
26111
|
+
parsedValue = defaultValue;
|
|
26112
|
+
}
|
|
26113
|
+
}
|
|
26077
26114
|
const updateValue = useCallback(value => {
|
|
26078
26115
|
try {
|
|
26079
26116
|
window.localStorage.setItem(key, JSON.stringify(value));
|
|
@@ -26084,8 +26121,6 @@ const useFetchState = (defaultValue, key) => {
|
|
|
26084
26121
|
return [parsedValue, updateValue];
|
|
26085
26122
|
};
|
|
26086
26123
|
|
|
26087
|
-
// import useLocalStorage from './useLocalStorage';
|
|
26088
|
-
|
|
26089
26124
|
const useTableStates = (id, version, customDefaults) => {
|
|
26090
26125
|
const [paginationModel, setPaginationModel] = useFetchState('', buildStorageKey({
|
|
26091
26126
|
id,
|
|
@@ -26141,7 +26176,8 @@ const useStatefulTable = props => {
|
|
|
26141
26176
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
26142
26177
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
26143
26178
|
onFilterModelChange: propsOnFilterModelChange,
|
|
26144
|
-
|
|
26179
|
+
onPageChange: propsOnPageChange,
|
|
26180
|
+
onPageSizeChange: propsOnPageSizeChange,
|
|
26145
26181
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
26146
26182
|
onSortModelChange: propsOnSortModelChange,
|
|
26147
26183
|
pinnedCustomColumns = {
|
|
@@ -26212,6 +26248,7 @@ const useStatefulTable = props => {
|
|
|
26212
26248
|
column.width = dimensionModel[column.field] || column.width || 100;
|
|
26213
26249
|
return column;
|
|
26214
26250
|
}), [propsColumns, dimensionModel]);
|
|
26251
|
+
|
|
26215
26252
|
/** Add resetPage method to apiRef. */
|
|
26216
26253
|
apiRef.current.resetPage = () => {
|
|
26217
26254
|
apiRef.current.setPage(0);
|
|
@@ -26222,7 +26259,7 @@ const useStatefulTable = props => {
|
|
|
26222
26259
|
onFilterModelChange: (model, details) => {
|
|
26223
26260
|
const filterModel = _objectSpread2(_objectSpread2({}, model), {}, {
|
|
26224
26261
|
items: model.items.map(item => {
|
|
26225
|
-
const column = apiRef.current.getColumn(item.
|
|
26262
|
+
const column = apiRef.current.getColumn(item.columnField);
|
|
26226
26263
|
item.type = column.type || 'string';
|
|
26227
26264
|
return item;
|
|
26228
26265
|
})
|
|
@@ -26259,16 +26296,33 @@ const useStatefulTable = props => {
|
|
|
26259
26296
|
}, search, historyReplace, columns);
|
|
26260
26297
|
},
|
|
26261
26298
|
pinnedColumns: pinnedColumnsModel,
|
|
26262
|
-
|
|
26263
|
-
|
|
26264
|
-
|
|
26265
|
-
|
|
26266
|
-
|
|
26267
|
-
propsOnPaginationModelChange === null || propsOnPaginationModelChange === void 0 ? void 0 : propsOnPaginationModelChange(paginationModel, details);
|
|
26299
|
+
page: paginationModelParsed.page,
|
|
26300
|
+
pageSize: paginationModelParsed.pageSize,
|
|
26301
|
+
onPageChange: (page, details) => {
|
|
26302
|
+
const direction = paginationModelParsed.page < page ? 'next' : 'back';
|
|
26303
|
+
propsOnPageChange === null || propsOnPageChange === void 0 ? void 0 : propsOnPageChange(page, details);
|
|
26268
26304
|
updateUrl({
|
|
26269
26305
|
filterModel: filterParsed,
|
|
26270
26306
|
sortModel: sortModelParsed,
|
|
26271
|
-
paginationModel:
|
|
26307
|
+
paginationModel: {
|
|
26308
|
+
page,
|
|
26309
|
+
pageSize: paginationModelParsed.pageSize,
|
|
26310
|
+
direction
|
|
26311
|
+
},
|
|
26312
|
+
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
26313
|
+
pinnedColumnsModel: pinnedColumnsModel
|
|
26314
|
+
}, search, historyReplace, columns);
|
|
26315
|
+
},
|
|
26316
|
+
onPageSizeChange: (pageSize, details) => {
|
|
26317
|
+
propsOnPageSizeChange === null || propsOnPageSizeChange === void 0 ? void 0 : propsOnPageSizeChange(pageSize, details);
|
|
26318
|
+
updateUrl({
|
|
26319
|
+
filterModel: filterParsed,
|
|
26320
|
+
sortModel: sortModelParsed,
|
|
26321
|
+
paginationModel: {
|
|
26322
|
+
page: paginationModelParsed.page,
|
|
26323
|
+
pageSize,
|
|
26324
|
+
direction: paginationModelParsed.direction
|
|
26325
|
+
},
|
|
26272
26326
|
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
26273
26327
|
pinnedColumnsModel: pinnedColumnsModel
|
|
26274
26328
|
}, search, historyReplace, columns);
|
|
@@ -26294,7 +26348,7 @@ const useStatefulTable = props => {
|
|
|
26294
26348
|
};
|
|
26295
26349
|
};
|
|
26296
26350
|
|
|
26297
|
-
const _excluded$1 = ["apiRef", "autoHeight", "className", "columns", "
|
|
26351
|
+
const _excluded$1 = ["apiRef", "autoHeight", "className", "columns", "columnTypes", "components", "componentsProps", "filterModel", "columnVisibilityModel", "pinnedColumns", "sortModel", "page", "pageSize", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "localStorageVersion", "onFilterModelChange", "selectionModel", "onColumnWidthChange", "onPageChange", "onPageSizeChange", "onSelectionModelChange", "onColumnVisibilityModelChange", "onPinnedColumnsChange", "onSortModelChange", "pagination", "paginationPlacement", "paginationProps", "pinnedCustomColumns", "rows", "rowsPerPageOptions", "sx", "theme", "useRouter", "paginationMode", "rowCount"];
|
|
26298
26352
|
const COMPONENT_NAME$1 = 'DataGrid';
|
|
26299
26353
|
const CLASSNAME$1 = 'redsift-datagrid';
|
|
26300
26354
|
const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
@@ -26304,13 +26358,15 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26304
26358
|
autoHeight,
|
|
26305
26359
|
className,
|
|
26306
26360
|
columns,
|
|
26307
|
-
|
|
26308
|
-
|
|
26361
|
+
columnTypes: propsColumnTypes,
|
|
26362
|
+
components,
|
|
26363
|
+
componentsProps,
|
|
26309
26364
|
filterModel: propsFilterModel,
|
|
26310
26365
|
columnVisibilityModel: propsColumnVisibilityModel,
|
|
26311
26366
|
pinnedColumns: propsPinnedColumns,
|
|
26312
26367
|
sortModel: propsSortModel,
|
|
26313
|
-
|
|
26368
|
+
page: propsPage,
|
|
26369
|
+
pageSize: propsPageSize,
|
|
26314
26370
|
height: propsHeight,
|
|
26315
26371
|
hideToolbar,
|
|
26316
26372
|
initialState,
|
|
@@ -26318,10 +26374,11 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26318
26374
|
license = process.env.MUI_LICENSE_KEY,
|
|
26319
26375
|
localStorageVersion,
|
|
26320
26376
|
onFilterModelChange: propsOnFilterModelChange,
|
|
26321
|
-
|
|
26377
|
+
selectionModel: propsSelectionModel,
|
|
26322
26378
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
26323
|
-
|
|
26324
|
-
|
|
26379
|
+
onPageChange: propsOnPageChange,
|
|
26380
|
+
onPageSizeChange: propsOnPageSizeChange,
|
|
26381
|
+
onSelectionModelChange: propsOnSelectionModelChange,
|
|
26325
26382
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
26326
26383
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
26327
26384
|
onSortModelChange: propsOnSortModelChange,
|
|
@@ -26330,7 +26387,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26330
26387
|
paginationProps,
|
|
26331
26388
|
pinnedCustomColumns,
|
|
26332
26389
|
rows,
|
|
26333
|
-
|
|
26390
|
+
rowsPerPageOptions,
|
|
26334
26391
|
sx,
|
|
26335
26392
|
theme: propsTheme,
|
|
26336
26393
|
useRouter,
|
|
@@ -26341,38 +26398,43 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26341
26398
|
const theme = useTheme$4(propsTheme);
|
|
26342
26399
|
const _apiRef = useGridApiRef();
|
|
26343
26400
|
const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
|
|
26344
|
-
const RenderedToolbar =
|
|
26401
|
+
const RenderedToolbar = components !== null && components !== void 0 && components.Toolbar ? components.Toolbar : Toolbar$2;
|
|
26345
26402
|
LicenseInfo.setLicenseKey(license);
|
|
26346
26403
|
const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
|
|
26347
26404
|
const {
|
|
26348
26405
|
onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
|
|
26349
26406
|
onFilterModelChange: controlledOnFilterModelChange,
|
|
26350
|
-
|
|
26407
|
+
onPageChange: controlledOnPageChange,
|
|
26408
|
+
onPageSizeChange: controlledOnPageSizeChange,
|
|
26351
26409
|
onPinnedColumnsChange: controlledOnPinnedColumnsChange,
|
|
26352
26410
|
onSortModelChange: controlledOnSortModelChange
|
|
26353
26411
|
} = useControlledDatagridState({
|
|
26354
26412
|
initialState,
|
|
26355
|
-
|
|
26413
|
+
rowsPerPageOptions,
|
|
26356
26414
|
propsColumnVisibilityModel,
|
|
26357
26415
|
propsFilterModel,
|
|
26358
26416
|
propsOnColumnVisibilityModelChange,
|
|
26359
26417
|
propsOnFilterModelChange,
|
|
26360
26418
|
propsOnPinnedColumnsChange,
|
|
26361
26419
|
propsOnSortModelChange,
|
|
26362
|
-
|
|
26420
|
+
propsPage,
|
|
26421
|
+
propsPageSize,
|
|
26363
26422
|
propsPinnedColumns,
|
|
26364
26423
|
propsSortModel,
|
|
26365
|
-
|
|
26424
|
+
propsOnPageChange,
|
|
26425
|
+
propsOnPageSizeChange
|
|
26366
26426
|
});
|
|
26367
26427
|
const {
|
|
26368
26428
|
columnVisibilityModel,
|
|
26369
26429
|
filterModel,
|
|
26370
26430
|
onColumnVisibilityModelChange,
|
|
26371
26431
|
onFilterModelChange,
|
|
26372
|
-
|
|
26432
|
+
onPageChange,
|
|
26433
|
+
onPageSizeChange,
|
|
26373
26434
|
onPinnedColumnsChange,
|
|
26374
26435
|
onSortModelChange,
|
|
26375
|
-
|
|
26436
|
+
page,
|
|
26437
|
+
pageSize,
|
|
26376
26438
|
pinnedColumns,
|
|
26377
26439
|
sortModel,
|
|
26378
26440
|
onColumnWidthChange
|
|
@@ -26382,39 +26444,40 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26382
26444
|
onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
|
|
26383
26445
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
26384
26446
|
onFilterModelChange: controlledOnFilterModelChange,
|
|
26385
|
-
|
|
26447
|
+
onPageChange: controlledOnPageChange,
|
|
26448
|
+
onPageSizeChange: controlledOnPageSizeChange,
|
|
26386
26449
|
onPinnedColumnsChange: controlledOnPinnedColumnsChange,
|
|
26387
26450
|
onSortModelChange: controlledOnSortModelChange,
|
|
26388
26451
|
pinnedCustomColumns,
|
|
26389
26452
|
useRouter: useRouter,
|
|
26390
26453
|
localStorageVersion
|
|
26391
26454
|
});
|
|
26392
|
-
const [
|
|
26455
|
+
const [selectionModel, setSelectionModel] = useState(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
|
|
26393
26456
|
useEffect(() => {
|
|
26394
|
-
|
|
26395
|
-
}, [
|
|
26396
|
-
const
|
|
26397
|
-
if (
|
|
26398
|
-
|
|
26457
|
+
setSelectionModel(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
|
|
26458
|
+
}, [propsSelectionModel]);
|
|
26459
|
+
const onSelectionModelChange = (selectionModel, details) => {
|
|
26460
|
+
if (propsOnSelectionModelChange) {
|
|
26461
|
+
propsOnSelectionModelChange(selectionModel, details);
|
|
26399
26462
|
} else {
|
|
26400
|
-
|
|
26463
|
+
setSelectionModel(selectionModel);
|
|
26401
26464
|
}
|
|
26402
26465
|
};
|
|
26403
26466
|
const selectionStatus = useRef({
|
|
26404
26467
|
type: 'none',
|
|
26405
26468
|
numberOfSelectedRows: 0,
|
|
26406
26469
|
numberOfSelectedRowsInPage: 0,
|
|
26407
|
-
page
|
|
26408
|
-
pageSize:
|
|
26470
|
+
page,
|
|
26471
|
+
pageSize: pageSize
|
|
26409
26472
|
});
|
|
26410
26473
|
|
|
26411
26474
|
// in server-side pagination we want to update the selection status
|
|
26412
26475
|
// every time we navigate between pages, resize our page or select something
|
|
26413
26476
|
useEffect(() => {
|
|
26414
26477
|
if (paginationMode == 'server') {
|
|
26415
|
-
onServerSideSelectionStatusChange(Array.isArray(
|
|
26478
|
+
onServerSideSelectionStatusChange(Array.isArray(selectionModel) ? selectionModel : [selectionModel], apiRef, selectionStatus, isRowSelectable, page, pageSize);
|
|
26416
26479
|
}
|
|
26417
|
-
}, [
|
|
26480
|
+
}, [selectionModel, page, pageSize]);
|
|
26418
26481
|
if (!Array.isArray(rows)) {
|
|
26419
26482
|
return null;
|
|
26420
26483
|
}
|
|
@@ -26447,13 +26510,15 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26447
26510
|
filterModel: filterModel,
|
|
26448
26511
|
onColumnVisibilityModelChange: onColumnVisibilityModelChange,
|
|
26449
26512
|
onFilterModelChange: onFilterModelChange,
|
|
26450
|
-
|
|
26513
|
+
onPageChange: onPageChange,
|
|
26514
|
+
onPageSizeChange: onPageSizeChange,
|
|
26451
26515
|
onPinnedColumnsChange: onPinnedColumnsChange,
|
|
26452
26516
|
onSortModelChange: onSortModelChange,
|
|
26453
|
-
|
|
26517
|
+
page: page,
|
|
26518
|
+
pageSize: pageSize,
|
|
26454
26519
|
pinnedColumns: pinnedColumns,
|
|
26455
26520
|
sortModel: sortModel,
|
|
26456
|
-
|
|
26521
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
26457
26522
|
onColumnWidthChange: onColumnWidthChange,
|
|
26458
26523
|
initialState: initialState,
|
|
26459
26524
|
isRowSelectable: isRowSelectable,
|
|
@@ -26464,55 +26529,58 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26464
26529
|
rowCount: rowCount,
|
|
26465
26530
|
autoHeight: autoHeight,
|
|
26466
26531
|
checkboxSelectionVisibleOnly: Boolean(pagination),
|
|
26467
|
-
|
|
26468
|
-
|
|
26469
|
-
|
|
26470
|
-
|
|
26471
|
-
|
|
26472
|
-
|
|
26532
|
+
columnTypes: _objectSpread2(_objectSpread2({}, customColumnTypes), propsColumnTypes),
|
|
26533
|
+
components: _objectSpread2(_objectSpread2({
|
|
26534
|
+
BaseButton,
|
|
26535
|
+
BaseCheckbox,
|
|
26536
|
+
// BaseTextField,
|
|
26537
|
+
BasePopper,
|
|
26538
|
+
ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
26473
26539
|
displayName: "ColumnFilteredIcon"
|
|
26474
26540
|
})),
|
|
26475
|
-
|
|
26541
|
+
ColumnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
26476
26542
|
displayName: "ColumnSelectorIcon"
|
|
26477
26543
|
})),
|
|
26478
|
-
|
|
26544
|
+
ColumnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
26479
26545
|
displayName: "ColumnSortedAscendingIcon"
|
|
26480
26546
|
})),
|
|
26481
|
-
|
|
26547
|
+
ColumnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
26482
26548
|
displayName: "ColumnSortedDescendingIcon"
|
|
26483
26549
|
})),
|
|
26484
|
-
|
|
26550
|
+
DensityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
26485
26551
|
displayName: "DensityCompactIcon"
|
|
26486
26552
|
})),
|
|
26487
|
-
|
|
26553
|
+
DensityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
26488
26554
|
displayName: "DensityStandardIcon"
|
|
26489
26555
|
})),
|
|
26490
|
-
|
|
26556
|
+
DensityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
26491
26557
|
displayName: "DensityComfortableIcon"
|
|
26492
26558
|
})),
|
|
26493
|
-
|
|
26559
|
+
DetailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
26494
26560
|
displayName: "DetailPanelCollapseIcon"
|
|
26495
26561
|
})),
|
|
26496
|
-
|
|
26562
|
+
DetailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
26497
26563
|
displayName: "DetailPanelExpandIcon"
|
|
26498
26564
|
})),
|
|
26499
|
-
|
|
26565
|
+
ExportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
26500
26566
|
displayName: "ExportIcon"
|
|
26501
26567
|
})),
|
|
26502
|
-
|
|
26568
|
+
OpenFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({
|
|
26503
26569
|
displayName: "OpenFilterButtonIcon"
|
|
26504
26570
|
}, props))
|
|
26505
|
-
},
|
|
26506
|
-
|
|
26507
|
-
|
|
26571
|
+
}, components), {}, {
|
|
26572
|
+
Toolbar: ToolbarWrapper,
|
|
26573
|
+
Pagination: props => {
|
|
26508
26574
|
return pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$2({}, props, {
|
|
26509
26575
|
displaySelection: false,
|
|
26510
26576
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
26511
26577
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
26512
26578
|
selectionStatus: selectionStatus.current,
|
|
26513
|
-
|
|
26514
|
-
|
|
26515
|
-
|
|
26579
|
+
page: page,
|
|
26580
|
+
pageSize: pageSize,
|
|
26581
|
+
onPageChange: onPageChange,
|
|
26582
|
+
onPageSizeChange: onPageSizeChange,
|
|
26583
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
26516
26584
|
paginationProps: paginationProps,
|
|
26517
26585
|
paginationMode: paginationMode,
|
|
26518
26586
|
rowCount: rowCount
|
|
@@ -26523,15 +26591,17 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26523
26591
|
selectionStatus: selectionStatus.current,
|
|
26524
26592
|
apiRef: apiRef,
|
|
26525
26593
|
isRowSelectable: isRowSelectable,
|
|
26526
|
-
|
|
26527
|
-
|
|
26528
|
-
|
|
26594
|
+
page: page,
|
|
26595
|
+
pageSize: pageSize,
|
|
26596
|
+
onPageChange: onPageChange,
|
|
26597
|
+
onPageSizeChange: onPageSizeChange,
|
|
26598
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
26529
26599
|
paginationProps: paginationProps,
|
|
26530
26600
|
paginationMode: paginationMode
|
|
26531
26601
|
})) : null;
|
|
26532
26602
|
}
|
|
26533
26603
|
}),
|
|
26534
|
-
|
|
26604
|
+
componentsProps: _objectSpread2(_objectSpread2({}, componentsProps), {}, {
|
|
26535
26605
|
toolbar: _objectSpread2({
|
|
26536
26606
|
hideToolbar,
|
|
26537
26607
|
RenderedToolbar,
|
|
@@ -26542,16 +26612,18 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26542
26612
|
selectionStatus,
|
|
26543
26613
|
apiRef,
|
|
26544
26614
|
isRowSelectable,
|
|
26545
|
-
|
|
26546
|
-
|
|
26547
|
-
|
|
26615
|
+
page,
|
|
26616
|
+
pageSize,
|
|
26617
|
+
onPageChange,
|
|
26618
|
+
onPageSizeChange,
|
|
26619
|
+
rowsPerPageOptions,
|
|
26548
26620
|
paginationProps,
|
|
26549
26621
|
paginationMode,
|
|
26550
26622
|
rowCount
|
|
26551
|
-
},
|
|
26623
|
+
}, componentsProps === null || componentsProps === void 0 ? void 0 : componentsProps.toolbar)
|
|
26552
26624
|
}),
|
|
26553
|
-
|
|
26554
|
-
|
|
26625
|
+
selectionModel: selectionModel,
|
|
26626
|
+
onSelectionModelChange: (newSelectionModel, details) => {
|
|
26555
26627
|
if (pagination && paginationMode != 'server') {
|
|
26556
26628
|
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
|
|
26557
26629
|
let {
|
|
@@ -26609,7 +26681,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26609
26681
|
};
|
|
26610
26682
|
}
|
|
26611
26683
|
}
|
|
26612
|
-
|
|
26684
|
+
onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(newSelectionModel, details);
|
|
26613
26685
|
},
|
|
26614
26686
|
sx: _objectSpread2(_objectSpread2({}, sx), {}, {
|
|
26615
26687
|
'.MuiDataGrid-columnHeaders': {
|
|
@@ -26683,5 +26755,5 @@ const TextCell = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26683
26755
|
TextCell.className = CLASSNAME;
|
|
26684
26756
|
TextCell.displayName = COMPONENT_NAME;
|
|
26685
26757
|
|
|
26686
|
-
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,
|
|
26758
|
+
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 };
|
|
26687
26759
|
//# sourceMappingURL=index.js.map
|