@visactor/vchart 1.13.19 → 1.13.21-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.
Files changed (78) hide show
  1. package/build/es5/index.js +2 -2
  2. package/build/index.es.js +33 -5
  3. package/build/index.js +33 -5
  4. package/build/index.min.js +1 -1
  5. package/build/tsconfig.tsbuildinfo +1 -1
  6. package/cjs/chart/base/base-chart.js +3 -0
  7. package/cjs/chart/base/base-chart.js.map +1 -1
  8. package/cjs/chart/interface/common.d.ts +2 -0
  9. package/cjs/chart/interface/common.js.map +1 -1
  10. package/cjs/chart/sankey/sankey-transformer.js +1 -1
  11. package/cjs/chart/sankey/sankey-transformer.js.map +1 -1
  12. package/cjs/constant/funnel.js +2 -1
  13. package/cjs/constant/sunburst.js +1 -2
  14. package/cjs/core/index.d.ts +1 -1
  15. package/cjs/core/index.js +1 -1
  16. package/cjs/core/index.js.map +1 -1
  17. package/cjs/core/interface.js +2 -1
  18. package/cjs/core/vchart.d.ts +2 -0
  19. package/cjs/core/vchart.js +8 -4
  20. package/cjs/core/vchart.js.map +1 -1
  21. package/cjs/data/transforms/sankey.d.ts +2 -0
  22. package/cjs/data/transforms/sankey.js +2 -1
  23. package/cjs/data/transforms/sankey.js.map +1 -1
  24. package/cjs/plugin/chart/interface.d.ts +4 -0
  25. package/cjs/plugin/chart/interface.js.map +1 -1
  26. package/cjs/plugin/chart/plugin-service.d.ts +3 -0
  27. package/cjs/plugin/chart/plugin-service.js +13 -0
  28. package/cjs/plugin/chart/plugin-service.js.map +1 -1
  29. package/cjs/plugin/chart/scroll/index.d.ts +2 -0
  30. package/cjs/plugin/chart/scroll/index.js +21 -0
  31. package/cjs/plugin/chart/scroll/index.js.map +1 -0
  32. package/cjs/plugin/chart/scroll/interface.d.ts +11 -0
  33. package/cjs/plugin/chart/scroll/interface.js +6 -0
  34. package/cjs/plugin/chart/scroll/interface.js.map +1 -0
  35. package/cjs/plugin/chart/scroll/scroll.d.ts +41 -0
  36. package/cjs/plugin/chart/scroll/scroll.js +204 -0
  37. package/cjs/plugin/chart/scroll/scroll.js.map +1 -0
  38. package/cjs/series/sankey/interface.d.ts +3 -0
  39. package/cjs/series/sankey/interface.js.map +1 -1
  40. package/cjs/series/sankey/sankey.js +2 -1
  41. package/cjs/series/sankey/sankey.js.map +1 -1
  42. package/esm/chart/base/base-chart.js +3 -0
  43. package/esm/chart/base/base-chart.js.map +1 -1
  44. package/esm/chart/interface/common.d.ts +2 -0
  45. package/esm/chart/interface/common.js.map +1 -1
  46. package/esm/chart/sankey/sankey-transformer.js +1 -1
  47. package/esm/chart/sankey/sankey-transformer.js.map +1 -1
  48. package/esm/constant/funnel.js +2 -1
  49. package/esm/constant/sunburst.js +1 -2
  50. package/esm/core/index.d.ts +1 -1
  51. package/esm/core/index.js +1 -1
  52. package/esm/core/index.js.map +1 -1
  53. package/esm/core/interface.js +2 -1
  54. package/esm/core/vchart.d.ts +2 -0
  55. package/esm/core/vchart.js +8 -4
  56. package/esm/core/vchart.js.map +1 -1
  57. package/esm/data/transforms/sankey.d.ts +2 -0
  58. package/esm/data/transforms/sankey.js +2 -1
  59. package/esm/data/transforms/sankey.js.map +1 -1
  60. package/esm/plugin/chart/interface.d.ts +4 -0
  61. package/esm/plugin/chart/interface.js.map +1 -1
  62. package/esm/plugin/chart/plugin-service.d.ts +3 -0
  63. package/esm/plugin/chart/plugin-service.js +13 -0
  64. package/esm/plugin/chart/plugin-service.js.map +1 -1
  65. package/esm/plugin/chart/scroll/index.d.ts +2 -0
  66. package/esm/plugin/chart/scroll/index.js +4 -0
  67. package/esm/plugin/chart/scroll/index.js.map +1 -0
  68. package/esm/plugin/chart/scroll/interface.d.ts +11 -0
  69. package/esm/plugin/chart/scroll/interface.js +2 -0
  70. package/esm/plugin/chart/scroll/interface.js.map +1 -0
  71. package/esm/plugin/chart/scroll/scroll.d.ts +41 -0
  72. package/esm/plugin/chart/scroll/scroll.js +206 -0
  73. package/esm/plugin/chart/scroll/scroll.js.map +1 -0
  74. package/esm/series/sankey/interface.d.ts +3 -0
  75. package/esm/series/sankey/interface.js.map +1 -1
  76. package/esm/series/sankey/sankey.js +2 -1
  77. package/esm/series/sankey/sankey.js.map +1 -1
  78. package/package.json +15 -15
