mirror of
https://github.com/abap2UI5/abap2UI5.git
synced 2025-04-29 15:26:16 +08:00
split custom controls (#1330)
* split custom controls * update * Update package.json
This commit is contained in:
parent
0e7ba63842
commit
c70baa86f2
|
@ -5,8 +5,7 @@
|
|||
"description": "Developing UI5 Apps purely in ABAP.",
|
||||
"scripts": {
|
||||
"syfixes": "find . -type f -name '*.abap' -exec sed -i -e 's/ RAISE EXCEPTION TYPE cx_sy_itab_line_not_found/ ASSERT 1 = 0/g' {} + ",
|
||||
"delete_mapster": "rm ./src/01/05/z2ui5_cl_cc_imagemapster.clas.abap && rm ./src/01/05/z2ui5_cl_cc_imagemapster.clas.xml",
|
||||
"downport": "rm -rf downport && cp -r src downport && abaplint --fix ./ci/abaplint-downport.jsonc && npm run syfixes && npm run delete_mapster",
|
||||
"downport": "rm -rf downport && cp -r src downport && abaplint --fix ./ci/abaplint-downport.jsonc && npm run syfixes",
|
||||
"unit": "echo RUNNING && node output/index.mjs",
|
||||
"transpile": "rm -rf output && abap_transpile test/abap_transpile.json",
|
||||
"test": "npm run downport && npm run transpile && npm run unit",
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
<?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 - cc addons</CTEXT>
|
||||
</DEVC>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
File diff suppressed because it is too large
Load Diff
|
@ -1,16 +0,0 @@
|
|||
<?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_CC_ANIMATECSS</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>animate css</DESCRIPT>
|
||||
<STATE>1</STATE>
|
||||
<CLSCCINCL>X</CLSCCINCL>
|
||||
<FIXPT>X</FIXPT>
|
||||
<UNICODE>X</UNICODE>
|
||||
</VSEOCLASS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
|
@ -1,170 +0,0 @@
|
|||
CLASS z2ui5_cl_cc_bwipjs DEFINITION
|
||||
PUBLIC
|
||||
FINAL
|
||||
CREATE PUBLIC .
|
||||
|
||||
PUBLIC SECTION.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_s_barcode,
|
||||
sym TYPE string,
|
||||
desc TYPE string,
|
||||
text TYPE string,
|
||||
opts TYPE string,
|
||||
END OF ty_s_barcode.
|
||||
TYPES ty_t_barcode TYPE STANDARD TABLE OF ty_s_barcode WITH EMPTY KEY.
|
||||
|
||||
CONSTANTS cv_src TYPE string VALUE `https://cdnjs.cloudflare.com/ajax/libs/bwip-js/4.1.1/bwip-js-min.js` ##NEEDED.
|
||||
|
||||
CLASS-METHODS get_t_barcode_types
|
||||
RETURNING
|
||||
VALUE(result) TYPE ty_t_barcode.
|
||||
|
||||
CLASS-METHODS get_js_lib_local
|
||||
RETURNING VALUE(result) TYPE string.
|
||||
|
||||
CLASS-METHODS get_js
|
||||
RETURNING
|
||||
VALUE(r_js) TYPE string.
|
||||
|
||||
PROTECTED SECTION.
|
||||
PRIVATE SECTION.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
|
||||
CLASS Z2UI5_CL_CC_BWIPJS IMPLEMENTATION.
|
||||
|
||||
|
||||
METHOD get_js.
|
||||
|
||||
r_js = ` sap.ui.define("z2ui5/bwipjs", [` && |\n| &&
|
||||
` "sap/ui/core/Control",` && |\n| &&
|
||||
` ], function (Control) {` && |\n| &&
|
||||
` "use strict";` && |\n| &&
|
||||
|\n| &&
|
||||
` return Control.extend("z2ui5.bwipjs", {` && |\n| &&
|
||||
|\n| &&
|
||||
` metadata: {` && |\n| &&
|
||||
` properties: {` && |\n| &&
|
||||
` bcid: {` && |\n| &&
|
||||
` type: "string",` && |\n| &&
|
||||
` defaultValue: ""` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` text: {` && |\n| &&
|
||||
` type: "string",` && |\n| &&
|
||||
` defaultValue: ""` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` scale: {` && |\n| &&
|
||||
` type: "string",` && |\n| &&
|
||||
` defaultValue: ""` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` height: {` && |\n| &&
|
||||
` type: "string",` && |\n| &&
|
||||
` defaultValue: ""` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` includetext: {` && |\n| &&
|
||||
` type: "string",` && |\n| &&
|
||||
` defaultValue: ""` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` textalign: {` && |\n| &&
|
||||
` type: "string",` && |\n| &&
|
||||
` defaultValue: ""` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
|\n| &&
|
||||
|\n| &&
|
||||
` aggregations: {` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` events: {` && |\n| &&
|
||||
` "upload": {` && |\n| &&
|
||||
` allowPreventDefault: true,` && |\n| &&
|
||||
` parameters: {}` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` renderer: null` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
|\n| &&
|
||||
` init() {` && |\n| &&
|
||||
|\n| &&
|
||||
|\n| &&
|
||||
` },` &&
|
||||
` onAfterRendering() { ` &&
|
||||
` if(window.bwipjs == undefined) { const loadScript = (FILE_URL, async = true, type = "text/javascript") => {` && |\n| &&
|
||||
` return new Promise((resolve, reject) => {` && |\n| &&
|
||||
` try {` && |\n| &&
|
||||
` const scriptEle = document.createElement("script");` && |\n| &&
|
||||
` scriptEle.type = type;` && |\n| &&
|
||||
` scriptEle.async = async;` && |\n| &&
|
||||
` scriptEle.src =FILE_URL;` && |\n| &&
|
||||
` scriptEle.addEventListener("load", (ev) => {` && |\n| &&
|
||||
` resolve({ status: true });` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` scriptEle.addEventListener("error", (ev) => {` && |\n| &&
|
||||
` reject({` && |\n| &&
|
||||
` status: false,` && |\n| &&
|
||||
` message: ``Failed to load the script ${FILE_URL}``` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` document.body.appendChild(scriptEle);` && |\n| &&
|
||||
` } catch (error) {` && |\n| &&
|
||||
` reject(error);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` };` && |\n| &&
|
||||
` ` && |\n| &&
|
||||
` this.BusyDialog = new sap.m.BusyDialog( { title : "Loading bwip-js", text : "... now loading the data from a far away server" });` && |\n| &&
|
||||
` this.BusyDialog.open();` && |\n| &&
|
||||
` loadScript("https://cdnjs.cloudflare.com/ajax/libs/bwip-js/4.1.1/bwip-js-min.js")` && |\n| &&
|
||||
` .then( data => {` && |\n| &&
|
||||
` this.BusyDialog.close();` && |\n| &&
|
||||
` let canvas = bwipjs.toCanvas('mycanvas', {` && |\n| &&
|
||||
` bcid: this.getProperty("bcid"), // Barcode type` && |\n| &&
|
||||
` text: this.getProperty("text"), // Text to encode` && |\n| &&
|
||||
` scale: this.getProperty("scale"), // 3x scaling factor` && |\n| &&
|
||||
` height: this.getProperty("height"), // Bar height, in millimeters` && |\n| &&
|
||||
` includetext: true, // Show human-readable text` && |\n| &&
|
||||
` textxalign: 'center', // Always good to set this` && |\n| &&
|
||||
` })` && |\n| &&
|
||||
` .catch( err => {` && |\n| &&
|
||||
` new sap.m.MessageBox.error('Error on load bwip-js library: ' + err);` && |\n| &&
|
||||
` this.BusyDialog.close();` && |\n| &&
|
||||
` }); } ) } else {` && |\n| &&
|
||||
` let canvas = bwipjs.toCanvas('mycanvas', {` && |\n| &&
|
||||
` bcid: this.getProperty("bcid"), // Barcode type` && |\n| &&
|
||||
` text: this.getProperty("text"), // Text to encode` && |\n| &&
|
||||
` scale: this.getProperty("scale"), // 3x scaling factor` && |\n| &&
|
||||
` height: this.getProperty("height"), // Bar height, in millimeters` && |\n| &&
|
||||
` includetext: true, // Show human-readable text` && |\n| &&
|
||||
` textxalign: 'center', // Always good to set this` && |\n| &&
|
||||
` }); }` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` renderer: function (oRm, oControl) {` && |\n| &&
|
||||
` oRm.write( "<canvas id='mycanvas' />");` && |\n| && |\n| &&
|
||||
` // The return value is the canvas element` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` });`.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD get_js_lib_local.
|
||||
|
||||
result = ``.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD get_t_barcode_types.
|
||||
|
||||
result = VALUE #(
|
||||
( sym = 'ean5' desc = 'EAN-5' text = '90200' opts = 'includetext guardwhitespace' )
|
||||
( sym = 'ean2' desc = 'EAN-2' text = '05' opts = 'includetext guardwhitespace' )
|
||||
( sym = 'ean13' desc = 'EAN-13' text = '9520123456788' opts = 'includetext guardwhitespace' )
|
||||
( sym = 'upca' desc = 'UPC-A' text = '012345000058' opts = 'includetext' )
|
||||
( sym = 'isbn' desc = 'ISBN' text = '978-1-56581-231-4 90000' opts = 'includetext guardwhitespace' )
|
||||
( sym = 'qrcode' desc = 'QR Code' text = 'http://goo.gl/0bis' opts = 'eclevel=M' ) ).
|
||||
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
|
@ -1,16 +0,0 @@
|
|||
<?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_CC_BWIPJS</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>bwip-js - barcode writer in pure javascript</DESCRIPT>
|
||||
<STATE>1</STATE>
|
||||
<CLSCCINCL>X</CLSCCINCL>
|
||||
<FIXPT>X</FIXPT>
|
||||
<UNICODE>X</UNICODE>
|
||||
</VSEOCLASS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
|
@ -1,128 +0,0 @@
|
|||
CLASS z2ui5_cl_cc_camera_pic DEFINITION
|
||||
PUBLIC
|
||||
FINAL
|
||||
CREATE PUBLIC .
|
||||
|
||||
PUBLIC SECTION.
|
||||
|
||||
CLASS-METHODS get_js
|
||||
RETURNING
|
||||
VALUE(r_js) TYPE string.
|
||||
|
||||
PROTECTED SECTION.
|
||||
PRIVATE SECTION.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
|
||||
CLASS Z2UI5_CL_CC_CAMERA_PIC IMPLEMENTATION.
|
||||
|
||||
|
||||
METHOD get_js.
|
||||
|
||||
r_js = ` sap.ui.define("z2ui5/CameraPicture" , [` && |\n| &&
|
||||
` "sap/ui/core/Control"` && |\n| &&
|
||||
`], function (Control) {` && |\n| &&
|
||||
` "use strict";` && |\n| &&
|
||||
` return Control.extend("z2ui5.CameraPicture", {` && |\n| &&
|
||||
` metadata: {` && |\n| &&
|
||||
` properties: {` && |\n| &&
|
||||
` id: { type: "string" },` && |\n| &&
|
||||
` value: { type: "string" },` && |\n| &&
|
||||
` press: { type: "string" },` && |\n| &&
|
||||
` autoplay: { type: "boolean", defaultValue: true }` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` events: {` && |\n| &&
|
||||
` "OnPhoto": {` && |\n| &&
|
||||
` allowPreventDefault: true,` && |\n| &&
|
||||
` parameters: {` && |\n| &&
|
||||
` "photo": {` && |\n| &&
|
||||
` type: "string"` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
|\n| &&
|
||||
` capture: function (oEvent) {` && |\n| &&
|
||||
|\n| &&
|
||||
` var video = document.querySelector("#zvideo");` && |\n| &&
|
||||
` var canvas = document.getElementById('zcanvas');` && |\n| &&
|
||||
` var resultb64 = "";` && |\n| &&
|
||||
` canvas.width = 200;` && |\n| &&
|
||||
` canvas.height = 200;` && |\n| &&
|
||||
` canvas.getContext('2d').drawImage(video, 0, 0, 200, 200);` && |\n| &&
|
||||
` resultb64 = canvas.toDataURL();` && |\n| &&
|
||||
` this.setProperty("value", resultb64);` && |\n| &&
|
||||
` this.fireOnPhoto({` && |\n| &&
|
||||
` "photo": resultb64` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
|\n| &&
|
||||
` onPicture: function (oEvent) {` && |\n| &&
|
||||
|\n| &&
|
||||
` if (!this._oScanDialog) {` && |\n| &&
|
||||
` this._oScanDialog = new sap.m.Dialog({` && |\n| &&
|
||||
` title: "Device Photo Function",` && |\n| &&
|
||||
` contentWidth: "640px",` && |\n| &&
|
||||
` contentHeight: "480px",` && |\n| &&
|
||||
` horizontalScrolling: false,` && |\n| &&
|
||||
` verticalScrolling: false,` && |\n| &&
|
||||
` stretchOnPhone: true,` && |\n| &&
|
||||
` content: [` && |\n| &&
|
||||
` new sap.ui.core.HTML({` && |\n| &&
|
||||
` id: this.getId() + 'PictureContainer',` && |\n| &&
|
||||
` content: '<video width="600px" height="400px" autoplay="true" id="zvideo">'` && |\n| &&
|
||||
` }),` && |\n| &&
|
||||
` new sap.m.Button({` && |\n| &&
|
||||
` text: "Capture",` && |\n| &&
|
||||
` press: function (oEvent) {` && |\n| &&
|
||||
` this.capture();` && |\n| &&
|
||||
` this._oScanDialog.close();` && |\n| &&
|
||||
` }.bind(this)` && |\n| &&
|
||||
` }),` && |\n| &&
|
||||
` new sap.ui.core.HTML({` && |\n| &&
|
||||
` content: '<canvas hidden id="zcanvas" style="overflow:auto"></canvas>'` && |\n| &&
|
||||
` }),` && |\n| &&
|
||||
` ],` && |\n| &&
|
||||
` endButton: new sap.m.Button({` && |\n| &&
|
||||
` text: "Cancel",` && |\n| &&
|
||||
` press: function (oEvent) {` && |\n| &&
|
||||
` this._oScanDialog.close();` && |\n| &&
|
||||
` }.bind(this)` && |\n| &&
|
||||
` }),` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
|\n| &&
|
||||
` this._oScanDialog.open();` && |\n| &&
|
||||
|\n| &&
|
||||
` setTimeout(function () {` && |\n| &&
|
||||
` var video = document.querySelector('#zvideo');` && |\n| &&
|
||||
` if (navigator.mediaDevices.getUserMedia) {` && |\n| &&
|
||||
` navigator.mediaDevices.getUserMedia({video: { facingMode: { exact: "environment" } } })` && |\n| &&
|
||||
` .then(function (stream) {` && |\n| &&
|
||||
` video.srcObject = stream;` && |\n| &&
|
||||
` })` && |\n| &&
|
||||
` .catch(function (error) {` && |\n| &&
|
||||
` console.log("Something went wrong!");` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }.bind(this), 300);` && |\n| &&
|
||||
|\n| &&
|
||||
` },` && |\n| &&
|
||||
|\n| &&
|
||||
` renderer: function (oRM, oControl) {` && |\n| &&
|
||||
|\n| &&
|
||||
` var oButton = new sap.m.Button({` && |\n| &&
|
||||
` icon: "sap-icon://camera",` && |\n| &&
|
||||
` text: "Camera",` && |\n| &&
|
||||
` press: oControl.onPicture.bind(oControl),` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` oRM.renderControl(oButton);` && |\n| &&
|
||||
|\n| &&
|
||||
` },` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
`});`.
|
||||
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
|
@ -1,16 +0,0 @@
|
|||
<?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_CC_CAMERA_PIC</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>device capability - camera picture</DESCRIPT>
|
||||
<STATE>1</STATE>
|
||||
<CLSCCINCL>X</CLSCCINCL>
|
||||
<FIXPT>X</FIXPT>
|
||||
<UNICODE>X</UNICODE>
|
||||
</VSEOCLASS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
|
@ -1,867 +0,0 @@
|
|||
CLASS z2ui5_cl_cc_chartjs DEFINITION
|
||||
PUBLIC
|
||||
FINAL
|
||||
CREATE PUBLIC .
|
||||
|
||||
PUBLIC SECTION.
|
||||
|
||||
INTERFACES z2ui5_if_ajson_filter.
|
||||
INTERFACES if_serializable_object.
|
||||
|
||||
" Data
|
||||
TYPES:
|
||||
BEGIN OF ty_x_y_r_data,
|
||||
x TYPE string,
|
||||
y TYPE string,
|
||||
r TYPE string,
|
||||
END OF ty_x_y_r_data.
|
||||
|
||||
TYPES ty_x_y_r_data_t TYPE STANDARD TABLE OF ty_x_y_r_data WITH EMPTY KEY.
|
||||
TYPES ty_bg_color TYPE STANDARD TABLE OF string WITH EMPTY KEY.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_padding,
|
||||
bottom TYPE string,
|
||||
top TYPE string,
|
||||
left TYPE string,
|
||||
right TYPE string,
|
||||
END OF ty_padding .
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_font,
|
||||
size TYPE i,
|
||||
family TYPE string,
|
||||
weight TYPE string,
|
||||
style TYPE string,
|
||||
line_height TYPE string,
|
||||
END OF ty_font .
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_datalabels_lbl,
|
||||
color TYPE string,
|
||||
font TYPE ty_font,
|
||||
END OF ty_datalabels_lbl .
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_datalabels_labels,
|
||||
title TYPE ty_datalabels_lbl,
|
||||
value TYPE ty_datalabels_lbl,
|
||||
END OF ty_datalabels_labels .
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_datalabels,
|
||||
align TYPE string,
|
||||
anchor TYPE string,
|
||||
background_color TYPE string,
|
||||
border_color TYPE string,
|
||||
border_radius TYPE i,
|
||||
border_width TYPE i,
|
||||
clamp TYPE abap_bool,
|
||||
clip TYPE abap_bool,
|
||||
color TYPE string,
|
||||
display TYPE abap_bool,
|
||||
font TYPE ty_font,
|
||||
formatter TYPE string,
|
||||
labels TYPE ty_datalabels_labels,
|
||||
listeners TYPE string,
|
||||
offset TYPE i,
|
||||
opacity TYPE i,
|
||||
padding TYPE ty_padding,
|
||||
rotation TYPE i,
|
||||
text_align TYPE string,
|
||||
text_stroke_color TYPE string,
|
||||
text_stroke_width TYPE i,
|
||||
text_shadow_blur TYPE i,
|
||||
text_shadow_color TYPE string,
|
||||
END OF ty_datalabels .
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_data_venn,
|
||||
sets TYPE string_table,
|
||||
value TYPE string,
|
||||
values TYPE string_table,
|
||||
END OF ty_data_venn .
|
||||
|
||||
TYPES ty_data_venn_t TYPE STANDARD TABLE OF ty_data_venn WITH EMPTY KEY.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_dataset,
|
||||
label TYPE string,
|
||||
type TYPE string,
|
||||
data TYPE string_table,
|
||||
data_venn TYPE ty_data_venn_t,
|
||||
data_radial TYPE ty_x_y_r_data_t,
|
||||
border_width TYPE i,
|
||||
border_color TYPE string,
|
||||
border_radius TYPE i,
|
||||
border_skipped TYPE abap_bool,
|
||||
show_line TYPE abap_bool,
|
||||
background_color_t TYPE ty_bg_color,
|
||||
background_color TYPE string,
|
||||
hover_offset TYPE i,
|
||||
order TYPE i,
|
||||
fill TYPE string,
|
||||
hidden TYPE abap_bool,
|
||||
point_style TYPE string,
|
||||
point_border_color TYPE string,
|
||||
point_radius TYPE i,
|
||||
point_hover_radius TYPE i,
|
||||
rtl TYPE abap_bool,
|
||||
datalabels TYPE ty_datalabels,
|
||||
tension TYPE string,
|
||||
END OF ty_dataset.
|
||||
|
||||
TYPES ty_datasets TYPE STANDARD TABLE OF ty_dataset WITH EMPTY KEY.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_data,
|
||||
labels TYPE string_table,
|
||||
datasets TYPE ty_datasets,
|
||||
END OF ty_data .
|
||||
|
||||
" Options
|
||||
TYPES:
|
||||
BEGIN OF ty_custom_canvas_bg_color,
|
||||
color TYPE string,
|
||||
END OF ty_custom_canvas_bg_color.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_autocolors_plugin,
|
||||
enabled TYPE abap_bool,
|
||||
mode TYPE string,
|
||||
offset TYPE i,
|
||||
repeat TYPE i,
|
||||
END OF ty_autocolors_plugin .
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_title,
|
||||
text TYPE string,
|
||||
display TYPE abap_bool,
|
||||
align TYPE string,
|
||||
color TYPE string,
|
||||
full_size TYPE abap_bool,
|
||||
position TYPE string,
|
||||
font TYPE ty_font,
|
||||
padding TYPE ty_padding,
|
||||
END OF ty_title .
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_labels,
|
||||
box_width TYPE i,
|
||||
box_height TYPE i,
|
||||
color TYPE abap_bool,
|
||||
font TYPE ty_font,
|
||||
padding TYPE i,
|
||||
generate_labels TYPE string,
|
||||
filter TYPE string,
|
||||
sort TYPE string,
|
||||
point_style TYPE string,
|
||||
text_align TYPE string,
|
||||
use_point_style TYPE abap_bool,
|
||||
point_style_width TYPE i,
|
||||
use_border_radius TYPE abap_bool,
|
||||
border_radius TYPE i,
|
||||
END OF ty_labels .
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_legend,
|
||||
position TYPE string,
|
||||
align TYPE string,
|
||||
display TYPE abap_bool,
|
||||
max_height TYPE i,
|
||||
max_width TYPE i,
|
||||
full_size TYPE i,
|
||||
on_click TYPE string,
|
||||
on_hover TYPE string,
|
||||
on_leave TYPE string,
|
||||
reverse TYPE abap_bool,
|
||||
labels TYPE ty_labels,
|
||||
rtl TYPE abap_bool,
|
||||
text_direction TYPE string,
|
||||
title TYPE ty_title,
|
||||
END OF ty_legend .
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_subtitle,
|
||||
text TYPE string,
|
||||
display TYPE abap_bool,
|
||||
color TYPE string,
|
||||
font TYPE ty_font,
|
||||
padding TYPE ty_padding,
|
||||
END OF ty_subtitle .
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_callback,
|
||||
label TYPE string,
|
||||
footer TYPE string,
|
||||
before_title TYPE string,
|
||||
after_title TYPE string,
|
||||
title TYPE string,
|
||||
before_body TYPE string,
|
||||
before_label TYPE string,
|
||||
label_color TYPE string,
|
||||
label_text_color TYPE string,
|
||||
label_point_style TYPE string,
|
||||
after_label TYPE string,
|
||||
after_body TYPE string,
|
||||
before_footer TYPE string,
|
||||
after_footer TYPE string,
|
||||
END OF ty_callback .
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_tooltip,
|
||||
callbacks TYPE ty_callback,
|
||||
mode TYPE string,
|
||||
intersect TYPE abap_bool,
|
||||
use_point_style TYPE abap_bool,
|
||||
enabled TYPE abap_bool,
|
||||
display_colors TYPE abap_bool,
|
||||
rtl TYPE abap_bool,
|
||||
external TYPE string,
|
||||
position TYPE string,
|
||||
item_sort TYPE string,
|
||||
filter TYPE string,
|
||||
background_color TYPE string,
|
||||
title_color TYPE string,
|
||||
title_align TYPE string,
|
||||
border_color TYPE string,
|
||||
text_direction TYPE string,
|
||||
x_align TYPE string,
|
||||
y_align TYPE string,
|
||||
title_font TYPE ty_font,
|
||||
body_font TYPE ty_font,
|
||||
footer_font TYPE ty_font,
|
||||
border_width TYPE i,
|
||||
box_width TYPE i,
|
||||
box_height TYPE i,
|
||||
box_padding TYPE i,
|
||||
title_spacing TYPE i,
|
||||
title_margin_bottom TYPE i,
|
||||
body_spacing TYPE i,
|
||||
footer_spacing TYPE i,
|
||||
footer_margin_top TYPE i,
|
||||
caret_padding TYPE i,
|
||||
caret_size TYPE i,
|
||||
corner_radius TYPE i,
|
||||
body_color TYPE string,
|
||||
multikey_background TYPE string,
|
||||
body_align TYPE string,
|
||||
footer_color TYPE string,
|
||||
footer_align TYPE string,
|
||||
padding TYPE ty_padding,
|
||||
END OF ty_tooltip .
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_filler,
|
||||
propagate TYPE abap_bool,
|
||||
END OF ty_filler .
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_deferred,
|
||||
delay TYPE i,
|
||||
x_offset TYPE string,
|
||||
y_offset TYPE string,
|
||||
END OF ty_deferred.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_label,
|
||||
background_color TYPE string,
|
||||
content TYPE string,
|
||||
display TYPE abap_bool,
|
||||
font TYPE ty_font,
|
||||
x_value TYPE string,
|
||||
y_value TYPE string,
|
||||
END OF ty_label.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_annotations,
|
||||
type TYPE string,
|
||||
border_color TYPE string,
|
||||
border_width TYPE string,
|
||||
background_shadow_color TYPE string,
|
||||
background_color TYPE string,
|
||||
click TYPE string,
|
||||
enter TYPE string,
|
||||
leave TYPE string,
|
||||
scaleid TYPE string,
|
||||
value TYPE string,
|
||||
draw_time TYPE string,
|
||||
x_max TYPE string,
|
||||
x_min TYPE string,
|
||||
x_scaleid TYPE string,
|
||||
y_scaleid TYPE string,
|
||||
y_max TYPE string,
|
||||
y_min TYPE string,
|
||||
label TYPE ty_label,
|
||||
sides TYPE string,
|
||||
radius TYPE string,
|
||||
font TYPE ty_font,
|
||||
x_value TYPE string,
|
||||
y_value TYPE string,
|
||||
rotation TYPE string,
|
||||
shadow_blur TYPE string,
|
||||
shadow_offset_x TYPE string,
|
||||
shadow_offset_y TYPE string,
|
||||
END OF ty_annotations.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_shapes,
|
||||
shape1 TYPE ty_annotations,
|
||||
shape2 TYPE ty_annotations,
|
||||
shape3 TYPE ty_annotations,
|
||||
shape4 TYPE ty_annotations,
|
||||
shape5 TYPE ty_annotations,
|
||||
END OF ty_shapes.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_annotation,
|
||||
annotations TYPE ty_shapes,
|
||||
END OF ty_annotation.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_plugins,
|
||||
deferred TYPE ty_deferred,
|
||||
datalabels TYPE ty_datalabels,
|
||||
autocolors TYPE ty_autocolors_plugin,
|
||||
custom_canvas_background_color TYPE ty_custom_canvas_bg_color,
|
||||
legend TYPE ty_legend,
|
||||
title TYPE ty_title,
|
||||
tooltip TYPE ty_tooltip,
|
||||
filler TYPE ty_filler,
|
||||
subtitle TYPE ty_subtitle,
|
||||
annotation TYPE ty_annotation,
|
||||
END OF ty_plugins .
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_point_label,
|
||||
display TYPE abap_bool,
|
||||
center_point_labels TYPE abap_bool,
|
||||
font TYPE ty_font,
|
||||
backdrop_color TYPE string,
|
||||
backdrop_padding TYPE ty_padding,
|
||||
border_radius TYPE i,
|
||||
callback TYPE string,
|
||||
padding TYPE i,
|
||||
END OF ty_point_label .
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_ticks,
|
||||
step_size TYPE i,
|
||||
count TYPE i,
|
||||
color TYPE string,
|
||||
align TYPE string,
|
||||
cross_align TYPE string,
|
||||
sample_size TYPE i,
|
||||
auto_skip TYPE abap_bool,
|
||||
include_bounds TYPE abap_bool,
|
||||
mirror TYPE abap_bool,
|
||||
auto_skip_padding TYPE i,
|
||||
label_offset TYPE i,
|
||||
max_rotation TYPE i,
|
||||
min_rotation TYPE i,
|
||||
padding TYPE i,
|
||||
max_ticks_limit TYPE i,
|
||||
backdrop_color TYPE string,
|
||||
backdrop_padding TYPE ty_padding,
|
||||
callback TYPE string,
|
||||
display TYPE abap_bool,
|
||||
show_label_backdrop TYPE abap_bool,
|
||||
text_stroke_color TYPE string,
|
||||
font TYPE ty_font,
|
||||
text_stroke_width TYPE i,
|
||||
z TYPE i,
|
||||
precision TYPE i,
|
||||
END OF ty_ticks .
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_border,
|
||||
color TYPE string,
|
||||
display TYPE abap_bool,
|
||||
width TYPE i,
|
||||
dash TYPE i,
|
||||
dash_offset TYPE i,
|
||||
z TYPE i,
|
||||
END OF ty_border .
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_grid,
|
||||
color TYPE string,
|
||||
border_color TYPE string,
|
||||
tick_color TYPE string,
|
||||
border_dash TYPE string,
|
||||
border_dash_offset TYPE p LENGTH 3 DECIMALS 2,
|
||||
circular TYPE abap_bool,
|
||||
line_width TYPE i,
|
||||
draw_on_chart_area TYPE abap_bool,
|
||||
draw_ticks TYPE abap_bool,
|
||||
offset TYPE abap_bool,
|
||||
tick_border_dash TYPE i,
|
||||
tick_border_dash_offset TYPE i,
|
||||
tick_length TYPE i,
|
||||
tick_width TYPE i,
|
||||
z TYPE i,
|
||||
END OF ty_grid .
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_angle_lines,
|
||||
color TYPE string,
|
||||
border_color TYPE string,
|
||||
display TYPE abap_bool,
|
||||
line_width TYPE i,
|
||||
border_dash TYPE i,
|
||||
border_dash_offset TYPE i,
|
||||
END OF ty_angle_lines .
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_scale,
|
||||
begin_at_zero TYPE abap_bool,
|
||||
min TYPE string,
|
||||
max TYPE string,
|
||||
point_labels TYPE ty_point_label,
|
||||
stacked TYPE abap_bool,
|
||||
reverse TYPE abap_bool,
|
||||
align_to_pixels TYPE abap_bool,
|
||||
clip TYPE abap_bool,
|
||||
bounds TYPE string,
|
||||
background_color TYPE string,
|
||||
type TYPE string,
|
||||
title TYPE ty_title,
|
||||
weight TYPE i,
|
||||
suggested_min TYPE i,
|
||||
suggested_max TYPE i,
|
||||
stack_weight TYPE i,
|
||||
stack TYPE string,
|
||||
position TYPE string,
|
||||
ticks TYPE ty_ticks,
|
||||
border TYPE ty_border,
|
||||
grid TYPE ty_grid,
|
||||
offset TYPE abap_bool,
|
||||
axis TYPE string,
|
||||
labels TYPE string_table,
|
||||
angle_lines TYPE ty_angle_lines,
|
||||
start_angle TYPE i,
|
||||
END OF ty_scale .
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_scales,
|
||||
y TYPE ty_scale,
|
||||
x TYPE ty_scale,
|
||||
r TYPE ty_scale,
|
||||
END OF ty_scales .
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_interaction,
|
||||
mode TYPE string,
|
||||
intersect TYPE abap_bool,
|
||||
include_invisible TYPE abap_bool,
|
||||
axis TYPE string,
|
||||
END OF ty_interaction .
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_tension,
|
||||
duration TYPE i,
|
||||
easing TYPE string,
|
||||
from TYPE i,
|
||||
to TYPE i,
|
||||
loop TYPE abap_bool,
|
||||
END OF ty_tension .
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_animations,
|
||||
tension TYPE ty_tension,
|
||||
END OF ty_animations .
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_hover,
|
||||
mode TYPE string,
|
||||
intersec TYPE abap_bool,
|
||||
END OF ty_hover .
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_layout,
|
||||
auto_padding TYPE abap_bool,
|
||||
padding TYPE ty_padding,
|
||||
END OF ty_layout .
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_point,
|
||||
radius TYPE i,
|
||||
rotation TYPE i,
|
||||
border_width TYPE i,
|
||||
hit_radius TYPE i,
|
||||
hover_radius TYPE i,
|
||||
hover_border_width TYPE i,
|
||||
point_style TYPE string,
|
||||
background_color TYPE string,
|
||||
border_color TYPE string,
|
||||
END OF ty_point .
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_line,
|
||||
tension TYPE i,
|
||||
border_cap_style TYPE string,
|
||||
border_width TYPE i,
|
||||
fill TYPE string,
|
||||
border_dash TYPE i,
|
||||
border_dash_offset TYPE i,
|
||||
border_join_style TYPE string,
|
||||
cubic_interpolation_mode TYPE string,
|
||||
cap_bezier_points TYPE abap_bool,
|
||||
stepped TYPE abap_bool,
|
||||
background_color TYPE string,
|
||||
border_color TYPE string,
|
||||
END OF ty_line .
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_bar,
|
||||
border_width TYPE i,
|
||||
background_color TYPE string,
|
||||
border_color TYPE string,
|
||||
border_skipped TYPE string,
|
||||
border_radius TYPE i,
|
||||
inflate_amount TYPE i,
|
||||
point_style TYPE string,
|
||||
END OF ty_bar.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_arc,
|
||||
border_width TYPE i,
|
||||
background_color TYPE string,
|
||||
border_color TYPE string,
|
||||
border_align TYPE string,
|
||||
border_dash TYPE i,
|
||||
border_dash_offset TYPE i,
|
||||
border_join_style TYPE string,
|
||||
circular TYPE abap_bool,
|
||||
angle TYPE i,
|
||||
END OF ty_arc.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_elements,
|
||||
point TYPE ty_point,
|
||||
line TYPE ty_line,
|
||||
bar TYPE ty_bar,
|
||||
arc TYPE ty_arc,
|
||||
END OF ty_elements .
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_options,
|
||||
scales TYPE ty_scales,
|
||||
responsive TYPE abap_bool,
|
||||
plugins TYPE ty_plugins,
|
||||
hover TYPE ty_hover,
|
||||
interaction TYPE ty_interaction,
|
||||
animations TYPE ty_animations,
|
||||
layout TYPE ty_layout,
|
||||
elements TYPE ty_elements,
|
||||
index_axis TYPE string,
|
||||
events TYPE string_table,
|
||||
END OF ty_options .
|
||||
|
||||
"ChartJS Configuration
|
||||
TYPES:
|
||||
BEGIN OF ty_chart ##NEEDED,
|
||||
type TYPE string,
|
||||
data TYPE ty_data,
|
||||
options TYPE ty_options,
|
||||
END OF ty_chart.
|
||||
|
||||
CLASS-METHODS get_chartjs_local
|
||||
RETURNING
|
||||
VALUE(result) TYPE string .
|
||||
CLASS-METHODS get_chartjs_url
|
||||
RETURNING
|
||||
VALUE(result) TYPE string .
|
||||
CLASS-METHODS get_js_datalabels
|
||||
RETURNING
|
||||
VALUE(result) TYPE string .
|
||||
CLASS-METHODS get_js_autocolors
|
||||
RETURNING
|
||||
VALUE(result) TYPE string .
|
||||
CLASS-METHODS get_js_deferred
|
||||
RETURNING
|
||||
VALUE(result) TYPE string .
|
||||
CLASS-METHODS get_js_venn
|
||||
RETURNING
|
||||
VALUE(result) TYPE string .
|
||||
CLASS-METHODS get_js_wordcloud
|
||||
RETURNING
|
||||
VALUE(result) TYPE string .
|
||||
CLASS-METHODS get_js_annotation
|
||||
RETURNING
|
||||
VALUE(result) TYPE string .
|
||||
CLASS-METHODS load_js
|
||||
IMPORTING
|
||||
datalabels TYPE abap_bool DEFAULT abap_false
|
||||
autocolors TYPE abap_bool DEFAULT abap_false
|
||||
deferred TYPE abap_bool DEFAULT abap_false
|
||||
venn TYPE abap_bool DEFAULT abap_false
|
||||
wordcloud TYPE abap_bool DEFAULT abap_false
|
||||
annotation TYPE abap_bool DEFAULT abap_false
|
||||
RETURNING
|
||||
VALUE(result) TYPE string .
|
||||
CLASS-METHODS load_cc
|
||||
RETURNING
|
||||
VALUE(result) TYPE string .
|
||||
|
||||
PROTECTED SECTION.
|
||||
PRIVATE SECTION.
|
||||
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
|
||||
CLASS Z2UI5_CL_CC_CHARTJS IMPLEMENTATION.
|
||||
|
||||
|
||||
METHOD get_chartjs_local.
|
||||
result = ``.
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD get_chartjs_url.
|
||||
result = `https://cdn.jsdelivr.net/npm/chart.js@4.4.1/dist/chart.umd.js`.
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD get_js_annotation.
|
||||
result = `https://cdn.jsdelivr.net/npm/chartjs-plugin-annotation@3.0.1/dist/chartjs-plugin-annotation.min.js`.
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD get_js_autocolors.
|
||||
"chartjs-plugin-datalabels must be loaded after the Chart.js library!
|
||||
result = `https://cdn.jsdelivr.net/npm/chartjs-plugin-autocolors`.
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD get_js_datalabels.
|
||||
"chartjs-plugin-datalabels must be loaded after the Chart.js library!
|
||||
result = `https://cdn.jsdelivr.net/npm/chartjs-plugin-datalabels@2`.
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD get_js_deferred.
|
||||
"chartjs-plugin-datalabels must be loaded after the Chart.js library!
|
||||
result = `https://cdn.jsdelivr.net/npm/chartjs-plugin-deferred@2.0.0/dist/chartjs-plugin-deferred.min.js`.
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD get_js_venn.
|
||||
result = `https://cdn.jsdelivr.net/npm/chartjs-chart-venn@4.2.7/build/index.umd.min.js`.
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD get_js_wordcloud.
|
||||
result = `https://cdn.jsdelivr.net/npm/chartjs-chart-wordcloud@4.3.2/build/index.umd.min.js`.
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD load_cc.
|
||||
|
||||
|
||||
result = `debugger;` && |\n| &&
|
||||
`sap.ui.define("z2ui5/chartjs", [` && |\n| &&
|
||||
` "sap/ui/core/Control",` && |\n| &&
|
||||
`], function (Control) {` && |\n| &&
|
||||
` "use strict";` && |\n| &&
|
||||
|\n| &&
|
||||
` return Control.extend("z2ui5.chartjs", {` && |\n| &&
|
||||
` metadata: {` && |\n| &&
|
||||
` properties: {` && |\n| &&
|
||||
` config: { ` && |\n| &&
|
||||
` type: "Array" ` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` canvas_id: {` && |\n| &&
|
||||
` type: "string",` && |\n| &&
|
||||
` defaultValue: ""` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` width: {` && |\n| &&
|
||||
` type: "string",` && |\n| &&
|
||||
` defaultValue: ""` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` height: {` && |\n| &&
|
||||
` type: "string",` && |\n| &&
|
||||
` defaultValue: ""` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` style: {` && |\n| &&
|
||||
` type: "string",` && |\n| &&
|
||||
` defaultValue: ""` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` view: {` && |\n| &&
|
||||
` type: "string",` && |\n| &&
|
||||
` defaultValue: ""` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` init() {` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
|\n| &&
|
||||
` setConfig: function(oConfig) { ` && |\n| &&
|
||||
` var canvas_id = this.getProperty("canvas_id");` && |\n| &&
|
||||
` var cVar = canvas_id+'_chartjs'; ` && |\n| &&
|
||||
* ` var cType = oConfig.type;` && |\n| &&
|
||||
* ` if(cType == 'venn') {` && |\n| &&
|
||||
* ` var tConfig = JSON.stringify(oConfig);` && |\n| &&
|
||||
* ` tConfig = tConfig.replace("dataVenn","data");` && |\n| &&
|
||||
* ` oConfig = JSON.parse(tConfig);` && |\n| &&
|
||||
* ` } else {` && |\n| &&
|
||||
* ` this.setProperty("config", oConfig );` && |\n| &&
|
||||
* ` };` && |\n| &&
|
||||
` var tConfig = JSON.stringify(oConfig);` && |\n| &&
|
||||
` tConfig = tConfig.replace("dataVenn","data");` && |\n| &&
|
||||
` tConfig = tConfig.replace("scaleid","scaleID");` && |\n| &&
|
||||
` tConfig = tConfig.replaceAll("xScaleid","xScaleID");` && |\n| &&
|
||||
` tConfig = tConfig.replaceAll("yScaleid","yScaleID");` && |\n| &&
|
||||
` tConfig = tConfig.replaceAll("dataRadial","data");` && |\n| &&
|
||||
` oConfig = JSON.parse(tConfig);` && |\n| &&
|
||||
` this.setProperty("config", oConfig, true );` && |\n| &&
|
||||
` if(oConfig){ fixJsonLibs(oConfig); };` && |\n| &&
|
||||
` if(window[cVar]?.data) { window[cVar].data = oConfig.data; }` && |\n| &&
|
||||
` if(window[cVar]?.options) { window[cVar].options = oConfig.options; }` && |\n| &&
|
||||
` if(window[cVar]?.config._config.type) { window[cVar].config._config.type = oConfig.type; }` && |\n| &&
|
||||
` if(window[cVar]){ window[cVar].update(); }` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
|\n| &&
|
||||
` renderer(oRm, oControl) {` && |\n| &&
|
||||
` var canvas_id = oControl.getProperty("canvas_id");` && |\n| &&
|
||||
` var width = oControl.getProperty("width");` && |\n| &&
|
||||
` var height = oControl.getProperty("height");` && |\n| &&
|
||||
` var style = oControl.getProperty("style");` && |\n| &&
|
||||
` oRm.write( "<canvas id='" + canvas_id + "' width='" + width + "' height='" + height + "' style = '" + style + "' />");` && |\n| &&
|
||||
|\n| &&
|
||||
` var Model = oControl.getProperty("config");` && |\n| &&
|
||||
` if(!Model ) { return; };` && |\n| &&
|
||||
` var cVar = canvas_id+'_chartjs'; ` && |\n| &&
|
||||
` setTimeout( (oControl) => { ` && |\n| &&
|
||||
|\n| &&
|
||||
` var ctx = document.getElementById(canvas_id); ` && |\n| &&
|
||||
` sap.z2ui5.autocolors = {}; try { sap.z2ui5.autocolors = window['chartjs-plugin-autocolors']; } catch (err){};` && |\n| &&
|
||||
` sap.z2ui5.ChartDeferred = {}; try { sap.z2ui5.ChartDeferred = window['chartjs-plugin-deferred']; } catch (err){};` && |\n| &&
|
||||
` window[cVar] = new Chart( ctx, Model );` && |\n| &&
|
||||
` ` && |\n| &&
|
||||
` }, 150 , oControl );` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
|\n| &&
|
||||
` });` && |\n| &&
|
||||
`});`.
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD load_js.
|
||||
|
||||
DATA lv_libs TYPE string VALUE ` `.
|
||||
|
||||
result = `` && |\n| &&
|
||||
`var libs = ["` && get_chartjs_url( ) && `"];` && |\n|.
|
||||
|
||||
IF datalabels = abap_true.
|
||||
result = result && `libs.push("` && get_js_datalabels( ) && `");` && |\n|.
|
||||
IF lv_libs = ` `.
|
||||
lv_libs = lv_libs && `ChartDataLabels`.
|
||||
ELSE.
|
||||
lv_libs = lv_libs && `,` && `ChartDataLabels`.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
IF autocolors = abap_true.
|
||||
result = result && `libs.push("` && get_js_autocolors( ) && `");` && |\n|.
|
||||
IF lv_libs = ` `.
|
||||
lv_libs = lv_libs && `sap.z2ui5.autocolors `.
|
||||
ELSE.
|
||||
lv_libs = lv_libs && `,` && `sap.z2ui5.autocolors `.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
IF deferred = abap_true.
|
||||
result = result && `libs.push("` && get_js_deferred( ) && `");` && |\n|.
|
||||
IF lv_libs = ` `.
|
||||
lv_libs = lv_libs && `sap.z2ui5.ChartDeferred`.
|
||||
ELSE.
|
||||
lv_libs = lv_libs && `,` && `sap.z2ui5.ChartDeferred`.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
IF annotation = abap_true.
|
||||
result = result && `libs.push("` && get_js_annotation( ) && `");` && |\n|.
|
||||
ENDIF.
|
||||
IF venn = abap_true.
|
||||
result = result && `libs.push("` && get_js_venn( ) && `");` && |\n|.
|
||||
ENDIF.
|
||||
IF wordcloud = abap_true.
|
||||
result = result && `libs.push("` && get_js_wordcloud( ) && `");` && |\n|.
|
||||
ENDIF.
|
||||
|
||||
|
||||
result = result && `` && |\n| &&
|
||||
`var fixJsonLibs = function(data){` && |\n| &&
|
||||
` if (!data.hasOwnProperty("plugins")) {` && |\n| &&
|
||||
` data["plugins"] = [` && lv_libs && `];` && |\n| &&
|
||||
` return;` && |\n| &&
|
||||
` };` && |\n| &&
|
||||
`` && |\n| &&
|
||||
` Object.keys(data).forEach(function(key) {` && |\n| &&
|
||||
` if(key=="plugins") {` && |\n| &&
|
||||
` data[key] = [` && lv_libs && `];` && |\n| &&
|
||||
` };` && |\n| &&
|
||||
`})};` && |\n| &&
|
||||
`var loadLibs = function(){` && |\n| &&
|
||||
` if(libs.length > 0){` && |\n| &&
|
||||
` var nextLib = libs.shift();` && |\n| &&
|
||||
` var headTag = document.getElementsByTagName('head')[0];` && |\n| &&
|
||||
`` && |\n| &&
|
||||
` var scriptTag = document.createElement('script');` && |\n| &&
|
||||
` scriptTag.src = nextLib;` && |\n| &&
|
||||
`` && |\n| &&
|
||||
` scriptTag.onload = function(e){` && |\n| &&
|
||||
` loadLibs();` && |\n| &&
|
||||
` };` && |\n| &&
|
||||
`` && |\n| &&
|
||||
` headTag.appendChild(scriptTag);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
`` && |\n| &&
|
||||
` else return;` && |\n| &&
|
||||
`` && |\n| &&
|
||||
`};` && |\n| &&
|
||||
`loadLibs();`.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD z2ui5_if_ajson_filter~keep_node.
|
||||
|
||||
rv_keep = abap_true.
|
||||
|
||||
CASE iv_visit.
|
||||
|
||||
WHEN z2ui5_if_ajson_filter=>visit_type-open.
|
||||
|
||||
IF is_node-children = 0.
|
||||
rv_keep = abap_false.
|
||||
ENDIF.
|
||||
|
||||
WHEN z2ui5_if_ajson_filter=>visit_type-value.
|
||||
|
||||
CASE is_node-type.
|
||||
WHEN z2ui5_if_ajson_types=>node_type-boolean.
|
||||
IF is_node-value = `false`.
|
||||
rv_keep = abap_false.
|
||||
ENDIF.
|
||||
WHEN z2ui5_if_ajson_types=>node_type-number.
|
||||
IF is_node-value = `0` OR is_node-value = `0.00`.
|
||||
rv_keep = abap_false.
|
||||
ENDIF.
|
||||
WHEN z2ui5_if_ajson_types=>node_type-string.
|
||||
IF is_node-value = ``.
|
||||
rv_keep = abap_false.
|
||||
ENDIF.
|
||||
ENDCASE.
|
||||
|
||||
WHEN z2ui5_if_ajson_filter=>visit_type-close.
|
||||
|
||||
IF is_node-children = 0.
|
||||
rv_keep = abap_false.
|
||||
ENDIF.
|
||||
|
||||
ENDCASE.
|
||||
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
|
@ -1,16 +0,0 @@
|
|||
<?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_CC_CHARTJS</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>CHARTJS</DESCRIPT>
|
||||
<STATE>1</STATE>
|
||||
<CLSCCINCL>X</CLSCCINCL>
|
||||
<FIXPT>X</FIXPT>
|
||||
<UNICODE>X</UNICODE>
|
||||
</VSEOCLASS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
|
@ -1,85 +0,0 @@
|
|||
CLASS z2ui5_cl_cc_demo_out DEFINITION
|
||||
PUBLIC
|
||||
FINAL
|
||||
CREATE PUBLIC .
|
||||
|
||||
PUBLIC SECTION.
|
||||
|
||||
CLASS-METHODS get_style
|
||||
RETURNING
|
||||
VALUE(result) TYPE string.
|
||||
|
||||
PROTECTED SECTION.
|
||||
PRIVATE SECTION.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
|
||||
CLASS z2ui5_cl_cc_demo_out IMPLEMENTATION.
|
||||
|
||||
METHOD get_style.
|
||||
|
||||
result = `<html:style type="text/css">body {` && |\n| &&
|
||||
` font-family: Arial;` && |\n| &&
|
||||
` font-size: 90%;` && |\n| &&
|
||||
`}` && |\n| &&
|
||||
`table {` && |\n| &&
|
||||
` font-family: Arial;` && |\n| &&
|
||||
` font-size: 90%;` && |\n| &&
|
||||
`}` && |\n| &&
|
||||
`caption {` && |\n| &&
|
||||
` font-family: Arial;` && |\n| &&
|
||||
` font-size: 90%;` && |\n| &&
|
||||
` font-weight:bold;` && |\n| &&
|
||||
` text-align:left;` && |\n| &&
|
||||
`}` && |\n| &&
|
||||
`span.heading1 {` && |\n| &&
|
||||
` font-size: 150%;` && |\n| &&
|
||||
` color:#000080;` && |\n| &&
|
||||
` font-weight:bold;` && |\n| &&
|
||||
`}` && |\n| &&
|
||||
`span.heading2 {` && |\n| &&
|
||||
` font-size: 135%;` && |\n| &&
|
||||
` color:#000080;` && |\n| &&
|
||||
` font-weight:bold;` && |\n| &&
|
||||
`}` && |\n| &&
|
||||
`span.heading3 {` && |\n| &&
|
||||
` font-size: 120%;` && |\n| &&
|
||||
` color:#000080;` && |\n| &&
|
||||
` font-weight:bold;` && |\n| &&
|
||||
`}` && |\n| &&
|
||||
`span.heading4 {` && |\n| &&
|
||||
` font-size: 105%;` && |\n| &&
|
||||
` color:#000080;` && |\n| &&
|
||||
` font-weight:bold;` && |\n| &&
|
||||
`}` && |\n| &&
|
||||
`span.normal {` && |\n| &&
|
||||
` font-size: 100%;` && |\n| &&
|
||||
` color:#000000;` && |\n| &&
|
||||
` font-weight:normal;` && |\n| &&
|
||||
`}` && |\n| &&
|
||||
`span.nonprop {` && |\n| &&
|
||||
` font-family: Courier New;` && |\n| &&
|
||||
` font-size: 100%;` && |\n| &&
|
||||
` color:#000000;` && |\n| &&
|
||||
` font-weight:400;` && |\n| &&
|
||||
`}` && |\n| &&
|
||||
`span.nowrap {` && |\n| &&
|
||||
` white-space:nowrap;` && |\n| &&
|
||||
`}` && |\n| &&
|
||||
`span.nprpnwrp {` && |\n| &&
|
||||
` font-family: Courier New;` && |\n| &&
|
||||
` font-size: 100%;` && |\n| &&
|
||||
` color:#000000;` && |\n| &&
|
||||
` font-weight:400;` && |\n| &&
|
||||
` white-space:nowrap;` && |\n| &&
|
||||
`}` && |\n| &&
|
||||
`tr.header {` && |\n| &&
|
||||
` background-color:#D3D3D3;` && |\n| &&
|
||||
`}` && |\n| &&
|
||||
`tr.body {` && |\n| &&
|
||||
` background-color:#EFEFEF;` && |\n| &&
|
||||
`}` && |\n| &&
|
||||
`</html:style>`.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
|
@ -1,16 +0,0 @@
|
|||
<?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_CC_DEMO_OUT</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>cc for cl_demo_ouput</DESCRIPT>
|
||||
<STATE>1</STATE>
|
||||
<CLSCCINCL>X</CLSCCINCL>
|
||||
<FIXPT>X</FIXPT>
|
||||
<UNICODE>X</UNICODE>
|
||||
</VSEOCLASS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
|
@ -1,538 +0,0 @@
|
|||
CLASS z2ui5_cl_cc_driver_js DEFINITION
|
||||
PUBLIC
|
||||
FINAL
|
||||
CREATE PUBLIC.
|
||||
|
||||
PUBLIC SECTION.
|
||||
INTERFACES z2ui5_if_ajson_filter.
|
||||
CONSTANTS:
|
||||
BEGIN OF buttons ##NEEDED,
|
||||
all TYPE string VALUE `['next','previous','close']`,
|
||||
next TYPE string VALUE `['next']`,
|
||||
previous TYPE string VALUE `['previous']`,
|
||||
close TYPE string VALUE `['close']`,
|
||||
next_previous TYPE string VALUE `['next','previous']`,
|
||||
next_close TYPE string VALUE `['next','close']`,
|
||||
previous_close TYPE string VALUE `['previous','close']`,
|
||||
END OF buttons.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF side ##NEEDED,
|
||||
top TYPE string VALUE `top`,
|
||||
right TYPE string VALUE `right`,
|
||||
bottom TYPE string VALUE `bottom`,
|
||||
left TYPE string VALUE `left`,
|
||||
end TYPE string VALUE `end`,
|
||||
END OF side.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF align ##NEEDED,
|
||||
start TYPE string VALUE `start`,
|
||||
center TYPE string VALUE `center`,
|
||||
end TYPE string VALUE `end`,
|
||||
END OF align.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_config_steps_popover,
|
||||
title TYPE string,
|
||||
description TYPE string,
|
||||
side TYPE string,
|
||||
align TYPE string,
|
||||
show_buttons TYPE string,
|
||||
disable_buttons TYPE string,
|
||||
next_btn_text TYPE string,
|
||||
prev_btn_text TYPE string,
|
||||
done_btn_text TYPE string,
|
||||
show_progress TYPE abap_bool,
|
||||
progress_text TYPE string,
|
||||
popover_class TYPE string,
|
||||
" onPopoverRender?: (popover: PopoverDOM, options: { config: Config; state: State }) => void;
|
||||
on_popover_render TYPE string,
|
||||
" onPrevClick?: (element?: Element, step: DriveStep, options: { config: Config; state: State }) => void;;
|
||||
on_next_click TYPE string,
|
||||
" onPrevClick?: (element?: Element, step: DriveStep, options: { config: Config; state: State }) => void;;
|
||||
on_prev_click TYPE string,
|
||||
" onCloseClick?: (element?: Element, step: DriveStep, options: { config: Config; state: State }) => void;;
|
||||
on_close_click TYPE string,
|
||||
END OF ty_config_steps_popover.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_config_steps,
|
||||
element TYPE string,
|
||||
elementview TYPE string,
|
||||
popover TYPE ty_config_steps_popover,
|
||||
" onDeselected?: (element?: Element, step: DriveStep, options: { config: Config; state: State }) => void;;
|
||||
on_deselected TYPE string,
|
||||
" onHighlightStarted?: (element?: Element, step: DriveStep, options: { config: Config; state: State }) => void;;
|
||||
on_highlight_started TYPE string,
|
||||
" onHighlighted?: (element?: Element, step: DriveStep, options: { config: Config; state: State }) => void;;
|
||||
on_highlighted TYPE string,
|
||||
END OF ty_config_steps.
|
||||
|
||||
TYPES ty_config_steps_tt TYPE STANDARD TABLE OF ty_config_steps WITH EMPTY KEY.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_config,
|
||||
steps TYPE ty_config_steps_tt,
|
||||
animate TYPE abap_bool,
|
||||
overlay_color TYPE string,
|
||||
smooth_scroll TYPE abap_bool,
|
||||
allow_close TYPE abap_bool,
|
||||
overlay_opacity TYPE i,
|
||||
stage_padding TYPE i,
|
||||
stage_radius TYPE i,
|
||||
allow_keyboard_control TYPE abap_bool,
|
||||
disable_active_interaction TYPE abap_bool,
|
||||
popover_class TYPE string,
|
||||
popover_offset TYPE i,
|
||||
show_buttons TYPE string,
|
||||
disable_buttons TYPE string,
|
||||
show_progress TYPE abap_bool,
|
||||
progress_text TYPE string,
|
||||
next_btn_text TYPE string,
|
||||
prev_btn_text TYPE string,
|
||||
done_btn_text TYPE string,
|
||||
" onPopoverRender?: (popover: PopoverDOM, options: { config: Config; state: State }) => void;
|
||||
on_popover_render TYPE string,
|
||||
" onHighlightStarted?: (element?: Element, step: DriveStep, options: { config: Config; state: State }) => void;;
|
||||
on_highlight_started TYPE string,
|
||||
" onHighlighted?: (element?: Element, step: DriveStep, options: { config: Config; state: State }) => void;;
|
||||
on_highlighted TYPE string,
|
||||
" onDeselected?: (element?: Element, step: DriveStep, options: { config: Config; state: State }) => void;;
|
||||
on_deselected TYPE string,
|
||||
" onDestroyStarted?: (element?: Element, step: DriveStep, options: { config: Config; state: State }) => void;;
|
||||
on_destroy_started TYPE string,
|
||||
" onDestroyed?: (element?: Element, step: DriveStep, options: { config: Config; state: State }) => void;;
|
||||
on_destroyed TYPE string,
|
||||
" onNextClick?: (element?: Element, step: DriveStep, options: { config: Config; state: State }) => void;;
|
||||
on_next_click TYPE string,
|
||||
" onPrevClick?: (element?: Element, step: DriveStep, options: { config: Config; state: State }) => void;;
|
||||
on_prev_click TYPE string,
|
||||
" onCloseClick?: (element?: Element, step: DriveStep, options: { config: Config; state: State }) => void;;
|
||||
on_close_click TYPE string,
|
||||
END OF ty_config.
|
||||
|
||||
CLASS-METHODS get_css_local
|
||||
RETURNING
|
||||
VALUE(result) TYPE string.
|
||||
|
||||
CLASS-METHODS get_js_local
|
||||
RETURNING
|
||||
VALUE(result) TYPE string.
|
||||
|
||||
CLASS-METHODS get_js_cc
|
||||
RETURNING
|
||||
VALUE(result) TYPE string.
|
||||
|
||||
CLASS-METHODS get_js_config
|
||||
IMPORTING
|
||||
i_steps_config TYPE ty_config
|
||||
i_highlight_config TYPE ty_config_steps
|
||||
i_highlight_driver_config TYPE ty_config
|
||||
RETURNING
|
||||
VALUE(r_drive_js) TYPE string.
|
||||
|
||||
PROTECTED SECTION.
|
||||
PRIVATE SECTION.
|
||||
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
|
||||
CLASS Z2UI5_CL_CC_DRIVER_JS IMPLEMENTATION.
|
||||
|
||||
|
||||
METHOD get_css_local.
|
||||
result = `` && |\n| &&
|
||||
`.driver-active .driver-overlay,.driver-active *{pointer-events:none}.driver-active .driver-active-element,.driver-active .driver-active-element *,.driver-popover,.driver-popover *{pointer-events:auto}` &&
|
||||
`@keyframes animate-fade-in{0%{opacity:0}to{opacity:1}}.driver-fade .driver-overlay{animation:animate-fade-in .2s ease-in-out}` &&
|
||||
`.driver-fade .driver-popover{animation:animate-fade-in .2s}` &&
|
||||
`.driver-popover{all:unset;box-sizing:border-box;color:#2d2d2d;margin:0;padding:15px;border-radius:5px;min-width:250px;max-width:300px;box-shadow:0 1px 10px #0006;z-index:1000000000;position:fixed;top:0;right:0;background-color:#fff}` &&
|
||||
`.driver-popover *{font-family:Helvetica Neue,Inter,ui-sans-serif,"Apple Color Emoji",Helvetica,Arial,sans-serif}.driver-popover-title{font:19px/normal sans-serif;font-weight:700;display:block;position:relative;line-height:1.5;zoom:1;margin:0}` &&
|
||||
`.driver-popover-close-btn{all:unset;position:absolute;top:0;right:0;width:32px;height:28px;cursor:pointer;font-size:18px;font-weight:500;color:#d2d2d2;z-index:1;text-align:center;transition:color;transition-duration:.2s}` &&
|
||||
`.driver-popover-close-btn:hover,.driver-popover-close-btn:focus{color:#2d2d2d}` &&
|
||||
`.driver-popover-title[style*=block]+.driver-popover-description{margin-top:5px}.driver-popover-description{margin-bottom:0;font:14px/normal sans-serif;line-height:1.5;font-weight:400;zoom:1}` &&
|
||||
`.driver-popover-footer{margin-top:15px;text-align:right;zoom:1;display:flex;align-items:center;justify-content:space-between}.driver-popover-progress-text{font-size:13px;font-weight:400;color:#727272;zoom:1}` &&
|
||||
`.driver-popover-footer button{all:unset;display:inline-block;box-sizing:border-box;padding:3px 7px;text-decoration:none;text-shadow:1px 1px 0 #fff;background-color:#fff;color:#2d2d2d;font:12px/normal sans-serif;` &&
|
||||
` cursor:pointer;outline:0;zoom:1;line-height:1.3;border:1px solid #ccc;border-radius:3px}` &&
|
||||
`.driver-popover-footer .driver-popover-btn-disabled{opacity:.5;pointer-events:none}:not(body):has(>.driver-active-element){overflow:hidden!important}` &&
|
||||
`.driver-no-interaction,.driver-no-interaction *{pointer-events:none!important}.driver-popover-footer button:hover,` &&
|
||||
`.driver-popover-footer button:focus{background-color:#f7f7f7}.driver-popover-navigation-btns{display:flex;flex-grow:1;justify-content:flex-end}.driver-popover-navigation-btns button+button{margin-left:4px}` &&
|
||||
`.driver-popover-arrow{content:"";position:absolute;border:5px solid #fff}.driver-popover-arrow-side-over{display:none}` &&
|
||||
`.driver-popover-arrow-side-left{left:100%;border-right-color:transparent;border-bottom-color:transparent;border-top-color:transparent}` &&
|
||||
`.driver-popover-arrow-side-right{right:100%;border-left-color:transparent;border-bottom-color:transparent;border-top-color:transparent}` &&
|
||||
`.driver-popover-arrow-side-top{top:100%;border-right-color:transparent;border-bottom-color:transparent;border-left-color:transparent}` &&
|
||||
`.driver-popover-arrow-side-bottom{bottom:100%;border-left-color:transparent;border-top-color:transparent;border-right-color:transparent}` &&
|
||||
`.driver-popover-arrow-side-center{display:none}.driver-popover-arrow-side-left.driver-popover-arrow-align-start,.driver-popover-arrow-side-right.driver-popover-arrow-align-start{top:15px}` &&
|
||||
`.driver-popover-arrow-side-top.driver-popover-arrow-align-start,.driver-popover-arrow-side-bottom.driver-popover-arrow-align-start{left:15px}` &&
|
||||
`.driver-popover-arrow-align-end.driver-popover-arrow-side-left,.driver-popover-arrow-align-end.driver-popover-arrow-side-right{bottom:15px}` &&
|
||||
`.driver-popover-arrow-side-top.driver-popover-arrow-align-end,.driver-popover-arrow-side-bottom.driver-popover-arrow-align-end{right:15px}` &&
|
||||
`.driver-popover-arrow-side-left.driver-popover-arrow-align-center,.driver-popover-arrow-side-right.driver-popover-arrow-align-center{top:50%;margin-top:-5px}` &&
|
||||
`.driver-popover-arrow-side-top.driver-popover-arrow-align-center,.driver-popover-arrow-side-bottom.driver-popover-arrow-align-center{left:50%;margin-left:-5px}.driver-popover-arrow-none{display:none}`.
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD get_js_cc.
|
||||
|
||||
result = `sap.z2ui5.DriverJS = { };` &&
|
||||
`sap.z2ui5.DriverJS.drive = function() {` && |\n| &&
|
||||
` if( driver !== undefined ) { if( config !== undefined ) {` && |\n| &&
|
||||
` driverObj = driver(config);` && |\n| &&
|
||||
` driverObj.drive();` && |\n| &&
|
||||
` } };` && |\n| &&
|
||||
` };` && |\n| &&
|
||||
` sap.z2ui5.DriverJS.highlight = function() {` && |\n| &&
|
||||
` if( driver !== undefined ) { if ( highlight_driver_config !== undefined ) { if (highlight_config !== undefined ) {` && |\n| &&
|
||||
` driverObj = driver(highlight_driver_config);` && |\n| &&
|
||||
` driverObj.highlight(highlight_config);` && |\n| &&
|
||||
` } }};` && |\n| &&
|
||||
` };`.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD get_js_config.
|
||||
|
||||
DATA(ls_config) = i_steps_config.
|
||||
DATA(ls_highlight_config) = i_highlight_config.
|
||||
DATA(ls_highlight_driver_config) = i_highlight_driver_config.
|
||||
|
||||
"load driver object from window object
|
||||
r_drive_js = `var driver = window.driver.js.driver;` && |\n| &&
|
||||
`var driverObj = new Object();` && |\n|.
|
||||
|
||||
"handle tour
|
||||
IF i_steps_config IS NOT INITIAL.
|
||||
|
||||
LOOP AT ls_config-steps ASSIGNING FIELD-SYMBOL(<step>).
|
||||
IF <step>-popover-title IS NOT INITIAL.
|
||||
<step>-popover-title = escape( val = <step>-popover-title format = cl_abap_format=>e_html_js_html ).
|
||||
ENDIF.
|
||||
IF <step>-popover-description IS NOT INITIAL.
|
||||
<step>-popover-description = escape( val = <step>-popover-description format = cl_abap_format=>e_html_js_html ).
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
|
||||
"needed for transpilation to js
|
||||
DATA(lv_config_json) = ``.
|
||||
* lv_config_json = /ui2/cl_json=>serialize(
|
||||
* data = ls_config
|
||||
* compress = abap_true
|
||||
* pretty_name = 'X' ).
|
||||
TRY.
|
||||
DATA(li_ajson) = CAST z2ui5_if_ajson( z2ui5_cl_ajson=>create_empty( ) ).
|
||||
li_ajson->set( iv_path = `/` iv_val = ls_config ).
|
||||
* li_ajson = li_ajson->filter( z2ui5_cl_ajson_filter_lib=>create_empty_filter( ) ).
|
||||
li_ajson = li_ajson->filter( NEW z2ui5_cl_cc_driver_js( ) ).
|
||||
li_ajson = li_ajson->map( z2ui5_cl_ajson_mapping=>create_to_camel_case( ) ).
|
||||
li_ajson = li_ajson->map( z2ui5_cl_ajson_mapping=>create_lower_case( ) ).
|
||||
lv_config_json = li_ajson->stringify( ).
|
||||
|
||||
CATCH cx_root.
|
||||
ENDTRY.
|
||||
r_drive_js = r_drive_js && `var config = ` && lv_config_json && `;` && |\n| &&
|
||||
`var iLength = config.steps.length;` && |\n| &&
|
||||
`for (var i = 0; i < iLength; i++) {` && |\n| &&
|
||||
` switch ( config.steps[i].elementview ) {` && |\n| &&
|
||||
` case 'NEST':` && |\n| &&
|
||||
` config.steps[i].element = '#' + sap.z2ui5.oViewNest.createId( config.steps[i].element );` && |\n| &&
|
||||
` case 'NEST2':` && |\n| &&
|
||||
` config.steps[i].element = '#' + sap.z2ui5.oViewNest2.createId( config.steps[i].element );` && |\n| &&
|
||||
` case 'POPUP':` && |\n| &&
|
||||
` config.steps[i].element = '#' + sap.z2ui5.oViewPopup.createId( config.steps[i].element );` && |\n| &&
|
||||
` case 'POPOVER':` && |\n| &&
|
||||
` config.steps[i].element = '#' + sap.z2ui5.oViewPopover.createId( config.steps[i].element );` && |\n| &&
|
||||
` // MAIN view is default` && |\n| &&
|
||||
` default:` && |\n| &&
|
||||
` config.steps[i].element = '#' + sap.z2ui5.oView.createId( config.steps[i].element );` && |\n| &&
|
||||
` };` && |\n| &&
|
||||
`};`.
|
||||
|
||||
r_drive_js = r_drive_js && |\n| &&
|
||||
`for (var key of Object.keys(config)) {` && |\n| &&
|
||||
` if( key.startsWith('on') ) {` && |\n| &&
|
||||
` config[key] = new Function( config[key] );` && |\n| &&
|
||||
` };` && |\n| &&
|
||||
`};` && |\n|.
|
||||
|
||||
r_drive_js = r_drive_js && |\n| &&
|
||||
`for (key of Object.keys(config.steps)) {` && |\n| &&
|
||||
` if( key.startsWith('on') ) {` && |\n| &&
|
||||
` config.steps[key] = new Function( config.steps[key] );` && |\n| &&
|
||||
` };` && |\n| &&
|
||||
`};` && |\n|.
|
||||
|
||||
r_drive_js = r_drive_js && |\n| &&
|
||||
`for (var j = 0; j < config.steps.length; j++) {` && |\n| &&
|
||||
` for (key of Object.keys(config.steps[j].popover)) {` && |\n| &&
|
||||
` if( key.startsWith('on') ) {` && |\n| &&
|
||||
` config.steps[j].popover[key] = new Function( config.steps[kj].popover[key] );` && |\n| &&
|
||||
` };` && |\n| &&
|
||||
` };` && |\n| &&
|
||||
`};` && |\n|.
|
||||
|
||||
|
||||
ENDIF.
|
||||
|
||||
"handle highlight
|
||||
IF i_highlight_config IS NOT INITIAL AND i_highlight_driver_config IS NOT INITIAL.
|
||||
|
||||
DATA(lv_highlight_driver_config_jn) = ``.
|
||||
* lv_highlight_driver_config_jn = /ui2/cl_json=>serialize(
|
||||
* data = ls_highlight_driver_config
|
||||
* compress = abap_true
|
||||
* pretty_name = 'X' ).
|
||||
TRY.
|
||||
li_ajson = CAST z2ui5_if_ajson( z2ui5_cl_ajson=>create_empty( ) ).
|
||||
li_ajson->set( iv_path = `/` iv_val = ls_highlight_driver_config ).
|
||||
* li_ajson = li_ajson->filter( z2ui5_cl_ajson_filter_lib=>create_empty_filter( ) ).
|
||||
li_ajson = li_ajson->filter( NEW z2ui5_cl_cc_driver_js( ) ).
|
||||
li_ajson = li_ajson->map( z2ui5_cl_ajson_mapping=>create_to_camel_case( ) ).
|
||||
li_ajson = li_ajson->map( z2ui5_cl_ajson_mapping=>create_lower_case( ) ).
|
||||
lv_highlight_driver_config_jn = li_ajson->stringify( ).
|
||||
CATCH cx_root.
|
||||
ENDTRY.
|
||||
r_drive_js = r_drive_js && |\n| &&
|
||||
`var highlight_driver_config = ` && lv_highlight_driver_config_jn && `;` && |\n|.
|
||||
|
||||
|
||||
IF ls_highlight_config-popover-title IS NOT INITIAL.
|
||||
ls_highlight_config-popover-title = escape( val = ls_highlight_config-popover-title format = cl_abap_format=>e_html_js_html ).
|
||||
ENDIF.
|
||||
|
||||
IF ls_highlight_config-popover-description IS NOT INITIAL.
|
||||
ls_highlight_config-popover-description = escape( val = ls_highlight_config-popover-description format = cl_abap_format=>e_html_js_html ).
|
||||
ENDIF.
|
||||
|
||||
DATA(lv_highlight_config_json) = ``.
|
||||
* lv_highlight_config_json = /ui2/cl_json=>serialize(
|
||||
* data = ls_highlight_config
|
||||
* compress = abap_true
|
||||
* pretty_name = 'X' ).
|
||||
TRY.
|
||||
li_ajson = CAST z2ui5_if_ajson( z2ui5_cl_ajson=>create_empty( ) ).
|
||||
li_ajson->set( iv_path = `/` iv_val = ls_highlight_config ).
|
||||
* li_ajson = li_ajson->filter( z2ui5_cl_ajson_filter_lib=>create_empty_filter( ) ).
|
||||
li_ajson = li_ajson->filter( NEW z2ui5_cl_cc_driver_js( ) ).
|
||||
li_ajson = li_ajson->map( z2ui5_cl_ajson_mapping=>create_to_camel_case( ) ).
|
||||
li_ajson = li_ajson->map( z2ui5_cl_ajson_mapping=>create_lower_case( ) ).
|
||||
lv_highlight_config_json = li_ajson->stringify( ).
|
||||
CATCH cx_root.
|
||||
ENDTRY.
|
||||
r_drive_js = r_drive_js && |\n| &&
|
||||
`var highlight_config = ` && lv_highlight_config_json && `;` && |\n| &&
|
||||
`switch ( highlight_config.elementview ) {` && |\n| &&
|
||||
` case 'NEST':` && |\n| &&
|
||||
` highlight_config.element = '#' + sap.z2ui5.oViewNest.createId( highlight_config.element );` && |\n| &&
|
||||
` case 'NEST2':` && |\n| &&
|
||||
` highlight_config.element = '#' + sap.z2ui5.oViewNest2.createId( highlight_config.element );` && |\n| &&
|
||||
` case 'POPUP':` && |\n| &&
|
||||
` highlight_config.element = '#' + sap.z2ui5.oViewPopup.createId( highlight_config.element );` && |\n| &&
|
||||
` case 'POPOVER':` && |\n| &&
|
||||
` highlight_config.element = '#' + sap.z2ui5.oViewPopover.createId( highlight_config.element );` && |\n| &&
|
||||
` // MAIN view is default` && |\n| &&
|
||||
` default:` && |\n| &&
|
||||
` highlight_config.element = '#' + sap.z2ui5.oView.createId( highlight_config.element );` && |\n| &&
|
||||
`};`.
|
||||
|
||||
r_drive_js = r_drive_js && |\n| &&
|
||||
`for (var key1 of Object.keys(highlight_config)) {` && |\n| &&
|
||||
` if( key1.startsWith('on') ) {` && |\n| &&
|
||||
` highlight_config[key1] = new Function( highlight_config[key1] );` && |\n| &&
|
||||
` };` && |\n| &&
|
||||
`};` && |\n|.
|
||||
|
||||
r_drive_js = r_drive_js && |\n| &&
|
||||
`for (var key1 of Object.keys(highlight_config.popover)) {` && |\n| &&
|
||||
` if( key1.startsWith('on') ) {` && |\n| &&
|
||||
` highlight_config.popover[key1] = new Function( highlight_config.popover[key1] );` && |\n| &&
|
||||
` };` && |\n| &&
|
||||
`};` && |\n|.
|
||||
|
||||
r_drive_js = r_drive_js && |\n| &&
|
||||
`for (key1 of Object.keys(highlight_driver_config)) {` && |\n| &&
|
||||
` if( key.startsWith('on') ) {` && |\n| &&
|
||||
` highlight_driver_config[key] = new Function( highlight_driver_config[key] );` && |\n| &&
|
||||
` };` && |\n| &&
|
||||
`};`.
|
||||
|
||||
ENDIF.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD get_js_local.
|
||||
result = `` && |\n| &&
|
||||
`this.driver=this.driver||{};this.driver.js=function(D){"use strict";let F={};function z(e={}){F={animate:!0,allowClose:!0,overlayOpacity:.7,smoothScroll:!1,disableActiveInteraction:!1,showProgress:!1,stagePadding:10,stageRadius:5,` &&
|
||||
`popoverOffset:10,showButtons:["next","previous","close"],disableButtons:[],overlayColor:"#000",...e}}function a(e){return e?F[e]:F}function W(e,o,t,i){return(e/=i/2)<1?t/2*e*e+o:-t/2*(--e*(e-2)-1)+o}` &&
|
||||
`function q(` &&
|
||||
`e){const o='a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input[type="text"]:not([disabled]), input[type="radio"]:not([disabled]), input[type="checkbox"]:not([disabled]), select:not(` &&
|
||||
`[disabled])';return e.flatMap(t=>{const i=t.matches(o),p=Array.from(t.querySelectorAll(o));return[...i?[t]:[],...p]}).filter(t=>getComputedStyle(t).pointerEvents!=="none"&&ae(t))}function V(e){if(!e||se(e))return;` &&
|
||||
`const o=a(` &&
|
||||
`"smoothScroll");e.scrollIntoView({behavior:!o||re(e)?"auto":"smooth",inline:"center",block:"center"})}function re(e){if(!e||!e.parentElement)return;const o=e.parentElement;return ` &&
|
||||
`o.scrollHeight>o.clientHeight}function se(e){const o=e.getBoundingClientRect();return o.top>=0&&o.left>=0&&o.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&o.right<=(` &&
|
||||
`window.innerWidth||document.documentElement.clientWidth)}function ae(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)}let N={};function b(e,o){N[e]=o}function l(e){return e?N[e]:N}function K(){N={}}let E={};function O(e,o)` &&
|
||||
`{E[e]=o}function _(e){var o;(o=E[e])==null||o.call(E)}function ce(){E={}}function le(e,o,t,i){let p=l("__activeStagePosition");const n=p||t.getBoundingClientRect(),f=i.getBoundingClientRect(),w=W(e,n.x,f.x-n.x,o),r=W(e,n.y,f.y-n.y,o),v=W(e,` &&
|
||||
`n.width,f.width-n.width,o),s=W(e,n.height,f.height-n.height,o);p={x:w,y:r,width:v,height:s},Y(p),b("__activeStagePosition",p)}function X(e){if(!e)return;const o=e.getBoundingClientRect(),t={x:o.x,y:o.y,width:o.width,height:o.height};b(` &&
|
||||
`"__activeStagePosition",t),Y(t)}function de(){const e=l("__activeStagePosition"),o=l("__overlaySvg");if(!e)return;if(!o){console.warn("No stage svg found.");return}const t=window.innerWidth,` &&
|
||||
'i=window.innerHeight;o.setAttribute("viewBox",`0 0 ${t} ${i}`)}function pe(e){const o=ue(e);document.body.appendChild(o),G(o,t=>{t.target.tagName==="path"&&_("overlayClick")}),b("__overlaySvg",o)' &&
|
||||
`}function Y(e){const o=l("__overlaySvg");if(!o){pe(e);return}const t=o.firstElementChild;if((t==null?void 0:t.tagName)!=="path")throw new Error("no path element found in stage svg");t.setAttribute("d",j(e))` &&
|
||||
`}function ue(e){const o=window.innerWidth,t=window.innerHeight,i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.classList.add("driver-overlay","driver-overlay-animated"),i.setAttribute(` &&
|
||||
'"viewBox",`0 0 ${o} ${t}`),i.setAttribute("xmlSpace","preserve"),i.setAttribute("xmlnsXlink","http://www.w3.org/1999/xlink"),i.setAttribute("version","1.1"),i.setAttribute(' &&
|
||||
`"preserveAspectRatio","xMinYMin slice"),i.style.fillRule="evenodd",i.style.clipRule="evenodd",i.style.strokeLinejoin="round",i.style.strokeMiterlimit="2",i.style.zIndex="10000",` &&
|
||||
`i.style.position="fixed",i.style.top="0",i.style.left="0",i.style.width="100%",i.style.height="100%";const p=document.createElementNS("http://www.w3.org/2000/svg","path");return ` &&
|
||||
'p.setAttribute("d",j(e)),p.style.fill=a("overlayColor")||"rgb(0,0,0)",p.style.opacity=`${a("overlayOpacity")}`,p.style.pointerEvents="auto",p.style.cursor="auto",i.appendChild(p),i}' &&
|
||||
`function j(e)` &&
|
||||
'{const o=window.innerWidth,t=window.innerHeight,i=a("stagePadding")||0,p=a("stageRadius")||0,n=e.width+i*2,f=e.height+i*2,w=Math.min(p,n/2,f/2),r=Math.floor(Math.max(w,0)),v=e.x-i+r,s=e.y-i,c=n-r*2,d=f-r*2;return`M${o},0L0,0L0,' &&
|
||||
'${t}L${o},${t}L${o},0ZM${v},${s} h${c} a${r},${r} 0 0 1 ${r},${r} v${d} a${r},${r} 0 0 1 -${r},${r} h-${c} a${r},${r} 0 0 1 -${r},-${r} v-${d} a${r},${r} 0 0 1 ${r},-${r} z`}function ve(){const e=l("__overlaySvg");e&&e.remove()' &&
|
||||
`}function fe(){const e=document.getElementById("driver-dummy-element");if(e)return e;let o=document.createElement("div");return o.id="driver-dummy-element",o.style.width="0",o.style.height="0",` &&
|
||||
`o.style.pointerEvents="none",o.style.opacity="0",o.style.position="fixed",o.style.top="50%",o.style.left="50%",document.body.appendChild(o),o}function Q(e){const{element:o}=e;let t=typeof ` &&
|
||||
`o=="string"?document.querySelector(o):o;t||(t=fe()),ge(t,e)}function he(){const e=l("__activeElement"),o=l("__activeStep");e&&(X(e),de(),oe(e,o))}function ge(e,o){const i=Date.now(),p=l("__activeStep"),` &&
|
||||
`n=l(` &&
|
||||
`"__activeElement")||e,f=!n||n===e,w=e.id==="driver-dummy-element",r=n.id==="driver-dummy-element",v=a("animate"),s=o.onHighlightStarted||a("onHighlightStarted"),c=(o==null?void 0:o.onHighlighted)||a(` &&
|
||||
`"onHighlighted"),d=(p==null?void 0:p.onDeselected)||a("onDeselected"),m=a(),g=l();!f&&d&&d(r?void 0:n,p,{config:m,state:g}),s&&s(w?void 0:e,o,{config:m,state:g});const u=!f&&v;let h=!1;xe(),b(` &&
|
||||
`"previousStep",p),b("previousElement",n),b("activeStep",o),b("activeElement",e);const P=()=>{if(l("__transitionCallback")!==P)return;const x=Date.now()-i,` &&
|
||||
`y=400-x<=400/2;o.popover&&y&&!h&&u&&(J(e,o),h=!0),a("animate")&&x<400?le(x,400,n,e):(X(e),c&&c(w?void 0:e,o,{config:a(),state:l()}),b("__transitionCallback",void 0),b(` &&
|
||||
`"__previousStep",p),b("__previousElement",n),b("__activeStep",o),b("__activeElement",e)),window.requestAnimationFrame(P)};b("__transitionCallback",P),window.requestAnimationFrame(P),V(e),` &&
|
||||
`!u&&o.popover&&J(e,o),n.classList.remove("driver-active-element","driver-no-interaction"),n.removeAttribute("aria-haspopup"),n.removeAttribute("aria-expanded"),n.removeAttribute(` &&
|
||||
`"aria-controls"),a("disableActiveInteraction")&&e.classList.add("driver-no-interaction"),e.classList.add("driver-active-element"),e.setAttribute("aria-haspopup","dialog"),` &&
|
||||
`e.setAttribute(` &&
|
||||
`"aria-expanded","true"),e.setAttribute("aria-controls","driver-popover-content")}function we(){var e;(e=document.getElementById("driver-dummy-element"))==null||e.remove(),document.querySelectorAll(` &&
|
||||
`".driver-active-element").forEach(o=>{o.classList.remove("driver-active-element","driver-no-interaction"),o.removeAttribute("aria-haspopup"),o.removeAttribute("aria-expanded"),o.removeAttribute(` &&
|
||||
`"aria-controls")})}function A(){const e=l("__resizeTimeout");e&&window.cancelAnimationFrame(e),b("__resizeTimeout",window.requestAnimationFrame(he))}function me(e){var r;if(!l("isInitialized")||!(` &&
|
||||
`e.key==="Tab"||e.keyCode===9))return;const i=l("__activeElement"),p=(r=l("popover"))==null?void 0:r.wrapper,n=q([...p?[p]:[],...i?[i]:[]]),f=n[0],w=n[n.length-1];if(e.preventDefault(),e.shiftKey){const v=n[n.indexOf(` &&
|
||||
`document.activeElement)-1]||w;v==null||v.focus()}else{const v=n[n.indexOf(document.activeElement)+1]||f;v==null||v.focus()}}function Z(e){var t;((t=a("allowKeyboardControl"))==null||t)&&(e.key==="Escape"?_(` &&
|
||||
`"escapePress"):e.key==="ArrowRight"?_("arrowRightPress"):e.key==="ArrowLeft"&&_("arrowLeftPress"))}function G(e,o,t){const i=(n,f)=>{const w=n.target;e.contains(w)&&((!t||t(w))` &&
|
||||
`&&(n.preventDefault(),n.stopPropagation(),n.stopImmediatePropagation()),f==null||f(n))};document.addEventListener("pointerdown",i,!0),document.addEventListener("mousedown",i,!0),document.addEventListener("` &&
|
||||
`pointerup",` &&
|
||||
`i,!0),document.addEventListener("mouseup",i,!0),document.addEventListener("click",n=>{i(n,o)},!0)}function ye(){window.addEventListener("keyup",Z,!1),window.addEventListener("keydown",me,!1),` &&
|
||||
`window.addEventListener("resize",A),window.addEventListener("scroll",A)}function be(){window.removeEventListener("keyup",Z),window.removeEventListener("resize",A),window.removeEventListener("scroll",` &&
|
||||
`A)` &&
|
||||
`}function xe(){const e=l("popover");e&&(e.wrapper.style.display="none")}function J(e,o){var C,y;let t=l("popover");t&&document.body.removeChild(t.wrapper),t=Pe(),document.body.appendChild(t.wrapper)` &&
|
||||
`;const{title:i,description:p,showButtons:n,disableButtons:f,showProgress:w,nextBtnText:r=a("nextBtnText")||"Next &rarr;",prevBtnText:v=a("prevBtnText")||"&larr; Previous",progressText:s=a(` &&
|
||||
`"progressText")||"{current} of {total}"}=o.popover||{};t.nextButton.innerHTML=r,t.previousButton.innerHTML=v,t.progress.innerHTML=s,i?(t.title.innerHTML=i,t.title.style.display="block")` &&
|
||||
`:t.title.style.display="none",p?(t.description.innerHTML=p,t.description.style.display="block"):t.description.style.display="none";const c=n||a("showButtons"),` &&
|
||||
`d=w||a("showProgress")||!1,m=(c==null?void ` &&
|
||||
`0:c.includes("next"))||(c==null?void 0:c.includes("previous"))||d;t.closeButton.style.display=c.includes("close")?"block":"none",m?(t.footer.style.display="flex",` &&
|
||||
`t.progress.style.display=d?"block":"none",t.nextButton.style.display=c.includes("next")?"block":"none"` &&
|
||||
`,t.previousButton.style.display=c.includes("previous")?"block":"none")` &&
|
||||
`:t.footer.style.display="none";const g=f||a("disableButtons")||[];g!=null&&g.includes("next")&&(t.nextButton.disabled=!0,t.nextButton.classList.add("driver-popover-btn-disabled")),` &&
|
||||
`g!=null&&g.includes("previous")&&(t.previousButton.disabled=!0,t.previousButton.classList.add("driver-popover-btn-disabled")),g!=null&&g.includes("close")&&(t.closeButton.disabled=!0,` &&
|
||||
`t.closeButton.classList.add("driver-popover-btn-disabled"));const u=t.wrapper;u.style.display="block",u.style.left="",u.style.top="",u.style.bottom="",u.style.right="",` &&
|
||||
`u.id="driver-popover-content",u.setAttribute("role","dialog"),u.setAttribute("aria-labelledby","driver-popover-title"),u.setAttribute("aria-describedby"` &&
|
||||
`,"driver-popover-description")` &&
|
||||
';const h=t.arrow;h.className="driver-popover-arrow";const P=((C=o.popover)==null?void 0:C.popoverClass)||a("popoverClass")||"";u.className=`driver-popover ${P}`.trim(),G(t.wrapper,k=>{var M,R,I;const T=k.target,H=((' &&
|
||||
`M=o.popover)==null?void 0:M.onNextClick)||a("onNextClick"),$=((R=o.popover)==null?void 0:R.onPrevClick)||a("onPrevClick"),B=((I=o.popover)==null?void 0:I.onCloseClick)||a("onCloseClick");if(T.classList.contains(` &&
|
||||
`"driver-popover-next-btn"))return H?H(e,o,{config:a(),state:l()}):_("nextClick");if(T.classList.contains("driver-popover-prev-btn"))return $?$(e,o,{config:a(),state:l()}):_("prevClick");if(T.classList.contains(` &&
|
||||
`"driver-popover-close-btn"))return B?B(e,o,{config:a(),state:l()}):_("closeClick")},k=>!(t!=null&&t.description.contains(k))&&!(t!=null&&t.title.contains(k))&&typeof ` &&
|
||||
`k.className=="string"&&k.className.includes("driver-popover")),b("popover",t);const S=((y=o.popover)==null?void 0:y.onPopoverRender)||a("onPopoverRender");S&&` &&
|
||||
`S(t,{config:a(),state:l()}),oe(e,o),V(u)` &&
|
||||
`;const L=e.classList.contains("driver-dummy-element"),x=q([u,...L?[]:[e]]);x.length>0&&x[0].focus()}function U(){const e=l("popover");if(!(e!=null&&e.wrapper))return;const o=e.wrapper.getBoundingClientRect(),` &&
|
||||
`t=a(` &&
|
||||
`"stagePadding")||0,i=a("popoverOffset")||0;return{width:o.width+t+i,height:o.height+t+i,realWidth:o.width,realHeight:o.height}}function ee(e,o){const{elementDimensions:t,popoverDimensions:i,popoverPadding:p,` &&
|
||||
`popoverArrowDimensions:n}=o;return e==="start"?Math.max(Math.min(t.top-p,window.innerHeight-i.realHeight-n.width),n.width):e==="end"?Math.max(Math.min(t.top-(i==null?void 0:i.realHeight)+t.height+p,window.innerHeight-(i==null?void`
|
||||
&&
|
||||
`0:i.realHeight)-n.width),n.width):e==="center"?Math.max(Math.min(t.top+t.height/2-(i==null?void 0:i.realHeight)/2,window.innerHeight-(i==null?void 0:i.realHeight)-n.width),n.width):0}function te(e,o){const{elementDimensions:t,` &&
|
||||
`popoverDimensions:i,popoverPadding:p,popoverArrowDimensions:n}=o;return e==="start"?Math.max(Math.min(t.left-p,window.innerWidth-i.realWidth-n.width),n.width):e==="end"` &&
|
||||
`?Math.max(Math.min(t.left-(i==null?void 0:i.realWidth)+t.width+p,` &&
|
||||
`window.innerWidth-(i==null?void 0:i.realWidth)-n.width),n.width):e==="center"?Math.max(Math.min(t.left+t.width/2-(i==null?void 0:i.realWidth)/2,window.innerWidth-(i==null?void 0:i.realWidth)-n.width),n.width):0}function oe(e,o){const t=l(` &&
|
||||
`"popover");if(!t)return;const{align:i="start",side:p="left"}=(o==null?void 0:o.popover)||{},n=i,f=e.id==="driver-dummy-element"?"over":p,w=a("stagePadding")||0,r=U(),` &&
|
||||
`v=t.arrow.getBoundingClientRect(),s=e.getBoundingClientRect(),c=s.top-r.height;let d=c>=0;const m=window.innerHeight-(s.bottom+r.height);let g=m>=0;const u=s.left-r.width;let h=u>=0;const P=window.innerWidth-(s.right+r.width);let ` &&
|
||||
`S=P>=0;const L=!d&&!g&&!h&&!S;let x=f;if(f==="top"&&d?S=h=g=!1:f==="bottom"&&g?S=h=d=!1:f==="left"&&h?S=d=g=!1:f==="right"&&S&&(h=d=g=!1),` &&
|
||||
'f==="over"){const C=window.innerWidth/2-r.realWidth/2,y=window.innerHeight/2-r.realHeight/2;t.wrapper.style.left=`${C}px`,t.wrapper.style.right="auto",t.wrapper.style.top=`${y}px`,t.wrapper.style.bottom="auto"}else if(L)' &&
|
||||
'{const C=window.innerWidth/2-(r==null?void 0:r.realWidth)/2,y=10;t.wrapper.style.left=`${C}px`,t.wrapper.style.right="auto",t.wrapper.style.bottom=`${y}px`,t.wrapper.style.top="auto"' &&
|
||||
`}else if(h){const C=Math.min(u,window.innerWidth-(` &&
|
||||
'r==null?void 0:r.realWidth)-v.width),y=ee(n,{elementDimensions:s,popoverDimensions:r,popoverPadding:w,popoverArrowDimensions:v});t.wrapper.style.left=`${C}px`,t.wrapper.style.top=`${y}px`,t.wrapper.style.bottom="auto",' &&
|
||||
`t.wrapper.style.right="auto",x="left"}else if(S){const C=Math.min(P,window.innerWidth-(r==null?void 0:r.realWidth)-v.width),y=ee(n,{elementDimensions:s,popoverDimensions:r,popoverPadding:w,popoverArrowDimensions:v})` &&
|
||||
';t.wrapper.style.right=`${C}px`,t.wrapper.style.top=`${y}px`,t.wrapper.style.bottom="auto",t.wrapper.style.left="auto",x="right"}else if(d){const C=Math.min(c,window.innerHeight-r.realHeight-v.width);let y=te(n,' &&
|
||||
'{elementDimensions:s,popoverDimensions:r,popoverPadding:w,popoverArrowDimensions:v});t.wrapper.style.top=`${C}px`,t.wrapper.style.left=`${y}px`,t.wrapper.style.bottom="auto",t.wrapper.style.right="auto",x="top"' &&
|
||||
`}else if(g)` &&
|
||||
'{const C=Math.min(m,window.innerHeight-(r==null?void 0:r.realHeight)-v.width);let y=te(n,{elementDimensions:s,popoverDimensions:r,popoverPadding:w,popoverArrowDimensions:v});t.wrapper.style.left=`${y}px`,t.wrapper.style.bottom=`${C}px`,' &&
|
||||
`t.wrapper.style.top="auto",t.wrapper.style.right="auto",x="bottom"}L?t.arrow.classList.add("driver-popover-arrow-none"):Ce(n,x,e)}function Ce(e,o,t){const i=l("popover");if(!i)return;const ` &&
|
||||
`p=t.getBoundingClientRect(),n=U(),f=i.arrow,w=n.width,r=window.innerWidth,v=p.width,s=p.left,c=n.height,d=window.innerHeight,m=p.top,g=p.height;f.className="driver-popover-arrow";let u=o,h=e;o==="top"?(s+v<=0?(u="` &&
|
||||
`right",` &&
|
||||
`h="end"):s+v-w<=0&&(u="top",h="start"),s>=r?(u="left",h="end"):s+w>=r&&(u="top",h="end")):o==="bottom"?(s+v<=0?(u="right",` &&
|
||||
`h="start"):s+v-w<=0&&(u="bottom",h="start"),s>=r?(u="left",h="start"):s+w>=r&&(u="bottom",h="end")):o==="left"?(m+g<=0?(u="bottom",` &&
|
||||
`h="end"):m+g-c<=0&&(u="left",h="start"),m>=d?(u="top",h="end"):m+c>=d&&(u="left",h="end")):o==="right"&&(m+g<=0?(u="bottom",` &&
|
||||
'h="start"):m+g-c<=0&&(u="right",h="start"),m>=d?(u="top",h="start"):m+c>=d&&(u="right",h="end")),u?(f.classList.add(`driver-popover-arrow-side-${u}`),' &&
|
||||
'f.classList.add(`driver-popover-arrow-align-${h}`)):f.classList.add("driver-popover-arrow-none")}function Pe(){const e=document.createElement("div");e.classList.add("driver-popover");const o=document.createElement(' &&
|
||||
`"div");o.classList.add("driver-popover-arrow");const t=document.createElement("header");t.id="driver-popover-title",t.classList.add("driver-popover-title"),t.style.display="none",` &&
|
||||
`t.innerText="Popover Title";const i=document.createElement("div");i.id="driver-popover-description",i.classList.add("driver-popover-description"),i.style.display="none",i.innerText="Popover ` &&
|
||||
`description is here";const p=document.createElement("button");p.type="button",p.classList.add("driver-popover-close-btn"),p.setAttribute("aria-label","Close"),` &&
|
||||
`p.innerHTML="&times;";const n=document.createElement("footer");n.classList.add("driver-popover-footer");const f=document.createElement("span");f.classList.add("driver-popover-progress-text"),` &&
|
||||
`f.innerText="";const w=document.createElement("span");w.classList.add("driver-popover-navigation-btns");const r=document.createElement("button");r.type="button",r.classList.add(` &&
|
||||
`"driver-popover-prev-btn"),r.innerHTML="&larr; Previous";const v=document.createElement("button");return v.type="button",v.classList.add("driver-popover-next-btn"),v.innerHTML="Next ` &&
|
||||
`&rarr;",w.appendChild(r),w.appendChild(v),n.appendChild(f),n.appendChild(w),e.appendChild(p),e.appendChild(o),e.appendChild(t),e.appendChild(i),e.appendChild(n),{wrapper:e,arrow:o,title:t,description:i,footer:n,previousButton:r,nextButton:v,` &&
|
||||
`closeButton:p,footerButtons:w,progress:f}}function Se(){var o;const e=l("popover");e&&((o=e.wrapper.parentElement)==null||o.removeChild(e.wrapper))}const Le="";function ke(e={}){z(e);function o(){a("allowClose")` &&
|
||||
`&&v()}function t(){const s=l("activeIndex"),c=a("steps")||[];if(typeof s=="undefined")return;const d=s+1;c[d]?r(d):v()}function i(){const s=l("activeIndex"),c=a("steps")||[];if(typeof ` &&
|
||||
`s=="undefined")return;const d=s-1;c[d]?r(d):v()}function p(s){(a("steps")||[])[s]?r(s):v()}function n(){var h;if(l("__transitionCallback"))return;const c=l("activeIndex"),d=l("__activeStep"),m=l(` &&
|
||||
`"__activeElement");if(typeof c=="undefined"||typeof d=="undefined"||typeof l("activeIndex")=="undefined")return;const u=((h=d.popover)==null?void 0:h.onPrevClick)||a("onPrevClick");` &&
|
||||
`if(u)return ` &&
|
||||
`u(m,d,{config:a(),state:l()});i()}function f(){var u;if(l("__transitionCallback"))return;const c=l("activeIndex"),d=l("__activeStep"),m=l("__activeElement");if(typeof c=="undefined"||typeof ` &&
|
||||
`d=="undefined")return;const g=((u=d.popover)==null?void 0:u.onNextClick)||a("onNextClick");if(g)return g(m,d,{config:a(),state:l()});t()}function w(){l("isInitialized")||(b("isInitialized",!0),` &&
|
||||
`document.body.classList.add("driver-active",a("animate")?"driver-fade":"driver-simple"),ye(),O("overlayClick",o),O("escapePress",o),O("arrowLeftPress",n),` &&
|
||||
`O("arrowRightPress",` &&
|
||||
`f))}function r(s=0){var H,$,B,M,R,I,ie,ne;const c=a("steps");if(!c){console.error("No steps to drive through"),v();return}if(!c[s]){v();return}b("__activeOnDestroyed",document.activeElement),b("activeIndex",s)` &&
|
||||
`;const d=c[s],m=c[s+1],g=c[s-1],u=((H=d.popover)==null?void 0:H.doneBtnText)||a("doneBtnText")||"Done",h=a("allowClose"),P=typeof(($=d.popover)==null?void 0:$.showProgress)!="undefined"` &&
|
||||
`?(B=d.popover)==null?void ` &&
|
||||
'0:B.showProgress:a("showProgress"),L=(((M=d.popover)==null?void 0:M.progressText)||a("progressText")||"{{current}} of {{total}}").replace("{{current}}",`${s+1}`).replace("' &&
|
||||
'{{total}}",`${c.length}`),x=((' &&
|
||||
`R=d.popover)==null?void 0:R.showButtons)||a("showButtons"),C=["next","previous",...h?["close"]:[]].filter(_e=>!(x!=null&&x.length)||x.includes(_e)),y=((I=d.popover)==null?void 0:I.onNextClick)||a(` &&
|
||||
`"onNextClick"),k=((ie=d.popover)==null?void 0:ie.onPrevClick)||a("onPrevClick"),T=((ne=d.popover)==null?void 0:ne.onCloseClick)||a("onCloseClick");Q({...d,popover:{showButtons:C,nextBtnText:m?void 0:u,` &&
|
||||
`disableButtons:[...g?[]:["previous"]],showProgress:P,progressText:L,onNextClick:y||(()=>{m?r(s+1):v()}),onPrevClick:k||(()=>{r(s-1)}),onCloseClick:T||(()=>{v()}),...(d==null?void 0:d.popover)||{}}})}function v(s=!0){const c=l(` &&
|
||||
`"__activeElement"),d=l("__activeStep"),m=l("__activeOnDestroyed"),g=a("onDestroyStarted");if(s&&g){const P=!c||(c==null?void 0:c.id)==="driver-dummy-element";g(P?void 0:c,d,` &&
|
||||
`{config:a(),state:l()})` &&
|
||||
`;return}const u=(d==null?void 0:d.onDeselected)||a("onDeselected"),h=a("onDestroyed");if(document.body.classList.remove("driver-active","driver-fade","driver-simple"),be(),Se(),we(),ve(),ce(),K(),` &&
|
||||
`c&&d){const P=c.id==="driver-dummy-element";u&&u(P?void 0:c,d,{config:a(),state:l()}),h&&h(P?void 0:c,d,{config:a(),state:l()})}m&&m.focus()}return{isActive:()=>l("isInitialized")||!1,refresh:A,` &&
|
||||
`drive:(s=0)=>{w(),r(s)},setConfig:z,setSteps:s=>{K(),z({...a(),steps:s})},getConfig:a,getState:l,getActiveIndex:()=>l("activeIndex"),isFirstStep:()=>l("activeIndex")===0,isLastStep:()=>{` &&
|
||||
`const s=a("steps")||[],` &&
|
||||
`c=l("activeIndex");return c!==void 0&&c===s.length-1},getActiveStep:()=>l("activeStep"),getActiveElement:()=>l("activeElement"),getPreviousElement:()=>l("previousElement"),` &&
|
||||
`getPreviousStep:()=>l(` &&
|
||||
`"previousStep"),moveNext:t,movePrevious:i,moveTo:p,hasNextStep:()=>{const s=a("steps")||[],c=l("activeIndex");return c!==void 0&&s[c+1]},hasPreviousStep:()=>{const s=a("steps")||[],c=l(` &&
|
||||
`"activeIndex");return c!==void 0&&s[c-1]},highlight:s=>{w(),Q({...s,popover:s.popover?{showButtons:[],showProgress:!1,progressText:"",...s.popover}:void 0})},destroy:()=>{v(!1)}}}return ` &&
|
||||
`D.driver=ke,Object.defineProperty(` &&
|
||||
`D,Symbol.toStringTag,{value:"Module"}),D}({});`.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD z2ui5_if_ajson_filter~keep_node.
|
||||
|
||||
rv_keep = abap_true.
|
||||
|
||||
CASE iv_visit.
|
||||
|
||||
WHEN z2ui5_if_ajson_filter=>visit_type-open.
|
||||
|
||||
IF is_node-children = 0.
|
||||
rv_keep = abap_false.
|
||||
ENDIF.
|
||||
|
||||
WHEN z2ui5_if_ajson_filter=>visit_type-value.
|
||||
|
||||
CASE is_node-type.
|
||||
WHEN z2ui5_if_ajson_types=>node_type-boolean.
|
||||
IF is_node-value = `false`.
|
||||
rv_keep = abap_false.
|
||||
ENDIF.
|
||||
WHEN z2ui5_if_ajson_types=>node_type-number.
|
||||
IF is_node-value = `0` OR is_node-value = `0.00`.
|
||||
rv_keep = abap_false.
|
||||
ENDIF.
|
||||
WHEN z2ui5_if_ajson_types=>node_type-string.
|
||||
IF is_node-value = ``.
|
||||
rv_keep = abap_false.
|
||||
ENDIF.
|
||||
ENDCASE.
|
||||
|
||||
WHEN z2ui5_if_ajson_filter=>visit_type-close.
|
||||
|
||||
IF is_node-children = 0.
|
||||
rv_keep = abap_false.
|
||||
ENDIF.
|
||||
|
||||
ENDCASE.
|
||||
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
|
@ -1,16 +0,0 @@
|
|||
<?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_CC_DRIVER_JS</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>driverjs - product tours, highlights, contextual help & more</DESCRIPT>
|
||||
<STATE>1</STATE>
|
||||
<CLSCCINCL>X</CLSCCINCL>
|
||||
<FIXPT>X</FIXPT>
|
||||
<UNICODE>X</UNICODE>
|
||||
</VSEOCLASS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
|
@ -1,104 +0,0 @@
|
|||
CLASS z2ui5_cl_cc_font_awesome DEFINITION
|
||||
PUBLIC
|
||||
FINAL
|
||||
CREATE PUBLIC .
|
||||
|
||||
PUBLIC SECTION.
|
||||
|
||||
CLASS-METHODS get_js_icon
|
||||
IMPORTING
|
||||
!i_font_uri TYPE clike
|
||||
RETURNING
|
||||
VALUE(r_js) TYPE string .
|
||||
|
||||
PROTECTED SECTION.
|
||||
PRIVATE SECTION.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
|
||||
CLASS z2ui5_cl_cc_font_awesome IMPLEMENTATION.
|
||||
|
||||
METHOD get_js_icon.
|
||||
|
||||
r_js = `` && |\n| &&
|
||||
* `const metadataURI = "` && metadata_uri && `";` && |\n| &&
|
||||
* `const oFontMetadata = ` && lcl_metadata=>get_fonts_metadata( ) && |\n| &&
|
||||
* `const oFontBrandsMetadata = ` && lcl_metadata=>get_brands_fonts_metadata( ) && |\n| &&
|
||||
`const oFonts = [{` && |\n| &&
|
||||
` fontFamily: 'fa-regular-400',` && |\n| &&
|
||||
` collectionName: 'fa-regular'` && |\n| &&
|
||||
* ` metadata: ` && lcl_metadata=>get_fonts_metadata( ) && |\n| &&
|
||||
* ` metadata: oFontMetadata,` && |\n| &&
|
||||
* ` fontURI: "` && font_uri && `"` && |\n| &&
|
||||
* ` lazy: true` && |\n| &&
|
||||
` }, {` && |\n| &&
|
||||
` fontFamily: 'fa-duotone-900',` && |\n| &&
|
||||
` collectionName: 'fa-duotone'` && |\n| &&
|
||||
* ` metadata: ` && lcl_metadata=>get_fonts_metadata( ) && |\n| &&
|
||||
* ` metadata: oFontMetadata` && |\n| &&
|
||||
* ` fontURI: "` && font_uri && `"` && |\n| &&
|
||||
* ` lazy: true` && |\n| &&
|
||||
` }, {` && |\n| &&
|
||||
` fontFamily: 'fa-light-300',` && |\n| &&
|
||||
` collectionName: 'fa-light'` && |\n| &&
|
||||
* ` metadata: ` && lcl_metadata=>get_fonts_metadata( ) && |\n| &&
|
||||
* ` metadata: oFontMetadata` && |\n| &&
|
||||
* ` fontURI: "` && font_uri && `"` && |\n| &&
|
||||
* ` lazy: true` && |\n| &&
|
||||
` }, {` && |\n| &&
|
||||
` fontFamily: 'fa-solid-900',` && |\n| &&
|
||||
` collectionName: 'fa-solid'` && |\n| &&
|
||||
* ` metadata: ` && lcl_metadata=>get_fonts_metadata( ) && |\n| &&
|
||||
* ` metadata: oFontMetadata` && |\n| &&
|
||||
* ` fontURI: "` && font_uri && `"` && |\n| &&
|
||||
* ` lazy: true` && |\n| &&
|
||||
` }, {` && |\n| &&
|
||||
` fontFamily: 'fa-thin-100',` && |\n| &&
|
||||
` collectionName: 'fa-thin'` && |\n| &&
|
||||
* ` metadata: ` && lcl_metadata=>get_fonts_metadata( ) && |\n| &&
|
||||
* ` metadata: oFontMetadata` && |\n| &&
|
||||
* ` fontURI: "` && font_uri && `"` && |\n| &&
|
||||
* ` lazy: true` && |\n| &&
|
||||
` }, {` && |\n| &&
|
||||
` fontFamily: 'fa-brands-400',` && |\n| &&
|
||||
` collectionName: 'fa-brands'` && |\n| &&
|
||||
* ` metadata: ` && lcl_metadata=>get_brands_fonts_metadata( ) && |\n| &&
|
||||
* ` metadata: oFontBrandsMetadata,` && |\n| &&
|
||||
* ` fontURI: "` && font_uri && `"` && |\n| &&
|
||||
* ` lazy: true` && |\n| &&
|
||||
` }, {` && |\n| &&
|
||||
` fontFamily: 'fa-sharp-solid-900',` && |\n| &&
|
||||
` collectionName: 'fa-sharp-solid'` && |\n| &&
|
||||
* ` metadata: ` && lcl_metadata=>get_fonts_metadata( ) && |\n| &&
|
||||
* ` metadata: oFontMetadata` && |\n| &&
|
||||
* ` fontURI: "` && font_uri && `"` && |\n| &&
|
||||
* ` lazy: true` && |\n| &&
|
||||
` }, {` && |\n| &&
|
||||
` fontFamily: 'fa-sharp-regular-400',` && |\n| &&
|
||||
` collectionName: 'fa-sharp-regular'` && |\n| &&
|
||||
* ` metadata: ` && lcl_metadata=>get_fonts_metadata( ) && |\n| &&
|
||||
* ` metadata: oFontMetadata` && |\n| &&
|
||||
* ` fontURI: "` && font_uri && `"` && |\n| &&
|
||||
* ` lazy: true` && |\n| &&
|
||||
` }, {` && |\n| &&
|
||||
` fontFamily: 'fa-sharp-light-300',` && |\n| &&
|
||||
` collectionName: 'fa-sharp-light'` && |\n| &&
|
||||
* ` metadata: ` && lcl_metadata=>get_fonts_metadata( ) && |\n| &&
|
||||
* ` metadata: oFontMetadata` && |\n| &&
|
||||
* ` fontURI: "` && font_uri && `"` && |\n| &&
|
||||
* ` lazy: true` && |\n| &&
|
||||
`}]` && |\n| &&
|
||||
* `oFonts.forEach(oFont => {` && |\n| &&
|
||||
* ` sap.ui.core.IconPool.registerFont(oFont);` && |\n| &&
|
||||
* `});`.
|
||||
`oFonts.forEach(function(font) {` && |\n| &&
|
||||
` sap.ui.core.IconPool.registerFont(jQuery.extend({}, font, {` && |\n| &&
|
||||
` fontURI: "` && i_font_uri && `",` && |\n| &&
|
||||
` lazy: true` && |\n| &&
|
||||
` }))` && |\n| &&
|
||||
`})`.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
|
@ -1,16 +0,0 @@
|
|||
<?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_CC_FONT_AWESOME</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>font awsome icons library</DESCRIPT>
|
||||
<STATE>1</STATE>
|
||||
<CLSCCINCL>X</CLSCCINCL>
|
||||
<FIXPT>X</FIXPT>
|
||||
<UNICODE>X</UNICODE>
|
||||
</VSEOCLASS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
File diff suppressed because it is too large
Load Diff
|
@ -1,16 +0,0 @@
|
|||
<?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_CC_IMAGEMAPSTER</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>imagemapster</DESCRIPT>
|
||||
<STATE>1</STATE>
|
||||
<CLSCCINCL>X</CLSCCINCL>
|
||||
<FIXPT>X</FIXPT>
|
||||
<UNICODE>X</UNICODE>
|
||||
</VSEOCLASS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
|
@ -1,111 +0,0 @@
|
|||
class Z2UI5_CL_CC_MESSAGE_M definition
|
||||
public
|
||||
final
|
||||
create public .
|
||||
|
||||
public section.
|
||||
|
||||
types:
|
||||
BEGIN OF ty_s_item,
|
||||
message TYPE string,
|
||||
description TYPE string,
|
||||
type TYPE string,
|
||||
target TYPE string,
|
||||
additionaltext TYPE string,
|
||||
date TYPE string,
|
||||
descriptionurl TYPE string,
|
||||
persistent TYPE string,
|
||||
END OF ty_s_item .
|
||||
|
||||
types ty_t_items TYPE STANDARD TABLE OF ty_s_item WITH EMPTY KEY ##NEEDED.
|
||||
|
||||
class-methods GET_JS
|
||||
returning
|
||||
value(RESULT) type STRING .
|
||||
PROTECTED SECTION.
|
||||
PRIVATE SECTION.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
|
||||
CLASS Z2UI5_CL_CC_MESSAGE_M IMPLEMENTATION.
|
||||
|
||||
|
||||
METHOD GET_JS.
|
||||
|
||||
result = `` && |\n| &&
|
||||
`sap.ui.define("z2ui5/MessageManager", [` && |\n| &&
|
||||
` "sap/ui/core/Control",` && |\n| &&
|
||||
`], function (Control) {` && |\n| &&
|
||||
` "use strict";` && |\n| &&
|
||||
|\n| &&
|
||||
` return Control.extend("z2ui5.MessageManager", {` && |\n| &&
|
||||
` metadata: {` && |\n| &&
|
||||
` properties: {` && |\n| &&
|
||||
` items: { type: "Array" }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` init() {` && |\n| &&
|
||||
` if (!sap.z2ui5.oMessageManager){` && |\n| &&
|
||||
` sap.z2ui5.oMessageManager = {};` && |\n| &&
|
||||
` sap.z2ui5.oMessageManager = new sap.ui.core.message.MessageManager();` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
|\n| &&
|
||||
` Messaging2Model( ){` && |\n| &&
|
||||
` var oData = sap.z2ui5.oMessageManager.getMessageModel().getData();` && |\n| &&
|
||||
` var Model = [];` && |\n| &&
|
||||
` oData.forEach(element => {` && |\n| &&
|
||||
` Model.push( { ` && |\n| &&
|
||||
` MESSAGE : element.message , ` && |\n| &&
|
||||
` DESCRIPTION : element.description , ` && |\n| &&
|
||||
` TYPE : element.type, ` && |\n| &&
|
||||
` TARGET : element.aTargets[0] , ` && |\n| &&
|
||||
` ADDITIONALTEXT : element.additionalText , ` && |\n| &&
|
||||
` DATE : element.date , ` && |\n| &&
|
||||
` DESCRIPTIONURL : element.descriptionUrl, ` && |\n| &&
|
||||
` PERSISTENT : element.persistent } );` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` this.setProperty("items", Model, true );` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
|\n| &&
|
||||
` Model2Messaging( ){` && |\n| &&
|
||||
* ` debugger;` && |\n| &&
|
||||
` var Model = this.getProperty("items");` && |\n| &&
|
||||
` if(!Model) { return; }` && |\n| &&
|
||||
|\n| &&
|
||||
` Model.forEach(element => {` && |\n| &&
|
||||
` var target = element.TARGET.split("--")[1];` && |\n| &&
|
||||
` if ( target == undefined ) { target = element.TARGET }` && |\n| &&
|
||||
` var oMessage = new sap.ui.core.message.Message({` && |\n| &&
|
||||
` message: element.MESSAGE,` && |\n| &&
|
||||
` description: element.DESCRIPTION,` && |\n| &&
|
||||
` type: element.TYPE,` && |\n| &&
|
||||
` target : sap.z2ui5.oView.getId( 'testINPUT' ) + '--' + target,` && |\n| &&
|
||||
` additionalText : element.ADDITIONALTEXT , ` && |\n| &&
|
||||
` date : element.DATE , ` && |\n| &&
|
||||
` descriptionUrl : element.DESCRIPTIONURL, ` && |\n| &&
|
||||
` persistent : element.PERSISTENT,` && |\n| &&
|
||||
` processor : this.oMessageProcessor` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` sap.z2ui5.oMessageManager.addMessages(oMessage) ;` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
|\n| &&
|
||||
` renderer(oRm, oControl) {` && |\n| &&
|
||||
` if(oControl.isInitialized) { return; }` && |\n| &&
|
||||
` debugger;` && |\n| &&
|
||||
` var resBinding = new sap.ui.model.ListBinding(sap.z2ui5.oMessageManager.getMessageModel(), "/" );` && |\n| &&
|
||||
` resBinding.attachChange(oControl.Messaging2Model.bind(oControl));` && |\n| &&
|
||||
` sap.z2ui5.oMessageManager.registerObject(sap.z2ui5.oView, true);` && |\n| &&
|
||||
` oControl.isInitialized = true;` && |\n| &&
|
||||
* ` setTimeout( (oControl) => { ` && |\n| &&
|
||||
* ` ` && |\n| &&
|
||||
* ` ` && |\n| &&
|
||||
* ` }, 50 , oControl );` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
`});`.
|
||||
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
|
@ -1,16 +0,0 @@
|
|||
<?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_CC_MESSAGE_M</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>UI5 Message Manager Control</DESCRIPT>
|
||||
<STATE>1</STATE>
|
||||
<CLSCCINCL>X</CLSCCINCL>
|
||||
<FIXPT>X</FIXPT>
|
||||
<UNICODE>X</UNICODE>
|
||||
</VSEOCLASS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
|
@ -1,116 +0,0 @@
|
|||
CLASS z2ui5_cl_cc_messaging DEFINITION
|
||||
PUBLIC
|
||||
FINAL
|
||||
CREATE PUBLIC .
|
||||
|
||||
PUBLIC SECTION.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_s_item,
|
||||
message TYPE string,
|
||||
description TYPE string,
|
||||
type TYPE string,
|
||||
target TYPE string,
|
||||
additionaltext TYPE string,
|
||||
date TYPE string,
|
||||
descriptionurl TYPE string,
|
||||
persistent TYPE string,
|
||||
END OF ty_s_item .
|
||||
TYPES ty_t_items TYPE STANDARD TABLE OF ty_s_item WITH EMPTY KEY ##NEEDED.
|
||||
|
||||
CLASS-METHODS get_js
|
||||
RETURNING
|
||||
VALUE(result) TYPE string .
|
||||
PROTECTED SECTION.
|
||||
PRIVATE SECTION.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
|
||||
CLASS Z2UI5_CL_CC_MESSAGING IMPLEMENTATION.
|
||||
|
||||
|
||||
METHOD get_js.
|
||||
|
||||
result = `try { ` && |\n| &&
|
||||
`sap.ui.define("z2ui5/Messaging",[` && |\n| &&
|
||||
` "sap/ui/core/Control",` && |\n| &&
|
||||
` "sap/ui/core/Messaging",` && |\n| &&
|
||||
`], (Control, Messaging) => {` && |\n| &&
|
||||
` "use strict";` && |\n| &&
|
||||
|\n| &&
|
||||
` return Control.extend("z2ui5.Messaging", {` && |\n| &&
|
||||
` metadata: {` && |\n| &&
|
||||
` properties: {` && |\n| &&
|
||||
` items: { type: "Array" }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` init() {` && |\n| &&
|
||||
` if (!sap.z2ui5.oMessaging){` && |\n| &&
|
||||
` sap.z2ui5.oMessaging = {};` && |\n| &&
|
||||
` sap.z2ui5.oMessaging.oMessageProcessor = new sap.ui.core.message.ControlMessageProcessor();` && |\n| &&
|
||||
` sap.z2ui5.oMessaging.oMessageManager = sap.ui.getCore().getMessageManager();` && |\n| &&
|
||||
` sap.z2ui5.oMessaging.oMessageManager = Messaging;` && |\n| &&
|
||||
` sap.z2ui5.oMessaging.oMessageManager.registerMessageProcessor(sap.z2ui5.oMessaging.oMessageProcessor);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
|\n| &&
|
||||
` onModelChange(oEvent) {` && |\n| &&
|
||||
` this.Messaging2Model();` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
|\n| &&
|
||||
` Messaging2Model( ){` && |\n| &&
|
||||
` var oData = Messaging.getMessageModel().getData();` && |\n| &&
|
||||
` var Model = [];` && |\n| &&
|
||||
` oData.forEach(element => {` && |\n| &&
|
||||
` Model.push( { ` && |\n| &&
|
||||
` MESSAGE : element.message , ` && |\n| &&
|
||||
` DESCRIPTION : element.description , ` && |\n| &&
|
||||
` TYPE : element.type, ` && |\n| &&
|
||||
` TARGET : element.aTargets[0] , ` && |\n| &&
|
||||
` ADDITIONALTEXT : element.additionalText , ` && |\n| &&
|
||||
` DATE : element.date , ` && |\n| &&
|
||||
` DESCRIPTIONURL : element.descriptionUrl, ` && |\n| &&
|
||||
` PERSISTENT : element.persistent } );` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` this.setProperty("items", Model, true );` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
|\n| &&
|
||||
` Model2Messaging( ){` && |\n| &&
|
||||
` var Model = this.getProperty("items");` && |\n| &&
|
||||
` if(!Model) { return; }` && |\n| &&
|
||||
|\n| &&
|
||||
` Model.forEach(element => {` && |\n| &&
|
||||
` var target = element.TARGET.split("--")[1];` && |\n| &&
|
||||
` if ( target == undefined ) { target = element.TARGET }` && |\n| &&
|
||||
` var oMessage = new sap.ui.core.message.Message({` && |\n| &&
|
||||
` message: element.MESSAGE,` && |\n| &&
|
||||
` description: element.DESCRIPTION,` && |\n| &&
|
||||
` type: element.TYPE,` && |\n| &&
|
||||
` target : sap.z2ui5.oView.getId( 'testINPUT' ) + '--' + target,` && |\n| &&
|
||||
` additionalText : element.ADDITIONALTEXT , ` && |\n| &&
|
||||
` date : element.DATE , ` && |\n| &&
|
||||
` descriptionUrl : element.DESCRIPTIONURL, ` && |\n| &&
|
||||
` persistent : element.PERSISTENT,` && |\n| &&
|
||||
` processor : this.oMessageProcessor` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` Messaging.addMessages(oMessage) ;` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` var resBinding = new sap.ui.model.ListBinding(Messaging.getMessageModel(), "/" );` && |\n| &&
|
||||
` resBinding.attachChange(this.onModelChange.bind(this));` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
|\n| &&
|
||||
` renderer(oRm, oControl) {` && |\n| &&
|
||||
` if(oControl.isInitialized) { return; }` && |\n| &&
|
||||
` oControl.Model2Messaging();` && |\n| &&
|
||||
` Messaging.registerObject(sap.z2ui5.oView, true);` && |\n| &&
|
||||
` oControl.isInitialized = true;` && |\n| &&
|
||||
` setTimeout( (oControl) => { ` && |\n| &&
|
||||
` ` && |\n| &&
|
||||
` ` && |\n| &&
|
||||
` }, 50 , oControl );` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
`}); } catch (e) { debugger; }`.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
|
@ -1,16 +0,0 @@
|
|||
<?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_CC_MESSAGING</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>UI5 Messaging Control</DESCRIPT>
|
||||
<STATE>1</STATE>
|
||||
<CLSCCINCL>X</CLSCCINCL>
|
||||
<FIXPT>X</FIXPT>
|
||||
<UNICODE>X</UNICODE>
|
||||
</VSEOCLASS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
|
@ -1,167 +0,0 @@
|
|||
CLASS z2ui5_cl_cc_spreadsheet DEFINITION
|
||||
PUBLIC
|
||||
FINAL
|
||||
CREATE PUBLIC .
|
||||
|
||||
PUBLIC SECTION.
|
||||
INTERFACES z2ui5_if_ajson_filter.
|
||||
CLASS-METHODS get_js
|
||||
IMPORTING
|
||||
!i_columnconfig TYPE clike OPTIONAL
|
||||
RETURNING
|
||||
VALUE(r_js) TYPE string .
|
||||
PROTECTED SECTION.
|
||||
PRIVATE SECTION.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
|
||||
CLASS Z2UI5_CL_CC_SPREADSHEET IMPLEMENTATION.
|
||||
|
||||
|
||||
METHOD get_js.
|
||||
DATA lv_column_config TYPE string.
|
||||
lv_column_config = i_columnconfig.
|
||||
IF lv_column_config IS INITIAL.
|
||||
lv_column_config = `''`.
|
||||
ENDIF.
|
||||
|
||||
r_js = ` sap.ui.define("z2ui5/ExportSpreadsheet" , [` && |\n| &&
|
||||
` "sap/ui/core/Control",` && |\n| &&
|
||||
` "sap/m/Button",` && |\n| &&
|
||||
* ` "sap/ui/export/Spreadsheet"` && |\n| &&
|
||||
* ` ], function (Control, Button, Spreadsheet) {` && |\n| &&
|
||||
` ], function (Control, Button) {` && |\n| &&
|
||||
` "use strict";` && |\n| &&
|
||||
|\n| &&
|
||||
` return Control.extend("z2ui5.ExportSpreadsheet", {` && |\n| &&
|
||||
|\n| &&
|
||||
` metadata: {` && |\n| &&
|
||||
` properties: {` && |\n| &&
|
||||
` tableId: {` && |\n| &&
|
||||
` type: "string",` && |\n| &&
|
||||
` defaultValue: ""` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` type: {` && |\n| &&
|
||||
` type: "string",` && |\n| &&
|
||||
` defaultValue: ""` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` icon: {` && |\n| &&
|
||||
` type: "string",` && |\n| &&
|
||||
` defaultValue: ""` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` tooltip: {` && |\n| &&
|
||||
` type: "string",` && |\n| &&
|
||||
` defaultValue: ""` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` columnconfig: { ` && |\n| &&
|
||||
` type: "Array" ` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` text: {` && |\n| &&
|
||||
` type: "string",` && |\n| &&
|
||||
` defaultValue: ""` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
|\n| &&
|
||||
|\n| &&
|
||||
` aggregations: {` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` events: { },` && |\n| &&
|
||||
` renderer: null` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
|\n| &&
|
||||
` setColumnconfig: function(oConfig) { ` && |\n| &&
|
||||
* ` oConfig = JSON.parse(oConfig);` && |\n| &&
|
||||
` this.setProperty("columnconfig", oConfig, true );` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
|\n| &&
|
||||
` renderer: function (oRm, oControl) {` && |\n| &&
|
||||
` var checkVersion = sap.ui.getVersionInfo().gav.includes('com.sap.ui5') ? true : false;` && |\n| &&
|
||||
|\n| &&
|
||||
` oControl.oExportButton = new Button({` && |\n| &&
|
||||
` text: oControl.getProperty("text"),` && |\n| &&
|
||||
` icon: oControl.getProperty("icon"), ` && |\n| &&
|
||||
` type: oControl.getProperty("type"), ` && |\n| &&
|
||||
` enabled: checkVersion,` && |\n| &&
|
||||
` tooltip: !checkVersion ? 'Not Available on OpenUI5 SDK' : oControl.getProperty("tooltip") , ` && |\n| &&
|
||||
` press: function (oEvent) { ` && |\n| &&
|
||||
|\n| &&
|
||||
` var aCols = oControl.getProperty("columnconfig");` && |\n| &&
|
||||
` if( !aCols ) { aCols = ` && lv_column_config && `; }` && |\n| &&
|
||||
|\n| &&
|
||||
` var oBinding, oSettings, oSheet, vTableId, vViewPrefix,vPrefixTableId;` && |\n| &&
|
||||
` vTableId = oControl.getProperty("tableId")` && |\n| &&
|
||||
` vPrefixTableId = sap.z2ui5.oView.createId( vTableId );` && |\n| &&
|
||||
` var oTable;` && |\n| &&
|
||||
` if (!oTable) { oTable = sap.z2ui5.oView.byId(vTableId); };` && |\n| &&
|
||||
` if (!oTable) { oTable = sap.z2ui5.oViewNest.byId(vTableId); };` && |\n| &&
|
||||
` if (!oTable) { oTable = sap.z2ui5.oViewNest2.byId(vTableId); };` && |\n| &&
|
||||
` if (!oTable) { oTable = sap.z2ui5.oViewPopup.Fragment.byId('popupId',vTableId); };` && |\n| &&
|
||||
` if (!oTable) { oTable = sap.z2ui5.oViewPopover.byId(vTableId); };` && |\n| &&
|
||||
` oBinding = oTable.getBinding("rows");` && |\n| &&
|
||||
` if (oBinding == null) {` && |\n| &&
|
||||
` oBinding = oTable.getBinding("items");` && |\n| &&
|
||||
` };` && |\n| &&
|
||||
` oSettings = {` && |\n| &&
|
||||
` workbook: { columns: aCols },` && |\n| &&
|
||||
` dataSource: oBinding` && |\n| &&
|
||||
` };` && |\n| &&
|
||||
* ` oSheet = new Spreadsheet(oSettings);` && |\n| &&
|
||||
` sap.ui.require(["sap/ui/export/Spreadsheet"], function(Spreadsheet) {` && |\n| &&
|
||||
` oSheet = new Spreadsheet(oSettings);` && |\n| &&
|
||||
` oSheet.build()` && |\n| &&
|
||||
` .then(function() {` && |\n| &&
|
||||
` }).finally(function() {` && |\n| &&
|
||||
` oSheet.destroy();` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` }.bind(oControl)` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
|\n| &&
|
||||
` oRm.renderControl(oControl.oExportButton);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` });`.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD z2ui5_if_ajson_filter~keep_node.
|
||||
|
||||
rv_keep = abap_true.
|
||||
|
||||
CASE iv_visit.
|
||||
|
||||
WHEN z2ui5_if_ajson_filter=>visit_type-open.
|
||||
|
||||
IF is_node-children = 0.
|
||||
rv_keep = abap_false.
|
||||
ENDIF.
|
||||
|
||||
WHEN z2ui5_if_ajson_filter=>visit_type-value.
|
||||
|
||||
CASE is_node-type.
|
||||
WHEN z2ui5_if_ajson_types=>node_type-boolean.
|
||||
IF is_node-value = `false`.
|
||||
rv_keep = abap_false.
|
||||
ENDIF.
|
||||
WHEN z2ui5_if_ajson_types=>node_type-number.
|
||||
IF is_node-value = `0` OR is_node-value = `0.00`.
|
||||
rv_keep = abap_false.
|
||||
ENDIF.
|
||||
WHEN z2ui5_if_ajson_types=>node_type-string.
|
||||
IF is_node-value = ``.
|
||||
rv_keep = abap_false.
|
||||
ENDIF.
|
||||
ENDCASE.
|
||||
|
||||
WHEN z2ui5_if_ajson_filter=>visit_type-close.
|
||||
|
||||
IF is_node-children = 0.
|
||||
rv_keep = abap_false.
|
||||
ENDIF.
|
||||
|
||||
ENDCASE.
|
||||
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
|
@ -1,16 +0,0 @@
|
|||
<?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_CC_SPREADSHEET</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>UI5 Spreadheet Control</DESCRIPT>
|
||||
<STATE>1</STATE>
|
||||
<CLSCCINCL>X</CLSCCINCL>
|
||||
<FIXPT>X</FIXPT>
|
||||
<UNICODE>X</UNICODE>
|
||||
</VSEOCLASS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
|
@ -1,272 +0,0 @@
|
|||
class Z2UI5_CL_CC_VALIDATOR definition
|
||||
public
|
||||
final
|
||||
create public .
|
||||
|
||||
public section.
|
||||
|
||||
types:
|
||||
BEGIN OF ty_constraints,
|
||||
type TYPE string,
|
||||
format TYPE string,
|
||||
min_length TYPE int4,
|
||||
max_length TYPE int4,
|
||||
minimum TYPE int4,
|
||||
maximum TYPE int4,
|
||||
END OF ty_constraints .
|
||||
types:
|
||||
BEGIN OF ty_type,
|
||||
email TYPE ty_constraints,
|
||||
number TYPE ty_constraints,
|
||||
date TYPE ty_constraints,
|
||||
END OF ty_type .
|
||||
types:
|
||||
BEGIN OF ty_validation_schema,
|
||||
properties TYPE ty_type,
|
||||
END OF ty_validation_schema .
|
||||
|
||||
class-methods GET_JS
|
||||
importing
|
||||
!IS_VALIDATION type TY_VALIDATION_SCHEMA
|
||||
!IV_VIEW type STRING
|
||||
returning
|
||||
value(RESULT) type STRING .
|
||||
class-methods LOAD_AJV
|
||||
returning
|
||||
value(RESULT) type STRING .
|
||||
class-methods VALIDATE_FIELDS
|
||||
returning
|
||||
value(RESULT) type STRING .
|
||||
PROTECTED SECTION.
|
||||
PRIVATE SECTION.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
|
||||
CLASS Z2UI5_CL_CC_VALIDATOR IMPLEMENTATION.
|
||||
|
||||
|
||||
METHOD GET_JS.
|
||||
|
||||
DATA(lv_schema_json) = ``.
|
||||
|
||||
* TRY.
|
||||
* DATA(li_ajson) = CAST z2ui5_if_ajson( z2ui5_cl_ajson=>create_empty( ) ).
|
||||
* li_ajson->set( iv_path = `/` iv_val = is_validation ).
|
||||
* li_ajson = li_ajson->map( z2ui5_cl_ajson_mapping=>create_to_camel_case( ) ).
|
||||
* li_ajson = li_ajson->map( z2ui5_cl_ajson_mapping=>create_lower_case( ) ).
|
||||
* lv_schema_json = li_ajson->stringify( ).
|
||||
*
|
||||
* CATCH cx_root.
|
||||
* ENDTRY.
|
||||
|
||||
lv_schema_json = /ui2/cl_json=>serialize(
|
||||
data = is_validation
|
||||
compress = abap_true
|
||||
* name =
|
||||
pretty_name = 'X'
|
||||
* type_descr =
|
||||
* assoc_arrays =
|
||||
* ts_as_iso8601 =
|
||||
* expand_includes =
|
||||
* assoc_arrays_opt =
|
||||
* numc_as_string =
|
||||
* name_mappings =
|
||||
* conversion_exits =
|
||||
).
|
||||
|
||||
|
||||
CASE iv_view.
|
||||
WHEN 'MAIN'.
|
||||
DATA(lv_view) = `sap.z2ui5.oView`.
|
||||
WHEN 'NEST'.
|
||||
lv_view = `sap.z2ui5.oViewNest`.
|
||||
WHEN 'NEST2'.
|
||||
lv_view = `sap.z2ui5.oViewNest2`.
|
||||
WHEN 'POPUP'.
|
||||
lv_view = `sap.z2ui5.oViewPopup.Fragment`.
|
||||
WHEN 'POPOVER'.
|
||||
lv_view = `sap.z2ui5.oViewPopover.Fragment`.
|
||||
ENDCASE.
|
||||
|
||||
|
||||
result = result && |\n| && `debugger;if (!z2ui5.Validator) { sap.ui.define("z2ui5/Validator" , ["sap/ui/base/Object","sap/ui/core/library","sap/ui/core/Control"], ` && |\n| &&
|
||||
` (UI5Object,coreLibrary,UI5Control)=>{` && |\n| &&
|
||||
` "use strict";` && |\n| &&
|
||||
` const VALID_UI5_CONTROL_PROPERTIES = ['dateValue', 'selectedKey', 'selected', 'value'];` && |\n| &&
|
||||
` const DEFAULT_AJV_OPTIONS = {` && |\n| &&
|
||||
` $data: true,` && |\n| &&
|
||||
` allErrors: true,` && |\n| &&
|
||||
` coerceTypes: true,` && |\n| &&
|
||||
` errorDataPath: 'property'` && |\n| &&
|
||||
` };` && |\n| &&
|
||||
` const Validator = UI5Object.extend('z2ui5.Validator', {` && |\n| &&
|
||||
` constructor: function(view, schema, opt) {` && |\n| &&
|
||||
` var schema = ` && lv_schema_json && `;` && |\n| &&
|
||||
` var view = ` && lv_view && `;` && |\n| &&
|
||||
` if (!view || !schema) { ` && |\n| &&
|
||||
` throw new Error('Missing parameters!');` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` UI5Object.apply(this, arguments);` && |\n| &&
|
||||
` ` && |\n| &&
|
||||
` const ajv = new Ajv(opt || DEFAULT_AJV_OPTIONS);` && |\n| &&
|
||||
` this._validate = ajv.compile(schema);` && |\n| &&
|
||||
` this._view = view;` && |\n| &&
|
||||
` this._errors = null;` && |\n| &&
|
||||
` this._payload = null;` && |\n| &&
|
||||
` this._validProperties = [];` && |\n| &&
|
||||
` this.addValidProperties(VALID_UI5_CONTROL_PROPERTIES);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` Validator.prototype.destroy = function() {` && |\n| &&
|
||||
` this._validate = null;` && |\n| &&
|
||||
` this._view = null;` && |\n| &&
|
||||
` this._errors = null;` && |\n| &&
|
||||
` this._payload = null;` && |\n| &&
|
||||
` this._validProperties = null;` && |\n| &&
|
||||
` };` && |\n| &&
|
||||
` Validator.prototype.validate = function() {` && |\n| &&
|
||||
` const controls = this._getControls();` && |\n| &&
|
||||
` this._payload = this._getPayloadToValidate(controls);` && |\n| &&
|
||||
` this._clearControlStatus(controls);` && |\n| &&
|
||||
` const isValid = this._validate(this._payload);` && |\n| &&
|
||||
` if (isValid) {` && |\n| &&
|
||||
` this._errors = null;` && |\n| &&
|
||||
` } else {` && |\n| &&
|
||||
` this._errors = this._processValidationErrors(this._validate.errors);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` return isValid;` && |\n| &&
|
||||
` };` && |\n| &&
|
||||
` Validator.prototype.getErrors = function() {` && |\n| &&
|
||||
` return this._errors;` && |\n| &&
|
||||
` };` && |\n| &&
|
||||
` Validator.prototype.getPayloadUsedInValidation = function() {` && |\n| &&
|
||||
` return this._payload;` && |\n| &&
|
||||
` };` && |\n| &&
|
||||
` Validator.prototype.getValidProperties = function() {` && |\n| &&
|
||||
` return this._validProperties.map(function _getValidProperties(validProperty) {` && |\n| &&
|
||||
` return validProperty;` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` };` && |\n| &&
|
||||
` Validator.prototype.addValidProperties = function(validProperties) {` && |\n| &&
|
||||
` const that = this;` && |\n| &&
|
||||
` validProperties.forEach(function _addValidProperty(property) {` && |\n| &&
|
||||
` that._validProperties.push(property);` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` };` && |\n| &&
|
||||
` Validator.prototype._getControls = function() {` && |\n| &&
|
||||
` const that = this;` && |\n| &&
|
||||
` if (this._validate.schema && this._validate.schema.properties) {` && |\n| &&
|
||||
` return Object.keys(this._validate.schema.properties)` && |\n| &&
|
||||
` .map(function _mapSchemaProperties(key) {` && |\n| &&
|
||||
` const control = that._view.byId(key);` && |\n| &&
|
||||
` return (control instanceof UI5Control) ? control : null;` && |\n| &&
|
||||
` })` && |\n| &&
|
||||
` .filter(function _filterSchemaProperties(control) {` && |\n| &&
|
||||
` return (control);` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` } else {` && |\n| &&
|
||||
` return [];` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` };` && |\n| &&
|
||||
` Validator.prototype._getPayloadToValidate = function(controls) {` && |\n| &&
|
||||
` const that = this;` && |\n| &&
|
||||
` const payload = {};` && |\n| &&
|
||||
` controls.forEach(function _setPayloadProperty(control) {` && |\n| &&
|
||||
` const viewIdIndex = control.getId().lastIndexOf('-') + 1;` && |\n| &&
|
||||
` const controlId = control.getId().substring(viewIdIndex);` && |\n| &&
|
||||
` payload[controlId] = that._getControlValue(control);` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` return payload;` && |\n| &&
|
||||
` };` && |\n| &&
|
||||
` Validator.prototype._getControlValue = function(control) {` && |\n| &&
|
||||
` let value = '';` && |\n| &&
|
||||
` const controlProperties = Object.keys(control.mProperties);` && |\n| &&
|
||||
` this._validProperties.forEach(function _filterControlProperties(validProperty) {` && |\n| &&
|
||||
` if (!value) {` && |\n| &&
|
||||
` const isValidProperty = controlProperties.find(function _findValidProperty(controlProperty) {` && |\n| &&
|
||||
` return (controlProperty === validProperty);` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` if (isValidProperty) {` && |\n| &&
|
||||
` const getPropertyMethod = ['get', validProperty.substring(0, 1).toUpperCase(), validProperty.substring(1)].join('');` && |\n| &&
|
||||
` if (control[getPropertyMethod]) {` && |\n| &&
|
||||
` value = control[getPropertyMethod]();` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` return value;` && |\n| &&
|
||||
` };` && |\n| &&
|
||||
` Validator.prototype._clearControlStatus = function(controls) {` && |\n| &&
|
||||
` controls.forEach(function _setValueState(control) {` && |\n| &&
|
||||
` if (control && control.setValueState) {` && |\n| &&
|
||||
` control.setValueState(coreLibrary.ValueState.None);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (control && control.setValueStateText) {` && |\n| &&
|
||||
` control.setValueStateText();` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` };` && |\n| &&
|
||||
` Validator.prototype._setControlErrorStatus = function(control, message) {` && |\n| &&
|
||||
` if (control && control.setValueState) {` && |\n| &&
|
||||
` control.setValueState(coreLibrary.ValueState.Error);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (control && control.setValueStateText) {` && |\n| &&
|
||||
` control.setValueStateText(message);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` };` && |\n| &&
|
||||
` Validator.prototype._processValidationErrors = function(errors) {` && |\n| &&
|
||||
` const that = this;` && |\n| &&
|
||||
` const errorMessageObjects = [];` && |\n| &&
|
||||
` errors.forEach(function _mapErrors(err) {` && |\n| &&
|
||||
` const controlId = err.dataPath.substring(1);` && |\n| &&
|
||||
` const control = that._view.byId(controlId);` && |\n| &&
|
||||
` if (control) {` && |\n| &&
|
||||
` that._setControlErrorStatus(control, err.message);` && |\n| &&
|
||||
` // errorMessageObjects.push(that._createErrorMessageObject(control, err.message, ''));` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` return errorMessageObjects;` && |\n| &&
|
||||
` };` && |\n| &&
|
||||
` ` && |\n| &&
|
||||
` return Validator;` && |\n| &&
|
||||
` ` && |\n| &&
|
||||
` }); }`.
|
||||
|
||||
|
||||
* result = result && |\n| && `try { var _validator = new z2ui5.Validator)(); } catch(v_err) {};`.
|
||||
result = result && |\n| && `var _validator = new z2ui5.Validator();`.
|
||||
|
||||
result = result && |\n| && `sap.z2ui5._validate = () => {` && |\n| &&
|
||||
` if (_validator.validate()) {` && |\n| &&
|
||||
` console.log('OK');` && |\n| &&
|
||||
` } else {` && |\n| &&
|
||||
` console.log(_validator.getErrors());` && |\n| &&
|
||||
` };` && |\n| &&
|
||||
`};`.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD LOAD_AJV.
|
||||
|
||||
result = `var headTag = document.getElementsByTagName('head')[0];` && |\n| &&
|
||||
`var loadLibs = function(){` && |\n| &&
|
||||
` var scriptTag = document.createElement('script');` && |\n| &&
|
||||
` scriptTag.src = 'https://cdn.jsdelivr.net/npm/ajv@6.12.6/dist/ajv.min.js';` && |\n| &&
|
||||
`` && |\n| &&
|
||||
* ` scriptTag.onload = function(e){` && |\n| &&
|
||||
* ` var ajvv = new Ajv(); ` && |\n| &&
|
||||
* ` };` && |\n| &&
|
||||
`` && |\n| &&
|
||||
` headTag.appendChild(scriptTag);` && |\n| &&
|
||||
`}` && |\n| &&
|
||||
`loadLibs();`.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD VALIDATE_FIELDS.
|
||||
result = `sap.z2ui5._validate()`.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
|
@ -1,16 +0,0 @@
|
|||
<?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_CC_VALIDATOR</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>cc - fields validator</DESCRIPT>
|
||||
<STATE>1</STATE>
|
||||
<CLSCCINCL>X</CLSCCINCL>
|
||||
<FIXPT>X</FIXPT>
|
||||
<UNICODE>X</UNICODE>
|
||||
</VSEOCLASS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
|
@ -294,7 +294,8 @@ CLASS z2ui5_cl_xml_view_cc IMPLEMENTATION.
|
|||
mo_view->_generic( ns = `html`
|
||||
name = `style` ).
|
||||
|
||||
CALL METHOD ('Z2UI5_CL_CC_DEMO_OUT')=>('GET_STYLE')
|
||||
data(lv_class) = 'Z2UI5_CL_CC_DEMO_OUT'.
|
||||
CALL METHOD (lv_class)=>('GET_STYLE')
|
||||
RECEIVING
|
||||
result = lv_style.
|
||||
result = mo_view->_cc_plain_xml( lv_style )->html( val ).
|
||||
|
|
Loading…
Reference in New Issue
Block a user