@visactor/vchart 1.11.8 → 1.11.9
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.js +82 -47
- package/build/index.min.js +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/chart/base/base-chart.js +1 -0
- package/cjs/chart/base/base-chart.js.map +1 -1
- package/cjs/chart/stack.js +2 -1
- package/cjs/chart/util.js +2 -1
- package/cjs/chart/util.js.map +1 -1
- package/cjs/compile/grammar-item.js +1 -2
- package/cjs/component/label/label.js.map +1 -1
- package/cjs/component/tooltip/interface/spec.d.ts +1 -1
- package/cjs/component/tooltip/interface/spec.js.map +1 -1
- package/cjs/component/tooltip/interface/theme.d.ts +1 -0
- package/cjs/component/tooltip/interface/theme.js.map +1 -1
- package/cjs/component/tooltip/tooltip-transformer.js +3 -0
- package/cjs/component/tooltip/tooltip-transformer.js.map +1 -1
- package/cjs/core/index.d.ts +1 -1
- package/cjs/core/index.js +1 -1
- package/cjs/core/index.js.map +1 -1
- package/cjs/core/vchart.d.ts +1 -0
- package/cjs/core/vchart.js +34 -28
- package/cjs/core/vchart.js.map +1 -1
- package/cjs/model/interface.d.ts +1 -0
- package/cjs/model/interface.js.map +1 -1
- package/cjs/series/base/base-series.js +13 -12
- package/cjs/series/base/base-series.js.map +1 -1
- package/cjs/series/polar/animation.js +6 -6
- package/cjs/series/polar/animation.js.map +1 -1
- package/cjs/series/waterfall/waterfall-transformer.js +1 -1
- package/cjs/series/waterfall/waterfall-transformer.js.map +1 -1
- package/cjs/series/waterfall/waterfall.d.ts +1 -0
- package/cjs/series/waterfall/waterfall.js +13 -13
- package/cjs/series/waterfall/waterfall.js.map +1 -1
- package/esm/chart/base/base-chart.js +1 -0
- package/esm/chart/base/base-chart.js.map +1 -1
- package/esm/chart/stack.js +2 -1
- package/esm/chart/util.js +2 -1
- package/esm/chart/util.js.map +1 -1
- package/esm/compile/grammar-item.js +1 -2
- package/esm/component/label/label.js.map +1 -1
- package/esm/component/tooltip/interface/spec.d.ts +1 -1
- package/esm/component/tooltip/interface/spec.js.map +1 -1
- package/esm/component/tooltip/interface/theme.d.ts +1 -0
- package/esm/component/tooltip/interface/theme.js.map +1 -1
- package/esm/component/tooltip/tooltip-transformer.js +4 -1
- package/esm/component/tooltip/tooltip-transformer.js.map +1 -1
- package/esm/core/index.d.ts +1 -1
- package/esm/core/index.js +1 -1
- package/esm/core/index.js.map +1 -1
- package/esm/core/vchart.d.ts +1 -0
- package/esm/core/vchart.js +34 -28
- package/esm/core/vchart.js.map +1 -1
- package/esm/model/interface.d.ts +1 -0
- package/esm/model/interface.js.map +1 -1
- package/esm/series/base/base-series.js +12 -11
- package/esm/series/base/base-series.js.map +1 -1
- package/esm/series/polar/animation.js +5 -6
- package/esm/series/polar/animation.js.map +1 -1
- package/esm/series/waterfall/waterfall-transformer.js +1 -1
- package/esm/series/waterfall/waterfall-transformer.js.map +1 -1
- package/esm/series/waterfall/waterfall.d.ts +1 -0
- package/esm/series/waterfall/waterfall.js +12 -12
- package/esm/series/waterfall/waterfall.js.map +1 -1
- package/package.json +16 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/component/tooltip/interface/theme.ts"],"names":[],"mappings":"","file":"theme.js","sourcesContent":["import type { RichTextWordBreak } from '@visactor/vrender-core';\nimport type { ITooltipShapePattern, StringOrNumber, TextAlign, TextBaseLine } from '../../../typings';\nimport type { Padding } from '@visactor/vrender-components';\nimport type { ITokenKey } from '../../../theme/token';\n\nexport interface ITooltipTextTheme<ColorType = string> {\n /** 字体 */\n fontFamily?: string;\n /** 字体大小 */\n fontSize?: number | ITokenKey;\n /** 字体颜色 */\n fill?: ColorType;\n /** @deprecated 字体颜色(兼容旧版本) */\n fontColor?: ColorType;\n /** 字重 */\n fontWeight?: StringOrNumber;\n /** 对齐方式 */\n textAlign?: TextAlign;\n /** 字体基线 */\n textBaseline?: TextBaseLine;\n /** 行高 */\n lineHeight?: number | string | ITokenKey;\n /** 与相邻元素的水平间距 */\n spacing?: number;\n /** 是否支持换行 */\n multiLine?: boolean;\n /** 最大宽度 */\n maxWidth?: number;\n /** 换行模式,默认为'break-word' */\n wordBreak?: RichTextWordBreak;\n /**\n * 是否开启自动宽度。效果分为以下几种情况:\n * - tooltip 标题:`autoWidth` 默认为 `false`。如果配置为 `true`,则 tooltip 标题会保持和 tooltip 内容一致的宽度\n * - tooltip key 标签:`autoWidth` 不适用\n * - tooltip value 标签:`autoWidth` 默认为 `true`。如果配置为 `true`,则 tooltip value 标签会自动占满 tooltip 整体宽度的剩余部分\n * @since 1.4.2\n */\n autoWidth?: boolean;\n}\n\nexport interface ITooltipTheme<ColorType = string> {\n /** 容器样式配置 */\n panel?: {\n /** tooltip 容器内边距 */\n padding?: Padding;\n /** 背景色 */\n backgroundColor?: ColorType;\n /** tooltip边框 */\n border?: {\n color?: ColorType;\n width?: number;\n /** 圆角 */\n radius?: number;\n };\n /** tooltip阴影 */\n shadow?: {\n x: number;\n y: number;\n blur: number;\n spread: number;\n color: ColorType;\n };\n };\n shape?: {\n /** 标记大小 */\n size?: number;\n /** shape 与相邻元素的水平间距 */\n spacing?: number;\n } & Omit<ITooltipShapePattern, 'seriesId'>;\n /** tooltip标题 */\n titleLabel?: ITooltipTextTheme<ColorType>;\n /** tooltip内容,key字段 */\n keyLabel?: Omit<ITooltipTextTheme<ColorType>, 'autoWidth'>;\n /** tooltip内容,value字段 */\n valueLabel?: ITooltipTextTheme<ColorType>;\n /** 内容项行间距 */\n spaceRow?: number;\n /**\n * 最大内容区高度,内容区若超过该高度将显示局部滚动条(适用于 dom tooltip)\n * @since 1.9.0\n */\n maxContentHeight?: number;\n /** 偏移量 */\n offset?: {\n x?: number;\n y?: number;\n };\n /**\n * @since 1.11.5\n *\n * shape、key、value的对齐方式,可选项如下:\n * 'left': 从左到右对齐\n * 'right': 从右到左对齐\n */\n align?: 'left' | 'right';\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/component/tooltip/interface/theme.ts"],"names":[],"mappings":"","file":"theme.js","sourcesContent":["import type { RichTextWordBreak } from '@visactor/vrender-core';\nimport type { ITooltipShapePattern, StringOrNumber, TextAlign, TextBaseLine } from '../../../typings';\nimport type { Padding } from '@visactor/vrender-components';\nimport type { ITokenKey } from '../../../theme/token';\n\nexport interface ITooltipTextTheme<ColorType = string> {\n /** 字体 */\n fontFamily?: string;\n /** 字体大小 */\n fontSize?: number | ITokenKey;\n /** 字体颜色 */\n fill?: ColorType;\n /** @deprecated 字体颜色(兼容旧版本) */\n fontColor?: ColorType;\n /** 字重 */\n fontWeight?: StringOrNumber;\n /** 对齐方式 */\n textAlign?: TextAlign;\n /** 字体基线 */\n textBaseline?: TextBaseLine;\n /** 行高 */\n lineHeight?: number | string | ITokenKey;\n /** 与相邻元素的水平间距 */\n spacing?: number;\n /** 是否支持换行 */\n multiLine?: boolean;\n /** 最大宽度 */\n maxWidth?: number;\n /** 换行模式,默认为'break-word' */\n wordBreak?: RichTextWordBreak;\n /**\n * 是否开启自动宽度。效果分为以下几种情况:\n * - tooltip 标题:`autoWidth` 默认为 `false`。如果配置为 `true`,则 tooltip 标题会保持和 tooltip 内容一致的宽度\n * - tooltip key 标签:`autoWidth` 不适用\n * - tooltip value 标签:`autoWidth` 默认为 `true`。如果配置为 `true`,则 tooltip value 标签会自动占满 tooltip 整体宽度的剩余部分\n * @since 1.4.2\n */\n autoWidth?: boolean;\n}\n\nexport interface ITooltipTheme<ColorType = string> {\n /** 容器样式配置 */\n panel?: {\n /** tooltip 容器内边距 */\n padding?: Padding;\n /** 背景色 */\n backgroundColor?: ColorType;\n /** tooltip边框 */\n border?: {\n color?: ColorType;\n width?: number;\n /** 圆角 */\n radius?: number;\n };\n /** tooltip阴影 */\n shadow?: {\n x: number;\n y: number;\n blur: number;\n spread: number;\n color: ColorType;\n };\n };\n shape?: {\n /** 标记大小 */\n size?: number;\n /** shape 与相邻元素的水平间距 */\n spacing?: number;\n } & Omit<ITooltipShapePattern, 'seriesId'>;\n /** tooltip标题 */\n titleLabel?: ITooltipTextTheme<ColorType>;\n /** tooltip内容,key字段 */\n keyLabel?: Omit<ITooltipTextTheme<ColorType>, 'autoWidth'>;\n /** tooltip内容,value字段 */\n valueLabel?: ITooltipTextTheme<ColorType>;\n /** 内容项行间距 */\n spaceRow?: number;\n /**\n * 最大内容区高度,内容区若超过该高度将显示局部滚动条(适用于 dom tooltip)\n * @since 1.9.0\n */\n maxContentHeight?: number;\n /** 偏移量 */\n offset?: {\n x?: number;\n y?: number;\n };\n /**\n * 浮层移动动画过渡时间,单位是 ms,设置为 0 的时候会紧跟着鼠标移动(目前仅影响 dom tooltip)\n * @since 1.11.9\n */\n transitionDuration?: number;\n /**\n * @since 1.11.5\n *\n * shape、key、value的对齐方式,可选项如下:\n * 'left': 从左到右对齐\n * 'right': 从右到左对齐\n */\n align?: 'left' | 'right';\n}\n"]}
|
|
@@ -11,8 +11,11 @@ class TooltipSpecTransformer extends base_1.BaseComponentSpecTransformer {
|
|
|
11
11
|
return !1;
|
|
12
12
|
}
|
|
13
13
|
_initTheme(spec, chartSpec) {
|
|
14
|
+
var _a;
|
|
14
15
|
const {spec: newSpec, theme: theme} = super._initTheme(spec, chartSpec);
|
|
15
16
|
return newSpec.style = (0, vutils_extension_1.mergeSpec)({}, this._theme, newSpec.style),
|
|
17
|
+
newSpec.offset = (0, vutils_extension_1.mergeSpec)({}, theme.offset, spec.offset),
|
|
18
|
+
newSpec.transitionDuration = null !== (_a = spec.transitionDuration) && void 0 !== _a ? _a : theme.transitionDuration,
|
|
16
19
|
{
|
|
17
20
|
spec: newSpec,
|
|
18
21
|
theme: theme
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/component/tooltip/tooltip-transformer.ts"],"names":[],"mappings":";;;AACA,qCAA8F;AAC9F,kCAAuD;AACvD,yCAAmD;AACnD,mCAAqD;AACrD,iEAAuD;AAEvD,MAAa,sBAAuB,SA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YAC3C,IAAI,CAAC,aAAa,GAAG,kBAAW,aAAX,kBAAW,uBAAX,kBAAW,CAAE,IAAI,CAAC;SACxC;IACH,CAAC;CACF;AA5CD,wDA4CC","file":"tooltip-transformer.js","sourcesContent":["import type { IChartSpecInfo } from '../../chart/interface';\nimport { domDocument, isMiniAppLikeMode, isString, isTrueBrowser, isValid } from '../../util';\nimport { BaseComponentSpecTransformer } from '../base';\nimport { TOOLTIP_EL_CLASS_NAME } from './constant';\nimport { getTooltipActualActiveType } from './utils';\nimport { mergeSpec } from '@visactor/vutils-extension';\n\nexport class TooltipSpecTransformer extends BaseComponentSpecTransformer<any> {\n protected _shouldMergeThemeToSpec() {\n return false;\n }\n\n protected _initTheme(spec: any, chartSpec: any): { spec: any; theme: any } {\n const { spec: newSpec, theme } = super._initTheme(spec, chartSpec);\n newSpec.style = mergeSpec({}, this._theme, newSpec.style);\n newSpec.offset = mergeSpec({}, theme.offset, spec.offset);\n newSpec.transitionDuration = spec.transitionDuration ?? theme.transitionDuration;\n return { spec: newSpec, theme };\n }\n\n protected _transformSpecAfterMergingTheme(spec: any, chartSpec: any, chartSpecInfo?: IChartSpecInfo) {\n super._transformSpecAfterMergingTheme(spec, chartSpec, chartSpecInfo);\n\n spec.visible = spec.visible ?? true;\n spec.activeType = getTooltipActualActiveType(spec);\n spec.renderMode =\n spec.renderMode ??\n // 小程序或非浏览器环境下,默认使用canvas渲染\n (isMiniAppLikeMode(this._option.mode) || !isTrueBrowser(this._option.mode) ? 'canvas' : 'html');\n spec.trigger = spec.trigger ?? 'hover';\n spec.className = spec.className ?? TOOLTIP_EL_CLASS_NAME;\n spec.enterable = spec.enterable ?? false;\n spec.transitionDuration = spec.transitionDuration ?? 150;\n spec.triggerOff = spec.triggerOff ?? spec.trigger;\n spec.confine = spec.confine ?? spec.renderMode === 'canvas';\n\n if (isValid(spec.mark)) {\n spec.mark.activeType = 'mark';\n }\n if (isValid(spec.dimension)) {\n spec.dimension.activeType = 'dimension';\n }\n\n if (isValid(spec.parentElement)) {\n if (isString(spec.parentElement)) {\n spec.parentElement = globalThis?.document?.getElementById(spec.parentElement);\n }\n } else if (isTrueBrowser(this._option.mode)) {\n spec.parentElement = domDocument?.body;\n }\n }\n}\n"]}
|
package/cjs/core/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VChart } from './vchart';
|
|
2
2
|
import { Factory } from './factory';
|
|
3
3
|
export { VChart, Factory };
|
|
4
|
-
export declare const version = "1.11.
|
|
4
|
+
export declare const version = "1.11.9";
|
|
5
5
|
export type { IVChart } from './interface';
|
|
6
6
|
export type { IStateSpec, StateValueType } from '../compile/mark';
|
|
7
7
|
export * from '../typings/spec/common';
|
package/cjs/core/index.js
CHANGED
|
@@ -35,7 +35,7 @@ Object.defineProperty(exports, "Factory", {
|
|
|
35
35
|
get: function() {
|
|
36
36
|
return factory_1.Factory;
|
|
37
37
|
}
|
|
38
|
-
}), exports.version = "1.11.
|
|
38
|
+
}), exports.version = "1.11.9", __exportStar(require("../typings/spec/common"), exports),
|
|
39
39
|
__exportStar(require("../event/interface"), exports), __exportStar(require("../theme/interface"), exports),
|
|
40
40
|
__exportStar(require("../constant"), exports), __exportStar(require("./interface"), exports),
|
|
41
41
|
__exportStar(require("../typings/spec/index"), exports), __exportStar(require("../typings/tooltip"), exports),
|
package/cjs/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAIA,qCAAkC;AAGzB,uFAHA,eAAM,OAGA;AAFf,uCAAoC;AAEnB,wFAFR,iBAAO,OAEQ;AAGX,QAAA,OAAO,GAAG,QAAQ,CAAC;AAMhC,yDAAuC;AACvC,qDAAmC;AACnC,qDAAmC;AACnC,8CAA4B;AAC5B,8CAA4B;AAK5B,wDAAsC;AAGtC,qDAAmC;AAGnC,iDAA+B;AAG/B,uDAAiD;AAAxC,uGAAA,OAAO,OAAA;AAGhB,4CAA0B","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.11.
|
|
1
|
+
{"version":3,"sources":["../src/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAIA,qCAAkC;AAGzB,uFAHA,eAAM,OAGA;AAFf,uCAAoC;AAEnB,wFAFR,iBAAO,OAEQ;AAGX,QAAA,OAAO,GAAG,QAAQ,CAAC;AAMhC,yDAAuC;AACvC,qDAAmC;AACnC,qDAAmC;AACnC,8CAA4B;AAC5B,8CAA4B;AAK5B,wDAAsC;AAGtC,qDAAmC;AAGnC,iDAA+B;AAG/B,uDAAiD;AAAxC,uGAAA,OAAO,OAAA;AAGhB,4CAA0B","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.11.9\";\n\n// export necessary types\nexport type { IVChart } from './interface';\nexport type { IStateSpec, StateValueType } from '../compile/mark';\n\nexport * from '../typings/spec/common';\nexport * from '../event/interface';\nexport * from '../theme/interface';\nexport * from '../constant';\nexport * from './interface';\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 { vglobal } from '@visactor/vrender-core';\n\n// plugin\nexport * from '../plugin';\n"]}
|
package/cjs/core/vchart.d.ts
CHANGED
|
@@ -147,6 +147,7 @@ export declare class VChart implements IVChart {
|
|
|
147
147
|
setCurrentTheme(name: string): Promise<IVChart>;
|
|
148
148
|
setCurrentThemeSync(name: string): IVChart;
|
|
149
149
|
protected _setCurrentTheme(name?: string): IUpdateSpecResult;
|
|
150
|
+
private _setFontFamilyTheme;
|
|
150
151
|
private _getTooltipComponent;
|
|
151
152
|
setTooltipHandler(tooltipHandler: ITooltipHandler): void;
|
|
152
153
|
getTooltipHandlerByUser(): ITooltipHandler | undefined;
|
package/cjs/core/vchart.js
CHANGED
|
@@ -109,7 +109,7 @@ class VChart {
|
|
|
109
109
|
return this._dataSet;
|
|
110
110
|
}
|
|
111
111
|
constructor(spec, options) {
|
|
112
|
-
var _a, _b, _c, _d, _e, _f
|
|
112
|
+
var _a, _b, _c, _d, _e, _f;
|
|
113
113
|
this.id = (0, id_1.createID)(), this._userEvents = [], this._autoSize = !0, this._option = {
|
|
114
114
|
mode: common_1.RenderModeEnum["desktop-browser"],
|
|
115
115
|
onError: msg => {
|
|
@@ -123,7 +123,7 @@ class VChart {
|
|
|
123
123
|
}), 100), this._option = (0, vutils_1.merge)(this._option, {
|
|
124
124
|
animation: !1 !== spec.animation
|
|
125
125
|
}, options), this._onError = null === (_a = this._option) || void 0 === _a ? void 0 : _a.onError;
|
|
126
|
-
const
|
|
126
|
+
const _g = this._option, {dom: dom, renderCanvas: renderCanvas, mode: mode, stage: stage, poptip: poptip} = _g, restOptions = __rest(_g, [ "dom", "renderCanvas", "mode", "stage", "poptip" ]), isTrueBrowseEnv = (0,
|
|
127
127
|
env_1.isTrueBrowser)(mode);
|
|
128
128
|
isTrueBrowseEnv && dom && (this._container = (0, util_1.isString)(dom) ? null === document || void 0 === document ? void 0 : document.getElementById(dom) : dom),
|
|
129
129
|
renderCanvas && (this._canvas = renderCanvas), stage && (this._stage = stage), "node" === mode || this._container || this._canvas || this._stage ? (isTrueBrowseEnv ? (0,
|
|
@@ -142,11 +142,8 @@ class VChart {
|
|
|
142
142
|
})), this._compiler.setSize(this._currentSize.width, this._currentSize.height),
|
|
143
143
|
this._eventDispatcher = new event_dispatcher_1.EventDispatcher(this, this._compiler),
|
|
144
144
|
this._event = new event_1.Event(this._eventDispatcher, mode), this._compiler.initView(),
|
|
145
|
-
null === (_d = this.
|
|
146
|
-
|
|
147
|
-
fontFamily: null === (_e = this._currentTheme) || void 0 === _e ? void 0 : _e.fontFamily
|
|
148
|
-
}
|
|
149
|
-
}), this._initDataSet(this._option.dataSet), this._autoSize = !!isTrueBrowseEnv && (null === (_g = null !== (_f = spec.autoFit) && void 0 !== _f ? _f : this._option.autoFit) || void 0 === _g || _g),
|
|
145
|
+
this._setFontFamilyTheme(null === (_d = this._currentTheme) || void 0 === _d ? void 0 : _d.fontFamily),
|
|
146
|
+
this._initDataSet(this._option.dataSet), this._autoSize = !!isTrueBrowseEnv && (null === (_f = null !== (_e = spec.autoFit) && void 0 !== _e ? _e : this._option.autoFit) || void 0 === _f || _f),
|
|
150
147
|
this._bindResizeEvent(), this._bindVGrammarViewEvent(), this._initChartPlugin(),
|
|
151
148
|
instance_manager_1.InstanceManager.registerInstance(this)) : null === (_b = this._option) || void 0 === _b || _b.onError("please specify container or renderCanvas!");
|
|
152
149
|
}
|
|
@@ -255,11 +252,12 @@ class VChart {
|
|
|
255
252
|
var _a, _b, _c, _d, _e, _f;
|
|
256
253
|
if (updateResult.reMake) this._releaseData(), this._initDataSet(), this._chartSpecTransformer = null,
|
|
257
254
|
null === (_a = this._chart) || void 0 === _a || _a.release(), this._chart = null,
|
|
258
|
-
null === (_b = this._compiler) || void 0 === _b || _b.releaseGrammar(!1 === (null === (_c = this._option) || void 0 === _c ? void 0 : _c.animation) || !1 === (null === (_d = this._spec) || void 0 === _d ? void 0 : _d.animation)),
|
|
255
|
+
updateResult.changeTheme && this._setCurrentTheme(), null === (_b = this._compiler) || void 0 === _b || _b.releaseGrammar(!1 === (null === (_c = this._option) || void 0 === _c ? void 0 : _c.animation) || !1 === (null === (_d = this._spec) || void 0 === _d ? void 0 : _d.animation)),
|
|
259
256
|
this._userEvents.forEach((e => {
|
|
260
257
|
var _a;
|
|
261
258
|
return null === (_a = this._event) || void 0 === _a ? void 0 : _a.on(e.eType, e.query, e.handler);
|
|
262
|
-
})), updateResult.reSize && this._doResize(); else if (updateResult.
|
|
259
|
+
})), updateResult.reSize && this._doResize(); else if (updateResult.changeTheme && this._setCurrentTheme(),
|
|
260
|
+
updateResult.reCompile && (null === (_e = this._compiler) || void 0 === _e || _e.clear({
|
|
263
261
|
chart: this._chart,
|
|
264
262
|
vChart: this
|
|
265
263
|
}, !this._option.animation || !this._spec.animation), null === (_f = this._compiler) || void 0 === _f || _f.compile({
|
|
@@ -424,26 +422,22 @@ class VChart {
|
|
|
424
422
|
}
|
|
425
423
|
_updateSpec(spec, forceMerge = !1, userUpdateOptions) {
|
|
426
424
|
var _a, _b;
|
|
427
|
-
const lastSpec = this._spec
|
|
428
|
-
if (!this._setNewSpec(spec, forceMerge)) return;
|
|
429
|
-
(0, vutils_1.isEqual)(lastSpec.theme, this._spec.theme) || this._setCurrentTheme();
|
|
430
|
-
const reSize = this._shouldChartResize(lastSpec);
|
|
431
|
-
if (null === (_b = null === (_a = this._compiler) || void 0 === _a ? void 0 : _a.getVGrammarView()) || void 0 === _b || _b.updateLayoutTag(),
|
|
432
|
-
this._spec.type !== lastSpec.type) return {
|
|
433
|
-
reTransformSpec: !0,
|
|
434
|
-
change: !0,
|
|
435
|
-
reMake: !0,
|
|
436
|
-
reCompile: !1,
|
|
437
|
-
reSize: reSize
|
|
438
|
-
};
|
|
439
|
-
this._initChartSpec(this._spec, "render");
|
|
440
|
-
const res = (0, util_2.mergeUpdateResult)(this._chart.updateSpec(this._spec), {
|
|
425
|
+
const lastSpec = this._spec, result = {
|
|
441
426
|
reTransformSpec: !1,
|
|
442
|
-
change:
|
|
427
|
+
change: !1,
|
|
443
428
|
reMake: !1,
|
|
444
429
|
reCompile: !1,
|
|
445
|
-
reSize:
|
|
446
|
-
|
|
430
|
+
reSize: !1,
|
|
431
|
+
changeTheme: !1
|
|
432
|
+
};
|
|
433
|
+
if (!this._setNewSpec(spec, forceMerge)) return;
|
|
434
|
+
(0, vutils_1.isEqual)(lastSpec.theme, this._spec.theme) || (result.changeTheme = !0);
|
|
435
|
+
const reSize = this._shouldChartResize(lastSpec);
|
|
436
|
+
if (result.reSize = reSize, null === (_b = null === (_a = this._compiler) || void 0 === _a ? void 0 : _a.getVGrammarView()) || void 0 === _b || _b.updateLayoutTag(),
|
|
437
|
+
this._spec.type !== lastSpec.type) return result.reMake = !0, result.reTransformSpec = !0,
|
|
438
|
+
result.change = !0, result;
|
|
439
|
+
this._initChartSpec(this._spec, "render");
|
|
440
|
+
const res = (0, util_2.mergeUpdateResult)(this._chart.updateSpec(this._spec), result);
|
|
447
441
|
return userUpdateOptions ? Object.assign(Object.assign({}, res), userUpdateOptions) : res;
|
|
448
442
|
}
|
|
449
443
|
updateModelSpec(filter, spec, forceMerge = !1, morphConfig) {
|
|
@@ -578,19 +572,23 @@ class VChart {
|
|
|
578
572
|
return this._currentThemeName;
|
|
579
573
|
}
|
|
580
574
|
setCurrentTheme(name) {
|
|
575
|
+
var _a;
|
|
581
576
|
return __awaiter(this, void 0, void 0, (function*() {
|
|
582
577
|
if (!theme_manager_1.ThemeManager.themeExist(name)) return this;
|
|
583
578
|
const result = this._setCurrentTheme(name);
|
|
584
|
-
return
|
|
579
|
+
return this._setFontFamilyTheme(null === (_a = this._currentTheme) || void 0 === _a ? void 0 : _a.fontFamily),
|
|
580
|
+
yield this.updateCustomConfigAndRerender(result, !1, {
|
|
585
581
|
transformSpec: !1,
|
|
586
582
|
actionSource: "setCurrentTheme"
|
|
587
583
|
}), this;
|
|
588
584
|
}));
|
|
589
585
|
}
|
|
590
586
|
setCurrentThemeSync(name) {
|
|
587
|
+
var _a;
|
|
591
588
|
if (!theme_manager_1.ThemeManager.themeExist(name)) return this;
|
|
592
589
|
const result = this._setCurrentTheme(name);
|
|
593
|
-
return this.
|
|
590
|
+
return this._setFontFamilyTheme(null === (_a = this._currentTheme) || void 0 === _a ? void 0 : _a.fontFamily),
|
|
591
|
+
this.updateCustomConfigAndRerender(result, !0, {
|
|
594
592
|
transformSpec: !1,
|
|
595
593
|
actionSource: "setCurrentTheme"
|
|
596
594
|
}), this;
|
|
@@ -603,6 +601,14 @@ class VChart {
|
|
|
603
601
|
reMake: !1
|
|
604
602
|
};
|
|
605
603
|
}
|
|
604
|
+
_setFontFamilyTheme(fontFamily) {
|
|
605
|
+
var _a;
|
|
606
|
+
fontFamily && (null === (_a = this.getStage()) || void 0 === _a || _a.setTheme({
|
|
607
|
+
text: {
|
|
608
|
+
fontFamily: fontFamily
|
|
609
|
+
}
|
|
610
|
+
}));
|
|
611
|
+
}
|
|
606
612
|
_getTooltipComponent() {
|
|
607
613
|
var _a;
|
|
608
614
|
return null === (_a = this._chart) || void 0 === _a ? void 0 : _a.getComponentsByType(type_1.ComponentTypeEnum.tooltip)[0];
|