@visactor/vrender-components 0.17.2-alpha.3 → 0.17.2

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 (75) hide show
  1. package/cjs/axis/base.js +2 -12
  2. package/cjs/axis/base.js.map +1 -1
  3. package/cjs/brush/brush.d.ts +3 -12
  4. package/cjs/brush/brush.js +29 -28
  5. package/cjs/brush/brush.js.map +1 -1
  6. package/cjs/checkbox/checkbox.js +4 -8
  7. package/cjs/checkbox/checkbox.js.map +1 -1
  8. package/cjs/core/base.d.ts +2 -0
  9. package/cjs/core/base.js +6 -0
  10. package/cjs/core/base.js.map +1 -1
  11. package/cjs/data-zoom/config.d.ts +18 -0
  12. package/cjs/data-zoom/config.js +19 -1
  13. package/cjs/data-zoom/config.js.map +1 -1
  14. package/cjs/data-zoom/data-zoom.d.ts +4 -3
  15. package/cjs/data-zoom/data-zoom.js +130 -113
  16. package/cjs/data-zoom/data-zoom.js.map +1 -1
  17. package/cjs/data-zoom/type.d.ts +6 -2
  18. package/cjs/data-zoom/type.js.map +1 -1
  19. package/cjs/index.d.ts +1 -1
  20. package/cjs/index.js +1 -1
  21. package/cjs/index.js.map +1 -1
  22. package/cjs/legend/discrete/discrete.d.ts +1 -1
  23. package/cjs/legend/discrete/discrete.js +33 -37
  24. package/cjs/legend/discrete/discrete.js.map +1 -1
  25. package/cjs/pager/pager.js +4 -9
  26. package/cjs/pager/pager.js.map +1 -1
  27. package/cjs/player/base-player.js +2 -5
  28. package/cjs/player/base-player.js.map +1 -1
  29. package/cjs/player/controller/controller.d.ts +0 -1
  30. package/cjs/player/controller/controller.js +5 -16
  31. package/cjs/player/controller/controller.js.map +1 -1
  32. package/cjs/scrollbar/scrollbar.d.ts +0 -1
  33. package/cjs/scrollbar/scrollbar.js +4 -10
  34. package/cjs/scrollbar/scrollbar.js.map +1 -1
  35. package/cjs/slider/slider.js +2 -4
  36. package/cjs/slider/slider.js.map +1 -1
  37. package/dist/index.js +206 -197
  38. package/dist/index.min.js +1 -1
  39. package/es/axis/base.js +2 -12
  40. package/es/axis/base.js.map +1 -1
  41. package/es/brush/brush.d.ts +3 -12
  42. package/es/brush/brush.js +31 -30
  43. package/es/brush/brush.js.map +1 -1
  44. package/es/checkbox/checkbox.js +5 -9
  45. package/es/checkbox/checkbox.js.map +1 -1
  46. package/es/core/base.d.ts +2 -0
  47. package/es/core/base.js +7 -1
  48. package/es/core/base.js.map +1 -1
  49. package/es/data-zoom/config.d.ts +18 -0
  50. package/es/data-zoom/config.js +19 -0
  51. package/es/data-zoom/config.js.map +1 -1
  52. package/es/data-zoom/data-zoom.d.ts +4 -3
  53. package/es/data-zoom/data-zoom.js +131 -114
  54. package/es/data-zoom/data-zoom.js.map +1 -1
  55. package/es/data-zoom/type.d.ts +6 -2
  56. package/es/data-zoom/type.js.map +1 -1
  57. package/es/index.d.ts +1 -1
  58. package/es/index.js +1 -1
  59. package/es/index.js.map +1 -1
  60. package/es/legend/discrete/discrete.d.ts +1 -1
  61. package/es/legend/discrete/discrete.js +33 -38
  62. package/es/legend/discrete/discrete.js.map +1 -1
  63. package/es/pager/pager.js +5 -10
  64. package/es/pager/pager.js.map +1 -1
  65. package/es/player/base-player.js +1 -6
  66. package/es/player/base-player.js.map +1 -1
  67. package/es/player/controller/controller.d.ts +0 -1
  68. package/es/player/controller/controller.js +5 -18
  69. package/es/player/controller/controller.js.map +1 -1
  70. package/es/scrollbar/scrollbar.d.ts +0 -1
  71. package/es/scrollbar/scrollbar.js +5 -11
  72. package/es/scrollbar/scrollbar.js.map +1 -1
  73. package/es/slider/slider.js +3 -5
  74. package/es/slider/slider.js.map +1 -1
  75. package/package.json +6 -6
