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