@ssplib/react-components 0.0.227 → 0.0.228
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.
|
@@ -67,8 +67,8 @@ interface FilterValue {
|
|
|
67
67
|
type: FilterType;
|
|
68
68
|
operator: FilterOperators;
|
|
69
69
|
operators: FilterOperators[];
|
|
70
|
-
value: string | any
|
|
71
|
-
value2?: string | any
|
|
70
|
+
value: string | any;
|
|
71
|
+
value2?: string | any;
|
|
72
72
|
useList?: {
|
|
73
73
|
id: string;
|
|
74
74
|
label: string;
|
|
@@ -504,8 +504,15 @@ hideTitleCSV = false, csvExcludeUpper = [], multipleDataPath = '', expandTextMax
|
|
|
504
504
|
case 'contem':
|
|
505
505
|
currentData.forEach((cd) => {
|
|
506
506
|
const value = (0, lodash_get_1.default)(cd, dt.keyName, '');
|
|
507
|
-
if (
|
|
508
|
-
|
|
507
|
+
if (dt.useList) {
|
|
508
|
+
if (value.includes(dt.value.id)) {
|
|
509
|
+
filteredData.push(cd);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
else {
|
|
513
|
+
if (value.includes(dt.value)) {
|
|
514
|
+
filteredData.push(cd);
|
|
515
|
+
}
|
|
509
516
|
}
|
|
510
517
|
});
|
|
511
518
|
break;
|
|
@@ -669,7 +676,11 @@ hideTitleCSV = false, csvExcludeUpper = [], multipleDataPath = '', expandTextMax
|
|
|
669
676
|
.map((x) => (react_1.default.createElement(material_1.Stack, { direction: 'row', spacing: 1, bgcolor: '#4e85c1', color: 'white', width: 'fit-content', paddingY: 0.5, borderRadius: 2, paddingX: 1, m: 0.5 },
|
|
670
677
|
react_1.default.createElement(Typography_1.default, { fontWeight: 700 }, x.label),
|
|
671
678
|
react_1.default.createElement(Typography_1.default, { fontStyle: 'italic' }, x.operator),
|
|
672
|
-
react_1.default.createElement(Typography_1.default, { bgcolor: 'white', borderRadius: 2, paddingX: 1, color: 'black' },
|
|
679
|
+
react_1.default.createElement(Typography_1.default, { bgcolor: 'white', borderRadius: 2, paddingX: 1, color: 'black' }, Array.isArray(x.value)
|
|
680
|
+
? x.value.map((x) => x.label).join(' - ')
|
|
681
|
+
: typeof x.value === 'object'
|
|
682
|
+
? x.value.label
|
|
683
|
+
: x.value.toString()),
|
|
673
684
|
react_1.default.createElement(material_1.IconButton, { onClick: (e) => {
|
|
674
685
|
var _a;
|
|
675
686
|
let currentValue = JSON.parse((_a = localStorage.getItem(localTableName)) !== null && _a !== void 0 ? _a : '[]');
|
|
@@ -882,13 +893,17 @@ function FilterField({ filterValue, operator, onChange }) {
|
|
|
882
893
|
switch (operator) {
|
|
883
894
|
case 'tem um dos':
|
|
884
895
|
return (react_1.default.createElement(material_1.Autocomplete, { multiple: true, id: 'tags-standard', onChange: (e, value) => {
|
|
896
|
+
if (value.length <= 0) {
|
|
897
|
+
onChange('');
|
|
898
|
+
return;
|
|
899
|
+
}
|
|
885
900
|
onChange(value);
|
|
886
901
|
}, options: filterValue.useList, defaultValue: Array.isArray(filterValue.value) ? filterValue.value : [], renderInput: (params) => react_1.default.createElement(TextField_1.default, Object.assign({}, params, { variant: 'standard', placeholder: 'Escolha os valores', fullWidth: true })), fullWidth: true }));
|
|
887
902
|
case 'contem':
|
|
888
903
|
return (react_1.default.createElement(material_1.Box, { width: '100%' },
|
|
889
904
|
react_1.default.createElement(material_1.Autocomplete, { options: filterValue.useList, onChange: (e, value) => {
|
|
890
|
-
onChange(value
|
|
891
|
-
}, defaultValue:
|
|
905
|
+
onChange(value);
|
|
906
|
+
}, defaultValue: typeof filterValue.value === 'object' ? filterValue.value : undefined, isOptionEqualToValue: (option, value) => option.label === value.label, renderInput: (params) => (react_1.default.createElement(TextField_1.default, Object.assign({}, params, { size: 'small', placeholder: 'Escolha um valor', fullWidth: true, sx: {
|
|
892
907
|
bgcolor: 'white',
|
|
893
908
|
} }))), fullWidth: true })));
|
|
894
909
|
}
|