@@ -8,7 +8,7 @@ var __rest = this && this.__rest || function(s, e) {
8
8
  return t;
9
9
  };
10
10
 
11
- import { vglobal, CustomEvent } from "@visactor/vrender-core";
11
+ import { vglobal } from "@visactor/vrender-core";
12
12
 
13
13
  import { array, clamp, debounce, isFunction, isValid, merge, throttle } from "@visactor/vutils";
14
14
 
@@ -16,7 +16,7 @@ import { AbstractComponent } from "../core/base";
16
16
 
17
17
  import { Tag } from "../tag";
18
18
 
19
- import { DEFAULT_DATA_ZOOM_ATTRIBUTES } from "./config";
19
+ import { DEFAULT_DATA_ZOOM_ATTRIBUTES, DEFAULT_HANDLER_ATTR_MAP } from "./config";
20
20
 
21
21
  import { DataZoomActiveTag } from "./type";
22
22
 
@@ -50,14 +50,18 @@ export class DataZoom extends AbstractComponent {
50
50
  end: 1
51
51
  }, this._statePointToData = state => state, this._onHandlerPointerDown = (e, tag) => {
52
52
  e.stopPropagation(), "start" === tag ? (this._activeTag = DataZoomActiveTag.startHandler,
53
- this._activeItem = this._startHandler) : "end" === tag ? (this._activeTag = DataZoomActiveTag.endHandler,
54
- this._activeItem = this._endHandler) : "middleRect" === tag ? (this._activeTag = DataZoomActiveTag.middleHandler,
53
+ this._activeItem = this._startHandlerMask) : "end" === tag ? (this._activeTag = DataZoomActiveTag.endHandler,
54
+ this._activeItem = this._endHandlerMask) : "middleRect" === tag ? (this._activeTag = DataZoomActiveTag.middleHandler,
55
55
  this._activeItem = this._middleHandlerRect) : "middleSymbol" === tag ? (this._activeTag = DataZoomActiveTag.middleHandler,
56
56
  this._activeItem = this._middleHandlerSymbol) : "background" === tag && (this._activeTag = DataZoomActiveTag.background,
57
57
  this._activeItem = this._background), this._activeState = !0, this._activeCache.startPos = this.eventPosToStagePos(e),
58
- this._activeCache.lastPos = this.eventPosToStagePos(e);
59
- }, this._onHandlerPointerMove = e => {
60
- var _a;
58
+ this._activeCache.lastPos = this.eventPosToStagePos(e), "browser" === vglobal.env && (vglobal.addEventListener("pointermove", this._onHandlerPointerMove, {
59
+ capture: !0
60
+ }), vglobal.addEventListener("pointerup", this._onHandlerPointerUp.bind(this))),
61
+ this.addEventListener("pointermove", this._onHandlerPointerMove, {
62
+ capture: !0
63
+ });
64
+ }, this._onHandlerPointerMove = delayMap[this.attribute.delayType]((e => {
61
65
  e.stopPropagation();
62
66
  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;
63
67
  let {start: start, end: end} = this.state;
@@ -66,9 +70,12 @@ export class DataZoom extends AbstractComponent {
66
70
  start = end + dis, this._activeTag = DataZoomActiveTag.startHandler) : end += dis),
67
71
  this._activeCache.lastPos = pos, brushSelect && this.renderDragMask()), start = Math.min(Math.max(start, 0), 1),
68
72
  end = Math.min(Math.max(end, 0), 1), startAttr === start && endAttr === end || (this.setStateAttr(start, end, !0),
69
- realTime && (null === (_a = this._updateStateCallback) || void 0 === _a || _a.call(this, start, end, this._activeTag)),
70
- this._dispatchChangeEvent(start, end));
71
- };
73
+ this._dispatchEvent("change", {
74
+ start: start,
75
+ end: end,
76
+ tag: this._activeTag
77
+ }));
78
+ }), this.attribute.delayTime);
72
79
  const {start: start, end: end, size: size, orient: orient, showDetail: showDetail, position: position, previewData: previewData, previewPointsX: previewPointsX, previewPointsY: previewPointsY, previewPointsX1: previewPointsX1, previewPointsY1: previewPointsY1, updateStateCallback: updateStateCallback} = this.attribute, {width: width, height: height} = size;
