@visactor/vchart-extension 2.0.1-alpha.2 → 2.0.1-alpha.3

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.
package/build/index.js CHANGED
@@ -2989,6 +2989,7 @@
2989
2989
  options: {
2990
2990
  direction: 'y',
2991
2991
  orient: 'negative',
2992
+ excludeChannels: ['x'],
2992
2993
  point: (datum, graphic) => {
2993
2994
  const channelAttr = graphic.getGraphicAttribute('y');
2994
2995
  const barSpace = spec.height / (spec.pageSize + 1);
@@ -3009,7 +3010,7 @@
3009
3010
  options: {
3010
3011
  direction: 'y',
3011
3012
  orient: 'negative',
3012
- excludeChannels: ['y'],
3013
+ excludeChannels: ['x'],
3013
3014
  point: (datum, graphic) => {
3014
3015
  const channelAttr = graphic.getGraphicAttribute('y');
3015
3016
  return { y: channelAttr + (spec.height / (spec.pageSize + 1)) * Math.min(spec.scrollSize, spec.pageSize) };
@@ -10776,7 +10777,7 @@
10776
10777
  }
10777
10778
  removeChild(child) {
10778
10779
  const data = super.removeChild(child);
10779
- return child.stage = null, this.getGraphicService().onRemove(child), this.addUpdateBoundTag(), data;
10780
+ return this.getGraphicService().onRemove(child), child.stage = null, this.addUpdateBoundTag(), data;
10780
10781
  }
10781
10782
  removeAllChild(deep = !1) {
10782
10783
  this.forEachChildren(child => {
@@ -18733,6 +18734,11 @@
18733
18734
  state.executor.stop();
18734
18735
  }), this.stateList = null;
18735
18736
  }
18737
+ reApplyState(state) {
18738
+ var _a;
18739
+ const stateInfo = null === (_a = this.stateList) || void 0 === _a ? void 0 : _a.find(stateInfo => stateInfo.state === state);
18740
+ stateInfo && (stateInfo.executor.stop(), stateInfo.executor.execute(stateInfo.animationConfig));
18741
+ }
18736
18742
  }
18737
18743
 
18738
18744
  class GraphicStateExtension {
@@ -18763,12 +18769,19 @@
18763
18769
  applyUnhighlightState(animationConfig, callback) {
18764
18770
  return this._getAnimationStateManager(this).applyUnhighlightState(animationConfig, callback), this;
18765
18771
  }
18766
- stopAnimationState(state, type) {
18767
- return this._getAnimationStateManager(this).stopState(state, type), this;
18772
+ stopAnimationState(state, type, deep = !1) {
18773
+ return this._getAnimationStateManager(this).stopState(state, type), deep && this.isContainer && this.forEachChildren(child => {
18774
+ child.stopAnimationState(state, type, deep);
18775
+ }), this;
18768
18776
  }
18769
18777
  clearAnimationStates() {
18770
18778
  return this._getAnimationStateManager(this).clearState(), this;
18771
18779
  }
18780
+ reApplyAnimationState(state, deep = !1) {
18781
+ return this._getAnimationStateManager(this).reApplyState(state), deep && this.isContainer && this.forEachChildren(child => {
18782
+ child.reApplyAnimationState(state, deep);
18783
+ }), this;
18784
+ }
18772
18785
  static extend(graphic) {
18773
18786
  return new GraphicStateExtension()._getAnimationStateManager(graphic), graphic;
18774
18787
  }
@@ -18820,6 +18833,21 @@
18820
18833
  getGraphicAttribute(key, prev = !1) {
18821
18834
  return !prev && this.finalAttribute ? this.finalAttribute[key] : this.attribute[key];
18822
18835
  }
18836
+ pauseAnimation(deep = !1) {
18837
+ this.animates && this.animates.forEach(animate => animate.pause()), deep && this.isContainer && this.forEachChildren(child => {
18838
+ child.pauseAnimation(deep);
18839
+ });
18840
+ }
18841
+ resumeAnimation(deep = !1) {
18842
+ this.animates && this.animates.forEach(animate => animate.resume()), deep && this.isContainer && this.forEachChildren(child => {
18843
+ child.resumeAnimation(deep);
18844
+ });
18845
+ }
18846
+ stopAnimation(deep = !1) {
18847
+ this.animates && this.animates.forEach(animate => animate.stop()), deep && this.isContainer && this.forEachChildren(child => {
18848
+ child.stopAnimation(deep);
18849
+ });
18850
+ }
18823
18851
  }
18824
18852
 
18825
18853
  function registerAnimate() {
@@ -19021,17 +19049,6 @@
19021
19049
  items,
19022
19050
  scale: axis._scale.clone()
19023
19051
  };
19024
- if (!ignoreGrid) {
19025
- attrs.grid = {
19026
- type: 'line',
19027
- start: { x: 0, y: 0 },
19028
- end,
19029
- items: items[0],
19030
- verticalFactor: axis._axisStyle.verticalFactor,
19031
- depth: depthZ,
19032
- length: !ignoreGrid ? regionSize.height : 0
19033
- };
19034
- }
19035
19052
  const directionStr = (_a = axis.directionStr) !== null && _a !== void 0 ? _a : 'r2l';
19036
19053
  let anchor3d = [0, 0];
19037
19054
  let alpha = -Math.PI / 2;
@@ -19044,6 +19061,20 @@
19044
19061
  attrs.z = z;
19045
19062
  attrs.alpha = alpha;
19046
19063
  attrs.anchor3d = anchor3d;
19064
+ if (!ignoreGrid) {
19065
+ attrs.grid = {
19066
+ type: 'line',
19067
+ start: { x: 0, y: 0 },
19068
+ end,
19069
+ items: items[0],
19070
+ verticalFactor: axis._axisStyle.verticalFactor,
19071
+ depth: depthZ,
19072
+ length: !ignoreGrid ? regionSize.height : 0,
19073
+ alpha,
19074
+ z,
19075
+ anchor3d
19076
+ };
19077
+ }
19047
19078
  return attrs;
19048
19079
  };
19049
19080
 
@@ -19053,7 +19084,59 @@
19053
19084
  }
19054
19085
  _afterUpdateAttribute(attrs, ignoreGrid) {
19055
19086
  const isZ = vchart.isZAxis(this._orient);
19087
+ const isX = vchart.isXAxis(this._orient);
19088
+ const isY = vchart.isYAxis(this._orient);
19089
+ let regionHeight = 0;
19090
+ let regionWidth = 0;
19091
+ if (!ignoreGrid) {
19092
+ const regions = this.getRegions();
19093
+ let { x: minX, y: minY } = regions[0].getLayoutStartPoint();
19094
+ let maxX = minX + regions[0].getLayoutRect().width;
19095
+ let maxY = minY + regions[0].getLayoutRect().height;
19096
+ for (let index = 1; index < regions.length; index++) {
19097
+ const region = regions[index];
19098
+ const { x, y } = region.getLayoutStartPoint();
19099
+ const { width, height } = region.getLayoutRect();
19100
+ minX = Math.min(minX, x);
19101
+ maxX = Math.max(maxX, width + x);
19102
+ minY = Math.min(minY, y);
19103
+ maxY = Math.max(maxY, height + y);
19104
+ }
19105
+ regionHeight = Math.abs(maxY - minY);
19106
+ regionWidth = Math.abs(maxX - minX);
19107
+ }
19108
+ let gridLength = 0;
19109
+ let axisLength = 0;
19110
+ const { width, height } = this.getLayoutRect();
19111
+ let end = { x: 0, y: 0 };
19112
+ if (isX) {
19113
+ end = { x: width, y: 0 };
19114
+ gridLength = regionHeight;
19115
+ axisLength = width;
19116
+ }
19117
+ else if (isY) {
19118
+ end = { x: 0, y: height };
19119
+ gridLength = regionWidth;
19120
+ axisLength = height;
19121
+ }
19122
+ const depth = this.layout3dBox ? this.layout3dBox.length : 0;
19056
19123
  if (!isZ) {
19124
+ const items = this.getLabelItems(axisLength);
19125
+ attrs.grid = {
19126
+ length: gridLength
19127
+ };
19128
+ attrs.start = { x: 0, y: 0 };
19129
+ attrs.text = this._spec.title.text || this._dataFieldText;
19130
+ attrs.maxWidth = this._getTitleLimit(isX);
19131
+ attrs.items = items;
19132
+ attrs.grid = {
19133
+ type: 'line',
19134
+ start: { x: 0, y: 0 },
19135
+ end,
19136
+ items: items[0],
19137
+ depth,
19138
+ length: gridLength
19139
+ };
19057
19140
  return attrs;
19058
19141
  }
19059
19142
  return getUpdateAttributeOfZAxis(this, ignoreGrid);