import XEUtils from "xe-utils";
import { addClass, removeClass } from "./dom.mjs";
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
};
