@ssplib/react-components 0.0.226 → 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;
|
|
@@ -623,8 +630,7 @@ hideTitleCSV = false, csvExcludeUpper = [], multipleDataPath = '', expandTextMax
|
|
|
623
630
|
borderRadius: '50px',
|
|
624
631
|
maxWidth: '600px',
|
|
625
632
|
}, size: 'small', onChange: onInputChange, fullWidth: true, placeholder: `Pesquisar ${tableName}` }),
|
|
626
|
-
Modal_1.MODAL.
|
|
627
|
-
react_1.default.createElement(material_1.Button, { startIcon: react_1.default.createElement(icons_material_1.FilterAlt, null), variant: 'contained', onClick: (e) => Modal_1.MODAL.openReparented(0), sx: {
|
|
633
|
+
react_1.default.createElement(material_1.Button, { startIcon: react_1.default.createElement(icons_material_1.FilterAlt, null), variant: 'contained', onClick: (e) => Modal_1.MODAL.open(react_1.default.createElement(CriarFiltro, { key: filterKey, reset: reset, filtrar: filtrar, baseFilters: [...filters], filters: localStorage.getItem(localTableName) ? JSON.parse(localStorage.getItem(localTableName)) : [...filters] })), sx: {
|
|
628
634
|
borderRadius: 3,
|
|
629
635
|
paddingX: '24px',
|
|
630
636
|
paddingY: '8px',
|
|
@@ -670,7 +676,11 @@ hideTitleCSV = false, csvExcludeUpper = [], multipleDataPath = '', expandTextMax
|
|
|
670
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 },
|
|
671
677
|
react_1.default.createElement(Typography_1.default, { fontWeight: 700 }, x.label),
|
|
672
678
|
react_1.default.createElement(Typography_1.default, { fontStyle: 'italic' }, x.operator),
|
|
673
|
-
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()),
|
|
674
684
|
react_1.default.createElement(material_1.IconButton, { onClick: (e) => {
|
|
675
685
|
var _a;
|
|
676
686
|
let currentValue = JSON.parse((_a = localStorage.getItem(localTableName)) !== null && _a !== void 0 ? _a : '[]');
|
|
@@ -883,13 +893,17 @@ function FilterField({ filterValue, operator, onChange }) {
|
|
|
883
893
|
switch (operator) {
|
|
884
894
|
case 'tem um dos':
|
|
885
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
|
+
}
|
|
886
900
|
onChange(value);
|
|
887
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 }));
|
|
888
902
|
case 'contem':
|
|
889
903
|
return (react_1.default.createElement(material_1.Box, { width: '100%' },
|
|
890
904
|
react_1.default.createElement(material_1.Autocomplete, { options: filterValue.useList, onChange: (e, value) => {
|
|
891
|
-
onChange(value
|
|
892
|
-
}, 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: {
|
|
893
907
|
bgcolor: 'white',
|
|
894
908
|
} }))), fullWidth: true })));
|
|
895
909
|
}
|