@visactor/vtable 0.25.2 → 0.25.3-alpha.0
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/ListTable.js +5 -5
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotChart.js +3 -3
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/PivotTable.js +3 -3
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/components/axis/axis.js +2 -2
- package/cjs/components/axis/axis.js.map +1 -1
- package/cjs/core/BaseTable.js +4 -3
- package/cjs/core/BaseTable.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/layout/chart-helper/get-chart-spec.js +2 -2
- package/cjs/layout/chart-helper/get-chart-spec.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +1 -0
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/cjs/vutil-extension-temp/algorithm/binary-search.d.ts +2 -0
- package/cjs/vutil-extension-temp/algorithm/binary-search.js +21 -0
- package/cjs/vutil-extension-temp/algorithm/binary-search.js.map +1 -0
- package/cjs/vutil-extension-temp/algorithm/index.d.ts +1 -0
- package/cjs/vutil-extension-temp/algorithm/index.js +21 -0
- package/cjs/vutil-extension-temp/algorithm/index.js.map +1 -0
- package/cjs/vutil-extension-temp/index.d.ts +4 -0
- package/cjs/vutil-extension-temp/index.js +22 -0
- package/cjs/vutil-extension-temp/index.js.map +1 -0
- package/cjs/vutil-extension-temp/spec/clone-deep.d.ts +1 -0
- package/cjs/vutil-extension-temp/spec/clone-deep.js +27 -0
- package/cjs/vutil-extension-temp/spec/clone-deep.js.map +1 -0
- package/cjs/vutil-extension-temp/spec/common.d.ts +3 -0
- package/cjs/vutil-extension-temp/spec/common.js +23 -0
- package/cjs/vutil-extension-temp/spec/common.js.map +1 -0
- package/cjs/vutil-extension-temp/spec/index.d.ts +3 -0
- package/cjs/vutil-extension-temp/spec/index.js +22 -0
- package/cjs/vutil-extension-temp/spec/index.js.map +1 -0
- package/cjs/vutil-extension-temp/spec/merge-spec.d.ts +5 -0
- package/cjs/vutil-extension-temp/spec/merge-spec.js +69 -0
- package/cjs/vutil-extension-temp/spec/merge-spec.js.map +1 -0
- package/cjs/vutil-extension-temp/transform/tick-data/config.d.ts +1 -0
- package/cjs/vutil-extension-temp/transform/tick-data/config.js +6 -0
- package/cjs/vutil-extension-temp/transform/tick-data/config.js.map +1 -0
- package/cjs/vutil-extension-temp/transform/tick-data/continuous.d.ts +3 -0
- package/cjs/vutil-extension-temp/transform/tick-data/continuous.js +57 -0
- package/cjs/vutil-extension-temp/transform/tick-data/continuous.js.map +1 -0
- package/cjs/vutil-extension-temp/transform/tick-data/discrete/linear.d.ts +6 -0
- package/cjs/vutil-extension-temp/transform/tick-data/discrete/linear.js +101 -0
- package/cjs/vutil-extension-temp/transform/tick-data/discrete/linear.js.map +1 -0
- package/cjs/vutil-extension-temp/transform/tick-data/discrete/polar-angle.d.ts +3 -0
- package/cjs/vutil-extension-temp/transform/tick-data/discrete/polar-angle.js +53 -0
- package/cjs/vutil-extension-temp/transform/tick-data/discrete/polar-angle.js.map +1 -0
- package/cjs/vutil-extension-temp/transform/tick-data/index.d.ts +6 -0
- package/cjs/vutil-extension-temp/transform/tick-data/index.js +41 -0
- package/cjs/vutil-extension-temp/transform/tick-data/index.js.map +1 -0
- package/cjs/vutil-extension-temp/transform/tick-data/interface.d.ts +38 -0
- package/cjs/vutil-extension-temp/transform/tick-data/interface.js +6 -0
- package/cjs/vutil-extension-temp/transform/tick-data/interface.js.map +1 -0
- package/cjs/vutil-extension-temp/transform/tick-data/util.d.ts +17 -0
- package/cjs/vutil-extension-temp/transform/tick-data/util.js +91 -0
- package/cjs/vutil-extension-temp/transform/tick-data/util.js.map +1 -0
- package/cjs/vutil-extension-temp/transform/tick-data/utils/polar-label-position.d.ts +8 -0
- package/cjs/vutil-extension-temp/transform/tick-data/utils/polar-label-position.js +20 -0
- package/cjs/vutil-extension-temp/transform/tick-data/utils/polar-label-position.js.map +1 -0
- package/cjs/vutil-extension-temp/utils/index.d.ts +3 -0
- package/cjs/vutil-extension-temp/utils/index.js +22 -0
- package/cjs/vutil-extension-temp/utils/index.js.map +1 -0
- package/cjs/vutil-extension-temp/utils/object.d.ts +3 -0
- package/cjs/vutil-extension-temp/utils/object.js +30 -0
- package/cjs/vutil-extension-temp/utils/object.js.map +1 -0
- package/cjs/vutil-extension-temp/utils/polar.d.ts +5 -0
- package/cjs/vutil-extension-temp/utils/polar.js +23 -0
- package/cjs/vutil-extension-temp/utils/polar.js.map +1 -0
- package/cjs/vutil-extension-temp/utils/text.d.ts +4 -0
- package/cjs/vutil-extension-temp/utils/text.js +17 -0
- package/cjs/vutil-extension-temp/utils/text.js.map +1 -0
- package/dist/vtable.js +515 -342
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.js +1 -1
- package/es/ListTable.js.map +1 -1
- package/es/PivotChart.js +1 -1
- package/es/PivotChart.js.map +1 -1
- package/es/PivotTable.js +1 -1
- package/es/PivotTable.js.map +1 -1
- package/es/components/axis/axis.js +1 -1
- package/es/components/axis/axis.js.map +1 -1
- package/es/core/BaseTable.js +4 -3
- package/es/core/BaseTable.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/layout/chart-helper/get-chart-spec.js +1 -1
- package/es/layout/chart-helper/get-chart-spec.js.map +1 -1
- package/es/ts-types/base-table.d.ts +1 -0
- package/es/ts-types/base-table.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/es/vutil-extension-temp/algorithm/binary-search.d.ts +2 -0
- package/es/vutil-extension-temp/algorithm/binary-search.js +11 -0
- package/es/vutil-extension-temp/algorithm/binary-search.js.map +1 -0
- package/es/vutil-extension-temp/algorithm/index.d.ts +1 -0
- package/es/vutil-extension-temp/algorithm/index.js +2 -0
- package/es/vutil-extension-temp/algorithm/index.js.map +1 -0
- package/es/vutil-extension-temp/index.d.ts +4 -0
- package/es/vutil-extension-temp/index.js +8 -0
- package/es/vutil-extension-temp/index.js.map +1 -0
- package/es/vutil-extension-temp/spec/clone-deep.d.ts +1 -0
- package/es/vutil-extension-temp/spec/clone-deep.js +20 -0
- package/es/vutil-extension-temp/spec/clone-deep.js.map +1 -0
- package/es/vutil-extension-temp/spec/common.d.ts +3 -0
- package/es/vutil-extension-temp/spec/common.js +15 -0
- package/es/vutil-extension-temp/spec/common.js.map +1 -0
- package/es/vutil-extension-temp/spec/index.d.ts +3 -0
- package/es/vutil-extension-temp/spec/index.js +6 -0
- package/es/vutil-extension-temp/spec/index.js.map +1 -0
- package/es/vutil-extension-temp/spec/merge-spec.d.ts +5 -0
- package/es/vutil-extension-temp/spec/merge-spec.js +57 -0
- package/es/vutil-extension-temp/spec/merge-spec.js.map +1 -0
- package/es/vutil-extension-temp/transform/tick-data/config.d.ts +1 -0
- package/es/vutil-extension-temp/transform/tick-data/config.js +2 -0
- package/es/vutil-extension-temp/transform/tick-data/config.js.map +1 -0
- package/es/vutil-extension-temp/transform/tick-data/continuous.d.ts +3 -0
- package/es/vutil-extension-temp/transform/tick-data/continuous.js +56 -0
- package/es/vutil-extension-temp/transform/tick-data/continuous.js.map +1 -0
- package/es/vutil-extension-temp/transform/tick-data/discrete/linear.d.ts +6 -0
- package/es/vutil-extension-temp/transform/tick-data/discrete/linear.js +92 -0
- package/es/vutil-extension-temp/transform/tick-data/discrete/linear.js.map +1 -0
- package/es/vutil-extension-temp/transform/tick-data/discrete/polar-angle.d.ts +3 -0
- package/es/vutil-extension-temp/transform/tick-data/discrete/polar-angle.js +45 -0
- package/es/vutil-extension-temp/transform/tick-data/discrete/polar-angle.js.map +1 -0
- package/es/vutil-extension-temp/transform/tick-data/index.d.ts +6 -0
- package/es/vutil-extension-temp/transform/tick-data/index.js +23 -0
- package/es/vutil-extension-temp/transform/tick-data/index.js.map +1 -0
- package/es/vutil-extension-temp/transform/tick-data/interface.d.ts +38 -0
- package/es/vutil-extension-temp/transform/tick-data/interface.js +2 -0
- package/es/vutil-extension-temp/transform/tick-data/interface.js.map +1 -0
- package/es/vutil-extension-temp/transform/tick-data/util.d.ts +17 -0
- package/es/vutil-extension-temp/transform/tick-data/util.js +78 -0
- package/es/vutil-extension-temp/transform/tick-data/util.js.map +1 -0
- package/es/vutil-extension-temp/transform/tick-data/utils/polar-label-position.d.ts +8 -0
- package/es/vutil-extension-temp/transform/tick-data/utils/polar-label-position.js +12 -0
- package/es/vutil-extension-temp/transform/tick-data/utils/polar-label-position.js.map +1 -0
- package/es/vutil-extension-temp/utils/index.d.ts +3 -0
- package/es/vutil-extension-temp/utils/index.js +6 -0
- package/es/vutil-extension-temp/utils/index.js.map +1 -0
- package/es/vutil-extension-temp/utils/object.d.ts +3 -0
- package/es/vutil-extension-temp/utils/object.js +15 -0
- package/es/vutil-extension-temp/utils/object.js.map +1 -0
- package/es/vutil-extension-temp/utils/polar.d.ts +5 -0
- package/es/vutil-extension-temp/utils/polar.js +16 -0
- package/es/vutil-extension-temp/utils/polar.js.map +1 -0
- package/es/vutil-extension-temp/utils/text.d.ts +4 -0
- package/es/vutil-extension-temp/utils/text.js +13 -0
- package/es/vutil-extension-temp/utils/text.js.map +1 -0
- package/package.json +3 -4
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { getCircleLabelPosition, getCircleVerticalVector, getVerticalCoord } from "@visactor/vrender-components";
|
|
2
|
+
|
|
3
|
+
import { polarToCartesian } from "@visactor/vutils";
|
|
4
|
+
|
|
5
|
+
export function getLabelPosition(angle, center, radius, labelOffset, inside, text, style) {
|
|
6
|
+
const point = polarToCartesian({
|
|
7
|
+
x: 0,
|
|
8
|
+
y: 0
|
|
9
|
+
}, radius, angle), labelPoint = getVerticalCoord(point, getCircleVerticalVector(labelOffset, point, center, inside)), vector = getCircleVerticalVector(labelOffset || 1, labelPoint, center, inside);
|
|
10
|
+
return getCircleLabelPosition(labelPoint, vector, text, style);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=polar-label-position.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/vutil-extension-temp/transform/tick-data/utils/polar-label-position.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACjH,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,UAAU,gBAAgB,CAC9B,KAAa,EACb,MAAgC,EAChC,MAAc,EACd,WAAmB,EACnB,MAAe,EACf,IAAqB,EACrB,KAAqC;IAErC,MAAM,KAAK,GAAG,gBAAgB,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IAC9D,MAAM,UAAU,GAAG,gBAAgB,CAAC,KAAK,EAAE,uBAAuB,CAAC,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACxG,MAAM,MAAM,GAAG,uBAAuB,CAAC,WAAW,IAAI,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACrF,OAAO,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;AACjE,CAAC","file":"polar-label-position.js","sourcesContent":["import type { ITextGraphicAttribute } from '@visactor/vrender-core';\nimport { getCircleLabelPosition, getCircleVerticalVector, getVerticalCoord } from '@visactor/vrender-components';\nimport { polarToCartesian } from '@visactor/vutils';\n\nexport function getLabelPosition(\n angle: number,\n center: { x: number; y: number },\n radius: number,\n labelOffset: number,\n inside: boolean,\n text: string | number,\n style: Partial<ITextGraphicAttribute>\n) {\n const point = polarToCartesian({ x: 0, y: 0 }, radius, angle);\n const labelPoint = getVerticalCoord(point, getCircleVerticalVector(labelOffset, point, center, inside));\n const vector = getCircleVerticalVector(labelOffset || 1, labelPoint, center, inside);\n return getCircleLabelPosition(labelPoint, vector, text, style);\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/vutil-extension-temp/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC","file":"index.js","sourcesContent":["export * from './object';\nexport * from './polar';\nexport * from './text';\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const includeSpec: <T = any>(spec: Partial<T>, searchSpec: Partial<T>) => boolean;
|
|
2
|
+
export declare const setProperty: <T>(target: T, path: Array<string | number>, value: any) => T;
|
|
3
|
+
export declare const getProperty: <T>(target: any, path: Array<string | number>, defaultValue?: T) => T;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { get, isArray, isFunction, isNil, isObject } from "@visactor/vutils";
|
|
2
|
+
|
|
3
|
+
export const includeSpec = (spec, searchSpec) => spec === searchSpec || !isFunction(spec) && !isFunction(searchSpec) && (isArray(spec) && isArray(searchSpec) ? searchSpec.every((searchItem => spec.some((item => includeSpec(item, searchItem))))) : !(!isObject(spec) || !isObject(searchSpec)) && Object.keys(searchSpec).every((key => includeSpec(spec[key], searchSpec[key]))));
|
|
4
|
+
|
|
5
|
+
export const setProperty = (target, path, value) => {
|
|
6
|
+
if (isNil(path)) return target;
|
|
7
|
+
const key = path[0];
|
|
8
|
+
return isNil(key) ? target : 1 === path.length ? (target[key] = value, target) : (isNil(target[key]) && ("number" == typeof path[1] ? target[key] = [] : target[key] = {}),
|
|
9
|
+
setProperty(target[key], path.slice(1), value));
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const getProperty = (target, path, defaultValue) => {
|
|
13
|
+
if (!isNil(path)) return get(target, path, defaultValue);
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=object.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/vutil-extension-temp/utils/object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAO7E,MAAM,CAAC,MAAM,WAAW,GAAG,CAAU,IAAgB,EAAE,UAAsB,EAAW,EAAE;IACxF,IAAI,IAAI,KAAK,UAAU,EAAE;QACvB,OAAO,IAAI,CAAC;KACb;IACD,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,UAAU,CAAC,EAAE;QAC9C,OAAO,KAAK,CAAC;KACd;IACD,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,UAAU,CAAC,EAAE;QACxC,OAAO,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;KACzF;IACD,IAAI,QAAQ,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,UAAU,CAAC,EAAE;QAC1C,OAAO,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;KACtF;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAI,MAAS,EAAE,IAA4B,EAAE,KAAU,EAAK,EAAE;IACvF,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE;QACf,OAAO,MAAM,CAAC;KACf;IACD,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,IAAI,KAAK,CAAC,GAAG,CAAC,EAAE;QACd,OAAO,MAAM,CAAC;KACf;IACD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;QACrB,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACpB,OAAO,MAAM,CAAC;KACf;IACD,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE;QACtB,IAAI,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE;YAC/B,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;SAClB;aAAM;YACL,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;SAClB;KACF;IACD,OAAO,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;AACxD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAI,MAAW,EAAE,IAA4B,EAAE,YAAgB,EAAK,EAAE;IAC/F,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE;QACf,OAAO,SAAS,CAAC;KAClB;IACD,OAAO,GAAG,CAAC,MAAM,EAAE,IAAgB,EAAE,YAAY,CAAM,CAAC;AAC1D,CAAC,CAAC","file":"object.js","sourcesContent":["import { get, isArray, isFunction, isNil, isObject } from '@visactor/vutils';\n\n/**\n * 判断一个 spec 是否包含另一个 spec 片段\n * @param spec 原始 spec\n * @param searchSpec 要匹配的 spec 片段\n */\nexport const includeSpec = <T = any>(spec: Partial<T>, searchSpec: Partial<T>): boolean => {\n if (spec === searchSpec) {\n return true;\n }\n if (isFunction(spec) || isFunction(searchSpec)) {\n return false;\n }\n if (isArray(spec) && isArray(searchSpec)) {\n return searchSpec.every(searchItem => spec.some(item => includeSpec(item, searchItem)));\n }\n if (isObject(spec) && isObject(searchSpec)) {\n return Object.keys(searchSpec).every(key => includeSpec(spec[key], searchSpec[key]));\n }\n return false;\n};\n\nexport const setProperty = <T>(target: T, path: Array<string | number>, value: any): T => {\n if (isNil(path)) {\n return target;\n }\n const key = path[0];\n if (isNil(key)) {\n return target;\n }\n if (path.length === 1) {\n target[key] = value;\n return target;\n }\n if (isNil(target[key])) {\n if (typeof path[1] === 'number') {\n target[key] = [];\n } else {\n target[key] = {};\n }\n }\n return setProperty(target[key], path.slice(1), value);\n};\n\nexport const getProperty = <T>(target: any, path: Array<string | number>, defaultValue?: T): T => {\n if (isNil(path)) {\n return undefined;\n }\n return get(target, path as string[], defaultValue) as T;\n};\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export function normalizeAngle(angle) {
|
|
2
|
+
for (;angle < 0; ) angle += 2 * Math.PI;
|
|
3
|
+
for (;angle >= 2 * Math.PI; ) angle -= 2 * Math.PI;
|
|
4
|
+
return angle;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function angleLabelOrientAttribute(angle) {
|
|
8
|
+
let align = "center", baseline = "middle";
|
|
9
|
+
return align = (angle = normalizeAngle(angle)) >= Math.PI * (5 / 3) || angle <= Math.PI * (1 / 3) ? "left" : angle >= Math.PI * (2 / 3) && angle <= Math.PI * (4 / 3) ? "right" : "center",
|
|
10
|
+
baseline = angle >= Math.PI * (7 / 6) && angle <= Math.PI * (11 / 6) ? "bottom" : angle >= Math.PI * (1 / 6) && angle <= Math.PI * (5 / 6) ? "top" : "middle",
|
|
11
|
+
{
|
|
12
|
+
align: align,
|
|
13
|
+
baseline: baseline
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=polar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/vutil-extension-temp/utils/polar.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,cAAc,CAAC,KAAa;IAC1C,OAAO,KAAK,GAAG,CAAC,EAAE;QAChB,KAAK,IAAI,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;KACtB;IACD,OAAO,KAAK,IAAI,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE;QAC3B,KAAK,IAAI,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;KACtB;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAOD,MAAM,UAAU,yBAAyB,CAAC,KAAa;IACrD,IAAI,KAAK,GAAkB,QAAQ,CAAC;IACpC,IAAI,QAAQ,GAAqB,QAAQ,CAAC;IAE1C,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;IAG9B,IAAI,KAAK,IAAI,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE;QAC5D,KAAK,GAAG,MAAM,CAAC;KAChB;SAAM,IAAI,KAAK,IAAI,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE;QACnE,KAAK,GAAG,OAAO,CAAC;KACjB;SAAM;QACL,KAAK,GAAG,QAAQ,CAAC;KAClB;IAGD,IAAI,KAAK,IAAI,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE;QAC7D,QAAQ,GAAG,QAAQ,CAAC;KACrB;SAAM,IAAI,KAAK,IAAI,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE;QACnE,QAAQ,GAAG,KAAK,CAAC;KAClB;SAAM;QACL,QAAQ,GAAG,QAAQ,CAAC;KACrB;IAED,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AAC7B,CAAC","file":"polar.js","sourcesContent":["import type { TextAlignType, TextBaselineType } from '@visactor/vrender-core';\n\n/**\n * 角度标准化处理\n * @param angle 弧度角\n */\nexport function normalizeAngle(angle: number): number {\n while (angle < 0) {\n angle += Math.PI * 2;\n }\n while (angle >= Math.PI * 2) {\n angle -= Math.PI * 2;\n }\n return angle;\n}\n\n/**\n * 计算对应角度下的角度轴标签定位属性\n * @param angle 弧度角,需要注意是逆时针计算的\n * @returns\n */\nexport function angleLabelOrientAttribute(angle: number) {\n let align: TextAlignType = 'center';\n let baseline: TextBaselineType = 'middle';\n\n angle = normalizeAngle(angle);\n\n // left: 5/3 - 1/3; right: 2/3 - 4/3; center: 5/3 - 1/3 & 2/3 - 4/3\n if (angle >= Math.PI * (5 / 3) || angle <= Math.PI * (1 / 3)) {\n align = 'left';\n } else if (angle >= Math.PI * (2 / 3) && angle <= Math.PI * (4 / 3)) {\n align = 'right';\n } else {\n align = 'center';\n }\n\n // bottom: 7/6 - 11/6; top: 1/6 - 5/6; middle: 11/6 - 1/6 & 5/6 - 7/6\n if (angle >= Math.PI * (7 / 6) && angle <= Math.PI * (11 / 6)) {\n baseline = 'bottom';\n } else if (angle >= Math.PI * (1 / 6) && angle <= Math.PI * (5 / 6)) {\n baseline = 'top';\n } else {\n baseline = 'middle';\n }\n\n return { align, baseline };\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ITextMeasureOption } from '@visactor/vutils';
|
|
2
|
+
import { TextMeasure } from '@visactor/vutils';
|
|
3
|
+
import type { ITextGraphicAttribute } from '@visactor/vrender-core';
|
|
4
|
+
export declare const initTextMeasure: (textSpec?: Partial<ITextGraphicAttribute>, option?: Partial<ITextMeasureOption>, useNaiveCanvas?: boolean, defaultFontParams?: Partial<ITextGraphicAttribute>) => TextMeasure<ITextGraphicAttribute>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TextMeasure } from "@visactor/vutils";
|
|
2
|
+
|
|
3
|
+
import { getTextBounds } from "@visactor/vrender-core";
|
|
4
|
+
|
|
5
|
+
export const initTextMeasure = (textSpec, option, useNaiveCanvas, defaultFontParams) => new TextMeasure(Object.assign({
|
|
6
|
+
defaultFontParams: Object.assign({
|
|
7
|
+
fontFamily: "PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",
|
|
8
|
+
fontSize: 14
|
|
9
|
+
}, defaultFontParams),
|
|
10
|
+
getTextBounds: useNaiveCanvas ? void 0 : getTextBounds,
|
|
11
|
+
specialCharSet: "-/: .,@%'\"~" + TextMeasure.ALPHABET_CHAR_SET + TextMeasure.ALPHABET_CHAR_SET.toUpperCase()
|
|
12
|
+
}, null != option ? option : {}), textSpec);
|
|
13
|
+
//# sourceMappingURL=text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/vutil-extension-temp/utils/text.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,QAAyC,EACzC,MAAoC,EACpC,cAAwB,EACxB,iBAAkD,EACd,EAAE;IACtC,OAAO,IAAI,WAAW,iBAElB,iBAAiB,kBACf,UAAU,EAER,gKAAgK,EAClK,QAAQ,EAAE,EAAE,IACT,iBAAiB,GAEtB,aAAa,EAAE,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,EACzD,cAAc,EAAE,cAAc,GAAG,WAAW,CAAC,iBAAiB,GAAG,WAAW,CAAC,iBAAiB,CAAC,WAAW,EAAE,IACzG,CAAC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,CAAC,GAEnB,QAAQ,CACT,CAAC;AACJ,CAAC,CAAC","file":"text.js","sourcesContent":["import type { ITextMeasureOption } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { TextMeasure } from '@visactor/vutils';\nimport type { ITextGraphicAttribute } from '@visactor/vrender-core';\nimport { getTextBounds } from '@visactor/vrender-core';\n\nexport const initTextMeasure = (\n textSpec?: Partial<ITextGraphicAttribute>,\n option?: Partial<ITextMeasureOption>,\n useNaiveCanvas?: boolean,\n defaultFontParams?: Partial<ITextGraphicAttribute>\n): TextMeasure<ITextGraphicAttribute> => {\n return new TextMeasure<ITextGraphicAttribute>(\n {\n defaultFontParams: {\n fontFamily:\n // eslint-disable-next-line max-len\n 'PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol',\n fontSize: 14,\n ...defaultFontParams\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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visactor/vtable",
|
|
3
|
-
"version": "0.25.
|
|
3
|
+
"version": "0.25.3-alpha.0",
|
|
4
4
|
"description": "canvas table width high performance",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"grid",
|
|
@@ -35,15 +35,14 @@
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
+
"@visactor/vtable-editors": "0.25.3-alpha.0",
|
|
38
39
|
"@visactor/vrender-core": "0.18.14-alpha.0",
|
|
39
40
|
"@visactor/vrender-kits": "0.18.14-alpha.0",
|
|
40
41
|
"@visactor/vrender-components": "0.18.14-alpha.0",
|
|
41
|
-
"@visactor/vutils-extension": "1.10.6-alpha.2",
|
|
42
42
|
"@visactor/vutils": "~0.18.1",
|
|
43
43
|
"@visactor/vscale": "~0.18.1",
|
|
44
44
|
"@visactor/vdataset": "~0.18.1",
|
|
45
|
-
"cssfontparser": "^1.2.1"
|
|
46
|
-
"@visactor/vtable-editors": "0.25.2"
|
|
45
|
+
"cssfontparser": "^1.2.1"
|
|
47
46
|
},
|
|
48
47
|
"devDependencies": {
|
|
49
48
|
"luxon": "*",
|