import { defineComponent as _, inject as y, shallowRef as $, ref as h, openBlock as k, createBlock as V, unref as s, withCtx as u, createElementVNode as c, renderSlot as w, createVNode as C, createTextVNode as F } from "vue";
import { ElCol as P, ElButton as x } from "element-plus";
import { Plus as A } from "../../../node_modules/.pnpm/@element-plus_icons-vue@2.3.1_vue@3.4.21/node_modules/@element-plus/icons-vue/dist/index.mjs";
import { SymbolState as B } from "../symbol.mjs";
import { wetProFormListProps as E } from "../types.mjs";
import N from "../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/cloneDeep.mjs";
const T = /* @__PURE__ */ _({
  name: "WetProFormList",
  __name: "list",
  props: E,
  setup(i) {
    const e = y(B), r = i, o = $(0), t = h([]), a = () => {
      t.value.push(`${o.value}`), o.value++;
    }, m = (l, n) => {
      if (r.prop) {
        const p = Array.isArray(r.prop) ? [...r.prop] : [r.prop], f = e == null ? void 0 : e.getFieldsValue([...p, `${n}`]), v = N(f);
        e == null || e.setFieldsValue([...p, `${o.value}`], v), t.value.splice(l + 1, 0, `${o.value}`), o.value++;
      }
    }, d = (l) => {
      t.value.splice(l, 1), t.value.length === 0 && (o.value = 0);
    };
    return (l, n) => (k(), V(s(P), null, {
      default: u(() => [
        c("div", null, [
          w(l.$slots, "default", {
            keys: t.value,
            deleteItem: d,
            addItem: a,
            copyAdd: m
          })
        ]),
        c("div", null, [
          C(s(x), {
            style: { width: "100%" },
            icon: s(A),
            onClick: a
          }, {
            default: u(() => [
              F("添加一行数据")
            ]),
            _: 1
          }, 8, ["icon"])
        ])
      ]),
      _: 3
    }));
  }
});
export {
  T as default
};
