@visactor/vchart 1.3.0-beta.2 → 1.3.0-beta.4

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 (63) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.js +88 -50
  3. package/build/index.min.js +1 -1
  4. package/build/tsconfig.tsbuildinfo +1 -1
  5. package/cjs/component/axis/base-axis.d.ts +1 -0
  6. package/cjs/component/axis/base-axis.js +2 -1
  7. package/cjs/component/axis/base-axis.js.map +1 -1
  8. package/cjs/component/axis/cartesian/axis.js +6 -3
  9. package/cjs/component/axis/cartesian/axis.js.map +1 -1
  10. package/cjs/component/axis/cartesian/interface/common.d.ts +1 -0
  11. package/cjs/component/axis/cartesian/interface/common.js.map +1 -1
  12. package/cjs/component/label/interface.d.ts +3 -0
  13. package/cjs/component/label/interface.js.map +1 -1
  14. package/cjs/component/label/label.js +4 -8
  15. package/cjs/component/label/label.js.map +1 -1
  16. package/cjs/component/tooltip/tooltip.js +4 -1
  17. package/cjs/component/tooltip/tooltip.js.map +1 -1
  18. package/cjs/core/index.d.ts +1 -1
  19. package/cjs/core/index.js +1 -1
  20. package/cjs/core/index.js.map +1 -1
  21. package/cjs/core/interface.d.ts +3 -0
  22. package/cjs/core/interface.js.map +1 -1
  23. package/cjs/core/vchart.d.ts +3 -0
  24. package/cjs/core/vchart.js +12 -0
  25. package/cjs/core/vchart.js.map +1 -1
  26. package/cjs/event/events/dimension/dimension-click.d.ts +1 -3
  27. package/cjs/event/events/dimension/dimension-click.js +9 -10
  28. package/cjs/event/events/dimension/dimension-click.js.map +1 -1
  29. package/cjs/event/events/dimension/dimension-hover.d.ts +2 -3
  30. package/cjs/event/events/dimension/dimension-hover.js +26 -17
  31. package/cjs/event/events/dimension/dimension-hover.js.map +1 -1
  32. package/cjs/model/layout-item.d.ts +4 -4
  33. package/cjs/model/layout-item.js.map +1 -1
  34. package/esm/component/axis/base-axis.d.ts +1 -0
  35. package/esm/component/axis/base-axis.js +2 -1
  36. package/esm/component/axis/base-axis.js.map +1 -1
  37. package/esm/component/axis/cartesian/axis.js +7 -4
  38. package/esm/component/axis/cartesian/axis.js.map +1 -1
  39. package/esm/component/axis/cartesian/interface/common.d.ts +1 -0
  40. package/esm/component/axis/cartesian/interface/common.js.map +1 -1
  41. package/esm/component/label/interface.d.ts +3 -0
  42. package/esm/component/label/interface.js.map +1 -1
  43. package/esm/component/label/label.js +4 -7
  44. package/esm/component/label/label.js.map +1 -1
  45. package/esm/component/tooltip/tooltip.js +4 -1
  46. package/esm/component/tooltip/tooltip.js.map +1 -1
  47. package/esm/core/index.d.ts +1 -1
  48. package/esm/core/index.js +1 -1
  49. package/esm/core/index.js.map +1 -1
  50. package/esm/core/interface.d.ts +3 -0
  51. package/esm/core/interface.js.map +1 -1
  52. package/esm/core/vchart.d.ts +3 -0
  53. package/esm/core/vchart.js +12 -0
  54. package/esm/core/vchart.js.map +1 -1
  55. package/esm/event/events/dimension/dimension-click.d.ts +1 -3
  56. package/esm/event/events/dimension/dimension-click.js +9 -10
  57. package/esm/event/events/dimension/dimension-click.js.map +1 -1
  58. package/esm/event/events/dimension/dimension-hover.d.ts +2 -3
  59. package/esm/event/events/dimension/dimension-hover.js +25 -16
  60. package/esm/event/events/dimension/dimension-hover.js.map +1 -1
  61. package/esm/model/layout-item.d.ts +4 -4
  62. package/esm/model/layout-item.js.map +1 -1
  63. package/package.json +1 -1
