@webtypen/webframez-core 0.3.57 → 0.3.58
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 +17 -1
- package/dist/DataBuilder/DataBuilder.d.ts +5 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -463,12 +463,28 @@ 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
|
+
}
|
|
467
478
|
}
|
|
468
479
|
}
|
|
469
480
|
});
|
|
470
481
|
```
|
|
471
482
|
|
|
483
|
+
`option` fields can use static `options: [{ value, label }]` or a client-side
|
|
484
|
+
`optionsMapping: { from: string; value: string; label: string }`. The mapping is
|
|
485
|
+
resolved by the DataBuilder frontend against the current form data, so changes in
|
|
486
|
+
the referenced array appear in selects without a backend reload.
|
|
487
|
+
|
|
472
488
|
You can also use:
|
|
473
489
|
- `registerModelType(...)`
|
|
474
490
|
- `registerFieldType(...)`
|
|
@@ -18,6 +18,11 @@ 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
|
+
};
|
|
21
26
|
export type DataBuilderType = {
|
|
22
27
|
key: string;
|
|
23
28
|
singular: string;
|
package/package.json
CHANGED