@visactor/react-vchart 2.0.20-alpha.6 → 2.0.20-alpha.7

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
@@ -38820,6 +38820,16 @@
38820
38820
  strokeBoundsBuffer: 0
38821
38821
  }
38822
38822
  };
38823
+ const LAYOUT_LEVEL = {
38824
+ background: 0,
38825
+ preview: 1,
38826
+ dragMask: 2,
38827
+ selectedBackground: 3,
38828
+ selectedPreview: 4,
38829
+ handler: 5,
38830
+ handlerText: 5,
38831
+ handlerMask: 999
38832
+ };
38823
38833
 
38824
38834
  const isTextOverflow = (componentBoundsLike, textBounds, layout, isHorizontal) => {
38825
38835
  if (!textBounds) return !1;
@@ -38950,12 +38960,14 @@
38950
38960
  x: position.x + start * width,
38951
38961
  y: position.y,
38952
38962
  width: (end - start) * width,
38953
- height: height
38963
+ height: height,
38964
+ zIndex: LAYOUT_LEVEL.dragMask
38954
38965
  }, dragMaskStyle), "rect") : this._dragMask = this._getContainer().createOrUpdateChild("dragMask", Object.assign({
38955
38966
  x: position.x,
38956
38967
  y: position.y + start * height,
38957
38968
  width: width,
38958
- height: (end - start) * height
38969
+ height: (end - start) * height,
38970
+ zIndex: LAYOUT_LEVEL.dragMask
38959
38971
  }, dragMaskStyle), "rect"), {
38960
38972
  start: start,
38961
38973
  end: end
@@ -38979,7 +38991,8 @@
38979
38991
  y: position.y,
38980
38992
  width: width,
38981
38993
  height: height,
38982
- cursor: brushSelect ? "crosshair" : "auto"
38994
+ cursor: brushSelect ? "crosshair" : "auto",
38995
+ zIndex: LAYOUT_LEVEL.background
38983
38996
  }, backgroundStyle), {
38984
38997
  pickable: !zoomLock && (null === (_a = backgroundStyle.pickable) || void 0 === _a || _a)
38985
38998
  }), "rect");
@@ -39012,7 +39025,8 @@
39012
39025
  x: position.x + start * width,
39013
39026
  y: position.y - middleHandlerBackgroundSize,
39014
39027
  width: (end - start) * width,
39015
- height: middleHandlerBackgroundSize
39028
+ height: middleHandlerBackgroundSize,
39029
+ zIndex: LAYOUT_LEVEL.handler
39016
39030
  }, null === (_d = middleHandlerStyle.background) || void 0 === _d ? void 0 : _d.style), {
39017
39031
  pickable: !zoomLock && (null === (_g = null === (_f = null === (_e = middleHandlerStyle.background) || void 0 === _e ? void 0 : _e.style) || void 0 === _f ? void 0 : _f.pickable) || void 0 === _g || _g)
39018
39032
  }), "rect"), this._middleHandlerSymbol = group.createOrUpdateChild("middleHandlerSymbol", Object.assign(Object.assign({
@@ -39020,24 +39034,29 @@
39020
39034
  y: position.y - middleHandlerBackgroundSize / 2,
39021
39035
  strokeBoundsBuffer: 0,
39022
39036
  angle: 0,
39023
- symbolType: null !== (_j = null === (_h = middleHandlerStyle.icon) || void 0 === _h ? void 0 : _h.symbolType) && void 0 !== _j ? _j : "square"
39037
+ symbolType: null !== (_j = null === (_h = middleHandlerStyle.icon) || void 0 === _h ? void 0 : _h.symbolType) && void 0 !== _j ? _j : "square",
39038
+ zIndex: LAYOUT_LEVEL.handler
39024
39039
  }, middleHandlerStyle.icon), {
39025
39040
  pickable: !zoomLock && (null === (_k = middleHandlerStyle.icon.pickable) || void 0 === _k || _k)
39026
39041
  }), "symbol");
39027
39042
  }
