@difizen/magent-au
Version:
65 lines • 1.99 kB
JavaScript
import { PlusOutlined } from '@ant-design/icons';
import { Collapse, Space } from 'antd';
import { SelectedItem } from "../item-crad/index.js";
import "./index.less";
import { jsx as _jsx } from "react/jsx-runtime";
import { Fragment as _Fragment } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
var clsPrefix = 'config-list';
export var ConfigList = function ConfigList(_ref) {
var selector = _ref.selector;
var list = selector.map(function (item) {
return {
key: item.key,
label: item.title,
extra: /*#__PURE__*/_jsx("div", {
className: "".concat(clsPrefix, "-card-add"),
children: /*#__PURE__*/_jsx(PlusOutlined, {
onClick: function onClick(e) {
e.stopPropagation();
item.onAdd();
}
})
}),
children: /*#__PURE__*/_jsx(_Fragment, {
children: item.options.map(function (option) {
return /*#__PURE__*/_jsx(SelectedItem, {
onDelete: function onDelete() {
item.onDelete(option);
},
icon: option.icon,
title: option.nickname || '-',
description: option.description || '-'
}, option.id);
})
}),
style: {
padding: 0
}
};
});
return /*#__PURE__*/_jsx("div", {
className: "".concat(clsPrefix, "-container"),
children: /*#__PURE__*/_jsx(Space, {
direction: "vertical",
size: 'large',
style: {
display: 'flex'
},
children: /*#__PURE__*/_jsxs("div", {
className: "".concat(clsPrefix, "-card"),
children: [/*#__PURE__*/_jsx("div", {
className: "".concat(clsPrefix, "-card-title"),
children: "\u6280\u80FD"
}), /*#__PURE__*/_jsx(Collapse, {
style: {
padding: 0
},
defaultActiveKey: ['knowledge', 'tool'],
ghost: true,
items: list
})]
})
})
});
};