73
80
  start && (this.state.start = start), end && (this.state.end = end), this._spanCache = this.state.end - this.state.start,
74
81
  this._isHorizontal = "top" === orient || "bottom" === orient, this._layoutCache.max = this._isHorizontal ? width : height,
@@ -76,13 +83,13 @@ export class DataZoom extends AbstractComponent {
76
83
  this._activeCache.startPos = position, this._activeCache.lastPos = position, this._showText = "auto" !== showDetail && showDetail,
77
84
  previewData && (this._previewData = previewData), isFunction(previewPointsX) && (this._previewPointsX = previewPointsX),
78
85
  isFunction(previewPointsY) && (this._previewPointsY = previewPointsY), isFunction(previewPointsX1) && (this._previewPointsX1 = previewPointsX1),
79
- isFunction(previewPointsY1) && (this._previewPointsY1 = previewPointsY1), isFunction(updateStateCallback) && (this._updateStateCallback = updateStateCallback);
86
+ isFunction(previewPointsY1) && (this._previewPointsY1 = previewPointsY1);
80
87
  }
81
88
  bindEvents() {
82
89
  if (this.attribute.disableTriggerEvent) return;
83
- const {showDetail: showDetail, brushSelect: brushSelect, delayType: delayType = "throttle", delayTime: delayTime = 0} = this.attribute;
84
- this._startHandler && this._startHandler.addEventListener("pointerdown", (e => this._onHandlerPointerDown(e, "start"))),
85
- this._endHandler && this._endHandler.addEventListener("pointerdown", (e => this._onHandlerPointerDown(e, "end"))),
90
+ const {showDetail: showDetail, brushSelect: brushSelect} = this.attribute;
91
+ this._startHandlerMask && this._startHandlerMask.addEventListener("pointerdown", (e => this._onHandlerPointerDown(e, "start"))),
92
+ this._endHandlerMask && this._endHandlerMask.addEventListener("pointerdown", (e => this._onHandlerPointerDown(e, "end"))),
86
93
  this._middleHandlerSymbol && this._middleHandlerSymbol.addEventListener("pointerdown", (e => this._onHandlerPointerDown(e, "middleSymbol"))),
87
94
  this._middleHandlerRect && this._middleHandlerRect.addEventListener("pointerdown", (e => this._onHandlerPointerDown(e, "middleRect")));
88
95
  const selectedTag = brushSelect ? "background" : "middleRect";
@@ -90,12 +97,7 @@ export class DataZoom extends AbstractComponent {
90
97
  brushSelect && this._background && this._background.addEventListener("pointerdown", (e => this._onHandlerPointerDown(e, "background"))),
91
98
  brushSelect && this._previewGroup && this._previewGroup.addEventListener("pointerdown", (e => this._onHandlerPointerDown(e, "background"))),
92
99
  this._selectedPreviewGroup && this._selectedPreviewGroup.addEventListener("pointerdown", (e => this._onHandlerPointerDown(e, selectedTag))),
93
- "browser" === vglobal.env && (vglobal.addEventListener("pointermove", delayMap[delayType](this._onHandlerPointerMove.bind(this), delayTime), {
94
- capture: !0
95
- }), vglobal.addEventListener("pointerup", this._onHandlerPointerUp.bind(this))),
96
- this.addEventListener("pointermove", delayMap[delayType](this._onHandlerPointerMove, delayTime), {
97
- capture: !0
98
- }), this.addEventListener("pointerup", this._onHandlerPointerUp), this.addEventListener("pointerupoutside", this._onHandlerPointerUp),
100
+ this.addEventListener("pointerup", this._onHandlerPointerUp), this.addEventListener("pointerupoutside", this._onHandlerPointerUp),
99
101
  "auto" === showDetail && (this.addEventListener("pointerenter", this._onHandlerPointerEnter),
100
102
  this.addEventListener("pointerleave", this._onHandlerPointerLeave));
101
103
  }
@@ -112,15 +114,14 @@ export class DataZoom extends AbstractComponent {
112
114
  }));
113
115
  }
