'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var vue = require('vue');
require('../config/index.js');
require('../../../../utils/index.js');
require('./params-table-row.vue.js');
var createNamespace = require('../../../../utils/create-namespace.js');
var paramsTableRow_vue_vue_type_script_setup_true_lang = require('./params-table-row.vue2.js');
var paramsTable = require('../config/params-table.js');

"use strict";
var _sfc_main = /* @__PURE__ */ vue.defineComponent({
  ...{ name: "LlParamsTable" },
  __name: "params-table",
  props: paramsTable.paramsTableProps,
  setup(__props) {
    const bem = createNamespace.createNamespace("params-table");
    const props = __props;
    const disabled = vue.inject("disabled");
    const addData = vue.ref("");
    const handleAdd = (dataSource) => {
      if (addData.value && dataSource.find((e) => e.name !== addData.value) || !dataSource.length) {
        if (!addData.value) return;
        dataSource.push({
          name: addData.value,
          required: false,
          value: "",
          static: false,
          description: "",
          contentType: ""
        });
        addData.value = "";
      }
    };
    return (_ctx, _cache) => {
      const _component_ll_tooltip = vue.resolveComponent("ll-tooltip");
      const _component_a_col = vue.resolveComponent("a-col");
      const _component_a_row = vue.resolveComponent("a-row");
      const _component_ll_input = vue.resolveComponent("ll-input");
      return vue.openBlock(), vue.createElementBlock(
        "div",
        {
          class: vue.normalizeClass(vue.unref(bem).b())
        },
        [
          vue.createVNode(_component_a_row, {
            class: vue.normalizeClass(vue.unref(bem).m("table-header")),
            gutter: 20
          }, {
            default: vue.withCtx(() => [
              vue.createVNode(_component_a_col, { span: 22 }, {
                default: vue.withCtx(() => [
                  vue.createVNode(_component_a_row, { gutter: 20 }, {
                    default: vue.withCtx(() => [
                      (vue.openBlock(true), vue.createElementBlock(
                        vue.Fragment,
                        null,
                        vue.renderList(props.columns, (col, index) => {
                          return vue.openBlock(), vue.createBlock(_component_a_col, {
                            key: index,
                            span: col.span,
                            class: vue.normalizeClass(vue.unref(bem).e("table-header-col"))
                          }, {
                            default: vue.withCtx(() => [
                              vue.createElementVNode(
                                "span",
                                null,
                                vue.toDisplayString(col.title),
                                1
                                /* TEXT */
                              ),
                              col.key === "static" ? (vue.openBlock(), vue.createBlock(_component_ll_tooltip, {
                                key: 0,
                                tip: "Content-Type \u5B57\u6BB5\u7528\u4E8E\u6307\u5B9A\u8BF7\u6C42\u90E8\u5206\u7684\u5A92\u4F53\u7C7B\u578B"
                              })) : vue.createCommentVNode("v-if", true)
                            ]),
                            _: 2
                            /* DYNAMIC */
                          }, 1032, ["span", "class"]);
                        }),
                        128
                        /* KEYED_FRAGMENT */
                      ))
                    ]),
                    _: 1
                    /* STABLE */
                  })
                ]),
                _: 1
                /* STABLE */
              }),
              vue.createVNode(_component_a_col, {
                class: vue.normalizeClass(vue.unref(bem).e("table-header-col")),
                span: 2
              }, {
                default: vue.withCtx(() => [..._cache[2] || (_cache[2] = [
                  vue.createTextVNode(
                    " \u64CD\u4F5C ",
                    -1
                    /* CACHED */
                  )
                ])]),
                _: 1
                /* STABLE */
              }, 8, ["class"])
            ]),
            _: 1
            /* STABLE */
          }, 8, ["class"]),
          vue.createElementVNode(
            "div",
            {
              class: vue.normalizeClass(vue.unref(bem).m("table-body"))
            },
            [
              (vue.openBlock(true), vue.createElementBlock(
                vue.Fragment,
                null,
                vue.renderList(props.dataSource, (item, index) => {
                  return vue.openBlock(), vue.createBlock(paramsTableRow_vue_vue_type_script_setup_true_lang.default, {
                    key: index,
                    data: item,
                    columns: props.columns,
                    "data-source": props.dataSource
                  }, null, 8, ["data", "columns", "data-source"]);
                }),
                128
                /* KEYED_FRAGMENT */
              )),
              vue.createVNode(_component_a_row, {
                gutter: 20,
                class: vue.normalizeClass(vue.unref(bem).e("table-row"))
              }, {
                default: vue.withCtx(() => [
                  (vue.openBlock(true), vue.createElementBlock(
                    vue.Fragment,
                    null,
                    vue.renderList(props.columns, (col, index) => {
                      return vue.openBlock(), vue.createBlock(_component_a_col, {
                        key: index,
                        span: col.span || 24 / props.columns.length,
                        class: vue.normalizeClass(vue.unref(bem).e("table-col"))
                      }, {
                        default: vue.withCtx(() => [
                          col.key === "name" ? (vue.openBlock(), vue.createBlock(_component_ll_input, {
                            key: 0,
                            value: addData.value,
                            "onUpdate:value": _cache[0] || (_cache[0] = ($event) => addData.value = $event),
                            placeholder: "\u6DFB\u52A0\u53C2\u6570",
                            disabled: vue.unref(disabled),
                            bordered: false,
                            onBlur: _cache[1] || (_cache[1] = ($event) => handleAdd(props.dataSource))
                          }, null, 8, ["value", "disabled"])) : vue.createCommentVNode("v-if", true)
                        ]),
                        _: 2
                        /* DYNAMIC */
                      }, 1032, ["span", "class"]);
                    }),
                    128
                    /* KEYED_FRAGMENT */
                  ))
                ]),
                _: 1
                /* STABLE */
              }, 8, ["class"])
            ],
            2
            /* CLASS */
          )
        ],
        2
        /* CLASS */
      );
    };
  }
});

exports.default = _sfc_main;
//# sourceMappingURL=params-table.vue2.js.map
