ideaz-element
Version:
<p align="center"> <a href="" target="_blank" rel="noopener noreferrer"> <img src="./docs/public/logo.svg" alt="Ideaz Element" width="180" style="width: 180px;" /> </a> </p>
47 lines (46 loc) • 1.25 kB
JavaScript
import { ref as g, nextTick as p } from "vue";
function x(s, d, o) {
const t = g(!1);
return { draggableOptions: [
{
selector: "tbody",
options: {
animation: 200,
handle: ".z-table-column-draggable",
ghostClass: "ghost",
dragClass: "drag-class",
onStart: () => {
t.value = !0;
},
onEnd: (n) => {
t.value = !1;
const { oldIndex: a, newIndex: r } = n, e = [...d.value], l = e[a];
e.splice(a, 1), e.splice(r, 0, l), s("update:data", e), s("drag-sort-end", d.value);
}
}
},
{
selector: ".el-table__header-wrapper tr",
options: {
animation: 150,
delay: 0,
ghostClass: "table-col__ghost",
onEnd: (n) => {
const { newIndex: a, oldIndex: r } = n, e = [...o.value], [l] = [...e.splice(r, 1)];
e.splice(a, 0, l), o.value = [], p(() => {
o.value = [...e], s(
"drag-column-end",
o.value.filter((c) => c.prop)[n.newIndex],
n.newIndex,
n.oldIndex
);
});
}
}
}
], dragging: t };
}
export {
x as useDraggable
};
//# sourceMappingURL=useDraggable.mjs.map