wip
This commit is contained in:
1 parent
9f1650572c
commit
3d3748c353
7 files changed
+104
-266
No files matched your search
@@ -1 +0,0 @@
|
||||
(() => { function l(f) { f.directive("sort", (m, { modifiers: E, expression: I }, { Alpine: g, effect: v, evaluateLater: w }) => { let a = m.closest("[x-data]"); if (!a) return; let x = w(I), o = g.$data(a), [r] = E; v(() => { x(e => { let n = [...o[r]]; if (["asc", "desc"].includes(e)) { let c = e === "asc" ? n.sort((s, t) => s > t ? 1 : -1) : n.sort((s, t) => s < t ? 1 : -1); o[r] = c; return } let [y, ...p] = e.split("."), A = n.sort((c, s) => { let t = p.reduce((i, d) => i[d], c), u = p.reduce((i, d) => i[d], s); return y === "asc" ? t > u ? 1 : -1 : t < u ? 1 : -1 }); o[r] = A }) }) }) } document.addEventListener("alpine:init", () => window.Alpine.plugin(l)); })();
|
||||
@@ -1,6 +0,0 @@
|
||||
import sort from '@alpinejs/sort';
|
||||
|
||||
// Intercept the global document event before Filament initializes its engine
|
||||
document.addEventListener('alpine:init', () => {
|
||||
window.Alpine.plugin(sort);
|
||||
});
|
||||
Reference in new issue
Block a user