@shwfed/config 2.2.2 → 2.2.3

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/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "shwfed",
3
3
  "configKey": "shwfed",
4
- "version": "2.2.2",
4
+ "version": "2.2.3",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "unknown"
@@ -80,10 +80,13 @@ export declare function schema(configure: (env: Environment) => void, _blockRef:
80
80
  }>;
81
81
  }>>>;
82
82
  kind: Schema.tag<"shwfed.component.form">;
83
- initial: Schema.optional<Schema.Struct<{
83
+ initial: Schema.optional<Schema.transform<Schema.Union<[Schema.Schema<string, string, never>, Schema.Struct<{
84
84
  request: Schema.optional<Schema.Schema<string, string, never>>;
85
85
  data: Schema.Schema<string, string, never>;
86
- }>>;
86
+ }>]>, Schema.Struct<{
87
+ request: Schema.optional<Schema.Schema<string, string, never>>;
88
+ data: Schema.Schema<string, string, never>;
89
+ }>>>;
87
90
  readonly: Schema.optional<Schema.Schema<string, string, never>>;
88
91
  }>>;
89
92
  }>;
@@ -347,10 +347,13 @@ export declare function schema(configure: (env: Environment) => void, _blockRef:
347
347
  }>;
348
348
  }>>>;
349
349
  kind: Schema.tag<"shwfed.component.form">;
350
- initial: Schema.optional<Schema.Struct<{
350
+ initial: Schema.optional<Schema.transform<Schema.Union<[Schema.Schema<string, string, never>, Schema.Struct<{
351
351
  request: Schema.optional<Schema.Schema<string, string, never>>;
352
352
  data: Schema.Schema<string, string, never>;
353
- }>>;
353
+ }>]>, Schema.Struct<{
354
+ request: Schema.optional<Schema.Schema<string, string, never>>;
355
+ data: Schema.Schema<string, string, never>;
356
+ }>>>;
354
357
  readonly: Schema.optional<Schema.Schema<string, string, never>>;
355
358
  }>>>;
356
359
  cellStyle: Schema.optional<Schema.Schema<string, string, never>>;
@@ -138,10 +138,13 @@ export declare function FormConfig(configure: (env: Environment) => void): Schem
138
138
  }>;
139
139
  }>>>;
140
140
  kind: Schema.tag<"shwfed.component.form">;
141
- initial: Schema.optional<Schema.Struct<{
141
+ initial: Schema.optional<Schema.transform<Schema.Union<[Schema.Schema<string, string, never>, Schema.Struct<{
142
142
  request: Schema.optional<Schema.Schema<string, string, never>>;
143
143
  data: Schema.Schema<string, string, never>;
144
- }>>;
144
+ }>]>, Schema.Struct<{
145
+ request: Schema.optional<Schema.Schema<string, string, never>>;
146
+ data: Schema.Schema<string, string, never>;
147
+ }>>>;
145
148
  readonly: Schema.optional<Schema.Schema<string, string, never>>;
146
149
  }>>;
147
150
  export declare function createFormConfig(body: Omit<Schema.Schema.Type<ReturnType<typeof FormConfig>>, 'kind'>): {
@@ -58,30 +58,40 @@ export function FormConfig(configure) {
58
58
  resultType: "dyn"
59
59
  });
60
60
  const CelFormReadonly = Expression({ configure: formConfigure, resultType: "bool" });
