@redsift/table 11.1.2-muiv5 → 11.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +25 -41
- package/index.js +258 -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, 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.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,17 +18133,17 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
18136
18133
|
if (!searchString) {
|
|
18137
18134
|
return {
|
|
18138
18135
|
items: [],
|
|
18139
|
-
|
|
18136
|
+
logicOperator: GridLogicOperator.And
|
|
18140
18137
|
};
|
|
18141
18138
|
}
|
|
18142
|
-
let
|
|
18139
|
+
let logicOperator = GridLogicOperator.And;
|
|
18143
18140
|
const searchParams = new URLSearchParams();
|
|
18144
18141
|
for (const [key, value] of new URLSearchParams(searchString)) {
|
|
18145
18142
|
if (key.startsWith('_') && !['_logicOperator', '_sortColumn', '_pinnedColumnsLeft', '_pinnedColumnsRight', '_columnVisibility', '_pagination'].includes(key)) {
|
|
18146
18143
|
searchParams.set(key, value);
|
|
18147
18144
|
}
|
|
18148
18145
|
if (key === '_logicOperator') {
|
|
18149
|
-
|
|
18146
|
+
logicOperator = value;
|
|
18150
18147
|
}
|
|
18151
18148
|
}
|
|
18152
18149
|
let id = 5000;
|
|
@@ -18187,8 +18184,8 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
18187
18184
|
return;
|
|
18188
18185
|
}
|
|
18189
18186
|
items.push({
|
|
18190
|
-
|
|
18191
|
-
|
|
18187
|
+
field,
|
|
18188
|
+
operator: columnType === 'number' && Object.keys(numberOperatorDecoder).includes(operator) ? numberOperatorDecoder[operator] : operator,
|
|
18192
18189
|
id,
|
|
18193
18190
|
value: listOperators.includes(operator) && decodedValue === '' ? [] : decodedValue,
|
|
18194
18191
|
type
|
|
@@ -18201,28 +18198,28 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
18201
18198
|
if (isInvalid) {
|
|
18202
18199
|
return {
|
|
18203
18200
|
items: [],
|
|
18204
|
-
|
|
18201
|
+
logicOperator: GridLogicOperator.And
|
|
18205
18202
|
};
|
|
18206
18203
|
}
|
|
18207
18204
|
return {
|
|
18208
18205
|
items,
|
|
18209
|
-
|
|
18206
|
+
logicOperator
|
|
18210
18207
|
};
|
|
18211
18208
|
};
|
|
18212
18209
|
const getSearchParamsFromFilterModel = filterModel => {
|
|
18213
18210
|
const searchParams = new URLSearchParams();
|
|
18214
|
-
searchParams.set('_logicOperator', filterModel['
|
|
18211
|
+
searchParams.set('_logicOperator', filterModel['logicOperator'] || '');
|
|
18215
18212
|
filterModel['items'].forEach(item => {
|
|
18216
18213
|
const {
|
|
18217
|
-
|
|
18218
|
-
|
|
18214
|
+
field,
|
|
18215
|
+
operator,
|
|
18219
18216
|
value,
|
|
18220
18217
|
type
|
|
18221
18218
|
} = item;
|
|
18222
|
-
if (Object.keys(numberOperatorEncoder).includes(
|
|
18223
|
-
searchParams.set(`_${
|
|
18219
|
+
if (Object.keys(numberOperatorEncoder).includes(operator)) {
|
|
18220
|
+
searchParams.set(`_${field}[${numberOperatorEncoder[operator]},${encodeValue(type)}]`, encodeValue(value));
|
|
18224
18221
|
} else {
|
|
18225
|
-
searchParams.set(`_${
|
|
18222
|
+
searchParams.set(`_${field}[${encodeValue(operator)},${encodeValue(type)}]`, encodeValue(value));
|
|
18226
18223
|
}
|
|
18227
18224
|
});
|
|
18228
18225
|
return searchParams;
|
|
@@ -18248,7 +18245,7 @@ const getFilterModel = (search, columns, localStorageFilters, setLocalStorageFil
|
|
|
18248
18245
|
}
|
|
18249
18246
|
return {
|
|
18250
18247
|
items: [],
|
|
18251
|
-
|
|
18248
|
+
logicOperator: GridLogicOperator.And
|
|
18252
18249
|
};
|
|
18253
18250
|
};
|
|
18254
18251
|
|
|
@@ -18371,11 +18368,11 @@ const getPaginationModel = (search, localStoragePagination, setLocalStoragePagin
|
|
|
18371
18368
|
|
|
18372
18369
|
const getSearchParamsFromColumnVisibility = (columnVisibility, columns) => {
|
|
18373
18370
|
const searchParams = new URLSearchParams();
|
|
18374
|
-
const
|
|
18371
|
+
const fields = columns.map(column => column.field);
|
|
18375
18372
|
|
|
18376
18373
|
// if column visibility model is empty, show all columns
|
|
18377
18374
|
if (Object.keys(columnVisibility).length == 0) {
|
|
18378
|
-
searchParams.set('_columnVisibility', `[${
|
|
18375
|
+
searchParams.set('_columnVisibility', `[${fields.join(',')}]`);
|
|
18379
18376
|
return searchParams;
|
|
18380
18377
|
}
|
|
18381
18378
|
const finalColumnVisibility = columns.filter(c => {
|
|
@@ -18425,12 +18422,12 @@ const getColumnVisibilityFromString = (notParsed, tableColumns) => {
|
|
|
18425
18422
|
continue;
|
|
18426
18423
|
}
|
|
18427
18424
|
exist = true;
|
|
18428
|
-
const
|
|
18425
|
+
const fields = tableColumns.map(column => column.field);
|
|
18429
18426
|
// TODO: Add validation that , is present
|
|
18430
18427
|
const columns = encodedValues.split(',').map(value => decodeValue(value));
|
|
18431
18428
|
|
|
18432
18429
|
// for each column, check if it's visible and add it to visibility model
|
|
18433
|
-
for (const column of
|
|
18430
|
+
for (const column of fields) {
|
|
18434
18431
|
const isColumnVisible = columns.includes(column);
|
|
18435
18432
|
visibility[column] = isColumnVisible;
|
|
18436
18433
|
if (isColumnVisible) {
|
|
@@ -18493,8 +18490,8 @@ const getPinnedColumnsFromString = (notParsed, tableColumns) => {
|
|
|
18493
18490
|
if (typeof encodedValues !== 'string') {
|
|
18494
18491
|
continue;
|
|
18495
18492
|
}
|
|
18496
|
-
const
|
|
18497
|
-
const columns = encodedValues.split(',').map(value => decodeValue(value)).filter(val => typeof val === 'string' &&
|
|
18493
|
+
const fields = [...tableColumns.map(column => column.field), '__check__'];
|
|
18494
|
+
const columns = encodedValues.split(',').map(value => decodeValue(value)).filter(val => typeof val === 'string' && fields.includes(val));
|
|
18498
18495
|
if (fieldURL === '_pinnedColumnsLeft') {
|
|
18499
18496
|
pinnedColumns['left'] = columns;
|
|
18500
18497
|
}
|
|
@@ -18644,17 +18641,17 @@ const updateUrl = (_ref4, search, historyReplace, columns) => {
|
|
|
18644
18641
|
// do not use it for equivalence (e.g. with value `3` and undefined we
|
|
18645
18642
|
// will get 0).
|
|
18646
18643
|
const compareFilters = (firstFilter, secondFilter) => {
|
|
18647
|
-
if (firstFilter.
|
|
18644
|
+
if (firstFilter.field < secondFilter.field) {
|
|
18648
18645
|
return -1;
|
|
18649
|
-
} else if (firstFilter.
|
|
18646
|
+
} else if (firstFilter.field > secondFilter.field) {
|
|
18650
18647
|
return 1;
|
|
18651
18648
|
}
|
|
18652
|
-
if (firstFilter.
|
|
18649
|
+
if (firstFilter.operator === undefined || secondFilter.operator === undefined) {
|
|
18653
18650
|
return 0;
|
|
18654
18651
|
}
|
|
18655
|
-
if (firstFilter.
|
|
18652
|
+
if (firstFilter.operator < secondFilter.operator) {
|
|
18656
18653
|
return -1;
|
|
18657
|
-
} else if (firstFilter.
|
|
18654
|
+
} else if (firstFilter.operator > secondFilter.operator) {
|
|
18658
18655
|
return 1;
|
|
18659
18656
|
}
|
|
18660
18657
|
if (firstFilter.value < secondFilter.value) {
|
|
@@ -18665,18 +18662,18 @@ const compareFilters = (firstFilter, secondFilter) => {
|
|
|
18665
18662
|
return 0;
|
|
18666
18663
|
};
|
|
18667
18664
|
const areFiltersEquivalent = (firstFilter, secondFilter) => {
|
|
18668
|
-
return firstFilter.
|
|
18665
|
+
return firstFilter.field === secondFilter.field && firstFilter.operator === secondFilter.operator && firstFilter.value === secondFilter.value;
|
|
18669
18666
|
};
|
|
18670
18667
|
const areFilterModelsEquivalent = (filterModel, filterModelToMatch) => {
|
|
18671
18668
|
const {
|
|
18672
18669
|
items,
|
|
18673
|
-
|
|
18670
|
+
logicOperator
|
|
18674
18671
|
} = filterModel;
|
|
18675
18672
|
const {
|
|
18676
18673
|
items: itemsToMatch,
|
|
18677
|
-
|
|
18674
|
+
logicOperator: logicOperatorToMatch
|
|
18678
18675
|
} = filterModelToMatch;
|
|
18679
|
-
if (
|
|
18676
|
+
if (logicOperator !== logicOperatorToMatch) {
|
|
18680
18677
|
return false;
|
|
18681
18678
|
}
|
|
18682
18679
|
if (items.length !== itemsToMatch.length) {
|
|
@@ -18689,7 +18686,7 @@ const areFilterModelsEquivalent = (filterModel, filterModelToMatch) => {
|
|
|
18689
18686
|
const filterToCompare = itemsToMatch[i];
|
|
18690
18687
|
|
|
18691
18688
|
// compareFilters return 0 if and only if the filters have the same
|
|
18692
|
-
//
|
|
18689
|
+
// field, operator, and value
|
|
18693
18690
|
if (!areFiltersEquivalent(filter, filterToCompare)) {
|
|
18694
18691
|
return false;
|
|
18695
18692
|
}
|
|
@@ -23101,16 +23098,16 @@ const getRole = (config, dateFormat) => {
|
|
|
23101
23098
|
}).join('\n');
|
|
23102
23099
|
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.
|
|
23103
23100
|
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.
|
|
23104
|
-
The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "
|
|
23105
|
-
- "
|
|
23106
|
-
- "items": a list of conditions, each is an object with exactly the three keys "
|
|
23107
|
-
- "
|
|
23101
|
+
The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "logicOperator" and "items":
|
|
23102
|
+
- "logicOperator": the logical operator, only "and" or "or" are allowed. If there is only one condition in the "items", use "and".
|
|
23103
|
+
- "items": a list of conditions, each is an object with exactly the three keys "field", "operator" and "value":
|
|
23104
|
+
- "field": the column name, must be one of ${columns}
|
|
23108
23105
|
- "value":
|
|
23109
|
-
- this can be skipped if the "
|
|
23110
|
-
- a list of multiple values if the "
|
|
23106
|
+
- this can be skipped if the "operator" is either "isEmpty" or "isNotEmpty"
|
|
23107
|
+
- a list of multiple values if the "operator" ends with "AnyOf"
|
|
23111
23108
|
- otherwise, it's a single value represented as a string: "true" instead of true, "false" instead of false, "0.6" instead of 0.6.
|
|
23112
23109
|
For "date" data type, use ${dateFormat}. If relative date is input, convert to the actual date given today is ${today}.
|
|
23113
|
-
- "
|
|
23110
|
+
- "operator": the comparison operator, accepted values depend on the data type of the column
|
|
23114
23111
|
${operators}
|
|
23115
23112
|
|
|
23116
23113
|
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:
|
|
@@ -23147,10 +23144,10 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
23147
23144
|
nlpFilterConfig,
|
|
23148
23145
|
onFilterModelChange,
|
|
23149
23146
|
dateFormat = 'yyyy-mm-dd',
|
|
23150
|
-
defaultModel = 'gpt-4-
|
|
23147
|
+
defaultModel = 'gpt-4-1106-preview',
|
|
23151
23148
|
defaultFilter = {
|
|
23152
23149
|
items: [],
|
|
23153
|
-
|
|
23150
|
+
logicOperator: 'and'
|
|
23154
23151
|
},
|
|
23155
23152
|
disablePower = false,
|
|
23156
23153
|
localeText
|
|
@@ -23228,7 +23225,7 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
23228
23225
|
value: prompt
|
|
23229
23226
|
}), /*#__PURE__*/React__default.createElement(Button, {
|
|
23230
23227
|
variant: "primary",
|
|
23231
|
-
"
|
|
23228
|
+
"aria-label": buttonAriaLabel,
|
|
23232
23229
|
type: "submit",
|
|
23233
23230
|
isLoading: isLoading
|
|
23234
23231
|
}, buttonText)), !disablePower && /*#__PURE__*/React__default.createElement(Tooltip, null, /*#__PURE__*/React__default.createElement(Tooltip.Trigger, null, /*#__PURE__*/React__default.createElement(Switch, {
|
|
@@ -23289,7 +23286,7 @@ const Toolbar$2 = props => {
|
|
|
23289
23286
|
let {
|
|
23290
23287
|
apiRef
|
|
23291
23288
|
} = _ref;
|
|
23292
|
-
return
|
|
23289
|
+
return gridExpandedSortedRowIdsSelector(apiRef);
|
|
23293
23290
|
}
|
|
23294
23291
|
},
|
|
23295
23292
|
printOptions: {
|
|
@@ -25521,12 +25518,10 @@ const ServerSideControlledPagination = _ref3 => {
|
|
|
25521
25518
|
selectionStatus,
|
|
25522
25519
|
displaySelection,
|
|
25523
25520
|
displayPagination,
|
|
25524
|
-
|
|
25525
|
-
|
|
25526
|
-
|
|
25527
|
-
onPageSizeChange,
|
|
25521
|
+
paginationModel,
|
|
25522
|
+
onPaginationModelChange,
|
|
25523
|
+
pageSizeOptions,
|
|
25528
25524
|
displayRowsPerPage,
|
|
25529
|
-
rowsPerPageOptions,
|
|
25530
25525
|
paginationProps,
|
|
25531
25526
|
rowCount
|
|
25532
25527
|
} = _ref3;
|
|
@@ -25545,13 +25540,17 @@ const ServerSideControlledPagination = _ref3 => {
|
|
|
25545
25540
|
}, totalRowsLabel) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$2({
|
|
25546
25541
|
component: "div",
|
|
25547
25542
|
count: totalNumberOfRowsInTable,
|
|
25548
|
-
page: page,
|
|
25549
|
-
onPageChange: (event,
|
|
25550
|
-
|
|
25551
|
-
|
|
25552
|
-
|
|
25553
|
-
|
|
25554
|
-
|
|
25543
|
+
page: paginationModel.page,
|
|
25544
|
+
onPageChange: (event, page) => onPaginationModelChange({
|
|
25545
|
+
page,
|
|
25546
|
+
pageSize: paginationModel.pageSize
|
|
25547
|
+
}),
|
|
25548
|
+
rowsPerPage: paginationModel.pageSize,
|
|
25549
|
+
onRowsPerPageChange: event => onPaginationModelChange({
|
|
25550
|
+
page: paginationModel.page,
|
|
25551
|
+
pageSize: parseInt(event.target.value, 10)
|
|
25552
|
+
}),
|
|
25553
|
+
rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
|
|
25555
25554
|
}, paginationProps)) : null);
|
|
25556
25555
|
};
|
|
25557
25556
|
|
|
@@ -25577,11 +25576,9 @@ const ControlledPagination = _ref3 => {
|
|
|
25577
25576
|
displayPagination = false,
|
|
25578
25577
|
selectionStatus,
|
|
25579
25578
|
apiRef,
|
|
25580
|
-
|
|
25581
|
-
|
|
25582
|
-
|
|
25583
|
-
onPageSizeChange,
|
|
25584
|
-
rowsPerPageOptions,
|
|
25579
|
+
paginationModel,
|
|
25580
|
+
onPaginationModelChange,
|
|
25581
|
+
pageSizeOptions,
|
|
25585
25582
|
isRowSelectable,
|
|
25586
25583
|
paginationProps
|
|
25587
25584
|
} = _ref3;
|
|
@@ -25611,17 +25608,25 @@ const ControlledPagination = _ref3 => {
|
|
|
25611
25608
|
}, `${selectionStatus.numberOfSelectedRows} row${selectionStatus.numberOfSelectedRows > 1 ? 's' : ''} selected`) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$2({
|
|
25612
25609
|
component: "div",
|
|
25613
25610
|
count: numberOfFilteredRowsInTable,
|
|
25614
|
-
page: page,
|
|
25615
|
-
onPageChange: (event,
|
|
25616
|
-
|
|
25611
|
+
page: paginationModel.page,
|
|
25612
|
+
onPageChange: (event, page) => {
|
|
25613
|
+
onPaginationModelChange({
|
|
25614
|
+
page,
|
|
25615
|
+
pageSize: paginationModel.pageSize
|
|
25616
|
+
});
|
|
25617
|
+
},
|
|
25618
|
+
rowsPerPage: paginationModel.pageSize,
|
|
25617
25619
|
onRowsPerPageChange: event => {
|
|
25618
|
-
|
|
25620
|
+
onPaginationModelChange({
|
|
25621
|
+
page: paginationModel.page,
|
|
25622
|
+
pageSize: parseInt(event.target.value, 10)
|
|
25623
|
+
});
|
|
25619
25624
|
},
|
|
25620
|
-
rowsPerPageOptions: displayRowsPerPage ?
|
|
25625
|
+
rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
|
|
25621
25626
|
}, paginationProps)) : null);
|
|
25622
25627
|
};
|
|
25623
25628
|
|
|
25624
|
-
const _excluded$3 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "
|
|
25629
|
+
const _excluded$3 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "paginationModel", "onPaginationModelChange", "pageSizeOptions", "paginationProps", "paginationMode", "rowCount"];
|
|
25625
25630
|
const ToolbarWrapper = _ref => {
|
|
25626
25631
|
let {
|
|
25627
25632
|
hideToolbar,
|
|
@@ -25633,11 +25638,9 @@ const ToolbarWrapper = _ref => {
|
|
|
25633
25638
|
selectionStatus,
|
|
25634
25639
|
apiRef,
|
|
25635
25640
|
isRowSelectable,
|
|
25636
|
-
|
|
25637
|
-
|
|
25638
|
-
|
|
25639
|
-
onPageSizeChange,
|
|
25640
|
-
rowsPerPageOptions,
|
|
25641
|
+
paginationModel,
|
|
25642
|
+
onPaginationModelChange,
|
|
25643
|
+
pageSizeOptions,
|
|
25641
25644
|
paginationProps,
|
|
25642
25645
|
paginationMode = 'client',
|
|
25643
25646
|
rowCount
|
|
@@ -25651,11 +25654,9 @@ const ToolbarWrapper = _ref => {
|
|
|
25651
25654
|
displayRowsPerPage: false,
|
|
25652
25655
|
displayPagination: ['top', 'both'].includes(paginationPlacement),
|
|
25653
25656
|
selectionStatus: selectionStatus.current,
|
|
25654
|
-
|
|
25655
|
-
|
|
25656
|
-
|
|
25657
|
-
onPageSizeChange: onPageSizeChange,
|
|
25658
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
25657
|
+
paginationModel: paginationModel,
|
|
25658
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
25659
|
+
pageSizeOptions: pageSizeOptions,
|
|
25659
25660
|
paginationProps: paginationProps,
|
|
25660
25661
|
rowCount: rowCount
|
|
25661
25662
|
}) : /*#__PURE__*/React__default.createElement(ControlledPagination, {
|
|
@@ -25665,30 +25666,26 @@ const ToolbarWrapper = _ref => {
|
|
|
25665
25666
|
selectionStatus: selectionStatus.current,
|
|
25666
25667
|
apiRef: apiRef,
|
|
25667
25668
|
isRowSelectable: isRowSelectable,
|
|
25668
|
-
|
|
25669
|
-
|
|
25670
|
-
|
|
25671
|
-
onPageSizeChange: onPageSizeChange,
|
|
25672
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
25669
|
+
paginationModel: paginationModel,
|
|
25670
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
25671
|
+
pageSizeOptions: pageSizeOptions,
|
|
25673
25672
|
paginationProps: paginationProps
|
|
25674
25673
|
}) : null);
|
|
25675
25674
|
};
|
|
25676
25675
|
|
|
25677
25676
|
const useControlledDatagridState = _ref => {
|
|
25678
|
-
var _initialState$paginat, _initialState$paginat2;
|
|
25677
|
+
var _ref2, _ref3, _propsPaginationModel, _initialState$paginat, _initialState$paginat2, _pageSizeOptions$, _ref4, _propsPaginationModel2, _initialState$paginat3, _initialState$paginat4;
|
|
25679
25678
|
let {
|
|
25680
25679
|
initialState,
|
|
25681
|
-
|
|
25680
|
+
pageSizeOptions,
|
|
25682
25681
|
propsColumnVisibilityModel,
|
|
25683
25682
|
propsFilterModel,
|
|
25684
25683
|
propsOnColumnVisibilityModelChange,
|
|
25685
25684
|
propsOnFilterModelChange,
|
|
25686
|
-
|
|
25687
|
-
propsOnPageSizeChange,
|
|
25685
|
+
propsOnPaginationModelChange,
|
|
25688
25686
|
propsOnPinnedColumnsChange,
|
|
25689
25687
|
propsOnSortModelChange,
|
|
25690
|
-
|
|
25691
|
-
propsPageSize,
|
|
25688
|
+
propsPaginationModel,
|
|
25692
25689
|
propsPinnedColumns,
|
|
25693
25690
|
propsSortModel
|
|
25694
25691
|
} = _ref;
|
|
@@ -25736,33 +25733,22 @@ const useControlledDatagridState = _ref => {
|
|
|
25736
25733
|
setSortModel(model);
|
|
25737
25734
|
}
|
|
25738
25735
|
};
|
|
25739
|
-
const [
|
|
25740
|
-
|
|
25741
|
-
|
|
25742
|
-
|
|
25743
|
-
|
|
25744
|
-
|
|
25745
|
-
|
|
25746
|
-
}
|
|
25747
|
-
};
|
|
25748
|
-
useEffect(() => {
|
|
25749
|
-
if (propsPage || propsPage === 0) {
|
|
25750
|
-
setPage(propsPage);
|
|
25751
|
-
}
|
|
25752
|
-
}, [propsPage]);
|
|
25753
|
-
const onPageSizeChange = pageSize => {
|
|
25754
|
-
onPageChange(0);
|
|
25755
|
-
if (propsOnPageSizeChange) {
|
|
25756
|
-
propsOnPageSizeChange(pageSize, undefined);
|
|
25736
|
+
const [paginationModel, setPaginationModel] = useState({
|
|
25737
|
+
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,
|
|
25738
|
+
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
|
|
25739
|
+
});
|
|
25740
|
+
const onPaginationModelChange = (model, details) => {
|
|
25741
|
+
if (propsOnPaginationModelChange) {
|
|
25742
|
+
propsOnPaginationModelChange(model, details);
|
|
25757
25743
|
} else {
|
|
25758
|
-
|
|
25744
|
+
setPaginationModel(model);
|
|
25759
25745
|
}
|
|
25760
25746
|
};
|
|
25761
25747
|
useEffect(() => {
|
|
25762
|
-
if (
|
|
25763
|
-
|
|
25748
|
+
if (propsPaginationModel) {
|
|
25749
|
+
setPaginationModel(propsPaginationModel);
|
|
25764
25750
|
}
|
|
25765
|
-
}, [
|
|
25751
|
+
}, [propsPaginationModel]);
|
|
25766
25752
|
return {
|
|
25767
25753
|
filterModel,
|
|
25768
25754
|
onFilterModelChange,
|
|
@@ -25772,14 +25758,12 @@ const useControlledDatagridState = _ref => {
|
|
|
25772
25758
|
onPinnedColumnsChange,
|
|
25773
25759
|
sortModel,
|
|
25774
25760
|
onSortModelChange,
|
|
25775
|
-
|
|
25776
|
-
|
|
25777
|
-
onPageChange,
|
|
25778
|
-
onPageSizeChange
|
|
25761
|
+
paginationModel,
|
|
25762
|
+
onPaginationModelChange
|
|
25779
25763
|
};
|
|
25780
25764
|
};
|
|
25781
25765
|
|
|
25782
|
-
const _excluded$2 = ["apiRef", "autoHeight", "className", "
|
|
25766
|
+
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"];
|
|
25783
25767
|
const COMPONENT_NAME$2 = 'DataGrid';
|
|
25784
25768
|
const CLASSNAME$2 = 'redsift-datagrid';
|
|
25785
25769
|
const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
@@ -25788,33 +25772,30 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
25788
25772
|
apiRef: propsApiRef,
|
|
25789
25773
|
autoHeight,
|
|
25790
25774
|
className,
|
|
25791
|
-
|
|
25792
|
-
|
|
25793
|
-
componentsProps,
|
|
25775
|
+
slots,
|
|
25776
|
+
slotProps,
|
|
25794
25777
|
filterModel: propsFilterModel,
|
|
25795
25778
|
columnVisibilityModel: propsColumnVisibilityModel,
|
|
25796
25779
|
pinnedColumns: propsPinnedColumns,
|
|
25797
25780
|
sortModel: propsSortModel,
|
|
25781
|
+
paginationModel: propsPaginationModel,
|
|
25798
25782
|
height: propsHeight,
|
|
25799
25783
|
hideToolbar,
|
|
25800
25784
|
initialState,
|
|
25801
25785
|
isRowSelectable,
|
|
25802
25786
|
license = process.env.MUI_LICENSE_KEY,
|
|
25803
25787
|
onFilterModelChange: propsOnFilterModelChange,
|
|
25804
|
-
|
|
25805
|
-
|
|
25788
|
+
rowSelectionModel: propsRowSelectionModel,
|
|
25789
|
+
onPaginationModelChange: propsOnPaginationModelChange,
|
|
25790
|
+
onRowSelectionModelChange: propsOnRowSelectionModelChange,
|
|
25806
25791
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
25807
25792
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
25808
25793
|
onSortModelChange: propsOnSortModelChange,
|
|
25809
|
-
selectionModel: propsSelectionModel,
|
|
25810
|
-
onSelectionModelChange: propsOnSelectionModelChange,
|
|
25811
|
-
page: propsPage,
|
|
25812
|
-
pageSize: propsPageSize,
|
|
25813
25794
|
pagination,
|
|
25814
25795
|
paginationPlacement = 'both',
|
|
25815
25796
|
paginationProps,
|
|
25816
25797
|
rows,
|
|
25817
|
-
|
|
25798
|
+
pageSizeOptions,
|
|
25818
25799
|
sx,
|
|
25819
25800
|
theme: propsTheme,
|
|
25820
25801
|
paginationMode = 'client',
|
|
@@ -25824,7 +25805,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
25824
25805
|
const theme = useTheme$4(propsTheme);
|
|
25825
25806
|
const _apiRef = useGridApiRef();
|
|
25826
25807
|
const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
|
|
25827
|
-
const RenderedToolbar =
|
|
25808
|
+
const RenderedToolbar = slots !== null && slots !== void 0 && slots.toolbar ? slots.toolbar : Toolbar$2;
|
|
25828
25809
|
LicenseInfo.setLicenseKey(license);
|
|
25829
25810
|
const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
|
|
25830
25811
|
const {
|
|
@@ -25832,56 +25813,52 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
25832
25813
|
filterModel,
|
|
25833
25814
|
onColumnVisibilityModelChange,
|
|
25834
25815
|
onFilterModelChange,
|
|
25835
|
-
|
|
25836
|
-
onPageSizeChange,
|
|
25816
|
+
onPaginationModelChange,
|
|
25837
25817
|
onPinnedColumnsChange,
|
|
25838
25818
|
onSortModelChange,
|
|
25839
|
-
|
|
25840
|
-
pageSize,
|
|
25819
|
+
paginationModel,
|
|
25841
25820
|
pinnedColumns,
|
|
25842
25821
|
sortModel
|
|
25843
25822
|
} = useControlledDatagridState({
|
|
25844
25823
|
initialState,
|
|
25845
|
-
|
|
25824
|
+
pageSizeOptions,
|
|
25846
25825
|
propsColumnVisibilityModel,
|
|
25847
25826
|
propsFilterModel,
|
|
25848
25827
|
propsOnColumnVisibilityModelChange,
|
|
25849
25828
|
propsOnFilterModelChange,
|
|
25850
25829
|
propsOnPinnedColumnsChange,
|
|
25851
25830
|
propsOnSortModelChange,
|
|
25852
|
-
|
|
25853
|
-
propsPageSize,
|
|
25831
|
+
propsPaginationModel,
|
|
25854
25832
|
propsPinnedColumns,
|
|
25855
25833
|
propsSortModel,
|
|
25856
|
-
|
|
25857
|
-
propsOnPageSizeChange
|
|
25834
|
+
propsOnPaginationModelChange
|
|
25858
25835
|
});
|
|
25859
|
-
const [
|
|
25836
|
+
const [rowSelectionModel, setRowSelectionModel] = useState(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
25860
25837
|
useEffect(() => {
|
|
25861
|
-
|
|
25862
|
-
}, [
|
|
25863
|
-
const
|
|
25864
|
-
if (
|
|
25865
|
-
|
|
25838
|
+
setRowSelectionModel(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
25839
|
+
}, [propsRowSelectionModel]);
|
|
25840
|
+
const onRowSelectionModelChange = (selectionModel, details) => {
|
|
25841
|
+
if (propsOnRowSelectionModelChange) {
|
|
25842
|
+
propsOnRowSelectionModelChange(selectionModel, details);
|
|
25866
25843
|
} else {
|
|
25867
|
-
|
|
25844
|
+
setRowSelectionModel(selectionModel);
|
|
25868
25845
|
}
|
|
25869
25846
|
};
|
|
25870
25847
|
const selectionStatus = useRef({
|
|
25871
25848
|
type: 'none',
|
|
25872
25849
|
numberOfSelectedRows: 0,
|
|
25873
25850
|
numberOfSelectedRowsInPage: 0,
|
|
25874
|
-
page,
|
|
25875
|
-
pageSize
|
|
25851
|
+
page: paginationModel.page,
|
|
25852
|
+
pageSize: paginationModel.pageSize
|
|
25876
25853
|
});
|
|
25877
25854
|
|
|
25878
25855
|
// in server-side pagination we want to update the selection status
|
|
25879
25856
|
// every time we navigate between pages, resize our page or select something
|
|
25880
25857
|
useEffect(() => {
|
|
25881
25858
|
if (paginationMode == 'server') {
|
|
25882
|
-
onServerSideSelectionStatusChange(Array.isArray(
|
|
25859
|
+
onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatus, isRowSelectable, paginationModel.page, paginationModel.pageSize);
|
|
25883
25860
|
}
|
|
25884
|
-
}, [
|
|
25861
|
+
}, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
|
|
25885
25862
|
if (!Array.isArray(rows)) {
|
|
25886
25863
|
return null;
|
|
25887
25864
|
}
|
|
@@ -25912,57 +25889,54 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
25912
25889
|
apiRef: apiRef,
|
|
25913
25890
|
autoHeight: autoHeight,
|
|
25914
25891
|
checkboxSelectionVisibleOnly: Boolean(pagination),
|
|
25915
|
-
|
|
25916
|
-
|
|
25917
|
-
|
|
25918
|
-
|
|
25919
|
-
|
|
25920
|
-
|
|
25921
|
-
ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
25892
|
+
slots: _objectSpread2(_objectSpread2({
|
|
25893
|
+
baseButton: BaseButton,
|
|
25894
|
+
baseCheckbox: BaseCheckbox,
|
|
25895
|
+
// baseTextField,
|
|
25896
|
+
basePopper: BasePopper,
|
|
25897
|
+
columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
25922
25898
|
displayName: "ColumnFilteredIcon"
|
|
25923
25899
|
})),
|
|
25924
|
-
|
|
25900
|
+
columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
25925
25901
|
displayName: "ColumnSelectorIcon"
|
|
25926
25902
|
})),
|
|
25927
|
-
|
|
25903
|
+
columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
25928
25904
|
displayName: "ColumnSortedAscendingIcon"
|
|
25929
25905
|
})),
|
|
25930
|
-
|
|
25906
|
+
columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
25931
25907
|
displayName: "ColumnSortedDescendingIcon"
|
|
25932
25908
|
})),
|
|
25933
|
-
|
|
25909
|
+
densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
25934
25910
|
displayName: "DensityCompactIcon"
|
|
25935
25911
|
})),
|
|
25936
|
-
|
|
25912
|
+
densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
25937
25913
|
displayName: "DensityStandardIcon"
|
|
25938
25914
|
})),
|
|
25939
|
-
|
|
25915
|
+
densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
25940
25916
|
displayName: "DensityComfortableIcon"
|
|
25941
25917
|
})),
|
|
25942
|
-
|
|
25918
|
+
detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
25943
25919
|
displayName: "DetailPanelCollapseIcon"
|
|
25944
25920
|
})),
|
|
25945
|
-
|
|
25921
|
+
detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
25946
25922
|
displayName: "DetailPanelExpandIcon"
|
|
25947
25923
|
})),
|
|
25948
|
-
|
|
25924
|
+
exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
25949
25925
|
displayName: "ExportIcon"
|
|
25950
25926
|
})),
|
|
25951
|
-
|
|
25927
|
+
openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({
|
|
25952
25928
|
displayName: "OpenFilterButtonIcon"
|
|
25953
25929
|
}, props))
|
|
25954
|
-
},
|
|
25955
|
-
|
|
25956
|
-
|
|
25930
|
+
}, slots), {}, {
|
|
25931
|
+
toolbar: ToolbarWrapper,
|
|
25932
|
+
pagination: props => pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$2({}, props, {
|
|
25957
25933
|
displaySelection: false,
|
|
25958
25934
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
25959
25935
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
25960
25936
|
selectionStatus: selectionStatus.current,
|
|
25961
|
-
|
|
25962
|
-
|
|
25963
|
-
|
|
25964
|
-
onPageSizeChange: onPageSizeChange,
|
|
25965
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
25937
|
+
paginationModel: paginationModel,
|
|
25938
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
25939
|
+
pageSizeOptions: pageSizeOptions,
|
|
25966
25940
|
paginationProps: paginationProps,
|
|
25967
25941
|
paginationMode: paginationMode,
|
|
25968
25942
|
rowCount: rowCount
|
|
@@ -25973,16 +25947,14 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
25973
25947
|
selectionStatus: selectionStatus.current,
|
|
25974
25948
|
apiRef: apiRef,
|
|
25975
25949
|
isRowSelectable: isRowSelectable,
|
|
25976
|
-
|
|
25977
|
-
|
|
25978
|
-
|
|
25979
|
-
onPageSizeChange: onPageSizeChange,
|
|
25980
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
25950
|
+
paginationModel: paginationModel,
|
|
25951
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
25952
|
+
pageSizeOptions: pageSizeOptions,
|
|
25981
25953
|
paginationProps: paginationProps,
|
|
25982
25954
|
paginationMode: paginationMode
|
|
25983
25955
|
})) : null
|
|
25984
25956
|
}),
|
|
25985
|
-
|
|
25957
|
+
slotProps: _objectSpread2(_objectSpread2({}, slotProps), {}, {
|
|
25986
25958
|
toolbar: _objectSpread2({
|
|
25987
25959
|
hideToolbar,
|
|
25988
25960
|
RenderedToolbar,
|
|
@@ -25993,15 +25965,13 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
25993
25965
|
selectionStatus,
|
|
25994
25966
|
apiRef,
|
|
25995
25967
|
isRowSelectable,
|
|
25996
|
-
|
|
25997
|
-
|
|
25998
|
-
|
|
25999
|
-
onPageSizeChange,
|
|
26000
|
-
rowsPerPageOptions,
|
|
25968
|
+
paginationModel,
|
|
25969
|
+
onPaginationModelChange,
|
|
25970
|
+
pageSizeOptions,
|
|
26001
25971
|
paginationProps,
|
|
26002
25972
|
paginationMode,
|
|
26003
25973
|
rowCount
|
|
26004
|
-
},
|
|
25974
|
+
}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar)
|
|
26005
25975
|
}),
|
|
26006
25976
|
filterModel: filterModel,
|
|
26007
25977
|
columnVisibilityModel: columnVisibilityModel,
|
|
@@ -26017,13 +25987,11 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26017
25987
|
paginationMode: paginationMode,
|
|
26018
25988
|
keepNonExistentRowsSelected: paginationMode == 'server',
|
|
26019
25989
|
rows: rows,
|
|
26020
|
-
|
|
26021
|
-
|
|
26022
|
-
|
|
26023
|
-
|
|
26024
|
-
|
|
26025
|
-
selectionModel: selectionModel,
|
|
26026
|
-
onSelectionModelChange: (newSelectionModel, details) => {
|
|
25990
|
+
pageSizeOptions: pageSizeOptions,
|
|
25991
|
+
paginationModel: paginationModel,
|
|
25992
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
25993
|
+
rowSelectionModel: rowSelectionModel,
|
|
25994
|
+
onRowSelectionModelChange: (newSelectionModel, details) => {
|
|
26027
25995
|
if (pagination && paginationMode != 'server') {
|
|
26028
25996
|
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
|
|
26029
25997
|
let {
|
|
@@ -26081,7 +26049,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26081
26049
|
};
|
|
26082
26050
|
}
|
|
26083
26051
|
}
|
|
26084
|
-
|
|
26052
|
+
onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
|
|
26085
26053
|
},
|
|
26086
26054
|
sx: _objectSpread2(_objectSpread2({}, sx), {}, {
|
|
26087
26055
|
'.MuiDataGrid-columnHeaders': {
|
|
@@ -26098,8 +26066,6 @@ DataGrid.className = CLASSNAME$2;
|
|
|
26098
26066
|
DataGrid.displayName = COMPONENT_NAME$2;
|
|
26099
26067
|
|
|
26100
26068
|
// Get and Set data from LocalStorage WITHOUT useState
|
|
26101
|
-
|
|
26102
|
-
// triggering a state update and consecutive re-render
|
|
26103
26069
|
const useFetchState = (defaultValue, key) => {
|
|
26104
26070
|
let stickyValue = null;
|
|
26105
26071
|
try {
|
|
@@ -26107,16 +26073,7 @@ const useFetchState = (defaultValue, key) => {
|
|
|
26107
26073
|
} catch (e) {
|
|
26108
26074
|
console.error('StatefulDataGrid: error getting item from local storage: ', e);
|
|
26109
26075
|
}
|
|
26110
|
-
|
|
26111
|
-
|
|
26112
|
-
// TODO: temporary workaround to avoid clashes when someone had sorting on the now-removed screenshot field (renamed to num_annotations)
|
|
26113
|
-
// 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
|
|
26114
|
-
if (parsedValue instanceof Array) {
|
|
26115
|
-
const fields = (parsedValue || []).map(item => item.field);
|
|
26116
|
-
if (fields.includes('screenshot') || fields.includes('diffs')) {
|
|
26117
|
-
parsedValue = defaultValue;
|
|
26118
|
-
}
|
|
26119
|
-
}
|
|
26076
|
+
const parsedValue = stickyValue !== null && stickyValue !== undefined && stickyValue !== 'undefined' ? JSON.parse(stickyValue) : defaultValue;
|
|
26120
26077
|
const updateValue = useCallback(value => {
|
|
26121
26078
|
try {
|
|
26122
26079
|
window.localStorage.setItem(key, JSON.stringify(value));
|
|
@@ -26127,6 +26084,8 @@ const useFetchState = (defaultValue, key) => {
|
|
|
26127
26084
|
return [parsedValue, updateValue];
|
|
26128
26085
|
};
|
|
26129
26086
|
|
|
26087
|
+
// import useLocalStorage from './useLocalStorage';
|
|
26088
|
+
|
|
26130
26089
|
const useTableStates = (id, version, customDefaults) => {
|
|
26131
26090
|
const [paginationModel, setPaginationModel] = useFetchState('', buildStorageKey({
|
|
26132
26091
|
id,
|
|
@@ -26182,8 +26141,7 @@ const useStatefulTable = props => {
|
|
|
26182
26141
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
26183
26142
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
26184
26143
|
onFilterModelChange: propsOnFilterModelChange,
|
|
26185
|
-
|
|
26186
|
-
onPageSizeChange: propsOnPageSizeChange,
|
|
26144
|
+
onPaginationModelChange: propsOnPaginationModelChange,
|
|
26187
26145
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
26188
26146
|
onSortModelChange: propsOnSortModelChange,
|
|
26189
26147
|
pinnedCustomColumns = {
|
|
@@ -26254,7 +26212,6 @@ const useStatefulTable = props => {
|
|
|
26254
26212
|
column.width = dimensionModel[column.field] || column.width || 100;
|
|
26255
26213
|
return column;
|
|
26256
26214
|
}), [propsColumns, dimensionModel]);
|
|
26257
|
-
|
|
26258
26215
|
/** Add resetPage method to apiRef. */
|
|
26259
26216
|
apiRef.current.resetPage = () => {
|
|
26260
26217
|
apiRef.current.setPage(0);
|
|
@@ -26265,7 +26222,7 @@ const useStatefulTable = props => {
|
|
|
26265
26222
|
onFilterModelChange: (model, details) => {
|
|
26266
26223
|
const filterModel = _objectSpread2(_objectSpread2({}, model), {}, {
|
|
26267
26224
|
items: model.items.map(item => {
|
|
26268
|
-
const column = apiRef.current.getColumn(item.
|
|
26225
|
+
const column = apiRef.current.getColumn(item.field);
|
|
26269
26226
|
item.type = column.type || 'string';
|
|
26270
26227
|
return item;
|
|
26271
26228
|
})
|
|
@@ -26302,33 +26259,16 @@ const useStatefulTable = props => {
|
|
|
26302
26259
|
}, search, historyReplace, columns);
|
|
26303
26260
|
},
|
|
26304
26261
|
pinnedColumns: pinnedColumnsModel,
|
|
26305
|
-
|
|
26306
|
-
|
|
26307
|
-
|
|
26308
|
-
|
|
26309
|
-
|
|
26310
|
-
|
|
26311
|
-
filterModel: filterParsed,
|
|
26312
|
-
sortModel: sortModelParsed,
|
|
26313
|
-
paginationModel: {
|
|
26314
|
-
page,
|
|
26315
|
-
pageSize: paginationModelParsed.pageSize,
|
|
26316
|
-
direction
|
|
26317
|
-
},
|
|
26318
|
-
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
26319
|
-
pinnedColumnsModel: pinnedColumnsModel
|
|
26320
|
-
}, search, historyReplace, columns);
|
|
26321
|
-
},
|
|
26322
|
-
onPageSizeChange: (pageSize, details) => {
|
|
26323
|
-
propsOnPageSizeChange === null || propsOnPageSizeChange === void 0 ? void 0 : propsOnPageSizeChange(pageSize, details);
|
|
26262
|
+
paginationModel: paginationModelParsed,
|
|
26263
|
+
onPaginationModelChange: (model, details) => {
|
|
26264
|
+
const paginationModel = _objectSpread2(_objectSpread2({}, model), {}, {
|
|
26265
|
+
direction: paginationModelParsed.page < model.page ? 'next' : 'back'
|
|
26266
|
+
});
|
|
26267
|
+
propsOnPaginationModelChange === null || propsOnPaginationModelChange === void 0 ? void 0 : propsOnPaginationModelChange(paginationModel, details);
|
|
26324
26268
|
updateUrl({
|
|
26325
26269
|
filterModel: filterParsed,
|
|
26326
26270
|
sortModel: sortModelParsed,
|
|
26327
|
-
paginationModel:
|
|
26328
|
-
page: paginationModelParsed.page,
|
|
26329
|
-
pageSize,
|
|
26330
|
-
direction: paginationModelParsed.direction
|
|
26331
|
-
},
|
|
26271
|
+
paginationModel: paginationModel,
|
|
26332
26272
|
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
26333
26273
|
pinnedColumnsModel: pinnedColumnsModel
|
|
26334
26274
|
}, search, historyReplace, columns);
|
|
@@ -26354,7 +26294,7 @@ const useStatefulTable = props => {
|
|
|
26354
26294
|
};
|
|
26355
26295
|
};
|
|
26356
26296
|
|
|
26357
|
-
const _excluded$1 = ["apiRef", "autoHeight", "className", "columns", "
|
|
26297
|
+
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", "pinnedCustomColumns", "rows", "pageSizeOptions", "sx", "theme", "useRouter", "paginationMode", "rowCount"];
|
|
26358
26298
|
const COMPONENT_NAME$1 = 'DataGrid';
|
|
26359
26299
|
const CLASSNAME$1 = 'redsift-datagrid';
|
|
26360
26300
|
const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
@@ -26364,15 +26304,13 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26364
26304
|
autoHeight,
|
|
26365
26305
|
className,
|
|
26366
26306
|
columns,
|
|
26367
|
-
|
|
26368
|
-
|
|
26369
|
-
componentsProps,
|
|
26307
|
+
slots,
|
|
26308
|
+
slotProps,
|
|
26370
26309
|
filterModel: propsFilterModel,
|
|
26371
26310
|
columnVisibilityModel: propsColumnVisibilityModel,
|
|
26372
26311
|
pinnedColumns: propsPinnedColumns,
|
|
26373
26312
|
sortModel: propsSortModel,
|
|
26374
|
-
|
|
26375
|
-
pageSize: propsPageSize,
|
|
26313
|
+
paginationModel: propsPaginationModel,
|
|
26376
26314
|
height: propsHeight,
|
|
26377
26315
|
hideToolbar,
|
|
26378
26316
|
initialState,
|
|
@@ -26380,11 +26318,10 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26380
26318
|
license = process.env.MUI_LICENSE_KEY,
|
|
26381
26319
|
localStorageVersion,
|
|
26382
26320
|
onFilterModelChange: propsOnFilterModelChange,
|
|
26383
|
-
|
|
26321
|
+
rowSelectionModel: propsRowSelectionModel,
|
|
26384
26322
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
26385
|
-
|
|
26386
|
-
|
|
26387
|
-
onSelectionModelChange: propsOnSelectionModelChange,
|
|
26323
|
+
onPaginationModelChange: propsOnPaginationModelChange,
|
|
26324
|
+
onRowSelectionModelChange: propsOnRowSelectionModelChange,
|
|
26388
26325
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
26389
26326
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
26390
26327
|
onSortModelChange: propsOnSortModelChange,
|
|
@@ -26393,7 +26330,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26393
26330
|
paginationProps,
|
|
26394
26331
|
pinnedCustomColumns,
|
|
26395
26332
|
rows,
|
|
26396
|
-
|
|
26333
|
+
pageSizeOptions,
|
|
26397
26334
|
sx,
|
|
26398
26335
|
theme: propsTheme,
|
|
26399
26336
|
useRouter,
|
|
@@ -26404,43 +26341,38 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26404
26341
|
const theme = useTheme$4(propsTheme);
|
|
26405
26342
|
const _apiRef = useGridApiRef();
|
|
26406
26343
|
const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
|
|
26407
|
-
const RenderedToolbar =
|
|
26344
|
+
const RenderedToolbar = slots !== null && slots !== void 0 && slots.toolbar ? slots.toolbar : Toolbar$2;
|
|
26408
26345
|
LicenseInfo.setLicenseKey(license);
|
|
26409
26346
|
const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
|
|
26410
26347
|
const {
|
|
26411
26348
|
onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
|
|
26412
26349
|
onFilterModelChange: controlledOnFilterModelChange,
|
|
26413
|
-
|
|
26414
|
-
onPageSizeChange: controlledOnPageSizeChange,
|
|
26350
|
+
onPaginationModelChange: controlledOnPaginationModelChange,
|
|
26415
26351
|
onPinnedColumnsChange: controlledOnPinnedColumnsChange,
|
|
26416
26352
|
onSortModelChange: controlledOnSortModelChange
|
|
26417
26353
|
} = useControlledDatagridState({
|
|
26418
26354
|
initialState,
|
|
26419
|
-
|
|
26355
|
+
pageSizeOptions,
|
|
26420
26356
|
propsColumnVisibilityModel,
|
|
26421
26357
|
propsFilterModel,
|
|
26422
26358
|
propsOnColumnVisibilityModelChange,
|
|
26423
26359
|
propsOnFilterModelChange,
|
|
26424
26360
|
propsOnPinnedColumnsChange,
|
|
26425
26361
|
propsOnSortModelChange,
|
|
26426
|
-
|
|
26427
|
-
propsPageSize,
|
|
26362
|
+
propsPaginationModel,
|
|
26428
26363
|
propsPinnedColumns,
|
|
26429
26364
|
propsSortModel,
|
|
26430
|
-
|
|
26431
|
-
propsOnPageSizeChange
|
|
26365
|
+
propsOnPaginationModelChange
|
|
26432
26366
|
});
|
|
26433
26367
|
const {
|
|
26434
26368
|
columnVisibilityModel,
|
|
26435
26369
|
filterModel,
|
|
26436
26370
|
onColumnVisibilityModelChange,
|
|
26437
26371
|
onFilterModelChange,
|
|
26438
|
-
|
|
26439
|
-
onPageSizeChange,
|
|
26372
|
+
onPaginationModelChange,
|
|
26440
26373
|
onPinnedColumnsChange,
|
|
26441
26374
|
onSortModelChange,
|
|
26442
|
-
|
|
26443
|
-
pageSize,
|
|
26375
|
+
paginationModel,
|
|
26444
26376
|
pinnedColumns,
|
|
26445
26377
|
sortModel,
|
|
26446
26378
|
onColumnWidthChange
|
|
@@ -26450,40 +26382,39 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26450
26382
|
onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
|
|
26451
26383
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
26452
26384
|
onFilterModelChange: controlledOnFilterModelChange,
|
|
26453
|
-
|
|
26454
|
-
onPageSizeChange: controlledOnPageSizeChange,
|
|
26385
|
+
onPaginationModelChange: controlledOnPaginationModelChange,
|
|
26455
26386
|
onPinnedColumnsChange: controlledOnPinnedColumnsChange,
|
|
26456
26387
|
onSortModelChange: controlledOnSortModelChange,
|
|
26457
26388
|
pinnedCustomColumns,
|
|
26458
26389
|
useRouter: useRouter,
|
|
26459
26390
|
localStorageVersion
|
|
26460
26391
|
});
|
|
26461
|
-
const [
|
|
26392
|
+
const [rowSelectionModel, setRowSelectionModel] = useState(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
26462
26393
|
useEffect(() => {
|
|
26463
|
-
|
|
26464
|
-
}, [
|
|
26465
|
-
const
|
|
26466
|
-
if (
|
|
26467
|
-
|
|
26394
|
+
setRowSelectionModel(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
26395
|
+
}, [propsRowSelectionModel]);
|
|
26396
|
+
const onRowSelectionModelChange = (selectionModel, details) => {
|
|
26397
|
+
if (propsOnRowSelectionModelChange) {
|
|
26398
|
+
propsOnRowSelectionModelChange(selectionModel, details);
|
|
26468
26399
|
} else {
|
|
26469
|
-
|
|
26400
|
+
setRowSelectionModel(selectionModel);
|
|
26470
26401
|
}
|
|
26471
26402
|
};
|
|
26472
26403
|
const selectionStatus = useRef({
|
|
26473
26404
|
type: 'none',
|
|
26474
26405
|
numberOfSelectedRows: 0,
|
|
26475
26406
|
numberOfSelectedRowsInPage: 0,
|
|
26476
|
-
page,
|
|
26477
|
-
pageSize: pageSize
|
|
26407
|
+
page: paginationModel.page,
|
|
26408
|
+
pageSize: paginationModel.pageSize
|
|
26478
26409
|
});
|
|
26479
26410
|
|
|
26480
26411
|
// in server-side pagination we want to update the selection status
|
|
26481
26412
|
// every time we navigate between pages, resize our page or select something
|
|
26482
26413
|
useEffect(() => {
|
|
26483
26414
|
if (paginationMode == 'server') {
|
|
26484
|
-
onServerSideSelectionStatusChange(Array.isArray(
|
|
26415
|
+
onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatus, isRowSelectable, paginationModel.page, paginationModel.pageSize);
|
|
26485
26416
|
}
|
|
26486
|
-
}, [
|
|
26417
|
+
}, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
|
|
26487
26418
|
if (!Array.isArray(rows)) {
|
|
26488
26419
|
return null;
|
|
26489
26420
|
}
|
|
@@ -26516,15 +26447,13 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26516
26447
|
filterModel: filterModel,
|
|
26517
26448
|
onColumnVisibilityModelChange: onColumnVisibilityModelChange,
|
|
26518
26449
|
onFilterModelChange: onFilterModelChange,
|
|
26519
|
-
|
|
26520
|
-
onPageSizeChange: onPageSizeChange,
|
|
26450
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
26521
26451
|
onPinnedColumnsChange: onPinnedColumnsChange,
|
|
26522
26452
|
onSortModelChange: onSortModelChange,
|
|
26523
|
-
|
|
26524
|
-
pageSize: pageSize,
|
|
26453
|
+
paginationModel: paginationModel,
|
|
26525
26454
|
pinnedColumns: pinnedColumns,
|
|
26526
26455
|
sortModel: sortModel,
|
|
26527
|
-
|
|
26456
|
+
pageSizeOptions: pageSizeOptions,
|
|
26528
26457
|
onColumnWidthChange: onColumnWidthChange,
|
|
26529
26458
|
initialState: initialState,
|
|
26530
26459
|
isRowSelectable: isRowSelectable,
|
|
@@ -26535,58 +26464,55 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26535
26464
|
rowCount: rowCount,
|
|
26536
26465
|
autoHeight: autoHeight,
|
|
26537
26466
|
checkboxSelectionVisibleOnly: Boolean(pagination),
|
|
26538
|
-
|
|
26539
|
-
|
|
26540
|
-
|
|
26541
|
-
|
|
26542
|
-
|
|
26543
|
-
|
|
26544
|
-
ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
26467
|
+
slots: _objectSpread2(_objectSpread2({
|
|
26468
|
+
baseButton: BaseButton,
|
|
26469
|
+
baseCheckbox: BaseCheckbox,
|
|
26470
|
+
// baseTextField,
|
|
26471
|
+
basePopper: BasePopper,
|
|
26472
|
+
columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
26545
26473
|
displayName: "ColumnFilteredIcon"
|
|
26546
26474
|
})),
|
|
26547
|
-
|
|
26475
|
+
columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
26548
26476
|
displayName: "ColumnSelectorIcon"
|
|
26549
26477
|
})),
|
|
26550
|
-
|
|
26478
|
+
columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
26551
26479
|
displayName: "ColumnSortedAscendingIcon"
|
|
26552
26480
|
})),
|
|
26553
|
-
|
|
26481
|
+
columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
26554
26482
|
displayName: "ColumnSortedDescendingIcon"
|
|
26555
26483
|
})),
|
|
26556
|
-
|
|
26484
|
+
densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
26557
26485
|
displayName: "DensityCompactIcon"
|
|
26558
26486
|
})),
|
|
26559
|
-
|
|
26487
|
+
densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
26560
26488
|
displayName: "DensityStandardIcon"
|
|
26561
26489
|
})),
|
|
26562
|
-
|
|
26490
|
+
densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
26563
26491
|
displayName: "DensityComfortableIcon"
|
|
26564
26492
|
})),
|
|
26565
|
-
|
|
26493
|
+
detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
26566
26494
|
displayName: "DetailPanelCollapseIcon"
|
|
26567
26495
|
})),
|
|
26568
|
-
|
|
26496
|
+
detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
26569
26497
|
displayName: "DetailPanelExpandIcon"
|
|
26570
26498
|
})),
|
|
26571
|
-
|
|
26499
|
+
exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
26572
26500
|
displayName: "ExportIcon"
|
|
26573
26501
|
})),
|
|
26574
|
-
|
|
26502
|
+
openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({
|
|
26575
26503
|
displayName: "OpenFilterButtonIcon"
|
|
26576
26504
|
}, props))
|
|
26577
|
-
},
|
|
26578
|
-
|
|
26579
|
-
|
|
26505
|
+
}, slots), {}, {
|
|
26506
|
+
toolbar: ToolbarWrapper,
|
|
26507
|
+
pagination: props => {
|
|
26580
26508
|
return pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$2({}, props, {
|
|
26581
26509
|
displaySelection: false,
|
|
26582
26510
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
26583
26511
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
26584
26512
|
selectionStatus: selectionStatus.current,
|
|
26585
|
-
|
|
26586
|
-
|
|
26587
|
-
|
|
26588
|
-
onPageSizeChange: onPageSizeChange,
|
|
26589
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
26513
|
+
paginationModel: paginationModel,
|
|
26514
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
26515
|
+
pageSizeOptions: pageSizeOptions,
|
|
26590
26516
|
paginationProps: paginationProps,
|
|
26591
26517
|
paginationMode: paginationMode,
|
|
26592
26518
|
rowCount: rowCount
|
|
@@ -26597,17 +26523,15 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26597
26523
|
selectionStatus: selectionStatus.current,
|
|
26598
26524
|
apiRef: apiRef,
|
|
26599
26525
|
isRowSelectable: isRowSelectable,
|
|
26600
|
-
|
|
26601
|
-
|
|
26602
|
-
|
|
26603
|
-
onPageSizeChange: onPageSizeChange,
|
|
26604
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
26526
|
+
paginationModel: paginationModel,
|
|
26527
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
26528
|
+
pageSizeOptions: pageSizeOptions,
|
|
26605
26529
|
paginationProps: paginationProps,
|
|
26606
26530
|
paginationMode: paginationMode
|
|
26607
26531
|
})) : null;
|
|
26608
26532
|
}
|
|
26609
26533
|
}),
|
|
26610
|
-
|
|
26534
|
+
slotProps: _objectSpread2(_objectSpread2({}, slotProps), {}, {
|
|
26611
26535
|
toolbar: _objectSpread2({
|
|
26612
26536
|
hideToolbar,
|
|
26613
26537
|
RenderedToolbar,
|
|
@@ -26618,18 +26542,16 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26618
26542
|
selectionStatus,
|
|
26619
26543
|
apiRef,
|
|
26620
26544
|
isRowSelectable,
|
|
26621
|
-
|
|
26622
|
-
|
|
26623
|
-
|
|
26624
|
-
onPageSizeChange,
|
|
26625
|
-
rowsPerPageOptions,
|
|
26545
|
+
paginationModel,
|
|
26546
|
+
onPaginationModelChange,
|
|
26547
|
+
pageSizeOptions,
|
|
26626
26548
|
paginationProps,
|
|
26627
26549
|
paginationMode,
|
|
26628
26550
|
rowCount
|
|
26629
|
-
},
|
|
26551
|
+
}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar)
|
|
26630
26552
|
}),
|
|
26631
|
-
|
|
26632
|
-
|
|
26553
|
+
rowSelectionModel: rowSelectionModel,
|
|
26554
|
+
onRowSelectionModelChange: (newSelectionModel, details) => {
|
|
26633
26555
|
if (pagination && paginationMode != 'server') {
|
|
26634
26556
|
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
|
|
26635
26557
|
let {
|
|
@@ -26687,7 +26609,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26687
26609
|
};
|
|
26688
26610
|
}
|
|
26689
26611
|
}
|
|
26690
|
-
|
|
26612
|
+
onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
|
|
26691
26613
|
},
|
|
26692
26614
|
sx: _objectSpread2(_objectSpread2({}, sx), {}, {
|
|
26693
26615
|
'.MuiDataGrid-columnHeaders': {
|
|
@@ -26761,5 +26683,5 @@ const TextCell = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26761
26683
|
TextCell.className = CLASSNAME;
|
|
26762
26684
|
TextCell.displayName = COMPONENT_NAME;
|
|
26763
26685
|
|
|
26764
|
-
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 };
|
|
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, isOperatorValueValid, isValueValid, muiIconToDSIcon, numberOperatorDecoder, numberOperatorEncoder, onServerSideSelectionStatusChange, operatorList, updateUrl, urlSearchParamsToString };
|
|
26765
26687
|
//# sourceMappingURL=index.js.map
|