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

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 (65) 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/data-zoom.d.ts +0 -3
  12. package/cjs/data-zoom/data-zoom.js +35 -37
  13. package/cjs/data-zoom/data-zoom.js.map +1 -1
  14. package/cjs/index.d.ts +1 -1
  15. package/cjs/index.js +1 -1
  16. package/cjs/index.js.map +1 -1
  17. package/cjs/legend/discrete/discrete.d.ts +1 -1
  18. package/cjs/legend/discrete/discrete.js +33 -37
  19. package/cjs/legend/discrete/discrete.js.map +1 -1
  20. package/cjs/pager/pager.js +4 -9
  21. package/cjs/pager/pager.js.map +1 -1
  22. package/cjs/player/base-player.js +2 -5
  23. package/cjs/player/base-player.js.map +1 -1
  24. package/cjs/player/controller/controller.d.ts +0 -1
  25. package/cjs/player/controller/controller.js +5 -16
  26. package/cjs/player/controller/controller.js.map +1 -1
  27. package/cjs/scrollbar/scrollbar.d.ts +0 -1
  28. package/cjs/scrollbar/scrollbar.js +2 -8
  29. package/cjs/scrollbar/scrollbar.js.map +1 -1
  30. package/cjs/slider/slider.js +2 -4
  31. package/cjs/slider/slider.js.map +1 -1
  32. package/dist/index.js +144 -165
  33. package/dist/index.min.js +1 -1
  34. package/es/axis/base.js +2 -12
  35. package/es/axis/base.js.map +1 -1
  36. package/es/brush/brush.d.ts +3 -12
  37. package/es/brush/brush.js +31 -30
  38. package/es/brush/brush.js.map +1 -1
  39. package/es/checkbox/checkbox.js +5 -9
  40. package/es/checkbox/checkbox.js.map +1 -1
  41. package/es/core/base.d.ts +2 -0
  42. package/es/core/base.js +7 -1
  43. package/es/core/base.js.map +1 -1
  44. package/es/data-zoom/data-zoom.d.ts +0 -3
  45. package/es/data-zoom/data-zoom.js +36 -37
  46. package/es/data-zoom/data-zoom.js.map +1 -1
  47. package/es/index.d.ts +1 -1
  48. package/es/index.js +1 -1
  49. package/es/index.js.map +1 -1
  50. package/es/legend/discrete/discrete.d.ts +1 -1
  51. package/es/legend/discrete/discrete.js +33 -38
  52. package/es/legend/discrete/discrete.js.map +1 -1
  53. package/es/pager/pager.js +5 -10
  54. package/es/pager/pager.js.map +1 -1
  55. package/es/player/base-player.js +1 -6
  56. package/es/player/base-player.js.map +1 -1
  57. package/es/player/controller/controller.d.ts +0 -1
  58. package/es/player/controller/controller.js +5 -18
  59. package/es/player/controller/controller.js.map +1 -1
  60. package/es/scrollbar/scrollbar.d.ts +0 -1
  61. package/es/scrollbar/scrollbar.js +3 -9
  62. package/es/scrollbar/scrollbar.js.map +1 -1
  63. package/es/slider/slider.js +3 -5
  64. package/es/slider/slider.js.map +1 -1
  65. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -16928,6 +16928,12 @@
16928
16928
  _getNodeId(id) {
16929
16929
  return `${this.id}-${this.name}-${id}`;
16930
16930
  }
16931
+ _dispatchEvent(eventName, details) {
16932
+ var _a;
16933
+ const changeEvent = new CustomEvent(eventName, details);
16934
+ changeEvent.manager = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventSystem.manager;
16935
+ this.dispatchEvent(changeEvent);
16936
+ }
16931
16937
  }
16932
16938
 