114
116
  eventPosToStagePos(e) {
115
- var _a, _b, _c;
116
- const stagePosition = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.window.getBoundingClientRect();
117
+ var _a, _b;
118
+ const {x: x, y: y} = vglobal.mapToCanvasPoint(e);
117
119
  return {
118
- x: e.clientX - ((null == stagePosition ? void 0 : stagePosition.left) || 0) - ((null === (_b = this.stage) || void 0 === _b ? void 0 : _b.x) || 0),
119
- y: e.clientY - ((null == stagePosition ? void 0 : stagePosition.top) || 0) - ((null === (_c = this.stage) || void 0 === _c ? void 0 : _c.y) || 0)
120
+ x: x - ((null === (_a = this.stage) || void 0 === _a ? void 0 : _a.x) || 0),
121
+ y: y - ((null === (_b = this.stage) || void 0 === _b ? void 0 : _b.y) || 0)
120
122
  };
121
123
  }
122
124
  _onHandlerPointerUp(e) {
123
- var _a;
124
125
  e.preventDefault();
125
126
  const {start: start, end: end, brushSelect: brushSelect, realTime: realTime = !0} = this.attribute;
126
127
  if (this._activeState && this._activeTag === DataZoomActiveTag.background) {
@@ -128,8 +129,16 @@ export class DataZoom extends AbstractComponent {
128
129
  this.backgroundDragZoom(this._activeCache.startPos, pos);
129
130
  }
130
131
  this._activeState = !1, brushSelect && this.renderDragMask(), realTime && start === this.state.start && end === this.state.end || (this.setStateAttr(this.state.start, this.state.end, !0),
131
- null === (_a = this._updateStateCallback) || void 0 === _a || _a.call(this, this.state.start, this.state.end, this._activeTag),
132
- this._dispatchChangeEvent(this.state.start, this.state.end));
132
+ this._dispatchEvent("change", {
133
+ start: this.state.start,
134
+ end: this.state.end,
135
+ tag: this._activeTag
136
+ })), "browser" === vglobal.env && (vglobal.removeEventListener("pointermove", this._onHandlerPointerMove, {
137
+ capture: !0
138
+ }), vglobal.removeEventListener("pointerup", this._onHandlerPointerUp.bind(this))),
139
+ this.removeEventListener("pointermove", this._onHandlerPointerMove, {
140
+ capture: !0
141
+ });
133
142
  }
134
143
  _onHandlerPointerEnter(e) {
135
144
  e.stopPropagation(), this._showText = !0, this.renderText();
@@ -238,17 +247,17 @@ export class DataZoom extends AbstractComponent {
238
247
  }, this._layoutAttrFromConfig;
239
248
  }
