@visactor/vrender-components 0.18.0-alpha.0 → 0.18.0-alpha.1

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 (179) hide show
  1. package/cjs/axis/base.js +24 -24
  2. package/cjs/axis/base.js.map +1 -1
  3. package/cjs/axis/grid/base.js +1 -1
  4. package/cjs/axis/grid/base.js.map +1 -1
  5. package/cjs/axis/line.js +59 -52
  6. package/cjs/axis/line.js.map +1 -1
  7. package/cjs/axis/overlap/auto-hide.d.ts +1 -0
  8. package/cjs/axis/overlap/auto-hide.js +10 -2
  9. package/cjs/axis/overlap/auto-hide.js.map +1 -1
  10. package/cjs/axis/overlap/auto-limit.d.ts +1 -0
  11. package/cjs/axis/overlap/auto-limit.js +5 -3
  12. package/cjs/axis/overlap/auto-limit.js.map +1 -1
  13. package/cjs/axis/type.d.ts +1 -0
  14. package/cjs/axis/type.js.map +1 -1
  15. package/cjs/brush/brush.js +4 -4
  16. package/cjs/brush/brush.js.map +1 -1
  17. package/cjs/checkbox/checkbox.js +2 -1
  18. package/cjs/checkbox/checkbox.js.map +1 -1
  19. package/cjs/core/type.d.ts +10 -8
  20. package/cjs/core/type.js.map +1 -1
  21. package/cjs/data-zoom/data-zoom.d.ts +5 -1
  22. package/cjs/data-zoom/data-zoom.js +136 -78
  23. package/cjs/data-zoom/data-zoom.js.map +1 -1
  24. package/cjs/index.d.ts +2 -1
  25. package/cjs/index.js +3 -2
  26. package/cjs/index.js.map +1 -1
  27. package/cjs/indicator/indicator.d.ts +3 -1
  28. package/cjs/indicator/indicator.js +60 -46
  29. package/cjs/indicator/indicator.js.map +1 -1
  30. package/cjs/indicator/type.d.ts +1 -0
  31. package/cjs/indicator/type.js.map +1 -1
  32. package/cjs/label/arc.d.ts +2 -2
  33. package/cjs/label/arc.js +38 -35
  34. package/cjs/label/arc.js.map +1 -1
  35. package/cjs/label/base.d.ts +6 -8
  36. package/cjs/label/base.js +92 -65
  37. package/cjs/label/base.js.map +1 -1
  38. package/cjs/label/line.js +3 -4
  39. package/cjs/label/line.js.map +1 -1
  40. package/cjs/label/type.d.ts +15 -8
  41. package/cjs/label/type.js.map +1 -1
  42. package/cjs/label/util.d.ts +4 -0
  43. package/cjs/label/util.js +24 -3
  44. package/cjs/label/util.js.map +1 -1
  45. package/cjs/legend/base.js +1 -1
  46. package/cjs/legend/base.js.map +1 -1
  47. package/cjs/legend/discrete/discrete.d.ts +1 -14
  48. package/cjs/legend/discrete/discrete.js +39 -60
  49. package/cjs/legend/discrete/discrete.js.map +1 -1
  50. package/cjs/legend/discrete/type.d.ts +0 -1
  51. package/cjs/legend/discrete/type.js.map +1 -1
  52. package/cjs/legend/type.d.ts +2 -2
  53. package/cjs/legend/type.js.map +1 -1
  54. package/cjs/marker/area.js +5 -1
  55. package/cjs/marker/area.js.map +1 -1
  56. package/cjs/marker/base.d.ts +1 -0
  57. package/cjs/marker/base.js +6 -3
  58. package/cjs/marker/base.js.map +1 -1
  59. package/cjs/marker/line.js +7 -1
  60. package/cjs/marker/line.js.map +1 -1
  61. package/cjs/marker/point.d.ts +1 -0
  62. package/cjs/marker/point.js +24 -11
  63. package/cjs/marker/point.js.map +1 -1
  64. package/cjs/marker/type.d.ts +1 -0
  65. package/cjs/marker/type.js.map +1 -1
  66. package/cjs/pager/pager.d.ts +0 -2
  67. package/cjs/pager/pager.js +8 -16
  68. package/cjs/pager/pager.js.map +1 -1
  69. package/cjs/pager/type.d.ts +0 -1
  70. package/cjs/pager/type.js.map +1 -1
  71. package/cjs/scrollbar/scrollbar.js +9 -3
  72. package/cjs/scrollbar/scrollbar.js.map +1 -1
  73. package/cjs/segment/segment.js +1 -1
  74. package/cjs/segment/segment.js.map +1 -1
  75. package/cjs/slider/slider.js +1 -1
  76. package/cjs/slider/slider.js.map +1 -1
  77. package/cjs/tag/tag.js +28 -42
  78. package/cjs/tag/tag.js.map +1 -1
  79. package/cjs/title/title.js +2 -2
  80. package/cjs/title/title.js.map +1 -1
  81. package/cjs/tooltip/tooltip.js +1 -1
  82. package/cjs/tooltip/tooltip.js.map +1 -1
  83. package/cjs/util/limit-shape.d.ts +4 -0
  84. package/cjs/util/limit-shape.js +13 -4
  85. package/cjs/util/limit-shape.js.map +1 -1
  86. package/cjs/util/text.d.ts +5 -2
  87. package/cjs/util/text.js +19 -6
  88. package/cjs/util/text.js.map +1 -1
  89. package/es/axis/base.js +22 -26
  90. package/es/axis/base.js.map +1 -1
  91. package/es/axis/grid/base.js +1 -1
  92. package/es/axis/grid/base.js.map +1 -1
  93. package/es/axis/line.js +59 -50
  94. package/es/axis/line.js.map +1 -1
  95. package/es/axis/overlap/auto-hide.d.ts +1 -0
  96. package/es/axis/overlap/auto-hide.js +10 -2
  97. package/es/axis/overlap/auto-hide.js.map +1 -1
  98. package/es/axis/overlap/auto-limit.d.ts +1 -0
  99. package/es/axis/overlap/auto-limit.js +5 -3
  100. package/es/axis/overlap/auto-limit.js.map +1 -1
  101. package/es/axis/type.d.ts +1 -0
  102. package/es/axis/type.js.map +1 -1
  103. package/es/brush/brush.js +4 -4
  104. package/es/brush/brush.js.map +1 -1
  105. package/es/checkbox/checkbox.js +2 -1
  106. package/es/checkbox/checkbox.js.map +1 -1
  107. package/es/core/type.d.ts +10 -8
  108. package/es/core/type.js.map +1 -1
  109. package/es/data-zoom/data-zoom.d.ts +5 -1
  110. package/es/data-zoom/data-zoom.js +135 -74
  111. package/es/data-zoom/data-zoom.js.map +1 -1
  112. package/es/index.d.ts +2 -1
  113. package/es/index.js +3 -1
  114. package/es/index.js.map +1 -1
  115. package/es/indicator/indicator.d.ts +3 -1
  116. package/es/indicator/indicator.js +57 -47
  117. package/es/indicator/indicator.js.map +1 -1
  118. package/es/indicator/type.d.ts +1 -0
  119. package/es/indicator/type.js.map +1 -1
  120. package/es/label/arc.d.ts +2 -2
  121. package/es/label/arc.js +38 -35
  122. package/es/label/arc.js.map +1 -1
  123. package/es/label/base.d.ts +6 -8
  124. package/es/label/base.js +92 -65
  125. package/es/label/base.js.map +1 -1
  126. package/es/label/line.js +3 -4
  127. package/es/label/line.js.map +1 -1
  128. package/es/label/type.d.ts +15 -8
  129. package/es/label/type.js.map +1 -1
  130. package/es/label/util.d.ts +4 -0
  131. package/es/label/util.js +22 -2
  132. package/es/label/util.js.map +1 -1
  133. package/es/legend/base.js +1 -1
  134. package/es/legend/base.js.map +1 -1
  135. package/es/legend/discrete/discrete.d.ts +1 -14
  136. package/es/legend/discrete/discrete.js +40 -58
  137. package/es/legend/discrete/discrete.js.map +1 -1
  138. package/es/legend/discrete/type.d.ts +0 -1
  139. package/es/legend/discrete/type.js.map +1 -1
  140. package/es/legend/type.d.ts +2 -2
  141. package/es/legend/type.js.map +1 -1
  142. package/es/marker/area.js +6 -2
  143. package/es/marker/area.js.map +1 -1
  144. package/es/marker/base.d.ts +1 -0
  145. package/es/marker/base.js +6 -3
  146. package/es/marker/base.js.map +1 -1
  147. package/es/marker/line.js +8 -2
  148. package/es/marker/line.js.map +1 -1
  149. package/es/marker/point.d.ts +1 -0
  150. package/es/marker/point.js +25 -11
  151. package/es/marker/point.js.map +1 -1
  152. package/es/marker/type.d.ts +1 -0
  153. package/es/marker/type.js.map +1 -1
  154. package/es/pager/pager.d.ts +0 -2
  155. package/es/pager/pager.js +8 -17
  156. package/es/pager/pager.js.map +1 -1
  157. package/es/pager/type.d.ts +0 -1
  158. package/es/pager/type.js.map +1 -1
  159. package/es/scrollbar/scrollbar.js +9 -3
  160. package/es/scrollbar/scrollbar.js.map +1 -1
  161. package/es/segment/segment.js +1 -1
  162. package/es/segment/segment.js.map +1 -1
  163. package/es/slider/slider.js +1 -1
  164. package/es/slider/slider.js.map +1 -1
  165. package/es/tag/tag.js +29 -45
  166. package/es/tag/tag.js.map +1 -1
  167. package/es/title/title.js +3 -3
  168. package/es/title/title.js.map +1 -1
  169. package/es/tooltip/tooltip.js +1 -1
  170. package/es/tooltip/tooltip.js.map +1 -1
  171. package/es/util/limit-shape.d.ts +4 -0
  172. package/es/util/limit-shape.js +11 -3
  173. package/es/util/limit-shape.js.map +1 -1
  174. package/es/util/text.d.ts +5 -2
  175. package/es/util/text.js +17 -5
  176. package/es/util/text.js.map +1 -1
  177. package/package.json +5 -5
  178. package/dist/index.js +0 -29932
  179. package/dist/index.min.js +0 -1
