mirror of
https://github.com/abap2UI5/abap2UI5.git
synced 2025-04-29 22:09:24 +08:00
Activate compress for binding (#774)
* activate-compress-for-binding * update two way binding * update version * update * Update src/00/z2ui5_cl_util_func.clas.abap Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com> * Update src/00/z2ui5_cl_util_func.clas.abap Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com> * Update src/00/z2ui5_cl_util_func.clas.abap Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com> * update unit test * activate compress * update version * Update src/01/01/z2ui5_cl_fw_http_handler.clas.abap Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com> * update version * version * update * update package structure * update * popups * Update src/03/01/z2ui5_cl_popup_input_date.clas.abap Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com> * Update src/03/01/z2ui5_cl_popup_input_date.clas.abap Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com> * Update src/03/01/z2ui5_cl_popup_input_int.clas.abap Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com> * Update src/03/01/z2ui5_cl_popup_input_int.clas.abap Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com> * popups * Update src/99/z2ui5_cl_test_features.clas.abap Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com> * Update src/99/z2ui5_cl_test_features.clas.abap Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com> --------- Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com>
This commit is contained in:
parent
4d48b8ceee
commit
0c6fdfab5e
|
@ -74,7 +74,7 @@ CLASS z2ui5_cl_util_func DEFINITION
|
|||
IMPORTING
|
||||
!any TYPE any
|
||||
!pretty_name TYPE clike DEFAULT /ui2/cl_json=>pretty_mode-none
|
||||
!compress TYPE abap_bool DEFAULT abap_false
|
||||
!compress TYPE abap_bool DEFAULT abap_true
|
||||
RETURNING
|
||||
VALUE(result) TYPE string.
|
||||
|
||||
|
@ -122,6 +122,12 @@ CLASS z2ui5_cl_util_func DEFINITION
|
|||
EXPORTING
|
||||
!t_result TYPE STANDARD TABLE.
|
||||
|
||||
CLASS-METHODS trans_ref_struc_2_struc
|
||||
IMPORTING
|
||||
!ir_struc_from TYPE REF TO data
|
||||
EXPORTING
|
||||
!r_result TYPE data.
|
||||
|
||||
CLASS-METHODS c_trim_upper
|
||||
IMPORTING
|
||||
!val TYPE clike
|
||||
|
@ -195,7 +201,7 @@ ENDCLASS.
|
|||
|
||||
|
||||
|
||||
CLASS Z2UI5_CL_UTIL_FUNC IMPLEMENTATION.
|
||||
CLASS z2ui5_cl_util_func IMPLEMENTATION.
|
||||
|
||||
|
||||
METHOD app_get_url.
|
||||
|
@ -627,6 +633,62 @@ CLASS Z2UI5_CL_UTIL_FUNC IMPLEMENTATION.
|
|||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD trans_ref_struc_2_struc.
|
||||
|
||||
FIELD-SYMBOLS <ls_from> TYPE any.
|
||||
|
||||
ASSIGN ir_struc_from->* TO <ls_from>.
|
||||
x_check_raise( xsdbool( sy-subrc <> 0 ) ).
|
||||
CLEAR r_result.
|
||||
|
||||
DATA(lo_struc) = CAST cl_abap_structdescr( cl_abap_datadescr=>describe_by_data( r_result ) ).
|
||||
DATA(lt_components) = lo_struc->get_components( ).
|
||||
LOOP AT lt_components INTO DATA(ls_comp).
|
||||
|
||||
DATA(lv_from) = ls_comp-name.
|
||||
REPLACE ALL OCCURRENCES OF `_` IN lv_from WITH ``.
|
||||
ASSIGN COMPONENT lv_from OF STRUCTURE <ls_from> TO FIELD-SYMBOL(<comp_from>).
|
||||
IF sy-subrc <> 0.
|
||||
CONTINUE.
|
||||
ENDIF.
|
||||
ASSIGN COMPONENT ls_comp-name OF STRUCTURE r_result TO FIELD-SYMBOL(<comp_to>).
|
||||
IF sy-subrc <> 0.
|
||||
CONTINUE.
|
||||
ENDIF.
|
||||
FIELD-SYMBOLS <comp_from_deref> TYPE any.
|
||||
ASSIGN <comp_from>->* TO <comp_from_deref>.
|
||||
DATA(lv_type_kind) = rtti_get_type_kind( <comp_to> ).
|
||||
|
||||
IF <comp_from_deref> IS INITIAL.
|
||||
CONTINUE.
|
||||
ENDIF.
|
||||
|
||||
CASE lv_type_kind.
|
||||
|
||||
WHEN cl_abap_typedescr=>typekind_table.
|
||||
trans_ref_tab_2_tab(
|
||||
EXPORTING
|
||||
ir_tab_from = <comp_from>
|
||||
IMPORTING
|
||||
t_result = <comp_to> ).
|
||||
|
||||
WHEN cl_abap_typedescr=>typekind_struct1 OR cl_abap_typedescr=>typekind_struct2.
|
||||
trans_ref_struc_2_struc(
|
||||
EXPORTING
|
||||
ir_struc_from = <comp_from>
|
||||
IMPORTING
|
||||
r_result = <comp_to> ).
|
||||
|
||||
WHEN OTHERS.
|
||||
<comp_to> = <comp_from_deref>.
|
||||
ENDCASE.
|
||||
|
||||
ENDLOOP.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
|
||||
METHOD trans_xml_2_any.
|
||||
|
||||
CALL TRANSFORMATION id
|
||||
|
|
|
@ -440,7 +440,7 @@ CLASS ltcl_unit_test IMPLEMENTATION.
|
|||
|
||||
DATA(lv_tab_json) = z2ui5_cl_util_func=>trans_json_any_2( lt_tab ).
|
||||
|
||||
DATA(lv_result) = `[{"TITLE":"Test","VALUE":"this is a description","SELECTED":true},{"TITLE":"Test2","VALUE":"this is a new descr","SELECTED":false}]`.
|
||||
DATA(lv_result) = `[{"TITLE":"Test","VALUE":"this is a description","SELECTED":true},{"TITLE":"Test2","VALUE":"this is a new descr"}]`.
|
||||
|
||||
IF lv_result <> lv_tab_json.
|
||||
cl_abap_unit_assert=>fail( ).
|
||||
|
|
|
@ -28,21 +28,21 @@ CLASS z2ui5_cl_fw_binding DEFINITION
|
|||
check_temp TYPE abap_bool,
|
||||
viewname TYPE string,
|
||||
pretty_name TYPE string,
|
||||
compress TYPE string,
|
||||
compress TYPE abap_bool,
|
||||
depth TYPE i,
|
||||
END OF ty_s_attri.
|
||||
TYPES ty_t_attri TYPE SORTED TABLE OF ty_s_attri WITH UNIQUE KEY name.
|
||||
|
||||
CLASS-METHODS factory
|
||||
IMPORTING
|
||||
app TYPE REF TO object OPTIONAL
|
||||
attri TYPE ty_t_attri OPTIONAL
|
||||
type TYPE string OPTIONAL
|
||||
data TYPE data OPTIONAL
|
||||
check_attri TYPE data OPTIONAL
|
||||
view TYPE string OPTIONAL
|
||||
pretty_name TYPE clike OPTIONAL
|
||||
compress TYPE clike OPTIONAL
|
||||
app TYPE REF TO object OPTIONAL
|
||||
attri TYPE ty_t_attri OPTIONAL
|
||||
type TYPE clike OPTIONAL
|
||||
data TYPE data OPTIONAL
|
||||
check_attri TYPE data OPTIONAL
|
||||
view TYPE clike OPTIONAL
|
||||
pretty_name TYPE clike OPTIONAL
|
||||
compress TYPE abap_bool OPTIONAL
|
||||
RETURNING
|
||||
VALUE(r_result) TYPE REF TO z2ui5_cl_fw_binding.
|
||||
|
||||
|
@ -57,7 +57,7 @@ CLASS z2ui5_cl_fw_binding DEFINITION
|
|||
DATA mv_check_attri TYPE abap_bool.
|
||||
DATA mv_view TYPE string.
|
||||
DATA mv_pretty_name TYPE string.
|
||||
DATA mv_compress TYPE string.
|
||||
DATA mv_compress TYPE abap_bool.
|
||||
|
||||
CLASS-METHODS update_attri
|
||||
IMPORTING
|
||||
|
@ -134,7 +134,7 @@ ENDCLASS.
|
|||
|
||||
|
||||
|
||||
CLASS Z2UI5_CL_FW_BINDING IMPLEMENTATION.
|
||||
CLASS z2ui5_cl_fw_binding IMPLEMENTATION.
|
||||
|
||||
|
||||
METHOD bind.
|
||||
|
@ -181,7 +181,7 @@ CLASS Z2UI5_CL_FW_BINDING IMPLEMENTATION.
|
|||
DATA(lv_id) = z2ui5_cl_util_func=>func_get_uuid_22( ).
|
||||
|
||||
INSERT VALUE #( name = lv_id
|
||||
data_stringify = z2ui5_cl_util_func=>trans_json_any_2( mr_data )
|
||||
data_stringify = z2ui5_cl_util_func=>trans_json_any_2( any = mr_data compress = me->mv_compress )
|
||||
bind_type = cs_bind_type-one_time )
|
||||
INTO TABLE mt_attri.
|
||||
result = |/{ lv_id }|.
|
||||
|
|
|
@ -389,12 +389,12 @@ CLASS z2ui5_cl_fw_controller IMPLEMENTATION.
|
|||
ENDIF.
|
||||
|
||||
IF ix IS BOUND.
|
||||
result->ms_next-o_app_call = z2ui5_cl_fw_ui_error=>factory( ix ).
|
||||
result->ms_next-o_app_call = z2ui5_cl_fw_app_error=>factory( ix ).
|
||||
result = result->app_call_factory( abap_true ).
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
result->ms_db-app = z2ui5_cl_fw_ui_startup=>factory( ).
|
||||
result->ms_db-app = z2ui5_cl_fw_app_startup=>factory( ).
|
||||
result->ms_db-app->id = result->ms_db-id.
|
||||
|
||||
ENDMETHOD.
|
||||
|
|
|
@ -20,27 +20,27 @@ CLASS ltcl_unit_test IMPLEMENTATION.
|
|||
|
||||
cl_abap_unit_assert=>assert_bound( lo_handler->ms_db-app ).
|
||||
|
||||
DATA(lo_app_fw) = CAST z2ui5_cl_fw_ui_startup( lo_handler->ms_db-app ) ##NEEDED.
|
||||
DATA(lo_app_fw) = CAST z2ui5_cl_fw_app_startup( lo_handler->ms_db-app ) ##NEEDED.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD test_req_begin_app_start.
|
||||
|
||||
DATA(lv_body) = `{"OLOCATION":{"ORIGIN":"https://url.abap-web.us10.hana.ondemand.com","PATHNAME":"/sap/bc/http/sap/z_http_service_for_ui","SEARCH":"?sap-client=100&app_start=z2ui5_cl_fw_ui_hello_world","VERSION":"c` &&
|
||||
DATA(lv_body) = `{"OLOCATION":{"ORIGIN":"https://url.abap-web.us10.hana.ondemand.com","PATHNAME":"/sap/bc/http/sap/z_http_service_for_ui","SEARCH":"?sap-client=100&app_start=z2ui5_cl_app_hello_world","VERSION":"c` &&
|
||||
`om.sap.ui5.dist:sapui5-sdk-dist:1.115.0:war"}}`.
|
||||
|
||||
DATA(lo_handler) = z2ui5_cl_fw_controller=>request_begin( lv_body ).
|
||||
|
||||
cl_abap_unit_assert=>assert_bound( lo_handler->ms_db-app ).
|
||||
|
||||
DATA(lo_app_fw) = CAST z2ui5_cl_fw_ui_hello_world( lo_handler->ms_db-app ) ##NEEDED.
|
||||
DATA(lo_app_fw) = CAST z2ui5_cl_app_hello_world( lo_handler->ms_db-app ) ##NEEDED.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD test_req_end.
|
||||
|
||||
DATA(lv_body) = `{"OLOCATION":{"ORIGIN":"https://url.abap-web.us10.hana.ondemand.com","PATHNAME":"/sap/bc/http/sap/z_http_service_for_ui","SEARCH":"?sap-client=100&app_start=z2ui5_cl_fw_ui_hello_world","VERSION":"c` &&
|
||||
DATA(lv_body) = `{"OLOCATION":{"ORIGIN":"https://url.abap-web.us10.hana.ondemand.com","PATHNAME":"/sap/bc/http/sap/z_http_service_for_ui","SEARCH":"?sap-client=100&app_start=z2ui5_cl_app_hello_world","VERSION":"c` &&
|
||||
`om.sap.ui5.dist:sapui5-sdk-dist:1.115.0:war"}}`.
|
||||
|
||||
DATA(lo_handler) = z2ui5_cl_fw_controller=>request_begin( lv_body ).
|
||||
|
|
|
@ -4,7 +4,7 @@ CLASS z2ui5_cl_fw_http_handler DEFINITION
|
|||
|
||||
PUBLIC SECTION.
|
||||
|
||||
CONSTANTS c_abap_version TYPE string VALUE '1.114.0' ##NO_TEXT.
|
||||
CONSTANTS c_abap_version TYPE string VALUE `1.115.0`.
|
||||
|
||||
CLASS-METHODS http_post
|
||||
IMPORTING
|
||||
|
@ -16,13 +16,11 @@ CLASS z2ui5_cl_fw_http_handler DEFINITION
|
|||
IMPORTING
|
||||
t_config TYPE z2ui5_if_client=>ty_t_name_value OPTIONAL
|
||||
content_security_policy TYPE clike OPTIONAL
|
||||
check_debugging TYPE abap_bool OPTIONAL
|
||||
custom_js TYPE string OPTIONAL
|
||||
json_model_limit TYPE string DEFAULT '100'
|
||||
PREFERRED PARAMETER t_config
|
||||
RETURNING
|
||||
VALUE(r_result) TYPE string
|
||||
##NEEDED.
|
||||
VALUE(r_result) TYPE string.
|
||||
|
||||
PROTECTED SECTION.
|
||||
CLASS-METHODS get_js
|
||||
|
@ -39,397 +37,397 @@ CLASS Z2UI5_CL_FW_HTTP_HANDLER IMPLEMENTATION.
|
|||
METHOD get_js.
|
||||
|
||||
result = `sap.ui.define("z2ui5/Controller", ["sap/ui/core/mvc/Controller", "sap/ui/core/mvc/XMLView", "sap/ui/model/json/JSONModel", "sap/ui/core/BusyIndicator", "sap/m/MessageBox", "sap/m/MessageToast", "sap/ui/core/Fragment"], function(Control` &&
|
||||
`ler, XMLView, JSONModel, BusyIndicator, MessageBox, MessageToast, Fragment) {` && |\n| &&
|
||||
` "use strict";` && |\n| &&
|
||||
` return Controller.extend("z2ui5.Controller", {` && |\n| &&
|
||||
` async onAfterRendering() {` && |\n| &&
|
||||
` try{` && |\n| &&
|
||||
` if (!sap.z2ui5.oResponse.PARAMS) {` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` const {S_POPUP, S_VIEW_NEST, S_VIEW_NEST2, S_POPOVER} = sap.z2ui5.oResponse.PARAMS;` && |\n| &&
|
||||
` if (S_POPUP.CHECK_DESTROY) {` && |\n| &&
|
||||
` sap.z2ui5.oController.PopupDestroy();` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (S_POPOVER.CHECK_DESTROY) {` && |\n| &&
|
||||
` sap.z2ui5.oController.PopoverDestroy();` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (S_POPUP.XML) {` && |\n| &&
|
||||
` sap.z2ui5.oController.PopupDestroy();` && |\n| &&
|
||||
` await this.displayFragment(S_POPUP.XML, 'oViewPopup');` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (!sap.z2ui5.checkNestAfter) {` && |\n| &&
|
||||
` if (S_VIEW_NEST.XML) {` && |\n| &&
|
||||
` sap.z2ui5.oController.NestViewDestroy();` && |\n| &&
|
||||
` await this.displayNestedView(S_VIEW_NEST.XML, 'oViewNest', 'S_VIEW_NEST');` && |\n| &&
|
||||
` sap.z2ui5.checkNestAfter = true;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (!sap.z2ui5.checkNestAfter2) {` && |\n| &&
|
||||
` if (S_VIEW_NEST2.XML) {` && |\n| &&
|
||||
` sap.z2ui5.oController.NestViewDestroy2();` && |\n| &&
|
||||
` await this.displayNestedView(S_VIEW_NEST2.XML, 'oViewNest2', 'S_VIEW_NEST2');` && |\n| &&
|
||||
` sap.z2ui5.checkNestAfter2 = true;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (S_POPOVER.XML) {` && |\n| &&
|
||||
` await this.displayFragment(S_POPOVER.XML, 'oViewPopover', S_POPOVER.OPEN_BY_ID);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` BusyIndicator.hide();` && |\n| &&
|
||||
` if (sap.z2ui5.isBusy) {` && |\n| &&
|
||||
` sap.z2ui5.isBusy = false;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (sap.z2ui5.busyDialog) {` && |\n| &&
|
||||
` sap.z2ui5.busyDialog.close();` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` sap.z2ui5.onAfterRendering.forEach(item=>{` && |\n| &&
|
||||
` if (item !== undefined) {` && |\n| &&
|
||||
` item();` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` )` && |\n| &&
|
||||
` }catch(e){ MessageBox.error(e.toLocaleString()); }` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
|\n| &&
|
||||
` async displayFragment(xml, viewProp, openById) {` && |\n| &&
|
||||
` const oFragment = await Fragment.load({` && |\n| &&
|
||||
` definition: xml,` && |\n| &&
|
||||
` controller: sap.z2ui5.oController,` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` let oview_model = new JSONModel(sap.z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
|
||||
` oview_model.setSizeLimit(sap.z2ui5.JSON_MODEL_LIMIT);` && |\n| &&
|
||||
` oFragment.setModel(oview_model);` && |\n| &&
|
||||
` let oControl = openById ? this.getControlById(openById) : null;` && |\n| &&
|
||||
` if (oControl) {` && |\n| &&
|
||||
` oFragment.openBy(oControl);` && |\n| &&
|
||||
` } else {` && |\n| &&
|
||||
` oFragment.open();` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` sap.z2ui5[viewProp] = oFragment;` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
|\n| &&
|
||||
` async displayNestedView(xml, viewProp, viewNestId) {` && |\n| &&
|
||||
` const oView = await XMLView.create({` && |\n| &&
|
||||
` definition: xml,` && |\n| &&
|
||||
` controller: sap.z2ui5.oControllerNest,` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
|\n| &&
|
||||
` let oview_model = new JSONModel(sap.z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
|
||||
` oview_model.setSizeLimit(sap.z2ui5.JSON_MODEL_LIMIT);` && |\n| &&
|
||||
` oView.setModel(oview_model);` && |\n| &&
|
||||
|\n| &&
|
||||
` let oParent = sap.z2ui5.oView.byId(sap.z2ui5.oResponse.PARAMS[viewNestId].ID);` && |\n| &&
|
||||
` if (oParent) {` && |\n| &&
|
||||
` try {` && |\n| &&
|
||||
` oParent[sap.z2ui5.oResponse.PARAMS[viewNestId].METHOD_DESTROY]();` && |\n| &&
|
||||
` } catch {}` && |\n| &&
|
||||
` oParent[sap.z2ui5.oResponse.PARAMS[viewNestId].METHOD_INSERT](oView);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` sap.z2ui5[viewProp] = oView;` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
|\n| &&
|
||||
` getControlById(id) {` && |\n| &&
|
||||
` let oControl = sap.z2ui5.oView.byId(id);` && |\n| &&
|
||||
` if (!oControl) {` && |\n| &&
|
||||
` oControl = sap.ui.getCore().byId(id);` && |\n| &&
|
||||
` debugger ;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (!oControl) {` && |\n| &&
|
||||
` oControl = sap.z2ui5.oViewNest.byId(id) || sap.z2ui5.oViewNest2.byId(id);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` return oControl;` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
|\n| &&
|
||||
` PopupDestroy() {` && |\n| &&
|
||||
` if (!sap.z2ui5.oViewPopup) {` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (sap.z2ui5.oViewPopup.close) {` && |\n| &&
|
||||
` try {` && |\n| &&
|
||||
` sap.z2ui5.oViewPopup.close();` && |\n| &&
|
||||
` } catch {}` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` sap.z2ui5.oViewPopup.destroy();` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` PopoverDestroy() {` && |\n| &&
|
||||
` if (!sap.z2ui5.oViewPopover) {` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (sap.z2ui5.oViewPopover.close) {` && |\n| &&
|
||||
` try {` && |\n| &&
|
||||
` sap.z2ui5.oViewPopover.close();` && |\n| &&
|
||||
` } catch {}` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` sap.z2ui5.oViewPopover.destroy();` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` NestViewDestroy() {` && |\n| &&
|
||||
` if (!sap.z2ui5.oViewNest) {` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` sap.z2ui5.oViewNest.destroy();` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` NestViewDestroy2() {` && |\n| &&
|
||||
` if (!sap.z2ui5.oViewNest2) {` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` sap.z2ui5.oViewNest2.destroy();` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` ViewDestroy() {` && |\n| &&
|
||||
` if (!sap.z2ui5.oView) {` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` sap.z2ui5.oView.destroy();` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` onEventFrontend(...args) {` && |\n| &&
|
||||
|\n| &&
|
||||
` sap.z2ui5.onBeforeEventFrontend.forEach(item => {` && |\n| &&
|
||||
` if (item !== undefined) {` && |\n| &&
|
||||
` item(args);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` )` && |\n| &&
|
||||
|\n| &&
|
||||
` let oCrossAppNavigator;` && |\n| &&
|
||||
` switch (args[0].EVENT) {` && |\n| &&
|
||||
` case 'CROSS_APP_NAV_TO_PREV_APP':` && |\n| &&
|
||||
` oCrossAppNavigator = sap.ushell.Container.getService("CrossApplicationNavigation");` && |\n| &&
|
||||
` oCrossAppNavigator.backToPreviousApp();` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'CROSS_APP_NAV_TO_EXT':` && |\n| &&
|
||||
` oCrossAppNavigator = sap.ushell.Container.getService("CrossApplicationNavigation");` && |\n| &&
|
||||
` const hash = (oCrossAppNavigator.hrefForExternal({` && |\n| &&
|
||||
` target: args[1],` && |\n| &&
|
||||
` params: args[2]` && |\n| &&
|
||||
` })) || "";` && |\n| &&
|
||||
` if (args[3] === 'EXT') {` && |\n| &&
|
||||
` let url = window.location.href.split('#')[0] + hash;` && |\n| &&
|
||||
` sap.m.URLHelper.redirect(url, true);` && |\n| &&
|
||||
` } else {` && |\n| &&
|
||||
` oCrossAppNavigator.toExternal({` && |\n| &&
|
||||
` target: {` && |\n| &&
|
||||
` shellHash: hash` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'LOCATION_RELOAD':` && |\n| &&
|
||||
` window.location = args[1];` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'OPEN_NEW_TAB':` && |\n| &&
|
||||
` window.open(args[1], '_blank');` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'POPUP_CLOSE':` && |\n| &&
|
||||
` sap.z2ui5.oController.PopupDestroy();` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'POPOVER_CLOSE':` && |\n| &&
|
||||
` sap.z2ui5.oController.PopoverDestroy();` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'NAV_CONTAINER_TO':` && |\n| &&
|
||||
` var navCon = sap.z2ui5.oView.byId(args[1]);` && |\n| &&
|
||||
` var navConTo = sap.z2ui5.oView.byId(args[2]);` && |\n| &&
|
||||
` navCon.to(navConTo);` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'NEST_NAV_CONTAINER_TO':` && |\n| &&
|
||||
` navCon = sap.z2ui5.oViewNest.byId(args[1]);` && |\n| &&
|
||||
` navConTo = sap.z2ui5.oViewNest.byId(args[2]);` && |\n| &&
|
||||
` navCon.to(navConTo);` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'NEST2_NAV_CONTAINER_TO':` && |\n| &&
|
||||
` navCon = sap.z2ui5.oViewNest2.byId(args[1]);` && |\n| &&
|
||||
` navConTo = sap.z2ui5.oViewNest2.byId(args[2]);` && |\n| &&
|
||||
` navCon.to(navConTo);` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` onEvent(...args) {` && |\n| &&
|
||||
` if (sap.z2ui5.isBusy) {` && |\n| &&
|
||||
` if (sap.z2ui5.isBusy == true) {` && |\n| &&
|
||||
` sap.z2ui5.busyDialog = new sap.m.BusyDialog();` && |\n| &&
|
||||
` sap.z2ui5.busyDialog.open();` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` sap.z2ui5.isBusy = true;` && |\n| &&
|
||||
` if (!window.navigator.onLine) {` && |\n| &&
|
||||
` sap.m.MessageBox.alert('No internet connection! Please reconnect to the server and try again.');` && |\n| &&
|
||||
` sap.z2ui5.isBusy = false;` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` BusyIndicator.show();` && |\n| &&
|
||||
` sap.z2ui5.oBody = {};` && |\n| &&
|
||||
` let isUpdated = false;` && |\n| &&
|
||||
` if (sap.z2ui5.oViewPopup) {` && |\n| &&
|
||||
` if (!sap.z2ui5.oViewPopup.isOpen || sap.z2ui5.oViewPopup.isOpen() == true) {` && |\n| &&
|
||||
` sap.z2ui5.oBody.EDIT = sap.z2ui5.oViewPopup.getModel().getData().EDIT;` && |\n| &&
|
||||
` isUpdated = true;` && |\n| &&
|
||||
` sap.z2ui5.oBody.VIEWNAME = 'MAIN';` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (isUpdated == false) {` && |\n| &&
|
||||
` if (sap.z2ui5.oViewPopover) {` && |\n| &&
|
||||
` if (sap.z2ui5.oViewPopover.isOpen) {` && |\n| &&
|
||||
` if (sap.z2ui5.oViewPopover.isOpen() == true) {` && |\n| &&
|
||||
` sap.z2ui5.oBody.EDIT = sap.z2ui5.oViewPopover.getModel().getData().EDIT;` && |\n| &&
|
||||
` isUpdated = true;` && |\n| &&
|
||||
` sap.z2ui5.oBody.VIEWNAME = 'MAIN';` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` sap.z2ui5.oViewPopover.destroy();` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (isUpdated == false) {` && |\n| &&
|
||||
` if (sap.z2ui5.oViewNest == this.getView()) {` && |\n| &&
|
||||
` sap.z2ui5.oBody.EDIT = sap.z2ui5.oViewNest.getModel().getData().EDIT;` && |\n| &&
|
||||
` sap.z2ui5.oBody.VIEWNAME = 'NEST';` && |\n| &&
|
||||
` isUpdated = true;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (isUpdated == false) {` && |\n| &&
|
||||
` sap.z2ui5.oBody.EDIT = sap.z2ui5.oView.getModel().getData().EDIT;` && |\n| &&
|
||||
` sap.z2ui5.oBody.VIEWNAME = 'MAIN';` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
|\n| &&
|
||||
` sap.z2ui5.onBeforeRoundtrip.forEach(item=>{` && |\n| &&
|
||||
` if (item !== undefined) {` && |\n| &&
|
||||
` item();` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` )` && |\n| &&
|
||||
` if (args[0].CHECK_VIEW_DESTROY) {` && |\n| &&
|
||||
` sap.z2ui5.oController.ViewDestroy();` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` sap.z2ui5.oBody.ID = sap.z2ui5.oResponse.ID;` && |\n| &&
|
||||
` sap.z2ui5.oBody.ARGUMENTS = args;` && |\n| &&
|
||||
|\n| &&
|
||||
` if (sap.z2ui5.checkLogActive) {` && |\n| &&
|
||||
` console.log('Request Object:');` && |\n| &&
|
||||
` console.log(sap.z2ui5.oBody);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` sap.z2ui5.oResponseOld = sap.z2ui5.oResponse;` && |\n| &&
|
||||
` sap.z2ui5.oResponse = {};` && |\n| &&
|
||||
` sap.z2ui5.oController.Roundtrip();` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` responseError(response) {` && |\n| &&
|
||||
` document.write(response);` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` updateModelIfRequired(paramKey, oView) {` && |\n| &&
|
||||
` if (sap.z2ui5.oResponse.PARAMS[paramKey].CHECK_UPDATE_MODEL) {` && |\n| &&
|
||||
` let model = new JSONModel(sap.z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
|
||||
` model.setSizeLimit(sap.z2ui5.JSON_MODEL_LIMIT);` && |\n| &&
|
||||
` oView.setModel(model);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` async responseSuccess(response) {` && |\n| &&
|
||||
` try{` && |\n| &&
|
||||
` sap.z2ui5.oResponse = response;` && |\n| &&
|
||||
|\n| &&
|
||||
` if (sap.z2ui5.oResponse.PARAMS.S_VIEW.CHECK_DESTROY) {` && |\n| &&
|
||||
` sap.z2ui5.oController.ViewDestroy();` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
|\n| &&
|
||||
` if (sap.z2ui5.oResponse.PARAMS.S_VIEW.XML !== '') {` && |\n| &&
|
||||
` sap.z2ui5.oController.ViewDestroy();` && |\n| &&
|
||||
` await sap.z2ui5.oController.createView(sap.z2ui5.oResponse.PARAMS.S_VIEW.XML, sap.z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
|
||||
` } else {` && |\n| &&
|
||||
` this.updateModelIfRequired('S_VIEW', sap.z2ui5.oView);` && |\n| &&
|
||||
` this.updateModelIfRequired('S_VIEW_NEST', sap.z2ui5.oViewNest);` && |\n| &&
|
||||
` this.updateModelIfRequired('S_VIEW_NEST2', sap.z2ui5.oViewNest2);` && |\n| &&
|
||||
` this.updateModelIfRequired('S_POPUP', sap.z2ui5.oViewPopup);` && |\n| &&
|
||||
` this.updateModelIfRequired('S_POPOVER', sap.z2ui5.oViewPopover);` && |\n| &&
|
||||
` sap.z2ui5.oController.onAfterRendering();` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` sap.z2ui5.oController.showMessage('S_MSG_TOAST', sap.z2ui5.oResponse.PARAMS);` && |\n| &&
|
||||
` sap.z2ui5.oController.showMessage('S_MSG_BOX', sap.z2ui5.oResponse.PARAMS);` && |\n| &&
|
||||
` }catch(e){ MessageBox.error(e.toLocaleString()); }` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` showMessage(msgType, params) {` && |\n| &&
|
||||
` if (params[msgType].TEXT !== '') {` && |\n| &&
|
||||
` if (msgType === 'S_MSG_TOAST') {` && |\n| &&
|
||||
` MessageToast.show(params[msgType].TEXT);` && |\n| &&
|
||||
` } else if (msgType === 'S_MSG_BOX') {` && |\n| &&
|
||||
` MessageBox[params[msgType].TYPE](params[msgType].TEXT);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` async createView(xml, viewModel) {` && |\n| &&
|
||||
` const oView = await XMLView.create({` && |\n| &&
|
||||
` definition: xml,` && |\n| &&
|
||||
` controller: sap.z2ui5.oController,` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` let oview_model = new JSONModel(viewModel);` && |\n| &&
|
||||
` oview_model.setSizeLimit(sap.z2ui5.JSON_MODEL_LIMIT);` && |\n| &&
|
||||
` oView.setModel(oview_model);` && |\n| &&
|
||||
|\n| &&
|
||||
` if (sap.z2ui5.oParent) {` && |\n| &&
|
||||
` sap.z2ui5.oParent.removeAllPages();` && |\n| &&
|
||||
` sap.z2ui5.oParent.insertPage(oView);` && |\n| &&
|
||||
` } else {` && |\n| &&
|
||||
` oView.placeAt("content");` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` sap.z2ui5.oView = oView;` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` async readHttp() {` && |\n| &&
|
||||
` const response = await fetch(sap.z2ui5.pathname, {` && |\n| &&
|
||||
` method: 'POST',` && |\n| &&
|
||||
` headers: {` && |\n| &&
|
||||
` 'Content-Type': 'application/json'` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` body: JSON.stringify(sap.z2ui5.oBody)` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
|\n| &&
|
||||
` if (!response.ok) {` && |\n| &&
|
||||
` const responseText = await response.text();` && |\n| &&
|
||||
` sap.z2ui5.oController.responseError(responseText);` && |\n| &&
|
||||
` } else {` && |\n| &&
|
||||
` const responseData = await response.json();` && |\n| &&
|
||||
` sap.z2ui5.oController.responseSuccess(responseData);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
|\n| &&
|
||||
` },` && |\n| &&
|
||||
|\n| &&
|
||||
` Roundtrip() {` && |\n| &&
|
||||
|\n| &&
|
||||
` sap.z2ui5.checkTimerActive = false;` && |\n| &&
|
||||
` sap.z2ui5.checkNestAfter = false;` && |\n| &&
|
||||
` sap.z2ui5.checkNestAfter2 = false;` && |\n| &&
|
||||
|\n| &&
|
||||
` sap.z2ui5.oBody.OLOCATION = {` && |\n| &&
|
||||
` ORIGIN: window.location.origin,` && |\n| &&
|
||||
` PATHNAME: sap.z2ui5.pathname,` && |\n| &&
|
||||
` SEARCH: window.location.search,` && |\n| &&
|
||||
` // VERSION: sap.ui.getVersionInfo().gav,` && |\n| &&
|
||||
` CHECK_LAUNCHPAD_ACTIVE: sap.ushell !== undefined,` && |\n| &&
|
||||
` STARTUP_PARAMETERS: sap.z2ui5.startupParameters,` && |\n| &&
|
||||
` };` && |\n| &&
|
||||
` if (sap.z2ui5.search) {` && |\n| &&
|
||||
` sap.z2ui5.oBody.OLOCATION.SEARCH = sap.z2ui5.search;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` sap.z2ui5.oController.readHttp();` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` })` && |\n| &&
|
||||
`});` && |\n| &&
|
||||
|\n| &&
|
||||
`sap.ui.require(["z2ui5/Controller", "sap/ui/core/BusyIndicator", "sap/ui/core/mvc/XMLView", "sap/ui/core/Fragment", "sap/m/MessageToast", "sap/m/MessageBox", "sap/ui/model/json/JSONModel"], (Controller,BusyIndicator)=>{` && |\n| &&
|
||||
|\n| &&
|
||||
` BusyIndicator.show();` && |\n| &&
|
||||
` sap.z2ui5.oController = new Controller();` && |\n| &&
|
||||
` sap.z2ui5.oControllerNest = new Controller();` && |\n| &&
|
||||
` sap.z2ui5.oControllerNest2 = new Controller();` && |\n| &&
|
||||
|\n| &&
|
||||
` sap.z2ui5.pathname = sap.z2ui5.pathname || window.location.pathname;` && |\n| &&
|
||||
` sap.z2ui5.checkNestAfter = false;` && |\n| &&
|
||||
|\n| &&
|
||||
` sap.z2ui5.oBody = {` && |\n| &&
|
||||
` APP_START: sap.z2ui5.APP_START` && |\n| &&
|
||||
` };` && |\n| &&
|
||||
` sap.z2ui5.oController.Roundtrip();` && |\n| &&
|
||||
|\n| &&
|
||||
` sap.z2ui5.onBeforeRoundtrip = [];` && |\n| &&
|
||||
` sap.z2ui5.onAfterRendering = [];` && |\n| &&
|
||||
` sap.z2ui5.onBeforeEventFrontend = [];` && |\n| &&
|
||||
` sap.z2ui5.onAfterRoundtrip = []; }` && |\n| &&
|
||||
`);`.
|
||||
|
||||
`ler, XMLView, JSONModel, BusyIndicator, MessageBox, MessageToast, Fragment) {` && |\n| &&
|
||||
` "use strict";` && |\n| &&
|
||||
` return Controller.extend("z2ui5.Controller", {` && |\n| &&
|
||||
` async onAfterRendering() {` && |\n| &&
|
||||
` try{` && |\n| &&
|
||||
` if (!sap.z2ui5.oResponse.PARAMS) {` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` const {S_POPUP, S_VIEW_NEST, S_VIEW_NEST2, S_POPOVER} = sap.z2ui5.oResponse.PARAMS;` && |\n| &&
|
||||
` if (S_POPUP?.CHECK_DESTROY) {` && |\n| &&
|
||||
` sap.z2ui5.oController.PopupDestroy();` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (S_POPOVER?.CHECK_DESTROY) {` && |\n| &&
|
||||
` sap.z2ui5.oController.PopoverDestroy();` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (S_POPUP?.XML) {` && |\n| &&
|
||||
` sap.z2ui5.oController.PopupDestroy();` && |\n| &&
|
||||
` await this.displayFragment(S_POPUP.XML, 'oViewPopup');` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (!sap.z2ui5.checkNestAfter) {` && |\n| &&
|
||||
` if (S_VIEW_NEST?.XML) {` && |\n| &&
|
||||
` sap.z2ui5.oController.NestViewDestroy();` && |\n| &&
|
||||
` await this.displayNestedView(S_VIEW_NEST.XML, 'oViewNest', 'S_VIEW_NEST');` && |\n| &&
|
||||
` sap.z2ui5.checkNestAfter = true;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (!sap.z2ui5.checkNestAfter2) {` && |\n| &&
|
||||
` if (S_VIEW_NEST2?.XML) {` && |\n| &&
|
||||
` sap.z2ui5.oController.NestViewDestroy2();` && |\n| &&
|
||||
` await this.displayNestedView(S_VIEW_NEST2.XML, 'oViewNest2', 'S_VIEW_NEST2');` && |\n| &&
|
||||
` sap.z2ui5.checkNestAfter2 = true;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (S_POPOVER?.XML) {` && |\n| &&
|
||||
` await this.displayFragment(S_POPOVER.XML, 'oViewPopover', S_POPOVER.OPEN_BY_ID);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` BusyIndicator.hide();` && |\n| &&
|
||||
` if (sap.z2ui5.isBusy) {` && |\n| &&
|
||||
` sap.z2ui5.isBusy = false;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (sap.z2ui5.busyDialog) {` && |\n| &&
|
||||
` sap.z2ui5.busyDialog.close();` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` sap.z2ui5.onAfterRendering.forEach(item=>{` && |\n| &&
|
||||
` if (item !== undefined) {` && |\n| &&
|
||||
` item();` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` )` && |\n| &&
|
||||
` }catch(e){ BusyIndicator.hide(); MessageBox.error(e.toLocaleString()); }` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
|\n| &&
|
||||
` async displayFragment(xml, viewProp, openById) {` && |\n| &&
|
||||
` const oFragment = await Fragment.load({` && |\n| &&
|
||||
` definition: xml,` && |\n| &&
|
||||
` controller: sap.z2ui5.oController,` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` let oview_model = new JSONModel(sap.z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
|
||||
` oview_model.setSizeLimit(sap.z2ui5.JSON_MODEL_LIMIT);` && |\n| &&
|
||||
` oFragment.setModel(oview_model);` && |\n| &&
|
||||
` let oControl = openById ? this.getControlById(openById) : null;` && |\n| &&
|
||||
` if (oControl) {` && |\n| &&
|
||||
` oFragment.openBy(oControl);` && |\n| &&
|
||||
` } else {` && |\n| &&
|
||||
` oFragment.open();` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` sap.z2ui5[viewProp] = oFragment;` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
|\n| &&
|
||||
` async displayNestedView(xml, viewProp, viewNestId) {` && |\n| &&
|
||||
` const oView = await XMLView.create({` && |\n| &&
|
||||
` definition: xml,` && |\n| &&
|
||||
` controller: sap.z2ui5.oControllerNest,` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
|\n| &&
|
||||
` let oview_model = new JSONModel(sap.z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
|
||||
` oview_model.setSizeLimit(sap.z2ui5.JSON_MODEL_LIMIT);` && |\n| &&
|
||||
` oView.setModel(oview_model);` && |\n| &&
|
||||
|\n| &&
|
||||
` let oParent = sap.z2ui5.oView.byId(sap.z2ui5.oResponse.PARAMS[viewNestId].ID);` && |\n| &&
|
||||
` if (oParent) {` && |\n| &&
|
||||
` try {` && |\n| &&
|
||||
` oParent[sap.z2ui5.oResponse.PARAMS[viewNestId].METHOD_DESTROY]();` && |\n| &&
|
||||
` } catch {}` && |\n| &&
|
||||
` oParent[sap.z2ui5.oResponse.PARAMS[viewNestId].METHOD_INSERT](oView);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` sap.z2ui5[viewProp] = oView;` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
|\n| &&
|
||||
` getControlById(id) {` && |\n| &&
|
||||
` let oControl = sap.z2ui5.oView.byId(id);` && |\n| &&
|
||||
` if (!oControl) {` && |\n| &&
|
||||
` oControl = sap.ui.getCore().byId(id);` && |\n| &&
|
||||
` debugger ;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (!oControl) {` && |\n| &&
|
||||
` oControl = sap.z2ui5.oViewNest.byId(id) || sap.z2ui5.oViewNest2.byId(id);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` return oControl;` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
|\n| &&
|
||||
` PopupDestroy() {` && |\n| &&
|
||||
` if (!sap.z2ui5.oViewPopup) {` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (sap.z2ui5.oViewPopup.close) {` && |\n| &&
|
||||
` try {` && |\n| &&
|
||||
` sap.z2ui5.oViewPopup.close();` && |\n| &&
|
||||
` } catch {}` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` sap.z2ui5.oViewPopup.destroy();` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` PopoverDestroy() {` && |\n| &&
|
||||
` if (!sap.z2ui5.oViewPopover) {` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (sap.z2ui5.oViewPopover.close) {` && |\n| &&
|
||||
` try {` && |\n| &&
|
||||
` sap.z2ui5.oViewPopover.close();` && |\n| &&
|
||||
` } catch {}` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` sap.z2ui5.oViewPopover.destroy();` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` NestViewDestroy() {` && |\n| &&
|
||||
` if (!sap.z2ui5.oViewNest) {` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` sap.z2ui5.oViewNest.destroy();` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` NestViewDestroy2() {` && |\n| &&
|
||||
` if (!sap.z2ui5.oViewNest2) {` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` sap.z2ui5.oViewNest2.destroy();` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` ViewDestroy() {` && |\n| &&
|
||||
` if (!sap.z2ui5.oView) {` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` sap.z2ui5.oView.destroy();` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` onEventFrontend(...args) {` && |\n| &&
|
||||
|\n| &&
|
||||
` sap.z2ui5.onBeforeEventFrontend.forEach(item => {` && |\n| &&
|
||||
` if (item !== undefined) {` && |\n| &&
|
||||
` item(args);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` )` && |\n| &&
|
||||
|\n| &&
|
||||
` let oCrossAppNavigator;` && |\n| &&
|
||||
` switch (args[0].EVENT) {` && |\n| &&
|
||||
` case 'CROSS_APP_NAV_TO_PREV_APP':` && |\n| &&
|
||||
` oCrossAppNavigator = sap.ushell.Container.getService("CrossApplicationNavigation");` && |\n| &&
|
||||
` oCrossAppNavigator.backToPreviousApp();` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'CROSS_APP_NAV_TO_EXT':` && |\n| &&
|
||||
` oCrossAppNavigator = sap.ushell.Container.getService("CrossApplicationNavigation");` && |\n| &&
|
||||
` const hash = (oCrossAppNavigator.hrefForExternal({` && |\n| &&
|
||||
` target: args[1],` && |\n| &&
|
||||
` params: args[2]` && |\n| &&
|
||||
` })) || "";` && |\n| &&
|
||||
` if (args[3] === 'EXT') {` && |\n| &&
|
||||
` let url = window.location.href.split('#')[0] + hash;` && |\n| &&
|
||||
` sap.m.URLHelper.redirect(url, true);` && |\n| &&
|
||||
` } else {` && |\n| &&
|
||||
` oCrossAppNavigator.toExternal({` && |\n| &&
|
||||
` target: {` && |\n| &&
|
||||
` shellHash: hash` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'LOCATION_RELOAD':` && |\n| &&
|
||||
` window.location = args[1];` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'OPEN_NEW_TAB':` && |\n| &&
|
||||
` window.open(args[1], '_blank');` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'POPUP_CLOSE':` && |\n| &&
|
||||
` sap.z2ui5.oController.PopupDestroy();` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'POPOVER_CLOSE':` && |\n| &&
|
||||
` sap.z2ui5.oController.PopoverDestroy();` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'NAV_CONTAINER_TO':` && |\n| &&
|
||||
` var navCon = sap.z2ui5.oView.byId(args[1]);` && |\n| &&
|
||||
` var navConTo = sap.z2ui5.oView.byId(args[2]);` && |\n| &&
|
||||
` navCon.to(navConTo);` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'NEST_NAV_CONTAINER_TO':` && |\n| &&
|
||||
` navCon = sap.z2ui5.oViewNest.byId(args[1]);` && |\n| &&
|
||||
` navConTo = sap.z2ui5.oViewNest.byId(args[2]);` && |\n| &&
|
||||
` navCon.to(navConTo);` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'NEST2_NAV_CONTAINER_TO':` && |\n| &&
|
||||
` navCon = sap.z2ui5.oViewNest2.byId(args[1]);` && |\n| &&
|
||||
` navConTo = sap.z2ui5.oViewNest2.byId(args[2]);` && |\n| &&
|
||||
` navCon.to(navConTo);` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` onEvent(...args) {` && |\n| &&
|
||||
` if (sap.z2ui5.isBusy) {` && |\n| &&
|
||||
` if (sap.z2ui5.isBusy == true) {` && |\n| &&
|
||||
` sap.z2ui5.busyDialog = new sap.m.BusyDialog();` && |\n| &&
|
||||
` sap.z2ui5.busyDialog.open();` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` sap.z2ui5.isBusy = true;` && |\n| &&
|
||||
` if (!window.navigator.onLine) {` && |\n| &&
|
||||
` sap.m.MessageBox.alert('No internet connection! Please reconnect to the server and try again.');` && |\n| &&
|
||||
` sap.z2ui5.isBusy = false;` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` BusyIndicator.show();` && |\n| &&
|
||||
` sap.z2ui5.oBody = {};` && |\n| &&
|
||||
` let isUpdated = false;` && |\n| &&
|
||||
` if (sap.z2ui5.oViewPopup) {` && |\n| &&
|
||||
` if (!sap.z2ui5.oViewPopup.isOpen || sap.z2ui5.oViewPopup.isOpen() == true) {` && |\n| &&
|
||||
` sap.z2ui5.oBody.EDIT = sap.z2ui5.oViewPopup.getModel().getData().EDIT;` && |\n| &&
|
||||
` isUpdated = true;` && |\n| &&
|
||||
` sap.z2ui5.oBody.VIEWNAME = 'MAIN';` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (isUpdated == false) {` && |\n| &&
|
||||
` if (sap.z2ui5.oViewPopover) {` && |\n| &&
|
||||
` if (sap.z2ui5.oViewPopover.isOpen) {` && |\n| &&
|
||||
` if (sap.z2ui5.oViewPopover.isOpen() == true) {` && |\n| &&
|
||||
` sap.z2ui5.oBody.EDIT = sap.z2ui5.oViewPopover.getModel().getData().EDIT;` && |\n| &&
|
||||
` isUpdated = true;` && |\n| &&
|
||||
` sap.z2ui5.oBody.VIEWNAME = 'MAIN';` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` sap.z2ui5.oViewPopover.destroy();` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (isUpdated == false) {` && |\n| &&
|
||||
` if (sap.z2ui5.oViewNest == this.getView()) {` && |\n| &&
|
||||
` sap.z2ui5.oBody.EDIT = sap.z2ui5.oViewNest.getModel().getData().EDIT;` && |\n| &&
|
||||
` sap.z2ui5.oBody.VIEWNAME = 'NEST';` && |\n| &&
|
||||
` isUpdated = true;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (isUpdated == false) {` && |\n| &&
|
||||
` sap.z2ui5.oBody.EDIT = sap.z2ui5.oView.getModel().getData().EDIT;` && |\n| &&
|
||||
` sap.z2ui5.oBody.VIEWNAME = 'MAIN';` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
|\n| &&
|
||||
` sap.z2ui5.onBeforeRoundtrip.forEach(item=>{` && |\n| &&
|
||||
` if (item !== undefined) {` && |\n| &&
|
||||
` item();` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` )` && |\n| &&
|
||||
` if (args[0].CHECK_VIEW_DESTROY) {` && |\n| &&
|
||||
` sap.z2ui5.oController.ViewDestroy();` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` sap.z2ui5.oBody.ID = sap.z2ui5.oResponse.ID;` && |\n| &&
|
||||
` sap.z2ui5.oBody.ARGUMENTS = args;` && |\n| &&
|
||||
|\n| &&
|
||||
` if (sap.z2ui5.checkLogActive) {` && |\n| &&
|
||||
` console.log('Request Object:');` && |\n| &&
|
||||
` console.log(sap.z2ui5.oBody);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` sap.z2ui5.oResponseOld = sap.z2ui5.oResponse;` && |\n| &&
|
||||
` sap.z2ui5.oResponse = {};` && |\n| &&
|
||||
` sap.z2ui5.oController.Roundtrip();` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` responseError(response) {` && |\n| &&
|
||||
` document.write(response);` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` updateModelIfRequired(paramKey, oView) {` && |\n| &&
|
||||
` if (sap.z2ui5.oResponse.PARAMS[paramKey]?.CHECK_UPDATE_MODEL) {` && |\n| &&
|
||||
` let model = new JSONModel(sap.z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
|
||||
` model.setSizeLimit(sap.z2ui5.JSON_MODEL_LIMIT);` && |\n| &&
|
||||
` oView.setModel(model);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` async responseSuccess(response) {` && |\n| &&
|
||||
` try{` && |\n| &&
|
||||
` sap.z2ui5.oResponse = response;` && |\n| &&
|
||||
|\n| &&
|
||||
` if (sap.z2ui5.oResponse.PARAMS?.S_VIEW?.CHECK_DESTROY) {` && |\n| &&
|
||||
` sap.z2ui5.oController.ViewDestroy();` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
|\n| &&
|
||||
` sap.z2ui5.oController.showMessage('S_MSG_TOAST', sap.z2ui5.oResponse.PARAMS);` && |\n| &&
|
||||
` sap.z2ui5.oController.showMessage('S_MSG_BOX', sap.z2ui5.oResponse.PARAMS);` && |\n| &&
|
||||
` if (sap.z2ui5.oResponse.PARAMS?.S_VIEW?.XML) { if ( sap.z2ui5.oResponse.PARAMS?.S_VIEW?.XML !== '') {` && |\n| &&
|
||||
` sap.z2ui5.oController.ViewDestroy();` && |\n| &&
|
||||
` await sap.z2ui5.oController.createView(sap.z2ui5.oResponse.PARAMS.S_VIEW.XML, sap.z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
|
||||
` return; } } ` && |\n| &&
|
||||
* ` } else {` && |\n| &&
|
||||
` this.updateModelIfRequired('S_VIEW', sap.z2ui5.oView);` && |\n| &&
|
||||
` this.updateModelIfRequired('S_VIEW_NEST', sap.z2ui5.oViewNest);` && |\n| &&
|
||||
` this.updateModelIfRequired('S_VIEW_NEST2', sap.z2ui5.oViewNest2);` && |\n| &&
|
||||
` this.updateModelIfRequired('S_POPUP', sap.z2ui5.oViewPopup);` && |\n| &&
|
||||
` this.updateModelIfRequired('S_POPOVER', sap.z2ui5.oViewPopover);` && |\n| &&
|
||||
` sap.z2ui5.oController.onAfterRendering();` && |\n| &&
|
||||
* ` }` && |\n| &&
|
||||
` }catch(e){ BusyIndicator.hide(); MessageBox.error(e.toLocaleString()); }` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` showMessage(msgType, params) {` && |\n| &&
|
||||
` if (params[msgType]?.TEXT !== undefined) {` && |\n| &&
|
||||
` if (msgType === 'S_MSG_TOAST') {` && |\n| &&
|
||||
` MessageToast.show(params[msgType].TEXT);` && |\n| &&
|
||||
` } else if (msgType === 'S_MSG_BOX') {` && |\n| &&
|
||||
` MessageBox[params[msgType].TYPE](params[msgType].TEXT);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` async createView(xml, viewModel) {` && |\n| &&
|
||||
` const oView = await XMLView.create({` && |\n| &&
|
||||
` definition: xml,` && |\n| &&
|
||||
` controller: sap.z2ui5.oController,` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` let oview_model = new JSONModel(viewModel);` && |\n| &&
|
||||
` oview_model.setSizeLimit(sap.z2ui5.JSON_MODEL_LIMIT);` && |\n| &&
|
||||
` oView.setModel(oview_model);` && |\n| &&
|
||||
|\n| &&
|
||||
` if (sap.z2ui5.oParent) {` && |\n| &&
|
||||
` sap.z2ui5.oParent.removeAllPages();` && |\n| &&
|
||||
` sap.z2ui5.oParent.insertPage(oView);` && |\n| &&
|
||||
` } else {` && |\n| &&
|
||||
` oView.placeAt("content");` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` sap.z2ui5.oView = oView;` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` async readHttp() {` && |\n| &&
|
||||
` const response = await fetch(sap.z2ui5.pathname, {` && |\n| &&
|
||||
` method: 'POST',` && |\n| &&
|
||||
` headers: {` && |\n| &&
|
||||
` 'Content-Type': 'application/json'` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` body: JSON.stringify(sap.z2ui5.oBody)` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
|\n| &&
|
||||
` if (!response.ok) {` && |\n| &&
|
||||
` const responseText = await response.text();` && |\n| &&
|
||||
` sap.z2ui5.oController.responseError(responseText);` && |\n| &&
|
||||
` } else {` && |\n| &&
|
||||
` const responseData = await response.json();` && |\n| &&
|
||||
` sap.z2ui5.oController.responseSuccess(responseData);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
|\n| &&
|
||||
` },` && |\n| &&
|
||||
|\n| &&
|
||||
` Roundtrip() {` && |\n| &&
|
||||
|\n| &&
|
||||
` sap.z2ui5.checkTimerActive = false;` && |\n| &&
|
||||
` sap.z2ui5.checkNestAfter = false;` && |\n| &&
|
||||
` sap.z2ui5.checkNestAfter2 = false;` && |\n| &&
|
||||
|\n| &&
|
||||
` sap.z2ui5.oBody.OLOCATION = {` && |\n| &&
|
||||
` ORIGIN: window.location.origin,` && |\n| &&
|
||||
` PATHNAME: sap.z2ui5.pathname,` && |\n| &&
|
||||
` SEARCH: window.location.search,` && |\n| &&
|
||||
` // VERSION: sap.ui.getVersionInfo().gav,` && |\n| &&
|
||||
` CHECK_LAUNCHPAD_ACTIVE: sap.ushell !== undefined,` && |\n| &&
|
||||
` STARTUP_PARAMETERS: sap.z2ui5.startupParameters,` && |\n| &&
|
||||
` };` && |\n| &&
|
||||
` if (sap.z2ui5.search) {` && |\n| &&
|
||||
` sap.z2ui5.oBody.OLOCATION.SEARCH = sap.z2ui5.search;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` sap.z2ui5.oController.readHttp();` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` })` && |\n| &&
|
||||
`});` && |\n| &&
|
||||
|\n| &&
|
||||
`sap.ui.require(["z2ui5/Controller", "sap/ui/core/BusyIndicator", "sap/ui/core/mvc/XMLView", "sap/ui/core/Fragment", "sap/m/MessageToast", "sap/m/MessageBox", "sap/ui/model/json/JSONModel"], (Controller,BusyIndicator)=>{` && |\n| &&
|
||||
|\n| &&
|
||||
` BusyIndicator.show();` && |\n| &&
|
||||
` sap.z2ui5.oController = new Controller();` && |\n| &&
|
||||
` sap.z2ui5.oControllerNest = new Controller();` && |\n| &&
|
||||
` sap.z2ui5.oControllerNest2 = new Controller();` && |\n| &&
|
||||
|\n| &&
|
||||
` sap.z2ui5.pathname = sap.z2ui5.pathname || window.location.pathname;` && |\n| &&
|
||||
` sap.z2ui5.checkNestAfter = false;` && |\n| &&
|
||||
|\n| &&
|
||||
` sap.z2ui5.oBody = {` && |\n| &&
|
||||
` APP_START: sap.z2ui5.APP_START` && |\n| &&
|
||||
` };` && |\n| &&
|
||||
` sap.z2ui5.oController.Roundtrip();` && |\n| &&
|
||||
|\n| &&
|
||||
` sap.z2ui5.onBeforeRoundtrip = [];` && |\n| &&
|
||||
` sap.z2ui5.onAfterRendering = [];` && |\n| &&
|
||||
` sap.z2ui5.onBeforeEventFrontend = [];` && |\n| &&
|
||||
` sap.z2ui5.onAfterRoundtrip = []; }` && |\n| &&
|
||||
`);`.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
@ -440,8 +438,8 @@ CLASS Z2UI5_CL_FW_HTTP_HANDLER IMPLEMENTATION.
|
|||
IF lt_config IS INITIAL.
|
||||
lt_config = VALUE #(
|
||||
* ( n = `src` v = `https://sdk.openui5.org/nightly/2/resources/sap-ui-core.js` )
|
||||
( n = `src` v = `https://sdk.openui5.org/resources/sap-ui-cachebuster/sap-ui-core.js` )
|
||||
* ( n = `src` v = `https://ui5.sap.com/1.120.0/resources/sap-ui-core.js` )
|
||||
* ( n = `src` v = `https://sdk.openui5.org/resources/sap-ui-cachebuster/sap-ui-core.js` )
|
||||
( n = `src` v = `https://ui5.sap.com/1.120.0/resources/sap-ui-core.js` )
|
||||
( n = `data-sap-ui-theme` v = `sap_horizon` )
|
||||
( n = `data-sap-ui-async` v = `true` )
|
||||
( n = `data-sap-ui-bindingSyntax` v = `complex` )
|
||||
|
@ -449,15 +447,12 @@ CLASS Z2UI5_CL_FW_HTTP_HANDLER IMPLEMENTATION.
|
|||
( n = `data-sap-ui-compatVersion` v = `edge` ) ).
|
||||
ENDIF.
|
||||
|
||||
DATA(lv_add_js) = z2ui5_cl_fw_cc_factory=>get_js_startup( ) && custom_js.
|
||||
|
||||
IF content_security_policy IS NOT SUPPLIED.
|
||||
DATA(lv_sec_policy) = `<meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline' 'unsafe-eval' data: ` &&
|
||||
`ui5.sap.com *.ui5.sap.com sapui5.hana.ondemand.com *.sapui5.hana.ondemand.com sdk.openui5.org *.sdk.openui5.org cdn.jsdelivr.net *.cdn.jsdelivr.net cdnjs.cloudflare.com *.cdnjs.cloudflare.com"/>`.
|
||||
ELSE.
|
||||
lv_sec_policy = content_security_policy.
|
||||
ENDIF.
|
||||
z2ui5_cl_fw_db=>cleanup( ).
|
||||
|
||||
r_result = `<!DOCTYPE html>` && |\n| &&
|
||||
`<html lang="en">` && |\n| &&
|
||||
|
@ -487,21 +482,25 @@ CLASS Z2UI5_CL_FW_HTTP_HANDLER IMPLEMENTATION.
|
|||
` <div id="content" data-handle-validation="true" ></div>` && |\n| &&
|
||||
`<abc/>` && |\n|.
|
||||
|
||||
r_result = r_result && `<script> sap.z2ui5 = sap.z2ui5 || {};` && |\n| &&
|
||||
get_js( ) && |\n| &&
|
||||
lv_add_js && |\n| &&
|
||||
` sap.z2ui5.JSON_MODEL_LIMIT = ` && json_model_limit && `;`.
|
||||
DATA(lv_add_js) = z2ui5_cl_fw_cc_factory=>get_js_startup( ) && custom_js.
|
||||
|
||||
* IF check_debugging = abap_true.
|
||||
r_result = r_result && `` &&
|
||||
z2ui5_cl_fw_cc_debugging_tools=>get_js( ) &&
|
||||
` sap.ui.require(["z2ui5/DebuggingTools","z2ui5/Controller"], (DebuggingTools) => { sap.z2ui5.DebuggingTools = new DebuggingTools(); ` && |\n| &&
|
||||
` });`.
|
||||
* ENDIF.
|
||||
r_result = r_result && ` ` && |\n| &&
|
||||
r_result = r_result &&
|
||||
`<script> sap.z2ui5 = sap.z2ui5 || {};` && |\n| &&
|
||||
get_js( ) && |\n| &&
|
||||
lv_add_js && |\n| &&
|
||||
` sap.z2ui5.JSON_MODEL_LIMIT = ` && json_model_limit && `;`.
|
||||
|
||||
r_result = r_result &&
|
||||
z2ui5_cl_fw_cc_debugging_tools=>get_js( ) &&
|
||||
` sap.ui.require(["z2ui5/DebuggingTools","z2ui5/Controller"], (DebuggingTools) => { sap.z2ui5.DebuggingTools = new DebuggingTools(); ` && |\n| &&
|
||||
` });`.
|
||||
|
||||
r_result = r_result && |\n| &&
|
||||
`</script>` && |\n| &&
|
||||
`<abc/></body></html>`.
|
||||
|
||||
z2ui5_cl_fw_db=>cleanup( ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
|
|
|
@ -25,13 +25,13 @@ CLASS z2ui5_cl_fw_model DEFINITION
|
|||
DATA mt_attri TYPE z2ui5_cl_fw_binding=>ty_t_attri.
|
||||
DATA mv_viewname TYPE string.
|
||||
|
||||
protected section.
|
||||
PROTECTED SECTION.
|
||||
PRIVATE SECTION.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
|
||||
CLASS Z2UI5_CL_FW_MODEL IMPLEMENTATION.
|
||||
CLASS z2ui5_cl_fw_model IMPLEMENTATION.
|
||||
|
||||
|
||||
METHOD factory.
|
||||
|
@ -50,7 +50,6 @@ CLASS Z2UI5_CL_FW_MODEL IMPLEMENTATION.
|
|||
WHERE bind_type = z2ui5_cl_fw_binding=>cs_bind_type-two_way AND
|
||||
viewname = mv_viewname.
|
||||
TRY.
|
||||
|
||||
DATA(lv_name_back) = `MO_APP->` && lr_attri->name.
|
||||
|
||||
FIELD-SYMBOLS <backend> TYPE any.
|
||||
|
@ -81,6 +80,13 @@ CLASS Z2UI5_CL_FW_MODEL IMPLEMENTATION.
|
|||
IMPORTING
|
||||
t_result = <backend> ).
|
||||
|
||||
WHEN cl_abap_typedescr=>typekind_struct1 OR cl_abap_typedescr=>typekind_struct2.
|
||||
z2ui5_cl_util_func=>trans_ref_struc_2_struc(
|
||||
EXPORTING
|
||||
ir_struc_from = <frontend>
|
||||
IMPORTING
|
||||
r_result = <backend> ).
|
||||
|
||||
WHEN OTHERS.
|
||||
|
||||
ASSIGN <frontend>->* TO <frontend>.
|
||||
|
@ -135,7 +141,7 @@ CLASS Z2UI5_CL_FW_MODEL IMPLEMENTATION.
|
|||
|
||||
WHEN `h`.
|
||||
lo_actual->add_attribute( n = lr_attri->name_front
|
||||
v = z2ui5_cl_util_func=>trans_json_any_2( any = <attribute> pretty_name = lr_attri->pretty_name compress = conv #( lr_attri->compress ) )
|
||||
v = z2ui5_cl_util_func=>trans_json_any_2( any = <attribute> pretty_name = lr_attri->pretty_name compress = lr_attri->compress )
|
||||
apos_active = abap_false ).
|
||||
|
||||
WHEN OTHERS.
|
||||
|
@ -151,7 +157,7 @@ CLASS Z2UI5_CL_FW_MODEL IMPLEMENTATION.
|
|||
WHEN OTHERS.
|
||||
|
||||
lo_actual->add_attribute( n = lr_attri->name_front
|
||||
v = z2ui5_cl_util_func=>trans_json_any_2( any = <attribute> pretty_name = lr_attri->pretty_name compress = conv #( lr_attri->compress ) )
|
||||
v = z2ui5_cl_util_func=>trans_json_any_2( any = <attribute> pretty_name = lr_attri->pretty_name compress = lr_attri->compress )
|
||||
apos_active = abap_false ).
|
||||
ENDCASE.
|
||||
ENDCASE.
|
||||
|
|
|
@ -155,7 +155,7 @@ INTERFACE z2ui5_if_client
|
|||
val TYPE data
|
||||
path TYPE abap_bool DEFAULT abap_false
|
||||
pretty_name TYPE clike DEFAULT /ui2/cl_json=>pretty_mode-none
|
||||
compress TYPE clike DEFAULT abap_false
|
||||
compress TYPE abap_bool DEFAULT abap_true
|
||||
tab TYPE STANDARD TABLE OPTIONAL
|
||||
tab_index TYPE i OPTIONAL
|
||||
RETURNING
|
||||
|
@ -167,7 +167,7 @@ INTERFACE z2ui5_if_client
|
|||
path TYPE abap_bool DEFAULT abap_false
|
||||
view TYPE string DEFAULT cs_view-main
|
||||
pretty_name TYPE clike DEFAULT /ui2/cl_json=>pretty_mode-none
|
||||
compress TYPE clike DEFAULT abap_false
|
||||
compress TYPE abap_bool DEFAULT abap_true
|
||||
tab TYPE STANDARD TABLE OPTIONAL
|
||||
tab_index TYPE i OPTIONAL
|
||||
RETURNING
|
||||
|
@ -178,7 +178,7 @@ INTERFACE z2ui5_if_client
|
|||
val TYPE data
|
||||
path TYPE abap_bool DEFAULT abap_false
|
||||
pretty_name TYPE clike DEFAULT /ui2/cl_json=>pretty_mode-none
|
||||
compress TYPE clike DEFAULT abap_false
|
||||
compress TYPE abap_bool DEFAULT abap_true
|
||||
RETURNING
|
||||
VALUE(result) TYPE string.
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<DEVC>
|
||||
<CTEXT>abap2UI5 - fw ui</CTEXT>
|
||||
<CTEXT>abap2UI5 - fw app</CTEXT>
|
||||
</DEVC>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
CLASS z2ui5_cl_fw_ui_error DEFINITION
|
||||
CLASS z2ui5_cl_fw_app_error DEFINITION
|
||||
PUBLIC
|
||||
FINAL
|
||||
CREATE PROTECTED.
|
||||
|
@ -12,7 +12,7 @@ CLASS z2ui5_cl_fw_ui_error DEFINITION
|
|||
IMPORTING
|
||||
!error TYPE REF TO cx_root
|
||||
RETURNING
|
||||
VALUE(result) TYPE REF TO z2ui5_cl_fw_ui_error.
|
||||
VALUE(result) TYPE REF TO z2ui5_cl_fw_app_error.
|
||||
|
||||
PROTECTED SECTION.
|
||||
PRIVATE SECTION.
|
||||
|
@ -20,7 +20,7 @@ ENDCLASS.
|
|||
|
||||
|
||||
|
||||
CLASS z2ui5_cl_fw_ui_error IMPLEMENTATION.
|
||||
CLASS z2ui5_cl_fw_app_error IMPLEMENTATION.
|
||||
|
||||
|
||||
METHOD factory.
|
|
@ -3,7 +3,7 @@
|
|||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<VSEOCLASS>
|
||||
<CLSNAME>Z2UI5_CL_FW_UI_ERROR</CLSNAME>
|
||||
<CLSNAME>Z2UI5_CL_FW_APP_ERROR</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>abap2UI5 - app error</DESCRIPT>
|
||||
<STATE>1</STATE>
|
|
@ -1,4 +1,4 @@
|
|||
CLASS z2ui5_cl_fw_ui_startup DEFINITION
|
||||
CLASS z2ui5_cl_fw_app_startup DEFINITION
|
||||
PUBLIC
|
||||
FINAL
|
||||
CREATE PROTECTED .
|
||||
|
@ -23,7 +23,7 @@ CLASS z2ui5_cl_fw_ui_startup DEFINITION
|
|||
|
||||
CLASS-METHODS factory
|
||||
RETURNING
|
||||
VALUE(result) TYPE REF TO z2ui5_cl_fw_ui_startup.
|
||||
VALUE(result) TYPE REF TO z2ui5_cl_fw_app_startup.
|
||||
|
||||
METHODS z2ui5_on_init.
|
||||
METHODS z2ui5_on_event.
|
||||
|
@ -34,7 +34,7 @@ ENDCLASS.
|
|||
|
||||
|
||||
|
||||
CLASS z2ui5_cl_fw_ui_startup IMPLEMENTATION.
|
||||
CLASS z2ui5_cl_fw_app_startup IMPLEMENTATION.
|
||||
|
||||
|
||||
METHOD factory.
|
||||
|
@ -198,7 +198,7 @@ CLASS z2ui5_cl_fw_ui_startup IMPLEMENTATION.
|
|||
ms_home-btn_event_id = `BUTTON_CHECK`.
|
||||
ms_home-class_editable = abap_true.
|
||||
ms_home-btn_icon = `sap-icon://validate`.
|
||||
ms_home-classname = `Z2UI5_CL_FW_UI_HELLO_WORLD`.
|
||||
ms_home-classname = `Z2UI5_CL_APP_HELLO_WORLD`.
|
||||
mv_check_demo = abap_true.
|
||||
|
||||
ENDMETHOD.
|
|
@ -12,7 +12,7 @@ CLASS ltcl_unit_test IMPLEMENTATION.
|
|||
|
||||
METHOD first_test.
|
||||
|
||||
DATA(lo_app) = Z2UI5_CL_FW_UI_STARTUP=>factory( ) ##NEEDED.
|
||||
DATA(lo_app) = Z2UI5_CL_FW_APP_STARTUP=>factory( ) ##NEEDED.
|
||||
|
||||
ENDMETHOD.
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<VSEOCLASS>
|
||||
<CLSNAME>Z2UI5_CL_FW_UI_STARTUP</CLSNAME>
|
||||
<CLSNAME>Z2UI5_CL_FW_APP_STARTUP</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>abap2UI5 - app startup</DESCRIPT>
|
||||
<STATE>1</STATE>
|
10
src/03/01/package.devc.xml
Normal file
10
src/03/01/package.devc.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_DEVC" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<DEVC>
|
||||
<CTEXT>abap2UI5 - ui popups (popup)</CTEXT>
|
||||
</DEVC>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
56
src/03/01/z2ui5_cl_popup_input_date.clas.abap
Normal file
56
src/03/01/z2ui5_cl_popup_input_date.clas.abap
Normal file
|
@ -0,0 +1,56 @@
|
|||
CLASS z2ui5_cl_popup_input_date DEFINITION
|
||||
PUBLIC
|
||||
FINAL
|
||||
CREATE PUBLIC.
|
||||
|
||||
PUBLIC SECTION.
|
||||
INTERFACES z2ui5_if_app.
|
||||
|
||||
DATA client TYPE REF TO z2ui5_if_client.
|
||||
data mt_tab type string.
|
||||
METHODS display.
|
||||
|
||||
PROTECTED SECTION.
|
||||
PRIVATE SECTION.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
|
||||
CLASS Z2UI5_CL_POPUP_INPUT_DATE IMPLEMENTATION.
|
||||
|
||||
|
||||
METHOD display.
|
||||
|
||||
DATA(popup) = Z2UI5_cl_xml_view=>factory_popup( client )->dialog( 'abap2UI5 - Popup to select entry'
|
||||
)->table(
|
||||
mode = 'SingleSelectLeft'
|
||||
items = client->_bind_edit( mt_tab )
|
||||
)->columns(
|
||||
)->column( )->text( 'Title' )->get_parent(
|
||||
)->column( )->text( 'Color' )->get_parent(
|
||||
)->column( )->text( 'Info' )->get_parent(
|
||||
)->column( )->text( 'Description' )->get_parent(
|
||||
)->get_parent(
|
||||
)->items( )->column_list_item( selected = '{SELKZ}'
|
||||
)->cells(
|
||||
)->text( '{TITLE}'
|
||||
)->text( '{VALUE}'
|
||||
)->text( '{INFO}'
|
||||
)->text( '{DESCR}'
|
||||
)->get_parent( )->get_parent( )->get_parent( )->get_parent(
|
||||
)->footer( )->overflow_toolbar(
|
||||
)->toolbar_spacer(
|
||||
)->button(
|
||||
text = 'continue'
|
||||
press = client->_event( 'POPUP_TABLE_CONTINUE' )
|
||||
type = 'Emphasized' ).
|
||||
|
||||
client->popup_display( popup->stringify( ) ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD z2ui5_if_app~main.
|
||||
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
16
src/03/01/z2ui5_cl_popup_input_date.clas.xml
Normal file
16
src/03/01/z2ui5_cl_popup_input_date.clas.xml
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<VSEOCLASS>
|
||||
<CLSNAME>Z2UI5_CL_POPUP_INPUT_DATE</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>ui - popup input date</DESCRIPT>
|
||||
<STATE>1</STATE>
|
||||
<CLSCCINCL>X</CLSCCINCL>
|
||||
<FIXPT>X</FIXPT>
|
||||
<UNICODE>X</UNICODE>
|
||||
</VSEOCLASS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
56
src/03/01/z2ui5_cl_popup_input_int.clas.abap
Normal file
56
src/03/01/z2ui5_cl_popup_input_int.clas.abap
Normal file
|
@ -0,0 +1,56 @@
|
|||
CLASS z2ui5_cl_popup_input_int DEFINITION
|
||||
PUBLIC
|
||||
FINAL
|
||||
CREATE PUBLIC.
|
||||
|
||||
PUBLIC SECTION.
|
||||
INTERFACES z2ui5_if_app.
|
||||
|
||||
DATA client TYPE REF TO z2ui5_if_client.
|
||||
data mt_tab type string.
|
||||
METHODS display.
|
||||
|
||||
PROTECTED SECTION.
|
||||
PRIVATE SECTION.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
|
||||
CLASS Z2UI5_CL_POPUP_INPUT_INT IMPLEMENTATION.
|
||||
|
||||
|
||||
METHOD display.
|
||||
|
||||
DATA(popup) = Z2UI5_cl_xml_view=>factory_popup( client )->dialog( 'abap2UI5 - Popup to select entry'
|
||||
)->table(
|
||||
mode = 'SingleSelectLeft'
|
||||
items = client->_bind_edit( mt_tab )
|
||||
)->columns(
|
||||
)->column( )->text( 'Title' )->get_parent(
|
||||
)->column( )->text( 'Color' )->get_parent(
|
||||
)->column( )->text( 'Info' )->get_parent(
|
||||
)->column( )->text( 'Description' )->get_parent(
|
||||
)->get_parent(
|
||||
)->items( )->column_list_item( selected = '{SELKZ}'
|
||||
)->cells(
|
||||
)->text( '{TITLE}'
|
||||
)->text( '{VALUE}'
|
||||
)->text( '{INFO}'
|
||||
)->text( '{DESCR}'
|
||||
)->get_parent( )->get_parent( )->get_parent( )->get_parent(
|
||||
)->footer( )->overflow_toolbar(
|
||||
)->toolbar_spacer(
|
||||
)->button(
|
||||
text = 'continue'
|
||||
press = client->_event( 'POPUP_TABLE_CONTINUE' )
|
||||
type = 'Emphasized' ).
|
||||
|
||||
client->popup_display( popup->stringify( ) ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD z2ui5_if_app~main.
|
||||
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
16
src/03/01/z2ui5_cl_popup_input_int.clas.xml
Normal file
16
src/03/01/z2ui5_cl_popup_input_int.clas.xml
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<VSEOCLASS>
|
||||
<CLSNAME>Z2UI5_CL_POPUP_INPUT_INT</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>ui - popup input integer</DESCRIPT>
|
||||
<STATE>1</STATE>
|
||||
<CLSCCINCL>X</CLSCCINCL>
|
||||
<FIXPT>X</FIXPT>
|
||||
<UNICODE>X</UNICODE>
|
||||
</VSEOCLASS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
|
@ -1,4 +1,4 @@
|
|||
CLASS z2ui5_cl_ui_pop_messages DEFINITION
|
||||
CLASS z2ui5_cl_popup_messages DEFINITION
|
||||
PUBLIC
|
||||
FINAL
|
||||
CREATE PUBLIC .
|
||||
|
@ -33,7 +33,7 @@ CLASS z2ui5_cl_ui_pop_messages DEFINITION
|
|||
i_messages TYPE ty_t_msg
|
||||
i_title TYPE string DEFAULT `abap2UI5 - Message Popup`
|
||||
RETURNING
|
||||
VALUE(r_result) TYPE REF TO z2ui5_cl_ui_pop_messages.
|
||||
VALUE(r_result) TYPE REF TO z2ui5_cl_popup_messages.
|
||||
|
||||
PROTECTED SECTION.
|
||||
DATA client TYPE REF TO z2ui5_if_client.
|
||||
|
@ -46,7 +46,7 @@ ENDCLASS.
|
|||
|
||||
|
||||
|
||||
CLASS z2ui5_cl_ui_pop_messages IMPLEMENTATION.
|
||||
CLASS z2ui5_cl_popup_messages IMPLEMENTATION.
|
||||
|
||||
|
||||
METHOD factory.
|
|
@ -3,7 +3,7 @@
|
|||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<VSEOCLASS>
|
||||
<CLSNAME>Z2UI5_CL_UI_POP_MESSAGES</CLSNAME>
|
||||
<CLSNAME>Z2UI5_CL_POPUP_MESSAGES</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>ui - popup messages</DESCRIPT>
|
||||
<STATE>1</STATE>
|
52
src/03/01/z2ui5_cl_popup_textedit.clas.abap
Normal file
52
src/03/01/z2ui5_cl_popup_textedit.clas.abap
Normal file
|
@ -0,0 +1,52 @@
|
|||
CLASS z2ui5_cl_popup_textedit DEFINITION
|
||||
PUBLIC
|
||||
FINAL
|
||||
CREATE PUBLIC .
|
||||
|
||||
PUBLIC SECTION.
|
||||
INTERFACES z2ui5_if_app.
|
||||
|
||||
DATA client TYPE REF TO z2ui5_if_client.
|
||||
DATA mv_stretch_active TYPE string.
|
||||
DATA mv_textarea TYPE string.
|
||||
METHODS display.
|
||||
|
||||
PROTECTED SECTION.
|
||||
PRIVATE SECTION.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
|
||||
CLASS z2ui5_cl_popup_textedit IMPLEMENTATION.
|
||||
|
||||
METHOD display.
|
||||
|
||||
DATA(popup) = z2ui5_cl_xml_view=>factory_popup( client )->dialog(
|
||||
stretch = mv_stretch_active
|
||||
title = 'Title'
|
||||
icon = 'sap-icon://edit'
|
||||
)->content(
|
||||
)->text_area(
|
||||
height = '100%'
|
||||
width = '100%'
|
||||
value = client->_bind_edit( mv_textarea )
|
||||
)->get_parent(
|
||||
)->footer( )->overflow_toolbar(
|
||||
)->toolbar_spacer(
|
||||
)->button(
|
||||
text = 'Cancel'
|
||||
press = client->_event( 'BUTTON_TEXTAREA_CANCEL' )
|
||||
)->button(
|
||||
text = 'Confirm'
|
||||
press = client->_event( 'BUTTON_TEXTAREA_CONFIRM' )
|
||||
type = 'Emphasized' ).
|
||||
|
||||
client->popup_display( popup->stringify( ) ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD z2ui5_if_app~main.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
16
src/03/01/z2ui5_cl_popup_textedit.clas.xml
Normal file
16
src/03/01/z2ui5_cl_popup_textedit.clas.xml
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<VSEOCLASS>
|
||||
<CLSNAME>Z2UI5_CL_POPUP_TEXTEDIT</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>ui - popup textedit</DESCRIPT>
|
||||
<STATE>1</STATE>
|
||||
<CLSCCINCL>X</CLSCCINCL>
|
||||
<FIXPT>X</FIXPT>
|
||||
<UNICODE>X</UNICODE>
|
||||
</VSEOCLASS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
|
@ -1,4 +1,4 @@
|
|||
CLASS z2ui5_cl_ui_pop_to_confirm DEFINITION
|
||||
CLASS z2ui5_cl_popup_to_confirm DEFINITION
|
||||
PUBLIC
|
||||
FINAL
|
||||
CREATE PUBLIC .
|
||||
|
@ -15,7 +15,7 @@ CLASS z2ui5_cl_ui_pop_to_confirm DEFINITION
|
|||
i_button_text_confirm TYPE string DEFAULT `OK`
|
||||
i_button_text_cancel TYPE string DEFAULT `Cancel`
|
||||
RETURNING
|
||||
VALUE(r_result) TYPE REF TO z2ui5_cl_ui_pop_to_confirm.
|
||||
VALUE(r_result) TYPE REF TO z2ui5_cl_popup_to_confirm.
|
||||
|
||||
METHODS check_result
|
||||
RETURNING
|
||||
|
@ -37,7 +37,7 @@ ENDCLASS.
|
|||
|
||||
|
||||
|
||||
CLASS Z2UI5_CL_UI_POP_TO_CONFIRM IMPLEMENTATION.
|
||||
CLASS Z2UI5_CL_POPUP_TO_CONFIRM IMPLEMENTATION.
|
||||
|
||||
|
||||
METHOD check_result.
|
|
@ -3,7 +3,7 @@
|
|||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<VSEOCLASS>
|
||||
<CLSNAME>Z2UI5_CL_UI_POP_TO_CONFIRM</CLSNAME>
|
||||
<CLSNAME>Z2UI5_CL_POPUP_TO_CONFIRM</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>ui - popup to confirm</DESCRIPT>
|
||||
<STATE>1</STATE>
|
108
src/03/01/z2ui5_cl_popup_to_inform.clas.abap
Normal file
108
src/03/01/z2ui5_cl_popup_to_inform.clas.abap
Normal file
|
@ -0,0 +1,108 @@
|
|||
CLASS z2ui5_cl_popup_to_inform DEFINITION
|
||||
PUBLIC
|
||||
FINAL
|
||||
CREATE PUBLIC .
|
||||
|
||||
PUBLIC SECTION.
|
||||
|
||||
INTERFACES z2ui5_if_app.
|
||||
|
||||
CLASS-METHODS factory
|
||||
IMPORTING
|
||||
i_question_text TYPE string
|
||||
i_title TYPE string DEFAULT `Title`
|
||||
i_icon TYPE string DEFAULT 'sap-icon://question-mark'
|
||||
i_button_text_confirm TYPE string DEFAULT `OK`
|
||||
i_button_text_cancel TYPE string DEFAULT `Cancel`
|
||||
RETURNING
|
||||
VALUE(r_result) TYPE REF TO z2ui5_cl_popup_to_inform.
|
||||
|
||||
METHODS check_result
|
||||
RETURNING
|
||||
VALUE(result) TYPE abap_bool.
|
||||
|
||||
PROTECTED SECTION.
|
||||
DATA client TYPE REF TO z2ui5_if_client.
|
||||
|
||||
DATA title TYPE string.
|
||||
DATA icon TYPE string.
|
||||
DATA question_text TYPE string.
|
||||
DATA button_text_confirm TYPE string.
|
||||
DATA button_text_cancel TYPE string.
|
||||
DATA check_initialized TYPE abap_bool.
|
||||
DATA check_result_confirmed TYPE abap_bool.
|
||||
METHODS view_display.
|
||||
PRIVATE SECTION.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
|
||||
CLASS Z2UI5_CL_POPUP_TO_INFORM IMPLEMENTATION.
|
||||
|
||||
|
||||
METHOD check_result.
|
||||
|
||||
result = check_result_confirmed.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD factory.
|
||||
|
||||
r_result = new #( ).
|
||||
r_result->title = i_title.
|
||||
r_result->icon = i_icon.
|
||||
r_result->question_text = i_question_text.
|
||||
r_result->button_text_confirm = i_button_text_confirm.
|
||||
r_result->button_text_cancel = i_button_text_cancel.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD view_display.
|
||||
|
||||
DATA(popup) = z2ui5_cl_xml_view=>factory_popup( )->dialog(
|
||||
title = title
|
||||
icon = icon
|
||||
)->content(
|
||||
)->vbox( 'sapUiMediumMargin'
|
||||
)->text( question_text
|
||||
)->get_parent( )->get_parent(
|
||||
)->footer( )->overflow_toolbar(
|
||||
)->toolbar_spacer(
|
||||
)->button(
|
||||
text = button_text_cancel
|
||||
press = client->_event( 'BUTTON_CANCEL' )
|
||||
)->button(
|
||||
text = button_text_confirm
|
||||
press = client->_event( 'BUTTON_CONFIRM' )
|
||||
type = 'Emphasized' ).
|
||||
|
||||
client->popup_display( popup->stringify( ) ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD z2ui5_if_app~main.
|
||||
|
||||
me->client = client.
|
||||
|
||||
IF check_initialized = abap_false.
|
||||
check_initialized = abap_true.
|
||||
view_display( ).
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
CASE client->get( )-event.
|
||||
WHEN `BUTTON_CONFIRM`.
|
||||
check_result_confirmed = abap_true.
|
||||
client->popup_destroy( ).
|
||||
client->nav_app_leave( client->get_app( client->get( )-s_draft-id_prev_app_stack ) ).
|
||||
WHEN `BUTTON_CANCEL`.
|
||||
check_result_confirmed = abap_false.
|
||||
client->popup_destroy( ).
|
||||
client->nav_app_leave( client->get_app( client->get( )-s_draft-id_prev_app_stack ) ).
|
||||
ENDCASE.
|
||||
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
16
src/03/01/z2ui5_cl_popup_to_inform.clas.xml
Normal file
16
src/03/01/z2ui5_cl_popup_to_inform.clas.xml
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<VSEOCLASS>
|
||||
<CLSNAME>Z2UI5_CL_POPUP_TO_INFORM</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>ui - popup to inform</DESCRIPT>
|
||||
<STATE>1</STATE>
|
||||
<CLSCCINCL>X</CLSCCINCL>
|
||||
<FIXPT>X</FIXPT>
|
||||
<UNICODE>X</UNICODE>
|
||||
</VSEOCLASS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
55
src/03/01/z2ui5_cl_popup_to_select.clas.abap
Normal file
55
src/03/01/z2ui5_cl_popup_to_select.clas.abap
Normal file
|
@ -0,0 +1,55 @@
|
|||
CLASS z2ui5_cl_popup_to_select DEFINITION
|
||||
PUBLIC
|
||||
FINAL
|
||||
CREATE PUBLIC.
|
||||
|
||||
PUBLIC SECTION.
|
||||
INTERFACES z2ui5_if_app.
|
||||
|
||||
DATA client TYPE REF TO z2ui5_if_client.
|
||||
data mt_tab type string.
|
||||
METHODS display.
|
||||
|
||||
PROTECTED SECTION.
|
||||
PRIVATE SECTION.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
|
||||
CLASS z2ui5_cl_popup_to_select IMPLEMENTATION.
|
||||
|
||||
METHOD display.
|
||||
|
||||
DATA(popup) = Z2UI5_cl_xml_view=>factory_popup( client )->dialog( 'abap2UI5 - Popup to select entry'
|
||||
)->table(
|
||||
mode = 'SingleSelectLeft'
|
||||
items = client->_bind_edit( mt_tab )
|
||||
)->columns(
|
||||
)->column( )->text( 'Title' )->get_parent(
|
||||
)->column( )->text( 'Color' )->get_parent(
|
||||
)->column( )->text( 'Info' )->get_parent(
|
||||
)->column( )->text( 'Description' )->get_parent(
|
||||
)->get_parent(
|
||||
)->items( )->column_list_item( selected = '{SELKZ}'
|
||||
)->cells(
|
||||
)->text( '{TITLE}'
|
||||
)->text( '{VALUE}'
|
||||
)->text( '{INFO}'
|
||||
)->text( '{DESCR}'
|
||||
)->get_parent( )->get_parent( )->get_parent( )->get_parent(
|
||||
)->footer( )->overflow_toolbar(
|
||||
)->toolbar_spacer(
|
||||
)->button(
|
||||
text = 'continue'
|
||||
press = client->_event( 'POPUP_TABLE_CONTINUE' )
|
||||
type = 'Emphasized' ).
|
||||
|
||||
client->popup_display( popup->stringify( ) ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD z2ui5_if_app~main.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
|
@ -3,7 +3,7 @@
|
|||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<VSEOCLASS>
|
||||
<CLSNAME>Z2UI5_CL_UI_POP_TO_SELECT</CLSNAME>
|
||||
<CLSNAME>Z2UI5_CL_POPUP_TO_SELECT</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>ui - popup to select</DESCRIPT>
|
||||
<STATE>1</STATE>
|
10
src/03/02/package.devc.xml
Normal file
10
src/03/02/package.devc.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_DEVC" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<DEVC>
|
||||
<CTEXT>abap2UI5 - ui apps (app)</CTEXT>
|
||||
</DEVC>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
|
@ -1,4 +1,4 @@
|
|||
CLASS z2ui5_cl_fw_ui_hello_world DEFINITION
|
||||
CLASS z2ui5_cl_app_hello_world DEFINITION
|
||||
PUBLIC
|
||||
CREATE PUBLIC .
|
||||
|
||||
|
@ -16,7 +16,7 @@ ENDCLASS.
|
|||
|
||||
|
||||
|
||||
CLASS z2ui5_cl_fw_ui_hello_world IMPLEMENTATION.
|
||||
CLASS Z2UI5_CL_APP_HELLO_WORLD IMPLEMENTATION.
|
||||
|
||||
|
||||
METHOD z2ui5_if_app~main.
|
||||
|
@ -29,7 +29,7 @@ CLASS z2ui5_cl_fw_ui_hello_world IMPLEMENTATION.
|
|||
|
||||
client->view_display( z2ui5_cl_xml_view=>factory(
|
||||
)->shell(
|
||||
)->page( title = 'abap2UI5 - z2ui5_cl_fw_ui_hello_world'
|
||||
)->page( title = 'abap2UI5 - z2ui5_cl_app_hello_world'
|
||||
)->simple_form( title = 'Hello World' editable = abap_true
|
||||
)->content( ns = `form`
|
||||
)->title( 'Make an input here and send it to the server...'
|
|
@ -12,7 +12,7 @@ CLASS ltcl_unit_test IMPLEMENTATION.
|
|||
|
||||
METHOD first_test.
|
||||
|
||||
DATA(lo_app) = NEW z2ui5_cl_fw_ui_hello_world( ) ##NEEDED.
|
||||
DATA(lo_app) = NEW z2ui5_cl_app_hello_world( ) ##NEEDED.
|
||||
|
||||
ENDMETHOD.
|
||||
|
|
@ -3,9 +3,9 @@
|
|||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<VSEOCLASS>
|
||||
<CLSNAME>Z2UI5_CL_FW_UI_HELLO_WORLD</CLSNAME>
|
||||
<CLSNAME>Z2UI5_CL_APP_HELLO_WORLD</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>abap2UI5 - app hello world test</DESCRIPT>
|
||||
<DESCRIPT>abap2UI5 - app hello world</DESCRIPT>
|
||||
<STATE>1</STATE>
|
||||
<CLSCCINCL>X</CLSCCINCL>
|
||||
<FIXPT>X</FIXPT>
|
|
@ -3,7 +3,7 @@
|
|||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<DEVC>
|
||||
<CTEXT>abap2UI5 - ui functions (ui)</CTEXT>
|
||||
<CTEXT>abap2UI5 - ui functions (app/popup)</CTEXT>
|
||||
</DEVC>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
CLASS z2ui5_cl_ui_pop_to_select DEFINITION
|
||||
PUBLIC
|
||||
FINAL
|
||||
CREATE PUBLIC .
|
||||
|
||||
PUBLIC SECTION.
|
||||
PROTECTED SECTION.
|
||||
PRIVATE SECTION.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
|
||||
CLASS z2ui5_cl_ui_pop_to_select IMPLEMENTATION.
|
||||
ENDCLASS.
|
|
@ -4,8 +4,6 @@ CLASS z2ui5_cl_test_features DEFINITION PUBLIC.
|
|||
|
||||
INTERFACES z2ui5_if_app.
|
||||
|
||||
DATA mv_input TYPE string.
|
||||
DATA mv_input2 TYPE string.
|
||||
DATA mv_check_popup_active TYPE abap_bool.
|
||||
DATA mv_check_initialized TYPE abap_bool.
|
||||
PROTECTED SECTION.
|
||||
|
@ -26,21 +24,18 @@ CLASS Z2UI5_CL_TEST_FEATURES IMPLEMENTATION.
|
|||
|
||||
DATA(view) = z2ui5_cl_xml_view=>factory( ).
|
||||
view->shell(
|
||||
)->page( title = 'abap2UI5 - flow logic - APP 01' navbuttonpress = client->_event( val = 'BACK' check_view_destroy = abap_true ) shownavbutton = abap_true
|
||||
)->page( title = 'abap2UI5 - UI functions' navbuttonpress = client->_event( val = 'BACK' check_view_destroy = abap_true ) shownavbutton = abap_true
|
||||
)->grid( 'L6 M12 S12' )->content( 'layout'
|
||||
)->simple_form( 'Controller' )->content( 'form'
|
||||
)->simple_form( title = 'Popups' editable = abap_true )->content( 'form'
|
||||
)->label( 'Test'
|
||||
)->button( text = 'z2ui5_cl_ui_pop_to_confirm' press = client->_event( 'z2ui5_cl_ui_pop_to_confirm' )
|
||||
)->button( text = 'POPUP_TO_INFORM' press = client->_event( 'z2ui5_cl_ui_pop_to_confirm' )
|
||||
)->label( 'Test'
|
||||
)->button( text = 'z2ui5_cl_ui_pop_messages' press = client->_event( 'z2ui5_cl_ui_pop_messages' )
|
||||
)->button( text = 'POPUP_TO_CONFIRM' press = client->_event( 'z2ui5_cl_ui_pop_to_confirm' )
|
||||
)->label( 'Test'
|
||||
)->button( text = 'POPUP_MESSAGES' press = client->_event( 'z2ui5_cl_ui_pop_messages' )
|
||||
)->label( 'Demo'
|
||||
)->button( text = 'z2ui5_cl_ui_pop_to_select' press = client->_event( 'z2ui5_cl_ui_pop_to_select' )
|
||||
)->label( 'Demo'
|
||||
)->input( client->_bind_edit( mv_input )
|
||||
)->button( text = 'call new app (set data)' press = client->_event( 'CALL_NEW_APP_READ' )
|
||||
)->label( 'some data, you can read it in the next app'
|
||||
)->input( client->_bind_edit( mv_input2 )
|
||||
).
|
||||
)->button( text = 'POPUP_TO_SELECT' press = client->_event( 'z2ui5_cl_ui_pop_to_select' )
|
||||
).
|
||||
|
||||
client->view_display( view->stringify( ) ).
|
||||
|
||||
|
@ -62,7 +57,7 @@ CLASS Z2UI5_CL_TEST_FEATURES IMPLEMENTATION.
|
|||
DATA(lo_prev) = client->get_app( client->get( )-s_draft-id_prev_app ).
|
||||
|
||||
TRY.
|
||||
DATA(lo_popup_decide) = CAST z2ui5_cl_ui_pop_to_confirm( lo_prev ).
|
||||
DATA(lo_popup_decide) = CAST z2ui5_cl_popup_to_confirm( lo_prev ).
|
||||
client->message_box_display( `the result is ` && lo_popup_decide->check_result( ) ).
|
||||
CATCH cx_root.
|
||||
ENDTRY.
|
||||
|
@ -74,7 +69,7 @@ CLASS Z2UI5_CL_TEST_FEATURES IMPLEMENTATION.
|
|||
CASE client->get( )-event.
|
||||
|
||||
WHEN 'z2ui5_cl_ui_pop_messages'.
|
||||
data(lo_popup_msg) = z2ui5_cl_ui_pop_messages=>factory(
|
||||
data(lo_popup_msg) = z2ui5_cl_popup_messages=>factory(
|
||||
i_messages = VALUE #(
|
||||
( message = 'An empty Report field causes an empty XML Message to be sent' type = 'E' id = 'MSG1' number = '001' )
|
||||
( message = 'Check was executed for wrong Scenario' type = 'E' id = 'MSG1' number = '002' )
|
||||
|
@ -88,7 +83,7 @@ CLASS Z2UI5_CL_TEST_FEATURES IMPLEMENTATION.
|
|||
client->nav_app_call( lo_popup_msg ).
|
||||
|
||||
WHEN 'z2ui5_cl_ui_pop_to_confirm'.
|
||||
DATA(lo_app) = z2ui5_cl_ui_pop_to_confirm=>factory(
|
||||
DATA(lo_app) = z2ui5_cl_popup_to_confirm=>factory(
|
||||
i_question_text = `this is a question`
|
||||
).
|
||||
mv_check_popup_active = abap_true.
|
||||
|
|
Loading…
Reference in New Issue
Block a user