@visactor/vrender-components 0.15.3 → 0.16.0-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 (49) hide show
  1. package/cjs/brush/brush.d.ts +0 -5
  2. package/cjs/brush/brush.js +14 -18
  3. package/cjs/brush/brush.js.map +1 -1
  4. package/cjs/brush/config.d.ts +0 -5
  5. package/cjs/brush/config.js +0 -5
  6. package/cjs/brush/config.js.map +1 -1
  7. package/cjs/brush/type.d.ts +1 -6
  8. package/cjs/brush/type.js.map +1 -1
  9. package/cjs/data-zoom/data-zoom.d.ts +0 -1
  10. package/cjs/data-zoom/data-zoom.js +3 -14
  11. package/cjs/data-zoom/data-zoom.js.map +1 -1
  12. package/cjs/index.d.ts +1 -1
  13. package/cjs/index.js +1 -1
  14. package/cjs/index.js.map +1 -1
  15. package/cjs/label/arc.js +12 -24
  16. package/cjs/label/arc.js.map +1 -1
  17. package/cjs/poptip/contribution.js +2 -2
  18. package/cjs/poptip/contribution.js.map +1 -1
  19. package/cjs/poptip/poptip-plugin.js +3 -3
  20. package/cjs/poptip/poptip-plugin.js.map +1 -1
  21. package/cjs/poptip/register.d.ts +1 -1
  22. package/cjs/poptip/register.js +2 -2
  23. package/cjs/poptip/register.js.map +1 -1
  24. package/dist/index.js +40 -98
  25. package/dist/index.min.js +1 -1
  26. package/es/brush/brush.d.ts +0 -5
  27. package/es/brush/brush.js +14 -17
  28. package/es/brush/brush.js.map +1 -1
  29. package/es/brush/config.d.ts +0 -5
  30. package/es/brush/config.js +0 -5
  31. package/es/brush/config.js.map +1 -1
  32. package/es/brush/type.d.ts +1 -6
  33. package/es/brush/type.js.map +1 -1
  34. package/es/data-zoom/data-zoom.d.ts +0 -1
  35. package/es/data-zoom/data-zoom.js +4 -15
  36. package/es/data-zoom/data-zoom.js.map +1 -1
  37. package/es/index.d.ts +1 -1
  38. package/es/index.js +1 -1
  39. package/es/index.js.map +1 -1
  40. package/es/label/arc.js +8 -20
  41. package/es/label/arc.js.map +1 -1
  42. package/es/poptip/contribution.js +1 -1
  43. package/es/poptip/contribution.js.map +1 -1
  44. package/es/poptip/poptip-plugin.js +1 -3
  45. package/es/poptip/poptip-plugin.js.map +1 -1
  46. package/es/poptip/register.d.ts +1 -1
  47. package/es/poptip/register.js +1 -3
  48. package/es/poptip/register.js.map +1 -1
  49. package/package.json +7 -6
package/dist/index.js CHANGED
@@ -896,35 +896,6 @@
896
896
  padding: 10
897
897
  };
898
898
 
899
- var PARAM_TYPES = "inversify:paramtypes";
900
- var DESIGN_PARAM_TYPES = "design:paramtypes";
901
-
902
- var idCounter = 0;
903
- function id() {
904
- return idCounter++;
905
- }
906
-
907
- var DUPLICATED_INJECTABLE_DECORATOR = "Cannot apply @injectable decorator multiple times.";
908
-
909
- var ContainerModule = function () {
910
- function ContainerModule(registry) {
911
- this.id = id();
912
- this.registry = registry;
913
- }
914
- return ContainerModule;
915
- }();
916
-
917
- function injectable() {
918
- return function (target) {
919
- if (Reflect.hasOwnMetadata(PARAM_TYPES, target)) {
920
- throw new Error(DUPLICATED_INJECTABLE_DECORATOR);
921
- }
922
- var types = Reflect.getMetadata(DESIGN_PARAM_TYPES, target) || [];
923
- Reflect.defineMetadata(PARAM_TYPES, types, target);
924
- return target;
925
- };
926
- }
927
-
928
899
  const DEFAULT_THEME = {
929
900
  visible: true,
930
901
  position: 'auto',
@@ -995,7 +966,7 @@
995
966
  }
