import "react";
import { jsx, jsxs } from "../../../node_modules/.pnpm/@emotion_react@11.10.4_q4mq7tnhdumujvomvw24zx33y4/node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js";
import ArcoForm from "../../../node_modules/.pnpm/@arco-design_web-react@2.40.1_biqbaboplfbrettd7655fr4n2y/node_modules/@arco-design/web-react/es/Form/index.js";
import Space from "../../../node_modules/.pnpm/@arco-design_web-react@2.40.1_biqbaboplfbrettd7655fr4n2y/node_modules/@arco-design/web-react/es/Space/index.js";
import Input from "../../../node_modules/.pnpm/@arco-design_web-react@2.40.1_biqbaboplfbrettd7655fr4n2y/node_modules/@arco-design/web-react/es/Input/input.js";
import Button from "../../../node_modules/.pnpm/@arco-design_web-react@2.40.1_biqbaboplfbrettd7655fr4n2y/node_modules/@arco-design/web-react/es/Button/index.js";
import IconDelete from "../../../node_modules/.pnpm/@arco-design_web-react@2.40.1_biqbaboplfbrettd7655fr4n2y/node_modules/@arco-design/web-react/icon/react-icon/IconDelete/index.js";
function List(props) {
  console.log("props:", props);
  return /* @__PURE__ */ jsx(ArcoForm.List, {
    field: props == null ? void 0 : props.name,
    children: (fields, {
      add,
      remove,
      move
    }) => {
      let values = Array.isArray(fields) ? fields : [fields];
      return /* @__PURE__ */ jsxs("div", {
        children: [values && values.map((item, index) => {
          var _a;
          return /* @__PURE__ */ jsx("div", {
            children: /* @__PURE__ */ jsx(ArcoForm.Item, {
              label: (props == null ? void 0 : props.label) + " " + index,
              children: /* @__PURE__ */ jsxs(Space, {
                children: [(_a = props.options) == null ? void 0 : _a.map((i, ii) => {
                  return /* @__PURE__ */ jsx(ArcoForm.Item, {
                    label: i.label,
                    field: item.field + `.${i.value}`,
                    rules: [{
                      required: i.required ? true : false
                    }],
                    noStyle: true,
                    children: /* @__PURE__ */ jsx(Input, {
                      placeholder: i.placeholder || i.label || ""
                    })
                  });
                }), /* @__PURE__ */ jsx(Button, {
                  icon: /* @__PURE__ */ jsx(IconDelete, {}),
                  shape: "circle",
                  status: "danger",
                  onClick: () => remove(index)
                })]
              })
            })
          }, item.key);
        }), /* @__PURE__ */ jsx(ArcoForm.Item, {
          children: /* @__PURE__ */ jsx(Button, {
            onClick: () => {
              add();
            },
            children: "\u65B0\u589E"
          })
        })]
      });
    }
  });
}
export {
  List
};
//# sourceMappingURL=List.js.map
