'use strict';

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

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

"use strict";
var _sfc_main = /* @__PURE__ */ vue.defineComponent({
  ...{ name: "LlParamsTableRow" },
  __name: "params-table-row",
  props: paramsTable.paramsTableRowProps,
  setup(__props) {
    const props = __props;
    const bem = createNamespace.createNamespace("params-table");
    const disabled = vue.inject("disabled");
    const innerData = vue.ref(props.data);
    const handleDelete = (list, data) => {
      const index = list.findIndex((item) => item.name === data.name);
      list.splice(index, 1);
    };
    return (_ctx, _cache) => {
      const _component_ll_input = vue.resolveComponent("ll-input");
      const _component_ll_icon = vue.resolveComponent("ll-icon");
      const _component_ll_button = vue.resolveComponent("ll-button");
      const _component_ll_select = vue.resolveComponent("ll-select");
      const _component_ll_switch = vue.resolveComponent("ll-switch");
      const _component_a_auto_complete = vue.resolveComponent("a-auto-complete");
      const _component_a_col = vue.resolveComponent("a-col");
      const _component_a_row = vue.resolveComponent("a-row");
      const _component_a_popconfirm = vue.resolveComponent("a-popconfirm");
      return vue.openBlock(), vue.createElementBlock("div", null, [
        vue.createVNode(_component_a_row, {
          gutter: 20,
          class: vue.normalizeClass(vue.unref(bem).e("table-row"))
        }, {
          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 || 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: innerData.value.name,
                              "onUpdate:value": _cache[0] || (_cache[0] = ($event) => innerData.value.name = $event),
                              disabled: vue.unref(disabled),
                              placeholder: "\u8BF7\u8F93\u5165"
                            }, null, 8, ["value", "disabled"])) : vue.createCommentVNode("v-if", true),
                            col.key === "required" ? (vue.openBlock(), vue.createBlock(_component_ll_button, {
                              key: 1,
                              type: "link",
                              disabled: vue.unref(disabled),
                              class: vue.normalizeClass(`${vue.unref(bem).m("required")} ${innerData.value.required ? vue.unref(bem).is("required") : ""}`),
                              onClick: _cache[1] || (_cache[1] = ($event) => innerData.value.required = !innerData.value.required)
                            }, {
                              default: vue.withCtx(() => [
                                vue.withDirectives(vue.createVNode(
                                  _component_ll_icon,
                                  { "icon-name": "icon-radio-check" },
                                  null,
                                  512
                                  /* NEED_PATCH */
                                ), [
                                  [vue.vShow, innerData.value.required]
                                ])
                              ]),
                              _: 1
                              /* STABLE */
                            }, 8, ["disabled", "class"])) : vue.createCommentVNode("v-if", true),
                            col.key === "type" ? (vue.openBlock(), vue.createBlock(_component_ll_select, {
                              key: 2,
                              value: innerData.value.type,
                              "onUpdate:value": _cache[2] || (_cache[2] = ($event) => innerData.value.type = $event),
                              options: vue.unref(paramsTable.paramsOptions),
                              disabled: vue.unref(disabled),
                              placeholder: "\u8BF7\u9009\u62E9",
                              style: { "width": "100%" }
                            }, null, 8, ["value", "options", "disabled"])) : vue.createCommentVNode("v-if", true),
                            col.key === "value" ? (vue.openBlock(), vue.createBlock(clickInput_vue_vue_type_script_setup_true_lang.default, {
                              key: 3,
                              value: innerData.value.value,
                              "onUpdate:value": _cache[3] || (_cache[3] = ($event) => innerData.value.value = $event),
                              type: "code",
                              placeholder: "\u8BF7\u8F93\u5165",
                              style: { "width": "100%" }
                            }, null, 8, ["value"])) : vue.createCommentVNode("v-if", true),
                            col.key === "static" ? (vue.openBlock(), vue.createBlock(_component_ll_switch, {
                              key: 4,
                              checked: innerData.value[col.key],
                              "onUpdate:checked": ($event) => innerData.value[col.key] = $event,
                              disabled: vue.unref(disabled)
                            }, null, 8, ["checked", "onUpdate:checked", "disabled"])) : vue.createCommentVNode("v-if", true),
                            col.key === "description" ? (vue.openBlock(), vue.createBlock(_component_ll_input, {
                              key: 5,
                              value: innerData.value[col.key],
                              "onUpdate:value": ($event) => innerData.value[col.key] = $event,
                              placeholder: col.placeholder || "\u8BF7\u8F93\u5165",
                              disabled: vue.unref(disabled)
                            }, null, 8, ["value", "onUpdate:value", "placeholder", "disabled"])) : vue.createCommentVNode("v-if", true),
                            col.key === "contentType" ? (vue.openBlock(), vue.createBlock(_component_a_auto_complete, {
                              key: 6,
                              value: innerData.value[col.key],
                              "onUpdate:value": ($event) => innerData.value[col.key] = $event,
                              class: vue.normalizeClass(vue.unref(bem).e("auto-complete")),
                              style: { width: "100%" },
                              disabled: vue.unref(disabled),
                              options: vue.unref(paramsTable.contentTypeOptions),
                              placeholder: col.placeholder || "\u8BF7\u8F93\u5165"
                            }, null, 8, ["value", "onUpdate:value", "class", "disabled", "options", "placeholder"])) : vue.createCommentVNode("v-if", true)
                          ]),
                          _: 2
                          /* DYNAMIC */
                        }, 1032, ["span", "class"]);
                      }),
                      128
                      /* KEYED_FRAGMENT */
                    ))
                  ]),
                  _: 1
                  /* STABLE */
                })
              ]),
              _: 1
              /* STABLE */
            }),
            vue.createVNode(_component_a_col, {
              span: 2,
              class: vue.normalizeClass(vue.unref(bem).e("table-col"))
            }, {
              default: vue.withCtx(() => [
                vue.createVNode(_component_a_popconfirm, {
                  title: "\u786E\u5B9A\u8981\u79FB\u9664\u5417\uFF1F",
                  "ok-text": "\u786E\u8BA4",
                  "cancel-text": "\u53D6\u6D88",
                  placement: "topRight",
                  disabled: vue.unref(disabled),
                  "overlay-class-name": vue.unref(bem).e("popconfirm"),
                  onConfirm: _cache[4] || (_cache[4] = ($event) => handleDelete(props.dataSource, innerData.value))
                }, {
                  default: vue.withCtx(() => [
                    vue.createVNode(_component_ll_button, {
                      type: "link",
                      disabled: vue.unref(disabled)
                    }, {
                      default: vue.withCtx(() => [
                        vue.createVNode(_component_ll_icon, { "icon-name": "icon-remove" })
                      ]),
                      _: 1
                      /* STABLE */
                    }, 8, ["disabled"])
                  ]),
                  _: 1
                  /* STABLE */
                }, 8, ["disabled", "overlay-class-name"])
              ]),
              _: 1
              /* STABLE */
            }, 8, ["class"])
          ]),
          _: 1
          /* STABLE */
        }, 8, ["class"])
      ]);
    };
  }
});

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