@visactor/vchart 2.1.3-alpha.4 → 2.1.3

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.
Files changed (84) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.es.js +140 -49
  3. package/build/index.js +160 -52
  4. package/build/index.min.js +2 -2
  5. package/build/tsconfig.tsbuildinfo +1 -1
  6. package/cjs/chart/index.js +1 -1
  7. package/cjs/chart/stack.js +1 -1
  8. package/cjs/chart/util.js +1 -1
  9. package/cjs/compile/compiler.d.ts +2 -0
  10. package/cjs/compile/compiler.js +23 -8
  11. package/cjs/compile/compiler.js.map +1 -1
  12. package/cjs/compile/interface/compiler.d.ts +1 -0
  13. package/cjs/compile/interface/compiler.js.map +1 -1
  14. package/cjs/compile/state-manager.js +1 -2
  15. package/cjs/component/poptip/index.js +5 -2
  16. package/cjs/component/poptip/index.js.map +1 -1
  17. package/cjs/component/util.js +2 -1
  18. package/cjs/constant/marker.js +1 -2
  19. package/cjs/constant/scroll-bar.js +2 -1
  20. package/cjs/core/factory-registry.d.ts +2 -1
  21. package/cjs/core/factory-registry.js +4 -2
  22. package/cjs/core/factory-registry.js.map +1 -1
  23. package/cjs/core/factory.d.ts +4 -1
  24. package/cjs/core/factory.js +5 -2
  25. package/cjs/core/factory.js.map +1 -1
  26. package/cjs/core/index.d.ts +1 -1
  27. package/cjs/core/index.js +2 -2
  28. package/cjs/core/index.js.map +1 -1
  29. package/cjs/core/vchart.js +9 -3
  30. package/cjs/core/vchart.js.map +1 -1
  31. package/cjs/data/transforms/funnel.js +9 -4
  32. package/cjs/data/transforms/funnel.js.map +1 -1
  33. package/cjs/interaction/interaction.d.ts +2 -0
  34. package/cjs/interaction/interaction.js +19 -11
  35. package/cjs/interaction/interaction.js.map +1 -1
  36. package/cjs/mark/glyph.d.ts +1 -1
  37. package/cjs/mark/glyph.js +7 -6
  38. package/cjs/mark/glyph.js.map +1 -1
  39. package/cjs/series/base/base-series.js +1 -1
  40. package/cjs/series/base/base-series.js.map +1 -1
  41. package/cjs/series/funnel/interface.js.map +1 -1
  42. package/cjs/series/sankey/sankey.d.ts +3 -0
  43. package/cjs/series/sankey/sankey.js +26 -16
  44. package/cjs/series/sankey/sankey.js.map +1 -1
  45. package/esm/chart/index.js +1 -1
  46. package/esm/chart/stack.js +1 -1
  47. package/esm/chart/util.js +1 -1
  48. package/esm/compile/compiler.d.ts +2 -0
  49. package/esm/compile/compiler.js +24 -7
  50. package/esm/compile/compiler.js.map +1 -1
  51. package/esm/compile/interface/compiler.d.ts +1 -0
  52. package/esm/compile/interface/compiler.js.map +1 -1
  53. package/esm/compile/state-manager.js +1 -2
  54. package/esm/component/poptip/index.js +8 -2
  55. package/esm/component/poptip/index.js.map +1 -1
  56. package/esm/component/util.js +2 -1
  57. package/esm/constant/marker.js +1 -2
  58. package/esm/constant/scroll-bar.js +2 -1
  59. package/esm/core/factory-registry.d.ts +2 -1
  60. package/esm/core/factory-registry.js +4 -2
  61. package/esm/core/factory-registry.js.map +1 -1
  62. package/esm/core/factory.d.ts +4 -1
  63. package/esm/core/factory.js +4 -2
  64. package/esm/core/factory.js.map +1 -1
  65. package/esm/core/index.d.ts +1 -1
  66. package/esm/core/index.js +2 -2
  67. package/esm/core/index.js.map +1 -1
  68. package/esm/core/vchart.js +9 -3
  69. package/esm/core/vchart.js.map +1 -1
  70. package/esm/data/transforms/funnel.js +8 -5
  71. package/esm/data/transforms/funnel.js.map +1 -1
  72. package/esm/interaction/interaction.d.ts +2 -0
  73. package/esm/interaction/interaction.js +19 -11
  74. package/esm/interaction/interaction.js.map +1 -1
  75. package/esm/mark/glyph.d.ts +1 -1
  76. package/esm/mark/glyph.js +7 -6
  77. package/esm/mark/glyph.js.map +1 -1
  78. package/esm/series/base/base-series.js +1 -1
  79. package/esm/series/base/base-series.js.map +1 -1
  80. package/esm/series/funnel/interface.js.map +1 -1
  81. package/esm/series/sankey/sankey.d.ts +3 -0
  82. package/esm/series/sankey/sankey.js +26 -15
  83. package/esm/series/sankey/sankey.js.map +1 -1
  84. package/package.json +9 -9
