@siliconst/metaui 1.0.0 → 1.0.2
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/package.json +21 -34
- package/src/nz/co/siliconst/ui5/metaui/controls/GeneratorHost-dbg.js +164 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/GeneratorHost-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/GeneratorHost.d.ts +82 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/GeneratorHost.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/GeneratorHost.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/GeneratorHost.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/ConditionEngine-dbg.js +44 -0
- package/src/nz/co/siliconst/ui5/metaui/core/ConditionEngine-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/ConditionEngine.d.ts +24 -0
- package/src/nz/co/siliconst/ui5/metaui/core/ConditionEngine.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/ConditionEngine.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/core/ConditionEngine.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/Engine-dbg.js +59 -0
- package/src/nz/co/siliconst/ui5/metaui/core/Engine-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/Engine.d.ts +24 -0
- package/src/nz/co/siliconst/ui5/metaui/core/Engine.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/Engine.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/core/Engine.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/EventBus-dbg.js +51 -0
- package/src/nz/co/siliconst/ui5/metaui/core/EventBus-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/EventBus.d.ts +31 -0
- package/src/nz/co/siliconst/ui5/metaui/core/EventBus.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/EventBus.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/core/EventBus.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry-dbg.js +60 -0
- package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry.d.ts +37 -0
- package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer-dbg.js +37 -0
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer.d.ts +20 -0
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/StateManager-dbg.js +56 -0
- package/src/nz/co/siliconst/ui5/metaui/core/StateManager-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/StateManager.d.ts +37 -0
- package/src/nz/co/siliconst/ui5/metaui/core/StateManager.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/StateManager.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/core/StateManager.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IEventBus-dbg.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IEventBus-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IEventBus.d.ts +29 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IEventBus.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IEventBus.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IEventBus.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ILayoutManager-dbg.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ILayoutManager-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ILayoutManager.d.ts +26 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ILayoutManager.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ILayoutManager.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ILayoutManager.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IPlugin-dbg.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IPlugin-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IPlugin.d.ts +32 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IPlugin.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IPlugin.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IPlugin.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchema-dbg.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchema-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchema.d.ts +68 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchema.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchema.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchema.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/BaseLayout-dbg.js +39 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/BaseLayout-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/BaseLayout.d.ts +28 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/BaseLayout.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/BaseLayout.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/BaseLayout.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout-dbg.js +57 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout.d.ts +20 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout-dbg.js +91 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout.d.ts +20 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/library-dbg.js +33 -0
- package/src/nz/co/siliconst/ui5/metaui/library-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/library-preload.js +34 -0
- package/src/nz/co/siliconst/ui5/metaui/library-preload.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/library.d.ts +10 -0
- package/src/nz/co/siliconst/ui5/metaui/library.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/library.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/library.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/manifest.json +34 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/BasePlugin-dbg.js +60 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/BasePlugin-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/BasePlugin.d.ts +43 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/BasePlugin.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/BasePlugin.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/BasePlugin.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/BooleanPlugin-dbg.js +43 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/BooleanPlugin-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/BooleanPlugin.d.ts +18 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/BooleanPlugin.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/BooleanPlugin.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/BooleanPlugin.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DatePlugin-dbg.js +61 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DatePlugin-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DatePlugin.d.ts +18 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DatePlugin.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DatePlugin.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DatePlugin.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DropdownPlugin-dbg.js +67 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DropdownPlugin-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DropdownPlugin.d.ts +18 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DropdownPlugin.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DropdownPlugin.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DropdownPlugin.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/NumberPlugin-dbg.js +54 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/NumberPlugin-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/NumberPlugin.d.ts +18 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/NumberPlugin.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/NumberPlugin.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/NumberPlugin.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/StringPlugin-dbg.js +54 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/StringPlugin-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/StringPlugin.d.ts +18 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/StringPlugin.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/StringPlugin.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/StringPlugin.js.map +1 -0
- package/test-resources/App.js +11 -0
- package/test-resources/Main.controller.js +73 -0
- package/test-resources/Main.view.xml +42 -0
- package/test-resources/index.html +21 -0
- package/test-resources/mockData.json +27 -0
- package/test-resources/mockSchema.json +98 -0
- package/ui5.yaml +1 -9
package/package.json
CHANGED
|
@@ -1,35 +1,22 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@siliconst/metaui",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Dynamic Metadata UI5 Engine",
|
|
5
|
-
"author": "SiliconStreetDev1",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "https://github.com/SiliconStreetDev1/MetaUI.git"
|
|
10
|
-
},
|
|
11
|
-
"keywords": [
|
|
12
|
-
"ui5",
|
|
13
|
-
"metadata",
|
|
14
|
-
"engine"
|
|
15
|
-
],
|
|
16
|
-
"files": [
|
|
17
|
-
"src",
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"build": "ui5 build --clean-dest"
|
|
23
|
-
},
|
|
24
|
-
"devDependencies": {
|
|
25
|
-
"@types/openui5": "^1.120.0",
|
|
26
|
-
"@ui5/cli": "^3.0.0",
|
|
27
|
-
"typescript": "^5.3.0",
|
|
28
|
-
"ui5-tooling-transpile": "^3.2.0"
|
|
29
|
-
},
|
|
30
|
-
"ui5": {
|
|
31
|
-
"dependencies": [
|
|
32
|
-
"ui5-tooling-transpile"
|
|
33
|
-
]
|
|
34
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@siliconst/metaui",
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "Dynamic Metadata UI5 Engine",
|
|
5
|
+
"author": "SiliconStreetDev1",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/SiliconStreetDev1/MetaUI.git"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"ui5",
|
|
13
|
+
"metadata",
|
|
14
|
+
"engine"
|
|
15
|
+
],
|
|
16
|
+
"files": [
|
|
17
|
+
"src",
|
|
18
|
+
"test-resources",
|
|
19
|
+
"ui5.yaml",
|
|
20
|
+
"README.md"
|
|
21
|
+
]
|
|
35
22
|
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
sap.ui.define(["sap/ui/core/Control", "sap/m/Dialog", "sap/m/Button", "../core/SchemaNormalizer", "../core/Engine", "../core/StateManager", "../layouts/BaseLayout"], function (Control, Dialog, Button, ___core_SchemaNormalizer, ___core_Engine, ___core_StateManager, ___layouts_BaseLayout) {
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const SchemaNormalizer = ___core_SchemaNormalizer["SchemaNormalizer"];
|
|
5
|
+
const Engine = ___core_Engine["Engine"];
|
|
6
|
+
const StateManager = ___core_StateManager["StateManager"];
|
|
7
|
+
const BaseLayout = ___layouts_BaseLayout["BaseLayout"];
|
|
8
|
+
/**
|
|
9
|
+
* Enterprise wrapper element for embedding or popping the dynamic form.
|
|
10
|
+
*
|
|
11
|
+
* @namespace nz.co.siliconst.ui5.metaui.controls
|
|
12
|
+
*/
|
|
13
|
+
const GeneratorHost = Control.extend("nz.co.siliconst.ui5.metaui.controls.GeneratorHost", {
|
|
14
|
+
constructor: function constructor() {
|
|
15
|
+
Control.prototype.constructor.apply(this, arguments);
|
|
16
|
+
this.stateManager = null;
|
|
17
|
+
this.generatedContent = null;
|
|
18
|
+
},
|
|
19
|
+
/**
|
|
20
|
+
* Standard UI5 control renderer. Renders the generated internal content.
|
|
21
|
+
*/
|
|
22
|
+
renderer: {
|
|
23
|
+
apiVersion: 2,
|
|
24
|
+
render(rm, control) {
|
|
25
|
+
rm.openStart("div", control);
|
|
26
|
+
rm.style("width", "100%");
|
|
27
|
+
rm.style("height", "100%");
|
|
28
|
+
rm.openEnd();
|
|
29
|
+
const content = control.getAggregation("_content");
|
|
30
|
+
if (content) {
|
|
31
|
+
rm.renderControl(content);
|
|
32
|
+
}
|
|
33
|
+
rm.close("div");
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
metadata: {
|
|
37
|
+
properties: {
|
|
38
|
+
/** The raw JSON metadata schema provided by the ABAP backend. */
|
|
39
|
+
schemaDefinition: {
|
|
40
|
+
type: "object",
|
|
41
|
+
defaultValue: null
|
|
42
|
+
},
|
|
43
|
+
/** The initial data payload to populate the fields. */
|
|
44
|
+
initialData: {
|
|
45
|
+
type: "object",
|
|
46
|
+
defaultValue: {}
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
aggregations: {
|
|
50
|
+
/** The internal hidden container holding the generated layouts. */
|
|
51
|
+
_content: {
|
|
52
|
+
type: "sap.ui.core.Control",
|
|
53
|
+
multiple: false,
|
|
54
|
+
visibility: "hidden"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
events: {
|
|
58
|
+
/** Triggered when the user submits the form via the Dialog modality. */
|
|
59
|
+
submit: {
|
|
60
|
+
parameters: {
|
|
61
|
+
/** The clean extracted JSON payload representing the current state. */
|
|
62
|
+
payload: {
|
|
63
|
+
type: "object"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
/** Triggered if the dialog is cancelled. */
|
|
68
|
+
cancel: {}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
/**
|
|
72
|
+
* Initializes the UI5 control.
|
|
73
|
+
*/
|
|
74
|
+
init: function _init() {
|
|
75
|
+
Control.prototype.init.call(this);
|
|
76
|
+
},
|
|
77
|
+
/**
|
|
78
|
+
* Lifecycle hook to automatically generate the layout if bound declaratively in XML.
|
|
79
|
+
*/
|
|
80
|
+
onBeforeRendering: function _onBeforeRendering() {
|
|
81
|
+
if (!this.generatedContent && this.getProperty("schemaDefinition")) {
|
|
82
|
+
this.generate();
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
/**
|
|
86
|
+
* Extracts the payload and fires the submit event manually. Useful for inline XML embedding.
|
|
87
|
+
*/
|
|
88
|
+
triggerSubmit: function _triggerSubmit() {
|
|
89
|
+
if (this.stateManager) {
|
|
90
|
+
const payload = this.stateManager.extractPayload();
|
|
91
|
+
this.fireEvent("submit", {
|
|
92
|
+
payload
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
/**
|
|
97
|
+
* Triggers the engine to parse the schema and build the layout.
|
|
98
|
+
* Must be called manually or hooked into onBeforeRendering if properties are bound.
|
|
99
|
+
*/
|
|
100
|
+
generate: function _generate() {
|
|
101
|
+
const rawSchema = this.getProperty("schemaDefinition");
|
|
102
|
+
const initialData = this.getProperty("initialData");
|
|
103
|
+
if (!rawSchema) {
|
|
104
|
+
throw new Error("[MetaUI] Cannot generate layout without a schemaDefinition.");
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// 1. Normalize schema
|
|
108
|
+
const normalizedSchema = SchemaNormalizer.normalize(rawSchema);
|
|
109
|
+
|
|
110
|
+
// 2. Bootstrap isolated State Manager
|
|
111
|
+
this.stateManager = new StateManager(initialData);
|
|
112
|
+
this.setModel(this.stateManager.getModel(), "meta");
|
|
113
|
+
|
|
114
|
+
// 3. Delegate to Layout Engine
|
|
115
|
+
const engine = new Engine();
|
|
116
|
+
const layoutFactory = new BaseLayout();
|
|
117
|
+
this.generatedContent = engine.build(normalizedSchema, layoutFactory);
|
|
118
|
+
|
|
119
|
+
// 4. Mount into hidden aggregation
|
|
120
|
+
this.setAggregation("_content", this.generatedContent);
|
|
121
|
+
},
|
|
122
|
+
/**
|
|
123
|
+
* Dialog Modality: Opens the generated layout inside a sap.m.Dialog.
|
|
124
|
+
* Automatically wires up 'Save' and 'Cancel' buttons.
|
|
125
|
+
*/
|
|
126
|
+
openInDialog: function _openInDialog(title = "Dynamic Form", submitButtonText = "Save") {
|
|
127
|
+
if (!this.generatedContent) {
|
|
128
|
+
this.generate();
|
|
129
|
+
}
|
|
130
|
+
const dialog = new Dialog({
|
|
131
|
+
title: title,
|
|
132
|
+
contentWidth: "800px",
|
|
133
|
+
content: [this],
|
|
134
|
+
// Mount self inside the dialog
|
|
135
|
+
beginButton: new Button({
|
|
136
|
+
text: submitButtonText,
|
|
137
|
+
type: "Emphasized",
|
|
138
|
+
press: () => {
|
|
139
|
+
if (this.stateManager) {
|
|
140
|
+
const payload = this.stateManager.extractPayload();
|
|
141
|
+
this.fireEvent("submit", {
|
|
142
|
+
payload
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
dialog.close();
|
|
146
|
+
}
|
|
147
|
+
}),
|
|
148
|
+
endButton: new Button({
|
|
149
|
+
text: "Cancel",
|
|
150
|
+
press: () => {
|
|
151
|
+
this.fireEvent("cancel");
|
|
152
|
+
dialog.close();
|
|
153
|
+
}
|
|
154
|
+
}),
|
|
155
|
+
afterClose: () => {
|
|
156
|
+
dialog.destroy();
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
dialog.open();
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
return GeneratorHost;
|
|
163
|
+
});
|
|
164
|
+
//# sourceMappingURL=GeneratorHost-dbg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeneratorHost-dbg.js","names":["SchemaNormalizer","___core_SchemaNormalizer","Engine","___core_Engine","StateManager","___core_StateManager","BaseLayout","___layouts_BaseLayout","GeneratorHost","Control","extend","constructor","prototype","apply","arguments","stateManager","generatedContent","renderer","apiVersion","render","rm","control","openStart","style","openEnd","content","getAggregation","renderControl","close","metadata","properties","schemaDefinition","type","defaultValue","initialData","aggregations","_content","multiple","visibility","events","submit","parameters","payload","cancel","init","_init","Control.prototype.init.call","onBeforeRendering","_onBeforeRendering","getProperty","generate","triggerSubmit","_triggerSubmit","extractPayload","fireEvent","_generate","rawSchema","Error","normalizedSchema","normalize","setModel","getModel","engine","layoutFactory","build","setAggregation","openInDialog","_openInDialog","title","submitButtonText","dialog","Dialog","contentWidth","beginButton","Button","text","press","endButton","afterClose","destroy","open"],"sources":["GeneratorHost.ts"],"sourcesContent":["/**\r\n * @file GeneratorHost.ts\r\n * @description The core UI5 custom control that exposes the MetaUI engine to host applications.\r\n */\r\n\r\nimport Control from \"sap/ui/core/Control\";\r\nimport RenderManager from \"sap/ui/core/RenderManager\";\r\nimport Dialog from \"sap/m/Dialog\";\r\nimport Button from \"sap/m/Button\";\r\nimport { SchemaNormalizer } from \"../core/SchemaNormalizer\";\r\nimport { Engine } from \"../core/Engine\";\r\nimport { StateManager } from \"../core/StateManager\";\r\nimport { BaseLayout } from \"../layouts/BaseLayout\";\r\n\r\n/**\r\n * Enterprise wrapper element for embedding or popping the dynamic form.\r\n * \r\n * @namespace nz.co.siliconst.ui5.metaui.controls\r\n */\r\nexport default class GeneratorHost extends Control {\r\n \r\n private stateManager: StateManager | null = null;\r\n private generatedContent: Control | null = null;\r\n\r\n static readonly metadata = {\r\n properties: {\r\n /** The raw JSON metadata schema provided by the ABAP backend. */\r\n schemaDefinition: { type: \"object\", defaultValue: null },\r\n /** The initial data payload to populate the fields. */\r\n initialData: { type: \"object\", defaultValue: {} }\r\n },\r\n aggregations: {\r\n /** The internal hidden container holding the generated layouts. */\r\n _content: { type: \"sap.ui.core.Control\", multiple: false, visibility: \"hidden\" }\r\n },\r\n events: {\r\n /** Triggered when the user submits the form via the Dialog modality. */\r\n submit: {\r\n parameters: {\r\n /** The clean extracted JSON payload representing the current state. */\r\n payload: { type: \"object\" }\r\n }\r\n },\r\n /** Triggered if the dialog is cancelled. */\r\n cancel: {}\r\n }\r\n };\r\n\r\n /**\r\n * Standard UI5 control renderer. Renders the generated internal content.\r\n */\r\n static renderer = {\r\n apiVersion: 2,\r\n render(rm: RenderManager, control: GeneratorHost) {\r\n rm.openStart(\"div\", control);\r\n rm.style(\"width\", \"100%\");\r\n rm.style(\"height\", \"100%\");\r\n rm.openEnd();\r\n \r\n const content = control.getAggregation(\"_content\") as Control;\r\n if (content) {\r\n rm.renderControl(content);\r\n }\r\n \r\n rm.close(\"div\");\r\n }\r\n };\r\n\r\n /**\r\n * Initializes the UI5 control.\r\n */\r\n public init(): void {\r\n super.init();\r\n }\r\n\r\n /**\r\n * Lifecycle hook to automatically generate the layout if bound declaratively in XML.\r\n */\r\n public onBeforeRendering(): void {\r\n if (!this.generatedContent && this.getProperty(\"schemaDefinition\")) {\r\n this.generate();\r\n }\r\n }\r\n\r\n /**\r\n * Extracts the payload and fires the submit event manually. Useful for inline XML embedding.\r\n */\r\n public triggerSubmit(): void {\r\n if (this.stateManager) {\r\n const payload = this.stateManager.extractPayload();\r\n this.fireEvent(\"submit\", { payload });\r\n }\r\n }\r\n\r\n /**\r\n * Triggers the engine to parse the schema and build the layout.\r\n * Must be called manually or hooked into onBeforeRendering if properties are bound.\r\n */\r\n public generate(): void {\r\n const rawSchema = this.getProperty(\"schemaDefinition\");\r\n const initialData = this.getProperty(\"initialData\");\r\n\r\n if (!rawSchema) {\r\n throw new Error(\"[MetaUI] Cannot generate layout without a schemaDefinition.\");\r\n }\r\n\r\n // 1. Normalize schema\r\n const normalizedSchema = SchemaNormalizer.normalize(rawSchema);\r\n\r\n // 2. Bootstrap isolated State Manager\r\n this.stateManager = new StateManager(initialData);\r\n this.setModel(this.stateManager.getModel(), \"meta\");\r\n\r\n // 3. Delegate to Layout Engine\r\n const engine = new Engine();\r\n const layoutFactory = new BaseLayout();\r\n \r\n this.generatedContent = engine.build(normalizedSchema, layoutFactory);\r\n\r\n // 4. Mount into hidden aggregation\r\n this.setAggregation(\"_content\", this.generatedContent);\r\n }\r\n\r\n /**\r\n * Dialog Modality: Opens the generated layout inside a sap.m.Dialog.\r\n * Automatically wires up 'Save' and 'Cancel' buttons.\r\n */\r\n public openInDialog(title: string = \"Dynamic Form\", submitButtonText: string = \"Save\"): void {\r\n if (!this.generatedContent) {\r\n this.generate();\r\n }\r\n\r\n const dialog = new Dialog({\r\n title: title,\r\n contentWidth: \"800px\",\r\n content: [this], // Mount self inside the dialog\r\n beginButton: new Button({\r\n text: submitButtonText,\r\n type: \"Emphasized\",\r\n press: () => {\r\n if (this.stateManager) {\r\n const payload = this.stateManager.extractPayload();\r\n this.fireEvent(\"submit\", { payload });\r\n }\r\n dialog.close();\r\n }\r\n }),\r\n endButton: new Button({\r\n text: \"Cancel\",\r\n press: () => {\r\n this.fireEvent(\"cancel\");\r\n dialog.close();\r\n }\r\n }),\r\n afterClose: () => {\r\n dialog.destroy();\r\n }\r\n });\r\n\r\n dialog.open();\r\n }\r\n}\r\n"],"mappings":";;;QASSA,gBAAgB,GAAAC,wBAAA;EAAA,MAChBC,MAAM,GAAAC,cAAA;EAAA,MACNC,YAAY,GAAAC,oBAAA;EAAA,MACZC,UAAU,GAAAC,qBAAA;EAEnB;AACA;AACA;AACA;AACA;EAJA,MAKqBC,aAAa,GAASC,OAAO,CAAAC,MAAA;IAAAC,WAAA,WA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
|
|
2
|
+
/**
|
|
3
|
+
* @file GeneratorHost.ts
|
|
4
|
+
* @description The core UI5 custom control that exposes the MetaUI engine to host applications.
|
|
5
|
+
*/
|
|
6
|
+
import Control from "sap/ui/core/Control";
|
|
7
|
+
import RenderManager from "sap/ui/core/RenderManager";
|
|
8
|
+
/**
|
|
9
|
+
* Enterprise wrapper element for embedding or popping the dynamic form.
|
|
10
|
+
*
|
|
11
|
+
* @namespace nz.co.siliconst.ui5.metaui.controls
|
|
12
|
+
*/
|
|
13
|
+
export default class GeneratorHost extends Control {
|
|
14
|
+
private stateManager;
|
|
15
|
+
private generatedContent;
|
|
16
|
+
static readonly metadata: {
|
|
17
|
+
properties: {
|
|
18
|
+
/** The raw JSON metadata schema provided by the ABAP backend. */
|
|
19
|
+
schemaDefinition: {
|
|
20
|
+
type: string;
|
|
21
|
+
defaultValue: any;
|
|
22
|
+
};
|
|
23
|
+
/** The initial data payload to populate the fields. */
|
|
24
|
+
initialData: {
|
|
25
|
+
type: string;
|
|
26
|
+
defaultValue: {};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
aggregations: {
|
|
30
|
+
/** The internal hidden container holding the generated layouts. */
|
|
31
|
+
_content: {
|
|
32
|
+
type: string;
|
|
33
|
+
multiple: boolean;
|
|
34
|
+
visibility: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
events: {
|
|
38
|
+
/** Triggered when the user submits the form via the Dialog modality. */
|
|
39
|
+
submit: {
|
|
40
|
+
parameters: {
|
|
41
|
+
/** The clean extracted JSON payload representing the current state. */
|
|
42
|
+
payload: {
|
|
43
|
+
type: string;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
/** Triggered if the dialog is cancelled. */
|
|
48
|
+
cancel: {};
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Standard UI5 control renderer. Renders the generated internal content.
|
|
53
|
+
*/
|
|
54
|
+
static renderer: {
|
|
55
|
+
apiVersion: number;
|
|
56
|
+
render(rm: RenderManager, control: GeneratorHost): void;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Initializes the UI5 control.
|
|
60
|
+
*/
|
|
61
|
+
init(): void;
|
|
62
|
+
/**
|
|
63
|
+
* Lifecycle hook to automatically generate the layout if bound declaratively in XML.
|
|
64
|
+
*/
|
|
65
|
+
onBeforeRendering(): void;
|
|
66
|
+
/**
|
|
67
|
+
* Extracts the payload and fires the submit event manually. Useful for inline XML embedding.
|
|
68
|
+
*/
|
|
69
|
+
triggerSubmit(): void;
|
|
70
|
+
/**
|
|
71
|
+
* Triggers the engine to parse the schema and build the layout.
|
|
72
|
+
* Must be called manually or hooked into onBeforeRendering if properties are bound.
|
|
73
|
+
*/
|
|
74
|
+
generate(): void;
|
|
75
|
+
/**
|
|
76
|
+
* Dialog Modality: Opens the generated layout inside a sap.m.Dialog.
|
|
77
|
+
* Automatically wires up 'Save' and 'Cancel' buttons.
|
|
78
|
+
*/
|
|
79
|
+
openInDialog(title?: string, submitButtonText?: string): void;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=GeneratorHost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeneratorHost.d.ts","sourceRoot":"..\\..\\..\\..\\..\\..\\..\\..","sources":["src\\nz\\co\\siliconst\\ui5\\metaui\\controls\\GeneratorHost.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,mDAAmD,CAAC;IACnE;;;OAGG;IAEH,OAAO,OAAO,MAAM,qBAAqB,CAAC;IAC1C,OAAO,aAAa,MAAM,2BAA2B,CAAC;IAQtD;;;;OAIG;IACH,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,OAAO;QAE9C,OAAO,CAAC,YAAY,CAA6B;QACjD,OAAO,CAAC,gBAAgB,CAAwB;QAEhD,MAAM,CAAC,QAAQ,CAAC,QAAQ;;gBAEhB,iEAAiE;;;;;gBAEjE,uDAAuD;;;;;;;gBAIvD,mEAAmE;;;;;;;;gBAInE,wEAAwE;;;wBAGhE,uEAAuE;;;;;;gBAI/E,4CAA4C;;;UAGlD;QAEF;;WAEG;QACH,MAAM,CAAC,QAAQ;;uBAEA,aAAa,WAAW,aAAa;UAalD;QAEF;;WAEG;QACI,IAAI,IAAI,IAAI;QAInB;;WAEG;QACI,iBAAiB,IAAI,IAAI;QAMhC;;WAEG;QACI,aAAa,IAAI,IAAI;QAO5B;;;WAGG;QACI,QAAQ,IAAI,IAAI;QAyBvB;;;WAGG;QACI,YAAY,CAAC,KAAK,GAAE,MAAuB,EAAE,gBAAgB,GAAE,MAAe,GAAG,IAAI;KAkC/F;CAEA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
sap.ui.define(["sap/ui/core/Control","sap/m/Dialog","sap/m/Button","../core/SchemaNormalizer","../core/Engine","../core/StateManager","../layouts/BaseLayout"],function(t,e,n,i,a,o,s){"use strict";const r=i["SchemaNormalizer"];const c=a["Engine"];const l=o["StateManager"];const g=s["BaseLayout"];const h=t.extend("nz.co.siliconst.ui5.metaui.controls.GeneratorHost",{constructor:function e(){t.prototype.constructor.apply(this,arguments);this.stateManager=null;this.generatedContent=null},renderer:{apiVersion:2,render(t,e){t.openStart("div",e);t.style("width","100%");t.style("height","100%");t.openEnd();const n=e.getAggregation("_content");if(n){t.renderControl(n)}t.close("div")}},metadata:{properties:{schemaDefinition:{type:"object",defaultValue:null},initialData:{type:"object",defaultValue:{}}},aggregations:{_content:{type:"sap.ui.core.Control",multiple:false,visibility:"hidden"}},events:{submit:{parameters:{payload:{type:"object"}}},cancel:{}}},init:function e(){t.prototype.init.call(this)},onBeforeRendering:function t(){if(!this.generatedContent&&this.getProperty("schemaDefinition")){this.generate()}},triggerSubmit:function t(){if(this.stateManager){const t=this.stateManager.extractPayload();this.fireEvent("submit",{payload:t})}},generate:function t(){const e=this.getProperty("schemaDefinition");const n=this.getProperty("initialData");if(!e){throw new Error("[MetaUI] Cannot generate layout without a schemaDefinition.")}const i=r.normalize(e);this.stateManager=new l(n);this.setModel(this.stateManager.getModel(),"meta");const a=new c;const o=new g;this.generatedContent=a.build(i,o);this.setAggregation("_content",this.generatedContent)},openInDialog:function t(i="Dynamic Form",a="Save"){if(!this.generatedContent){this.generate()}const o=new e({title:i,contentWidth:"800px",content:[this],beginButton:new n({text:a,type:"Emphasized",press:()=>{if(this.stateManager){const t=this.stateManager.extractPayload();this.fireEvent("submit",{payload:t})}o.close()}}),endButton:new n({text:"Cancel",press:()=>{this.fireEvent("cancel");o.close()}}),afterClose:()=>{o.destroy()}});o.open()}});return h});
|
|
2
|
+
//# sourceMappingURL=GeneratorHost.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeneratorHost.js","names":["SchemaNormalizer","___core_SchemaNormalizer","Engine","___core_Engine","StateManager","___core_StateManager","BaseLayout","___layouts_BaseLayout","GeneratorHost","Control","extend","constructor","prototype","apply","this","arguments","stateManager","generatedContent","renderer","apiVersion","render","rm","control","openStart","style","openEnd","content","getAggregation","renderControl","close","metadata","properties","schemaDefinition","type","defaultValue","initialData","aggregations","_content","multiple","visibility","events","submit","parameters","payload","cancel","init","_init","Control.prototype.init.call","onBeforeRendering","_onBeforeRendering","getProperty","generate","triggerSubmit","_triggerSubmit","extractPayload","fireEvent","_generate","rawSchema","Error","normalizedSchema","normalize","setModel","getModel","engine","layoutFactory","build","setAggregation","openInDialog","_openInDialog","title","submitButtonText","dialog","Dialog","contentWidth","beginButton","Button","text","press","endButton","afterClose","destroy","open"],"sources":["GeneratorHost.ts"],"sourcesContent":["/**\r\n * @file GeneratorHost.ts\r\n * @description The core UI5 custom control that exposes the MetaUI engine to host applications.\r\n */\r\n\r\nimport Control from \"sap/ui/core/Control\";\r\nimport RenderManager from \"sap/ui/core/RenderManager\";\r\nimport Dialog from \"sap/m/Dialog\";\r\nimport Button from \"sap/m/Button\";\r\nimport { SchemaNormalizer } from \"../core/SchemaNormalizer\";\r\nimport { Engine } from \"../core/Engine\";\r\nimport { StateManager } from \"../core/StateManager\";\r\nimport { BaseLayout } from \"../layouts/BaseLayout\";\r\n\r\n/**\r\n * Enterprise wrapper element for embedding or popping the dynamic form.\r\n * \r\n * @namespace nz.co.siliconst.ui5.metaui.controls\r\n */\r\nexport default class GeneratorHost extends Control {\r\n \r\n private stateManager: StateManager | null = null;\r\n private generatedContent: Control | null = null;\r\n\r\n static readonly metadata = {\r\n properties: {\r\n /** The raw JSON metadata schema provided by the ABAP backend. */\r\n schemaDefinition: { type: \"object\", defaultValue: null },\r\n /** The initial data payload to populate the fields. */\r\n initialData: { type: \"object\", defaultValue: {} }\r\n },\r\n aggregations: {\r\n /** The internal hidden container holding the generated layouts. */\r\n _content: { type: \"sap.ui.core.Control\", multiple: false, visibility: \"hidden\" }\r\n },\r\n events: {\r\n /** Triggered when the user submits the form via the Dialog modality. */\r\n submit: {\r\n parameters: {\r\n /** The clean extracted JSON payload representing the current state. */\r\n payload: { type: \"object\" }\r\n }\r\n },\r\n /** Triggered if the dialog is cancelled. */\r\n cancel: {}\r\n }\r\n };\r\n\r\n /**\r\n * Standard UI5 control renderer. Renders the generated internal content.\r\n */\r\n static renderer = {\r\n apiVersion: 2,\r\n render(rm: RenderManager, control: GeneratorHost) {\r\n rm.openStart(\"div\", control);\r\n rm.style(\"width\", \"100%\");\r\n rm.style(\"height\", \"100%\");\r\n rm.openEnd();\r\n \r\n const content = control.getAggregation(\"_content\") as Control;\r\n if (content) {\r\n rm.renderControl(content);\r\n }\r\n \r\n rm.close(\"div\");\r\n }\r\n };\r\n\r\n /**\r\n * Initializes the UI5 control.\r\n */\r\n public init(): void {\r\n super.init();\r\n }\r\n\r\n /**\r\n * Lifecycle hook to automatically generate the layout if bound declaratively in XML.\r\n */\r\n public onBeforeRendering(): void {\r\n if (!this.generatedContent && this.getProperty(\"schemaDefinition\")) {\r\n this.generate();\r\n }\r\n }\r\n\r\n /**\r\n * Extracts the payload and fires the submit event manually. Useful for inline XML embedding.\r\n */\r\n public triggerSubmit(): void {\r\n if (this.stateManager) {\r\n const payload = this.stateManager.extractPayload();\r\n this.fireEvent(\"submit\", { payload });\r\n }\r\n }\r\n\r\n /**\r\n * Triggers the engine to parse the schema and build the layout.\r\n * Must be called manually or hooked into onBeforeRendering if properties are bound.\r\n */\r\n public generate(): void {\r\n const rawSchema = this.getProperty(\"schemaDefinition\");\r\n const initialData = this.getProperty(\"initialData\");\r\n\r\n if (!rawSchema) {\r\n throw new Error(\"[MetaUI] Cannot generate layout without a schemaDefinition.\");\r\n }\r\n\r\n // 1. Normalize schema\r\n const normalizedSchema = SchemaNormalizer.normalize(rawSchema);\r\n\r\n // 2. Bootstrap isolated State Manager\r\n this.stateManager = new StateManager(initialData);\r\n this.setModel(this.stateManager.getModel(), \"meta\");\r\n\r\n // 3. Delegate to Layout Engine\r\n const engine = new Engine();\r\n const layoutFactory = new BaseLayout();\r\n \r\n this.generatedContent = engine.build(normalizedSchema, layoutFactory);\r\n\r\n // 4. Mount into hidden aggregation\r\n this.setAggregation(\"_content\", this.generatedContent);\r\n }\r\n\r\n /**\r\n * Dialog Modality: Opens the generated layout inside a sap.m.Dialog.\r\n * Automatically wires up 'Save' and 'Cancel' buttons.\r\n */\r\n public openInDialog(title: string = \"Dynamic Form\", submitButtonText: string = \"Save\"): void {\r\n if (!this.generatedContent) {\r\n this.generate();\r\n }\r\n\r\n const dialog = new Dialog({\r\n title: title,\r\n contentWidth: \"800px\",\r\n content: [this], // Mount self inside the dialog\r\n beginButton: new Button({\r\n text: submitButtonText,\r\n type: \"Emphasized\",\r\n press: () => {\r\n if (this.stateManager) {\r\n const payload = this.stateManager.extractPayload();\r\n this.fireEvent(\"submit\", { payload });\r\n }\r\n dialog.close();\r\n }\r\n }),\r\n endButton: new Button({\r\n text: \"Cancel\",\r\n press: () => {\r\n this.fireEvent(\"cancel\");\r\n dialog.close();\r\n }\r\n }),\r\n afterClose: () => {\r\n dialog.destroy();\r\n }\r\n });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DACpB,CAGA,MAAMC,EAAmB3D,EAAiB4D,UAAUH,GAGpD3C,KAAKE,aAAe,IAAIZ,EAAa+B,GACrCrB,KAAK+C,SAAS/C,KAAKE,aAAa8C,WAAY,QAG5C,MAAMC,EAAS,IAAI7D,EACnB,MAAM8D,EAAgB,IAAI1D,EAE1BQ,KAAKG,iBAAmB8C,EAAOE,MAAMN,EAAkBK,GAGvDlD,KAAKoD,eAAe,WAAYpD,KAAKG,iBACzC,EAMOkD,aAAY,SAAAC,EAACC,EAAgB,eAAgBC,EAA2B,QAC3E,IAAKxD,KAAKG,iBAAkB,CACxBH,KAAKqC,UACT,CAEA,MAAMoB,EAAS,IAAIC,EAAO,CACtBH,MAAOA,EACPI,aAAc,QACd/C,QAAS,CAACZ,MACV4D,YAAa,IAAIC,EAAO,CACpBC,KAAMN,EACNrC,KAAM,aACN4C,MAAOA,KACH,GAAI/D,KAAKE,aAAc,CACnB,MAAM2B,EAAU7B,KAAKE,aAAasC,iBAClCxC,KAAKyC,UAAU,SAAU,CAAEZ,WAC/B,CACA4B,EAAO1C,WAGfiD,UAAW,IAAIH,EAAO,CAClBC,KAAM,SACNC,MAAOA,KACH/D,KAAKyC,UAAU,UACfgB,EAAO1C,WAGfkD,WAAYA,KACRR,EAAOS,aAIfT,EAAOU,MACX,IAAC,OA7IgBzE,CAAa","ignoreList":[]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
sap.ui.define(["./EventBus"], function (___EventBus) {
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @file ConditionEngine.ts
|
|
6
|
+
* @description Evaluates dynamic rules to alter the schema in real-time.
|
|
7
|
+
*/
|
|
8
|
+
const EventBus = ___EventBus["EventBus"];
|
|
9
|
+
/**
|
|
10
|
+
* Engine that listens to the EventBus and evaluates cross-field dependencies.
|
|
11
|
+
*/
|
|
12
|
+
class ConditionEngine {
|
|
13
|
+
/**
|
|
14
|
+
* Initializes the ConditionEngine with the active schema.
|
|
15
|
+
* @param schema The current UI layout schema.
|
|
16
|
+
*/
|
|
17
|
+
constructor(schema) {
|
|
18
|
+
this.schema = schema;
|
|
19
|
+
this.initializeListeners();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Subscribes to the EventBus for real-time field change interception.
|
|
24
|
+
*/
|
|
25
|
+
initializeListeners() {
|
|
26
|
+
EventBus.getInstance().subscribe(this.handleEvent.bind(this));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Internal handler to evaluate business rules when a field is updated.
|
|
31
|
+
* @param event The structured change event.
|
|
32
|
+
*/
|
|
33
|
+
handleEvent(event) {
|
|
34
|
+
// Architecture hook: Logic to evaluate conditions against the schema
|
|
35
|
+
// and update plugin properties will be injected here in later phases.
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
var __exports = {
|
|
39
|
+
__esModule: true
|
|
40
|
+
};
|
|
41
|
+
__exports.ConditionEngine = ConditionEngine;
|
|
42
|
+
return __exports;
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=ConditionEngine-dbg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConditionEngine-dbg.js","names":["EventBus","___EventBus","ConditionEngine","constructor","schema","initializeListeners","getInstance","subscribe","handleEvent","bind","event","__exports","__esModule"],"sources":["ConditionEngine.ts"],"sourcesContent":["/**\r\n * @file ConditionEngine.ts\r\n * @description Evaluates dynamic rules to alter the schema in real-time.\r\n */\r\n\r\nimport { EventBus } from \"./EventBus\";\r\nimport { ISchema } from \"../interfaces/ISchema\";\r\nimport { IFieldChangeEvent } from \"../interfaces/IEventBus\";\r\n\r\n/**\r\n * Engine that listens to the EventBus and evaluates cross-field dependencies.\r\n */\r\nexport class ConditionEngine {\r\n private schema: ISchema;\r\n\r\n /**\r\n * Initializes the ConditionEngine with the active schema.\r\n * @param schema The current UI layout schema.\r\n */\r\n constructor(schema: ISchema) {\r\n this.schema = schema;\r\n this.initializeListeners();\r\n }\r\n\r\n /**\r\n * Subscribes to the EventBus for real-time field change interception.\r\n */\r\n private initializeListeners(): void {\r\n EventBus.getInstance().subscribe(this.handleEvent.bind(this));\r\n }\r\n\r\n /**\r\n * Internal handler to evaluate business rules when a field is updated.\r\n * @param event The structured change event.\r\n */\r\n private handleEvent(event: IFieldChangeEvent): void {\r\n // Architecture hook: Logic to evaluate conditions against the schema \r\n // and update plugin properties will be injected here in later phases.\r\n }\r\n}\r\n"],"mappings":";;;EAAA;AACA;AACA;AACA;EAHA,MAKSA,QAAQ,GAAAC,WAAA;EAIjB;AACA;AACA;EACO,MAAMC,eAAe,CAAC;IAGzB;AACJ;AACA;AACA;IACIC,WAAWA,CAACC,MAAe,EAAE;MACzB,IAAI,CAACA,MAAM,GAAGA,MAAM;MACpB,IAAI,CAACC,mBAAmB,CAAC,CAAC;IAC9B;;IAEA;AACJ;AACA;IACYA,mBAAmBA,CAAA,EAAS;MAChCL,QAAQ,CAACM,WAAW,CAAC,CAAC,CAACC,SAAS,CAAC,IAAI,CAACC,WAAW,CAACC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjE;;IAEA;AACJ;AACA;AACA;IACYD,WAAWA,CAACE,KAAwB,EAAQ;MAChD;MACA;IAAA;EAER;EAAC,IAAAC,SAAA;IAAAC,UAAA;EAAA;EAAAD,SAAA,CAAAT,eAAA,GAAAA,eAAA;EAAA,OAAAS,SAAA;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
declare module "nz/co/siliconst/ui5/metaui/core/ConditionEngine" {
|
|
2
|
+
import { ISchema } from "nz/co/siliconst/ui5/metaui/interfaces/ISchema";
|
|
3
|
+
/**
|
|
4
|
+
* Engine that listens to the EventBus and evaluates cross-field dependencies.
|
|
5
|
+
*/
|
|
6
|
+
export class ConditionEngine {
|
|
7
|
+
private schema;
|
|
8
|
+
/**
|
|
9
|
+
* Initializes the ConditionEngine with the active schema.
|
|
10
|
+
* @param schema The current UI layout schema.
|
|
11
|
+
*/
|
|
12
|
+
constructor(schema: ISchema);
|
|
13
|
+
/**
|
|
14
|
+
* Subscribes to the EventBus for real-time field change interception.
|
|
15
|
+
*/
|
|
16
|
+
private initializeListeners;
|
|
17
|
+
/**
|
|
18
|
+
* Internal handler to evaluate business rules when a field is updated.
|
|
19
|
+
* @param event The structured change event.
|
|
20
|
+
*/
|
|
21
|
+
private handleEvent;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=ConditionEngine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConditionEngine.d.ts","sourceRoot":"..\\..\\..\\..\\..\\..\\..\\..","sources":["src\\nz\\co\\siliconst\\ui5\\metaui\\core\\ConditionEngine.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,iDAAiD,CAAC;IAOjE,OAAO,EAAE,OAAO,EAAE,MAAM,+CAA+C,CAAC;IAGxE;;OAEG;IACH,MAAa,eAAe;QACxB,OAAO,CAAC,MAAM,CAAU;QAExB;;;WAGG;oBACS,MAAM,EAAE,OAAO;QAK3B;;WAEG;QACH,OAAO,CAAC,mBAAmB;QAI3B;;;WAGG;QACH,OAAO,CAAC,WAAW;KAItB;CAEA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
sap.ui.define(["./EventBus"],function(e){"use strict";const i=e["EventBus"];class n{constructor(e){this.schema=e;this.initializeListeners()}initializeListeners(){i.getInstance().subscribe(this.handleEvent.bind(this))}handleEvent(e){}}var t={__esModule:true};t.ConditionEngine=n;return t});
|
|
2
|
+
//# sourceMappingURL=ConditionEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConditionEngine.js","names":["EventBus","___EventBus","ConditionEngine","constructor","schema","this","initializeListeners","getInstance","subscribe","handleEvent","bind","event","__exports","__esModule"],"sources":["ConditionEngine.ts"],"sourcesContent":["/**\r\n * @file ConditionEngine.ts\r\n * @description Evaluates dynamic rules to alter the schema in real-time.\r\n */\r\n\r\nimport { EventBus } from \"./EventBus\";\r\nimport { ISchema } from \"../interfaces/ISchema\";\r\nimport { IFieldChangeEvent } from \"../interfaces/IEventBus\";\r\n\r\n/**\r\n * Engine that listens to the EventBus and evaluates cross-field dependencies.\r\n */\r\nexport class ConditionEngine {\r\n private schema: ISchema;\r\n\r\n /**\r\n * Initializes the ConditionEngine with the active schema.\r\n * @param schema The current UI layout schema.\r\n */\r\n constructor(schema: ISchema) {\r\n this.schema = schema;\r\n this.initializeListeners();\r\n }\r\n\r\n /**\r\n * Subscribes to the EventBus for real-time field change interception.\r\n */\r\n private initializeListeners(): void {\r\n EventBus.getInstance().subscribe(this.handleEvent.bind(this));\r\n }\r\n\r\n /**\r\n * Internal handler to evaluate business rules when a field is updated.\r\n * @param event The structured change event.\r\n */\r\n private handleEvent(event: IFieldChangeEvent): void {\r\n // Architecture hook: Logic to evaluate conditions against the schema \r\n // and update plugin properties will be injected here in later phases.\r\n }\r\n}\r\n"],"mappings":"sDAAA,MAKSA,EAAQC,EAAA,YAOV,MAAMC,EAOTC,YAAYC,GACRC,KAAKD,OAASA,EACdC,KAAKC,qBACT,CAKQA,sBACJN,EAASO,cAAcC,UAAUH,KAAKI,YAAYC,KAAKL,MAC3D,CAMQI,YAAYE,GAEhB,EAEP,IAAAC,EAAA,CAAAC,WAAA,MAAAD,EAAAV,kBAAA,OAAAU,CAAA","ignoreList":[]}
|
|
@@ -0,0 +1,59 @@
|
|
|
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
|
+
* The MetaUI Engine. Responsible for bootstrapping the layout generation.
|
|
11
|
+
* Follows strict Orchestrator patterns; delegates all actual rendering to LayoutManagers.
|
|
12
|
+
*/
|
|
13
|
+
class Engine {
|
|
14
|
+
conditionEngine = null;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Evaluates the schema and delegates generation to the layout factory.
|
|
18
|
+
* @param schema The fully normalized schema definition.
|
|
19
|
+
* @param layoutManager The injected layout factory class.
|
|
20
|
+
* @returns The populated UI5 layout container.
|
|
21
|
+
*/
|
|
22
|
+
build(schema, layoutManager) {
|
|
23
|
+
// Bootstrap the condition engine to start listening for field events in this schema
|
|
24
|
+
this.conditionEngine = new ConditionEngine(schema);
|
|
25
|
+
if (schema.mode === "form") {
|
|
26
|
+
return layoutManager.renderForm(schema);
|
|
27
|
+
} else if (schema.mode === "table") {
|
|
28
|
+
if (!schema.tables || schema.tables.length === 0) {
|
|
29
|
+
throw new Error("[MetaUI] Table mode requires at least one table definition.");
|
|
30
|
+
}
|
|
31
|
+
return layoutManager.renderTable(schema.tables[0]);
|
|
32
|
+
} else if (schema.mode === "mixed") {
|
|
33
|
+
const container = new VBox({
|
|
34
|
+
renderType: "Bare"
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// 1. Render the top-level form if there are root fields
|
|
38
|
+
if (schema.rootFields && schema.rootFields.length > 0) {
|
|
39
|
+
container.addItem(layoutManager.renderForm(schema));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// 2. Render all tables sequentially below the form
|
|
43
|
+
if (schema.tables && schema.tables.length > 0) {
|
|
44
|
+
schema.tables.forEach(tableMeta => {
|
|
45
|
+
container.addItem(layoutManager.renderTable(tableMeta));
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
return container;
|
|
49
|
+
}
|
|
50
|
+
throw new Error(`[MetaUI] Mode '${schema.mode}' is not yet implemented or invalid.`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
var __exports = {
|
|
54
|
+
__esModule: true
|
|
55
|
+
};
|
|
56
|
+
__exports.Engine = Engine;
|
|
57
|
+
return __exports;
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=Engine-dbg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Engine-dbg.js","names":["ConditionEngine","___ConditionEngine","Engine","conditionEngine","build","schema","layoutManager","mode","renderForm","tables","length","Error","renderTable","container","VBox","renderType","rootFields","addItem","forEach","tableMeta","__exports","__esModule"],"sources":["Engine.ts"],"sourcesContent":["/**\r\n * @file Engine.ts\r\n * @description The central orchestrator that routes data between the Layout Factory and Plugin Registry.\r\n */\r\n\r\nimport { ISchema } from \"../interfaces/ISchema\";\r\nimport { ILayoutManager } from \"../interfaces/ILayoutManager\";\r\nimport { ConditionEngine } from \"./ConditionEngine\";\r\nimport Control from \"sap/ui/core/Control\";\r\nimport VBox from \"sap/m/VBox\";\r\n\r\n/**\r\n * The MetaUI Engine. Responsible for bootstrapping the layout generation.\r\n * Follows strict Orchestrator patterns; delegates all actual rendering to LayoutManagers.\r\n */\r\nexport class Engine {\r\n private conditionEngine: ConditionEngine | null = null;\r\n \r\n /**\r\n * Evaluates the schema and delegates generation to the layout factory.\r\n * @param schema The fully normalized schema definition.\r\n * @param layoutManager The injected layout factory class.\r\n * @returns The populated UI5 layout container.\r\n */\r\n public build(schema: ISchema, layoutManager: ILayoutManager): Control {\r\n // Bootstrap the condition engine to start listening for field events in this schema\r\n this.conditionEngine = new ConditionEngine(schema);\r\n \r\n if (schema.mode === \"form\") {\r\n return layoutManager.renderForm(schema);\r\n } else if (schema.mode === \"table\") {\r\n if (!schema.tables || schema.tables.length === 0) {\r\n throw new Error(\"[MetaUI] Table mode requires at least one table definition.\");\r\n }\r\n return layoutManager.renderTable(schema.tables[0]);\r\n } else if (schema.mode === \"mixed\") {\r\n const container = new VBox({ renderType: \"Bare\" });\r\n \r\n // 1. Render the top-level form if there are root fields\r\n if (schema.rootFields && schema.rootFields.length > 0) {\r\n container.addItem(layoutManager.renderForm(schema));\r\n }\r\n \r\n // 2. Render all tables sequentially below the form\r\n if (schema.tables && schema.tables.length > 0) {\r\n schema.tables.forEach(tableMeta => {\r\n container.addItem(layoutManager.renderTable(tableMeta));\r\n });\r\n }\r\n \r\n return container;\r\n }\r\n \r\n throw new Error(`[MetaUI] Mode '${schema.mode}' is not yet implemented or invalid.`);\r\n }\r\n}\r\n"],"mappings":";;;EAAA;AACA;AACA;AACA;EAHA,MAOSA,eAAe,GAAAC,kBAAA;EAIxB;AACA;AACA;AACA;EACO,MAAMC,MAAM,CAAC;IACRC,eAAe,GAA2B,IAAI;;IAEtD;AACJ;AACA;AACA;AACA;AACA;IACWC,KAAKA,CAACC,MAAe,EAAEC,aAA6B,EAAW;MAClE;MACA,IAAI,CAACH,eAAe,GAAG,IAAIH,eAAe,CAACK,MAAM,CAAC;MAElD,IAAIA,MAAM,CAACE,IAAI,KAAK,MAAM,EAAE;QACxB,OAAOD,aAAa,CAACE,UAAU,CAACH,MAAM,CAAC;MAC3C,CAAC,MAAM,IAAIA,MAAM,CAACE,IAAI,KAAK,OAAO,EAAE;QAChC,IAAI,CAACF,MAAM,CAACI,MAAM,IAAIJ,MAAM,CAACI,MAAM,CAACC,MAAM,KAAK,CAAC,EAAE;UAC9C,MAAM,IAAIC,KAAK,CAAC,6DAA6D,CAAC;QAClF;QACA,OAAOL,aAAa,CAACM,WAAW,CAACP,MAAM,CAACI,MAAM,CAAC,CAAC,CAAC,CAAC;MACtD,CAAC,MAAM,IAAIJ,MAAM,CAACE,IAAI,KAAK,OAAO,EAAE;QAChC,MAAMM,SAAS,GAAG,IAAIC,IAAI,CAAC;UAAEC,UAAU,EAAE;QAAO,CAAC,CAAC;;QAElD;QACA,IAAIV,MAAM,CAACW,UAAU,IAAIX,MAAM,CAACW,UAAU,CAACN,MAAM,GAAG,CAAC,EAAE;UACnDG,SAAS,CAACI,OAAO,CAACX,aAAa,CAACE,UAAU,CAACH,MAAM,CAAC,CAAC;QACvD;;QAEA;QACA,IAAIA,MAAM,CAACI,MAAM,IAAIJ,MAAM,CAACI,MAAM,CAACC,MAAM,GAAG,CAAC,EAAE;UAC3CL,MAAM,CAACI,MAAM,CAACS,OAAO,CAACC,SAAS,IAAI;YAC/BN,SAAS,CAACI,OAAO,CAACX,aAAa,CAACM,WAAW,CAACO,SAAS,CAAC,CAAC;UAC3D,CAAC,CAAC;QACN;QAEA,OAAON,SAAS;MACpB;MAEA,MAAM,IAAIF,KAAK,CAAC,kBAAkBN,MAAM,CAACE,IAAI,sCAAsC,CAAC;IACxF;EACJ;EAAC,IAAAa,SAAA;IAAAC,UAAA;EAAA;EAAAD,SAAA,CAAAlB,MAAA,GAAAA,MAAA;EAAA,OAAAkB,SAAA;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
declare module "nz/co/siliconst/ui5/metaui/core/Engine" {
|
|
2
|
+
/**
|
|
3
|
+
* @file Engine.ts
|
|
4
|
+
* @description The central orchestrator that routes data between the Layout Factory and Plugin Registry.
|
|
5
|
+
*/
|
|
6
|
+
import { ISchema } from "nz/co/siliconst/ui5/metaui/interfaces/ISchema";
|
|
7
|
+
import { ILayoutManager } from "nz/co/siliconst/ui5/metaui/interfaces/ILayoutManager";
|
|
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
|
+
export class Engine {
|
|
14
|
+
private conditionEngine;
|
|
15
|
+
/**
|
|
16
|
+
* Evaluates the schema and delegates generation to the layout factory.
|
|
17
|
+
* @param schema The fully normalized schema definition.
|
|
18
|
+
* @param layoutManager The injected layout factory class.
|
|
19
|
+
* @returns The populated UI5 layout container.
|
|
20
|
+
*/
|
|
21
|
+
build(schema: ISchema, layoutManager: ILayoutManager): Control;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=Engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,EAAE,MAAM,+CAA+C,CAAC;IACxE,OAAO,EAAE,cAAc,EAAE,MAAM,sDAAsD,CAAC;IAEtF,OAAO,OAAO,MAAM,qBAAqB,CAAC;IAG1C;;;OAGG;IACH,MAAa,MAAM;QACf,OAAO,CAAC,eAAe,CAAgC;QAEvD;;;;;WAKG;QACI,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,cAAc,GAAG,OAAO;KA+BxE;CAEA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
sap.ui.define(["./ConditionEngine","sap/m/VBox"],function(e,n){"use strict";const t=e["ConditionEngine"];class r{conditionEngine=null;build(e,r){this.conditionEngine=new t(e);if(e.mode==="form"){return r.renderForm(e)}else if(e.mode==="table"){if(!e.tables||e.tables.length===0){throw new Error("[MetaUI] Table mode requires at least one table definition.")}return r.renderTable(e.tables[0])}else if(e.mode==="mixed"){const t=new n({renderType:"Bare"});if(e.rootFields&&e.rootFields.length>0){t.addItem(r.renderForm(e))}if(e.tables&&e.tables.length>0){e.tables.forEach(e=>{t.addItem(r.renderTable(e))})}return t}throw new Error(`[MetaUI] Mode '${e.mode}' is not yet implemented or invalid.`)}}var i={__esModule:true};i.Engine=r;return i});
|
|
2
|
+
//# sourceMappingURL=Engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Engine.js","names":["ConditionEngine","___ConditionEngine","Engine","conditionEngine","build","schema","layoutManager","this","mode","renderForm","tables","length","Error","renderTable","container","VBox","renderType","rootFields","addItem","forEach","tableMeta","__exports","__esModule"],"sources":["Engine.ts"],"sourcesContent":["/**\r\n * @file Engine.ts\r\n * @description The central orchestrator that routes data between the Layout Factory and Plugin Registry.\r\n */\r\n\r\nimport { ISchema } from \"../interfaces/ISchema\";\r\nimport { ILayoutManager } from \"../interfaces/ILayoutManager\";\r\nimport { ConditionEngine } from \"./ConditionEngine\";\r\nimport Control from \"sap/ui/core/Control\";\r\nimport VBox from \"sap/m/VBox\";\r\n\r\n/**\r\n * The MetaUI Engine. Responsible for bootstrapping the layout generation.\r\n * Follows strict Orchestrator patterns; delegates all actual rendering to LayoutManagers.\r\n */\r\nexport class Engine {\r\n private conditionEngine: ConditionEngine | null = null;\r\n \r\n /**\r\n * Evaluates the schema and delegates generation to the layout factory.\r\n * @param schema The fully normalized schema definition.\r\n * @param layoutManager The injected layout factory class.\r\n * @returns The populated UI5 layout container.\r\n */\r\n public build(schema: ISchema, layoutManager: ILayoutManager): Control {\r\n // Bootstrap the condition engine to start listening for field events in this schema\r\n this.conditionEngine = new ConditionEngine(schema);\r\n \r\n if (schema.mode === \"form\") {\r\n return layoutManager.renderForm(schema);\r\n } else if (schema.mode === \"table\") {\r\n if (!schema.tables || schema.tables.length === 0) {\r\n throw new Error(\"[MetaUI] Table mode requires at least one table definition.\");\r\n }\r\n return layoutManager.renderTable(schema.tables[0]);\r\n } else if (schema.mode === \"mixed\") {\r\n const container = new VBox({ renderType: \"Bare\" });\r\n \r\n // 1. Render the top-level form if there are root fields\r\n if (schema.rootFields && schema.rootFields.length > 0) {\r\n container.addItem(layoutManager.renderForm(schema));\r\n }\r\n \r\n // 2. Render all tables sequentially below the form\r\n if (schema.tables && schema.tables.length > 0) {\r\n schema.tables.forEach(tableMeta => {\r\n container.addItem(layoutManager.renderTable(tableMeta));\r\n });\r\n }\r\n \r\n return container;\r\n }\r\n \r\n throw new Error(`[MetaUI] Mode '${schema.mode}' is not yet implemented or invalid.`);\r\n }\r\n}\r\n"],"mappings":"4EAAA,MAOSA,EAAeC,EAAA,mBAQjB,MAAMC,EACDC,gBAA0C,KAQ3CC,MAAMC,EAAiBC,GAE1BC,KAAKJ,gBAAkB,IAAIH,EAAgBK,GAE3C,GAAIA,EAAOG,OAAS,OAAQ,CACxB,OAAOF,EAAcG,WAAWJ,EACpC,MAAO,GAAIA,EAAOG,OAAS,QAAS,CAChC,IAAKH,EAAOK,QAAUL,EAAOK,OAAOC,SAAW,EAAG,CAC9C,MAAM,IAAIC,MAAM,8DACpB,CACA,OAAON,EAAcO,YAAYR,EAAOK,OAAO,GACnD,MAAO,GAAIL,EAAOG,OAAS,QAAS,CAChC,MAAMM,EAAY,IAAIC,EAAK,CAAEC,WAAY,SAGzC,GAAIX,EAAOY,YAAcZ,EAAOY,WAAWN,OAAS,EAAG,CACnDG,EAAUI,QAAQZ,EAAcG,WAAWJ,GAC/C,CAGA,GAAIA,EAAOK,QAAUL,EAAOK,OAAOC,OAAS,EAAG,CAC3CN,EAAOK,OAAOS,QAAQC,IAClBN,EAAUI,QAAQZ,EAAcO,YAAYO,KAEpD,CAEA,OAAON,CACX,CAEA,MAAM,IAAIF,MAAM,kBAAkBP,EAAOG,2CAC7C,EACH,IAAAa,EAAA,CAAAC,WAAA,MAAAD,EAAAnB,SAAA,OAAAmB,CAAA","ignoreList":[]}
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
var __exports = {
|
|
46
|
+
__esModule: true
|
|
47
|
+
};
|
|
48
|
+
__exports.EventBus = EventBus;
|
|
49
|
+
return __exports;
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=EventBus-dbg.js.map
|
|
@@ -0,0 +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":["/**\r\n * @file EventBus.ts\r\n * @description Internal pub/sub channel for managing cross-field dependencies.\r\n */\r\n\r\nimport { IEventBus, IFieldChangeEvent } from \"../interfaces/IEventBus\";\r\n\r\n/**\r\n * Singleton orchestrator for localized state changes across the generated UI layout.\r\n */\r\nexport class EventBus implements IEventBus {\r\n private static instance: EventBus;\r\n private listeners: Array<(event: IFieldChangeEvent) => void> = [];\r\n\r\n private constructor() {\r\n // Enforce singleton\r\n }\r\n\r\n /**\r\n * Retrieves the singular instance of the EventBus.\r\n * @returns The EventBus singleton.\r\n */\r\n public static getInstance(): EventBus {\r\n if (!EventBus.instance) {\r\n EventBus.instance = new EventBus();\r\n }\r\n return EventBus.instance;\r\n }\r\n\r\n /**\r\n * Publishes a value change event to all internal subscribers.\r\n * @param event The structured payload of the field change.\r\n */\r\n public publishFieldChange(event: IFieldChangeEvent): void {\r\n this.listeners.forEach(listener => listener(event));\r\n }\r\n\r\n /**\r\n * Registers a callback listener to react to field changes.\r\n * @param listener The callback function.\r\n */\r\n public subscribe(listener: (event: IFieldChangeEvent) => void): void {\r\n this.listeners.push(listener);\r\n }\r\n}\r\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;EACJ;EAAC,IAAAG,SAAA;IAAAC,UAAA;EAAA;EAAAD,SAAA,CAAAX,QAAA,GAAAA,QAAA;EAAA,OAAAW,SAAA;AAAA","ignoreList":[]}
|