@ssplib/react-components 0.0.236 → 0.0.238
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.
|
@@ -476,7 +476,7 @@ hideTitleCSV = false, csvExcludeUpper = [], multipleDataPath = '', expandTextMax
|
|
|
476
476
|
return;
|
|
477
477
|
let currentData = JSON.parse(JSON.stringify(startData));
|
|
478
478
|
filterData
|
|
479
|
-
.filter((dt) => dt.value)
|
|
479
|
+
.filter((dt) => dt.value || (dt.operator === 'entre' && (dt.value || dt.value2)))
|
|
480
480
|
.forEach((dt) => {
|
|
481
481
|
let filteredData = [];
|
|
482
482
|
console.log(dt);
|
|
@@ -569,12 +569,10 @@ hideTitleCSV = false, csvExcludeUpper = [], multipleDataPath = '', expandTextMax
|
|
|
569
569
|
});
|
|
570
570
|
break;
|
|
571
571
|
case 'entre':
|
|
572
|
+
const dateA = dt.value ? (0, dayjs_1.default)(dt.value, 'DD/MM/YYYY') : (0, dayjs_1.default)('01/01/2000', 'DD/MM/YYYY');
|
|
573
|
+
const dateB = dt.value2 ? (0, dayjs_1.default)(dt.value2, 'DD/MM/YYYY') : (0, dayjs_1.default)('31/12/2030', 'DD/MM/YYYY');
|
|
572
574
|
currentData.forEach((cd) => {
|
|
573
575
|
const value = (0, dayjs_1.default)((0, lodash_get_1.default)(cd, dt.keyName, ''), 'DD/MM/YYYY');
|
|
574
|
-
const dateA = (0, dayjs_1.default)(dt.value, 'DD/MM/YYYY');
|
|
575
|
-
const dateB = (0, dayjs_1.default)(dt.value2, 'DD/MM/YYYY');
|
|
576
|
-
if (!dateA.isValid() || !dateB.isValid())
|
|
577
|
-
return;
|
|
578
576
|
if ((value.isAfter(dateA) || value.isSame(dateA)) && (value.isBefore(dateB) || value.isSame(dateB))) {
|
|
579
577
|
filteredData.push(cd);
|
|
580
578
|
}
|
|
@@ -619,6 +617,28 @@ hideTitleCSV = false, csvExcludeUpper = [], multipleDataPath = '', expandTextMax
|
|
|
619
617
|
}
|
|
620
618
|
});
|
|
621
619
|
break;
|
|
620
|
+
case 'entre':
|
|
621
|
+
const dateA = dt.value ? (0, dayjs_1.default)(dt.value, 'DD/MM/YYYY') : (0, dayjs_1.default)('01/01/2000', 'DD/MM/YYYY');
|
|
622
|
+
const dateB = dt.value2 ? (0, dayjs_1.default)(dt.value2, 'DD/MM/YYYY') : (0, dayjs_1.default)('31/12/2030', 'DD/MM/YYYY');
|
|
623
|
+
currentData.forEach((cd) => {
|
|
624
|
+
var _a;
|
|
625
|
+
const dates = (_a = filtersFuncData[dt.customFunc]((0, lodash_get_1.default)(cd, dt.keyName, ''))) !== null && _a !== void 0 ? _a : [];
|
|
626
|
+
let isBetween = false;
|
|
627
|
+
dates.forEach((dtStr) => {
|
|
628
|
+
if (isBetween)
|
|
629
|
+
return;
|
|
630
|
+
const dt = (0, dayjs_1.default)(dtStr, 'DD/MM/YYYY');
|
|
631
|
+
if (!dt.isValid())
|
|
632
|
+
return;
|
|
633
|
+
if ((dt.isAfter(dateA) || dt.isSame(dateA)) && (dt.isBefore(dateB) || dt.isSame(dateB))) {
|
|
634
|
+
isBetween = true;
|
|
635
|
+
}
|
|
636
|
+
});
|
|
637
|
+
if (isBetween) {
|
|
638
|
+
filteredData.push(cd);
|
|
639
|
+
}
|
|
640
|
+
});
|
|
641
|
+
break;
|
|
622
642
|
}
|
|
623
643
|
break;
|
|
624
644
|
}
|
|
@@ -739,7 +759,7 @@ hideTitleCSV = false, csvExcludeUpper = [], multipleDataPath = '', expandTextMax
|
|
|
739
759
|
" de ",
|
|
740
760
|
list.length)))),
|
|
741
761
|
localStorage.getItem(localTableName) && (react_1.default.createElement(material_1.Box, { display: 'inline-flex', flexWrap: 'wrap', padding: 0.5, borderRadius: 4, marginBottom: 1 }, JSON.parse((_a = localStorage.getItem(localTableName)) !== null && _a !== void 0 ? _a : '[]')
|
|
742
|
-
.filter((x) => x.value)
|
|
762
|
+
.filter((x) => x.value || (x.operator === 'entre' && (x.value || x.value2)))
|
|
743
763
|
.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 },
|
|
744
764
|
react_1.default.createElement(Typography_1.default, { fontWeight: 700 }, x.label),
|
|
745
765
|
react_1.default.createElement(Typography_1.default, { fontStyle: 'italic' }, x.operator),
|
|
@@ -747,7 +767,9 @@ hideTitleCSV = false, csvExcludeUpper = [], multipleDataPath = '', expandTextMax
|
|
|
747
767
|
? x.value.map((x) => x.label).join(' - ')
|
|
748
768
|
: typeof x.value === 'object'
|
|
749
769
|
? x.value.label
|
|
750
|
-
: x.
|
|
770
|
+
: x.operator === 'entre'
|
|
771
|
+
? `${x.value ? x.value : 'Antes'} e ${x.value2 ? x.value2 : 'Depois'}`
|
|
772
|
+
: x.value.toString()),
|
|
751
773
|
react_1.default.createElement(material_1.IconButton, { onClick: (e) => {
|
|
752
774
|
var _a;
|
|
753
775
|
let currentValue = JSON.parse((_a = localStorage.getItem(localTableName)) !== null && _a !== void 0 ? _a : '[]');
|