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                                                                 */
/* 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, normalizeStyle, createElementBlock, Fragment, renderList, createCommentVNode, createTextVNode } from "vue";
import { getCurrentItem } from "../../utils/common.mjs";
import OptionConfig from "../../../components/OptionConfig.vue.mjs";
import components from "../aside/index.mjs";
import EventConfigButton from "../../../components/EventConfigButton.vue.mjs";
/* empty css              */
import _export_sfc from "../../../../../_virtual/_plugin-vue_export-helper.mjs";
import { ElCollapse, ElCollapseItem } from "../../../../../node_modules/element-plus/es/components/collapse/index.mjs";
import { ElSelect, ElOption } from "../../../../../node_modules/element-plus/es/components/select/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 { ElCheckbox } from "../../../../../node_modules/element-plus/es/components/checkbox/index.mjs";
import { ElInputNumber } from "../../../../../node_modules/element-plus/es/components/input-number/index.mjs";
import { ElRadioGroup, ElRadioButton } from "../../../../../node_modules/element-plus/es/components/radio/index.mjs";
import { ElSwitch } from "../../../../../node_modules/element-plus/es/components/switch/index.mjs";
const _sfc_main = {
  __name: "widgets",
  props: {
    column: {
      type: Object
    },
    isComp: {
      type: Boolean,
      default: false
    }
  },
  setup(__props) {
    const props = __props;
    const currentItem = computed(() => {
      return props.column || getCurrentItem();
    });
    const activeName = ref(["common"]);
    const fieldTypes = computed(() => {
      var _a;
      const basicComponents = components.find((c) => c.name === "basic");
      return ((_a = basicComponents == null ? void 0 : basicComponents.children) == null ? void 0 : _a.filter((c) => c.isShow)) || [];
    });
    function handleFieldTypeChange(fieldType) {
      currentItem.value;
    }
    function handleFormatChange(value) {
      currentItem.value.align = "center";
      switch (value) {
        case "percentage":
          currentItem.value.suffix = "%";
          break;
        case "permillage":
          currentItem.value.suffix = "‰";
          break;
        case "permillion":
          currentItem.value.suffix = "‱";
          break;
        case "yuan":
        case "wan":
        case "million":
          currentItem.value.suffix = "";
          currentItem.value.align = "right";
          break;
        default:
          currentItem.value.suffix = "";
          break;
      }
    }
    return (_ctx, _cache) => {
      const _component_el_option = ElOption;
      const _component_el_select = ElSelect;
      const _component_el_input = ElInput;
      const _component_el_form_item = ElFormItem;
      const _component_el_checkbox = ElCheckbox;
      const _component_el_input_number = ElInputNumber;
      const _component_el_radio_button = ElRadioButton;
      const _component_el_radio_group = ElRadioGroup;
      const _component_el_switch = ElSwitch;
      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[22] || (_cache[22] = ($event) => isRef(activeName) ? activeName.value = $event : null)
      }, {
        default: withCtx(() => [
          createVNode(_component_el_collapse_item, {
            name: "common",
            title: "基本属性"
          }, {
            default: withCtx(() => [
              createVNode(_component_el_select, {
                teleported: false,
                modelValue: unref(currentItem).fieldType,
                "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(currentItem).fieldType = $event),
                size: "small",
                class: "field-type-select",
                onChange: handleFieldTypeChange,
                placement: "bottom-end",
                style: normalizeStyle(__props.isComp ? { top: 0 } : {})
              }, {
                default: withCtx(() => [
                  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(fieldTypes), (type) => {
                    return openBlock(), createBlock(_component_el_option, {
                      key: type.fieldType,
                      label: type.label,
                      value: type.fieldType
                    }, null, 8, ["label", "value"]);
                  }), 128))
                ]),
                _: 1
              }, 8, ["modelValue", "style"]),
              (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[1] || (_cache[1] = ($event) => unref(currentItem).label = $event)
                      }, null, 8, ["modelValue"])
                    ]),
                    _: 1
                  }),
                  createVNode(_component_el_form_item, { label: "字段名称" }, {
                    default: withCtx(() => [
                      createVNode(_component_el_input, {
                        modelValue: unref(currentItem).fieldName,
                        "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => unref(currentItem).fieldName = $event)
                      }, null, 8, ["modelValue"])
                    ]),
                    _: 1
                  }),
                  unref(currentItem).fieldType === "number" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
                    createVNode(_component_el_form_item, { label: "格式" }, {
                      default: withCtx(() => [
                        createVNode(_component_el_select, {
                          modelValue: unref(currentItem).format,
                          "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => unref(currentItem).format = $event),
                          teleported: false,
                          onChange: handleFormatChange
                        }, {
                          default: withCtx(() => [
                            createVNode(_component_el_option, {
                              label: "数值",
                              value: "number"
                            }),
                            createVNode(_component_el_option, {
                              label: "金额(元)",
                              value: "yuan"
                            }),
                            createVNode(_component_el_option, {
                              label: "金额(万元)",
                              value: "wan"
                            }),
                            createVNode(_component_el_option, {
                              label: "金额(百万元)",
                              value: "million"
                            }),
                            createVNode(_component_el_option, {
                              label: "百分比",
                              value: "percentage"
                            }),
                            createVNode(_component_el_option, {
                              label: "千分比",
                              value: "permillage"
                            }),
                            createVNode(_component_el_option, {
                              label: "万分比",
                              value: "permillion"
                            })
                          ]),
                          _: 1
                        }, 8, ["modelValue"])
                      ]),
                      _: 1
                    }),
                    createVNode(_component_el_form_item, null, {
                      default: withCtx(() => [
                        createVNode(_component_el_checkbox, {
                          modelValue: unref(currentItem).hasDecimalPlaces,
                          "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => unref(currentItem).hasDecimalPlaces = $event),
                          label: "保留小数位数"
                        }, null, 8, ["modelValue"]),
                        unref(currentItem).hasDecimalPlaces ? (openBlock(), createBlock(_component_el_input_number, {
                          key: 0,
                          style: { "margin-left": "10px", "width": "80px" },
                          modelValue: unref(currentItem).decimalPlaces,
                          "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => unref(currentItem).decimalPlaces = $event),
                          min: 0,
                          max: 10,
                          "controls-position": "right",
                          size: "small"
                        }, null, 8, ["modelValue"])) : createCommentVNode("", true)
                      ]),
                      _: 1
                    })
                  ], 64)) : createCommentVNode("", true),
                  unref(currentItem).fieldType === "select" || unref(currentItem).fieldType === "multipleSelection" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
                    createVNode(OptionConfig, {
                      modelValue: unref(currentItem).optionConfig,
                      "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => unref(currentItem).optionConfig = $event)
                    }, null, 8, ["modelValue"]),
                    createVNode(_component_el_form_item, { label: "标签效果" }, {
                      default: withCtx(() => [
                        createVNode(_component_el_select, {
                          modelValue: unref(currentItem).optionStyle,
                          "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => unref(currentItem).optionStyle = $event),
                          teleported: false
                        }, {
                          default: withCtx(() => [
                            createVNode(_component_el_option, {
                              label: "默认",
                              value: "default"
                            })
                          ]),
                          _: 1
                        }, 8, ["modelValue"])
                      ]),
                      _: 1
                    })
                  ], 64)) : createCommentVNode("", true),
                  unref(currentItem).fieldType === "date" ? (openBlock(), createBlock(_component_el_form_item, {
                    key: 2,
                    label: "类型"
                  }, {
                    default: withCtx(() => [
                      createVNode(_component_el_select, {
                        modelValue: unref(currentItem).dateType,
                        "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => unref(currentItem).dateType = $event),
                        teleported: false
                      }, {
                        default: withCtx(() => [
                          createVNode(_component_el_option, {
                            label: "年-月-日",
                            value: "date"
                          }),
                          createVNode(_component_el_option, {
                            label: "年-周",
                            value: "week"
                          }),
                          createVNode(_component_el_option, {
                            label: "年-月",
                            value: "month"
                          }),
                          createVNode(_component_el_option, {
                            label: "年",
                            value: "year"
                          }),
                          createVNode(_component_el_option, {
                            label: "年-月-日 时:分",
                            value: "datetime-minute"
                          }),
                          createVNode(_component_el_option, {
                            label: "年-月-日 时:分:秒",
                            value: "datetime"
                          }),
                          createVNode(_component_el_option, {
                            label: "多日期",
                            value: "dates"
                          })
                        ]),
                        _: 1
                      }, 8, ["modelValue"])
                    ]),
                    _: 1
                  })) : createCommentVNode("", true),
                  createVNode(_component_el_form_item, { label: "宽度模式" }, {
                    default: withCtx(() => [
                      createVNode(_component_el_radio_group, {
                        modelValue: unref(currentItem).widthMode,
                        "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => unref(currentItem).widthMode = $event),
                        size: "small"
                      }, {
                        default: withCtx(() => [
                          createVNode(_component_el_radio_button, { value: "auto" }, {
                            default: withCtx(() => _cache[23] || (_cache[23] = [
                              createTextVNode("自适应")
                            ])),
                            _: 1
                          }),
                          createVNode(_component_el_radio_button, { value: "fixed" }, {
                            default: withCtx(() => _cache[24] || (_cache[24] = [
                              createTextVNode("固定宽度")
                            ])),
                            _: 1
                          })
                        ]),
                        _: 1
                      }, 8, ["modelValue"])
                    ]),
                    _: 1
                  }),
                  unref(currentItem).widthMode === "fixed" ? (openBlock(), createBlock(_component_el_form_item, {
                    key: 3,
                    label: "固定宽度"
                  }, {
                    default: withCtx(() => [
                      createVNode(_component_el_input_number, {
                        modelValue: unref(currentItem).width,
                        "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => unref(currentItem).width = $event),
                        min: 80,
                        max: 500,
                        class: "width-input"
                      }, {
                        append: withCtx(() => _cache[25] || (_cache[25] = [
                          createTextVNode("px")
                        ])),
                        _: 1
                      }, 8, ["modelValue"])
                    ]),
                    _: 1
                  })) : createCommentVNode("", true),
                  unref(currentItem).widthMode === "auto" ? (openBlock(), createBlock(_component_el_form_item, {
                    key: 4,
                    label: "最小宽度"
                  }, {
                    default: withCtx(() => [
                      createVNode(_component_el_input_number, {
                        modelValue: unref(currentItem).minWidth,
                        "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => unref(currentItem).minWidth = $event),
                        min: 80,
                        max: 500,
                        class: "width-input"
                      }, {
                        append: withCtx(() => _cache[26] || (_cache[26] = [
                          createTextVNode("px")
                        ])),
                        _: 1
                      }, 8, ["modelValue"])
                    ]),
                    _: 1
                  })) : createCommentVNode("", true),
                  createVNode(_component_el_form_item, { label: "超出自动换行" }, {
                    default: withCtx(() => [
                      createVNode(_component_el_switch, {
                        modelValue: unref(currentItem).isOverflowWrap,
                        "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => unref(currentItem).isOverflowWrap = $event)
                      }, null, 8, ["modelValue"])
                    ]),
                    _: 1
                  }),
                  createVNode(_component_el_form_item, { label: "表头对齐方式" }, {
                    default: withCtx(() => [
                      createVNode(_component_el_select, {
                        modelValue: unref(currentItem).headerAlign,
                        "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => unref(currentItem).headerAlign = $event),
                        teleported: false
                      }, {
                        default: withCtx(() => [
                          createVNode(_component_el_option, {
                            label: "左对齐",
                            value: "left"
                          }),
                          createVNode(_component_el_option, {
                            label: "居中",
                            value: "center"
                          }),
                          createVNode(_component_el_option, {
                            label: "右对齐",
                            value: "right"
                          })
                        ]),
                        _: 1
                      }, 8, ["modelValue"])
                    ]),
                    _: 1
                  }),
                  createVNode(_component_el_form_item, { label: "数据对齐方式" }, {
                    default: withCtx(() => [
                      createVNode(_component_el_select, {
                        modelValue: unref(currentItem).align,
                        "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => unref(currentItem).align = $event),
                        teleported: false
                      }, {
                        default: withCtx(() => [
                          createVNode(_component_el_option, {
                            label: "左对齐",
                            value: "left"
                          }),
                          createVNode(_component_el_option, {
                            label: "居中",
                            value: "center"
                          }),
                          createVNode(_component_el_option, {
                            label: "右对齐",
                            value: "right"
                          })
                        ]),
                        _: 1
                      }, 8, ["modelValue"])
                    ]),
                    _: 1
                  }),
                  createVNode(_component_el_form_item, { label: "前置内容" }, {
                    default: withCtx(() => [
                      createVNode(_component_el_input, {
                        modelValue: unref(currentItem).prefix,
                        "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => unref(currentItem).prefix = $event)
                      }, null, 8, ["modelValue"])
                    ]),
                    _: 1
                  }),
                  createVNode(_component_el_form_item, { label: "后置内容" }, {
                    default: withCtx(() => [
                      createVNode(_component_el_input, {
                        modelValue: unref(currentItem).suffix,
                        "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => unref(currentItem).suffix = $event)
                      }, null, 8, ["modelValue"])
                    ]),
                    _: 1
                  }),
                  createVNode(_component_el_form_item, { label: "数据脱敏" }, {
                    default: withCtx(() => [
                      createVNode(_component_el_input, {
                        modelValue: unref(currentItem).dataMasking,
                        "onUpdate:modelValue": _cache[17] || (_cache[17] = ($event) => unref(currentItem).dataMasking = $event)
                      }, null, 8, ["modelValue"])
                    ]),
                    _: 1
                  }),
                  createVNode(_component_el_form_item, { label: "超链接" }, {
                    default: withCtx(() => [
                      createVNode(_component_el_checkbox, {
                        modelValue: unref(currentItem).isLink,
                        "onUpdate:modelValue": _cache[18] || (_cache[18] = ($event) => unref(currentItem).isLink = $event),
                        label: "启用超链接"
                      }, null, 8, ["modelValue"]),
                      unref(currentItem).isLink ? (openBlock(), createBlock(EventConfigButton, {
                        key: 0,
                        config: unref(currentItem).linkConfig,
                        onConfirm: (data) => unref(currentItem).linkConfig = data
                      }, null, 8, ["config", "onConfirm"])) : createCommentVNode("", true)
                    ]),
                    _: 1
                  }),
                  createVNode(_component_el_form_item, { label: "字段排序" }, {
                    default: withCtx(() => [
                      createVNode(_component_el_radio_group, {
                        modelValue: unref(currentItem).sortRule,
                        "onUpdate:modelValue": _cache[19] || (_cache[19] = ($event) => unref(currentItem).sortRule = $event),
                        size: "small"
                      }, {
                        default: withCtx(() => [
                          createVNode(_component_el_radio_button, { value: "none" }, {
                            default: withCtx(() => _cache[27] || (_cache[27] = [
                              createTextVNode("无")
                            ])),
                            _: 1
                          }),
                          createVNode(_component_el_radio_button, { value: "static" }, {
                            default: withCtx(() => _cache[28] || (_cache[28] = [
                              createTextVNode("前台排序")
                            ])),
                            _: 1
                          }),
                          createVNode(_component_el_radio_button, { value: "server" }, {
                            default: withCtx(() => _cache[29] || (_cache[29] = [
                              createTextVNode("后台排序")
                            ])),
                            _: 1
                          })
                        ]),
                        _: 1
                      }, 8, ["modelValue"])
                    ]),
                    _: 1
                  }),
                  createVNode(_component_el_form_item, { label: "其他" }, {
                    default: withCtx(() => [
                      createVNode(_component_el_checkbox, {
                        modelValue: unref(currentItem).isFixed,
                        "onUpdate:modelValue": _cache[20] || (_cache[20] = ($event) => unref(currentItem).isFixed = $event),
                        label: "左侧固定"
                      }, null, 8, ["modelValue"]),
                      createVNode(_component_el_checkbox, {
                        modelValue: unref(currentItem).canCopy,
                        "onUpdate:modelValue": _cache[21] || (_cache[21] = ($event) => unref(currentItem).canCopy = $event),
                        label: "复制"
                      }, null, 8, ["modelValue"])
                    ]),
                    _: 1
                  })
                ]),
                _: 1
              }, 8, ["model"]))
            ]),
            _: 1
          })
        ]),
        _: 1
      }, 8, ["modelValue"]);
    };
  }
};
const widgets = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-ee9264c8"]]);
export {
  widgets as default
};
