@siliconst/metaui 1.4.5 → 1.4.7
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 +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/CameraControl-dbg.js +13 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/CameraControl-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/CameraControl.d.ts +10 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/CameraControl.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/CameraControl.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/CameraControl.ts +10 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost-dbg.js +49 -6
- package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost.d.ts +48 -5
- package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost.ts +49 -5
- package/src/nz/co/siliconst/ui5/metaui/controls/GeolocationControl-dbg.js +32 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/GeolocationControl-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/GeolocationControl.d.ts +7 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/GeolocationControl.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/GeolocationControl.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/GeolocationControl.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/GeolocationControl.ts +11 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/RichTextControl-dbg.js +20 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/RichTextControl-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/RichTextControl.d.ts +12 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/RichTextControl.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/RichTextControl.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/RichTextControl.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/RichTextControl.ts +21 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/SignatureControl-dbg.js +9 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/SignatureControl-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/SignatureControl.d.ts +7 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/SignatureControl.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/SignatureControl.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/SignatureControl.ts +7 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/VoiceInputControl-dbg.js +13 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/VoiceInputControl-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/VoiceInputControl.d.ts +10 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/VoiceInputControl.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/VoiceInputControl.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/VoiceInputControl.ts +10 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost-dbg.js +46 -10
- package/src/nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost.d.ts +17 -5
- package/src/nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost.ts +48 -8
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/DataSyncDelegate-dbg.js +5 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/DataSyncDelegate-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/DataSyncDelegate.d.ts +4 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/DataSyncDelegate.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/DataSyncDelegate.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/DataSyncDelegate.ts +4 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/DialogDelegate-dbg.js +4 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/DialogDelegate-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/DialogDelegate.d.ts +4 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/DialogDelegate.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/DialogDelegate.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/DialogDelegate.ts +4 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ValidationDelegate-dbg.js +4 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ValidationDelegate-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ValidationDelegate.d.ts +4 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ValidationDelegate.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ValidationDelegate.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ValidationDelegate.ts +4 -0
- package/src/nz/co/siliconst/ui5/metaui/core/DefaultLayoutGenerator-dbg.js +45 -12
- package/src/nz/co/siliconst/ui5/metaui/core/DefaultLayoutGenerator-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/DefaultLayoutGenerator.d.ts +6 -0
- package/src/nz/co/siliconst/ui5/metaui/core/DefaultLayoutGenerator.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/DefaultLayoutGenerator.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/DefaultLayoutGenerator.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/DefaultLayoutGenerator.ts +25 -12
- package/src/nz/co/siliconst/ui5/metaui/core/Engine-dbg.js +30 -17
- 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 +8 -8
- 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 +39 -32
- package/src/nz/co/siliconst/ui5/metaui/core/PipelineManager-dbg.js +17 -3
- package/src/nz/co/siliconst/ui5/metaui/core/PipelineManager-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/PipelineManager.d.ts +4 -0
- package/src/nz/co/siliconst/ui5/metaui/core/PipelineManager.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/PipelineManager.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/PipelineManager.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/PipelineManager.ts +13 -3
- package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry-dbg.js +158 -106
- 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 +25 -26
- 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 +176 -113
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer-dbg.js +26 -0
- 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 +22 -0
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer.d.ts.map +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 +22 -0
- package/src/nz/co/siliconst/ui5/metaui/core/StateManager-dbg.js +6 -0
- 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 +5 -0
- 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 +5 -0
- 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 -3
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IPlugin.ts +3 -3
- package/src/nz/co/siliconst/ui5/metaui/layouts/CompactLayout-dbg.js +10 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/CompactLayout-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/CompactLayout.d.ts +9 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/CompactLayout.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/CompactLayout.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/CompactLayout.ts +9 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout-dbg.js +10 -0
- 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 +9 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout.d.ts.map +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 +9 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout-dbg.js +2 -2
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout-dbg.js.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 +2 -2
- package/src/nz/co/siliconst/ui5/metaui/layouts/WizardLayout-dbg.js +9 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/WizardLayout-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/WizardLayout.d.ts +8 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/WizardLayout.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/WizardLayout.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/WizardLayout.ts +8 -0
- package/src/nz/co/siliconst/ui5/metaui/library-dbg.js +2 -32
- package/src/nz/co/siliconst/ui5/metaui/library-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/library-preload.js +36 -37
- package/src/nz/co/siliconst/ui5/metaui/library-preload.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/library.d.ts +0 -6
- 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 +0 -33
- package/src/nz/co/siliconst/ui5/metaui/plugins/actions/ClearFormActionPlugin-dbg.js +2 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/actions/ClearFormActionPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/actions/ClearFormActionPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/actions/ClearFormActionPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/actions/ClearFormActionPlugin.ts +2 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/actions/SubmitFormActionPlugin-dbg.js +2 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/actions/SubmitFormActionPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/actions/SubmitFormActionPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/actions/SubmitFormActionPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/actions/SubmitFormActionPlugin.ts +2 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/ArrayPlugin-dbg.js +23 -5
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/ArrayPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/ArrayPlugin.d.ts +16 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/ArrayPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/ArrayPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/ArrayPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/ArrayPlugin.ts +21 -5
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BarcodeScannerPlugin-dbg.js +21 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BarcodeScannerPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BarcodeScannerPlugin.d.ts +17 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BarcodeScannerPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BarcodeScannerPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BarcodeScannerPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BarcodeScannerPlugin.ts +19 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BasePlugin-dbg.js +6 -6
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BasePlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BasePlugin.d.ts +5 -5
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BasePlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BasePlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BasePlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BasePlugin.ts +6 -6
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BooleanPlugin-dbg.js +3 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BooleanPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BooleanPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BooleanPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BooleanPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BooleanPlugin.ts +4 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/CameraPlugin-dbg.js +21 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/CameraPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/CameraPlugin.d.ts +17 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/CameraPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/CameraPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/CameraPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/CameraPlugin.ts +19 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/CodeEditorPlugin-dbg.js +31 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/CodeEditorPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/CodeEditorPlugin.d.ts +25 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/CodeEditorPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/CodeEditorPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/CodeEditorPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/CodeEditorPlugin.ts +27 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DatePlugin-dbg.js +21 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DatePlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DatePlugin.d.ts +17 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DatePlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DatePlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DatePlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DatePlugin.ts +19 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DateTimePlugin-dbg.js +21 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DateTimePlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DateTimePlugin.d.ts +17 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DateTimePlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DateTimePlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DateTimePlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DateTimePlugin.ts +19 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DropdownPlugin-dbg.js +4 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DropdownPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DropdownPlugin.d.ts +2 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DropdownPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DropdownPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DropdownPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DropdownPlugin.ts +4 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/FileUploaderPlugin-dbg.js +21 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/FileUploaderPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/FileUploaderPlugin.d.ts +17 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/FileUploaderPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/FileUploaderPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/FileUploaderPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/FileUploaderPlugin.ts +19 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/GeolocationPlugin-dbg.js +21 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/GeolocationPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/GeolocationPlugin.d.ts +17 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/GeolocationPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/GeolocationPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/GeolocationPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/GeolocationPlugin.ts +19 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MessageStripPlugin-dbg.js +18 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MessageStripPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MessageStripPlugin.d.ts +16 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MessageStripPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MessageStripPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MessageStripPlugin.ts +16 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MultiSelectPlugin-dbg.js +21 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MultiSelectPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MultiSelectPlugin.d.ts +17 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MultiSelectPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MultiSelectPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MultiSelectPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MultiSelectPlugin.ts +19 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/NumberPlugin-dbg.js +21 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/NumberPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/NumberPlugin.d.ts +17 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/NumberPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/NumberPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/NumberPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/NumberPlugin.ts +19 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/ObjectPlugin-dbg.js +28 -5
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/ObjectPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/ObjectPlugin.d.ts +20 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/ObjectPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/ObjectPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/ObjectPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/ObjectPlugin.ts +25 -5
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/RatingIndicatorPlugin-dbg.js +21 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/RatingIndicatorPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/RatingIndicatorPlugin.d.ts +17 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/RatingIndicatorPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/RatingIndicatorPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/RatingIndicatorPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/RatingIndicatorPlugin.ts +19 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/RichTextPlugin-dbg.js +21 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/RichTextPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/RichTextPlugin.d.ts +17 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/RichTextPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/RichTextPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/RichTextPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/RichTextPlugin.ts +19 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SignaturePlugin-dbg.js +21 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SignaturePlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SignaturePlugin.d.ts +17 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SignaturePlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SignaturePlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SignaturePlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SignaturePlugin.ts +19 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SliderPlugin-dbg.js +21 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SliderPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SliderPlugin.d.ts +17 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SliderPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SliderPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SliderPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SliderPlugin.ts +19 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/StringPlugin-dbg.js +4 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/StringPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/StringPlugin.d.ts +2 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/StringPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/StringPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/StringPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/StringPlugin.ts +4 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SwitchPlugin-dbg.js +21 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SwitchPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SwitchPlugin.d.ts +17 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SwitchPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SwitchPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SwitchPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SwitchPlugin.ts +19 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/TextAreaPlugin-dbg.js +21 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/TextAreaPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/TextAreaPlugin.d.ts +17 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/TextAreaPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/TextAreaPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/TextAreaPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/TextAreaPlugin.ts +19 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/TimePlugin-dbg.js +21 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/TimePlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/TimePlugin.d.ts +17 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/TimePlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/TimePlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/TimePlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/TimePlugin.ts +19 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/VoiceInputPlugin-dbg.js +21 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/VoiceInputPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/VoiceInputPlugin.d.ts +17 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/VoiceInputPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/VoiceInputPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/VoiceInputPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/VoiceInputPlugin.ts +19 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/datasources/RemoteDropdownPlugin-dbg.js +2 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/datasources/RemoteDropdownPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/datasources/RemoteDropdownPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/datasources/RemoteDropdownPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/datasources/RemoteDropdownPlugin.ts +2 -2
- package/src/nz/co/siliconst/ui5/metaui/core/LayoutRegistry-dbg.js +0 -32
- package/src/nz/co/siliconst/ui5/metaui/core/LayoutRegistry-dbg.js.map +0 -1
- package/src/nz/co/siliconst/ui5/metaui/core/LayoutRegistry.d.ts +0 -16
- package/src/nz/co/siliconst/ui5/metaui/core/LayoutRegistry.d.ts.map +0 -1
- package/src/nz/co/siliconst/ui5/metaui/core/LayoutRegistry.js +0 -2
- package/src/nz/co/siliconst/ui5/metaui/core/LayoutRegistry.js.map +0 -1
- package/src/nz/co/siliconst/ui5/metaui/core/LayoutRegistry.ts +0 -26
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Engine-dbg.js","names":["ConditionEngine","___ConditionEngine","PluginRegistry","___PluginRegistry","Logger","___utils_Logger","DefaultLayoutGenerator","___DefaultLayoutGenerator","Engine","conditionEngine","activePlugins","isDisplayMode","constructor","displayMode","build","schema","model","modelName","onSubmit","engineScopeId","onChange","activeModel","isValid","fieldKey","errorMessage","controlId","handleEvent","ensureLayout","warn","layoutStrategy","type","layoutManager","layoutRegistry","getStrict","render","error","msg","message","showErrorPopup","Text","text","generateField","fieldMeta","bindingPath","isTemplate","plugin","getInstance","getPlugin","ui","widget","setDisplayMode","push","path","scopeId","undefined","control","registerPlugin","generateLayout","validateAll","errors","item","result","validate","replace","name","destroy","messageManager","Messaging","existingMessages","getMessageModel","getData","messagesToRemove","targetPath","matched","filter","getTarget","getMessageProcessor","getId","length","removeMessages","__exports","__esModule"],"sources":["Engine.ts"],"sourcesContent":["/**\n * @file Engine.ts\n * @description The central orchestrator that routes data between the Layout Factory and Plugin Registry (v2).\n */\n\nimport { ISchema, IPropertyMetadata } from \"../interfaces/ISchema\";\nimport { ILayoutManager } from \"../interfaces/ILayoutManager\";\nimport { IPlugin, IPluginValidationResult } from \"../interfaces/IPlugin\";\nimport { ConditionEngine } from \"./ConditionEngine\";\nimport { PluginRegistry } from \"./PluginRegistry\";\nimport Control from \"sap/ui/core/Control\";\nimport VBox from \"sap/m/VBox\";\nimport Text from \"sap/m/Text\";\nimport { Registry } from \"./Registry\";\nimport { Logger } from \"../utils/Logger\";\nimport { DefaultLayoutGenerator } from \"./DefaultLayoutGenerator\";\nimport Core from \"sap/ui/core/Core\";\nimport Messaging from \"sap/ui/core/Messaging\";\n\n/**\n * The Engine is responsible for translating a normalized schema into a physical UI5 layout.\n * It delegates layout generation to the configured `LayoutManager` and field generation to the `PluginRegistry`.\n * It is NOT a God Class; it strictly routes execution flow and tracks active plugins for validation.\n * It embodies the \"Plugin-First Philosophy\" by routing all complex field and layout rendering\n * through discrete, decoupled plugins rather than handling native overrides.\n * \n * @namespace nz.co.siliconst.ui5.metaui.core\n * @public\n */\nexport class Engine {\n /** Global registry of all available layout strategies (e.g. Form, Table, Wizard). */\n public static layoutRegistry: Registry<ILayoutManager>;\n /** Handles dynamic conditional logic across the active form. */\n private conditionEngine: ConditionEngine | null = null;\n \n /** Array of all instantiated plugins generated during the current build. */\n private activePlugins: { plugin: IPlugin, path: string }[] = [];\n\n /** Deterministic scope ID injected by the host control to prevent clone collisions. */\n public engineScopeId?: string;\n \n private activeModel?: sap.ui.model.Model;\n \n /** Tracks whether the entire engine is running in Read-Only Display mode. */\n public readonly isDisplayMode: boolean = false;\n\n constructor(displayMode: boolean = false) {\n this.isDisplayMode = displayMode;\n }\n \n /**\n * Bootstraps the layout generation process by resolving the correct layout strategy.\n * \n * @param schema The normalized JSON schema representing the view.\n * @param model The active StateManager JSONModel instance.\n * @param modelName The UI5 model alias used for isolation.\n * @param onSubmit Callback fired when form is submitted.\n * @param engineScopeId Deterministic scope ID for this engine instance.\n * @param onChange Callback fired when field values change.\n * @returns The generated root UI5 Control container.\n */\n public build(schema: ISchema, model: sap.ui.model.Model, modelName: string = \"meta\", onSubmit?: () => void, engineScopeId?: string, onChange?: (isValid: boolean, fieldKey?: string, errorMessage?: string, controlId?: string) => void): Control {\n this.conditionEngine = new ConditionEngine(schema);\n this.activePlugins = [];\n this.activeModel = model;\n this.engineScopeId = engineScopeId;\n this.onChange = (isValid: boolean, fieldKey?: string, errorMessage?: string, controlId?: string) => {\n if (this.conditionEngine && fieldKey) {\n this.conditionEngine.handleEvent(fieldKey, isValid);\n }\n if (onChange) {\n onChange(isValid, fieldKey, errorMessage, controlId);\n }\n };\n \n try {\n // Intercept and synthesize a default layout if the developer/backend failed to provide one\n if (DefaultLayoutGenerator.ensureLayout(schema)) {\n Logger.warn(\"[MetaUI Engine] Missing 'uiLayout' array in schema. Synthesized a default layout mapping to prevent a blank render.\");\n }\n\n const layoutStrategy = schema.layoutStrategy || (schema.type === \"array\" ? \"table\" : \"form\");\n const layoutManager = Engine.layoutRegistry.getStrict(layoutStrategy);\n \n return layoutManager.render(schema, modelName, this, onSubmit);\n } catch (error) {\n const msg = (error as Error).message;\n Logger.error(\"[MetaUI Engine] Critical error during layout generation\", msg);\n Logger.showErrorPopup(`Engine failed to generate the layout.\\n\\nDetails: ${msg}`);\n return new Text({ text: \"Critical Layout Error\" });\n }\n }\n\n /**\n * Instantiates the correct plugin for a specific field based on type and widget hints,\n * and tracks the plugin for global validation.\n * \n * @param fieldMeta The metadata schema specific to the field.\n * @param bindingPath The JSON path representing the field within the payload.\n * @param modelName The UI5 JSONModel name used for data binding.\n * @returns The generated UI5 Control for the field.\n */\n public generateField(fieldMeta: IPropertyMetadata, bindingPath: string, modelName: string, isTemplate: boolean = false): Control {\n try {\n const plugin = PluginRegistry.getInstance().getPlugin(fieldMeta.type || \"string\", fieldMeta.ui?.widget);\n plugin.setDisplayMode(this.isDisplayMode);\n \n if (!isTemplate) {\n this.activePlugins.push({ plugin, path: bindingPath });\n }\n const scopeId = isTemplate ? undefined : this.engineScopeId;\n const control = plugin.render(fieldMeta, bindingPath, modelName, scopeId, this.onChange);\n \n if (this.conditionEngine) {\n this.conditionEngine.registerPlugin(bindingPath, plugin);\n }\n \n return control;\n } catch (error) {\n const msg = (error as Error).message;\n Logger.error(`[MetaUI Engine] Failed to generate field at ${bindingPath}`, msg);\n Logger.showErrorPopup(`Failed to generate field '${bindingPath}'.\\n\\nDetails: ${msg}`);\n return new Text({ text: `[Error generating field ${bindingPath}]` });\n }\n }\n\n /**\n * Generates a sub-layout (like an embedded table or nested form) without \n * destroying the current Engine state or Condition tracking.\n * \n * @param schema The normalized JSON schema representing the view.\n * @param modelName The UI5 JSONModel name used for data binding (defaults to \"meta\").\n * @param bindingPath Optional path to bind the sub-layout to a specific array/object property.\n * @returns The generated root UI5 Control container.\n */\n public generateLayout(schema: ISchema, modelName: string, bindingPath?: string): Control {\n try {\n const layoutStrategy = schema.layoutStrategy || (schema.type === \"array\" ? \"table\" : \"form\");\n const layoutManager = Engine.layoutRegistry.getStrict(layoutStrategy);\n return layoutManager.render(schema, modelName, this, undefined, bindingPath);\n } catch (error) {\n const msg = (error as Error).message;\n Logger.error(`[MetaUI Engine] Critical error generating sub-layout for ${bindingPath}`, msg);\n Logger.showErrorPopup(`Engine failed to generate a sub-layout.\\n\\nDetails: ${msg}`);\n return new Text({ text: \"Critical Sub-Layout Error\" });\n }\n }\n\n /**\n * Iterates through all active plugins and triggers their internal validation pipelines.\n * \n * @returns {IPluginValidationResult[]} Array of validation error objects. Empty array if valid.\n */\n public validateAll(): IPluginValidationResult[] {\n const errors: IPluginValidationResult[] = [];\n for (const item of this.activePlugins) {\n const result = item.plugin.validate();\n if (!result.isValid) {\n // Ensure the path is bound to the error so GeneratorHost knows where to target it\n result.fieldKey = result.fieldKey || item.path.replace(/^\\//, \"\");\n errors.push(result);\n // Add console log to find which plugin fails silently\n Logger.error(\"[MetaUI Validation] Plugin failed validation silently:\", item.path || item.plugin.constructor.name);\n }\n }\n return errors;\n }\n\n /**\n * Cleans up internal state and destroys the condition engine to prevent memory leaks.\n */\n public destroy(): void {\n if (this.conditionEngine) {\n this.conditionEngine.destroy();\n this.conditionEngine = null;\n }\n \n // ------------------------------------------------------------------------\n // Ghost Error Prevention\n // Flush MessageManager for active plugins before destroying their controls\n // ------------------------------------------------------------------------\n const messageManager = Messaging;\n const existingMessages = messageManager.getMessageModel().getData();\n const messagesToRemove: any[] = [];\n \n for (const item of this.activePlugins) {\n if (this.activeModel) {\n const targetPath = `/${item.path.replace(/^\\//, \"\")}`;\n const matched = existingMessages.filter((msg: any) => \n msg.getTarget() === targetPath && msg.getMessageProcessor() && msg.getMessageProcessor().getId() === this.activeModel.getId()\n );\n messagesToRemove.push(...matched);\n }\n if (typeof item.plugin.destroy === \"function\") {\n item.plugin.destroy();\n }\n }\n \n if (messagesToRemove.length > 0) {\n messageManager.removeMessages(messagesToRemove);\n }\n \n this.activePlugins = [];\n }\n}\n"],"mappings":";;;EAAA;AACA;AACA;AACA;EAHA,MAQSA,eAAe,GAAAC,kBAAA;EAAA,MACfC,cAAc,GAAAC,iBAAA;EAAA,MAKdC,MAAM,GAAAC,eAAA;EAAA,MACNC,sBAAsB,GAAAC,yBAAA;EAI/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACO,MAAMC,MAAM,CAAC;IAChB;;IAEA;IACQC,eAAe,GAA2B,IAAI;;IAEtD;IACQC,aAAa,GAAwC,EAAE;;IAE/D;;IAKA;IACgBC,aAAa,GAAY,KAAK;IAE9CC,WAAWA,CAACC,WAAoB,GAAG,KAAK,EAAE;MACtC,IAAI,CAACF,aAAa,GAAGE,WAAW;IACpC;;IAEA;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACWC,KAAKA,CAACC,MAAe,EAAEC,KAAyB,EAAEC,SAAiB,GAAG,MAAM,EAAEC,QAAqB,EAAEC,aAAsB,EAAEC,QAAmG,EAAW;MAC9O,IAAI,CAACX,eAAe,GAAG,IAAIT,eAAe,CAACe,MAAM,CAAC;MAClD,IAAI,CAACL,aAAa,GAAG,EAAE;MACvB,IAAI,CAACW,WAAW,GAAGL,KAAK;MACxB,IAAI,CAACG,aAAa,GAAGA,aAAa;MAClC,IAAI,CAACC,QAAQ,GAAG,CAACE,OAAgB,EAAEC,QAAiB,EAAEC,YAAqB,EAAEC,SAAkB,KAAK;QAChG,IAAI,IAAI,CAAChB,eAAe,IAAIc,QAAQ,EAAE;UAClC,IAAI,CAACd,eAAe,CAACiB,WAAW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MAElC,KAAK,MAAMX,IAAI,IAAI,IAAI,CAAClD,aAAa,EAAE;QACnC,IAAI,IAAI,CAACW,WAAW,EAAE;UAClB,MAAMmD,UAAU,GAAG,IAAIZ,IAAI,CAACR,IAAI,CAACW,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE;UACrD,MAAMU,OAAO,GAAGL,gBAAgB,CAACM,MAAM,CAAEtC,GAAQ,IAC7CA,GAAG,CAACuC,SAAS,CAAC,CAAC,KAAKH,UAAU,IAAIpC,GAAG,CAACwC,mBAAmB,CAAC,CAAC,IAAIxC,GAAG,CAACwC,mBAAmB,CAAC,CAAC,CAACC,KAAK,CAAC,CAAC,KAAK,IAAI,CAACxD,WAAW,CAACwD,KAAK,CAAC,CAChI,CAAC;UACDN,gBAAgB,CAACpB,IAAI,CAAC,GAAGsB,OAAO,CAAC;QACrC;QACA,IAAI,OAAOb,IAAI,CAACf,MAAM,CAACoB,OAAO,KAAK,UAAU,EAAE;UAC3CL,IAAI,CAACf,MAAM,CAACoB,OAAO,CAAC,CAAC;QACzB;MACJ;MAEA,IAAIM,gBAAgB,CAACO,MAAM,GAAG,CAAC,EAAE;QAC7BZ,cAAc,CAACa,cAAc,CAACR,gBAAgB,CAAC;MACnD;MAEA,IAAI,CAAC7D,aAAa,GAAG,EAAE;IAC3B;EACJ;EAAC,IAAAsE,SAAA;IAAAC,UAAA;EAAA;EAAAD,SAAA,CAAAxE,MAAA,GAAAA,MAAA;EAAA,OAAAwE,SAAA;AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Engine-dbg.js","names":["ConditionEngine","___ConditionEngine","PluginRegistry","___PluginRegistry","Logger","___utils_Logger","DefaultLayoutGenerator","___DefaultLayoutGenerator","Engine","conditionEngine","activePlugins","isEditable","constructor","editable","build","schema","model","modelName","onSubmit","engineScopeId","onChange","activeModel","isValid","fieldKey","errorMessage","controlId","handleEvent","ensureLayout","warn","layoutStrategy","type","layoutManager","getInstance","getLayout","render","error","msg","message","showErrorPopup","Text","text","generateField","fieldMeta","bindingPath","isTemplate","plugin","getPlugin","ui","widget","setEditable","push","path","scopeId","undefined","control","registerPlugin","generateLayout","validateAll","errors","item","result","validate","replace","name","destroy","messageManager","Messaging","existingMessages","getMessageModel","getData","messagesToRemove","targetPath","matched","filter","getTarget","getMessageProcessor","getId","length","removeMessages","__exports","__esModule"],"sources":["Engine.ts"],"sourcesContent":["/**\n * @file Engine.ts\n * @description The central orchestrator that routes data between the Layout Factory and Plugin Registry (v2).\n */\n\nimport { ISchema, IPropertyMetadata } from \"../interfaces/ISchema\";\nimport { ILayoutManager } from \"../interfaces/ILayoutManager\";\nimport { IPlugin, IPluginValidationResult } from \"../interfaces/IPlugin\";\nimport { ConditionEngine } from \"./ConditionEngine\";\nimport { PluginRegistry } from \"./PluginRegistry\";\nimport Control from \"sap/ui/core/Control\";\nimport VBox from \"sap/m/VBox\";\nimport Text from \"sap/m/Text\";\nimport { Logger } from \"../utils/Logger\";\nimport { DefaultLayoutGenerator } from \"./DefaultLayoutGenerator\";\nimport Core from \"sap/ui/core/Core\";\nimport Messaging from \"sap/ui/core/Messaging\";\n\n/**\n * The Engine is responsible for translating a normalized schema into a physical UI5 layout.\n * It delegates layout generation to the configured `LayoutManager` and field generation to the `PluginRegistry`.\n * It strictly routes execution flow and tracks active plugins for validation.\n * It embodies the \"Plugin-First Philosophy\" by routing all complex field and layout rendering\n * through discrete, decoupled plugins rather than handling native overrides.\n * \n * @namespace nz.co.siliconst.ui5.metaui.core\n * @public\n */\nexport class Engine {\n /** Handles dynamic conditional logic across the active form. */\n private conditionEngine: ConditionEngine | null = null;\n\n /** Array of all instantiated plugins generated during the current build. */\n private activePlugins: { plugin: IPlugin, path: string }[] = [];\n\n /** Deterministic scope ID injected by the host control to prevent clone collisions. */\n public engineScopeId?: string;\n\n private activeModel?: sap.ui.model.Model;\n\n /** Tracks whether the entire engine is running in Editable mode. */\n public readonly isEditable: boolean = true;\n\n /**\n * Initializes a new Engine instance.\n * @param editable Whether the engine should render form fields as editable or read-only.\n */\n constructor(editable: boolean = true) {\n this.isEditable = editable;\n }\n\n /**\n * Bootstraps the layout generation process by resolving the correct layout strategy.\n * \n * @param schema The normalized JSON schema representing the view.\n * @param model The active StateManager JSONModel instance.\n * @param modelName The UI5 model alias used for isolation.\n * @param onSubmit Callback fired when form is submitted.\n * @param engineScopeId Deterministic scope ID for this engine instance.\n * @param onChange Callback fired when field values change.\n * @returns The generated root UI5 Control container.\n */\n public build(schema: ISchema, model: sap.ui.model.Model, modelName: string = \"meta\", onSubmit?: () => void, engineScopeId?: string, onChange?: (isValid: boolean, fieldKey?: string, errorMessage?: string, controlId?: string) => void): Control {\n this.conditionEngine = new ConditionEngine(schema);\n this.activePlugins = [];\n this.activeModel = model;\n this.engineScopeId = engineScopeId;\n this.onChange = (isValid: boolean, fieldKey?: string, errorMessage?: string, controlId?: string) => {\n if (this.conditionEngine && fieldKey) {\n this.conditionEngine.handleEvent(fieldKey, isValid);\n }\n if (onChange) {\n onChange(isValid, fieldKey, errorMessage, controlId);\n }\n };\n\n try {\n // Intercept and synthesize a default layout if the developer/backend failed to provide one\n if (DefaultLayoutGenerator.ensureLayout(schema)) {\n Logger.warn(\"[MetaUI Engine] Missing 'uiLayout' array in schema. Synthesized a default layout mapping to prevent a blank render.\");\n }\n\n const layoutStrategy = schema.layoutStrategy || (schema.type === \"array\" ? \"table\" : \"form\");\n const layoutManager = PluginRegistry.getInstance().getLayout(layoutStrategy);\n\n return layoutManager.render(schema, modelName, this, onSubmit);\n } catch (error) {\n const msg = (error as Error).message;\n Logger.error(\"[MetaUI Engine] Critical error during layout generation\", msg);\n Logger.showErrorPopup(`Engine failed to generate the layout.\\n\\nDetails: ${msg}`);\n return new Text({ text: \"Critical Layout Error\" });\n }\n }\n\n /**\n * Instantiates the correct plugin for a specific field based on type and widget hints,\n * and tracks the plugin for global validation.\n * \n * @param fieldMeta The metadata schema specific to the field.\n * @param bindingPath The JSON path representing the field within the payload.\n * @param modelName The UI5 JSONModel name used for data binding.\n * @returns The generated UI5 Control for the field.\n */\n public generateField(fieldMeta: IPropertyMetadata, bindingPath: string, modelName: string, isTemplate: boolean = false): Control {\n try {\n const plugin = PluginRegistry.getInstance().getPlugin(fieldMeta.type || \"string\", fieldMeta.ui?.widget);\n plugin.setEditable(this.isEditable);\n\n if (!isTemplate) {\n this.activePlugins.push({ plugin, path: bindingPath });\n }\n const scopeId = isTemplate ? undefined : this.engineScopeId;\n const control = plugin.render(fieldMeta, bindingPath, modelName, scopeId, this.onChange);\n\n if (this.conditionEngine) {\n this.conditionEngine.registerPlugin(bindingPath, plugin);\n }\n\n return control;\n } catch (error) {\n const msg = (error as Error).message;\n Logger.error(`[MetaUI Engine] Failed to generate field at ${bindingPath}`, msg);\n Logger.showErrorPopup(`Failed to generate field '${bindingPath}'.\\n\\nDetails: ${msg}`);\n return new Text({ text: `[Error generating field ${bindingPath}]` });\n }\n }\n\n /**\n * Generates a sub-layout (like an embedded table or nested form) without \n * destroying the current Engine state or Condition tracking.\n * \n * @param schema The normalized JSON schema representing the view.\n * @param modelName The UI5 JSONModel name used for data binding (defaults to \"meta\").\n * @param bindingPath Optional path to bind the sub-layout to a specific array/object property.\n * @returns The generated root UI5 Control container.\n */\n public generateLayout(schema: ISchema, modelName: string, bindingPath?: string): Control {\n try {\n const layoutStrategy = schema.layoutStrategy || (schema.type === \"array\" ? \"table\" : \"form\");\n const layoutManager = PluginRegistry.getInstance().getLayout(layoutStrategy);\n return layoutManager.render(schema, modelName, this, undefined, bindingPath);\n } catch (error) {\n const msg = (error as Error).message;\n Logger.error(`[MetaUI Engine] Critical error generating sub-layout for ${bindingPath}`, msg);\n Logger.showErrorPopup(`Engine failed to generate a sub-layout.\\n\\nDetails: ${msg}`);\n return new Text({ text: \"Critical Sub-Layout Error\" });\n }\n }\n\n /**\n * Iterates through all active plugins and triggers their internal validation pipelines.\n * \n * @returns {IPluginValidationResult[]} Array of validation error objects. Empty array if valid.\n */\n public validateAll(): IPluginValidationResult[] {\n const errors: IPluginValidationResult[] = [];\n for (const item of this.activePlugins) {\n try {\n const result = item.plugin.validate();\n if (!result.isValid) {\n // Ensure the path is bound to the error so GeneratorHost knows where to target it\n result.fieldKey = result.fieldKey || item.path.replace(/^\\//, \"\");\n errors.push(result);\n // Add console log to find which plugin fails silently\n Logger.error(\"[MetaUI Validation] Plugin failed validation silently:\", item.path || item.plugin.constructor.name);\n }\n } catch (error) {\n const msg = (error as Error).message;\n Logger.error(`[MetaUI Validation] Exception during plugin validation at path ${item.path}`, msg);\n errors.push({ isValid: false, errorMessage: `Validation crashed: ${msg}`, fieldKey: item.path.replace(/^\\//, \"\") });\n }\n }\n return errors;\n }\n\n /**\n * Cleans up internal state and destroys the condition engine to prevent memory leaks.\n */\n public destroy(): void {\n if (this.conditionEngine) {\n this.conditionEngine.destroy();\n this.conditionEngine = null;\n }\n\n // ------------------------------------------------------------------------\n // Ghost Error Prevention\n // Flush MessageManager for active plugins before destroying their controls\n // ------------------------------------------------------------------------\n const messageManager = Messaging;\n const existingMessages = messageManager.getMessageModel().getData();\n const messagesToRemove: any[] = [];\n\n for (const item of this.activePlugins) {\n if (this.activeModel) {\n const targetPath = `/${item.path.replace(/^\\//, \"\")}`;\n const matched = existingMessages.filter((msg: any) =>\n msg.getTarget() === targetPath && msg.getMessageProcessor() && msg.getMessageProcessor().getId() === this.activeModel.getId()\n );\n messagesToRemove.push(...matched);\n }\n if (typeof item.plugin.destroy === \"function\") {\n item.plugin.destroy();\n }\n }\n\n if (messagesToRemove.length > 0) {\n messageManager.removeMessages(messagesToRemove);\n }\n\n this.activePlugins = [];\n }\n}\n"],"mappings":";;;EAAA;AACA;AACA;AACA;EAHA,MAQSA,eAAe,GAAAC,kBAAA;EAAA,MACfC,cAAc,GAAAC,iBAAA;EAAA,MAIdC,MAAM,GAAAC,eAAA;EAAA,MACNC,sBAAsB,GAAAC,yBAAA;EAI/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACO,MAA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;QACnC,IAAI,IAAI,CAACW,WAAW,EAAE;UAClB,MAAMkD,UAAU,GAAG,IAAIZ,IAAI,CAACR,IAAI,CAACW,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE;UACrD,MAAMU,OAAO,GAAGL,gBAAgB,CAACM,MAAM,CAAErC,GAAQ,IAC7CA,GAAG,CAACsC,SAAS,CAAC,CAAC,KAAKH,UAAU,IAAInC,GAAG,CAACuC,mBAAmB,CAAC,CAAC,IAAIvC,GAAG,CAACuC,mBAAmB,CAAC,CAAC,CAACC,KAAK,CAAC,CAAC,KAAK,IAAI,CAACvD,WAAW,CAACuD,KAAK,CAAC,CAChI,CAAC;UACDN,gBAAgB,CAACpB,IAAI,CAAC,GAAGsB,OAAO,CAAC;QACrC;QACA,IAAI,OAAOb,IAAI,CAACd,MAAM,CAACmB,OAAO,KAAK,UAAU,EAAE;UAC3CL,IAAI,CAACd,MAAM,CAACmB,OAAO,CAAC,CAAC;QACzB;MACJ;MAEA,IAAIM,gBAAgB,CAACO,MAAM,GAAG,CAAC,EAAE;QAC7BZ,cAAc,CAACa,cAAc,CAACR,gBAAgB,CAAC;MACnD;MAEA,IAAI,CAAC5D,aAAa,GAAG,EAAE;IAC3B;EACJ;EAAC,IAAAqE,SAAA;IAAAC,UAAA;EAAA;EAAAD,SAAA,CAAAvE,MAAA,GAAAA,MAAA;EAAA,OAAAuE,SAAA;AAAA","ignoreList":[]}
|
|
@@ -4,14 +4,12 @@ declare module "nz/co/siliconst/ui5/metaui/core/Engine" {
|
|
|
4
4
|
* @description The central orchestrator that routes data between the Layout Factory and Plugin Registry (v2).
|
|
5
5
|
*/
|
|
6
6
|
import { ISchema, IPropertyMetadata } from "nz/co/siliconst/ui5/metaui/interfaces/ISchema";
|
|
7
|
-
import { ILayoutManager } from "nz/co/siliconst/ui5/metaui/interfaces/ILayoutManager";
|
|
8
7
|
import { IPluginValidationResult } from "nz/co/siliconst/ui5/metaui/interfaces/IPlugin";
|
|
9
8
|
import Control from "sap/ui/core/Control";
|
|
10
|
-
import { Registry } from "nz/co/siliconst/ui5/metaui/core/Registry";
|
|
11
9
|
/**
|
|
12
10
|
* The Engine is responsible for translating a normalized schema into a physical UI5 layout.
|
|
13
11
|
* It delegates layout generation to the configured `LayoutManager` and field generation to the `PluginRegistry`.
|
|
14
|
-
* It
|
|
12
|
+
* It strictly routes execution flow and tracks active plugins for validation.
|
|
15
13
|
* It embodies the "Plugin-First Philosophy" by routing all complex field and layout rendering
|
|
16
14
|
* through discrete, decoupled plugins rather than handling native overrides.
|
|
17
15
|
*
|
|
@@ -19,8 +17,6 @@ declare module "nz/co/siliconst/ui5/metaui/core/Engine" {
|
|
|
19
17
|
* @public
|
|
20
18
|
*/
|
|
21
19
|
export class Engine {
|
|
22
|
-
/** Global registry of all available layout strategies (e.g. Form, Table, Wizard). */
|
|
23
|
-
static layoutRegistry: Registry<ILayoutManager>;
|
|
24
20
|
/** Handles dynamic conditional logic across the active form. */
|
|
25
21
|
private conditionEngine;
|
|
26
22
|
/** Array of all instantiated plugins generated during the current build. */
|
|
@@ -28,9 +24,13 @@ declare module "nz/co/siliconst/ui5/metaui/core/Engine" {
|
|
|
28
24
|
/** Deterministic scope ID injected by the host control to prevent clone collisions. */
|
|
29
25
|
engineScopeId?: string;
|
|
30
26
|
private activeModel?;
|
|
31
|
-
/** Tracks whether the entire engine is running in
|
|
32
|
-
readonly
|
|
33
|
-
|
|
27
|
+
/** Tracks whether the entire engine is running in Editable mode. */
|
|
28
|
+
readonly isEditable: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Initializes a new Engine instance.
|
|
31
|
+
* @param editable Whether the engine should render form fields as editable or read-only.
|
|
32
|
+
*/
|
|
33
|
+
constructor(editable?: boolean);
|
|
34
34
|
/**
|
|
35
35
|
* Bootstraps the layout generation process by resolving the correct layout strategy.
|
|
36
36
|
*
|
|
@@ -1 +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,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;
|
|
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,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;IAE3F,OAAO,EAAW,uBAAuB,EAAE,MAAM,+CAA+C,CAAC;IAGjG,OAAO,OAAO,MAAM,qBAAqB,CAAC;IAQ1C;;;;;;;;;OASG;IACH,MAAa,MAAM;QACf,gEAAgE;QAChE,OAAO,CAAC,eAAe,CAAgC;QAEvD,4EAA4E;QAC5E,OAAO,CAAC,aAAa,CAA2C;QAEhE,uFAAuF;QAChF,aAAa,CAAC,EAAE,MAAM,CAAC;QAE9B,OAAO,CAAC,WAAW,CAAC,CAAqB;QAEzC,oEAAoE;QACpE,SAAgB,UAAU,EAAE,OAAO,CAAQ;QAE3C;;;WAGG;oBACS,QAAQ,GAAE,OAAc;QAIpC;;;;;;;;;;WAUG;QACI,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,SAAS,GAAE,MAAe,EAAE,QAAQ,CAAC,EAAE,MAAM,IAAI,EAAE,aAAa,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO;QAgCjP;;;;;;;;WAQG;QACI,aAAa,CAAC,SAAS,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,GAAE,OAAe,GAAG,OAAO;QAwBhI;;;;;;;;WAQG;QACI,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO;QAaxF;;;;WAIG;QACI,WAAW,IAAI,uBAAuB,EAAE;QAqB/C;;WAEG;QACI,OAAO,IAAI,IAAI;KAiCzB;CAEA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
sap.ui.define(["./ConditionEngine","./PluginRegistry","sap/m/Text","../utils/Logger","./DefaultLayoutGenerator","sap/ui/core/Messaging"],function(e,t,n,i,r
|
|
1
|
+
sap.ui.define(["./ConditionEngine","./PluginRegistry","sap/m/Text","../utils/Logger","./DefaultLayoutGenerator","sap/ui/core/Messaging"],function(e,t,n,i,a,r){"use strict";const o=e["ConditionEngine"];const s=t["PluginRegistry"];const g=i["Logger"];const l=a["DefaultLayoutGenerator"];class c{conditionEngine=null;activePlugins=[];isEditable=true;constructor(e=true){this.isEditable=e}build(e,t,i="meta",a,r,c){this.conditionEngine=new o(e);this.activePlugins=[];this.activeModel=t;this.engineScopeId=r;this.onChange=(e,t,n,i)=>{if(this.conditionEngine&&t){this.conditionEngine.handleEvent(t,e)}if(c){c(e,t,n,i)}};try{if(l.ensureLayout(e)){g.warn("[MetaUI Engine] Missing 'uiLayout' array in schema. Synthesized a default layout mapping to prevent a blank render.")}const t=e.layoutStrategy||(e.type==="array"?"table":"form");const n=s.getInstance().getLayout(t);return n.render(e,i,this,a)}catch(e){const t=e.message;g.error("[MetaUI Engine] Critical error during layout generation",t);g.showErrorPopup(`Engine failed to generate the layout.\n\nDetails: ${t}`);return new n({text:"Critical Layout Error"})}}generateField(e,t,i,a=false){try{const n=s.getInstance().getPlugin(e.type||"string",e.ui?.widget);n.setEditable(this.isEditable);if(!a){this.activePlugins.push({plugin:n,path:t})}const r=a?undefined:this.engineScopeId;const o=n.render(e,t,i,r,this.onChange);if(this.conditionEngine){this.conditionEngine.registerPlugin(t,n)}return o}catch(e){const i=e.message;g.error(`[MetaUI Engine] Failed to generate field at ${t}`,i);g.showErrorPopup(`Failed to generate field '${t}'.\n\nDetails: ${i}`);return new n({text:`[Error generating field ${t}]`})}}generateLayout(e,t,i){try{const n=e.layoutStrategy||(e.type==="array"?"table":"form");const a=s.getInstance().getLayout(n);return a.render(e,t,this,undefined,i)}catch(e){const t=e.message;g.error(`[MetaUI Engine] Critical error generating sub-layout for ${i}`,t);g.showErrorPopup(`Engine failed to generate a sub-layout.\n\nDetails: ${t}`);return new n({text:"Critical Sub-Layout Error"})}}validateAll(){const e=[];for(const t of this.activePlugins){try{const n=t.plugin.validate();if(!n.isValid){n.fieldKey=n.fieldKey||t.path.replace(/^\//,"");e.push(n);g.error("[MetaUI Validation] Plugin failed validation silently:",t.path||t.plugin.constructor.name)}}catch(n){const i=n.message;g.error(`[MetaUI Validation] Exception during plugin validation at path ${t.path}`,i);e.push({isValid:false,errorMessage:`Validation crashed: ${i}`,fieldKey:t.path.replace(/^\//,"")})}}return e}destroy(){if(this.conditionEngine){this.conditionEngine.destroy();this.conditionEngine=null}const e=r;const t=e.getMessageModel().getData();const n=[];for(const e of this.activePlugins){if(this.activeModel){const i=`/${e.path.replace(/^\//,"")}`;const a=t.filter(e=>e.getTarget()===i&&e.getMessageProcessor()&&e.getMessageProcessor().getId()===this.activeModel.getId());n.push(...a)}if(typeof e.plugin.destroy==="function"){e.plugin.destroy()}}if(n.length>0){e.removeMessages(n)}this.activePlugins=[]}}var u={__esModule:true};u.Engine=c;return u});
|
|
2
2
|
//# sourceMappingURL=Engine.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Engine.js","names":["ConditionEngine","___ConditionEngine","PluginRegistry","___PluginRegistry","Logger","___utils_Logger","DefaultLayoutGenerator","___DefaultLayoutGenerator","Engine","conditionEngine","activePlugins","isDisplayMode","constructor","displayMode","this","build","schema","model","modelName","onSubmit","engineScopeId","onChange","activeModel","isValid","fieldKey","errorMessage","controlId","handleEvent","ensureLayout","warn","layoutStrategy","type","layoutManager","layoutRegistry","getStrict","render","error","msg","message","showErrorPopup","Text","text","generateField","fieldMeta","bindingPath","isTemplate","plugin","getInstance","getPlugin","ui","widget","setDisplayMode","push","path","scopeId","undefined","control","registerPlugin","generateLayout","validateAll","errors","item","result","validate","replace","name","destroy","messageManager","Messaging","existingMessages","getMessageModel","getData","messagesToRemove","targetPath","matched","filter","getTarget","getMessageProcessor","getId","length","removeMessages","__exports","__esModule"],"sources":["Engine.ts"],"sourcesContent":["/**\n * @file Engine.ts\n * @description The central orchestrator that routes data between the Layout Factory and Plugin Registry (v2).\n */\n\nimport { ISchema, IPropertyMetadata } from \"../interfaces/ISchema\";\nimport { ILayoutManager } from \"../interfaces/ILayoutManager\";\nimport { IPlugin, IPluginValidationResult } from \"../interfaces/IPlugin\";\nimport { ConditionEngine } from \"./ConditionEngine\";\nimport { PluginRegistry } from \"./PluginRegistry\";\nimport Control from \"sap/ui/core/Control\";\nimport VBox from \"sap/m/VBox\";\nimport Text from \"sap/m/Text\";\nimport { Registry } from \"./Registry\";\nimport { Logger } from \"../utils/Logger\";\nimport { DefaultLayoutGenerator } from \"./DefaultLayoutGenerator\";\nimport Core from \"sap/ui/core/Core\";\nimport Messaging from \"sap/ui/core/Messaging\";\n\n/**\n * The Engine is responsible for translating a normalized schema into a physical UI5 layout.\n * It delegates layout generation to the configured `LayoutManager` and field generation to the `PluginRegistry`.\n * It is NOT a God Class; it strictly routes execution flow and tracks active plugins for validation.\n * It embodies the \"Plugin-First Philosophy\" by routing all complex field and layout rendering\n * through discrete, decoupled plugins rather than handling native overrides.\n * \n * @namespace nz.co.siliconst.ui5.metaui.core\n * @public\n */\nexport class Engine {\n /** Global registry of all available layout strategies (e.g. Form, Table, Wizard). */\n public static layoutRegistry: Registry<ILayoutManager>;\n /** Handles dynamic conditional logic across the active form. */\n private conditionEngine: ConditionEngine | null = null;\n \n /** Array of all instantiated plugins generated during the current build. */\n private activePlugins: { plugin: IPlugin, path: string }[] = [];\n\n /** Deterministic scope ID injected by the host control to prevent clone collisions. */\n public engineScopeId?: string;\n \n private activeModel?: sap.ui.model.Model;\n \n /** Tracks whether the entire engine is running in Read-Only Display mode. */\n public readonly isDisplayMode: boolean = false;\n\n constructor(displayMode: boolean = false) {\n this.isDisplayMode = displayMode;\n }\n \n /**\n * Bootstraps the layout generation process by resolving the correct layout strategy.\n * \n * @param schema The normalized JSON schema representing the view.\n * @param model The active StateManager JSONModel instance.\n * @param modelName The UI5 model alias used for isolation.\n * @param onSubmit Callback fired when form is submitted.\n * @param engineScopeId Deterministic scope ID for this engine instance.\n * @param onChange Callback fired when field values change.\n * @returns The generated root UI5 Control container.\n */\n public build(schema: ISchema, model: sap.ui.model.Model, modelName: string = \"meta\", onSubmit?: () => void, engineScopeId?: string, onChange?: (isValid: boolean, fieldKey?: string, errorMessage?: string, controlId?: string) => void): Control {\n this.conditionEngine = new ConditionEngine(schema);\n this.activePlugins = [];\n this.activeModel = model;\n this.engineScopeId = engineScopeId;\n this.onChange = (isValid: boolean, fieldKey?: string, errorMessage?: string, controlId?: string) => {\n if (this.conditionEngine && fieldKey) {\n this.conditionEngine.handleEvent(fieldKey, isValid);\n }\n if (onChange) {\n onChange(isValid, fieldKey, errorMessage, controlId);\n }\n };\n \n try {\n // Intercept and synthesize a default layout if the developer/backend failed to provide one\n if (DefaultLayoutGenerator.ensureLayout(schema)) {\n Logger.warn(\"[MetaUI Engine] Missing 'uiLayout' array in schema. Synthesized a default layout mapping to prevent a blank render.\");\n }\n\n const layoutStrategy = schema.layoutStrategy || (schema.type === \"array\" ? \"table\" : \"form\");\n const layoutManager = Engine.layoutRegistry.getStrict(layoutStrategy);\n \n return layoutManager.render(schema, modelName, this, onSubmit);\n } catch (error) {\n const msg = (error as Error).message;\n Logger.error(\"[MetaUI Engine] Critical error during layout generation\", msg);\n Logger.showErrorPopup(`Engine failed to generate the layout.\\n\\nDetails: ${msg}`);\n return new Text({ text: \"Critical Layout Error\" });\n }\n }\n\n /**\n * Instantiates the correct plugin for a specific field based on type and widget hints,\n * and tracks the plugin for global validation.\n * \n * @param fieldMeta The metadata schema specific to the field.\n * @param bindingPath The JSON path representing the field within the payload.\n * @param modelName The UI5 JSONModel name used for data binding.\n * @returns The generated UI5 Control for the field.\n */\n public generateField(fieldMeta: IPropertyMetadata, bindingPath: string, modelName: string, isTemplate: boolean = false): Control {\n try {\n const plugin = PluginRegistry.getInstance().getPlugin(fieldMeta.type || \"string\", fieldMeta.ui?.widget);\n plugin.setDisplayMode(this.isDisplayMode);\n \n if (!isTemplate) {\n this.activePlugins.push({ plugin, path: bindingPath });\n }\n const scopeId = isTemplate ? undefined : this.engineScopeId;\n const control = plugin.render(fieldMeta, bindingPath, modelName, scopeId, this.onChange);\n \n if (this.conditionEngine) {\n this.conditionEngine.registerPlugin(bindingPath, plugin);\n }\n \n return control;\n } catch (error) {\n const msg = (error as Error).message;\n Logger.error(`[MetaUI Engine] Failed to generate field at ${bindingPath}`, msg);\n Logger.showErrorPopup(`Failed to generate field '${bindingPath}'.\\n\\nDetails: ${msg}`);\n return new Text({ text: `[Error generating field ${bindingPath}]` });\n }\n }\n\n /**\n * Generates a sub-layout (like an embedded table or nested form) without \n * destroying the current Engine state or Condition tracking.\n * \n * @param schema The normalized JSON schema representing the view.\n * @param modelName The UI5 JSONModel name used for data binding (defaults to \"meta\").\n * @param bindingPath Optional path to bind the sub-layout to a specific array/object property.\n * @returns The generated root UI5 Control container.\n */\n public generateLayout(schema: ISchema, modelName: string, bindingPath?: string): Control {\n try {\n const layoutStrategy = schema.layoutStrategy || (schema.type === \"array\" ? \"table\" : \"form\");\n const layoutManager = Engine.layoutRegistry.getStrict(layoutStrategy);\n return layoutManager.render(schema, modelName, this, undefined, bindingPath);\n } catch (error) {\n const msg = (error as Error).message;\n Logger.error(`[MetaUI Engine] Critical error generating sub-layout for ${bindingPath}`, msg);\n Logger.showErrorPopup(`Engine failed to generate a sub-layout.\\n\\nDetails: ${msg}`);\n return new Text({ text: \"Critical Sub-Layout Error\" });\n }\n }\n\n /**\n * Iterates through all active plugins and triggers their internal validation pipelines.\n * \n * @returns {IPluginValidationResult[]} Array of validation error objects. Empty array if valid.\n */\n public validateAll(): IPluginValidationResult[] {\n const errors: IPluginValidationResult[] = [];\n for (const item of this.activePlugins) {\n const result = item.plugin.validate();\n if (!result.isValid) {\n // Ensure the path is bound to the error so GeneratorHost knows where to target it\n result.fieldKey = result.fieldKey || item.path.replace(/^\\//, \"\");\n errors.push(result);\n // Add console log to find which plugin fails silently\n Logger.error(\"[MetaUI Validation] Plugin failed validation silently:\", item.path || item.plugin.constructor.name);\n }\n }\n return errors;\n }\n\n /**\n * Cleans up internal state and destroys the condition engine to prevent memory leaks.\n */\n public destroy(): void {\n if (this.conditionEngine) {\n this.conditionEngine.destroy();\n this.conditionEngine = null;\n }\n \n // ------------------------------------------------------------------------\n // Ghost Error Prevention\n // Flush MessageManager for active plugins before destroying their controls\n // ------------------------------------------------------------------------\n const messageManager = Messaging;\n const existingMessages = messageManager.getMessageModel().getData();\n const messagesToRemove: any[] = [];\n \n for (const item of this.activePlugins) {\n if (this.activeModel) {\n const targetPath = `/${item.path.replace(/^\\//, \"\")}`;\n const matched = existingMessages.filter((msg: any) => \n msg.getTarget() === targetPath && msg.getMessageProcessor() && msg.getMessageProcessor().getId() === this.activeModel.getId()\n );\n messagesToRemove.push(...matched);\n }\n if (typeof item.plugin.destroy === \"function\") {\n item.plugin.destroy();\n }\n }\n \n if (messagesToRemove.length > 0) {\n messageManager.removeMessages(messagesToRemove);\n }\n \n this.activePlugins = [];\n }\n}\n"],"mappings":"4KAAA,MAQSA,EAAeC,EAAA,yBACfC,EAAcC,EAAA,wBAKdC,EAAMC,EAAA,gBACNC,EAAsBC,EAAA,0BAcxB,MAAMC,EAIDC,gBAA0C,KAG1CC,cAAqD,GAQ7CC,cAAyB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IAAIZ,EAAKR,KAAKW,QAAQ,MAAO,MAChD,MAAMU,EAAUL,EAAiBM,OAAQtC,GACrCA,EAAIuC,cAAgBH,GAAcpC,EAAIwC,uBAAyBxC,EAAIwC,sBAAsBC,UAAYhE,KAAKQ,YAAYwD,SAE1HN,EAAiBpB,QAAQsB,EAC7B,CACA,UAAWb,EAAKf,OAAOoB,UAAY,WAAY,CAC3CL,EAAKf,OAAOoB,SAChB,CACJ,CAEA,GAAIM,EAAiBO,OAAS,EAAG,CAC7BZ,EAAea,eAAeR,EAClC,CAEA1D,KAAKJ,cAAgB,EACzB,EACH,IAAAuE,EAAA,CAAAC,WAAA,MAAAD,EAAAzE,SAAA,OAAAyE,CAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Engine.js","names":["ConditionEngine","___ConditionEngine","PluginRegistry","___PluginRegistry","Logger","___utils_Logger","DefaultLayoutGenerator","___DefaultLayoutGenerator","Engine","conditionEngine","activePlugins","isEditable","constructor","editable","this","build","schema","model","modelName","onSubmit","engineScopeId","onChange","activeModel","isValid","fieldKey","errorMessage","controlId","handleEvent","ensureLayout","warn","layoutStrategy","type","layoutManager","getInstance","getLayout","render","error","msg","message","showErrorPopup","Text","text","generateField","fieldMeta","bindingPath","isTemplate","plugin","getPlugin","ui","widget","setEditable","push","path","scopeId","undefined","control","registerPlugin","generateLayout","validateAll","errors","item","result","validate","replace","name","destroy","messageManager","Messaging","existingMessages","getMessageModel","getData","messagesToRemove","targetPath","matched","filter","getTarget","getMessageProcessor","getId","length","removeMessages","__exports","__esModule"],"sources":["Engine.ts"],"sourcesContent":["/**\n * @file Engine.ts\n * @description The central orchestrator that routes data between the Layout Factory and Plugin Registry (v2).\n */\n\nimport { ISchema, IPropertyMetadata } from \"../interfaces/ISchema\";\nimport { ILayoutManager } from \"../interfaces/ILayoutManager\";\nimport { IPlugin, IPluginValidationResult } from \"../interfaces/IPlugin\";\nimport { ConditionEngine } from \"./ConditionEngine\";\nimport { PluginRegistry } from \"./PluginRegistry\";\nimport Control from \"sap/ui/core/Control\";\nimport VBox from \"sap/m/VBox\";\nimport Text from \"sap/m/Text\";\nimport { Logger } from \"../utils/Logger\";\nimport { DefaultLayoutGenerator } from \"./DefaultLayoutGenerator\";\nimport Core from \"sap/ui/core/Core\";\nimport Messaging from \"sap/ui/core/Messaging\";\n\n/**\n * The Engine is responsible for translating a normalized schema into a physical UI5 layout.\n * It delegates layout generation to the configured `LayoutManager` and field generation to the `PluginRegistry`.\n * It strictly routes execution flow and tracks active plugins for validation.\n * It embodies the \"Plugin-First Philosophy\" by routing all complex field and layout rendering\n * through discrete, decoupled plugins rather than handling native overrides.\n * \n * @namespace nz.co.siliconst.ui5.metaui.core\n * @public\n */\nexport class Engine {\n /** Handles dynamic conditional logic across the active form. */\n private conditionEngine: ConditionEngine | null = null;\n\n /** Array of all instantiated plugins generated during the current build. */\n private activePlugins: { plugin: IPlugin, path: string }[] = [];\n\n /** Deterministic scope ID injected by the host control to prevent clone collisions. */\n public engineScopeId?: string;\n\n private activeModel?: sap.ui.model.Model;\n\n /** Tracks whether the entire engine is running in Editable mode. */\n public readonly isEditable: boolean = true;\n\n /**\n * Initializes a new Engine instance.\n * @param editable Whether the engine should render form fields as editable or read-only.\n */\n constructor(editable: boolean = true) {\n this.isEditable = editable;\n }\n\n /**\n * Bootstraps the layout generation process by resolving the correct layout strategy.\n * \n * @param schema The normalized JSON schema representing the view.\n * @param model The active StateManager JSONModel instance.\n * @param modelName The UI5 model alias used for isolation.\n * @param onSubmit Callback fired when form is submitted.\n * @param engineScopeId Deterministic scope ID for this engine instance.\n * @param onChange Callback fired when field values change.\n * @returns The generated root UI5 Control container.\n */\n public build(schema: ISchema, model: sap.ui.model.Model, modelName: string = \"meta\", onSubmit?: () => void, engineScopeId?: string, onChange?: (isValid: boolean, fieldKey?: string, errorMessage?: string, controlId?: string) => void): Control {\n this.conditionEngine = new ConditionEngine(schema);\n this.activePlugins = [];\n this.activeModel = model;\n this.engineScopeId = engineScopeId;\n this.onChange = (isValid: boolean, fieldKey?: string, errorMessage?: string, controlId?: string) => {\n if (this.conditionEngine && fieldKey) {\n this.conditionEngine.handleEvent(fieldKey, isValid);\n }\n if (onChange) {\n onChange(isValid, fieldKey, errorMessage, controlId);\n }\n };\n\n try {\n // Intercept and synthesize a default layout if the developer/backend failed to provide one\n if (DefaultLayoutGenerator.ensureLayout(schema)) {\n Logger.warn(\"[MetaUI Engine] Missing 'uiLayout' array in schema. Synthesized a default layout mapping to prevent a blank render.\");\n }\n\n const layoutStrategy = schema.layoutStrategy || (schema.type === \"array\" ? \"table\" : \"form\");\n const layoutManager = PluginRegistry.getInstance().getLayout(layoutStrategy);\n\n return layoutManager.render(schema, modelName, this, onSubmit);\n } catch (error) {\n const msg = (error as Error).message;\n Logger.error(\"[MetaUI Engine] Critical error during layout generation\", msg);\n Logger.showErrorPopup(`Engine failed to generate the layout.\\n\\nDetails: ${msg}`);\n return new Text({ text: \"Critical Layout Error\" });\n }\n }\n\n /**\n * Instantiates the correct plugin for a specific field based on type and widget hints,\n * and tracks the plugin for global validation.\n * \n * @param fieldMeta The metadata schema specific to the field.\n * @param bindingPath The JSON path representing the field within the payload.\n * @param modelName The UI5 JSONModel name used for data binding.\n * @returns The generated UI5 Control for the field.\n */\n public generateField(fieldMeta: IPropertyMetadata, bindingPath: string, modelName: string, isTemplate: boolean = false): Control {\n try {\n const plugin = PluginRegistry.getInstance().getPlugin(fieldMeta.type || \"string\", fieldMeta.ui?.widget);\n plugin.setEditable(this.isEditable);\n\n if (!isTemplate) {\n this.activePlugins.push({ plugin, path: bindingPath });\n }\n const scopeId = isTemplate ? undefined : this.engineScopeId;\n const control = plugin.render(fieldMeta, bindingPath, modelName, scopeId, this.onChange);\n\n if (this.conditionEngine) {\n this.conditionEngine.registerPlugin(bindingPath, plugin);\n }\n\n return control;\n } catch (error) {\n const msg = (error as Error).message;\n Logger.error(`[MetaUI Engine] Failed to generate field at ${bindingPath}`, msg);\n Logger.showErrorPopup(`Failed to generate field '${bindingPath}'.\\n\\nDetails: ${msg}`);\n return new Text({ text: `[Error generating field ${bindingPath}]` });\n }\n }\n\n /**\n * Generates a sub-layout (like an embedded table or nested form) without \n * destroying the current Engine state or Condition tracking.\n * \n * @param schema The normalized JSON schema representing the view.\n * @param modelName The UI5 JSONModel name used for data binding (defaults to \"meta\").\n * @param bindingPath Optional path to bind the sub-layout to a specific array/object property.\n * @returns The generated root UI5 Control container.\n */\n public generateLayout(schema: ISchema, modelName: string, bindingPath?: string): Control {\n try {\n const layoutStrategy = schema.layoutStrategy || (schema.type === \"array\" ? \"table\" : \"form\");\n const layoutManager = PluginRegistry.getInstance().getLayout(layoutStrategy);\n return layoutManager.render(schema, modelName, this, undefined, bindingPath);\n } catch (error) {\n const msg = (error as Error).message;\n Logger.error(`[MetaUI Engine] Critical error generating sub-layout for ${bindingPath}`, msg);\n Logger.showErrorPopup(`Engine failed to generate a sub-layout.\\n\\nDetails: ${msg}`);\n return new Text({ text: \"Critical Sub-Layout Error\" });\n }\n }\n\n /**\n * Iterates through all active plugins and triggers their internal validation pipelines.\n * \n * @returns {IPluginValidationResult[]} Array of validation error objects. Empty array if valid.\n */\n public validateAll(): IPluginValidationResult[] {\n const errors: IPluginValidationResult[] = [];\n for (const item of this.activePlugins) {\n try {\n const result = item.plugin.validate();\n if (!result.isValid) {\n // Ensure the path is bound to the error so GeneratorHost knows where to target it\n result.fieldKey = result.fieldKey || item.path.replace(/^\\//, \"\");\n errors.push(result);\n // Add console log to find which plugin fails silently\n Logger.error(\"[MetaUI Validation] Plugin failed validation silently:\", item.path || item.plugin.constructor.name);\n }\n } catch (error) {\n const msg = (error as Error).message;\n Logger.error(`[MetaUI Validation] Exception during plugin validation at path ${item.path}`, msg);\n errors.push({ isValid: false, errorMessage: `Validation crashed: ${msg}`, fieldKey: item.path.replace(/^\\//, \"\") });\n }\n }\n return errors;\n }\n\n /**\n * Cleans up internal state and destroys the condition engine to prevent memory leaks.\n */\n public destroy(): void {\n if (this.conditionEngine) {\n this.conditionEngine.destroy();\n this.conditionEngine = null;\n }\n\n // ------------------------------------------------------------------------\n // Ghost Error Prevention\n // Flush MessageManager for active plugins before destroying their controls\n // ------------------------------------------------------------------------\n const messageManager = Messaging;\n const existingMessages = messageManager.getMessageModel().getData();\n const messagesToRemove: any[] = [];\n\n for (const item of this.activePlugins) {\n if (this.activeModel) {\n const targetPath = `/${item.path.replace(/^\\//, \"\")}`;\n const matched = existingMessages.filter((msg: any) =>\n msg.getTarget() === targetPath && msg.getMessageProcessor() && msg.getMessageProcessor().getId() === this.activeModel.getId()\n );\n messagesToRemove.push(...matched);\n }\n if (typeof item.plugin.destroy === \"function\") {\n item.plugin.destroy();\n }\n }\n\n if (messagesToRemove.length > 0) {\n messageManager.removeMessages(messagesToRemove);\n }\n\n this.activePlugins = [];\n }\n}\n"],"mappings":"4KAAA,MAQSA,EAAeC,EAAA,yBACfC,EAAcC,EAAA,wBAIdC,EAAMC,EAAA,gBACNC,EAAsBC,EAAA,0BAcxB,MAAMC,EAEDC,gBAA0C,KAG1CC,cAAqD,GAQ7CC,WAAsB,KAMtCC,YAAYC,EAAoB,MAC5BC,KAAKH,WAAaE,CACtB,CAaOE,MAAMC,EAAiBC,EAA2BC,EAAoB,OAAQC,EAAuBC,EAAwBC,GAChIP,KAAKL,gBAAkB,IAAIT,EAAgBgB,GAC3CF,KAAKJ,cAAgB,GACrBI,KAAKQ,YAAcL,EACnBH,KAAKM,cAAgBA,EACrBN,KAAKO,SAAW,CAACE,EAAkBC,EAAmBC,EAAuBC,KACzE,GAAIZ,KAAKL,iBAAmBe,EAAU,CAClCV,KAAKL,gBAAgBkB,YAAYH,EAAUD,EAC/C,CACA,GAAIF,EAAU,CACVA,EAASE,EAASC,EAAUC,EAAcC,EAC9C,GAGJ,IAEI,GAAIpB,EAAuBsB,aAAaZ,GAAS,CAC7CZ,EAAOyB,KAAK,sHAChB,CAEA,MAAMC,EAAiBd,EAAOc,iBAAmBd,EAAOe,OAAS,QAAU,Q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EAzD,KAAKJ,cAAgB,EACzB,EACH,IAAAsE,EAAA,CAAAC,WAAA,MAAAD,EAAAxE,SAAA,OAAAwE,CAAA","ignoreList":[]}
|
|
@@ -11,7 +11,6 @@ import { PluginRegistry } from "./PluginRegistry";
|
|
|
11
11
|
import Control from "sap/ui/core/Control";
|
|
12
12
|
import VBox from "sap/m/VBox";
|
|
13
13
|
import Text from "sap/m/Text";
|
|
14
|
-
import { Registry } from "./Registry";
|
|
15
14
|
import { Logger } from "../utils/Logger";
|
|
16
15
|
import { DefaultLayoutGenerator } from "./DefaultLayoutGenerator";
|
|
17
16
|
import Core from "sap/ui/core/Core";
|
|
@@ -20,7 +19,7 @@ import Messaging from "sap/ui/core/Messaging";
|
|
|
20
19
|
/**
|
|
21
20
|
* The Engine is responsible for translating a normalized schema into a physical UI5 layout.
|
|
22
21
|
* It delegates layout generation to the configured `LayoutManager` and field generation to the `PluginRegistry`.
|
|
23
|
-
* It
|
|
22
|
+
* It strictly routes execution flow and tracks active plugins for validation.
|
|
24
23
|
* It embodies the "Plugin-First Philosophy" by routing all complex field and layout rendering
|
|
25
24
|
* through discrete, decoupled plugins rather than handling native overrides.
|
|
26
25
|
*
|
|
@@ -28,26 +27,28 @@ import Messaging from "sap/ui/core/Messaging";
|
|
|
28
27
|
* @public
|
|
29
28
|
*/
|
|
30
29
|
export class Engine {
|
|
31
|
-
/** Global registry of all available layout strategies (e.g. Form, Table, Wizard). */
|
|
32
|
-
public static layoutRegistry: Registry<ILayoutManager>;
|
|
33
30
|
/** Handles dynamic conditional logic across the active form. */
|
|
34
31
|
private conditionEngine: ConditionEngine | null = null;
|
|
35
|
-
|
|
32
|
+
|
|
36
33
|
/** Array of all instantiated plugins generated during the current build. */
|
|
37
34
|
private activePlugins: { plugin: IPlugin, path: string }[] = [];
|
|
38
35
|
|
|
39
36
|
/** Deterministic scope ID injected by the host control to prevent clone collisions. */
|
|
40
37
|
public engineScopeId?: string;
|
|
41
|
-
|
|
38
|
+
|
|
42
39
|
private activeModel?: sap.ui.model.Model;
|
|
43
|
-
|
|
44
|
-
/** Tracks whether the entire engine is running in Read-Only Display mode. */
|
|
45
|
-
public readonly isDisplayMode: boolean = false;
|
|
46
40
|
|
|
47
|
-
|
|
48
|
-
|
|
41
|
+
/** Tracks whether the entire engine is running in Editable mode. */
|
|
42
|
+
public readonly isEditable: boolean = true;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Initializes a new Engine instance.
|
|
46
|
+
* @param editable Whether the engine should render form fields as editable or read-only.
|
|
47
|
+
*/
|
|
48
|
+
constructor(editable: boolean = true) {
|
|
49
|
+
this.isEditable = editable;
|
|
49
50
|
}
|
|
50
|
-
|
|
51
|
+
|
|
51
52
|
/**
|
|
52
53
|
* Bootstraps the layout generation process by resolving the correct layout strategy.
|
|
53
54
|
*
|
|
@@ -72,7 +73,7 @@ export class Engine {
|
|
|
72
73
|
onChange(isValid, fieldKey, errorMessage, controlId);
|
|
73
74
|
}
|
|
74
75
|
};
|
|
75
|
-
|
|
76
|
+
|
|
76
77
|
try {
|
|
77
78
|
// Intercept and synthesize a default layout if the developer/backend failed to provide one
|
|
78
79
|
if (DefaultLayoutGenerator.ensureLayout(schema)) {
|
|
@@ -80,8 +81,8 @@ export class Engine {
|
|
|
80
81
|
}
|
|
81
82
|
|
|
82
83
|
const layoutStrategy = schema.layoutStrategy || (schema.type === "array" ? "table" : "form");
|
|
83
|
-
const layoutManager =
|
|
84
|
-
|
|
84
|
+
const layoutManager = PluginRegistry.getInstance().getLayout(layoutStrategy);
|
|
85
|
+
|
|
85
86
|
return layoutManager.render(schema, modelName, this, onSubmit);
|
|
86
87
|
} catch (error) {
|
|
87
88
|
const msg = (error as Error).message;
|
|
@@ -103,18 +104,18 @@ export class Engine {
|
|
|
103
104
|
public generateField(fieldMeta: IPropertyMetadata, bindingPath: string, modelName: string, isTemplate: boolean = false): Control {
|
|
104
105
|
try {
|
|
105
106
|
const plugin = PluginRegistry.getInstance().getPlugin(fieldMeta.type || "string", fieldMeta.ui?.widget);
|
|
106
|
-
plugin.
|
|
107
|
-
|
|
107
|
+
plugin.setEditable(this.isEditable);
|
|
108
|
+
|
|
108
109
|
if (!isTemplate) {
|
|
109
110
|
this.activePlugins.push({ plugin, path: bindingPath });
|
|
110
111
|
}
|
|
111
112
|
const scopeId = isTemplate ? undefined : this.engineScopeId;
|
|
112
113
|
const control = plugin.render(fieldMeta, bindingPath, modelName, scopeId, this.onChange);
|
|
113
|
-
|
|
114
|
+
|
|
114
115
|
if (this.conditionEngine) {
|
|
115
116
|
this.conditionEngine.registerPlugin(bindingPath, plugin);
|
|
116
117
|
}
|
|
117
|
-
|
|
118
|
+
|
|
118
119
|
return control;
|
|
119
120
|
} catch (error) {
|
|
120
121
|
const msg = (error as Error).message;
|
|
@@ -136,7 +137,7 @@ export class Engine {
|
|
|
136
137
|
public generateLayout(schema: ISchema, modelName: string, bindingPath?: string): Control {
|
|
137
138
|
try {
|
|
138
139
|
const layoutStrategy = schema.layoutStrategy || (schema.type === "array" ? "table" : "form");
|
|
139
|
-
const layoutManager =
|
|
140
|
+
const layoutManager = PluginRegistry.getInstance().getLayout(layoutStrategy);
|
|
140
141
|
return layoutManager.render(schema, modelName, this, undefined, bindingPath);
|
|
141
142
|
} catch (error) {
|
|
142
143
|
const msg = (error as Error).message;
|
|
@@ -154,13 +155,19 @@ export class Engine {
|
|
|
154
155
|
public validateAll(): IPluginValidationResult[] {
|
|
155
156
|
const errors: IPluginValidationResult[] = [];
|
|
156
157
|
for (const item of this.activePlugins) {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
158
|
+
try {
|
|
159
|
+
const result = item.plugin.validate();
|
|
160
|
+
if (!result.isValid) {
|
|
161
|
+
// Ensure the path is bound to the error so GeneratorHost knows where to target it
|
|
162
|
+
result.fieldKey = result.fieldKey || item.path.replace(/^\//, "");
|
|
163
|
+
errors.push(result);
|
|
164
|
+
// Add console log to find which plugin fails silently
|
|
165
|
+
Logger.error("[MetaUI Validation] Plugin failed validation silently:", item.path || item.plugin.constructor.name);
|
|
166
|
+
}
|
|
167
|
+
} catch (error) {
|
|
168
|
+
const msg = (error as Error).message;
|
|
169
|
+
Logger.error(`[MetaUI Validation] Exception during plugin validation at path ${item.path}`, msg);
|
|
170
|
+
errors.push({ isValid: false, errorMessage: `Validation crashed: ${msg}`, fieldKey: item.path.replace(/^\//, "") });
|
|
164
171
|
}
|
|
165
172
|
}
|
|
166
173
|
return errors;
|
|
@@ -174,7 +181,7 @@ export class Engine {
|
|
|
174
181
|
this.conditionEngine.destroy();
|
|
175
182
|
this.conditionEngine = null;
|
|
176
183
|
}
|
|
177
|
-
|
|
184
|
+
|
|
178
185
|
// ------------------------------------------------------------------------
|
|
179
186
|
// Ghost Error Prevention
|
|
180
187
|
// Flush MessageManager for active plugins before destroying their controls
|
|
@@ -182,11 +189,11 @@ export class Engine {
|
|
|
182
189
|
const messageManager = Messaging;
|
|
183
190
|
const existingMessages = messageManager.getMessageModel().getData();
|
|
184
191
|
const messagesToRemove: any[] = [];
|
|
185
|
-
|
|
192
|
+
|
|
186
193
|
for (const item of this.activePlugins) {
|
|
187
194
|
if (this.activeModel) {
|
|
188
195
|
const targetPath = `/${item.path.replace(/^\//, "")}`;
|
|
189
|
-
const matched = existingMessages.filter((msg: any) =>
|
|
196
|
+
const matched = existingMessages.filter((msg: any) =>
|
|
190
197
|
msg.getTarget() === targetPath && msg.getMessageProcessor() && msg.getMessageProcessor().getId() === this.activeModel.getId()
|
|
191
198
|
);
|
|
192
199
|
messagesToRemove.push(...matched);
|
|
@@ -195,11 +202,11 @@ export class Engine {
|
|
|
195
202
|
item.plugin.destroy();
|
|
196
203
|
}
|
|
197
204
|
}
|
|
198
|
-
|
|
205
|
+
|
|
199
206
|
if (messagesToRemove.length > 0) {
|
|
200
207
|
messageManager.removeMessages(messagesToRemove);
|
|
201
208
|
}
|
|
202
|
-
|
|
209
|
+
|
|
203
210
|
this.activePlugins = [];
|
|
204
211
|
}
|
|
205
212
|
}
|
|
@@ -17,7 +17,9 @@ sap.ui.define(["./Registry", "../plugins/validators/PatternValidatorPlugin", "..
|
|
|
17
17
|
const PhoneFormatterPlugin = ___plugins_formatters_PhoneFormatterPlugin["PhoneFormatterPlugin"];
|
|
18
18
|
const TextCaseFormatterPlugin = ___plugins_formatters_TextCaseFormatterPlugin["TextCaseFormatterPlugin"];
|
|
19
19
|
const Logger = ___utils_Logger["Logger"]; // --- Built-in Default Validators ---
|
|
20
|
+
/** Internal rule for required fields. */
|
|
20
21
|
class RequiredValidator {
|
|
22
|
+
/** Validates that the value is not null, undefined, or empty string. */
|
|
21
23
|
validate(parsedValue, args) {
|
|
22
24
|
if (parsedValue === null || parsedValue === undefined || parsedValue === "") {
|
|
23
25
|
return {
|
|
@@ -30,7 +32,10 @@ sap.ui.define(["./Registry", "../plugins/validators/PatternValidatorPlugin", "..
|
|
|
30
32
|
};
|
|
31
33
|
}
|
|
32
34
|
}
|
|
35
|
+
|
|
36
|
+
/** Internal rule for string maximum length. */
|
|
33
37
|
class MaxLengthValidator {
|
|
38
|
+
/** Validates that a string does not exceed the provided argument length. */
|
|
34
39
|
validate(parsedValue, args) {
|
|
35
40
|
if (typeof parsedValue === "string" && args && typeof args === "number") {
|
|
36
41
|
if (parsedValue.length > args) {
|
|
@@ -94,9 +99,18 @@ sap.ui.define(["./Registry", "../plugins/validators/PatternValidatorPlugin", "..
|
|
|
94
99
|
const validator = this.validators.get(rule);
|
|
95
100
|
if (validator) {
|
|
96
101
|
const args = argsMap ? argsMap[rule] : undefined;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
102
|
+
try {
|
|
103
|
+
const result = validator.validate(parsedValue, args);
|
|
104
|
+
if (!result.isValid) {
|
|
105
|
+
return result; // Fast fail on first error
|
|
106
|
+
}
|
|
107
|
+
} catch (error) {
|
|
108
|
+
const msg = error.message;
|
|
109
|
+
Logger.error(`[MetaUI] PipelineManager: Validator '${rule}' crashed during execution.`, msg);
|
|
110
|
+
return {
|
|
111
|
+
isValid: false,
|
|
112
|
+
errorMessage: `System validation error: ${msg}`
|
|
113
|
+
};
|
|
100
114
|
}
|
|
101
115
|
} else {
|
|
102
116
|
Logger.warn(`[MetaUI] PipelineManager: Requested validator '${rule}' not found in registry.`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PipelineManager-dbg.js","names":["Registry","___Registry","PatternValidatorPlugin","___plugins_validators_PatternValidatorPlugin","MinLengthValidatorPlugin","___plugins_validators_MinLengthValidatorPlugin","RangeValidatorPlugin","___plugins_validators_RangeValidatorPlugin","UrlValidatorPlugin","___plugins_validators_UrlValidatorPlugin","IbanValidatorPlugin","___plugins_validators_IbanValidatorPlugin","EmailValidatorPlugin","___plugins_validators_EmailValidatorPlugin","DateFormatterPlugin","___plugins_formatters_DateFormatterPlugin","PhoneFormatterPlugin","___plugins_formatters_PhoneFormatterPlugin","TextCaseFormatterPlugin","___plugins_formatters_TextCaseFormatterPlugin","Logger","___utils_Logger","RequiredValidator","validate","parsedValue","args","undefined","isValid","errorMessage","MaxLengthValidator","length","PipelineManager","formatters","parsers","validators","constructor","register","executeValidation","requestedValidators","argsMap","rule","validator","get","result","warn","GlobalPipeline","__exports","__esModule"],"sources":["PipelineManager.ts"],"sourcesContent":["/**\n * @file PipelineManager.ts\n * @description Central manager for the data manipulation pipeline. \n * Orchestrates Formatting, Parsing, and Validating data using the generic Registry.\n */\n\nimport { Registry } from \"./Registry\";\nimport { IFormatter, IParser, IValidator, IValidationResult } from \"../interfaces/IPipeline\";\nimport { PatternValidatorPlugin } from \"../plugins/validators/PatternValidatorPlugin\";\nimport { MinLengthValidatorPlugin } from \"../plugins/validators/MinLengthValidatorPlugin\";\nimport { RangeValidatorPlugin } from \"../plugins/validators/RangeValidatorPlugin\";\nimport { UrlValidatorPlugin } from \"../plugins/validators/UrlValidatorPlugin\";\nimport { IbanValidatorPlugin } from \"../plugins/validators/IbanValidatorPlugin\";\nimport { EmailValidatorPlugin } from \"../plugins/validators/EmailValidatorPlugin\";\nimport { DateFormatterPlugin } from \"../plugins/formatters/DateFormatterPlugin\";\nimport { PhoneFormatterPlugin } from \"../plugins/formatters/PhoneFormatterPlugin\";\nimport { TextCaseFormatterPlugin } from \"../plugins/formatters/TextCaseFormatterPlugin\";\nimport { Logger } from \"../utils/Logger\";\n\n// --- Built-in Default Validators ---\nclass RequiredValidator implements IValidator {\n validate(parsedValue: unknown, args?: unknown): IValidationResult {\n if (parsedValue === null || parsedValue === undefined || parsedValue === \"\") {\n return { isValid: false, errorMessage: \"This field is required.\" };\n }\n return { isValid: true };\n }\n}\n\nclass MaxLengthValidator implements IValidator {\n validate(parsedValue: unknown, args?: unknown): IValidationResult {\n if (typeof parsedValue === \"string\" && args && typeof args === \"number\") {\n if (parsedValue.length > args) {\n return { isValid: false, errorMessage: `Maximum length is ${args} characters.` };\n }\n }\n return { isValid: true };\n }\n}\n\n\n/**\n * The core engine responsible for marshalling data through the validation, formatting, and parsing phases.\n * Pluggable design allows new validators to be registered dynamically.\n * \n * @namespace nz.co.siliconst.ui5.metaui.core\n * @public\n */\nexport class PipelineManager {\n /** Registry of data formatters applied before pushing to the UI. */\n public readonly formatters: Registry<IFormatter> = new Registry<IFormatter>(\"Formatters\");\n /** Registry of data parsers applied when pulling data from the UI. */\n public readonly parsers: Registry<IParser> = new Registry<IParser>(\"Parsers\");\n /** Registry of business logic validators. */\n public readonly validators: Registry<IValidator> = new Registry<IValidator>(\"Validators\");\n\n /**\n * Bootstraps the PipelineManager with default validators (required, maxLength, email).\n */\n constructor() {\n // Register default validators\n this.validators.register(\"required\", new RequiredValidator());\n this.validators.register(\"maxLength\", new MaxLengthValidator());\n this.validators.register(\"pattern\", new PatternValidatorPlugin());\n this.validators.register(\"minLength\", new MinLengthValidatorPlugin());\n this.validators.register(\"range\", new RangeValidatorPlugin());\n this.validators.register(\"url\", new UrlValidatorPlugin());\n this.validators.register(\"iban\", new IbanValidatorPlugin());\n this.validators.register(\"email\", new EmailValidatorPlugin());\n\n // Register default formatters\n this.formatters.register(\"date\", new DateFormatterPlugin());\n this.formatters.register(\"phone\", new PhoneFormatterPlugin());\n this.formatters.register(\"textCase\", new TextCaseFormatterPlugin());\n }\n\n /**\n * Executes the validation pipeline sequentially. Fails fast on the first encountered error.\n * \n * @param parsedValue The raw extracted value from the UI control.\n * @param requestedValidators Array of validation rule keys (e.g. ['required', 'email']).\n * @param argsMap Optional map of parameters required by specific rules (e.g. { maxLength: 50 }).\n * @returns {IValidationResult} The final result state and any associated error message.\n */\n public executeValidation(parsedValue: unknown, requestedValidators: string[], argsMap?: Record<string, any>): IValidationResult {\n for (const rule of requestedValidators) {\n const validator = this.validators.get(rule);\n if (validator) {\n const args = argsMap ? argsMap[rule] : undefined;\n const result = validator.validate(parsedValue, args);\n if (!result.isValid) {\n return result; // Fast fail on first error\n }\n } else {\n Logger.warn(`[MetaUI] PipelineManager: Requested validator '${rule}' not found in registry.`);\n }\n }\n return { isValid: true };\n }\n}\n\n/** \n * Singleton instance for global access to the active validation pipeline. \n * @public \n */\nexport const GlobalPipeline = new PipelineManager();\n"],"mappings":";;;EAAA;AACA;AACA;AACA;AACA;EAJA,MAMSA,QAAQ,GAAAC,WAAA;EAAA,MAERC,sBAAsB,GAAAC,4CAAA;EAAA,MACtBC,wBAAwB,GAAAC,8CAAA;EAAA,MACxBC,oBAAoB,GAAAC,0CAAA;EAAA,MACpBC,kBAAkB,GAAAC,wCAAA;EAAA,MAClBC,mBAAmB,GAAAC,yCAAA;EAAA,MACnBC,oBAAoB,GAAAC,0CAAA;EAAA,MACpBC,mBAAmB,GAAAC,yCAAA;EAAA,MACnBC,oBAAoB,GAAAC,0CAAA;EAAA,MACpBC,uBAAuB,GAAAC,6CAAA;EAAA,MACvBC,MAAM,GAAAC,eAAA,YAEf;EACA,MAAMC,iBAAiB,CAAuB;IAC1CC,QAAQA,CAACC,WAAoB,EAAEC,IAAc,EAAq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,IAAI,0BAA0B,CAAC;QACjG;MACJ;MACA,OAAO;QAAEb,OAAO,EAAE;MAAK,CAAC;IAC5B;EACJ;;EAEA;AACA;AACA;AACA;EACO,MAAMkB,cAAc,GAAG,IAAId,eAAe,CAAC,CAAC;EAAC,IAAAe,SAAA;IAAAC,UAAA;EAAA;EAAAD,SAAA,CAAAf,eAAA,GAAAA,eAAA;EAAAe,SAAA,CAAAD,cAAA,GAAAA,cAAA;EAAA,OAAAC,SAAA;AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"PipelineManager-dbg.js","names":["Registry","___Registry","PatternValidatorPlugin","___plugins_validators_PatternValidatorPlugin","MinLengthValidatorPlugin","___plugins_validators_MinLengthValidatorPlugin","RangeValidatorPlugin","___plugins_validators_RangeValidatorPlugin","UrlValidatorPlugin","___plugins_validators_UrlValidatorPlugin","IbanValidatorPlugin","___plugins_validators_IbanValidatorPlugin","EmailValidatorPlugin","___plugins_validators_EmailValidatorPlugin","DateFormatterPlugin","___plugins_formatters_DateFormatterPlugin","PhoneFormatterPlugin","___plugins_formatters_PhoneFormatterPlugin","TextCaseFormatterPlugin","___plugins_formatters_TextCaseFormatterPlugin","Logger","___utils_Logger","RequiredValidator","validate","parsedValue","args","undefined","isValid","errorMessage","MaxLengthValidator","length","PipelineManager","formatters","parsers","validators","constructor","register","executeValidation","requestedValidators","argsMap","rule","validator","get","result","error","msg","message","warn","GlobalPipeline","__exports","__esModule"],"sources":["PipelineManager.ts"],"sourcesContent":["/**\n * @file PipelineManager.ts\n * @description Central manager for the data manipulation pipeline. \n * Orchestrates Formatting, Parsing, and Validating data using the generic Registry.\n */\n\nimport { Registry } from \"./Registry\";\nimport { IFormatter, IParser, IValidator, IValidationResult } from \"../interfaces/IPipeline\";\nimport { PatternValidatorPlugin } from \"../plugins/validators/PatternValidatorPlugin\";\nimport { MinLengthValidatorPlugin } from \"../plugins/validators/MinLengthValidatorPlugin\";\nimport { RangeValidatorPlugin } from \"../plugins/validators/RangeValidatorPlugin\";\nimport { UrlValidatorPlugin } from \"../plugins/validators/UrlValidatorPlugin\";\nimport { IbanValidatorPlugin } from \"../plugins/validators/IbanValidatorPlugin\";\nimport { EmailValidatorPlugin } from \"../plugins/validators/EmailValidatorPlugin\";\nimport { DateFormatterPlugin } from \"../plugins/formatters/DateFormatterPlugin\";\nimport { PhoneFormatterPlugin } from \"../plugins/formatters/PhoneFormatterPlugin\";\nimport { TextCaseFormatterPlugin } from \"../plugins/formatters/TextCaseFormatterPlugin\";\nimport { Logger } from \"../utils/Logger\";\n\n// --- Built-in Default Validators ---\n/** Internal rule for required fields. */\nclass RequiredValidator implements IValidator {\n /** Validates that the value is not null, undefined, or empty string. */\n validate(parsedValue: unknown, args?: unknown): IValidationResult {\n if (parsedValue === null || parsedValue === undefined || parsedValue === \"\") {\n return { isValid: false, errorMessage: \"This field is required.\" };\n }\n return { isValid: true };\n }\n}\n\n/** Internal rule for string maximum length. */\nclass MaxLengthValidator implements IValidator {\n /** Validates that a string does not exceed the provided argument length. */\n validate(parsedValue: unknown, args?: unknown): IValidationResult {\n if (typeof parsedValue === \"string\" && args && typeof args === \"number\") {\n if (parsedValue.length > args) {\n return { isValid: false, errorMessage: `Maximum length is ${args} characters.` };\n }\n }\n return { isValid: true };\n }\n}\n\n\n/**\n * The core engine responsible for marshalling data through the validation, formatting, and parsing phases.\n * Pluggable design allows new validators to be registered dynamically.\n * \n * @namespace nz.co.siliconst.ui5.metaui.core\n * @public\n */\nexport class PipelineManager {\n /** Registry of data formatters applied before pushing to the UI. */\n public readonly formatters: Registry<IFormatter> = new Registry<IFormatter>(\"Formatters\");\n /** Registry of data parsers applied when pulling data from the UI. */\n public readonly parsers: Registry<IParser> = new Registry<IParser>(\"Parsers\");\n /** Registry of business logic validators. */\n public readonly validators: Registry<IValidator> = new Registry<IValidator>(\"Validators\");\n\n /**\n * Bootstraps the PipelineManager with default validators (required, maxLength, email).\n */\n constructor() {\n // Register default validators\n this.validators.register(\"required\", new RequiredValidator());\n this.validators.register(\"maxLength\", new MaxLengthValidator());\n this.validators.register(\"pattern\", new PatternValidatorPlugin());\n this.validators.register(\"minLength\", new MinLengthValidatorPlugin());\n this.validators.register(\"range\", new RangeValidatorPlugin());\n this.validators.register(\"url\", new UrlValidatorPlugin());\n this.validators.register(\"iban\", new IbanValidatorPlugin());\n this.validators.register(\"email\", new EmailValidatorPlugin());\n\n // Register default formatters\n this.formatters.register(\"date\", new DateFormatterPlugin());\n this.formatters.register(\"phone\", new PhoneFormatterPlugin());\n this.formatters.register(\"textCase\", new TextCaseFormatterPlugin());\n }\n\n /**\n * Executes the validation pipeline sequentially. Fails fast on the first encountered error.\n * \n * @param parsedValue The raw extracted value from the UI control.\n * @param requestedValidators Array of validation rule keys (e.g. ['required', 'email']).\n * @param argsMap Optional map of parameters required by specific rules (e.g. { maxLength: 50 }).\n * @returns {IValidationResult} The final result state and any associated error message.\n */\n public executeValidation(parsedValue: unknown, requestedValidators: string[], argsMap?: Record<string, any>): IValidationResult {\n for (const rule of requestedValidators) {\n const validator = this.validators.get(rule);\n if (validator) {\n const args = argsMap ? argsMap[rule] : undefined;\n try {\n const result = validator.validate(parsedValue, args);\n if (!result.isValid) {\n return result; // Fast fail on first error\n }\n } catch (error) {\n const msg = (error as Error).message;\n Logger.error(`[MetaUI] PipelineManager: Validator '${rule}' crashed during execution.`, msg);\n return { isValid: false, errorMessage: `System validation error: ${msg}` };\n }\n } else {\n Logger.warn(`[MetaUI] PipelineManager: Requested validator '${rule}' not found in registry.`);\n }\n }\n return { isValid: true };\n }\n}\n\n/** \n * Singleton instance for global access to the active validation pipeline. \n * @public \n */\nexport const GlobalPipeline = new PipelineManager();\n"],"mappings":";;;EAAA;AACA;AACA;AACA;AACA;EAJA,MAMSA,QAAQ,GAAAC,WAAA;EAAA,MAERC,sBAAsB,GAAAC,4CAAA;EAAA,MACtBC,wBAAwB,GAAAC,8CAAA;EAAA,MACxBC,oBAAoB,GAAAC,0CAAA;EAAA,MACpBC,kBAAkB,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C;QAC3C,IAAIC,SAAS,EAAE;UACX,MAAMhB,IAAI,GAAGc,OAAO,GAAGA,OAAO,CAACC,IAAI,CAAC,GAAGd,SAAS;UAChD,IAAI;YACA,MAAMiB,MAAM,GAAGF,SAAS,CAAClB,QAAQ,CAACC,WAAW,EAAEC,IAAI,CAAC;YACpD,IAAI,CAACkB,MAAM,CAAChB,OAAO,EAAE;cACjB,OAAOgB,MAAM,CAAC,CAAC;YACnB;UACJ,CAAC,CAAC,OAAOC,KAAK,EAAE;YACZ,MAAMC,GAAG,GAAID,KAAK,CAAWE,OAAO;YACpC1B,MAAM,CAACwB,KAAK,CAAC,wCAAwCJ,IAAI,6BAA6B,EAAEK,GAAG,CAAC;YAC5F,OAAO;cAAElB,OAAO,EAAE,KAAK;cAAEC,YAAY,EAAE,4BAA4BiB,GAAG;YAAG,CAAC;UAC9E;QACJ,CAAC,MAAM;UACHzB,MAAM,CAAC2B,IAAI,CAAC,kDAAkDP,IAAI,0BAA0B,CAAC;QACjG;MACJ;MACA,OAAO;QAAEb,OAAO,EAAE;MAAK,CAAC;IAC5B;EACJ;;EAEA;AACA;AACA;AACA;EACO,MAAMqB,cAAc,GAAG,IAAIjB,eAAe,CAAC,CAAC;EAAC,IAAAkB,SAAA;IAAAC,UAAA;EAAA;EAAAD,SAAA,CAAAlB,eAAA,GAAAA,eAAA;EAAAkB,SAAA,CAAAD,cAAA,GAAAA,cAAA;EAAA,OAAAC,SAAA;AAAA","ignoreList":[]}
|
|
@@ -6,10 +6,14 @@ declare module "nz/co/siliconst/ui5/metaui/core/PipelineManager" {
|
|
|
6
6
|
*/
|
|
7
7
|
import { Registry } from "nz/co/siliconst/ui5/metaui/core/Registry";
|
|
8
8
|
import { IFormatter, IParser, IValidator, IValidationResult } from "nz/co/siliconst/ui5/metaui/interfaces/IPipeline";
|
|
9
|
+
/** Internal rule for required fields. */
|
|
9
10
|
class RequiredValidator implements IValidator {
|
|
11
|
+
/** Validates that the value is not null, undefined, or empty string. */
|
|
10
12
|
validate(parsedValue: unknown, args?: unknown): IValidationResult;
|
|
11
13
|
}
|
|
14
|
+
/** Internal rule for string maximum length. */
|
|
12
15
|
class MaxLengthValidator implements IValidator {
|
|
16
|
+
/** Validates that a string does not exceed the provided argument length. */
|
|
13
17
|
validate(parsedValue: unknown, args?: unknown): IValidationResult;
|
|
14
18
|
}
|
|
15
19
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PipelineManager.d.ts","sourceRoot":"../../../../../../../..","sources":["src/nz/co/siliconst/ui5/metaui/core/PipelineManager.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,iDAAiD,CAAC;IACjE;;;;OAIG;IAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;IACpE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,iDAAiD,CAAC;IAarH,MAAM,iBAAkB,YAAW,UAAU;QACzC,QAAQ,CAAC,WAAW,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,iBAAiB;KAMpE;IAED,MAAM,kBAAmB,YAAW,UAAU;QAC1C,QAAQ,CAAC,WAAW,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,iBAAiB;KAQpE;IAGD;;;;;;OAMG;IACH,MAAa,eAAe;QACxB,oEAAoE;QACpE,SAAgB,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC,CAA0C;QAC1F,sEAAsE;QACtE,SAAgB,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAoC;QAC9E,6CAA6C;QAC7C,SAAgB,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC,CAA0C;QAE1F;;WAEG;;QAkBH;;;;;;;WAOG;QACI,iBAAiB,CAAC,WAAW,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,iBAAiB;
|
|
1
|
+
{"version":3,"file":"PipelineManager.d.ts","sourceRoot":"../../../../../../../..","sources":["src/nz/co/siliconst/ui5/metaui/core/PipelineManager.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,iDAAiD,CAAC;IACjE;;;;OAIG;IAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;IACpE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,iDAAiD,CAAC;IAarH,yCAAyC;IACzC,MAAM,iBAAkB,YAAW,UAAU;QACzC,wEAAwE;QACxE,QAAQ,CAAC,WAAW,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,iBAAiB;KAMpE;IAED,+CAA+C;IAC/C,MAAM,kBAAmB,YAAW,UAAU;QAC1C,4EAA4E;QAC5E,QAAQ,CAAC,WAAW,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,iBAAiB;KAQpE;IAGD;;;;;;OAMG;IACH,MAAa,eAAe;QACxB,oEAAoE;QACpE,SAAgB,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC,CAA0C;QAC1F,sEAAsE;QACtE,SAAgB,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAoC;QAC9E,6CAA6C;QAC7C,SAAgB,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC,CAA0C;QAE1F;;WAEG;;QAkBH;;;;;;;WAOG;QACI,iBAAiB,CAAC,WAAW,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,iBAAiB;KAqBlI;IAED;;;OAGG;IACI,MAAM,cAAc,iBAAwB,CAAC;CAEnD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
sap.ui.define(["./Registry","../plugins/validators/PatternValidatorPlugin","../plugins/validators/MinLengthValidatorPlugin","../plugins/validators/RangeValidatorPlugin","../plugins/validators/UrlValidatorPlugin","../plugins/validators/IbanValidatorPlugin","../plugins/validators/EmailValidatorPlugin","../plugins/formatters/DateFormatterPlugin","../plugins/formatters/PhoneFormatterPlugin","../plugins/formatters/TextCaseFormatterPlugin","../utils/Logger"],function(t,
|
|
1
|
+
sap.ui.define(["./Registry","../plugins/validators/PatternValidatorPlugin","../plugins/validators/MinLengthValidatorPlugin","../plugins/validators/RangeValidatorPlugin","../plugins/validators/UrlValidatorPlugin","../plugins/validators/IbanValidatorPlugin","../plugins/validators/EmailValidatorPlugin","../plugins/formatters/DateFormatterPlugin","../plugins/formatters/PhoneFormatterPlugin","../plugins/formatters/TextCaseFormatterPlugin","../utils/Logger"],function(e,t,r,i,a,s,n,l,o,g,u){"use strict";const d=e["Registry"];const c=t["PatternValidatorPlugin"];const P=r["MinLengthValidatorPlugin"];const f=i["RangeValidatorPlugin"];const h=a["UrlValidatorPlugin"];const m=s["IbanValidatorPlugin"];const v=n["EmailValidatorPlugin"];const V=l["DateFormatterPlugin"];const p=o["PhoneFormatterPlugin"];const w=g["TextCaseFormatterPlugin"];const M=u["Logger"];class x{validate(e,t){if(e===null||e===undefined||e===""){return{isValid:false,errorMessage:"This field is required."}}return{isValid:true}}}class y{validate(e,t){if(typeof e==="string"&&t&&typeof t==="number"){if(e.length>t){return{isValid:false,errorMessage:`Maximum length is ${t} characters.`}}}return{isValid:true}}}class F{formatters=new d("Formatters");parsers=new d("Parsers");validators=new d("Validators");constructor(){this.validators.register("required",new x);this.validators.register("maxLength",new y);this.validators.register("pattern",new c);this.validators.register("minLength",new P);this.validators.register("range",new f);this.validators.register("url",new h);this.validators.register("iban",new m);this.validators.register("email",new v);this.formatters.register("date",new V);this.formatters.register("phone",new p);this.formatters.register("textCase",new w)}executeValidation(e,t,r){for(const i of t){const t=this.validators.get(i);if(t){const a=r?r[i]:undefined;try{const r=t.validate(e,a);if(!r.isValid){return r}}catch(e){const t=e.message;M.error(`[MetaUI] PipelineManager: Validator '${i}' crashed during execution.`,t);return{isValid:false,errorMessage:`System validation error: ${t}`}}}else{M.warn(`[MetaUI] PipelineManager: Requested validator '${i}' not found in registry.`)}}return{isValid:true}}}const L=new F;var b={__esModule:true};b.PipelineManager=F;b.GlobalPipeline=L;return b});
|
|
2
2
|
//# sourceMappingURL=PipelineManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PipelineManager.js","names":["Registry","___Registry","PatternValidatorPlugin","___plugins_validators_PatternValidatorPlugin","MinLengthValidatorPlugin","___plugins_validators_MinLengthValidatorPlugin","RangeValidatorPlugin","___plugins_validators_RangeValidatorPlugin","UrlValidatorPlugin","___plugins_validators_UrlValidatorPlugin","IbanValidatorPlugin","___plugins_validators_IbanValidatorPlugin","EmailValidatorPlugin","___plugins_validators_EmailValidatorPlugin","DateFormatterPlugin","___plugins_formatters_DateFormatterPlugin","PhoneFormatterPlugin","___plugins_formatters_PhoneFormatterPlugin","TextCaseFormatterPlugin","___plugins_formatters_TextCaseFormatterPlugin","Logger","___utils_Logger","RequiredValidator","validate","parsedValue","args","undefined","isValid","errorMessage","MaxLengthValidator","length","PipelineManager","formatters","parsers","validators","constructor","this","register","executeValidation","requestedValidators","argsMap","rule","validator","get","result","warn","GlobalPipeline","__exports","__esModule"],"sources":["PipelineManager.ts"],"sourcesContent":["/**\n * @file PipelineManager.ts\n * @description Central manager for the data manipulation pipeline. \n * Orchestrates Formatting, Parsing, and Validating data using the generic Registry.\n */\n\nimport { Registry } from \"./Registry\";\nimport { IFormatter, IParser, IValidator, IValidationResult } from \"../interfaces/IPipeline\";\nimport { PatternValidatorPlugin } from \"../plugins/validators/PatternValidatorPlugin\";\nimport { MinLengthValidatorPlugin } from \"../plugins/validators/MinLengthValidatorPlugin\";\nimport { RangeValidatorPlugin } from \"../plugins/validators/RangeValidatorPlugin\";\nimport { UrlValidatorPlugin } from \"../plugins/validators/UrlValidatorPlugin\";\nimport { IbanValidatorPlugin } from \"../plugins/validators/IbanValidatorPlugin\";\nimport { EmailValidatorPlugin } from \"../plugins/validators/EmailValidatorPlugin\";\nimport { DateFormatterPlugin } from \"../plugins/formatters/DateFormatterPlugin\";\nimport { PhoneFormatterPlugin } from \"../plugins/formatters/PhoneFormatterPlugin\";\nimport { TextCaseFormatterPlugin } from \"../plugins/formatters/TextCaseFormatterPlugin\";\nimport { Logger } from \"../utils/Logger\";\n\n// --- Built-in Default Validators ---\nclass RequiredValidator implements IValidator {\n validate(parsedValue: unknown, args?: unknown): IValidationResult {\n if (parsedValue === null || parsedValue === undefined || parsedValue === \"\") {\n return { isValid: false, errorMessage: \"This field is required.\" };\n }\n return { isValid: true };\n }\n}\n\nclass MaxLengthValidator implements IValidator {\n validate(parsedValue: unknown, args?: unknown): IValidationResult {\n if (typeof parsedValue === \"string\" && args && typeof args === \"number\") {\n if (parsedValue.length > args) {\n return { isValid: false, errorMessage: `Maximum length is ${args} characters.` };\n }\n }\n return { isValid: true };\n }\n}\n\n\n/**\n * The core engine responsible for marshalling data through the validation, formatting, and parsing phases.\n * Pluggable design allows new validators to be registered dynamically.\n * \n * @namespace nz.co.siliconst.ui5.metaui.core\n * @public\n */\nexport class PipelineManager {\n /** Registry of data formatters applied before pushing to the UI. */\n public readonly formatters: Registry<IFormatter> = new Registry<IFormatter>(\"Formatters\");\n /** Registry of data parsers applied when pulling data from the UI. */\n public readonly parsers: Registry<IParser> = new Registry<IParser>(\"Parsers\");\n /** Registry of business logic validators. */\n public readonly validators: Registry<IValidator> = new Registry<IValidator>(\"Validators\");\n\n /**\n * Bootstraps the PipelineManager with default validators (required, maxLength, email).\n */\n constructor() {\n // Register default validators\n this.validators.register(\"required\", new RequiredValidator());\n this.validators.register(\"maxLength\", new MaxLengthValidator());\n this.validators.register(\"pattern\", new PatternValidatorPlugin());\n this.validators.register(\"minLength\", new MinLengthValidatorPlugin());\n this.validators.register(\"range\", new RangeValidatorPlugin());\n this.validators.register(\"url\", new UrlValidatorPlugin());\n this.validators.register(\"iban\", new IbanValidatorPlugin());\n this.validators.register(\"email\", new EmailValidatorPlugin());\n\n // Register default formatters\n this.formatters.register(\"date\", new DateFormatterPlugin());\n this.formatters.register(\"phone\", new PhoneFormatterPlugin());\n this.formatters.register(\"textCase\", new TextCaseFormatterPlugin());\n }\n\n /**\n * Executes the validation pipeline sequentially. Fails fast on the first encountered error.\n * \n * @param parsedValue The raw extracted value from the UI control.\n * @param requestedValidators Array of validation rule keys (e.g. ['required', 'email']).\n * @param argsMap Optional map of parameters required by specific rules (e.g. { maxLength: 50 }).\n * @returns {IValidationResult} The final result state and any associated error message.\n */\n public executeValidation(parsedValue: unknown, requestedValidators: string[], argsMap?: Record<string, any>): IValidationResult {\n for (const rule of requestedValidators) {\n const validator = this.validators.get(rule);\n if (validator) {\n const args = argsMap ? argsMap[rule] : undefined;\n const result = validator.validate(parsedValue, args);\n
|
|
1
|
+
{"version":3,"file":"PipelineManager.js","names":["Registry","___Registry","PatternValidatorPlugin","___plugins_validators_PatternValidatorPlugin","MinLengthValidatorPlugin","___plugins_validators_MinLengthValidatorPlugin","RangeValidatorPlugin","___plugins_validators_RangeValidatorPlugin","UrlValidatorPlugin","___plugins_validators_UrlValidatorPlugin","IbanValidatorPlugin","___plugins_validators_IbanValidatorPlugin","EmailValidatorPlugin","___plugins_validators_EmailValidatorPlugin","DateFormatterPlugin","___plugins_formatters_DateFormatterPlugin","PhoneFormatterPlugin","___plugins_formatters_PhoneFormatterPlugin","TextCaseFormatterPlugin","___plugins_formatters_TextCaseFormatterPlugin","Logger","___utils_Logger","RequiredValidator","validate","parsedValue","args","undefined","isValid","errorMessage","MaxLengthValidator","length","PipelineManager","formatters","parsers","validators","constructor","this","register","executeValidation","requestedValidators","argsMap","rule","validator","get","result","error","msg","message","warn","GlobalPipeline","__exports","__esModule"],"sources":["PipelineManager.ts"],"sourcesContent":["/**\n * @file PipelineManager.ts\n * @description Central manager for the data manipulation pipeline. \n * Orchestrates Formatting, Parsing, and Validating data using the generic Registry.\n */\n\nimport { Registry } from \"./Registry\";\nimport { IFormatter, IParser, IValidator, IValidationResult } from \"../interfaces/IPipeline\";\nimport { PatternValidatorPlugin } from \"../plugins/validators/PatternValidatorPlugin\";\nimport { MinLengthValidatorPlugin } from \"../plugins/validators/MinLengthValidatorPlugin\";\nimport { RangeValidatorPlugin } from \"../plugins/validators/RangeValidatorPlugin\";\nimport { UrlValidatorPlugin } from \"../plugins/validators/UrlValidatorPlugin\";\nimport { IbanValidatorPlugin } from \"../plugins/validators/IbanValidatorPlugin\";\nimport { EmailValidatorPlugin } from \"../plugins/validators/EmailValidatorPlugin\";\nimport { DateFormatterPlugin } from \"../plugins/formatters/DateFormatterPlugin\";\nimport { PhoneFormatterPlugin } from \"../plugins/formatters/PhoneFormatterPlugin\";\nimport { TextCaseFormatterPlugin } from \"../plugins/formatters/TextCaseFormatterPlugin\";\nimport { Logger } from \"../utils/Logger\";\n\n// --- Built-in Default Validators ---\n/** Internal rule for required fields. */\nclass RequiredValidator implements IValidator {\n /** Validates that the value is not null, undefined, or empty string. */\n validate(parsedValue: unknown, args?: unknown): IValidationResult {\n if (parsedValue === null || parsedValue === undefined || parsedValue === \"\") {\n return { isValid: false, errorMessage: \"This field is required.\" };\n }\n return { isValid: true };\n }\n}\n\n/** Internal rule for string maximum length. */\nclass MaxLengthValidator implements IValidator {\n /** Validates that a string does not exceed the provided argument length. */\n validate(parsedValue: unknown, args?: unknown): IValidationResult {\n if (typeof parsedValue === \"string\" && args && typeof args === \"number\") {\n if (parsedValue.length > args) {\n return { isValid: false, errorMessage: `Maximum length is ${args} characters.` };\n }\n }\n return { isValid: true };\n }\n}\n\n\n/**\n * The core engine responsible for marshalling data through the validation, formatting, and parsing phases.\n * Pluggable design allows new validators to be registered dynamically.\n * \n * @namespace nz.co.siliconst.ui5.metaui.core\n * @public\n */\nexport class PipelineManager {\n /** Registry of data formatters applied before pushing to the UI. */\n public readonly formatters: Registry<IFormatter> = new Registry<IFormatter>(\"Formatters\");\n /** Registry of data parsers applied when pulling data from the UI. */\n public readonly parsers: Registry<IParser> = new Registry<IParser>(\"Parsers\");\n /** Registry of business logic validators. */\n public readonly validators: Registry<IValidator> = new Registry<IValidator>(\"Validators\");\n\n /**\n * Bootstraps the PipelineManager with default validators (required, maxLength, email).\n */\n constructor() {\n // Register default validators\n this.validators.register(\"required\", new RequiredValidator());\n this.validators.register(\"maxLength\", new MaxLengthValidator());\n this.validators.register(\"pattern\", new PatternValidatorPlugin());\n this.validators.register(\"minLength\", new MinLengthValidatorPlugin());\n this.validators.register(\"range\", new RangeValidatorPlugin());\n this.validators.register(\"url\", new UrlValidatorPlugin());\n this.validators.register(\"iban\", new IbanValidatorPlugin());\n this.validators.register(\"email\", new EmailValidatorPlugin());\n\n // Register default formatters\n this.formatters.register(\"date\", new DateFormatterPlugin());\n this.formatters.register(\"phone\", new PhoneFormatterPlugin());\n this.formatters.register(\"textCase\", new TextCaseFormatterPlugin());\n }\n\n /**\n * Executes the validation pipeline sequentially. Fails fast on the first encountered error.\n * \n * @param parsedValue The raw extracted value from the UI control.\n * @param requestedValidators Array of validation rule keys (e.g. ['required', 'email']).\n * @param argsMap Optional map of parameters required by specific rules (e.g. { maxLength: 50 }).\n * @returns {IValidationResult} The final result state and any associated error message.\n */\n public executeValidation(parsedValue: unknown, requestedValidators: string[], argsMap?: Record<string, any>): IValidationResult {\n for (const rule of requestedValidators) {\n const validator = this.validators.get(rule);\n if (validator) {\n const args = argsMap ? argsMap[rule] : undefined;\n try {\n const result = validator.validate(parsedValue, args);\n if (!result.isValid) {\n return result; // Fast fail on first error\n }\n } catch (error) {\n const msg = (error as Error).message;\n Logger.error(`[MetaUI] PipelineManager: Validator '${rule}' crashed during execution.`, msg);\n return { isValid: false, errorMessage: `System validation error: ${msg}` };\n }\n } else {\n Logger.warn(`[MetaUI] PipelineManager: Requested validator '${rule}' not found in registry.`);\n }\n }\n return { isValid: true };\n }\n}\n\n/** \n * Singleton instance for global access to the active validation pipeline. \n * @public \n */\nexport const GlobalP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