996
967
  };
997
968
  PopTipRenderContribution = __decorate([
998
- injectable()
969
+ vrender.injectable()
999
970
  ], PopTipRenderContribution);
1000
971
 
1001
972
  let PopTipPlugin = class PopTipPlugin {
@@ -1048,7 +1019,7 @@
1048
1019
  }
1049
1020
  };
1050
1021
  PopTipPlugin = __decorate([
1051
- injectable()
1022
+ vrender.injectable()
1052
1023
  ], PopTipPlugin);
1053
1024
  let PopTipForClipedTextPlugin = class PopTipForClipedTextPlugin {
1054
1025
  constructor() {
@@ -1100,10 +1071,10 @@
1100
1071
  }
1101
1072
  };
1102
1073
  PopTipForClipedTextPlugin = __decorate([
1103
- injectable()
1074
+ vrender.injectable()
1104
1075
  ], PopTipForClipedTextPlugin);
1105
1076
 
1106
- const popTipModule = new ContainerModule((bind, unbind, isBound, rebind) => {
1077
+ const popTipModule = new vrender.ContainerModule((bind, unbind, isBound, rebind) => {
1107
1078
  if (!isBound(PopTipRenderContribution)) {
1108
1079
  bind(PopTipRenderContribution).toSelf().inSingletonScope();
1109
1080
  bind(vrender.InteractiveSubRenderContribution).toService(PopTipRenderContribution);
@@ -2473,7 +2444,7 @@
2473
2444
  const arcs = this.layoutArcLabels(this.attribute.position, this.attribute, Array.from(this._idToGraphic.values()), data, textBoundsArray, ellipsisWidth);
2474
2445
  for (let i = 0; i < data.length; i++) {
2475
2446
  const textData = data[i];
2476
- const basedArc = arcs.find(arc => { var _a; return ((_a = arc.refDatum) === null || _a === void 0 ? void 0 : _a.id) === textData.id; });
2447
+ const basedArc = arcs.find(arc => arc.refDatum.id === textData.id);
2477
2448
  const labelAttribute = {
2478
2449
  visible: basedArc.labelVisible,
2479
2450
  x: basedArc.labelPosition.x,
@@ -2503,26 +2474,24 @@
2503
2474
  var _a, _b;
2504
2475
  const graphicAttribute = currentMark.attribute;
2505
2476
  const center = { x: (_a = graphicAttribute === null || graphicAttribute === void 0 ? void 0 : graphicAttribute.x) !== null && _a !== void 0 ? _a : 0, y: (_b = graphicAttribute === null || graphicAttribute === void 0 ? void 0 : graphicAttribute.y) !== null && _b !== void 0 ? _b : 0 };
2506
- if (!vutils.isNil(data[index]) && !vutils.isNil(textBoundsArray[index])) {
2507
- const item = data[index] ? data[index] : null;
2508
- const textBounds = textBoundsArray[index] ? textBoundsArray[index] : { x1: 0, x2: 0, y1: 0, y2: 0 };
2509
- const arcMiddleAngle = (graphicAttribute.startAngle + graphicAttribute.endAngle) / 2;
2510
- const intervalAngle = graphicAttribute.endAngle - graphicAttribute.startAngle;
2511
- const arcQuadrant = computeQuadrant(graphicAttribute.endAngle - intervalAngle / 2);
2512
- const arcMiddle = circlePoint(center.x, center.y, graphicAttribute.outerRadius, arcMiddleAngle);
2513
- const outerArcMiddle = circlePoint(center.x, center.y, maxRadius + attribute.line.line1MinLength, arcMiddleAngle);
2514
- const arc = new ArcInfo(item, arcMiddle, outerArcMiddle, arcQuadrant, intervalAngle, arcMiddleAngle, graphicAttribute.innerRadius, graphicAttribute.outerRadius, center);
2515
- arc.pointA = circlePoint(center.x, center.y, this.computeDatumRadius(center.x * 2, center.y * 2, graphicAttribute.outerRadius), arc.middleAngle);
2516
- arc.labelSize = {
2517
- width: textBounds.x2 - textBounds.x1,
2518
- height: textBounds.y2 - textBounds.y1
2519
- };
2520
- if (isQuadrantRight(arc.quadrant)) {
2521
- this._arcRight.set(arc.refDatum, arc);
2522
- }
2523
- else if (isQuadrantLeft(arc.quadrant)) {
2524
- this._arcLeft.set(arc.refDatum, arc);
2525
- }
2477
+ const item = data[index];
2478
+ const textBounds = textBoundsArray[index];
2479
+ const arcMiddleAngle = (graphicAttribute.startAngle + graphicAttribute.endAngle) / 2;
2480
+ const intervalAngle = graphicAttribute.endAngle - graphicAttribute.startAngle;
2481
+ const arcQuadrant = computeQuadrant(graphicAttribute.endAngle - intervalAngle / 2);
2482
+ const arcMiddle = circlePoint(center.x, center.y, graphicAttribute.outerRadius, arcMiddleAngle);
2483
+ const outerArcMiddle = circlePoint(center.x, center.y, maxRadius + attribute.line.line1MinLength, arcMiddleAngle);
2484
+ const arc = new ArcInfo(item, arcMiddle, outerArcMiddle, arcQuadrant, intervalAngle, arcMiddleAngle, graphicAttribute.innerRadius, graphicAttribute.outerRadius, center);
2485
+ arc.pointA = circlePoint(center.x, center.y, this.computeDatumRadius(center.x * 2, center.y * 2, graphicAttribute.outerRadius), arc.middleAngle);
2486
+ arc.labelSize = {
2487
+ width: textBounds.x2 - textBounds.x1,
2488
+ height: textBounds.y2 - textBounds.y1
2489
+ };
2490
+ if (isQuadrantRight(arc.quadrant)) {
2491
+ this._arcRight.set(arc.refDatum, arc);
2492
+ }
2493
+ else if (isQuadrantLeft(arc.quadrant)) {
2494
+ this._arcLeft.set(arc.refDatum, arc);
2526
2495
  }
2527
2496
  });
2528
2497
  const leftArcs = Array.from(this._arcLeft.values());
@@ -2729,8 +2698,7 @@
2729
2698
  return vutils.isNil(textAlign) || textAlign === 'auto' ? 'center' : textAlign;
2730
2699
  }
2731
2700
  _getFormatLabelText(value, limit) {
2732
- var _a;
2733
- return (_a = value === null || value === void 0 ? void 0 : value.text) !== null && _a !== void 0 ? _a : '';
2701
+ return value.text;
2734
2702
  }
2735
2703
  _adjustY(arcs, maxLabels, attribute, currentMarks) {
2736
2704
  var _a, _b, _c, _d;
@@ -5526,7 +5494,6 @@
5526
5494
  end: this.state.end
5527
5495
  });
5528
5496
  this._updateStateCallback && this._updateStateCallback(this.state.start, this.state.end);
5529
- this._dispatchChangeEvent(this.state.start, this.state.end);
5530
5497
  }
5531
5498
  };
5532
5499
  const { start, end, size, orient, showDetail, position, previewData, previewCallbackX, previewCallbackY, previewCallbackX1, previewCallbackY1, updateStateCallback } = this.attribute;
@@ -5626,7 +5593,6 @@
5626
5593
  end: this.state.end
5627
5594
  });
