1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.maybeAnimation = exports.isFullTooltip = exports.maybeTooltip = exports.subTooltip = void 0;
|
4 | const util_1 = require("@antv/util");
|
5 | const helper_1 = require("./helper");
|
6 | function 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 | }
|
14 | exports.subTooltip = subTooltip;
|
15 | function 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 | }
|
24 | exports.maybeTooltip = maybeTooltip;
|
25 | function isFullTooltip(tooltip) {
|
26 | if (Object.keys(tooltip).length === 0)
|
27 | return true;
|
28 | const { title, items } = tooltip;
|
29 | return title !== undefined || items !== undefined;
|
30 | }
|
31 | exports.isFullTooltip = isFullTooltip;
|
32 | function maybeAnimation(animate, sub) {
|
33 | return typeof animate === 'object' ? (0, helper_1.subObject)(animate, sub) : animate;
|
34 | }
|
35 | exports.maybeAnimation = maybeAnimation;
|
36 |
|
\ | No newline at end of file |