package/build/index.js CHANGED
@@ -14658,12 +14658,12 @@
14658
14658
  cursor: 1,
14659
14659
  html: 1
14660
14660
  };
14661
- class Graphic extends Node {
14661
+ class GraphicImpl extends Node {
14662
14662
  static mixin(source) {
14663
14663
  const keys = Object.keys(source);
14664
14664
  for (let i = 0; i < keys.length; ++i) {
14665
14665
  const propertyName = keys[i];
14666
- Object.defineProperty(Graphic.prototype, propertyName, Object.getOwnPropertyDescriptor(source, propertyName));
14666
+ Object.defineProperty(this.prototype, propertyName, Object.getOwnPropertyDescriptor(source, propertyName));
14667
14667
  }
14668
14668
  }
14669
14669
  get AABBBounds() {
@@ -15902,13 +15902,26 @@
15902
15902
  return null;
15903
15903
  }
15904
15904
  }
15905
+ GraphicImpl.userSymbolMap = {};
15906
+ const GRAPHIC_CLASS_SYMBOL = Symbol.for("@visactor/vrender-core/graphic-class");
15907
+ function createGraphicClassState() {
15908
+ return {
15909
+ Graphic: GraphicImpl
15910
+ };
15911
+ }
15912
+ function getGraphicClassState() {
15913
+ var _a;
15914
+ const globalScope = globalThis;
15915
+ return null !== (_a = globalScope[GRAPHIC_CLASS_SYMBOL]) && void 0 !== _a || (globalScope[GRAPHIC_CLASS_SYMBOL] = createGraphicClassState()), globalScope[GRAPHIC_CLASS_SYMBOL];
15916
+ }
15917
+ const Graphic = getGraphicClassState().Graphic;
15905
15918
  function backgroundNotImage(image) {
15906
15919
  return "string" == typeof image ? !(image.startsWith("<svg") || isValidUrl$1(image) || image.includes("/") || isBase64$1(image)) : !(!image.fill && !image.stroke) || !("string" != typeof image.gradient || !Array.isArray(image.stops));
15907
15920
  }
15908
15921
  function isExternalTexture(texture) {
15909
15922
  return !!texture && ("string" == typeof texture ? !builtinTextureTypes.has(texture) && (texture.startsWith("<svg") || isValidUrl$1(texture) || texture.includes("/") || isBase64$1(texture)) : isObject$2(texture));
15910
15923
  }
15911
- Graphic.userSymbolMap = {}, Graphic.mixin(EventTarget);
15924
+ Graphic.mixin(EventTarget);
15912
15925
 
15913
15926
  const defaultThemeObj = {
15914
15927
  arc: DefaultArcAttribute,
@@ -33399,9 +33412,10 @@
33399
33412
  interactionTriggers: {},
33400
33413
  composedEventMap: {},
33401
33414
  tooltipProcessors: {},
33415
+ runtimePluginInstallers: {},
33402
33416
  formatter: undefined
33403
33417
  });
33404
- const factoryRegistryVersion = "2.1.1";
33418
+ const factoryRegistryVersion = "2.1.3";
33405
33419
  const factoryRegistryKey = Symbol.for(`@visactor/vchart/factory-registry@${factoryRegistryVersion}`);
33406
33420
  const globalFactoryRegistry = globalThis;
33407
33421
  const factoryRegistry = (_a = globalFactoryRegistry[factoryRegistryKey]) !== null && _a !== void 0 ? _a : (globalFactoryRegistry[factoryRegistryKey] = createFactoryRegistry());
@@ -33644,6 +33658,13 @@
33644
33658
  }
33645
33659
  return new Cror(tooltip);
33646
33660
  };
33661
+ Factory._runtimePluginInstallers = factoryRegistry.runtimePluginInstallers;
33662
+ Factory.registerRuntimePluginInstaller = (type, installer) => {
33663
+ Factory._runtimePluginInstallers[type] = installer;
33664
+ };
33665
+ Factory.getRuntimePluginInstaller = (type) => {
33666
+ return Factory._runtimePluginInstallers[type];
33667
+ };
33647
33668
 
