@siliconst/metaui 1.0.2 → 1.2.0
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 +134 -123
- package/package.json +3 -2
- package/src/nz/co/siliconst/ui5/metaui/.library +7 -7
- package/src/nz/co/siliconst/ui5/metaui/controls/GeneratorHost-dbg.js +299 -163
- package/src/nz/co/siliconst/ui5/metaui/controls/GeneratorHost-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/GeneratorHost.d.ts +54 -6
- package/src/nz/co/siliconst/ui5/metaui/controls/GeneratorHost.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/GeneratorHost.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/GeneratorHost.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/GeneratorHost.ts +292 -162
- package/src/nz/co/siliconst/ui5/metaui/core/ConditionEngine-dbg.js +51 -43
- package/src/nz/co/siliconst/ui5/metaui/core/ConditionEngine-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/ConditionEngine.d.ts +5 -0
- package/src/nz/co/siliconst/ui5/metaui/core/ConditionEngine.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/ConditionEngine.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/ConditionEngine.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/ConditionEngine.ts +49 -40
- package/src/nz/co/siliconst/ui5/metaui/core/Engine-dbg.js +81 -58
- package/src/nz/co/siliconst/ui5/metaui/core/Engine-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/Engine.d.ts +5 -12
- package/src/nz/co/siliconst/ui5/metaui/core/Engine.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/Engine.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/Engine.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/Engine.ts +82 -56
- package/src/nz/co/siliconst/ui5/metaui/core/EventBus-dbg.js +65 -50
- package/src/nz/co/siliconst/ui5/metaui/core/EventBus-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/EventBus.d.ts +9 -0
- package/src/nz/co/siliconst/ui5/metaui/core/EventBus.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/EventBus.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/EventBus.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/EventBus.ts +60 -45
- package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry-dbg.js +72 -59
- package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry.d.ts +6 -4
- package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry.ts +71 -56
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer-dbg.js +145 -36
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer.d.ts +13 -8
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer.ts +157 -31
- package/src/nz/co/siliconst/ui5/metaui/core/StateManager-dbg.js +55 -55
- package/src/nz/co/siliconst/ui5/metaui/core/StateManager-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/StateManager.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/StateManager.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/StateManager.ts +56 -56
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IEventBus-dbg.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IEventBus-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IEventBus.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IEventBus.ts +29 -29
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ILayoutManager-dbg.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ILayoutManager-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ILayoutManager.d.ts +6 -12
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ILayoutManager.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ILayoutManager.ts +21 -26
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IPlugin-dbg.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IPlugin.d.ts +3 -20
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IPlugin.ts +14 -33
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchema-dbg.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchema-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchema.d.ts +33 -43
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchema.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchema.ts +70 -70
- package/src/nz/co/siliconst/ui5/metaui/layouts/BaseLayout-dbg.js +23 -38
- package/src/nz/co/siliconst/ui5/metaui/layouts/BaseLayout-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/BaseLayout.d.ts +4 -17
- package/src/nz/co/siliconst/ui5/metaui/layouts/BaseLayout.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/BaseLayout.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/BaseLayout.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/BaseLayout.ts +22 -34
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout-dbg.js +98 -56
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout.d.ts +7 -7
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout.ts +97 -60
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout-dbg.js +102 -90
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout.d.ts +4 -8
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout.ts +119 -102
- package/src/nz/co/siliconst/ui5/metaui/library-dbg.js +43 -32
- package/src/nz/co/siliconst/ui5/metaui/library-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/library-preload.js +22 -17
- package/src/nz/co/siliconst/ui5/metaui/library-preload.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/library.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/library.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/library.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/library.ts +55 -43
- package/src/nz/co/siliconst/ui5/metaui/manifest.json +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/ArrayPlugin-dbg.js +68 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/ArrayPlugin-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/ArrayPlugin.d.ts +15 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/ArrayPlugin.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/ArrayPlugin.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/ArrayPlugin.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/ArrayPlugin.ts +71 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/BasePlugin-dbg.js +54 -59
- package/src/nz/co/siliconst/ui5/metaui/plugins/BasePlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/BasePlugin.d.ts +8 -27
- package/src/nz/co/siliconst/ui5/metaui/plugins/BasePlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/BasePlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/BasePlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/BasePlugin.ts +56 -58
- package/src/nz/co/siliconst/ui5/metaui/plugins/BooleanPlugin-dbg.js +41 -42
- package/src/nz/co/siliconst/ui5/metaui/plugins/BooleanPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/BooleanPlugin.d.ts +2 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/BooleanPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/BooleanPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/BooleanPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/BooleanPlugin.ts +41 -42
- package/src/nz/co/siliconst/ui5/metaui/plugins/DatePlugin-dbg.js +68 -60
- package/src/nz/co/siliconst/ui5/metaui/plugins/DatePlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/DatePlugin.d.ts +2 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/DatePlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/DatePlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/DatePlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/DatePlugin.ts +69 -63
- package/src/nz/co/siliconst/ui5/metaui/plugins/DateTimePlugin-dbg.js +68 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DateTimePlugin-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DateTimePlugin.d.ts +18 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DateTimePlugin.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DateTimePlugin.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DateTimePlugin.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DateTimePlugin.ts +68 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DropdownPlugin-dbg.js +66 -66
- package/src/nz/co/siliconst/ui5/metaui/plugins/DropdownPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/DropdownPlugin.d.ts +2 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/DropdownPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/DropdownPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/DropdownPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/DropdownPlugin.ts +65 -65
- package/src/nz/co/siliconst/ui5/metaui/plugins/NumberPlugin-dbg.js +55 -53
- package/src/nz/co/siliconst/ui5/metaui/plugins/NumberPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/NumberPlugin.d.ts +3 -3
- package/src/nz/co/siliconst/ui5/metaui/plugins/NumberPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/NumberPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/NumberPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/NumberPlugin.ts +56 -55
- package/src/nz/co/siliconst/ui5/metaui/plugins/StringPlugin-dbg.js +56 -53
- package/src/nz/co/siliconst/ui5/metaui/plugins/StringPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/StringPlugin.d.ts +2 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/StringPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/StringPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/StringPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/StringPlugin.ts +58 -55
- package/src/nz/co/siliconst/ui5/metaui/plugins/SwitchPlugin-dbg.js +43 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/SwitchPlugin-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/SwitchPlugin.d.ts +18 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/SwitchPlugin.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/SwitchPlugin.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/SwitchPlugin.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/SwitchPlugin.ts +42 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TextAreaPlugin-dbg.js +58 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TextAreaPlugin-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TextAreaPlugin.d.ts +18 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TextAreaPlugin.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TextAreaPlugin.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TextAreaPlugin.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TextAreaPlugin.ts +58 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TimePlugin-dbg.js +74 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TimePlugin-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TimePlugin.d.ts +18 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TimePlugin.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TimePlugin.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TimePlugin.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TimePlugin.ts +71 -0
- package/ui5.yaml +3 -3
- package/test-resources/App.js +0 -11
- package/test-resources/Main.controller.js +0 -73
- package/test-resources/Main.view.xml +0 -42
- package/test-resources/index.html +0 -21
- package/test-resources/mockData.json +0 -27
- package/test-resources/mockSchema.json +0 -98
|
@@ -1,40 +1,49 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file ConditionEngine.ts
|
|
3
|
-
* @description Evaluates dynamic rules to alter the schema in real-time.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { EventBus } from "./EventBus";
|
|
7
|
-
import { ISchema } from "../interfaces/ISchema";
|
|
8
|
-
import { IFieldChangeEvent } from "../interfaces/IEventBus";
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Engine that listens to the EventBus and evaluates cross-field dependencies.
|
|
12
|
-
*/
|
|
13
|
-
export class ConditionEngine {
|
|
14
|
-
private schema: ISchema;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
*
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
this.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @file ConditionEngine.ts
|
|
3
|
+
* @description Evaluates dynamic rules to alter the schema in real-time.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { EventBus } from "./EventBus";
|
|
7
|
+
import { ISchema } from "../interfaces/ISchema";
|
|
8
|
+
import { IFieldChangeEvent } from "../interfaces/IEventBus";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Engine that listens to the EventBus and evaluates cross-field dependencies.
|
|
12
|
+
*/
|
|
13
|
+
export class ConditionEngine {
|
|
14
|
+
private schema: ISchema;
|
|
15
|
+
private boundHandler: (event: IFieldChangeEvent) => void;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Initializes the ConditionEngine with the active schema.
|
|
19
|
+
* @param schema The current UI layout schema.
|
|
20
|
+
*/
|
|
21
|
+
constructor(schema: ISchema) {
|
|
22
|
+
this.schema = schema;
|
|
23
|
+
this.boundHandler = this.handleEvent.bind(this);
|
|
24
|
+
this.initializeListeners();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Subscribes to the EventBus for real-time field change interception.
|
|
29
|
+
*/
|
|
30
|
+
private initializeListeners(): void {
|
|
31
|
+
EventBus.getInstance().subscribe(this.boundHandler);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Internal handler to evaluate business rules when a field is updated.
|
|
36
|
+
* @param event The structured change event.
|
|
37
|
+
*/
|
|
38
|
+
private handleEvent(event: IFieldChangeEvent): void {
|
|
39
|
+
// Architecture hook: Logic to evaluate conditions against the schema
|
|
40
|
+
// and update plugin properties will be injected here in later phases.
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Cleans up EventBus listeners to prevent memory leaks on destruction.
|
|
45
|
+
*/
|
|
46
|
+
public destroy(): void {
|
|
47
|
+
EventBus.getInstance().unsubscribe(this.boundHandler);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -1,59 +1,82 @@
|
|
|
1
|
-
sap.ui.define(["./ConditionEngine", "sap/m/VBox"], function (___ConditionEngine, VBox) {
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @file Engine.ts
|
|
6
|
-
* @description The central orchestrator that routes data between the Layout Factory and Plugin Registry.
|
|
7
|
-
*/
|
|
8
|
-
const ConditionEngine = ___ConditionEngine["ConditionEngine"];
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
1
|
+
sap.ui.define(["./ConditionEngine", "sap/m/VBox"], function (___ConditionEngine, VBox) {
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @file Engine.ts
|
|
6
|
+
* @description The central orchestrator that routes data between the Layout Factory and Plugin Registry (v2).
|
|
7
|
+
*/
|
|
8
|
+
const ConditionEngine = ___ConditionEngine["ConditionEngine"];
|
|
9
|
+
class Engine {
|
|
10
|
+
conditionEngine = null;
|
|
11
|
+
activePlugins = [];
|
|
12
|
+
build(schema, layoutManager, modelName = "meta") {
|
|
13
|
+
this.conditionEngine = new ConditionEngine(schema);
|
|
14
|
+
this.activePlugins = [];
|
|
15
|
+
const trackPlugin = plugin => this.activePlugins.push(plugin);
|
|
16
|
+
|
|
17
|
+
// Implicit layout routing based on root type
|
|
18
|
+
if (schema.type === "array") {
|
|
19
|
+
if (!schema.items) {
|
|
20
|
+
throw new Error("[MetaUI] Array schema must define 'items'.");
|
|
21
|
+
}
|
|
22
|
+
return layoutManager.renderTable(schema.items, `${modelName}>/`, schema.title);
|
|
23
|
+
}
|
|
24
|
+
if (schema.type === "object") {
|
|
25
|
+
const container = new VBox({
|
|
26
|
+
renderType: "Bare"
|
|
27
|
+
});
|
|
28
|
+
const props = schema.properties || {};
|
|
29
|
+
|
|
30
|
+
// Separate scalar properties (form fields) from root array properties (inline tables)
|
|
31
|
+
const formProps = {};
|
|
32
|
+
const tableProps = [];
|
|
33
|
+
for (const key of Object.keys(props)) {
|
|
34
|
+
if (props[key].type === "array") {
|
|
35
|
+
tableProps.push({
|
|
36
|
+
key,
|
|
37
|
+
meta: props[key]
|
|
38
|
+
});
|
|
39
|
+
} else {
|
|
40
|
+
formProps[key] = props[key];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Render the top-level form if there are scalar fields
|
|
45
|
+
if (Object.keys(formProps).length > 0) {
|
|
46
|
+
container.addItem(layoutManager.renderForm(formProps, modelName, schema.title, trackPlugin));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Render root-level arrays as massive native tables below the form
|
|
50
|
+
for (const tableProp of tableProps) {
|
|
51
|
+
if (tableProp.meta.items) {
|
|
52
|
+
container.addItem(layoutManager.renderTable(tableProp.meta.items, `${modelName}>/${tableProp.key}`, tableProp.meta.ui?.label || tableProp.key));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return container;
|
|
56
|
+
}
|
|
57
|
+
throw new Error(`[MetaUI] Unsupported schema type: ${schema.type}`);
|
|
58
|
+
}
|
|
59
|
+
validateAll() {
|
|
60
|
+
let isValid = true;
|
|
61
|
+
for (const plugin of this.activePlugins) {
|
|
62
|
+
if (!plugin.validate()) {
|
|
63
|
+
isValid = false;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return isValid;
|
|
67
|
+
}
|
|
68
|
+
destroy() {
|
|
69
|
+
if (this.conditionEngine) {
|
|
70
|
+
this.conditionEngine.destroy();
|
|
71
|
+
this.conditionEngine = null;
|
|
72
|
+
}
|
|
73
|
+
this.activePlugins = [];
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
var __exports = {
|
|
77
|
+
__esModule: true
|
|
78
|
+
};
|
|
79
|
+
__exports.Engine = Engine;
|
|
80
|
+
return __exports;
|
|
81
|
+
});
|
|
59
82
|
//# sourceMappingURL=Engine-dbg.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Engine-dbg.js","names":["ConditionEngine","___ConditionEngine","Engine","conditionEngine","build","schema","layoutManager","
|
|
1
|
+
{"version":3,"file":"Engine-dbg.js","names":["ConditionEngine","___ConditionEngine","Engine","conditionEngine","activePlugins","build","schema","layoutManager","modelName","trackPlugin","plugin","push","type","items","Error","renderTable","title","container","VBox","renderType","props","properties","formProps","tableProps","key","Object","keys","meta","length","addItem","renderForm","tableProp","ui","label","validateAll","isValid","validate","destroy","__exports","__esModule"],"sources":["Engine.ts"],"sourcesContent":["/**\n * @file Engine.ts\n * @description The central orchestrator that routes data between the Layout Factory and Plugin Registry (v2).\n */\n\nimport { ISchema, IPropertyMetadata } from \"../interfaces/ISchema\";\nimport { ILayoutManager } from \"../interfaces/ILayoutManager\";\nimport { IPlugin } from \"../interfaces/IPlugin\";\nimport { ConditionEngine } from \"./ConditionEngine\";\nimport Control from \"sap/ui/core/Control\";\nimport VBox from \"sap/m/VBox\";\n\nexport class Engine {\n private conditionEngine: ConditionEngine | null = null;\n private activePlugins: IPlugin[] = [];\n \n public build(schema: ISchema, layoutManager: ILayoutManager, modelName: string = \"meta\"): Control {\n this.conditionEngine = new ConditionEngine(schema);\n this.activePlugins = [];\n\n const trackPlugin = (plugin: IPlugin) => this.activePlugins.push(plugin);\n \n // Implicit layout routing based on root type\n if (schema.type === \"array\") {\n if (!schema.items) {\n throw new Error(\"[MetaUI] Array schema must define 'items'.\");\n }\n return layoutManager.renderTable(schema.items, `${modelName}>/`, schema.title);\n }\n \n if (schema.type === \"object\") {\n const container = new VBox({ renderType: \"Bare\" });\n const props = schema.properties || {};\n \n // Separate scalar properties (form fields) from root array properties (inline tables)\n const formProps: Record<string, IPropertyMetadata> = {};\n const tableProps: { key: string; meta: IPropertyMetadata }[] = [];\n \n for (const key of Object.keys(props)) {\n if (props[key].type === \"array\") {\n tableProps.push({ key, meta: props[key] });\n } else {\n formProps[key] = props[key];\n }\n }\n \n // Render the top-level form if there are scalar fields\n if (Object.keys(formProps).length > 0) {\n container.addItem(layoutManager.renderForm(formProps, modelName, schema.title, trackPlugin));\n }\n \n // Render root-level arrays as massive native tables below the form\n for (const tableProp of tableProps) {\n if (tableProp.meta.items) {\n container.addItem(layoutManager.renderTable(tableProp.meta.items, `${modelName}>/${tableProp.key}`, tableProp.meta.ui?.label || tableProp.key));\n }\n }\n \n return container;\n }\n \n throw new Error(`[MetaUI] Unsupported schema type: ${schema.type}`);\n }\n\n public validateAll(): boolean {\n let isValid = true;\n for (const plugin of this.activePlugins) {\n if (!plugin.validate()) {\n isValid = false;\n }\n }\n return isValid;\n }\n\n public destroy(): void {\n if (this.conditionEngine) {\n this.conditionEngine.destroy();\n this.conditionEngine = null;\n }\n this.activePlugins = [];\n }\n}\n"],"mappings":";;;EAAA;AACA;AACA;AACA;EAHA,MAQSA,eAAe,GAAAC,kBAAA;EAIjB,MAAMC,MAAM,CAAC;IACRC,eAAe,GAA2B,IAAI;IAC9CC,aAAa,GAAc,EAAE;IAE9BC,KAAKA,CAACC,MAAe,EAAEC,aAA6B,EAAEC,SAAiB,GAAG,MAAM,EAAW;MAC9F,IAAI,CAACL,eAAe,GAAG,IAAIH,eAAe,CAACM,MAAM,CAAC;MAClD,IAAI,CAACF,aAAa,GAAG,EAAE;MAEvB,MAAMK,WAAW,GAAIC,MAAe,IAAK,IAAI,CAACN,aAAa,CAACO,IAAI,CAACD,MAAM,CAAC;;MAExE;MACA,IAAIJ,MAAM,CAACM,IAAI,KAAK,OAAO,EAAE;QACzB,IAAI,CAACN,MAAM,CAACO,KAAK,EAAE;UACf,MAAM,IAAIC,KAAK,CAAC,4CAA4C,CAAC;QACjE;QACA,OAAOP,aAAa,CAACQ,WAAW,CAACT,MAAM,CAACO,KAAK,EAAE,GAAGL,SAAS,IAAI,EAAEF,MAAM,CAACU,KAAK,CAAC;MAClF;MAEA,IAAIV,MAAM,CAACM,IAAI,KAAK,QAAQ,EAAE;QAC1B,MAAMK,SAAS,GAAG,IAAIC,IAAI,CAAC;UAAEC,UAAU,EAAE;QAAO,CAAC,CAAC;QAClD,MAAMC,KAAK,GAAGd,MAAM,CAACe,UAAU,IAAI,CAAC,CAAC;;QAErC;QACA,MAAMC,SAA4C,GAAG,CAAC,CAAC;QACvD,MAAMC,UAAsD,GAAG,EAAE;QAEjE,KAAK,MAAMC,GAAG,IAAIC,MAAM,CAACC,IAAI,CAACN,KAAK,CAAC,EAAE;UAClC,IAAIA,KAAK,CAACI,GAAG,CAAC,CAACZ,IAAI,KAAK,OAAO,EAAE;YAC7BW,UAAU,CAACZ,IAAI,CAAC;cAAEa,GAAG;cAAEG,IAAI,EAAEP,KAAK,CAACI,GAAG;YAAE,CAAC,CAAC;UAC9C,CAAC,MAAM;YACHF,SAAS,CAACE,GAAG,CAAC,GAAGJ,KAAK,CAACI,GAAG,CAAC;UAC/B;QACJ;;QAEA;QACA,IAAIC,MAAM,CAACC,IAAI,CAACJ,SAAS,CAAC,CAACM,MAAM,GAAG,CAAC,EAAE;UACnCX,SAAS,CAACY,OAAO,CAACtB,aAAa,CAACuB,UAAU,CAACR,SAAS,EAAEd,SAAS,EAAEF,MAAM,CAACU,KAAK,EAAEP,WAAW,CAAC,CAAC;QAChG;;QAEA;QACA,KAAK,MAAMsB,SAAS,IAAIR,UAAU,EAAE;UAChC,IAAIQ,SAAS,CAACJ,IAAI,CAACd,KAAK,EAAE;YACtBI,SAAS,CAACY,OAAO,CAACtB,aAAa,CAACQ,WAAW,CAACgB,SAAS,CAACJ,IAAI,CAACd,KAAK,EAAE,GAAGL,SAAS,KAAKuB,SAAS,CAACP,GAAG,EAAE,EAAEO,SAAS,CAACJ,IAAI,CAACK,EAAE,EAAEC,KAAK,IAAIF,SAAS,CAACP,GAAG,CAAC,CAAC;UACnJ;QACJ;QAEA,OAAOP,SAAS;MACpB;MAEA,MAAM,IAAIH,KAAK,CAAC,qCAAqCR,MAAM,CAACM,IAAI,EAAE,CAAC;IACvE;IAEOsB,WAAWA,CAAA,EAAY;MAC1B,IAAIC,OAAO,GAAG,IAAI;MAClB,KAAK,MAAMzB,MAAM,IAAI,IAAI,CAACN,aAAa,EAAE;QACrC,IAAI,CAACM,MAAM,CAAC0B,QAAQ,CAAC,CAAC,EAAE;UACpBD,OAAO,GAAG,KAAK;QACnB;MACJ;MACA,OAAOA,OAAO;IAClB;IAEOE,OAAOA,CAAA,EAAS;MACnB,IAAI,IAAI,CAAClC,eAAe,EAAE;QACtB,IAAI,CAACA,eAAe,CAACkC,OAAO,CAAC,CAAC;QAC9B,IAAI,CAAClC,eAAe,GAAG,IAAI;MAC/B;MACA,IAAI,CAACC,aAAa,GAAG,EAAE;IAC3B;EACJ;EAAC,IAAAkC,SAAA;IAAAC,UAAA;EAAA;EAAAD,SAAA,CAAApC,MAAA,GAAAA,MAAA;EAAA,OAAAoC,SAAA;AAAA","ignoreList":[]}
|
|
@@ -1,24 +1,17 @@
|
|
|
1
1
|
declare module "nz/co/siliconst/ui5/metaui/core/Engine" {
|
|
2
2
|
/**
|
|
3
3
|
* @file Engine.ts
|
|
4
|
-
* @description The central orchestrator that routes data between the Layout Factory and Plugin Registry.
|
|
4
|
+
* @description The central orchestrator that routes data between the Layout Factory and Plugin Registry (v2).
|
|
5
5
|
*/
|
|
6
6
|
import { ISchema } from "nz/co/siliconst/ui5/metaui/interfaces/ISchema";
|
|
7
7
|
import { ILayoutManager } from "nz/co/siliconst/ui5/metaui/interfaces/ILayoutManager";
|
|
8
8
|
import Control from "sap/ui/core/Control";
|
|
9
|
-
/**
|
|
10
|
-
* The MetaUI Engine. Responsible for bootstrapping the layout generation.
|
|
11
|
-
* Follows strict Orchestrator patterns; delegates all actual rendering to LayoutManagers.
|
|
12
|
-
*/
|
|
13
9
|
export class Engine {
|
|
14
10
|
private conditionEngine;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
* @returns The populated UI5 layout container.
|
|
20
|
-
*/
|
|
21
|
-
build(schema: ISchema, layoutManager: ILayoutManager): Control;
|
|
11
|
+
private activePlugins;
|
|
12
|
+
build(schema: ISchema, layoutManager: ILayoutManager, modelName?: string): Control;
|
|
13
|
+
validateAll(): boolean;
|
|
14
|
+
destroy(): void;
|
|
22
15
|
}
|
|
23
16
|
}
|
|
24
17
|
//# sourceMappingURL=Engine.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Engine.d.ts","sourceRoot":"
|
|
1
|
+
{"version":3,"file":"Engine.d.ts","sourceRoot":"../../../../../../../..","sources":["src/nz/co/siliconst/ui5/metaui/core/Engine.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,wCAAwC,CAAC;IACxD;;;OAGG;IAEH,OAAO,EAAE,OAAO,EAAqB,MAAM,+CAA+C,CAAC;IAC3F,OAAO,EAAE,cAAc,EAAE,MAAM,sDAAsD,CAAC;IAGtF,OAAO,OAAO,MAAM,qBAAqB,CAAC;IAG1C,MAAa,MAAM;QACf,OAAO,CAAC,eAAe,CAAgC;QACvD,OAAO,CAAC,aAAa,CAAiB;QAE/B,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,SAAS,GAAE,MAAe,GAAG,OAAO;QAgD1F,WAAW,IAAI,OAAO;QAUtB,OAAO,IAAI,IAAI;KAOzB;CAEA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
sap.ui.define(["./ConditionEngine","sap/m/VBox"],function(e,
|
|
1
|
+
sap.ui.define(["./ConditionEngine","sap/m/VBox"],function(e,t){"use strict";const i=e["ConditionEngine"];class n{conditionEngine=null;activePlugins=[];build(e,n,s="meta"){this.conditionEngine=new i(e);this.activePlugins=[];const r=e=>this.activePlugins.push(e);if(e.type==="array"){if(!e.items){throw new Error("[MetaUI] Array schema must define 'items'.")}return n.renderTable(e.items,`${s}>/`,e.title)}if(e.type==="object"){const i=new t({renderType:"Bare"});const o=e.properties||{};const a={};const c=[];for(const e of Object.keys(o)){if(o[e].type==="array"){c.push({key:e,meta:o[e]})}else{a[e]=o[e]}}if(Object.keys(a).length>0){i.addItem(n.renderForm(a,s,e.title,r))}for(const e of c){if(e.meta.items){i.addItem(n.renderTable(e.meta.items,`${s}>/${e.key}`,e.meta.ui?.label||e.key))}}return i}throw new Error(`[MetaUI] Unsupported schema type: ${e.type}`)}validateAll(){let e=true;for(const t of this.activePlugins){if(!t.validate()){e=false}}return e}destroy(){if(this.conditionEngine){this.conditionEngine.destroy();this.conditionEngine=null}this.activePlugins=[]}}var s={__esModule:true};s.Engine=n;return s});
|
|
2
2
|
//# sourceMappingURL=Engine.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Engine.js","names":["ConditionEngine","___ConditionEngine","Engine","conditionEngine","build","schema","layoutManager","this","
|
|
1
|
+
{"version":3,"file":"Engine.js","names":["ConditionEngine","___ConditionEngine","Engine","conditionEngine","activePlugins","build","schema","layoutManager","modelName","this","trackPlugin","plugin","push","type","items","Error","renderTable","title","container","VBox","renderType","props","properties","formProps","tableProps","key","Object","keys","meta","length","addItem","renderForm","tableProp","ui","label","validateAll","isValid","validate","destroy","__exports","__esModule"],"sources":["Engine.ts"],"sourcesContent":["/**\n * @file Engine.ts\n * @description The central orchestrator that routes data between the Layout Factory and Plugin Registry (v2).\n */\n\nimport { ISchema, IPropertyMetadata } from \"../interfaces/ISchema\";\nimport { ILayoutManager } from \"../interfaces/ILayoutManager\";\nimport { IPlugin } from \"../interfaces/IPlugin\";\nimport { ConditionEngine } from \"./ConditionEngine\";\nimport Control from \"sap/ui/core/Control\";\nimport VBox from \"sap/m/VBox\";\n\nexport class Engine {\n private conditionEngine: ConditionEngine | null = null;\n private activePlugins: IPlugin[] = [];\n \n public build(schema: ISchema, layoutManager: ILayoutManager, modelName: string = \"meta\"): Control {\n this.conditionEngine = new ConditionEngine(schema);\n this.activePlugins = [];\n\n const trackPlugin = (plugin: IPlugin) => this.activePlugins.push(plugin);\n \n // Implicit layout routing based on root type\n if (schema.type === \"array\") {\n if (!schema.items) {\n throw new Error(\"[MetaUI] Array schema must define 'items'.\");\n }\n return layoutManager.renderTable(schema.items, `${modelName}>/`, schema.title);\n }\n \n if (schema.type === \"object\") {\n const container = new VBox({ renderType: \"Bare\" });\n const props = schema.properties || {};\n \n // Separate scalar properties (form fields) from root array properties (inline tables)\n const formProps: Record<string, IPropertyMetadata> = {};\n const tableProps: { key: string; meta: IPropertyMetadata }[] = [];\n \n for (const key of Object.keys(props)) {\n if (props[key].type === \"array\") {\n tableProps.push({ key, meta: props[key] });\n } else {\n formProps[key] = props[key];\n }\n }\n \n // Render the top-level form if there are scalar fields\n if (Object.keys(formProps).length > 0) {\n container.addItem(layoutManager.renderForm(formProps, modelName, schema.title, trackPlugin));\n }\n \n // Render root-level arrays as massive native tables below the form\n for (const tableProp of tableProps) {\n if (tableProp.meta.items) {\n container.addItem(layoutManager.renderTable(tableProp.meta.items, `${modelName}>/${tableProp.key}`, tableProp.meta.ui?.label || tableProp.key));\n }\n }\n \n return container;\n }\n \n throw new Error(`[MetaUI] Unsupported schema type: ${schema.type}`);\n }\n\n public validateAll(): boolean {\n let isValid = true;\n for (const plugin of this.activePlugins) {\n if (!plugin.validate()) {\n isValid = false;\n }\n }\n return isValid;\n }\n\n public destroy(): void {\n if (this.conditionEngine) {\n this.conditionEngine.destroy();\n this.conditionEngine = null;\n }\n this.activePlugins = [];\n }\n}\n"],"mappings":"4EAAA,MAQSA,EAAeC,EAAA,mBAIjB,MAAMC,EACDC,gBAA0C,KAC1CC,cAA2B,GAE5BC,MAAMC,EAAiBC,EAA+BC,EAAoB,QAC7EC,KAAKN,gBAAkB,IAAIH,EAAgBM,GAC3CG,KAAKL,cAAgB,GAErB,MAAMM,EAAeC,GAAoBF,KAAKL,cAAcQ,KAAKD,GAGjE,GAAIL,EAAOO,OAAS,QAAS,CACzB,IAAKP,EAAOQ,MAAO,CACf,MAAM,IAAIC,MAAM,6CACpB,CACA,OAAOR,EAAcS,YAAYV,EAAOQ,MAAO,GAAGN,MAAeF,EAAOW,MAC5E,CAEA,GAAIX,EAAOO,OAAS,SAAU,CAC1B,MAAMK,EAAY,IAAIC,EAAK,CAAEC,WAAY,SACzC,MAAMC,EAAQf,EAAOgB,YAAc,CAAC,EAGpC,MAAMC,EAA+C,CAAC,EACtD,MAAMC,EAAyD,GAE/D,IAAK,MAAMC,KAAOC,OAAOC,KAAKN,GAAQ,CAClC,GAAIA,EAAMI,GAAKZ,OAAS,QAAS,CAC7BW,EAAWZ,KAAK,CAAEa,MAAKG,KAAMP,EAAMI,IACvC,KAAO,CACHF,EAAUE,GAAOJ,EAAMI,EAC3B,CACJ,CAGA,GAAIC,OAAOC,KAAKJ,GAAWM,OAAS,EAAG,CACnCX,EAAUY,QAAQvB,EAAcwB,WAAWR,EAAWf,EAAWF,EAAOW,MAAOP,GACnF,CAGA,IAAK,MAAMsB,KAAaR,EAAY,CAChC,GAAIQ,EAAUJ,KAAKd,MAAO,CACtBI,EAAUY,QAAQvB,EAAcS,YAAYgB,EAAUJ,KAAKd,MAAO,GAAGN,MAAcwB,EAAUP,MAAOO,EAAUJ,KAAKK,IAAIC,OAASF,EAAUP,KAC9I,CACJ,CAEA,OAAOP,CACX,CAEA,MAAM,IAAIH,MAAM,qCAAqCT,EAAOO,OAChE,CAEOsB,cACH,IAAIC,EAAU,KACd,IAAK,MAAMzB,KAAUF,KAAKL,cAAe,CACrC,IAAKO,EAAO0B,WAAY,CACpBD,EAAU,KACd,CACJ,CACA,OAAOA,CACX,CAEOE,UACH,GAAI7B,KAAKN,gBAAiB,CACtBM,KAAKN,gBAAgBmC,UACrB7B,KAAKN,gBAAkB,IAC3B,CACAM,KAAKL,cAAgB,EACzB,EACH,IAAAmC,EAAA,CAAAC,WAAA,MAAAD,EAAArC,SAAA,OAAAqC,CAAA","ignoreList":[]}
|
|
@@ -1,56 +1,82 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Engine.ts
|
|
3
|
-
* @description The central orchestrator that routes data between the Layout Factory and Plugin Registry.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { ISchema } from "../interfaces/ISchema";
|
|
7
|
-
import { ILayoutManager } from "../interfaces/ILayoutManager";
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @file Engine.ts
|
|
3
|
+
* @description The central orchestrator that routes data between the Layout Factory and Plugin Registry (v2).
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { ISchema, IPropertyMetadata } from "../interfaces/ISchema";
|
|
7
|
+
import { ILayoutManager } from "../interfaces/ILayoutManager";
|
|
8
|
+
import { IPlugin } from "../interfaces/IPlugin";
|
|
9
|
+
import { ConditionEngine } from "./ConditionEngine";
|
|
10
|
+
import Control from "sap/ui/core/Control";
|
|
11
|
+
import VBox from "sap/m/VBox";
|
|
12
|
+
|
|
13
|
+
export class Engine {
|
|
14
|
+
private conditionEngine: ConditionEngine | null = null;
|
|
15
|
+
private activePlugins: IPlugin[] = [];
|
|
16
|
+
|
|
17
|
+
public build(schema: ISchema, layoutManager: ILayoutManager, modelName: string = "meta"): Control {
|
|
18
|
+
this.conditionEngine = new ConditionEngine(schema);
|
|
19
|
+
this.activePlugins = [];
|
|
20
|
+
|
|
21
|
+
const trackPlugin = (plugin: IPlugin) => this.activePlugins.push(plugin);
|
|
22
|
+
|
|
23
|
+
// Implicit layout routing based on root type
|
|
24
|
+
if (schema.type === "array") {
|
|
25
|
+
if (!schema.items) {
|
|
26
|
+
throw new Error("[MetaUI] Array schema must define 'items'.");
|
|
27
|
+
}
|
|
28
|
+
return layoutManager.renderTable(schema.items, `${modelName}>/`, schema.title);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (schema.type === "object") {
|
|
32
|
+
const container = new VBox({ renderType: "Bare" });
|
|
33
|
+
const props = schema.properties || {};
|
|
34
|
+
|
|
35
|
+
// Separate scalar properties (form fields) from root array properties (inline tables)
|
|
36
|
+
const formProps: Record<string, IPropertyMetadata> = {};
|
|
37
|
+
const tableProps: { key: string; meta: IPropertyMetadata }[] = [];
|
|
38
|
+
|
|
39
|
+
for (const key of Object.keys(props)) {
|
|
40
|
+
if (props[key].type === "array") {
|
|
41
|
+
tableProps.push({ key, meta: props[key] });
|
|
42
|
+
} else {
|
|
43
|
+
formProps[key] = props[key];
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Render the top-level form if there are scalar fields
|
|
48
|
+
if (Object.keys(formProps).length > 0) {
|
|
49
|
+
container.addItem(layoutManager.renderForm(formProps, modelName, schema.title, trackPlugin));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Render root-level arrays as massive native tables below the form
|
|
53
|
+
for (const tableProp of tableProps) {
|
|
54
|
+
if (tableProp.meta.items) {
|
|
55
|
+
container.addItem(layoutManager.renderTable(tableProp.meta.items, `${modelName}>/${tableProp.key}`, tableProp.meta.ui?.label || tableProp.key));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return container;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
throw new Error(`[MetaUI] Unsupported schema type: ${schema.type}`);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
public validateAll(): boolean {
|
|
66
|
+
let isValid = true;
|
|
67
|
+
for (const plugin of this.activePlugins) {
|
|
68
|
+
if (!plugin.validate()) {
|
|
69
|
+
isValid = false;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return isValid;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
public destroy(): void {
|
|
76
|
+
if (this.conditionEngine) {
|
|
77
|
+
this.conditionEngine.destroy();
|
|
78
|
+
this.conditionEngine = null;
|
|
79
|
+
}
|
|
80
|
+
this.activePlugins = [];
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -1,51 +1,66 @@
|
|
|
1
|
-
sap.ui.define([], function () {
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @file EventBus.ts
|
|
6
|
-
* @description Internal pub/sub channel for managing cross-field dependencies.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Singleton orchestrator for localized state changes across the generated UI layout.
|
|
11
|
-
*/
|
|
12
|
-
class EventBus {
|
|
13
|
-
listeners = [];
|
|
14
|
-
constructor() {
|
|
15
|
-
// Enforce singleton
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Retrieves the singular instance of the EventBus.
|
|
20
|
-
* @returns The EventBus singleton.
|
|
21
|
-
*/
|
|
22
|
-
static getInstance() {
|
|
23
|
-
if (!EventBus.instance) {
|
|
24
|
-
EventBus.instance = new EventBus();
|
|
25
|
-
}
|
|
26
|
-
return EventBus.instance;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Publishes a value change event to all internal subscribers.
|
|
31
|
-
* @param event The structured payload of the field change.
|
|
32
|
-
*/
|
|
33
|
-
publishFieldChange(event) {
|
|
34
|
-
this.listeners.forEach(listener => listener(event));
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Registers a callback listener to react to field changes.
|
|
39
|
-
* @param listener The callback function.
|
|
40
|
-
*/
|
|
41
|
-
subscribe(listener) {
|
|
42
|
-
this.listeners.push(listener);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
1
|
+
sap.ui.define([], function () {
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @file EventBus.ts
|
|
6
|
+
* @description Internal pub/sub channel for managing cross-field dependencies.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Singleton orchestrator for localized state changes across the generated UI layout.
|
|
11
|
+
*/
|
|
12
|
+
class EventBus {
|
|
13
|
+
listeners = [];
|
|
14
|
+
constructor() {
|
|
15
|
+
// Enforce singleton
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Retrieves the singular instance of the EventBus.
|
|
20
|
+
* @returns The EventBus singleton.
|
|
21
|
+
*/
|
|
22
|
+
static getInstance() {
|
|
23
|
+
if (!EventBus.instance) {
|
|
24
|
+
EventBus.instance = new EventBus();
|
|
25
|
+
}
|
|
26
|
+
return EventBus.instance;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Publishes a value change event to all internal subscribers.
|
|
31
|
+
* @param event The structured payload of the field change.
|
|
32
|
+
*/
|
|
33
|
+
publishFieldChange(event) {
|
|
34
|
+
this.listeners.forEach(listener => listener(event));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Registers a callback listener to react to field changes.
|
|
39
|
+
* @param listener The callback function.
|
|
40
|
+
*/
|
|
41
|
+
subscribe(listener) {
|
|
42
|
+
this.listeners.push(listener);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Unregisters a callback listener to prevent memory leaks.
|
|
47
|
+
* @param listener The callback function to remove.
|
|
48
|
+
*/
|
|
49
|
+
unsubscribe(listener) {
|
|
50
|
+
this.listeners = this.listeners.filter(l => l !== listener);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Unregisters all callback listeners.
|
|
55
|
+
*/
|
|
56
|
+
unsubscribeAll() {
|
|
57
|
+
this.listeners = [];
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
var __exports = {
|
|
61
|
+
__esModule: true
|
|
62
|
+
};
|
|
63
|
+
__exports.EventBus = EventBus;
|
|
64
|
+
return __exports;
|
|
65
|
+
});
|
|
51
66
|
//# sourceMappingURL=EventBus-dbg.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventBus-dbg.js","names":["EventBus","listeners","constructor","getInstance","instance","publishFieldChange","event","forEach","listener","subscribe","push","__exports","__esModule"],"sources":["EventBus.ts"],"sourcesContent":["/**\
|
|
1
|
+
{"version":3,"file":"EventBus-dbg.js","names":["EventBus","listeners","constructor","getInstance","instance","publishFieldChange","event","forEach","listener","subscribe","push","unsubscribe","filter","l","unsubscribeAll","__exports","__esModule"],"sources":["EventBus.ts"],"sourcesContent":["/**\n * @file EventBus.ts\n * @description Internal pub/sub channel for managing cross-field dependencies.\n */\n\nimport { IEventBus, IFieldChangeEvent } from \"../interfaces/IEventBus\";\n\n/**\n * Singleton orchestrator for localized state changes across the generated UI layout.\n */\nexport class EventBus implements IEventBus {\n private static instance: EventBus;\n private listeners: Array<(event: IFieldChangeEvent) => void> = [];\n\n private constructor() {\n // Enforce singleton\n }\n\n /**\n * Retrieves the singular instance of the EventBus.\n * @returns The EventBus singleton.\n */\n public static getInstance(): EventBus {\n if (!EventBus.instance) {\n EventBus.instance = new EventBus();\n }\n return EventBus.instance;\n }\n\n /**\n * Publishes a value change event to all internal subscribers.\n * @param event The structured payload of the field change.\n */\n public publishFieldChange(event: IFieldChangeEvent): void {\n this.listeners.forEach(listener => listener(event));\n }\n\n /**\n * Registers a callback listener to react to field changes.\n * @param listener The callback function.\n */\n public subscribe(listener: (event: IFieldChangeEvent) => void): void {\n this.listeners.push(listener);\n }\n\n /**\n * Unregisters a callback listener to prevent memory leaks.\n * @param listener The callback function to remove.\n */\n public unsubscribe(listener: (event: IFieldChangeEvent) => void): void {\n this.listeners = this.listeners.filter(l => l !== listener);\n }\n\n /**\n * Unregisters all callback listeners.\n */\n public unsubscribeAll(): void {\n this.listeners = [];\n }\n}\n"],"mappings":";;;EAAA;AACA;AACA;AACA;;EAIA;AACA;AACA;EACO,MAAMA,QAAQ,CAAsB;IAE/BC,SAAS,GAA8C,EAAE;IAEzDC,WAAWA,CAAA,EAAG;MAClB;IAAA;;IAGJ;AACJ;AACA;AACA;IACI,OAAcC,WAAWA,CAAA,EAAa;MAClC,IAAI,CAACH,QAAQ,CAACI,QAAQ,EAAE;QACpBJ,QAAQ,CAACI,QAAQ,GAAG,IAAIJ,QAAQ,CAAC,CAAC;MACtC;MACA,OAAOA,QAAQ,CAACI,QAAQ;IAC5B;;IAEA;AACJ;AACA;AACA;IACWC,kBAAkBA,CAACC,KAAwB,EAAQ;MACtD,IAAI,CAACL,SAAS,CAACM,OAAO,CAACC,QAAQ,IAAIA,QAAQ,CAACF,KAAK,CAAC,CAAC;IACvD;;IAEA;AACJ;AACA;AACA;IACWG,SAASA,CAACD,QAA4C,EAAQ;MACjE,IAAI,CAACP,SAAS,CAACS,IAAI,CAACF,QAAQ,CAAC;IACjC;;IAEA;AACJ;AACA;AACA;IACWG,WAAWA,CAACH,QAA4C,EAAQ;MACnE,IAAI,CAACP,SAAS,GAAG,IAAI,CAACA,SAAS,CAACW,MAAM,CAACC,CAAC,IAAIA,CAAC,KAAKL,QAAQ,CAAC;IAC/D;;IAEA;AACJ;AACA;IACWM,cAAcA,CAAA,EAAS;MAC1B,IAAI,CAACb,SAAS,GAAG,EAAE;IACvB;EACJ;EAAC,IAAAc,SAAA;IAAAC,UAAA;EAAA;EAAAD,SAAA,CAAAf,QAAA,GAAAA,QAAA;EAAA,OAAAe,SAAA;AAAA","ignoreList":[]}
|