New frontend test (#1466)

* update

* update ui52abap auto taransformation

* update

* commit changes

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* Update abaplint.jsonc

* update

* update

* update

* update

* update

* update

* update

* update

* Update abaplint.jsonc

* update

* update

* update

* update

* update
This commit is contained in:
oblomov-dev 2024-10-01 00:25:48 +02:00 committed by GitHub
parent 5280439bac
commit 30f8cec526
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
90 changed files with 18447 additions and 301 deletions

10
app/.gitignore vendored Normal file
View File

@ -0,0 +1,10 @@
node_modules/
dist/
.scp/
.env
Makefile*.mta
mta_archives
mta-*
resources
archive.zip
.*_mta_build_tmp

36
app/README.md Normal file
View File

@ -0,0 +1,36 @@
## abap2UI5 - SAP BTP Connector
_Running into problems or found a bug? Create an issue [**here**](https://github.com/abap2UI5/abap2UI5/issues)_
### Key Features
* **BTP Connector:** Host your abap2UI5 apps on SAP Build Workzone Launchpad & SAP Mobile Start<br>
* **User-Friendly:** Launch different backend apps simply by adjusting the start parameter "app_start"<br>
* **Project Consistency:** The framework and all abap2UI5 apps can remain unchanged in your ABAP system<br>
* **Compatibility:** Runs with all ABAP Backend Systems (SAP NetWeaver version 7.02 or higher, S/4HANA On-Premise, S/4HANA Private Cloud, S/4HANA Public Cloud)
* **Installation:** Deploy this Repository to SAP BTP
### Integration Scenarios
##### 1/3 - Connect your ABAP System to SAP BTP and access your abap2UI5 Apps from anywhere
<img width="700" alt="image" src="https://github.com/abap2UI5/abap2UI5-btp_proxy_app/assets/102328295/110c0810-1a57-4a16-b8c2-c88d35be7002">
<br>
<img width="600" alt="Bildschirmfoto 2023-12-06 um 10 46 55" src="https://github.com/abap2UI5/abap2UI5-btp_proxy_app/assets/102328295/1fd174a8-86e8-4303-88b8-76b20df5a087">
##### 2/3 - Launch your abap2UI5 Apps using SAP Build Workzone Launchpad [(here)](https://github.com/abap2UI5/abap2UI5-documentation/blob/main/docs/ext-business_technology_platform/04_build_workzone_configuration.md)
<img width="700" alt="image" src="https://github.com/abap2UI5/abap2UI5-btp_proxy_app/assets/102328295/1def3a77-1887-4807-be6f-619d1c2526ae">
<br>
<img width="600" alt="image" src="https://github.com/abap2UI5/integration-fiori_launchpad_on_premise/assets/102328295/0267f17a-b2ab-4e69-937f-24f2204f4b13">
##### 3/3 - Launch your abap2UI5 Apps using SAP Mobile Start [(here)](https://github.com/abap2UI5/abap2UI5-documentation/blob/main/docs/ext-business_technology_platform/05_mobile_start_configuration.md)
<img width="700" alt="image" src="https://github.com/abap2UI5/abap2UI5-btp_proxy_app/assets/102328295/e895e772-0705-425c-9fb9-deed7d304642">
<br>
<img width="600" alt="image" src="https://github.com/abap2UI5/integration-fiori_launchpad_on_premise/assets/102328295/d8caa3cb-7bb0-4a96-bc32-086c6238e22f">
### Installation
[1. Installation & Configuration of SAP BTP](https://www.linkedin.com/pulse/abap2ui5-integration-sap-business-technology-platform-13-installation-lf1re/?trackingId=YQ0y%2Fq0y6Kw5PK8chNCbrw%3D%3D&trk=article-ssr-frontend-pulse_little-text-block)<br>
[2. Setup SAP Build WorkZone](https://www.linkedin.com/pulse/abap2ui5-integration-sap-business-technology-platform-23-setup-ujdqe/?trackingId=vFwHvpI9oBk2igiz5P5CWA%3D%3D&trk=article-ssr-frontend-pulse_little-text-block)<br>
[3. Setup SAP Mobile Start](https://www.linkedin.com/pulse/abap2ui5-integration-sap-business-technology-platform-33-setup-uzure?trk=article-ssr-frontend-pulse_more-articles_related-content-card)<br>
### FAQ
* your comments, questions, wishes and bugs are welcome, please create an [**issue**](https://github.com/abap2UI5/ext-business_technology_platform/issues)

1
app/auto/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules

21
app/auto/LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 abap2UI5
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

149
app/auto/README.md Normal file
View File

@ -0,0 +1,149 @@
# webapp_transform_to
🚧 transform webapp to bsp/stringifiedABAP 🚧
#### Run ui5app->bsp
```
npm i
node transform2bsp.js
```
#### Run ui5app->abapstring
```
npm i
node transform2abap.js
```
#### Script bsp
```js
const fs = require('fs-extra');
const path = require('path');
const sourceDir = 'source/webapp';
const targetDir = 'target/src/02';
function transformFileName(filePath) {
const relativePath = path.relative(sourceDir, filePath);
const transformedName = `z2ui5.wapa.${relativePath.replace(/\//g, '_')}`;
return path.join(targetDir, transformedName);
}
async function transformFiles(dir) {
const entries = await fs.readdir(dir, { withFileTypes: true });
for (const entry of entries) {
const srcPath = path.join(dir, entry.name);
if (entry.isDirectory()) {
await transformFiles(srcPath);
} else if (entry.isFile()) {
const destFilePath = transformFileName(srcPath);
const destDir = path.dirname(destFilePath);
await fs.ensureDir(destDir);
await fs.copy(srcPath, destFilePath);
console.log(`Copied and renamed ${srcPath} to ${destFilePath}`);
}
}
}
transformFiles(sourceDir).catch(err => console.error('Error transforming files:', err));
```
#### Script abap
```js
const fs = require('fs');
const path = require('path');
const abapClassTemplate = require('./abapClassTemplate');
const xmlTemplate = require('./abapXMLTemplate');
// Define source and target directories
const sourceDir = path.join(__dirname, 'source/webapp');
const targetDir = path.join(__dirname, 'target_abap');
// Function to read the file content from the source directory
function readFileContent(filePath) {
return fs.promises.readFile(filePath, 'utf-8');
}
// Function to create a new file in the target directory
function createFileInTargetDir(targetFilePath, content) {
return fs.promises.writeFile(targetFilePath, content, 'utf-8');
}
// Function to format the content into an ABAP class method
function formatAsAbapClass(content, className) {
const formattedContent = content.split('\n').map(line => {
let formattedLine = '';
while (line.length > 100) {
formattedLine += ` \`${line.substring(0, 100).replace(/`/g, '``')}\` && |\\n| &&\n`;
line = line.substring(100);
}
formattedLine += ` \`${line.replace(/`/g, '``')}\` && |\\n| &&`;
return formattedLine;
}).join('\n');
return abapClassTemplate(className, formattedContent);
}
// Function to generate a class name from a file path
function generateClassName(filePath) {
const relativePath = path.relative(sourceDir, filePath);
const parts = relativePath.split(path.sep);
const fileName = parts.pop().split('.');
if (fileName.length > 2) {
fileName.splice(1, 1); // Remove the middle part
}
const folderPath = parts.join('_').toLowerCase();
return `z2ui5_cl_app_${folderPath}_${fileName.join('_')}`;
}
// Function to recursively get all files in a directory
function getAllFiles(dirPath, arrayOfFiles) {
const files = fs.readdirSync(dirPath);
arrayOfFiles = arrayOfFiles || [];
files.forEach(file => {
const filePath = path.join(dirPath, file);
if (fs.statSync(filePath).isDirectory()) {
arrayOfFiles = getAllFiles(filePath, arrayOfFiles);
} else {
arrayOfFiles.push(filePath);
}
});
return arrayOfFiles;
}
// Main function to read the source files and create new target files
async function main() {
try {
const files = getAllFiles(sourceDir);
for (const file of files) {
const sourceContent = await readFileContent(file);
console.log(`Source file content fetched successfully for ${file}.`);
const className = generateClassName(file);
const abapClassContent = formatAsAbapClass(sourceContent, className);
const targetFilePath = path.join(targetDir, `${className}.clas.abap`);
await createFileInTargetDir(targetFilePath, abapClassContent);
console.log(`Target file created successfully at: ${targetFilePath}`);
const xmlContent = xmlTemplate(className, `abap2UI5 - ${path.basename(file)}`);
const xmlFilePath = path.join(targetDir, `${className}.clas.xml`);
await createFileInTargetDir(xmlFilePath, xmlContent);
console.log(`XML file created successfully at: ${xmlFilePath}`);
}
} catch (error) {
console.error('Error:', error.message);
}
}
// Run the main function
main();
```

View File

@ -0,0 +1,29 @@
module.exports = function(className, formattedContent) {
return `CLASS ${className} DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
CLASS-METHODS get
RETURNING
VALUE(result) TYPE string.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS ${className} IMPLEMENTATION.
METHOD get.
result = ${formattedContent}
\`\`.
ENDMETHOD.
ENDCLASS.
`;
};

View File

@ -0,0 +1,19 @@
module.exports = function(className, description) {
return `<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<VSEOCLASS>
<CLSNAME>${className.toUpperCase()}</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>${className.toUpperCase()}</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>
<UNICODE>X</UNICODE>
</VSEOCLASS>
</asx:values>
</asx:abap>
</abapGit>
`;
};

82
app/auto/package-lock.json generated Normal file
View File

@ -0,0 +1,82 @@
{
"name": "webapp_to_bsp",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"dependencies": {
"fs-extra": "^11.2.0",
"xml2js": "^0.6.2"
}
},
"node_modules/fs-extra": {
"version": "11.2.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz",
"integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==",
"license": "MIT",
"dependencies": {
"graceful-fs": "^4.2.0",
"jsonfile": "^6.0.1",
"universalify": "^2.0.0"
},
"engines": {
"node": ">=14.14"
}
},
"node_modules/graceful-fs": {
"version": "4.2.11",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
"integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==",
"license": "ISC"
},
"node_modules/jsonfile": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
"integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
"license": "MIT",
"dependencies": {
"universalify": "^2.0.0"
},
"optionalDependencies": {
"graceful-fs": "^4.1.6"
}
},
"node_modules/sax": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.4.1.tgz",
"integrity": "sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg==",
"license": "ISC"
},
"node_modules/universalify": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz",
"integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==",
"license": "MIT",
"engines": {
"node": ">= 10.0.0"
}
},
"node_modules/xml2js": {
"version": "0.6.2",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.6.2.tgz",
"integrity": "sha512-T4rieHaC1EXcES0Kxxj4JWgaUQHDk+qwHcYOCFHfiwKz7tOVPLq7Hjq9dM1WCMhylqMEfP7hMcOIChvotiZegA==",
"license": "MIT",
"dependencies": {
"sax": ">=0.6.0",
"xmlbuilder": "~11.0.0"
},
"engines": {
"node": ">=4.0.0"
}
},
"node_modules/xmlbuilder": {
"version": "11.0.1",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz",
"integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==",
"license": "MIT",
"engines": {
"node": ">=4.0"
}
}
}
}

6
app/auto/package.json Normal file
View File

@ -0,0 +1,6 @@
{
"dependencies": {
"fs-extra": "^11.2.0",
"xml2js": "^0.6.2"
}
}

130
app/auto/transform2abap.js Normal file
View File

@ -0,0 +1,130 @@
const fs = require('fs');
const path = require('path');
const abapClassTemplate = require('./abapClassTemplate');
const xmlTemplate = require('./abapXMLTemplate');
// Define source and target directories
const sourceDir = path.join(__dirname, '../webapp');
const targetDir = path.join(__dirname, '../../src/01/99');
// Initial XML content
const initialXMLContent = `<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_DEVC" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<DEVC>
<CTEXT>abap2UI5 - app (generated)</CTEXT>
</DEVC>
</asx:values>
</asx:abap>
</abapGit>`;
// Function to read the file content from the source directory
function readFile(filePath) {
return fs.promises.readFile(filePath, 'utf-8');
}
// Function to create a new file in the target directory
function createFileInTargetDir(targetFilePath, content) {
return fs.promises.writeFile(targetFilePath, content, 'utf-8');
}
// Function to format the content into an ABAP class method
function formatAsAbapClass(content, className, isSpecialFile) {
const lines = content.split('\n');
const formattedLines = lines.map((line, index) => {
line = line.replace(/\s+$/, ''); // Remove trailing spaces
const formattedLine = ` \`${line.replace(/`/g, '``')}\` && ${isSpecialFile ? '' : '|\\n| &&'}`;
if ((index + 1) % 500 === 0) {
return `${formattedLine}\n |\\n|.\n result = result &&`;
}
return formattedLine;
});
return abapClassTemplate(className, formattedLines.join('\n'));
}
// Function to generate a class name from a file path
function generateClassName(filePath) {
const relativePath = path.relative(sourceDir, filePath);
const parts = relativePath.split(path.sep);
const fileName = parts.pop().split('.');
if (fileName.length > 2) {
fileName.splice(1, 1); // Remove the middle part
}
const folderPath = parts.map(part => part.substring(0, 4)).join('_').toLowerCase();
return `z2ui5_cl_app_${folderPath}_${fileName.join('_')}`;
}
// Function to recursively get all files in a directory
function getAllFiles(dirPath, arrayOfFiles) {
const files = fs.readdirSync(dirPath);
arrayOfFiles = arrayOfFiles || [];
files.forEach(file => {
const filePath = path.join(dirPath, file);
if (fs.statSync(filePath).isDirectory()) {
arrayOfFiles = getAllFiles(filePath, arrayOfFiles);
} else {
arrayOfFiles.push(filePath);
}
});
return arrayOfFiles;
}
// Function to delete the target directory
function deleteTargetDir(dirPath) {
if (fs.existsSync(dirPath)) {
fs.readdirSync(dirPath).forEach(file => {
const curPath = path.join(dirPath, file);
if (fs.lstatSync(curPath).isDirectory()) {
deleteTargetDir(curPath);
} else {
fs.unlinkSync(curPath);
}
});
fs.rmdirSync(dirPath);
}
}
// Main function to read the source files and create new target files
async function main() {
try {
// Delete the target directory if it exists
deleteTargetDir(targetDir);
// Recreate the target directory
fs.mkdirSync(targetDir, { recursive: true });
// Create the initial XML file
const initialXMLFilePath = path.join(targetDir, 'package.devc.xml');
await createFileInTargetDir(initialXMLFilePath, initialXMLContent);
console.log(`Initial XML file created successfully at: ${initialXMLFilePath}`);
const files = getAllFiles(sourceDir);
for (const file of files) {
let sourceContent = await readFile(file);
console.log(`Source file content fetched successfully for ${file}.`);
const className = generateClassName(file);
const isSpecialFile = file.endsWith('.xml') || file.endsWith('.json') || file.endsWith('.html');
const abapClassContent = formatAsAbapClass(sourceContent, className, isSpecialFile);
const targetFilePath = path.join(targetDir, `${className.toLowerCase()}.clas.abap`);
await createFileInTargetDir(targetFilePath, abapClassContent);
console.log(`Target file created successfully at: ${targetFilePath}`);
const xmlContent = xmlTemplate(className, `abap2UI5 - ${path.basename(file)}`);
const xmlFilePath = path.join(targetDir, `${className.toLowerCase()}.clas.xml`);
await createFileInTargetDir(xmlFilePath, `\uFEFF${xmlContent}`);
console.log(`XML file created successfully at: ${xmlFilePath}`);
}
} catch (error) {
console.error('Error:', error.message);
}
}
// Run the main function
main();

31
app/auto/transform2bsp.js Normal file
View File

@ -0,0 +1,31 @@
const fs = require('fs-extra');
const path = require('path');
const sourceDir = 'source/webapp';
const targetDir = 'target_bsp/';
function transformFileName(filePath) {
const relativePath = path.relative(sourceDir, filePath);
const transformedName = `z2ui5.wapa.${relativePath.replace(/\//g, '_')}`;
return path.join(targetDir, transformedName);
}
async function transformFiles(dir) {
const entries = await fs.readdir(dir, { withFileTypes: true });
for (const entry of entries) {
const srcPath = path.join(dir, entry.name);
if (entry.isDirectory()) {
await transformFiles(srcPath);
} else if (entry.isFile()) {
const destFilePath = transformFileName(srcPath);
const destDir = path.dirname(destFilePath);
await fs.ensureDir(destDir);
await fs.copy(srcPath, destFilePath);
console.log(`Copied and renamed ${srcPath} to ${destFilePath}`);
}
}
}
transformFiles(sourceDir).catch(err => console.error('Error transforming files:', err));

View File

