import "../../../../../node_modules/element-plus/es/index.mjs";
/* empty css                                                             */
/* empty css                                                                    */
/* empty css                                                                         */
/* empty css                                                                */
/* empty css                                                                 */
/* empty css                                                                       */
/* empty css                                                                        */
/* empty css                                                                     */
/* empty css                                                                 */
import { computed, ref, createBlock, openBlock, unref, isRef, withCtx, createVNode, createElementBlock, createCommentVNode, createTextVNode, Fragment } from "vue";
import { getCurrentItem, getEditConfigData } from "../../utils/common.mjs";
import TemplateSelector from "../../../components/TemplateSelector.vue2.mjs";
import emitter from "../../utils/eventBus.mjs";
import ValueSelector from "../../../components/ValueSelector.vue.mjs";
import ParamsConfig from "../../../components/ParamsConfig.vue2.mjs";
import { ElCollapse, ElCollapseItem } from "../../../../../node_modules/element-plus/es/components/collapse/index.mjs";
import { ElForm, ElFormItem } from "../../../../../node_modules/element-plus/es/components/form/index.mjs";
import { ElInput } from "../../../../../node_modules/element-plus/es/components/input/index.mjs";
import { ElRadioGroup, ElRadioButton } from "../../../../../node_modules/element-plus/es/components/radio/index.mjs";
const _sfc_main = {
  __name: "subForm",
  setup(__props) {
    const currentItem = computed(() => {
      return getCurrentItem();
    });
    const activeName = ref(["common"]);
    function handleTitleModeChange(value) {
      const item = currentItem.value;
      const fieldsData = getEditConfigData().fieldsData;
      const fieldInData = fieldsData == null ? void 0 : fieldsData.find((f) => {
        var _a;
        return ((_a = f.component) == null ? void 0 : _a.id) === item.id;
      });
      if (fieldInData) {
        fieldInData.h = value === "none" ? 2 : 3;
        emitter.emit("resizeEvent");
      }
    }
    return (_ctx, _cache) => {
      const _component_el_input = ElInput;
      const _component_el_form_item = ElFormItem;
      const _component_el_radio_button = ElRadioButton;
      const _component_el_radio_group = ElRadioGroup;
      const _component_el_form = ElForm;
      const _component_el_collapse_item = ElCollapseItem;
      const _component_el_collapse = ElCollapse;
      return openBlock(), createBlock(_component_el_collapse, {
        class: "setting",
        modelValue: unref(activeName),
        "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => isRef(activeName) ? activeName.value = $event : null)
      }, {
        default: withCtx(() => [
          createVNode(_component_el_collapse_item, {
            name: "common",
            title: "基本属性"
          }, {
            default: withCtx(() => [
              (openBlock(), createBlock(_component_el_form, {
                "label-position": "top",
                "label-width": "auto",
                model: unref(currentItem),
                key: unref(currentItem).id
              }, {
                default: withCtx(() => [
                  createVNode(_component_el_form_item, {
                    label: "标题",
                    required: ""
                  }, {
                    default: withCtx(() => [
                      createVNode(_component_el_input, {
                        modelValue: unref(currentItem).label,
                        "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(currentItem).label = $event)
                      }, null, 8, ["modelValue"])
                    ]),
                    _: 1
                  }),
                  createVNode(_component_el_form_item, { label: "标题模式" }, {
                    default: withCtx(() => [
                      createVNode(_component_el_radio_group, {
                        modelValue: unref(currentItem).titleMode,
                        "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => unref(currentItem).titleMode = $event),
                        size: "small",
                        onChange: handleTitleModeChange
                      }, {
                        default: withCtx(() => [
                          createVNode(_component_el_radio_button, { value: "none" }, {
                            default: withCtx(() => _cache[12] || (_cache[12] = [
                              createTextVNode("无")
                            ])),
                            _: 1
                          }),
                          createVNode(_component_el_radio_button, { value: "label" }, {
                            default: withCtx(() => _cache[13] || (_cache[13] = [
                              createTextVNode("标题")
                            ])),
                            _: 1
                          }),
                          createVNode(_component_el_radio_button, { value: "subLabel" }, {
                            default: withCtx(() => _cache[14] || (_cache[14] = [
                              createTextVNode("子标题")
                            ])),
                            _: 1
                          })
                        ]),
                        _: 1
                      }, 8, ["modelValue"])
                    ]),
                    _: 1
                  }),
                  unref(currentItem).titleMode != "none" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
                    unref(currentItem).titleMode == "label" ? (openBlock(), createBlock(_component_el_form_item, {
                      key: 0,
                      label: "副标题"
                    }, {
                      default: withCtx(() => [
                        createVNode(_component_el_input, {
                          modelValue: unref(currentItem).subLabel,
                          "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => unref(currentItem).subLabel = $event),
                          rows: 2,
                          type: "textarea",
                          resize: "none"
                        }, null, 8, ["modelValue"])
                      ]),
                      _: 1
                    })) : createCommentVNode("", true)
                  ], 64)) : createCommentVNode("", true),
                  createVNode(_component_el_form_item, { label: "显示模式" }, {
                    default: withCtx(() => [
                      createVNode(_component_el_radio_group, {
                        modelValue: unref(currentItem).displayMode,
                        "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => unref(currentItem).displayMode = $event),
                        size: "small"
                      }, {
                        default: withCtx(() => [
                          createVNode(_component_el_radio_button, { value: "all" }, {
                            default: withCtx(() => _cache[15] || (_cache[15] = [
                              createTextVNode("始终显示")
                            ])),
                            _: 1
                          }),
                          createVNode(_component_el_radio_button, { value: "edit" }, {
                            default: withCtx(() => _cache[16] || (_cache[16] = [
                              createTextVNode("编辑时显示")
                            ])),
                            _: 1
                          }),
                          createVNode(_component_el_radio_button, { value: "query" }, {
                            default: withCtx(() => _cache[17] || (_cache[17] = [
                              createTextVNode("查看时显示")
                            ])),
                            _: 1
                          })
                        ]),
                        _: 1
                      }, 8, ["modelValue"])
                    ]),
                    _: 1
                  }),
                  createVNode(_component_el_form_item, { label: "数据来源" }, {
                    default: withCtx(() => [
                      createVNode(_component_el_radio_group, {
                        modelValue: unref(currentItem).dataSourceFrom,
                        "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => unref(currentItem).dataSourceFrom = $event),
                        size: "small"
                      }, {
                        default: withCtx(() => [
                          createVNode(_component_el_radio_button, { value: "main" }, {
                            default: withCtx(() => _cache[18] || (_cache[18] = [
                              createTextVNode("主页面获取")
                            ])),
                            _: 1
                          }),
                          createVNode(_component_el_radio_button, { value: "self" }, {
                            default: withCtx(() => _cache[19] || (_cache[19] = [
                              createTextVNode("子表单自加载")
                            ])),
                            _: 1
                          })
                        ]),
                        _: 1
                      }, 8, ["modelValue"])
                    ]),
                    _: 1
                  }),
                  unref(currentItem).dataSourceFrom == "self" ? (openBlock(), createBlock(_component_el_form_item, {
                    key: 1,
                    label: "表单参数"
                  }, {
                    default: withCtx(() => [
                      createVNode(ParamsConfig, {
                        modelValue: unref(currentItem).subFormParams,
                        "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => unref(currentItem).subFormParams = $event)
                      }, null, 8, ["modelValue"])
                    ]),
                    _: 1
                  })) : createCommentVNode("", true),
                  createVNode(_component_el_form_item, { label: "表单来源" }, {
                    default: withCtx(() => [
                      createVNode(_component_el_radio_group, {
                        modelValue: unref(currentItem).formSource,
                        "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => unref(currentItem).formSource = $event),
                        size: "small"
                      }, {
                        default: withCtx(() => [
                          createVNode(_component_el_radio_button, { value: "select" }, {
                            default: withCtx(() => _cache[20] || (_cache[20] = [
                              createTextVNode("选择表单")
                            ])),
                            _: 1
                          }),
                          createVNode(_component_el_radio_button, { value: "dynamic" }, {
                            default: withCtx(() => _cache[21] || (_cache[21] = [
                              createTextVNode("动态表单")
                            ])),
                            _: 1
                          })
                        ]),
                        _: 1
                      }, 8, ["modelValue"])
                    ]),
                    _: 1
                  }),
                  unref(currentItem).formSource == "select" ? (openBlock(), createBlock(_component_el_form_item, {
                    key: 2,
                    label: "选择子表单"
                  }, {
                    default: withCtx(() => [
                      createVNode(TemplateSelector, {
                        modelValue: unref(currentItem).subFormName,
                        "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => unref(currentItem).subFormName = $event),
                        templateKey: unref(currentItem).subFormKey,
                        "onUpdate:templateKey": _cache[8] || (_cache[8] = ($event) => unref(currentItem).subFormKey = $event),
                        templateId: unref(currentItem).subFormId,
                        "onUpdate:templateId": _cache[9] || (_cache[9] = ($event) => unref(currentItem).subFormId = $event),
                        templateType: "form"
                      }, null, 8, ["modelValue", "templateKey", "templateId"])
                    ]),
                    _: 1
                  })) : unref(currentItem).formSource == "dynamic" ? (openBlock(), createBlock(_component_el_form_item, {
                    key: 3,
                    label: "表单标识"
                  }, {
                    default: withCtx(() => [
                      createVNode(ValueSelector, {
                        modelValue: unref(currentItem).dynamicSubFormKey,
                        "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => unref(currentItem).dynamicSubFormKey = $event),
                        size: "default"
                      }, null, 8, ["modelValue"])
                    ]),
                    _: 1
                  })) : createCommentVNode("", true)
                ]),
                _: 1
              }, 8, ["model"]))
            ]),
            _: 1
          })
        ]),
        _: 1
      }, 8, ["modelValue"]);
    };
  }
};
export {
  _sfc_main as default
};
