@visactor/vrender-components 1.0.19-alpha.0 → 1.0.19

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 (66) hide show
  1. package/cjs/axis/line.js.map +1 -1
  2. package/cjs/axis/tick-data/continuous.js.map +1 -1
  3. package/cjs/axis/tick-data/util.js.map +1 -1
  4. package/cjs/brush/brush.js.map +1 -1
  5. package/cjs/data-zoom/data-zoom.d.ts +12 -83
  6. package/cjs/data-zoom/data-zoom.js +104 -542
  7. package/cjs/data-zoom/data-zoom.js.map +1 -1
  8. package/cjs/data-zoom/interaction.d.ts +65 -0
  9. package/cjs/data-zoom/interaction.js +179 -0
  10. package/cjs/data-zoom/interaction.js.map +1 -0
  11. package/cjs/data-zoom/renderer.d.ts +91 -0
  12. package/cjs/data-zoom/renderer.js +461 -0
  13. package/cjs/data-zoom/renderer.js.map +1 -0
  14. package/cjs/data-zoom/type.d.ts +8 -0
  15. package/cjs/data-zoom/type.js +11 -3
  16. package/cjs/data-zoom/type.js.map +1 -1
  17. package/cjs/data-zoom/utils.d.ts +2 -0
  18. package/cjs/data-zoom/utils.js +20 -0
  19. package/cjs/data-zoom/utils.js.map +1 -0
  20. package/cjs/index.d.ts +1 -1
  21. package/cjs/index.js +1 -1
  22. package/cjs/index.js.map +1 -1
  23. package/cjs/indicator/config.js +1 -2
  24. package/cjs/indicator/register.js +2 -1
  25. package/cjs/label/base.js +1 -1
  26. package/cjs/label/data-label-register.js +1 -1
  27. package/cjs/label/dataLabel.js +1 -1
  28. package/cjs/table-series-number/event-manager.js +6 -12
  29. package/cjs/table-series-number/event-manager.js.map +1 -1
  30. package/cjs/table-series-number/type.d.ts +1 -5
  31. package/cjs/table-series-number/type.js +1 -2
  32. package/cjs/table-series-number/type.js.map +1 -1
  33. package/dist/index.es.js +1089 -774
  34. package/es/axis/line.js.map +1 -1
  35. package/es/axis/tick-data/continuous.js.map +1 -1
  36. package/es/axis/tick-data/util.js.map +1 -1
  37. package/es/brush/brush.js.map +1 -1
  38. package/es/data-zoom/data-zoom.d.ts +12 -83
  39. package/es/data-zoom/data-zoom.js +108 -545
  40. package/es/data-zoom/data-zoom.js.map +1 -1
  41. package/es/data-zoom/interaction.d.ts +65 -0
  42. package/es/data-zoom/interaction.js +177 -0
  43. package/es/data-zoom/interaction.js.map +1 -0
  44. package/es/data-zoom/renderer.d.ts +91 -0
  45. package/es/data-zoom/renderer.js +458 -0
  46. package/es/data-zoom/renderer.js.map +1 -0
  47. package/es/data-zoom/type.d.ts +8 -0
  48. package/es/data-zoom/type.js +13 -0
  49. package/es/data-zoom/type.js.map +1 -1
  50. package/es/data-zoom/utils.d.ts +2 -0
  51. package/es/data-zoom/utils.js +12 -0
  52. package/es/data-zoom/utils.js.map +1 -0
  53. package/es/index.d.ts +1 -1
  54. package/es/index.js +1 -1
  55. package/es/index.js.map +1 -1
  56. package/es/indicator/config.js +1 -2
  57. package/es/indicator/register.js +2 -1
  58. package/es/label/base.js +1 -1
  59. package/es/label/data-label-register.js +1 -1
  60. package/es/label/dataLabel.js +1 -1
  61. package/es/table-series-number/event-manager.js +6 -12
  62. package/es/table-series-number/event-manager.js.map +1 -1
  63. package/es/table-series-number/type.d.ts +1 -5
  64. package/es/table-series-number/type.js +1 -2
  65. package/es/table-series-number/type.js.map +1 -1
  66. package/package.json +4 -4
@@ -1,573 +1,141 @@
1
- var __rest = this && this.__rest || function(s, e) {
2
- var t = {};
3
- for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
4
- if (null != s && "function" == typeof Object.getOwnPropertySymbols) {
5
- var i = 0;
6
- for (p = Object.getOwnPropertySymbols(s); i < p.length; i++) e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]) && (t[p[i]] = s[p[i]]);
7
- }
8
- return t;
9
- };
10
-
11
- import { flatten_simplify, vglobal } from "@visactor/vrender-core";
12
-
13
- import { Bounds, array, clamp, debounce, isFunction, isValid, merge, throttle } from "@visactor/vutils";
1
+ import { array, isFunction, isValid, merge } from "@visactor/vutils";
14
2
 
15
3
  import { AbstractComponent } from "../core/base";
16
4
 
17
- import { Tag } from "../tag";
5
+ import { IDataZoomEvent, IDataZoomInteractiveEvent } from "./type";
18
6
 
19
- import { DEFAULT_DATA_ZOOM_ATTRIBUTES, DEFAULT_HANDLER_ATTR_MAP } from "./config";
7
+ import { DataZoomRenderer } from "./renderer";
20
8
 
21
- import { DataZoomActiveTag } from "./type";
9
+ import { DataZoomInteraction } from "./interaction";
22
10
 
23
11
  import { loadDataZoomComponent } from "./register";
24
12
 
25
- import { getEndTriggersOfDrag } from "../util/event";
26
-
27
- const delayMap = {
28
- debounce: debounce,
29
- throttle: throttle
30
- };
13
+ import { DEFAULT_DATA_ZOOM_ATTRIBUTES } from "./config";
31
14
 
32
15
  loadDataZoomComponent();
33
16
 