@ -0,0 +1,259 @@
<?xml version="1.0"?>
<UI5RepMapping version="1.0" xmlns="sap.ui5.tools.repository.mapping">
<MappingEntries>
<MappingEntry
path = "Component.js"
is_folder = ""
internal_rep = "B"
internal_rep_path = "Component.js" />
<MappingEntry
path = "cc"
is_folder = "X"
internal_rep = ""
internal_rep_path = "" />
<MappingEntry
path = "cc/DebugTool.fragment.xml"
is_folder = ""
internal_rep = "B"
internal_rep_path = "cc/DebugTool.fragment.xml" />
<MappingEntry
path = "cc/DebugTool.js"
is_folder = ""
internal_rep = "B"
internal_rep_path = "cc/DebugTool.js" />
<MappingEntry
path = "cc/Server.js"
is_folder = ""
internal_rep = "B"
internal_rep_path = "cc/Server.js" />
<MappingEntry
path = "controller"
is_folder = "X"
internal_rep = ""
internal_rep_path = "" />
<MappingEntry
path = "controller/App.controller.js"
is_folder = ""
internal_rep = "B"
internal_rep_path = "controller/App.controller.js" />
<MappingEntry
path = "controller/View1.controller.js"
is_folder = ""
internal_rep = "B"
internal_rep_path = "controller/View1.controller.js" />
<MappingEntry
path = "css"
is_folder = "X"
internal_rep = ""
internal_rep_path = "" />
<MappingEntry
path = "css/style.css"
is_folder = ""
internal_rep = "B"
internal_rep_path = "css/style.css" />
<MappingEntry
path = "i18n"
is_folder = "X"
internal_rep = ""
internal_rep_path = "" />
<MappingEntry
path = "i18n/i18n.properties"
is_folder = ""
internal_rep = "B"
internal_rep_path = "i18n/i18n.properties" />
<MappingEntry
path = "index.html"
is_folder = ""
internal_rep = "B"
internal_rep_path = "index.html" />
<MappingEntry
path = "manifest.json"
is_folder = ""
internal_rep = "B"
internal_rep_path = "manifest.json" />
<MappingEntry
path = "model"
is_folder = "X"
internal_rep = ""
internal_rep_path = "" />
<MappingEntry
path = "model/models.js"
is_folder = ""
internal_rep = "B"
internal_rep_path = "model/models.js" />
<MappingEntry
path = "test"
is_folder = "X"
internal_rep = ""
internal_rep_path = "" />
<MappingEntry
path = "test/flpSandbox.html"
is_folder = ""
internal_rep = "B"
internal_rep_path = "test/flpSandbox.html" />
<MappingEntry
path = "test/flpSandbox.js"
is_folder = ""
internal_rep = "B"
internal_rep_path = "test/flpSandbox.js" />
<MappingEntry
path = "test/initFlpSandbox.js"
is_folder = ""
internal_rep = "B"
internal_rep_path = "test/initFlpSandbox.js" />
<MappingEntry
path = "test/integration"
is_folder = "X"
internal_rep = ""
internal_rep_path = "" />
<MappingEntry
path = "test/integration/AllJourneys.js"
is_folder = ""
internal_rep = "B"
internal_rep_path = "test/integration/AllJourneys.js" />
<MappingEntry
path = "test/integration/NavigationJourney.js"
is_folder = ""
internal_rep = "B"
internal_rep_path = "test/integration/NavigationJourney.js" />
<MappingEntry
path = "test/integration/arrangements"
is_folder = "X"
internal_rep = ""
internal_rep_path = "" />
<MappingEntry
path = "test/integration/arrangements/Startup.js"
is_folder = ""
internal_rep = "B"
internal_rep_path = "test/integration/arrangements/Startup.js" />
<MappingEntry
path = "test/integration/opaTests.qunit.html"
is_folder = ""
internal_rep = "B"
internal_rep_path = "test/integration/opaTests.qunit.html" />
<MappingEntry
path = "test/integration/opaTests.qunit.js"
is_folder = ""
internal_rep = "B"
internal_rep_path = "test/integration/opaTests.qunit.js" />
<MappingEntry
path = "test/integration/pages"
is_folder = "X"
internal_rep = ""
internal_rep_path = "" />
<MappingEntry
path = "test/integration/pages/App.js"
is_folder = ""
internal_rep = "B"
internal_rep_path = "test/integration/pages/App.js" />
<MappingEntry
path = "test/integration/pages/View1.js"
is_folder = ""
internal_rep = "B"
internal_rep_path = "test/integration/pages/View1.js" />
<MappingEntry
path = "test/locate-reuse-libs.js"
is_folder = ""
internal_rep = "B"
internal_rep_path = "UI556BC4A63F9BB8A077ADC9EDF2158A3EDA5B15CEF" />
<MappingEntry
path = "test/testsuite.qunit.html"
is_folder = ""
internal_rep = "B"
internal_rep_path = "test/testsuite.qunit.html" />
<MappingEntry
path = "test/testsuite.qunit.js"
is_folder = ""
internal_rep = "B"
internal_rep_path = "test/testsuite.qunit.js" />
<MappingEntry
path = "test/unit"
is_folder = "X"
internal_rep = ""
internal_rep_path = "" />
<MappingEntry
path = "test/unit/AllTests.js"
is_folder = ""
internal_rep = "B"
internal_rep_path = "test/unit/AllTests.js" />
<MappingEntry
path = "test/unit/controller"
is_folder = "X"
internal_rep = ""
internal_rep_path = "" />
<MappingEntry
path = "test/unit/controller/View1.controller.js"
is_folder = ""
internal_rep = "B"
internal_rep_path = "test/unit/controller/View1.controller.js" />
<MappingEntry
path = "test/unit/unitTests.qunit.html"
is_folder = ""
internal_rep = "B"
internal_rep_path = "test/unit/unitTests.qunit.html" />
<MappingEntry
path = "test/unit/unitTests.qunit.js"
is_folder = ""
internal_rep = "B"
internal_rep_path = "test/unit/unitTests.qunit.js" />
<MappingEntry
path = "view"
is_folder = "X"
internal_rep = ""
internal_rep_path = "" />
<MappingEntry
path = "view/App.view.xml"
is_folder = ""
internal_rep = "B"
internal_rep_path = "view/App.view.xml" />
<MappingEntry
path = "view/View1.view.xml"
is_folder = ""
internal_rep = "B"
internal_rep_path = "view/View1.view.xml" />
</MappingEntries>
</UI5RepMapping>

13072
app/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

36
app/package.json Normal file
View File

@ -0,0 +1,36 @@
{
"name": "z2ui5",
"version": "0.0.1",
"description": "",
"keywords": [
"ui5",
"openui5",
"sapui5"
],
"main": "webapp/index.html",
"dependencies": {},
"devDependencies": {
"@ui5/cli": "^3.0.0",
"@sap/ux-ui5-tooling": "1",
"rimraf": "^5.0.5",
"@sap/ui5-builder-webide-extension": "^1.1.9",
"ui5-task-zipper": "^3.1.3",
"mbt": "^1.2.27"
},
"scripts": {
"start": "fiori run --open \"test/flpSandbox.html?sap-ui-xx-viewCache=false#z2ui5-display\"",
"start-local": "fiori run --config ./ui5-local.yaml --open \"test/flpSandbox.html?sap-ui-xx-viewCache=false#z2ui5-display\"",
"build": "ui5 build --config=ui5.yaml --clean-dest --dest dist",
"deploy": "fiori cfDeploy",
"deploy-config": "fiori add deploy-config",
"start-noflp": "fiori run --open \"index.html?sap-ui-xx-viewCache=false\"",
"start-variants-management": "fiori run --open \"preview.html?sap-ui-xx-viewCache=false&fiori-tools-rta-mode=true&sap-ui-rta-skip-flex-validation=true#preview-app\"",
"unit-tests": "fiori run --open 'test/unit/unitTests.qunit.html'",
"int-tests": "fiori run --open 'test/integration/opaTests.qunit.html'",
"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",
"build:mta": "rimraf resources mta_archives && mbt build"
},
"sapuxLayer": "CUSTOMER_BASE"
}

50
app/ui5-local.yaml Normal file
View File

@ -0,0 +1,50 @@
# yaml-language-server: $schema=https://sap.github.io/ui5-tooling/schema/ui5.yaml.json
specVersion: "3.1"
metadata:
name: z2ui5
type: application
framework:
name: SAPUI5
version: 1.128.1
libraries:
- name: sap.m
- name: sap.ui.core
- name: sap.f
- name: sap.suite.ui.generic.template
- name: sap.ui.comp
- name: sap.ui.generic.app
- name: sap.ui.table
- name: sap.ushell
- name: themelib_sap_horizon
server:
customMiddleware:
- name: fiori-tools-appreload
afterMiddleware: compression
configuration:
port: 35729
path: webapp
delay: 300
- name: fiori-tools-proxy
afterMiddleware: compression
configuration:
ignoreCertError: false # If set to true, certificate errors will be ignored. E.g. self-signed certificates will be accepted
backend:
- path: /sap
url: _SYSTEM_
destination: BACKEND_ABAP2UI5
- name: sap-fe-mockserver
beforeMiddleware: csp
configuration:
mountPath: /
services:
- urlPath: /sap/bc/z2ui5
metadataPath: ./webapp/localService/metadata.xml
mockdataPath: ./webapp/localService/data
generateMockData: true
annotations: []
- name: fiori-tools-preview
afterMiddleware: fiori-tools-appreload
configuration:
component: z2ui5
ui5Theme: sap_horizon

37
app/ui5-mock.yaml Normal file
View File

@ -0,0 +1,37 @@
# yaml-language-server: $schema=https://sap.github.io/ui5-tooling/schema/ui5.yaml.json
specVersion: "3.1"
metadata:
name: z2ui5
type: application
server:
customMiddleware:
- name: fiori-tools-proxy
afterMiddleware: compression
configuration:
ignoreCertError: false # If set to true, certificate errors will be ignored. E.g. self-signed certificates will be accepted
ui5:
path:
- /resources
- /test-resources
url: https://ui5.sap.com
backend:
- path: /sap
url: <<<system>>>
destination: BACKEND_ABAP2UI5
- name: fiori-tools-appreload
afterMiddleware: compression
configuration:
port: 35729
path: webapp
delay: 300
- name: sap-fe-mockserver
beforeMiddleware: csp
configuration:
mountPath: /
services:
- urlPath: /sap/bc/z2ui5
metadataPath: ./webapp/localService/metadata.xml
mockdataPath: ./webapp/localService/data
generateMockData: true
annotations: []

30
app/ui5.yaml Normal file
View File

@ -0,0 +1,30 @@
specVersion: "3.1"
metadata:
name: z2ui5
type: application
server:
customMiddleware:
- name: fiori-tools-proxy
afterMiddleware: compression
configuration:
ignoreCertError: false # If set to true, certificate errors will be ignored. E.g. self-signed certificates will be accepted
ui5:
path:
- /resources
- /test-resources
url: https://ui5.sap.com
backend:
- path: /sap
url: _SYSTEM_
destination: BACKEND_ABAP2UI5
- name: fiori-tools-appreload
afterMiddleware: compression
configuration:
port: 35729
path: webapp
delay: 300
- name: fiori-tools-preview
afterMiddleware: fiori-tools-appreload
configuration:
component: z2ui5
ui5Theme: sap_horizon

60
app/webapp/Component.js Normal file
View File

@ -0,0 +1,60 @@
sap.ui.define(["sap/ui/core/UIComponent", "z2ui5/model/models",
"z2ui5/cc/DebugTool","z2ui5/cc/Server", "sap/base/Log","sap/ui/VersionInfo"
], function (UIComponent, models, DebugTool, Server, Log, VersionInfo) {
return UIComponent.extend("z2ui5.Component", {
metadata: {
manifest: "json"
},
init: async function () {
UIComponent.prototype.init.apply(this, arguments);
this.getRouter().initialize();
z2ui5.oRouter = this.getRouter();
this.setModel(models.createDeviceModel(), "device");
this._oLogger = Log.getLogger("abap2UI5");
z2ui5.oConfig = {};
z2ui5.oConfig.ComponentData = this.getComponentData();
try {
z2ui5.oLaunchpadService = await this.getService("ShellUIService");
} catch (e) {}
let oVersionInfo = await VersionInfo.load();
z2ui5.oConfig.UI5VersionInfo = {
version : oVersionInfo.version,
buildTimestamp : oVersionInfo.buildTimestamp,
gav : oVersionInfo.gav,
}
if (/iPad|iPhone/.test(navigator.platform)) {
window.addEventListener("__pagehide", this.__pagehide.bind(this));
} else {
window.addEventListener("__beforeunload", this.__beforeunload.bind(this));
}
document.addEventListener("keydown", function (zEvent) {
if (zEvent?.key === "F12") {
new z2ui5.cc.DebugTool().show();
}
});
},
__beforeunload: function () {
window.removeEventListener("__beforeunload", this.__beforeunload.bind(this));
this.destroy();
},
__pagehide: function () {
window.removeEventListener("__pagehide", this.__pagehide.bind(this));
this.destroy();
},
exit: function () {
Server.endSession();
if (UIComponent.prototype.exit)
UIComponent.prototype.exit.apply(this, arguments);
},
});
});

View File

@ -0,0 +1,104 @@
<core:FragmentDefinition
xmlns="sap.m"
xmlns:mvc="sap.ui.core.mvc"
xmlns:core="sap.ui.core"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:ce="sap.ui.codeeditor"
>
<Dialog
title="abap2UI5 - Debug Tool"
stretch="true"
>
<IconTabHeader
selectedKey="PLAIN"
select="onItemSelect"
>
<items>
<IconTabFilter
text="Config"
key="CONFIG"
enabled="true"
/>
<IconTabFilter
text="Previous Request"
key="REQUEST"
enabled="true"
/>
<IconTabFilter
text="Response"
key="PLAIN"
/>
<IconTabFilter
text="Source Code"
key="SOURCE"
/>
<IconTabFilter
text="View"
key="VIEW"
/>
<IconTabFilter
text="View Model"
key="MODEL"
/>
<IconTabFilter
text="Popup"
key="POPUP"
enabled="{/activePopup}"
/>
<IconTabFilter
text="Popup Model"
key="POPUP_MODEL"
enabled="{/activePopup}"
/>
<IconTabFilter
text="Popover"
key="POPOVER"
enabled="{/activePopover}"
/>
<IconTabFilter
text="Popover Model"
key="POPOVER_MODEL"
enabled="{/activePopover}"
/>
<IconTabFilter
text="Nest1"
key="NEST1"
enabled="{/activeNest1}"
/>
<IconTabFilter
text="Nest1 Model"
key="NEST1_MODEL"
enabled="{/activeNest1}"
/>
<IconTabFilter
text="Nest2"
key="NEST2"
enabled="{/activeNest2}"
/>
<IconTabFilter
text="Nest2 Model"
key="NEST2_MODEL"
enabled="{/activeNest2}"
/>
</items>
</IconTabHeader>
<VBox>
<ToggleButton text="Source XML after Templating" visible="{/isTemplating}" pressed="{/templatingSource}" press="onTemplatingPress" />
<ce:CodeEditor
type="{/type}"
value="{/value}"
height="2000px"
width="10000px"
visible="{/editor_visible}"
/></VBox>
<VBox visible="{/source_visible}">
<core:HTML/>
</VBox>
<endButton>
<Button
text="Close"
press="onClose"
/>
</endButton>
</Dialog>
</core:FragmentDefinition>

130
app/webapp/cc/DebugTool.js Normal file
View File

@ -0,0 +1,130 @@
sap.ui.define(["sap/ui/core/Control", "sap/ui/core/Fragment", "sap/ui/model/json/JSONModel"], (Control, Fragment, JSONModel) => {
"use strict";
return Control.extend("z2ui5.cc.DebugTool", {
prettifyXml: function (sourceXml) {
const xmlDoc = new DOMParser().parseFromString(sourceXml, 'application/xml');
const xsltDoc = new DOMParser().parseFromString(sParse, 'application/xml');
const xsltProcessor = new XSLTProcessor();
xsltProcessor.importStylesheet(xsltDoc);
const resultDoc = xsltProcessor.transformToDocument(xmlDoc);
const resultXml = new XMLSerializer().serializeToString(resultDoc);
return resultXml.replace(/&gt;/g, ">");
},
onItemSelect: function (oEvent) {
const selItem = oEvent.getSource().getSelectedKey();
const oView = z2ui5?.oView;
const oResponse = z2ui5?.oResponse;
const displayEditor = this.displayEditor.bind(this);
switch (selItem) {
case 'CONFIG':
displayEditor(oEvent, JSON.stringify(z2ui5.oConfig, null, 3), 'json');
break;
case 'MODEL':
displayEditor(oEvent, JSON.stringify(oView?.getModel()?.getData(), null, 3), 'json');
break;
case 'VIEW':
const viewContent = oView?.mProperties?.viewContent || z2ui5.responseData.S_FRONT.PARAMS.S_VIEW.XML;
displayEditor(oEvent, this.prettifyXml(viewContent), 'xml', this.prettifyXml(oView?._xContent.outerHTML));
break;
case 'PLAIN':
displayEditor(oEvent, JSON.stringify(z2ui5.responseData, null, 3), 'json');
break;
case 'REQUEST':
displayEditor(oEvent, JSON.stringify(z2ui5.oBody, null, 3), 'json');
break;
case 'POPUP':
displayEditor(oEvent, this.prettifyXml(oResponse?.PARAMS?.S_POPUP?.XML), 'xml');
break;
case 'POPUP_MODEL':
displayEditor(oEvent, JSON.stringify(z2ui5.oViewPopup.getModel().getData(), null, 3), 'json');
break;
case 'POPOVER':
displayEditor(oEvent, oResponse?.PARAMS?.S_POPOVER?.XML, 'xml');
break;
case 'POPOVER_MODEL':
displayEditor(oEvent, JSON.stringify(z2ui5?.oViewPopover?.getModel()?.getData(), null, 3), 'json');
break;
case 'NEST1':
displayEditor(oEvent, this.prettifyXml(z2ui5?.oViewNest?.mProperties?.viewContent), 'xml', this.prettifyXml(z2ui5?.oViewNest?._xContent.outerHTML));
break;
case 'NEST1_MODEL':
displayEditor(oEvent, JSON.stringify(z2ui5?.oViewNest?.getModel()?.getData(), null, 3), 'json');
break;
case 'NEST2':
displayEditor(oEvent, this.prettifyXml(z2ui5?.oViewNest2?.mProperties?.viewContent), 'xml', this.prettifyXml(z2ui5?.oViewNest2?._xContent.outerHTML));
break;
case 'NEST2_MODEL':
displayEditor(oEvent, JSON.stringify(z2ui5?.oViewNest2?.getModel()?.getData(), null, 3), 'json');
break;
case 'SOURCE':
const parent = oEvent.getSource().getParent();
const contentControl = parent.getContent()[2].getItems()[0];
const url = `${window.location.origin}/sap/bc/adt/oo/classes/${z2ui5.responseData.S_FRONT.APP}/source/main`;
const content = atob('PGlmcmFtZSBpZD0idGVzdCIgc3JjPSInICsgdXJsICsgJyIgaGVpZ2h0PSI4MDBweCIgd2lkdGg9IjEyMDBweCIgLz4=').replace("' + url + '", url);
contentControl.setProperty("content", content);
const modelData = oEvent.getSource().getModel().oData;
modelData.editor_visible = false;
modelData.source_visible = true;
oEvent.getSource().getModel().refresh();
break;
}
},
displayEditor: function (oEvent, content, type, xcontent = "") {
const modelData = oEvent.getSource().getModel().oData;
modelData.editor_visible = true;
modelData.source_visible = false;
modelData.isTemplating = content.includes("xmlns:template");
modelData.value = content;
modelData.previousValue = content;
modelData.xContent = xcontent;
modelData.type = type;
oEvent.getSource().getModel().refresh();
},
onTemplatingPress: function (oEvent) {
const modelData = oEvent.getSource().getModel().oData;
modelData.value = oEvent.getSource().getPressed() ? modelData.xContent : modelData.previousValue;
oEvent.getSource().getModel().refresh();
},
onClose: function () {
this.oDialog.close();
},
async show() {
if (!this.oDialog) {
this.oDialog = await Fragment.load({
name: "z2ui5.cc.DebugTool",
controller: this,
});
}
const value = JSON.stringify(z2ui5.responseData, null, 3);
const oData = {
type: 'json',
source_visible: false,
editor_visible: true,
value: value,
xContent: '',
previousValue: value,
isTemplating: false,
templatingSource: false,
activeNest1: z2ui5?.oViewNest?.mProperties?.viewContent !== undefined,
activeNest2: z2ui5?.oViewNest2?.mProperties?.viewContent !== undefined,
activePopup: z2ui5?.oResponse?.PARAMS?.S_POPUP?.XML !== undefined,
activePopover: z2ui5?.oResponse?.PARAMS?.S_POPOVER?.XML !== undefined,
};
const oModel = new JSONModel(oData);
this.oDialog.addStyleClass('dbg-ltr');
this.oDialog.setModel(oModel);
this.oDialog.open();
}
});
});

147
app/webapp/cc/Server.js Normal file
View File

