"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                                                                     */
;/* empty css                                                                  */
;/* empty css                                                               */
;/* empty css                                                            */
;/* empty css                                                               */
;/* empty css                                                                     */
;/* empty css                                                               */
;/* empty css                                                               */
const Vue = require("vue");
const common = require("../utils/common.js");
const useDataSourceDialog = require("../dataSource/useDataSourceDialog.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/select/index.js");
const index$2 = require("../../../../node_modules/element-plus/es/components/radio/index.js");
const _hoisted_1 = { class: "form-setting" };
const _hoisted_2 = { class: "setting-left" };
const _hoisted_3 = { class: "setting-right" };
const _sfc_main = {
  __name: "formSetting",
  setup(__props) {
    const { dataSourceDialogVisible, DataSourceDialog } = useDataSourceDialog.useDataSourceDialog();
    const formConfig = Vue.computed(() => {
      const config = common.getEditConfigData();
      if (config.navigationEnabled ?? true) {
        config.navigationEnabled = true;
      }
      return config;
    });
    const dataSources = Vue.computed(() => {
      return formConfig.value.dataSources || [];
    });
    const selectedDataSource = Vue.computed({
      get: () => formConfig.value.dataSourceId,
      set: (val) => {
        formConfig.value.dataSourceId = val;
      }
    });
    Vue.computed(() => {
      if (!selectedDataSource.value) return "";
      const dataSource = dataSources.value.find(
        (ds) => ds.id === selectedDataSource.value
      );
      return dataSource ? dataSource.name : "";
    });
    Vue.computed(() => {
      return formConfig.value.validationRules || [];
    });
    return (_ctx, _cache) => {
      const _component_el_switch = index.ElSwitch;
      const _component_el_option = index$1.ElOption;
      const _component_el_select = index$1.ElSelect;
      const _component_el_radio_button = index$2.ElRadioButton;
      const _component_el_radio_group = index$2.ElRadioGroup;
      return Vue.openBlock(), Vue.createElementBlock(Vue.Fragment, null, [
        Vue.createElementVNode("div", _hoisted_1, [
          Vue.createElementVNode("div", _hoisted_2, [
            _cache[11] || (_cache[11] = Vue.createElementVNode("span", { class: "text-label" }, "启用导航", -1)),
            Vue.createVNode(_component_el_switch, {
              modelValue: formConfig.value.navigationEnabled,
              "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => formConfig.value.navigationEnabled = $event),
              size: "small"
            }, null, 8, ["modelValue"]),
            _cache[12] || (_cache[12] = Vue.createElementVNode("div", { class: "setting-divider" }, null, -1)),
            _cache[13] || (_cache[13] = Vue.createElementVNode("span", { class: "text-label" }, "列数", -1)),
            Vue.createVNode(_component_el_select, {
              modelValue: formConfig.value.columns,
              "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => formConfig.value.columns = $event),
              size: "small",
              style: { "width": "100px" }
            }, {
              default: Vue.withCtx(() => [
                Vue.createVNode(_component_el_option, {
                  label: "一列",
                  value: 1
                }),
                Vue.createVNode(_component_el_option, {
                  label: "二列",
                  value: 2
                }),
                Vue.createVNode(_component_el_option, {
                  label: "三列",
                  value: 3
                }),
                Vue.createVNode(_component_el_option, {
                  label: "四列",
                  value: 4
                })
              ]),
              _: 1
            }, 8, ["modelValue"]),
            _cache[14] || (_cache[14] = Vue.createElementVNode("div", { class: "setting-divider" }, null, -1)),
            _cache[15] || (_cache[15] = Vue.createElementVNode("span", { class: "text-label" }, "标签位置", -1)),
            Vue.createVNode(_component_el_radio_group, {
              modelValue: formConfig.value.labelPosition,
              "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => formConfig.value.labelPosition = $event),
              size: "small"
            }, {
              default: Vue.withCtx(() => [
                Vue.createVNode(_component_el_radio_button, { value: "left" }, {
                  default: Vue.withCtx(() => _cache[6] || (_cache[6] = [
                    Vue.createTextVNode("左对齐")
                  ])),
                  _: 1
                }),
                Vue.createVNode(_component_el_radio_button, { value: "right" }, {
                  default: Vue.withCtx(() => _cache[7] || (_cache[7] = [
                    Vue.createTextVNode("右对齐")
                  ])),
                  _: 1
                }),
                Vue.createVNode(_component_el_radio_button, { value: "top" }, {
                  default: Vue.withCtx(() => _cache[8] || (_cache[8] = [
                    Vue.createTextVNode("顶部对齐")
                  ])),
                  _: 1
                })
              ]),
              _: 1
            }, 8, ["modelValue"]),
            _cache[16] || (_cache[16] = Vue.createElementVNode("div", { class: "setting-divider" }, null, -1)),
            _cache[17] || (_cache[17] = Vue.createElementVNode("span", { class: "text-label" }, "表单模式", -1)),
            Vue.createVNode(_component_el_radio_group, {
              modelValue: formConfig.value.formMode,
              "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => formConfig.value.formMode = $event),
              size: "small"
            }, {
              default: Vue.withCtx(() => [
                Vue.createVNode(_component_el_radio_button, { value: "edit" }, {
                  default: Vue.withCtx(() => _cache[9] || (_cache[9] = [
                    Vue.createTextVNode("编辑")
                  ])),
                  _: 1
                }),
                Vue.createVNode(_component_el_radio_button, { value: "query" }, {
                  default: Vue.withCtx(() => _cache[10] || (_cache[10] = [
                    Vue.createTextVNode("查看")
                  ])),
                  _: 1
                })
              ]),
              _: 1
            }, 8, ["modelValue"])
          ]),
          Vue.createElementVNode("div", _hoisted_3, [
            _cache[18] || (_cache[18] = Vue.createElementVNode("span", { class: "text-label" }, "显示字段名", -1)),
            Vue.createVNode(_component_el_switch, {
              modelValue: formConfig.value.showFieldName,
              "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => formConfig.value.showFieldName = $event),
              size: "small"
            }, null, 8, ["modelValue"])
          ])
        ]),
        Vue.createVNode(Vue.unref(DataSourceDialog), {
          modelValue: Vue.unref(dataSourceDialogVisible),
          "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => Vue.isRef(dataSourceDialogVisible) ? dataSourceDialogVisible.value = $event : null)
        }, null, 8, ["modelValue"])
      ], 64);
    };
  }
};
const FormSetting = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-152eb837"]]);
exports.default = FormSetting;
