@redsift/table 11.3.1-muiv5 → 11.3.2-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +191 -33
- package/index.js +480 -412
- 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, GridFilterInputSingleSelect, GridFilterInputMultipleValue, GridFilterInputMultipleSingleSelect, getGridStringOperators as getGridStringOperators$1, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators, GridLogicOperator, GridToolbarContainer, GridToolbarFilterButton, GridToolbarColumnsButton, GridToolbarDensitySelector, GridToolbarExport, gridExpandedSortedRowIdsSelector, GridToolbarQuickFilter, gridPaginatedVisibleSortedGridRowEntriesSelector, gridPaginatedVisibleSortedGridRowIdsSelector, gridFilteredSortedRowEntriesSelector, gridFilteredSortedRowIdsSelector, useGridApiRef, DataGridPro } from '@mui/x-data-grid-pro';
|
|
2
2
|
export { getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators } from '@mui/x-data-grid-pro';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import React__default, { Children, isValidElement, cloneElement, forwardRef, useLayoutEffect, useEffect, useRef, useContext, useState, useCallback, createElement, useMemo } from 'react';
|
|
@@ -17639,7 +17639,7 @@ const isBetweenOperator = {
|
|
|
17639
17639
|
label: 'is between',
|
|
17640
17640
|
value: 'isBetween',
|
|
17641
17641
|
getApplyFilterFn: filterItem => {
|
|
17642
|
-
if (!filterItem.
|
|
17642
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
17643
17643
|
return null;
|
|
17644
17644
|
}
|
|
17645
17645
|
if (!Array.isArray(filterItem.value) || filterItem.value.length !== 2) {
|
|
@@ -17652,7 +17652,7 @@ const isBetweenOperator = {
|
|
|
17652
17652
|
return null;
|
|
17653
17653
|
}
|
|
17654
17654
|
return params => {
|
|
17655
|
-
return params.value !== null && filterItem.value[0] <= params.value && params.value <= filterItem.value[1];
|
|
17655
|
+
return params.value !== null && params.value !== undefined && filterItem.value[0] <= params.value && params.value <= filterItem.value[1];
|
|
17656
17656
|
};
|
|
17657
17657
|
},
|
|
17658
17658
|
InputComponent: InputNumberInterval
|
|
@@ -17661,18 +17661,18 @@ const IS_BETWEEN = isBetweenOperator;
|
|
|
17661
17661
|
|
|
17662
17662
|
const getGridNumericOperators = () => [...getGridNumericOperators$1(), IS_BETWEEN];
|
|
17663
17663
|
|
|
17664
|
-
const
|
|
17665
|
-
label: 'does not
|
|
17666
|
-
value: '
|
|
17664
|
+
const doesNotContain = {
|
|
17665
|
+
label: 'does not contain',
|
|
17666
|
+
value: 'doesNotContain',
|
|
17667
17667
|
getApplyFilterFn: filterItem => {
|
|
17668
|
-
if (!filterItem.
|
|
17668
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
17669
17669
|
return null;
|
|
17670
17670
|
}
|
|
17671
17671
|
return params => {
|
|
17672
17672
|
if (filterItem.value.length === 0) {
|
|
17673
17673
|
return true;
|
|
17674
17674
|
}
|
|
17675
|
-
if (params.value
|
|
17675
|
+
if (params.value.indexOf(filterItem.value) !== -1) {
|
|
17676
17676
|
return false;
|
|
17677
17677
|
}
|
|
17678
17678
|
return true;
|
|
@@ -17680,20 +17680,20 @@ const doesNotEqual = {
|
|
|
17680
17680
|
},
|
|
17681
17681
|
InputComponent: GridFilterInputValue
|
|
17682
17682
|
};
|
|
17683
|
-
const
|
|
17683
|
+
const DOES_NOT_CONTAIN = doesNotContain;
|
|
17684
17684
|
|
|
17685
|
-
const
|
|
17686
|
-
label: 'does not
|
|
17687
|
-
value: '
|
|
17685
|
+
const doesNotEqual = {
|
|
17686
|
+
label: 'does not equal',
|
|
17687
|
+
value: 'doesNotEqual',
|
|
17688
17688
|
getApplyFilterFn: filterItem => {
|
|
17689
|
-
if (!filterItem.
|
|
17689
|
+
if (!filterItem.field || !filterItem.value || !filterItem.value) {
|
|
17690
17690
|
return null;
|
|
17691
17691
|
}
|
|
17692
17692
|
return params => {
|
|
17693
17693
|
if (filterItem.value.length === 0) {
|
|
17694
17694
|
return true;
|
|
17695
17695
|
}
|
|
17696
|
-
if (params.value
|
|
17696
|
+
if (params.value === filterItem.value) {
|
|
17697
17697
|
return false;
|
|
17698
17698
|
}
|
|
17699
17699
|
return true;
|
|
@@ -17701,13 +17701,108 @@ const doesNotContain = {
|
|
|
17701
17701
|
},
|
|
17702
17702
|
InputComponent: GridFilterInputValue
|
|
17703
17703
|
};
|
|
17704
|
-
const
|
|
17704
|
+
const DOES_NOT_EQUAL = doesNotEqual;
|
|
17705
|
+
|
|
17706
|
+
const doesNotHaveOperator = {
|
|
17707
|
+
label: "doesn't have",
|
|
17708
|
+
value: 'doesNotHave',
|
|
17709
|
+
getApplyFilterFn: filterItem => {
|
|
17710
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
17711
|
+
return null;
|
|
17712
|
+
}
|
|
17713
|
+
return params => {
|
|
17714
|
+
const cellValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
17715
|
+
return !cellValues.includes(filterItem.value);
|
|
17716
|
+
};
|
|
17717
|
+
},
|
|
17718
|
+
InputComponent: GridFilterInputValue
|
|
17719
|
+
};
|
|
17720
|
+
const DOES_NOT_HAVE = doesNotHaveOperator;
|
|
17721
|
+
const DOES_NOT_HAVE_WITH_SELECT = _objectSpread2(_objectSpread2({}, DOES_NOT_HAVE), {}, {
|
|
17722
|
+
InputComponent: GridFilterInputSingleSelect
|
|
17723
|
+
});
|
|
17724
|
+
|
|
17725
|
+
const hasOperator = {
|
|
17726
|
+
label: 'has',
|
|
17727
|
+
value: 'has',
|
|
17728
|
+
getApplyFilterFn: filterItem => {
|
|
17729
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
17730
|
+
return null;
|
|
17731
|
+
}
|
|
17732
|
+
return params => {
|
|
17733
|
+
const cellValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
17734
|
+
return cellValues.includes(filterItem.value);
|
|
17735
|
+
};
|
|
17736
|
+
},
|
|
17737
|
+
InputComponent: GridFilterInputValue
|
|
17738
|
+
};
|
|
17739
|
+
const HAS = hasOperator;
|
|
17740
|
+
const HAS_WITH_SELECT = _objectSpread2(_objectSpread2({}, HAS), {}, {
|
|
17741
|
+
InputComponent: GridFilterInputSingleSelect
|
|
17742
|
+
});
|
|
17743
|
+
|
|
17744
|
+
const hasOnlyOperator = {
|
|
17745
|
+
label: 'has only',
|
|
17746
|
+
value: 'hasOnly',
|
|
17747
|
+
getApplyFilterFn: filterItem => {
|
|
17748
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
17749
|
+
return null;
|
|
17750
|
+
}
|
|
17751
|
+
return params => {
|
|
17752
|
+
const cellValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
17753
|
+
return cellValues.length === 1 && cellValues[0] === filterItem.value;
|
|
17754
|
+
};
|
|
17755
|
+
},
|
|
17756
|
+
InputComponent: GridFilterInputValue
|
|
17757
|
+
};
|
|
17758
|
+
const HAS_ONLY = hasOnlyOperator;
|
|
17759
|
+
const HAS_ONLY_WITH_SELECT = _objectSpread2(_objectSpread2({}, HAS_ONLY), {}, {
|
|
17760
|
+
InputComponent: GridFilterInputSingleSelect
|
|
17761
|
+
});
|
|
17762
|
+
|
|
17763
|
+
const isOperator = {
|
|
17764
|
+
label: 'is',
|
|
17765
|
+
value: 'is',
|
|
17766
|
+
getApplyFilterFn: filterItem => {
|
|
17767
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
17768
|
+
return null;
|
|
17769
|
+
}
|
|
17770
|
+
return params => {
|
|
17771
|
+
const paramValue = params.value;
|
|
17772
|
+
return paramValue === filterItem.value;
|
|
17773
|
+
};
|
|
17774
|
+
},
|
|
17775
|
+
InputComponent: GridFilterInputValue
|
|
17776
|
+
};
|
|
17777
|
+
const IS = isOperator;
|
|
17778
|
+
const IS_WITH_SELECT = _objectSpread2(_objectSpread2({}, IS), {}, {
|
|
17779
|
+
InputComponent: GridFilterInputSingleSelect
|
|
17780
|
+
});
|
|
17781
|
+
|
|
17782
|
+
const isNotOperator = {
|
|
17783
|
+
label: 'is not',
|
|
17784
|
+
value: 'isNot',
|
|
17785
|
+
getApplyFilterFn: filterItem => {
|
|
17786
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
17787
|
+
return null;
|
|
17788
|
+
}
|
|
17789
|
+
return params => {
|
|
17790
|
+
const paramValue = params.value;
|
|
17791
|
+
return paramValue !== filterItem.value;
|
|
17792
|
+
};
|
|
17793
|
+
},
|
|
17794
|
+
InputComponent: GridFilterInputValue
|
|
17795
|
+
};
|
|
17796
|
+
const IS_NOT = isNotOperator;
|
|
17797
|
+
const IS_NOT_WITH_SELECT = _objectSpread2(_objectSpread2({}, IS_NOT), {}, {
|
|
17798
|
+
InputComponent: GridFilterInputSingleSelect
|
|
17799
|
+
});
|
|
17705
17800
|
|
|
17706
17801
|
const containsAnyOfOperator = {
|
|
17707
17802
|
label: 'contains any of',
|
|
17708
17803
|
value: 'containsAnyOf',
|
|
17709
17804
|
getApplyFilterFn: filterItem => {
|
|
17710
|
-
if (!filterItem.
|
|
17805
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
17711
17806
|
return null;
|
|
17712
17807
|
}
|
|
17713
17808
|
return params => {
|
|
@@ -17730,7 +17825,7 @@ const containsAnyOfCIOperator = {
|
|
|
17730
17825
|
label: 'contains any of (case insensitive)',
|
|
17731
17826
|
value: 'containsAnyOf',
|
|
17732
17827
|
getApplyFilterFn: filterItem => {
|
|
17733
|
-
if (!filterItem.
|
|
17828
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
17734
17829
|
return null;
|
|
17735
17830
|
}
|
|
17736
17831
|
return params => {
|
|
@@ -17757,7 +17852,7 @@ const endsWithAnyOfOperator = {
|
|
|
17757
17852
|
label: 'ends with any of',
|
|
17758
17853
|
value: 'endsWithAnyOf',
|
|
17759
17854
|
getApplyFilterFn: filterItem => {
|
|
17760
|
-
if (!filterItem.
|
|
17855
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
17761
17856
|
return null;
|
|
17762
17857
|
}
|
|
17763
17858
|
return params => {
|
|
@@ -17784,7 +17879,7 @@ const isAnyOfOperator = {
|
|
|
17784
17879
|
label: 'is any of',
|
|
17785
17880
|
value: 'isAnyOf',
|
|
17786
17881
|
getApplyFilterFn: filterItem => {
|
|
17787
|
-
if (!filterItem.
|
|
17882
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
17788
17883
|
return null;
|
|
17789
17884
|
}
|
|
17790
17885
|
return params => {
|
|
@@ -17803,12 +17898,38 @@ const isAnyOfOperator = {
|
|
|
17803
17898
|
InputComponent: GridFilterInputMultipleValue
|
|
17804
17899
|
};
|
|
17805
17900
|
const IS_ANY_OF = isAnyOfOperator;
|
|
17901
|
+
const IS_ANY_OF_WITH_SELECT = _objectSpread2(_objectSpread2({}, IS_ANY_OF), {}, {
|
|
17902
|
+
InputComponent: GridFilterInputMultipleSingleSelect
|
|
17903
|
+
});
|
|
17904
|
+
|
|
17905
|
+
const hasAnyOfOperator = {
|
|
17906
|
+
label: 'has any of',
|
|
17907
|
+
value: 'hasAnyOf',
|
|
17908
|
+
getApplyFilterFn: filterItem => {
|
|
17909
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
17910
|
+
return null;
|
|
17911
|
+
}
|
|
17912
|
+
return params => {
|
|
17913
|
+
if (filterItem.value.length === 0) {
|
|
17914
|
+
return true;
|
|
17915
|
+
}
|
|
17916
|
+
const cellValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
17917
|
+
const filterItemValues = Array.isArray(filterItem.value) ? filterItem.value : [filterItem.value];
|
|
17918
|
+
return filterItemValues.some(v => cellValues.includes(v));
|
|
17919
|
+
};
|
|
17920
|
+
},
|
|
17921
|
+
InputComponent: GridFilterInputMultipleValue
|
|
17922
|
+
};
|
|
17923
|
+
const HAS_ANY_OF = hasAnyOfOperator;
|
|
17924
|
+
const HAS_ANY_OF_WITH_SELECT = _objectSpread2(_objectSpread2({}, HAS_ANY_OF), {}, {
|
|
17925
|
+
InputComponent: GridFilterInputMultipleSingleSelect
|
|
17926
|
+
});
|
|
17806
17927
|
|
|
17807
17928
|
const isNotAnyOfOperator = {
|
|
17808
17929
|
label: 'is not any of',
|
|
17809
17930
|
value: 'isNotAnyOf',
|
|
17810
17931
|
getApplyFilterFn: filterItem => {
|
|
17811
|
-
if (!filterItem.
|
|
17932
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
17812
17933
|
return null;
|
|
17813
17934
|
}
|
|
17814
17935
|
return params => {
|
|
@@ -17827,12 +17948,15 @@ const isNotAnyOfOperator = {
|
|
|
17827
17948
|
InputComponent: GridFilterInputMultipleValue
|
|
17828
17949
|
};
|
|
17829
17950
|
const IS_NOT_ANY_OF = isNotAnyOfOperator;
|
|
17951
|
+
const IS_NOT_ANY_OF_WITH_SELECT = _objectSpread2(_objectSpread2({}, IS_NOT_ANY_OF), {}, {
|
|
17952
|
+
InputComponent: GridFilterInputMultipleSingleSelect
|
|
17953
|
+
});
|
|
17830
17954
|
|
|
17831
17955
|
const startsWithAnyOfOperator = {
|
|
17832
17956
|
label: 'starts with any of',
|
|
17833
17957
|
value: 'startsWithAnyOf',
|
|
17834
17958
|
getApplyFilterFn: filterItem => {
|
|
17835
|
-
if (!filterItem.
|
|
17959
|
+
if (!filterItem.field || !filterItem.value || !filterItem.operator) {
|
|
17836
17960
|
return null;
|
|
17837
17961
|
}
|
|
17838
17962
|
return params => {
|
|
@@ -17855,7 +17979,30 @@ const startsWithAnyOfOperator = {
|
|
|
17855
17979
|
};
|
|
17856
17980
|
const STARTS_WITH_ANY_OF = startsWithAnyOfOperator;
|
|
17857
17981
|
|
|
17982
|
+
const doesNotHaveAnyOf = {
|
|
17983
|
+
label: "doesn't have any of",
|
|
17984
|
+
value: 'doesNotHaveAnyOf',
|
|
17985
|
+
getApplyFilterFn: filterItem => {
|
|
17986
|
+
if (!filterItem.field || !filterItem.value || !Array.isArray(filterItem.value) || filterItem.value.length === 0) {
|
|
17987
|
+
return null;
|
|
17988
|
+
}
|
|
17989
|
+
return params => {
|
|
17990
|
+
const cellValues = Array.isArray(params.value) ? params.value : [params.value];
|
|
17991
|
+
|
|
17992
|
+
// Return true only if none of the filter values are in the cell values
|
|
17993
|
+
return filterItem.value.every(filterVal => !cellValues.includes(filterVal));
|
|
17994
|
+
};
|
|
17995
|
+
},
|
|
17996
|
+
InputComponent: GridFilterInputMultipleValue
|
|
17997
|
+
};
|
|
17998
|
+
const DOES_NOT_HAVE_ANY_OF = doesNotHaveAnyOf;
|
|
17999
|
+
const DOES_NOT_HAVE_ANY_OF_WITH_SELECT = _objectSpread2(_objectSpread2({}, DOES_NOT_HAVE_ANY_OF), {}, {
|
|
18000
|
+
InputComponent: GridFilterInputMultipleSingleSelect
|
|
18001
|
+
});
|
|
18002
|
+
|
|
17858
18003
|
const getGridStringArrayOperators = () => [CONTAINS_ANY_OF, ENDS_WITH_ANY_OF, IS_ANY_OF, IS_NOT_ANY_OF, STARTS_WITH_ANY_OF];
|
|
18004
|
+
const getGridStringArrayOperatorsWithSelect = () => [CONTAINS_ANY_OF, ENDS_WITH_ANY_OF, IS_ANY_OF_WITH_SELECT, IS_ANY_OF_WITH_SELECT, IS_NOT_WITH_SELECT, IS_WITH_SELECT, STARTS_WITH_ANY_OF];
|
|
18005
|
+
const getGridStringArrayOperatorsWithSelectOnStringArrayColumns = () => [HAS_WITH_SELECT, HAS_ANY_OF_WITH_SELECT, HAS_ONLY_WITH_SELECT, DOES_NOT_HAVE_WITH_SELECT, DOES_NOT_HAVE_ANY_OF_WITH_SELECT];
|
|
17859
18006
|
|
|
17860
18007
|
const getGridStringOperators = () => [...getGridStringOperators$1().filter(operator => !['isAnyOf'].includes(operator.value)), DOES_NOT_CONTAIN, DOES_NOT_EQUAL, ...getGridStringArrayOperators()];
|
|
17861
18008
|
|
|
@@ -17871,30 +18018,62 @@ const operatorList = {
|
|
|
17871
18018
|
// Extended types
|
|
17872
18019
|
rsString: getGridStringOperators(),
|
|
17873
18020
|
rsNumber: getGridNumericOperators(),
|
|
18021
|
+
rsSingleSelect: getGridStringArrayOperatorsWithSelect(),
|
|
18022
|
+
rsSingleSelectWithShortOperatorList: [IS_WITH_SELECT, IS_NOT_WITH_SELECT, IS_ANY_OF_WITH_SELECT],
|
|
18023
|
+
rsMultipleSelect: getGridStringArrayOperatorsWithSelectOnStringArrayColumns(),
|
|
18024
|
+
rsMultipleSelectWithShortOperatorList: [HAS_WITH_SELECT, DOES_NOT_HAVE_WITH_SELECT, HAS_ANY_OF_WITH_SELECT],
|
|
17874
18025
|
// Custom types
|
|
17875
18026
|
rsStringArray: getGridStringArrayOperators()
|
|
17876
18027
|
};
|
|
17877
18028
|
|
|
17878
18029
|
const getRsStringColumnType = () => {
|
|
17879
18030
|
return {
|
|
17880
|
-
|
|
18031
|
+
type: 'string',
|
|
17881
18032
|
filterOperators: operatorList.rsString
|
|
17882
18033
|
};
|
|
17883
18034
|
};
|
|
17884
18035
|
const getRsNumberColumnType = () => {
|
|
17885
18036
|
return {
|
|
17886
|
-
|
|
18037
|
+
type: 'number',
|
|
17887
18038
|
filterOperators: operatorList.rsNumber
|
|
17888
18039
|
};
|
|
17889
18040
|
};
|
|
18041
|
+
const getRsSingleSelectColumnType = () => {
|
|
18042
|
+
return {
|
|
18043
|
+
type: 'singleSelect',
|
|
18044
|
+
filterOperators: operatorList.rsSingleSelect
|
|
18045
|
+
};
|
|
18046
|
+
};
|
|
18047
|
+
const getRsSingleSelectWithShortOperatorListColumnType = () => {
|
|
18048
|
+
return {
|
|
18049
|
+
type: 'singleSelect',
|
|
18050
|
+
filterOperators: operatorList.rsSingleSelectWithShortOperatorList
|
|
18051
|
+
};
|
|
18052
|
+
};
|
|
18053
|
+
const getRsMultipleSelectColumnType = () => {
|
|
18054
|
+
return {
|
|
18055
|
+
type: 'singleSelect',
|
|
18056
|
+
filterOperators: operatorList.rsMultipleSelect
|
|
18057
|
+
};
|
|
18058
|
+
};
|
|
18059
|
+
const getRsMultipleSelectWithShortOperatorListColumnType = () => {
|
|
18060
|
+
return {
|
|
18061
|
+
type: 'singleSelect',
|
|
18062
|
+
filterOperators: operatorList.rsMultipleSelectWithShortOperatorList
|
|
18063
|
+
};
|
|
18064
|
+
};
|
|
17890
18065
|
const customColumnTypes = {
|
|
17891
18066
|
rsString: getRsStringColumnType(),
|
|
17892
|
-
rsNumber: getRsNumberColumnType()
|
|
18067
|
+
rsNumber: getRsNumberColumnType(),
|
|
18068
|
+
rsSingleSelect: getRsSingleSelectColumnType(),
|
|
18069
|
+
rsSingleSelectWithShortOperatorList: getRsSingleSelectWithShortOperatorListColumnType(),
|
|
18070
|
+
rsMultipleSelect: getRsMultipleSelectColumnType(),
|
|
18071
|
+
rsMultipleSelectWithShortOperatorList: getRsMultipleSelectWithShortOperatorListColumnType()
|
|
17893
18072
|
};
|
|
17894
18073
|
|
|
17895
18074
|
const API_URL = 'https://api.openai.com/v1/chat/completions';
|
|
17896
18075
|
async function getCompletion(text, role, openai_api_key) {
|
|
17897
|
-
let model = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'gpt-3.5-turbo-
|
|
18076
|
+
let model = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'gpt-3.5-turbo-1106';
|
|
17898
18077
|
try {
|
|
17899
18078
|
const messages = [{
|
|
17900
18079
|
role: 'system',
|
|
@@ -18061,42 +18240,39 @@ const numberOperatorDecoder = {
|
|
|
18061
18240
|
lt: '<',
|
|
18062
18241
|
lte: '<='
|
|
18063
18242
|
};
|
|
18064
|
-
const isOperatorValueValid = (
|
|
18065
|
-
const column = columns.find(column => column.field ===
|
|
18243
|
+
const isOperatorValueValid = (field, operator, columns) => {
|
|
18244
|
+
const column = columns.find(column => column.field === field);
|
|
18066
18245
|
if (!column) {
|
|
18067
18246
|
return false;
|
|
18068
18247
|
}
|
|
18069
18248
|
const columnType = (column === null || column === void 0 ? void 0 : column.type) || 'string';
|
|
18070
|
-
const operators = operatorList[columnType];
|
|
18249
|
+
const operators = column.filterOperators || operatorList[columnType];
|
|
18071
18250
|
if (!operators) {
|
|
18072
18251
|
return false;
|
|
18073
18252
|
}
|
|
18074
|
-
|
|
18075
|
-
return !!operators.filterOperators.find(op => columnType === 'number' && Object.keys(numberOperatorEncoder).includes(op.value) ? numberOperatorEncoder[op.value] === operatorValue : op['value'] === operatorValue);
|
|
18076
|
-
}
|
|
18077
|
-
return !!operators.find(op => ['number', 'rsNumber'].includes(columnType) && Object.keys(numberOperatorEncoder).includes(op.value) ? numberOperatorEncoder[op.value] === operatorValue : op['value'] === operatorValue);
|
|
18253
|
+
return !!operators.find(op => columnType === 'number' && Object.keys(numberOperatorEncoder).includes(op.value) ? numberOperatorEncoder[op.value] === operator : op.value === operator);
|
|
18078
18254
|
};
|
|
18079
|
-
const listOperators = ['containsAnyOf', 'endsWithAnyOf', 'isAnyOf', 'isNotAnyOf', 'startsWithAnyOf'];
|
|
18255
|
+
const listOperators = ['containsAnyOf', 'doesNotContainAnyOf', 'endsWithAnyOf', 'doesNotEndWithAnyOf', 'hasAnyOf', 'doesNotHaveAnyOf', 'isAnyOf', 'isNotAnyOf', 'startsWithAnyOf', 'doesNotStartWithAnyOf'];
|
|
18080
18256
|
|
|
18081
18257
|
// Check if the value doesn't break
|
|
18082
|
-
const isValueValid = (value,
|
|
18258
|
+
const isValueValid = (value, field, columns, operator) => {
|
|
18083
18259
|
var _column$type;
|
|
18084
18260
|
// every field accepts undefined as value for default
|
|
18085
18261
|
if (value === undefined || value === '') {
|
|
18086
18262
|
return true;
|
|
18087
18263
|
}
|
|
18088
18264
|
|
|
18089
|
-
// xxxAnyOf accepts as value only lists, and we are
|
|
18265
|
+
// xxxAnyOf accepts as value only lists, and we are declaring them in the
|
|
18090
18266
|
// URL as `list=[...]`
|
|
18091
|
-
if (listOperators.includes(
|
|
18267
|
+
if (listOperators.includes(operator)) {
|
|
18092
18268
|
return Array.isArray(value) || value === '';
|
|
18093
18269
|
}
|
|
18094
18270
|
|
|
18095
18271
|
// We are accepting arrays only if they are of the 'xxxAnyOf' type
|
|
18096
|
-
if (Array.isArray(value) && !listOperators.includes(
|
|
18272
|
+
if (Array.isArray(value) && !listOperators.includes(operator)) {
|
|
18097
18273
|
return false;
|
|
18098
18274
|
}
|
|
18099
|
-
const column = columns.find(column => column.field ===
|
|
18275
|
+
const column = columns.find(column => column.field === field);
|
|
18100
18276
|
if (!column) {
|
|
18101
18277
|
return false;
|
|
18102
18278
|
}
|
|
@@ -18134,7 +18310,7 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
18134
18310
|
if (!searchString) {
|
|
18135
18311
|
return 'invalid';
|
|
18136
18312
|
}
|
|
18137
|
-
let
|
|
18313
|
+
let logicOperator = GridLogicOperator.And;
|
|
18138
18314
|
let quickFilterValues = [];
|
|
18139
18315
|
const searchParams = new URLSearchParams();
|
|
18140
18316
|
for (const [key, value] of new URLSearchParams(searchString)) {
|
|
@@ -18142,7 +18318,7 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
18142
18318
|
searchParams.set(key, value);
|
|
18143
18319
|
}
|
|
18144
18320
|
if (key === '_logicOperator') {
|
|
18145
|
-
|
|
18321
|
+
logicOperator = value === GridLogicOperator.And || value === GridLogicOperator.Or ? value : GridLogicOperator.And;
|
|
18146
18322
|
}
|
|
18147
18323
|
if (key === '_quickFilterValues') {
|
|
18148
18324
|
try {
|
|
@@ -18161,7 +18337,7 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
18161
18337
|
if (isInvalid) {
|
|
18162
18338
|
return;
|
|
18163
18339
|
}
|
|
18164
|
-
const field = key.split('[')[0].slice(1);
|
|
18340
|
+
const field = key.split('[')[0].slice(1);
|
|
18165
18341
|
if (!fields.includes(field)) {
|
|
18166
18342
|
return;
|
|
18167
18343
|
}
|
|
@@ -18178,7 +18354,6 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
18178
18354
|
return;
|
|
18179
18355
|
}
|
|
18180
18356
|
const operator = splitRight[0];
|
|
18181
|
-
// if the operator is not part of the valid operators invalidate the URL
|
|
18182
18357
|
if (!isOperatorValueValid(field, operator, columns) || Array.isArray(operator)) {
|
|
18183
18358
|
isInvalid = true;
|
|
18184
18359
|
return;
|
|
@@ -18190,41 +18365,37 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
18190
18365
|
return;
|
|
18191
18366
|
}
|
|
18192
18367
|
items.push({
|
|
18193
|
-
|
|
18194
|
-
|
|
18368
|
+
field,
|
|
18369
|
+
operator: columnType === 'number' && Object.keys(numberOperatorDecoder).includes(operator) ? numberOperatorDecoder[operator] : operator,
|
|
18195
18370
|
id,
|
|
18196
18371
|
value: listOperators.includes(operator) && decodedValue === '' ? [] : decodedValue,
|
|
18197
18372
|
type
|
|
18198
18373
|
});
|
|
18199
18374
|
});
|
|
18200
|
-
|
|
18201
|
-
// If we found some condition that results in an invalid URL,
|
|
18202
|
-
// return the empty filterModel (this will trigger the localStorage)
|
|
18203
|
-
// and will pick up the last valid search
|
|
18204
18375
|
if (isInvalid) {
|
|
18205
18376
|
return 'invalid';
|
|
18206
18377
|
}
|
|
18207
18378
|
return {
|
|
18208
18379
|
items,
|
|
18209
|
-
|
|
18380
|
+
logicOperator,
|
|
18210
18381
|
quickFilterValues
|
|
18211
18382
|
};
|
|
18212
18383
|
};
|
|
18213
18384
|
const getSearchParamsFromFilterModel = filterModel => {
|
|
18214
18385
|
var _filterModel$quickFil;
|
|
18215
18386
|
const searchParams = new URLSearchParams();
|
|
18216
|
-
searchParams.set('_logicOperator', filterModel['
|
|
18387
|
+
searchParams.set('_logicOperator', filterModel['logicOperator'] || '');
|
|
18217
18388
|
filterModel['items'].forEach(item => {
|
|
18218
18389
|
const {
|
|
18219
|
-
|
|
18220
|
-
|
|
18390
|
+
field,
|
|
18391
|
+
operator,
|
|
18221
18392
|
value,
|
|
18222
18393
|
type
|
|
18223
18394
|
} = item;
|
|
18224
|
-
if (Object.keys(numberOperatorEncoder).includes(
|
|
18225
|
-
searchParams.set(`_${
|
|
18395
|
+
if (Object.keys(numberOperatorEncoder).includes(operator)) {
|
|
18396
|
+
searchParams.set(`_${field}[${numberOperatorEncoder[operator]},${encodeValue(type)}]`, encodeValue(value));
|
|
18226
18397
|
} else {
|
|
18227
|
-
searchParams.set(`_${
|
|
18398
|
+
searchParams.set(`_${field}[${encodeValue(operator)},${encodeValue(type)}]`, encodeValue(value));
|
|
18228
18399
|
}
|
|
18229
18400
|
});
|
|
18230
18401
|
if ((_filterModel$quickFil = filterModel.quickFilterValues) !== null && _filterModel$quickFil !== void 0 && _filterModel$quickFil.length) {
|
|
@@ -18240,7 +18411,7 @@ const getSearchParamsFromFilterModel = filterModel => {
|
|
|
18240
18411
|
const getFilterModel = (search, columns, localStorageFilters, setLocalStorageFilters, initialState, isNewVersion) => {
|
|
18241
18412
|
const defaultValue = initialState && initialState.filter && initialState.filter.filterModel ? initialState.filter.filterModel : {
|
|
18242
18413
|
items: [],
|
|
18243
|
-
|
|
18414
|
+
logicOperator: GridLogicOperator.And
|
|
18244
18415
|
};
|
|
18245
18416
|
if (isNewVersion) {
|
|
18246
18417
|
return defaultValue;
|
|
@@ -18379,13 +18550,38 @@ const getPaginationModel = (search, localStoragePagination, setLocalStoragePagin
|
|
|
18379
18550
|
|
|
18380
18551
|
/** COLUMN VISIBILITY */
|
|
18381
18552
|
|
|
18553
|
+
const getColumnVisibilityFromString = (searchString, columns) => {
|
|
18554
|
+
if (!searchString) {
|
|
18555
|
+
return 'invalid';
|
|
18556
|
+
}
|
|
18557
|
+
const searchParams = new URLSearchParams(searchString);
|
|
18558
|
+
const value = searchParams.get('_columnVisibility');
|
|
18559
|
+
if (value === '' || value === null || value === '[]') {
|
|
18560
|
+
return 'invalid';
|
|
18561
|
+
}
|
|
18562
|
+
const parsedFields = value.slice(1, value.length - 1).split(',');
|
|
18563
|
+
const fields = columns.map(column => column.field);
|
|
18564
|
+
const visibility = {};
|
|
18565
|
+
for (const field of fields) {
|
|
18566
|
+
visibility[field] = false;
|
|
18567
|
+
}
|
|
18568
|
+
for (const parsedField of parsedFields) {
|
|
18569
|
+
if (fields.includes(parsedField)) {
|
|
18570
|
+
visibility[parsedField] = true;
|
|
18571
|
+
}
|
|
18572
|
+
}
|
|
18573
|
+
if (Object.values(visibility).filter(v => v === true).length === 0) {
|
|
18574
|
+
return 'invalid';
|
|
18575
|
+
}
|
|
18576
|
+
return visibility;
|
|
18577
|
+
};
|
|
18382
18578
|
const getSearchParamsFromColumnVisibility = (columnVisibility, columns) => {
|
|
18383
18579
|
const searchParams = new URLSearchParams();
|
|
18384
|
-
const
|
|
18580
|
+
const fields = columns.map(column => column.field);
|
|
18385
18581
|
|
|
18386
18582
|
// if column visibility model is empty, show all columns
|
|
18387
18583
|
if (Object.keys(columnVisibility).length == 0) {
|
|
18388
|
-
searchParams.set('_columnVisibility', `[${
|
|
18584
|
+
searchParams.set('_columnVisibility', `[${fields.join(',')}]`);
|
|
18389
18585
|
return searchParams;
|
|
18390
18586
|
}
|
|
18391
18587
|
const finalColumnVisibility = columns.filter(c => {
|
|
@@ -18396,63 +18592,10 @@ const getSearchParamsFromColumnVisibility = (columnVisibility, columns) => {
|
|
|
18396
18592
|
[colName]: true
|
|
18397
18593
|
});
|
|
18398
18594
|
}, columnVisibility);
|
|
18399
|
-
const visibleColumns =
|
|
18400
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
18401
|
-
.filter(_ref => {
|
|
18402
|
-
let [_, visible] = _ref;
|
|
18403
|
-
return visible;
|
|
18404
|
-
})
|
|
18405
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
18406
|
-
.map(_ref2 => {
|
|
18407
|
-
let [column, _] = _ref2;
|
|
18408
|
-
return encodeValue(column);
|
|
18409
|
-
});
|
|
18595
|
+
const visibleColumns = fields.filter(column => finalColumnVisibility[column] !== false);
|
|
18410
18596
|
searchParams.set('_columnVisibility', `[${visibleColumns.join(',')}]`);
|
|
18411
18597
|
return searchParams;
|
|
18412
18598
|
};
|
|
18413
|
-
const getColumnVisibilityFromString = (notParsed, tableColumns) => {
|
|
18414
|
-
if (!notParsed || notParsed.length === 1 && notParsed[0] === '?') {
|
|
18415
|
-
return 'invalid';
|
|
18416
|
-
}
|
|
18417
|
-
// remove the initial ? if present
|
|
18418
|
-
const parsed = notParsed[0] === '?' ? notParsed.slice(1) : notParsed;
|
|
18419
|
-
const visibility = {};
|
|
18420
|
-
let exist = false;
|
|
18421
|
-
let visibleColumnsCount = 0;
|
|
18422
|
-
for (const item of parsed.split('&')) {
|
|
18423
|
-
// if it's not column visibility field, skip
|
|
18424
|
-
const fieldURL = item.split('=')[0];
|
|
18425
|
-
if (fieldURL !== '_columnVisibility') {
|
|
18426
|
-
continue;
|
|
18427
|
-
}
|
|
18428
|
-
// e.g. item = _columnVisibility[abc,def]
|
|
18429
|
-
const left = item.split(']')[0];
|
|
18430
|
-
if (left.split('[').length < 2) {
|
|
18431
|
-
continue;
|
|
18432
|
-
}
|
|
18433
|
-
const encodedValues = item.split('[')[1].split(']')[0];
|
|
18434
|
-
if (typeof encodedValues !== 'string') {
|
|
18435
|
-
continue;
|
|
18436
|
-
}
|
|
18437
|
-
exist = true;
|
|
18438
|
-
const columnFields = tableColumns.map(column => column.field);
|
|
18439
|
-
// TODO: Add validation that , is present
|
|
18440
|
-
const columns = encodedValues.split(',').map(value => decodeValue(value));
|
|
18441
|
-
|
|
18442
|
-
// for each column, check if it's visible and add it to visibility model
|
|
18443
|
-
for (const column of columnFields) {
|
|
18444
|
-
const isColumnVisible = columns.includes(column);
|
|
18445
|
-
visibility[column] = isColumnVisible;
|
|
18446
|
-
if (isColumnVisible) {
|
|
18447
|
-
visibleColumnsCount += 1;
|
|
18448
|
-
}
|
|
18449
|
-
}
|
|
18450
|
-
}
|
|
18451
|
-
if (visibleColumnsCount === 0 && !exist) {
|
|
18452
|
-
return 'invalid';
|
|
18453
|
-
}
|
|
18454
|
-
return visibility;
|
|
18455
|
-
};
|
|
18456
18599
|
|
|
18457
18600
|
// Rules:
|
|
18458
18601
|
// - if we have something in the URL, use that info
|
|
@@ -18513,8 +18656,8 @@ const getPinnedColumnsFromString = (notParsed, tableColumns) => {
|
|
|
18513
18656
|
if (typeof encodedValues !== 'string') {
|
|
18514
18657
|
continue;
|
|
18515
18658
|
}
|
|
18516
|
-
const
|
|
18517
|
-
const columns = encodedValues.split(',').map(value => decodeValue(value)).filter(val => typeof val === 'string' &&
|
|
18659
|
+
const fields = [...tableColumns.map(column => column.field), '__check__'];
|
|
18660
|
+
const columns = encodedValues.split(',').map(value => decodeValue(value)).filter(val => typeof val === 'string' && fields.includes(val));
|
|
18518
18661
|
if (fieldURL === '_pinnedColumnsLeft') {
|
|
18519
18662
|
pinnedColumns['left'] = columns;
|
|
18520
18663
|
}
|
|
@@ -18522,9 +18665,9 @@ const getPinnedColumnsFromString = (notParsed, tableColumns) => {
|
|
|
18522
18665
|
pinnedColumns['right'] = columns;
|
|
18523
18666
|
}
|
|
18524
18667
|
}
|
|
18525
|
-
return pinnedColumns
|
|
18526
|
-
left: pinnedColumns
|
|
18527
|
-
right: pinnedColumns
|
|
18668
|
+
return pinnedColumns.left && pinnedColumns.left.length > 0 || pinnedColumns.right && pinnedColumns.right.length > 0 ? {
|
|
18669
|
+
left: pinnedColumns.left || [],
|
|
18670
|
+
right: pinnedColumns.right || []
|
|
18528
18671
|
} : 'invalid';
|
|
18529
18672
|
};
|
|
18530
18673
|
const getSearchParamsFromPinnedColumns = pinnedColumns => {
|
|
@@ -18574,7 +18717,7 @@ const getSearchParamsFromTab = search => {
|
|
|
18574
18717
|
}
|
|
18575
18718
|
return searchParams;
|
|
18576
18719
|
};
|
|
18577
|
-
const getFinalSearch =
|
|
18720
|
+
const getFinalSearch = _ref => {
|
|
18578
18721
|
let {
|
|
18579
18722
|
search,
|
|
18580
18723
|
localStorageVersion,
|
|
@@ -18584,7 +18727,7 @@ const getFinalSearch = _ref3 => {
|
|
|
18584
18727
|
columnsVisibilityModel,
|
|
18585
18728
|
pinnedColumnsModel,
|
|
18586
18729
|
columns
|
|
18587
|
-
} =
|
|
18730
|
+
} = _ref;
|
|
18588
18731
|
const filterModelSearch = getSearchParamsFromFilterModel(filterModel);
|
|
18589
18732
|
const sortModelSearch = getSearchParamsFromSorting(sortModel);
|
|
18590
18733
|
const paginationModelSearch = getSearchParamsFromPagination(paginationModel);
|
|
@@ -18649,14 +18792,14 @@ const getModelsParsedOrUpdateLocalStorage = (search, localStorageVersion, column
|
|
|
18649
18792
|
pinnedColumnsModel
|
|
18650
18793
|
};
|
|
18651
18794
|
};
|
|
18652
|
-
const updateUrl = (
|
|
18795
|
+
const updateUrl = (_ref2, search, localStorageVersion, historyReplace, columns) => {
|
|
18653
18796
|
let {
|
|
18654
18797
|
filterModel,
|
|
18655
18798
|
sortModel,
|
|
18656
18799
|
paginationModel,
|
|
18657
18800
|
columnsModel: columnsVisibilityModel,
|
|
18658
18801
|
pinnedColumnsModel
|
|
18659
|
-
} =
|
|
18802
|
+
} = _ref2;
|
|
18660
18803
|
const newSearch = getFinalSearch({
|
|
18661
18804
|
search,
|
|
18662
18805
|
localStorageVersion,
|
|
@@ -18677,17 +18820,17 @@ const updateUrl = (_ref4, search, localStorageVersion, historyReplace, columns)
|
|
|
18677
18820
|
// do not use it for equivalence (e.g. with value `3` and undefined we
|
|
18678
18821
|
// will get 0).
|
|
18679
18822
|
const compareFilters = (firstFilter, secondFilter) => {
|
|
18680
|
-
if (firstFilter.
|
|
18823
|
+
if (firstFilter.field < secondFilter.field) {
|
|
18681
18824
|
return -1;
|
|
18682
|
-
} else if (firstFilter.
|
|
18825
|
+
} else if (firstFilter.field > secondFilter.field) {
|
|
18683
18826
|
return 1;
|
|
18684
18827
|
}
|
|
18685
|
-
if (firstFilter.
|
|
18828
|
+
if (firstFilter.operator === undefined || secondFilter.operator === undefined) {
|
|
18686
18829
|
return 0;
|
|
18687
18830
|
}
|
|
18688
|
-
if (firstFilter.
|
|
18831
|
+
if (firstFilter.operator < secondFilter.operator) {
|
|
18689
18832
|
return -1;
|
|
18690
|
-
} else if (firstFilter.
|
|
18833
|
+
} else if (firstFilter.operator > secondFilter.operator) {
|
|
18691
18834
|
return 1;
|
|
18692
18835
|
}
|
|
18693
18836
|
if (firstFilter.value < secondFilter.value) {
|
|
@@ -18698,18 +18841,18 @@ const compareFilters = (firstFilter, secondFilter) => {
|
|
|
18698
18841
|
return 0;
|
|
18699
18842
|
};
|
|
18700
18843
|
const areFiltersEquivalent = (firstFilter, secondFilter) => {
|
|
18701
|
-
return firstFilter.
|
|
18844
|
+
return firstFilter.field === secondFilter.field && firstFilter.operator === secondFilter.operator && firstFilter.value === secondFilter.value;
|
|
18702
18845
|
};
|
|
18703
18846
|
const areFilterModelsEquivalent = (filterModel, filterModelToMatch) => {
|
|
18704
18847
|
const {
|
|
18705
18848
|
items,
|
|
18706
|
-
|
|
18849
|
+
logicOperator
|
|
18707
18850
|
} = filterModel;
|
|
18708
18851
|
const {
|
|
18709
18852
|
items: itemsToMatch,
|
|
18710
|
-
|
|
18853
|
+
logicOperator: logicOperatorToMatch
|
|
18711
18854
|
} = filterModelToMatch;
|
|
18712
|
-
if (
|
|
18855
|
+
if (logicOperator !== logicOperatorToMatch) {
|
|
18713
18856
|
return false;
|
|
18714
18857
|
}
|
|
18715
18858
|
if (items.length !== itemsToMatch.length) {
|
|
@@ -18722,7 +18865,7 @@ const areFilterModelsEquivalent = (filterModel, filterModelToMatch) => {
|
|
|
18722
18865
|
const filterToCompare = itemsToMatch[i];
|
|
18723
18866
|
|
|
18724
18867
|
// compareFilters return 0 if and only if the filters have the same
|
|
18725
|
-
//
|
|
18868
|
+
// field, operator, and value
|
|
18726
18869
|
if (!areFiltersEquivalent(filter, filterToCompare)) {
|
|
18727
18870
|
return false;
|
|
18728
18871
|
}
|
|
@@ -24533,16 +24676,16 @@ const getRole = (config, dateFormat) => {
|
|
|
24533
24676
|
}).join('\n');
|
|
24534
24677
|
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.
|
|
24535
24678
|
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.
|
|
24536
|
-
The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "
|
|
24537
|
-
- "
|
|
24538
|
-
- "items": a list of conditions, each is an object with exactly the three keys "
|
|
24539
|
-
- "
|
|
24679
|
+
The AI assistant extracts information from the user input and generates a JSON object with exactly the two keys "logicOperator" and "items":
|
|
24680
|
+
- "logicOperator": the logical operator, only "and" or "or" are allowed. If there is only one condition in the "items", use "and".
|
|
24681
|
+
- "items": a list of conditions, each is an object with exactly the three keys "field", "operator" and "value":
|
|
24682
|
+
- "field": the column name, must be one of ${columns}
|
|
24540
24683
|
- "value":
|
|
24541
|
-
- this can be skipped if the "
|
|
24542
|
-
- a list of multiple values if the "
|
|
24684
|
+
- this can be skipped if the "operator" is either "isEmpty" or "isNotEmpty"
|
|
24685
|
+
- a list of multiple values if the "operator" ends with "AnyOf"
|
|
24543
24686
|
- otherwise, it's a single value represented as a string: "true" instead of true, "false" instead of false, "0.6" instead of 0.6.
|
|
24544
24687
|
For "date" data type, use ${dateFormat}. If relative date is input, convert to the actual date given today is ${today}.
|
|
24545
|
-
- "
|
|
24688
|
+
- "operator": the comparison operator, accepted values depend on the data type of the column
|
|
24546
24689
|
${operators}
|
|
24547
24690
|
|
|
24548
24691
|
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:
|
|
@@ -24579,10 +24722,10 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24579
24722
|
nlpFilterConfig,
|
|
24580
24723
|
onFilterModelChange,
|
|
24581
24724
|
dateFormat = 'yyyy-mm-dd',
|
|
24582
|
-
defaultModel = 'gpt-4-
|
|
24725
|
+
defaultModel = 'gpt-4-1106-preview',
|
|
24583
24726
|
defaultFilter = {
|
|
24584
24727
|
items: [],
|
|
24585
|
-
|
|
24728
|
+
logicOperator: 'and'
|
|
24586
24729
|
},
|
|
24587
24730
|
disablePower = false,
|
|
24588
24731
|
localeText
|
|
@@ -24660,7 +24803,7 @@ const GridToolbarFilterSemanticField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24660
24803
|
value: prompt
|
|
24661
24804
|
}), /*#__PURE__*/React__default.createElement(Button, {
|
|
24662
24805
|
variant: "primary",
|
|
24663
|
-
"
|
|
24806
|
+
"aria-label": buttonAriaLabel,
|
|
24664
24807
|
type: "submit",
|
|
24665
24808
|
isLoading: isLoading
|
|
24666
24809
|
}, buttonText)), !disablePower && /*#__PURE__*/React__default.createElement(Tooltip, null, /*#__PURE__*/React__default.createElement(Tooltip.Trigger, null, /*#__PURE__*/React__default.createElement(Switch, {
|
|
@@ -24722,7 +24865,7 @@ const Toolbar$2 = props => {
|
|
|
24722
24865
|
let {
|
|
24723
24866
|
apiRef
|
|
24724
24867
|
} = _ref;
|
|
24725
|
-
return
|
|
24868
|
+
return gridExpandedSortedRowIdsSelector(apiRef);
|
|
24726
24869
|
}
|
|
24727
24870
|
},
|
|
24728
24871
|
printOptions: {
|
|
@@ -26956,12 +27099,10 @@ const ServerSideControlledPagination = _ref3 => {
|
|
|
26956
27099
|
selectionStatus,
|
|
26957
27100
|
displaySelection,
|
|
26958
27101
|
displayPagination,
|
|
26959
|
-
|
|
26960
|
-
|
|
26961
|
-
|
|
26962
|
-
onPageSizeChange,
|
|
27102
|
+
paginationModel,
|
|
27103
|
+
onPaginationModelChange,
|
|
27104
|
+
pageSizeOptions,
|
|
26963
27105
|
displayRowsPerPage,
|
|
26964
|
-
rowsPerPageOptions,
|
|
26965
27106
|
paginationProps,
|
|
26966
27107
|
rowCount
|
|
26967
27108
|
} = _ref3;
|
|
@@ -26980,13 +27121,17 @@ const ServerSideControlledPagination = _ref3 => {
|
|
|
26980
27121
|
}, totalRowsLabel) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$1({
|
|
26981
27122
|
component: "div",
|
|
26982
27123
|
count: totalNumberOfRowsInTable,
|
|
26983
|
-
page: page,
|
|
26984
|
-
onPageChange: (event,
|
|
26985
|
-
|
|
26986
|
-
|
|
26987
|
-
|
|
26988
|
-
|
|
26989
|
-
|
|
27124
|
+
page: paginationModel.page,
|
|
27125
|
+
onPageChange: (event, page) => onPaginationModelChange({
|
|
27126
|
+
page,
|
|
27127
|
+
pageSize: paginationModel.pageSize
|
|
27128
|
+
}),
|
|
27129
|
+
rowsPerPage: paginationModel.pageSize,
|
|
27130
|
+
onRowsPerPageChange: event => onPaginationModelChange({
|
|
27131
|
+
page: paginationModel.page,
|
|
27132
|
+
pageSize: parseInt(event.target.value, 10)
|
|
27133
|
+
}),
|
|
27134
|
+
rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
|
|
26990
27135
|
}, paginationProps)) : null);
|
|
26991
27136
|
};
|
|
26992
27137
|
|
|
@@ -27012,11 +27157,9 @@ const ControlledPagination = _ref3 => {
|
|
|
27012
27157
|
displayPagination = false,
|
|
27013
27158
|
selectionStatus,
|
|
27014
27159
|
apiRef,
|
|
27015
|
-
|
|
27016
|
-
|
|
27017
|
-
|
|
27018
|
-
onPageSizeChange,
|
|
27019
|
-
rowsPerPageOptions,
|
|
27160
|
+
paginationModel,
|
|
27161
|
+
onPaginationModelChange,
|
|
27162
|
+
pageSizeOptions,
|
|
27020
27163
|
isRowSelectable,
|
|
27021
27164
|
paginationProps
|
|
27022
27165
|
} = _ref3;
|
|
@@ -27046,17 +27189,25 @@ const ControlledPagination = _ref3 => {
|
|
|
27046
27189
|
}, `${selectionStatus.numberOfSelectedRows} row${selectionStatus.numberOfSelectedRows > 1 ? 's' : ''} selected`) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, _extends$1({
|
|
27047
27190
|
component: "div",
|
|
27048
27191
|
count: numberOfFilteredRowsInTable,
|
|
27049
|
-
page: page,
|
|
27050
|
-
onPageChange: (event,
|
|
27051
|
-
|
|
27192
|
+
page: paginationModel.page,
|
|
27193
|
+
onPageChange: (event, page) => {
|
|
27194
|
+
onPaginationModelChange({
|
|
27195
|
+
page,
|
|
27196
|
+
pageSize: paginationModel.pageSize
|
|
27197
|
+
});
|
|
27198
|
+
},
|
|
27199
|
+
rowsPerPage: paginationModel.pageSize,
|
|
27052
27200
|
onRowsPerPageChange: event => {
|
|
27053
|
-
|
|
27201
|
+
onPaginationModelChange({
|
|
27202
|
+
page: paginationModel.page,
|
|
27203
|
+
pageSize: parseInt(event.target.value, 10)
|
|
27204
|
+
});
|
|
27054
27205
|
},
|
|
27055
|
-
rowsPerPageOptions: displayRowsPerPage ?
|
|
27206
|
+
rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions : []
|
|
27056
27207
|
}, paginationProps)) : null);
|
|
27057
27208
|
};
|
|
27058
27209
|
|
|
27059
|
-
const _excluded$3 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "
|
|
27210
|
+
const _excluded$3 = ["hideToolbar", "RenderedToolbar", "filterModel", "onFilterModelChange", "pagination", "paginationPlacement", "selectionStatus", "apiRef", "isRowSelectable", "paginationModel", "onPaginationModelChange", "pageSizeOptions", "paginationProps", "paginationMode", "rowCount"];
|
|
27060
27211
|
const ToolbarWrapper = _ref => {
|
|
27061
27212
|
let {
|
|
27062
27213
|
hideToolbar,
|
|
@@ -27068,11 +27219,9 @@ const ToolbarWrapper = _ref => {
|
|
|
27068
27219
|
selectionStatus,
|
|
27069
27220
|
apiRef,
|
|
27070
27221
|
isRowSelectable,
|
|
27071
|
-
|
|
27072
|
-
|
|
27073
|
-
|
|
27074
|
-
onPageSizeChange,
|
|
27075
|
-
rowsPerPageOptions,
|
|
27222
|
+
paginationModel,
|
|
27223
|
+
onPaginationModelChange,
|
|
27224
|
+
pageSizeOptions,
|
|
27076
27225
|
paginationProps,
|
|
27077
27226
|
paginationMode = 'client',
|
|
27078
27227
|
rowCount
|
|
@@ -27086,11 +27235,9 @@ const ToolbarWrapper = _ref => {
|
|
|
27086
27235
|
displayRowsPerPage: false,
|
|
27087
27236
|
displayPagination: ['top', 'both'].includes(paginationPlacement),
|
|
27088
27237
|
selectionStatus: selectionStatus.current,
|
|
27089
|
-
|
|
27090
|
-
|
|
27091
|
-
|
|
27092
|
-
onPageSizeChange: onPageSizeChange,
|
|
27093
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
27238
|
+
paginationModel: paginationModel,
|
|
27239
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
27240
|
+
pageSizeOptions: pageSizeOptions,
|
|
27094
27241
|
paginationProps: paginationProps,
|
|
27095
27242
|
rowCount: rowCount
|
|
27096
27243
|
}) : /*#__PURE__*/React__default.createElement(ControlledPagination, {
|
|
@@ -27100,30 +27247,26 @@ const ToolbarWrapper = _ref => {
|
|
|
27100
27247
|
selectionStatus: selectionStatus.current,
|
|
27101
27248
|
apiRef: apiRef,
|
|
27102
27249
|
isRowSelectable: isRowSelectable,
|
|
27103
|
-
|
|
27104
|
-
|
|
27105
|
-
|
|
27106
|
-
onPageSizeChange: onPageSizeChange,
|
|
27107
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
27250
|
+
paginationModel: paginationModel,
|
|
27251
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
27252
|
+
pageSizeOptions: pageSizeOptions,
|
|
27108
27253
|
paginationProps: paginationProps
|
|
27109
27254
|
}) : null);
|
|
27110
27255
|
};
|
|
27111
27256
|
|
|
27112
27257
|
const useControlledDatagridState = _ref => {
|
|
27113
|
-
var _initialState$paginat, _initialState$paginat2;
|
|
27258
|
+
var _ref2, _ref3, _propsPaginationModel, _initialState$paginat, _initialState$paginat2, _pageSizeOptions$, _ref4, _propsPaginationModel2, _initialState$paginat3, _initialState$paginat4;
|
|
27114
27259
|
let {
|
|
27115
27260
|
initialState,
|
|
27116
|
-
|
|
27261
|
+
pageSizeOptions,
|
|
27117
27262
|
propsColumnVisibilityModel,
|
|
27118
27263
|
propsFilterModel,
|
|
27119
27264
|
propsOnColumnVisibilityModelChange,
|
|
27120
27265
|
propsOnFilterModelChange,
|
|
27121
|
-
|
|
27122
|
-
propsOnPageSizeChange,
|
|
27266
|
+
propsOnPaginationModelChange,
|
|
27123
27267
|
propsOnPinnedColumnsChange,
|
|
27124
27268
|
propsOnSortModelChange,
|
|
27125
|
-
|
|
27126
|
-
propsPageSize,
|
|
27269
|
+
propsPaginationModel,
|
|
27127
27270
|
propsPinnedColumns,
|
|
27128
27271
|
propsSortModel
|
|
27129
27272
|
} = _ref;
|
|
@@ -27171,33 +27314,22 @@ const useControlledDatagridState = _ref => {
|
|
|
27171
27314
|
setSortModel(model);
|
|
27172
27315
|
}
|
|
27173
27316
|
};
|
|
27174
|
-
const [
|
|
27175
|
-
|
|
27176
|
-
|
|
27177
|
-
|
|
27178
|
-
|
|
27179
|
-
|
|
27180
|
-
|
|
27181
|
-
}
|
|
27182
|
-
};
|
|
27183
|
-
useEffect(() => {
|
|
27184
|
-
if (propsPage || propsPage === 0) {
|
|
27185
|
-
setPage(propsPage);
|
|
27186
|
-
}
|
|
27187
|
-
}, [propsPage]);
|
|
27188
|
-
const onPageSizeChange = pageSize => {
|
|
27189
|
-
onPageChange(0);
|
|
27190
|
-
if (propsOnPageSizeChange) {
|
|
27191
|
-
propsOnPageSizeChange(pageSize, undefined);
|
|
27317
|
+
const [paginationModel, setPaginationModel] = useState({
|
|
27318
|
+
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,
|
|
27319
|
+
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
|
|
27320
|
+
});
|
|
27321
|
+
const onPaginationModelChange = (model, details) => {
|
|
27322
|
+
if (propsOnPaginationModelChange) {
|
|
27323
|
+
propsOnPaginationModelChange(model, details);
|
|
27192
27324
|
} else {
|
|
27193
|
-
|
|
27325
|
+
setPaginationModel(model);
|
|
27194
27326
|
}
|
|
27195
27327
|
};
|
|
27196
27328
|
useEffect(() => {
|
|
27197
|
-
if (
|
|
27198
|
-
|
|
27329
|
+
if (propsPaginationModel) {
|
|
27330
|
+
setPaginationModel(propsPaginationModel);
|
|
27199
27331
|
}
|
|
27200
|
-
}, [
|
|
27332
|
+
}, [propsPaginationModel]);
|
|
27201
27333
|
return {
|
|
27202
27334
|
filterModel,
|
|
27203
27335
|
onFilterModelChange,
|
|
@@ -27207,14 +27339,12 @@ const useControlledDatagridState = _ref => {
|
|
|
27207
27339
|
onPinnedColumnsChange,
|
|
27208
27340
|
sortModel,
|
|
27209
27341
|
onSortModelChange,
|
|
27210
|
-
|
|
27211
|
-
|
|
27212
|
-
onPageChange,
|
|
27213
|
-
onPageSizeChange
|
|
27342
|
+
paginationModel,
|
|
27343
|
+
onPaginationModelChange
|
|
27214
27344
|
};
|
|
27215
27345
|
};
|
|
27216
27346
|
|
|
27217
|
-
const _excluded$2 = ["apiRef", "autoHeight", "className", "
|
|
27347
|
+
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"];
|
|
27218
27348
|
const COMPONENT_NAME$2 = 'DataGrid';
|
|
27219
27349
|
const CLASSNAME$2 = 'redsift-datagrid';
|
|
27220
27350
|
const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
@@ -27223,33 +27353,30 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27223
27353
|
apiRef: propsApiRef,
|
|
27224
27354
|
autoHeight,
|
|
27225
27355
|
className,
|
|
27226
|
-
|
|
27227
|
-
|
|
27228
|
-
componentsProps,
|
|
27356
|
+
slots,
|
|
27357
|
+
slotProps,
|
|
27229
27358
|
filterModel: propsFilterModel,
|
|
27230
27359
|
columnVisibilityModel: propsColumnVisibilityModel,
|
|
27231
27360
|
pinnedColumns: propsPinnedColumns,
|
|
27232
27361
|
sortModel: propsSortModel,
|
|
27362
|
+
paginationModel: propsPaginationModel,
|
|
27233
27363
|
height: propsHeight,
|
|
27234
27364
|
hideToolbar,
|
|
27235
27365
|
initialState,
|
|
27236
27366
|
isRowSelectable,
|
|
27237
27367
|
license = process.env.MUI_LICENSE_KEY,
|
|
27238
27368
|
onFilterModelChange: propsOnFilterModelChange,
|
|
27239
|
-
|
|
27240
|
-
|
|
27369
|
+
rowSelectionModel: propsRowSelectionModel,
|
|
27370
|
+
onPaginationModelChange: propsOnPaginationModelChange,
|
|
27371
|
+
onRowSelectionModelChange: propsOnRowSelectionModelChange,
|
|
27241
27372
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
27242
27373
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
27243
27374
|
onSortModelChange: propsOnSortModelChange,
|
|
27244
|
-
selectionModel: propsSelectionModel,
|
|
27245
|
-
onSelectionModelChange: propsOnSelectionModelChange,
|
|
27246
|
-
page: propsPage,
|
|
27247
|
-
pageSize: propsPageSize,
|
|
27248
27375
|
pagination,
|
|
27249
27376
|
paginationPlacement = 'both',
|
|
27250
27377
|
paginationProps,
|
|
27251
27378
|
rows,
|
|
27252
|
-
|
|
27379
|
+
pageSizeOptions,
|
|
27253
27380
|
sx,
|
|
27254
27381
|
theme: propsTheme,
|
|
27255
27382
|
paginationMode = 'client',
|
|
@@ -27259,7 +27386,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27259
27386
|
const theme = useTheme$4(propsTheme);
|
|
27260
27387
|
const _apiRef = useGridApiRef();
|
|
27261
27388
|
const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
|
|
27262
|
-
const RenderedToolbar =
|
|
27389
|
+
const RenderedToolbar = slots !== null && slots !== void 0 && slots.toolbar ? slots.toolbar : Toolbar$2;
|
|
27263
27390
|
LicenseInfo.setLicenseKey(license);
|
|
27264
27391
|
const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
|
|
27265
27392
|
const {
|
|
@@ -27267,56 +27394,52 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27267
27394
|
filterModel,
|
|
27268
27395
|
onColumnVisibilityModelChange,
|
|
27269
27396
|
onFilterModelChange,
|
|
27270
|
-
|
|
27271
|
-
onPageSizeChange,
|
|
27397
|
+
onPaginationModelChange,
|
|
27272
27398
|
onPinnedColumnsChange,
|
|
27273
27399
|
onSortModelChange,
|
|
27274
|
-
|
|
27275
|
-
pageSize,
|
|
27400
|
+
paginationModel,
|
|
27276
27401
|
pinnedColumns,
|
|
27277
27402
|
sortModel
|
|
27278
27403
|
} = useControlledDatagridState({
|
|
27279
27404
|
initialState,
|
|
27280
|
-
|
|
27405
|
+
pageSizeOptions,
|
|
27281
27406
|
propsColumnVisibilityModel,
|
|
27282
27407
|
propsFilterModel,
|
|
27283
27408
|
propsOnColumnVisibilityModelChange,
|
|
27284
27409
|
propsOnFilterModelChange,
|
|
27285
27410
|
propsOnPinnedColumnsChange,
|
|
27286
27411
|
propsOnSortModelChange,
|
|
27287
|
-
|
|
27288
|
-
propsPageSize,
|
|
27412
|
+
propsPaginationModel,
|
|
27289
27413
|
propsPinnedColumns,
|
|
27290
27414
|
propsSortModel,
|
|
27291
|
-
|
|
27292
|
-
propsOnPageSizeChange
|
|
27415
|
+
propsOnPaginationModelChange
|
|
27293
27416
|
});
|
|
27294
|
-
const [
|
|
27417
|
+
const [rowSelectionModel, setRowSelectionModel] = useState(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
27295
27418
|
useEffect(() => {
|
|
27296
|
-
|
|
27297
|
-
}, [
|
|
27298
|
-
const
|
|
27299
|
-
if (
|
|
27300
|
-
|
|
27419
|
+
setRowSelectionModel(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
27420
|
+
}, [propsRowSelectionModel]);
|
|
27421
|
+
const onRowSelectionModelChange = (selectionModel, details) => {
|
|
27422
|
+
if (propsOnRowSelectionModelChange) {
|
|
27423
|
+
propsOnRowSelectionModelChange(selectionModel, details);
|
|
27301
27424
|
} else {
|
|
27302
|
-
|
|
27425
|
+
setRowSelectionModel(selectionModel);
|
|
27303
27426
|
}
|
|
27304
27427
|
};
|
|
27305
27428
|
const selectionStatus = useRef({
|
|
27306
27429
|
type: 'none',
|
|
27307
27430
|
numberOfSelectedRows: 0,
|
|
27308
27431
|
numberOfSelectedRowsInPage: 0,
|
|
27309
|
-
page,
|
|
27310
|
-
pageSize
|
|
27432
|
+
page: paginationModel.page,
|
|
27433
|
+
pageSize: paginationModel.pageSize
|
|
27311
27434
|
});
|
|
27312
27435
|
|
|
27313
27436
|
// in server-side pagination we want to update the selection status
|
|
27314
27437
|
// every time we navigate between pages, resize our page or select something
|
|
27315
27438
|
useEffect(() => {
|
|
27316
27439
|
if (paginationMode == 'server') {
|
|
27317
|
-
onServerSideSelectionStatusChange(Array.isArray(
|
|
27440
|
+
onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatus, isRowSelectable, paginationModel.page, paginationModel.pageSize);
|
|
27318
27441
|
}
|
|
27319
|
-
}, [
|
|
27442
|
+
}, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
|
|
27320
27443
|
if (!Array.isArray(rows)) {
|
|
27321
27444
|
return null;
|
|
27322
27445
|
}
|
|
@@ -27347,57 +27470,54 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27347
27470
|
apiRef: apiRef,
|
|
27348
27471
|
autoHeight: autoHeight,
|
|
27349
27472
|
checkboxSelectionVisibleOnly: Boolean(pagination),
|
|
27350
|
-
|
|
27351
|
-
|
|
27352
|
-
|
|
27353
|
-
|
|
27354
|
-
|
|
27355
|
-
|
|
27356
|
-
ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27473
|
+
slots: _objectSpread2(_objectSpread2({
|
|
27474
|
+
baseButton: BaseButton,
|
|
27475
|
+
baseCheckbox: BaseCheckbox,
|
|
27476
|
+
// baseTextField,
|
|
27477
|
+
basePopper: BasePopper,
|
|
27478
|
+
columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27357
27479
|
displayName: "ColumnFilteredIcon"
|
|
27358
27480
|
})),
|
|
27359
|
-
|
|
27481
|
+
columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27360
27482
|
displayName: "ColumnSelectorIcon"
|
|
27361
27483
|
})),
|
|
27362
|
-
|
|
27484
|
+
columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27363
27485
|
displayName: "ColumnSortedAscendingIcon"
|
|
27364
27486
|
})),
|
|
27365
|
-
|
|
27487
|
+
columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27366
27488
|
displayName: "ColumnSortedDescendingIcon"
|
|
27367
27489
|
})),
|
|
27368
|
-
|
|
27490
|
+
densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27369
27491
|
displayName: "DensityCompactIcon"
|
|
27370
27492
|
})),
|
|
27371
|
-
|
|
27493
|
+
densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27372
27494
|
displayName: "DensityStandardIcon"
|
|
27373
27495
|
})),
|
|
27374
|
-
|
|
27496
|
+
densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27375
27497
|
displayName: "DensityComfortableIcon"
|
|
27376
27498
|
})),
|
|
27377
|
-
|
|
27499
|
+
detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27378
27500
|
displayName: "DetailPanelCollapseIcon"
|
|
27379
27501
|
})),
|
|
27380
|
-
|
|
27502
|
+
detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27381
27503
|
displayName: "DetailPanelExpandIcon"
|
|
27382
27504
|
})),
|
|
27383
|
-
|
|
27505
|
+
exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27384
27506
|
displayName: "ExportIcon"
|
|
27385
27507
|
})),
|
|
27386
|
-
|
|
27508
|
+
openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
|
|
27387
27509
|
displayName: "OpenFilterButtonIcon"
|
|
27388
27510
|
}, props))
|
|
27389
|
-
},
|
|
27390
|
-
|
|
27391
|
-
|
|
27511
|
+
}, slots), {}, {
|
|
27512
|
+
toolbar: ToolbarWrapper,
|
|
27513
|
+
pagination: props => pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$1({}, props, {
|
|
27392
27514
|
displaySelection: false,
|
|
27393
27515
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
27394
27516
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
27395
27517
|
selectionStatus: selectionStatus.current,
|
|
27396
|
-
|
|
27397
|
-
|
|
27398
|
-
|
|
27399
|
-
onPageSizeChange: onPageSizeChange,
|
|
27400
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
27518
|
+
paginationModel: paginationModel,
|
|
27519
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
27520
|
+
pageSizeOptions: pageSizeOptions,
|
|
27401
27521
|
paginationProps: paginationProps,
|
|
27402
27522
|
paginationMode: paginationMode,
|
|
27403
27523
|
rowCount: rowCount
|
|
@@ -27408,16 +27528,14 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27408
27528
|
selectionStatus: selectionStatus.current,
|
|
27409
27529
|
apiRef: apiRef,
|
|
27410
27530
|
isRowSelectable: isRowSelectable,
|
|
27411
|
-
|
|
27412
|
-
|
|
27413
|
-
|
|
27414
|
-
onPageSizeChange: onPageSizeChange,
|
|
27415
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
27531
|
+
paginationModel: paginationModel,
|
|
27532
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
27533
|
+
pageSizeOptions: pageSizeOptions,
|
|
27416
27534
|
paginationProps: paginationProps,
|
|
27417
27535
|
paginationMode: paginationMode
|
|
27418
27536
|
})) : null
|
|
27419
27537
|
}),
|
|
27420
|
-
|
|
27538
|
+
slotProps: _objectSpread2(_objectSpread2({}, slotProps), {}, {
|
|
27421
27539
|
toolbar: _objectSpread2({
|
|
27422
27540
|
hideToolbar,
|
|
27423
27541
|
RenderedToolbar,
|
|
@@ -27428,15 +27546,13 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27428
27546
|
selectionStatus,
|
|
27429
27547
|
apiRef,
|
|
27430
27548
|
isRowSelectable,
|
|
27431
|
-
|
|
27432
|
-
|
|
27433
|
-
|
|
27434
|
-
onPageSizeChange,
|
|
27435
|
-
rowsPerPageOptions,
|
|
27549
|
+
paginationModel,
|
|
27550
|
+
onPaginationModelChange,
|
|
27551
|
+
pageSizeOptions,
|
|
27436
27552
|
paginationProps,
|
|
27437
27553
|
paginationMode,
|
|
27438
27554
|
rowCount
|
|
27439
|
-
},
|
|
27555
|
+
}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar)
|
|
27440
27556
|
}),
|
|
27441
27557
|
filterModel: filterModel,
|
|
27442
27558
|
columnVisibilityModel: columnVisibilityModel,
|
|
@@ -27452,13 +27568,11 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27452
27568
|
paginationMode: paginationMode,
|
|
27453
27569
|
keepNonExistentRowsSelected: paginationMode == 'server',
|
|
27454
27570
|
rows: rows,
|
|
27455
|
-
|
|
27456
|
-
|
|
27457
|
-
|
|
27458
|
-
|
|
27459
|
-
|
|
27460
|
-
selectionModel: selectionModel,
|
|
27461
|
-
onSelectionModelChange: (newSelectionModel, details) => {
|
|
27571
|
+
pageSizeOptions: pageSizeOptions,
|
|
27572
|
+
paginationModel: paginationModel,
|
|
27573
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
27574
|
+
rowSelectionModel: rowSelectionModel,
|
|
27575
|
+
onRowSelectionModelChange: (newSelectionModel, details) => {
|
|
27462
27576
|
if (pagination && paginationMode != 'server') {
|
|
27463
27577
|
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
|
|
27464
27578
|
let {
|
|
@@ -27516,7 +27630,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27516
27630
|
};
|
|
27517
27631
|
}
|
|
27518
27632
|
}
|
|
27519
|
-
|
|
27633
|
+
onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
|
|
27520
27634
|
},
|
|
27521
27635
|
sx: _objectSpread2(_objectSpread2({}, sx), {}, {
|
|
27522
27636
|
'.MuiDataGrid-columnHeaders': {
|
|
@@ -27533,8 +27647,6 @@ DataGrid.className = CLASSNAME$2;
|
|
|
27533
27647
|
DataGrid.displayName = COMPONENT_NAME$2;
|
|
27534
27648
|
|
|
27535
27649
|
// Get and Set data from LocalStorage WITHOUT useState
|
|
27536
|
-
|
|
27537
|
-
// triggering a state update and consecutive re-render
|
|
27538
27650
|
const useFetchState = (defaultValue, key) => {
|
|
27539
27651
|
let stickyValue = null;
|
|
27540
27652
|
try {
|
|
@@ -27542,16 +27654,7 @@ const useFetchState = (defaultValue, key) => {
|
|
|
27542
27654
|
} catch (e) {
|
|
27543
27655
|
console.error('StatefulDataGrid: error getting item from local storage: ', e);
|
|
27544
27656
|
}
|
|
27545
|
-
|
|
27546
|
-
|
|
27547
|
-
// TODO: temporary workaround to avoid clashes when someone had sorting on the now-removed screenshot field (renamed to num_annotations)
|
|
27548
|
-
// 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
|
|
27549
|
-
if (parsedValue instanceof Array) {
|
|
27550
|
-
const fields = (parsedValue || []).map(item => item.field);
|
|
27551
|
-
if (fields.includes('screenshot') || fields.includes('diffs')) {
|
|
27552
|
-
parsedValue = defaultValue;
|
|
27553
|
-
}
|
|
27554
|
-
}
|
|
27657
|
+
const parsedValue = stickyValue !== null && stickyValue !== undefined && stickyValue !== 'undefined' ? JSON.parse(stickyValue) : defaultValue;
|
|
27555
27658
|
const updateValue = useCallback(value => {
|
|
27556
27659
|
try {
|
|
27557
27660
|
window.localStorage.setItem(key, JSON.stringify(value));
|
|
@@ -27562,6 +27665,8 @@ const useFetchState = (defaultValue, key) => {
|
|
|
27562
27665
|
return [parsedValue, updateValue];
|
|
27563
27666
|
};
|
|
27564
27667
|
|
|
27668
|
+
// import useLocalStorage from './useLocalStorage';
|
|
27669
|
+
|
|
27565
27670
|
const useTableStates = (id, version) => {
|
|
27566
27671
|
const [paginationModel, setPaginationModel] = useFetchState('', buildStorageKey({
|
|
27567
27672
|
id,
|
|
@@ -27618,8 +27723,7 @@ const useStatefulTable = props => {
|
|
|
27618
27723
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
27619
27724
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
27620
27725
|
onFilterModelChange: propsOnFilterModelChange,
|
|
27621
|
-
|
|
27622
|
-
onPageSizeChange: propsOnPageSizeChange,
|
|
27726
|
+
onPaginationModelChange: propsOnPaginationModelChange,
|
|
27623
27727
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
27624
27728
|
onSortModelChange: propsOnSortModelChange,
|
|
27625
27729
|
useRouter,
|
|
@@ -27649,7 +27753,7 @@ const useStatefulTable = props => {
|
|
|
27649
27753
|
setDimensionModel
|
|
27650
27754
|
} = useTableStates(id, localStorageVersion);
|
|
27651
27755
|
|
|
27652
|
-
// clearing up old version keys
|
|
27756
|
+
// clearing up old version keys, triggering only on first render
|
|
27653
27757
|
useEffect(() => clearPreviousVersionStorage(id, previousLocalStorageVersions), [id, previousLocalStorageVersions]);
|
|
27654
27758
|
const onColumnDimensionChange = useCallback(_ref => {
|
|
27655
27759
|
let {
|
|
@@ -27682,7 +27786,6 @@ const useStatefulTable = props => {
|
|
|
27682
27786
|
column.width = dimensionModel[column.field] || column.width || 100;
|
|
27683
27787
|
return column;
|
|
27684
27788
|
}), [propsColumns, dimensionModel]);
|
|
27685
|
-
|
|
27686
27789
|
/** Add resetPage method to apiRef. */
|
|
27687
27790
|
apiRef.current.resetPage = () => {
|
|
27688
27791
|
apiRef.current.setPage(0);
|
|
@@ -27693,7 +27796,7 @@ const useStatefulTable = props => {
|
|
|
27693
27796
|
onFilterModelChange: (model, details) => {
|
|
27694
27797
|
const filterModel = _objectSpread2(_objectSpread2({}, model), {}, {
|
|
27695
27798
|
items: model.items.map(item => {
|
|
27696
|
-
const column = apiRef.current.getColumn(item.
|
|
27799
|
+
const column = apiRef.current.getColumn(item.field);
|
|
27697
27800
|
item.type = column.type || 'string';
|
|
27698
27801
|
return item;
|
|
27699
27802
|
}),
|
|
@@ -27731,33 +27834,16 @@ const useStatefulTable = props => {
|
|
|
27731
27834
|
}, search, localStorageVersion, historyReplace, columns);
|
|
27732
27835
|
},
|
|
27733
27836
|
pinnedColumns: pinnedColumnsModel,
|
|
27734
|
-
|
|
27735
|
-
|
|
27736
|
-
|
|
27737
|
-
|
|
27738
|
-
|
|
27739
|
-
|
|
27740
|
-
filterModel: filterParsed,
|
|
27741
|
-
sortModel: sortModelParsed,
|
|
27742
|
-
paginationModel: {
|
|
27743
|
-
page,
|
|
27744
|
-
pageSize: paginationModelParsed.pageSize,
|
|
27745
|
-
direction
|
|
27746
|
-
},
|
|
27747
|
-
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
27748
|
-
pinnedColumnsModel: pinnedColumnsModel
|
|
27749
|
-
}, search, localStorageVersion, historyReplace, columns);
|
|
27750
|
-
},
|
|
27751
|
-
onPageSizeChange: (pageSize, details) => {
|
|
27752
|
-
propsOnPageSizeChange === null || propsOnPageSizeChange === void 0 ? void 0 : propsOnPageSizeChange(pageSize, details);
|
|
27837
|
+
paginationModel: paginationModelParsed,
|
|
27838
|
+
onPaginationModelChange: (model, details) => {
|
|
27839
|
+
const paginationModel = _objectSpread2(_objectSpread2({}, model), {}, {
|
|
27840
|
+
direction: paginationModelParsed.page < model.page ? 'next' : 'back'
|
|
27841
|
+
});
|
|
27842
|
+
propsOnPaginationModelChange === null || propsOnPaginationModelChange === void 0 ? void 0 : propsOnPaginationModelChange(paginationModel, details);
|
|
27753
27843
|
updateUrl({
|
|
27754
27844
|
filterModel: filterParsed,
|
|
27755
27845
|
sortModel: sortModelParsed,
|
|
27756
|
-
paginationModel:
|
|
27757
|
-
page: paginationModelParsed.page,
|
|
27758
|
-
pageSize,
|
|
27759
|
-
direction: paginationModelParsed.direction
|
|
27760
|
-
},
|
|
27846
|
+
paginationModel: paginationModel,
|
|
27761
27847
|
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
27762
27848
|
pinnedColumnsModel: pinnedColumnsModel
|
|
27763
27849
|
}, search, localStorageVersion, historyReplace, columns);
|
|
@@ -27783,7 +27869,7 @@ const useStatefulTable = props => {
|
|
|
27783
27869
|
};
|
|
27784
27870
|
};
|
|
27785
27871
|
|
|
27786
|
-
const _excluded$1 = ["apiRef", "autoHeight", "className", "columns", "
|
|
27872
|
+
const _excluded$1 = ["apiRef", "autoHeight", "className", "columns", "slots", "slotProps", "filterModel", "columnVisibilityModel", "pinnedColumns", "sortModel", "paginationModel", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "localStorageVersion", "previousLocalStorageVersions", "onFilterModelChange", "rowSelectionModel", "onColumnWidthChange", "onPaginationModelChange", "onRowSelectionModelChange", "onColumnVisibilityModelChange", "onPinnedColumnsChange", "onSortModelChange", "pagination", "paginationPlacement", "paginationProps", "rows", "pageSizeOptions", "sx", "theme", "useRouter", "paginationMode", "rowCount"];
|
|
27787
27873
|
const COMPONENT_NAME$1 = 'DataGrid';
|
|
27788
27874
|
const CLASSNAME$1 = 'redsift-datagrid';
|
|
27789
27875
|
const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
@@ -27793,15 +27879,13 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27793
27879
|
autoHeight,
|
|
27794
27880
|
className,
|
|
27795
27881
|
columns,
|
|
27796
|
-
|
|
27797
|
-
|
|
27798
|
-
componentsProps,
|
|
27882
|
+
slots,
|
|
27883
|
+
slotProps,
|
|
27799
27884
|
filterModel: propsFilterModel,
|
|
27800
27885
|
columnVisibilityModel: propsColumnVisibilityModel,
|
|
27801
27886
|
pinnedColumns: propsPinnedColumns,
|
|
27802
27887
|
sortModel: propsSortModel,
|
|
27803
|
-
|
|
27804
|
-
pageSize: propsPageSize,
|
|
27888
|
+
paginationModel: propsPaginationModel,
|
|
27805
27889
|
height: propsHeight,
|
|
27806
27890
|
hideToolbar,
|
|
27807
27891
|
initialState,
|
|
@@ -27810,11 +27894,10 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27810
27894
|
localStorageVersion,
|
|
27811
27895
|
previousLocalStorageVersions,
|
|
27812
27896
|
onFilterModelChange: propsOnFilterModelChange,
|
|
27813
|
-
|
|
27897
|
+
rowSelectionModel: propsRowSelectionModel,
|
|
27814
27898
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
27815
|
-
|
|
27816
|
-
|
|
27817
|
-
onSelectionModelChange: propsOnSelectionModelChange,
|
|
27899
|
+
onPaginationModelChange: propsOnPaginationModelChange,
|
|
27900
|
+
onRowSelectionModelChange: propsOnRowSelectionModelChange,
|
|
27818
27901
|
onColumnVisibilityModelChange: propsOnColumnVisibilityModelChange,
|
|
27819
27902
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
27820
27903
|
onSortModelChange: propsOnSortModelChange,
|
|
@@ -27822,7 +27905,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27822
27905
|
paginationPlacement = 'both',
|
|
27823
27906
|
paginationProps,
|
|
27824
27907
|
rows,
|
|
27825
|
-
|
|
27908
|
+
pageSizeOptions,
|
|
27826
27909
|
sx,
|
|
27827
27910
|
theme: propsTheme,
|
|
27828
27911
|
useRouter,
|
|
@@ -27833,43 +27916,38 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27833
27916
|
const theme = useTheme$4(propsTheme);
|
|
27834
27917
|
const _apiRef = useGridApiRef();
|
|
27835
27918
|
const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
|
|
27836
|
-
const RenderedToolbar =
|
|
27919
|
+
const RenderedToolbar = slots !== null && slots !== void 0 && slots.toolbar ? slots.toolbar : Toolbar$2;
|
|
27837
27920
|
LicenseInfo.setLicenseKey(license);
|
|
27838
27921
|
const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
|
|
27839
27922
|
const {
|
|
27840
27923
|
onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
|
|
27841
27924
|
onFilterModelChange: controlledOnFilterModelChange,
|
|
27842
|
-
|
|
27843
|
-
onPageSizeChange: controlledOnPageSizeChange,
|
|
27925
|
+
onPaginationModelChange: controlledOnPaginationModelChange,
|
|
27844
27926
|
onPinnedColumnsChange: controlledOnPinnedColumnsChange,
|
|
27845
27927
|
onSortModelChange: controlledOnSortModelChange
|
|
27846
27928
|
} = useControlledDatagridState({
|
|
27847
27929
|
initialState,
|
|
27848
|
-
|
|
27930
|
+
pageSizeOptions,
|
|
27849
27931
|
propsColumnVisibilityModel,
|
|
27850
27932
|
propsFilterModel,
|
|
27851
27933
|
propsOnColumnVisibilityModelChange,
|
|
27852
27934
|
propsOnFilterModelChange,
|
|
27853
27935
|
propsOnPinnedColumnsChange,
|
|
27854
27936
|
propsOnSortModelChange,
|
|
27855
|
-
|
|
27856
|
-
propsPageSize,
|
|
27937
|
+
propsPaginationModel,
|
|
27857
27938
|
propsPinnedColumns,
|
|
27858
27939
|
propsSortModel,
|
|
27859
|
-
|
|
27860
|
-
propsOnPageSizeChange
|
|
27940
|
+
propsOnPaginationModelChange
|
|
27861
27941
|
});
|
|
27862
27942
|
const {
|
|
27863
27943
|
columnVisibilityModel,
|
|
27864
27944
|
filterModel,
|
|
27865
27945
|
onColumnVisibilityModelChange,
|
|
27866
27946
|
onFilterModelChange,
|
|
27867
|
-
|
|
27868
|
-
onPageSizeChange,
|
|
27947
|
+
onPaginationModelChange,
|
|
27869
27948
|
onPinnedColumnsChange,
|
|
27870
27949
|
onSortModelChange,
|
|
27871
|
-
|
|
27872
|
-
pageSize,
|
|
27950
|
+
paginationModel,
|
|
27873
27951
|
pinnedColumns,
|
|
27874
27952
|
sortModel,
|
|
27875
27953
|
onColumnWidthChange
|
|
@@ -27880,40 +27958,39 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27880
27958
|
onColumnVisibilityModelChange: controlledOnColumnVisibilityModelChange,
|
|
27881
27959
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
27882
27960
|
onFilterModelChange: controlledOnFilterModelChange,
|
|
27883
|
-
|
|
27884
|
-
onPageSizeChange: controlledOnPageSizeChange,
|
|
27961
|
+
onPaginationModelChange: controlledOnPaginationModelChange,
|
|
27885
27962
|
onPinnedColumnsChange: controlledOnPinnedColumnsChange,
|
|
27886
27963
|
onSortModelChange: controlledOnSortModelChange,
|
|
27887
27964
|
useRouter: useRouter,
|
|
27888
27965
|
localStorageVersion,
|
|
27889
27966
|
previousLocalStorageVersions
|
|
27890
27967
|
});
|
|
27891
|
-
const [
|
|
27968
|
+
const [rowSelectionModel, setRowSelectionModel] = useState(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
27892
27969
|
useEffect(() => {
|
|
27893
|
-
|
|
27894
|
-
}, [
|
|
27895
|
-
const
|
|
27896
|
-
if (
|
|
27897
|
-
|
|
27970
|
+
setRowSelectionModel(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
27971
|
+
}, [propsRowSelectionModel]);
|
|
27972
|
+
const onRowSelectionModelChange = (selectionModel, details) => {
|
|
27973
|
+
if (propsOnRowSelectionModelChange) {
|
|
27974
|
+
propsOnRowSelectionModelChange(selectionModel, details);
|
|
27898
27975
|
} else {
|
|
27899
|
-
|
|
27976
|
+
setRowSelectionModel(selectionModel);
|
|
27900
27977
|
}
|
|
27901
27978
|
};
|
|
27902
27979
|
const selectionStatus = useRef({
|
|
27903
27980
|
type: 'none',
|
|
27904
27981
|
numberOfSelectedRows: 0,
|
|
27905
27982
|
numberOfSelectedRowsInPage: 0,
|
|
27906
|
-
page,
|
|
27907
|
-
pageSize: pageSize
|
|
27983
|
+
page: paginationModel.page,
|
|
27984
|
+
pageSize: paginationModel.pageSize
|
|
27908
27985
|
});
|
|
27909
27986
|
|
|
27910
27987
|
// in server-side pagination we want to update the selection status
|
|
27911
27988
|
// every time we navigate between pages, resize our page or select something
|
|
27912
27989
|
useEffect(() => {
|
|
27913
27990
|
if (paginationMode == 'server') {
|
|
27914
|
-
onServerSideSelectionStatusChange(Array.isArray(
|
|
27991
|
+
onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatus, isRowSelectable, paginationModel.page, paginationModel.pageSize);
|
|
27915
27992
|
}
|
|
27916
|
-
}, [
|
|
27993
|
+
}, [rowSelectionModel, paginationModel.page, paginationModel.pageSize]);
|
|
27917
27994
|
if (!Array.isArray(rows)) {
|
|
27918
27995
|
return null;
|
|
27919
27996
|
}
|
|
@@ -27946,15 +28023,13 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27946
28023
|
filterModel: filterModel,
|
|
27947
28024
|
onColumnVisibilityModelChange: onColumnVisibilityModelChange,
|
|
27948
28025
|
onFilterModelChange: onFilterModelChange,
|
|
27949
|
-
|
|
27950
|
-
onPageSizeChange: onPageSizeChange,
|
|
28026
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
27951
28027
|
onPinnedColumnsChange: onPinnedColumnsChange,
|
|
27952
28028
|
onSortModelChange: onSortModelChange,
|
|
27953
|
-
|
|
27954
|
-
pageSize: pageSize,
|
|
28029
|
+
paginationModel: paginationModel,
|
|
27955
28030
|
pinnedColumns: pinnedColumns,
|
|
27956
28031
|
sortModel: sortModel,
|
|
27957
|
-
|
|
28032
|
+
pageSizeOptions: pageSizeOptions,
|
|
27958
28033
|
onColumnWidthChange: onColumnWidthChange,
|
|
27959
28034
|
initialState: initialState,
|
|
27960
28035
|
isRowSelectable: isRowSelectable,
|
|
@@ -27965,58 +28040,55 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27965
28040
|
rowCount: rowCount,
|
|
27966
28041
|
autoHeight: autoHeight,
|
|
27967
28042
|
checkboxSelectionVisibleOnly: Boolean(pagination),
|
|
27968
|
-
|
|
27969
|
-
|
|
27970
|
-
|
|
27971
|
-
|
|
27972
|
-
|
|
27973
|
-
|
|
27974
|
-
ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
28043
|
+
slots: _objectSpread2(_objectSpread2({
|
|
28044
|
+
baseButton: BaseButton,
|
|
28045
|
+
baseCheckbox: BaseCheckbox,
|
|
28046
|
+
// baseTextField,
|
|
28047
|
+
basePopper: BasePopper,
|
|
28048
|
+
columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27975
28049
|
displayName: "ColumnFilteredIcon"
|
|
27976
28050
|
})),
|
|
27977
|
-
|
|
28051
|
+
columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27978
28052
|
displayName: "ColumnSelectorIcon"
|
|
27979
28053
|
})),
|
|
27980
|
-
|
|
28054
|
+
columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27981
28055
|
displayName: "ColumnSortedAscendingIcon"
|
|
27982
28056
|
})),
|
|
27983
|
-
|
|
28057
|
+
columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27984
28058
|
displayName: "ColumnSortedDescendingIcon"
|
|
27985
28059
|
})),
|
|
27986
|
-
|
|
28060
|
+
densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27987
28061
|
displayName: "DensityCompactIcon"
|
|
27988
28062
|
})),
|
|
27989
|
-
|
|
28063
|
+
densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27990
28064
|
displayName: "DensityStandardIcon"
|
|
27991
28065
|
})),
|
|
27992
|
-
|
|
28066
|
+
densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27993
28067
|
displayName: "DensityComfortableIcon"
|
|
27994
28068
|
})),
|
|
27995
|
-
|
|
28069
|
+
detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27996
28070
|
displayName: "DetailPanelCollapseIcon"
|
|
27997
28071
|
})),
|
|
27998
|
-
|
|
28072
|
+
detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
27999
28073
|
displayName: "DetailPanelExpandIcon"
|
|
28000
28074
|
})),
|
|
28001
|
-
|
|
28075
|
+
exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({}, props, {
|
|
28002
28076
|
displayName: "ExportIcon"
|
|
28003
28077
|
})),
|
|
28004
|
-
|
|
28078
|
+
openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$1({
|
|
28005
28079
|
displayName: "OpenFilterButtonIcon"
|
|
28006
28080
|
}, props))
|
|
28007
|
-
},
|
|
28008
|
-
|
|
28009
|
-
|
|
28081
|
+
}, slots), {}, {
|
|
28082
|
+
toolbar: ToolbarWrapper,
|
|
28083
|
+
pagination: props => {
|
|
28010
28084
|
return pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends$1({}, props, {
|
|
28011
28085
|
displaySelection: false,
|
|
28012
28086
|
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
28013
28087
|
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
28014
28088
|
selectionStatus: selectionStatus.current,
|
|
28015
|
-
|
|
28016
|
-
|
|
28017
|
-
|
|
28018
|
-
onPageSizeChange: onPageSizeChange,
|
|
28019
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
28089
|
+
paginationModel: paginationModel,
|
|
28090
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
28091
|
+
pageSizeOptions: pageSizeOptions,
|
|
28020
28092
|
paginationProps: paginationProps,
|
|
28021
28093
|
paginationMode: paginationMode,
|
|
28022
28094
|
rowCount: rowCount
|
|
@@ -28027,17 +28099,15 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
28027
28099
|
selectionStatus: selectionStatus.current,
|
|
28028
28100
|
apiRef: apiRef,
|
|
28029
28101
|
isRowSelectable: isRowSelectable,
|
|
28030
|
-
|
|
28031
|
-
|
|
28032
|
-
|
|
28033
|
-
onPageSizeChange: onPageSizeChange,
|
|
28034
|
-
rowsPerPageOptions: rowsPerPageOptions,
|
|
28102
|
+
paginationModel: paginationModel,
|
|
28103
|
+
onPaginationModelChange: onPaginationModelChange,
|
|
28104
|
+
pageSizeOptions: pageSizeOptions,
|
|
28035
28105
|
paginationProps: paginationProps,
|
|
28036
28106
|
paginationMode: paginationMode
|
|
28037
28107
|
})) : null;
|
|
28038
28108
|
}
|
|
28039
28109
|
}),
|
|
28040
|
-
|
|
28110
|
+
slotProps: _objectSpread2(_objectSpread2({}, slotProps), {}, {
|
|
28041
28111
|
toolbar: _objectSpread2({
|
|
28042
28112
|
hideToolbar,
|
|
28043
28113
|
RenderedToolbar,
|
|
@@ -28048,18 +28118,16 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
28048
28118
|
selectionStatus,
|
|
28049
28119
|
apiRef,
|
|
28050
28120
|
isRowSelectable,
|
|
28051
|
-
|
|
28052
|
-
|
|
28053
|
-
|
|
28054
|
-
onPageSizeChange,
|
|
28055
|
-
rowsPerPageOptions,
|
|
28121
|
+
paginationModel,
|
|
28122
|
+
onPaginationModelChange,
|
|
28123
|
+
pageSizeOptions,
|
|
28056
28124
|
paginationProps,
|
|
28057
28125
|
paginationMode,
|
|
28058
28126
|
rowCount
|
|
28059
|
-
},
|
|
28127
|
+
}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar)
|
|
28060
28128
|
}),
|
|
28061
|
-
|
|
28062
|
-
|
|
28129
|
+
rowSelectionModel: rowSelectionModel,
|
|
28130
|
+
onRowSelectionModelChange: (newSelectionModel, details) => {
|
|
28063
28131
|
if (pagination && paginationMode != 'server') {
|
|
28064
28132
|
const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
|
|
28065
28133
|
let {
|
|
@@ -28117,7 +28185,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
28117
28185
|
};
|
|
28118
28186
|
}
|
|
28119
28187
|
}
|
|
28120
|
-
|
|
28188
|
+
onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
|
|
28121
28189
|
},
|
|
28122
28190
|
sx: _objectSpread2(_objectSpread2({}, sx), {}, {
|
|
28123
28191
|
'.MuiDataGrid-columnHeaders': {
|
|
@@ -28191,5 +28259,5 @@ const TextCell = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
28191
28259
|
TextCell.className = CLASSNAME;
|
|
28192
28260
|
TextCell.displayName = COMPONENT_NAME;
|
|
28193
28261
|
|
|
28194
|
-
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 };
|
|
28262
|
+
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, DOES_NOT_HAVE, DOES_NOT_HAVE_WITH_SELECT, DataGrid, ENDS_WITH_ANY_OF, FILTER_MODEL_KEY, FILTER_SEARCH_KEY, GridToolbarFilterSemanticField, HAS, HAS_ANY_OF, HAS_ANY_OF_WITH_SELECT, HAS_ONLY, HAS_ONLY_WITH_SELECT, HAS_WITH_SELECT, IS, IS_ANY_OF, IS_ANY_OF_WITH_SELECT, IS_BETWEEN, IS_NOT, IS_NOT_ANY_OF, IS_NOT_ANY_OF_WITH_SELECT, IS_NOT_WITH_SELECT, IS_WITH_SELECT, 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, getGridStringArrayOperatorsWithSelect, getGridStringArrayOperatorsWithSelectOnStringArrayColumns, getGridStringOperators, getModelsParsedOrUpdateLocalStorage, getPaginationFromString, getPinnedColumnsFromString, getRsMultipleSelectColumnType, getRsMultipleSelectWithShortOperatorListColumnType, getRsNumberColumnType, getRsSingleSelectColumnType, getRsSingleSelectWithShortOperatorListColumnType, getRsStringColumnType, getSearchParamsFromColumnVisibility, getSearchParamsFromFilterModel, getSearchParamsFromPagination, getSearchParamsFromPinnedColumns, getSearchParamsFromSorting, getSearchParamsFromTab, getSortingFromString, isOperatorValueValid, isValueValid, muiIconToDSIcon, numberOperatorDecoder, numberOperatorEncoder, onServerSideSelectionStatusChange, operatorList, updateUrl, urlSearchParamsToString };
|
|
28195
28263
|
//# sourceMappingURL=index.js.map
|