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.cjs +21 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +21 -6
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +21 -6
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/html/table.js +17 -6
- package/src/html/table.test.js +12 -12
package/dist/index.cjs
CHANGED
@@ -1724,7 +1724,9 @@ var DataTable = function DataTable(props) {
|
|
1724
1724
|
expanded = _props$expanded === void 0 ? false : _props$expanded,
|
1725
1725
|
className = props.className,
|
1726
1726
|
_props$emptyMessage = props.emptyMessage,
|
1727
|
-
emptyMessage = _props$emptyMessage === void 0 ? "No Results Found" : _props$emptyMessage
|
1727
|
+
emptyMessage = _props$emptyMessage === void 0 ? "No Results Found" : _props$emptyMessage,
|
1728
|
+
_props$multisort = props.multisort,
|
1729
|
+
multisort = _props$multisort === void 0 ? false : _props$multisort;
|
1728
1730
|
|
1729
1731
|
var _useState = React.useState({}),
|
1730
1732
|
sortDir = _useState[0],
|
@@ -1735,11 +1737,19 @@ var DataTable = function DataTable(props) {
|
|
1735
1737
|
setAllChecked = _useState2[1];
|
1736
1738
|
|
1737
1739
|
function changeSort(id) {
|
1738
|
-
|
1740
|
+
if (multisort) {
|
1741
|
+
var _Object$assign;
|
1742
|
+
|
1743
|
+
var nextDir = sortDir[id] ? sortDir[id] * -1 : 1;
|
1744
|
+
var next = Object.assign({}, sortDir, (_Object$assign = {}, _Object$assign[id] = nextDir, _Object$assign));
|
1745
|
+
setSortDir(next);
|
1746
|
+
} else {
|
1747
|
+
var _setSortDir;
|
1748
|
+
|
1749
|
+
var _nextDir = sortDir[id] ? sortDir[id] * -1 : 1;
|
1739
1750
|
|
1740
|
-
|
1741
|
-
|
1742
|
-
setSortDir(next);
|
1751
|
+
setSortDir((_setSortDir = {}, _setSortDir[id] = _nextDir, _setSortDir));
|
1752
|
+
}
|
1743
1753
|
}
|
1744
1754
|
|
1745
1755
|
function multiSort(array, sortObject) {
|
@@ -1754,7 +1764,12 @@ var DataTable = function DataTable(props) {
|
|
1754
1764
|
}
|
1755
1765
|
|
1756
1766
|
var keySort = function keySort(a, b, direction) {
|
1757
|
-
direction = direction !== null ? direction : 1;
|
1767
|
+
direction = direction !== null ? direction : 1; // check if a and b are numbers and compare as numbers
|
1768
|
+
|
1769
|
+
if (!isNaN(a) && !isNaN(b)) {
|
1770
|
+
a = Number(a);
|
1771
|
+
b = Number(b);
|
1772
|
+
}
|
1758
1773
|
|
1759
1774
|
if (a === b) {
|
1760
1775
|
// If the values are the same, do not switch positions.
|