@visactor/vrender-components 0.17.20-alpha.7 → 0.17.20-alpha.9

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.
@@ -189,4 +189,5 @@ class Brush extends base_1.AbstractComponent {
189
189
  }
190
190
  }
191
191
 
192
- exports.Brush = Brush, Brush.defaultAttributes = config_1.DEFAULT_BRUSH_ATTRIBUTES;
192
+ exports.Brush = Brush, Brush.defaultAttributes = config_1.DEFAULT_BRUSH_ATTRIBUTES;
193
+ //# sourceMappingURL=brush.js.map
package/cjs/brush/type.js CHANGED
@@ -8,5 +8,4 @@ Object.defineProperty(exports, "__esModule", {
8
8
  IOperateType.drawStart = "drawStart", IOperateType.drawEnd = "drawEnd", IOperateType.drawing = "drawing",
9
9
  IOperateType.moving = "moving", IOperateType.moveStart = "moveStart", IOperateType.moveEnd = "moveEnd",
10
10
  IOperateType.brushClear = "brushClear";
11
- }(IOperateType = exports.IOperateType || (exports.IOperateType = {}));
12
- //# sourceMappingURL=type.js.map
11
+ }(IOperateType = exports.IOperateType || (exports.IOperateType = {}));
@@ -165,6 +165,7 @@ export declare class DataZoom extends AbstractComponent<Required<DataZoomAttribu
165
165
  y: number;
166
166
  };
167
167
  private _onHandlerPointerDown;
168
+ private _pointerMove;
168
169
  private _onHandlerPointerMove;
169
170
  private _onHandlerPointerUp;
170
171
  private _onHandlerPointerEnter;
@@ -61,11 +61,11 @@ class DataZoom extends base_1.AbstractComponent {
61
61
  this._activeItem = this._background), this._activeState = !0, this._activeCache.startPos = this.eventPosToStagePos(e),
62
62
  this._activeCache.lastPos = this.eventPosToStagePos(e), "browser" === vrender_core_1.vglobal.env && (vrender_core_1.vglobal.addEventListener("pointermove", this._onHandlerPointerMove, {
63
63
  capture: !0
64
- }), vrender_core_1.vglobal.addEventListener("pointerup", this._onHandlerPointerUp.bind(this))),
64
+ }), vrender_core_1.vglobal.addEventListener("pointerup", this._onHandlerPointerUp)),
65
65
  this.addEventListener("pointermove", this._onHandlerPointerMove, {
66
66
  capture: !0
67
67
  });
68
- }, this._onHandlerPointerMove = delayMap[this.attribute.delayType]((e => {
68
+ }, this._pointerMove = e => {
69
69
  e.stopPropagation();
70
70
  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;
71
71
  let {start: start, end: end} = this.state;
@@ -73,13 +73,32 @@ class DataZoom extends base_1.AbstractComponent {
73
73
  end = start + dis, this._activeTag = type_1.DataZoomActiveTag.endHandler) : start += dis : this._activeTag === type_1.DataZoomActiveTag.endHandler && (end + dis < start ? (end = start,
74
74
  start = end + dis, this._activeTag = type_1.DataZoomActiveTag.startHandler) : end += dis),
75
75
  this._activeCache.lastPos = pos, brushSelect && this.renderDragMask()), start = Math.min(Math.max(start, 0), 1),
76
- end = Math.min(Math.max(end, 0), 1), startAttr === start && endAttr === end || (this.setStateAttr(start, end, !0),
76
+ end = Math.min(Math.max(end, 0), 1), !realTime || startAttr === start && endAttr === end || (this.setStateAttr(start, end, !0),
77
77
  this._dispatchEvent("change", {
78
78
  start: start,
79
79
  end: end,
80
80
  tag: this._activeTag
81
81
  }));
82
- }), this.attribute.delayTime);
82
+ }, this._onHandlerPointerMove = 0 === this.attribute.delayTime ? this._pointerMove : delayMap[this.attribute.delayType](this._pointerMove, this.attribute.delayTime),
83
+ this._onHandlerPointerUp = e => {
84
+ e.preventDefault();
85
+ const {start: start, end: end, brushSelect: brushSelect, realTime: realTime = !0} = this.attribute;
86
+ if (this._activeState && this._activeTag === type_1.DataZoomActiveTag.background) {
87
+ const pos = this.eventPosToStagePos(e);
88
+ this.backgroundDragZoom(this._activeCache.startPos, pos);
89
+ }
90
+ this._activeState = !1, brushSelect && this.renderDragMask(), realTime && start === this.state.start && end === this.state.end || (this.setStateAttr(this.state.start, this.state.end, !0),
91
+ this._dispatchEvent("change", {
92
+ start: this.state.start,
93
+ end: this.state.end,
94
+ tag: this._activeTag
95
+ })), "browser" === vrender_core_1.vglobal.env && (vrender_core_1.vglobal.removeEventListener("pointermove", this._onHandlerPointerMove, {
96
+ capture: !0
97
+ }), vrender_core_1.vglobal.removeEventListener("pointerup", this._onHandlerPointerUp)),
98
+ this.removeEventListener("pointermove", this._onHandlerPointerMove, {
99
+ capture: !0
100
+ }), this.removeEventListener("pointerup", this._onHandlerPointerUp);
101
+ };
83
102
  const {position: position, showDetail: showDetail} = attributes;
