1 | import "antd/es/tooltip/style";
|
2 | import _Tooltip from "antd/es/tooltip";
|
3 | import { CheckOutlined } from '@ant-design/icons';
|
4 | import classNames from 'classnames';
|
5 | import React, { useMemo } from 'react';
|
6 |
|
7 | var BlockCheckbox = function BlockCheckbox(_ref) {
|
8 | var value = _ref.value,
|
9 | configType = _ref.configType,
|
10 | onChange = _ref.onChange,
|
11 | list = _ref.list,
|
12 | prefixCls = _ref.prefixCls;
|
13 | var baseClassName = "".concat(prefixCls, "-drawer-block-checkbox");
|
14 | var dom = useMemo(function () {
|
15 | var domList = (list || []).map(function (item) {
|
16 | return React.createElement(_Tooltip, {
|
17 | title: item.title,
|
18 | key: item.key
|
19 | }, React.createElement("div", {
|
20 | className: classNames("".concat(baseClassName, "-item"), "".concat(baseClassName, "-item-").concat(item.key), "".concat(baseClassName, "-").concat(configType, "-item")),
|
21 | onClick: function onClick() {
|
22 | return onChange(item.key);
|
23 | }
|
24 | }, React.createElement(CheckOutlined, {
|
25 | className: "".concat(baseClassName, "-selectIcon"),
|
26 | style: {
|
27 | display: value === item.key ? 'block' : 'none'
|
28 | }
|
29 | })));
|
30 | });
|
31 | return domList;
|
32 | }, [value, list === null || list === void 0 ? void 0 : list.length, onChange]);
|
33 | return React.createElement("div", {
|
34 | className: baseClassName,
|
35 | style: {
|
36 | minHeight: 42
|
37 | }
|
38 | }, dom);
|
39 | };
|
40 |
|
41 | export default BlockCheckbox; |
\ | No newline at end of file |