@ssplib/react-components 0.0.237 → 0.0.239
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,10 +476,9 @@ 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
|
-
console.log(dt);
|
|
483
482
|
switch (dt.type) {
|
|
484
483
|
case 'number':
|
|
485
484
|
switch (dt.operator) {
|
|
@@ -569,12 +568,10 @@ hideTitleCSV = false, csvExcludeUpper = [], multipleDataPath = '', expandTextMax
|
|
|
569
568
|
});
|
|
570
569
|
break;
|
|
571
570
|
case 'entre':
|
|
571
|
+
const dateA = dt.value ? (0, dayjs_1.default)(dt.value, 'DD/MM/YYYY') : (0, dayjs_1.default)('01/01/2000', 'DD/MM/YYYY');
|
|
572
|
+
const dateB = dt.value2 ? (0, dayjs_1.default)(dt.value2, 'DD/MM/YYYY') : (0, dayjs_1.default)('31/12/2030', 'DD/MM/YYYY');
|
|
572
573
|
currentData.forEach((cd) => {
|
|
573
574
|
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
575
|
if ((value.isAfter(dateA) || value.isSame(dateA)) && (value.isBefore(dateB) || value.isSame(dateB))) {
|
|
579
576
|
filteredData.push(cd);
|
|
580
577
|
}
|
|
@@ -620,14 +617,12 @@ hideTitleCSV = false, csvExcludeUpper = [], multipleDataPath = '', expandTextMax
|
|
|
620
617
|
});
|
|
621
618
|
break;
|
|
622
619
|
case 'entre':
|
|
620
|
+
const dateA = dt.value ? (0, dayjs_1.default)(dt.value, 'DD/MM/YYYY') : (0, dayjs_1.default)('01/01/2000', 'DD/MM/YYYY');
|
|
621
|
+
const dateB = dt.value2 ? (0, dayjs_1.default)(dt.value2, 'DD/MM/YYYY') : (0, dayjs_1.default)('31/12/2030', 'DD/MM/YYYY');
|
|
623
622
|
currentData.forEach((cd) => {
|
|
624
623
|
var _a;
|
|
625
624
|
const dates = (_a = filtersFuncData[dt.customFunc]((0, lodash_get_1.default)(cd, dt.keyName, ''))) !== null && _a !== void 0 ? _a : [];
|
|
626
|
-
const dateA = (0, dayjs_1.default)(dt.value, 'DD/MM/YYYY');
|
|
627
|
-
const dateB = (0, dayjs_1.default)(dt.value2, 'DD/MM/YYYY');
|
|
628
625
|
let isBetween = false;
|
|
629
|
-
if (!dateA.isValid() || !dateB.isValid())
|
|
630
|
-
return;
|
|
631
626
|
dates.forEach((dtStr) => {
|
|
632
627
|
if (isBetween)
|
|
633
628
|
return;
|
|
@@ -763,7 +758,7 @@ hideTitleCSV = false, csvExcludeUpper = [], multipleDataPath = '', expandTextMax
|
|
|
763
758
|
" de ",
|
|
764
759
|
list.length)))),
|
|
765
760
|
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 : '[]')
|
|
766
|
-
.filter((x) => x.value)
|
|
761
|
+
.filter((x) => x.value || (x.operator === 'entre' && (x.value || x.value2)))
|
|
767
762
|
.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 },
|
|
768
763
|
react_1.default.createElement(Typography_1.default, { fontWeight: 700 }, x.label),
|
|
769
764
|
react_1.default.createElement(Typography_1.default, { fontStyle: 'italic' }, x.operator),
|
|
@@ -771,8 +766,8 @@ hideTitleCSV = false, csvExcludeUpper = [], multipleDataPath = '', expandTextMax
|
|
|
771
766
|
? x.value.map((x) => x.label).join(' - ')
|
|
772
767
|
: typeof x.value === 'object'
|
|
773
768
|
? x.value.label
|
|
774
|
-
: x.
|
|
775
|
-
? `${x.value} e ${x.value2}`
|
|
769
|
+
: x.operator === 'entre'
|
|
770
|
+
? `${x.value ? x.value : 'Antes'} e ${x.value2 ? x.value2 : 'Depois'}`
|
|
776
771
|
: x.value.toString()),
|
|
777
772
|
react_1.default.createElement(material_1.IconButton, { onClick: (e) => {
|
|
778
773
|
var _a;
|