33648
33669
  function mergeTheme(target, ...sources) {
33649
33670
  return mergeSpec(transformThemeToMerge(target), ...sources.map(transformThemeToMerge));
@@ -37008,6 +37029,7 @@
37008
37029
  };
37009
37030
  const createStageFromApp = (app, params) => app.createStage(params);
37010
37031
 
37032
+ const POPTIP_FOR_TEXT_PLUGIN_NAME = 'poptipForText';
37011
37033
  class Compiler {
37012
37034
  get stateAnimationConfig() {
37013
37035
  return this._stateAnimationConfig;
@@ -37072,8 +37094,36 @@
37072
37094
  getStage() {
37073
37095
  return this._stage;
37074
37096
  }
37097
+ _dedupeStagePlugin(pluginName) {
37098
+ var _a;
37099
+ const pluginService = (_a = this._stage) === null || _a === void 0 ? void 0 : _a.pluginService;
37100
+ if (!(pluginService === null || pluginService === void 0 ? void 0 : pluginService.findPluginsByName)) {
37101
+ return;
37102
+ }
37103
+ const plugins = pluginService.findPluginsByName(pluginName);
37104
+ if (plugins.length <= 1) {
37105
+ return;
37106
+ }
37107
+ const plugin = plugins[0];
37108
+ if (pluginService.uninstall) {
37109
+ pluginService.uninstall(pluginName);
37110
+ pluginService.register(plugin);
37111
+ }
37112
+ else {
37113
+ plugins.slice(1).forEach(duplicatePlugin => {
37114
+ pluginService.unRegister(duplicatePlugin);
37115
+ });
37116
+ }
37117
+ }
37118
+ _dedupePoptipPlugin() {
37119
+ var _a;
37120
+ if (!((_a = this._option.pluginList) === null || _a === void 0 ? void 0 : _a.includes(POPTIP_FOR_TEXT_PLUGIN_NAME))) {
37121
+ return;
37122
+ }
37123
+ this._dedupeStagePlugin(POPTIP_FOR_TEXT_PLUGIN_NAME);
37124
+ }
37075
37125
  initView() {
37076
- var _a, _b, _c, _d;
37126
+ var _a, _b, _c, _d, _e;
37077
37127
  if (this._released) {
37078
37128
  return;
37079
37129
  }
@@ -37095,22 +37145,24 @@
37095
37145
  modeParams
37096
37146
  });
37097
37147
  this._releaseVRenderAppRef = resolvedApp.releaseAppRef;
37148
+ (_a = this._option.runtimePluginInstallers) === null || _a === void 0 ? void 0 : _a.forEach(install => install(resolvedApp.app));
37098
37149
  try {
37099
- this._stage = createStageFromApp(resolvedApp.app, Object.assign({ background, width: this._width, height: this._height, container: (_a = this._container.dom) !== null && _a !== void 0 ? _a : null, canvas: (_b = this._container.canvas) !== null && _b !== void 0 ? _b : null, dpr, viewBox: this._option.viewBox, canvasControled: this._option.canvasControled, beforeRender: (stage) => {
37150
+ this._stage = createStageFromApp(resolvedApp.app, Object.assign({ background, width: this._width, height: this._height, container: (_b = this._container.dom) !== null && _b !== void 0 ? _b : null, canvas: (_c = this._container.canvas) !== null && _c !== void 0 ? _c : null, dpr, viewBox: this._option.viewBox, canvasControled: this._option.canvasControled, beforeRender: (stage) => {
37100
37151
  var _a, _b, _c;
37101
37152
  (_a = this._compileChart) === null || _a === void 0 ? void 0 : _a.onBeforeRender();
37102
37153
  (_c = (_b = this._option).beforeRender) === null || _c === void 0 ? void 0 : _c.call(_b, stage);
37103
37154
  }, afterRender: this._option.afterRender, disableDirtyBounds: true, autoRender: true, ticker: this._option.ticker, pluginList: this._option.pluginList, enableHtmlAttribute: this._option.enableHtmlAttribute, optimize: this._option.optimize, supportsTouchEvents: this._option.supportsTouchEvents, supportsPointerEvents: this._option.supportsPointerEvents, event: {
37104
37155
  clickInterval: clickInterval,
37105
37156
  autoPreventDefault: autoPreventDefault
37106
- }, ReactDOM: this._option.ReactDOM, autoRefresh: isValid$1(autoRefreshDpr) ? autoRefreshDpr : !isValid$1(dpr) }, ((_c = this._option.renderHooks) !== null && _c !== void 0 ? _c : {})));
37157
+ }, ReactDOM: this._option.ReactDOM, autoRefresh: isValid$1(autoRefreshDpr) ? autoRefreshDpr : !isValid$1(dpr) }, ((_d = this._option.renderHooks) !== null && _d !== void 0 ? _d : {})));
37107
37158
  }
37108
37159
  catch (error) {
37109
- (_d = this._releaseVRenderAppRef) === null || _d === void 0 ? void 0 : _d.call(this);
37160
+ (_e = this._releaseVRenderAppRef) === null || _e === void 0 ? void 0 : _e.call(this);
37110
37161
  this._releaseVRenderAppRef = undefined;
37111
37162
  throw error;
37112
37163
  }
37113
37164
  }