240
249
  render() {
241
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
250
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
242
251
  this._layoutAttrFromConfig = null;
243
- const {orient: orient, backgroundStyle: backgroundStyle, backgroundChartStyle: backgroundChartStyle, selectedBackgroundStyle: selectedBackgroundStyle, selectedBackgroundChartStyle: selectedBackgroundChartStyle, middleHandlerStyle: middleHandlerStyle, startHandlerStyle: startHandlerStyle, endHandlerStyle: endHandlerStyle, brushSelect: brushSelect} = this.attribute, {start: start, end: end} = this.state, {position: position, width: width, height: height} = this.getLayoutAttrFromConfig(), group = this.createOrUpdateChild("dataZoom-container", {}, "group");
244
- this._container = group, this._background = group.createOrUpdateChild("background", Object.assign({
252
+ const {orient: orient, backgroundStyle: backgroundStyle, backgroundChartStyle: backgroundChartStyle, selectedBackgroundStyle: selectedBackgroundStyle, selectedBackgroundChartStyle: selectedBackgroundChartStyle, middleHandlerStyle: middleHandlerStyle, startHandlerStyle: startHandlerStyle, endHandlerStyle: endHandlerStyle, brushSelect: brushSelect} = 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");
253
+ if (this._container = group, this._background = group.createOrUpdateChild("background", Object.assign({
245
254
  x: position.x,
246
255
  y: position.y,
247
256
  width: width,
248
257
  height: height,
249
258
  cursor: brushSelect ? "crosshair" : "auto"
250
- }, backgroundStyle), "rect"), (null === (_a = null == backgroundChartStyle ? void 0 : backgroundChartStyle.line) || void 0 === _a ? void 0 : _a.visible) && this.setPreviewAttributes("line", group),
251
- (null === (_b = null == backgroundChartStyle ? void 0 : backgroundChartStyle.area) || void 0 === _b ? void 0 : _b.visible) && this.setPreviewAttributes("area", group),
259
+ }, backgroundStyle), "rect"), (null === (_c = null == backgroundChartStyle ? void 0 : backgroundChartStyle.line) || void 0 === _c ? void 0 : _c.visible) && this.setPreviewAttributes("line", group),
260
+ (null === (_d = null == backgroundChartStyle ? void 0 : backgroundChartStyle.area) || void 0 === _d ? void 0 : _d.visible) && this.setPreviewAttributes("area", group),
252
261
  brushSelect && this.renderDragMask(), this._isHorizontal ? this._selectedBackground = group.createOrUpdateChild("selectedBackground", Object.assign({
253
262
  x: position.x + start * width,
254
263
  y: position.y,
@@ -261,73 +270,91 @@ export class DataZoom extends AbstractComponent {
261
270
  width: width,
262
271
  height: (end - start) * height,
263
272
  cursor: brushSelect ? "crosshair" : "move"
264
- }, selectedBackgroundStyle), "rect"), (null === (_c = null == selectedBackgroundChartStyle ? void 0 : selectedBackgroundChartStyle.line) || void 0 === _c ? void 0 : _c.visible) && this.setSelectedPreviewAttributes("line", group),
265
- (null === (_d = null == selectedBackgroundChartStyle ? void 0 : selectedBackgroundChartStyle.area) || void 0 === _d ? void 0 : _d.visible) && this.setSelectedPreviewAttributes("area", group),
266
- this._showText && this.renderText(), this._isHorizontal ? (this._startHandler = group.createOrUpdateChild("startHandler", Object.assign({
267
- x: position.x + start * width,
268
- y: position.y + height / 2,
269
- size: height,
270
- angle: 0,
271
- symbolType: null !== (_e = null == startHandlerStyle ? void 0 : startHandlerStyle.symbolType) && void 0 !== _e ? _e : "square",
272
- cursor: "ew-resize",
273
- strokeBoundsBuffer: 0,
274
- boundsPadding: 2,
275
- pickMode: "imprecise"
276
- }, startHandlerStyle), "symbol"), this._endHandler = group.createOrUpdateChild("endHandler", Object.assign({
277
- x: position.x + end * width,
278
- y: position.y + height / 2,
279
- size: height,
280
- angle: 0,
281
- symbolType: null !== (_f = null == endHandlerStyle ? void 0 : endHandlerStyle.symbolType) && void 0 !== _f ? _f : "square",
282
- cursor: "ew-resize",
283
- strokeBoundsBuffer: 0,
284
- boundsPadding: 2,
285
- pickMode: "imprecise"
286
- }, endHandlerStyle), "symbol"), (null == middleHandlerStyle ? void 0 : middleHandlerStyle.visible) && (this._middleHandlerRect = group.createOrUpdateChild("middleHandlerRect", Object.assign({
287
- x: position.x + start * width,
288
- y: position.y - ((null === (_g = null == middleHandlerStyle ? void 0 : middleHandlerStyle.background) || void 0 === _g ? void 0 : _g.size) || 10),
289
- width: (end - start) * width,
290
- height: (null === (_h = null == middleHandlerStyle ? void 0 : middleHandlerStyle.background) || void 0 === _h ? void 0 : _h.size) || 10
291
- }, null === (_j = null == middleHandlerStyle ? void 0 : middleHandlerStyle.background) || void 0 === _j ? void 0 : _j.style), "rect"),
292
- this._middleHandlerSymbol = group.createOrUpdateChild("middleHandlerSymbol", Object.assign({
293
- x: position.x + (start + end) / 2 * width,
294
- y: position.y - ((null === (_k = null == middleHandlerStyle ? void 0 : middleHandlerStyle.background) || void 0 === _k ? void 0 : _k.size) || 10) / 2,
295
- strokeBoundsBuffer: 0,
296
- angle: 0,
297
- symbolType: null !== (_m = null === (_l = null == middleHandlerStyle ? void 0 : middleHandlerStyle.icon) || void 0 === _l ? void 0 : _l.symbolType) && void 0 !== _m ? _m : "square"
298
- }, null == middleHandlerStyle ? void 0 : middleHandlerStyle.icon), "symbol"))) : (this._startHandler = group.createOrUpdateChild("startHandler", Object.assign({
299
- x: position.x + width / 2,
300
- y: position.y + start * height,
301
- size: width,
302
- angle: Math.PI / 180 * 90,
303
- symbolType: null !== (_o = null == startHandlerStyle ? void 0 : startHandlerStyle.symbolType) && void 0 !== _o ? _o : "square",
304
- cursor: "ns-resize",
305
- boundsPadding: 2,
306
- pickMode: "imprecise",
307
- strokeBoundsBuffer: 0
308
- }, startHandlerStyle), "symbol"), (null == middleHandlerStyle ? void 0 : middleHandlerStyle.visible) && (this._middleHandlerRect = group.createOrUpdateChild("middleHandlerRect", Object.assign({
309
- x: "left" === orient ? position.x - ((null === (_p = null == middleHandlerStyle ? void 0 : middleHandlerStyle.background) || void 0 === _p ? void 0 : _p.size) || 10) : position.x + width,
310
- y: position.y + start * height,
311
- width: (null === (_q = null == middleHandlerStyle ? void 0 : middleHandlerStyle.background) || void 0 === _q ? void 0 : _q.size) || 10,
312
- height: (end - start) * height
313
- }, null === (_r = null == middleHandlerStyle ? void 0 : middleHandlerStyle.background) || void 0 === _r ? void 0 : _r.style), "rect"),
314
- this._middleHandlerSymbol = group.createOrUpdateChild("middleHandlerSymbol", Object.assign({
315
- x: "left" === orient ? position.x - ((null === (_s = null == middleHandlerStyle ? void 0 : middleHandlerStyle.background) || void 0 === _s ? void 0 : _s.size) || 10) / 2 : position.x + width + ((null === (_t = null == middleHandlerStyle ? void 0 : middleHandlerStyle.background) || void 0 === _t ? void 0 : _t.size) || 10) / 2,
316
- y: position.y + (start + end) / 2 * height,
317
- angle: Math.PI / 180 * 90,
318
- symbolType: null !== (_v = null === (_u = null == middleHandlerStyle ? void 0 : middleHandlerStyle.icon) || void 0 === _u ? void 0 : _u.symbolType) && void 0 !== _v ? _v : "square",
319
- strokeBoundsBuffer: 0
320
- }, null == middleHandlerStyle ? void 0 : middleHandlerStyle.icon), "symbol")), this._endHandler = group.createOrUpdateChild("endHandler", Object.assign({
321
- x: position.x + width / 2,
322
- y: position.y + end * height,
323
- size: width,
324
- angle: Math.PI / 180 * 90,
325
- symbolType: null !== (_w = null == endHandlerStyle ? void 0 : endHandlerStyle.symbolType) && void 0 !== _w ? _w : "square",
326
- cursor: "ns-resize",
327
- boundsPadding: 2,
328
- pickMode: "imprecise",
329
- strokeBoundsBuffer: 0
330
- }, endHandlerStyle), "symbol"));
273
+ }, selectedBackgroundStyle), "rect"), (null === (_e = null == selectedBackgroundChartStyle ? void 0 : selectedBackgroundChartStyle.line) || void 0 === _e ? void 0 : _e.visible) && this.setSelectedPreviewAttributes("line", group),
274
+ (null === (_f = null == selectedBackgroundChartStyle ? void 0 : selectedBackgroundChartStyle.area) || void 0 === _f ? void 0 : _f.visible) && this.setSelectedPreviewAttributes("area", group),
275
+ this._showText && this.renderText(), this._isHorizontal) {
276
+ this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign({
277
+ x: position.x + start * width,
278
+ y: position.y + height / 2,
279
+ size: height,
280
+ symbolType: null !== (_g = null == startHandlerStyle ? void 0 : startHandlerStyle.symbolType) && void 0 !== _g ? _g : "square"
281
+ }, DEFAULT_HANDLER_ATTR_MAP.horizontal), startHandlerStyle), "symbol"), this._endHandler = group.createOrUpdateChild("endHandler", Object.assign(Object.assign({
282
+ x: position.x + end * width,
283
+ y: position.y + height / 2,
284
+ size: height,
285
+ symbolType: null !== (_h = null == endHandlerStyle ? void 0 : endHandlerStyle.symbolType) && void 0 !== _h ? _h : "square"
286
+ }, DEFAULT_HANDLER_ATTR_MAP.horizontal), endHandlerStyle), "symbol");
287
+ 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);
288
+ this._startHandlerMask = group.createOrUpdateChild("startHandlerMask", Object.assign({
289
+ x: position.x + start * width - startHandlerWidth / 2,
290
+ y: position.y + height / 2 - startHandlerHeight / 2,
291
+ width: startHandlerWidth,
292
+ height: startHandlerHeight,
293
+ fill: "white",
294
+ fillOpacity: 0
295
+ }, DEFAULT_HANDLER_ATTR_MAP.horizontal), "rect"), this._endHandlerMask = group.createOrUpdateChild("endHandlerMask", Object.assign({
296
+ x: position.x + end * width - endHandlerWidth / 2,
297
+ y: position.y + height / 2 - endHandlerHeight / 2,
298
+ width: endHandlerWidth,
299
+ height: endHandlerHeight,
300
+ fill: "white",
301
+ fillOpacity: 0
302
+ }, DEFAULT_HANDLER_ATTR_MAP.horizontal), "rect"), (null == middleHandlerStyle ? void 0 : middleHandlerStyle.visible) && (this._middleHandlerRect = group.createOrUpdateChild("middleHandlerRect", Object.assign({
303
+ x: position.x + start * width,
304
+ y: position.y - ((null === (_j = null == middleHandlerStyle ? void 0 : middleHandlerStyle.background) || void 0 === _j ? void 0 : _j.size) || 10),
305
+ width: (end - start) * width,
306
+ height: (null === (_k = null == middleHandlerStyle ? void 0 : middleHandlerStyle.background) || void 0 === _k ? void 0 : _k.size) || 10
307
+ }, null === (_l = null == middleHandlerStyle ? void 0 : middleHandlerStyle.background) || void 0 === _l ? void 0 : _l.style), "rect"),
308
+ this._middleHandlerSymbol = group.createOrUpdateChild("middleHandlerSymbol", Object.assign({
309
+ x: position.x + (start + end) / 2 * width,
310
+ y: position.y - ((null === (_m = null == middleHandlerStyle ? void 0 : middleHandlerStyle.background) || void 0 === _m ? void 0 : _m.size) || 10) / 2,
311
+ strokeBoundsBuffer: 0,
312
+ angle: 0,
313
+ symbolType: null !== (_p = null === (_o = null == middleHandlerStyle ? void 0 : middleHandlerStyle.icon) || void 0 === _o ? void 0 : _o.symbolType) && void 0 !== _p ? _p : "square"
314
+ }, null == middleHandlerStyle ? void 0 : middleHandlerStyle.icon), "symbol"));
315
+ } else {
316
+ this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign({
317
+ x: position.x + width / 2,
318
+ y: position.y + start * height,
319
+ size: width,
320
+ symbolType: null !== (_q = null == startHandlerStyle ? void 0 : startHandlerStyle.symbolType) && void 0 !== _q ? _q : "square"
321
+ }, DEFAULT_HANDLER_ATTR_MAP.vertical), startHandlerStyle), "symbol"), this._endHandler = group.createOrUpdateChild("endHandler", Object.assign(Object.assign({
322
+ x: position.x + width / 2,
323
+ y: position.y + end * height,
324
+ size: width,
325
+ symbolType: null !== (_r = null == endHandlerStyle ? void 0 : endHandlerStyle.symbolType) && void 0 !== _r ? _r : "square"
326
+ }, DEFAULT_HANDLER_ATTR_MAP.vertical), endHandlerStyle), "symbol");
327
+ 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);
328
+ this._startHandlerMask = group.createOrUpdateChild("startHandlerMask", Object.assign({
329
+ x: position.x + width / 2 - startHandlerWidth / 2,
330
+ y: position.y + start * height - startHandlerHeight / 2,
331
+ width: startHandlerWidth,
332
+ height: startHandlerHeight,
333
+ symbolType: "rect",
334
+ fill: "white",
335
+ fillOpacity: 0
336
+ }, DEFAULT_HANDLER_ATTR_MAP.vertical), "symbol"), this._endHandlerMask = group.createOrUpdateChild("endHandlerMask", Object.assign({
337
+ x: position.x + width / 2 - endHandlerWidth / 2,
338
+ y: position.y + end * height - endHandlerHeight / 2,
339
+ width: endHandlerWidth,
340
+ height: endHandlerHeight,
341
+ symbolType: "rect",
342
+ fill: "white",
343
+ fillOpacity: 0
344
+ }, DEFAULT_HANDLER_ATTR_MAP.vertical), "symbol"), (null == middleHandlerStyle ? void 0 : middleHandlerStyle.visible) && (this._middleHandlerRect = group.createOrUpdateChild("middleHandlerRect", Object.assign({
345
+ x: "left" === orient ? position.x - ((null === (_s = null == middleHandlerStyle ? void 0 : middleHandlerStyle.background) || void 0 === _s ? void 0 : _s.size) || 10) : position.x + width,
346
+ y: position.y + start * height,
347
+ width: (null === (_t = null == middleHandlerStyle ? void 0 : middleHandlerStyle.background) || void 0 === _t ? void 0 : _t.size) || 10,
348
+ height: (end - start) * height
349
+ }, null === (_u = null == middleHandlerStyle ? void 0 : middleHandlerStyle.background) || void 0 === _u ? void 0 : _u.style), "rect"),
350
+ this._middleHandlerSymbol = group.createOrUpdateChild("middleHandlerSymbol", Object.assign({
351
+ x: "left" === orient ? position.x - ((null === (_v = null == middleHandlerStyle ? void 0 : middleHandlerStyle.background) || void 0 === _v ? void 0 : _v.size) || 10) / 2 : position.x + width + ((null === (_w = null == middleHandlerStyle ? void 0 : middleHandlerStyle.background) || void 0 === _w ? void 0 : _w.size) || 10) / 2,
352
+ y: position.y + (start + end) / 2 * height,
353
+ angle: Math.PI / 180 * 90,
354
+ symbolType: null !== (_y = null === (_x = null == middleHandlerStyle ? void 0 : middleHandlerStyle.icon) || void 0 === _x ? void 0 : _x.symbolType) && void 0 !== _y ? _y : "square",
355
+ strokeBoundsBuffer: 0
356
+ }, null == middleHandlerStyle ? void 0 : middleHandlerStyle.icon), "symbol"));
357
+ }
331
358
  }
