"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
require("../../../../node_modules/element-plus/es/index.js");
;/* empty css                                                          */
;/* empty css                                                             */
;/* empty css                                                               */
;/* empty css                                                               */
const Vue = require("vue");
const vueDraggablePlus = require("../../../../node_modules/vue-draggable-plus/dist/vue-draggable-plus.js");
const index$3 = require("../../../../node_modules/@element-plus/icons-vue/dist/index.js");
const common = require("../utils/common.js");
;/* empty css                        */
const _pluginVue_exportHelper = require("../../../../_virtual/_plugin-vue_export-helper.js");
const index = require("../../../../node_modules/element-plus/es/components/switch/index.js");
const index$1 = require("../../../../node_modules/element-plus/es/components/button/index.js");
const index$2 = require("../../../../node_modules/element-plus/es/components/icon/index.js");
const index$4 = require("../../../../node_modules/element-plus/es/components/link/index.js");
const _hoisted_1 = { class: "page-footer-setting" };
const _hoisted_2 = { class: "setting-left" };
const _hoisted_3 = { class: "setting-center" };
const _hoisted_4 = ["onMouseenter", "onClick"];
const _sfc_main = {
  __name: "PageFooterSetting",
  setup(__props) {
    const editConfigData = Vue.computed(() => {
      return common.getEditConfigData();
    });
    const pageFooterConfig = Vue.computed(() => {
      return editConfigData.value.pageFooterConfig || {
        enabled: true,
        actions: []
      };
    });
    function getBtnProps(item) {
      return {
        type: item.btnType
      };
    }
    function addAction() {
      const newBtn = {
        id: Date.now(),
        label: "按钮",
        type: "pageFooterBtn",
        btnType: "primary"
      };
      if (!pageFooterConfig.value.actions) {
        pageFooterConfig.value.actions = [];
      }
      pageFooterConfig.value.actions.push(newBtn);
    }
    function removeAction(item) {
      const index2 = pageFooterConfig.value.actions.findIndex(
        (i) => i.id === item.id
      );
      if (index2 !== -1) {
        pageFooterConfig.value.actions.splice(index2, 1);
      }
    }
    return (_ctx, _cache) => {
      const _component_el_switch = index.ElSwitch;
      const _component_el_button = index$1.ElButton;
      const _component_el_icon = index$2.ElIcon;
      const _component_el_link = index$4.ElLink;
      return Vue.openBlock(), Vue.createElementBlock("div", _hoisted_1, [
        Vue.createElementVNode("div", _hoisted_2, [
          _cache[3] || (_cache[3] = Vue.createElementVNode("span", { class: "text-label" }, "启用页尾", -1)),
          Vue.createVNode(_component_el_switch, {
            modelValue: pageFooterConfig.value.enabled,
            "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => pageFooterConfig.value.enabled = $event),
            size: "small"
          }, null, 8, ["modelValue"]),
          _cache[4] || (_cache[4] = Vue.createElementVNode("div", { class: "setting-divider" }, null, -1))
        ]),
        Vue.createElementVNode("div", _hoisted_3, [
          Vue.createVNode(Vue.unref(vueDraggablePlus.VueDraggable), {
            modelValue: pageFooterConfig.value.actions,
            "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => pageFooterConfig.value.actions = $event),
            animation: 150,
            group: { name: "pageFooterActions" },
            ghostClass: "ghost",
            class: "optBtnDraggable"
          }, {
            default: Vue.withCtx(() => [
              (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(pageFooterConfig.value.actions, (item) => {
                return Vue.openBlock(), Vue.createElementBlock("div", {
                  class: Vue.normalizeClass(["optBtn", Vue.unref(common.getCurrentClass)(item)]),
                  onMouseenter: ($event) => Vue.unref(common.setHoverItem)(item),
                  onMouseleave: _cache[1] || (_cache[1] = ($event) => Vue.unref(common.setHoverItem)()),
                  onClick: Vue.withModifiers(($event) => Vue.unref(common.setSelectedItem)(item), ["stop"])
                }, [
                  Vue.createVNode(_component_el_button, Vue.mergeProps({
                    class: "elBtn",
                    ref_for: true
                  }, getBtnProps(item)), {
                    default: Vue.withCtx(() => [
                      Vue.createTextVNode(Vue.toDisplayString(item.label), 1)
                    ]),
                    _: 2
                  }, 1040),
                  Vue.createVNode(_component_el_icon, {
                    class: "delete-icon",
                    onClick: Vue.withModifiers(($event) => removeAction(item), ["stop"])
                  }, {
                    default: Vue.withCtx(() => [
                      Vue.createVNode(Vue.unref(index$3.Close))
                    ]),
                    _: 2
                  }, 1032, ["onClick"])
                ], 42, _hoisted_4);
              }), 256))
            ]),
            _: 1
          }, 8, ["modelValue"]),
          Vue.createVNode(_component_el_link, {
            class: "optBtn addLink",
            underline: "never",
            type: "primary",
            icon: Vue.unref(index$3.Plus),
            onClick: Vue.withModifiers(addAction, ["stop"])
          }, {
            default: Vue.withCtx(() => _cache[5] || (_cache[5] = [
              Vue.createTextVNode("按钮")
            ])),
            _: 1
          }, 8, ["icon"])
        ]),
        _cache[6] || (_cache[6] = Vue.createElementVNode("div", { class: "setting-right" }, null, -1))
      ]);
    };
  }
};
const PageFooterSetting = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-63bf2610"]]);
exports.default = PageFooterSetting;