@@ -28,16 +28,18 @@ export type Padding = number | number[] | {
28
28
  right?: number;
29
29
  };
30
30
  type CommonTextContent = {
31
- type?: 'text';
32
- text?: string | string[] | number | number[];
31
+ text?: string | string[] | number | number[] | {
32
+ type?: 'text';
33
+ text: string | string[] | number | number[];
34
+ };
33
35
  };
34
36
  type RichTextContent = {
35
- type?: 'rich';
36
- text?: IRichTextCharacter[];
37
+ text?: {
38
+ type: 'rich';
39
+ text: IRichTextCharacter[];
40
+ };
37
41
  };
38
- type HtmlTextContent = {
39
- type?: 'html';
40
- text?: string | HTMLElement;
42
+ export type TextContent = (CommonTextContent | RichTextContent) & {
43
+ type?: 'text' | 'rich';
41
44
  };
42
- export type TextContent = CommonTextContent | RichTextContent | HtmlTextContent;
43
45
  export {};
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/core/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type { IRichTextCharacter } from '@visactor/vrender-core';\n\nexport type Point = {\n x: number;\n y: number;\n};\n\nexport interface LocationCfg {\n [key: string]: any;\n}\n\nexport interface PointLocationCfg extends LocationCfg {\n /**\n * 位置 x\n * @type {number}\n */\n x: number;\n /**\n * 位置 y\n * @type {number}\n */\n y: number;\n}\n\nexport interface RegionLocationCfg extends LocationCfg {\n /**\n * 起始点\n */\n start: Point;\n /**\n * 结束点\n */\n end: Point;\n}\n\nexport type State<T> = {\n [key: string]: T;\n};\n\nexport type BaseGraphicAttributes<T> = {\n /**\n * 基础样式设置\n */\n style?: T;\n /**\n * 状态样式设置\n */\n state?: State<T>;\n};\n\nexport type Padding =\n | number\n | number[]\n | {\n top?: number;\n bottom?: number;\n left?: number;\n right?: number;\n };\n\ntype CommonTextContent = {\n type?: 'text';\n text?: string | string[] | number | number[];\n};\n\ntype RichTextContent = {\n type?: 'rich';\n text?: IRichTextCharacter[];\n};\n\ntype HtmlTextContent = {\n type?: 'html';\n text?: string | HTMLElement;\n};\n\nexport type TextContent = CommonTextContent | RichTextContent | HtmlTextContent;\n"]}
1
+ {"version":3,"sources":["../src/core/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type { IRichTextCharacter } from '@visactor/vrender-core';\n\nexport type Point = {\n x: number;\n y: number;\n};\n\nexport interface LocationCfg {\n [key: string]: any;\n}\n\nexport interface PointLocationCfg extends LocationCfg {\n /**\n * 位置 x\n * @type {number}\n */\n x: number;\n /**\n * 位置 y\n * @type {number}\n */\n y: number;\n}\n\nexport interface RegionLocationCfg extends LocationCfg {\n /**\n * 起始点\n */\n start: Point;\n /**\n * 结束点\n */\n end: Point;\n}\n\nexport type State<T> = {\n [key: string]: T;\n};\n\nexport type BaseGraphicAttributes<T> = {\n /**\n * 基础样式设置\n */\n style?: T;\n /**\n * 状态样式设置\n */\n state?: State<T>;\n};\n\nexport type Padding =\n | number\n | number[]\n | {\n top?: number;\n bottom?: number;\n left?: number;\n right?: number;\n };\n\ntype CommonTextContent = {\n text?:\n | string\n | string[]\n | number\n | number[]\n | {\n type?: 'text';\n text: string | string[] | number | number[];\n };\n};\n\ntype RichTextContent = {\n text?: {\n type: 'rich';\n text: IRichTextCharacter[];\n };\n};\n\nexport type TextContent = (CommonTextContent | RichTextContent) & {\n /** @deprecated */\n type?: 'text' | 'rich';\n};\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { FederatedPointerEvent, IGroup } from '@visactor/vrender-core';
2
- import type { IPointLike } from '@visactor/vutils';
2
+ import type { IBoundsLike, IPointLike } from '@visactor/vutils';
3
3
  import { AbstractComponent } from '../core/base';
4
4
  import type { TagAttributes } from '../tag';
5
5
  import { Tag } from '../tag';
@@ -154,7 +154,9 @@ export declare class DataZoom extends AbstractComponent<Required<DataZoomAttribu
154
154
  private _previewPointsY1;
155
155
  private _statePointToData;
156
156
  private _layoutAttrFromConfig;
157
+ setPropsFromAttrs(): void;
157
158
  constructor(attributes: DataZoomAttributes, options?: ComponentOptions);
159
+ setAttributes(params: Partial<Required<DataZoomAttributes>>, forceUpdateTag?: boolean): void;
158
160
  protected bindEvents(): void;
159
161
  protected dragMaskSize(): number;
160
162
  protected setStateAttr(start: number, end: number, shouldRender: boolean): void;
@@ -170,6 +172,8 @@ export declare class DataZoom extends AbstractComponent<Required<DataZoomAttribu
170
172
  protected backgroundDragZoom(startPos: IPointLike, endPos: IPointLike): void;
171
173
  protected moveZoomWithMiddle(middle: number): void;
172
174
  protected renderDragMask(): void;
175
+ protected isTextOverflow(componentBoundsLike: IBoundsLike, textBounds: IBoundsLike | null, layout: 'start' | 'end'): boolean;
176
+ protected setTextAttr(startTextBounds: IBoundsLike, endTextBounds: IBoundsLike): void;
173
177
  protected renderText(): void;
174
178
  protected getLayoutAttrFromConfig(): any;
175
179
  protected render(): void;
@@ -22,6 +22,18 @@ const vrender_core_1 = require("@visactor/vrender-core"), vutils_1 = require("@v
22
22
  (0, register_1.loadDataZoomComponent)();
23
23
 
24
24
  class DataZoom extends base_1.AbstractComponent {
25
+ setPropsFromAttrs() {
26
+ const {start: start, end: end, orient: orient, previewData: previewData, previewPointsX: previewPointsX, previewPointsY: previewPointsY, previewPointsX1: previewPointsX1, previewPointsY1: previewPointsY1} = this.attribute;
27
+ start && (this.state.start = start), end && (this.state.end = end);
28
+ const {width: width, height: height} = this.getLayoutAttrFromConfig();
29
+ this._spanCache = this.state.end - this.state.start, this._isHorizontal = "top" === orient || "bottom" === orient,
30
+ this._layoutCache.max = this._isHorizontal ? width : height, this._layoutCache.attPos = this._isHorizontal ? "x" : "y",
31
+ this._layoutCache.attSize = this._isHorizontal ? "width" : "height", previewData && (this._previewData = previewData),
32
+ (0, vutils_1.isFunction)(previewPointsX) && (this._previewPointsX = previewPointsX),
33
+ (0, vutils_1.isFunction)(previewPointsY) && (this._previewPointsY = previewPointsY),
34
+ (0, vutils_1.isFunction)(previewPointsX1) && (this._previewPointsX1 = previewPointsX1),
35
+ (0, vutils_1.isFunction)(previewPointsY1) && (this._previewPointsY1 = previewPointsY1);
36
+ }
25
37
  constructor(attributes, options) {
26
38
  super((null == options ? void 0 : options.skipDefault) ? attributes : (0, vutils_1.merge)({}, DataZoom.defaultAttributes, attributes)),
27
39
  this.name = "dataZoom", this._previewData = [], this._activeState = !1, this._activeCache = {
@@ -68,15 +80,12 @@ class DataZoom extends base_1.AbstractComponent {
68
80
  tag: this._activeTag
69
81
  }));
70
82
  }), this.attribute.delayTime);
71
- 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;
72
- start && (this.state.start = start), end && (this.state.end = end), this._spanCache = this.state.end - this.state.start,
73
- this._isHorizontal = "top" === orient || "bottom" === orient, this._layoutCache.max = this._isHorizontal ? width : height,
74
- this._layoutCache.attPos = this._isHorizontal ? "x" : "y", this._layoutCache.attSize = this._isHorizontal ? "width" : "height",
83
+ const {position: position, showDetail: showDetail} = attributes;
75
84
  this._activeCache.startPos = position, this._activeCache.lastPos = position, this._showText = "auto" !== showDetail && showDetail,
76
- previewData && (this._previewData = previewData), (0, vutils_1.isFunction)(previewPointsX) && (this._previewPointsX = previewPointsX),
77
- (0, vutils_1.isFunction)(previewPointsY) && (this._previewPointsY = previewPointsY),
78
- (0, vutils_1.isFunction)(previewPointsX1) && (this._previewPointsX1 = previewPointsX1),
79
- (0, vutils_1.isFunction)(previewPointsY1) && (this._previewPointsY1 = previewPointsY1);
85
+ this.setPropsFromAttrs();
86
+ }
87
+ setAttributes(params, forceUpdateTag) {
88
+ super.setAttributes(params, forceUpdateTag), this.setPropsFromAttrs();
80
89
  }
81
90
  bindEvents() {
82
91
  if (this.attribute.disableTriggerEvent) return;
@@ -108,7 +117,7 @@ class DataZoom extends base_1.AbstractComponent {
108
117
  }
109
118
  eventPosToStagePos(e) {
110
119
  var _a, _b;
111
- const {x: x, y: y} = vrender_core_1.vglobal.mapToCanvasPoint(e);
120
+ const {x: x, y: y} = vrender_core_1.vglobal.mapToCanvasPoint(e, this.stage.window.getContext().canvas.nativeCanvas);
112
121
  return {
113
122
  x: x - ((null === (_a = this.stage) || void 0 === _a ? void 0 : _a.x) || 0),
114
123
  y: y - ((null === (_b = this.stage) || void 0 === _b ? void 0 : _b.y) || 0)
@@ -162,59 +171,80 @@ class DataZoom extends base_1.AbstractComponent {
162
171
  height: this._activeState && this._activeTag === type_1.DataZoomActiveTag.background && Math.abs(this.dragMaskSize()) || 0
163
172
  }, dragMaskStyle), "rect");
164
173
  }
165
- renderText() {
166
- const {startTextStyle: startTextStyle, endTextStyle: endTextStyle} = this.attribute, {formatMethod: startTextFormat} = startTextStyle, restStartStyle = __rest(startTextStyle, [ "formatMethod" ]), {formatMethod: endTextFormat} = endTextStyle, restEndTextStyle = __rest(endTextStyle, [ "formatMethod" ]), {start: start, end: end} = this.state;
174
+ isTextOverflow(componentBoundsLike, textBounds, layout) {
175
+ if (!textBounds) return !1;
176
+ if (this._isHorizontal) {
177
+ if ("start" === layout) {
178
+ if (textBounds.x1 < componentBoundsLike.x1) return !0;
179
+ } else if (textBounds.x2 > componentBoundsLike.x2) return !0;
180
+ } else if ("start" === layout) {
181
+ if (textBounds.y1 < componentBoundsLike.y1) return !0;
182
+ } else if (textBounds.y2 > componentBoundsLike.y2) return !0;
183
+ return !1;
184
+ }
185
+ setTextAttr(startTextBounds, endTextBounds) {
186
+ 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;
167
187
  this._startValue = this._statePointToData(start), this._endValue = this._statePointToData(end);
168
- const {position: position, width: width, height: height} = this.getLayoutAttrFromConfig();
169
- this._isHorizontal ? (this._startText = this.maybeAddLabel(this._container, (0,
170
- vutils_1.merge)({}, restStartStyle, {
171
- text: startTextFormat ? startTextFormat(this._startValue) : this._startValue,
188
+ const {position: position, width: width, height: height} = this.getLayoutAttrFromConfig(), startTextValue = startTextFormat ? startTextFormat(this._startValue) : this._startValue, endTextValue = endTextFormat ? endTextFormat(this._endValue) : this._endValue, componentBoundsLike = {
189
+ x1: position.x,
190
+ y1: position.y,
191
+ x2: position.x + width,
192
+ y2: position.y + height
193
+ };
194
+ let startTextPosition, endTextPosition, startTextAlignStyle, endTextAlignStyle;
195
+ this._isHorizontal ? (startTextPosition = {
172
196
  x: position.x + start * width,
173
- y: position.y + height / 2,
174
- visible: this._showText,
175
- pickable: !1,
176
- childrenPickable: !1,
177
- textStyle: {
178
- textAlign: "right",
179
- textBaseline: "middle"
180
- }
181
- }), `data-zoom-start-text-${position}`), this._endText = this.maybeAddLabel(this._container, (0,
182
- vutils_1.merge)({}, restEndTextStyle, {
183
- text: endTextFormat ? endTextFormat(this._endValue) : this._endValue,
197
+ y: position.y + height / 2
198
+ }, endTextPosition = {
184
199
  x: position.x + end * width,
185
- y: position.y + height / 2,
186
- visible: this._showText,
187
- pickable: !1,
188
- childrenPickable: !1,
189
- textStyle: {
190
- textAlign: "left",
191
- textBaseline: "middle"
192
- }
193
- }), `data-zoom-end-text-${position}`)) : (this._startText = this.maybeAddLabel(this._container, (0,
194
- vutils_1.merge)({}, restStartStyle, {
195
- text: startTextFormat ? startTextFormat(this._startValue) : this._startValue,
200
+ y: position.y + height / 2
201
+ }, startTextAlignStyle = {
202
+ textAlign: this.isTextOverflow(componentBoundsLike, startTextBounds, "start") ? "left" : "right",
203
+ textBaseline: "middle"
204
+ }, endTextAlignStyle = {
205
+ textAlign: this.isTextOverflow(componentBoundsLike, endTextBounds, "end") ? "right" : "left",
206
+ textBaseline: "middle"
207
+ }) : (startTextPosition = {
196
208
  x: position.x + width / 2,
197
- y: position.y + start * height,
209
+ y: position.y + start * height
210
+ }, endTextPosition = {
211
+ x: position.x + width / 2,
212
+ y: position.y + end * height
213
+ }, startTextAlignStyle = {
214
+ textAlign: "center",
215
+ textBaseline: this.isTextOverflow(componentBoundsLike, startTextBounds, "start") ? "top" : "bottom"
216
+ }, endTextAlignStyle = {
217
+ textAlign: "center",
218
+ textBaseline: this.isTextOverflow(componentBoundsLike, endTextBounds, "end") ? "bottom" : "top"
219
+ }), this._startText = this.maybeAddLabel(this._container, (0, vutils_1.merge)({}, restStartTextStyle, {
220
+ text: startTextValue,
221
+ x: startTextPosition.x,
222
+ y: startTextPosition.y,
198
223
  visible: this._showText,
199
224
  pickable: !1,
200
225
  childrenPickable: !1,
201
- textStyle: {
202
- textAlign: "center",
203
- textBaseline: "bottom"
204
- }
226
+ textStyle: startTextAlignStyle
205
227
  }), `data-zoom-start-text-${position}`), this._endText = this.maybeAddLabel(this._container, (0,
206
228
  vutils_1.merge)({}, restEndTextStyle, {
207
- text: endTextFormat ? endTextFormat(this._endValue) : this._endValue,
208
- x: position.x + width / 2,
209
- y: position.y + end * height,
229
+ text: endTextValue,
230
+ x: endTextPosition.x,
231
+ y: endTextPosition.y,
210
232
  visible: this._showText,
211
233
  pickable: !1,
212
234
  childrenPickable: !1,
213
- textStyle: {
214
- textAlign: "center",
215
- textBaseline: "top"
216
- }
217
- }), `data-zoom-end-text-${position}`));
235
+ textStyle: endTextAlignStyle
236
+ }), `data-zoom-end-text-${position}`);
237
+ }
238
+ renderText() {
239
+ let startTextBounds = null, endTextBounds = null;
240
+ this.setTextAttr(startTextBounds, endTextBounds), startTextBounds = this._startText.AABBBounds,
241
+ endTextBounds = this._endText.AABBBounds, this.setTextAttr(startTextBounds, endTextBounds),
242
+ startTextBounds = this._startText.AABBBounds, endTextBounds = this._endText.AABBBounds;
243
+ const {x1: x1, x2: x2, y1: y1, y2: y2} = startTextBounds, {dx: startTextDx = 0, dy: startTextDy = 0} = this.attribute.startTextStyle;
244
+ if ((new vutils_1.Bounds).set(x1, y1, x2, y2).intersects(endTextBounds)) {
245
+ const direction = "bottom" === this.attribute.orient || "right" === this.attribute.orient ? -1 : 1;
246
+ this._isHorizontal ? this._startText.setAttribute("dy", startTextDy + direction * Math.abs(endTextBounds.y1 - endTextBounds.y2)) : this._startText.setAttribute("dx", startTextDx + direction * Math.abs(endTextBounds.x1 - endTextBounds.x2));
247
+ } else this._isHorizontal ? this._startText.setAttribute("dy", startTextDy) : this._startText.setAttribute("dx", startTextDx);
218
248
  }
219
249
  getLayoutAttrFromConfig() {
220
250
  var _a, _b, _c, _d;
@@ -246,60 +276,72 @@ class DataZoom extends base_1.AbstractComponent {
246
276
  render() {
247
277
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
248
278
  this._layoutAttrFromConfig = null;
249
- 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");
250
- if (this._container = group, this._background = group.createOrUpdateChild("background", Object.assign({
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
+ if (this._container = group, this._background = group.createOrUpdateChild("background", Object.assign(Object.assign({
251
281
  x: position.x,
252
282
  y: position.y,
253
283
  width: width,
254
284
  height: height,
255
285
  cursor: brushSelect ? "crosshair" : "auto"
256
- }, backgroundStyle), "rect"), (null === (_c = backgroundChartStyle.line) || void 0 === _c ? void 0 : _c.visible) && this.setPreviewAttributes("line", group),
286
+ }, backgroundStyle), {
287
+ pickable: !zoomLock
288
+ }), "rect"), (null === (_c = backgroundChartStyle.line) || void 0 === _c ? void 0 : _c.visible) && this.setPreviewAttributes("line", group),
257
289
  (null === (_d = backgroundChartStyle.area) || void 0 === _d ? void 0 : _d.visible) && this.setPreviewAttributes("area", group),
258
- brushSelect && this.renderDragMask(), this._isHorizontal ? this._selectedBackground = group.createOrUpdateChild("selectedBackground", Object.assign({
290
+ brushSelect && this.renderDragMask(), this._isHorizontal ? this._selectedBackground = group.createOrUpdateChild("selectedBackground", Object.assign(Object.assign({
259
291
  x: position.x + start * width,
260
292
  y: position.y,
261
293
  width: (end - start) * width,
262
294
  height: height,
263
295
  cursor: brushSelect ? "crosshair" : "move"
264
- }, selectedBackgroundStyle), "rect") : this._selectedBackground = group.createOrUpdateChild("selectedBackground", Object.assign({
296
+ }, selectedBackgroundStyle), {
297
+ pickable: !zoomLock
298
+ }), "rect") : this._selectedBackground = group.createOrUpdateChild("selectedBackground", Object.assign(Object.assign({
265
299
  x: position.x,
266
300
  y: position.y + start * height,
267
301
  width: width,
268
302
  height: (end - start) * height,
269
303
  cursor: brushSelect ? "crosshair" : "move"
270
- }, selectedBackgroundStyle), "rect"), (null === (_e = selectedBackgroundChartStyle.line) || void 0 === _e ? void 0 : _e.visible) && this.setSelectedPreviewAttributes("line", group),
304
+ }, selectedBackgroundStyle), {
305
+ pickable: !zoomLock
306
+ }), "rect"), (null === (_e = selectedBackgroundChartStyle.line) || void 0 === _e ? void 0 : _e.visible) && this.setSelectedPreviewAttributes("line", group),
271
307
  (null === (_f = selectedBackgroundChartStyle.area) || void 0 === _f ? void 0 : _f.visible) && this.setSelectedPreviewAttributes("area", group),
272
- this._showText && this.renderText(), this._isHorizontal) {
308
+ this._isHorizontal) {
273
309
  if (middleHandlerStyle.visible) {
274
310
  const middleHandlerBackgroundSize = (null === (_g = middleHandlerStyle.background) || void 0 === _g ? void 0 : _g.size) || 10;
275
- this._middleHandlerRect = group.createOrUpdateChild("middleHandlerRect", Object.assign({
311
+ this._middleHandlerRect = group.createOrUpdateChild("middleHandlerRect", Object.assign(Object.assign({
276
312
  x: position.x + start * width,
277
313
  y: position.y - middleHandlerBackgroundSize,
278
314
  width: (end - start) * width,
279
315
  height: middleHandlerBackgroundSize
280
- }, null === (_h = middleHandlerStyle.background) || void 0 === _h ? void 0 : _h.style), "rect"),
281
- this._middleHandlerSymbol = group.createOrUpdateChild("middleHandlerSymbol", Object.assign({
316
+ }, null === (_h = middleHandlerStyle.background) || void 0 === _h ? void 0 : _h.style), {
317
+ pickable: !zoomLock
318
+ }), "rect"), this._middleHandlerSymbol = group.createOrUpdateChild("middleHandlerSymbol", Object.assign(Object.assign({
282
319
  x: position.x + (start + end) / 2 * width,
283
320
  y: position.y - middleHandlerBackgroundSize / 2,
284
321
  strokeBoundsBuffer: 0,
285
322
  angle: 0,
286
323
  symbolType: null !== (_k = null === (_j = middleHandlerStyle.icon) || void 0 === _j ? void 0 : _j.symbolType) && void 0 !== _k ? _k : "square"
287
- }, middleHandlerStyle.icon), "symbol");
324
+ }, middleHandlerStyle.icon), {
325
+ pickable: !zoomLock
326
+ }), "symbol");
288
327
  }
289
- this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign({
328
+ this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign(Object.assign({
290
329
  x: position.x + start * width,
291
330
  y: position.y + height / 2,
292
331
  size: height,
293
332
  symbolType: null !== (_l = startHandlerStyle.symbolType) && void 0 !== _l ? _l : "square"
294
- }, config_1.DEFAULT_HANDLER_ATTR_MAP.horizontal), startHandlerStyle), "symbol"),
295
- this._endHandler = group.createOrUpdateChild("endHandler", Object.assign(Object.assign({
333
+ }, config_1.DEFAULT_HANDLER_ATTR_MAP.horizontal), startHandlerStyle), {
334
+ pickable: !zoomLock
335
+ }), "symbol"), this._endHandler = group.createOrUpdateChild("endHandler", Object.assign(Object.assign(Object.assign({
296
336
  x: position.x + end * width,
297
337
  y: position.y + height / 2,
298
338
  size: height,
299
339
  symbolType: null !== (_m = endHandlerStyle.symbolType) && void 0 !== _m ? _m : "square"
300
- }, config_1.DEFAULT_HANDLER_ATTR_MAP.horizontal), endHandlerStyle), "symbol");
340
+ }, config_1.DEFAULT_HANDLER_ATTR_MAP.horizontal), endHandlerStyle), {
341
+ pickable: !zoomLock
342
+ }), "symbol");
301
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);
302
- this._startHandlerMask = group.createOrUpdateChild("startHandlerMask", Object.assign({
344
+ this._startHandlerMask = group.createOrUpdateChild("startHandlerMask", Object.assign(Object.assign({
303
345
  x: position.x + start * width - startHandlerWidth / 2,
304
346
  y: position.y + height / 2 - startHandlerHeight / 2,
305
347
  width: startHandlerWidth,
@@ -307,7 +349,9 @@ class DataZoom extends base_1.AbstractComponent {
307
349
  fill: "white",
308
350
  fillOpacity: 0,
309
351
  zIndex: 999
310
- }, config_1.DEFAULT_HANDLER_ATTR_MAP.horizontal), "rect"), this._endHandlerMask = group.createOrUpdateChild("endHandlerMask", Object.assign({
352
+ }, config_1.DEFAULT_HANDLER_ATTR_MAP.horizontal), {
353
+ pickable: !zoomLock
354
+ }), "rect"), this._endHandlerMask = group.createOrUpdateChild("endHandlerMask", Object.assign(Object.assign({
311
355
  x: position.x + end * width - endHandlerWidth / 2,
312
356
  y: position.y + height / 2 - endHandlerHeight / 2,
313
357
  width: endHandlerWidth,
@@ -315,37 +359,46 @@ class DataZoom extends base_1.AbstractComponent {
315
359
  fill: "white",
316
360
  fillOpacity: 0,
317
361
  zIndex: 999
318
- }, config_1.DEFAULT_HANDLER_ATTR_MAP.horizontal), "rect");
362
+ }, config_1.DEFAULT_HANDLER_ATTR_MAP.horizontal), {
363
+ pickable: !zoomLock
364
+ }), "rect");
319
365
  } else {
320
366
  if (middleHandlerStyle.visible) {
321
367
  const middleHandlerBackgroundSize = (null === (_o = middleHandlerStyle.background) || void 0 === _o ? void 0 : _o.size) || 10;
322
- this._middleHandlerRect = group.createOrUpdateChild("middleHandlerRect", Object.assign({
368
+ this._middleHandlerRect = group.createOrUpdateChild("middleHandlerRect", Object.assign(Object.assign({
323
369
  x: "left" === orient ? position.x - middleHandlerBackgroundSize : position.x + width,
324
370
  y: position.y + start * height,
325
371
  width: middleHandlerBackgroundSize,
326
372
  height: (end - start) * height
327
- }, null === (_p = middleHandlerStyle.background) || void 0 === _p ? void 0 : _p.style), "rect"),
328
- this._middleHandlerSymbol = group.createOrUpdateChild("middleHandlerSymbol", Object.assign({
373
+ }, null === (_p = middleHandlerStyle.background) || void 0 === _p ? void 0 : _p.style), {
374
+ pickable: !zoomLock
375
+ }), "rect"), this._middleHandlerSymbol = group.createOrUpdateChild("middleHandlerSymbol", Object.assign(Object.assign({
329
376
  x: "left" === orient ? position.x - middleHandlerBackgroundSize / 2 : position.x + width + middleHandlerBackgroundSize / 2,
330
377
  y: position.y + (start + end) / 2 * height,
331
378
  angle: Math.PI / 180 * 90,
332
379
  symbolType: null !== (_r = null === (_q = middleHandlerStyle.icon) || void 0 === _q ? void 0 : _q.symbolType) && void 0 !== _r ? _r : "square",
333
380
  strokeBoundsBuffer: 0
334
- }, middleHandlerStyle.icon), "symbol");
381
+ }, middleHandlerStyle.icon), {
382
+ pickable: !zoomLock
383
+ }), "symbol");
335
384
  }
336
- this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign({
385
+ this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign(Object.assign({
337
386
  x: position.x + width / 2,
338
387
  y: position.y + start * height,
339
388
  size: width,
340
389
  symbolType: null !== (_s = startHandlerStyle.symbolType) && void 0 !== _s ? _s : "square"
341
- }, config_1.DEFAULT_HANDLER_ATTR_MAP.vertical), startHandlerStyle), "symbol"), this._endHandler = group.createOrUpdateChild("endHandler", Object.assign(Object.assign({
390
+ }, config_1.DEFAULT_HANDLER_ATTR_MAP.vertical), startHandlerStyle), {
391
+ pickable: !zoomLock
392
+ }), "symbol"), this._endHandler = group.createOrUpdateChild("endHandler", Object.assign(Object.assign(Object.assign({
342
393
  x: position.x + width / 2,
343
394
  y: position.y + end * height,
344
395
  size: width,
345
396
  symbolType: null !== (_t = endHandlerStyle.symbolType) && void 0 !== _t ? _t : "square"
346
- }, config_1.DEFAULT_HANDLER_ATTR_MAP.vertical), endHandlerStyle), "symbol");
397
+ }, config_1.DEFAULT_HANDLER_ATTR_MAP.vertical), endHandlerStyle), {
398
+ pickable: !zoomLock
399
+ }), "symbol");
347
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);
348
- this._startHandlerMask = group.createOrUpdateChild("startHandlerMask", Object.assign({
401
+ this._startHandlerMask = group.createOrUpdateChild("startHandlerMask", Object.assign(Object.assign({
349
402
  x: position.x + width / 2 + startHandlerWidth / 2,
350
403
  y: position.y + start * height - startHandlerHeight / 2,
351
404
  width: endHandlerHeight,
@@ -353,7 +406,9 @@ class DataZoom extends base_1.AbstractComponent {
353
406
  fill: "white",
354
407
  fillOpacity: 0,
355
408
  zIndex: 999
356
- }, config_1.DEFAULT_HANDLER_ATTR_MAP.vertical), "rect"), this._endHandlerMask = group.createOrUpdateChild("endHandlerMask", Object.assign({
409
+ }, config_1.DEFAULT_HANDLER_ATTR_MAP.vertical), {
410
+ pickable: !zoomLock
411
+ }), "rect"), this._endHandlerMask = group.createOrUpdateChild("endHandlerMask", Object.assign(Object.assign({
357
412
  x: position.x + width / 2 + endHandlerWidth / 2,
358
413
  y: position.y + end * height - endHandlerHeight / 2,
359
414
  width: endHandlerHeight,
@@ -361,8 +416,11 @@ class DataZoom extends base_1.AbstractComponent {
361
416
  fill: "white",
362
417
  fillOpacity: 0,
363
418
  zIndex: 999
364
- }, config_1.DEFAULT_HANDLER_ATTR_MAP.vertical), "rect");
419
+ }, config_1.DEFAULT_HANDLER_ATTR_MAP.vertical), {
420
+ pickable: !zoomLock
421
+ }), "rect");
365
422
  }
423
+ this._showText && this.renderText();
366
424
  }
367
425
  computeBasePoints() {
368
426
  const {orient: orient} = this.attribute, {position: position, width: width, height: height} = this.getLayoutAttrFromConfig();