package/build/index.es.js CHANGED
@@ -45011,6 +45011,7 @@ loadBrushComponent();
45011
45011
  let Brush$1 = class Brush extends AbstractComponent {
45012
45012
  constructor(attributes, options) {
45013
45013
  super((null == options ? void 0 : options.skipDefault) ? attributes : merge$1({}, Brush.defaultAttributes, attributes)), this.name = "brush", this._activeBrushState = !1, this._activeDrawState = !1, this._cacheDrawPoints = [], this._activeMoveState = !1, this._operatingMaskMoveDx = 0, this._operatingMaskMoveDy = 0, this._operatingMaskMoveRangeX = [-1 / 0, 1 / 0], this._operatingMaskMoveRangeY = [-1 / 0, 1 / 0], this._brushMaskAABBBoundsDict = {}, this._firstUpdate = !0, this._onBrushStart = e => {
45014
+ if (this._outOfInteractiveRange(e)) return;
45014
45015
  const {
45015
45016
  updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger,
45016
45017
  endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger,
@@ -62887,6 +62888,9 @@ class ChartPluginService extends BasePluginService {
62887
62888
  super();
62888
62889
  this.globalInstance = globalInstance;
62889
62890
  }
62891
+ getPlugin(name) {
62892
+ return this._plugins.find(plugin => plugin.name === name);
62893
+ }
62890
62894
  onInit(chartSpec) {
62891
62895
  this._plugins.forEach(plugin => {
62892
62896
  plugin.onInit && plugin.onInit(this, chartSpec);
@@ -62913,6 +62917,16 @@ class ChartPluginService extends BasePluginService {
62913
62917
  plugin.onBeforeInitChart && plugin.onBeforeInitChart(this, chartSpec, actionSource);
62914
62918
  });
62915
62919
  }
62920
+ onLayoutRectUpdate() {
62921
+ this._plugins.forEach(plugin => {
62922
+ plugin.onLayoutRectUpdate && plugin.onLayoutRectUpdate(this);
62923
+ });
62924
+ }
62925
+ onAfterRender() {
62926
+ this._plugins.forEach(plugin => {
62927
+ plugin.onAfterRender && plugin.onAfterRender(this);
62928
+ });
62929
+ }
62916
62930
  releaseAll() {
62917
62931
  super.releaseAll();
62918
62932
  this.globalInstance = null;
@@ -63037,6 +63051,9 @@ class VChart {
63037
63051
  getDataSet() {
63038
63052
  return this._dataSet;
63039
63053
  }
63054
+ get chartPlugin() {
63055
+ return this._chartPlugin;
63056
+ }
63040
63057
  constructor(spec, options) {
63041
63058
  var _a, _b, _c, _d, _e, _f, _g, _h;
63042
63059
  this.id = createID();
@@ -63401,6 +63418,7 @@ class VChart {
63401
63418
  return false;
63402
63419
  }
63403
63420
  this._updateAnimateState();
63421
+ this._chartPluginApply('onAfterRender', this._spec);
63404
63422
  this._event.emit(ChartEvent.rendered, {
63405
63423
  chart: this._chart,
63406
63424
  vchart: this
@@ -64232,7 +64250,8 @@ class VChart {
64232
64250
  getSpecInfo: () => { var _a; return (_a = this._specInfo) !== null && _a !== void 0 ? _a : {}; },
64233
64251
  layout: this._option.layout,
64234
64252
  onError: this._onError,
64235
- disableTriggerEvent: this._option.disableTriggerEvent === true
64253
+ disableTriggerEvent: this._option.disableTriggerEvent === true,
64254
+ chartPluginApply: (funcName, ...args) => this._chartPluginApply(funcName, ...args)
64236
64255
  };
64237
64256
  }
64238
64257
  }
@@ -64255,7 +64274,7 @@ const registerVChartCore = () => {
64255
64274
  };
64256
64275
  registerVChartCore();
64257
64276
 
64258
- const version = "1.13.19";
64277
+ const version = "1.13.21-alpha.0";
64259
64278
 
64260
64279
  const addVChartProperty = (data, op) => {
64261
64280
  const context = op.beforeCall();
@@ -71512,6 +71531,7 @@ class BaseChart extends CompilableBase {
71512
71531
  return (_b = (_a = this.getCompiler()) === null || _a === void 0 ? void 0 : _a.getCanvas()) !== null && _b !== void 0 ? _b : null;
71513
71532
  }
71514
71533
  _updateLayoutRect(viewBox) {
71534
+ var _a, _b;
71515
71535
  const canvasRect = this.getCanvasRect();
71516
71536
  let viewRect = canvasRect;
71517
71537
  if (viewBox) {
@@ -71532,6 +71552,7 @@ class BaseChart extends CompilableBase {
71532
71552
  this._layoutRect.x = this.padding.left;
71533
71553
  this._layoutRect.y = this.padding.top;
71534
71554
  this._event.emit(ChartEvent.layoutRectUpdate, { chart: this });
71555
+ (_b = (_a = this._option) === null || _a === void 0 ? void 0 : _a.chartPluginApply) === null || _b === void 0 ? void 0 : _b.call(_a, 'onLayoutRectUpdate', { chart: this });
71535
71556
  }
71536
71557
  setCurrentTheme() {
71537
71558
  this.updateChartConfig({ change: true, reMake: false }, this._spec);
@@ -86427,7 +86448,12 @@ const sankeyLayout = (data, op) => {
86427
86448
  }
86428
86449
  const layout = new SankeyLayout(op);
86429
86450
  const result = [];
86430
- result.push(layout.layout(originalData, view));
86451
+ if (op.customLayout) {
86452
+ result.push(op.customLayout(layout, originalData, view, op));
86453
+ }
86454
+ else {
86455
+ result.push(layout.layout(originalData, view));
86456
+ }
86431
86457
  return result;
86432
86458
  };
86433
86459
 
@@ -87064,7 +87090,8 @@ class SankeySeries extends CartesianSeries {
87064
87090
  linkHeight: this._spec.linkHeight,
87065
87091
  equalNodeHeight: this._spec.equalNodeHeight,
87066
87092
  linkOverlap: this._spec.linkOverlap,
87067
- inverse: this._spec.inverse
87093
+ inverse: this._spec.inverse,
87094
+ customLayout: this._spec.customLayout
87068
87095
  },
87069
87096
  level: TransformLevel.sankeyLayout
87070
87097
  });
@@ -92696,7 +92723,8 @@ class SankeyChartSpecTransformer extends BaseChartSpecTransformer {
92696
92723
  'link',
92697
92724
  'emphasis',
92698
92725
  'inverse',
92699
- 'overflow'
92726
+ 'overflow',
92727
+ 'customLayout'
92700
92728
  ]);
92701
92729
  return series;
92702
92730
  }
package/build/index.js CHANGED
@@ -45017,6 +45017,7 @@
45017
45017
  let Brush$1 = class Brush extends AbstractComponent {
45018
45018
  constructor(attributes, options) {
45019
45019
  super((null == options ? void 0 : options.skipDefault) ? attributes : merge$1({}, Brush.defaultAttributes, attributes)), this.name = "brush", this._activeBrushState = !1, this._activeDrawState = !1, this._cacheDrawPoints = [], this._activeMoveState = !1, this._operatingMaskMoveDx = 0, this._operatingMaskMoveDy = 0, this._operatingMaskMoveRangeX = [-1 / 0, 1 / 0], this._operatingMaskMoveRangeY = [-1 / 0, 1 / 0], this._brushMaskAABBBoundsDict = {}, this._firstUpdate = !0, this._onBrushStart = e => {
45020
+ if (this._outOfInteractiveRange(e)) return;
45020
45021
  const {
45021
45022
  updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger,
45022
45023
  endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger,
@@ -62893,6 +62894,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
62893
62894
  super();
62894
62895
  this.globalInstance = globalInstance;
62895
62896
  }
62897
+ getPlugin(name) {
62898
+ return this._plugins.find(plugin => plugin.name === name);
62899
+ }
62896
62900
  onInit(chartSpec) {
62897
62901
  this._plugins.forEach(plugin => {
62898
62902
  plugin.onInit && plugin.onInit(this, chartSpec);
@@ -62919,6 +62923,16 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
62919
62923
  plugin.onBeforeInitChart && plugin.onBeforeInitChart(this, chartSpec, actionSource);
62920
62924
  });
62921
62925
  }
62926
+ onLayoutRectUpdate() {
62927
+ this._plugins.forEach(plugin => {
62928
+ plugin.onLayoutRectUpdate && plugin.onLayoutRectUpdate(this);
62929
+ });
62930
+ }
62931
+ onAfterRender() {
62932
+ this._plugins.forEach(plugin => {
62933
+ plugin.onAfterRender && plugin.onAfterRender(this);
62934
+ });
62935
+ }
62922
62936
  releaseAll() {
62923
62937
  super.releaseAll();
62924
62938
  this.globalInstance = null;
@@ -63043,6 +63057,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
63043
63057
  getDataSet() {
63044
63058
  return this._dataSet;
63045
63059
  }
63060
+ get chartPlugin() {
63061
+ return this._chartPlugin;
63062
+ }
63046
63063
  constructor(spec, options) {
63047
63064
  var _a, _b, _c, _d, _e, _f, _g, _h;
63048
63065
  this.id = createID();
@@ -63407,6 +63424,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
63407
63424
  return false;
63408
63425
  }
63409
63426
  this._updateAnimateState();
63427
+ this._chartPluginApply('onAfterRender', this._spec);
63410
63428
  this._event.emit(ChartEvent.rendered, {
63411
63429
  chart: this._chart,
63412
63430
  vchart: this
@@ -64238,7 +64256,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
64238
64256
  getSpecInfo: () => { var _a; return (_a = this._specInfo) !== null && _a !== void 0 ? _a : {}; },
64239
64257
  layout: this._option.layout,
64240
64258
  onError: this._onError,
64241
- disableTriggerEvent: this._option.disableTriggerEvent === true
64259
+ disableTriggerEvent: this._option.disableTriggerEvent === true,
64260
+ chartPluginApply: (funcName, ...args) => this._chartPluginApply(funcName, ...args)
64242
64261
  };
64243
64262
  }
64244
64263
  }
@@ -64261,7 +64280,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
64261
64280
  };
64262
64281
  registerVChartCore();
64263
64282
 
64264
- const version = "1.13.19";
64283
+ const version = "1.13.21-alpha.0";
64265
64284
 
64266
64285
  const addVChartProperty = (data, op) => {
64267
64286
  const context = op.beforeCall();
@@ -71518,6 +71537,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
71518
71537
  return (_b = (_a = this.getCompiler()) === null || _a === void 0 ? void 0 : _a.getCanvas()) !== null && _b !== void 0 ? _b : null;
71519
71538
  }
71520
71539
  _updateLayoutRect(viewBox) {
71540
+ var _a, _b;
71521
71541
  const canvasRect = this.getCanvasRect();
71522
71542
  let viewRect = canvasRect;
71523
71543
  if (viewBox) {
@@ -71538,6 +71558,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
71538
71558
  this._layoutRect.x = this.padding.left;
71539
71559
  this._layoutRect.y = this.padding.top;
71540
71560
  this._event.emit(ChartEvent.layoutRectUpdate, { chart: this });
71561
+ (_b = (_a = this._option) === null || _a === void 0 ? void 0 : _a.chartPluginApply) === null || _b === void 0 ? void 0 : _b.call(_a, 'onLayoutRectUpdate', { chart: this });
71541
71562
  }
71542
71563
  setCurrentTheme() {
71543
71564
  this.updateChartConfig({ change: true, reMake: false }, this._spec);
@@ -86433,7 +86454,12 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
86433
86454
  }
86434
86455
  const layout = new SankeyLayout(op);
86435
86456
  const result = [];
86436
- result.push(layout.layout(originalData, view));
86457
+ if (op.customLayout) {
86458
+ result.push(op.customLayout(layout, originalData, view, op));
86459
+ }
86460
+ else {
86461
+ result.push(layout.layout(originalData, view));
86462
+ }
86437
86463
  return result;
86438
86464
  };
86439
86465
 
@@ -87070,7 +87096,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
87070
87096
  linkHeight: this._spec.linkHeight,
87071
87097
  equalNodeHeight: this._spec.equalNodeHeight,
87072
87098
  linkOverlap: this._spec.linkOverlap,
87073
- inverse: this._spec.inverse
87099
+ inverse: this._spec.inverse,
87100
+ customLayout: this._spec.customLayout
87074
87101
  },
87075
87102
  level: TransformLevel.sankeyLayout
87076
87103
  });
@@ -92702,7 +92729,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
92702
92729
  'link',
92703
92730
  'emphasis',
92704
92731
  'inverse',
92705
- 'overflow'
92732
+ 'overflow',
92733
+ 'customLayout'
92706
92734
  ]);
92707
92735
  return series;
92708
92736
  }