@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
|
@@ -26,6 +26,15 @@ declare module "nz/co/siliconst/ui5/metaui/core/EventBus" {
|
|
|
26
26
|
* @param listener The callback function.
|
|
27
27
|
*/
|
|
28
28
|
subscribe(listener: (event: IFieldChangeEvent) => void): void;
|
|
29
|
+
/**
|
|
30
|
+
* Unregisters a callback listener to prevent memory leaks.
|
|
31
|
+
* @param listener The callback function to remove.
|
|
32
|
+
*/
|
|
33
|
+
unsubscribe(listener: (event: IFieldChangeEvent) => void): void;
|
|
34
|
+
/**
|
|
35
|
+
* Unregisters all callback listeners.
|
|
36
|
+
*/
|
|
37
|
+
unsubscribeAll(): void;
|
|
29
38
|
}
|
|
30
39
|
}
|
|
31
40
|
//# sourceMappingURL=EventBus.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventBus.d.ts","sourceRoot":"
|
|
1
|
+
{"version":3,"file":"EventBus.d.ts","sourceRoot":"../../../../../../../..","sources":["src/nz/co/siliconst/ui5/metaui/core/EventBus.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,0CAA0C,CAAC;IAC1D;;;OAGG;IAEH,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,iDAAiD,CAAC;IAE/F;;OAEG;IACH,MAAa,QAAS,YAAW,SAAS;QACtC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAW;QAClC,OAAO,CAAC,SAAS,CAAiD;QAElE,OAAO;QAIP;;;WAGG;eACW,WAAW,IAAI,QAAQ;QAOrC;;;WAGG;QACI,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI;QAIzD;;;WAGG;QACI,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,GAAG,IAAI;QAIpE;;;WAGG;QACI,WAAW,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,GAAG,IAAI;QAItE;;WAEG;QACI,cAAc,IAAI,IAAI;KAGhC;CAEA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
sap.ui.define([],function(){"use strict";class s{listeners=[];constructor(){}static getInstance(){if(!s.instance){s.instance=new s}return s.instance}publishFieldChange(s){this.listeners.forEach(e=>e(s))}subscribe(s){this.listeners.push(s)}}var e={__esModule:true};e.EventBus=s;return e});
|
|
1
|
+
sap.ui.define([],function(){"use strict";class s{listeners=[];constructor(){}static getInstance(){if(!s.instance){s.instance=new s}return s.instance}publishFieldChange(s){this.listeners.forEach(e=>e(s))}subscribe(s){this.listeners.push(s)}unsubscribe(s){this.listeners=this.listeners.filter(e=>e!==s)}unsubscribeAll(){this.listeners=[]}}var e={__esModule:true};e.EventBus=s;return e});
|
|
2
2
|
//# sourceMappingURL=EventBus.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventBus.js","names":["EventBus","listeners","constructor","getInstance","instance","publishFieldChange","event","this","forEach","listener","subscribe","push","__exports","__esModule"],"sources":["EventBus.ts"],"sourcesContent":["/**\
|
|
1
|
+
{"version":3,"file":"EventBus.js","names":["EventBus","listeners","constructor","getInstance","instance","publishFieldChange","event","this","forEach","listener","subscribe","push","unsubscribe","filter","l","unsubscribeAll","__exports","__esModule"],"sources":["EventBus.ts"],"sourcesContent":["/**\n * @file EventBus.ts\n * @description Internal pub/sub channel for managing cross-field dependencies.\n */\n\nimport { IEventBus, IFieldChangeEvent } from \"../interfaces/IEventBus\";\n\n/**\n * Singleton orchestrator for localized state changes across the generated UI layout.\n */\nexport class EventBus implements IEventBus {\n private static instance: EventBus;\n private listeners: Array<(event: IFieldChangeEvent) => void> = [];\n\n private constructor() {\n // Enforce singleton\n }\n\n /**\n * Retrieves the singular instance of the EventBus.\n * @returns The EventBus singleton.\n */\n public static getInstance(): EventBus {\n if (!EventBus.instance) {\n EventBus.instance = new EventBus();\n }\n return EventBus.instance;\n }\n\n /**\n * Publishes a value change event to all internal subscribers.\n * @param event The structured payload of the field change.\n */\n public publishFieldChange(event: IFieldChangeEvent): void {\n this.listeners.forEach(listener => listener(event));\n }\n\n /**\n * Registers a callback listener to react to field changes.\n * @param listener The callback function.\n */\n public subscribe(listener: (event: IFieldChangeEvent) => void): void {\n this.listeners.push(listener);\n }\n\n /**\n * Unregisters a callback listener to prevent memory leaks.\n * @param listener The callback function to remove.\n */\n public unsubscribe(listener: (event: IFieldChangeEvent) => void): void {\n this.listeners = this.listeners.filter(l => l !== listener);\n }\n\n /**\n * Unregisters all callback listeners.\n */\n public unsubscribeAll(): void {\n this.listeners = [];\n }\n}\n"],"mappings":"yCAUO,MAAMA,EAEDC,UAAuD,GAEvDC,cACJ,CAOJ,kBAAcC,GACV,IAAKH,EAASI,SAAU,CACpBJ,EAASI,SAAW,IAAIJ,CAC5B,CACA,OAAOA,EAASI,QACpB,CAMOC,mBAAmBC,GACtBC,KAAKN,UAAUO,QAAQC,GAAYA,EAASH,GAChD,CAMOI,UAAUD,GACbF,KAAKN,UAAUU,KAAKF,EACxB,CAMOG,YAAYH,GACfF,KAAKN,UAAYM,KAAKN,UAAUY,OAAOC,GAAKA,IAAML,EACtD,CAKOM,iBACHR,KAAKN,UAAY,EACrB,EACH,IAAAe,EAAA,CAAAC,WAAA,MAAAD,EAAAhB,WAAA,OAAAgB,CAAA","ignoreList":[]}
|
|
@@ -1,45 +1,60 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file EventBus.ts
|
|
3
|
-
* @description Internal pub/sub channel for managing cross-field dependencies.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { IEventBus, IFieldChangeEvent } from "../interfaces/IEventBus";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Singleton orchestrator for localized state changes across the generated UI layout.
|
|
10
|
-
*/
|
|
11
|
-
export class EventBus implements IEventBus {
|
|
12
|
-
private static instance: EventBus;
|
|
13
|
-
private listeners: Array<(event: IFieldChangeEvent) => void> = [];
|
|
14
|
-
|
|
15
|
-
private constructor() {
|
|
16
|
-
// Enforce singleton
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Retrieves the singular instance of the EventBus.
|
|
21
|
-
* @returns The EventBus singleton.
|
|
22
|
-
*/
|
|
23
|
-
public static getInstance(): EventBus {
|
|
24
|
-
if (!EventBus.instance) {
|
|
25
|
-
EventBus.instance = new EventBus();
|
|
26
|
-
}
|
|
27
|
-
return EventBus.instance;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Publishes a value change event to all internal subscribers.
|
|
32
|
-
* @param event The structured payload of the field change.
|
|
33
|
-
*/
|
|
34
|
-
public publishFieldChange(event: IFieldChangeEvent): void {
|
|
35
|
-
this.listeners.forEach(listener => listener(event));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Registers a callback listener to react to field changes.
|
|
40
|
-
* @param listener The callback function.
|
|
41
|
-
*/
|
|
42
|
-
public subscribe(listener: (event: IFieldChangeEvent) => void): void {
|
|
43
|
-
this.listeners.push(listener);
|
|
44
|
-
}
|
|
45
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @file EventBus.ts
|
|
3
|
+
* @description Internal pub/sub channel for managing cross-field dependencies.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { IEventBus, IFieldChangeEvent } from "../interfaces/IEventBus";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Singleton orchestrator for localized state changes across the generated UI layout.
|
|
10
|
+
*/
|
|
11
|
+
export class EventBus implements IEventBus {
|
|
12
|
+
private static instance: EventBus;
|
|
13
|
+
private listeners: Array<(event: IFieldChangeEvent) => void> = [];
|
|
14
|
+
|
|
15
|
+
private constructor() {
|
|
16
|
+
// Enforce singleton
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Retrieves the singular instance of the EventBus.
|
|
21
|
+
* @returns The EventBus singleton.
|
|
22
|
+
*/
|
|
23
|
+
public static getInstance(): EventBus {
|
|
24
|
+
if (!EventBus.instance) {
|
|
25
|
+
EventBus.instance = new EventBus();
|
|
26
|
+
}
|
|
27
|
+
return EventBus.instance;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Publishes a value change event to all internal subscribers.
|
|
32
|
+
* @param event The structured payload of the field change.
|
|
33
|
+
*/
|
|
34
|
+
public publishFieldChange(event: IFieldChangeEvent): void {
|
|
35
|
+
this.listeners.forEach(listener => listener(event));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Registers a callback listener to react to field changes.
|
|
40
|
+
* @param listener The callback function.
|
|
41
|
+
*/
|
|
42
|
+
public subscribe(listener: (event: IFieldChangeEvent) => void): void {
|
|
43
|
+
this.listeners.push(listener);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Unregisters a callback listener to prevent memory leaks.
|
|
48
|
+
* @param listener The callback function to remove.
|
|
49
|
+
*/
|
|
50
|
+
public unsubscribe(listener: (event: IFieldChangeEvent) => void): void {
|
|
51
|
+
this.listeners = this.listeners.filter(l => l !== listener);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Unregisters all callback listeners.
|
|
56
|
+
*/
|
|
57
|
+
public unsubscribeAll(): void {
|
|
58
|
+
this.listeners = [];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -1,60 +1,73 @@
|
|
|
1
|
-
sap.ui.define([], function () {
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @file PluginRegistry.ts
|
|
6
|
-
* @description Centralized hub for mapping UI5 controls to SAP schema data types.
|
|
7
|
-
* Enforces the Registry Pattern to decouple the core engine from specific UI5 control implementations.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Singleton registry that manages the lifecycle and lookup of UI5 plugin constructors.
|
|
12
|
-
*/
|
|
13
|
-
class PluginRegistry {
|
|
14
|
-
/** Internal map linking string types to their respective constructor functions. */
|
|
15
|
-
plugins = new Map();
|
|
16
|
-
constructor() {
|
|
17
|
-
// Enforce singleton
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Retrieves the singular instance of the PluginRegistry.
|
|
22
|
-
* @returns The PluginRegistry singleton.
|
|
23
|
-
*/
|
|
24
|
-
static getInstance() {
|
|
25
|
-
if (!PluginRegistry.instance) {
|
|
26
|
-
PluginRegistry.instance = new PluginRegistry();
|
|
27
|
-
}
|
|
28
|
-
return PluginRegistry.instance;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Registers a new UI control plugin against a specific schema primitive type.
|
|
33
|
-
* @param type The primitive FieldType (e.g., 'string', 'date').
|
|
34
|
-
* @param pluginConstructor The class constructor for the plugin.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
*
|
|
44
|
-
* @
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
1
|
+
sap.ui.define([], function () {
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @file PluginRegistry.ts
|
|
6
|
+
* @description Centralized hub for mapping UI5 controls to SAP schema data types.
|
|
7
|
+
* Enforces the Registry Pattern to decouple the core engine from specific UI5 control implementations.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Singleton registry that manages the lifecycle and lookup of UI5 plugin constructors.
|
|
12
|
+
*/
|
|
13
|
+
class PluginRegistry {
|
|
14
|
+
/** Internal map linking string types to their respective constructor functions. */
|
|
15
|
+
plugins = new Map();
|
|
16
|
+
constructor() {
|
|
17
|
+
// Enforce singleton
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Retrieves the singular instance of the PluginRegistry.
|
|
22
|
+
* @returns The PluginRegistry singleton.
|
|
23
|
+
*/
|
|
24
|
+
static getInstance() {
|
|
25
|
+
if (!PluginRegistry.instance) {
|
|
26
|
+
PluginRegistry.instance = new PluginRegistry();
|
|
27
|
+
}
|
|
28
|
+
return PluginRegistry.instance;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Registers a new UI control plugin against a specific schema primitive type (and optional widget).
|
|
33
|
+
* @param type The primitive FieldType (e.g., 'string', 'date').
|
|
34
|
+
* @param pluginConstructor The class constructor for the plugin.
|
|
35
|
+
* @param widgetName Optional widget specific override (e.g., 'textArea').
|
|
36
|
+
*/
|
|
37
|
+
register(type, pluginConstructor, widgetName) {
|
|
38
|
+
const key = widgetName ? `${type}:${widgetName}` : type;
|
|
39
|
+
this.plugins.set(key, pluginConstructor);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Instantiates and returns a new plugin based on the requested primitive type and widget.
|
|
44
|
+
* @param type The primitive FieldType to look up.
|
|
45
|
+
* @param widgetName Optional widget specific override.
|
|
46
|
+
* @throws Error if no plugin has been registered for the provided type.
|
|
47
|
+
* @returns A newly instantiated plugin ready for rendering.
|
|
48
|
+
*/
|
|
49
|
+
getPlugin(type, widgetName) {
|
|
50
|
+
let PluginClass;
|
|
51
|
+
|
|
52
|
+
// 1. Attempt specific widget lookup
|
|
53
|
+
if (widgetName) {
|
|
54
|
+
PluginClass = this.plugins.get(`${type}:${widgetName}`);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// 2. Fallback to primitive type
|
|
58
|
+
if (!PluginClass) {
|
|
59
|
+
PluginClass = this.plugins.get(type);
|
|
60
|
+
}
|
|
61
|
+
if (!PluginClass) {
|
|
62
|
+
throw new Error(`[MetaUI] No plugin registered for FieldType: ${type}`);
|
|
63
|
+
}
|
|
64
|
+
return new PluginClass();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
var __exports = {
|
|
68
|
+
__esModule: true
|
|
69
|
+
};
|
|
70
|
+
__exports.PluginRegistry = PluginRegistry;
|
|
71
|
+
return __exports;
|
|
72
|
+
});
|
|
60
73
|
//# sourceMappingURL=PluginRegistry-dbg.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginRegistry-dbg.js","names":["PluginRegistry","plugins","Map","constructor","getInstance","instance","register","type","pluginConstructor","set","getPlugin","PluginClass","get","Error","__exports","__esModule"],"sources":["PluginRegistry.ts"],"sourcesContent":["/**\
|
|
1
|
+
{"version":3,"file":"PluginRegistry-dbg.js","names":["PluginRegistry","plugins","Map","constructor","getInstance","instance","register","type","pluginConstructor","widgetName","key","set","getPlugin","PluginClass","get","Error","__exports","__esModule"],"sources":["PluginRegistry.ts"],"sourcesContent":["/**\n * @file PluginRegistry.ts\n * @description Centralized hub for mapping UI5 controls to SAP schema data types.\n * Enforces the Registry Pattern to decouple the core engine from specific UI5 control implementations.\n */\n\nimport { IPlugin } from \"../interfaces/IPlugin\";\nimport { FieldType } from \"../interfaces/ISchema\";\n\n/**\n * Singleton registry that manages the lifecycle and lookup of UI5 plugin constructors.\n */\nexport class PluginRegistry {\n private static instance: PluginRegistry;\n \n /** Internal map linking string types to their respective constructor functions. */\n private plugins: Map<string, new () => IPlugin> = new Map();\n\n private constructor() {\n // Enforce singleton\n }\n\n /**\n * Retrieves the singular instance of the PluginRegistry.\n * @returns The PluginRegistry singleton.\n */\n public static getInstance(): PluginRegistry {\n if (!PluginRegistry.instance) {\n PluginRegistry.instance = new PluginRegistry();\n }\n return PluginRegistry.instance;\n }\n\n /**\n * Registers a new UI control plugin against a specific schema primitive type (and optional widget).\n * @param type The primitive FieldType (e.g., 'string', 'date').\n * @param pluginConstructor The class constructor for the plugin.\n * @param widgetName Optional widget specific override (e.g., 'textArea').\n */\n public register(type: FieldType, pluginConstructor: new () => IPlugin, widgetName?: string): void {\n const key = widgetName ? `${type}:${widgetName}` : type;\n this.plugins.set(key, pluginConstructor);\n }\n\n /**\n * Instantiates and returns a new plugin based on the requested primitive type and widget.\n * @param type The primitive FieldType to look up.\n * @param widgetName Optional widget specific override.\n * @throws Error if no plugin has been registered for the provided type.\n * @returns A newly instantiated plugin ready for rendering.\n */\n public getPlugin(type: FieldType, widgetName?: string): IPlugin {\n let PluginClass;\n \n // 1. Attempt specific widget lookup\n if (widgetName) {\n PluginClass = this.plugins.get(`${type}:${widgetName}`);\n }\n \n // 2. Fallback to primitive type\n if (!PluginClass) {\n PluginClass = this.plugins.get(type);\n }\n\n if (!PluginClass) {\n throw new Error(`[MetaUI] No plugin registered for FieldType: ${type}`);\n }\n \n return new PluginClass();\n }\n}\n"],"mappings":";;;EAAA;AACA;AACA;AACA;AACA;;EAKA;AACA;AACA;EACO,MAAMA,cAAc,CAAC;IAGxB;IACQC,OAAO,GAAmC,IAAIC,GAAG,CAAC,CAAC;IAEnDC,WAAWA,CAAA,EAAG;MAClB;IAAA;;IAGJ;AACJ;AACA;AACA;IACI,OAAcC,WAAWA,CAAA,EAAmB;MACxC,IAAI,CAACJ,cAAc,CAACK,QAAQ,EAAE;QAC1BL,cAAc,CAACK,QAAQ,GAAG,IAAIL,cAAc,CAAC,CAAC;MAClD;MACA,OAAOA,cAAc,CAACK,QAAQ;IAClC;;IAEA;AACJ;AACA;AACA;AACA;AACA;IACWC,QAAQA,CAACC,IAAe,EAAEC,iBAAoC,EAAEC,UAAmB,EAAQ;MAC9F,MAAMC,GAAG,GAAGD,UAAU,GAAG,GAAGF,IAAI,IAAIE,UAAU,EAAE,GAAGF,IAAI;MACvD,IAAI,CAACN,OAAO,CAACU,GAAG,CAACD,GAAG,EAAEF,iBAAiB,CAAC;IAC5C;;IAEA;AACJ;AACA;AACA;AACA;AACA;AACA;IACWI,SAASA,CAACL,IAAe,EAAEE,UAAmB,EAAW;MAC5D,IAAII,WAAW;;MAEf;MACA,IAAIJ,UAAU,EAAE;QACZI,WAAW,GAAG,IAAI,CAACZ,OAAO,CAACa,GAAG,CAAC,GAAGP,IAAI,IAAIE,UAAU,EAAE,CAAC;MAC3D;;MAEA;MACA,IAAI,CAACI,WAAW,EAAE;QACdA,WAAW,GAAG,IAAI,CAACZ,OAAO,CAACa,GAAG,CAACP,IAAI,CAAC;MACxC;MAEA,IAAI,CAACM,WAAW,EAAE;QACd,MAAM,IAAIE,KAAK,CAAC,gDAAgDR,IAAI,EAAE,CAAC;MAC3E;MAEA,OAAO,IAAIM,WAAW,CAAC,CAAC;IAC5B;EACJ;EAAC,IAAAG,SAAA;IAAAC,UAAA;EAAA;EAAAD,SAAA,CAAAhB,cAAA,GAAAA,cAAA;EAAA,OAAAgB,SAAA;AAAA","ignoreList":[]}
|
|
@@ -20,18 +20,20 @@ declare module "nz/co/siliconst/ui5/metaui/core/PluginRegistry" {
|
|
|
20
20
|
*/
|
|
21
21
|
static getInstance(): PluginRegistry;
|
|
22
22
|
/**
|
|
23
|
-
* Registers a new UI control plugin against a specific schema primitive type.
|
|
23
|
+
* Registers a new UI control plugin against a specific schema primitive type (and optional widget).
|
|
24
24
|
* @param type The primitive FieldType (e.g., 'string', 'date').
|
|
25
25
|
* @param pluginConstructor The class constructor for the plugin.
|
|
26
|
+
* @param widgetName Optional widget specific override (e.g., 'textArea').
|
|
26
27
|
*/
|
|
27
|
-
register(type: FieldType, pluginConstructor: new () => IPlugin): void;
|
|
28
|
+
register(type: FieldType, pluginConstructor: new () => IPlugin, widgetName?: string): void;
|
|
28
29
|
/**
|
|
29
|
-
* Instantiates and returns a new plugin based on the requested primitive type.
|
|
30
|
+
* Instantiates and returns a new plugin based on the requested primitive type and widget.
|
|
30
31
|
* @param type The primitive FieldType to look up.
|
|
32
|
+
* @param widgetName Optional widget specific override.
|
|
31
33
|
* @throws Error if no plugin has been registered for the provided type.
|
|
32
34
|
* @returns A newly instantiated plugin ready for rendering.
|
|
33
35
|
*/
|
|
34
|
-
getPlugin(type: FieldType): IPlugin;
|
|
36
|
+
getPlugin(type: FieldType, widgetName?: string): IPlugin;
|
|
35
37
|
}
|
|
36
38
|
}
|
|
37
39
|
//# sourceMappingURL=PluginRegistry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginRegistry.d.ts","sourceRoot":"
|
|
1
|
+
{"version":3,"file":"PluginRegistry.d.ts","sourceRoot":"../../../../../../../..","sources":["src/nz/co/siliconst/ui5/metaui/core/PluginRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,gDAAgD,CAAC;IAChE;;;;OAIG;IAEH,OAAO,EAAE,OAAO,EAAE,MAAM,+CAA+C,CAAC;IACxE,OAAO,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;IAE1E;;OAEG;IACH,MAAa,cAAc;QACvB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAiB;QAExC,mFAAmF;QACnF,OAAO,CAAC,OAAO,CAA6C;QAE5D,OAAO;QAIP;;;WAGG;eACW,WAAW,IAAI,cAAc;QAO3C;;;;;WAKG;QACI,QAAQ,CAAC,IAAI,EAAE,SAAS,EAAE,iBAAiB,EAAE,UAAU,OAAO,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI;QAKjG;;;;;;WAMG;QACI,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO;KAmBlE;CAEA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
sap.ui.define([],function(){"use strict";class e{plugins=new Map;constructor(){}static getInstance(){if(!e.instance){e.instance=new e}return e.instance}register(e,t){this.plugins.set(
|
|
1
|
+
sap.ui.define([],function(){"use strict";class e{plugins=new Map;constructor(){}static getInstance(){if(!e.instance){e.instance=new e}return e.instance}register(e,t,n){const i=n?`${e}:${n}`:e;this.plugins.set(i,t)}getPlugin(e,t){let n;if(t){n=this.plugins.get(`${e}:${t}`)}if(!n){n=this.plugins.get(e)}if(!n){throw new Error(`[MetaUI] No plugin registered for FieldType: ${e}`)}return new n}}var t={__esModule:true};t.PluginRegistry=e;return t});
|
|
2
2
|
//# sourceMappingURL=PluginRegistry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginRegistry.js","names":["PluginRegistry","plugins","Map","constructor","getInstance","instance","register","type","pluginConstructor","this","set","getPlugin","PluginClass","get","Error","__exports","__esModule"],"sources":["PluginRegistry.ts"],"sourcesContent":["/**\
|
|
1
|
+
{"version":3,"file":"PluginRegistry.js","names":["PluginRegistry","plugins","Map","constructor","getInstance","instance","register","type","pluginConstructor","widgetName","key","this","set","getPlugin","PluginClass","get","Error","__exports","__esModule"],"sources":["PluginRegistry.ts"],"sourcesContent":["/**\n * @file PluginRegistry.ts\n * @description Centralized hub for mapping UI5 controls to SAP schema data types.\n * Enforces the Registry Pattern to decouple the core engine from specific UI5 control implementations.\n */\n\nimport { IPlugin } from \"../interfaces/IPlugin\";\nimport { FieldType } from \"../interfaces/ISchema\";\n\n/**\n * Singleton registry that manages the lifecycle and lookup of UI5 plugin constructors.\n */\nexport class PluginRegistry {\n private static instance: PluginRegistry;\n \n /** Internal map linking string types to their respective constructor functions. */\n private plugins: Map<string, new () => IPlugin> = new Map();\n\n private constructor() {\n // Enforce singleton\n }\n\n /**\n * Retrieves the singular instance of the PluginRegistry.\n * @returns The PluginRegistry singleton.\n */\n public static getInstance(): PluginRegistry {\n if (!PluginRegistry.instance) {\n PluginRegistry.instance = new PluginRegistry();\n }\n return PluginRegistry.instance;\n }\n\n /**\n * Registers a new UI control plugin against a specific schema primitive type (and optional widget).\n * @param type The primitive FieldType (e.g., 'string', 'date').\n * @param pluginConstructor The class constructor for the plugin.\n * @param widgetName Optional widget specific override (e.g., 'textArea').\n */\n public register(type: FieldType, pluginConstructor: new () => IPlugin, widgetName?: string): void {\n const key = widgetName ? `${type}:${widgetName}` : type;\n this.plugins.set(key, pluginConstructor);\n }\n\n /**\n * Instantiates and returns a new plugin based on the requested primitive type and widget.\n * @param type The primitive FieldType to look up.\n * @param widgetName Optional widget specific override.\n * @throws Error if no plugin has been registered for the provided type.\n * @returns A newly instantiated plugin ready for rendering.\n */\n public getPlugin(type: FieldType, widgetName?: string): IPlugin {\n let PluginClass;\n \n // 1. Attempt specific widget lookup\n if (widgetName) {\n PluginClass = this.plugins.get(`${type}:${widgetName}`);\n }\n \n // 2. Fallback to primitive type\n if (!PluginClass) {\n PluginClass = this.plugins.get(type);\n }\n\n if (!PluginClass) {\n throw new Error(`[MetaUI] No plugin registered for FieldType: ${type}`);\n }\n \n return new PluginClass();\n }\n}\n"],"mappings":"yCAYO,MAAMA,EAIDC,QAA0C,IAAIC,IAE9CC,cACJ,CAOJ,kBAAcC,GACV,IAAKJ,EAAeK,SAAU,CAC1BL,EAAeK,SAAW,IAAIL,CAClC,CACA,OAAOA,EAAeK,QAC1B,CAQOC,SAASC,EAAiBC,EAAsCC,GACnE,MAAMC,EAAMD,EAAa,GAAGF,KAAQE,IAAeF,EACnDI,KAAKV,QAAQW,IAAIF,EAAKF,EAC1B,CASOK,UAAUN,EAAiBE,GAC9B,IAAIK,EAGJ,GAAIL,EAAY,CACZK,EAAcH,KAAKV,QAAQc,IAAI,GAAGR,KAAQE,IAC9C,CAGA,IAAKK,EAAa,CACdA,EAAcH,KAAKV,QAAQc,IAAIR,EACnC,CAEA,IAAKO,EAAa,CACd,MAAM,IAAIE,MAAM,gDAAgDT,IACpE,CAEA,OAAO,IAAIO,CACf,EACH,IAAAG,EAAA,CAAAC,WAAA,MAAAD,EAAAjB,iBAAA,OAAAiB,CAAA","ignoreList":[]}
|
|
@@ -1,56 +1,71 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file PluginRegistry.ts
|
|
3
|
-
* @description Centralized hub for mapping UI5 controls to SAP schema data types.
|
|
4
|
-
* Enforces the Registry Pattern to decouple the core engine from specific UI5 control implementations.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { IPlugin } from "../interfaces/IPlugin";
|
|
8
|
-
import { FieldType } from "../interfaces/ISchema";
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Singleton registry that manages the lifecycle and lookup of UI5 plugin constructors.
|
|
12
|
-
*/
|
|
13
|
-
export class PluginRegistry {
|
|
14
|
-
private static instance: PluginRegistry;
|
|
15
|
-
|
|
16
|
-
/** Internal map linking string types to their respective constructor functions. */
|
|
17
|
-
private plugins: Map<
|
|
18
|
-
|
|
19
|
-
private constructor() {
|
|
20
|
-
// Enforce singleton
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Retrieves the singular instance of the PluginRegistry.
|
|
25
|
-
* @returns The PluginRegistry singleton.
|
|
26
|
-
*/
|
|
27
|
-
public static getInstance(): PluginRegistry {
|
|
28
|
-
if (!PluginRegistry.instance) {
|
|
29
|
-
PluginRegistry.instance = new PluginRegistry();
|
|
30
|
-
}
|
|
31
|
-
return PluginRegistry.instance;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Registers a new UI control plugin against a specific schema primitive type.
|
|
36
|
-
* @param type The primitive FieldType (e.g., 'string', 'date').
|
|
37
|
-
* @param pluginConstructor The class constructor for the plugin.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
*
|
|
47
|
-
* @
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @file PluginRegistry.ts
|
|
3
|
+
* @description Centralized hub for mapping UI5 controls to SAP schema data types.
|
|
4
|
+
* Enforces the Registry Pattern to decouple the core engine from specific UI5 control implementations.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { IPlugin } from "../interfaces/IPlugin";
|
|
8
|
+
import { FieldType } from "../interfaces/ISchema";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Singleton registry that manages the lifecycle and lookup of UI5 plugin constructors.
|
|
12
|
+
*/
|
|
13
|
+
export class PluginRegistry {
|
|
14
|
+
private static instance: PluginRegistry;
|
|
15
|
+
|
|
16
|
+
/** Internal map linking string types to their respective constructor functions. */
|
|
17
|
+
private plugins: Map<string, new () => IPlugin> = new Map();
|
|
18
|
+
|
|
19
|
+
private constructor() {
|
|
20
|
+
// Enforce singleton
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Retrieves the singular instance of the PluginRegistry.
|
|
25
|
+
* @returns The PluginRegistry singleton.
|
|
26
|
+
*/
|
|
27
|
+
public static getInstance(): PluginRegistry {
|
|
28
|
+
if (!PluginRegistry.instance) {
|
|
29
|
+
PluginRegistry.instance = new PluginRegistry();
|
|
30
|
+
}
|
|
31
|
+
return PluginRegistry.instance;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Registers a new UI control plugin against a specific schema primitive type (and optional widget).
|
|
36
|
+
* @param type The primitive FieldType (e.g., 'string', 'date').
|
|
37
|
+
* @param pluginConstructor The class constructor for the plugin.
|
|
38
|
+
* @param widgetName Optional widget specific override (e.g., 'textArea').
|
|
39
|
+
*/
|
|
40
|
+
public register(type: FieldType, pluginConstructor: new () => IPlugin, widgetName?: string): void {
|
|
41
|
+
const key = widgetName ? `${type}:${widgetName}` : type;
|
|
42
|
+
this.plugins.set(key, pluginConstructor);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Instantiates and returns a new plugin based on the requested primitive type and widget.
|
|
47
|
+
* @param type The primitive FieldType to look up.
|
|
48
|
+
* @param widgetName Optional widget specific override.
|
|
49
|
+
* @throws Error if no plugin has been registered for the provided type.
|
|
50
|
+
* @returns A newly instantiated plugin ready for rendering.
|
|
51
|
+
*/
|
|
52
|
+
public getPlugin(type: FieldType, widgetName?: string): IPlugin {
|
|
53
|
+
let PluginClass;
|
|
54
|
+
|
|
55
|
+
// 1. Attempt specific widget lookup
|
|
56
|
+
if (widgetName) {
|
|
57
|
+
PluginClass = this.plugins.get(`${type}:${widgetName}`);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// 2. Fallback to primitive type
|
|
61
|
+
if (!PluginClass) {
|
|
62
|
+
PluginClass = this.plugins.get(type);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (!PluginClass) {
|
|
66
|
+
throw new Error(`[MetaUI] No plugin registered for FieldType: ${type}`);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return new PluginClass();
|
|
70
|
+
}
|
|
71
|
+
}
|