@visactor/vchart 1.13.14 → 1.13.16
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.
- package/build/es5/index.js +1 -1
- package/build/index.es.js +74 -65
- package/build/index.js +138 -129
- package/build/index.min.js +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/animation/config.js +2 -1
- package/cjs/animation/utils.js +1 -2
- package/cjs/constant/scroll-bar.js +1 -1
- package/cjs/constant/sunburst.js +1 -1
- package/cjs/constant/waterfall.js +1 -1
- package/cjs/constant/word-cloud.js +1 -1
- package/cjs/core/expression-function.js +1 -2
- package/cjs/core/index.d.ts +2 -1
- package/cjs/core/index.js +5 -4
- package/cjs/core/index.js.map +1 -1
- package/cjs/core/vchart.js +2 -1
- package/cjs/event/event-dispatcher.js +1 -1
- package/cjs/event/event.js +1 -1
- package/cjs/event/index.js +1 -1
- package/cjs/event/interface.js +1 -1
- package/cjs/plugin/components/tooltip-handler/dom-tooltip-handler.d.ts +1 -1
- package/cjs/plugin/components/tooltip-handler/dom-tooltip-handler.js +4 -3
- package/cjs/plugin/components/tooltip-handler/dom-tooltip-handler.js.map +1 -1
- package/cjs/series/dot/dot.d.ts +1 -1
- package/cjs/series/link/link.d.ts +1 -1
- package/cjs/series/sankey/interface.d.ts +2 -0
- package/cjs/series/sankey/interface.js.map +1 -1
- package/cjs/series/sankey/sankey.d.ts +7 -6
- package/cjs/series/sankey/sankey.js +43 -46
- package/cjs/series/sankey/sankey.js.map +1 -1
- package/cjs/util/style.js +3 -2
- package/cjs/util/style.js.map +1 -1
- package/esm/animation/config.js +2 -1
- package/esm/animation/utils.js +1 -2
- package/esm/constant/scroll-bar.js +1 -1
- package/esm/constant/sunburst.js +1 -1
- package/esm/constant/waterfall.js +1 -1
- package/esm/constant/word-cloud.js +1 -1
- package/esm/core/expression-function.js +1 -2
- package/esm/core/index.d.ts +2 -1
- package/esm/core/index.js +3 -1
- package/esm/core/index.js.map +1 -1
- package/esm/core/vchart.js +2 -1
- package/esm/event/event-dispatcher.js +1 -1
- package/esm/event/event.js +1 -1
- package/esm/event/index.js +1 -1
- package/esm/event/interface.js +1 -1
- package/esm/plugin/components/tooltip-handler/dom-tooltip-handler.d.ts +1 -1
- package/esm/plugin/components/tooltip-handler/dom-tooltip-handler.js +4 -3
- package/esm/plugin/components/tooltip-handler/dom-tooltip-handler.js.map +1 -1
- package/esm/series/dot/dot.d.ts +1 -1
- package/esm/series/link/link.d.ts +1 -1
- package/esm/series/sankey/interface.d.ts +2 -0
- package/esm/series/sankey/interface.js.map +1 -1
- package/esm/series/sankey/sankey.d.ts +7 -6
- package/esm/series/sankey/sankey.js +43 -40
- package/esm/series/sankey/sankey.js.map +1 -1
- package/esm/util/style.js +3 -2
- package/esm/util/style.js.map +1 -1
- package/package.json +4 -4
package/cjs/util/style.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/util/style.ts"],"names":[],"mappings":";;;AAAA,6CAAuE;AAUvE,SAAgB,uBAAuB,CAAC,MAAW,EAAE;IACnD,MAAM,SAAS,qBACV,GAAG,CACP,CAAC;IAEF,IAAI,IAAA,mBAAU,EAAC,GAAG,CAAC,KAAK,CAAC,EAAE;QACzB,SAAS,CAAC,KAAK,GAAG,CAAC,IAAqB,EAAE,UAAmB,EAAE,KAAa,EAAE,QAA2B,EAAE,EAAE,CAC3G,kBAAkB,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;KACpE;SAAM,IAAI,CAAC,IAAA,gBAAO,EAAC,GAAG,CAAC,KAAK,CAAC,EAAE;QAC9B,SAAS,CAAC,KAAK,GAAG,kBAAkB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;KACjD;IAED,IAAI,CAAC,IAAA,gBAAO,EAAC,GAAG,CAAC,KAAK,CAAC,EAAE;QACvB,MAAM,aAAa,GAAG,EAAE,CAAC;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AC,EAAE;YAC1B,aAAa,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;SACxC;aAAM;YACL,aAAa,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;SACjC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,kBAAkB,CAAC,aAAa,CAAC,CAAC;AAC3C,CAAC;AAbD,0DAaC;AAED,SAAgB,kBAAkB,CAAC,KAAU;IAC3C,IAAI,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,EAAE;QAChB,uCACK,KAAK,KACR,KAAK,EAAE,IAAA,uBAAc,EAAC,KAAK,CAAC,KAAK,CAAC,IAClC;KACH;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AATD,gDASC","file":"style.js","sourcesContent":["import { degreeToRadian, isEmpty, isFunction } from '@visactor/vutils';\nimport type { Datum } from '../typings';\nimport type { LegendItemDatum } from '@visactor/vrender-components';\n\n/**\n * 针对一些可以配置状态样式的属性的转换函数,结构如下:\n * { style: {}, state: { hover: {} } }\n * @param cfg\n * @returns\n */\nexport function transformComponentStyle(cfg: any = {}) {\n const newConfig = {\n ...cfg\n };\n\n if (isFunction(cfg.style)) {\n newConfig.style = (item: LegendItemDatum, isSelected: boolean, index: number, allItems: LegendItemDatum[]) =>\n transformToGraphic(cfg.style(item, isSelected, index, allItems));\n } else if (!isEmpty(cfg.style)) {\n newConfig.style = transformToGraphic(cfg.style);\n }\n\n if (!isEmpty(cfg.state)) {\n const newStateStyle = {};\n Object.keys(cfg.state).forEach(key => {\n if (isFunction(cfg.state[key])) {\n newStateStyle[key] = (item: LegendItemDatum, isSelected: boolean, index: number, allItems: LegendItemDatum[]) =>\n transformToGraphic(cfg.state[key](item, isSelected, index, allItems));\n } else if (!isEmpty(cfg.state[key])) {\n newStateStyle[key] = transformToGraphic(cfg.state[key]);\n }\n });\n newConfig.state = newStateStyle;\n }\n\n return newConfig;\n}\n\nexport function transformStateStyle(stateStyle: any) {\n if (isEmpty(stateStyle)) {\n return null;\n }\n const newStateStyle = {};\n Object.keys(stateStyle).forEach(key => {\n if (isFunction(stateStyle[key])) {\n newStateStyle[key] = (value: any, index: number, datum: Datum, data: Datum[]) =>\n transformToGraphic(stateStyle[key](value, index, datum, data));\n } else if (!isEmpty(stateStyle[key])) {\n newStateStyle[key] = transformToGraphic(stateStyle[key]);\n }\n });\n\n return newStateStyle;\n}\n\nexport function transformAxisLabelStateStyle(stateStyle: any) {\n if (isEmpty(stateStyle)) {\n return null;\n }\n const newStateStyle = {};\n Object.keys(stateStyle).forEach(key => {\n if (isFunction(stateStyle[key])) {\n newStateStyle[key] = (datum: Datum, index: number, data: Datum[], layer?: number) => {\n return transformToGraphic(stateStyle[key](datum.rawValue, index, datum, data, layer));\n };\n } else if (!isEmpty(stateStyle[key])) {\n newStateStyle[key] = transformToGraphic(stateStyle[key]);\n }\n });\n\n return newStateStyle;\n}\n\nexport function transformIndicatorStyle(style: any, datum: any) {\n if (isEmpty(style)) {\n return null;\n }\n const newStateStyle = {};\n Object.keys(style).forEach(key => {\n if (isFunction(style[key])) {\n newStateStyle[key] = style[key](datum);\n } else {\n newStateStyle[key] = style[key];\n }\n });\n return transformToGraphic(newStateStyle);\n}\n\nexport function transformToGraphic(style: any) {\n if (style?.angle) {\n return {\n ...style,\n angle: degreeToRadian(style.angle)\n };\n }\n\n return style;\n}\n"]}
|
package/esm/animation/config.js
CHANGED
|
@@ -152,4 +152,5 @@ export const registerVGrammarLineOrAreaAnimation = () => {
|
|
|
152
152
|
|
|
153
153
|
export const registerVGrammarPolygonAnimation = () => {
|
|
154
154
|
View.useRegisters([ registerGrowPointsInAnimation, registerGrowPointsOutAnimation ]);
|
|
155
|
-
};
|
|
155
|
+
};
|
|
156
|
+
//# sourceMappingURL=config.js.map
|
package/esm/animation/utils.js
CHANGED
|
@@ -124,5 +124,4 @@ export function isAnimationEnabledForSeries(series) {
|
|
|
124
124
|
config && (config.large && config.largeThreshold && (animationThreshold = Math.min(animationThreshold, config.largeThreshold)),
|
|
125
125
|
config.progressiveThreshold && (animationThreshold = Math.min(animationThreshold, config.progressiveThreshold)));
|
|
126
126
|
})), !((null === (_d = null === (_c = series.getRawData()) || void 0 === _c ? void 0 : _c.latestData) || void 0 === _d ? void 0 : _d.length) >= animationThreshold);
|
|
127
|
-
}
|
|
128
|
-
//# sourceMappingURL=utils.js.map
|
|
127
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const SCROLL_BAR_DEFAULT_SIZE = 12;
|
|
2
|
-
//# sourceMappingURL=scroll-bar.js.map
|
|
2
|
+
//# sourceMappingURL=scroll-bar.js.map
|
package/esm/constant/sunburst.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const SUNBURST_AUTO_VISIBLE_DEFAULT_THRESHOLD = 10;
|
|
2
|
-
//# sourceMappingURL=sunburst.js.map
|
|
2
|
+
//# sourceMappingURL=sunburst.js.map
|
|
@@ -13,4 +13,4 @@ export const WORDCLOUD_DATA_TOTAL = `${PREFIX}_WORDCLOUD_DATA_TOTAL`;
|
|
|
13
13
|
export const WORD_CLOUD_TEXT = `${PREFIX}_WORD_CLOUD_TEXT`;
|
|
14
14
|
|
|
15
15
|
export const WORDCLOUD_SHAPE_DATA_TOTAL = `${PREFIX}_WORDCLOUD_SHAPE_DATA_TOTAL`;
|
|
16
|
-
//# sourceMappingURL=word-cloud.js.map
|
|
16
|
+
//# sourceMappingURL=word-cloud.js.map
|
package/esm/core/index.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { VChart } from './vchart';
|
|
2
2
|
import { Factory } from './factory';
|
|
3
3
|
export { VChart, Factory };
|
|
4
|
-
export declare const version = "1.13.
|
|
4
|
+
export declare const version = "1.13.16";
|
|
5
5
|
export type { IVChart } from './interface';
|
|
6
6
|
export type { IStateSpec, StateValueType } from '../compile/mark';
|
|
7
7
|
export type { IRegion } from '../region/interface';
|
|
8
8
|
export * from '../typings/spec/common';
|
|
9
9
|
export * from '../event/interface';
|
|
10
10
|
export * from '../theme/interface';
|
|
11
|
+
export * from '../compile/mark/interface';
|
|
11
12
|
export * from './interface';
|
|
12
13
|
export * from '../constant/base';
|
|
13
14
|
export * from '../constant/data';
|
package/esm/core/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Factory } from "./factory";
|
|
|
4
4
|
|
|
5
5
|
export { VChart, Factory };
|
|
6
6
|
|
|
7
|
-
export const version = "1.13.
|
|
7
|
+
export const version = "1.13.16";
|
|
8
8
|
|
|
9
9
|
export * from "../typings/spec/common";
|
|
10
10
|
|
|
@@ -12,6 +12,8 @@ export * from "../event/interface";
|
|
|
12
12
|
|
|
13
13
|
export * from "../theme/interface";
|
|
14
14
|
|
|
15
|
+
export * from "../compile/mark/interface";
|
|
16
|
+
|
|
15
17
|
export * from "./interface";
|
|
16
18
|
|
|
17
19
|
export * from "../constant/base";
|
package/esm/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAG3B,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC;AAOjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAG5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AAKjC,cAAc,uBAAuB,CAAC;AAGtC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,gBAAgB,CAAC;AAG/B,OAAO,EACL,OAAO,EACP,WAAW,EACX,cAAc,EACd,UAAU,EACV,SAAS,EACT,UAAU,EACV,UAAU,EACV,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,WAAW,EACZ,MAAM,wBAAwB,CAAC","file":"index.js","sourcesContent":["/**\n * @description The core module of VChart, containing the necessary interfaces for using VChart.\n */\n\nimport { VChart } from './vchart';\nimport { Factory } from './factory';\n\nexport { VChart, Factory };\n\n// export the version\nexport const version = \"1.13.
|
|
1
|
+
{"version":3,"sources":["../src/core/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAG3B,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC;AAOjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,aAAa,CAAC;AAG5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AAKjC,cAAc,uBAAuB,CAAC;AAGtC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,gBAAgB,CAAC;AAG/B,OAAO,EACL,OAAO,EACP,WAAW,EACX,cAAc,EACd,UAAU,EACV,SAAS,EACT,UAAU,EACV,UAAU,EACV,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,WAAW,EACZ,MAAM,wBAAwB,CAAC","file":"index.js","sourcesContent":["/**\n * @description The core module of VChart, containing the necessary interfaces for using VChart.\n */\n\nimport { VChart } from './vchart';\nimport { Factory } from './factory';\n\nexport { VChart, Factory };\n\n// export the version\nexport const version = \"1.13.16\";\n\n// export necessary types\nexport type { IVChart } from './interface';\nexport type { IStateSpec, StateValueType } from '../compile/mark';\nexport type { IRegion } from '../region/interface';\n\nexport * from '../typings/spec/common';\nexport * from '../event/interface';\nexport * from '../theme/interface';\nexport * from '../compile/mark/interface';\nexport * from './interface';\n\n// some constants\nexport * from '../constant/base';\nexport * from '../constant/data';\n\n/**\n * spec\n */\nexport * from '../typings/spec/index';\n\n// tooltip\nexport * from '../typings/tooltip';\n\n// theme\nexport * from '../theme/index';\n\n// vrender\nexport {\n vglobal,\n createGroup,\n createRichText,\n createText,\n createArc,\n createArea,\n createRect,\n createLine,\n createSymbol,\n ManualTicker,\n StreamLight\n} from '@visactor/vrender-core';\n"]}
|
package/esm/core/vchart.js
CHANGED
|
@@ -976,4 +976,5 @@ export const registerVChartCore = () => {
|
|
|
976
976
|
|
|
977
977
|
Factory.registerRegion("region", Region), Factory.registerLayout("base", Layout),
|
|
978
978
|
registerGroupMark(), View.useRegisters([ registerGesturePlugin ]), registerHoverInteraction(),
|
|
979
|
-
registerSelectInteraction(), registerTheme(darkTheme.name, darkTheme), Logger.getInstance(LoggerLevel.Error);
|
|
979
|
+
registerSelectInteraction(), registerTheme(darkTheme.name, darkTheme), Logger.getInstance(LoggerLevel.Error);
|
|
980
|
+
//# sourceMappingURL=vchart.js.map
|
|
@@ -226,4 +226,4 @@ export class EventDispatcher {
|
|
|
226
226
|
return eType && (interactionType = eType.split(":")[0], interactionType) && VGrammarFactory.hasInteraction(interactionType);
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
|
-
//# sourceMappingURL=event-dispatcher.js.map
|
|
229
|
+
//# sourceMappingURL=event-dispatcher.js.map
|
package/esm/event/event.js
CHANGED
package/esm/event/index.js
CHANGED
package/esm/event/interface.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { };
|
|
2
|
-
//# sourceMappingURL=interface.js.map
|
|
2
|
+
//# sourceMappingURL=interface.js.map
|
|
@@ -34,7 +34,7 @@ export declare class DomTooltipHandler extends BaseTooltipHandler {
|
|
|
34
34
|
protected _updateTooltip(visible: boolean, params: TooltipHandlerParams): void;
|
|
35
35
|
protected _initStyle(): void;
|
|
36
36
|
protected _updateDomStringByCol(actualTooltip?: ITooltipActual): void;
|
|
37
|
-
protected _updateDomStyle(sizeKey
|
|
37
|
+
protected _updateDomStyle(sizeKey: 'width' | 'height', refreshSize: boolean): void;
|
|
38
38
|
protected _getParentElement(spec: ITooltipSpec): HTMLElement;
|
|
39
39
|
isTooltipShown(): boolean;
|
|
40
40
|
reInit(): void;
|
|
@@ -75,7 +75,7 @@ export class DomTooltipHandler extends BaseTooltipHandler {
|
|
|
75
75
|
_getTooltipBoxSize(actualTooltip, changePositionOnly) {
|
|
76
76
|
var _a;
|
|
77
77
|
this._rootDom || this.initRootDom(), changePositionOnly || this._updateDomStringByCol(actualTooltip),
|
|
78
|
-
this._updateDomStyle("height");
|
|
78
|
+
this._updateDomStyle("height", changePositionOnly);
|
|
79
79
|
const rect = null === (_a = this._rootDom) || void 0 === _a ? void 0 : _a.getBoundingClientRect();
|
|
80
80
|
return {
|
|
81
81
|
width: null == rect ? void 0 : rect.width,
|
|
@@ -167,7 +167,7 @@ export class DomTooltipHandler extends BaseTooltipHandler {
|
|
|
167
167
|
}));
|
|
168
168
|
} else contentDom && !hasContent && contentDom.parentNode.removeChild(contentDom);
|
|
169
169
|
}
|
|
170
|
-
_updateDomStyle(sizeKey = "width") {
|
|
170
|
+
_updateDomStyle(sizeKey = "width", refreshSize) {
|
|
171
171
|
var _a, _b, _c, _d, _e;
|
|
172
172
|
const rootDom = this._rootDom, contentDom = [ ...rootDom.children ].find((child => child.className.includes(TOOLTIP_CONTENT_BOX_CLASS_NAME))), titleDom = [ ...rootDom.children ].find((child => child.className.includes(TOOLTIP_TITLE_CLASS_NAME)));
|
|
173
173
|
if (contentDom) {
|
|
@@ -187,6 +187,7 @@ export class DomTooltipHandler extends BaseTooltipHandler {
|
|
|
187
187
|
for (let i = 0; i < rows.length; i++) {
|
|
188
188
|
const cols = null !== (_d = rows[i].children) && void 0 !== _d ? _d : [];
|
|
189
189
|
for (let j = 0; j < cols.length; j++) {
|
|
190
|
+
refreshSize && (cols[j].style[sizeKey] = "initial");
|
|
190
191
|
const width = cols[j].getBoundingClientRect()[sizeKey];
|
|
191
192
|
(void 0 === widthByCol[j] || widthByCol[j] < width) && (widthByCol[j] = width);
|
|
192
193
|
}
|
|
@@ -207,7 +208,7 @@ export class DomTooltipHandler extends BaseTooltipHandler {
|
|
|
207
208
|
}
|
|
208
209
|
reInit() {
|
|
209
210
|
super.reInit(), this._initStyle(), this._rootDom && setStyleToDom(this._rootDom, this._domStyle.panel),
|
|
210
|
-
this.getVisibility() && (this._updateDomStringByCol(this._tooltipActual), this._updateDomStyle("height"));
|
|
211
|
+
this.getVisibility() && (this._updateDomStringByCol(this._tooltipActual), this._updateDomStyle("height", !1));
|
|
211
212
|
}
|
|
212
213
|
_updatePosition({x: x, y: y}) {
|
|
213
214
|
this._rootDom && (this._rootDom.style.transform = `translate3d(${x}px, ${y}px, 0)`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugin/components/tooltip-handler/dom-tooltip-handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EACL,+BAA+B,EAC/B,uBAAuB,EACvB,cAAc,EACd,8BAA8B,EAC9B,wBAAwB,EACzB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAc,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAIvD,MAAM,OAAO,iBAAkB,SAAQ,kBAAkB;IAqBv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file":"dom-tooltip-handler.js","sourcesContent":["import type { ITooltipActual, ITooltipPositionActual } from '../../../typings/tooltip';\nimport { BaseTooltipHandler } from './base';\nimport { getDomStyle, getTextStyle, setStyleToDom } from './utils/style';\nimport {\n TOOLTIP_CONTAINER_EL_CLASS_NAME,\n DEFAULT_TOOLTIP_Z_INDEX,\n TOOLTIP_PREFIX,\n TOOLTIP_CONTENT_BOX_CLASS_NAME,\n TOOLTIP_TITLE_CLASS_NAME\n} from './constants';\nimport { type Maybe, isValid } from '@visactor/vutils';\nimport type { IContainerSize } from '@visactor/vrender-components';\nimport { domDocument } from '../../../util/env';\nimport type { ITooltipSpec, TooltipHandlerParams } from '../../../component/tooltip';\nimport type { IComponentPluginService } from '../interface';\nimport { registerComponentPlugin } from '../register';\nimport type { ILayoutPoint } from '../../../typings';\nimport { TooltipHandlerType } from '../../../component/tooltip/constant';\nimport { getSvgHtml } from './utils/svg';\nimport { formatContent } from './utils/common';\nimport { token } from '../../../theme/token';\nimport { calcLayoutNumber } from '../../../util/space';\n/**\n * The tooltip handler class.\n */\nexport class DomTooltipHandler extends BaseTooltipHandler {\n static readonly type = TooltipHandlerType.dom;\n readonly type = TooltipHandlerType.dom;\n\n protected _tooltipContainer = domDocument?.body;\n protected _domStyle: {\n panelPadding?: number[];\n panel: Partial<CSSStyleDeclaration>;\n row: Partial<CSSStyleDeclaration>;\n title: Partial<CSSStyleDeclaration>;\n shape: Partial<CSSStyleDeclaration>;\n key: Partial<CSSStyleDeclaration>;\n value: Partial<CSSStyleDeclaration>;\n };\n protected _rootDom?: HTMLElement;\n protected _tooltipActual?: ITooltipActual;\n protected declare _container: Maybe<HTMLDivElement>;\n\n /** 自定义 tooltip 的位置缓存 */\n protected _cacheCustomTooltipPosition: ILayoutPoint;\n\n getVisibility() {\n return this._rootDom ? this._rootDom.style.visibility === 'visible' : false;\n }\n\n setVisibility(_value: boolean) {\n // 这里做个节流\n if (_value !== this.getVisibility() && this._rootDom) {\n this._rootDom.style.visibility = _value ? 'visible' : 'hidden';\n }\n }\n\n getRootDom() {\n return this._rootDom;\n }\n\n constructor() {\n super(DomTooltipHandler.type);\n }\n\n onAdd(service: IComponentPluginService<any>): void {\n super.onAdd(service);\n this._initStyle();\n this.initEl();\n }\n\n initEl() {\n const tooltipSpec = this._component.getSpec() as ITooltipSpec;\n const parentElement = tooltipSpec.parentElement as HTMLElement | HTMLCanvasElement;\n if (domDocument && parentElement && parentElement.children && parentElement.children.length) {\n for (let i = 0; i < parentElement.children.length; i++) {\n if (parentElement.children[i].classList.contains(TOOLTIP_CONTAINER_EL_CLASS_NAME)) {\n this._container = parentElement.children[i] as HTMLDivElement;\n break;\n }\n }\n if (!this._container) {\n this._container = domDocument.createElement('div');\n this._container.style.position = 'relative';\n this._container.style.zIndex = DEFAULT_TOOLTIP_Z_INDEX;\n this._container.classList.add(TOOLTIP_CONTAINER_EL_CLASS_NAME);\n parentElement.appendChild(this._container);\n }\n }\n }\n\n initRootDom() {\n const tooltipSpec = this._component.getSpec() as ITooltipSpec;\n const tooltipElement = document.createElement('div');\n const globalTheme = this._chartOption?.getTheme() ?? {};\n\n setStyleToDom(tooltipElement, {\n left: '0',\n top: '0',\n pointerEvents: 'none',\n padding: '12px',\n position: 'absolute',\n zIndex: DEFAULT_TOOLTIP_Z_INDEX,\n fontFamily: (globalTheme?.fontFamily ?? token.fontFamily) as string,\n fontSize: '11px',\n borderRadius: '3px',\n borderStyle: 'solid',\n lineHeight: 'initial',\n background: '#fff',\n boxShadow: '2px 2px 4px rgba(0, 0, 0, 0.1)',\n maxWidth: '100wh',\n maxHeight: '100vh',\n visibility: 'hidden',\n ...this._domStyle.panel\n } as CSSStyleDeclaration);\n tooltipElement.classList.add(tooltipSpec.className);\n tooltipElement.setAttribute('vchart-tooltip-id', `${this.id}`);\n this._container.appendChild(tooltipElement);\n this._rootDom = tooltipElement;\n }\n\n // 计算 tooltip 内容区域的宽高,并缓存结果\n protected _getTooltipBoxSize(actualTooltip: ITooltipActual, changePositionOnly: boolean): IContainerSize | undefined {\n if (!this._rootDom) {\n this.initRootDom();\n }\n if (!changePositionOnly) {\n this._updateDomStringByCol(actualTooltip);\n }\n\n this._updateDomStyle('height');\n\n const rect = this._rootDom?.getBoundingClientRect();\n\n return {\n width: rect?.width,\n height: rect?.height\n };\n }\n\n protected _removeTooltip() {\n if (this._rootDom && this._rootDom.parentNode) {\n this._rootDom.parentNode.removeChild(this._rootDom);\n this._rootDom = null;\n }\n this._container = null;\n }\n\n protected _updateTooltip(visible: boolean, params: TooltipHandlerParams) {\n if (!visible || !this._rootDom) {\n this.setVisibility(visible);\n this._cacheCustomTooltipPosition = undefined;\n } else {\n const { tooltipSpec, activeTooltipSpec } = params;\n\n if (!params.changePositionOnly) {\n this._tooltipActual = activeTooltipSpec;\n }\n const currentVisible = this.getVisibility();\n\n // 位置\n const el = this._rootDom;\n if (el) {\n const { x = 0, y = 0 } = activeTooltipSpec.position ?? {};\n if (tooltipSpec.updateElement) {\n // 此处先设定一次位置,防止页面暂时出现滚动条(优先设置上次的位置)\n this._updatePosition(this._cacheCustomTooltipPosition ?? { x, y });\n // 更新 tooltip dom\n tooltipSpec.updateElement(el, activeTooltipSpec, params);\n // 重新计算 tooltip 位置\n const position = this._getActualTooltipPosition(activeTooltipSpec, params, {\n width: el.offsetWidth,\n height: el.offsetHeight\n });\n // 更新位置\n this._updatePosition(position);\n // 更新缓存\n this._cacheCustomTooltipPosition = position;\n } else {\n if (!currentVisible) {\n // 当从隐藏切换到显示的时候,需要先设置一次 transition 为 0ms,防止出现从一个非常远的初始位置进行动画\n this._rootDom.style.transitionDuration = '0ms';\n } else {\n this._rootDom.style.transitionDuration = this._domStyle.panel.transitionDuration ?? 'initial';\n }\n this._updatePosition({ x, y });\n }\n }\n this.setVisibility(visible);\n }\n }\n\n protected _initStyle() {\n const tooltipSpec = this._component.getSpec() as ITooltipSpec;\n\n this._domStyle = getDomStyle(tooltipSpec);\n }\n\n protected _updateDomStringByCol(actualTooltip?: ITooltipActual) {\n const { title = {}, content } = actualTooltip;\n const hasContent = content && content.length;\n const rowStyle = this._domStyle.row;\n const chilren = [...(this._rootDom.children as any)] as HTMLElement[];\n let titleDom = chilren.find(child => child.className.includes(TOOLTIP_TITLE_CLASS_NAME));\n let contentDom = chilren.find(child => child.className.includes(TOOLTIP_CONTENT_BOX_CLASS_NAME));\n\n if (!titleDom && title.visible !== false) {\n titleDom = document.createElement('h2');\n const span = document.createElement('span');\n titleDom.appendChild(span);\n\n titleDom.classList.add(TOOLTIP_TITLE_CLASS_NAME);\n\n // 将 titleDom 插入到 this._rootDom 中作为第一个节点\n if (this._rootDom.firstChild) {\n this._rootDom.insertBefore(titleDom, this._rootDom.firstChild);\n } else {\n this._rootDom.appendChild(titleDom);\n }\n }\n\n if (titleDom && title.visible !== false) {\n setStyleToDom(titleDom, {\n ...this._domStyle.title,\n ...(hasContent ? rowStyle : { marginBottom: '0px' }),\n marginTop: '0px'\n });\n (titleDom.firstChild as HTMLElement).innerHTML = `${title.value ?? ''}`;\n } else if (titleDom && title.visible === false) {\n titleDom.parentNode.removeChild(titleDom);\n }\n\n const columns = ['shape', 'key', 'value'];\n\n if (!contentDom && hasContent) {\n contentDom = document.createElement('div');\n\n columns.forEach(col => {\n const colDiv = document.createElement('div');\n\n colDiv.classList.add(`${TOOLTIP_PREFIX}-column`);\n colDiv.classList.add(`${TOOLTIP_PREFIX}-${col}-column`);\n colDiv.setAttribute('data-col', col);\n contentDom.appendChild(colDiv);\n });\n\n contentDom.classList.add(TOOLTIP_CONTENT_BOX_CLASS_NAME);\n this._rootDom.appendChild(contentDom);\n }\n\n if (contentDom && hasContent) {\n const columnDivs = [...(contentDom.children as any)] as HTMLElement[];\n setStyleToDom(contentDom, { whiteSpace: 'nowrap' });\n\n columnDivs.forEach((colDiv, index) => {\n const colName = colDiv.getAttribute('data-col');\n\n if (colName && columns.includes(colName)) {\n const hideColumn = colName === 'shape' && content.every(c => !c.hasShape || !c.shapeType);\n\n setStyleToDom(colDiv, {\n ...(this._domStyle as any)[colName],\n display: hideColumn ? 'none' : 'inline-block',\n verticalAlign: 'top'\n });\n const rows = [...(colDiv.children as any)] as HTMLElement[];\n\n // 删除多余的行\n rows.slice(content.length).forEach(extraRow => {\n extraRow.parentNode.removeChild(extraRow);\n });\n\n content.forEach((entry, index) => {\n let row = rows[index];\n\n if (!row) {\n row = document.createElement('div');\n row.classList.add(`${TOOLTIP_PREFIX}-${colName}`);\n colDiv.appendChild(row);\n }\n const styleByRow = {\n ...rowStyle\n };\n\n if (index === content.length - 1) {\n styleByRow.marginBottom = '0px';\n }\n\n styleByRow.display = entry.visible === false ? 'none' : 'block';\n // 每次更新,需要更新单元格的高度,防止同步高度的时候没有更新\n styleByRow.height = 'initial';\n\n if (colName === 'key') {\n row.innerHTML = formatContent(entry.key);\n if (entry.keyStyle) {\n getTextStyle(entry.keyStyle, styleByRow);\n }\n } else if (colName === 'value') {\n row.innerHTML = formatContent(entry.value);\n if (entry.valueStyle) {\n getTextStyle(entry.valueStyle, styleByRow);\n }\n } else if (colName === 'shape') {\n row.innerHTML = getSvgHtml(entry, `${this.id}_${index}`);\n }\n\n setStyleToDom(row, styleByRow);\n });\n }\n });\n } else if (contentDom && !hasContent) {\n contentDom.parentNode.removeChild(contentDom);\n }\n }\n protected _updateDomStyle(sizeKey: 'width' | 'height' = 'width') {\n const rootDom = this._rootDom;\n const contentDom = [...(rootDom.children as any)].find(child =>\n child.className.includes(TOOLTIP_CONTENT_BOX_CLASS_NAME)\n );\n const titleDom = [...(rootDom.children as any)].find(child => child.className.includes(TOOLTIP_TITLE_CLASS_NAME));\n\n if (contentDom) {\n const tooltipSpec = this._component.getSpec() as ITooltipSpec;\n const contentStyle: Partial<CSSStyleDeclaration> = {};\n const titleLabel = tooltipSpec.style?.titleLabel;\n const autoFixTitleWidth = titleLabel && titleLabel.autoWidth && titleLabel.multiLine !== false;\n\n if (autoFixTitleWidth && titleDom) {\n const maxWidth = [...(contentDom.children as any)].reduce((res, col) => {\n return sizeKey === 'height'\n ? res + col.getBoundingClientRect().width\n : Math.max(res, col.getBoundingClientRect().width);\n }, 0);\n\n if (maxWidth > 0) {\n titleDom.style.maxWidth = `${maxWidth}px`;\n // 需要再计算一次,因为之前可能因为没有设置maxWidth, content的dom被撑宽了\n titleDom.style.maxWidth = `${Math.ceil(contentDom.getBoundingClientRect().width)}px`;\n }\n }\n\n if (isValid(tooltipSpec?.style?.maxContentHeight)) {\n const titleHeight =\n titleDom && titleDom.className.includes(TOOLTIP_TITLE_CLASS_NAME)\n ? titleDom.getBoundingClientRect().height + (tooltipSpec.style.spaceRow ?? 0)\n : 0;\n const viewRect = (this._chartOption as any).getChartViewRect();\n const maxHeight = calcLayoutNumber(\n tooltipSpec.style.maxContentHeight,\n Math.min(viewRect.height, document.body.clientHeight) -\n titleHeight -\n (this._domStyle.panelPadding ? this._domStyle.panelPadding[0] + this._domStyle.panelPadding[1] : 0)\n );\n\n if (maxHeight > 0) {\n contentStyle.maxHeight = `${maxHeight}px`;\n contentStyle.overflowY = 'auto';\n // todo 让内容宽度往外阔一点,给滚动条留出位置\n contentStyle.width = `calc(100% + ${\n this._domStyle.panelPadding ? this._domStyle.panelPadding[1] + 'px' : '10px'\n })`;\n\n setStyleToDom(contentDom as HTMLElement, contentStyle);\n }\n }\n\n const rows = contentDom.children;\n const widthByCol: number[] = [];\n if (rows) {\n for (let i = 0; i < rows.length; i++) {\n const row = rows[i];\n const cols = row.children ?? ([] as HTMLElement[]);\n\n for (let j = 0; j < cols.length; j++) {\n const width = cols[j].getBoundingClientRect()[sizeKey];\n if (widthByCol[j] === undefined || widthByCol[j] < width) {\n widthByCol[j] = width;\n }\n }\n }\n\n for (let i = 0; i < rows.length; i++) {\n const row = rows[i];\n const cols = row.children ?? ([] as HTMLElement[]);\n\n for (let j = 0; j < cols.length; j++) {\n (cols[j] as HTMLElement).style[sizeKey] = `${widthByCol[j]}px`;\n }\n }\n }\n }\n }\n\n protected _getParentElement(spec: ITooltipSpec): HTMLElement {\n return this._container ?? super._getParentElement(spec);\n }\n\n isTooltipShown() {\n return this.getVisibility();\n }\n\n reInit() {\n super.reInit();\n this._initStyle();\n if (this._rootDom) {\n setStyleToDom(this._rootDom, this._domStyle.panel);\n }\n\n if (this.getVisibility()) {\n this._updateDomStringByCol(this._tooltipActual);\n this._updateDomStyle('height');\n }\n }\n\n protected _updatePosition({ x, y }: ITooltipPositionActual) {\n if (this._rootDom) {\n // translate3d 性能较好:https://stackoverflow.com/questions/22111256/translate3d-vs-translate-performance\n this._rootDom.style.transform = `translate3d(${x}px, ${y}px, 0)`;\n }\n }\n}\n\nexport const registerDomTooltipHandler = () => {\n registerComponentPlugin(DomTooltipHandler);\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/plugin/components/tooltip-handler/dom-tooltip-handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EACL,+BAA+B,EAC/B,uBAAuB,EACvB,cAAc,EACd,8BAA8B,EAC9B,wBAAwB,EACzB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAc,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAIvD,MAAM,OAAO,iBAAkB,SAAQ,kBAAkB;IAqBvD,aAAa;QACX,OAAO,IAAI,CA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G,CAAC;AAiZhD,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,EAAE;IAC5C,uBAAuB,CAAC,iBAAiB,CAAC,CAAC;AAC7C,CAAC,CAAC","file":"dom-tooltip-handler.js","sourcesContent":["import type { ITooltipActual, ITooltipPositionActual } from '../../../typings/tooltip';\nimport { BaseTooltipHandler } from './base';\nimport { getDomStyle, getTextStyle, setStyleToDom } from './utils/style';\nimport {\n TOOLTIP_CONTAINER_EL_CLASS_NAME,\n DEFAULT_TOOLTIP_Z_INDEX,\n TOOLTIP_PREFIX,\n TOOLTIP_CONTENT_BOX_CLASS_NAME,\n TOOLTIP_TITLE_CLASS_NAME\n} from './constants';\nimport { type Maybe, isValid } from '@visactor/vutils';\nimport type { IContainerSize } from '@visactor/vrender-components';\nimport { domDocument } from '../../../util/env';\nimport type { ITooltipSpec, TooltipHandlerParams } from '../../../component/tooltip';\nimport type { IComponentPluginService } from '../interface';\nimport { registerComponentPlugin } from '../register';\nimport type { ILayoutPoint } from '../../../typings';\nimport { TooltipHandlerType } from '../../../component/tooltip/constant';\nimport { getSvgHtml } from './utils/svg';\nimport { formatContent } from './utils/common';\nimport { token } from '../../../theme/token';\nimport { calcLayoutNumber } from '../../../util/space';\n/**\n * The tooltip handler class.\n */\nexport class DomTooltipHandler extends BaseTooltipHandler {\n static readonly type = TooltipHandlerType.dom;\n readonly type = TooltipHandlerType.dom;\n\n protected _tooltipContainer = domDocument?.body;\n protected _domStyle: {\n panelPadding?: number[];\n panel: Partial<CSSStyleDeclaration>;\n row: Partial<CSSStyleDeclaration>;\n title: Partial<CSSStyleDeclaration>;\n shape: Partial<CSSStyleDeclaration>;\n key: Partial<CSSStyleDeclaration>;\n value: Partial<CSSStyleDeclaration>;\n };\n protected _rootDom?: HTMLElement;\n protected _tooltipActual?: ITooltipActual;\n protected declare _container: Maybe<HTMLDivElement>;\n\n /** 自定义 tooltip 的位置缓存 */\n protected _cacheCustomTooltipPosition: ILayoutPoint;\n\n getVisibility() {\n return this._rootDom ? this._rootDom.style.visibility === 'visible' : false;\n }\n\n setVisibility(_value: boolean) {\n // 这里做个节流\n if (_value !== this.getVisibility() && this._rootDom) {\n this._rootDom.style.visibility = _value ? 'visible' : 'hidden';\n }\n }\n\n getRootDom() {\n return this._rootDom;\n }\n\n constructor() {\n super(DomTooltipHandler.type);\n }\n\n onAdd(service: IComponentPluginService<any>): void {\n super.onAdd(service);\n this._initStyle();\n this.initEl();\n }\n\n initEl() {\n const tooltipSpec = this._component.getSpec() as ITooltipSpec;\n const parentElement = tooltipSpec.parentElement as HTMLElement | HTMLCanvasElement;\n if (domDocument && parentElement && parentElement.children && parentElement.children.length) {\n for (let i = 0; i < parentElement.children.length; i++) {\n if (parentElement.children[i].classList.contains(TOOLTIP_CONTAINER_EL_CLASS_NAME)) {\n this._container = parentElement.children[i] as HTMLDivElement;\n break;\n }\n }\n if (!this._container) {\n this._container = domDocument.createElement('div');\n this._container.style.position = 'relative';\n this._container.style.zIndex = DEFAULT_TOOLTIP_Z_INDEX;\n this._container.classList.add(TOOLTIP_CONTAINER_EL_CLASS_NAME);\n parentElement.appendChild(this._container);\n }\n }\n }\n\n initRootDom() {\n const tooltipSpec = this._component.getSpec() as ITooltipSpec;\n const tooltipElement = document.createElement('div');\n const globalTheme = this._chartOption?.getTheme() ?? {};\n\n setStyleToDom(tooltipElement, {\n left: '0',\n top: '0',\n pointerEvents: 'none',\n padding: '12px',\n position: 'absolute',\n zIndex: DEFAULT_TOOLTIP_Z_INDEX,\n fontFamily: (globalTheme?.fontFamily ?? token.fontFamily) as string,\n fontSize: '11px',\n borderRadius: '3px',\n borderStyle: 'solid',\n lineHeight: 'initial',\n background: '#fff',\n boxShadow: '2px 2px 4px rgba(0, 0, 0, 0.1)',\n maxWidth: '100wh',\n maxHeight: '100vh',\n visibility: 'hidden',\n ...this._domStyle.panel\n } as CSSStyleDeclaration);\n tooltipElement.classList.add(tooltipSpec.className);\n tooltipElement.setAttribute('vchart-tooltip-id', `${this.id}`);\n this._container.appendChild(tooltipElement);\n this._rootDom = tooltipElement;\n }\n\n // 计算 tooltip 内容区域的宽高,并缓存结果\n protected _getTooltipBoxSize(actualTooltip: ITooltipActual, changePositionOnly: boolean): IContainerSize | undefined {\n if (!this._rootDom) {\n this.initRootDom();\n }\n if (!changePositionOnly) {\n this._updateDomStringByCol(actualTooltip);\n }\n\n this._updateDomStyle('height', changePositionOnly);\n\n const rect = this._rootDom?.getBoundingClientRect();\n\n return {\n width: rect?.width,\n height: rect?.height\n };\n }\n\n protected _removeTooltip() {\n if (this._rootDom && this._rootDom.parentNode) {\n this._rootDom.parentNode.removeChild(this._rootDom);\n this._rootDom = null;\n }\n this._container = null;\n }\n\n protected _updateTooltip(visible: boolean, params: TooltipHandlerParams) {\n if (!visible || !this._rootDom) {\n this.setVisibility(visible);\n this._cacheCustomTooltipPosition = undefined;\n } else {\n const { tooltipSpec, activeTooltipSpec } = params;\n\n if (!params.changePositionOnly) {\n this._tooltipActual = activeTooltipSpec;\n }\n const currentVisible = this.getVisibility();\n\n // 位置\n const el = this._rootDom;\n if (el) {\n const { x = 0, y = 0 } = activeTooltipSpec.position ?? {};\n if (tooltipSpec.updateElement) {\n // 此处先设定一次位置,防止页面暂时出现滚动条(优先设置上次的位置)\n this._updatePosition(this._cacheCustomTooltipPosition ?? { x, y });\n // 更新 tooltip dom\n tooltipSpec.updateElement(el, activeTooltipSpec, params);\n // 重新计算 tooltip 位置\n const position = this._getActualTooltipPosition(activeTooltipSpec, params, {\n width: el.offsetWidth,\n height: el.offsetHeight\n });\n // 更新位置\n this._updatePosition(position);\n // 更新缓存\n this._cacheCustomTooltipPosition = position;\n } else {\n if (!currentVisible) {\n // 当从隐藏切换到显示的时候,需要先设置一次 transition 为 0ms,防止出现从一个非常远的初始位置进行动画\n this._rootDom.style.transitionDuration = '0ms';\n } else {\n this._rootDom.style.transitionDuration = this._domStyle.panel.transitionDuration ?? 'initial';\n }\n this._updatePosition({ x, y });\n }\n }\n this.setVisibility(visible);\n }\n }\n\n protected _initStyle() {\n const tooltipSpec = this._component.getSpec() as ITooltipSpec;\n\n this._domStyle = getDomStyle(tooltipSpec);\n }\n\n protected _updateDomStringByCol(actualTooltip?: ITooltipActual) {\n const { title = {}, content } = actualTooltip;\n const hasContent = content && content.length;\n const rowStyle = this._domStyle.row;\n const chilren = [...(this._rootDom.children as any)] as HTMLElement[];\n let titleDom = chilren.find(child => child.className.includes(TOOLTIP_TITLE_CLASS_NAME));\n let contentDom = chilren.find(child => child.className.includes(TOOLTIP_CONTENT_BOX_CLASS_NAME));\n\n if (!titleDom && title.visible !== false) {\n titleDom = document.createElement('h2');\n const span = document.createElement('span');\n titleDom.appendChild(span);\n\n titleDom.classList.add(TOOLTIP_TITLE_CLASS_NAME);\n\n // 将 titleDom 插入到 this._rootDom 中作为第一个节点\n if (this._rootDom.firstChild) {\n this._rootDom.insertBefore(titleDom, this._rootDom.firstChild);\n } else {\n this._rootDom.appendChild(titleDom);\n }\n }\n\n if (titleDom && title.visible !== false) {\n setStyleToDom(titleDom, {\n ...this._domStyle.title,\n ...(hasContent ? rowStyle : { marginBottom: '0px' }),\n marginTop: '0px'\n });\n (titleDom.firstChild as HTMLElement).innerHTML = `${title.value ?? ''}`;\n } else if (titleDom && title.visible === false) {\n titleDom.parentNode.removeChild(titleDom);\n }\n\n const columns = ['shape', 'key', 'value'];\n\n if (!contentDom && hasContent) {\n contentDom = document.createElement('div');\n\n columns.forEach(col => {\n const colDiv = document.createElement('div');\n\n colDiv.classList.add(`${TOOLTIP_PREFIX}-column`);\n colDiv.classList.add(`${TOOLTIP_PREFIX}-${col}-column`);\n colDiv.setAttribute('data-col', col);\n contentDom.appendChild(colDiv);\n });\n\n contentDom.classList.add(TOOLTIP_CONTENT_BOX_CLASS_NAME);\n this._rootDom.appendChild(contentDom);\n }\n\n if (contentDom && hasContent) {\n const columnDivs = [...(contentDom.children as any)] as HTMLElement[];\n setStyleToDom(contentDom, { whiteSpace: 'nowrap' });\n\n columnDivs.forEach((colDiv, index) => {\n const colName = colDiv.getAttribute('data-col');\n\n if (colName && columns.includes(colName)) {\n const hideColumn = colName === 'shape' && content.every(c => !c.hasShape || !c.shapeType);\n\n setStyleToDom(colDiv, {\n ...(this._domStyle as any)[colName],\n display: hideColumn ? 'none' : 'inline-block',\n verticalAlign: 'top'\n });\n const rows = [...(colDiv.children as any)] as HTMLElement[];\n\n // 删除多余的行\n rows.slice(content.length).forEach(extraRow => {\n extraRow.parentNode.removeChild(extraRow);\n });\n\n content.forEach((entry, index) => {\n let row = rows[index];\n\n if (!row) {\n row = document.createElement('div');\n row.classList.add(`${TOOLTIP_PREFIX}-${colName}`);\n colDiv.appendChild(row);\n }\n const styleByRow = {\n ...rowStyle\n };\n\n if (index === content.length - 1) {\n styleByRow.marginBottom = '0px';\n }\n\n styleByRow.display = entry.visible === false ? 'none' : 'block';\n // 每次更新,需要更新单元格的高度,防止同步高度的时候没有更新\n styleByRow.height = 'initial';\n\n if (colName === 'key') {\n row.innerHTML = formatContent(entry.key);\n if (entry.keyStyle) {\n getTextStyle(entry.keyStyle, styleByRow);\n }\n } else if (colName === 'value') {\n row.innerHTML = formatContent(entry.value);\n if (entry.valueStyle) {\n getTextStyle(entry.valueStyle, styleByRow);\n }\n } else if (colName === 'shape') {\n row.innerHTML = getSvgHtml(entry, `${this.id}_${index}`);\n }\n\n setStyleToDom(row, styleByRow);\n });\n }\n });\n } else if (contentDom && !hasContent) {\n contentDom.parentNode.removeChild(contentDom);\n }\n }\n protected _updateDomStyle(sizeKey: 'width' | 'height' = 'width', refreshSize: boolean) {\n const rootDom = this._rootDom;\n const contentDom = [...(rootDom.children as any)].find(child =>\n child.className.includes(TOOLTIP_CONTENT_BOX_CLASS_NAME)\n );\n const titleDom = [...(rootDom.children as any)].find(child => child.className.includes(TOOLTIP_TITLE_CLASS_NAME));\n\n if (contentDom) {\n const tooltipSpec = this._component.getSpec() as ITooltipSpec;\n const contentStyle: Partial<CSSStyleDeclaration> = {};\n const titleLabel = tooltipSpec.style?.titleLabel;\n const autoFixTitleWidth = titleLabel && titleLabel.autoWidth && titleLabel.multiLine !== false;\n\n if (autoFixTitleWidth && titleDom) {\n const maxWidth = [...(contentDom.children as any)].reduce((res, col) => {\n return sizeKey === 'height'\n ? res + col.getBoundingClientRect().width\n : Math.max(res, col.getBoundingClientRect().width);\n }, 0);\n\n if (maxWidth > 0) {\n titleDom.style.maxWidth = `${maxWidth}px`;\n // 需要再计算一次,因为之前可能因为没有设置maxWidth, content的dom被撑宽了\n titleDom.style.maxWidth = `${Math.ceil(contentDom.getBoundingClientRect().width)}px`;\n }\n }\n\n if (isValid(tooltipSpec?.style?.maxContentHeight)) {\n const titleHeight =\n titleDom && titleDom.className.includes(TOOLTIP_TITLE_CLASS_NAME)\n ? titleDom.getBoundingClientRect().height + (tooltipSpec.style.spaceRow ?? 0)\n : 0;\n const viewRect = (this._chartOption as any).getChartViewRect();\n const maxHeight = calcLayoutNumber(\n tooltipSpec.style.maxContentHeight,\n Math.min(viewRect.height, document.body.clientHeight) -\n titleHeight -\n (this._domStyle.panelPadding ? this._domStyle.panelPadding[0] + this._domStyle.panelPadding[1] : 0)\n );\n\n if (maxHeight > 0) {\n contentStyle.maxHeight = `${maxHeight}px`;\n contentStyle.overflowY = 'auto';\n // todo 让内容宽度往外阔一点,给滚动条留出位置\n contentStyle.width = `calc(100% + ${\n this._domStyle.panelPadding ? this._domStyle.panelPadding[1] + 'px' : '10px'\n })`;\n\n setStyleToDom(contentDom as HTMLElement, contentStyle);\n }\n }\n\n const rows = contentDom.children;\n const widthByCol: number[] = [];\n if (rows) {\n for (let i = 0; i < rows.length; i++) {\n const row = rows[i];\n const cols = row.children ?? ([] as HTMLElement[]);\n\n for (let j = 0; j < cols.length; j++) {\n if (refreshSize) {\n // 每次更新,需要更新单元格的高度,防止同步高度的时候没有更新\n cols[j].style[sizeKey] = 'initial';\n }\n\n const width = cols[j].getBoundingClientRect()[sizeKey];\n if (widthByCol[j] === undefined || widthByCol[j] < width) {\n widthByCol[j] = width;\n }\n }\n }\n\n for (let i = 0; i < rows.length; i++) {\n const row = rows[i];\n const cols = row.children ?? ([] as HTMLElement[]);\n\n for (let j = 0; j < cols.length; j++) {\n (cols[j] as HTMLElement).style[sizeKey] = `${widthByCol[j]}px`;\n }\n }\n }\n }\n }\n\n protected _getParentElement(spec: ITooltipSpec): HTMLElement {\n return this._container ?? super._getParentElement(spec);\n }\n\n isTooltipShown() {\n return this.getVisibility();\n }\n\n reInit() {\n super.reInit();\n this._initStyle();\n if (this._rootDom) {\n setStyleToDom(this._rootDom, this._domStyle.panel);\n }\n\n if (this.getVisibility()) {\n this._updateDomStringByCol(this._tooltipActual);\n this._updateDomStyle('height', false);\n }\n }\n\n protected _updatePosition({ x, y }: ITooltipPositionActual) {\n if (this._rootDom) {\n // translate3d 性能较好:https://stackoverflow.com/questions/22111256/translate3d-vs-translate-performance\n this._rootDom.style.transform = `translate3d(${x}px, ${y}px, 0)`;\n }\n }\n}\n\nexport const registerDomTooltipHandler = () => {\n registerComponentPlugin(DomTooltipHandler);\n};\n"]}
|
package/esm/series/dot/dot.d.ts
CHANGED
|
@@ -63,7 +63,7 @@ export declare class DotSeries<T extends IDotSeriesSpec = IDotSeriesSpec> extend
|
|
|
63
63
|
protected initTooltip(): void;
|
|
64
64
|
onEvaluateEnd(ctx: IModelEvaluateOption): void;
|
|
65
65
|
protected onMarkTreePositionUpdate(marks: IMark[]): void;
|
|
66
|
-
getDotData(): import("
|
|
66
|
+
getDotData(): import("../..").IMarkData;
|
|
67
67
|
protected _getDataIdKey(): any;
|
|
68
68
|
getStackValueField(): string;
|
|
69
69
|
getActiveMarks(): IMark[];
|
|
@@ -47,7 +47,7 @@ export declare class LinkSeries<T extends ILinkSeriesSpec = ILinkSeriesSpec> ext
|
|
|
47
47
|
initInteraction(): void;
|
|
48
48
|
protected initTooltip(): void;
|
|
49
49
|
protected onMarkTreePositionUpdate(marks: IMark[]): void;
|
|
50
|
-
getDotInfoData(): import("
|
|
50
|
+
getDotInfoData(): import("../..").IMarkData;
|
|
51
51
|
getActiveMarks(): IMark[];
|
|
52
52
|
}
|
|
53
53
|
export declare const registerLinkSeries: () => void;
|
|
@@ -48,6 +48,8 @@ export interface ISankeySeriesSpec extends Omit<ISeriesSpec, 'data'>, IAnimation
|
|
|
48
48
|
enable: boolean;
|
|
49
49
|
trigger?: 'click' | 'hover';
|
|
50
50
|
effect: 'self' | 'adjacency' | 'related';
|
|
51
|
+
highlightState?: string;
|
|
52
|
+
blurState?: string;
|
|
51
53
|
};
|
|
52
54
|
[SeriesMarkNameEnum.label]?: ISankeyLabelSpec | ISankeyLabelSpec[];
|
|
53
55
|
overflow?: 'scroll' | 'hidden' | 'scroll-x' | 'scroll-y';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/series/sankey/interface.ts"],"names":[],"mappings":"","file":"interface.js","sourcesContent":["import type { ISeriesSpec, DirectionType, IMarkTheme } from '../../typings';\nimport type { IMarkSpec } from '../../typings/spec/common';\nimport type { IRectMarkSpec, ILinkPathMarkSpec } from '../../typings/visual';\nimport type { IAnimationSpec } from '../../animation/spec';\nimport type { SeriesMarkNameEnum } from '../interface/type';\nimport type { ILabelSpec } from '../../component/label/interface';\n\nexport type SankeyMark = 'node' | 'link' | 'label';\n\nexport type SankeyAppearPreset = 'growIn' | 'fadeIn';\nexport interface ISankeyAnimationParams {\n direction: DirectionType;\n growFrom: () => number;\n}\n\nexport type ISankeyLabelSpec = ILabelSpec & {\n /**\n * 标签布局方式\n * @default 'outside'\n */\n position?: 'outside' | 'inside-start' | 'inside-middle' | 'inside-end' | 'left' | 'right';\n /** 标签文字缩略 */\n limit?: number;\n};\n\nexport interface ISankeySeriesSpec extends Omit<ISeriesSpec, 'data'>, IAnimationSpec<SankeyMark, SankeyAppearPreset> {\n type: 'sankey';\n\n /**\n * 数据字段配置\n */\n /** 节点名称字段配置 */\n categoryField: string;\n /** 节点之间关系的权重字段 */\n valueField: string;\n /** 来源节点数据字段\n * 层级数据不提供\n */\n sourceField?: string;\n /** 目标节点数据字段\n * 层级数据不提供\n */\n targetField?: string;\n\n /**\n * 图表布局方向\n */\n direction?: DirectionType;\n /**\n * 节点的对齐类型,所有深度相同的节点,采用什么对齐方式,决定了节点在第几层:\n * - 横向布局的桑基图,用于计算节点x坐标\n * - 纵向布局的桑基图,用于计算节点y坐标\n */\n nodeAlign?: 'left' | 'right' | 'center' | 'justify' | 'start' | 'end';\n /**\n * 横向布局的桑基图,设置节点Y坐标的对齐方式:\n * 'start' - '顶部对齐'\n * 'end' - '底部对齐'\n * 'middle' - '居中对齐'\n *\n * 纵向布局的桑基图,设置节点X坐标的对齐方式:\n * 'start' - '左对齐'\n * 'end' - '右对齐'\n * 'middle' - '居中对齐'\n * 'parent' - '父节点',从1.12.14版本开始支持\n *\n * @since 1.12.4\n */\n crossNodeAlign?: 'start' | 'end' | 'middle' | 'parent';\n /**\n * 是否反向\n * @since 1.12.2\n */\n inverse?: boolean;\n /**\n * 同一层中两个节点之间的间隙大小\n */\n nodeGap?: number;\n /**\n * 每个节点的宽度,支持三种取值\n * 1. 百分比字符串,例如:{ nodeWidth: '12%' }\n * 2. 以'px'为单位的简单数字,eg: { nodeWidth: 20 }\n * 3. function,通过自定义计算指定nodeWidth\n */\n nodeWidth?: string | number | ((node: SankeyNodeElement) => number);\n /**\n * link宽度,单位px\n */\n linkWidth?: number | ((link: SankeyLinkElement) => number);\n /**\n * link + node 的最小宽度\n */\n minStepWidth?: number;\n /**\n * 数据不为零或空时节点的最小大小\n * - 这个配置可以用来避免数据太小时看不到太细的节点\n * - 建议小于5px\n */\n minNodeHeight?: number;\n /**\n * 数据不为零或空时边的最小大小\n * - 这个配置可以用来避免数据太小的时候看不到太细的链接\n * - 建议小于5px\n * - 当同时指定 `minNodeHeight` 和 `minLinkHeight` 两个选项时,此选项应小于 `minNodeHeight`\n */\n minLinkHeight?: number;\n /**\n * 数据不为零或空时节点的最大大小\n * @since 1.12.14\n */\n maxNodeHeight?: number;\n /**\n * 数据不为零或空时边的最大大小\n * - 当同时指定 `maxNodeHeight` 和 `maxLinkHeight` 两个选项时,此选项应小于 `maxNodeHeight`\n * @since 1.12.14\n */\n maxLinkHeight?: number;\n /** 布局的迭代次数 */\n iterations?: number;\n /** 解析node的key,defaultValue */\n nodeKey?: string | number | ((datum: SankeyNodeDatum) => string | number);\n /** 按此funtion排序link */\n linkSortBy?: (a: SankeyLinkElement, b: SankeyLinkElement) => number;\n /** 按此funtion排序node */\n nodeSortBy?: (a: SankeyNodeElement, b: SankeyNodeElement) => number;\n /** 自定义指定节点层 */\n setNodeLayer?: (datum: SankeyNodeDatum) => number;\n /**\n * 是否丢弃孤立的节点\n * @since 1.11.0\n */\n dropIsolatedNode?: boolean;\n /**\n * set the height of node\n * @since 1.11.0\n */\n nodeHeight?: number | ((node: SankeyNodeElement) => number);\n /**\n * set the height of link\n * @since 1.11.0\n */\n linkHeight?: number | ((link: SankeyLinkElement, sourceNode: SankeyNodeElement, sourceNodeHeight: number) => number);\n /**\n * each node has same height\n * @since 1.11.0\n */\n equalNodeHeight?: boolean;\n /**\n * the layout type of link\n * @since 1.11.0\n */\n linkOverlap?: 'start' | 'center' | 'end';\n\n /** 节点配置 */\n [SeriesMarkNameEnum.node]?: IMarkSpec<IRectMarkSpec>;\n\n /** 边配置 */\n [SeriesMarkNameEnum.link]?: IMarkSpec<ILinkPathMarkSpec>;\n\n /** 联动交互配置 */\n emphasis?: {\n /** 是否开启交互 */\n enable: boolean;\n /**\n * 交互触发类型\n * 默认为‘click'\n */\n trigger?: 'click' | 'hover';\n /**桑基图提供3种在节点上的交互联动效果\n * self: 仅高亮当前节点。\n * adjacency: 高亮当前节点上下游节点和关联的边,淡化其它图形元素。\n * related: 高亮与当前节点相关的整条路径上的节点和边,淡化其它图形元素。 */\n effect: 'self' | 'adjacency' | 'related';\n };\n\n /** 标签配置 */\n [SeriesMarkNameEnum.label]?: ISankeyLabelSpec | ISankeyLabelSpec[];\n\n /**\n * 当制定了节点、边的宽度的时候,可以配置这个属性\n * 当宽度大于图表region的宽度、高度大于图表resion高度的时候是否自动产生滚动条\n * @since 1.13.0\n */\n overflow?: 'scroll' | 'hidden' | 'scroll-x' | 'scroll-y';\n\n /** 进度条配置 */\n // scroll?: IScrollSpec & {\n // /** 是否开启进度条 */\n // enable: boolean;\n // };\n}\n\nexport interface SankeyLinkDatum {\n source: string | number;\n target: string | number;\n value?: number;\n}\n\nexport interface SankeyNodeDatum {\n value?: number;\n}\n\nexport interface HierarchyNodeDatum {\n value?: number;\n children?: HierarchyNodeDatum[];\n}\n\nexport type SankeyData =\n | {\n nodes?: SankeyNodeDatum[];\n links: SankeyLinkDatum[];\n }\n | {\n nodes: HierarchyNodeDatum[];\n };\n\n/**\n * The node element after sankey layout\n */\nexport interface SankeyNodeElement {\n key: string | number;\n index: number;\n /** the depth of node, from source to target */\n depth: number;\n\n /** the depth of node, from target to source */\n endDepth?: number;\n /** the final layer index after layout */\n layer?: number;\n isLastLayer?: boolean;\n value: number;\n datum: SankeyNodeDatum;\n sourceLinks: SankeyLinkElement[];\n targetLinks: SankeyLinkElement[];\n x0?: number;\n y0?: number;\n x1?: number;\n y1?: number;\n}\n/**\n * the link element after sankey layout\n */\nexport interface SankeyLinkElement {\n vertical?: boolean;\n index: number;\n source: string | number;\n target: string | number;\n value: number;\n datum: SankeyLinkDatum | SankeyLinkDatum[];\n thickness?: number;\n sourceRect?: { x0: number; x1: number; y0: number; y1: number };\n targetRect?: { x0: number; x1: number; y0: number; y1: number };\n /** this will only be generate in hierarchy node data*/\n parents?: (string | number)[];\n y0?: number;\n y1?: number;\n x0?: number;\n x1?: number;\n}\n\nexport type SankeyLayoutResult = {\n nodes: SankeyNodeElement[];\n links: SankeyLinkElement[];\n columns: SankeyNodeElement[][];\n}[];\n\nexport interface ISankeySeriesTheme {\n [SeriesMarkNameEnum.node]?: IMarkTheme<IRectMarkSpec>;\n [SeriesMarkNameEnum.link]?: IMarkTheme<ILinkPathMarkSpec>;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/series/sankey/interface.ts"],"names":[],"mappings":"","file":"interface.js","sourcesContent":["import type { ISeriesSpec, DirectionType, IMarkTheme } from '../../typings';\nimport type { IMarkSpec } from '../../typings/spec/common';\nimport type { IRectMarkSpec, ILinkPathMarkSpec } from '../../typings/visual';\nimport type { IAnimationSpec } from '../../animation/spec';\nimport type { SeriesMarkNameEnum } from '../interface/type';\nimport type { ILabelSpec } from '../../component/label/interface';\n\nexport type SankeyMark = 'node' | 'link' | 'label';\n\nexport type SankeyAppearPreset = 'growIn' | 'fadeIn';\nexport interface ISankeyAnimationParams {\n direction: DirectionType;\n growFrom: () => number;\n}\n\nexport type ISankeyLabelSpec = ILabelSpec & {\n /**\n * 标签布局方式\n * @default 'outside'\n */\n position?: 'outside' | 'inside-start' | 'inside-middle' | 'inside-end' | 'left' | 'right';\n /** 标签文字缩略 */\n limit?: number;\n};\n\nexport interface ISankeySeriesSpec extends Omit<ISeriesSpec, 'data'>, IAnimationSpec<SankeyMark, SankeyAppearPreset> {\n type: 'sankey';\n\n /**\n * 数据字段配置\n */\n /** 节点名称字段配置 */\n categoryField: string;\n /** 节点之间关系的权重字段 */\n valueField: string;\n /** 来源节点数据字段\n * 层级数据不提供\n */\n sourceField?: string;\n /** 目标节点数据字段\n * 层级数据不提供\n */\n targetField?: string;\n\n /**\n * 图表布局方向\n */\n direction?: DirectionType;\n /**\n * 节点的对齐类型,所有深度相同的节点,采用什么对齐方式,决定了节点在第几层:\n * - 横向布局的桑基图,用于计算节点x坐标\n * - 纵向布局的桑基图,用于计算节点y坐标\n */\n nodeAlign?: 'left' | 'right' | 'center' | 'justify' | 'start' | 'end';\n /**\n * 横向布局的桑基图,设置节点Y坐标的对齐方式:\n * 'start' - '顶部对齐'\n * 'end' - '底部对齐'\n * 'middle' - '居中对齐'\n *\n * 纵向布局的桑基图,设置节点X坐标的对齐方式:\n * 'start' - '左对齐'\n * 'end' - '右对齐'\n * 'middle' - '居中对齐'\n * 'parent' - '父节点',从1.12.14版本开始支持\n *\n * @since 1.12.4\n */\n crossNodeAlign?: 'start' | 'end' | 'middle' | 'parent';\n /**\n * 是否反向\n * @since 1.12.2\n */\n inverse?: boolean;\n /**\n * 同一层中两个节点之间的间隙大小\n */\n nodeGap?: number;\n /**\n * 每个节点的宽度,支持三种取值\n * 1. 百分比字符串,例如:{ nodeWidth: '12%' }\n * 2. 以'px'为单位的简单数字,eg: { nodeWidth: 20 }\n * 3. function,通过自定义计算指定nodeWidth\n */\n nodeWidth?: string | number | ((node: SankeyNodeElement) => number);\n /**\n * link宽度,单位px\n */\n linkWidth?: number | ((link: SankeyLinkElement) => number);\n /**\n * link + node 的最小宽度\n */\n minStepWidth?: number;\n /**\n * 数据不为零或空时节点的最小大小\n * - 这个配置可以用来避免数据太小时看不到太细的节点\n * - 建议小于5px\n */\n minNodeHeight?: number;\n /**\n * 数据不为零或空时边的最小大小\n * - 这个配置可以用来避免数据太小的时候看不到太细的链接\n * - 建议小于5px\n * - 当同时指定 `minNodeHeight` 和 `minLinkHeight` 两个选项时,此选项应小于 `minNodeHeight`\n */\n minLinkHeight?: number;\n /**\n * 数据不为零或空时节点的最大大小\n * @since 1.12.14\n */\n maxNodeHeight?: number;\n /**\n * 数据不为零或空时边的最大大小\n * - 当同时指定 `maxNodeHeight` 和 `maxLinkHeight` 两个选项时,此选项应小于 `maxNodeHeight`\n * @since 1.12.14\n */\n maxLinkHeight?: number;\n /** 布局的迭代次数 */\n iterations?: number;\n /** 解析node的key,defaultValue */\n nodeKey?: string | number | ((datum: SankeyNodeDatum) => string | number);\n /** 按此funtion排序link */\n linkSortBy?: (a: SankeyLinkElement, b: SankeyLinkElement) => number;\n /** 按此funtion排序node */\n nodeSortBy?: (a: SankeyNodeElement, b: SankeyNodeElement) => number;\n /** 自定义指定节点层 */\n setNodeLayer?: (datum: SankeyNodeDatum) => number;\n /**\n * 是否丢弃孤立的节点\n * @since 1.11.0\n */\n dropIsolatedNode?: boolean;\n /**\n * set the height of node\n * @since 1.11.0\n */\n nodeHeight?: number | ((node: SankeyNodeElement) => number);\n /**\n * set the height of link\n * @since 1.11.0\n */\n linkHeight?: number | ((link: SankeyLinkElement, sourceNode: SankeyNodeElement, sourceNodeHeight: number) => number);\n /**\n * each node has same height\n * @since 1.11.0\n */\n equalNodeHeight?: boolean;\n /**\n * the layout type of link\n * @since 1.11.0\n */\n linkOverlap?: 'start' | 'center' | 'end';\n\n /** 节点配置 */\n [SeriesMarkNameEnum.node]?: IMarkSpec<IRectMarkSpec>;\n\n /** 边配置 */\n [SeriesMarkNameEnum.link]?: IMarkSpec<ILinkPathMarkSpec>;\n\n /** 联动交互配置 */\n emphasis?: {\n /** 是否开启交互 */\n enable: boolean;\n /**\n * 交互触发类型\n * 默认为‘click'\n */\n trigger?: 'click' | 'hover';\n /**桑基图提供3种在节点上的交互联动效果\n * self: 仅高亮当前节点。\n * adjacency: 高亮当前节点上下游节点和关联的边,淡化其它图形元素。\n * related: 高亮与当前节点相关的整条路径上的节点和边,淡化其它图形元素。 */\n effect: 'self' | 'adjacency' | 'related';\n /**\n * 高亮状态\n * @default 'selected'\n * @since 1.13.13\n */\n highlightState?: string;\n /**\n * 失焦状态\n * @default 'blur'\n * @since 1.13.13\n */\n blurState?: string;\n };\n\n /** 标签配置 */\n [SeriesMarkNameEnum.label]?: ISankeyLabelSpec | ISankeyLabelSpec[];\n\n /**\n * 当制定了节点、边的宽度的时候,可以配置这个属性\n * 当宽度大于图表region的宽度、高度大于图表resion高度的时候是否自动产生滚动条\n * @since 1.13.0\n */\n overflow?: 'scroll' | 'hidden' | 'scroll-x' | 'scroll-y';\n\n /** 进度条配置 */\n // scroll?: IScrollSpec & {\n // /** 是否开启进度条 */\n // enable: boolean;\n // };\n}\n\nexport interface SankeyLinkDatum {\n source: string | number;\n target: string | number;\n value?: number;\n}\n\nexport interface SankeyNodeDatum {\n value?: number;\n}\n\nexport interface HierarchyNodeDatum {\n value?: number;\n children?: HierarchyNodeDatum[];\n}\n\nexport type SankeyData =\n | {\n nodes?: SankeyNodeDatum[];\n links: SankeyLinkDatum[];\n }\n | {\n nodes: HierarchyNodeDatum[];\n };\n\n/**\n * The node element after sankey layout\n */\nexport interface SankeyNodeElement {\n key: string | number;\n index: number;\n /** the depth of node, from source to target */\n depth: number;\n\n /** the depth of node, from target to source */\n endDepth?: number;\n /** the final layer index after layout */\n layer?: number;\n isLastLayer?: boolean;\n value: number;\n datum: SankeyNodeDatum;\n sourceLinks: SankeyLinkElement[];\n targetLinks: SankeyLinkElement[];\n x0?: number;\n y0?: number;\n x1?: number;\n y1?: number;\n}\n/**\n * the link element after sankey layout\n */\nexport interface SankeyLinkElement {\n vertical?: boolean;\n index: number;\n source: string | number;\n target: string | number;\n value: number;\n datum: SankeyLinkDatum | SankeyLinkDatum[];\n thickness?: number;\n sourceRect?: { x0: number; x1: number; y0: number; y1: number };\n targetRect?: { x0: number; x1: number; y0: number; y1: number };\n /** this will only be generate in hierarchy node data*/\n parents?: (string | number)[];\n y0?: number;\n y1?: number;\n x0?: number;\n x1?: number;\n}\n\nexport type SankeyLayoutResult = {\n nodes: SankeyNodeElement[];\n links: SankeyLinkElement[];\n columns: SankeyNodeElement[][];\n}[];\n\nexport interface ISankeySeriesTheme {\n [SeriesMarkNameEnum.node]?: IMarkTheme<IRectMarkSpec>;\n [SeriesMarkNameEnum.link]?: IMarkTheme<ILinkPathMarkSpec>;\n}\n"]}
|
|
@@ -50,15 +50,16 @@ export declare class SankeySeries<T extends ISankeySeriesSpec = ISankeySeriesSpe
|
|
|
50
50
|
private _createText;
|
|
51
51
|
initAnimation(): void;
|
|
52
52
|
protected initEvent(): void;
|
|
53
|
+
protected _initEmphasisEvent(): void;
|
|
53
54
|
private nodesSeriesDataUpdate;
|
|
54
55
|
private linksSeriesDataUpdate;
|
|
55
56
|
protected _handleEmphasisElement: (params: ExtendEventParam) => void;
|
|
56
|
-
protected _handleClearEmpty: () => void;
|
|
57
|
-
protected _handleNodeAdjacencyClick: (element: IElement) => void;
|
|
58
|
-
protected _handleLinkAdjacencyClick: (element: IGlyphElement) => void;
|
|
59
|
-
protected _handleNodeRelatedClick: (element: IElement) => void;
|
|
60
|
-
protected _handleLinkRelatedClick: (element: IGlyphElement) => void;
|
|
61
|
-
protected _highLightElements(vGrammarElements: IVgrammarMark['elements'], highlightNodes: string[]): void;
|
|
57
|
+
protected _handleClearEmpty: (highlightState: string, blurState: string) => void;
|
|
58
|
+
protected _handleNodeAdjacencyClick: (element: IElement, highlightState: string, blurState: string) => void;
|
|
59
|
+
protected _handleLinkAdjacencyClick: (element: IGlyphElement, highlightState: string, blurState: string) => void;
|
|
60
|
+
protected _handleNodeRelatedClick: (element: IElement, highlightState: string, blurState: string) => void;
|
|
61
|
+
protected _handleLinkRelatedClick: (element: IGlyphElement, highlightState: string, blurState: string) => void;
|
|
62
|
+
protected _highLightElements(vGrammarElements: IVgrammarMark['elements'], highlightNodes: string[], highlightState: string, blurState: string): void;
|
|
62
63
|
protected initTooltip(): void;
|
|
63
64
|
_setNodeOrdinalColorScale(): void;
|
|
64
65
|
getNodeList(): any;
|