84
103
  this._activeCache.startPos = position, this._activeCache.lastPos = position, this._showText = "auto" !== showDetail && showDetail,
85
104
  this.setPropsFromAttrs();
@@ -123,25 +142,6 @@ class DataZoom extends base_1.AbstractComponent {
123
142
  y: y - ((null === (_b = this.stage) || void 0 === _b ? void 0 : _b.y) || 0)
124
143
  };
125
144
  }
126
- _onHandlerPointerUp(e) {
127
- e.preventDefault();
128
- const {start: start, end: end, brushSelect: brushSelect, realTime: realTime = !0} = this.attribute;
129
- if (this._activeState && this._activeTag === type_1.DataZoomActiveTag.background) {
130
- const pos = this.eventPosToStagePos(e);
131
- this.backgroundDragZoom(this._activeCache.startPos, pos);
132
- }
133
- this._activeState = !1, brushSelect && this.renderDragMask(), realTime && start === this.state.start && end === this.state.end || (this.setStateAttr(this.state.start, this.state.end, !0),
134
- this._dispatchEvent("change", {
135
- start: this.state.start,
136
- end: this.state.end,
137
- tag: this._activeTag
138
- })), "browser" === vrender_core_1.vglobal.env && (vrender_core_1.vglobal.removeEventListener("pointermove", this._onHandlerPointerMove, {
139
- capture: !0
140
- }), vrender_core_1.vglobal.removeEventListener("pointerup", this._onHandlerPointerUp.bind(this))),
141
- this.removeEventListener("pointermove", this._onHandlerPointerMove, {
142
- capture: !0
143
- });
144
- }
145
145
  _onHandlerPointerEnter(e) {
146
146
  e.stopPropagation(), this._showText = !0, this.renderText();
147
147
  }
@@ -274,7 +274,7 @@ class DataZoom extends base_1.AbstractComponent {
274
274
  }, this._layoutAttrFromConfig;
275
275
  }