37165
+ this._dedupePoptipPlugin();
37114
37166
  this._stage.enableIncrementalAutoRender();
37115
37167
  this._stage.setTheme({
37116
37168
  symbol: {
@@ -47812,7 +47864,13 @@
47812
47864
  this._updateCurrentTheme();
47813
47865
  this._currentSize = this.getCurrentSize();
47814
47866
  const pluginList = [];
47867
+ const runtimePluginInstallers = [];
47815
47868
  if (poptip !== false) {
47869
+ const poptipInstaller = Factory.getRuntimePluginInstaller('poptipForText');
47870
+ if (poptipInstaller) {
47871
+ poptipInstaller();
47872
+ runtimePluginInstallers.push(poptipInstaller);
47873
+ }
47816
47874
  pluginList.push('poptipForText');
47817
47875
  }
47818
47876
  if (spec.type === "sankey") {
@@ -47830,7 +47888,8 @@
47830
47888
  dom: (_e = this._container) !== null && _e !== void 0 ? _e : 'none',
47831
47889
  canvas: renderCanvas
47832
47890
  }, Object.assign(Object.assign({ mode: this._option.mode, stage,
47833
- pluginList }, restOptions), { background: this._getBackground(), onError: this._onError }));
47891
+ pluginList,
47892
+ runtimePluginInstallers }, restOptions), { background: this._getBackground(), onError: this._onError }));
47834
47893
  this._compiler.setSize(this._currentSize.width, this._currentSize.height);
47835
47894
  this._eventDispatcher = new EventDispatcher(this, this._compiler);
47836
47895
  this._event = new Event$1(this._eventDispatcher, mode);
@@ -49347,7 +49406,7 @@
49347
49406
  });
49348
49407
  };
49349
49408
 
49350
- const version = "2.1.1";
49409
+ const version = "2.1.3";
49351
49410
 
49352
49411
  const addVChartProperty = (data, op) => {
49353
49412
  const context = op.beforeCall();
@@ -51141,6 +51200,7 @@
51141
51200
  this._spec[mark.name] && this.initMarkStyleWithSpec(mark, this._spec[mark.name]);
51142
51201
  });
51143
51202
  this.initMarkStyle();
51203
+ this.initMarkState();
51144
51204
  marks.forEach(mark => {
51145
51205
  mark.commit(false);
51146
51206
  });
@@ -61317,11 +61377,28 @@
61317
61377
  getStatedGraphics(trigger) {
61318
61378
  return this._stateGraphicsByTrigger.get(trigger);
61319
61379
  }
