@ssplib/react-components 0.0.141 → 0.0.142
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.
|
@@ -350,7 +350,28 @@ function Table({ columns, fetchFunc, emptyMsg = {
|
|
|
350
350
|
}, [appliedFilters]);
|
|
351
351
|
const filterBasedOnList = (filteredList) => {
|
|
352
352
|
let rawList = JSON.parse(JSON.stringify(Array.isArray(startData) ? startData : (0, lodash_get_1.default)(startData, dataPath)));
|
|
353
|
-
if (filteredList.length
|
|
353
|
+
if (filteredList.length <= 0 || rawList.length <= 0) {
|
|
354
|
+
setList(rawList);
|
|
355
|
+
setPagCount(getCount(rawList));
|
|
356
|
+
setCurrentPage(0);
|
|
357
|
+
setListPage(1);
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
let canContinue = true;
|
|
361
|
+
// verificando todas as chaves existem, se a chave não existir, não pode continuar e nao faz nada
|
|
362
|
+
filteredList
|
|
363
|
+
.map((x) => x.keyName)
|
|
364
|
+
.forEach((x) => {
|
|
365
|
+
if (!canContinue)
|
|
366
|
+
return;
|
|
367
|
+
if (!Object.keys(rawList[0]).includes(x)) {
|
|
368
|
+
canContinue = false;
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
if (!canContinue) {
|
|
373
|
+
setAppliedFilters([]);
|
|
374
|
+
localStorage.setItem('tableFilters', JSON.stringify([]));
|
|
354
375
|
setList(rawList);
|
|
355
376
|
setPagCount(getCount(rawList));
|
|
356
377
|
setCurrentPage(0);
|
|
@@ -521,7 +542,7 @@ function Table({ columns, fetchFunc, emptyMsg = {
|
|
|
521
542
|
return 0;
|
|
522
543
|
});
|
|
523
544
|
}
|
|
524
|
-
appliedFilters.
|
|
545
|
+
appliedFilters.forEach((x) => {
|
|
525
546
|
if (!x.isDate)
|
|
526
547
|
category(x.type, x.keyName, x.uniqueName, x.customValue, x.referencekey);
|
|
527
548
|
else
|