@visactor/vchart 2.0.13-alpha.0 → 2.0.13-alpha.1

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 (50) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.es.js +22 -20
  3. package/build/index.js +22 -20
  4. package/build/index.min.js +2 -2
  5. package/build/tsconfig.tsbuildinfo +1 -1
  6. package/cjs/animation/callback-disappear.js +2 -1
  7. package/cjs/animation/index.js +1 -2
  8. package/cjs/compile/compiler.js +1 -1
  9. package/cjs/compile/grammar-item.js +1 -1
  10. package/cjs/compile/morph.js +1 -1
  11. package/cjs/compile/state-manager.js +1 -1
  12. package/cjs/compile/util.js +1 -1
  13. package/cjs/component/brush/brush.js +13 -12
  14. package/cjs/component/brush/brush.js.map +1 -1
  15. package/cjs/component/brush/interface.d.ts +2 -1
  16. package/cjs/component/brush/interface.js.map +1 -1
  17. package/cjs/component/tooltip/utils/show-tooltip.js +2 -10
  18. package/cjs/component/tooltip/utils/show-tooltip.js.map +1 -1
  19. package/cjs/component/util.js +1 -2
  20. package/cjs/constant/data.js +2 -1
  21. package/cjs/constant/scroll-bar.js +1 -2
  22. package/cjs/core/index.js +2 -1
  23. package/cjs/core/interface.js +1 -1
  24. package/cjs/core/util.js +1 -1
  25. package/cjs/core/vchart.js +1 -1
  26. package/cjs/env/env.js +1 -1
  27. package/cjs/env/index.js +1 -1
  28. package/esm/animation/callback-disappear.js +2 -1
  29. package/esm/animation/index.js +1 -2
  30. package/esm/compile/compiler.js +1 -1
  31. package/esm/compile/grammar-item.js +1 -1
  32. package/esm/compile/morph.js +1 -1
  33. package/esm/compile/state-manager.js +1 -1
  34. package/esm/compile/util.js +1 -1
  35. package/esm/component/brush/brush.js +13 -12
  36. package/esm/component/brush/brush.js.map +1 -1
  37. package/esm/component/brush/interface.d.ts +2 -1
  38. package/esm/component/brush/interface.js.map +1 -1
  39. package/esm/component/tooltip/utils/show-tooltip.js +2 -10
  40. package/esm/component/tooltip/utils/show-tooltip.js.map +1 -1
  41. package/esm/component/util.js +1 -2
  42. package/esm/constant/data.js +2 -1
  43. package/esm/constant/scroll-bar.js +1 -2
  44. package/esm/core/index.js +2 -1
  45. package/esm/core/interface.js +1 -1
  46. package/esm/core/util.js +1 -1
  47. package/esm/core/vchart.js +1 -1
  48. package/esm/env/env.js +1 -1
  49. package/esm/env/index.js +1 -1
  50. package/package.json +9 -9
package/build/index.es.js CHANGED
@@ -51096,6 +51096,7 @@ loadBrushComponent();
51096
51096
  let Brush$1 = class Brush extends AbstractComponent {
51097
51097
  constructor(attributes, options) {
51098
51098
  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 => {
51099
+ if (!1 === this._beforeBrushEvent(e)) return;
51099
51100
  const {
51100
51101
  updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger,
51101
51102
  endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger,
@@ -51103,11 +51104,11 @@ let Brush$1 = class Brush extends AbstractComponent {
51103
51104
  } = this.attribute;
51104
51105
  array(updateTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushingWithDelay)), array(endTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushEnd)), e.stopPropagation(), this._firstUpdate = !0, this._activeMoveState = brushMoved && this._isPosInBrushMask(e), this._activeDrawState = !this._activeMoveState, this._startPos = this.eventPosToStagePos(e), this._cacheDrawPoints = [this._startPos];
51105
51106
  }, this._onBrushing = e => {
51106
- this._outOfInteractiveRange(e) || (e.stopPropagation(), this._firstUpdate ? (this._activeDrawState && this._initDraw(e), this._activeMoveState && this._initMove(e), this._firstUpdate = !1) : (this._activeDrawState && this._drawing(e), this._activeMoveState && this._moving(e)));
51107
+ !1 !== this._beforeBrushEvent(e) && (this._outOfInteractiveRange(e) || (e.stopPropagation(), this._firstUpdate ? (this._activeDrawState && this._initDraw(e), this._activeMoveState && this._initMove(e), this._firstUpdate = !1) : (this._activeDrawState && this._drawing(e), this._activeMoveState && this._moving(e))));
51107
51108
  }, this._onBrushingWithDelay = 0 === this.attribute.delayTime ? this._onBrushing : delayMap$1[this.attribute.delayType](this._onBrushing, this.attribute.delayTime), this._onBrushEnd = e => {
51108
51109
  this._releaseBrushUpdateEvents(), e.preventDefault(), this._activeDrawState && this._drawEnd(e), this._activeMoveState && this._moveEnd(e), this._activeDrawState = !1, this._activeMoveState = !1;
51109
51110
  }, this._onBrushClear = e => {
51110
- e.preventDefault(), this._isEmptyMask() || (this._clearMask(), this._dispatchBrushEvent(IOperateType.brushClear, e)), this._activeDrawState = !1, this._activeMoveState = !1;
51111
+ !1 !== this._beforeBrushEvent(e) && (e.preventDefault(), this._isEmptyMask() || (this._clearMask(), this._dispatchBrushEvent(IOperateType.brushClear, e)), this._activeDrawState = !1, this._activeMoveState = !1);
51111
51112
  };
51112
51113
  }
