"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");
const ValueSelector = require("./ValueSelector.vue.js");
;/* empty css                  */
const _pluginVue_exportHelper = require("../../../_virtual/_plugin-vue_export-helper.js");
const index = require("../../../node_modules/element-plus/es/components/button/index.js");
const index$2 = require("../../../node_modules/element-plus/es/components/input/index.js");
const _hoisted_1 = { class: "params-config-container" };
const _hoisted_2 = {
  key: 1,
  class: "params-table"
};
const _hoisted_3 = { class: "params-body" };
const _hoisted_4 = { class: "params-cell key-params" };
const _hoisted_5 = { class: "params-cell value-params" };
const _hoisted_6 = { class: "params-cell action-cell" };
const _hoisted_7 = { class: "params-footer" };
const _sfc_main = {
  __name: "ParamsConfig",
  props: {
    modelValue: {
      type: Array,
      default: () => []
    },
    availableFields: {
      type: Array,
      default: () => []
    }
  },
  emits: ["update:modelValue"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const params = Vue.computed({
      get: () => props.modelValue,
      set: (val) => emit("update:modelValue", val)
    });
    const emit = __emit;
    function addParam() {
      params.value.push({
        id: Date.now(),
        key: "",
        value: ""
      });
    }
    function removeParam(index2) {
      params.value.splice(index2, 1);
    }
    return (_ctx, _cache) => {
      const _component_el_button = index.ElButton;
      const _component_el_input = index$2.ElInput;
      return Vue.openBlock(), Vue.createElementBlock("div", _hoisted_1, [
        Vue.unref(params).length === 0 ? (Vue.openBlock(), Vue.createBlock(_component_el_button, {
          key: 0,
          type: "primary",
          size: "small",
          icon: Vue.unref(index$1.Plus),
          link: "",
          onClick: addParam
        }, {
          default: Vue.withCtx(() => _cache[0] || (_cache[0] = [
            Vue.createTextVNode(" 新增参数 ")
          ])),
          _: 1
        }, 8, ["icon"])) : (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_2, [
          _cache[2] || (_cache[2] = Vue.createElementVNode("div", { class: "params-header" }, [
            Vue.createElementVNode("div", { class: "params-cell key-header" }, "键名"),
            Vue.createElementVNode("div", { class: "params-cell value-header" }, "值"),
            Vue.createElementVNode("div", { class: "params-cell action-header" })
          ], -1)),
          Vue.createElementVNode("div", _hoisted_3, [
            (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(Vue.unref(params), (item, index2) => {
              return Vue.openBlock(), Vue.createElementBlock("div", {
                key: item.id,
                class: "params-row"
              }, [
                Vue.createElementVNode("div", _hoisted_4, [
                  Vue.createVNode(_component_el_input, {
                    modelValue: item.key,
                    "onUpdate:modelValue": ($event) => item.key = $event,
                    placeholder: "参数名",
                    size: "small"
                  }, null, 8, ["modelValue", "onUpdate:modelValue"])
                ]),
                Vue.createElementVNode("div", _hoisted_5, [
                  Vue.createVNode(ValueSelector.default, {
                    modelValue: item.value,
                    "onUpdate:modelValue": ($event) => item.value = $event,
                    placeholder: "参数值",
                    size: "small"
                  }, null, 8, ["modelValue", "onUpdate:modelValue"])
                ]),
                Vue.createElementVNode("div", _hoisted_6, [
                  Vue.createVNode(_component_el_button, {
                    type: "danger",
                    size: "small",
                    icon: Vue.unref(index$1.Delete),
                    text: "",
                    onClick: ($event) => removeParam(index2)
                  }, null, 8, ["icon", "onClick"])
                ])
              ]);
            }), 128))
          ]),
          Vue.createElementVNode("div", _hoisted_7, [
            Vue.createVNode(_component_el_button, {
              type: "primary",
              size: "small",
              icon: Vue.unref(index$1.Plus),
              link: "",
              onClick: addParam
            }, {
              default: Vue.withCtx(() => _cache[1] || (_cache[1] = [
                Vue.createTextVNode(" 新增参数 ")
              ])),
              _: 1
            }, 8, ["icon"])
          ])
        ]))
      ]);
    };
  }
};
const ParamsConfig = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-097f1353"]]);
exports.default = ParamsConfig;