39028
- this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign(Object.assign({
39043
+ this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign(Object.assign(Object.assign({
39029
39044
  x: position.x + start * width,
39030
39045
  y: position.y + height / 2,
39031
39046
  size: height,
39032
39047
  symbolType: null !== (_l = startHandlerStyle.symbolType) && void 0 !== _l ? _l : "square"
39033
- }, DEFAULT_HANDLER_ATTR_MAP.horizontal), startHandlerStyle), {
39048
+ }, DEFAULT_HANDLER_ATTR_MAP.horizontal), {
39049
+ zIndex: LAYOUT_LEVEL.handler
39050
+ }), startHandlerStyle), {
39034
39051
  pickable: !zoomLock && (null === (_m = startHandlerStyle.pickable) || void 0 === _m || _m)
39035
- }), "symbol"), this._endHandler = group.createOrUpdateChild("endHandler", Object.assign(Object.assign(Object.assign({
39052
+ }), "symbol"), this._endHandler = group.createOrUpdateChild("endHandler", Object.assign(Object.assign(Object.assign(Object.assign({
39036
39053
  x: position.x + end * width,
39037
39054
  y: position.y + height / 2,
39038
39055
  size: height,
39039
39056
  symbolType: null !== (_o = endHandlerStyle.symbolType) && void 0 !== _o ? _o : "square"
39040
- }, DEFAULT_HANDLER_ATTR_MAP.horizontal), endHandlerStyle), {
39057
+ }, DEFAULT_HANDLER_ATTR_MAP.horizontal), {
39058
+ zIndex: LAYOUT_LEVEL.handler
39059
+ }), endHandlerStyle), {
39041
39060
  pickable: !zoomLock && (null === (_p = endHandlerStyle.pickable) || void 0 === _p || _p)
39042
39061
  }), "symbol");
39043
39062
  const startHandlerWidth = Math.max(this._startHandler.AABBBounds.width(), startHandlerMinSize),
@@ -39051,7 +39070,7 @@
39051
39070
  height: startHandlerHeight,
39052
39071
  fill: "white",
39053
39072
  fillOpacity: 0,
39054
- zIndex: 999
39073
+ zIndex: LAYOUT_LEVEL.handlerMask
39055
39074
  }, DEFAULT_HANDLER_ATTR_MAP.horizontal), {
39056
39075
  pickable: !zoomLock
39057
39076
  }), "rect"), this._endHandlerMask = group.createOrUpdateChild("endHandlerMask", Object.assign(Object.assign({
@@ -39061,7 +39080,7 @@
39061
39080
  height: endHandlerHeight,
39062
39081
  fill: "white",
39063
39082
  fillOpacity: 0,
39064
- zIndex: 999
39083
+ zIndex: LAYOUT_LEVEL.handlerMask
39065
39084
  }, DEFAULT_HANDLER_ATTR_MAP.horizontal), {
39066
39085
  pickable: !zoomLock
39067
39086
  }), "rect");
@@ -39072,7 +39091,8 @@
39072
39091
  x: "left" === orient ? position.x - middleHandlerBackgroundSize : position.x + width,
39073
39092
  y: position.y + start * height,
39074
39093
  width: middleHandlerBackgroundSize,
39075
- height: (end - start) * height
39094
+ height: (end - start) * height,
39095
+ zIndex: LAYOUT_LEVEL.handler
39076
39096
  }, null === (_r = middleHandlerStyle.background) || void 0 === _r ? void 0 : _r.style), {
39077
39097
  pickable: !zoomLock && (null === (_u = null === (_t = null === (_s = middleHandlerStyle.background) || void 0 === _s ? void 0 : _s.style) || void 0 === _t ? void 0 : _t.pickable) || void 0 === _u || _u)
39078
39098
  }), "rect"), this._middleHandlerSymbol = group.createOrUpdateChild("middleHandlerSymbol", Object.assign(Object.assign({
@@ -39080,23 +39100,27 @@
39080
39100
  y: position.y + (start + end) / 2 * height,
39081
39101
  angle: Math.PI / 180 * 90,
39082
39102
  symbolType: null !== (_w = null === (_v = middleHandlerStyle.icon) || void 0 === _v ? void 0 : _v.symbolType) && void 0 !== _w ? _w : "square",
39083
- strokeBoundsBuffer: 0
39103
+ strokeBoundsBuffer: 0,
39104
+ zIndex: LAYOUT_LEVEL.handler
39084
39105
  }, middleHandlerStyle.icon), {
39085
39106
  pickable: !zoomLock && (null === (_y = null === (_x = middleHandlerStyle.icon) || void 0 === _x ? void 0 : _x.pickable) || void 0 === _y || _y)
39086
39107
  }), "symbol");
