@redsift/table 11.1.3-muiv5 → 11.1.3
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 {
|
|
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
|
}
|
|
@@ -23095,16 +23092,16 @@ const getRole = (config, dateFormat) => {
|
|
|
23095
23092
|
}).join('\n');
|
|
23096
23093
|
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.
|
|
23097
23094
|
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.
|
|
23098
|
-
The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "
|
|
23099
|
-
- "
|
|
23100
|
-
- "items": a list of conditions, each is an object with exactly the three keys "
|
|
23101
|
-
- "
|
|
23095
|
+
The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "logicOperator" and "items":
|
|
23096
|
+
- "logicOperator": the logical operator, only "and" or "or" are allowed. If there is only one condition in the "items", use "and".
|
|
23097
|
+
- "items": a list of conditions, each is an object with exactly the three keys "field", "operator" and "value":
|
|
23098
|
+
- "field": the column name, must be one of ${columns}
|
|
23102
23099
|
- "value":
|
|
23103
|
-
- this can be skipped if the "
|
|
23104
|
-
- a list of multiple values if the "
|
|
23100
|
+
- this can be skipped if the "operator" is either "isEmpty" or "isNotEmpty"
|
|
23101
|
+
- a list of multiple values if the "operator" ends with "AnyOf"
|
|
23105
23102
|
- otherwise, it's a single value represented as a string: "true" instead of true, "false" instead of false, "0.6" instead of 0.6.
|
|
23106
23103
|
For "date" data type, use ${dateFormat}. If relative date is input, convert to the actual date given today is ${today}.
|
|
23107
|
-
- "
|
|
23104
|
+
- "operator": the comparison operator, accepted values depend on the data type of the column
|
|
23108
23105
|
${operators}
|
|
23109
23106
|
|
|
23110
23107
|
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:
|
|
@@ -23141,10 +23138,10 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
23141
23138
|
nlpFilterConfig,
|
|
23142
23139
|
onFilterModelChange,
|
|
23143
23140
|
dateFormat = 'yyyy-mm-dd',
|
|
23144
|
-
defaultModel = 'gpt-4-
|
|
23141
|
+
defaultModel = 'gpt-4-1106-preview',
|
|
23145
23142
|
defaultFilter = {
|
|
23146
23143
|
items: [],
|
|
23147
|
-
|
|
23144
|
+
logicOperator: 'and'
|
|
23148
23145
|
},
|
|
23149
23146
|
disablePower = false,
|
|
23150
23147
|
localeText
|
|
@@ -23222,7 +23219,7 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
23222
23219
|
value: prompt
|
|
23223
23220
|
}), /*#__PURE__*/React__default.createElement(Button, {
|
|
23224
23221
|
variant: "primary",
|
|
23225
|
-
"
|
|
23222
|
+
"aria-label": buttonAriaLabel,
|
|
23226
23223
|
type: "submit",
|
|
23227
23224
|
isLoading: isLoading
|
|
23228
23225
|
}, buttonText)), !disablePower && /*#__PURE__*/React__default.createElement(Tooltip, null, /*#__PURE__*/React__default.createElement(Tooltip.Trigger, null, /*#__PURE__*/React__default.createElement(Switch, {
|
|
@@ -23283,7 +23280,7 @@ const Toolbar$2 = props => {
|
|
|
23283
23280
|
let {
|
|
23284
23281
|
apiRef
|
|
23285
23282
|
} = _ref;
|
|
23286
|
-
return
|
|
23283
|
+
return gridExpandedSortedRowIdsSelector(apiRef);
|
|
23287
23284
|
}
|
|
23288
23285
|
},
|
|
23289
23286
|
printOptions: {
|
|
@@ -25515,12 +25512,10 @@ const ServerSideControlledPagination = _ref3 => {
|
|
|
25515
25512
|
selectionStatus,
|
|
25516
25513
|
displaySelection,
|
|
25517
25514
|
displayPagination,
|
|
25518
|
-
|
|
25519
|
-
|
|
25520
|
-
|
|
25521
|
-
onPageSizeChange,
|
|
25515
|
+
paginationModel,
|
|
25516
|
+
onPaginationModelChange,
|
|
25517
|
+
pageSizeOptions,
|
|
25522
25518
|
displayRowsPerPage,
|
|
25523
|
-
rowsPerPageOptions,
|
|
25524
25519
|
paginationProps,
|
|
25525
25520
|
rowCount
|
|
25526
25521
|
} = _ref3;
|
|
@@ -25539,13 +25534,17 @@ const ServerSideControlledPagination = _ref3 => {
|
|
|
25539
25534
|
}, totalRowsLabel) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$2({
|
|
25540
25535
|
component: "div",
|
|
25541
25536
|
count: totalNumberOfRowsInTable,
|
|
25542
|
-
page: page,
|
|
25543
|
-
onPageChange: (event,
|
|
25544
|
-
|
|
25545
|
-
|
|
25546
|
-
|
|
25547
|
-
|
|
25548
|
-
|
|
25537
|
+
page: paginationModel.page,
|
|
25538
|
+
onPageChange: (event, page) => onPaginationModelChange({
|
|
25539
|
+
page,
|
|
25540
|
+
pageSize: paginationModel.pageSize
|
|
25541
|
+
}),
|
|
25542
|
+
rowsPerPage: paginationModel.pageSize,
|
|
25543
|
+
onRowsPerPageChange: event => onPaginationModelChange({
|
|
25544
|
+
page: paginationModel.page,
|
|
25545
|
+
pageSize: parseInt(event.target.value, 10)
|
|
25546
|
+
}),
|
|
25547
|
+
rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
|
|
25549
25548
|
}, paginationProps)) : null);
|
|
25550
25549
|
};
|
|
25551
25550
|
|
|
@@ -25571,11 +25570,9 @@ const ControlledPagination = _ref3 => {
|
|
|
25571
25570
|
displayPagination = false,
|
|
25572
25571
|
selectionStatus,
|
|
25573
25572
|
apiRef,
|
|
25574
|
-
|
|
25575
|
-
|
|
25576
|
-
|
|
25577
|
-
onPageSizeChange,
|
|
25578
|
-
rowsPerPageOptions,
|
|
25573
|
+
paginationModel,
|
|
25574
|
+
onPaginationModelChange,
|
|
25575
|
+
pageSizeOptions,
|
|
25579
25576
|
isRowSelectable,
|
|
25580
25577
|
paginationProps
|
|
25581
25578
|
} = _ref3;
|
|
@@ -25605,17 +25602,25 @@ const ControlledPagination = _ref3 => {
|
|
|
25605
25602
|
}, `${selectionStatus.numberOfSelectedRows} row${selectionStatus.numberOfSelectedRows > 1 ? 's' : ''} selected`) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$2({
|
|
25606
25603
|
component: "div",
|
|
25607
25604
|
count: numberOfFilteredRowsInTable,
|
|
25608
|
-
page: page,
|
|
25609
|
-
onPageChange: (event,
|
|
25610
|
-
|
|
25605
|
+
page: paginationModel.page,
|
|
25606
|
+
onPageChange: (event, page) => {
|
|
25607
|
+
onPaginationModelChange({
|
|
25608
|
+
page,
|
|
25609
|
+
pageSize: paginationModel.pageSize
|
|
25610
|
+
});
|
|
25611
|
+
},
|
|
25612
|
+
rowsPerPage: paginationModel.pageSize,
|
|
25611
25613
|
onRowsPerPageChange: event => {
|
|
25612
|
-
|
|
25614
|
+
onPaginationModelChange({
|
|
25615
|
+
page: paginationModel.page,
|
|
25616
|
+
pageSize: parseInt(event.target.value, 10)
|
|
25617
|
+
});
|
|
25613
25618
|
},
|
|
25614
|
-
rowsPerPageOptions: displayRowsPerPage ?
|
|
25619
|
+
rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
|
|
25615
25620
|
}, paginationProps)) : null);
|
|
25616
25621
|
};
|
|
25617
25622
|
|
|
25618
|
-
const _excluded$3 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "
|
|
25623
|
+
const _excluded$3 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "paginationModel", "onPaginationModelChange", "pageSizeOptions", "paginationProps", "paginationMode", "rowCount"];
|
|
25619
25624
|
const ToolbarWrapper = _ref => {
|
|
25620
25625
|
let {
|
|
25621
25626
|
hideToolbar,
|
|
@@ -25627,11 +25632,9 @@ const ToolbarWrapper = _ref => {
|
|
|
25627
25632
|
selectionStatus,
|
|
25628
25633
|
apiRef,
|
|
25629
25634
|
isRowSelectable,
|
|
25630
|
-
|
|
25631
|
-
|
|
25632
|
-
|
|
25633
|
-
onPageSizeChange,
|
|
25634
|
-
rowsPerPageOptions,
|
|
25635
|
+
paginationModel,
|
|
25636
|
+
onPaginationModelChange,
|
|
25637
|
+
pageSizeOptions,
|
|
25635
25638
|
paginationProps,
|
|
25636
25639
|
paginationMode = 'client',
|
|
25637
25640
|
rowCount
|
|
@@ -25645,11 +25648,9 @@ const ToolbarWrapper = _ref => {
|
|
|
25645
25648
|
displayRowsPerPage: false,
|
|
25646
25649
|
displayPagination: ['top', 'both'].includes(paginationPlacement),
|
|
25647
25650
|
selectionStatus: selectionStatus.current,
|
|
25648
|
-
|
|
25649
|
-
|
|
25650
|
-
|
|
25651
|
-
onPageSizeChange: onPageSizeChange,
|
|
25652
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
25651
|
+
paginationModel: paginationModel,
|
|
25652
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
25653
|
+
pageSizeOptions: pageSizeOptions,
|
|
25653
25654
|
paginationProps: paginationProps,
|
|
25654
25655
|
rowCount: rowCount
|
|
25655
25656
|
}) : /*#__PURE__*/React__default.createElement(ControlledPagination, {
|
|
@@ -25659,30 +25660,26 @@ const ToolbarWrapper = _ref => {
|
|
|
25659
25660
|
selectionStatus: selectionStatus.current,
|
|
25660
25661
|
apiRef: apiRef,
|
|
25661
25662
|
isRowSelectable: isRowSelectable,
|
|
25662
|
-
|
|
25663
|
-
|
|
25664
|
-
|
|
25665
|
-
onPageSizeChange: onPageSizeChange,
|
|
25666
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
25663
|
+
paginationModel: paginationModel,
|
|
25664
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
25665
|
+
pageSizeOptions: pageSizeOptions,
|
|
25667
25666
|
paginationProps: paginationProps
|
|
25668
25667
|
}) : null);
|
|
25669
25668
|
};
|
|
25670
25669
|
|
|
25671
25670
|
const useControlledDatagridState = _ref => {
|
|
25672
|
-
var _initialState$paginat, _initialState$paginat2;
|
|
25671
|
+
var _ref2, _ref3, _propsPaginationModel, _initialState$paginat, _initialState$paginat2, _pageSizeOptions$, _ref4, _propsPaginationModel2, _initialState$paginat3, _initialState$paginat4;
|
|
25673
25672
|
let {
|
|
25674
25673
|
initialState,
|
|
25675
|
-
|
|
25674
|
+
pageSizeOptions,
|
|
25676
25675
|
propsColumnVisibilityModel,
|
|
25677
25676
|
propsFilterModel,
|
|
25678
25677
|
propsOnColumnVisibilityModelChange,
|
|
25679
25678
|
propsOnFilterModelChange,
|
|
25680
|
-
|
|
25681
|
-
propsOnPageSizeChange,
|
|
25679
|
+
propsOnPaginationModelChange,
|
|
25682
25680
|
propsOnPinnedColumnsChange,
|
|
25683
25681
|
propsOnSortModelChange,
|
|
25684
|
-
|
|
25685
|
-
propsPageSize,
|
|
25682
|
+
propsPaginationModel,
|
|
25686
25683
|
propsPinnedColumns,
|
|
25687
25684
|
propsSortModel
|
|
25688
25685
|
} = _ref;
|
|
@@ -25730,33 +25727,22 @@ const useControlledDatagridState = _ref => {
|
|
|
25730
25727
|
setSortModel(model);
|
|
25731
25728
|
}
|
|
25732
25729
|
};
|
|
25733
|
-
const [
|
|
25734
|
-
|
|
25735
|
-
|
|
25736
|
-
|
|
25737
|
-
|
|
25738
|
-
|
|
25739
|
-
|
|
25740
|
-
}
|
|
25741
|
-
};
|
|
25742
|
-
useEffect(() => {
|
|
25743
|
-
if (propsPage || propsPage === 0) {
|
|
25744
|
-
setPage(propsPage);
|
|
25745
|
-
}
|
|
25746
|
-
}, [propsPage]);
|
|
25747
|
-
const onPageSizeChange = pageSize => {
|
|
25748
|
-
onPageChange(0);
|
|
25749
|
-
if (propsOnPageSizeChange) {
|
|
25750
|
-
propsOnPageSizeChange(pageSize, undefined);
|
|
25730
|
+
const [paginationModel, setPaginationModel] = useState({
|
|
25731
|
+
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,
|
|
25732
|
+
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
|
|
25733
|
+
});
|
|
25734
|
+
const onPaginationModelChange = (model, details) => {
|
|
25735
|
+
if (propsOnPaginationModelChange) {
|
|
25736
|
+
propsOnPaginationModelChange(model, details);
|
|
25751
25737
|
} else {
|
|
25752
|
-
|
|
25738
|
+
setPaginationModel(model);
|
|
25753
25739
|
}
|
|
25754
25740
|
};
|
|
25755
25741
|
useEffect(() => {
|
|
25756
|
-
if (
|
|
25757
|
-
|
|
25742
|
+
if (propsPaginationModel) {
|
|
25743
|
+
setPaginationModel(propsPaginationModel);
|
|
25758
25744
|
}
|
|
25759
|
-
}, [
|
|
25745
|
+
}, [propsPaginationModel]);
|
|
25760
25746
|
return {
|
|
25761
25747
|
filterModel,
|
|
25762
25748
|
onFilterModelChange,
|
|
@@ -25766,14 +25752,12 @@ const useControlledDatagridState = _ref => {
|
|
|
25766
25752
|
onPinnedColumnsChange,
|
|
25767
25753
|
sortModel,
|
|
25768
25754
|
onSortModelChange,
|
|
25769
|
-
|
|
25770
|
-
|
|
25771
|
-
onPageChange,
|
|
25772
|
-
onPageSizeChange
|
|
25755
|
+
paginationModel,
|
|
25756
|
+
onPaginationModelChange
|
|
25773
25757
|
};
|
|
25774
25758
|
};
|
|
25775
25759
|
|
|
25776
|
-
const _excluded$2 = ["apiRef", "autoHeight", "className", "
|
|
25760
|
+
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"];
|
|
25777
25761
|
const COMPONENT_NAME$2 = 'DataGrid';
|
|
25778
25762
|
const CLASSNAME$2 = 'redsift-datagrid';
|
|
25779
25763
|
const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
@@ -25782,33 +25766,30 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
25782
25766
|
apiRef: propsApiRef,
|
|
25783
25767
|
autoHeight,
|
|
25784
25768
|
className,
|
|
25785
|
-
|
|
25786
|
-
|
|
25787
|
-
componentsProps,
|
|
25769
|
+
slots,
|
|
25770
|
+
slotProps,
|
|
25788
25771
|
filterModel: propsFilterModel,
|
|
25789
25772
|
columnVisibilityModel: propsColumnVisibilityModel,
|
|
25790
25773
|
pinnedColumns: propsPinnedColumns,
|
|
25791
25774
|
sortModel: propsSortModel,
|
|
25775
|
+
paginationModel: propsPaginationModel,
|
|
25792
25776
|
height: propsHeight,
|
|
25793
25777
|
hideToolbar,
|
|
25794
25778
|
initialState,
|
|
25795
25779
|
isRowSelectable,
|
|
25796
25780
|
license = process.env.MUI_LICENSE_KEY,
|
|
25797
25781
|
onFilterModelChange: propsOnFilterModelChange,
|
|
25798
|
-
|
|
25799
|
-
|
|
25782
|
+
rowSelectionModel: propsRowSelectionModel,
|
|
25783
|
+
onPaginationModelChange: propsOnPaginationModelChange,
|
|
25784
|
+
onRowSelectionModelChange: propsOnRowSelectionModelChange,
|
|
25800
25785
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
25801
25786
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
25802
25787
|
onSortModelChange: propsOnSortModelChange,
|
|
25803
|
-
selectionModel: propsSelectionModel,
|
|
25804
|
-
onSelectionModelChange: propsOnSelectionModelChange,
|
|
25805
|
-
page: propsPage,
|
|
25806
|
-
pageSize: propsPageSize,
|
|
25807
25788
|
pagination,
|
|
25808
25789
|
paginationPlacement = 'both',
|
|
25809
25790
|
paginationProps,
|
|
25810
25791
|
rows,
|
|
25811
|
-
|
|
25792
|
+
pageSizeOptions,
|
|
25812
25793
|
sx,
|
|
25813
25794
|
theme: propsTheme,
|
|
25814
25795
|
paginationMode = 'client',
|
|
@@ -25818,7 +25799,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
25818
25799
|
const theme = useTheme$4(propsTheme);
|
|
25819
25800
|
const _apiRef = useGridApiRef();
|
|
25820
25801
|
const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
|
|
25821
|
-
const RenderedToolbar =
|
|
25802
|
+
const RenderedToolbar = slots !== null && slots !== void 0 && slots.toolbar ? slots.toolbar : Toolbar$2;
|
|
25822
25803
|
LicenseInfo.setLicenseKey(license);
|
|
25823
25804
|
const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
|
|
25824
25805
|
const {
|
|
@@ -25826,56 +25807,52 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
25826
25807
|
filterModel,
|
|
25827
25808
|
onColumnVisibilityModelChange,
|
|
25828
25809
|
onFilterModelChange,
|
|
25829
|
-
|
|
25830
|
-
onPageSizeChange,
|
|
25810
|
+
onPaginationModelChange,
|
|
25831
25811
|
onPinnedColumnsChange,
|
|
25832
25812
|
onSortModelChange,
|
|
25833
|
-
|
|
25834
|
-
pageSize,
|
|
25813
|
+
paginationModel,
|
|
25835
25814
|
pinnedColumns,
|
|
25836
25815
|
sortModel
|
|
25837
25816
|
} = useControlledDatagridState({
|
|
25838
25817
|
initialState,
|
|
25839
|
-
|
|
25818
|
+
pageSizeOptions,
|
|
25840
25819
|
propsColumnVisibilityModel,
|
|
25841
25820
|
propsFilterModel,
|
|
25842
25821
|
propsOnColumnVisibilityModelChange,
|
|
25843
25822
|
propsOnFilterModelChange,
|
|
25844
25823
|
propsOnPinnedColumnsChange,
|
|
25845
25824
|
propsOnSortModelChange,
|
|
25846
|
-
|
|
25847
|
-
propsPageSize,
|
|
25825
|
+
propsPaginationModel,
|
|
25848
25826
|
propsPinnedColumns,
|
|
25849
25827
|
propsSortModel,
|
|
25850
|
-
|
|
25851
|
-
propsOnPageSizeChange
|
|
25828
|
+
propsOnPaginationModelChange
|
|
25852
25829
|
});
|
|
25853
|
-
const [
|
|
25830
|
+
const [rowSelectionModel, setRowSelectionModel] = useState(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
25854
25831
|
useEffect(() => {
|
|
25855
|
-
|
|
25856
|
-
}, [
|
|
25857
|
-
const
|
|
25858
|
-
if (
|
|
25859
|
-
|
|
25832
|
+
setRowSelectionModel(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
25833
|
+
}, [propsRowSelectionModel]);
|
|
25834
|
+
const onRowSelectionModelChange = (selectionModel, details) => {
|
|
25835
|
+
if (propsOnRowSelectionModelChange) {
|
|
25836
|
+
propsOnRowSelectionModelChange(selectionModel, details);
|
|
25860
25837
|
} else {
|
|
25861
|
-
|
|
25838
|
+
setRowSelectionModel(selectionModel);
|
|
25862
25839
|
}
|
|
25863
25840
|
};
|
|
25864
25841
|
const selectionStatus = useRef({
|
|
25865
25842
|
type: 'none',
|
|
25866
25843
|
numberOfSelectedRows: 0,
|
|
25867
25844
|
numberOfSelectedRowsInPage: 0,
|
|
25868
|
-
page,
|
|
25869
|
-
pageSize
|
|
25845
|
+
page: paginationModel.page,
|
|
25846
|
+
pageSize: paginationModel.pageSize
|
|
25870
25847
|
});
|
|
25871
25848
|
|
|
25872
25849
|
// in server-side pagination we want to update the selection status
|
|
25873
25850
|
// every time we navigate between pages, resize our page or select something
|
|
25874
25851
|
useEffect(() => {
|
|
25875
25852
|
if (paginationMode == 'server') {
|
|
25876
|
-
onServerSideSelectionStatusChange(Array.isArray(
|
|
25853
|
+
onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatus, isRowSelectable, paginationModel.page, paginationModel.pageSize);
|
|
25877
25854
|
}
|
|
25878
|
-
}, [
|
|
25855
|
+
}, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
|
|
25879
25856
|
if (!Array.isArray(rows)) {
|
|
25880
25857
|
return null;
|
|
25881
25858
|
}
|
|
@@ -25906,57 +25883,54 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
25906
25883
|
apiRef: apiRef,
|
|
25907
25884
|
autoHeight: autoHeight,
|
|
25908
25885
|
checkboxSelectionVisibleOnly: Boolean(pagination),
|
|
25909
|
-
|
|
25910
|
-
|
|
25911
|
-
|
|
25912
|
-
|
|
25913
|
-
|
|
25914
|
-
|
|
25915
|
-
ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
25886
|
+
slots: _objectSpread2(_objectSpread2({
|
|
25887
|
+
baseButton: BaseButton,
|
|
25888
|
+
baseCheckbox: BaseCheckbox,
|
|
25889
|
+
// baseTextField,
|
|
25890
|
+
basePopper: BasePopper,
|
|
25891
|
+
columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
25916
25892
|
displayName: "ColumnFilteredIcon"
|
|
25917
25893
|
})),
|
|
25918
|
-
|
|
25894
|
+
columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
25919
25895
|
displayName: "ColumnSelectorIcon"
|
|
25920
25896
|
})),
|
|
25921
|
-
|
|
25897
|
+
columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
25922
25898
|
displayName: "ColumnSortedAscendingIcon"
|
|
25923
25899
|
})),
|
|
25924
|
-
|
|
25900
|
+
columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
25925
25901
|
displayName: "ColumnSortedDescendingIcon"
|
|
25926
25902
|
})),
|
|
25927
|
-
|
|
25903
|
+
densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
25928
25904
|
displayName: "DensityCompactIcon"
|
|
25929
25905
|
})),
|
|
25930
|
-
|
|
25906
|
+
densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
25931
25907
|
displayName: "DensityStandardIcon"
|
|
25932
25908
|
})),
|
|
25933
|
-
|
|
25909
|
+
densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
25934
25910
|
displayName: "DensityComfortableIcon"
|
|
25935
25911
|
})),
|
|
25936
|
-
|
|
25912
|
+
detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
25937
25913
|
displayName: "DetailPanelCollapseIcon"
|
|
25938
25914
|
})),
|
|
25939
|
-
|
|
25915
|
+
detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
25940
25916
|
displayName: "DetailPanelExpandIcon"
|
|
25941
25917
|
})),
|
|
25942
|
-
|
|
25918
|
+
exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
25943
25919
|
displayName: "ExportIcon"
|
|
25944
25920
|
})),
|
|
25945
|
-
|
|
25921
|
+
openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({
|
|
25946
25922
|
displayName: "OpenFilterButtonIcon"
|
|
25947
25923
|
}, props))
|
|
25948
|
-
},
|
|
25949
|
-
|
|
25950
|
-
|
|
25924
|
+
}, slots), {}, {
|
|
25925
|
+
toolbar: ToolbarWrapper,
|
|
25926
|
+
pagination: props => pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$2({}, props, {
|
|
25951
25927
|
displaySelection: false,
|
|
25952
25928
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
25953
25929
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
25954
25930
|
selectionStatus: selectionStatus.current,
|
|
25955
|
-
|
|
25956
|
-
|
|
25957
|
-
|
|
25958
|
-
onPageSizeChange: onPageSizeChange,
|
|
25959
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
25931
|
+
paginationModel: paginationModel,
|
|
25932
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
25933
|
+
pageSizeOptions: pageSizeOptions,
|
|
25960
25934
|
paginationProps: paginationProps,
|
|
25961
25935
|
paginationMode: paginationMode,
|
|
25962
25936
|
rowCount: rowCount
|
|
@@ -25967,16 +25941,14 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
25967
25941
|
selectionStatus: selectionStatus.current,
|
|
25968
25942
|
apiRef: apiRef,
|
|
25969
25943
|
isRowSelectable: isRowSelectable,
|
|
25970
|
-
|
|
25971
|
-
|
|
25972
|
-
|
|
25973
|
-
onPageSizeChange: onPageSizeChange,
|
|
25974
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
25944
|
+
paginationModel: paginationModel,
|
|
25945
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
25946
|
+
pageSizeOptions: pageSizeOptions,
|
|
25975
25947
|
paginationProps: paginationProps,
|
|
25976
25948
|
paginationMode: paginationMode
|
|
25977
25949
|
})) : null
|
|
25978
25950
|
}),
|
|
25979
|
-
|
|
25951
|
+
slotProps: _objectSpread2(_objectSpread2({}, slotProps), {}, {
|
|
25980
25952
|
toolbar: _objectSpread2({
|
|
25981
25953
|
hideToolbar,
|
|
25982
25954
|
RenderedToolbar,
|
|
@@ -25987,15 +25959,13 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
25987
25959
|
selectionStatus,
|
|
25988
25960
|
apiRef,
|
|
25989
25961
|
isRowSelectable,
|
|
25990
|
-
|
|
25991
|
-
|
|
25992
|
-
|
|
25993
|
-
onPageSizeChange,
|
|
25994
|
-
rowsPerPageOptions,
|
|
25962
|
+
paginationModel,
|
|
25963
|
+
onPaginationModelChange,
|
|
25964
|
+
pageSizeOptions,
|
|
25995
25965
|
paginationProps,
|
|
25996
25966
|
paginationMode,
|
|
25997
25967
|
rowCount
|
|
25998
|
-
},
|
|
25968
|
+
}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar)
|
|
25999
25969
|
}),
|
|
26000
25970
|
filterModel: filterModel,
|
|
26001
25971
|
columnVisibilityModel: columnVisibilityModel,
|
|
@@ -26011,13 +25981,11 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26011
25981
|
paginationMode: paginationMode,
|
|
26012
25982
|
keepNonExistentRowsSelected: paginationMode == 'server',
|
|
26013
25983
|
rows: rows,
|
|
26014
|
-
|
|
26015
|
-
|
|
26016
|
-
|
|
26017
|
-
|
|
26018
|
-
|
|
26019
|
-
selectionModel: selectionModel,
|
|
26020
|
-
onSelectionModelChange: (newSelectionModel, details) => {
|
|
25984
|
+
pageSizeOptions: pageSizeOptions,
|
|
25985
|
+
paginationModel: paginationModel,
|
|
25986
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
25987
|
+
rowSelectionModel: rowSelectionModel,
|
|
25988
|
+
onRowSelectionModelChange: (newSelectionModel, details) => {
|
|
26021
25989
|
if (pagination && paginationMode != 'server') {
|
|
26022
25990
|
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
|
|
26023
25991
|
let {
|
|
@@ -26075,7 +26043,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26075
26043
|
};
|
|
26076
26044
|
}
|
|
26077
26045
|
}
|
|
26078
|
-
|
|
26046
|
+
onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
|
|
26079
26047
|
},
|
|
26080
26048
|
sx: _objectSpread2(_objectSpread2({}, sx), {}, {
|
|
26081
26049
|
'.MuiDataGrid-columnHeaders': {
|
|
@@ -26092,8 +26060,6 @@ DataGrid.className = CLASSNAME$2;
|
|
|
26092
26060
|
DataGrid.displayName = COMPONENT_NAME$2;
|
|
26093
26061
|
|
|
26094
26062
|
// Get and Set data from LocalStorage WITHOUT useState
|
|
26095
|
-
|
|
26096
|
-
// triggering a state update and consecutive re-render
|
|
26097
26063
|
const useFetchState = (defaultValue, key) => {
|
|
26098
26064
|
let stickyValue = null;
|
|
26099
26065
|
try {
|
|
@@ -26101,16 +26067,7 @@ const useFetchState = (defaultValue, key) => {
|
|
|
26101
26067
|
} catch (e) {
|
|
26102
26068
|
console.error('StatefulDataGrid: error getting item from local storage: ', e);
|
|
26103
26069
|
}
|
|
26104
|
-
|
|
26105
|
-
|
|
26106
|
-
// TODO: temporary workaround to avoid clashes when someone had sorting on the now-removed screenshot field (renamed to num_annotations)
|
|
26107
|
-
// Consider upgrading the Datagrid component library as the exception handling was added in this PR: https://github.com/mui-org/material-ui-x/pull/3224
|
|
26108
|
-
if (parsedValue instanceof Array) {
|
|
26109
|
-
const fields = (parsedValue || []).map(item => item.field);
|
|
26110
|
-
if (fields.includes('screenshot') || fields.includes('diffs')) {
|
|
26111
|
-
parsedValue = defaultValue;
|
|
26112
|
-
}
|
|
26113
|
-
}
|
|
26070
|
+
const parsedValue = stickyValue !== null && stickyValue !== undefined && stickyValue !== 'undefined' ? JSON.parse(stickyValue) : defaultValue;
|
|
26114
26071
|
const updateValue = useCallback(value => {
|
|
26115
26072
|
try {
|
|
26116
26073
|
window.localStorage.setItem(key, JSON.stringify(value));
|
|
@@ -26121,6 +26078,8 @@ const useFetchState = (defaultValue, key) => {
|
|
|
26121
26078
|
return [parsedValue, updateValue];
|
|
26122
26079
|
};
|
|
26123
26080
|
|
|
26081
|
+
// import useLocalStorage from './useLocalStorage';
|
|
26082
|
+
|
|
26124
26083
|
const useTableStates = (id, version, customDefaults) => {
|
|
26125
26084
|
const [paginationModel, setPaginationModel] = useFetchState('', buildStorageKey({
|
|
26126
26085
|
id,
|
|
@@ -26176,8 +26135,7 @@ const useStatefulTable = props => {
|
|
|
26176
26135
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
26177
26136
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
26178
26137
|
onFilterModelChange: propsOnFilterModelChange,
|
|
26179
|
-
|
|
26180
|
-
onPageSizeChange: propsOnPageSizeChange,
|
|
26138
|
+
onPaginationModelChange: propsOnPaginationModelChange,
|
|
26181
26139
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
26182
26140
|
onSortModelChange: propsOnSortModelChange,
|
|
26183
26141
|
pinnedCustomColumns = {
|
|
@@ -26248,7 +26206,6 @@ const useStatefulTable = props => {
|
|
|
26248
26206
|
column.width = dimensionModel[column.field] || column.width || 100;
|
|
26249
26207
|
return column;
|
|
26250
26208
|
}), [propsColumns, dimensionModel]);
|
|
26251
|
-
|
|
26252
26209
|
/** Add resetPage method to apiRef. */
|
|
26253
26210
|
apiRef.current.resetPage = () => {
|
|
26254
26211
|
apiRef.current.setPage(0);
|
|
@@ -26259,7 +26216,7 @@ const useStatefulTable = props => {
|
|
|
26259
26216
|
onFilterModelChange: (model, details) => {
|
|
26260
26217
|
const filterModel = _objectSpread2(_objectSpread2({}, model), {}, {
|
|
26261
26218
|
items: model.items.map(item => {
|
|
26262
|
-
const column = apiRef.current.getColumn(item.
|
|
26219
|
+
const column = apiRef.current.getColumn(item.field);
|
|
26263
26220
|
item.type = column.type || 'string';
|
|
26264
26221
|
return item;
|
|
26265
26222
|
})
|
|
@@ -26296,33 +26253,16 @@ const useStatefulTable = props => {
|
|
|
26296
26253
|
}, search, historyReplace, columns);
|
|
26297
26254
|
},
|
|
26298
26255
|
pinnedColumns: pinnedColumnsModel,
|
|
26299
|
-
|
|
26300
|
-
|
|
26301
|
-
|
|
26302
|
-
|
|
26303
|
-
|
|
26304
|
-
|
|
26305
|
-
filterModel: filterParsed,
|
|
26306
|
-
sortModel: sortModelParsed,
|
|
26307
|
-
paginationModel: {
|
|
26308
|
-
page,
|
|
26309
|
-
pageSize: paginationModelParsed.pageSize,
|
|
26310
|
-
direction
|
|
26311
|
-
},
|
|
26312
|
-
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
26313
|
-
pinnedColumnsModel: pinnedColumnsModel
|
|
26314
|
-
}, search, historyReplace, columns);
|
|
26315
|
-
},
|
|
26316
|
-
onPageSizeChange: (pageSize, details) => {
|
|
26317
|
-
propsOnPageSizeChange === null || propsOnPageSizeChange === void 0 ? void 0 : propsOnPageSizeChange(pageSize, details);
|
|
26256
|
+
paginationModel: paginationModelParsed,
|
|
26257
|
+
onPaginationModelChange: (model, details) => {
|
|
26258
|
+
const paginationModel = _objectSpread2(_objectSpread2({}, model), {}, {
|
|
26259
|
+
direction: paginationModelParsed.page < model.page ? 'next' : 'back'
|
|
26260
|
+
});
|
|
26261
|
+
propsOnPaginationModelChange === null || propsOnPaginationModelChange === void 0 ? void 0 : propsOnPaginationModelChange(paginationModel, details);
|
|
26318
26262
|
updateUrl({
|
|
26319
26263
|
filterModel: filterParsed,
|
|
26320
26264
|
sortModel: sortModelParsed,
|
|
26321
|
-
paginationModel:
|
|
26322
|
-
page: paginationModelParsed.page,
|
|
26323
|
-
pageSize,
|
|
26324
|
-
direction: paginationModelParsed.direction
|
|
26325
|
-
},
|
|
26265
|
+
paginationModel: paginationModel,
|
|
26326
26266
|
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
26327
26267
|
pinnedColumnsModel: pinnedColumnsModel
|
|
26328
26268
|
}, search, historyReplace, columns);
|
|
@@ -26348,7 +26288,7 @@ const useStatefulTable = props => {
|
|
|
26348
26288
|
};
|
|
26349
26289
|
};
|
|
26350
26290
|
|
|
26351
|
-
const _excluded$1 = ["apiRef", "autoHeight", "className", "columns", "
|
|
26291
|
+
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"];
|
|
26352
26292
|
const COMPONENT_NAME$1 = 'DataGrid';
|
|
26353
26293
|
const CLASSNAME$1 = 'redsift-datagrid';
|
|
26354
26294
|
const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
@@ -26358,15 +26298,13 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26358
26298
|
autoHeight,
|
|
26359
26299
|
className,
|
|
26360
26300
|
columns,
|
|
26361
|
-
|
|
26362
|
-
|
|
26363
|
-
componentsProps,
|
|
26301
|
+
slots,
|
|
26302
|
+
slotProps,
|
|
26364
26303
|
filterModel: propsFilterModel,
|
|
26365
26304
|
columnVisibilityModel: propsColumnVisibilityModel,
|
|
26366
26305
|
pinnedColumns: propsPinnedColumns,
|
|
26367
26306
|
sortModel: propsSortModel,
|
|
26368
|
-
|
|
26369
|
-
pageSize: propsPageSize,
|
|
26307
|
+
paginationModel: propsPaginationModel,
|
|
26370
26308
|
height: propsHeight,
|
|
26371
26309
|
hideToolbar,
|
|
26372
26310
|
initialState,
|
|
@@ -26374,11 +26312,10 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26374
26312
|
license = process.env.MUI_LICENSE_KEY,
|
|
26375
26313
|
localStorageVersion,
|
|
26376
26314
|
onFilterModelChange: propsOnFilterModelChange,
|
|
26377
|
-
|
|
26315
|
+
rowSelectionModel: propsRowSelectionModel,
|
|
26378
26316
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
26379
|
-
|
|
26380
|
-
|
|
26381
|
-
onSelectionModelChange: propsOnSelectionModelChange,
|
|
26317
|
+
onPaginationModelChange: propsOnPaginationModelChange,
|
|
26318
|
+
onRowSelectionModelChange: propsOnRowSelectionModelChange,
|
|
26382
26319
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
26383
26320
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
26384
26321
|
onSortModelChange: propsOnSortModelChange,
|
|
@@ -26387,7 +26324,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26387
26324
|
paginationProps,
|
|
26388
26325
|
pinnedCustomColumns,
|
|
26389
26326
|
rows,
|
|
26390
|
-
|
|
26327
|
+
pageSizeOptions,
|
|
26391
26328
|
sx,
|
|
26392
26329
|
theme: propsTheme,
|
|
26393
26330
|
useRouter,
|
|
@@ -26398,43 +26335,38 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26398
26335
|
const theme = useTheme$4(propsTheme);
|
|
26399
26336
|
const _apiRef = useGridApiRef();
|
|
26400
26337
|
const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
|
|
26401
|
-
const RenderedToolbar =
|
|
26338
|
+
const RenderedToolbar = slots !== null && slots !== void 0 && slots.toolbar ? slots.toolbar : Toolbar$2;
|
|
26402
26339
|
LicenseInfo.setLicenseKey(license);
|
|
26403
26340
|
const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
|
|
26404
26341
|
const {
|
|
26405
26342
|
onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
|
|
26406
26343
|
onFilterModelChange: controlledOnFilterModelChange,
|
|
26407
|
-
|
|
26408
|
-
onPageSizeChange: controlledOnPageSizeChange,
|
|
26344
|
+
onPaginationModelChange: controlledOnPaginationModelChange,
|
|
26409
26345
|
onPinnedColumnsChange: controlledOnPinnedColumnsChange,
|
|
26410
26346
|
onSortModelChange: controlledOnSortModelChange
|
|
26411
26347
|
} = useControlledDatagridState({
|
|
26412
26348
|
initialState,
|
|
26413
|
-
|
|
26349
|
+
pageSizeOptions,
|
|
26414
26350
|
propsColumnVisibilityModel,
|
|
26415
26351
|
propsFilterModel,
|
|
26416
26352
|
propsOnColumnVisibilityModelChange,
|
|
26417
26353
|
propsOnFilterModelChange,
|
|
26418
26354
|
propsOnPinnedColumnsChange,
|
|
26419
26355
|
propsOnSortModelChange,
|
|
26420
|
-
|
|
26421
|
-
propsPageSize,
|
|
26356
|
+
propsPaginationModel,
|
|
26422
26357
|
propsPinnedColumns,
|
|
26423
26358
|
propsSortModel,
|
|
26424
|
-
|
|
26425
|
-
propsOnPageSizeChange
|
|
26359
|
+
propsOnPaginationModelChange
|
|
26426
26360
|
});
|
|
26427
26361
|
const {
|
|
26428
26362
|
columnVisibilityModel,
|
|
26429
26363
|
filterModel,
|
|
26430
26364
|
onColumnVisibilityModelChange,
|
|
26431
26365
|
onFilterModelChange,
|
|
26432
|
-
|
|
26433
|
-
onPageSizeChange,
|
|
26366
|
+
onPaginationModelChange,
|
|
26434
26367
|
onPinnedColumnsChange,
|
|
26435
26368
|
onSortModelChange,
|
|
26436
|
-
|
|
26437
|
-
pageSize,
|
|
26369
|
+
paginationModel,
|
|
26438
26370
|
pinnedColumns,
|
|
26439
26371
|
sortModel,
|
|
26440
26372
|
onColumnWidthChange
|
|
@@ -26444,40 +26376,39 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26444
26376
|
onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
|
|
26445
26377
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
26446
26378
|
onFilterModelChange: controlledOnFilterModelChange,
|
|
26447
|
-
|
|
26448
|
-
onPageSizeChange: controlledOnPageSizeChange,
|
|
26379
|
+
onPaginationModelChange: controlledOnPaginationModelChange,
|
|
26449
26380
|
onPinnedColumnsChange: controlledOnPinnedColumnsChange,
|
|
26450
26381
|
onSortModelChange: controlledOnSortModelChange,
|
|
26451
26382
|
pinnedCustomColumns,
|
|
26452
26383
|
useRouter: useRouter,
|
|
26453
26384
|
localStorageVersion
|
|
26454
26385
|
});
|
|
26455
|
-
const [
|
|
26386
|
+
const [rowSelectionModel, setRowSelectionModel] = useState(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
26456
26387
|
useEffect(() => {
|
|
26457
|
-
|
|
26458
|
-
}, [
|
|
26459
|
-
const
|
|
26460
|
-
if (
|
|
26461
|
-
|
|
26388
|
+
setRowSelectionModel(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
26389
|
+
}, [propsRowSelectionModel]);
|
|
26390
|
+
const onRowSelectionModelChange = (selectionModel, details) => {
|
|
26391
|
+
if (propsOnRowSelectionModelChange) {
|
|
26392
|
+
propsOnRowSelectionModelChange(selectionModel, details);
|
|
26462
26393
|
} else {
|
|
26463
|
-
|
|
26394
|
+
setRowSelectionModel(selectionModel);
|
|
26464
26395
|
}
|
|
26465
26396
|
};
|
|
26466
26397
|
const selectionStatus = useRef({
|
|
26467
26398
|
type: 'none',
|
|
26468
26399
|
numberOfSelectedRows: 0,
|
|
26469
26400
|
numberOfSelectedRowsInPage: 0,
|
|
26470
|
-
page,
|
|
26471
|
-
pageSize: pageSize
|
|
26401
|
+
page: paginationModel.page,
|
|
26402
|
+
pageSize: paginationModel.pageSize
|
|
26472
26403
|
});
|
|
26473
26404
|
|
|
26474
26405
|
// in server-side pagination we want to update the selection status
|
|
26475
26406
|
// every time we navigate between pages, resize our page or select something
|
|
26476
26407
|
useEffect(() => {
|
|
26477
26408
|
if (paginationMode == 'server') {
|
|
26478
|
-
onServerSideSelectionStatusChange(Array.isArray(
|
|
26409
|
+
onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatus, isRowSelectable, paginationModel.page, paginationModel.pageSize);
|
|
26479
26410
|
}
|
|
26480
|
-
}, [
|
|
26411
|
+
}, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
|
|
26481
26412
|
if (!Array.isArray(rows)) {
|
|
26482
26413
|
return null;
|
|
26483
26414
|
}
|
|
@@ -26510,15 +26441,13 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26510
26441
|
filterModel: filterModel,
|
|
26511
26442
|
onColumnVisibilityModelChange: onColumnVisibilityModelChange,
|
|
26512
26443
|
onFilterModelChange: onFilterModelChange,
|
|
26513
|
-
|
|
26514
|
-
onPageSizeChange: onPageSizeChange,
|
|
26444
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
26515
26445
|
onPinnedColumnsChange: onPinnedColumnsChange,
|
|
26516
26446
|
onSortModelChange: onSortModelChange,
|
|
26517
|
-
|
|
26518
|
-
pageSize: pageSize,
|
|
26447
|
+
paginationModel: paginationModel,
|
|
26519
26448
|
pinnedColumns: pinnedColumns,
|
|
26520
26449
|
sortModel: sortModel,
|
|
26521
|
-
|
|
26450
|
+
pageSizeOptions: pageSizeOptions,
|
|
26522
26451
|
onColumnWidthChange: onColumnWidthChange,
|
|
26523
26452
|
initialState: initialState,
|
|
26524
26453
|
isRowSelectable: isRowSelectable,
|
|
@@ -26529,58 +26458,55 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26529
26458
|
rowCount: rowCount,
|
|
26530
26459
|
autoHeight: autoHeight,
|
|
26531
26460
|
checkboxSelectionVisibleOnly: Boolean(pagination),
|
|
26532
|
-
|
|
26533
|
-
|
|
26534
|
-
|
|
26535
|
-
|
|
26536
|
-
|
|
26537
|
-
|
|
26538
|
-
ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
26461
|
+
slots: _objectSpread2(_objectSpread2({
|
|
26462
|
+
baseButton: BaseButton,
|
|
26463
|
+
baseCheckbox: BaseCheckbox,
|
|
26464
|
+
// baseTextField,
|
|
26465
|
+
basePopper: BasePopper,
|
|
26466
|
+
columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
26539
26467
|
displayName: "ColumnFilteredIcon"
|
|
26540
26468
|
})),
|
|
26541
|
-
|
|
26469
|
+
columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
26542
26470
|
displayName: "ColumnSelectorIcon"
|
|
26543
26471
|
})),
|
|
26544
|
-
|
|
26472
|
+
columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
26545
26473
|
displayName: "ColumnSortedAscendingIcon"
|
|
26546
26474
|
})),
|
|
26547
|
-
|
|
26475
|
+
columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
26548
26476
|
displayName: "ColumnSortedDescendingIcon"
|
|
26549
26477
|
})),
|
|
26550
|
-
|
|
26478
|
+
densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
26551
26479
|
displayName: "DensityCompactIcon"
|
|
26552
26480
|
})),
|
|
26553
|
-
|
|
26481
|
+
densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
26554
26482
|
displayName: "DensityStandardIcon"
|
|
26555
26483
|
})),
|
|
26556
|
-
|
|
26484
|
+
densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
26557
26485
|
displayName: "DensityComfortableIcon"
|
|
26558
26486
|
})),
|
|
26559
|
-
|
|
26487
|
+
detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
26560
26488
|
displayName: "DetailPanelCollapseIcon"
|
|
26561
26489
|
})),
|
|
26562
|
-
|
|
26490
|
+
detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
26563
26491
|
displayName: "DetailPanelExpandIcon"
|
|
26564
26492
|
})),
|
|
26565
|
-
|
|
26493
|
+
exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
|
|
26566
26494
|
displayName: "ExportIcon"
|
|
26567
26495
|
})),
|
|
26568
|
-
|
|
26496
|
+
openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({
|
|
26569
26497
|
displayName: "OpenFilterButtonIcon"
|
|
26570
26498
|
}, props))
|
|
26571
|
-
},
|
|
26572
|
-
|
|
26573
|
-
|
|
26499
|
+
}, slots), {}, {
|
|
26500
|
+
toolbar: ToolbarWrapper,
|
|
26501
|
+
pagination: props => {
|
|
26574
26502
|
return pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$2({}, props, {
|
|
26575
26503
|
displaySelection: false,
|
|
26576
26504
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
26577
26505
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
26578
26506
|
selectionStatus: selectionStatus.current,
|
|
26579
|
-
|
|
26580
|
-
|
|
26581
|
-
|
|
26582
|
-
onPageSizeChange: onPageSizeChange,
|
|
26583
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
26507
|
+
paginationModel: paginationModel,
|
|
26508
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
26509
|
+
pageSizeOptions: pageSizeOptions,
|
|
26584
26510
|
paginationProps: paginationProps,
|
|
26585
26511
|
paginationMode: paginationMode,
|
|
26586
26512
|
rowCount: rowCount
|
|
@@ -26591,17 +26517,15 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26591
26517
|
selectionStatus: selectionStatus.current,
|
|
26592
26518
|
apiRef: apiRef,
|
|
26593
26519
|
isRowSelectable: isRowSelectable,
|
|
26594
|
-
|
|
26595
|
-
|
|
26596
|
-
|
|
26597
|
-
onPageSizeChange: onPageSizeChange,
|
|
26598
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
26520
|
+
paginationModel: paginationModel,
|
|
26521
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
26522
|
+
pageSizeOptions: pageSizeOptions,
|
|
26599
26523
|
paginationProps: paginationProps,
|
|
26600
26524
|
paginationMode: paginationMode
|
|
26601
26525
|
})) : null;
|
|
26602
26526
|
}
|
|
26603
26527
|
}),
|
|
26604
|
-
|
|
26528
|
+
slotProps: _objectSpread2(_objectSpread2({}, slotProps), {}, {
|
|
26605
26529
|
toolbar: _objectSpread2({
|
|
26606
26530
|
hideToolbar,
|
|
26607
26531
|
RenderedToolbar,
|
|
@@ -26612,18 +26536,16 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26612
26536
|
selectionStatus,
|
|
26613
26537
|
apiRef,
|
|
26614
26538
|
isRowSelectable,
|
|
26615
|
-
|
|
26616
|
-
|
|
26617
|
-
|
|
26618
|
-
onPageSizeChange,
|
|
26619
|
-
rowsPerPageOptions,
|
|
26539
|
+
paginationModel,
|
|
26540
|
+
onPaginationModelChange,
|
|
26541
|
+
pageSizeOptions,
|
|
26620
26542
|
paginationProps,
|
|
26621
26543
|
paginationMode,
|
|
26622
26544
|
rowCount
|
|
26623
|
-
},
|
|
26545
|
+
}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar)
|
|
26624
26546
|
}),
|
|
26625
|
-
|
|
26626
|
-
|
|
26547
|
+
rowSelectionModel: rowSelectionModel,
|
|
26548
|
+
onRowSelectionModelChange: (newSelectionModel, details) => {
|
|
26627
26549
|
if (pagination && paginationMode != 'server') {
|
|
26628
26550
|
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
|
|
26629
26551
|
let {
|
|
@@ -26681,7 +26603,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26681
26603
|
};
|
|
26682
26604
|
}
|
|
26683
26605
|
}
|
|
26684
|
-
|
|
26606
|
+
onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
|
|
26685
26607
|
},
|
|
26686
26608
|
sx: _objectSpread2(_objectSpread2({}, sx), {}, {
|
|
26687
26609
|
'.MuiDataGrid-columnHeaders': {
|
|
@@ -26755,5 +26677,5 @@ const TextCell = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
26755
26677
|
TextCell.className = CLASSNAME;
|
|
26756
26678
|
TextCell.displayName = COMPONENT_NAME;
|
|
26757
26679
|
|
|
26758
|
-
export { BaseButton, BaseCheckbox, BaseIcon, BasePopper, BaseTextField, CATEGORIES, CONTAINS_ANY_OF, CONTAINS_ANY_OF_I, ControlledPagination, DEFAULT_OPERATORS, DETAIL_PANEL_TOGGLE_COL_DEF, DIMENSION_MODEL_KEY, DOES_NOT_CONTAIN, DOES_NOT_EQUAL, DataGrid, ENDS_WITH_ANY_OF, FILTER_MODEL_KEY, FILTER_SEARCH_KEY, GridToolbarFilterSemanticField, IS_ANY_OF, IS_BETWEEN, IS_NOT_ANY_OF, PAGINATION_MODEL_KEY, PINNED_COLUMNS, SORT_MODEL_KEY, STARTS_WITH_ANY_OF, ServerSideControlledPagination, StatefulDataGrid, TextCell, Toolbar$2 as Toolbar, ToolbarWrapper, VISIBILITY_MODEL_KEY, areFilterModelsEquivalent, buildStorageKey, clearPreviousVersionStorage, customColumnTypes, decodeValue, encodeValue, getColumnVisibilityFromString, getCompletion, getFilterModelFromString, getFinalSearch, getGridNumericOperators, getGridStringArrayOperators, getGridStringOperators, getModelsParsedOrUpdateLocalStorage, getPaginationFromString, getPinnedColumnsFromString, getRsNumberColumnType, getRsStringColumnType, getSearchParamsFromColumnVisibility, getSearchParamsFromFilterModel, getSearchParamsFromPagination, getSearchParamsFromPinnedColumns, getSearchParamsFromSorting, getSearchParamsFromTab, getSortingFromString, muiIconToDSIcon, numberOperatorDecoder, numberOperatorEncoder, onServerSideSelectionStatusChange, operatorList, updateUrl, urlSearchParamsToString };
|
|
26680
|
+
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 };
|
|
26759
26681
|
//# sourceMappingURL=index.js.map
|