UNPKG

linkmore-design

Version:

🌈 πŸš€lmη»„δ»ΆεΊ“γ€‚πŸš€

81 lines β€’ 3.02 kB
import React from 'react'; import Button from "../../button"; import IconFont from "../../icon-font"; import Popover from "../../popover"; import DisabledContext from "../../config-provider/DisabledContext"; var QuickOpetate = function QuickOpetate(_ref) { var record = _ref.record, rowKey = _ref.rowKey, handleAdd = _ref.handleAdd, handleDelete = _ref.handleDelete, _ref$options = _ref.options, options = _ref$options === void 0 ? ['add', 'delete'] : _ref$options, getLength = _ref.getLength, quickOpetateClearAll = _ref.quickOpetateClearAll; var disabled = React.useContext(DisabledContext) || false; var appendChildren = function appendChildren() { handleAdd === null || handleAdd === void 0 ? void 0 : handleAdd(record, true); }; var appendAdd = function appendAdd() { handleAdd === null || handleAdd === void 0 ? void 0 : handleAdd(record); }; return /*#__PURE__*/React.createElement("div", { style: { display: 'flex', alignItems: 'center', justifyContent: 'flex-start', marginLeft: '-4px' } }, options !== null && options !== void 0 && options.includes('add') && options !== null && options !== void 0 && options.includes('addInChildren') ? /*#__PURE__*/React.createElement(Popover, { placement: "bottom", overlayClassName: "lm_table_append_add_popover" // open={true} , title: null, className: "lm_edittable_add_btn", content: /*#__PURE__*/React.createElement("ul", null, /*#__PURE__*/React.createElement("li", { onClick: appendAdd }, "\u6DFB\u52A0\u5E73\u7EA7"), /*#__PURE__*/React.createElement("li", { onClick: appendChildren }, "\u6DFB\u52A0\u5B50\u7EA7")), trigger: "hover" }, /*#__PURE__*/React.createElement(Button, { type: "link", size: "small", icon: /*#__PURE__*/React.createElement(IconFont, { type: "icon-jia", style: { fontSize: 16 } }) })) : options !== null && options !== void 0 && options.includes('add') || options !== null && options !== void 0 && options.includes('addInChildren') ? /*#__PURE__*/React.createElement(Button, { type: "link", size: "small", className: "lm_edittable_add_btn", disabled: disabled, icon: /*#__PURE__*/React.createElement(IconFont, { type: "icon-jia", style: { fontSize: 16 } }), onClick: function onClick() { return handleAdd(record, !!(options !== null && options !== void 0 && options.includes('addInChildren'))); } }) : null, options.includes('delete') && /*#__PURE__*/React.createElement(Button, { type: "link", size: "small", className: "lm_edittable_delete_btn", disabled: !quickOpetateClearAll && getLength < 2 || disabled, icon: /*#__PURE__*/React.createElement(IconFont, { type: "icon-a-shidia1qingchu", style: { fontSize: 16 } }), onClick: function onClick() { return handleDelete(record[rowKey]); } })); }; export default QuickOpetate;