Ui5 v2 adjustments (#1578)

* update

* update

* Update abaplint.jsonc

* update

* update

* fixes
This commit is contained in:
oblomov-dev 2024-11-26 13:57:54 +01:00 committed by GitHub
parent 43550ff667
commit 0f155af743
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 99 additions and 65 deletions

View File

@ -16,4 +16,4 @@ jobs:
with:
node-version: '20.11.0'
- run: cd app && npm i
- run: cd app && npm install --global @ui5/linter && ui5lint --details
- run: cd app && npm install --global @ui5/linter && ui5lint --ignore-pattern "webapp/index.html" --details

View File

@ -31,7 +31,7 @@
"undeploy": "cf undeploy z2ui5 --delete-services --delete-service-keys --delete-service-brokers",
"deploy-test": "npm run build && fiori deploy --config ui5-deploy.yaml --testMode true",
"build:cf": "ui5 build preload --clean-dest --config ui5-deploy.yaml --include-task=generateCachebusterInfo",
"transform": "node ../ci/app2string/trans2abap.js && abaplint --fix ../ci/app2string/abaplint.jsonc",
"transform": "node ../ci/app2string/trans2abap.js",
"build:mta": "rimraf resources mta_archives && mbt build"
},
"sapuxLayer": "CUSTOMER_BASE"

View File

