@visactor/vrender-components 0.13.2-alpha.1 → 0.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/axis/line.js +8 -2
- package/cjs/axis/line.js.map +1 -1
- package/cjs/core/type.js +1 -2
- package/cjs/crosshair/circle.js +2 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/pager/index.js +1 -1
- package/cjs/pager/pager.js +1 -1
- package/cjs/poptip/contribution.js +26 -10
- package/cjs/poptip/contribution.js.map +1 -1
- package/cjs/poptip/index.js +1 -1
- package/cjs/poptip/poptip-plugin.d.ts +13 -0
- package/cjs/poptip/poptip-plugin.js +39 -5
- package/cjs/poptip/poptip-plugin.js.map +1 -1
- package/cjs/poptip/register.d.ts +2 -1
- package/cjs/poptip/register.js +7 -6
- package/cjs/poptip/register.js.map +1 -1
- package/cjs/poptip/theme.d.ts +4 -0
- package/cjs/poptip/theme.js +26 -0
- package/cjs/poptip/theme.js.map +1 -0
- package/dist/index.js +131 -15
- package/dist/index.min.js +1 -1
- package/es/axis/line.js +8 -2
- package/es/axis/line.js.map +1 -1
- package/es/core/type.js +1 -2
- package/es/crosshair/circle.js +2 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/pager/index.js +1 -1
- package/es/pager/pager.js +1 -1
- package/es/poptip/contribution.js +29 -9
- package/es/poptip/contribution.js.map +1 -1
- package/es/poptip/index.js +1 -1
- package/es/poptip/poptip-plugin.d.ts +13 -0
- package/es/poptip/poptip-plugin.js +39 -4
- package/es/poptip/poptip-plugin.js.map +1 -1
- package/es/poptip/register.d.ts +2 -1
- package/es/poptip/register.js +9 -4
- package/es/poptip/register.js.map +1 -1
- package/es/poptip/theme.d.ts +4 -0
- package/es/poptip/theme.js +22 -0
- package/es/poptip/theme.js.map +1 -0
- package/package.json +4 -4
- package/dist/vrender-components.js.js +0 -1
- package/dist/vrender-components.js.min.js +0 -1
package/dist/index.js
CHANGED
|
@@ -875,27 +875,70 @@
|
|
|
875
875
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
876
876
|
};
|
|
877
877
|
|
|
878
|
+
const theme = {
|
|
879
|
+
poptip: {
|
|
880
|
+
visible: true,
|
|
881
|
+
position: 'top',
|
|
882
|
+
titleStyle: {
|
|
883
|
+
fontSize: 16,
|
|
884
|
+
fill: '#08979c'
|
|
885
|
+
},
|
|
886
|
+
contentStyle: {
|
|
887
|
+
fontSize: 12,
|
|
888
|
+
fill: 'green'
|
|
889
|
+
},
|
|
890
|
+
panel: {
|
|
891
|
+
visible: true,
|
|
892
|
+
fill: '#e6fffb',
|
|
893
|
+
stroke: '#87e8de',
|
|
894
|
+
lineWidth: 1,
|
|
895
|
+
cornerRadius: 4
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
};
|
|
899
|
+
|
|
900
|
+
function wrapPoptip(target, source) {
|
|
901
|
+
vutils.merge(target, theme.poptip, source);
|
|
902
|
+
return target;
|
|
903
|
+
}
|
|
878
904
|
let PopTipRenderContribution = class PopTipRenderContribution {
|
|
879
905
|
render(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, options) {
|
|
880
|
-
if (graphic._showPoptip) {
|
|
881
|
-
const { visible, visibleCb } = graphic.attribute.poptip;
|
|
906
|
+
if (graphic._showPoptip === 1) {
|
|
907
|
+
const { visible, visibleCb } = graphic.attribute.poptip || {};
|
|
882
908
|
if (visible === false || (visibleCb && visibleCb(graphic) === false)) {
|
|
883
909
|
return;
|
|
884
910
|
}
|
|
885
911
|
if (!this.poptipComponent) {
|
|
886
912
|
this.poptipComponent = new PopTip(graphic.attribute.poptip);
|
|
887
913
|
}
|
|
914
|
+
let poptip = graphic.attribute.poptip || {};
|
|
915
|
+
if (graphic.type === 'text' && poptip.title == null && poptip.content == null) {
|
|
916
|
+
const out = {};
|
|
917
|
+
wrapPoptip(out, poptip);
|
|
918
|
+
poptip = out;
|
|
919
|
+
poptip.content = poptip.content ?? graphic.attribute.text;
|
|
920
|
+
}
|
|
921
|
+
const matrix = graphic.globalTransMatrix;
|
|
888
922
|
this.poptipComponent.setAttributes({
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
923
|
+
visibleAll: true,
|
|
924
|
+
pickable: false,
|
|
925
|
+
childrenPickable: false,
|
|
926
|
+
...poptip,
|
|
927
|
+
x: matrix.e,
|
|
928
|
+
y: matrix.f
|
|
893
929
|
});
|
|
894
930
|
const interactiveLayer = drawContext.stage.getLayer('_builtin_interactive');
|
|
895
931
|
if (interactiveLayer) {
|
|
896
932
|
interactiveLayer.add(this.poptipComponent);
|
|
897
933
|
}
|
|
898
934
|
}
|
|
935
|
+
else if (graphic._showPoptip === 2) {
|
|
936
|
+
graphic._showPoptip = 0;
|
|
937
|
+
this.poptipComponent &&
|
|
938
|
+
this.poptipComponent.setAttributes({
|
|
939
|
+
visibleAll: false
|
|
940
|
+
});
|
|
941
|
+
}
|
|
899
942
|
}
|
|
900
943
|
};
|
|
901
944
|
PopTipRenderContribution = __decorate([
|
|
@@ -916,16 +959,21 @@
|
|
|
916
959
|
}
|
|
917
960
|
poptip = (e) => {
|
|
918
961
|
const graphic = e.target;
|
|
919
|
-
if (graphic.isContainer || !graphic.attribute
|
|
962
|
+
if (graphic.isContainer || !graphic.attribute) {
|
|
920
963
|
this.unpoptip(e);
|
|
921
964
|
return;
|
|
922
965
|
}
|
|
966
|
+
if (graphic === this.activeGraphic) {
|
|
967
|
+
return;
|
|
968
|
+
}
|
|
923
969
|
const { poptip } = graphic.attribute;
|
|
924
970
|
if (poptip) {
|
|
925
|
-
graphic.
|
|
971
|
+
graphic.setAttributes({});
|
|
972
|
+
graphic._showPoptip = 1;
|
|
926
973
|
}
|
|
927
974
|
if (this.activeGraphic) {
|
|
928
|
-
this.activeGraphic.
|
|
975
|
+
this.activeGraphic.setAttributes({});
|
|
976
|
+
this.activeGraphic._showPoptip = 2;
|
|
929
977
|
}
|
|
930
978
|
this.setActiveGraphic(graphic, true);
|
|
931
979
|
};
|
|
@@ -933,7 +981,8 @@
|
|
|
933
981
|
if (!this.activeGraphic) {
|
|
934
982
|
return;
|
|
935
983
|
}
|
|
936
|
-
this.activeGraphic.
|
|
984
|
+
this.activeGraphic.setAttributes({});
|
|
985
|
+
this.activeGraphic._showPoptip = 2;
|
|
937
986
|
this.setActiveGraphic(null, true);
|
|
938
987
|
};
|
|
939
988
|
setActiveGraphic(graphic, rerender) {
|
|
@@ -948,14 +997,69 @@
|
|
|
948
997
|
PopTipPlugin = __decorate([
|
|
949
998
|
injectable()
|
|
950
999
|
], PopTipPlugin);
|
|
1000
|
+
let PopTipForClipedTextPlugin = class PopTipForClipedTextPlugin {
|
|
1001
|
+
name = 'poptipForText';
|
|
1002
|
+
activeEvent = 'onRegister';
|
|
1003
|
+
pluginService;
|
|
1004
|
+
_uid = vrender.Generator.GenAutoIncrementId();
|
|
1005
|
+
key = this.name + this._uid;
|
|
1006
|
+
activeGraphic;
|
|
1007
|
+
activate(context) {
|
|
1008
|
+
this.pluginService = context;
|
|
1009
|
+
const { stage } = this.pluginService;
|
|
1010
|
+
stage.addEventListener('pointerover', this.poptip);
|
|
1011
|
+
}
|
|
1012
|
+
poptip = (e) => {
|
|
1013
|
+
const graphic = e.target;
|
|
1014
|
+
if (graphic.type !== 'text' || !graphic.cliped || graphic.isContainer || !graphic.attribute) {
|
|
1015
|
+
this.unpoptip(e);
|
|
1016
|
+
return;
|
|
1017
|
+
}
|
|
1018
|
+
if (graphic === this.activeGraphic) {
|
|
1019
|
+
return;
|
|
1020
|
+
}
|
|
1021
|
+
const { poptip = {} } = graphic.attribute;
|
|
1022
|
+
if (poptip) {
|
|
1023
|
+
graphic.setAttributes({});
|
|
1024
|
+
graphic._showPoptip = 1;
|
|
1025
|
+
}
|
|
1026
|
+
if (this.activeGraphic) {
|
|
1027
|
+
this.activeGraphic.setAttributes({});
|
|
1028
|
+
this.activeGraphic._showPoptip = 2;
|
|
1029
|
+
}
|
|
1030
|
+
this.setActiveGraphic(graphic, true);
|
|
1031
|
+
};
|
|
1032
|
+
unpoptip = (e) => {
|
|
1033
|
+
if (!this.activeGraphic) {
|
|
1034
|
+
return;
|
|
1035
|
+
}
|
|
1036
|
+
this.activeGraphic.setAttributes({});
|
|
1037
|
+
this.activeGraphic._showPoptip = 2;
|
|
1038
|
+
this.setActiveGraphic(null, true);
|
|
1039
|
+
};
|
|
1040
|
+
setActiveGraphic(graphic, rerender) {
|
|
1041
|
+
this.activeGraphic = graphic;
|
|
1042
|
+
this.pluginService.stage.renderNextFrame();
|
|
1043
|
+
}
|
|
1044
|
+
deactivate(context) {
|
|
1045
|
+
const { stage } = this.pluginService;
|
|
1046
|
+
stage.removeEventListener('pointerover', this.poptip);
|
|
1047
|
+
}
|
|
1048
|
+
};
|
|
1049
|
+
PopTipForClipedTextPlugin = __decorate([
|
|
1050
|
+
injectable()
|
|
1051
|
+
], PopTipForClipedTextPlugin);
|
|
951
1052
|
|
|
952
1053
|
const module = new ContainerModule(bind => {
|
|
953
1054
|
bind(PopTipRenderContribution).toSelf().inSingletonScope();
|
|
954
1055
|
bind(vrender.InteractiveSubRenderContribution).toService(PopTipRenderContribution);
|
|
955
1056
|
bind(PopTipPlugin).toSelf().inSingletonScope();
|
|
956
1057
|
bind(vrender.AutoEnablePlugins).toService(PopTipPlugin);
|
|
1058
|
+
bind(PopTipForClipedTextPlugin).toSelf().inSingletonScope();
|
|
1059
|
+
bind(vrender.AutoEnablePlugins).toService(PopTipForClipedTextPlugin);
|
|
957
1060
|
});
|
|
958
|
-
function
|
|
1061
|
+
function loadPoptip(defaultPoptipTheme) {
|
|
1062
|
+
vutils.merge(theme.poptip, defaultPoptipTheme);
|
|
959
1063
|
vrender.container.load(module);
|
|
960
1064
|
}
|
|
961
1065
|
|
|
@@ -3209,11 +3313,23 @@
|
|
|
3209
3313
|
labelLength += space;
|
|
3210
3314
|
const layerCount = Object.keys(this.axisLabelLayerSize).length;
|
|
3211
3315
|
if (axisVector[1] === 0) {
|
|
3212
|
-
|
|
3316
|
+
const labelBoundsHeight = this.axisLabelsContainer.AABBBounds.height();
|
|
3317
|
+
if (isFinite(labelBoundsHeight)) {
|
|
3318
|
+
labelLength += labelBoundsHeight + (layerCount - 1) * space;
|
|
3319
|
+
}
|
|
3320
|
+
else {
|
|
3321
|
+
labelLength = 0;
|
|
3322
|
+
}
|
|
3213
3323
|
}
|
|
3214
3324
|
else {
|
|
3215
3325
|
if (axisVector[0] === 0) {
|
|
3216
|
-
|
|
3326
|
+
const boundsWidth = this.axisLabelsContainer.AABBBounds.width();
|
|
3327
|
+
if (isFinite(boundsWidth)) {
|
|
3328
|
+
labelLength += boundsWidth + (layerCount - 1) * space;
|
|
3329
|
+
}
|
|
3330
|
+
else {
|
|
3331
|
+
labelLength = 0;
|
|
3332
|
+
}
|
|
3217
3333
|
}
|
|
3218
3334
|
else {
|
|
3219
3335
|
Object.keys(this.axisLabelLayerSize).forEach((layer, index) => {
|
|
@@ -9311,7 +9427,7 @@
|
|
|
9311
9427
|
}
|
|
9312
9428
|
}
|
|
9313
9429
|
|
|
9314
|
-
const version = "0.13.2
|
|
9430
|
+
const version = "0.13.2";
|
|
9315
9431
|
|
|
9316
9432
|
exports.AbstractComponent = AbstractComponent;
|
|
9317
9433
|
exports.BasePlayer = BasePlayer;
|
|
@@ -9360,10 +9476,10 @@
|
|
|
9360
9476
|
exports.Tag = Tag;
|
|
9361
9477
|
exports.Title = Title;
|
|
9362
9478
|
exports.Tooltip = Tooltip;
|
|
9363
|
-
exports.enablePoptip = enablePoptip;
|
|
9364
9479
|
exports.getHorizontalPath = getHorizontalPath;
|
|
9365
9480
|
exports.getSizeHandlerPath = getSizeHandlerPath;
|
|
9366
9481
|
exports.getVerticalPath = getVerticalPath;
|
|
9482
|
+
exports.loadPoptip = loadPoptip;
|
|
9367
9483
|
exports.module = module;
|
|
9368
9484
|
exports.version = version;
|
|
9369
9485
|
|