276
276
  render() {
277
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
277
+ 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;
278
278
  this._layoutAttrFromConfig = null;
279
279
  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");
280
280
  if (this._container = group, this._background = group.createOrUpdateChild("background", Object.assign(Object.assign({
@@ -284,9 +284,9 @@ class DataZoom extends base_1.AbstractComponent {
284
284
  height: height,
285
285
  cursor: brushSelect ? "crosshair" : "auto"
286
286
  }, backgroundStyle), {
287
- pickable: !zoomLock
288
- }), "rect"), (null === (_c = backgroundChartStyle.line) || void 0 === _c ? void 0 : _c.visible) && this.setPreviewAttributes("line", group),
289
- (null === (_d = backgroundChartStyle.area) || void 0 === _d ? void 0 : _d.visible) && this.setPreviewAttributes("area", group),
287
+ pickable: !zoomLock && (null === (_c = backgroundStyle.pickable) || void 0 === _c || _c)
288
+ }), "rect"), (null === (_d = backgroundChartStyle.line) || void 0 === _d ? void 0 : _d.visible) && this.setPreviewAttributes("line", group),
289
+ (null === (_e = backgroundChartStyle.area) || void 0 === _e ? void 0 : _e.visible) && this.setPreviewAttributes("area", group),
290
290
  brushSelect && this.renderDragMask(), this._isHorizontal ? this._selectedBackground = group.createOrUpdateChild("selectedBackground", Object.assign(Object.assign({
291
291
  x: position.x + start * width,
292
292
  y: position.y,
@@ -294,7 +294,7 @@ class DataZoom extends base_1.AbstractComponent {
294
294
  height: height,
295
295
  cursor: brushSelect ? "crosshair" : "move"
296
296
  }, selectedBackgroundStyle), {
297
- pickable: !zoomLock
297
+ pickable: !zoomLock && (null === (_f = selectedBackgroundChartStyle.pickable) || void 0 === _f || _f)
298
298
  }), "rect") : this._selectedBackground = group.createOrUpdateChild("selectedBackground", Object.assign(Object.assign({
299
299
  x: position.x,
300
300
  y: position.y + start * height,
@@ -302,43 +302,43 @@ class DataZoom extends base_1.AbstractComponent {
302
302
  height: (end - start) * height,
303
303
  cursor: brushSelect ? "crosshair" : "move"
304
304
  }, selectedBackgroundStyle), {
305
- pickable: !zoomLock
306
- }), "rect"), (null === (_e = selectedBackgroundChartStyle.line) || void 0 === _e ? void 0 : _e.visible) && this.setSelectedPreviewAttributes("line", group),
307
- (null === (_f = selectedBackgroundChartStyle.area) || void 0 === _f ? void 0 : _f.visible) && this.setSelectedPreviewAttributes("area", group),
305
+ pickable: !zoomLock && (null === (_g = selectedBackgroundStyle.pickable) || void 0 === _g || _g)
306
+ }), "rect"), (null === (_h = selectedBackgroundChartStyle.line) || void 0 === _h ? void 0 : _h.visible) && this.setSelectedPreviewAttributes("line", group),
307
+ (null === (_j = selectedBackgroundChartStyle.area) || void 0 === _j ? void 0 : _j.visible) && this.setSelectedPreviewAttributes("area", group),
308
308
  this._isHorizontal) {
309
309
  if (middleHandlerStyle.visible) {
310
- const middleHandlerBackgroundSize = (null === (_g = middleHandlerStyle.background) || void 0 === _g ? void 0 : _g.size) || 10;
310
+ const middleHandlerBackgroundSize = (null === (_k = middleHandlerStyle.background) || void 0 === _k ? void 0 : _k.size) || 10;
311
311
  this._middleHandlerRect = group.createOrUpdateChild("middleHandlerRect", Object.assign(Object.assign({
312
312
  x: position.x + start * width,
313
313
  y: position.y - middleHandlerBackgroundSize,
314
314
  width: (end - start) * width,
315
315
  height: middleHandlerBackgroundSize
316
- }, null === (_h = middleHandlerStyle.background) || void 0 === _h ? void 0 : _h.style), {
317
- pickable: !zoomLock
316
+ }, null === (_l = middleHandlerStyle.background) || void 0 === _l ? void 0 : _l.style), {
317
+ 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)
318
318
  }), "rect"), this._middleHandlerSymbol = group.createOrUpdateChild("middleHandlerSymbol", Object.assign(Object.assign({
319
319
  x: position.x + (start + end) / 2 * width,
320
320
  y: position.y - middleHandlerBackgroundSize / 2,
321
321
  strokeBoundsBuffer: 0,
322
322
  angle: 0,
323
- symbolType: null !== (_k = null === (_j = middleHandlerStyle.icon) || void 0 === _j ? void 0 : _j.symbolType) && void 0 !== _k ? _k : "square"
323
+ symbolType: null !== (_r = null === (_q = middleHandlerStyle.icon) || void 0 === _q ? void 0 : _q.symbolType) && void 0 !== _r ? _r : "square"
324
324
  }, middleHandlerStyle.icon), {
325
- pickable: !zoomLock
325
+ pickable: !zoomLock && (null === (_s = middleHandlerStyle.icon.pickable) || void 0 === _s || _s)
326
326
  }), "symbol");
327
327
  }
328
328
  this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign(Object.assign({
329
329
  x: position.x + start * width,
330
330
  y: position.y + height / 2,
331
331
  size: height,
332
- symbolType: null !== (_l = startHandlerStyle.symbolType) && void 0 !== _l ? _l : "square"
332
+ symbolType: null !== (_t = startHandlerStyle.symbolType) && void 0 !== _t ? _t : "square"
333
333
  }, config_1.DEFAULT_HANDLER_ATTR_MAP.horizontal), startHandlerStyle), {
334
- pickable: !zoomLock
334
+ pickable: !zoomLock && (null === (_u = startHandlerStyle.pickable) || void 0 === _u || _u)
335
335
  }), "symbol"), this._endHandler = group.createOrUpdateChild("endHandler", Object.assign(Object.assign(Object.assign({
336
336
  x: position.x + end * width,
337
337
  y: position.y + height / 2,
338
338
  size: height,
339
- symbolType: null !== (_m = endHandlerStyle.symbolType) && void 0 !== _m ? _m : "square"
339
+ symbolType: null !== (_v = endHandlerStyle.symbolType) && void 0 !== _v ? _v : "square"
340
340
  }, config_1.DEFAULT_HANDLER_ATTR_MAP.horizontal), endHandlerStyle), {
341
- pickable: !zoomLock
341
+ pickable: !zoomLock && (null === (_w = endHandlerStyle.pickable) || void 0 === _w || _w)
342
342
  }), "symbol");