package/build/index.js CHANGED
@@ -532,6 +532,18 @@
532
532
  return target;
533
533
  }
534
534
 
535
+ function pickWithout(obj, keys) {
536
+ if (!obj || !isPlainObject(obj)) return obj;
537
+ const result = {};
538
+ return Object.keys(obj).forEach(k => {
539
+ const v = obj[k];
540
+ let match = !1;
541
+ keys.forEach(itKey => {
542
+ (isString(itKey) && itKey === k || itKey instanceof RegExp && k.match(itKey)) && (match = !0);
543
+ }), match || (result[k] = v);
544
+ }), result;
545
+ }
546
+
535
547
  function objToString(obj) {
536
548
  return Object.prototype.toString.call(obj);
537
549
  }
@@ -56086,9 +56098,20 @@
56086
56098
  }
56087
56099
 
56088
56100
  class DimensionClickEvent extends DimensionEvent {
56089
- constructor(eventDispatcher, mode) {
56090
- super(eventDispatcher, mode);
56091
- this.onClick = this.onClick.bind(this);
56101
+ constructor() {
56102
+ super(...arguments);
56103
+ this.onClick = (params) => {
56104
+ if (!params) {
56105
+ return;
56106
+ }
56107
+ const x = params.event.viewX;
56108
+ const y = params.event.viewY;
56109
+ const targetDimensionInfo = this.getTargetDimensionInfo(x, y);
56110
+ if (!targetDimensionInfo) {
56111
+ return;
56112
+ }
56113
+ this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'click', dimensionInfo: [...targetDimensionInfo] }));
56114
+ };
56092
56115
  }
56093
56116
  register(eType, handler) {
56094
56117
  this._callback = handler.callback;
@@ -56103,25 +56126,41 @@
56103
56126
  callback: this.onClick
56104
56127
  });
56105
56128
  }
56106
- onClick(params) {
56107
- if (!params) {
56108
- return;
56109
- }
56110
- const x = params.event.viewX;
56111
- const y = params.event.viewY;
56112
- const targetDimensionInfo = this.getTargetDimensionInfo(x, y);
56113
- if (!targetDimensionInfo) {
56114
- return;
56115
- }
56116
- this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'click', dimensionInfo: [...targetDimensionInfo] }));
56117
- }
56118
56129
  }
56119
56130
 
56120
56131
  class DimensionHoverEvent extends DimensionEvent {
56121
- constructor(eventDispatcher, mode) {
56122
- super(eventDispatcher, mode);
56132
+ constructor() {
56133
+ super(...arguments);
56123
56134
  this._cacheDimensionInfo = null;
56124
- this.onMouseMove = this.onMouseMove.bind(this);
56135
+ this.onMouseMove = (params) => {
56136
+ if (!params) {
56137
+ return;
56138
+ }
56139
+ const x = params.event.viewX;
56140
+ const y = params.event.viewY;
56141
+ const targetDimensionInfo = this.getTargetDimensionInfo(x, y);
56142
+ if (targetDimensionInfo === null && this._cacheDimensionInfo !== null) {
56143
+ this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'leave', dimensionInfo: [...this._cacheDimensionInfo] }));
56144
+ this._cacheDimensionInfo = targetDimensionInfo;
56145
+ }
56146
+ else if (targetDimensionInfo !== null &&
56147
+ (this._cacheDimensionInfo === null ||
56148
+ targetDimensionInfo.length !== this._cacheDimensionInfo.length ||
56149
+ targetDimensionInfo.some((info, i) => !isSameDimensionInfo(info, this._cacheDimensionInfo[i])))) {
56150
+ this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'enter', dimensionInfo: [...targetDimensionInfo] }));
56151
+ this._cacheDimensionInfo = targetDimensionInfo;
56152
+ }
56153
+ else if (targetDimensionInfo !== null) {
56154
+ this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'move', dimensionInfo: [...targetDimensionInfo] }));
56155
+ }
56156
+ };
56157
+ this.onMouseOut = (params) => {
56158
+ if (!params) {
56159
+ return;
56160
+ }
56161
+ this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'leave', dimensionInfo: this._cacheDimensionInfo ? [...this._cacheDimensionInfo] : [] }));
56162
+ this._cacheDimensionInfo = null;
56163
+ };
56125
56164
  }
