mirror of
https://github.com/abap2UI5/abap2UI5.git
synced 2025-04-29 20:38:43 +08:00
update message box
This commit is contained in:
parent
db038379ff
commit
bd5c3cb045
|
@ -11,7 +11,7 @@ Set the correct backend system in the yamls <br>
|
|||
Replace "/sap/bc/z2ui5" with your endpoint in the manifest
|
||||
```
|
||||
npm i
|
||||
npm run start
|
||||
npm run start-noflp
|
||||
```
|
||||
|
||||
#### Before PR
|
||||
|
|
|
@ -1,432 +1,425 @@
|
|||
sap.ui.define(["sap/ui/core/mvc/Controller", "sap/ui/core/mvc/XMLView", "sap/ui/model/json/JSONModel",
|
||||
sap.ui.define(["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", "sap/m/BusyDialog",
|
||||
"sap/ui/VersionInfo", "z2ui5/cc/Server",
|
||||
],
|
||||
function(Controller, XMLView, JSONModel, BusyIndicator, MessageBox, MessageToast, Fragment, mBusyDialog, VersionInfo,
|
||||
Server ) {
|
||||
"use strict";
|
||||
return Controller.extend("z2ui5.controller.View1", {
|
||||
"sap/ui/VersionInfo", "z2ui5/cc/Server",
|
||||
],
|
||||
function (Controller, XMLView, JSONModel, BusyIndicator, MessageBox, MessageToast, Fragment, mBusyDialog, VersionInfo,
|
||||
Server) {
|
||||
"use strict";
|
||||
return Controller.extend("z2ui5.controller.View1", {
|
||||
|
||||
onInit (){
|
||||
onInit() {
|
||||
|
||||
z2ui5.oRouter.attachRouteMatched(function(oEvent) {
|
||||
z2ui5.checkInit = true;
|
||||
Server.Roundtrip();
|
||||
}, this);
|
||||
z2ui5.oRouter.attachRouteMatched(function (oEvent) {
|
||||
z2ui5.checkInit = true;
|
||||
Server.Roundtrip();
|
||||
}, this);
|
||||
|
||||
},
|
||||
async onAfterRendering() {
|
||||
},
|
||||
async onAfterRendering() {
|
||||
|
||||
if (!z2ui5.oResponse){
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if (!z2ui5.oResponse.PARAMS) {
|
||||
BusyIndicator.hide();
|
||||
z2ui5.isBusy = false;
|
||||
if (!z2ui5.oResponse) {
|
||||
return;
|
||||
}
|
||||
const {S_POPUP, S_VIEW_NEST, S_VIEW_NEST2, S_POPOVER} = z2ui5.oResponse.PARAMS;
|
||||
if (S_POPUP?.CHECK_DESTROY) {
|
||||
z2ui5.oController.PopupDestroy();
|
||||
|
||||
try {
|
||||
if (!z2ui5.oResponse.PARAMS) {
|
||||
BusyIndicator.hide();
|
||||
z2ui5.isBusy = false;
|
||||
return;
|
||||
}
|
||||
const { S_POPUP, S_VIEW_NEST, S_VIEW_NEST2, S_POPOVER } = z2ui5.oResponse.PARAMS;
|
||||
if (S_POPUP?.CHECK_DESTROY) {
|
||||
z2ui5.oController.PopupDestroy();
|
||||
}
|
||||
if (S_POPOVER?.CHECK_DESTROY) {
|
||||
z2ui5.oController.PopoverDestroy();
|
||||
}
|
||||
if (S_POPUP?.XML) {
|
||||
z2ui5.oController.PopupDestroy();
|
||||
await this.displayFragment(S_POPUP.XML, 'oViewPopup');
|
||||
}
|
||||
if (!z2ui5.checkNestAfter) {
|
||||
if (S_VIEW_NEST?.XML) {
|
||||
z2ui5.oController.NestViewDestroy();
|
||||
await this.displayNestedView(S_VIEW_NEST.XML, 'oViewNest', 'S_VIEW_NEST');
|
||||
z2ui5.checkNestAfter = true;
|
||||
}
|
||||
}
|
||||
if (!z2ui5.checkNestAfter2) {
|
||||
if (S_VIEW_NEST2?.XML) {
|
||||
z2ui5.oController.NestViewDestroy2();
|
||||
await this.displayNestedView2(S_VIEW_NEST2.XML, 'oViewNest2', 'S_VIEW_NEST2');
|
||||
z2ui5.checkNestAfter2 = true;
|
||||
}
|
||||
}
|
||||
if (S_POPOVER?.XML) {
|
||||
await this.displayPopover(S_POPOVER.XML, 'oViewPopover', S_POPOVER.OPEN_BY_ID);
|
||||
}
|
||||
BusyIndicator.hide();
|
||||
z2ui5.isBusy = false;
|
||||
z2ui5.onAfterRendering.forEach(item => {
|
||||
if (item !== undefined) {
|
||||
item();
|
||||
}
|
||||
}
|
||||
)
|
||||
} catch (e) {
|
||||
BusyIndicator.hide();
|
||||
z2ui5.isBusy = false;
|
||||
MessageBox.error(e.toLocaleString(), {
|
||||
title: "Unexpected Error Occured - App Terminated",
|
||||
actions: [],
|
||||
onClose: () => {
|
||||
new mBusyDialog({
|
||||
text: "Please Restart the App"
|
||||
}).open();
|
||||
}
|
||||
})
|
||||
}
|
||||
if (S_POPOVER?.CHECK_DESTROY) {
|
||||
z2ui5.oController.PopoverDestroy();
|
||||
},
|
||||
async displayFragment(xml, viewProp) {
|
||||
let oview_model = new JSONModel(z2ui5.oResponse.OVIEWMODEL);
|
||||
const oFragment = await Fragment.load({
|
||||
definition: xml,
|
||||
controller: z2ui5.oControllerPopup,
|
||||
id: "popupId"
|
||||
});
|
||||
oFragment.setModel(oview_model);
|
||||
z2ui5[viewProp] = oFragment;
|
||||
z2ui5[viewProp].Fragment = Fragment;
|
||||
oFragment.open();
|
||||
},
|
||||
async displayPopover(xml, viewProp, openById) {
|
||||
sap.ui.require(["sap/ui/core/Element"], async function (Element) {
|
||||
const oFragment = await Fragment.load({
|
||||
definition: xml,
|
||||
controller: z2ui5.oControllerPopover,
|
||||
id: "popoverId"
|
||||
});
|
||||
let oview_model = new JSONModel(z2ui5.oResponse.OVIEWMODEL);
|
||||
oFragment.setModel(oview_model);
|
||||
z2ui5[viewProp] = oFragment;
|
||||
z2ui5[viewProp].Fragment = Fragment;
|
||||
let oControl = {};
|
||||
if (z2ui5.oView?.byId(openById)) {
|
||||
oControl = z2ui5.oView.byId(openById);
|
||||
} else if (z2ui5.oViewPopup?.Fragment.byId('popupId', openById)) {
|
||||
oControl = z2ui5.oViewPopup.Fragment.byId('popupId', openById);
|
||||
} else if (z2ui5.oViewNest?.byId(openById)) {
|
||||
oControl = z2ui5.oViewNest.byId(openById);
|
||||
} else if (z2ui5.oViewNest2?.byId(openById)) {
|
||||
oControl = z2ui5.oViewNest2.byId(openById);
|
||||
} else {
|
||||
if (sapUiCore.byId(openById)) {
|
||||
// oControl = sapUiCore.byId(openById);
|
||||
oControl = Element.getElementById(openById);
|
||||
} else {
|
||||
oControl = null;
|
||||
}
|
||||
;
|
||||
}
|
||||
oFragment.openBy(oControl);
|
||||
});
|
||||
},
|
||||
async displayNestedView(xml, viewProp, viewNestId) {
|
||||
let oview_model = new JSONModel(z2ui5.oResponse.OVIEWMODEL);
|
||||
const oView = await XMLView.create({
|
||||
definition: xml,
|
||||
controller: z2ui5.oControllerNest,
|
||||
preprocessors: {
|
||||
xml: {
|
||||
models: {
|
||||
template: oview_model
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
oView.setModel(oview_model);
|
||||
let oParent = z2ui5.oView.byId(z2ui5.oResponse.PARAMS[viewNestId].ID);
|
||||
if (oParent) {
|
||||
try {
|
||||
oParent[z2ui5.oResponse.PARAMS[viewNestId].METHOD_DESTROY]();
|
||||
} catch { }
|
||||
oParent[z2ui5.oResponse.PARAMS[viewNestId].METHOD_INSERT](oView);
|
||||
}
|
||||
if (S_POPUP?.XML) {
|
||||
z2ui5.oController.PopupDestroy();
|
||||
await this.displayFragment(S_POPUP.XML, 'oViewPopup');
|
||||
z2ui5[viewProp] = oView;
|
||||
},
|
||||
async displayNestedView2(xml, viewProp, viewNestId) {
|
||||
let oview_model = new JSONModel(z2ui5.oResponse.OVIEWMODEL);
|
||||
const oView = await XMLView.create({
|
||||
definition: xml,
|
||||
controller: z2ui5.oControllerNest2,
|
||||
preprocessors: {
|
||||
xml: {
|
||||
models: {
|
||||
template: oview_model
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
oView.setModel(oview_model);
|
||||
let oParent = z2ui5.oView.byId(z2ui5.oResponse.PARAMS[viewNestId].ID);
|
||||
if (oParent) {
|
||||
try {
|
||||
oParent[z2ui5.oResponse.PARAMS[viewNestId].METHOD_DESTROY]();
|
||||
} catch { }
|
||||
oParent[z2ui5.oResponse.PARAMS[viewNestId].METHOD_INSERT](oView);
|
||||
}
|
||||
if (!z2ui5.checkNestAfter) {
|
||||
if (S_VIEW_NEST?.XML) {
|
||||
z2ui5.oController.NestViewDestroy();
|
||||
await this.displayNestedView(S_VIEW_NEST.XML, 'oViewNest', 'S_VIEW_NEST');
|
||||
z2ui5.checkNestAfter = true;
|
||||
z2ui5[viewProp] = oView;
|
||||
},
|
||||
PopupDestroy() {
|
||||
if (!z2ui5.oViewPopup) {
|
||||
return;
|
||||
}
|
||||
if (z2ui5.oViewPopup.close) {
|
||||
try {
|
||||
z2ui5.oViewPopup.close();
|
||||
} catch { }
|
||||
}
|
||||
z2ui5.oViewPopup.destroy();
|
||||
},
|
||||
PopoverDestroy() {
|
||||
if (!z2ui5.oViewPopover) {
|
||||
return;
|
||||
}
|
||||
if (z2ui5.oViewPopover.close) {
|
||||
try {
|
||||
z2ui5.oViewPopover.close();
|
||||
} catch { }
|
||||
}
|
||||
z2ui5.oViewPopover.destroy();
|
||||
},
|
||||
NestViewDestroy() {
|
||||
if (!z2ui5.oViewNest) {
|
||||
return;
|
||||
}
|
||||
z2ui5.oViewNest.destroy();
|
||||
},
|
||||
NestViewDestroy2() {
|
||||
if (!z2ui5.oViewNest2) {
|
||||
return;
|
||||
}
|
||||
z2ui5.oViewNest2.destroy();
|
||||
},
|
||||
ViewDestroy() {
|
||||
if (!z2ui5.oView) {
|
||||
return;
|
||||
}
|
||||
z2ui5.oView.destroy();
|
||||
},
|
||||
eF(...args) {
|
||||
|
||||
z2ui5.onBeforeEventFrontend.forEach(item => {
|
||||
if (item !== undefined) {
|
||||
item(args);
|
||||
}
|
||||
}
|
||||
if (!z2ui5.checkNestAfter2) {
|
||||
if (S_VIEW_NEST2?.XML) {
|
||||
z2ui5.oController.NestViewDestroy2();
|
||||
await this.displayNestedView2(S_VIEW_NEST2.XML, 'oViewNest2', 'S_VIEW_NEST2');
|
||||
z2ui5.checkNestAfter2 = true;
|
||||
)
|
||||
let oCrossAppNavigator;
|
||||
switch (args[0]) {
|
||||
case 'SET_SIZE_LIMIT':
|
||||
switch (args[2]) {
|
||||
case 'MAIN':
|
||||
z2ui5.oView.getModel().setSizeLimit(parseInt(args[1]));
|
||||
z2ui5.oView.getModel().refresh(true);
|
||||
break;
|
||||
case 'NEST':
|
||||
z2ui5.oViewNest.getModel().setSizeLimit(parseInt(args[1]));
|
||||
z2ui5.oViewNest.getModel().refresh(true);
|
||||
break;
|
||||
case 'NEST2':
|
||||
z2ui5.oViewNest2.getModel().setSizeLimit(parseInt(args[1]));
|
||||
z2ui5.oViewNest2.getModel().refresh(true);
|
||||
break;
|
||||
case 'POPUP':
|
||||
z2ui5.oPopup.getModel().setSizeLimit(parseInt(args[1]));
|
||||
z2ui5.oPopup.getModel().refresh(true);
|
||||
break;
|
||||
case 'POPOVER':
|
||||
z2ui5.oPopover.getModel().setSizeLimit(parseInt(args[1]));
|
||||
z2ui5.oPopover.getModel().refresh(true);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'DOWNLOAD_B64_FILE':
|
||||
var a = document.createElement("a");
|
||||
a.href = args[1];
|
||||
a.download = args[2];
|
||||
a.click();
|
||||
break;
|
||||
case 'CROSS_APP_NAV_TO_PREV_APP':
|
||||
// oCrossAppNavigator = Container.getService("CrossApplicationNavigation");
|
||||
oCrossAppNavigator = sap.ushell.Container.getService("CrossApplicationNavigation");
|
||||
oCrossAppNavigator.backToPreviousApp();
|
||||
break;
|
||||
case 'CROSS_APP_NAV_TO_EXT':
|
||||
// oCrossAppNavigator = Container.getService("CrossApplicationNavigation");
|
||||
oCrossAppNavigator = sap.ushell.Container.getService("CrossApplicationNavigation");
|
||||
const hash = (oCrossAppNavigator.hrefForExternal({
|
||||
target: args[1],
|
||||
params: args[2]
|
||||
})) || "";
|
||||
if (args[3] === 'EXT') {
|
||||
let url = window.location.href.split('#')[0] + hash;
|
||||
//todo
|
||||
//URLHelper.redirect(url, true);
|
||||
} else {
|
||||
oCrossAppNavigator.toExternal({
|
||||
target: {
|
||||
shellHash: hash
|
||||
}
|
||||
});
|
||||
}
|
||||
break;
|
||||
case 'LOCATION_RELOAD':
|
||||
window.location = args[1];
|
||||
break;
|
||||
case 'OPEN_NEW_TAB':
|
||||
window.open(args[1], '_blank');
|
||||
break;
|
||||
case 'POPUP_CLOSE':
|
||||
z2ui5.oController.PopupDestroy();
|
||||
break;
|
||||
case 'POPOVER_CLOSE':
|
||||
z2ui5.oController.PopoverDestroy();
|
||||
break;
|
||||
case 'NAV_CONTAINER_TO':
|
||||
var navCon = z2ui5.oView.byId(args[1]);
|
||||
var navConTo = z2ui5.oView.byId(args[2]);
|
||||
navCon.to(navConTo);
|
||||
break;
|
||||
case 'NEST_NAV_CONTAINER_TO':
|
||||
navCon = z2ui5.oViewNest.byId(args[1]);
|
||||
navConTo = z2ui5.oViewNest.byId(args[2]);
|
||||
navCon.to(navConTo);
|
||||
break;
|
||||
case 'NEST2_NAV_CONTAINER_TO':
|
||||
navCon = z2ui5.oViewNest2.byId(args[1]);
|
||||
navConTo = z2ui5.oViewNest2.byId(args[2]);
|
||||
navCon.to(navConTo);
|
||||
break;
|
||||
case 'POPUP_NAV_CONTAINER_TO':
|
||||
navCon = Fragment.byId("popupId", args[1]);
|
||||
navConTo = Fragment.byId("popupId", args[2]);
|
||||
navCon.to(navConTo);
|
||||
break;
|
||||
}
|
||||
},
|
||||
eB(...args) {
|
||||
|
||||
if (!window.navigator.onLine) {
|
||||
MessageBox.alert('No internet connection! Please reconnect to the server and try again.');
|
||||
return;
|
||||
}
|
||||
if (z2ui5.isBusy == true) {
|
||||
if (!args[0][2]) {
|
||||
let oBusyDialog = new mBusyDialog();
|
||||
oBusyDialog.open();
|
||||
setTimeout((oBusyDialog) => {
|
||||
oBusyDialog.close()
|
||||
}
|
||||
, 100, oBusyDialog);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (S_POPOVER?.XML) {
|
||||
await this.displayPopover(S_POPOVER.XML, 'oViewPopover', S_POPOVER.OPEN_BY_ID);
|
||||
z2ui5.isBusy = true;
|
||||
BusyIndicator.show();
|
||||
z2ui5.oBody = {};
|
||||
if (args[0][3]) {
|
||||
z2ui5.oBody.XX = z2ui5.oView.getModel().getData().XX;
|
||||
z2ui5.oBody.VIEWNAME = 'MAIN';
|
||||
} else if (z2ui5.oController == this) {
|
||||
z2ui5.oBody.XX = z2ui5.oView.getModel().getData().XX;
|
||||
z2ui5.oBody.VIEWNAME = 'MAIN';
|
||||
} else if (z2ui5.oControllerPopup == this) {
|
||||
if (z2ui5.oViewPopup) {
|
||||
z2ui5.oBody.XX = z2ui5.oViewPopup.getModel().getData().XX;
|
||||
}
|
||||
z2ui5.oBody.VIEWNAME = 'MAIN';
|
||||
} else if (z2ui5.oControllerPopover == this) {
|
||||
z2ui5.oBody.XX = z2ui5.oViewPopover.getModel().getData().XX;
|
||||
z2ui5.oBody.VIEWNAME = 'MAIN';
|
||||
} else if (z2ui5.oControllerNest == this) {
|
||||
z2ui5.oBody.XX = z2ui5.oViewNest.getModel().getData().XX;
|
||||
z2ui5.oBody.VIEWNAME = 'NEST';
|
||||
} else if (z2ui5.oControllerNest2 == this) {
|
||||
z2ui5.oBody.XX = z2ui5.oViewNest2.getModel().getData().XX;
|
||||
z2ui5.oBody.VIEWNAME = 'NEST2';
|
||||
}
|
||||
BusyIndicator.hide();
|
||||
z2ui5.isBusy = false;
|
||||
z2ui5.onAfterRendering.forEach(item => {
|
||||
z2ui5.onBeforeRoundtrip.forEach(item => {
|
||||
if (item !== undefined) {
|
||||
item();
|
||||
}
|
||||
}
|
||||
)
|
||||
} catch (e) {
|
||||
BusyIndicator.hide();
|
||||
z2ui5.isBusy = false;
|
||||
MessageBox.error(e.toLocaleString(), {
|
||||
title: "Unexpected Error Occured - App Terminated",
|
||||
actions: [],
|
||||
onClose: () => {
|
||||
new mBusyDialog({
|
||||
text: "Please Restart the App"
|
||||
}).open();
|
||||
// if (args[0][1]) {
|
||||
// z2ui5.oController.ViewDestroy();
|
||||
// }
|
||||
z2ui5.oBody.ID = z2ui5.oResponse.ID;
|
||||
z2ui5.oBody.ARGUMENTS = args;
|
||||
z2ui5.oBody.ARGUMENTS.forEach((item, i) => {
|
||||
if (i == 0) {
|
||||
return;
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
async displayFragment(xml, viewProp) {
|
||||
let oview_model = new JSONModel(z2ui5.oResponse.OVIEWMODEL);
|
||||
const oFragment = await Fragment.load({
|
||||
definition: xml,
|
||||
controller: z2ui5.oControllerPopup,
|
||||
id: "popupId"
|
||||
});
|
||||
oFragment.setModel(oview_model);
|
||||
z2ui5[viewProp] = oFragment;
|
||||
z2ui5[viewProp].Fragment = Fragment;
|
||||
oFragment.open();
|
||||
},
|
||||
async displayPopover(xml, viewProp, openById) {
|
||||
sap.ui.require(["sap/ui/core/Element"], async function(Element) {
|
||||
const oFragment = await Fragment.load({
|
||||
definition: xml,
|
||||
controller: z2ui5.oControllerPopover,
|
||||
id: "popoverId"
|
||||
});
|
||||
let oview_model = new JSONModel(z2ui5.oResponse.OVIEWMODEL);
|
||||
oFragment.setModel(oview_model);
|
||||
z2ui5[viewProp] = oFragment;
|
||||
z2ui5[viewProp].Fragment = Fragment;
|
||||
let oControl = {};
|
||||
if (z2ui5.oView?.byId(openById)) {
|
||||
oControl = z2ui5.oView.byId(openById);
|
||||
} else if (z2ui5.oViewPopup?.Fragment.byId('popupId', openById)) {
|
||||
oControl = z2ui5.oViewPopup.Fragment.byId('popupId', openById);
|
||||
} else if (z2ui5.oViewNest?.byId(openById)) {
|
||||
oControl = z2ui5.oViewNest.byId(openById);
|
||||
} else if (z2ui5.oViewNest2?.byId(openById)) {
|
||||
oControl = z2ui5.oViewNest2.byId(openById);
|
||||
} else {
|
||||
if (sapUiCore.byId(openById)) {
|
||||
// oControl = sapUiCore.byId(openById);
|
||||
oControl = Element.getElementById(openById);
|
||||
} else {
|
||||
oControl = null;
|
||||
if (typeof item === 'object') {
|
||||
z2ui5.oBody.ARGUMENTS[i] = JSON.stringify(item);
|
||||
}
|
||||
}
|
||||
);
|
||||
z2ui5.oResponseOld = z2ui5.oResponse;
|
||||
Server.Roundtrip();
|
||||
|
||||
},
|
||||
|
||||
updateModelIfRequired(paramKey, oView) {
|
||||
if (z2ui5.oResponse.PARAMS == undefined) {
|
||||
return;
|
||||
}
|
||||
if (z2ui5.oResponse.PARAMS[paramKey]?.CHECK_UPDATE_MODEL) {
|
||||
let model = new JSONModel(z2ui5.oResponse.OVIEWMODEL);
|
||||
if (oView) {
|
||||
oView.setModel(model);
|
||||
}
|
||||
}
|
||||
},
|
||||
async checkSDKcompatibility(err) {
|
||||
let oCurrentVersionInfo = await VersionInfo.load();
|
||||
var ui5_sdk = oCurrentVersionInfo.gav.includes('com.sap.ui5') ? true : false;
|
||||
if (!ui5_sdk) {
|
||||
if (err) {
|
||||
MessageBox.error("openui5 SDK is loaded, module: " + err._modules + " is not availabe in openui5");
|
||||
return;
|
||||
}
|
||||
;
|
||||
}
|
||||
oFragment.openBy(oControl);
|
||||
});
|
||||
},
|
||||
async displayNestedView(xml, viewProp, viewNestId) {
|
||||
let oview_model = new JSONModel(z2ui5.oResponse.OVIEWMODEL);
|
||||
const oView = await XMLView.create({
|
||||
definition: xml,
|
||||
controller: z2ui5.oControllerNest,
|
||||
preprocessors: {
|
||||
xml: {
|
||||
models: {
|
||||
template: oview_model
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
oView.setModel(oview_model);
|
||||
let oParent = z2ui5.oView.byId(z2ui5.oResponse.PARAMS[viewNestId].ID);
|
||||
if (oParent) {
|
||||
try {
|
||||
oParent[z2ui5.oResponse.PARAMS[viewNestId].METHOD_DESTROY]();
|
||||
} catch {}
|
||||
oParent[z2ui5.oResponse.PARAMS[viewNestId].METHOD_INSERT](oView);
|
||||
}
|
||||
z2ui5[viewProp] = oView;
|
||||
},
|
||||
async displayNestedView2(xml, viewProp, viewNestId) {
|
||||
let oview_model = new JSONModel(z2ui5.oResponse.OVIEWMODEL);
|
||||
const oView = await XMLView.create({
|
||||
definition: xml,
|
||||
controller: z2ui5.oControllerNest2,
|
||||
preprocessors: {
|
||||
xml: {
|
||||
models: {
|
||||
template: oview_model
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
oView.setModel(oview_model);
|
||||
let oParent = z2ui5.oView.byId(z2ui5.oResponse.PARAMS[viewNestId].ID);
|
||||
if (oParent) {
|
||||
try {
|
||||
oParent[z2ui5.oResponse.PARAMS[viewNestId].METHOD_DESTROY]();
|
||||
} catch {}
|
||||
oParent[z2ui5.oResponse.PARAMS[viewNestId].METHOD_INSERT](oView);
|
||||
}
|
||||
z2ui5[viewProp] = oView;
|
||||
},
|
||||
PopupDestroy() {
|
||||
if (!z2ui5.oViewPopup) {
|
||||
return;
|
||||
}
|
||||
if (z2ui5.oViewPopup.close) {
|
||||
try {
|
||||
z2ui5.oViewPopup.close();
|
||||
} catch {}
|
||||
}
|
||||
z2ui5.oViewPopup.destroy();
|
||||
},
|
||||
PopoverDestroy() {
|
||||
if (!z2ui5.oViewPopover) {
|
||||
return;
|
||||
}
|
||||
if (z2ui5.oViewPopover.close) {
|
||||
try {
|
||||
z2ui5.oViewPopover.close();
|
||||
} catch {}
|
||||
}
|
||||
z2ui5.oViewPopover.destroy();
|
||||
},
|
||||
NestViewDestroy() {
|
||||
if (!z2ui5.oViewNest) {
|
||||
return;
|
||||
}
|
||||
z2ui5.oViewNest.destroy();
|
||||
},
|
||||
NestViewDestroy2() {
|
||||
if (!z2ui5.oViewNest2) {
|
||||
return;
|
||||
}
|
||||
z2ui5.oViewNest2.destroy();
|
||||
},
|
||||
ViewDestroy() {
|
||||
if (!z2ui5.oView) {
|
||||
return;
|
||||
}
|
||||
z2ui5.oView.destroy();
|
||||
},
|
||||
eF(...args) {
|
||||
|
||||
z2ui5.onBeforeEventFrontend.forEach(item => {
|
||||
if (item !== undefined) {
|
||||
item(args);
|
||||
}
|
||||
}
|
||||
)
|
||||
let oCrossAppNavigator;
|
||||
switch (args[0]) {
|
||||
case 'SET_SIZE_LIMIT':
|
||||
switch (args[2]) {
|
||||
case 'MAIN':
|
||||
z2ui5.oView.getModel().setSizeLimit(parseInt(args[1]));
|
||||
z2ui5.oView.getModel().refresh(true);
|
||||
break;
|
||||
case 'NEST':
|
||||
z2ui5.oViewNest.getModel().setSizeLimit(parseInt(args[1]));
|
||||
z2ui5.oViewNest.getModel().refresh(true);
|
||||
break;
|
||||
case 'NEST2':
|
||||
z2ui5.oViewNest2.getModel().setSizeLimit(parseInt(args[1]));
|
||||
z2ui5.oViewNest2.getModel().refresh(true);
|
||||
break;
|
||||
case 'POPUP':
|
||||
z2ui5.oPopup.getModel().setSizeLimit(parseInt(args[1]));
|
||||
z2ui5.oPopup.getModel().refresh(true);
|
||||
break;
|
||||
case 'POPOVER':
|
||||
z2ui5.oPopover.getModel().setSizeLimit(parseInt(args[1]));
|
||||
z2ui5.oPopover.getModel().refresh(true);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'DOWNLOAD_B64_FILE':
|
||||
var a = document.createElement("a");
|
||||
a.href = args[1];
|
||||
a.download = args[2];
|
||||
a.click();
|
||||
break;
|
||||
case 'CROSS_APP_NAV_TO_PREV_APP':
|
||||
// oCrossAppNavigator = Container.getService("CrossApplicationNavigation");
|
||||
oCrossAppNavigator = sap.ushell.Container.getService("CrossApplicationNavigation");
|
||||
oCrossAppNavigator.backToPreviousApp();
|
||||
break;
|
||||
case 'CROSS_APP_NAV_TO_EXT':
|
||||
// oCrossAppNavigator = Container.getService("CrossApplicationNavigation");
|
||||
oCrossAppNavigator = sap.ushell.Container.getService("CrossApplicationNavigation");
|
||||
const hash = (oCrossAppNavigator.hrefForExternal({
|
||||
target: args[1],
|
||||
params: args[2]
|
||||
})) || "";
|
||||
if (args[3] === 'EXT') {
|
||||
let url = window.location.href.split('#')[0] + hash;
|
||||
//todo
|
||||
//URLHelper.redirect(url, true);
|
||||
} else {
|
||||
oCrossAppNavigator.toExternal({
|
||||
target: {
|
||||
shellHash: hash
|
||||
}
|
||||
});
|
||||
}
|
||||
break;
|
||||
case 'LOCATION_RELOAD':
|
||||
window.location = args[1];
|
||||
break;
|
||||
case 'OPEN_NEW_TAB':
|
||||
window.open(args[1], '_blank');
|
||||
break;
|
||||
case 'POPUP_CLOSE':
|
||||
z2ui5.oController.PopupDestroy();
|
||||
break;
|
||||
case 'POPOVER_CLOSE':
|
||||
z2ui5.oController.PopoverDestroy();
|
||||
break;
|
||||
case 'NAV_CONTAINER_TO':
|
||||
var navCon = z2ui5.oView.byId(args[1]);
|
||||
var navConTo = z2ui5.oView.byId(args[2]);
|
||||
navCon.to(navConTo);
|
||||
break;
|
||||
case 'NEST_NAV_CONTAINER_TO':
|
||||
navCon = z2ui5.oViewNest.byId(args[1]);
|
||||
navConTo = z2ui5.oViewNest.byId(args[2]);
|
||||
navCon.to(navConTo);
|
||||
break;
|
||||
case 'NEST2_NAV_CONTAINER_TO':
|
||||
navCon = z2ui5.oViewNest2.byId(args[1]);
|
||||
navConTo = z2ui5.oViewNest2.byId(args[2]);
|
||||
navCon.to(navConTo);
|
||||
break;
|
||||
case 'POPUP_NAV_CONTAINER_TO':
|
||||
navCon = Fragment.byId("popupId", args[1]);
|
||||
navConTo = Fragment.byId("popupId", args[2]);
|
||||
navCon.to(navConTo);
|
||||
break;
|
||||
}
|
||||
},
|
||||
eB(...args) {
|
||||
|
||||
// var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
|
||||
//debugger;
|
||||
// z2ui5.oRouter.navTo("RouteView2");
|
||||
// return;
|
||||
|
||||
if (!window.navigator.onLine) {
|
||||
MessageBox.alert('No internet connection! Please reconnect to the server and try again.');
|
||||
return;
|
||||
}
|
||||
if (z2ui5.isBusy == true) {
|
||||
if (!args[0][2]) {
|
||||
let oBusyDialog = new mBusyDialog();
|
||||
oBusyDialog.open();
|
||||
setTimeout( (oBusyDialog) => {
|
||||
oBusyDialog.close()
|
||||
}
|
||||
, 100, oBusyDialog);
|
||||
; MessageBox.error(err.toLocaleString());
|
||||
},
|
||||
showMessage(msgType, params) {
|
||||
if (params == undefined) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
z2ui5.isBusy = true;
|
||||
BusyIndicator.show();
|
||||
z2ui5.oBody = {};
|
||||
if (args[0][3]) {
|
||||
z2ui5.oBody.XX = z2ui5.oView.getModel().getData().XX;
|
||||
z2ui5.oBody.VIEWNAME = 'MAIN';
|
||||
} else if (z2ui5.oController == this) {
|
||||
z2ui5.oBody.XX = z2ui5.oView.getModel().getData().XX;
|
||||
z2ui5.oBody.VIEWNAME = 'MAIN';
|
||||
} else if (z2ui5.oControllerPopup == this) {
|
||||
if (z2ui5.oViewPopup) {
|
||||
z2ui5.oBody.XX = z2ui5.oViewPopup.getModel().getData().XX;
|
||||
}
|
||||
z2ui5.oBody.VIEWNAME = 'MAIN';
|
||||
} else if (z2ui5.oControllerPopover == this) {
|
||||
z2ui5.oBody.XX = z2ui5.oViewPopover.getModel().getData().XX;
|
||||
z2ui5.oBody.VIEWNAME = 'MAIN';
|
||||
} else if (z2ui5.oControllerNest == this) {
|
||||
z2ui5.oBody.XX = z2ui5.oViewNest.getModel().getData().XX;
|
||||
z2ui5.oBody.VIEWNAME = 'NEST';
|
||||
} else if (z2ui5.oControllerNest2 == this) {
|
||||
z2ui5.oBody.XX = z2ui5.oViewNest2.getModel().getData().XX;
|
||||
z2ui5.oBody.VIEWNAME = 'NEST2';
|
||||
}
|
||||
z2ui5.onBeforeRoundtrip.forEach(item => {
|
||||
if (item !== undefined) {
|
||||
item();
|
||||
}
|
||||
}
|
||||
)
|
||||
if (args[0][1]) {
|
||||
z2ui5.oController.ViewDestroy();
|
||||
}
|
||||
z2ui5.oBody.ID = z2ui5.oResponse.ID;
|
||||
z2ui5.oBody.ARGUMENTS = args;
|
||||
z2ui5.oBody.ARGUMENTS.forEach( (item, i) => {
|
||||
if (i == 0) {
|
||||
return;
|
||||
}
|
||||
if (typeof item === 'object') {
|
||||
z2ui5.oBody.ARGUMENTS[i] = JSON.stringify(item);
|
||||
}
|
||||
}
|
||||
);
|
||||
z2ui5.oResponseOld = z2ui5.oResponse;
|
||||
Server.Roundtrip();
|
||||
|
||||
},
|
||||
|
||||
updateModelIfRequired(paramKey, oView) {
|
||||
if (z2ui5.oResponse.PARAMS == undefined) {
|
||||
return;
|
||||
}
|
||||
if (z2ui5.oResponse.PARAMS[paramKey]?.CHECK_UPDATE_MODEL) {
|
||||
let model = new JSONModel(z2ui5.oResponse.OVIEWMODEL);
|
||||
if (oView) {
|
||||
oView.setModel(model);
|
||||
}
|
||||
}
|
||||
},
|
||||
async checkSDKcompatibility(err) {
|
||||
let oCurrentVersionInfo = await VersionInfo.load();
|
||||
var ui5_sdk = oCurrentVersionInfo.gav.includes('com.sap.ui5') ? true : false;
|
||||
if (!ui5_sdk) {
|
||||
if (err) {
|
||||
MessageBox.error("openui5 SDK is loaded, module: " + err._modules + " is not availabe in openui5");
|
||||
return;
|
||||
}
|
||||
;
|
||||
}
|
||||
;MessageBox.error(err.toLocaleString());
|
||||
},
|
||||
showMessage(msgType, params) {
|
||||
if (params == undefined) {
|
||||
return;
|
||||
}
|
||||
if (params[msgType]?.TEXT !== undefined) {
|
||||
if (msgType === 'S_MSG_TOAST') {
|
||||
MessageToast.show(params[msgType].TEXT, {
|
||||
duration: params[msgType].DURATION ? parseInt(params[msgType].DURATION) : 3000,
|
||||
width: params[msgType].WIDTH ? params[msgType].WIDTH : '15em',
|
||||
onClose: params[msgType].ONCLOSE ? params[msgType].ONCLOSE : null,
|
||||
autoClose: params[msgType].AUTOCLOSE ? true : false,
|
||||
animationTimingFunction: params[msgType].ANIMATIONTIMINGFUNCTION ? params[msgType].ANIMATIONTIMINGFUNCTION : 'ease',
|
||||
animationDuration: params[msgType].ANIMATIONDURATION ? parseInt(params[msgType].ANIMATIONDURATION) : 1000,
|
||||
closeonBrowserNavigation: params[msgType].CLOSEONBROWSERNAVIGATION ? true : false
|
||||
});
|
||||
if (params[msgType].CLASS) {
|
||||
let mtoast = {};
|
||||
mtoast = document.getElementsByClassName("sapMMessageToast")[0];
|
||||
if (mtoast) {
|
||||
mtoast.classList.add(params[msgType].CLASS);
|
||||
if (params[msgType]?.TEXT !== undefined) {
|
||||
if (msgType === 'S_MSG_TOAST') {
|
||||
MessageToast.show(params[msgType].TEXT, {
|
||||
duration: params[msgType].DURATION ? parseInt(params[msgType].DURATION) : 3000,
|
||||
width: params[msgType].WIDTH ? params[msgType].WIDTH : '15em',
|
||||
onClose: params[msgType].ONCLOSE ? params[msgType].ONCLOSE : null,
|
||||
autoClose: params[msgType].AUTOCLOSE ? true : false,
|
||||
animationTimingFunction: params[msgType].ANIMATIONTIMINGFUNCTION ? params[msgType].ANIMATIONTIMINGFUNCTION : 'ease',
|
||||
animationDuration: params[msgType].ANIMATIONDURATION ? parseInt(params[msgType].ANIMATIONDURATION) : 1000,
|
||||
closeonBrowserNavigation: params[msgType].CLOSEONBROWSERNAVIGATION ? true : false
|
||||
});
|
||||
if (params[msgType].CLASS) {
|
||||
let mtoast = {};
|
||||
mtoast = document.getElementsByClassName("sapMMessageToast")[0];
|
||||
if (mtoast) {
|
||||
mtoast.classList.add(params[msgType].CLASS);
|
||||
}
|
||||
}
|
||||
}
|
||||
;
|
||||
} else if (msgType === 'S_MSG_BOX') {
|
||||
if (params[msgType].TYPE) {
|
||||
MessageBox[params[msgType].TYPE](params[msgType].TEXT);
|
||||
} else {
|
||||
MessageBox.show(params[msgType].TEXT, {
|
||||
;
|
||||
} else if (msgType === 'S_MSG_BOX') {
|
||||
|
||||
let oParams = {
|
||||
styleClass: params[msgType].STYLECLASS ? params[msgType].STYLECLASS : '',
|
||||
title: params[msgType].TITLE ? params[msgType].TITLE : '',
|
||||
onClose: params[msgType].ONCLOSE ? Function("sAction", "return " + params[msgType].ONCLOSE) : null,
|
||||
|
@ -437,32 +430,64 @@ sap.ui.define(["sap/ui/core/mvc/Controller", "sap/ui/core/mvc/XMLView", "sap/ui/
|
|||
icon: params[msgType].ICON ? params[msgType].ICON : 'NONE',
|
||||
details: params[msgType].DETAILS ? params[msgType].DETAILS : '',
|
||||
closeOnNavigation: params[msgType].CLOSEONNAVIGATION ? true : false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
setApp(oApp) {
|
||||
this._oApp = oApp;
|
||||
},
|
||||
async displayView(xml, viewModel) {
|
||||
let oview_model = new JSONModel(viewModel);
|
||||
z2ui5.oView = await XMLView.create({
|
||||
definition: xml,
|
||||
models: oview_model,
|
||||
controller: z2ui5.oController,
|
||||
id: 'mainView',
|
||||
preprocessors: {
|
||||
xml: {
|
||||
models: {
|
||||
template: oview_model
|
||||
};
|
||||
if ( oParams.icon = 'None' ) { delete oParams.icon };
|
||||
MessageBox[params[msgType].TYPE](params[msgType].TEXT, oParams);
|
||||
return;
|
||||
|
||||
switch (params[msgType].TYPE) {
|
||||
case 'error':
|
||||
MessageBox.error(params[msgType].TEXT, oParams);
|
||||
break;
|
||||
case 'warning':
|
||||
MessageBox.error(params[msgType].TEXT, oParams);
|
||||
break;
|
||||
default:
|
||||
MessageBox.shwo(params[msgType].TEXT, oParams);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
|
||||
if (params[msgType].TYPE) {
|
||||
MessageBox[params[msgType].TYPE](params[msgType].TEXT);
|
||||
} else {
|
||||
MessageBox.show(params[msgType].TEXT, {
|
||||
styleClass: params[msgType].STYLECLASS ? params[msgType].STYLECLASS : '',
|
||||
title: params[msgType].TITLE ? params[msgType].TITLE : '',
|
||||
onClose: params[msgType].ONCLOSE ? Function("sAction", "return " + params[msgType].ONCLOSE) : null,
|
||||
actions: params[msgType].ACTIONS ? params[msgType].ACTIONS : 'OK',
|
||||
emphasizedAction: params[msgType].EMPHASIZEDACTION ? params[msgType].EMPHASIZEDACTION : 'OK',
|
||||
initialFocus: params[msgType].INITIALFOCUS ? params[msgType].INITIALFOCUS : null,
|
||||
textDirection: params[msgType].TEXTDIRECTION ? params[msgType].TEXTDIRECTION : 'Inherit',
|
||||
icon: params[msgType].ICON ? params[msgType].ICON : 'NONE',
|
||||
details: params[msgType].DETAILS ? params[msgType].DETAILS : '',
|
||||
closeOnNavigation: params[msgType].CLOSEONNAVIGATION ? true : false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
z2ui5.oView.setModel(z2ui5.oDeviceModel, "device");
|
||||
this._oApp.removeAllPages();
|
||||
this._oApp.insertPage(z2ui5.oView);
|
||||
},
|
||||
})
|
||||
});
|
||||
},
|
||||
setApp(oApp) {
|
||||
this._oApp = oApp;
|
||||
},
|
||||
async displayView(xml, viewModel) {
|
||||
let oview_model = new JSONModel(viewModel);
|
||||
z2ui5.oView = await XMLView.create({
|
||||
definition: xml,
|
||||
models: oview_model,
|
||||
controller: z2ui5.oController,
|
||||
id: 'mainView',
|
||||
preprocessors: {
|
||||
xml: {
|
||||
models: {
|
||||
template: oview_model
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
z2ui5.oView.setModel(z2ui5.oDeviceModel, "device");
|
||||
this._oApp.removeAllPages();
|
||||
this._oApp.insertPage(z2ui5.oView);
|
||||
},
|
||||
})
|
||||
});
|
|
@ -20,433 +20,426 @@ CLASS z2ui5_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",` && |\n| &&
|
||||
` ],` && |\n| &&
|
||||
` function(Controller, XMLView, JSONModel, BusyIndicator, MessageBox, MessageToast, Fragment, mBusyDialog, VersionInfo,` && |\n| &&
|
||||
` Server ) {` && |\n| &&
|
||||
` "use strict";` && |\n| &&
|
||||
` return Controller.extend("z2ui5.controller.View1", {` && |\n| &&
|
||||
` "sap/ui/VersionInfo", "z2ui5/cc/Server",` && |\n| &&
|
||||
`],` && |\n| &&
|
||||
` function (Controller, XMLView, JSONModel, BusyIndicator, MessageBox, MessageToast, Fragment, mBusyDialog, VersionInfo,` && |\n| &&
|
||||
` Server) {` && |\n| &&
|
||||
` "use strict";` && |\n| &&
|
||||
` return Controller.extend("z2ui5.controller.View1", {` && |\n| &&
|
||||
`` && |\n| &&
|
||||
` onInit (){` && |\n| &&
|
||||
` onInit() {` && |\n| &&
|
||||
`` && |\n| &&
|
||||
` z2ui5.oRouter.attachRouteMatched(function(oEvent) {` && |\n| &&
|
||||
` z2ui5.checkInit = true;` && |\n| &&
|
||||
` Server.Roundtrip();` && |\n| &&
|
||||
` }, this);` && |\n| &&
|
||||
` z2ui5.oRouter.attachRouteMatched(function (oEvent) {` && |\n| &&
|
||||
` z2ui5.checkInit = true;` && |\n| &&
|
||||
` Server.Roundtrip();` && |\n| &&
|
||||
` }, this);` && |\n| &&
|
||||
`` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` async onAfterRendering() {` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` async onAfterRendering() {` && |\n| &&
|
||||
`` && |\n| &&
|
||||
` if (!z2ui5.oResponse){` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
`` && |\n| &&
|
||||
` try {` && |\n| &&
|
||||
` if (!z2ui5.oResponse.PARAMS) {` && |\n| &&
|
||||
` BusyIndicator.hide();` && |\n| &&
|
||||
` z2ui5.isBusy = false;` && |\n| &&
|
||||
` if (!z2ui5.oResponse) {` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` const {S_POPUP, S_VIEW_NEST, S_VIEW_NEST2, S_POPOVER} = z2ui5.oResponse.PARAMS;` && |\n| &&
|
||||
` if (S_POPUP?.CHECK_DESTROY) {` && |\n| &&
|
||||
` z2ui5.oController.PopupDestroy();` && |\n| &&
|
||||
`` && |\n| &&
|
||||
` try {` && |\n| &&
|
||||
` if (!z2ui5.oResponse.PARAMS) {` && |\n| &&
|
||||
` BusyIndicator.hide();` && |\n| &&
|
||||
` z2ui5.isBusy = false;` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` const { S_POPUP, S_VIEW_NEST, S_VIEW_NEST2, S_POPOVER } = z2ui5.oResponse.PARAMS;` && |\n| &&
|
||||
` if (S_POPUP?.CHECK_DESTROY) {` && |\n| &&
|
||||
` z2ui5.oController.PopupDestroy();` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (S_POPOVER?.CHECK_DESTROY) {` && |\n| &&
|
||||
` z2ui5.oController.PopoverDestroy();` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (S_POPUP?.XML) {` && |\n| &&
|
||||
` z2ui5.oController.PopupDestroy();` && |\n| &&
|
||||
` await this.displayFragment(S_POPUP.XML, 'oViewPopup');` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (!z2ui5.checkNestAfter) {` && |\n| &&
|
||||
` if (S_VIEW_NEST?.XML) {` && |\n| &&
|
||||
` z2ui5.oController.NestViewDestroy();` && |\n| &&
|
||||
` await this.displayNestedView(S_VIEW_NEST.XML, 'oViewNest', 'S_VIEW_NEST');` && |\n| &&
|
||||
` z2ui5.checkNestAfter = true;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (!z2ui5.checkNestAfter2) {` && |\n| &&
|
||||
` if (S_VIEW_NEST2?.XML) {` && |\n| &&
|
||||
` z2ui5.oController.NestViewDestroy2();` && |\n| &&
|
||||
` await this.displayNestedView2(S_VIEW_NEST2.XML, 'oViewNest2', 'S_VIEW_NEST2');` && |\n| &&
|
||||
` z2ui5.checkNestAfter2 = true;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (S_POPOVER?.XML) {` && |\n| &&
|
||||
` await this.displayPopover(S_POPOVER.XML, 'oViewPopover', S_POPOVER.OPEN_BY_ID);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` BusyIndicator.hide();` && |\n| &&
|
||||
` z2ui5.isBusy = false;` && |\n| &&
|
||||
` z2ui5.onAfterRendering.forEach(item => {` && |\n| &&
|
||||
` if (item !== undefined) {` && |\n| &&
|
||||
` item();` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` )` && |\n| &&
|
||||
` } catch (e) {` && |\n| &&
|
||||
` BusyIndicator.hide();` && |\n| &&
|
||||
` z2ui5.isBusy = false;` && |\n| &&
|
||||
` MessageBox.error(e.toLocaleString(), {` && |\n| &&
|
||||
` title: "Unexpected Error Occured - App Terminated",` && |\n| &&
|
||||
` actions: [],` && |\n| &&
|
||||
` onClose: () => {` && |\n| &&
|
||||
` new mBusyDialog({` && |\n| &&
|
||||
` text: "Please Restart the App"` && |\n| &&
|
||||
` }).open();` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` })` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (S_POPOVER?.CHECK_DESTROY) {` && |\n| &&
|
||||
` z2ui5.oController.PopoverDestroy();` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` async displayFragment(xml, viewProp) {` && |\n| &&
|
||||
` let oview_model = new JSONModel(z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
|
||||
` const oFragment = await Fragment.load({` && |\n| &&
|
||||
` definition: xml,` && |\n| &&
|
||||
` controller: z2ui5.oControllerPopup,` && |\n| &&
|
||||
` id: "popupId"` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` oFragment.setModel(oview_model);` && |\n| &&
|
||||
` z2ui5[viewProp] = oFragment;` && |\n| &&
|
||||
` z2ui5[viewProp].Fragment = Fragment;` && |\n| &&
|
||||
` oFragment.open();` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` async displayPopover(xml, viewProp, openById) {` && |\n| &&
|
||||
` sap.ui.require(["sap/ui/core/Element"], async function (Element) {` && |\n| &&
|
||||
` const oFragment = await Fragment.load({` && |\n| &&
|
||||
` definition: xml,` && |\n| &&
|
||||
` controller: z2ui5.oControllerPopover,` && |\n| &&
|
||||
` id: "popoverId"` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` let oview_model = new JSONModel(z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
|
||||
` oFragment.setModel(oview_model);` && |\n| &&
|
||||
` z2ui5[viewProp] = oFragment;` && |\n| &&
|
||||
` z2ui5[viewProp].Fragment = Fragment;` && |\n| &&
|
||||
` let oControl = {};` && |\n| &&
|
||||
` if (z2ui5.oView?.byId(openById)) {` && |\n| &&
|
||||
` oControl = z2ui5.oView.byId(openById);` && |\n| &&
|
||||
` } else if (z2ui5.oViewPopup?.Fragment.byId('popupId', openById)) {` && |\n| &&
|
||||
` oControl = z2ui5.oViewPopup.Fragment.byId('popupId', openById);` && |\n| &&
|
||||
` } else if (z2ui5.oViewNest?.byId(openById)) {` && |\n| &&
|
||||
` oControl = z2ui5.oViewNest.byId(openById);` && |\n| &&
|
||||
` } else if (z2ui5.oViewNest2?.byId(openById)) {` && |\n| &&
|
||||
` oControl = z2ui5.oViewNest2.byId(openById);` && |\n| &&
|
||||
` } else {` && |\n| &&
|
||||
` if (sapUiCore.byId(openById)) {` && |\n| &&
|
||||
` // oControl = sapUiCore.byId(openById);` && |\n| &&
|
||||
` oControl = Element.getElementById(openById);` && |\n| &&
|
||||
` } else {` && |\n| &&
|
||||
` oControl = null;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` ;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` oFragment.openBy(oControl);` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` async displayNestedView(xml, viewProp, viewNestId) {` && |\n| &&
|
||||
` let oview_model = new JSONModel(z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
|
||||
` const oView = await XMLView.create({` && |\n| &&
|
||||
` definition: xml,` && |\n| &&
|
||||
` controller: z2ui5.oControllerNest,` && |\n| &&
|
||||
` preprocessors: {` && |\n| &&
|
||||
` xml: {` && |\n| &&
|
||||
` models: {` && |\n| &&
|
||||
` template: oview_model` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` oView.setModel(oview_model);` && |\n| &&
|
||||
` let oParent = z2ui5.oView.byId(z2ui5.oResponse.PARAMS[viewNestId].ID);` && |\n| &&
|
||||
` if (oParent) {` && |\n| &&
|
||||
` try {` && |\n| &&
|
||||
` oParent[z2ui5.oResponse.PARAMS[viewNestId].METHOD_DESTROY]();` && |\n| &&
|
||||
` } catch { }` && |\n| &&
|
||||
` oParent[z2ui5.oResponse.PARAMS[viewNestId].METHOD_INSERT](oView);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (S_POPUP?.XML) {` && |\n| &&
|
||||
` z2ui5.oController.PopupDestroy();` && |\n| &&
|
||||
` await this.displayFragment(S_POPUP.XML, 'oViewPopup');` && |\n| &&
|
||||
` z2ui5[viewProp] = oView;` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` async displayNestedView2(xml, viewProp, viewNestId) {` && |\n| &&
|
||||
` let oview_model = new JSONModel(z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
|
||||
` const oView = await XMLView.create({` && |\n| &&
|
||||
` definition: xml,` && |\n| &&
|
||||
` controller: z2ui5.oControllerNest2,` && |\n| &&
|
||||
` preprocessors: {` && |\n| &&
|
||||
` xml: {` && |\n| &&
|
||||
` models: {` && |\n| &&
|
||||
` template: oview_model` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` oView.setModel(oview_model);` && |\n| &&
|
||||
` let oParent = z2ui5.oView.byId(z2ui5.oResponse.PARAMS[viewNestId].ID);` && |\n| &&
|
||||
` if (oParent) {` && |\n| &&
|
||||
` try {` && |\n| &&
|
||||
` oParent[z2ui5.oResponse.PARAMS[viewNestId].METHOD_DESTROY]();` && |\n| &&
|
||||
` } catch { }` && |\n| &&
|
||||
` oParent[z2ui5.oResponse.PARAMS[viewNestId].METHOD_INSERT](oView);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (!z2ui5.checkNestAfter) {` && |\n| &&
|
||||
` if (S_VIEW_NEST?.XML) {` && |\n| &&
|
||||
` z2ui5.oController.NestViewDestroy();` && |\n| &&
|
||||
` await this.displayNestedView(S_VIEW_NEST.XML, 'oViewNest', 'S_VIEW_NEST');` && |\n| &&
|
||||
` z2ui5.checkNestAfter = true;` && |\n| &&
|
||||
` z2ui5[viewProp] = oView;` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` PopupDestroy() {` && |\n| &&
|
||||
` if (!z2ui5.oViewPopup) {` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (z2ui5.oViewPopup.close) {` && |\n| &&
|
||||
` try {` && |\n| &&
|
||||
` z2ui5.oViewPopup.close();` && |\n| &&
|
||||
` } catch { }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` z2ui5.oViewPopup.destroy();` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` PopoverDestroy() {` && |\n| &&
|
||||
` if (!z2ui5.oViewPopover) {` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (z2ui5.oViewPopover.close) {` && |\n| &&
|
||||
` try {` && |\n| &&
|
||||
` z2ui5.oViewPopover.close();` && |\n| &&
|
||||
` } catch { }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` z2ui5.oViewPopover.destroy();` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` NestViewDestroy() {` && |\n| &&
|
||||
` if (!z2ui5.oViewNest) {` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` z2ui5.oViewNest.destroy();` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` NestViewDestroy2() {` && |\n| &&
|
||||
` if (!z2ui5.oViewNest2) {` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` z2ui5.oViewNest2.destroy();` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` ViewDestroy() {` && |\n| &&
|
||||
` if (!z2ui5.oView) {` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` z2ui5.oView.destroy();` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` eF(...args) {` && |\n| &&
|
||||
`` && |\n| &&
|
||||
` z2ui5.onBeforeEventFrontend.forEach(item => {` && |\n| &&
|
||||
` if (item !== undefined) {` && |\n| &&
|
||||
` item(args);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (!z2ui5.checkNestAfter2) {` && |\n| &&
|
||||
` if (S_VIEW_NEST2?.XML) {` && |\n| &&
|
||||
` z2ui5.oController.NestViewDestroy2();` && |\n| &&
|
||||
` await this.displayNestedView2(S_VIEW_NEST2.XML, 'oViewNest2', 'S_VIEW_NEST2');` && |\n| &&
|
||||
` z2ui5.checkNestAfter2 = true;` && |\n| &&
|
||||
` )` && |\n| &&
|
||||
` let oCrossAppNavigator;` && |\n| &&
|
||||
` switch (args[0]) {` && |\n| &&
|
||||
` case 'SET_SIZE_LIMIT':` && |\n| &&
|
||||
` switch (args[2]) {` && |\n| &&
|
||||
` case 'MAIN':` && |\n| &&
|
||||
` z2ui5.oView.getModel().setSizeLimit(parseInt(args[1]));` && |\n| &&
|
||||
` z2ui5.oView.getModel().refresh(true);` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'NEST':` && |\n| &&
|
||||
` z2ui5.oViewNest.getModel().setSizeLimit(parseInt(args[1]));` && |\n| &&
|
||||
` z2ui5.oViewNest.getModel().refresh(true);` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'NEST2':` && |\n| &&
|
||||
` z2ui5.oViewNest2.getModel().setSizeLimit(parseInt(args[1]));` && |\n| &&
|
||||
` z2ui5.oViewNest2.getModel().refresh(true);` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'POPUP':` && |\n| &&
|
||||
` z2ui5.oPopup.getModel().setSizeLimit(parseInt(args[1]));` && |\n| &&
|
||||
` z2ui5.oPopup.getModel().refresh(true);` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'POPOVER':` && |\n| &&
|
||||
` z2ui5.oPopover.getModel().setSizeLimit(parseInt(args[1]));` && |\n| &&
|
||||
` z2ui5.oPopover.getModel().refresh(true);` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'DOWNLOAD_B64_FILE':` && |\n| &&
|
||||
` var a = document.createElement("a");` && |\n| &&
|
||||
` a.href = args[1];` && |\n| &&
|
||||
` a.download = args[2];` && |\n| &&
|
||||
` a.click();` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'CROSS_APP_NAV_TO_PREV_APP':` && |\n| &&
|
||||
` // oCrossAppNavigator = Container.getService("CrossApplicationNavigation");` && |\n| &&
|
||||
` oCrossAppNavigator = sap.ushell.Container.getService("CrossApplicationNavigation");` && |\n| &&
|
||||
` oCrossAppNavigator.backToPreviousApp();` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'CROSS_APP_NAV_TO_EXT':` && |\n| &&
|
||||
` // oCrossAppNavigator = Container.getService("CrossApplicationNavigation");` && |\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| &&
|
||||
` //todo` && |\n| &&
|
||||
` //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| &&
|
||||
` z2ui5.oController.PopupDestroy();` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'POPOVER_CLOSE':` && |\n| &&
|
||||
` z2ui5.oController.PopoverDestroy();` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'NAV_CONTAINER_TO':` && |\n| &&
|
||||
` var navCon = z2ui5.oView.byId(args[1]);` && |\n| &&
|
||||
` var navConTo = z2ui5.oView.byId(args[2]);` && |\n| &&
|
||||
` navCon.to(navConTo);` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'NEST_NAV_CONTAINER_TO':` && |\n| &&
|
||||
` navCon = z2ui5.oViewNest.byId(args[1]);` && |\n| &&
|
||||
` navConTo = z2ui5.oViewNest.byId(args[2]);` && |\n| &&
|
||||
` navCon.to(navConTo);` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'NEST2_NAV_CONTAINER_TO':` && |\n| &&
|
||||
` navCon = z2ui5.oViewNest2.byId(args[1]);` && |\n| &&
|
||||
` navConTo = z2ui5.oViewNest2.byId(args[2]);` && |\n| &&
|
||||
` navCon.to(navConTo);` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'POPUP_NAV_CONTAINER_TO':` && |\n| &&
|
||||
` navCon = Fragment.byId("popupId", args[1]);` && |\n| &&
|
||||
` navConTo = Fragment.byId("popupId", args[2]);` && |\n| &&
|
||||
` navCon.to(navConTo);` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` eB(...args) {` && |\n| &&
|
||||
`` && |\n| &&
|
||||
` if (!window.navigator.onLine) {` && |\n| &&
|
||||
` MessageBox.alert('No internet connection! Please reconnect to the server and try again.');` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (z2ui5.isBusy == true) {` && |\n| &&
|
||||
` if (!args[0][2]) {` && |\n| &&
|
||||
` let oBusyDialog = new mBusyDialog();` && |\n| &&
|
||||
` oBusyDialog.open();` && |\n| &&
|
||||
` setTimeout((oBusyDialog) => {` && |\n| &&
|
||||
` oBusyDialog.close()` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` , 100, oBusyDialog);` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (S_POPOVER?.XML) {` && |\n| &&
|
||||
` await this.displayPopover(S_POPOVER.XML, 'oViewPopover', S_POPOVER.OPEN_BY_ID);` && |\n| &&
|
||||
` z2ui5.isBusy = true;` && |\n| &&
|
||||
` BusyIndicator.show();` && |\n| &&
|
||||
` z2ui5.oBody = {};` && |\n| &&
|
||||
` if (args[0][3]) {` && |\n| &&
|
||||
` z2ui5.oBody.XX = z2ui5.oView.getModel().getData().XX;` && |\n| &&
|
||||
` z2ui5.oBody.VIEWNAME = 'MAIN';` && |\n| &&
|
||||
` } else if (z2ui5.oController == this) {` && |\n| &&
|
||||
` z2ui5.oBody.XX = z2ui5.oView.getModel().getData().XX;` && |\n| &&
|
||||
` z2ui5.oBody.VIEWNAME = 'MAIN';` && |\n| &&
|
||||
` } else if (z2ui5.oControllerPopup == this) {` && |\n| &&
|
||||
` if (z2ui5.oViewPopup) {` && |\n| &&
|
||||
` z2ui5.oBody.XX = z2ui5.oViewPopup.getModel().getData().XX;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` z2ui5.oBody.VIEWNAME = 'MAIN';` && |\n| &&
|
||||
` } else if (z2ui5.oControllerPopover == this) {` && |\n| &&
|
||||
` z2ui5.oBody.XX = z2ui5.oViewPopover.getModel().getData().XX;` && |\n| &&
|
||||
` z2ui5.oBody.VIEWNAME = 'MAIN';` && |\n| &&
|
||||
` } else if (z2ui5.oControllerNest == this) {` && |\n| &&
|
||||
` z2ui5.oBody.XX = z2ui5.oViewNest.getModel().getData().XX;` && |\n| &&
|
||||
` z2ui5.oBody.VIEWNAME = 'NEST';` && |\n| &&
|
||||
` } else if (z2ui5.oControllerNest2 == this) {` && |\n| &&
|
||||
` z2ui5.oBody.XX = z2ui5.oViewNest2.getModel().getData().XX;` && |\n| &&
|
||||
` z2ui5.oBody.VIEWNAME = 'NEST2';` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` BusyIndicator.hide();` && |\n| &&
|
||||
` z2ui5.isBusy = false;` && |\n| &&
|
||||
` z2ui5.onAfterRendering.forEach(item => {` && |\n| &&
|
||||
` z2ui5.onBeforeRoundtrip.forEach(item => {` && |\n| &&
|
||||
` if (item !== undefined) {` && |\n| &&
|
||||
` item();` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` )` && |\n| &&
|
||||
` } catch (e) {` && |\n| &&
|
||||
` BusyIndicator.hide();` && |\n| &&
|
||||
` z2ui5.isBusy = false;` && |\n| &&
|
||||
` MessageBox.error(e.toLocaleString(), {` && |\n| &&
|
||||
` title: "Unexpected Error Occured - App Terminated",` && |\n| &&
|
||||
` actions: [],` && |\n| &&
|
||||
` onClose: () => {` && |\n| &&
|
||||
` new mBusyDialog({` && |\n| &&
|
||||
` text: "Please Restart the App"` && |\n| &&
|
||||
` }).open();` && |\n| &&
|
||||
` // if (args[0][1]) {` && |\n| &&
|
||||
` // z2ui5.oController.ViewDestroy();` && |\n| &&
|
||||
` // }` && |\n| &&
|
||||
` z2ui5.oBody.ID = z2ui5.oResponse.ID;` && |\n| &&
|
||||
` z2ui5.oBody.ARGUMENTS = args;` && |\n| &&
|
||||
` z2ui5.oBody.ARGUMENTS.forEach((item, i) => {` && |\n| &&
|
||||
` if (i == 0) {` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` })` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` async displayFragment(xml, viewProp) {` && |\n| &&
|
||||
` let oview_model = new JSONModel(z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
|
||||
` const oFragment = await Fragment.load({` && |\n| &&
|
||||
` definition: xml,` && |\n| &&
|
||||
` controller: z2ui5.oControllerPopup,` && |\n| &&
|
||||
` id: "popupId"` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` oFragment.setModel(oview_model);` && |\n| &&
|
||||
` z2ui5[viewProp] = oFragment;` && |\n| &&
|
||||
` z2ui5[viewProp].Fragment = Fragment;` && |\n| &&
|
||||
` oFragment.open();` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` async displayPopover(xml, viewProp, openById) {` && |\n| &&
|
||||
` sap.ui.require(["sap/ui/core/Element"], async function(Element) {` && |\n| &&
|
||||
` const oFragment = await Fragment.load({` && |\n| &&
|
||||
` definition: xml,` && |\n| &&
|
||||
` controller: z2ui5.oControllerPopover,` && |\n| &&
|
||||
` id: "popoverId"` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` let oview_model = new JSONModel(z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
|
||||
` oFragment.setModel(oview_model);` && |\n| &&
|
||||
` z2ui5[viewProp] = oFragment;` && |\n| &&
|
||||
` z2ui5[viewProp].Fragment = Fragment;` && |\n| &&
|
||||
` let oControl = {};` && |\n| &&
|
||||
` if (z2ui5.oView?.byId(openById)) {` && |\n| &&
|
||||
` oControl = z2ui5.oView.byId(openById);` && |\n| &&
|
||||
` } else if (z2ui5.oViewPopup?.Fragment.byId('popupId', openById)) {` && |\n| &&
|
||||
` oControl = z2ui5.oViewPopup.Fragment.byId('popupId', openById);` && |\n| &&
|
||||
` } else if (z2ui5.oViewNest?.byId(openById)) {` && |\n| &&
|
||||
` oControl = z2ui5.oViewNest.byId(openById);` && |\n| &&
|
||||
` } else if (z2ui5.oViewNest2?.byId(openById)) {` && |\n| &&
|
||||
` oControl = z2ui5.oViewNest2.byId(openById);` && |\n| &&
|
||||
` } else {` && |\n| &&
|
||||
` if (sapUiCore.byId(openById)) {` && |\n| &&
|
||||
` // oControl = sapUiCore.byId(openById);` && |\n| &&
|
||||
` oControl = Element.getElementById(openById);` && |\n| &&
|
||||
` } else {` && |\n| &&
|
||||
` oControl = null;` && |\n| &&
|
||||
` if (typeof item === 'object') {` && |\n| &&
|
||||
` z2ui5.oBody.ARGUMENTS[i] = JSON.stringify(item);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` );` && |\n| &&
|
||||
` z2ui5.oResponseOld = z2ui5.oResponse;` && |\n| &&
|
||||
` Server.Roundtrip();` && |\n| &&
|
||||
`` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
`` && |\n| &&
|
||||
` updateModelIfRequired(paramKey, oView) {` && |\n| &&
|
||||
` if (z2ui5.oResponse.PARAMS == undefined) {` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (z2ui5.oResponse.PARAMS[paramKey]?.CHECK_UPDATE_MODEL) {` && |\n| &&
|
||||
` let model = new JSONModel(z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
|
||||
` if (oView) {` && |\n| &&
|
||||
` oView.setModel(model);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` async checkSDKcompatibility(err) {` && |\n| &&
|
||||
` let oCurrentVersionInfo = await VersionInfo.load();` && |\n| &&
|
||||
` var ui5_sdk = oCurrentVersionInfo.gav.includes('com.sap.ui5') ? true : false;` && |\n| &&
|
||||
` if (!ui5_sdk) {` && |\n| &&
|
||||
` if (err) {` && |\n| &&
|
||||
` MessageBox.error("openui5 SDK is loaded, module: " + err._modules + " is not availabe in openui5");` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` ;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` oFragment.openBy(oControl);` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` async displayNestedView(xml, viewProp, viewNestId) {` && |\n| &&
|
||||
` let oview_model = new JSONModel(z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
|
||||
` const oView = await XMLView.create({` && |\n| &&
|
||||
` definition: xml,` && |\n| &&
|
||||
` controller: z2ui5.oControllerNest,` && |\n| &&
|
||||
` preprocessors: {` && |\n| &&
|
||||
` xml: {` && |\n| &&
|
||||
` models: {` && |\n| &&
|
||||
` template: oview_model` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` oView.setModel(oview_model);` && |\n| &&
|
||||
` let oParent = z2ui5.oView.byId(z2ui5.oResponse.PARAMS[viewNestId].ID);` && |\n| &&
|
||||
` if (oParent) {` && |\n| &&
|
||||
` try {` && |\n| &&
|
||||
` oParent[z2ui5.oResponse.PARAMS[viewNestId].METHOD_DESTROY]();` && |\n| &&
|
||||
` } catch {}` && |\n| &&
|
||||
` oParent[z2ui5.oResponse.PARAMS[viewNestId].METHOD_INSERT](oView);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` z2ui5[viewProp] = oView;` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` async displayNestedView2(xml, viewProp, viewNestId) {` && |\n| &&
|
||||
` let oview_model = new JSONModel(z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
|
||||
` const oView = await XMLView.create({` && |\n| &&
|
||||
` definition: xml,` && |\n| &&
|
||||
` controller: z2ui5.oControllerNest2,` && |\n| &&
|
||||
` preprocessors: {` && |\n| &&
|
||||
` xml: {` && |\n| &&
|
||||
` models: {` && |\n| &&
|
||||
` template: oview_model` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` oView.setModel(oview_model);` && |\n| &&
|
||||
` let oParent = z2ui5.oView.byId(z2ui5.oResponse.PARAMS[viewNestId].ID);` && |\n| &&
|
||||
` if (oParent) {` && |\n| &&
|
||||
` try {` && |\n| &&
|
||||
` oParent[z2ui5.oResponse.PARAMS[viewNestId].METHOD_DESTROY]();` && |\n| &&
|
||||
` } catch {}` && |\n| &&
|
||||
` oParent[z2ui5.oResponse.PARAMS[viewNestId].METHOD_INSERT](oView);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` z2ui5[viewProp] = oView;` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` PopupDestroy() {` && |\n| &&
|
||||
` if (!z2ui5.oViewPopup) {` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (z2ui5.oViewPopup.close) {` && |\n| &&
|
||||
` try {` && |\n| &&
|
||||
` z2ui5.oViewPopup.close();` && |\n| &&
|
||||
` } catch {}` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` z2ui5.oViewPopup.destroy();` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` PopoverDestroy() {` && |\n| &&
|
||||
` if (!z2ui5.oViewPopover) {` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (z2ui5.oViewPopover.close) {` && |\n| &&
|
||||
` try {` && |\n| &&
|
||||
` z2ui5.oViewPopover.close();` && |\n| &&
|
||||
` } catch {}` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` z2ui5.oViewPopover.destroy();` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` NestViewDestroy() {` && |\n| &&
|
||||
` if (!z2ui5.oViewNest) {` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` z2ui5.oViewNest.destroy();` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` NestViewDestroy2() {` && |\n| &&
|
||||
` if (!z2ui5.oViewNest2) {` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` z2ui5.oViewNest2.destroy();` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` ViewDestroy() {` && |\n| &&
|
||||
` if (!z2ui5.oView) {` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` z2ui5.oView.destroy();` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` eF(...args) {` && |\n| &&
|
||||
`` && |\n| &&
|
||||
` z2ui5.onBeforeEventFrontend.forEach(item => {` && |\n| &&
|
||||
` if (item !== undefined) {` && |\n| &&
|
||||
` item(args);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` )` && |\n| &&
|
||||
` let oCrossAppNavigator;` && |\n| &&
|
||||
` switch (args[0]) {` && |\n| &&
|
||||
` case 'SET_SIZE_LIMIT':` && |\n| &&
|
||||
` switch (args[2]) {` && |\n| &&
|
||||
` case 'MAIN':` && |\n| &&
|
||||
` z2ui5.oView.getModel().setSizeLimit(parseInt(args[1]));` && |\n| &&
|
||||
` z2ui5.oView.getModel().refresh(true);` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'NEST':` && |\n| &&
|
||||
` z2ui5.oViewNest.getModel().setSizeLimit(parseInt(args[1]));` && |\n| &&
|
||||
` z2ui5.oViewNest.getModel().refresh(true);` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'NEST2':` && |\n| &&
|
||||
` z2ui5.oViewNest2.getModel().setSizeLimit(parseInt(args[1]));` && |\n| &&
|
||||
` z2ui5.oViewNest2.getModel().refresh(true);` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'POPUP':` && |\n| &&
|
||||
` z2ui5.oPopup.getModel().setSizeLimit(parseInt(args[1]));` && |\n| &&
|
||||
` z2ui5.oPopup.getModel().refresh(true);` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'POPOVER':` && |\n| &&
|
||||
` z2ui5.oPopover.getModel().setSizeLimit(parseInt(args[1]));` && |\n| &&
|
||||
` z2ui5.oPopover.getModel().refresh(true);` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'DOWNLOAD_B64_FILE':` && |\n| &&
|
||||
` var a = document.createElement("a");` && |\n| &&
|
||||
` a.href = args[1];` && |\n| &&
|
||||
` a.download = args[2];` && |\n| &&
|
||||
` a.click();` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'CROSS_APP_NAV_TO_PREV_APP':` && |\n| &&
|
||||
` // oCrossAppNavigator = Container.getService("CrossApplicationNavigation");` && |\n| &&
|
||||
` oCrossAppNavigator = sap.ushell.Container.getService("CrossApplicationNavigation");` && |\n| &&
|
||||
` oCrossAppNavigator.backToPreviousApp();` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'CROSS_APP_NAV_TO_EXT':` && |\n| &&
|
||||
` // oCrossAppNavigator = Container.getService("CrossApplicationNavigation");` && |\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| &&
|
||||
` //todo` && |\n| &&
|
||||
` //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| &&
|
||||
` z2ui5.oController.PopupDestroy();` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'POPOVER_CLOSE':` && |\n| &&
|
||||
` z2ui5.oController.PopoverDestroy();` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'NAV_CONTAINER_TO':` && |\n| &&
|
||||
` var navCon = z2ui5.oView.byId(args[1]);` && |\n| &&
|
||||
` var navConTo = z2ui5.oView.byId(args[2]);` && |\n| &&
|
||||
` navCon.to(navConTo);` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'NEST_NAV_CONTAINER_TO':` && |\n| &&
|
||||
` navCon = z2ui5.oViewNest.byId(args[1]);` && |\n| &&
|
||||
` navConTo = z2ui5.oViewNest.byId(args[2]);` && |\n| &&
|
||||
` navCon.to(navConTo);` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'NEST2_NAV_CONTAINER_TO':` && |\n| &&
|
||||
` navCon = z2ui5.oViewNest2.byId(args[1]);` && |\n| &&
|
||||
` navConTo = z2ui5.oViewNest2.byId(args[2]);` && |\n| &&
|
||||
` navCon.to(navConTo);` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'POPUP_NAV_CONTAINER_TO':` && |\n| &&
|
||||
` navCon = Fragment.byId("popupId", args[1]);` && |\n| &&
|
||||
` navConTo = Fragment.byId("popupId", args[2]);` && |\n| &&
|
||||
` navCon.to(navConTo);` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` eB(...args) {` && |\n| &&
|
||||
`` && |\n| &&
|
||||
` // var oRouter = sap.ui.core.UIComponent.getRouterFor(this);` && |\n| &&
|
||||
` //debugger;` && |\n| &&
|
||||
` // z2ui5.oRouter.navTo("RouteView2");` && |\n| &&
|
||||
` // return;` && |\n| &&
|
||||
`` && |\n| &&
|
||||
` if (!window.navigator.onLine) {` && |\n| &&
|
||||
` MessageBox.alert('No internet connection! Please reconnect to the server and try again.');` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (z2ui5.isBusy == true) {` && |\n| &&
|
||||
` if (!args[0][2]) {` && |\n| &&
|
||||
` let oBusyDialog = new mBusyDialog();` && |\n| &&
|
||||
` oBusyDialog.open();` && |\n| &&
|
||||
` setTimeout( (oBusyDialog) => {` && |\n| &&
|
||||
` oBusyDialog.close()` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` , 100, oBusyDialog);` && |\n| &&
|
||||
` ; MessageBox.error(err.toLocaleString());` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` showMessage(msgType, params) {` && |\n| &&
|
||||
` if (params == undefined) {` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` z2ui5.isBusy = true;` && |\n| &&
|
||||
` BusyIndicator.show();` && |\n| &&
|
||||
` z2ui5.oBody = {};` && |\n| &&
|
||||
` if (args[0][3]) {` && |\n| &&
|
||||
` z2ui5.oBody.XX = z2ui5.oView.getModel().getData().XX;` && |\n| &&
|
||||
` z2ui5.oBody.VIEWNAME = 'MAIN';` && |\n| &&
|
||||
` } else if (z2ui5.oController == this) {` && |\n| &&
|
||||
` z2ui5.oBody.XX = z2ui5.oView.getModel().getData().XX;` && |\n| &&
|
||||
` z2ui5.oBody.VIEWNAME = 'MAIN';` && |\n| &&
|
||||
` } else if (z2ui5.oControllerPopup == this) {` && |\n| &&
|
||||
` if (z2ui5.oViewPopup) {` && |\n| &&
|
||||
` z2ui5.oBody.XX = z2ui5.oViewPopup.getModel().getData().XX;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` z2ui5.oBody.VIEWNAME = 'MAIN';` && |\n| &&
|
||||
` } else if (z2ui5.oControllerPopover == this) {` && |\n| &&
|
||||
` z2ui5.oBody.XX = z2ui5.oViewPopover.getModel().getData().XX;` && |\n| &&
|
||||
` z2ui5.oBody.VIEWNAME = 'MAIN';` && |\n| &&
|
||||
` } else if (z2ui5.oControllerNest == this) {` && |\n| &&
|
||||
` z2ui5.oBody.XX = z2ui5.oViewNest.getModel().getData().XX;` && |\n| &&
|
||||
` z2ui5.oBody.VIEWNAME = 'NEST';` && |\n| &&
|
||||
` } else if (z2ui5.oControllerNest2 == this) {` && |\n| &&
|
||||
` z2ui5.oBody.XX = z2ui5.oViewNest2.getModel().getData().XX;` && |\n| &&
|
||||
` z2ui5.oBody.VIEWNAME = 'NEST2';` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` z2ui5.onBeforeRoundtrip.forEach(item => {` && |\n| &&
|
||||
` if (item !== undefined) {` && |\n| &&
|
||||
` item();` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` )` && |\n| &&
|
||||
` if (args[0][1]) {` && |\n| &&
|
||||
` z2ui5.oController.ViewDestroy();` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` z2ui5.oBody.ID = z2ui5.oResponse.ID;` && |\n| &&
|
||||
` z2ui5.oBody.ARGUMENTS = args;` && |\n| &&
|
||||
` z2ui5.oBody.ARGUMENTS.forEach( (item, i) => {` && |\n| &&
|
||||
` if (i == 0) {` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (typeof item === 'object') {` && |\n| &&
|
||||
` z2ui5.oBody.ARGUMENTS[i] = JSON.stringify(item);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` );` && |\n| &&
|
||||
` z2ui5.oResponseOld = z2ui5.oResponse;` && |\n| &&
|
||||
` Server.Roundtrip();` && |\n| &&
|
||||
`` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
`` && |\n| &&
|
||||
` updateModelIfRequired(paramKey, oView) {` && |\n| &&
|
||||
` if (z2ui5.oResponse.PARAMS == undefined) {` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (z2ui5.oResponse.PARAMS[paramKey]?.CHECK_UPDATE_MODEL) {` && |\n| &&
|
||||
` let model = new JSONModel(z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
|
||||
` if (oView) {` && |\n| &&
|
||||
` oView.setModel(model);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` async checkSDKcompatibility(err) {` && |\n| &&
|
||||
` let oCurrentVersionInfo = await VersionInfo.load();` && |\n| &&
|
||||
` var ui5_sdk = oCurrentVersionInfo.gav.includes('com.sap.ui5') ? true : false;` && |\n| &&
|
||||
` if (!ui5_sdk) {` && |\n| &&
|
||||
` if (err) {` && |\n| &&
|
||||
` MessageBox.error("openui5 SDK is loaded, module: " + err._modules + " is not availabe in openui5");` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` ;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` ;MessageBox.error(err.toLocaleString());` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` showMessage(msgType, params) {` && |\n| &&
|
||||
` if (params == undefined) {` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (params[msgType]?.TEXT !== undefined) {` && |\n| &&
|
||||
` if (msgType === 'S_MSG_TOAST') {` && |\n| &&
|
||||
` MessageToast.show(params[msgType].TEXT, {` && |\n| &&
|
||||
` duration: params[msgType].DURATION ? parseInt(params[msgType].DURATION) : 3000,` && |\n| &&
|
||||
` width: params[msgType].WIDTH ? params[msgType].WIDTH : '15em',` && |\n| &&
|
||||
` onClose: params[msgType].ONCLOSE ? params[msgType].ONCLOSE : null,` && |\n| &&
|
||||
` autoClose: params[msgType].AUTOCLOSE ? true : false,` && |\n| &&
|
||||
` animationTimingFunction: params[msgType].ANIMATIONTIMINGFUNCTION ? params[msgType].ANIMATIONTIMINGFUNCTION : 'ease',` && |\n| &&
|
||||
` animationDuration: params[msgType].ANIMATIONDURATION ? parseInt(params[msgType].ANIMATIONDURATION) : 1000,` && |\n| &&
|
||||
` closeonBrowserNavigation: params[msgType].CLOSEONBROWSERNAVIGATION ? true : false` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` if (params[msgType].CLASS) {` && |\n| &&
|
||||
` let mtoast = {};` && |\n| &&
|
||||
` mtoast = document.getElementsByClassName("sapMMessageToast")[0];` && |\n| &&
|
||||
` if (mtoast) {` && |\n| &&
|
||||
` mtoast.classList.add(params[msgType].CLASS);` && |\n| &&
|
||||
` if (params[msgType]?.TEXT !== undefined) {` && |\n| &&
|
||||
` if (msgType === 'S_MSG_TOAST') {` && |\n| &&
|
||||
` MessageToast.show(params[msgType].TEXT, {` && |\n| &&
|
||||
` duration: params[msgType].DURATION ? parseInt(params[msgType].DURATION) : 3000,` && |\n| &&
|
||||
` width: params[msgType].WIDTH ? params[msgType].WIDTH : '15em',` && |\n| &&
|
||||
` onClose: params[msgType].ONCLOSE ? params[msgType].ONCLOSE : null,` && |\n| &&
|
||||
` autoClose: params[msgType].AUTOCLOSE ? true : false,` && |\n| &&
|
||||
` animationTimingFunction: params[msgType].ANIMATIONTIMINGFUNCTION ? params[msgType].ANIMATIONTIMINGFUNCTION : 'ease',` && |\n| &&
|
||||
` animationDuration: params[msgType].ANIMATIONDURATION ? parseInt(params[msgType].ANIMATIONDURATION) : 1000,` && |\n| &&
|
||||
` closeonBrowserNavigation: params[msgType].CLOSEONBROWSERNAVIGATION ? true : false` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` if (params[msgType].CLASS) {` && |\n| &&
|
||||
` let mtoast = {};` && |\n| &&
|
||||
` mtoast = document.getElementsByClassName("sapMMessageToast")[0];` && |\n| &&
|
||||
` if (mtoast) {` && |\n| &&
|
||||
` mtoast.classList.add(params[msgType].CLASS);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` ;` && |\n| &&
|
||||
` } else if (msgType === 'S_MSG_BOX') {` && |\n| &&
|
||||
` if (params[msgType].TYPE) {` && |\n| &&
|
||||
` MessageBox[params[msgType].TYPE](params[msgType].TEXT);` && |\n| &&
|
||||
` } else {` && |\n| &&
|
||||
` MessageBox.show(params[msgType].TEXT, {` && |\n| &&
|
||||
` ;` && |\n| &&
|
||||
` } else if (msgType === 'S_MSG_BOX') {` && |\n| &&
|
||||
`` && |\n| &&
|
||||
` let oParams = {` && |\n| &&
|
||||
` styleClass: params[msgType].STYLECLASS ? params[msgType].STYLECLASS : '',` && |\n| &&
|
||||
` title: params[msgType].TITLE ? params[msgType].TITLE : '',` && |\n| &&
|
||||
` onClose: params[msgType].ONCLOSE ? Function("sAction", "return " + params[msgType].ONCLOSE) : null,` && |\n| &&
|
||||
|
@ -457,35 +450,67 @@ CLASS z2ui5_cl_app_view1_js IMPLEMENTATION.
|
|||
` icon: params[msgType].ICON ? params[msgType].ICON : 'NONE',` && |\n| &&
|
||||
` details: params[msgType].DETAILS ? params[msgType].DETAILS : '',` && |\n| &&
|
||||
` closeOnNavigation: params[msgType].CLOSEONNAVIGATION ? true : false` && |\n| &&
|
||||
` })` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` setApp(oApp) {` && |\n| &&
|
||||
` this._oApp = oApp;` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` async displayView(xml, viewModel) {` && |\n| &&
|
||||
` let oview_model = new JSONModel(viewModel);` && |\n| &&
|
||||
` z2ui5.oView = await XMLView.create({` && |\n| &&
|
||||
` definition: xml,` && |\n| &&
|
||||
` models: oview_model,` && |\n| &&
|
||||
` controller: z2ui5.oController,` && |\n| &&
|
||||
` id: 'mainView',` && |\n| &&
|
||||
` preprocessors: {` && |\n| &&
|
||||
` xml: {` && |\n| &&
|
||||
` models: {` && |\n| &&
|
||||
` template: oview_model` && |\n| &&
|
||||
` };` && |\n| &&
|
||||
` if ( oParams.icon = 'None' ) { delete oParams.icon };` && |\n| &&
|
||||
` MessageBox[params[msgType].TYPE](params[msgType].TEXT, oParams);` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
`` && |\n| &&
|
||||
` switch (params[msgType].TYPE) {` && |\n| &&
|
||||
` case 'error':` && |\n| &&
|
||||
` MessageBox.error(params[msgType].TEXT, oParams);` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` case 'warning':` && |\n| &&
|
||||
` MessageBox.error(params[msgType].TEXT, oParams);` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` default:` && |\n| &&
|
||||
` MessageBox.shwo(params[msgType].TEXT, oParams);` && |\n| &&
|
||||
` break;` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
`` && |\n| &&
|
||||
` if (params[msgType].TYPE) {` && |\n| &&
|
||||
` MessageBox[params[msgType].TYPE](params[msgType].TEXT);` && |\n| &&
|
||||
` } else {` && |\n| &&
|
||||
` MessageBox.show(params[msgType].TEXT, {` && |\n| &&
|
||||
` styleClass: params[msgType].STYLECLASS ? params[msgType].STYLECLASS : '',` && |\n| &&
|
||||
` title: params[msgType].TITLE ? params[msgType].TITLE : '',` && |\n| &&
|
||||
` onClose: params[msgType].ONCLOSE ? Function("sAction", "return " + params[msgType].ONCLOSE) : null,` && |\n| &&
|
||||
` actions: params[msgType].ACTIONS ? params[msgType].ACTIONS : 'OK',` && |\n| &&
|
||||
` emphasizedAction: params[msgType].EMPHASIZEDACTION ? params[msgType].EMPHASIZEDACTION : 'OK',` && |\n| &&
|
||||
` initialFocus: params[msgType].INITIALFOCUS ? params[msgType].INITIALFOCUS : null,` && |\n| &&
|
||||
` textDirection: params[msgType].TEXTDIRECTION ? params[msgType].TEXTDIRECTION : 'Inherit',` && |\n| &&
|
||||
` icon: params[msgType].ICON ? params[msgType].ICON : 'NONE',` && |\n| &&
|
||||
` details: params[msgType].DETAILS ? params[msgType].DETAILS : '',` && |\n| &&
|
||||
` closeOnNavigation: params[msgType].CLOSEONNAVIGATION ? true : false` && |\n| &&
|
||||
` })` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` z2ui5.oView.setModel(z2ui5.oDeviceModel, "device");` && |\n| &&
|
||||
` this._oApp.removeAllPages();` && |\n| &&
|
||||
` this._oApp.insertPage(z2ui5.oView);` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` })` && |\n| &&
|
||||
`});` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` setApp(oApp) {` && |\n| &&
|
||||
` this._oApp = oApp;` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` async displayView(xml, viewModel) {` && |\n| &&
|
||||
` let oview_model = new JSONModel(viewModel);` && |\n| &&
|
||||
` z2ui5.oView = await XMLView.create({` && |\n| &&
|
||||
` definition: xml,` && |\n| &&
|
||||
` models: oview_model,` && |\n| &&
|
||||
` controller: z2ui5.oController,` && |\n| &&
|
||||
` id: 'mainView',` && |\n| &&
|
||||
` preprocessors: {` && |\n| &&
|
||||
` xml: {` && |\n| &&
|
||||
` models: {` && |\n| &&
|
||||
` template: oview_model` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` z2ui5.oView.setModel(z2ui5.oDeviceModel, "device");` && |\n| &&
|
||||
` this._oApp.removeAllPages();` && |\n| &&
|
||||
` this._oApp.insertPage(z2ui5.oView);` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` })` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
``.
|
||||
|
||||
ENDMETHOD.
|
||||
|
|
Loading…
Reference in New Issue
Block a user