ywana-core8 0.0.779 → 0.0.781

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/dist/index.umd.js CHANGED
@@ -1718,7 +1718,9 @@
1718
1718
  expanded = _props$expanded === void 0 ? false : _props$expanded,
1719
1719
  className = props.className,
1720
1720
  _props$emptyMessage = props.emptyMessage,
1721
- emptyMessage = _props$emptyMessage === void 0 ? "No Results Found" : _props$emptyMessage;
1721
+ emptyMessage = _props$emptyMessage === void 0 ? "No Results Found" : _props$emptyMessage,
1722
+ _props$multisort = props.multisort,
1723
+ multisort = _props$multisort === void 0 ? false : _props$multisort;
1722
1724
 
1723
1725
  var _useState = React.useState({}),
1724
1726
  sortDir = _useState[0],
@@ -1729,11 +1731,19 @@
1729
1731
  setAllChecked = _useState2[1];
1730
1732
 
1731
1733
  function changeSort(id) {
1732
- var _Object$assign;
1734
+ if (multisort) {
1735
+ var _Object$assign;
1736
+
1737
+ var nextDir = sortDir[id] ? sortDir[id] * -1 : 1;
1738
+ var next = Object.assign({}, sortDir, (_Object$assign = {}, _Object$assign[id] = nextDir, _Object$assign));
1739
+ setSortDir(next);
1740
+ } else {
1741
+ var _setSortDir;
1742
+
1743
+ var _nextDir = sortDir[id] ? sortDir[id] * -1 : 1;
1733
1744
 
1734
- var nextDir = sortDir[id] ? sortDir[id] * -1 : 1;
1735
- var next = Object.assign({}, sortDir, (_Object$assign = {}, _Object$assign[id] = nextDir, _Object$assign));
1736
- setSortDir(next);
1745
+ setSortDir((_setSortDir = {}, _setSortDir[id] = _nextDir, _setSortDir));
1746
+ }
1737
1747
  }
1738
1748
 
1739
1749
  function multiSort(array, sortObject) {
@@ -1748,7 +1758,12 @@
1748
1758
  }
1749
1759
 
1750
1760
  var keySort = function keySort(a, b, direction) {
1751
- direction = direction !== null ? direction : 1;
1761
+ direction = direction !== null ? direction : 1; // check if a and b are numbers and compare as numbers
1762
+
1763
+ if (!isNaN(a) && !isNaN(b)) {
1764
+ a = Number(a);
1765
+ b = Number(b);
1766
+ }
1752
1767
 
1753
1768
  if (a === b) {
1754
1769
  // If the values are the same, do not switch positions.