@lionad/cx-comps-tanstack-charts 0.1.0-alpha.10 → 0.1.0-alpha.11
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/dist/index.mjs
CHANGED
|
@@ -588,7 +588,7 @@ function translateFrame(spec) {
|
|
|
588
588
|
}
|
|
589
589
|
/** channel 运行时校验:只接受字段名字符串(accessor 函数 JSON 不可表达) */
|
|
590
590
|
function assertChannels(spec) {
|
|
591
|
-
const constantKeys = spec.type === "ruleX" ? /* @__PURE__ */ new Set(["x"]) : spec.type === "ruleY" ? /* @__PURE__ */ new Set(["y"]) : void 0;
|
|
591
|
+
const constantKeys = spec.type === "ruleX" ? /* @__PURE__ */ new Set(["x"]) : spec.type === "ruleY" ? /* @__PURE__ */ new Set(["y"]) : spec.type === "rect" ? /* @__PURE__ */ new Set(["x1", "y1"]) : void 0;
|
|
592
592
|
for (const key of CHANNEL_KEYS) {
|
|
593
593
|
const value = spec[key];
|
|
594
594
|
if (value !== void 0 && typeof value !== "string") {
|
|
@@ -669,7 +669,11 @@ function translateMark(spec, datasets) {
|
|
|
669
669
|
if (!factory) throw new Error(`translateMark: 未知 mark type "${String(spec.type)}"`);
|
|
670
670
|
assertChannels(spec);
|
|
671
671
|
const options = {};
|
|
672
|
-
for (const key of CHANNEL_KEYS)
|
|
672
|
+
for (const key of CHANNEL_KEYS) {
|
|
673
|
+
const value = spec[key];
|
|
674
|
+
if (value === void 0) continue;
|
|
675
|
+
options[key] = typeof value === "number" ? () => value : value;
|
|
676
|
+
}
|
|
673
677
|
for (const key of CHANNEL_FLEX_KEYS) if (spec[key] !== void 0) options[key] = spec[key];
|
|
674
678
|
for (const key of STYLE_KEYS) if (spec[key] !== void 0) options[key] = spec[key];
|
|
675
679
|
for (const key of SCALAR_KEYS) if (spec[key] !== void 0) options[key] = spec[key];
|
|
@@ -1245,7 +1249,7 @@ function buildDefinition(spec, datasets, rowsOverride) {
|
|
|
1245
1249
|
if (bound.type === "polar") pushMark(bound, translatePolar(bound, table));
|
|
1246
1250
|
else if (bound.type === "pie") pushMark(bound, translatePie(bound, table));
|
|
1247
1251
|
else if (COMPOSITE_TYPES.has(bound.type)) {
|
|
1248
|
-
const result = translateCompositeMark(bound, table, (child, rows) => buildDefinition(child,
|
|
1252
|
+
const result = translateCompositeMark(bound, table, (child, rows) => buildDefinition(child, table, rows));
|
|
1249
1253
|
for (const expanded of result.marks) pushMark(bound, expanded);
|
|
1250
1254
|
if (result.xDomain) derivedXDomain = result.xDomain;
|
|
1251
1255
|
if (result.yDomain) derivedYDomain = result.yDomain;
|
|
@@ -89,7 +89,8 @@ export type CxChartMarkType = 'lineY' | 'lineX' | 'areaY' | 'areaX' | 'barY' | '
|
|
|
89
89
|
/**
|
|
90
90
|
* 单 mark 声明式。平铺契约(LLM 友好):专有标量字段全部可选、按名透传,
|
|
91
91
|
* 不适用的字段被对应工厂忽略;channel 只接受字段名字符串(弹性 channel
|
|
92
|
-
* angle/radius/width/height/length/rotate/r
|
|
92
|
+
* angle/radius/width/height/length/rotate/r 另接受数值常量;x1/y1 仅在
|
|
93
|
+
* rect 基线场景接受数值常量——对应官方直方图零基线写法 y1:()=>0)。
|
|
93
94
|
*/
|
|
94
95
|
export interface CxChartMarkSpec {
|
|
95
96
|
type: CxChartMarkType;
|
|
@@ -110,8 +111,8 @@ export interface CxChartMarkSpec {
|
|
|
110
111
|
decorative?: boolean;
|
|
111
112
|
x?: string;
|
|
112
113
|
y?: string;
|
|
113
|
-
x1?: string;
|
|
114
|
-
y1?: string;
|
|
114
|
+
x1?: string | number;
|
|
115
|
+
y1?: string | number;
|
|
115
116
|
x2?: string;
|
|
116
117
|
y2?: string;
|
|
117
118
|
z?: string;
|