"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.clearColAnimate = clearColAnimate;
exports.clearRowAnimate = clearRowAnimate;
exports.moveColAnimateToLr = moveColAnimateToLr;
exports.moveRowAnimateToTb = moveRowAnimateToTb;
var _xeUtils = _interopRequireDefault(require("xe-utils"));
var _dom = require("../../ui/src/dom");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
var rowMoveCls = 'row--drag-move';
var colMoveClass = 'col--drag-move';
/**
 * 上下拖拽
 */
function moveRowAnimateToTb(elemList, offsetTop) {
  _xeUtils.default.arrayEach(elemList, function (trEl) {
    trEl.style.transform = "translateY(".concat(offsetTop, "px)");
  });
  requestAnimationFrame(function () {
    _xeUtils.default.arrayEach(elemList, function (trEl) {
      (0, _dom.addClass)(trEl, rowMoveCls);
      trEl.style.transform = '';
    });
  });
}
function clearRowAnimate(elem, clss) {
  setTimeout(function () {
    if (elem) {
      _xeUtils.default.arrayEach(elem.querySelectorAll(clss.map(function (cls) {
        return "".concat(cls, ".").concat(rowMoveCls);
      }).join(',')), function (elem) {
        return (0, _dom.removeClass)(elem, rowMoveCls);
      });
    }
  }, 500);
}
/**
 * 左右拖拽
 */
function moveColAnimateToLr(elemList, offsetLeft) {
  _xeUtils.default.arrayEach(elemList, function (trEl) {
    trEl.style.transform = "translateX(".concat(offsetLeft, "px)");
  });
  requestAnimationFrame(function () {
    _xeUtils.default.arrayEach(elemList, function (trEl) {
      (0, _dom.addClass)(trEl, colMoveClass);
      trEl.style.transform = '';
    });
  });
}
function clearColAnimate(elem, clss) {
  setTimeout(function () {
    if (elem) {
      _xeUtils.default.arrayEach(elem.querySelectorAll(clss.map(function (cls) {
        return "".concat(cls, ".").concat(rowMoveCls);
      }).join(',')), function (elem) {
        return (0, _dom.removeClass)(elem, colMoveClass);
      });
    }
  }, 500);
}