@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/es/util/text.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getTextBounds } from "@visactor/vrender-core";
|
|
2
2
|
|
|
3
|
-
import { TextMeasure } from "@visactor/vutils";
|
|
3
|
+
import { TextMeasure, isObject } from "@visactor/vutils";
|
|
4
4
|
|
|
5
5
|
import { DEFAULT_TEXT_FONT_FAMILY, DEFAULT_TEXT_FONT_SIZE } from "../constant";
|
|
6
6
|
|
|
@@ -35,4 +35,16 @@ export function measureTextSize(text, textSpec, fontFamily = DEFAULT_TEXT_FONT_F
|
|
|
35
35
|
height: bounds.height()
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
+
|
|
39
|
+
export function isRichText(attributes, typeKey = "type") {
|
|
40
|
+
return typeKey in attributes && "rich" === attributes[typeKey] || isObject(attributes.text) && "rich" === attributes.text.type;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export 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
|
+
}
|
|
38
50
|
//# sourceMappingURL=text.js.map
|
package/es/util/text.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/util/text.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGvD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
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AE,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;AAED,MAAM,UAAU,UAAU,CAAC,UAAuB,EAAE,OAAO,GAAG,MAAM;IAClE,OAAO,CACL,CAAC,OAAO,IAAI,UAAU,IAAI,UAAU,CAAC,OAAO,CAAC,KAAK,MAAM,CAAC;QACzD,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,IAAK,UAAU,CAAC,IAAoB,CAAC,IAAI,KAAK,MAAM,CAAC,CAChF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,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","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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visactor/vrender-components",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.20-alpha.2",
|
|
4
4
|
"description": "components library for dp visualization",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "cjs/index.js",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"dist"
|
|
13
13
|
],
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@visactor/vrender-core": "0.17.
|
|
16
|
-
"@visactor/vrender-kits": "0.17.
|
|
15
|
+
"@visactor/vrender-core": "0.17.20-alpha.2",
|
|
16
|
+
"@visactor/vrender-kits": "0.17.20-alpha.2",
|
|
17
17
|
"@visactor/vutils": "~0.17.3",
|
|
18
18
|
"@visactor/vscale": "~0.17.3"
|
|
19
19
|
},
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"vite": "3.2.6",
|
|
30
30
|
"typescript": "4.9.5",
|
|
31
31
|
"@internal/bundler": "0.0.1",
|
|
32
|
-
"@internal/
|
|
33
|
-
"@internal/
|
|
32
|
+
"@internal/eslint-config": "0.0.1",
|
|
33
|
+
"@internal/ts-config": "0.0.1"
|
|
34
34
|
},
|
|
35
35
|
"keywords": [
|
|
36
36
|
"VisActor",
|