@visactor/vchart 1.11.1-alpha.0 → 1.11.1-alpha.2

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 (47) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.js +52 -56
  3. package/build/index.min.js +1 -1
  4. package/build/tsconfig.tsbuildinfo +1 -1
  5. package/cjs/animation/config.js +1 -2
  6. package/cjs/compile/grammar-item.js +2 -1
  7. package/cjs/component/marker/base-marker.d.ts +7 -0
  8. package/cjs/component/marker/base-marker.js +5 -0
  9. package/cjs/component/marker/base-marker.js.map +1 -1
  10. package/cjs/component/marker/mark-line/base-mark-line.d.ts +1 -0
  11. package/cjs/component/marker/mark-line/base-mark-line.js +9 -4
  12. package/cjs/component/marker/mark-line/base-mark-line.js.map +1 -1
  13. package/cjs/component/marker/mark-line/cartesian-mark-line.js +10 -27
  14. package/cjs/component/marker/mark-line/cartesian-mark-line.js.map +1 -1
  15. package/cjs/core/index.d.ts +1 -1
  16. package/cjs/core/index.js +1 -1
  17. package/cjs/core/index.js.map +1 -1
  18. package/cjs/core/vchart.d.ts +2 -2
  19. package/cjs/core/vchart.js +15 -12
  20. package/cjs/core/vchart.js.map +1 -1
  21. package/cjs/event/event-dispatcher.js +2 -1
  22. package/cjs/event/index.js +1 -2
  23. package/cjs/series/sankey/sankey.js +4 -2
  24. package/cjs/series/sankey/sankey.js.map +1 -1
  25. package/cjs/typings/tooltip/line.js.map +1 -1
  26. package/esm/animation/config.js +1 -2
  27. package/esm/compile/grammar-item.js +2 -1
  28. package/esm/component/marker/base-marker.d.ts +7 -0
  29. package/esm/component/marker/base-marker.js +6 -1
  30. package/esm/component/marker/base-marker.js.map +1 -1
  31. package/esm/component/marker/mark-line/base-mark-line.d.ts +1 -0
  32. package/esm/component/marker/mark-line/base-mark-line.js +9 -4
  33. package/esm/component/marker/mark-line/base-mark-line.js.map +1 -1
  34. package/esm/component/marker/mark-line/cartesian-mark-line.js +10 -28
  35. package/esm/component/marker/mark-line/cartesian-mark-line.js.map +1 -1
  36. package/esm/core/index.d.ts +1 -1
  37. package/esm/core/index.js +1 -1
  38. package/esm/core/index.js.map +1 -1
  39. package/esm/core/vchart.d.ts +2 -2
  40. package/esm/core/vchart.js +15 -12
  41. package/esm/core/vchart.js.map +1 -1
  42. package/esm/event/event-dispatcher.js +2 -1
  43. package/esm/event/index.js +1 -2
  44. package/esm/series/sankey/sankey.js +4 -2
  45. package/esm/series/sankey/sankey.js.map +1 -1
  46. package/esm/typings/tooltip/line.js.map +1 -1
  47. package/package.json +3 -3
package/build/index.js CHANGED
@@ -60686,7 +60686,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
60686
60686
  return spec;
60687
60687
  }
60688
60688
  _initChartSpec(spec, actionSource) {
60689
- var _a;
60689
+ var _a, _b;
60690
60690
  if (VChart.getFunctionList() && VChart.getFunctionList().length) {
60691
60691
  spec = functionTransform(spec, VChart);
60692
60692
  }
@@ -60694,9 +60694,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
60694
60694
  if (!this._chartSpecTransformer) {
60695
60695
  this._chartSpecTransformer = Factory.createChartSpecTransformer(this._spec.type, this._getChartOption(this._spec.type));
60696
60696
  }
60697
- this._chartSpecTransformer.transformSpec(this._spec);
60697
+ (_a = this._chartSpecTransformer) === null || _a === void 0 ? void 0 : _a.transformSpec(this._spec);
60698
60698
  this._chartPluginApply('onAfterChartSpecTransform', this._spec, actionSource);
60699
- this._specInfo = (_a = this._chartSpecTransformer) === null || _a === void 0 ? void 0 : _a.transformModelSpec(this._spec);
60699
+ this._specInfo = (_b = this._chartSpecTransformer) === null || _b === void 0 ? void 0 : _b.transformModelSpec(this._spec);
60700
60700
  this._chartPluginApply('onAfterModelSpecTransform', this._spec, this._specInfo, actionSource);
60701
60701
  }
