vxe-table
Version:
A PC-end table component based on Vxe UI, supporting copy-paste, data pivot table, and high-performance virtual list table solution.
47 lines (46 loc) • 1.36 kB
JavaScript
import XEUtils from "xe-utils";
import { addClass, removeClass } from "./dom";
const rowMoveCls = "row--drag-move";
const colMoveClass = "col--drag-move";
function moveRowAnimateToTb(elemList, offsetTop) {
XEUtils.arrayEach(elemList, (trEl) => {
trEl.style.transform = `translateY(${offsetTop}px)`;
});
requestAnimationFrame(() => {
XEUtils.arrayEach(elemList, (trEl) => {
addClass(trEl, rowMoveCls);
trEl.style.transform = "";
});
});
}
function clearRowAnimate(elem, clss) {
setTimeout(() => {
if (elem) {
XEUtils.arrayEach(elem.querySelectorAll(clss.map((cls) => `${cls}.${rowMoveCls}`).join(",")), (elem2) => removeClass(elem2, rowMoveCls));
}
}, 500);
}
function moveColAnimateToLr(elemList, offsetLeft) {
XEUtils.arrayEach(elemList, (trEl) => {
trEl.style.transform = `translateX(${offsetLeft}px)`;
});
requestAnimationFrame(() => {
XEUtils.arrayEach(elemList, (trEl) => {
addClass(trEl, colMoveClass);
trEl.style.transform = "";
});
});
}
function clearColAnimate(elem, clss) {
setTimeout(() => {
if (elem) {
XEUtils.arrayEach(elem.querySelectorAll(clss.map((cls) => `${cls}.${rowMoveCls}`).join(",")), (elem2) => removeClass(elem2, colMoveClass));
}
}, 500);
}
export {
clearColAnimate,
clearRowAnimate,
moveColAnimateToLr,
moveRowAnimateToTb
};