@visactor/vrender 1.0.26 → 1.0.27-alpha.0
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.
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +11 -10
- package/cjs/index.js.map +1 -1
- package/dist/index.es.js +137 -3
- package/dist/index.js +137 -3
- package/dist/index.min.js +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/package.json +5 -5
package/cjs/index.d.ts
CHANGED
package/cjs/index.js
CHANGED
|
@@ -21,16 +21,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
21
21
|
|
|
22
22
|
const vrender_core_1 = require("@visactor/vrender-core"), vrender_kits_1 = require("@visactor/vrender-kits"), vrender_kits_2 = require("@visactor/vrender-kits"), vrender_animate_1 = require("@visactor/vrender-animate");
|
|
23
23
|
|
|
24
|
-
exports.version = "1.0.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
(0, vrender_kits_2.
|
|
28
|
-
(0, vrender_kits_2.
|
|
29
|
-
(0, vrender_kits_2.
|
|
30
|
-
(0, vrender_kits_2.
|
|
31
|
-
vrender_kits_2.
|
|
32
|
-
(0, vrender_kits_2.
|
|
33
|
-
(0,
|
|
24
|
+
exports.version = "1.0.27-alpha.0", (0, vrender_core_1.preLoadAllModule)(), (0,
|
|
25
|
+
vrender_core_1.isBrowserEnv)() ? (0, vrender_kits_1.loadBrowserEnv)(vrender_core_1.container) : (0,
|
|
26
|
+
vrender_core_1.isNodeEnv)() && (0, vrender_kits_1.loadNodeEnv)(vrender_core_1.container),
|
|
27
|
+
(0, vrender_kits_2.registerArc)(), (0, vrender_kits_2.registerArc3d)(), (0, vrender_kits_2.registerArea)(),
|
|
28
|
+
(0, vrender_kits_2.registerCircle)(), (0, vrender_kits_2.registerGlyph)(), (0, vrender_kits_2.registerGroup)(),
|
|
29
|
+
(0, vrender_kits_2.registerImage)(), (0, vrender_kits_2.registerLine)(), (0, vrender_kits_2.registerPath)(),
|
|
30
|
+
(0, vrender_kits_2.registerPolygon)(), (0, vrender_kits_2.registerPyramid3d)(),
|
|
31
|
+
(0, vrender_kits_2.registerRect)(), (0, vrender_kits_2.registerRect3d)(), (0, vrender_kits_2.registerRichtext)(),
|
|
32
|
+
(0, vrender_kits_2.registerShadowRoot)(), (0, vrender_kits_2.registerSymbol)(),
|
|
33
|
+
(0, vrender_kits_2.registerText)(), (0, vrender_kits_2.registerWrapText)(), (0,
|
|
34
|
+
vrender_kits_1.registerStar)(), (0, vrender_core_1.registerFlexLayoutPlugin)(),
|
|
34
35
|
(0, vrender_core_1.registerViewTransform3dPlugin)(), (0, vrender_core_1.registerHtmlAttributePlugin)(),
|
|
35
36
|
(0, vrender_core_1.registerReactAttributePlugin)(), (0, vrender_core_1.registerDirectionalLight)(),
|
|
36
37
|
(0, vrender_core_1.registerOrthoCamera)(), (0, vrender_animate_1.registerCustomAnimate)(),
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kCAAgC;AAChC,yDAWgC;AAChC,yDAAmF;AACnF,yDAmBgC;AAChC,+DAAmF;AAEtE,QAAA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kCAAgC;AAChC,yDAWgC;AAChC,yDAAmF;AACnF,yDAmBgC;AAChC,+DAAmF;AAEtE,QAAA,OAAO,GAAG,gBAAgB,CAAC;AAExC,IAAA,+BAAgB,GAAE,CAAC;AAEnB,IAAI,IAAA,2BAAY,GAAE,EAAE;IAClB,IAAA,6BAAc,EAAC,wBAAS,CAAC,CAAC;CAC3B;KAAM,IAAI,IAAA,wBAAS,GAAE,EAAE;IACtB,IAAA,0BAAW,EAAC,wBAAS,CAAC,CAAC;CACxB;AACD,IAAA,0BAAW,GAAE,CAAC;AACd,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,8BAAe,GAAE,CAAC;AAClB,IAAA,gCAAiB,GAAE,CAAC;AACpB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,+BAAgB,GAAE,CAAC;AACnB,IAAA,iCAAkB,GAAE,CAAC;AACrB,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,+BAAgB,GAAE,CAAC;AACnB,IAAA,2BAAY,GAAE,CAAC;AAEf,IAAA,uCAAwB,GAAE,CAAC;AAC3B,IAAA,4CAA6B,GAAE,CAAC;AAChC,IAAA,0CAA2B,GAAE,CAAC;AAC9B,IAAA,2CAA4B,GAAE,CAAC;AAC/B,IAAA,uCAAwB,GAAE,CAAC;AAC3B,IAAA,kCAAmB,GAAE,CAAC;AAEtB,IAAA,uCAAqB,GAAE,CAAC;AACxB,IAAA,iCAAe,GAAE,CAAC;AAElB,yDAAuC;AACvC,yDAAuC;AACvC,4DAA0C;AAC1C,+DAA6C;AAG7C,6DAAkD;AAAzC,wGAAA,KAAK,OAAA;AACd,uDAAmD;AAA1C,yGAAA,SAAS,OAAA","file":"index.js","sourcesContent":["import '@visactor/vrender-core';\nimport {\n container,\n isBrowserEnv,\n isNodeEnv,\n preLoadAllModule,\n registerFlexLayoutPlugin,\n registerViewTransform3dPlugin,\n registerHtmlAttributePlugin,\n registerReactAttributePlugin,\n registerDirectionalLight,\n registerOrthoCamera\n} from '@visactor/vrender-core';\nimport { loadBrowserEnv, loadNodeEnv, registerStar } from '@visactor/vrender-kits';\nimport {\n registerArc,\n registerArc3d,\n registerArea,\n registerCircle,\n registerGlyph,\n registerGroup,\n registerImage,\n registerLine,\n registerPath,\n registerPolygon,\n registerPyramid3d,\n registerRect,\n registerRect3d,\n registerRichtext,\n registerShadowRoot,\n registerSymbol,\n registerText,\n registerWrapText\n} from '@visactor/vrender-kits';\nimport { registerCustomAnimate, registerAnimate } from '@visactor/vrender-animate';\n// 导出版本号\nexport const version = \"1.0.27-alpha.0\";\n\npreLoadAllModule();\n\nif (isBrowserEnv()) {\n loadBrowserEnv(container);\n} else if (isNodeEnv()) {\n loadNodeEnv(container);\n}\nregisterArc();\nregisterArc3d();\nregisterArea();\nregisterCircle();\nregisterGlyph();\nregisterGroup();\nregisterImage();\nregisterLine();\nregisterPath();\nregisterPolygon();\nregisterPyramid3d();\nregisterRect();\nregisterRect3d();\nregisterRichtext();\nregisterShadowRoot();\nregisterSymbol();\nregisterText();\nregisterWrapText();\nregisterStar();\n\nregisterFlexLayoutPlugin();\nregisterViewTransform3dPlugin();\nregisterHtmlAttributePlugin();\nregisterReactAttributePlugin();\nregisterDirectionalLight();\nregisterOrthoCamera();\n\nregisterCustomAnimate();\nregisterAnimate();\n\nexport * from '@visactor/vrender-core';\nexport * from '@visactor/vrender-kits';\nexport * from '@visactor/vrender-animate';\nexport * from '@visactor/vrender-components';\n\n// avoid naming conflicts with 'State' & 'Direction' in '@visactor/vrender-components'\nexport { State } from '@visactor/vrender-animate';\nexport { Direction } from '@visactor/vrender-core';\n"]}
|
package/dist/index.es.js
CHANGED
|
@@ -39324,7 +39324,7 @@ class ArcSegment extends Segment {
|
|
|
39324
39324
|
|
|
39325
39325
|
var AXIS_ELEMENT_NAME;
|
|
39326
39326
|
!function (AXIS_ELEMENT_NAME) {
|
|
39327
|
-
AXIS_ELEMENT_NAME.innerView = "inner-view", AXIS_ELEMENT_NAME.axisContainer = "axis-container", AXIS_ELEMENT_NAME.labelContainer = "axis-label-container", AXIS_ELEMENT_NAME.tickContainer = "axis-tick-container", AXIS_ELEMENT_NAME.tick = "axis-tick", AXIS_ELEMENT_NAME.subTick = "axis-sub-tick", AXIS_ELEMENT_NAME.label = "axis-label", AXIS_ELEMENT_NAME.title = "axis-title", AXIS_ELEMENT_NAME.gridContainer = "axis-grid-container", AXIS_ELEMENT_NAME.grid = "axis-grid", AXIS_ELEMENT_NAME.gridRegion = "axis-grid-region", AXIS_ELEMENT_NAME.line = "axis-line", AXIS_ELEMENT_NAME.background = "axis-background", AXIS_ELEMENT_NAME.axisLabelBackground = "axis-label-background", AXIS_ELEMENT_NAME.axisBreak = "axis-break", AXIS_ELEMENT_NAME.axisBreakSymbol = "axis-break-symbol";
|
|
39327
|
+
AXIS_ELEMENT_NAME.innerView = "inner-view", AXIS_ELEMENT_NAME.axisContainer = "axis-container", AXIS_ELEMENT_NAME.labelContainer = "axis-label-container", AXIS_ELEMENT_NAME.tickContainer = "axis-tick-container", AXIS_ELEMENT_NAME.tick = "axis-tick", AXIS_ELEMENT_NAME.subTick = "axis-sub-tick", AXIS_ELEMENT_NAME.label = "axis-label", AXIS_ELEMENT_NAME.title = "axis-title", AXIS_ELEMENT_NAME.labelHoverOnAxis = "axis-label-hover-on-axis", AXIS_ELEMENT_NAME.gridContainer = "axis-grid-container", AXIS_ELEMENT_NAME.grid = "axis-grid", AXIS_ELEMENT_NAME.gridRegion = "axis-grid-region", AXIS_ELEMENT_NAME.line = "axis-line", AXIS_ELEMENT_NAME.background = "axis-background", AXIS_ELEMENT_NAME.axisLabelBackground = "axis-label-background", AXIS_ELEMENT_NAME.axisBreak = "axis-break", AXIS_ELEMENT_NAME.axisBreakSymbol = "axis-break-symbol";
|
|
39328
39328
|
}(AXIS_ELEMENT_NAME || (AXIS_ELEMENT_NAME = {}));
|
|
39329
39329
|
var AxisStateValue;
|
|
39330
39330
|
!function (AxisStateValue) {
|
|
@@ -39361,6 +39361,26 @@ const DEFAULT_AXIS_THEME = {
|
|
|
39361
39361
|
fillOpacity: 1
|
|
39362
39362
|
}
|
|
39363
39363
|
},
|
|
39364
|
+
labelHoverOnAxis: {
|
|
39365
|
+
visible: !1,
|
|
39366
|
+
space: 7,
|
|
39367
|
+
padding: 2,
|
|
39368
|
+
position: 0,
|
|
39369
|
+
autoRotate: !1,
|
|
39370
|
+
textStyle: {
|
|
39371
|
+
fontSize: 12,
|
|
39372
|
+
fill: "red",
|
|
39373
|
+
fontWeight: "normal",
|
|
39374
|
+
fillOpacity: 1
|
|
39375
|
+
},
|
|
39376
|
+
background: {
|
|
39377
|
+
visible: !0,
|
|
39378
|
+
style: {
|
|
39379
|
+
cornerRadius: 2,
|
|
39380
|
+
fill: "black"
|
|
39381
|
+
}
|
|
39382
|
+
}
|
|
39383
|
+
},
|
|
39364
39384
|
tick: {
|
|
39365
39385
|
visible: !0,
|
|
39366
39386
|
inside: !1,
|
|
@@ -40352,7 +40372,17 @@ var __rest$b = undefined && undefined.__rest || function (s, e) {
|
|
|
40352
40372
|
loadLineAxisComponent();
|
|
40353
40373
|
class LineAxis extends AxisBase {
|
|
40354
40374
|
constructor(attributes, options) {
|
|
40355
|
-
|
|
40375
|
+
var _a;
|
|
40376
|
+
if (attributes.labelHoverOnAxis && (attributes.labelHoverOnAxis.textStyle = Object.assign({}, attributes.label.style, attributes.labelHoverOnAxis.textStyle), void 0 === attributes.labelHoverOnAxis.space)) {
|
|
40377
|
+
const {
|
|
40378
|
+
padding = 2
|
|
40379
|
+
} = attributes.labelHoverOnAxis,
|
|
40380
|
+
parsedPadding = normalizePadding(padding),
|
|
40381
|
+
toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3],
|
|
40382
|
+
space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis.defaultAttributes.label.space) - toDiffPadding;
|
|
40383
|
+
attributes.labelHoverOnAxis.space = space;
|
|
40384
|
+
}
|
|
40385
|
+
super((null == options ? void 0 : options.skipDefault) ? attributes : merge({}, LineAxis.defaultAttributes, attributes), options), this.labelHoverOnAxisGroup = null;
|
|
40356
40386
|
}
|
|
40357
40387
|
_renderInner(container) {
|
|
40358
40388
|
var _a;
|
|
@@ -40414,6 +40444,15 @@ class LineAxis extends AxisBase {
|
|
|
40414
40444
|
}, panel.style));
|
|
40415
40445
|
bgRect.name = AXIS_ELEMENT_NAME.background, bgRect.id = this._getNodeId("background"), bgRect.states = merge({}, DEFAULT_STATES$1, null !== (_a = panel.state) && void 0 !== _a ? _a : {}), axisContainer.insertBefore(bgRect, axisContainer.firstChild);
|
|
40416
40446
|
}
|
|
40447
|
+
const {
|
|
40448
|
+
labelHoverOnAxis: labelHoverOnAxis
|
|
40449
|
+
} = this.attribute;
|
|
40450
|
+
labelHoverOnAxis && labelHoverOnAxis.visible && this.renderLabelHoverOnAxis();
|
|
40451
|
+
}
|
|
40452
|
+
renderLabelHoverOnAxis() {
|
|
40453
|
+
const hoverOnLabelAttributes = this.getLabelHoverOnAxisAttribute(),
|
|
40454
|
+
hoverOnLabel = new Tag(Object.assign({}, hoverOnLabelAttributes));
|
|
40455
|
+
hoverOnLabel.name = AXIS_ELEMENT_NAME.title, hoverOnLabel.id = this._getNodeId("hover-on-label"), this.labelHoverOnAxisGroup = hoverOnLabel, this.axisContainer.add(hoverOnLabel);
|
|
40417
40456
|
}
|
|
40418
40457
|
renderLine(container) {
|
|
40419
40458
|
const {
|
|
@@ -40554,6 +40593,66 @@ class LineAxis extends AxisBase {
|
|
|
40554
40593
|
visible: !0
|
|
40555
40594
|
}, background.style)), attrs;
|
|
40556
40595
|
}
|
|
40596
|
+
getLabelHoverOnAxisAttribute() {
|
|
40597
|
+
var _a, _b;
|
|
40598
|
+
const {
|
|
40599
|
+
orient: orient
|
|
40600
|
+
} = this.attribute,
|
|
40601
|
+
_c = this.attribute.labelHoverOnAxis,
|
|
40602
|
+
{
|
|
40603
|
+
position = 0,
|
|
40604
|
+
space = 4,
|
|
40605
|
+
autoRotate = !0,
|
|
40606
|
+
textStyle = {},
|
|
40607
|
+
background = {},
|
|
40608
|
+
formatMethod: formatMethod,
|
|
40609
|
+
text: textContent = "",
|
|
40610
|
+
maxWidth: maxWidth
|
|
40611
|
+
} = _c,
|
|
40612
|
+
restAttrs = __rest$b(_c, ["position", "space", "autoRotate", "textStyle", "background", "formatMethod", "text", "maxWidth"]),
|
|
40613
|
+
point = this.getTickCoord(0);
|
|
40614
|
+
"bottom" === orient || "top" === orient ? point.x = position : point.y = position;
|
|
40615
|
+
let tickLength = 0;
|
|
40616
|
+
(null === (_a = this.attribute.tick) || void 0 === _a ? void 0 : _a.visible) && !1 === this.attribute.tick.inside && (tickLength = this.attribute.tick.length || 4), (null === (_b = this.attribute.subTick) || void 0 === _b ? void 0 : _b.visible) && !1 === this.attribute.subTick.inside && (tickLength = Math.max(tickLength, this.attribute.subTick.length || 2));
|
|
40617
|
+
const offset = tickLength + 0 + space,
|
|
40618
|
+
labelPoint = this.getVerticalCoord(point, offset, !1),
|
|
40619
|
+
vector = this.getVerticalVector(offset, !1, {
|
|
40620
|
+
x: 0,
|
|
40621
|
+
y: 0
|
|
40622
|
+
});
|
|
40623
|
+
let textBaseline,
|
|
40624
|
+
{
|
|
40625
|
+
angle: angle
|
|
40626
|
+
} = restAttrs,
|
|
40627
|
+
textAlign = "center";
|
|
40628
|
+
if (isNil$1(angle) && autoRotate) {
|
|
40629
|
+
const axisVector = this.getRelativeVector();
|
|
40630
|
+
angle = angleTo(axisVector, [1, 0], !0);
|
|
40631
|
+
const {
|
|
40632
|
+
verticalFactor = 1
|
|
40633
|
+
} = this.attribute;
|
|
40634
|
+
textBaseline = 1 === -1 * verticalFactor ? "bottom" : "top";
|
|
40635
|
+
} else {
|
|
40636
|
+
const {
|
|
40637
|
+
textAlign: textAlign2,
|
|
40638
|
+
textBaseline: textBaseline2
|
|
40639
|
+
} = this.getLabelAlign(vector, !1, textStyle.angle);
|
|
40640
|
+
textAlign = textAlign2, textBaseline = textBaseline2;
|
|
40641
|
+
}
|
|
40642
|
+
const maxTagWidth = maxWidth,
|
|
40643
|
+
text = formatMethod ? formatMethod(textContent) : textContent,
|
|
40644
|
+
attrs = Object.assign(Object.assign(Object.assign({}, labelPoint), restAttrs), {
|
|
40645
|
+
maxWidth: maxTagWidth,
|
|
40646
|
+
textStyle: Object.assign({
|
|
40647
|
+
textAlign: textAlign,
|
|
40648
|
+
textBaseline: textBaseline
|
|
40649
|
+
}, textStyle),
|
|
40650
|
+
text: text
|
|
40651
|
+
});
|
|
40652
|
+
return attrs.angle = angle, background && background.visible && (attrs.panel = Object.assign(Object.assign({
|
|
40653
|
+
visible: !0
|
|
40654
|
+
}, restAttrs.panel), background.style)), attrs;
|
|
40655
|
+
}
|
|
40557
40656
|
getTextBaseline(vector, inside) {
|
|
40558
40657
|
let base = "middle";
|
|
40559
40658
|
const {
|
|
@@ -40744,6 +40843,41 @@ class LineAxis extends AxisBase {
|
|
|
40744
40843
|
}
|
|
40745
40844
|
return limitLength && (limitLength = (limitLength - labelSpace - titleSpacing - titleHeight - axisLineWidth - tickLength) / layerCount), limitLength;
|
|
40746
40845
|
}
|
|
40846
|
+
showLabelHoverOnAxis(position, text) {
|
|
40847
|
+
let adjustPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0;
|
|
40848
|
+
if (this.attribute.labelHoverOnAxis) {
|
|
40849
|
+
const preContainerBounds = this.axisContainer.AABBBounds,
|
|
40850
|
+
preWidth = preContainerBounds.width(),
|
|
40851
|
+
preHeight = preContainerBounds.height(),
|
|
40852
|
+
preX1 = preContainerBounds.x1,
|
|
40853
|
+
preY1 = preContainerBounds.y1,
|
|
40854
|
+
preX2 = preContainerBounds.x2,
|
|
40855
|
+
preY2 = preContainerBounds.y2;
|
|
40856
|
+
if (this.labelHoverOnAxisGroup) {
|
|
40857
|
+
const {
|
|
40858
|
+
formatMethod: formatMethod
|
|
40859
|
+
} = this.attribute.labelHoverOnAxis,
|
|
40860
|
+
textStr = formatMethod ? formatMethod(text) : text;
|
|
40861
|
+
this.labelHoverOnAxisGroup.setAttribute("text", textStr), this.labelHoverOnAxisGroup.setAttribute("visible", !0), this.labelHoverOnAxisGroup.setAttribute("visibleAll", !0), "left" === this.attribute.orient || "right" === this.attribute.orient ? this.labelHoverOnAxisGroup.setAttributes({
|
|
40862
|
+
y: position
|
|
40863
|
+
}) : this.labelHoverOnAxisGroup.setAttributes({
|
|
40864
|
+
x: position
|
|
40865
|
+
});
|
|
40866
|
+
} else this.attribute.labelHoverOnAxis.visible = !0, this.attribute.labelHoverOnAxis.position = position, this.attribute.labelHoverOnAxis.text = text, this.renderLabelHoverOnAxis();
|
|
40867
|
+
if (adjustPosition) {
|
|
40868
|
+
const afterContainerBounds = this.axisContainer.AABBBounds,
|
|
40869
|
+
diffWidth = afterContainerBounds.width() - preWidth,
|
|
40870
|
+
diffHeight = afterContainerBounds.height() - preHeight;
|
|
40871
|
+
diffWidth > 0 && ("top" === this.attribute.orient || "bottom" === this.attribute.orient) && (afterContainerBounds.x1 < preX1 ? this.showLabelHoverOnAxis(position + diffWidth, text, !1) : afterContainerBounds.x2 > preX2 && this.showLabelHoverOnAxis(position - diffWidth, text, !1)), diffHeight > 0 && ("left" === this.attribute.orient || "right" === this.attribute.orient) && (afterContainerBounds.y1 < preY1 ? this.showLabelHoverOnAxis(position + diffHeight, text, !1) : afterContainerBounds.y2 > preY2 && this.showLabelHoverOnAxis(position - diffHeight, text, !1));
|
|
40872
|
+
}
|
|
40873
|
+
}
|
|
40874
|
+
}
|
|
40875
|
+
hideLabelHoverOnAxis() {
|
|
40876
|
+
this.attribute.labelHoverOnAxis && this.labelHoverOnAxisGroup && this.labelHoverOnAxisGroup.setAttributes({
|
|
40877
|
+
visible: !1,
|
|
40878
|
+
visibleAll: !1
|
|
40879
|
+
});
|
|
40880
|
+
}
|
|
40747
40881
|
release() {
|
|
40748
40882
|
super.release(), this._breaks = null;
|
|
40749
40883
|
}
|
|
@@ -52818,7 +52952,7 @@ TableSeriesNumber.defaultAttributes = {
|
|
|
52818
52952
|
select: !0
|
|
52819
52953
|
};
|
|
52820
52954
|
|
|
52821
|
-
const version = "1.0.
|
|
52955
|
+
const version = "1.0.27-alpha.0";
|
|
52822
52956
|
preLoadAllModule();
|
|
52823
52957
|
if (isBrowserEnv()) {
|
|
52824
52958
|
loadBrowserEnv(container);
|
package/dist/index.js
CHANGED
|
@@ -39330,7 +39330,7 @@
|
|
|
39330
39330
|
|
|
39331
39331
|
exports.AXIS_ELEMENT_NAME = void 0;
|
|
39332
39332
|
!function (AXIS_ELEMENT_NAME) {
|
|
39333
|
-
AXIS_ELEMENT_NAME.innerView = "inner-view", AXIS_ELEMENT_NAME.axisContainer = "axis-container", AXIS_ELEMENT_NAME.labelContainer = "axis-label-container", AXIS_ELEMENT_NAME.tickContainer = "axis-tick-container", AXIS_ELEMENT_NAME.tick = "axis-tick", AXIS_ELEMENT_NAME.subTick = "axis-sub-tick", AXIS_ELEMENT_NAME.label = "axis-label", AXIS_ELEMENT_NAME.title = "axis-title", AXIS_ELEMENT_NAME.gridContainer = "axis-grid-container", AXIS_ELEMENT_NAME.grid = "axis-grid", AXIS_ELEMENT_NAME.gridRegion = "axis-grid-region", AXIS_ELEMENT_NAME.line = "axis-line", AXIS_ELEMENT_NAME.background = "axis-background", AXIS_ELEMENT_NAME.axisLabelBackground = "axis-label-background", AXIS_ELEMENT_NAME.axisBreak = "axis-break", AXIS_ELEMENT_NAME.axisBreakSymbol = "axis-break-symbol";
|
|
39333
|
+
AXIS_ELEMENT_NAME.innerView = "inner-view", AXIS_ELEMENT_NAME.axisContainer = "axis-container", AXIS_ELEMENT_NAME.labelContainer = "axis-label-container", AXIS_ELEMENT_NAME.tickContainer = "axis-tick-container", AXIS_ELEMENT_NAME.tick = "axis-tick", AXIS_ELEMENT_NAME.subTick = "axis-sub-tick", AXIS_ELEMENT_NAME.label = "axis-label", AXIS_ELEMENT_NAME.title = "axis-title", AXIS_ELEMENT_NAME.labelHoverOnAxis = "axis-label-hover-on-axis", AXIS_ELEMENT_NAME.gridContainer = "axis-grid-container", AXIS_ELEMENT_NAME.grid = "axis-grid", AXIS_ELEMENT_NAME.gridRegion = "axis-grid-region", AXIS_ELEMENT_NAME.line = "axis-line", AXIS_ELEMENT_NAME.background = "axis-background", AXIS_ELEMENT_NAME.axisLabelBackground = "axis-label-background", AXIS_ELEMENT_NAME.axisBreak = "axis-break", AXIS_ELEMENT_NAME.axisBreakSymbol = "axis-break-symbol";
|
|
39334
39334
|
}(exports.AXIS_ELEMENT_NAME || (exports.AXIS_ELEMENT_NAME = {}));
|
|
39335
39335
|
exports.AxisStateValue = void 0;
|
|
39336
39336
|
!function (AxisStateValue) {
|
|
@@ -39367,6 +39367,26 @@
|
|
|
39367
39367
|
fillOpacity: 1
|
|
39368
39368
|
}
|
|
39369
39369
|
},
|
|
39370
|
+
labelHoverOnAxis: {
|
|
39371
|
+
visible: !1,
|
|
39372
|
+
space: 7,
|
|
39373
|
+
padding: 2,
|
|
39374
|
+
position: 0,
|
|
39375
|
+
autoRotate: !1,
|
|
39376
|
+
textStyle: {
|
|
39377
|
+
fontSize: 12,
|
|
39378
|
+
fill: "red",
|
|
39379
|
+
fontWeight: "normal",
|
|
39380
|
+
fillOpacity: 1
|
|
39381
|
+
},
|
|
39382
|
+
background: {
|
|
39383
|
+
visible: !0,
|
|
39384
|
+
style: {
|
|
39385
|
+
cornerRadius: 2,
|
|
39386
|
+
fill: "black"
|
|
39387
|
+
}
|
|
39388
|
+
}
|
|
39389
|
+
},
|
|
39370
39390
|
tick: {
|
|
39371
39391
|
visible: !0,
|
|
39372
39392
|
inside: !1,
|
|
@@ -40358,7 +40378,17 @@
|
|
|
40358
40378
|
loadLineAxisComponent();
|
|
40359
40379
|
class LineAxis extends AxisBase {
|
|
40360
40380
|
constructor(attributes, options) {
|
|
40361
|
-
|
|
40381
|
+
var _a;
|
|
40382
|
+
if (attributes.labelHoverOnAxis && (attributes.labelHoverOnAxis.textStyle = Object.assign({}, attributes.label.style, attributes.labelHoverOnAxis.textStyle), void 0 === attributes.labelHoverOnAxis.space)) {
|
|
40383
|
+
const {
|
|
40384
|
+
padding = 2
|
|
40385
|
+
} = attributes.labelHoverOnAxis,
|
|
40386
|
+
parsedPadding = normalizePadding(padding),
|
|
40387
|
+
toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3],
|
|
40388
|
+
space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis.defaultAttributes.label.space) - toDiffPadding;
|
|
40389
|
+
attributes.labelHoverOnAxis.space = space;
|
|
40390
|
+
}
|
|
40391
|
+
super((null == options ? void 0 : options.skipDefault) ? attributes : merge({}, LineAxis.defaultAttributes, attributes), options), this.labelHoverOnAxisGroup = null;
|
|
40362
40392
|
}
|
|
40363
40393
|
_renderInner(container) {
|
|
40364
40394
|
var _a;
|
|
@@ -40420,6 +40450,15 @@
|
|
|
40420
40450
|
}, panel.style));
|
|
40421
40451
|
bgRect.name = exports.AXIS_ELEMENT_NAME.background, bgRect.id = this._getNodeId("background"), bgRect.states = merge({}, DEFAULT_STATES$1, null !== (_a = panel.state) && void 0 !== _a ? _a : {}), axisContainer.insertBefore(bgRect, axisContainer.firstChild);
|
|
40422
40452
|
}
|
|
40453
|
+
const {
|
|
40454
|
+
labelHoverOnAxis: labelHoverOnAxis
|
|
40455
|
+
} = this.attribute;
|
|
40456
|
+
labelHoverOnAxis && labelHoverOnAxis.visible && this.renderLabelHoverOnAxis();
|
|
40457
|
+
}
|
|
40458
|
+
renderLabelHoverOnAxis() {
|
|
40459
|
+
const hoverOnLabelAttributes = this.getLabelHoverOnAxisAttribute(),
|
|
40460
|
+
hoverOnLabel = new Tag(Object.assign({}, hoverOnLabelAttributes));
|
|
40461
|
+
hoverOnLabel.name = exports.AXIS_ELEMENT_NAME.title, hoverOnLabel.id = this._getNodeId("hover-on-label"), this.labelHoverOnAxisGroup = hoverOnLabel, this.axisContainer.add(hoverOnLabel);
|
|
40423
40462
|
}
|
|
40424
40463
|
renderLine(container) {
|
|
40425
40464
|
const {
|
|
@@ -40560,6 +40599,66 @@
|
|
|
40560
40599
|
visible: !0
|
|
40561
40600
|
}, background.style)), attrs;
|
|
40562
40601
|
}
|
|
40602
|
+
getLabelHoverOnAxisAttribute() {
|
|
40603
|
+
var _a, _b;
|
|
40604
|
+
const {
|
|
40605
|
+
orient: orient
|
|
40606
|
+
} = this.attribute,
|
|
40607
|
+
_c = this.attribute.labelHoverOnAxis,
|
|
40608
|
+
{
|
|
40609
|
+
position = 0,
|
|
40610
|
+
space = 4,
|
|
40611
|
+
autoRotate = !0,
|
|
40612
|
+
textStyle = {},
|
|
40613
|
+
background = {},
|
|
40614
|
+
formatMethod: formatMethod,
|
|
40615
|
+
text: textContent = "",
|
|
40616
|
+
maxWidth: maxWidth
|
|
40617
|
+
} = _c,
|
|
40618
|
+
restAttrs = __rest$b(_c, ["position", "space", "autoRotate", "textStyle", "background", "formatMethod", "text", "maxWidth"]),
|
|
40619
|
+
point = this.getTickCoord(0);
|
|
40620
|
+
"bottom" === orient || "top" === orient ? point.x = position : point.y = position;
|
|
40621
|
+
let tickLength = 0;
|
|
40622
|
+
(null === (_a = this.attribute.tick) || void 0 === _a ? void 0 : _a.visible) && !1 === this.attribute.tick.inside && (tickLength = this.attribute.tick.length || 4), (null === (_b = this.attribute.subTick) || void 0 === _b ? void 0 : _b.visible) && !1 === this.attribute.subTick.inside && (tickLength = Math.max(tickLength, this.attribute.subTick.length || 2));
|
|
40623
|
+
const offset = tickLength + 0 + space,
|
|
40624
|
+
labelPoint = this.getVerticalCoord(point, offset, !1),
|
|
40625
|
+
vector = this.getVerticalVector(offset, !1, {
|
|
40626
|
+
x: 0,
|
|
40627
|
+
y: 0
|
|
40628
|
+
});
|
|
40629
|
+
let textBaseline,
|
|
40630
|
+
{
|
|
40631
|
+
angle: angle
|
|
40632
|
+
} = restAttrs,
|
|
40633
|
+
textAlign = "center";
|
|
40634
|
+
if (isNil$1(angle) && autoRotate) {
|
|
40635
|
+
const axisVector = this.getRelativeVector();
|
|
40636
|
+
angle = angleTo(axisVector, [1, 0], !0);
|
|
40637
|
+
const {
|
|
40638
|
+
verticalFactor = 1
|
|
40639
|
+
} = this.attribute;
|
|
40640
|
+
textBaseline = 1 === -1 * verticalFactor ? "bottom" : "top";
|
|
40641
|
+
} else {
|
|
40642
|
+
const {
|
|
40643
|
+
textAlign: textAlign2,
|
|
40644
|
+
textBaseline: textBaseline2
|
|
40645
|
+
} = this.getLabelAlign(vector, !1, textStyle.angle);
|
|
40646
|
+
textAlign = textAlign2, textBaseline = textBaseline2;
|
|
40647
|
+
}
|
|
40648
|
+
const maxTagWidth = maxWidth,
|
|
40649
|
+
text = formatMethod ? formatMethod(textContent) : textContent,
|
|
40650
|
+
attrs = Object.assign(Object.assign(Object.assign({}, labelPoint), restAttrs), {
|
|
40651
|
+
maxWidth: maxTagWidth,
|
|
40652
|
+
textStyle: Object.assign({
|
|
40653
|
+
textAlign: textAlign,
|
|
40654
|
+
textBaseline: textBaseline
|
|
40655
|
+
}, textStyle),
|
|
40656
|
+
text: text
|
|
40657
|
+
});
|
|
40658
|
+
return attrs.angle = angle, background && background.visible && (attrs.panel = Object.assign(Object.assign({
|
|
40659
|
+
visible: !0
|
|
40660
|
+
}, restAttrs.panel), background.style)), attrs;
|
|
40661
|
+
}
|
|
40563
40662
|
getTextBaseline(vector, inside) {
|
|
40564
40663
|
let base = "middle";
|
|
40565
40664
|
const {
|
|
@@ -40750,6 +40849,41 @@
|
|
|
40750
40849
|
}
|
|
40751
40850
|
return limitLength && (limitLength = (limitLength - labelSpace - titleSpacing - titleHeight - axisLineWidth - tickLength) / layerCount), limitLength;
|
|
40752
40851
|
}
|
|
40852
|
+
showLabelHoverOnAxis(position, text) {
|
|
40853
|
+
let adjustPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0;
|
|
40854
|
+
if (this.attribute.labelHoverOnAxis) {
|
|
40855
|
+
const preContainerBounds = this.axisContainer.AABBBounds,
|
|
40856
|
+
preWidth = preContainerBounds.width(),
|
|
40857
|
+
preHeight = preContainerBounds.height(),
|
|
40858
|
+
preX1 = preContainerBounds.x1,
|
|
40859
|
+
preY1 = preContainerBounds.y1,
|
|
40860
|
+
preX2 = preContainerBounds.x2,
|
|
40861
|
+
preY2 = preContainerBounds.y2;
|
|
40862
|
+
if (this.labelHoverOnAxisGroup) {
|
|
40863
|
+
const {
|
|
40864
|
+
formatMethod: formatMethod
|
|
40865
|
+
} = this.attribute.labelHoverOnAxis,
|
|
40866
|
+
textStr = formatMethod ? formatMethod(text) : text;
|
|
40867
|
+
this.labelHoverOnAxisGroup.setAttribute("text", textStr), this.labelHoverOnAxisGroup.setAttribute("visible", !0), this.labelHoverOnAxisGroup.setAttribute("visibleAll", !0), "left" === this.attribute.orient || "right" === this.attribute.orient ? this.labelHoverOnAxisGroup.setAttributes({
|
|
40868
|
+
y: position
|
|
40869
|
+
}) : this.labelHoverOnAxisGroup.setAttributes({
|
|
40870
|
+
x: position
|
|
40871
|
+
});
|
|
40872
|
+
} else this.attribute.labelHoverOnAxis.visible = !0, this.attribute.labelHoverOnAxis.position = position, this.attribute.labelHoverOnAxis.text = text, this.renderLabelHoverOnAxis();
|
|
40873
|
+
if (adjustPosition) {
|
|
40874
|
+
const afterContainerBounds = this.axisContainer.AABBBounds,
|
|
40875
|
+
diffWidth = afterContainerBounds.width() - preWidth,
|
|
40876
|
+
diffHeight = afterContainerBounds.height() - preHeight;
|
|
40877
|
+
diffWidth > 0 && ("top" === this.attribute.orient || "bottom" === this.attribute.orient) && (afterContainerBounds.x1 < preX1 ? this.showLabelHoverOnAxis(position + diffWidth, text, !1) : afterContainerBounds.x2 > preX2 && this.showLabelHoverOnAxis(position - diffWidth, text, !1)), diffHeight > 0 && ("left" === this.attribute.orient || "right" === this.attribute.orient) && (afterContainerBounds.y1 < preY1 ? this.showLabelHoverOnAxis(position + diffHeight, text, !1) : afterContainerBounds.y2 > preY2 && this.showLabelHoverOnAxis(position - diffHeight, text, !1));
|
|
40878
|
+
}
|
|
40879
|
+
}
|
|
40880
|
+
}
|
|
40881
|
+
hideLabelHoverOnAxis() {
|
|
40882
|
+
this.attribute.labelHoverOnAxis && this.labelHoverOnAxisGroup && this.labelHoverOnAxisGroup.setAttributes({
|
|
40883
|
+
visible: !1,
|
|
40884
|
+
visibleAll: !1
|
|
40885
|
+
});
|
|
40886
|
+
}
|
|
40753
40887
|
release() {
|
|
40754
40888
|
super.release(), this._breaks = null;
|
|
40755
40889
|
}
|
|
@@ -52824,7 +52958,7 @@
|
|
|
52824
52958
|
select: !0
|
|
52825
52959
|
};
|
|
52826
52960
|
|
|
52827
|
-
const version = "1.0.
|
|
52961
|
+
const version = "1.0.27-alpha.0";
|
|
52828
52962
|
preLoadAllModule();
|
|
52829
52963
|
if (isBrowserEnv()) {
|
|
52830
52964
|
loadBrowserEnv(container);
|