@ -16,9 +16,9 @@ sap.ui.define(["sap/ui/core/UIComponent", "z2ui5/model/models","z2ui5/cc/Server"
z2ui5.oConfig.ComponentData = this.getComponentData();
try {
z2ui5.oLaunchpadService = await this.getService("ShellUIService");
} catch (e) {}
z2ui5.oLaunchpadService = await this.getService("ShellUIService");
} catch (e) {}
let oVersionInfo = await VersionInfo.load();
z2ui5.oConfig.UI5VersionInfo = {
version : oVersionInfo.version,

View File

@ -639,7 +639,7 @@ sap.ui.define("z2ui5/MultiInputExt", ["sap/ui/core/Control", "sap/m/Token", "sap
let table = z2ui5.oView.byId(this.getProperty("MultiInputId"));
if (!table) {
try {
table = Core.byId(Element.getElementsByName(this.getProperty("MultiInputName"))[0].id.replace('-inner', ''));
// table = Core.byId(Element.getElementsByName(this.getProperty("MultiInputName"))[0].id.replace('-inner', ''));
} catch (e) {
return;
}
@ -667,8 +667,10 @@ sap.ui.define("z2ui5/MultiInputExt", ["sap/ui/core/Control", "sap/m/Token", "sap
);
sap.ui.define("z2ui5/CameraPicture" , [
"sap/ui/core/Control"
], function (Control) {
"sap/ui/core/Control",
"sap/m/Dialog",
"sap/m/Button"
], function (Control, Dialog, Button) {
"use strict";
return Control.extend("z2ui5.CameraPicture", {
metadata: {
@ -708,30 +710,30 @@ sap.ui.define("z2ui5/CameraPicture" , [
onPicture: function (oEvent) {
if (!this._oScanDialog) {
this._oScanDialog = new sap.m.Dialog({
this._oScanDialog = new Dialog({
title: "Device Photo Function",
contentWidth: "640px",
contentHeight: "480px",
horizontalScrolling: false,
verticalScrolling: false,
stretchOnPhone: true,
stretch: true,
content: [
new sap.ui.core.HTML({
new HTML({
id: this.getId() + 'PictureContainer',
content: '<video width="600px" height="400px" autoplay="true" id="zvideo">'
}),
new sap.m.Button({
new Button({
text: "Capture",
press: function (oEvent) {
this.capture();
this._oScanDialog.close();
}.bind(this)
}),
new sap.ui.core.HTML({
new HTML({
content: '<canvas hidden id="zcanvas" style="overflow:auto"></canvas>'
}),
],
endButton: new sap.m.Button({
endButton: new Button({
text: "Cancel",
press: function (oEvent) {
this._oScanDialog.close();
@ -759,7 +761,7 @@ sap.ui.define("z2ui5/CameraPicture" , [
renderer: function (oRM, oControl) {
var oButton = new sap.m.Button({
var oButton = new Button({
icon: "sap-icon://camera",
text: "Camera",
press: oControl.onPicture.bind(oControl),
@ -817,7 +819,7 @@ sap.ui.define("z2ui5/Util", [], () => {
"use strict";
return {
DateCreateObject: (s) => new Date(s),
DateAbapTimestampToDate: (sTimestamp) => new sap.gantt.misc.Format.abapTimestampToDate(sTimestamp),
// DateAbapTimestampToDate: (sTimestamp) => new sap.gantt.misc.Format.abapTimestampToDate(sTimestamp), commented for UI5 2.x compatibility
DateAbapDateToDateObject: (d) => new Date(d.slice(0, 4), parseInt(d.slice(4, 6)) - 1, d.slice(6, 8)),
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)),
};

View File

@ -248,26 +248,40 @@ sap.ui.define(["sap/ui/core/mvc/Controller", "sap/ui/core/mvc/XMLView", "sap/ui/
a.click();
break;
case 'CROSS_APP_NAV_TO_PREV_APP':
oCrossAppNavigator = sap.ushell.Container.getService("CrossApplicationNavigation");
oCrossAppNavigator.backToPreviousApp();
sap.ui.require([
"sap/ushell/Container"
], async (ushellContainer) => {
// z2ui5.oCrossAppNavigator = await ushellContainer.getServiceAsync("CrossApplicationNavigation");
z2ui5.oCrossAppNavigator = ushellContainer.getService("CrossApplicationNavigation");
z2ui5.oCrossAppNavigator.backToPreviousApp();
});
//oCrossAppNavigator = sap.ushell.Container.getService("CrossApplicationNavigation");
break;
case 'CROSS_APP_NAV_TO_EXT':
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
}
});
}
z2ui5.args = args;
sap.ui.require([
"sap/ushell/Container"
], async (ushellContainer) => {
// z2ui5.oCrossAppNavigator = await ushellContainer.getServiceAsync("CrossApplicationNavigation");
z2ui5.oCrossAppNavigator = ushellContainer.getService("CrossApplicationNavigation");
const hash = (z2ui5.oCrossAppNavigator.hrefForExternal({
target: z2ui5.args[1],
params: z2ui5.args[2]
})) || "";
if (z2ui5.args[3] === 'EXT') {
let url = window.location.href.split('#')[0] + hash;
//todo
//URLHelper.redirect(url, true);
} else {
z2ui5.oCrossAppNavigator.toExternal({
target: {
shellHash: hash
}
});
}
});
break;
case 'LOCATION_RELOAD':
window.location = args[1];

View File

@ -82,7 +82,7 @@
"commented_code": false,
"constant_classes": true,
"constructor_visibility_public": true,
"contains_tab": true,
"contains_tab": false,
"cyclic_oo": false,
"cyclomatic_complexity": {
"exclude": [],

View File

@ -661,7 +661,7 @@ CLASS z2ui5_cl_app_app_js IMPLEMENTATION.
` let table = z2ui5.oView.byId(this.getProperty("MultiInputId"));` && |\n| &&
` if (!table) {` && |\n| &&
` try {` && |\n| &&
` table = Core.byId(Element.getElementsByName(this.getProperty("MultiInputName"))[0].id.replace('-inner', ''));` && |\n| &&
` // table = Core.byId(Element.getElementsByName(this.getProperty("MultiInputName"))[0].id.replace('-inner', ''));` && |\n| &&
` } catch (e) {` && |\n| &&
` return;` && |\n| &&
` }` && |\n| &&
@ -689,8 +689,10 @@ CLASS z2ui5_cl_app_app_js IMPLEMENTATION.
`);` && |\n| &&
`` && |\n| &&
`sap.ui.define("z2ui5/CameraPicture" , [` && |\n| &&
` "sap/ui/core/Control"` && |\n| &&
`], function (Control) {` && |\n| &&
` "sap/ui/core/Control",` && |\n| &&
` "sap/m/Dialog",` && |\n| &&
` "sap/m/Button"` && |\n| &&
`], function (Control, Dialog, Button) {` && |\n| &&
` "use strict";` && |\n| &&
` return Control.extend("z2ui5.CameraPicture", {` && |\n| &&
` metadata: {` && |\n| &&
@ -730,30 +732,30 @@ CLASS z2ui5_cl_app_app_js IMPLEMENTATION.
` onPicture: function (oEvent) {` && |\n| &&
`` && |\n| &&
` if (!this._oScanDialog) {` && |\n| &&
` this._oScanDialog = new sap.m.Dialog({` && |\n| &&
` this._oScanDialog = new Dialog({` && |\n| &&
` title: "Device Photo Function",` && |\n| &&
` contentWidth: "640px",` && |\n| &&
` contentHeight: "480px",` && |\n| &&
` horizontalScrolling: false,` && |\n| &&
` verticalScrolling: false,` && |\n| &&
` stretchOnPhone: true,` && |\n| &&
` stretch: true,` && |\n| &&
` content: [` && |\n| &&
` new sap.ui.core.HTML({` && |\n| &&
` new HTML({` && |\n| &&
` id: this.getId() + 'PictureContainer',` && |\n| &&
` content: '<video width="600px" height="400px" autoplay="true" id="zvideo">'` && |\n| &&
` }),` && |\n| &&
` new sap.m.Button({` && |\n| &&
` new Button({` && |\n| &&
` text: "Capture",` && |\n| &&
` press: function (oEvent) {` && |\n| &&
` this.capture();` && |\n| &&
` this._oScanDialog.close();` && |\n| &&
` }.bind(this)` && |\n| &&
` }),` && |\n| &&
` new sap.ui.core.HTML({` && |\n| &&
` new HTML({` && |\n| &&
` content: '<canvas hidden id="zcanvas" style="overflow:auto"></canvas>'` && |\n| &&
` }),` && |\n| &&
` ],` && |\n| &&
` endButton: new sap.m.Button({` && |\n| &&
` endButton: new Button({` && |\n| &&
` text: "Cancel",` && |\n| &&
` press: function (oEvent) {` && |\n| &&
` this._oScanDialog.close();` && |\n| &&
@ -781,7 +783,7 @@ CLASS z2ui5_cl_app_app_js IMPLEMENTATION.
`` && |\n| &&
` renderer: function (oRM, oControl) {` && |\n| &&
`` && |\n| &&
` var oButton = new sap.m.Button({` && |\n| &&
` var oButton = new Button({` && |\n| &&
` icon: "sap-icon://camera",` && |\n| &&
` text: "Camera",` && |\n| &&
` press: oControl.onPicture.bind(oControl),` && |\n| &&
@ -839,7 +841,7 @@ CLASS z2ui5_cl_app_app_js IMPLEMENTATION.
` "use strict";` && |\n| &&
` return {` && |\n| &&
` DateCreateObject: (s) => new Date(s),` && |\n| &&
` DateAbapTimestampToDate: (sTimestamp) => new sap.gantt.misc.Format.abapTimestampToDate(sTimestamp),` && |\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| &&
` 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| &&

View File

@ -37,7 +37,7 @@ CLASS z2ui5_cl_app_component_js IMPLEMENTATION.
`` && |\n| &&
` try {` && |\n| &&
` z2ui5.oLaunchpadService = await this.getService("ShellUIService");` && |\n| &&
` } catch (e) {}` && |\n| &&
` } catch (e) {}` && |\n| &&
`` && |\n| &&
` let oVersionInfo = await VersionInfo.load();` && |\n| &&
` z2ui5.oConfig.UI5VersionInfo = {` && |\n| &&

View File

@ -268,26 +268,40 @@ CLASS z2ui5_cl_app_view1_js IMPLEMENTATION.
` a.click();` && |\n| &&
` break;` && |\n| &&
` case 'CROSS_APP_NAV_TO_PREV_APP':` && |\n| &&
` oCrossAppNavigator = sap.ushell.Container.getService("CrossApplicationNavigation");` && |\n| &&
` oCrossAppNavigator.backToPreviousApp();` && |\n| &&
` sap.ui.require([` && |\n| &&
` "sap/ushell/Container"` && |\n| &&
` ], async (ushellContainer) => {` && |\n| &&
` // z2ui5.oCrossAppNavigator = await ushellContainer.getServiceAsync("CrossApplicationNavigation");` && |\n| &&
` z2ui5.oCrossAppNavigator = ushellContainer.getService("CrossApplicationNavigation");` && |\n| &&
` z2ui5.oCrossAppNavigator.backToPreviousApp();` && |\n| &&
` });` && |\n| &&
`` && |\n| &&
` //oCrossAppNavigator = sap.ushell.Container.getService("CrossApplicationNavigation");` && |\n| &&
`` && |\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| &&
` //todo` && |\n| &&
` //URLHelper.redirect(url, true);` && |\n| &&
` } else {` && |\n| &&
` oCrossAppNavigator.toExternal({` && |\n| &&
` target: {` && |\n| &&
` shellHash: hash` && |\n| &&
` }` && |\n| &&
` });` && |\n| &&
` }` && |\n| &&
` z2ui5.args = args;` && |\n| &&
` sap.ui.require([` && |\n| &&
` "sap/ushell/Container"` && |\n| &&
` ], async (ushellContainer) => {` && |\n| &&
` // z2ui5.oCrossAppNavigator = await ushellContainer.getServiceAsync("CrossApplicationNavigation");` && |\n| &&
` z2ui5.oCrossAppNavigator = ushellContainer.getService("CrossApplicationNavigation");` && |\n| &&
` const hash = (z2ui5.oCrossAppNavigator.hrefForExternal({` && |\n| &&
` target: z2ui5.args[1],` && |\n| &&
` params: z2ui5.args[2]` && |\n| &&
` })) || "";` && |\n| &&
` if (z2ui5.args[3] === 'EXT') {` && |\n| &&
` let url = window.location.href.split('#')[0] + hash;` && |\n| &&
` //todo` && |\n| &&
` //URLHelper.redirect(url, true);` && |\n| &&
` } else {` && |\n| &&
` z2ui5.oCrossAppNavigator.toExternal({` && |\n| &&
` target: {` && |\n| &&
` shellHash: hash` && |\n| &&
` }` && |\n| &&
` });` && |\n| &&
` }` && |\n| &&
` });` && |\n| &&
` break;` && |\n| &&
` case 'LOCATION_RELOAD':` && |\n| &&
` window.location = args[1];` && |\n| &&
@ -504,6 +518,8 @@ CLASS z2ui5_cl_app_view1_js IMPLEMENTATION.
` }` && |\n| &&
` });` && |\n| &&
` z2ui5.oView.setModel(z2ui5.oDeviceModel, "device");` && |\n| &&
|\n|.
result = result &&
` this._oApp.removeAllPages();` && |\n| &&
` this._oApp.insertPage(z2ui5.oView);` && |\n| &&
` },` && |\n| &&