@ -0,0 +1,147 @@
sap.ui.define(["sap/ui/core/BusyIndicator","sap/m/MessageBox"
],
function (BusyIndicator, MessageBox) {
"use strict";
return {
endSession: function () {
if (z2ui5.contextId) {
fetch(z2ui5.oConfig.pathname, {
method: 'HEAD',
keepalive: true,
headers: {
'sap-terminate': 'session',
'sap-contextid': z2ui5.contextId,
'sap-contextid-accept': 'header'
}
});
delete z2ui5.contextId;
}
},
Roundtrip() {
z2ui5.checkTimerActive = false;
z2ui5.checkNestAfter = false;
z2ui5.checkNestAfter2 = false;
let event = (args) => {
if (args != undefined) {
return args[0][0];
}
};
z2ui5.oBody ??= {};
z2ui5.oBody.S_FRONT = {
ID: z2ui5?.oBody?.ID,
CONFIG: z2ui5.oConfig,
XX: z2ui5?.oBody?.XX,
ORIGIN: window.location.origin,
PATHNAME: window.location.pathname,
SEARCH: (z2ui5.search) ? z2ui5.search : window.location.search,
VIEW: z2ui5.oBody?.VIEWNAME,
EVENT: event(z2ui5.oBody?.ARGUMENTS),
HASH: window.location.hash,
};
if (z2ui5.oBody?.ARGUMENTS != undefined) {
if (z2ui5.oBody?.ARGUMENTS.length > 0) {
z2ui5.oBody?.ARGUMENTS.shift();
}
}
z2ui5.oBody.S_FRONT.T_EVENT_ARG = z2ui5.oBody?.ARGUMENTS;
delete z2ui5.oBody.ID;
delete z2ui5.oBody?.VIEWNAME;
delete z2ui5.oBody?.S_FRONT.XX;
delete z2ui5.oBody?.ARGUMENTS;
if (!z2ui5.oBody.S_FRONT.T_EVENT_ARG) {
delete z2ui5.oBody.S_FRONT.T_EVENT_ARG;
}
if (z2ui5.oBody.S_FRONT.T_EVENT_ARG) {
if (z2ui5.oBody.S_FRONT.T_EVENT_ARG.length == 0) {
delete z2ui5.oBody.S_FRONT.T_EVENT_ARG;
}
}
if (z2ui5.oBody.S_FRONT.T_STARTUP_PARAMETERS == undefined) {
delete z2ui5.oBody.S_FRONT.T_STARTUP_PARAMETERS;
}
if (z2ui5.oBody.S_FRONT.SEARCH == '') {
delete z2ui5.oBody.S_FRONT.SEARCH;
}
if (!z2ui5.oBody.XX) {
delete z2ui5.oBody.XX;
}
this.readHttp();
},
async readHttp() {
const response = await fetch(z2ui5.oConfig.pathname, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'sap-contextid-accept': 'header',
'sap-contextid': z2ui5.contextId
},
body: JSON.stringify(z2ui5.oBody)
});
z2ui5.contextId = response.headers.get("sap-contextid");
if (!response.ok) {
const responseText = await response.text();
this.responseError(responseText);
} else {
const responseData = await response.json();
z2ui5.responseData = responseData;
this.responseSuccess({
ID: responseData.S_FRONT.ID,
PARAMS: responseData.S_FRONT.PARAMS,
OVIEWMODEL: responseData.MODEL,
});
}
},
async responseSuccess(response) {
try {
z2ui5.oResponse = response;
if (z2ui5.oResponse.PARAMS?.S_VIEW?.CHECK_DESTROY) {
z2ui5.oController.ViewDestroy();
}
; if (z2ui5.oResponse.PARAMS?.S_FOLLOW_UP_ACTION?.CUSTOM_JS) {
setTimeout(() => {
let mParams = z2ui5.oResponse?.PARAMS.S_FOLLOW_UP_ACTION.CUSTOM_JS.split("'");
let mParamsEF = mParams.filter((val, index) => index % 2)
if (mParamsEF.length) {
z2ui5.oController.eF.apply(undefined, mParamsEF);
} else {
Function("return " + mParams[0])();
}
}, 100);
};
z2ui5.oController.showMessage('S_MSG_TOAST', z2ui5.oResponse.PARAMS);
z2ui5.oController.showMessage('S_MSG_BOX', z2ui5.oResponse.PARAMS);
if (z2ui5.oResponse.PARAMS?.S_VIEW?.XML) {
if (z2ui5.oResponse.PARAMS?.S_VIEW?.XML !== '') {
z2ui5.oController.ViewDestroy();
await z2ui5.oController.displayView(z2ui5.oResponse.PARAMS.S_VIEW.XML, z2ui5.oResponse.OVIEWMODEL);
return;
}
}
z2ui5.oController.updateModelIfRequired('S_VIEW', z2ui5.oView);
z2ui5.oController.updateModelIfRequired('S_VIEW_NEST', z2ui5.oViewNest);
z2ui5.oController.updateModelIfRequired('S_VIEW_NEST2', z2ui5.oViewNest2);
z2ui5.oController.updateModelIfRequired('S_POPUP', z2ui5.oViewPopup);
z2ui5.oController.updateModelIfRequired('S_POPOVER', z2ui5.oViewPopover);
z2ui5.oController.onAfterRendering();
} catch (e) {
BusyIndicator.hide();
if (e.message.includes("openui5")) {
if (e.message.includes("script load error")) {
z2ui5.oController.checkSDKcompatibility(e)
}
} else {
MessageBox.error(e.toLocaleString());
}
}
},
responseError(response) {
document.write(response);
},
};
});

View File

@ -0,0 +1,778 @@
sap.ui.define(["sap/ui/core/mvc/Controller",
"z2ui5/controller/View1.controller",
], function (BaseController, Controller) {
return BaseController.extend("z2ui5.controller.App", {
onInit: async function () {
z2ui5.oConfig.pathname = this.getView().getModel().sServiceUrl;
if (z2ui5.oConfig.pathname == '_LOCAL_') {
z2ui5.oConfig.pathname = window.location.href;
};
z2ui5.oController = new Controller();
z2ui5.oController.setApp(this.getView().byId("app"));
z2ui5.oControllerNest = new Controller();
z2ui5.oControllerNest2 = new Controller();
z2ui5.oControllerPopup = new Controller();
z2ui5.oControllerPopover = new Controller();
z2ui5.onBeforeRoundtrip = [];
z2ui5.onAfterRendering = [];
z2ui5.onBeforeEventFrontend = [];
z2ui5.onAfterRoundtrip = [];
z2ui5.checkNestAfter = false;
}
});
});
sap.ui.define("z2ui5/Timer", ["sap/ui/core/Control"], (Control) => {
"use strict";
return Control.extend("z2ui5.Timer", {
metadata: {
properties: {
delayMS: {
type: "string",
defaultValue: ""
},
checkActive: {
type: "boolean",
defaultValue: true
},
checkRepeat: {
type: "boolean",
defaultValue: false
},
},
events: {
"finished": {
allowPreventDefault: true,
parameters: {},
}
}
},
onAfterRendering() { },
delayedCall(oControl) {
if (oControl.getProperty("checkActive") == false) {
return;
}
setTimeout((oControl) => {
oControl.setProperty("checkActive", false)
oControl.fireFinished();
if (oControl.getProperty("checkRepeat")) {
oControl.delayedCall(oControl);
}
}
, parseInt(oControl.getProperty("delayMS")), oControl);
},
renderer(oRm, oControl) {
oControl.delayedCall(oControl);
}
});
}
);
sap.ui.define("z2ui5/Focus", ["sap/ui/core/Control",], (Control) => {
"use strict";
return Control.extend("z2ui5.Focus", {
metadata: {
properties: {
setUpdate: {
type: "boolean",
defaultValue: true
},
focusId: {
type: "string"
},
selectionStart: {
type: "string",
defaultValue: "0"
},
selectionEnd: {
type: "string",
defaultValue: "0"
},
}
},
init() { },
setFocusId(val) {
try {
this.setProperty("focusId", val);
var oElement = z2ui5.oView.byId(val);
var oFocus = oElement.getFocusInfo();
oElement.applyFocusInfo(oFocus);
} catch (e) { }
},
renderer(oRm, oControl) {
if (!oControl.getProperty("setUpdate")) {
return;
}
oControl.setProperty("setUpdate", false);
setTimeout((oControl) => {
var oElement = z2ui5.oView.byId(oControl.getProperty("focusId"));
var oFocus = oElement.getFocusInfo();
oFocus.selectionStart = parseInt(oControl.getProperty("selectionStart"));
oFocus.selectionEnd = parseInt(oControl.getProperty("selectionEnd"));
oElement.applyFocusInfo(oFocus);
}
, 100, oControl);
}
});
}
);
sap.ui.define("z2ui5/Title", ["sap/ui/core/Control"], (Control) => {
"use strict";
return Control.extend("z2ui5.Title", {
metadata: {
properties: {
title: {
type: "string"
},
}
},
setTitle(val) {
this.setProperty("title", val);
document.title = val;
},
renderer(oRm, oControl) { }
});
}
);
sap.ui.define("z2ui5/LPTitle", ["sap/ui/core/Control"], (Control) => {
"use strict";
return Control.extend("z2ui5.LPTitle", {
metadata: {
properties: {
title: {
type: "string"
},
}
},
setTitle(val) {
try {
this.setProperty("title", val);
z2ui5.oLaunchpadService.setTitle(val);
} catch (e) {
console.error("Launchpad Service to set Title not found");
}
},
renderer(oRm, oControl) { }
});
}
);
sap.ui.define("z2ui5/History", ["sap/ui/core/Control"], (Control) => {
"use strict";
return Control.extend("z2ui5.History", {
metadata: {
properties: {
search: {
type: "string"
},
}
},
setSearch(val) {
this.setProperty("search", val);
history.replaceState(null, null, window.location.pathname + val);
},
renderer(oRm, oControl) { }
});
}
);
sap.ui.define("z2ui5/Scrolling", ["sap/ui/core/Control"], (Control) => {
"use strict";
return Control.extend("z2ui5.Scrolling", {
metadata: {
properties: {
setUpdate: {
type: "boolean",
defaultValue: true
},
items: {
type: "Array"
}
}
},
setBackend() {
const items = this.getProperty("items");
if (items) {
items.forEach(item => {
try {
const scrollDelegate = z2ui5.oView.byId(item.ID).getScrollDelegate();
item.SCROLLTO = scrollDelegate ? scrollDelegate.getScrollTop() : 0;
} catch {
try {
const element = document.getElementById(`${z2ui5.oView.byId(item.ID).getId()}-inner`);
item.SCROLLTO = element ? element.scrollTop : 0;
} catch {}
}
});
}
},
init() {
z2ui5.onBeforeRoundtrip.push(this.setBackend.bind(this));
},
renderer(oRm, oControl) {
if (!oControl.getProperty("setUpdate")) return;
oControl.setProperty("setUpdate", false);
const items = oControl.getProperty("items");
if (!items) return;
setTimeout(() => {
items.forEach(item => {
try {
z2ui5.oView.byId(item.ID).scrollTo(item.SCROLLTO);
} catch {
try {
const element = document.getElementById(`${z2ui5.oView.byId(item.ID).getId()}-inner`);
if (element) element.scrollTop = item.SCROLLTO;
} catch {
setTimeout(() => {
z2ui5.oView.byId(item.ID).scrollTo(item.SCROLLTO);
}, 1);
}
}
});
}, 100);
}
});
});
sap.ui.define("z2ui5/Info", ["sap/ui/core/Control", "sap/ui/VersionInfo", "sap/ui/Device"], (Control, VersionInfo, Device) => {
"use strict";
return Control.extend("z2ui5.Info", {
metadata: {
properties: {
ui5_version: {
type: "string"
},
device_phone: {
type: "string"
},
device_desktop: {
type: "string"
},
device_tablet: {
type: "string"
},
device_combi: {
type: "string"
},
device_height: {
type: "string"
},
device_width: {
type: "string"
},
ui5_theme: {
type: "string"
},
device_os: {
type: "string"
},
device_systemtype: {
type: "string"
},
device_browser: {
type: "string"
},
},
events: {
"finished": {
allowPreventDefault: true,
parameters: {},
}
}
},
init() { },
onAfterRendering() {
},
async renderer(oRm, oControl) {
debugger;
let oDevice = z2ui5.oView.getModel("device").oData;
oControl.setProperty("device_phone", oDevice.system.phone);
oControl.setProperty("device_desktop", oDevice.system.desktop);
oControl.setProperty("device_tablet", oDevice.system.tablet);
oControl.setProperty("device_combi", oDevice.system.combi);
oControl.setProperty("device_height", oDevice.resize.height);
oControl.setProperty("device_width", oDevice.resize.width);
oControl.setProperty("device_os", oDevice.os.name);
oControl.setProperty("device_browser", oDevice.browser.name);
oControl.fireFinished();
}
});
}
);
sap.ui.define("z2ui5/Geolocation", ["sap/ui/core/Control"], (Control) => {
"use strict";
return Control.extend("z2ui5.Geolocation", {
metadata: {
properties: {
longitude: {
type: "string",
defaultValue: ""
},
latitude: {
type: "string",
defaultValue: ""
},
altitude: {
type: "string",
defaultValue: ""
},
accuracy: {
type: "string",
defaultValue: ""
},
altitudeAccuracy: {
type: "string",
defaultValue: ""
},
speed: {
type: "string",
defaultValue: false
},
heading: {
type: "string",
defaultValue: false
},
enableHighAccuracy: {
type: "boolean",
defaultValue: false
},
timeout: {
type: "string",
defaultValue: "5000"
}
},
events: {
"finished": {
allowPreventDefault: true,
parameters: {},
}
}
},
callbackPosition(position) {
var test = position.coords.longitude
this.setProperty("longitude", position.coords.longitude, true);
this.setProperty("latitude", position.coords.latitude, true);
this.setProperty("altitude", position.coords.altitude, true);
this.setProperty("accuracy", position.coords.accuracy, true);
this.setProperty("altitudeAccuracy", position.coords.altitudeAccuracy, true);
this.setProperty("speed", position.coords.speed, true);
this.setProperty("heading", position.coords.heading, true);
this.fireFinished();
//this.getParent().getParent().getModel().refresh();
},
async init() {
navigator.geolocation.getCurrentPosition(this.callbackPosition.bind(this));
//navigator.geolocation.watchPosition(this.callbackPosition.bind(this));
},
exit() {//clearWatch
},
onAfterRendering() {
},
renderer(oRm, oControl) {
}
});
}
);
sap.ui.define("z2ui5/FileUploader", ["sap/ui/core/Control", "sap/m/Button", "sap/ui/unified/FileUploader", "sap/m/HBox"], function (Control, Button, FileUploader, HBox) {
"use strict";
return Control.extend("z2ui5.FileUploader", {
metadata: {
properties: {
value: {
type: "string",
defaultValue: ""
},
path: {
type: "string",
defaultValue: ""
},
tooltip: {
type: "string",
defaultValue: ""
},
fileType: {
type: "string",
defaultValue: ""
},
placeholder: {
type: "string",
defaultValue: ""
},
buttonText: {
type: "string",
defaultValue: ""
},
style: {
type: "string",
defaultValue: ""
},
uploadButtonText: {
type: "string",
defaultValue: "Upload"
},
enabled: {
type: "boolean",
defaultValue: true
},
icon: {
type: "string",
defaultValue: "sap-icon://browse-folder"
},
iconOnly: {
type: "boolean",
defaultValue: false
},
buttonOnly: {
type: "boolean",
defaultValue: false
},
multiple: {
type: "boolean",
defaultValue: false
},
visible: {
type: "boolean",
defaultValue: true
},
checkDirectUpload: {
type: "boolean",
defaultValue: false
}
},
aggregations: {},
events: {
"upload": {
allowPreventDefault: true,
parameters: {}
}
},
renderer: null
},
renderer: function (oRm, oControl) {
if (!oControl.getProperty("checkDirectUpload")) {
oControl.oUploadButton = new Button({
text: oControl.getProperty("uploadButtonText"),
enabled: oControl.getProperty("path") !== "",
press: function (oEvent) {
this.setProperty("path", this.oFileUploader.getProperty("value"));
var file = z2ui5.oUpload.oFileUpload.files[0];
var reader = new FileReader();
reader.onload = function (evt) {
var vContent = evt.currentTarget.result;
this.setProperty("value", vContent);
this.fireUpload();
//this.getView().byId('picture' ).getDomRef().src = vContent;
}
.bind(this)
reader.readAsDataURL(file);
}
.bind(oControl)
});
}
oControl.oFileUploader = new FileUploader({
icon: oControl.getProperty("icon"),
iconOnly: oControl.getProperty("iconOnly"),
buttonOnly: oControl.getProperty("buttonOnly"),
buttonText: oControl.getProperty("buttonText"),
style: oControl.getProperty("style"),
fileType: oControl.getProperty("fileType"),
visible: oControl.getProperty("visible"),
uploadOnChange: true,
enabled: oControl.getProperty("enabled"),
value: oControl.getProperty("path"),
placeholder: oControl.getProperty("placeholder"),
change: function (oEvent) {
if (oControl.getProperty("checkDirectUpload")) {
return;
}
var value = oEvent.getSource().getProperty("value");
this.setProperty("path", value);
if (value) {
this.oUploadButton.setEnabled();
} else {
this.oUploadButton.setEnabled(false);
}
this.oUploadButton.rerender();
z2ui5.oUpload = oEvent.oSource;
}
.bind(oControl),
uploadComplete: function (oEvent) {
if (!oControl.getProperty("checkDirectUpload")) {
return;
}
var value = oEvent.getSource().getProperty("value");
this.setProperty("path", value);
var file = oEvent.oSource.oFileUpload.files[0];
var reader = new FileReader();
reader.onload = function (evt) {
var vContent = evt.currentTarget.result;
this.setProperty("value", vContent);
this.fireUpload();
}
.bind(this)
reader.readAsDataURL(file);
}
.bind(oControl)
});
var hbox = new HBox();
hbox.addItem(oControl.oFileUploader);
hbox.addItem(oControl.oUploadButton);
oRm.renderControl(hbox);
}
});
});
sap.ui.define("z2ui5/MultiInputExt", ["sap/ui/core/Control", "sap/m/Token", "sap/ui/core/Core", "sap/ui/core/Element"], (Control, Token, Core, Element) => {
"use strict";
return Control.extend("z2ui5.MultiInputExt", {
metadata: {
properties: {
MultiInputId: {
type: "String"
},
MultiInputName: {
type: "String"
},
addedTokens: {
type: "Array"
},
checkInit: {
type: "Boolean",
defaultValue: false
},
removedTokens: {
type: "Array"
}
},
events: {
"change": {
allowPreventDefault: true,
parameters: {}
}
},
},
init() {
z2ui5.onAfterRendering.push(this.setControl.bind(this));
},
onTokenUpdate(oEvent) {
this.setProperty("addedTokens", []);
this.setProperty("removedTokens", []);
if (oEvent.mParameters.type == "removed") {
let removedTokens = [];
oEvent.mParameters.removedTokens.forEach((item) => {
removedTokens.push({
KEY: item.getKey(),
TEXT: item.getText()
});
}
);
this.setProperty("removedTokens", removedTokens);
} else {
let addedTokens = [];
oEvent.mParameters.addedTokens.forEach((item) => {
addedTokens.push({
KEY: item.getKey(),
TEXT: item.getText()
});
}
);
this.setProperty("addedTokens", addedTokens);
}
this.fireChange();
},
renderer(oRm, oControl) {
z2ui5.onAfterRendering.push(this.setControl.bind(oControl));
},
setControl() {
let table = z2ui5.oView.byId(this.getProperty("MultiInputId"));
if (!table) {
try {
table = Core.byId(Element.getElementsByName(this.getProperty("MultiInputName"))[0].id.replace('-inner', ''));
} catch (e) {
return;
}
}
if (!table) {
return;
}
if (this.getProperty("checkInit") == true) {
return;
}
this.setProperty("checkInit", true);
table.attachTokenUpdate(this.onTokenUpdate.bind(this));
var fnValidator = function (args) {
var text = args.text;
return new Token({
key: text,
text: text
});
};
table.addValidator(fnValidator);
},
renderer(oRM, oControl) { }
});
}
);
sap.ui.define("z2ui5/UITableExt", ["sap/ui/core/Control"], (Control) => {
"use strict";
return Control.extend("z2ui5.UITableExt", {
metadata: {
properties: {
tableId: {
type: "String"
}
}
},
init() {
z2ui5.onBeforeRoundtrip.push(this.readFilter.bind(this));
z2ui5.onAfterRoundtrip.push(this.setFilter.bind(this));
},
readFilter() {
try {
let id = this.getProperty("tableId");
let oTable = z2ui5.oView.byId(id);
this.aFilters = oTable.getBinding().aFilters;
} catch (e) { }
;
},
setFilter() {
try {
setTimeout((aFilters) => {
let id = this.getProperty("tableId");
let oTable = z2ui5.oView.byId(id);
oTable.getBinding().filter(aFilters);
}
, 100, this.aFilters);
} catch (e) { }
;
},
renderer(oRM, oControl) { }
});
}
);
sap.ui.define("z2ui5/Util", [], () => {
"use strict";
return {
DateCreateObject: (s) => new Date(s),
DateAbapTimestampToDate: (sTimestamp) => new sap.gantt.misc.Format.abapTimestampToDate(sTimestamp),
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)),
};
}
);
sap.ui.require(["z2ui5/Util"], (Util) => {
z2ui5.Util = Util;
}
);
sap.ui.define("z2ui5/Favicon", ["sap/ui/core/Control"], (Control) => {
"use strict";
return Control.extend("z2ui5.Favicon", {
metadata: {
properties: {
favicon: {
type: "string"
},
}
},
setFavicon(val) {
this.setProperty("favicon", val);
let headTitle = document.querySelector('head');
let setFavicon = document.createElement('link');
setFavicon.setAttribute('rel', 'shortcut icon');
setFavicon.setAttribute('href', val);
headTitle.appendChild(setFavicon);
},
renderer(oRm, oControl) { }
});
}
);
sap.ui.define("z2ui5/Dirty", ["sap/ui/core/Control", "sap/ushell/Container"], (Control, Container) => {
"use strict";
return Control.extend("z2ui5.Dirty", {
metadata: {
properties: {
isDirty: {
type: "string"
},
}
},
setIsDirty(val) {
if (Container) {
Container.setDirtyFlag(val);
} else {
window.onbeforeunload = function (e) {
if (val) {
e.preventDefault();
}
}
}
},
renderer(oRm, oControl) { }
});
}
);