343
343
  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);
344
344
  this._startHandlerMask = group.createOrUpdateChild("startHandlerMask", Object.assign(Object.assign({
@@ -364,38 +364,38 @@ class DataZoom extends base_1.AbstractComponent {
364
364
  }), "rect");
365
365
  } else {
366
366
  if (middleHandlerStyle.visible) {
367
- const middleHandlerBackgroundSize = (null === (_o = middleHandlerStyle.background) || void 0 === _o ? void 0 : _o.size) || 10;
367
+ const middleHandlerBackgroundSize = (null === (_x = middleHandlerStyle.background) || void 0 === _x ? void 0 : _x.size) || 10;
368
368
  this._middleHandlerRect = group.createOrUpdateChild("middleHandlerRect", Object.assign(Object.assign({
369
369
  x: "left" === orient ? position.x - middleHandlerBackgroundSize : position.x + width,
370
370
  y: position.y + start * height,
371
371
  width: middleHandlerBackgroundSize,
372
372
  height: (end - start) * height
373
- }, null === (_p = middleHandlerStyle.background) || void 0 === _p ? void 0 : _p.style), {
374
- pickable: !zoomLock
373
+ }, null === (_y = middleHandlerStyle.background) || void 0 === _y ? void 0 : _y.style), {
374
+ 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)
375
375
  }), "rect"), this._middleHandlerSymbol = group.createOrUpdateChild("middleHandlerSymbol", Object.assign(Object.assign({
376
376
  x: "left" === orient ? position.x - middleHandlerBackgroundSize / 2 : position.x + width + middleHandlerBackgroundSize / 2,
377
377
  y: position.y + (start + end) / 2 * height,
378
378
  angle: Math.PI / 180 * 90,
379
- symbolType: null !== (_r = null === (_q = middleHandlerStyle.icon) || void 0 === _q ? void 0 : _q.symbolType) && void 0 !== _r ? _r : "square",
379
+ symbolType: null !== (_3 = null === (_2 = middleHandlerStyle.icon) || void 0 === _2 ? void 0 : _2.symbolType) && void 0 !== _3 ? _3 : "square",
380
380
  strokeBoundsBuffer: 0
381
381
  }, middleHandlerStyle.icon), {
382
- pickable: !zoomLock
382
+ pickable: !zoomLock && (null === (_5 = null === (_4 = middleHandlerStyle.icon) || void 0 === _4 ? void 0 : _4.pickable) || void 0 === _5 || _5)
383
383
  }), "symbol");
384
384
  }
385
385
  this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign(Object.assign({
386
386
  x: position.x + width / 2,
387
387
  y: position.y + start * height,
388
388
  size: width,
389
- symbolType: null !== (_s = startHandlerStyle.symbolType) && void 0 !== _s ? _s : "square"
389
+ symbolType: null !== (_6 = startHandlerStyle.symbolType) && void 0 !== _6 ? _6 : "square"
390
390
  }, config_1.DEFAULT_HANDLER_ATTR_MAP.vertical), startHandlerStyle), {
391
- pickable: !zoomLock
391
+ pickable: !zoomLock && (null === (_7 = startHandlerStyle.pickable) || void 0 === _7 || _7)
392
392
  }), "symbol"), this._endHandler = group.createOrUpdateChild("endHandler", Object.assign(Object.assign(Object.assign({
393
393
  x: position.x + width / 2,
394
394
  y: position.y + end * height,
395
395
  size: width,
396
- symbolType: null !== (_t = endHandlerStyle.symbolType) && void 0 !== _t ? _t : "square"
396
+ symbolType: null !== (_8 = endHandlerStyle.symbolType) && void 0 !== _8 ? _8 : "square"
397
397
  }, config_1.DEFAULT_HANDLER_ATTR_MAP.vertical), endHandlerStyle), {
398
- pickable: !zoomLock
398
+ pickable: !zoomLock && (null === (_9 = endHandlerStyle.pickable) || void 0 === _9 || _9)
399
399
  }), "symbol");
400
400
  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);
401
401
  this._startHandlerMask = group.createOrUpdateChild("startHandlerMask", Object.assign(Object.assign({