Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic Update #29

Merged
merged 1 commit into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions src/01/02/z2ui6_cl_core_srv_json.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ CLASS z2ui6_cl_core_srv_json DEFINITION
ENDCLASS.



CLASS z2ui6_cl_core_srv_json IMPLEMENTATION.


METHOD model_front_to_back.

IF line_exists( t_attri->*[ view = view ] ).
Expand Down Expand Up @@ -77,6 +80,7 @@ CLASS z2ui6_cl_core_srv_json IMPLEMENTATION.

ENDMETHOD.


METHOD model_back_to_front.
TRY.

Expand Down Expand Up @@ -129,6 +133,7 @@ CLASS z2ui6_cl_core_srv_json IMPLEMENTATION.
ENDTRY.
ENDMETHOD.


METHOD request_json_to_abap.
TRY.

Expand Down Expand Up @@ -163,10 +168,20 @@ CLASS z2ui6_cl_core_srv_json IMPLEMENTATION.
CATCH cx_root.
ENDTRY.

result-s_control-app_start_draft = z2ui6_cl_util=>c_trim_upper(
z2ui6_cl_util=>url_param_get( val = `z2ui5-xapp-state`
url = result-s_front-search ) ).

try.
" result-s_control-app_start_draft = z2ui5_cl_util=>c_trim_upper(
" z2ui5_cl_util=>url_param_get( val = `z2ui5-xapp-state`
" url = result-s_front-search ) ).
data(lv_hash) = result-s_front-hash.
split lv_hash at '&/' into data(lv_dummy) lv_hash.
if lv_hash is initial.
lv_hash = result-s_front-hash+2.
endif.
result-s_control-app_start_draft = z2ui6_cl_util=>c_trim_upper(
z2ui6_cl_util=>url_param_get( val = `z2ui5-xapp-state`
url = lv_hash ) ).
catch cx_root.
endtry.
IF result-s_control-app_start IS NOT INITIAL.
IF result-s_control-app_start(1) = `-`.
REPLACE FIRST OCCURRENCE OF `-` IN result-s_control-app_start WITH `/`.
Expand All @@ -187,6 +202,7 @@ CLASS z2ui6_cl_core_srv_json IMPLEMENTATION.
ENDTRY.
ENDMETHOD.


METHOD response_abap_to_json.
TRY.

Expand All @@ -208,6 +224,7 @@ CLASS z2ui6_cl_core_srv_json IMPLEMENTATION.
ENDTRY.
ENDMETHOD.


METHOD z2ui6_if_ajson_filter~keep_node.

rv_keep = abap_true.
Expand Down
2 changes: 1 addition & 1 deletion src/01/02/z2ui6_if_core_types.intf.abap
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ INTERFACE z2ui6_if_core_types
END OF s_follow_up_action,
* handler_attrs TYPE ty_s_http_handler_attributes,
set_app_state_active TYPE abap_bool,
set_push_state TYPE abap_bool,
set_push_state TYPE string,
set_nav_back TYPE abap_bool,
s_stateful TYPE ty_s_http_res-s_stateful,
END OF ty_s_next_frontend.
Expand Down
19 changes: 13 additions & 6 deletions src/01/03/z2ui6_cl_app_app_js.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ CLASS z2ui6_cl_app_app_js IMPLEMENTATION.