View File

@ -0,0 +1,468 @@
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", {
onInit (){
z2ui5.oRouter.attachRouteMatched(function(oEvent) {
z2ui5.checkInit = true;
Server.Roundtrip();
}, this);
},
async onAfterRendering() {
if (!z2ui5.oResponse){
return;
}
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();
}
})
}
},
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);
}
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);
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);
}
}
;
} else if (msgType === 'S_MSG_BOX') {
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
})
}
}
}
},
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);
},
})
});

1
app/webapp/css/style.css Normal file
View File

@ -0,0 +1 @@
/* Enter your custom styles here */

35
app/webapp/index.html Normal file
View File

@ -0,0 +1,35 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<style>
html, body, body > div, #container, #container-uiarea {
height: 100%;
}
</style>
<script
id="sap-ui-bootstrap"
src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js"
data-sap-ui-theme="sap_horizon"
data-sap-ui-resourceroots='{
"z2ui5": "./"
}'
data-sap-ui-oninit="module:sap/ui/core/ComponentSupport"
data-sap-ui-compatVersion="edge"
data-sap-ui-async="true"
data-sap-ui-frameOptions="trusted"
></script>
</head>
<body class="sapUiBody sapUiSizeCompact" id="content">
<div
data-sap-ui-component
data-name="z2ui5"
data-id="container"
data-settings='{"id" : "z2ui5"}'
data-handle-validation="true"
></div>
</body>
</html>

144
app/webapp/manifest.json Normal file
View File

@ -0,0 +1,144 @@
{
"_version": "1.65.0",
"sap.app": {
"id": "z2ui5",
"type": "application",
"applicationVersion": {
"version": "0.0.1"
},
"title": "{{appTitle}}",
"description": "{{appDescription}}",
"resources": "resources.json",
"sourceTemplate": {
"id": "@sap/generator-fiori:basic",
"version": "1.15.0",
"toolsId": "3a966e20-9635-4c28-8861-d1b66f79f1de"
},
"dataSources": {
"mainService": {
"uri": "_LOCAL_",
"type": "OData",
"settings": {
"annotations": [],
"localUri": "localService/metadata.xml",
"odataVersion": "2.0"
}
}
},
"crossNavigation": {
"inbounds": {
"z2ui5-display": {
"semanticObject": "z2ui5",
"action": "display",
"title": "{{flpTitle}}",
"signature": {
"parameters": {},
"additionalParameters": "allowed"
}
}
}
}
},
"sap.ui": {
"technology": "UI5",
"icons": {
"icon": "",
"favIcon": "",
"phone": "",
"phone@2": "",
"tablet": "",
"tablet@2": ""
},
"deviceTypes": {
"desktop": true,
"tablet": true,
"phone": true
}
},
"sap.ui5": {
"flexEnabled": true,
"dependencies": {
"minUI5Version": "1.128.1",
"libs": {
"sap.m": {},
"sap.ui.core": {}
}
},
"contentDensities": {
"compact": true,
"cozy": true
},
"services": {
"ShellUIService": {
"factoryName": "sap.ushell.ui5service.ShellUIService"
}
},
"models": {
"": {
"dataSource": "mainService",
"preload": true,
"settings": {}
}
},
"resources": {
"css": [
{
"uri": "css/style.css"
}
]
},
"routing": {
"config": {
"routerClass": "sap.m.routing.Router",
"viewType": "XML",
"async": true,
"viewPath": "z2ui5.view",
"controlAggregation": "pages",
"controlId": "app",
"clearControlAggregation": false
},
"routes": [
{
"name": "RouteView1",
"pattern": ":?query:",
"target": [
"TargetView1"
]
},
{
"name": "RouteView2",
"pattern": ":?query:",
"target": [
"TargetView2"
]
}
],
"targets": {
"TargetView1": {
"viewType": "XML",
"transition": "flip",
"clearControlAggregation": false,
"viewId": "View1",
"viewName": "View1"
},
"TargetView2": {
"viewType": "XML",
"transition": "flip",
"clearControlAggregation": false,
"viewId": "View2",
"viewName": "View2"
}
}
},
"rootView": {
"viewName": "z2ui5.view.App",
"type": "XML",
"async": true,
"id": "App"
}
},
"sap.cloud": {
"public": true,
"service": "z2ui5"
}
}

View File

@ -0,0 +1,19 @@
sap.ui.define([
"sap/ui/model/json/JSONModel",
"sap/ui/Device"
],
function (JSONModel, Device) {
"use strict";
return {
/**
* Provides runtime info for the device the UI5 app is running on as JSONModel
*/
createDeviceModel: function () {
var oModel = new JSONModel(Device);
oModel.setDefaultBindingMode("OneWay");
return oModel;
}
};
});

View File

@ -0,0 +1,7 @@
<mvc:View controllerName="z2ui5.controller.App"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:mvc="sap.ui.core.mvc" displayBlock="true"
xmlns="sap.m">
<App id="app">
</App>
</mvc:View>

View File

@ -0,0 +1,4 @@
<mvc:View controllerName="z2ui5.controller.View1"
xmlns:mvc="sap.ui.core.mvc" displayBlock="true"
xmlns="sap.m">
</mvc:View>

31
app/xs-app.json Normal file
View File

@ -0,0 +1,31 @@
{
"welcomeFile": "/index.html",
"authenticationMethod": "route",
"routes": [
{
"source": "^/sap/(.*)$",
"target": "/sap/$1",
"destination": "BACKEND_ABAP2UI5",
"authenticationType": "none",
"csrfProtection": false
},
{
"source": "^/resources/(.*)$",
"target": "/resources/$1",
"authenticationType": "none",
"destination": "ui5"
},
{
"source": "^/test-resources/(.*)$",
"target": "/test-resources/$1",
"authenticationType": "none",
"destination": "ui5"
},
{
"source": "^(.*)$",
"target": "$1",
"service": "html5-apps-repo-rt",
"authenticationType": "xsuaa"
}
]
}

7
app/xs-security.json Normal file
View File

@ -0,0 +1,7 @@
{
"xsappname": "z2ui5",
"tenant-mode": "dedicated",
"description": "Security profile of called application",
"scopes": [],
"role-templates": []
}

View File