16933
16939
  function __rest(s, e) {
@@ -18590,7 +18596,7 @@
18590
18596
  const [currentPos, currentScrollValue] = this._computeScrollValue(e);
18591
18597
  const range = [preScrollRange[0] + currentScrollValue, preScrollRange[1] + currentScrollValue];
18592
18598
  if (!realTime) {
18593
- this._onChange({
18599
+ this._dispatchEvent('scroll', {
18594
18600
  pre: preRange,
18595
18601
  value: vutils.clampRange(range, limitRange[0], limitRange[1])
18596
18602
  });
@@ -18626,7 +18632,7 @@
18626
18632
  }
18627
18633
  this.attribute.range = currScrollRange;
18628
18634
  if (realTime) {
18629
- this._onChange({
18635
+ this._dispatchEvent('scroll', {
18630
18636
  pre: preRange,
18631
18637
  value: currScrollRange
18632
18638
  });
@@ -18729,12 +18735,6 @@
18729
18735
  ? vutils.clampRange([x1 + min * width, x1 + max * width], x1, width - sliderSize)
18730
18736
  : vutils.clampRange([y1 + min * height, y1 + max * height], y1, height - sliderSize);
18731
18737
  }
18732
- _onChange(detail) {
18733
- var _a;
18734
- const changeEvent = new CustomEvent('scroll', detail);
18735
- changeEvent.manager = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventSystem.manager;
18736
- this.dispatchEvent(changeEvent);
18737
- }
18738
18738
  _reset() {
18739
18739
  this._sliderRenderBounds = null;
18740
18740
  this._sliderLimitRange = null;
@@ -22614,7 +22614,7 @@
22614
22614
  }
22615
22615
  _getLabelAttribute(tickDatum, index, tickData, layer) {
22616
22616
  var _a, _b, _c, _d, _e, _f;
22617
- const _g = this.attribute.label, { space = 4, inside = false, formatMethod, type = 'text', text } = _g, tagAttributes = __rest(_g, ["space", "inside", "formatMethod", "type", "text"]);
22617
+ const { space = 4, inside = false, formatMethod, type = 'text', text } = this.attribute.label;
22618
22618
  let offset = space;
22619
22619
  let tickLength = 0;
22620
22620
  if (((_a = this.attribute.tick) === null || _a === void 0 ? void 0 : _a.visible) && ((_b = this.attribute.tick) === null || _b === void 0 ? void 0 : _b.inside) === inside) {
@@ -22638,7 +22638,7 @@
22638
22638
  const textContent = formatMethod
22639
22639
  ? formatMethod(`${tickDatum.label}`, tickDatum, index, tickData, layer)
22640
22640
  : tickDatum.label;
22641
- let { style: textStyle } = tagAttributes;
22641
+ let { style: textStyle } = this.attribute.label;
22642
22642
  textStyle = vutils.isFunction(textStyle)
22643
22643
  ? vutils.merge({}, DEFAULT_AXIS_THEME.label.style, textStyle(tickDatum, index, tickData, layer))
22644
22644
  : textStyle;
@@ -24374,9 +24374,13 @@
24374
24374
  this._activeState = true;
24375
24375
  this._activeCache.startPos = this.eventPosToStagePos(e);
24376
24376
  this._activeCache.lastPos = this.eventPosToStagePos(e);
24377
+ if (vglobal.env === 'browser') {
24378
+ vglobal.addEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
24379
+ vglobal.addEventListener('pointerup', this._onHandlerPointerUp.bind(this));
24380
+ }
24381
+ this.addEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
24377
24382
  };
24378
- this._onHandlerPointerMove = (e) => {
24379
- var _a;
24383
+ this._onHandlerPointerMove = delayMap$1[this.attribute.delayType]((e) => {
24380
24384
  e.stopPropagation();
24381
24385
  const { start: startAttr, end: endAttr, brushSelect, realTime = true } = this.attribute;
24382
24386
  const pos = this.eventPosToStagePos(e);
@@ -24414,10 +24418,13 @@
24414
24418
  end = Math.min(Math.max(end, 0), 1);
24415
24419
  if (startAttr !== start || endAttr !== end) {
24416
24420
  this.setStateAttr(start, end, true);
24417
- realTime && ((_a = this._updateStateCallback) === null || _a === void 0 ? void 0 : _a.call(this, start, end, this._activeTag));
24418
- this._dispatchChangeEvent(start, end);
24421
+ this._dispatchEvent('change', {
24422
+ start,
24423
+ end,
24424
+ tag: this._activeTag
24425
+ });
24419
24426
  }
24420
- };
24427
+ }, this.attribute.delayTime);
24421
24428
  const { start, end, size, orient, showDetail, position, previewData, previewPointsX, previewPointsY, previewPointsX1, previewPointsY1, updateStateCallback } = this.attribute;
24422
24429
  const { width, height } = size;
24423
24430
  start && (this.state.start = start);
@@ -24440,13 +24447,12 @@
24440
24447
  vutils.isFunction(previewPointsY) && (this._previewPointsY = previewPointsY);
24441
24448
  vutils.isFunction(previewPointsX1) && (this._previewPointsX1 = previewPointsX1);
24442
24449
  vutils.isFunction(previewPointsY1) && (this._previewPointsY1 = previewPointsY1);
24443
- vutils.isFunction(updateStateCallback) && (this._updateStateCallback = updateStateCallback);
24444
24450
  }
24445
24451
  bindEvents() {
24446
24452
  if (this.attribute.disableTriggerEvent) {
24447
24453
  return;
24448
24454
  }
24449
- const { showDetail, brushSelect, delayType = 'throttle', delayTime = 0 } = this.attribute;
24455
+ const { showDetail, brushSelect } = this.attribute;
24450
24456
  if (this._startHandler) {
24451
24457
  this._startHandler.addEventListener('pointerdown', (e) => this._onHandlerPointerDown(e, 'start'));
24452
24458
  }
@@ -24472,15 +24478,6 @@
24472
24478
  if (this._selectedPreviewGroup) {
24473
24479
  this._selectedPreviewGroup.addEventListener('pointerdown', (e) => this._onHandlerPointerDown(e, selectedTag));
24474
24480
  }
24475
- if (vglobal.env === 'browser') {
24476
- vglobal.addEventListener('pointermove', delayMap$1[delayType](this._onHandlerPointerMove.bind(this), delayTime), {
24477
- capture: true
24478
- });
24479
- vglobal.addEventListener('pointerup', this._onHandlerPointerUp.bind(this));
24480
- }
24481
- this.addEventListener('pointermove', delayMap$1[delayType](this._onHandlerPointerMove, delayTime), {
24482
- capture: true
24483
- });
24484
24481
  this.addEventListener('pointerup', this._onHandlerPointerUp);
24485
24482
  this.addEventListener('pointerupoutside', this._onHandlerPointerUp);
24486
24483
  if (showDetail === 'auto') {
@@ -24511,15 +24508,14 @@
24511
24508
  shouldRender && this.setAttributes({ start, end });
24512
24509
  }
24513
24510
  eventPosToStagePos(e) {
24514
- var _a, _b, _c;
24515
- const stagePosition = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.window.getBoundingClientRect();
24511
+ var _a, _b;
24512
+ const { x, y } = vglobal.mapToCanvasPoint(e);
24516
24513
  return {
24517
- x: e.clientX - ((stagePosition === null || stagePosition === void 0 ? void 0 : stagePosition.left) || 0) - (((_b = this.stage) === null || _b === void 0 ? void 0 : _b.x) || 0),
24518
- y: e.clientY - ((stagePosition === null || stagePosition === void 0 ? void 0 : stagePosition.top) || 0) - (((_c = this.stage) === null || _c === void 0 ? void 0 : _c.y) || 0)
24514
+ x: x - (((_a = this.stage) === null || _a === void 0 ? void 0 : _a.x) || 0),
24515
+ y: y - (((_b = this.stage) === null || _b === void 0 ? void 0 : _b.y) || 0)
24519
24516
  };
24520
24517
  }
24521
24518
  _onHandlerPointerUp(e) {
24522
- var _a;
24523
24519
  e.preventDefault();
24524
24520
  const { start, end, brushSelect, realTime = true } = this.attribute;
24525
24521
  if (this._activeState) {
@@ -24532,9 +24528,17 @@
24532
24528
  brushSelect && this.renderDragMask();
24533
24529
  if (!realTime || start !== this.state.start || end !== this.state.end) {
24534
24530
  this.setStateAttr(this.state.start, this.state.end, true);
24535
- (_a = this._updateStateCallback) === null || _a === void 0 ? void 0 : _a.call(this, this.state.start, this.state.end, this._activeTag);
24536
- this._dispatchChangeEvent(this.state.start, this.state.end);
24531
+ this._dispatchEvent('change', {
24532
+ start: this.state.start,
24533
+ end: this.state.end,
24534
+ tag: this._activeTag
24535
+ });
24536
+ }
24537
+ if (vglobal.env === 'browser') {
24538
+ vglobal.removeEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
24539
+ vglobal.removeEventListener('pointerup', this._onHandlerPointerUp.bind(this));
24537
24540
  }
24541
+ this.removeEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
24538
24542
  }
24539
24543
  _onHandlerPointerEnter(e) {
24540
24544
  e.stopPropagation();
@@ -24895,25 +24899,18 @@
24895
24899
  container.add(labelShape);
24896
24900
  return labelShape;
24897
24901
  }
24898
- _dispatchChangeEvent(start, end) {
24899
- var _a;
24900
- const changeEvent = new CustomEvent('change', {
24901
- start,
24902
- end
24903
- });
24904
- changeEvent.manager = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventSystem.manager;
24905
- this.dispatchEvent(changeEvent);
24906
- }
24907
24902
  setStartAndEnd(start, end) {
24908
- var _a;
24909
24903
  const { start: startAttr, end: endAttr } = this.attribute;
24910
24904
  if (vutils.isValid(start) && vutils.isValid(end) && (start !== this.state.start || end !== this.state.end)) {
24911
24905
  this.state.start = start;
24912
24906
  this.state.end = end;
24913
24907
  if (startAttr !== this.state.start || endAttr !== this.state.end) {
24914
24908
  this.setStateAttr(start, end, true);
24915
- (_a = this._updateStateCallback) === null || _a === void 0 ? void 0 : _a.call(this, start, end, this._activeTag);
24916
- this._dispatchChangeEvent(start, end);
24909
+ this._dispatchEvent('change', {
24910
+ start,
24911
+ end,
24912
+ tag: this._activeTag
24913
+ });
24917
24914
  }
24918
24915
  }
24919
24916
  }
@@ -24941,9 +24938,6 @@
24941
24938
  const middleHandlerSymbolSize = (_d = (_c = middleHandlerStyle === null || middleHandlerStyle === void 0 ? void 0 : middleHandlerStyle.icon) === null || _c === void 0 ? void 0 : _c.size) !== null && _d !== void 0 ? _d : 10;
24942
24939
  return Math.max(middleHandlerRectSize, ...vutils.array(middleHandlerSymbolSize));
24943
24940
  }
24944
- setUpdateStateCallback(callback) {
24945
- vutils.isFunction(callback) && (this._updateStateCallback = callback);
24946
- }
24947
24941
  setPreviewPointsX(callback) {
24948
24942
  vutils.isFunction(callback) && (this._previewPointsX = callback);
24949
24943
  }
@@ -25765,7 +25759,6 @@
25765
25759
  target.removeState('hover');
25766
25760
  };
25767
25761
  this._onClick = (e) => {
25768
- var _a, _b;
25769
25762
  const target = e.target;
25770
25763
  if (target.name === 'preHandler') {
25771
25764
  if (this._current === 1) {
@@ -25778,14 +25771,12 @@
25778
25771
  else {
25779
25772
  target.removeState('disable');
25780
25773
  }
25781
- const changeEvent = new CustomEvent('toPrev', {
25774
+ this._dispatchEvent('toPrev', {
25782
25775
  current: this._current,
25783
25776
  total: this._total,
25784
25777
  direction: 'pre',
25785
25778
  event: e
25786
25779
  });
25787
- changeEvent.manager = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventSystem.manager;
25788
- this.dispatchEvent(changeEvent);
25789
25780
  }
25790
25781
  if (target.name === 'nextHandler') {
25791
25782
  if (this._current === this._total) {
@@ -25798,14 +25789,12 @@
25798
25789
  else {
25799
25790
  target.removeState('disable');
25800
25791
  }
25801
- const changeEvent = new CustomEvent('toNext', {
25792
+ this._dispatchEvent('toNext', {
25802
25793
  current: this._current,
25803
25794
  total: this._total,
25804
25795
  direction: 'next',
25805
25796
  event: e
25806
25797
  });
25807
- changeEvent.manager = (_b = this.stage) === null || _b === void 0 ? void 0 : _b.eventSystem.manager;
25808
- this.dispatchEvent(changeEvent);
25809
25798
  }
25810
25799
  if (this._current > 1) {
25811
25800
  this.preHandler.removeState('disable');
@@ -26108,7 +26097,7 @@
26108
26097
  const currentSelectedItems = this._getSelectedLegends();
26109
26098
  if (selectMode === 'multiple') {
26110
26099
  if (allowAllCanceled === false && isSelected && currentSelectedItems.length === 1) {
26111
- this._dispatchEvent(exports.LegendEvent.legendItemClick, legendItem, e);
26100
+ this._dispatchLegendEvent(exports.LegendEvent.legendItemClick, legendItem, e);
26112
26101
  return;
26113
26102
  }
26114
26103
  if (isSelected) {
@@ -26131,7 +26120,7 @@
26131
26120
  });
26132
26121
  }
26133
26122
  }
26134
- this._dispatchEvent(exports.LegendEvent.legendItemClick, legendItem, e);
26123
+ this._dispatchLegendEvent(exports.LegendEvent.legendItemClick, legendItem, e);
26135
26124
  }
26136
26125
  };
26137
26126
  }
@@ -26268,26 +26257,27 @@
26268
26257
  }
26269
26258
  }
26270
26259
  _renderEachItem(item, isSelected, index, items) {
26260
+ var _a, _b;
26271
26261
  const { id, label, value, shape } = item;
26272
- const { padding = 0, focus, focusIconStyle = {} } = this.attribute.item;
26273
- let { shape: shapeAttr = {}, label: labelAttr = {}, value: valueAttr = {}, background = {} } = this.attribute.item;
26274
- shapeAttr = this._handleStyle(shapeAttr, item, isSelected, index, items);
26275
- labelAttr = this._handleStyle(labelAttr, item, isSelected, index, items);
26276
- valueAttr = this._handleStyle(valueAttr, item, isSelected, index, items);
26277
- background = this._handleStyle(background, item, isSelected, index, items);
26262
+ const { padding = 0, focus, focusIconStyle } = this.attribute.item;
26263
+ const { shape: shapeAttr, label: labelAttr, value: valueAttr, background } = this.attribute.item;
26264
+ const shapeStyle = this._handleStyle(shapeAttr, item, isSelected, index, items);
26265
+ const labelStyle = this._handleStyle(labelAttr, item, isSelected, index, items);
26266
+ const valueStyle = this._handleStyle(valueAttr, item, isSelected, index, items);
26267
+ const backgroundStyle = this._handleStyle(background, item, isSelected, index, items);
26278
26268
  const parsedPadding = vutils.normalizePadding(padding);
26279
26269
  let itemGroup;
26280
26270
  if (background.visible === false) {
26281
26271
  itemGroup = graphicCreator.group({
26282
26272
  x: 0,
26283
26273
  y: 0,
26284
- cursor: (background === null || background === void 0 ? void 0 : background.style).cursor
26274
+ cursor: (_a = backgroundStyle.style) === null || _a === void 0 ? void 0 : _a.cursor
26285
26275
  });
26286
26276
  this._appendDataToShape(itemGroup, exports.LEGEND_ELEMENT_NAME.item, item, itemGroup);
26287
26277
  }
26288
26278
  else {
26289
- itemGroup = graphicCreator.group(Object.assign({ x: 0, y: 0 }, background === null || background === void 0 ? void 0 : background.style));
26290
- this._appendDataToShape(itemGroup, exports.LEGEND_ELEMENT_NAME.item, item, itemGroup, background === null || background === void 0 ? void 0 : background.state);
26279
+ itemGroup = graphicCreator.group(Object.assign({ x: 0, y: 0 }, backgroundStyle.style));
26280
+ this._appendDataToShape(itemGroup, exports.LEGEND_ELEMENT_NAME.item, item, itemGroup, backgroundStyle.state);
26291
26281
  }
26292
26282
  itemGroup.id = `${id !== null && id !== void 0 ? id : label}-${index}`;
26293
26283
  itemGroup.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected);
@@ -26301,20 +26291,20 @@
26301
26291
  let shapeSize = 0;
26302
26292
  let shapeSpace = 0;
26303
26293
  if ((shapeAttr === null || shapeAttr === void 0 ? void 0 : shapeAttr.visible) !== false) {
26304
- shapeSize = vutils.get(shapeAttr, 'style.size', DEFAULT_SHAPE_SIZE);
26294
+ shapeSize = vutils.get(shapeStyle, 'style.size', DEFAULT_SHAPE_SIZE);
26305
26295
  shapeSpace = vutils.get(shapeAttr, 'space', DEFAULT_SHAPE_SPACE);
26306
- const itemShape = graphicCreator.symbol(Object.assign(Object.assign({ x: 0, y: 0, symbolType: 'circle', strokeBoundsBuffer: 0 }, shape), shapeAttr.style));
26307
- Object.keys(shapeAttr.state || {}).forEach(key => {
26308
- const color = shapeAttr.state[key].fill ||
26309
- shapeAttr.state[key].stroke;
26310
- if (shape.fill && vutils.isNil(shapeAttr.state[key].fill) && color) {
26311
- shapeAttr.state[key].fill = color;
26296
+ const itemShape = graphicCreator.symbol(Object.assign(Object.assign({ x: 0, y: 0, symbolType: 'circle', strokeBoundsBuffer: 0 }, shape), shapeStyle.style));
26297
+ Object.keys(shapeStyle.state || {}).forEach(key => {
26298
+ const color = shapeStyle.state[key].fill ||
26299
+ shapeStyle.state[key].stroke;
26300
+ if (shape.fill && vutils.isNil(shapeStyle.state[key].fill) && color) {
26301
+ shapeStyle.state[key].fill = color;
26312
26302
  }
26313
- if (shape.stroke && vutils.isNil(shapeAttr.state[key].stroke) && color) {
26314
- shapeAttr.state[key].stroke = color;
26303
+ if (shape.stroke && vutils.isNil(shapeStyle.state[key].stroke) && color) {
26304
+ shapeStyle.state[key].stroke = color;
26315
26305
  }
26316
26306
  });
26317
- this._appendDataToShape(itemShape, exports.LEGEND_ELEMENT_NAME.itemShape, item, itemGroup, shapeAttr === null || shapeAttr === void 0 ? void 0 : shapeAttr.state);
26307
+ this._appendDataToShape(itemShape, exports.LEGEND_ELEMENT_NAME.itemShape, item, itemGroup, shapeStyle.state);
26318
26308
  itemShape.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected);
26319
26309
  innerGroup.add(itemShape);
26320
26310
  }
@@ -26326,15 +26316,15 @@
26326
26316
  this._appendDataToShape(focusShape, exports.LEGEND_ELEMENT_NAME.focus, item, itemGroup);
26327
26317
  focusSpace = focusSize;
26328
26318
  }
26329
- const labelShape = graphicCreator.text(Object.assign(Object.assign({ x: shapeSize / 2 + shapeSpace, y: 0, textAlign: 'start', textBaseline: 'middle', lineHeight: (labelAttr === null || labelAttr === void 0 ? void 0 : labelAttr.style).fontSize }, labelAttr === null || labelAttr === void 0 ? void 0 : labelAttr.style), { text: labelAttr.formatMethod ? labelAttr.formatMethod(label, item, index) : label }));
26330
- this._appendDataToShape(labelShape, exports.LEGEND_ELEMENT_NAME.itemLabel, item, itemGroup, labelAttr === null || labelAttr === void 0 ? void 0 : labelAttr.state);
26319
+ const labelShape = graphicCreator.text(Object.assign(Object.assign({ x: shapeSize / 2 + shapeSpace, y: 0, textAlign: 'start', textBaseline: 'middle', lineHeight: (_b = labelStyle.style) === null || _b === void 0 ? void 0 : _b.fontSize }, labelStyle.style), { text: labelAttr.formatMethod ? labelAttr.formatMethod(label, item, index) : label }));
26320
+ this._appendDataToShape(labelShape, exports.LEGEND_ELEMENT_NAME.itemLabel, item, itemGroup, labelStyle.state);
26331
26321
  labelShape.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected);
26332
26322
  innerGroup.add(labelShape);
26333
26323
  const labelSpace = vutils.get(labelAttr, 'space', DEFAULT_LABEL_SPACE);
26334
26324
  if (vutils.isValid(value)) {
26335
26325
  const valueSpace = vutils.get(valueAttr, 'space', focus ? DEFAULT_VALUE_SPACE : 0);
26336
- const valueShape = graphicCreator.text(Object.assign(Object.assign({ x: 0, y: 0, textAlign: 'start', textBaseline: 'middle', lineHeight: (valueAttr === null || valueAttr === void 0 ? void 0 : valueAttr.style).fontSize }, valueAttr === null || valueAttr === void 0 ? void 0 : valueAttr.style), { text: valueAttr.formatMethod ? valueAttr.formatMethod(value, item, index) : value }));
26337
- this._appendDataToShape(valueShape, exports.LEGEND_ELEMENT_NAME.itemValue, item, itemGroup, valueAttr === null || valueAttr === void 0 ? void 0 : valueAttr.state);
26326
+ const valueShape = graphicCreator.text(Object.assign(Object.assign({ x: 0, y: 0, textAlign: 'start', textBaseline: 'middle', lineHeight: valueStyle.style.fontSize }, valueStyle.style), { text: valueAttr.formatMethod ? valueAttr.formatMethod(value, item, index) : value }));
26327
+ this._appendDataToShape(valueShape, exports.LEGEND_ELEMENT_NAME.itemValue, item, itemGroup, valueStyle.state);
26338
26328
  valueShape.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected);
26339
26329
  if (this._itemWidthByUser) {
26340
26330
  const layoutWidth = this._itemWidthByUser -
@@ -26553,7 +26543,7 @@
26553
26543
  if (focusButton) {
26554
26544
  focusButton.setAttribute('visible', true);
26555
26545
  }
26556
- this._dispatchEvent(exports.LegendEvent.legendItemHover, legendItem, e);
26546
+ this._dispatchLegendEvent(exports.LegendEvent.legendItemHover, legendItem, e);
26557
26547
  }
26558
26548
  _unHover(legendItem, e) {
26559
26549
  let attributeUpdate = false;
@@ -26578,9 +26568,9 @@
26578
26568
  focusButton.setAttribute('visible', false);
26579
26569
  }
26580
26570
  if (attributeUpdate) {
26581
- this._dispatchEvent(exports.LegendEvent.legendItemAttributeUpdate, legendItem, e);
26571
+ this._dispatchLegendEvent(exports.LegendEvent.legendItemAttributeUpdate, legendItem, e);
26582
26572
  }
26583
- this._dispatchEvent(exports.LegendEvent.legendItemUnHover, legendItem, e);
26573
+ this._dispatchLegendEvent(exports.LegendEvent.legendItemUnHover, legendItem, e);
26584
26574
  }
26585
26575
  _setLegendItemState(legendItem, stateName, e) {
26586
26576
  const keepCurrentStates = true;
@@ -26601,7 +26591,7 @@
26601
26591
  }
26602
26592
  });
26603
26593
  if (attributeUpdate) {
26604
- this._dispatchEvent(exports.LegendEvent.legendItemAttributeUpdate, legendItem, e);
26594
+ this._dispatchLegendEvent(exports.LegendEvent.legendItemAttributeUpdate, legendItem, e);
26605
26595
  }
26606
26596
  }
26607
26597
  _removeLegendItemState(legendItem, stateNames, e) {
@@ -26626,7 +26616,7 @@
26626
26616
  }
26627
26617
  });
26628
26618
  if (attributeUpdate) {
26629
- this._dispatchEvent(exports.LegendEvent.legendItemAttributeUpdate, legendItem, e);
26619
+ this._dispatchLegendEvent(exports.LegendEvent.legendItemAttributeUpdate, legendItem, e);
26630
26620
  }
26631
26621
  }
