@siliconst/metaui 1.0.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +134 -123
- package/package.json +3 -2
- package/src/nz/co/siliconst/ui5/metaui/.library +7 -7
- package/src/nz/co/siliconst/ui5/metaui/controls/GeneratorHost-dbg.js +299 -163
- package/src/nz/co/siliconst/ui5/metaui/controls/GeneratorHost-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/GeneratorHost.d.ts +54 -6
- package/src/nz/co/siliconst/ui5/metaui/controls/GeneratorHost.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/GeneratorHost.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/GeneratorHost.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/GeneratorHost.ts +292 -162
- package/src/nz/co/siliconst/ui5/metaui/core/ConditionEngine-dbg.js +51 -43
- package/src/nz/co/siliconst/ui5/metaui/core/ConditionEngine-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/ConditionEngine.d.ts +5 -0
- package/src/nz/co/siliconst/ui5/metaui/core/ConditionEngine.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/ConditionEngine.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/ConditionEngine.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/ConditionEngine.ts +49 -40
- package/src/nz/co/siliconst/ui5/metaui/core/Engine-dbg.js +81 -58
- package/src/nz/co/siliconst/ui5/metaui/core/Engine-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/Engine.d.ts +5 -12
- package/src/nz/co/siliconst/ui5/metaui/core/Engine.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/Engine.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/Engine.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/Engine.ts +82 -56
- package/src/nz/co/siliconst/ui5/metaui/core/EventBus-dbg.js +65 -50
- package/src/nz/co/siliconst/ui5/metaui/core/EventBus-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/EventBus.d.ts +9 -0
- package/src/nz/co/siliconst/ui5/metaui/core/EventBus.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/EventBus.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/EventBus.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/EventBus.ts +60 -45
- package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry-dbg.js +72 -59
- package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry.d.ts +6 -4
- package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry.ts +71 -56
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer-dbg.js +145 -36
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer.d.ts +13 -8
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer.ts +157 -31
- package/src/nz/co/siliconst/ui5/metaui/core/StateManager-dbg.js +55 -55
- package/src/nz/co/siliconst/ui5/metaui/core/StateManager-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/StateManager.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/StateManager.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/StateManager.ts +56 -56
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IEventBus-dbg.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IEventBus-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IEventBus.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IEventBus.ts +29 -29
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ILayoutManager-dbg.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ILayoutManager-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ILayoutManager.d.ts +6 -12
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ILayoutManager.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ILayoutManager.ts +21 -26
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IPlugin-dbg.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IPlugin.d.ts +3 -20
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IPlugin.ts +14 -33
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchema-dbg.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchema-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchema.d.ts +33 -43
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchema.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchema.ts +70 -70
- package/src/nz/co/siliconst/ui5/metaui/layouts/BaseLayout-dbg.js +23 -38
- package/src/nz/co/siliconst/ui5/metaui/layouts/BaseLayout-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/BaseLayout.d.ts +4 -17
- package/src/nz/co/siliconst/ui5/metaui/layouts/BaseLayout.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/BaseLayout.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/BaseLayout.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/BaseLayout.ts +22 -34
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout-dbg.js +98 -56
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout.d.ts +7 -7
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout.ts +97 -60
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout-dbg.js +102 -90
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout.d.ts +4 -8
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout.ts +119 -102
- package/src/nz/co/siliconst/ui5/metaui/library-dbg.js +43 -32
- package/src/nz/co/siliconst/ui5/metaui/library-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/library-preload.js +22 -17
- package/src/nz/co/siliconst/ui5/metaui/library-preload.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/library.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/library.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/library.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/library.ts +55 -43
- package/src/nz/co/siliconst/ui5/metaui/manifest.json +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/ArrayPlugin-dbg.js +68 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/ArrayPlugin-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/ArrayPlugin.d.ts +15 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/ArrayPlugin.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/ArrayPlugin.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/ArrayPlugin.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/ArrayPlugin.ts +71 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/BasePlugin-dbg.js +54 -59
- package/src/nz/co/siliconst/ui5/metaui/plugins/BasePlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/BasePlugin.d.ts +8 -27
- package/src/nz/co/siliconst/ui5/metaui/plugins/BasePlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/BasePlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/BasePlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/BasePlugin.ts +56 -58
- package/src/nz/co/siliconst/ui5/metaui/plugins/BooleanPlugin-dbg.js +41 -42
- package/src/nz/co/siliconst/ui5/metaui/plugins/BooleanPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/BooleanPlugin.d.ts +2 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/BooleanPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/BooleanPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/BooleanPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/BooleanPlugin.ts +41 -42
- package/src/nz/co/siliconst/ui5/metaui/plugins/DatePlugin-dbg.js +68 -60
- package/src/nz/co/siliconst/ui5/metaui/plugins/DatePlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/DatePlugin.d.ts +2 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/DatePlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/DatePlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/DatePlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/DatePlugin.ts +69 -63
- package/src/nz/co/siliconst/ui5/metaui/plugins/DateTimePlugin-dbg.js +68 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DateTimePlugin-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DateTimePlugin.d.ts +18 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DateTimePlugin.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DateTimePlugin.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DateTimePlugin.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DateTimePlugin.ts +68 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DropdownPlugin-dbg.js +66 -66
- package/src/nz/co/siliconst/ui5/metaui/plugins/DropdownPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/DropdownPlugin.d.ts +2 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/DropdownPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/DropdownPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/DropdownPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/DropdownPlugin.ts +65 -65
- package/src/nz/co/siliconst/ui5/metaui/plugins/NumberPlugin-dbg.js +55 -53
- package/src/nz/co/siliconst/ui5/metaui/plugins/NumberPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/NumberPlugin.d.ts +3 -3
- package/src/nz/co/siliconst/ui5/metaui/plugins/NumberPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/NumberPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/NumberPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/NumberPlugin.ts +56 -55
- package/src/nz/co/siliconst/ui5/metaui/plugins/StringPlugin-dbg.js +56 -53
- package/src/nz/co/siliconst/ui5/metaui/plugins/StringPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/StringPlugin.d.ts +2 -2
- package/src/nz/co/siliconst/ui5/metaui/plugins/StringPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/StringPlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/StringPlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/StringPlugin.ts +58 -55
- package/src/nz/co/siliconst/ui5/metaui/plugins/SwitchPlugin-dbg.js +43 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/SwitchPlugin-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/SwitchPlugin.d.ts +18 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/SwitchPlugin.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/SwitchPlugin.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/SwitchPlugin.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/SwitchPlugin.ts +42 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TextAreaPlugin-dbg.js +58 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TextAreaPlugin-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TextAreaPlugin.d.ts +18 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TextAreaPlugin.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TextAreaPlugin.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TextAreaPlugin.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TextAreaPlugin.ts +58 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TimePlugin-dbg.js +74 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TimePlugin-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TimePlugin.d.ts +18 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TimePlugin.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TimePlugin.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TimePlugin.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TimePlugin.ts +71 -0
- package/ui5.yaml +3 -3
- package/test-resources/App.js +0 -11
- package/test-resources/Main.controller.js +0 -73
- package/test-resources/Main.view.xml +0 -42
- package/test-resources/index.html +0 -21
- package/test-resources/mockData.json +0 -27
- package/test-resources/mockSchema.json +0 -98
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
sap.ui.define(["./BasePlugin", "sap/m/Switch"], function (___BasePlugin, Switch) {
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @file SwitchPlugin.ts
|
|
6
|
+
* @description Renders a sap.m.Switch for boolean data specifically marked with the switch widget.
|
|
7
|
+
*/
|
|
8
|
+
const BasePlugin = ___BasePlugin["BasePlugin"];
|
|
9
|
+
/**
|
|
10
|
+
* Handles rendering logic for toggleable boolean switches.
|
|
11
|
+
*/
|
|
12
|
+
class SwitchPlugin extends BasePlugin {
|
|
13
|
+
render(fieldMetadata, bindingPath, modelName = "meta") {
|
|
14
|
+
this.metadata = fieldMetadata;
|
|
15
|
+
this.control = new Switch({
|
|
16
|
+
state: `{${modelName}>${bindingPath}}`,
|
|
17
|
+
enabled: !fieldMetadata.ui?.readOnly,
|
|
18
|
+
change: oEvent => {
|
|
19
|
+
const val = oEvent.getParameter("state");
|
|
20
|
+
this.publishChange(val);
|
|
21
|
+
this.validate();
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
return this.control;
|
|
25
|
+
}
|
|
26
|
+
validate() {
|
|
27
|
+
// Boolean states rarely fail validation.
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
applyState() {
|
|
31
|
+
if (this.control && this.metadata) {
|
|
32
|
+
const sw = this.control;
|
|
33
|
+
sw.setEnabled(!this.metadata.ui?.readOnly);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
var __exports = {
|
|
38
|
+
__esModule: true
|
|
39
|
+
};
|
|
40
|
+
__exports.SwitchPlugin = SwitchPlugin;
|
|
41
|
+
return __exports;
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=SwitchPlugin-dbg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwitchPlugin-dbg.js","names":["BasePlugin","___BasePlugin","SwitchPlugin","render","fieldMetadata","bindingPath","modelName","metadata","control","Switch","state","enabled","ui","readOnly","change","oEvent","val","getParameter","publishChange","validate","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\";\n\n/**\n * Handles rendering logic for toggleable boolean switches.\n */\nexport class SwitchPlugin extends BasePlugin {\n public render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName: string = \"meta\"): Control {\n this.metadata = fieldMetadata;\n\n this.control = new Switch({\n state: `{${modelName}>${bindingPath}}`,\n enabled: !fieldMetadata.ui?.readOnly,\n change: (oEvent: any) => {\n const val = oEvent.getParameter(\"state\");\n this.publishChange(val);\n this.validate();\n }\n });\n\n return this.control;\n }\n\n public validate(): boolean {\n // Boolean states rarely fail validation.\n return true;\n }\n\n protected applyState(): void {\n if (this.control && this.metadata) {\n const sw = this.control as Switch;\n sw.setEnabled(!this.metadata.ui?.readOnly);\n }\n }\n}\n"],"mappings":";;;EAAA;AACA;AACA;AACA;EAHA,MAKSA,UAAU,GAAAC,aAAA;EAKnB;AACA;AACA;EACO,MAAMC,YAAY,SAASF,UAAU,CAAC;IAClCG,MAAMA,CAACC,aAAgC,EAAEC,WAAmB,EAAEC,SAAiB,GAAG,MAAM,EAAW;MACtG,IAAI,CAACC,QAAQ,GAAGH,aAAa;MAE7B,IAAI,CAACI,OAAO,GAAG,IAAIC,MAAM,CAAC;QACtBC,KAAK,EAAE,IAAIJ,SAAS,IAAID,WAAW,GAAG;QACtCM,OAAO,EAAE,CAACP,aAAa,CAACQ,EAAE,EAAEC,QAAQ;QACpCC,MAAM,EAAGC,MAAW,IAAK;UACrB,MAAMC,GAAG,GAAGD,MAAM,CAACE,YAAY,CAAC,OAAO,CAAC;UACxC,IAAI,CAACC,aAAa,CAACF,GAAG,CAAC;UACvB,IAAI,CAACG,QAAQ,CAAC,CAAC;QACnB;MACJ,CAAC,CAAC;MAEF,OAAO,IAAI,CAACX,OAAO;IACvB;IAEOW,QAAQA,CAAA,EAAY;MACvB;MACA,OAAO,IAAI;IACf;IAEUC,UAAUA,CAAA,EAAS;MACzB,IAAI,IAAI,CAACZ,OAAO,IAAI,IAAI,CAACD,QAAQ,EAAE;QAC/B,MAAMc,EAAE,GAAG,IAAI,CAACb,OAAiB;QACjCa,EAAE,CAACC,UAAU,CAAC,CAAC,IAAI,CAACf,QAAQ,CAACK,EAAE,EAAEC,QAAQ,CAAC;MAC9C;IACJ;EACJ;EAAC,IAAAU,SAAA;IAAAC,UAAA;EAAA;EAAAD,SAAA,CAAArB,YAAA,GAAAA,YAAA;EAAA,OAAAqB,SAAA;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare module "nz/co/siliconst/ui5/metaui/plugins/SwitchPlugin" {
|
|
2
|
+
/**
|
|
3
|
+
* @file SwitchPlugin.ts
|
|
4
|
+
* @description Renders a sap.m.Switch for boolean data specifically marked with the switch widget.
|
|
5
|
+
*/
|
|
6
|
+
import { BasePlugin } from "nz/co/siliconst/ui5/metaui/plugins/BasePlugin";
|
|
7
|
+
import { IPropertyMetadata } from "nz/co/siliconst/ui5/metaui/interfaces/ISchema";
|
|
8
|
+
import Control from "sap/ui/core/Control";
|
|
9
|
+
/**
|
|
10
|
+
* Handles rendering logic for toggleable boolean switches.
|
|
11
|
+
*/
|
|
12
|
+
export class SwitchPlugin extends BasePlugin {
|
|
13
|
+
render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName?: string): Control;
|
|
14
|
+
validate(): boolean;
|
|
15
|
+
protected applyState(): void;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=SwitchPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwitchPlugin.d.ts","sourceRoot":"../../../../../../../..","sources":["src/nz/co/siliconst/ui5/metaui/plugins/SwitchPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,iDAAiD,CAAC;IACjE;;;OAGG;IAEH,OAAO,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;IAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;IAElF,OAAO,OAAO,MAAM,qBAAqB,CAAC;IAE1C;;OAEG;IACH,MAAa,YAAa,SAAQ,UAAU;QACjC,MAAM,CAAC,aAAa,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,GAAE,MAAe,GAAG,OAAO;QAgBlG,QAAQ,IAAI,OAAO;QAK1B,SAAS,CAAC,UAAU,IAAI,IAAI;KAM/B;CAEA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
sap.ui.define(["./BasePlugin","sap/m/Switch"],function(t,e){"use strict";const a=t["BasePlugin"];class s extends a{render(t,a,s="meta"){this.metadata=t;this.control=new e({state:`{${s}>${a}}`,enabled:!t.ui?.readOnly,change:t=>{const e=t.getParameter("state");this.publishChange(e);this.validate()}});return this.control}validate(){return true}applyState(){if(this.control&&this.metadata){const t=this.control;t.setEnabled(!this.metadata.ui?.readOnly)}}}var n={__esModule:true};n.SwitchPlugin=s;return n});
|
|
2
|
+
//# sourceMappingURL=SwitchPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwitchPlugin.js","names":["BasePlugin","___BasePlugin","SwitchPlugin","render","fieldMetadata","bindingPath","modelName","this","metadata","control","Switch","state","enabled","ui","readOnly","change","oEvent","val","getParameter","publishChange","validate","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\";\n\n/**\n * Handles rendering logic for toggleable boolean switches.\n */\nexport class SwitchPlugin extends BasePlugin {\n public render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName: string = \"meta\"): Control {\n this.metadata = fieldMetadata;\n\n this.control = new Switch({\n state: `{${modelName}>${bindingPath}}`,\n enabled: !fieldMetadata.ui?.readOnly,\n change: (oEvent: any) => {\n const val = oEvent.getParameter(\"state\");\n this.publishChange(val);\n this.validate();\n }\n });\n\n return this.control;\n }\n\n public validate(): boolean {\n // Boolean states rarely fail validation.\n return true;\n }\n\n protected applyState(): void {\n if (this.control && this.metadata) {\n const sw = this.control as Switch;\n sw.setEnabled(!this.metadata.ui?.readOnly);\n }\n }\n}\n"],"mappings":"yEAAA,MAKSA,EAAUC,EAAA,cAQZ,MAAMC,UAAqBF,EACvBG,OAAOC,EAAkCC,EAAqBC,EAAoB,QACrFC,KAAKC,SAAWJ,EAEhBG,KAAKE,QAAU,IAAIC,EAAO,CACtBC,MAAO,IAAIL,KAAaD,KACxBO,SAAUR,EAAcS,IAAIC,SAC5BC,OAASC,IACL,MAAMC,EAAMD,EAAOE,aAAa,SAChCX,KAAKY,cAAcF,GACnBV,KAAKa,cAIb,OAAOb,KAAKE,OAChB,CAEOW,WAEH,OAAO,IACX,CAEUC,aACN,GAAId,KAAKE,SAAWF,KAAKC,SAAU,CAC/B,MAAMc,EAAKf,KAAKE,QAChBa,EAAGC,YAAYhB,KAAKC,SAASK,IAAIC,SACrC,CACJ,EACH,IAAAU,EAAA,CAAAC,WAAA,MAAAD,EAAAtB,eAAA,OAAAsB,CAAA","ignoreList":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file SwitchPlugin.ts
|
|
3
|
+
* @description Renders a sap.m.Switch for boolean data specifically marked with the switch widget.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { BasePlugin } from "./BasePlugin";
|
|
7
|
+
import { IPropertyMetadata } from "../interfaces/ISchema";
|
|
8
|
+
import Switch from "sap/m/Switch";
|
|
9
|
+
import Control from "sap/ui/core/Control";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Handles rendering logic for toggleable boolean switches.
|
|
13
|
+
*/
|
|
14
|
+
export class SwitchPlugin extends BasePlugin {
|
|
15
|
+
public render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName: string = "meta"): Control {
|
|
16
|
+
this.metadata = fieldMetadata;
|
|
17
|
+
|
|
18
|
+
this.control = new Switch({
|
|
19
|
+
state: `{${modelName}>${bindingPath}}`,
|
|
20
|
+
enabled: !fieldMetadata.ui?.readOnly,
|
|
21
|
+
change: (oEvent: any) => {
|
|
22
|
+
const val = oEvent.getParameter("state");
|
|
23
|
+
this.publishChange(val);
|
|
24
|
+
this.validate();
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
return this.control;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public validate(): boolean {
|
|
32
|
+
// Boolean states rarely fail validation.
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
protected applyState(): void {
|
|
37
|
+
if (this.control && this.metadata) {
|
|
38
|
+
const sw = this.control as Switch;
|
|
39
|
+
sw.setEnabled(!this.metadata.ui?.readOnly);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
sap.ui.define(["./BasePlugin", "sap/m/TextArea"], function (___BasePlugin, TextArea) {
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @file TextAreaPlugin.ts
|
|
6
|
+
* @description Renders a sap.m.TextArea for string data specifically marked with the textArea widget.
|
|
7
|
+
*/
|
|
8
|
+
const BasePlugin = ___BasePlugin["BasePlugin"];
|
|
9
|
+
/**
|
|
10
|
+
* Handles rendering and logic for multi-line text areas.
|
|
11
|
+
*/
|
|
12
|
+
class TextAreaPlugin extends BasePlugin {
|
|
13
|
+
render(fieldMetadata, bindingPath, modelName = "meta") {
|
|
14
|
+
this.metadata = fieldMetadata;
|
|
15
|
+
this.fieldKey = bindingPath.replace("/", ""); // For EventBus
|
|
16
|
+
|
|
17
|
+
this.control = new TextArea({
|
|
18
|
+
value: `{${modelName}>${bindingPath}}`,
|
|
19
|
+
maxLength: fieldMetadata.maxLength || 0,
|
|
20
|
+
required: !!fieldMetadata.required,
|
|
21
|
+
rows: fieldMetadata.ui?.rows || 4,
|
|
22
|
+
// Default to 4 rows for text areas
|
|
23
|
+
change: oEvent => {
|
|
24
|
+
const val = oEvent.getParameter("value");
|
|
25
|
+
this.publishChange(val);
|
|
26
|
+
this.validate();
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
this.applyCommonDirectives(this.control, fieldMetadata, modelName);
|
|
30
|
+
return this.control;
|
|
31
|
+
}
|
|
32
|
+
validate() {
|
|
33
|
+
if (!this.control || !this.metadata) return true;
|
|
34
|
+
const input = this.control;
|
|
35
|
+
const val = input.getValue();
|
|
36
|
+
if (this.metadata.required && (!val || typeof val !== 'string' || val.trim() === "")) {
|
|
37
|
+
input.setValueState("Error");
|
|
38
|
+
input.setValueStateText("This field is required.");
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
input.setValueState("None");
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
applyState() {
|
|
45
|
+
if (this.control && this.metadata) {
|
|
46
|
+
const input = this.control;
|
|
47
|
+
input.setEditable(!this.metadata.ui?.readOnly);
|
|
48
|
+
input.setRequired(this.metadata.required);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
var __exports = {
|
|
53
|
+
__esModule: true
|
|
54
|
+
};
|
|
55
|
+
__exports.TextAreaPlugin = TextAreaPlugin;
|
|
56
|
+
return __exports;
|
|
57
|
+
});
|
|
58
|
+
//# sourceMappingURL=TextAreaPlugin-dbg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextAreaPlugin-dbg.js","names":["BasePlugin","___BasePlugin","TextAreaPlugin","render","fieldMetadata","bindingPath","modelName","metadata","fieldKey","replace","control","TextArea","value","maxLength","required","rows","ui","change","oEvent","val","getParameter","publishChange","validate","applyCommonDirectives","input","getValue","trim","setValueState","setValueStateText","applyState","setEditable","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\";\n\n/**\n * Handles rendering and logic for multi-line text areas.\n */\nexport class TextAreaPlugin extends BasePlugin {\n public render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName: string = \"meta\"): Control {\n this.metadata = fieldMetadata;\n this.fieldKey = bindingPath.replace(\"/\", \"\"); // For EventBus\n \n this.control = new TextArea({\n value: `{${modelName}>${bindingPath}}`,\n maxLength: fieldMetadata.maxLength || 0,\n required: !!fieldMetadata.required,\n rows: fieldMetadata.ui?.rows || 4, // Default to 4 rows for text areas\n change: (oEvent: any) => {\n const val = oEvent.getParameter(\"value\");\n this.publishChange(val);\n this.validate();\n }\n });\n\n this.applyCommonDirectives(this.control, fieldMetadata, modelName);\n\n return this.control;\n }\n\n public validate(): boolean {\n if (!this.control || !this.metadata) return true;\n const input = this.control as TextArea;\n const val = input.getValue();\n\n if (this.metadata.required && (!val || typeof val !== 'string' || val.trim() === \"\")) {\n input.setValueState(\"Error\" as any);\n input.setValueStateText(\"This field is required.\");\n return false;\n }\n\n input.setValueState(\"None\" as any);\n return true;\n }\n\n protected applyState(): void {\n if (this.control && this.metadata) {\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;EAKnB;AACA;AACA;EACO,MAAMC,cAAc,SAASF,UAAU,CAAC;IACpCG,MAAMA,CAACC,aAAgC,EAAEC,WAAmB,EAAEC,SAAiB,GAAG,MAAM,EAAW;MACtG,IAAI,CAACC,QAAQ,GAAGH,aAAa;MAC7B,IAAI,CAACI,QAAQ,GAAGH,WAAW,CAACI,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC;;MAE9C,IAAI,CAACC,OAAO,GAAG,IAAIC,QAAQ,CAAC;QACxBC,KAAK,EAAE,IAAIN,SAAS,IAAID,WAAW,GAAG;QACtCQ,SAAS,EAAET,aAAa,CAACS,SAAS,IAAI,CAAC;QACvCC,QAAQ,EAAE,CAAC,CAACV,aAAa,CAACU,QAAQ;QAClCC,IAAI,EAAEX,aAAa,CAACY,EAAE,EAAED,IAAI,IAAI,CAAC;QAAE;QACnCE,MAAM,EAAGC,MAAW,IAAK;UACrB,MAAMC,GAAG,GAAGD,MAAM,CAACE,YAAY,CAAC,OAAO,CAAC;UACxC,IAAI,CAACC,aAAa,CAACF,GAAG,CAAC;UACvB,IAAI,CAACG,QAAQ,CAAC,CAAC;QACnB;MACJ,CAAC,CAAC;MAEF,IAAI,CAACC,qBAAqB,CAAC,IAAI,CAACb,OAAO,EAAEN,aAAa,EAAEE,SAAS,CAAC;MAElE,OAAO,IAAI,CAACI,OAAO;IACvB;IAEOY,QAAQA,CAAA,EAAY;MACvB,IAAI,CAAC,IAAI,CAACZ,OAAO,IAAI,CAAC,IAAI,CAACH,QAAQ,EAAE,OAAO,IAAI;MAChD,MAAMiB,KAAK,GAAG,IAAI,CAACd,OAAmB;MACtC,MAAMS,GAAG,GAAGK,KAAK,CAACC,QAAQ,CAAC,CAAC;MAE5B,IAAI,IAAI,CAAClB,QAAQ,CAACO,QAAQ,KAAK,CAACK,GAAG,IAAI,OAAOA,GAAG,KAAK,QAAQ,IAAIA,GAAG,CAACO,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE;QAClFF,KAAK,CAACG,aAAa,CAAC,OAAc,CAAC;QACnCH,KAAK,CAACI,iBAAiB,CAAC,yBAAyB,CAAC;QAClD,OAAO,KAAK;MAChB;MAEAJ,KAAK,CAACG,aAAa,CAAC,MAAa,CAAC;MAClC,OAAO,IAAI;IACf;IAEUE,UAAUA,CAAA,EAAS;MACzB,IAAI,IAAI,CAACnB,OAAO,IAAI,IAAI,CAACH,QAAQ,EAAE;QAC/B,MAAMiB,KAAK,GAAG,IAAI,CAACd,OAAmB;QACtCc,KAAK,CAACM,WAAW,CAAC,CAAC,IAAI,CAACvB,QAAQ,CAACS,EAAE,EAAEe,QAAQ,CAAC;QAC9CP,KAAK,CAACQ,WAAW,CAAC,IAAI,CAACzB,QAAQ,CAACO,QAAQ,CAAC;MAC7C;IACJ;EACJ;EAAC,IAAAmB,SAAA;IAAAC,UAAA;EAAA;EAAAD,SAAA,CAAA/B,cAAA,GAAAA,cAAA;EAAA,OAAA+B,SAAA;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare module "nz/co/siliconst/ui5/metaui/plugins/TextAreaPlugin" {
|
|
2
|
+
/**
|
|
3
|
+
* @file TextAreaPlugin.ts
|
|
4
|
+
* @description Renders a sap.m.TextArea for string data specifically marked with the textArea widget.
|
|
5
|
+
*/
|
|
6
|
+
import { BasePlugin } from "nz/co/siliconst/ui5/metaui/plugins/BasePlugin";
|
|
7
|
+
import { IPropertyMetadata } from "nz/co/siliconst/ui5/metaui/interfaces/ISchema";
|
|
8
|
+
import Control from "sap/ui/core/Control";
|
|
9
|
+
/**
|
|
10
|
+
* Handles rendering and logic for multi-line text areas.
|
|
11
|
+
*/
|
|
12
|
+
export class TextAreaPlugin extends BasePlugin {
|
|
13
|
+
render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName?: string): Control;
|
|
14
|
+
validate(): boolean;
|
|
15
|
+
protected applyState(): void;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=TextAreaPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextAreaPlugin.d.ts","sourceRoot":"../../../../../../../..","sources":["src/nz/co/siliconst/ui5/metaui/plugins/TextAreaPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,mDAAmD,CAAC;IACnE;;;OAGG;IAEH,OAAO,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;IAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;IAElF,OAAO,OAAO,MAAM,qBAAqB,CAAC;IAE1C;;OAEG;IACH,MAAa,cAAe,SAAQ,UAAU;QACnC,MAAM,CAAC,aAAa,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,GAAE,MAAe,GAAG,OAAO;QAqBlG,QAAQ,IAAI,OAAO;QAe1B,SAAS,CAAC,UAAU,IAAI,IAAI;KAO/B;CAEA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
sap.ui.define(["./BasePlugin","sap/m/TextArea"],function(t,e){"use strict";const a=t["BasePlugin"];class r extends a{render(t,a,r="meta"){this.metadata=t;this.fieldKey=a.replace("/","");this.control=new e({value:`{${r}>${a}}`,maxLength:t.maxLength||0,required:!!t.required,rows:t.ui?.rows||4,change:t=>{const e=t.getParameter("value");this.publishChange(e);this.validate()}});this.applyCommonDirectives(this.control,t,r);return this.control}validate(){if(!this.control||!this.metadata)return true;const t=this.control;const e=t.getValue();if(this.metadata.required&&(!e||typeof e!=="string"||e.trim()==="")){t.setValueState("Error");t.setValueStateText("This field is required.");return false}t.setValueState("None");return true}applyState(){if(this.control&&this.metadata){const t=this.control;t.setEditable(!this.metadata.ui?.readOnly);t.setRequired(this.metadata.required)}}}var i={__esModule:true};i.TextAreaPlugin=r;return i});
|
|
2
|
+
//# sourceMappingURL=TextAreaPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextAreaPlugin.js","names":["BasePlugin","___BasePlugin","TextAreaPlugin","render","fieldMetadata","bindingPath","modelName","this","metadata","fieldKey","replace","control","TextArea","value","maxLength","required","rows","ui","change","oEvent","val","getParameter","publishChange","validate","applyCommonDirectives","input","getValue","trim","setValueState","setValueStateText","applyState","setEditable","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\";\n\n/**\n * Handles rendering and logic for multi-line text areas.\n */\nexport class TextAreaPlugin extends BasePlugin {\n public render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName: string = \"meta\"): Control {\n this.metadata = fieldMetadata;\n this.fieldKey = bindingPath.replace(\"/\", \"\"); // For EventBus\n \n this.control = new TextArea({\n value: `{${modelName}>${bindingPath}}`,\n maxLength: fieldMetadata.maxLength || 0,\n required: !!fieldMetadata.required,\n rows: fieldMetadata.ui?.rows || 4, // Default to 4 rows for text areas\n change: (oEvent: any) => {\n const val = oEvent.getParameter(\"value\");\n this.publishChange(val);\n this.validate();\n }\n });\n\n this.applyCommonDirectives(this.control, fieldMetadata, modelName);\n\n return this.control;\n }\n\n public validate(): boolean {\n if (!this.control || !this.metadata) return true;\n const input = this.control as TextArea;\n const val = input.getValue();\n\n if (this.metadata.required && (!val || typeof val !== 'string' || val.trim() === \"\")) {\n input.setValueState(\"Error\" as any);\n input.setValueStateText(\"This field is required.\");\n return false;\n }\n\n input.setValueState(\"None\" as any);\n return true;\n }\n\n protected applyState(): void {\n if (this.control && this.metadata) {\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":"2EAAA,MAKSA,EAAUC,EAAA,cAQZ,MAAMC,UAAuBF,EACzBG,OAAOC,EAAkCC,EAAqBC,EAAoB,QACrFC,KAAKC,SAAWJ,EAChBG,KAAKE,SAAWJ,EAAYK,QAAQ,IAAK,IAEzCH,KAAKI,QAAU,IAAIC,EAAS,CACxBC,MAAO,IAAIP,KAAaD,KACxBS,UAAWV,EAAcU,WAAa,EACtCC,WAAYX,EAAcW,SAC1BC,KAAMZ,EAAca,IAAID,MAAQ,EAChCE,OAASC,IACL,MAAMC,EAAMD,EAAOE,aAAa,SAChCd,KAAKe,cAAcF,GACnBb,KAAKgB,cAIbhB,KAAKiB,sBAAsBjB,KAAKI,QAASP,EAAeE,GAExD,OAAOC,KAAKI,OAChB,CAEOY,WACH,IAAKhB,KAAKI,UAAYJ,KAAKC,SAAU,OAAO,KAC5C,MAAMiB,EAAQlB,KAAKI,QACnB,MAAMS,EAAMK,EAAMC,WAElB,GAAInB,KAAKC,SAASO,YAAcK,UAAcA,IAAQ,UAAYA,EAAIO,SAAW,IAAK,CAClFF,EAAMG,cAAc,SACpBH,EAAMI,kBAAkB,2BACxB,OAAO,KACX,CAEAJ,EAAMG,cAAc,QACpB,OAAO,IACX,CAEUE,aACN,GAAIvB,KAAKI,SAAWJ,KAAKC,SAAU,CAC/B,MAAMiB,EAAQlB,KAAKI,QACnBc,EAAMM,aAAaxB,KAAKC,SAASS,IAAIe,UACrCP,EAAMQ,YAAY1B,KAAKC,SAASO,SACpC,CACJ,EACH,IAAAmB,EAAA,CAAAC,WAAA,MAAAD,EAAAhC,iBAAA,OAAAgC,CAAA","ignoreList":[]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file TextAreaPlugin.ts
|
|
3
|
+
* @description Renders a sap.m.TextArea for string data specifically marked with the textArea widget.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { BasePlugin } from "./BasePlugin";
|
|
7
|
+
import { IPropertyMetadata } from "../interfaces/ISchema";
|
|
8
|
+
import TextArea from "sap/m/TextArea";
|
|
9
|
+
import Control from "sap/ui/core/Control";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Handles rendering and logic for multi-line text areas.
|
|
13
|
+
*/
|
|
14
|
+
export class TextAreaPlugin extends BasePlugin {
|
|
15
|
+
public render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName: string = "meta"): Control {
|
|
16
|
+
this.metadata = fieldMetadata;
|
|
17
|
+
this.fieldKey = bindingPath.replace("/", ""); // For EventBus
|
|
18
|
+
|
|
19
|
+
this.control = new TextArea({
|
|
20
|
+
value: `{${modelName}>${bindingPath}}`,
|
|
21
|
+
maxLength: fieldMetadata.maxLength || 0,
|
|
22
|
+
required: !!fieldMetadata.required,
|
|
23
|
+
rows: fieldMetadata.ui?.rows || 4, // Default to 4 rows for text areas
|
|
24
|
+
change: (oEvent: any) => {
|
|
25
|
+
const val = oEvent.getParameter("value");
|
|
26
|
+
this.publishChange(val);
|
|
27
|
+
this.validate();
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
this.applyCommonDirectives(this.control, fieldMetadata, modelName);
|
|
32
|
+
|
|
33
|
+
return this.control;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public validate(): boolean {
|
|
37
|
+
if (!this.control || !this.metadata) return true;
|
|
38
|
+
const input = this.control as TextArea;
|
|
39
|
+
const val = input.getValue();
|
|
40
|
+
|
|
41
|
+
if (this.metadata.required && (!val || typeof val !== 'string' || val.trim() === "")) {
|
|
42
|
+
input.setValueState("Error" as any);
|
|
43
|
+
input.setValueStateText("This field is required.");
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
input.setValueState("None" as any);
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
protected applyState(): void {
|
|
52
|
+
if (this.control && this.metadata) {
|
|
53
|
+
const input = this.control as TextArea;
|
|
54
|
+
input.setEditable(!this.metadata.ui?.readOnly);
|
|
55
|
+
input.setRequired(this.metadata.required);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
sap.ui.define(["./BasePlugin", "sap/m/TimePicker"], function (___BasePlugin, TimePicker) {
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @file TimePlugin.ts
|
|
6
|
+
* @description Handles rendering logic for Time strings.
|
|
7
|
+
*/
|
|
8
|
+
const BasePlugin = ___BasePlugin["BasePlugin"];
|
|
9
|
+
/**
|
|
10
|
+
* Handles rendering and logic for time inputs.
|
|
11
|
+
*/
|
|
12
|
+
class TimePlugin extends BasePlugin {
|
|
13
|
+
render(fieldMetadata, bindingPath, modelName = "meta") {
|
|
14
|
+
this.metadata = fieldMetadata;
|
|
15
|
+
this.control = new TimePicker({
|
|
16
|
+
value: {
|
|
17
|
+
path: `${modelName}>${bindingPath}`,
|
|
18
|
+
type: "sap.ui.model.type.Time",
|
|
19
|
+
formatOptions: {
|
|
20
|
+
source: {
|
|
21
|
+
pattern: "HH:mm:ss"
|
|
22
|
+
},
|
|
23
|
+
pattern: "HH:mm:ss"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
displayFormat: "HH:mm:ss",
|
|
27
|
+
editable: !fieldMetadata.ui?.readOnly,
|
|
28
|
+
required: fieldMetadata.required,
|
|
29
|
+
change: oEvent => {
|
|
30
|
+
const val = oEvent.getParameter("value");
|
|
31
|
+
this.publishChange(val);
|
|
32
|
+
this.validate();
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
return this.control;
|
|
36
|
+
}
|
|
37
|
+
validate() {
|
|
38
|
+
if (!this.control || !this.metadata) return true;
|
|
39
|
+
const input = this.control;
|
|
40
|
+
const isValid = typeof input.isValidValue === "function" ? input.isValidValue() : true;
|
|
41
|
+
const val = input.getValue();
|
|
42
|
+
const coreLibrary = sap.ui.require("sap/ui/core/library");
|
|
43
|
+
const ValueState = coreLibrary ? coreLibrary.ValueState : {
|
|
44
|
+
Error: "Error",
|
|
45
|
+
None: "None"
|
|
46
|
+
};
|
|
47
|
+
if (this.metadata.required && (!val || typeof val !== 'string' || val.trim() === "")) {
|
|
48
|
+
input.setValueState(ValueState.Error);
|
|
49
|
+
input.setValueStateText("This field is required.");
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
if (val && !isValid) {
|
|
53
|
+
input.setValueState(ValueState.Error);
|
|
54
|
+
input.setValueStateText("Invalid time format.");
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
input.setValueState(ValueState.None);
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
applyState() {
|
|
61
|
+
if (this.control && this.metadata) {
|
|
62
|
+
const input = this.control;
|
|
63
|
+
input.setEditable(!this.metadata.ui?.readOnly);
|
|
64
|
+
input.setRequired(this.metadata.required);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
var __exports = {
|
|
69
|
+
__esModule: true
|
|
70
|
+
};
|
|
71
|
+
__exports.TimePlugin = TimePlugin;
|
|
72
|
+
return __exports;
|
|
73
|
+
});
|
|
74
|
+
//# sourceMappingURL=TimePlugin-dbg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimePlugin-dbg.js","names":["BasePlugin","___BasePlugin","TimePlugin","render","fieldMetadata","bindingPath","modelName","metadata","control","TimePicker","value","path","type","formatOptions","source","pattern","displayFormat","editable","ui","readOnly","required","change","oEvent","val","getParameter","publishChange","validate","input","isValid","isValidValue","getValue","coreLibrary","sap","require","ValueState","Error","None","trim","setValueState","setValueStateText","applyState","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\";\n\n/**\n * Handles rendering and logic for time inputs.\n */\nexport class TimePlugin extends BasePlugin {\n public render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName: string = \"meta\"): Control {\n this.metadata = fieldMetadata;\n \n this.control = new TimePicker({\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: any) => {\n const val = oEvent.getParameter(\"value\");\n this.publishChange(val);\n this.validate();\n }\n });\n\n return this.control;\n }\n\n public validate(): boolean {\n if (!this.control || !this.metadata) return true;\n const input = this.control as TimePicker;\n const isValid = typeof input.isValidValue === \"function\" ? input.isValidValue() : true;\n const val = input.getValue();\n const coreLibrary = sap.ui.require(\"sap/ui/core/library\");\n const ValueState = coreLibrary ? coreLibrary.ValueState : { Error: \"Error\", None: \"None\" };\n\n if (this.metadata.required && (!val || typeof val !== 'string' || val.trim() === \"\")) {\n input.setValueState(ValueState.Error);\n input.setValueStateText(\"This field is required.\");\n return false;\n }\n\n if (val && !isValid) {\n input.setValueState(ValueState.Error);\n input.setValueStateText(\"Invalid time format.\");\n return false;\n }\n\n input.setValueState(ValueState.None);\n return true;\n }\n\n protected applyState(): void {\n if (this.control && this.metadata) {\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;EAKnB;AACA;AACA;EACO,MAAMC,UAAU,SAASF,UAAU,CAAC;IAChCG,MAAMA,CAACC,aAAgC,EAAEC,WAAmB,EAAEC,SAAiB,GAAG,MAAM,EAAW;MACtG,IAAI,CAACC,QAAQ,GAAGH,aAAa;MAE7B,IAAI,CAACI,OAAO,GAAG,IAAIC,UAAU,CAAC;QAC1BC,KAAK,EAAE;UACHC,IAAI,EAAE,GAAGL,SAAS,IAAID,WAAW,EAAE;UACnCO,IAAI,EAAE,wBAAwB;UAC9BC,aAAa,EAAE;YACXC,MAAM,EAAE;cAAEC,OAAO,EAAE;YAAW,CAAC;YAC/BA,OAAO,EAAE;UACb;QACJ,CAAC;QACDC,aAAa,EAAE,UAAU;QACzBC,QAAQ,EAAE,CAACb,aAAa,CAACc,EAAE,EAAEC,QAAQ;QACrCC,QAAQ,EAAEhB,aAAa,CAACgB,QAAQ;QAChCC,MAAM,EAAGC,MAAW,IAAK;UACrB,MAAMC,GAAG,GAAGD,MAAM,CAACE,YAAY,CAAC,OAAO,CAAC;UACxC,IAAI,CAACC,aAAa,CAACF,GAAG,CAAC;UACvB,IAAI,CAACG,QAAQ,CAAC,CAAC;QACnB;MACJ,CAAC,CAAC;MAEF,OAAO,IAAI,CAAClB,OAAO;IACvB;IAEOkB,QAAQA,CAAA,EAAY;MACvB,IAAI,CAAC,IAAI,CAAClB,OAAO,IAAI,CAAC,IAAI,CAACD,QAAQ,EAAE,OAAO,IAAI;MAChD,MAAMoB,KAAK,GAAG,IAAI,CAACnB,OAAqB;MACxC,MAAMoB,OAAO,GAAG,OAAOD,KAAK,CAACE,YAAY,KAAK,UAAU,GAAGF,KAAK,CAACE,YAAY,CAAC,CAAC,GAAG,IAAI;MACtF,MAAMN,GAAG,GAAGI,KAAK,CAACG,QAAQ,CAAC,CAAC;MAC5B,MAAMC,WAAW,GAAGC,GAAG,CAACd,EAAE,CAACe,OAAO,CAAC,qBAAqB,CAAC;MACzD,MAAMC,UAAU,GAAGH,WAAW,GAAGA,WAAW,CAACG,UAAU,GAAG;QAAEC,KAAK,EAAE,OAAO;QAAEC,IAAI,EAAE;MAAO,CAAC;MAE1F,IAAI,IAAI,CAAC7B,QAAQ,CAACa,QAAQ,KAAK,CAACG,GAAG,IAAI,OAAOA,GAAG,KAAK,QAAQ,IAAIA,GAAG,CAACc,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE;QAClFV,KAAK,CAACW,aAAa,CAACJ,UAAU,CAACC,KAAK,CAAC;QACrCR,KAAK,CAACY,iBAAiB,CAAC,yBAAyB,CAAC;QAClD,OAAO,KAAK;MAChB;MAEA,IAAIhB,GAAG,IAAI,CAACK,OAAO,EAAE;QACjBD,KAAK,CAACW,aAAa,CAACJ,UAAU,CAACC,KAAK,CAAC;QACrCR,KAAK,CAACY,iBAAiB,CAAC,sBAAsB,CAAC;QAC/C,OAAO,KAAK;MAChB;MAEAZ,KAAK,CAACW,aAAa,CAACJ,UAAU,CAACE,IAAI,CAAC;MACpC,OAAO,IAAI;IACf;IAEUI,UAAUA,CAAA,EAAS;MACzB,IAAI,IAAI,CAAChC,OAAO,IAAI,IAAI,CAACD,QAAQ,EAAE;QAC/B,MAAMoB,KAAK,GAAG,IAAI,CAACnB,OAAqB;QACxCmB,KAAK,CAACc,WAAW,CAAC,CAAC,IAAI,CAAClC,QAAQ,CAACW,EAAE,EAAEC,QAAQ,CAAC;QAC9CQ,KAAK,CAACe,WAAW,CAAC,IAAI,CAACnC,QAAQ,CAACa,QAAQ,CAAC;MAC7C;IACJ;EACJ;EAAC,IAAAuB,SAAA;IAAAC,UAAA;EAAA;EAAAD,SAAA,CAAAzC,UAAA,GAAAA,UAAA;EAAA,OAAAyC,SAAA;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare module "nz/co/siliconst/ui5/metaui/plugins/TimePlugin" {
|
|
2
|
+
/**
|
|
3
|
+
* @file TimePlugin.ts
|
|
4
|
+
* @description Handles rendering logic for Time strings.
|
|
5
|
+
*/
|
|
6
|
+
import { BasePlugin } from "nz/co/siliconst/ui5/metaui/plugins/BasePlugin";
|
|
7
|
+
import { IPropertyMetadata } from "nz/co/siliconst/ui5/metaui/interfaces/ISchema";
|
|
8
|
+
import Control from "sap/ui/core/Control";
|
|
9
|
+
/**
|
|
10
|
+
* Handles rendering and logic for time inputs.
|
|
11
|
+
*/
|
|
12
|
+
export class TimePlugin extends BasePlugin {
|
|
13
|
+
render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName?: string): Control;
|
|
14
|
+
validate(): boolean;
|
|
15
|
+
protected applyState(): void;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=TimePlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimePlugin.d.ts","sourceRoot":"../../../../../../../..","sources":["src/nz/co/siliconst/ui5/metaui/plugins/TimePlugin.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,+CAA+C,CAAC;IAC/D;;;OAGG;IAEH,OAAO,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;IAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;IAElF,OAAO,OAAO,MAAM,qBAAqB,CAAC;IAE1C;;OAEG;IACH,MAAa,UAAW,SAAQ,UAAU;QAC/B,MAAM,CAAC,aAAa,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,GAAE,MAAe,GAAG,OAAO;QAyBlG,QAAQ,IAAI,OAAO;QAwB1B,SAAS,CAAC,UAAU,IAAI,IAAI;KAO/B;CAEA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
sap.ui.define(["./BasePlugin","sap/m/TimePicker"],function(e,t){"use strict";const a=e["BasePlugin"];class r extends a{render(e,a,r="meta"){this.metadata=e;this.control=new t({value:{path:`${r}>${a}`,type:"sap.ui.model.type.Time",formatOptions:{source:{pattern:"HH:mm:ss"},pattern:"HH:mm:ss"}},displayFormat:"HH:mm:ss",editable:!e.ui?.readOnly,required:e.required,change:e=>{const t=e.getParameter("value");this.publishChange(t);this.validate()}});return this.control}validate(){if(!this.control||!this.metadata)return true;const e=this.control;const t=typeof e.isValidValue==="function"?e.isValidValue():true;const a=e.getValue();const r=sap.ui.require("sap/ui/core/library");const i=r?r.ValueState:{Error:"Error",None:"None"};if(this.metadata.required&&(!a||typeof a!=="string"||a.trim()==="")){e.setValueState(i.Error);e.setValueStateText("This field is required.");return false}if(a&&!t){e.setValueState(i.Error);e.setValueStateText("Invalid time format.");return false}e.setValueState(i.None);return true}applyState(){if(this.control&&this.metadata){const e=this.control;e.setEditable(!this.metadata.ui?.readOnly);e.setRequired(this.metadata.required)}}}var i={__esModule:true};i.TimePlugin=r;return i});
|
|
2
|
+
//# sourceMappingURL=TimePlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimePlugin.js","names":["BasePlugin","___BasePlugin","TimePlugin","render","fieldMetadata","bindingPath","modelName","this","metadata","control","TimePicker","value","path","type","formatOptions","source","pattern","displayFormat","editable","ui","readOnly","required","change","oEvent","val","getParameter","publishChange","validate","input","isValid","isValidValue","getValue","coreLibrary","sap","require","ValueState","Error","None","trim","setValueState","setValueStateText","applyState","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\";\n\n/**\n * Handles rendering and logic for time inputs.\n */\nexport class TimePlugin extends BasePlugin {\n public render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName: string = \"meta\"): Control {\n this.metadata = fieldMetadata;\n \n this.control = new TimePicker({\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: any) => {\n const val = oEvent.getParameter(\"value\");\n this.publishChange(val);\n this.validate();\n }\n });\n\n return this.control;\n }\n\n public validate(): boolean {\n if (!this.control || !this.metadata) return true;\n const input = this.control as TimePicker;\n const isValid = typeof input.isValidValue === \"function\" ? input.isValidValue() : true;\n const val = input.getValue();\n const coreLibrary = sap.ui.require(\"sap/ui/core/library\");\n const ValueState = coreLibrary ? coreLibrary.ValueState : { Error: \"Error\", None: \"None\" };\n\n if (this.metadata.required && (!val || typeof val !== 'string' || val.trim() === \"\")) {\n input.setValueState(ValueState.Error);\n input.setValueStateText(\"This field is required.\");\n return false;\n }\n\n if (val && !isValid) {\n input.setValueState(ValueState.Error);\n input.setValueStateText(\"Invalid time format.\");\n return false;\n }\n\n input.setValueState(ValueState.None);\n return true;\n }\n\n protected applyState(): void {\n if (this.control && this.metadata) {\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":"6EAAA,MAKSA,EAAUC,EAAA,cAQZ,MAAMC,UAAmBF,EACrBG,OAAOC,EAAkCC,EAAqBC,EAAoB,QACrFC,KAAKC,SAAWJ,EAEhBG,KAAKE,QAAU,IAAIC,EAAW,CAC1BC,MAAO,CACHC,KAAM,GAAGN,KAAaD,IACtBQ,KAAM,yBACNC,cAAe,CACXC,OAAQ,CAAEC,QAAS,YACnBA,QAAS,aAGjBC,cAAe,WACfC,UAAWd,EAAce,IAAIC,SAC7BC,SAAUjB,EAAciB,SACxBC,OAASC,IACL,MAAMC,EAAMD,EAAOE,aAAa,SAChClB,KAAKmB,cAAcF,GACnBjB,KAAKoB,cAIb,OAAOpB,KAAKE,OAChB,CAEOkB,WACH,IAAKpB,KAAKE,UAAYF,KAAKC,SAAU,OAAO,KAC5C,MAAMoB,EAAQrB,KAAKE,QACnB,MAAMoB,SAAiBD,EAAME,eAAiB,WAAaF,EAAME,eAAiB,KAClF,MAAMN,EAAMI,EAAMG,WAClB,MAAMC,EAAcC,IAAId,GAAGe,QAAQ,uBACnC,MAAMC,EAAaH,EAAcA,EAAYG,WAAa,CAAEC,MAAO,QAASC,KAAM,QAElF,GAAI9B,KAAKC,SAASa,YAAcG,UAAcA,IAAQ,UAAYA,EAAIc,SAAW,IAAK,CAClFV,EAAMW,cAAcJ,EAAWC,OAC/BR,EAAMY,kBAAkB,2BACxB,OAAO,KACX,CAEA,GAAIhB,IAAQK,EAAS,CACjBD,EAAMW,cAAcJ,EAAWC,OAC/BR,EAAMY,kBAAkB,wBACxB,OAAO,KACX,CAEAZ,EAAMW,cAAcJ,EAAWE,MAC/B,OAAO,IACX,CAEUI,aACN,GAAIlC,KAAKE,SAAWF,KAAKC,SAAU,CAC/B,MAAMoB,EAAQrB,KAAKE,QACnBmB,EAAMc,aAAanC,KAAKC,SAASW,IAAIC,UACrCQ,EAAMe,YAAYpC,KAAKC,SAASa,SACpC,CACJ,EACH,IAAAuB,EAAA,CAAAC,WAAA,MAAAD,EAAA1C,aAAA,OAAA0C,CAAA","ignoreList":[]}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file TimePlugin.ts
|
|
3
|
+
* @description Handles rendering logic for Time strings.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { BasePlugin } from "./BasePlugin";
|
|
7
|
+
import { IPropertyMetadata } from "../interfaces/ISchema";
|
|
8
|
+
import TimePicker from "sap/m/TimePicker";
|
|
9
|
+
import Control from "sap/ui/core/Control";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Handles rendering and logic for time inputs.
|
|
13
|
+
*/
|
|
14
|
+
export class TimePlugin extends BasePlugin {
|
|
15
|
+
public render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName: string = "meta"): Control {
|
|
16
|
+
this.metadata = fieldMetadata;
|
|
17
|
+
|
|
18
|
+
this.control = new TimePicker({
|
|
19
|
+
value: {
|
|
20
|
+
path: `${modelName}>${bindingPath}`,
|
|
21
|
+
type: "sap.ui.model.type.Time",
|
|
22
|
+
formatOptions: {
|
|
23
|
+
source: { pattern: "HH:mm:ss" },
|
|
24
|
+
pattern: "HH:mm:ss"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
displayFormat: "HH:mm:ss",
|
|
28
|
+
editable: !fieldMetadata.ui?.readOnly,
|
|
29
|
+
required: fieldMetadata.required,
|
|
30
|
+
change: (oEvent: any) => {
|
|
31
|
+
const val = oEvent.getParameter("value");
|
|
32
|
+
this.publishChange(val);
|
|
33
|
+
this.validate();
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
return this.control;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public validate(): boolean {
|
|
41
|
+
if (!this.control || !this.metadata) return true;
|
|
42
|
+
const input = this.control as TimePicker;
|
|
43
|
+
const isValid = typeof input.isValidValue === "function" ? input.isValidValue() : true;
|
|
44
|
+
const val = input.getValue();
|
|
45
|
+
const coreLibrary = sap.ui.require("sap/ui/core/library");
|
|
46
|
+
const ValueState = coreLibrary ? coreLibrary.ValueState : { Error: "Error", None: "None" };
|
|
47
|
+
|
|
48
|
+
if (this.metadata.required && (!val || typeof val !== 'string' || val.trim() === "")) {
|
|
49
|
+
input.setValueState(ValueState.Error);
|
|
50
|
+
input.setValueStateText("This field is required.");
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (val && !isValid) {
|
|
55
|
+
input.setValueState(ValueState.Error);
|
|
56
|
+
input.setValueStateText("Invalid time format.");
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
input.setValueState(ValueState.None);
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
protected applyState(): void {
|
|
65
|
+
if (this.control && this.metadata) {
|
|
66
|
+
const input = this.control as TimePicker;
|
|
67
|
+
input.setEditable(!this.metadata.ui?.readOnly);
|
|
68
|
+
input.setRequired(this.metadata.required);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
package/ui5.yaml
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
specVersion: "3.0"
|
|
2
|
-
metadata:
|
|
3
|
-
name: nz.co.siliconst.ui5.metaui
|
|
1
|
+
specVersion: "3.0"
|
|
2
|
+
metadata:
|
|
3
|
+
name: nz.co.siliconst.ui5.metaui
|
|
4
4
|
type: library
|
package/test-resources/App.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
sap.ui.define([
|
|
2
|
-
"sap/ui/core/mvc/Controller",
|
|
3
|
-
"nz/co/siliconst/ui5/metaui/controls/GeneratorHost",
|
|
4
|
-
"sap/m/MessageToast",
|
|
5
|
-
"nz/co/siliconst/ui5/metaui/library"
|
|
6
|
-
], function(Controller, GeneratorHost, MessageToast) {
|
|
7
|
-
"use strict";
|
|
8
|
-
|
|
9
|
-
return Controller.extend("test.Main", {
|
|
10
|
-
onInit: function() {
|
|
11
|
-
this.mockSchema = null;
|
|
12
|
-
this.initialData = null;
|
|
13
|
-
|
|
14
|
-
// Fetch the external JSON files to simulate backend payload ingestion
|
|
15
|
-
Promise.all([
|
|
16
|
-
fetch("mockSchema.json").then(res => res.json()),
|
|
17
|
-
fetch("mockData.json").then(res => res.json())
|
|
18
|
-
]).then((results) => {
|
|
19
|
-
this.mockSchema = results[0];
|
|
20
|
-
this.initialData = results[1];
|
|
21
|
-
|
|
22
|
-
var sapUIModel = sap.ui.require("sap/ui/model/json/JSONModel");
|
|
23
|
-
if (!sapUIModel) {
|
|
24
|
-
sapUIModel = sap.ui.model.json.JSONModel;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// Create JSON models for the declarative XML binding
|
|
28
|
-
var schemaModel = new sapUIModel(this.mockSchema);
|
|
29
|
-
var dataModel = new sapUIModel(this.initialData);
|
|
30
|
-
|
|
31
|
-
this.getView().setModel(schemaModel, "schemaModel");
|
|
32
|
-
this.getView().setModel(dataModel, "dataModel");
|
|
33
|
-
|
|
34
|
-
MessageToast.show("JSON payloads successfully bound to XML View.");
|
|
35
|
-
}).catch((err) => {
|
|
36
|
-
MessageToast.show("Error loading JSON.");
|
|
37
|
-
console.error("Fetch error:", err);
|
|
38
|
-
});
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
// ---------- OPTION 1: XML BINDING INLINE ----------
|
|
42
|
-
onSaveInline: function() {
|
|
43
|
-
// Trigger the submit event on the embedded XML control
|
|
44
|
-
this.byId("metaHost").triggerSubmit();
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
// ---------- OPTION 2: JAVASCRIPT API DIALOG ----------
|
|
48
|
-
onOpenDialog: function() {
|
|
49
|
-
if (!this.mockSchema || !this.initialData) {
|
|
50
|
-
MessageToast.show("JSON payloads not loaded yet.");
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const host = new GeneratorHost({
|
|
55
|
-
schemaDefinition: this.mockSchema,
|
|
56
|
-
initialData: this.initialData,
|
|
57
|
-
submit: (oEvent) => {
|
|
58
|
-
this.onSubmit(oEvent); // Reuse the same handler to output payload
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
host.openInDialog("MetaUI Generated Form (JS API)", "OK");
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
// ---------- COMMON OUTPUT HANDLER ----------
|
|
66
|
-
onSubmit: function(oEvent) {
|
|
67
|
-
// Extract the clean JSON payload from the UI5 engine event
|
|
68
|
-
const payload = oEvent.getParameter("payload");
|
|
69
|
-
this.byId("outputArea").setValue(JSON.stringify(payload, null, 2));
|
|
70
|
-
MessageToast.show("Payload Extracted Successfully!");
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
});
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
<mvc:View
|
|
2
|
-
controllerName="test.Main"
|
|
3
|
-
xmlns:mvc="sap.ui.core.mvc"
|
|
4
|
-
xmlns="sap.m"
|
|
5
|
-
xmlns:meta="nz.co.siliconst.ui5.metaui.controls"
|
|
6
|
-
displayBlock="true">
|
|
7
|
-
<App>
|
|
8
|
-
<Page title="MetaUI Standalone Sandbox Test">
|
|
9
|
-
<content>
|
|
10
|
-
<VBox class="sapUiSmallMargin" spacing="1rem">
|
|
11
|
-
|
|
12
|
-
<Panel headerText="Option 1: Declarative XML Binding (Inline)" expandable="true" expanded="true">
|
|
13
|
-
<content>
|
|
14
|
-
<Text text="This section uses the <meta:GeneratorHost> tag embedded directly into the XML view, bound to JSONModels." class="sapUiSmallMarginBottom" />
|
|
15
|
-
<meta:GeneratorHost
|
|
16
|
-
id="metaHost"
|
|
17
|
-
schemaDefinition="{schemaModel>/}"
|
|
18
|
-
initialData="{dataModel>/}"
|
|
19
|
-
submit=".onSubmit" />
|
|
20
|
-
<Button text="Save Inline Form" press=".onSaveInline" type="Emphasized" class="sapUiSmallMarginTop" />
|
|
21
|
-
</content>
|
|
22
|
-
</Panel>
|
|
23
|
-
|
|
24
|
-
<Panel headerText="Option 2: JavaScript API (Dialog Modality)" expandable="true" expanded="true">
|
|
25
|
-
<content>
|
|
26
|
-
<Text text="This section demonstrates instantiating the GeneratorHost purely in JavaScript and rendering it inside a sap.m.Dialog." class="sapUiSmallMarginBottom" />
|
|
27
|
-
<Button text="Open MetaUI Dialog" press=".onOpenDialog" type="Emphasized" />
|
|
28
|
-
</content>
|
|
29
|
-
</Panel>
|
|
30
|
-
|
|
31
|
-
<Panel headerText="Output Window" expandable="false">
|
|
32
|
-
<content>
|
|
33
|
-
<Title text="Submitted JSON Payload:" class="sapUiSmallMarginBottom" />
|
|
34
|
-
<TextArea id="outputArea" width="100%" rows="15" editable="false" />
|
|
35
|
-
</content>
|
|
36
|
-
</Panel>
|
|
37
|
-
|
|
38
|
-
</VBox>
|
|
39
|
-
</content>
|
|
40
|
-
</Page>
|
|
41
|
-
</App>
|
|
42
|
-
</mvc:View>
|