332
359
  computeBasePoints() {
333
360
  const {orient: orient} = this.attribute, {position: position, width: width, height: height} = this.getLayoutAttrFromConfig();
@@ -429,22 +456,15 @@ export class DataZoom extends AbstractComponent {
429
456
  return labelShape ? labelShape.setAttributes(attributes) : (labelShape = new Tag(attributes),
430
457
  labelShape.name = name), container.add(labelShape), labelShape;
431
458
  }
432
- _dispatchChangeEvent(start, end) {
433
- var _a;
434
- const changeEvent = new CustomEvent("change", {
435
- start: start,
436
- end: end
437
- });
438
- changeEvent.manager = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.eventSystem.manager,
439
- this.dispatchEvent(changeEvent);
440
- }
441
459
  setStartAndEnd(start, end) {
442
- var _a;
443
460
  const {start: startAttr, end: endAttr} = this.attribute;
444
461
  isValid(start) && isValid(end) && (start !== this.state.start || end !== this.state.end) && (this.state.start = start,
445
462
  this.state.end = end, startAttr === this.state.start && endAttr === this.state.end || (this.setStateAttr(start, end, !0),
446
- null === (_a = this._updateStateCallback) || void 0 === _a || _a.call(this, start, end, this._activeTag),
447
- this._dispatchChangeEvent(start, end)));
463
+ this._dispatchEvent("change", {
464
+ start: start,
465
+ end: end,
466
+ tag: this._activeTag
467
+ })));
448
468
  }
449
469
  setPreviewData(data) {
450
470
  this._previewData = data;
@@ -463,9 +483,6 @@ export class DataZoom extends AbstractComponent {
463
483
  const {middleHandlerStyle: middleHandlerStyle} = this.attribute, middleHandlerRectSize = null !== (_b = null === (_a = null == middleHandlerStyle ? void 0 : middleHandlerStyle.background) || void 0 === _a ? void 0 : _a.size) && void 0 !== _b ? _b : 10, middleHandlerSymbolSize = null !== (_d = null === (_c = null == middleHandlerStyle ? void 0 : middleHandlerStyle.icon) || void 0 === _c ? void 0 : _c.size) && void 0 !== _d ? _d : 10;
464
484
  return Math.max(middleHandlerRectSize, ...array(middleHandlerSymbolSize));
465
485
  }
466
- setUpdateStateCallback(callback) {
467
- isFunction(callback) && (this._updateStateCallback = callback);
468
- }
469
486
  setPreviewPointsX(callback) {
470
487
  isFunction(callback) && (this._previewPointsX = callback);
471
488
  }