34
17
  export class DataZoom extends AbstractComponent {
35
- setPropsFromAttrs() {
36
- const {start: start, end: end, orient: orient, previewData: previewData, previewPointsX: previewPointsX, previewPointsY: previewPointsY, previewPointsX1: previewPointsX1, previewPointsY1: previewPointsY1} = this.attribute;
37
- start && (this.state.start = start), end && (this.state.end = end);
38
- const {width: width, height: height} = this.getLayoutAttrFromConfig();
39
- this._spanCache = this.state.end - this.state.start, this._isHorizontal = "top" === orient || "bottom" === orient,
40
- this._layoutCache.max = this._isHorizontal ? width : height, this._layoutCache.attPos = this._isHorizontal ? "x" : "y",
41
- this._layoutCache.attSize = this._isHorizontal ? "width" : "height", previewData && (this._previewData = previewData),
42
- isFunction(previewPointsX) && (this._previewPointsX = previewPointsX), isFunction(previewPointsY) && (this._previewPointsY = previewPointsY),
43
- isFunction(previewPointsX1) && (this._previewPointsX1 = previewPointsX1), isFunction(previewPointsY1) && (this._previewPointsY1 = previewPointsY1);
44
- }
45
18
  constructor(attributes, options) {
46
19
  super((null == options ? void 0 : options.skipDefault) ? attributes : merge({}, DataZoom.defaultAttributes, attributes)),
47
- this.name = "dataZoom", this._previewData = [], this._activeState = !1, this._activeCache = {
48
- startPos: {
49
- x: 0,
50
- y: 0
51
- },
52
- lastPos: {
53
- x: 0,
54
- y: 0
55
- }
56
- }, this._layoutCache = {
57
- attPos: "x",
58
- attSize: "width",
59
- max: 0
60
- }, this.state = {
20
+ this.name = "dataZoom", this._state = {
61
21
  start: 0,
62
22
  end: 1
63
- }, this._statePointToData = state => state, this._handleTouchMove = e => {
64
- this._activeState && e.preventDefault();
65
- }, this._onHandlerPointerDown = (e, tag) => {
66
- this._clearDragEvents(), "start" === tag ? (this._activeTag = DataZoomActiveTag.startHandler,
67
- this._activeItem = this._startHandlerMask) : "end" === tag ? (this._activeTag = DataZoomActiveTag.endHandler,
68
- this._activeItem = this._endHandlerMask) : "middleRect" === tag ? (this._activeTag = DataZoomActiveTag.middleHandler,
69
- this._activeItem = this._middleHandlerRect) : "middleSymbol" === tag ? (this._activeTag = DataZoomActiveTag.middleHandler,
70
- this._activeItem = this._middleHandlerSymbol) : "background" === tag && (this._activeTag = DataZoomActiveTag.background,
71
- this._activeItem = this._background), this._activeState = !0, this._activeCache.startPos = this.eventPosToStagePos(e),
72
- this._activeCache.lastPos = this.eventPosToStagePos(e);
73
- const evtTarget = "browser" === vglobal.env ? vglobal : this.stage, triggers = getEndTriggersOfDrag();
74
- evtTarget.addEventListener("pointermove", this._onHandlerPointerMove, {
75
- capture: !0
76
- }), this.addEventListener("pointermove", this._onHandlerPointerMove, {
77
- capture: !0
78
- }), triggers.forEach((trigger => {
79
- evtTarget.addEventListener(trigger, this._onHandlerPointerUp);
80
- }));
81
- }, this._pointerMove = e => {
82
- const {start: startAttr, end: endAttr, brushSelect: brushSelect, realTime: realTime = !0} = this.attribute, pos = this.eventPosToStagePos(e), {attPos: attPos, max: max} = this._layoutCache, dis = (pos[attPos] - this._activeCache.lastPos[attPos]) / max;
83
- let {start: start, end: end} = this.state;
84
- this._activeState && (this._activeTag === DataZoomActiveTag.middleHandler ? this.moveZoomWithMiddle((this.state.start + this.state.end) / 2 + dis) : this._activeTag === DataZoomActiveTag.startHandler ? start + dis > end ? (start = end,
85
- end = start + dis, this._activeTag = DataZoomActiveTag.endHandler) : start += dis : this._activeTag === DataZoomActiveTag.endHandler && (end + dis < start ? (end = start,
86
- start = end + dis, this._activeTag = DataZoomActiveTag.startHandler) : end += dis),
87
- this._activeCache.lastPos = pos, brushSelect && this.renderDragMask()), start = Math.min(Math.max(start, 0), 1),
88
- end = Math.min(Math.max(end, 0), 1), startAttr === start && endAttr === end || (this.setStateAttr(start, end, !0),
89
- realTime && this._dispatchEvent("change", {
90
- start: start,
91
- end: end,
92
- tag: this._activeTag
93
- }));
94
- }, this._onHandlerPointerMove = 0 === this.attribute.delayTime ? this._pointerMove : delayMap[this.attribute.delayType](this._pointerMove, this.attribute.delayTime),
95
- this._onHandlerPointerUp = e => {
96
- const {start: start, end: end, brushSelect: brushSelect, realTime: realTime = !0} = this.attribute;
97
- if (this._activeState && this._activeTag === DataZoomActiveTag.background) {
98
- const pos = this.eventPosToStagePos(e);
99
- this.backgroundDragZoom(this._activeCache.startPos, pos);
100
- }
101
- this._activeState = !1, brushSelect && this.renderDragMask(), this._dispatchEvent("change", {
102
- start: this.state.start,
103
- end: this.state.end,
104
- tag: this._activeTag
105
- }), this._clearDragEvents();
23
+ }, this.getLayoutAttrFromConfig = () => {
24
+ var _a, _b, _c, _d, _e, _f;
25
+ if (this._layoutCacheFromConfig) return this._layoutCacheFromConfig;
26
+ const {position: positionConfig, size: size, orient: orient, middleHandlerStyle: middleHandlerStyle = {}, startHandlerStyle: startHandlerStyle = {}, endHandlerStyle: endHandlerStyle = {}, backgroundStyle: backgroundStyle = {}} = this.attribute, {width: widthConfig, height: heightConfig} = size, middleHandlerSize = null !== (_b = null === (_a = middleHandlerStyle.background) || void 0 === _a ? void 0 : _a.size) && void 0 !== _b ? _b : 10;
27
+ let width, height, position;
28
+ middleHandlerStyle.visible ? this._isHorizontal ? (width = widthConfig, height = heightConfig - middleHandlerSize,
29
+ position = {
30
+ x: positionConfig.x,
31
+ y: positionConfig.y + middleHandlerSize
32
+ }) : (width = widthConfig - middleHandlerSize, height = heightConfig, position = {
33
+ x: positionConfig.x + ("left" === orient ? middleHandlerSize : 0),
34
+ y: positionConfig.y
35
+ }) : (width = widthConfig, height = heightConfig, position = positionConfig);
36
+ const startHandlerSize = null !== (_c = startHandlerStyle.size) && void 0 !== _c ? _c : this._isHorizontal ? height : width, endHandlerSize = null !== (_d = endHandlerStyle.size) && void 0 !== _d ? _d : this._isHorizontal ? height : width;
37
+ return startHandlerStyle.visible && (this._isHorizontal ? (width -= (startHandlerSize + endHandlerSize) / 2,
38
+ position = {
39
+ x: position.x + startHandlerSize / 2,
40
+ y: position.y
41
+ }) : (height -= (startHandlerSize + endHandlerSize) / 2, position = {
42
+ x: position.x,
43
+ y: position.y + startHandlerSize / 2
44
+ })), height += (null !== (_e = backgroundStyle.lineWidth) && void 0 !== _e ? _e : 2) / 2,
45
+ width += (null !== (_f = backgroundStyle.lineWidth) && void 0 !== _f ? _f : 2) / 2,
46
+ this._layoutCacheFromConfig = {
47
+ position: position,
48
+ width: width,
49
+ height: height
50
+ }, this._layoutCacheFromConfig;
106
51
  };
107
- const {position: position, showDetail: showDetail} = attributes;
108
- this._activeCache.startPos = position, this._activeCache.lastPos = position, this._showText = "auto" !== showDetail && showDetail,
109
- this.setPropsFromAttrs();
110
- }
111
- setAttributes(params, forceUpdateTag) {
112
- super.setAttributes(params, forceUpdateTag), this.setPropsFromAttrs();
113
- }
114
- bindEvents() {
115
- if (this.attribute.disableTriggerEvent) return void this.setAttribute("childrenPickable", !1);
116
- const {showDetail: showDetail, brushSelect: brushSelect} = this.attribute;
117
- this._startHandlerMask && this._startHandlerMask.addEventListener("pointerdown", (e => this._onHandlerPointerDown(e, "start"))),
118
- this._endHandlerMask && this._endHandlerMask.addEventListener("pointerdown", (e => this._onHandlerPointerDown(e, "end"))),
119
- this._middleHandlerSymbol && this._middleHandlerSymbol.addEventListener("pointerdown", (e => this._onHandlerPointerDown(e, "middleSymbol"))),
120
- this._middleHandlerRect && this._middleHandlerRect.addEventListener("pointerdown", (e => this._onHandlerPointerDown(e, "middleRect")));
121
- const selectedTag = brushSelect ? "background" : "middleRect";
122
- this._selectedBackground && this._selectedBackground.addEventListener("pointerdown", (e => this._onHandlerPointerDown(e, selectedTag))),
123
- brushSelect && this._background && this._background.addEventListener("pointerdown", (e => this._onHandlerPointerDown(e, "background"))),
124
- brushSelect && this._previewGroup && this._previewGroup.addEventListener("pointerdown", (e => this._onHandlerPointerDown(e, "background"))),
125
- this._selectedPreviewGroup && this._selectedPreviewGroup.addEventListener("pointerdown", (e => this._onHandlerPointerDown(e, selectedTag))),
126
- "auto" === showDetail && (this.addEventListener("pointerenter", this._onHandlerPointerEnter),
127
- this.addEventListener("pointerleave", this._onHandlerPointerLeave)), ("browser" === vglobal.env ? vglobal : this.stage).addEventListener("touchmove", this._handleTouchMove, {
128
- passive: !1
129
- });
130
- }
131
- dragMaskSize() {
132
- const {position: position} = this.attribute, {attPos: attPos, max: max} = this._layoutCache;
133
- return this._activeCache.lastPos[attPos] - position[attPos] > max ? max + position[attPos] - this._activeCache.startPos[attPos] : this._activeCache.lastPos[attPos] - position[attPos] < 0 ? position[attPos] - this._activeCache.startPos[attPos] : this._activeCache.lastPos[attPos] - this._activeCache.startPos[attPos];
134
- }
135
- setStateAttr(start, end, shouldRender) {
136
- const {zoomLock: zoomLock = !1, minSpan: minSpan = 0, maxSpan: maxSpan = 1} = this.attribute, span = end - start;
137
- span !== this._spanCache && (zoomLock || span < minSpan || span > maxSpan) || (this._spanCache = span,
138
- this.state.start = start, this.state.end = end, shouldRender && this.setAttributes({
139
- start: start,
140
- end: end
141
- }));
142
- }
143
- _clearDragEvents() {
144
- const evtTarget = "browser" === vglobal.env ? vglobal : this.stage, triggers = getEndTriggersOfDrag();
145
- evtTarget.removeEventListener("pointermove", this._onHandlerPointerMove, {
146
- capture: !0
147
- }), triggers.forEach((trigger => {
148
- evtTarget.removeEventListener(trigger, this._onHandlerPointerUp);
149
- })), this.removeEventListener("pointermove", this._onHandlerPointerMove, {
150
- capture: !0
151
- });
152
- }
153
- _onHandlerPointerEnter(e) {
154
- this._showText = !0, this.renderText();
155
- }
156
- _onHandlerPointerLeave(e) {
157
- this._showText = !1, this.renderText();
158
- }
159
- backgroundDragZoom(startPos, endPos) {
160
- const {attPos: attPos, max: max} = this._layoutCache, {position: position} = this.attribute, startPosInComponent = startPos[attPos] - position[attPos], endPosInComponent = endPos[attPos] - position[attPos], start = Math.min(Math.max(Math.min(startPosInComponent, endPosInComponent) / max, 0), 1), end = Math.min(Math.max(Math.max(startPosInComponent, endPosInComponent) / max, 0), 1);
161
- Math.abs(start - end) < .01 ? this.moveZoomWithMiddle(start) : this.setStateAttr(start, end, !1);
162
- }
163
- moveZoomWithMiddle(middle) {
164
- let offset = middle - (this.state.start + this.state.end) / 2;
165
- 0 !== offset && (offset > 0 ? this.state.end + offset > 1 && (offset = 1 - this.state.end) : offset < 0 && this.state.start + offset < 0 && (offset = -this.state.start),
166
- this.setStateAttr(this.state.start + offset, this.state.end + offset, !1));
167
- }
168
- renderDragMask() {
169
- const {dragMaskStyle: dragMaskStyle} = this.attribute, {position: position, width: width, height: height} = this.getLayoutAttrFromConfig();
170
- this._isHorizontal ? this._dragMask = this._container.createOrUpdateChild("dragMask", Object.assign({
171
- x: clamp(this.dragMaskSize() < 0 ? this._activeCache.lastPos.x : this._activeCache.startPos.x, position.x, position.x + width),
172
- y: position.y,
173
- width: this._activeState && this._activeTag === DataZoomActiveTag.background && Math.abs(this.dragMaskSize()) || 0,
174
- height: height
175
- }, dragMaskStyle), "rect") : this._dragMask = this._container.createOrUpdateChild("dragMask", Object.assign({
176
- x: position.x,
177
- y: clamp(this.dragMaskSize() < 0 ? this._activeCache.lastPos.y : this._activeCache.startPos.y, position.y, position.y + height),
178
- width: width,
179
- height: this._activeState && this._activeTag === DataZoomActiveTag.background && Math.abs(this.dragMaskSize()) || 0
180
- }, dragMaskStyle), "rect");
181
- }
182
- isTextOverflow(componentBoundsLike, textBounds, layout) {
183
- if (!textBounds) return !1;
184
- if (this._isHorizontal) {
185
- if ("start" === layout) {
186
- if (textBounds.x1 < componentBoundsLike.x1) return !0;
187
- } else if (textBounds.x2 > componentBoundsLike.x2) return !0;
188
- } else if ("start" === layout) {
189
- if (textBounds.y1 < componentBoundsLike.y1) return !0;
190
- } else if (textBounds.y2 > componentBoundsLike.y2) return !0;
191
- return !1;
192
- }
193
- setTextAttr(startTextBounds, endTextBounds) {
194
- var _a, _b, _c, _d, _e, _f, _g, _h;
195
- const {startTextStyle: startTextStyle, endTextStyle: endTextStyle} = this.attribute, {formatMethod: startTextFormat} = startTextStyle, restStartTextStyle = __rest(startTextStyle, [ "formatMethod" ]), {formatMethod: endTextFormat} = endTextStyle, restEndTextStyle = __rest(endTextStyle, [ "formatMethod" ]), {start: start, end: end} = this.state;
196
- this._startValue = this._statePointToData(start), this._endValue = this._statePointToData(end);
197
- const {position: position, width: width, height: height} = this.getLayoutAttrFromConfig(), startTextValue = startTextFormat ? startTextFormat(this._startValue) : this._startValue, endTextValue = endTextFormat ? endTextFormat(this._endValue) : this._endValue, componentBoundsLike = {
198
- x1: position.x,
199
- y1: position.y,
200
- x2: position.x + width,
201
- y2: position.y + height
52
+ const {start: start, end: end, orient: orient} = this.attribute;
53
+ this._isHorizontal = "top" === orient || "bottom" === orient, start && (this._state.start = start),
54
+ end && (this._state.end = end), this._renderer = new DataZoomRenderer(this._getRendererAttrs()),
55
+ this._interaction = new DataZoomInteraction(this._getInteractionAttrs());
56
+ }
57
+ _getRendererAttrs() {
58
+ return {
59
+ attribute: this.attribute,
60
+ getLayoutAttrFromConfig: this.getLayoutAttrFromConfig,
61
+ setState: state => {
62
+ this._state = state;
63
+ },
64
+ getState: () => this._state,
65
+ getContainer: () => this._container
202
66
  };
203
- let startTextPosition, endTextPosition, startTextAlignStyle, endTextAlignStyle;
204
- this._isHorizontal ? (startTextPosition = {
205
- x: position.x + start * width,
206
- y: position.y + height / 2
207
- }, endTextPosition = {
208
- x: position.x + end * width,
209
- y: position.y + height / 2
210
- }, startTextAlignStyle = {
211
- textAlign: this.isTextOverflow(componentBoundsLike, startTextBounds, "start") ? "left" : "right",
212
- textBaseline: null !== (_b = null === (_a = null == restStartTextStyle ? void 0 : restStartTextStyle.textStyle) || void 0 === _a ? void 0 : _a.textBaseline) && void 0 !== _b ? _b : "middle"
213
- }, endTextAlignStyle = {
214
- textAlign: this.isTextOverflow(componentBoundsLike, endTextBounds, "end") ? "right" : "left",
215
- textBaseline: null !== (_d = null === (_c = null == restEndTextStyle ? void 0 : restEndTextStyle.textStyle) || void 0 === _c ? void 0 : _c.textBaseline) && void 0 !== _d ? _d : "middle"
216
- }) : (startTextPosition = {
217
- x: position.x + width / 2,
218
- y: position.y + start * height
219
- }, endTextPosition = {
220
- x: position.x + width / 2,
221
- y: position.y + end * height
222
- }, startTextAlignStyle = {
223
- textAlign: null !== (_f = null === (_e = null == restStartTextStyle ? void 0 : restStartTextStyle.textStyle) || void 0 === _e ? void 0 : _e.textAlign) && void 0 !== _f ? _f : "center",
224
- textBaseline: this.isTextOverflow(componentBoundsLike, startTextBounds, "start") ? "top" : "bottom"
225
- }, endTextAlignStyle = {
226
- textAlign: null !== (_h = null === (_g = null == restEndTextStyle ? void 0 : restEndTextStyle.textStyle) || void 0 === _g ? void 0 : _g.textAlign) && void 0 !== _h ? _h : "center",
227
- textBaseline: this.isTextOverflow(componentBoundsLike, endTextBounds, "end") ? "bottom" : "top"
228
- }), this._startText = this.maybeAddLabel(this._container, merge({}, restStartTextStyle, {
229
- text: startTextValue,
230
- x: startTextPosition.x,
231
- y: startTextPosition.y,
232
- visible: this._showText,
233
- pickable: !1,
234
- childrenPickable: !1,
235
- textStyle: startTextAlignStyle
236
- }), `data-zoom-start-text-${position}`), this._endText = this.maybeAddLabel(this._container, merge({}, restEndTextStyle, {
237
- text: endTextValue,
238
- x: endTextPosition.x,
239
- y: endTextPosition.y,
240
- visible: this._showText,
241
- pickable: !1,
242
- childrenPickable: !1,
243
- textStyle: endTextAlignStyle
244
- }), `data-zoom-end-text-${position}`);
245
67
  }
246
- renderText() {
247
- let startTextBounds = null, endTextBounds = null;
248
- this.setTextAttr(startTextBounds, endTextBounds), startTextBounds = this._startText.AABBBounds,
249
- endTextBounds = this._endText.AABBBounds, this.setTextAttr(startTextBounds, endTextBounds),
250
- startTextBounds = this._startText.AABBBounds, endTextBounds = this._endText.AABBBounds;
251
- const {x1: x1, x2: x2, y1: y1, y2: y2} = startTextBounds, {dx: startTextDx = 0, dy: startTextDy = 0} = this.attribute.startTextStyle;
252
- if ((new Bounds).set(x1, y1, x2, y2).intersects(endTextBounds)) {
253
- const direction = "bottom" === this.attribute.orient || "right" === this.attribute.orient ? -1 : 1;
254
- if (this._isHorizontal) {
255
- const boundsYDiff = Math.abs(endTextBounds.y1 - endTextBounds.y2);
256
- this._startText.setAttribute("dy", startTextDy + direction * (Number.isFinite(boundsYDiff) ? boundsYDiff : 0));
257
- } else {
258
- const boundsXDiff = Math.abs(endTextBounds.x1 - endTextBounds.x2);
259
- this._startText.setAttribute("dx", startTextDx + direction * (Number.isFinite(boundsXDiff) ? boundsXDiff : 0));
260
- }
261
- } else this._isHorizontal ? this._startText.setAttribute("dy", startTextDy) : this._startText.setAttribute("dx", startTextDx);
262
- }
263
- getLayoutAttrFromConfig() {
264
- var _a, _b, _c, _d, _e, _f;
265
- if (this._layoutAttrFromConfig) return this._layoutAttrFromConfig;
266
- const {position: positionConfig, size: size, orient: orient, middleHandlerStyle: middleHandlerStyle = {}, startHandlerStyle: startHandlerStyle = {}, endHandlerStyle: endHandlerStyle = {}, backgroundStyle: backgroundStyle = {}} = this.attribute, {width: widthConfig, height: heightConfig} = size, middleHandlerSize = null !== (_b = null === (_a = middleHandlerStyle.background) || void 0 === _a ? void 0 : _a.size) && void 0 !== _b ? _b : 10;
267
- let width, height, position;
268
- middleHandlerStyle.visible ? this._isHorizontal ? (width = widthConfig, height = heightConfig - middleHandlerSize,
269
- position = {
270
- x: positionConfig.x,
271
- y: positionConfig.y + middleHandlerSize
272
- }) : (width = widthConfig - middleHandlerSize, height = heightConfig, position = {
273
- x: positionConfig.x + ("left" === orient ? middleHandlerSize : 0),
274
- y: positionConfig.y
275
- }) : (width = widthConfig, height = heightConfig, position = positionConfig);
276
- const startHandlerSize = null !== (_c = startHandlerStyle.size) && void 0 !== _c ? _c : this._isHorizontal ? height : width, endHandlerSize = null !== (_d = endHandlerStyle.size) && void 0 !== _d ? _d : this._isHorizontal ? height : width;
277
- return startHandlerStyle.visible && (this._isHorizontal ? (width -= (startHandlerSize + endHandlerSize) / 2,
278
- position = {
279
- x: position.x + startHandlerSize / 2,
280
- y: position.y
281
- }) : (height -= (startHandlerSize + endHandlerSize) / 2, position = {
282
- x: position.x,
283
- y: position.y + startHandlerSize / 2
284
- })), height += null !== (_e = backgroundStyle.lineWidth / 2) && void 0 !== _e ? _e : 1,
285
- width += null !== (_f = backgroundStyle.lineWidth / 2) && void 0 !== _f ? _f : 1,
286
- this._layoutAttrFromConfig = {
287
- position: position,
288
- width: width,
289
- height: height
290
- }, this._layoutAttrFromConfig;
291
- }
292
- render() {
293
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9;
294
- this._layoutAttrFromConfig = null;
295
- const {orient: orient, backgroundStyle: backgroundStyle, backgroundChartStyle: backgroundChartStyle = {}, selectedBackgroundStyle: selectedBackgroundStyle = {}, selectedBackgroundChartStyle: selectedBackgroundChartStyle = {}, middleHandlerStyle: middleHandlerStyle = {}, startHandlerStyle: startHandlerStyle = {}, endHandlerStyle: endHandlerStyle = {}, brushSelect: brushSelect, zoomLock: zoomLock} = this.attribute, {start: start, end: end} = this.state, {position: position, width: width, height: height} = this.getLayoutAttrFromConfig(), startHandlerMinSize = null !== (_a = startHandlerStyle.triggerMinSize) && void 0 !== _a ? _a : 40, endHandlerMinSize = null !== (_b = endHandlerStyle.triggerMinSize) && void 0 !== _b ? _b : 40, group = this.createOrUpdateChild("dataZoom-container", {}, "group");
296
- if (this._container = group, this._background = group.createOrUpdateChild("background", Object.assign(Object.assign({
297
- x: position.x,
298
- y: position.y,
299
- width: width,
300
- height: height,
301
- cursor: brushSelect ? "crosshair" : "auto"
302
- }, backgroundStyle), {
303
- pickable: !zoomLock && (null === (_c = backgroundStyle.pickable) || void 0 === _c || _c)
304
- }), "rect"), (null === (_d = backgroundChartStyle.line) || void 0 === _d ? void 0 : _d.visible) && this.setPreviewAttributes("line", group),
305
- (null === (_e = backgroundChartStyle.area) || void 0 === _e ? void 0 : _e.visible) && this.setPreviewAttributes("area", group),
306
- brushSelect && this.renderDragMask(), this._isHorizontal ? this._selectedBackground = group.createOrUpdateChild("selectedBackground", Object.assign(Object.assign({
307
- x: position.x + start * width,
308
- y: position.y,
309
- width: (end - start) * width,
310
- height: height,
311
- cursor: brushSelect ? "crosshair" : "move"
312
- }, selectedBackgroundStyle), {
313
- pickable: !zoomLock && (null === (_f = selectedBackgroundChartStyle.pickable) || void 0 === _f || _f)
314
- }), "rect") : this._selectedBackground = group.createOrUpdateChild("selectedBackground", Object.assign(Object.assign({
315
- x: position.x,
316
- y: position.y + start * height,
317
- width: width,
318
- height: (end - start) * height,
319
- cursor: brushSelect ? "crosshair" : "move"
320
- }, selectedBackgroundStyle), {
321
- pickable: !zoomLock && (null === (_g = selectedBackgroundStyle.pickable) || void 0 === _g || _g)
322
- }), "rect"), (null === (_h = selectedBackgroundChartStyle.line) || void 0 === _h ? void 0 : _h.visible) && this.setSelectedPreviewAttributes("line", group),
323
- (null === (_j = selectedBackgroundChartStyle.area) || void 0 === _j ? void 0 : _j.visible) && this.setSelectedPreviewAttributes("area", group),
324
- this._isHorizontal) {
325
- if (middleHandlerStyle.visible) {
326
- const middleHandlerBackgroundSize = (null === (_k = middleHandlerStyle.background) || void 0 === _k ? void 0 : _k.size) || 10;
327
- this._middleHandlerRect = group.createOrUpdateChild("middleHandlerRect", Object.assign(Object.assign({
328
- x: position.x + start * width,
329
- y: position.y - middleHandlerBackgroundSize,
330
- width: (end - start) * width,
331
- height: middleHandlerBackgroundSize
332
- }, null === (_l = middleHandlerStyle.background) || void 0 === _l ? void 0 : _l.style), {
333
- pickable: !zoomLock && (null === (_p = null === (_o = null === (_m = middleHandlerStyle.background) || void 0 === _m ? void 0 : _m.style) || void 0 === _o ? void 0 : _o.pickable) || void 0 === _p || _p)
334
- }), "rect"), this._middleHandlerSymbol = group.createOrUpdateChild("middleHandlerSymbol", Object.assign(Object.assign({
335
- x: position.x + (start + end) / 2 * width,
336
- y: position.y - middleHandlerBackgroundSize / 2,
337
- strokeBoundsBuffer: 0,
338
- angle: 0,
339
- symbolType: null !== (_r = null === (_q = middleHandlerStyle.icon) || void 0 === _q ? void 0 : _q.symbolType) && void 0 !== _r ? _r : "square"
340
- }, middleHandlerStyle.icon), {
341
- pickable: !zoomLock && (null === (_s = middleHandlerStyle.icon.pickable) || void 0 === _s || _s)
342
- }), "symbol");
343
- }
344
- this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign(Object.assign({
345
- x: position.x + start * width,
346
- y: position.y + height / 2,
347
- size: height,
348
- symbolType: null !== (_t = startHandlerStyle.symbolType) && void 0 !== _t ? _t : "square"
349
- }, DEFAULT_HANDLER_ATTR_MAP.horizontal), startHandlerStyle), {
350
- pickable: !zoomLock && (null === (_u = startHandlerStyle.pickable) || void 0 === _u || _u)
351
- }), "symbol"), this._endHandler = group.createOrUpdateChild("endHandler", Object.assign(Object.assign(Object.assign({
352
- x: position.x + end * width,
353
- y: position.y + height / 2,
354
- size: height,
355
- symbolType: null !== (_v = endHandlerStyle.symbolType) && void 0 !== _v ? _v : "square"
356
- }, DEFAULT_HANDLER_ATTR_MAP.horizontal), endHandlerStyle), {
357
- pickable: !zoomLock && (null === (_w = endHandlerStyle.pickable) || void 0 === _w || _w)
358
- }), "symbol");
359
- const startHandlerWidth = Math.max(this._startHandler.AABBBounds.width(), startHandlerMinSize), startHandlerHeight = Math.max(this._startHandler.AABBBounds.height(), startHandlerMinSize), endHandlerWidth = Math.max(this._endHandler.AABBBounds.width(), endHandlerMinSize), endHandlerHeight = Math.max(this._endHandler.AABBBounds.height(), endHandlerMinSize);
360
- this._startHandlerMask = group.createOrUpdateChild("startHandlerMask", Object.assign(Object.assign({
361
- x: position.x + start * width - startHandlerWidth / 2,
362
- y: position.y + height / 2 - startHandlerHeight / 2,
363
- width: startHandlerWidth,
364
- height: startHandlerHeight,
365
- fill: "white",
366
- fillOpacity: 0,
367
- zIndex: 999
368
- }, DEFAULT_HANDLER_ATTR_MAP.horizontal), {
369
- pickable: !zoomLock
370
- }), "rect"), this._endHandlerMask = group.createOrUpdateChild("endHandlerMask", Object.assign(Object.assign({
371
- x: position.x + end * width - endHandlerWidth / 2,
372
- y: position.y + height / 2 - endHandlerHeight / 2,
373
- width: endHandlerWidth,
374
- height: endHandlerHeight,
375
- fill: "white",
376
- fillOpacity: 0,
377
- zIndex: 999
378
- }, DEFAULT_HANDLER_ATTR_MAP.horizontal), {
379
- pickable: !zoomLock
380
- }), "rect");
381
- } else {
382
- if (middleHandlerStyle.visible) {
383
- const middleHandlerBackgroundSize = (null === (_x = middleHandlerStyle.background) || void 0 === _x ? void 0 : _x.size) || 10;
384
- this._middleHandlerRect = group.createOrUpdateChild("middleHandlerRect", Object.assign(Object.assign({
385
- x: "left" === orient ? position.x - middleHandlerBackgroundSize : position.x + width,
386
- y: position.y + start * height,
387
- width: middleHandlerBackgroundSize,
388
- height: (end - start) * height
389
- }, null === (_y = middleHandlerStyle.background) || void 0 === _y ? void 0 : _y.style), {
390
- pickable: !zoomLock && (null === (_1 = null === (_0 = null === (_z = middleHandlerStyle.background) || void 0 === _z ? void 0 : _z.style) || void 0 === _0 ? void 0 : _0.pickable) || void 0 === _1 || _1)
391
- }), "rect"), this._middleHandlerSymbol = group.createOrUpdateChild("middleHandlerSymbol", Object.assign(Object.assign({
392
- x: "left" === orient ? position.x - middleHandlerBackgroundSize / 2 : position.x + width + middleHandlerBackgroundSize / 2,
393
- y: position.y + (start + end) / 2 * height,
394
- angle: Math.PI / 180 * 90,
395
- symbolType: null !== (_3 = null === (_2 = middleHandlerStyle.icon) || void 0 === _2 ? void 0 : _2.symbolType) && void 0 !== _3 ? _3 : "square",
396
- strokeBoundsBuffer: 0
397
- }, middleHandlerStyle.icon), {
398
- pickable: !zoomLock && (null === (_5 = null === (_4 = middleHandlerStyle.icon) || void 0 === _4 ? void 0 : _4.pickable) || void 0 === _5 || _5)
399
- }), "symbol");
400
- }
401
- this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign(Object.assign({
402
- x: position.x + width / 2,
403
- y: position.y + start * height,
404
- size: width,
405
- symbolType: null !== (_6 = startHandlerStyle.symbolType) && void 0 !== _6 ? _6 : "square"
406
- }, DEFAULT_HANDLER_ATTR_MAP.vertical), startHandlerStyle), {
407
- pickable: !zoomLock && (null === (_7 = startHandlerStyle.pickable) || void 0 === _7 || _7)
408
- }), "symbol"), this._endHandler = group.createOrUpdateChild("endHandler", Object.assign(Object.assign(Object.assign({
409
- x: position.x + width / 2,
410
- y: position.y + end * height,
411
- size: width,
412
- symbolType: null !== (_8 = endHandlerStyle.symbolType) && void 0 !== _8 ? _8 : "square"
413
- }, DEFAULT_HANDLER_ATTR_MAP.vertical), endHandlerStyle), {
414
- pickable: !zoomLock && (null === (_9 = endHandlerStyle.pickable) || void 0 === _9 || _9)
415
- }), "symbol");
416
- const startHandlerWidth = Math.max(this._startHandler.AABBBounds.width(), startHandlerMinSize), startHandlerHeight = Math.max(this._startHandler.AABBBounds.height(), startHandlerMinSize), endHandlerWidth = Math.max(this._endHandler.AABBBounds.width(), endHandlerMinSize), endHandlerHeight = Math.max(this._endHandler.AABBBounds.height(), endHandlerMinSize);
417
- this._startHandlerMask = group.createOrUpdateChild("startHandlerMask", Object.assign(Object.assign({
418
- x: position.x + width / 2 + startHandlerWidth / 2,
419
- y: position.y + start * height - startHandlerHeight / 2,
420
- width: endHandlerHeight,
421
- height: endHandlerWidth,
422
- fill: "white",
423
- fillOpacity: 0,
424
- zIndex: 999
425
- }, DEFAULT_HANDLER_ATTR_MAP.vertical), {
426
- pickable: !zoomLock
427
- }), "rect"), this._endHandlerMask = group.createOrUpdateChild("endHandlerMask", Object.assign(Object.assign({
428
- x: position.x + width / 2 + endHandlerWidth / 2,
429
- y: position.y + end * height - endHandlerHeight / 2,
430
- width: endHandlerHeight,
431
- height: endHandlerWidth,
432
- fill: "white",
433
- fillOpacity: 0,
434
- zIndex: 999
435
- }, DEFAULT_HANDLER_ATTR_MAP.vertical), {
436
- pickable: !zoomLock
437
- }), "rect");
438
- }
439
- this._showText && this.renderText();
440
- }
441
- computeBasePoints() {
442
- const {orient: orient} = this.attribute, {position: position, width: width, height: height} = this.getLayoutAttrFromConfig();
443
- let basePointStart, basePointEnd;
444
- return this._isHorizontal ? (basePointStart = [ {
445
- x: position.x,
446
- y: position.y + height
447
- } ], basePointEnd = [ {
448
- x: position.x + width,
449
- y: position.y + height
450
- } ]) : "left" === orient ? (basePointStart = [ {
451
- x: position.x + width,
452
- y: position.y
453
- } ], basePointEnd = [ {
454
- x: position.x + width,
455
- y: position.y + height
456
- } ]) : (basePointStart = [ {
457
- x: position.x,
458
- y: position.y + height
459
- } ], basePointEnd = [ {
460
- x: position.x,
461
- y: position.y
462
- } ]), {
463
- basePointStart: basePointStart,
464
- basePointEnd: basePointEnd
68
+ _getInteractionAttrs() {
69
+ return {
70
+ stage: this.stage,
71
+ attribute: this.attribute,
72
+ startHandlerMask: this._renderer.startHandlerMask,
73
+ endHandlerMask: this._renderer.endHandlerMask,
74
+ middleHandlerSymbol: this._renderer.middleHandlerSymbol,
75
+ middleHandlerRect: this._renderer.middleHandlerRect,
76
+ selectedBackground: this._renderer.selectedBackground,
77
+ background: this._renderer.background,
78
+ previewGroup: this._renderer.previewGroup,
79
+ selectedPreviewGroup: this._renderer.selectedPreviewGroup,
80
+ getLayoutAttrFromConfig: this.getLayoutAttrFromConfig,
81
+ setState: state => {
82
+ this._state = state;
83
+ },
84
+ getState: () => this._state,
85
+ getGlobalTransMatrix: () => this.globalTransMatrix
465
86
  };
466
87
  }
467
- simplifyPoints(points) {
468
- var _a;
469
- if (points.length > 1e4) {
470
- const tolerance = null !== (_a = this.attribute.tolerance) && void 0 !== _a ? _a : this._previewData.length / 1e4;
471
- return flatten_simplify(points, tolerance, !1);
472
- }
473
- return points;
474
- }
475
- getPreviewLinePoints() {
476
- let previewPoints = this._previewData.map((d => ({
477
- x: this._previewPointsX && this._previewPointsX(d),
478
- y: this._previewPointsY && this._previewPointsY(d)
479
- })));
480
- if (0 === previewPoints.length) return previewPoints;
481
- previewPoints = this.simplifyPoints(previewPoints);
482
- const {basePointStart: basePointStart, basePointEnd: basePointEnd} = this.computeBasePoints();
483
- return basePointStart.concat(previewPoints).concat(basePointEnd);
484
- }
485
- getPreviewAreaPoints() {
486
- let previewPoints = this._previewData.map((d => ({
487
- x: this._previewPointsX && this._previewPointsX(d),
488
- y: this._previewPointsY && this._previewPointsY(d),
489
- x1: this._previewPointsX1 && this._previewPointsX1(d),
490
- y1: this._previewPointsY1 && this._previewPointsY1(d)
491
- })));
492
- if (0 === previewPoints.length) return previewPoints;
493
- previewPoints = this.simplifyPoints(previewPoints);
494
- const {basePointStart: basePointStart, basePointEnd: basePointEnd} = this.computeBasePoints();
495
- return basePointStart.concat(previewPoints).concat(basePointEnd);
88
+ bindEvents() {
89
+ this.attribute.disableTriggerEvent ? this.setAttribute("childrenPickable", !1) : (this._interaction.bindEvents(),
90
+ this._interaction.on(IDataZoomInteractiveEvent.stateUpdate, (({shouldRender: shouldRender}) => {
91
+ shouldRender && this._renderer.renderDataZoom(!0);
92
+ })), this._interaction.on(IDataZoomInteractiveEvent.dataZoomUpdate, (({start: start, end: end, tag: tag}) => {
93
+ this._dispatchEvent(IDataZoomEvent.dataZoomChange, {
94
+ start: start,
95
+ end: end,
96
+ tag: tag
97
+ });
98
+ })), this._interaction.on(IDataZoomInteractiveEvent.maskUpdate, (() => {
99
+ this._renderer.renderDragMask();
100
+ })), "auto" === this.attribute.showDetail && (this._container.addEventListener("pointerenter", (() => {
101
+ this._renderer.showText = !0, this._renderer.renderText();
102
+ })), this._container.addEventListener("pointerleave", (() => {
103
+ this._renderer.showText = !1, this._renderer.renderText();
104
+ }))));
496
105
  }
497
- setPreviewAttributes(type, group) {
498
- this._previewGroup || (this._previewGroup = group.createOrUpdateChild("previewGroup", {
499
- pickable: !1
500
- }, "group")), "line" === type ? this._previewLine = this._previewGroup.createOrUpdateChild("previewLine", {}, "line") : this._previewArea = this._previewGroup.createOrUpdateChild("previewArea", {
501
- curveType: "basis"
502
- }, "area");
503
- const {backgroundChartStyle: backgroundChartStyle = {}} = this.attribute;
504
- "line" === type && this._previewLine.setAttributes(Object.assign({
505
- points: this.getPreviewLinePoints(),
506
- curveType: "basis",
507
- pickable: !1
508
- }, backgroundChartStyle.line)), "area" === type && this._previewArea.setAttributes(Object.assign({
509
- points: this.getPreviewAreaPoints(),
510
- curveType: "basis",
511
- pickable: !1
512
- }, backgroundChartStyle.area));
106
+ setAttributes(params, forceUpdateTag) {
107
+ const {start: start, end: end} = this.attribute;
108
+ start && (this._state.start = start), end && (this._state.end = end), this._renderer.setAttributes(this._getRendererAttrs()),
109
+ this._interaction.setAttributes(this._getInteractionAttrs()), super.setAttributes(params, forceUpdateTag);
513
110
  }
514
- setSelectedPreviewAttributes(type, group) {
515
- this._selectedPreviewGroupClip || (this._selectedPreviewGroupClip = group.createOrUpdateChild("selectedPreviewGroupClip", {
516
- pickable: !1
517
- }, "group"), this._selectedPreviewGroup = this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup", {}, "group")),
518
- "line" === type ? this._selectedPreviewLine = this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine", {}, "line") : this._selectedPreviewArea = this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea", {
519
- curveType: "basis"
520
- }, "area");
521
- const {selectedBackgroundChartStyle: selectedBackgroundChartStyle = {}} = this.attribute, {start: start, end: end} = this.state, {position: position, width: width, height: height} = this.getLayoutAttrFromConfig();
522
- this._selectedPreviewGroupClip.setAttributes({
523
- x: this._isHorizontal ? position.x + start * width : position.x,
524
- y: this._isHorizontal ? position.y : position.y + start * height,
525
- width: this._isHorizontal ? (end - start) * width : width,
526
- height: this._isHorizontal ? height : (end - start) * height,
527
- clip: !0,
528
- pickable: !1
529
- }), this._selectedPreviewGroup.setAttributes({
530
- x: -(this._isHorizontal ? position.x + start * width : position.x),
531
- y: -(this._isHorizontal ? position.y : position.y + start * height),
532
- width: this._isHorizontal ? (end - start) * width : width,
533
- height: this._isHorizontal ? height : (end - start) * height,
534
- pickable: !1
535
- }), "line" === type && this._selectedPreviewLine.setAttributes(Object.assign({
536
- points: this.getPreviewLinePoints(),
537
- curveType: "basis",
538
- pickable: !1
539
- }, selectedBackgroundChartStyle.line)), "area" === type && this._selectedPreviewArea.setAttributes(Object.assign({
540
- points: this.getPreviewAreaPoints(),
541
- curveType: "basis",
542
- pickable: !1
543
- }, selectedBackgroundChartStyle.area));
111
+ render() {
112
+ this._layoutCacheFromConfig = null, this._container = this.createOrUpdateChild("datazoom-container", {}, "group"),
113
+ this._renderer.renderDataZoom(), this._interaction.setAttributes(this._getInteractionAttrs());
544
114
  }
545
- maybeAddLabel(container, attributes, name) {
546
- let labelShape = this.find((node => node.name === name), !0);
547
- return labelShape ? labelShape.setAttributes(attributes) : (labelShape = new Tag(attributes),
548
- labelShape.name = name), container.add(labelShape), labelShape;
115
+ release(all) {
116
+ super.release(all), this._interaction.clearDragEvents();
549
117
  }
550
118
  setStartAndEnd(start, end) {
551
- const {start: startAttr, end: endAttr} = this.attribute;
552
- isValid(start) && isValid(end) && (start !== this.state.start || end !== this.state.end) && (this.state.start = start,
553
- this.state.end = end, startAttr === this.state.start && endAttr === this.state.end || (this.setStateAttr(start, end, !0),
554
- this._dispatchEvent("change", {
119
+ const {start: startState, end: endState} = this._state;
120
+ isValid(start) && isValid(end) && (start !== startState || end !== endState) && (this._state = {
555
121
  start: start,
556
- end: end,
557
- tag: this._activeTag
558
- })));
122
+ end: end
123
+ }, this._renderer.renderDataZoom(!0), this._dispatchEvent(IDataZoomEvent.dataZoomChange, {
124
+ start: start,
125
+ end: end
126
+ }));
559
127
  }
560
128
  setPreviewData(data) {
561
- this._previewData = data;
129
+ this._renderer.previewData = data;
562
130
  }
563
131
  setText(text, tag) {
564
- "start" === tag ? this._startText.setAttribute("text", text) : this._endText.setAttribute("text", text);
132
+ "start" === tag ? this._renderer.startText.setAttribute("text", text) : this._renderer.endText.setAttribute("text", text);
565
133
  }
566
134
  getStartValue() {
567
- return this._startValue;
135
+ return this._renderer.startValue;
568
136
  }
569
137
  getEndTextValue() {
570
- return this._endValue;
138
+ return this._renderer.endValue;
571
139
  }
572
140
  getMiddleHandlerSize() {
573
141
  var _a, _b, _c, _d;
@@ -575,24 +143,19 @@ export class DataZoom extends AbstractComponent {
575
143
  return Math.max(middleHandlerRectSize, ...array(middleHandlerSymbolSize));
576
144
  }
577
145
  setPreviewPointsX(callback) {
578
- isFunction(callback) && (this._previewPointsX = callback);
146
+ isFunction(callback) && (this._renderer.previewPointsX = callback);
579
147
  }
580
148
  setPreviewPointsY(callback) {
581
- isFunction(callback) && (this._previewPointsY = callback);
149
+ isFunction(callback) && (this._renderer.previewPointsY = callback);
582
150
  }
583
151
  setPreviewPointsX1(callback) {
584
- isFunction(callback) && (this._previewPointsX1 = callback);
152
+ isFunction(callback) && (this._renderer.previewPointsX1 = callback);
585
153
  }
586
154
  setPreviewPointsY1(callback) {
587
- isFunction(callback) && (this._previewPointsY1 = callback);
155
+ isFunction(callback) && (this._renderer.previewPointsY1 = callback);
588
156
  }
589
157
  setStatePointToData(callback) {
590
- isFunction(callback) && (this._statePointToData = callback);
591
- }
592
- release(all) {
593
- super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).addEventListener("touchmove", this._handleTouchMove, {
594
- passive: !1
595
- }), this._clearDragEvents();
158
+ isFunction(callback) && (this._renderer.statePointToData = callback);
596
159
  }
597
160
  }
598
161