61380
+ _getMarkById(trigger) {
61381
+ const markById = new Map();
61382
+ trigger.getMarks().forEach(mark => {
61383
+ if (mark) {
61384
+ markById.set(mark.id, mark);
61385
+ }
61386
+ });
61387
+ return markById;
61388
+ }
61389
+ _hasAnimationByGraphicState(graphic, markById) {
61390
+ var _a, _b, _c;
61391
+ const mark = (_b = (_a = graphic.parent) === null || _a === void 0 ? void 0 : _a.mark) !== null && _b !== void 0 ? _b : markById.get(graphic.context.markId);
61392
+ return !!((_c = mark === null || mark === void 0 ? void 0 : mark.hasAnimationByState) === null || _c === void 0 ? void 0 : _c.call(mark, 'state'));
61393
+ }
61320
61394
  updateStates(trigger, newStatedGraphics, prevStatedGraphics, state, reverseState) {
61321
61395
  if (this._disableTriggerEvent) {
61322
61396
  return [];
61323
61397
  }
61324
61398
  if (!newStatedGraphics || !newStatedGraphics.length) {
61399
+ if (prevStatedGraphics && prevStatedGraphics.length) {
61400
+ this.clearAllStatesOfTrigger(trigger, state, reverseState);
61401
+ }
61325
61402
  return [];
61326
61403
  }
61327
61404
  if (state && reverseState) {
@@ -61345,42 +61422,36 @@
61345
61422
  }
61346
61423
  toggleReverseStateOfGraphics(trigger, newStatedGraphics, prevStatedGraphics, reverseState) {
61347
61424
  const markIdByState = trigger.getMarkIdByState();
61425
+ const markById = this._getMarkById(trigger);
61348
61426
  prevStatedGraphics.forEach(g => {
61349
- var _a;
61350
61427
  const hasReverse = reverseState && markIdByState[reverseState] && markIdByState[reverseState].includes(g.context.markId);
61351
61428
  if (hasReverse) {
61352
- const m = (_a = g.parent) === null || _a === void 0 ? void 0 : _a.mark;
61353
- const hasAnimation = m.hasAnimationByState && m.hasAnimationByState('state');
61429
+ const hasAnimation = this._hasAnimationByGraphicState(g, markById);
61354
61430
  addGraphicState(g, reverseState, true, hasAnimation);
61355
61431
  }
61356
61432
  });
61357
61433
  newStatedGraphics.forEach(g => {
61358
- var _a;
61359
61434
  const hasReverse = reverseState && markIdByState[reverseState] && markIdByState[reverseState].includes(g.context.markId);
61360
61435
  if (hasReverse) {
61361
- const m = (_a = g.parent) === null || _a === void 0 ? void 0 : _a.mark;
61362
- const hasAnimation = m.hasAnimationByState && m.hasAnimationByState('state');
61436
+ const hasAnimation = this._hasAnimationByGraphicState(g, markById);
61363
61437
  removeGraphicState(g, reverseState, hasAnimation);
61364
61438
  }
61365
61439
  });
61366
61440
  }
61367
61441
  toggleStateOfGraphics(trigger, newStatedGraphics, prevStatedGraphics, state) {
61368
61442
  const markIdByState = trigger.getMarkIdByState();
61443
+ const markById = this._getMarkById(trigger);
61369
61444
  prevStatedGraphics.forEach(g => {
61370
- var _a;
61371
61445
  const hasState = state && markIdByState[state] && markIdByState[state].includes(g.context.markId);
61372
61446
  if (hasState) {
61373
- const m = (_a = g.parent) === null || _a === void 0 ? void 0 : _a.mark;
61374
- const hasAnimation = m.hasAnimationByState && m.hasAnimationByState('state');
61447
+ const hasAnimation = this._hasAnimationByGraphicState(g, markById);
61375
61448
  removeGraphicState(g, state, hasAnimation);
61376
61449
  }
61377
61450
  });
61378
61451
  newStatedGraphics.forEach(g => {
61379
- var _a;
61380
61452
  const hasState = state && markIdByState[state] && markIdByState[state].includes(g.context.markId);
61381
61453
  if (hasState) {
61382
- const m = (_a = g.parent) === null || _a === void 0 ? void 0 : _a.mark;
61383
- const hasAnimation = m.hasAnimationByState && m.hasAnimationByState('state');
61454
+ const hasAnimation = this._hasAnimationByGraphicState(g, markById);
61384
61455
  addGraphicState(g, state, true, hasAnimation);
61385
61456
  }
61386
61457
  });
@@ -65463,6 +65534,10 @@
65463
65534
  function bindPoptip(container) {
65464
65535
  container.isBound(PopTipRenderContribution) || (container.bind(PopTipRenderContribution).toSelf().inSingletonScope(), container.bind(InteractiveSubRenderContribution).toService(PopTipRenderContribution)), container.isBound(PopTipPlugin) || (container.bind(PopTipPlugin).toSelf(), container.bind(AutoEnablePlugins).toService(PopTipPlugin)), container.isBound(PopTipForClipedTextPlugin) || (container.bind(PopTipForClipedTextPlugin).toSelf(), container.bind(AutoEnablePlugins).toService(PopTipForClipedTextPlugin));
65465
65536
  }
65537
+ function installPoptipToApp(app) {
65538
+ if (!app) throw new Error("installPoptipToApp requires an app instance");
65539
+ configureRuntimeApplicationForApp(app), bindPoptip(getRuntimeInstallerBindingContext()), refreshRuntimeInstallerContributions(), installRuntimeGraphicRenderersToApp(app);
65540
+ }
65466
65541
  function loadPoptip() {
65467
65542
  bindPoptip(getLegacyBindingContext()), bindPoptip(getRuntimeInstallerBindingContext()), refreshRuntimeInstallerContributions();
65468
65543
  }
@@ -77930,7 +78005,7 @@
77930
78005
  class GlyphMark extends BaseMark {
77931
78006
  constructor() {
77932
78007
  super(...arguments);
77933
- this._setStateOfGraphic = (g) => {
78008
+ this._setStateOfGraphic = (g, hasAnimation) => {
77934
78009
  g.clearStates();
77935
78010
  if (g.context.diffState === DiffState.enter || g.context.diffState === DiffState.update) {
77936
78011
  g.glyphStateProxy = (stateName, nexStates) => {
@@ -77946,7 +78021,7 @@
77946
78021
  }
77947
78022
  return glyphAttrs;
77948
78023
  };
77949
- g.useStates(g.context.states);
78024
+ g.useStates(g.context.states, hasAnimation);
77950
78025
  }
77951
78026
  };
77952
78027
  }
@@ -78025,12 +78100,13 @@
78025
78100
  _createGraphic(attrs = {}) {
78026
78101
  const glyph = createGlyph(attrs);
78027
78102
  glyph.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(glyph);
78028
- glyph.addEventListener('afterAttributeUpdate', (event) => {
78029
- var _a;
78030
- if (((_a = event === null || event === void 0 ? void 0 : event.detail) === null || _a === void 0 ? void 0 : _a.type) === GLYPH_STATE_ATTRIBUTE_UPDATE_TYPE) {
78103
+ const onAttributeUpdate = glyph.onAttributeUpdate.bind(glyph);
78104
+ glyph.onAttributeUpdate = (context) => {
78105
+ onAttributeUpdate(context);
78106
+ if ((context === null || context === void 0 ? void 0 : context.type) === GLYPH_STATE_ATTRIBUTE_UPDATE_TYPE) {
78031
78107
  this._syncInheritedStyleAttrs(glyph, glyph.attribute);
78032
78108
  }
78033
- });
78109
+ };
78034
78110
  const subMarks = this._subMarks;
78035
78111
  if (subMarks) {
78036
78112
  const subGraphics = [];
@@ -89008,14 +89084,26 @@
89008
89084
  if (!data || data.length === 0) {
89009
89085
  return data;
89010
89086
  }
89011
- const { asTransformRatio, asReachRatio, asHeightRatio, asValueRatio, asNextValueRatio, asLastValueRatio, asLastValue, asCurrentValue, asNextValue, } = op;
89087
+ const { asTransformRatio, asReachRatio, asHeightRatio, asValueRatio, asNextValueRatio, asLastValueRatio, asLastValue, asCurrentValue, asNextValue } = op;
89012
89088
  const valueField = resolveOptionValue$2(op.valueField);
89013
89089
  const heightVisual = (_a = resolveOptionValue$2(op.heightVisual)) !== null && _a !== void 0 ? _a : false;
89014
89090
  const isCone = (_b = resolveOptionValue$2(op.isCone)) !== null && _b !== void 0 ? _b : true;
89015
89091
  const range = resolveOptionValue$2(op.range);
89016
- const max = data.reduce((m, d) => Math.max(m, Number.parseFloat(d[valueField]) || -Infinity), -Infinity);
89017
- const min = data.reduce((m, d) => Math.min(m, Number.parseFloat(d[valueField]) || Infinity), Infinity);
89018
- const rangeArr = [(_c = range === null || range === void 0 ? void 0 : range.min) !== null && _c !== void 0 ? _c : min, (_d = range === null || range === void 0 ? void 0 : range.max) !== null && _d !== void 0 ? _d : max];
89092
+ const max = data.reduce((m, d) => {
89093
+ const value = Number.parseFloat(d[valueField]);
89094
+ return isValidNumber$1(value) ? Math.max(m, value) : m;
89095
+ }, -Infinity);
89096
+ const rangeMin = (_c = range === null || range === void 0 ? void 0 : range.min) !== null && _c !== void 0 ? _c : 0;
89097
+ const rangeMax = (_d = range === null || range === void 0 ? void 0 : range.max) !== null && _d !== void 0 ? _d : max;
89098
+ const getValueRatio = (value) => {
89099
+ if (!isValidNumber$1(value) || !isValidNumber$1(rangeMin) || !isValidNumber$1(rangeMax)) {
89100
+ return 0;
89101
+ }
89102
+ if (rangeMin === rangeMax) {
89103
+ return value < rangeMin ? 0 : 1;
89104
+ }
89105
+ return clamp$1((value - rangeMin) / (rangeMax - rangeMin), 0, 1);
89106
+ };
89019
89107
  data.forEach((d, i) => {
89020
89108
  var _a, _b;
89021
89109
  const currentValue = Number.parseFloat(d[valueField]);
@@ -89023,15 +89111,16 @@
89023
89111
  const nextValue = Number.parseFloat((_b = data[i + 1]) === null || _b === void 0 ? void 0 : _b[valueField]);
89024
89112
  const transformRatio = !isValidNumber$1(nextValue * currentValue) || currentValue === 0 ? 0 : nextValue / currentValue;
89025
89113
  const reachRatio = !isValidNumber$1(currentValue * lastValue) || lastValue === 0 ? 0 : currentValue / lastValue;
89114
+ const valueRatio = getValueRatio(currentValue);
89026
89115
  asLastValue && (d[asLastValue] = lastValue);
89027
89116
  asNextValue && (d[asNextValue] = nextValue);
89028
89117
  asTransformRatio && (d[asTransformRatio] = transformRatio);
89029
89118
  asReachRatio && (d[asReachRatio] = i === 0 ? 1 : reachRatio);
89030
89119
  asHeightRatio && (d[asHeightRatio] = heightVisual === true ? transformRatio : 1 / data.length);
89031
- asValueRatio && (d[asValueRatio] = currentValue / rangeArr[1]);
89120
+ asValueRatio && (d[asValueRatio] = valueRatio);
89032
89121
  asNextValueRatio &&
89033
- (d[asNextValueRatio] = i === data.length - 1 ? (isCone ? 0 : d[asValueRatio]) : nextValue / rangeArr[1]);
89034
- asLastValueRatio && (d[asLastValueRatio] = i === 0 ? 1 : lastValue / rangeArr[1]);
89122
+ (d[asNextValueRatio] = i === data.length - 1 ? (isCone ? 0 : d[asValueRatio]) : getValueRatio(nextValue));
89123
+ asLastValueRatio && (d[asLastValueRatio] = i === 0 ? 1 : getValueRatio(lastValue));
89035
89124
  asCurrentValue && (d[asCurrentValue] = currentValue);
89036
89125
  });
89037
89126
  return data;
@@ -91222,18 +91311,18 @@
91222
91311
  highlightNodes.push(linkDatum.target);
91223
91312
  }
91224
91313
  removeGraphicState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE);
91225
- addGraphicState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, true);
91314
+ addGraphicState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, true, this._hasLinkStateAnimation());
91226
91315
  }
91227
91316
  else if (linkDatum.target === nodeDatum.key) {
91228
91317
  if (!highlightNodes.includes(linkDatum.source)) {
91229
91318
  highlightNodes.push(linkDatum.source);
91230
91319
  }
91231
91320
  removeGraphicState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE);
91232
- addGraphicState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, true);
91321
+ addGraphicState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, true, this._hasLinkStateAnimation());
91233
91322
  }
