1 | import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2 | import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
3 | var _excluded = ["color", "check"];
|
4 | import { CheckOutlined } from '@ant-design/icons';
|
5 | import { Tooltip } from 'antd';
|
6 | import React from 'react';
|
7 | import { jsx as _jsx } from "react/jsx-runtime";
|
8 | var Tag = React.forwardRef(function (_ref, ref) {
|
9 | var color = _ref.color,
|
10 | check = _ref.check,
|
11 | rest = _objectWithoutProperties(_ref, _excluded);
|
12 | return _jsx("div", _objectSpread(_objectSpread({}, rest), {}, {
|
13 | style: {
|
14 | backgroundColor: color
|
15 | },
|
16 | ref: ref,
|
17 | children: check ? _jsx(CheckOutlined, {}) : ''
|
18 | }));
|
19 | });
|
20 | var ThemeColor = function ThemeColor(_ref2) {
|
21 | var value = _ref2.value,
|
22 | colorList = _ref2.colorList,
|
23 | onChange = _ref2.onChange,
|
24 | prefixCls = _ref2.prefixCls,
|
25 | formatMessage = _ref2.formatMessage,
|
26 | hashId = _ref2.hashId;
|
27 | if (!colorList || (colorList === null || colorList === void 0 ? void 0 : colorList.length) < 1) {
|
28 | return null;
|
29 | }
|
30 | var baseClassName = "".concat(prefixCls, "-theme-color");
|
31 | return _jsx("div", {
|
32 | className: "".concat(baseClassName, " ").concat(hashId),
|
33 | children: colorList === null || colorList === void 0 ? void 0 : colorList.map(function (_ref3) {
|
34 | var key = _ref3.key,
|
35 | color = _ref3.color,
|
36 | title = _ref3.title;
|
37 | if (!key) return null;
|
38 | return _jsx(Tooltip, {
|
39 | title: title !== null && title !== void 0 ? title : formatMessage({
|
40 | id: "app.setting.themecolor.".concat(key)
|
41 | }),
|
42 | children: _jsx(Tag, {
|
43 | className: "".concat(baseClassName, "-block ").concat(hashId),
|
44 | color: color,
|
45 | check: value === color,
|
46 | onClick: function onClick() {
|
47 | return onChange && onChange(color);
|
48 | }
|
49 | })
|
50 | }, color);
|
51 | })
|
52 | });
|
53 | };
|
54 | export { ThemeColor }; |
\ | No newline at end of file |