import "../../../../../node_modules/element-plus/es/index.mjs";
/* empty css                                                             */
import { computed, createElementBlock, openBlock, createCommentVNode, createElementVNode, createBlock, normalizeClass, createVNode, withCtx, unref, toDisplayString } from "vue";
import { DocumentAdd as document_add_default, Document as document_default } from "../../../../../node_modules/@element-plus/icons-vue/dist/index.mjs";
import H2Wrapper from "./H2Wrapper.vue.mjs";
import SubTitle from "./SubTitle.vue.mjs";
/* empty css              */
import _export_sfc from "../../../../../_virtual/_plugin-vue_export-helper.mjs";
import { ElIcon } from "../../../../../node_modules/element-plus/es/components/icon/index.mjs";
const _hoisted_1 = { class: "sub-form-container" };
const _hoisted_2 = {
  key: 0,
  style: { "margin-bottom": "12px" }
};
const _hoisted_3 = {
  key: 0,
  class: "empty-state"
};
const _hoisted_4 = {
  key: 1,
  class: "form-content"
};
const _hoisted_5 = { class: "form-icon" };
const _hoisted_6 = { class: "form-info" };
const _hoisted_7 = ["title"];
const _hoisted_8 = ["title"];
const _sfc_main = {
  __name: "SubForm",
  props: {
    componentData: {
      type: Object,
      required: true
    }
  },
  setup(__props) {
    const props = __props;
    const titleMode = computed(() => {
      var _a;
      const mode = ((_a = props.componentData) == null ? void 0 : _a.titleMode) || "none";
      return mode;
    });
    const formSource = computed(() => {
      var _a;
      return ((_a = props.componentData) == null ? void 0 : _a.formSource) || "select";
    });
    const formName = computed(() => {
      var _a, _b;
      if (formSource.value === "select") {
        return ((_a = props.componentData) == null ? void 0 : _a.subFormName) || "";
      } else if (formSource.value === "dynamic") {
        const dynamicValue = (_b = props.componentData) == null ? void 0 : _b.dynamicSubFormKey;
        if (dynamicValue && typeof dynamicValue === "object" && dynamicValue !== null) {
          return dynamicValue.label || "";
        }
        return dynamicValue || "";
      }
      return "";
    });
    const formKey = computed(() => {
      var _a;
      if (formSource.value === "select") {
        return ((_a = props.componentData) == null ? void 0 : _a.subFormKey) || "";
      } else if (formSource.value === "dynamic") {
        return "动态表单";
      }
      return "";
    });
    const hasForm = computed(() => {
      var _a, _b;
      if (formSource.value === "select") {
        return !!((_a = props.componentData) == null ? void 0 : _a.subFormName);
      } else if (formSource.value === "dynamic") {
        return !!((_b = props.componentData) == null ? void 0 : _b.dynamicSubFormKey);
      }
      return false;
    });
    return (_ctx, _cache) => {
      const _component_el_icon = ElIcon;
      return openBlock(), createElementBlock("div", _hoisted_1, [
        titleMode.value !== "none" ? (openBlock(), createElementBlock("div", _hoisted_2, [
          titleMode.value === "label" ? (openBlock(), createBlock(H2Wrapper, {
            key: 0,
            componentData: __props.componentData
          }, null, 8, ["componentData"])) : titleMode.value === "subLabel" ? (openBlock(), createBlock(SubTitle, {
            key: 1,
            componentData: __props.componentData
          }, null, 8, ["componentData"])) : createCommentVNode("", true)
        ])) : createCommentVNode("", true),
        createElementVNode("div", {
          class: normalizeClass(["sub-form-display", { "is-empty": !hasForm.value, "has-form": hasForm.value }])
        }, [
          !hasForm.value ? (openBlock(), createElementBlock("div", _hoisted_3, [
            createVNode(_component_el_icon, { class: "icon" }, {
              default: withCtx(() => [
                createVNode(unref(document_add_default))
              ]),
              _: 1
            }),
            _cache[0] || (_cache[0] = createElementVNode("div", { class: "text" }, "未配置子表单", -1))
          ])) : (openBlock(), createElementBlock("div", _hoisted_4, [
            createElementVNode("div", _hoisted_5, [
              createVNode(_component_el_icon, null, {
                default: withCtx(() => [
                  createVNode(unref(document_default))
                ]),
                _: 1
              })
            ]),
            createElementVNode("div", _hoisted_6, [
              createElementVNode("div", {
                class: "form-name",
                title: formName.value
              }, toDisplayString(formName.value), 9, _hoisted_7),
              createElementVNode("div", {
                class: "form-key",
                title: formKey.value
              }, toDisplayString(formKey.value), 9, _hoisted_8)
            ])
          ]))
        ], 2)
      ]);
    };
  }
};
const SubForm = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-cd333a16"]]);
export {
  SubForm as default
};
