@visactor/vrender-components 0.22.0-vstory.1 → 0.22.0-vstory.10
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 +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/title/title.js +36 -42
- package/cjs/title/title.js.map +1 -1
- package/dist/index.es.js +150 -88
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/title/title.js +34 -37
- package/es/title/title.js.map +1 -1
- package/package.json +5 -5
package/cjs/index.d.ts
CHANGED
package/cjs/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var __createBinding = this && this.__createBinding || (Object.create ? function(
|
|
|
17
17
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", {
|
|
19
19
|
value: !0
|
|
20
|
-
}), exports.version = void 0, exports.version = "0.22.0-vstory.
|
|
20
|
+
}), exports.version = void 0, exports.version = "0.22.0-vstory.10", __exportStar(require("./core/base"), exports),
|
|
21
21
|
__exportStar(require("./core/type"), exports), __exportStar(require("./scrollbar"), exports),
|
|
22
22
|
__exportStar(require("./tag"), exports), __exportStar(require("./poptip"), exports),
|
|
23
23
|
__exportStar(require("./crosshair"), exports), __exportStar(require("./label"), exports),
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACa,QAAA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACa,QAAA,OAAO,GAAG,kBAAkB,CAAC;AAE1C,8CAA4B;AAC5B,8CAA4B;AAC5B,8CAA4B;AAC5B,wCAAsB;AACtB,2CAAyB;AACzB,8CAA4B;AAC5B,0CAAwB;AACxB,yCAAuB;AACvB,8CAA4B;AAC5B,4CAA0B;AAC1B,8CAA4B;AAC5B,2CAAyB;AACzB,0CAAwB;AACxB,2CAAyB;AACzB,0CAAwB;AACxB,8CAA4B;AAC5B,2CAAyB;AACzB,8CAA4B;AAC5B,2CAAyB;AACzB,0CAAwB;AACxB,4CAA0B;AAC1B,6CAA2B;AAC3B,8CAA4B;AAC5B,wCAAsB;AACtB,6CAA2B;AAC3B,0CAAwB;AACxB,8CAA4B;AAC5B,4CAA0B;AAC1B,yCAAuB;AACvB,2CAAyB;AACzB,+CAA6B","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.22.0-vstory.10\";\n\nexport * from './core/base';\nexport * from './core/type';\nexport * from './scrollbar';\nexport * from './tag';\nexport * from './poptip';\nexport * from './crosshair';\nexport * from './label';\nexport * from './axis';\nexport * from './axis/grid';\nexport * from './segment';\nexport * from './data-zoom';\nexport * from './marker';\nexport * from './pager';\nexport * from './legend';\nexport * from './title';\nexport * from './indicator';\nexport * from './slider';\nexport * from './link-path';\nexport * from './player';\nexport * from './brush';\nexport * from './tooltip';\nexport * from './timeline';\nexport * from './interface';\nexport * from './jsx';\nexport * from './checkbox';\nexport * from './radio';\nexport * from './empty-tip';\nexport * from './weather';\nexport * from './util';\nexport * from './switch';\nexport * from './label-item';\n"]}
|
package/cjs/title/title.js
CHANGED
|
@@ -14,21 +14,21 @@ class Title extends base_1.AbstractComponent {
|
|
|
14
14
|
this.name = "title";
|
|
15
15
|
}
|
|
16
16
|
render() {
|
|
17
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t
|
|
17
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
18
18
|
const {textType: textType, text: text, subtextType: subtextType, textStyle: textStyle = {}, subtext: subtext, subtextStyle: subtextStyle = {}, width: width, height: height, minWidth: minWidth, maxWidth: maxWidth, minHeight: minHeight, maxHeight: maxHeight, align: align, verticalAlign: verticalAlign, padding: padding = 0} = this.attribute, parsedPadding = (0,
|
|
19
19
|
vutils_1.normalizePadding)(padding), group = this.createOrUpdateChild("title-container", {
|
|
20
20
|
x: parsedPadding[3],
|
|
21
21
|
y: parsedPadding[0],
|
|
22
22
|
zIndex: 1
|
|
23
|
-
}, "group")
|
|
23
|
+
}, "group");
|
|
24
24
|
if (!1 !== this.attribute.visible && !1 !== textStyle.visible) {
|
|
25
|
-
const {width: mainTitleWidth, maxHeight: mainTitleMaxHeight, maxWidth: mainTitleMaxWidth, x: x = 0, y: y = 0, ellipsis: ellipsis = !0, wordBreak: wordBreak = "break-word", maxWidth: maxWidth, lineClamp: lineClamp} = textStyle;
|
|
25
|
+
const {width: mainTitleWidth, height: mainTitleHeight, maxHeight: mainTitleMaxHeight, maxWidth: mainTitleMaxWidth, x: x = 0, y: y = 0, ellipsis: ellipsis = !0, wordBreak: wordBreak = "break-word", maxWidth: maxWidth, lineClamp: lineClamp} = textStyle;
|
|
26
26
|
if ("rich" === textType || (0, vutils_1.isValid)(textStyle.character)) {
|
|
27
27
|
const attr = Object.assign({
|
|
28
28
|
x: x,
|
|
29
29
|
y: y,
|
|
30
|
-
width: null !== (
|
|
31
|
-
height: null !=
|
|
30
|
+
width: null !== (_a = null != mainTitleWidth ? mainTitleWidth : width) && void 0 !== _a ? _a : 0,
|
|
31
|
+
height: null !== (_b = null != mainTitleHeight ? mainTitleHeight : height) && void 0 !== _b ? _b : 0,
|
|
32
32
|
ellipsis: null == ellipsis || ellipsis,
|
|
33
33
|
wordBreak: null != wordBreak ? wordBreak : "break-word",
|
|
34
34
|
maxHeight: null != mainTitleMaxHeight ? mainTitleMaxHeight : maxHeight,
|
|
@@ -44,7 +44,7 @@ class Title extends base_1.AbstractComponent {
|
|
|
44
44
|
x: x,
|
|
45
45
|
y: y,
|
|
46
46
|
width: null !== (_d = null != mainTitleWidth ? mainTitleWidth : width) && void 0 !== _d ? _d : 0,
|
|
47
|
-
height: null !=
|
|
47
|
+
height: null !== (_e = null != mainTitleHeight ? mainTitleHeight : height) && void 0 !== _e ? _e : 0,
|
|
48
48
|
ellipsis: ellipsis,
|
|
49
49
|
wordBreak: wordBreak,
|
|
50
50
|
maxHeight: null != mainTitleMaxHeight ? mainTitleMaxHeight : maxHeight,
|
|
@@ -56,17 +56,17 @@ class Title extends base_1.AbstractComponent {
|
|
|
56
56
|
text: (0, vutils_1.isArray)(text) ? text : [ text ],
|
|
57
57
|
whiteSpace: "normal"
|
|
58
58
|
}, textStyle), {
|
|
59
|
-
maxLineWidth: null !== (
|
|
60
|
-
heightLimit: null
|
|
59
|
+
maxLineWidth: null !== (_g = null !== (_f = textStyle.maxLineWidth) && void 0 !== _f ? _f : mainTitleWidth) && void 0 !== _g ? _g : width,
|
|
60
|
+
heightLimit: null != mainTitleHeight ? mainTitleHeight : maxHeight,
|
|
61
61
|
lineClamp: lineClamp,
|
|
62
62
|
ellipsis: ellipsis,
|
|
63
63
|
x: x,
|
|
64
64
|
y: y
|
|
65
65
|
}), "text"));
|
|
66
66
|
}
|
|
67
|
-
const
|
|
67
|
+
const maintextHeight = this._mainTitle ? this._mainTitle.AABBBounds.height() : 0, maintextWidth = this._mainTitle ? this._mainTitle.AABBBounds.width() : 0;
|
|
68
68
|
if (!1 !== this.attribute.visible && !1 !== subtextStyle.visible) {
|
|
69
|
-
const {width: subTitleWidth, height: subTitleHeight, maxWidth: subTitleMaxWidth, maxHeight: subTitleMaxHeight, x: x = 0, y: y = 0, ellipsis: ellipsis = !0, wordBreak: wordBreak = "break-word", lineClamp: lineClamp} = subtextStyle, maxSubTextHeight = Math.max(Number.MIN_VALUE, maxHeight -
|
|
69
|
+
const {width: subTitleWidth, height: subTitleHeight, maxWidth: subTitleMaxWidth, maxHeight: subTitleMaxHeight, x: x = 0, y: y = 0, ellipsis: ellipsis = !0, wordBreak: wordBreak = "break-word", lineClamp: lineClamp} = subtextStyle, maxSubTextHeight = Math.max(Number.MIN_VALUE, maxHeight - maintextHeight);
|
|
70
70
|
if ("rich" === subtextType || (0, vutils_1.isValid)(subtextStyle.character)) {
|
|
71
71
|
const attr = Object.assign({
|
|
72
72
|
x: x,
|
|
@@ -105,50 +105,44 @@ class Title extends base_1.AbstractComponent {
|
|
|
105
105
|
lineClamp: lineClamp,
|
|
106
106
|
ellipsis: ellipsis,
|
|
107
107
|
x: 0,
|
|
108
|
-
y:
|
|
108
|
+
y: maintextHeight
|
|
109
109
|
}), "text"));
|
|
110
110
|
}
|
|
111
|
-
const
|
|
112
|
-
let
|
|
113
|
-
if ((0, vutils_1.isValid)(width) && (
|
|
114
|
-
(0, vutils_1.isValid)(minWidth) &&
|
|
115
|
-
(0, vutils_1.isValid)(maxWidth) &&
|
|
116
|
-
(0, vutils_1.isValid)(minHeight) &&
|
|
117
|
-
(0, vutils_1.isValid)(maxHeight) &&
|
|
118
|
-
group.attribute.width =
|
|
111
|
+
const subtextHeight = this._subTitle ? this._subTitle.AABBBounds.height() : 0, subtextWidth = this._subTitle ? this._subTitle.AABBBounds.width() : 0;
|
|
112
|
+
let titleWidth = Math.max(maintextWidth, subtextWidth), titleHeight = maintextHeight + (null !== (_q = subtextStyle.height) && void 0 !== _q ? _q : subtextHeight);
|
|
113
|
+
if ((0, vutils_1.isValid)(width) && (titleWidth = width), (0, vutils_1.isValid)(height) && (titleHeight = height),
|
|
114
|
+
(0, vutils_1.isValid)(minWidth) && titleWidth < minWidth && (titleWidth = minWidth),
|
|
115
|
+
(0, vutils_1.isValid)(maxWidth) && titleWidth > maxWidth && (titleWidth = maxWidth),
|
|
116
|
+
(0, vutils_1.isValid)(minHeight) && titleHeight < minHeight && (titleHeight = minHeight),
|
|
117
|
+
(0, vutils_1.isValid)(maxHeight) && titleHeight > maxHeight && (titleHeight = maxHeight),
|
|
118
|
+
group.attribute.width = titleWidth, group.attribute.height = titleHeight, group.attribute.boundsPadding = parsedPadding,
|
|
119
119
|
this._mainTitle) {
|
|
120
120
|
if ((0, vutils_1.isValid)(align) || (0, vutils_1.isValid)(textStyle.align)) {
|
|
121
|
-
const mainTitleAlign = textStyle.align ? textStyle.align : align, mainTitleWidth = null !== (_r = textStyle.width) && void 0 !== _r ? _r :
|
|
122
|
-
"center" === mainTitleAlign ? (this._mainTitle.setAttribute("x", mainTitleWidth / 2),
|
|
123
|
-
this._mainTitle.setAttribute("textAlign", "center")) : "right" === mainTitleAlign
|
|
124
|
-
this._mainTitle.setAttribute("textAlign", "right"))
|
|
125
|
-
this._mainTitle.setAttribute("textAlign", "left"));
|
|
121
|
+
const mainTitleAlign = textStyle.align ? textStyle.align : align, mainTitleWidth = null !== (_r = textStyle.width) && void 0 !== _r ? _r : maintextWidth;
|
|
122
|
+
"left" === mainTitleAlign ? (this._mainTitle.setAttribute("x", 0), this._mainTitle.setAttribute("textAlign", "left")) : "center" === mainTitleAlign ? (this._mainTitle.setAttribute("x", mainTitleWidth / 2),
|
|
123
|
+
this._mainTitle.setAttribute("textAlign", "center")) : "right" === mainTitleAlign && (this._mainTitle.setAttribute("x", mainTitleWidth),
|
|
124
|
+
this._mainTitle.setAttribute("textAlign", "right"));
|
|
126
125
|
}
|
|
127
126
|
if ((0, vutils_1.isValid)(verticalAlign) || (0, vutils_1.isValid)(textStyle.verticalAlign)) {
|
|
128
|
-
const mainTitleVerticalAlign = textStyle.verticalAlign ? textStyle.verticalAlign : verticalAlign;
|
|
129
|
-
"
|
|
130
|
-
this._mainTitle.setAttribute("textBaseline", "middle")) : "bottom" === mainTitleVerticalAlign && (
|
|
131
|
-
|
|
132
|
-
this._mainTitle.setAttribute("textBaseline", "bottom")) : (this._mainTitle.setAttribute("y", 0),
|
|
133
|
-
this._mainTitle.setAttribute("textBaseline", "top"));
|
|
127
|
+
const mainTitleVerticalAlign = textStyle.verticalAlign ? textStyle.verticalAlign : verticalAlign, mainTitleHeight = textStyle.height ? textStyle.height : titleHeight;
|
|
128
|
+
"top" === mainTitleVerticalAlign ? (this._mainTitle.setAttribute("y", 0), this._mainTitle.setAttribute("textBaseline", "top")) : "middle" === mainTitleVerticalAlign ? (this._mainTitle.setAttribute("y", mainTitleHeight / 2),
|
|
129
|
+
this._mainTitle.setAttribute("textBaseline", "middle")) : "bottom" === mainTitleVerticalAlign && (this._mainTitle.setAttribute("y", mainTitleHeight),
|
|
130
|
+
this._mainTitle.setAttribute("textBaseline", "bottom"));
|
|
134
131
|
}
|
|
135
132
|
}
|
|
136
133
|
if (this._subTitle) {
|
|
137
134
|
if ((0, vutils_1.isValid)(align) || (0, vutils_1.isValid)(subtextStyle.align)) {
|
|
138
|
-
const subTitleAlign = subtextStyle.align ? subtextStyle.align : align, subTitleWidth = null !== (
|
|
139
|
-
"center" === subTitleAlign ? (this._subTitle.setAttribute("x", subTitleWidth / 2),
|
|
140
|
-
this._subTitle.setAttribute("textAlign", "center")) : "right" === subTitleAlign
|
|
141
|
-
this._subTitle.setAttribute("textAlign", "right"))
|
|
142
|
-
this._subTitle.setAttribute("textAlign", "left"));
|
|
135
|
+
const subTitleAlign = subtextStyle.align ? subtextStyle.align : align, subTitleWidth = null !== (_s = subtextStyle.width) && void 0 !== _s ? _s : subtextWidth;
|
|
136
|
+
"left" === subTitleAlign ? (this._subTitle.setAttribute("x", 0), this._subTitle.setAttribute("textAlign", "left")) : "center" === subTitleAlign ? (this._subTitle.setAttribute("x", subTitleWidth / 2),
|
|
137
|
+
this._subTitle.setAttribute("textAlign", "center")) : "right" === subTitleAlign && (this._subTitle.setAttribute("x", subTitleWidth),
|
|
138
|
+
this._subTitle.setAttribute("textAlign", "right"));
|
|
143
139
|
}
|
|
144
140
|
if ((0, vutils_1.isValid)(verticalAlign) || (0, vutils_1.isValid)(textStyle.verticalAlign)) {
|
|
145
|
-
const subTitleVerticalAlign = subtextStyle.verticalAlign ? subtextStyle.verticalAlign : verticalAlign, subTitleYStart =
|
|
146
|
-
|
|
147
|
-
"middle" === subTitleVerticalAlign
|
|
148
|
-
this._subTitle.setAttribute("textBaseline", "middle")) : "bottom" === subTitleVerticalAlign && (
|
|
149
|
-
|
|
150
|
-
this._subTitle.setAttribute("textBaseline", "bottom")) : (this._subTitle.setAttribute("y", subTitleYStart),
|
|
151
|
-
this._subTitle.setAttribute("textBaseline", "top"));
|
|
141
|
+
const subTitleVerticalAlign = subtextStyle.verticalAlign ? subtextStyle.verticalAlign : verticalAlign, subTitleYStart = maintextHeight, subTitleHeight = null !== (_t = subtextStyle.height) && void 0 !== _t ? _t : 0;
|
|
142
|
+
"top" === subTitleVerticalAlign ? (this._subTitle.setAttribute("y", subTitleYStart),
|
|
143
|
+
this._subTitle.setAttribute("textBaseline", "top")) : "middle" === subTitleVerticalAlign ? (this._subTitle.setAttribute("y", subTitleYStart + subTitleHeight / 2),
|
|
144
|
+
this._subTitle.setAttribute("textBaseline", "middle")) : "bottom" === subTitleVerticalAlign && (this._subTitle.setAttribute("y", subTitleYStart + subTitleHeight),
|
|
145
|
+
this._subTitle.setAttribute("textBaseline", "bottom"));
|
|
152
146
|
}
|
|
153
147
|
}
|
|
154
148
|
}
|
package/cjs/title/title.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/title/title.ts"],"names":[],"mappings":";;;AAIA,6CAA6E;AAC7E,uCAAiD;AAGjD,0CAAqD;AACrD,yCAAgD;AAEhD,IAAA,6BAAkB,GAAE,CAAC;AACrB,MAAa,KAAM,SAAQ,wBAAuC;IAyBhE,YAAY,UAAsB,EAAE,OAA0B;QAC5D,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAA,cAAK,EAAC,EAAE,EAAE,KAAK,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QAzB5F,SAAI,GAAG,OAAO,CAAC;IA0Bf,CAAC;IAES,MAAM;;QACd,MAAM,EACJ,QAAQ,EACR,IAAI,EACJ,WAAW,EACX,SAAS,GAAG,EAAE,EACd,OAAO,EACP,YAAY,GAAG,EAAE,EACjB,KAAK,EACL,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,SA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AQ,CAAC,CAAC;iBACvD;qBAAM,IAAI,qBAAqB,KAAK,QAAQ,IAAI,IAAA,gBAAO,EAAC,cAAc,CAAC,EAAE;oBACxE,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,GAAG,EAAE,cAAc,GAAG,cAAc,CAAC,CAAC;oBAClE,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;iBACvD;qBAAM;oBACL,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;oBACjD,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;iBACpD;aACF;SACF;IACH,CAAC;;AA9SH,sBA+SC;AAzSQ,uBAAiB,GAAwB;IAC9C,SAAS,EAAE;QACT,QAAQ,EAAE,KAAK;QACf,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,MAAM;QAClB,SAAS,EAAE,MAAM;QACjB,YAAY,EAAE,KAAK;KACpB;IACD,YAAY,EAAE;QACZ,QAAQ,EAAE,KAAK;QACf,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,QAAQ;QACpB,SAAS,EAAE,MAAM;QACjB,YAAY,EAAE,KAAK;KACpB;CACF,CAAC","file":"title.js","sourcesContent":["/**\n * @description 标题组件\n */\nimport type { IGroup, IText, IRichText, IRichTextCharacter } from '@visactor/vrender-core';\nimport { merge, isValid, normalizePadding, isArray } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { TitleAttrs } from './type';\nimport type { ComponentOptions } from '../interface';\nimport { DEFAULT_HTML_TEXT_SPEC } from '../constant';\nimport { loadTitleComponent } from './register';\n\nloadTitleComponent();\nexport class Title extends AbstractComponent<Required<TitleAttrs>> {\n name = 'title';\n\n private _mainTitle?: IText | IRichText;\n private _subTitle?: IText | IRichText;\n\n static defaultAttributes: Partial<TitleAttrs> = {\n textStyle: {\n ellipsis: '...',\n fill: '#333',\n fontSize: 20,\n fontWeight: 'bold',\n textAlign: 'left',\n textBaseline: 'top'\n },\n subtextStyle: {\n ellipsis: '...',\n fill: '#6F6F6F',\n fontSize: 16,\n fontWeight: 'normal',\n textAlign: 'left',\n textBaseline: 'top'\n }\n };\n\n constructor(attributes: TitleAttrs, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, Title.defaultAttributes, attributes));\n }\n\n protected render() {\n const {\n textType,\n text,\n subtextType,\n textStyle = {},\n subtext,\n subtextStyle = {},\n width,\n height,\n minWidth,\n maxWidth,\n minHeight,\n maxHeight,\n align,\n verticalAlign,\n padding = 0\n } = this.attribute as TitleAttrs;\n\n const parsedPadding = normalizePadding(padding);\n\n const group = this.createOrUpdateChild(\n 'title-container',\n { x: parsedPadding[3], y: parsedPadding[0], zIndex: 1 },\n 'group'\n ) as IGroup;\n\n const fixedMainTitleHeight = textStyle.height ?? height;\n if (this.attribute.visible !== false && textStyle.visible !== false) {\n const {\n width: mainTitleWidth,\n maxHeight: mainTitleMaxHeight,\n maxWidth: mainTitleMaxWidth,\n x = 0,\n y = 0,\n ellipsis = true,\n wordBreak = 'break-word',\n maxWidth,\n lineClamp\n } = textStyle;\n if (textType === 'rich' || isValid(textStyle.character)) {\n const attr = {\n x,\n y,\n width: mainTitleWidth ?? width ?? 0,\n height: fixedMainTitleHeight ?? 0,\n ellipsis: ellipsis ?? true,\n wordBreak: wordBreak ?? 'break-word',\n maxHeight: mainTitleMaxHeight ?? maxHeight,\n maxWidth: mainTitleMaxWidth ?? maxWidth,\n // 兼容旧版富文本配置,如果未设置textType === 'rich',text内容为string 易报错\n textConfig: textStyle.character ?? (text as IRichTextCharacter[]),\n ...textStyle\n };\n this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext') as IRichText;\n } else if (textType === 'html') {\n const attr = {\n html: {\n dom: text as string,\n ...DEFAULT_HTML_TEXT_SPEC,\n ...textStyle\n },\n x,\n y,\n width: mainTitleWidth ?? width ?? 0,\n height: fixedMainTitleHeight ?? 0,\n ellipsis,\n wordBreak,\n maxHeight: mainTitleMaxHeight ?? maxHeight,\n maxWidth: mainTitleMaxWidth ?? maxWidth,\n textConfig: [] as any[],\n ...textStyle\n };\n this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext') as IRichText;\n } else if (isValid(text)) {\n this._mainTitle = group.createOrUpdateChild(\n 'mainTitle',\n {\n text: isArray(text) ? (text as any) : [text as string],\n whiteSpace: 'normal',\n ...textStyle,\n maxLineWidth: textStyle.maxLineWidth ?? mainTitleWidth ?? width,\n heightLimit: textStyle.height ?? maxHeight,\n lineClamp,\n ellipsis,\n x,\n y\n },\n 'text'\n ) as IText;\n }\n }\n\n const mainTextBoundsHeight = this._mainTitle ? this._mainTitle.AABBBounds.height() : 0;\n const mainTextBoundsWidth = this._mainTitle ? this._mainTitle.AABBBounds.width() : 0;\n\n // 目前 height 限制等于 0 时,相当于 Infinity,无限制\n\n if (this.attribute.visible !== false && subtextStyle.visible !== false) {\n const {\n width: subTitleWidth,\n height: subTitleHeight,\n maxWidth: subTitleMaxWidth,\n maxHeight: subTitleMaxHeight,\n x = 0,\n y = 0,\n ellipsis = true,\n wordBreak = 'break-word',\n lineClamp\n } = subtextStyle;\n const maxSubTextHeight = Math.max(Number.MIN_VALUE, maxHeight - mainTextBoundsHeight);\n\n if (subtextType === 'rich' || isValid(subtextStyle.character)) {\n const attr: any = {\n x,\n y,\n width: subTitleWidth ?? width ?? 0,\n height: subTitleHeight ?? height ?? 0,\n ellipsis,\n wordBreak,\n maxHeight: subTitleMaxHeight ?? maxSubTextHeight,\n maxWidth: subTitleMaxWidth ?? maxWidth,\n // 兼容旧版富文本配置,如果未设置textType === 'rich',text内容为string 易报错\n textConfig: subtextStyle.character ?? (subtext as IRichTextCharacter[]),\n ...subtextStyle\n };\n this._subTitle = group.createOrUpdateChild('subTitle', attr, 'richtext') as IRichText;\n } else if (subtextType === 'html') {\n const attr: any = {\n html: {\n dom: subtext as string,\n ...DEFAULT_HTML_TEXT_SPEC,\n ...subtextStyle\n },\n x,\n y,\n width: subTitleWidth ?? width ?? 0,\n height: subTitleHeight ?? height ?? 0,\n ellipsis,\n wordBreak,\n maxHeight: subTitleMaxHeight ?? maxSubTextHeight,\n maxWidth: subTitleMaxWidth ?? maxWidth,\n textConfig: [] as any[],\n ...subtextStyle\n };\n this._subTitle = group.createOrUpdateChild('subTitle', attr, 'richtext') as IRichText;\n } else if (isValid(subtext)) {\n this._subTitle = group.createOrUpdateChild(\n 'subTitle',\n {\n text: isArray(subtext) ? (subtext as any) : [subtext as string],\n whiteSpace: 'normal',\n ...subtextStyle,\n maxLineWidth: subtextStyle.maxLineWidth ?? width,\n heightLimit: subtextStyle.heightLimit ?? maxSubTextHeight,\n lineClamp,\n ellipsis,\n x: 0,\n y: mainTextBoundsHeight\n },\n 'text'\n ) as IText;\n }\n }\n\n const subTextBoundsHeight = this._subTitle ? this._subTitle.AABBBounds.height() : 0;\n const subTextBoundsWidth = this._subTitle ? this._subTitle.AABBBounds.width() : 0;\n\n // 设置宽高\n let totalWidth = Math.max(mainTextBoundsWidth, subTextBoundsWidth);\n let totalHeight = mainTextBoundsHeight + (subtextStyle.height ?? subTextBoundsHeight);\n\n if (isValid(width)) {\n totalWidth = width;\n }\n\n if (isValid(height)) {\n totalHeight = height;\n }\n\n if (isValid(minWidth) && totalWidth < minWidth) {\n totalWidth = minWidth;\n }\n if (isValid(maxWidth)) {\n if (totalWidth > maxWidth) {\n totalWidth = maxWidth;\n }\n }\n\n if (isValid(minHeight) && totalHeight < minHeight) {\n totalHeight = minHeight;\n }\n\n if (isValid(maxHeight)) {\n if (totalHeight > maxHeight) {\n totalHeight = maxHeight;\n }\n }\n\n group.attribute.width = totalWidth;\n group.attribute.height = totalHeight;\n group.attribute.boundsPadding = parsedPadding;\n\n // 设置对齐\n if (this._mainTitle) {\n if (isValid(align) || isValid(textStyle.align)) {\n const mainTitleAlign = textStyle.align ? textStyle.align : align;\n const mainTitleWidth = textStyle.width ?? totalWidth;\n if (mainTitleAlign === 'center') {\n this._mainTitle.setAttribute('x', mainTitleWidth / 2);\n this._mainTitle.setAttribute('textAlign', 'center');\n } else if (mainTitleAlign === 'right') {\n this._mainTitle.setAttribute('x', mainTitleWidth);\n this._mainTitle.setAttribute('textAlign', 'right');\n } else {\n this._mainTitle.setAttribute('x', 0);\n this._mainTitle.setAttribute('textAlign', 'left');\n }\n }\n\n if (isValid(verticalAlign) || isValid(textStyle.verticalAlign)) {\n const mainTitleVerticalAlign = textStyle.verticalAlign ? textStyle.verticalAlign : verticalAlign;\n if (mainTitleVerticalAlign === 'middle' && isValid(fixedMainTitleHeight)) {\n this._mainTitle.setAttribute('y', fixedMainTitleHeight / 2);\n this._mainTitle.setAttribute('textBaseline', 'middle');\n } else if (mainTitleVerticalAlign === 'bottom' && isValid(fixedMainTitleHeight)) {\n this._mainTitle.setAttribute('y', fixedMainTitleHeight);\n this._mainTitle.setAttribute('textBaseline', 'bottom');\n } else {\n this._mainTitle.setAttribute('y', 0);\n this._mainTitle.setAttribute('textBaseline', 'top');\n }\n }\n }\n\n if (this._subTitle) {\n if (isValid(align) || isValid(subtextStyle.align)) {\n const subTitleAlign = subtextStyle.align ? subtextStyle.align : align;\n // 当subText没有设置显示的宽度,但是mainText设置了显示的宽度的时候,为mainText为主,因为默认subText要和mainText对齐\n const subTitleWidth = subtextStyle.width ?? textStyle.width ?? totalWidth;\n if (subTitleAlign === 'center') {\n this._subTitle.setAttribute('x', subTitleWidth / 2);\n this._subTitle.setAttribute('textAlign', 'center');\n } else if (subTitleAlign === 'right') {\n this._subTitle.setAttribute('x', subTitleWidth);\n this._subTitle.setAttribute('textAlign', 'right');\n } else {\n this._subTitle.setAttribute('x', 0);\n this._subTitle.setAttribute('textAlign', 'left');\n }\n }\n\n if (isValid(verticalAlign) || isValid(textStyle.verticalAlign)) {\n const subTitleVerticalAlign = subtextStyle.verticalAlign ? subtextStyle.verticalAlign : verticalAlign;\n const subTitleYStart = this._mainTitle\n ? isValid(fixedMainTitleHeight)\n ? // 如果是用户指定的高度,根据bounds的height 和指定高度求最大值\n this._mainTitle.AABBBounds.y1 + Math.max(this._mainTitle.AABBBounds.height(), fixedMainTitleHeight)\n : this._mainTitle.AABBBounds.y2\n : 0;\n const subTitleHeight = subtextStyle.height ?? height;\n if (subTitleVerticalAlign === 'middle' && isValid(subTitleHeight)) {\n this._subTitle.setAttribute('y', subTitleYStart + subTitleHeight / 2);\n this._subTitle.setAttribute('textBaseline', 'middle');\n } else if (subTitleVerticalAlign === 'bottom' && isValid(subTitleHeight)) {\n this._subTitle.setAttribute('y', subTitleYStart + subTitleHeight);\n this._subTitle.setAttribute('textBaseline', 'bottom');\n } else {\n this._subTitle.setAttribute('y', subTitleYStart);\n this._subTitle.setAttribute('textBaseline', 'top');\n }\n }\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/title/title.ts"],"names":[],"mappings":";;;AAIA,6CAA6E;AAC7E,uCAAiD;AAGjD,0CAAqD;AACrD,yCAAgD;AAEhD,IAAA,6BAAkB,GAAE,CAAC;AACrB,MAAa,KAAM,SAAQ,wBAAuC;IAyBhE,YAAY,UAAsB,EAAE,OAA0B;QAC5D,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAA,cAAK,EAAC,EAAE,EAAE,KAAK,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QAzB5F,SAAI,GAAG,OAAO,CAAC;IA0Bf,CAAC;IAES,MAAM;;QACd,MAAM,EACJ,QAAQ,EACR,IAAI,EACJ,WAAW,EACX,SAAS,GAAG,EAAE,EACd,OAAO,EACP,YAAY,GAAG,EAAE,EACjB,KAAK,EACL,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,SAAS,EACT,KAAK,EACL,aAAa,EACb,OAAO,G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AClE,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;iBACvD;aACF;SACF;IACH,CAAC;;AAxSH,sBAySC;AAnSQ,uBAAiB,GAAwB;IAC9C,SAAS,EAAE;QACT,QAAQ,EAAE,KAAK;QACf,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,MAAM;QAClB,SAAS,EAAE,MAAM;QACjB,YAAY,EAAE,KAAK;KACpB;IACD,YAAY,EAAE;QACZ,QAAQ,EAAE,KAAK;QACf,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,QAAQ;QACpB,SAAS,EAAE,MAAM;QACjB,YAAY,EAAE,KAAK;KACpB;CACF,CAAC","file":"title.js","sourcesContent":["/**\n * @description 标题组件\n */\nimport type { IGroup, IText, IRichText, IRichTextCharacter } from '@visactor/vrender-core';\nimport { merge, isValid, normalizePadding, isArray } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { TitleAttrs } from './type';\nimport type { ComponentOptions } from '../interface';\nimport { DEFAULT_HTML_TEXT_SPEC } from '../constant';\nimport { loadTitleComponent } from './register';\n\nloadTitleComponent();\nexport class Title extends AbstractComponent<Required<TitleAttrs>> {\n name = 'title';\n\n private _mainTitle?: IText | IRichText;\n private _subTitle?: IText | IRichText;\n\n static defaultAttributes: Partial<TitleAttrs> = {\n textStyle: {\n ellipsis: '...',\n fill: '#333',\n fontSize: 20,\n fontWeight: 'bold',\n textAlign: 'left',\n textBaseline: 'top'\n },\n subtextStyle: {\n ellipsis: '...',\n fill: '#6F6F6F',\n fontSize: 16,\n fontWeight: 'normal',\n textAlign: 'left',\n textBaseline: 'top'\n }\n };\n\n constructor(attributes: TitleAttrs, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, Title.defaultAttributes, attributes));\n }\n\n protected render() {\n const {\n textType,\n text,\n subtextType,\n textStyle = {},\n subtext,\n subtextStyle = {},\n width,\n height,\n minWidth,\n maxWidth,\n minHeight,\n maxHeight,\n align,\n verticalAlign,\n padding = 0\n } = this.attribute as TitleAttrs;\n\n const parsedPadding = normalizePadding(padding);\n\n const group = this.createOrUpdateChild(\n 'title-container',\n { x: parsedPadding[3], y: parsedPadding[0], zIndex: 1 },\n 'group'\n ) as IGroup;\n\n if (this.attribute.visible !== false && textStyle.visible !== false) {\n const {\n width: mainTitleWidth,\n height: mainTitleHeight,\n maxHeight: mainTitleMaxHeight,\n maxWidth: mainTitleMaxWidth,\n x = 0,\n y = 0,\n ellipsis = true,\n wordBreak = 'break-word',\n maxWidth,\n lineClamp\n } = textStyle;\n if (textType === 'rich' || isValid(textStyle.character)) {\n const attr = {\n x,\n y,\n width: mainTitleWidth ?? width ?? 0,\n height: mainTitleHeight ?? height ?? 0,\n ellipsis: ellipsis ?? true,\n wordBreak: wordBreak ?? 'break-word',\n maxHeight: mainTitleMaxHeight ?? maxHeight,\n maxWidth: mainTitleMaxWidth ?? maxWidth,\n // 兼容旧版富文本配置,如果未设置textType === 'rich',text内容为string 易报错\n textConfig: textStyle.character ?? (text as IRichTextCharacter[]),\n ...textStyle\n };\n this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext') as IRichText;\n } else if (textType === 'html') {\n const attr = {\n html: {\n dom: text as string,\n ...DEFAULT_HTML_TEXT_SPEC,\n ...textStyle\n },\n x,\n y,\n width: mainTitleWidth ?? width ?? 0,\n height: mainTitleHeight ?? height ?? 0,\n ellipsis,\n wordBreak,\n maxHeight: mainTitleMaxHeight ?? maxHeight,\n maxWidth: mainTitleMaxWidth ?? maxWidth,\n textConfig: [] as any[],\n ...textStyle\n };\n this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext') as IRichText;\n } else if (isValid(text)) {\n this._mainTitle = group.createOrUpdateChild(\n 'mainTitle',\n {\n text: isArray(text) ? (text as any) : [text as string],\n whiteSpace: 'normal',\n ...textStyle,\n maxLineWidth: textStyle.maxLineWidth ?? mainTitleWidth ?? width,\n heightLimit: mainTitleHeight ?? maxHeight,\n lineClamp,\n ellipsis,\n x,\n y\n },\n 'text'\n ) as IText;\n }\n }\n\n const maintextHeight = this._mainTitle ? this._mainTitle.AABBBounds.height() : 0;\n const maintextWidth = this._mainTitle ? this._mainTitle.AABBBounds.width() : 0;\n\n // 目前 height 限制等于 0 时,相当于 Infinity,无限制\n\n if (this.attribute.visible !== false && subtextStyle.visible !== false) {\n const {\n width: subTitleWidth,\n height: subTitleHeight,\n maxWidth: subTitleMaxWidth,\n maxHeight: subTitleMaxHeight,\n x = 0,\n y = 0,\n ellipsis = true,\n wordBreak = 'break-word',\n lineClamp\n } = subtextStyle;\n const maxSubTextHeight = Math.max(Number.MIN_VALUE, maxHeight - maintextHeight);\n\n if (subtextType === 'rich' || isValid(subtextStyle.character)) {\n const attr: any = {\n x,\n y,\n width: subTitleWidth ?? width ?? 0,\n height: subTitleHeight ?? height ?? 0,\n ellipsis,\n wordBreak,\n maxHeight: subTitleMaxHeight ?? maxSubTextHeight,\n maxWidth: subTitleMaxWidth ?? maxWidth,\n // 兼容旧版富文本配置,如果未设置textType === 'rich',text内容为string 易报错\n textConfig: subtextStyle.character ?? (subtext as IRichTextCharacter[]),\n ...subtextStyle\n };\n this._subTitle = group.createOrUpdateChild('subTitle', attr, 'richtext') as IRichText;\n } else if (subtextType === 'html') {\n const attr: any = {\n html: {\n dom: subtext as string,\n ...DEFAULT_HTML_TEXT_SPEC,\n ...subtextStyle\n },\n x,\n y,\n width: subTitleWidth ?? width ?? 0,\n height: subTitleHeight ?? height ?? 0,\n ellipsis,\n wordBreak,\n maxHeight: subTitleMaxHeight ?? maxSubTextHeight,\n maxWidth: subTitleMaxWidth ?? maxWidth,\n textConfig: [] as any[],\n ...subtextStyle\n };\n this._subTitle = group.createOrUpdateChild('subTitle', attr, 'richtext') as IRichText;\n } else if (isValid(subtext)) {\n this._subTitle = group.createOrUpdateChild(\n 'subTitle',\n {\n text: isArray(subtext) ? (subtext as any) : [subtext as string],\n whiteSpace: 'normal',\n ...subtextStyle,\n maxLineWidth: subtextStyle.maxLineWidth ?? width,\n heightLimit: subtextStyle.heightLimit ?? maxSubTextHeight,\n lineClamp,\n ellipsis,\n x: 0,\n y: maintextHeight\n },\n 'text'\n ) as IText;\n }\n }\n\n const subtextHeight = this._subTitle ? this._subTitle.AABBBounds.height() : 0;\n const subtextWidth = this._subTitle ? this._subTitle.AABBBounds.width() : 0;\n\n // 设置宽高\n let titleWidth = Math.max(maintextWidth, subtextWidth);\n let titleHeight = maintextHeight + (subtextStyle.height ?? subtextHeight);\n\n if (isValid(width)) {\n titleWidth = width;\n }\n\n if (isValid(height)) {\n titleHeight = height;\n }\n\n if (isValid(minWidth) && titleWidth < minWidth) {\n titleWidth = minWidth;\n }\n if (isValid(maxWidth)) {\n if (titleWidth > maxWidth) {\n titleWidth = maxWidth;\n }\n }\n\n if (isValid(minHeight) && titleHeight < minHeight) {\n titleHeight = minHeight;\n }\n\n if (isValid(maxHeight)) {\n if (titleHeight > maxHeight) {\n titleHeight = maxHeight;\n }\n }\n group.attribute.width = titleWidth;\n group.attribute.height = titleHeight;\n group.attribute.boundsPadding = parsedPadding;\n\n // 设置对齐\n if (this._mainTitle) {\n if (isValid(align) || isValid(textStyle.align)) {\n const mainTitleAlign = textStyle.align ? textStyle.align : align;\n const mainTitleWidth = textStyle.width ?? maintextWidth;\n if (mainTitleAlign === 'left') {\n this._mainTitle.setAttribute('x', 0);\n this._mainTitle.setAttribute('textAlign', 'left');\n } else if (mainTitleAlign === 'center') {\n this._mainTitle.setAttribute('x', mainTitleWidth / 2);\n this._mainTitle.setAttribute('textAlign', 'center');\n } else if (mainTitleAlign === 'right') {\n this._mainTitle.setAttribute('x', mainTitleWidth);\n this._mainTitle.setAttribute('textAlign', 'right');\n }\n }\n\n if (isValid(verticalAlign) || isValid(textStyle.verticalAlign)) {\n const mainTitleVerticalAlign = textStyle.verticalAlign ? textStyle.verticalAlign : verticalAlign;\n const mainTitleHeight = textStyle.height ? textStyle.height : titleHeight;\n if (mainTitleVerticalAlign === 'top') {\n this._mainTitle.setAttribute('y', 0);\n this._mainTitle.setAttribute('textBaseline', 'top');\n } else if (mainTitleVerticalAlign === 'middle') {\n this._mainTitle.setAttribute('y', mainTitleHeight / 2);\n this._mainTitle.setAttribute('textBaseline', 'middle');\n } else if (mainTitleVerticalAlign === 'bottom') {\n this._mainTitle.setAttribute('y', mainTitleHeight);\n this._mainTitle.setAttribute('textBaseline', 'bottom');\n }\n }\n }\n\n if (this._subTitle) {\n if (isValid(align) || isValid(subtextStyle.align)) {\n const subTitleAlign = subtextStyle.align ? subtextStyle.align : align;\n const subTitleWidth = subtextStyle.width ?? subtextWidth;\n if (subTitleAlign === 'left') {\n this._subTitle.setAttribute('x', 0);\n this._subTitle.setAttribute('textAlign', 'left');\n } else if (subTitleAlign === 'center') {\n this._subTitle.setAttribute('x', subTitleWidth / 2);\n this._subTitle.setAttribute('textAlign', 'center');\n } else if (subTitleAlign === 'right') {\n this._subTitle.setAttribute('x', subTitleWidth);\n this._subTitle.setAttribute('textAlign', 'right');\n }\n }\n\n if (isValid(verticalAlign) || isValid(textStyle.verticalAlign)) {\n const subTitleVerticalAlign = subtextStyle.verticalAlign ? subtextStyle.verticalAlign : verticalAlign;\n const subTitleYStart = maintextHeight;\n const subTitleHeight = subtextStyle.height ?? 0;\n if (subTitleVerticalAlign === 'top') {\n this._subTitle.setAttribute('y', subTitleYStart);\n this._subTitle.setAttribute('textBaseline', 'top');\n } else if (subTitleVerticalAlign === 'middle') {\n this._subTitle.setAttribute('y', subTitleYStart + subTitleHeight / 2);\n this._subTitle.setAttribute('textBaseline', 'middle');\n } else if (subTitleVerticalAlign === 'bottom') {\n this._subTitle.setAttribute('y', subTitleYStart + subTitleHeight);\n this._subTitle.setAttribute('textBaseline', 'bottom');\n }\n }\n }\n }\n}\n"]}
|
package/dist/index.es.js
CHANGED
|
@@ -618,12 +618,6 @@ let DefaultGlobal = class {
|
|
|
618
618
|
get env() {
|
|
619
619
|
return this._env;
|
|
620
620
|
}
|
|
621
|
-
get isImageAnonymous() {
|
|
622
|
-
return this._isImageAnonymous;
|
|
623
|
-
}
|
|
624
|
-
set isImageAnonymous(isImageAnonymous) {
|
|
625
|
-
this._isImageAnonymous = isImageAnonymous;
|
|
626
|
-
}
|
|
627
621
|
get devicePixelRatio() {
|
|
628
622
|
return this._env || this.setEnv("browser"), this.envContribution.getDevicePixelRatio();
|
|
629
623
|
}
|
|
@@ -658,7 +652,7 @@ let DefaultGlobal = class {
|
|
|
658
652
|
this._env || this.setEnv("browser"), this.envContribution.applyStyles = support;
|
|
659
653
|
}
|
|
660
654
|
constructor(contributions) {
|
|
661
|
-
this.contributions = contributions, this.
|
|
655
|
+
this.contributions = contributions, this.id = Generator.GenAutoIncrementId(), this.hooks = {
|
|
662
656
|
onSetEnv: new SyncHook(["lastEnv", "env", "global"])
|
|
663
657
|
}, this.measureTextMethod = "native", this.optimizeVisible = !1;
|
|
664
658
|
}
|
|
@@ -2420,6 +2414,7 @@ const DefaultTextAttribute = Object.assign(Object.assign(Object.assign({}, Defau
|
|
|
2420
2414
|
});
|
|
2421
2415
|
const DefaultRichTextAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultTextStyle), {
|
|
2422
2416
|
editable: !1,
|
|
2417
|
+
editOptions: null,
|
|
2423
2418
|
width: 300,
|
|
2424
2419
|
height: 300,
|
|
2425
2420
|
ellipsis: !0,
|
|
@@ -2864,7 +2859,7 @@ function measureTextCanvas(text, character) {
|
|
|
2864
2859
|
descent: 0,
|
|
2865
2860
|
width: 0
|
|
2866
2861
|
};
|
|
2867
|
-
return "number" != typeof measurement.
|
|
2862
|
+
return "number" != typeof measurement.fontBoundingBoxAscent || "number" != typeof measurement.fontBoundingBoxDescent ? (result.width = measurement.width, result.height = character.fontSize || 0, result.ascent = result.height, result.descent = 0) : (result.width = measurement.width, result.height = Math.floor(measurement.fontBoundingBoxAscent + measurement.fontBoundingBoxDescent), result.ascent = Math.floor(measurement.fontBoundingBoxAscent), result.descent = result.height - result.ascent), result;
|
|
2868
2863
|
}
|
|
2869
2864
|
|
|
2870
2865
|
var __decorate$O = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
@@ -5050,7 +5045,7 @@ class ResourceLoader {
|
|
|
5050
5045
|
}
|
|
5051
5046
|
static GetFile(url, type) {
|
|
5052
5047
|
let data = ResourceLoader.cache.get(url);
|
|
5053
|
-
return data ? "fail" === data.loadState ? Promise.reject() : "
|
|
5048
|
+
return data ? "init" === data.loadState || "fail" === data.loadState ? Promise.reject() : "loading" === data.loadState ? data.dataPromise.then(data => data.data) : Promise.resolve(data.data) : (data = {
|
|
5054
5049
|
type: type,
|
|
5055
5050
|
loadState: "init"
|
|
5056
5051
|
}, ResourceLoader.cache.set(url, data), "arrayBuffer" === type ? data.dataPromise = application.global.loadArrayBuffer(url) : "blob" === type ? data.dataPromise = application.global.loadBlob(url) : "json" === type && (data.dataPromise = application.global.loadJson(url)), data.dataPromise.then(data => data.data));
|
|
@@ -5159,7 +5154,7 @@ class Graphic extends Node {
|
|
|
5159
5154
|
}
|
|
5160
5155
|
}
|
|
5161
5156
|
get AABBBounds() {
|
|
5162
|
-
return this.tryUpdateAABBBounds(
|
|
5157
|
+
return this.tryUpdateAABBBounds();
|
|
5163
5158
|
}
|
|
5164
5159
|
get OBBBounds() {
|
|
5165
5160
|
return this.tryUpdateOBBBounds();
|
|
@@ -5203,12 +5198,13 @@ class Graphic extends Node {
|
|
|
5203
5198
|
onAnimateBind(animate) {
|
|
5204
5199
|
this._emitCustomEvent("animate-bind", animate);
|
|
5205
5200
|
}
|
|
5206
|
-
tryUpdateAABBBounds(
|
|
5201
|
+
tryUpdateAABBBounds() {
|
|
5202
|
+
const full = "imprecise" === this.attribute.boundsMode;
|
|
5207
5203
|
if (!this.shouldUpdateAABBBounds()) return this._AABBBounds;
|
|
5208
5204
|
if (!this.valid) return this._AABBBounds.clear(), this._AABBBounds;
|
|
5209
5205
|
application.graphicService.beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
|
|
5210
5206
|
const bounds = this.doUpdateAABBBounds(full);
|
|
5211
|
-
return application.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, !0), bounds;
|
|
5207
|
+
return application.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, !0), "empty" === this.attribute.boundsMode && bounds.clear(), bounds;
|
|
5212
5208
|
}
|
|
5213
5209
|
tryUpdateOBBBounds() {
|
|
5214
5210
|
if (this._OBBBounds || (this._OBBBounds = new OBBBounds()), this.tryUpdateAABBBounds(), this.updateOBBBoundsStamp === this.updateAABBBoundsStamp) return this._OBBBounds;
|
|
@@ -5452,7 +5448,7 @@ class Graphic extends Node {
|
|
|
5452
5448
|
context && context.skipUpdateCallback || (application.graphicService.onAttributeUpdate(this), this._emitCustomEvent("afterAttributeUpdate", context));
|
|
5453
5449
|
}
|
|
5454
5450
|
update(d) {
|
|
5455
|
-
d ? (d.bounds && this.tryUpdateAABBBounds(
|
|
5451
|
+
d ? (d.bounds && this.tryUpdateAABBBounds(), d.trans && this.tryUpdateLocalTransMatrix()) : (this.tryUpdateAABBBounds(), this.tryUpdateLocalTransMatrix());
|
|
5456
5452
|
}
|
|
5457
5453
|
hasState(stateName) {
|
|
5458
5454
|
return !(!this.currentStates || !this.currentStates.length) && (!!isNil(stateName) || this.currentStates.includes(stateName));
|
|
@@ -6162,7 +6158,7 @@ class Group extends Graphic {
|
|
|
6162
6158
|
application.graphicService.beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
|
|
6163
6159
|
const selfChange = this.shouldSelfChangeUpdateAABBBounds(),
|
|
6164
6160
|
bounds = this.doUpdateAABBBounds();
|
|
6165
|
-
return this.addUpdateLayoutTag(), application.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, selfChange), bounds;
|
|
6161
|
+
return this.addUpdateLayoutTag(), application.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, selfChange), "empty" === this.attribute.boundsMode && bounds.clear(), bounds;
|
|
6166
6162
|
}
|
|
6167
6163
|
doUpdateLocalMatrix() {
|
|
6168
6164
|
const {
|
|
@@ -8286,7 +8282,7 @@ class CustomSymbolClass {
|
|
|
8286
8282
|
return isNumber(size) ? size : Math.min(size[0], size[1]);
|
|
8287
8283
|
}
|
|
8288
8284
|
drawWithClipRange(ctx, size, x, y, clipRange, z, cb) {
|
|
8289
|
-
return this.isSvg ? !!this.svgCache && (this.svgCache.forEach(item => {
|
|
8285
|
+
return size = this.parseSize(size), this.isSvg ? !!this.svgCache && (this.svgCache.forEach(item => {
|
|
8290
8286
|
item.path.drawWithClipRange(ctx, size, x, y, clipRange), cb && cb(item.path, item.attribute);
|
|
8291
8287
|
}), !1) : (this.path.drawWithClipRange(ctx, size, x, y, clipRange), !1);
|
|
8292
8288
|
}
|
|
@@ -8749,6 +8745,14 @@ class Frame {
|
|
|
8749
8745
|
}
|
|
8750
8746
|
}
|
|
8751
8747
|
|
|
8748
|
+
function getFixedLRTB(left, right, top, bottom) {
|
|
8749
|
+
return {
|
|
8750
|
+
left: Math.round(left),
|
|
8751
|
+
top: Math.round(top),
|
|
8752
|
+
right: Math.round(right),
|
|
8753
|
+
bottom: Math.round(bottom)
|
|
8754
|
+
};
|
|
8755
|
+
}
|
|
8752
8756
|
class Paragraph {
|
|
8753
8757
|
constructor(text, newLine, character) {
|
|
8754
8758
|
this.fontSize = character.fontSize || 16, this.textBaseline = character.textBaseline || "alphabetic";
|
|
@@ -8771,7 +8775,32 @@ class Paragraph {
|
|
|
8771
8775
|
} = measureTextCanvas(this.text, this.character);
|
|
8772
8776
|
this.width = width, "vertical" === this.direction && (this.widthOrigin = this.width, this.width = this.heightOrigin, this.height = this.widthOrigin);
|
|
8773
8777
|
}
|
|
8774
|
-
|
|
8778
|
+
drawBackground(ctx, top, ascent, deltaLeft, isLineFirst, textAlign, lineHeight) {
|
|
8779
|
+
if (!this.character.background || this.character.backgroundOpacity && !(this.character.backgroundOpacity > 0)) return;
|
|
8780
|
+
let baseline = top + ascent,
|
|
8781
|
+
text = this.text,
|
|
8782
|
+
left = this.left + deltaLeft;
|
|
8783
|
+
baseline += this.top;
|
|
8784
|
+
let direction = this.direction;
|
|
8785
|
+
if (this.verticalEllipsis) text = this.ellipsisStr, direction = "vertical", baseline -= this.ellipsisWidth / 2;else {
|
|
8786
|
+
if ("hide" === this.ellipsis) return;
|
|
8787
|
+
if ("add" === this.ellipsis) text += this.ellipsisStr, "right" !== textAlign && "end" !== textAlign || (left -= this.ellipsisWidth);else if ("replace" === this.ellipsis) {
|
|
8788
|
+
const index = getStrByWithCanvas(text, ("vertical" === direction ? this.height : this.width) - this.ellipsisWidth + this.ellipsisOtherParagraphWidth, this.character, text.length - 1);
|
|
8789
|
+
if (text = text.slice(0, index), text += this.ellipsisStr, "right" === textAlign || "end" === textAlign) {
|
|
8790
|
+
const {
|
|
8791
|
+
width: width
|
|
8792
|
+
} = measureTextCanvas(this.text.slice(index), this.character);
|
|
8793
|
+
"vertical" === direction || (left -= this.ellipsisWidth - width);
|
|
8794
|
+
}
|
|
8795
|
+
}
|
|
8796
|
+
}
|
|
8797
|
+
const lrtb = getFixedLRTB(left, left + (this.widthOrigin || this.width), top, top + lineHeight);
|
|
8798
|
+
return Object.assign(Object.assign({}, lrtb), {
|
|
8799
|
+
fillStyle: this.character.background,
|
|
8800
|
+
globalAlpha: this.character.backgroundOpacity
|
|
8801
|
+
});
|
|
8802
|
+
}
|
|
8803
|
+
draw(ctx, top, ascent, deltaLeft, isLineFirst, textAlign, lineHeight) {
|
|
8775
8804
|
let baseline = top + ascent,
|
|
8776
8805
|
text = this.text,
|
|
8777
8806
|
left = this.left + deltaLeft;
|
|
@@ -8796,15 +8825,31 @@ class Paragraph {
|
|
|
8796
8825
|
case "sub":
|
|
8797
8826
|
baseline += this.descent / 2;
|
|
8798
8827
|
}
|
|
8799
|
-
|
|
8800
|
-
const fillStyle = ctx.fillStyle,
|
|
8801
|
-
globalAlpha = ctx.globalAlpha;
|
|
8802
|
-
ctx.fillStyle = this.character.background, void 0 !== this.character.backgroundOpacity && (ctx.globalAlpha = this.character.backgroundOpacity), ctx.fillRect(left, top, this.widthOrigin || this.width, this.lineHeight), ctx.fillStyle = fillStyle, ctx.globalAlpha = globalAlpha;
|
|
8803
|
-
}
|
|
8828
|
+
"vertical" === direction && (ctx.save(), ctx.rotateAbout(Math.PI / 2, left, baseline), ctx.translate(-this.heightOrigin || -this.lineHeight / 2, -this.descent / 2), ctx.translate(left, baseline), left = 0, baseline = 0);
|
|
8804
8829
|
const {
|
|
8805
8830
|
lineWidth = 1
|
|
8806
8831
|
} = this.character;
|
|
8807
|
-
this.character.stroke && lineWidth && ctx.strokeText(text, left, baseline), this.character.fill && ctx.fillText(text, left, baseline), this.character.fill
|
|
8832
|
+
if (this.character.stroke && lineWidth && ctx.strokeText(text, left, baseline), this.character.fill && ctx.fillText(text, left, baseline), this.character.fill) if (this.character.lineThrough || this.character.underline) {
|
|
8833
|
+
if (this.character.underline) {
|
|
8834
|
+
const top = 1 + baseline,
|
|
8835
|
+
lrtb = getFixedLRTB(left, left + (this.widthOrigin || this.width), top, top + (this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1));
|
|
8836
|
+
ctx.fillRect(lrtb.left, lrtb.top, lrtb.right - lrtb.left, lrtb.bottom - lrtb.top);
|
|
8837
|
+
}
|
|
8838
|
+
if (this.character.lineThrough) {
|
|
8839
|
+
const top = 1 + baseline - this.ascent / 2,
|
|
8840
|
+
lrtb = getFixedLRTB(left, left + (this.widthOrigin || this.width), top, top + (this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1));
|
|
8841
|
+
ctx.fillRect(lrtb.left, lrtb.top, lrtb.right - lrtb.left, lrtb.bottom - lrtb.top);
|
|
8842
|
+
}
|
|
8843
|
+
} else if ("underline" === this.character.textDecoration) {
|
|
8844
|
+
const top = 1 + baseline,
|
|
8845
|
+
lrtb = getFixedLRTB(left, left + (this.widthOrigin || this.width), top, top + (this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1));
|
|
8846
|
+
ctx.fillRect(lrtb.left, lrtb.top, lrtb.right - lrtb.left, lrtb.bottom - lrtb.top);
|
|
8847
|
+
} else if ("line-through" === this.character.textDecoration) {
|
|
8848
|
+
const top = 1 + baseline - this.ascent / 2,
|
|
8849
|
+
lrtb = getFixedLRTB(left, left + (this.widthOrigin || this.width), top, top + (this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1));
|
|
8850
|
+
ctx.fillRect(lrtb.left, lrtb.top, lrtb.right - lrtb.left, lrtb.bottom - lrtb.top);
|
|
8851
|
+
}
|
|
8852
|
+
"vertical" === direction && ctx.restore();
|
|
8808
8853
|
}
|
|
8809
8854
|
getWidthWithEllips(direction) {
|
|
8810
8855
|
let text = this.text;
|
|
@@ -9027,7 +9072,20 @@ class Line {
|
|
|
9027
9072
|
paragraph.ellipsis = "hide", otherParagraphWidth += paragraph.width;
|
|
9028
9073
|
}
|
|
9029
9074
|
}
|
|
9075
|
+
let fillStyle = "",
|
|
9076
|
+
globalAlpha = -1,
|
|
9077
|
+
currBgList = [];
|
|
9078
|
+
const bgList = [currBgList];
|
|
9030
9079
|
this.paragraphs.forEach((paragraph, index) => {
|
|
9080
|
+
if (paragraph instanceof RichTextIcon) return;
|
|
9081
|
+
const data = paragraph.drawBackground(ctx, y, this.ascent, x, 0 === index, this.textAlign, this.height);
|
|
9082
|
+
data && (fillStyle === data.fillStyle && globalAlpha === data.globalAlpha || (currBgList = [], bgList.push(currBgList), fillStyle = data.fillStyle, globalAlpha = data.globalAlpha), currBgList.push(data));
|
|
9083
|
+
}), bgList.forEach(bg => {
|
|
9084
|
+
if (0 === bg.length) return;
|
|
9085
|
+
const data = bg[0],
|
|
9086
|
+
end = bg[bg.length - 1];
|
|
9087
|
+
ctx.fillStyle = data.fillStyle, ctx.globalAlpha = data.globalAlpha, ctx.fillRect(data.left, data.top, end.right - data.left, end.bottom - data.top);
|
|
9088
|
+
}), this.paragraphs.forEach((paragraph, index) => {
|
|
9031
9089
|
if (paragraph instanceof RichTextIcon) return paragraph.setAttributes({
|
|
9032
9090
|
x: x + paragraph._x,
|
|
9033
9091
|
y: y + paragraph._y
|
|
@@ -9038,7 +9096,7 @@ class Line {
|
|
|
9038
9096
|
x2: this.left + this.actualWidth,
|
|
9039
9097
|
y2: this.top + this.height
|
|
9040
9098
|
};
|
|
9041
|
-
applyStrokeStyle(ctx, paragraph.character), applyFillStyle(ctx, paragraph.character, b), paragraph.draw(ctx, y, this.ascent, x, 0 === index, this.textAlign);
|
|
9099
|
+
applyStrokeStyle(ctx, paragraph.character), applyFillStyle(ctx, paragraph.character, b), paragraph.draw(ctx, y, this.ascent, x, 0 === index, this.textAlign, this.height);
|
|
9042
9100
|
});
|
|
9043
9101
|
}
|
|
9044
9102
|
getWidthWithEllips(ellipsis) {
|
|
@@ -9189,7 +9247,13 @@ class RichText extends Graphic {
|
|
|
9189
9247
|
}
|
|
9190
9248
|
return cache.every(item => item.isComposing || !(item.text && isString(item.text) && RichText.splitText(item.text).length > 1));
|
|
9191
9249
|
}
|
|
9250
|
+
static splitEmoji(text) {
|
|
9251
|
+
return [...new Intl.Segmenter().segment(text)].map(x => x.segment);
|
|
9252
|
+
}
|
|
9192
9253
|
static splitText(text) {
|
|
9254
|
+
try {
|
|
9255
|
+
return this.splitEmoji(text);
|
|
9256
|
+
} catch (e) {}
|
|
9193
9257
|
return Array.from(text);
|
|
9194
9258
|
}
|
|
9195
9259
|
static TransformTextConfig2SingleCharacter(textConfig) {
|
|
@@ -9205,13 +9269,15 @@ class RichText extends Graphic {
|
|
|
9205
9269
|
}), tc;
|
|
9206
9270
|
}
|
|
9207
9271
|
updateAABBBounds(attribute, richtextTheme, aabbBounds) {
|
|
9272
|
+
var _a, _b;
|
|
9208
9273
|
const {
|
|
9209
9274
|
width = richtextTheme.width,
|
|
9210
9275
|
height = richtextTheme.height,
|
|
9211
9276
|
maxWidth = richtextTheme.maxWidth,
|
|
9212
9277
|
maxHeight = richtextTheme.maxHeight,
|
|
9213
9278
|
textAlign = richtextTheme.textAlign,
|
|
9214
|
-
textBaseline = richtextTheme.textBaseline
|
|
9279
|
+
textBaseline = richtextTheme.textBaseline,
|
|
9280
|
+
editOptions: editOptions
|
|
9215
9281
|
} = attribute;
|
|
9216
9282
|
if (width > 0 && height > 0) aabbBounds.set(0, 0, width, height);else {
|
|
9217
9283
|
const frameCache = this.getFrameCache(),
|
|
@@ -9223,6 +9289,7 @@ class RichText extends Graphic {
|
|
|
9223
9289
|
contentHeight = height || actualHeight || 0;
|
|
9224
9290
|
contentHeight = "number" == typeof maxHeight && contentHeight > maxHeight ? maxHeight : contentHeight || 0, contentWidth = "number" == typeof maxWidth && contentWidth > maxWidth ? maxWidth : contentWidth || 0, aabbBounds.set(0, 0, contentWidth, contentHeight);
|
|
9225
9291
|
}
|
|
9292
|
+
editOptions && editOptions.keepHeightWhileEmpty && !aabbBounds.height() && !(null === (_a = attribute.textConfig) || void 0 === _a ? void 0 : _a.length) && (aabbBounds.y2 = aabbBounds.y1 + (null !== (_b = attribute.fontSize) && void 0 !== _b ? _b : 12), aabbBounds.x2 = aabbBounds.x1 + 2);
|
|
9226
9293
|
let deltaY = 0;
|
|
9227
9294
|
switch (textBaseline) {
|
|
9228
9295
|
case "top":
|
|
@@ -10609,8 +10676,8 @@ class DefaultImageRenderContribution extends DefaultRectRenderContribution {
|
|
|
10609
10676
|
constructor() {
|
|
10610
10677
|
super(...arguments), this.time = BaseRenderContributionTime.afterFillStroke, this.useStyle = !0, this.order = 0;
|
|
10611
10678
|
}
|
|
10612
|
-
drawShape(
|
|
10613
|
-
return super.drawShape(
|
|
10679
|
+
drawShape(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb) {
|
|
10680
|
+
return super.drawShape(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb);
|
|
10614
10681
|
}
|
|
10615
10682
|
}
|
|
10616
10683
|
const defaultImageRenderContribution = new DefaultImageRenderContribution();
|
|
@@ -13058,7 +13125,7 @@ let DefaultDrawContribution = class {
|
|
|
13058
13125
|
renderGroup(group, drawContext, parentMatrix, skipSort) {
|
|
13059
13126
|
if (drawContext.break || !1 === group.attribute.visibleAll) return;
|
|
13060
13127
|
if (group.incremental && (null == drawContext.startAtId || drawContext.startAtId === group._uid)) return drawContext.break = !0, void this._increaseRender(group, drawContext);
|
|
13061
|
-
if (this.useDirtyBounds && !isRectIntersect(group.AABBBounds, this.dirtyBounds, !1)) return;
|
|
13128
|
+
if (this.useDirtyBounds && !isRectIntersect(group.AABBBounds, this.dirtyBounds, !1) && "empty" !== group.attribute.boundsMode) return;
|
|
13062
13129
|
let tempBounds,
|
|
13063
13130
|
nextM = parentMatrix;
|
|
13064
13131
|
if (this.useDirtyBounds) {
|
|
@@ -13139,7 +13206,7 @@ let DefaultDrawContribution = class {
|
|
|
13139
13206
|
} = graphic.parent.attribute;
|
|
13140
13207
|
(scrollX || scrollY) && (retrans = !0, this.scrollMatrix || (this.scrollMatrix = matrixAllocate.allocate(1, 0, 0, 1, 0, 0)), this.scrollMatrix.translate(-scrollX, -scrollY));
|
|
13141
13208
|
}
|
|
13142
|
-
if (retrans && (tempBounds = this.dirtyBounds.clone().transformWithMatrix(this.scrollMatrix)), this.useDirtyBounds && !graphic.isContainer && !isRectIntersect(graphic.AABBBounds, null != tempBounds ? tempBounds : this.dirtyBounds, !1)) {
|
|
13209
|
+
if (retrans && (tempBounds = this.dirtyBounds.clone().transformWithMatrix(this.scrollMatrix)), this.useDirtyBounds && !graphic.isContainer && "empty" !== graphic.attribute.boundsMode && !isRectIntersect(graphic.AABBBounds, null != tempBounds ? tempBounds : this.dirtyBounds, !1)) {
|
|
13143
13210
|
if (retrans && graphic.parent) {
|
|
13144
13211
|
const {
|
|
13145
13212
|
scrollX = 0,
|
|
@@ -28089,36 +28156,35 @@ class Title extends AbstractComponent {
|
|
|
28089
28156
|
this.name = 'title';
|
|
28090
28157
|
}
|
|
28091
28158
|
render() {
|
|
28092
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t
|
|
28159
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
28093
28160
|
const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute;
|
|
28094
28161
|
const parsedPadding = normalizePadding(padding);
|
|
28095
28162
|
const group = this.createOrUpdateChild('title-container', { x: parsedPadding[3], y: parsedPadding[0], zIndex: 1 }, 'group');
|
|
28096
|
-
const fixedMainTitleHeight = (_a = textStyle.height) !== null && _a !== void 0 ? _a : height;
|
|
28097
28163
|
if (this.attribute.visible !== false && textStyle.visible !== false) {
|
|
28098
|
-
const { width: mainTitleWidth, maxHeight: mainTitleMaxHeight, maxWidth: mainTitleMaxWidth, x = 0, y = 0, ellipsis = true, wordBreak = 'break-word', maxWidth, lineClamp } = textStyle;
|
|
28164
|
+
const { width: mainTitleWidth, height: mainTitleHeight, maxHeight: mainTitleMaxHeight, maxWidth: mainTitleMaxWidth, x = 0, y = 0, ellipsis = true, wordBreak = 'break-word', maxWidth, lineClamp } = textStyle;
|
|
28099
28165
|
if (textType === 'rich' || isValid(textStyle.character)) {
|
|
28100
28166
|
const attr = Object.assign({ x,
|
|
28101
|
-
y, width: (
|
|
28167
|
+
y, width: (_a = mainTitleWidth !== null && mainTitleWidth !== void 0 ? mainTitleWidth : width) !== null && _a !== void 0 ? _a : 0, height: (_b = mainTitleHeight !== null && mainTitleHeight !== void 0 ? mainTitleHeight : height) !== null && _b !== void 0 ? _b : 0, ellipsis: ellipsis !== null && ellipsis !== void 0 ? ellipsis : true, wordBreak: wordBreak !== null && wordBreak !== void 0 ? wordBreak : 'break-word', maxHeight: mainTitleMaxHeight !== null && mainTitleMaxHeight !== void 0 ? mainTitleMaxHeight : maxHeight, maxWidth: mainTitleMaxWidth !== null && mainTitleMaxWidth !== void 0 ? mainTitleMaxWidth : maxWidth, textConfig: (_c = textStyle.character) !== null && _c !== void 0 ? _c : text }, textStyle);
|
|
28102
28168
|
this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext');
|
|
28103
28169
|
}
|
|
28104
28170
|
else if (textType === 'html') {
|
|
28105
28171
|
const attr = Object.assign({ html: Object.assign(Object.assign({ dom: text }, DEFAULT_HTML_TEXT_SPEC), textStyle), x,
|
|
28106
|
-
y, width: (_d = mainTitleWidth !== null && mainTitleWidth !== void 0 ? mainTitleWidth : width) !== null && _d !== void 0 ? _d : 0, height:
|
|
28172
|
+
y, width: (_d = mainTitleWidth !== null && mainTitleWidth !== void 0 ? mainTitleWidth : width) !== null && _d !== void 0 ? _d : 0, height: (_e = mainTitleHeight !== null && mainTitleHeight !== void 0 ? mainTitleHeight : height) !== null && _e !== void 0 ? _e : 0, ellipsis,
|
|
28107
28173
|
wordBreak, maxHeight: mainTitleMaxHeight !== null && mainTitleMaxHeight !== void 0 ? mainTitleMaxHeight : maxHeight, maxWidth: mainTitleMaxWidth !== null && mainTitleMaxWidth !== void 0 ? mainTitleMaxWidth : maxWidth, textConfig: [] }, textStyle);
|
|
28108
28174
|
this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext');
|
|
28109
28175
|
}
|
|
28110
28176
|
else if (isValid(text)) {
|
|
28111
|
-
this._mainTitle = group.createOrUpdateChild('mainTitle', Object.assign(Object.assign({ text: isArray(text) ? text : [text], whiteSpace: 'normal' }, textStyle), { maxLineWidth: (
|
|
28177
|
+
this._mainTitle = group.createOrUpdateChild('mainTitle', Object.assign(Object.assign({ text: isArray(text) ? text : [text], whiteSpace: 'normal' }, textStyle), { maxLineWidth: (_g = (_f = textStyle.maxLineWidth) !== null && _f !== void 0 ? _f : mainTitleWidth) !== null && _g !== void 0 ? _g : width, heightLimit: mainTitleHeight !== null && mainTitleHeight !== void 0 ? mainTitleHeight : maxHeight, lineClamp,
|
|
28112
28178
|
ellipsis,
|
|
28113
28179
|
x,
|
|
28114
28180
|
y }), 'text');
|
|
28115
28181
|
}
|
|
28116
28182
|
}
|
|
28117
|
-
const
|
|
28118
|
-
const
|
|
28183
|
+
const maintextHeight = this._mainTitle ? this._mainTitle.AABBBounds.height() : 0;
|
|
28184
|
+
const maintextWidth = this._mainTitle ? this._mainTitle.AABBBounds.width() : 0;
|
|
28119
28185
|
if (this.attribute.visible !== false && subtextStyle.visible !== false) {
|
|
28120
28186
|
const { width: subTitleWidth, height: subTitleHeight, maxWidth: subTitleMaxWidth, maxHeight: subTitleMaxHeight, x = 0, y = 0, ellipsis = true, wordBreak = 'break-word', lineClamp } = subtextStyle;
|
|
28121
|
-
const maxSubTextHeight = Math.max(Number.MIN_VALUE, maxHeight -
|
|
28187
|
+
const maxSubTextHeight = Math.max(Number.MIN_VALUE, maxHeight - maintextHeight);
|
|
28122
28188
|
if (subtextType === 'rich' || isValid(subtextStyle.character)) {
|
|
28123
28189
|
const attr = Object.assign({ x,
|
|
28124
28190
|
y, width: (_h = subTitleWidth !== null && subTitleWidth !== void 0 ? subTitleWidth : width) !== null && _h !== void 0 ? _h : 0, height: (_j = subTitleHeight !== null && subTitleHeight !== void 0 ? subTitleHeight : height) !== null && _j !== void 0 ? _j : 0, ellipsis,
|
|
@@ -28133,43 +28199,47 @@ class Title extends AbstractComponent {
|
|
|
28133
28199
|
}
|
|
28134
28200
|
else if (isValid(subtext)) {
|
|
28135
28201
|
this._subTitle = group.createOrUpdateChild('subTitle', Object.assign(Object.assign({ text: isArray(subtext) ? subtext : [subtext], whiteSpace: 'normal' }, subtextStyle), { maxLineWidth: (_o = subtextStyle.maxLineWidth) !== null && _o !== void 0 ? _o : width, heightLimit: (_p = subtextStyle.heightLimit) !== null && _p !== void 0 ? _p : maxSubTextHeight, lineClamp,
|
|
28136
|
-
ellipsis, x: 0, y:
|
|
28202
|
+
ellipsis, x: 0, y: maintextHeight }), 'text');
|
|
28137
28203
|
}
|
|
28138
28204
|
}
|
|
28139
|
-
const
|
|
28140
|
-
const
|
|
28141
|
-
let
|
|
28142
|
-
let
|
|
28205
|
+
const subtextHeight = this._subTitle ? this._subTitle.AABBBounds.height() : 0;
|
|
28206
|
+
const subtextWidth = this._subTitle ? this._subTitle.AABBBounds.width() : 0;
|
|
28207
|
+
let titleWidth = Math.max(maintextWidth, subtextWidth);
|
|
28208
|
+
let titleHeight = maintextHeight + ((_q = subtextStyle.height) !== null && _q !== void 0 ? _q : subtextHeight);
|
|
28143
28209
|
if (isValid(width)) {
|
|
28144
|
-
|
|
28210
|
+
titleWidth = width;
|
|
28145
28211
|
}
|
|
28146
28212
|
if (isValid(height)) {
|
|
28147
|
-
|
|
28213
|
+
titleHeight = height;
|
|
28148
28214
|
}
|
|
28149
|
-
if (isValid(minWidth) &&
|
|
28150
|
-
|
|
28215
|
+
if (isValid(minWidth) && titleWidth < minWidth) {
|
|
28216
|
+
titleWidth = minWidth;
|
|
28151
28217
|
}
|
|
28152
28218
|
if (isValid(maxWidth)) {
|
|
28153
|
-
if (
|
|
28154
|
-
|
|
28219
|
+
if (titleWidth > maxWidth) {
|
|
28220
|
+
titleWidth = maxWidth;
|
|
28155
28221
|
}
|
|
28156
28222
|
}
|
|
28157
|
-
if (isValid(minHeight) &&
|
|
28158
|
-
|
|
28223
|
+
if (isValid(minHeight) && titleHeight < minHeight) {
|
|
28224
|
+
titleHeight = minHeight;
|
|
28159
28225
|
}
|
|
28160
28226
|
if (isValid(maxHeight)) {
|
|
28161
|
-
if (
|
|
28162
|
-
|
|
28227
|
+
if (titleHeight > maxHeight) {
|
|
28228
|
+
titleHeight = maxHeight;
|
|
28163
28229
|
}
|
|
28164
28230
|
}
|
|
28165
|
-
group.attribute.width =
|
|
28166
|
-
group.attribute.height =
|
|
28231
|
+
group.attribute.width = titleWidth;
|
|
28232
|
+
group.attribute.height = titleHeight;
|
|
28167
28233
|
group.attribute.boundsPadding = parsedPadding;
|
|
28168
28234
|
if (this._mainTitle) {
|
|
28169
28235
|
if (isValid(align) || isValid(textStyle.align)) {
|
|
28170
28236
|
const mainTitleAlign = textStyle.align ? textStyle.align : align;
|
|
28171
|
-
const mainTitleWidth = (_r = textStyle.width) !== null && _r !== void 0 ? _r :
|
|
28172
|
-
if (mainTitleAlign === '
|
|
28237
|
+
const mainTitleWidth = (_r = textStyle.width) !== null && _r !== void 0 ? _r : maintextWidth;
|
|
28238
|
+
if (mainTitleAlign === 'left') {
|
|
28239
|
+
this._mainTitle.setAttribute('x', 0);
|
|
28240
|
+
this._mainTitle.setAttribute('textAlign', 'left');
|
|
28241
|
+
}
|
|
28242
|
+
else if (mainTitleAlign === 'center') {
|
|
28173
28243
|
this._mainTitle.setAttribute('x', mainTitleWidth / 2);
|
|
28174
28244
|
this._mainTitle.setAttribute('textAlign', 'center');
|
|
28175
28245
|
}
|
|
@@ -28177,32 +28247,33 @@ class Title extends AbstractComponent {
|
|
|
28177
28247
|
this._mainTitle.setAttribute('x', mainTitleWidth);
|
|
28178
28248
|
this._mainTitle.setAttribute('textAlign', 'right');
|
|
28179
28249
|
}
|
|
28180
|
-
else {
|
|
28181
|
-
this._mainTitle.setAttribute('x', 0);
|
|
28182
|
-
this._mainTitle.setAttribute('textAlign', 'left');
|
|
28183
|
-
}
|
|
28184
28250
|
}
|
|
28185
28251
|
if (isValid(verticalAlign) || isValid(textStyle.verticalAlign)) {
|
|
28186
28252
|
const mainTitleVerticalAlign = textStyle.verticalAlign ? textStyle.verticalAlign : verticalAlign;
|
|
28187
|
-
|
|
28188
|
-
|
|
28253
|
+
const mainTitleHeight = textStyle.height ? textStyle.height : titleHeight;
|
|
28254
|
+
if (mainTitleVerticalAlign === 'top') {
|
|
28255
|
+
this._mainTitle.setAttribute('y', 0);
|
|
28256
|
+
this._mainTitle.setAttribute('textBaseline', 'top');
|
|
28257
|
+
}
|
|
28258
|
+
else if (mainTitleVerticalAlign === 'middle') {
|
|
28259
|
+
this._mainTitle.setAttribute('y', mainTitleHeight / 2);
|
|
28189
28260
|
this._mainTitle.setAttribute('textBaseline', 'middle');
|
|
28190
28261
|
}
|
|
28191
|
-
else if (mainTitleVerticalAlign === 'bottom'
|
|
28192
|
-
this._mainTitle.setAttribute('y',
|
|
28262
|
+
else if (mainTitleVerticalAlign === 'bottom') {
|
|
28263
|
+
this._mainTitle.setAttribute('y', mainTitleHeight);
|
|
28193
28264
|
this._mainTitle.setAttribute('textBaseline', 'bottom');
|
|
28194
28265
|
}
|
|
28195
|
-
else {
|
|
28196
|
-
this._mainTitle.setAttribute('y', 0);
|
|
28197
|
-
this._mainTitle.setAttribute('textBaseline', 'top');
|
|
28198
|
-
}
|
|
28199
28266
|
}
|
|
28200
28267
|
}
|
|
28201
28268
|
if (this._subTitle) {
|
|
28202
28269
|
if (isValid(align) || isValid(subtextStyle.align)) {
|
|
28203
28270
|
const subTitleAlign = subtextStyle.align ? subtextStyle.align : align;
|
|
28204
|
-
const subTitleWidth = (
|
|
28205
|
-
if (subTitleAlign === '
|
|
28271
|
+
const subTitleWidth = (_s = subtextStyle.width) !== null && _s !== void 0 ? _s : subtextWidth;
|
|
28272
|
+
if (subTitleAlign === 'left') {
|
|
28273
|
+
this._subTitle.setAttribute('x', 0);
|
|
28274
|
+
this._subTitle.setAttribute('textAlign', 'left');
|
|
28275
|
+
}
|
|
28276
|
+
else if (subTitleAlign === 'center') {
|
|
28206
28277
|
this._subTitle.setAttribute('x', subTitleWidth / 2);
|
|
28207
28278
|
this._subTitle.setAttribute('textAlign', 'center');
|
|
28208
28279
|
}
|
|
@@ -28210,32 +28281,23 @@ class Title extends AbstractComponent {
|
|
|
28210
28281
|
this._subTitle.setAttribute('x', subTitleWidth);
|
|
28211
28282
|
this._subTitle.setAttribute('textAlign', 'right');
|
|
28212
28283
|
}
|
|
28213
|
-
else {
|
|
28214
|
-
this._subTitle.setAttribute('x', 0);
|
|
28215
|
-
this._subTitle.setAttribute('textAlign', 'left');
|
|
28216
|
-
}
|
|
28217
28284
|
}
|
|
28218
28285
|
if (isValid(verticalAlign) || isValid(textStyle.verticalAlign)) {
|
|
28219
28286
|
const subTitleVerticalAlign = subtextStyle.verticalAlign ? subtextStyle.verticalAlign : verticalAlign;
|
|
28220
|
-
const subTitleYStart =
|
|
28221
|
-
|
|
28222
|
-
|
|
28223
|
-
|
|
28224
|
-
|
|
28225
|
-
|
|
28226
|
-
|
|
28227
|
-
if (subTitleVerticalAlign === 'middle' && isValid(subTitleHeight)) {
|
|
28287
|
+
const subTitleYStart = maintextHeight;
|
|
28288
|
+
const subTitleHeight = (_t = subtextStyle.height) !== null && _t !== void 0 ? _t : 0;
|
|
28289
|
+
if (subTitleVerticalAlign === 'top') {
|
|
28290
|
+
this._subTitle.setAttribute('y', subTitleYStart);
|
|
28291
|
+
this._subTitle.setAttribute('textBaseline', 'top');
|
|
28292
|
+
}
|
|
28293
|
+
else if (subTitleVerticalAlign === 'middle') {
|
|
28228
28294
|
this._subTitle.setAttribute('y', subTitleYStart + subTitleHeight / 2);
|
|
28229
28295
|
this._subTitle.setAttribute('textBaseline', 'middle');
|
|
28230
28296
|
}
|
|
28231
|
-
else if (subTitleVerticalAlign === 'bottom'
|
|
28297
|
+
else if (subTitleVerticalAlign === 'bottom') {
|
|
28232
28298
|
this._subTitle.setAttribute('y', subTitleYStart + subTitleHeight);
|
|
28233
28299
|
this._subTitle.setAttribute('textBaseline', 'bottom');
|
|
28234
28300
|
}
|
|
28235
|
-
else {
|
|
28236
|
-
this._subTitle.setAttribute('y', subTitleYStart);
|
|
28237
|
-
this._subTitle.setAttribute('textBaseline', 'top');
|
|
28238
|
-
}
|
|
28239
28301
|
}
|
|
28240
28302
|
}
|
|
28241
28303
|
}
|
|
@@ -31239,6 +31301,6 @@ StoryLabelItem.defaultAttributes = {
|
|
|
31239
31301
|
theme: 'default'
|
|
31240
31302
|
};
|
|
31241
31303
|
|
|
31242
|
-
const version = "0.22.0-vstory.
|
|
31304
|
+
const version = "0.22.0-vstory.10";
|
|
31243
31305
|
|
|
31244
31306
|
export { AXIS_ELEMENT_NAME, AbstractComponent, ArcInfo, ArcLabel, ArcSegment, AxisStateValue, BasePlayer, Brush, CheckBox, CircleAxis, CircleAxisGrid, CircleCrosshair, ColorContinuousLegend, ContinuousPlayer, DEFAULT_ITEM_SPACE_COL, DEFAULT_ITEM_SPACE_ROW, DEFAULT_LABEL_SPACE, DEFAULT_PAGER_SPACE, DEFAULT_SHAPE_SIZE, DEFAULT_SHAPE_SPACE, DEFAULT_STATES$1 as DEFAULT_STATES, DEFAULT_TITLE_SPACE, DEFAULT_VALUE_SPACE, DataLabel, DataZoom, DataZoomActiveTag, DirectionEnum, DiscreteLegend, DiscretePlayer, EmptyTip, GroupTransition, IMarkAreaLabelPosition, IMarkCommonArcLabelPosition, IMarkLineLabelPosition, IMarkPointItemPosition, IOperateType, Indicator, LEGEND_ELEMENT_NAME, LabelBase, LegendEvent, LegendStateValue, LineAxis, LineAxisGrid, LineCrosshair, LineLabel, LinkPath, MarkArcArea, MarkArcLine, MarkArea, MarkLine, MarkPoint, Pager, PlayerEventEnum, PolygonCrosshair, PolygonSectorCrosshair, PopTip, Radio, RectCrosshair, RectLabel, SLIDER_ELEMENT_NAME, ScrollBar, SectorCrosshair, Segment, SizeContinuousLegend, Slider, StoryLabelItem, Switch, SymbolLabel, Tag, Timeline, Title, Tooltip, TopZIndex, VTag, WeatherBox, alignTextInLine, angle, angleLabelOrientAttribute, angleTo, cartesianTicks, clampRadian, computeOffsetForlimit, continuousTicks, contrastAccessibilityChecker, convertDomainToTickData, createTextGraphicByType, deltaXYToAngle, fuzzyEqualNumber, getAxisBreakSymbolAttrs, getCircleLabelPosition, getCirclePoints, getCircleVerticalVector, getElMap, getHorizontalPath, getMarksByName, getNoneGroupMarksByName, getPolarAngleLabelPosition, getPolygonPath, getSizeHandlerPath, getTextAlignAttrOfVerticalDir, getTextType, getVerticalCoord, getVerticalPath, hasOverlap, htmlAttributeTransform, initTextMeasure, isInRange, isPostiveXAxis, isRichText, isVisible, labelSmartInvert, length, limitShapeInBounds, linearDiscreteTicks, loadPoptip, loadScrollbar, measureTextSize, normalize, polarAngleAxisDiscreteTicks, polarTicks, reactAttributeTransform, registerArcDataLabel, registerLineDataLabel, registerMarkArcAreaAnimate, registerMarkArcLineAnimate, registerMarkAreaAnimate, registerMarkLineAnimate, registerMarkPointAnimate, registerRectDataLabel, registerSymbolDataLabel, removeRepeatPoint, richTextAttributeTransform, scale, scrollbarModule, setPoptipTheme, smartInvertStrategy, tan2AngleToAngle, textIntersect, ticks, traverseGroup, version };
|
package/es/index.d.ts
CHANGED
package/es/index.js
CHANGED
package/es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,kBAAkB,CAAC;AAE1C,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.22.0-vstory.10\";\n\nexport * from './core/base';\nexport * from './core/type';\nexport * from './scrollbar';\nexport * from './tag';\nexport * from './poptip';\nexport * from './crosshair';\nexport * from './label';\nexport * from './axis';\nexport * from './axis/grid';\nexport * from './segment';\nexport * from './data-zoom';\nexport * from './marker';\nexport * from './pager';\nexport * from './legend';\nexport * from './title';\nexport * from './indicator';\nexport * from './slider';\nexport * from './link-path';\nexport * from './player';\nexport * from './brush';\nexport * from './tooltip';\nexport * from './timeline';\nexport * from './interface';\nexport * from './jsx';\nexport * from './checkbox';\nexport * from './radio';\nexport * from './empty-tip';\nexport * from './weather';\nexport * from './util';\nexport * from './switch';\nexport * from './label-item';\n"]}
|
package/es/title/title.js
CHANGED
|
@@ -14,20 +14,20 @@ export class Title extends AbstractComponent {
|
|
|
14
14
|
this.name = "title";
|
|
15
15
|
}
|
|
16
16
|
render() {
|
|
17
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t
|
|
17
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
18
18
|
const {textType: textType, text: text, subtextType: subtextType, textStyle: textStyle = {}, subtext: subtext, subtextStyle: subtextStyle = {}, width: width, height: height, minWidth: minWidth, maxWidth: maxWidth, minHeight: minHeight, maxHeight: maxHeight, align: align, verticalAlign: verticalAlign, padding: padding = 0} = this.attribute, parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("title-container", {
|
|
19
19
|
x: parsedPadding[3],
|
|
20
20
|
y: parsedPadding[0],
|
|
21
21
|
zIndex: 1
|
|
22
|
-
}, "group")
|
|
22
|
+
}, "group");
|
|
23
23
|
if (!1 !== this.attribute.visible && !1 !== textStyle.visible) {
|
|
24
|
-
const {width: mainTitleWidth, maxHeight: mainTitleMaxHeight, maxWidth: mainTitleMaxWidth, x: x = 0, y: y = 0, ellipsis: ellipsis = !0, wordBreak: wordBreak = "break-word", maxWidth: maxWidth, lineClamp: lineClamp} = textStyle;
|
|
24
|
+
const {width: mainTitleWidth, height: mainTitleHeight, maxHeight: mainTitleMaxHeight, maxWidth: mainTitleMaxWidth, x: x = 0, y: y = 0, ellipsis: ellipsis = !0, wordBreak: wordBreak = "break-word", maxWidth: maxWidth, lineClamp: lineClamp} = textStyle;
|
|
25
25
|
if ("rich" === textType || isValid(textStyle.character)) {
|
|
26
26
|
const attr = Object.assign({
|
|
27
27
|
x: x,
|
|
28
28
|
y: y,
|
|
29
|
-
width: null !== (
|
|
30
|
-
height: null !=
|
|
29
|
+
width: null !== (_a = null != mainTitleWidth ? mainTitleWidth : width) && void 0 !== _a ? _a : 0,
|
|
30
|
+
height: null !== (_b = null != mainTitleHeight ? mainTitleHeight : height) && void 0 !== _b ? _b : 0,
|
|
31
31
|
ellipsis: null == ellipsis || ellipsis,
|
|
32
32
|
wordBreak: null != wordBreak ? wordBreak : "break-word",
|
|
33
33
|
maxHeight: null != mainTitleMaxHeight ? mainTitleMaxHeight : maxHeight,
|
|
@@ -43,7 +43,7 @@ export class Title extends AbstractComponent {
|
|
|
43
43
|
x: x,
|
|
44
44
|
y: y,
|
|
45
45
|
width: null !== (_d = null != mainTitleWidth ? mainTitleWidth : width) && void 0 !== _d ? _d : 0,
|
|
46
|
-
height: null !=
|
|
46
|
+
height: null !== (_e = null != mainTitleHeight ? mainTitleHeight : height) && void 0 !== _e ? _e : 0,
|
|
47
47
|
ellipsis: ellipsis,
|
|
48
48
|
wordBreak: wordBreak,
|
|
49
49
|
maxHeight: null != mainTitleMaxHeight ? mainTitleMaxHeight : maxHeight,
|
|
@@ -55,17 +55,17 @@ export class Title extends AbstractComponent {
|
|
|
55
55
|
text: isArray(text) ? text : [ text ],
|
|
56
56
|
whiteSpace: "normal"
|
|
57
57
|
}, textStyle), {
|
|
58
|
-
maxLineWidth: null !== (
|
|
59
|
-
heightLimit: null
|
|
58
|
+
maxLineWidth: null !== (_g = null !== (_f = textStyle.maxLineWidth) && void 0 !== _f ? _f : mainTitleWidth) && void 0 !== _g ? _g : width,
|
|
59
|
+
heightLimit: null != mainTitleHeight ? mainTitleHeight : maxHeight,
|
|
60
60
|
lineClamp: lineClamp,
|
|
61
61
|
ellipsis: ellipsis,
|
|
62
62
|
x: x,
|
|
63
63
|
y: y
|
|
64
64
|
}), "text"));
|
|
65
65
|
}
|
|
66
|
-
const
|
|
66
|
+
const maintextHeight = this._mainTitle ? this._mainTitle.AABBBounds.height() : 0, maintextWidth = this._mainTitle ? this._mainTitle.AABBBounds.width() : 0;
|
|
67
67
|
if (!1 !== this.attribute.visible && !1 !== subtextStyle.visible) {
|
|
68
|
-
const {width: subTitleWidth, height: subTitleHeight, maxWidth: subTitleMaxWidth, maxHeight: subTitleMaxHeight, x: x = 0, y: y = 0, ellipsis: ellipsis = !0, wordBreak: wordBreak = "break-word", lineClamp: lineClamp} = subtextStyle, maxSubTextHeight = Math.max(Number.MIN_VALUE, maxHeight -
|
|
68
|
+
const {width: subTitleWidth, height: subTitleHeight, maxWidth: subTitleMaxWidth, maxHeight: subTitleMaxHeight, x: x = 0, y: y = 0, ellipsis: ellipsis = !0, wordBreak: wordBreak = "break-word", lineClamp: lineClamp} = subtextStyle, maxSubTextHeight = Math.max(Number.MIN_VALUE, maxHeight - maintextHeight);
|
|
69
69
|
if ("rich" === subtextType || isValid(subtextStyle.character)) {
|
|
70
70
|
const attr = Object.assign({
|
|
71
71
|
x: x,
|
|
@@ -104,45 +104,42 @@ export class Title extends AbstractComponent {
|
|
|
104
104
|
lineClamp: lineClamp,
|
|
105
105
|
ellipsis: ellipsis,
|
|
106
106
|
x: 0,
|
|
107
|
-
y:
|
|
107
|
+
y: maintextHeight
|
|
108
108
|
}), "text"));
|
|
109
109
|
}
|
|
110
|
-
const
|
|
111
|
-
let
|
|
112
|
-
if (isValid(width) && (
|
|
113
|
-
isValid(minWidth) &&
|
|
114
|
-
isValid(minHeight) &&
|
|
115
|
-
group.attribute.width =
|
|
110
|
+
const subtextHeight = this._subTitle ? this._subTitle.AABBBounds.height() : 0, subtextWidth = this._subTitle ? this._subTitle.AABBBounds.width() : 0;
|
|
111
|
+
let titleWidth = Math.max(maintextWidth, subtextWidth), titleHeight = maintextHeight + (null !== (_q = subtextStyle.height) && void 0 !== _q ? _q : subtextHeight);
|
|
112
|
+
if (isValid(width) && (titleWidth = width), isValid(height) && (titleHeight = height),
|
|
113
|
+
isValid(minWidth) && titleWidth < minWidth && (titleWidth = minWidth), isValid(maxWidth) && titleWidth > maxWidth && (titleWidth = maxWidth),
|
|
114
|
+
isValid(minHeight) && titleHeight < minHeight && (titleHeight = minHeight), isValid(maxHeight) && titleHeight > maxHeight && (titleHeight = maxHeight),
|
|
115
|
+
group.attribute.width = titleWidth, group.attribute.height = titleHeight, group.attribute.boundsPadding = parsedPadding,
|
|
116
116
|
this._mainTitle) {
|
|
117
117
|
if (isValid(align) || isValid(textStyle.align)) {
|
|
118
|
-
const mainTitleAlign = textStyle.align ? textStyle.align : align, mainTitleWidth = null !== (_r = textStyle.width) && void 0 !== _r ? _r :
|
|
119
|
-
"center" === mainTitleAlign ? (this._mainTitle.setAttribute("x", mainTitleWidth / 2),
|
|
120
|
-
this._mainTitle.setAttribute("textAlign", "center")) : "right" === mainTitleAlign
|
|
121
|
-
this._mainTitle.setAttribute("textAlign", "right"))
|
|
122
|
-
this._mainTitle.setAttribute("textAlign", "left"));
|
|
118
|
+
const mainTitleAlign = textStyle.align ? textStyle.align : align, mainTitleWidth = null !== (_r = textStyle.width) && void 0 !== _r ? _r : maintextWidth;
|
|
119
|
+
"left" === mainTitleAlign ? (this._mainTitle.setAttribute("x", 0), this._mainTitle.setAttribute("textAlign", "left")) : "center" === mainTitleAlign ? (this._mainTitle.setAttribute("x", mainTitleWidth / 2),
|
|
120
|
+
this._mainTitle.setAttribute("textAlign", "center")) : "right" === mainTitleAlign && (this._mainTitle.setAttribute("x", mainTitleWidth),
|
|
121
|
+
this._mainTitle.setAttribute("textAlign", "right"));
|
|
123
122
|
}
|
|
124
123
|
if (isValid(verticalAlign) || isValid(textStyle.verticalAlign)) {
|
|
125
|
-
const mainTitleVerticalAlign = textStyle.verticalAlign ? textStyle.verticalAlign : verticalAlign;
|
|
126
|
-
"
|
|
127
|
-
this._mainTitle.setAttribute("textBaseline", "middle")) : "bottom" === mainTitleVerticalAlign &&
|
|
128
|
-
this._mainTitle.setAttribute("textBaseline", "bottom"))
|
|
129
|
-
this._mainTitle.setAttribute("textBaseline", "top"));
|
|
124
|
+
const mainTitleVerticalAlign = textStyle.verticalAlign ? textStyle.verticalAlign : verticalAlign, mainTitleHeight = textStyle.height ? textStyle.height : titleHeight;
|
|
125
|
+
"top" === mainTitleVerticalAlign ? (this._mainTitle.setAttribute("y", 0), this._mainTitle.setAttribute("textBaseline", "top")) : "middle" === mainTitleVerticalAlign ? (this._mainTitle.setAttribute("y", mainTitleHeight / 2),
|
|
126
|
+
this._mainTitle.setAttribute("textBaseline", "middle")) : "bottom" === mainTitleVerticalAlign && (this._mainTitle.setAttribute("y", mainTitleHeight),
|
|
127
|
+
this._mainTitle.setAttribute("textBaseline", "bottom"));
|
|
130
128
|
}
|
|
131
129
|
}
|
|
132
130
|
if (this._subTitle) {
|
|
133
131
|
if (isValid(align) || isValid(subtextStyle.align)) {
|
|
134
|
-
const subTitleAlign = subtextStyle.align ? subtextStyle.align : align, subTitleWidth = null !== (
|
|
135
|
-
"center" === subTitleAlign ? (this._subTitle.setAttribute("x", subTitleWidth / 2),
|
|
136
|
-
this._subTitle.setAttribute("textAlign", "center")) : "right" === subTitleAlign
|
|
137
|
-
this._subTitle.setAttribute("textAlign", "right"))
|
|
138
|
-
this._subTitle.setAttribute("textAlign", "left"));
|
|
132
|
+
const subTitleAlign = subtextStyle.align ? subtextStyle.align : align, subTitleWidth = null !== (_s = subtextStyle.width) && void 0 !== _s ? _s : subtextWidth;
|
|
133
|
+
"left" === subTitleAlign ? (this._subTitle.setAttribute("x", 0), this._subTitle.setAttribute("textAlign", "left")) : "center" === subTitleAlign ? (this._subTitle.setAttribute("x", subTitleWidth / 2),
|
|
134
|
+
this._subTitle.setAttribute("textAlign", "center")) : "right" === subTitleAlign && (this._subTitle.setAttribute("x", subTitleWidth),
|
|
135
|
+
this._subTitle.setAttribute("textAlign", "right"));
|
|
139
136
|
}
|
|
140
137
|
if (isValid(verticalAlign) || isValid(textStyle.verticalAlign)) {
|
|
141
|
-
const subTitleVerticalAlign = subtextStyle.verticalAlign ? subtextStyle.verticalAlign : verticalAlign, subTitleYStart =
|
|
142
|
-
"
|
|
143
|
-
this._subTitle.setAttribute("textBaseline", "
|
|
144
|
-
this._subTitle.setAttribute("textBaseline", "
|
|
145
|
-
this._subTitle.setAttribute("textBaseline", "
|
|
138
|
+
const subTitleVerticalAlign = subtextStyle.verticalAlign ? subtextStyle.verticalAlign : verticalAlign, subTitleYStart = maintextHeight, subTitleHeight = null !== (_t = subtextStyle.height) && void 0 !== _t ? _t : 0;
|
|
139
|
+
"top" === subTitleVerticalAlign ? (this._subTitle.setAttribute("y", subTitleYStart),
|
|
140
|
+
this._subTitle.setAttribute("textBaseline", "top")) : "middle" === subTitleVerticalAlign ? (this._subTitle.setAttribute("y", subTitleYStart + subTitleHeight / 2),
|
|
141
|
+
this._subTitle.setAttribute("textBaseline", "middle")) : "bottom" === subTitleVerticalAlign && (this._subTitle.setAttribute("y", subTitleYStart + subTitleHeight),
|
|
142
|
+
this._subTitle.setAttribute("textBaseline", "bottom"));
|
|
146
143
|
}
|
|
147
144
|
}
|
|
148
145
|
}
|
package/es/title/title.js.map
CHANGED
|
@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AE,MAAM;QACjB,YAAY,EAAE,KAAK;KACpB;IACD,YAAY,EAAE;QACZ,QAAQ,EAAE,KAAK;QACf,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,QAAQ;QACpB,SAAS,EAAE,MAAM;QACjB,YAAY,EAAE,KAAK;KACpB;CACF,CAAC","file":"title.js","sourcesContent":["/**\n * @description 标题组件\n */\nimport type { IGroup, IText, IRichText, IRichTextCharacter } from '@visactor/vrender-core';\nimport { merge, isValid, normalizePadding, isArray } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { TitleAttrs } from './type';\nimport type { ComponentOptions } from '../interface';\nimport { DEFAULT_HTML_TEXT_SPEC } from '../constant';\nimport { loadTitleComponent } from './register';\n\nloadTitleComponent();\nexport class Title extends AbstractComponent<Required<TitleAttrs>> {\n name = 'title';\n\n private _mainTitle?: IText | IRichText;\n private _subTitle?: IText | IRichText;\n\n static defaultAttributes: Partial<TitleAttrs> = {\n textStyle: {\n ellipsis: '...',\n fill: '#333',\n fontSize: 20,\n fontWeight: 'bold',\n textAlign: 'left',\n textBaseline: 'top'\n },\n subtextStyle: {\n ellipsis: '...',\n fill: '#6F6F6F',\n fontSize: 16,\n fontWeight: 'normal',\n textAlign: 'left',\n textBaseline: 'top'\n }\n };\n\n constructor(attributes: TitleAttrs, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, Title.defaultAttributes, attributes));\n }\n\n protected render() {\n const {\n textType,\n text,\n subtextType,\n textStyle = {},\n subtext,\n subtextStyle = {},\n width,\n height,\n minWidth,\n maxWidth,\n minHeight,\n maxHeight,\n align,\n verticalAlign,\n padding = 0\n } = this.attribute as TitleAttrs;\n\n const parsedPadding = normalizePadding(padding);\n\n const group = this.createOrUpdateChild(\n 'title-container',\n { x: parsedPadding[3], y: parsedPadding[0], zIndex: 1 },\n 'group'\n ) as IGroup;\n\n const fixedMainTitleHeight = textStyle.height ?? height;\n if (this.attribute.visible !== false && textStyle.visible !== false) {\n const {\n width: mainTitleWidth,\n maxHeight: mainTitleMaxHeight,\n maxWidth: mainTitleMaxWidth,\n x = 0,\n y = 0,\n ellipsis = true,\n wordBreak = 'break-word',\n maxWidth,\n lineClamp\n } = textStyle;\n if (textType === 'rich' || isValid(textStyle.character)) {\n const attr = {\n x,\n y,\n width: mainTitleWidth ?? width ?? 0,\n height: fixedMainTitleHeight ?? 0,\n ellipsis: ellipsis ?? true,\n wordBreak: wordBreak ?? 'break-word',\n maxHeight: mainTitleMaxHeight ?? maxHeight,\n maxWidth: mainTitleMaxWidth ?? maxWidth,\n // 兼容旧版富文本配置,如果未设置textType === 'rich',text内容为string 易报错\n textConfig: textStyle.character ?? (text as IRichTextCharacter[]),\n ...textStyle\n };\n this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext') as IRichText;\n } else if (textType === 'html') {\n const attr = {\n html: {\n dom: text as string,\n ...DEFAULT_HTML_TEXT_SPEC,\n ...textStyle\n },\n x,\n y,\n width: mainTitleWidth ?? width ?? 0,\n height: fixedMainTitleHeight ?? 0,\n ellipsis,\n wordBreak,\n maxHeight: mainTitleMaxHeight ?? maxHeight,\n maxWidth: mainTitleMaxWidth ?? maxWidth,\n textConfig: [] as any[],\n ...textStyle\n };\n this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext') as IRichText;\n } else if (isValid(text)) {\n this._mainTitle = group.createOrUpdateChild(\n 'mainTitle',\n {\n text: isArray(text) ? (text as any) : [text as string],\n whiteSpace: 'normal',\n ...textStyle,\n maxLineWidth: textStyle.maxLineWidth ?? mainTitleWidth ?? width,\n heightLimit: textStyle.height ?? maxHeight,\n lineClamp,\n ellipsis,\n x,\n y\n },\n 'text'\n ) as IText;\n }\n }\n\n const mainTextBoundsHeight = this._mainTitle ? this._mainTitle.AABBBounds.height() : 0;\n const mainTextBoundsWidth = this._mainTitle ? this._mainTitle.AABBBounds.width() : 0;\n\n // 目前 height 限制等于 0 时,相当于 Infinity,无限制\n\n if (this.attribute.visible !== false && subtextStyle.visible !== false) {\n const {\n width: subTitleWidth,\n height: subTitleHeight,\n maxWidth: subTitleMaxWidth,\n maxHeight: subTitleMaxHeight,\n x = 0,\n y = 0,\n ellipsis = true,\n wordBreak = 'break-word',\n lineClamp\n } = subtextStyle;\n const maxSubTextHeight = Math.max(Number.MIN_VALUE, maxHeight - mainTextBoundsHeight);\n\n if (subtextType === 'rich' || isValid(subtextStyle.character)) {\n const attr: any = {\n x,\n y,\n width: subTitleWidth ?? width ?? 0,\n height: subTitleHeight ?? height ?? 0,\n ellipsis,\n wordBreak,\n maxHeight: subTitleMaxHeight ?? maxSubTextHeight,\n maxWidth: subTitleMaxWidth ?? maxWidth,\n // 兼容旧版富文本配置,如果未设置textType === 'rich',text内容为string 易报错\n textConfig: subtextStyle.character ?? (subtext as IRichTextCharacter[]),\n ...subtextStyle\n };\n this._subTitle = group.createOrUpdateChild('subTitle', attr, 'richtext') as IRichText;\n } else if (subtextType === 'html') {\n const attr: any = {\n html: {\n dom: subtext as string,\n ...DEFAULT_HTML_TEXT_SPEC,\n ...subtextStyle\n },\n x,\n y,\n width: subTitleWidth ?? width ?? 0,\n height: subTitleHeight ?? height ?? 0,\n ellipsis,\n wordBreak,\n maxHeight: subTitleMaxHeight ?? maxSubTextHeight,\n maxWidth: subTitleMaxWidth ?? maxWidth,\n textConfig: [] as any[],\n ...subtextStyle\n };\n this._subTitle = group.createOrUpdateChild('subTitle', attr, 'richtext') as IRichText;\n } else if (isValid(subtext)) {\n this._subTitle = group.createOrUpdateChild(\n 'subTitle',\n {\n text: isArray(subtext) ? (subtext as any) : [subtext as string],\n whiteSpace: 'normal',\n ...subtextStyle,\n maxLineWidth: subtextStyle.maxLineWidth ?? width,\n heightLimit: subtextStyle.heightLimit ?? maxSubTextHeight,\n lineClamp,\n ellipsis,\n x: 0,\n y: mainTextBoundsHeight\n },\n 'text'\n ) as IText;\n }\n }\n\n const subTextBoundsHeight = this._subTitle ? this._subTitle.AABBBounds.height() : 0;\n const subTextBoundsWidth = this._subTitle ? this._subTitle.AABBBounds.width() : 0;\n\n // 设置宽高\n let totalWidth = Math.max(mainTextBoundsWidth, subTextBoundsWidth);\n let totalHeight = mainTextBoundsHeight + (subtextStyle.height ?? subTextBoundsHeight);\n\n if (isValid(width)) {\n totalWidth = width;\n }\n\n if (isValid(height)) {\n totalHeight = height;\n }\n\n if (isValid(minWidth) && totalWidth < minWidth) {\n totalWidth = minWidth;\n }\n if (isValid(maxWidth)) {\n if (totalWidth > maxWidth) {\n totalWidth = maxWidth;\n }\n }\n\n if (isValid(minHeight) && totalHeight < minHeight) {\n totalHeight = minHeight;\n }\n\n if (isValid(maxHeight)) {\n if (totalHeight > maxHeight) {\n totalHeight = maxHeight;\n }\n }\n\n group.attribute.width = totalWidth;\n group.attribute.height = totalHeight;\n group.attribute.boundsPadding = parsedPadding;\n\n // 设置对齐\n if (this._mainTitle) {\n if (isValid(align) || isValid(textStyle.align)) {\n const mainTitleAlign = textStyle.align ? textStyle.align : align;\n const mainTitleWidth = textStyle.width ?? totalWidth;\n if (mainTitleAlign === 'center') {\n this._mainTitle.setAttribute('x', mainTitleWidth / 2);\n this._mainTitle.setAttribute('textAlign', 'center');\n } else if (mainTitleAlign === 'right') {\n this._mainTitle.setAttribute('x', mainTitleWidth);\n this._mainTitle.setAttribute('textAlign', 'right');\n } else {\n this._mainTitle.setAttribute('x', 0);\n this._mainTitle.setAttribute('textAlign', 'left');\n }\n }\n\n if (isValid(verticalAlign) || isValid(textStyle.verticalAlign)) {\n const mainTitleVerticalAlign = textStyle.verticalAlign ? textStyle.verticalAlign : verticalAlign;\n if (mainTitleVerticalAlign === 'middle' && isValid(fixedMainTitleHeight)) {\n this._mainTitle.setAttribute('y', fixedMainTitleHeight / 2);\n this._mainTitle.setAttribute('textBaseline', 'middle');\n } else if (mainTitleVerticalAlign === 'bottom' && isValid(fixedMainTitleHeight)) {\n this._mainTitle.setAttribute('y', fixedMainTitleHeight);\n this._mainTitle.setAttribute('textBaseline', 'bottom');\n } else {\n this._mainTitle.setAttribute('y', 0);\n this._mainTitle.setAttribute('textBaseline', 'top');\n }\n }\n }\n\n if (this._subTitle) {\n if (isValid(align) || isValid(subtextStyle.align)) {\n const subTitleAlign = subtextStyle.align ? subtextStyle.align : align;\n // 当subText没有设置显示的宽度,但是mainText设置了显示的宽度的时候,为mainText为主,因为默认subText要和mainText对齐\n const subTitleWidth = subtextStyle.width ?? textStyle.width ?? totalWidth;\n if (subTitleAlign === 'center') {\n this._subTitle.setAttribute('x', subTitleWidth / 2);\n this._subTitle.setAttribute('textAlign', 'center');\n } else if (subTitleAlign === 'right') {\n this._subTitle.setAttribute('x', subTitleWidth);\n this._subTitle.setAttribute('textAlign', 'right');\n } else {\n this._subTitle.setAttribute('x', 0);\n this._subTitle.setAttribute('textAlign', 'left');\n }\n }\n\n if (isValid(verticalAlign) || isValid(textStyle.verticalAlign)) {\n const subTitleVerticalAlign = subtextStyle.verticalAlign ? subtextStyle.verticalAlign : verticalAlign;\n const subTitleYStart = this._mainTitle\n ? isValid(fixedMainTitleHeight)\n ? // 如果是用户指定的高度,根据bounds的height 和指定高度求最大值\n this._mainTitle.AABBBounds.y1 + Math.max(this._mainTitle.AABBBounds.height(), fixedMainTitleHeight)\n : this._mainTitle.AABBBounds.y2\n : 0;\n const subTitleHeight = subtextStyle.height ?? height;\n if (subTitleVerticalAlign === 'middle' && isValid(subTitleHeight)) {\n this._subTitle.setAttribute('y', subTitleYStart + subTitleHeight / 2);\n this._subTitle.setAttribute('textBaseline', 'middle');\n } else if (subTitleVerticalAlign === 'bottom' && isValid(subTitleHeight)) {\n this._subTitle.setAttribute('y', subTitleYStart + subTitleHeight);\n this._subTitle.setAttribute('textBaseline', 'bottom');\n } else {\n this._subTitle.setAttribute('y', subTitleYStart);\n this._subTitle.setAttribute('textBaseline', 'top');\n }\n }\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/title/title.ts"],"names":[],"mappings":"AAIA,OAA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Ac,GAAG,cAAc,CAAC;gBACtC,MAAM,cAAc,GAAG,MAAA,YAAY,CAAC,MAAM,mCAAI,CAAC,CAAC;gBAChD,IAAI,qBAAqB,KAAK,KAAK,EAAE;oBACnC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;oBACjD,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;iBACpD;qBAAM,IAAI,qBAAqB,KAAK,QAAQ,EAAE;oBAC7C,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,GAAG,EAAE,cAAc,GAAG,cAAc,GAAG,CAAC,CAAC,CAAC;oBACtE,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;iBACvD;qBAAM,IAAI,qBAAqB,KAAK,QAAQ,EAAE;oBAC7C,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,GAAG,EAAE,cAAc,GAAG,cAAc,CAAC,CAAC;oBAClE,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;iBACvD;aACF;SACF;IACH,CAAC;;AAlSM,uBAAiB,GAAwB;IAC9C,SAAS,EAAE;QACT,QAAQ,EAAE,KAAK;QACf,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,MAAM;QAClB,SAAS,EAAE,MAAM;QACjB,YAAY,EAAE,KAAK;KACpB;IACD,YAAY,EAAE;QACZ,QAAQ,EAAE,KAAK;QACf,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,QAAQ;QACpB,SAAS,EAAE,MAAM;QACjB,YAAY,EAAE,KAAK;KACpB;CACF,CAAC","file":"title.js","sourcesContent":["/**\n * @description 标题组件\n */\nimport type { IGroup, IText, IRichText, IRichTextCharacter } from '@visactor/vrender-core';\nimport { merge, isValid, normalizePadding, isArray } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { TitleAttrs } from './type';\nimport type { ComponentOptions } from '../interface';\nimport { DEFAULT_HTML_TEXT_SPEC } from '../constant';\nimport { loadTitleComponent } from './register';\n\nloadTitleComponent();\nexport class Title extends AbstractComponent<Required<TitleAttrs>> {\n name = 'title';\n\n private _mainTitle?: IText | IRichText;\n private _subTitle?: IText | IRichText;\n\n static defaultAttributes: Partial<TitleAttrs> = {\n textStyle: {\n ellipsis: '...',\n fill: '#333',\n fontSize: 20,\n fontWeight: 'bold',\n textAlign: 'left',\n textBaseline: 'top'\n },\n subtextStyle: {\n ellipsis: '...',\n fill: '#6F6F6F',\n fontSize: 16,\n fontWeight: 'normal',\n textAlign: 'left',\n textBaseline: 'top'\n }\n };\n\n constructor(attributes: TitleAttrs, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, Title.defaultAttributes, attributes));\n }\n\n protected render() {\n const {\n textType,\n text,\n subtextType,\n textStyle = {},\n subtext,\n subtextStyle = {},\n width,\n height,\n minWidth,\n maxWidth,\n minHeight,\n maxHeight,\n align,\n verticalAlign,\n padding = 0\n } = this.attribute as TitleAttrs;\n\n const parsedPadding = normalizePadding(padding);\n\n const group = this.createOrUpdateChild(\n 'title-container',\n { x: parsedPadding[3], y: parsedPadding[0], zIndex: 1 },\n 'group'\n ) as IGroup;\n\n if (this.attribute.visible !== false && textStyle.visible !== false) {\n const {\n width: mainTitleWidth,\n height: mainTitleHeight,\n maxHeight: mainTitleMaxHeight,\n maxWidth: mainTitleMaxWidth,\n x = 0,\n y = 0,\n ellipsis = true,\n wordBreak = 'break-word',\n maxWidth,\n lineClamp\n } = textStyle;\n if (textType === 'rich' || isValid(textStyle.character)) {\n const attr = {\n x,\n y,\n width: mainTitleWidth ?? width ?? 0,\n height: mainTitleHeight ?? height ?? 0,\n ellipsis: ellipsis ?? true,\n wordBreak: wordBreak ?? 'break-word',\n maxHeight: mainTitleMaxHeight ?? maxHeight,\n maxWidth: mainTitleMaxWidth ?? maxWidth,\n // 兼容旧版富文本配置,如果未设置textType === 'rich',text内容为string 易报错\n textConfig: textStyle.character ?? (text as IRichTextCharacter[]),\n ...textStyle\n };\n this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext') as IRichText;\n } else if (textType === 'html') {\n const attr = {\n html: {\n dom: text as string,\n ...DEFAULT_HTML_TEXT_SPEC,\n ...textStyle\n },\n x,\n y,\n width: mainTitleWidth ?? width ?? 0,\n height: mainTitleHeight ?? height ?? 0,\n ellipsis,\n wordBreak,\n maxHeight: mainTitleMaxHeight ?? maxHeight,\n maxWidth: mainTitleMaxWidth ?? maxWidth,\n textConfig: [] as any[],\n ...textStyle\n };\n this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext') as IRichText;\n } else if (isValid(text)) {\n this._mainTitle = group.createOrUpdateChild(\n 'mainTitle',\n {\n text: isArray(text) ? (text as any) : [text as string],\n whiteSpace: 'normal',\n ...textStyle,\n maxLineWidth: textStyle.maxLineWidth ?? mainTitleWidth ?? width,\n heightLimit: mainTitleHeight ?? maxHeight,\n lineClamp,\n ellipsis,\n x,\n y\n },\n 'text'\n ) as IText;\n }\n }\n\n const maintextHeight = this._mainTitle ? this._mainTitle.AABBBounds.height() : 0;\n const maintextWidth = this._mainTitle ? this._mainTitle.AABBBounds.width() : 0;\n\n // 目前 height 限制等于 0 时,相当于 Infinity,无限制\n\n if (this.attribute.visible !== false && subtextStyle.visible !== false) {\n const {\n width: subTitleWidth,\n height: subTitleHeight,\n maxWidth: subTitleMaxWidth,\n maxHeight: subTitleMaxHeight,\n x = 0,\n y = 0,\n ellipsis = true,\n wordBreak = 'break-word',\n lineClamp\n } = subtextStyle;\n const maxSubTextHeight = Math.max(Number.MIN_VALUE, maxHeight - maintextHeight);\n\n if (subtextType === 'rich' || isValid(subtextStyle.character)) {\n const attr: any = {\n x,\n y,\n width: subTitleWidth ?? width ?? 0,\n height: subTitleHeight ?? height ?? 0,\n ellipsis,\n wordBreak,\n maxHeight: subTitleMaxHeight ?? maxSubTextHeight,\n maxWidth: subTitleMaxWidth ?? maxWidth,\n // 兼容旧版富文本配置,如果未设置textType === 'rich',text内容为string 易报错\n textConfig: subtextStyle.character ?? (subtext as IRichTextCharacter[]),\n ...subtextStyle\n };\n this._subTitle = group.createOrUpdateChild('subTitle', attr, 'richtext') as IRichText;\n } else if (subtextType === 'html') {\n const attr: any = {\n html: {\n dom: subtext as string,\n ...DEFAULT_HTML_TEXT_SPEC,\n ...subtextStyle\n },\n x,\n y,\n width: subTitleWidth ?? width ?? 0,\n height: subTitleHeight ?? height ?? 0,\n ellipsis,\n wordBreak,\n maxHeight: subTitleMaxHeight ?? maxSubTextHeight,\n maxWidth: subTitleMaxWidth ?? maxWidth,\n textConfig: [] as any[],\n ...subtextStyle\n };\n this._subTitle = group.createOrUpdateChild('subTitle', attr, 'richtext') as IRichText;\n } else if (isValid(subtext)) {\n this._subTitle = group.createOrUpdateChild(\n 'subTitle',\n {\n text: isArray(subtext) ? (subtext as any) : [subtext as string],\n whiteSpace: 'normal',\n ...subtextStyle,\n maxLineWidth: subtextStyle.maxLineWidth ?? width,\n heightLimit: subtextStyle.heightLimit ?? maxSubTextHeight,\n lineClamp,\n ellipsis,\n x: 0,\n y: maintextHeight\n },\n 'text'\n ) as IText;\n }\n }\n\n const subtextHeight = this._subTitle ? this._subTitle.AABBBounds.height() : 0;\n const subtextWidth = this._subTitle ? this._subTitle.AABBBounds.width() : 0;\n\n // 设置宽高\n let titleWidth = Math.max(maintextWidth, subtextWidth);\n let titleHeight = maintextHeight + (subtextStyle.height ?? subtextHeight);\n\n if (isValid(width)) {\n titleWidth = width;\n }\n\n if (isValid(height)) {\n titleHeight = height;\n }\n\n if (isValid(minWidth) && titleWidth < minWidth) {\n titleWidth = minWidth;\n }\n if (isValid(maxWidth)) {\n if (titleWidth > maxWidth) {\n titleWidth = maxWidth;\n }\n }\n\n if (isValid(minHeight) && titleHeight < minHeight) {\n titleHeight = minHeight;\n }\n\n if (isValid(maxHeight)) {\n if (titleHeight > maxHeight) {\n titleHeight = maxHeight;\n }\n }\n group.attribute.width = titleWidth;\n group.attribute.height = titleHeight;\n group.attribute.boundsPadding = parsedPadding;\n\n // 设置对齐\n if (this._mainTitle) {\n if (isValid(align) || isValid(textStyle.align)) {\n const mainTitleAlign = textStyle.align ? textStyle.align : align;\n const mainTitleWidth = textStyle.width ?? maintextWidth;\n if (mainTitleAlign === 'left') {\n this._mainTitle.setAttribute('x', 0);\n this._mainTitle.setAttribute('textAlign', 'left');\n } else if (mainTitleAlign === 'center') {\n this._mainTitle.setAttribute('x', mainTitleWidth / 2);\n this._mainTitle.setAttribute('textAlign', 'center');\n } else if (mainTitleAlign === 'right') {\n this._mainTitle.setAttribute('x', mainTitleWidth);\n this._mainTitle.setAttribute('textAlign', 'right');\n }\n }\n\n if (isValid(verticalAlign) || isValid(textStyle.verticalAlign)) {\n const mainTitleVerticalAlign = textStyle.verticalAlign ? textStyle.verticalAlign : verticalAlign;\n const mainTitleHeight = textStyle.height ? textStyle.height : titleHeight;\n if (mainTitleVerticalAlign === 'top') {\n this._mainTitle.setAttribute('y', 0);\n this._mainTitle.setAttribute('textBaseline', 'top');\n } else if (mainTitleVerticalAlign === 'middle') {\n this._mainTitle.setAttribute('y', mainTitleHeight / 2);\n this._mainTitle.setAttribute('textBaseline', 'middle');\n } else if (mainTitleVerticalAlign === 'bottom') {\n this._mainTitle.setAttribute('y', mainTitleHeight);\n this._mainTitle.setAttribute('textBaseline', 'bottom');\n }\n }\n }\n\n if (this._subTitle) {\n if (isValid(align) || isValid(subtextStyle.align)) {\n const subTitleAlign = subtextStyle.align ? subtextStyle.align : align;\n const subTitleWidth = subtextStyle.width ?? subtextWidth;\n if (subTitleAlign === 'left') {\n this._subTitle.setAttribute('x', 0);\n this._subTitle.setAttribute('textAlign', 'left');\n } else if (subTitleAlign === 'center') {\n this._subTitle.setAttribute('x', subTitleWidth / 2);\n this._subTitle.setAttribute('textAlign', 'center');\n } else if (subTitleAlign === 'right') {\n this._subTitle.setAttribute('x', subTitleWidth);\n this._subTitle.setAttribute('textAlign', 'right');\n }\n }\n\n if (isValid(verticalAlign) || isValid(textStyle.verticalAlign)) {\n const subTitleVerticalAlign = subtextStyle.verticalAlign ? subtextStyle.verticalAlign : verticalAlign;\n const subTitleYStart = maintextHeight;\n const subTitleHeight = subtextStyle.height ?? 0;\n if (subTitleVerticalAlign === 'top') {\n this._subTitle.setAttribute('y', subTitleYStart);\n this._subTitle.setAttribute('textBaseline', 'top');\n } else if (subTitleVerticalAlign === 'middle') {\n this._subTitle.setAttribute('y', subTitleYStart + subTitleHeight / 2);\n this._subTitle.setAttribute('textBaseline', 'middle');\n } else if (subTitleVerticalAlign === 'bottom') {\n this._subTitle.setAttribute('y', subTitleYStart + subTitleHeight);\n this._subTitle.setAttribute('textBaseline', 'bottom');\n }\n }\n }\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visactor/vrender-components",
|
|
3
|
-
"version": "0.22.0-vstory.
|
|
3
|
+
"version": "0.22.0-vstory.10",
|
|
4
4
|
"description": "components library for dp visualization",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "cjs/index.js",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@visactor/vutils": "~0.19.3",
|
|
16
16
|
"@visactor/vscale": "~0.19.3",
|
|
17
|
-
"@visactor/vrender-core": "0.22.0-vstory.
|
|
18
|
-
"@visactor/vrender-kits": "0.22.0-vstory.
|
|
17
|
+
"@visactor/vrender-core": "0.22.0-vstory.10",
|
|
18
|
+
"@visactor/vrender-kits": "0.22.0-vstory.10"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@rushstack/eslint-patch": "~1.1.4",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"vite": "3.2.6",
|
|
30
30
|
"typescript": "4.9.5",
|
|
31
31
|
"cross-env": "^7.0.3",
|
|
32
|
-
"@internal/bundler": "0.0.1",
|
|
33
32
|
"@internal/eslint-config": "0.0.1",
|
|
34
|
-
"@internal/ts-config": "0.0.1"
|
|
33
|
+
"@internal/ts-config": "0.0.1",
|
|
34
|
+
"@internal/bundler": "0.0.1"
|
|
35
35
|
},
|
|
36
36
|
"keywords": [
|
|
37
37
|
"VisActor",
|