56126
56165
  register(eType, handler) {
56127
56166
  this._callback = handler.callback;
@@ -56129,6 +56168,10 @@
56129
56168
  query: Object.assign(Object.assign({}, handler.query), { source: Event_Source_Type.chart }),
56130
56169
  callback: this.onMouseMove
56131
56170
  });
56171
+ this._eventDispatcher.register('pointerout', {
56172
+ query: Object.assign(Object.assign({}, handler.query), { source: Event_Source_Type.chart }),
56173
+ callback: this.onMouseOut
56174
+ });
56132
56175
  if (isMobileLikeMode(this._mode)) {
56133
56176
  this._eventDispatcher.register('pointerdown', {
56134
56177
  query: Object.assign(Object.assign({}, handler.query), { source: Event_Source_Type.chart }),
@@ -56148,28 +56191,6 @@
56148
56191
  });
56149
56192
  }
56150
56193
  }
56151
- onMouseMove(params) {
56152
- if (!params) {
56153
- return;
56154
- }
56155
- const x = params.event.viewX;
56156
- const y = params.event.viewY;
56157
- const targetDimensionInfo = this.getTargetDimensionInfo(x, y);
56158
- if (targetDimensionInfo === null && this._cacheDimensionInfo !== null) {
56159
- this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'leave', dimensionInfo: [...this._cacheDimensionInfo] }));
56160
- this._cacheDimensionInfo = targetDimensionInfo;
56161
- }
56162
- else if (targetDimensionInfo !== null &&
56163
- (this._cacheDimensionInfo === null ||
56164
- targetDimensionInfo.length !== this._cacheDimensionInfo.length ||
56165
- targetDimensionInfo.some((info, i) => !isSameDimensionInfo(info, this._cacheDimensionInfo[i])))) {
56166
- this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'enter', dimensionInfo: [...targetDimensionInfo] }));
56167
- this._cacheDimensionInfo = targetDimensionInfo;
56168
- }
56169
- else if (targetDimensionInfo !== null) {
56170
- this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'move', dimensionInfo: [...targetDimensionInfo] }));
56171
- }
56172
- }
56173
56194
  }
56174
56195
 
56175
56196
  var DimensionEventEnum;
@@ -57860,6 +57881,18 @@
57860
57881
  var _a;
57861
57882
  return (_a = this._chart) === null || _a === void 0 ? void 0 : _a.setDimensionIndex(value, opt);
57862
57883
  }
