From c2d6c157b4adc56e454bd81fb2f1202edd787b10 Mon Sep 17 00:00:00 2001 From: oblomov <102328295+oblomov-dev@users.noreply.github.com> Date: Tue, 19 Dec 2023 14:56:08 +0100 Subject: [PATCH] Xml parser factory plain + UI table extension (#735) * xml parser factory plain + ui table extension * abaplint fix --- src/01/03/z2ui5_cl_fw_cc_factory.clas.abap | 3 +- src/01/03/z2ui5_cl_fw_cc_scrolling.clas.abap | 2 - src/01/03/z2ui5_cl_fw_cc_uitableext.clas.abap | 61 +++++++++++++++++++ src/01/03/z2ui5_cl_fw_cc_uitableext.clas.xml | 16 +++++ src/10/01/z2ui5_cl_xml_view.clas.abap | 14 +++++ src/10/01/z2ui5_cl_xml_view_cc.clas.abap | 18 +++++- 6 files changed, 109 insertions(+), 5 deletions(-) create mode 100644 src/01/03/z2ui5_cl_fw_cc_uitableext.clas.abap create mode 100644 src/01/03/z2ui5_cl_fw_cc_uitableext.clas.xml diff --git a/src/01/03/z2ui5_cl_fw_cc_factory.clas.abap b/src/01/03/z2ui5_cl_fw_cc_factory.clas.abap index 268ec09a..834b2441 100644 --- a/src/01/03/z2ui5_cl_fw_cc_factory.clas.abap +++ b/src/01/03/z2ui5_cl_fw_cc_factory.clas.abap @@ -27,7 +27,8 @@ CLASS Z2UI5_CL_FW_CC_FACTORY IMPLEMENTATION. z2ui5_cl_fw_cc_geolocation=>get_js( ) && Z2UI5_CL_FW_CC_DEV_TOOLS=>get_js( ) && z2ui5_cl_fw_cc_file_uploader=>get_js( ) && - z2ui5_cl_fw_cc_multiinput=>get_js( ). + z2ui5_cl_fw_cc_multiinput=>get_js( ) && + z2ui5_cl_fw_cc_uitableext=>get_js( ). ENDMETHOD. ENDCLASS. diff --git a/src/01/03/z2ui5_cl_fw_cc_scrolling.clas.abap b/src/01/03/z2ui5_cl_fw_cc_scrolling.clas.abap index 2eaa4b89..a2e7667a 100644 --- a/src/01/03/z2ui5_cl_fw_cc_scrolling.clas.abap +++ b/src/01/03/z2ui5_cl_fw_cc_scrolling.clas.abap @@ -61,8 +61,6 @@ CLASS z2ui5_cl_fw_cc_scrolling IMPLEMENTATION. |\n| && ` oControl.setProperty("setUpdate", false);` && |\n| && ` var items = oControl.getProperty("items");` && |\n| && -* ` var resBinding = new sap.ui.model.ListBinding(sap.z2ui5.oView.getModel( ), "/EDIT/MT_SCROLL" );` && |\n| && -* ` resBinding.attachChange( ( ) => { alert( "Model Change" ); } ); ` && ` if(!items){return;};` && |\n| && |\n| && ` setTimeout( (oControl) => { ` && |\n| && diff --git a/src/01/03/z2ui5_cl_fw_cc_uitableext.clas.abap b/src/01/03/z2ui5_cl_fw_cc_uitableext.clas.abap new file mode 100644 index 00000000..d5f8dcf4 --- /dev/null +++ b/src/01/03/z2ui5_cl_fw_cc_uitableext.clas.abap @@ -0,0 +1,61 @@ +CLASS z2ui5_cl_fw_cc_uitableext DEFINITION + PUBLIC + FINAL + CREATE PUBLIC . + + PUBLIC SECTION. + class-METHODS get_js + RETURNING + VALUE(result) TYPE string. + + PROTECTED SECTION. + PRIVATE SECTION. +ENDCLASS. + + + +CLASS z2ui5_cl_fw_cc_uitableext IMPLEMENTATION. + + METHOD get_js. + + result = `jQuery.sap.declare("z2ui5.UITableExt"); sap.ui.require([` && |\n| && + ` "sap/ui/core/Control"` && |\n| && + `], (Control) => {` && |\n| && + ` "use strict";` && |\n| && + |\n| && + ` return Control.extend("z2ui5.UITableExt", {` && |\n| && + ` metadata: {` && |\n| && + ` properties: {` && |\n| && + ` tableId: { type: "String" }` && |\n| && + ` }` && |\n| && + ` },` && |\n| && + |\n| && + ` init() {` && |\n| && + ` sap.z2ui5.onBeforeRoundtrip.push(this.readFilter.bind(this));` && |\n| && + ` sap.z2ui5.onAfterRoundtrip.push(this.setFilter.bind(this));` && |\n| && + ` },` && |\n| && + |\n| && + ` readFilter() {` && |\n| && + ` try {` && |\n| && + ` let id = this.getProperty("tableId");` && |\n| && + ` let oTable = sap.z2ui5.oView.byId(id);` && |\n| && + ` this.aFilters = oTable.getBinding().aFilters;` && |\n| && + ` } catch (e) { };` && |\n| && + ` },` && |\n| && + |\n| && + ` setFilter() {` && |\n| && + ` try {` && |\n| && + ` setTimeout( (aFilters) => { let id = this.getProperty("tableId");` && |\n| && + ` let oTable = sap.z2ui5.oView.byId(id);` && |\n| && + ` oTable.getBinding().filter(aFilters);` && |\n| && + ` } , 100 , this.aFilters); } catch (e) { };` && |\n| && + ` },` && |\n| && + |\n| && + ` renderer(oRM, oControl) {` && |\n| && + ` }` && |\n| && + ` });` && |\n| && + `});`. + + ENDMETHOD. + +ENDCLASS. diff --git a/src/01/03/z2ui5_cl_fw_cc_uitableext.clas.xml b/src/01/03/z2ui5_cl_fw_cc_uitableext.clas.xml new file mode 100644 index 00000000..879e1e67 --- /dev/null +++ b/src/01/03/z2ui5_cl_fw_cc_uitableext.clas.xml @@ -0,0 +1,16 @@ + + + + + + Z2UI5_CL_FW_CC_UITABLEEXT + E + cc - sap.ui.table extension + 1 + X + X + X + + + + diff --git a/src/10/01/z2ui5_cl_xml_view.clas.abap b/src/10/01/z2ui5_cl_xml_view.clas.abap index 5d2bea1e..c28c734e 100644 --- a/src/10/01/z2ui5_cl_xml_view.clas.abap +++ b/src/10/01/z2ui5_cl_xml_view.clas.abap @@ -12,6 +12,11 @@ public section. preferred parameter CLIENT returning value(RESULT) type ref to Z2UI5_CL_XML_VIEW . + + class-methods FACTORY_plain + returning + value(RESULT) type ref to Z2UI5_CL_XML_VIEW . + class-methods FACTORY_POPUP importing !T_NS type Z2UI5_IF_CLIENT=>TY_T_NAME_VALUE optional @@ -4222,6 +4227,15 @@ CLASS Z2UI5_CL_XML_VIEW IMPLEMENTATION. ENDMETHOD. +METHOD factory_plain. + + result = NEW #( ). + + result->mo_root = result. + result->mo_parent = result. + + ENDMETHOD. + METHOD factory. result = NEW #( ). diff --git a/src/10/01/z2ui5_cl_xml_view_cc.clas.abap b/src/10/01/z2ui5_cl_xml_view_cc.clas.abap index 1211c2e1..4cefe6d7 100644 --- a/src/10/01/z2ui5_cl_xml_view_cc.clas.abap +++ b/src/10/01/z2ui5_cl_xml_view_cc.clas.abap @@ -5,7 +5,6 @@ CLASS z2ui5_cl_xml_view_cc DEFINITION PUBLIC SECTION. - METHODS multiinput IMPORTING !showclearicon TYPE clike OPTIONAL @@ -26,6 +25,12 @@ CLASS z2ui5_cl_xml_view_cc DEFINITION RETURNING VALUE(result) TYPE REF TO z2ui5_cl_xml_view . + METHODS uitableext + IMPORTING + !tableid TYPE clike OPTIONAL + RETURNING + VALUE(result) TYPE REF TO z2ui5_cl_xml_view . + METHODS camera_picture IMPORTING !id TYPE clike OPTIONAL @@ -343,7 +348,8 @@ CLASS z2ui5_cl_xml_view_cc IMPLEMENTATION. ENDMETHOD. METHOD multiinput. - result = mo_view->_generic( name = `MultiInput` ns = `z2ui5` + result = mo_view. + mo_view->_generic( name = `MultiInput` ns = `z2ui5` t_prop = VALUE #( ( n = `tokens` v = tokens ) ( n = `showClearIcon` v = z2ui5_cl_util_func=>boolean_abap_2_json( showclearicon ) ) ( n = `showValueHelp` v = z2ui5_cl_util_func=>boolean_abap_2_json( showvaluehelp ) ) @@ -361,4 +367,12 @@ CLASS z2ui5_cl_xml_view_cc IMPLEMENTATION. ( n = `class` v = class ) ) ). ENDMETHOD. + METHOD uitableext. + + result = mo_view->_generic( name = `UITableExt` ns = `z2ui5` + t_prop = VALUE #( ( n = `tableId` v = tableId ) + ) ). + + ENDMETHOD. + ENDCLASS.