result = `sap.ui.define(["sap/ui/core/mvc/Controller",` && |\n| &&
` "z2ui5/controller/View1.controller",` && |\n| &&
`], function (BaseController, Controller) {` && |\n| &&
` "z2ui5/cc/Server",` && |\n| &&
` "sap/ui/core/routing/HashChanger"` && |\n| &&
`], function (BaseController, Controller, Server, HashChanger) {` && |\n| &&
` return BaseController.extend("z2ui5.controller.App", {` && |\n| &&
`` && |\n| &&
` onInit() {` && |\n| &&
Expand All @@ -46,6 +48,12 @@ CLASS z2ui6_cl_app_app_js IMPLEMENTATION.
`` && |\n| &&
` z2ui5.checkNestAfter = false;` && |\n| &&
`` && |\n| &&
` // if (sap.ui.core.routing.HashChanger.getInstance().getHash().includes("z2ui5-xapp-state")){` && |\n| &&
` if (HashChanger.getInstance().getHash()){` && |\n| &&
` z2ui5.checkInit = true;` && |\n| &&
` Server.Roundtrip();` && |\n| &&
` }` && |\n| &&
`` && |\n| &&
` }` && |\n| &&
` });` && |\n| &&
`});` && |\n| &&
Expand Down Expand Up @@ -510,6 +518,8 @@ CLASS z2ui6_cl_app_app_js IMPLEMENTATION.
` defaultValue: "Upload"` && |\n| &&
` },` && |\n| &&
` enabled: {` && |\n| &&
|\n|.
result = result &&
` type: "boolean",` && |\n| &&
` defaultValue: true` && |\n| &&
` },` && |\n| &&
Expand All @@ -518,8 +528,6 @@ CLASS z2ui6_cl_app_app_js IMPLEMENTATION.
` defaultValue: "sap-icon://browse-folder"` && |\n| &&
` },` && |\n| &&
` iconOnly: {` && |\n| &&
|\n|.
result = result &&
` type: "boolean",` && |\n| &&
` defaultValue: false` && |\n| &&
` },` && |\n| &&
Expand Down Expand Up @@ -1012,6 +1020,8 @@ CLASS z2ui6_cl_app_app_js IMPLEMENTATION.
` DateCreateObject: (s) => new Date(s),` && |\n| &&
` // DateAbapTimestampToDate: (sTimestamp) => new sap.gantt.misc.Format.abapTimestampToDate(sTimestamp), commented for UI5 2.x compatibility` && |\n| &&
` DateAbapDateToDateObject: (d) => new Date(d.slice(0, 4), parseInt(d.slice(4, 6)) - 1, d.slice(6, 8)),` && |\n| &&
|\n|.
result = result &&
` DateAbapDateTimeToDateObject: (d, t = '000000') => new Date(d.slice(0, 4), parseInt(d.slice(4, 6)) - 1, d.slice(6, 8), t.slice(0, 2), t.slice(2, 4), t.slice(4, 6)),` && |\n| &&
` };` && |\n| &&
`}` && |\n| &&
Expand All @@ -1020,8 +1030,6 @@ CLASS z2ui6_cl_app_app_js IMPLEMENTATION.
` z2ui5.Util = Util;` && |\n| &&
`}` && |\n| &&
`);` && |\n| &&
|\n|.
result = result &&
`` && |\n| &&
`sap.ui.define("z2ui5/Favicon", ["sap/ui/core/Control"], (Control) => {` && |\n| &&
` "use strict";` && |\n| &&
Expand Down Expand Up @@ -1071,7 +1079,6 @@ CLASS z2ui6_cl_app_app_js IMPLEMENTATION.
` });` && |\n| &&
`}` && |\n| &&
`);` && |\n| &&
`` && |\n| &&
``.

