"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const index = require("../../store/index.js");
const cloneDeep$1 = require("../../../../node_modules/lodash-es/cloneDeep.js");
function cloneDeep(data) {
  return cloneDeep$1.default(data);
}
function setEditConfigData(data) {
  index.default.commit("set_edit_config_data", data);
}
function getEditConfigData() {
  return index.default.getters.editConfigData;
}
function setSelectedItem(item) {
  index.default.commit("set_selected_item", item);
}
function setHoverItem(item) {
  index.default.commit("set_hover_item", item);
}
function isHoverItem(item) {
  var _a;
  return ((_a = index.default.getters.hoverItem) == null ? void 0 : _a.id) == (item == null ? void 0 : item.id);
}
function isSelectedItem(item) {
  var _a;
  return ((_a = index.default.getters.selectedItem) == null ? void 0 : _a.id) == (item == null ? void 0 : item.id);
}
function getCurrentItem() {
  return index.default.getters.selectedItem;
}
function getCurrentClass(item) {
  return {
    "is-hover": isHoverItem(item),
    "is-select": isSelectedItem(item)
  };
}
function setEditConfigDataSources(dataSources) {
  const editConfigData = index.default.getters.editConfigData;
  editConfigData.dataSources = dataSources;
  index.default.commit("set_edit_config_data", editConfigData);
}
function getEditConfigDialogs() {
  return index.default.getters.editConfigData.dialogs || [];
}
function setEditConfigDialogs(dialogs) {
  const editConfigData = index.default.getters.editConfigData;
  editConfigData.dialogs = dialogs;
  index.default.commit("set_edit_config_data", editConfigData);
}
function getEditConfigDataSources() {
  return index.default.getters.editConfigData.dataSources;
}
function getEditConfigDataFields() {
  const editingType = index.default.getters.editingType;
  const fieldsData = index.default.getters.editConfigData.fieldsData;
  switch (editingType) {
    case "table":
      return fieldsData;
    case "form":
      return fieldsData.map((item) => item.component);
  }
  return fieldsData;
}
function getEditingType() {
  return index.default.getters.editingType;
}
exports.cloneDeep = cloneDeep;
exports.getCurrentClass = getCurrentClass;
exports.getCurrentItem = getCurrentItem;
exports.getEditConfigData = getEditConfigData;
exports.getEditConfigDataFields = getEditConfigDataFields;
exports.getEditConfigDataSources = getEditConfigDataSources;
exports.getEditConfigDialogs = getEditConfigDialogs;
exports.getEditingType = getEditingType;
exports.isHoverItem = isHoverItem;
exports.isSelectedItem = isSelectedItem;
exports.setEditConfigData = setEditConfigData;
exports.setEditConfigDataSources = setEditConfigDataSources;
exports.setEditConfigDialogs = setEditConfigDialogs;
exports.setHoverItem = setHoverItem;
exports.setSelectedItem = setSelectedItem;
