"use strict";

var _interopRequireDefault = require("E:/T/git/\u5965\u666ETeam/opu-components-vue/node_modules/@babel/runtime/helpers/interopRequireDefault.js").default;

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _objectSpread2 = _interopRequireDefault(require("E:/T/git/\u5965\u666ETeam/opu-components-vue/node_modules/@babel/runtime/helpers/esm/objectSpread2.js"));

var _extends2 = _interopRequireDefault(require("E:/T/git/\u5965\u666ETeam/opu-components-vue/node_modules/@babel/runtime/helpers/esm/extends.js"));

var _vue = _interopRequireDefault(require("vue"));

var _setColumns = _interopRequireDefault(require("./setColumns.js"));

var setColumnsConstructor = _vue.default.extend(_setColumns.default);

var setp = 1;

var setColumnsModal = function setColumnsModal(options) {
  if (_vue.default.prototype.$isServer) return;
  var rest = (0, _extends2.default)({}, options);
  var instance = new setColumnsConstructor({
    propsData: (0, _objectSpread2.default)({}, rest)
  });
  var id = "setColumnsModal_".concat(setp);
  instance.id = id;
  instance.vm = instance.$mount();
  document.body.appendChild(instance.vm.$el);
  instance.vm.visible = true;
  setp++; //绑定 submit 方法

  instance.vm.$on("submit", function (selecteds) {
    if (instance.submit) {
      instance.submit(selecteds);
    }
  });
  instance.vm.$on("cancel", function (selecteds) {
    if (instance.cancel) {
      instance.cancel(selecteds);
    }
  });
  instance.vm.$on("destroy", function () {
    document.body.removeChild(instance.vm.$el);
  });
  return instance.vm;
};

var _default = setColumnsModal;
exports.default = _default;