39087
39108
  }
39088
- this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign(Object.assign({
39109
+ this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign(Object.assign(Object.assign({
39089
39110
  x: position.x + width / 2,
39090
39111
  y: position.y + start * height,
39091
39112
  size: width,
39092
39113
  symbolType: null !== (_z = startHandlerStyle.symbolType) && void 0 !== _z ? _z : "square"
39093
- }, DEFAULT_HANDLER_ATTR_MAP.vertical), startHandlerStyle), {
39114
+ }, DEFAULT_HANDLER_ATTR_MAP.vertical), {
39115
+ zIndex: LAYOUT_LEVEL.handler
39116
+ }), startHandlerStyle), {
39094
39117
  pickable: !zoomLock && (null === (_0 = startHandlerStyle.pickable) || void 0 === _0 || _0)
39095
39118
  }), "symbol"), this._endHandler = group.createOrUpdateChild("endHandler", Object.assign(Object.assign(Object.assign({
39096
39119
  x: position.x + width / 2,
39097
39120
  y: position.y + end * height,
39098
39121
  size: width,
39099
- symbolType: null !== (_1 = endHandlerStyle.symbolType) && void 0 !== _1 ? _1 : "square"
39122
+ symbolType: null !== (_1 = endHandlerStyle.symbolType) && void 0 !== _1 ? _1 : "square",
39123
+ zIndex: LAYOUT_LEVEL.handler
39100
39124
  }, DEFAULT_HANDLER_ATTR_MAP.vertical), endHandlerStyle), {
39101
39125
  pickable: !zoomLock && (null === (_2 = endHandlerStyle.pickable) || void 0 === _2 || _2)
39102
39126
  }), "symbol");
@@ -39111,7 +39135,7 @@
39111
39135
  height: endHandlerWidth,
39112
39136
  fill: "white",
39113
39137
  fillOpacity: 0,
39114
- zIndex: 999
39138
+ zIndex: LAYOUT_LEVEL.handlerMask
39115
39139
  }, DEFAULT_HANDLER_ATTR_MAP.vertical), {
39116
39140
  pickable: !zoomLock
39117
39141
  }), "rect"), this._endHandlerMask = group.createOrUpdateChild("endHandlerMask", Object.assign(Object.assign({
@@ -39121,7 +39145,7 @@
39121
39145
  height: endHandlerWidth,
39122
39146
  fill: "white",
39123
39147
  fillOpacity: 0,
39124
- zIndex: 999
39148
+ zIndex: LAYOUT_LEVEL.handlerMask
39125
39149
  }, DEFAULT_HANDLER_ATTR_MAP.vertical), {
39126
39150
  pickable: !zoomLock
39127
39151
  }), "rect");
@@ -39150,7 +39174,8 @@
39150
39174
  y: position.y,
39151
39175
  width: (end - start) * width,
39152
39176
  height: height,
39153
- cursor: brushSelect ? "crosshair" : "move"
39177
+ cursor: brushSelect ? "crosshair" : "move",
39178
+ zIndex: LAYOUT_LEVEL.selectedBackground
39154
39179
  }, selectedBackgroundStyle), {
39155
39180
  pickable: !zoomLock && (null === (_a = selectedBackgroundChartStyle.pickable) || void 0 === _a || _a)
39156
39181
  }), "rect") : this._selectedBackground = group.createOrUpdateChild("selectedBackground", Object.assign(Object.assign({
@@ -39158,14 +39183,16 @@
39158
39183
  y: position.y + start * height,
39159
39184
  width: width,
39160
39185
  height: (end - start) * height,
39161
- cursor: brushSelect ? "crosshair" : "move"
39186
+ cursor: brushSelect ? "crosshair" : "move",
39187
+ zIndex: LAYOUT_LEVEL.selectedBackground
39162
39188
  }, selectedBackgroundStyle), {
39163
39189
  pickable: !zoomLock && (null === (_b = selectedBackgroundStyle.pickable) || void 0 === _b || _b)
39164
39190
  }), "rect");