@ -82,11 +82,7 @@
"commented_code": false,
"constant_classes": true,
"constructor_visibility_public": true,
"contains_tab": {
"exclude": [],
"severity": "Error",
"spaces": 1
},
"contains_tab": false,
"cyclic_oo": false,
"cyclomatic_complexity": {
"exclude": [],
@ -159,7 +155,7 @@
"inline_data_old_versions": true,
"intf_referencing_clas": false,
"keep_single_parameter_on_one_line": false,
"keyword_case": true,
"keyword_case": false,
"line_break_multiple_parameters": false,
"line_break_style": true,
"line_length": false,
@ -298,7 +294,7 @@
"use_line_exists": true,
"use_new": true,
"when_others_last": true,
"whitespace_end": true,
"whitespace_end": false,
"xml_consistency": true,
"forbidden_void_type": {
"check": [

View File

@ -3,7 +3,7 @@
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<DEVC>
<CTEXT>abap2UI5 - ext libraries</CTEXT>
<CTEXT>abap2UI5 - libs (external)</CTEXT>
</DEVC>
</asx:values>
</asx:abap>

View File

@ -3,7 +3,7 @@
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<DEVC>
<CTEXT>abap2UI5 - functions</CTEXT>
<CTEXT>abap2UI5 - db</CTEXT>
</DEVC>
</asx:values>
</asx:abap>

View File

@ -3,7 +3,7 @@
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<DEVC>
<CTEXT>abap2UI5 - server</CTEXT>
<CTEXT>abap2UI5 - srv</CTEXT>
</DEVC>
</asx:values>
</asx:abap>

View File

@ -15,12 +15,6 @@ CLASS z2ui5_cl_core_action DEFINITION
RETURNING
VALUE(result) TYPE REF TO z2ui5_cl_core_action.
METHODS factory_system_error
IMPORTING
ix TYPE REF TO cx_root
RETURNING
VALUE(result) TYPE REF TO z2ui5_cl_core_action.
METHODS factory_first_start
RETURNING
VALUE(result) TYPE REF TO z2ui5_cl_core_action.
@ -143,20 +137,6 @@ CLASS z2ui5_cl_core_action IMPLEMENTATION.
ENDMETHOD.
METHOD factory_system_error.
result = NEW #( mo_http_post ).
result->mo_app->ms_draft-id = z2ui5_cl_util=>uuid_get_c32( ).
result->ms_actual-check_on_navigated = abap_true.
result->ms_next-o_app_call = z2ui5_cl_core_app_error=>factory( ix ).
result = result->factory_stack_call( ).
ENDMETHOD.
METHOD factory_system_startup.
result = NEW #( mo_http_post ).

View File

@ -19,6 +19,8 @@ CLASS z2ui5_cl_core_app_startup DEFINITION
class_editable TYPE abap_bool VALUE abap_true,
END OF ms_home.
DATA mv_ui5_version TYPE string .
DATA client TYPE REF TO z2ui5_if_client.
DATA mv_check_initialized TYPE abap_bool.
@ -30,7 +32,7 @@ CLASS z2ui5_cl_core_app_startup DEFINITION
METHODS z2ui5_on_event.
METHODS view_display_start.
METHODS on_event_check.
METHODS view_display_popup.
PROTECTED SECTION.
DATA mt_classes TYPE z2ui5_cl_util=>ty_t_classes.
@ -39,7 +41,7 @@ ENDCLASS.
CLASS Z2UI5_CL_CORE_APP_STARTUP IMPLEMENTATION.
CLASS z2ui5_cl_core_app_startup IMPLEMENTATION.
METHOD factory.
@ -119,7 +121,7 @@ CLASS Z2UI5_CL_CORE_APP_STARTUP IMPLEMENTATION.
)->label(
)->link( text = `(Example)`
target = `_blank`
href = `https://github.com/abap2UI5/abap2UI5/blob/main/src/01/03/z2ui5_cl_core_app_hello_w.clas.abap`
href = `https://github.com/abap2UI5/abap2UI5/blob/main/src/02/z2ui5_cl_hello_world.clas.abap`
)->label( `Step 4` ).
IF ms_home-class_editable = abap_true.
@ -230,16 +232,76 @@ CLASS Z2UI5_CL_CORE_APP_STARTUP IMPLEMENTATION.
ENDMETHOD.
METHOD view_display_popup.
DATA(page2) = z2ui5_cl_xml_view=>factory_popup(
)->dialog(
title = `abap2UI5 - System Information`
afterclose = client->_event( `CLOSE` ) ).
DATA(content) = page2->content( ).
content->_z2ui5( )->info_frontend( ui5_version = client->_bind( mv_ui5_version ) ).
DATA(simple_form2) = content->simple_form(
editable = abap_true
layout = `ResponsiveGridLayout`
labelspanxl = `4`
labelspanl = `3`
labelspanm = `4`
labelspans = `12`
adjustlabelspan = abap_false
emptyspanxl = `0`
emptyspanl = `4`
emptyspanm = `0`
emptyspans = `0`
columnsxl = `1`
columnsl = `1`
columnsm = `1`
singlecontainerfullsize = abap_false
)->content( `form` ).
simple_form2->toolbar( )->title( `Frontend` ).
simple_form2->label( `UI5 Version` ).
simple_form2->text( client->_bind( mv_ui5_version ) ).
simple_form2->label( `Launchpad active` ).
simple_form2->checkbox( enabled = abap_false selected = client->get( )-check_launchpad_active ).
simple_form2->toolbar( )->title( `Backend` ).
simple_form2->label( `ABAP for Cloud` ).
simple_form2->checkbox( enabled = abap_false selected = z2ui5_cl_util=>context_check_abap_cloud( ) ).
DATA(lv_count) = CONV string( NEW z2ui5_cl_core_draft_srv( )->count_entries( ) ).
simple_form2->toolbar( )->title( `abap2UI5` ).
simple_form2->label( `Version ` ).
simple_form2->text( z2ui5_if_app=>version ).
simple_form2->label( `Draft Entries ` ).
simple_form2->text( lv_count ).
page2->end_button( )->button(
text = 'close'
press = client->_event( 'CLOSE' )
type = 'Emphasized' ).
client->popup_display( page2->stringify( ) ).
ENDMETHOD.
METHOD z2ui5_on_event.
DATA li_app TYPE REF TO z2ui5_if_app.
CASE client->get( )-event.
WHEN `CLOSE`.
client->popup_destroy( ).
WHEN `OPEN_DEBUG`.
client->message_box_display( `Press CTRL+F12 to open the debugging tools` ).
WHEN `OPEN_INFO`.
client->nav_app_call( z2ui5_cl_core_app_info=>factory( ) ).
view_display_popup( ).
* client->nav_app_call( z2ui5_cl_core_app_info=>factory( ) ).
RETURN.
WHEN `BUTTON_CHECK`.
@ -273,7 +335,7 @@ CLASS Z2UI5_CL_CORE_APP_STARTUP IMPLEMENTATION.
ms_home-btn_event_id = `BUTTON_CHECK`.
ms_home-class_editable = abap_true.
ms_home-btn_icon = `sap-icon://validate`.
ms_home-classname = z2ui5_cl_util=>rtti_get_classname_by_ref( NEW z2ui5_cl_core_app_hello_w( ) ).
ms_home-classname = z2ui5_cl_util=>rtti_get_classname_by_ref( NEW z2ui5_cl_hello_world( ) ).
ENDMETHOD.
ENDCLASS.

View File

@ -5,7 +5,7 @@
<VSEOCLASS>
<CLSNAME>Z2UI5_CL_CORE_APP_STARTUP</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>abap2UI5 - app startup</DESCRIPT>
<DESCRIPT>abap2UI5 - startup app</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>

View File

@ -79,7 +79,8 @@ CLASS z2ui5_cl_core_http_post IMPLEMENTATION.
ENDIF.
CATCH cx_root INTO DATA(x).
mo_action = mo_action->factory_system_error( x ).
ASSERT x->get_text( ) = 1.
* mo_action = mo_action->factory_system_error( x ).
ENDTRY.
ENDMETHOD.
@ -157,7 +158,8 @@ CLASS z2ui5_cl_core_http_post IMPLEMENTATION.
ENDIF.
CATCH cx_root INTO DATA(x).
mo_action = mo_action->factory_system_error( x ).
ASSERT x->get_text( ) = 1.
* mo_action = mo_action->factory_system_error( x ).
ENDTRY.
ENDMETHOD.
ENDCLASS.

View File

@ -3,7 +3,7 @@
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<DEVC>
<CTEXT>abap2UI5 - client</CTEXT>
<CTEXT>abap2UI5 - app (manual)</CTEXT>
</DEVC>
</asx:values>
</asx:abap>

View File

@ -1,67 +0,0 @@
CLASS z2ui5_cl_core_app_error DEFINITION
PUBLIC
FINAL
CREATE PROTECTED .
PUBLIC SECTION.
INTERFACES z2ui5_if_app.
DATA mx_error TYPE REF TO cx_root .
CLASS-METHODS factory
IMPORTING
!error TYPE REF TO cx_root
RETURNING
VALUE(result) TYPE REF TO z2ui5_cl_core_app_error.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_core_app_error IMPLEMENTATION.
METHOD factory.
result = NEW #( ).
result->mx_error = error.
ENDMETHOD.
METHOD z2ui5_if_app~main.
DATA(lv_url) = shift_left( val = client->get( )-s_config-origin && client->get( )-s_config-pathname sub = ` ` ).
DATA(lv_url_app_start) = lv_url && client->get( )-s_config-search.
DATA(lv_text) = ``.
DATA(lx_error) = mx_error.
WHILE lx_error IS BOUND.
lv_text = lv_text && `<p>` && lx_error->get_text( ) && `</p>`.
lx_error = lx_error->previous.
ENDWHILE.
DATA(view) = z2ui5_cl_xml_view=>factory( ).
DATA(vbox) = view->shell( )->vbox( alignitems = `Center` ).
vbox->text( ).
vbox->hbox(
)->icon( src = `sap-icon://alert`
)->text(
)->title( `500 Internal Server Error`
)->text(
)->icon( src = `sap-icon://alert` ).
vbox->formatted_text( lv_text ).
vbox->hbox(
)->button(
text = `Restart`
type = `Emphasized`
press = client->_event_client( val = client->cs_event-location_reload t_arg = VALUE #( ( lv_url_app_start ) ) )
).
client->view_display( view->stringify( ) ).
client->popup_destroy( ).
ENDMETHOD.
ENDCLASS.

View File

@ -1,20 +0,0 @@
CLASS ltcl_app_error_test DEFINITION FINAL FOR TESTING
DURATION SHORT
RISK LEVEL DANGEROUS.
PRIVATE SECTION.
METHODS first_test FOR TESTING RAISING cx_static_check.
ENDCLASS.
CLASS ltcl_app_error_test IMPLEMENTATION.
METHOD first_test.
DATA(lx) = NEW z2ui5_cx_util_error( ).
DATA(lo_app) = z2ui5_cl_core_app_error=>factory( lx ) ##NEEDED.
ENDMETHOD.
ENDCLASS.

View File

@ -1,145 +0,0 @@
CLASS z2ui5_cl_core_app_info DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES z2ui5_if_app.
DATA client TYPE REF TO z2ui5_if_client.
DATA mv_check_initialized TYPE abap_bool.
DATA mv_ui5_version TYPE string .
* DATA mv_device TYPE string.
* DATA mv_device_type TYPE string.
* DATA mv_theme TYPE string.
* DATA mv_device_browser TYPE string.
* DATA mv_device_theme TYPE string.
* DATA mv_device_gav TYPE string.
CLASS-METHODS factory
RETURNING
VALUE(result) TYPE REF TO z2ui5_cl_core_app_info.
METHODS z2ui5_on_event .
METHODS view_display_start .
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_core_app_info IMPLEMENTATION.
METHOD factory.
result = NEW #( ).
ENDMETHOD.
METHOD view_display_start.
DATA(page2) = z2ui5_cl_xml_view=>factory_popup(
)->dialog(
title = `abap2UI5 - System Information`
afterclose = client->_event( `CLOSE` ) ).
DATA(content) = page2->content( ).
content->_z2ui5( )->info_frontend(
* device_browser = client->_bind( mv_device_browser )
* device_systemtype = client->_bind( mv_device_type )
* ui5_gav = client->_bind( mv_device_gav )
* ui5_theme = client->_bind( mv_device_theme )
ui5_version = client->_bind( mv_ui5_version ) ).
DATA(simple_form2) = content->simple_form(
editable = abap_true
layout = `ResponsiveGridLayout`
labelspanxl = `4`
labelspanl = `3`
labelspanm = `4`
labelspans = `12`
adjustlabelspan = abap_false
emptyspanxl = `0`
emptyspanl = `4`
emptyspanm = `0`
emptyspans = `0`
columnsxl = `1`
columnsl = `1`
columnsm = `1`
singlecontainerfullsize = abap_false
)->content( `form` ).
simple_form2->toolbar( )->title( `Frontend` ).
simple_form2->label( `UI5 Version` ).
simple_form2->text( client->_bind( mv_ui5_version ) ).
simple_form2->label( `Launchpad active` ).
simple_form2->checkbox( enabled = abap_false selected = client->get( )-check_launchpad_active ).
* simple_form2->label( `Browser` ).
* simple_form2->text( client->_bind( mv_device_browser ) ).
* simple_form2->label( `Bootstrap` ).
* simple_form2->text( client->_bind( mv_device_gav ) ).
* simple_form2->label( `Theme` ).
* simple_form2->text( client->_bind( mv_device_theme ) ).
* simple_form2->label( `Type` ).
* simple_form2->text( client->_bind( mv_device_type ) ).
simple_form2->toolbar( )->title( `Backend` ).
simple_form2->label( `ABAP for Cloud` ).
simple_form2->checkbox( enabled = abap_false selected = z2ui5_cl_util=>context_check_abap_cloud( ) ).
DATA(lv_count) = CONV string( NEW z2ui5_cl_core_draft_srv( )->count_entries( ) ).
simple_form2->toolbar( )->title( `abap2UI5` ).
simple_form2->label( `Version ` ).
simple_form2->text( z2ui5_if_app=>version ).
simple_form2->label( `Draft Entries ` ).
simple_form2->text( lv_count ).
page2->end_button( )->button(
text = 'close'
press = client->_event( 'CLOSE' )
type = 'Emphasized' ).
client->popup_display( page2->stringify( ) ).
ENDMETHOD.
METHOD z2ui5_if_app~main.
me->client = client.
IF mv_check_initialized = abap_false.
mv_check_initialized = abap_true.
view_display_start( ).
RETURN.
ENDIF.
IF client->get( )-check_on_navigated = abap_true.
view_display_start( ).
RETURN.
ENDIF.
z2ui5_on_event( ).
ENDMETHOD.
METHOD z2ui5_on_event.
CASE client->get( )-event.
WHEN `CLOSE`.
client->popup_destroy( ).
client->nav_app_leave( client->get_app( client->get( )-s_draft-id_prev_app_stack ) ).
WHEN OTHERS.
ENDCASE.
ENDMETHOD.
ENDCLASS.

View File

@ -1,19 +0,0 @@
CLASS ltcl_app_startup_test DEFINITION FINAL FOR TESTING
DURATION SHORT
RISK LEVEL DANGEROUS.
PRIVATE SECTION.
METHODS first_test FOR TESTING RAISING cx_static_check.
ENDCLASS.
CLASS ltcl_app_startup_test IMPLEMENTATION.
METHOD first_test.
DATA(lo_app) = z2ui5_cl_core_app_info=>factory( ) ##NEEDED.
ENDMETHOD.
ENDCLASS.

View File

@ -3,7 +3,7 @@
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<DEVC>
<CTEXT>abap2UI5 - apps</CTEXT>
<CTEXT>abap2UI5 - app (generated)</CTEXT>
</DEVC>
</asx:values>
</asx:abap>

View File

@ -0,0 +1,86 @@
CLASS z2ui5_cl_app__Component_js DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
CLASS-METHODS get
RETURNING
VALUE(result) TYPE string.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_app__Component_js IMPLEMENTATION.
METHOD get.
result = `sap.ui.define(["sap/ui/core/UIComponent", "z2ui5/model/models",` && |\n| &&
` "z2ui5/cc/DebugTool","z2ui5/cc/Server", "sap/base/Log","sap/ui/VersionInfo"` && |\n| &&
`` && |\n| &&
` ], function (UIComponent, models, DebugTool, Server, Log, VersionInfo) {` && |\n| &&
` return UIComponent.extend("z2ui5.Component", {` && |\n| &&
` metadata: {` && |\n| &&
` manifest: "json"` && |\n| &&
` },` && |\n| &&
` init: async function () {` && |\n| &&
`` && |\n| &&
` UIComponent.prototype.init.apply(this, arguments);` && |\n| &&
`` && |\n| &&
` this.getRouter().initialize();` && |\n| &&
` z2ui5.oRouter = this.getRouter();` && |\n| &&
` this.setModel(models.createDeviceModel(), "device");` && |\n| &&
` this._oLogger = Log.getLogger("abap2UI5");` && |\n| &&
`` && |\n| &&
` z2ui5.oConfig = {};` && |\n| &&
` z2ui5.oConfig.ComponentData = this.getComponentData();` && |\n| &&
`` && |\n| &&
` try {` && |\n| &&
` z2ui5.oLaunchpadService = await this.getService("ShellUIService");` && |\n| &&
` } catch (e) {}` && |\n| &&
`` && |\n| &&
` let oVersionInfo = await VersionInfo.load();` && |\n| &&
` z2ui5.oConfig.UI5VersionInfo = {` && |\n| &&
` version : oVersionInfo.version,` && |\n| &&
` buildTimestamp : oVersionInfo.buildTimestamp,` && |\n| &&
` gav : oVersionInfo.gav,` && |\n| &&
` }` && |\n| &&
`` && |\n| &&
` if (/iPad|iPhone/.test(navigator.platform)) {` && |\n| &&
` window.addEventListener("__pagehide", this.__pagehide.bind(this));` && |\n| &&
` } else {` && |\n| &&
` window.addEventListener("__beforeunload", this.__beforeunload.bind(this));` && |\n| &&
` }` && |\n| &&
`` && |\n| &&
` document.addEventListener("keydown", function (zEvent) {` && |\n| &&
` if (zEvent?.key === "F12") {` && |\n| &&
` new z2ui5.cc.DebugTool().show();` && |\n| &&
` }` && |\n| &&
` });` && |\n| &&
` },` && |\n| &&
`` && |\n| &&
` __beforeunload: function () {` && |\n| &&
` window.removeEventListener("__beforeunload", this.__beforeunload.bind(this));` && |\n| &&
` this.destroy();` && |\n| &&
` },` && |\n| &&
` __pagehide: function () {` && |\n| &&
` window.removeEventListener("__pagehide", this.__pagehide.bind(this));` && |\n| &&
` this.destroy();` && |\n| &&
` },` && |\n| &&
`` && |\n| &&
` exit: function () {` && |\n| &&
` Server.endSession();` && |\n| &&
` if (UIComponent.prototype.exit)` && |\n| &&
` UIComponent.prototype.exit.apply(this, arguments);` && |\n| &&
` },` && |\n| &&
` });` && |\n| &&
`});` && |\n| &&
`` && |\n| &&
``.
ENDMETHOD.
ENDCLASS.

View File

@ -3,14 +3,13 @@
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<VSEOCLASS>
<CLSNAME>Z2UI5_CL_CORE_APP_ERROR</CLSNAME>
<CLSNAME>Z2UI5_CL_APP__COMPONENT_JS</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>abap2UI5 - app error</DESCRIPT>
<DESCRIPT>Z2UI5_CL_APP__COMPONENT_JS</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>
<UNICODE>X</UNICODE>
<WITH_UNIT_TESTS>X</WITH_UNIT_TESTS>
</VSEOCLASS>
</asx:values>
</asx:abap>

View File

@ -0,0 +1,60 @@
CLASS z2ui5_cl_app__index_html DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
CLASS-METHODS get
RETURNING
VALUE(result) TYPE string.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_app__index_html IMPLEMENTATION.
METHOD get.
result = `<!DOCTYPE html>` &&
`<html lang="en">` &&
`<head>` &&
` <meta charset="UTF-8">` &&
` <meta name="viewport" content="width=device-width, initial-scale=1.0">` &&
` <meta http-equiv="X-UA-Compatible" content="IE=edge">` &&
` <title></title>` &&
` <style>` &&
` html, body, body > div, #container, #container-uiarea {` &&
` height: 100%;` &&
` }` &&
` </style>` &&
` <script` &&
` id="sap-ui-bootstrap"` &&
` src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js"` &&
` data-sap-ui-theme="sap_horizon"` &&
` data-sap-ui-resourceroots='{` &&
` "z2ui5": "./"` &&
` }'` &&
` data-sap-ui-oninit="module:sap/ui/core/ComponentSupport"` &&
` data-sap-ui-compatVersion="edge"` &&
` data-sap-ui-async="true"` &&
` data-sap-ui-frameOptions="trusted"` &&
` ></script>` &&
`</head>` &&
`<body class="sapUiBody sapUiSizeCompact" id="content">` &&
` <div` &&
` data-sap-ui-component` &&
` data-name="z2ui5"` &&
` data-id="container"` &&
` data-settings='{"id" : "z2ui5"}'` &&
` data-handle-validation="true"` &&
` ></div>` &&
`</body>` &&
`</html>` &&
``.
ENDMETHOD.
ENDCLASS.

View File

@ -3,9 +3,9 @@
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<VSEOCLASS>
<CLSNAME>Z2UI5_CL_CORE_APP_HELLO_W</CLSNAME>
<CLSNAME>Z2UI5_CL_APP__INDEX_HTML</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>abap2UI5 - app hello world</DESCRIPT>
<DESCRIPT>Z2UI5_CL_APP__INDEX_HTML</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>

View File

@ -0,0 +1,169 @@
CLASS z2ui5_cl_app__manifest DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
CLASS-METHODS get
RETURNING
VALUE(result) TYPE string.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_app__manifest IMPLEMENTATION.
METHOD get.
result = `{` &&
` "_version": "1.65.0",` &&
` "sap.app": {` &&
` "id": "z2ui5",` &&
` "type": "application",` &&
` "applicationVersion": {` &&
` "version": "0.0.1"` &&
` },` &&
` "title": "{{appTitle}}",` &&
` "description": "{{appDescription}}",` &&
` "resources": "resources.json",` &&
` "sourceTemplate": {` &&
` "id": "@sap/generator-fiori:basic",` &&
` "version": "1.15.0",` &&
` "toolsId": "3a966e20-9635-4c28-8861-d1b66f79f1de"` &&
` },` &&
` "dataSources": {` &&
` "mainService": {` &&
` "uri": "_LOCAL_",` &&
` "type": "OData",` &&
` "settings": {` &&
` "annotations": [],` &&
` "localUri": "localService/metadata.xml",` &&
` "odataVersion": "2.0"` &&
` }` &&
` }` &&
` },` &&
` "crossNavigation": {` &&
` "inbounds": {` &&
` "z2ui5-display": {` &&
` "semanticObject": "z2ui5",` &&
` "action": "display",` &&
` "title": "{{flpTitle}}",` &&
` "signature": {` &&
` "parameters": {},` &&
` "additionalParameters": "allowed"` &&
` }` &&
` }` &&
` }` &&
` }` &&
` },` &&
` "sap.ui": {` &&
` "technology": "UI5",` &&
` "icons": {` &&
` "icon": "",` &&
` "favIcon": "",` &&
` "phone": "",` &&
` "phone@2": "",` &&
` "tablet": "",` &&
` "tablet@2": ""` &&
` },` &&
` "deviceTypes": {` &&
` "desktop": true,` &&
` "tablet": true,` &&
` "phone": true` &&
` }` &&
` },` &&
` "sap.ui5": {` &&
` "flexEnabled": true,` &&
` "dependencies": {` &&
` "minUI5Version": "1.128.1",` &&
` "libs": {` &&
` "sap.m": {},` &&
` "sap.ui.core": {}` &&
` }` &&
` },` &&
` "contentDensities": {` &&
` "compact": true,` &&
` "cozy": true` &&
` },` &&
` "services": {` &&
` "ShellUIService": {` &&
` "factoryName": "sap.ushell.ui5service.ShellUIService"` &&
` }` &&
` },` &&
` "models": {` &&
` "": {` &&
` "dataSource": "mainService",` &&
` "preload": true,` &&
` "settings": {}` &&
` }` &&
` },` &&
` "resources": {` &&
` "css": [` &&
` {` &&
` "uri": "css/style.css"` &&
` }` &&
` ]` &&
` },` &&
` "routing": {` &&
` "config": {` &&
` "routerClass": "sap.m.routing.Router",` &&
` "viewType": "XML",` &&
` "async": true,` &&
` "viewPath": "z2ui5.view",` &&
` "controlAggregation": "pages",` &&
` "controlId": "app",` &&
` "clearControlAggregation": false` &&
` },` &&
` "routes": [` &&
` {` &&
` "name": "RouteView1",` &&
` "pattern": ":?query:",` &&
` "target": [` &&
` "TargetView1"` &&
` ]` &&
` },` &&
` {` &&
` "name": "RouteView2",` &&
` "pattern": ":?query:",` &&
` "target": [` &&
` "TargetView2"` &&
` ]` &&
` }` &&
` ],` &&
` "targets": {` &&
` "TargetView1": {` &&
` "viewType": "XML",` &&
` "transition": "flip",` &&
` "clearControlAggregation": false,` &&
` "viewId": "View1",` &&
` "viewName": "View1"` &&
` },` &&
` "TargetView2": {` &&
` "viewType": "XML",` &&
` "transition": "flip",` &&
` "clearControlAggregation": false,` &&
` "viewId": "View2",` &&
` "viewName": "View2"` &&
` }` &&
` }` &&
` },` &&
` "rootView": {` &&
` "viewName": "z2ui5.view.App",` &&
` "type": "XML",` &&
` "async": true,` &&
` "id": "App"` &&
` }` &&
` },` &&
` "sap.cloud": {` &&
` "public": true,` &&
` "service": "z2ui5"` &&
` }` &&
`}` &&
``.
ENDMETHOD.
ENDCLASS.

View File

@ -3,14 +3,13 @@
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<VSEOCLASS>
<CLSNAME>Z2UI5_CL_CORE_APP_INFO</CLSNAME>
<CLSNAME>Z2UI5_CL_APP__MANIFEST</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>abap2UI5 - app system info</DESCRIPT>
<DESCRIPT>Z2UI5_CL_APP__MANIFEST_JSON</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>
<UNICODE>X</UNICODE>
<WITH_UNIT_TESTS>X</WITH_UNIT_TESTS>
</VSEOCLASS>
</asx:values>
</asx:abap>

View File

@ -0,0 +1,156 @@
CLASS z2ui5_cl_app_cc_dbgtl_js DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
CLASS-METHODS get
RETURNING
VALUE(result) TYPE string.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_app_cc_dbgtl_js IMPLEMENTATION.
METHOD get.
result = `sap.ui.define(["sap/ui/core/Control", "sap/ui/core/Fragment", "sap/ui/model/json/JSONModel"], (Control, Fragment, JSONModel) => {` && |\n| &&
` "use strict";` && |\n| &&
`` && |\n| &&
` return Control.extend("z2ui5.cc.DebugTool", {` && |\n| &&
`` && |\n| &&
` prettifyXml: function (sourceXml) {` && |\n| &&
` const xmlDoc = new DOMParser().parseFromString(sourceXml, 'application/xml');` && |\n| &&
` const xsltDoc = new DOMParser().parseFromString(sParse, 'application/xml');` && |\n| &&
`` && |\n| &&
` const xsltProcessor = new XSLTProcessor();` && |\n| &&
` xsltProcessor.importStylesheet(xsltDoc);` && |\n| &&
` const resultDoc = xsltProcessor.transformToDocument(xmlDoc);` && |\n| &&
` const resultXml = new XMLSerializer().serializeToString(resultDoc);` && |\n| &&
` return resultXml.replace(/&gt;/g, ">");` && |\n| &&
` },` && |\n| &&
`` && |\n| &&
` onItemSelect: function (oEvent) {` && |\n| &&
` const selItem = oEvent.getSource().getSelectedKey();` && |\n| &&
` const oView = z2ui5?.oView;` && |\n| &&
` const oResponse = z2ui5?.oResponse;` && |\n| &&
` const displayEditor = this.displayEditor.bind(this);` && |\n| &&
`` && |\n| &&
` switch (selItem) {` && |\n| &&
` case 'CONFIG':` && |\n| &&
` displayEditor(oEvent, JSON.stringify(z2ui5.oConfig, null, 3), 'json');` && |\n| &&
` break;` && |\n| &&
` case 'MODEL':` && |\n| &&
` displayEditor(oEvent, JSON.stringify(oView?.getModel()?.getData(), null, 3), 'json');` && |\n| &&
` break;` && |\n| &&
` case 'VIEW':` && |\n| &&
` const viewContent = oView?.mProperties?.viewContent || z2ui5.responseData.S_FRONT.PARAMS.S_VIEW.XML;` && |\n| &&
` displayEditor(oEvent, this.prettifyXml(viewContent), 'xml', this.prettifyXml(oView?._xContent.outerHTML));` && |\n| &&
` break;` && |\n| &&
` case 'PLAIN':` && |\n| &&
` displayEditor(oEvent, JSON.stringify(z2ui5.responseData, null, 3), 'json');` && |\n| &&
` break;` && |\n| &&
` case 'REQUEST':` && |\n| &&
` displayEditor(oEvent, JSON.stringify(z2ui5.oBody, null, 3), 'json');` && |\n| &&
` break;` && |\n| &&
` case 'POPUP':` && |\n| &&
` displayEditor(oEvent, this.prettifyXml(oResponse?.PARAMS?.S_POPUP?.XML), 'xml');` && |\n| &&
` break;` && |\n| &&
` case 'POPUP_MODEL':` && |\n| &&
` displayEditor(oEvent, JSON.stringify(z2ui5.oViewPopup.getModel().getData(), null, 3), 'json');` && |\n| &&
` break;` && |\n| &&
` case 'POPOVER':` && |\n| &&
` displayEditor(oEvent, oResponse?.PARAMS?.S_POPOVER?.XML, 'xml');` && |\n| &&
` break;` && |\n| &&
` case 'POPOVER_MODEL':` && |\n| &&
` displayEditor(oEvent, JSON.stringify(z2ui5?.oViewPopover?.getModel()?.getData(), null, 3), 'json');` && |\n| &&
` break;` && |\n| &&
` case 'NEST1':` && |\n| &&
` displayEditor(oEvent, this.prettifyXml(z2ui5?.oViewNest?.mProperties?.viewContent), 'xml', this.prettifyXml(z2ui5?.oViewNest?._xContent.outerHTML));` && |\n| &&
` break;` && |\n| &&
` case 'NEST1_MODEL':` && |\n| &&
` displayEditor(oEvent, JSON.stringify(z2ui5?.oViewNest?.getModel()?.getData(), null, 3), 'json');` && |\n| &&
` break;` && |\n| &&
` case 'NEST2':` && |\n| &&
` displayEditor(oEvent, this.prettifyXml(z2ui5?.oViewNest2?.mProperties?.viewContent), 'xml', this.prettifyXml(z2ui5?.oViewNest2?._xContent.outerHTML));` && |\n| &&
` break;` && |\n| &&
` case 'NEST2_MODEL':` && |\n| &&
` displayEditor(oEvent, JSON.stringify(z2ui5?.oViewNest2?.getModel()?.getData(), null, 3), 'json');` && |\n| &&
` break;` && |\n| &&
` case 'SOURCE':` && |\n| &&
` const parent = oEvent.getSource().getParent();` && |\n| &&
` const contentControl = parent.getContent()[2].getItems()[0];` && |\n| &&
` const url = ``${window.location.origin}/sap/bc/adt/oo/classes/${z2ui5.responseData.S_FRONT.APP}/source/main``;` && |\n| &&
` const content = atob('PGlmcmFtZSBpZD0idGVzdCIgc3JjPSInICsgdXJsICsgJyIgaGVpZ2h0PSI4MDBweCIgd2lkdGg9IjEyMDBweCIgLz4=').replace("' + url + '", url);` && |\n| &&
` contentControl.setProperty("content", content);` && |\n| &&
` const modelData = oEvent.getSource().getModel().oData;` && |\n| &&
` modelData.editor_visible = false;` && |\n| &&
` modelData.source_visible = true;` && |\n| &&
` oEvent.getSource().getModel().refresh();` && |\n| &&
` break;` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
`` && |\n| &&
` displayEditor: function (oEvent, content, type, xcontent = "") {` && |\n| &&
` const modelData = oEvent.getSource().getModel().oData;` && |\n| &&
` modelData.editor_visible = true;` && |\n| &&
` modelData.source_visible = false;` && |\n| &&
` modelData.isTemplating = content.includes("xmlns:template");` && |\n| &&
` modelData.value = content;` && |\n| &&
` modelData.previousValue = content;` && |\n| &&
` modelData.xContent = xcontent;` && |\n| &&
` modelData.type = type;` && |\n| &&
` oEvent.getSource().getModel().refresh();` && |\n| &&
` },` && |\n| &&
`` && |\n| &&
` onTemplatingPress: function (oEvent) {` && |\n| &&
` const modelData = oEvent.getSource().getModel().oData;` && |\n| &&
` modelData.value = oEvent.getSource().getPressed() ? modelData.xContent : modelData.previousValue;` && |\n| &&
` oEvent.getSource().getModel().refresh();` && |\n| &&
` },` && |\n| &&
`` && |\n| &&
` onClose: function () {` && |\n| &&
` this.oDialog.close();` && |\n| &&
` },` && |\n| &&
`` && |\n| &&
` async show() {` && |\n| &&
` if (!this.oDialog) {` && |\n| &&
` this.oDialog = await Fragment.load({` && |\n| &&
` name: "z2ui5.cc.DebugTool",` && |\n| &&
` controller: this,` && |\n| &&
` });` && |\n| &&
` }` && |\n| &&
`` && |\n| &&
` const value = JSON.stringify(z2ui5.responseData, null, 3);` && |\n| &&
` const oData = {` && |\n| &&
` type: 'json',` && |\n| &&
` source_visible: false,` && |\n| &&
` editor_visible: true,` && |\n| &&
` value: value,` && |\n| &&
` xContent: '',` && |\n| &&
` previousValue: value,` && |\n| &&
` isTemplating: false,` && |\n| &&
` templatingSource: false,` && |\n| &&
` activeNest1: z2ui5?.oViewNest?.mProperties?.viewContent !== undefined,` && |\n| &&
` activeNest2: z2ui5?.oViewNest2?.mProperties?.viewContent !== undefined,` && |\n| &&
` activePopup: z2ui5?.oResponse?.PARAMS?.S_POPUP?.XML !== undefined,` && |\n| &&
` activePopover: z2ui5?.oResponse?.PARAMS?.S_POPOVER?.XML !== undefined,` && |\n| &&
` };` && |\n| &&
` const oModel = new JSONModel(oData);` && |\n| &&
`` && |\n| &&
` this.oDialog.addStyleClass('dbg-ltr');` && |\n| &&
` this.oDialog.setModel(oModel);` && |\n| &&
` this.oDialog.open();` && |\n| &&
` }` && |\n| &&
` });` && |\n| &&
`});` && |\n| &&
`` && |\n| &&
``.
ENDMETHOD.
ENDCLASS.

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<VSEOCLASS>
<CLSNAME>Z2UI5_CL_APP_CC_DBGTL_JS</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>Z2UI5_CL_APP_CC_DEBUGTOOL_JS</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>
<UNICODE>X</UNICODE>
</VSEOCLASS>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -0,0 +1,130 @@
CLASS z2ui5_cl_app_cc_dbgtl_xml DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
CLASS-METHODS get
RETURNING
VALUE(result) TYPE string.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_app_cc_dbgtl_xml IMPLEMENTATION.
METHOD get.
result = `<core:FragmentDefinition` &&
` xmlns="sap.m"` &&
` xmlns:mvc="sap.ui.core.mvc"` &&
` xmlns:core="sap.ui.core"` &&
` xmlns:html="http://www.w3.org/1999/xhtml"` &&
` xmlns:ce="sap.ui.codeeditor"` &&
`>` &&
` <Dialog` &&
` title="abap2UI5 - Debug Tool"` &&
` stretch="true"` &&
` >` &&
` <IconTabHeader` &&
` selectedKey="PLAIN"` &&
` select="onItemSelect"` &&
` >` &&
` <items>` &&
` <IconTabFilter` &&
` text="Config"` &&
` key="CONFIG"` &&
` enabled="true"` &&
` />` &&
` <IconTabFilter` &&
` text="Previous Request"` &&
` key="REQUEST"` &&
` enabled="true"` &&
` />` &&
` <IconTabFilter` &&
` text="Response"` &&
` key="PLAIN"` &&
` />` &&
` <IconTabFilter` &&
` text="Source Code"` &&
` key="SOURCE"` &&
` />` &&
` <IconTabFilter` &&
` text="View"` &&
` key="VIEW"` &&
` />` &&
` <IconTabFilter` &&
` text="View Model"` &&
` key="MODEL"` &&
` />` &&
` <IconTabFilter` &&
` text="Popup"` &&
` key="POPUP"` &&
` enabled="{/activePopup}"` &&
` />` &&
` <IconTabFilter` &&
` text="Popup Model"` &&
` key="POPUP_MODEL"` &&
` enabled="{/activePopup}"` &&
` />` &&
` <IconTabFilter` &&
` text="Popover"` &&
` key="POPOVER"` &&
` enabled="{/activePopover}"` &&
` />` &&
` <IconTabFilter` &&
` text="Popover Model"` &&
` key="POPOVER_MODEL"` &&
` enabled="{/activePopover}"` &&
` />` &&
` <IconTabFilter` &&
` text="Nest1"` &&
` key="NEST1"` &&
` enabled="{/activeNest1}"` &&
` />` &&
` <IconTabFilter` &&
` text="Nest1 Model"` &&
` key="NEST1_MODEL"` &&
` enabled="{/activeNest1}"` &&
` />` &&
` <IconTabFilter` &&
` text="Nest2"` &&
` key="NEST2"` &&
` enabled="{/activeNest2}"` &&
` />` &&
` <IconTabFilter` &&
` text="Nest2 Model"` &&
` key="NEST2_MODEL"` &&
` enabled="{/activeNest2}"` &&
` />` &&
` </items>` &&
` </IconTabHeader>` &&
` <VBox>` &&
` <ToggleButton text="Source XML after Templating" visible="{/isTemplating}" pressed="{/templatingSource}" press="onTemplatingPress" />` &&
` <ce:CodeEditor` &&
` type="{/type}"` &&
` value="{/value}"` &&
` height="2000px"` &&
` width="10000px"` &&
` visible="{/editor_visible}"` &&
` /></VBox>` &&
` <VBox visible="{/source_visible}">` &&
` <core:HTML/>` &&
` </VBox>` &&
` <endButton>` &&
` <Button` &&
` text="Close"` &&
` press="onClose"` &&
` />` &&
` </endButton>` &&
` </Dialog>` &&
`</core:FragmentDefinition>` &&
`` &&
``.
ENDMETHOD.
ENDCLASS.

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<VSEOCLASS>
<CLSNAME>Z2UI5_CL_APP_CC_DBGTL_XML</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>Z2UI5_CL_APP_CC_DEBUGTOOL_XML</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>
<UNICODE>X</UNICODE>
</VSEOCLASS>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -0,0 +1,172 @@
CLASS z2ui5_cl_app_cc_Server_js DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
CLASS-METHODS get
RETURNING
VALUE(result) TYPE string.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_app_cc_Server_js IMPLEMENTATION.
METHOD get.
result = `sap.ui.define(["sap/ui/core/BusyIndicator","sap/m/MessageBox"` && |\n| &&
`],` && |\n| &&
` function (BusyIndicator, MessageBox) {` && |\n| &&
` "use strict";` && |\n| &&
`` && |\n| &&
` return {` && |\n| &&
`` && |\n| &&
` endSession: function () {` && |\n| &&
`` && |\n| &&
` if (z2ui5.contextId) {` && |\n| &&
` fetch(z2ui5.oConfig.pathname, {` && |\n| &&
` method: 'HEAD',` && |\n| &&
` keepalive: true,` && |\n| &&
` headers: {` && |\n| &&
` 'sap-terminate': 'session',` && |\n| &&
` 'sap-contextid': z2ui5.contextId,` && |\n| &&
` 'sap-contextid-accept': 'header'` && |\n| &&
` }` && |\n| &&
` });` && |\n| &&
` delete z2ui5.contextId;` && |\n| &&
` }` && |\n| &&
`` && |\n| &&
` },` && |\n| &&
` Roundtrip() {` && |\n| &&
` z2ui5.checkTimerActive = false;` && |\n| &&
` z2ui5.checkNestAfter = false;` && |\n| &&
` z2ui5.checkNestAfter2 = false;` && |\n| &&
` let event = (args) => {` && |\n| &&
` if (args != undefined) {` && |\n| &&
` return args[0][0];` && |\n| &&
` }` && |\n| &&
` };` && |\n| &&
`` && |\n| &&
` z2ui5.oBody ??= {};` && |\n| &&
` z2ui5.oBody.S_FRONT = {` && |\n| &&
` ID: z2ui5?.oBody?.ID,` && |\n| &&
` CONFIG: z2ui5.oConfig,` && |\n| &&
` XX: z2ui5?.oBody?.XX,` && |\n| &&
` ORIGIN: window.location.origin,` && |\n| &&
` PATHNAME: window.location.pathname,` && |\n| &&
` SEARCH: (z2ui5.search) ? z2ui5.search : window.location.search,` && |\n| &&
` VIEW: z2ui5.oBody?.VIEWNAME,` && |\n| &&
` EVENT: event(z2ui5.oBody?.ARGUMENTS),` && |\n| &&
` HASH: window.location.hash,` && |\n| &&
` };` && |\n| &&
` if (z2ui5.oBody?.ARGUMENTS != undefined) {` && |\n| &&
` if (z2ui5.oBody?.ARGUMENTS.length > 0) {` && |\n| &&
` z2ui5.oBody?.ARGUMENTS.shift();` && |\n| &&
` }` && |\n| &&
` }` && |\n| &&
` z2ui5.oBody.S_FRONT.T_EVENT_ARG = z2ui5.oBody?.ARGUMENTS;` && |\n| &&
` delete z2ui5.oBody.ID;` && |\n| &&
` delete z2ui5.oBody?.VIEWNAME;` && |\n| &&
` delete z2ui5.oBody?.S_FRONT.XX;` && |\n| &&
` delete z2ui5.oBody?.ARGUMENTS;` && |\n| &&
` if (!z2ui5.oBody.S_FRONT.T_EVENT_ARG) {` && |\n| &&
` delete z2ui5.oBody.S_FRONT.T_EVENT_ARG;` && |\n| &&
` }` && |\n| &&
` if (z2ui5.oBody.S_FRONT.T_EVENT_ARG) {` && |\n| &&
` if (z2ui5.oBody.S_FRONT.T_EVENT_ARG.length == 0) {` && |\n| &&
` delete z2ui5.oBody.S_FRONT.T_EVENT_ARG;` && |\n| &&
` }` && |\n| &&
` }` && |\n| &&
` if (z2ui5.oBody.S_FRONT.T_STARTUP_PARAMETERS == undefined) {` && |\n| &&
` delete z2ui5.oBody.S_FRONT.T_STARTUP_PARAMETERS;` && |\n| &&
` }` && |\n| &&
` if (z2ui5.oBody.S_FRONT.SEARCH == '') {` && |\n| &&
` delete z2ui5.oBody.S_FRONT.SEARCH;` && |\n| &&
` }` && |\n| &&
` if (!z2ui5.oBody.XX) {` && |\n| &&
` delete z2ui5.oBody.XX;` && |\n| &&
` }` && |\n| &&
` this.readHttp();` && |\n| &&
` },` && |\n| &&
`` && |\n| &&
` async readHttp() {` && |\n| &&
` const response = await fetch(z2ui5.oConfig.pathname, {` && |\n| &&
` method: 'POST',` && |\n| &&
` headers: {` && |\n| &&
` 'Content-Type': 'application/json',` && |\n| &&
` 'sap-contextid-accept': 'header',` && |\n| &&
` 'sap-contextid': z2ui5.contextId` && |\n| &&
` },` && |\n| &&
` body: JSON.stringify(z2ui5.oBody)` && |\n| &&
` });` && |\n| &&
` z2ui5.contextId = response.headers.get("sap-contextid");` && |\n| &&
` if (!response.ok) {` && |\n| &&
` const responseText = await response.text();` && |\n| &&
` this.responseError(responseText);` && |\n| &&
` } else {` && |\n| &&
` const responseData = await response.json();` && |\n| &&
` z2ui5.responseData = responseData;` && |\n| &&
` this.responseSuccess({` && |\n| &&
` ID: responseData.S_FRONT.ID,` && |\n| &&
` PARAMS: responseData.S_FRONT.PARAMS,` && |\n| &&
` OVIEWMODEL: responseData.MODEL,` && |\n| &&
` });` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
` async responseSuccess(response) {` && |\n| &&
` try {` && |\n| &&
` z2ui5.oResponse = response;` && |\n| &&
` if (z2ui5.oResponse.PARAMS?.S_VIEW?.CHECK_DESTROY) {` && |\n| &&
` z2ui5.oController.ViewDestroy();` && |\n| &&
` }` && |\n| &&
` ; if (z2ui5.oResponse.PARAMS?.S_FOLLOW_UP_ACTION?.CUSTOM_JS) {` && |\n| &&
` setTimeout(() => {` && |\n| &&
` let mParams = z2ui5.oResponse?.PARAMS.S_FOLLOW_UP_ACTION.CUSTOM_JS.split("'");` && |\n| &&
` let mParamsEF = mParams.filter((val, index) => index % 2)` && |\n| &&
` if (mParamsEF.length) {` && |\n| &&
` z2ui5.oController.eF.apply(undefined, mParamsEF);` && |\n| &&
` } else {` && |\n| &&
` Function("return " + mParams[0])();` && |\n| &&
` }` && |\n| &&
` }, 100);` && |\n| &&
` };` && |\n| &&
` z2ui5.oController.showMessage('S_MSG_TOAST', z2ui5.oResponse.PARAMS);` && |\n| &&
` z2ui5.oController.showMessage('S_MSG_BOX', z2ui5.oResponse.PARAMS);` && |\n| &&
` if (z2ui5.oResponse.PARAMS?.S_VIEW?.XML) {` && |\n| &&
` if (z2ui5.oResponse.PARAMS?.S_VIEW?.XML !== '') {` && |\n| &&
` z2ui5.oController.ViewDestroy();` && |\n| &&
` await z2ui5.oController.displayView(z2ui5.oResponse.PARAMS.S_VIEW.XML, z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
` return;` && |\n| &&
` }` && |\n| &&
` }` && |\n| &&
` z2ui5.oController.updateModelIfRequired('S_VIEW', z2ui5.oView);` && |\n| &&
` z2ui5.oController.updateModelIfRequired('S_VIEW_NEST', z2ui5.oViewNest);` && |\n| &&
` z2ui5.oController.updateModelIfRequired('S_VIEW_NEST2', z2ui5.oViewNest2);` && |\n| &&
` z2ui5.oController.updateModelIfRequired('S_POPUP', z2ui5.oViewPopup);` && |\n| &&
` z2ui5.oController.updateModelIfRequired('S_POPOVER', z2ui5.oViewPopover);` && |\n| &&
` z2ui5.oController.onAfterRendering();` && |\n| &&
` } catch (e) {` && |\n| &&
` BusyIndicator.hide();` && |\n| &&
` if (e.message.includes("openui5")) {` && |\n| &&
` if (e.message.includes("script load error")) {` && |\n| &&
` z2ui5.oController.checkSDKcompatibility(e)` && |\n| &&
` }` && |\n| &&
` } else {` && |\n| &&
` MessageBox.error(e.toLocaleString());` && |\n| &&
` }` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
` responseError(response) {` && |\n| &&
` document.write(response);` && |\n| &&
` },` && |\n| &&
` };` && |\n| &&
` });` && |\n| &&
``.
ENDMETHOD.
ENDCLASS.

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<VSEOCLASS>
<CLSNAME>Z2UI5_CL_APP_CC_SERVER_JS</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>Z2UI5_CL_APP_CC_SERVER_JS</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>
<UNICODE>X</UNICODE>
</VSEOCLASS>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -0,0 +1,805 @@
CLASS z2ui5_cl_app_cont_App_js DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
CLASS-METHODS get
RETURNING
VALUE(result) TYPE string.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_app_cont_App_js IMPLEMENTATION.
METHOD get.
result = `sap.ui.define(["sap/ui/core/mvc/Controller",` && |\n| &&
` "z2ui5/controller/View1.controller",` && |\n| &&
`], function (BaseController, Controller) {` && |\n| &&
` return BaseController.extend("z2ui5.controller.App", {` && |\n| &&
`` && |\n| &&
` onInit: async function () {` && |\n| &&
`` && |\n| &&
` z2ui5.oConfig.pathname = this.getView().getModel().sServiceUrl;` && |\n| &&
` if (z2ui5.oConfig.pathname == '_LOCAL_') {` && |\n| &&
` z2ui5.oConfig.pathname = window.location.href;` && |\n| &&
` };` && |\n| &&
`` && |\n| &&
` z2ui5.oController = new Controller();` && |\n| &&
` z2ui5.oController.setApp(this.getView().byId("app"));` && |\n| &&
`` && |\n| &&
` z2ui5.oControllerNest = new Controller();` && |\n| &&
` z2ui5.oControllerNest2 = new Controller();` && |\n| &&
` z2ui5.oControllerPopup = new Controller();` && |\n| &&
` z2ui5.oControllerPopover = new Controller();` && |\n| &&
`` && |\n| &&
` z2ui5.onBeforeRoundtrip = [];` && |\n| &&
` z2ui5.onAfterRendering = [];` && |\n| &&
` z2ui5.onBeforeEventFrontend = [];` && |\n| &&
` z2ui5.onAfterRoundtrip = [];` && |\n| &&
`` && |\n| &&
` z2ui5.checkNestAfter = false;` && |\n| &&
`` && |\n| &&
` }` && |\n| &&
` });` && |\n| &&
`});` && |\n| &&
`` && |\n| &&
`` && |\n| &&
`sap.ui.define("z2ui5/Timer", ["sap/ui/core/Control"], (Control) => {` && |\n| &&
` "use strict";` && |\n| &&
`` && |\n| &&
` return Control.extend("z2ui5.Timer", {` && |\n| &&
` metadata: {` && |\n| &&
` properties: {` && |\n| &&
` delayMS: {` && |\n| &&
` type: "string",` && |\n| &&
` defaultValue: ""` && |\n| &&
` },` && |\n| &&
` checkActive: {` && |\n| &&
` type: "boolean",` && |\n| &&
` defaultValue: true` && |\n| &&
` },` && |\n| &&
` checkRepeat: {` && |\n| &&
` type: "boolean",` && |\n| &&
` defaultValue: false` && |\n| &&
` },` && |\n| &&
` },` && |\n| &&
` events: {` && |\n| &&
` "finished": {` && |\n| &&
` allowPreventDefault: true,` && |\n| &&
` parameters: {},` && |\n| &&
` }` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
` onAfterRendering() { },` && |\n| &&
` delayedCall(oControl) {` && |\n| &&
`` && |\n| &&
` if (oControl.getProperty("checkActive") == false) {` && |\n| &&
` return;` && |\n| &&
` }` && |\n| &&
` setTimeout((oControl) => {` && |\n| &&
` oControl.setProperty("checkActive", false)` && |\n| &&
` oControl.fireFinished();` && |\n| &&
` if (oControl.getProperty("checkRepeat")) {` && |\n| &&
` oControl.delayedCall(oControl);` && |\n| &&
` }` && |\n| &&
` }` && |\n| &&
` , parseInt(oControl.getProperty("delayMS")), oControl);` && |\n| &&
` },` && |\n| &&
` renderer(oRm, oControl) {` && |\n| &&
` oControl.delayedCall(oControl);` && |\n| &&
` }` && |\n| &&
` });` && |\n| &&
`}` && |\n| &&
`);` && |\n| &&
`` && |\n| &&
`sap.ui.define("z2ui5/Focus", ["sap/ui/core/Control",], (Control) => {` && |\n| &&
` "use strict";` && |\n| &&
` return Control.extend("z2ui5.Focus", {` && |\n| &&
` metadata: {` && |\n| &&
` properties: {` && |\n| &&
` setUpdate: {` && |\n| &&
` type: "boolean",` && |\n| &&
` defaultValue: true` && |\n| &&
` },` && |\n| &&
` focusId: {` && |\n| &&
` type: "string"` && |\n| &&
` },` && |\n| &&
` selectionStart: {` && |\n| &&
` type: "string",` && |\n| &&
` defaultValue: "0"` && |\n| &&
` },` && |\n| &&
` selectionEnd: {` && |\n| &&
` type: "string",` && |\n| &&
` defaultValue: "0"` && |\n| &&
` },` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
` init() { },` && |\n| &&
` setFocusId(val) {` && |\n| &&
` try {` && |\n| &&
` this.setProperty("focusId", val);` && |\n| &&
` var oElement = z2ui5.oView.byId(val);` && |\n| &&
` var oFocus = oElement.getFocusInfo();` && |\n| &&
` oElement.applyFocusInfo(oFocus);` && |\n| &&
` } catch (e) { }` && |\n| &&
` },` && |\n| &&
` renderer(oRm, oControl) {` && |\n| &&
` if (!oControl.getProperty("setUpdate")) {` && |\n| &&
` return;` && |\n| &&
` }` && |\n| &&
` oControl.setProperty("setUpdate", false);` && |\n| &&
` setTimeout((oControl) => {` && |\n| &&
` var oElement = z2ui5.oView.byId(oControl.getProperty("focusId"));` && |\n| &&
` var oFocus = oElement.getFocusInfo();` && |\n| &&
` oFocus.selectionStart = parseInt(oControl.getProperty("selectionStart"));` && |\n| &&
` oFocus.selectionEnd = parseInt(oControl.getProperty("selectionEnd"));` && |\n| &&
` oElement.applyFocusInfo(oFocus);` && |\n| &&
` }` && |\n| &&
` , 100, oControl);` && |\n| &&
` }` && |\n| &&
` });` && |\n| &&
`}` && |\n| &&
`);` && |\n| &&
`` && |\n| &&
`sap.ui.define("z2ui5/Title", ["sap/ui/core/Control"], (Control) => {` && |\n| &&
` "use strict";` && |\n| &&
` return Control.extend("z2ui5.Title", {` && |\n| &&
` metadata: {` && |\n| &&
` properties: {` && |\n| &&
` title: {` && |\n| &&
` type: "string"` && |\n| &&
` },` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
` setTitle(val) {` && |\n| &&
` this.setProperty("title", val);` && |\n| &&
` document.title = val;` && |\n| &&
` },` && |\n| &&
` renderer(oRm, oControl) { }` && |\n| &&
` });` && |\n| &&
`}` && |\n| &&
`);` && |\n| &&
`sap.ui.define("z2ui5/LPTitle", ["sap/ui/core/Control"], (Control) => {` && |\n| &&
` "use strict";` && |\n| &&
` return Control.extend("z2ui5.LPTitle", {` && |\n| &&
` metadata: {` && |\n| &&
` properties: {` && |\n| &&
` title: {` && |\n| &&
` type: "string"` && |\n| &&
` },` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
` setTitle(val) {` && |\n| &&
` try {` && |\n| &&
` this.setProperty("title", val);` && |\n| &&
` z2ui5.oLaunchpadService.setTitle(val);` && |\n| &&
` } catch (e) {` && |\n| &&
` console.error("Launchpad Service to set Title not found");` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
` renderer(oRm, oControl) { }` && |\n| &&
` });` && |\n| &&
`}` && |\n| &&
`);` && |\n| &&
`sap.ui.define("z2ui5/History", ["sap/ui/core/Control"], (Control) => {` && |\n| &&
` "use strict";` && |\n| &&
` return Control.extend("z2ui5.History", {` && |\n| &&
` metadata: {` && |\n| &&
` properties: {` && |\n| &&
` search: {` && |\n| &&
` type: "string"` && |\n| &&
` },` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
` setSearch(val) {` && |\n| &&
` this.setProperty("search", val);` && |\n| &&
` history.replaceState(null, null, window.location.pathname + val);` && |\n| &&
` },` && |\n| &&
` renderer(oRm, oControl) { }` && |\n| &&
` });` && |\n| &&
`}` && |\n| &&
`);` && |\n| &&
`sap.ui.define("z2ui5/Scrolling", ["sap/ui/core/Control"], (Control) => {` && |\n| &&
` "use strict";` && |\n| &&
`` && |\n| &&
` return Control.extend("z2ui5.Scrolling", {` && |\n| &&
` metadata: {` && |\n| &&
` properties: {` && |\n| &&
` setUpdate: {` && |\n| &&
` type: "boolean",` && |\n| &&
` defaultValue: true` && |\n| &&
` },` && |\n| &&
` items: {` && |\n| &&
` type: "Array"` && |\n| &&
` }` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
`` && |\n| &&
` setBackend() {` && |\n| &&
` const items = this.getProperty("items");` && |\n| &&
`` && |\n| &&
` if (items) {` && |\n| &&
` items.forEach(item => {` && |\n| &&
` try {` && |\n| &&
` const scrollDelegate = z2ui5.oView.byId(item.ID).getScrollDelegate();` && |\n| &&
` item.SCROLLTO = scrollDelegate ? scrollDelegate.getScrollTop() : 0;` && |\n| &&
` } catch {` && |\n| &&
` try {` && |\n| &&
` const element = document.getElementById(``${z2ui5.oView.byId(item.ID).getId()}-inner``);` && |\n| &&
` item.SCROLLTO = element ? element.scrollTop : 0;` && |\n| &&
` } catch {}` && |\n| &&
` }` && |\n| &&
` });` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
`` && |\n| &&
` init() {` && |\n| &&
` z2ui5.onBeforeRoundtrip.push(this.setBackend.bind(this));` && |\n| &&
` },` && |\n| &&
`` && |\n| &&
` renderer(oRm, oControl) {` && |\n| &&
` if (!oControl.getProperty("setUpdate")) return;` && |\n| &&
`` && |\n| &&
` oControl.setProperty("setUpdate", false);` && |\n| &&
` const items = oControl.getProperty("items");` && |\n| &&
` if (!items) return;` && |\n| &&
`` && |\n| &&
` setTimeout(() => {` && |\n| &&
` items.forEach(item => {` && |\n| &&
` try {` && |\n| &&
` z2ui5.oView.byId(item.ID).scrollTo(item.SCROLLTO);` && |\n| &&
` } catch {` && |\n| &&
` try {` && |\n| &&
` const element = document.getElementById(``${z2ui5.oView.byId(item.ID).getId()}-inner``);` && |\n| &&
` if (element) element.scrollTop = item.SCROLLTO;` && |\n| &&
` } catch {` && |\n| &&
` setTimeout(() => {` && |\n| &&
` z2ui5.oView.byId(item.ID).scrollTo(item.SCROLLTO);` && |\n| &&
` }, 1);` && |\n| &&
` }` && |\n| &&
` }` && |\n| &&
` });` && |\n| &&
` }, 100);` && |\n| &&
` }` && |\n| &&
` });` && |\n| &&
`});` && |\n| &&
`` && |\n| &&
`` && |\n| &&
`` && |\n| &&
`sap.ui.define("z2ui5/Info", ["sap/ui/core/Control", "sap/ui/VersionInfo", "sap/ui/Device"], (Control, VersionInfo, Device) => {` && |\n| &&
` "use strict";` && |\n| &&
`` && |\n| &&
` return Control.extend("z2ui5.Info", {` && |\n| &&
` metadata: {` && |\n| &&
` properties: {` && |\n| &&
` ui5_version: {` && |\n| &&
` type: "string"` && |\n| &&
` },` && |\n| &&
` device_phone: {` && |\n| &&
` type: "string"` && |\n| &&
` },` && |\n| &&
` device_desktop: {` && |\n| &&
` type: "string"` && |\n| &&
` },` && |\n| &&
` device_tablet: {` && |\n| &&
` type: "string"` && |\n| &&
` },` && |\n| &&
` device_combi: {` && |\n| &&
` type: "string"` && |\n| &&
` },` && |\n| &&
` device_height: {` && |\n| &&
` type: "string"` && |\n| &&
` },` && |\n| &&
` device_width: {` && |\n| &&
` type: "string"` && |\n| &&
` },` && |\n| &&
` ui5_theme: {` && |\n| &&
` type: "string"` && |\n| &&
` },` && |\n| &&
` device_os: {` && |\n| &&
` type: "string"` && |\n| &&
` },` && |\n| &&
` device_systemtype: {` && |\n| &&
` type: "string"` && |\n| &&
` },` && |\n| &&
` device_browser: {` && |\n| &&
` type: "string"` && |\n| &&
` },` && |\n| &&
` },` && |\n| &&
` events: {` && |\n| &&
` "finished": {` && |\n| &&
` allowPreventDefault: true,` && |\n| &&
` parameters: {},` && |\n| &&
` }` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
`` && |\n| &&
` init() { },` && |\n| &&
`` && |\n| &&
` onAfterRendering() {` && |\n| &&
` },` && |\n| &&
`` && |\n| &&
` async renderer(oRm, oControl) {` && |\n| &&
`` && |\n| &&
` debugger;` && |\n| &&
` let oDevice = z2ui5.oView.getModel("device").oData;` && |\n| &&
` oControl.setProperty("device_phone", oDevice.system.phone);` && |\n| &&
` oControl.setProperty("device_desktop", oDevice.system.desktop);` && |\n| &&
` oControl.setProperty("device_tablet", oDevice.system.tablet);` && |\n| &&
` oControl.setProperty("device_combi", oDevice.system.combi);` && |\n| &&
` oControl.setProperty("device_height", oDevice.resize.height);` && |\n| &&
` oControl.setProperty("device_width", oDevice.resize.width);` && |\n| &&
` oControl.setProperty("device_os", oDevice.os.name);` && |\n| &&
` oControl.setProperty("device_browser", oDevice.browser.name);` && |\n| &&
` oControl.fireFinished();` && |\n| &&
`` && |\n| &&
` }` && |\n| &&
` });` && |\n| &&
`}` && |\n| &&
`);` && |\n| &&
`` && |\n| &&
`sap.ui.define("z2ui5/Geolocation", ["sap/ui/core/Control"], (Control) => {` && |\n| &&
` "use strict";` && |\n| &&
`` && |\n| &&
` return Control.extend("z2ui5.Geolocation", {` && |\n| &&
` metadata: {` && |\n| &&
` properties: {` && |\n| &&
` longitude: {` && |\n| &&
` type: "string",` && |\n| &&
` defaultValue: ""` && |\n| &&
` },` && |\n| &&
` latitude: {` && |\n| &&
` type: "string",` && |\n| &&
` defaultValue: ""` && |\n| &&
` },` && |\n| &&
` altitude: {` && |\n| &&
` type: "string",` && |\n| &&
` defaultValue: ""` && |\n| &&
` },` && |\n| &&
` accuracy: {` && |\n| &&
` type: "string",` && |\n| &&
` defaultValue: ""` && |\n| &&
` },` && |\n| &&
` altitudeAccuracy: {` && |\n| &&
` type: "string",` && |\n| &&
` defaultValue: ""` && |\n| &&
` },` && |\n| &&
` speed: {` && |\n| &&
` type: "string",` && |\n| &&
` defaultValue: false` && |\n| &&
` },` && |\n| &&
` heading: {` && |\n| &&
` type: "string",` && |\n| &&
` defaultValue: false` && |\n| &&
` },` && |\n| &&
` enableHighAccuracy: {` && |\n| &&
` type: "boolean",` && |\n| &&
` defaultValue: false` && |\n| &&
` },` && |\n| &&
` timeout: {` && |\n| &&
` type: "string",` && |\n| &&
` defaultValue: "5000"` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
` events: {` && |\n| &&
` "finished": {` && |\n| &&
` allowPreventDefault: true,` && |\n| &&
` parameters: {},` && |\n| &&
` }` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
`` && |\n| &&
` callbackPosition(position) {` && |\n| &&
`` && |\n| &&
` var test = position.coords.longitude` && |\n| &&
` this.setProperty("longitude", position.coords.longitude, true);` && |\n| &&
` this.setProperty("latitude", position.coords.latitude, true);` && |\n| &&
` this.setProperty("altitude", position.coords.altitude, true);` && |\n| &&
` this.setProperty("accuracy", position.coords.accuracy, true);` && |\n| &&
` this.setProperty("altitudeAccuracy", position.coords.altitudeAccuracy, true);` && |\n| &&
` this.setProperty("speed", position.coords.speed, true);` && |\n| &&
` this.setProperty("heading", position.coords.heading, true);` && |\n| &&
` this.fireFinished();` && |\n| &&
` //this.getParent().getParent().getModel().refresh();` && |\n| &&
`` && |\n| &&
` },` && |\n| &&
`` && |\n| &&
` async init() {` && |\n| &&
`` && |\n| &&
` navigator.geolocation.getCurrentPosition(this.callbackPosition.bind(this));` && |\n| &&
` //navigator.geolocation.watchPosition(this.callbackPosition.bind(this));` && |\n| &&
`` && |\n| &&
` },` && |\n| &&
`` && |\n| &&
` exit() {//clearWatch` && |\n| &&
` },` && |\n| &&
`` && |\n| &&
` onAfterRendering() {` && |\n| &&
` },` && |\n| &&
`` && |\n| &&
` renderer(oRm, oControl) {` && |\n| &&
` }` && |\n| &&
` });` && |\n| &&
`}` && |\n| &&
`);` && |\n| &&
`` && |\n| &&
`sap.ui.define("z2ui5/FileUploader", ["sap/ui/core/Control", "sap/m/Button", "sap/ui/unified/FileUploader", "sap/m/HBox"], function (Control, Button, FileUploader, HBox) {` && |\n| &&
` "use strict";` && |\n| &&
`` && |\n| &&
` return Control.extend("z2ui5.FileUploader", {` && |\n| &&
`` && |\n| &&
` metadata: {` && |\n| &&
` properties: {` && |\n| &&
` value: {` && |\n| &&
` type: "string",` && |\n| &&
` defaultValue: ""` && |\n| &&
` },` && |\n| &&
` path: {` && |\n| &&
` type: "string",` && |\n| &&
` defaultValue: ""` && |\n| &&
` },` && |\n| &&
` tooltip: {` && |\n| &&
` type: "string",` && |\n| &&
` defaultValue: ""` && |\n| &&
` },` && |\n| &&
` fileType: {` && |\n| &&
` type: "string",` && |\n| &&
` defaultValue: ""` && |\n| &&
` },` && |\n| &&
` placeholder: {` && |\n| &&
` type: "string",` && |\n| &&
` defaultValue: ""` && |\n| &&
` },` && |\n| &&
` buttonText: {` && |\n| &&
` type: "string",` && |\n| &&
` defaultValue: ""` && |\n| &&
` },` && |\n| &&
` style: {` && |\n| &&
` type: "string",` && |\n| &&
` defaultValue: ""` && |\n| &&
` },` && |\n| &&
` uploadButtonText: {` && |\n| &&
` type: "string",` && |\n| &&
` defaultValue: "Upload"` && |\n| &&
` },` && |\n| &&
` enabled: {` && |\n| &&
` type: "boolean",` && |\n| &&
` defaultValue: true` && |\n| &&
` },` && |\n| &&
` icon: {` && |\n| &&
` type: "string",` && |\n| &&
` defaultValue: "sap-icon://browse-folder"` && |\n| &&
` },` && |\n| &&
` iconOnly: {` && |\n| &&
` type: "boolean",` && |\n| &&
` defaultValue: false` && |\n| &&
` },` && |\n| &&
` buttonOnly: {` && |\n| &&
` type: "boolean",` && |\n| &&
` defaultValue: false` && |\n| &&
` },` && |\n| &&
` multiple: {` && |\n| &&
` type: "boolean",` && |\n| &&
` defaultValue: false` && |\n| &&
` },` && |\n| &&
` visible: {` && |\n| &&
` type: "boolean",` && |\n| &&
` defaultValue: true` && |\n| &&
` },` && |\n| &&
` checkDirectUpload: {` && |\n| &&
` type: "boolean",` && |\n| &&
` defaultValue: false` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
`` && |\n| &&
` aggregations: {},` && |\n| &&
` events: {` && |\n| &&
` "upload": {` && |\n| &&
` allowPreventDefault: true,` && |\n| &&
` parameters: {}` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
` renderer: null` && |\n| &&
` },` && |\n| &&
`` && |\n| &&
` renderer: function (oRm, oControl) {` && |\n| &&
`` && |\n| &&
` if (!oControl.getProperty("checkDirectUpload")) {` && |\n| &&
` oControl.oUploadButton = new Button({` && |\n| &&
` text: oControl.getProperty("uploadButtonText"),` && |\n| &&
` enabled: oControl.getProperty("path") !== "",` && |\n| &&
` press: function (oEvent) {` && |\n| &&
`` && |\n| &&
` this.setProperty("path", this.oFileUploader.getProperty("value"));` && |\n| &&
`` && |\n| &&
|\n|.
result = result &&
` var file = z2ui5.oUpload.oFileUpload.files[0];` && |\n| &&
` var reader = new FileReader();` && |\n| &&
`` && |\n| &&
` reader.onload = function (evt) {` && |\n| &&
` var vContent = evt.currentTarget.result;` && |\n| &&
` this.setProperty("value", vContent);` && |\n| &&
` this.fireUpload();` && |\n| &&
` //this.getView().byId('picture' ).getDomRef().src = vContent;` && |\n| &&
` }` && |\n| &&
` .bind(this)` && |\n| &&
`` && |\n| &&
` reader.readAsDataURL(file);` && |\n| &&
` }` && |\n| &&
` .bind(oControl)` && |\n| &&
` });` && |\n| &&
` }` && |\n| &&
`` && |\n| &&
` oControl.oFileUploader = new FileUploader({` && |\n| &&
` icon: oControl.getProperty("icon"),` && |\n| &&
` iconOnly: oControl.getProperty("iconOnly"),` && |\n| &&
` buttonOnly: oControl.getProperty("buttonOnly"),` && |\n| &&
` buttonText: oControl.getProperty("buttonText"),` && |\n| &&
` style: oControl.getProperty("style"),` && |\n| &&
` fileType: oControl.getProperty("fileType"),` && |\n| &&
` visible: oControl.getProperty("visible"),` && |\n| &&
` uploadOnChange: true,` && |\n| &&
` enabled: oControl.getProperty("enabled"),` && |\n| &&
` value: oControl.getProperty("path"),` && |\n| &&
` placeholder: oControl.getProperty("placeholder"),` && |\n| &&
` change: function (oEvent) {` && |\n| &&
` if (oControl.getProperty("checkDirectUpload")) {` && |\n| &&
` return;` && |\n| &&
` }` && |\n| &&
`` && |\n| &&
` var value = oEvent.getSource().getProperty("value");` && |\n| &&
` this.setProperty("path", value);` && |\n| &&
` if (value) {` && |\n| &&
` this.oUploadButton.setEnabled();` && |\n| &&
` } else {` && |\n| &&
` this.oUploadButton.setEnabled(false);` && |\n| &&
` }` && |\n| &&
` this.oUploadButton.rerender();` && |\n| &&
` z2ui5.oUpload = oEvent.oSource;` && |\n| &&
` }` && |\n| &&
` .bind(oControl),` && |\n| &&
` uploadComplete: function (oEvent) {` && |\n| &&
` if (!oControl.getProperty("checkDirectUpload")) {` && |\n| &&
` return;` && |\n| &&
` }` && |\n| &&
`` && |\n| &&
` var value = oEvent.getSource().getProperty("value");` && |\n| &&
` this.setProperty("path", value);` && |\n| &&
`` && |\n| &&
` var file = oEvent.oSource.oFileUpload.files[0];` && |\n| &&
` var reader = new FileReader();` && |\n| &&
`` && |\n| &&
` reader.onload = function (evt) {` && |\n| &&
` var vContent = evt.currentTarget.result;` && |\n| &&
` this.setProperty("value", vContent);` && |\n| &&
` this.fireUpload();` && |\n| &&
` }` && |\n| &&
` .bind(this)` && |\n| &&
`` && |\n| &&
` reader.readAsDataURL(file);` && |\n| &&
` }` && |\n| &&
` .bind(oControl)` && |\n| &&
` });` && |\n| &&
`` && |\n| &&
` var hbox = new HBox();` && |\n| &&
` hbox.addItem(oControl.oFileUploader);` && |\n| &&
` hbox.addItem(oControl.oUploadButton);` && |\n| &&
` oRm.renderControl(hbox);` && |\n| &&
` }` && |\n| &&
` });` && |\n| &&
`});` && |\n| &&
`` && |\n| &&
`sap.ui.define("z2ui5/MultiInputExt", ["sap/ui/core/Control", "sap/m/Token", "sap/ui/core/Core", "sap/ui/core/Element"], (Control, Token, Core, Element) => {` && |\n| &&
` "use strict";` && |\n| &&
`` && |\n| &&
` return Control.extend("z2ui5.MultiInputExt", {` && |\n| &&
` metadata: {` && |\n| &&
` properties: {` && |\n| &&
` MultiInputId: {` && |\n| &&
` type: "String"` && |\n| &&
` },` && |\n| &&
` MultiInputName: {` && |\n| &&
` type: "String"` && |\n| &&
` },` && |\n| &&
` addedTokens: {` && |\n| &&
` type: "Array"` && |\n| &&
` },` && |\n| &&
` checkInit: {` && |\n| &&
` type: "Boolean",` && |\n| &&
` defaultValue: false` && |\n| &&
` },` && |\n| &&
` removedTokens: {` && |\n| &&
` type: "Array"` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
` events: {` && |\n| &&
` "change": {` && |\n| &&
` allowPreventDefault: true,` && |\n| &&
` parameters: {}` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
` },` && |\n| &&
`` && |\n| &&
` init() {` && |\n| &&
` z2ui5.onAfterRendering.push(this.setControl.bind(this));` && |\n| &&
` },` && |\n| &&
`` && |\n| &&
` onTokenUpdate(oEvent) {` && |\n| &&
` this.setProperty("addedTokens", []);` && |\n| &&
` this.setProperty("removedTokens", []);` && |\n| &&
`` && |\n| &&
` if (oEvent.mParameters.type == "removed") {` && |\n| &&
` let removedTokens = [];` && |\n| &&
` oEvent.mParameters.removedTokens.forEach((item) => {` && |\n| &&
` removedTokens.push({` && |\n| &&
` KEY: item.getKey(),` && |\n| &&
` TEXT: item.getText()` && |\n| &&
` });` && |\n| &&
` }` && |\n| &&
` );` && |\n| &&
` this.setProperty("removedTokens", removedTokens);` && |\n| &&
` } else {` && |\n| &&
` let addedTokens = [];` && |\n| &&
` oEvent.mParameters.addedTokens.forEach((item) => {` && |\n| &&
` addedTokens.push({` && |\n| &&
` KEY: item.getKey(),` && |\n| &&
` TEXT: item.getText()` && |\n| &&
` });` && |\n| &&
` }` && |\n| &&
` );` && |\n| &&
` this.setProperty("addedTokens", addedTokens);` && |\n| &&
` }` && |\n| &&
` this.fireChange();` && |\n| &&
` },` && |\n| &&
` renderer(oRm, oControl) {` && |\n| &&
` z2ui5.onAfterRendering.push(this.setControl.bind(oControl));` && |\n| &&
` },` && |\n| &&
` setControl() {` && |\n| &&
` 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| &&
` } catch (e) {` && |\n| &&
` return;` && |\n| &&
` }` && |\n| &&
` }` && |\n| &&
` if (!table) {` && |\n| &&
` return;` && |\n| &&
` }` && |\n| &&
` if (this.getProperty("checkInit") == true) {` && |\n| &&
` return;` && |\n| &&
` }` && |\n| &&
` this.setProperty("checkInit", true);` && |\n| &&
` table.attachTokenUpdate(this.onTokenUpdate.bind(this));` && |\n| &&
` var fnValidator = function (args) {` && |\n| &&
` var text = args.text;` && |\n| &&
` return new Token({` && |\n| &&
` key: text,` && |\n| &&
` text: text` && |\n| &&
` });` && |\n| &&
` };` && |\n| &&
` table.addValidator(fnValidator);` && |\n| &&
` },` && |\n| &&
` renderer(oRM, oControl) { }` && |\n| &&
` });` && |\n| &&
`}` && |\n| &&
`);` && |\n| &&
`` && |\n| &&
`sap.ui.define("z2ui5/UITableExt", ["sap/ui/core/Control"], (Control) => {` && |\n| &&
` "use strict";` && |\n| &&
`` && |\n| &&
` return Control.extend("z2ui5.UITableExt", {` && |\n| &&
` metadata: {` && |\n| &&
` properties: {` && |\n| &&
` tableId: {` && |\n| &&
` type: "String"` && |\n| &&
` }` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
`` && |\n| &&
` init() {` && |\n| &&
` z2ui5.onBeforeRoundtrip.push(this.readFilter.bind(this));` && |\n| &&
` z2ui5.onAfterRoundtrip.push(this.setFilter.bind(this));` && |\n| &&
` },` && |\n| &&
`` && |\n| &&
` readFilter() {` && |\n| &&
` try {` && |\n| &&
` let id = this.getProperty("tableId");` && |\n| &&
` let oTable = z2ui5.oView.byId(id);` && |\n| &&
` this.aFilters = oTable.getBinding().aFilters;` && |\n| &&
` } catch (e) { }` && |\n| &&
` ;` && |\n| &&
` },` && |\n| &&
`` && |\n| &&
` setFilter() {` && |\n| &&
` try {` && |\n| &&
` setTimeout((aFilters) => {` && |\n| &&
` let id = this.getProperty("tableId");` && |\n| &&
` let oTable = z2ui5.oView.byId(id);` && |\n| &&
` oTable.getBinding().filter(aFilters);` && |\n| &&
` }` && |\n| &&
` , 100, this.aFilters);` && |\n| &&
` } catch (e) { }` && |\n| &&
` ;` && |\n| &&
` },` && |\n| &&
`` && |\n| &&
` renderer(oRM, oControl) { }` && |\n| &&
` });` && |\n| &&
`}` && |\n| &&
`);` && |\n| &&
`` && |\n| &&
`sap.ui.define("z2ui5/Util", [], () => {` && |\n| &&
` "use strict";` && |\n| &&
` return {` && |\n| &&
` DateCreateObject: (s) => new Date(s),` && |\n| &&
` DateAbapTimestampToDate: (sTimestamp) => new sap.gantt.misc.Format.abapTimestampToDate(sTimestamp),` && |\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| &&
`}` && |\n| &&
`);` && |\n| &&
`sap.ui.require(["z2ui5/Util"], (Util) => {` && |\n| &&
` z2ui5.Util = Util;` && |\n| &&
`}` && |\n| &&
`);` && |\n| &&
`` && |\n| &&
`sap.ui.define("z2ui5/Favicon", ["sap/ui/core/Control"], (Control) => {` && |\n| &&
` "use strict";` && |\n| &&
` return Control.extend("z2ui5.Favicon", {` && |\n| &&
` metadata: {` && |\n| &&
` properties: {` && |\n| &&
` favicon: {` && |\n| &&
` type: "string"` && |\n| &&
` },` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
` setFavicon(val) {` && |\n| &&
` this.setProperty("favicon", val);` && |\n| &&
` let headTitle = document.querySelector('head');` && |\n| &&
` let setFavicon = document.createElement('link');` && |\n| &&
` setFavicon.setAttribute('rel', 'shortcut icon');` && |\n| &&
` setFavicon.setAttribute('href', val);` && |\n| &&
` headTitle.appendChild(setFavicon);` && |\n| &&
` },` && |\n| &&
` renderer(oRm, oControl) { }` && |\n| &&
` });` && |\n| &&
`}` && |\n| &&
`);` && |\n| &&
`` && |\n| &&
`sap.ui.define("z2ui5/Dirty", ["sap/ui/core/Control", "sap/ushell/Container"], (Control, Container) => {` && |\n| &&
` "use strict";` && |\n| &&
` return Control.extend("z2ui5.Dirty", {` && |\n| &&
` metadata: {` && |\n| &&
` properties: {` && |\n| &&
` isDirty: {` && |\n| &&
` type: "string"` && |\n| &&
` },` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
` setIsDirty(val) {` && |\n| &&
` if (Container) {` && |\n| &&
` Container.setDirtyFlag(val);` && |\n| &&
` } else {` && |\n| &&
` window.onbeforeunload = function (e) {` && |\n| &&
` if (val) {` && |\n| &&
` e.preventDefault();` && |\n| &&
` }` && |\n| &&
` }` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
` renderer(oRm, oControl) { }` && |\n| &&
` });` && |\n| &&
`}` && |\n| &&
`);` && |\n| &&
``.
ENDMETHOD.
ENDCLASS.

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<VSEOCLASS>
<CLSNAME>Z2UI5_CL_APP_CONT_APP_JS</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>Z2UI5_CL_APP_CONT_APP_JS</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>
<UNICODE>X</UNICODE>
</VSEOCLASS>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -0,0 +1,493 @@
CLASS z2ui5_cl_app_cont_View1_js DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
CLASS-METHODS get
RETURNING
VALUE(result) TYPE string.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_app_cont_View1_js IMPLEMENTATION.
METHOD get.
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| &&
`` && |\n| &&
` onInit (){` && |\n| &&
`` && |\n| &&
` z2ui5.oRouter.attachRouteMatched(function(oEvent) {` && |\n| &&
` z2ui5.checkInit = true;` && |\n| &&
` Server.Roundtrip();` && |\n| &&
` }, this);` && |\n| &&
`` && |\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| &&
` 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| &&
` },` && |\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| &&
` 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| &&
` 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| &&
` }` && |\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| &&
` 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| &&
` 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.
ENDCLASS.

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<VSEOCLASS>
<CLSNAME>Z2UI5_CL_APP_CONT_VIEW1_JS</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>Z2UI5_CL_APP_CONT_VIEW1_JS</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>
<UNICODE>X</UNICODE>
</VSEOCLASS>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -0,0 +1,26 @@
CLASS z2ui5_cl_app_css_style_css DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
CLASS-METHODS get
RETURNING
VALUE(result) TYPE string.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_app_css_style_css IMPLEMENTATION.
METHOD get.
result = `/* Enter your custom styles here */` && |\n| &&
``.
ENDMETHOD.
ENDCLASS.

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<VSEOCLASS>
<CLSNAME>Z2UI5_CL_APP_CSS_STYLE_CSS</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>Z2UI5_CL_APP_CSS_STYLE_CSS</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>
<UNICODE>X</UNICODE>
</VSEOCLASS>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -0,0 +1,44 @@
CLASS z2ui5_cl_app_mode_mdls_js DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
CLASS-METHODS get
RETURNING
VALUE(result) TYPE string.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_app_mode_mdls_js IMPLEMENTATION.
METHOD get.
result = `sap.ui.define([` && |\n| &&
` "sap/ui/model/json/JSONModel",` && |\n| &&
` "sap/ui/Device"` && |\n| &&
`],` && |\n| &&
`function (JSONModel, Device) {` && |\n| &&
` "use strict";` && |\n| &&
`` && |\n| &&
` return {` && |\n| &&
` /**` && |\n| &&
` * Provides runtime info for the device the UI5 app is running on as JSONModel` && |\n| &&
` */` && |\n| &&
` createDeviceModel: function () {` && |\n| &&
` var oModel = new JSONModel(Device);` && |\n| &&
` oModel.setDefaultBindingMode("OneWay");` && |\n| &&
` return oModel;` && |\n| &&
` }` && |\n| &&
` };` && |\n| &&
`` && |\n| &&
`});` && |\n| &&
``.
ENDMETHOD.
ENDCLASS.

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<VSEOCLASS>
<CLSNAME>Z2UI5_CL_APP_MODE_MDLS_JS</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>Z2UI5_CL_APP_MODE_MODELS_JS</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>
<UNICODE>X</UNICODE>
</VSEOCLASS>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -0,0 +1,30 @@
CLASS z2ui5_cl_app_view1_xml DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
CLASS-METHODS get
RETURNING
VALUE(result) TYPE string.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_app_view1_xml IMPLEMENTATION.
METHOD get.
result = `<mvc:View controllerName="z2ui5.controller.View1"` &&
` xmlns:mvc="sap.ui.core.mvc" displayBlock="true"` &&
` xmlns="sap.m">` &&
`</mvc:View>` &&
`` &&
``.
ENDMETHOD.
ENDCLASS.

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<VSEOCLASS>
<CLSNAME>Z2UI5_CL_APP_VIEW1_XML</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>Z2UI5_CL_APP_VIEW_VIEW1_XML</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>
<UNICODE>X</UNICODE>
</VSEOCLASS>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -0,0 +1,33 @@
CLASS z2ui5_cl_app_view_App_xml DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
CLASS-METHODS get
RETURNING
VALUE(result) TYPE string.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_app_view_App_xml IMPLEMENTATION.
METHOD get.
result = `<mvc:View controllerName="z2ui5.controller.App"` &&
` xmlns:html="http://www.w3.org/1999/xhtml"` &&
` xmlns:mvc="sap.ui.core.mvc" displayBlock="true"` &&
` xmlns="sap.m">` &&
` <App id="app">` &&
` </App>` &&
`</mvc:View>` &&
`` &&
``.
ENDMETHOD.
ENDCLASS.

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<VSEOCLASS>
<CLSNAME>Z2UI5_CL_APP_VIEW_APP_XML</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>Z2UI5_CL_APP_VIEW_APP_XML</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>
<UNICODE>X</UNICODE>
</VSEOCLASS>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -1,4 +1,4 @@
CLASS z2ui5_cl_core_app_hello_w DEFINITION
CLASS z2ui5_cl_hello_world DEFINITION
PUBLIC
CREATE PUBLIC .
@ -14,7 +14,7 @@ ENDCLASS.
CLASS z2ui5_cl_core_app_hello_w IMPLEMENTATION.
CLASS z2ui5_cl_hello_world IMPLEMENTATION.
METHOD z2ui5_if_app~main.

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<VSEOCLASS>
<CLSNAME>Z2UI5_CL_HELLO_WORLD</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>abap2UI5 - hello world app</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>
<UNICODE>X</UNICODE>
</VSEOCLASS>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -59,6 +59,11 @@ CLASS z2ui5_cl_http_handler DEFINITION
IMPORTING
attributes TYPE z2ui5_if_types=>ty_s_http_handler_attributes.
METHODS get_index_html
RETURNING
VALUE(result) TYPE string
##CALLED.
PRIVATE SECTION.
@ -140,6 +145,7 @@ CLASS z2ui5_cl_http_handler IMPLEMENTATION.
set_config( is_custom_config ).
ms_res-body = z2ui5_cl_ui5_index_html=>get( ms_config ).
* ms_res-body = get_index_html( ).
NEW z2ui5_cl_core_draft_srv( )->cleanup( ).
@ -205,4 +211,60 @@ CLASS z2ui5_cl_http_handler IMPLEMENTATION.
ENDMETHOD.
METHOD get_index_html.
IF ms_config-styles_css IS INITIAL.
DATA(lv_style_css) = z2ui5_cl_ui5_style_css=>get( ).
ELSE.
lv_style_css = ms_config-styles_css.
ENDIF.
result = `<!DOCTYPE html>` && |\n| &&
`<html lang="en">` && |\n| &&
`<head>` && |\n| &&
ms_config-content_security_policy && |\n| &&
` <meta charset="UTF-8">` && |\n| &&
` <meta name="viewport" content="width=device-width, initial-scale=1.0">` && |\n| &&
` <meta http-equiv="X-UA-Compatible" content="IE=edge">` && |\n| &&
| <title> { ms_config-title }</title> \n| &&
| <style> html, body, body > div, #container, #container-uiarea \{\n| &
| height: 100%;\n| &
| \}</style> \n| &&
`<script>` && |\n| &&
` function onInitComponent(){` && |\n| &&
` sap.ui.require.preload({` && |\n| &&
` "z2ui5/manifest.json": '` && z2ui5_cl_app__manifest=>get( ) && ` ',` && |\n| &&
` "z2ui5/Component.js": function(){` && z2ui5_cl_app__component_js=>get( ) && ms_config-custom_js && ` },` && |\n| &&
` "z2ui5/css/style.css": '` && lv_style_css && `',` && |\n| &&
` "z2ui5/model/models.js": function(){` && z2ui5_cl_app_mode_mdls_js=>get( ) && `},` && |\n| &&
` "z2ui5/view/App.view.xml": '` && z2ui5_cl_app_view_app_xml=>get( ) && `' ,` && |\n| &&
` "z2ui5/controller/App.controller.js": function(){` && z2ui5_cl_app_cont_app_js=>get( ) && `},` && |\n| &&
` "z2ui5/view/View1.view.xml": '` && z2ui5_cl_app_view1_xml=>get( ) && `' ,` && |\n| &&
` "z2ui5/controller/View1.controller.js": function(){` && z2ui5_cl_app_cont_view1_js=>get( ) && `},` && |\n| &&
` "z2ui5/cc/Server.js": function(){` && z2ui5_cl_app_cc_server_js=>get( ) && `} ,` && |\n| &&
` "z2ui5/cc/DebugTool.fragment.xml": '` && z2ui5_cl_app_cc_dbgtl_xml=>get( ) && `' ,` && |\n| &&
` "z2ui5/cc/DebugTool.js": function(){` && z2ui5_cl_app_cc_dbgtl_js=>get( ) && `},` && |\n| &&
` });` && |\n| &&
` sap.ui.require(["sap/ui/core/ComponentSupport"], function(ComponentSupport){` && |\n| &&
` window.z2ui5 = {}; ComponentSupport.run();` && |\n| &&
` });` && |\n| &&
` }` && |\n| &&
`</script>` && |\n| &&
`<script id="sap-ui-bootstrap" data-sap-ui-resourceroots='{ "z2ui5": "./" }' data-sap-ui-oninit="onInitComponent" ` && |\n| &&
`data-sap-ui-compatVersion="edge" data-sap-ui-async="true" data-sap-ui-frameOptions="trusted" data-sap-ui-bindingSyntax="complex"` && |\n| &&
`data-sap-ui-theme="` && ms_config-theme && `" src=" ` && ms_config-src && `" `.
LOOP AT ms_config-t_add_config REFERENCE INTO DATA(lr_config).
result = result && | { lr_config->n }='{ lr_config->v }'|.
ENDLOOP.
result = result &&
` ></script></head>` && |\n| &&
`<body class="sapUiBody sapUiSizeCompact" id="content">` && |\n| &&
` <div data-sap-ui-component data-name="z2ui5" data-id="container" data-settings='{"id" : "z2ui5"}' data-handle-validation="true"></div>` && |\n| &&
` </body></html>`.
ENDMETHOD.
ENDCLASS.