91234
91323
  else {
91235
91324
  removeGraphicState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS);
91236
- addGraphicState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, true);
91325
+ addGraphicState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, true, this._hasLinkStateAnimation());
91237
91326
  }
91238
91327
  });
91239
91328
  }
@@ -91253,11 +91342,11 @@
91253
91342
  allLinkElements.forEach(linkEl => {
91254
91343
  if (linkEl === graphic) {
91255
91344
  removeGraphicState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE);
91256
- addRuntimeState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, { ratio: 1 });
91345
+ addRuntimeState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, { ratio: 1 }, true, this._hasLinkStateAnimation());
91257
91346
  }
91258
91347
  else {
91259
91348
  removeGraphicState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS);
91260
- addGraphicState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, true);
91349
+ addGraphicState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, true, this._hasLinkStateAnimation());
91261
91350
  }
91262
91351
  });
91263
91352
  }
@@ -91371,11 +91460,11 @@
91371
91460
  const linkDatum = getDatumOfGraphic(linkEl);
91372
91461
  if (highlightLinks.includes((_a = linkDatum.key) !== null && _a !== void 0 ? _a : linkDatum.index)) {
91373
91462
  removeGraphicState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE);
91374
- addGraphicState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, true);
91463
+ addGraphicState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, true, this._hasLinkStateAnimation());
91375
91464
  }