61
- return Schema.Struct({
62
- kind: Schema.tag(KIND),
63
- initial: Schema.optional(Schema.Struct({
64
- request: Schema.optional(CelInitialRequest.annotations({
65
- title: "\u8BF7\u6C42",
66
- description: md`
67
- 可选的 HTTP 请求表达式:返回 \`HttpRequest\`,运行时由宿主发起,并把响应体作为 \`json\` 传给「数据」表达式。
61
+ const InitialStruct = Schema.Struct({
62
+ request: Schema.optional(CelInitialRequest.annotations({
63
+ title: "\u8BF7\u6C42",
64
+ description: md`
65
+ 可选的 HTTP 请求表达式:返回 \`HttpRequest\`,运行时由宿主发起,并把响应体作为 \`json\` 传给「数据」表达式。
68
66
 
69
- 留空时「数据」直接对 CEL 上下文求值(静态默认值,或引用 \`form\` 的表达式)。
70
- `
71
- })),
72
- data: CelInitialData.annotations({
73
- title: "\u6570\u636E",
74
- description: md`
75
- 返回整个表单初始值的 CEL 表达式(应为一个对象):
67
+ 留空时「数据」直接对 CEL 上下文求值(静态默认值,或引用 \`form\` 的表达式)。
68
+ `
69
+ })),
70
+ data: CelInitialData.annotations({
71
+ title: "\u6570\u636E",
72
+ description: md`
73
+ 返回整个表单初始值的 CEL 表达式(应为一个对象):
76
74
 
77
- - 可以互相依赖,但应避免循环引用。考虑一个含「用户名」与「用户角色」的表单:可默认填入当前登入人的用户名,再以此为依据填入其默认角色。
75
+ - 可以互相依赖,但应避免循环引用。考虑一个含「用户名」与「用户角色」的表单:可默认填入当前登入人的用户名,再以此为依据填入其默认角色。
78
76
 
79
- - 配置了「请求」时,可通过 \`json\` 引用响应体,例如 \`json.?data\`。
77
+ - 配置了「请求」时,可通过 \`json\` 引用响应体,例如 \`json.?data\`。
80
78
 
81
- - 如果配置了初始值,重置这个表单将**重置为其初始值,而非空**。
82
- `
83
- })
84
- }).annotations({
79
+ - 如果配置了初始值,重置这个表单将**重置为其初始值,而非空**。
80
+ `
81
+ })
82
+ });
83
+ const Initial = Schema.transform(
84
+ Schema.Union(CelInitialData, InitialStruct),
85
+ InitialStruct,
86
+ {
87
+ strict: true,
88
+ decode: (input) => typeof input === "string" ? { data: input } : input,
89
+ encode: (output) => output
90
+ }
91
+ );
92
+ return Schema.Struct({
93
+ kind: Schema.tag(KIND),
94
+ initial: Schema.optional(Initial.annotations({
85
95
  title: "\u521D\u59CB\u503C",
86
96
  description: "\u8868\u5355\u521D\u59CB\u503C\u7684\u6765\u6E90\uFF1A\u53EF\u9009\u7684 HTTP \u8BF7\u6C42\uFF0C\u52A0\u4E00\u4E2A\u8FD4\u56DE\u521D\u59CB\u503C\u5BF9\u8C61\u7684 CEL \u8868\u8FBE\u5F0F"
87
97
  })),
@@ -432,10 +432,13 @@ export declare function TableConfig(configure: (env: Environment) => void): Sche
432
432
  }>;
433
433
  }>>>;
434
434
  kind: Schema.tag<"shwfed.component.form">;
435
- initial: Schema.optional<Schema.Struct<{
435
+ initial: Schema.optional<Schema.transform<Schema.Union<[Schema.Schema<string, string, never>, Schema.Struct<{
436
436
  request: Schema.optional<Schema.Schema<string, string, never>>;
437
437
  data: Schema.Schema<string, string, never>;
438
- }>>;
438
+ }>]>, Schema.Struct<{
439
+ request: Schema.optional<Schema.Schema<string, string, never>>;
440
+ data: Schema.Schema<string, string, never>;
441
+ }>>>;
439
442
  readonly: Schema.optional<Schema.Schema<string, string, never>>;
440
443
  }>>>;
441
444
  cellStyle: Schema.optional<Schema.Schema<string, string, never>>;
@@ -214,7 +214,6 @@ function applyShortcut(index) {
214
214
  <PopoverContent
215
215
  align="start"
216
216
  :class="cn('w-auto p-0', props.popoverClass)"
217
- :style="{ minWidth: 'var(--reka-popover-trigger-width)' }"
218
217
  @open-auto-focus="(event) => event.preventDefault()"
219
218
  @interact-outside="onInteractOutside"
220
219
  >
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shwfed/config",
3
- "version": "2.2.2",
3
+ "version": "2.2.3",
4
4
  "description": "Configurable UI for SHWFED",
5
5
  "type": "module",
6
6
  "publishConfig": {