26632
26622
  _getSelectedLegends() {
@@ -26645,12 +26635,11 @@
26645
26635
  shape.delegate = delegateShape;
26646
26636
  shape.states = vutils.merge({}, DEFAULT_STATES, states);
26647
26637
  }
26648
- _dispatchEvent(eventName, legendItem, event) {
26649
- var _a;
26638
+ _dispatchLegendEvent(eventName, legendItem, event) {
26650
26639
  const currentSelectedItems = this._getSelectedLegends();
26651
26640
  currentSelectedItems.sort((pre, next) => pre.index - next.index);
26652
26641
  const currentSelected = currentSelectedItems.map((obj) => obj.label);
26653
- const changeEvent = new CustomEvent(eventName, {
26642
+ this._dispatchEvent(eventName, {
26654
26643
  item: legendItem,
26655
26644
  data: legendItem.data,
26656
26645
  selected: legendItem.hasState(exports.LegendStateValue.selected),
@@ -26658,18 +26647,27 @@
26658
26647
  currentSelected,
26659
26648
  event
26660
26649
  });
26661
- changeEvent.manager = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventSystem.manager;
26662
- this.dispatchEvent(changeEvent);
26663
26650
  }
26664
26651
  _handleStyle(config, item, isSelected, index, items) {
26665
- const newConfig = vutils.merge({}, config);
26666
- if (config.style && vutils.isFunction(config.style)) {
26667
- newConfig.style = config.style(item, isSelected, index, items);
26652
+ const newConfig = {};
26653
+ if (config.style) {
26654
+ if (vutils.isFunction(config.style)) {
26655
+ newConfig.style = config.style(item, isSelected, index, items);
26656
+ }
26657
+ else {
26658
+ newConfig.style = config.style;
26659
+ }
26668
26660
  }
26669
26661
  if (config.state) {
26662
+ newConfig.state = {};
26670
26663
  Object.keys(config.state).forEach(key => {
26671
- if (config.state[key] && vutils.isFunction(config.state[key])) {
26672
- newConfig.state[key] = config.state[key](item, isSelected, index, items);
26664
+ if (config.state[key]) {
26665
+ if (vutils.isFunction(config.state[key])) {
26666
+ newConfig.state[key] = config.state[key](item, isSelected, index, items);
26667
+ }
26668
+ else {
26669
+ newConfig.state[key] = config.state[key];
26670
+ }
26673
26671
  }
26674
26672
  });
26675
26673
  }
@@ -27334,10 +27332,9 @@
27334
27332
  }
27335
27333
  }
27336
27334
  _dispatchChangeEvent() {
27337
- var _a;
27338
27335
  const isRange = !!this.attribute.range;
27339
27336
  const currentValue = this._currentValue;
27340
- const changeEvent = new CustomEvent('change', {
27337
+ this._dispatchEvent('change', {
27341
27338
  value: isRange
27342
27339
  ? [
27343
27340
  Math.min(currentValue.endValue, currentValue.startValue),
@@ -27351,8 +27348,6 @@
27351
27348
  ]
27352
27349
  : currentValue.startPos
27353
27350
  });
27354
- changeEvent.manager = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventSystem.manager;
27355
- this.dispatchEvent(changeEvent);
27356
27351
  }
27357
27352
  _getHandlers() {
27358
27353
  let startHandler = this._startHandler;
@@ -28270,12 +28265,6 @@
28270
28265
  this.forward();
28271
28266
  });
28272
28267
  };
28273
- this._createCustomEvent = (eventType) => {
28274
- var _a;
28275
- const customEvent = new CustomEvent(eventType, { eventType });
28276
- customEvent.manager = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventSystem.manager;
28277
- return customEvent;
28278
- };
28279
28268
  this.renderPlay = () => {
28280
28269
  if (this._isPaused) {
28281
28270
  this._playController.setAttributes(Object.assign({ symbolType: this._playController.getComputedAttribute('symbolType') }, this._startAttr.style));
@@ -28291,20 +28280,16 @@
28291
28280
  this._forwardController.setAttributes(this._forwardAttr.style);
28292
28281
  };
28293
28282
  this.play = () => {
28294
- const onPlayEvent = this._createCustomEvent(ControllerEventEnum.OnPlay);
28295
- this.dispatchEvent(onPlayEvent);
28283
+ this._dispatchEvent('ControllerEventEnum.OnPlay');
28296
28284
  };
28297
28285
  this.pause = () => {
28298
- const onPauseEvent = this._createCustomEvent(ControllerEventEnum.OnPause);
28299
- this.dispatchEvent(onPauseEvent);
28286
+ this._dispatchEvent('ControllerEventEnum.OnPause');
28300
28287
  };
28301
28288
  this.forward = () => {
28302
- const onPlayEvent = this._createCustomEvent(ControllerEventEnum.OnForward);
28303
- this.dispatchEvent(onPlayEvent);
28289
+ this._dispatchEvent('ControllerEventEnum.OnForward');
28304
28290
  };
28305
28291
  this.backward = () => {
28306
- const onPlayEvent = this._createCustomEvent(ControllerEventEnum.OnBackward);
28307
- this.dispatchEvent(onPlayEvent);
28292
+ this._dispatchEvent('ControllerEventEnum.OnBackward');
28308
28293
  };
28309
28294
  this.togglePlay = () => {
28310
28295
  this._playController.setAttributes(this._startAttr.style);
@@ -28579,14 +28564,11 @@
28579
28564
  this._controller.setAttributes(attrs);
28580
28565
  }
28581
28566
  dispatchCustomEvent(eventType, dataIndex) {
28582
- var _a;
28583
- const changeEvent = new CustomEvent(eventType, {
28567
+ this._dispatchEvent(eventType, {
28584
28568
  eventType,
28585
28569
  index: dataIndex,
28586
28570
  value: this._data[dataIndex]
28587
28571
  });
28588
- changeEvent.manager = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventSystem.manager;
28589
- this.dispatchEvent(changeEvent);
28590
28572
  }
28591
28573
  }
28592
28574
  BasePlayer.defaultAttributes = {
@@ -29020,20 +29002,27 @@
29020
29002
  if (this._activeDrawState && !this._isDrawedBeforeEnd && removeOnClick) {
29021
29003
  this._container.incrementalClearChild();
29022
29004
  this._brushMaskAABBBoundsDict = {};
29023
- this._updateDragMaskCallback &&
29024
- this._updateDragMaskCallback({
29025
- operateType: exports.IOperateType.brushClear,
29026
- operateMask: this._operatingMask,
29027
- operatedMaskAABBBounds: this._brushMaskAABBBoundsDict
29028
- });
29005
+ this._dispatchEvent(exports.IOperateType.brushClear, {
29006
+ operateMask: this._operatingMask,
29007
+ operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
29008
+ event: e
29009
+ });
29029
29010
  }
29030
29011
  else if (!this._outOfInteractiveRange(e)) {
29031
- this._updateDragMaskCallback &&
29032
- this._updateDragMaskCallback({
29033
- operateType: this._activeDrawState ? exports.IOperateType.drawEnd : exports.IOperateType.moveEnd,
29012
+ if (this._activeDrawState) {
29013
+ this._dispatchEvent(exports.IOperateType.drawEnd, {
29034
29014
  operateMask: this._operatingMask,
29035
- operatedMaskAABBBounds: this._brushMaskAABBBoundsDict
29015
+ operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
29016
+ event: e
29036
29017
  });
29018
+ }
29019
+ if (this._activeMoveState) {
29020
+ this._dispatchEvent(exports.IOperateType.moveEnd, {
29021
+ operateMask: this._operatingMask,
29022
+ operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
29023
+ event: e
29024
+ });
29025
+ }
29037
29026
  }
29038
29027
  this._activeDrawState = false;
29039
29028
  this._activeMoveState = false;
@@ -29041,7 +29030,7 @@
29041
29030
  (_a = this._operatingMask) === null || _a === void 0 ? void 0 : _a.setAttribute('pickable', false);
29042
29031
  };
29043
29032
  }
29044
- bindBrushEvents() {
29033
+ _bindBrushEvents() {
29045
29034
  if (this.attribute.disableTriggerEvent) {
29046
29035
  return;
29047
29036
  }
@@ -29079,12 +29068,11 @@
29079
29068
  this._container.incrementalClearChild();
29080
29069
  }
29081
29070
  this._addBrushMask();
29082
- this._updateDragMaskCallback &&
29083
- this._updateDragMaskCallback({
29084
- operateType: exports.IOperateType.drawStart,
29085
- operateMask: this._operatingMask,
29086
- operatedMaskAABBBounds: this._brushMaskAABBBoundsDict
29087
- });
29071
+ this._dispatchEvent(exports.IOperateType.drawStart, {
29072
+ operateMask: this._operatingMask,
29073
+ operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
29074
+ event: e
29075
+ });
29088
29076
  }
29089
29077
  _initMove(e) {
29090
29078
  var _a, _b;
@@ -29101,12 +29089,11 @@
29101
29089
  this._operatingMaskMoveRangeX = [minMoveStepX, maxMoveStepX];
29102
29090
  this._operatingMaskMoveRangeY = [minMoveStepY, maxMoveStepY];
29103
29091
  this._operatingMask.setAttribute('pickable', true);
29104
- this._updateDragMaskCallback &&
29105
- this._updateDragMaskCallback({
29106
- operateType: exports.IOperateType.moveStart,
29107
- operateMask: this._operatingMask,
29108
- operatedMaskAABBBounds: this._brushMaskAABBBoundsDict
29109
- });
29092
+ this._dispatchEvent(exports.IOperateType.moveStart, {
29093
+ operateMask: this._operatingMask,
29094
+ operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
29095
+ event: e
29096
+ });
29110
29097
  }
29111
29098
  _drawing(e) {
29112
29099
  var _a;
@@ -29130,12 +29117,11 @@
29130
29117
  const maskPoints = this._computeMaskPoints();
29131
29118
  this._operatingMask.setAttribute('points', maskPoints);
29132
29119
  this._brushMaskAABBBoundsDict[this._operatingMask.name] = this._operatingMask.AABBBounds;
29133
- this._updateDragMaskCallback &&
29134
- this._updateDragMaskCallback({
29135
- operateType: exports.IOperateType.drawing,
29136
- operateMask: this._operatingMask,
29137
- operatedMaskAABBBounds: this._brushMaskAABBBoundsDict
29138
- });
29120
+ this._dispatchEvent(exports.IOperateType.drawing, {
29121
+ operateMask: this._operatingMask,
29122
+ operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
29123
+ event: e
29124
+ });
29139
29125
  }
29140
29126
  _moving(e) {
29141
29127
  const startPos = this._cacheMovePoint;
@@ -29154,12 +29140,11 @@
29154
29140
  dy: moveY
29155
29141
  });
29156
29142
  this._brushMaskAABBBoundsDict[this._operatingMask.name] = this._operatingMask.AABBBounds;
29157
- this._updateDragMaskCallback &&
29158
- this._updateDragMaskCallback({
29159
- operateType: exports.IOperateType.moving,
29160
- operateMask: this._operatingMask,
29161
- operatedMaskAABBBounds: this._brushMaskAABBBoundsDict
29162
- });
29143
+ this._dispatchEvent(exports.IOperateType.moving, {
29144
+ operateMask: this._operatingMask,
29145
+ operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
29146
+ event: e
29147
+ });
29163
29148
  }
29164
29149
  _computeMaskPoints() {
29165
29150
  const { brushType, xRange = [0, 0], yRange = [0, 0] } = this.attribute;
@@ -29244,21 +29229,18 @@
29244
29229
  return false;
29245
29230
  }
29246
29231
  eventPosToStagePos(e) {
29247
- var _a, _b, _c;
29248
- const stagePosition = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.window.getBoundingClientRect();
29232
+ var _a, _b;
29233
+ const { x, y } = vglobal.mapToCanvasPoint(e);
29249
29234
  return {
29250
- x: e.clientX - ((stagePosition === null || stagePosition === void 0 ? void 0 : stagePosition.left) || 0) - (((_b = this.stage) === null || _b === void 0 ? void 0 : _b.x) || 0),
29251
- y: e.clientY - ((stagePosition === null || stagePosition === void 0 ? void 0 : stagePosition.top) || 0) - (((_c = this.stage) === null || _c === void 0 ? void 0 : _c.y) || 0)
29235
+ x: x - (((_a = this.stage) === null || _a === void 0 ? void 0 : _a.x) || 0),
29236
+ y: y - (((_b = this.stage) === null || _b === void 0 ? void 0 : _b.y) || 0)
29252
29237
  };
29253
29238
  }
29254
29239
  render() {
29255
- this.bindBrushEvents();
29240
+ this._bindBrushEvents();
29256
29241
  const group = this.createOrUpdateChild('brush-container', {}, 'group');
29257
29242
  this._container = group;
29258
29243
  }
29259
- setUpdateDragMaskCallback(callback) {
29260
- vutils.isFunction(callback) && (this._updateDragMaskCallback = callback);
29261
- }
29262
29244
  releaseBrushEvents() {
29263
29245
  const { delayType = 'throttle', delayTime = 0, trigger = DEFAULT_BRUSH_ATTRIBUTES.trigger, updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger, endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger, resetTrigger = DEFAULT_BRUSH_ATTRIBUTES.resetTrigger } = this.attribute;
29264
29246
  this.stage.removeEventListener(trigger, this._onBrushStart);
@@ -29831,7 +29813,6 @@
29831
29813
  });
29832
29814
  }
29833
29815
  handleClick() {
29834
- var _a;
29835
29816
  if (this.attribute.disabled) {
29836
29817
  return;
29837
29818
  }
@@ -29843,12 +29824,10 @@
29843
29824
  this.setAttribute('checked', true);
29844
29825
  this.setAttribute('indeterminate', false);
29845
29826
  }
29846
- const changeEvent = new CustomEvent('checkbox_state_change', {
29827
+ this._dispatchEvent('checkbox_state_change', {
29847
29828
  eventType: 'checkbox_state_change',
29848
29829
  checked: this.attribute.checked
29849
29830
  });
29850
- changeEvent.manager = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventSystem.manager;
29851
- this.dispatchEvent(changeEvent);
29852
29831
  }
29853
29832
  }
29854
29833
  CheckBox.defaultAttributes = {
@@ -29889,7 +29868,7 @@
29889
29868
  }
29890
29869
  };
29891
29870
 
29892
- const version = "0.17.2-alpha.3";
29871
+ const version = "0.17.2-alpha.4";
29893
29872
 
29894
29873
  exports.AbstractComponent = AbstractComponent;
29895
29874
  exports.ArcInfo = ArcInfo;