soma-core 2.2.6 → 2.2.8
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/core/build/compiler/soma-precompile.js +66 -10
- package/core/client/container/IContainerAdapter.ts +4 -0
- package/core/client/container/SomaContainerAdapter.ts +43 -2
- package/core/client/data/data-object-resolver.ts +43 -8
- package/core/client/engine/event-engine.ts +28 -3
- package/core/client/engine/soma-bootstrap.ts +2 -1
- package/core/client/engines/chart/adapter-echarts.ts +75 -2
- package/core/client/engines/chart/index.ts +18 -0
- package/core/client/engines/chart/port.ts +13 -0
- package/core/client/infra/notify/DefaultNotifyService.ts +2 -2
- package/core/client/parser/confirm-spec.ts +99 -6
- package/core/client/parser/data-config-parser.ts +1 -1
- package/core/client/parser/pipeline-parser.ts +2 -1
- package/core/client/render-ports/hide-transition.ts +9 -0
- package/core/client/render-ports/index.ts +4 -0
- package/core/client/render-ports/notify-renderer.ts +2 -1
- package/core/index.ts +16 -4
- package/core/server/api/load-host-service.ts +3 -0
- package/core/server/api/paged-list.ts +259 -0
- package/core/server/host/empty-host-bootstrap.mjs +3 -0
- package/core/server/host/host-assembly.ts +3 -0
- package/core/server/host/source-aliases.cjs +345 -0
- package/core/server/host/source-aliases.ts +32 -0
- package/core/server/host/source-packages.cjs +1 -0
- package/core/server/infra/cache/ServerFileCache.ts +4 -1
- package/core/server/node.ts +10 -0
- package/core/server/runtime-space/bindings.ts +47 -1
- package/core/server/runtime-space/digest.ts +6 -0
- package/core/server/runtime-space/index.ts +1 -1
- package/core/server/runtime-space/inject.ts +4 -1
- package/core/server/runtime-space/prewarm.ts +8 -8
- package/core/server/runtime-space/store.ts +8 -7
- package/core/server/runtime-space/types.ts +3 -2
- package/core/shared/core-diagnostic-codes.ts +6 -0
- package/core/shared/data-declaration-checks.ts +29 -3
- package/core/shared/registry-generated/diagnostic-registry-index.ts +5 -0
- package/core/shared/registry-generated/diagnostic-registry.ts +35 -0
- package/core/shared/registry-generated/limits.ts +18 -2
- package/core/shared/registry-generated/std-grammar.ts +1 -1
- package/core/shared/types/data-config.types.ts +3 -1
- package/core/shared/types/event.types.ts +9 -0
- package/dist/browser/soma-runtime.js +262 -23
- package/dist/core/index.cjs +283 -23
- package/dist/host-native/aot-builder.cjs +284 -0
- package/dist/host-native/native-server.cjs +395 -24
- package/dist/lsp/component-tree.cjs +66 -10
- package/dist/types/client/container/IContainerAdapter.d.ts +3 -0
- package/dist/types/client/container/SomaContainerAdapter.d.ts +5 -0
- package/dist/types/client/data/data-object-resolver.d.ts +2 -0
- package/dist/types/client/engines/chart/index.d.ts +1 -1
- package/dist/types/client/engines/chart/port.d.ts +15 -0
- package/dist/types/client/parser/confirm-spec.d.ts +27 -3
- package/dist/types/client/render-ports/hide-transition.d.ts +9 -0
- package/dist/types/client/render-ports/index.d.ts +4 -0
- package/dist/types/client/render-ports/notify-renderer.d.ts +2 -1
- package/dist/types/index.d.ts +4 -4
- package/dist/types/server/api/paged-list.d.ts +101 -0
- package/dist/types/server/host/source-aliases.d.cts +53 -0
- package/dist/types/server/host/source-aliases.d.ts +30 -0
- package/dist/types/server/host/source-packages.d.cts +2 -0
- package/dist/types/server/node.d.ts +1 -0
- package/dist/types/server/runtime-space/bindings.d.ts +9 -0
- package/dist/types/server/runtime-space/digest.d.ts +5 -0
- package/dist/types/server/runtime-space/index.d.ts +1 -1
- package/dist/types/server/runtime-space/prewarm.d.ts +2 -2
- package/dist/types/server/runtime-space/types.d.ts +3 -2
- package/dist/types/shared/core-diagnostic-codes.d.ts +1 -1
- package/dist/types/shared/registry-generated/diagnostic-registry.d.ts +30 -0
- package/dist/types/shared/registry-generated/limits.d.ts +14 -0
- package/dist/types/shared/registry-generated/std-grammar.d.ts +1 -1
- package/dist/types/shared/types/data-config.types.d.ts +3 -1
- package/dist/types/shared/types/event.types.d.ts +8 -0
- package/host-native/src/aot-builder.ts +23 -0
- package/host-native/src/host-prepare.ts +18 -1
- package/host-native/src/native-server.ts +16 -0
- package/host-native/styles/globals.css +30 -28
- package/package.json +13 -2
|
@@ -3934,11 +3934,12 @@ ${formatScopeIssues(issues)}`, issues[0].path.startsWith("scopes") ? `${path.sli
|
|
|
3934
3934
|
var NOTIFY_LEVELS = ["success", "info", "warning", "error", "alert", "announce"];
|
|
3935
3935
|
var NOTIFY_POLITENESS = ["polite", "assertive"];
|
|
3936
3936
|
var SOMA_CONFIRM_LEVELS = ["plain", "typed", "consent"];
|
|
3937
|
+
var SOMA_CONFIRM_TONES = ["default", "danger"];
|
|
3937
3938
|
|
|
3938
3939
|
// core/client/parser/confirm-spec.ts
|
|
3939
3940
|
var SOMA_CONFIRM_REJECTED_PREFIX = "soma-confirm:";
|
|
3940
3941
|
var SOMA_CONFIRM_TEXT_MAX = 1e3;
|
|
3941
|
-
var SPEC_KEYS = ["level", "text", "phrase", "impact"];
|
|
3942
|
+
var SPEC_KEYS = ["level", "text", "phrase", "impact", "tone"];
|
|
3942
3943
|
function boundedText(value, key) {
|
|
3943
3944
|
if (typeof value !== "string" || value.trim() === "") return `confirm.${key} \u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32\uFF0C\u5F53\u524D\u503C: ${JSON.stringify(value)}`;
|
|
3944
3945
|
if (value.length > SOMA_CONFIRM_TEXT_MAX) return `confirm.${key} \u8FC7\u957F\uFF08\u4E0A\u9650 ${SOMA_CONFIRM_TEXT_MAX} \u5B57\u7B26\uFF09`;
|
|
@@ -3946,7 +3947,7 @@ function boundedText(value, key) {
|
|
|
3946
3947
|
}
|
|
3947
3948
|
function checkConfirmSpec(raw) {
|
|
3948
3949
|
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
|
|
3949
|
-
return { ok: false, error: `confirm \u7ED3\u6784\u5FC5\u987B\u662F { level, text, phrase?, impact? } \u5BF9\u8C61\uFF0C\u5F53\u524D\u503C: ${JSON.stringify(raw)}` };
|
|
3950
|
+
return { ok: false, error: `confirm \u7ED3\u6784\u5FC5\u987B\u662F { level, text, phrase?, impact?, tone? } \u5BF9\u8C61\uFF0C\u5F53\u524D\u503C: ${JSON.stringify(raw)}` };
|
|
3950
3951
|
}
|
|
3951
3952
|
const record = raw;
|
|
3952
3953
|
const extra = Object.keys(record).find((key) => !SPEC_KEYS.includes(key));
|
|
@@ -3957,6 +3958,9 @@ function checkConfirmSpec(raw) {
|
|
|
3957
3958
|
if (typeof level !== "string" || !SOMA_CONFIRM_LEVELS.includes(level)) {
|
|
3958
3959
|
return { ok: false, error: `confirm.level \u5FC5\u987B\u662F ${SOMA_CONFIRM_LEVELS.join(" / ")} \u4E4B\u4E00\uFF0C\u5F53\u524D\u503C: ${JSON.stringify(level)}` };
|
|
3959
3960
|
}
|
|
3961
|
+
if (record.tone !== void 0 && (typeof record.tone !== "string" || !SOMA_CONFIRM_TONES.includes(record.tone))) {
|
|
3962
|
+
return { ok: false, error: `confirm.tone \u5FC5\u987B\u662F ${SOMA_CONFIRM_TONES.join(" / ")} \u4E4B\u4E00\uFF08\u4E0D\u5199 = default\uFF09\uFF0C\u5F53\u524D\u503C: ${JSON.stringify(record.tone)}` };
|
|
3963
|
+
}
|
|
3960
3964
|
const textProblem = boundedText(record.text, "text");
|
|
3961
3965
|
if (textProblem !== null) return { ok: false, error: textProblem };
|
|
3962
3966
|
for (const key of ["phrase", "impact"]) {
|
|
@@ -3984,7 +3988,8 @@ function checkConfirmSpec(raw) {
|
|
|
3984
3988
|
level: lv,
|
|
3985
3989
|
text,
|
|
3986
3990
|
...lv === "typed" ? { phrase: record.phrase.trim() } : {},
|
|
3987
|
-
...lv !== "plain" && record.impact !== void 0 ? { impact: record.impact.trim() } : {}
|
|
3991
|
+
...lv !== "plain" && record.impact !== void 0 ? { impact: record.impact.trim() } : {},
|
|
3992
|
+
...record.tone === "danger" ? { tone: "danger" } : {}
|
|
3988
3993
|
}
|
|
3989
3994
|
};
|
|
3990
3995
|
}
|
|
@@ -4205,7 +4210,7 @@ function splitOptionalSegments(parts) {
|
|
|
4205
4210
|
const segment = parseConfirmSegment(message);
|
|
4206
4211
|
if ("error" in segment) throw new SomaEventParseError(segment.error, parts.join(" | "));
|
|
4207
4212
|
confirm = segment.spec.text;
|
|
4208
|
-
confirmSpec = segment.spec.level === "plain" ? void 0 : segment.spec;
|
|
4213
|
+
confirmSpec = segment.spec.level === "plain" && segment.spec.tone === void 0 ? void 0 : segment.spec;
|
|
4209
4214
|
continue;
|
|
4210
4215
|
}
|
|
4211
4216
|
if (index > 0 && part.startsWith(PERMISSION_PREFIX)) {
|
|
@@ -4843,14 +4848,16 @@ function inspectSourceRequire(raw, paramNames) {
|
|
|
4843
4848
|
}
|
|
4844
4849
|
const issues = [];
|
|
4845
4850
|
const seen = /* @__PURE__ */ new Set();
|
|
4846
|
-
|
|
4847
|
-
const at = `require[${index}]`;
|
|
4851
|
+
const checkName = (name, at, inGroup) => {
|
|
4848
4852
|
if (typeof name !== "string" || name.trim() === "") {
|
|
4849
4853
|
issues.push({ path: at, message: `require \u91CC\u7684\u53C2\u6570\u540D\u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32\uFF0C\u5F53\u524D\u503C: ${show(name)}` });
|
|
4850
4854
|
return;
|
|
4851
4855
|
}
|
|
4852
4856
|
if (seen.has(name)) {
|
|
4853
|
-
issues.push({
|
|
4857
|
+
issues.push({
|
|
4858
|
+
path: at,
|
|
4859
|
+
message: inGroup ? `require \u91CC\u6709\u91CD\u590D\u7684\u53C2\u6570\u540D "${name}"\uFF08\u540C\u540D\u4E0D\u80FD\u5728\u5355\u9879\u4E0E\u5206\u7EC4\u91CC\u3001\u6216\u4E24\u4E2A\u5206\u7EC4\u91CC\u91CD\u590D\u51FA\u73B0\uFF09` : `require \u91CC\u6709\u91CD\u590D\u7684\u53C2\u6570\u540D "${name}"`
|
|
4860
|
+
});
|
|
4854
4861
|
return;
|
|
4855
4862
|
}
|
|
4856
4863
|
seen.add(name);
|
|
@@ -4860,6 +4867,28 @@ function inspectSourceRequire(raw, paramNames) {
|
|
|
4860
4867
|
message: `require \u91CC\u7684 "${name}" \u6CA1\u6709\u51FA\u73B0\u5728\u540C\u4E00\u6765\u6E90\u7684 params \u91CC\uFF08params \u6709: ${paramNames.join(" / ") || "\u65E0"}\uFF09`
|
|
4861
4868
|
});
|
|
4862
4869
|
}
|
|
4870
|
+
};
|
|
4871
|
+
raw.forEach((entry, index) => {
|
|
4872
|
+
const at = `require[${index}]`;
|
|
4873
|
+
if (!Array.isArray(entry)) {
|
|
4874
|
+
checkName(entry, at, false);
|
|
4875
|
+
return;
|
|
4876
|
+
}
|
|
4877
|
+
if (entry.length < 2) {
|
|
4878
|
+
issues.push({
|
|
4879
|
+
path: at,
|
|
4880
|
+
message: `require \u91CC\u7684\u300C\u81F3\u5C11\u4E00\u4E2A\u300D\u5206\u7EC4\u81F3\u5C11\u8981 2 \u4E2A\u53C2\u6570\u540D\uFF08\u5355\u4E2A\u53C2\u6570\u76F4\u63A5\u5199\u540D\u5B57\uFF09\uFF0C\u5F53\u524D\u503C: ${show(entry)}`
|
|
4881
|
+
});
|
|
4882
|
+
return;
|
|
4883
|
+
}
|
|
4884
|
+
entry.forEach((member, memberIndex) => {
|
|
4885
|
+
const memberAt = `${at}[${memberIndex}]`;
|
|
4886
|
+
if (Array.isArray(member)) {
|
|
4887
|
+
issues.push({ path: memberAt, message: `require \u7684\u5206\u7EC4\u53EA\u8BB8\u4E00\u5C42\uFF0C\u4E0D\u80FD\u518D\u5D4C\u5957\u6570\u7EC4\uFF0C\u5F53\u524D\u503C: ${show(member)}` });
|
|
4888
|
+
return;
|
|
4889
|
+
}
|
|
4890
|
+
checkName(member, memberAt, true);
|
|
4891
|
+
});
|
|
4863
4892
|
});
|
|
4864
4893
|
return issues;
|
|
4865
4894
|
}
|
|
@@ -6214,6 +6243,11 @@ var SOMA_PIPELINE_LIMITS = {
|
|
|
6214
6243
|
"file": "core/server/registry/registry-file-lock.ts",
|
|
6215
6244
|
"symbol": "SOMA_PIPELINE_LIMITS"
|
|
6216
6245
|
},
|
|
6246
|
+
{
|
|
6247
|
+
"module": "soma-core",
|
|
6248
|
+
"file": "core/server/api/paged-list.ts",
|
|
6249
|
+
"symbol": "SOMA_PIPELINE_LIMITS"
|
|
6250
|
+
},
|
|
6217
6251
|
{
|
|
6218
6252
|
"module": "soma-core",
|
|
6219
6253
|
"file": "core/server/registry/registry-write-pipeline.ts",
|
|
@@ -6229,6 +6263,11 @@ var SOMA_PIPELINE_LIMITS = {
|
|
|
6229
6263
|
"file": "core/server/registry/source/version-store.ts",
|
|
6230
6264
|
"symbol": "SOMA_PIPELINE_LIMITS"
|
|
6231
6265
|
},
|
|
6266
|
+
{
|
|
6267
|
+
"module": "soma-core",
|
|
6268
|
+
"file": "core/server/runtime-space/inject.ts",
|
|
6269
|
+
"symbol": "SOMA_PIPELINE_LIMITS"
|
|
6270
|
+
},
|
|
6232
6271
|
{
|
|
6233
6272
|
"module": "soma-ui",
|
|
6234
6273
|
"file": "src/compiler/bdl/registry/archive.ts",
|
|
@@ -6577,7 +6616,8 @@ var SOMA_PIPELINE_LIMITS = {
|
|
|
6577
6616
|
"watchFailLimit": 2,
|
|
6578
6617
|
"serverFileMaxEntries": 512,
|
|
6579
6618
|
"serverFileMaxBytes": 33554432,
|
|
6580
|
-
"serverDirMaxEntries": 256
|
|
6619
|
+
"serverDirMaxEntries": 256,
|
|
6620
|
+
"sourceRootAliasCapacity": 64
|
|
6581
6621
|
},
|
|
6582
6622
|
"runtimeCache": {
|
|
6583
6623
|
"basis": "runtime \u7A7A\u95F4 L1 \u5185\u5B58 LRU \u7684\u6761\u76EE\u5BB9\u91CF\uFF08\u7F16\u8BD1\u7ED3\u679C\u4E0E\u6807\u51C6\u683C\u5F0F\u4EA7\u7269\u5404\u4E00\u6761\u76EE\uFF09\u4E0E\u9759\u6001\u9875\u5730\u5740\u6E05\u5355\u7684\u5F00\u53D1\u6001\u590D\u6838\u95F4\u9694\uFF1B\u5BB9\u91CF\u4E0D\u5C0F\u4E8E\u53D1\u5E03\u9875\u4EA7\u7269\u7F13\u5B58\u5BB9\u91CF\uFF08cache.publishedArtifactCapacity\uFF09\uFF0C\u56E0\u4E3A L1 \u8981\u5BB9\u5F97\u4E0B\u5DF2\u53D1\u5E03\u9875\u52A0\u4E0A\u8FD0\u884C\u671F\u6309 URL \u6CE8\u5165\u7684\u9875\uFF1B\u590D\u6838\u95F4\u9694\u8BA9\u65B0\u589E\u9759\u6001\u9875\u6700\u8FDF\u8FD9\u4E2A\u6BEB\u79D2\u6570\u540E\u8FDB\u5165\u5199\u5165\u671F\u51B2\u7A81\u5224\u5B9A\uFF08\u751F\u4EA7\u6001\u4E0D\u8FC7\u671F\uFF09\u3002\u8FC1\u5165\u524D\u662F soma-core store.ts \u7684 SOMA_RUNTIME_CACHE_ENTRIES_DEFAULT \u4E0E static-source.ts \u7684 DEV_TTL_MS",
|
|
@@ -6595,6 +6635,10 @@ var SOMA_PIPELINE_LIMITS = {
|
|
|
6595
6635
|
"maxWaitMs": 5e3,
|
|
6596
6636
|
"waitSliceMs": 15
|
|
6597
6637
|
},
|
|
6638
|
+
"pagedList": {
|
|
6639
|
+
"pageSizeDefault": 10,
|
|
6640
|
+
"pageSizeMax": 500
|
|
6641
|
+
},
|
|
6598
6642
|
"writeRate": {
|
|
6599
6643
|
"limit": 120,
|
|
6600
6644
|
"windowMs": 6e4
|
|
@@ -6605,7 +6649,8 @@ var SOMA_PIPELINE_LIMITS = {
|
|
|
6605
6649
|
"defaultDebounceMs": 300
|
|
6606
6650
|
},
|
|
6607
6651
|
"inject": {
|
|
6608
|
-
"pageMaxBytes": 4194304
|
|
6652
|
+
"pageMaxBytes": 4194304,
|
|
6653
|
+
"batchFailureMessageMaxChars": 2e3
|
|
6609
6654
|
},
|
|
6610
6655
|
"execution": {
|
|
6611
6656
|
"maxNodes": 128,
|
|
@@ -6888,7 +6933,7 @@ function parseSource(raw, path, objectNames, selfName, deps) {
|
|
|
6888
6933
|
SOMA_FROM_REQUIRE_CODE
|
|
6889
6934
|
);
|
|
6890
6935
|
}
|
|
6891
|
-
source.require = [...
|
|
6936
|
+
source.require = requireRaw.map((entry) => Array.isArray(entry) ? [...entry] : entry);
|
|
6892
6937
|
}
|
|
6893
6938
|
return source;
|
|
6894
6939
|
}
|
|
@@ -7504,6 +7549,17 @@ var SOMA_CORE_DIAGNOSTIC_CODES = [
|
|
|
7504
7549
|
// 时间:ready() 前调同步方法
|
|
7505
7550
|
"CORE-TEMPORAL-ZONE",
|
|
7506
7551
|
// 时间:时区标识非法
|
|
7552
|
+
// 宿主源码别名(产生点 core/server/host/source-aliases.cjs,CJS 不能 import 本表,码字面量两处各一份,由本表对账测试与注册表一致)
|
|
7553
|
+
"CORE-HOST-ALIAS-INVALID",
|
|
7554
|
+
// 别名声明形状不对 / 路径越界或不存在 / 别名名字非法(error)
|
|
7555
|
+
"CORE-HOST-ALIAS-RESERVED",
|
|
7556
|
+
// 别名占了保留名(soma / soma-*、server-only、node_modules、带子路径的 Node 内置)(error)
|
|
7557
|
+
"CORE-HOST-ALIAS-SHADOW",
|
|
7558
|
+
// 宿主 node_modules/<别名> 已存在且不是指向别名目录的软链(warning,别名仍生效)
|
|
7559
|
+
"CORE-HOST-ALIAS-DUPLICATE",
|
|
7560
|
+
// 多个源码根里同名别名,先声明者胜(warning)
|
|
7561
|
+
"CORE-HOST-ALIAS-TSCONFIG-DRIFT",
|
|
7562
|
+
// tsconfig.json 的 baseUrl 与第一个源码根不一致(warning)
|
|
7507
7563
|
"CORE-DND-SPEC",
|
|
7508
7564
|
// 拖放:getData 返回非对象 / 同元素重复登记
|
|
7509
7565
|
"CORE-ALGO-DIFF-INPUT",
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { HideTransition } from '../render-ports/hide-transition';
|
|
2
|
+
|
|
1
3
|
/** 容器适配层协议 — 端口:Web 适配器为缺省实现,其他容器由调用方实现 */
|
|
2
4
|
export interface SomaAnchorStats {
|
|
3
5
|
anchors: Set<string>;
|
|
@@ -33,5 +35,7 @@ export interface IContainerAdapter {
|
|
|
33
35
|
/** `options.replace`:替换当前历史条目(管道 `NAV_* | … | replace`) */
|
|
34
36
|
navigate(url: string, options?: { replace?: boolean }): void;
|
|
35
37
|
now(): number;
|
|
38
|
+
/** 注入隐藏前过渡钩子(`renderPorts.hideTransition`);传 null 清除。未注入时 setVisibility 立即写 hidden */
|
|
39
|
+
setHideTransition?(hook: HideTransition | null): void;
|
|
36
40
|
setNavigateHandler?(handler: (url: string, options?: { replace?: boolean }) => void): void;
|
|
37
41
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { IContainerAdapter, SomaAnchorStats } from './IContainerAdapter';
|
|
2
|
+
import type { HideTransition } from '../render-ports/hide-transition';
|
|
2
3
|
import { hasBlockedScheme, sanitizeAttributeWrite } from '../security/url-guard';
|
|
3
4
|
import { shouldRemoveAttribute } from '../security/attribute-presence';
|
|
4
5
|
import { sanitizeSomaHtml } from '../security/html-sanitizer';
|
|
@@ -8,6 +9,9 @@ export type { SomaAnchorStats } from './IContainerAdapter';
|
|
|
8
9
|
|
|
9
10
|
export class SomaContainerAdapter implements IContainerAdapter {
|
|
10
11
|
private navigateHandler: ((url: string, options?: { replace?: boolean }) => void) | null = null;
|
|
12
|
+
private hideTransition: HideTransition | null = null;
|
|
13
|
+
/** 正在「隐藏前过渡」的元素 -> 取消控制器(显示时 abort,作废旧 Promise) */
|
|
14
|
+
private readonly pendingHides = new WeakMap<HTMLElement, AbortController>();
|
|
11
15
|
|
|
12
16
|
/** 注入自定义导航处理器(如 SomaRouter + Next.js 路由) */
|
|
13
17
|
setNavigateHandler(handler: (url: string, options?: { replace?: boolean }) => void): void {
|
|
@@ -120,11 +124,48 @@ export class SomaContainerAdapter implements IContainerAdapter {
|
|
|
120
124
|
|
|
121
125
|
/** 显隐只有 `hidden` 属性这一个机制:不写内联样式、不切类名;元素自带的 display 规则压不过 `[hidden]`,见 host-next/app/globals.css(宿主壳样式) */
|
|
122
126
|
setVisibility(element: HTMLElement, visible: boolean): void {
|
|
123
|
-
|
|
127
|
+
const pending = this.pendingHides.get(element);
|
|
128
|
+
if (visible) {
|
|
129
|
+
if (pending) {
|
|
130
|
+
this.pendingHides.delete(element);
|
|
131
|
+
pending.abort();
|
|
132
|
+
}
|
|
133
|
+
element.hidden = false;
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
const hook = this.hideTransition;
|
|
137
|
+
// 未注册钩子 / 已隐藏 / 正在过渡:与以前一致(直接写,或不重复触发)
|
|
138
|
+
if (!hook || element.hidden || pending) {
|
|
139
|
+
if (!pending) element.hidden = true;
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
const controller = new AbortController();
|
|
143
|
+
let result: Promise<void> | void;
|
|
144
|
+
try {
|
|
145
|
+
result = hook(element, controller.signal);
|
|
146
|
+
} catch {
|
|
147
|
+
element.hidden = true;
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (!result || typeof (result as Promise<void>).then !== 'function') {
|
|
151
|
+
element.hidden = true;
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
this.pendingHides.set(element, controller);
|
|
155
|
+
const settle = (): void => {
|
|
156
|
+
if (this.pendingHides.get(element) !== controller || controller.signal.aborted) return;
|
|
157
|
+
this.pendingHides.delete(element);
|
|
158
|
+
element.hidden = true;
|
|
159
|
+
};
|
|
160
|
+
(result as Promise<void>).then(settle, settle);
|
|
124
161
|
}
|
|
125
162
|
|
|
126
163
|
isVisible(element: HTMLElement): boolean {
|
|
127
|
-
return !element.hidden;
|
|
164
|
+
return !element.hidden && !this.pendingHides.has(element);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
setHideTransition(hook: HideTransition | null): void {
|
|
168
|
+
this.hideTransition = hook;
|
|
128
169
|
}
|
|
129
170
|
|
|
130
171
|
toggleClasses(element: HTMLElement, classes: string[], enabled: boolean): void {
|
|
@@ -58,7 +58,8 @@ export class SomaDataCycleError extends Error {
|
|
|
58
58
|
|
|
59
59
|
/** 解析器需要的最小 http 能力(结构兼容 IHttpClient / SomaHttpService) */
|
|
60
60
|
export interface SomaDataHttpLike {
|
|
61
|
-
|
|
61
|
+
/** `silentErrorToast`:读失败已由读状态在内容区内联呈现,请求层不再全局弹 toast(避免同一错误出现两次) */
|
|
62
|
+
get<T = unknown>(url: string, config?: { params?: Record<string, string>; silentErrorToast?: boolean; onResponse?: (info: { status: number }) => void }): Promise<T>;
|
|
62
63
|
/** 写通道:不实现时 submit 抛「本 Host 的 http 不支持写」而不是静默失败 */
|
|
63
64
|
post?<T = unknown>(url: string, body?: unknown, config?: { onResponse?: (info: { status: number }) => void; timeout?: number; signal?: AbortSignal }): Promise<T>;
|
|
64
65
|
put?<T = unknown>(url: string, body?: unknown, config?: { onResponse?: (info: { status: number }) => void; timeout?: number; signal?: AbortSignal }): Promise<T>;
|
|
@@ -149,6 +150,28 @@ function isPlainObject(value: unknown): value is Record<string, unknown> {
|
|
|
149
150
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
150
151
|
}
|
|
151
152
|
|
|
153
|
+
/**
|
|
154
|
+
* 提交体里的布尔显式化:字典里 `type: bool` 的字段,新建时缺席或为空(undefined / null / 空串)→ false;
|
|
155
|
+
* 已给出的布尔(true / false)原样保留。没有要改的返回原对象(同一引用)。
|
|
156
|
+
*/
|
|
157
|
+
function explicitBooleans(
|
|
158
|
+
fields: Readonly<Record<string, { readonly type?: string }>>,
|
|
159
|
+
model: Readonly<Record<string, unknown>>,
|
|
160
|
+
create: boolean,
|
|
161
|
+
): Record<string, unknown> {
|
|
162
|
+
let next: Record<string, unknown> | null = null;
|
|
163
|
+
for (const [key, field] of Object.entries(fields)) {
|
|
164
|
+
if (field?.type !== 'bool') continue;
|
|
165
|
+
const present = Object.hasOwn(model, key);
|
|
166
|
+
const value = model[key];
|
|
167
|
+
const blank = value === undefined || value === null || value === '';
|
|
168
|
+
if (present ? !blank : !create) continue;
|
|
169
|
+
next ??= { ...model };
|
|
170
|
+
next[key] = false;
|
|
171
|
+
}
|
|
172
|
+
return next ?? (model as Record<string, unknown>);
|
|
173
|
+
}
|
|
174
|
+
|
|
152
175
|
/** 按点分路径段读取(任一环节为空即返回 undefined) */
|
|
153
176
|
function readPath(root: unknown, segments: string[]): unknown {
|
|
154
177
|
let current: unknown = root;
|
|
@@ -674,8 +697,14 @@ export class SomaDataObjectResolver {
|
|
|
674
697
|
options: SomaSubmitOptions = {},
|
|
675
698
|
): Promise<SomaDataSubmitResult> {
|
|
676
699
|
const intent = options.intent ?? 'explicit';
|
|
677
|
-
const
|
|
678
|
-
const write =
|
|
700
|
+
const declared = this.config.objects[name];
|
|
701
|
+
const write = declared?.write;
|
|
702
|
+
// 布尔字段无论真假都显式提交:新建时缺席 / 空的布尔补 false,取消勾选的 false 与勾选的 true 原样上行;
|
|
703
|
+
// 发出去的就是显式化后的这份,不靠后端回落默认值。更新缺席 = 不改,不补
|
|
704
|
+
const sent = write !== undefined && declared?.fields !== undefined && isPlainObject(model)
|
|
705
|
+
? explicitBooleans(declared.fields, model, (mode ?? this.inferWriteMode(name, write)) === 'create')
|
|
706
|
+
: model;
|
|
707
|
+
const result = await this.submitRaw(name, sent, mode, options.identityField, options.signal);
|
|
679
708
|
if (!write) return result;
|
|
680
709
|
if (result.ok) return decorateSuccess(result, write, intent);
|
|
681
710
|
return decorateFailure(result, intent, { sentToken: readConcurrencyToken(model, write) });
|
|
@@ -871,11 +900,14 @@ export class SomaDataObjectResolver {
|
|
|
871
900
|
*/
|
|
872
901
|
mapSubmitError(error: unknown, write: SomaDataWriteConfig): Extract<SomaDataSubmitResult, { ok: false }> {
|
|
873
902
|
const payload = extractErrorPayload(error);
|
|
874
|
-
const
|
|
903
|
+
const raw = payload.message
|
|
875
904
|
?? (error instanceof Error ? error.message : '提交失败');
|
|
876
905
|
// 状态码(版本冲突 409 / 412 等):异常或响应上的 status,或 SomaHttpService 写进消息的 `HTTP 409: …`。
|
|
877
|
-
//
|
|
878
|
-
|
|
906
|
+
// 面向使用者的文案只留后端给的可读原因:`HTTP 409:` 前缀剥掉,状态码走结果的 `status` 字段(开发态诊断读它,界面不显示);
|
|
907
|
+
// 前缀后面没有原因时退到通用说法,不把状态码当文案
|
|
908
|
+
const http = splitHttpMessage(raw);
|
|
909
|
+
const message = http === null ? raw : (http.text !== '' ? http.text : '提交失败');
|
|
910
|
+
const status = commandStatusOf(error) ?? http?.status;
|
|
879
911
|
// 版本冲突带上服务端当前令牌与当前记录(取得不到就不带,调用方退回重读)
|
|
880
912
|
const conflict = status === 409 || status === 412 ? readConflictState(error, write) : {};
|
|
881
913
|
const withStatus = status === undefined ? { ...conflict } : { status, ...conflict };
|
|
@@ -1438,7 +1470,10 @@ export class SomaDataObjectResolver {
|
|
|
1438
1470
|
const params = this.resolveParams(source.params, selfName, selfValue);
|
|
1439
1471
|
// `$user.*` 解不出:不发请求,来源按空列表处理,诊断已写
|
|
1440
1472
|
if (params === null) return { skipped: false, data: [] };
|
|
1441
|
-
|
|
1473
|
+
const blank = (name: string): boolean => isRequiredParamBlank(params?.[name]);
|
|
1474
|
+
if (source.require?.some((entry) => (Array.isArray(entry) ? entry.every(blank) : blank(entry)))) {
|
|
1475
|
+
return { skipped: true };
|
|
1476
|
+
}
|
|
1442
1477
|
return { skipped: false, data: await this.requestSource(source, selfName, params) };
|
|
1443
1478
|
}
|
|
1444
1479
|
|
|
@@ -1449,7 +1484,7 @@ export class SomaDataObjectResolver {
|
|
|
1449
1484
|
): Promise<unknown> {
|
|
1450
1485
|
// 观测:整对象取数没有窗口,region 记对象名,window 记空窗口
|
|
1451
1486
|
try { this.onFetch?.({ region: selfName, object: selfName, window: { offset: 0, limit: 0 }, query: params ?? {} }); } catch { /* 观测异常不影响取数 */ }
|
|
1452
|
-
const request = this.http.get(source.api, params ? { params } :
|
|
1487
|
+
const request = this.http.get(source.api, params ? { params, silentErrorToast: true } : { silentErrorToast: true });
|
|
1453
1488
|
if (source.failWhen === undefined) return request;
|
|
1454
1489
|
return Promise.resolve(request).then((data) => {
|
|
1455
1490
|
const refusal = envelopeFailureOf(data, { failWhen: source.failWhen!, messagePath: source.messagePath }, '服务端拒绝了该请求');
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { recordMetric } from '../diagnostics/telemetry-context';
|
|
2
2
|
import type { IContainerAdapter } from '../container/IContainerAdapter';
|
|
3
3
|
import { SomaRowScope, readRowPath } from './row-scope';
|
|
4
|
+
import {
|
|
5
|
+
confirmContextOf,
|
|
6
|
+
resolveConfirmSpec,
|
|
7
|
+
warnConfirmMissing,
|
|
8
|
+
type SomaConfirmContext,
|
|
9
|
+
} from '../parser/confirm-spec';
|
|
4
10
|
import { SOMA_KEY_MODIFIERS } from '../../shared/types/keyboard.types';
|
|
5
11
|
import type { SomaDiagnostics } from '../diagnostics/SomaDiagnostics';
|
|
6
12
|
import { SomaMiddlewareChain } from '../middleware/SomaMiddlewareChain';
|
|
@@ -256,7 +262,15 @@ export class SomaEventEngine<TContext extends Record<string, unknown> = Record<s
|
|
|
256
262
|
return false;
|
|
257
263
|
};
|
|
258
264
|
if (!isCurrent()) return;
|
|
259
|
-
const preChecked = this.preCheck(
|
|
265
|
+
const preChecked = this.preCheck(
|
|
266
|
+
config,
|
|
267
|
+
config.somaId,
|
|
268
|
+
element,
|
|
269
|
+
confirmContextOf(
|
|
270
|
+
isSomaEmitEvent(originalEvent) ? originalEvent.payload : undefined,
|
|
271
|
+
rowContext instanceof SomaRowScope ? rowContext.data : undefined,
|
|
272
|
+
),
|
|
273
|
+
);
|
|
260
274
|
if (!(preChecked instanceof Promise ? await preChecked : preChecked)) {
|
|
261
275
|
runtime.status = 'blocked';
|
|
262
276
|
runtime.message = 'pre-check rejected';
|
|
@@ -591,13 +605,24 @@ export class SomaEventEngine<TContext extends Record<string, unknown> = Record<s
|
|
|
591
605
|
return this.adapter.confirm(spec.text);
|
|
592
606
|
}
|
|
593
607
|
|
|
594
|
-
private preCheck(
|
|
608
|
+
private preCheck(
|
|
609
|
+
config: SomaCompiledEvent,
|
|
610
|
+
somaId: string,
|
|
611
|
+
element: HTMLElement,
|
|
612
|
+
confirmContext: SomaConfirmContext,
|
|
613
|
+
): boolean | Promise<boolean> {
|
|
595
614
|
if (this.getContext(element) instanceof SomaRowScope ? this.pendingRows.has(element) : this.pendingSet.has(somaId)) {
|
|
596
615
|
return false;
|
|
597
616
|
}
|
|
598
617
|
|
|
599
618
|
if (config.confirm) {
|
|
600
|
-
|
|
619
|
+
// 确认文案占位(`{字段}` / `{n}`)在触发时代入:只替换 text / impact,permission / roles 顺序与确认级别不受影响
|
|
620
|
+
const spec = resolveConfirmSpec(
|
|
621
|
+
config.confirmSpec ?? { level: 'plain', text: config.confirm },
|
|
622
|
+
confirmContext,
|
|
623
|
+
(name) => warnConfirmMissing(name, `${somaId}.${config.domEvent}`),
|
|
624
|
+
);
|
|
625
|
+
return this.askConfirm(spec);
|
|
601
626
|
}
|
|
602
627
|
|
|
603
628
|
return true;
|
|
@@ -795,6 +795,7 @@ export class SomaBootstrap {
|
|
|
795
795
|
...(shortcutsDesign()?.sequenceTimeoutMs !== undefined ? { sequenceTimeoutMs: shortcutsDesign()!.sequenceTimeoutMs } : {}),
|
|
796
796
|
});
|
|
797
797
|
this.renderPorts = options.renderPorts;
|
|
798
|
+
if (options.renderPorts?.hideTransition) this.adapter.setHideTransition?.(options.renderPorts.hideTransition);
|
|
798
799
|
this.engines = options.engines ?? {};
|
|
799
800
|
this.localeOptions = options.locale ?? {};
|
|
800
801
|
this.preferredLocale = this.localeOptions.initial;
|
|
@@ -1630,7 +1631,7 @@ export class SomaBootstrap {
|
|
|
1630
1631
|
(fn as (u: string, b?: unknown) => Promise<T>).call(services.http, strip(url), body);
|
|
1631
1632
|
};
|
|
1632
1633
|
const http = {
|
|
1633
|
-
get: <T,>(url: string, requestConfig?: { params?: Record<string, string
|
|
1634
|
+
get: <T,>(url: string, requestConfig?: { params?: Record<string, string>; silentErrorToast?: boolean }) =>
|
|
1634
1635
|
services.http.get<T>(strip(url), requestConfig),
|
|
1635
1636
|
// 写通道(M-5):Host 的 http 没实现某个动词时留 undefined,
|
|
1636
1637
|
// resolver.submit 会给出「本 Host 的 http 不支持它」而不是静默失败
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { SomaEngineError } from '../../../shared/engines/engine-error';
|
|
6
6
|
import { loadEngineModule, type EngineLoadTelemetry } from '../load';
|
|
7
7
|
import { COMPONENT_LOADERS, SERIES_IMPLIED_COMPONENTS, SERIES_LOADERS } from './kind-modules';
|
|
8
|
-
import type { ChartInit, ChartInstance, ChartPointer, SomaChartAdapter } from './port';
|
|
8
|
+
import type { ChartColumn, ChartInit, ChartInstance, ChartPointer, SomaChartAdapter } from './port';
|
|
9
9
|
|
|
10
10
|
interface Rect { x: number; y: number; width: number; height: number; clone(): Rect; applyTransform(m: ArrayLike<number> | null): void }
|
|
11
11
|
interface GraphicEl { getBoundingRect(): Rect; getComputedTransform(): ArrayLike<number> | null }
|
|
@@ -18,7 +18,17 @@ interface EChartsInstance {
|
|
|
18
18
|
resize(opts?: { width: number; height: number }): void;
|
|
19
19
|
dispose(): void;
|
|
20
20
|
/** 公开于实例但文档称内部:用来取数据项的图元(假设项,见 §12) */
|
|
21
|
-
getModel(): {
|
|
21
|
+
getModel(): {
|
|
22
|
+
getSeriesByIndex(i: number): { getData(): { getItemGraphicEl(i: number): GraphicEl | undefined } } | undefined;
|
|
23
|
+
getComponent(type: string, index: number): unknown;
|
|
24
|
+
};
|
|
25
|
+
getZr(): {
|
|
26
|
+
on(event: string, handler: (e: { offsetX?: number; offsetY?: number }) => void): void;
|
|
27
|
+
off(event: string, handler: (e: { offsetX?: number; offsetY?: number }) => void): void;
|
|
28
|
+
};
|
|
29
|
+
containPixel(finder: Record<string, number>, value: number[]): boolean;
|
|
30
|
+
convertFromPixel(finder: Record<string, number>, value: number[]): number | number[];
|
|
31
|
+
convertToPixel(finder: Record<string, number>, value: number): number | number[];
|
|
22
32
|
}
|
|
23
33
|
interface EChartsCore {
|
|
24
34
|
init(host: HTMLElement, theme: unknown, opts: Record<string, unknown>): EChartsInstance;
|
|
@@ -132,6 +142,69 @@ export function createEChartsAdapter(adapterOptions: EChartsAdapterOptions = {})
|
|
|
132
142
|
chart.off('mouseout', onOut);
|
|
133
143
|
};
|
|
134
144
|
},
|
|
145
|
+
onColumn(handler): () => void {
|
|
146
|
+
// 按坐标轴换算所在列:第一个类目轴(优先 x 轴,其次 y 轴),不依赖系列图元,null 列与列间空白也命中
|
|
147
|
+
const zr = chart.getZr();
|
|
148
|
+
const axisOf = (): { dim: 'x' | 'y'; count: number } | null => {
|
|
149
|
+
const model = chart.getModel();
|
|
150
|
+
for (const dim of ['x', 'y'] as const) {
|
|
151
|
+
const axis = model.getComponent(`${dim}Axis`, 0) as { get(k: string): unknown; getCategories?(): unknown[] } | undefined;
|
|
152
|
+
if (axis !== undefined && axis.get('type') === 'category') {
|
|
153
|
+
// 类目来自系列数据时选项的 xAxis.data 为空(getCategories 只读选项里写的),实际类目在轴刻度的 ordinalMeta 里:优先读它
|
|
154
|
+
const scale = (axis as { axis?: { scale?: { getOrdinalMeta?(): { categories?: unknown[] } | undefined } } }).axis?.scale;
|
|
155
|
+
const metaCats = scale?.getOrdinalMeta?.()?.categories;
|
|
156
|
+
const cats = metaCats !== undefined && metaCats.length > 0 ? metaCats : (axis.getCategories?.() ?? []);
|
|
157
|
+
return { dim, count: cats.length };
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return null;
|
|
161
|
+
};
|
|
162
|
+
const columnAt = (x: number, y: number): ChartColumn | null => {
|
|
163
|
+
const axis = axisOf();
|
|
164
|
+
if (axis === null || axis.count === 0) return null;
|
|
165
|
+
if (!chart.containPixel({ gridIndex: 0 }, [x, y])) return null;
|
|
166
|
+
// 像素 → 数据:二维像素 [x, y] 必须配坐标系 finder(gridIndex)取回 [x 值, y 值];
|
|
167
|
+
// 配单轴 finder(xAxisIndex)时引擎期望的是标量像素,传数组得不到数值(实测列命中恒为 null、读数不随悬停变)
|
|
168
|
+
const raw = chart.convertFromPixel({ gridIndex: 0 }, [x, y]);
|
|
169
|
+
const v = Array.isArray(raw) ? raw[axis.dim === 'x' ? 0 : 1] : raw;
|
|
170
|
+
if (typeof v !== 'number' || !Number.isFinite(v)) return null;
|
|
171
|
+
const dataIndex = Math.min(axis.count - 1, Math.max(0, Math.round(v)));
|
|
172
|
+
return columnAnchor(dataIndex, axis.dim);
|
|
173
|
+
};
|
|
174
|
+
const columnAnchor = (dataIndex: number, dim: 'x' | 'y'): ChartColumn | null => {
|
|
175
|
+
const finder: Record<string, number> = dim === 'x' ? { xAxisIndex: 0 } : { yAxisIndex: 0 };
|
|
176
|
+
const px = chart.convertToPixel(finder, dataIndex);
|
|
177
|
+
const grid = chart.getModel().getComponent('grid', 0) as { coordinateSystem?: { getRect(): Rect } } | undefined;
|
|
178
|
+
const rect = grid?.coordinateSystem?.getRect();
|
|
179
|
+
const along = typeof px === 'number' ? px : Array.isArray(px) ? px[0] : NaN;
|
|
180
|
+
if (!Number.isFinite(along)) return null;
|
|
181
|
+
// 绘图区矩形取不到(引擎内部模型形状随版本变)时锚点的另一轴退到 0:列号才是命中的事实,锚点只用于对齐浮层
|
|
182
|
+
const anchor = dim === 'x' ? { x: along, y: rect?.y ?? 0 } : { x: rect?.x ?? 0, y: along };
|
|
183
|
+
return { dataIndex, anchor };
|
|
184
|
+
};
|
|
185
|
+
const read = (e: { offsetX?: number; offsetY?: number }): ChartColumn | null =>
|
|
186
|
+
typeof e.offsetX === 'number' && typeof e.offsetY === 'number' ? columnAt(e.offsetX, e.offsetY) : null;
|
|
187
|
+
const onMove = (e: { offsetX?: number; offsetY?: number }): void => {
|
|
188
|
+
const c = read(e);
|
|
189
|
+
handler(c === null ? 'leave' : 'hover', c);
|
|
190
|
+
};
|
|
191
|
+
const onClick = (e: { offsetX?: number; offsetY?: number }): void => {
|
|
192
|
+
const c = read(e);
|
|
193
|
+
if (c !== null) handler('click', c);
|
|
194
|
+
};
|
|
195
|
+
const onOut = (): void => handler('leave', null);
|
|
196
|
+
zr.on('mousemove', onMove);
|
|
197
|
+
zr.on('click', onClick);
|
|
198
|
+
zr.on('globalout', onOut);
|
|
199
|
+
let active = true;
|
|
200
|
+
return () => {
|
|
201
|
+
if (!active) return;
|
|
202
|
+
active = false;
|
|
203
|
+
zr.off('mousemove', onMove);
|
|
204
|
+
zr.off('click', onClick);
|
|
205
|
+
zr.off('globalout', onOut);
|
|
206
|
+
};
|
|
207
|
+
},
|
|
135
208
|
resize(): void {
|
|
136
209
|
chart.resize(size === undefined ? undefined : { width: size.width, height: size.height });
|
|
137
210
|
},
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// exports `./chart`:图表引擎端口。`createChartPort(adapter?)`:缺省 ECharts 6 适配器(SVG 渲染器,动态加载)。
|
|
2
2
|
// 入参校验(主题、option、销毁后调用)在 createChartPort 里做,换适配器也一样受约束。
|
|
3
3
|
export type {
|
|
4
|
+
ChartColumn,
|
|
4
5
|
ChartInit,
|
|
5
6
|
ChartInstance,
|
|
6
7
|
ChartPointer,
|
|
@@ -61,6 +62,23 @@ function guard(inner: ChartInstance): ChartInstance {
|
|
|
61
62
|
unsubs.add(wrapped);
|
|
62
63
|
return wrapped;
|
|
63
64
|
},
|
|
65
|
+
...(inner.onColumn === undefined
|
|
66
|
+
? {}
|
|
67
|
+
: {
|
|
68
|
+
onColumn(handler: Parameters<NonNullable<ChartInstance['onColumn']>>[0]) {
|
|
69
|
+
live();
|
|
70
|
+
const off = inner.onColumn!(handler);
|
|
71
|
+
let done = false;
|
|
72
|
+
const wrapped = (): void => {
|
|
73
|
+
if (done) return;
|
|
74
|
+
done = true;
|
|
75
|
+
unsubs.delete(wrapped);
|
|
76
|
+
off();
|
|
77
|
+
};
|
|
78
|
+
unsubs.add(wrapped);
|
|
79
|
+
return wrapped;
|
|
80
|
+
},
|
|
81
|
+
}),
|
|
64
82
|
resize(): void { live(); inner.resize(); },
|
|
65
83
|
dispose(): void {
|
|
66
84
|
if (disposed) return;
|
|
@@ -22,7 +22,20 @@ export interface ChartPointer {
|
|
|
22
22
|
readonly anchor: { readonly x: number; readonly y: number };
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
/** 指针 / 键盘所在的类目轴列;空值列、列间空白也能命中(与系列是否有图元无关) */
|
|
26
|
+
export interface ChartColumn {
|
|
27
|
+
/** 第一个类目轴上的列序号(与系列 data 下标一致) */
|
|
28
|
+
readonly dataIndex: number;
|
|
29
|
+
/** 该列在容器内的锚点像素(列中心、绘图区顶部) */
|
|
30
|
+
readonly anchor: { readonly x: number; readonly y: number };
|
|
31
|
+
}
|
|
32
|
+
|
|
25
33
|
export interface ChartInstance {
|
|
34
|
+
/**
|
|
35
|
+
* 指针在绘图区内移动 / 点击 / 离开时按坐标轴换算所在列;落在绘图区外按 leave 处理;无类目轴的图(饼、仪表等)不触发。
|
|
36
|
+
* 可选:旧适配器缺该方法时调用方回落到 `onPointer`(只有带图元的列可交互)。
|
|
37
|
+
*/
|
|
38
|
+
onColumn?(handler: (kind: 'hover' | 'click' | 'leave', col: ChartColumn | null) => void): () => void;
|
|
26
39
|
setOption(option: Readonly<Record<string, unknown>>, mode?: 'merge' | 'replace'): void;
|
|
27
40
|
/** 键盘漫游驱动 */
|
|
28
41
|
highlight(p: { seriesIndex: number; dataIndex: number } | null): void;
|
|
@@ -62,8 +62,8 @@ export class DefaultNotifyService implements INotifyService {
|
|
|
62
62
|
return this.renderer.confirm({
|
|
63
63
|
message: spec.text,
|
|
64
64
|
...(title === undefined ? {} : { title }),
|
|
65
|
-
// plain
|
|
66
|
-
...(spec.level === 'plain' ? {} : { spec }),
|
|
65
|
+
// plain 且无语气不带 spec:旧渲染器与旧测试看到的请求逐字不变
|
|
66
|
+
...(spec.level === 'plain' && spec.tone === undefined ? {} : { spec }),
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
return this.confirmResult;
|