@shwfed/config 2.3.28 → 2.4.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/dist/mcp.mjs +3128 -1272
- package/dist/module.json +1 -1
- package/dist/preview/assets/{config-CQHS6cZe.js → config-BcQQl4v6.js} +1 -1
- package/dist/preview/assets/{config-fvkC2rB8.js → config-BdFIFUa_.js} +1 -1
- package/dist/preview/assets/{config-DDfTl9Cs.js → config-Bi9F-Jdh.js} +1 -1
- package/dist/preview/assets/{config-CJHPt8Gx.js → config-Bxkq2ZRm.js} +1 -1
- package/dist/preview/assets/{config-D0_1yZdF.js → config-C32yfrlg.js} +1 -1
- package/dist/preview/assets/{config--PcXQV_r.js → config-CHHX7vhb.js} +1 -1
- package/dist/preview/assets/{config-5KVDXgUF.js → config-CZ0f5xdI.js} +1 -1
- package/dist/preview/assets/{config-B5avpKJE.js → config-D9xGgFnF.js} +1 -1
- package/dist/preview/assets/{config-CNo3isHa.js → config-Ddh8pxIi.js} +1 -1
- package/dist/preview/assets/{definition.vue_vue_type_script_setup_true_lang-RM-qDh0R.js → definition.vue_vue_type_script_setup_true_lang-C_cjxvm1.js} +1 -1
- package/dist/preview/assets/{index-a2QwAots.css → index-BqOX70Hd.css} +1 -1
- package/dist/preview/assets/index-D-VR1i8D.js +659 -0
- package/dist/preview/assets/index-ihZGlPdX.js +1 -0
- package/dist/preview/assets/{runtime-BPjZQmcY.js → runtime-Bn8mqeDH.js} +1 -1
- package/dist/preview/assets/{runtime-DcrzodsN.js → runtime-Cc_Wk3o-.js} +1 -1
- package/dist/preview/assets/{runtime-BGTWf-O7.js → runtime-CttAjIgg.js} +1 -1
- package/dist/preview/assets/{runtime-Dy4ZmQ-n.js → runtime-Cx4f2UTl.js} +1 -1
- package/dist/preview/assets/{runtime-CCbyrqQT.js → runtime-D1dESjXR.js} +1 -1
- package/dist/preview/assets/{runtime-C_XX6a0C.js → runtime-DIEP1Xbh.js} +1 -1
- package/dist/preview/assets/{runtime-CtqwtTE_.js → runtime-DKceWuBx.js} +1 -1
- package/dist/preview/assets/{runtime-Dr_10emf.js → runtime-Dhid9O5c.js} +1 -1
- package/dist/preview/assets/{runtime-Bq3fmxeF.js → runtime-YMiqi6WY.js} +1 -1
- package/dist/preview/index.html +2 -2
- package/dist/runtime/components/block-layout-editor/index.d.vue.ts +10 -2
- package/dist/runtime/components/block-layout-editor/index.vue +44 -8
- package/dist/runtime/components/block-layout-editor/index.vue.d.ts +10 -2
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.form/config.d.vue.ts +2 -0
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.form/config.vue.d.ts +2 -0
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.form/runtime.d.vue.ts +2 -0
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.form/runtime.vue.d.ts +2 -0
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.form/schema.d.ts +2 -0
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/config.d.vue.ts +2 -0
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/config.vue.d.ts +2 -0
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/runtime.d.vue.ts +2 -0
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/runtime.vue.d.ts +2 -0
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/schema.d.ts +3 -0
- package/dist/runtime/components/config/config.vue +35 -0
- package/dist/runtime/components/config/use-editor.d.ts +11 -1
- package/dist/runtime/components/config/use-editor.js +27 -1
- package/dist/runtime/components/form/config.vue +32 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.multi/config.d.vue.ts +163 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.multi/config.vue +745 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.multi/config.vue.d.ts +163 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.multi/runtime.d.vue.ts +8 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.multi/runtime.vue +383 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.multi/runtime.vue.d.ts +8 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.multi/schema.d.ts +264 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.multi/schema.js +183 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.single/config.d.vue.ts +163 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.single/config.vue +745 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.single/config.vue.d.ts +163 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.single/runtime.d.vue.ts +8 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.single/runtime.vue +402 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.single/runtime.vue.d.ts +8 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.single/schema.d.ts +264 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.single/schema.js +209 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/config.d.vue.ts +129 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/config.vue +618 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/config.vue.d.ts +129 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/runtime.d.vue.ts +8 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/runtime.vue +501 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/runtime.vue.d.ts +8 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/schema.d.ts +99 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/schema.js +133 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/config.d.vue.ts +127 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/config.vue +550 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/config.vue.d.ts +127 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/runtime.d.vue.ts +8 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/runtime.vue +496 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/runtime.vue.d.ts +8 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/schema.d.ts +96 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/schema.js +125 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/config.d.vue.ts +133 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/config.vue +605 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/config.vue.d.ts +133 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/runtime.d.vue.ts +8 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/runtime.vue +401 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/runtime.vue.d.ts +8 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/schema.d.ts +102 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/schema.js +142 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/config.d.vue.ts +131 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/config.vue +560 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/config.vue.d.ts +131 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/runtime.d.vue.ts +8 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/runtime.vue +395 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/runtime.vue.d.ts +8 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/schema.d.ts +96 -0
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/schema.js +118 -0
- package/dist/runtime/components/form/fields/2026-05-28/tree-combobox-shared.d.ts +35 -0
- package/dist/runtime/components/form/fields/2026-05-28/tree-combobox-shared.js +31 -0
- package/dist/runtime/components/form/index.vue +7 -5
- package/dist/runtime/components/form/schema.d.ts +4 -0
- package/dist/runtime/components/form/schema.js +4 -0
- package/dist/runtime/components/form/unit-config.vue +45 -1
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.select/config.vue +0 -22
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.select/header.vue +3 -15
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.select/schema.d.ts +0 -1
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.select/schema.js +0 -4
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/config.d.vue.ts +183 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/config.vue +931 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/config.vue.d.ts +183 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/runtime.d.vue.ts +9 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/runtime.vue +463 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/runtime.vue.d.ts +9 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/schema.d.ts +283 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/schema.js +275 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.d.vue.ts +183 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.vue +931 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.vue.d.ts +183 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/runtime.d.vue.ts +9 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/runtime.vue +414 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/runtime.vue.d.ts +9 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/schema.d.ts +283 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/schema.js +275 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/config.d.vue.ts +133 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/config.vue +632 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/config.vue.d.ts +133 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/runtime.d.vue.ts +9 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/runtime.vue +461 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/runtime.vue.d.ts +9 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/schema.d.ts +93 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/schema.js +161 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/config.d.vue.ts +131 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/config.vue +563 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/config.vue.d.ts +131 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/runtime.d.vue.ts +9 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/runtime.vue +443 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/runtime.vue.d.ts +9 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/schema.d.ts +90 -0
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/schema.js +153 -0
- package/dist/runtime/components/table/columns/2026-05-28/tree-combobox-shared.d.ts +35 -0
- package/dist/runtime/components/table/columns/2026-05-28/tree-combobox-shared.js +31 -0
- package/dist/runtime/components/table/config.vue +55 -82
- package/dist/runtime/components/table/schema.d.ts +4 -0
- package/dist/runtime/components/ui/command/CommandItem.d.vue.ts +7 -0
- package/dist/runtime/components/ui/command/CommandItem.vue +13 -4
- package/dist/runtime/components/ui/command/CommandItem.vue.d.ts +7 -0
- package/dist/runtime/share/clipboard.d.ts +26 -0
- package/dist/runtime/share/clipboard.js +82 -0
- package/dist/runtime/share/layout.d.ts +4 -0
- package/dist/runtime/share/layout.js +35 -0
- package/package.json +1 -1
- package/dist/preview/assets/index-DNd8J9Zv.js +0 -643
- package/dist/preview/assets/index-DrIMqXAa.js +0 -1
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
|
+
import type { ColumnDef } from '@tanstack/vue-table';
|
|
3
|
+
import type { Environment } from '../../../../../vendor/cel-js/lib/index.js';
|
|
4
|
+
import type { ColumnDefDeps, MigrateFn, MigrateSource } from '../../../utils/resolve.js';
|
|
5
|
+
export declare const type: "com.shwfed.table.column.combobox-single";
|
|
6
|
+
export declare const compatibilityDate: "2026-05-28";
|
|
7
|
+
export declare const metadata: {
|
|
8
|
+
readonly name: "单选";
|
|
9
|
+
readonly icon: "fluent:chevron-down-20-regular";
|
|
10
|
+
};
|
|
11
|
+
export declare function itemSchema(configure: (env: Environment) => void): Schema.Struct<{
|
|
12
|
+
id: Schema.refine<string, typeof Schema.String>;
|
|
13
|
+
label: Schema.refine<readonly [{
|
|
14
|
+
readonly locale: "zh";
|
|
15
|
+
readonly message: string;
|
|
16
|
+
}, ...{
|
|
17
|
+
readonly locale: "en" | "ja" | "ko";
|
|
18
|
+
readonly message: string;
|
|
19
|
+
}[]], Schema.TupleType<readonly [Schema.Struct<{
|
|
20
|
+
locale: Schema.Literal<["zh"]>;
|
|
21
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
22
|
+
}>], [Schema.Struct<{
|
|
23
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
24
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
25
|
+
}>]>>;
|
|
26
|
+
value: Schema.Union<[Schema.Struct<{
|
|
27
|
+
kind: Schema.Literal<["text"]>;
|
|
28
|
+
value: typeof Schema.String;
|
|
29
|
+
}>, Schema.Struct<{
|
|
30
|
+
kind: Schema.Literal<["number"]>;
|
|
31
|
+
value: typeof Schema.Number;
|
|
32
|
+
}>]>;
|
|
33
|
+
tooltip: Schema.optional<Schema.refine<readonly [{
|
|
34
|
+
readonly locale: "zh";
|
|
35
|
+
readonly message: string;
|
|
36
|
+
}, ...{
|
|
37
|
+
readonly locale: "en" | "ja" | "ko";
|
|
38
|
+
readonly message: string;
|
|
39
|
+
}[]], Schema.TupleType<readonly [Schema.Struct<{
|
|
40
|
+
locale: Schema.Literal<["zh"]>;
|
|
41
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
42
|
+
}>], [Schema.Struct<{
|
|
43
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
44
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
45
|
+
}>]>>>;
|
|
46
|
+
keywords: Schema.optional<Schema.Array$<typeof Schema.String>>;
|
|
47
|
+
}>;
|
|
48
|
+
export declare function remoteOptionsSchema(configure: (env: Environment) => void): Schema.Struct<{
|
|
49
|
+
kind: Schema.Literal<["remote"]>;
|
|
50
|
+
request: Schema.Schema<string, string, never>;
|
|
51
|
+
options: Schema.Schema<string, string, never>;
|
|
52
|
+
optionValue: Schema.optionalWith<Schema.Schema<string, string, never>, {
|
|
53
|
+
default: () => string;
|
|
54
|
+
}>;
|
|
55
|
+
optionLabel: Schema.optionalWith<Schema.refine<readonly [{
|
|
56
|
+
readonly locale: "zh";
|
|
57
|
+
readonly message: string;
|
|
58
|
+
}, ...{
|
|
59
|
+
readonly locale: "en" | "ja" | "ko";
|
|
60
|
+
readonly message: string;
|
|
61
|
+
}[]], Schema.TupleType<readonly [Schema.Struct<{
|
|
62
|
+
locale: Schema.Literal<["zh"]>;
|
|
63
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
64
|
+
}>], [Schema.Struct<{
|
|
65
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
66
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
67
|
+
}>]>>, {
|
|
68
|
+
default: () => readonly [{
|
|
69
|
+
readonly locale: "zh";
|
|
70
|
+
readonly message: "";
|
|
71
|
+
}];
|
|
72
|
+
}>;
|
|
73
|
+
optionKeywords: Schema.optional<Schema.Schema<string, string, never>>;
|
|
74
|
+
}>;
|
|
75
|
+
export declare function optionsSchema(configure: (env: Environment) => void): Schema.Union<[Schema.Struct<{
|
|
76
|
+
kind: Schema.Literal<["static"]>;
|
|
77
|
+
items: Schema.optionalWith<Schema.Array$<Schema.Struct<{
|
|
78
|
+
id: Schema.refine<string, typeof Schema.String>;
|
|
79
|
+
label: Schema.refine<readonly [{
|
|
80
|
+
readonly locale: "zh";
|
|
81
|
+
readonly message: string;
|
|
82
|
+
}, ...{
|
|
83
|
+
readonly locale: "en" | "ja" | "ko";
|
|
84
|
+
readonly message: string;
|
|
85
|
+
}[]], Schema.TupleType<readonly [Schema.Struct<{
|
|
86
|
+
locale: Schema.Literal<["zh"]>;
|
|
87
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
88
|
+
}>], [Schema.Struct<{
|
|
89
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
90
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
91
|
+
}>]>>;
|
|
92
|
+
value: Schema.Union<[Schema.Struct<{
|
|
93
|
+
kind: Schema.Literal<["text"]>;
|
|
94
|
+
value: typeof Schema.String;
|
|
95
|
+
}>, Schema.Struct<{
|
|
96
|
+
kind: Schema.Literal<["number"]>;
|
|
97
|
+
value: typeof Schema.Number;
|
|
98
|
+
}>]>;
|
|
99
|
+
tooltip: Schema.optional<Schema.refine<readonly [{
|
|
100
|
+
readonly locale: "zh";
|
|
101
|
+
readonly message: string;
|
|
102
|
+
}, ...{
|
|
103
|
+
readonly locale: "en" | "ja" | "ko";
|
|
104
|
+
readonly message: string;
|
|
105
|
+
}[]], Schema.TupleType<readonly [Schema.Struct<{
|
|
106
|
+
locale: Schema.Literal<["zh"]>;
|
|
107
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
108
|
+
}>], [Schema.Struct<{
|
|
109
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
110
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
111
|
+
}>]>>>;
|
|
112
|
+
keywords: Schema.optional<Schema.Array$<typeof Schema.String>>;
|
|
113
|
+
}>>, {
|
|
114
|
+
default: () => readonly [];
|
|
115
|
+
}>;
|
|
116
|
+
}>, Schema.Struct<{
|
|
117
|
+
kind: Schema.Literal<["remote"]>;
|
|
118
|
+
request: Schema.Schema<string, string, never>;
|
|
119
|
+
options: Schema.Schema<string, string, never>;
|
|
120
|
+
optionValue: Schema.optionalWith<Schema.Schema<string, string, never>, {
|
|
121
|
+
default: () => string;
|
|
122
|
+
}>;
|
|
123
|
+
optionLabel: Schema.optionalWith<Schema.refine<readonly [{
|
|
124
|
+
readonly locale: "zh";
|
|
125
|
+
readonly message: string;
|
|
126
|
+
}, ...{
|
|
127
|
+
readonly locale: "en" | "ja" | "ko";
|
|
128
|
+
readonly message: string;
|
|
129
|
+
}[]], Schema.TupleType<readonly [Schema.Struct<{
|
|
130
|
+
locale: Schema.Literal<["zh"]>;
|
|
131
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
132
|
+
}>], [Schema.Struct<{
|
|
133
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
134
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
135
|
+
}>]>>, {
|
|
136
|
+
default: () => readonly [{
|
|
137
|
+
readonly locale: "zh";
|
|
138
|
+
readonly message: "";
|
|
139
|
+
}];
|
|
140
|
+
}>;
|
|
141
|
+
optionKeywords: Schema.optional<Schema.Schema<string, string, never>>;
|
|
142
|
+
}>]>;
|
|
143
|
+
export declare function writeSchema(configure: (env: Environment) => void): Schema.Union<[Schema.Struct<{
|
|
144
|
+
kind: Schema.Literal<["binding"]>;
|
|
145
|
+
binding: Schema.SchemaClass<string, string, never>;
|
|
146
|
+
}>, Schema.Struct<{
|
|
147
|
+
kind: Schema.Literal<["remote"]>;
|
|
148
|
+
accessor: Schema.Schema<string, string, never>;
|
|
149
|
+
onChange: Schema.optional<Schema.Schema<string, string, never>>;
|
|
150
|
+
successMessage: Schema.optional<Schema.Schema<string, string, never>>;
|
|
151
|
+
triggers: Schema.optional<Schema.Array$<Schema.Struct<{
|
|
152
|
+
target: Schema.refine<string, typeof Schema.String>;
|
|
153
|
+
operation: Schema.SchemaClass<string, string, never>;
|
|
154
|
+
}>>>;
|
|
155
|
+
}>]>;
|
|
156
|
+
export declare function schema(configure: (env: Environment) => void): Schema.Struct<{
|
|
157
|
+
title: Schema.TupleType<readonly [Schema.Struct<{
|
|
158
|
+
locale: Schema.Literal<["zh"]>;
|
|
159
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
160
|
+
}>], [Schema.Struct<{
|
|
161
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
162
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
163
|
+
}>]>;
|
|
164
|
+
placeholder: Schema.optional<Schema.TupleType<readonly [Schema.Struct<{
|
|
165
|
+
locale: Schema.Literal<["zh"]>;
|
|
166
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
167
|
+
}>], [Schema.Struct<{
|
|
168
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
169
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
170
|
+
}>]>>;
|
|
171
|
+
hidden: Schema.optional<Schema.Schema<string, string, never>>;
|
|
172
|
+
disabled: Schema.optional<Schema.Schema<string, string, never>>;
|
|
173
|
+
readonly: Schema.optional<Schema.Schema<string, string, never>>;
|
|
174
|
+
enableSorting: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
|
|
175
|
+
size: Schema.optional<Schema.refine<number, Schema.filter<typeof Schema.Number>>>;
|
|
176
|
+
grow: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
|
|
177
|
+
tooltip: Schema.optional<Schema.TupleType<readonly [Schema.Struct<{
|
|
178
|
+
locale: Schema.Literal<["zh"]>;
|
|
179
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
180
|
+
}>], [Schema.Struct<{
|
|
181
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
182
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
183
|
+
}>]>>;
|
|
184
|
+
options: Schema.optionalWith<Schema.Union<[Schema.Struct<{
|
|
185
|
+
kind: Schema.Literal<["static"]>;
|
|
186
|
+
items: Schema.optionalWith<Schema.Array$<Schema.Struct<{
|
|
187
|
+
id: Schema.refine<string, typeof Schema.String>;
|
|
188
|
+
label: Schema.refine<readonly [{
|
|
189
|
+
readonly locale: "zh";
|
|
190
|
+
readonly message: string;
|
|
191
|
+
}, ...{
|
|
192
|
+
readonly locale: "en" | "ja" | "ko";
|
|
193
|
+
readonly message: string;
|
|
194
|
+
}[]], Schema.TupleType<readonly [Schema.Struct<{
|
|
195
|
+
locale: Schema.Literal<["zh"]>;
|
|
196
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
197
|
+
}>], [Schema.Struct<{
|
|
198
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
199
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
200
|
+
}>]>>;
|
|
201
|
+
value: Schema.Union<[Schema.Struct<{
|
|
202
|
+
kind: Schema.Literal<["text"]>;
|
|
203
|
+
value: typeof Schema.String;
|
|
204
|
+
}>, Schema.Struct<{
|
|
205
|
+
kind: Schema.Literal<["number"]>;
|
|
206
|
+
value: typeof Schema.Number;
|
|
207
|
+
}>]>;
|
|
208
|
+
tooltip: Schema.optional<Schema.refine<readonly [{
|
|
209
|
+
readonly locale: "zh";
|
|
210
|
+
readonly message: string;
|
|
211
|
+
}, ...{
|
|
212
|
+
readonly locale: "en" | "ja" | "ko";
|
|
213
|
+
readonly message: string;
|
|
214
|
+
}[]], Schema.TupleType<readonly [Schema.Struct<{
|
|
215
|
+
locale: Schema.Literal<["zh"]>;
|
|
216
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
217
|
+
}>], [Schema.Struct<{
|
|
218
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
219
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
220
|
+
}>]>>>;
|
|
221
|
+
keywords: Schema.optional<Schema.Array$<typeof Schema.String>>;
|
|
222
|
+
}>>, {
|
|
223
|
+
default: () => readonly [];
|
|
224
|
+
}>;
|
|
225
|
+
}>, Schema.Struct<{
|
|
226
|
+
kind: Schema.Literal<["remote"]>;
|
|
227
|
+
request: Schema.Schema<string, string, never>;
|
|
228
|
+
options: Schema.Schema<string, string, never>;
|
|
229
|
+
optionValue: Schema.optionalWith<Schema.Schema<string, string, never>, {
|
|
230
|
+
default: () => string;
|
|
231
|
+
}>;
|
|
232
|
+
optionLabel: Schema.optionalWith<Schema.refine<readonly [{
|
|
233
|
+
readonly locale: "zh";
|
|
234
|
+
readonly message: string;
|
|
235
|
+
}, ...{
|
|
236
|
+
readonly locale: "en" | "ja" | "ko";
|
|
237
|
+
readonly message: string;
|
|
238
|
+
}[]], Schema.TupleType<readonly [Schema.Struct<{
|
|
239
|
+
locale: Schema.Literal<["zh"]>;
|
|
240
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
241
|
+
}>], [Schema.Struct<{
|
|
242
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
243
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
244
|
+
}>]>>, {
|
|
245
|
+
default: () => readonly [{
|
|
246
|
+
readonly locale: "zh";
|
|
247
|
+
readonly message: "";
|
|
248
|
+
}];
|
|
249
|
+
}>;
|
|
250
|
+
optionKeywords: Schema.optional<Schema.Schema<string, string, never>>;
|
|
251
|
+
}>]>, {
|
|
252
|
+
default: () => {
|
|
253
|
+
kind: "static";
|
|
254
|
+
items: readonly [];
|
|
255
|
+
};
|
|
256
|
+
}>;
|
|
257
|
+
write: Schema.optionalWith<Schema.Union<[Schema.Struct<{
|
|
258
|
+
kind: Schema.Literal<["binding"]>;
|
|
259
|
+
binding: Schema.SchemaClass<string, string, never>;
|
|
260
|
+
}>, Schema.Struct<{
|
|
261
|
+
kind: Schema.Literal<["remote"]>;
|
|
262
|
+
accessor: Schema.Schema<string, string, never>;
|
|
263
|
+
onChange: Schema.optional<Schema.Schema<string, string, never>>;
|
|
264
|
+
successMessage: Schema.optional<Schema.Schema<string, string, never>>;
|
|
265
|
+
triggers: Schema.optional<Schema.Array$<Schema.Struct<{
|
|
266
|
+
target: Schema.refine<string, typeof Schema.String>;
|
|
267
|
+
operation: Schema.SchemaClass<string, string, never>;
|
|
268
|
+
}>>>;
|
|
269
|
+
}>]>, {
|
|
270
|
+
default: () => {
|
|
271
|
+
kind: "binding";
|
|
272
|
+
binding: string;
|
|
273
|
+
};
|
|
274
|
+
}>;
|
|
275
|
+
id: Schema.refine<string, typeof Schema.String>;
|
|
276
|
+
groupId: Schema.optional<typeof Schema.UUID>;
|
|
277
|
+
type: Schema.Literal<["com.shwfed.table.column.combobox-single"]>;
|
|
278
|
+
compatibilityDate: Schema.Literal<["2026-05-28"]>;
|
|
279
|
+
}>;
|
|
280
|
+
export type Value = Schema.Schema.Type<ReturnType<typeof schema>>;
|
|
281
|
+
export declare const migrateFrom: ReadonlyArray<MigrateSource>;
|
|
282
|
+
export declare const migrate: MigrateFn;
|
|
283
|
+
export declare function toColumnDef(value: Value, { getLocaleText, $cel, inheritedContext }: ColumnDefDeps): Partial<ColumnDef<unknown, unknown>>;
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
|
+
import { getProperty } from "dot-prop";
|
|
3
|
+
import { Expression, LocaleMarkdown } from "../../../../../share/expression.js";
|
|
4
|
+
import { Locale } from "../../../../../share/locale.js";
|
|
5
|
+
import { Triggers } from "../../../../../share/event-bus.js";
|
|
6
|
+
import {
|
|
7
|
+
CelRowAccess,
|
|
8
|
+
columnFields,
|
|
9
|
+
columnIdentityFields,
|
|
10
|
+
editableHeader,
|
|
11
|
+
LocaleMarkdownWithRow,
|
|
12
|
+
registerRowVariablesIfAbsent
|
|
13
|
+
} from "../../../utils/shared.js";
|
|
14
|
+
export const type = "com.shwfed.table.column.combobox-single";
|
|
15
|
+
export const compatibilityDate = "2026-05-28";
|
|
16
|
+
export const metadata = {
|
|
17
|
+
name: "\u5355\u9009",
|
|
18
|
+
icon: "fluent:chevron-down-20-regular"
|
|
19
|
+
};
|
|
20
|
+
const isListType = (actual) => actual === "dyn" || actual.startsWith("list");
|
|
21
|
+
const isKeywordsType = (actual) => actual === "dyn" || actual.startsWith("list") || actual.startsWith("optional");
|
|
22
|
+
export function itemSchema(configure) {
|
|
23
|
+
const LocaleMd = LocaleMarkdownWithRow(configure);
|
|
24
|
+
const TextValue = Schema.Struct({
|
|
25
|
+
kind: Schema.Literal("text"),
|
|
26
|
+
value: Schema.String
|
|
27
|
+
});
|
|
28
|
+
const NumberValue = Schema.Struct({
|
|
29
|
+
kind: Schema.Literal("number"),
|
|
30
|
+
value: Schema.Number
|
|
31
|
+
});
|
|
32
|
+
const ItemValue = Schema.Union(TextValue, NumberValue).annotations({
|
|
33
|
+
title: "\u503C",
|
|
34
|
+
description: "\u9009\u9879\u7ED1\u5B9A\u7684\u503C\uFF0C\u53EF\u4EE5\u662F\u6587\u672C\u6216\u6570\u5B57"
|
|
35
|
+
});
|
|
36
|
+
return Schema.Struct({
|
|
37
|
+
id: Schema.UUID.annotations({ description: "\u9009\u9879\u552F\u4E00\u6807\u8BC6\uFF0C\u7528\u4E8E\u7A33\u5B9A\u7684 v-for key" }),
|
|
38
|
+
label: LocaleMd.annotations({
|
|
39
|
+
title: "\u6807\u7B7E",
|
|
40
|
+
description: "\u9009\u9879\u5C55\u793A\u7684\u672C\u5730\u5316\u6587\u672C\uFF0C\u652F\u6301 Markdown \u4E0E `{{ row.foo }}` / `{{ form.bar }}` \u63D2\u503C"
|
|
41
|
+
}),
|
|
42
|
+
value: ItemValue,
|
|
43
|
+
tooltip: Schema.optional(LocaleMd.annotations({
|
|
44
|
+
title: "\u63D0\u793A",
|
|
45
|
+
description: "\u9F20\u6807\u60AC\u505C\u5728\u9009\u9879\u4E0A\u65F6\u5C55\u793A\u7684\u672C\u5730\u5316\u63D0\u793A\uFF0C\u652F\u6301 Markdown"
|
|
46
|
+
})),
|
|
47
|
+
keywords: Schema.optional(Schema.Array(Schema.String).annotations({
|
|
48
|
+
title: "\u5173\u952E\u8BCD",
|
|
49
|
+
description: "\u9664\u6807\u7B7E\u5916\u53EF\u53C2\u4E0E\u641C\u7D22\u5339\u914D\u7684\u989D\u5916\u5173\u952E\u8BCD\uFF1B\u7528\u4E8E\u8BA9\u9009\u9879\u547D\u4E2D\u6807\u7B7E\u672A\u5C55\u793A\u7684\u522B\u540D / \u4EE3\u53F7"
|
|
50
|
+
}))
|
|
51
|
+
}).annotations({
|
|
52
|
+
title: "ComboboxSingleItem"
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
export function remoteOptionsSchema(configure) {
|
|
56
|
+
const CelRequest = Expression({
|
|
57
|
+
configure: (env) => {
|
|
58
|
+
configure(env);
|
|
59
|
+
registerRowVariablesIfAbsent(env);
|
|
60
|
+
},
|
|
61
|
+
resultType: "HttpRequest"
|
|
62
|
+
});
|
|
63
|
+
const CelOptions = Expression({
|
|
64
|
+
configure: (env) => {
|
|
65
|
+
configure(env);
|
|
66
|
+
registerRowVariablesIfAbsent(env);
|
|
67
|
+
env.registerVariable("json", "dyn", { description: "HTTP \u54CD\u5E94\u4F53\uFF08\u5DF2\u89E3\u6790 JSON\uFF09\uFF1B\u8BF7\u6C42\u5931\u8D25\u6216\u5C1A\u672A\u5B8C\u6210\u65F6\u4E3A `null`" });
|
|
68
|
+
},
|
|
69
|
+
resultType: isListType
|
|
70
|
+
});
|
|
71
|
+
const CelOptionValue = Expression({
|
|
72
|
+
configure: (env) => {
|
|
73
|
+
configure(env);
|
|
74
|
+
registerRowVariablesIfAbsent(env);
|
|
75
|
+
env.registerVariable("option", "dyn", { description: "`\u9009\u9879` \u8868\u8FBE\u5F0F\u4EA7\u51FA\u7684\u6570\u7EC4\u4E2D\u8FED\u4EE3\u5230\u7684\u5355\u4E2A\u5143\u7D20" });
|
|
76
|
+
},
|
|
77
|
+
resultType: "dyn"
|
|
78
|
+
});
|
|
79
|
+
const LocaleOptionLabel = LocaleMarkdown({
|
|
80
|
+
configure: (env) => {
|
|
81
|
+
configure(env);
|
|
82
|
+
registerRowVariablesIfAbsent(env);
|
|
83
|
+
env.registerVariable("option", "dyn", { description: "`\u9009\u9879` \u8868\u8FBE\u5F0F\u4EA7\u51FA\u7684\u6570\u7EC4\u4E2D\u8FED\u4EE3\u5230\u7684\u5355\u4E2A\u5143\u7D20" });
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
const CelOptionKeywords = Expression({
|
|
87
|
+
configure: (env) => {
|
|
88
|
+
configure(env);
|
|
89
|
+
registerRowVariablesIfAbsent(env);
|
|
90
|
+
env.registerVariable("option", "dyn", { description: "`\u9009\u9879` \u8868\u8FBE\u5F0F\u4EA7\u51FA\u7684\u6570\u7EC4\u4E2D\u8FED\u4EE3\u5230\u7684\u5355\u4E2A\u5143\u7D20" });
|
|
91
|
+
},
|
|
92
|
+
resultType: isKeywordsType
|
|
93
|
+
});
|
|
94
|
+
return Schema.Struct({
|
|
95
|
+
kind: Schema.Literal("remote"),
|
|
96
|
+
request: CelRequest.annotations({
|
|
97
|
+
title: "\u8BF7\u6C42",
|
|
98
|
+
description: "\u8FD4\u56DE `HttpRequest` \u7684 CEL \u8868\u8FBE\u5F0F\uFF1B\u53EF\u8BBF\u95EE `row` \u4E0E `index`\u3002\u76F8\u540C\u7B7E\u540D\u7684\u8BF7\u6C42\u4F1A\u5728\u8BE5\u8868\u683C\u5185\u81EA\u52A8\u53BB\u91CD"
|
|
99
|
+
}),
|
|
100
|
+
options: CelOptions.annotations({
|
|
101
|
+
title: "\u9009\u9879",
|
|
102
|
+
description: "\u4ECE HTTP \u54CD\u5E94\u4F53\u63D0\u53D6\u9009\u9879\u6570\u7EC4\u7684 CEL \u8868\u8FBE\u5F0F\uFF1B\u53EF\u8BBF\u95EE `row`\u3001`index` \u4E0E `json`\u3002\u4F8B\uFF1A`json.data`"
|
|
103
|
+
}),
|
|
104
|
+
optionValue: Schema.optionalWith(CelOptionValue.annotations({
|
|
105
|
+
title: "\u9009\u9879\u503C",
|
|
106
|
+
description: "\u4ECE\u5F53\u524D `option` \u63D0\u53D6\u5199\u5165\u503C\u7684 CEL\uFF1B\u4F8B\uFF1A`option.value`"
|
|
107
|
+
}), { default: () => "option" }),
|
|
108
|
+
optionLabel: Schema.optionalWith(LocaleOptionLabel.annotations({
|
|
109
|
+
title: "\u9009\u9879\u6807\u7B7E",
|
|
110
|
+
description: "\u6BCF\u4E2A\u9009\u9879\u5C55\u793A\u7684\u672C\u5730\u5316\u6587\u672C\uFF0C\u652F\u6301 `{{ string(option.foo) }}` \u63D2\u503C"
|
|
111
|
+
}), { default: () => [{ locale: "zh", message: "" }] }),
|
|
112
|
+
optionKeywords: Schema.optional(CelOptionKeywords.annotations({
|
|
113
|
+
title: "\u5173\u952E\u8BCD",
|
|
114
|
+
description: "\u4ECE\u5F53\u524D `option` \u63D0\u53D6\u989D\u5916\u641C\u7D22\u5173\u952E\u8BCD\u7684 CEL\uFF0C\u8FD4\u56DE\u5B57\u7B26\u4E32\u5217\u8868\uFF1B\u7528\u4E8E\u8BA9\u9009\u9879\u547D\u4E2D\u6807\u7B7E\u672A\u5C55\u793A\u7684\u522B\u540D / \u4EE3\u53F7\u3002\u4F8B\uFF1A`option.aliases`"
|
|
115
|
+
}))
|
|
116
|
+
}).annotations({ title: "ComboboxSingleOptionsRemote", description: "\u8FDC\u7A0B\u52A0\u8F7D\u7684\u9009\u9879\u5217\u8868" });
|
|
117
|
+
}
|
|
118
|
+
export function optionsSchema(configure) {
|
|
119
|
+
const Item = itemSchema(configure);
|
|
120
|
+
const StaticSpec = Schema.Struct({
|
|
121
|
+
kind: Schema.Literal("static"),
|
|
122
|
+
items: Schema.optionalWith(Schema.Array(Item).annotations({
|
|
123
|
+
title: "\u9009\u9879",
|
|
124
|
+
description: "\u4E0B\u62C9\u6846\u53EF\u9009\u9879\u5217\u8868"
|
|
125
|
+
}), { default: () => [] })
|
|
126
|
+
}).annotations({ title: "ComboboxSingleOptionsStatic", description: "\u9759\u6001\u914D\u7F6E\u7684\u9009\u9879\u5217\u8868" });
|
|
127
|
+
const RemoteSpec = remoteOptionsSchema(configure);
|
|
128
|
+
return Schema.Union(StaticSpec, RemoteSpec).annotations({
|
|
129
|
+
title: "\u9009\u9879\u6765\u6E90",
|
|
130
|
+
description: '\u9009\u9879\u53EF\u4EE5\u662F\u9759\u6001\u914D\u7F6E\uFF08`kind: "static"`\uFF09\u6216\u7531\u8FDC\u7A0B\u63A5\u53E3\u52A0\u8F7D\uFF08`kind: "remote"`\uFF09'
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
export function writeSchema(configure) {
|
|
134
|
+
const CelOnChange = Expression({
|
|
135
|
+
configure: (env) => {
|
|
136
|
+
configure(env);
|
|
137
|
+
registerRowVariablesIfAbsent(env);
|
|
138
|
+
env.registerVariable("value", "dyn", { description: "\u7528\u6237\u9009\u4E2D\u7684\u65B0\u503C\uFF08\u4E0E\u6240\u9009\u9879\u7684 `value` \u4E00\u81F4\uFF1B\u6E05\u7A7A\u65F6\u4E3A `null`\uFF09" });
|
|
139
|
+
},
|
|
140
|
+
resultType: "HttpRequest"
|
|
141
|
+
});
|
|
142
|
+
const CelMessage = Expression({
|
|
143
|
+
configure: (env) => {
|
|
144
|
+
configure(env);
|
|
145
|
+
env.registerVariable("json", "dyn", { description: "HTTP \u54CD\u5E94\u4F53\uFF08\u5DF2\u89E3\u6790 JSON\uFF09" });
|
|
146
|
+
},
|
|
147
|
+
resultType: "string"
|
|
148
|
+
});
|
|
149
|
+
const WriteBinding = Schema.Struct({
|
|
150
|
+
kind: Schema.Literal("binding"),
|
|
151
|
+
binding: Schema.String.annotations({ title: "\u7ED1\u5B9A\u8DEF\u5F84", description: "\u5355\u5143\u683C\u8BFB\u5199\u7684 dot-prop \u8DEF\u5F84\uFF0C\u4F8B\u5982 `name` \u6216 `address.city`\uFF1B\u5199\u5165\u5373\u8986\u76D6\u8BE5\u8DEF\u5F84\u4E0A\u7684\u503C" })
|
|
152
|
+
}).annotations({ title: "ComboboxSingleWriteBinding", description: "\u884C\u5185\u53EF\u7F16\u8F91\uFF1A\u8BFB\u5199\u540C\u4E00 dot-prop \u8DEF\u5F84" });
|
|
153
|
+
const WriteRemote = Schema.Struct({
|
|
154
|
+
kind: Schema.Literal("remote"),
|
|
155
|
+
accessor: CelRowAccess(configure).annotations({ title: "\u8DEF\u5F84", description: "\u884C\u6570\u636E\u8BBF\u95EE CEL \u8868\u8FBE\u5F0F\uFF0C\u4F8B\u5982 `row.user.name`\uFF1B\u4F5C\u4E3A\u53EA\u8BFB\u56DE\u663E\u503C" }),
|
|
156
|
+
onChange: Schema.optional(CelOnChange.annotations({ title: "\u5207\u6362\u8BF7\u6C42", description: "\u7528\u6237\u9009\u62E9\u540E\u7ACB\u5373\u53D1\u8D77\u7684 HTTP \u8BF7\u6C42\uFF1B`value` \u4E3A\u65B0\u503C" })),
|
|
157
|
+
successMessage: Schema.optional(CelMessage.annotations({ title: "\u6210\u529F\u6D88\u606F", description: "\u8BF7\u6C42\u6210\u529F\u540E\u5F39\u51FA\u7684 toast\uFF1B\u672A\u914D\u7F6E\u5219\u9759\u9ED8" })),
|
|
158
|
+
triggers: Schema.optional(Triggers.annotations({ title: "\u6210\u529F\u540E\u89E6\u53D1", description: "\u8BF7\u6C42\u6210\u529F\u540E\u5192\u6CE1\u7684\u64CD\u4F5C" }))
|
|
159
|
+
}).annotations({ title: "ComboboxSingleWriteRemote", description: "\u670D\u52A1\u7AEF\u5199\u5165\uFF1A\u53EA\u8BFB\u56DE\u663E + \u5207\u6362\u8BF7\u6C42" });
|
|
160
|
+
return Schema.Union(WriteBinding, WriteRemote).annotations({
|
|
161
|
+
title: "\u5199\u5165\u65B9\u5F0F",
|
|
162
|
+
description: '`kind: "binding"` \u884C\u5185\u7F16\u8F91\u5199\u56DE dot-prop \u8DEF\u5F84\uFF1B`kind: "remote"` \u53EA\u8BFB\u56DE\u663E\u5E76\u901A\u8FC7\u8BF7\u6C42\u5199\u5165\u670D\u52A1\u7AEF'
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
export function schema(configure) {
|
|
166
|
+
const CelBool = CelRowAccess(configure, { resultType: "bool" });
|
|
167
|
+
const Options = optionsSchema(configure);
|
|
168
|
+
const Write = writeSchema(configure);
|
|
169
|
+
const display = columnFields(configure);
|
|
170
|
+
return Schema.Struct({
|
|
171
|
+
type: Schema.Literal(type),
|
|
172
|
+
compatibilityDate: Schema.Literal(compatibilityDate),
|
|
173
|
+
...columnIdentityFields(),
|
|
174
|
+
title: display.title,
|
|
175
|
+
placeholder: Schema.optional(Locale.annotations({
|
|
176
|
+
title: "\u5360\u4F4D\u7B26",
|
|
177
|
+
description: "\u672A\u9009\u4E2D\u4EFB\u4F55\u9009\u9879\u65F6\u8F93\u5165\u6846\u4E2D\u7684\u5360\u4F4D\u6587\u672C"
|
|
178
|
+
})),
|
|
179
|
+
hidden: Schema.optional(CelBool.annotations({
|
|
180
|
+
title: "\u9690\u85CF\u6761\u4EF6",
|
|
181
|
+
description: "\u8FD4\u56DE `true` \u65F6\u8BE5\u884C\u7684\u4E0B\u62C9\u6846\u4E0D\u6E32\u67D3\uFF08\u5176\u4F59\u884C\u4E0D\u53D7\u5F71\u54CD\uFF09"
|
|
182
|
+
})),
|
|
183
|
+
disabled: Schema.optional(CelBool.annotations({
|
|
184
|
+
title: "\u7981\u7528\u6761\u4EF6",
|
|
185
|
+
description: "\u8FD4\u56DE `true` \u65F6\u4E0B\u62C9\u6846\u4ECD\u7136\u6E32\u67D3\u4F46\u4E0D\u53EF\u9009\u62E9"
|
|
186
|
+
})),
|
|
187
|
+
readonly: Schema.optional(CelBool.annotations({
|
|
188
|
+
title: "\u53EA\u8BFB\u6761\u4EF6",
|
|
189
|
+
description: "\u8FD4\u56DE `true` \u65F6\u4EC5\u4EE5\u7EAF\u6587\u672C\u5C55\u793A\u5F53\u524D\u9009\u9879\u7684\u6807\u7B7E"
|
|
190
|
+
})),
|
|
191
|
+
enableSorting: display.enableSorting,
|
|
192
|
+
size: display.size,
|
|
193
|
+
grow: display.grow,
|
|
194
|
+
tooltip: display.tooltip,
|
|
195
|
+
options: Schema.optionalWith(Options, {
|
|
196
|
+
default: () => ({ kind: "static", items: [] })
|
|
197
|
+
}),
|
|
198
|
+
write: Schema.optionalWith(Write, {
|
|
199
|
+
default: () => ({ kind: "binding", binding: "" })
|
|
200
|
+
})
|
|
201
|
+
}).annotations({
|
|
202
|
+
title: "ComboboxSingleRenderer",
|
|
203
|
+
description: "\u4E0B\u62C9\u5355\u9009\u6E32\u67D3\u5668"
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
export const migrateFrom = [
|
|
207
|
+
{ type: "com.shwfed.table.column.combobox-single", compatibilityDate: "2026-05-26" },
|
|
208
|
+
{ type: "com.shwfed.table.column.combobox-single.remote", compatibilityDate: "2026-05-26" }
|
|
209
|
+
];
|
|
210
|
+
const CARRY = ["id", "groupId", "title", "size", "grow", "tooltip", "enableSorting", "placeholder", "hidden", "disabled", "readonly"];
|
|
211
|
+
export const migrate = (prev) => Effect.try({
|
|
212
|
+
try: () => {
|
|
213
|
+
if (!prev || typeof prev !== "object") {
|
|
214
|
+
throw new Error("\u4E0B\u62C9\u5355\u9009\u8FC1\u79FB\u5931\u8D25\uFF1A\u539F\u503C\u4E0D\u662F\u5BF9\u8C61");
|
|
215
|
+
}
|
|
216
|
+
const src = prev;
|
|
217
|
+
const out = { type, compatibilityDate };
|
|
218
|
+
for (const k of CARRY) {
|
|
219
|
+
if (src[k] !== void 0) out[k] = src[k];
|
|
220
|
+
}
|
|
221
|
+
if (typeof src.binding === "string") {
|
|
222
|
+
out.write = { kind: "binding", binding: src.binding };
|
|
223
|
+
} else if (typeof src.accessor === "string") {
|
|
224
|
+
const remote = { kind: "remote", accessor: src.accessor };
|
|
225
|
+
if (typeof src.onChange === "string") remote.onChange = src.onChange;
|
|
226
|
+
if (typeof src.successMessage === "string") remote.successMessage = src.successMessage;
|
|
227
|
+
if (Array.isArray(src.triggers)) remote.triggers = src.triggers;
|
|
228
|
+
out.write = remote;
|
|
229
|
+
} else {
|
|
230
|
+
out.write = { kind: "binding", binding: "" };
|
|
231
|
+
}
|
|
232
|
+
const opts = src.options;
|
|
233
|
+
if (opts && typeof opts === "object" && "kind" in opts) {
|
|
234
|
+
out.options = opts;
|
|
235
|
+
} else if (Array.isArray(src.items)) {
|
|
236
|
+
out.options = { kind: "static", items: src.items };
|
|
237
|
+
} else if (typeof src.request === "string" || typeof src.options === "string") {
|
|
238
|
+
const remote = { kind: "remote" };
|
|
239
|
+
if (typeof src.request === "string") remote.request = src.request;
|
|
240
|
+
if (typeof src.options === "string") remote.options = src.options;
|
|
241
|
+
if (typeof src.optionValue === "string") remote.optionValue = src.optionValue;
|
|
242
|
+
if (Array.isArray(src.optionLabel)) remote.optionLabel = src.optionLabel;
|
|
243
|
+
out.options = remote;
|
|
244
|
+
} else {
|
|
245
|
+
out.options = { kind: "static", items: [] };
|
|
246
|
+
}
|
|
247
|
+
return out;
|
|
248
|
+
},
|
|
249
|
+
catch: (e) => e instanceof Error ? e : new Error(String(e))
|
|
250
|
+
});
|
|
251
|
+
export function toColumnDef(value, { getLocaleText, $cel, inheritedContext }) {
|
|
252
|
+
const write = value.write;
|
|
253
|
+
const accessorFn = write.kind === "binding" ? (row) => {
|
|
254
|
+
if (!row || typeof row !== "object") return void 0;
|
|
255
|
+
return getProperty(row, write.binding);
|
|
256
|
+
} : (row, index) => {
|
|
257
|
+
try {
|
|
258
|
+
return Effect.runSync($cel(write.accessor, { ...inheritedContext, row, index }));
|
|
259
|
+
} catch (e) {
|
|
260
|
+
console.error("[shwfed-table] combobox-single accessor failed", e);
|
|
261
|
+
return void 0;
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
return {
|
|
265
|
+
header: editableHeader(getLocaleText(value.title)),
|
|
266
|
+
accessorFn,
|
|
267
|
+
enableSorting: value.enableSorting ?? false,
|
|
268
|
+
sortingFn: "basic",
|
|
269
|
+
size: value.size,
|
|
270
|
+
meta: {
|
|
271
|
+
grow: value.grow ?? false,
|
|
272
|
+
tooltip: getLocaleText(value.tooltip)
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
}
|