"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                                                                     */
const Vue = require("vue");
;/* empty css             */
const _pluginVue_exportHelper = require("../../../../../../_virtual/_plugin-vue_export-helper.js");
const index = require("../../../../../../node_modules/element-plus/es/components/container/index.js");
const index$1 = require("../../../../../../node_modules/element-plus/es/components/button/index.js");
const _sfc_main = {
  __name: "Footer",
  props: {
    pageFooterConfig: {
      type: Object,
      required: true,
      default: () => ({
        buttons: []
      })
    },
    formMode: {
      type: String,
      default: ""
    }
  },
  emits: ["cancel", "submit", "custom-button-click"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const formDetailsFooterRef = Vue.ref();
    const handleButtonClick = (button) => {
      emit("custom-button-click", button);
    };
    const showFooter = Vue.ref(true);
    Vue.onMounted(() => {
      var _a;
      const layoutDom = (_a = formDetailsFooterRef.value) == null ? void 0 : _a.$el.closest(".fec-layout-row");
      if (layoutDom && props.formMode == "query") {
        showFooter.value = false;
      }
    });
    return (_ctx, _cache) => {
      var _a;
      const _component_el_button = index$1.ElButton;
      const _component_el_footer = index.ElFooter;
      const _directive_fec_auth = Vue.resolveDirective("fec-auth");
      return __props.pageFooterConfig.enabled && ((_a = __props.pageFooterConfig.actions) == null ? void 0 : _a.length) && Vue.unref(showFooter) ? (Vue.openBlock(), Vue.createBlock(_component_el_footer, {
        key: 0,
        class: "form-details-footer",
        ref_key: "formDetailsFooterRef",
        ref: formDetailsFooterRef
      }, {
        default: Vue.withCtx(() => [
          (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(__props.pageFooterConfig.actions, (button) => {
            return Vue.openBlock(), Vue.createElementBlock(Vue.Fragment, {
              key: button.id
            }, [
              button.btnType == "default" || button.btnType == "primary" && __props.formMode == "edit" ? Vue.withDirectives((Vue.openBlock(), Vue.createBlock(_component_el_button, {
                key: 0,
                type: button.btnType,
                onClick: ($event) => handleButtonClick(button)
              }, {
                default: Vue.withCtx(() => [
                  Vue.createTextVNode(Vue.toDisplayString(button.label), 1)
                ]),
                _: 2
              }, 1032, ["type", "onClick"])), [
                [_directive_fec_auth, button.permission]
              ]) : Vue.createCommentVNode("", true)
            ], 64);
          }), 128))
        ]),
        _: 1
      }, 512)) : Vue.createCommentVNode("", true);
    };
  }
};
const component = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-deabd2d2"]]);
exports.default = component;
