mirror of
https://github.com/abap2UI5/abap2UI5.git
synced 2025-04-29 23:06:30 +08:00

* Refactoring due to added Component support, slightly fixed session handl (#1439) * Refactoring due to added Component support, slightly fixed session handl * Update src/01/02/z2ui5_cl_core_http_get.clas.abap Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com> --------- Co-authored-by: oblomov-dev <102328295+oblomov-dev@users.noreply.github.com> Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com> * session fix + tokens * update stateful error * pagehide for ios devices, beforeunload for desktop and others (#1440) * fixes * fixes excpetions * update * lint fixes * replaced root view with app for launchpad compati * fix missed latest changes in init - added again * update index html * update * update app * update * Update src/01/02/z2ui5_cl_core_http_get.clas.locals_imp.abap Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com> * Update src/01/02/z2ui5_cl_core_http_get.clas.locals_imp.abap Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com> * fixes * lint fixes * update * Update src/01/02/z2ui5_cl_core_app.clas.abap Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com> * Update changelog.txt * update * Update src/01/02/z2ui5_cl_core_app.clas.abap Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com> --------- Co-authored-by: Michael Zinnöcker <29286643+mzinnoecker@users.noreply.github.com> Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com>
93 lines
4.3 KiB
ABAP
93 lines
4.3 KiB
ABAP
CLASS z2ui5_cl_cc_multiinput DEFINITION
|
|
PUBLIC
|
|
FINAL
|
|
CREATE PUBLIC .
|
|
|
|
PUBLIC SECTION.
|
|
|
|
CLASS-METHODS get_js
|
|
RETURNING
|
|
VALUE(result) TYPE string.
|
|
|
|
PROTECTED SECTION.
|
|
PRIVATE SECTION.
|
|
ENDCLASS.
|
|
|
|
|
|
|
|
CLASS z2ui5_cl_cc_multiinput IMPLEMENTATION.
|
|
|
|
|
|
METHOD get_js.
|
|
|
|
result = `if (!z2ui5.MultiInputExt) { sap.ui.define( "z2ui5/MultiInputExt" , ["sap/ui/core/Control", "sap/m/Token"` && |\n| &&
|
|
`], (Control, Token) => {` && |\n| &&
|
|
` "use strict";` && |\n| &&
|
|
|\n| &&
|
|
` return Control.extend("z2ui5.MultiInputExt", {` && |\n| &&
|
|
` metadata: {` && |\n| &&
|
|
` properties: {` && |\n| &&
|
|
` MultiInputId: { type: "String" },` && |\n| &&
|
|
` MultiInputName: { type: "String" },` && |\n| &&
|
|
` addedTokens: { type: "Array" },` && |\n| &&
|
|
` checkInit: { type: "Boolean", defaultValue : false },` && |\n| &&
|
|
` removedTokens: { type: "Array" }` && |\n| &&
|
|
` },` && |\n| &&
|
|
` events: {` && |\n| &&
|
|
` "change": {` && |\n| &&
|
|
` allowPreventDefault: true,` && |\n| &&
|
|
` parameters: {}` && |\n| &&
|
|
` }` && |\n| &&
|
|
` },` && |\n| &&
|
|
` },` && |\n| &&
|
|
|\n| &&
|
|
` init() {` && |\n| &&
|
|
` sap.z2ui5.onAfterRendering.push( this.setControl.bind(this) ); ` && |\n| &&
|
|
` },` && |\n| &&
|
|
|\n| &&
|
|
` onTokenUpdate(oEvent) { ` && |\n| &&
|
|
` this.setProperty("addedTokens", []);` && |\n| &&
|
|
` this.setProperty("removedTokens", []);` && |\n| &&
|
|
|\n| &&
|
|
` if (oEvent.mParameters.type == "removed") {` && |\n| &&
|
|
` let removedTokens = [];` && |\n| &&
|
|
` oEvent.mParameters.removedTokens.forEach((item) => {` && |\n| &&
|
|
` removedTokens.push({ KEY: item.getKey(), TEXT: item.getText() });` && |\n| &&
|
|
` });` && |\n| &&
|
|
` this.setProperty("removedTokens", removedTokens);` && |\n| &&
|
|
` } else {` && |\n| &&
|
|
` let addedTokens = [];` && |\n| &&
|
|
` oEvent.mParameters.addedTokens.forEach((item) => {` && |\n| &&
|
|
` addedTokens.push({ KEY: item.getKey(), TEXT: item.getText() });` && |\n| &&
|
|
` });` && |\n| &&
|
|
` this.setProperty("addedTokens", addedTokens);` && |\n| &&
|
|
` }` && |\n| &&
|
|
` this.fireChange();` && |\n| &&
|
|
` },` && |\n| &&
|
|
` renderer(oRm, oControl) { ` &&
|
|
` sap.z2ui5.onAfterRendering.push( this.setControl.bind(oControl) ); ` && |\n| &&
|
|
` },` && |\n| &&
|
|
` setControl(){ ` && |\n| &&
|
|
` let table = sap.z2ui5.oView.byId( this.getProperty("MultiInputId") );` && |\n| &&
|
|
` if (!table) {` && |\n| &&
|
|
` try{ table = sap.ui.getCore( ).byId( ` && |\n| &&
|
|
` document.getElementsByName(this.getProperty("MultiInputName"))[0].id.replace('-inner', '')` && |\n| &&
|
|
` );` && |\n| &&
|
|
`}catch (e){ return; } } ` && |\n| &&
|
|
` if ( !table ){ return; } ` && |\n| &&
|
|
` if ( this.getProperty("checkInit") == true ){ return; } ` && |\n| &&
|
|
` this.setProperty( "checkInit" , true );` && |\n| &&
|
|
` table.attachTokenUpdate(this.onTokenUpdate.bind(this));` && |\n| &&
|
|
` var fnValidator = function (args) {` && |\n| &&
|
|
` var text = args.text;` && |\n| &&
|
|
` return new Token({ key: text, text: text });` && |\n| &&
|
|
` };` && |\n| &&
|
|
` table.addValidator(fnValidator); }, ` && |\n| &&
|
|
` renderer(oRM, oControl) {` && |\n| &&
|
|
* ` sap.z2ui5.onAfterRendering.push( oControl.setControl.bind(oControl) ); ` && |\n| &&
|
|
` }` && |\n| &&
|
|
` });` && |\n| &&
|
|
`}); }`.
|
|
ENDMETHOD.
|
|
ENDCLASS.
|