@redsift/table 11.2.1-muiv5 → 11.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +25 -31
- package/index.js +256 -334
- package/index.js.map +1 -1
- package/package.json +4 -4
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GRID_DETAIL_PANEL_TOGGLE_COL_DEF, getGridNumericOperators as getGridNumericOperators$1, GridFilterInputValue, GridFilterInputMultipleValue, getGridStringOperators as getGridStringOperators$1, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators,
|
|
1
|
+
import { GRID_DETAIL_PANEL_TOGGLE_COL_DEF, getGridNumericOperators as getGridNumericOperators$1, GridFilterInputValue, GridFilterInputMultipleValue, getGridStringOperators as getGridStringOperators$1, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators, GridLogicOperator, GridToolbarContainer, GridToolbarFilterButton, GridToolbarColumnsButton, GridToolbarDensitySelector, GridToolbarExport, gridExpandedSortedRowIdsSelector, gridPaginatedVisibleSortedGridRowEntriesSelector, gridPaginatedVisibleSortedGridRowIdsSelector, gridFilteredSortedRowEntriesSelector, gridFilteredSortedRowIdsSelector, useGridApiRef, DataGridPro } from '@mui/x-data-grid-pro';
|
|
2
2
|
export { getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators } from '@mui/x-data-grid-pro';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import React__default, { Children, isValidElement, cloneElement, forwardRef, useLayoutEffect, useEffect, useRef, useContext, useState, useCallback, createElement, useMemo } from 'react';
|
|
@@ -17639,7 +17639,7 @@ const isBetweenOperator = {
|
|
|
17639
17639
|
label: 'is between',
|
|
17640
17640
|
value: 'isBetween',
|
|
17641
17641
|
getApplyFilterFn: filterItem => {
|
|
17642
|
-
if (!filterItem.
|
|
17642
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
17643
17643
|
return null;
|
|
17644
17644
|
}
|
|
17645
17645
|
if (!Array.isArray(filterItem.value) || filterItem.value.length !== 2) {
|
|
@@ -17652,7 +17652,7 @@ const isBetweenOperator = {
|
|
|
17652
17652
|
return null;
|
|
17653
17653
|
}
|
|
17654
17654
|
return params => {
|
|
17655
|
-
return params.value !== null && filterItem.value[0] <= params.value && params.value <= filterItem.value[1];
|
|
17655
|
+
return params.value !== null && params.value !== undefined && filterItem.value[0] <= params.value && params.value <= filterItem.value[1];
|
|
17656
17656
|
};
|
|
17657
17657
|
},
|
|
17658
17658
|
InputComponent: InputNumberInterval
|
|
@@ -17665,7 +17665,7 @@ const doesNotEqual = {
|
|
|
17665
17665
|
label: 'does not equal',
|
|
17666
17666
|
value: 'doesNotEqual',
|
|
17667
17667
|
getApplyFilterFn: filterItem => {
|
|
17668
|
-
if (!filterItem.
|
|
17668
|
+
if (!filterItem.field || !filterItem.value || !filterItem.value) {
|
|
17669
17669
|
return null;
|
|
17670
17670
|
}
|
|
17671
17671
|
return params => {
|
|
@@ -17686,7 +17686,7 @@ const doesNotContain = {
|
|
|
17686
17686
|
label: 'does not contain',
|
|
17687
17687
|
value: 'doesNotContain',
|
|
17688
17688
|
getApplyFilterFn: filterItem => {
|
|
17689
|
-
if (!filterItem.
|
|
17689
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
17690
17690
|
return null;
|
|
17691
17691
|
}
|
|
17692
17692
|
return params => {
|
|
@@ -17707,7 +17707,7 @@ const containsAnyOfOperator = {
|
|
|
17707
17707
|
label: 'contains any of',
|
|
17708
17708
|
value: 'containsAnyOf',
|
|
17709
17709
|
getApplyFilterFn: filterItem => {
|
|
17710
|
-
if (!filterItem.
|
|
17710
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
17711
17711
|
return null;
|
|
17712
17712
|
}
|
|
17713
17713
|
return params => {
|
|
@@ -17730,7 +17730,7 @@ const containsAnyOfCIOperator = {
|
|
|
17730
17730
|
label: 'contains any of (case insensitive)',
|
|
17731
17731
|
value: 'containsAnyOf',
|
|
17732
17732
|
getApplyFilterFn: filterItem => {
|
|
17733
|
-
if (!filterItem.
|
|
17733
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
17734
17734
|
return null;
|
|
17735
17735
|
}
|
|
17736
17736
|
return params => {
|
|
@@ -17757,7 +17757,7 @@ const endsWithAnyOfOperator = {
|
|
|
17757
17757
|
label: 'ends with any of',
|
|
17758
17758
|
value: 'endsWithAnyOf',
|
|
17759
17759
|
getApplyFilterFn: filterItem => {
|
|
17760
|
-
if (!filterItem.
|
|
17760
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
17761
17761
|
return null;
|
|
17762
17762
|
}
|
|
17763
17763
|
return params => {
|
|
@@ -17784,7 +17784,7 @@ const isAnyOfOperator = {
|
|
|
17784
17784
|
label: 'is any of',
|
|
17785
17785
|
value: 'isAnyOf',
|
|
17786
17786
|
getApplyFilterFn: filterItem => {
|
|
17787
|
-
if (!filterItem.
|
|
17787
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
17788
17788
|
return null;
|
|
17789
17789
|
}
|
|
17790
17790
|
return params => {
|
|
@@ -17808,7 +17808,7 @@ const isNotAnyOfOperator = {
|
|
|
17808
17808
|
label: 'is not any of',
|
|
17809
17809
|
value: 'isNotAnyOf',
|
|
17810
17810
|
getApplyFilterFn: filterItem => {
|
|
17811
|
-
if (!filterItem.
|
|
17811
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
17812
17812
|
return null;
|
|
17813
17813
|
}
|
|
17814
17814
|
return params => {
|
|
@@ -17832,7 +17832,7 @@ const startsWithAnyOfOperator = {
|
|
|
17832
17832
|
label: 'starts with any of',
|
|
17833
17833
|
value: 'startsWithAnyOf',
|
|
17834
17834
|
getApplyFilterFn: filterItem => {
|
|
17835
|
-
if (!filterItem.
|
|
17835
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
17836
17836
|
return null;
|
|
17837
17837
|
}
|
|
17838
17838
|
return params => {
|
|
@@ -17877,13 +17877,13 @@ const operatorList = {
|
|
|
17877
17877
|
|
|
17878
17878
|
const getRsStringColumnType = () => {
|
|
17879
17879
|
return {
|
|
17880
|
-
|
|
17880
|
+
type: 'string',
|
|
17881
17881
|
filterOperators: operatorList.rsString
|
|
17882
17882
|
};
|
|
17883
17883
|
};
|
|
17884
17884
|
const getRsNumberColumnType = () => {
|
|
17885
17885
|
return {
|
|
17886
|
-
|
|
17886
|
+
type: 'number',
|
|
17887
17887
|
filterOperators: operatorList.rsNumber
|
|
17888
17888
|
};
|
|
17889
17889
|
};
|
|
@@ -17894,7 +17894,7 @@ const customColumnTypes = {
|
|
|
17894
17894
|
|
|
17895
17895
|
const API_URL = 'https://api.openai.com/v1/chat/completions';
|
|
17896
17896
|
async function getCompletion(text, role, openai_api_key) {
|
|
17897
|
-
let model = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'gpt-3.5-turbo-
|
|
17897
|
+
let model = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'gpt-3.5-turbo-1106';
|
|
17898
17898
|
try {
|
|
17899
17899
|
const messages = [{
|
|
17900
17900
|
role: 'system',
|
|
@@ -18063,42 +18063,39 @@ const numberOperatorDecoder = {
|
|
|
18063
18063
|
lt: '<',
|
|
18064
18064
|
lte: '<='
|
|
18065
18065
|
};
|
|
18066
|
-
const isOperatorValueValid = (
|
|
18067
|
-
const column = columns.find(column => column.field ===
|
|
18066
|
+
const isOperatorValueValid = (field, operator, columns) => {
|
|
18067
|
+
const column = columns.find(column => column.field === field);
|
|
18068
18068
|
if (!column) {
|
|
18069
18069
|
return false;
|
|
18070
18070
|
}
|
|
18071
18071
|
const columnType = (column === null || column === void 0 ? void 0 : column.type) || 'string';
|
|
18072
|
-
const operators = operatorList[columnType];
|
|
18072
|
+
const operators = column.filterOperators || operatorList[columnType];
|
|
18073
18073
|
if (!operators) {
|
|
18074
18074
|
return false;
|
|
18075
18075
|
}
|
|
18076
|
-
|
|
18077
|
-
return !!operators.filterOperators.find(op => columnType === 'number' && Object.keys(numberOperatorEncoder).includes(op.value) ? numberOperatorEncoder[op.value] === operatorValue : op['value'] === operatorValue);
|
|
18078
|
-
}
|
|
18079
|
-
return !!operators.find(op => ['number', 'rsNumber'].includes(columnType) && Object.keys(numberOperatorEncoder).includes(op.value) ? numberOperatorEncoder[op.value] === operatorValue : op['value'] === operatorValue);
|
|
18076
|
+
return !!operators.find(op => columnType === 'number' && Object.keys(numberOperatorEncoder).includes(op.value) ? numberOperatorEncoder[op.value] === operator : op.value === operator);
|
|
18080
18077
|
};
|
|
18081
18078
|
const listOperators = ['containsAnyOf', 'endsWithAnyOf', 'isAnyOf', 'isNotAnyOf', 'startsWithAnyOf'];
|
|
18082
18079
|
|
|
18083
18080
|
// Check if the value doesn't break
|
|
18084
|
-
const isValueValid = (value,
|
|
18081
|
+
const isValueValid = (value, field, columns, operator) => {
|
|
18085
18082
|
var _column$type;
|
|
18086
18083
|
// every field accepts undefined as value for default
|
|
18087
18084
|
if (value === undefined || value === '') {
|
|
18088
18085
|
return true;
|
|
18089
18086
|
}
|
|
18090
18087
|
|
|
18091
|
-
// xxxAnyOf accepts as value only lists, and we are
|
|
18088
|
+
// xxxAnyOf accepts as value only lists, and we are declaring them in the
|
|
18092
18089
|
// URL as `list=[...]`
|
|
18093
|
-
if (listOperators.includes(
|
|
18090
|
+
if (listOperators.includes(operator)) {
|
|
18094
18091
|
return Array.isArray(value) || value === '';
|
|
18095
18092
|
}
|
|
18096
18093
|
|
|
18097
18094
|
// We are accepting arrays only if they are of the 'xxxAnyOf' type
|
|
18098
|
-
if (Array.isArray(value) && !listOperators.includes(
|
|
18095
|
+
if (Array.isArray(value) && !listOperators.includes(operator)) {
|
|
18099
18096
|
return false;
|
|
18100
18097
|
}
|
|
18101
|
-
const column = columns.find(column => column.field ===
|
|
18098
|
+
const column = columns.find(column => column.field === field);
|
|
18102
18099
|
if (!column) {
|
|
18103
18100
|
return false;
|
|
18104
18101
|
}
|
|
@@ -18136,14 +18133,14 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
18136
18133
|
if (!searchString) {
|
|
18137
18134
|
return 'invalid';
|
|
18138
18135
|
}
|
|
18139
|
-
let
|
|
18136
|
+
let logicOperator = GridLogicOperator.And;
|
|
18140
18137
|
const searchParams = new URLSearchParams();
|
|
18141
18138
|
for (const [key, value] of new URLSearchParams(searchString)) {
|
|
18142
18139
|
if (key.startsWith('_') && !['_logicOperator', '_sortColumn', '_pinnedColumnsLeft', '_pinnedColumnsRight', '_columnVisibility', '_pagination'].includes(key)) {
|
|
18143
18140
|
searchParams.set(key, value);
|
|
18144
18141
|
}
|
|
18145
18142
|
if (key === '_logicOperator') {
|
|
18146
|
-
|
|
18143
|
+
logicOperator = value;
|
|
18147
18144
|
}
|
|
18148
18145
|
}
|
|
18149
18146
|
let id = 5000;
|
|
@@ -18184,8 +18181,8 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
18184
18181
|
return;
|
|
18185
18182
|
}
|
|
18186
18183
|
items.push({
|
|
18187
|
-
|
|
18188
|
-
|
|
18184
|
+
field,
|
|
18185
|
+
operator: columnType === 'number' && Object.keys(numberOperatorDecoder).includes(operator) ? numberOperatorDecoder[operator] : operator,
|
|
18189
18186
|
id,
|
|
18190
18187
|
value: listOperators.includes(operator) && decodedValue === '' ? [] : decodedValue,
|
|
18191
18188
|
type
|
|
@@ -18200,23 +18197,23 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
18200
18197
|
}
|
|
18201
18198
|
return {
|
|
18202
18199
|
items,
|
|
18203
|
-
|
|
18200
|
+
logicOperator
|
|
18204
18201
|
};
|
|
18205
18202
|
};
|
|
18206
18203
|
const getSearchParamsFromFilterModel = filterModel => {
|
|
18207
18204
|
const searchParams = new URLSearchParams();
|
|
18208
|
-
searchParams.set('_logicOperator', filterModel['
|
|
18205
|
+
searchParams.set('_logicOperator', filterModel['logicOperator'] || '');
|
|
18209
18206
|
filterModel['items'].forEach(item => {
|
|
18210
18207
|
const {
|
|
18211
|
-
|
|
18212
|
-
|
|
18208
|
+
field,
|
|
18209
|
+
operator,
|
|
18213
18210
|
value,
|
|
18214
18211
|
type
|
|
18215
18212
|
} = item;
|
|
18216
|
-
if (Object.keys(numberOperatorEncoder).includes(
|
|
18217
|
-
searchParams.set(`_${
|
|
18213
|
+
if (Object.keys(numberOperatorEncoder).includes(operator)) {
|
|
18214
|
+
searchParams.set(`_${field}[${numberOperatorEncoder[operator]},${encodeValue(type)}]`, encodeValue(value));
|
|
18218
18215
|
} else {
|
|
18219
|
-
searchParams.set(`_${
|
|
18216
|
+
searchParams.set(`_${field}[${encodeValue(operator)},${encodeValue(type)}]`, encodeValue(value));
|
|
18220
18217
|
}
|
|
18221
18218
|
});
|
|
18222
18219
|
return searchParams;
|
|
@@ -18242,7 +18239,7 @@ const getFilterModel = (search, columns, localStorageFilters, setLocalStorageFil
|
|
|
18242
18239
|
}
|
|
18243
18240
|
return initialState && initialState.filter && initialState.filter.filterModel ? initialState.filter.filterModel : {
|
|
18244
18241
|
items: [],
|
|
18245
|
-
|
|
18242
|
+
logicOperator: GridLogicOperator.And
|
|
18246
18243
|
};
|
|
18247
18244
|
};
|
|
18248
18245
|
|
|
@@ -18358,11 +18355,11 @@ const getPaginationModel = (search, localStoragePagination, setLocalStoragePagin
|
|
|
18358
18355
|
|
|
18359
18356
|
const getSearchParamsFromColumnVisibility = (columnVisibility, columns) => {
|
|
18360
18357
|
const searchParams = new URLSearchParams();
|
|
18361
|
-
const
|
|
18358
|
+
const fields = columns.map(column => column.field);
|
|
18362
18359
|
|
|
18363
18360
|
// if column visibility model is empty, show all columns
|
|
18364
18361
|
if (Object.keys(columnVisibility).length == 0) {
|
|
18365
|
-
searchParams.set('_columnVisibility', `[${
|
|
18362
|
+
searchParams.set('_columnVisibility', `[${fields.join(',')}]`);
|
|
18366
18363
|
return searchParams;
|
|
18367
18364
|
}
|
|
18368
18365
|
const finalColumnVisibility = columns.filter(c => {
|
|
@@ -18412,12 +18409,12 @@ const getColumnVisibilityFromString = (notParsed, tableColumns) => {
|
|
|
18412
18409
|
continue;
|
|
18413
18410
|
}
|
|
18414
18411
|
exist = true;
|
|
18415
|
-
const
|
|
18412
|
+
const fields = tableColumns.map(column => column.field);
|
|
18416
18413
|
// TODO: Add validation that , is present
|
|
18417
18414
|
const columns = encodedValues.split(',').map(value => decodeValue(value));
|
|
18418
18415
|
|
|
18419
18416
|
// for each column, check if it's visible and add it to visibility model
|
|
18420
|
-
for (const column of
|
|
18417
|
+
for (const column of fields) {
|
|
18421
18418
|
const isColumnVisible = columns.includes(column);
|
|
18422
18419
|
visibility[column] = isColumnVisible;
|
|
18423
18420
|
if (isColumnVisible) {
|
|
@@ -18484,8 +18481,8 @@ const getPinnedColumnsFromString = (notParsed, tableColumns) => {
|
|
|
18484
18481
|
if (typeof encodedValues !== 'string') {
|
|
18485
18482
|
continue;
|
|
18486
18483
|
}
|
|
18487
|
-
const
|
|
18488
|
-
const columns = encodedValues.split(',').map(value => decodeValue(value)).filter(val => typeof val === 'string' &&
|
|
18484
|
+
const fields = [...tableColumns.map(column => column.field), '__check__'];
|
|
18485
|
+
const columns = encodedValues.split(',').map(value => decodeValue(value)).filter(val => typeof val === 'string' && fields.includes(val));
|
|
18489
18486
|
if (fieldURL === '_pinnedColumnsLeft') {
|
|
18490
18487
|
pinnedColumns['left'] = columns;
|
|
18491
18488
|
}
|
|
@@ -18638,17 +18635,17 @@ const updateUrl = (_ref4, search, historyReplace, columns) => {
|
|
|
18638
18635
|
// do not use it for equivalence (e.g. with value `3` and undefined we
|
|
18639
18636
|
// will get 0).
|
|
18640
18637
|
const compareFilters = (firstFilter, secondFilter) => {
|
|
18641
|
-
if (firstFilter.
|
|
18638
|
+
if (firstFilter.field < secondFilter.field) {
|
|
18642
18639
|
return -1;
|
|
18643
|
-
} else if (firstFilter.
|
|
18640
|
+
} else if (firstFilter.field > secondFilter.field) {
|
|
18644
18641
|
return 1;
|
|
18645
18642
|
}
|
|
18646
|
-
if (firstFilter.
|
|
18643
|
+
if (firstFilter.operator === undefined || secondFilter.operator === undefined) {
|
|
18647
18644
|
return 0;
|
|
18648
18645
|
}
|
|
18649
|
-
if (firstFilter.
|
|
18646
|
+
if (firstFilter.operator < secondFilter.operator) {
|
|
18650
18647
|
return -1;
|
|
18651
|
-
} else if (firstFilter.
|
|
18648
|
+
} else if (firstFilter.operator > secondFilter.operator) {
|
|
18652
18649
|
return 1;
|
|
18653
18650
|
}
|
|
18654
18651
|
if (firstFilter.value < secondFilter.value) {
|
|
@@ -18659,18 +18656,18 @@ const compareFilters = (firstFilter, secondFilter) => {
|
|
|
18659
18656
|
return 0;
|
|
18660
18657
|
};
|
|
18661
18658
|
const areFiltersEquivalent = (firstFilter, secondFilter) => {
|
|
18662
|
-
return firstFilter.
|
|
18659
|
+
return firstFilter.field === secondFilter.field && firstFilter.operator === secondFilter.operator && firstFilter.value === secondFilter.value;
|
|
18663
18660
|
};
|
|
18664
18661
|
const areFilterModelsEquivalent = (filterModel, filterModelToMatch) => {
|
|
18665
18662
|
const {
|
|
18666
18663
|
items,
|
|
18667
|
-
|
|
18664
|
+
logicOperator
|
|
18668
18665
|
} = filterModel;
|
|
18669
18666
|
const {
|
|
18670
18667
|
items: itemsToMatch,
|
|
18671
|
-
|
|
18668
|
+
logicOperator: logicOperatorToMatch
|
|
18672
18669
|
} = filterModelToMatch;
|
|
18673
|
-
if (
|
|
18670
|
+
if (logicOperator !== logicOperatorToMatch) {
|
|
18674
18671
|
return false;
|
|
18675
18672
|
}
|
|
18676
18673
|
if (items.length !== itemsToMatch.length) {
|
|
@@ -18683,7 +18680,7 @@ const areFilterModelsEquivalent = (filterModel, filterModelToMatch) => {
|
|
|
18683
18680
|
const filterToCompare = itemsToMatch[i];
|
|
18684
18681
|
|
|
18685
18682
|
// compareFilters return 0 if and only if the filters have the same
|
|
18686
|
-
//
|
|
18683
|
+
// field, operator, and value
|
|
18687
18684
|
if (!areFiltersEquivalent(filter, filterToCompare)) {
|
|
18688
18685
|
return false;
|
|
18689
18686
|
}
|
|
@@ -24494,16 +24491,16 @@ const getRole = (config, dateFormat) => {
|
|
|
24494
24491
|
}).join('\n');
|
|
24495
24492
|
return `The AI assistant parses user input to generate a JSON object that will be used as a row filter for a data table MUI Data Grid.
|
|
24496
24493
|
The filter supports mulitple conditions using only two logical operator "and", "or". It only allows "and" between all conditions or "or" between all conditions. It can't mix the two types.
|
|
24497
|
-
The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "
|
|
24498
|
-
- "
|
|
24499
|
-
- "items": a list of conditions, each is an object with exactly the three keys "
|
|
24500
|
-
- "
|
|
24494
|
+
The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "logicOperator" and "items":
|
|
24495
|
+
- "logicOperator": the logical operator, only "and" or "or" are allowed. If there is only one condition in the "items", use "and".
|
|
24496
|
+
- "items": a list of conditions, each is an object with exactly the three keys "field", "operator" and "value":
|
|
24497
|
+
- "field": the column name, must be one of ${columns}
|
|
24501
24498
|
- "value":
|
|
24502
|
-
- this can be skipped if the "
|
|
24503
|
-
- a list of multiple values if the "
|
|
24499
|
+
- this can be skipped if the "operator" is either "isEmpty" or "isNotEmpty"
|
|
24500
|
+
- a list of multiple values if the "operator" ends with "AnyOf"
|
|
24504
24501
|
- otherwise, it's a single value represented as a string: "true" instead of true, "false" instead of false, "0.6" instead of 0.6.
|
|
24505
24502
|
For "date" data type, use ${dateFormat}. If relative date is input, convert to the actual date given today is ${today}.
|
|
24506
|
-
- "
|
|
24503
|
+
- "operator": the comparison operator, accepted values depend on the data type of the column
|
|
24507
24504
|
${operators}
|
|
24508
24505
|
|
|
24509
24506
|
Below is the datatype in square bracket, constraints on the data range if any, followed by the description of each column used in the data table:
|
|
@@ -24540,10 +24537,10 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24540
24537
|
nlpFilterConfig,
|
|
24541
24538
|
onFilterModelChange,
|
|
24542
24539
|
dateFormat = 'yyyy-mm-dd',
|
|
24543
|
-
defaultModel = 'gpt-4-
|
|
24540
|
+
defaultModel = 'gpt-4-1106-preview',
|
|
24544
24541
|
defaultFilter = {
|
|
24545
24542
|
items: [],
|
|
24546
|
-
|
|
24543
|
+
logicOperator: 'and'
|
|
24547
24544
|
},
|
|
24548
24545
|
disablePower = false,
|
|
24549
24546
|
localeText
|
|
@@ -24621,7 +24618,7 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24621
24618
|
value: prompt
|
|
24622
24619
|
}), /*#__PURE__*/React__default.createElement(Button, {
|
|
24623
24620
|
variant: "primary",
|
|
24624
|
-
"
|
|
24621
|
+
"aria-label": buttonAriaLabel,
|
|
24625
24622
|
type: "submit",
|
|
24626
24623
|
isLoading: isLoading
|
|
24627
24624
|
}, buttonText)), !disablePower && /*#__PURE__*/React__default.createElement(Tooltip, null, /*#__PURE__*/React__default.createElement(Tooltip.Trigger, null, /*#__PURE__*/React__default.createElement(Switch, {
|
|
@@ -24682,7 +24679,7 @@ const Toolbar$2 = props => {
|
|
|
24682
24679
|
let {
|
|
24683
24680
|
apiRef
|
|
24684
24681
|
} = _ref;
|
|
24685
|
-
return
|
|
24682
|
+
return gridExpandedSortedRowIdsSelector(apiRef);
|
|
24686
24683
|
}
|
|
24687
24684
|
},
|
|
24688
24685
|
printOptions: {
|
|
@@ -26914,12 +26911,10 @@ const ServerSideControlledPagination = _ref3 => {
|
|
|
26914
26911
|
selectionStatus,
|
|
26915
26912
|
displaySelection,
|
|
26916
26913
|
displayPagination,
|
|
26917
|
-
|
|
26918
|
-
|
|
26919
|
-
|
|
26920
|
-
onPageSizeChange,
|
|
26914
|
+
paginationModel,
|
|
26915
|
+
onPaginationModelChange,
|
|
26916
|
+
pageSizeOptions,
|
|
26921
26917
|
displayRowsPerPage,
|
|
26922
|
-
rowsPerPageOptions,
|
|
26923
26918
|
paginationProps,
|
|
26924
26919
|
rowCount
|
|
26925
26920
|
} = _ref3;
|
|
@@ -26938,13 +26933,17 @@ const ServerSideControlledPagination = _ref3 => {
|
|
|
26938
26933
|
}, totalRowsLabel) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$1({
|
|
26939
26934
|
component: "div",
|
|
26940
26935
|
count: totalNumberOfRowsInTable,
|
|
26941
|
-
page: page,
|
|
26942
|
-
onPageChange: (event,
|
|
26943
|
-
|
|
26944
|
-
|
|
26945
|
-
|
|
26946
|
-
|
|
26947
|
-
|
|
26936
|
+
page: paginationModel.page,
|
|
26937
|
+
onPageChange: (event, page) => onPaginationModelChange({
|
|
26938
|
+
page,
|
|
26939
|
+
pageSize: paginationModel.pageSize
|
|
26940
|
+
}),
|
|
26941
|
+
rowsPerPage: paginationModel.pageSize,
|
|
26942
|
+
onRowsPerPageChange: event => onPaginationModelChange({
|
|
26943
|
+
page: paginationModel.page,
|
|
26944
|
+
pageSize: parseInt(event.target.value, 10)
|
|
26945
|
+
}),
|
|
26946
|
+
rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
|
|
26948
26947
|
}, paginationProps)) : null);
|
|
26949
26948
|
};
|
|
26950
26949
|
|
|
@@ -26970,11 +26969,9 @@ const ControlledPagination = _ref3 => {
|
|
|
26970
26969
|
displayPagination = false,
|
|
26971
26970
|
selectionStatus,
|
|
26972
26971
|
apiRef,
|
|
26973
|
-
|
|
26974
|
-
|
|
26975
|
-
|
|
26976
|
-
onPageSizeChange,
|
|
26977
|
-
rowsPerPageOptions,
|
|
26972
|
+
paginationModel,
|
|
26973
|
+
onPaginationModelChange,
|
|
26974
|
+
pageSizeOptions,
|
|
26978
26975
|
isRowSelectable,
|
|
26979
26976
|
paginationProps
|
|
26980
26977
|
} = _ref3;
|
|
@@ -27004,17 +27001,25 @@ const ControlledPagination = _ref3 => {
|
|
|
27004
27001
|
}, `${selectionStatus.numberOfSelectedRows} row${selectionStatus.numberOfSelectedRows > 1 ? 's' : ''} selected`) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$1({
|
|
27005
27002
|
component: "div",
|
|
27006
27003
|
count: numberOfFilteredRowsInTable,
|
|
27007
|
-
page: page,
|
|
27008
|
-
onPageChange: (event,
|
|
27009
|
-
|
|
27004
|
+
page: paginationModel.page,
|
|
27005
|
+
onPageChange: (event, page) => {
|
|
27006
|
+
onPaginationModelChange({
|
|
27007
|
+
page,
|
|
27008
|
+
pageSize: paginationModel.pageSize
|
|
27009
|
+
});
|
|
27010
|
+
},
|
|
27011
|
+
rowsPerPage: paginationModel.pageSize,
|
|
27010
27012
|
onRowsPerPageChange: event => {
|
|
27011
|
-
|
|
27013
|
+
onPaginationModelChange({
|
|
27014
|
+
page: paginationModel.page,
|
|
27015
|
+
pageSize: parseInt(event.target.value, 10)
|
|
27016
|
+
});
|
|
27012
27017
|
},
|
|
27013
|
-
rowsPerPageOptions: displayRowsPerPage ?
|
|
27018
|
+
rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
|
|
27014
27019
|
}, paginationProps)) : null);
|
|
27015
27020
|
};
|
|
27016
27021
|
|
|
27017
|
-
const _excluded$3 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "
|
|
27022
|
+
const _excluded$3 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "paginationModel", "onPaginationModelChange", "pageSizeOptions", "paginationProps", "paginationMode", "rowCount"];
|
|
27018
27023
|
const ToolbarWrapper = _ref => {
|
|
27019
27024
|
let {
|
|
27020
27025
|
hideToolbar,
|
|
@@ -27026,11 +27031,9 @@ const ToolbarWrapper = _ref => {
|
|
|
27026
27031
|
selectionStatus,
|
|
27027
27032
|
apiRef,
|
|
27028
27033
|
isRowSelectable,
|
|
27029
|
-
|
|
27030
|
-
|
|
27031
|
-
|
|
27032
|
-
onPageSizeChange,
|
|
27033
|
-
rowsPerPageOptions,
|
|
27034
|
+
paginationModel,
|
|
27035
|
+
onPaginationModelChange,
|
|
27036
|
+
pageSizeOptions,
|
|
27034
27037
|
paginationProps,
|
|
27035
27038
|
paginationMode = 'client',
|
|
27036
27039
|
rowCount
|
|
@@ -27044,11 +27047,9 @@ const ToolbarWrapper = _ref => {
|
|
|
27044
27047
|
displayRowsPerPage: false,
|
|
27045
27048
|
displayPagination: ['top', 'both'].includes(paginationPlacement),
|
|
27046
27049
|
selectionStatus: selectionStatus.current,
|
|
27047
|
-
|
|
27048
|
-
|
|
27049
|
-
|
|
27050
|
-
onPageSizeChange: onPageSizeChange,
|
|
27051
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
27050
|
+
paginationModel: paginationModel,
|
|
27051
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
27052
|
+
pageSizeOptions: pageSizeOptions,
|
|
27052
27053
|
paginationProps: paginationProps,
|
|
27053
27054
|
rowCount: rowCount
|
|
27054
27055
|
}) : /*#__PURE__*/React__default.createElement(ControlledPagination, {
|
|
@@ -27058,30 +27059,26 @@ const ToolbarWrapper = _ref => {
|
|
|
27058
27059
|
selectionStatus: selectionStatus.current,
|
|
27059
27060
|
apiRef: apiRef,
|
|
27060
27061
|
isRowSelectable: isRowSelectable,
|
|
27061
|
-
|
|
27062
|
-
|
|
27063
|
-
|
|
27064
|
-
onPageSizeChange: onPageSizeChange,
|
|
27065
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
27062
|
+
paginationModel: paginationModel,
|
|
27063
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
27064
|
+
pageSizeOptions: pageSizeOptions,
|
|
27066
27065
|
paginationProps: paginationProps
|
|
27067
27066
|
}) : null);
|
|
27068
27067
|
};
|
|
27069
27068
|
|
|
27070
27069
|
const useControlledDatagridState = _ref => {
|
|
27071
|
-
var _initialState$paginat, _initialState$paginat2;
|
|
27070
|
+
var _ref2, _ref3, _propsPaginationModel, _initialState$paginat, _initialState$paginat2, _pageSizeOptions$, _ref4, _propsPaginationModel2, _initialState$paginat3, _initialState$paginat4;
|
|
27072
27071
|
let {
|
|
27073
27072
|
initialState,
|
|
27074
|
-
|
|
27073
|
+
pageSizeOptions,
|
|
27075
27074
|
propsColumnVisibilityModel,
|
|
27076
27075
|
propsFilterModel,
|
|
27077
27076
|
propsOnColumnVisibilityModelChange,
|
|
27078
27077
|
propsOnFilterModelChange,
|
|
27079
|
-
|
|
27080
|
-
propsOnPageSizeChange,
|
|
27078
|
+
propsOnPaginationModelChange,
|
|
27081
27079
|
propsOnPinnedColumnsChange,
|
|
27082
27080
|
propsOnSortModelChange,
|
|
27083
|
-
|
|
27084
|
-
propsPageSize,
|
|
27081
|
+
propsPaginationModel,
|
|
27085
27082
|
propsPinnedColumns,
|
|
27086
27083
|
propsSortModel
|
|
27087
27084
|
} = _ref;
|
|
@@ -27129,33 +27126,22 @@ const useControlledDatagridState = _ref => {
|
|
|
27129
27126
|
setSortModel(model);
|
|
27130
27127
|
}
|
|
27131
27128
|
};
|
|
27132
|
-
const [
|
|
27133
|
-
|
|
27134
|
-
|
|
27135
|
-
|
|
27136
|
-
|
|
27137
|
-
|
|
27138
|
-
|
|
27139
|
-
}
|
|
27140
|
-
};
|
|
27141
|
-
useEffect(() => {
|
|
27142
|
-
if (propsPage || propsPage === 0) {
|
|
27143
|
-
setPage(propsPage);
|
|
27144
|
-
}
|
|
27145
|
-
}, [propsPage]);
|
|
27146
|
-
const onPageSizeChange = pageSize => {
|
|
27147
|
-
onPageChange(0);
|
|
27148
|
-
if (propsOnPageSizeChange) {
|
|
27149
|
-
propsOnPageSizeChange(pageSize, undefined);
|
|
27129
|
+
const [paginationModel, setPaginationModel] = useState({
|
|
27130
|
+
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,
|
|
27131
|
+
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
|
|
27132
|
+
});
|
|
27133
|
+
const onPaginationModelChange = (model, details) => {
|
|
27134
|
+
if (propsOnPaginationModelChange) {
|
|
27135
|
+
propsOnPaginationModelChange(model, details);
|
|
27150
27136
|
} else {
|
|
27151
|
-
|
|
27137
|
+
setPaginationModel(model);
|
|
27152
27138
|
}
|
|
27153
27139
|
};
|
|
27154
27140
|
useEffect(() => {
|
|
27155
|
-
if (
|
|
27156
|
-
|
|
27141
|
+
if (propsPaginationModel) {
|
|
27142
|
+
setPaginationModel(propsPaginationModel);
|
|
27157
27143
|
}
|
|
27158
|
-
}, [
|
|
27144
|
+
}, [propsPaginationModel]);
|
|
27159
27145
|
return {
|
|
27160
27146
|
filterModel,
|
|
27161
27147
|
onFilterModelChange,
|
|
@@ -27165,14 +27151,12 @@ const useControlledDatagridState = _ref => {
|
|
|
27165
27151
|
onPinnedColumnsChange,
|
|
27166
27152
|
sortModel,
|
|
27167
27153
|
onSortModelChange,
|
|
27168
|
-
|
|
27169
|
-
|
|
27170
|
-
onPageChange,
|
|
27171
|
-
onPageSizeChange
|
|
27154
|
+
paginationModel,
|
|
27155
|
+
onPaginationModelChange
|
|
27172
27156
|
};
|
|
27173
27157
|
};
|
|
27174
27158
|
|
|
27175
|
-
const _excluded$2 = ["apiRef", "autoHeight", "className", "
|
|
27159
|
+
const _excluded$2 = ["apiRef", "autoHeight", "className", "slots", "slotProps", "filterModel", "columnVisibilityModel", "pinnedColumns", "sortModel", "paginationModel", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "onFilterModelChange", "rowSelectionModel", "onPaginationModelChange", "onRowSelectionModelChange", "onColumnVisibilityModelChange", "onPinnedColumnsChange", "onSortModelChange", "pagination", "paginationPlacement", "paginationProps", "rows", "pageSizeOptions", "sx", "theme", "paginationMode", "rowCount"];
|
|
27176
27160
|
const COMPONENT_NAME$2 = 'DataGrid';
|
|
27177
27161
|
const CLASSNAME$2 = 'redsift-datagrid';
|
|
27178
27162
|
const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
@@ -27181,33 +27165,30 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27181
27165
|
apiRef: propsApiRef,
|
|
27182
27166
|
autoHeight,
|
|
27183
27167
|
className,
|
|
27184
|
-
|
|
27185
|
-
|
|
27186
|
-
componentsProps,
|
|
27168
|
+
slots,
|
|
27169
|
+
slotProps,
|
|
27187
27170
|
filterModel: propsFilterModel,
|
|
27188
27171
|
columnVisibilityModel: propsColumnVisibilityModel,
|
|
27189
27172
|
pinnedColumns: propsPinnedColumns,
|
|
27190
27173
|
sortModel: propsSortModel,
|
|
27174
|
+
paginationModel: propsPaginationModel,
|
|
27191
27175
|
height: propsHeight,
|
|
27192
27176
|
hideToolbar,
|
|
27193
27177
|
initialState,
|
|
27194
27178
|
isRowSelectable,
|
|
27195
27179
|
license = process.env.MUI_LICENSE_KEY,
|
|
27196
27180
|
onFilterModelChange: propsOnFilterModelChange,
|
|
27197
|
-
|
|
27198
|
-
|
|
27181
|
+
rowSelectionModel: propsRowSelectionModel,
|
|
27182
|
+
onPaginationModelChange: propsOnPaginationModelChange,
|
|
27183
|
+
onRowSelectionModelChange: propsOnRowSelectionModelChange,
|
|
27199
27184
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
27200
27185
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
27201
27186
|
onSortModelChange: propsOnSortModelChange,
|
|
27202
|
-
selectionModel: propsSelectionModel,
|
|
27203
|
-
onSelectionModelChange: propsOnSelectionModelChange,
|
|
27204
|
-
page: propsPage,
|
|
27205
|
-
pageSize: propsPageSize,
|
|
27206
27187
|
pagination,
|
|
27207
27188
|
paginationPlacement = 'both',
|
|
27208
27189
|
paginationProps,
|
|
27209
27190
|
rows,
|
|
27210
|
-
|
|
27191
|
+
pageSizeOptions,
|
|
27211
27192
|
sx,
|
|
27212
27193
|
theme: propsTheme,
|
|
27213
27194
|
paginationMode = 'client',
|
|
@@ -27217,7 +27198,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27217
27198
|
const theme = useTheme$4(propsTheme);
|
|
27218
27199
|
const _apiRef = useGridApiRef();
|
|
27219
27200
|
const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
|
|
27220
|
-
const RenderedToolbar =
|
|
27201
|
+
const RenderedToolbar = slots !== null && slots !== void 0 && slots.toolbar ? slots.toolbar : Toolbar$2;
|
|
27221
27202
|
LicenseInfo.setLicenseKey(license);
|
|
27222
27203
|
const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
|
|
27223
27204
|
const {
|
|
@@ -27225,56 +27206,52 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27225
27206
|
filterModel,
|
|
27226
27207
|
onColumnVisibilityModelChange,
|
|
27227
27208
|
onFilterModelChange,
|
|
27228
|
-
|
|
27229
|
-
onPageSizeChange,
|
|
27209
|
+
onPaginationModelChange,
|
|
27230
27210
|
onPinnedColumnsChange,
|
|
27231
27211
|
onSortModelChange,
|
|
27232
|
-
|
|
27233
|
-
pageSize,
|
|
27212
|
+
paginationModel,
|
|
27234
27213
|
pinnedColumns,
|
|
27235
27214
|
sortModel
|
|
27236
27215
|
} = useControlledDatagridState({
|
|
27237
27216
|
initialState,
|
|
27238
|
-
|
|
27217
|
+
pageSizeOptions,
|
|
27239
27218
|
propsColumnVisibilityModel,
|
|
27240
27219
|
propsFilterModel,
|
|
27241
27220
|
propsOnColumnVisibilityModelChange,
|
|
27242
27221
|
propsOnFilterModelChange,
|
|
27243
27222
|
propsOnPinnedColumnsChange,
|
|
27244
27223
|
propsOnSortModelChange,
|
|
27245
|
-
|
|
27246
|
-
propsPageSize,
|
|
27224
|
+
propsPaginationModel,
|
|
27247
27225
|
propsPinnedColumns,
|
|
27248
27226
|
propsSortModel,
|
|
27249
|
-
|
|
27250
|
-
propsOnPageSizeChange
|
|
27227
|
+
propsOnPaginationModelChange
|
|
27251
27228
|
});
|
|
27252
|
-
const [
|
|
27229
|
+
const [rowSelectionModel, setRowSelectionModel] = useState(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
27253
27230
|
useEffect(() => {
|
|
27254
|
-
|
|
27255
|
-
}, [
|
|
27256
|
-
const
|
|
27257
|
-
if (
|
|
27258
|
-
|
|
27231
|
+
setRowSelectionModel(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
27232
|
+
}, [propsRowSelectionModel]);
|
|
27233
|
+
const onRowSelectionModelChange = (selectionModel, details) => {
|
|
27234
|
+
if (propsOnRowSelectionModelChange) {
|
|
27235
|
+
propsOnRowSelectionModelChange(selectionModel, details);
|
|
27259
27236
|
} else {
|
|
27260
|
-
|
|
27237
|
+
setRowSelectionModel(selectionModel);
|
|
27261
27238
|
}
|
|
27262
27239
|
};
|
|
27263
27240
|
const selectionStatus = useRef({
|
|
27264
27241
|
type: 'none',
|
|
27265
27242
|
numberOfSelectedRows: 0,
|
|
27266
27243
|
numberOfSelectedRowsInPage: 0,
|
|
27267
|
-
page,
|
|
27268
|
-
pageSize
|
|
27244
|
+
page: paginationModel.page,
|
|
27245
|
+
pageSize: paginationModel.pageSize
|
|
27269
27246
|
});
|
|
27270
27247
|
|
|
27271
27248
|
// in server-side pagination we want to update the selection status
|
|
27272
27249
|
// every time we navigate between pages, resize our page or select something
|
|
27273
27250
|
useEffect(() => {
|
|
27274
27251
|
if (paginationMode == 'server') {
|
|
27275
|
-
onServerSideSelectionStatusChange(Array.isArray(
|
|
27252
|
+
onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatus, isRowSelectable, paginationModel.page, paginationModel.pageSize);
|
|
27276
27253
|
}
|
|
27277
|
-
}, [
|
|
27254
|
+
}, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
|
|
27278
27255
|
if (!Array.isArray(rows)) {
|
|
27279
27256
|
return null;
|
|
27280
27257
|
}
|
|
@@ -27305,57 +27282,54 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27305
27282
|
apiRef: apiRef,
|
|
27306
27283
|
autoHeight: autoHeight,
|
|
27307
27284
|
checkboxSelectionVisibleOnly: Boolean(pagination),
|
|
27308
|
-
|
|
27309
|
-
|
|
27310
|
-
|
|
27311
|
-
|
|
27312
|
-
|
|
27313
|
-
|
|
27314
|
-
ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27285
|
+
slots: _objectSpread2(_objectSpread2({
|
|
27286
|
+
baseButton: BaseButton,
|
|
27287
|
+
baseCheckbox: BaseCheckbox,
|
|
27288
|
+
// baseTextField,
|
|
27289
|
+
basePopper: BasePopper,
|
|
27290
|
+
columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27315
27291
|
displayName: "ColumnFilteredIcon"
|
|
27316
27292
|
})),
|
|
27317
|
-
|
|
27293
|
+
columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27318
27294
|
displayName: "ColumnSelectorIcon"
|
|
27319
27295
|
})),
|
|
27320
|
-
|
|
27296
|
+
columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27321
27297
|
displayName: "ColumnSortedAscendingIcon"
|
|
27322
27298
|
})),
|
|
27323
|
-
|
|
27299
|
+
columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27324
27300
|
displayName: "ColumnSortedDescendingIcon"
|
|
27325
27301
|
})),
|
|
27326
|
-
|
|
27302
|
+
densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27327
27303
|
displayName: "DensityCompactIcon"
|
|
27328
27304
|
})),
|
|
27329
|
-
|
|
27305
|
+
densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27330
27306
|
displayName: "DensityStandardIcon"
|
|
27331
27307
|
})),
|
|
27332
|
-
|
|
27308
|
+
densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27333
27309
|
displayName: "DensityComfortableIcon"
|
|
27334
27310
|
})),
|
|
27335
|
-
|
|
27311
|
+
detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27336
27312
|
displayName: "DetailPanelCollapseIcon"
|
|
27337
27313
|
})),
|
|
27338
|
-
|
|
27314
|
+
detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27339
27315
|
displayName: "DetailPanelExpandIcon"
|
|
27340
27316
|
})),
|
|
27341
|
-
|
|
27317
|
+
exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27342
27318
|
displayName: "ExportIcon"
|
|
27343
27319
|
})),
|
|
27344
|
-
|
|
27320
|
+
openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
|
|
27345
27321
|
displayName: "OpenFilterButtonIcon"
|
|
27346
27322
|
}, props))
|
|
27347
|
-
},
|
|
27348
|
-
|
|
27349
|
-
|
|
27323
|
+
}, slots), {}, {
|
|
27324
|
+
toolbar: ToolbarWrapper,
|
|
27325
|
+
pagination: props => pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$1({}, props, {
|
|
27350
27326
|
displaySelection: false,
|
|
27351
27327
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
27352
27328
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
27353
27329
|
selectionStatus: selectionStatus.current,
|
|
27354
|
-
|
|
27355
|
-
|
|
27356
|
-
|
|
27357
|
-
onPageSizeChange: onPageSizeChange,
|
|
27358
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
27330
|
+
paginationModel: paginationModel,
|
|
27331
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
27332
|
+
pageSizeOptions: pageSizeOptions,
|
|
27359
27333
|
paginationProps: paginationProps,
|
|
27360
27334
|
paginationMode: paginationMode,
|
|
27361
27335
|
rowCount: rowCount
|
|
@@ -27366,16 +27340,14 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27366
27340
|
selectionStatus: selectionStatus.current,
|
|
27367
27341
|
apiRef: apiRef,
|
|
27368
27342
|
isRowSelectable: isRowSelectable,
|
|
27369
|
-
|
|
27370
|
-
|
|
27371
|
-
|
|
27372
|
-
onPageSizeChange: onPageSizeChange,
|
|
27373
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
27343
|
+
paginationModel: paginationModel,
|
|
27344
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
27345
|
+
pageSizeOptions: pageSizeOptions,
|
|
27374
27346
|
paginationProps: paginationProps,
|
|
27375
27347
|
paginationMode: paginationMode
|
|
27376
27348
|
})) : null
|
|
27377
27349
|
}),
|
|
27378
|
-
|
|
27350
|
+
slotProps: _objectSpread2(_objectSpread2({}, slotProps), {}, {
|
|
27379
27351
|
toolbar: _objectSpread2({
|
|
27380
27352
|
hideToolbar,
|
|
27381
27353
|
RenderedToolbar,
|
|
@@ -27386,15 +27358,13 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27386
27358
|
selectionStatus,
|
|
27387
27359
|
apiRef,
|
|
27388
27360
|
isRowSelectable,
|
|
27389
|
-
|
|
27390
|
-
|
|
27391
|
-
|
|
27392
|
-
onPageSizeChange,
|
|
27393
|
-
rowsPerPageOptions,
|
|
27361
|
+
paginationModel,
|
|
27362
|
+
onPaginationModelChange,
|
|
27363
|
+
pageSizeOptions,
|
|
27394
27364
|
paginationProps,
|
|
27395
27365
|
paginationMode,
|
|
27396
27366
|
rowCount
|
|
27397
|
-
},
|
|
27367
|
+
}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar)
|
|
27398
27368
|
}),
|
|
27399
27369
|
filterModel: filterModel,
|
|
27400
27370
|
columnVisibilityModel: columnVisibilityModel,
|
|
@@ -27410,13 +27380,11 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27410
27380
|
paginationMode: paginationMode,
|
|
27411
27381
|
keepNonExistentRowsSelected: paginationMode == 'server',
|
|
27412
27382
|
rows: rows,
|
|
27413
|
-
|
|
27414
|
-
|
|
27415
|
-
|
|
27416
|
-
|
|
27417
|
-
|
|
27418
|
-
selectionModel: selectionModel,
|
|
27419
|
-
onSelectionModelChange: (newSelectionModel, details) => {
|
|
27383
|
+
pageSizeOptions: pageSizeOptions,
|
|
27384
|
+
paginationModel: paginationModel,
|
|
27385
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
27386
|
+
rowSelectionModel: rowSelectionModel,
|
|
27387
|
+
onRowSelectionModelChange: (newSelectionModel, details) => {
|
|
27420
27388
|
if (pagination && paginationMode != 'server') {
|
|
27421
27389
|
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
|
|
27422
27390
|
let {
|
|
@@ -27474,7 +27442,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27474
27442
|
};
|
|
27475
27443
|
}
|
|
27476
27444
|
}
|
|
27477
|
-
|
|
27445
|
+
onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
|
|
27478
27446
|
},
|
|
27479
27447
|
sx: _objectSpread2(_objectSpread2({}, sx), {}, {
|
|
27480
27448
|
'.MuiDataGrid-columnHeaders': {
|
|
@@ -27491,8 +27459,6 @@ DataGrid.className = CLASSNAME$2;
|
|
|
27491
27459
|
DataGrid.displayName = COMPONENT_NAME$2;
|
|
27492
27460
|
|
|
27493
27461
|
// Get and Set data from LocalStorage WITHOUT useState
|
|
27494
|
-
|
|
27495
|
-
// triggering a state update and consecutive re-render
|
|
27496
27462
|
const useFetchState = (defaultValue, key) => {
|
|
27497
27463
|
let stickyValue = null;
|
|
27498
27464
|
try {
|
|
@@ -27500,16 +27466,7 @@ const useFetchState = (defaultValue, key) => {
|
|
|
27500
27466
|
} catch (e) {
|
|
27501
27467
|
console.error('StatefulDataGrid: error getting item from local storage: ', e);
|
|
27502
27468
|
}
|
|
27503
|
-
|
|
27504
|
-
|
|
27505
|
-
// TODO: temporary workaround to avoid clashes when someone had sorting on the now-removed screenshot field (renamed to num_annotations)
|
|
27506
|
-
// Consider upgrading the Datagrid component library as the exception handling was added in this PR: https://github.com/mui-org/material-ui-x/pull/3224
|
|
27507
|
-
if (parsedValue instanceof Array) {
|
|
27508
|
-
const fields = (parsedValue || []).map(item => item.field);
|
|
27509
|
-
if (fields.includes('screenshot') || fields.includes('diffs')) {
|
|
27510
|
-
parsedValue = defaultValue;
|
|
27511
|
-
}
|
|
27512
|
-
}
|
|
27469
|
+
const parsedValue = stickyValue !== null && stickyValue !== undefined && stickyValue !== 'undefined' ? JSON.parse(stickyValue) : defaultValue;
|
|
27513
27470
|
const updateValue = useCallback(value => {
|
|
27514
27471
|
try {
|
|
27515
27472
|
window.localStorage.setItem(key, JSON.stringify(value));
|
|
@@ -27520,6 +27477,8 @@ const useFetchState = (defaultValue, key) => {
|
|
|
27520
27477
|
return [parsedValue, updateValue];
|
|
27521
27478
|
};
|
|
27522
27479
|
|
|
27480
|
+
// import useLocalStorage from './useLocalStorage';
|
|
27481
|
+
|
|
27523
27482
|
const useTableStates = (id, version) => {
|
|
27524
27483
|
const [paginationModel, setPaginationModel] = useFetchState('', buildStorageKey({
|
|
27525
27484
|
id,
|
|
@@ -27576,8 +27535,7 @@ const useStatefulTable = props => {
|
|
|
27576
27535
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
27577
27536
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
27578
27537
|
onFilterModelChange: propsOnFilterModelChange,
|
|
27579
|
-
|
|
27580
|
-
onPageSizeChange: propsOnPageSizeChange,
|
|
27538
|
+
onPaginationModelChange: propsOnPaginationModelChange,
|
|
27581
27539
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
27582
27540
|
onSortModelChange: propsOnSortModelChange,
|
|
27583
27541
|
useRouter,
|
|
@@ -27639,7 +27597,6 @@ const useStatefulTable = props => {
|
|
|
27639
27597
|
column.width = dimensionModel[column.field] || column.width || 100;
|
|
27640
27598
|
return column;
|
|
27641
27599
|
}), [propsColumns, dimensionModel]);
|
|
27642
|
-
|
|
27643
27600
|
/** Add resetPage method to apiRef. */
|
|
27644
27601
|
apiRef.current.resetPage = () => {
|
|
27645
27602
|
apiRef.current.setPage(0);
|
|
@@ -27650,7 +27607,7 @@ const useStatefulTable = props => {
|
|
|
27650
27607
|
onFilterModelChange: (model, details) => {
|
|
27651
27608
|
const filterModel = _objectSpread2(_objectSpread2({}, model), {}, {
|
|
27652
27609
|
items: model.items.map(item => {
|
|
27653
|
-
const column = apiRef.current.getColumn(item.
|
|
27610
|
+
const column = apiRef.current.getColumn(item.field);
|
|
27654
27611
|
item.type = column.type || 'string';
|
|
27655
27612
|
return item;
|
|
27656
27613
|
})
|
|
@@ -27687,33 +27644,16 @@ const useStatefulTable = props => {
|
|
|
27687
27644
|
}, search, historyReplace, columns);
|
|
27688
27645
|
},
|
|
27689
27646
|
pinnedColumns: pinnedColumnsModel,
|
|
27690
|
-
|
|
27691
|
-
|
|
27692
|
-
|
|
27693
|
-
|
|
27694
|
-
|
|
27695
|
-
|
|
27696
|
-
filterModel: filterParsed,
|
|
27697
|
-
sortModel: sortModelParsed,
|
|
27698
|
-
paginationModel: {
|
|
27699
|
-
page,
|
|
27700
|
-
pageSize: paginationModelParsed.pageSize,
|
|
27701
|
-
direction
|
|
27702
|
-
},
|
|
27703
|
-
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
27704
|
-
pinnedColumnsModel: pinnedColumnsModel
|
|
27705
|
-
}, search, historyReplace, columns);
|
|
27706
|
-
},
|
|
27707
|
-
onPageSizeChange: (pageSize, details) => {
|
|
27708
|
-
propsOnPageSizeChange === null || propsOnPageSizeChange === void 0 ? void 0 : propsOnPageSizeChange(pageSize, details);
|
|
27647
|
+
paginationModel: paginationModelParsed,
|
|
27648
|
+
onPaginationModelChange: (model, details) => {
|
|
27649
|
+
const paginationModel = _objectSpread2(_objectSpread2({}, model), {}, {
|
|
27650
|
+
direction: paginationModelParsed.page < model.page ? 'next' : 'back'
|
|
27651
|
+
});
|
|
27652
|
+
propsOnPaginationModelChange === null || propsOnPaginationModelChange === void 0 ? void 0 : propsOnPaginationModelChange(paginationModel, details);
|
|
27709
27653
|
updateUrl({
|
|
27710
27654
|
filterModel: filterParsed,
|
|
27711
27655
|
sortModel: sortModelParsed,
|
|
27712
|
-
paginationModel:
|
|
27713
|
-
page: paginationModelParsed.page,
|
|
27714
|
-
pageSize,
|
|
27715
|
-
direction: paginationModelParsed.direction
|
|
27716
|
-
},
|
|
27656
|
+
paginationModel: paginationModel,
|
|
27717
27657
|
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
27718
27658
|
pinnedColumnsModel: pinnedColumnsModel
|
|
27719
27659
|
}, search, historyReplace, columns);
|
|
@@ -27739,7 +27679,7 @@ const useStatefulTable = props => {
|
|
|
27739
27679
|
};
|
|
27740
27680
|
};
|
|
27741
27681
|
|
|
27742
|
-
const _excluded$1 = ["apiRef", "autoHeight", "className", "columns", "
|
|
27682
|
+
const _excluded$1 = ["apiRef", "autoHeight", "className", "columns", "slots", "slotProps", "filterModel", "columnVisibilityModel", "pinnedColumns", "sortModel", "paginationModel", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "localStorageVersion", "onFilterModelChange", "rowSelectionModel", "onColumnWidthChange", "onPaginationModelChange", "onRowSelectionModelChange", "onColumnVisibilityModelChange", "onPinnedColumnsChange", "onSortModelChange", "pagination", "paginationPlacement", "paginationProps", "rows", "pageSizeOptions", "sx", "theme", "useRouter", "paginationMode", "rowCount"];
|
|
27743
27683
|
const COMPONENT_NAME$1 = 'DataGrid';
|
|
27744
27684
|
const CLASSNAME$1 = 'redsift-datagrid';
|
|
27745
27685
|
const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
@@ -27749,15 +27689,13 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27749
27689
|
autoHeight,
|
|
27750
27690
|
className,
|
|
27751
27691
|
columns,
|
|
27752
|
-
|
|
27753
|
-
|
|
27754
|
-
componentsProps,
|
|
27692
|
+
slots,
|
|
27693
|
+
slotProps,
|
|
27755
27694
|
filterModel: propsFilterModel,
|
|
27756
27695
|
columnVisibilityModel: propsColumnVisibilityModel,
|
|
27757
27696
|
pinnedColumns: propsPinnedColumns,
|
|
27758
27697
|
sortModel: propsSortModel,
|
|
27759
|
-
|
|
27760
|
-
pageSize: propsPageSize,
|
|
27698
|
+
paginationModel: propsPaginationModel,
|
|
27761
27699
|
height: propsHeight,
|
|
27762
27700
|
hideToolbar,
|
|
27763
27701
|
initialState,
|
|
@@ -27765,11 +27703,10 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27765
27703
|
license = process.env.MUI_LICENSE_KEY,
|
|
27766
27704
|
localStorageVersion,
|
|
27767
27705
|
onFilterModelChange: propsOnFilterModelChange,
|
|
27768
|
-
|
|
27706
|
+
rowSelectionModel: propsRowSelectionModel,
|
|
27769
27707
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
27770
|
-
|
|
27771
|
-
|
|
27772
|
-
onSelectionModelChange: propsOnSelectionModelChange,
|
|
27708
|
+
onPaginationModelChange: propsOnPaginationModelChange,
|
|
27709
|
+
onRowSelectionModelChange: propsOnRowSelectionModelChange,
|
|
27773
27710
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
27774
27711
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
27775
27712
|
onSortModelChange: propsOnSortModelChange,
|
|
@@ -27777,7 +27714,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27777
27714
|
paginationPlacement = 'both',
|
|
27778
27715
|
paginationProps,
|
|
27779
27716
|
rows,
|
|
27780
|
-
|
|
27717
|
+
pageSizeOptions,
|
|
27781
27718
|
sx,
|
|
27782
27719
|
theme: propsTheme,
|
|
27783
27720
|
useRouter,
|
|
@@ -27788,43 +27725,38 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27788
27725
|
const theme = useTheme$4(propsTheme);
|
|
27789
27726
|
const _apiRef = useGridApiRef();
|
|
27790
27727
|
const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
|
|
27791
|
-
const RenderedToolbar =
|
|
27728
|
+
const RenderedToolbar = slots !== null && slots !== void 0 && slots.toolbar ? slots.toolbar : Toolbar$2;
|
|
27792
27729
|
LicenseInfo.setLicenseKey(license);
|
|
27793
27730
|
const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
|
|
27794
27731
|
const {
|
|
27795
27732
|
onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
|
|
27796
27733
|
onFilterModelChange: controlledOnFilterModelChange,
|
|
27797
|
-
|
|
27798
|
-
onPageSizeChange: controlledOnPageSizeChange,
|
|
27734
|
+
onPaginationModelChange: controlledOnPaginationModelChange,
|
|
27799
27735
|
onPinnedColumnsChange: controlledOnPinnedColumnsChange,
|
|
27800
27736
|
onSortModelChange: controlledOnSortModelChange
|
|
27801
27737
|
} = useControlledDatagridState({
|
|
27802
27738
|
initialState,
|
|
27803
|
-
|
|
27739
|
+
pageSizeOptions,
|
|
27804
27740
|
propsColumnVisibilityModel,
|
|
27805
27741
|
propsFilterModel,
|
|
27806
27742
|
propsOnColumnVisibilityModelChange,
|
|
27807
27743
|
propsOnFilterModelChange,
|
|
27808
27744
|
propsOnPinnedColumnsChange,
|
|
27809
27745
|
propsOnSortModelChange,
|
|
27810
|
-
|
|
27811
|
-
propsPageSize,
|
|
27746
|
+
propsPaginationModel,
|
|
27812
27747
|
propsPinnedColumns,
|
|
27813
27748
|
propsSortModel,
|
|
27814
|
-
|
|
27815
|
-
propsOnPageSizeChange
|
|
27749
|
+
propsOnPaginationModelChange
|
|
27816
27750
|
});
|
|
27817
27751
|
const {
|
|
27818
27752
|
columnVisibilityModel,
|
|
27819
27753
|
filterModel,
|
|
27820
27754
|
onColumnVisibilityModelChange,
|
|
27821
27755
|
onFilterModelChange,
|
|
27822
|
-
|
|
27823
|
-
onPageSizeChange,
|
|
27756
|
+
onPaginationModelChange,
|
|
27824
27757
|
onPinnedColumnsChange,
|
|
27825
27758
|
onSortModelChange,
|
|
27826
|
-
|
|
27827
|
-
pageSize,
|
|
27759
|
+
paginationModel,
|
|
27828
27760
|
pinnedColumns,
|
|
27829
27761
|
sortModel,
|
|
27830
27762
|
onColumnWidthChange
|
|
@@ -27835,39 +27767,38 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27835
27767
|
onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
|
|
27836
27768
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
27837
27769
|
onFilterModelChange: controlledOnFilterModelChange,
|
|
27838
|
-
|
|
27839
|
-
onPageSizeChange: controlledOnPageSizeChange,
|
|
27770
|
+
onPaginationModelChange: controlledOnPaginationModelChange,
|
|
27840
27771
|
onPinnedColumnsChange: controlledOnPinnedColumnsChange,
|
|
27841
27772
|
onSortModelChange: controlledOnSortModelChange,
|
|
27842
27773
|
useRouter: useRouter,
|
|
27843
27774
|
localStorageVersion
|
|
27844
27775
|
});
|
|
27845
|
-
const [
|
|
27776
|
+
const [rowSelectionModel, setRowSelectionModel] = useState(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
27846
27777
|
useEffect(() => {
|
|
27847
|
-
|
|
27848
|
-
}, [
|
|
27849
|
-
const
|
|
27850
|
-
if (
|
|
27851
|
-
|
|
27778
|
+
setRowSelectionModel(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
27779
|
+
}, [propsRowSelectionModel]);
|
|
27780
|
+
const onRowSelectionModelChange = (selectionModel, details) => {
|
|
27781
|
+
if (propsOnRowSelectionModelChange) {
|
|
27782
|
+
propsOnRowSelectionModelChange(selectionModel, details);
|
|
27852
27783
|
} else {
|
|
27853
|
-
|
|
27784
|
+
setRowSelectionModel(selectionModel);
|
|
27854
27785
|
}
|
|
27855
27786
|
};
|
|
27856
27787
|
const selectionStatus = useRef({
|
|
27857
27788
|
type: 'none',
|
|
27858
27789
|
numberOfSelectedRows: 0,
|
|
27859
27790
|
numberOfSelectedRowsInPage: 0,
|
|
27860
|
-
page,
|
|
27861
|
-
pageSize: pageSize
|
|
27791
|
+
page: paginationModel.page,
|
|
27792
|
+
pageSize: paginationModel.pageSize
|
|
27862
27793
|
});
|
|
27863
27794
|
|
|
27864
27795
|
// in server-side pagination we want to update the selection status
|
|
27865
27796
|
// every time we navigate between pages, resize our page or select something
|
|
27866
27797
|
useEffect(() => {
|
|
27867
27798
|
if (paginationMode == 'server') {
|
|
27868
|
-
onServerSideSelectionStatusChange(Array.isArray(
|
|
27799
|
+
onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatus, isRowSelectable, paginationModel.page, paginationModel.pageSize);
|
|
27869
27800
|
}
|
|
27870
|
-
}, [
|
|
27801
|
+
}, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
|
|
27871
27802
|
if (!Array.isArray(rows)) {
|
|
27872
27803
|
return null;
|
|
27873
27804
|
}
|
|
@@ -27900,15 +27831,13 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27900
27831
|
filterModel: filterModel,
|
|
27901
27832
|
onColumnVisibilityModelChange: onColumnVisibilityModelChange,
|
|
27902
27833
|
onFilterModelChange: onFilterModelChange,
|
|
27903
|
-
|
|
27904
|
-
onPageSizeChange: onPageSizeChange,
|
|
27834
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
27905
27835
|
onPinnedColumnsChange: onPinnedColumnsChange,
|
|
27906
27836
|
onSortModelChange: onSortModelChange,
|
|
27907
|
-
|
|
27908
|
-
pageSize: pageSize,
|
|
27837
|
+
paginationModel: paginationModel,
|
|
27909
27838
|
pinnedColumns: pinnedColumns,
|
|
27910
27839
|
sortModel: sortModel,
|
|
27911
|
-
|
|
27840
|
+
pageSizeOptions: pageSizeOptions,
|
|
27912
27841
|
onColumnWidthChange: onColumnWidthChange,
|
|
27913
27842
|
initialState: initialState,
|
|
27914
27843
|
isRowSelectable: isRowSelectable,
|
|
@@ -27919,58 +27848,55 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27919
27848
|
rowCount: rowCount,
|
|
27920
27849
|
autoHeight: autoHeight,
|
|
27921
27850
|
checkboxSelectionVisibleOnly: Boolean(pagination),
|
|
27922
|
-
|
|
27923
|
-
|
|
27924
|
-
|
|
27925
|
-
|
|
27926
|
-
|
|
27927
|
-
|
|
27928
|
-
ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27851
|
+
slots: _objectSpread2(_objectSpread2({
|
|
27852
|
+
baseButton: BaseButton,
|
|
27853
|
+
baseCheckbox: BaseCheckbox,
|
|
27854
|
+
// baseTextField,
|
|
27855
|
+
basePopper: BasePopper,
|
|
27856
|
+
columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27929
27857
|
displayName: "ColumnFilteredIcon"
|
|
27930
27858
|
})),
|
|
27931
|
-
|
|
27859
|
+
columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27932
27860
|
displayName: "ColumnSelectorIcon"
|
|
27933
27861
|
})),
|
|
27934
|
-
|
|
27862
|
+
columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27935
27863
|
displayName: "ColumnSortedAscendingIcon"
|
|
27936
27864
|
})),
|
|
27937
|
-
|
|
27865
|
+
columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27938
27866
|
displayName: "ColumnSortedDescendingIcon"
|
|
27939
27867
|
})),
|
|
27940
|
-
|
|
27868
|
+
densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27941
27869
|
displayName: "DensityCompactIcon"
|
|
27942
27870
|
})),
|
|
27943
|
-
|
|
27871
|
+
densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27944
27872
|
displayName: "DensityStandardIcon"
|
|
27945
27873
|
})),
|
|
27946
|
-
|
|
27874
|
+
densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27947
27875
|
displayName: "DensityComfortableIcon"
|
|
27948
27876
|
})),
|
|
27949
|
-
|
|
27877
|
+
detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27950
27878
|
displayName: "DetailPanelCollapseIcon"
|
|
27951
27879
|
})),
|
|
27952
|
-
|
|
27880
|
+
detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27953
27881
|
displayName: "DetailPanelExpandIcon"
|
|
27954
27882
|
})),
|
|
27955
|
-
|
|
27883
|
+
exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27956
27884
|
displayName: "ExportIcon"
|
|
27957
27885
|
})),
|
|
27958
|
-
|
|
27886
|
+
openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
|
|
27959
27887
|
displayName: "OpenFilterButtonIcon"
|
|
27960
27888
|
}, props))
|
|
27961
|
-
},
|
|
27962
|
-
|
|
27963
|
-
|
|
27889
|
+
}, slots), {}, {
|
|
27890
|
+
toolbar: ToolbarWrapper,
|
|
27891
|
+
pagination: props => {
|
|
27964
27892
|
return pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$1({}, props, {
|
|
27965
27893
|
displaySelection: false,
|
|
27966
27894
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
27967
27895
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
27968
27896
|
selectionStatus: selectionStatus.current,
|
|
27969
|
-
|
|
27970
|
-
|
|
27971
|
-
|
|
27972
|
-
onPageSizeChange: onPageSizeChange,
|
|
27973
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
27897
|
+
paginationModel: paginationModel,
|
|
27898
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
27899
|
+
pageSizeOptions: pageSizeOptions,
|
|
27974
27900
|
paginationProps: paginationProps,
|
|
27975
27901
|
paginationMode: paginationMode,
|
|
27976
27902
|
rowCount: rowCount
|
|
@@ -27981,17 +27907,15 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27981
27907
|
selectionStatus: selectionStatus.current,
|
|
27982
27908
|
apiRef: apiRef,
|
|
27983
27909
|
isRowSelectable: isRowSelectable,
|
|
27984
|
-
|
|
27985
|
-
|
|
27986
|
-
|
|
27987
|
-
onPageSizeChange: onPageSizeChange,
|
|
27988
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
27910
|
+
paginationModel: paginationModel,
|
|
27911
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
27912
|
+
pageSizeOptions: pageSizeOptions,
|
|
27989
27913
|
paginationProps: paginationProps,
|
|
27990
27914
|
paginationMode: paginationMode
|
|
27991
27915
|
})) : null;
|
|
27992
27916
|
}
|
|
27993
27917
|
}),
|
|
27994
|
-
|
|
27918
|
+
slotProps: _objectSpread2(_objectSpread2({}, slotProps), {}, {
|
|
27995
27919
|
toolbar: _objectSpread2({
|
|
27996
27920
|
hideToolbar,
|
|
27997
27921
|
RenderedToolbar,
|
|
@@ -28002,18 +27926,16 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
28002
27926
|
selectionStatus,
|
|
28003
27927
|
apiRef,
|
|
28004
27928
|
isRowSelectable,
|
|
28005
|
-
|
|
28006
|
-
|
|
28007
|
-
|
|
28008
|
-
onPageSizeChange,
|
|
28009
|
-
rowsPerPageOptions,
|
|
27929
|
+
paginationModel,
|
|
27930
|
+
onPaginationModelChange,
|
|
27931
|
+
pageSizeOptions,
|
|
28010
27932
|
paginationProps,
|
|
28011
27933
|
paginationMode,
|
|
28012
27934
|
rowCount
|
|
28013
|
-
},
|
|
27935
|
+
}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar)
|
|
28014
27936
|
}),
|
|
28015
|
-
|
|
28016
|
-
|
|
27937
|
+
rowSelectionModel: rowSelectionModel,
|
|
27938
|
+
onRowSelectionModelChange: (newSelectionModel, details) => {
|
|
28017
27939
|
if (pagination && paginationMode != 'server') {
|
|
28018
27940
|
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
|
|
28019
27941
|
let {
|
|
@@ -28071,7 +27993,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
28071
27993
|
};
|
|
28072
27994
|
}
|
|
28073
27995
|
}
|
|
28074
|
-
|
|
27996
|
+
onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
|
|
28075
27997
|
},
|
|
28076
27998
|
sx: _objectSpread2(_objectSpread2({}, sx), {}, {
|
|
28077
27999
|
'.MuiDataGrid-columnHeaders': {
|
|
@@ -28145,5 +28067,5 @@ const TextCell = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
28145
28067
|
TextCell.className = CLASSNAME;
|
|
28146
28068
|
TextCell.displayName = COMPONENT_NAME;
|
|
28147
28069
|
|
|
28148
|
-
export { BaseButton, BaseCheckbox, BaseIcon, BasePopper, BaseTextField, CATEGORIES, CONTAINS_ANY_OF, CONTAINS_ANY_OF_I, ControlledPagination, DEFAULT_OPERATORS, DETAIL_PANEL_TOGGLE_COL_DEF, DIMENSION_MODEL_KEY, DOES_NOT_CONTAIN, DOES_NOT_EQUAL, DataGrid, ENDS_WITH_ANY_OF, FILTER_MODEL_KEY, FILTER_SEARCH_KEY, GridToolbarFilterSemanticField, IS_ANY_OF, IS_BETWEEN, IS_NOT_ANY_OF, PAGINATION_MODEL_KEY, PINNED_COLUMNS, SORT_MODEL_KEY, STARTS_WITH_ANY_OF, ServerSideControlledPagination, StatefulDataGrid, TextCell, Toolbar$2 as Toolbar, ToolbarWrapper, VISIBILITY_MODEL_KEY, areFilterModelsEquivalent, buildStorageKey, clearPreviousVersionStorage, customColumnTypes, decodeValue, encodeValue, getColumnVisibilityFromString, getCompletion, getFilterModelFromString, getFinalSearch, getGridNumericOperators, getGridStringArrayOperators, getGridStringOperators, getModelsParsedOrUpdateLocalStorage, getPaginationFromString, getPinnedColumnsFromString, getRsNumberColumnType, getRsStringColumnType, getSearchParamsFromColumnVisibility, getSearchParamsFromFilterModel, getSearchParamsFromPagination, getSearchParamsFromPinnedColumns, getSearchParamsFromSorting, getSearchParamsFromTab, getSortingFromString, muiIconToDSIcon, numberOperatorDecoder, numberOperatorEncoder, onServerSideSelectionStatusChange, operatorList, updateUrl, urlSearchParamsToString };
|
|
28070
|
+
export { BaseButton, BaseCheckbox, BaseIcon, BasePopper, BaseTextField, CATEGORIES, CONTAINS_ANY_OF, CONTAINS_ANY_OF_I, ControlledPagination, DEFAULT_OPERATORS, DETAIL_PANEL_TOGGLE_COL_DEF, DIMENSION_MODEL_KEY, DOES_NOT_CONTAIN, DOES_NOT_EQUAL, DataGrid, ENDS_WITH_ANY_OF, FILTER_MODEL_KEY, FILTER_SEARCH_KEY, GridToolbarFilterSemanticField, IS_ANY_OF, IS_BETWEEN, IS_NOT_ANY_OF, PAGINATION_MODEL_KEY, PINNED_COLUMNS, SORT_MODEL_KEY, STARTS_WITH_ANY_OF, ServerSideControlledPagination, StatefulDataGrid, TextCell, Toolbar$2 as Toolbar, ToolbarWrapper, VISIBILITY_MODEL_KEY, areFilterModelsEquivalent, buildStorageKey, clearPreviousVersionStorage, customColumnTypes, decodeValue, encodeValue, getColumnVisibilityFromString, getCompletion, getFilterModelFromString, getFinalSearch, getGridNumericOperators, getGridStringArrayOperators, getGridStringOperators, getModelsParsedOrUpdateLocalStorage, getPaginationFromString, getPinnedColumnsFromString, getRsNumberColumnType, getRsStringColumnType, getSearchParamsFromColumnVisibility, getSearchParamsFromFilterModel, getSearchParamsFromPagination, getSearchParamsFromPinnedColumns, getSearchParamsFromSorting, getSearchParamsFromTab, getSortingFromString, isOperatorValueValid, isValueValid, muiIconToDSIcon, numberOperatorDecoder, numberOperatorEncoder, onServerSideSelectionStatusChange, operatorList, updateUrl, urlSearchParamsToString };
|
|
28149
28071
|
//# sourceMappingURL=index.js.map
|