fluid-dnd
Version:
An agnostic drag and drop library to sort all kind of lists. With current support for vue, react and svelte
49 lines (48 loc) • 1.18 kB
JavaScript
import { u as B, a as C, r as d, b as W, g as l, c as j, m as T, s as k, d as p, e as q, f as w } from "./index-CU_UvYra.js";
function z(r, m, u, g) {
const { animationDuration: v } = r, [f] = B(
r,
u,
g
), R = (s, e, o, t) => {
if (!o || !o.droppable || !o.config)
return;
const { droppable: i, config: n } = o;
let [a] = l(e, i);
a = [e, ...a].toReversed();
const A = j(
e,
"remove",
n.direction,
i
);
for (const [F, c] of a.entries())
F >= s && (T(c, A), setTimeout(() => {
t(c);
}, v));
}, S = (s) => {
q(m, v, !0), setTimeout(() => {
f(s), b(s, m);
}, v);
}, b = (s, e) => {
const [o] = l(s, e);
for (const t of [...o, s])
w(t);
}, h = (s, e, o, t) => {
const { removingClass: i, delayBeforeRemove: n } = r;
e == s && (C(o, i), setTimeout(() => {
y(s, e, o, t);
}, n));
}, y = (s, e, o, t) => {
const { removingClass: i, onRemoveAtEvent: n } = r;
d(o, i), W(o, m, !1, t), R(e, o, t, (a) => {
D(a), S(o);
}), n(s, !0);
}, D = (s) => {
k(s, v, p), T(s);
};
return [h];
}
export {
z as default
};