@redsift/table 11.2.0-muiv5 → 11.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +25 -41
- 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, 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,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
|
|
|
@@ -18365,11 +18362,11 @@ const getPaginationModel = (search, localStoragePagination, setLocalStoragePagin
|
|
|
18365
18362
|
|
|
18366
18363
|
const getSearchParamsFromColumnVisibility = (columnVisibility, columns) => {
|
|
18367
18364
|
const searchParams = new URLSearchParams();
|
|
18368
|
-
const
|
|
18365
|
+
const fields = columns.map(column => column.field);
|
|
18369
18366
|
|
|
18370
18367
|
// if column visibility model is empty, show all columns
|
|
18371
18368
|
if (Object.keys(columnVisibility).length == 0) {
|
|
18372
|
-
searchParams.set('_columnVisibility', `[${
|
|
18369
|
+
searchParams.set('_columnVisibility', `[${fields.join(',')}]`);
|
|
18373
18370
|
return searchParams;
|
|
18374
18371
|
}
|
|
18375
18372
|
const finalColumnVisibility = columns.filter(c => {
|
|
@@ -18419,12 +18416,12 @@ const getColumnVisibilityFromString = (notParsed, tableColumns) => {
|
|
|
18419
18416
|
continue;
|
|
18420
18417
|
}
|
|
18421
18418
|
exist = true;
|
|
18422
|
-
const
|
|
18419
|
+
const fields = tableColumns.map(column => column.field);
|
|
18423
18420
|
// TODO: Add validation that , is present
|
|
18424
18421
|
const columns = encodedValues.split(',').map(value => decodeValue(value));
|
|
18425
18422
|
|
|
18426
18423
|
// for each column, check if it's visible and add it to visibility model
|
|
18427
|
-
for (const column of
|
|
18424
|
+
for (const column of fields) {
|
|
18428
18425
|
const isColumnVisible = columns.includes(column);
|
|
18429
18426
|
visibility[column] = isColumnVisible;
|
|
18430
18427
|
if (isColumnVisible) {
|
|
@@ -18487,8 +18484,8 @@ const getPinnedColumnsFromString = (notParsed, tableColumns) => {
|
|
|
18487
18484
|
if (typeof encodedValues !== 'string') {
|
|
18488
18485
|
continue;
|
|
18489
18486
|
}
|
|
18490
|
-
const
|
|
18491
|
-
const columns = encodedValues.split(',').map(value => decodeValue(value)).filter(val => typeof val === 'string' &&
|
|
18487
|
+
const fields = [...tableColumns.map(column => column.field), '__check__'];
|
|
18488
|
+
const columns = encodedValues.split(',').map(value => decodeValue(value)).filter(val => typeof val === 'string' && fields.includes(val));
|
|
18492
18489
|
if (fieldURL === '_pinnedColumnsLeft') {
|
|
18493
18490
|
pinnedColumns['left'] = columns;
|
|
18494
18491
|
}
|
|
@@ -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, customDefaults) => {
|
|
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
|
pinnedCustomColumns = {
|
|
@@ -27648,7 +27606,6 @@ const useStatefulTable = props => {
|
|
|
27648
27606
|
column.width = dimensionModel[column.field] || column.width || 100;
|
|
27649
27607
|
return column;
|
|
27650
27608
|
}), [propsColumns, dimensionModel]);
|
|
27651
|
-
|
|
27652
27609
|
/** Add resetPage method to apiRef. */
|
|
27653
27610
|
apiRef.current.resetPage = () => {
|
|
27654
27611
|
apiRef.current.setPage(0);
|
|
@@ -27659,7 +27616,7 @@ const useStatefulTable = props => {
|
|
|
27659
27616
|
onFilterModelChange: (model, details) => {
|
|
27660
27617
|
const filterModel = _objectSpread2(_objectSpread2({}, model), {}, {
|
|
27661
27618
|
items: model.items.map(item => {
|
|
27662
|
-
const column = apiRef.current.getColumn(item.
|
|
27619
|
+
const column = apiRef.current.getColumn(item.field);
|
|
27663
27620
|
item.type = column.type || 'string';
|
|
27664
27621
|
return item;
|
|
27665
27622
|
})
|
|
@@ -27696,33 +27653,16 @@ const useStatefulTable = props => {
|
|
|
27696
27653
|
}, search, historyReplace, columns);
|
|
27697
27654
|
},
|
|
27698
27655
|
pinnedColumns: pinnedColumnsModel,
|
|
27699
|
-
|
|
27700
|
-
|
|
27701
|
-
|
|
27702
|
-
|
|
27703
|
-
|
|
27704
|
-
|
|
27705
|
-
filterModel: filterParsed,
|
|
27706
|
-
sortModel: sortModelParsed,
|
|
27707
|
-
paginationModel: {
|
|
27708
|
-
page,
|
|
27709
|
-
pageSize: paginationModelParsed.pageSize,
|
|
27710
|
-
direction
|
|
27711
|
-
},
|
|
27712
|
-
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
27713
|
-
pinnedColumnsModel: pinnedColumnsModel
|
|
27714
|
-
}, search, historyReplace, columns);
|
|
27715
|
-
},
|
|
27716
|
-
onPageSizeChange: (pageSize, details) => {
|
|
27717
|
-
propsOnPageSizeChange === null || propsOnPageSizeChange === void 0 ? void 0 : propsOnPageSizeChange(pageSize, details);
|
|
27656
|
+
paginationModel: paginationModelParsed,
|
|
27657
|
+
onPaginationModelChange: (model, details) => {
|
|
27658
|
+
const paginationModel = _objectSpread2(_objectSpread2({}, model), {}, {
|
|
27659
|
+
direction: paginationModelParsed.page < model.page ? 'next' : 'back'
|
|
27660
|
+
});
|
|
27661
|
+
propsOnPaginationModelChange === null || propsOnPaginationModelChange === void 0 ? void 0 : propsOnPaginationModelChange(paginationModel, details);
|
|
27718
27662
|
updateUrl({
|
|
27719
27663
|
filterModel: filterParsed,
|
|
27720
27664
|
sortModel: sortModelParsed,
|
|
27721
|
-
paginationModel:
|
|
27722
|
-
page: paginationModelParsed.page,
|
|
27723
|
-
pageSize,
|
|
27724
|
-
direction: paginationModelParsed.direction
|
|
27725
|
-
},
|
|
27665
|
+
paginationModel: paginationModel,
|
|
27726
27666
|
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
27727
27667
|
pinnedColumnsModel: pinnedColumnsModel
|
|
27728
27668
|
}, search, historyReplace, columns);
|
|
@@ -27748,7 +27688,7 @@ const useStatefulTable = props => {
|
|
|
27748
27688
|
};
|
|
27749
27689
|
};
|
|
27750
27690
|
|
|
27751
|
-
const _excluded$1 = ["apiRef", "autoHeight", "className", "columns", "
|
|
27691
|
+
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"];
|
|
27752
27692
|
const COMPONENT_NAME$1 = 'DataGrid';
|
|
27753
27693
|
const CLASSNAME$1 = 'redsift-datagrid';
|
|
27754
27694
|
const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
@@ -27758,15 +27698,13 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27758
27698
|
autoHeight,
|
|
27759
27699
|
className,
|
|
27760
27700
|
columns,
|
|
27761
|
-
|
|
27762
|
-
|
|
27763
|
-
componentsProps,
|
|
27701
|
+
slots,
|
|
27702
|
+
slotProps,
|
|
27764
27703
|
filterModel: propsFilterModel,
|
|
27765
27704
|
columnVisibilityModel: propsColumnVisibilityModel,
|
|
27766
27705
|
pinnedColumns: propsPinnedColumns,
|
|
27767
27706
|
sortModel: propsSortModel,
|
|
27768
|
-
|
|
27769
|
-
pageSize: propsPageSize,
|
|
27707
|
+
paginationModel: propsPaginationModel,
|
|
27770
27708
|
height: propsHeight,
|
|
27771
27709
|
hideToolbar,
|
|
27772
27710
|
initialState,
|
|
@@ -27774,11 +27712,10 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27774
27712
|
license = process.env.MUI_LICENSE_KEY,
|
|
27775
27713
|
localStorageVersion,
|
|
27776
27714
|
onFilterModelChange: propsOnFilterModelChange,
|
|
27777
|
-
|
|
27715
|
+
rowSelectionModel: propsRowSelectionModel,
|
|
27778
27716
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
27779
|
-
|
|
27780
|
-
|
|
27781
|
-
onSelectionModelChange: propsOnSelectionModelChange,
|
|
27717
|
+
onPaginationModelChange: propsOnPaginationModelChange,
|
|
27718
|
+
onRowSelectionModelChange: propsOnRowSelectionModelChange,
|
|
27782
27719
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
27783
27720
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
27784
27721
|
onSortModelChange: propsOnSortModelChange,
|
|
@@ -27787,7 +27724,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27787
27724
|
paginationProps,
|
|
27788
27725
|
pinnedCustomColumns,
|
|
27789
27726
|
rows,
|
|
27790
|
-
|
|
27727
|
+
pageSizeOptions,
|
|
27791
27728
|
sx,
|
|
27792
27729
|
theme: propsTheme,
|
|
27793
27730
|
useRouter,
|
|
@@ -27798,43 +27735,38 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27798
27735
|
const theme = useTheme$4(propsTheme);
|
|
27799
27736
|
const _apiRef = useGridApiRef();
|
|
27800
27737
|
const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
|
|
27801
|
-
const RenderedToolbar =
|
|
27738
|
+
const RenderedToolbar = slots !== null && slots !== void 0 && slots.toolbar ? slots.toolbar : Toolbar$2;
|
|
27802
27739
|
LicenseInfo.setLicenseKey(license);
|
|
27803
27740
|
const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
|
|
27804
27741
|
const {
|
|
27805
27742
|
onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
|
|
27806
27743
|
onFilterModelChange: controlledOnFilterModelChange,
|
|
27807
|
-
|
|
27808
|
-
onPageSizeChange: controlledOnPageSizeChange,
|
|
27744
|
+
onPaginationModelChange: controlledOnPaginationModelChange,
|
|
27809
27745
|
onPinnedColumnsChange: controlledOnPinnedColumnsChange,
|
|
27810
27746
|
onSortModelChange: controlledOnSortModelChange
|
|
27811
27747
|
} = useControlledDatagridState({
|
|
27812
27748
|
initialState,
|
|
27813
|
-
|
|
27749
|
+
pageSizeOptions,
|
|
27814
27750
|
propsColumnVisibilityModel,
|
|
27815
27751
|
propsFilterModel,
|
|
27816
27752
|
propsOnColumnVisibilityModelChange,
|
|
27817
27753
|
propsOnFilterModelChange,
|
|
27818
27754
|
propsOnPinnedColumnsChange,
|
|
27819
27755
|
propsOnSortModelChange,
|
|
27820
|
-
|
|
27821
|
-
propsPageSize,
|
|
27756
|
+
propsPaginationModel,
|
|
27822
27757
|
propsPinnedColumns,
|
|
27823
27758
|
propsSortModel,
|
|
27824
|
-
|
|
27825
|
-
propsOnPageSizeChange
|
|
27759
|
+
propsOnPaginationModelChange
|
|
27826
27760
|
});
|
|
27827
27761
|
const {
|
|
27828
27762
|
columnVisibilityModel,
|
|
27829
27763
|
filterModel,
|
|
27830
27764
|
onColumnVisibilityModelChange,
|
|
27831
27765
|
onFilterModelChange,
|
|
27832
|
-
|
|
27833
|
-
onPageSizeChange,
|
|
27766
|
+
onPaginationModelChange,
|
|
27834
27767
|
onPinnedColumnsChange,
|
|
27835
27768
|
onSortModelChange,
|
|
27836
|
-
|
|
27837
|
-
pageSize,
|
|
27769
|
+
paginationModel,
|
|
27838
27770
|
pinnedColumns,
|
|
27839
27771
|
sortModel,
|
|
27840
27772
|
onColumnWidthChange
|
|
@@ -27845,40 +27777,39 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27845
27777
|
onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
|
|
27846
27778
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
27847
27779
|
onFilterModelChange: controlledOnFilterModelChange,
|
|
27848
|
-
|
|
27849
|
-
onPageSizeChange: controlledOnPageSizeChange,
|
|
27780
|
+
onPaginationModelChange: controlledOnPaginationModelChange,
|
|
27850
27781
|
onPinnedColumnsChange: controlledOnPinnedColumnsChange,
|
|
27851
27782
|
onSortModelChange: controlledOnSortModelChange,
|
|
27852
27783
|
pinnedCustomColumns,
|
|
27853
27784
|
useRouter: useRouter,
|
|
27854
27785
|
localStorageVersion
|
|
27855
27786
|
});
|
|
27856
|
-
const [
|
|
27787
|
+
const [rowSelectionModel, setRowSelectionModel] = useState(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
27857
27788
|
useEffect(() => {
|
|
27858
|
-
|
|
27859
|
-
}, [
|
|
27860
|
-
const
|
|
27861
|
-
if (
|
|
27862
|
-
|
|
27789
|
+
setRowSelectionModel(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
27790
|
+
}, [propsRowSelectionModel]);
|
|
27791
|
+
const onRowSelectionModelChange = (selectionModel, details) => {
|
|
27792
|
+
if (propsOnRowSelectionModelChange) {
|
|
27793
|
+
propsOnRowSelectionModelChange(selectionModel, details);
|
|
27863
27794
|
} else {
|
|
27864
|
-
|
|
27795
|
+
setRowSelectionModel(selectionModel);
|
|
27865
27796
|
}
|
|
27866
27797
|
};
|
|
27867
27798
|
const selectionStatus = useRef({
|
|
27868
27799
|
type: 'none',
|
|
27869
27800
|
numberOfSelectedRows: 0,
|
|
27870
27801
|
numberOfSelectedRowsInPage: 0,
|
|
27871
|
-
page,
|
|
27872
|
-
pageSize: pageSize
|
|
27802
|
+
page: paginationModel.page,
|
|
27803
|
+
pageSize: paginationModel.pageSize
|
|
27873
27804
|
});
|
|
27874
27805
|
|
|
27875
27806
|
// in server-side pagination we want to update the selection status
|
|
27876
27807
|
// every time we navigate between pages, resize our page or select something
|
|
27877
27808
|
useEffect(() => {
|
|
27878
27809
|
if (paginationMode == 'server') {
|
|
27879
|
-
onServerSideSelectionStatusChange(Array.isArray(
|
|
27810
|
+
onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatus, isRowSelectable, paginationModel.page, paginationModel.pageSize);
|
|
27880
27811
|
}
|
|
27881
|
-
}, [
|
|
27812
|
+
}, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
|
|
27882
27813
|
if (!Array.isArray(rows)) {
|
|
27883
27814
|
return null;
|
|
27884
27815
|
}
|
|
@@ -27911,15 +27842,13 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27911
27842
|
filterModel: filterModel,
|
|
27912
27843
|
onColumnVisibilityModelChange: onColumnVisibilityModelChange,
|
|
27913
27844
|
onFilterModelChange: onFilterModelChange,
|
|
27914
|
-
|
|
27915
|
-
onPageSizeChange: onPageSizeChange,
|
|
27845
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
27916
27846
|
onPinnedColumnsChange: onPinnedColumnsChange,
|
|
27917
27847
|
onSortModelChange: onSortModelChange,
|
|
27918
|
-
|
|
27919
|
-
pageSize: pageSize,
|
|
27848
|
+
paginationModel: paginationModel,
|
|
27920
27849
|
pinnedColumns: pinnedColumns,
|
|
27921
27850
|
sortModel: sortModel,
|
|
27922
|
-
|
|
27851
|
+
pageSizeOptions: pageSizeOptions,
|
|
27923
27852
|
onColumnWidthChange: onColumnWidthChange,
|
|
27924
27853
|
initialState: initialState,
|
|
27925
27854
|
isRowSelectable: isRowSelectable,
|
|
@@ -27930,58 +27859,55 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27930
27859
|
rowCount: rowCount,
|
|
27931
27860
|
autoHeight: autoHeight,
|
|
27932
27861
|
checkboxSelectionVisibleOnly: Boolean(pagination),
|
|
27933
|
-
|
|
27934
|
-
|
|
27935
|
-
|
|
27936
|
-
|
|
27937
|
-
|
|
27938
|
-
|
|
27939
|
-
ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27862
|
+
slots: _objectSpread2(_objectSpread2({
|
|
27863
|
+
baseButton: BaseButton,
|
|
27864
|
+
baseCheckbox: BaseCheckbox,
|
|
27865
|
+
// baseTextField,
|
|
27866
|
+
basePopper: BasePopper,
|
|
27867
|
+
columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27940
27868
|
displayName: "ColumnFilteredIcon"
|
|
27941
27869
|
})),
|
|
27942
|
-
|
|
27870
|
+
columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27943
27871
|
displayName: "ColumnSelectorIcon"
|
|
27944
27872
|
})),
|
|
27945
|
-
|
|
27873
|
+
columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27946
27874
|
displayName: "ColumnSortedAscendingIcon"
|
|
27947
27875
|
})),
|
|
27948
|
-
|
|
27876
|
+
columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27949
27877
|
displayName: "ColumnSortedDescendingIcon"
|
|
27950
27878
|
})),
|
|
27951
|
-
|
|
27879
|
+
densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27952
27880
|
displayName: "DensityCompactIcon"
|
|
27953
27881
|
})),
|
|
27954
|
-
|
|
27882
|
+
densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27955
27883
|
displayName: "DensityStandardIcon"
|
|
27956
27884
|
})),
|
|
27957
|
-
|
|
27885
|
+
densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27958
27886
|
displayName: "DensityComfortableIcon"
|
|
27959
27887
|
})),
|
|
27960
|
-
|
|
27888
|
+
detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27961
27889
|
displayName: "DetailPanelCollapseIcon"
|
|
27962
27890
|
})),
|
|
27963
|
-
|
|
27891
|
+
detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27964
27892
|
displayName: "DetailPanelExpandIcon"
|
|
27965
27893
|
})),
|
|
27966
|
-
|
|
27894
|
+
exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27967
27895
|
displayName: "ExportIcon"
|
|
27968
27896
|
})),
|
|
27969
|
-
|
|
27897
|
+
openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
|
|
27970
27898
|
displayName: "OpenFilterButtonIcon"
|
|
27971
27899
|
}, props))
|
|
27972
|
-
},
|
|
27973
|
-
|
|
27974
|
-
|
|
27900
|
+
}, slots), {}, {
|
|
27901
|
+
toolbar: ToolbarWrapper,
|
|
27902
|
+
pagination: props => {
|
|
27975
27903
|
return pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$1({}, props, {
|
|
27976
27904
|
displaySelection: false,
|
|
27977
27905
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
27978
27906
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
27979
27907
|
selectionStatus: selectionStatus.current,
|
|
27980
|
-
|
|
27981
|
-
|
|
27982
|
-
|
|
27983
|
-
onPageSizeChange: onPageSizeChange,
|
|
27984
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
27908
|
+
paginationModel: paginationModel,
|
|
27909
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
27910
|
+
pageSizeOptions: pageSizeOptions,
|
|
27985
27911
|
paginationProps: paginationProps,
|
|
27986
27912
|
paginationMode: paginationMode,
|
|
27987
27913
|
rowCount: rowCount
|
|
@@ -27992,17 +27918,15 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27992
27918
|
selectionStatus: selectionStatus.current,
|
|
27993
27919
|
apiRef: apiRef,
|
|
27994
27920
|
isRowSelectable: isRowSelectable,
|
|
27995
|
-
|
|
27996
|
-
|
|
27997
|
-
|
|
27998
|
-
onPageSizeChange: onPageSizeChange,
|
|
27999
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
27921
|
+
paginationModel: paginationModel,
|
|
27922
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
27923
|
+
pageSizeOptions: pageSizeOptions,
|
|
28000
27924
|
paginationProps: paginationProps,
|
|
28001
27925
|
paginationMode: paginationMode
|
|
28002
27926
|
})) : null;
|
|
28003
27927
|
}
|
|
28004
27928
|
}),
|
|
28005
|
-
|
|
27929
|
+
slotProps: _objectSpread2(_objectSpread2({}, slotProps), {}, {
|
|
28006
27930
|
toolbar: _objectSpread2({
|
|
28007
27931
|
hideToolbar,
|
|
28008
27932
|
RenderedToolbar,
|
|
@@ -28013,18 +27937,16 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
28013
27937
|
selectionStatus,
|
|
28014
27938
|
apiRef,
|
|
28015
27939
|
isRowSelectable,
|
|
28016
|
-
|
|
28017
|
-
|
|
28018
|
-
|
|
28019
|
-
onPageSizeChange,
|
|
28020
|
-
rowsPerPageOptions,
|
|
27940
|
+
paginationModel,
|
|
27941
|
+
onPaginationModelChange,
|
|
27942
|
+
pageSizeOptions,
|
|
28021
27943
|
paginationProps,
|
|
28022
27944
|
paginationMode,
|
|
28023
27945
|
rowCount
|
|
28024
|
-
},
|
|
27946
|
+
}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar)
|
|
28025
27947
|
}),
|
|
28026
|
-
|
|
28027
|
-
|
|
27948
|
+
rowSelectionModel: rowSelectionModel,
|
|
27949
|
+
onRowSelectionModelChange: (newSelectionModel, details) => {
|
|
28028
27950
|
if (pagination && paginationMode != 'server') {
|
|
28029
27951
|
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
|
|
28030
27952
|
let {
|
|
@@ -28082,7 +28004,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
28082
28004
|
};
|
|
28083
28005
|
}
|
|
28084
28006
|
}
|
|
28085
|
-
|
|
28007
|
+
onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
|
|
28086
28008
|
},
|
|
28087
28009
|
sx: _objectSpread2(_objectSpread2({}, sx), {}, {
|
|
28088
28010
|
'.MuiDataGrid-columnHeaders': {
|
|
@@ -28156,5 +28078,5 @@ const TextCell = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
28156
28078
|
TextCell.className = CLASSNAME;
|
|
28157
28079
|
TextCell.displayName = COMPONENT_NAME;
|
|
28158
28080
|
|
|
28159
|
-
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 };
|
|
28081
|
+
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 };
|
|
28160
28082
|
//# sourceMappingURL=index.js.map
|