@visactor/vrender-components 0.13.2 → 0.13.3-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.
- package/cjs/axis/base.js +31 -23
- package/cjs/axis/base.js.map +1 -1
- package/cjs/axis/overlap/auto-limit.js +1 -1
- package/cjs/axis/overlap/auto-limit.js.map +1 -1
- package/cjs/axis/type.d.ts +3 -3
- package/cjs/axis/type.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/legend/discrete/discrete.d.ts +1 -0
- package/cjs/legend/discrete/discrete.js +17 -7
- package/cjs/legend/discrete/discrete.js.map +1 -1
- package/cjs/legend/discrete/type.d.ts +9 -8
- package/cjs/legend/discrete/type.js.map +1 -1
- package/cjs/poptip/poptip.d.ts +1 -0
- package/cjs/poptip/poptip.js +40 -31
- package/cjs/poptip/poptip.js.map +1 -1
- package/cjs/poptip/register.d.ts +2 -1
- package/cjs/poptip/register.js +8 -4
- package/cjs/poptip/register.js.map +1 -1
- package/cjs/poptip/theme.d.ts +1 -0
- package/cjs/poptip/theme.js +24 -18
- package/cjs/poptip/theme.js.map +1 -1
- package/cjs/poptip/type.d.ts +4 -2
- package/cjs/poptip/type.js.map +1 -1
- package/dist/index.js +148 -73
- package/dist/index.min.js +1 -1
- package/es/axis/base.js +29 -20
- package/es/axis/base.js.map +1 -1
- package/es/axis/overlap/auto-limit.js +1 -1
- package/es/axis/overlap/auto-limit.js.map +1 -1
- package/es/axis/type.d.ts +3 -3
- package/es/axis/type.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/legend/discrete/discrete.d.ts +1 -0
- package/es/legend/discrete/discrete.js +18 -7
- package/es/legend/discrete/discrete.js.map +1 -1
- package/es/legend/discrete/type.d.ts +9 -8
- package/es/legend/discrete/type.js.map +1 -1
- package/es/poptip/poptip.d.ts +1 -0
- package/es/poptip/poptip.js +38 -31
- package/es/poptip/poptip.js.map +1 -1
- package/es/poptip/register.d.ts +2 -1
- package/es/poptip/register.js +7 -3
- package/es/poptip/register.js.map +1 -1
- package/es/poptip/theme.d.ts +1 -0
- package/es/poptip/theme.js +24 -18
- package/es/poptip/theme.js.map +1 -1
- package/es/poptip/type.d.ts +4 -2
- package/es/poptip/type.js.map +1 -1
- package/package.json +4 -4
package/cjs/poptip/theme.js
CHANGED
|
@@ -2,25 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: !0
|
|
5
|
-
}), exports.theme =
|
|
6
|
-
|
|
5
|
+
}), exports.theme = exports.DEFAULT_THEME = void 0;
|
|
6
|
+
|
|
7
|
+
const vutils_1 = require("@visactor/vutils");
|
|
8
|
+
|
|
9
|
+
exports.DEFAULT_THEME = {
|
|
10
|
+
visible: !0,
|
|
11
|
+
position: "auto",
|
|
12
|
+
titleStyle: {
|
|
13
|
+
fontSize: 16,
|
|
14
|
+
fill: "#08979c"
|
|
15
|
+
},
|
|
16
|
+
contentStyle: {
|
|
17
|
+
fontSize: 12,
|
|
18
|
+
fill: "green"
|
|
19
|
+
},
|
|
20
|
+
panel: {
|
|
7
21
|
visible: !0,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
fontSize: 12,
|
|
15
|
-
fill: "green"
|
|
16
|
-
},
|
|
17
|
-
panel: {
|
|
18
|
-
visible: !0,
|
|
19
|
-
fill: "#e6fffb",
|
|
20
|
-
stroke: "#87e8de",
|
|
21
|
-
lineWidth: 1,
|
|
22
|
-
cornerRadius: 4
|
|
23
|
-
}
|
|
22
|
+
fill: "#e6fffb",
|
|
23
|
+
size: 12,
|
|
24
|
+
space: 0,
|
|
25
|
+
stroke: "#87e8de",
|
|
26
|
+
lineWidth: 1,
|
|
27
|
+
cornerRadius: 4
|
|
24
28
|
}
|
|
29
|
+
}, exports.theme = {
|
|
30
|
+
poptip: (0, vutils_1.merge)({}, exports.DEFAULT_THEME)
|
|
25
31
|
};
|
|
26
32
|
//# sourceMappingURL=theme.js.map
|
package/cjs/poptip/theme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["poptip/theme.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"sources":["poptip/theme.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AAG5B,QAAA,aAAa,GAAqB;IAC7C,OAAO,EAAE,IAAI;IACb,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE;QACZ,IAAI,EAAE,SAAS;KAChB;IACD,YAAY,EAAE;QACZ,QAAQ,EAAE,EAAE;QACZ,IAAI,EAAE,OAAO;KACd;IACD,KAAK,EAAE;QACL,OAAO,EAAE,IAAI;QAEb,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,EAAE;QACR,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,SAAS;QACjB,SAAS,EAAE,CAAC;QACZ,YAAY,EAAE,CAAC;KAChB;CACF,CAAC;AAEW,QAAA,KAAK,GAAiC;IACjD,MAAM,EAAE,IAAA,cAAK,EAAC,EAAE,EAAE,qBAAa,CAAC;CACjC,CAAC","file":"theme.js","sourcesContent":["import { merge } from '@visactor/vutils';\nimport type { PopTipAttributes } from './type';\n\nexport const DEFAULT_THEME: PopTipAttributes = {\n visible: true,\n position: 'auto',\n titleStyle: {\n fontSize: 16,\n fill: '#08979c'\n },\n contentStyle: {\n fontSize: 12,\n fill: 'green'\n },\n panel: {\n visible: true,\n\n fill: '#e6fffb',\n size: 12,\n space: 0,\n stroke: '#87e8de',\n lineWidth: 1,\n cornerRadius: 4\n }\n};\n\nexport const theme: { poptip: PopTipAttributes } = {\n poptip: merge({}, DEFAULT_THEME)\n};\n"]}
|
package/cjs/poptip/type.d.ts
CHANGED
|
@@ -7,14 +7,16 @@ type StateStyle = {
|
|
|
7
7
|
panel?: State<Partial<IRectGraphicAttribute>>;
|
|
8
8
|
};
|
|
9
9
|
export type PopTipAttributes = {
|
|
10
|
-
position?: 'top' | 'tl' | 'tr' | 'bottom' | 'bl' | 'br' | 'left' | 'lt' | 'lb' | 'right' | 'rt' | 'rb';
|
|
10
|
+
position?: 'auto' | 'top' | 'tl' | 'tr' | 'bottom' | 'bl' | 'br' | 'left' | 'lt' | 'lb' | 'right' | 'rt' | 'rb';
|
|
11
11
|
title?: string | string[] | number | number[];
|
|
12
12
|
titleStyle?: Partial<ITextGraphicAttribute>;
|
|
13
13
|
content?: string | string[] | number | number[];
|
|
14
14
|
contentStyle?: Partial<ITextGraphicAttribute>;
|
|
15
15
|
space?: number;
|
|
16
16
|
padding?: Padding;
|
|
17
|
-
panel?: BackgroundAttributes & ISymbolGraphicAttribute
|
|
17
|
+
panel?: BackgroundAttributes & ISymbolGraphicAttribute & {
|
|
18
|
+
space?: number;
|
|
19
|
+
};
|
|
18
20
|
minWidth?: number;
|
|
19
21
|
maxWidth?: number;
|
|
20
22
|
visible?: boolean;
|
package/cjs/poptip/type.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["poptip/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type {\n IGraphic,\n IGroupGraphicAttribute,\n IRectGraphicAttribute,\n ISymbolGraphicAttribute,\n ITextGraphicAttribute\n} from '@visactor/vrender';\nimport type { Padding, State } from '../core/type';\nimport type { BackgroundAttributes } from '../interface';\n\ntype StateStyle = {\n /**\n * title 文本的状态配置\n */\n title?: State<Partial<ITextGraphicAttribute>>;\n /**\n * content 文本的状态配置\n */\n content?: State<Partial<ITextGraphicAttribute>>;\n /**\n * panel 背景的状态配置ß\n */\n panel?: State<Partial<IRectGraphicAttribute>>;\n};\n\nexport type PopTipAttributes = {\n /** 位置,参考arco design */\n position?: 'top' | 'tl' | 'tr' | 'bottom' | 'bl' | 'br' | 'left' | 'lt' | 'lb' | 'right' | 'rt' | 'rb';\n /**\n * 标题内容,如果需要进行换行,则使用数组形式,如 ['abc', '123']\n */\n title?: string | string[] | number | number[];\n /** 标题样式 */\n titleStyle?: Partial<ITextGraphicAttribute>;\n /**\n * 内容文本,如果需要进行换行,则使用数组形式,如 ['abc', '123']\n */\n content?: string | string[] | number | number[];\n /** 内容文本样式 */\n contentStyle?: Partial<ITextGraphicAttribute>;\n /**\n * 标题与内容的间距\n */\n space?: number;\n /**\n * 内部边距\n */\n padding?: Padding;\n /**\n * 标签的背景面板配置, TODO: 支持symbol形状\n */\n panel?: BackgroundAttributes & ISymbolGraphicAttribute;\n\n /**\n * 最小宽度,像素值\n * @default 30\n */\n minWidth?: number;\n /**\n * 最大宽度,像素值。当文字超过最大宽度时,会自动省略。\n */\n maxWidth?: number;\n\n visible?: boolean;\n visibleFunc?: (graphic: IGraphic) => boolean;\n state?: StateStyle;\n dx?: number;\n dy?: number;\n} & Omit<IGroupGraphicAttribute, 'background'>;\n\nexport type PoptipShapeAttributes = {\n /**\n * 是否展示 shape\n */\n visible: boolean;\n} & Partial<ISymbolGraphicAttribute>;\n"]}
|
|
1
|
+
{"version":3,"sources":["poptip/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type {\n IGraphic,\n IGroupGraphicAttribute,\n IRectGraphicAttribute,\n ISymbolGraphicAttribute,\n ITextGraphicAttribute\n} from '@visactor/vrender';\nimport type { Padding, State } from '../core/type';\nimport type { BackgroundAttributes } from '../interface';\n\ntype StateStyle = {\n /**\n * title 文本的状态配置\n */\n title?: State<Partial<ITextGraphicAttribute>>;\n /**\n * content 文本的状态配置\n */\n content?: State<Partial<ITextGraphicAttribute>>;\n /**\n * panel 背景的状态配置ß\n */\n panel?: State<Partial<IRectGraphicAttribute>>;\n};\n\nexport type PopTipAttributes = {\n /** 位置,参考arco design */\n position?: 'auto' | 'top' | 'tl' | 'tr' | 'bottom' | 'bl' | 'br' | 'left' | 'lt' | 'lb' | 'right' | 'rt' | 'rb';\n /**\n * 标题内容,如果需要进行换行,则使用数组形式,如 ['abc', '123']\n */\n title?: string | string[] | number | number[];\n /** 标题样式 */\n titleStyle?: Partial<ITextGraphicAttribute>;\n /**\n * 内容文本,如果需要进行换行,则使用数组形式,如 ['abc', '123']\n */\n content?: string | string[] | number | number[];\n /** 内容文本样式 */\n contentStyle?: Partial<ITextGraphicAttribute>;\n /**\n * 标题与内容的间距\n */\n space?: number;\n /**\n * 内部边距\n */\n padding?: Padding;\n /**\n * 标签的背景面板配置, TODO: 支持symbol形状\n */\n panel?: BackgroundAttributes & ISymbolGraphicAttribute & { space?: number };\n\n /**\n * 最小宽度,像素值\n * @default 30\n */\n minWidth?: number;\n /**\n * 最大宽度,像素值。当文字超过最大宽度时,会自动省略。\n */\n maxWidth?: number;\n\n visible?: boolean;\n visibleFunc?: (graphic: IGraphic) => boolean;\n state?: StateStyle;\n dx?: number;\n dy?: number;\n} & Omit<IGroupGraphicAttribute, 'background'>;\n\nexport type PoptipShapeAttributes = {\n /**\n * 是否展示 shape\n */\n visible: boolean;\n} & Partial<ISymbolGraphicAttribute>;\n"]}
|
package/dist/index.js
CHANGED
|
@@ -743,44 +743,65 @@
|
|
|
743
743
|
const poptipHeight = parsedPadding[0] + parsedPadding[2] + height;
|
|
744
744
|
const { visible: bgVisible, ...backgroundStyle } = panel;
|
|
745
745
|
const symbolSize = backgroundStyle.size ?? 12;
|
|
746
|
+
const spaceSize = vutils.isArray(symbolSize)
|
|
747
|
+
? [symbolSize[0] + (backgroundStyle.space ?? 0), symbolSize[1] + (backgroundStyle.space ?? 0)]
|
|
748
|
+
: symbolSize + (backgroundStyle.space ?? 0);
|
|
746
749
|
const lineWidth = backgroundStyle.lineWidth ?? 1;
|
|
747
|
-
const
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
750
|
+
const range = this.stage
|
|
751
|
+
? [this.stage.width, this.stage.height]
|
|
752
|
+
: undefined;
|
|
753
|
+
const layout = position === 'auto';
|
|
754
|
+
for (let i = 0; i < this.positionList.length; i++) {
|
|
755
|
+
const p = layout ? this.positionList[i] : position;
|
|
756
|
+
const { angle, offset, rectOffset } = this.getAngleAndOffset(p, popTipWidth, poptipHeight, vutils.isArray(spaceSize) ? spaceSize : [spaceSize, spaceSize - lineWidth]);
|
|
757
|
+
if (vutils.isBoolean(bgVisible)) {
|
|
758
|
+
const offsetX = (vutils.isArray(symbolSize) ? symbolSize[0] : symbolSize) / 4;
|
|
759
|
+
const bgSymbol = group.createOrUpdateChild('poptip-symbol-panel', {
|
|
760
|
+
...backgroundStyle,
|
|
761
|
+
visible: bgVisible && (contentVisible || titleVisible),
|
|
762
|
+
x: offsetX,
|
|
763
|
+
y: 0,
|
|
764
|
+
anchor: [0, 0],
|
|
765
|
+
symbolType: 'arrow2Left',
|
|
766
|
+
angle: angle,
|
|
767
|
+
dx: offset[0],
|
|
768
|
+
dy: offset[1],
|
|
769
|
+
size: symbolSize,
|
|
770
|
+
zIndex: -9
|
|
771
|
+
}, 'symbol');
|
|
772
|
+
if (!vutils.isEmpty(state?.panel)) {
|
|
773
|
+
bgSymbol.states = state.panel;
|
|
774
|
+
}
|
|
775
|
+
const bgRect = group.createOrUpdateChild('poptip-rect-panel', {
|
|
776
|
+
...backgroundStyle,
|
|
777
|
+
visible: bgVisible && (contentVisible || titleVisible),
|
|
778
|
+
x: 0,
|
|
779
|
+
y: 0,
|
|
780
|
+
width: popTipWidth,
|
|
781
|
+
height: poptipHeight,
|
|
782
|
+
zIndex: -10
|
|
783
|
+
}, 'rect');
|
|
784
|
+
if (!vutils.isEmpty(state?.panel)) {
|
|
785
|
+
bgRect.states = state.panel;
|
|
786
|
+
}
|
|
765
787
|
}
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
788
|
+
group.setAttributes({
|
|
789
|
+
x: -offset[0] + dx,
|
|
790
|
+
y: -offset[1] + dy
|
|
791
|
+
});
|
|
792
|
+
if (layout && range) {
|
|
793
|
+
const b = this.AABBBounds;
|
|
794
|
+
const stageBounds = new vutils.Bounds().setValue(0, 0, range[0], range[1]);
|
|
795
|
+
if (vutils.rectInsideAnotherRect(b, stageBounds, false)) {
|
|
796
|
+
break;
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
else {
|
|
800
|
+
break;
|
|
777
801
|
}
|
|
778
802
|
}
|
|
779
|
-
group.setAttributes({
|
|
780
|
-
x: -offset[0] + dx,
|
|
781
|
-
y: -offset[1] + dy
|
|
782
|
-
});
|
|
783
803
|
}
|
|
804
|
+
positionList = ['top', 'tl', 'tr', 'bottom', 'bl', 'br', 'left', 'lt', 'lb', 'right', 'rt', 'rb'];
|
|
784
805
|
getAngleAndOffset(position, width, height, size) {
|
|
785
806
|
const sizeH = size[1] / 2;
|
|
786
807
|
switch (position) {
|
|
@@ -875,27 +896,30 @@
|
|
|
875
896
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
876
897
|
};
|
|
877
898
|
|
|
878
|
-
const
|
|
879
|
-
|
|
899
|
+
const DEFAULT_THEME = {
|
|
900
|
+
visible: true,
|
|
901
|
+
position: 'auto',
|
|
902
|
+
titleStyle: {
|
|
903
|
+
fontSize: 16,
|
|
904
|
+
fill: '#08979c'
|
|
905
|
+
},
|
|
906
|
+
contentStyle: {
|
|
907
|
+
fontSize: 12,
|
|
908
|
+
fill: 'green'
|
|
909
|
+
},
|
|
910
|
+
panel: {
|
|
880
911
|
visible: true,
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
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
|
-
}
|
|
912
|
+
fill: '#e6fffb',
|
|
913
|
+
size: 12,
|
|
914
|
+
space: 0,
|
|
915
|
+
stroke: '#87e8de',
|
|
916
|
+
lineWidth: 1,
|
|
917
|
+
cornerRadius: 4
|
|
897
918
|
}
|
|
898
919
|
};
|
|
920
|
+
const theme = {
|
|
921
|
+
poptip: vutils.merge({}, DEFAULT_THEME)
|
|
922
|
+
};
|
|
899
923
|
|
|
900
924
|
function wrapPoptip(target, source) {
|
|
901
925
|
vutils.merge(target, theme.poptip, source);
|
|
@@ -1050,7 +1074,7 @@
|
|
|
1050
1074
|
injectable()
|
|
1051
1075
|
], PopTipForClipedTextPlugin);
|
|
1052
1076
|
|
|
1053
|
-
const
|
|
1077
|
+
const popTipModule = new ContainerModule(bind => {
|
|
1054
1078
|
bind(PopTipRenderContribution).toSelf().inSingletonScope();
|
|
1055
1079
|
bind(vrender.InteractiveSubRenderContribution).toService(PopTipRenderContribution);
|
|
1056
1080
|
bind(PopTipPlugin).toSelf().inSingletonScope();
|
|
@@ -1060,7 +1084,10 @@
|
|
|
1060
1084
|
});
|
|
1061
1085
|
function loadPoptip(defaultPoptipTheme) {
|
|
1062
1086
|
vutils.merge(theme.poptip, defaultPoptipTheme);
|
|
1063
|
-
vrender.container.load(
|
|
1087
|
+
vrender.container.load(popTipModule);
|
|
1088
|
+
}
|
|
1089
|
+
function setPoptipTheme(defaultPoptipTheme) {
|
|
1090
|
+
vutils.merge(theme.poptip, DEFAULT_THEME, defaultPoptipTheme);
|
|
1064
1091
|
}
|
|
1065
1092
|
|
|
1066
1093
|
class CrosshairBase extends AbstractComponent {
|
|
@@ -2734,16 +2761,25 @@
|
|
|
2734
2761
|
tickLineGroup.name = exports.AXIS_ELEMENT_NAME.tickContainer;
|
|
2735
2762
|
tickLineGroup.id = this._getNodeId('tick-container');
|
|
2736
2763
|
container.add(tickLineGroup);
|
|
2737
|
-
const tickLineState = vutils.isEmpty(this.attribute.tick?.state)
|
|
2738
|
-
? null
|
|
2739
|
-
: vutils.merge({}, DEFAULT_STATES$2, this.attribute.tick.state);
|
|
2740
2764
|
tickLineItems.forEach((item, index) => {
|
|
2741
2765
|
const line = vrender.createLine({
|
|
2742
2766
|
...this._getTickLineAttribute('tick', item, index, tickLineItems)
|
|
2743
2767
|
});
|
|
2744
2768
|
line.name = exports.AXIS_ELEMENT_NAME.tick;
|
|
2745
2769
|
line.id = this._getNodeId(item.id);
|
|
2746
|
-
|
|
2770
|
+
if (vutils.isEmpty(this.attribute.tick?.state)) {
|
|
2771
|
+
line.states = null;
|
|
2772
|
+
}
|
|
2773
|
+
else {
|
|
2774
|
+
const data = this.data[index];
|
|
2775
|
+
const tickLineState = vutils.merge({}, DEFAULT_STATES$2, this.attribute.tick.state);
|
|
2776
|
+
Object.keys(tickLineState).forEach(key => {
|
|
2777
|
+
if (vutils.isFunction(tickLineState[key])) {
|
|
2778
|
+
tickLineState[key] = tickLineState[key](data.rawValue, index, data, this.data);
|
|
2779
|
+
}
|
|
2780
|
+
});
|
|
2781
|
+
line.states = tickLineState;
|
|
2782
|
+
}
|
|
2747
2783
|
tickLineGroup.add(line);
|
|
2748
2784
|
});
|
|
2749
2785
|
this.tickLineItems = tickLineItems;
|
|
@@ -2751,14 +2787,24 @@
|
|
|
2751
2787
|
if (subTick?.visible) {
|
|
2752
2788
|
const subTickLineItems = this.getSubTickLineItems();
|
|
2753
2789
|
if (subTickLineItems.length) {
|
|
2754
|
-
const subTickLineState = vutils.isEmpty(subTick.state) ? null : vutils.merge({}, DEFAULT_STATES$2, subTick.state);
|
|
2755
2790
|
subTickLineItems.forEach((item, index) => {
|
|
2756
2791
|
const line = vrender.createLine({
|
|
2757
2792
|
...this._getTickLineAttribute('subTick', item, index, tickLineItems)
|
|
2758
2793
|
});
|
|
2759
2794
|
line.name = exports.AXIS_ELEMENT_NAME.subTick;
|
|
2760
2795
|
line.id = this._getNodeId(`${index}`);
|
|
2761
|
-
|
|
2796
|
+
if (vutils.isEmpty(subTick.state)) {
|
|
2797
|
+
line.states = null;
|
|
2798
|
+
}
|
|
2799
|
+
else {
|
|
2800
|
+
const subTickLineState = vutils.merge({}, DEFAULT_STATES$2, subTick.state);
|
|
2801
|
+
Object.keys(subTickLineState).forEach(key => {
|
|
2802
|
+
if (vutils.isFunction(subTickLineState[key])) {
|
|
2803
|
+
subTickLineState[key] = subTickLineState[key](item.value, index, item, tickLineItems);
|
|
2804
|
+
}
|
|
2805
|
+
});
|
|
2806
|
+
line.states = subTickLineState;
|
|
2807
|
+
}
|
|
2762
2808
|
tickLineGroup.add(line);
|
|
2763
2809
|
});
|
|
2764
2810
|
}
|
|
@@ -2779,15 +2825,23 @@
|
|
|
2779
2825
|
let maxTextHeight = 0;
|
|
2780
2826
|
let textAlign = 'center';
|
|
2781
2827
|
let textBaseline = 'middle';
|
|
2782
|
-
const labelState = vutils.isEmpty(this.attribute.label?.state)
|
|
2783
|
-
? null
|
|
2784
|
-
: vutils.merge({}, DEFAULT_STATES$2, this.attribute.label.state);
|
|
2785
2828
|
data.forEach((item, index) => {
|
|
2786
2829
|
const labelStyle = this._getLabelAttribute(item, index, data, layer);
|
|
2787
2830
|
const text = vrender.createText(labelStyle);
|
|
2788
2831
|
text.name = exports.AXIS_ELEMENT_NAME.label;
|
|
2789
2832
|
text.id = this._getNodeId(`layer${layer}-label-${item.id}`);
|
|
2790
|
-
|
|
2833
|
+
if (vutils.isEmpty(this.attribute.label?.state)) {
|
|
2834
|
+
text.states = null;
|
|
2835
|
+
}
|
|
2836
|
+
else {
|
|
2837
|
+
const labelState = vutils.merge({}, DEFAULT_STATES$2, this.attribute.label.state);
|
|
2838
|
+
Object.keys(labelState).forEach(key => {
|
|
2839
|
+
if (vutils.isFunction(labelState[key])) {
|
|
2840
|
+
labelState[key] = labelState[key](item, index, data, layer);
|
|
2841
|
+
}
|
|
2842
|
+
});
|
|
2843
|
+
text.states = labelState;
|
|
2844
|
+
}
|
|
2791
2845
|
labelGroup.add(text);
|
|
2792
2846
|
const angle = labelStyle.angle ?? 0;
|
|
2793
2847
|
maxTextWidth = Math.max(maxTextWidth, text.AABBBounds.width());
|
|
@@ -3228,7 +3282,7 @@
|
|
|
3228
3282
|
: limitLength
|
|
3229
3283
|
: limitLength / Math.sin(label.attribute.angle);
|
|
3230
3284
|
label.setAttributes({
|
|
3231
|
-
maxLineWidth: limitLabelLength,
|
|
3285
|
+
maxLineWidth: Math.abs(limitLabelLength),
|
|
3232
3286
|
ellipsis
|
|
3233
3287
|
});
|
|
3234
3288
|
});
|
|
@@ -5976,7 +6030,7 @@
|
|
|
5976
6030
|
item.id = item.label;
|
|
5977
6031
|
}
|
|
5978
6032
|
item.index = index;
|
|
5979
|
-
const itemGroup = this._renderEachItem(item, vutils.isEmpty(defaultSelected) ? true : defaultSelected?.includes(item.label), index);
|
|
6033
|
+
const itemGroup = this._renderEachItem(item, vutils.isEmpty(defaultSelected) ? true : defaultSelected?.includes(item.label), index, legendItems);
|
|
5980
6034
|
const itemWidth = itemGroup.attribute.width;
|
|
5981
6035
|
const itemHeight = itemGroup.attribute.height;
|
|
5982
6036
|
this._itemHeight = Math.max(this._itemHeight, itemHeight);
|
|
@@ -6049,16 +6103,21 @@
|
|
|
6049
6103
|
this._itemsContainer.addEventListener('pointerdown', this._onClick);
|
|
6050
6104
|
}
|
|
6051
6105
|
}
|
|
6052
|
-
_renderEachItem(item, isSelected, index) {
|
|
6106
|
+
_renderEachItem(item, isSelected, index, items) {
|
|
6053
6107
|
const { id, label, value, shape } = item;
|
|
6054
|
-
const {
|
|
6108
|
+
const { padding = 0, focus, focusIconStyle = {} } = this.attribute.item;
|
|
6109
|
+
let { shape: shapeAttr = {}, label: labelAttr = {}, value: valueAttr = {}, background = {} } = this.attribute.item;
|
|
6110
|
+
shapeAttr = this._handleStyle(shapeAttr, item, isSelected, index, items);
|
|
6111
|
+
labelAttr = this._handleStyle(labelAttr, item, isSelected, index, items);
|
|
6112
|
+
valueAttr = this._handleStyle(valueAttr, item, isSelected, index, items);
|
|
6113
|
+
background = this._handleStyle(background, item, isSelected, index, items);
|
|
6055
6114
|
const parsedPadding = vutils.normalizePadding(padding);
|
|
6056
6115
|
let itemGroup;
|
|
6057
6116
|
if (background.visible === false) {
|
|
6058
6117
|
itemGroup = vrender.createGroup({
|
|
6059
6118
|
x: 0,
|
|
6060
6119
|
y: 0,
|
|
6061
|
-
cursor: background?.style.cursor
|
|
6120
|
+
cursor: (background?.style).cursor
|
|
6062
6121
|
});
|
|
6063
6122
|
this._appendDataToShape(itemGroup, exports.LEGEND_ELEMENT_NAME.item, item, itemGroup);
|
|
6064
6123
|
}
|
|
@@ -6089,7 +6148,8 @@
|
|
|
6089
6148
|
...shapeAttr.style
|
|
6090
6149
|
});
|
|
6091
6150
|
Object.keys(shapeAttr.state || {}).forEach(key => {
|
|
6092
|
-
const color = shapeAttr.state[key].fill ||
|
|
6151
|
+
const color = shapeAttr.state[key].fill ||
|
|
6152
|
+
shapeAttr.state[key].stroke;
|
|
6093
6153
|
if (shape.fill && vutils.isNil(shapeAttr.state[key].fill) && color) {
|
|
6094
6154
|
shapeAttr.state[key].fill = color;
|
|
6095
6155
|
}
|
|
@@ -6121,7 +6181,7 @@
|
|
|
6121
6181
|
y: 0,
|
|
6122
6182
|
textAlign: 'start',
|
|
6123
6183
|
textBaseline: 'middle',
|
|
6124
|
-
lineHeight: labelAttr?.style.fontSize,
|
|
6184
|
+
lineHeight: (labelAttr?.style).fontSize,
|
|
6125
6185
|
...labelAttr?.style,
|
|
6126
6186
|
text: labelAttr.formatMethod ? labelAttr.formatMethod(label, item, index) : label
|
|
6127
6187
|
});
|
|
@@ -6137,7 +6197,7 @@
|
|
|
6137
6197
|
y: 0,
|
|
6138
6198
|
textAlign: 'start',
|
|
6139
6199
|
textBaseline: 'middle',
|
|
6140
|
-
lineHeight: valueAttr?.style.fontSize,
|
|
6200
|
+
lineHeight: (valueAttr?.style).fontSize,
|
|
6141
6201
|
...valueAttr?.style,
|
|
6142
6202
|
text: valueAttr.formatMethod ? valueAttr.formatMethod(value, item, index) : value
|
|
6143
6203
|
});
|
|
@@ -6470,6 +6530,20 @@
|
|
|
6470
6530
|
changeEvent.manager = this.stage?.eventSystem.manager;
|
|
6471
6531
|
this.dispatchEvent(changeEvent);
|
|
6472
6532
|
}
|
|
6533
|
+
_handleStyle(config, item, isSelected, index, items) {
|
|
6534
|
+
const newConfig = vutils.merge({}, config);
|
|
6535
|
+
if (config.style && vutils.isFunction(config.style)) {
|
|
6536
|
+
newConfig.style = config.style(item, isSelected, index, items);
|
|
6537
|
+
}
|
|
6538
|
+
if (config.state) {
|
|
6539
|
+
Object.keys(config.state).forEach(key => {
|
|
6540
|
+
if (config.state[key] && vutils.isFunction(config.state[key])) {
|
|
6541
|
+
newConfig.state[key] = config.state[key](item, isSelected, index, items);
|
|
6542
|
+
}
|
|
6543
|
+
});
|
|
6544
|
+
}
|
|
6545
|
+
return newConfig;
|
|
6546
|
+
}
|
|
6473
6547
|
}
|
|
6474
6548
|
|
|
6475
6549
|
exports.SLIDER_ELEMENT_NAME = void 0;
|
|
@@ -9427,7 +9501,7 @@
|
|
|
9427
9501
|
}
|
|
9428
9502
|
}
|
|
9429
9503
|
|
|
9430
|
-
const version = "0.13.
|
|
9504
|
+
const version = "0.13.3-alpha.1";
|
|
9431
9505
|
|
|
9432
9506
|
exports.AbstractComponent = AbstractComponent;
|
|
9433
9507
|
exports.BasePlayer = BasePlayer;
|
|
@@ -9480,7 +9554,8 @@
|
|
|
9480
9554
|
exports.getSizeHandlerPath = getSizeHandlerPath;
|
|
9481
9555
|
exports.getVerticalPath = getVerticalPath;
|
|
9482
9556
|
exports.loadPoptip = loadPoptip;
|
|
9483
|
-
exports.
|
|
9557
|
+
exports.popTipModule = popTipModule;
|
|
9558
|
+
exports.setPoptipTheme = setPoptipTheme;
|
|
9484
9559
|
exports.version = version;
|
|
9485
9560
|
|
|
9486
9561
|
}));
|