svelte-common 4.7.0 → 4.8.0
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/package.json +1 -1
- package/src/index.svelte +2 -1
- package/src/sorting.mjs +11 -1
package/package.json
CHANGED
package/src/index.svelte
CHANGED
package/src/sorting.mjs
CHANGED
|
@@ -10,7 +10,17 @@ export const orderByCycle = {
|
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Deliver next value in the order by cycle.
|
|
13
|
+
* SORT_NONE -> SORT_ASCENDING -> SORT_DESCENDING -> SORT_NONE ...
|
|
13
14
|
* @param {string} orderBy
|
|
14
15
|
* @returns {string} new order either SORT_NONE, SORT_ASCENDING or SORT_DESCENDING
|
|
15
16
|
*/
|
|
16
|
-
export function toggleOrdeBy(orderBy) { return orderByCycle[orderBy] ||
|
|
17
|
+
export function toggleOrdeBy(orderBy) { return orderByCycle[orderBy] || "none"; }
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Add sortable toggle to a node.
|
|
22
|
+
* @param {Node} node
|
|
23
|
+
*/
|
|
24
|
+
export function sortable(node) {
|
|
25
|
+
node.click = () => { node.sortable = toggleOrderBy(node.sortable); };
|
|
26
|
+
}
|