@ssplib/react-components 0.0.202 → 0.0.203

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.
@@ -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].toLowerCase().includes(customValue))
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ssplib/react-components",
3
- "version": "0.0.202",
3
+ "version": "0.0.203",
4
4
  "description": "SSP React Components",
5
5
  "main": "index.js",
6
6
  "author": "Pedro Henrique <sr.hudrick@gmail.com>",