51113
51114
  _bindBrushEvents() {
@@ -51312,6 +51313,10 @@ let Brush$1 = class Brush extends AbstractComponent {
51312
51313
  pos = this.eventPosToStagePos(e);
51313
51314
  return pos.x > maxX || pos.x < minX || pos.y > maxY || pos.y < minY;
51314
51315
  }
51316
+ _beforeBrushEvent(e) {
51317
+ var _a, _b;
51318
+ return null === (_b = (_a = this.attribute).beforeBrushChange) || void 0 === _b ? void 0 : _b.call(_a, e);
51319
+ }
51315
51320
  _dispatchBrushEvent(operateType, e) {
51316
51321
  this._dispatchEvent(operateType, {
51317
51322
  operateMask: this._operatingMask,
@@ -95659,15 +95664,11 @@ function showTooltip(datum, options, component) {
95659
95664
  });
95660
95665
  return originDatum;
95661
95666
  };
95662
- const transform = region.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse();
95663
95667
  const getMockEvent = (originPos) => {
95664
95668
  var _a, _b;
95665
95669
  const pos = bound(originPos);
95666
- const tempX = (_a = opt.x) !== null && _a !== void 0 ? _a : regionPos.x + pos.x;
95667
- const tempY = (_b = opt.y) !== null && _b !== void 0 ? _b : regionPos.y + pos.y;
95668
- const canvasPoint = { x: 0, y: 0 };
95669
- transform.transformPoint({ x: tempX, y: tempY }, canvasPoint);
95670
- const { x: canvasX, y: canvasY } = canvasPoint;
95670
+ const canvasX = (_a = opt.x) !== null && _a !== void 0 ? _a : regionPos.x + pos.x;
95671
+ const canvasY = (_b = opt.y) !== null && _b !== void 0 ? _b : regionPos.y + pos.y;
95671
95672
  return {
95672
95673
  canvasX,
95673
95674
  canvasY,
@@ -103210,30 +103211,30 @@ class Brush extends BaseComponent {
103210
103211
  this._cacheInteractiveRangeAttrs.push(interactiveAttr);
103211
103212
  brush.addEventListener(IOperateType.brushActive, (e) => {
103212
103213
  this._initMarkBrushState(componentIndex, OUT_BRUSH_STATE);
103213
- this._emitEvent(ChartEvent.brushActive, region);
103214
+ this._emitEvent(ChartEvent.brushActive, region, e);
103214
103215
  });
103215
103216
  brush.addEventListener(IOperateType.drawStart, (e) => {
103216
103217
  this._setRegionMarkPickable(region, true);
103217
- this._emitEvent(ChartEvent.brushStart, region);
103218
+ this._emitEvent(ChartEvent.brushStart, region, e);
103218
103219
  });
103219
103220
  brush.addEventListener(IOperateType.moveStart, (e) => {
103220
103221
  this._setRegionMarkPickable(region, true);
103221
- this._emitEvent(ChartEvent.brushStart, region);
103222
+ this._emitEvent(ChartEvent.brushStart, region, e);
103222
103223
  });
103223
103224
  brush.addEventListener(IOperateType.drawing, (e) => {
103224
103225
  this._setRegionMarkPickable(region, false);
103225
103226
  this._handleBrushChange(region, e);
103226
- this._emitEvent(ChartEvent.brushChange, region);
103227
+ this._emitEvent(ChartEvent.brushChange, region, e);
103227
103228
  });
103228
103229
  brush.addEventListener(IOperateType.moving, (e) => {
103229
103230
  this._setRegionMarkPickable(region, false);
103230
103231
  this._handleBrushChange(region, e);
103231
- this._emitEvent(ChartEvent.brushChange, region);
103232
+ this._emitEvent(ChartEvent.brushChange, region, e);
103232
103233
  });
103233
103234
  brush.addEventListener(IOperateType.brushClear, (e) => {
103234
103235
  this._setRegionMarkPickable(region, true);
103235
103236
  this._initMarkBrushState(componentIndex, '');
103236
- this._emitEvent(ChartEvent.brushClear, region);
103237
+ this._emitEvent(ChartEvent.brushClear, region, e);
103237
103238
  });
103238
103239
  brush.addEventListener(IOperateType.drawEnd, (e) => {
103239
103240
  var _a;
@@ -103244,11 +103245,11 @@ class Brush extends BaseComponent {
103244
103245
  if (this._spec.onBrushEnd(e) === true) {
103245
103246
  this.clearGraphic();
103246
103247
  this._initMarkBrushState(componentIndex, '');
103247
- this._emitEvent(ChartEvent.brushClear, region);
103248
+ this._emitEvent(ChartEvent.brushClear, region, e);
103248
103249
  }
103249
103250
  else {
103250
103251
  this._spec.onBrushEnd(e);
103251
- this._emitEvent(ChartEvent.brushEnd, region);
103252
+ this._emitEvent(ChartEvent.brushEnd, region, e);
103252
103253
  }
103253
103254
  }
103254
103255
  else {
@@ -103256,7 +103257,7 @@ class Brush extends BaseComponent {
103256
103257
  if ((!this._spec.zoomWhenEmpty && inBrushData.length > 0) || !updateElementsState) {
103257
103258
  this._setAxisAndDataZoom(operateMask, region);
103258
103259
  }
103259
- this._emitEvent(ChartEvent.brushEnd, region);
103260
+ this._emitEvent(ChartEvent.brushEnd, region, e);
103260
103261
  }
103261
103262
  });
103262
103263
  brush.addEventListener(IOperateType.moveEnd, (e) => {
@@ -103267,7 +103268,7 @@ class Brush extends BaseComponent {
103267
103268
  if ((!this._spec.zoomWhenEmpty && inBrushData.length > 0) || updateElementsState) {
103268
103269
  this._setAxisAndDataZoom(operateMask, region);
103269
103270
  }
103270
- this._emitEvent(ChartEvent.brushEnd, region);
103271
+ this._emitEvent(ChartEvent.brushEnd, region, e);
103271
103272
  });
103272
103273
  }
103273
103274
  _getBrushInteractiveAttr(region) {
@@ -103330,7 +103331,7 @@ class Brush extends BaseComponent {
103330
103331
  }
103331
103332
  return data;
103332
103333
  }
103333
- _emitEvent(eventType, region) {
103334
+ _emitEvent(eventType, region, e) {
103334
103335
  var _a;
103335
103336
  this.event.emit(eventType, {
103336
103337
  model: this,
@@ -103347,7 +103348,8 @@ class Brush extends BaseComponent {
103347
103348
  linkedOutOfBrushElementsMap: this._linkedOutOfBrushElementsMap,
103348
103349
  zoomRecord: this._zoomRecord
103349
103350
  },
103350
- vchart: (_a = this._option) === null || _a === void 0 ? void 0 : _a.globalInstance
103351
+ vchart: (_a = this._option) === null || _a === void 0 ? void 0 : _a.globalInstance,
103352
+ event: e
103351
103353
  });
103352
103354
  }
103353
103355
  _reconfigItem(operateMask, region) {
package/build/index.js CHANGED
@@ -51102,6 +51102,7 @@
51102
51102
  let Brush$1 = class Brush extends AbstractComponent {
51103
51103
  constructor(attributes, options) {
51104
51104
  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 => {
51105
+ if (!1 === this._beforeBrushEvent(e)) return;
51105
51106
  const {
51106
51107
  updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger,
51107
51108
  endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger,
@@ -51109,11 +51110,11 @@
51109
51110
  } = this.attribute;
51110
51111
  array(updateTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushingWithDelay)), array(endTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushEnd)), e.stopPropagation(), this._firstUpdate = !0, this._activeMoveState = brushMoved && this._isPosInBrushMask(e), this._activeDrawState = !this._activeMoveState, this._startPos = this.eventPosToStagePos(e), this._cacheDrawPoints = [this._startPos];
51111
51112
  }, this._onBrushing = e => {
51112
- this._outOfInteractiveRange(e) || (e.stopPropagation(), this._firstUpdate ? (this._activeDrawState && this._initDraw(e), this._activeMoveState && this._initMove(e), this._firstUpdate = !1) : (this._activeDrawState && this._drawing(e), this._activeMoveState && this._moving(e)));
51113
+ !1 !== this._beforeBrushEvent(e) && (this._outOfInteractiveRange(e) || (e.stopPropagation(), this._firstUpdate ? (this._activeDrawState && this._initDraw(e), this._activeMoveState && this._initMove(e), this._firstUpdate = !1) : (this._activeDrawState && this._drawing(e), this._activeMoveState && this._moving(e))));
51113
51114
  }, this._onBrushingWithDelay = 0 === this.attribute.delayTime ? this._onBrushing : delayMap$1[this.attribute.delayType](this._onBrushing, this.attribute.delayTime), this._onBrushEnd = e => {
51114
51115
  this._releaseBrushUpdateEvents(), e.preventDefault(), this._activeDrawState && this._drawEnd(e), this._activeMoveState && this._moveEnd(e), this._activeDrawState = !1, this._activeMoveState = !1;
51115
51116
  }, this._onBrushClear = e => {
51116
- e.preventDefault(), this._isEmptyMask() || (this._clearMask(), this._dispatchBrushEvent(IOperateType.brushClear, e)), this._activeDrawState = !1, this._activeMoveState = !1;
51117
+ !1 !== this._beforeBrushEvent(e) && (e.preventDefault(), this._isEmptyMask() || (this._clearMask(), this._dispatchBrushEvent(IOperateType.brushClear, e)), this._activeDrawState = !1, this._activeMoveState = !1);
51117
51118
  };
51118
51119
  }
51119
51120
  _bindBrushEvents() {
@@ -51318,6 +51319,10 @@
51318
51319
  pos = this.eventPosToStagePos(e);
51319
51320
  return pos.x > maxX || pos.x < minX || pos.y > maxY || pos.y < minY;
51320
51321
  }
51322
+ _beforeBrushEvent(e) {
51323
+ var _a, _b;
51324
+ return null === (_b = (_a = this.attribute).beforeBrushChange) || void 0 === _b ? void 0 : _b.call(_a, e);
51325
+ }
51321
51326
  _dispatchBrushEvent(operateType, e) {
51322
51327
  this._dispatchEvent(operateType, {
51323
51328
  operateMask: this._operatingMask,
@@ -95665,15 +95670,11 @@
95665
95670
  });
95666
95671
  return originDatum;
95667
95672
  };
95668
- const transform = region.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse();
95669
95673
  const getMockEvent = (originPos) => {
95670
95674
  var _a, _b;
95671
95675
  const pos = bound(originPos);
95672
- const tempX = (_a = opt.x) !== null && _a !== void 0 ? _a : regionPos.x + pos.x;
95673
- const tempY = (_b = opt.y) !== null && _b !== void 0 ? _b : regionPos.y + pos.y;
95674
- const canvasPoint = { x: 0, y: 0 };
95675
- transform.transformPoint({ x: tempX, y: tempY }, canvasPoint);
95676
- const { x: canvasX, y: canvasY } = canvasPoint;
95676
+ const canvasX = (_a = opt.x) !== null && _a !== void 0 ? _a : regionPos.x + pos.x;
95677
+ const canvasY = (_b = opt.y) !== null && _b !== void 0 ? _b : regionPos.y + pos.y;
95677
95678
  return {
95678
95679
  canvasX,
95679
95680
  canvasY,
@@ -103216,30 +103217,30 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
103216
103217
  this._cacheInteractiveRangeAttrs.push(interactiveAttr);
103217
103218
  brush.addEventListener(IOperateType.brushActive, (e) => {
103218
103219
  this._initMarkBrushState(componentIndex, OUT_BRUSH_STATE);
103219
- this._emitEvent(exports.ChartEvent.brushActive, region);
103220
+ this._emitEvent(exports.ChartEvent.brushActive, region, e);
103220
103221
  });
103221
103222
  brush.addEventListener(IOperateType.drawStart, (e) => {
103222
103223
  this._setRegionMarkPickable(region, true);
103223
- this._emitEvent(exports.ChartEvent.brushStart, region);
103224
+ this._emitEvent(exports.ChartEvent.brushStart, region, e);
103224
103225
  });
103225
103226
  brush.addEventListener(IOperateType.moveStart, (e) => {
103226
103227
  this._setRegionMarkPickable(region, true);
103227
- this._emitEvent(exports.ChartEvent.brushStart, region);
103228
+ this._emitEvent(exports.ChartEvent.brushStart, region, e);
103228
103229
  });
103229
103230
  brush.addEventListener(IOperateType.drawing, (e) => {
103230
103231
  this._setRegionMarkPickable(region, false);
103231
103232
  this._handleBrushChange(region, e);
103232
- this._emitEvent(exports.ChartEvent.brushChange, region);
103233
+ this._emitEvent(exports.ChartEvent.brushChange, region, e);
103233
103234
  });
103234
103235
  brush.addEventListener(IOperateType.moving, (e) => {
103235
103236
  this._setRegionMarkPickable(region, false);
103236
103237
  this._handleBrushChange(region, e);
103237
- this._emitEvent(exports.ChartEvent.brushChange, region);
103238
+ this._emitEvent(exports.ChartEvent.brushChange, region, e);
103238
103239
  });
103239
103240
  brush.addEventListener(IOperateType.brushClear, (e) => {
103240
103241
  this._setRegionMarkPickable(region, true);
103241
103242
  this._initMarkBrushState(componentIndex, '');
103242
- this._emitEvent(exports.ChartEvent.brushClear, region);
103243
+ this._emitEvent(exports.ChartEvent.brushClear, region, e);
103243
103244
  });
103244
103245
  brush.addEventListener(IOperateType.drawEnd, (e) => {
103245
103246
  var _a;
@@ -103250,11 +103251,11 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
103250
103251
  if (this._spec.onBrushEnd(e) === true) {
103251
103252
  this.clearGraphic();
103252
103253
  this._initMarkBrushState(componentIndex, '');
103253
- this._emitEvent(exports.ChartEvent.brushClear, region);
103254
+ this._emitEvent(exports.ChartEvent.brushClear, region, e);
103254
103255
  }
103255
103256
  else {
103256
103257
  this._spec.onBrushEnd(e);
103257
- this._emitEvent(exports.ChartEvent.brushEnd, region);
103258
+ this._emitEvent(exports.ChartEvent.brushEnd, region, e);
103258
103259
  }
103259
103260
  }
103260
103261
  else {
@@ -103262,7 +103263,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
103262
103263
  if ((!this._spec.zoomWhenEmpty && inBrushData.length > 0) || !updateElementsState) {
103263
103264
  this._setAxisAndDataZoom(operateMask, region);
103264
103265
  }
103265
- this._emitEvent(exports.ChartEvent.brushEnd, region);
103266
+ this._emitEvent(exports.ChartEvent.brushEnd, region, e);
103266
103267
  }
103267
103268
  });
103268
103269
  brush.addEventListener(IOperateType.moveEnd, (e) => {
@@ -103273,7 +103274,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
103273
103274
  if ((!this._spec.zoomWhenEmpty && inBrushData.length > 0) || updateElementsState) {
103274
103275
  this._setAxisAndDataZoom(operateMask, region);
103275
103276
  }
103276
- this._emitEvent(exports.ChartEvent.brushEnd, region);
103277
+ this._emitEvent(exports.ChartEvent.brushEnd, region, e);
103277
103278
  });
103278
103279
  }
103279
103280
  _getBrushInteractiveAttr(region) {
@@ -103336,7 +103337,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
103336
103337
  }
103337
103338
  return data;
103338
103339
  }
103339
- _emitEvent(eventType, region) {
103340
+ _emitEvent(eventType, region, e) {
103340
103341
  var _a;
103341
103342
  this.event.emit(eventType, {
103342
103343
  model: this,
@@ -103353,7 +103354,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
103353
103354
  linkedOutOfBrushElementsMap: this._linkedOutOfBrushElementsMap,
103354
103355
  zoomRecord: this._zoomRecord
103355
103356
  },
103356
- vchart: (_a = this._option) === null || _a === void 0 ? void 0 : _a.globalInstance
103357
+ vchart: (_a = this._option) === null || _a === void 0 ? void 0 : _a.globalInstance,
103358
+ event: e
103357
103359
  });
103358
103360
  }
103359
103361
  _reconfigItem(operateMask, region) {