5628
5595
  this._updateStateCallback && this._updateStateCallback(this.state.start, this.state.end);
5629
- this._dispatchChangeEvent(this.state.start, this.state.end);
5630
5596
  }
5631
5597
  }
5632
5598
  _onHandlerPointerEnter(e) {
@@ -5986,15 +5952,6 @@
5986
5952
  container.add(labelShape);
5987
5953
  return labelShape;
5988
5954
  }
5989
- _dispatchChangeEvent(start, end) {
5990
- var _a;
5991
- const changeEvent = new vrender.CustomEvent('change', {
5992
- start,
5993
- end
5994
- });
5995
- changeEvent.manager = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventSystem.manager;
5996
- this.dispatchEvent(changeEvent);
5997
- }
5998
5955
  setStartAndEnd(start, end) {
5999
5956
  const { start: startAttr, end: endAttr } = this.attribute;
6000
5957
  if (vutils.isValid(start) && vutils.isValid(end) && (start !== this.state.start || end !== this.state.end)) {
@@ -6003,7 +5960,6 @@
6003
5960
  if (startAttr !== this.state.start || endAttr !== this.state.end) {
6004
5961
  this.setAttributes({ start, end });
6005
5962
  this._updateStateCallback && this._updateStateCallback(start, end);
6006
- this._dispatchChangeEvent(start, end);
6007
5963
  }
6008
5964
  }
6009
5965
  }
