@ssplib/react-components 0.0.202 → 0.0.204
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.
- package/components/form/table/Table.js +17 -13
- package/package.json +1 -1
|
@@ -456,8 +456,8 @@ function Table({ columns, fetchFunc, emptyMsg = {
|
|
|
456
456
|
function category(type, keyName, uniqueName, customValue, referencekey) {
|
|
457
457
|
if (type === 'a-z') {
|
|
458
458
|
rawList = rawList.sort((a, b) => {
|
|
459
|
-
const aValue = a[keyName];
|
|
460
|
-
const bValue = b[keyName];
|
|
459
|
+
const aValue = String(a[keyName]);
|
|
460
|
+
const bValue = String(b[keyName]);
|
|
461
461
|
const valueA = typeof aValue === 'number' ? aValue : aValue.toLowerCase();
|
|
462
462
|
const valueB = typeof bValue === 'number' ? bValue : bValue.toLowerCase();
|
|
463
463
|
if (valueA < valueB) {
|
|
@@ -471,8 +471,8 @@ function Table({ columns, fetchFunc, emptyMsg = {
|
|
|
471
471
|
} //
|
|
472
472
|
else if (type === 'z-a') {
|
|
473
473
|
rawList = rawList.sort((a, b) => {
|
|
474
|
-
const aValue = a[keyName];
|
|
475
|
-
const bValue = b[keyName];
|
|
474
|
+
const aValue = String(a[keyName]);
|
|
475
|
+
const bValue = String(b[keyName]);
|
|
476
476
|
const valueA = typeof aValue === 'number' ? aValue : aValue.toLowerCase();
|
|
477
477
|
const valueB = typeof bValue === 'number' ? bValue : bValue.toLowerCase();
|
|
478
478
|
if (valueA < valueB) {
|
|
@@ -486,15 +486,17 @@ function Table({ columns, fetchFunc, emptyMsg = {
|
|
|
486
486
|
} //
|
|
487
487
|
else if (type === 'items') {
|
|
488
488
|
rawList = rawList
|
|
489
|
-
.filter((x) => x[keyName]
|
|
489
|
+
.filter((x) => String(x[keyName])
|
|
490
|
+
.toLowerCase()
|
|
491
|
+
.includes(customValue !== null && customValue !== void 0 ? customValue : ''))
|
|
490
492
|
.sort((a, b) => {
|
|
491
|
-
const aValue = a[keyName];
|
|
492
|
-
const bValue = b[keyName];
|
|
493
|
+
const aValue = String(a[keyName]);
|
|
494
|
+
const bValue = String(b[keyName]);
|
|
493
495
|
const valueA = typeof aValue === 'number' ? aValue : aValue.toLowerCase();
|
|
494
496
|
const valueB = typeof bValue === 'number' ? bValue : bValue.toLowerCase();
|
|
495
|
-
if (valueA.includes(customValue))
|
|
497
|
+
if (valueA.includes(customValue !== null && customValue !== void 0 ? customValue : ''))
|
|
496
498
|
return -1;
|
|
497
|
-
if (valueB.includes(customValue))
|
|
499
|
+
if (valueB.includes(customValue !== null && customValue !== void 0 ? customValue : ''))
|
|
498
500
|
return 1;
|
|
499
501
|
if (valueA < valueB) {
|
|
500
502
|
return -1;
|
|
@@ -507,7 +509,7 @@ function Table({ columns, fetchFunc, emptyMsg = {
|
|
|
507
509
|
if (referencekey) {
|
|
508
510
|
const data = [];
|
|
509
511
|
let newFiltered = rawList.filter((x) => {
|
|
510
|
-
const item = x[keyName];
|
|
512
|
+
const item = String(x[keyName]);
|
|
511
513
|
const value = typeof item === 'number' ? item : item.toLowerCase();
|
|
512
514
|
if (value === customValue) {
|
|
513
515
|
data.push(x);
|
|
@@ -516,8 +518,8 @@ function Table({ columns, fetchFunc, emptyMsg = {
|
|
|
516
518
|
return true;
|
|
517
519
|
});
|
|
518
520
|
data.sort((a, b) => {
|
|
519
|
-
const aValue = a[referencekey];
|
|
520
|
-
const bValue = b[referencekey];
|
|
521
|
+
const aValue = String(a[referencekey]);
|
|
522
|
+
const bValue = String(b[referencekey]);
|
|
521
523
|
const valueA = typeof aValue === 'number' ? aValue : aValue.toLowerCase();
|
|
522
524
|
const valueB = typeof bValue === 'number' ? bValue : bValue.toLowerCase();
|
|
523
525
|
if (valueA < valueB) {
|
|
@@ -574,7 +576,9 @@ function Table({ columns, fetchFunc, emptyMsg = {
|
|
|
574
576
|
function date(from, to, keyName) {
|
|
575
577
|
const separator = filterSeparator;
|
|
576
578
|
rawList = rawList.filter((x) => {
|
|
577
|
-
const dts = x[keyName]
|
|
579
|
+
const dts = String(x[keyName])
|
|
580
|
+
.split(separator)
|
|
581
|
+
.map((k) => { var _a, _b; return (_b = ((_a = k.match(/[0-9]+\/[0-9]+\/[0-9]+/)) !== null && _a !== void 0 ? _a : [])[0]) !== null && _b !== void 0 ? _b : ''; });
|
|
578
582
|
let inside = false;
|
|
579
583
|
dts.forEach((k) => {
|
|
580
584
|
if (inside)
|