@visactor/vchart 1.11.1-alpha.6 → 1.11.2-alpha.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.
- package/build/es5/index.js +12 -12
- package/build/index.es.js +103642 -0
- package/build/index.js +32855 -30569
- package/build/index.min.js +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/animation/config.d.ts +1 -0
- package/cjs/animation/config.js +30 -24
- package/cjs/animation/config.js.map +1 -1
- package/cjs/chart/stack.js +1 -2
- package/cjs/compile/grammar-item.js +2 -1
- package/cjs/compile/util.js +3 -0
- package/cjs/compile/util.js.map +1 -1
- package/cjs/component/marker/mark-point/base-mark-point.js +27 -17
- package/cjs/component/marker/mark-point/base-mark-point.js.map +1 -1
- package/cjs/component/marker/mark-point/interface/theme.d.ts +7 -1
- package/cjs/component/marker/mark-point/interface/theme.js.map +1 -1
- package/cjs/component/player/player.js +5 -3
- package/cjs/component/player/player.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 -1
- package/cjs/data/transforms/sankey.js.map +1 -1
- package/cjs/env/env.d.ts +1 -0
- package/cjs/env/env.js +7 -1
- package/cjs/env/env.js.map +1 -1
- package/cjs/event/event-dispatcher.js +2 -1
- package/cjs/event/index.js +1 -2
- package/cjs/model/layout-model.js +4 -3
- package/cjs/model/layout-model.js.map +1 -1
- package/cjs/plugin/components/tooltip-handler/base.d.ts +1 -1
- package/cjs/series/area/animation.d.ts +1 -1
- package/cjs/series/area/animation.js +6 -16
- package/cjs/series/area/animation.js.map +1 -1
- package/cjs/series/area/area.js +1 -1
- package/cjs/series/area/area.js.map +1 -1
- package/cjs/series/sankey/sankey.d.ts +3 -0
- package/cjs/series/sankey/sankey.js +31 -31
- package/cjs/series/sankey/sankey.js.map +1 -1
- package/cjs/typings/spec/common.d.ts +1 -0
- package/cjs/typings/spec/common.js +2 -2
- package/cjs/typings/spec/common.js.map +1 -1
- package/esm/animation/config.d.ts +1 -0
- package/esm/animation/config.js +29 -23
- package/esm/animation/config.js.map +1 -1
- package/esm/chart/stack.js +1 -2
- package/esm/compile/grammar-item.js +2 -1
- package/esm/compile/util.js +3 -0
- package/esm/compile/util.js.map +1 -1
- package/esm/component/marker/mark-point/base-mark-point.js +25 -17
- package/esm/component/marker/mark-point/base-mark-point.js.map +1 -1
- package/esm/component/marker/mark-point/interface/theme.d.ts +7 -1
- package/esm/component/marker/mark-point/interface/theme.js.map +1 -1
- package/esm/component/player/player.js +5 -3
- package/esm/component/player/player.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 -1
- package/esm/data/transforms/sankey.js.map +1 -1
- package/esm/env/env.d.ts +1 -0
- package/esm/env/env.js +5 -1
- package/esm/env/env.js.map +1 -1
- package/esm/event/event-dispatcher.js +2 -1
- package/esm/event/index.js +1 -2
- package/esm/model/layout-model.js +4 -3
- package/esm/model/layout-model.js.map +1 -1
- package/esm/plugin/components/tooltip-handler/base.d.ts +1 -1
- package/esm/series/area/animation.d.ts +1 -1
- package/esm/series/area/animation.js +3 -16
- package/esm/series/area/animation.js.map +1 -1
- package/esm/series/area/area.js +3 -3
- package/esm/series/area/area.js.map +1 -1
- package/esm/series/sankey/sankey.d.ts +3 -0
- package/esm/series/sankey/sankey.js +31 -31
- package/esm/series/sankey/sankey.js.map +1 -1
- package/esm/typings/spec/common.d.ts +1 -0
- package/esm/typings/spec/common.js +2 -2
- package/esm/typings/spec/common.js.map +1 -1
- package/package.json +19 -21
|
@@ -53,6 +53,7 @@ export declare const registerScaleInOutAnimation: () => void;
|
|
|
53
53
|
export declare const registerFadeInOutAnimation: () => void;
|
|
54
54
|
export declare const registerCartesianGroupClipAnimation: () => void;
|
|
55
55
|
export declare const registerLineAnimation: () => void;
|
|
56
|
+
export declare const registerAreaAnimation: () => void;
|
|
56
57
|
export declare const registerVGrammarCommonAnimation: () => void;
|
|
57
58
|
export declare const registerVGrammarRectAnimation: () => void;
|
|
58
59
|
export declare const registerVGrammarArcAnimation: () => void;
|
package/cjs/animation/config.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: !0
|
|
5
|
-
}), exports.registerVGrammarPolygonAnimation = exports.registerVGrammarLineOrAreaAnimation = exports.registerVGrammarArcAnimation = exports.registerVGrammarRectAnimation = exports.registerVGrammarCommonAnimation = exports.registerLineAnimation = exports.registerCartesianGroupClipAnimation = exports.registerFadeInOutAnimation = exports.registerScaleInOutAnimation = exports.FadeInOutAnimation = exports.ScaleInOutAnimation = exports.DEFAULT_ANIMATION_CONFIG = void 0;
|
|
5
|
+
}), exports.registerVGrammarPolygonAnimation = exports.registerVGrammarLineOrAreaAnimation = exports.registerVGrammarArcAnimation = exports.registerVGrammarRectAnimation = exports.registerVGrammarCommonAnimation = exports.registerAreaAnimation = exports.registerLineAnimation = exports.registerCartesianGroupClipAnimation = exports.registerFadeInOutAnimation = exports.registerScaleInOutAnimation = exports.FadeInOutAnimation = exports.ScaleInOutAnimation = exports.DEFAULT_ANIMATION_CONFIG = void 0;
|
|
6
6
|
|
|
7
7
|
const vrender_core_1 = require("@visactor/vrender-core"), animation_1 = require("../series/line/animation"), factory_1 = require("../core/factory"), vgrammar_core_1 = require("@visactor/vgrammar-core");
|
|
8
8
|
|
|
@@ -97,34 +97,40 @@ const registerCartesianGroupClipAnimation = () => {
|
|
|
97
97
|
|
|
98
98
|
exports.registerCartesianGroupClipAnimation = registerCartesianGroupClipAnimation;
|
|
99
99
|
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
excludeChannels: [ "points", "defined" ]
|
|
113
|
-
}
|
|
114
|
-
}, {
|
|
115
|
-
channel: [ "points" ],
|
|
116
|
-
custom: vrender_core_1.TagPointsUpdate,
|
|
117
|
-
duration: exports.DEFAULT_ANIMATION_CONFIG.update.duration,
|
|
118
|
-
easing: exports.DEFAULT_ANIMATION_CONFIG.update.easing
|
|
119
|
-
} ],
|
|
120
|
-
disappear: {
|
|
121
|
-
type: "clipOut"
|
|
100
|
+
const lineOrAreaAnimation = (params, preset) => ({
|
|
101
|
+
appear: (0, animation_1.linePresetAnimation)(params, preset),
|
|
102
|
+
enter: {
|
|
103
|
+
type: "fadeIn"
|
|
104
|
+
},
|
|
105
|
+
exit: {
|
|
106
|
+
type: "fadeOut"
|
|
107
|
+
},
|
|
108
|
+
update: [ {
|
|
109
|
+
type: "update",
|
|
110
|
+
options: {
|
|
111
|
+
excludeChannels: [ "points", "defined" ]
|
|
122
112
|
}
|
|
123
|
-
}
|
|
113
|
+
}, {
|
|
114
|
+
channel: [ "points" ],
|
|
115
|
+
custom: vrender_core_1.TagPointsUpdate,
|
|
116
|
+
duration: exports.DEFAULT_ANIMATION_CONFIG.update.duration,
|
|
117
|
+
easing: exports.DEFAULT_ANIMATION_CONFIG.update.easing
|
|
118
|
+
} ],
|
|
119
|
+
disappear: {
|
|
120
|
+
type: "clipOut"
|
|
121
|
+
}
|
|
122
|
+
}), registerLineAnimation = () => {
|
|
123
|
+
factory_1.Factory.registerAnimation("line", lineOrAreaAnimation);
|
|
124
124
|
};
|
|
125
125
|
|
|
126
126
|
exports.registerLineAnimation = registerLineAnimation;
|
|
127
127
|
|
|
128
|
+
const registerAreaAnimation = () => {
|
|
129
|
+
factory_1.Factory.registerAnimation("area", lineOrAreaAnimation);
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
exports.registerAreaAnimation = registerAreaAnimation;
|
|
133
|
+
|
|
128
134
|
const registerVGrammarCommonAnimation = () => {
|
|
129
135
|
vgrammar_core_1.View.useRegisters([ vgrammar_core_1.registerScaleInAnimation, vgrammar_core_1.registerScaleOutAnimation, vgrammar_core_1.registerFadeInAnimation, vgrammar_core_1.registerFadeOutAnimation, vgrammar_core_1.registerMoveInAnimation, vgrammar_core_1.registerMoveOutAnimation, vgrammar_core_1.registerRotateInAnimation, vgrammar_core_1.registerRotateOutAnimation, vgrammar_core_1.registerUpdateAnimation ]);
|
|
130
136
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/animation/config.ts"],"names":[],"mappings":";;;AACA,yDAA+E;AAG/E,wDAA+D;AAE/D,6CAA0C;AAC1C,2DA6BiC;AAEpB,QAAA,wBAAwB,GAAG;IACtC,MAAM,EAAE;QACN,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,UAAU;KACnB;IACD,MAAM,EAAE;QACN,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,GAAG;QACb,MAAM,EAAE,QAAQ;KACjB;IACD,KAAK,EAAE;QACL,QAAQ,EAAE,GAAG;QACb,MAAM,EAAE,QAAQ;KACjB;IACD,IAAI,EAAE;QACJ,QAAQ,EAAE,GAAG;QACb,MAAM,EAAE,QAAQ;KACjB;IACD,SAAS,EAAE;QACT,QAAQ,EAAE,GAAG;QACb,MAAM,EAAE,SAAS;KAClB;CACF,CAAC;AAEW,QAAA,mBAAmB,GAAG;IACjC,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;IAC3B,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;IAC1B,IAAI,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE;IAC1B,SAAS,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE;CAChC,CAAC;AAEW,QAAA,kBAAkB,GAAG;IAChC,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;IAC1B,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;IACzB,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;IACzB,SAAS,EAAE,E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G,GAAG,EAAE;IAChD,oBAAI,CAAC,YAAY,CAAC;QAChB,6CAA6B;QAC7B,8CAA8B;QAC9B,4CAA4B;QAC5B,6CAA6B;QAC7B,6CAA6B;QAC7B,8CAA8B;KAC/B,CAAC,CAAC;AACL,CAAC,CAAC;AATW,QAAA,6BAA6B,iCASxC;AAEK,MAAM,4BAA4B,GAAG,GAAG,EAAE;IAC/C,oBAAI,CAAC,YAAY,CAAC;QAChB,6CAA6B;QAC7B,8CAA8B;QAC9B,4CAA4B;QAC5B,6CAA6B;KAC9B,CAAC,CAAC;AACL,CAAC,CAAC;AAPW,QAAA,4BAA4B,gCAOvC;AAEK,MAAM,mCAAmC,GAAG,GAAG,EAAE;IACtD,oBAAI,CAAC,YAAY,CAAC;QAChB,6CAA6B;QAC7B,8CAA8B;QAC9B,8CAA8B;QAC9B,+CAA+B;QAC/B,8CAA8B;QAC9B,+CAA+B;QAC/B,uCAAuB;QACvB,wCAAwB;KACzB,CAAC,CAAC;AACL,CAAC,CAAC;AAXW,QAAA,mCAAmC,uCAW9C;AAEK,MAAM,gCAAgC,GAAG,GAAG,EAAE;IACnD,oBAAI,CAAC,YAAY,CAAC,CAAC,6CAA6B,EAAE,8CAA8B,CAAC,CAAC,CAAC;AACrF,CAAC,CAAC;AAFW,QAAA,gCAAgC,oCAE3C","file":"config.js","sourcesContent":["/* eslint-disable no-duplicate-imports */\nimport { TagPointsUpdate, ClipDirectionAnimate } from '@visactor/vrender-core';\nimport type { IElement } from '@visactor/vgrammar-core';\nimport type { ILineAnimationParams, LineAppearPreset } from '../series/line/animation';\nimport { linePresetAnimation } from '../series/line/animation';\nimport type { MarkAnimationSpec, ICartesianGroupAnimationParams } from './interface';\nimport { Factory } from '../core/factory';\nimport {\n View,\n registerScaleInAnimation,\n registerScaleOutAnimation,\n registerFadeInAnimation,\n registerFadeOutAnimation,\n registerClipInAnimation,\n registerClipOutAnimation,\n registerGrowAngleInAnimation,\n registerGrowAngleOutAnimation,\n registerGrowCenterInAnimation,\n registerGrowCenterOutAnimation,\n registerGrowHeightInAnimation,\n registerGrowHeightOutAnimation,\n registerGrowPointsInAnimation,\n registerGrowPointsOutAnimation,\n registerGrowPointsXInAnimation,\n registerGrowPointsXOutAnimation,\n registerGrowPointsYInAnimation,\n registerGrowPointsYOutAnimation,\n registerGrowRadiusInAnimation,\n registerGrowRadiusOutAnimation,\n registerGrowWidthInAnimation,\n registerGrowWidthOutAnimation,\n registerMoveInAnimation,\n registerMoveOutAnimation,\n registerRotateInAnimation,\n registerRotateOutAnimation,\n registerUpdateAnimation\n} from '@visactor/vgrammar-core';\n\nexport const DEFAULT_ANIMATION_CONFIG = {\n appear: {\n duration: 1000,\n easing: 'cubicOut'\n },\n update: {\n type: 'update',\n duration: 300,\n easing: 'linear'\n },\n enter: {\n duration: 300,\n easing: 'linear'\n },\n exit: {\n duration: 300,\n easing: 'linear'\n },\n disappear: {\n duration: 500,\n easing: 'cubicIn'\n }\n};\n\nexport const ScaleInOutAnimation = {\n appear: { type: 'scaleIn' },\n enter: { type: 'scaleIn' },\n exit: { type: 'scaleOut' },\n disappear: { type: 'scaleOut' }\n};\n\nexport const FadeInOutAnimation = {\n appear: { type: 'fadeIn' },\n enter: { type: 'fadeIn' },\n exit: { type: 'fadeOut' },\n disappear: { type: 'fadeOut' }\n};\n\nexport const registerScaleInOutAnimation = () => {\n Factory.registerAnimation('scaleInOut', () => ScaleInOutAnimation);\n};\n\nexport const registerFadeInOutAnimation = () => {\n Factory.registerAnimation('fadeInOut', () => FadeInOutAnimation);\n};\n\nexport const registerCartesianGroupClipAnimation = () => {\n Factory.registerAnimation('cartesianGroupClip', (params?: ICartesianGroupAnimationParams) => {\n return {\n appear: {\n custom: ClipDirectionAnimate,\n customParameters: (datum: any, element: IElement) => {\n return {\n animationType: 'in',\n group: element.getGraphicItem(),\n direction: params.direction(),\n width: params.width(),\n height: params.height(),\n orient: params.orient()\n };\n }\n },\n disappear: {\n custom: ClipDirectionAnimate,\n customParameters: (datum: any, element: IElement) => {\n return {\n animationType: 'out',\n group: element.getGraphicItem(),\n direction: params.direction(),\n width: params.width(),\n height: params.height(),\n orient: params.orient()\n };\n }\n }\n };\n });\n};\n\nconst lineOrAreaAnimation = (params: ILineAnimationParams, preset: LineAppearPreset) => {\n return {\n appear: linePresetAnimation(params, preset),\n enter: { type: 'fadeIn' },\n exit: { type: 'fadeOut' },\n update: [\n {\n type: 'update',\n options: { excludeChannels: ['points', 'defined'] }\n },\n {\n channel: ['points'],\n custom: TagPointsUpdate,\n duration: DEFAULT_ANIMATION_CONFIG.update.duration,\n easing: DEFAULT_ANIMATION_CONFIG.update.easing\n }\n ],\n disappear: { type: 'clipOut' }\n } as MarkAnimationSpec;\n};\n\nexport const registerLineAnimation = () => {\n Factory.registerAnimation('line', lineOrAreaAnimation);\n};\n\nexport const registerAreaAnimation = () => {\n Factory.registerAnimation('area', lineOrAreaAnimation);\n};\n\nexport const registerVGrammarCommonAnimation = () => {\n View.useRegisters([\n registerScaleInAnimation,\n registerScaleOutAnimation,\n registerFadeInAnimation,\n registerFadeOutAnimation,\n registerMoveInAnimation,\n registerMoveOutAnimation,\n registerRotateInAnimation,\n registerRotateOutAnimation,\n registerUpdateAnimation\n ]);\n};\n\nexport const registerVGrammarRectAnimation = () => {\n View.useRegisters([\n registerGrowHeightInAnimation,\n registerGrowHeightOutAnimation,\n registerGrowWidthInAnimation,\n registerGrowWidthOutAnimation,\n registerGrowCenterInAnimation,\n registerGrowCenterOutAnimation\n ]);\n};\n\nexport const registerVGrammarArcAnimation = () => {\n View.useRegisters([\n registerGrowRadiusInAnimation,\n registerGrowRadiusOutAnimation,\n registerGrowAngleInAnimation,\n registerGrowAngleOutAnimation\n ]);\n};\n\nexport const registerVGrammarLineOrAreaAnimation = () => {\n View.useRegisters([\n registerGrowPointsInAnimation,\n registerGrowPointsOutAnimation,\n registerGrowPointsXInAnimation,\n registerGrowPointsXOutAnimation,\n registerGrowPointsYInAnimation,\n registerGrowPointsYOutAnimation,\n registerClipInAnimation,\n registerClipOutAnimation\n ]);\n};\n\nexport const registerVGrammarPolygonAnimation = () => {\n View.useRegisters([registerGrowPointsInAnimation, registerGrowPointsOutAnimation]);\n};\n"]}
|
package/cjs/chart/stack.js
CHANGED
package/cjs/compile/util.js
CHANGED
package/cjs/compile/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/compile/util.ts"],"names":[],"mappings":";;;AAEA,mDAAwD;AAGxD,SAAgB,YAAY,CAAC,IAAgB;IAC3C,QAAQ,IAAI,EAAE;QACZ,KAAK,uBAAc,CAAC,iBAAiB,CAAC,CAAC;QACvC,KAAK,uBAAc,CAAC,gBAAgB,CAAC;YACnC,OAAO,SAAS,CAAC;QACnB,KAAK,uBAAc,CAAC,IAAI,CAAC;QACzB,KAAK,uBAAc,CAAC,MAAM;YACxB,OAAO,MAAM,CAAC;QAChB,KAAK,uBAAc,CAAC,OAAO,CAAC;QAC5B,KAAK,uBAAc,CAAC,iBAAiB,CAAC;YACpC,OAAO,QAAQ,CAAC;QAClB,KAAK,uBAAc,CAAC,IAAI;YACtB,OAAO,MAAM,CAAC;QAChB,KAAK,uBAAc,CAAC,EAAE;YACpB,OAAO,IAAI,CAAC;QACd,KAAK,uBAAc,CAAC,EAAE;YACpB,OAAO,IAAI,CAAC;
|
|
1
|
+
{"version":3,"sources":["../src/compile/util.ts"],"names":[],"mappings":";;;AAEA,mDAAwD;AAGxD,SAAgB,YAAY,CAAC,IAAgB;IAC3C,QAAQ,IAAI,EAAE;QACZ,KAAK,uBAAc,CAAC,iBAAiB,CAAC,CAAC;QACvC,KAAK,uBAAc,CAAC,gBAAgB,CAAC;YACnC,OAAO,SAAS,CAAC;QACnB,KAAK,uBAAc,CAAC,IAAI,CAAC;QACzB,KAAK,uBAAc,CAAC,MAAM;YACxB,OAAO,MAAM,CAAC;QAChB,KAAK,uBAAc,CAAC,OAAO,CAAC;QAC5B,KAAK,uBAAc,CAAC,iBAAiB,CAAC;YACpC,OAAO,QAAQ,CAAC;QAClB,KAAK,uBAAc,CAAC,IAAI;YACtB,OAAO,MAAM,CAAC;QAChB,KAAK,uBAAc,CAAC,EAAE;YACpB,OAAO,IAAI,CAAC;QACd,KAAK,uBAAc,CAAC,EAAE;YACpB,OAAO,IAAI,CAAC;QACd,KAAK,uBAAc,CAAC,OAAO;YACzB,OAAO,SAAS,CAAC;KACpB;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AArBD,oCAqBC","file":"util.js","sourcesContent":["import type { RenderMode } from '../typings/spec';\n// eslint-disable-next-line no-duplicate-imports\nimport { RenderModeEnum } from '../typings/spec/common';\n\n// TODO: feishu => lark\nexport function toRenderMode(mode: RenderMode): any {\n switch (mode) {\n case RenderModeEnum['desktop-browser']:\n case RenderModeEnum['mobile-browser']:\n return 'browser';\n case RenderModeEnum.node:\n case RenderModeEnum.worker:\n return 'node';\n case RenderModeEnum.miniApp:\n case RenderModeEnum['desktop-miniApp']:\n return 'feishu';\n case RenderModeEnum.lynx:\n return 'lynx';\n case RenderModeEnum.wx:\n return 'wx';\n case RenderModeEnum.tt:\n return 'tt';\n case RenderModeEnum.harmony:\n return 'harmony';\n }\n return 'browser';\n}\n"]}
|
|
@@ -25,8 +25,8 @@ class BaseMarkPoint extends base_marker_1.BaseMarker {
|
|
|
25
25
|
return "polar" === markerSpec.coordinateType || doPolarProcess ? "polar" : "geo" === markerSpec.coordinateType || doGeoProcess ? "geo" : "cartesian";
|
|
26
26
|
}
|
|
27
27
|
_createMarkerComponent() {
|
|
28
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
29
|
-
const {itemContent: itemContent = {}, itemLine: itemLine = {}} = this._spec, {text: label = {}, symbol: symbol, image: image, richText: richText} = itemContent, restItemContent = __rest(itemContent, [ "text", "symbol", "image", "richText" ]), markPointAttrs = {
|
|
28
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3;
|
|
29
|
+
const {itemContent: itemContent = {}, itemLine: itemLine = {}, targetSymbol: targetSymbol = {}} = this._spec, {text: label = {}, symbol: symbol, image: image, richText: richText} = itemContent, restItemContent = __rest(itemContent, [ "text", "symbol", "image", "richText" ]), markPointAttrs = {
|
|
30
30
|
zIndex: this.layoutZIndex,
|
|
31
31
|
interactive: null === (_a = this._spec.interactive) || void 0 === _a || _a,
|
|
32
32
|
hover: null === (_b = this._spec.interactive) || void 0 === _b || _b,
|
|
@@ -37,29 +37,39 @@ class BaseMarkPoint extends base_marker_1.BaseMarker {
|
|
|
37
37
|
},
|
|
38
38
|
clipInRange: null !== (_d = this._spec.clip) && void 0 !== _d && _d,
|
|
39
39
|
itemContent: Object.assign({
|
|
40
|
-
symbolStyle: (0, style_1.transformToGraphic)((0, utils_1.transformStyle)(null == symbol ? void 0 : symbol.style, this._markerData)),
|
|
41
|
-
imageStyle: (0, utils_1.transformStyle)(null == image ? void 0 : image.style, this._markerData),
|
|
42
|
-
textStyle: (0, utils_1.transformLabelAttributes)(label, this._markerData),
|
|
43
|
-
richTextStyle: (0, utils_1.transformStyle)(null == richText ? void 0 : richText.style, this._markerData),
|
|
44
40
|
offsetX: (0, utils_1.transformOffset)(itemContent.offsetX, this._relativeSeries.getRegion()),
|
|
45
41
|
offsetY: (0, utils_1.transformOffset)(itemContent.offsetX, this._relativeSeries.getRegion())
|
|
46
42
|
}, restItemContent),
|
|
43
|
+
targetSymbol: {
|
|
44
|
+
offset: null !== (_e = targetSymbol.offset) && void 0 !== _e ? _e : 0,
|
|
45
|
+
visible: null !== (_f = targetSymbol.visible) && void 0 !== _f && _f,
|
|
46
|
+
size: null !== (_g = targetSymbol.size) && void 0 !== _g ? _g : 20,
|
|
47
|
+
style: (0, utils_1.transformStyle)(targetSymbol.style, this._markerData)
|
|
48
|
+
},
|
|
47
49
|
state: {
|
|
48
|
-
line: (0, utils_1.transformState)(null !== (
|
|
49
|
-
lineStartSymbol: (0, utils_1.transformState)(null !== (
|
|
50
|
-
lineEndSymbol: (0, utils_1.transformState)(null !== (
|
|
51
|
-
symbol: (0, utils_1.transformState)(null !== (
|
|
52
|
-
image: (0, utils_1.transformState)(null !== (
|
|
53
|
-
text: (0, utils_1.transformState)(null !== (
|
|
54
|
-
textBackground: (0, utils_1.transformState)(null === (
|
|
55
|
-
richText: (0, utils_1.transformState)(null !== (
|
|
56
|
-
customMark: (0, utils_1.transformState)(null !== (
|
|
50
|
+
line: (0, utils_1.transformState)(null !== (_j = null === (_h = this._spec.itemLine.line) || void 0 === _h ? void 0 : _h.state) && void 0 !== _j ? _j : {}, this._markerData),
|
|
51
|
+
lineStartSymbol: (0, utils_1.transformState)(null !== (_l = null === (_k = this._spec.itemLine.startSymbol) || void 0 === _k ? void 0 : _k.state) && void 0 !== _l ? _l : {}, this._markerData),
|
|
52
|
+
lineEndSymbol: (0, utils_1.transformState)(null !== (_o = null === (_m = this._spec.itemLine.endSymbol) || void 0 === _m ? void 0 : _m.state) && void 0 !== _o ? _o : {}, this._markerData),
|
|
53
|
+
symbol: (0, utils_1.transformState)(null !== (_q = null === (_p = this._spec.itemContent.symbol) || void 0 === _p ? void 0 : _p.state) && void 0 !== _q ? _q : {}, this._markerData),
|
|
54
|
+
image: (0, utils_1.transformState)(null !== (_s = null === (_r = this._spec.itemContent.image) || void 0 === _r ? void 0 : _r.state) && void 0 !== _s ? _s : {}, this._markerData),
|
|
55
|
+
text: (0, utils_1.transformState)(null !== (_u = null === (_t = this._spec.itemContent.text) || void 0 === _t ? void 0 : _t.state) && void 0 !== _u ? _u : {}, this._markerData),
|
|
56
|
+
textBackground: (0, utils_1.transformState)(null === (_w = null === (_v = this._spec.itemContent.text) || void 0 === _v ? void 0 : _v.labelBackground) || void 0 === _w ? void 0 : _w.state, this._markerData),
|
|
57
|
+
richText: (0, utils_1.transformState)(null !== (_y = null === (_x = this._spec.itemContent.richText) || void 0 === _x ? void 0 : _x.state) && void 0 !== _y ? _y : {}, this._markerData),
|
|
58
|
+
customMark: (0, utils_1.transformState)(null !== (_0 = null === (_z = this._spec.itemContent.customMark) || void 0 === _z ? void 0 : _z.state) && void 0 !== _0 ? _0 : {}, this._markerData),
|
|
59
|
+
targetItem: (0, utils_1.transformState)(null !== (_2 = null === (_1 = this._spec.targetSymbol) || void 0 === _1 ? void 0 : _1.state) && void 0 !== _2 ? _2 : {}, this._markerData)
|
|
57
60
|
},
|
|
58
|
-
animation: null !== (
|
|
61
|
+
animation: null !== (_3 = this._spec.animation) && void 0 !== _3 && _3,
|
|
59
62
|
animationEnter: this._spec.animationEnter,
|
|
60
63
|
animationExit: this._spec.animationExit,
|
|
61
64
|
animationUpdate: this._spec.animationUpdate
|
|
62
|
-
}
|
|
65
|
+
};
|
|
66
|
+
(null == symbol ? void 0 : symbol.style) && (markPointAttrs.itemContent.symbolStyle = (0,
|
|
67
|
+
style_1.transformToGraphic)((0, utils_1.transformStyle)(symbol.style, this._markerData))),
|
|
68
|
+
(null == image ? void 0 : image.style) && (markPointAttrs.itemContent.imageStyle = (0,
|
|
69
|
+
utils_1.transformStyle)(image.style, this._markerData)), label && (markPointAttrs.itemContent.textStyle = (0,
|
|
70
|
+
utils_1.transformLabelAttributes)(label, this._markerData)), (null == richText ? void 0 : richText.style) && (markPointAttrs.itemContent.richTextStyle = (0,
|
|
71
|
+
utils_1.transformStyle)(richText.style, this._markerData));
|
|
72
|
+
const {visible: visible, line: line = {}} = itemLine, restItemLine = __rest(itemLine, [ "visible", "line" ]);
|
|
63
73
|
markPointAttrs.itemLine = !1 !== visible ? Object.assign(Object.assign({}, restItemLine), {
|
|
64
74
|
visible: !0,
|
|
65
75
|
lineStyle: (0, style_1.transformToGraphic)(line.style)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/component/marker/mark-point/base-mark-point.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,iDAA8C;AAE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AC","file":"base-mark-point.js","sourcesContent":["import { DataView } from '@visactor/vdataset';\nimport type { IMarkPoint, IMarkPointSpec } from './interface';\nimport { markerAggregation } from '../../../data/transforms/aggregation';\nimport {\n computeClipRange,\n computeOffsetFromRegion,\n getMarkPointProcessInfo,\n transformLabelAttributes,\n transformOffset,\n transformState,\n transformStyle\n} from '../utils';\nimport { registerDataSetInstanceTransform } from '../../../data/register';\nimport type { MarkPointAttrs } from '@visactor/vrender-components';\n// eslint-disable-next-line no-duplicate-imports\nimport { MarkPoint as MarkPointComponent } from '@visactor/vrender-components';\nimport { isValid } from '@visactor/vutils';\nimport { transformToGraphic } from '../../../util/style';\nimport { BaseMarker } from '../base-marker';\nimport { LayoutZIndex } from '../../../constant';\nimport type { IGroup } from '@visactor/vrender-core';\nimport { markerFilter } from '../../../data/transforms/marker-filter';\nimport type { IMarkProcessOptions } from '../interface';\n\nexport abstract class BaseMarkPoint extends BaseMarker<IMarkPointSpec> implements IMarkPoint {\n static specKey = 'markPoint';\n specKey = 'markPoint';\n\n layoutZIndex: number = LayoutZIndex.MarkPoint;\n protected declare _markerComponent: MarkPointComponent;\n\n protected abstract _computePointsAttr(): any;\n protected abstract _computeOptions(): IMarkProcessOptions;\n\n static _getMarkerCoordinateType(markerSpec: any): string {\n const { doPolarProcess, doGeoProcess } = getMarkPointProcessInfo(markerSpec);\n if (markerSpec.coordinateType === 'polar' || doPolarProcess) {\n return 'polar';\n } else if (markerSpec.coordinateType === 'geo' || doGeoProcess) {\n return 'geo';\n }\n return 'cartesian';\n }\n\n protected _createMarkerComponent() {\n const { itemContent = {}, itemLine = {} } = this._spec;\n const { text: label = {}, symbol, image, richText, ...restItemContent } = itemContent;\n\n const markPointAttrs: MarkPointAttrs = {\n zIndex: this.layoutZIndex,\n interactive: this._spec.interactive ?? true,\n hover: this._spec.interactive ?? true,\n select: this._spec.interactive ?? true,\n position: { x: 0, y: 0 },\n clipInRange: this._spec.clip ?? false,\n itemContent: {\n symbolStyle: transformToGraphic(transformStyle(symbol?.style, this._markerData)),\n imageStyle: transformStyle(image?.style, this._markerData),\n textStyle: transformLabelAttributes(label, this._markerData),\n richTextStyle: transformStyle(richText?.style, this._markerData),\n offsetX: transformOffset(itemContent.offsetX, this._relativeSeries.getRegion()),\n offsetY: transformOffset(itemContent.offsetX, this._relativeSeries.getRegion()),\n ...restItemContent // Tips: 因为网站 demo 上已经透出了 imageStyle richTextStyle 的写法,为了兼容所以这个需要在后面覆盖\n },\n state: {\n line: transformState(this._spec.itemLine.line?.state ?? {}, this._markerData),\n lineStartSymbol: transformState(this._spec.itemLine.startSymbol?.state ?? {}, this._markerData),\n lineEndSymbol: transformState(this._spec.itemLine.endSymbol?.state ?? {}, this._markerData),\n symbol: transformState(this._spec.itemContent.symbol?.state ?? {}, this._markerData),\n image: transformState(this._spec.itemContent.image?.state ?? {}, this._markerData),\n text: transformState(this._spec.itemContent.text?.state ?? {}, this._markerData),\n textBackground: transformState(this._spec.itemContent.text?.labelBackground?.state, this._markerData),\n richText: transformState(this._spec.itemContent.richText?.state ?? {}, this._markerData),\n customMark: transformState(this._spec.itemContent.customMark?.state ?? {}, this._markerData)\n },\n animation: this._spec.animation ?? false,\n animationEnter: this._spec.animationEnter,\n animationExit: this._spec.animationExit,\n animationUpdate: this._spec.animationUpdate\n };\n\n const { visible, line = {}, ...restItemLine } = itemLine;\n if (visible !== false) {\n markPointAttrs.itemLine = {\n ...restItemLine,\n visible: true,\n lineStyle: transformToGraphic(line.style)\n } as any;\n } else {\n markPointAttrs.itemLine = {\n visible: false\n };\n }\n\n const markPoint = new MarkPointComponent(markPointAttrs);\n return markPoint as unknown as IGroup;\n }\n\n protected _markerLayout() {\n const spec = this._spec;\n const data = this._markerData;\n const relativeSeries = this._relativeSeries;\n\n const { point } = this._computePointsAttr();\n\n const seriesData = this._getRelativeDataView().latestData;\n const dataPoints = data\n ? data.latestData[0] && data.latestData[0].latestData\n ? data.latestData[0].latestData\n : data.latestData\n : seriesData;\n\n let limitRect;\n if (spec.clip || spec.itemContent?.confine) {\n const { minX, maxX, minY, maxY } = computeClipRange([relativeSeries.getRegion()]);\n limitRect = {\n x: minX,\n y: minY,\n width: maxX - minX,\n height: maxY - minY\n };\n }\n if (this._markerComponent) {\n const attribute = this._markerComponent.attribute ?? {};\n const textStyle = attribute.itemContent?.textStyle ?? {};\n this._markerComponent.setAttributes({\n position: point === undefined ? { x: null, y: null } : point, // setAttrs时merge时undefined会被忽略, 所以这里做转换\n itemContent: {\n ...attribute.itemContent,\n textStyle: {\n ...textStyle,\n text: this._spec.itemContent.text?.formatMethod\n ? // type error here will be fixed in components\n (this._spec.itemContent.text.formatMethod(dataPoints, seriesData) as any)\n : textStyle.text\n },\n offsetX: computeOffsetFromRegion(point, attribute.itemContent.offsetX, this._relativeSeries.getRegion()),\n offsetY: computeOffsetFromRegion(point, attribute.itemContent.offsetY, this._relativeSeries.getRegion())\n },\n limitRect,\n dx: this._layoutOffsetX,\n dy: this._layoutOffsetY\n });\n }\n }\n\n protected _initDataView(): void {\n const spec = this._spec as any;\n const { doXYProcess, doPolarProcess, doGeoProcess } = getMarkPointProcessInfo(spec);\n const isCoordinateProcess = isValid(spec.coordinate);\n if (!isCoordinateProcess && !doXYProcess && !doPolarProcess && !doGeoProcess) {\n return;\n }\n\n registerDataSetInstanceTransform(this._option.dataSet, 'markerAggregation', markerAggregation);\n registerDataSetInstanceTransform(this._option.dataSet, 'markerFilter', markerFilter);\n\n const { options } = this._computeOptions();\n\n const data = new DataView(this._option.dataSet, { name: `${this.type}_${this.id}_data` });\n data.parse([this._getRelativeDataView()], {\n type: 'dataview'\n });\n data.transform({\n type: 'markerAggregation',\n options\n });\n\n data.transform({\n type: 'markerFilter',\n options: this._getAllRelativeSeries()\n });\n data.target.on('change', () => {\n this._markerLayout();\n });\n this._markerData = data;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/component/marker/mark-point/base-mark-point.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,iDAA8C;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AC;QAE3C,MAAM,IAAI,GAAG,IAAI,mBAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;QAC1F,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,EAAE;YACxC,IAAI,EAAE,UAAU;SACjB,CAAC,CAAC;QACH,IAAI,CAAC,SAAS,CAAC;YACb,IAAI,EAAE,mBAAmB;YACzB,OAAO;SACR,CAAC,CAAC;QAEH,IAAI,CAAC,SAAS,CAAC;YACb,IAAI,EAAE,cAAc;YACpB,OAAO,EAAE,IAAI,CAAC,qBAAqB,EAAE;SACtC,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;YAC5B,IAAI,CAAC,aAAa,EAAE,CAAC;QACvB,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC1B,CAAC;;AAxKH,sCAyKC;AAxKQ,qBAAO,GAAG,WAAW,CAAC","file":"base-mark-point.js","sourcesContent":["import { DataView } from '@visactor/vdataset';\nimport type { IMarkPoint, IMarkPointSpec } from './interface';\nimport { markerAggregation } from '../../../data/transforms/aggregation';\nimport {\n computeClipRange,\n computeOffsetFromRegion,\n getMarkPointProcessInfo,\n transformLabelAttributes,\n transformOffset,\n transformState,\n transformStyle\n} from '../utils';\nimport { registerDataSetInstanceTransform } from '../../../data/register';\nimport type { MarkPointAttrs } from '@visactor/vrender-components';\n// eslint-disable-next-line no-duplicate-imports\nimport { MarkPoint as MarkPointComponent } from '@visactor/vrender-components';\nimport { isValid } from '@visactor/vutils';\nimport { transformToGraphic } from '../../../util/style';\nimport { BaseMarker } from '../base-marker';\nimport { LayoutZIndex } from '../../../constant';\nimport type { IGroup } from '@visactor/vrender-core';\nimport { markerFilter } from '../../../data/transforms/marker-filter';\nimport type { IMarkProcessOptions } from '../interface';\n\nexport abstract class BaseMarkPoint extends BaseMarker<IMarkPointSpec> implements IMarkPoint {\n static specKey = 'markPoint';\n specKey = 'markPoint';\n\n layoutZIndex: number = LayoutZIndex.MarkPoint;\n protected declare _markerComponent: MarkPointComponent;\n\n protected abstract _computePointsAttr(): any;\n protected abstract _computeOptions(): IMarkProcessOptions;\n\n static _getMarkerCoordinateType(markerSpec: any): string {\n const { doPolarProcess, doGeoProcess } = getMarkPointProcessInfo(markerSpec);\n if (markerSpec.coordinateType === 'polar' || doPolarProcess) {\n return 'polar';\n } else if (markerSpec.coordinateType === 'geo' || doGeoProcess) {\n return 'geo';\n }\n return 'cartesian';\n }\n\n protected _createMarkerComponent() {\n const { itemContent = {}, itemLine = {}, targetSymbol = {} } = this._spec;\n const { text: label = {}, symbol, image, richText, ...restItemContent } = itemContent;\n\n const markPointAttrs: MarkPointAttrs = {\n zIndex: this.layoutZIndex,\n interactive: this._spec.interactive ?? true,\n hover: this._spec.interactive ?? true,\n select: this._spec.interactive ?? true,\n position: { x: 0, y: 0 },\n clipInRange: this._spec.clip ?? false,\n itemContent: {\n offsetX: transformOffset(itemContent.offsetX, this._relativeSeries.getRegion()),\n offsetY: transformOffset(itemContent.offsetX, this._relativeSeries.getRegion()),\n ...restItemContent // Tips: 因为网站 demo 上已经透出了 imageStyle richTextStyle 的写法,为了兼容所以这个需要在后面覆盖\n },\n targetSymbol: {\n offset: targetSymbol.offset ?? 0,\n visible: targetSymbol.visible ?? false,\n size: targetSymbol.size ?? 20,\n style: transformStyle(targetSymbol.style, this._markerData)\n },\n state: {\n line: transformState(this._spec.itemLine.line?.state ?? {}, this._markerData),\n lineStartSymbol: transformState(this._spec.itemLine.startSymbol?.state ?? {}, this._markerData),\n lineEndSymbol: transformState(this._spec.itemLine.endSymbol?.state ?? {}, this._markerData),\n symbol: transformState(this._spec.itemContent.symbol?.state ?? {}, this._markerData),\n image: transformState(this._spec.itemContent.image?.state ?? {}, this._markerData),\n text: transformState(this._spec.itemContent.text?.state ?? {}, this._markerData),\n textBackground: transformState(this._spec.itemContent.text?.labelBackground?.state, this._markerData),\n richText: transformState(this._spec.itemContent.richText?.state ?? {}, this._markerData),\n customMark: transformState(this._spec.itemContent.customMark?.state ?? {}, this._markerData),\n targetItem: transformState(this._spec.targetSymbol?.state ?? {}, this._markerData)\n },\n animation: this._spec.animation ?? false,\n animationEnter: this._spec.animationEnter,\n animationExit: this._spec.animationExit,\n animationUpdate: this._spec.animationUpdate\n };\n\n if (symbol?.style) {\n markPointAttrs.itemContent.symbolStyle = transformToGraphic(transformStyle(symbol.style, this._markerData));\n }\n if (image?.style) {\n markPointAttrs.itemContent.imageStyle = transformStyle(image.style, this._markerData);\n }\n if (label) {\n markPointAttrs.itemContent.textStyle = transformLabelAttributes(label, this._markerData);\n }\n if (richText?.style) {\n markPointAttrs.itemContent.richTextStyle = transformStyle(richText.style, this._markerData);\n }\n\n const { visible, line = {}, ...restItemLine } = itemLine;\n if (visible !== false) {\n markPointAttrs.itemLine = {\n ...restItemLine,\n visible: true,\n lineStyle: transformToGraphic(line.style)\n } as any;\n } else {\n markPointAttrs.itemLine = {\n visible: false\n };\n }\n\n const markPoint = new MarkPointComponent(markPointAttrs);\n return markPoint as unknown as IGroup;\n }\n\n protected _markerLayout() {\n const spec = this._spec;\n const data = this._markerData;\n const relativeSeries = this._relativeSeries;\n\n const { point } = this._computePointsAttr();\n\n const seriesData = this._getRelativeDataView().latestData;\n const dataPoints = data\n ? data.latestData[0] && data.latestData[0].latestData\n ? data.latestData[0].latestData\n : data.latestData\n : seriesData;\n\n let limitRect;\n if (spec.clip || spec.itemContent?.confine) {\n const { minX, maxX, minY, maxY } = computeClipRange([relativeSeries.getRegion()]);\n limitRect = {\n x: minX,\n y: minY,\n width: maxX - minX,\n height: maxY - minY\n };\n }\n if (this._markerComponent) {\n const attribute = this._markerComponent.attribute ?? {};\n const textStyle = attribute.itemContent?.textStyle ?? {};\n this._markerComponent.setAttributes({\n position: point === undefined ? { x: null, y: null } : point, // setAttrs时merge时undefined会被忽略, 所以这里做转换\n itemContent: {\n ...attribute.itemContent,\n textStyle: {\n ...textStyle,\n text: this._spec.itemContent.text?.formatMethod\n ? // type error here will be fixed in components\n (this._spec.itemContent.text.formatMethod(dataPoints, seriesData) as any)\n : textStyle.text\n },\n offsetX: computeOffsetFromRegion(point, attribute.itemContent.offsetX, this._relativeSeries.getRegion()),\n offsetY: computeOffsetFromRegion(point, attribute.itemContent.offsetY, this._relativeSeries.getRegion())\n },\n limitRect,\n dx: this._layoutOffsetX,\n dy: this._layoutOffsetY\n });\n }\n }\n\n protected _initDataView(): void {\n const spec = this._spec as any;\n const { doXYProcess, doPolarProcess, doGeoProcess } = getMarkPointProcessInfo(spec);\n const isCoordinateProcess = isValid(spec.coordinate);\n if (!isCoordinateProcess && !doXYProcess && !doPolarProcess && !doGeoProcess) {\n return;\n }\n\n registerDataSetInstanceTransform(this._option.dataSet, 'markerAggregation', markerAggregation);\n registerDataSetInstanceTransform(this._option.dataSet, 'markerFilter', markerFilter);\n\n const { options } = this._computeOptions();\n\n const data = new DataView(this._option.dataSet, { name: `${this.type}_${this.id}_data` });\n data.parse([this._getRelativeDataView()], {\n type: 'dataview'\n });\n data.transform({\n type: 'markerAggregation',\n options\n });\n\n data.transform({\n type: 'markerFilter',\n options: this._getAllRelativeSeries()\n });\n data.target.on('change', () => {\n this._markerLayout();\n });\n this._markerData = data;\n }\n}\n"]}
|
|
@@ -17,7 +17,8 @@ export interface IItemContent extends IMarkerRef {
|
|
|
17
17
|
customMark?: Partial<IMarkerState<IGroupGraphicAttribute>>;
|
|
18
18
|
}
|
|
19
19
|
export type IItemLine<T extends Partial<IMarkerSymbol> = IMarkerSymbol> = {
|
|
20
|
-
type?: 'type-s' | 'type-do' | 'type-po' | 'type-op';
|
|
20
|
+
type?: 'type-s' | 'type-do' | 'type-po' | 'type-op' | 'type-arc';
|
|
21
|
+
arcRatio?: number;
|
|
21
22
|
visible?: boolean;
|
|
22
23
|
decorativeLine?: {
|
|
23
24
|
visible?: boolean;
|
|
@@ -30,4 +31,9 @@ export type IItemLine<T extends Partial<IMarkerSymbol> = IMarkerSymbol> = {
|
|
|
30
31
|
export interface IMarkPointTheme<T extends Partial<IMarkerSymbol> = Partial<IMarkerSymbol>> {
|
|
31
32
|
itemLine?: IItemLine<T>;
|
|
32
33
|
itemContent?: IItemContent;
|
|
34
|
+
targetSymbol?: {
|
|
35
|
+
offset?: number;
|
|
36
|
+
visible?: boolean;
|
|
37
|
+
size?: number;
|
|
38
|
+
} & Partial<IMarkerState<ISymbolMarkSpec>>;
|
|
33
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/component/marker/mark-point/interface/theme.ts"],"names":[],"mappings":"","file":"theme.js","sourcesContent":["import type { IImageGraphicAttribute, IRichTextGraphicAttribute, IGroupGraphicAttribute } from '@visactor/vrender-core';\nimport type { IMarkPointItemPosition } from '@visactor/vrender-components';\nimport type { ILineMarkSpec, ISymbolMarkSpec } from '../../../../typings';\nimport type { IMarkerLabelSpec, IMarkerRef, IMarkerState, IMarkerSymbol } from '../../interface';\nimport type { IRegion } from 'src/region';\n\nexport type IOffsetCallback = (region: IRegion) => number;\n\nexport interface IItemContent extends IMarkerRef {\n /**\n * 标注类型\n */\n type?: 'symbol' | 'text' | 'image' | 'richText';\n /**\n * 标注内容相对于定位点的位置\n */\n position?: keyof typeof IMarkPointItemPosition;\n /**\n * x 方向偏移量\n */\n offsetX?: number | 'regionRight' | 'regionLeft' | IOffsetCallback;\n /**\n * y 方向偏移量\n */\n offsetY?: number | 'regionTop' | 'regionBottom' | IOffsetCallback;\n /**\n * 是否自动调整 item content 使其展示在 marker 可见区域内。\n * @default false\n * @since 1.8.7\n */\n confine?: boolean;\n /**\n * type为symbol时, symbol的样式\n */\n symbol?: Partial<IMarkerState<ISymbolMarkSpec>>;\n /**\n * type为image时, image的样式\n */\n image?: Partial<IMarkerState<IImageGraphicAttribute>>;\n /**\n * type为text时, text的样式\n * 'text'类型的ItemContent新增三种子类型:'text','rich'。配置在textStyle.type上。\n */\n text?: IMarkerLabelSpec;\n /**\n * type为rich text时, rich text的样式\n */\n richText?: Partial<IMarkerState<IRichTextGraphicAttribute>>;\n /**\n * type为custom时, customMark的样式(目前仅在mapLabel内部逻辑中使用到)\n */\n customMark?: Partial<IMarkerState<IGroupGraphicAttribute>>;\n}\n\nexport type IItemLine<T extends Partial<IMarkerSymbol> = IMarkerSymbol> = {\n /** TODO:'type-opo' */\n /**\n * 引导线类型\n * 'type-s'表示起点和终点直接连线; 'type-do'表示包含一个折点,且折点x坐标为起点到终点的 1/2 x坐标,折点y坐标为起点y坐标;'type-op' 表示包含一个折点,且折点x坐标为起点x坐标,折点y坐标为终点y坐标;'type-po' 表示包含一个折点,且折点x坐标为终点x坐标,折点y坐标为起点y坐标\n * 引导线类型的具体形式参考:https://journals.sagepub.com/doi/10.1177/1473871618799500\n */\n type?: 'type-s' | 'type-do' | 'type-po' | 'type-op';\n /**\n * 引导线可见性\n */\n visible?: boolean;\n /**\n * 垂直于引导线的装饰线,参考案例: https://observablehq.com/@mikelotis/edmonton-population-history-line-chart\n */\n decorativeLine?: {\n /**\n * 装饰线可见性\n */\n visible?: boolean;\n /**\n * 装饰线的长度\n */\n length?: number;\n };\n /**\n * 引导线起点symbol样式\n */\n startSymbol?: T;\n /**\n * 引导线终点symbol样式\n */\n endSymbol?: T;\n /**\n * 引导线样式\n */\n line?: Partial<IMarkerState<Omit<ILineMarkSpec, 'visible'>>>;\n};\n\nexport interface IMarkPointTheme<T extends Partial<IMarkerSymbol> = Partial<IMarkerSymbol>> {\n /**\n * 标注引导线\n */\n itemLine?: IItemLine<T>;\n\n /**\n * 标注内容\n */\n itemContent?: IItemContent;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/component/marker/mark-point/interface/theme.ts"],"names":[],"mappings":"","file":"theme.js","sourcesContent":["import type { IImageGraphicAttribute, IRichTextGraphicAttribute, IGroupGraphicAttribute } from '@visactor/vrender-core';\nimport type { IMarkPointItemPosition } from '@visactor/vrender-components';\nimport type { ILineMarkSpec, ISymbolMarkSpec } from '../../../../typings';\nimport type { IMarkerLabelSpec, IMarkerRef, IMarkerState, IMarkerSymbol } from '../../interface';\nimport type { IRegion } from 'src/region';\n\nexport type IOffsetCallback = (region: IRegion) => number;\n\nexport interface IItemContent extends IMarkerRef {\n /**\n * 标注类型\n */\n type?: 'symbol' | 'text' | 'image' | 'richText';\n /**\n * 标注内容相对于定位点的位置\n */\n position?: keyof typeof IMarkPointItemPosition;\n /**\n * x 方向偏移量\n */\n offsetX?: number | 'regionRight' | 'regionLeft' | IOffsetCallback;\n /**\n * y 方向偏移量\n */\n offsetY?: number | 'regionTop' | 'regionBottom' | IOffsetCallback;\n /**\n * 是否自动调整 item content 使其展示在 marker 可见区域内。\n * @default false\n * @since 1.8.7\n */\n confine?: boolean;\n /**\n * type为symbol时, symbol的样式\n */\n symbol?: Partial<IMarkerState<ISymbolMarkSpec>>;\n /**\n * type为image时, image的样式\n */\n image?: Partial<IMarkerState<IImageGraphicAttribute>>;\n /**\n * type为text时, text的样式\n * 'text'类型的ItemContent新增三种子类型:'text','rich'。配置在textStyle.type上。\n */\n text?: IMarkerLabelSpec;\n /**\n * type为rich text时, rich text的样式\n */\n richText?: Partial<IMarkerState<IRichTextGraphicAttribute>>;\n /**\n * type为custom时, customMark的样式(目前仅在mapLabel内部逻辑中使用到)\n */\n customMark?: Partial<IMarkerState<IGroupGraphicAttribute>>;\n}\n\nexport type IItemLine<T extends Partial<IMarkerSymbol> = IMarkerSymbol> = {\n /** TODO:'type-opo' */\n /**\n * 引导线类型\n * 'type-s'表示起点和终点直接连线; 'type-do'表示包含一个折点,且折点x坐标为起点到终点的 1/2 x坐标,折点y坐标为起点y坐标;'type-op' 表示包含一个折点,且折点x坐标为起点x坐标,折点y坐标为终点y坐标;'type-po' 表示包含一个折点,且折点x坐标为终点x坐标,折点y坐标为起点y坐标\n * 引导线类型的具体形式参考:https://journals.sagepub.com/doi/10.1177/1473871618799500\n */\n type?: 'type-s' | 'type-do' | 'type-po' | 'type-op' | 'type-arc';\n /**\n * 当type为type-arc时生效, 数值决定圆心到终点连线的偏移量, 绝对值越小, 曲率越大, 符号决定法向, 不能等于0\n * @since 1.11.1\n * @default 0.8\n */\n arcRatio?: number;\n /**\n * 引导线可见性\n */\n visible?: boolean;\n /**\n * 垂直于引导线的装饰线,参考案例: https://observablehq.com/@mikelotis/edmonton-population-history-line-chart\n */\n decorativeLine?: {\n /**\n * 装饰线可见性\n */\n visible?: boolean;\n /**\n * 装饰线的长度\n */\n length?: number;\n };\n /**\n * 引导线起点symbol样式\n */\n startSymbol?: T;\n /**\n * 引导线终点symbol样式\n */\n endSymbol?: T;\n /**\n * 引导线样式\n */\n line?: Partial<IMarkerState<Omit<ILineMarkSpec, 'visible'>>>;\n};\n\nexport interface IMarkPointTheme<T extends Partial<IMarkerSymbol> = Partial<IMarkerSymbol>> {\n /**\n * 标注引导线\n */\n itemLine?: IItemLine<T>;\n\n /**\n * 标注内容\n */\n itemContent?: IItemContent;\n /**\n * 被标注的内容\n * @since 1.11.1\n */\n targetSymbol?: {\n /**\n * 被标注内容与标记线间的间隙\n * @default 0\n */\n offset?: number;\n /**\n * 是否显示\n * @default false\n */\n visible?: boolean;\n /**\n * 大小\n * @default 20\n */\n size?: number;\n } & Partial<IMarkerState<ISymbolMarkSpec>>;\n}\n"]}
|
|
@@ -11,7 +11,7 @@ class Player extends base_component_1.BaseComponent {
|
|
|
11
11
|
super(...arguments), this.layoutZIndex = constant_1.LayoutZIndex.Player, this.layoutLevel = constant_1.LayoutLevel.Player,
|
|
12
12
|
this.specKey = "player", this.type = type_1.ComponentTypeEnum.player, this._orient = "bottom",
|
|
13
13
|
this._getPlayerAttrs = () => {
|
|
14
|
-
var _a, _b;
|
|
14
|
+
var _a, _b, _c, _d, _e, _f;
|
|
15
15
|
const type = this._spec.type, layoutAttrs = {
|
|
16
16
|
size: {
|
|
17
17
|
width: this._width,
|
|
@@ -21,9 +21,11 @@ class Player extends base_component_1.BaseComponent {
|
|
|
21
21
|
dy: null !== (_b = this._spec.dy) && void 0 !== _b ? _b : 0 + this._dy
|
|
22
22
|
};
|
|
23
23
|
return "discrete" === type ? Object.assign(Object.assign(Object.assign({}, (0, transform_1.transformDiscreteSpecToAttrs)(this._spec, this._specs)), layoutAttrs), {
|
|
24
|
-
disableTriggerEvent: this._option.disableTriggerEvent
|
|
24
|
+
disableTriggerEvent: this._option.disableTriggerEvent,
|
|
25
|
+
loop: null === (_d = null === (_c = this._spec) || void 0 === _c ? void 0 : _c.loop) || void 0 === _d || _d
|
|
25
26
|
}) : Object.assign(Object.assign(Object.assign({}, (0, transform_1.transformContinuousSpecToAttrs)(this._spec, this._specs)), layoutAttrs), {
|
|
26
|
-
disableTriggerEvent: this._option.disableTriggerEvent
|
|
27
|
+
disableTriggerEvent: this._option.disableTriggerEvent,
|
|
28
|
+
loop: null === (_f = null === (_e = this._spec) || void 0 === _e ? void 0 : _e.loop) || void 0 === _f || _f
|
|
27
29
|
});
|
|
28
30
|
}, this._createOrUpdatePlayerComponent = () => {
|
|
29
31
|
const attrs = Object.assign({}, this._getPlayerAttrs()), container = this.getContainer();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/component/player/player.ts"],"names":[],"mappings":";;;AAAA,kDAA+C;AAK/C,qEAAiG;AAGjG,6CAAkF;AAWlF,4CAAsD;AACtD,2DAAuD;AACvD,iDAAiG;AACjG,2CAA0D;AAC1D,6CAAuE;AAEvE,MAAa,MAAO,SAAQ,8BAAsB;IAAlD;;QACE,iBAAY,GAAW,uBAAY,CAAC,MAAM,CAAC;QAC3C,gBAAW,GAAW,sBAAW,CAAC,MAAM,CAAC;QAGzC,YAAO,GAAW,QAAQ,CAAC;QAG3B,SAAI,GAAG,wBAAiB,CAAC,MAAM,CAAC;QACtB,YAAO,GAAgB,QAAQ,CAAC;QA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AO,CAAC,EAAE;YAC9B,OAAO,CAAC,CAAC;SACV;QAGD,IAAI,IAAI,CAAC,SAAS,KAAK,OAAO,EAAE;YAC9B,OAAO,CAAC,CAAC;SACV;aAEI,IAAI,IAAI,CAAC,SAAS,KAAK,QAAQ,EAAE;YACpC,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;SACzC;QAGD,OAAO,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;IACpC,CAAC;;AAzQH,wBAsZC;AAlZQ,cAAO,GAAG,QAAQ,CAAC;AAGnB,WAAI,GAAG,wBAAiB,CAAC,MAAM,CAAC;AAiZlC,MAAM,cAAc,GAAG,GAAG,EAAE;IACjC,iBAAO,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AACjD,CAAC,CAAC;AAFW,QAAA,cAAc,kBAEzB","file":"player.js","sourcesContent":["import { Factory } from './../../core/factory';\nimport type { INode, IGroup, IGraphic } from '@visactor/vrender-core';\nimport type { ContinuousPlayerAttributes, DiscretePlayerAttributes } from '@visactor/vrender-components';\n\n// eslint-disable-next-line no-duplicate-imports\nimport { DiscretePlayer, ContinuousPlayer, PlayerEventEnum } from '@visactor/vrender-components';\nimport type { Maybe } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { isNumber, array, isEqual, isNil, isValidNumber } from '@visactor/vutils';\n\nimport type { IModelRenderOption, IModelSpecInfo } from '../../model/interface';\nimport type { IRegion } from '../../region/interface';\n\nimport type { DirectionType, IPlayer } from './interface';\n// eslint-disable-next-line no-duplicate-imports\nimport type { IComponent } from '../interface';\nimport type { IPoint, IOrientType, ILayoutRect, IChartSpec, IDataValues } from '../../typings';\n\n// eslint-disable-next-line no-duplicate-imports\nimport { ComponentTypeEnum } from '../interface/type';\nimport { BaseComponent } from '../base/base-component';\nimport { transformContinuousSpecToAttrs, transformDiscreteSpecToAttrs } from './utils/transform';\nimport { isHorizontal, isVertical } from './utils/orient';\nimport { ChartEvent, LayoutLevel, LayoutZIndex } from '../../constant';\n\nexport class Player extends BaseComponent<IPlayer> implements IComponent {\n layoutZIndex: number = LayoutZIndex.Player;\n layoutLevel: number = LayoutLevel.Player;\n\n static specKey = 'player';\n specKey: string = 'player';\n\n static type = ComponentTypeEnum.player;\n type = ComponentTypeEnum.player;\n protected _orient: IOrientType = 'bottom';\n private _specs: Partial<IChartSpec>[];\n\n private _playerComponent: DiscretePlayer | ContinuousPlayer;\n private _cacheAttrs: ContinuousPlayerAttributes | DiscretePlayerAttributes;\n\n private _visible: boolean;\n private _direction: DirectionType;\n private _alternate: boolean;\n private _dx: number;\n private _dy: number;\n private _width: number;\n private _height: number;\n private _position: 'start' | 'middle' | 'end';\n\n get orient() {\n return this._orient;\n }\n\n set layoutOrient(v: IOrientType) {\n this._orient = v;\n }\n\n static getSpecInfo(chartSpec: any): Maybe<IModelSpecInfo[]> {\n const playerSpec = chartSpec[this.specKey];\n if (isNil(playerSpec)) {\n return null;\n }\n return [\n {\n spec: playerSpec,\n specPath: [this.specKey],\n specInfoPath: ['component', this.specKey, 0],\n type: ComponentTypeEnum.player\n }\n ];\n }\n\n /**\n * 设置Attr\n */\n setAttrFromSpec() {\n super.setAttrFromSpec();\n this._orient = this._spec.orient ?? 'bottom';\n this._specs = this._spec.specs ?? [];\n this._direction = this._spec.direction ?? 'default';\n this._alternate = this._spec.alternate ?? false;\n this._dx = this._spec.dx ?? 0;\n this._dy = this._spec.dy ?? 0;\n this._position = this._spec.position ?? 'middle';\n this._visible = this._spec.visible ?? true;\n }\n\n /**\n * 计算组件位置(布局的左上角起点)\n * @param pos\n */\n afterSetLayoutStartPoint(pos: IPoint) {\n super.afterSetLayoutStartPoint(pos);\n if (isValidNumber(pos.x)) {\n const offsetX = isVertical(this._orient) ? pos.x + this._sliderExceededSize() / 2 : pos.x;\n this._playerComponent && this._playerComponent.setAttribute('x', offsetX);\n }\n if (isValidNumber(pos.y)) {\n const offsetY = isHorizontal(this._orient) ? pos.y + this._sliderExceededSize() / 2 : pos.y;\n this._playerComponent && this._playerComponent.setAttribute('y', offsetY);\n }\n }\n\n /**\n * 计算组件占用的bound box\n * @param rect\n * @returns\n */\n getBoundsInRect(rect: ILayoutRect, fullSpace: ILayoutRect) {\n this._width = this._computeWidth(rect);\n this._height = this._computeHeight(rect);\n this._dx = this._computeDx(fullSpace);\n this._dy = this._computeDy(fullSpace);\n\n const bounds = this._computeLayoutRect(rect, this._width, this._height);\n\n this._createOrUpdatePlayerComponent();\n\n return bounds;\n }\n\n changeRegions(regions: IRegion[]): void {\n // do nothing\n }\n\n onRender(ctx: IModelRenderOption): void {\n // do nothing\n }\n\n protected _getNeedClearVRenderComponents(): IGraphic[] {\n return [this._playerComponent] as unknown as IGroup[];\n }\n\n /**\n * 播放器属性\n */\n private _getPlayerAttrs = () => {\n const type = this._spec.type;\n const layoutAttrs = {\n size: {\n width: this._width,\n height: this._height\n },\n dx: this._spec.dx ?? 0 + this._dx,\n dy: this._spec.dy ?? 0 + this._dy\n };\n // 离散类型Attrs\n if (type === 'discrete') {\n return {\n ...transformDiscreteSpecToAttrs(this._spec, this._specs),\n ...layoutAttrs,\n disableTriggerEvent: this._option.disableTriggerEvent\n };\n }\n // 连续类型Attrs\n return {\n ...transformContinuousSpecToAttrs(this._spec, this._specs),\n ...layoutAttrs,\n disableTriggerEvent: this._option.disableTriggerEvent\n };\n };\n\n /**\n * 创建或更新播放器组件\n */\n private _createOrUpdatePlayerComponent = () => {\n const attrs = { ...this._getPlayerAttrs() };\n const container = this.getContainer();\n if (this._playerComponent) {\n if (!isEqual(attrs, this._cacheAttrs)) {\n this._cacheAttrs = attrs;\n this._playerComponent.setAttributes(attrs);\n // FIXME: player 组件没有重写 setAttributes 方法,因此不能正常更新样式。以下两句模拟执行了 setAttributes 方法,但是应在 vrender-component 的后续版本中实现 setAttributes 方法\n this._playerComponent._initAttributes();\n this._playerComponent.render();\n }\n } else {\n if (attrs.type === 'discrete') {\n this._playerComponent = new DiscretePlayer(attrs);\n } else {\n this._playerComponent = new ContinuousPlayer(attrs);\n }\n\n this._cacheAttrs = attrs;\n this._playerComponent.name = `player`;\n\n container.add(this._playerComponent as unknown as INode);\n\n this._initEvent();\n }\n };\n\n /**\n * 计算起点\n */\n private _computeLayoutRect(rect: ILayoutRect, width: number, height: number) {\n // don't set bounds when player hidden\n if (this._visible === false) {\n return { x1: 0, x2: 0, y1: 0, y2: 0 };\n }\n // set bounds by 4 kinds of orient\n switch (this._orient) {\n case 'top': {\n return { x1: 0, y1: 0, x2: width, y2: height };\n }\n case 'right': {\n return { x1: rect.width - width, y1: 0, x2: rect.width, y2: rect.height };\n }\n case 'left': {\n return { x1: 0, y1: 0, x2: width, y2: height };\n }\n case 'bottom':\n default: {\n return { x1: 0, y1: rect.height - height, x2: rect.width, y2: rect.height };\n }\n }\n }\n\n /**\n * 计算组件宽度\n */\n private _computeWidth(rect: ILayoutRect) {\n // 若设置的是数值则直接返回\n if (isNumber(this._spec.width)) {\n return Math.min(rect.width, Number(this._spec.width));\n }\n\n if (isVertical(this._orient)) {\n return this._maxSize();\n }\n return rect.width;\n }\n\n /**\n * 计算组件高度\n */\n private _computeHeight(rect: ILayoutRect) {\n // 若设置的是数值则直接返回\n if (isNumber(this._spec.height)) {\n this._height = this._spec.height;\n return Math.min(rect.height, Number(this._spec.height));\n }\n\n if (isHorizontal(this._orient)) {\n return this._maxSize();\n }\n return rect.height;\n }\n\n /**\n * 计算x方向的偏移, 用于实现对齐\n */\n private _computeDx(rect: ILayoutRect) {\n // 垂直时, x不偏移\n if (isVertical(this._orient)) {\n return 0;\n }\n\n // start\n if (this._position === 'start') {\n return 0;\n }\n // middle\n else if (this._position === 'middle') {\n return (rect.width - this._width) / 2;\n }\n // end\n return rect.width - this._width;\n }\n\n /**\n * 计算y方向的偏移, 用于实现对齐\n */\n private _computeDy(rect: ILayoutRect) {\n // 水平时, y不偏移\n if (isHorizontal(this._orient)) {\n return 0;\n }\n\n // start\n if (this._position === 'start') {\n return 0;\n }\n // middle\n else if (this._position === 'middle') {\n return (rect.height - this._height) / 2;\n }\n\n // end\n return rect.height - this._height;\n }\n\n /**\n * 播放器宽度取计算子组件中最高的一个\n */\n private _maxSize = () => {\n return Math.max(\n ...array(this._spec.controller.start?.style?.size),\n ...array(this._spec.controller.pause?.style?.size),\n ...array(this._spec.controller.backward?.style?.size),\n ...array(this._spec.controller.forward?.style?.size),\n (isVertical(this._orient) ? this._spec.slider.railStyle.width : this._spec.slider.railStyle.height) ?? 10\n );\n };\n\n /**\n * 滑动条超过按钮的高度\n */\n private _sliderExceededSize = () => {\n const sliderHeight =\n (isVertical(this._orient) ? this._spec.slider.railStyle.width : this._spec.slider.railStyle.height) ?? 10;\n const controllersHeight = Math.max(\n ...array(this._spec.controller.start?.style?.size),\n ...array(this._spec.controller.pause?.style?.size),\n ...array(this._spec.controller.backward?.style?.size),\n ...array(this._spec.controller.forward?.style?.size)\n );\n if (sliderHeight >= controllersHeight) {\n return sliderHeight - controllersHeight;\n }\n return 0;\n };\n\n /**\n * 事件\n */\n private _initEvent = () => {\n if (this._option.disableTriggerEvent) {\n return;\n }\n // 自动播放\n this._option.globalInstance.on(ChartEvent.rendered, () => {\n if (this._spec?.auto) {\n this._playerComponent.play();\n }\n });\n\n // 循环播放 与 交替方向\n this._playerComponent.addEventListener(PlayerEventEnum.end, () => {\n this.event.emit(ChartEvent.playerEnd, { model: this });\n\n // 交替方向, 仅离散轴支持\n if (this._alternate && this._spec.type === 'discrete') {\n this._direction = this._direction === 'default' ? 'reverse' : 'default';\n this._playerComponent.setAttributes({\n direction: this._direction,\n dataIndex: this._direction === 'reverse' ? this._specs.length - 2 : 1\n });\n }\n\n // 循环播放\n if (this._spec?.loop) {\n this._playerComponent.play();\n }\n });\n\n // 数据更新\n this._playerComponent.addEventListener(PlayerEventEnum.change, (e: { detail: { index: number } }) => {\n // 更新data\n const { index } = e.detail;\n const spec = this._specs[index];\n (array(spec.data) as IDataValues[]).forEach(data => {\n this._option?.globalInstance?.updateData(data.id, data.values);\n });\n\n this.event.emit(ChartEvent.playerChange, {\n model: this,\n value: {\n spec: spec,\n index: index,\n specs: this._specs\n }\n });\n });\n\n // 后退\n this._playerComponent.addEventListener(PlayerEventEnum.backward, (e: { detail: { index: number } }) => {\n const { index } = e.detail;\n const spec = this._specs[index];\n this.event.emit(ChartEvent.playerBackward, {\n model: this,\n value: {\n spec: spec,\n index: index,\n specs: this._specs\n }\n });\n });\n\n // 前进\n this._playerComponent.addEventListener(PlayerEventEnum.forward, (e: { detail: { index: number } }) => {\n const { index } = e.detail;\n const spec = this._specs[index];\n this.event.emit(ChartEvent.playerForward, {\n model: this,\n value: {\n spec: spec,\n index: index,\n specs: this._specs\n }\n });\n });\n\n // 播放\n this._playerComponent.addEventListener(PlayerEventEnum.play, (e: { detail: { index: number } }) => {\n const { index } = e.detail;\n const spec = this._specs[index];\n this.event.emit(ChartEvent.playerPlay, {\n model: this,\n value: {\n spec: spec,\n index: index,\n specs: this._specs\n }\n });\n });\n\n // 暂停\n this._playerComponent.addEventListener(PlayerEventEnum.pause, (e: { detail: { index: number } }) => {\n const { index } = e.detail;\n const spec = this._specs[index];\n this.event.emit(ChartEvent.playerPause, {\n model: this,\n value: {\n spec: spec,\n index: index,\n specs: this._specs\n }\n });\n });\n };\n}\n\nexport const registerPlayer = () => {\n Factory.registerComponent(Player.type, Player);\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/component/player/player.ts"],"names":[],"mappings":";;;AAAA,kDAA+C;AAK/C,qEAAiG;AAGjG,6CAAkF;AAWlF,4CAAsD;AACtD,2DAAuD;AACvD,iDAAiG;AACjG,2CAA0D;AAC1D,6CAAuE;AAEvE,MAAa,MAAO,SAAQ,8BAAsB;IAAlD;;QACE,iBAAY,GAAW,uBAAY,CAAC,MAAM,CAAC;QAC3C,gBAAW,GAAW,sBAAW,CAAC,MAAM,CAAC;QAGzC,YAAO,GAAW,QA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AQ,EAAE;YACpC,OAAO,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;SACvC;QAED,OAAO,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;IAClC,CAAC;IAKO,UAAU,CAAC,IAAiB;QAElC,IAAI,IAAA,qBAAY,EAAC,IAAI,CAAC,OAAO,CAAC,EAAE;YAC9B,OAAO,CAAC,CAAC;SACV;QAGD,IAAI,IAAI,CAAC,SAAS,KAAK,OAAO,EAAE;YAC9B,OAAO,CAAC,CAAC;SACV;aAEI,IAAI,IAAI,CAAC,SAAS,KAAK,QAAQ,EAAE;YACpC,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;SACzC;QAGD,OAAO,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;IACpC,CAAC;;AA3QH,wBAwZC;AApZQ,cAAO,GAAG,QAAQ,CAAC;AAGnB,WAAI,GAAG,wBAAiB,CAAC,MAAM,CAAC;AAmZlC,MAAM,cAAc,GAAG,GAAG,EAAE;IACjC,iBAAO,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AACjD,CAAC,CAAC;AAFW,QAAA,cAAc,kBAEzB","file":"player.js","sourcesContent":["import { Factory } from './../../core/factory';\nimport type { INode, IGroup, IGraphic } from '@visactor/vrender-core';\nimport type { ContinuousPlayerAttributes, DiscretePlayerAttributes } from '@visactor/vrender-components';\n\n// eslint-disable-next-line no-duplicate-imports\nimport { DiscretePlayer, ContinuousPlayer, PlayerEventEnum } from '@visactor/vrender-components';\nimport type { Maybe } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { isNumber, array, isEqual, isNil, isValidNumber } from '@visactor/vutils';\n\nimport type { IModelRenderOption, IModelSpecInfo } from '../../model/interface';\nimport type { IRegion } from '../../region/interface';\n\nimport type { DirectionType, IPlayer } from './interface';\n// eslint-disable-next-line no-duplicate-imports\nimport type { IComponent } from '../interface';\nimport type { IPoint, IOrientType, ILayoutRect, IChartSpec, IDataValues } from '../../typings';\n\n// eslint-disable-next-line no-duplicate-imports\nimport { ComponentTypeEnum } from '../interface/type';\nimport { BaseComponent } from '../base/base-component';\nimport { transformContinuousSpecToAttrs, transformDiscreteSpecToAttrs } from './utils/transform';\nimport { isHorizontal, isVertical } from './utils/orient';\nimport { ChartEvent, LayoutLevel, LayoutZIndex } from '../../constant';\n\nexport class Player extends BaseComponent<IPlayer> implements IComponent {\n layoutZIndex: number = LayoutZIndex.Player;\n layoutLevel: number = LayoutLevel.Player;\n\n static specKey = 'player';\n specKey: string = 'player';\n\n static type = ComponentTypeEnum.player;\n type = ComponentTypeEnum.player;\n protected _orient: IOrientType = 'bottom';\n private _specs: Partial<IChartSpec>[];\n\n private _playerComponent: DiscretePlayer | ContinuousPlayer;\n private _cacheAttrs: ContinuousPlayerAttributes | DiscretePlayerAttributes;\n\n private _visible: boolean;\n private _direction: DirectionType;\n private _alternate: boolean;\n private _dx: number;\n private _dy: number;\n private _width: number;\n private _height: number;\n private _position: 'start' | 'middle' | 'end';\n\n get orient() {\n return this._orient;\n }\n\n set layoutOrient(v: IOrientType) {\n this._orient = v;\n }\n\n static getSpecInfo(chartSpec: any): Maybe<IModelSpecInfo[]> {\n const playerSpec = chartSpec[this.specKey];\n if (isNil(playerSpec)) {\n return null;\n }\n return [\n {\n spec: playerSpec,\n specPath: [this.specKey],\n specInfoPath: ['component', this.specKey, 0],\n type: ComponentTypeEnum.player\n }\n ];\n }\n\n /**\n * 设置Attr\n */\n setAttrFromSpec() {\n super.setAttrFromSpec();\n this._orient = this._spec.orient ?? 'bottom';\n this._specs = this._spec.specs ?? [];\n this._direction = this._spec.direction ?? 'default';\n this._alternate = this._spec.alternate ?? false;\n this._dx = this._spec.dx ?? 0;\n this._dy = this._spec.dy ?? 0;\n this._position = this._spec.position ?? 'middle';\n this._visible = this._spec.visible ?? true;\n }\n\n /**\n * 计算组件位置(布局的左上角起点)\n * @param pos\n */\n afterSetLayoutStartPoint(pos: IPoint) {\n super.afterSetLayoutStartPoint(pos);\n if (isValidNumber(pos.x)) {\n const offsetX = isVertical(this._orient) ? pos.x + this._sliderExceededSize() / 2 : pos.x;\n this._playerComponent && this._playerComponent.setAttribute('x', offsetX);\n }\n if (isValidNumber(pos.y)) {\n const offsetY = isHorizontal(this._orient) ? pos.y + this._sliderExceededSize() / 2 : pos.y;\n this._playerComponent && this._playerComponent.setAttribute('y', offsetY);\n }\n }\n\n /**\n * 计算组件占用的bound box\n * @param rect\n * @returns\n */\n getBoundsInRect(rect: ILayoutRect, fullSpace: ILayoutRect) {\n this._width = this._computeWidth(rect);\n this._height = this._computeHeight(rect);\n this._dx = this._computeDx(fullSpace);\n this._dy = this._computeDy(fullSpace);\n\n const bounds = this._computeLayoutRect(rect, this._width, this._height);\n\n this._createOrUpdatePlayerComponent();\n\n return bounds;\n }\n\n changeRegions(regions: IRegion[]): void {\n // do nothing\n }\n\n onRender(ctx: IModelRenderOption): void {\n // do nothing\n }\n\n protected _getNeedClearVRenderComponents(): IGraphic[] {\n return [this._playerComponent] as unknown as IGroup[];\n }\n\n /**\n * 播放器属性\n */\n private _getPlayerAttrs = () => {\n const type = this._spec.type;\n const layoutAttrs = {\n size: {\n width: this._width,\n height: this._height\n },\n dx: this._spec.dx ?? 0 + this._dx,\n dy: this._spec.dy ?? 0 + this._dy\n };\n // 离散类型Attrs\n if (type === 'discrete') {\n return {\n ...transformDiscreteSpecToAttrs(this._spec, this._specs),\n ...layoutAttrs,\n disableTriggerEvent: this._option.disableTriggerEvent,\n loop: this._spec?.loop ?? true\n };\n }\n // 连续类型Attrs\n return {\n ...transformContinuousSpecToAttrs(this._spec, this._specs),\n ...layoutAttrs,\n disableTriggerEvent: this._option.disableTriggerEvent,\n loop: this._spec?.loop ?? true\n };\n };\n\n /**\n * 创建或更新播放器组件\n */\n private _createOrUpdatePlayerComponent = () => {\n const attrs = { ...this._getPlayerAttrs() };\n const container = this.getContainer();\n if (this._playerComponent) {\n if (!isEqual(attrs, this._cacheAttrs)) {\n this._cacheAttrs = attrs;\n this._playerComponent.setAttributes(attrs);\n // FIXME: player 组件没有重写 setAttributes 方法,因此不能正常更新样式。以下两句模拟执行了 setAttributes 方法,但是应在 vrender-component 的后续版本中实现 setAttributes 方法\n this._playerComponent._initAttributes();\n this._playerComponent.render();\n }\n } else {\n if (attrs.type === 'discrete') {\n this._playerComponent = new DiscretePlayer(attrs);\n } else {\n this._playerComponent = new ContinuousPlayer(attrs);\n }\n\n this._cacheAttrs = attrs;\n this._playerComponent.name = `player`;\n\n container.add(this._playerComponent as unknown as INode);\n\n this._initEvent();\n }\n };\n\n /**\n * 计算起点\n */\n private _computeLayoutRect(rect: ILayoutRect, width: number, height: number) {\n // don't set bounds when player hidden\n if (this._visible === false) {\n return { x1: 0, x2: 0, y1: 0, y2: 0 };\n }\n // set bounds by 4 kinds of orient\n switch (this._orient) {\n case 'top': {\n return { x1: 0, y1: 0, x2: width, y2: height };\n }\n case 'right': {\n return { x1: rect.width - width, y1: 0, x2: rect.width, y2: rect.height };\n }\n case 'left': {\n return { x1: 0, y1: 0, x2: width, y2: height };\n }\n case 'bottom':\n default: {\n return { x1: 0, y1: rect.height - height, x2: rect.width, y2: rect.height };\n }\n }\n }\n\n /**\n * 计算组件宽度\n */\n private _computeWidth(rect: ILayoutRect) {\n // 若设置的是数值则直接返回\n if (isNumber(this._spec.width)) {\n return Math.min(rect.width, Number(this._spec.width));\n }\n\n if (isVertical(this._orient)) {\n return this._maxSize();\n }\n return rect.width;\n }\n\n /**\n * 计算组件高度\n */\n private _computeHeight(rect: ILayoutRect) {\n // 若设置的是数值则直接返回\n if (isNumber(this._spec.height)) {\n this._height = this._spec.height;\n return Math.min(rect.height, Number(this._spec.height));\n }\n\n if (isHorizontal(this._orient)) {\n return this._maxSize();\n }\n return rect.height;\n }\n\n /**\n * 计算x方向的偏移, 用于实现对齐\n */\n private _computeDx(rect: ILayoutRect) {\n // 垂直时, x不偏移\n if (isVertical(this._orient)) {\n return 0;\n }\n\n // start\n if (this._position === 'start') {\n return 0;\n }\n // middle\n else if (this._position === 'middle') {\n return (rect.width - this._width) / 2;\n }\n // end\n return rect.width - this._width;\n }\n\n /**\n * 计算y方向的偏移, 用于实现对齐\n */\n private _computeDy(rect: ILayoutRect) {\n // 水平时, y不偏移\n if (isHorizontal(this._orient)) {\n return 0;\n }\n\n // start\n if (this._position === 'start') {\n return 0;\n }\n // middle\n else if (this._position === 'middle') {\n return (rect.height - this._height) / 2;\n }\n\n // end\n return rect.height - this._height;\n }\n\n /**\n * 播放器宽度取计算子组件中最高的一个\n */\n private _maxSize = () => {\n return Math.max(\n ...array(this._spec.controller.start?.style?.size),\n ...array(this._spec.controller.pause?.style?.size),\n ...array(this._spec.controller.backward?.style?.size),\n ...array(this._spec.controller.forward?.style?.size),\n (isVertical(this._orient) ? this._spec.slider.railStyle.width : this._spec.slider.railStyle.height) ?? 10\n );\n };\n\n /**\n * 滑动条超过按钮的高度\n */\n private _sliderExceededSize = () => {\n const sliderHeight =\n (isVertical(this._orient) ? this._spec.slider.railStyle.width : this._spec.slider.railStyle.height) ?? 10;\n const controllersHeight = Math.max(\n ...array(this._spec.controller.start?.style?.size),\n ...array(this._spec.controller.pause?.style?.size),\n ...array(this._spec.controller.backward?.style?.size),\n ...array(this._spec.controller.forward?.style?.size)\n );\n if (sliderHeight >= controllersHeight) {\n return sliderHeight - controllersHeight;\n }\n return 0;\n };\n\n /**\n * 事件\n */\n private _initEvent = () => {\n if (this._option.disableTriggerEvent) {\n return;\n }\n // 自动播放\n this._option.globalInstance.on(ChartEvent.rendered, () => {\n if (this._spec?.auto) {\n this._playerComponent.play();\n }\n });\n\n // 循环播放 与 交替方向\n this._playerComponent.addEventListener(PlayerEventEnum.end, () => {\n this.event.emit(ChartEvent.playerEnd, { model: this });\n\n // 交替方向, 仅离散轴支持\n if (this._alternate && this._spec.type === 'discrete') {\n this._direction = this._direction === 'default' ? 'reverse' : 'default';\n this._playerComponent.setAttributes({\n direction: this._direction,\n dataIndex: this._direction === 'reverse' ? this._specs.length - 2 : 1\n });\n }\n\n // 循环播放\n if (this._spec?.loop) {\n this._playerComponent.play();\n }\n });\n\n // 数据更新\n this._playerComponent.addEventListener(PlayerEventEnum.change, (e: { detail: { index: number } }) => {\n // 更新data\n const { index } = e.detail;\n const spec = this._specs[index];\n (array(spec.data) as IDataValues[]).forEach(data => {\n this._option?.globalInstance?.updateData(data.id, data.values);\n });\n\n this.event.emit(ChartEvent.playerChange, {\n model: this,\n value: {\n spec: spec,\n index: index,\n specs: this._specs\n }\n });\n });\n\n // 后退\n this._playerComponent.addEventListener(PlayerEventEnum.backward, (e: { detail: { index: number } }) => {\n const { index } = e.detail;\n const spec = this._specs[index];\n this.event.emit(ChartEvent.playerBackward, {\n model: this,\n value: {\n spec: spec,\n index: index,\n specs: this._specs\n }\n });\n });\n\n // 前进\n this._playerComponent.addEventListener(PlayerEventEnum.forward, (e: { detail: { index: number } }) => {\n const { index } = e.detail;\n const spec = this._specs[index];\n this.event.emit(ChartEvent.playerForward, {\n model: this,\n value: {\n spec: spec,\n index: index,\n specs: this._specs\n }\n });\n });\n\n // 播放\n this._playerComponent.addEventListener(PlayerEventEnum.play, (e: { detail: { index: number } }) => {\n const { index } = e.detail;\n const spec = this._specs[index];\n this.event.emit(ChartEvent.playerPlay, {\n model: this,\n value: {\n spec: spec,\n index: index,\n specs: this._specs\n }\n });\n });\n\n // 暂停\n this._playerComponent.addEventListener(PlayerEventEnum.pause, (e: { detail: { index: number } }) => {\n const { index } = e.detail;\n const spec = this._specs[index];\n this.event.emit(ChartEvent.playerPause, {\n model: this,\n value: {\n spec: spec,\n index: index,\n specs: this._specs\n }\n });\n });\n };\n}\n\nexport const registerPlayer = () => {\n Factory.registerComponent(Player.type, Player);\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.2-alpha.0";
|
|
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.2-alpha.0", __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,gBAAgB,CAAC;AAMxC,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,gBAAgB,CAAC;AAMxC,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.2-alpha.0\";\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
|
@@ -186,7 +186,7 @@ export declare class VChart implements IVChart {
|
|
|
186
186
|
setRuntimeSpec(spec: any): void;
|
|
187
187
|
private _initChartPlugin;
|
|
188
188
|
private _chartPluginApply;
|
|
189
|
-
protected _getMode(): (typeof RenderModeEnum)["desktop-browser"] | "desktop-browser" | "mobile-browser" | "node" | "worker" | "miniApp" | "wx" | "tt" | "desktop-miniApp" | "lynx";
|
|
189
|
+
protected _getMode(): (typeof RenderModeEnum)["desktop-browser"] | "desktop-browser" | "mobile-browser" | "node" | "worker" | "miniApp" | "wx" | "tt" | "harmony" | "desktop-miniApp" | "lynx";
|
|
190
190
|
protected _getChartOption(type: string): IChartOption;
|
|
191
191
|
}
|
|
192
192
|
export declare const registerVChartCore: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/data/transforms/sankey.ts"],"names":[],"mappings":";;;AACA,+DAAyD;AACzD,
|
|
1
|
+
{"version":3,"sources":["../src/data/transforms/sankey.ts"],"names":[],"mappings":";;;AACA,+DAAyD;AACzD,6CAAkD;AAS3C,MAAM,qBAAqB,GAAG,CAAC,GAAa,EAAE,IAAW,EAAE,KAAa,EAAE,EAAE;IACjF,IAAI,CAAC,OAAO,CAAC,CAAC,GAAQ,EAAE,EAAE;QACxB,IAAI,CAAC,IAAA,cAAK,EAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE;YACtB,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;SACrB;QAED,IAAI,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;YAC3C,IAAA,6BAAqB,EAAC,GAAG,EAAE,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;SACjD;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAVW,QAAA,qBAAqB,yBAUhC;AAEK,MAAM,YAAY,GAAG,CAAC,IAAW,EAAgB,EAAE;;IACxD,IAAI,CAAC,IAAI,IAAI,CAAC,IAAA,gBAAO,EAAC,IAAI,CAAC,EAAE;QAC3B,OAAO,EAAkB,CAAC;KAC3B;IAED,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;QAKnB,MAAM,UAAU,GAAe;YAC7B,KAAK,EAAE,EAAE;YACT,KAAK,EAAE,EAAE;SACV,CAAC;QACF,IAAI,CAAC,OAAO,CAAC,CAAC,KAAU,EAAE,EAAE;YAC1B,IAAI,KAAK,CAAC,EAAE,KAAK,OAAO,IAAI,KAAK,CAAC,EAAE,KAAK,OAAO,EAAE;gBAChD,UAAU,CAAC,KAAK,CAAC,EAAE,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AAE,CAAC;YAE5B,YAAoB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,KAAU,EAAE,EAAE;gBACjD,MAAM,YAAY,GAAQ,EAAE,CAAC;gBAC7B,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE;oBACvB,IAAI,GAAG,KAAK,EAAE,CAAC,WAAW,EAAE;wBAC1B,YAAY,CAAC,MAAM,GAAG,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC;qBAC7C;yBAAM,IAAI,GAAG,KAAK,EAAE,CAAC,WAAW,EAAE;wBACjC,YAAY,CAAC,MAAM,GAAG,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC;qBAC7C;yBAAM,IAAI,GAAG,KAAK,EAAE,CAAC,UAAU,EAAE;wBAChC,YAAY,CAAC,KAAK,GAAG,KAAK,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC;qBAC3C;yBAAM;wBACL,YAAY,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;qBAChC;iBACF;gBACD,WAAW,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACjC,CAAC,CAAC,CAAC;YACF,YAAoB,CAAC,KAAK,GAAG,WAAW,CAAC;SAC3C;KACF;IAED,MAAM,MAAM,GAAG,IAAI,8BAAY,CAAC,EAAE,CAAC,CAAC;IAEpC,MAAM,MAAM,GAAG,EAAE,CAAC;IAElB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC;IAE/C,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAlDW,QAAA,YAAY,gBAkDvB","file":"sankey.js","sourcesContent":["import type { SankeyOptions, SankeyData } from '@visactor/vgrammar-sankey';\nimport { SankeyLayout } from '@visactor/vgrammar-sankey';\nimport { isArray, isNil } from '@visactor/vutils';\n\nexport interface ISankeyOpt extends SankeyOptions {\n targetField: string;\n sourceField: string;\n valueField: string;\n view: () => { x0: number; x1: number; y0: number; y1: number };\n}\n\nexport const collectHierarchyField = (set: Set<any>, data: any[], field: string) => {\n data.forEach((obj: any) => {\n if (!isNil(obj[field])) {\n set.add(obj[field]);\n }\n\n if (obj.children && obj.children.length > 0) {\n collectHierarchyField(set, obj.children, field); // 递归处理子节点\n }\n });\n};\n\nexport const sankeyFormat = (data: any[]): SankeyData[] => {\n if (!data || !isArray(data)) {\n return [] as SankeyData[];\n }\n\n if (data.length > 1) {\n /**\n * data structure for Fengshen:\n * [{id:’nodes’, values:[xxx]},{id:’links’, values:[xxx]}]\n */\n const updateData: SankeyData = {\n links: [],\n nodes: []\n };\n data.forEach((datum: any) => {\n if (datum.id === 'links' || datum.id === 'nodes') {\n updateData[datum.id] = datum.values;\n }\n });\n return [updateData];\n }\n /**\n * data structure:\n * [{nodes: [xxx], links: [xxx]}]\n */\n if (data[0]?.latestData) {\n return data[0].latestData;\n }\n return data;\n};\n\nexport const sankeyLayout = (data: SankeyData[], op: ISankeyOpt) => {\n if (!data || !op?.view || !data.length) {\n return [];\n }\n\n const view = op.view();\n\n if (\n view.x1 - view.x0 === 0 ||\n view.y1 - view.y0 === 0 ||\n view.x1 - view.x0 === -Infinity ||\n view.x1 - view.x0 === Infinity ||\n view.y1 - view.y0 === -Infinity ||\n view.y1 - view.y0 === Infinity\n ) {\n return [];\n }\n\n const originalData = data[0];\n\n if (op.sourceField !== 'source' || op.targetField !== 'target' || op.valueField !== 'value') {\n if ((originalData as any).links) {\n const updatedData: {}[] = [];\n\n (originalData as any).links.forEach((datum: any) => {\n const updatedDatum: any = {};\n for (const key in datum) {\n if (key === op.sourceField) {\n updatedDatum.source = datum[op.sourceField];\n } else if (key === op.targetField) {\n updatedDatum.target = datum[op.targetField];\n } else if (key === op.valueField) {\n updatedDatum.value = datum[op.valueField];\n } else {\n updatedDatum[key] = datum[key];\n }\n }\n updatedData.push(updatedDatum);\n });\n (originalData as any).links = updatedData;\n }\n }\n\n const layout = new SankeyLayout(op);\n\n const result = [];\n\n result.push(layout.layout(originalData, view));\n\n return result;\n};\n"]}
|
package/cjs/env/env.d.ts
CHANGED