@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 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webtypen/webframez-core",
3
- "version": "0.3.57",
3
+ "version": "0.3.58",
4
4
  "description": "The core package of the typescript based webframez (web-framework) by webtypen.de",
5
5
  "homepage": "https://webtypen.de/",
6
6
  "license": "MIT",