@shwfed/nuxt 0.11.47 → 0.11.48
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 +1 -1
- package/dist/runtime/components/fields.d.vue.ts +6 -850
- package/dist/runtime/components/fields.vue +2 -0
- package/dist/runtime/components/fields.vue.d.ts +6 -850
- package/dist/runtime/components/ui/fields/Fields.d.vue.ts +10 -1698
- package/dist/runtime/components/ui/fields/Fields.vue +162 -627
- package/dist/runtime/components/ui/fields/Fields.vue.d.ts +10 -1698
- package/dist/runtime/components/ui/fields/FieldsBody.d.vue.ts +17 -0
- package/dist/runtime/components/ui/fields/FieldsBody.vue +720 -0
- package/dist/runtime/components/ui/fields/FieldsBody.vue.d.ts +17 -0
- package/dist/runtime/components/ui/fields/render-context.d.ts +120 -0
- package/dist/runtime/components/ui/fields/render-context.js +0 -0
- package/dist/runtime/components/ui/fields/schema.d.ts +134 -5606
- package/dist/runtime/components/ui/fields/schema.js +80 -83
- package/dist/runtime/components/ui/fields-configurator/FieldsConfiguratorDialog.d.vue.ts +5 -849
- package/dist/runtime/components/ui/fields-configurator/FieldsConfiguratorDialog.vue +618 -224
- package/dist/runtime/components/ui/fields-configurator/FieldsConfiguratorDialog.vue.d.ts +5 -849
- package/package.json +1 -1
|
@@ -13,13 +13,27 @@ const inheritedFieldContext = {
|
|
|
13
13
|
const labeledFieldShape = {
|
|
14
14
|
hideLabel: z.boolean().optional().describe("\u4E3A true \u65F6\uFF0C\u4E0D\u6E32\u67D3\u5B57\u6BB5\u6807\u7B7E")
|
|
15
15
|
};
|
|
16
|
+
const labeledFieldTitleShape = {
|
|
17
|
+
title: localeC.describe("\u5B57\u6BB5\u6807\u7B7E\u7684\u672C\u5730\u5316\u663E\u793A\u6587\u672C"),
|
|
18
|
+
...labeledFieldShape
|
|
19
|
+
};
|
|
16
20
|
const fieldCellStyleShape = {
|
|
17
21
|
labelStyle: z.string().optional().describe("CSS \u6837\u5F0F\u5BF9\u8C61\u8868\u8FBE\u5F0F\uFF0C\u63A7\u5236 contents \u5E03\u5C40\u6A21\u5F0F\u4E0B\u6807\u7B7E\u5355\u5143\u683C\u7684\u5E03\u5C40\u4E0E\u5916\u89C2"),
|
|
18
22
|
contentStyle: z.string().optional().describe("CSS \u6837\u5F0F\u5BF9\u8C61\u8868\u8FBE\u5F0F\uFF0C\u63A7\u5236 contents \u5E03\u5C40\u6A21\u5F0F\u4E0B\u5185\u5BB9\u5355\u5143\u683C\u7684\u5E03\u5C40\u4E0E\u5916\u89C2")
|
|
19
23
|
};
|
|
20
24
|
export const KIND = "shwfed.component.fields";
|
|
21
|
-
export const CURRENT_COMPATIBILITY_DATE = "2026-03-
|
|
22
|
-
export const SUPPORTED_COMPATIBILITY_DATES = [
|
|
25
|
+
export const CURRENT_COMPATIBILITY_DATE = "2026-03-27";
|
|
26
|
+
export const SUPPORTED_COMPATIBILITY_DATES = [
|
|
27
|
+
CURRENT_COMPATIBILITY_DATE,
|
|
28
|
+
"2026-03-20"
|
|
29
|
+
];
|
|
30
|
+
export const FieldsOrientationC = z.enum(["horizontal", "vertical", "floating", "contents"]);
|
|
31
|
+
export const FieldsStyleC = expressionC([/^map/, "dyn"], {
|
|
32
|
+
...inheritedFieldContext
|
|
33
|
+
}).optional().describe("\u8FD4\u56DE\u5B57\u6BB5\u96C6\u5408\u5BB9\u5668\u6837\u5F0F\u5BF9\u8C61\u7684 CEL \u8868\u8FBE\u5F0F\uFF0C\u53EF\u4F7F\u7528 form\u3001row\u3001index \u548C id \u53D8\u91CF\u3002");
|
|
34
|
+
export const FieldGroupStyleC = expressionC([/^map/, "dyn"], {
|
|
35
|
+
...inheritedFieldContext
|
|
36
|
+
}).optional().describe("\u8FD4\u56DE\u5B57\u6BB5\u7EC4\u5BB9\u5668\u6837\u5F0F\u5BF9\u8C61\u7684 CEL \u8868\u8FBE\u5F0F\uFF0C\u53EF\u4F7F\u7528 form\u3001row\u3001index \u548C id \u53D8\u91CF\u3002");
|
|
23
37
|
export const ValidationRuleC = z.object({
|
|
24
38
|
expression: expressionC(["bool", "dyn"], { value: "dyn", ...inheritedFieldContext }).describe("\u8FD4\u56DE\u5E03\u5C14\u503C\u7684 CEL \u8868\u8FBE\u5F0F\uFF0C\u53EF\u4F7F\u7528 value\u3001form\u3001row\u3001index \u548C id \u53D8\u91CF"),
|
|
25
39
|
message: z.string().describe("\u6821\u9A8C\u5931\u8D25\u65F6\u5C55\u793A\u7684 Markdown \u6D88\u606F\uFF0C\u53EF\u5728 {{ expression }} \u4E2D\u4F7F\u7528 value\u3001form\u3001row\u3001index \u548C id \u53D8\u91CF")
|
|
@@ -175,6 +189,11 @@ export const UploadFieldC = z.object({
|
|
|
175
189
|
export const SlotFieldC = z.strictObject({
|
|
176
190
|
id: fieldIdC,
|
|
177
191
|
type: z.literal("slot").describe("\u5177\u540D\u63D2\u69FD\u5B57\u6BB5\uFF0C\u901A\u8FC7\u5B57\u6BB5 id \u5BF9\u5E94\u7684\u5177\u540D\u63D2\u69FD\u6E32\u67D3\u5185\u5BB9"),
|
|
192
|
+
title: localeC.optional().describe("\u53EF\u9009\u7684\u5B57\u6BB5\u6807\u7B7E\uFF1B\u914D\u7F6E\u540E\u8BE5\u63D2\u69FD\u4F1A\u901A\u8FC7\u5E38\u89C4 Field \u6807\u7B7E/\u5185\u5BB9\u7ED3\u6784\u6E32\u67D3"),
|
|
193
|
+
...labeledFieldShape,
|
|
194
|
+
required: z.boolean().optional().describe("\u4E3A true \u65F6\uFF0C\u4EC5\u5728\u5B57\u6BB5\u6807\u7B7E\u540E\u663E\u793A\u5FC5\u586B\u63D0\u793A\u661F\u53F7\uFF0C\u4E0D\u5F71\u54CD\u5B9E\u9645\u6821\u9A8C\u903B\u8F91"),
|
|
195
|
+
hidden: expressionC(["bool", "dyn"], inheritedFieldContext).optional().describe("\u4E3A true \u65F6\uFF0C\u9690\u85CF\u8FD9\u4E2A\u5B57\u6BB5\uFF0C\u53EF\u4F7F\u7528 form\u3001row\u3001index \u548C id \u53D8\u91CF"),
|
|
196
|
+
...fieldCellStyleShape,
|
|
178
197
|
style: z.string().optional().describe("CSS \u6837\u5F0F\u5BF9\u8C61\u8868\u8FBE\u5F0F\uFF0C\u6C42\u503C\u540E\u901A\u8FC7 scoped slot \u7684 style prop \u4F20\u7ED9\u6D88\u8D39\u8005")
|
|
179
198
|
});
|
|
180
199
|
export const EmptyFieldC = z.strictObject({
|
|
@@ -182,26 +201,34 @@ export const EmptyFieldC = z.strictObject({
|
|
|
182
201
|
type: z.literal("empty").describe("\u7A7A\u767D\u5B57\u6BB5\uFF0C\u6309\u987A\u5E8F\u6E32\u67D3\u4E00\u4E2A\u7A7A div\uFF0C\u53EA\u80FD\u901A\u8FC7 style \u63A7\u5236\u5E03\u5C40"),
|
|
183
202
|
style: z.string().optional().describe("CSS \u6837\u5F0F\u5BF9\u8C61\u8868\u8FBE\u5F0F\uFF0C\u6C42\u503C\u540E\u4F5C\u4E3A\u7A7A div \u7684\u5185\u8054\u6837\u5F0F")
|
|
184
203
|
});
|
|
185
|
-
export const FieldC = z.
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
204
|
+
export const FieldC = z.lazy(
|
|
205
|
+
() => z.discriminatedUnion("type", [
|
|
206
|
+
StringFieldC,
|
|
207
|
+
TextareaFieldC,
|
|
208
|
+
NumberFieldC,
|
|
209
|
+
MarkdownFieldC,
|
|
210
|
+
MarkdownBodyFieldC,
|
|
211
|
+
SelectFieldC,
|
|
212
|
+
RadioGroupFieldC,
|
|
213
|
+
CalendarFieldC,
|
|
214
|
+
UploadFieldC,
|
|
215
|
+
SlotFieldC,
|
|
216
|
+
EmptyFieldC,
|
|
217
|
+
ContainerFieldC
|
|
218
|
+
])
|
|
219
|
+
);
|
|
220
|
+
export const ContainerFieldC = z.strictObject({
|
|
221
|
+
id: fieldIdC,
|
|
222
|
+
type: z.literal("container").describe("\u5BB9\u5668\u5B57\u6BB5\uFF0C\u901A\u8FC7\u4E00\u884C\u6807\u7B7E\u5305\u88F9\u53E6\u4E00\u7EC4\u5D4C\u5957\u5B57\u6BB5"),
|
|
223
|
+
...labeledFieldTitleShape,
|
|
224
|
+
required: z.boolean().optional().describe("\u4E3A true \u65F6\uFF0C\u4EC5\u5728\u5B57\u6BB5\u6807\u7B7E\u540E\u663E\u793A\u5FC5\u586B\u63D0\u793A\u661F\u53F7\uFF0C\u4E0D\u5F71\u54CD\u5B9E\u9645\u6821\u9A8C\u903B\u8F91"),
|
|
225
|
+
hidden: expressionC(["bool", "dyn"], inheritedFieldContext).optional().describe("\u4E3A true \u65F6\uFF0C\u9690\u85CF\u8FD9\u4E2A\u5B57\u6BB5\u53CA\u5176\u6240\u6709\u5B50\u5B57\u6BB5\uFF0C\u53EF\u4F7F\u7528 form\u3001row\u3001index \u548C id \u53D8\u91CF"),
|
|
226
|
+
...fieldCellStyleShape,
|
|
227
|
+
bodyOrientation: FieldsOrientationC.optional().describe("\u5BB9\u5668\u5185\u90E8\u5D4C\u5957\u5B57\u6BB5\u7684\u5E03\u5C40\u65B9\u5411\uFF1B\u7559\u7A7A\u65F6\u9ED8\u8BA4 horizontal"),
|
|
228
|
+
bodyBordered: z.boolean().optional().describe("\u4E3A true \u65F6\uFF0C\u5728 contents \u5E03\u5C40\u6A21\u5F0F\u4E0B\u4E3A\u5BB9\u5668\u5185\u90E8\u5B57\u6BB5\u5BB9\u5668\u548C\u5355\u5143\u683C\u6DFB\u52A0\u8868\u683C\u5F0F\u8FB9\u6846"),
|
|
229
|
+
bodyStyle: FieldsStyleC.describe("\u8FD4\u56DE\u5BB9\u5668\u5185\u90E8\u5D4C\u5957\u5B57\u6BB5\u5BB9\u5668\u6837\u5F0F\u5BF9\u8C61\u7684 CEL \u8868\u8FBE\u5F0F\uFF0C\u53EF\u4F7F\u7528 form\u3001row\u3001index \u548C id \u53D8\u91CF\u3002"),
|
|
230
|
+
fields: z.array(FieldC).readonly().describe("\u5BB9\u5668\u5B57\u6BB5\u5185\u7684\u5D4C\u5957\u5B57\u6BB5\u5217\u8868\uFF0C\u4EC5\u652F\u6301\u5B57\u6BB5\uFF0C\u4E0D\u652F\u6301\u5B57\u6BB5\u7EC4")
|
|
231
|
+
}).readonly();
|
|
205
232
|
export const FieldGroupC = z.strictObject({
|
|
206
233
|
id: fieldGroupIdC,
|
|
207
234
|
style: FieldGroupStyleC,
|
|
@@ -213,14 +240,12 @@ const fieldsSharedShape = {
|
|
|
213
240
|
style: FieldsStyleC
|
|
214
241
|
};
|
|
215
242
|
function isPathlessField(field) {
|
|
216
|
-
return field.type === "slot" || field.type === "empty" || field.type === "markdown" || field.type === "markdown-body";
|
|
243
|
+
return field.type === "slot" || field.type === "empty" || field.type === "markdown" || field.type === "markdown-body" || field.type === "container";
|
|
217
244
|
}
|
|
218
|
-
function
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
value.fields.forEach((field, fieldIndex) => {
|
|
223
|
-
const fieldIdPath = ["fields", fieldIndex, "id"];
|
|
245
|
+
function validateFieldUniqueness(fields, parentPath, ctx, fieldIdOwners, fieldPathOwners) {
|
|
246
|
+
fields.forEach((field, fieldIndex) => {
|
|
247
|
+
const fieldBasePath = [...parentPath, fieldIndex];
|
|
248
|
+
const fieldIdPath = [...fieldBasePath, "id"];
|
|
224
249
|
const existingFieldIdPath = fieldIdOwners[field.id];
|
|
225
250
|
if (existingFieldIdPath) {
|
|
226
251
|
ctx.addIssue({
|
|
@@ -236,26 +261,34 @@ function validateGroupAndFieldUniqueness(value, ctx) {
|
|
|
236
261
|
} else {
|
|
237
262
|
fieldIdOwners[field.id] = [...fieldIdPath];
|
|
238
263
|
}
|
|
239
|
-
if (isPathlessField(field)) {
|
|
240
|
-
|
|
264
|
+
if (!isPathlessField(field)) {
|
|
265
|
+
const fieldPathPath = [...fieldBasePath, "path"];
|
|
266
|
+
const existingFieldPathPath = fieldPathOwners[field.path];
|
|
267
|
+
if (existingFieldPathPath) {
|
|
268
|
+
ctx.addIssue({
|
|
269
|
+
code: "custom",
|
|
270
|
+
message: "field path must be unique",
|
|
271
|
+
path: [...fieldPathPath]
|
|
272
|
+
});
|
|
273
|
+
ctx.addIssue({
|
|
274
|
+
code: "custom",
|
|
275
|
+
message: "field path must be unique",
|
|
276
|
+
path: [...existingFieldPathPath]
|
|
277
|
+
});
|
|
278
|
+
} else {
|
|
279
|
+
fieldPathOwners[field.path] = [...fieldPathPath];
|
|
280
|
+
}
|
|
241
281
|
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
if (existingFieldPathPath) {
|
|
245
|
-
ctx.addIssue({
|
|
246
|
-
code: "custom",
|
|
247
|
-
message: "field path must be unique",
|
|
248
|
-
path: [...fieldPathPath]
|
|
249
|
-
});
|
|
250
|
-
ctx.addIssue({
|
|
251
|
-
code: "custom",
|
|
252
|
-
message: "field path must be unique",
|
|
253
|
-
path: [...existingFieldPathPath]
|
|
254
|
-
});
|
|
255
|
-
} else {
|
|
256
|
-
fieldPathOwners[field.path] = [...fieldPathPath];
|
|
282
|
+
if (field.type === "container") {
|
|
283
|
+
validateFieldUniqueness(field.fields, [...fieldBasePath, "fields"], ctx, fieldIdOwners, fieldPathOwners);
|
|
257
284
|
}
|
|
258
285
|
});
|
|
286
|
+
}
|
|
287
|
+
function validateGroupAndFieldUniqueness(value, ctx) {
|
|
288
|
+
const groupIdOwners = {};
|
|
289
|
+
const fieldIdOwners = {};
|
|
290
|
+
const fieldPathOwners = {};
|
|
291
|
+
validateFieldUniqueness(value.fields, ["fields"], ctx, fieldIdOwners, fieldPathOwners);
|
|
259
292
|
value.groups.forEach((group, groupIndex) => {
|
|
260
293
|
const existingGroupIndex = groupIdOwners[group.id];
|
|
261
294
|
if (existingGroupIndex !== void 0) {
|
|
@@ -272,43 +305,7 @@ function validateGroupAndFieldUniqueness(value, ctx) {
|
|
|
272
305
|
} else {
|
|
273
306
|
groupIdOwners[group.id] = groupIndex;
|
|
274
307
|
}
|
|
275
|
-
group.fields
|
|
276
|
-
const fieldIdPath = ["groups", groupIndex, "fields", fieldIndex, "id"];
|
|
277
|
-
const existingFieldIdPath = fieldIdOwners[field.id];
|
|
278
|
-
if (existingFieldIdPath) {
|
|
279
|
-
ctx.addIssue({
|
|
280
|
-
code: "custom",
|
|
281
|
-
message: "field id must be unique",
|
|
282
|
-
path: [...fieldIdPath]
|
|
283
|
-
});
|
|
284
|
-
ctx.addIssue({
|
|
285
|
-
code: "custom",
|
|
286
|
-
message: "field id must be unique",
|
|
287
|
-
path: [...existingFieldIdPath]
|
|
288
|
-
});
|
|
289
|
-
} else {
|
|
290
|
-
fieldIdOwners[field.id] = [...fieldIdPath];
|
|
291
|
-
}
|
|
292
|
-
if (isPathlessField(field)) {
|
|
293
|
-
return;
|
|
294
|
-
}
|
|
295
|
-
const fieldPathPath = ["groups", groupIndex, "fields", fieldIndex, "path"];
|
|
296
|
-
const existingFieldPathPath = fieldPathOwners[field.path];
|
|
297
|
-
if (existingFieldPathPath) {
|
|
298
|
-
ctx.addIssue({
|
|
299
|
-
code: "custom",
|
|
300
|
-
message: "field path must be unique",
|
|
301
|
-
path: [...fieldPathPath]
|
|
302
|
-
});
|
|
303
|
-
ctx.addIssue({
|
|
304
|
-
code: "custom",
|
|
305
|
-
message: "field path must be unique",
|
|
306
|
-
path: [...existingFieldPathPath]
|
|
307
|
-
});
|
|
308
|
-
} else {
|
|
309
|
-
fieldPathOwners[field.path] = [...fieldPathPath];
|
|
310
|
-
}
|
|
311
|
-
});
|
|
308
|
+
validateFieldUniqueness(group.fields, ["groups", groupIndex, "fields"], ctx, fieldIdOwners, fieldPathOwners);
|
|
312
309
|
});
|
|
313
310
|
}
|
|
314
311
|
const FieldsBodyNormalizedObjectC = z.object({
|