@webtypen/webframez-core 0.3.57 → 0.3.59
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/README.md +40 -1
- package/dist/DataBuilder/DataBuilder.d.ts +7 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -463,12 +463,51 @@ builder.registerType({
|
|
|
463
463
|
collection: "users",
|
|
464
464
|
fields: {
|
|
465
465
|
email: { type: "text", required: true, unique: { match: {} } },
|
|
466
|
-
age: { type: "integer" }
|
|
466
|
+
age: { type: "integer" },
|
|
467
|
+
default_values: {
|
|
468
|
+
type: "array",
|
|
469
|
+
schema: {
|
|
470
|
+
key: { type: "string", required: true },
|
|
471
|
+
name: { type: "string", required: true }
|
|
472
|
+
}
|
|
473
|
+
},
|
|
474
|
+
target: {
|
|
475
|
+
type: "option",
|
|
476
|
+
optionsMapping: { from: "default_values", value: "key", label: "name" }
|
|
477
|
+
},
|
|
478
|
+
mixed_target: {
|
|
479
|
+
type: "option",
|
|
480
|
+
optionsMapping: [
|
|
481
|
+
{ from: "default_values", value: "key", label: "name", valuePrefix: "@defaults." },
|
|
482
|
+
{ from: "features_targets", value: "key", label: "name" },
|
|
483
|
+
{ from: "@parent.attributes", value: "key", label: "name" }
|
|
484
|
+
]
|
|
485
|
+
},
|
|
486
|
+
licenses: {
|
|
487
|
+
type: "array",
|
|
488
|
+
toggable: true,
|
|
489
|
+
previewLabel: "{{ name }}",
|
|
490
|
+
schema: {
|
|
491
|
+
key: { type: "string", required: true },
|
|
492
|
+
name: { type: "string", required: true }
|
|
493
|
+
}
|
|
494
|
+
}
|
|
467
495
|
}
|
|
468
496
|
}
|
|
469
497
|
});
|
|
470
498
|
```
|
|
471
499
|
|
|
500
|
+
`option` fields can use static `options: [{ value, label }]` or a client-side
|
|
501
|
+
`optionsMapping`. The mapping can be a single object or an array of objects with
|
|
502
|
+
`{ from: string; value: string; label: string; valuePrefix?: string }`. Multiple
|
|
503
|
+
mapping entries are aggregated in order, and `@parent...` source paths resolve
|
|
504
|
+
against the nearest outer array entry in the current form data.
|
|
505
|
+
|
|
506
|
+
Array fields can set `toggable: true` to let the frontend collapse entries. Use
|
|
507
|
+
`previewLabel` with the same template syntax to render a label in the entry title
|
|
508
|
+
row. `toggable` and `previewLabel` may be defined on the schema field or the form
|
|
509
|
+
layout entry; form layout options override schema options.
|
|
510
|
+
|
|
472
511
|
You can also use:
|
|
473
512
|
- `registerModelType(...)`
|
|
474
513
|
- `registerFieldType(...)`
|
|
@@ -18,6 +18,13 @@ export type DataBuilderSchema = {
|
|
|
18
18
|
newDataHandler?: Function;
|
|
19
19
|
canDelete?: any;
|
|
20
20
|
};
|
|
21
|
+
export type DataBuilderOptionMapping = {
|
|
22
|
+
from: string;
|
|
23
|
+
value: string;
|
|
24
|
+
label: string;
|
|
25
|
+
valuePrefix?: string;
|
|
26
|
+
};
|
|
27
|
+
export type DataBuilderOptionsMapping = DataBuilderOptionMapping | DataBuilderOptionMapping[];
|
|
21
28
|
export type DataBuilderType = {
|
|
22
29
|
key: string;
|
|
23
30
|
singular: string;
|
package/package.json
CHANGED