39165
39191
  }
39166
39192
  _setPreviewAttributes(type, group) {
39167
39193
  this._previewGroup || (this._previewGroup = group.createOrUpdateChild("previewGroup", {
39168
- pickable: !1
39194
+ pickable: !1,
39195
+ zIndex: LAYOUT_LEVEL.preview
39169
39196
  }, "group")), "line" === type ? this._previewLine = this._previewGroup.createOrUpdateChild("previewLine", {}, "line") : this._previewArea = this._previewGroup.createOrUpdateChild("previewArea", {
39170
39197
  curveType: "basis"
39171
39198
  }, "area");
@@ -39184,7 +39211,8 @@
39184
39211
  }
39185
39212
  _setSelectedPreviewClipAttributes(type, group) {
39186
39213
  this._selectedPreviewGroupClip || (this._selectedPreviewGroupClip = group.createOrUpdateChild("selectedPreviewGroupClip", {
39187
- pickable: !1
39214
+ pickable: !1,
39215
+ zIndex: LAYOUT_LEVEL.selectedPreview
39188
39216
  }, "group"), this._selectedPreviewGroup = this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup", {}, "group"));
39189
39217
  const {
39190
39218
  start: start,
@@ -39386,7 +39414,8 @@
39386
39414
  visible: this._showText,
39387
39415
  pickable: !1,
39388
39416
  childrenPickable: !1,
39389
- textStyle: startTextAlignStyle
39417
+ textStyle: startTextAlignStyle,
39418
+ zIndex: LAYOUT_LEVEL.handlerText
39390
39419
  }), "data-zoom-start-text"), this._endText = this._maybeAddLabel(this._getContainer(), merge$1({}, restEndTextStyle, {
39391
39420
  text: endTextValue,
39392
39421
  x: endTextPosition.x,
@@ -39394,7 +39423,8 @@
39394
39423
  visible: this._showText,
39395
39424
  pickable: !1,
39396
39425
  childrenPickable: !1,
39397
- textStyle: endTextAlignStyle
39426
+ textStyle: endTextAlignStyle,
39427
+ zIndex: LAYOUT_LEVEL.handlerText
39398
39428
  }), "data-zoom-end-text");
39399
39429
  }
39400
39430
  _maybeAddLabel(container, attributes, name) {
@@ -49890,11 +49920,11 @@
49890
49920
  this._lastMark = mark;
49891
49921
  }
49892
49922
  reuse(mark) {
49893
- this.type === mark.type && (this._product = mark.getProduct(), this._product && (this._product.clearStates(), this._graphics = mark.getGraphics(), this._graphics.forEach(g => {
49923
+ this.type === mark.type && (this._product = mark.getProduct(), this._product.clearStates(), this._graphics = mark.getGraphics(), this._graphics.forEach(g => {
49894
49924
  g.clearStates();
49895
49925
  }), this._graphicMap = mark._graphicMap, this._graphicMap.forEach(g => {
49896
49926
  g.context = Object.assign(Object.assign({}, g.context), this._getCommonContext());
49897
- }), this._dataByKey = mark._dataByKey, this._prevDataByKey = mark._prevDataByKey, this.needClear = mark.needClear));
49927
+ }), this._dataByKey = mark._dataByKey, this._prevDataByKey = mark._prevDataByKey, this.needClear = mark.needClear);
49898
49928
  }
49899
49929
  _parseProgressiveContext(data) {
49900
49930
  const enableProgressive = this._markConfig.progressiveStep > 0 && this._markConfig.progressiveThreshold > 0 && this._markConfig.progressiveStep < this._markConfig.progressiveThreshold,
@@ -80147,7 +80177,7 @@
80147
80177
  }