91376
91465
  else {
91377
91466
  removeGraphicState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS);
91378
- addGraphicState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, true);
91467
+ addGraphicState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, true, this._hasLinkStateAnimation());
91379
91468
  }
91380
91469
  });
91381
91470
  }
@@ -91424,7 +91513,7 @@
91424
91513
  }, 0);
91425
91514
  const ratio = val / linkDatum.value;
91426
91515
  removeGraphicState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE);
91427
- addRuntimeState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, { ratio });
91516
+ addRuntimeState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, { ratio }, true, this._hasLinkStateAnimation());
91428
91517
  return;
91429
91518
  }
91430
91519
  if (upSelectedLink) {
@@ -91437,11 +91526,11 @@
91437
91526
  removeGraphicState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE);
91438
91527
  addRuntimeState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, {
91439
91528
  ratio: upSelectedLink.value / linkDatum.value
91440
- });
91529
+ }, true, this._hasLinkStateAnimation());
91441
91530
  return;
91442
91531
  }
91443
91532
  removeGraphicState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS);
91444
- addGraphicState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, true);
91533
+ addGraphicState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, true, this._hasLinkStateAnimation());
91445
91534
  return;
91446
91535
  });
91447
91536
  if (this._nodeMark) {
@@ -91509,7 +91598,7 @@
91509
91598
  const originalDatum = linkDatum.datum;
91510
91599
  if (linkDatum.source === curLinkDatum.source && linkDatum.target === curLinkDatum.target) {
91511
91600
  removeGraphicState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE);
91512
- addRuntimeState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, { ratio: 1 });
91601
+ addRuntimeState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, { ratio: 1 }, true, this._hasLinkStateAnimation());
91513
91602
  return;
