@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,162 +1,292 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file GeneratorHost.ts
|
|
3
|
-
* @description The core UI5 custom control that exposes the MetaUI engine to host applications.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import Control from "sap/ui/core/Control";
|
|
7
|
-
import RenderManager from "sap/ui/core/RenderManager";
|
|
8
|
-
import Dialog from "sap/m/Dialog";
|
|
9
|
-
import Button from "sap/m/Button";
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
*
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
submit
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @file GeneratorHost.ts
|
|
3
|
+
* @description The core UI5 custom control that exposes the MetaUI engine to host applications.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import Control from "sap/ui/core/Control";
|
|
7
|
+
import RenderManager from "sap/ui/core/RenderManager";
|
|
8
|
+
import Dialog from "sap/m/Dialog";
|
|
9
|
+
import Button from "sap/m/Button";
|
|
10
|
+
import MessagePage from "sap/m/MessagePage";
|
|
11
|
+
import Log from "sap/base/Log";
|
|
12
|
+
import { SchemaNormalizer } from "../core/SchemaNormalizer";
|
|
13
|
+
import { Engine } from "../core/Engine";
|
|
14
|
+
import { StateManager } from "../core/StateManager";
|
|
15
|
+
import { BaseLayout } from "../layouts/BaseLayout";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Wrapper element for embedding or popping the dynamic form.
|
|
19
|
+
*
|
|
20
|
+
* @namespace nz.co.siliconst.ui5.metaui.controls
|
|
21
|
+
*/
|
|
22
|
+
export default class GeneratorHost extends Control {
|
|
23
|
+
|
|
24
|
+
private stateManager: StateManager | null = null;
|
|
25
|
+
private generatedContent: Control | null = null;
|
|
26
|
+
private engine: Engine | null = null;
|
|
27
|
+
|
|
28
|
+
static readonly metadata = {
|
|
29
|
+
properties: {
|
|
30
|
+
/** The raw JSON metadata schema provided by the ABAP backend. */
|
|
31
|
+
schemaDefinition: { type: "any", defaultValue: null },
|
|
32
|
+
/** The initial data payload to populate the fields as an object. */
|
|
33
|
+
initialData: { type: "any", defaultValue: null },
|
|
34
|
+
/** The initial data payload provided as a raw JSON string. */
|
|
35
|
+
initialDataJson: { type: "string", defaultValue: null },
|
|
36
|
+
/** The final payload data object, updated on submit. */
|
|
37
|
+
outputData: { type: "object", defaultValue: null },
|
|
38
|
+
/** The final payload JSON string, updated on submit. */
|
|
39
|
+
outputDataJson: { type: "string", defaultValue: null },
|
|
40
|
+
/** If true, validation errors will be pushed to the global sap.ui.core.message.MessageManager. */
|
|
41
|
+
useMessageManager: { type: "boolean", defaultValue: false }
|
|
42
|
+
},
|
|
43
|
+
aggregations: {
|
|
44
|
+
/** The internal hidden container holding the generated layouts. */
|
|
45
|
+
_content: { type: "sap.ui.core.Control", multiple: false, visibility: "hidden" }
|
|
46
|
+
},
|
|
47
|
+
events: {
|
|
48
|
+
/** Triggered before final submission, allowing host apps to run custom validation logic and halt submission if needed. */
|
|
49
|
+
beforeSubmit: {
|
|
50
|
+
parameters: {
|
|
51
|
+
/** The clean extracted JSON payload representing the current state. */
|
|
52
|
+
payload: { type: "object" },
|
|
53
|
+
/** Function to add a custom validation error message for a specific field path. */
|
|
54
|
+
addError: { type: "function" },
|
|
55
|
+
/** Function to prevent the default submission and dialog closure. */
|
|
56
|
+
preventDefault: { type: "function" }
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
/** Triggered when the user submits the form via the Dialog modality. */
|
|
60
|
+
submit: {
|
|
61
|
+
parameters: {
|
|
62
|
+
/** The clean extracted JSON payload representing the current state. */
|
|
63
|
+
payload: { type: "object" },
|
|
64
|
+
/** The stringified final JSON payload. */
|
|
65
|
+
payloadJson: { type: "string" }
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
/** Triggered if the dialog is cancelled. */
|
|
69
|
+
cancel: {}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Standard UI5 control renderer. Renders the generated internal content.
|
|
75
|
+
*/
|
|
76
|
+
static renderer = {
|
|
77
|
+
apiVersion: 2,
|
|
78
|
+
render(rm: RenderManager, control: GeneratorHost) {
|
|
79
|
+
rm.openStart("div", control);
|
|
80
|
+
rm.style("width", "100%");
|
|
81
|
+
rm.style("height", "100%");
|
|
82
|
+
rm.openEnd();
|
|
83
|
+
|
|
84
|
+
const content = control.getAggregation("_content") as Control;
|
|
85
|
+
if (content) {
|
|
86
|
+
rm.renderControl(content);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
rm.close("div");
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Initializes the UI5 control.
|
|
95
|
+
*/
|
|
96
|
+
public init(): void {
|
|
97
|
+
super.init();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Standard UI5 lifecycle hook for destruction.
|
|
102
|
+
* Guaranteed to tear down isolated models and unbind global event listeners.
|
|
103
|
+
*/
|
|
104
|
+
public exit(): void {
|
|
105
|
+
if (this.engine) {
|
|
106
|
+
this.engine.destroy();
|
|
107
|
+
this.engine = null;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (this.stateManager) {
|
|
111
|
+
this.stateManager.getModel().destroy();
|
|
112
|
+
this.stateManager = null;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (this.generatedContent) {
|
|
116
|
+
this.generatedContent.destroy();
|
|
117
|
+
this.generatedContent = null;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Lifecycle hook to automatically generate the layout if bound declaratively in XML.
|
|
123
|
+
*/
|
|
124
|
+
public onBeforeRendering(): void {
|
|
125
|
+
if (!this.generatedContent && this.getProperty("schemaDefinition")) {
|
|
126
|
+
this.generate();
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Extracts the payload, pushes it to properties, and fires the submit event manually.
|
|
132
|
+
* Returns true if submission was successful, false if validation failed or was prevented.
|
|
133
|
+
*/
|
|
134
|
+
public triggerSubmit(): boolean {
|
|
135
|
+
if (this.stateManager && this.engine) {
|
|
136
|
+
let isPrevented = false;
|
|
137
|
+
const useMessageManager = this.getProperty("useMessageManager") as boolean;
|
|
138
|
+
let messageManager: any = null;
|
|
139
|
+
|
|
140
|
+
if (useMessageManager) {
|
|
141
|
+
messageManager = sap.ui.getCore().getMessageManager();
|
|
142
|
+
messageManager.removeAllMessages();
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Helper to add messages securely via async require so it isn't a hard dependency
|
|
146
|
+
const pushMessage = (path: string, text: string) => {
|
|
147
|
+
if (useMessageManager && messageManager) {
|
|
148
|
+
sap.ui.require(["sap/ui/core/message/Message"], (Message: any) => {
|
|
149
|
+
messageManager.addMessages(new Message({
|
|
150
|
+
message: text,
|
|
151
|
+
type: "Error" as any,
|
|
152
|
+
target: `${this.stateManager?.getModel().getId()}>/${path}`,
|
|
153
|
+
processor: this.stateManager?.getModel()
|
|
154
|
+
}));
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
// 1. Run global schema validation
|
|
160
|
+
if (!this.engine.validateAll()) {
|
|
161
|
+
pushMessage("", "One or more fields failed schema validation. Please review the highlighted fields.");
|
|
162
|
+
return false; // Schema validation failed, inputs already turned red
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const payload = this.stateManager.extractPayload();
|
|
166
|
+
const payloadJson = JSON.stringify(payload);
|
|
167
|
+
|
|
168
|
+
// 2. Fire beforeSubmit exit
|
|
169
|
+
this.fireEvent("beforeSubmit", {
|
|
170
|
+
payload,
|
|
171
|
+
preventDefault: () => {
|
|
172
|
+
isPrevented = true;
|
|
173
|
+
},
|
|
174
|
+
addError: (propertyPath: string, errorMessage: string) => {
|
|
175
|
+
isPrevented = true;
|
|
176
|
+
if (useMessageManager && messageManager) {
|
|
177
|
+
pushMessage(propertyPath, errorMessage);
|
|
178
|
+
} else {
|
|
179
|
+
Log.warning(`[MetaUI] Validation Error for ${propertyPath}: ${errorMessage}`, "GeneratorHost");
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
if (isPrevented) {
|
|
185
|
+
return false; // Exit validation failed or prevented submission
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// Push final values to properties (updating XML bindings)
|
|
189
|
+
this.setProperty("outputData", payload, true);
|
|
190
|
+
this.setProperty("outputDataJson", payloadJson, true);
|
|
191
|
+
|
|
192
|
+
this.fireEvent("submit", { payload, payloadJson });
|
|
193
|
+
return true;
|
|
194
|
+
}
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Triggers the engine to parse the schema and build the layout.
|
|
200
|
+
* Safely wrapped in a try/catch to prevent Launchpad crashes.
|
|
201
|
+
*/
|
|
202
|
+
public generate(): void {
|
|
203
|
+
try {
|
|
204
|
+
const rawSchema = this.getProperty("schemaDefinition");
|
|
205
|
+
|
|
206
|
+
let initialData = this.getProperty("initialData");
|
|
207
|
+
const initialDataJson = this.getProperty("initialDataJson");
|
|
208
|
+
|
|
209
|
+
if (initialDataJson) {
|
|
210
|
+
try {
|
|
211
|
+
initialData = JSON.parse(initialDataJson);
|
|
212
|
+
} catch (e) {
|
|
213
|
+
Log.error("[MetaUI] Failed to parse initialDataJson string.", (e as Error).message, "GeneratorHost");
|
|
214
|
+
}
|
|
215
|
+
} else if (typeof initialData === "string") {
|
|
216
|
+
try {
|
|
217
|
+
initialData = JSON.parse(initialData);
|
|
218
|
+
} catch (e) {
|
|
219
|
+
Log.error("[MetaUI] Failed to parse initialData string.", (e as Error).message, "GeneratorHost");
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// 1. Normalize schema (allows fallback to data inference)
|
|
224
|
+
const normalizedSchema = SchemaNormalizer.normalize(rawSchema, initialData);
|
|
225
|
+
|
|
226
|
+
// 2. Bootstrap isolated State Manager
|
|
227
|
+
this.stateManager = new StateManager(initialData || {});
|
|
228
|
+
|
|
229
|
+
// Dynamically generate a 100% unique model name for isolation
|
|
230
|
+
const modelName = "metaUI_" + this.getId();
|
|
231
|
+
this.setModel(this.stateManager.getModel(), modelName);
|
|
232
|
+
|
|
233
|
+
// 3. Delegate to Layout Engine
|
|
234
|
+
this.engine = new Engine();
|
|
235
|
+
const layoutFactory = new BaseLayout();
|
|
236
|
+
|
|
237
|
+
this.generatedContent = this.engine.build(normalizedSchema, layoutFactory, modelName);
|
|
238
|
+
|
|
239
|
+
// 4. Mount into hidden aggregation
|
|
240
|
+
this.setAggregation("_content", this.generatedContent);
|
|
241
|
+
|
|
242
|
+
} catch (error) {
|
|
243
|
+
Log.error("[MetaUI] Engine failed to generate layout. Preventing Launchpad crash.", (error as Error).message, "GeneratorHost");
|
|
244
|
+
|
|
245
|
+
const errorPage = new MessagePage({
|
|
246
|
+
text: "UI Generation Failed",
|
|
247
|
+
description: "The dynamic schema could not be rendered. Please check the Fiori console for diagnostic logs.",
|
|
248
|
+
icon: "sap-icon://error"
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
this.setAggregation("_content", errorPage);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Dialog Modality: Opens the generated layout inside a sap.m.Dialog.
|
|
257
|
+
* Automatically wires up 'Save' and 'Cancel' buttons.
|
|
258
|
+
*/
|
|
259
|
+
public openInDialog(title: string = "Dynamic Form", submitButtonText: string = "Save"): void {
|
|
260
|
+
if (!this.generatedContent) {
|
|
261
|
+
this.generate();
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
const dialog = new Dialog({
|
|
265
|
+
title: title,
|
|
266
|
+
contentWidth: "800px",
|
|
267
|
+
content: [this], // Mount self inside the dialog
|
|
268
|
+
beginButton: new Button({
|
|
269
|
+
text: submitButtonText,
|
|
270
|
+
type: "Emphasized",
|
|
271
|
+
press: () => {
|
|
272
|
+
const success = this.triggerSubmit();
|
|
273
|
+
if (success) {
|
|
274
|
+
dialog.close();
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}),
|
|
278
|
+
endButton: new Button({
|
|
279
|
+
text: "Cancel",
|
|
280
|
+
press: () => {
|
|
281
|
+
this.fireEvent("cancel");
|
|
282
|
+
dialog.close();
|
|
283
|
+
}
|
|
284
|
+
}),
|
|
285
|
+
afterClose: () => {
|
|
286
|
+
dialog.destroy();
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
dialog.open();
|
|
291
|
+
}
|
|
292
|
+
}
|
|
@@ -1,44 +1,52 @@
|
|
|
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.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
*
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
//
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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.boundHandler = this.handleEvent.bind(this);
|
|
20
|
+
this.initializeListeners();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Subscribes to the EventBus for real-time field change interception.
|
|
25
|
+
*/
|
|
26
|
+
initializeListeners() {
|
|
27
|
+
EventBus.getInstance().subscribe(this.boundHandler);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Internal handler to evaluate business rules when a field is updated.
|
|
32
|
+
* @param event The structured change event.
|
|
33
|
+
*/
|
|
34
|
+
handleEvent(event) {
|
|
35
|
+
// Architecture hook: Logic to evaluate conditions against the schema
|
|
36
|
+
// and update plugin properties will be injected here in later phases.
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Cleans up EventBus listeners to prevent memory leaks on destruction.
|
|
41
|
+
*/
|
|
42
|
+
destroy() {
|
|
43
|
+
EventBus.getInstance().unsubscribe(this.boundHandler);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
var __exports = {
|
|
47
|
+
__esModule: true
|
|
48
|
+
};
|
|
49
|
+
__exports.ConditionEngine = ConditionEngine;
|
|
50
|
+
return __exports;
|
|
51
|
+
});
|
|
44
52
|
//# sourceMappingURL=ConditionEngine-dbg.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConditionEngine-dbg.js","names":["EventBus","___EventBus","ConditionEngine","constructor","schema","initializeListeners","getInstance","subscribe","
|
|
1
|
+
{"version":3,"file":"ConditionEngine-dbg.js","names":["EventBus","___EventBus","ConditionEngine","constructor","schema","boundHandler","handleEvent","bind","initializeListeners","getInstance","subscribe","event","destroy","unsubscribe","__exports","__esModule"],"sources":["ConditionEngine.ts"],"sourcesContent":["/**\n * @file ConditionEngine.ts\n * @description Evaluates dynamic rules to alter the schema in real-time.\n */\n\nimport { EventBus } from \"./EventBus\";\nimport { ISchema } from \"../interfaces/ISchema\";\nimport { IFieldChangeEvent } from \"../interfaces/IEventBus\";\n\n/**\n * Engine that listens to the EventBus and evaluates cross-field dependencies.\n */\nexport class ConditionEngine {\n private schema: ISchema;\n private boundHandler: (event: IFieldChangeEvent) => void;\n\n /**\n * Initializes the ConditionEngine with the active schema.\n * @param schema The current UI layout schema.\n */\n constructor(schema: ISchema) {\n this.schema = schema;\n this.boundHandler = this.handleEvent.bind(this);\n this.initializeListeners();\n }\n\n /**\n * Subscribes to the EventBus for real-time field change interception.\n */\n private initializeListeners(): void {\n EventBus.getInstance().subscribe(this.boundHandler);\n }\n\n /**\n * Internal handler to evaluate business rules when a field is updated.\n * @param event The structured change event.\n */\n private handleEvent(event: IFieldChangeEvent): void {\n // Architecture hook: Logic to evaluate conditions against the schema \n // and update plugin properties will be injected here in later phases.\n }\n\n /**\n * Cleans up EventBus listeners to prevent memory leaks on destruction.\n */\n public destroy(): void {\n EventBus.getInstance().unsubscribe(this.boundHandler);\n }\n}\n"],"mappings":";;;EAAA;AACA;AACA;AACA;EAHA,MAKSA,QAAQ,GAAAC,WAAA;EAIjB;AACA;AACA;EACO,MAAMC,eAAe,CAAC;IAIzB;AACJ;AACA;AACA;IACIC,WAAWA,CAACC,MAAe,EAAE;MACzB,IAAI,CAACA,MAAM,GAAGA,MAAM;MACpB,IAAI,CAACC,YAAY,GAAG,IAAI,CAACC,WAAW,CAACC,IAAI,CAAC,IAAI,CAAC;MAC/C,IAAI,CAACC,mBAAmB,CAAC,CAAC;IAC9B;;IAEA;AACJ;AACA;IACYA,mBAAmBA,CAAA,EAAS;MAChCR,QAAQ,CAACS,WAAW,CAAC,CAAC,CAACC,SAAS,CAAC,IAAI,CAACL,YAAY,CAAC;IACvD;;IAEA;AACJ;AACA;AACA;IACYC,WAAWA,CAACK,KAAwB,EAAQ;MAChD;MACA;IAAA;;IAGJ;AACJ;AACA;IACWC,OAAOA,CAAA,EAAS;MACnBZ,QAAQ,CAACS,WAAW,CAAC,CAAC,CAACI,WAAW,CAAC,IAAI,CAACR,YAAY,CAAC;IACzD;EACJ;EAAC,IAAAS,SAAA;IAAAC,UAAA;EAAA;EAAAD,SAAA,CAAAZ,eAAA,GAAAA,eAAA;EAAA,OAAAY,SAAA;AAAA","ignoreList":[]}
|
|
@@ -5,6 +5,7 @@ declare module "nz/co/siliconst/ui5/metaui/core/ConditionEngine" {
|
|
|
5
5
|
*/
|
|
6
6
|
export class ConditionEngine {
|
|
7
7
|
private schema;
|
|
8
|
+
private boundHandler;
|
|
8
9
|
/**
|
|
9
10
|
* Initializes the ConditionEngine with the active schema.
|
|
10
11
|
* @param schema The current UI layout schema.
|
|
@@ -19,6 +20,10 @@ declare module "nz/co/siliconst/ui5/metaui/core/ConditionEngine" {
|
|
|
19
20
|
* @param event The structured change event.
|
|
20
21
|
*/
|
|
21
22
|
private handleEvent;
|
|
23
|
+
/**
|
|
24
|
+
* Cleans up EventBus listeners to prevent memory leaks on destruction.
|
|
25
|
+
*/
|
|
26
|
+
destroy(): void;
|
|
22
27
|
}
|
|
23
28
|
}
|
|
24
29
|
//# sourceMappingURL=ConditionEngine.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConditionEngine.d.ts","sourceRoot":"
|
|
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;QACxB,OAAO,CAAC,YAAY,CAAqC;QAEzD;;;WAGG;oBACS,MAAM,EAAE,OAAO;QAM3B;;WAEG;QACH,OAAO,CAAC,mBAAmB;QAI3B;;;WAGG;QACH,OAAO,CAAC,WAAW;QAKnB;;WAEG;QACI,OAAO,IAAI,IAAI;KAGzB;CAEA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
sap.ui.define(["./EventBus"],function(
|
|
1
|
+
sap.ui.define(["./EventBus"],function(n){"use strict";const e=n["EventBus"];class s{constructor(n){this.schema=n;this.boundHandler=this.handleEvent.bind(this);this.initializeListeners()}initializeListeners(){e.getInstance().subscribe(this.boundHandler)}handleEvent(n){}destroy(){e.getInstance().unsubscribe(this.boundHandler)}}var t={__esModule:true};t.ConditionEngine=s;return t});
|
|
2
2
|
//# sourceMappingURL=ConditionEngine.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConditionEngine.js","names":["EventBus","___EventBus","ConditionEngine","constructor","schema","this","initializeListeners","getInstance","subscribe","
|
|
1
|
+
{"version":3,"file":"ConditionEngine.js","names":["EventBus","___EventBus","ConditionEngine","constructor","schema","this","boundHandler","handleEvent","bind","initializeListeners","getInstance","subscribe","event","destroy","unsubscribe","__exports","__esModule"],"sources":["ConditionEngine.ts"],"sourcesContent":["/**\n * @file ConditionEngine.ts\n * @description Evaluates dynamic rules to alter the schema in real-time.\n */\n\nimport { EventBus } from \"./EventBus\";\nimport { ISchema } from \"../interfaces/ISchema\";\nimport { IFieldChangeEvent } from \"../interfaces/IEventBus\";\n\n/**\n * Engine that listens to the EventBus and evaluates cross-field dependencies.\n */\nexport class ConditionEngine {\n private schema: ISchema;\n private boundHandler: (event: IFieldChangeEvent) => void;\n\n /**\n * Initializes the ConditionEngine with the active schema.\n * @param schema The current UI layout schema.\n */\n constructor(schema: ISchema) {\n this.schema = schema;\n this.boundHandler = this.handleEvent.bind(this);\n this.initializeListeners();\n }\n\n /**\n * Subscribes to the EventBus for real-time field change interception.\n */\n private initializeListeners(): void {\n EventBus.getInstance().subscribe(this.boundHandler);\n }\n\n /**\n * Internal handler to evaluate business rules when a field is updated.\n * @param event The structured change event.\n */\n private handleEvent(event: IFieldChangeEvent): void {\n // Architecture hook: Logic to evaluate conditions against the schema \n // and update plugin properties will be injected here in later phases.\n }\n\n /**\n * Cleans up EventBus listeners to prevent memory leaks on destruction.\n */\n public destroy(): void {\n EventBus.getInstance().unsubscribe(this.boundHandler);\n }\n}\n"],"mappings":"sDAAA,MAKSA,EAAQC,EAAA,YAOV,MAAMC,EAQTC,YAAYC,GACRC,KAAKD,OAASA,EACdC,KAAKC,aAAeD,KAAKE,YAAYC,KAAKH,MAC1CA,KAAKI,qBACT,CAKQA,sBACJT,EAASU,cAAcC,UAAUN,KAAKC,aAC1C,CAMQC,YAAYK,GAEhB,CAMGC,UACHb,EAASU,cAAcI,YAAYT,KAAKC,aAC5C,EACH,IAAAS,EAAA,CAAAC,WAAA,MAAAD,EAAAb,kBAAA,OAAAa,CAAA","ignoreList":[]}
|