57884
+ stopAnimation() {
57885
+ var _a, _b, _c;
57886
+ (_c = (_b = (_a = this._compiler) === null || _a === void 0 ? void 0 : _a.getVGrammarView()) === null || _b === void 0 ? void 0 : _b.animate) === null || _c === void 0 ? void 0 : _c.stop();
57887
+ }
57888
+ pauseAnimation() {
57889
+ var _a, _b, _c;
57890
+ (_c = (_b = (_a = this._compiler) === null || _a === void 0 ? void 0 : _a.getVGrammarView()) === null || _b === void 0 ? void 0 : _b.animate) === null || _c === void 0 ? void 0 : _c.pause();
57891
+ }
57892
+ resumeAnimation() {
57893
+ var _a, _b, _c;
57894
+ (_c = (_b = (_a = this._compiler) === null || _a === void 0 ? void 0 : _a.getVGrammarView()) === null || _b === void 0 ? void 0 : _b.animate) === null || _c === void 0 ? void 0 : _c.resume();
57895
+ }
57863
57896
  convertDatumToPosition(datum, dataLinkInfo = {}, isRelativeToCanvas = false) {
57864
57897
  var _a;
57865
57898
  if (!this._chart) {
@@ -60687,7 +60720,7 @@
60687
60720
  VChart.useMark([ComponentMark, GroupMark, ImageMark]);
60688
60721
  Factory.registerRegion('region', Region);
60689
60722
  Factory.registerLayout('base', Layout);
60690
- const version = "1.3.0-beta.2";
60723
+ const version = "1.3.0-beta.4";
60691
60724
  Logger.getInstance(LoggerLevel.Error);
60692
60725
 
60693
60726
  var SeriesMarkNameEnum;
@@ -82924,7 +82957,8 @@
82924
82957
  autoHideSeparation: spec.label.autoHideSeparation,
82925
82958
  limitEllipsis: spec.label.limitEllipsis,
82926
82959
  layoutFunc: spec.label.layoutFunc,
82927
- dataFilter: spec.label.dataFilter
82960
+ dataFilter: spec.label.dataFilter,
82961
+ containerAlign: spec.label.containerAlign
82928
82962
  },
82929
82963
  tick: {
82930
82964
  visible: spec.tick.visible,
@@ -83210,11 +83244,11 @@
83210
83244
  super.setAttrFromSpec();
83211
83245
  const isX = isXAxis(this.orient);
83212
83246
  if (isX) {
83213
- if (isNil(this._spec.maxHeight)) {
83247
+ if (isUndefined(this._spec.maxHeight)) {
83214
83248
  this._spec.maxHeight = '30%';
83215
83249
  }
83216
83250
  }
83217
- else if (isNil(this._spec.maxWidth)) {
83251
+ else if (isUndefined(this._spec.maxWidth)) {
83218
83252
  this._spec.maxWidth = '30%';
83219
83253
  }
83220
83254
  const axisStyle = this._getAxisAttributes();
@@ -83569,6 +83603,11 @@
83569
83603
  items: this.getLabelItems(width)
83570
83604
  };
83571
83605
  }
83606
+ let verticalMinSize = isX ? this._minHeight : this._minWidth;
83607
+ if ((isX && this._layoutRectLevelMap.height === USER_LAYOUT_RECT_LEVEL) ||
83608
+ (isY && this._layoutRectLevelMap.width === USER_LAYOUT_RECT_LEVEL)) {
83609
+ verticalMinSize = this._verticalLimitSize;
83610
+ }
83572
83611
  const attrs = {
83573
83612
  start: { x: 0, y: 0 },
83574
83613
  end,
@@ -83583,7 +83622,8 @@
83583
83622
  maxWidth: this._getTitleLimit(isX)
83584
83623
  },
83585
83624
  items: this.getLabelItems(axisLength),
83586
- verticalLimitSize: this._verticalLimitSize
83625
+ verticalLimitSize: this._verticalLimitSize,
83626
+ verticalMinSize
83587
83627
  };
83588
83628
  return attrs;
83589
83629
  }
@@ -90286,6 +90326,7 @@
90286
90326
  this._mountEvent('pointerdown', { level: Event_Bubble_Level.chart }, this._handleMouseMove);
90287
90327
  this._mountEvent('pointerup', { source: 'window' }, this._handleMouseOut);
90288
90328
  }
90329
+ this._mountEvent('pointerout', { level: Event_Bubble_Level.chart, source: 'chart' }, this._handleMouseOut);
90289
90330
  this._mountEvent('pointermove', { source: 'window' }, this._handleMouseOut);
90290
90331
  }
90291
90332
  else if (trigger === 'click') {
@@ -90678,14 +90719,11 @@
90678
90719
  if (baseMark) {
90679
90720
  const configFunc = (_a = markLabelConfigFunc[baseMark.type]) !== null && _a !== void 0 ? _a : markLabelConfigFunc.symbol;
90680
90721
  const labelSpec = (_b = baseMark.getLabelSpec()) !== null && _b !== void 0 ? _b : {};
90681
- const { smartInvert, offset, overlap, animation } = labelSpec;
90682
90722
  const interactive = this._interactiveConfig(labelSpec);
90723
+ const passiveLabelSpec = pickWithout(labelSpec, ['position', 'style', 'state']);
90683
90724
  return merge$2({
90684
90725
  textStyle: { pickable: labelSpec.interactive === true }
90685
- }, configFunc(labelInfo[baseMarks.findIndex(mark => mark === baseMark)]), Object.assign({ smartInvert,
90686
- offset,
90687
- animation,
90688
- overlap }, interactive));
90726
+ }, configFunc(labelInfo[baseMarks.findIndex(mark => mark === baseMark)]), Object.assign(Object.assign({}, passiveLabelSpec), interactive));
90689
90727
  }
90690
90728
  })
90691
90729
  .encode((datum, element) => {