@siliconst/metaui 1.4.21 → 1.4.34
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/constants/MetaUIConstants-dbg.js +51 -0
- package/src/nz/co/siliconst/ui5/metaui/constants/MetaUIConstants-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/constants/MetaUIConstants.d.ts +41 -0
- package/src/nz/co/siliconst/ui5/metaui/constants/MetaUIConstants.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/constants/MetaUIConstants.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/constants/MetaUIConstants.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/constants/MetaUIConstants.ts +44 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/BaseHardwareControl-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/BaseHardwareControl.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/BaseHardwareControl.ts +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/BaseHardwareControlRenderer-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/BaseHardwareControlRenderer.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/BaseHardwareControlRenderer.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/BaseHardwareControlRenderer.ts +2 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/CameraControl-dbg.js +2 -2
- package/src/nz/co/siliconst/ui5/metaui/controls/CameraControl-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/CameraControl.js +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 +3 -3
- package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost-dbg.js +5 -1
- 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 +6 -2
- 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 +10 -9
- package/src/nz/co/siliconst/ui5/metaui/controls/GeolocationControl-dbg.js +0 -9
- 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 +0 -9
- 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 +3 -9
- package/src/nz/co/siliconst/ui5/metaui/controls/RichTextControl-dbg.js +0 -11
- 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 +0 -11
- 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 +2 -9
- package/src/nz/co/siliconst/ui5/metaui/controls/SignatureControl-dbg.js +2 -7
- 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 +0 -5
- package/src/nz/co/siliconst/ui5/metaui/controls/SignatureControl.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/SignatureControl.js +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 +3 -7
- package/src/nz/co/siliconst/ui5/metaui/controls/VoiceInputControl-dbg.js +1 -6
- 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 +0 -5
- package/src/nz/co/siliconst/ui5/metaui/controls/VoiceInputControl.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/VoiceInputControl.js +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 +9 -12
- package/src/nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost-dbg.js +51 -12
- 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 +13 -0
- 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 +53 -14
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/DataSyncDelegate-dbg.js +2 -2
- 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 +1 -1
- 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 +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 +3 -3
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ODataDelegate-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ODataDelegate.d.ts +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ODataDelegate.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ODataDelegate.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ODataDelegate.ts +8 -7
- 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 +1 -1
- 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 +3 -3
- package/src/nz/co/siliconst/ui5/metaui/core/ConditionEngine-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/ConditionEngine.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/ConditionEngine.ts +4 -4
- package/src/nz/co/siliconst/ui5/metaui/core/Engine-dbg.js +3 -4
- 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 +1 -1
- 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 +6 -7
- package/src/nz/co/siliconst/ui5/metaui/core/LayoutMutator-dbg.js +84 -0
- package/src/nz/co/siliconst/ui5/metaui/core/LayoutMutator-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/LayoutMutator.d.ts +16 -0
- package/src/nz/co/siliconst/ui5/metaui/core/LayoutMutator.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/LayoutMutator.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/core/LayoutMutator.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/LayoutMutator.ts +80 -0
- package/src/nz/co/siliconst/ui5/metaui/core/LayoutScorer-dbg.js +137 -0
- package/src/nz/co/siliconst/ui5/metaui/core/LayoutScorer-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/LayoutScorer.d.ts +24 -0
- package/src/nz/co/siliconst/ui5/metaui/core/LayoutScorer.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/LayoutScorer.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/core/LayoutScorer.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/LayoutScorer.ts +141 -0
- package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry-dbg.js +26 -0
- 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 +2 -0
- 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 +29 -1
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer-dbg.js +1 -1
- 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 +4 -4
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer.ts +11 -11
- package/src/nz/co/siliconst/ui5/metaui/core/StateManager-dbg.js.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 +1 -1
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchema-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchema.d.ts +4 -1
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchema.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchema.ts +5 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout-dbg.js +5 -5
- 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.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout.ts +4 -4
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout-dbg.js +7 -5
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout.d.ts.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 +11 -7
- package/src/nz/co/siliconst/ui5/metaui/library-preload.js +40 -37
- package/src/nz/co/siliconst/ui5/metaui/library-preload.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/OpenApiParserFactory-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/OpenApiParserFactory.d.ts +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/OpenApiParserFactory.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/OpenApiParserFactory.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/OpenApiParserFactory.ts +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/OpenApiRefResolver-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/OpenApiRefResolver.d.ts +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/OpenApiRefResolver.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/OpenApiRefResolver.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/OpenApiRefResolver.ts +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/OpenApiUIMapper-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/OpenApiUIMapper.d.ts +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/OpenApiUIMapper.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/OpenApiUIMapper.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/OpenApiUIMapper.ts +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/heuristics/OpenApiHeuristicEngine-dbg.js +2 -2
- package/src/nz/co/siliconst/ui5/metaui/openapi/heuristics/OpenApiHeuristicEngine-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/heuristics/OpenApiHeuristicEngine.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/heuristics/OpenApiHeuristicEngine.ts +2 -2
- package/src/nz/co/siliconst/ui5/metaui/openapi/heuristics/plugins/ProtobufVariantHeuristic-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/heuristics/plugins/ProtobufVariantHeuristic.d.ts +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/heuristics/plugins/ProtobufVariantHeuristic.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/heuristics/plugins/ProtobufVariantHeuristic.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/heuristics/plugins/ProtobufVariantHeuristic.ts +3 -3
- package/src/nz/co/siliconst/ui5/metaui/openapi/parsers/OpenApi2Parser-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/parsers/OpenApi2Parser.d.ts +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/parsers/OpenApi2Parser.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/parsers/OpenApi2Parser.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/parsers/OpenApi2Parser.ts +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/parsers/OpenApi3Parser-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/parsers/OpenApi3Parser.d.ts +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/parsers/OpenApi3Parser.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/parsers/OpenApi3Parser.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/parsers/OpenApi3Parser.ts +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/parsers/OpenApiPropertyMapper-dbg.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/parsers/OpenApiPropertyMapper-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/parsers/OpenApiPropertyMapper.d.ts +4 -4
- package/src/nz/co/siliconst/ui5/metaui/openapi/parsers/OpenApiPropertyMapper.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/parsers/OpenApiPropertyMapper.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/parsers/OpenApiPropertyMapper.ts +19 -19
- 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.d.ts.map +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 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/ArrayPlugin-dbg.js +18 -15
- 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.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 +18 -18
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BarcodeScannerPlugin-dbg.js +1 -1
- 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.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 +2 -2
- 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 +1 -6
- 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.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BasePlugin.ts +2 -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.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BooleanPlugin.ts +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/CameraPlugin-dbg.js +2 -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.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 +2 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/CodeEditorPlugin-dbg.js +4 -4
- 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.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 +4 -4
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DatePlugin-dbg.js +1 -1
- 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.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 +2 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DateTimePlugin-dbg.js +1 -1
- 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.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 +2 -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.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DropdownPlugin.ts +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/EmailPlugin-dbg.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/EmailPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/EmailPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/EmailPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/EmailPlugin.ts +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/FileUploaderPlugin-dbg.js +1 -1
- 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.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 +2 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/GeolocationPlugin-dbg.js +2 -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.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 +2 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/LinkPlugin-dbg.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/LinkPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/LinkPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/LinkPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/LinkPlugin.ts +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MultiInputPlugin-dbg.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MultiInputPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MultiInputPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MultiInputPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MultiInputPlugin.ts +3 -3
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/NumberPlugin-dbg.js +3 -3
- 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.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 +4 -4
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/ObjectPlugin-dbg.js +5 -4
- 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.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 +7 -6
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/PasswordPlugin-dbg.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/PasswordPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/PasswordPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/PasswordPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/PasswordPlugin.ts +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/RatingIndicatorPlugin-dbg.js +1 -1
- 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.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 +2 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/ReferencePlugin-dbg.js +3 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/ReferencePlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/ReferencePlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/ReferencePlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/ReferencePlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/ReferencePlugin.ts +3 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/RichTextPlugin-dbg.js +2 -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.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 +2 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SignaturePlugin-dbg.js +2 -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.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 +2 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SliderPlugin-dbg.js +1 -1
- 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.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 +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/StepInputPlugin-dbg.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/StepInputPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/StepInputPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/StepInputPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/StepInputPlugin.ts +2 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/StringPlugin-dbg.js +1 -1
- 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.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 +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/TextAreaPlugin-dbg.js +2 -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.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 +2 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/TimePlugin-dbg.js +1 -1
- 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.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 +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/VoiceInputPlugin-dbg.js +2 -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.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 +2 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/datasources/LiveSearchPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/datasources/LiveSearchPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/datasources/LiveSearchPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/datasources/LiveSearchPlugin.ts +109 -108
- package/src/nz/co/siliconst/ui5/metaui/plugins/datasources/ODataListBindingPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/datasources/ODataListBindingPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/datasources/ODataListBindingPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/datasources/ODataListBindingPlugin.ts +64 -63
- package/src/nz/co/siliconst/ui5/metaui/plugins/datasources/RemoteDropdownPlugin-dbg.js +1 -1
- 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.d.ts +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/datasources/RemoteDropdownPlugin.d.ts.map +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 +118 -117
- package/src/nz/co/siliconst/ui5/metaui/plugins/datasources/RemoteValueHelpPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/datasources/RemoteValueHelpPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/datasources/RemoteValueHelpPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/datasources/RemoteValueHelpPlugin.ts +105 -104
- package/src/nz/co/siliconst/ui5/metaui/utils/Logger-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/utils/Logger.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/utils/Logger.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/utils/Logger.ts +1 -1
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
* with a proprietary 'ui' directive block for Fiori visual orchestration.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
import { RenderModeType, SchemaTypeType } from "../constants/MetaUIConstants";
|
|
9
|
+
|
|
10
|
+
export type FieldType = SchemaTypeType | "date";
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
* Value help structure mapping SAP Key/Text pairs.
|
|
@@ -48,6 +50,8 @@ export interface IUIDirective {
|
|
|
48
50
|
formatter?: string;
|
|
49
51
|
args?: unknown;
|
|
50
52
|
dialogButtonText?: string;
|
|
53
|
+
layoutBudget?: number;
|
|
54
|
+
renderMode?: RenderModeType;
|
|
51
55
|
}
|
|
52
56
|
|
|
53
57
|
export interface IRemoteValueHelpConfig {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
sap.ui.define(["sap/ui/layout/form/SimpleForm", "sap/m/Label", "sap/ui/core/Title", "sap/m/VBox", "../core/SchemaNormalizer", "../utils/Logger"], function (SimpleForm, Label, Title, VBox, ___core_SchemaNormalizer, ___utils_Logger) {
|
|
1
|
+
sap.ui.define(["sap/ui/layout/form/SimpleForm", "sap/m/Label", "sap/ui/core/Title", "sap/m/VBox", "../core/SchemaNormalizer", "../utils/Logger", "../core/PluginRegistry"], function (SimpleForm, Label, Title, VBox, ___core_SchemaNormalizer, ___utils_Logger, ___core_PluginRegistry) {
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
4
|
const SchemaNormalizer = ___core_SchemaNormalizer["SchemaNormalizer"];
|
|
5
5
|
const Logger = ___utils_Logger["Logger"];
|
|
6
|
+
const PluginRegistry = ___core_PluginRegistry["PluginRegistry"];
|
|
6
7
|
/**
|
|
7
8
|
* Layout Manager responsible for generating a fully responsive SAP Fiori SimpleForm.
|
|
8
9
|
* It traverses the `uiLayout` tree defined in the schema to build the form groups and fields,
|
|
@@ -81,8 +82,8 @@ sap.ui.define(["sap/ui/layout/form/SimpleForm", "sap/m/Label", "sap/ui/core/Titl
|
|
|
81
82
|
// Collections of primitives, or explicitly assigned widgets (like multiSelect), remain in the Form as Field Plugins.
|
|
82
83
|
const isCollectionOfRecords = meta.items?.type === "object" || meta.items?.properties;
|
|
83
84
|
const hasExplicitWidget = !!meta.ui?.widget;
|
|
84
|
-
const
|
|
85
|
-
if (
|
|
85
|
+
const isTableSubLayout = meta.type === "array" && isCollectionOfRecords && !hasExplicitWidget;
|
|
86
|
+
if (isTableSubLayout) {
|
|
86
87
|
Logger.debug("[MetaUI FormLayout]", `Routing property '${propKey}' to Table Sub-Layout.`, "FormLayout");
|
|
87
88
|
tableElements.push({
|
|
88
89
|
scope: bindingPath,
|
|
@@ -161,8 +162,7 @@ sap.ui.define(["sap/ui/layout/form/SimpleForm", "sap/m/Label", "sap/ui/core/Titl
|
|
|
161
162
|
const control = engine.generateField(effectiveMeta, `/${propKey}`, modelName);
|
|
162
163
|
|
|
163
164
|
// Automatically apply fullWidth layout data if natively wide or explicitly requested
|
|
164
|
-
const
|
|
165
|
-
const isNativelyWide = widget === "codeEditor" || widget === "textArea" || widget === "richText";
|
|
165
|
+
const isNativelyWide = PluginRegistry.getInstance().isPluginNativelyWide(effectiveMeta.type || "string", effectiveMeta.ui?.widget);
|
|
166
166
|
const isFullWidth = effectiveMeta.ui?.fullWidth !== undefined ? effectiveMeta.ui?.fullWidth : isNativelyWide;
|
|
167
167
|
if (isFullWidth) {
|
|
168
168
|
sap.ui.require(["sap/ui/layout/GridData"], GridData => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormLayout-dbg.js","names":["SchemaNormalizer","___core_SchemaNormalizer","Logger","___utils_Logger","FormLayout","render","schema","modelName","engine","onSubmit","container","VBox","renderType","form","SimpleForm","editable","title","layout","labelSpanXL","labelSpanL","labelSpanM","labelSpanS","adjustLabelSpan","emptySpanXL","emptySpanL","emptySpanM","emptySpanS","columnsXL","columnsL","columnsM","singleContainerFullSize","uiLayout","Array","isArray","warn","addItem","tableElements","hasFormFields","renderElement","element","type","label","addContent","Title","text","elements","forEach","scope","startsWith","error","meta","bindingPath","propKey","resolveScope","isCollectionOfRecords","items","properties","hasExplicitWidget","ui","widget","isSubLayout","debug","push","_renderScalarField","field","subSchema","control","generateLayout","addStyleClass","msg","message","showErrorPopup","labelText","Label","required","effectiveMeta","generateField","isNativelyWide","isFullWidth","fullWidth","undefined","sap","require","GridData","setLayoutData","span","__exports","__esModule"],"sources":["FormLayout.ts"],"sourcesContent":["/**\n * @file FormLayout.ts\n * @description Generates a fully responsive SAP Fiori Form layout (SimpleForm).\n */\n\nimport SimpleForm from \"sap/ui/layout/form/SimpleForm\";\nimport Label from \"sap/m/Label\";\nimport Title from \"sap/ui/core/Title\";\nimport VBox from \"sap/m/VBox\";\nimport { IPropertyMetadata, ISchema, ILayoutElement } from \"../interfaces/ISchema\";\nimport { ILayoutManager } from \"../interfaces/ILayoutManager\";\nimport { Engine } from \"../core/Engine\";\nimport { SchemaNormalizer } from \"../core/SchemaNormalizer\";\nimport { Logger } from \"../utils/Logger\";\nimport Control from \"sap/ui/core/Control\";\n\n/**\n * Layout Manager responsible for generating a fully responsive SAP Fiori SimpleForm.\n * It traverses the `uiLayout` tree defined in the schema to build the form groups and fields,\n * completely separating visual orchestration from data modeling.\n * @namespace nz.co.siliconst.ui5.metaui.layouts\n * @public\n */\nexport class FormLayout implements ILayoutManager {\n /**\n * Renders the JSON Schema properties into a UI5 SimpleForm using the uiLayout definitions.\n * \n * @param schema The active JSON schema subset.\n * @param modelName The bound UI5 model name.\n * @param engine The central orchestrator for delegating plugin generation.\n * @param onSubmit Optional submit hook.\n * @returns {Control} The VBox wrapper containing the generated form.\n */\n public render(schema: ISchema, modelName: string, engine: Engine, onSubmit?: () => void): Control {\n const container = new VBox({ renderType: \"Bare\" });\n const form = new SimpleForm({\n editable: true,\n title: schema.title,\n layout: \"ResponsiveGridLayout\",\n labelSpanXL: 4, labelSpanL: 4, labelSpanM: 4, labelSpanS: 12,\n adjustLabelSpan: false,\n emptySpanXL: 0, emptySpanL: 0, emptySpanM: 0, emptySpanS: 0,\n columnsXL: 1, columnsL: 1, columnsM: 1,\n singleContainerFullSize: false\n });\n\n if (!schema.uiLayout || !Array.isArray(schema.uiLayout)) {\n Logger.warn(\"[MetaUI] Missing 'uiLayout' array in schema. Form will not render any fields.\");\n container.addItem(form);\n return container;\n }\n\n const tableElements: { scope: string, meta: IPropertyMetadata, label?: string }[] = [];\n let hasFormFields = false;\n\n // Recursively render layout elements\n const renderElement = (element: ILayoutElement) => {\n if (element.type === \"Group\") {\n if (element.label) {\n form.addContent(new Title({ text: element.label }));\n }\n \n if (element.elements && Array.isArray(element.elements)) {\n element.elements.forEach(renderElement);\n }\n } else if (element.type === \"Control\") {\n if (!element.scope || !element.scope.startsWith(\"#/properties/\")) {\n Logger.error(`[MetaUI] Invalid scope '${element.scope}' in uiLayout Control.`, \"\", \"FormLayout\");\n return;\n }\n \n const { meta, bindingPath, propKey } = SchemaNormalizer.resolveScope(schema, element.scope);\n \n if (!meta) {\n Logger.error(`[MetaUI] Property '${propKey}' not found in schema definitions.`, \"\", \"FormLayout\");\n return;\n }\n\n // Architectural Boundary: Separate Field Controls (Plugins) from Sub-Layouts (LayoutManagers)\n // A property is delegated to a Sub-Layout Manager (Table) ONLY if it represents a collection of complex objects.\n // Collections of primitives, or explicitly assigned widgets (like multiSelect), remain in the Form as Field Plugins.\n const isCollectionOfRecords = meta.items?.type === \"object\" || meta.items?.properties;\n const hasExplicitWidget = !!meta.ui?.widget;\n const isSubLayout = meta.type === \"array\" && isCollectionOfRecords && !hasExplicitWidget;\n\n if (isSubLayout) {\n Logger.debug(\"[MetaUI FormLayout]\", `Routing property '${propKey}' to Table Sub-Layout.`, \"FormLayout\");\n tableElements.push({ scope: bindingPath, meta, label: element.label });\n } else {\n hasFormFields = true;\n Logger.debug(\"[MetaUI FormLayout]\", `Rendering scalar field '${bindingPath}'.`, \"FormLayout\");\n this._renderScalarField(form, element, bindingPath, meta, modelName, engine);\n }\n } else {\n Logger.warn(`[MetaUI] Unsupported layout element type '${element.type}'.`, \"\", \"FormLayout\");\n }\n };\n\n // Render everything defined in the layout\n schema.uiLayout.forEach(renderElement);\n\n if (hasFormFields) {\n container.addItem(form);\n }\n\n // Render array/table sub-layouts full width below the form\n tableElements.forEach(field => {\n try {\n const subSchema = {\n type: \"array\",\n title: field.label || field.meta.ui?.label || field.scope,\n items: field.meta.items || { type: \"object\", properties: {} },\n uiLayout: field.meta.items?.uiLayout // Pass down sub-layout if available\n };\n \n const control = engine.generateLayout(subSchema as ISchema, modelName, `/${field.scope}`);\n if (control) {\n control.addStyleClass(\"sapUiSmallMarginTop\");\n container.addItem(control);\n }\n } catch (error) {\n const msg = (error as Error).message;\n Logger.error(`[MetaUI] Failed to render array field ${field.scope}`, msg, \"FormLayout\");\n Logger.showErrorPopup(`Failed to render array field '${field.scope}'.\\n\\nDetails: ${msg}`);\n }\n });\n\n return container;\n }\n\n /**\n * Synthesizes a primitive field into the Form.\n * @param form The SimpleForm instance.\n * @param element The layout element definition.\n * @param propKey The bound property key.\n * @param meta The inferred metadata schema.\n * @param modelName The UI5 data model name.\n * @param engine The core Engine instance.\n */\n private _renderScalarField(form: SimpleForm, element: ILayoutElement, propKey: string, meta: IPropertyMetadata, modelName: string, engine: Engine): void {\n try {\n const labelText = element.label || meta.ui?.label || propKey;\n const label = new Label({\n text: labelText,\n required: meta.required\n });\n\n // Override widget if specified in the layout element\n const effectiveMeta = { ...meta };\n if (element.widget) {\n effectiveMeta.ui = { ...meta.ui, widget: element.widget };\n }\n\n const control = engine.generateField(effectiveMeta, `/${propKey}`, modelName);\n\n // Automatically apply fullWidth layout data if natively wide or explicitly requested\n const widget = effectiveMeta.ui?.widget;\n const isNativelyWide = widget === \"codeEditor\" || widget === \"textArea\" || widget === \"richText\";\n const isFullWidth = effectiveMeta.ui?.fullWidth !== undefined ? effectiveMeta.ui?.fullWidth : isNativelyWide;\n\n if (isFullWidth) {\n sap.ui.require([\"sap/ui/layout/GridData\"], (GridData: typeof import(\"sap/ui/layout/GridData\").default) => {\n control.setLayoutData(new GridData({ span: \"XL12 L12 M12 S12\" }));\n });\n }\n\n form.addContent(label);\n form.addContent(control);\n } catch (error) {\n const msg = (error as Error).message;\n Logger.error(`[MetaUI] Failed to render field ${propKey}`, msg, \"FormLayout\");\n Logger.showErrorPopup(`Failed to render field '${prop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AE7E;QACA,MAAMoD,MAAM,GAAGgB,aAAa,CAACjB,EAAE,EAAEC,MAAM;QACvC,MAAMkB,cAAc,GAAGlB,MAAM,KAAK,YAAY,IAAIA,MAAM,KAAK,UAAU,IAAIA,MAAM,KAAK,UAAU;QAChG,MAAMmB,WAAW,GAAGH,aAAa,CAACjB,EAAE,EAAEqB,SAAS,KAAKC,SAAS,GAAGL,aAAa,CAACjB,EAAE,EAAEqB,SAAS,GAAGF,cAAc;QAE5G,IAAIC,WAAW,EAAE;UACbG,GAAG,CAACvB,EAAE,CAACwB,OAAO,CAAC,CAAC,wBAAwB,CAAC,EAAGC,QAAyD,IAAK;YACtGjB,OAAO,CAACkB,aAAa,CAAC,IAAID,QAAQ,CAAC;cAAEE,IAAI,EAAE;YAAmB,CAAC,CAAC,CAAC;UACrE,CAAC,CAAC;QACN;QAEAxE,IAAI,CAAC6B,UAAU,CAACD,KAAK,CAAC;QACtB5B,IAAI,CAAC6B,UAAU,CAACwB,OAAO,CAAC;MAC5B,CAAC,CAAC,OAAOjB,KAAK,EAAE;QACZ,MAAMoB,GAAG,GAAIpB,KAAK,CAAWqB,OAAO;QACpCpE,MAAM,CAAC+C,KAAK,CAAC,mCAAmCG,OAAO,EAAE,EAAEiB,GAAG,EAAE,YAAY,CAAC;QAC7EnE,MAAM,CAACqE,cAAc,CAAC,2BAA2BnB,OAAO,kBAAkBiB,GAAG,EAAE,CAAC;MACpF;IACJ;EACJ;EAAC,IAAAiB,SAAA;IAAAC,UAAA;EAAA;EAAAD,SAAA,CAAAlF,UAAA,GAAAA,UAAA;EAAA,OAAAkF,SAAA;AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"FormLayout-dbg.js","names":["SchemaNormalizer","___core_SchemaNormalizer","Logger","___utils_Logger","PluginRegistry","___core_PluginRegistry","FormLayout","render","schema","modelName","engine","onSubmit","container","VBox","renderType","form","SimpleForm","editable","title","layout","labelSpanXL","labelSpanL","labelSpanM","labelSpanS","adjustLabelSpan","emptySpanXL","emptySpanL","emptySpanM","emptySpanS","columnsXL","columnsL","columnsM","singleContainerFullSize","uiLayout","Array","isArray","warn","addItem","tableElements","hasFormFields","renderElement","element","type","label","addContent","Title","text","elements","forEach","scope","startsWith","error","meta","bindingPath","propKey","resolveScope","isCollectionOfRecords","items","properties","hasExplicitWidget","ui","widget","isTableSubLayout","debug","push","_renderScalarField","field","subSchema","control","generateLayout","addStyleClass","msg","message","showErrorPopup","labelText","Label","required","effectiveMeta","generateField","isNativelyWide","getInstance","isPluginNativelyWide","isFullWidth","fullWidth","undefined","sap","require","GridData","setLayoutData","span","__exports","__esModule"],"sources":["FormLayout.ts"],"sourcesContent":["/**\n * @file FormLayout.ts\n * @description Generates a fully responsive SAP Fiori Form layout (SimpleForm).\n */\n\nimport SimpleForm from \"sap/ui/layout/form/SimpleForm\";\nimport Label from \"sap/m/Label\";\nimport Title from \"sap/ui/core/Title\";\nimport VBox from \"sap/m/VBox\";\nimport { IPropertyMetadata, ISchema, ILayoutElement } from \"../interfaces/ISchema\";\nimport { ILayoutManager } from \"../interfaces/ILayoutManager\";\nimport { Engine } from \"../core/Engine\";\nimport { SchemaNormalizer } from \"../core/SchemaNormalizer\";\nimport { Logger } from \"../utils/Logger\";\nimport Control from \"sap/ui/core/Control\";\nimport { PluginRegistry } from \"../core/PluginRegistry\";\n\n/**\n * Layout Manager responsible for generating a fully responsive SAP Fiori SimpleForm.\n * It traverses the `uiLayout` tree defined in the schema to build the form groups and fields,\n * completely separating visual orchestration from data modeling.\n * @namespace nz.co.siliconst.ui5.metaui.layouts\n * @public\n */\nexport class FormLayout implements ILayoutManager {\n /**\n * Renders the JSON Schema properties into a UI5 SimpleForm using the uiLayout definitions.\n * \n * @param schema The active JSON schema subset.\n * @param modelName The bound UI5 model name.\n * @param engine The central orchestrator for delegating plugin generation.\n * @param onSubmit Optional submit hook.\n * @returns {Control} The VBox wrapper containing the generated form.\n */\n public render(schema: ISchema, modelName: string, engine: Engine, onSubmit?: () => void): Control {\n const container = new VBox({ renderType: \"Bare\" });\n const form = new SimpleForm({\n editable: true,\n title: schema.title,\n layout: \"ResponsiveGridLayout\",\n labelSpanXL: 4, labelSpanL: 4, labelSpanM: 4, labelSpanS: 12,\n adjustLabelSpan: false,\n emptySpanXL: 0, emptySpanL: 0, emptySpanM: 0, emptySpanS: 0,\n columnsXL: 1, columnsL: 1, columnsM: 1,\n singleContainerFullSize: false\n });\n\n if (!schema.uiLayout || !Array.isArray(schema.uiLayout)) {\n Logger.warn(\"[MetaUI] Missing 'uiLayout' array in schema. Form will not render any fields.\");\n container.addItem(form);\n return container;\n }\n\n const tableElements: { scope: string, meta: IPropertyMetadata, label?: string }[] = [];\n let hasFormFields = false;\n\n // Recursively render layout elements\n const renderElement = (element: ILayoutElement) => {\n if (element.type === \"Group\") {\n if (element.label) {\n form.addContent(new Title({ text: element.label }));\n }\n \n if (element.elements && Array.isArray(element.elements)) {\n element.elements.forEach(renderElement);\n }\n } else if (element.type === \"Control\") {\n if (!element.scope || !element.scope.startsWith(\"#/properties/\")) {\n Logger.error(`[MetaUI] Invalid scope '${element.scope}' in uiLayout Control.`, \"\", \"FormLayout\");\n return;\n }\n \n const { meta, bindingPath, propKey } = SchemaNormalizer.resolveScope(schema, element.scope);\n \n if (!meta) {\n Logger.error(`[MetaUI] Property '${propKey}' not found in schema definitions.`, \"\", \"FormLayout\");\n return;\n }\n\n // Architectural Boundary: Separate Field Controls (Plugins) from Sub-Layouts (LayoutManagers)\n // A property is delegated to a Sub-Layout Manager (Table) ONLY if it represents a collection of complex objects.\n // Collections of primitives, or explicitly assigned widgets (like multiSelect), remain in the Form as Field Plugins.\n const isCollectionOfRecords = meta.items?.type === \"object\" || meta.items?.properties;\n const hasExplicitWidget = !!meta.ui?.widget;\n const isTableSubLayout = meta.type === \"array\" && isCollectionOfRecords && !hasExplicitWidget;\n\n if (isTableSubLayout) {\n Logger.debug(\"[MetaUI FormLayout]\", `Routing property '${propKey}' to Table Sub-Layout.`, \"FormLayout\");\n tableElements.push({ scope: bindingPath, meta, label: element.label });\n } else {\n hasFormFields = true;\n Logger.debug(\"[MetaUI FormLayout]\", `Rendering scalar field '${bindingPath}'.`, \"FormLayout\");\n this._renderScalarField(form, element, bindingPath, meta, modelName, engine);\n }\n } else {\n Logger.warn(`[MetaUI] Unsupported layout element type '${element.type}'.`, \"\", \"FormLayout\");\n }\n };\n\n // Render everything defined in the layout\n schema.uiLayout.forEach(renderElement);\n\n if (hasFormFields) {\n container.addItem(form);\n }\n\n // Render array/table sub-layouts full width below the form\n tableElements.forEach(field => {\n try {\n const subSchema = {\n type: \"array\",\n title: field.label || field.meta.ui?.label || field.scope,\n items: field.meta.items || { type: \"object\", properties: {} },\n uiLayout: field.meta.items?.uiLayout // Pass down sub-layout if available\n };\n \n const control = engine.generateLayout(subSchema as ISchema, modelName, `/${field.scope}`);\n if (control) {\n control.addStyleClass(\"sapUiSmallMarginTop\");\n container.addItem(control);\n }\n } catch (error) {\n const msg = (error as Error).message;\n Logger.error(`[MetaUI] Failed to render array field ${field.scope}`, msg, \"FormLayout\");\n Logger.showErrorPopup(`Failed to render array field '${field.scope}'.\\n\\nDetails: ${msg}`);\n }\n });\n\n return container;\n }\n\n /**\n * Synthesizes a primitive field into the Form.\n * @param form The SimpleForm instance.\n * @param element The layout element definition.\n * @param propKey The bound property key.\n * @param meta The inferred metadata schema.\n * @param modelName The UI5 data model name.\n * @param engine The core Engine instance.\n */\n private _renderScalarField(form: SimpleForm, element: ILayoutElement, propKey: string, meta: IPropertyMetadata, modelName: string, engine: Engine): void {\n try {\n const labelText = element.label || meta.ui?.label || propKey;\n const label = new Label({\n text: labelText,\n required: meta.required\n });\n\n // Override widget if specified in the layout element\n const effectiveMeta = { ...meta };\n if (element.widget) {\n effectiveMeta.ui = { ...meta.ui, widget: element.widget };\n }\n\n const control = engine.generateField(effectiveMeta, `/${propKey}`, modelName);\n\n // Automatically apply fullWidth layout data if natively wide or explicitly requested\n const isNativelyWide = PluginRegistry.getInstance().isPluginNativelyWide(effectiveMeta.type || \"string\", effectiveMeta.ui?.widget);\n const isFullWidth = effectiveMeta.ui?.fullWidth !== undefined ? effectiveMeta.ui?.fullWidth : isNativelyWide;\n\n if (isFullWidth) {\n sap.ui.require([\"sap/ui/layout/GridData\"], (GridData: typeof import(\"sap/ui/layout/GridData\").default) => {\n control.setLayoutData(new GridData({ span: \"XL12 L12 M12 S12\" }));\n });\n }\n\n form.addContent(label);\n form.addContent(control);\n } catch (error) {\n const msg = (error as Error).message;\n Logger.error(`[MetaUI] Failed to render field ${propKey}`, msg, \"FormLayout\");\n Logger.showErrorPopup(`Failed to render field '${propKey}'.\\n\\nDetails: ${msg}`);\n }\n }\n}\n"],"mappings":";;;QAYSA,gBAAgB,GAAAC,wBAAA;EAAA,MAChBC,MAAM,GAAAC,eAAA;EAAA,MAENC,cAAc,GAAAC,sBAAA;EAEvB;AACA;AACA;AACA;AACA;AACA;AACA;EACO,MAAMC,UAAU,CAA2B;IAC9C;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACWC,MAAMA,CAACC,MAAe,EAAEC,SAAiB,EAAEC,MAAc,EAAEC,QAAqB,EAAW;MAC9F,MAAMC,SAAS,GAAG,IAAIC,IAAI,CAAC;QAAEC,UAAU,EAAE;MAAO,CAAC,CAAC;MAClD,MAAMC,IAAI,GAAG,IAAIC,UAAU,CAAC;QACxBC,QAAQ,EAAE,IAAI;QACdC,KAAK,EAAEV,MAAM,CAACU,KAAK;QACnBC,MAAM,EAAE,sBAAsB;QAC9BC,WAAW,EAAE,CAAC;QAAEC,UAAU,EAAE,CAAC;QAAEC,UAAU,EAAE,CAAC;QAAEC,UAAU,EAAE,EAAE;QAC5DC,eAAe,EAAE,KAAK;QACtBC,WAAW,EAAE,CAAC;QAAEC,UAAU,EAAE,CAAC;QAAEC,UAAU,EAAE,CAAC;QAAEC,UAAU,EAAE,CAAC;QAC3DC,SAAS,EAAE,CAAC;QAAEC,QAAQ,EAAE,CAAC;QAAEC,QAA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AC7ErE,MAAM,CAACuE,cAAc,CAAC,2BAA2BnB,OAAO,kBAAkBiB,GAAG,EAAE,CAAC;MACpF;IACJ;EACJ;EAAC,IAAAmB,SAAA;IAAAC,UAAA;EAAA;EAAAD,SAAA,CAAApF,UAAA,GAAAA,UAAA;EAAA,OAAAoF,SAAA;AAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormLayout.d.ts","sourceRoot":"../../../../../../../..","sources":["src/nz/co/siliconst/ui5/metaui/layouts/FormLayout.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,+CAA+C,CAAC;IAU/D,OAAO,EAAqB,OAAO,EAAkB,MAAM,+CAA+C,CAAC;IAC3G,OAAO,EAAE,cAAc,EAAE,MAAM,sDAAsD,CAAC;IACtF,OAAO,EAAE,MAAM,EAAE,MAAM,wCAAwC,CAAC;IAGhE,OAAO,OAAO,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"FormLayout.d.ts","sourceRoot":"../../../../../../../..","sources":["src/nz/co/siliconst/ui5/metaui/layouts/FormLayout.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,+CAA+C,CAAC;IAU/D,OAAO,EAAqB,OAAO,EAAkB,MAAM,+CAA+C,CAAC;IAC3G,OAAO,EAAE,cAAc,EAAE,MAAM,sDAAsD,CAAC;IACtF,OAAO,EAAE,MAAM,EAAE,MAAM,wCAAwC,CAAC;IAGhE,OAAO,OAAO,MAAM,qBAAqB,CAAC;IAG1C;;;;;;OAMG;IACH,MAAa,UAAW,YAAW,cAAc;QAC7C;;;;;;;;WAQG;QACI,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO;QAiGjG;;;;;;;;WAQG;QACH,OAAO,CAAC,kBAAkB;KAkC7B;CAEA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
sap.ui.define(["sap/ui/layout/form/SimpleForm","sap/m/Label","sap/ui/core/Title","sap/m/VBox","../core/SchemaNormalizer","../utils/Logger"],function(e,t,a,r,o,i){"use strict";const
|
|
1
|
+
sap.ui.define(["sap/ui/layout/form/SimpleForm","sap/m/Label","sap/ui/core/Title","sap/m/VBox","../core/SchemaNormalizer","../utils/Logger","../core/PluginRegistry"],function(e,t,a,r,o,i,n){"use strict";const s=o["SchemaNormalizer"];const l=i["Logger"];const u=n["PluginRegistry"];class p{render(t,o,i,n){const u=new r({renderType:"Bare"});const p=new e({editable:true,title:t.title,layout:"ResponsiveGridLayout",labelSpanXL:4,labelSpanL:4,labelSpanM:4,labelSpanS:12,adjustLabelSpan:false,emptySpanXL:0,emptySpanL:0,emptySpanM:0,emptySpanS:0,columnsXL:1,columnsL:1,columnsM:1,singleContainerFullSize:false});if(!t.uiLayout||!Array.isArray(t.uiLayout)){l.warn("[MetaUI] Missing 'uiLayout' array in schema. Form will not render any fields.");u.addItem(p);return u}const d=[];let c=false;const y=e=>{if(e.type==="Group"){if(e.label){p.addContent(new a({text:e.label}))}if(e.elements&&Array.isArray(e.elements)){e.elements.forEach(y)}}else if(e.type==="Control"){if(!e.scope||!e.scope.startsWith("#/properties/")){l.error(`[MetaUI] Invalid scope '${e.scope}' in uiLayout Control.`,"","FormLayout");return}const{meta:a,bindingPath:r,propKey:n}=s.resolveScope(t,e.scope);if(!a){l.error(`[MetaUI] Property '${n}' not found in schema definitions.`,"","FormLayout");return}const u=a.items?.type==="object"||a.items?.properties;const y=!!a.ui?.widget;const m=a.type==="array"&&u&&!y;if(m){l.debug("[MetaUI FormLayout]",`Routing property '${n}' to Table Sub-Layout.`,"FormLayout");d.push({scope:r,meta:a,label:e.label})}else{c=true;l.debug("[MetaUI FormLayout]",`Rendering scalar field '${r}'.`,"FormLayout");this._renderScalarField(p,e,r,a,o,i)}}else{l.warn(`[MetaUI] Unsupported layout element type '${e.type}'.`,"","FormLayout")}};t.uiLayout.forEach(y);if(c){u.addItem(p)}d.forEach(e=>{try{const t={type:"array",title:e.label||e.meta.ui?.label||e.scope,items:e.meta.items||{type:"object",properties:{}},uiLayout:e.meta.items?.uiLayout};const a=i.generateLayout(t,o,`/${e.scope}`);if(a){a.addStyleClass("sapUiSmallMarginTop");u.addItem(a)}}catch(t){const a=t.message;l.error(`[MetaUI] Failed to render array field ${e.scope}`,a,"FormLayout");l.showErrorPopup(`Failed to render array field '${e.scope}'.\n\nDetails: ${a}`)}});return u}_renderScalarField(e,a,r,o,i,n){try{const s=a.label||o.ui?.label||r;const l=new t({text:s,required:o.required});const p={...o};if(a.widget){p.ui={...o.ui,widget:a.widget}}const d=n.generateField(p,`/${r}`,i);const c=u.getInstance().isPluginNativelyWide(p.type||"string",p.ui?.widget);const y=p.ui?.fullWidth!==undefined?p.ui?.fullWidth:c;if(y){sap.ui.require(["sap/ui/layout/GridData"],e=>{d.setLayoutData(new e({span:"XL12 L12 M12 S12"}))})}e.addContent(l);e.addContent(d)}catch(e){const t=e.message;l.error(`[MetaUI] Failed to render field ${r}`,t,"FormLayout");l.showErrorPopup(`Failed to render field '${r}'.\n\nDetails: ${t}`)}}}var d={__esModule:true};d.FormLayout=p;return d});
|
|
2
2
|
//# sourceMappingURL=FormLayout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormLayout.js","names":["SchemaNormalizer","___core_SchemaNormalizer","Logger","___utils_Logger","FormLayout","render","schema","modelName","engine","onSubmit","container","VBox","renderType","form","SimpleForm","editable","title","layout","labelSpanXL","labelSpanL","labelSpanM","labelSpanS","adjustLabelSpan","emptySpanXL","emptySpanL","emptySpanM","emptySpanS","columnsXL","columnsL","columnsM","singleContainerFullSize","uiLayout","Array","isArray","warn","addItem","tableElements","hasFormFields","renderElement","element","type","label","addContent","Title","text","elements","forEach","scope","startsWith","error","meta","bindingPath","propKey","resolveScope","isCollectionOfRecords","items","properties","hasExplicitWidget","ui","widget","isSubLayout","debug","push","this","_renderScalarField","field","subSchema","control","generateLayout","addStyleClass","msg","message","showErrorPopup","labelText","Label","required","effectiveMeta","generateField","isNativelyWide","isFullWidth","fullWidth","undefined","sap","require","GridData","setLayoutData","span","__exports","__esModule"],"sources":["FormLayout.ts"],"sourcesContent":["/**\n * @file FormLayout.ts\n * @description Generates a fully responsive SAP Fiori Form layout (SimpleForm).\n */\n\nimport SimpleForm from \"sap/ui/layout/form/SimpleForm\";\nimport Label from \"sap/m/Label\";\nimport Title from \"sap/ui/core/Title\";\nimport VBox from \"sap/m/VBox\";\nimport { IPropertyMetadata, ISchema, ILayoutElement } from \"../interfaces/ISchema\";\nimport { ILayoutManager } from \"../interfaces/ILayoutManager\";\nimport { Engine } from \"../core/Engine\";\nimport { SchemaNormalizer } from \"../core/SchemaNormalizer\";\nimport { Logger } from \"../utils/Logger\";\nimport Control from \"sap/ui/core/Control\";\n\n/**\n * Layout Manager responsible for generating a fully responsive SAP Fiori SimpleForm.\n * It traverses the `uiLayout` tree defined in the schema to build the form groups and fields,\n * completely separating visual orchestration from data modeling.\n * @namespace nz.co.siliconst.ui5.metaui.layouts\n * @public\n */\nexport class FormLayout implements ILayoutManager {\n /**\n * Renders the JSON Schema properties into a UI5 SimpleForm using the uiLayout definitions.\n * \n * @param schema The active JSON schema subset.\n * @param modelName The bound UI5 model name.\n * @param engine The central orchestrator for delegating plugin generation.\n * @param onSubmit Optional submit hook.\n * @returns {Control} The VBox wrapper containing the generated form.\n */\n public render(schema: ISchema, modelName: string, engine: Engine, onSubmit?: () => void): Control {\n const container = new VBox({ renderType: \"Bare\" });\n const form = new SimpleForm({\n editable: true,\n title: schema.title,\n layout: \"ResponsiveGridLayout\",\n labelSpanXL: 4, labelSpanL: 4, labelSpanM: 4, labelSpanS: 12,\n adjustLabelSpan: false,\n emptySpanXL: 0, emptySpanL: 0, emptySpanM: 0, emptySpanS: 0,\n columnsXL: 1, columnsL: 1, columnsM: 1,\n singleContainerFullSize: false\n });\n\n if (!schema.uiLayout || !Array.isArray(schema.uiLayout)) {\n Logger.warn(\"[MetaUI] Missing 'uiLayout' array in schema. Form will not render any fields.\");\n container.addItem(form);\n return container;\n }\n\n const tableElements: { scope: string, meta: IPropertyMetadata, label?: string }[] = [];\n let hasFormFields = false;\n\n // Recursively render layout elements\n const renderElement = (element: ILayoutElement) => {\n if (element.type === \"Group\") {\n if (element.label) {\n form.addContent(new Title({ text: element.label }));\n }\n \n if (element.elements && Array.isArray(element.elements)) {\n element.elements.forEach(renderElement);\n }\n } else if (element.type === \"Control\") {\n if (!element.scope || !element.scope.startsWith(\"#/properties/\")) {\n Logger.error(`[MetaUI] Invalid scope '${element.scope}' in uiLayout Control.`, \"\", \"FormLayout\");\n return;\n }\n \n const { meta, bindingPath, propKey } = SchemaNormalizer.resolveScope(schema, element.scope);\n \n if (!meta) {\n Logger.error(`[MetaUI] Property '${propKey}' not found in schema definitions.`, \"\", \"FormLayout\");\n return;\n }\n\n // Architectural Boundary: Separate Field Controls (Plugins) from Sub-Layouts (LayoutManagers)\n // A property is delegated to a Sub-Layout Manager (Table) ONLY if it represents a collection of complex objects.\n // Collections of primitives, or explicitly assigned widgets (like multiSelect), remain in the Form as Field Plugins.\n const isCollectionOfRecords = meta.items?.type === \"object\" || meta.items?.properties;\n const hasExplicitWidget = !!meta.ui?.widget;\n const isSubLayout = meta.type === \"array\" && isCollectionOfRecords && !hasExplicitWidget;\n\n if (isSubLayout) {\n Logger.debug(\"[MetaUI FormLayout]\", `Routing property '${propKey}' to Table Sub-Layout.`, \"FormLayout\");\n tableElements.push({ scope: bindingPath, meta, label: element.label });\n } else {\n hasFormFields = true;\n Logger.debug(\"[MetaUI FormLayout]\", `Rendering scalar field '${bindingPath}'.`, \"FormLayout\");\n this._renderScalarField(form, element, bindingPath, meta, modelName, engine);\n }\n } else {\n Logger.warn(`[MetaUI] Unsupported layout element type '${element.type}'.`, \"\", \"FormLayout\");\n }\n };\n\n // Render everything defined in the layout\n schema.uiLayout.forEach(renderElement);\n\n if (hasFormFields) {\n container.addItem(form);\n }\n\n // Render array/table sub-layouts full width below the form\n tableElements.forEach(field => {\n try {\n const subSchema = {\n type: \"array\",\n title: field.label || field.meta.ui?.label || field.scope,\n items: field.meta.items || { type: \"object\", properties: {} },\n uiLayout: field.meta.items?.uiLayout // Pass down sub-layout if available\n };\n \n const control = engine.generateLayout(subSchema as ISchema, modelName, `/${field.scope}`);\n if (control) {\n control.addStyleClass(\"sapUiSmallMarginTop\");\n container.addItem(control);\n }\n } catch (error) {\n const msg = (error as Error).message;\n Logger.error(`[MetaUI] Failed to render array field ${field.scope}`, msg, \"FormLayout\");\n Logger.showErrorPopup(`Failed to render array field '${field.scope}'.\\n\\nDetails: ${msg}`);\n }\n });\n\n return container;\n }\n\n /**\n * Synthesizes a primitive field into the Form.\n * @param form The SimpleForm instance.\n * @param element The layout element definition.\n * @param propKey The bound property key.\n * @param meta The inferred metadata schema.\n * @param modelName The UI5 data model name.\n * @param engine The core Engine instance.\n */\n private _renderScalarField(form: SimpleForm, element: ILayoutElement, propKey: string, meta: IPropertyMetadata, modelName: string, engine: Engine): void {\n try {\n const labelText = element.label || meta.ui?.label || propKey;\n const label = new Label({\n text: labelText,\n required: meta.required\n });\n\n // Override widget if specified in the layout element\n const effectiveMeta = { ...meta };\n if (element.widget) {\n effectiveMeta.ui = { ...meta.ui, widget: element.widget };\n }\n\n const control = engine.generateField(effectiveMeta, `/${propKey}`, modelName);\n\n // Automatically apply fullWidth layout data if natively wide or explicitly requested\n const widget = effectiveMeta.ui?.widget;\n const isNativelyWide = widget === \"codeEditor\" || widget === \"textArea\" || widget === \"richText\";\n const isFullWidth = effectiveMeta.ui?.fullWidth !== undefined ? effectiveMeta.ui?.fullWidth : isNativelyWide;\n\n if (isFullWidth) {\n sap.ui.require([\"sap/ui/layout/GridData\"], (GridData: typeof import(\"sap/ui/layout/GridData\").default) => {\n control.setLayoutData(new GridData({ span: \"XL12 L12 M12 S12\" }));\n });\n }\n\n form.addContent(label);\n form.addContent(control);\n } catch (error) {\n const msg = (error as Error).message;\n Logger.error(`[MetaUI] Failed to render field ${propKey}`, msg, \"FormLayout\");\n Logger.showErrorPopup(`Failed to render field '${propKey}'.\\n\\nDetails: ${msg}`);\n }\n }\n}\n"],"mappings":"qLAYSA,EAAgBC,EAAA,0BAChBC,EAAMC,EAAA,UAUR,MAAMC,EAUFC,OAAOC,EAAiBC,EAAmBC,EAAgBC,GAC9D,MAAMC,EAAY,IAAIC,EAAK,CAAEC,WAAY,SACzC,MAAMC,EAAO,IAAIC,EAAW,CACxBC,SAAU,KACVC,MAAOV,EAAOU,MACdC,OAAQ,uBACRC,YAAa,EAAGC,WAAY,EAAGC,WAAY,EAAGC,WAAY,GAC1DC,gBAAiB,MACjBC,YAAa,EAAGC,WAAY,EAAGC,WAAY,EAAGC,WAAY,EAC1DC,UAAW,EAAGC,SAAU,EAAGC,SAAU,EACrCC,wBAAyB,QAG7B,IAAKxB,EAAOyB,WAAaC,MAAMC,QAAQ3B,EAAOyB,UAAW,CACrD7B,EAAOgC,KAAK,iFACZxB,EAAUyB,QAAQtB,GAClB,OAAOH,CACX,CAEA,MAAM0B,EAA8E,GACpF,IAAIC,EAAgB,MAGpB,MAAMC,EAAiBC,IACnB,GAAIA,EAAQC,OAAS,QAAS,CAC1B,GAAID,EAAQE,MAAO,CACf5B,EAAK6B,WAAW,IAAIC,EAAM,CAAEC,KAAML,EAAQE,QAC9C,CAEA,GAAIF,EAAQM,UAAYb,MAAMC,QAAQM,EAAQM,UAAW,CACrDN,EAAQM,SAASC,QAAQR,EAC7B,CACJ,MAAO,GAAIC,EAAQC,OAAS,UAAW,CACnC,IAAKD,EAAQQ,QAAUR,EAAQQ,MAAMC,WAAW,iBAAkB,CAC9D9C,EAAO+C,MAAM,2BAA2BV,EAAQQ,8BAA+B,GAAI,cACnF,MACJ,CAEA,MAAMG,KAAEA,EAAIC,YAAEA,EAAWC,QAAEA,GAAYpD,EAAiBqD,aAAa/C,EAAQiC,EAAQQ,OAErF,IAAKG,EA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EAAkB0B,EAAyBa,EAAiBF,EAAyB3C,EAAmBC,GAC/H,IACI,MAAMiE,EAAYlC,EAAQE,OAASS,EAAKQ,IAAIjB,OAASW,EACrD,MAAMX,EAAQ,IAAIiC,EAAM,CACpB9B,KAAM6B,EACNE,SAAUzB,EAAKyB,WAInB,MAAMC,EAAgB,IAAK1B,GAC3B,GAAIX,EAAQoB,OAAQ,CAChBiB,EAAclB,GAAK,IAAKR,EAAKQ,GAAIC,OAAQpB,EAAQoB,OACrD,CAEA,MAAMQ,EAAU3D,EAAOqE,cAAcD,EAAe,IAAIxB,IAAW7C,GAGnE,MAAMoD,EAASiB,EAAclB,IAAIC,OACjC,MAAMmB,EAAiBnB,IAAW,cAAgBA,IAAW,YAAcA,IAAW,WACtF,MAAMoB,EAAcH,EAAclB,IAAIsB,YAAcC,UAAYL,EAAclB,IAAIsB,UAAYF,EAE9F,GAAIC,EAAa,CACbG,IAAIxB,GAAGyB,QAAQ,CAAC,0BAA4BC,IACxCjB,EAAQkB,cAAc,IAAID,EAAS,CAAEE,KAAM,uBAEnD,CAEAzE,EAAK6B,WAAWD,GAChB5B,EAAK6B,WAAWyB,EACpB,CAAE,MAAOlB,GACL,MAAMqB,EAAOrB,EAAgBsB,QAC7BrE,EAAO+C,MAAM,mCAAmCG,IAAWkB,EAAK,cAChEpE,EAAOsE,eAAe,2BAA2BpB,mBAAyBkB,IAC9E,CACJ,EACH,IAAAiB,EAAA,CAAAC,WAAA,MAAAD,EAAAnF,aAAA,OAAAmF,CAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"FormLayout.js","names":["SchemaNormalizer","___core_SchemaNormalizer","Logger","___utils_Logger","PluginRegistry","___core_PluginRegistry","FormLayout","render","schema","modelName","engine","onSubmit","container","VBox","renderType","form","SimpleForm","editable","title","layout","labelSpanXL","labelSpanL","labelSpanM","labelSpanS","adjustLabelSpan","emptySpanXL","emptySpanL","emptySpanM","emptySpanS","columnsXL","columnsL","columnsM","singleContainerFullSize","uiLayout","Array","isArray","warn","addItem","tableElements","hasFormFields","renderElement","element","type","label","addContent","Title","text","elements","forEach","scope","startsWith","error","meta","bindingPath","propKey","resolveScope","isCollectionOfRecords","items","properties","hasExplicitWidget","ui","widget","isTableSubLayout","debug","push","this","_renderScalarField","field","subSchema","control","generateLayout","addStyleClass","msg","message","showErrorPopup","labelText","Label","required","effectiveMeta","generateField","isNativelyWide","getInstance","isPluginNativelyWide","isFullWidth","fullWidth","undefined","sap","require","GridData","setLayoutData","span","__exports","__esModule"],"sources":["FormLayout.ts"],"sourcesContent":["/**\n * @file FormLayout.ts\n * @description Generates a fully responsive SAP Fiori Form layout (SimpleForm).\n */\n\nimport SimpleForm from \"sap/ui/layout/form/SimpleForm\";\nimport Label from \"sap/m/Label\";\nimport Title from \"sap/ui/core/Title\";\nimport VBox from \"sap/m/VBox\";\nimport { IPropertyMetadata, ISchema, ILayoutElement } from \"../interfaces/ISchema\";\nimport { ILayoutManager } from \"../interfaces/ILayoutManager\";\nimport { Engine } from \"../core/Engine\";\nimport { SchemaNormalizer } from \"../core/SchemaNormalizer\";\nimport { Logger } from \"../utils/Logger\";\nimport Control from \"sap/ui/core/Control\";\nimport { PluginRegistry } from \"../core/PluginRegistry\";\n\n/**\n * Layout Manager responsible for generating a fully responsive SAP Fiori SimpleForm.\n * It traverses the `uiLayout` tree defined in the schema to build the form groups and fields,\n * completely separating visual orchestration from data modeling.\n * @namespace nz.co.siliconst.ui5.metaui.layouts\n * @public\n */\nexport class FormLayout implements ILayoutManager {\n /**\n * Renders the JSON Schema properties into a UI5 SimpleForm using the uiLayout definitions.\n * \n * @param schema The active JSON schema subset.\n * @param modelName The bound UI5 model name.\n * @param engine The central orchestrator for delegating plugin generation.\n * @param onSubmit Optional submit hook.\n * @returns {Control} The VBox wrapper containing the generated form.\n */\n public render(schema: ISchema, modelName: string, engine: Engine, onSubmit?: () => void): Control {\n const container = new VBox({ renderType: \"Bare\" });\n const form = new SimpleForm({\n editable: true,\n title: schema.title,\n layout: \"ResponsiveGridLayout\",\n labelSpanXL: 4, labelSpanL: 4, labelSpanM: 4, labelSpanS: 12,\n adjustLabelSpan: false,\n emptySpanXL: 0, emptySpanL: 0, emptySpanM: 0, emptySpanS: 0,\n columnsXL: 1, columnsL: 1, columnsM: 1,\n singleContainerFullSize: false\n });\n\n if (!schema.uiLayout || !Array.isArray(schema.uiLayout)) {\n Logger.warn(\"[MetaUI] Missing 'uiLayout' array in schema. Form will not render any fields.\");\n container.addItem(form);\n return container;\n }\n\n const tableElements: { scope: string, meta: IPropertyMetadata, label?: string }[] = [];\n let hasFormFields = false;\n\n // Recursively render layout elements\n const renderElement = (element: ILayoutElement) => {\n if (element.type === \"Group\") {\n if (element.label) {\n form.addContent(new Title({ text: element.label }));\n }\n \n if (element.elements && Array.isArray(element.elements)) {\n element.elements.forEach(renderElement);\n }\n } else if (element.type === \"Control\") {\n if (!element.scope || !element.scope.startsWith(\"#/properties/\")) {\n Logger.error(`[MetaUI] Invalid scope '${element.scope}' in uiLayout Control.`, \"\", \"FormLayout\");\n return;\n }\n \n const { meta, bindingPath, propKey } = SchemaNormalizer.resolveScope(schema, element.scope);\n \n if (!meta) {\n Logger.error(`[MetaUI] Property '${propKey}' not found in schema definitions.`, \"\", \"FormLayout\");\n return;\n }\n\n // Architectural Boundary: Separate Field Controls (Plugins) from Sub-Layouts (LayoutManagers)\n // A property is delegated to a Sub-Layout Manager (Table) ONLY if it represents a collection of complex objects.\n // Collections of primitives, or explicitly assigned widgets (like multiSelect), remain in the Form as Field Plugins.\n const isCollectionOfRecords = meta.items?.type === \"object\" || meta.items?.properties;\n const hasExplicitWidget = !!meta.ui?.widget;\n const isTableSubLayout = meta.type === \"array\" && isCollectionOfRecords && !hasExplicitWidget;\n\n if (isTableSubLayout) {\n Logger.debug(\"[MetaUI FormLayout]\", `Routing property '${propKey}' to Table Sub-Layout.`, \"FormLayout\");\n tableElements.push({ scope: bindingPath, meta, label: element.label });\n } else {\n hasFormFields = true;\n Logger.debug(\"[MetaUI FormLayout]\", `Rendering scalar field '${bindingPath}'.`, \"FormLayout\");\n this._renderScalarField(form, element, bindingPath, meta, modelName, engine);\n }\n } else {\n Logger.warn(`[MetaUI] Unsupported layout element type '${element.type}'.`, \"\", \"FormLayout\");\n }\n };\n\n // Render everything defined in the layout\n schema.uiLayout.forEach(renderElement);\n\n if (hasFormFields) {\n container.addItem(form);\n }\n\n // Render array/table sub-layouts full width below the form\n tableElements.forEach(field => {\n try {\n const subSchema = {\n type: \"array\",\n title: field.label || field.meta.ui?.label || field.scope,\n items: field.meta.items || { type: \"object\", properties: {} },\n uiLayout: field.meta.items?.uiLayout // Pass down sub-layout if available\n };\n \n const control = engine.generateLayout(subSchema as ISchema, modelName, `/${field.scope}`);\n if (control) {\n control.addStyleClass(\"sapUiSmallMarginTop\");\n container.addItem(control);\n }\n } catch (error) {\n const msg = (error as Error).message;\n Logger.error(`[MetaUI] Failed to render array field ${field.scope}`, msg, \"FormLayout\");\n Logger.showErrorPopup(`Failed to render array field '${field.scope}'.\\n\\nDetails: ${msg}`);\n }\n });\n\n return container;\n }\n\n /**\n * Synthesizes a primitive field into the Form.\n * @param form The SimpleForm instance.\n * @param element The layout element definition.\n * @param propKey The bound property key.\n * @param meta The inferred metadata schema.\n * @param modelName The UI5 data model name.\n * @param engine The core Engine instance.\n */\n private _renderScalarField(form: SimpleForm, element: ILayoutElement, propKey: string, meta: IPropertyMetadata, modelName: string, engine: Engine): void {\n try {\n const labelText = element.label || meta.ui?.label || propKey;\n const label = new Label({\n text: labelText,\n required: meta.required\n });\n\n // Override widget if specified in the layout element\n const effectiveMeta = { ...meta };\n if (element.widget) {\n effectiveMeta.ui = { ...meta.ui, widget: element.widget };\n }\n\n const control = engine.generateField(effectiveMeta, `/${propKey}`, modelName);\n\n // Automatically apply fullWidth layout data if natively wide or explicitly requested\n const isNativelyWide = PluginRegistry.getInstance().isPluginNativelyWide(effectiveMeta.type || \"string\", effectiveMeta.ui?.widget);\n const isFullWidth = effectiveMeta.ui?.fullWidth !== undefined ? effectiveMeta.ui?.fullWidth : isNativelyWide;\n\n if (isFullWidth) {\n sap.ui.require([\"sap/ui/layout/GridData\"], (GridData: typeof import(\"sap/ui/layout/GridData\").default) => {\n control.setLayoutData(new GridData({ span: \"XL12 L12 M12 S12\" }));\n });\n }\n\n form.addContent(label);\n form.addContent(control);\n } catch (error) {\n const msg = (error as Error).message;\n Logger.error(`[MetaUI] Failed to render field ${propKey}`, msg, \"FormLayout\");\n Logger.showErrorPopup(`Failed to render field '${propKey}'.\\n\\nDetails: ${msg}`);\n }\n }\n}\n"],"mappings":"gNAYSA,EAAgBC,EAAA,0BAChBC,EAAMC,EAAA,gBAENC,EAAcC,EAAA,kBAShB,MAAMC,EAUFC,OAAOC,EAAiBC,EAAmBC,EAAgBC,GAC9D,MAAMC,EAAY,IAAIC,EAAK,CAAEC,WAAY,SACzC,MAAMC,EAAO,IAAIC,EAAW,CACxBC,SAAU,KACVC,MAAOV,EAAOU,MACdC,OAAQ,uBACRC,YAAa,EAAGC,WAAY,EAAGC,WAAY,EAAGC,WAAY,GAC1DC,gBAAiB,MACjBC,YAAa,EAAGC,WAAY,EAAGC,WAAY,EAAGC,WAAY,EAC1DC,UAAW,EAAGC,SAAU,EAAGC,SAAU,EACrCC,wBAAyB,QAG7B,IAAKxB,EAAOyB,WAAaC,MAAMC,QAAQ3B,EAAOyB,UAAW,CACrD/B,EAAOkC,KAAK,iFACZxB,EAAUyB,QAAQtB,GAClB,OAAOH,CACX,CAEA,MAAM0B,EAA8E,GACpF,IAAIC,EAAgB,MAGpB,MAAMC,EAAiBC,IACnB,GAAIA,EAAQC,OAAS,QAAS,CAC1B,GAAID,EAAQE,MAAO,CACf5B,EAAK6B,WAAW,IAAIC,EAAM,CAAEC,KAAML,EAAQE,QAC9C,CAEA,GAAIF,EAAQM,UAAYb,MAAMC,QAAQM,EAAQM,UAAW,CACrDN,EAAQM,SAASC,QAAQR,EAC7B,CACJ,MAAO,GAAIC,EAAQC,O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../core/Engine";
|
|
|
13
13
|
import { SchemaNormalizer } from "../core/SchemaNormalizer";
|
|
14
14
|
import { Logger } from "../utils/Logger";
|
|
15
15
|
import Control from "sap/ui/core/Control";
|
|
16
|
+
import { PluginRegistry } from "../core/PluginRegistry";
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* Layout Manager responsible for generating a fully responsive SAP Fiori SimpleForm.
|
|
@@ -81,9 +82,9 @@ export class FormLayout implements ILayoutManager {
|
|
|
81
82
|
// Collections of primitives, or explicitly assigned widgets (like multiSelect), remain in the Form as Field Plugins.
|
|
82
83
|
const isCollectionOfRecords = meta.items?.type === "object" || meta.items?.properties;
|
|
83
84
|
const hasExplicitWidget = !!meta.ui?.widget;
|
|
84
|
-
const
|
|
85
|
+
const isTableSubLayout = meta.type === "array" && isCollectionOfRecords && !hasExplicitWidget;
|
|
85
86
|
|
|
86
|
-
if (
|
|
87
|
+
if (isTableSubLayout) {
|
|
87
88
|
Logger.debug("[MetaUI FormLayout]", `Routing property '${propKey}' to Table Sub-Layout.`, "FormLayout");
|
|
88
89
|
tableElements.push({ scope: bindingPath, meta, label: element.label });
|
|
89
90
|
} else {
|
|
@@ -154,8 +155,7 @@ export class FormLayout implements ILayoutManager {
|
|
|
154
155
|
const control = engine.generateField(effectiveMeta, `/${propKey}`, modelName);
|
|
155
156
|
|
|
156
157
|
// Automatically apply fullWidth layout data if natively wide or explicitly requested
|
|
157
|
-
const
|
|
158
|
-
const isNativelyWide = widget === "codeEditor" || widget === "textArea" || widget === "richText";
|
|
158
|
+
const isNativelyWide = PluginRegistry.getInstance().isPluginNativelyWide(effectiveMeta.type || "string", effectiveMeta.ui?.widget);
|
|
159
159
|
const isFullWidth = effectiveMeta.ui?.fullWidth !== undefined ? effectiveMeta.ui?.fullWidth : isNativelyWide;
|
|
160
160
|
|
|
161
161
|
if (isFullWidth) {
|
|
@@ -27,8 +27,9 @@ sap.ui.define(["sap/m/Table", "sap/m/Column", "sap/m/Text", "sap/m/ColumnListIte
|
|
|
27
27
|
let itemsSchema = schema.items;
|
|
28
28
|
if (itemsSchema && !itemsSchema.properties && itemsSchema.ui?.widget === "reference" && itemsSchema.$ref) {
|
|
29
29
|
Logger.debug(`[MetaUI] TableLayout detecting reference widget for ${bindingPath}. Resolving ${itemsSchema.$ref}`, "", "TableLayout");
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
const host = engine.host;
|
|
31
|
+
if (host && typeof host.getSchemaDefinition === "function") {
|
|
32
|
+
const resolved = host.getSchemaDefinition(itemsSchema.$ref);
|
|
32
33
|
Logger.debug(`[MetaUI] Resolved schema for ${itemsSchema.$ref}: ${!!resolved} ${resolved ? Object.keys(resolved) : ""}`, "", "TableLayout");
|
|
33
34
|
if (resolved && resolved.properties) {
|
|
34
35
|
itemsSchema = resolved;
|
|
@@ -36,7 +37,7 @@ sap.ui.define(["sap/m/Table", "sap/m/Column", "sap/m/Text", "sap/m/ColumnListIte
|
|
|
36
37
|
Logger.error(`[MetaUI] TableLayout resolved schema but it has no properties!`, "", "TableLayout");
|
|
37
38
|
}
|
|
38
39
|
} else {
|
|
39
|
-
Logger.error(`[MetaUI] TableLayout cannot resolve ${itemsSchema.$ref} because engine.host.getSchemaDefinition is missing! host: ${
|
|
40
|
+
Logger.error(`[MetaUI] TableLayout cannot resolve ${itemsSchema.$ref} because engine.host.getSchemaDefinition is missing! host: ${host?.getMetadata().getName()}`, "", "TableLayout");
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
43
|
if (schema.type !== "array" || !itemsSchema || !itemsSchema.properties) {
|
|
@@ -55,7 +56,7 @@ sap.ui.define(["sap/m/Table", "sap/m/Column", "sap/m/Text", "sap/m/ColumnListIte
|
|
|
55
56
|
icon: "sap-icon://add",
|
|
56
57
|
press: oEvent => {
|
|
57
58
|
const btn = oEvent.getSource();
|
|
58
|
-
const tbl = btn.getParent()
|
|
59
|
+
const tbl = btn.getParent()?.getParent();
|
|
59
60
|
const model = tbl.getModel(actualModelName);
|
|
60
61
|
const info = tbl.getBindingInfo("items");
|
|
61
62
|
if (!info || !info.path) return;
|
|
@@ -75,7 +76,8 @@ sap.ui.define(["sap/m/Table", "sap/m/Column", "sap/m/Text", "sap/m/ColumnListIte
|
|
|
75
76
|
mode: !engine.isEditable ? "None" : "Delete",
|
|
76
77
|
delete: oEvent => {
|
|
77
78
|
const item = oEvent.getParameter("listItem");
|
|
78
|
-
const path = item.getBindingContext(actualModelName)
|
|
79
|
+
const path = item.getBindingContext(actualModelName)?.getPath();
|
|
80
|
+
if (!path) return;
|
|
79
81
|
const model = item.getModel(actualModelName);
|
|
80
82
|
const splitPaths = path.split("/");
|
|
81
83
|
const index = parseInt(splitPaths.pop() || "0", 10);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableLayout-dbg.js","names":["SchemaNormalizer","___core_SchemaNormalizer","Logger","___utils_Logger","TableLayout","render","schema","modelName","engine","onSubmit","bindingPath","itemsSchema","items","properties","ui","widget","$ref","debug","host","getSchemaDefinition","resolved","Object","keys","error","getMetadata","getName","type","Error","tableTitle","title","actualModelName","actualPath","table","Table","headerToolbar","Toolbar","content","Title","text","ToolbarSpacer","isEditable","Button","icon","press","oEvent","btn","getSource","tbl","getParent","model","getModel","info","getBindingInfo","path","rawData","getProperty","data","Array","isArray","newData","setProperty","onChange","replace","fixedLayout","mode","delete","item","getParameter","getBindingContext","getPath","splitPaths","split","index","parseInt","pop","arrayPath","join","splice","templateCells","props","layoutElements","uiLayout","forEach","element","scope","meta","fieldMeta","propKey","resolveScope","addColumn","Column","header","Text","label","demandPopin","isKey","minScreenWidth","popinDisplay","effectiveMeta","control","generateField","push","warn","key","column","msg","message","showErrorPopup","rowTemplate","ColumnListItem","cells","bindItems","template","templateShareable","__exports","__esModule"],"sources":["TableLayout.ts"],"sourcesContent":["/**\n * @file TableLayout.ts\n * @description Generates a responsive SAP Fiori Table layout for v2 schema.\n */\n\nimport Table from \"sap/m/Table\";\nimport Column from \"sap/m/Column\";\nimport Text from \"sap/m/Text\";\nimport ColumnListItem from \"sap/m/ColumnListItem\";\nimport Toolbar from \"sap/m/Toolbar\";\nimport Title from \"sap/m/Title\";\nimport ToolbarSpacer from \"sap/m/ToolbarSpacer\";\nimport Button from \"sap/m/Button\";\nimport JSONModel from \"sap/ui/model/json/JSONModel\";\nimport Control from \"sap/ui/core/Control\";\nimport { IPropertyMetadata, ISchema, ILayoutElement } from \"../interfaces/ISchema\";\nimport { ILayoutManager } from \"../interfaces/ILayoutManager\";\nimport { Engine } from \"../core/Engine\";\nimport { SchemaNormalizer } from \"../core/SchemaNormalizer\";\nimport { Logger } from \"../utils/Logger\";\n\n/**\n * Layout Manager responsible for generating a responsive SAP Fiori Table.\n * It is automatically utilized by the Engine when the schema root or property is of type 'array'.\n * Includes built-in support for adding and deleting rows via dynamic data binding manipulation.\n * \n * @namespace nz.co.siliconst.ui5.metaui.layouts\n * @public\n */\nexport class TableLayout implements ILayoutManager {\n /**\n * Renders the JSON Schema array properties into a UI5 Table.\n * \n * @param schema The active JSON schema array definition.\n * @param modelName The UI5 JSONModel name used for data binding.\n * @param engine The central orchestrator for delegating column plugin generation.\n * @param onSubmit Optional submit hook.\n * @param bindingPath The JSON path representing the array within the payload.\n * @returns {Control} The generated sap.m.Table control.\n * @throws {Error} If the provided schema is not of type 'array'.\n */\n public render(schema: ISchema, modelName: string, engine: Engine, onSubmit?: () => void, bindingPath: string = \"/\"): Control {\n let itemsSchema = schema.items;\n if (itemsSchema && !itemsSchema.properties && itemsSchema.ui?.widget === \"reference\" && itemsSchema.$ref) {\n Logger.debug(`[MetaUI] TableLayout detecting reference widget for ${bindingPath}. Resolving ${itemsSchema.$ref}`, \"\", \"TableLayout\");\n if (engine.host && engine.host.getSchemaDefinition) {\n const resolved = engine.host.getSchemaDefinition(itemsSchema.$ref);\n Logger.debug(`[MetaUI] Resolved schema for ${itemsSchema.$ref}: ${!!resolved} ${resolved ? Object.keys(resolved) : \"\"}`, \"\", \"TableLayout\");\n if (resolved && resolved.properties) {\n itemsSchema = resolved;\n } else {\n Logger.error(`[MetaUI] TableLayout resolved schema but it has no properties!`, \"\", \"TableLayout\");\n }\n } else {\n Logger.error(`[MetaUI] TableLayout cannot resolve ${itemsSchema.$ref} because engine.host.getSchemaDefinition is missing! host: ${engine.host?.getMetadata().getName()}`, \"\", \"TableLayout\");\n }\n }\n\n if (schema.type !== \"array\" || !itemsSchema || !itemsSchema.properties) {\n Logger.error(`[MetaUI] TableLayout fatal error! schema.type: ${schema.type}, itemsSchema: ${!!itemsSchema}, properties: ${itemsSchema ? !!itemsSchema.properties : false}`, \"\", \"TableLayout\");\n throw new Error(\"[MetaUI] TableLayout requires an array schema with items.properties.\");\n }\n\n const tableTitle = schema.title || \"Table\";\n const actualModelName = modelName;\n const actualPath = bindingPath;\n\n const table = new Table({\n headerToolbar: new Toolbar({\n content: [\n new Title({ text: tableTitle }),\n new ToolbarSpacer(),\n ...(!engine.isEditable ? [] : [\n new Button({\n text: \"Add Row\",\n icon: \"sap-icon://add\",\n press: (oEvent: sap.ui.base.Event) => {\n const btn = oEvent.getSource();\n const tbl = btn.getParent().getParent() as Table;\n const model = tbl.getModel(actualModelName) as JSONModel;\n const info = tbl.getBindingInfo(\"items\");\n if (!info || !info.path) return;\n\n const rawData = model.getProperty(info.path);\n const data = Array.isArray(rawData) ? rawData : [];\n const newData = [...data, {}];\n model.setProperty(info.path, newData);\n\n // CRITICAL: Notify the engine so it extracts payload and triggers liveUpdate\n if (engine.onChange) {\n engine.onChange(true, actualPath.replace(/^\\//, \"\"));\n }\n }\n })\n ])\n ]\n }),\n fixedLayout: false,\n mode: !engine.isEditable ? \"None\" : \"Delete\",\n delete: (oEvent: sap.ui.base.Event) => {\n const item = oEvent.getParameter(\"listItem\");\n const path = item.getBindingContext(actualModelName).getPath();\n const model = item.getModel(actualModelName) as JSONModel;\n\n const splitPaths = path.split(\"/\");\n const index = parseInt(splitPaths.pop() || \"0\", 10);\n let arrayPath = splitPaths.join(\"/\");\n if (arrayPath === \"\") arrayPath = \"/\";\n\n const rawData = model.getProperty(arrayPath);\n const data = Array.isArray(rawData) ? rawData : [];\n const newData = [...data];\n newData.splice(index, 1);\n model.setProperty(arrayPath, newData);\n\n // CRITICAL: Notify the engine so it extracts payload and triggers liveUpdate\n if (engine.onChange) {\n engine.onChange(true, actualPath.replace(/^\\//, \"\"));\n }\n }\n });\n\n const templateCells: Control[] = [];\n const props = itemsSchema.properties;\n const layoutElements = schema.uiLayout;\n\n if (layoutElements && Array.isArray(layoutElements)) {\n // Only render columns defined in uiLayout\n layoutElements.forEach((element: ILayoutElement) => {\n if (element.type === \"Control\" && element.scope) {\n const { meta: fieldMeta, bindingPath, propKey } = SchemaNormalizer.resolveScope(\n { type: \"object\", properties: props } as ISchema, \n element.scope\n );\n \n if (!fieldMeta) {\n Logger.error(`[MetaUI] Property '${propKey}' not found in schema definitions for Table.`, \"\", \"TableLayout\");\n } else {\n // The architectural boundary: Table Layout orchestrates the columns and aggregation binding,\n // but delegates the actual cell rendering to the Engine's Field Plugins.\n table.addColumn(new Column({\n header: new Text({ text: element.label || fieldMeta.ui?.label || propKey }),\n demandPopin: !fieldMeta.ui?.isKey,\n minScreenWidth: fieldMeta.ui?.isKey ? \"\" : \"Tablet\",\n popinDisplay: \"Inline\"\n }));\n\n const effectiveMeta = { ...fieldMeta };\n if (element.widget) {\n effectiveMeta.ui = { ...fieldMeta.ui, widget: element.widget };\n }\n\n // We pass the activeModel as actualModelName down. But the path must be relative to the \n // table row binding context, so we just use the bindingPath (e.g. \"id\" or \"header/id\")\n const control = engine.generateField(effectiveMeta, bindingPath, actualModelName || \"meta\", true);\n templateCells.push(control);\n }\n } else {\n Logger.warn(`[MetaUI] Unsupported layout element type '${element.type}' in Table.`, \"\", \"TableLayout\");\n }\n });\n } else {\n Logger.debug(\"[MetaUI TableLayout]\", \"No uiLayout provided. Falling back to rendering all properties as columns.\", \"TableLayout\");\n // Fallback: If no uiLayout is provided, render all properties as columns\n Object.keys(props).forEach((key) => {\n try {\n const fieldMeta = props[key];\n const isKey = !!fieldMeta.ui?.isKey;\n\n const column = new Column({\n header: new Text({ text: fieldMeta.ui?.label || key }),\n demandPopin: !isKey,\n minScreenWidth: isKey ? \"\" : \"Tablet\",\n popinDisplay: \"Inline\"\n });\n table.addColumn(column);\n\n const control = engine.generateField(fieldMeta, key, actualModelName || \"meta\", true);\n templateCells.push(control);\n } catch (error) {\n const msg = (error as Error).message;\n Logger.error(`[MetaUI] Failed to render fallback column ${key}`, msg, \"TableLayout\");\n Logger.showErrorPopup(`Failed to render fallback table column '${key}'.\\n\\nDetails: ${msg}`);\n templateCells.push(new Text({ text: \"Error\" }));\n }\n });\n }\n\n\n\n const rowTemplate = new ColumnListItem({\n cells: templateCells\n });\n\n table.bindItems({\n path: actualPath,\n model: actualModelName,\n template: rowTemplate,\n templateShareable: false\n });\n\n return table;\n }\n}\n"],"mappings":";;;QAkBSA,gBAAgB,GAAAC,wBAAA;EAAA,MAChBC,MAAM,GAAAC,eAAA;EAEf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACO,MAAMC,WAAW,CAA2B;IAC/C;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACWC,MAAMA,CAACC,MAAe,EAAEC,SAAiB,EAAEC,MAAc,EAAEC,QAAqB,EAAEC,WAAmB,GAAG,GAAG,EAAW;MACzH,IAAIC,WAAW,GAAGL,MAAM,CAACM,KAAK;MAC9B,IAAID,WAAW,IAAI,CAACA,WAAW,CAACE,UAAU,IAAIF,WAAW,CAACG,EAAE,EAAEC,MAAM,KAAK,WAAW,IAAIJ,WAAW,CAACK,IAAI,EAAE;QACtGd,MAAM,CAACe,KAAK,CAAC,uDAAuDP,WAAW,eAAeC,WAAW,CAACK,IAAI,EAAE,EAAE,EAAE,EAAE,aAAa,CAAC;QACpI,IAAIR,MAAM,CAACU,IAAI,IAAIV,MAAM,CAACU,IAAI,CAACC,mBAAmB,EAAE;UAChD,MAAMC,QAAQ,GAAGZ,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AAI,CAAC,IAAIT,IAAI,CAAC;cAAEtD,IAAI,EAAE;YAAQ,CAAC,CAAC,CAAC;UACnD;QACJ,CAAC,CAAC;MACN;MAIA,MAAMsE,WAAW,GAAG,IAAIC,cAAc,CAAC;QACnCC,KAAK,EAAEhC;MACX,CAAC,CAAC;MAEF9C,KAAK,CAAC+E,SAAS,CAAC;QACZ1D,IAAI,EAAEtB,UAAU;QAChBkB,KAAK,EAAEnB,eAAe;QACtBkF,QAAQ,EAAEJ,WAAW;QACrBK,iBAAiB,EAAE;MACvB,CAAC,CAAC;MAEF,OAAOjF,KAAK;IAChB;EACJ;EAAC,IAAAkF,SAAA;IAAAC,UAAA;EAAA;EAAAD,SAAA,CAAA9G,WAAA,GAAAA,WAAA;EAAA,OAAA8G,SAAA;AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"TableLayout-dbg.js","names":["SchemaNormalizer","___core_SchemaNormalizer","Logger","___utils_Logger","TableLayout","render","schema","modelName","engine","onSubmit","bindingPath","itemsSchema","items","properties","ui","widget","$ref","debug","host","getSchemaDefinition","resolved","Object","keys","error","getMetadata","getName","type","Error","tableTitle","title","actualModelName","actualPath","table","Table","headerToolbar","Toolbar","content","Title","text","ToolbarSpacer","isEditable","Button","icon","press","oEvent","btn","getSource","tbl","getParent","model","getModel","info","getBindingInfo","path","rawData","getProperty","data","Array","isArray","newData","setProperty","onChange","replace","fixedLayout","mode","delete","item","getParameter","getBindingContext","getPath","splitPaths","split","index","parseInt","pop","arrayPath","join","splice","templateCells","props","layoutElements","uiLayout","forEach","element","scope","meta","fieldMeta","propKey","resolveScope","addColumn","Column","header","Text","label","demandPopin","isKey","minScreenWidth","popinDisplay","effectiveMeta","control","generateField","push","warn","key","column","msg","message","showErrorPopup","rowTemplate","ColumnListItem","cells","bindItems","template","templateShareable","__exports","__esModule"],"sources":["TableLayout.ts"],"sourcesContent":["/**\n * @file TableLayout.ts\n * @description Generates a responsive SAP Fiori Table layout for v2 schema.\n */\n\nimport Table from \"sap/m/Table\";\nimport Column from \"sap/m/Column\";\nimport Text from \"sap/m/Text\";\nimport ColumnListItem from \"sap/m/ColumnListItem\";\nimport Toolbar from \"sap/m/Toolbar\";\nimport Title from \"sap/m/Title\";\nimport ToolbarSpacer from \"sap/m/ToolbarSpacer\";\nimport Button from \"sap/m/Button\";\nimport JSONModel from \"sap/ui/model/json/JSONModel\";\nimport Control from \"sap/ui/core/Control\";\nimport { IPropertyMetadata, ISchema, ILayoutElement } from \"../interfaces/ISchema\";\nimport { ILayoutManager } from \"../interfaces/ILayoutManager\";\nimport { Engine } from \"../core/Engine\";\nimport GeneratorHost from \"../controls/host/GeneratorHost\";\nimport { SchemaNormalizer } from \"../core/SchemaNormalizer\";\nimport { Logger } from \"../utils/Logger\";\n\n/**\n * Layout Manager responsible for generating a responsive SAP Fiori Table.\n * It is automatically utilized by the Engine when the schema root or property is of type 'array'.\n * Includes built-in support for adding and deleting rows via dynamic data binding manipulation.\n * \n * @namespace nz.co.siliconst.ui5.metaui.layouts\n * @public\n */\nexport class TableLayout implements ILayoutManager {\n /**\n * Renders the JSON Schema array properties into a UI5 Table.\n * \n * @param schema The active JSON schema array definition.\n * @param modelName The UI5 JSONModel name used for data binding.\n * @param engine The central orchestrator for delegating column plugin generation.\n * @param onSubmit Optional submit hook.\n * @param bindingPath The JSON path representing the array within the payload.\n * @returns {Control} The generated sap.m.Table control.\n * @throws {Error} If the provided schema is not of type 'array'.\n */\n public render(schema: ISchema, modelName: string, engine: Engine, onSubmit?: () => void, bindingPath: string = \"/\"): Control {\n let itemsSchema = schema.items;\n if (itemsSchema && !itemsSchema.properties && itemsSchema.ui?.widget === \"reference\" && itemsSchema.$ref) {\n Logger.debug(`[MetaUI] TableLayout detecting reference widget for ${bindingPath}. Resolving ${itemsSchema.$ref}`, \"\", \"TableLayout\");\n \n const host = engine.host as unknown as GeneratorHost;\n if (host && typeof host.getSchemaDefinition === \"function\") {\n const resolved = host.getSchemaDefinition(itemsSchema.$ref);\n Logger.debug(`[MetaUI] Resolved schema for ${itemsSchema.$ref}: ${!!resolved} ${resolved ? Object.keys(resolved) : \"\"}`, \"\", \"TableLayout\");\n if (resolved && resolved.properties) {\n itemsSchema = resolved;\n } else {\n Logger.error(`[MetaUI] TableLayout resolved schema but it has no properties!`, \"\", \"TableLayout\");\n }\n } else {\n Logger.error(`[MetaUI] TableLayout cannot resolve ${itemsSchema.$ref} because engine.host.getSchemaDefinition is missing! host: ${host?.getMetadata().getName()}`, \"\", \"TableLayout\");\n }\n }\n\n if (schema.type !== \"array\" || !itemsSchema || !itemsSchema.properties) {\n Logger.error(`[MetaUI] TableLayout fatal error! schema.type: ${schema.type}, itemsSchema: ${!!itemsSchema}, properties: ${itemsSchema ? !!itemsSchema.properties : false}`, \"\", \"TableLayout\");\n throw new Error(\"[MetaUI] TableLayout requires an array schema with items.properties.\");\n }\n\n const tableTitle = schema.title || \"Table\";\n const actualModelName = modelName;\n const actualPath = bindingPath;\n\n const table = new Table({\n headerToolbar: new Toolbar({\n content: [\n new Title({ text: tableTitle }),\n new ToolbarSpacer(),\n ...(!engine.isEditable ? [] : [\n new Button({\n text: \"Add Row\",\n icon: \"sap-icon://add\",\n press: (oEvent: sap.ui.base.Event) => {\n const btn = oEvent.getSource() as Button;\n const tbl = btn.getParent()?.getParent() as Table;\n const model = tbl.getModel(actualModelName) as JSONModel;\n const info = tbl.getBindingInfo(\"items\");\n if (!info || !info.path) return;\n\n const rawData = model.getProperty(info.path);\n const data = Array.isArray(rawData) ? rawData : [];\n const newData = [...data, {}];\n model.setProperty(info.path, newData);\n\n // CRITICAL: Notify the engine so it extracts payload and triggers liveUpdate\n if (engine.onChange) {\n engine.onChange(true, actualPath.replace(/^\\//, \"\"));\n }\n }\n })\n ])\n ]\n }),\n fixedLayout: false,\n mode: !engine.isEditable ? \"None\" : \"Delete\",\n delete: (oEvent: sap.ui.base.Event) => {\n const item = oEvent.getParameter(\"listItem\") as ColumnListItem;\n const path = item.getBindingContext(actualModelName)?.getPath();\n if (!path) return;\n const model = item.getModel(actualModelName) as JSONModel;\n\n const splitPaths = path.split(\"/\");\n const index = parseInt(splitPaths.pop() || \"0\", 10);\n let arrayPath = splitPaths.join(\"/\");\n if (arrayPath === \"\") arrayPath = \"/\";\n\n const rawData = model.getProperty(arrayPath);\n const data = Array.isArray(rawData) ? rawData : [];\n const newData = [...data];\n newData.splice(index, 1);\n model.setProperty(arrayPath, newData);\n\n // CRITICAL: Notify the engine so it extracts payload and triggers liveUpdate\n if (engine.onChange) {\n engine.onChange(true, actualPath.replace(/^\\//, \"\"));\n }\n }\n });\n\n const templateCells: Control[] = [];\n const props = itemsSchema.properties;\n const layoutElements = schema.uiLayout;\n\n if (layoutElements && Array.isArray(layoutElements)) {\n // Only render columns defined in uiLayout\n layoutElements.forEach((element: ILayoutElement) => {\n if (element.type === \"Control\" && element.scope) {\n const { meta: fieldMeta, bindingPath, propKey } = SchemaNormalizer.resolveScope(\n { type: \"object\", properties: props } as ISchema, \n element.scope\n );\n \n if (!fieldMeta) {\n Logger.error(`[MetaUI] Property '${propKey}' not found in schema definitions for Table.`, \"\", \"TableLayout\");\n } else {\n // The architectural boundary: Table Layout orchestrates the columns and aggregation binding,\n // but delegates the actual cell rendering to the Engine's Field Plugins.\n table.addColumn(new Column({\n header: new Text({ text: element.label || fieldMeta.ui?.label || propKey }),\n demandPopin: !fieldMeta.ui?.isKey,\n minScreenWidth: fieldMeta.ui?.isKey ? \"\" : \"Tablet\",\n popinDisplay: \"Inline\"\n }));\n\n const effectiveMeta = { ...fieldMeta };\n if (element.widget) {\n effectiveMeta.ui = { ...fieldMeta.ui, widget: element.widget };\n }\n\n // We pass the activeModel as actualModelName down. But the path must be relative to the \n // table row binding context, so we just use the bindingPath (e.g. \"id\" or \"header/id\")\n const control = engine.generateField(effectiveMeta, bindingPath, actualModelName || \"meta\", true);\n templateCells.push(control);\n }\n } else {\n Logger.warn(`[MetaUI] Unsupported layout element type '${element.type}' in Table.`, \"\", \"TableLayout\");\n }\n });\n } else {\n Logger.debug(\"[MetaUI TableLayout]\", \"No uiLayout provided. Falling back to rendering all properties as columns.\", \"TableLayout\");\n // Fallback: If no uiLayout is provided, render all properties as columns\n Object.keys(props).forEach((key) => {\n try {\n const fieldMeta = props[key];\n const isKey = !!fieldMeta.ui?.isKey;\n\n const column = new Column({\n header: new Text({ text: fieldMeta.ui?.label || key }),\n demandPopin: !isKey,\n minScreenWidth: isKey ? \"\" : \"Tablet\",\n popinDisplay: \"Inline\"\n });\n table.addColumn(column);\n\n const control = engine.generateField(fieldMeta, key, actualModelName || \"meta\", true);\n templateCells.push(control);\n } catch (error) {\n const msg = (error as Error).message;\n Logger.error(`[MetaUI] Failed to render fallback column ${key}`, msg, \"TableLayout\");\n Logger.showErrorPopup(`Failed to render fallback table column '${key}'.\\n\\nDetails: ${msg}`);\n templateCells.push(new Text({ text: \"Error\" }));\n }\n });\n }\n\n\n\n const rowTemplate = new ColumnListItem({\n cells: templateCells\n });\n\n table.bindItems({\n path: actualPath,\n model: actualModelName,\n template: rowTemplate,\n templateShareable: false\n });\n\n return table;\n }\n}\n"],"mappings":";;;QAmBSA,gBAAgB,GAAAC,wBAAA;EAAA,MAChBC,MAAM,GAAAC,eAAA;EAEf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACO,MAAMC,WAAW,CAA2B;IAC/C;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACWC,MAAMA,CAACC,MAAe,EAAEC,SAAiB,EAAEC,MAAc,EAAEC,QAAqB,EAAEC,WAAmB,GAAG,GAAG,EAAW;MACzH,IAAIC,WAAW,GAAGL,MAAM,CAACM,KAAK;MAC9B,IAAID,WAAW,IAAI,CAACA,WAAW,CAACE,UAAU,IAAIF,WAAW,CAACG,EAAE,EAAEC,MAAM,KAAK,WAAW,IAAIJ,WAAW,CAACK,IAAI,EAAE;QACtGd,MAAM,CAACe,KAAK,CAAC,uDAAuDP,WAAW,eAAeC,WAAW,CAACK,IAAI,EAAE,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xG,MAAM,CAACqB,KAAK,CAAC,6CAA6CgF,GAAG,EAAE,EAAEE,GAAG,EAAE,aAAa,CAAC;YACpFvG,MAAM,CAACyG,cAAc,CAAC,2CAA2CJ,GAAG,kBAAkBE,GAAG,EAAE,CAAC;YAC5F3B,aAAa,CAACuB,IAAI,CAAC,IAAIT,IAAI,CAAC;cAAEtD,IAAI,EAAE;YAAQ,CAAC,CAAC,CAAC;UACnD;QACJ,CAAC,CAAC;MACN;MAIA,MAAMsE,WAAW,GAAG,IAAIC,cAAc,CAAC;QACnCC,KAAK,EAAEhC;MACX,CAAC,CAAC;MAEF9C,KAAK,CAAC+E,SAAS,CAAC;QACZ1D,IAAI,EAAEtB,UAAU;QAChBkB,KAAK,EAAEnB,eAAe;QACtBkF,QAAQ,EAAEJ,WAAW;QACrBK,iBAAiB,EAAE;MACvB,CAAC,CAAC;MAEF,OAAOjF,KAAK;IAChB;EACJ;EAAC,IAAAkF,SAAA;IAAAC,UAAA;EAAA;EAAAD,SAAA,CAAA9G,WAAA,GAAAA,WAAA;EAAA,OAAA8G,SAAA;AAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableLayout.d.ts","sourceRoot":"../../../../../../../..","sources":["src/nz/co/siliconst/ui5/metaui/layouts/TableLayout.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,gDAAgD,CAAC;IAehE,OAAO,OAAO,MAAM,qBAAqB,CAAC;IAC1C,OAAO,EAAqB,OAAO,EAAkB,MAAM,+CAA+C,CAAC;IAC3G,OAAO,EAAE,cAAc,EAAE,MAAM,sDAAsD,CAAC;IACtF,OAAO,EAAE,MAAM,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"TableLayout.d.ts","sourceRoot":"../../../../../../../..","sources":["src/nz/co/siliconst/ui5/metaui/layouts/TableLayout.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,gDAAgD,CAAC;IAehE,OAAO,OAAO,MAAM,qBAAqB,CAAC;IAC1C,OAAO,EAAqB,OAAO,EAAkB,MAAM,+CAA+C,CAAC;IAC3G,OAAO,EAAE,cAAc,EAAE,MAAM,sDAAsD,CAAC;IACtF,OAAO,EAAE,MAAM,EAAE,MAAM,wCAAwC,CAAC;IAKhE;;;;;;;OAOG;IACH,MAAa,WAAY,YAAW,cAAc;QAC9C;;;;;;;;;;WAUG;QACI,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,IAAI,EAAE,WAAW,GAAE,MAAY,GAAG,OAAO;KAqK/H;CAEA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
sap.ui.define(["sap/m/Table","sap/m/Column","sap/m/Text","sap/m/ColumnListItem","sap/m/Toolbar","sap/m/Title","sap/m/ToolbarSpacer","sap/m/Button","../core/SchemaNormalizer","../utils/Logger"],function(e,t,a,o,r,n,s,i,l,c){"use strict";const p=l["SchemaNormalizer"];const u=c["Logger"];class d{render(l,c,d,m,y="/"){let b=l.items;if(b&&!b.properties&&b.ui?.widget==="reference"&&b.$ref){u.debug(`[MetaUI] TableLayout detecting reference widget for ${y}. Resolving ${b.$ref}`,"","TableLayout");
|
|
1
|
+
sap.ui.define(["sap/m/Table","sap/m/Column","sap/m/Text","sap/m/ColumnListItem","sap/m/Toolbar","sap/m/Title","sap/m/ToolbarSpacer","sap/m/Button","../core/SchemaNormalizer","../utils/Logger"],function(e,t,a,o,r,n,s,i,l,c){"use strict";const p=l["SchemaNormalizer"];const u=c["Logger"];class d{render(l,c,d,m,y="/"){let b=l.items;if(b&&!b.properties&&b.ui?.widget==="reference"&&b.$ref){u.debug(`[MetaUI] TableLayout detecting reference widget for ${y}. Resolving ${b.$ref}`,"","TableLayout");const e=d.host;if(e&&typeof e.getSchemaDefinition==="function"){const t=e.getSchemaDefinition(b.$ref);u.debug(`[MetaUI] Resolved schema for ${b.$ref}: ${!!t} ${t?Object.keys(t):""}`,"","TableLayout");if(t&&t.properties){b=t}else{u.error(`[MetaUI] TableLayout resolved schema but it has no properties!`,"","TableLayout")}}else{u.error(`[MetaUI] TableLayout cannot resolve ${b.$ref} because engine.host.getSchemaDefinition is missing! host: ${e?.getMetadata().getName()}`,"","TableLayout")}}if(l.type!=="array"||!b||!b.properties){u.error(`[MetaUI] TableLayout fatal error! schema.type: ${l.type}, itemsSchema: ${!!b}, properties: ${b?!!b.properties:false}`,"","TableLayout");throw new Error("[MetaUI] TableLayout requires an array schema with items.properties.")}const g=l.title||"Table";const f=c;const h=y;const T=new e({headerToolbar:new r({content:[new n({text:g}),new s,...!d.isEditable?[]:[new i({text:"Add Row",icon:"sap-icon://add",press:e=>{const t=e.getSource();const a=t.getParent()?.getParent();const o=a.getModel(f);const r=a.getBindingInfo("items");if(!r||!r.path)return;const n=o.getProperty(r.path);const s=Array.isArray(n)?n:[];const i=[...s,{}];o.setProperty(r.path,i);if(d.onChange){d.onChange(true,h.replace(/^\//,""))}}})]]}),fixedLayout:false,mode:!d.isEditable?"None":"Delete",delete:e=>{const t=e.getParameter("listItem");const a=t.getBindingContext(f)?.getPath();if(!a)return;const o=t.getModel(f);const r=a.split("/");const n=parseInt(r.pop()||"0",10);let s=r.join("/");if(s==="")s="/";const i=o.getProperty(s);const l=Array.isArray(i)?i:[];const c=[...l];c.splice(n,1);o.setProperty(s,c);if(d.onChange){d.onChange(true,h.replace(/^\//,""))}}});const w=[];const L=b.properties;const $=l.uiLayout;if($&&Array.isArray($)){$.forEach(e=>{if(e.type==="Control"&&e.scope){const{meta:o,bindingPath:r,propKey:n}=p.resolveScope({type:"object",properties:L},e.scope);if(!o){u.error(`[MetaUI] Property '${n}' not found in schema definitions for Table.`,"","TableLayout")}else{T.addColumn(new t({header:new a({text:e.label||o.ui?.label||n}),demandPopin:!o.ui?.isKey,minScreenWidth:o.ui?.isKey?"":"Tablet",popinDisplay:"Inline"}));const s={...o};if(e.widget){s.ui={...o.ui,widget:e.widget}}const i=d.generateField(s,r,f||"meta",true);w.push(i)}}else{u.warn(`[MetaUI] Unsupported layout element type '${e.type}' in Table.`,"","TableLayout")}})}else{u.debug("[MetaUI TableLayout]","No uiLayout provided. Falling back to rendering all properties as columns.","TableLayout");Object.keys(L).forEach(e=>{try{const o=L[e];const r=!!o.ui?.isKey;const n=new t({header:new a({text:o.ui?.label||e}),demandPopin:!r,minScreenWidth:r?"":"Tablet",popinDisplay:"Inline"});T.addColumn(n);const s=d.generateField(o,e,f||"meta",true);w.push(s)}catch(t){const o=t.message;u.error(`[MetaUI] Failed to render fallback column ${e}`,o,"TableLayout");u.showErrorPopup(`Failed to render fallback table column '${e}'.\n\nDetails: ${o}`);w.push(new a({text:"Error"}))}})}const I=new o({cells:w});T.bindItems({path:h,model:f,template:I,templateShareable:false});return T}}var m={__esModule:true};m.TableLayout=d;return m});
|
|
2
2
|
//# sourceMappingURL=TableLayout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableLayout.js","names":["SchemaNormalizer","___core_SchemaNormalizer","Logger","___utils_Logger","TableLayout","render","schema","modelName","engine","onSubmit","bindingPath","itemsSchema","items","properties","ui","widget","$ref","debug","host","getSchemaDefinition","resolved","Object","keys","error","getMetadata","getName","type","Error","tableTitle","title","actualModelName","actualPath","table","Table","headerToolbar","Toolbar","content","Title","text","ToolbarSpacer","isEditable","Button","icon","press","oEvent","btn","getSource","tbl","getParent","model","getModel","info","getBindingInfo","path","rawData","getProperty","data","Array","isArray","newData","setProperty","onChange","replace","fixedLayout","mode","delete","item","getParameter","getBindingContext","getPath","splitPaths","split","index","parseInt","pop","arrayPath","join","splice","templateCells","props","layoutElements","uiLayout","forEach","element","scope","meta","fieldMeta","propKey","resolveScope","addColumn","Column","header","Text","label","demandPopin","isKey","minScreenWidth","popinDisplay","effectiveMeta","control","generateField","push","warn","key","column","msg","message","showErrorPopup","rowTemplate","ColumnListItem","cells","bindItems","template","templateShareable","__exports","__esModule"],"sources":["TableLayout.ts"],"sourcesContent":["/**\n * @file TableLayout.ts\n * @description Generates a responsive SAP Fiori Table layout for v2 schema.\n */\n\nimport Table from \"sap/m/Table\";\nimport Column from \"sap/m/Column\";\nimport Text from \"sap/m/Text\";\nimport ColumnListItem from \"sap/m/ColumnListItem\";\nimport Toolbar from \"sap/m/Toolbar\";\nimport Title from \"sap/m/Title\";\nimport ToolbarSpacer from \"sap/m/ToolbarSpacer\";\nimport Button from \"sap/m/Button\";\nimport JSONModel from \"sap/ui/model/json/JSONModel\";\nimport Control from \"sap/ui/core/Control\";\nimport { IPropertyMetadata, ISchema, ILayoutElement } from \"../interfaces/ISchema\";\nimport { ILayoutManager } from \"../interfaces/ILayoutManager\";\nimport { Engine } from \"../core/Engine\";\nimport { SchemaNormalizer } from \"../core/SchemaNormalizer\";\nimport { Logger } from \"../utils/Logger\";\n\n/**\n * Layout Manager responsible for generating a responsive SAP Fiori Table.\n * It is automatically utilized by the Engine when the schema root or property is of type 'array'.\n * Includes built-in support for adding and deleting rows via dynamic data binding manipulation.\n * \n * @namespace nz.co.siliconst.ui5.metaui.layouts\n * @public\n */\nexport class TableLayout implements ILayoutManager {\n /**\n * Renders the JSON Schema array properties into a UI5 Table.\n * \n * @param schema The active JSON schema array definition.\n * @param modelName The UI5 JSONModel name used for data binding.\n * @param engine The central orchestrator for delegating column plugin generation.\n * @param onSubmit Optional submit hook.\n * @param bindingPath The JSON path representing the array within the payload.\n * @returns {Control} The generated sap.m.Table control.\n * @throws {Error} If the provided schema is not of type 'array'.\n */\n public render(schema: ISchema, modelName: string, engine: Engine, onSubmit?: () => void, bindingPath: string = \"/\"): Control {\n let itemsSchema = schema.items;\n if (itemsSchema && !itemsSchema.properties && itemsSchema.ui?.widget === \"reference\" && itemsSchema.$ref) {\n Logger.debug(`[MetaUI] TableLayout detecting reference widget for ${bindingPath}. Resolving ${itemsSchema.$ref}`, \"\", \"TableLayout\");\n if (engine.host && engine.host.getSchemaDefinition) {\n const resolved = engine.host.getSchemaDefinition(itemsSchema.$ref);\n Logger.debug(`[MetaUI] Resolved schema for ${itemsSchema.$ref}: ${!!resolved} ${resolved ? Object.keys(resolved) : \"\"}`, \"\", \"TableLayout\");\n if (resolved && resolved.properties) {\n itemsSchema = resolved;\n } else {\n Logger.error(`[MetaUI] TableLayout resolved schema but it has no properties!`, \"\", \"TableLayout\");\n }\n } else {\n Logger.error(`[MetaUI] TableLayout cannot resolve ${itemsSchema.$ref} because engine.host.getSchemaDefinition is missing! host: ${engine.host?.getMetadata().getName()}`, \"\", \"TableLayout\");\n }\n }\n\n if (schema.type !== \"array\" || !itemsSchema || !itemsSchema.properties) {\n Logger.error(`[MetaUI] TableLayout fatal error! schema.type: ${schema.type}, itemsSchema: ${!!itemsSchema}, properties: ${itemsSchema ? !!itemsSchema.properties : false}`, \"\", \"TableLayout\");\n throw new Error(\"[MetaUI] TableLayout requires an array schema with items.properties.\");\n }\n\n const tableTitle = schema.title || \"Table\";\n const actualModelName = modelName;\n const actualPath = bindingPath;\n\n const table = new Table({\n headerToolbar: new Toolbar({\n content: [\n new Title({ text: tableTitle }),\n new ToolbarSpacer(),\n ...(!engine.isEditable ? [] : [\n new Button({\n text: \"Add Row\",\n icon: \"sap-icon://add\",\n press: (oEvent: sap.ui.base.Event) => {\n const btn = oEvent.getSource();\n const tbl = btn.getParent().getParent() as Table;\n const model = tbl.getModel(actualModelName) as JSONModel;\n const info = tbl.getBindingInfo(\"items\");\n if (!info || !info.path) return;\n\n const rawData = model.getProperty(info.path);\n const data = Array.isArray(rawData) ? rawData : [];\n const newData = [...data, {}];\n model.setProperty(info.path, newData);\n\n // CRITICAL: Notify the engine so it extracts payload and triggers liveUpdate\n if (engine.onChange) {\n engine.onChange(true, actualPath.replace(/^\\//, \"\"));\n }\n }\n })\n ])\n ]\n }),\n fixedLayout: false,\n mode: !engine.isEditable ? \"None\" : \"Delete\",\n delete: (oEvent: sap.ui.base.Event) => {\n const item = oEvent.getParameter(\"listItem\");\n const path = item.getBindingContext(actualModelName).getPath();\n const model = item.getModel(actualModelName) as JSONModel;\n\n const splitPaths = path.split(\"/\");\n const index = parseInt(splitPaths.pop() || \"0\", 10);\n let arrayPath = splitPaths.join(\"/\");\n if (arrayPath === \"\") arrayPath = \"/\";\n\n const rawData = model.getProperty(arrayPath);\n const data = Array.isArray(rawData) ? rawData : [];\n const newData = [...data];\n newData.splice(index, 1);\n model.setProperty(arrayPath, newData);\n\n // CRITICAL: Notify the engine so it extracts payload and triggers liveUpdate\n if (engine.onChange) {\n engine.onChange(true, actualPath.replace(/^\\//, \"\"));\n }\n }\n });\n\n const templateCells: Control[] = [];\n const props = itemsSchema.properties;\n const layoutElements = schema.uiLayout;\n\n if (layoutElements && Array.isArray(layoutElements)) {\n // Only render columns defined in uiLayout\n layoutElements.forEach((element: ILayoutElement) => {\n if (element.type === \"Control\" && element.scope) {\n const { meta: fieldMeta, bindingPath, propKey } = SchemaNormalizer.resolveScope(\n { type: \"object\", properties: props } as ISchema, \n element.scope\n );\n \n if (!fieldMeta) {\n Logger.error(`[MetaUI] Property '${propKey}' not found in schema definitions for Table.`, \"\", \"TableLayout\");\n } else {\n // The architectural boundary: Table Layout orchestrates the columns and aggregation binding,\n // but delegates the actual cell rendering to the Engine's Field Plugins.\n table.addColumn(new Column({\n header: new Text({ text: element.label || fieldMeta.ui?.label || propKey }),\n demandPopin: !fieldMeta.ui?.isKey,\n minScreenWidth: fieldMeta.ui?.isKey ? \"\" : \"Tablet\",\n popinDisplay: \"Inline\"\n }));\n\n const effectiveMeta = { ...fieldMeta };\n if (element.widget) {\n effectiveMeta.ui = { ...fieldMeta.ui, widget: element.widget };\n }\n\n // We pass the activeModel as actualModelName down. But the path must be relative to the \n // table row binding context, so we just use the bindingPath (e.g. \"id\" or \"header/id\")\n const control = engine.generateField(effectiveMeta, bindingPath, actualModelName || \"meta\", true);\n templateCells.push(control);\n }\n } else {\n Logger.warn(`[MetaUI] Unsupported layout element type '${element.type}' in Table.`, \"\", \"TableLayout\");\n }\n });\n } else {\n Logger.debug(\"[MetaUI TableLayout]\", \"No uiLayout provided. Falling back to rendering all properties as columns.\", \"TableLayout\");\n // Fallback: If no uiLayout is provided, render all properties as columns\n Object.keys(props).forEach((key) => {\n try {\n const fieldMeta = props[key];\n const isKey = !!fieldMeta.ui?.isKey;\n\n const column = new Column({\n header: new Text({ text: fieldMeta.ui?.label || key }),\n demandPopin: !isKey,\n minScreenWidth: isKey ? \"\" : \"Tablet\",\n popinDisplay: \"Inline\"\n });\n table.addColumn(column);\n\n const control = engine.generateField(fieldMeta, key, actualModelName || \"meta\", true);\n templateCells.push(control);\n } catch (error) {\n const msg = (error as Error).message;\n Logger.error(`[MetaUI] Failed to render fallback column ${key}`, msg, \"TableLayout\");\n Logger.showErrorPopup(`Failed to render fallback table column '${key}'.\\n\\nDetails: ${msg}`);\n templateCells.push(new Text({ text: \"Error\" }));\n }\n });\n }\n\n\n\n const rowTemplate = new ColumnListItem({\n cells: templateCells\n });\n\n table.bindItems({\n path: actualPath,\n model: actualModelName,\n template: rowTemplate,\n templateShareable: false\n });\n\n return table;\n }\n}\n"],"mappings":"kPAkBSA,EAAgBC,EAAA,0BAChBC,EAAMC,EAAA,UAUR,MAAMC,EAYFC,OAAOC,EAAiBC,EAAmBC,EAAgBC,EAAuBC,EAAsB,KAC3G,IAAIC,EAAcL,EAAOM,MACzB,GAAID,IAAgBA,EAAYE,YAAcF,EAAYG,IAAIC,SAAW,aAAeJ,EAAYK,KAAM,CACtGd,EAAOe,MAAM,uDAAuDP,gBAA0BC,EAAYK,OAAQ,GAAI,eACtH,GAAIR,EAAOU,MAAQV,EAAOU,KAAKC,oBAAqB,CAChD,MAAMC,EAAWZ,EAAOU,KAAKC,oBAAoBR,EAAYK,MAC7Dd,EAAOe,MAAM,gCAAgCN,EAAYK,WAAWI,KAAYA,EAAWC,OAAOC,KAAKF,GAAY,KAAM,GAAI,eAC7H,GAAIA,GAAYA,EAASP,WAAY,CACjCF,EAAcS,CAClB,KAAO,C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,EAAcuB,KAAKF,EACvB,CACJ,KAAO,CACHjG,EAAOoG,KAAK,6CAA6CnB,EAAQzD,kBAAmB,GAAI,cAC5F,GAER,KAAO,CACHxB,EAAOe,MAAM,uBAAwB,6EAA8E,eAEnHI,OAAOC,KAAKyD,GAAOG,QAASqB,IACxB,IACI,MAAMjB,EAAYP,EAAMwB,GACxB,MAAMR,IAAUT,EAAUxE,IAAIiF,MAE9B,MAAMS,EAAS,IAAId,EAAO,CACtBC,OAAQ,IAAIC,EAAK,CAAEtD,KAAMgD,EAAUxE,IAAI+E,OAASU,IAChDT,aAAcC,EACdC,eAAgBD,EAAQ,GAAK,SAC7BE,aAAc,WAElBjE,EAAMyD,UAAUe,GAEhB,MAAML,EAAU3F,EAAO4F,cAAcd,EAAWiB,EAAKzE,GAAmB,OAAQ,MAChFgD,EAAcuB,KAAKF,EACvB,CAAE,MAAO5E,GACL,MAAMkF,EAAOlF,EAAgBmF,QAC7BxG,EAAOqB,MAAM,6CAA6CgF,IAAOE,EAAK,eACtEvG,EAAOyG,eAAe,2CAA2CJ,mBAAqBE,KACtF3B,EAAcuB,KAAK,IAAIT,EAAK,CAAEtD,KAAM,UACxC,GAER,CAIA,MAAMsE,EAAc,IAAIC,EAAe,CACnCC,MAAOhC,IAGX9C,EAAM+E,UAAU,CACZ1D,KAAMtB,EACNkB,MAAOnB,EACPkF,SAAUJ,EACVK,kBAAmB,QAGvB,OAAOjF,CACX,EACH,IAAAkF,EAAA,CAAAC,WAAA,MAAAD,EAAA9G,cAAA,OAAA8G,CAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"TableLayout.js","names":["SchemaNormalizer","___core_SchemaNormalizer","Logger","___utils_Logger","TableLayout","render","schema","modelName","engine","onSubmit","bindingPath","itemsSchema","items","properties","ui","widget","$ref","debug","host","getSchemaDefinition","resolved","Object","keys","error","getMetadata","getName","type","Error","tableTitle","title","actualModelName","actualPath","table","Table","headerToolbar","Toolbar","content","Title","text","ToolbarSpacer","isEditable","Button","icon","press","oEvent","btn","getSource","tbl","getParent","model","getModel","info","getBindingInfo","path","rawData","getProperty","data","Array","isArray","newData","setProperty","onChange","replace","fixedLayout","mode","delete","item","getParameter","getBindingContext","getPath","splitPaths","split","index","parseInt","pop","arrayPath","join","splice","templateCells","props","layoutElements","uiLayout","forEach","element","scope","meta","fieldMeta","propKey","resolveScope","addColumn","Column","header","Text","label","demandPopin","isKey","minScreenWidth","popinDisplay","effectiveMeta","control","generateField","push","warn","key","column","msg","message","showErrorPopup","rowTemplate","ColumnListItem","cells","bindItems","template","templateShareable","__exports","__esModule"],"sources":["TableLayout.ts"],"sourcesContent":["/**\n * @file TableLayout.ts\n * @description Generates a responsive SAP Fiori Table layout for v2 schema.\n */\n\nimport Table from \"sap/m/Table\";\nimport Column from \"sap/m/Column\";\nimport Text from \"sap/m/Text\";\nimport ColumnListItem from \"sap/m/ColumnListItem\";\nimport Toolbar from \"sap/m/Toolbar\";\nimport Title from \"sap/m/Title\";\nimport ToolbarSpacer from \"sap/m/ToolbarSpacer\";\nimport Button from \"sap/m/Button\";\nimport JSONModel from \"sap/ui/model/json/JSONModel\";\nimport Control from \"sap/ui/core/Control\";\nimport { IPropertyMetadata, ISchema, ILayoutElement } from \"../interfaces/ISchema\";\nimport { ILayoutManager } from \"../interfaces/ILayoutManager\";\nimport { Engine } from \"../core/Engine\";\nimport GeneratorHost from \"../controls/host/GeneratorHost\";\nimport { SchemaNormalizer } from \"../core/SchemaNormalizer\";\nimport { Logger } from \"../utils/Logger\";\n\n/**\n * Layout Manager responsible for generating a responsive SAP Fiori Table.\n * It is automatically utilized by the Engine when the schema root or property is of type 'array'.\n * Includes built-in support for adding and deleting rows via dynamic data binding manipulation.\n * \n * @namespace nz.co.siliconst.ui5.metaui.layouts\n * @public\n */\nexport class TableLayout implements ILayoutManager {\n /**\n * Renders the JSON Schema array properties into a UI5 Table.\n * \n * @param schema The active JSON schema array definition.\n * @param modelName The UI5 JSONModel name used for data binding.\n * @param engine The central orchestrator for delegating column plugin generation.\n * @param onSubmit Optional submit hook.\n * @param bindingPath The JSON path representing the array within the payload.\n * @returns {Control} The generated sap.m.Table control.\n * @throws {Error} If the provided schema is not of type 'array'.\n */\n public render(schema: ISchema, modelName: string, engine: Engine, onSubmit?: () => void, bindingPath: string = \"/\"): Control {\n let itemsSchema = schema.items;\n if (itemsSchema && !itemsSchema.properties && itemsSchema.ui?.widget === \"reference\" && itemsSchema.$ref) {\n Logger.debug(`[MetaUI] TableLayout detecting reference widget for ${bindingPath}. Resolving ${itemsSchema.$ref}`, \"\", \"TableLayout\");\n \n const host = engine.host as unknown as GeneratorHost;\n if (host && typeof host.getSchemaDefinition === \"function\") {\n const resolved = host.getSchemaDefinition(itemsSchema.$ref);\n Logger.debug(`[MetaUI] Resolved schema for ${itemsSchema.$ref}: ${!!resolved} ${resolved ? Object.keys(resolved) : \"\"}`, \"\", \"TableLayout\");\n if (resolved && resolved.properties) {\n itemsSchema = resolved;\n } else {\n Logger.error(`[MetaUI] TableLayout resolved schema but it has no properties!`, \"\", \"TableLayout\");\n }\n } else {\n Logger.error(`[MetaUI] TableLayout cannot resolve ${itemsSchema.$ref} because engine.host.getSchemaDefinition is missing! host: ${host?.getMetadata().getName()}`, \"\", \"TableLayout\");\n }\n }\n\n if (schema.type !== \"array\" || !itemsSchema || !itemsSchema.properties) {\n Logger.error(`[MetaUI] TableLayout fatal error! schema.type: ${schema.type}, itemsSchema: ${!!itemsSchema}, properties: ${itemsSchema ? !!itemsSchema.properties : false}`, \"\", \"TableLayout\");\n throw new Error(\"[MetaUI] TableLayout requires an array schema with items.properties.\");\n }\n\n const tableTitle = schema.title || \"Table\";\n const actualModelName = modelName;\n const actualPath = bindingPath;\n\n const table = new Table({\n headerToolbar: new Toolbar({\n content: [\n new Title({ text: tableTitle }),\n new ToolbarSpacer(),\n ...(!engine.isEditable ? [] : [\n new Button({\n text: \"Add Row\",\n icon: \"sap-icon://add\",\n press: (oEvent: sap.ui.base.Event) => {\n const btn = oEvent.getSource() as Button;\n const tbl = btn.getParent()?.getParent() as Table;\n const model = tbl.getModel(actualModelName) as JSONModel;\n const info = tbl.getBindingInfo(\"items\");\n if (!info || !info.path) return;\n\n const rawData = model.getProperty(info.path);\n const data = Array.isArray(rawData) ? rawData : [];\n const newData = [...data, {}];\n model.setProperty(info.path, newData);\n\n // CRITICAL: Notify the engine so it extracts payload and triggers liveUpdate\n if (engine.onChange) {\n engine.onChange(true, actualPath.replace(/^\\//, \"\"));\n }\n }\n })\n ])\n ]\n }),\n fixedLayout: false,\n mode: !engine.isEditable ? \"None\" : \"Delete\",\n delete: (oEvent: sap.ui.base.Event) => {\n const item = oEvent.getParameter(\"listItem\") as ColumnListItem;\n const path = item.getBindingContext(actualModelName)?.getPath();\n if (!path) return;\n const model = item.getModel(actualModelName) as JSONModel;\n\n const splitPaths = path.split(\"/\");\n const index = parseInt(splitPaths.pop() || \"0\", 10);\n let arrayPath = splitPaths.join(\"/\");\n if (arrayPath === \"\") arrayPath = \"/\";\n\n const rawData = model.getProperty(arrayPath);\n const data = Array.isArray(rawData) ? rawData : [];\n const newData = [...data];\n newData.splice(index, 1);\n model.setProperty(arrayPath, newData);\n\n // CRITICAL: Notify the engine so it extracts payload and triggers liveUpdate\n if (engine.onChange) {\n engine.onChange(true, actualPath.replace(/^\\//, \"\"));\n }\n }\n });\n\n const templateCells: Control[] = [];\n const props = itemsSchema.properties;\n const layoutElements = schema.uiLayout;\n\n if (layoutElements && Array.isArray(layoutElements)) {\n // Only render columns defined in uiLayout\n layoutElements.forEach((element: ILayoutElement) => {\n if (element.type === \"Control\" && element.scope) {\n const { meta: fieldMeta, bindingPath, propKey } = SchemaNormalizer.resolveScope(\n { type: \"object\", properties: props } as ISchema, \n element.scope\n );\n \n if (!fieldMeta) {\n Logger.error(`[MetaUI] Property '${propKey}' not found in schema definitions for Table.`, \"\", \"TableLayout\");\n } else {\n // The architectural boundary: Table Layout orchestrates the columns and aggregation binding,\n // but delegates the actual cell rendering to the Engine's Field Plugins.\n table.addColumn(new Column({\n header: new Text({ text: element.label || fieldMeta.ui?.label || propKey }),\n demandPopin: !fieldMeta.ui?.isKey,\n minScreenWidth: fieldMeta.ui?.isKey ? \"\" : \"Tablet\",\n popinDisplay: \"Inline\"\n }));\n\n const effectiveMeta = { ...fieldMeta };\n if (element.widget) {\n effectiveMeta.ui = { ...fieldMeta.ui, widget: element.widget };\n }\n\n // We pass the activeModel as actualModelName down. But the path must be relative to the \n // table row binding context, so we just use the bindingPath (e.g. \"id\" or \"header/id\")\n const control = engine.generateField(effectiveMeta, bindingPath, actualModelName || \"meta\", true);\n templateCells.push(control);\n }\n } else {\n Logger.warn(`[MetaUI] Unsupported layout element type '${element.type}' in Table.`, \"\", \"TableLayout\");\n }\n });\n } else {\n Logger.debug(\"[MetaUI TableLayout]\", \"No uiLayout provided. Falling back to rendering all properties as columns.\", \"TableLayout\");\n // Fallback: If no uiLayout is provided, render all properties as columns\n Object.keys(props).forEach((key) => {\n try {\n const fieldMeta = props[key];\n const isKey = !!fieldMeta.ui?.isKey;\n\n const column = new Column({\n header: new Text({ text: fieldMeta.ui?.label || key }),\n demandPopin: !isKey,\n minScreenWidth: isKey ? \"\" : \"Tablet\",\n popinDisplay: \"Inline\"\n });\n table.addColumn(column);\n\n const control = engine.generateField(fieldMeta, key, actualModelName || \"meta\", true);\n templateCells.push(control);\n } catch (error) {\n const msg = (error as Error).message;\n Logger.error(`[MetaUI] Failed to render fallback column ${key}`, msg, \"TableLayout\");\n Logger.showErrorPopup(`Failed to render fallback table column '${key}'.\\n\\nDetails: ${msg}`);\n templateCells.push(new Text({ text: \"Error\" }));\n }\n });\n }\n\n\n\n const rowTemplate = new ColumnListItem({\n cells: templateCells\n });\n\n table.bindItems({\n path: actualPath,\n model: actualModelName,\n template: rowTemplate,\n templateShareable: false\n });\n\n return table;\n }\n}\n"],"mappings":"kPAmBSA,EAAgBC,EAAA,0BAChBC,EAAMC,EAAA,UAUR,MAAMC,EAYFC,OAAOC,EAAiBC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Ac,IAAIC,EAAe,CACnCC,MAAOhC,IAGX9C,EAAM+E,UAAU,CACZ1D,KAAMtB,EACNkB,MAAOnB,EACPkF,SAAUJ,EACVK,kBAAmB,QAGvB,OAAOjF,CACX,EACH,IAAAkF,EAAA,CAAAC,WAAA,MAAAD,EAAA9G,cAAA,OAAA8G,CAAA","ignoreList":[]}
|
|
@@ -16,6 +16,7 @@ import Control from "sap/ui/core/Control";
|
|
|
16
16
|
import { IPropertyMetadata, ISchema, ILayoutElement } from "../interfaces/ISchema";
|
|
17
17
|
import { ILayoutManager } from "../interfaces/ILayoutManager";
|
|
18
18
|
import { Engine } from "../core/Engine";
|
|
19
|
+
import GeneratorHost from "../controls/host/GeneratorHost";
|
|
19
20
|
import { SchemaNormalizer } from "../core/SchemaNormalizer";
|
|
20
21
|
import { Logger } from "../utils/Logger";
|
|
21
22
|
|
|
@@ -43,8 +44,10 @@ export class TableLayout implements ILayoutManager {
|
|
|
43
44
|
let itemsSchema = schema.items;
|
|
44
45
|
if (itemsSchema && !itemsSchema.properties && itemsSchema.ui?.widget === "reference" && itemsSchema.$ref) {
|
|
45
46
|
Logger.debug(`[MetaUI] TableLayout detecting reference widget for ${bindingPath}. Resolving ${itemsSchema.$ref}`, "", "TableLayout");
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
|
|
48
|
+
const host = engine.host as unknown as GeneratorHost;
|
|
49
|
+
if (host && typeof host.getSchemaDefinition === "function") {
|
|
50
|
+
const resolved = host.getSchemaDefinition(itemsSchema.$ref);
|
|
48
51
|
Logger.debug(`[MetaUI] Resolved schema for ${itemsSchema.$ref}: ${!!resolved} ${resolved ? Object.keys(resolved) : ""}`, "", "TableLayout");
|
|
49
52
|
if (resolved && resolved.properties) {
|
|
50
53
|
itemsSchema = resolved;
|
|
@@ -52,7 +55,7 @@ export class TableLayout implements ILayoutManager {
|
|
|
52
55
|
Logger.error(`[MetaUI] TableLayout resolved schema but it has no properties!`, "", "TableLayout");
|
|
53
56
|
}
|
|
54
57
|
} else {
|
|
55
|
-
Logger.error(`[MetaUI] TableLayout cannot resolve ${itemsSchema.$ref} because engine.host.getSchemaDefinition is missing! host: ${
|
|
58
|
+
Logger.error(`[MetaUI] TableLayout cannot resolve ${itemsSchema.$ref} because engine.host.getSchemaDefinition is missing! host: ${host?.getMetadata().getName()}`, "", "TableLayout");
|
|
56
59
|
}
|
|
57
60
|
}
|
|
58
61
|
|
|
@@ -75,8 +78,8 @@ export class TableLayout implements ILayoutManager {
|
|
|
75
78
|
text: "Add Row",
|
|
76
79
|
icon: "sap-icon://add",
|
|
77
80
|
press: (oEvent: sap.ui.base.Event) => {
|
|
78
|
-
const btn = oEvent.getSource();
|
|
79
|
-
const tbl = btn.getParent()
|
|
81
|
+
const btn = oEvent.getSource() as Button;
|
|
82
|
+
const tbl = btn.getParent()?.getParent() as Table;
|
|
80
83
|
const model = tbl.getModel(actualModelName) as JSONModel;
|
|
81
84
|
const info = tbl.getBindingInfo("items");
|
|
82
85
|
if (!info || !info.path) return;
|
|
@@ -98,8 +101,9 @@ export class TableLayout implements ILayoutManager {
|
|
|
98
101
|
fixedLayout: false,
|
|
99
102
|
mode: !engine.isEditable ? "None" : "Delete",
|
|
100
103
|
delete: (oEvent: sap.ui.base.Event) => {
|
|
101
|
-
const item = oEvent.getParameter("listItem");
|
|
102
|
-
const path = item.getBindingContext(actualModelName)
|
|
104
|
+
const item = oEvent.getParameter("listItem") as ColumnListItem;
|
|
105
|
+
const path = item.getBindingContext(actualModelName)?.getPath();
|
|
106
|
+
if (!path) return;
|
|
103
107
|
const model = item.getModel(actualModelName) as JSONModel;
|
|
104
108
|
|
|
105
109
|
const splitPaths = path.split("/");
|