@@ -9796,11 +9752,6 @@
9796
9752
  })(exports.IOperateType || (exports.IOperateType = {}));
9797
9753
 
9798
9754
  const DEFAULT_BRUSH_ATTRIBUTES = {
9799
- trigger: 'pointerdown',
9800
- updateTrigger: 'pointermove',
9801
- endTrigger: 'pointerup',
9802
- resetTrigger: 'pointerupoutside',
9803
- hasMask: true,
9804
9755
  brushMode: 'single',
9805
9756
  brushType: 'rect',
9806
9757
  brushStyle: {
@@ -9862,7 +9813,6 @@
9862
9813
  const { removeOnClick = true } = this.attribute;
9863
9814
  if (this._activeDrawState && !this._isDrawedBeforeEnd && removeOnClick) {
9864
9815
  this._container.incrementalClearChild();
9865
- this._brushMaskAABBBoundsDict = {};
9866
9816
  this._updateDragMaskCallback &&
9867
9817
  this._updateDragMaskCallback({
9868
9818
  operateType: exports.IOperateType.brushClear,
@@ -9885,11 +9835,11 @@
9885
9835
  };
9886
9836
  }
9887
9837
  bindBrushEvents() {
9888
- const { delayType = 'throttle', delayTime = 0, trigger = DEFAULT_BRUSH_ATTRIBUTES.trigger, updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger, endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger, resetTrigger = DEFAULT_BRUSH_ATTRIBUTES.resetTrigger } = this.attribute;
9889
- this.stage.addEventListener(trigger, this._onBrushStart);
9890
- this.stage.addEventListener(updateTrigger, delayMap[delayType](this._onBrushing, delayTime));
9891
- this.stage.addEventListener(endTrigger, this._onBrushEnd);
9892
- this.stage.addEventListener(resetTrigger, this._onBrushEnd);
9838
+ const { delayType = 'throttle', delayTime = 0 } = this.attribute;
9839
+ this.stage.addEventListener('pointerdown', this._onBrushStart);
9840
+ this.stage.addEventListener('pointermove', delayMap[delayType](this._onBrushing, delayTime));
9841
+ this.stage.addEventListener('pointerup', this._onBrushEnd);
9842
+ this.stage.addEventListener('pointerupoutside', this._onBrushEnd);
9893
9843
  }
9894
9844
  _isPosInBrushMask(e) {
9895
9845
  const pos = this.eventPosToStagePos(e);
@@ -9915,7 +9865,6 @@
9915
9865
  this._cacheDrawPoints = [pos];
9916
9866
  this._isDrawedBeforeEnd = false;
9917
9867
  if (brushMode === 'single') {
9918
- this._brushMaskAABBBoundsDict = {};
9919
9868
  this._container.incrementalClearChild();
9920
9869
  }
9921
9870
  this._addBrushMask();
@@ -9952,21 +9901,15 @@
9952
9901
  var _a;
9953
9902
  const pos = this.eventPosToStagePos(e);
9954
9903
  const { x1 = 0, x2 = 0, y1 = 0, y2 = 0 } = (_a = this._operatingMask) === null || _a === void 0 ? void 0 : _a._AABBBounds;
9955
- const { sizeThreshold = DEFAULT_SIZE_THRESHOLD, brushType } = this.attribute;
9956
- const cacheLength = this._cacheDrawPoints.length;
9904
+ const { sizeThreshold = DEFAULT_SIZE_THRESHOLD } = this.attribute;
9957
9905
  this._isDrawedBeforeEnd = !!(Math.abs(x2 - x1) > sizeThreshold || Math.abs(y1 - y2) > sizeThreshold);
9958
- if (cacheLength > 0) {
9906
+ if (this._cacheDrawPoints.length > 0) {
9959
9907
  const lastPos = this._cacheDrawPoints[this._cacheDrawPoints.length - 1];
9960
9908
  if (pos.x === (lastPos === null || lastPos === void 0 ? void 0 : lastPos.x) && pos.y === (lastPos === null || lastPos === void 0 ? void 0 : lastPos.y)) {
9961
9909
  return;
9962
9910
  }
9963
9911
  }
9964
- if (brushType === 'polygon' || cacheLength <= 1) {
9965
- this._cacheDrawPoints.push(pos);
9966
- }
9967
- else {
9968
- this._cacheDrawPoints[cacheLength - 1] = pos;
9969
- }
9912
+ this._cacheDrawPoints.push(pos);
9970
9913
  const maskPoints = this._computeMaskPoints();
9971
9914
  this._operatingMask.setAttribute('points', maskPoints);
9972
9915
  this._brushMaskAABBBoundsDict[this._operatingMask.name] = this._operatingMask.AABBBounds;
@@ -10066,9 +10009,8 @@
10066
10009
  return maskPoints;
10067
10010
  }
10068
10011
  _addBrushMask() {
10069
- var _a;
10070
- const { brushStyle, hasMask } = this.attribute;
10071
- const brushMask = vrender.createPolygon(Object.assign(Object.assign({ points: vutils.cloneDeep(this._cacheDrawPoints), cursor: 'move', pickable: false }, brushStyle), { opacity: hasMask ? (_a = brushStyle.opacity) !== null && _a !== void 0 ? _a : 1 : 0 }));
10012
+ const { brushStyle } = this.attribute;
10013
+ const brushMask = vrender.createPolygon(Object.assign({ points: vutils.cloneDeep(this._cacheDrawPoints), cursor: 'move', pickable: false }, brushStyle));
10072
10014
  brushMask.name = `brush-${Date.now()}`;
10073
10015
  this._operatingMask = brushMask;
10074
10016
  this._container.add(brushMask);
@@ -10100,11 +10042,11 @@
10100
10042
  vutils.isFunction(callback) && (this._updateDragMaskCallback = callback);
10101
10043
  }
10102
10044
  releaseBrushEvents() {
10103
- const { delayType = 'throttle', delayTime = 0, trigger = DEFAULT_BRUSH_ATTRIBUTES.trigger, updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger, endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger, resetTrigger = DEFAULT_BRUSH_ATTRIBUTES.resetTrigger } = this.attribute;
10104
- this.stage.removeEventListener(trigger, this._onBrushStart);
10105
- this.stage.removeEventListener(updateTrigger, delayMap[delayType](this._onBrushing, delayTime));
10106
- this.stage.removeEventListener(endTrigger, this._onBrushEnd);
10107
- this.stage.removeEventListener(resetTrigger, this._onBrushEnd);
10045
+ const { delayType = 'throttle', delayTime = 0 } = this.attribute;
10046
+ this.stage.removeEventListener('pointerdown', this._onBrushStart);
10047
+ this.stage.removeEventListener('pointermove', delayMap[delayType](this._onBrushing, delayTime));
10048
+ this.stage.removeEventListener('pointerup', this._onBrushEnd);
10049
+ this.stage.removeEventListener('pointerupoutside', this._onBrushEnd);
10108
10050
  }
10109
10051
  }
10110
10052
  Brush.defaultAttributes = DEFAULT_BRUSH_ATTRIBUTES;
@@ -10495,7 +10437,7 @@
10495
10437
  return new Tag(params ? params.attribute : {});
10496
10438
  }
10497
10439
 
10498
- const version = "0.15.3";
10440
+ const version = "0.16.0-alpha.1";
10499
10441
 
10500
10442
  exports.AbstractComponent = AbstractComponent;
10501
10443
  exports.ArcInfo = ArcInfo;