@siliconst/metaui 1.4.9 → 1.4.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -178
- package/package.json +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost-dbg.js +56 -8
- 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 +27 -3
- 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 +52 -9
- package/src/nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost-dbg.js +132 -18
- 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 +14 -9
- 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 +117 -18
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/DataSyncDelegate-dbg.js +1 -3
- 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.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 +1 -3
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/DialogDelegate-dbg.js +9 -6
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/DialogDelegate-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/DialogDelegate.d.ts +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/DialogDelegate.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/DialogDelegate.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/DialogDelegate.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/DialogDelegate.ts +9 -6
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ValidationDelegate-dbg.js +56 -49
- 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 +9 -4
- 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 +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 +67 -50
- package/src/nz/co/siliconst/ui5/metaui/core/ConditionEngine-dbg.js +0 -2
- package/src/nz/co/siliconst/ui5/metaui/core/ConditionEngine-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/ConditionEngine.d.ts +0 -2
- package/src/nz/co/siliconst/ui5/metaui/core/ConditionEngine.d.ts.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 +0 -3
- package/src/nz/co/siliconst/ui5/metaui/core/DefaultLayoutGenerator-dbg.js +4 -6
- package/src/nz/co/siliconst/ui5/metaui/core/DefaultLayoutGenerator-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/DefaultLayoutGenerator.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/DefaultLayoutGenerator.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/DefaultLayoutGenerator.ts +4 -4
- package/src/nz/co/siliconst/ui5/metaui/core/Engine-dbg.js +36 -9
- 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 +18 -2
- package/src/nz/co/siliconst/ui5/metaui/core/Engine.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/Engine.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/Engine.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/Engine.ts +39 -5
- package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry-dbg.js +19 -2
- 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 +9 -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 +21 -7
- package/src/nz/co/siliconst/ui5/metaui/core/Registry-dbg.js +3 -1
- package/src/nz/co/siliconst/ui5/metaui/core/Registry-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/Registry.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/Registry.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/Registry.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/Registry.ts +3 -1
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer-dbg.js +54 -34
- 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 +3 -1
- 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 +55 -34
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaValidator-dbg.js +7 -6
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaValidator-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaValidator.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaValidator.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaValidator.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaValidator.ts +7 -6
- package/src/nz/co/siliconst/ui5/metaui/core/StateManager-dbg.js +40 -11
- package/src/nz/co/siliconst/ui5/metaui/core/StateManager-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/StateManager.d.ts +6 -1
- package/src/nz/co/siliconst/ui5/metaui/core/StateManager.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/StateManager.js +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 +39 -13
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IPlugin.d.ts +13 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IPlugin.ts +15 -0
- 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 +1 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchema.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchema.ts +1 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout-dbg.js +10 -0
- 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 +10 -0
- package/src/nz/co/siliconst/ui5/metaui/library-dbg.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/library-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/library-preload.js +44 -43
- package/src/nz/co/siliconst/ui5/metaui/library-preload.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/library.d.ts +1 -0
- package/src/nz/co/siliconst/ui5/metaui/library.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/library.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/library.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/library.ts +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/ArrayPlugin-dbg.js +6 -0
- 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 +6 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BarcodeScannerPlugin-dbg.js +2 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BarcodeScannerPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BarcodeScannerPlugin.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 +77 -1
- 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 +17 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BasePlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BasePlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BasePlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BasePlugin.ts +67 -7
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BooleanPlugin-dbg.js +1 -1
- 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 +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 +1 -1
- 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 +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/CodeEditorPlugin-dbg.js +10 -3
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/CodeEditorPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/CodeEditorPlugin.d.ts.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 +10 -3
- 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 +1 -1
- 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 +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/DropdownPlugin-dbg.js +1 -1
- 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 +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/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 +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/GeolocationPlugin-dbg.js +1 -1
- 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 +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MultiInputPlugin-dbg.js +130 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MultiInputPlugin-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MultiInputPlugin.d.ts +39 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MultiInputPlugin.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MultiInputPlugin.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MultiInputPlugin.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MultiInputPlugin.ts +127 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MultiSelectPlugin-dbg.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MultiSelectPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MultiSelectPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MultiSelectPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/MultiSelectPlugin.ts +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/NumberPlugin-dbg.js +2 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/NumberPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/NumberPlugin.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 +2 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/ObjectPlugin-dbg.js +6 -0
- 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 +6 -0
- 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 +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/RichTextPlugin-dbg.js +1 -1
- 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 +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SignaturePlugin-dbg.js +1 -1
- 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 +1 -1
- 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/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/SwitchPlugin-dbg.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SwitchPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SwitchPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SwitchPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/SwitchPlugin.ts +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/TextAreaPlugin-dbg.js +40 -4
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/TextAreaPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/TextAreaPlugin.d.ts +4 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/TextAreaPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/TextAreaPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/TextAreaPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/TextAreaPlugin.ts +41 -3
- 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 +1 -1
- 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 +1 -1
- 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.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/datasources/LiveSearchPlugin.ts +1 -1
- 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.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/datasources/RemoteValueHelpPlugin.ts +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/formatters/CurrencyFormatterPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/formatters/CurrencyFormatterPlugin.d.ts +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/formatters/CurrencyFormatterPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/formatters/CurrencyFormatterPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/formatters/CurrencyFormatterPlugin.ts +2 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/formatters/DateFormatterPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/formatters/DateFormatterPlugin.d.ts +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/formatters/DateFormatterPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/formatters/DateFormatterPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/formatters/DateFormatterPlugin.ts +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/formatters/PhoneFormatterPlugin-dbg.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/formatters/PhoneFormatterPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/formatters/PhoneFormatterPlugin.d.ts +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/formatters/PhoneFormatterPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/formatters/PhoneFormatterPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/formatters/PhoneFormatterPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/formatters/PhoneFormatterPlugin.ts +2 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/formatters/TextCaseFormatterPlugin-dbg.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/formatters/TextCaseFormatterPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/formatters/TextCaseFormatterPlugin.d.ts +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/formatters/TextCaseFormatterPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/formatters/TextCaseFormatterPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/formatters/TextCaseFormatterPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/formatters/TextCaseFormatterPlugin.ts +2 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/EmailValidatorPlugin-dbg.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/EmailValidatorPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/EmailValidatorPlugin.d.ts +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/EmailValidatorPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/EmailValidatorPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/EmailValidatorPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/EmailValidatorPlugin.ts +3 -3
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/IbanValidatorPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/IbanValidatorPlugin.d.ts +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/IbanValidatorPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/IbanValidatorPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/IbanValidatorPlugin.ts +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/MinLengthValidatorPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/MinLengthValidatorPlugin.d.ts +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/MinLengthValidatorPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/MinLengthValidatorPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/MinLengthValidatorPlugin.ts +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/PatternValidatorPlugin-dbg.js +2 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/PatternValidatorPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/PatternValidatorPlugin.d.ts +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/PatternValidatorPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/PatternValidatorPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/PatternValidatorPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/PatternValidatorPlugin.ts +4 -4
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/RangeValidatorPlugin-dbg.js +3 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/RangeValidatorPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/RangeValidatorPlugin.d.ts +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/RangeValidatorPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/RangeValidatorPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/RangeValidatorPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/RangeValidatorPlugin.ts +4 -3
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/UrlValidatorPlugin-dbg.js +3 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/UrlValidatorPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/UrlValidatorPlugin.d.ts +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/UrlValidatorPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/UrlValidatorPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/UrlValidatorPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/validators/UrlValidatorPlugin.ts +4 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SwitchPlugin.js","names":["BasePlugin","___BasePlugin","SwitchPlugin","render","fieldMetadata","bindingPath","modelName","engineScopeId","onChange","this","metadata","isEditable","control","TextControl","id","generateStableId","text","path","formatter","val","applyCommonDirectives","Switch","state","enabled","ui","readOnly","change","oEvent","getParameter","result","
|
|
1
|
+
{"version":3,"file":"SwitchPlugin.js","names":["BasePlugin","___BasePlugin","SwitchPlugin","render","fieldMetadata","bindingPath","modelName","engineScopeId","onChange","this","metadata","isEditable","control","TextControl","id","generateStableId","text","path","formatter","val","applyCommonDirectives","Switch","state","enabled","ui","readOnly","change","oEvent","getParameter","result","validateAndApplyVisualState","isValid","fieldKey","getValue","getState","applyState","sw","setEnabled","__exports","__esModule"],"sources":["SwitchPlugin.ts"],"sourcesContent":["/**\n * @file SwitchPlugin.ts\n * @description Renders a sap.m.Switch for boolean data specifically marked with the switch widget.\n */\n\nimport { BasePlugin } from \"./BasePlugin\";\nimport { IPropertyMetadata } from \"../../interfaces/ISchema\";\nimport Switch from \"sap/m/Switch\";\nimport Control from \"sap/ui/core/Control\";\nimport TextControl from \"sap/m/Text\";\n\n/**\n * Handles rendering logic for toggleable boolean switches.\n */\nexport class SwitchPlugin extends BasePlugin {\n /**\n * Renders a `sap.m.Switch` component.\n * \n * @param fieldMetadata The specific JSON schema properties for this field.\n * @param bindingPath The JSON path bound to this control.\n * @param modelName The UI5 JSONModel name.\n * @param engineScopeId The deterministic scope ID.\n * @param onChange The callback fired on value change.\n * @returns {Control} The configured Switch control.\n */\n public render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName: string = \"meta\", engineScopeId?: string, onChange?: (isValid: boolean, fieldKey?: string) => void): Control {\n this.onChange = onChange;\n this.metadata = fieldMetadata;\n\n if (!this.isEditable) {\n \n this.control = new TextControl({\n id: this.generateStableId(engineScopeId, bindingPath),\n text: {\n path: `${modelName}>${bindingPath}`,\n formatter: (val: boolean) => val ? \"Yes\" : \"No\"\n }\n });\n this.applyCommonDirectives(this.control, fieldMetadata, modelName);\n return this.control as Control;\n }\n\n this.control = new Switch({\n id: this.generateStableId(engineScopeId, bindingPath),\n state: `{${modelName}>${bindingPath}}`,\n enabled: !fieldMetadata.ui?.readOnly,\n change: (oEvent: sap.ui.base.Event) => {\n const val = (oEvent as sap.ui.base.Event).getParameter(\"state\");\n const result = this.validateAndApplyVisualState();\n if (this.onChange) {\n this.onChange(result.isValid, this.fieldKey);\n }\n }\n });\n\n this.applyCommonDirectives(this.control, fieldMetadata, modelName);\n\n return this.control as Control;\n }\n\n /**\n * Retrieves the current switch state.\n * @returns {unknown} The boolean state.\n */\n protected getValue(): unknown {\n return this.control ? (this.control as Switch).getState() : false;\n }\n\n /**\n * Applies dynamic read-only state.\n */\n protected applyState(): void {\n if (this.control && this.metadata) {\n if (!this.isEditable) return;\n const sw = this.control as Switch;\n sw.setEnabled(!this.metadata.ui?.readOnly);\n }\n }\n}\n"],"mappings":"wFAAA,MAKSA,EAAUC,EAAA,cASZ,MAAMC,UAAqBF,EAWvBG,OAAOC,EAAmCC,EAAsBC,EAAoB,OAAQC,EAAwBC,GACvHC,KAAKD,SAAWA,EAChBC,KAAKC,SAAWN,EAEhB,IAAKK,KAAKE,WAAY,CAElBF,KAAKG,QAAU,IAAIC,EAAY,CAC3BC,GAAIL,KAAKM,iBAAiBR,EAAeF,GACzCW,KAAM,CACFC,KAAM,GAAGX,KAAaD,IACtBa,UAAYC,GAAiBA,EAAM,MAAQ,QAGnDV,KAAKW,sBAAsBX,KAAKG,QAASR,EAAeE,GACxD,OAAOG,KAAKG,OAChB,CAEAH,KAAKG,QAAU,IAAIS,EAAO,CACtBP,GAAIL,KAAKM,iBAAiBR,EAAeF,GACzCiB,MAAO,IAAIhB,KAAaD,KACxBkB,SAAUnB,EAAcoB,IAAIC,SAC5BC,OAASC,IACL,MAAMR,EAAOQ,EAA6BC,aAAa,SACvD,MAAMC,EAASpB,KAAKqB,8BACpB,GAAIrB,KAAKD,SAAU,CACfC,KAAKD,SAASqB,EAAOE,QAAStB,KAAKuB,SACvC,KAIRvB,KAAKW,sBAAsBX,KAAKG,QAASR,EAAeE,GAExD,OAAOG,KAAKG,OAChB,CAMUqB,WACN,OAAOxB,KAAKG,QAAWH,KAAKG,QAAmBsB,WAAa,KAChE,CAKUC,aACN,GAAI1B,KAAKG,SAAWH,KAAKC,SAAU,CAC/B,IAAKD,KAAKE,WAAY,OACtB,MAAMyB,EAAK3B,KAAKG,QAChBwB,EAAGC,YAAY5B,KAAKC,SAASc,IAAIC,SACrC,CACJ,EACH,IAAAa,EAAA,CAAAC,WAAA,MAAAD,EAAApC,eAAA,OAAAoC,CAAA","ignoreList":[]}
|
|
@@ -46,7 +46,7 @@ export class SwitchPlugin extends BasePlugin {
|
|
|
46
46
|
enabled: !fieldMetadata.ui?.readOnly,
|
|
47
47
|
change: (oEvent: sap.ui.base.Event) => {
|
|
48
48
|
const val = (oEvent as sap.ui.base.Event).getParameter("state");
|
|
49
|
-
const result = this.
|
|
49
|
+
const result = this.validateAndApplyVisualState();
|
|
50
50
|
if (this.onChange) {
|
|
51
51
|
this.onChange(result.isValid, this.fieldKey);
|
|
52
52
|
}
|
|
@@ -38,20 +38,56 @@ sap.ui.define(["./BasePlugin", "sap/m/TextArea", "sap/m/Text"], function (___Bas
|
|
|
38
38
|
value: `{${modelName}>${bindingPath}}`,
|
|
39
39
|
maxLength: fieldMetadata.maxLength || 0,
|
|
40
40
|
required: !!fieldMetadata.required,
|
|
41
|
-
rows:
|
|
42
|
-
//
|
|
41
|
+
rows: 3,
|
|
42
|
+
// Start with at least 3 lines
|
|
43
|
+
growing: false,
|
|
44
|
+
// We manage height manually to maintain the +2 lines requirement
|
|
43
45
|
change: oEvent => {
|
|
44
|
-
|
|
45
|
-
const result = this.
|
|
46
|
+
this.updateHeight(oEvent.getSource());
|
|
47
|
+
const result = this.validateAndApplyVisualState();
|
|
46
48
|
if (this.onChange) {
|
|
47
49
|
this.onChange(result.isValid, this.fieldKey);
|
|
48
50
|
}
|
|
51
|
+
},
|
|
52
|
+
liveChange: oEvent => {
|
|
53
|
+
this.updateHeight(oEvent.getSource());
|
|
49
54
|
}
|
|
50
55
|
});
|
|
56
|
+
|
|
57
|
+
// Clean architecture: Wait for the model context, then calculate initial height
|
|
58
|
+
this.control.attachEventOnce("modelContextChange", () => {
|
|
59
|
+
const oBinding = this.control.getBinding("value");
|
|
60
|
+
const initLogic = () => {
|
|
61
|
+
if (this.control) {
|
|
62
|
+
this.updateHeight(this.control);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
if (oBinding) {
|
|
66
|
+
oBinding.attachChange(initLogic);
|
|
67
|
+
}
|
|
68
|
+
// Execute immediately in case the model is synchronous (JSONModel)
|
|
69
|
+
initLogic();
|
|
70
|
+
});
|
|
51
71
|
this.applyCommonDirectives(this.control, fieldMetadata, modelName);
|
|
52
72
|
return this.control;
|
|
53
73
|
}
|
|
54
74
|
|
|
75
|
+
/**
|
|
76
|
+
* Dynamically sets the rows to the content length + 2
|
|
77
|
+
*/
|
|
78
|
+
updateHeight(oTextArea) {
|
|
79
|
+
const val = oTextArea.getValue() || "";
|
|
80
|
+
// Count actual newlines in the string
|
|
81
|
+
const numLines = val.split(/\r\n|\r|\n/).length;
|
|
82
|
+
// Also estimate word wrapping if they type a really long single line without pressing enter
|
|
83
|
+
// A standard character width approximation, assuming ~80 chars per line for full width
|
|
84
|
+
const wrappedLines = Math.ceil(val.length / 80);
|
|
85
|
+
const totalLines = Math.max(numLines, wrappedLines);
|
|
86
|
+
|
|
87
|
+
// Ensure there is always 2 lines of extra breathing room
|
|
88
|
+
oTextArea.setRows(Math.max(3, totalLines + 2));
|
|
89
|
+
}
|
|
90
|
+
|
|
55
91
|
/**
|
|
56
92
|
* Retrieves the current text string.
|
|
57
93
|
* @returns {unknown} The text string.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextAreaPlugin-dbg.js","names":["BasePlugin","___BasePlugin","TextAreaPlugin","render","fieldMetadata","bindingPath","modelName","engineScopeId","onChange","metadata","fieldKey","replace","isEditable","control","TextControl","id","generateStableId","text","applyCommonDirectives","TextArea","value","maxLength","required","rows","
|
|
1
|
+
{"version":3,"file":"TextAreaPlugin-dbg.js","names":["BasePlugin","___BasePlugin","TextAreaPlugin","render","fieldMetadata","bindingPath","modelName","engineScopeId","onChange","metadata","fieldKey","replace","isEditable","control","TextControl","id","generateStableId","text","applyCommonDirectives","TextArea","value","maxLength","required","rows","growing","change","oEvent","updateHeight","getSource","result","validateAndApplyVisualState","isValid","liveChange","attachEventOnce","oBinding","getBinding","initLogic","attachChange","oTextArea","val","getValue","numLines","split","length","wrappedLines","Math","ceil","totalLines","max","setRows","applyState","input","setEditable","ui","readOnly","setRequired","__exports","__esModule"],"sources":["TextAreaPlugin.ts"],"sourcesContent":["/**\n * @file TextAreaPlugin.ts\n * @description Renders a sap.m.TextArea for string data specifically marked with the textArea widget.\n */\n\nimport { BasePlugin } from \"./BasePlugin\";\nimport { IPropertyMetadata } from \"../../interfaces/ISchema\";\nimport TextArea from \"sap/m/TextArea\";\nimport Control from \"sap/ui/core/Control\";\nimport TextControl from \"sap/m/Text\";\n\n/**\n * Handles rendering and logic for multi-line text areas.\n */\nexport class TextAreaPlugin extends BasePlugin {\n /**\n * Renders a `sap.m.TextArea` component.\n * \n * @param fieldMetadata The specific JSON schema properties for this field.\n * @param bindingPath The JSON path bound to this control.\n * @param modelName The UI5 JSONModel name.\n * @param engineScopeId The deterministic scope ID.\n * @param onChange The callback fired on value change.\n * @returns {Control} The configured TextArea control.\n */\n public render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName: string = \"meta\", engineScopeId?: string, onChange?: (isValid: boolean, fieldKey?: string) => void): Control {\n this.onChange = onChange;\n this.metadata = fieldMetadata;\n this.fieldKey = bindingPath.replace(\"/\", \"\"); // For EventBus\n \n if (!this.isEditable) {\n \n this.control = new TextControl({\n id: this.generateStableId(engineScopeId, bindingPath),\n text: `{${modelName}>${bindingPath}}`\n });\n this.applyCommonDirectives(this.control, fieldMetadata, modelName);\n return this.control as Control;\n }\n\n this.control = new TextArea({\n id: this.generateStableId(engineScopeId, bindingPath),\n value: `{${modelName}>${bindingPath}}`,\n maxLength: fieldMetadata.maxLength || 0,\n required: !!fieldMetadata.required,\n rows: 3, // Start with at least 3 lines\n growing: false, // We manage height manually to maintain the +2 lines requirement\n change: (oEvent: sap.ui.base.Event) => {\n this.updateHeight(oEvent.getSource() as TextArea);\n const result = this.validateAndApplyVisualState();\n if (this.onChange) {\n this.onChange(result.isValid, this.fieldKey);\n }\n },\n liveChange: (oEvent: sap.ui.base.Event) => {\n this.updateHeight(oEvent.getSource() as TextArea);\n }\n });\n\n // Clean architecture: Wait for the model context, then calculate initial height\n (this.control as TextArea).attachEventOnce(\"modelContextChange\", () => {\n const oBinding = (this.control as TextArea).getBinding(\"value\");\n \n const initLogic = () => {\n if (this.control) {\n this.updateHeight(this.control as TextArea);\n }\n };\n\n if (oBinding) {\n oBinding.attachChange(initLogic);\n }\n // Execute immediately in case the model is synchronous (JSONModel)\n initLogic();\n });\n\n this.applyCommonDirectives(this.control, fieldMetadata, modelName);\n\n return this.control as Control;\n }\n\n /**\n * Dynamically sets the rows to the content length + 2\n */\n private updateHeight(oTextArea: TextArea): void {\n const val = oTextArea.getValue() || \"\";\n // Count actual newlines in the string\n const numLines = val.split(/\\r\\n|\\r|\\n/).length;\n // Also estimate word wrapping if they type a really long single line without pressing enter\n // A standard character width approximation, assuming ~80 chars per line for full width\n const wrappedLines = Math.ceil(val.length / 80);\n \n const totalLines = Math.max(numLines, wrappedLines);\n \n // Ensure there is always 2 lines of extra breathing room\n oTextArea.setRows(Math.max(3, totalLines + 2));\n }\n\n /**\n * Retrieves the current text string.\n * @returns {unknown} The text string.\n */\n protected getValue(): unknown {\n return this.control ? (this.control as TextArea).getValue() : null;\n }\n\n /**\n * Applies dynamic read-only state.\n */\n protected applyState(): void {\n if (this.control && this.metadata) {\n if (!this.isEditable) return;\n const input = this.control as TextArea;\n input.setEditable(!this.metadata.ui?.readOnly);\n input.setRequired(this.metadata.required);\n }\n }\n}\n"],"mappings":";;;EAAA;AACA;AACA;AACA;EAHA,MAKSA,UAAU,GAAAC,aAAA;EAMnB;AACA;AACA;EACO,MAAMC,cAAc,SAASF,UAAU,CAAC;IAC3C;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACWG,MAAMA,CAACC,aAAgC,EAAGC,WAAmB,EAAGC,SAAiB,GAAG,MAAM,EAAEC,aAAsB,EAAEC,QAAwD,EAAW;MAC1L,IAAI,CAACA,QAAQ,GAAGA,QAAQ;MACxB,IAAI,CAACC,QAAQ,GAAGL,aAAa;MAC7B,IAAI,CAACM,QAAQ,GAAGL,WAAW,CAACM,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC;;MAE9C,IAAI,CAAC,IAAI,CAACC,UAAU,EAAE;QAElB,IAAI,CAACC,OAAO,GAAG,IAAIC,WAAW,CAAC;UAC3BC,EAAE,EAAE,IAAI,CAACC,gBAAgB,CAACT,aAAa,E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C,IAAI,CAAC9C,QAAQ,CAACa,QAAQ,CAAC;MAC7C;IACJ;EACJ;EAAC,IAAAkC,SAAA;IAAAC,UAAA;EAAA;EAAAD,SAAA,CAAAtD,cAAA,GAAAA,cAAA;EAAA,OAAAsD,SAAA;AAAA","ignoreList":[]}
|
|
@@ -21,6 +21,10 @@ declare module "nz/co/siliconst/ui5/metaui/plugins/controls/TextAreaPlugin" {
|
|
|
21
21
|
* @returns {Control} The configured TextArea control.
|
|
22
22
|
*/
|
|
23
23
|
render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName?: string, engineScopeId?: string, onChange?: (isValid: boolean, fieldKey?: string) => void): Control;
|
|
24
|
+
/**
|
|
25
|
+
* Dynamically sets the rows to the content length + 2
|
|
26
|
+
*/
|
|
27
|
+
private updateHeight;
|
|
24
28
|
/**
|
|
25
29
|
* Retrieves the current text string.
|
|
26
30
|
* @returns {unknown} The text string.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextAreaPlugin.d.ts","sourceRoot":"../../../../../../../../..","sources":["src/nz/co/siliconst/ui5/metaui/plugins/controls/TextAreaPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,4DAA4D,CAAC;IAC5E;;;OAGG;IAEH,OAAO,EAAE,UAAU,EAAE,MAAM,wDAAwD,CAAC;IACpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;IAElF,OAAO,OAAO,MAAM,qBAAqB,CAAC;IAG1C;;OAEG;IACH,MAAa,cAAe,SAAQ,UAAU;QAC1C;;;;;;;;;WASG;QACI,MAAM,CAAC,aAAa,EAAE,iBAAiB,EAAG,WAAW,EAAE,MAAM,EAAG,SAAS,GAAE,MAAe,EAAE,aAAa,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO;
|
|
1
|
+
{"version":3,"file":"TextAreaPlugin.d.ts","sourceRoot":"../../../../../../../../..","sources":["src/nz/co/siliconst/ui5/metaui/plugins/controls/TextAreaPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,4DAA4D,CAAC;IAC5E;;;OAGG;IAEH,OAAO,EAAE,UAAU,EAAE,MAAM,wDAAwD,CAAC;IACpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;IAElF,OAAO,OAAO,MAAM,qBAAqB,CAAC;IAG1C;;OAEG;IACH,MAAa,cAAe,SAAQ,UAAU;QAC1C;;;;;;;;;WASG;QACI,MAAM,CAAC,aAAa,EAAE,iBAAiB,EAAG,WAAW,EAAE,MAAM,EAAG,SAAS,GAAE,MAAe,EAAE,aAAa,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO;QAwD7L;;WAEG;QACH,OAAO,CAAC,YAAY;QAcpB;;;WAGG;QACH,SAAS,CAAC,QAAQ,IAAI,OAAO;QAI7B;;WAEG;QACH,SAAS,CAAC,UAAU,IAAI,IAAI;KAQ/B;CAEA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
sap.ui.define(["./BasePlugin","sap/m/TextArea","sap/m/Text"],function(t,e,i){"use strict";const a=t["BasePlugin"];class
|
|
1
|
+
sap.ui.define(["./BasePlugin","sap/m/TextArea","sap/m/Text"],function(t,e,i){"use strict";const a=t["BasePlugin"];class n extends a{render(t,a,n="meta",s,h){this.onChange=h;this.metadata=t;this.fieldKey=a.replace("/","");if(!this.isEditable){this.control=new i({id:this.generateStableId(s,a),text:`{${n}>${a}}`});this.applyCommonDirectives(this.control,t,n);return this.control}this.control=new e({id:this.generateStableId(s,a),value:`{${n}>${a}}`,maxLength:t.maxLength||0,required:!!t.required,rows:3,growing:false,change:t=>{this.updateHeight(t.getSource());const e=this.validateAndApplyVisualState();if(this.onChange){this.onChange(e.isValid,this.fieldKey)}},liveChange:t=>{this.updateHeight(t.getSource())}});this.control.attachEventOnce("modelContextChange",()=>{const t=this.control.getBinding("value");const e=()=>{if(this.control){this.updateHeight(this.control)}};if(t){t.attachChange(e)}e()});this.applyCommonDirectives(this.control,t,n);return this.control}updateHeight(t){const e=t.getValue()||"";const i=e.split(/\r\n|\r|\n/).length;const a=Math.ceil(e.length/80);const n=Math.max(i,a);t.setRows(Math.max(3,n+2))}getValue(){return this.control?this.control.getValue():null}applyState(){if(this.control&&this.metadata){if(!this.isEditable)return;const t=this.control;t.setEditable(!this.metadata.ui?.readOnly);t.setRequired(this.metadata.required)}}}var s={__esModule:true};s.TextAreaPlugin=n;return s});
|
|
2
2
|
//# sourceMappingURL=TextAreaPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextAreaPlugin.js","names":["BasePlugin","___BasePlugin","TextAreaPlugin","render","fieldMetadata","bindingPath","modelName","engineScopeId","onChange","this","metadata","fieldKey","replace","isEditable","control","TextControl","id","generateStableId","text","applyCommonDirectives","TextArea","value","maxLength","required","rows","
|
|
1
|
+
{"version":3,"file":"TextAreaPlugin.js","names":["BasePlugin","___BasePlugin","TextAreaPlugin","render","fieldMetadata","bindingPath","modelName","engineScopeId","onChange","this","metadata","fieldKey","replace","isEditable","control","TextControl","id","generateStableId","text","applyCommonDirectives","TextArea","value","maxLength","required","rows","growing","change","oEvent","updateHeight","getSource","result","validateAndApplyVisualState","isValid","liveChange","attachEventOnce","oBinding","getBinding","initLogic","attachChange","oTextArea","val","getValue","numLines","split","length","wrappedLines","Math","ceil","totalLines","max","setRows","applyState","input","setEditable","ui","readOnly","setRequired","__exports","__esModule"],"sources":["TextAreaPlugin.ts"],"sourcesContent":["/**\n * @file TextAreaPlugin.ts\n * @description Renders a sap.m.TextArea for string data specifically marked with the textArea widget.\n */\n\nimport { BasePlugin } from \"./BasePlugin\";\nimport { IPropertyMetadata } from \"../../interfaces/ISchema\";\nimport TextArea from \"sap/m/TextArea\";\nimport Control from \"sap/ui/core/Control\";\nimport TextControl from \"sap/m/Text\";\n\n/**\n * Handles rendering and logic for multi-line text areas.\n */\nexport class TextAreaPlugin extends BasePlugin {\n /**\n * Renders a `sap.m.TextArea` component.\n * \n * @param fieldMetadata The specific JSON schema properties for this field.\n * @param bindingPath The JSON path bound to this control.\n * @param modelName The UI5 JSONModel name.\n * @param engineScopeId The deterministic scope ID.\n * @param onChange The callback fired on value change.\n * @returns {Control} The configured TextArea control.\n */\n public render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName: string = \"meta\", engineScopeId?: string, onChange?: (isValid: boolean, fieldKey?: string) => void): Control {\n this.onChange = onChange;\n this.metadata = fieldMetadata;\n this.fieldKey = bindingPath.replace(\"/\", \"\"); // For EventBus\n \n if (!this.isEditable) {\n \n this.control = new TextControl({\n id: this.generateStableId(engineScopeId, bindingPath),\n text: `{${modelName}>${bindingPath}}`\n });\n this.applyCommonDirectives(this.control, fieldMetadata, modelName);\n return this.control as Control;\n }\n\n this.control = new TextArea({\n id: this.generateStableId(engineScopeId, bindingPath),\n value: `{${modelName}>${bindingPath}}`,\n maxLength: fieldMetadata.maxLength || 0,\n required: !!fieldMetadata.required,\n rows: 3, // Start with at least 3 lines\n growing: false, // We manage height manually to maintain the +2 lines requirement\n change: (oEvent: sap.ui.base.Event) => {\n this.updateHeight(oEvent.getSource() as TextArea);\n const result = this.validateAndApplyVisualState();\n if (this.onChange) {\n this.onChange(result.isValid, this.fieldKey);\n }\n },\n liveChange: (oEvent: sap.ui.base.Event) => {\n this.updateHeight(oEvent.getSource() as TextArea);\n }\n });\n\n // Clean architecture: Wait for the model context, then calculate initial height\n (this.control as TextArea).attachEventOnce(\"modelContextChange\", () => {\n const oBinding = (this.control as TextArea).getBinding(\"value\");\n \n const initLogic = () => {\n if (this.control) {\n this.updateHeight(this.control as TextArea);\n }\n };\n\n if (oBinding) {\n oBinding.attachChange(initLogic);\n }\n // Execute immediately in case the model is synchronous (JSONModel)\n initLogic();\n });\n\n this.applyCommonDirectives(this.control, fieldMetadata, modelName);\n\n return this.control as Control;\n }\n\n /**\n * Dynamically sets the rows to the content length + 2\n */\n private updateHeight(oTextArea: TextArea): void {\n const val = oTextArea.getValue() || \"\";\n // Count actual newlines in the string\n const numLines = val.split(/\\r\\n|\\r|\\n/).length;\n // Also estimate word wrapping if they type a really long single line without pressing enter\n // A standard character width approximation, assuming ~80 chars per line for full width\n const wrappedLines = Math.ceil(val.length / 80);\n \n const totalLines = Math.max(numLines, wrappedLines);\n \n // Ensure there is always 2 lines of extra breathing room\n oTextArea.setRows(Math.max(3, totalLines + 2));\n }\n\n /**\n * Retrieves the current text string.\n * @returns {unknown} The text string.\n */\n protected getValue(): unknown {\n return this.control ? (this.control as TextArea).getValue() : null;\n }\n\n /**\n * Applies dynamic read-only state.\n */\n protected applyState(): void {\n if (this.control && this.metadata) {\n if (!this.isEditable) return;\n const input = this.control as TextArea;\n input.setEditable(!this.metadata.ui?.readOnly);\n input.setRequired(this.metadata.required);\n }\n }\n}\n"],"mappings":"0FAAA,MAKSA,EAAUC,EAAA,cASZ,MAAMC,UAAuBF,EAWzBG,OAAOC,EAAmCC,EAAsBC,EAAoB,OAAQC,EAAwBC,GACvHC,KAAKD,SAAWA,EAChBC,KAAKC,SAAWN,EAChBK,KAAKE,SAAWN,EAAYO,QAAQ,IAAK,IAEzC,IAAKH,KAAKI,WAAY,CAElBJ,KAAKK,QAAU,IAAIC,EAAY,CAC3BC,GAAIP,KAAKQ,iBAAiBV,EAAeF,GACzCa,KAAM,IAAIZ,KAAaD,OAE3BI,KAAKU,sBAAsBV,KAAKK,QAASV,EAAeE,GACxD,OAAOG,KAAKK,OAChB,CAEAL,KAAKK,QAAU,IAAIM,EAAS,CACxBJ,GAAIP,KAAKQ,iBAAiBV,EAAeF,GACzCgB,MAAO,IAAIf,KAAaD,KACxBiB,UAAWlB,EAAckB,WAAa,EACtCC,WAAYnB,EAAcmB,SAC1BC,KAAM,EACNC,QAAS,MACTC,OAASC,IACLlB,KAAKmB,aAAaD,EAAOE,aACzB,MAAMC,EAASrB,KAAKsB,8BACpB,GAAItB,KAAKD,SAAU,CACfC,KAAKD,SAASsB,EAAOE,QAASvB,KAAKE,SACvC,GAEJsB,WAAaN,IACTlB,KAAKmB,aAAaD,EAAOE,gBAKhCpB,KAAKK,QAAqBoB,gBAAgB,qBAAsB,KAC7D,MAAMC,EAAY1B,KAAKK,QAAqBsB,WAAW,SAEvD,MAAMC,EAAYA,KACd,GAAI5B,KAAKK,QAAS,CACdL,KAAKmB,aAAanB,KAAKK,QAC3B,GAGJ,GAAIqB,EAAU,CACVA,EAASG,aAAaD,EAC1B,CAEAA,MAGJ5B,KAAKU,sBAAsBV,KAAKK,QAASV,EAAeE,GAExD,OAAOG,KAAKK,OAChB,CAKQc,aAAaW,GACjB,MAAMC,EAAMD,EAAUE,YAAc,GAEpC,MAAMC,EAAWF,EAAIG,MAAM,cAAcC,OAGzC,MAAMC,EAAeC,KAAKC,KAAKP,EAAII,OAAS,IAE5C,MAAMI,EAAaF,KAAKG,IAAIP,EAAUG,GAGtCN,EAAUW,QAAQJ,KAAKG,IAAI,EAAGD,EAAa,GAC/C,CAMUP,WACN,OAAOhC,KAAKK,QAAWL,KAAKK,QAAqB2B,WAAa,IAClE,CAKUU,aACN,GAAI1C,KAAKK,SAAWL,KAAKC,SAAU,CAC/B,IAAKD,KAAKI,WAAY,OACtB,MAAMuC,EAAQ3C,KAAKK,QACnBsC,EAAMC,aAAa5C,KAAKC,SAAS4C,IAAIC,UACrCH,EAAMI,YAAY/C,KAAKC,SAASa,SACpC,CACJ,EACH,IAAAkC,EAAA,CAAAC,WAAA,MAAAD,EAAAvD,iBAAA,OAAAuD,CAAA","ignoreList":[]}
|
|
@@ -43,21 +43,59 @@ export class TextAreaPlugin extends BasePlugin {
|
|
|
43
43
|
value: `{${modelName}>${bindingPath}}`,
|
|
44
44
|
maxLength: fieldMetadata.maxLength || 0,
|
|
45
45
|
required: !!fieldMetadata.required,
|
|
46
|
-
rows:
|
|
46
|
+
rows: 3, // Start with at least 3 lines
|
|
47
|
+
growing: false, // We manage height manually to maintain the +2 lines requirement
|
|
47
48
|
change: (oEvent: sap.ui.base.Event) => {
|
|
48
|
-
|
|
49
|
-
const result = this.
|
|
49
|
+
this.updateHeight(oEvent.getSource() as TextArea);
|
|
50
|
+
const result = this.validateAndApplyVisualState();
|
|
50
51
|
if (this.onChange) {
|
|
51
52
|
this.onChange(result.isValid, this.fieldKey);
|
|
52
53
|
}
|
|
54
|
+
},
|
|
55
|
+
liveChange: (oEvent: sap.ui.base.Event) => {
|
|
56
|
+
this.updateHeight(oEvent.getSource() as TextArea);
|
|
53
57
|
}
|
|
54
58
|
});
|
|
55
59
|
|
|
60
|
+
// Clean architecture: Wait for the model context, then calculate initial height
|
|
61
|
+
(this.control as TextArea).attachEventOnce("modelContextChange", () => {
|
|
62
|
+
const oBinding = (this.control as TextArea).getBinding("value");
|
|
63
|
+
|
|
64
|
+
const initLogic = () => {
|
|
65
|
+
if (this.control) {
|
|
66
|
+
this.updateHeight(this.control as TextArea);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
if (oBinding) {
|
|
71
|
+
oBinding.attachChange(initLogic);
|
|
72
|
+
}
|
|
73
|
+
// Execute immediately in case the model is synchronous (JSONModel)
|
|
74
|
+
initLogic();
|
|
75
|
+
});
|
|
76
|
+
|
|
56
77
|
this.applyCommonDirectives(this.control, fieldMetadata, modelName);
|
|
57
78
|
|
|
58
79
|
return this.control as Control;
|
|
59
80
|
}
|
|
60
81
|
|
|
82
|
+
/**
|
|
83
|
+
* Dynamically sets the rows to the content length + 2
|
|
84
|
+
*/
|
|
85
|
+
private updateHeight(oTextArea: TextArea): void {
|
|
86
|
+
const val = oTextArea.getValue() || "";
|
|
87
|
+
// Count actual newlines in the string
|
|
88
|
+
const numLines = val.split(/\r\n|\r|\n/).length;
|
|
89
|
+
// Also estimate word wrapping if they type a really long single line without pressing enter
|
|
90
|
+
// A standard character width approximation, assuming ~80 chars per line for full width
|
|
91
|
+
const wrappedLines = Math.ceil(val.length / 80);
|
|
92
|
+
|
|
93
|
+
const totalLines = Math.max(numLines, wrappedLines);
|
|
94
|
+
|
|
95
|
+
// Ensure there is always 2 lines of extra breathing room
|
|
96
|
+
oTextArea.setRows(Math.max(3, totalLines + 2));
|
|
97
|
+
}
|
|
98
|
+
|
|
61
99
|
/**
|
|
62
100
|
* Retrieves the current text string.
|
|
63
101
|
* @returns {unknown} The text string.
|
|
@@ -57,7 +57,7 @@ sap.ui.define(["./BasePlugin", "sap/m/TimePicker", "sap/m/Text"], function (___B
|
|
|
57
57
|
required: fieldMetadata.required,
|
|
58
58
|
change: oEvent => {
|
|
59
59
|
const val = oEvent.getParameter("value");
|
|
60
|
-
const result = this.
|
|
60
|
+
const result = this.validateAndApplyVisualState();
|
|
61
61
|
if (this.onChange) {
|
|
62
62
|
this.onChange(result.isValid, this.fieldKey);
|
|
63
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimePlugin-dbg.js","names":["BasePlugin","___BasePlugin","TimePlugin","render","fieldMetadata","bindingPath","modelName","engineScopeId","onChange","metadata","isEditable","control","TextControl","id","generateStableId","text","path","type","formatOptions","source","pattern","applyCommonDirectives","TimePicker","value","displayFormat","editable","ui","readOnly","required","change","oEvent","val","getParameter","result","
|
|
1
|
+
{"version":3,"file":"TimePlugin-dbg.js","names":["BasePlugin","___BasePlugin","TimePlugin","render","fieldMetadata","bindingPath","modelName","engineScopeId","onChange","metadata","isEditable","control","TextControl","id","generateStableId","text","path","type","formatOptions","source","pattern","applyCommonDirectives","TimePicker","value","displayFormat","editable","ui","readOnly","required","change","oEvent","val","getParameter","result","validateAndApplyVisualState","isValid","fieldKey","getValue","applyState","input","setEditable","setRequired","__exports","__esModule"],"sources":["TimePlugin.ts"],"sourcesContent":["/**\n * @file TimePlugin.ts\n * @description Handles rendering logic for Time strings.\n */\n\nimport { BasePlugin } from \"./BasePlugin\";\nimport { IPropertyMetadata } from \"../../interfaces/ISchema\";\nimport TimePicker from \"sap/m/TimePicker\";\nimport Control from \"sap/ui/core/Control\";\nimport TextControl from \"sap/m/Text\";\n\n/**\n * Handles rendering and logic for time inputs.\n */\nexport class TimePlugin extends BasePlugin {\n /**\n * Renders a `sap.m.TimePicker` component.\n * \n * @param fieldMetadata The specific JSON schema properties for this field.\n * @param bindingPath The JSON path bound to this control.\n * @param modelName The UI5 JSONModel name.\n * @param engineScopeId The deterministic scope ID.\n * @param onChange The callback fired on value change.\n * @returns {Control} The configured TimePicker control.\n */\n public render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName: string = \"meta\", engineScopeId?: string, onChange?: (isValid: boolean, fieldKey?: string) => void): Control {\n this.onChange = onChange;\n this.metadata = fieldMetadata;\n \n if (!this.isEditable) {\n \n this.control = new TextControl({\n id: this.generateStableId(engineScopeId, bindingPath),\n text: {\n path: `${modelName}>${bindingPath}`,\n type: \"sap.ui.model.type.Time\",\n formatOptions: {\n source: { pattern: \"HH:mm:ss\" },\n pattern: \"HH:mm:ss\"\n }\n }\n });\n this.applyCommonDirectives(this.control, fieldMetadata, modelName);\n return this.control as Control;\n }\n\n this.control = new TimePicker({\n id: this.generateStableId(engineScopeId, bindingPath),\n value: {\n path: `${modelName}>${bindingPath}`,\n type: \"sap.ui.model.type.Time\",\n formatOptions: {\n source: { pattern: \"HH:mm:ss\" },\n pattern: \"HH:mm:ss\"\n }\n },\n displayFormat: \"HH:mm:ss\",\n editable: !fieldMetadata.ui?.readOnly,\n required: fieldMetadata.required,\n change: (oEvent: sap.ui.base.Event) => {\n const val = (oEvent as sap.ui.base.Event).getParameter(\"value\");\n const result = this.validateAndApplyVisualState();\n if (this.onChange) {\n this.onChange(result.isValid, this.fieldKey);\n }\n }\n });\n\n this.applyCommonDirectives(this.control, fieldMetadata, modelName);\n\n return this.control as Control;\n }\n\n /**\n * Retrieves the current time string.\n * @returns {unknown} The time string.\n */\n protected getValue(): unknown {\n return this.control ? (this.control as TimePicker).getValue() : null;\n }\n\n /**\n * Applies dynamic read-only state.\n */\n protected applyState(): void {\n if (this.control && this.metadata) {\n if (!this.isEditable) return;\n const input = this.control as TimePicker;\n input.setEditable(!this.metadata.ui?.readOnly);\n input.setRequired(this.metadata.required);\n }\n }\n}\n"],"mappings":";;;EAAA;AACA;AACA;AACA;EAHA,MAKSA,UAAU,GAAAC,aAAA;EAMnB;AACA;AACA;EACO,MAAMC,UAAU,SAASF,UAAU,CAAC;IACvC;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACWG,MAAMA,CAACC,aAAgC,EAAGC,WAAmB,EAAGC,SAAiB,GAAG,MAAM,EAAEC,aAAsB,EAAEC,QAAwD,EAAW;MAC1L,IAAI,CAACA,QAAQ,GAAGA,QAAQ;MACxB,IAAI,CAACC,QAAQ,GAAGL,aAAa;MAE7B,IAAI,CAAC,IAAI,CAACM,UAAU,EAAE;QAElB,IAAI,CAACC,OAAO,GAAG,IAAIC,WAAW,CAAC;UAC3BC,EAAE,EAAE,IAAI,CAACC,gBAAgB,CAACP,aAAa,EAAEF,WAAW,CAAC;UACrDU,IAAI,EAAE;YACFC,IAAI,EAAE,GAAGV,SAAS,IAAID,WAAW,EAAE;YACnCY,IAAI,EAAE,wBAAwB;YAC9BC,aAAa,EAAE;cACXC,MAAM,EAAE;gBAAEC,OAAO,EAAE;cAAW,CAAC;cAC/BA,OAAO,EAAE;YACb;UACJ;QACJ,CAAC,CAAC;QACF,IAAI,CAACC,qBAAqB,CAAC,IAAI,CAACV,OAAO,EAAEP,aAAa,EAAEE,SAAS,CAAC;QAClE,OAAO,IAAI,CAACK,OAAO;MACvB;MAEA,IAAI,CAACA,OAAO,GAAG,IAAIW,UAAU,CAAC;QAC1BT,EAAE,EAAE,IAAI,CAACC,gBAAgB,CAACP,aAAa,EAAEF,WAAW,CAAC;QACrDkB,KAAK,EAAE;UACHP,IAAI,EAAE,GAAGV,SAAS,IA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ACJ;EACJ;EAAC,IAAAc,SAAA;IAAAC,UAAA;EAAA;EAAAD,SAAA,CAAAxC,UAAA,GAAAA,UAAA;EAAA,OAAAwC,SAAA;AAAA","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
sap.ui.define(["./BasePlugin","sap/m/TimePicker","sap/m/Text"],function(t,e,i){"use strict";const s=t["BasePlugin"];class a extends s{render(t,s,a="meta",r
|
|
1
|
+
sap.ui.define(["./BasePlugin","sap/m/TimePicker","sap/m/Text"],function(t,e,i){"use strict";const s=t["BasePlugin"];class a extends s{render(t,s,a="meta",n,r){this.onChange=r;this.metadata=t;if(!this.isEditable){this.control=new i({id:this.generateStableId(n,s),text:{path:`${a}>${s}`,type:"sap.ui.model.type.Time",formatOptions:{source:{pattern:"HH:mm:ss"},pattern:"HH:mm:ss"}}});this.applyCommonDirectives(this.control,t,a);return this.control}this.control=new e({id:this.generateStableId(n,s),value:{path:`${a}>${s}`,type:"sap.ui.model.type.Time",formatOptions:{source:{pattern:"HH:mm:ss"},pattern:"HH:mm:ss"}},displayFormat:"HH:mm:ss",editable:!t.ui?.readOnly,required:t.required,change:t=>{const e=t.getParameter("value");const i=this.validateAndApplyVisualState();if(this.onChange){this.onChange(i.isValid,this.fieldKey)}}});this.applyCommonDirectives(this.control,t,a);return this.control}getValue(){return this.control?this.control.getValue():null}applyState(){if(this.control&&this.metadata){if(!this.isEditable)return;const t=this.control;t.setEditable(!this.metadata.ui?.readOnly);t.setRequired(this.metadata.required)}}}var n={__esModule:true};n.TimePlugin=a;return n});
|
|
2
2
|
//# sourceMappingURL=TimePlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimePlugin.js","names":["BasePlugin","___BasePlugin","TimePlugin","render","fieldMetadata","bindingPath","modelName","engineScopeId","onChange","this","metadata","isEditable","control","TextControl","id","generateStableId","text","path","type","formatOptions","source","pattern","applyCommonDirectives","TimePicker","value","displayFormat","editable","ui","readOnly","required","change","oEvent","val","getParameter","result","
|
|
1
|
+
{"version":3,"file":"TimePlugin.js","names":["BasePlugin","___BasePlugin","TimePlugin","render","fieldMetadata","bindingPath","modelName","engineScopeId","onChange","this","metadata","isEditable","control","TextControl","id","generateStableId","text","path","type","formatOptions","source","pattern","applyCommonDirectives","TimePicker","value","displayFormat","editable","ui","readOnly","required","change","oEvent","val","getParameter","result","validateAndApplyVisualState","isValid","fieldKey","getValue","applyState","input","setEditable","setRequired","__exports","__esModule"],"sources":["TimePlugin.ts"],"sourcesContent":["/**\n * @file TimePlugin.ts\n * @description Handles rendering logic for Time strings.\n */\n\nimport { BasePlugin } from \"./BasePlugin\";\nimport { IPropertyMetadata } from \"../../interfaces/ISchema\";\nimport TimePicker from \"sap/m/TimePicker\";\nimport Control from \"sap/ui/core/Control\";\nimport TextControl from \"sap/m/Text\";\n\n/**\n * Handles rendering and logic for time inputs.\n */\nexport class TimePlugin extends BasePlugin {\n /**\n * Renders a `sap.m.TimePicker` component.\n * \n * @param fieldMetadata The specific JSON schema properties for this field.\n * @param bindingPath The JSON path bound to this control.\n * @param modelName The UI5 JSONModel name.\n * @param engineScopeId The deterministic scope ID.\n * @param onChange The callback fired on value change.\n * @returns {Control} The configured TimePicker control.\n */\n public render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName: string = \"meta\", engineScopeId?: string, onChange?: (isValid: boolean, fieldKey?: string) => void): Control {\n this.onChange = onChange;\n this.metadata = fieldMetadata;\n \n if (!this.isEditable) {\n \n this.control = new TextControl({\n id: this.generateStableId(engineScopeId, bindingPath),\n text: {\n path: `${modelName}>${bindingPath}`,\n type: \"sap.ui.model.type.Time\",\n formatOptions: {\n source: { pattern: \"HH:mm:ss\" },\n pattern: \"HH:mm:ss\"\n }\n }\n });\n this.applyCommonDirectives(this.control, fieldMetadata, modelName);\n return this.control as Control;\n }\n\n this.control = new TimePicker({\n id: this.generateStableId(engineScopeId, bindingPath),\n value: {\n path: `${modelName}>${bindingPath}`,\n type: \"sap.ui.model.type.Time\",\n formatOptions: {\n source: { pattern: \"HH:mm:ss\" },\n pattern: \"HH:mm:ss\"\n }\n },\n displayFormat: \"HH:mm:ss\",\n editable: !fieldMetadata.ui?.readOnly,\n required: fieldMetadata.required,\n change: (oEvent: sap.ui.base.Event) => {\n const val = (oEvent as sap.ui.base.Event).getParameter(\"value\");\n const result = this.validateAndApplyVisualState();\n if (this.onChange) {\n this.onChange(result.isValid, this.fieldKey);\n }\n }\n });\n\n this.applyCommonDirectives(this.control, fieldMetadata, modelName);\n\n return this.control as Control;\n }\n\n /**\n * Retrieves the current time string.\n * @returns {unknown} The time string.\n */\n protected getValue(): unknown {\n return this.control ? (this.control as TimePicker).getValue() : null;\n }\n\n /**\n * Applies dynamic read-only state.\n */\n protected applyState(): void {\n if (this.control && this.metadata) {\n if (!this.isEditable) return;\n const input = this.control as TimePicker;\n input.setEditable(!this.metadata.ui?.readOnly);\n input.setRequired(this.metadata.required);\n }\n }\n}\n"],"mappings":"4FAAA,MAKSA,EAAUC,EAAA,cASZ,MAAMC,UAAmBF,EAWrBG,OAAOC,EAAmCC,EAAsBC,EAAoB,OAAQC,EAAwBC,GACvHC,KAAKD,SAAWA,EAChBC,KAAKC,SAAWN,EAEhB,IAAKK,KAAKE,WAAY,CAElBF,KAAKG,QAAU,IAAIC,EAAY,CAC3BC,GAAIL,KAAKM,iBAAiBR,EAAeF,GACzCW,KAAM,CACFC,KAAM,GAAGX,KAAaD,IACtBa,KAAM,yBACNC,cAAe,CACXC,OAAQ,CAAEC,QAAS,YACnBA,QAAS,eAIrBZ,KAAKa,sBAAsBb,KAAKG,QAASR,EAAeE,GACxD,OAAOG,KAAKG,OAChB,CAEAH,KAAKG,QAAU,IAAIW,EAAW,CAC1BT,GAAIL,KAAKM,iBAAiBR,EAAeF,GACzCmB,MAAO,CACHP,KAAM,GAAGX,KAAaD,IACtBa,KAAM,yBACNC,cAAe,CACXC,OAAQ,CAAEC,QAAS,YACnBA,QAAS,aAGjBI,cAAe,WACfC,UAAWtB,EAAcuB,IAAIC,SAC7BC,SAAUzB,EAAcyB,SACxBC,OAASC,IACL,MAAMC,EAAOD,EAA6BE,aAAa,SACvD,MAAMC,EAASzB,KAAK0B,8BACpB,GAAI1B,KAAKD,SAAU,CACfC,KAAKD,SAAS0B,EAAOE,QAAS3B,KAAK4B,SACvC,KAIR5B,KAAKa,sBAAsBb,KAAKG,QAASR,EAAeE,GAExD,OAAOG,KAAKG,OAChB,CAMU0B,WACN,OAAO7B,KAAKG,QAAWH,KAAKG,QAAuB0B,WAAa,IACpE,CAKUC,aACN,GAAI9B,KAAKG,SAAWH,KAAKC,SAAU,CAC/B,IAAKD,KAAKE,WAAY,OACtB,MAAM6B,EAAQ/B,KAAKG,QACnB4B,EAAMC,aAAahC,KAAKC,SAASiB,IAAIC,UACrCY,EAAME,YAAYjC,KAAKC,SAASmB,SACpC,CACJ,EACH,IAAAc,EAAA,CAAAC,WAAA,MAAAD,EAAAzC,aAAA,OAAAyC,CAAA","ignoreList":[]}
|
|
@@ -59,7 +59,7 @@ export class TimePlugin extends BasePlugin {
|
|
|
59
59
|
required: fieldMetadata.required,
|
|
60
60
|
change: (oEvent: sap.ui.base.Event) => {
|
|
61
61
|
const val = (oEvent as sap.ui.base.Event).getParameter("value");
|
|
62
|
-
const result = this.
|
|
62
|
+
const result = this.validateAndApplyVisualState();
|
|
63
63
|
if (this.onChange) {
|
|
64
64
|
this.onChange(result.isValid, this.fieldKey);
|
|
65
65
|
}
|
|
@@ -44,7 +44,7 @@ sap.ui.define(["../controls/BasePlugin", "../../controls/VoiceInputControl", "sa
|
|
|
44
44
|
});
|
|
45
45
|
this.applyCommonDirectives(this.control, metadata, modelName);
|
|
46
46
|
this.control.attachCapture(() => {
|
|
47
|
-
const result = this.
|
|
47
|
+
const result = this.validateAndApplyVisualState();
|
|
48
48
|
if (this.onChange) {
|
|
49
49
|
this.onChange(result.isValid, this.fieldKey);
|
|
50
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VoiceInputPlugin-dbg.js","names":["BasePlugin","___controls_BasePlugin","VoiceInputControl","_interopRequireDefault","__VoiceInputControl","VoiceInputPlugin","render","metadata","bindingPath","modelName","engineScopeId","onChange","fieldKey","replace","isEditable","control","TextControl","id","generateStableId","text","path","formatter","val","applyCommonDirectives","value","schemaMetadata","readOnly","ui","attachCapture","result","
|
|
1
|
+
{"version":3,"file":"VoiceInputPlugin-dbg.js","names":["BasePlugin","___controls_BasePlugin","VoiceInputControl","_interopRequireDefault","__VoiceInputControl","VoiceInputPlugin","render","metadata","bindingPath","modelName","engineScopeId","onChange","fieldKey","replace","isEditable","control","TextControl","id","generateStableId","text","path","formatter","val","applyCommonDirectives","value","schemaMetadata","readOnly","ui","attachCapture","result","validateAndApplyVisualState","isValid","getValue","applyState","setProperty","__exports","__esModule"],"sources":["VoiceInputPlugin.ts"],"sourcesContent":["import { BasePlugin } from \"../controls/BasePlugin\";\nimport { IPropertyMetadata } from \"../../interfaces/ISchema\";\nimport Control from \"sap/ui/core/Control\";\nimport VoiceInputControl from \"../../controls/VoiceInputControl\";\nimport TextControl from \"sap/m/Text\";\n\nexport class VoiceInputPlugin extends BasePlugin {\n /**\n * Renders a `VoiceInputControl` component.\n * \n * @param metadata The specific JSON schema properties for this field.\n * @param bindingPath The JSON path bound to this control.\n * @param modelName The UI5 JSONModel name.\n * @param engineScopeId The deterministic scope ID.\n * @param onChange The callback fired on value change.\n * @returns {Control} The configured VoiceInputControl.\n */\n public render(metadata: IPropertyMetadata, bindingPath: string, modelName: string = \"meta\", engineScopeId?: string, onChange?: (isValid: boolean, fieldKey?: string) => void): Control {\n this.onChange = onChange;\n this.metadata = metadata;\n this.fieldKey = bindingPath.replace('/', '');\n this.modelName = modelName;\n\n if (!this.isEditable) {\n \n this.control = new TextControl({\n id: this.generateStableId(engineScopeId, bindingPath),\n text: {\n path: `${modelName}>${bindingPath}`,\n formatter: (val: unknown) => {\n if (!val || val === \"undefined\" || val === \"null\") return \"\";\n return val;\n }\n }\n }) as Control;\n this.applyCommonDirectives(this.control, metadata, modelName);\n return this.control as Control;\n }\n\n this.control = new VoiceInputControl({\n id: this.generateStableId(engineScopeId, bindingPath),\n value: `{${modelName}>${bindingPath}}`,\n schemaMetadata: metadata,\n readOnly: !!metadata.ui?.readOnly\n }) as Control;\n\n this.applyCommonDirectives(this.control, metadata, modelName);\n\n (this.control as VoiceInputControl).attachCapture(() => {\n const result = this.validateAndApplyVisualState();\n if (this.onChange) {\n this.onChange(result.isValid, this.fieldKey);\n }\n });\n\n return this.control as Control;\n }\n\n /**\n * Retrieves the current voice transcription text.\n * @returns {unknown} The text string.\n */\n protected getValue(): unknown {\n return this.control ? (this.control as VoiceInputControl).getValue() : null;\n }\n\n /**\n * Applies dynamic read-only state.\n */\n protected applyState(): void {\n if (this.control && this.metadata) {\n if (!this.isEditable) return;\n (this.control as sap.ui.core.Control).setProperty(\"readOnly\", !!this.metadata.ui?.readOnly);\n }\n }\n}\n"],"mappings":";;;;;;QAASA,UAAU,GAAAC,sBAAA;EAAA,MAGZC,iBAAiB,GAAAC,sBAAA,CAAAC,mBAAA;EAGjB,MAAMC,gBAAgB,SAASL,UAAU,CAAC;IAC7C;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACWM,MAAMA,CAACC,QAA2B,EAAGC,WAAmB,EAAGC,SAAiB,GAAG,MAAM,EAAEC,aAAsB,EAAEC,QAAwD,EAAW;MACrL,IAAI,CAACA,QAAQ,GAAGA,QAAQ;MACxB,IAAI,CAACJ,QAAQ,GAAGA,QAAQ;MACxB,IAAI,CAACK,QAAQ,GAAGJ,WAAW,CAACK,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;MAC5C,IAAI,CAACJ,SAAS,GAAGA,SAAS;MAE1B,IAAI,CAAC,IAAI,CAACK,UAAU,EAAE;QAElB,IAAI,CAACC,OAAO,GAAG,IAAIC,WAAW,CAAC;UAC3BC,EAAE,EAAE,IAAI,CAACC,gBAAgB,CAACR,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A,EAAS;MACzB,IAAI,IAAI,CAAClB,OAAO,IAAI,IAAI,CAACR,QAAQ,EAAE;QAC/B,IAAI,CAAC,IAAI,CAACO,UAAU,EAAE;QACrB,IAAI,CAACC,OAAO,CAAyBmB,WAAW,CAAC,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC3B,QAAQ,CAACoB,EAAE,EAAED,QAAQ,CAAC;MAC/F;IACJ;EACJ;EAAC,IAAAS,SAAA;IAAAC,UAAA;EAAA;EAAAD,SAAA,CAAA9B,gBAAA,GAAAA,gBAAA;EAAA,OAAA8B,SAAA;AAAA","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
sap.ui.define(["../controls/BasePlugin","../../controls/VoiceInputControl","sap/m/Text"],function(t,e,i){"use strict";function n(t){return t&&t.__esModule&&typeof t.default!=="undefined"?t.default:t}const a=t["BasePlugin"];const s=n(e);class r extends a{render(t,e,n="meta",a,r){this.onChange=r;this.metadata=t;this.fieldKey=e.replace("/","");this.modelName=n;if(!this.isEditable){this.control=new i({id:this.generateStableId(a,e),text:{path:`${n}>${e}`,formatter:t=>{if(!t||t==="undefined"||t==="null")return"";return t}}});this.applyCommonDirectives(this.control,t,n);return this.control}this.control=new s({id:this.generateStableId(a,e),value:`{${n}>${e}}`,schemaMetadata:t,readOnly:!!t.ui?.readOnly});this.applyCommonDirectives(this.control,t,n);this.control.attachCapture(()=>{const t=this.
|
|
1
|
+
sap.ui.define(["../controls/BasePlugin","../../controls/VoiceInputControl","sap/m/Text"],function(t,e,i){"use strict";function n(t){return t&&t.__esModule&&typeof t.default!=="undefined"?t.default:t}const a=t["BasePlugin"];const s=n(e);class r extends a{render(t,e,n="meta",a,r){this.onChange=r;this.metadata=t;this.fieldKey=e.replace("/","");this.modelName=n;if(!this.isEditable){this.control=new i({id:this.generateStableId(a,e),text:{path:`${n}>${e}`,formatter:t=>{if(!t||t==="undefined"||t==="null")return"";return t}}});this.applyCommonDirectives(this.control,t,n);return this.control}this.control=new s({id:this.generateStableId(a,e),value:`{${n}>${e}}`,schemaMetadata:t,readOnly:!!t.ui?.readOnly});this.applyCommonDirectives(this.control,t,n);this.control.attachCapture(()=>{const t=this.validateAndApplyVisualState();if(this.onChange){this.onChange(t.isValid,this.fieldKey)}});return this.control}getValue(){return this.control?this.control.getValue():null}applyState(){if(this.control&&this.metadata){if(!this.isEditable)return;this.control.setProperty("readOnly",!!this.metadata.ui?.readOnly)}}}var l={__esModule:true};l.VoiceInputPlugin=r;return l});
|
|
2
2
|
//# sourceMappingURL=VoiceInputPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VoiceInputPlugin.js","names":["BasePlugin","___controls_BasePlugin","VoiceInputControl","_interopRequireDefault","__VoiceInputControl","VoiceInputPlugin","render","metadata","bindingPath","modelName","engineScopeId","onChange","this","fieldKey","replace","isEditable","control","TextControl","id","generateStableId","text","path","formatter","val","applyCommonDirectives","value","schemaMetadata","readOnly","ui","attachCapture","result","
|
|
1
|
+
{"version":3,"file":"VoiceInputPlugin.js","names":["BasePlugin","___controls_BasePlugin","VoiceInputControl","_interopRequireDefault","__VoiceInputControl","VoiceInputPlugin","render","metadata","bindingPath","modelName","engineScopeId","onChange","this","fieldKey","replace","isEditable","control","TextControl","id","generateStableId","text","path","formatter","val","applyCommonDirectives","value","schemaMetadata","readOnly","ui","attachCapture","result","validateAndApplyVisualState","isValid","getValue","applyState","setProperty","__exports","__esModule"],"sources":["VoiceInputPlugin.ts"],"sourcesContent":["import { BasePlugin } from \"../controls/BasePlugin\";\nimport { IPropertyMetadata } from \"../../interfaces/ISchema\";\nimport Control from \"sap/ui/core/Control\";\nimport VoiceInputControl from \"../../controls/VoiceInputControl\";\nimport TextControl from \"sap/m/Text\";\n\nexport class VoiceInputPlugin extends BasePlugin {\n /**\n * Renders a `VoiceInputControl` component.\n * \n * @param metadata The specific JSON schema properties for this field.\n * @param bindingPath The JSON path bound to this control.\n * @param modelName The UI5 JSONModel name.\n * @param engineScopeId The deterministic scope ID.\n * @param onChange The callback fired on value change.\n * @returns {Control} The configured VoiceInputControl.\n */\n public render(metadata: IPropertyMetadata, bindingPath: string, modelName: string = \"meta\", engineScopeId?: string, onChange?: (isValid: boolean, fieldKey?: string) => void): Control {\n this.onChange = onChange;\n this.metadata = metadata;\n this.fieldKey = bindingPath.replace('/', '');\n this.modelName = modelName;\n\n if (!this.isEditable) {\n \n this.control = new TextControl({\n id: this.generateStableId(engineScopeId, bindingPath),\n text: {\n path: `${modelName}>${bindingPath}`,\n formatter: (val: unknown) => {\n if (!val || val === \"undefined\" || val === \"null\") return \"\";\n return val;\n }\n }\n }) as Control;\n this.applyCommonDirectives(this.control, metadata, modelName);\n return this.control as Control;\n }\n\n this.control = new VoiceInputControl({\n id: this.generateStableId(engineScopeId, bindingPath),\n value: `{${modelName}>${bindingPath}}`,\n schemaMetadata: metadata,\n readOnly: !!metadata.ui?.readOnly\n }) as Control;\n\n this.applyCommonDirectives(this.control, metadata, modelName);\n\n (this.control as VoiceInputControl).attachCapture(() => {\n const result = this.validateAndApplyVisualState();\n if (this.onChange) {\n this.onChange(result.isValid, this.fieldKey);\n }\n });\n\n return this.control as Control;\n }\n\n /**\n * Retrieves the current voice transcription text.\n * @returns {unknown} The text string.\n */\n protected getValue(): unknown {\n return this.control ? (this.control as VoiceInputControl).getValue() : null;\n }\n\n /**\n * Applies dynamic read-only state.\n */\n protected applyState(): void {\n if (this.control && this.metadata) {\n if (!this.isEditable) return;\n (this.control as sap.ui.core.Control).setProperty(\"readOnly\", !!this.metadata.ui?.readOnly);\n }\n }\n}\n"],"mappings":"6MAASA,EAAUC,EAAA,oBAGZC,EAAiBC,EAAAC,GAGjB,MAAMC,UAAyBL,EAW3BM,OAAOC,EAA8BC,EAAsBC,EAAoB,OAAQC,EAAwBC,GAClHC,KAAKD,SAAWA,EAChBC,KAAKL,SAAWA,EAChBK,KAAKC,SAAWL,EAAYM,QAAQ,IAAK,IACzCF,KAAKH,UAAYA,EAEjB,IAAKG,KAAKG,WAAY,CAElBH,KAAKI,QAAU,IAAIC,EAAY,CAC3BC,GAAIN,KAAKO,iBAAiBT,EAAeF,GACzCY,KAAM,CACFC,KAAM,GAAGZ,KAAaD,IACtBc,UAAYC,IACR,IAAKA,GAAOA,IAAQ,aAAeA,IAAQ,OAAQ,MAAO,GAC1D,OAAOA,MAInBX,KAAKY,sBAAsBZ,KAAKI,QAAST,EAAUE,GACnD,OAAOG,KAAKI,OAChB,CAEAJ,KAAKI,QAAU,IAAId,EAAkB,CACjCgB,GAAIN,KAAKO,iBAAiBT,EAAeF,GACzCiB,MAAO,IAAIhB,KAAaD,KACxBkB,eAAgBnB,EAChBoB,WAAYpB,EAASqB,IAAID,WAG7Bf,KAAKY,sBAAsBZ,KAAKI,QAAST,EAAUE,GAElDG,KAAKI,QAA8Ba,cAAc,KAC9C,MAAMC,EAASlB,KAAKmB,8BAChB,GAAInB,KAAKD,SAAU,CACfC,KAAKD,SAASmB,EAAOE,QAASpB,KAAKC,SACvC,IAGR,OAAOD,KAAKI,OAChB,CAMUiB,WACN,OAAOrB,KAAKI,QAAWJ,KAAKI,QAA8BiB,WAAa,IAC3E,CAKUC,aACN,GAAItB,KAAKI,SAAWJ,KAAKL,SAAU,CAC/B,IAAKK,KAAKG,WAAY,OACrBH,KAAKI,QAAgCmB,YAAY,aAAcvB,KAAKL,SAASqB,IAAID,SACtF,CACJ,EACH,IAAAS,EAAA,CAAAC,WAAA,MAAAD,EAAA/B,mBAAA,OAAA+B,CAAA","ignoreList":[]}
|
|
@@ -47,7 +47,7 @@ export class VoiceInputPlugin extends BasePlugin {
|
|
|
47
47
|
this.applyCommonDirectives(this.control, metadata, modelName);
|
|
48
48
|
|
|
49
49
|
(this.control as VoiceInputControl).attachCapture(() => {
|
|
50
|
-
const result = this.
|
|
50
|
+
const result = this.validateAndApplyVisualState();
|
|
51
51
|
if (this.onChange) {
|
|
52
52
|
this.onChange(result.isValid, this.fieldKey);
|
|
53
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LiveSearchPlugin-dbg.js","names":["BasePlugin","___controls_BasePlugin","Logger","____utils_Logger","LiveSearchPlugin","render","fieldMetadata","bindingPath","modelName","metadata","input","Input","value","enabled","ui","readOnly","placeholder","showSuggestion","suggest","oEvent","query","getParameter","fetchSuggestions","change","validate","control","vhConfig","valueHelp","url","error","removeAllSuggestionItems","setBusy","fetch","then","res","json","data","keyPath","textPath","lowerQuery","toLowerCase","filteredData","filter","item","textValue","String","includes","forEach","itemData","addSuggestionItem","Item","key","text","catch","err","message","finally","getValue","applyState","setEnabled","__exports","__esModule"],"sources":["LiveSearchPlugin.ts"],"sourcesContent":["/**\n * @file LiveSearchPlugin.ts\n * @description A custom datasource plugin that provides asynchronous live search (autocomplete) functionality.\n */\n\nimport { BasePlugin } from \"../controls/BasePlugin\";\nimport { IPropertyMetadata, IRemoteValueHelpConfig } from \"../../interfaces/ISchema\";\nimport Input from \"sap/m/Input\";\nimport Item from \"sap/ui/core/Item\";\nimport Control from \"sap/ui/core/Control\";\nimport { Logger } from \"../../utils/Logger\";\n\n/**\n * A custom datasource plugin that provides asynchronous live search (autocomplete) functionality.\n * As the user types, it fetches suggestions from a remote endpoint.\n * \n * @namespace nz.co.siliconst.ui5.metaui.plugins.datasources\n * @public\n */\nexport class LiveSearchPlugin extends BasePlugin {\n public render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName: string = \"meta\"): Control {\n this.metadata = fieldMetadata;\n \n const input = new Input({\n value: `{${modelName}>${bindingPath}}`,\n enabled: !fieldMetadata.ui?.readOnly,\n placeholder: \"Type to search...\",\n showSuggestion: true,\n suggest: (oEvent: sap.ui.base.Event) => {\n const query = (oEvent as sap.ui.base.Event).getParameter(\"suggestValue\");\n this.fetchSuggestions(input, query);\n },\n change: (oEvent: sap.ui.base.Event) => {\n this.validate();\n }\n });\n\n this.control = input;\n return this.control as Control;\n }\n\n /**\n * Executes the REST fetch for suggestions based on a query. Can be overridden by mock subclasses.\n * @param input The UI5 Input to populate with suggestions.\n * @param query The text typed by the user.\n */\n protected fetchSuggestions(input: Input, query: string): void {\n const vhConfig = this.metadata?.valueHelp as IRemoteValueHelpConfig;\n if (!vhConfig || !vhConfig.url) {\n Logger.error(\"LiveSearchPlugin requires a valid valueHelp configuration with a URL.\", \"\", \"LiveSearchPlugin\");\n return;\n }\n\n if (!query) {\n input.removeAllSuggestionItems();\n return;\n }\n \n input.setBusy(true);\n \n // In a real application, the query parameter would be passed to the backend (e.g. ?q=query)\n // Here, we simulate fetching and filter locally, but subclasses can override this entirely.\n fetch(vhConfig.url)\n .then(res => res.json())\n .then((data: unknown[]) => {\n const keyPath = vhConfig.keyPath || \"key\";\n const textPath = vhConfig.textPath || \"text\";\n \n input.removeAllSuggestionItems();\n\n // Simple client-side filter for demonstration\n const lowerQuery = query.toLowerCase();\n const filteredData = data.filter(item => {\n const textValue = String(item[textPath] || item[keyPath]).toLowerCase();\n return textValue.includes(lowerQuery);\n });\n \n filteredData.forEach(itemData => {\n input.addSuggestionItem(new Item({ \n key: itemData[keyPath], \n text: itemData[textPath] || itemData[keyPath]\n }));\n });\n })\n .catch(err => {\n Logger.error(\"Failed to load value help from \" + vhConfig.url, err.message, \"LiveSearchPlugin\");\n })\n .finally(() => {\n input.setBusy(false);\n });\n }\n\n /**\n * Retrieves the current input value.\n * @returns {unknown} The input text.\n */\n protected getValue(): unknown {\n return this.control ? (this.control as Input).getValue() : null;\n }\n\n /**\n * Applies dynamic read-only state.\n */\n protected applyState(): void {\n if (this.control && this.metadata) {\n (this.control as Input).setEnabled(!this.metadata.ui?.readOnly);\n }\n }\n}\n"],"mappings":";;;EAAA;AACA;AACA;AACA;EAHA,MAKSA,UAAU,GAAAC,sBAAA;EAAA,MAKVC,MAAM,GAAAC,gBAAA;EAEf;AACA;AACA;AACA;AACA;AACA;AACA;EACO,MAAMC,gBAAgB,SAASJ,UAAU,CAAC;IACtCK,MAAMA,CAACC,aAAgC,EAAEC,WAAmB,EAA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ugin","___controls_BasePlugin","Logger","____utils_Logger","LiveSearchPlugin","render","fieldMetadata","bindingPath","modelName","metadata","input","Input","value","enabled","ui","readOnly","placeholder","showSuggestion","suggest","oEvent","query","getParameter","fetchSuggestions","change","validate","control","vhConfig","valueHelp","url","error","removeAllSuggestionItems","setBusy","fetch","then","res","json","data","keyPath","textPath","lowerQuery","toLowerCase","filteredData","filter","item","textValue","String","includes","forEach","itemData","addSuggestionItem","Item","key","text","catch","err","message","finally","getValue","applyState","setEnabled","__exports","__esModule"],"sources":["LiveSearchPlugin.ts"],"sourcesContent":["/**\n * @file LiveSearchPlugin.ts\n * @description A custom datasource plugin that provides asynchronous live search (autocomplete) functionality.\n */\n\nimport { BasePlugin } from \"../controls/BasePlugin\";\nimport { IPropertyMetadata, IRemoteValueHelpConfig } from \"../../interfaces/ISchema\";\nimport Input from \"sap/m/Input\";\nimport Item from \"sap/ui/core/Item\";\nimport Control from \"sap/ui/core/Control\";\nimport { Logger } from \"../../utils/Logger\";\n\n/**\n * A custom datasource plugin that provides asynchronous live search (autocomplete) functionality.\n * As the user types, it fetches suggestions from a remote endpoint.\n * \n * @namespace nz.co.siliconst.ui5.metaui.plugins.datasources\n * @public\n */\nexport class LiveSearchPlugin extends BasePlugin {\n public render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName: string = \"meta\"): Control {\n this.metadata = fieldMetadata;\n \n const input = new Input({\n value: `{${modelName}>${bindingPath}}`,\n enabled: !fieldMetadata.ui?.readOnly,\n placeholder: \"Type to search...\",\n showSuggestion: true,\n suggest: (oEvent: sap.ui.base.Event) => {\n const query = (oEvent as sap.ui.base.Event).getParameter(\"suggestValue\");\n this.fetchSuggestions(input, query);\n },\n change: (oEvent: sap.ui.base.Event) => {\n this.validate();\n }\n });\n\n this.control = input;\n return this.control as Control;\n }\n\n /**\n * Executes the REST fetch for suggestions based on a query. Can be overridden by mock subclasses.\n * @param input The UI5 Input to populate with suggestions.\n * @param query The text typed by the user.\n */\n protected fetchSuggestions(input: Input, query: string): void {\n const vhConfig = this.metadata?.valueHelp as IRemoteValueHelpConfig;\n if (!vhConfig || !vhConfig.url) {\n Logger.error(\"LiveSearchPlugin requires a valid valueHelp configuration with a URL.\", \"\", \"LiveSearchPlugin\");\n return;\n }\n\n if (!query) {\n input.removeAllSuggestionItems();\n return;\n }\n \n input.setBusy(true);\n \n // In a real application, the query parameter would be passed to the backend (e.g. ?q=query)\n // Here, we simulate fetching and filter locally, but subclasses can override this entirely.\n fetch(vhConfig.url)\n .then(res => res.json())\n .then((data: Record<string, unknown>[]) => {\n const keyPath = vhConfig.keyPath || \"key\";\n const textPath = vhConfig.textPath || \"text\";\n \n input.removeAllSuggestionItems();\n\n // Simple client-side filter for demonstration\n const lowerQuery = query.toLowerCase();\n const filteredData = data.filter(item => {\n const textValue = String(item[textPath] || item[keyPath]).toLowerCase();\n return textValue.includes(lowerQuery);\n });\n \n filteredData.forEach(itemData => {\n input.addSuggestionItem(new Item({ \n key: itemData[keyPath], \n text: itemData[textPath] || itemData[keyPath]\n }));\n });\n })\n .catch(err => {\n Logger.error(\"Failed to load value help from \" + vhConfig.url, err.message, \"LiveSearchPlugin\");\n })\n .finally(() => {\n input.setBusy(false);\n });\n }\n\n /**\n * Retrieves the current input value.\n * @returns {unknown} The input text.\n */\n protected getValue(): unknown {\n return this.control ? (this.control as Input).getValue() : null;\n }\n\n /**\n * Applies dynamic read-only state.\n */\n protected applyState(): void {\n if (this.control && this.metadata) {\n (this.control as Input).setEnabled(!this.metadata.ui?.readOnly);\n }\n }\n}\n"],"mappings":";;;EAAA;AACA;AACA;AACA;EAHA,MAKSA,UAAU,GAAAC,sBAAA;EAAA,MAKVC,MAAM,GAAAC,gBAAA;EAEf;AACA;AACA;AACA;AACA;AACA;AACA;EACO,MAAMC,gBAAgB,SAASJ,UAAU,CAAC;IACtCK,MAAMA,CAACC,aAAgC,EAAEC,WAAmB,EAAEC,SAAiB,GAAG,MAAM,EAAW;MACtG,IAAI,CAACC,QAAQ,GAA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C,IAAI,CAAClD,QAAQ,CAACK,EAAE,EAAEC,QAAQ,CAAC;MACnE;IACJ;EACJ;EAAC,IAAA6C,SAAA;IAAAC,UAAA;EAAA;EAAAD,SAAA,CAAAxD,gBAAA,GAAAA,gBAAA;EAAA,OAAAwD,SAAA;AAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LiveSearchPlugin.js","names":["BasePlugin","___controls_BasePlugin","Logger","____utils_Logger","LiveSearchPlugin","render","fieldMetadata","bindingPath","modelName","this","metadata","input","Input","value","enabled","ui","readOnly","placeholder","showSuggestion","suggest","oEvent","query","getParameter","fetchSuggestions","change","validate","control","vhConfig","valueHelp","url","error","removeAllSuggestionItems","setBusy","fetch","then","res","json","data","keyPath","textPath","lowerQuery","toLowerCase","filteredData","filter","item","textValue","String","includes","forEach","itemData","addSuggestionItem","Item","key","text","catch","err","message","finally","getValue","applyState","setEnabled","__exports","__esModule"],"sources":["LiveSearchPlugin.ts"],"sourcesContent":["/**\n * @file LiveSearchPlugin.ts\n * @description A custom datasource plugin that provides asynchronous live search (autocomplete) functionality.\n */\n\nimport { BasePlugin } from \"../controls/BasePlugin\";\nimport { IPropertyMetadata, IRemoteValueHelpConfig } from \"../../interfaces/ISchema\";\nimport Input from \"sap/m/Input\";\nimport Item from \"sap/ui/core/Item\";\nimport Control from \"sap/ui/core/Control\";\nimport { Logger } from \"../../utils/Logger\";\n\n/**\n * A custom datasource plugin that provides asynchronous live search (autocomplete) functionality.\n * As the user types, it fetches suggestions from a remote endpoint.\n * \n * @namespace nz.co.siliconst.ui5.metaui.plugins.datasources\n * @public\n */\nexport class LiveSearchPlugin extends BasePlugin {\n public render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName: string = \"meta\"): Control {\n this.metadata = fieldMetadata;\n \n const input = new Input({\n value: `{${modelName}>${bindingPath}}`,\n enabled: !fieldMetadata.ui?.readOnly,\n placeholder: \"Type to search...\",\n showSuggestion: true,\n suggest: (oEvent: sap.ui.base.Event) => {\n const query = (oEvent as sap.ui.base.Event).getParameter(\"suggestValue\");\n this.fetchSuggestions(input, query);\n },\n change: (oEvent: sap.ui.base.Event) => {\n this.validate();\n }\n });\n\n this.control = input;\n return this.control as Control;\n }\n\n /**\n * Executes the REST fetch for suggestions based on a query. Can be overridden by mock subclasses.\n * @param input The UI5 Input to populate with suggestions.\n * @param query The text typed by the user.\n */\n protected fetchSuggestions(input: Input, query: string): void {\n const vhConfig = this.metadata?.valueHelp as IRemoteValueHelpConfig;\n if (!vhConfig || !vhConfig.url) {\n Logger.error(\"LiveSearchPlugin requires a valid valueHelp configuration with a URL.\", \"\", \"LiveSearchPlugin\");\n return;\n }\n\n if (!query) {\n input.removeAllSuggestionItems();\n return;\n }\n \n input.setBusy(true);\n \n // In a real application, the query parameter would be passed to the backend (e.g. ?q=query)\n // Here, we simulate fetching and filter locally, but subclasses can override this entirely.\n fetch(vhConfig.url)\n .then(res => res.json())\n .then((data: unknown[]) => {\n const keyPath = vhConfig.keyPath || \"key\";\n const textPath = vhConfig.textPath || \"text\";\n \n input.removeAllSuggestionItems();\n\n // Simple client-side filter for demonstration\n const lowerQuery = query.toLowerCase();\n const filteredData = data.filter(item => {\n const textValue = String(item[textPath] || item[keyPath]).toLowerCase();\n return textValue.includes(lowerQuery);\n });\n \n filteredData.forEach(itemData => {\n input.addSuggestionItem(new Item({ \n key: itemData[keyPath], \n text: itemData[textPath] || itemData[keyPath]\n }));\n });\n })\n .catch(err => {\n Logger.error(\"Failed to load value help from \" + vhConfig.url, err.message, \"LiveSearchPlugin\");\n })\n .finally(() => {\n input.setBusy(false);\n });\n }\n\n /**\n * Retrieves the current input value.\n * @returns {unknown} The input text.\n */\n protected getValue(): unknown {\n return this.control ? (this.control as Input).getValue() : null;\n }\n\n /**\n * Applies dynamic read-only state.\n */\n protected applyState(): void {\n if (this.control && this.metadata) {\n (this.control as Input).setEnabled(!this.metadata.ui?.readOnly);\n }\n }\n}\n"],"mappings":"8HAAA,M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C,aACN,GAAIlD,KAAKiB,SAAWjB,KAAKC,SAAU,CAC9BD,KAAKiB,QAAkBkC,YAAYnD,KAAKC,SAASK,IAAIC,SAC1D,CACJ,EACH,IAAA6C,EAAA,CAAAC,WAAA,MAAAD,EAAAzD,mBAAA,OAAAyD,CAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"LiveSearchPlugin.js","names":["BasePlugin","___controls_BasePlugin","Logger","____utils_Logger","LiveSearchPlugin","render","fieldMetadata","bindingPath","modelName","this","metadata","input","Input","value","enabled","ui","readOnly","placeholder","showSuggestion","suggest","oEvent","query","getParameter","fetchSuggestions","change","validate","control","vhConfig","valueHelp","url","error","removeAllSuggestionItems","setBusy","fetch","then","res","json","data","keyPath","textPath","lowerQuery","toLowerCase","filteredData","filter","item","textValue","String","includes","forEach","itemData","addSuggestionItem","Item","key","text","catch","err","message","finally","getValue","applyState","setEnabled","__exports","__esModule"],"sources":["LiveSearchPlugin.ts"],"sourcesContent":["/**\n * @file LiveSearchPlugin.ts\n * @description A custom datasource plugin that provides asynchronous live search (autocomplete) functionality.\n */\n\nimport { BasePlugin } from \"../controls/BasePlugin\";\nimport { IPropertyMetadata, IRemoteValueHelpConfig } from \"../../interfaces/ISchema\";\nimport Input from \"sap/m/Input\";\nimport Item from \"sap/ui/core/Item\";\nimport Control from \"sap/ui/core/Control\";\nimport { Logger } from \"../../utils/Logger\";\n\n/**\n * A custom datasource plugin that provides asynchronous live search (autocomplete) functionality.\n * As the user types, it fetches suggestions from a remote endpoint.\n * \n * @namespace nz.co.siliconst.ui5.metaui.plugins.datasources\n * @public\n */\nexport class LiveSearchPlugin extends BasePlugin {\n public render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName: string = \"meta\"): Control {\n this.metadata = fieldMetadata;\n \n const input = new Input({\n value: `{${modelName}>${bindingPath}}`,\n enabled: !fieldMetadata.ui?.readOnly,\n placeholder: \"Type to search...\",\n showSuggestion: true,\n suggest: (oEvent: sap.ui.base.Event) => {\n const query = (oEvent as sap.ui.base.Event).getParameter(\"suggestValue\");\n this.fetchSuggestions(input, query);\n },\n change: (oEvent: sap.ui.base.Event) => {\n this.validate();\n }\n });\n\n this.control = input;\n return this.control as Control;\n }\n\n /**\n * Executes the REST fetch for suggestions based on a query. Can be overridden by mock subclasses.\n * @param input The UI5 Input to populate with suggestions.\n * @param query The text typed by the user.\n */\n protected fetchSuggestions(input: Input, query: string): void {\n const vhConfig = this.metadata?.valueHelp as IRemoteValueHelpConfig;\n if (!vhConfig || !vhConfig.url) {\n Logger.error(\"LiveSearchPlugin requires a valid valueHelp configuration with a URL.\", \"\", \"LiveSearchPlugin\");\n return;\n }\n\n if (!query) {\n input.removeAllSuggestionItems();\n return;\n }\n \n input.setBusy(true);\n \n // In a real application, the query parameter would be passed to the backend (e.g. ?q=query)\n // Here, we simulate fetching and filter locally, but subclasses can override this entirely.\n fetch(vhConfig.url)\n .then(res => res.json())\n .then((data: Record<string, unknown>[]) => {\n const keyPath = vhConfig.keyPath || \"key\";\n const textPath = vhConfig.textPath || \"text\";\n \n input.removeAllSuggestionItems();\n\n // Simple client-side filter for demonstration\n const lowerQuery = query.toLowerCase();\n const filteredData = data.filter(item => {\n const textValue = String(item[textPath] || item[keyPath]).toLowerCase();\n return textValue.includes(lowerQuery);\n });\n \n filteredData.forEach(itemData => {\n input.addSuggestionItem(new Item({ \n key: itemData[keyPath], \n text: itemData[textPath] || itemData[keyPath]\n }));\n });\n })\n .catch(err => {\n Logger.error(\"Failed to load value help from \" + vhConfig.url, err.message, \"LiveSearchPlugin\");\n })\n .finally(() => {\n input.setBusy(false);\n });\n }\n\n /**\n * Retrieves the current input value.\n * @returns {unknown} The input text.\n */\n protected getValue(): unknown {\n return this.control ? (this.control as Input).getValue() : null;\n }\n\n /**\n * Applies dynamic read-only state.\n */\n protected applyState(): void {\n if (this.control && this.metadata) {\n (this.control as Input).setEnabled(!this.metadata.ui?.readOnly);\n }\n }\n}\n"],"mappings":"8HAAA,MAKSA,EAAUC,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D,KAAKiB,SAAWjB,KAAKC,SAAU,CAC9BD,KAAKiB,QAAkBkC,YAAYnD,KAAKC,SAASK,IAAIC,SAC1D,CACJ,EACH,IAAA6C,EAAA,CAAAC,WAAA,MAAAD,EAAAzD,mBAAA,OAAAyD,CAAA","ignoreList":[]}
|
|
@@ -62,7 +62,7 @@ export class LiveSearchPlugin extends BasePlugin {
|
|
|
62
62
|
// Here, we simulate fetching and filter locally, but subclasses can override this entirely.
|
|
63
63
|
fetch(vhConfig.url)
|
|
64
64
|
.then(res => res.json())
|
|
65
|
-
.then((data: unknown[]) => {
|
|
65
|
+
.then((data: Record<string, unknown>[]) => {
|
|
66
66
|
const keyPath = vhConfig.keyPath || "key";
|
|
67
67
|
const textPath = vhConfig.textPath || "text";
|
|
68
68
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteValueHelpPlugin-dbg.js","names":["BasePlugin","___controls_BasePlugin","Logger","____utils_Logger","RemoteValueHelpPlugin","isLoaded","render","fieldMetadata","bindingPath","modelName","metadata","comboBox","ComboBox","selectedKey","enabled","ui","readOnly","placeholder","change","oEvent","item","getParameter","val","getKey","validate","attachEventOnce","fetchData","control","vhConfig","valueHelp","url","error","setBusy","fetch","then","res","json","data","keyPath","textPath","forEach","itemData","addItem","Item","key","text","catch","err","message","finally","getValue","getSelectedKey","applyState","setEnabled","__exports","__esModule"],"sources":["RemoteValueHelpPlugin.ts"],"sourcesContent":["/**\n * @file RemoteValueHelpPlugin.ts\n * @description A custom datasource plugin that simulates fetching data from a remote server.\n */\n\nimport { BasePlugin } from \"../controls/BasePlugin\";\nimport { IPropertyMetadata, IRemoteValueHelpConfig } from \"../../interfaces/ISchema\";\nimport ComboBox from \"sap/m/ComboBox\";\nimport Item from \"sap/ui/core/Item\";\nimport Control from \"sap/ui/core/Control\";\nimport { Logger } from \"../../utils/Logger\";\n\n/**\n * A custom datasource plugin that simulates fetching data from a remote server.\n * Proves out custom data sources that dynamically load value help.\n * \n * @namespace nz.co.siliconst.ui5.metaui.plugins.datasources\n * @public\n */\nexport class RemoteValueHelpPlugin extends BasePlugin {\n private isLoaded = false;\n\n /**\n * Renders a `ComboBox` that simulates fetching data from a remote server.\n * \n * @param fieldMetadata The specific JSON schema properties for this field.\n * @param bindingPath The JSON path bound to this control.\n * @param modelName The UI5 JSONModel name.\n * @returns {Control} The configured ComboBox control.\n */\n public render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName: string = \"meta\"): Control {\n this.metadata = fieldMetadata;\n \n const comboBox = new ComboBox({\n selectedKey: `{${modelName}>${bindingPath}}`,\n enabled: !fieldMetadata.ui?.readOnly,\n placeholder: \"Select a country...\",\n change: (oEvent: sap.ui.base.Event) => {\n const item = (oEvent as sap.ui.base.Event).getParameter(\"selectedItem\");\n const val = item ? item.getKey() : (oEvent as sap.ui.base.Event).getParameter(\"value\"); // Allow free text as well\n this.validate();\n }\n });\n\n // Perform an async load against the REST endpoint\n comboBox.attachEventOnce(\"loadItems\", () => {\n this.fetchData(comboBox);\n });\n\n this.control = comboBox;\n return this.control as Control;\n }\n\n /**\n * Executes the REST fetch for data.\n * @param comboBox The UI5 ComboBox to populate.\n */\n protected fetchData(comboBox: ComboBox): void {\n const vhConfig = this.metadata?.valueHelp as IRemoteValueHelpConfig;\n if (!vhConfig || !vhConfig.url) {\n Logger.error(\"RemoteValueHelpPlugin requires a valid valueHelp configuration with a URL.\", \"\", \"RemoteValueHelpPlugin\");\n return;\n }\n \n comboBox.setBusy(true);\n \n fetch(vhConfig.url)\n .then(res => res.json())\n .then((data: unknown[]) => {\n const keyPath = vhConfig.keyPath || \"key\";\n const textPath = vhConfig.textPath || \"text\";\n \n data.forEach(itemData => {\n comboBox.addItem(new Item({ \n key: itemData[keyPath], \n text: itemData[textPath] || itemData[keyPath]\n }));\n });\n })\n .catch(err => {\n Logger.error(\"Failed to load value help from \" + vhConfig.url, err.message, \"RemoteValueHelpPlugin\");\n })\n .finally(() => {\n comboBox.setBusy(false);\n this.isLoaded = true;\n });\n }\n\n /**\n * Retrieves the current selected key.\n * @returns {unknown} The selected key.\n */\n protected getValue(): unknown {\n return this.control ? (this.control as ComboBox).getSelectedKey() : null;\n }\n\n /**\n * Applies dynamic read-only state.\n */\n protected applyState(): void {\n if (this.control && this.metadata) {\n (this.control as ComboBox).setEnabled(!this.metadata.ui?.readOnly);\n }\n }\n}\n"],"mappings":";;;EAAA;AACA;AACA;AACA;EAHA,MAKSA,UAAU,GAAAC,sBAAA;EAAA,MAKVC,MAAM,GAAAC,gBAAA;EAEf;AACA;AACA;AACA;AACA;AACA;AACA;EACO,MAAMC,qBAAqB,SAASJ,UAAU,CAAC;IAC1CK,QAAQ,GAAG,KAAK;;IAExB;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;IACWC,MAAMA,CAACC,aAAgC,EAAEC,WAAmB,EAAEC,SAAiB,GAAG,MAAM,EAAW;MACtG,IAAI,CAACC,QAAQ,GAAGH,aAAa;MAE7B,MAAMI,QAAQ,GAAG,IAAIC,QAAQ,CAAC;QAC1BC,WAAW,EAAE,IAAIJ,SAAS,IAAID,WAAW,GAAG;QAC5CM,OAAO,EAAE,CAACP,aAAa,CAACQ,EAAE,EAAEC,QAAQ;QACpCC,WAAW,EAAE,qBAAqB;QAClCC,MAAM,EAAGC,MAAyB,IAAK;UACnC,MAAMC,IAAI,GAAID,MAAM,CAAuBE,YAAY,CAAC,cAAc,CAAC;UACvE,MAAMC,GAAG,GAAGF,IAAI,GAAGA,IAAI,CAACG,MAAM,CAAC,CAAC,GAAIJ,MAAM,CAAuBE,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;UACxF,IAAI,CAACG,QAAQ,CAAC,CAAC;QACnB;MACJ,CAAC,CAAC;;MAEF;MACAb,QAAQ,CAACc,eAAe,CAAC,WAAW,EAAE,MAAM;QACxC,IAAI,CAACC,SAAS,CAACf,QAAQ,CAAC;MAC5B,CAAC,CAAC;MAEF,IAAI,CAACgB,OAAO,GAAGhB,QAAQ;MACvB,OAAO,IAAI,CAACgB,OAAO;IACvB;;IAEA;AACJ;AACA;AACA;IACcD,SAASA,CAACf,QAAkB,EAAQ;MAC1C,MAAMiB,QAAQ,GAAG,IAAI,CAAClB,QAAQ,EAAEmB,SAAmC;MACnE,IAAI,CAACD,QAAQ,IAAI,CAACA,QAAQ,CAACE,GAAG,EAAE;QAC5B5B,MAAM,CAAC6B,KAAK,CAAC,4EAA4E,EAAE,EAAE,EAAE,uBAAuB,CAAC;QACvH;MACJ;MAEApB,QAAQ,CAACqB,OAAO,CAAC,IAAI,CAAC;MAEtBC,KAAK,CAACL,QAAQ,CAACE,GAAG,CAAC,CACdI,IAAI,CAACC,GAAG,IAAIA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC,CACvBF,IAAI,CAAEG,
|
|
1
|
+
{"version":3,"file":"RemoteValueHelpPlugin-dbg.js","names":["BasePlugin","___controls_BasePlugin","Logger","____utils_Logger","RemoteValueHelpPlugin","isLoaded","render","fieldMetadata","bindingPath","modelName","metadata","comboBox","ComboBox","selectedKey","enabled","ui","readOnly","placeholder","change","oEvent","item","getParameter","val","getKey","validate","attachEventOnce","fetchData","control","vhConfig","valueHelp","url","error","setBusy","fetch","then","res","json","data","keyPath","textPath","forEach","itemData","addItem","Item","key","text","catch","err","message","finally","getValue","getSelectedKey","applyState","setEnabled","__exports","__esModule"],"sources":["RemoteValueHelpPlugin.ts"],"sourcesContent":["/**\n * @file RemoteValueHelpPlugin.ts\n * @description A custom datasource plugin that simulates fetching data from a remote server.\n */\n\nimport { BasePlugin } from \"../controls/BasePlugin\";\nimport { IPropertyMetadata, IRemoteValueHelpConfig } from \"../../interfaces/ISchema\";\nimport ComboBox from \"sap/m/ComboBox\";\nimport Item from \"sap/ui/core/Item\";\nimport Control from \"sap/ui/core/Control\";\nimport { Logger } from \"../../utils/Logger\";\n\n/**\n * A custom datasource plugin that simulates fetching data from a remote server.\n * Proves out custom data sources that dynamically load value help.\n * \n * @namespace nz.co.siliconst.ui5.metaui.plugins.datasources\n * @public\n */\nexport class RemoteValueHelpPlugin extends BasePlugin {\n private isLoaded = false;\n\n /**\n * Renders a `ComboBox` that simulates fetching data from a remote server.\n * \n * @param fieldMetadata The specific JSON schema properties for this field.\n * @param bindingPath The JSON path bound to this control.\n * @param modelName The UI5 JSONModel name.\n * @returns {Control} The configured ComboBox control.\n */\n public render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName: string = \"meta\"): Control {\n this.metadata = fieldMetadata;\n \n const comboBox = new ComboBox({\n selectedKey: `{${modelName}>${bindingPath}}`,\n enabled: !fieldMetadata.ui?.readOnly,\n placeholder: \"Select a country...\",\n change: (oEvent: sap.ui.base.Event) => {\n const item = (oEvent as sap.ui.base.Event).getParameter(\"selectedItem\");\n const val = item ? item.getKey() : (oEvent as sap.ui.base.Event).getParameter(\"value\"); // Allow free text as well\n this.validate();\n }\n });\n\n // Perform an async load against the REST endpoint\n comboBox.attachEventOnce(\"loadItems\", () => {\n this.fetchData(comboBox);\n });\n\n this.control = comboBox;\n return this.control as Control;\n }\n\n /**\n * Executes the REST fetch for data.\n * @param comboBox The UI5 ComboBox to populate.\n */\n protected fetchData(comboBox: ComboBox): void {\n const vhConfig = this.metadata?.valueHelp as IRemoteValueHelpConfig;\n if (!vhConfig || !vhConfig.url) {\n Logger.error(\"RemoteValueHelpPlugin requires a valid valueHelp configuration with a URL.\", \"\", \"RemoteValueHelpPlugin\");\n return;\n }\n \n comboBox.setBusy(true);\n \n fetch(vhConfig.url)\n .then(res => res.json())\n .then((data: Record<string, unknown>[]) => {\n const keyPath = vhConfig.keyPath || \"key\";\n const textPath = vhConfig.textPath || \"text\";\n \n data.forEach(itemData => {\n comboBox.addItem(new Item({ \n key: itemData[keyPath], \n text: itemData[textPath] || itemData[keyPath]\n }));\n });\n })\n .catch(err => {\n Logger.error(\"Failed to load value help from \" + vhConfig.url, err.message, \"RemoteValueHelpPlugin\");\n })\n .finally(() => {\n comboBox.setBusy(false);\n this.isLoaded = true;\n });\n }\n\n /**\n * Retrieves the current selected key.\n * @returns {unknown} The selected key.\n */\n protected getValue(): unknown {\n return this.control ? (this.control as ComboBox).getSelectedKey() : null;\n }\n\n /**\n * Applies dynamic read-only state.\n */\n protected applyState(): void {\n if (this.control && this.metadata) {\n (this.control as ComboBox).setEnabled(!this.metadata.ui?.readOnly);\n }\n }\n}\n"],"mappings":";;;EAAA;AACA;AACA;AACA;EAHA,MAKSA,UAAU,GAAAC,sBAAA;EAAA,MAKVC,MAAM,GAAAC,gBAAA;EAEf;AACA;AACA;AACA;AACA;AACA;AACA;EACO,MAAMC,qBAAqB,SAASJ,UAAU,CAAC;IAC1CK,QAAQ,GAAG,KAAK;;IAExB;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;IACWC,MAAMA,CAACC,aAAgC,EAAEC,WAAmB,EAAEC,SAAiB,GAAG,MAAM,EAAW;MACtG,IAAI,CAACC,QAAQ,GAAGH,aAAa;MAE7B,MAAMI,QAAQ,GAAG,IAAIC,QAAQ,CAAC;QAC1BC,WAAW,EAAE,IAAIJ,SAAS,IAAID,WAAW,GAAG;QAC5CM,OAAO,EAAE,CAACP,aAAa,CAACQ,EAAE,EAAEC,QAAQ;QACpCC,WAAW,EAAE,qBAAqB;QAClCC,MAAM,EAAGC,MAAyB,IAAK;UACnC,MAAMC,IAAI,GAAID,MAAM,CAAuBE,YAAY,CAAC,cAAc,CAAC;UACvE,MAAMC,GAAG,GAAGF,IAAI,GAAGA,IAAI,CAACG,MAAM,CAAC,CAAC,GAAIJ,MAAM,CAAuBE,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;UACxF,IAAI,CAACG,QAAQ,CAAC,CAAC;QACnB;MACJ,CAAC,CAAC;;MAEF;MACAb,QAAQ,CAACc,eAAe,CAAC,WAAW,EAAE,MAAM;QACxC,IAAI,CAACC,SAAS,CAACf,QAAQ,CAAC;MAC5B,CAAC,CAAC;MAEF,IAAI,CAACgB,OAAO,GAAGhB,QAAQ;MACvB,OAAO,IAAI,CAACgB,O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