@alicloud/console-base-rc-side-panel 1.1.8-beta.3 → 1.1.9-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -11,9 +11,10 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _consoleBaseRcEasyIcon = require("@alicloud/console-base-rc-easy-icon");
|
|
13
13
|
var _consoleBaseRcTooltip = require("@alicloud/console-base-rc-tooltip");
|
|
14
|
+
var _consoleBaseRcHtmlTrusted = _interopRequireDefault(require("@alicloud/console-base-rc-html-trusted"));
|
|
14
15
|
var _model = require("../../../model");
|
|
15
16
|
var _rc = require("../../rc");
|
|
16
|
-
var _excluded = ["id", "className", "style", "active", "title", "icon", "unread", "mark", "tooltip", "tooltipOptions", "onlyShowIcon", "onClick", "onActiveChange"];
|
|
17
|
+
var _excluded = ["id", "className", "style", "active", "title", "icon", "unread", "mark", "tooltip", "tooltipAsHtml", "tooltipOptions", "onlyShowIcon", "onClick", "onActiveChange"];
|
|
17
18
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
18
19
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
19
20
|
function Item(_ref) {
|
|
@@ -26,6 +27,7 @@ function Item(_ref) {
|
|
|
26
27
|
unread = _ref.unread,
|
|
27
28
|
mark = _ref.mark,
|
|
28
29
|
tooltip = _ref.tooltip,
|
|
30
|
+
tooltipAsHtml = _ref.tooltipAsHtml,
|
|
29
31
|
tooltipOptions = _ref.tooltipOptions,
|
|
30
32
|
onlyShowIcon = _ref.onlyShowIcon,
|
|
31
33
|
onClick = _ref.onClick,
|
|
@@ -53,7 +55,9 @@ function Item(_ref) {
|
|
|
53
55
|
}));
|
|
54
56
|
};
|
|
55
57
|
return collapsed || !tooltip && !title ? renderItem() : /*#__PURE__*/_react.default.createElement(_consoleBaseRcTooltip.TooltipV1, (0, _extends2.default)({
|
|
56
|
-
title: tooltip
|
|
58
|
+
title: tooltipAsHtml && typeof tooltip === 'string' ? /*#__PURE__*/_react.default.createElement(_consoleBaseRcHtmlTrusted.default, {
|
|
59
|
+
text: tooltip
|
|
60
|
+
}) : tooltip || title,
|
|
57
61
|
placement: "left",
|
|
58
62
|
destroyTooltipOnHide: true,
|
|
59
63
|
fixed: true
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["id", "className", "style", "active", "title", "icon", "unread", "mark", "tooltip", "tooltipOptions", "onlyShowIcon", "onClick", "onActiveChange"];
|
|
3
|
+
var _excluded = ["id", "className", "style", "active", "title", "icon", "unread", "mark", "tooltip", "tooltipAsHtml", "tooltipOptions", "onlyShowIcon", "onClick", "onActiveChange"];
|
|
4
4
|
import React, { useCallback } from 'react';
|
|
5
5
|
import { renderEasyIcon } from '@alicloud/console-base-rc-easy-icon';
|
|
6
6
|
import { TooltipV1 } from '@alicloud/console-base-rc-tooltip';
|
|
7
|
+
import HtmlTrusted from '@alicloud/console-base-rc-html-trusted';
|
|
7
8
|
import { useCollapsed } from '../../../model';
|
|
8
9
|
import { SidePanelItemWrap, SidePanelItemButton, SidePanelItemBadge } from '../../rc';
|
|
9
10
|
export default function Item(_ref) {
|
|
@@ -16,6 +17,7 @@ export default function Item(_ref) {
|
|
|
16
17
|
unread = _ref.unread,
|
|
17
18
|
mark = _ref.mark,
|
|
18
19
|
tooltip = _ref.tooltip,
|
|
20
|
+
tooltipAsHtml = _ref.tooltipAsHtml,
|
|
19
21
|
tooltipOptions = _ref.tooltipOptions,
|
|
20
22
|
onlyShowIcon = _ref.onlyShowIcon,
|
|
21
23
|
onClick = _ref.onClick,
|
|
@@ -43,7 +45,9 @@ export default function Item(_ref) {
|
|
|
43
45
|
}));
|
|
44
46
|
};
|
|
45
47
|
return collapsed || !tooltip && !title ? renderItem() : /*#__PURE__*/React.createElement(TooltipV1, _extends({
|
|
46
|
-
title: tooltip
|
|
48
|
+
title: tooltipAsHtml && typeof tooltip === 'string' ? /*#__PURE__*/React.createElement(HtmlTrusted, {
|
|
49
|
+
text: tooltip
|
|
50
|
+
}) : tooltip || title,
|
|
47
51
|
placement: "left",
|
|
48
52
|
destroyTooltipOnHide: true,
|
|
49
53
|
fixed: true
|
|
@@ -18,6 +18,10 @@ export interface ISidePanelItemProps extends Omit<ButtonProps, 'label' | 'size'
|
|
|
18
18
|
* 当需要复杂的 tooltip 时,可以用这个 prop
|
|
19
19
|
*/
|
|
20
20
|
tooltip?: string | React.ReactElement;
|
|
21
|
+
/**
|
|
22
|
+
* 当 Tooltip 没有条件用 JSX,必须是字符串但又需要展示成 HTML 时,可以用 `tooltipAsHtml: true`
|
|
23
|
+
*/
|
|
24
|
+
tooltipAsHtml?: boolean;
|
|
21
25
|
/**
|
|
22
26
|
* tooltip 的配置
|
|
23
27
|
*/
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { SidePanelItemProps } from '../../../model';
|
|
2
|
-
export default function Item({ id, className, style, active, title, icon, unread, mark, tooltip, tooltipOptions, onlyShowIcon, onClick, onActiveChange, ...rest }: SidePanelItemProps): JSX.Element;
|
|
2
|
+
export default function Item({ id, className, style, active, title, icon, unread, mark, tooltip, tooltipAsHtml, tooltipOptions, onlyShowIcon, onClick, onActiveChange, ...rest }: SidePanelItemProps): JSX.Element;
|