@redsift/table 11.2.1 → 11.2.2-muiv5-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +32 -26
- package/index.js +366 -316
- package/index.js.map +1 -1
- package/package.json +6 -6
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GRID_DETAIL_PANEL_TOGGLE_COL_DEF, getGridNumericOperators as getGridNumericOperators$1, GridFilterInputValue, GridFilterInputMultipleValue, getGridStringOperators as getGridStringOperators$1, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators,
|
|
1
|
+
import { GRID_DETAIL_PANEL_TOGGLE_COL_DEF, getGridNumericOperators as getGridNumericOperators$1, GridFilterInputValue, GridFilterInputMultipleValue, getGridStringOperators as getGridStringOperators$1, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators, GridLinkOperator, GridToolbarContainer, GridToolbarFilterButton, GridToolbarColumnsButton, GridToolbarDensitySelector, GridToolbarExport, gridVisibleSortedRowIdsSelector, gridPaginatedVisibleSortedGridRowEntriesSelector, gridPaginatedVisibleSortedGridRowIdsSelector, gridFilteredSortedRowEntriesSelector, gridFilteredSortedRowIdsSelector, useGridApiRef, DataGridPro } from '@mui/x-data-grid-pro';
|
|
2
2
|
export { getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators } from '@mui/x-data-grid-pro';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import React__default, { Children, isValidElement, cloneElement, forwardRef, useLayoutEffect, useEffect, useRef, useContext, useState, useCallback, createElement, useMemo } from 'react';
|
|
@@ -17639,7 +17639,7 @@ const isBetweenOperator = {
|
|
|
17639
17639
|
label: 'is between',
|
|
17640
17640
|
value: 'isBetween',
|
|
17641
17641
|
getApplyFilterFn: filterItem => {
|
|
17642
|
-
if (!filterItem.
|
|
17642
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17643
17643
|
return null;
|
|
17644
17644
|
}
|
|
17645
17645
|
if (!Array.isArray(filterItem.value) || filterItem.value.length !== 2) {
|
|
@@ -17652,7 +17652,7 @@ const isBetweenOperator = {
|
|
|
17652
17652
|
return null;
|
|
17653
17653
|
}
|
|
17654
17654
|
return params => {
|
|
17655
|
-
return params.value !== null &&
|
|
17655
|
+
return params.value !== null && filterItem.value[0] <= params.value && params.value <= filterItem.value[1];
|
|
17656
17656
|
};
|
|
17657
17657
|
},
|
|
17658
17658
|
InputComponent: InputNumberInterval
|
|
@@ -17665,7 +17665,7 @@ const doesNotEqual = {
|
|
|
17665
17665
|
label: 'does not equal',
|
|
17666
17666
|
value: 'doesNotEqual',
|
|
17667
17667
|
getApplyFilterFn: filterItem => {
|
|
17668
|
-
if (!filterItem.
|
|
17668
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17669
17669
|
return null;
|
|
17670
17670
|
}
|
|
17671
17671
|
return params => {
|
|
@@ -17686,7 +17686,7 @@ const doesNotContain = {
|
|
|
17686
17686
|
label: 'does not contain',
|
|
17687
17687
|
value: 'doesNotContain',
|
|
17688
17688
|
getApplyFilterFn: filterItem => {
|
|
17689
|
-
if (!filterItem.
|
|
17689
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17690
17690
|
return null;
|
|
17691
17691
|
}
|
|
17692
17692
|
return params => {
|
|
@@ -17707,7 +17707,7 @@ const containsAnyOfOperator = {
|
|
|
17707
17707
|
label: 'contains any of',
|
|
17708
17708
|
value: 'containsAnyOf',
|
|
17709
17709
|
getApplyFilterFn: filterItem => {
|
|
17710
|
-
if (!filterItem.
|
|
17710
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17711
17711
|
return null;
|
|
17712
17712
|
}
|
|
17713
17713
|
return params => {
|
|
@@ -17730,7 +17730,7 @@ const containsAnyOfCIOperator = {
|
|
|
17730
17730
|
label: 'contains any of (case insensitive)',
|
|
17731
17731
|
value: 'containsAnyOf',
|
|
17732
17732
|
getApplyFilterFn: filterItem => {
|
|
17733
|
-
if (!filterItem.
|
|
17733
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17734
17734
|
return null;
|
|
17735
17735
|
}
|
|
17736
17736
|
return params => {
|
|
@@ -17757,7 +17757,7 @@ const endsWithAnyOfOperator = {
|
|
|
17757
17757
|
label: 'ends with any of',
|
|
17758
17758
|
value: 'endsWithAnyOf',
|
|
17759
17759
|
getApplyFilterFn: filterItem => {
|
|
17760
|
-
if (!filterItem.
|
|
17760
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17761
17761
|
return null;
|
|
17762
17762
|
}
|
|
17763
17763
|
return params => {
|
|
@@ -17784,7 +17784,7 @@ const isAnyOfOperator = {
|
|
|
17784
17784
|
label: 'is any of',
|
|
17785
17785
|
value: 'isAnyOf',
|
|
17786
17786
|
getApplyFilterFn: filterItem => {
|
|
17787
|
-
if (!filterItem.
|
|
17787
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17788
17788
|
return null;
|
|
17789
17789
|
}
|
|
17790
17790
|
return params => {
|
|
@@ -17808,7 +17808,7 @@ const isNotAnyOfOperator = {
|
|
|
17808
17808
|
label: 'is not any of',
|
|
17809
17809
|
value: 'isNotAnyOf',
|
|
17810
17810
|
getApplyFilterFn: filterItem => {
|
|
17811
|
-
if (!filterItem.
|
|
17811
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17812
17812
|
return null;
|
|
17813
17813
|
}
|
|
17814
17814
|
return params => {
|
|
@@ -17832,7 +17832,7 @@ const startsWithAnyOfOperator = {
|
|
|
17832
17832
|
label: 'starts with any of',
|
|
17833
17833
|
value: 'startsWithAnyOf',
|
|
17834
17834
|
getApplyFilterFn: filterItem => {
|
|
17835
|
-
if (!filterItem.
|
|
17835
|
+
if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
|
|
17836
17836
|
return null;
|
|
17837
17837
|
}
|
|
17838
17838
|
return params => {
|
|
@@ -17877,13 +17877,13 @@ const operatorList = {
|
|
|
17877
17877
|
|
|
17878
17878
|
const getRsStringColumnType = () => {
|
|
17879
17879
|
return {
|
|
17880
|
-
|
|
17880
|
+
extendType: 'string',
|
|
17881
17881
|
filterOperators: operatorList.rsString
|
|
17882
17882
|
};
|
|
17883
17883
|
};
|
|
17884
17884
|
const getRsNumberColumnType = () => {
|
|
17885
17885
|
return {
|
|
17886
|
-
|
|
17886
|
+
extendType: 'number',
|
|
17887
17887
|
filterOperators: operatorList.rsNumber
|
|
17888
17888
|
};
|
|
17889
17889
|
};
|
|
@@ -17894,7 +17894,7 @@ const customColumnTypes = {
|
|
|
17894
17894
|
|
|
17895
17895
|
const API_URL = 'https://api.openai.com/v1/chat/completions';
|
|
17896
17896
|
async function getCompletion(text, role, openai_api_key) {
|
|
17897
|
-
let model = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'gpt-3.5-turbo-
|
|
17897
|
+
let model = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'gpt-3.5-turbo-0613';
|
|
17898
17898
|
try {
|
|
17899
17899
|
const messages = [{
|
|
17900
17900
|
role: 'system',
|
|
@@ -18063,39 +18063,42 @@ const numberOperatorDecoder = {
|
|
|
18063
18063
|
lt: '<',
|
|
18064
18064
|
lte: '<='
|
|
18065
18065
|
};
|
|
18066
|
-
const isOperatorValueValid = (
|
|
18067
|
-
const column = columns.find(column => column.field ===
|
|
18066
|
+
const isOperatorValueValid = (columnField, operatorValue, columns) => {
|
|
18067
|
+
const column = columns.find(column => column.field === columnField);
|
|
18068
18068
|
if (!column) {
|
|
18069
18069
|
return false;
|
|
18070
18070
|
}
|
|
18071
18071
|
const columnType = (column === null || column === void 0 ? void 0 : column.type) || 'string';
|
|
18072
|
-
const operators =
|
|
18072
|
+
const operators = operatorList[columnType];
|
|
18073
18073
|
if (!operators) {
|
|
18074
18074
|
return false;
|
|
18075
18075
|
}
|
|
18076
|
-
|
|
18076
|
+
if ('filterOperators' in operators) {
|
|
18077
|
+
return !!operators.filterOperators.find(op => columnType === 'number' && Object.keys(numberOperatorEncoder).includes(op.value) ? numberOperatorEncoder[op.value] === operatorValue : op['value'] === operatorValue);
|
|
18078
|
+
}
|
|
18079
|
+
return !!operators.find(op => ['number', 'rsNumber'].includes(columnType) && Object.keys(numberOperatorEncoder).includes(op.value) ? numberOperatorEncoder[op.value] === operatorValue : op['value'] === operatorValue);
|
|
18077
18080
|
};
|
|
18078
18081
|
const listOperators = ['containsAnyOf', 'endsWithAnyOf', 'isAnyOf', 'isNotAnyOf', 'startsWithAnyOf'];
|
|
18079
18082
|
|
|
18080
18083
|
// Check if the value doesn't break
|
|
18081
|
-
const isValueValid = (value,
|
|
18084
|
+
const isValueValid = (value, columnField, columns, operatorValue) => {
|
|
18082
18085
|
var _column$type;
|
|
18083
18086
|
// every field accepts undefined as value for default
|
|
18084
18087
|
if (value === undefined || value === '') {
|
|
18085
18088
|
return true;
|
|
18086
18089
|
}
|
|
18087
18090
|
|
|
18088
|
-
// xxxAnyOf accepts as value only lists, and we are
|
|
18091
|
+
// xxxAnyOf accepts as value only lists, and we are declearing them in the
|
|
18089
18092
|
// URL as `list=[...]`
|
|
18090
|
-
if (listOperators.includes(
|
|
18093
|
+
if (listOperators.includes(operatorValue)) {
|
|
18091
18094
|
return Array.isArray(value) || value === '';
|
|
18092
18095
|
}
|
|
18093
18096
|
|
|
18094
18097
|
// We are accepting arrays only if they are of the 'xxxAnyOf' type
|
|
18095
|
-
if (Array.isArray(value) && !listOperators.includes(
|
|
18098
|
+
if (Array.isArray(value) && !listOperators.includes(operatorValue)) {
|
|
18096
18099
|
return false;
|
|
18097
18100
|
}
|
|
18098
|
-
const column = columns.find(column => column.field ===
|
|
18101
|
+
const column = columns.find(column => column.field === columnField);
|
|
18099
18102
|
if (!column) {
|
|
18100
18103
|
return false;
|
|
18101
18104
|
}
|
|
@@ -18133,14 +18136,14 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
18133
18136
|
if (!searchString) {
|
|
18134
18137
|
return 'invalid';
|
|
18135
18138
|
}
|
|
18136
|
-
let
|
|
18139
|
+
let linkOperator = GridLinkOperator.And;
|
|
18137
18140
|
const searchParams = new URLSearchParams();
|
|
18138
18141
|
for (const [key, value] of new URLSearchParams(searchString)) {
|
|
18139
18142
|
if (key.startsWith('_') && !['_logicOperator', '_sortColumn', '_pinnedColumnsLeft', '_pinnedColumnsRight', '_columnVisibility', '_pagination'].includes(key)) {
|
|
18140
18143
|
searchParams.set(key, value);
|
|
18141
18144
|
}
|
|
18142
18145
|
if (key === '_logicOperator') {
|
|
18143
|
-
|
|
18146
|
+
linkOperator = value === GridLinkOperator.And || value === GridLinkOperator.Or ? value : GridLinkOperator.And;
|
|
18144
18147
|
}
|
|
18145
18148
|
}
|
|
18146
18149
|
let id = 5000;
|
|
@@ -18181,8 +18184,8 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
18181
18184
|
return;
|
|
18182
18185
|
}
|
|
18183
18186
|
items.push({
|
|
18184
|
-
field,
|
|
18185
|
-
|
|
18187
|
+
columnField: field,
|
|
18188
|
+
operatorValue: ['number', 'rsNumber'].includes(columnType) && Object.keys(numberOperatorDecoder).includes(operator) ? numberOperatorDecoder[operator] : operator,
|
|
18186
18189
|
id,
|
|
18187
18190
|
value: listOperators.includes(operator) && decodedValue === '' ? [] : decodedValue,
|
|
18188
18191
|
type
|
|
@@ -18197,23 +18200,23 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
18197
18200
|
}
|
|
18198
18201
|
return {
|
|
18199
18202
|
items,
|
|
18200
|
-
|
|
18203
|
+
linkOperator
|
|
18201
18204
|
};
|
|
18202
18205
|
};
|
|
18203
18206
|
const getSearchParamsFromFilterModel = filterModel => {
|
|
18204
18207
|
const searchParams = new URLSearchParams();
|
|
18205
|
-
searchParams.set('_logicOperator', filterModel['
|
|
18208
|
+
searchParams.set('_logicOperator', filterModel['linkOperator'] || '');
|
|
18206
18209
|
filterModel['items'].forEach(item => {
|
|
18207
18210
|
const {
|
|
18208
|
-
|
|
18209
|
-
|
|
18211
|
+
columnField,
|
|
18212
|
+
operatorValue,
|
|
18210
18213
|
value,
|
|
18211
18214
|
type
|
|
18212
18215
|
} = item;
|
|
18213
|
-
if (Object.keys(numberOperatorEncoder).includes(
|
|
18214
|
-
searchParams.set(`_${
|
|
18216
|
+
if (Object.keys(numberOperatorEncoder).includes(operatorValue)) {
|
|
18217
|
+
searchParams.set(`_${columnField}[${numberOperatorEncoder[operatorValue]},${encodeValue(type)}]`, encodeValue(value));
|
|
18215
18218
|
} else {
|
|
18216
|
-
searchParams.set(`_${
|
|
18219
|
+
searchParams.set(`_${columnField}[${encodeValue(operatorValue)},${encodeValue(type)}]`, encodeValue(value));
|
|
18217
18220
|
}
|
|
18218
18221
|
});
|
|
18219
18222
|
return searchParams;
|
|
@@ -18239,7 +18242,7 @@ const getFilterModel = (search, columns, localStorageFilters, setLocalStorageFil
|
|
|
18239
18242
|
}
|
|
18240
18243
|
return initialState && initialState.filter && initialState.filter.filterModel ? initialState.filter.filterModel : {
|
|
18241
18244
|
items: [],
|
|
18242
|
-
|
|
18245
|
+
linkOperator: GridLinkOperator.And
|
|
18243
18246
|
};
|
|
18244
18247
|
};
|
|
18245
18248
|
|
|
@@ -18252,7 +18255,7 @@ const getSortingFromString = (searchString, columns) => {
|
|
|
18252
18255
|
const searchParams = new URLSearchParams(searchString);
|
|
18253
18256
|
const value = searchParams.get('_sortColumn');
|
|
18254
18257
|
if (value === '' || value === null || value === '[]') {
|
|
18255
|
-
return
|
|
18258
|
+
return 'invalid';
|
|
18256
18259
|
}
|
|
18257
18260
|
const fields = columns.map(column => column.field);
|
|
18258
18261
|
const [column, order] = value.slice(1, value.length - 1).split(',');
|
|
@@ -18353,13 +18356,38 @@ const getPaginationModel = (search, localStoragePagination, setLocalStoragePagin
|
|
|
18353
18356
|
|
|
18354
18357
|
/** COLUMN VISIBILITY */
|
|
18355
18358
|
|
|
18359
|
+
const getColumnVisibilityFromString = (searchString, columns) => {
|
|
18360
|
+
if (!searchString) {
|
|
18361
|
+
return 'invalid';
|
|
18362
|
+
}
|
|
18363
|
+
const searchParams = new URLSearchParams(searchString);
|
|
18364
|
+
const value = searchParams.get('_columnVisibility');
|
|
18365
|
+
if (value === '' || value === null || value === '[]') {
|
|
18366
|
+
return 'invalid';
|
|
18367
|
+
}
|
|
18368
|
+
const parsedFields = value.slice(1, value.length - 1).split(',');
|
|
18369
|
+
const fields = columns.map(column => column.field);
|
|
18370
|
+
const visibility = {};
|
|
18371
|
+
for (const field of fields) {
|
|
18372
|
+
visibility[field] = false;
|
|
18373
|
+
}
|
|
18374
|
+
for (const parsedField of parsedFields) {
|
|
18375
|
+
if (fields.includes(parsedField)) {
|
|
18376
|
+
visibility[parsedField] = true;
|
|
18377
|
+
}
|
|
18378
|
+
}
|
|
18379
|
+
if (Object.values(visibility).filter(v => v === true).length === 0) {
|
|
18380
|
+
return 'invalid';
|
|
18381
|
+
}
|
|
18382
|
+
return visibility;
|
|
18383
|
+
};
|
|
18356
18384
|
const getSearchParamsFromColumnVisibility = (columnVisibility, columns) => {
|
|
18357
18385
|
const searchParams = new URLSearchParams();
|
|
18358
|
-
const
|
|
18386
|
+
const columnFields = columns.map(column => column.field);
|
|
18359
18387
|
|
|
18360
18388
|
// if column visibility model is empty, show all columns
|
|
18361
18389
|
if (Object.keys(columnVisibility).length == 0) {
|
|
18362
|
-
searchParams.set('_columnVisibility', `[${
|
|
18390
|
+
searchParams.set('_columnVisibility', `[${columnFields.join(',')}]`);
|
|
18363
18391
|
return searchParams;
|
|
18364
18392
|
}
|
|
18365
18393
|
const finalColumnVisibility = columns.filter(c => {
|
|
@@ -18370,63 +18398,10 @@ const getSearchParamsFromColumnVisibility = (columnVisibility, columns) => {
|
|
|
18370
18398
|
[colName]: true
|
|
18371
18399
|
});
|
|
18372
18400
|
}, columnVisibility);
|
|
18373
|
-
const visibleColumns =
|
|
18374
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
18375
|
-
.filter(_ref => {
|
|
18376
|
-
let [_, visible] = _ref;
|
|
18377
|
-
return visible;
|
|
18378
|
-
})
|
|
18379
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
18380
|
-
.map(_ref2 => {
|
|
18381
|
-
let [column, _] = _ref2;
|
|
18382
|
-
return encodeValue(column);
|
|
18383
|
-
});
|
|
18401
|
+
const visibleColumns = columnFields.filter(column => finalColumnVisibility[column] !== false);
|
|
18384
18402
|
searchParams.set('_columnVisibility', `[${visibleColumns.join(',')}]`);
|
|
18385
18403
|
return searchParams;
|
|
18386
18404
|
};
|
|
18387
|
-
const getColumnVisibilityFromString = (notParsed, tableColumns) => {
|
|
18388
|
-
if (!notParsed || notParsed.length === 1 && notParsed[0] === '?') {
|
|
18389
|
-
return 'invalid';
|
|
18390
|
-
}
|
|
18391
|
-
// remove the initial ? if present
|
|
18392
|
-
const parsed = notParsed[0] === '?' ? notParsed.slice(1) : notParsed;
|
|
18393
|
-
const visibility = {};
|
|
18394
|
-
let exist = false;
|
|
18395
|
-
let visibleColumnsCount = 0;
|
|
18396
|
-
for (const item of parsed.split('&')) {
|
|
18397
|
-
// if it's not column visibility field, skip
|
|
18398
|
-
const fieldURL = item.split('=')[0];
|
|
18399
|
-
if (fieldURL !== '_columnVisibility') {
|
|
18400
|
-
continue;
|
|
18401
|
-
}
|
|
18402
|
-
// e.g. item = _columnVisibility[abc,def]
|
|
18403
|
-
const left = item.split(']')[0];
|
|
18404
|
-
if (left.split('[').length < 2) {
|
|
18405
|
-
continue;
|
|
18406
|
-
}
|
|
18407
|
-
const encodedValues = item.split('[')[1].split(']')[0];
|
|
18408
|
-
if (typeof encodedValues !== 'string') {
|
|
18409
|
-
continue;
|
|
18410
|
-
}
|
|
18411
|
-
exist = true;
|
|
18412
|
-
const fields = tableColumns.map(column => column.field);
|
|
18413
|
-
// TODO: Add validation that , is present
|
|
18414
|
-
const columns = encodedValues.split(',').map(value => decodeValue(value));
|
|
18415
|
-
|
|
18416
|
-
// for each column, check if it's visible and add it to visibility model
|
|
18417
|
-
for (const column of fields) {
|
|
18418
|
-
const isColumnVisible = columns.includes(column);
|
|
18419
|
-
visibility[column] = isColumnVisible;
|
|
18420
|
-
if (isColumnVisible) {
|
|
18421
|
-
visibleColumnsCount += 1;
|
|
18422
|
-
}
|
|
18423
|
-
}
|
|
18424
|
-
}
|
|
18425
|
-
if (visibleColumnsCount === 0 && !exist) {
|
|
18426
|
-
return 'invalid';
|
|
18427
|
-
}
|
|
18428
|
-
return visibility;
|
|
18429
|
-
};
|
|
18430
18405
|
|
|
18431
18406
|
// Rules:
|
|
18432
18407
|
// - if we have something in the URL, use that info
|
|
@@ -18481,8 +18456,8 @@ const getPinnedColumnsFromString = (notParsed, tableColumns) => {
|
|
|
18481
18456
|
if (typeof encodedValues !== 'string') {
|
|
18482
18457
|
continue;
|
|
18483
18458
|
}
|
|
18484
|
-
const
|
|
18485
|
-
const columns = encodedValues.split(',').map(value => decodeValue(value)).filter(val => typeof val === 'string' &&
|
|
18459
|
+
const columnFields = [...tableColumns.map(column => column.field), '__check__'];
|
|
18460
|
+
const columns = encodedValues.split(',').map(value => decodeValue(value)).filter(val => typeof val === 'string' && columnFields.includes(val));
|
|
18486
18461
|
if (fieldURL === '_pinnedColumnsLeft') {
|
|
18487
18462
|
pinnedColumns['left'] = columns;
|
|
18488
18463
|
}
|
|
@@ -18490,9 +18465,9 @@ const getPinnedColumnsFromString = (notParsed, tableColumns) => {
|
|
|
18490
18465
|
pinnedColumns['right'] = columns;
|
|
18491
18466
|
}
|
|
18492
18467
|
}
|
|
18493
|
-
return pinnedColumns
|
|
18494
|
-
left: pinnedColumns
|
|
18495
|
-
right: pinnedColumns
|
|
18468
|
+
return pinnedColumns.left && pinnedColumns.left.length > 0 || pinnedColumns.right && pinnedColumns.right.length > 0 ? {
|
|
18469
|
+
left: pinnedColumns.left || [],
|
|
18470
|
+
right: pinnedColumns.right || []
|
|
18496
18471
|
} : 'invalid';
|
|
18497
18472
|
};
|
|
18498
18473
|
const getSearchParamsFromPinnedColumns = pinnedColumns => {
|
|
@@ -18544,7 +18519,7 @@ const getSearchParamsFromTab = search => {
|
|
|
18544
18519
|
}
|
|
18545
18520
|
return searchParams;
|
|
18546
18521
|
};
|
|
18547
|
-
const getFinalSearch =
|
|
18522
|
+
const getFinalSearch = _ref => {
|
|
18548
18523
|
let {
|
|
18549
18524
|
search,
|
|
18550
18525
|
filterModel,
|
|
@@ -18553,7 +18528,7 @@ const getFinalSearch = _ref3 => {
|
|
|
18553
18528
|
columnsVisibilityModel,
|
|
18554
18529
|
pinnedColumnsModel,
|
|
18555
18530
|
columns
|
|
18556
|
-
} =
|
|
18531
|
+
} = _ref;
|
|
18557
18532
|
const filterModelSearch = getSearchParamsFromFilterModel(filterModel);
|
|
18558
18533
|
const sortModelSearch = getSearchParamsFromSorting(sortModel);
|
|
18559
18534
|
const paginationModelSearch = getSearchParamsFromPagination(paginationModel);
|
|
@@ -18608,14 +18583,14 @@ const getModelsParsedOrUpdateLocalStorage = (search, columns, historyReplace, in
|
|
|
18608
18583
|
pinnedColumnsModel
|
|
18609
18584
|
};
|
|
18610
18585
|
};
|
|
18611
|
-
const updateUrl = (
|
|
18586
|
+
const updateUrl = (_ref2, search, historyReplace, columns) => {
|
|
18612
18587
|
let {
|
|
18613
18588
|
filterModel,
|
|
18614
18589
|
sortModel,
|
|
18615
18590
|
paginationModel,
|
|
18616
18591
|
columnsModel: columnsVisibilityModel,
|
|
18617
18592
|
pinnedColumnsModel
|
|
18618
|
-
} =
|
|
18593
|
+
} = _ref2;
|
|
18619
18594
|
const newSearch = getFinalSearch({
|
|
18620
18595
|
search,
|
|
18621
18596
|
filterModel,
|
|
@@ -18635,17 +18610,17 @@ const updateUrl = (_ref4, search, historyReplace, columns) => {
|
|
|
18635
18610
|
// do not use it for equivalence (e.g. with value `3` and undefined we
|
|
18636
18611
|
// will get 0).
|
|
18637
18612
|
const compareFilters = (firstFilter, secondFilter) => {
|
|
18638
|
-
if (firstFilter.
|
|
18613
|
+
if (firstFilter.columnField < secondFilter.columnField) {
|
|
18639
18614
|
return -1;
|
|
18640
|
-
} else if (firstFilter.
|
|
18615
|
+
} else if (firstFilter.columnField > secondFilter.columnField) {
|
|
18641
18616
|
return 1;
|
|
18642
18617
|
}
|
|
18643
|
-
if (firstFilter.
|
|
18618
|
+
if (firstFilter.operatorValue === undefined || secondFilter.operatorValue === undefined) {
|
|
18644
18619
|
return 0;
|
|
18645
18620
|
}
|
|
18646
|
-
if (firstFilter.
|
|
18621
|
+
if (firstFilter.operatorValue < secondFilter.operatorValue) {
|
|
18647
18622
|
return -1;
|
|
18648
|
-
} else if (firstFilter.
|
|
18623
|
+
} else if (firstFilter.operatorValue > secondFilter.operatorValue) {
|
|
18649
18624
|
return 1;
|
|
18650
18625
|
}
|
|
18651
18626
|
if (firstFilter.value < secondFilter.value) {
|
|
@@ -18656,18 +18631,18 @@ const compareFilters = (firstFilter, secondFilter) => {
|
|
|
18656
18631
|
return 0;
|
|
18657
18632
|
};
|
|
18658
18633
|
const areFiltersEquivalent = (firstFilter, secondFilter) => {
|
|
18659
|
-
return firstFilter.
|
|
18634
|
+
return firstFilter.columnField === secondFilter.columnField && firstFilter.operatorValue === secondFilter.operatorValue && firstFilter.value === secondFilter.value;
|
|
18660
18635
|
};
|
|
18661
18636
|
const areFilterModelsEquivalent = (filterModel, filterModelToMatch) => {
|
|
18662
18637
|
const {
|
|
18663
18638
|
items,
|
|
18664
|
-
|
|
18639
|
+
linkOperator
|
|
18665
18640
|
} = filterModel;
|
|
18666
18641
|
const {
|
|
18667
18642
|
items: itemsToMatch,
|
|
18668
|
-
|
|
18643
|
+
linkOperator: linkOperatorToMatch
|
|
18669
18644
|
} = filterModelToMatch;
|
|
18670
|
-
if (
|
|
18645
|
+
if (linkOperator !== linkOperatorToMatch) {
|
|
18671
18646
|
return false;
|
|
18672
18647
|
}
|
|
18673
18648
|
if (items.length !== itemsToMatch.length) {
|
|
@@ -18680,7 +18655,7 @@ const areFilterModelsEquivalent = (filterModel, filterModelToMatch) => {
|
|
|
18680
18655
|
const filterToCompare = itemsToMatch[i];
|
|
18681
18656
|
|
|
18682
18657
|
// compareFilters return 0 if and only if the filters have the same
|
|
18683
|
-
//
|
|
18658
|
+
// columnField, operatorValue, and value
|
|
18684
18659
|
if (!areFiltersEquivalent(filter, filterToCompare)) {
|
|
18685
18660
|
return false;
|
|
18686
18661
|
}
|
|
@@ -24491,16 +24466,16 @@ const getRole = (config, dateFormat) => {
|
|
|
24491
24466
|
}).join('\n');
|
|
24492
24467
|
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.
|
|
24493
24468
|
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.
|
|
24494
|
-
The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "
|
|
24495
|
-
- "
|
|
24496
|
-
- "items": a list of conditions, each is an object with exactly the three keys "
|
|
24497
|
-
- "
|
|
24469
|
+
The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "linkOperator" and "items":
|
|
24470
|
+
- "linkOperator": the logical operator, only "and" or "or" are allowed. If there is only one condition in the "items", use "and".
|
|
24471
|
+
- "items": a list of conditions, each is an object with exactly the three keys "columnField", "operatorValue" and "value":
|
|
24472
|
+
- "columnField": the column name, must be one of ${columns}
|
|
24498
24473
|
- "value":
|
|
24499
|
-
- this can be skipped if the "
|
|
24500
|
-
- a list of multiple values if the "
|
|
24474
|
+
- this can be skipped if the "operatorValue" is either "isEmpty" or "isNotEmpty"
|
|
24475
|
+
- a list of multiple values if the "operatorValue" ends with "AnyOf"
|
|
24501
24476
|
- otherwise, it's a single value represented as a string: "true" instead of true, "false" instead of false, "0.6" instead of 0.6.
|
|
24502
24477
|
For "date" data type, use ${dateFormat}. If relative date is input, convert to the actual date given today is ${today}.
|
|
24503
|
-
- "
|
|
24478
|
+
- "operatorValue": the comparison operator, accepted values depend on the data type of the column
|
|
24504
24479
|
${operators}
|
|
24505
24480
|
|
|
24506
24481
|
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:
|
|
@@ -24537,10 +24512,10 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24537
24512
|
nlpFilterConfig,
|
|
24538
24513
|
onFilterModelChange,
|
|
24539
24514
|
dateFormat = 'yyyy-mm-dd',
|
|
24540
|
-
defaultModel = 'gpt-4-
|
|
24515
|
+
defaultModel = 'gpt-4-0613',
|
|
24541
24516
|
defaultFilter = {
|
|
24542
24517
|
items: [],
|
|
24543
|
-
|
|
24518
|
+
linkOperator: 'and'
|
|
24544
24519
|
},
|
|
24545
24520
|
disablePower = false,
|
|
24546
24521
|
localeText
|
|
@@ -24618,7 +24593,7 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24618
24593
|
value: prompt
|
|
24619
24594
|
}), /*#__PURE__*/React__default.createElement(Button, {
|
|
24620
24595
|
variant: "primary",
|
|
24621
|
-
"
|
|
24596
|
+
"aira-label": buttonAriaLabel,
|
|
24622
24597
|
type: "submit",
|
|
24623
24598
|
isLoading: isLoading
|
|
24624
24599
|
}, buttonText)), !disablePower && /*#__PURE__*/React__default.createElement(Tooltip, null, /*#__PURE__*/React__default.createElement(Tooltip.Trigger, null, /*#__PURE__*/React__default.createElement(Switch, {
|
|
@@ -24679,7 +24654,7 @@ const Toolbar$2 = props => {
|
|
|
24679
24654
|
let {
|
|
24680
24655
|
apiRef
|
|
24681
24656
|
} = _ref;
|
|
24682
|
-
return
|
|
24657
|
+
return gridVisibleSortedRowIdsSelector(apiRef);
|
|
24683
24658
|
}
|
|
24684
24659
|
},
|
|
24685
24660
|
printOptions: {
|
|
@@ -26911,10 +26886,12 @@ const ServerSideControlledPagination = _ref3 => {
|
|
|
26911
26886
|
selectionStatus,
|
|
26912
26887
|
displaySelection,
|
|
26913
26888
|
displayPagination,
|
|
26914
|
-
|
|
26915
|
-
|
|
26916
|
-
|
|
26889
|
+
page,
|
|
26890
|
+
onPageChange,
|
|
26891
|
+
pageSize,
|
|
26892
|
+
onPageSizeChange,
|
|
26917
26893
|
displayRowsPerPage,
|
|
26894
|
+
rowsPerPageOptions,
|
|
26918
26895
|
paginationProps,
|
|
26919
26896
|
rowCount
|
|
26920
26897
|
} = _ref3;
|
|
@@ -26933,17 +26910,13 @@ const ServerSideControlledPagination = _ref3 => {
|
|
|
26933
26910
|
}, totalRowsLabel) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$1({
|
|
26934
26911
|
component: "div",
|
|
26935
26912
|
count: totalNumberOfRowsInTable,
|
|
26936
|
-
page:
|
|
26937
|
-
onPageChange: (event,
|
|
26938
|
-
|
|
26939
|
-
|
|
26940
|
-
|
|
26941
|
-
|
|
26942
|
-
|
|
26943
|
-
page: paginationModel.page,
|
|
26944
|
-
pageSize: parseInt(event.target.value, 10)
|
|
26945
|
-
}),
|
|
26946
|
-
rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
|
|
26913
|
+
page: page,
|
|
26914
|
+
onPageChange: (event, newPage) => onPageChange(newPage),
|
|
26915
|
+
rowsPerPage: pageSize,
|
|
26916
|
+
onRowsPerPageChange: event => {
|
|
26917
|
+
onPageSizeChange(parseInt(event.target.value, 10));
|
|
26918
|
+
},
|
|
26919
|
+
rowsPerPageOptions: displayRowsPerPage ? rowsPerPageOptions : []
|
|
26947
26920
|
}, paginationProps)) : null);
|
|
26948
26921
|
};
|
|
26949
26922
|
|
|
@@ -26969,9 +26942,11 @@ const ControlledPagination = _ref3 => {
|
|
|
26969
26942
|
displayPagination = false,
|
|
26970
26943
|
selectionStatus,
|
|
26971
26944
|
apiRef,
|
|
26972
|
-
|
|
26973
|
-
|
|
26974
|
-
|
|
26945
|
+
page,
|
|
26946
|
+
onPageChange,
|
|
26947
|
+
pageSize,
|
|
26948
|
+
onPageSizeChange,
|
|
26949
|
+
rowsPerPageOptions,
|
|
26975
26950
|
isRowSelectable,
|
|
26976
26951
|
paginationProps
|
|
26977
26952
|
} = _ref3;
|
|
@@ -27001,25 +26976,17 @@ const ControlledPagination = _ref3 => {
|
|
|
27001
26976
|
}, `${selectionStatus.numberOfSelectedRows} row${selectionStatus.numberOfSelectedRows > 1 ? 's' : ''} selected`) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$1({
|
|
27002
26977
|
component: "div",
|
|
27003
26978
|
count: numberOfFilteredRowsInTable,
|
|
27004
|
-
page:
|
|
27005
|
-
onPageChange: (event,
|
|
27006
|
-
|
|
27007
|
-
page,
|
|
27008
|
-
pageSize: paginationModel.pageSize
|
|
27009
|
-
});
|
|
27010
|
-
},
|
|
27011
|
-
rowsPerPage: paginationModel.pageSize,
|
|
26979
|
+
page: page,
|
|
26980
|
+
onPageChange: (event, newPage) => onPageChange(newPage),
|
|
26981
|
+
rowsPerPage: pageSize,
|
|
27012
26982
|
onRowsPerPageChange: event => {
|
|
27013
|
-
|
|
27014
|
-
page: paginationModel.page,
|
|
27015
|
-
pageSize: parseInt(event.target.value, 10)
|
|
27016
|
-
});
|
|
26983
|
+
onPageSizeChange(parseInt(event.target.value, 10));
|
|
27017
26984
|
},
|
|
27018
|
-
rowsPerPageOptions: displayRowsPerPage ?
|
|
26985
|
+
rowsPerPageOptions: displayRowsPerPage ? rowsPerPageOptions : []
|
|
27019
26986
|
}, paginationProps)) : null);
|
|
27020
26987
|
};
|
|
27021
26988
|
|
|
27022
|
-
const _excluded$3 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "
|
|
26989
|
+
const _excluded$3 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "page", "onPageChange", "pageSize", "onPageSizeChange", "rowsPerPageOptions", "paginationProps", "paginationMode", "rowCount"];
|
|
27023
26990
|
const ToolbarWrapper = _ref => {
|
|
27024
26991
|
let {
|
|
27025
26992
|
hideToolbar,
|
|
@@ -27031,9 +26998,11 @@ const ToolbarWrapper = _ref => {
|
|
|
27031
26998
|
selectionStatus,
|
|
27032
26999
|
apiRef,
|
|
27033
27000
|
isRowSelectable,
|
|
27034
|
-
|
|
27035
|
-
|
|
27036
|
-
|
|
27001
|
+
page,
|
|
27002
|
+
onPageChange,
|
|
27003
|
+
pageSize,
|
|
27004
|
+
onPageSizeChange,
|
|
27005
|
+
rowsPerPageOptions,
|
|
27037
27006
|
paginationProps,
|
|
27038
27007
|
paginationMode = 'client',
|
|
27039
27008
|
rowCount
|
|
@@ -27047,9 +27016,11 @@ const ToolbarWrapper = _ref => {
|
|
|
27047
27016
|
displayRowsPerPage: false,
|
|
27048
27017
|
displayPagination: ['top', 'both'].includes(paginationPlacement),
|
|
27049
27018
|
selectionStatus: selectionStatus.current,
|
|
27050
|
-
|
|
27051
|
-
|
|
27052
|
-
|
|
27019
|
+
page: page,
|
|
27020
|
+
onPageChange: onPageChange,
|
|
27021
|
+
pageSize: pageSize,
|
|
27022
|
+
onPageSizeChange: onPageSizeChange,
|
|
27023
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
27053
27024
|
paginationProps: paginationProps,
|
|
27054
27025
|
rowCount: rowCount
|
|
27055
27026
|
}) : /*#__PURE__*/React__default.createElement(ControlledPagination, {
|
|
@@ -27059,26 +27030,30 @@ const ToolbarWrapper = _ref => {
|
|
|
27059
27030
|
selectionStatus: selectionStatus.current,
|
|
27060
27031
|
apiRef: apiRef,
|
|
27061
27032
|
isRowSelectable: isRowSelectable,
|
|
27062
|
-
|
|
27063
|
-
|
|
27064
|
-
|
|
27033
|
+
page: page,
|
|
27034
|
+
onPageChange: onPageChange,
|
|
27035
|
+
pageSize: pageSize,
|
|
27036
|
+
onPageSizeChange: onPageSizeChange,
|
|
27037
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
27065
27038
|
paginationProps: paginationProps
|
|
27066
27039
|
}) : null);
|
|
27067
27040
|
};
|
|
27068
27041
|
|
|
27069
27042
|
const useControlledDatagridState = _ref => {
|
|
27070
|
-
var
|
|
27043
|
+
var _initialState$paginat, _initialState$paginat2;
|
|
27071
27044
|
let {
|
|
27072
27045
|
initialState,
|
|
27073
|
-
|
|
27046
|
+
rowsPerPageOptions,
|
|
27074
27047
|
propsColumnVisibilityModel,
|
|
27075
27048
|
propsFilterModel,
|
|
27076
27049
|
propsOnColumnVisibilityModelChange,
|
|
27077
27050
|
propsOnFilterModelChange,
|
|
27078
|
-
|
|
27051
|
+
propsOnPageChange,
|
|
27052
|
+
propsOnPageSizeChange,
|
|
27079
27053
|
propsOnPinnedColumnsChange,
|
|
27080
27054
|
propsOnSortModelChange,
|
|
27081
|
-
|
|
27055
|
+
propsPage,
|
|
27056
|
+
propsPageSize,
|
|
27082
27057
|
propsPinnedColumns,
|
|
27083
27058
|
propsSortModel
|
|
27084
27059
|
} = _ref;
|
|
@@ -27126,22 +27101,33 @@ const useControlledDatagridState = _ref => {
|
|
|
27126
27101
|
setSortModel(model);
|
|
27127
27102
|
}
|
|
27128
27103
|
};
|
|
27129
|
-
const [
|
|
27130
|
-
|
|
27131
|
-
|
|
27132
|
-
|
|
27133
|
-
|
|
27134
|
-
if (propsOnPaginationModelChange) {
|
|
27135
|
-
propsOnPaginationModelChange(model, details);
|
|
27104
|
+
const [page, setPage] = useState((initialState === null || initialState === void 0 ? void 0 : (_initialState$paginat = initialState.pagination) === null || _initialState$paginat === void 0 ? void 0 : _initialState$paginat.page) || propsPage || 0);
|
|
27105
|
+
const [pageSize, setPageSize] = useState((initialState === null || initialState === void 0 ? void 0 : (_initialState$paginat2 = initialState.pagination) === null || _initialState$paginat2 === void 0 ? void 0 : _initialState$paginat2.pageSize) || propsPageSize || (rowsPerPageOptions === null || rowsPerPageOptions === void 0 ? void 0 : rowsPerPageOptions[0]) || 25);
|
|
27106
|
+
const onPageChange = page => {
|
|
27107
|
+
if (propsOnPageChange) {
|
|
27108
|
+
propsOnPageChange(page, undefined);
|
|
27136
27109
|
} else {
|
|
27137
|
-
|
|
27110
|
+
setPage(page);
|
|
27138
27111
|
}
|
|
27139
27112
|
};
|
|
27140
27113
|
useEffect(() => {
|
|
27141
|
-
if (
|
|
27142
|
-
|
|
27114
|
+
if (propsPage || propsPage === 0) {
|
|
27115
|
+
setPage(propsPage);
|
|
27116
|
+
}
|
|
27117
|
+
}, [propsPage]);
|
|
27118
|
+
const onPageSizeChange = pageSize => {
|
|
27119
|
+
onPageChange(0);
|
|
27120
|
+
if (propsOnPageSizeChange) {
|
|
27121
|
+
propsOnPageSizeChange(pageSize, undefined);
|
|
27122
|
+
} else {
|
|
27123
|
+
setPageSize(pageSize);
|
|
27143
27124
|
}
|
|
27144
|
-
}
|
|
27125
|
+
};
|
|
27126
|
+
useEffect(() => {
|
|
27127
|
+
if (propsPageSize) {
|
|
27128
|
+
setPageSize(propsPageSize);
|
|
27129
|
+
}
|
|
27130
|
+
}, [propsPageSize]);
|
|
27145
27131
|
return {
|
|
27146
27132
|
filterModel,
|
|
27147
27133
|
onFilterModelChange,
|
|
@@ -27151,12 +27137,14 @@ const useControlledDatagridState = _ref => {
|
|
|
27151
27137
|
onPinnedColumnsChange,
|
|
27152
27138
|
sortModel,
|
|
27153
27139
|
onSortModelChange,
|
|
27154
|
-
|
|
27155
|
-
|
|
27140
|
+
page,
|
|
27141
|
+
pageSize,
|
|
27142
|
+
onPageChange,
|
|
27143
|
+
onPageSizeChange
|
|
27156
27144
|
};
|
|
27157
27145
|
};
|
|
27158
27146
|
|
|
27159
|
-
const _excluded$2 = ["apiRef", "autoHeight", "className", "
|
|
27147
|
+
const _excluded$2 = ["apiRef", "autoHeight", "className", "columnTypes", "components", "componentsProps", "filterModel", "columnVisibilityModel", "pinnedColumns", "sortModel", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "onFilterModelChange", "onPageChange", "onPageSizeChange", "onColumnVisibilityModelChange", "onPinnedColumnsChange", "onSortModelChange", "selectionModel", "onSelectionModelChange", "page", "pageSize", "pagination", "paginationPlacement", "paginationProps", "rows", "rowsPerPageOptions", "sx", "theme", "paginationMode", "rowCount"];
|
|
27160
27148
|
const COMPONENT_NAME$2 = 'DataGrid';
|
|
27161
27149
|
const CLASSNAME$2 = 'redsift-datagrid';
|
|
27162
27150
|
const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
@@ -27165,30 +27153,33 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27165
27153
|
apiRef: propsApiRef,
|
|
27166
27154
|
autoHeight,
|
|
27167
27155
|
className,
|
|
27168
|
-
|
|
27169
|
-
|
|
27156
|
+
columnTypes: propsColumnTypes,
|
|
27157
|
+
components,
|
|
27158
|
+
componentsProps,
|
|
27170
27159
|
filterModel: propsFilterModel,
|
|
27171
27160
|
columnVisibilityModel: propsColumnVisibilityModel,
|
|
27172
27161
|
pinnedColumns: propsPinnedColumns,
|
|
27173
27162
|
sortModel: propsSortModel,
|
|
27174
|
-
paginationModel: propsPaginationModel,
|
|
27175
27163
|
height: propsHeight,
|
|
27176
27164
|
hideToolbar,
|
|
27177
27165
|
initialState,
|
|
27178
27166
|
isRowSelectable,
|
|
27179
27167
|
license = process.env.MUI_LICENSE_KEY,
|
|
27180
27168
|
onFilterModelChange: propsOnFilterModelChange,
|
|
27181
|
-
|
|
27182
|
-
|
|
27183
|
-
onRowSelectionModelChange: propsOnRowSelectionModelChange,
|
|
27169
|
+
onPageChange: propsOnPageChange,
|
|
27170
|
+
onPageSizeChange: propsOnPageSizeChange,
|
|
27184
27171
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
27185
27172
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
27186
27173
|
onSortModelChange: propsOnSortModelChange,
|
|
27174
|
+
selectionModel: propsSelectionModel,
|
|
27175
|
+
onSelectionModelChange: propsOnSelectionModelChange,
|
|
27176
|
+
page: propsPage,
|
|
27177
|
+
pageSize: propsPageSize,
|
|
27187
27178
|
pagination,
|
|
27188
27179
|
paginationPlacement = 'both',
|
|
27189
27180
|
paginationProps,
|
|
27190
27181
|
rows,
|
|
27191
|
-
|
|
27182
|
+
rowsPerPageOptions,
|
|
27192
27183
|
sx,
|
|
27193
27184
|
theme: propsTheme,
|
|
27194
27185
|
paginationMode = 'client',
|
|
@@ -27198,7 +27189,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27198
27189
|
const theme = useTheme$4(propsTheme);
|
|
27199
27190
|
const _apiRef = useGridApiRef();
|
|
27200
27191
|
const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
|
|
27201
|
-
const RenderedToolbar =
|
|
27192
|
+
const RenderedToolbar = components !== null && components !== void 0 && components.Toolbar ? components.Toolbar : Toolbar$2;
|
|
27202
27193
|
LicenseInfo.setLicenseKey(license);
|
|
27203
27194
|
const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
|
|
27204
27195
|
const {
|
|
@@ -27206,52 +27197,56 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27206
27197
|
filterModel,
|
|
27207
27198
|
onColumnVisibilityModelChange,
|
|
27208
27199
|
onFilterModelChange,
|
|
27209
|
-
|
|
27200
|
+
onPageChange,
|
|
27201
|
+
onPageSizeChange,
|
|
27210
27202
|
onPinnedColumnsChange,
|
|
27211
27203
|
onSortModelChange,
|
|
27212
|
-
|
|
27204
|
+
page,
|
|
27205
|
+
pageSize,
|
|
27213
27206
|
pinnedColumns,
|
|
27214
27207
|
sortModel
|
|
27215
27208
|
} = useControlledDatagridState({
|
|
27216
27209
|
initialState,
|
|
27217
|
-
|
|
27210
|
+
rowsPerPageOptions,
|
|
27218
27211
|
propsColumnVisibilityModel,
|
|
27219
27212
|
propsFilterModel,
|
|
27220
27213
|
propsOnColumnVisibilityModelChange,
|
|
27221
27214
|
propsOnFilterModelChange,
|
|
27222
27215
|
propsOnPinnedColumnsChange,
|
|
27223
27216
|
propsOnSortModelChange,
|
|
27224
|
-
|
|
27217
|
+
propsPage,
|
|
27218
|
+
propsPageSize,
|
|
27225
27219
|
propsPinnedColumns,
|
|
27226
27220
|
propsSortModel,
|
|
27227
|
-
|
|
27221
|
+
propsOnPageChange,
|
|
27222
|
+
propsOnPageSizeChange
|
|
27228
27223
|
});
|
|
27229
|
-
const [
|
|
27224
|
+
const [selectionModel, setSelectionModel] = useState(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
|
|
27230
27225
|
useEffect(() => {
|
|
27231
|
-
|
|
27232
|
-
}, [
|
|
27233
|
-
const
|
|
27234
|
-
if (
|
|
27235
|
-
|
|
27226
|
+
setSelectionModel(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
|
|
27227
|
+
}, [propsSelectionModel]);
|
|
27228
|
+
const onSelectionModelChange = (selectionModel, details) => {
|
|
27229
|
+
if (propsOnSelectionModelChange) {
|
|
27230
|
+
propsOnSelectionModelChange(selectionModel, details);
|
|
27236
27231
|
} else {
|
|
27237
|
-
|
|
27232
|
+
setSelectionModel(selectionModel);
|
|
27238
27233
|
}
|
|
27239
27234
|
};
|
|
27240
27235
|
const selectionStatus = useRef({
|
|
27241
27236
|
type: 'none',
|
|
27242
27237
|
numberOfSelectedRows: 0,
|
|
27243
27238
|
numberOfSelectedRowsInPage: 0,
|
|
27244
|
-
page
|
|
27245
|
-
pageSize
|
|
27239
|
+
page,
|
|
27240
|
+
pageSize
|
|
27246
27241
|
});
|
|
27247
27242
|
|
|
27248
27243
|
// in server-side pagination we want to update the selection status
|
|
27249
27244
|
// every time we navigate between pages, resize our page or select something
|
|
27250
27245
|
useEffect(() => {
|
|
27251
27246
|
if (paginationMode == 'server') {
|
|
27252
|
-
onServerSideSelectionStatusChange(Array.isArray(
|
|
27247
|
+
onServerSideSelectionStatusChange(Array.isArray(selectionModel) ? selectionModel : [selectionModel], apiRef, selectionStatus, isRowSelectable, page, pageSize);
|
|
27253
27248
|
}
|
|
27254
|
-
}, [
|
|
27249
|
+
}, [selectionModel, page, pageSize]);
|
|
27255
27250
|
if (!Array.isArray(rows)) {
|
|
27256
27251
|
return null;
|
|
27257
27252
|
}
|
|
@@ -27282,54 +27277,57 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27282
27277
|
apiRef: apiRef,
|
|
27283
27278
|
autoHeight: autoHeight,
|
|
27284
27279
|
checkboxSelectionVisibleOnly: Boolean(pagination),
|
|
27285
|
-
|
|
27286
|
-
|
|
27287
|
-
|
|
27288
|
-
|
|
27289
|
-
|
|
27290
|
-
|
|
27280
|
+
columnTypes: _objectSpread2(_objectSpread2({}, customColumnTypes), propsColumnTypes),
|
|
27281
|
+
components: _objectSpread2(_objectSpread2({
|
|
27282
|
+
BaseButton,
|
|
27283
|
+
BaseCheckbox,
|
|
27284
|
+
// BaseTextField,
|
|
27285
|
+
BasePopper,
|
|
27286
|
+
ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27291
27287
|
displayName: "ColumnFilteredIcon"
|
|
27292
27288
|
})),
|
|
27293
|
-
|
|
27289
|
+
ColumnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27294
27290
|
displayName: "ColumnSelectorIcon"
|
|
27295
27291
|
})),
|
|
27296
|
-
|
|
27292
|
+
ColumnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27297
27293
|
displayName: "ColumnSortedAscendingIcon"
|
|
27298
27294
|
})),
|
|
27299
|
-
|
|
27295
|
+
ColumnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27300
27296
|
displayName: "ColumnSortedDescendingIcon"
|
|
27301
27297
|
})),
|
|
27302
|
-
|
|
27298
|
+
DensityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27303
27299
|
displayName: "DensityCompactIcon"
|
|
27304
27300
|
})),
|
|
27305
|
-
|
|
27301
|
+
DensityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27306
27302
|
displayName: "DensityStandardIcon"
|
|
27307
27303
|
})),
|
|
27308
|
-
|
|
27304
|
+
DensityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27309
27305
|
displayName: "DensityComfortableIcon"
|
|
27310
27306
|
})),
|
|
27311
|
-
|
|
27307
|
+
DetailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27312
27308
|
displayName: "DetailPanelCollapseIcon"
|
|
27313
27309
|
})),
|
|
27314
|
-
|
|
27310
|
+
DetailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27315
27311
|
displayName: "DetailPanelExpandIcon"
|
|
27316
27312
|
})),
|
|
27317
|
-
|
|
27313
|
+
ExportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27318
27314
|
displayName: "ExportIcon"
|
|
27319
27315
|
})),
|
|
27320
|
-
|
|
27316
|
+
OpenFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
|
|
27321
27317
|
displayName: "OpenFilterButtonIcon"
|
|
27322
27318
|
}, props))
|
|
27323
|
-
},
|
|
27324
|
-
|
|
27325
|
-
|
|
27319
|
+
}, components), {}, {
|
|
27320
|
+
Toolbar: ToolbarWrapper,
|
|
27321
|
+
Pagination: props => pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$1({}, props, {
|
|
27326
27322
|
displaySelection: false,
|
|
27327
27323
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
27328
27324
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
27329
27325
|
selectionStatus: selectionStatus.current,
|
|
27330
|
-
|
|
27331
|
-
|
|
27332
|
-
|
|
27326
|
+
page: page,
|
|
27327
|
+
onPageChange: onPageChange,
|
|
27328
|
+
pageSize: pageSize,
|
|
27329
|
+
onPageSizeChange: onPageSizeChange,
|
|
27330
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
27333
27331
|
paginationProps: paginationProps,
|
|
27334
27332
|
paginationMode: paginationMode,
|
|
27335
27333
|
rowCount: rowCount
|
|
@@ -27340,14 +27338,16 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27340
27338
|
selectionStatus: selectionStatus.current,
|
|
27341
27339
|
apiRef: apiRef,
|
|
27342
27340
|
isRowSelectable: isRowSelectable,
|
|
27343
|
-
|
|
27344
|
-
|
|
27345
|
-
|
|
27341
|
+
page: page,
|
|
27342
|
+
onPageChange: onPageChange,
|
|
27343
|
+
pageSize: pageSize,
|
|
27344
|
+
onPageSizeChange: onPageSizeChange,
|
|
27345
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
27346
27346
|
paginationProps: paginationProps,
|
|
27347
27347
|
paginationMode: paginationMode
|
|
27348
27348
|
})) : null
|
|
27349
27349
|
}),
|
|
27350
|
-
|
|
27350
|
+
componentsProps: _objectSpread2(_objectSpread2({}, componentsProps), {}, {
|
|
27351
27351
|
toolbar: _objectSpread2({
|
|
27352
27352
|
hideToolbar,
|
|
27353
27353
|
RenderedToolbar,
|
|
@@ -27358,13 +27358,15 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27358
27358
|
selectionStatus,
|
|
27359
27359
|
apiRef,
|
|
27360
27360
|
isRowSelectable,
|
|
27361
|
-
|
|
27362
|
-
|
|
27363
|
-
|
|
27361
|
+
page,
|
|
27362
|
+
onPageChange,
|
|
27363
|
+
pageSize,
|
|
27364
|
+
onPageSizeChange,
|
|
27365
|
+
rowsPerPageOptions,
|
|
27364
27366
|
paginationProps,
|
|
27365
27367
|
paginationMode,
|
|
27366
27368
|
rowCount
|
|
27367
|
-
},
|
|
27369
|
+
}, componentsProps === null || componentsProps === void 0 ? void 0 : componentsProps.toolbar)
|
|
27368
27370
|
}),
|
|
27369
27371
|
filterModel: filterModel,
|
|
27370
27372
|
columnVisibilityModel: columnVisibilityModel,
|
|
@@ -27380,11 +27382,13 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27380
27382
|
paginationMode: paginationMode,
|
|
27381
27383
|
keepNonExistentRowsSelected: paginationMode == 'server',
|
|
27382
27384
|
rows: rows,
|
|
27383
|
-
|
|
27384
|
-
|
|
27385
|
-
|
|
27386
|
-
|
|
27387
|
-
|
|
27385
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
27386
|
+
page: page,
|
|
27387
|
+
onPageChange: onPageChange,
|
|
27388
|
+
pageSize: pageSize,
|
|
27389
|
+
onPageSizeChange: onPageSizeChange,
|
|
27390
|
+
selectionModel: selectionModel,
|
|
27391
|
+
onSelectionModelChange: (newSelectionModel, details) => {
|
|
27388
27392
|
if (pagination && paginationMode != 'server') {
|
|
27389
27393
|
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
|
|
27390
27394
|
let {
|
|
@@ -27442,7 +27446,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27442
27446
|
};
|
|
27443
27447
|
}
|
|
27444
27448
|
}
|
|
27445
|
-
|
|
27449
|
+
onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(newSelectionModel, details);
|
|
27446
27450
|
},
|
|
27447
27451
|
sx: _objectSpread2(_objectSpread2({}, sx), {}, {
|
|
27448
27452
|
'.MuiDataGrid-columnHeaders': {
|
|
@@ -27459,6 +27463,8 @@ DataGrid.className = CLASSNAME$2;
|
|
|
27459
27463
|
DataGrid.displayName = COMPONENT_NAME$2;
|
|
27460
27464
|
|
|
27461
27465
|
// Get and Set data from LocalStorage WITHOUT useState
|
|
27466
|
+
|
|
27467
|
+
// triggering a state update and consecutive re-render
|
|
27462
27468
|
const useFetchState = (defaultValue, key) => {
|
|
27463
27469
|
let stickyValue = null;
|
|
27464
27470
|
try {
|
|
@@ -27466,7 +27472,16 @@ const useFetchState = (defaultValue, key) => {
|
|
|
27466
27472
|
} catch (e) {
|
|
27467
27473
|
console.error('StatefulDataGrid: error getting item from local storage: ', e);
|
|
27468
27474
|
}
|
|
27469
|
-
|
|
27475
|
+
let parsedValue = stickyValue !== null && stickyValue !== undefined && stickyValue !== 'undefined' ? JSON.parse(stickyValue) : defaultValue;
|
|
27476
|
+
|
|
27477
|
+
// TODO: temporary workaround to avoid clashes when someone had sorting on the now-removed screenshot field (renamed to num_annotations)
|
|
27478
|
+
// 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
|
|
27479
|
+
if (parsedValue instanceof Array) {
|
|
27480
|
+
const fields = (parsedValue || []).map(item => item.field);
|
|
27481
|
+
if (fields.includes('screenshot') || fields.includes('diffs')) {
|
|
27482
|
+
parsedValue = defaultValue;
|
|
27483
|
+
}
|
|
27484
|
+
}
|
|
27470
27485
|
const updateValue = useCallback(value => {
|
|
27471
27486
|
try {
|
|
27472
27487
|
window.localStorage.setItem(key, JSON.stringify(value));
|
|
@@ -27477,8 +27492,6 @@ const useFetchState = (defaultValue, key) => {
|
|
|
27477
27492
|
return [parsedValue, updateValue];
|
|
27478
27493
|
};
|
|
27479
27494
|
|
|
27480
|
-
// import useLocalStorage from './useLocalStorage';
|
|
27481
|
-
|
|
27482
27495
|
const useTableStates = (id, version) => {
|
|
27483
27496
|
const [paginationModel, setPaginationModel] = useFetchState('', buildStorageKey({
|
|
27484
27497
|
id,
|
|
@@ -27535,7 +27548,8 @@ const useStatefulTable = props => {
|
|
|
27535
27548
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
27536
27549
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
27537
27550
|
onFilterModelChange: propsOnFilterModelChange,
|
|
27538
|
-
|
|
27551
|
+
onPageChange: propsOnPageChange,
|
|
27552
|
+
onPageSizeChange: propsOnPageSizeChange,
|
|
27539
27553
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
27540
27554
|
onSortModelChange: propsOnSortModelChange,
|
|
27541
27555
|
useRouter,
|
|
@@ -27597,6 +27611,7 @@ const useStatefulTable = props => {
|
|
|
27597
27611
|
column.width = dimensionModel[column.field] || column.width || 100;
|
|
27598
27612
|
return column;
|
|
27599
27613
|
}), [propsColumns, dimensionModel]);
|
|
27614
|
+
|
|
27600
27615
|
/** Add resetPage method to apiRef. */
|
|
27601
27616
|
apiRef.current.resetPage = () => {
|
|
27602
27617
|
apiRef.current.setPage(0);
|
|
@@ -27607,7 +27622,7 @@ const useStatefulTable = props => {
|
|
|
27607
27622
|
onFilterModelChange: (model, details) => {
|
|
27608
27623
|
const filterModel = _objectSpread2(_objectSpread2({}, model), {}, {
|
|
27609
27624
|
items: model.items.map(item => {
|
|
27610
|
-
const column = apiRef.current.getColumn(item.
|
|
27625
|
+
const column = apiRef.current.getColumn(item.columnField);
|
|
27611
27626
|
item.type = column.type || 'string';
|
|
27612
27627
|
return item;
|
|
27613
27628
|
})
|
|
@@ -27644,16 +27659,33 @@ const useStatefulTable = props => {
|
|
|
27644
27659
|
}, search, historyReplace, columns);
|
|
27645
27660
|
},
|
|
27646
27661
|
pinnedColumns: pinnedColumnsModel,
|
|
27647
|
-
|
|
27648
|
-
|
|
27649
|
-
|
|
27650
|
-
|
|
27651
|
-
|
|
27652
|
-
|
|
27662
|
+
page: paginationModelParsed.page,
|
|
27663
|
+
pageSize: paginationModelParsed.pageSize,
|
|
27664
|
+
onPageChange: (page, details) => {
|
|
27665
|
+
const direction = paginationModelParsed.page < page ? 'next' : 'back';
|
|
27666
|
+
propsOnPageChange === null || propsOnPageChange === void 0 ? void 0 : propsOnPageChange(page, details);
|
|
27667
|
+
updateUrl({
|
|
27668
|
+
filterModel: filterParsed,
|
|
27669
|
+
sortModel: sortModelParsed,
|
|
27670
|
+
paginationModel: {
|
|
27671
|
+
page,
|
|
27672
|
+
pageSize: paginationModelParsed.pageSize,
|
|
27673
|
+
direction
|
|
27674
|
+
},
|
|
27675
|
+
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
27676
|
+
pinnedColumnsModel: pinnedColumnsModel
|
|
27677
|
+
}, search, historyReplace, columns);
|
|
27678
|
+
},
|
|
27679
|
+
onPageSizeChange: (pageSize, details) => {
|
|
27680
|
+
propsOnPageSizeChange === null || propsOnPageSizeChange === void 0 ? void 0 : propsOnPageSizeChange(pageSize, details);
|
|
27653
27681
|
updateUrl({
|
|
27654
27682
|
filterModel: filterParsed,
|
|
27655
27683
|
sortModel: sortModelParsed,
|
|
27656
|
-
paginationModel:
|
|
27684
|
+
paginationModel: {
|
|
27685
|
+
page: paginationModelParsed.page,
|
|
27686
|
+
pageSize,
|
|
27687
|
+
direction: paginationModelParsed.direction
|
|
27688
|
+
},
|
|
27657
27689
|
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
27658
27690
|
pinnedColumnsModel: pinnedColumnsModel
|
|
27659
27691
|
}, search, historyReplace, columns);
|
|
@@ -27679,7 +27711,7 @@ const useStatefulTable = props => {
|
|
|
27679
27711
|
};
|
|
27680
27712
|
};
|
|
27681
27713
|
|
|
27682
|
-
const _excluded$1 = ["apiRef", "autoHeight", "className", "columns", "
|
|
27714
|
+
const _excluded$1 = ["apiRef", "autoHeight", "className", "columns", "columnTypes", "components", "componentsProps", "filterModel", "columnVisibilityModel", "pinnedColumns", "sortModel", "page", "pageSize", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "localStorageVersion", "onFilterModelChange", "selectionModel", "onColumnWidthChange", "onPageChange", "onPageSizeChange", "onSelectionModelChange", "onColumnVisibilityModelChange", "onPinnedColumnsChange", "onSortModelChange", "pagination", "paginationPlacement", "paginationProps", "rows", "rowsPerPageOptions", "sx", "theme", "useRouter", "paginationMode", "rowCount"];
|
|
27683
27715
|
const COMPONENT_NAME$1 = 'DataGrid';
|
|
27684
27716
|
const CLASSNAME$1 = 'redsift-datagrid';
|
|
27685
27717
|
const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
@@ -27689,13 +27721,15 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27689
27721
|
autoHeight,
|
|
27690
27722
|
className,
|
|
27691
27723
|
columns,
|
|
27692
|
-
|
|
27693
|
-
|
|
27724
|
+
columnTypes: propsColumnTypes,
|
|
27725
|
+
components,
|
|
27726
|
+
componentsProps,
|
|
27694
27727
|
filterModel: propsFilterModel,
|
|
27695
27728
|
columnVisibilityModel: propsColumnVisibilityModel,
|
|
27696
27729
|
pinnedColumns: propsPinnedColumns,
|
|
27697
27730
|
sortModel: propsSortModel,
|
|
27698
|
-
|
|
27731
|
+
page: propsPage,
|
|
27732
|
+
pageSize: propsPageSize,
|
|
27699
27733
|
height: propsHeight,
|
|
27700
27734
|
hideToolbar,
|
|
27701
27735
|
initialState,
|
|
@@ -27703,10 +27737,11 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27703
27737
|
license = process.env.MUI_LICENSE_KEY,
|
|
27704
27738
|
localStorageVersion,
|
|
27705
27739
|
onFilterModelChange: propsOnFilterModelChange,
|
|
27706
|
-
|
|
27740
|
+
selectionModel: propsSelectionModel,
|
|
27707
27741
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
27708
|
-
|
|
27709
|
-
|
|
27742
|
+
onPageChange: propsOnPageChange,
|
|
27743
|
+
onPageSizeChange: propsOnPageSizeChange,
|
|
27744
|
+
onSelectionModelChange: propsOnSelectionModelChange,
|
|
27710
27745
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
27711
27746
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
27712
27747
|
onSortModelChange: propsOnSortModelChange,
|
|
@@ -27714,7 +27749,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27714
27749
|
paginationPlacement = 'both',
|
|
27715
27750
|
paginationProps,
|
|
27716
27751
|
rows,
|
|
27717
|
-
|
|
27752
|
+
rowsPerPageOptions,
|
|
27718
27753
|
sx,
|
|
27719
27754
|
theme: propsTheme,
|
|
27720
27755
|
useRouter,
|
|
@@ -27725,38 +27760,43 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27725
27760
|
const theme = useTheme$4(propsTheme);
|
|
27726
27761
|
const _apiRef = useGridApiRef();
|
|
27727
27762
|
const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
|
|
27728
|
-
const RenderedToolbar =
|
|
27763
|
+
const RenderedToolbar = components !== null && components !== void 0 && components.Toolbar ? components.Toolbar : Toolbar$2;
|
|
27729
27764
|
LicenseInfo.setLicenseKey(license);
|
|
27730
27765
|
const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
|
|
27731
27766
|
const {
|
|
27732
27767
|
onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
|
|
27733
27768
|
onFilterModelChange: controlledOnFilterModelChange,
|
|
27734
|
-
|
|
27769
|
+
onPageChange: controlledOnPageChange,
|
|
27770
|
+
onPageSizeChange: controlledOnPageSizeChange,
|
|
27735
27771
|
onPinnedColumnsChange: controlledOnPinnedColumnsChange,
|
|
27736
27772
|
onSortModelChange: controlledOnSortModelChange
|
|
27737
27773
|
} = useControlledDatagridState({
|
|
27738
27774
|
initialState,
|
|
27739
|
-
|
|
27775
|
+
rowsPerPageOptions,
|
|
27740
27776
|
propsColumnVisibilityModel,
|
|
27741
27777
|
propsFilterModel,
|
|
27742
27778
|
propsOnColumnVisibilityModelChange,
|
|
27743
27779
|
propsOnFilterModelChange,
|
|
27744
27780
|
propsOnPinnedColumnsChange,
|
|
27745
27781
|
propsOnSortModelChange,
|
|
27746
|
-
|
|
27782
|
+
propsPage,
|
|
27783
|
+
propsPageSize,
|
|
27747
27784
|
propsPinnedColumns,
|
|
27748
27785
|
propsSortModel,
|
|
27749
|
-
|
|
27786
|
+
propsOnPageChange,
|
|
27787
|
+
propsOnPageSizeChange
|
|
27750
27788
|
});
|
|
27751
27789
|
const {
|
|
27752
27790
|
columnVisibilityModel,
|
|
27753
27791
|
filterModel,
|
|
27754
27792
|
onColumnVisibilityModelChange,
|
|
27755
27793
|
onFilterModelChange,
|
|
27756
|
-
|
|
27794
|
+
onPageChange,
|
|
27795
|
+
onPageSizeChange,
|
|
27757
27796
|
onPinnedColumnsChange,
|
|
27758
27797
|
onSortModelChange,
|
|
27759
|
-
|
|
27798
|
+
page,
|
|
27799
|
+
pageSize,
|
|
27760
27800
|
pinnedColumns,
|
|
27761
27801
|
sortModel,
|
|
27762
27802
|
onColumnWidthChange
|
|
@@ -27767,38 +27807,39 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27767
27807
|
onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
|
|
27768
27808
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
27769
27809
|
onFilterModelChange: controlledOnFilterModelChange,
|
|
27770
|
-
|
|
27810
|
+
onPageChange: controlledOnPageChange,
|
|
27811
|
+
onPageSizeChange: controlledOnPageSizeChange,
|
|
27771
27812
|
onPinnedColumnsChange: controlledOnPinnedColumnsChange,
|
|
27772
27813
|
onSortModelChange: controlledOnSortModelChange,
|
|
27773
27814
|
useRouter: useRouter,
|
|
27774
27815
|
localStorageVersion
|
|
27775
27816
|
});
|
|
27776
|
-
const [
|
|
27817
|
+
const [selectionModel, setSelectionModel] = useState(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
|
|
27777
27818
|
useEffect(() => {
|
|
27778
|
-
|
|
27779
|
-
}, [
|
|
27780
|
-
const
|
|
27781
|
-
if (
|
|
27782
|
-
|
|
27819
|
+
setSelectionModel(propsSelectionModel !== null && propsSelectionModel !== void 0 ? propsSelectionModel : []);
|
|
27820
|
+
}, [propsSelectionModel]);
|
|
27821
|
+
const onSelectionModelChange = (selectionModel, details) => {
|
|
27822
|
+
if (propsOnSelectionModelChange) {
|
|
27823
|
+
propsOnSelectionModelChange(selectionModel, details);
|
|
27783
27824
|
} else {
|
|
27784
|
-
|
|
27825
|
+
setSelectionModel(selectionModel);
|
|
27785
27826
|
}
|
|
27786
27827
|
};
|
|
27787
27828
|
const selectionStatus = useRef({
|
|
27788
27829
|
type: 'none',
|
|
27789
27830
|
numberOfSelectedRows: 0,
|
|
27790
27831
|
numberOfSelectedRowsInPage: 0,
|
|
27791
|
-
page
|
|
27792
|
-
pageSize:
|
|
27832
|
+
page,
|
|
27833
|
+
pageSize: pageSize
|
|
27793
27834
|
});
|
|
27794
27835
|
|
|
27795
27836
|
// in server-side pagination we want to update the selection status
|
|
27796
27837
|
// every time we navigate between pages, resize our page or select something
|
|
27797
27838
|
useEffect(() => {
|
|
27798
27839
|
if (paginationMode == 'server') {
|
|
27799
|
-
onServerSideSelectionStatusChange(Array.isArray(
|
|
27840
|
+
onServerSideSelectionStatusChange(Array.isArray(selectionModel) ? selectionModel : [selectionModel], apiRef, selectionStatus, isRowSelectable, page, pageSize);
|
|
27800
27841
|
}
|
|
27801
|
-
}, [
|
|
27842
|
+
}, [selectionModel, page, pageSize]);
|
|
27802
27843
|
if (!Array.isArray(rows)) {
|
|
27803
27844
|
return null;
|
|
27804
27845
|
}
|
|
@@ -27831,13 +27872,15 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27831
27872
|
filterModel: filterModel,
|
|
27832
27873
|
onColumnVisibilityModelChange: onColumnVisibilityModelChange,
|
|
27833
27874
|
onFilterModelChange: onFilterModelChange,
|
|
27834
|
-
|
|
27875
|
+
onPageChange: onPageChange,
|
|
27876
|
+
onPageSizeChange: onPageSizeChange,
|
|
27835
27877
|
onPinnedColumnsChange: onPinnedColumnsChange,
|
|
27836
27878
|
onSortModelChange: onSortModelChange,
|
|
27837
|
-
|
|
27879
|
+
page: page,
|
|
27880
|
+
pageSize: pageSize,
|
|
27838
27881
|
pinnedColumns: pinnedColumns,
|
|
27839
27882
|
sortModel: sortModel,
|
|
27840
|
-
|
|
27883
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
27841
27884
|
onColumnWidthChange: onColumnWidthChange,
|
|
27842
27885
|
initialState: initialState,
|
|
27843
27886
|
isRowSelectable: isRowSelectable,
|
|
@@ -27848,55 +27891,58 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27848
27891
|
rowCount: rowCount,
|
|
27849
27892
|
autoHeight: autoHeight,
|
|
27850
27893
|
checkboxSelectionVisibleOnly: Boolean(pagination),
|
|
27851
|
-
|
|
27852
|
-
|
|
27853
|
-
|
|
27854
|
-
|
|
27855
|
-
|
|
27856
|
-
|
|
27894
|
+
columnTypes: _objectSpread2(_objectSpread2({}, customColumnTypes), propsColumnTypes),
|
|
27895
|
+
components: _objectSpread2(_objectSpread2({
|
|
27896
|
+
BaseButton,
|
|
27897
|
+
BaseCheckbox,
|
|
27898
|
+
// BaseTextField,
|
|
27899
|
+
BasePopper,
|
|
27900
|
+
ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27857
27901
|
displayName: "ColumnFilteredIcon"
|
|
27858
27902
|
})),
|
|
27859
|
-
|
|
27903
|
+
ColumnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27860
27904
|
displayName: "ColumnSelectorIcon"
|
|
27861
27905
|
})),
|
|
27862
|
-
|
|
27906
|
+
ColumnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27863
27907
|
displayName: "ColumnSortedAscendingIcon"
|
|
27864
27908
|
})),
|
|
27865
|
-
|
|
27909
|
+
ColumnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27866
27910
|
displayName: "ColumnSortedDescendingIcon"
|
|
27867
27911
|
})),
|
|
27868
|
-
|
|
27912
|
+
DensityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27869
27913
|
displayName: "DensityCompactIcon"
|
|
27870
27914
|
})),
|
|
27871
|
-
|
|
27915
|
+
DensityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27872
27916
|
displayName: "DensityStandardIcon"
|
|
27873
27917
|
})),
|
|
27874
|
-
|
|
27918
|
+
DensityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27875
27919
|
displayName: "DensityComfortableIcon"
|
|
27876
27920
|
})),
|
|
27877
|
-
|
|
27921
|
+
DetailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27878
27922
|
displayName: "DetailPanelCollapseIcon"
|
|
27879
27923
|
})),
|
|
27880
|
-
|
|
27924
|
+
DetailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27881
27925
|
displayName: "DetailPanelExpandIcon"
|
|
27882
27926
|
})),
|
|
27883
|
-
|
|
27927
|
+
ExportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27884
27928
|
displayName: "ExportIcon"
|
|
27885
27929
|
})),
|
|
27886
|
-
|
|
27930
|
+
OpenFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
|
|
27887
27931
|
displayName: "OpenFilterButtonIcon"
|
|
27888
27932
|
}, props))
|
|
27889
|
-
},
|
|
27890
|
-
|
|
27891
|
-
|
|
27933
|
+
}, components), {}, {
|
|
27934
|
+
Toolbar: ToolbarWrapper,
|
|
27935
|
+
Pagination: props => {
|
|
27892
27936
|
return pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$1({}, props, {
|
|
27893
27937
|
displaySelection: false,
|
|
27894
27938
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
27895
27939
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
27896
27940
|
selectionStatus: selectionStatus.current,
|
|
27897
|
-
|
|
27898
|
-
|
|
27899
|
-
|
|
27941
|
+
page: page,
|
|
27942
|
+
pageSize: pageSize,
|
|
27943
|
+
onPageChange: onPageChange,
|
|
27944
|
+
onPageSizeChange: onPageSizeChange,
|
|
27945
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
27900
27946
|
paginationProps: paginationProps,
|
|
27901
27947
|
paginationMode: paginationMode,
|
|
27902
27948
|
rowCount: rowCount
|
|
@@ -27907,15 +27953,17 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27907
27953
|
selectionStatus: selectionStatus.current,
|
|
27908
27954
|
apiRef: apiRef,
|
|
27909
27955
|
isRowSelectable: isRowSelectable,
|
|
27910
|
-
|
|
27911
|
-
|
|
27912
|
-
|
|
27956
|
+
page: page,
|
|
27957
|
+
pageSize: pageSize,
|
|
27958
|
+
onPageChange: onPageChange,
|
|
27959
|
+
onPageSizeChange: onPageSizeChange,
|
|
27960
|
+
rowsPerPageOptions: rowsPerPageOptions,
|
|
27913
27961
|
paginationProps: paginationProps,
|
|
27914
27962
|
paginationMode: paginationMode
|
|
27915
27963
|
})) : null;
|
|
27916
27964
|
}
|
|
27917
27965
|
}),
|
|
27918
|
-
|
|
27966
|
+
componentsProps: _objectSpread2(_objectSpread2({}, componentsProps), {}, {
|
|
27919
27967
|
toolbar: _objectSpread2({
|
|
27920
27968
|
hideToolbar,
|
|
27921
27969
|
RenderedToolbar,
|
|
@@ -27926,16 +27974,18 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27926
27974
|
selectionStatus,
|
|
27927
27975
|
apiRef,
|
|
27928
27976
|
isRowSelectable,
|
|
27929
|
-
|
|
27930
|
-
|
|
27931
|
-
|
|
27977
|
+
page,
|
|
27978
|
+
pageSize,
|
|
27979
|
+
onPageChange,
|
|
27980
|
+
onPageSizeChange,
|
|
27981
|
+
rowsPerPageOptions,
|
|
27932
27982
|
paginationProps,
|
|
27933
27983
|
paginationMode,
|
|
27934
27984
|
rowCount
|
|
27935
|
-
},
|
|
27985
|
+
}, componentsProps === null || componentsProps === void 0 ? void 0 : componentsProps.toolbar)
|
|
27936
27986
|
}),
|
|
27937
|
-
|
|
27938
|
-
|
|
27987
|
+
selectionModel: selectionModel,
|
|
27988
|
+
onSelectionModelChange: (newSelectionModel, details) => {
|
|
27939
27989
|
if (pagination && paginationMode != 'server') {
|
|
27940
27990
|
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
|
|
27941
27991
|
let {
|
|
@@ -27993,7 +28043,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27993
28043
|
};
|
|
27994
28044
|
}
|
|
27995
28045
|
}
|
|
27996
|
-
|
|
28046
|
+
onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(newSelectionModel, details);
|
|
27997
28047
|
},
|
|
27998
28048
|
sx: _objectSpread2(_objectSpread2({}, sx), {}, {
|
|
27999
28049
|
'.MuiDataGrid-columnHeaders': {
|
|
@@ -28067,5 +28117,5 @@ const TextCell = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
28067
28117
|
TextCell.className = CLASSNAME;
|
|
28068
28118
|
TextCell.displayName = COMPONENT_NAME;
|
|
28069
28119
|
|
|
28070
|
-
export { BaseButton, BaseCheckbox, BaseIcon, BasePopper, BaseTextField, CATEGORIES, CONTAINS_ANY_OF, CONTAINS_ANY_OF_I, ControlledPagination, DEFAULT_OPERATORS, DETAIL_PANEL_TOGGLE_COL_DEF, DIMENSION_MODEL_KEY, DOES_NOT_CONTAIN, DOES_NOT_EQUAL, DataGrid, ENDS_WITH_ANY_OF, FILTER_MODEL_KEY, FILTER_SEARCH_KEY, GridToolbarFilterSemanticField, IS_ANY_OF, IS_BETWEEN, IS_NOT_ANY_OF, PAGINATION_MODEL_KEY, PINNED_COLUMNS, SORT_MODEL_KEY, STARTS_WITH_ANY_OF, ServerSideControlledPagination, StatefulDataGrid, TextCell, Toolbar$2 as Toolbar, ToolbarWrapper, VISIBILITY_MODEL_KEY, areFilterModelsEquivalent, buildStorageKey, clearPreviousVersionStorage, customColumnTypes, decodeValue, encodeValue, getColumnVisibilityFromString, getCompletion, getFilterModelFromString, getFinalSearch, getGridNumericOperators, getGridStringArrayOperators, getGridStringOperators, getModelsParsedOrUpdateLocalStorage, getPaginationFromString, getPinnedColumnsFromString, getRsNumberColumnType, getRsStringColumnType, getSearchParamsFromColumnVisibility, getSearchParamsFromFilterModel, getSearchParamsFromPagination, getSearchParamsFromPinnedColumns, getSearchParamsFromSorting, getSearchParamsFromTab, getSortingFromString,
|
|
28120
|
+
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 };
|
|
28071
28121
|
//# sourceMappingURL=index.js.map
|