UNPKG

1.34 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.maybeAnimation = exports.isFullTooltip = exports.maybeTooltip = exports.subTooltip = void 0;
4const util_1 = require("@antv/util");
5const helper_1 = require("./helper");
6function subTooltip(tooltip, name, defaults = {}, main = false) {
7 if ((0, helper_1.isUnset)(tooltip))
8 return tooltip;
9 if (Array.isArray(tooltip) && main)
10 return tooltip;
11 const sub = (0, helper_1.subObject)(tooltip, name);
12 return (0, util_1.deepMix)(defaults, sub);
13}
14exports.subTooltip = subTooltip;
15function maybeTooltip(tooltip, defaults = {}) {
16 if ((0, helper_1.isUnset)(tooltip))
17 return tooltip;
18 if (Array.isArray(tooltip))
19 return tooltip;
20 if (!isFullTooltip(tooltip))
21 return tooltip;
22 return (0, util_1.deepMix)(defaults, tooltip);
23}
24exports.maybeTooltip = maybeTooltip;
25function isFullTooltip(tooltip) {
26 if (Object.keys(tooltip).length === 0)
27 return true;
28 const { title, items } = tooltip;
29 return title !== undefined || items !== undefined;
30}
31exports.isFullTooltip = isFullTooltip;
32function maybeAnimation(animate, sub) {
33 return typeof animate === 'object' ? (0, helper_1.subObject)(animate, sub) : animate;
34}
35exports.maybeAnimation = maybeAnimation;
36//# sourceMappingURL=mark.js.map
\No newline at end of file