91514
91603
  }
91515
91604
  const selectedDatum = originalDatum
@@ -91537,7 +91626,7 @@
91537
91626
  }, 0);
91538
91627
  const ratio = val / linkDatum.value;
91539
91628
  removeGraphicState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE);
91540
- addRuntimeState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, { ratio });
91629
+ addRuntimeState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, { ratio }, true, this._hasLinkStateAnimation());
91541
91630
  return;
91542
91631
  }
91543
91632
  const upSelectedLink = upstreamLinks.find((upLink) => upLink.source === linkDatum.source && upLink.target === linkDatum.target);
@@ -91551,11 +91640,11 @@
91551
91640
  removeGraphicState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE);
91552
91641
  addRuntimeState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, {
91553
91642
  ratio: upSelectedLink.value / linkDatum.value
91554
- });
91643
+ }, true, this._hasLinkStateAnimation());
91555
91644
  return;
91556
91645
  }
91557
91646
  removeGraphicState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS);
91558
- addGraphicState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, true);
91647
+ addGraphicState(linkEl, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, true, this._hasLinkStateAnimation());
91559
91648
  return;
91560
91649
  });
91561
91650
  this._highLightElements(allNodeElements, highlightNodes);
@@ -91567,6 +91656,16 @@
91567
91656
  var _a;
91568
91657
  return (_a = this._spec.direction) !== null && _a !== void 0 ? _a : 'horizontal';
91569
91658
  }
91659
+ _hasStateAnimation(mark) {
91660
+ var _a;
91661
+ return isAnimationEnabledForSeries(this) && !!((_a = mark === null || mark === void 0 ? void 0 : mark.hasAnimationByState) === null || _a === void 0 ? void 0 : _a.call(mark, 'state'));
91662
+ }
91663
+ _hasLinkStateAnimation() {
91664
+ return this._hasStateAnimation(this._linkMark);
91665
+ }
91666
+ _hasNodeStateAnimation() {
91667
+ return this._hasStateAnimation(this._nodeMark);
91668
+ }
91570
91669
  getCategoryField() {
91571
91670
  return this._categoryField;
91572
91671
  }
@@ -91860,10 +91959,10 @@
91860
91959
  graphics.forEach(g => {
91861
91960
  removeGraphicState(g, [exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]);
91862
91961
  if (highlightNodes.includes(getDatumOfGraphic(g).key)) {
91863
- addGraphicState(g, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, true);
91962
+ addGraphicState(g, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS, true, this._hasNodeStateAnimation());
91864
91963
  }
91865
91964
  else {
91866
- addGraphicState(g, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, true);
91965
+ addGraphicState(g, exports.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE, true, this._hasNodeStateAnimation());
91867
91966
  }
91868
91967
  });
91869
91968
  }
@@ -106828,8 +106927,17 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
106828
106927
  Factory.registerLayout(GridLayout.type, GridLayout);
106829
106928
  };
106830
106929
 
106930
+ const installPoptip = (app) => {
106931
+ if (app) {
106932
+ installPoptipToApp(app);
106933
+ }
106934
+ else {
106935
+ loadPoptip();
106936
+ }
106937
+ };
106831
106938
  const registerPoptip = () => {
106832
- loadPoptip();
106939
+ Factory.registerRuntimePluginInstaller('poptipForText', installPoptip);
106940
+ installPoptip();
106833
106941
  };
106834
106942
 
106835
106943
  const TOOLTIP_PREFIX = 'vchart-tooltip';