60702
60702
  _updateSpecInfo() {
@@ -60833,14 +60833,14 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
60833
60833
  return this._beforeRender(option);
60834
60834
  }
60835
60835
  _reCompile(updateResult, morphConfig) {
60836
- var _a, _b, _c, _d, _e;
60836
+ var _a, _b, _c, _d, _e, _f;
60837
60837
  if (updateResult.reMake) {
60838
60838
  this._releaseData();
60839
60839
  this._initDataSet();
60840
60840
  this._chartSpecTransformer = null;
60841
- this._chart.release();
60841
+ (_a = this._chart) === null || _a === void 0 ? void 0 : _a.release();
60842
60842
  this._chart = null;
60843
- (_a = this._compiler) === null || _a === void 0 ? void 0 : _a.releaseGrammar(((_b = this._option) === null || _b === void 0 ? void 0 : _b.animation) === false || ((_c = this._spec) === null || _c === void 0 ? void 0 : _c.animation) === false);
60843
+ (_b = this._compiler) === null || _b === void 0 ? void 0 : _b.releaseGrammar(((_c = this._option) === null || _c === void 0 ? void 0 : _c.animation) === false || ((_d = this._spec) === null || _d === void 0 ? void 0 : _d.animation) === false);
60844
60844
  this._userEvents.forEach(e => { var _a; return (_a = this._event) === null || _a === void 0 ? void 0 : _a.on(e.eType, e.query, e.handler); });
60845
60845
  if (updateResult.reSize) {
60846
60846
  this._doResize();
@@ -60848,8 +60848,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
60848
60848
  }
60849
60849
  else {
60850
60850
  if (updateResult.reCompile) {
60851
- (_d = this._compiler) === null || _d === void 0 ? void 0 : _d.clear({ chart: this._chart, vChart: this }, !this._option.animation || !this._spec.animation);
60852
- (_e = this._compiler) === null || _e === void 0 ? void 0 : _e.compile({ chart: this._chart, vChart: this }, {});
60851
+ (_e = this._compiler) === null || _e === void 0 ? void 0 : _e.clear({ chart: this._chart, vChart: this }, !this._option.animation || !this._spec.animation);
60852
+ (_f = this._compiler) === null || _f === void 0 ? void 0 : _f.compile({ chart: this._chart, vChart: this }, {});
60853
60853
  }
60854
60854
  if (updateResult.reSize) {
60855
60855
  const { width, height } = this.getCurrentSize();
@@ -61031,20 +61031,30 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
61031
61031
  }
61032
61032
  return this;
61033
61033
  }
61034
+ const prevData = array(this._spec.data);
61034
61035
  const list = array(data);
61035
61036
  list.forEach(d => {
61036
61037
  var _a;
61037
61038
  const { id, values, parser, fields } = d;
61038
- const preDV = this._spec.data.find(dv => dv.name === id);
61039
+ const preDV = prevData.find(dv => dv.name === id);
61039
61040
  if (preDV) {
61040
- preDV.setFields(cloneDeep(fields));
61041
- preDV.parse(values, cloneDeep(parser));
61041
+ if (preDV instanceof DataView) {
61042
+ preDV.setFields(cloneDeep(fields));
61043
+ preDV.parse(values, cloneDeep(parser));
61044
+ }
61045
+ else {
61046
+ preDV.values = values;
61047
+ isValid$3(parser) && (preDV.parser = parser);
61048
+ isValid$3(fields) && (preDV.fields = fields);
61049
+ }
61042
61050
  }
61043
61051
  else {
61044
- const dataView = dataToDataView(d, this._dataSet, this._spec.data, {
61052
+ const dataView = dataToDataView(d, this._dataSet, prevData, {
61045
61053
  onError: (_a = this._option) === null || _a === void 0 ? void 0 : _a.onError
61046
61054
  });
61047
- this._spec.data.push(dataView);
61055
+ if (isArray$3(this._spec.data)) {
61056
+ this._spec.data.push(dataView);
61057
+ }
61048
61058
  }
61049
61059
  });
61050
61060
  return this;
@@ -66009,7 +66019,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
66009
66019
  registerComponentPlugin(CanvasTooltipHandler);
66010
66020
  };
66011
66021
 
66012
- const version = "1.11.1-alpha.0";
66022
+ const version = "1.11.1-alpha.2";
66013
66023
 
66014
66024
  const addVChartProperty = (data, op) => {
66015
66025
  const context = op.beforeCall();
@@ -87023,11 +87033,11 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
87023
87033
  }
87024
87034
  valueToPositionX(value) {
87025
87035
  const node = this.valueToNode(value);
87026
- return node.x0;
87036
+ return node === null || node === void 0 ? void 0 : node.x0;
87027
87037
  }
87028
87038
  valueToPositionY(value) {
87029
87039
  const node = this.valueToNode(value);
87030
- return node.y0;
87040
+ return node === null || node === void 0 ? void 0 : node.y0;
87031
87041
  }
87032
87042
  initMarkStyle() {
87033
87043
  this._initNodeMarkStyle();
@@ -97036,6 +97046,15 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
97036
97046
  }
97037
97047
  super.onLayoutStart(layoutRect, chartViewRect, ctx);
97038
97048
  }
97049
+ _compareSpec(spec, prevSpec) {
97050
+ const result = super._compareSpec(spec, prevSpec);
97051
+ if (!isEqual$1(prevSpec, spec)) {
97052
+ result.reRender = true;
97053
+ result.reMake = true;
97054
+ result.change = true;
97055
+ }
97056
+ return result;
97057
+ }
97039
97058
  }
97040
97059
 
97041
97060
  function markerRegression(_data, opt) {
@@ -97125,8 +97144,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
97125
97144
  const markLine = this._newMarkLineComponent(markLineAttrs);
97126
97145
  return markLine;
97127
97146
  }
97128
- _markerLayout() {
97129
- var _a, _b, _c, _d, _e;
97147
+ _getUpdateMarkerAttrs() {
97148
+ var _a, _b, _c, _d;
97130
97149
  const spec = this._spec;
97131
97150
  const data = this._markerData;
97132
97151
  const startRelativeSeries = this._startRelativeSeries;
@@ -97153,7 +97172,12 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
97153
97172
  const labelAttrs = Object.assign(Object.assign({}, markerComponentAttr.label), { text: this._spec.label.formatMethod
97154
97173
  ? this._spec.label.formatMethod(dataPoints, seriesData)
97155
97174
  : (_d = markerComponentAttr.label) === null || _d === void 0 ? void 0 : _d.text });
97156
- (_e = this._markerComponent) === null || _e === void 0 ? void 0 : _e.setAttributes(Object.assign(Object.assign({}, pointsAttr), { label: labelAttrs, limitRect, dx: this._layoutOffsetX, dy: this._layoutOffsetY }));
97175
+ return Object.assign(Object.assign({}, pointsAttr), { label: labelAttrs, limitRect, dx: this._layoutOffsetX, dy: this._layoutOffsetY });
97176
+ }
97177
+ _markerLayout() {
97178
+ var _a;
97179
+ const updateAttrs = this._getUpdateMarkerAttrs();
97180
+ (_a = this._markerComponent) === null || _a === void 0 ? void 0 : _a.setAttributes(updateAttrs);
97157
97181
  }
97158
97182
  _initDataView() {
97159
97183
  const spec = this._spec;
@@ -97249,35 +97273,11 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
97249
97273
  return { points };
97250
97274
  }
97251
97275
  _markerLayout() {
97252
- var _a, _b, _c, _d, _e, _f;
97253
- super._markerLayout();
97254
- const spec = this._spec;
97255
- const data = this._markerData;
97256
- const startRelativeSeries = this._startRelativeSeries;
97257
- const endRelativeSeries = this._endRelativeSeries;
97258
- const relativeSeries = this._relativeSeries;
97259
- const { points } = this._computePointsAttr();
97260
- const seriesData = this._relativeSeries.getViewData().latestData;
97261
- const dataPoints = data.latestData[0] && data.latestData[0].latestData ? data.latestData[0].latestData : data.latestData;
97262
- let limitRect;
97263
- if (spec.clip || ((_a = spec.label) === null || _a === void 0 ? void 0 : _a.confine)) {
97264
- const { minX, maxX, minY, maxY } = computeClipRange([
97265
- startRelativeSeries.getRegion(),
97266
- endRelativeSeries.getRegion(),
97267
- relativeSeries.getRegion()
97268
- ]);
97269
- limitRect = {
97270
- x: minX,
97271
- y: minY,
97272
- width: maxX - minX,
97273
- height: maxY - minY
97274
- };
97275
- }
97276
- const markerComponentAttr = (_c = (_b = this._markerComponent) === null || _b === void 0 ? void 0 : _b.attribute) !== null && _c !== void 0 ? _c : {};
97277
- const labelAttrs = Object.assign(Object.assign({}, markerComponentAttr.label), { text: this._spec.label.formatMethod
97278
- ? this._spec.label.formatMethod(dataPoints, seriesData)
97279
- : (_d = markerComponentAttr.label) === null || _d === void 0 ? void 0 : _d.text });
97276
+ var _a, _b, _c, _d;
97277
+ const updateAttrs = this._getUpdateMarkerAttrs();
97280
97278
  if (this._spec.type === 'type-step') {
97279
+ const startRelativeSeries = this._startRelativeSeries;
97280
+ const endRelativeSeries = this._endRelativeSeries;
97281
97281
  const { multiSegment, mainSegmentIndex } = this._spec.line || {};
97282
97282
  const { connectDirection, expandDistance = 0 } = this._spec;
97283
97283
  let expandDistanceValue;
@@ -97300,6 +97300,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
97300
97300
  else {
97301
97301
  expandDistanceValue = expandDistance;
97302
97302
  }
97303
+ const { points, label, limitRect } = updateAttrs;
97303
97304
  const joinPoints = getInsertPoints(points[0], points[1], connectDirection, expandDistanceValue);
97304
97305
  let labelPositionAttrs;
97305
97306
  if (multiSegment && isValid$3(mainSegmentIndex)) {
@@ -97313,7 +97314,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
97313
97314
  else {
97314
97315
  labelPositionAttrs = Object.assign(Object.assign({ position: 'start', autoRotate: false }, getTextOffset(points[0], points[1], connectDirection, expandDistanceValue)), { refX: 0, refY: 0 });
97315
97316
  }
97316
- (_e = this._markerComponent) === null || _e === void 0 ? void 0 : _e.setAttributes({
97317
+ const markerComponentAttr = (_b = (_a = this._markerComponent) === null || _a === void 0 ? void 0 : _a.attribute) !== null && _b !== void 0 ? _b : {};
97318
+ (_c = this._markerComponent) === null || _c === void 0 ? void 0 : _c.setAttributes({
97317
97319
  points: multiSegment
97318
97320
  ? [
97319
97321
  [joinPoints[0], joinPoints[1]],
@@ -97321,7 +97323,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
97321
97323
  [joinPoints[2], joinPoints[3]]
97322
97324
  ]
97323
97325
  : joinPoints,
97324
- label: Object.assign(Object.assign(Object.assign({}, labelAttrs), labelPositionAttrs), { textStyle: Object.assign(Object.assign({}, markerComponentAttr.label.textStyle), { textAlign: 'center', textBaseline: 'middle' }) }),
97326
+ label: Object.assign(Object.assign(Object.assign({}, label), labelPositionAttrs), { textStyle: Object.assign(Object.assign({}, markerComponentAttr.label.textStyle), { textAlign: 'center', textBaseline: 'middle' }) }),
97325
97327
  limitRect,
97326
97328
  multiSegment,
97327
97329
  mainSegmentIndex,
@@ -97330,13 +97332,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
97330
97332
  });
97331
97333
  }
97332
97334
  else {
97333
- (_f = this._markerComponent) === null || _f === void 0 ? void 0 : _f.setAttributes({
97334
- points,
97335
- label: labelAttrs,
97336
- limitRect,
97337
- dx: this._layoutOffsetX,
97338
- dy: this._layoutOffsetY
97339
- });
97335
+ (_d = this._markerComponent) === null || _d === void 0 ? void 0 : _d.setAttributes(updateAttrs);
97340
97336
  }
97341
97337
  }
97342
97338
  _computeOptions() {