"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");
const index$1 = require("../../../../../node_modules/@element-plus/icons-vue/dist/index.js");
;/* empty css                   */
const _pluginVue_exportHelper = require("../../../../../_virtual/_plugin-vue_export-helper.js");
const index = require("../../../../../node_modules/element-plus/es/components/input/index.js");
const index$2 = require("../../../../../node_modules/element-plus/es/components/scrollbar/index.js");
const _hoisted_1 = { class: "field-variable" };
const _hoisted_2 = { class: "field-search" };
const _hoisted_3 = ["onClick"];
const _hoisted_4 = ["field-type"];
const _sfc_main = {
  __name: "FieldVariable",
  props: {
    fieldList: {
      type: Array,
      default: () => []
    }
  },
  emits: ["fieldSelect"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const type = {
      text: "字符串",
      textarea: "字符串",
      select: "字符串",
      radio: "字符串",
      number: "数字",
      multipleSelection: "数组",
      checkbox: "数组",
      date: "日期",
      switch: "布尔值",
      hidden: "隐藏域"
    };
    const searchVariable = Vue.ref("");
    const filterFieldList = Vue.ref([]);
    Vue.watch(searchVariable, (val) => {
      filterFieldList.value = props.fieldList.filter(
        ({ label }) => label.includes(val)
      );
    });
    Vue.onMounted(() => {
      filterFieldList.value = props.fieldList;
    });
    return (_ctx, _cache) => {
      const _component_el_input = index.ElInput;
      const _component_el_scrollbar = index$2.ElScrollbar;
      return Vue.openBlock(), Vue.createElementBlock("div", _hoisted_1, [
        Vue.createElementVNode("div", _hoisted_2, [
          Vue.createVNode(_component_el_input, {
            placeholder: "搜索变量",
            "prefix-icon": Vue.unref(index$1.Search),
            modelValue: searchVariable.value,
            "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchVariable.value = $event),
            clearable: ""
          }, null, 8, ["prefix-icon", "modelValue"])
        ]),
        Vue.createVNode(_component_el_scrollbar, null, {
          default: Vue.withCtx(() => [
            (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(filterFieldList.value, (item) => {
              return Vue.openBlock(), Vue.createElementBlock("div", {
                class: "field-item",
                onClick: ($event) => _ctx.$emit("fieldSelect", item),
                key: item.fieldName
              }, [
                Vue.createElementVNode("span", null, Vue.toDisplayString(item.label), 1),
                Vue.createElementVNode("span", {
                  "field-type": item.fieldType,
                  class: "text-tag"
                }, Vue.toDisplayString(type[item.fieldType]), 9, _hoisted_4)
              ], 8, _hoisted_3);
            }), 128))
          ]),
          _: 1
        })
      ]);
    };
  }
};
const FieldVariable = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-c2ceeb58"]]);
exports.default = FieldVariable;
