@fses/workbench-app 0.2.2 → 0.2.4
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/WORKBENCH-CLOSURE.json +12 -12
- package/dist/{Workspace-fYH2XNdb.js → Workspace-CIfCreXf.js} +6 -7
- package/dist/fses-workbench-app.js +4 -4
- package/dist/{index-CbIJlts1.js → index-xopzCjp-.js} +239 -234
- package/dist/internal/personal-workbench/lib/cardRecommendationIdentity.d.ts +37 -0
- package/dist/internal/personal-workbench/lib/workbenchCardRecommendationReturnItemUpsert.d.ts +32 -0
- package/dist/runtime/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/{useWorkbenchRuntime-Ch8lqkjO.js → useWorkbenchRuntime-Bn92SaQG.js} +6030 -5843
- package/node_modules/@fses/ai-chat/dist/fses-ai-chat.js +293 -293
- package/node_modules/@fses/ai-chat/dist/fses-ai-chat.umd.cjs +1 -1
- package/node_modules/@fses/ai-chat/dist/style.css +1 -1
- package/node_modules/@fses/ai-chat/package.json +5 -5
- package/node_modules/@fses/workbench-card/dist/fses-workbench-card-echarts-protocol.js +656 -641
- package/node_modules/@fses/workbench-card/dist/fses-workbench-card-renderers.js +2425 -2410
- package/node_modules/@fses/workbench-card/package.json +1 -1
- package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/series.converter.ts +34 -13
- package/package.json +3 -3
|
@@ -51,26 +51,47 @@ function toStringLabels(value: unknown): string[] {
|
|
|
51
51
|
* @returns 可传给 ECharts series.data 的值
|
|
52
52
|
*/
|
|
53
53
|
function normalizeSeriesValue(value: unknown): unknown {
|
|
54
|
-
if (typeof value === 'number' && Number.isFinite(value)) return value;
|
|
55
|
-
if (typeof value === 'string' && value.trim()) {
|
|
56
|
-
const parsed = Number(value);
|
|
57
|
-
return Number.isFinite(parsed) ? parsed : value;
|
|
58
|
-
}
|
|
59
54
|
if (isRecord(value) && 'value' in value) {
|
|
60
55
|
const rawValue = value.value;
|
|
61
|
-
const parsedValue =
|
|
62
|
-
? Number(rawValue)
|
|
63
|
-
: rawValue;
|
|
56
|
+
const parsedValue = finiteNumber(rawValue);
|
|
64
57
|
return {
|
|
65
58
|
...value,
|
|
66
|
-
value:
|
|
59
|
+
value: parsedValue !== undefined
|
|
67
60
|
? parsedValue
|
|
68
61
|
: rawValue,
|
|
69
62
|
};
|
|
70
63
|
}
|
|
64
|
+
const numericValue = finiteNumber(value);
|
|
65
|
+
if (numericValue !== undefined) return numericValue;
|
|
71
66
|
return value;
|
|
72
67
|
}
|
|
73
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Reads a finite number from primitive values or typed value wrappers.
|
|
71
|
+
* @param value - Runtime series value from protocol data.
|
|
72
|
+
* @returns Finite number, or undefined when no numeric value can be read.
|
|
73
|
+
*/
|
|
74
|
+
function finiteNumber(value: unknown): number | undefined {
|
|
75
|
+
if (typeof value === 'number') return Number.isFinite(value) ? value : undefined;
|
|
76
|
+
if (typeof value === 'bigint') {
|
|
77
|
+
const numericValue = Number(value);
|
|
78
|
+
return Number.isFinite(numericValue) ? numericValue : undefined;
|
|
79
|
+
}
|
|
80
|
+
if (typeof value === 'string') {
|
|
81
|
+
const normalized = value.replace(/[,,\s]/gu, '').trim();
|
|
82
|
+
if (!normalized) return undefined;
|
|
83
|
+
const numericValue = Number(normalized);
|
|
84
|
+
return Number.isFinite(numericValue) ? numericValue : undefined;
|
|
85
|
+
}
|
|
86
|
+
if (!isRecord(value)) return undefined;
|
|
87
|
+
for (const key of ['value', 'raw_value', 'numeric_value', 'metric_value', 'count', 'amount']) {
|
|
88
|
+
if (!Object.prototype.hasOwnProperty.call(value, key)) continue;
|
|
89
|
+
const numericValue = finiteNumber(value[key]);
|
|
90
|
+
if (numericValue !== undefined) return numericValue;
|
|
91
|
+
}
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
|
|
74
95
|
/**
|
|
75
96
|
* 从 canonical 或 dataset 包裹的协议数据中读取类目标签。
|
|
76
97
|
* @param source - 协议数据对象或其中的 dataset 对象
|
|
@@ -291,8 +312,8 @@ function isWaterfallHelperSeries(seriesDef: Record<string, unknown>): boolean {
|
|
|
291
312
|
*/
|
|
292
313
|
function waterfallNumber(value: unknown): number {
|
|
293
314
|
const raw = isRecord(value) && 'value' in value ? value.value : value;
|
|
294
|
-
const parsed =
|
|
295
|
-
return
|
|
315
|
+
const parsed = finiteNumber(raw);
|
|
316
|
+
return parsed !== undefined ? Math.max(0, parsed) : 0;
|
|
296
317
|
}
|
|
297
318
|
|
|
298
319
|
/**
|
|
@@ -517,13 +538,13 @@ function buildPieData(series: NormalizedSeriesItem, categories: string[]): unkno
|
|
|
517
538
|
name: typeof item.name === 'string' && item.name.trim()
|
|
518
539
|
? item.name.trim()
|
|
519
540
|
: categories[index] || series.name || `item-${index + 1}`,
|
|
520
|
-
value:
|
|
541
|
+
value: finiteNumber(item.value) ?? 0,
|
|
521
542
|
}));
|
|
522
543
|
}
|
|
523
544
|
|
|
524
545
|
return series.data.map((value, index) => ({
|
|
525
546
|
name: categories[index] || `item-${index + 1}`,
|
|
526
|
-
value,
|
|
547
|
+
value: finiteNumber(value) ?? value,
|
|
527
548
|
}));
|
|
528
549
|
}
|
|
529
550
|
|
package/package.json
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"@byteluck-fe/workbench-template": "0.1.1",
|
|
11
11
|
"@byteluck/agentic-protocol": "2.2.1",
|
|
12
12
|
"@byteluck/workbench-skill-contracts": "0.1.0",
|
|
13
|
-
"@fses/ai-chat": "1.0.
|
|
14
|
-
"@fses/workbench-card": "0.3.
|
|
13
|
+
"@fses/ai-chat": "1.0.3",
|
|
14
|
+
"@fses/workbench-card": "0.3.3",
|
|
15
15
|
"@microsoft/fetch-event-source": "2.0.1",
|
|
16
16
|
"axios": "^1.15.0",
|
|
17
17
|
"clsx": "^2.1.1",
|
|
@@ -142,5 +142,5 @@
|
|
|
142
142
|
},
|
|
143
143
|
"type": "module",
|
|
144
144
|
"types": "./dist/index.d.ts",
|
|
145
|
-
"version": "0.2.
|
|
145
|
+
"version": "0.2.4"
|
|
146
146
|
}
|