ENDMETHOD.
Expand Down
17 changes: 9 additions & 8 deletions src/01/03/z2ui6_cl_app_component_js.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,23 @@ CLASS z2ui6_cl_app_component_js IMPLEMENTATION.
`], function (UIComponent, Models, Server, VersionInfo, DebugTool) {` && |\n| &&
` return UIComponent.extend("z2ui5.Component", {` && |\n| &&
` metadata: {` && |\n| &&
` manifest: "json"` && |\n| &&
` manifest: "json",` && |\n| &&
` interfaces: [` && |\n| &&
` "sap.ui.core.IAsyncContentCreation"` && |\n| &&
` ]` && |\n| &&
` },` && |\n| &&
` async init() {` && |\n| &&
` UIComponent.prototype.init.apply(this, arguments);` && |\n| &&
`` && |\n| &&
` if (typeof z2ui5 == 'undefined') {` && |\n| &&
` z2ui5 = {};` && |\n| &&
` }` && |\n| &&
` this.getRouter().initialize();` && |\n| &&
` z2ui5 = {};` && |\n| &&
`` && |\n| &&
` z2ui5.oRouter = this.getRouter();` && |\n| &&
` z2ui5.oRouter.initialize();` && |\n| &&
` z2ui5.oRouter.stop();` && |\n| &&
`` && |\n| &&
` z2ui5.oDeviceModel = Models.createDeviceModel();` && |\n| &&
` this.setModel(z2ui5.oDeviceModel, "device");` && |\n| &&
`` && |\n| &&
Expand Down Expand Up @@ -64,18 +71,13 @@ CLASS z2ui6_cl_app_component_js IMPLEMENTATION.
` }` && |\n| &&
` });` && |\n| &&
`` && |\n| &&
` // Handle forward/back buttons` && |\n| &&
` window.addEventListener("popstate", (event) => {` && |\n| &&
` delete event?.state?.response?.PARAMS?.SET_PUSH_STATE;` && |\n| &&
` delete event?.state?.response?.PARAMS?.SET_APP_STATE_ACTIVE;` && |\n| &&
` if (event?.state?.view) {` && |\n| &&
` z2ui5.oController.ViewDestroy();` && |\n| &&
` z2ui5.oResponse = event.state.response;` && |\n| &&
` z2ui5.oController.displayView(event.state.view, event.state.model);` && |\n| &&
` }else{` && |\n| &&
` let urlObj = new URL(window.location.href);` && |\n| &&
` urlObj.searchParams.delete("z2ui5-xapp-state");` && |\n| &&
` history.replaceState(null, null, urlObj.pathname + urlObj.search + urlObj.hash);` && |\n| &&
` }` && |\n| &&
` });` && |\n| &&
` },` && |\n| &&
Expand All @@ -96,7 +98,6 @@ CLASS z2ui6_cl_app_component_js IMPLEMENTATION.
` },` && |\n| &&
` });` && |\n| &&
`});` && |\n| &&
`` && |\n| &&
``.

ENDMETHOD.
Expand Down
8 changes: 4 additions & 4 deletions src/01/03/z2ui6_cl_app_server_js.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ CLASS z2ui6_cl_app_server_js IMPLEMENTATION.
` }` && |\n| &&
` };` && |\n| &&
`` && |\n| &&
` try{` && |\n| &&
` let oState = JSON.parse(JSON.stringify({ view: z2ui5.oView.mProperties.viewContent, model: z2ui5.oView.getModel().getData(), response: z2ui5.oResponse }));` && |\n| &&
` history.replaceState(oState, "", window.location.href );` && |\n| &&
` }catch(e){}` && |\n| &&
` // try{` && |\n| &&
` // let oState = JSON.parse(JSON.stringify({ view: z2ui5.oView.mProperties.viewContent, model: z2ui5.oView.getModel().getData(), response: z2ui5.oResponse }));` && |\n| &&
` // history.replaceState(oState, "", window.location.href );` && |\n| &&
` // }catch(e){}` && |\n| &&
`` && |\n| &&
` z2ui5.oBody ??= {};` && |\n| &&
` z2ui5.oBody.S_FRONT = {` && |\n| &&
Expand Down
65 changes: 51 additions & 14 deletions src/01/03/z2ui6_cl_app_view1_js.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ CLASS z2ui6_cl_app_view1_js IMPLEMENTATION.

