@visactor/vrender-components 0.17.19 → 0.17.20-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/axis/base.js +5 -9
- package/cjs/axis/base.js.map +1 -1
- package/cjs/core/type.d.ts +10 -8
- package/cjs/core/type.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/indicator/indicator.js +7 -32
- package/cjs/indicator/indicator.js.map +1 -1
- package/cjs/label/base.js +3 -15
- package/cjs/label/base.js.map +1 -1
- package/cjs/label/type.d.ts +1 -1
- package/cjs/label/type.js.map +1 -1
- package/cjs/legend/base.js.map +1 -1
- package/cjs/legend/discrete/discrete.d.ts +1 -0
- package/cjs/legend/discrete/discrete.js +29 -17
- package/cjs/legend/discrete/discrete.js.map +1 -1
- package/cjs/legend/discrete/type.d.ts +3 -0
- package/cjs/legend/discrete/type.js.map +1 -1
- package/cjs/legend/type.d.ts +2 -2
- package/cjs/legend/type.js.map +1 -1
- package/cjs/tag/tag.js +28 -42
- package/cjs/tag/tag.js.map +1 -1
- package/cjs/util/text.d.ts +4 -1
- package/cjs/util/text.js +15 -2
- package/cjs/util/text.js.map +1 -1
- package/es/axis/base.js +4 -11
- package/es/axis/base.js.map +1 -1
- package/es/core/type.d.ts +10 -8
- package/es/core/type.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/indicator/indicator.js +5 -34
- package/es/indicator/indicator.js.map +1 -1
- package/es/label/base.js +2 -17
- package/es/label/base.js.map +1 -1
- package/es/label/type.d.ts +1 -1
- package/es/label/type.js.map +1 -1
- package/es/legend/base.js.map +1 -1
- package/es/legend/discrete/discrete.d.ts +1 -0
- package/es/legend/discrete/discrete.js +28 -16
- package/es/legend/discrete/discrete.js.map +1 -1
- package/es/legend/discrete/type.d.ts +3 -0
- package/es/legend/discrete/type.js.map +1 -1
- package/es/legend/type.d.ts +2 -2
- package/es/legend/type.js.map +1 -1
- package/es/tag/tag.js +29 -45
- package/es/tag/tag.js.map +1 -1
- package/es/util/text.d.ts +4 -1
- package/es/util/text.js +13 -1
- package/es/util/text.js.map +1 -1
- package/package.json +5 -5
package/cjs/util/text.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: !0
|
|
5
|
-
}), exports.measureTextSize = exports.initTextMeasure = void 0;
|
|
5
|
+
}), exports.richTextAttributeTransform = exports.isRichText = exports.measureTextSize = exports.initTextMeasure = void 0;
|
|
6
6
|
|
|
7
7
|
const vrender_core_1 = require("@visactor/vrender-core"), vutils_1 = require("@visactor/vutils"), constant_1 = require("../constant"), initTextMeasure = (textSpec, option, useNaiveCanvas) => new vutils_1.TextMeasure(Object.assign({
|
|
8
8
|
defaultFontParams: {
|
|
@@ -36,5 +36,18 @@ function measureTextSize(text, textSpec, fontFamily = constant_1.DEFAULT_TEXT_FO
|
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
function isRichText(attributes, typeKey = "type") {
|
|
40
|
+
return typeKey in attributes && "rich" === attributes[typeKey] || (0, vutils_1.isObject)(attributes.text) && "rich" === attributes.text.type;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function richTextAttributeTransform(attributes) {
|
|
44
|
+
var _a, _b;
|
|
45
|
+
return attributes.width = null !== (_a = attributes.width) && void 0 !== _a ? _a : 0,
|
|
46
|
+
attributes.height = null !== (_b = attributes.height) && void 0 !== _b ? _b : 0,
|
|
47
|
+
attributes.maxWidth = attributes.maxLineWidth, attributes.textConfig = attributes.text.text || attributes.text,
|
|
48
|
+
attributes;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
exports.initTextMeasure = initTextMeasure, exports.measureTextSize = measureTextSize,
|
|
52
|
+
exports.isRichText = isRichText, exports.richTextAttributeTransform = richTextAttributeTransform;
|
|
40
53
|
//# sourceMappingURL=text.js.map
|
package/cjs/util/text.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/util/text.ts"],"names":[],"mappings":";;;AAEA,yDAAuD;AAGvD,
|
|
1
|
+
{"version":3,"sources":["../src/util/text.ts"],"names":[],"mappings":";;;AAEA,yDAAuD;AAGvD,6CAAyD;AACzD,0CAA+E;AAGxE,MAAM,eAAe,GAAG,CAC7B,QAAyC,EACzC,MAAoC,EACpC,cAAwB,EACY,EAAE;IACtC,OAAO,IAAI,oBAAW,iBAElB,iBAAiB,EAAE;YACjB,UAAU,EAAE,mCAAwB;YACpC,QAAQ,EAAE,iCAAsB;SACjC,EACD,aAAa,EAAE,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,4BAAa,EACzD,cAAc,EAAE,cAAc,GAAG,oBAAW,CAAC,iBAAiB,GAAG,oBAAW,CAAC,iBAAiB,CAAC,WAAW,EAAE,IACzG,CAAC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,CAAC,GAEnB,QAAQ,CACT,CAAC;AACJ,CAAC,CAAC;AAjBW,QAAA,eAAe,mBAiB1B;AAGF,SAAgB,eAAe,CAC7B,IAA2C,EAC3C,QAAwC,EACxC,aAAqB,mCAAwB;;IAE7C,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;KAChC;IACD,MAAM,MAAM,GAAG,IAAA,4BAAa,EAAC;QAC3B,IAAI;QACJ,UAAU,EAAE,MAAA,QAAQ,CAAC,UAAU,mCAAI,UAAU;QAC7C,QAAQ,EAAE,QAAQ,CAAC,QAAQ,IAAI,EAAE;QACjC,UAAU,EAAE,QAAQ,CAAC,UAAiB;QACtC,SAAS,EAAE,MAAA,QAAQ,CAAC,SAAS,mCAAI,QAAQ;QACzC,YAAY,EAAE,QAAQ,CAAC,YAAY;QACnC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ;QAC7B,YAAY,EAAE,QAAQ,CAAC,YAAY,IAAI,QAAQ;QAC/C,UAAU,EAAE,QAAQ,CAAC,QAAQ,IAAI,EAAE;KACpC,CAAC,CAAC;IAEH,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC;AAC5D,CAAC;AArBD,0CAqBC;AAED,SAAgB,UAAU,CAAC,UAAuB,EAAE,OAAO,GAAG,MAAM;IAClE,OAAO,CACL,CAAC,OAAO,IAAI,UAAU,IAAI,UAAU,CAAC,OAAO,CAAC,KAAK,MAAM,CAAC;QACzD,CAAC,IAAA,iBAAQ,EAAC,UAAU,CAAC,IAAI,CAAC,IAAK,UAAU,CAAC,IAAoB,CAAC,IAAI,KAAK,MAAM,CAAC,CAChF,CAAC;AACJ,CAAC;AALD,gCAKC;AAED,SAAgB,0BAA0B,CAAC,UAAoE;;IAC7G,UAAU,CAAC,KAAK,GAAG,MAAA,UAAU,CAAC,KAAK,mCAAI,CAAC,CAAC;IACzC,UAAU,CAAC,MAAM,GAAG,MAAA,UAAU,CAAC,MAAM,mCAAI,CAAC,CAAC;IAC3C,UAAU,CAAC,QAAQ,GAAG,UAAU,CAAC,YAAY,CAAC;IAC9C,UAAU,CAAC,UAAU,GAAI,UAAU,CAAC,IAAuB,CAAC,IAAI,IAAI,UAAU,CAAC,IAAI,CAAC;IACpF,OAAO,UAAU,CAAC;AACpB,CAAC;AAND,gEAMC","file":"text.js","sourcesContent":["import type { IRichTextAttribute, ITextGraphicAttribute } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { getTextBounds } from '@visactor/vrender-core';\nimport type { ITextMeasureOption } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { TextMeasure, isObject } from '@visactor/vutils';\nimport { DEFAULT_TEXT_FONT_FAMILY, DEFAULT_TEXT_FONT_SIZE } from '../constant';\nimport type { TextContent } from '../core/type';\n\nexport const initTextMeasure = (\n textSpec?: Partial<ITextGraphicAttribute>,\n option?: Partial<ITextMeasureOption>,\n useNaiveCanvas?: boolean\n): TextMeasure<ITextGraphicAttribute> => {\n return new TextMeasure<ITextGraphicAttribute>(\n {\n defaultFontParams: {\n fontFamily: DEFAULT_TEXT_FONT_FAMILY,\n fontSize: DEFAULT_TEXT_FONT_SIZE\n },\n getTextBounds: useNaiveCanvas ? undefined : getTextBounds,\n specialCharSet: '-/: .,@%\\'\"~' + TextMeasure.ALPHABET_CHAR_SET + TextMeasure.ALPHABET_CHAR_SET.toUpperCase(),\n ...(option ?? {})\n },\n textSpec\n );\n};\n\n// FIXME: 和上一个方法统一,使用 TextMeasure 类\nexport function measureTextSize(\n text: string | number | string[] | number[],\n textSpec: Partial<ITextGraphicAttribute>,\n fontFamily: string = DEFAULT_TEXT_FONT_FAMILY\n) {\n if (!text) {\n return { width: 0, height: 0 };\n }\n const bounds = getTextBounds({\n text,\n fontFamily: textSpec.fontFamily ?? fontFamily,\n fontSize: textSpec.fontSize || 12,\n fontWeight: textSpec.fontWeight as any,\n textAlign: textSpec.textAlign ?? 'center',\n textBaseline: textSpec.textBaseline,\n ellipsis: !!textSpec.ellipsis,\n maxLineWidth: textSpec.maxLineWidth || Infinity,\n lineHeight: textSpec.fontSize || 12\n });\n\n return { width: bounds.width(), height: bounds.height() };\n}\n\nexport function isRichText(attributes: TextContent, typeKey = 'type') {\n return (\n (typeKey in attributes && attributes[typeKey] === 'rich') ||\n (isObject(attributes.text) && (attributes.text as TextContent).type === 'rich')\n );\n}\n\nexport function richTextAttributeTransform(attributes: ITextGraphicAttribute & IRichTextAttribute & TextContent) {\n attributes.width = attributes.width ?? 0;\n attributes.height = attributes.height ?? 0;\n attributes.maxWidth = attributes.maxLineWidth;\n attributes.textConfig = (attributes.text as unknown as any).text || attributes.text;\n return attributes;\n}\n"]}
|
package/es/axis/base.js
CHANGED
|
@@ -4,7 +4,7 @@ import { abs, cloneDeep, get, isEmpty, isFunction, isNumberClose, merge, pi } fr
|
|
|
4
4
|
|
|
5
5
|
import { AbstractComponent } from "../core/base";
|
|
6
6
|
|
|
7
|
-
import { traverseGroup } from "../util";
|
|
7
|
+
import { isRichText, richTextAttributeTransform, traverseGroup } from "../util";
|
|
8
8
|
|
|
9
9
|
import { DEFAULT_STATES, StateValue } from "../constant";
|
|
10
10
|
|
|
@@ -14,8 +14,6 @@ import { DEFAULT_AXIS_THEME } from "./config";
|
|
|
14
14
|
|
|
15
15
|
import { Tag } from "../tag/tag";
|
|
16
16
|
|
|
17
|
-
import { DEFAULT_HTML_TEXT_SPEC } from "../constant";
|
|
18
|
-
|
|
19
17
|
export class AxisBase extends AbstractComponent {
|
|
20
18
|
constructor() {
|
|
21
19
|
super(...arguments), this.name = "axis", this.data = [], this.tickLineItems = [],
|
|
@@ -156,17 +154,12 @@ export class AxisBase extends AbstractComponent {
|
|
|
156
154
|
});
|
|
157
155
|
return labelGroup.name = `${AXIS_ELEMENT_NAME.labelContainer}-layer-${layer}`, labelGroup.id = this._getNodeId(`label-container-layer-${layer}`),
|
|
158
156
|
container.add(labelGroup), data.forEach(((item, index) => {
|
|
159
|
-
var _a
|
|
157
|
+
var _a;
|
|
160
158
|
const labelStyle = this._getLabelAttribute(item, index, data, layer);
|
|
161
159
|
let text;
|
|
162
|
-
if (
|
|
163
|
-
labelStyle.height = null !== (_b = labelStyle.height) && void 0 !== _b ? _b : 0,
|
|
164
|
-
text = graphicCreator.richtext(labelStyle)) : "html" === labelStyle.type ? (labelStyle.textConfig = [],
|
|
165
|
-
labelStyle.html = Object.assign(Object.assign({
|
|
166
|
-
dom: labelStyle.text
|
|
167
|
-
}, DEFAULT_HTML_TEXT_SPEC), labelStyle), text = graphicCreator.richtext(labelStyle)) : text = graphicCreator.text(labelStyle),
|
|
160
|
+
if (text = isRichText(labelStyle) ? graphicCreator.richtext(richTextAttributeTransform(labelStyle)) : graphicCreator.text(labelStyle),
|
|
168
161
|
text.name = AXIS_ELEMENT_NAME.label, text.id = this._getNodeId(`layer${layer}-label-${item.id}`),
|
|
169
|
-
isEmpty(null === (
|
|
162
|
+
isEmpty(null === (_a = this.attribute.label) || void 0 === _a ? void 0 : _a.state)) text.states = DEFAULT_STATES; else {
|
|
170
163
|
const labelState = merge({}, DEFAULT_STATES, this.attribute.label.state);
|
|
171
164
|
Object.keys(labelState).forEach((key => {
|
|
172
165
|
isFunction(labelState[key]) && (labelState[key] = labelState[key](item, index, data, layer));
|
package/es/axis/base.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/axis/base.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGxD,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtG,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGjD,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAU9C,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD,MAAM,OAAgB,QAAuC,SAAQ,iBAA8B;IAAnG;;QACE,SAAI,GAAG,MAAM,CAAC;QAkBJ,SAAI,GAA0B,EAAE,CAAC;QACjC,kBAAa,GAAmB,EAAE,CAAC;QACnC,qBAAgB,GAAmB,EAAE,CAAC;QACtC,uBAAkB,GAAqF,EAAE,CAAC;QAC1G,wBAAmB,GAAkB,IAAI,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AAE;;YAC/B,IAAI,CAAC,IAAI,iCACJ,IAAI,KACP,KAAK,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,EACpC,EAAE,EAAE,MAAA,IAAI,CAAC,EAAE,mCAAI,IAAI,CAAC,KAAK,IACzB,CAAC;QACL,CAAC,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;CACF","file":"base.js","sourcesContent":["/**\n * TODO:\n * 1. trunk 坐标轴截断\n * @description 坐标轴组件基类\n */\nimport type {\n IGroup,\n INode,\n ITextGraphicAttribute,\n TextAlignType,\n TextBaselineType,\n FederatedPointerEvent,\n IGraphic,\n IText\n} from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { graphicCreator } from '@visactor/vrender-core';\nimport type { Dict } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { abs, cloneDeep, get, isEmpty, isFunction, isNumberClose, merge, pi } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { Point } from '../core/type';\nimport type { TagAttributes } from '../tag';\nimport { traverseGroup } from '../util';\nimport { DEFAULT_STATES, StateValue } from '../constant';\nimport { AXIS_ELEMENT_NAME } from './constant';\nimport { DEFAULT_AXIS_THEME } from './config';\nimport type {\n LabelAttributes,\n AxisBaseAttributes,\n AxisItem,\n TickAttributes,\n TransformedAxisItem,\n SubTickAttributes,\n TickLineItem\n} from './type';\nimport { Tag } from '../tag/tag';\nimport { DEFAULT_HTML_TEXT_SPEC } from '../constant';\n\nexport abstract class AxisBase<T extends AxisBaseAttributes> extends AbstractComponent<Required<T>> {\n name = 'axis';\n\n // TODO: 组件整体统一起来\n protected _innerView: IGroup;\n getInnerView() {\n return this._innerView;\n }\n\n protected _prevInnerView: IGroup; // 缓存旧场景树,用于自定义动画\n /**\n * 获取更新前的旧场景树\n * @returns 返回更新前的旧场景树\n */\n getPrevInnerView() {\n return this._prevInnerView;\n }\n\n // 经过处理后的坐标轴点数据\n protected data: TransformedAxisItem[] = [];\n protected tickLineItems: TickLineItem[] = [];\n protected subTickLineItems: TickLineItem[] = [];\n protected axisLabelLayerSize: Dict<{ width: number; height: number; textAlign: string; textBaseline: string }> = {};\n protected axisLabelsContainer: IGroup | null = null;\n protected axisContainer: IGroup;\n\n private _lastHover: IGraphic;\n private _lastSelect: IGraphic;\n\n protected abstract renderLine(container: IGroup): void;\n abstract isInValidValue(value: number): boolean;\n abstract getTickCoord(value: number): Point;\n abstract getVerticalVector(offset: number, inside: boolean, point: Point): [number, number];\n abstract getRelativeVector(point?: Point): [number, number];\n protected abstract getTitleAttribute(): TagAttributes;\n protected abstract getTextBaseline(vector: [number, number], inside?: boolean): TextBaselineType;\n protected abstract beforeLabelsOverlap(\n labelShapes: IText[],\n labelData: AxisItem[],\n labelContainer: IGroup,\n layer: number,\n layerCount: number\n ): void;\n protected abstract handleLabelsOverlap(\n labelShapes: IText[],\n labelData: AxisItem[],\n labelContainer: IGroup,\n layer: number,\n layerCount: number\n ): void;\n protected abstract afterLabelsOverlap(\n labelShapes: IText[],\n labelData: AxisItem[],\n labelContainer: IGroup,\n layer: number,\n layerCount: number\n ): void;\n protected abstract getLabelAlign(\n vector: [number, number],\n inside?: boolean,\n angle?: number\n ): { textAlign: TextAlignType; textBaseline: TextBaselineType };\n\n /**\n * 坐标轴的一个特殊的方法,用于不更新场景树来获取更新属性后的包围盒\n * TODO:后面看情况再抽象为通用的方法\n */\n getBoundsWithoutRender(attributes: Partial<T>) {\n const currentAttribute = cloneDeep(this.attribute);\n merge(this.attribute, attributes);\n\n const offscreenGroup = graphicCreator.group({\n x: this.attribute.x,\n y: this.attribute.y\n });\n this.add(offscreenGroup);\n\n this._renderInner(offscreenGroup);\n\n this.removeChild(offscreenGroup);\n this.attribute = currentAttribute;\n return offscreenGroup.AABBBounds;\n }\n\n protected render(): void {\n this.removeAllChild();\n this._prevInnerView = this._innerView;\n this._innerView = graphicCreator.group({ x: 0, y: 0, pickable: false });\n this.add(this._innerView);\n\n this._renderInner(this._innerView);\n\n this._bindEvent();\n }\n\n private _bindEvent() {\n if (this.attribute.disableTriggerEvent) {\n return;\n }\n const { hover, select } = this.attribute;\n\n if (hover) {\n this._innerView.addEventListener('pointermove', this._onHover as EventListenerOrEventListenerObject);\n this._innerView.addEventListener('pointerout', this._onUnHover as EventListenerOrEventListenerObject);\n }\n\n if (select) {\n this._innerView.addEventListener('pointerdown', this._onClick as EventListenerOrEventListenerObject);\n }\n }\n\n private _onHover = (e: FederatedPointerEvent) => {\n const target = e.target as unknown as IGraphic;\n if (target !== this._lastHover && target.name && !isEmpty(target.states)) {\n target.addState(StateValue.hover, true);\n traverseGroup(this.axisContainer, (node: IGraphic) => {\n if (node !== target && node.name && !isEmpty(node.states)) {\n node.addState(StateValue.hoverReverse, true);\n }\n });\n this._lastHover = target;\n }\n };\n\n private _onUnHover = (e: FederatedPointerEvent) => {\n if (this._lastHover) {\n traverseGroup(this.axisContainer, (node: IGraphic) => {\n if (node.name && !isEmpty(node.states)) {\n node.removeState(StateValue.hoverReverse);\n node.removeState(StateValue.hover);\n }\n });\n this._lastHover = null;\n }\n };\n\n private _onClick = (e: FederatedPointerEvent) => {\n const target = e.target as unknown as IGraphic;\n if (this._lastSelect === target && target.hasState(StateValue.selected)) {\n // 取消选中\n this._lastSelect = null;\n traverseGroup(this.axisContainer, (node: IGraphic) => {\n if (node.name && !isEmpty(node.states)) {\n node.removeState(StateValue.selectedReverse);\n node.removeState(StateValue.selected);\n }\n });\n return;\n }\n\n if (target.name && !isEmpty(target.states)) {\n target.addState(StateValue.selected, true);\n traverseGroup(this.axisContainer, (node: IGraphic) => {\n if (node !== target && node.name && !isEmpty(node.states)) {\n node.addState(StateValue.selectedReverse, true);\n }\n });\n this._lastSelect = target;\n }\n };\n\n protected _renderInner(container: IGroup) {\n const { title, label, tick, line, items } = this.attribute;\n\n const axisContainer = graphicCreator.group({ x: 0, y: 0, zIndex: 1 });\n axisContainer.name = AXIS_ELEMENT_NAME.axisContainer;\n axisContainer.id = this._getNodeId('container');\n axisContainer.setMode(this.mode);\n this.axisContainer = axisContainer;\n container.add(axisContainer);\n\n // 渲染轴线\n if (line && line.visible) {\n this.renderLine(axisContainer);\n }\n\n if (items && items.length) {\n this.data = this._transformItems(items[0]);\n\n // 渲染刻度线,包含子刻度线\n if (tick && tick.visible) {\n this.renderTicks(axisContainer);\n }\n // 渲染标签\n if (label && label.visible) {\n const labelGroup = graphicCreator.group({ x: 0, y: 0, pickable: false });\n labelGroup.name = AXIS_ELEMENT_NAME.labelContainer;\n labelGroup.id = this._getNodeId('label-container');\n this.axisLabelsContainer = labelGroup;\n axisContainer.add(labelGroup);\n items.forEach((axisItems: AxisItem[], layer: number) => {\n const layerLabelGroup = this.renderLabels(labelGroup, axisItems, layer);\n\n const labels = layerLabelGroup.getChildren() as IText[];\n this.beforeLabelsOverlap(labels, axisItems, layerLabelGroup, layer, items.length);\n // handle overlap\n this.handleLabelsOverlap(labels, axisItems, layerLabelGroup, layer, items.length);\n this.afterLabelsOverlap(labels, axisItems, layerLabelGroup, layer, items.length);\n\n let maxTextWidth = 0;\n let maxTextHeight = 0;\n let textAlign = 'center';\n let textBaseline = 'middle';\n labels.forEach((label: IText) => {\n const labelStyle = label.attribute;\n const angle = labelStyle.angle ?? 0;\n const textBounds = label.AABBBounds;\n let textWidth = textBounds.width();\n let textHeight = textBounds.height();\n if (angle) {\n textWidth = Math.abs(textWidth * Math.cos(angle));\n textHeight = Math.abs(textHeight * Math.sin(angle));\n }\n maxTextWidth = Math.max(maxTextWidth, textWidth);\n maxTextHeight = Math.max(maxTextHeight, textHeight);\n\n textAlign = labelStyle.textAlign as string;\n textBaseline = labelStyle.textBaseline as string;\n });\n this.axisLabelLayerSize[layer] = {\n width: maxTextWidth,\n height: maxTextHeight,\n\n textAlign,\n textBaseline\n };\n });\n }\n }\n\n // 渲染标题\n if (title && title.visible) {\n this.renderTitle(axisContainer);\n }\n }\n protected renderTicks(container: IGroup) {\n const tickLineItems = this.getTickLineItems();\n\n const tickLineGroup = graphicCreator.group({ x: 0, y: 0, pickable: false });\n tickLineGroup.name = AXIS_ELEMENT_NAME.tickContainer;\n tickLineGroup.id = this._getNodeId('tick-container');\n container.add(tickLineGroup);\n\n tickLineItems.forEach((item: TickLineItem, index) => {\n const line = graphicCreator.line({\n ...this._getTickLineAttribute('tick', item, index, tickLineItems)\n });\n line.name = AXIS_ELEMENT_NAME.tick;\n line.id = this._getNodeId(item.id);\n\n if (isEmpty(this.attribute.tick?.state)) {\n line.states = DEFAULT_STATES;\n } else {\n const data = this.data[index];\n const tickLineState = merge({}, DEFAULT_STATES, this.attribute.tick.state);\n Object.keys(tickLineState).forEach(key => {\n if (isFunction(tickLineState[key])) {\n tickLineState[key] = tickLineState[key](data.rawValue, index, data, this.data);\n }\n });\n line.states = tickLineState;\n }\n\n tickLineGroup.add(line);\n });\n this.tickLineItems = tickLineItems;\n\n // subTick 处理\n const { subTick } = this.attribute;\n if (subTick && subTick.visible) {\n const subTickLineItems: TickLineItem[] = this.getSubTickLineItems();\n if (subTickLineItems.length) {\n subTickLineItems.forEach((item: TickLineItem, index) => {\n const line = graphicCreator.line({\n ...this._getTickLineAttribute('subTick', item, index, tickLineItems)\n });\n line.name = AXIS_ELEMENT_NAME.subTick;\n line.id = this._getNodeId(`${index}`);\n\n if (isEmpty(subTick.state)) {\n line.states = DEFAULT_STATES;\n } else {\n const subTickLineState = merge({}, DEFAULT_STATES, subTick.state);\n Object.keys(subTickLineState).forEach(key => {\n if (isFunction(subTickLineState[key])) {\n subTickLineState[key] = subTickLineState[key](item.value, index, item, tickLineItems);\n }\n });\n line.states = subTickLineState;\n }\n\n tickLineGroup.add(line);\n });\n }\n\n this.subTickLineItems = subTickLineItems;\n }\n }\n\n protected renderLabels(container: IGroup, items: AxisItem[], layer: number) {\n const { dataFilter } = this.attribute.label;\n if (dataFilter && isFunction(dataFilter)) {\n items = dataFilter(items, layer) as TransformedAxisItem[];\n }\n const data = this._transformItems(items);\n\n const labelGroup = graphicCreator.group({ x: 0, y: 0, pickable: false });\n labelGroup.name = `${AXIS_ELEMENT_NAME.labelContainer}-layer-${layer}`;\n labelGroup.id = this._getNodeId(`label-container-layer-${layer}`);\n container.add(labelGroup);\n\n data.forEach((item: TransformedAxisItem, index: number) => {\n const labelStyle: any = this._getLabelAttribute(item, index, data, layer);\n let text;\n if (labelStyle.type === 'rich') {\n labelStyle.textConfig = labelStyle.text;\n labelStyle.width = labelStyle.width ?? 0;\n labelStyle.height = labelStyle.height ?? 0;\n text = graphicCreator.richtext(labelStyle);\n } else if (labelStyle.type === 'html') {\n labelStyle.textConfig = [] as any;\n labelStyle.html = {\n dom: labelStyle.text as string,\n ...DEFAULT_HTML_TEXT_SPEC,\n ...labelStyle\n };\n text = graphicCreator.richtext(labelStyle as any);\n } else {\n text = graphicCreator.text(labelStyle as any);\n }\n text.name = AXIS_ELEMENT_NAME.label;\n text.id = this._getNodeId(`layer${layer}-label-${item.id}`);\n if (isEmpty(this.attribute.label?.state)) {\n text.states = DEFAULT_STATES;\n } else {\n const labelState = merge({}, DEFAULT_STATES, this.attribute.label.state);\n Object.keys(labelState).forEach(key => {\n if (isFunction(labelState[key])) {\n labelState[key] = labelState[key](item, index, data, layer);\n }\n });\n text.states = labelState;\n }\n\n labelGroup.add(text);\n });\n\n return labelGroup;\n }\n\n protected renderTitle(container: IGroup) {\n const titleAttributes = this.getTitleAttribute();\n const axisTitle = new Tag({\n ...titleAttributes\n });\n axisTitle.name = AXIS_ELEMENT_NAME.title;\n axisTitle.id = this._getNodeId('title');\n container.add(axisTitle as unknown as INode);\n }\n\n protected getVerticalCoord(point: Point, offset: number, inside: boolean): Point {\n const vector = this.getVerticalVector(offset, inside, point);\n return {\n x: point.x + vector[0],\n y: point.y + vector[1]\n };\n }\n\n protected getTextAlign(vector: number[]): TextAlignType {\n let align: TextAlignType = 'center';\n\n if (isNumberClose(vector[0], 0)) {\n if (isNumberClose(vector[1], 0)) {\n if (Object.is(vector[1], -0)) {\n align = 'start';\n } else if (Object.is(vector[0], -0)) {\n align = 'end';\n }\n } else {\n align = 'center';\n }\n } else if (vector[0] > 0) {\n align = 'start';\n } else if (vector[0] < 0) {\n align = 'end';\n }\n return align;\n }\n\n protected getTickLineItems() {\n const { tick } = this.attribute;\n const data = this.data;\n // tick 处理\n const tickLineItems: TickLineItem[] = [];\n const { alignWithLabel, inside = false, length, dataFilter } = tick as TickAttributes;\n let tickSegment = 1;\n const count = data.length;\n if (count >= 2) {\n tickSegment = data[1].value - data[0].value;\n }\n\n (dataFilter && isFunction(dataFilter) ? dataFilter(data) : data).forEach((item: TransformedAxisItem) => {\n let point = item.point;\n let tickValue = item.value;\n if (!alignWithLabel) {\n const value = item.value - tickSegment / 2;\n if (this.isInValidValue(value)) {\n return;\n }\n point = this.getTickCoord(value);\n tickValue = value;\n }\n const endPoint = this.getVerticalCoord(point, length as number, inside);\n\n if (this.mode === '3d') {\n const vec = this.getVerticalVector(length as number, inside, point);\n let alpha = 0;\n let beta = 0;\n if (abs(vec[0]) > abs(vec[1])) {\n alpha = (pi / 2) * (endPoint.x > point.x ? 1 : -1);\n } else {\n beta = (pi / 2) * (endPoint.y > point.y ? -1 : 1);\n }\n tickLineItems.push({\n start: point,\n end: endPoint,\n value: tickValue,\n id: `tick-${item.id}`,\n anchor: [point.x, point.y],\n alpha,\n beta\n });\n } else {\n tickLineItems.push({\n start: point,\n end: endPoint,\n value: tickValue,\n id: `tick-${item.id}`\n });\n }\n });\n\n return tickLineItems;\n }\n\n protected getSubTickLineItems() {\n const { subTick } = this.attribute as AxisBaseAttributes;\n const subTickLineItems: TickLineItem[] = [];\n const { count: subCount = 4, inside = false, length = 2 } = subTick as SubTickAttributes;\n const tickLineItems = this.tickLineItems;\n const tickLineCount = tickLineItems.length;\n\n if (tickLineCount >= 2) {\n for (let i = 0; i < tickLineCount - 1; i++) {\n const pre = tickLineItems[i];\n const next = tickLineItems[i + 1];\n for (let j = 0; j < subCount; j++) {\n const percent = (j + 1) / (subCount + 1);\n const value = (1 - percent) * pre.value + percent * next.value;\n const point = this.getTickCoord(value);\n const endPoint = this.getVerticalCoord(point, length, inside);\n subTickLineItems.push({\n start: point,\n end: endPoint,\n value,\n id: `sub-tick-${value}`\n });\n }\n }\n }\n\n return subTickLineItems;\n }\n\n private _getTickLineAttribute(type: string, tickItem: TickLineItem, index: number, tickItems: TickLineItem[]) {\n let style = get(this.attribute, `${type}.style`);\n const data = this.data[index];\n style = isFunction(style)\n ? merge(\n {},\n get(DEFAULT_AXIS_THEME, `${type}.style`),\n type === 'tick'\n ? style(data.rawValue, index, data, this.data)\n : style(tickItem.value, index, tickItem, tickItems)\n )\n : style;\n\n const { start, end, anchor, alpha, beta } = tickItem;\n return {\n points: [start, end],\n anchor,\n alpha,\n beta,\n ...style\n };\n }\n\n private _getLabelAttribute(\n tickDatum: TransformedAxisItem,\n index: number,\n tickData: TransformedAxisItem[],\n layer: number\n ) {\n const { space = 4, inside = false, formatMethod, type = 'text', text } = this.attribute.label as LabelAttributes;\n let offset = space;\n let tickLength = 0;\n if (this.attribute.tick?.visible && this.attribute.tick.inside === inside) {\n tickLength = this.attribute.tick.length || 4;\n }\n if (this.attribute.subTick?.visible && this.attribute.subTick.inside === inside) {\n tickLength = Math.max(tickLength, this.attribute.subTick.length || 2);\n }\n offset += tickLength;\n\n // 先测试 line\n const axisVector = this.getRelativeVector(tickDatum.point);\n if (layer > 0) {\n if (axisVector[1] === 0) {\n offset += (this.axisLabelLayerSize[layer - 1].height + get(this.attribute, 'label.space', 4)) * layer;\n } else {\n offset += (this.axisLabelLayerSize[layer - 1].width + get(this.attribute, 'label.space', 4)) * layer;\n }\n }\n\n const point = this.getVerticalCoord(tickDatum.point, offset, inside);\n const vector = this.getVerticalVector(offset || 1, inside, point);\n const textContent = formatMethod\n ? formatMethod(`${tickDatum.label}`, tickDatum, index, tickData, layer)\n : tickDatum.label;\n let { style: textStyle } = this.attribute.label as LabelAttributes;\n textStyle = isFunction(textStyle)\n ? merge({}, DEFAULT_AXIS_THEME.label.style, textStyle(tickDatum, index, tickData, layer))\n : textStyle;\n\n const labelAlign = this.getLabelAlign(vector, inside, (textStyle as ITextGraphicAttribute).angle);\n textStyle = merge(labelAlign, textStyle) as Partial<ITextGraphicAttribute>;\n // 兼容原先 style.text 回调的方式\n if (isFunction(textStyle.text)) {\n // @ts-ignore\n textStyle.text = textStyle.text({\n label: tickDatum.label,\n value: tickDatum.rawValue,\n index: tickDatum.index,\n layer\n });\n }\n\n return {\n ...this.getLabelPosition(point, vector, textContent, textStyle),\n text: text ?? textContent,\n lineHeight: textStyle?.fontSize,\n type,\n ...textStyle\n };\n }\n\n protected getLabelPosition(\n point: Point,\n vector: [number, number],\n text: string | number,\n style: Partial<ITextGraphicAttribute>\n ) {\n return point;\n }\n\n private _transformItems(items: AxisItem[]) {\n const data: TransformedAxisItem[] = [];\n items.forEach((item: AxisItem) => {\n data.push({\n ...item,\n point: this.getTickCoord(item.value),\n id: item.id ?? item.label\n });\n });\n return data;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/axis/base.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGxD,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtG,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGjD,OAAO,EAAE,UAAU,EAAE,0BAA0B,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAU9C,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAGjC,MAAM,OAAgB,QA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;IACd,CAAC;CACF","file":"base.js","sourcesContent":["/**\n * TODO:\n * 1. trunk 坐标轴截断\n * @description 坐标轴组件基类\n */\nimport type {\n IGroup,\n INode,\n ITextGraphicAttribute,\n TextAlignType,\n TextBaselineType,\n FederatedPointerEvent,\n IGraphic,\n IText\n} from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { graphicCreator } from '@visactor/vrender-core';\nimport type { Dict } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { abs, cloneDeep, get, isEmpty, isFunction, isNumberClose, merge, pi } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { Point } from '../core/type';\nimport type { TagAttributes } from '../tag';\nimport { isRichText, richTextAttributeTransform, traverseGroup } from '../util';\nimport { DEFAULT_STATES, StateValue } from '../constant';\nimport { AXIS_ELEMENT_NAME } from './constant';\nimport { DEFAULT_AXIS_THEME } from './config';\nimport type {\n LabelAttributes,\n AxisBaseAttributes,\n AxisItem,\n TickAttributes,\n TransformedAxisItem,\n SubTickAttributes,\n TickLineItem\n} from './type';\nimport { Tag } from '../tag/tag';\nimport { DEFAULT_HTML_TEXT_SPEC } from '../constant';\n\nexport abstract class AxisBase<T extends AxisBaseAttributes> extends AbstractComponent<Required<T>> {\n name = 'axis';\n\n // TODO: 组件整体统一起来\n protected _innerView: IGroup;\n getInnerView() {\n return this._innerView;\n }\n\n protected _prevInnerView: IGroup; // 缓存旧场景树,用于自定义动画\n /**\n * 获取更新前的旧场景树\n * @returns 返回更新前的旧场景树\n */\n getPrevInnerView() {\n return this._prevInnerView;\n }\n\n // 经过处理后的坐标轴点数据\n protected data: TransformedAxisItem[] = [];\n protected tickLineItems: TickLineItem[] = [];\n protected subTickLineItems: TickLineItem[] = [];\n protected axisLabelLayerSize: Dict<{ width: number; height: number; textAlign: string; textBaseline: string }> = {};\n protected axisLabelsContainer: IGroup | null = null;\n protected axisContainer: IGroup;\n\n private _lastHover: IGraphic;\n private _lastSelect: IGraphic;\n\n protected abstract renderLine(container: IGroup): void;\n abstract isInValidValue(value: number): boolean;\n abstract getTickCoord(value: number): Point;\n abstract getVerticalVector(offset: number, inside: boolean, point: Point): [number, number];\n abstract getRelativeVector(point?: Point): [number, number];\n protected abstract getTitleAttribute(): TagAttributes;\n protected abstract getTextBaseline(vector: [number, number], inside?: boolean): TextBaselineType;\n protected abstract beforeLabelsOverlap(\n labelShapes: IText[],\n labelData: AxisItem[],\n labelContainer: IGroup,\n layer: number,\n layerCount: number\n ): void;\n protected abstract handleLabelsOverlap(\n labelShapes: IText[],\n labelData: AxisItem[],\n labelContainer: IGroup,\n layer: number,\n layerCount: number\n ): void;\n protected abstract afterLabelsOverlap(\n labelShapes: IText[],\n labelData: AxisItem[],\n labelContainer: IGroup,\n layer: number,\n layerCount: number\n ): void;\n protected abstract getLabelAlign(\n vector: [number, number],\n inside?: boolean,\n angle?: number\n ): { textAlign: TextAlignType; textBaseline: TextBaselineType };\n\n /**\n * 坐标轴的一个特殊的方法,用于不更新场景树来获取更新属性后的包围盒\n * TODO:后面看情况再抽象为通用的方法\n */\n getBoundsWithoutRender(attributes: Partial<T>) {\n const currentAttribute = cloneDeep(this.attribute);\n merge(this.attribute, attributes);\n\n const offscreenGroup = graphicCreator.group({\n x: this.attribute.x,\n y: this.attribute.y\n });\n this.add(offscreenGroup);\n\n this._renderInner(offscreenGroup);\n\n this.removeChild(offscreenGroup);\n this.attribute = currentAttribute;\n return offscreenGroup.AABBBounds;\n }\n\n protected render(): void {\n this.removeAllChild();\n this._prevInnerView = this._innerView;\n this._innerView = graphicCreator.group({ x: 0, y: 0, pickable: false });\n this.add(this._innerView);\n\n this._renderInner(this._innerView);\n\n this._bindEvent();\n }\n\n private _bindEvent() {\n if (this.attribute.disableTriggerEvent) {\n return;\n }\n const { hover, select } = this.attribute;\n\n if (hover) {\n this._innerView.addEventListener('pointermove', this._onHover as EventListenerOrEventListenerObject);\n this._innerView.addEventListener('pointerout', this._onUnHover as EventListenerOrEventListenerObject);\n }\n\n if (select) {\n this._innerView.addEventListener('pointerdown', this._onClick as EventListenerOrEventListenerObject);\n }\n }\n\n private _onHover = (e: FederatedPointerEvent) => {\n const target = e.target as unknown as IGraphic;\n if (target !== this._lastHover && target.name && !isEmpty(target.states)) {\n target.addState(StateValue.hover, true);\n traverseGroup(this.axisContainer, (node: IGraphic) => {\n if (node !== target && node.name && !isEmpty(node.states)) {\n node.addState(StateValue.hoverReverse, true);\n }\n });\n this._lastHover = target;\n }\n };\n\n private _onUnHover = (e: FederatedPointerEvent) => {\n if (this._lastHover) {\n traverseGroup(this.axisContainer, (node: IGraphic) => {\n if (node.name && !isEmpty(node.states)) {\n node.removeState(StateValue.hoverReverse);\n node.removeState(StateValue.hover);\n }\n });\n this._lastHover = null;\n }\n };\n\n private _onClick = (e: FederatedPointerEvent) => {\n const target = e.target as unknown as IGraphic;\n if (this._lastSelect === target && target.hasState(StateValue.selected)) {\n // 取消选中\n this._lastSelect = null;\n traverseGroup(this.axisContainer, (node: IGraphic) => {\n if (node.name && !isEmpty(node.states)) {\n node.removeState(StateValue.selectedReverse);\n node.removeState(StateValue.selected);\n }\n });\n return;\n }\n\n if (target.name && !isEmpty(target.states)) {\n target.addState(StateValue.selected, true);\n traverseGroup(this.axisContainer, (node: IGraphic) => {\n if (node !== target && node.name && !isEmpty(node.states)) {\n node.addState(StateValue.selectedReverse, true);\n }\n });\n this._lastSelect = target;\n }\n };\n\n protected _renderInner(container: IGroup) {\n const { title, label, tick, line, items } = this.attribute;\n\n const axisContainer = graphicCreator.group({ x: 0, y: 0, zIndex: 1 });\n axisContainer.name = AXIS_ELEMENT_NAME.axisContainer;\n axisContainer.id = this._getNodeId('container');\n axisContainer.setMode(this.mode);\n this.axisContainer = axisContainer;\n container.add(axisContainer);\n\n // 渲染轴线\n if (line && line.visible) {\n this.renderLine(axisContainer);\n }\n\n if (items && items.length) {\n this.data = this._transformItems(items[0]);\n\n // 渲染刻度线,包含子刻度线\n if (tick && tick.visible) {\n this.renderTicks(axisContainer);\n }\n // 渲染标签\n if (label && label.visible) {\n const labelGroup = graphicCreator.group({ x: 0, y: 0, pickable: false });\n labelGroup.name = AXIS_ELEMENT_NAME.labelContainer;\n labelGroup.id = this._getNodeId('label-container');\n this.axisLabelsContainer = labelGroup;\n axisContainer.add(labelGroup);\n items.forEach((axisItems: AxisItem[], layer: number) => {\n const layerLabelGroup = this.renderLabels(labelGroup, axisItems, layer);\n\n const labels = layerLabelGroup.getChildren() as IText[];\n this.beforeLabelsOverlap(labels, axisItems, layerLabelGroup, layer, items.length);\n // handle overlap\n this.handleLabelsOverlap(labels, axisItems, layerLabelGroup, layer, items.length);\n this.afterLabelsOverlap(labels, axisItems, layerLabelGroup, layer, items.length);\n\n let maxTextWidth = 0;\n let maxTextHeight = 0;\n let textAlign = 'center';\n let textBaseline = 'middle';\n labels.forEach((label: IText) => {\n const labelStyle = label.attribute;\n const angle = labelStyle.angle ?? 0;\n const textBounds = label.AABBBounds;\n let textWidth = textBounds.width();\n let textHeight = textBounds.height();\n if (angle) {\n textWidth = Math.abs(textWidth * Math.cos(angle));\n textHeight = Math.abs(textHeight * Math.sin(angle));\n }\n maxTextWidth = Math.max(maxTextWidth, textWidth);\n maxTextHeight = Math.max(maxTextHeight, textHeight);\n\n textAlign = labelStyle.textAlign as string;\n textBaseline = labelStyle.textBaseline as string;\n });\n this.axisLabelLayerSize[layer] = {\n width: maxTextWidth,\n height: maxTextHeight,\n\n textAlign,\n textBaseline\n };\n });\n }\n }\n\n // 渲染标题\n if (title && title.visible) {\n this.renderTitle(axisContainer);\n }\n }\n protected renderTicks(container: IGroup) {\n const tickLineItems = this.getTickLineItems();\n\n const tickLineGroup = graphicCreator.group({ x: 0, y: 0, pickable: false });\n tickLineGroup.name = AXIS_ELEMENT_NAME.tickContainer;\n tickLineGroup.id = this._getNodeId('tick-container');\n container.add(tickLineGroup);\n\n tickLineItems.forEach((item: TickLineItem, index) => {\n const line = graphicCreator.line({\n ...this._getTickLineAttribute('tick', item, index, tickLineItems)\n });\n line.name = AXIS_ELEMENT_NAME.tick;\n line.id = this._getNodeId(item.id);\n\n if (isEmpty(this.attribute.tick?.state)) {\n line.states = DEFAULT_STATES;\n } else {\n const data = this.data[index];\n const tickLineState = merge({}, DEFAULT_STATES, this.attribute.tick.state);\n Object.keys(tickLineState).forEach(key => {\n if (isFunction(tickLineState[key])) {\n tickLineState[key] = tickLineState[key](data.rawValue, index, data, this.data);\n }\n });\n line.states = tickLineState;\n }\n\n tickLineGroup.add(line);\n });\n this.tickLineItems = tickLineItems;\n\n // subTick 处理\n const { subTick } = this.attribute;\n if (subTick && subTick.visible) {\n const subTickLineItems: TickLineItem[] = this.getSubTickLineItems();\n if (subTickLineItems.length) {\n subTickLineItems.forEach((item: TickLineItem, index) => {\n const line = graphicCreator.line({\n ...this._getTickLineAttribute('subTick', item, index, tickLineItems)\n });\n line.name = AXIS_ELEMENT_NAME.subTick;\n line.id = this._getNodeId(`${index}`);\n\n if (isEmpty(subTick.state)) {\n line.states = DEFAULT_STATES;\n } else {\n const subTickLineState = merge({}, DEFAULT_STATES, subTick.state);\n Object.keys(subTickLineState).forEach(key => {\n if (isFunction(subTickLineState[key])) {\n subTickLineState[key] = subTickLineState[key](item.value, index, item, tickLineItems);\n }\n });\n line.states = subTickLineState;\n }\n\n tickLineGroup.add(line);\n });\n }\n\n this.subTickLineItems = subTickLineItems;\n }\n }\n\n protected renderLabels(container: IGroup, items: AxisItem[], layer: number) {\n const { dataFilter } = this.attribute.label;\n if (dataFilter && isFunction(dataFilter)) {\n items = dataFilter(items, layer) as TransformedAxisItem[];\n }\n const data = this._transformItems(items);\n\n const labelGroup = graphicCreator.group({ x: 0, y: 0, pickable: false });\n labelGroup.name = `${AXIS_ELEMENT_NAME.labelContainer}-layer-${layer}`;\n labelGroup.id = this._getNodeId(`label-container-layer-${layer}`);\n container.add(labelGroup);\n\n data.forEach((item: TransformedAxisItem, index: number) => {\n const labelStyle: any = this._getLabelAttribute(item, index, data, layer);\n let text;\n if (isRichText(labelStyle)) {\n text = graphicCreator.richtext(richTextAttributeTransform(labelStyle));\n } else {\n text = graphicCreator.text(labelStyle as any);\n }\n text.name = AXIS_ELEMENT_NAME.label;\n text.id = this._getNodeId(`layer${layer}-label-${item.id}`);\n if (isEmpty(this.attribute.label?.state)) {\n text.states = DEFAULT_STATES;\n } else {\n const labelState = merge({}, DEFAULT_STATES, this.attribute.label.state);\n Object.keys(labelState).forEach(key => {\n if (isFunction(labelState[key])) {\n labelState[key] = labelState[key](item, index, data, layer);\n }\n });\n text.states = labelState;\n }\n\n labelGroup.add(text);\n });\n\n return labelGroup;\n }\n\n protected renderTitle(container: IGroup) {\n const titleAttributes = this.getTitleAttribute();\n const axisTitle = new Tag({\n ...titleAttributes\n });\n axisTitle.name = AXIS_ELEMENT_NAME.title;\n axisTitle.id = this._getNodeId('title');\n container.add(axisTitle as unknown as INode);\n }\n\n protected getVerticalCoord(point: Point, offset: number, inside: boolean): Point {\n const vector = this.getVerticalVector(offset, inside, point);\n return {\n x: point.x + vector[0],\n y: point.y + vector[1]\n };\n }\n\n protected getTextAlign(vector: number[]): TextAlignType {\n let align: TextAlignType = 'center';\n\n if (isNumberClose(vector[0], 0)) {\n if (isNumberClose(vector[1], 0)) {\n if (Object.is(vector[1], -0)) {\n align = 'start';\n } else if (Object.is(vector[0], -0)) {\n align = 'end';\n }\n } else {\n align = 'center';\n }\n } else if (vector[0] > 0) {\n align = 'start';\n } else if (vector[0] < 0) {\n align = 'end';\n }\n return align;\n }\n\n protected getTickLineItems() {\n const { tick } = this.attribute;\n const data = this.data;\n // tick 处理\n const tickLineItems: TickLineItem[] = [];\n const { alignWithLabel, inside = false, length, dataFilter } = tick as TickAttributes;\n let tickSegment = 1;\n const count = data.length;\n if (count >= 2) {\n tickSegment = data[1].value - data[0].value;\n }\n\n (dataFilter && isFunction(dataFilter) ? dataFilter(data) : data).forEach((item: TransformedAxisItem) => {\n let point = item.point;\n let tickValue = item.value;\n if (!alignWithLabel) {\n const value = item.value - tickSegment / 2;\n if (this.isInValidValue(value)) {\n return;\n }\n point = this.getTickCoord(value);\n tickValue = value;\n }\n const endPoint = this.getVerticalCoord(point, length as number, inside);\n\n if (this.mode === '3d') {\n const vec = this.getVerticalVector(length as number, inside, point);\n let alpha = 0;\n let beta = 0;\n if (abs(vec[0]) > abs(vec[1])) {\n alpha = (pi / 2) * (endPoint.x > point.x ? 1 : -1);\n } else {\n beta = (pi / 2) * (endPoint.y > point.y ? -1 : 1);\n }\n tickLineItems.push({\n start: point,\n end: endPoint,\n value: tickValue,\n id: `tick-${item.id}`,\n anchor: [point.x, point.y],\n alpha,\n beta\n });\n } else {\n tickLineItems.push({\n start: point,\n end: endPoint,\n value: tickValue,\n id: `tick-${item.id}`\n });\n }\n });\n\n return tickLineItems;\n }\n\n protected getSubTickLineItems() {\n const { subTick } = this.attribute as AxisBaseAttributes;\n const subTickLineItems: TickLineItem[] = [];\n const { count: subCount = 4, inside = false, length = 2 } = subTick as SubTickAttributes;\n const tickLineItems = this.tickLineItems;\n const tickLineCount = tickLineItems.length;\n\n if (tickLineCount >= 2) {\n for (let i = 0; i < tickLineCount - 1; i++) {\n const pre = tickLineItems[i];\n const next = tickLineItems[i + 1];\n for (let j = 0; j < subCount; j++) {\n const percent = (j + 1) / (subCount + 1);\n const value = (1 - percent) * pre.value + percent * next.value;\n const point = this.getTickCoord(value);\n const endPoint = this.getVerticalCoord(point, length, inside);\n subTickLineItems.push({\n start: point,\n end: endPoint,\n value,\n id: `sub-tick-${value}`\n });\n }\n }\n }\n\n return subTickLineItems;\n }\n\n private _getTickLineAttribute(type: string, tickItem: TickLineItem, index: number, tickItems: TickLineItem[]) {\n let style = get(this.attribute, `${type}.style`);\n const data = this.data[index];\n style = isFunction(style)\n ? merge(\n {},\n get(DEFAULT_AXIS_THEME, `${type}.style`),\n type === 'tick'\n ? style(data.rawValue, index, data, this.data)\n : style(tickItem.value, index, tickItem, tickItems)\n )\n : style;\n\n const { start, end, anchor, alpha, beta } = tickItem;\n return {\n points: [start, end],\n anchor,\n alpha,\n beta,\n ...style\n };\n }\n\n private _getLabelAttribute(\n tickDatum: TransformedAxisItem,\n index: number,\n tickData: TransformedAxisItem[],\n layer: number\n ) {\n const { space = 4, inside = false, formatMethod, type = 'text', text } = this.attribute.label as LabelAttributes;\n let offset = space;\n let tickLength = 0;\n if (this.attribute.tick?.visible && this.attribute.tick.inside === inside) {\n tickLength = this.attribute.tick.length || 4;\n }\n if (this.attribute.subTick?.visible && this.attribute.subTick.inside === inside) {\n tickLength = Math.max(tickLength, this.attribute.subTick.length || 2);\n }\n offset += tickLength;\n\n // 先测试 line\n const axisVector = this.getRelativeVector(tickDatum.point);\n if (layer > 0) {\n if (axisVector[1] === 0) {\n offset += (this.axisLabelLayerSize[layer - 1].height + get(this.attribute, 'label.space', 4)) * layer;\n } else {\n offset += (this.axisLabelLayerSize[layer - 1].width + get(this.attribute, 'label.space', 4)) * layer;\n }\n }\n\n const point = this.getVerticalCoord(tickDatum.point, offset, inside);\n const vector = this.getVerticalVector(offset || 1, inside, point);\n const textContent = formatMethod\n ? formatMethod(`${tickDatum.label}`, tickDatum, index, tickData, layer)\n : tickDatum.label;\n let { style: textStyle } = this.attribute.label as LabelAttributes;\n textStyle = isFunction(textStyle)\n ? merge({}, DEFAULT_AXIS_THEME.label.style, textStyle(tickDatum, index, tickData, layer))\n : textStyle;\n\n const labelAlign = this.getLabelAlign(vector, inside, (textStyle as ITextGraphicAttribute).angle);\n textStyle = merge(labelAlign, textStyle) as Partial<ITextGraphicAttribute>;\n // 兼容原先 style.text 回调的方式\n if (isFunction(textStyle.text)) {\n // @ts-ignore\n textStyle.text = textStyle.text({\n label: tickDatum.label,\n value: tickDatum.rawValue,\n index: tickDatum.index,\n layer\n });\n }\n\n return {\n ...this.getLabelPosition(point, vector, textContent, textStyle),\n text: text ?? textContent,\n lineHeight: textStyle?.fontSize,\n type,\n ...textStyle\n };\n }\n\n protected getLabelPosition(\n point: Point,\n vector: [number, number],\n text: string | number,\n style: Partial<ITextGraphicAttribute>\n ) {\n return point;\n }\n\n private _transformItems(items: AxisItem[]) {\n const data: TransformedAxisItem[] = [];\n items.forEach((item: AxisItem) => {\n data.push({\n ...item,\n point: this.getTickCoord(item.value),\n id: item.id ?? item.label\n });\n });\n return data;\n }\n}\n"]}
|
package/es/core/type.d.ts
CHANGED
|
@@ -28,16 +28,18 @@ export type Padding = number | number[] | {
|
|
|
28
28
|
right?: number;
|
|
29
29
|
};
|
|
30
30
|
type CommonTextContent = {
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
text?: string | string[] | number | number[] | {
|
|
32
|
+
type?: 'text';
|
|
33
|
+
text: string | string[] | number | number[];
|
|
34
|
+
};
|
|
33
35
|
};
|
|
34
36
|
type RichTextContent = {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
text?: {
|
|
38
|
+
type: 'rich';
|
|
39
|
+
text: IRichTextCharacter[];
|
|
40
|
+
};
|
|
37
41
|
};
|
|
38
|
-
type
|
|
39
|
-
type?: '
|
|
40
|
-
text?: string | HTMLElement;
|
|
42
|
+
export type TextContent = (CommonTextContent | RichTextContent) & {
|
|
43
|
+
type?: 'text' | 'rich';
|
|
41
44
|
};
|
|
42
|
-
export type TextContent = CommonTextContent | RichTextContent | HtmlTextContent;
|
|
43
45
|
export {};
|
package/es/core/type.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type { IRichTextCharacter } from '@visactor/vrender-core';\n\nexport type Point = {\n x: number;\n y: number;\n};\n\nexport interface LocationCfg {\n [key: string]: any;\n}\n\nexport interface PointLocationCfg extends LocationCfg {\n /**\n * 位置 x\n * @type {number}\n */\n x: number;\n /**\n * 位置 y\n * @type {number}\n */\n y: number;\n}\n\nexport interface RegionLocationCfg extends LocationCfg {\n /**\n * 起始点\n */\n start: Point;\n /**\n * 结束点\n */\n end: Point;\n}\n\nexport type State<T> = {\n [key: string]: T;\n};\n\nexport type BaseGraphicAttributes<T> = {\n /**\n * 基础样式设置\n */\n style?: T;\n /**\n * 状态样式设置\n */\n state?: State<T>;\n};\n\nexport type Padding =\n | number\n | number[]\n | {\n top?: number;\n bottom?: number;\n left?: number;\n right?: number;\n };\n\ntype CommonTextContent = {\n type?: 'text';\n
|
|
1
|
+
{"version":3,"sources":["../src/core/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type { IRichTextCharacter } from '@visactor/vrender-core';\n\nexport type Point = {\n x: number;\n y: number;\n};\n\nexport interface LocationCfg {\n [key: string]: any;\n}\n\nexport interface PointLocationCfg extends LocationCfg {\n /**\n * 位置 x\n * @type {number}\n */\n x: number;\n /**\n * 位置 y\n * @type {number}\n */\n y: number;\n}\n\nexport interface RegionLocationCfg extends LocationCfg {\n /**\n * 起始点\n */\n start: Point;\n /**\n * 结束点\n */\n end: Point;\n}\n\nexport type State<T> = {\n [key: string]: T;\n};\n\nexport type BaseGraphicAttributes<T> = {\n /**\n * 基础样式设置\n */\n style?: T;\n /**\n * 状态样式设置\n */\n state?: State<T>;\n};\n\nexport type Padding =\n | number\n | number[]\n | {\n top?: number;\n bottom?: number;\n left?: number;\n right?: number;\n };\n\ntype CommonTextContent = {\n text?:\n | string\n | string[]\n | number\n | number[]\n | {\n type?: 'text';\n text: string | string[] | number | number[];\n };\n};\n\ntype RichTextContent = {\n text?: {\n type: 'rich';\n text: IRichTextCharacter[];\n };\n};\n\nexport type TextContent = (CommonTextContent | RichTextContent) & {\n /** @deprecated */\n type?: 'text' | 'rich';\n};\n"]}
|
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,iBAAiB,CAAC;AAEzC,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,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.17.20-alpha.2\";\n\nexport * from './core/base';\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 './interface';\nexport * from './jsx';\nexport * from './checkbox';\nexport * from './util';\n"]}
|
|
@@ -2,12 +2,10 @@ import { merge, isValid, array, isValidNumber, get } from "@visactor/vutils";
|
|
|
2
2
|
|
|
3
3
|
import { AbstractComponent } from "../core/base";
|
|
4
4
|
|
|
5
|
-
import { measureTextSize } from "../util";
|
|
5
|
+
import { isRichText, measureTextSize, richTextAttributeTransform } from "../util";
|
|
6
6
|
|
|
7
7
|
import { DEFAULT_INDICATOR_THEME } from "./config";
|
|
8
8
|
|
|
9
|
-
import { DEFAULT_HTML_TEXT_SPEC } from "../constant";
|
|
10
|
-
|
|
11
9
|
import { loadIndicatorComponent } from "./register";
|
|
12
10
|
|
|
13
11
|
loadIndicatorComponent();
|
|
@@ -17,7 +15,7 @@ export class Indicator extends AbstractComponent {
|
|
|
17
15
|
super(...arguments), this.name = "indicator";
|
|
18
16
|
}
|
|
19
17
|
render() {
|
|
20
|
-
var _a
|
|
18
|
+
var _a;
|
|
21
19
|
const {visible: visible, title: title = {}, content: content, size: size, limitRatio: limitRatio = 1 / 0} = this.attribute, limit = Math.min(size.width, size.height) * limitRatio, group = this.createOrUpdateChild("indicator-container", {
|
|
22
20
|
x: 0,
|
|
23
21
|
y: 0,
|
|
@@ -26,20 +24,7 @@ export class Indicator extends AbstractComponent {
|
|
|
26
24
|
if (!0 !== visible) return void (group && group.hideAll());
|
|
27
25
|
if (isValid(title)) if (!1 !== title.visible) {
|
|
28
26
|
const titleStyle = merge({}, get(DEFAULT_INDICATOR_THEME, "title.style"), title.style);
|
|
29
|
-
|
|
30
|
-
textConfig: titleStyle.text
|
|
31
|
-
}, titleStyle), {
|
|
32
|
-
visible: title.visible,
|
|
33
|
-
x: 0,
|
|
34
|
-
y: 0,
|
|
35
|
-
width: null !== (_a = titleStyle.width) && void 0 !== _a ? _a : 0,
|
|
36
|
-
height: null !== (_b = titleStyle.height) && void 0 !== _b ? _b : 0
|
|
37
|
-
}), "richtext") : "html" === titleStyle.type ? this._title = group.createOrUpdateChild("indicator-title", Object.assign(Object.assign({
|
|
38
|
-
textConfig: [],
|
|
39
|
-
html: Object.assign(Object.assign({
|
|
40
|
-
dom: titleStyle.text
|
|
41
|
-
}, DEFAULT_HTML_TEXT_SPEC), titleStyle)
|
|
42
|
-
}, titleStyle), {
|
|
27
|
+
isRichText(titleStyle) ? this._title = group.createOrUpdateChild("indicator-title", Object.assign(Object.assign({}, richTextAttributeTransform(titleStyle)), {
|
|
43
28
|
visible: title.visible,
|
|
44
29
|
x: 0,
|
|
45
30
|
y: 0
|
|
@@ -57,24 +42,10 @@ export class Indicator extends AbstractComponent {
|
|
|
57
42
|
if (isValid(content)) {
|
|
58
43
|
const contents = array(content), contentComponents = [];
|
|
59
44
|
contents.forEach(((contentItem, i) => {
|
|
60
|
-
var _a, _b;
|
|
61
45
|
if (!1 !== contentItem.visible) {
|
|
62
46
|
const contentStyle = merge({}, get(DEFAULT_INDICATOR_THEME, "content.style"), contentItem.style);
|
|
63
47
|
let contentComponent;
|
|
64
|
-
contentComponent =
|
|
65
|
-
textConfig: contentStyle.text
|
|
66
|
-
}, contentStyle), {
|
|
67
|
-
visible: title.visible,
|
|
68
|
-
x: 0,
|
|
69
|
-
y: 0,
|
|
70
|
-
width: null !== (_a = contentStyle.width) && void 0 !== _a ? _a : 0,
|
|
71
|
-
height: null !== (_b = contentStyle.height) && void 0 !== _b ? _b : 0
|
|
72
|
-
}), "richtext") : "html" === contentStyle.type ? group.createOrUpdateChild("indicator-content-" + i, Object.assign(Object.assign({
|
|
73
|
-
textConfig: [],
|
|
74
|
-
html: Object.assign(Object.assign({
|
|
75
|
-
dom: contentStyle.text
|
|
76
|
-
}, DEFAULT_HTML_TEXT_SPEC), contentStyle)
|
|
77
|
-
}, contentStyle), {
|
|
48
|
+
contentComponent = isRichText(contentStyle) ? group.createOrUpdateChild("indicator-content-" + i, Object.assign(Object.assign({}, richTextAttributeTransform(contentStyle)), {
|
|
78
49
|
visible: title.visible,
|
|
79
50
|
x: 0,
|
|
80
51
|
y: 0
|
|
@@ -93,7 +64,7 @@ export class Indicator extends AbstractComponent {
|
|
|
93
64
|
})), this._content = contentComponents;
|
|
94
65
|
}
|
|
95
66
|
this._setGlobalAutoFit(limit), this._setYPosition();
|
|
96
|
-
const totalHeight = null !== (
|
|
67
|
+
const totalHeight = null !== (_a = null == group ? void 0 : group.AABBBounds.height()) && void 0 !== _a ? _a : 0;
|
|
97
68
|
group.setAttribute("y", size.height / 2 - totalHeight / 2), group.setAttribute("x", size.width / 2);
|
|
98
69
|
}
|
|
99
70
|
_setLocalAutoFit(limit, indicatorItem, indicatorItemSpec) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/indicator/indicator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEpD,sBAAsB,EAAE,CAAC;AACzB,MAAM,OAAO,SAAU,SAAQ,iBAAgD;IAA/E;;QACE,SAAI,GAAG,WAAW,CAAC;IAoRrB,CAAC;IA/QW,MAAM;;QACd,MAAM,EAAE,OAAO,EAAE,KAAK,GAAG,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,GAAG,QAAQ,EAAE,GAAG,IAAI,CAAC,SAAgC,CAAC;QAE5G,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,UAAU,CAAC;QAE7D,MAAM,KAAK,GAAG,IAAI,CAAC,mBAAmB,CAAC,qBAAqB,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,OAAO,CAAW,CAAC;QAG5G,IAAI,OAAO,KAAK,IAAI,EAAE;YACpB,KAAK,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;YACzB,OAAO;SACR;QAED,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE;YAClB,IAAI,KAAK,CA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W,CAAC,EAAE,CAAC,WAAW,CAAC,OAAO,KAAK,KAAK,CAAC;aACpD,OAAO,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE,EAAE;;YAC9B,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YACzC,WAAW,CAAC,YAAY,CAAC,GAAG,EAAE,WAAW,GAAG,UAAU,GAAG,iBAAiB,CAAC,CAAC;YAC5E,MAAM,YAAY,GAAG,MAAA,WAAW,CAAC,KAAK,mCAAI,CAAC,CAAC;YAC5C,iBAAiB,IAAI,WAAW,CAAC,UAAU,CAAC,MAAM,EAAE,GAAG,YAAY,CAAC;QACtE,CAAC,CAAC,CAAC;IACP,CAAC;CACF","file":"indicator.js","sourcesContent":["/**\n * @description 指标卡组件\n */\nimport type { IGroup, INode, IText, ITextGraphicAttribute } from '@visactor/vrender-core';\nimport { merge, isValid, array, isValidNumber, get } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport { measureTextSize } from '../util';\nimport type { IndicatorAttributes, IndicatorItemSpec } from './type';\nimport { DEFAULT_INDICATOR_THEME } from './config';\nimport { DEFAULT_HTML_TEXT_SPEC } from '../constant';\nimport { loadIndicatorComponent } from './register';\n\nloadIndicatorComponent();\nexport class Indicator extends AbstractComponent<Required<IndicatorAttributes>> {\n name = 'indicator';\n\n private _title?: IText;\n private _content?: IText | IText[];\n\n protected render() {\n const { visible, title = {}, content, size, limitRatio = Infinity } = this.attribute as IndicatorAttributes;\n\n const limit = Math.min(size.width, size.height) * limitRatio;\n\n const group = this.createOrUpdateChild('indicator-container', { x: 0, y: 0, zIndex: 1 }, 'group') as IGroup;\n\n // 指标卡全部隐藏\n if (visible !== true) {\n group && group.hideAll();\n return;\n }\n\n if (isValid(title)) {\n if (title.visible !== false) {\n const titleStyle = merge({}, get(DEFAULT_INDICATOR_THEME, 'title.style'), title.style);\n if (titleStyle.type === 'rich') {\n this._title = group.createOrUpdateChild(\n 'indicator-title',\n {\n textConfig: titleStyle.text,\n ...titleStyle,\n visible: title.visible,\n x: 0,\n y: 0,\n width: titleStyle.width ?? 0,\n height: titleStyle.height ?? 0\n },\n 'richtext'\n ) as IText;\n } else if (titleStyle.type === 'html') {\n this._title = group.createOrUpdateChild(\n 'indicator-title',\n {\n textConfig: [],\n html: {\n dom: titleStyle.text as string,\n ...DEFAULT_HTML_TEXT_SPEC,\n ...titleStyle\n },\n ...titleStyle,\n visible: title.visible,\n x: 0,\n y: 0\n },\n 'richtext'\n ) as IText;\n } else {\n this._title = group.createOrUpdateChild(\n 'indicator-title',\n {\n ...titleStyle,\n /**\n * 加入以下逻辑:如果没有声明lineHeight,默认 lineHeight 等于 fontSize\n * 因为如果不声明 vrender 底层会默认给文本加上 2px 的高度,会影响布局计算\n * 注意:在autoFit改变fontsize时,lineHeight也要同步修改\n */\n lineHeight: isValid(titleStyle.lineHeight) ? titleStyle.lineHeight : titleStyle.fontSize,\n visible: title.visible,\n x: 0,\n y: 0\n },\n 'text'\n ) as IText;\n }\n\n // auto-fit\n if (title.autoFit && isValidNumber(limit)) {\n this._setLocalAutoFit(limit, this._title, title);\n }\n\n //auto-limit\n if (title.autoLimit && isValidNumber(limitRatio)) {\n this._title.setAttribute('maxLineWidth', limit);\n }\n } else {\n /**\n * indicator部分隐藏\n * 例如title隐藏了,content还保留。直接设置visible:false 计算group.AABBounts是错的,影响上下居中。\n * 这里把隐藏的nodes删除后,group.AABBounts计算才正确。\n */\n const titleNode = group.find(node => node.name === 'indicator-title', false);\n titleNode && group.removeChild(titleNode as INode);\n this._title = undefined;\n }\n }\n\n if (isValid(content)) {\n const contents: IndicatorItemSpec[] = array(content);\n const contentComponents: IText[] = [];\n contents.forEach((contentItem, i) => {\n if (contentItem.visible !== false) {\n const contentStyle = merge({}, get(DEFAULT_INDICATOR_THEME, 'content.style'), contentItem.style);\n let contentComponent;\n if (contentStyle.type === 'rich') {\n contentComponent = group.createOrUpdateChild(\n 'indicator-content-' + i,\n {\n textConfig: contentStyle.text,\n ...contentStyle,\n visible: title.visible,\n x: 0,\n y: 0,\n width: contentStyle.width ?? 0,\n height: contentStyle.height ?? 0\n },\n 'richtext'\n ) as IText;\n } else if (contentStyle.type === 'html') {\n contentComponent = group.createOrUpdateChild(\n 'indicator-content-' + i,\n {\n textConfig: [],\n html: {\n dom: contentStyle.text as string,\n ...DEFAULT_HTML_TEXT_SPEC,\n ...contentStyle\n },\n ...contentStyle,\n visible: title.visible,\n x: 0,\n y: 0\n },\n 'richtext'\n ) as IText;\n } else {\n contentComponent = group.createOrUpdateChild(\n 'indicator-content-' + i,\n {\n ...contentStyle,\n lineHeight: isValid(contentStyle.lineHeight) ? contentStyle.lineHeight : contentStyle.fontSize,\n visible: contentItem.visible,\n x: 0,\n y: 0\n },\n 'text'\n ) as IText;\n }\n\n // auto-fit\n if (contentItem.autoFit && isValidNumber(limit)) {\n this._setLocalAutoFit(limit, contentComponent, contentItem);\n }\n\n //auto-limit\n if (contentItem.autoLimit && isValidNumber(limitRatio)) {\n contentComponent.setAttribute('maxLineWidth', limit);\n }\n\n contentComponents.push(contentComponent);\n } else {\n /**\n * indicator部分隐藏\n */\n const contentItemNode = group.find(node => node.name === 'indicator-content-' + i, false);\n contentItemNode && group.removeChild(contentItemNode as INode);\n }\n });\n this._content = contentComponents;\n }\n\n this._setGlobalAutoFit(limit);\n this._setYPosition();\n\n const totalHeight = group?.AABBBounds.height() ?? 0;\n group.setAttribute('y', size.height / 2 - totalHeight / 2);\n group.setAttribute('x', size.width / 2);\n }\n\n private _setLocalAutoFit(limit: number, indicatorItem: IText, indicatorItemSpec: IndicatorItemSpec) {\n // only apply local auto fit for default auto fit text\n if ((indicatorItemSpec.fitStrategy ?? 'default') !== 'default') {\n return;\n }\n const originWidth = measureTextSize(\n (indicatorItemSpec.style?.text ?? '') as string | number | number[] | string[],\n (indicatorItemSpec.style ?? {}) as Partial<ITextGraphicAttribute>,\n this.stage?.getTheme().text.fontFamily\n ).width;\n if (originWidth > 0) {\n const ratio = (limit * (indicatorItemSpec.fitPercent ?? 0.5)) / originWidth;\n const fontSize = Math.floor((indicatorItemSpec.style?.fontSize ?? 20) * ratio);\n indicatorItem.setAttribute('fontSize', fontSize);\n indicatorItem.setAttribute(\n 'lineHeight',\n isValid(indicatorItemSpec.style.lineHeight) ? indicatorItemSpec.style.lineHeight : fontSize\n );\n }\n }\n\n private _setGlobalAutoFit(limit: number) {\n // compute the inscribed rect width & height for all texts\n // the font size will be determined by the longest text\n // 1. hx^2 + hy^2 = r^2\n // 2. hy = ra * hx + h\n // -> (ra^2 + 1) * x^2 + (2 * h * ra) * x + (h^2 - r^2) = 0\n\n const r = limit / 2;\n\n // unify the initial font size for auto fit texts\n const singleHeight = 12;\n const autoFitTexts: { text: IText; spec: IndicatorItemSpec }[] = [];\n // other text height\n let otherHeight = 0;\n // non auto fit title height\n const titleSpec = this.attribute.title ?? {};\n if (titleSpec.autoFit && titleSpec.fitStrategy === 'inscribed') {\n this._title.setAttribute('fontSize', singleHeight);\n autoFitTexts.push({ text: this._title, spec: this.attribute.title ?? {} });\n } else {\n otherHeight += this._title?.AABBBounds?.height?.() ?? 0;\n }\n const titleSpace = titleSpec.space ?? 0;\n otherHeight += titleSpace;\n // non auto fit content height\n array(this.attribute.content)\n .filter(contentSpec => contentSpec.visible !== false)\n .forEach((contentSpec, index) => {\n const contentText = this._content[index];\n if (contentSpec.autoFit && contentSpec.fitStrategy === 'inscribed') {\n contentText.setAttribute('fontSize', singleHeight);\n autoFitTexts.push({ text: contentText, spec: contentSpec });\n } else {\n otherHeight += contentText?.AABBBounds?.height?.() ?? 0;\n }\n const contentSpace = contentSpec.space ?? 0;\n otherHeight += contentSpace;\n });\n if (autoFitTexts.length <= 0) {\n return;\n }\n\n // max width for all auto fit texts\n const maxWidth = autoFitTexts.reduce((width, textItem) => {\n return Math.max(width, textItem.text.AABBBounds.width());\n }, 0);\n\n // y = x * (singleHeight / maxWidth * textCount) + otherHeight\n // hy = hx * (singleHeight / maxWidth * textCount) + otherHeight / 2\n const ra = (singleHeight / maxWidth) * autoFitTexts.length;\n const h = otherHeight / 2;\n const a = ra ** 2 + 1;\n const b = 2 * h * ra;\n const c = h ** 2 - r ** 2;\n const hx = (-b + Math.sqrt(b ** 2 - 4 * a * c)) / (2 * a);\n const hy = ra * hx + h;\n const y = 2 * hy;\n const lineHeight = (y - otherHeight) / autoFitTexts.length;\n if (isValidNumber(y)) {\n autoFitTexts.forEach(textItem => {\n const specLineHeight = textItem.spec.style?.lineHeight;\n textItem.text.setAttribute('fontSize', lineHeight);\n textItem.text.setAttribute('lineHeight', isValid(specLineHeight) ? specLineHeight : lineHeight);\n });\n }\n }\n\n private _setYPosition() {\n let lastContentHeight = 0;\n\n const titleHeight = this._title?.AABBBounds?.height?.() ?? 0;\n const titleSpace = this.attribute.title?.space ?? 0;\n array(this.attribute.content)\n .filter(contentSpec => contentSpec.visible !== false)\n .forEach((contentSpec, index) => {\n const contentText = this._content[index];\n contentText.setAttribute('y', titleHeight + titleSpace + lastContentHeight);\n const contentSpace = contentSpec.space ?? 0;\n lastContentHeight += contentText.AABBBounds.height() + contentSpace;\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/indicator/indicator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAElF,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEpD,sBAAsB,EAAE,CAAC;AACzB,MAAM,OAAO,SAAU,SAAQ,iBAAgD;IAA/E;;QACE,SAAI,GAAG,WAAW,CAAC;IA4OrB,CAAC;IAvOW,MAAM;;QACd,M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AAC,MAAM,EAAE,GAAG,YAAY,CAAC;QACtE,CAAC,CAAC,CAAC;IACP,CAAC;CACF","file":"indicator.js","sourcesContent":["/**\n * @description 指标卡组件\n */\nimport type { IGroup, INode, IText, ITextGraphicAttribute } from '@visactor/vrender-core';\nimport { merge, isValid, array, isValidNumber, get } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport { isRichText, measureTextSize, richTextAttributeTransform } from '../util';\nimport type { IndicatorAttributes, IndicatorItemSpec } from './type';\nimport { DEFAULT_INDICATOR_THEME } from './config';\nimport { loadIndicatorComponent } from './register';\n\nloadIndicatorComponent();\nexport class Indicator extends AbstractComponent<Required<IndicatorAttributes>> {\n name = 'indicator';\n\n private _title?: IText;\n private _content?: IText | IText[];\n\n protected render() {\n const { visible, title = {}, content, size, limitRatio = Infinity } = this.attribute as IndicatorAttributes;\n\n const limit = Math.min(size.width, size.height) * limitRatio;\n\n const group = this.createOrUpdateChild('indicator-container', { x: 0, y: 0, zIndex: 1 }, 'group') as IGroup;\n\n // 指标卡全部隐藏\n if (visible !== true) {\n group && group.hideAll();\n return;\n }\n\n if (isValid(title)) {\n if (title.visible !== false) {\n const titleStyle = merge({}, get(DEFAULT_INDICATOR_THEME, 'title.style'), title.style);\n if (isRichText(titleStyle)) {\n this._title = group.createOrUpdateChild(\n 'indicator-title',\n {\n ...richTextAttributeTransform(titleStyle),\n visible: title.visible,\n x: 0,\n y: 0\n },\n 'richtext'\n ) as IText;\n } else {\n this._title = group.createOrUpdateChild(\n 'indicator-title',\n {\n ...titleStyle,\n /**\n * 加入以下逻辑:如果没有声明lineHeight,默认 lineHeight 等于 fontSize\n * 因为如果不声明 vrender 底层会默认给文本加上 2px 的高度,会影响布局计算\n * 注意:在autoFit改变fontsize时,lineHeight也要同步修改\n */\n lineHeight: isValid(titleStyle.lineHeight) ? titleStyle.lineHeight : titleStyle.fontSize,\n visible: title.visible,\n x: 0,\n y: 0\n },\n 'text'\n ) as IText;\n }\n\n // auto-fit\n if (title.autoFit && isValidNumber(limit)) {\n this._setLocalAutoFit(limit, this._title, title);\n }\n\n //auto-limit\n if (title.autoLimit && isValidNumber(limitRatio)) {\n this._title.setAttribute('maxLineWidth', limit);\n }\n } else {\n /**\n * indicator部分隐藏\n * 例如title隐藏了,content还保留。直接设置visible:false 计算group.AABBounts是错的,影响上下居中。\n * 这里把隐藏的nodes删除后,group.AABBounts计算才正确。\n */\n const titleNode = group.find(node => node.name === 'indicator-title', false);\n titleNode && group.removeChild(titleNode as INode);\n this._title = undefined;\n }\n }\n\n if (isValid(content)) {\n const contents: IndicatorItemSpec[] = array(content);\n const contentComponents: IText[] = [];\n contents.forEach((contentItem, i) => {\n if (contentItem.visible !== false) {\n const contentStyle = merge({}, get(DEFAULT_INDICATOR_THEME, 'content.style'), contentItem.style);\n let contentComponent;\n if (isRichText(contentStyle)) {\n contentComponent = group.createOrUpdateChild(\n 'indicator-content-' + i,\n {\n ...richTextAttributeTransform(contentStyle),\n visible: title.visible,\n x: 0,\n y: 0\n },\n 'richtext'\n ) as IText;\n } else {\n contentComponent = group.createOrUpdateChild(\n 'indicator-content-' + i,\n {\n ...contentStyle,\n lineHeight: isValid(contentStyle.lineHeight) ? contentStyle.lineHeight : contentStyle.fontSize,\n visible: contentItem.visible,\n x: 0,\n y: 0\n },\n 'text'\n ) as IText;\n }\n\n // auto-fit\n if (contentItem.autoFit && isValidNumber(limit)) {\n this._setLocalAutoFit(limit, contentComponent, contentItem);\n }\n\n //auto-limit\n if (contentItem.autoLimit && isValidNumber(limitRatio)) {\n contentComponent.setAttribute('maxLineWidth', limit);\n }\n\n contentComponents.push(contentComponent);\n } else {\n /**\n * indicator部分隐藏\n */\n const contentItemNode = group.find(node => node.name === 'indicator-content-' + i, false);\n contentItemNode && group.removeChild(contentItemNode as INode);\n }\n });\n this._content = contentComponents;\n }\n\n this._setGlobalAutoFit(limit);\n this._setYPosition();\n\n const totalHeight = group?.AABBBounds.height() ?? 0;\n group.setAttribute('y', size.height / 2 - totalHeight / 2);\n group.setAttribute('x', size.width / 2);\n }\n\n private _setLocalAutoFit(limit: number, indicatorItem: IText, indicatorItemSpec: IndicatorItemSpec) {\n // only apply local auto fit for default auto fit text\n if ((indicatorItemSpec.fitStrategy ?? 'default') !== 'default') {\n return;\n }\n const originWidth = measureTextSize(\n (indicatorItemSpec.style?.text ?? '') as string | number | number[] | string[],\n (indicatorItemSpec.style ?? {}) as Partial<ITextGraphicAttribute>,\n this.stage?.getTheme().text.fontFamily\n ).width;\n if (originWidth > 0) {\n const ratio = (limit * (indicatorItemSpec.fitPercent ?? 0.5)) / originWidth;\n const fontSize = Math.floor((indicatorItemSpec.style?.fontSize ?? 20) * ratio);\n indicatorItem.setAttribute('fontSize', fontSize);\n indicatorItem.setAttribute(\n 'lineHeight',\n isValid(indicatorItemSpec.style.lineHeight) ? indicatorItemSpec.style.lineHeight : fontSize\n );\n }\n }\n\n private _setGlobalAutoFit(limit: number) {\n // compute the inscribed rect width & height for all texts\n // the font size will be determined by the longest text\n // 1. hx^2 + hy^2 = r^2\n // 2. hy = ra * hx + h\n // -> (ra^2 + 1) * x^2 + (2 * h * ra) * x + (h^2 - r^2) = 0\n\n const r = limit / 2;\n\n // unify the initial font size for auto fit texts\n const singleHeight = 12;\n const autoFitTexts: { text: IText; spec: IndicatorItemSpec }[] = [];\n // other text height\n let otherHeight = 0;\n // non auto fit title height\n const titleSpec = this.attribute.title ?? {};\n if (titleSpec.autoFit && titleSpec.fitStrategy === 'inscribed') {\n this._title.setAttribute('fontSize', singleHeight);\n autoFitTexts.push({ text: this._title, spec: this.attribute.title ?? {} });\n } else {\n otherHeight += this._title?.AABBBounds?.height?.() ?? 0;\n }\n const titleSpace = titleSpec.space ?? 0;\n otherHeight += titleSpace;\n // non auto fit content height\n array(this.attribute.content)\n .filter(contentSpec => contentSpec.visible !== false)\n .forEach((contentSpec, index) => {\n const contentText = this._content[index];\n if (contentSpec.autoFit && contentSpec.fitStrategy === 'inscribed') {\n contentText.setAttribute('fontSize', singleHeight);\n autoFitTexts.push({ text: contentText, spec: contentSpec });\n } else {\n otherHeight += contentText?.AABBBounds?.height?.() ?? 0;\n }\n const contentSpace = contentSpec.space ?? 0;\n otherHeight += contentSpace;\n });\n if (autoFitTexts.length <= 0) {\n return;\n }\n\n // max width for all auto fit texts\n const maxWidth = autoFitTexts.reduce((width, textItem) => {\n return Math.max(width, textItem.text.AABBBounds.width());\n }, 0);\n\n // y = x * (singleHeight / maxWidth * textCount) + otherHeight\n // hy = hx * (singleHeight / maxWidth * textCount) + otherHeight / 2\n const ra = (singleHeight / maxWidth) * autoFitTexts.length;\n const h = otherHeight / 2;\n const a = ra ** 2 + 1;\n const b = 2 * h * ra;\n const c = h ** 2 - r ** 2;\n const hx = (-b + Math.sqrt(b ** 2 - 4 * a * c)) / (2 * a);\n const hy = ra * hx + h;\n const y = 2 * hy;\n const lineHeight = (y - otherHeight) / autoFitTexts.length;\n if (isValidNumber(y)) {\n autoFitTexts.forEach(textItem => {\n const specLineHeight = textItem.spec.style?.lineHeight;\n textItem.text.setAttribute('fontSize', lineHeight);\n textItem.text.setAttribute('lineHeight', isValid(specLineHeight) ? specLineHeight : lineHeight);\n });\n }\n }\n\n private _setYPosition() {\n let lastContentHeight = 0;\n\n const titleHeight = this._title?.AABBBounds?.height?.() ?? 0;\n const titleSpace = this.attribute.title?.space ?? 0;\n array(this.attribute.content)\n .filter(contentSpec => contentSpec.visible !== false)\n .forEach((contentSpec, index) => {\n const contentText = this._content[index];\n contentText.setAttribute('y', titleHeight + titleSpace + lastContentHeight);\n const contentSpace = contentSpec.space ?? 0;\n lastContentHeight += contentText.AABBBounds.height() + contentSpace;\n });\n }\n}\n"]}
|
package/es/label/base.js
CHANGED
|
@@ -6,7 +6,7 @@ import { AbstractComponent } from "../core/base";
|
|
|
6
6
|
|
|
7
7
|
import { labelSmartInvert, contrastAccessibilityChecker, smartInvertStrategy } from "../util/label-smartInvert";
|
|
8
8
|
|
|
9
|
-
import { getMarksByName, getNoneGroupMarksByName, traverseGroup } from "../util";
|
|
9
|
+
import { getMarksByName, getNoneGroupMarksByName, isRichText, richTextAttributeTransform, traverseGroup } from "../util";
|
|
10
10
|
|
|
11
11
|
import { StateValue } from "../constant";
|
|
12
12
|
|
|
@@ -16,8 +16,6 @@ import { DefaultLabelAnimation, getAnimationAttributes, updateAnimation } from "
|
|
|
16
16
|
|
|
17
17
|
import { connectLineBetweenBounds, getPointsOfLineArea } from "./util";
|
|
18
18
|
|
|
19
|
-
import { DEFAULT_HTML_TEXT_SPEC } from "../constant";
|
|
20
|
-
|
|
21
19
|
import { loadLabelComponent } from "./register";
|
|
22
20
|
|
|
23
21
|
loadLabelComponent();
|
|
@@ -102,20 +100,7 @@ export class LabelBase extends AbstractComponent {
|
|
|
102
100
|
state && !isEmpty(state) && (target.states = state);
|
|
103
101
|
}
|
|
104
102
|
_createLabelText(attributes) {
|
|
105
|
-
|
|
106
|
-
if ("rich" === attributes.textType) {
|
|
107
|
-
attributes.textConfig = attributes.text, attributes.width = null !== (_a = attributes.width) && void 0 !== _a ? _a : 0,
|
|
108
|
-
attributes.height = null !== (_b = attributes.height) && void 0 !== _b ? _b : 0,
|
|
109
|
-
attributes.maxWidth = attributes.maxLineWidth;
|
|
110
|
-
return graphicCreator.richtext(attributes);
|
|
111
|
-
}
|
|
112
|
-
if ("html" === attributes.textType) {
|
|
113
|
-
attributes.textConfig = [], attributes.html = Object.assign(Object.assign({
|
|
114
|
-
dom: attributes.text
|
|
115
|
-
}, DEFAULT_HTML_TEXT_SPEC), attributes);
|
|
116
|
-
return graphicCreator.richtext(attributes);
|
|
117
|
-
}
|
|
118
|
-
return graphicCreator.text(attributes);
|
|
103
|
+
return isRichText(attributes, "textType") ? graphicCreator.richtext(richTextAttributeTransform(attributes)) : graphicCreator.text(attributes);
|
|
119
104
|
}
|
|
120
105
|
_prepare() {
|
|
121
106
|
var _a, _b, _c, _d, _e;
|