@siliconst/metaui 1.4.20 → 1.4.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost-dbg.js +8 -3
- 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 +8 -0
- 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 +2 -3
- package/src/nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost-dbg.js +13 -3
- 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 +8 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost.ts +9 -4
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ODataDelegate-dbg.js +13 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ODataDelegate-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ODataDelegate.d.ts +4 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ODataDelegate.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ODataDelegate.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ODataDelegate.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ODataDelegate.ts +13 -0
- package/src/nz/co/siliconst/ui5/metaui/core/Engine-dbg.js +8 -4
- package/src/nz/co/siliconst/ui5/metaui/core/Engine-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/Engine.d.ts +5 -1
- package/src/nz/co/siliconst/ui5/metaui/core/Engine.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/Engine.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/Engine.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/Engine.ts +9 -4
- package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry-dbg.js +3 -0
- package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry.d.ts.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 +3 -0
- package/src/nz/co/siliconst/ui5/metaui/library-preload.js +9 -6
- package/src/nz/co/siliconst/ui5/metaui/library-preload.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/OpenApiUIMapper-dbg.js +6 -3
- package/src/nz/co/siliconst/ui5/metaui/openapi/OpenApiUIMapper-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/OpenApiUIMapper.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/OpenApiUIMapper.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/OpenApiUIMapper.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/openapi/OpenApiUIMapper.ts +6 -3
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/EmailPlugin-dbg.js +48 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/EmailPlugin-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/EmailPlugin.d.ts +11 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/EmailPlugin.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/EmailPlugin.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/EmailPlugin.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/EmailPlugin.ts +48 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/LinkPlugin-dbg.js +58 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/LinkPlugin-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/LinkPlugin.d.ts +11 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/LinkPlugin.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/LinkPlugin.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/LinkPlugin.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/LinkPlugin.ts +57 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/PasswordPlugin-dbg.js +49 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/PasswordPlugin-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/PasswordPlugin.d.ts +11 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/PasswordPlugin.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/PasswordPlugin.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/PasswordPlugin.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/PasswordPlugin.ts +49 -0
|
@@ -47,13 +47,16 @@ sap.ui.define([], function () {
|
|
|
47
47
|
ui.widget = "date";
|
|
48
48
|
break;
|
|
49
49
|
case "password":
|
|
50
|
-
ui.
|
|
50
|
+
ui.widget = "password";
|
|
51
|
+
ui.format = "password"; // Kept for schema validation
|
|
51
52
|
break;
|
|
52
53
|
case "email":
|
|
53
|
-
ui.
|
|
54
|
+
ui.widget = "email";
|
|
55
|
+
ui.format = "email"; // Kept for schema validation
|
|
54
56
|
break;
|
|
55
57
|
case "uri":
|
|
56
|
-
ui.
|
|
58
|
+
ui.widget = "link";
|
|
59
|
+
ui.format = "url"; // Kept for schema validation
|
|
57
60
|
break;
|
|
58
61
|
case "binary":
|
|
59
62
|
case "byte":
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenApiUIMapper-dbg.js","names":["OpenApiUIMapper","build","swaggerProp","keyName","ui","title","label","generateLabel","readOnly","format","widget","validators","push","name","spaced","replace","split","filter","w","length","map","word","charAt","toUpperCase","slice","toLowerCase","join","trim","__exports","__esModule"],"sources":["OpenApiUIMapper.ts"],"sourcesContent":["/**\n * @file OpenApiUIMapper.ts\n * @description Utility class for mapping OpenAPI properties and formats into MetaUI IUIDirectives.\n */\nimport { IUIDirective } from \"../interfaces/ISchema\";\n\n/**\n * Utility class responsible for evaluating OpenAPI metadata and generating the corresponding \n * MetaUI UI rendering directives. This isolates all visual layout assumptions from the parsing engine.\n * \n * @public\n */\nexport class OpenApiUIMapper {\n /**\n * Evaluates an OpenAPI property definition and constructs a MetaUI IUIDirective block.\n * Extracts labels from title/description, maps readOnly state, and assigns \n * specific UI5 Fiori widgets based on the OpenAPI 'format' property.\n * \n * @param {any} swaggerProp The raw OpenAPI property schema chunk.\n * @param {string} keyName The technical JSON key of the property.\n * @returns {IUIDirective} The constructed MetaUI UI orchestration directive.\n */\n public static build(swaggerProp: unknown, keyName: string): IUIDirective {\n const ui: IUIDirective = {};\n\n // Label Synthesis\n if (swaggerProp.title) {\n ui.label = swaggerProp.title;\n } else {\n ui.label = this.generateLabel(keyName);\n }\n\n // State Mapping\n if (swaggerProp.readOnly === true) {\n ui.readOnly = true;\n }\n\n // Format to Widget Translation\n if (swaggerProp.format) {\n switch (swaggerProp.format) {\n case \"date-time\":\n ui.widget = \"datetime\";\n break;\n case \"date\":\n ui.widget = \"date\";\n break;\n case \"password\":\n ui.
|
|
1
|
+
{"version":3,"file":"OpenApiUIMapper-dbg.js","names":["OpenApiUIMapper","build","swaggerProp","keyName","ui","title","label","generateLabel","readOnly","format","widget","validators","push","name","spaced","replace","split","filter","w","length","map","word","charAt","toUpperCase","slice","toLowerCase","join","trim","__exports","__esModule"],"sources":["OpenApiUIMapper.ts"],"sourcesContent":["/**\n * @file OpenApiUIMapper.ts\n * @description Utility class for mapping OpenAPI properties and formats into MetaUI IUIDirectives.\n */\nimport { IUIDirective } from \"../interfaces/ISchema\";\n\n/**\n * Utility class responsible for evaluating OpenAPI metadata and generating the corresponding \n * MetaUI UI rendering directives. This isolates all visual layout assumptions from the parsing engine.\n * \n * @public\n */\nexport class OpenApiUIMapper {\n /**\n * Evaluates an OpenAPI property definition and constructs a MetaUI IUIDirective block.\n * Extracts labels from title/description, maps readOnly state, and assigns \n * specific UI5 Fiori widgets based on the OpenAPI 'format' property.\n * \n * @param {any} swaggerProp The raw OpenAPI property schema chunk.\n * @param {string} keyName The technical JSON key of the property.\n * @returns {IUIDirective} The constructed MetaUI UI orchestration directive.\n */\n public static build(swaggerProp: unknown, keyName: string): IUIDirective {\n const ui: IUIDirective = {};\n\n // Label Synthesis\n if (swaggerProp.title) {\n ui.label = swaggerProp.title;\n } else {\n ui.label = this.generateLabel(keyName);\n }\n\n // State Mapping\n if (swaggerProp.readOnly === true) {\n ui.readOnly = true;\n }\n\n // Format to Widget Translation\n if (swaggerProp.format) {\n switch (swaggerProp.format) {\n case \"date-time\":\n ui.widget = \"datetime\";\n break;\n case \"date\":\n ui.widget = \"date\";\n break;\n case \"password\":\n ui.widget = \"password\";\n ui.format = \"password\"; // Kept for schema validation\n break;\n case \"email\":\n ui.widget = \"email\";\n ui.format = \"email\"; // Kept for schema validation\n break;\n case \"uri\":\n ui.widget = \"link\";\n ui.format = \"url\"; // Kept for schema validation\n break;\n case \"binary\":\n case \"byte\":\n ui.widget = \"fileUploader\";\n break;\n case \"uuid\":\n case \"ipv4\":\n case \"ipv6\":\n case \"hostname\":\n if (!ui.validators) ui.validators = [];\n ui.validators.push(swaggerProp.format);\n break;\n }\n }\n\n return ui;\n }\n\n /**\n * Synthesizes a human-readable Title Case label from camelCase or snake_case technical keys.\n * \n * @param {string} name The raw technical property key (e.g., 'creationTimestamp').\n * @returns {string} The formatted human-readable label (e.g., 'Creation Timestamp').\n * @private\n */\n private static generateLabel(name: string): string {\n if (!name) return \"\";\n let spaced = name.replace(/([A-Z])/g, \" $1\").replace(/_/g, \" \");\n return spaced.split(' ')\n .filter(w => w.length > 0)\n .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())\n .join(' ')\n .trim();\n }\n}\n"],"mappings":";;;EAAA;AACA;AACA;AACA;;EAGA;AACA;AACA;AACA;AACA;AACA;EACO,MAAMA,eAAe,CAAC;IACzB;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACI,OAAcC,KAAKA,CAACC,WAAoB,EAAEC,OAAe,EAAgB;MACrE,MAAMC,EAAgB,GAAG,CAAC,CAAC;;MAE3B;MACA,IAAIF,WAAW,CAACG,KAAK,EAAE;QACnBD,EAAE,CAACE,KAAK,GAAGJ,WAAW,CAACG,KAAK;MAChC,CAAC,MAAM;QACHD,EAAE,CAACE,KAAK,GAAG,IAAI,CAACC,aAAa,CAACJ,OAAO,CAAC;MAC1C;;MAEA;MACA,IAAID,WAAW,CAACM,QAAQ,KAAK,IAAI,EAAE;QAC/BJ,EAAE,CAACI,QAAQ,GAAG,IAAI;MACtB;;MAEA;MACA,IAAIN,WAAW,CAACO,MAAM,EAAE;QACpB,QAAQP,WAAW,CAACO,MAAM;UACtB,KAAK,WAAW;YACZL,EAAE,CAACM,MAAM,GAAG,UAAU;YACtB;UACJ,KAAK,MAAM;YACPN,EAAE,CAACM,MAAM,GAAG,M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AAC,CAAC;IACf;EACJ;EAAC,IAAAC,SAAA;IAAAC,UAAA;EAAA;EAAAD,SAAA,CAAA5B,eAAA,GAAAA,eAAA;EAAA,OAAA4B,SAAA;AAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenApiUIMapper.d.ts","sourceRoot":"../../../../../../../..","sources":["src/nz/co/siliconst/ui5/metaui/openapi/OpenApiUIMapper.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,oDAAoD,CAAC;IACpE;;;OAGG;IACH,OAAO,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;IAE7E;;;;;OAKG;IACH,MAAa,eAAe;QACxB;;;;;;;;WAQG;eACW,KAAK,CAAC,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,YAAY;
|
|
1
|
+
{"version":3,"file":"OpenApiUIMapper.d.ts","sourceRoot":"../../../../../../../..","sources":["src/nz/co/siliconst/ui5/metaui/openapi/OpenApiUIMapper.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,oDAAoD,CAAC;IACpE;;;OAGG;IACH,OAAO,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;IAE7E;;;;;OAKG;IACH,MAAa,eAAe;QACxB;;;;;;;;WAQG;eACW,KAAK,CAAC,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,YAAY;QAqDxE;;;;;;WAMG;QACH,OAAO,CAAC,MAAM,CAAC,aAAa;KAS/B;CAEA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
sap.ui.define([],function(){"use strict";class e{static build(e,a){const t={};if(e.title){t.label=e.title}else{t.label=this.generateLabel(a)}if(e.readOnly===true){t.readOnly=true}if(e.format){switch(e.format){case"date-time":t.widget="datetime";break;case"date":t.widget="date";break;case"password":t.format="password";break;case"email":t.format="email";break;case"uri":t.format="url";break;case"binary":case"byte":t.widget="fileUploader";break;case"uuid":case"ipv4":case"ipv6":case"hostname":if(!t.validators)t.validators=[];t.validators.push(e.format);break}}return t}static generateLabel(e){if(!e)return"";let a=e.replace(/([A-Z])/g," $1").replace(/_/g," ");return a.split(" ").filter(e=>e.length>0).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ").trim()}}var a={__esModule:true};a.OpenApiUIMapper=e;return a});
|
|
1
|
+
sap.ui.define([],function(){"use strict";class e{static build(e,a){const t={};if(e.title){t.label=e.title}else{t.label=this.generateLabel(a)}if(e.readOnly===true){t.readOnly=true}if(e.format){switch(e.format){case"date-time":t.widget="datetime";break;case"date":t.widget="date";break;case"password":t.widget="password";t.format="password";break;case"email":t.widget="email";t.format="email";break;case"uri":t.widget="link";t.format="url";break;case"binary":case"byte":t.widget="fileUploader";break;case"uuid":case"ipv4":case"ipv6":case"hostname":if(!t.validators)t.validators=[];t.validators.push(e.format);break}}return t}static generateLabel(e){if(!e)return"";let a=e.replace(/([A-Z])/g," $1").replace(/_/g," ");return a.split(" ").filter(e=>e.length>0).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ").trim()}}var a={__esModule:true};a.OpenApiUIMapper=e;return a});
|
|
2
2
|
//# sourceMappingURL=OpenApiUIMapper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenApiUIMapper.js","names":["OpenApiUIMapper","build","swaggerProp","keyName","ui","title","label","this","generateLabel","readOnly","format","widget","validators","push","name","spaced","replace","split","filter","w","length","map","word","charAt","toUpperCase","slice","toLowerCase","join","trim","__exports","__esModule"],"sources":["OpenApiUIMapper.ts"],"sourcesContent":["/**\n * @file OpenApiUIMapper.ts\n * @description Utility class for mapping OpenAPI properties and formats into MetaUI IUIDirectives.\n */\nimport { IUIDirective } from \"../interfaces/ISchema\";\n\n/**\n * Utility class responsible for evaluating OpenAPI metadata and generating the corresponding \n * MetaUI UI rendering directives. This isolates all visual layout assumptions from the parsing engine.\n * \n * @public\n */\nexport class OpenApiUIMapper {\n /**\n * Evaluates an OpenAPI property definition and constructs a MetaUI IUIDirective block.\n * Extracts labels from title/description, maps readOnly state, and assigns \n * specific UI5 Fiori widgets based on the OpenAPI 'format' property.\n * \n * @param {any} swaggerProp The raw OpenAPI property schema chunk.\n * @param {string} keyName The technical JSON key of the property.\n * @returns {IUIDirective} The constructed MetaUI UI orchestration directive.\n */\n public static build(swaggerProp: unknown, keyName: string): IUIDirective {\n const ui: IUIDirective = {};\n\n // Label Synthesis\n if (swaggerProp.title) {\n ui.label = swaggerProp.title;\n } else {\n ui.label = this.generateLabel(keyName);\n }\n\n // State Mapping\n if (swaggerProp.readOnly === true) {\n ui.readOnly = true;\n }\n\n // Format to Widget Translation\n if (swaggerProp.format) {\n switch (swaggerProp.format) {\n case \"date-time\":\n ui.widget = \"datetime\";\n break;\n case \"date\":\n ui.widget = \"date\";\n break;\n case \"password\":\n ui.
|
|
1
|
+
{"version":3,"file":"OpenApiUIMapper.js","names":["OpenApiUIMapper","build","swaggerProp","keyName","ui","title","label","this","generateLabel","readOnly","format","widget","validators","push","name","spaced","replace","split","filter","w","length","map","word","charAt","toUpperCase","slice","toLowerCase","join","trim","__exports","__esModule"],"sources":["OpenApiUIMapper.ts"],"sourcesContent":["/**\n * @file OpenApiUIMapper.ts\n * @description Utility class for mapping OpenAPI properties and formats into MetaUI IUIDirectives.\n */\nimport { IUIDirective } from \"../interfaces/ISchema\";\n\n/**\n * Utility class responsible for evaluating OpenAPI metadata and generating the corresponding \n * MetaUI UI rendering directives. This isolates all visual layout assumptions from the parsing engine.\n * \n * @public\n */\nexport class OpenApiUIMapper {\n /**\n * Evaluates an OpenAPI property definition and constructs a MetaUI IUIDirective block.\n * Extracts labels from title/description, maps readOnly state, and assigns \n * specific UI5 Fiori widgets based on the OpenAPI 'format' property.\n * \n * @param {any} swaggerProp The raw OpenAPI property schema chunk.\n * @param {string} keyName The technical JSON key of the property.\n * @returns {IUIDirective} The constructed MetaUI UI orchestration directive.\n */\n public static build(swaggerProp: unknown, keyName: string): IUIDirective {\n const ui: IUIDirective = {};\n\n // Label Synthesis\n if (swaggerProp.title) {\n ui.label = swaggerProp.title;\n } else {\n ui.label = this.generateLabel(keyName);\n }\n\n // State Mapping\n if (swaggerProp.readOnly === true) {\n ui.readOnly = true;\n }\n\n // Format to Widget Translation\n if (swaggerProp.format) {\n switch (swaggerProp.format) {\n case \"date-time\":\n ui.widget = \"datetime\";\n break;\n case \"date\":\n ui.widget = \"date\";\n break;\n case \"password\":\n ui.widget = \"password\";\n ui.format = \"password\"; // Kept for schema validation\n break;\n case \"email\":\n ui.widget = \"email\";\n ui.format = \"email\"; // Kept for schema validation\n break;\n case \"uri\":\n ui.widget = \"link\";\n ui.format = \"url\"; // Kept for schema validation\n break;\n case \"binary\":\n case \"byte\":\n ui.widget = \"fileUploader\";\n break;\n case \"uuid\":\n case \"ipv4\":\n case \"ipv6\":\n case \"hostname\":\n if (!ui.validators) ui.validators = [];\n ui.validators.push(swaggerProp.format);\n break;\n }\n }\n\n return ui;\n }\n\n /**\n * Synthesizes a human-readable Title Case label from camelCase or snake_case technical keys.\n * \n * @param {string} name The raw technical property key (e.g., 'creationTimestamp').\n * @returns {string} The formatted human-readable label (e.g., 'Creation Timestamp').\n * @private\n */\n private static generateLabel(name: string): string {\n if (!name) return \"\";\n let spaced = name.replace(/([A-Z])/g, \" $1\").replace(/_/g, \" \");\n return spaced.split(' ')\n .filter(w => w.length > 0)\n .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())\n .join(' ')\n .trim();\n }\n}\n"],"mappings":"yCAYO,MAAMA,EAUT,YAAcC,CAAMC,EAAsBC,GACtC,MAAMC,EAAmB,CAAC,EAG1B,GAAIF,EAAYG,MAAO,CACnBD,EAAGE,MAAQJ,EAAYG,KAC3B,KAAO,CACHD,EAAGE,MAAQC,KAAKC,cAAcL,EAClC,CAGA,GAAID,EAAYO,WAAa,KAAM,CAC/BL,EAAGK,SAAW,IAClB,CAGA,GAAIP,EAAYQ,OAAQ,CACpB,OAAQR,EAAYQ,QAChB,IAAK,YACDN,EAAGO,OAAS,WACZ,MACJ,IAAK,OACDP,EAAGO,OAAS,OACZ,MACJ,IAAK,WACDP,EAAGO,OAAS,WACZP,EAAGM,OAAS,WACZ,MACJ,IAAK,QACDN,EAAGO,OAAS,QACZP,EAAGM,OAAS,QACZ,MACJ,IAAK,MACDN,EAAGO,OAAS,OACZP,EAAGM,OAAS,MACZ,MACJ,IAAK,SACL,IAAK,OACDN,EAAGO,OAAS,eACZ,MACJ,IAAK,OACL,IAAK,OACL,IAAK,OACL,IAAK,WACD,IAAKP,EAAGQ,WAAYR,EAAGQ,WAAa,GACpCR,EAAGQ,WAAWC,KAAKX,EAAYQ,QAC/B,MAEZ,CAEA,OAAON,CACX,CASA,oBAAeI,CAAcM,GACzB,IAAKA,EAAM,MAAO,GAClB,IAAIC,EAASD,EAAKE,QAAQ,WAAY,OAAOA,QAAQ,KAAM,KAC3D,OAAOD,EAAOE,MAAM,KACfC,OAAOC,GAAKA,EAAEC,OAAS,GACvBC,IAAIC,GAAQA,EAAKC,OAAO,GAAGC,cAAgBF,EAAKG,MAAM,GAAGC,eACzDC,KAAK,KACLC,MACT,EACH,IAAAC,EAAA,CAAAC,WAAA,MAAAD,EAAA7B,kBAAA,OAAA6B,CAAA","ignoreList":[]}
|
|
@@ -45,13 +45,16 @@ export class OpenApiUIMapper {
|
|
|
45
45
|
ui.widget = "date";
|
|
46
46
|
break;
|
|
47
47
|
case "password":
|
|
48
|
-
ui.
|
|
48
|
+
ui.widget = "password";
|
|
49
|
+
ui.format = "password"; // Kept for schema validation
|
|
49
50
|
break;
|
|
50
51
|
case "email":
|
|
51
|
-
ui.
|
|
52
|
+
ui.widget = "email";
|
|
53
|
+
ui.format = "email"; // Kept for schema validation
|
|
52
54
|
break;
|
|
53
55
|
case "uri":
|
|
54
|
-
ui.
|
|
56
|
+
ui.widget = "link";
|
|
57
|
+
ui.format = "url"; // Kept for schema validation
|
|
55
58
|
break;
|
|
56
59
|
case "binary":
|
|
57
60
|
case "byte":
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
sap.ui.define(["./BasePlugin", "sap/m/Input", "sap/m/Text"], function (___BasePlugin, Input, TextControl) {
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const BasePlugin = ___BasePlugin["BasePlugin"];
|
|
5
|
+
class EmailPlugin extends BasePlugin {
|
|
6
|
+
render(fieldMetadata, bindingPath, modelName = "meta", engineScopeId, onChange) {
|
|
7
|
+
this.onChange = onChange;
|
|
8
|
+
this.metadata = fieldMetadata;
|
|
9
|
+
this.fieldKey = bindingPath.replace("/", "");
|
|
10
|
+
if (!this.isEditable) {
|
|
11
|
+
this.control = new TextControl({
|
|
12
|
+
id: this.generateStableId(engineScopeId, bindingPath),
|
|
13
|
+
text: this.generateBindingInfo(bindingPath, modelName)
|
|
14
|
+
});
|
|
15
|
+
this.applyCommonDirectives(this.control, fieldMetadata, modelName);
|
|
16
|
+
return this.control;
|
|
17
|
+
}
|
|
18
|
+
this.control = new Input({
|
|
19
|
+
id: this.generateStableId(engineScopeId, bindingPath),
|
|
20
|
+
value: this.generateBindingInfo(bindingPath, modelName),
|
|
21
|
+
type: "Email",
|
|
22
|
+
maxLength: fieldMetadata.maxLength || 0,
|
|
23
|
+
required: !!fieldMetadata.required,
|
|
24
|
+
change: oEvent => {
|
|
25
|
+
const result = this.validateAndApplyVisualState();
|
|
26
|
+
if (this.onChange) this.onChange(result.isValid, this.fieldKey);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
this.applyCommonDirectives(this.control, fieldMetadata, modelName);
|
|
30
|
+
return this.control;
|
|
31
|
+
}
|
|
32
|
+
getValue() {
|
|
33
|
+
return this.control && this.control.getMetadata().getName() === "sap.m.Input" ? this.control.getValue() : null;
|
|
34
|
+
}
|
|
35
|
+
applyState() {
|
|
36
|
+
if (!this.control || !this.metadata || this.control.getMetadata().getName() !== "sap.m.Input") return;
|
|
37
|
+
const input = this.control;
|
|
38
|
+
input.setEditable(!this.metadata.ui?.readOnly);
|
|
39
|
+
input.setRequired(!!this.metadata.required);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
var __exports = {
|
|
43
|
+
__esModule: true
|
|
44
|
+
};
|
|
45
|
+
__exports.EmailPlugin = EmailPlugin;
|
|
46
|
+
return __exports;
|
|
47
|
+
});
|
|
48
|
+
//# sourceMappingURL=EmailPlugin-dbg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmailPlugin-dbg.js","names":["BasePlugin","___BasePlugin","EmailPlugin","render","fieldMetadata","bindingPath","modelName","engineScopeId","onChange","metadata","fieldKey","replace","isEditable","control","TextControl","id","generateStableId","text","generateBindingInfo","applyCommonDirectives","Input","value","type","maxLength","required","change","oEvent","result","validateAndApplyVisualState","isValid","getValue","getMetadata","getName","applyState","input","setEditable","ui","readOnly","setRequired","__exports","__esModule"],"sources":["EmailPlugin.ts"],"sourcesContent":["import { BasePlugin } from \"./BasePlugin\";\nimport { IPropertyMetadata } from \"../../interfaces/ISchema\";\nimport Input from \"sap/m/Input\";\nimport Control from \"sap/ui/core/Control\";\nimport TextControl from \"sap/m/Text\";\n\nexport class EmailPlugin extends BasePlugin {\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(\"/\", \"\");\n \n if (!this.isEditable) {\n this.control = new TextControl({\n id: this.generateStableId(engineScopeId, bindingPath),\n text: this.generateBindingInfo(bindingPath, modelName)\n });\n this.applyCommonDirectives(this.control, fieldMetadata, modelName);\n return this.control as Control;\n }\n\n this.control = new Input({\n id: this.generateStableId(engineScopeId, bindingPath),\n value: this.generateBindingInfo(bindingPath, modelName),\n type: \"Email\",\n maxLength: fieldMetadata.maxLength || 0,\n required: !!fieldMetadata.required,\n change: (oEvent: sap.ui.base.Event) => {\n const result = this.validateAndApplyVisualState();\n if (this.onChange) this.onChange(result.isValid, this.fieldKey);\n }\n });\n\n this.applyCommonDirectives(this.control, fieldMetadata, modelName);\n return this.control as Control;\n }\n\n protected getValue(): unknown {\n return this.control && this.control.getMetadata().getName() === \"sap.m.Input\" ? (this.control as Input).getValue() : null;\n }\n\n protected applyState(): void {\n if (!this.control || !this.metadata || this.control.getMetadata().getName() !== \"sap.m.Input\") return;\n const input = this.control as Input;\n input.setEditable(!this.metadata.ui?.readOnly);\n input.setRequired(!!this.metadata.required);\n }\n}\n"],"mappings":";;;QAASA,UAAU,GAAAC,aAAA;EAMZ,MAAMC,WAAW,SAASF,UAAU,CAAC;IACjCG,MAAMA,CAACC,aAAgC,EAAEC,WAAmB,EAAEC,SAAiB,GAAG,MAAM,EAAEC,aAAsB,EAAEC,QAAwD,EAAW;MACxL,IAAI,CAACA,QAAQ,GAAGA,QAAQ;MACxB,IAAI,CAACC,QAAQ,GAAGL,aAAa;MAC7B,IAAI,CAACM,QAAQ,GAAGL,WAAW,CAACM,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;MAE5C,IAAI,CAAC,IAAI,CAACC,UAAU,EAAE;QAClB,IAAI,CAACC,OAAO,GAAG,IAAIC,WAAW,CAAC;UAC3BC,EAAE,EAAE,IAAI,CAACC,gBAAgB,CAACT,aAAa,EAAEF,WAAW,CAAC;UACrDY,IAAI,EAAE,IAAI,CAACC,mBAAmB,CAACb,WAAW,EAAEC,SAAS;QACzD,CAAC,CAAC;QACF,IAAI,CAACa,qBAAqB,CAAC,IAAI,CAACN,OAAO,EAAET,aAAa,EAAEE,SAAS,CAAC;QAClE,OAAO,IAAI,CAACO,OAAO;MACvB;MAEA,IAAI,CAACA,OAAO,GAAG,IAAIO,KAAK,CAAC;QACrBL,EAAE,EAAE,IAAI,CAACC,gBAAgB,CAACT,aAAa,EAAEF,WAAW,CAAC;QACrDgB,KAAK,EAAE,IAAI,CAACH,mBAAmB,CAACb,WAAW,EAAEC,SAA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;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare module "nz/co/siliconst/ui5/metaui/plugins/controls/EmailPlugin" {
|
|
2
|
+
import { BasePlugin } from "nz/co/siliconst/ui5/metaui/plugins/controls/BasePlugin";
|
|
3
|
+
import { IPropertyMetadata } from "nz/co/siliconst/ui5/metaui/interfaces/ISchema";
|
|
4
|
+
import Control from "sap/ui/core/Control";
|
|
5
|
+
export class EmailPlugin extends BasePlugin {
|
|
6
|
+
render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName?: string, engineScopeId?: string, onChange?: (isValid: boolean, fieldKey?: string) => void): Control;
|
|
7
|
+
protected getValue(): unknown;
|
|
8
|
+
protected applyState(): void;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=EmailPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmailPlugin.d.ts","sourceRoot":"../../../../../../../../..","sources":["src/nz/co/siliconst/ui5/metaui/plugins/controls/EmailPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,yDAAyD,CAAC;IACzE,OAAO,EAAE,UAAU,EAAE,MAAM,wDAAwD,CAAC;IACpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;IAElF,OAAO,OAAO,MAAM,qBAAqB,CAAC;IAG1C,MAAa,WAAY,SAAQ,UAAU;QAChC,MAAM,CAAC,aAAa,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,EAAE,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;QA8B3L,SAAS,CAAC,QAAQ,IAAI,OAAO;QAI7B,SAAS,CAAC,UAAU,IAAI,IAAI;KAM/B;CAEA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
sap.ui.define(["./BasePlugin","sap/m/Input","sap/m/Text"],function(t,e,i){"use strict";const a=t["BasePlugin"];class n extends a{render(t,a,n="meta",s,r){this.onChange=r;this.metadata=t;this.fieldKey=a.replace("/","");if(!this.isEditable){this.control=new i({id:this.generateStableId(s,a),text:this.generateBindingInfo(a,n)});this.applyCommonDirectives(this.control,t,n);return this.control}this.control=new e({id:this.generateStableId(s,a),value:this.generateBindingInfo(a,n),type:"Email",maxLength:t.maxLength||0,required:!!t.required,change:t=>{const e=this.validateAndApplyVisualState();if(this.onChange)this.onChange(e.isValid,this.fieldKey)}});this.applyCommonDirectives(this.control,t,n);return this.control}getValue(){return this.control&&this.control.getMetadata().getName()==="sap.m.Input"?this.control.getValue():null}applyState(){if(!this.control||!this.metadata||this.control.getMetadata().getName()!=="sap.m.Input")return;const t=this.control;t.setEditable(!this.metadata.ui?.readOnly);t.setRequired(!!this.metadata.required)}}var s={__esModule:true};s.EmailPlugin=n;return s});
|
|
2
|
+
//# sourceMappingURL=EmailPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmailPlugin.js","names":["BasePlugin","___BasePlugin","EmailPlugin","render","fieldMetadata","bindingPath","modelName","engineScopeId","onChange","this","metadata","fieldKey","replace","isEditable","control","TextControl","id","generateStableId","text","generateBindingInfo","applyCommonDirectives","Input","value","type","maxLength","required","change","oEvent","result","validateAndApplyVisualState","isValid","getValue","getMetadata","getName","applyState","input","setEditable","ui","readOnly","setRequired","__exports","__esModule"],"sources":["EmailPlugin.ts"],"sourcesContent":["import { BasePlugin } from \"./BasePlugin\";\nimport { IPropertyMetadata } from \"../../interfaces/ISchema\";\nimport Input from \"sap/m/Input\";\nimport Control from \"sap/ui/core/Control\";\nimport TextControl from \"sap/m/Text\";\n\nexport class EmailPlugin extends BasePlugin {\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(\"/\", \"\");\n \n if (!this.isEditable) {\n this.control = new TextControl({\n id: this.generateStableId(engineScopeId, bindingPath),\n text: this.generateBindingInfo(bindingPath, modelName)\n });\n this.applyCommonDirectives(this.control, fieldMetadata, modelName);\n return this.control as Control;\n }\n\n this.control = new Input({\n id: this.generateStableId(engineScopeId, bindingPath),\n value: this.generateBindingInfo(bindingPath, modelName),\n type: \"Email\",\n maxLength: fieldMetadata.maxLength || 0,\n required: !!fieldMetadata.required,\n change: (oEvent: sap.ui.base.Event) => {\n const result = this.validateAndApplyVisualState();\n if (this.onChange) this.onChange(result.isValid, this.fieldKey);\n }\n });\n\n this.applyCommonDirectives(this.control, fieldMetadata, modelName);\n return this.control as Control;\n }\n\n protected getValue(): unknown {\n return this.control && this.control.getMetadata().getName() === \"sap.m.Input\" ? (this.control as Input).getValue() : null;\n }\n\n protected applyState(): void {\n if (!this.control || !this.metadata || this.control.getMetadata().getName() !== \"sap.m.Input\") return;\n const input = this.control as Input;\n input.setEditable(!this.metadata.ui?.readOnly);\n input.setRequired(!!this.metadata.required);\n }\n}\n"],"mappings":"6FAASA,EAAUC,EAAA,cAMZ,MAAMC,UAAoBF,EACtBG,OAAOC,EAAkCC,EAAqBC,EAAoB,OAAQC,EAAwBC,GACrHC,KAAKD,SAAWA,EAChBC,KAAKC,SAAWN,EAChBK,KAAKE,SAAWN,EAAYO,QAAQ,IAAK,IAEzC,IAAKH,KAAKI,WAAY,CAClBJ,KAAKK,QAAU,IAAIC,EAAY,CAC3BC,GAAIP,KAAKQ,iBAAiBV,EAAeF,GACzCa,KAAMT,KAAKU,oBAAoBd,EAAaC,KAEhDG,KAAKW,sBAAsBX,KAAKK,QAASV,EAAeE,GACxD,OAAOG,KAAKK,OAChB,CAEAL,KAAKK,QAAU,IAAIO,EAAM,CACrBL,GAAIP,KAAKQ,iBAAiBV,EAAeF,GACzCiB,MAAOb,KAAKU,oBAAoBd,EAAaC,GAC7CiB,KAAM,QACNC,UAAWpB,EAAcoB,WAAa,EACtCC,WAAYrB,EAAcqB,SAC1BC,OAASC,IACL,MAAMC,EAASnB,KAAKoB,8BACpB,GAAIpB,KAAKD,SAAUC,KAAKD,SAASoB,EAAOE,QAASrB,KAAKE,aAI9DF,KAAKW,sBAAsBX,KAAKK,QAASV,EAAeE,GACxD,OAAOG,KAAKK,OAChB,CAEUiB,WACN,OAAOtB,KAAKK,SAAWL,KAAKK,QAAQkB,cAAcC,YAAc,cAAiBxB,KAAKK,QAAkBiB,WAAa,IACzH,CAEUG,aACN,IAAKzB,KAAKK,UAAYL,KAAKC,UAAYD,KAAKK,QAAQkB,cAAcC,YAAc,cAAe,OAC/F,MAAME,EAAQ1B,KAAKK,QACnBqB,EAAMC,aAAa3B,KAAKC,SAAS2B,IAAIC,UACrCH,EAAMI,cAAc9B,KAAKC,SAASe,SACtC,EACH,IAAAe,EAAA,CAAAC,WAAA,MAAAD,EAAAtC,cAAA,OAAAsC,CAAA","ignoreList":[]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { BasePlugin } from "./BasePlugin";
|
|
2
|
+
import { IPropertyMetadata } from "../../interfaces/ISchema";
|
|
3
|
+
import Input from "sap/m/Input";
|
|
4
|
+
import Control from "sap/ui/core/Control";
|
|
5
|
+
import TextControl from "sap/m/Text";
|
|
6
|
+
|
|
7
|
+
export class EmailPlugin extends BasePlugin {
|
|
8
|
+
public render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName: string = "meta", engineScopeId?: string, onChange?: (isValid: boolean, fieldKey?: string) => void): Control {
|
|
9
|
+
this.onChange = onChange;
|
|
10
|
+
this.metadata = fieldMetadata;
|
|
11
|
+
this.fieldKey = bindingPath.replace("/", "");
|
|
12
|
+
|
|
13
|
+
if (!this.isEditable) {
|
|
14
|
+
this.control = new TextControl({
|
|
15
|
+
id: this.generateStableId(engineScopeId, bindingPath),
|
|
16
|
+
text: this.generateBindingInfo(bindingPath, modelName)
|
|
17
|
+
});
|
|
18
|
+
this.applyCommonDirectives(this.control, fieldMetadata, modelName);
|
|
19
|
+
return this.control as Control;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
this.control = new Input({
|
|
23
|
+
id: this.generateStableId(engineScopeId, bindingPath),
|
|
24
|
+
value: this.generateBindingInfo(bindingPath, modelName),
|
|
25
|
+
type: "Email",
|
|
26
|
+
maxLength: fieldMetadata.maxLength || 0,
|
|
27
|
+
required: !!fieldMetadata.required,
|
|
28
|
+
change: (oEvent: sap.ui.base.Event) => {
|
|
29
|
+
const result = this.validateAndApplyVisualState();
|
|
30
|
+
if (this.onChange) this.onChange(result.isValid, this.fieldKey);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
this.applyCommonDirectives(this.control, fieldMetadata, modelName);
|
|
35
|
+
return this.control as Control;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
protected getValue(): unknown {
|
|
39
|
+
return this.control && this.control.getMetadata().getName() === "sap.m.Input" ? (this.control as Input).getValue() : null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
protected applyState(): void {
|
|
43
|
+
if (!this.control || !this.metadata || this.control.getMetadata().getName() !== "sap.m.Input") return;
|
|
44
|
+
const input = this.control as Input;
|
|
45
|
+
input.setEditable(!this.metadata.ui?.readOnly);
|
|
46
|
+
input.setRequired(!!this.metadata.required);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
sap.ui.define(["./BasePlugin", "sap/m/Link", "sap/m/Input"], function (___BasePlugin, Link, Input) {
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const BasePlugin = ___BasePlugin["BasePlugin"];
|
|
5
|
+
class LinkPlugin extends BasePlugin {
|
|
6
|
+
render(fieldMetadata, bindingPath, modelName = "meta", engineScopeId, onChange) {
|
|
7
|
+
this.onChange = onChange;
|
|
8
|
+
this.metadata = fieldMetadata;
|
|
9
|
+
this.fieldKey = bindingPath.replace("/", "");
|
|
10
|
+
if (!this.isEditable) {
|
|
11
|
+
this.control = new Link({
|
|
12
|
+
id: this.generateStableId(engineScopeId, bindingPath),
|
|
13
|
+
text: this.generateBindingInfo(bindingPath, modelName),
|
|
14
|
+
href: this.generateBindingInfo(bindingPath, modelName),
|
|
15
|
+
target: "_blank"
|
|
16
|
+
});
|
|
17
|
+
this.applyCommonDirectives(this.control, fieldMetadata, modelName);
|
|
18
|
+
return this.control;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Editable mode: user needs to type a URL, so we use an Input configured for URLs
|
|
22
|
+
this.control = new Input({
|
|
23
|
+
id: this.generateStableId(engineScopeId, bindingPath),
|
|
24
|
+
value: this.generateBindingInfo(bindingPath, modelName),
|
|
25
|
+
type: "Url",
|
|
26
|
+
maxLength: fieldMetadata.maxLength || 0,
|
|
27
|
+
required: !!fieldMetadata.required,
|
|
28
|
+
change: oEvent => {
|
|
29
|
+
const result = this.validateAndApplyVisualState();
|
|
30
|
+
if (this.onChange) this.onChange(result.isValid, this.fieldKey);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
this.applyCommonDirectives(this.control, fieldMetadata, modelName);
|
|
34
|
+
return this.control;
|
|
35
|
+
}
|
|
36
|
+
getValue() {
|
|
37
|
+
if (!this.control) return null;
|
|
38
|
+
if (this.control.getMetadata().getName() === "sap.m.Input") {
|
|
39
|
+
return this.control.getValue();
|
|
40
|
+
}
|
|
41
|
+
return this.control.getHref();
|
|
42
|
+
}
|
|
43
|
+
applyState() {
|
|
44
|
+
if (!this.control || !this.metadata) return;
|
|
45
|
+
if (this.control.getMetadata().getName() === "sap.m.Input") {
|
|
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.LinkPlugin = LinkPlugin;
|
|
56
|
+
return __exports;
|
|
57
|
+
});
|
|
58
|
+
//# sourceMappingURL=LinkPlugin-dbg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LinkPlugin-dbg.js","names":["BasePlugin","___BasePlugin","LinkPlugin","render","fieldMetadata","bindingPath","modelName","engineScopeId","onChange","metadata","fieldKey","replace","isEditable","control","Link","id","generateStableId","text","generateBindingInfo","href","target","applyCommonDirectives","Input","value","type","maxLength","required","change","oEvent","result","validateAndApplyVisualState","isValid","getValue","getMetadata","getName","getHref","applyState","input","setEditable","ui","readOnly","setRequired","__exports","__esModule"],"sources":["LinkPlugin.ts"],"sourcesContent":["import { BasePlugin } from \"./BasePlugin\";\nimport { IPropertyMetadata } from \"../../interfaces/ISchema\";\nimport Link from \"sap/m/Link\";\nimport Input from \"sap/m/Input\";\nimport Control from \"sap/ui/core/Control\";\n\nexport class LinkPlugin extends BasePlugin {\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(\"/\", \"\");\n \n if (!this.isEditable) {\n this.control = new Link({\n id: this.generateStableId(engineScopeId, bindingPath),\n text: this.generateBindingInfo(bindingPath, modelName),\n href: this.generateBindingInfo(bindingPath, modelName),\n target: \"_blank\"\n });\n this.applyCommonDirectives(this.control, fieldMetadata, modelName);\n return this.control as Control;\n }\n\n // Editable mode: user needs to type a URL, so we use an Input configured for URLs\n this.control = new Input({\n id: this.generateStableId(engineScopeId, bindingPath),\n value: this.generateBindingInfo(bindingPath, modelName),\n type: \"Url\",\n maxLength: fieldMetadata.maxLength || 0,\n required: !!fieldMetadata.required,\n change: (oEvent: sap.ui.base.Event) => {\n const result = this.validateAndApplyVisualState();\n if (this.onChange) this.onChange(result.isValid, this.fieldKey);\n }\n });\n \n this.applyCommonDirectives(this.control, fieldMetadata, modelName);\n return this.control as Control;\n }\n \n protected getValue(): unknown {\n if (!this.control) return null;\n if (this.control.getMetadata().getName() === \"sap.m.Input\") {\n return (this.control as Input).getValue();\n }\n return (this.control as Link).getHref();\n }\n \n protected applyState(): void {\n if (!this.control || !this.metadata) return;\n if (this.control.getMetadata().getName() === \"sap.m.Input\") {\n const input = this.control as Input;\n input.setEditable(!this.metadata.ui?.readOnly);\n input.setRequired(!!this.metadata.required);\n }\n }\n}\n"],"mappings":";;;QAASA,UAAU,GAAAC,aAAA;EAMZ,MAAMC,UAAU,SAASF,UAAU,CAAC;IAChCG,MAAMA,CAACC,aAAgC,EAAEC,WAAmB,EAAEC,SAAiB,GAAG,MAAM,EAAEC,aAAsB,EAAEC,QAAwD,EAAW;MACxL,IAAI,CAACA,QAAQ,GAAGA,QAAQ;MACxB,IAAI,CAACC,QAAQ,GAAGL,aAAa;MAC7B,IAAI,CAACM,QAAQ,GAAGL,WAAW,CAACM,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;MAE5C,IAAI,CAAC,IAAI,CAACC,UAAU,EAAE;QAClB,IAAI,CAACC,OAAO,GAAG,IAAIC,IAAI,CAAC;UACpBC,EAAE,EAAE,IAAI,CAACC,gBAAgB,CAACT,aAAa,EAAEF,WAAW,CAAC;UACrDY,IAAI,EAAE,IAAI,CAACC,mBAAmB,CAACb,WAAW,EAAEC,SAAS,CAAC;UACtDa,IAAI,EAAE,IAAI,CAACD,mBAAmB,CAACb,WAAW,EAAEC,SAAS,CAAC;UACtDc,MAAM,EAAE;QACZ,CAAC,CAAC;QACF,IAAI,CAACC,qBAAqB,CAAC,IAAI,CAACR,OAAO,EAAET,aAAa,EAAEE,SAAS,CAAC;QAClE,OAAO,IAAI,CAACO,OAAO;MACvB;;MAEA;MACA,IAAI,CAACA,OAAO,GAAG,IAAIS,KAAK,CAAC;QACrBP,EAAE,EAAE,IAAI,CAACC,gBAAgB,CAACT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C;QAC9CH,KAAK,CAACI,WAAW,CAAC,CAAC,CAAC,IAAI,CAAChC,QAAQ,CAACiB,QAAQ,CAAC;MAC/C;IACJ;EACJ;EAAC,IAAAgB,SAAA;IAAAC,UAAA;EAAA;EAAAD,SAAA,CAAAxC,UAAA,GAAAA,UAAA;EAAA,OAAAwC,SAAA;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare module "nz/co/siliconst/ui5/metaui/plugins/controls/LinkPlugin" {
|
|
2
|
+
import { BasePlugin } from "nz/co/siliconst/ui5/metaui/plugins/controls/BasePlugin";
|
|
3
|
+
import { IPropertyMetadata } from "nz/co/siliconst/ui5/metaui/interfaces/ISchema";
|
|
4
|
+
import Control from "sap/ui/core/Control";
|
|
5
|
+
export class LinkPlugin extends BasePlugin {
|
|
6
|
+
render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName?: string, engineScopeId?: string, onChange?: (isValid: boolean, fieldKey?: string) => void): Control;
|
|
7
|
+
protected getValue(): unknown;
|
|
8
|
+
protected applyState(): void;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=LinkPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LinkPlugin.d.ts","sourceRoot":"../../../../../../../../..","sources":["src/nz/co/siliconst/ui5/metaui/plugins/controls/LinkPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,wDAAwD,CAAC;IACxE,OAAO,EAAE,UAAU,EAAE,MAAM,wDAAwD,CAAC;IACpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;IAGlF,OAAO,OAAO,MAAM,qBAAqB,CAAC;IAE1C,MAAa,UAAW,SAAQ,UAAU;QAC/B,MAAM,CAAC,aAAa,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,EAAE,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;QAiC3L,SAAS,CAAC,QAAQ,IAAI,OAAO;QAQ7B,SAAS,CAAC,UAAU,IAAI,IAAI;KAQ/B;CAEA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
sap.ui.define(["./BasePlugin","sap/m/Link","sap/m/Input"],function(t,e,i){"use strict";const n=t["BasePlugin"];class a extends n{render(t,n,a="meta",s,r){this.onChange=r;this.metadata=t;this.fieldKey=n.replace("/","");if(!this.isEditable){this.control=new e({id:this.generateStableId(s,n),text:this.generateBindingInfo(n,a),href:this.generateBindingInfo(n,a),target:"_blank"});this.applyCommonDirectives(this.control,t,a);return this.control}this.control=new i({id:this.generateStableId(s,n),value:this.generateBindingInfo(n,a),type:"Url",maxLength:t.maxLength||0,required:!!t.required,change:t=>{const e=this.validateAndApplyVisualState();if(this.onChange)this.onChange(e.isValid,this.fieldKey)}});this.applyCommonDirectives(this.control,t,a);return this.control}getValue(){if(!this.control)return null;if(this.control.getMetadata().getName()==="sap.m.Input"){return this.control.getValue()}return this.control.getHref()}applyState(){if(!this.control||!this.metadata)return;if(this.control.getMetadata().getName()==="sap.m.Input"){const t=this.control;t.setEditable(!this.metadata.ui?.readOnly);t.setRequired(!!this.metadata.required)}}}var s={__esModule:true};s.LinkPlugin=a;return s});
|
|
2
|
+
//# sourceMappingURL=LinkPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LinkPlugin.js","names":["BasePlugin","___BasePlugin","LinkPlugin","render","fieldMetadata","bindingPath","modelName","engineScopeId","onChange","this","metadata","fieldKey","replace","isEditable","control","Link","id","generateStableId","text","generateBindingInfo","href","target","applyCommonDirectives","Input","value","type","maxLength","required","change","oEvent","result","validateAndApplyVisualState","isValid","getValue","getMetadata","getName","getHref","applyState","input","setEditable","ui","readOnly","setRequired","__exports","__esModule"],"sources":["LinkPlugin.ts"],"sourcesContent":["import { BasePlugin } from \"./BasePlugin\";\nimport { IPropertyMetadata } from \"../../interfaces/ISchema\";\nimport Link from \"sap/m/Link\";\nimport Input from \"sap/m/Input\";\nimport Control from \"sap/ui/core/Control\";\n\nexport class LinkPlugin extends BasePlugin {\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(\"/\", \"\");\n \n if (!this.isEditable) {\n this.control = new Link({\n id: this.generateStableId(engineScopeId, bindingPath),\n text: this.generateBindingInfo(bindingPath, modelName),\n href: this.generateBindingInfo(bindingPath, modelName),\n target: \"_blank\"\n });\n this.applyCommonDirectives(this.control, fieldMetadata, modelName);\n return this.control as Control;\n }\n\n // Editable mode: user needs to type a URL, so we use an Input configured for URLs\n this.control = new Input({\n id: this.generateStableId(engineScopeId, bindingPath),\n value: this.generateBindingInfo(bindingPath, modelName),\n type: \"Url\",\n maxLength: fieldMetadata.maxLength || 0,\n required: !!fieldMetadata.required,\n change: (oEvent: sap.ui.base.Event) => {\n const result = this.validateAndApplyVisualState();\n if (this.onChange) this.onChange(result.isValid, this.fieldKey);\n }\n });\n \n this.applyCommonDirectives(this.control, fieldMetadata, modelName);\n return this.control as Control;\n }\n \n protected getValue(): unknown {\n if (!this.control) return null;\n if (this.control.getMetadata().getName() === \"sap.m.Input\") {\n return (this.control as Input).getValue();\n }\n return (this.control as Link).getHref();\n }\n \n protected applyState(): void {\n if (!this.control || !this.metadata) return;\n if (this.control.getMetadata().getName() === \"sap.m.Input\") {\n const input = this.control as Input;\n input.setEditable(!this.metadata.ui?.readOnly);\n input.setRequired(!!this.metadata.required);\n }\n }\n}\n"],"mappings":"6FAASA,EAAUC,EAAA,cAMZ,MAAMC,UAAmBF,EACrBG,OAAOC,EAAkCC,EAAqBC,EAAoB,OAAQC,EAAwBC,GACrHC,KAAKD,SA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|
2
|
+
import { IPropertyMetadata } from "../../interfaces/ISchema";
|
|
3
|
+
import Link from "sap/m/Link";
|
|
4
|
+
import Input from "sap/m/Input";
|
|
5
|
+
import Control from "sap/ui/core/Control";
|
|
6
|
+
|
|
7
|
+
export class LinkPlugin extends BasePlugin {
|
|
8
|
+
public render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName: string = "meta", engineScopeId?: string, onChange?: (isValid: boolean, fieldKey?: string) => void): Control {
|
|
9
|
+
this.onChange = onChange;
|
|
10
|
+
this.metadata = fieldMetadata;
|
|
11
|
+
this.fieldKey = bindingPath.replace("/", "");
|
|
12
|
+
|
|
13
|
+
if (!this.isEditable) {
|
|
14
|
+
this.control = new Link({
|
|
15
|
+
id: this.generateStableId(engineScopeId, bindingPath),
|
|
16
|
+
text: this.generateBindingInfo(bindingPath, modelName),
|
|
17
|
+
href: this.generateBindingInfo(bindingPath, modelName),
|
|
18
|
+
target: "_blank"
|
|
19
|
+
});
|
|
20
|
+
this.applyCommonDirectives(this.control, fieldMetadata, modelName);
|
|
21
|
+
return this.control as Control;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Editable mode: user needs to type a URL, so we use an Input configured for URLs
|
|
25
|
+
this.control = new Input({
|
|
26
|
+
id: this.generateStableId(engineScopeId, bindingPath),
|
|
27
|
+
value: this.generateBindingInfo(bindingPath, modelName),
|
|
28
|
+
type: "Url",
|
|
29
|
+
maxLength: fieldMetadata.maxLength || 0,
|
|
30
|
+
required: !!fieldMetadata.required,
|
|
31
|
+
change: (oEvent: sap.ui.base.Event) => {
|
|
32
|
+
const result = this.validateAndApplyVisualState();
|
|
33
|
+
if (this.onChange) this.onChange(result.isValid, this.fieldKey);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
this.applyCommonDirectives(this.control, fieldMetadata, modelName);
|
|
38
|
+
return this.control as Control;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
protected getValue(): unknown {
|
|
42
|
+
if (!this.control) return null;
|
|
43
|
+
if (this.control.getMetadata().getName() === "sap.m.Input") {
|
|
44
|
+
return (this.control as Input).getValue();
|
|
45
|
+
}
|
|
46
|
+
return (this.control as Link).getHref();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
protected applyState(): void {
|
|
50
|
+
if (!this.control || !this.metadata) return;
|
|
51
|
+
if (this.control.getMetadata().getName() === "sap.m.Input") {
|
|
52
|
+
const input = this.control as Input;
|
|
53
|
+
input.setEditable(!this.metadata.ui?.readOnly);
|
|
54
|
+
input.setRequired(!!this.metadata.required);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
sap.ui.define(["./BasePlugin", "sap/m/Input", "sap/m/Text"], function (___BasePlugin, Input, TextControl) {
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const BasePlugin = ___BasePlugin["BasePlugin"];
|
|
5
|
+
class PasswordPlugin extends BasePlugin {
|
|
6
|
+
render(fieldMetadata, bindingPath, modelName = "meta", engineScopeId, onChange) {
|
|
7
|
+
this.onChange = onChange;
|
|
8
|
+
this.metadata = fieldMetadata;
|
|
9
|
+
this.fieldKey = bindingPath.replace("/", "");
|
|
10
|
+
if (!this.isEditable) {
|
|
11
|
+
// Password in read-only should be masked natively
|
|
12
|
+
this.control = new TextControl({
|
|
13
|
+
id: this.generateStableId(engineScopeId, bindingPath),
|
|
14
|
+
text: "********"
|
|
15
|
+
});
|
|
16
|
+
this.applyCommonDirectives(this.control, fieldMetadata, modelName);
|
|
17
|
+
return this.control;
|
|
18
|
+
}
|
|
19
|
+
this.control = new Input({
|
|
20
|
+
id: this.generateStableId(engineScopeId, bindingPath),
|
|
21
|
+
value: this.generateBindingInfo(bindingPath, modelName),
|
|
22
|
+
type: "Password",
|
|
23
|
+
maxLength: fieldMetadata.maxLength || 0,
|
|
24
|
+
required: !!fieldMetadata.required,
|
|
25
|
+
change: oEvent => {
|
|
26
|
+
const result = this.validateAndApplyVisualState();
|
|
27
|
+
if (this.onChange) this.onChange(result.isValid, this.fieldKey);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
this.applyCommonDirectives(this.control, fieldMetadata, modelName);
|
|
31
|
+
return this.control;
|
|
32
|
+
}
|
|
33
|
+
getValue() {
|
|
34
|
+
return this.control && this.control.getMetadata().getName() === "sap.m.Input" ? this.control.getValue() : null;
|
|
35
|
+
}
|
|
36
|
+
applyState() {
|
|
37
|
+
if (!this.control || !this.metadata || this.control.getMetadata().getName() !== "sap.m.Input") return;
|
|
38
|
+
const input = this.control;
|
|
39
|
+
input.setEditable(!this.metadata.ui?.readOnly);
|
|
40
|
+
input.setRequired(!!this.metadata.required);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
var __exports = {
|
|
44
|
+
__esModule: true
|
|
45
|
+
};
|
|
46
|
+
__exports.PasswordPlugin = PasswordPlugin;
|
|
47
|
+
return __exports;
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=PasswordPlugin-dbg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PasswordPlugin-dbg.js","names":["BasePlugin","___BasePlugin","PasswordPlugin","render","fieldMetadata","bindingPath","modelName","engineScopeId","onChange","metadata","fieldKey","replace","isEditable","control","TextControl","id","generateStableId","text","applyCommonDirectives","Input","value","generateBindingInfo","type","maxLength","required","change","oEvent","result","validateAndApplyVisualState","isValid","getValue","getMetadata","getName","applyState","input","setEditable","ui","readOnly","setRequired","__exports","__esModule"],"sources":["PasswordPlugin.ts"],"sourcesContent":["import { BasePlugin } from \"./BasePlugin\";\nimport { IPropertyMetadata } from \"../../interfaces/ISchema\";\nimport Input from \"sap/m/Input\";\nimport Control from \"sap/ui/core/Control\";\nimport TextControl from \"sap/m/Text\";\n\nexport class PasswordPlugin extends BasePlugin {\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(\"/\", \"\");\n \n if (!this.isEditable) {\n // Password in read-only should be masked natively\n this.control = new TextControl({\n id: this.generateStableId(engineScopeId, bindingPath),\n text: \"********\" \n });\n this.applyCommonDirectives(this.control, fieldMetadata, modelName);\n return this.control as Control;\n }\n\n this.control = new Input({\n id: this.generateStableId(engineScopeId, bindingPath),\n value: this.generateBindingInfo(bindingPath, modelName),\n type: \"Password\",\n maxLength: fieldMetadata.maxLength || 0,\n required: !!fieldMetadata.required,\n change: (oEvent: sap.ui.base.Event) => {\n const result = this.validateAndApplyVisualState();\n if (this.onChange) this.onChange(result.isValid, this.fieldKey);\n }\n });\n\n this.applyCommonDirectives(this.control, fieldMetadata, modelName);\n return this.control as Control;\n }\n\n protected getValue(): unknown {\n return this.control && this.control.getMetadata().getName() === \"sap.m.Input\" ? (this.control as Input).getValue() : null;\n }\n\n protected applyState(): void {\n if (!this.control || !this.metadata || this.control.getMetadata().getName() !== \"sap.m.Input\") return;\n const input = this.control as Input;\n input.setEditable(!this.metadata.ui?.readOnly);\n input.setRequired(!!this.metadata.required);\n }\n}\n"],"mappings":";;;QAASA,UAAU,GAAAC,aAAA;EAMZ,MAAMC,cAAc,SAASF,UAAU,CAAC;IACpCG,MAAMA,CAACC,aAAgC,EAAEC,WAAmB,EAAEC,SAAiB,GAAG,MAAM,EAAEC,aAAsB,EAAEC,QAAwD,EAAW;MACxL,IAAI,CAACA,QAAQ,GAAGA,QAAQ;MACxB,IAAI,CAACC,QAAQ,GAAGL,aAAa;MAC7B,IAAI,CAACM,QAAQ,GAAGL,WAAW,CAACM,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;MAE5C,IAAI,CAAC,IAAI,CAACC,UAAU,EAAE;QAClB;QACA,IAAI,CAACC,OAAO,GAAG,IAAIC,WAAW,CAAC;UAC3BC,EAAE,EAAE,IAAI,CAACC,gBAAgB,CAACT,aAAa,E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AC,KAAK,aAAa,EAAE;MAC/F,MAAME,KAAK,GAAG,IAAI,CAACrB,OAAgB;MACnCqB,KAAK,CAACC,WAAW,CAAC,CAAC,IAAI,CAAC1B,QAAQ,CAAC2B,EAAE,EAAEC,QAAQ,CAAC;MAC9CH,KAAK,CAACI,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC7B,QAAQ,CAACe,QAAQ,CAAC;IAC/C;EACJ;EAAC,IAAAe,SAAA;IAAAC,UAAA;EAAA;EAAAD,SAAA,CAAArC,cAAA,GAAAA,cAAA;EAAA,OAAAqC,SAAA;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare module "nz/co/siliconst/ui5/metaui/plugins/controls/PasswordPlugin" {
|
|
2
|
+
import { BasePlugin } from "nz/co/siliconst/ui5/metaui/plugins/controls/BasePlugin";
|
|
3
|
+
import { IPropertyMetadata } from "nz/co/siliconst/ui5/metaui/interfaces/ISchema";
|
|
4
|
+
import Control from "sap/ui/core/Control";
|
|
5
|
+
export class PasswordPlugin extends BasePlugin {
|
|
6
|
+
render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName?: string, engineScopeId?: string, onChange?: (isValid: boolean, fieldKey?: string) => void): Control;
|
|
7
|
+
protected getValue(): unknown;
|
|
8
|
+
protected applyState(): void;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=PasswordPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PasswordPlugin.d.ts","sourceRoot":"../../../../../../../../..","sources":["src/nz/co/siliconst/ui5/metaui/plugins/controls/PasswordPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,4DAA4D,CAAC;IAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,wDAAwD,CAAC;IACpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;IAElF,OAAO,OAAO,MAAM,qBAAqB,CAAC;IAG1C,MAAa,cAAe,SAAQ,UAAU;QACnC,MAAM,CAAC,aAAa,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,EAAE,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;QA+B3L,SAAS,CAAC,QAAQ,IAAI,OAAO;QAI7B,SAAS,CAAC,UAAU,IAAI,IAAI;KAM/B;CAEA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
sap.ui.define(["./BasePlugin","sap/m/Input","sap/m/Text"],function(t,e,i){"use strict";const a=t["BasePlugin"];class s extends a{render(t,a,s="meta",n,r){this.onChange=r;this.metadata=t;this.fieldKey=a.replace("/","");if(!this.isEditable){this.control=new i({id:this.generateStableId(n,a),text:"********"});this.applyCommonDirectives(this.control,t,s);return this.control}this.control=new e({id:this.generateStableId(n,a),value:this.generateBindingInfo(a,s),type:"Password",maxLength:t.maxLength||0,required:!!t.required,change:t=>{const e=this.validateAndApplyVisualState();if(this.onChange)this.onChange(e.isValid,this.fieldKey)}});this.applyCommonDirectives(this.control,t,s);return this.control}getValue(){return this.control&&this.control.getMetadata().getName()==="sap.m.Input"?this.control.getValue():null}applyState(){if(!this.control||!this.metadata||this.control.getMetadata().getName()!=="sap.m.Input")return;const t=this.control;t.setEditable(!this.metadata.ui?.readOnly);t.setRequired(!!this.metadata.required)}}var n={__esModule:true};n.PasswordPlugin=s;return n});
|
|
2
|
+
//# sourceMappingURL=PasswordPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PasswordPlugin.js","names":["BasePlugin","___BasePlugin","PasswordPlugin","render","fieldMetadata","bindingPath","modelName","engineScopeId","onChange","this","metadata","fieldKey","replace","isEditable","control","TextControl","id","generateStableId","text","applyCommonDirectives","Input","value","generateBindingInfo","type","maxLength","required","change","oEvent","result","validateAndApplyVisualState","isValid","getValue","getMetadata","getName","applyState","input","setEditable","ui","readOnly","setRequired","__exports","__esModule"],"sources":["PasswordPlugin.ts"],"sourcesContent":["import { BasePlugin } from \"./BasePlugin\";\nimport { IPropertyMetadata } from \"../../interfaces/ISchema\";\nimport Input from \"sap/m/Input\";\nimport Control from \"sap/ui/core/Control\";\nimport TextControl from \"sap/m/Text\";\n\nexport class PasswordPlugin extends BasePlugin {\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(\"/\", \"\");\n \n if (!this.isEditable) {\n // Password in read-only should be masked natively\n this.control = new TextControl({\n id: this.generateStableId(engineScopeId, bindingPath),\n text: \"********\" \n });\n this.applyCommonDirectives(this.control, fieldMetadata, modelName);\n return this.control as Control;\n }\n\n this.control = new Input({\n id: this.generateStableId(engineScopeId, bindingPath),\n value: this.generateBindingInfo(bindingPath, modelName),\n type: \"Password\",\n maxLength: fieldMetadata.maxLength || 0,\n required: !!fieldMetadata.required,\n change: (oEvent: sap.ui.base.Event) => {\n const result = this.validateAndApplyVisualState();\n if (this.onChange) this.onChange(result.isValid, this.fieldKey);\n }\n });\n\n this.applyCommonDirectives(this.control, fieldMetadata, modelName);\n return this.control as Control;\n }\n\n protected getValue(): unknown {\n return this.control && this.control.getMetadata().getName() === \"sap.m.Input\" ? (this.control as Input).getValue() : null;\n }\n\n protected applyState(): void {\n if (!this.control || !this.metadata || this.control.getMetadata().getName() !== \"sap.m.Input\") return;\n const input = this.control as Input;\n input.setEditable(!this.metadata.ui?.readOnly);\n input.setRequired(!!this.metadata.required);\n }\n}\n"],"mappings":"6FAASA,EAAUC,EAAA,cAMZ,MAAMC,UAAuBF,EACzBG,OAAOC,EAAkCC,EAAqBC,EAAoB,OAAQC,EAAwBC,GACrHC,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,aAEVT,KAAKU,sBAAsBV,KAAKK,QAASV,EAAeE,GACxD,OAAOG,KAAKK,OAChB,CAEAL,KAAKK,QAAU,IAAIM,EAAM,CACrBJ,GAAIP,KAAKQ,iBAAiBV,EAAeF,GACzCgB,MAAOZ,KAAKa,oBAAoBjB,EAAaC,GAC7CiB,KAAM,WACNC,UAAWpB,EAAcoB,WAAa,EACtCC,WAAYrB,EAAcqB,SAC1BC,OAASC,IACL,MAAMC,EAASnB,KAAKoB,8BACpB,GAAIpB,KAAKD,SAAUC,KAAKD,SAASoB,EAAOE,QAASrB,KAAKE,aAI9DF,KAAKU,sBAAsBV,KAAKK,QAASV,EAAeE,GACxD,OAAOG,KAAKK,OAChB,CAEUiB,WACN,OAAOtB,KAAKK,SAAWL,KAAKK,QAAQkB,cAAcC,YAAc,cAAiBxB,KAAKK,QAAkBiB,WAAa,IACzH,CAEUG,aACN,IAAKzB,KAAKK,UAAYL,KAAKC,UAAYD,KAAKK,QAAQkB,cAAcC,YAAc,cAAe,OAC/F,MAAME,EAAQ1B,KAAKK,QACnBqB,EAAMC,aAAa3B,KAAKC,SAAS2B,IAAIC,UACrCH,EAAMI,cAAc9B,KAAKC,SAASe,SACtC,EACH,IAAAe,EAAA,CAAAC,WAAA,MAAAD,EAAAtC,iBAAA,OAAAsC,CAAA","ignoreList":[]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { BasePlugin } from "./BasePlugin";
|
|
2
|
+
import { IPropertyMetadata } from "../../interfaces/ISchema";
|
|
3
|
+
import Input from "sap/m/Input";
|
|
4
|
+
import Control from "sap/ui/core/Control";
|
|
5
|
+
import TextControl from "sap/m/Text";
|
|
6
|
+
|
|
7
|
+
export class PasswordPlugin extends BasePlugin {
|
|
8
|
+
public render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName: string = "meta", engineScopeId?: string, onChange?: (isValid: boolean, fieldKey?: string) => void): Control {
|
|
9
|
+
this.onChange = onChange;
|
|
10
|
+
this.metadata = fieldMetadata;
|
|
11
|
+
this.fieldKey = bindingPath.replace("/", "");
|
|
12
|
+
|
|
13
|
+
if (!this.isEditable) {
|
|
14
|
+
// Password in read-only should be masked natively
|
|
15
|
+
this.control = new TextControl({
|
|
16
|
+
id: this.generateStableId(engineScopeId, bindingPath),
|
|
17
|
+
text: "********"
|
|
18
|
+
});
|
|
19
|
+
this.applyCommonDirectives(this.control, fieldMetadata, modelName);
|
|
20
|
+
return this.control as Control;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
this.control = new Input({
|
|
24
|
+
id: this.generateStableId(engineScopeId, bindingPath),
|
|
25
|
+
value: this.generateBindingInfo(bindingPath, modelName),
|
|
26
|
+
type: "Password",
|
|
27
|
+
maxLength: fieldMetadata.maxLength || 0,
|
|
28
|
+
required: !!fieldMetadata.required,
|
|
29
|
+
change: (oEvent: sap.ui.base.Event) => {
|
|
30
|
+
const result = this.validateAndApplyVisualState();
|
|
31
|
+
if (this.onChange) this.onChange(result.isValid, this.fieldKey);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
this.applyCommonDirectives(this.control, fieldMetadata, modelName);
|
|
36
|
+
return this.control as Control;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
protected getValue(): unknown {
|
|
40
|
+
return this.control && this.control.getMetadata().getName() === "sap.m.Input" ? (this.control as Input).getValue() : null;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
protected applyState(): void {
|
|
44
|
+
if (!this.control || !this.metadata || this.control.getMetadata().getName() !== "sap.m.Input") return;
|
|
45
|
+
const input = this.control as Input;
|
|
46
|
+
input.setEditable(!this.metadata.ui?.readOnly);
|
|
47
|
+
input.setRequired(!!this.metadata.required);
|
|
48
|
+
}
|
|
49
|
+
}
|