result = `sap.ui.define(["sap/ui/core/mvc/Controller", "sap/ui/core/mvc/XMLView", "sap/ui/model/json/JSONModel",` && |\n| &&
` "sap/ui/core/BusyIndicator", "sap/m/MessageBox", "sap/m/MessageToast", "sap/ui/core/Fragment", "sap/m/BusyDialog",` && |\n| &&
` "sap/ui/VersionInfo", "z2ui5/cc/Server", "sap/ui/model/odata/v2/ODataModel", "sap/m/library"` && |\n| &&
` "sap/ui/VersionInfo", "z2ui5/cc/Server", "sap/ui/model/odata/v2/ODataModel", "sap/m/library", "sap/ui/core/routing/HashChanger"` && |\n| &&
`],` && |\n| &&
` function (Controller, XMLView, JSONModel, BusyIndicator, MessageBox, MessageToast, Fragment, mBusyDialog, VersionInfo,` && |\n| &&
` Server, ODataModel, mobileLibrary) {` && |\n| &&
` Server, ODataModel, mobileLibrary, HashChanger) {` && |\n| &&
` "use strict";` && |\n| &&
` return Controller.extend("z2ui5.controller.View1", {` && |\n| &&
`` && |\n| &&
Expand Down Expand Up @@ -77,20 +77,31 @@ CLASS z2ui6_cl_app_view1_js IMPLEMENTATION.
` }` && |\n| &&
`` && |\n| &&
` let oState = JSON.parse(JSON.stringify({ view: z2ui5.oView.mProperties.viewContent, model: z2ui5.oView.getModel().getData(), response: z2ui5.oResponse }));` && |\n| &&
` if (SET_PUSH_STATE) {` && |\n| &&
` history.pushState(oState, "", window.location.href );` && |\n| &&
` }else{` && |\n| &&
` if (SET_PUSH_STATE) {` && |\n| &&
` // sap.ui.core.routing.HashChanger.getInstance().setHash("423143124");` && |\n| &&
` // sap.ui.core.routing.HashChanger.getInstance().replaceHash("423143124");` && |\n| &&
` //history.go(-1);` && |\n| &&
` let urlObj = new URL(window.location.href);` && |\n| &&
` let hash = HashChanger.getInstance().getHash();` && |\n| &&
` if (!hash){` && |\n| &&
` hash = '#';` && |\n| &&
` }` && |\n| &&
` history.pushState(oState, "", urlObj.pathname + urlObj.search + hash + SET_PUSH_STATE);` && |\n| &&
` }else{` && |\n| &&
` // debugger;` && |\n| &&
` history.replaceState(oState, "", window.location.href );` && |\n| &&
` }` && |\n| &&
`` && |\n| &&
` if (SET_APP_STATE_ACTIVE) {` && |\n| &&
` let urlObj = new URL(window.location.href);` && |\n| &&
` urlObj.searchParams.set("z2ui5-xapp-state", z2ui5.oResponse.ID);` && |\n| &&
` history.replaceState(oState, null, urlObj.pathname + urlObj.search + urlObj.hash);` && |\n| &&
` HashChanger.getInstance().replaceHash("z2ui5-xapp-state=" + z2ui5.oResponse.ID );` && |\n| &&
` // let urlObj = new URL(window.location.href);` && |\n| &&
` // urlObj.searchParams.set("z2ui5-xapp-state", z2ui5.oResponse.ID);` && |\n| &&
` // history.replaceState(oState, null, urlObj.pathname + urlObj.search + urlObj.hash);` && |\n| &&
` } else {` && |\n| &&
` let urlObj = new URL(window.location.href);` && |\n| &&
` urlObj.searchParams.delete("z2ui5-xapp-state");` && |\n| &&
` history.replaceState(oState, null, urlObj.pathname + urlObj.search + urlObj.hash);` && |\n| &&
` HashChanger.getInstance().replaceHash("");` && |\n| &&
` // let urlObj = new URL(window.location.href);` && |\n| &&
` // urlObj.searchParams.delete("z2ui5-xapp-state");` && |\n| &&
` // history.replaceState(oState, null, urlObj.pathname + urlObj.search + urlObj.hash);` && |\n| &&
` }` && |\n| &&
`` && |\n| &&
`` && |\n| &&
Expand Down Expand Up @@ -288,6 +299,33 @@ CLASS z2ui6_cl_app_view1_js IMPLEMENTATION.
` case 'HISTORY_BACK':` && |\n| &&
` history.back();` && |\n| &&
` break;` && |\n| &&
` case 'CLIPBOARD_APP_STATE':` && |\n| &&
` function copyToClipboard(textToCopy) {` && |\n| &&
` if (navigator.clipboard && typeof navigator.clipboard.writeText === "function") {` && |\n| &&
` navigator.clipboard.writeText(textToCopy)` && |\n| &&
` .then(() => {` && |\n| &&
`` && |\n| &&
` })` && |\n| &&
` .catch(err => {` && |\n| &&
`` && |\n| &&
` });` && |\n| &&
` } else {` && |\n| &&
` const tempTextArea = document.createElement("textarea");` && |\n| &&
` tempTextArea.value = textToCopy;` && |\n| &&
` document.body.appendChild(tempTextArea);` && |\n| &&
`` && |\n| &&
` tempTextArea.select();` && |\n| &&
` try {` && |\n| &&
` document.execCommand("copy");` && |\n| &&
`` && |\n| &&
` } catch (err) {` && |\n| &&
`` && |\n| &&
` }` && |\n| &&
` document.body.removeChild(tempTextArea);` && |\n| &&
` }` && |\n| &&
` }` && |\n| &&
` copyToClipboard(window.location.href + '#/z2ui5-xapp-state=' + z2ui5.oResponse.ID );` && |\n| &&
` break;` && |\n| &&
` case 'SET_ODATA_MODEL':` && |\n| &&
` var oModel = new ODataModel({ serviceUrl: args[1], annotationURI: (args.length > 3 ? args[3] : '') });` && |\n| &&
` z2ui5.oView.setModel(oModel, args[2] ? args[2] : undefined);` && |\n| &&
Expand Down Expand Up @@ -480,6 +518,8 @@ CLASS z2ui6_cl_app_view1_js IMPLEMENTATION.
` if (params == undefined) {` && |\n| &&
` return;` && |\n| &&
` }` && |\n| &&
|\n|.
result = result &&
` if (params[msgType]?.TEXT !== undefined) {` && |\n| &&
` if (msgType === 'S_MSG_TOAST') {` && |\n| &&
` MessageToast.show(params[msgType].TEXT, {` && |\n| &&
Expand Down Expand Up @@ -518,8 +558,6 @@ CLASS z2ui6_cl_app_view1_js IMPLEMENTATION.
` }` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
|\n|.
result = result &&
` async displayView(xml, viewModel) {` && |\n| &&
` let oview_model = new JSONModel(viewModel);` && |\n| &&
` var oModel = oview_model;` && |\n| &&
Expand Down Expand Up @@ -551,7 +589,6 @@ CLASS z2ui6_cl_app_view1_js IMPLEMENTATION.
` },` && |\n| &&
` })` && |\n| &&
` });` && |\n| &&
`` && |\n| &&
``.

ENDMETHOD.
Expand Down
5 changes: 2 additions & 3 deletions src/02/01/z2ui6_cl_pop_input_val.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ CLASS z2ui6_cl_pop_input_val DEFINITION
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.

Expand Down Expand Up @@ -98,11 +97,11 @@ CLASS z2ui6_cl_pop_input_val IMPLEMENTATION.

CASE client->get( )-event.
WHEN `BUTTON_CONFIRM`.
check_result_confirmed = abap_true.
ms_result-check_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.
ms_result-check_confirmed = abap_false.
client->popup_destroy( ).
client->nav_app_leave( client->get_app( client->get( )-s_draft-id_prev_app_stack ) ).
ENDCASE.
Expand Down
Loading