80148
80178
  }
80149
80179
  _handleDataCollectionChange() {
80150
- this._data.getDataView().reRunAllTransform();
80180
+ this._data.getDataView().reRunAllTransform(), this._initAfterLayout();
80151
80181
  const domain = this._computeDomainOfValueScale();
80152
80182
  domain && (this._valueScale || (this._valueScale = new LinearScale()), this._valueScale.domain(domain), this._updateValueScaleRange(), this._component && this._createOrUpdateComponent(!0));
80153
80183
  }
@@ -80298,9 +80328,7 @@
80298
80328
  }
80299
80329
  _createOrUpdateComponent(changeData) {
80300
80330
  if (this._visible) {
80301
- const xScale = this._isHorizontal ? this._stateScale : this._valueScale,
80302
- yScale = this._isHorizontal ? this._valueScale : this._stateScale,
80303
- isNeedPreview = this._isScaleValid(xScale) && this._isScaleValid(yScale) && !1 !== this._spec.showBackgroundChart,
80331
+ const isNeedPreview = !1 !== this._spec.showBackgroundChart,
80304
80332
  attrs = this._getAttrs(isNeedPreview),
80305
80333
  axis = this._relatedAxisComponent;
80306
80334
  if (this._component) this._component.setAttributes(attrs), changeData && (this._component.setPreviewData(this._data.getDataView().latestData), isNeedPreview && (this._isHorizontal ? this._component.setPreviewPointsY1(this._dataToPositionY2) : this._component.setPreviewPointsX1(this._dataToPositionX2), this._component.setStatePointToData(state => statePointToData(state, this._stateScale, isReverse(axis, this._isHorizontal)))));else {
@@ -80450,10 +80478,8 @@
80450
80478
  const isSameScrollValue = isClose(this._start, start) && isClose(this._end, end);
80451
80479
  if (this._shouldChange && (!isSameScrollValue || !1 === this._spec.realTime)) {
80452
80480
  updateComponent && this._component && this._component.setAttribute("range", [start, end]), this._start = start, this._end = end;
80453
- const axis = this._relatedAxisComponent,
80454
- reverse = isReverse(axis, this._isHorizontal),
80455
- startValue = statePointToData(start, this._stateScale, reverse),
80456
- endValue = statePointToData(end, this._stateScale, reverse);
80481
+ const startValue = statePointToData(start, this._stateScale, !1),
80482
+ endValue = statePointToData(end, this._stateScale, !1);
80457
80483
  (isFunction$1(this._spec.updateDataAfterChange) ? this._spec.updateDataAfterChange(start, end, startValue, endValue) : this._handleStateChange(startValue, endValue)) && this.event.emit(ChartEvent.scrollBarChange, {
80458
80484
  model: this,
80459
80485
  value: {
@@ -84091,15 +84117,23 @@
84091
84117
  y2: y2
84092
84118
  } = operateMaskBounds,
84093
84119
  regionStartAttr = isHorizontal ? "x" : "y",
84094
- regionSizeAttr = isHorizontal ? "width" : "height",
84095
84120
  boundsStart = isHorizontal ? x1 : y1,
84096
- boundsEnd = isHorizontal ? x2 : y2;
84121
+ boundsEnd = isHorizontal ? x2 : y2,
84122
+ range = axis.getScale().range(),
84123
+ rangeFactor = null !== (_b = axis.scaleRangeFactor()) && void 0 !== _b ? _b : [0, 1],
84124
+ isAxisReverse = last(range) < range[0],
84125
+ startPosTemp = boundsStart - region.getLayoutStartPoint()[regionStartAttr],
84126
+ endPosTemp = boundsEnd - region.getLayoutStartPoint()[regionStartAttr],
84127
+ endPos = isAxisReverse ? Math.min(startPosTemp, endPosTemp) : Math.max(startPosTemp, endPosTemp),
84128
+ startPos = isAxisReverse ? Math.max(startPosTemp, endPosTemp) : Math.min(startPosTemp, endPosTemp),
84129
+ start = (startPos - range[0]) / (last(range) - range[0]) * (rangeFactor[1] - rangeFactor[0]) + rangeFactor[0],
84130
+ end = (endPos - range[0]) / (last(range) - range[0]) * (rangeFactor[1] - rangeFactor[0]) + rangeFactor[0],
84131
+ newStart = this._stateClamp(start - axisRangeExpand),
84132
+ newEnd = this._stateClamp(end + axisRangeExpand);
84097
84133
  if (this._axisDataZoomMap[axis.id]) {
84098
84134
  const dataZoom = this._axisDataZoomMap[axis.id],
84099
- startPercent = (boundsStart - region.getLayoutStartPoint()[regionStartAttr]) / region.getLayoutRect()[regionSizeAttr],
84100
- endPercent = (boundsEnd - region.getLayoutStartPoint()[regionStartAttr]) / region.getLayoutRect()[regionSizeAttr],
84101
- newStartPercent = this._stateClamp(startPercent - axisRangeExpand),
84102
- newEndPercent = this._stateClamp(endPercent + axisRangeExpand);
84135
+ newStartPercent = isAxisReverse ? 1 - newStart : newStart,
84136
+ newEndPercent = isAxisReverse ? 1 - newEnd : newEnd;
84103
84137
  dataZoom.setStartAndEnd(Math.min(newStartPercent, newEndPercent), Math.max(newStartPercent, newEndPercent), ["percent", "percent"]), this._zoomRecord.push({
84104
84138
  operateComponent: dataZoom,
84105
84139
  start: newStartPercent,
@@ -84107,26 +84141,13 @@
84107
84141
  startValue: statePointToData(newStartPercent, dataZoom.stateScale, isReverse(dataZoom.relatedAxisComponent, dataZoom.isHorizontal)),
84108
84142
  endValue: statePointToData(newEndPercent, dataZoom.stateScale, isReverse(dataZoom.relatedAxisComponent, dataZoom.isHorizontal))
84109
84143
  });
84110
- } else {
84111
- const range = axis.getScale().range(),
84112
- rangeFactor = null !== (_b = axis.scaleRangeFactor()) && void 0 !== _b ? _b : [0, 1],
84113
- isAxisReverse = last(range) < range[0],
84114
- startPosTemp = boundsStart - region.getLayoutStartPoint()[regionStartAttr],
84115
- endPosTemp = boundsEnd - region.getLayoutStartPoint()[regionStartAttr],
84116
- endPos = isAxisReverse ? Math.min(startPosTemp, endPosTemp) : Math.max(startPosTemp, endPosTemp),
84117
- startPos = isAxisReverse ? Math.max(startPosTemp, endPosTemp) : Math.min(startPosTemp, endPosTemp),
84118
- start = (startPos - range[0]) / (last(range) - range[0]) * (rangeFactor[1] - rangeFactor[0]) + rangeFactor[0],
84119
- end = (endPos - range[0]) / (last(range) - range[0]) * (rangeFactor[1] - rangeFactor[0]) + rangeFactor[0],
84120
- newStart = this._stateClamp(start - axisRangeExpand),
84121
- newEnd = this._stateClamp(end + axisRangeExpand);
84122
- axis.scaleRangeFactor([newStart, newEnd]), axis.effect.scaleUpdate(), this._zoomRecord.push({
84123
- operateComponent: axis,
84124
- start: newStart,
84125
- end: newEnd,
84126
- startValue: axis.getScale().invert(startPos),
84127
- endValue: axis.getScale().invert(endPos)
84128
- });
84129
- }
84144
+ } else axis.scaleRangeFactor([newStart, newEnd]), axis.effect.scaleUpdate(), this._zoomRecord.push({
84145
+ operateComponent: axis,
84146
+ start: newStart,
84147
+ end: newEnd,
84148
+ startValue: axis.getScale().invert(startPos),
84149
+ endValue: axis.getScale().invert(endPos)
84150
+ });
84130
84151
  });
84131
84152
  }
84132
84153
  }