mirror of
https://github.com/abap2UI5/abap2UI5.git
synced 2025-04-29 02:58:20 +08:00
update view extension (#146)
* view definition * update view * xml view * bugfix startapp * update view * view update * update view extensions * view extension
This commit is contained in:
parent
2c60ae51cc
commit
2ebee1f190
|
@ -10,7 +10,7 @@ ENDCLASS.
|
|||
|
||||
|
||||
|
||||
CLASS Z2UI5_CL_APP_DEMO_00 IMPLEMENTATION.
|
||||
CLASS z2ui5_cl_app_demo_00 IMPLEMENTATION.
|
||||
|
||||
|
||||
METHOD z2ui5_if_app~controller.
|
||||
|
@ -33,7 +33,6 @@ CLASS Z2UI5_CL_APP_DEMO_00 IMPLEMENTATION.
|
|||
ENDCASE.
|
||||
|
||||
|
||||
|
||||
DATA(page) = z2ui5_cl_xml_view_helper=>factory(
|
||||
)->page(
|
||||
title = 'abap2UI5 - Demo Section'
|
||||
|
|
|
@ -7,8 +7,8 @@ CLASS z2ui5_cl_app_demo_07 DEFINITION PUBLIC.
|
|||
DATA mv_path TYPE string.
|
||||
DATA mv_value TYPE string.
|
||||
|
||||
DATA mv_popup_view TYPE string.
|
||||
|
||||
" DATA mv_popup_view TYPE string.
|
||||
" DATA check_initialized TYPE abap_bool.
|
||||
TYPES:
|
||||
BEGIN OF ty_file,
|
||||
selkz TYPE abap_bool,
|
||||
|
@ -22,23 +22,100 @@ CLASS z2ui5_cl_app_demo_07 DEFINITION PUBLIC.
|
|||
DATA mt_file TYPE STANDARD TABLE OF ty_file WITH EMPTY KEY.
|
||||
DATA ms_file_edit TYPE ty_file.
|
||||
DATA ms_file_prev TYPE ty_file.
|
||||
data mv_set_prev_view type abap_bool.
|
||||
" DATA mv_set_prev_view TYPE abap_bool.
|
||||
|
||||
PROTECTED SECTION.
|
||||
|
||||
DATA client TYPE REF TO z2ui5_if_client.
|
||||
DATA:
|
||||
BEGIN OF app,
|
||||
check_initialized TYPE abap_bool,
|
||||
view_main TYPE string,
|
||||
view_popup TYPE string,
|
||||
get TYPE z2ui5_if_client=>ty_s_get,
|
||||
next TYPE z2ui5_if_client=>ty_s_next,
|
||||
END OF app.
|
||||
METHODS ui5_on_init.
|
||||
METHODS ui5_on_event.
|
||||
|
||||
METHODS ui5_render_view_main
|
||||
RETURNING
|
||||
VALUE(r_result) TYPE string.
|
||||
|
||||
METHODS ui5_render_view_init
|
||||
RETURNING
|
||||
VALUE(r_result) TYPE string.
|
||||
|
||||
METHODS ui5_render_popup_descr
|
||||
RETURNING
|
||||
VALUE(r_result) TYPE string.
|
||||
|
||||
METHODS ui5_render_popup_data
|
||||
RETURNING
|
||||
VALUE(r_result) TYPE string.
|
||||
|
||||
METHODS ui5_get_ccontrol_file_upload
|
||||
RETURNING
|
||||
VALUE(result) TYPE string.
|
||||
|
||||
PRIVATE SECTION.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
|
||||
CLASS Z2UI5_CL_APP_DEMO_07 IMPLEMENTATION.
|
||||
CLASS z2ui5_cl_app_demo_07 IMPLEMENTATION.
|
||||
|
||||
|
||||
METHOD z2ui5_if_app~controller.
|
||||
|
||||
mv_popup_view = ''.
|
||||
mv_set_prev_view = ''.
|
||||
me->client = client.
|
||||
app-get = client->get( ).
|
||||
app-view_popup = ``.
|
||||
|
||||
IF app-check_initialized = abap_false.
|
||||
app-check_initialized = abap_true.
|
||||
ui5_on_init( ).
|
||||
ENDIF.
|
||||
|
||||
IF app-get-event IS NOT INITIAL.
|
||||
ui5_on_event( ).
|
||||
ENDIF.
|
||||
|
||||
CASE app-view_main.
|
||||
WHEN 'INIT'.
|
||||
app-next-xml_main = ui5_render_view_init( ).
|
||||
WHEN 'MAIN'.
|
||||
app-next-xml_main = ui5_render_view_main( ).
|
||||
ENDCASE.
|
||||
|
||||
CASE app-view_popup.
|
||||
WHEN 'DESCR'.
|
||||
app-next-xml_popup = ui5_render_popup_descr( ).
|
||||
WHEN 'DATA'.
|
||||
app-next-xml_popup = ui5_render_popup_data( ).
|
||||
ENDCASE.
|
||||
|
||||
client->set_next( app-next ).
|
||||
CLEAR app-get.
|
||||
CLEAR app-next.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD ui5_on_init.
|
||||
|
||||
app-view_main = 'INIT'.
|
||||
client->popup_message_toast( 'Custom Control for File Upload loaded' ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD ui5_on_event.
|
||||
|
||||
CASE client->get( )-event.
|
||||
|
||||
WHEN 'START'.
|
||||
app-view_main = 'MAIN'.
|
||||
|
||||
WHEN 'DISPLAY'.
|
||||
ms_file_prev = mt_file[ selkz = abap_true ].
|
||||
|
||||
|
@ -58,22 +135,56 @@ CLASS Z2UI5_CL_APP_DEMO_07 IMPLEMENTATION.
|
|||
|
||||
WHEN 'POPUP_DESCR'.
|
||||
ms_file_edit = mt_file[ selkz = abap_true ].
|
||||
mv_popup_view = 'POPUP_DESCR'.
|
||||
mv_set_prev_view = abap_true.
|
||||
app-view_popup = 'DESCR'.
|
||||
app-next-check_set_prev_view = abap_true.
|
||||
|
||||
WHEN 'POPUP_DATA'.
|
||||
ms_file_edit = mt_file[ selkz = abap_true ].
|
||||
mv_popup_view = 'POPUP_DATA'.
|
||||
mv_set_prev_view = abap_true.
|
||||
app-view_popup = 'DATA'.
|
||||
app-next-check_set_prev_view = abap_true.
|
||||
|
||||
WHEN 'BACK'.
|
||||
client->nav_app_leave( client->get_app( client->get( )-id_prev_app_stack ) ).
|
||||
|
||||
ENDCASE.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
DATA(lo_main) = z2ui5_cl_xml_view_helper=>factory( ).
|
||||
DATA(page) = lo_main->page(
|
||||
|
||||
METHOD ui5_render_view_init.
|
||||
|
||||
DATA(lo_view) = z2ui5_cl_xml_view_helper=>factory( check_shell = abap_false ns = VALUE #(
|
||||
( `xmlns:mvc="sap.ui.core.mvc"` )
|
||||
( `xmlns:m="sap.m"` )
|
||||
( `xmlns:z2ui5="z2ui5"` )
|
||||
( `xmlns:core="sap.ui.core"` )
|
||||
( `xmlns="http://www.w3.org/1999/xhtml"` )
|
||||
) ).
|
||||
|
||||
DATA(page) = lo_view->_generic( name = 'Shell' ns = 'm' )->page(
|
||||
ns = 'm'
|
||||
title = 'abap2UI5 - File Upload/Download'
|
||||
navbuttonpress = client->_event( 'BACK' )
|
||||
shownavbutton = abap_true
|
||||
)->header_content( ns = 'm'
|
||||
)->toolbar_spacer( ns = 'm'
|
||||
)->link( ns = 'm' text = 'Demo' href = 'https://twitter.com/OblomovDev/status/1638487600930357248'
|
||||
)->link( ns = 'm' text = 'Source_Code' href = client->get( )-url_source_code
|
||||
)->get_parent( ).
|
||||
|
||||
page->text( ns = 'm' text = 'Custom Control for File Upload is now loaded.'
|
||||
)->button( ns = 'm' text = 'continue' press = client->_event( 'START' )
|
||||
)->zz_plain( ` <script> ` && ui5_get_ccontrol_file_upload( ) && ` </script>`
|
||||
).
|
||||
|
||||
r_result = lo_view->get_root( )->xml_get( ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD ui5_render_view_main.
|
||||
|
||||
DATA(page) = z2ui5_cl_xml_view_helper=>factory( )->page(
|
||||
title = 'abap2UI5 - File Upload/Download'
|
||||
navbuttonpress = client->_event( 'BACK' )
|
||||
shownavbutton = abap_true
|
||||
|
@ -121,64 +232,175 @@ CLASS Z2UI5_CL_APP_DEMO_07 IMPLEMENTATION.
|
|||
)->text( '{DESCR}' ).
|
||||
|
||||
IF ms_file_prev-data IS NOT INITIAL.
|
||||
page->zz_html( '<iframe src="' && ms_file_prev-data && '" height="75%" width="98%"/>' ).
|
||||
page->zz_plain( '<html:iframe src="' && ms_file_prev-data && '" height="75%" width="98%"/>' ).
|
||||
CLEAR mv_value.
|
||||
ENDIF.
|
||||
|
||||
DATA(lo_popup) = z2ui5_cl_xml_view_helper=>factory( ).
|
||||
|
||||
CASE mv_popup_view.
|
||||
|
||||
WHEN 'POPUP_DESCR'.
|
||||
|
||||
lo_popup = z2ui5_cl_xml_view_helper=>factory(
|
||||
)->dialog(
|
||||
title = 'Edit Description'
|
||||
icon = 'sap-icon://edit'
|
||||
)->content(
|
||||
)->text_area(
|
||||
height = '99%'
|
||||
width = '99%'
|
||||
value = client->_bind( ms_file_edit-descr )
|
||||
)->get_parent(
|
||||
)->footer( )->overflow_toolbar(
|
||||
)->toolbar_spacer(
|
||||
)->button(
|
||||
text = 'Cancel'
|
||||
press = client->_event( 'TEXTAREA_CANCEL' )
|
||||
)->button(
|
||||
text = 'Confirm'
|
||||
press = client->_event( 'TEXTAREA_DESCR_CONFIRM' )
|
||||
type = 'Emphasized' ).
|
||||
|
||||
|
||||
WHEN 'POPUP_DATA'.
|
||||
|
||||
lo_popup = z2ui5_cl_xml_view_helper=>factory(
|
||||
)->dialog(
|
||||
stretch = abap_true
|
||||
title = 'Data:'
|
||||
)->content(
|
||||
)->text_area(
|
||||
height = '99%'
|
||||
width = '99%'
|
||||
enabled = abap_false
|
||||
value = client->_bind( ms_file_edit-data )
|
||||
)->get_parent(
|
||||
)->footer( )->overflow_toolbar(
|
||||
)->toolbar_spacer(
|
||||
)->button(
|
||||
text = 'close'
|
||||
press = client->_event( 'TEXTAREA_DATA_CONFIRM' )
|
||||
type = 'Emphasized' ).
|
||||
|
||||
ENDCASE.
|
||||
|
||||
client->set_next( VALUE #(
|
||||
xml_main = lo_main->get_root( )->xml_get( )
|
||||
xml_popup = lo_popup->get_root( )->xml_get( )
|
||||
check_set_prev_view = mv_set_prev_view
|
||||
) ).
|
||||
r_result = page->get_root( )->xml_get( ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD ui5_render_popup_descr.
|
||||
|
||||
DATA(lo_popup) = z2ui5_cl_xml_view_helper=>factory(
|
||||
)->dialog(
|
||||
title = 'Edit Description'
|
||||
icon = 'sap-icon://edit'
|
||||
)->content(
|
||||
)->text_area(
|
||||
height = '99%'
|
||||
width = '99%'
|
||||
value = client->_bind( ms_file_edit-descr )
|
||||
)->get_parent(
|
||||
)->footer( )->overflow_toolbar(
|
||||
)->toolbar_spacer(
|
||||
)->button(
|
||||
text = 'Cancel'
|
||||
press = client->_event( 'TEXTAREA_CANCEL' )
|
||||
)->button(
|
||||
text = 'Confirm'
|
||||
press = client->_event( 'TEXTAREA_DESCR_CONFIRM' )
|
||||
type = 'Emphasized' ).
|
||||
|
||||
r_result = lo_popup->get_root( )->xml_get( ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD ui5_render_popup_data.
|
||||
|
||||
DATA(lo_popup) = z2ui5_cl_xml_view_helper=>factory(
|
||||
)->dialog(
|
||||
stretch = abap_true
|
||||
title = 'Data:'
|
||||
)->content(
|
||||
)->text_area(
|
||||
height = '99%'
|
||||
width = '99%'
|
||||
enabled = abap_false
|
||||
value = client->_bind( ms_file_edit-data )
|
||||
)->get_parent(
|
||||
)->footer( )->overflow_toolbar(
|
||||
)->toolbar_spacer(
|
||||
)->button(
|
||||
text = 'close'
|
||||
press = client->_event( 'TEXTAREA_DATA_CONFIRM' )
|
||||
type = 'Emphasized' ).
|
||||
|
||||
r_result = lo_popup->get_root( )->xml_get( ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD ui5_get_ccontrol_file_upload.
|
||||
|
||||
result = ` jQuery.sap.declare("z2ui5.FileUploader");` && |\n| &&
|
||||
|\n| &&
|
||||
` sap.ui.define([` && |\n| &&
|
||||
` "sap/ui/core/Control",` && |\n| &&
|
||||
` "sap/m/Button",` && |\n| &&
|
||||
` "sap/ui/unified/FileUploader"` && |\n| &&
|
||||
` ], function (Control, Button, FileUploader) {` && |\n| &&
|
||||
` "use strict";` && |\n| &&
|
||||
|\n| &&
|
||||
` return Control.extend("z2ui5.FileUploader", {` && |\n| &&
|
||||
|\n| &&
|
||||
` metadata: {` && |\n| &&
|
||||
` properties: {` && |\n| &&
|
||||
` value: {` && |\n| &&
|
||||
` type: "string",` && |\n| &&
|
||||
` defaultValue: ""` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` path: {` && |\n| &&
|
||||
` type: "string",` && |\n| &&
|
||||
` defaultValue: ""` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` tooltip: {` && |\n| &&
|
||||
` type: "string",` && |\n| &&
|
||||
` defaultValue: ""` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` fileType: {` && |\n| &&
|
||||
` type: "string",` && |\n| &&
|
||||
` defaultValue: ""` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` placeholder: {` && |\n| &&
|
||||
` type: "string",` && |\n| &&
|
||||
` defaultValue: ""` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` buttonText: {` && |\n| &&
|
||||
` type: "string",` && |\n| &&
|
||||
` defaultValue: "Upload"` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` enabled: {` && |\n| &&
|
||||
` type: "boolean",` && |\n| &&
|
||||
` defaultValue: true` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` multiple: {` && |\n| &&
|
||||
` type: "boolean",` && |\n| &&
|
||||
` defaultValue: false` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
|\n| &&
|
||||
|\n| &&
|
||||
` aggregations: {` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` events: {` && |\n| &&
|
||||
` "upload": {` && |\n| &&
|
||||
` allowPreventDefault: true,` && |\n| &&
|
||||
` parameters: {}` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` renderer: null` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
|\n| &&
|
||||
` renderer: function (oRm, oControl) {` && |\n| &&
|
||||
|\n| &&
|
||||
` oControl.oUploadButton = new Button({` && |\n| &&
|
||||
` text: oControl.getProperty("buttonText"),` && |\n| &&
|
||||
` enabled: oControl.getProperty("path") !== "",` && |\n| &&
|
||||
` press: function (oEvent) {` && |\n| &&
|
||||
|\n| &&
|
||||
` this.setProperty("path", this.oFileUploader.getProperty("value"));` && |\n| &&
|
||||
|\n| &&
|
||||
` var file = this.oFileUploader.oFileUpload.files[0];` && |\n| &&
|
||||
` var reader = new FileReader();` && |\n| &&
|
||||
|\n| &&
|
||||
` reader.onload = function (evt) {` && |\n| &&
|
||||
` var vContent = evt.currentTarget.result;` && |\n| &&
|
||||
` this.setProperty("value", vContent);` && |\n| &&
|
||||
` this.fireUpload();` && |\n| &&
|
||||
` //this.getView().byId('picture' ).getDomRef().src = vContent;` && |\n| &&
|
||||
` }.bind(this)` && |\n| &&
|
||||
|\n| &&
|
||||
` reader.readAsDataURL(file);` && |\n| &&
|
||||
` }.bind(oControl)` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
|\n| &&
|
||||
` oControl.oFileUploader = new FileUploader({` && |\n| &&
|
||||
` icon: "sap-icon://browse-folder",` && |\n| &&
|
||||
` iconOnly: true,` && |\n| &&
|
||||
` value: oControl.getProperty("path"),` && |\n| &&
|
||||
` placeholder: oControl.getProperty("placeholder"),` && |\n| &&
|
||||
` change: function (oEvent) {` && |\n| &&
|
||||
` var value = oEvent.getSource().getProperty("value");` && |\n| &&
|
||||
` this.setProperty("path", value);` && |\n| &&
|
||||
` if (value) {` && |\n| &&
|
||||
` this.oUploadButton.setEnabled();` && |\n| &&
|
||||
` } else {` && |\n| &&
|
||||
` this.oUploadButton.setEnabled(false);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` this.oUploadButton.rerender();` && |\n| &&
|
||||
` }.bind(oControl)` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
|\n| &&
|
||||
` var hbox = new sap.m.HBox();` && |\n| &&
|
||||
` hbox.addItem(oControl.oFileUploader);` && |\n| &&
|
||||
` hbox.addItem(oControl.oUploadButton);` && |\n| &&
|
||||
` oRm.renderControl(hbox);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` });`.
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
|
|
|
@ -22,15 +22,15 @@ CLASS z2ui5_cl_app_demo_18 DEFINITION PUBLIC.
|
|||
METHODS z2ui5_on_init.
|
||||
METHODS z2ui5_on_event.
|
||||
|
||||
METHODS z2ui5_on_view_main
|
||||
METHODS z2ui5_render_view_main
|
||||
RETURNING
|
||||
VALUE(result) TYPE string.
|
||||
|
||||
METHODS z2ui5_on_view_second
|
||||
METHODS z2ui5_render_view_second
|
||||
RETURNING
|
||||
VALUE(result) TYPE string.
|
||||
|
||||
METHODS z2ui5_on_popup_input
|
||||
METHODS z2ui5_render_popup_input
|
||||
RETURNING
|
||||
VALUE(result) TYPE string.
|
||||
|
||||
|
@ -66,15 +66,15 @@ CLASS z2ui5_cl_app_demo_18 IMPLEMENTATION.
|
|||
"view rendering
|
||||
CASE app-view_main.
|
||||
WHEN 'VIEW_MAIN'.
|
||||
app-next-xml_main = z2ui5_on_view_main( ).
|
||||
app-next-xml_main = z2ui5_render_view_main( ).
|
||||
WHEN 'VIEW_SECOND'.
|
||||
app-next-xml_main = z2ui5_on_view_second( ).
|
||||
app-next-xml_main = z2ui5_render_view_second( ).
|
||||
ENDCASE.
|
||||
|
||||
"popup rendering
|
||||
CASE app-view_popup.
|
||||
WHEN 'POPUP_INPUT'.
|
||||
app-next-xml_popup = z2ui5_on_popup_input( ).
|
||||
app-next-xml_popup = z2ui5_render_popup_input( ).
|
||||
ENDCASE.
|
||||
|
||||
"set the data for the frontend
|
||||
|
@ -122,7 +122,7 @@ CLASS z2ui5_cl_app_demo_18 IMPLEMENTATION.
|
|||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD z2ui5_on_view_main.
|
||||
METHOD z2ui5_render_view_main.
|
||||
|
||||
result = z2ui5_cl_xml_view_helper=>factory(
|
||||
)->page(
|
||||
|
@ -162,7 +162,7 @@ CLASS z2ui5_cl_app_demo_18 IMPLEMENTATION.
|
|||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD z2ui5_on_view_second.
|
||||
METHOD z2ui5_render_view_second.
|
||||
|
||||
result = z2ui5_cl_xml_view_helper=>factory(
|
||||
)->page(
|
||||
|
@ -193,7 +193,7 @@ CLASS z2ui5_cl_app_demo_18 IMPLEMENTATION.
|
|||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD z2ui5_on_popup_input.
|
||||
METHOD z2ui5_render_popup_input.
|
||||
|
||||
result = z2ui5_cl_xml_view_helper=>factory( )->dialog(
|
||||
title = 'Title'
|
||||
|
|
|
@ -4,6 +4,7 @@ CLASS z2ui5_cl_app_demo_29 DEFINITION PUBLIC.
|
|||
|
||||
INTERFACES z2ui5_if_app.
|
||||
|
||||
data mv_value type string.
|
||||
DATA product TYPE string.
|
||||
DATA quantity TYPE i.
|
||||
|
||||
|
@ -12,14 +13,14 @@ CLASS z2ui5_cl_app_demo_29 DEFINITION PUBLIC.
|
|||
DATA input41 TYPE string.
|
||||
PROTECTED SECTION.
|
||||
|
||||
data client TYPE REF TO z2ui5_if_client.
|
||||
DATA:
|
||||
BEGIN OF app,
|
||||
client TYPE REF TO z2ui5_if_client,
|
||||
check_initialized TYPE abap_bool,
|
||||
view_main TYPE string,
|
||||
view_popup TYPE string,
|
||||
s_get TYPE z2ui5_if_client=>ty_s_get,
|
||||
s_next TYPE z2ui5_if_client=>ty_s_next,
|
||||
get TYPE z2ui5_if_client=>ty_s_get,
|
||||
next TYPE z2ui5_if_client=>ty_s_next,
|
||||
END OF app.
|
||||
|
||||
METHODS z2ui5_on_init.
|
||||
|
@ -36,8 +37,8 @@ CLASS Z2UI5_CL_APP_DEMO_29 IMPLEMENTATION.
|
|||
|
||||
METHOD z2ui5_if_app~controller.
|
||||
|
||||
app-client = client.
|
||||
app-s_get = client->get( ).
|
||||
me->client = client.
|
||||
app-get = client->get( ).
|
||||
app-view_popup = ``.
|
||||
|
||||
IF app-check_initialized = abap_false.
|
||||
|
@ -45,28 +46,31 @@ CLASS Z2UI5_CL_APP_DEMO_29 IMPLEMENTATION.
|
|||
z2ui5_on_init( ).
|
||||
ENDIF.
|
||||
|
||||
IF app-s_get-event IS NOT INITIAL.
|
||||
IF app-get-event IS NOT INITIAL.
|
||||
z2ui5_on_event( ).
|
||||
ENDIF.
|
||||
|
||||
z2ui5_on_render( ).
|
||||
|
||||
client->set_next( app-s_next ).
|
||||
CLEAR app-s_get.
|
||||
CLEAR app-s_next.
|
||||
client->set_next( app-next ).
|
||||
CLEAR app-get.
|
||||
CLEAR app-next.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD z2ui5_on_event.
|
||||
|
||||
CASE app-s_get-event.
|
||||
CASE app-get-event.
|
||||
|
||||
WHEN 'POST'.
|
||||
app-client->popup_message_toast( app-s_get-event_data ).
|
||||
client->popup_message_toast( app-get-event_data ).
|
||||
|
||||
WHEN 'MYCC'.
|
||||
client->popup_message_toast( 'MYCC event ' && mv_value ).
|
||||
|
||||
WHEN 'BACK'.
|
||||
app-client->nav_app_leave( app-client->get_app( app-s_get-id_prev_app_stack ) ).
|
||||
client->nav_app_leave( client->get_app( app-get-id_prev_app_stack ) ).
|
||||
|
||||
ENDCASE.
|
||||
|
||||
|
@ -83,36 +87,108 @@ CLASS Z2UI5_CL_APP_DEMO_29 IMPLEMENTATION.
|
|||
input21 = '40'.
|
||||
input22 = '40'.
|
||||
|
||||
mv_value = 'test'.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD z2ui5_on_render.
|
||||
|
||||
|
||||
app-s_next-xml_main = `<mvc:View controllerName="project1.controller.View1"` && |\n| &&
|
||||
app-next-xml_main = `<mvc:View controllerName="project1.controller.View1"` && |\n| &&
|
||||
` xmlns:mvc="sap.ui.core.mvc" displayBlock="true"` && |\n| &&
|
||||
` xmlns:m="sap.m" xmlns="http://www.w3.org/1999/xhtml"` && |\n| &&
|
||||
` >` && |\n| &&
|
||||
` xmlns:z2ui5="z2ui5" xmlns:m="sap.m" xmlns="http://www.w3.org/1999/xhtml"` && |\n| &&
|
||||
` ><m:Button ` && |\n| &&
|
||||
` text="back" ` && |\n| &&
|
||||
` press="` && client->_event( 'BACK' ) && `" ` && |\n| &&
|
||||
` class="sapUiContentPadding sapUiResponsivePadding--content"/> ` && |\n| &&
|
||||
|
||||
`<html><head><style>` && |\n| &&
|
||||
`body {background-color: powderblue;}` && |\n| &&
|
||||
`h1 {color: blue;}` && |\n| &&
|
||||
`p {color: red;}` && |\n| &&
|
||||
`</style>` && |\n| &&
|
||||
`</style>` &&
|
||||
`</head>` && |\n| &&
|
||||
`<body>` && |\n| &&
|
||||
`<script> debugger; if(!z2ui5.MyCC){ jQuery.sap.declare("z2ui5.MyCC");` && |\n| &&
|
||||
|\n| &&
|
||||
` sap.ui.define( [` && |\n| &&
|
||||
` "sap/ui/core/Control",` && |\n| &&
|
||||
` ], function (Control) {` && |\n| &&
|
||||
` "use strict";` && |\n| &&
|
||||
|\n| &&
|
||||
` return Control.extend("z2ui5.MyCC", {` && |\n| &&
|
||||
|\n| &&
|
||||
` metadata: {` && |\n| &&
|
||||
` properties: {` && |\n| &&
|
||||
` value: { type: "string" }` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` events: {` && |\n| &&
|
||||
` "change": {` && |\n| &&
|
||||
` allowPreventDefault: true,` && |\n| &&
|
||||
` parameters: {}` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
|\n| &&
|
||||
` renderer: function (oRm, oControl) {` && |\n| &&
|
||||
|\n| &&
|
||||
` oControl.oInput = new sap.m.Input({` && |\n| &&
|
||||
` value: oControl.getProperty("value")` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
|\n| &&
|
||||
` oControl.oButton = new sap.m.Button({` && |\n| &&
|
||||
` text: 'button text',` && |\n| &&
|
||||
` press: function (oEvent) {` && |\n| &&
|
||||
` // this.oInput._sTypedInValue` && |\n| &&
|
||||
` // this.oInput.getProperty( 'value' ) ` && |\n| &&
|
||||
` this.setProperty("value", this.oInput._sTypedInValue );` && |\n| &&
|
||||
` this.fireChange();` && |\n| &&
|
||||
` }.bind(oControl)` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` oRm.renderControl(oControl.oInput);` && |\n| &&
|
||||
` oRm.renderControl(oControl.oButton);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
`}); } </script>` && |\n| &&
|
||||
|\n| &&
|
||||
`<h1>This is a heading</h1>` && |\n| &&
|
||||
`<p>This is a paragraph.</p>` && |\n| &&
|
||||
`<h1>My First JavaScript</h1>` && |\n| &&
|
||||
`<button type="button" onclick="myFunction()">` && |\n| &&
|
||||
`Click me to display Date and Time.</button>` && |\n| &&
|
||||
`<p id="demo"></p>` && |\n| &&
|
||||
`<script>` && |\n| &&
|
||||
`<p id="demo"></p><svg id="svg" version="1.1"` && |\n| &&
|
||||
` baseProfile="full"` && |\n| &&
|
||||
` width="500" height="500"` && |\n| &&
|
||||
` xmlns="http://www.w3.org/2000/svg">` && |\n| &&
|
||||
` <rect width="100%" height="100%" />` && |\n| &&
|
||||
` <circle id="circle" cx="100" cy="100" r="80" />` && |\n| &&
|
||||
` </svg>` && |\n| &&
|
||||
`<div>X: <input id="sliderX" type="range" min="1" max="500" value="100" /></div><canvas id="canvas" width="500" height="300"></canvas>` && |\n| &&
|
||||
`<script> debugger; let canvas = document.getElementById(sap.z2ui5.oView.createId( 'canvas' ));` && |\n| &&
|
||||
` if (canvas.getContext){` && |\n| &&
|
||||
`let context = canvas.getContext('2d');` && |\n| &&
|
||||
`context.fillStyle = 'rgb(200,0,0)';` && |\n| &&
|
||||
`context.fillRect (10, 10, 80, 80);` && |\n| &&
|
||||
`context.fillStyle = 'rgba(0, 0, 200, 0.5)';` && |\n| &&
|
||||
`context.fillRect (100, 10, 80, 80);` && |\n| &&
|
||||
`context.strokeStyle = 'rgb(200,0,0)';` && |\n| &&
|
||||
`context.strokeRect (190, 10, 80, 80);` && |\n| &&
|
||||
`context.strokeStyle = 'rgba(0, 0, 200, 0.5)';` && |\n| &&
|
||||
` context.strokeRect (280, 10, 80, 80);` && |\n| &&
|
||||
` context.fillStyle = 'rgb(200,0,0)';` && |\n| &&
|
||||
` context.fillRect (370, 10, 80, 80);` && |\n| &&
|
||||
` context.clearRect (380, 20, 60, 20);` && |\n| &&
|
||||
` context.fillRect (390, 25, 10, 10);` && |\n| &&
|
||||
` context.fillRect (420, 25, 10, 10);` && |\n| &&
|
||||
` context.clearRect (385, 60, 50, 10); } ` && |\n| &&
|
||||
` function myFunction( ) { sap.z2ui5.oView.getController().onEvent({ 'EVENT' : 'POST', 'METHOD' : 'UPDATE' }, 'this is my data' ) }` && |\n| &&
|
||||
`</script>` &&
|
||||
`</script> <script src="https://cdn.jsdelivr.net/npm/jsbarcode@3.11.5/dist/barcodes/JsBarcode.code128.min.js"> </script>` &&
|
||||
* ` <z2ui5:MyCC change=" ` && client->_event( 'MYCC' ) && `" value="` && client->_bind( mv_value ) && `"/>` && |\n| &&
|
||||
|
||||
`</body>` && |\n| &&
|
||||
`</html> ` && |\n| &&
|
||||
`</mvc:View>`.
|
||||
`</mvc:View>`.
|
||||
|
||||
|
||||
|
||||
|
|
136
src/00/z2ui5_cl_app_demo_29.clas.locals_imp.abap
Normal file
136
src/00/z2ui5_cl_app_demo_29.clas.locals_imp.abap
Normal file
|
@ -0,0 +1,136 @@
|
|||
*"* use this source file for the definition and implementation of
|
||||
*"* local helper classes, interface definitions and type
|
||||
*"* declarations
|
||||
class lcl_repository DEFINITION.
|
||||
|
||||
PUBLIC SECTION.
|
||||
|
||||
class-METHODS get_js_barcode_lib
|
||||
returning
|
||||
value(result) type string.
|
||||
|
||||
|
||||
endclass.
|
||||
|
||||
CLASS lcl_repository IMPLEMENTATION.
|
||||
|
||||
METHOD get_js_barcode_lib.
|
||||
|
||||
result = `` && |\n| &&
|
||||
`!function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable` &&
|
||||
`:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"obj` &&
|
||||
`ect"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){` &&
|
||||
`var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=7)}([function(t,e,n){"use strict";var r;function o(t,e,n){return e in t?` &&
|
||||
`Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}Object.defineProperty(e,"__esModule",{value:!0});var i=e.SET_A=0,a=e.SET_B=1,u=e.SET_C=2,s=(e.SHIFT=98,e.START_A=103),f=e.START_B=104,c=e.START_C=105;e.MODULO=1` &&
|
||||
`03,e.STOP=106,e.FNC1=207,e.SET_BY_CODE=(o(r={},s,i),o(r,f,a),o(r,c,u),r),e.SWAP={101:i,100:a,99:u},e.A_START_CHAR=String.fromCharCode(208),e.B_START_CHAR=String.fromCharCode(209),e.C_START_CHAR=String.fromCharCode(210),e.A_CHARS="[\0-_È-Ï]",e.B_CHA` &&
|
||||
`RS="[ -È-Ï]",e.C_CHARS="(Ï*[0-9]{2}Ï*)",e.BARS=[11011001100,11001101100,11001100110,10010011e3,10010001100,10001001100,10011001e3,10011000100,10001100100,11001001e3,11001000100,11000100100,10110011100,10011011100,10011001110,10111001100,1001110110` &&
|
||||
`0,10011100110,11001110010,11001011100,11001001110,11011100100,11001110100,11101101110,11101001100,11100101100,11100100110,11101100100,11100110100,11100110010,11011011e3,11011000110,11000110110,10100011e3,10001011e3,10001000110,10110001e3,10001101e3` &&
|
||||
`,10001100010,11010001e3,11000101e3,11000100010,10110111e3,10110001110,10001101110,10111011e3,10111000110,10001110110,11101110110,11010001110,11000101110,11011101e3,11011100010,11011101110,11101011e3,11101000110,11100010110,11101101e3,11101100010,11` &&
|
||||
`100011010,11101111010,11001000010,11110001010,1010011e4,10100001100,1001011e4,10010000110,10000101100,10000100110,1011001e4,10110000100,1001101e4,10011000010,10000110100,10000110010,11000010010,1100101e4,11110111010,11000010100,10001111010,10100111` &&
|
||||
`100,10010111100,10010011110,10111100100,10011110100,10011110010,11110100100,11110010100,11110010010,11011011110,11011110110,11110110110,10101111e3,10100011110,10001011110,10111101e3,10111100010,11110101e3,11110100010,10111011110,10111101110,1110101` &&
|
||||
`1110,11110101110,11010000100,1101001e4,11010011100,1100011101011]},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,o=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1` &&
|
||||
`,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),i=n(11),a=(r=i)&&r.__esModule?r:{default:r},u=n(0);var s=function(t){function e(t,n){!function(t,e){` &&
|
||||
`if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof ` &&
|
||||
`e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t.substring(1),n));return r.bytes=t.split("").map((function(t){return t.charCodeAt(0)})),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression mu` &&
|
||||
`st either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),o(e,[{key:"valid"` &&
|
||||
`,value:function(){return/^[\x00-\x7F\xC8-\xD3]+$/.test(this.data)}},{key:"encode",value:function(){var t=this.bytes,n=t.shift()-105,r=u.SET_BY_CODE[n];if(void 0===r)throw new RangeError("The encoding does not start with a start character.");!0===th` &&
|
||||
`is.shouldEncodeAsEan128()&&t.unshift(u.FNC1);var o=e.next(t,1,r);return{text:this.text===this.data?this.text.replace(/[^\x20-\x7E]/g,""):this.text,data:e.getBar(n)+o.result+e.getBar((o.checksum+n)%u.MODULO)+e.getBar(u.STOP)}}},{key:"shouldEncodeAsE` &&
|
||||
`an128",value:function(){var t=this.options.ean128||!1;return"string"==typeof t&&(t="true"===t.toLowerCase()),t}}],[{key:"getBar",value:function(t){return u.BARS[t]?u.BARS[t].toString():""}},{key:"correctIndex",value:function(t,e){if(e===u.SET_A){va` &&
|
||||
`r n=t.shift();return n<32?n+64:n-32}return e===u.SET_B?t.shift()-32:10*(t.shift()-48)+t.shift()-48}},{key:"next",value:function(t,n,r){if(!t.length)return{result:"",checksum:0};var o=void 0,i=void 0;if(t[0]>=200){i=t.shift()-105;var a=u.SWAP[i];voi` &&
|
||||
`d 0!==a?o=e.next(t,n+1,a):(r!==u.SET_A&&r!==u.SET_B||i!==u.SHIFT||(t[0]=r===u.SET_A?t[0]>95?t[0]-96:t[0]:t[0]<32?t[0]+96:t[0]),o=e.next(t,n+1,r))}else i=e.correctIndex(t,r),o=e.next(t,n+1,r);var s=i*n;return{result:e.getBar(i)+o.result,checksum:s+o` &&
|
||||
`.checksum}}}]),e}(a.default);e.default=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnPr` &&
|
||||
`operty.call(n,r)&&(t[r]=n[r])}return t};e.default=function(t,e){return r({},t,e)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){var e=["width","height","textMargin","fontSize","margin","marginT` &&
|
||||
`op","marginBottom","marginLeft","marginRight"];for(var n in e)e.hasOwnProperty(n)&&(n=e[n],"string"==typeof t[n]&&(t[n]=parseInt(t[n],10)));"string"==typeof t.displayValue&&(t.displayValue="false"!=t.displayValue);return t}},function(t,e,n){"use st` &&
|
||||
`rict";Object.defineProperty(e,"__esModule",{value:!0});var r={width:2,height:100,format:"auto",displayValue:!0,fontOptions:"",font:"monospace",text:void 0,textAlign:"center",textPosition:"bottom",textMargin:2,fontSize:20,background:"#ffffff",lineCo` &&
|
||||
`lor:"#000000",margin:10,marginTop:void 0,marginBottom:void 0,marginLeft:void 0,marginRight:void 0,valid:function(){}};e.default=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getTotalWidthOfEncodings=e.calculateE` &&
|
||||
`ncodingAttributes=e.getBarcodePadding=e.getEncodingHeight=e.getMaximumHeightOfEncodings=void 0;var r,o=n(2),i=(r=o)&&r.__esModule?r:{default:r};function a(t,e){return e.height+(e.displayValue&&t.text.length>0?e.fontSize+e.textMargin:0)+e.marginTop+` &&
|
||||
`e.marginBottom}function u(t,e,n){if(n.displayValue&&e<t){if("center"==n.textAlign)return Math.floor((t-e)/2);if("left"==n.textAlign)return 0;if("right"==n.textAlign)return Math.floor(t-e)}return 0}function s(t,e,n){var r;if(n)r=n;else{if("undefined` &&
|
||||
`"==typeof document)return 0;r=document.createElement("canvas").getContext("2d")}r.font=e.fontOptions+" "+e.fontSize+"px "+e.font;var o=r.measureText(t);return o?o.width:0}e.getMaximumHeightOfEncodings=function(t){for(var e=0,n=0;n<t.length;n++)t[n]` &&
|
||||
`.height>e&&(e=t[n].height);return e},e.getEncodingHeight=a,e.getBarcodePadding=u,e.calculateEncodingAttributes=function(t,e,n){for(var r=0;r<t.length;r++){var o,f=t[r],c=(0,i.default)(e,f.options);o=c.displayValue?s(f.text,c,n):0;var l=f.data.lengt` &&
|
||||
`h*c.width;f.width=Math.ceil(Math.max(o,l)),f.height=a(f,c),f.barcodePadding=u(o,l,c)}},e.getTotalWidthOfEncodings=function(t){for(var e=0,n=0;n<t.length;n++)e+=t[n].width;return e}},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))` &&
|
||||
`throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function` &&
|
||||
`"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Obj` &&
|
||||
`ect.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var a=function(t){function e(t,n){r(this,e);var i=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return i.name="InvalidInputException",i.symbology=t` &&
|
||||
`,i.input=n,i.message='"'+i.input+'" is not a valid input for '+i.symbology,i}return i(e,Error),e}(),u=function(t){function e(){r(this,e);var t=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return t.name="InvalidElementException",t.mess` &&
|
||||
`age="Not supported type to render on",t}return i(e,Error),e}(),s=function(t){function e(){r(this,e);var t=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return t.name="NoElementException",t.message="No element to render on.",t}return i(` &&
|
||||
`e,Error),e}();e.InvalidInputException=a,e.InvalidElementException=u,e.NoElementException=s},function(t,e,n){"use strict";var r=d(n(8)),o=d(n(2)),i=d(n(16)),a=d(n(17)),u=d(n(18)),s=d(n(3)),f=d(n(24)),c=n(6),l=d(n(4));function d(t){return t&&t.__esMo` &&
|
||||
`dule?t:{default:t}}var p=function(){},h=function(t,e,n){var r=new p;if(void 0===t)throw Error("No element to render on was provided.");return r._renderProperties=(0,u.default)(t),r._encodings=[],r._options=l.default,r._errorHandler=new f.default(r)` &&
|
||||
`,void 0!==e&&((n=n||{}).format||(n.format=b()),r.options(n)[n.format](e,n).render()),r};for(var v in h.getModule=function(t){return r.default[t]},r.default)r.default.hasOwnProperty(v)&&g(r.default,v);function g(t,e){p.prototype[e]=p.prototype[e.toU` &&
|
||||
`pperCase()]=p.prototype[e.toLowerCase()]=function(n,r){var i=this;return i._errorHandler.wrapBarcodeCall((function(){r.text=void 0===r.text?void 0:""+r.text;var a=(0,o.default)(i._options,r);a=(0,s.default)(a);var u=t[e],f=y(n,u,a);return i._encodi` &&
|
||||
`ngs.push(f),i}))}}function y(t,e,n){var r=new e(t=""+t,n);if(!r.valid())throw new c.InvalidInputException(r.constructor.name,t);var a=r.encode();a=(0,i.default)(a);for(var u=0;u<a.length;u++)a[u].options=(0,o.default)(n,a[u].options);return a}funct` &&
|
||||
`ion b(){return r.default.CODE128?"CODE128":Object.keys(r.default)[0]}function _(t,e,n){e=(0,i.default)(e);for(var r=0;r<e.length;r++)e[r].options=(0,o.default)(n,e[r].options),(0,a.default)(e[r].options);(0,a.default)(n),new(0,t.renderer)(t.element` &&
|
||||
`,e,n).render(),t.afterRender&&t.afterRender()}p.prototype.options=function(t){return this._options=(0,o.default)(this._options,t),this},p.prototype.blank=function(t){var e=new Array(t+1).join("0");return this._encodings.push({data:e}),this},p.proto` &&
|
||||
`type.init=function(){var t;if(this._renderProperties)for(var e in Array.isArray(this._renderProperties)||(this._renderProperties=[this._renderProperties]),this._renderProperties){t=this._renderProperties[e];var n=(0,o.default)(this._options,t.optio` &&
|
||||
`ns);"auto"==n.format&&(n.format=b()),this._errorHandler.wrapBarcodeCall((function(){var e=y(n.value,r.default[n.format.toUpperCase()],n);_(t,e,n)}))}},p.prototype.render=function(){if(!this._renderProperties)throw new c.NoElementException;if(Array.` &&
|
||||
`isArray(this._renderProperties))for(var t=0;t<this._renderProperties.length;t++)_(this._renderProperties[t],this._encodings,this._options);else _(this._renderProperties,this._encodings,this._options);return this},p.prototype._defaults=l.default,"un` &&
|
||||
`defined"!=typeof window&&(window.JsBarcode=h),"undefined"!=typeof jQuery&&(jQuery.fn.JsBarcode=function(t,e){var n=[];return jQuery(this).each((function(){n.push(this)})),h(n,t,e)}),t.exports=h},function(t,e,n){"use strict";Object.defineProperty(e,` &&
|
||||
`"__esModule",{value:!0});var r=n(9);e.default={CODE128:r.CODE128,CODE128A:r.CODE128A,CODE128B:r.CODE128B,CODE128C:r.CODE128C}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CODE128C=e.CODE128B=e.CODE128A=e.CODE128=` &&
|
||||
`void 0;var r=u(n(10)),o=u(n(13)),i=u(n(14)),a=u(n(15));function u(t){return t&&t.__esModule?t:{default:t}}e.CODE128=r.default,e.CODE128A=o.default,e.CODE128B=i.default,e.CODE128C=a.default},function(t,e,n){"use strict";Object.defineProperty(e,"__es` &&
|
||||
`Module",{value:!0});var r=i(n(1)),o=i(n(12));function i(t){return t&&t.__esModule?t:{default:t}}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=ty` &&
|
||||
`peof e?t:e}var u=function(t){function e(t,n){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),/^[\x00-\x7F\xC8-\xD3]+$/.test(t))var r=a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,(0` &&
|
||||
`,o.default)(t),n));else r=a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));return a(r)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.p` &&
|
||||
`rototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e}(r.default);e.default=u},function(t,e,n){"use strict";Object.define` &&
|
||||
`Property(e,"__esModule",{value:!0});e.default=function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.data=e,this.text=n.text||e,this.options=n}},function(t,e,n){"use strict";Object` &&
|
||||
`.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=function(t){return t.match(new RegExp("^"+r.A_CHARS+"*"))[0].length},i=function(t){return t.match(new RegExp("^"+r.B_CHARS+"*"))[0].length},a=function(t){return t.match(new RegExp("^"+r.C_CHAR` &&
|
||||
`S+"*"))[0]};function u(t,e){var n=e?r.A_CHARS:r.B_CHARS,o=t.match(new RegExp("^("+n+"+?)(([0-9]{2}){2,})([^0-9]|$)"));if(o)return o[1]+String.fromCharCode(204)+s(t.substring(o[1].length));var i=t.match(new RegExp("^"+n+"+"))[0];return i.length===t.` &&
|
||||
`length?t:i+String.fromCharCode(e?205:206)+u(t.substring(i.length),!e)}function s(t){var e=a(t),n=e.length;if(n===t.length)return t;t=t.substring(n);var r=o(t)>=i(t);return e+String.fromCharCode(r?206:205)+u(t,r)}e.default=function(t){var e=void 0;i` &&
|
||||
`f(a(t).length>=2)e=r.C_START_CHAR+s(t);else{var n=o(t)>i(t);e=(n?r.A_START_CHAR:r.B_START_CHAR)+u(t,n)}return e.replace(/[\xCD\xCE]([^])[\xCD\xCE]/,(function(t,e){return String.fromCharCode(203)+e}))}},function(t,e,n){"use strict";Object.defineProp` &&
|
||||
`erty(e,"__esModule",{value:!0});var r,o=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n` &&
|
||||
`&&t(e.prototype,n),r&&t(e,r),e}}(),i=n(1),a=(r=i)&&r.__esModule?r:{default:r},u=n(0);var s=function(t){function e(t,n){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e){if(!t)t` &&
|
||||
`hrow new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,u.A_START_CHAR+t,n))}return function(t,e){if("functi` &&
|
||||
`on"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?O` &&
|
||||
`bject.setPrototypeOf(t,e):t.__proto__=e)}(e,t),o(e,[{key:"valid",value:function(){return new RegExp("^"+u.A_CHARS+"+$").test(this.data)}}]),e}(a.default);e.default=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var` &&
|
||||
` r,o=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),` &&
|
||||
`i=n(1),a=(r=i)&&r.__esModule?r:{default:r},u=n(0);var s=function(t){function e(t,n){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e){if(!t)throw new ReferenceError("this hasn'` &&
|
||||
`t been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,u.B_START_CHAR+t,n))}return function(t,e){if("function"!=typeof e&&null!==e)throw new T` &&
|
||||
`ypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto` &&
|
||||
`__=e)}(e,t),o(e,[{key:"valid",value:function(){return new RegExp("^"+u.B_CHARS+"+$").test(this.data)}}]),e}(a.default);e.default=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,o=function(){function t(t,e){for` &&
|
||||
`(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),i=n(1),a=(r=i)&&r.__esModule?r:{def` &&
|
||||
`ault:r},u=n(0);var s=function(t){function e(t,n){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't` &&
|
||||
` been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,u.C_START_CHAR+t,n))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must eit` &&
|
||||
`her be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),o(e,[{key:"valid",value` &&
|
||||
`:function(){return new RegExp("^"+u.C_CHARS+"+$").test(this.data)}}]),e}(a.default);e.default=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){var e=[];return function t(n){if(Array.isArray(n))f` &&
|
||||
`or(var r=0;r<n.length;r++)t(n[r]);else n.text=n.text||"",n.data=n.data||"",e.push(n)}(t),e}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){return t.marginTop=t.marginTop||t.margin,t.marginBottom` &&
|
||||
`=t.marginBottom||t.margin,t.marginRight=t.marginRight||t.margin,t.marginLeft=t.marginLeft||t.margin,t}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?` &&
|
||||
`function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=u(n(19)),i=u(n(20)),a=n(6);function u(t){return t&&t.__esModule?t:{default:t}}function s(t){if("string"=` &&
|
||||
`=typeof t)return function(t){var e=document.querySelectorAll(t);if(0===e.length)return;for(var n=[],r=0;r<e.length;r++)n.push(s(e[r]));return n}(t);if(Array.isArray(t)){for(var e=[],n=0;n<t.length;n++)e.push(s(t[n]));return e}if("undefined"!=typeof` &&
|
||||
` HTMLCanvasElement&&t instanceof HTMLImageElement)return u=t,{element:f=document.createElement("canvas"),options:(0,o.default)(u),renderer:i.default.CanvasRenderer,afterRender:function(){u.setAttribute("src",f.toDataURL())}};if(t&&t.nodeName&&"svg"` &&
|
||||
`===t.nodeName.toLowerCase()||"undefined"!=typeof SVGElement&&t instanceof SVGElement)return{element:t,options:(0,o.default)(t),renderer:i.default.SVGRenderer};if("undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement)return{element:t` &&
|
||||
`,options:(0,o.default)(t),renderer:i.default.CanvasRenderer};if(t&&t.getContext)return{element:t,renderer:i.default.CanvasRenderer};if(t&&"object"===(void 0===t?"undefined":r(t))&&!t.nodeName)return{element:t,renderer:i.default.ObjectRenderer};thro` &&
|
||||
`w new a.InvalidElementException;var u,f}e.default=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(n(3)),o=i(n(4));function i(t){return t&&t.__esModule?t:{default:t}}e.default=function(t){var e={};for(var n i` &&
|
||||
`n o.default)o.default.hasOwnProperty(n)&&(t.hasAttribute("jsbarcode-"+n.toLowerCase())&&(e[n]=t.getAttribute("jsbarcode-"+n.toLowerCase())),t.hasAttribute("data-"+n.toLowerCase())&&(e[n]=t.getAttribute("data-"+n.toLowerCase())));return e.value=t.ge` &&
|
||||
`tAttribute("jsbarcode-value")||t.getAttribute("data-value"),e=(0,r.default)(e)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=a(n(21)),o=a(n(22)),i=a(n(23));function a(t){return t&&t.__esModule?t:{default:t}}e` &&
|
||||
`.default={CanvasRenderer:r.default,SVGRenderer:o.default,ObjectRenderer:i.default}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,o=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable` &&
|
||||
`=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),i=n(2),a=(r=i)&&r.__esModule?r:{default:r},u=n(5);var s=function(){function t(e,n,r` &&
|
||||
`){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.canvas=e,this.encodings=n,this.options=r}return o(t,[{key:"render",value:function(){if(!this.canvas.getContext)throw new Error("The browser` &&
|
||||
` does not support canvas.");this.prepareCanvas();for(var t=0;t<this.encodings.length;t++){var e=(0,a.default)(this.options,this.encodings[t].options);this.drawCanvasBarcode(e,this.encodings[t]),this.drawCanvasText(e,this.encodings[t]),this.moveCanv` &&
|
||||
`asDrawing(this.encodings[t])}this.restoreCanvas()}},{key:"prepareCanvas",value:function(){var t=this.canvas.getContext("2d");t.save(),(0,u.calculateEncodingAttributes)(this.encodings,this.options,t);var e=(0,u.getTotalWidthOfEncodings)(this.encodin` &&
|
||||
`gs),n=(0,u.getMaximumHeightOfEncodings)(this.encodings);this.canvas.width=e+this.options.marginLeft+this.options.marginRight,this.canvas.height=n,t.clearRect(0,0,this.canvas.width,this.canvas.height),this.options.background&&(t.fillStyle=this.optio` &&
|
||||
`ns.background,t.fillRect(0,0,this.canvas.width,this.canvas.height)),t.translate(this.options.marginLeft,0)}},{key:"drawCanvasBarcode",value:function(t,e){var n,r=this.canvas.getContext("2d"),o=e.data;n="top"==t.textPosition?t.marginTop+t.fontSize+t` &&
|
||||
`.textMargin:t.marginTop,r.fillStyle=t.lineColor;for(var i=0;i<o.length;i++){var a=i*t.width+e.barcodePadding;"1"===o[i]?r.fillRect(a,n,t.width,t.height):o[i]&&r.fillRect(a,n,t.width,t.height*o[i])}}},{key:"drawCanvasText",value:function(t,e){var n,` &&
|
||||
`r,o=this.canvas.getContext("2d"),i=t.fontOptions+" "+t.fontSize+"px "+t.font;t.displayValue&&(r="top"==t.textPosition?t.marginTop+t.fontSize-t.textMargin:t.height+t.textMargin+t.marginTop+t.fontSize,o.font=i,"left"==t.textAlign||e.barcodePadding>0?` &&
|
||||
`(n=0,o.textAlign="left"):"right"==t.textAlign?(n=e.width-1,o.textAlign="right"):(n=e.width/2,o.textAlign="center"),o.fillText(e.text,n,r))}},{key:"moveCanvasDrawing",value:function(t){this.canvas.getContext("2d").translate(t.width,0)}},{key:"restor` &&
|
||||
`eCanvas",value:function(){this.canvas.getContext("2d").restore()}}]),t}();e.default=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,o=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumera` &&
|
||||
`ble=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),i=n(2),a=(r=i)&&r.__esModule?r:{default:r},u=n(5);var s="http://www.w3.org/2000/` &&
|
||||
`svg",f=function(){function t(e,n,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.svg=e,this.encodings=n,this.options=r,this.document=r.xmlDocument||document}return o(t,[{key:"render",val` &&
|
||||
`ue:function(){var t=this.options.marginLeft;this.prepareSVG();for(var e=0;e<this.encodings.length;e++){var n=this.encodings[e],r=(0,a.default)(this.options,n.options),o=this.createGroup(t,r.marginTop,this.svg);this.setGroupOptions(o,r),this.drawSvg` &&
|
||||
`Barcode(o,r,n),this.drawSVGText(o,r,n),t+=n.width}}},{key:"prepareSVG",value:function(){for(;this.svg.firstChild;)this.svg.removeChild(this.svg.firstChild);(0,u.calculateEncodingAttributes)(this.encodings,this.options);var t=(0,u.getTotalWidthOfEnc` &&
|
||||
`odings)(this.encodings),e=(0,u.getMaximumHeightOfEncodings)(this.encodings),n=t+this.options.marginLeft+this.options.marginRight;this.setSvgAttributes(n,e),this.options.background&&this.drawRect(0,0,n,e,this.svg).setAttribute("style","fill:"+this.o` &&
|
||||
`ptions.background+";")}},{key:"drawSvgBarcode",value:function(t,e,n){var r,o=n.data;r="top"==e.textPosition?e.fontSize+e.textMargin:0;for(var i=0,a=0,u=0;u<o.length;u++)a=u*e.width+n.barcodePadding,"1"===o[u]?i++:i>0&&(this.drawRect(a-e.width*i,r,e` &&
|
||||
`.width*i,e.height,t),i=0);i>0&&this.drawRect(a-e.width*(i-1),r,e.width*i,e.height,t)}},{key:"drawSVGText",value:function(t,e,n){var r,o,i=this.document.createElementNS(s,"text");e.displayValue&&(i.setAttribute("style","font:"+e.fontOptions+" "+e.fo` &&
|
||||
`ntSize+"px "+e.font),o="top"==e.textPosition?e.fontSize-e.textMargin:e.height+e.textMargin+e.fontSize,"left"==e.textAlign||n.barcodePadding>0?(r=0,i.setAttribute("text-anchor","start")):"right"==e.textAlign?(r=n.width-1,i.setAttribute("text-anchor"` &&
|
||||
`,"end")):(r=n.width/2,i.setAttribute("text-anchor","middle")),i.setAttribute("x",r),i.setAttribute("y",o),i.appendChild(this.document.createTextNode(n.text)),t.appendChild(i))}},{key:"setSvgAttributes",value:function(t,e){var n=this.svg;n.setAttrib` &&
|
||||
`ute("width",t+"px"),n.setAttribute("height",e+"px"),n.setAttribute("x","0px"),n.setAttribute("y","0px"),n.setAttribute("viewBox","0 0 "+t+" "+e),n.setAttribute("xmlns",s),n.setAttribute("version","1.1"),n.setAttribute("style","transform: translate(` &&
|
||||
`0,0)")}},{key:"createGroup",value:function(t,e,n){var r=this.document.createElementNS(s,"g");return r.setAttribute("transform","translate("+t+", "+e+")"),n.appendChild(r),r}},{key:"setGroupOptions",value:function(t,e){t.setAttribute("style","fill:"` &&
|
||||
`+e.lineColor+";")}},{key:"drawRect",value:function(t,e,n,r,o){var i=this.document.createElementNS(s,"rect");return i.setAttribute("x",t),i.setAttribute("y",e),i.setAttribute("width",n),i.setAttribute("height",r),o.appendChild(i),i}}]),t}();e.defaul` &&
|
||||
`t=f},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.definePro` &&
|
||||
`perty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();var o=function(){function t(e,n,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.object=e,this.encoding` &&
|
||||
`s=n,this.options=r}return r(t,[{key:"render",value:function(){this.object.encodings=this.encodings}}]),t}();e.default=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n<e.` &&
|
||||
`length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();var o=function(){function t(e){!function(t,e){if` &&
|
||||
`(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.api=e}return r(t,[{key:"handleCatch",value:function(t){if("InvalidInputException"!==t.name)throw t;if(this.api._options.valid===this.api._defaults.valid)throw` &&
|
||||
` t.message;this.api._options.valid(!1),this.api.render=function(){}}},{key:"wrapBarcodeCall",value:function(t){try{var e=t.apply(void 0,arguments);return this.api._options.valid(!0),e}catch(t){return this.handleCatch(t),this.api}}}]),t}();e.default` &&
|
||||
`=o}]);`.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
|
@ -22,6 +22,9 @@ CLASS z2ui5_cl_xml_view_helper DEFINITION
|
|||
DATA t_child TYPE STANDARD TABLE OF REF TO z2ui5_cl_xml_view_helper WITH EMPTY KEY.
|
||||
|
||||
CLASS-METHODS factory
|
||||
IMPORTING
|
||||
ns TYPE string_table OPTIONAL
|
||||
check_shell TYPE abap_bool DEFAULT abap_true
|
||||
RETURNING
|
||||
VALUE(result) TYPE REF TO z2ui5_cl_xml_view_helper.
|
||||
|
||||
|
@ -148,7 +151,7 @@ CLASS z2ui5_cl_xml_view_helper DEFINITION
|
|||
VALUE(result) TYPE REF TO z2ui5_cl_xml_view_helper.
|
||||
|
||||
METHODS snapped_content
|
||||
IMPORTING
|
||||
IMPORTING
|
||||
ns TYPE clike DEFAULT `uxap`
|
||||
RETURNING
|
||||
VALUE(result) TYPE REF TO z2ui5_cl_xml_view_helper.
|
||||
|
@ -166,7 +169,7 @@ CLASS z2ui5_cl_xml_view_helper DEFINITION
|
|||
VALUE(result) TYPE REF TO z2ui5_cl_xml_view_helper.
|
||||
|
||||
METHODS actions
|
||||
IMPORTING
|
||||
IMPORTING
|
||||
ns TYPE clike DEFAULT `uxap`
|
||||
RETURNING
|
||||
VALUE(result) TYPE REF TO z2ui5_cl_xml_view_helper.
|
||||
|
@ -480,6 +483,7 @@ CLASS z2ui5_cl_xml_view_helper DEFINITION
|
|||
press TYPE clike OPTIONAL
|
||||
class TYPE clike OPTIONAL
|
||||
id TYPE clike OPTIONAL
|
||||
ns TYPE clike OPTIONAL
|
||||
RETURNING
|
||||
VALUE(result) TYPE REF TO z2ui5_cl_xml_view_helper.
|
||||
|
||||
|
@ -490,6 +494,7 @@ CLASS z2ui5_cl_xml_view_helper DEFINITION
|
|||
shownavbutton TYPE clike OPTIONAL
|
||||
id TYPE clike OPTIONAL
|
||||
class TYPE clike OPTIONAL
|
||||
ns TYPE clike OPTIONAL
|
||||
PREFERRED PARAMETER title
|
||||
RETURNING
|
||||
VALUE(result) TYPE REF TO z2ui5_cl_xml_view_helper.
|
||||
|
@ -528,7 +533,7 @@ CLASS z2ui5_cl_xml_view_helper DEFINITION
|
|||
RETURNING
|
||||
VALUE(result) TYPE REF TO z2ui5_cl_xml_view_helper.
|
||||
|
||||
METHODS zz_html
|
||||
METHODS zz_plain
|
||||
IMPORTING
|
||||
val TYPE clike OPTIONAL
|
||||
RETURNING
|
||||
|
@ -536,7 +541,7 @@ CLASS z2ui5_cl_xml_view_helper DEFINITION
|
|||
|
||||
METHODS content
|
||||
IMPORTING
|
||||
ns TYPE clike optional
|
||||
ns TYPE clike OPTIONAL
|
||||
RETURNING
|
||||
VALUE(result) TYPE REF TO z2ui5_cl_xml_view_helper.
|
||||
|
||||
|
@ -576,6 +581,8 @@ CLASS z2ui5_cl_xml_view_helper DEFINITION
|
|||
VALUE(result) TYPE REF TO z2ui5_cl_xml_view_helper.
|
||||
|
||||
METHODS toolbar_spacer
|
||||
IMPORTING
|
||||
ns TYPE clike OPTIONAL
|
||||
RETURNING
|
||||
VALUE(result) TYPE REF TO z2ui5_cl_xml_view_helper.
|
||||
|
||||
|
@ -620,6 +627,7 @@ CLASS z2ui5_cl_xml_view_helper DEFINITION
|
|||
text TYPE clike OPTIONAL
|
||||
href TYPE clike OPTIONAL
|
||||
enabled TYPE clike OPTIONAL
|
||||
ns TYPE clike OPTIONAL
|
||||
RETURNING
|
||||
VALUE(result) TYPE REF TO z2ui5_cl_xml_view_helper.
|
||||
|
||||
|
@ -787,6 +795,7 @@ CLASS z2ui5_cl_xml_view_helper DEFINITION
|
|||
IMPORTING
|
||||
text TYPE clike OPTIONAL
|
||||
class TYPE clike OPTIONAL
|
||||
ns TYPE clike OPTIONAL
|
||||
PREFERRED PARAMETER text
|
||||
RETURNING
|
||||
VALUE(result) TYPE REF TO z2ui5_cl_xml_view_helper.
|
||||
|
@ -815,26 +824,13 @@ CLASS z2ui5_cl_xml_view_helper DEFINITION
|
|||
VALUE(result) TYPE REF TO z2ui5_cl_xml_view_helper.
|
||||
|
||||
METHODS xml_get
|
||||
IMPORTING
|
||||
check_shell TYPE abap_bool DEFAULT abap_true
|
||||
RETURNING
|
||||
VALUE(result) TYPE string.
|
||||
|
||||
|
||||
PROTECTED SECTION.
|
||||
|
||||
|
||||
METHODS xml_get_begin
|
||||
IMPORTING
|
||||
check_shell TYPE abap_bool DEFAULT abap_true
|
||||
RETURNING
|
||||
VALUE(result) TYPE string.
|
||||
|
||||
|
||||
|
||||
METHODS xml_get_end
|
||||
IMPORTING
|
||||
check_shell TYPE abap_bool DEFAULT abap_true
|
||||
RETURNING
|
||||
VALUE(result) TYPE string.
|
||||
|
||||
|
@ -870,6 +866,8 @@ CLASS z2ui5_cl_xml_view_helper IMPLEMENTATION.
|
|||
( `xmlns:html="http://www.w3.org/1999/xhtml"` )
|
||||
).
|
||||
|
||||
ELSE.
|
||||
mt_ns = ns.
|
||||
ENDIF.
|
||||
|
||||
ENDMETHOD.
|
||||
|
@ -877,12 +875,16 @@ CLASS z2ui5_cl_xml_view_helper IMPLEMENTATION.
|
|||
|
||||
METHOD factory.
|
||||
|
||||
" result = NEW #( ).
|
||||
DATA(lo_tree) = NEW z2ui5_cl_xml_view_helper( ).
|
||||
DATA(lo_tree) = NEW z2ui5_cl_xml_view_helper( ns = ns ).
|
||||
lo_tree->m_root = lo_tree.
|
||||
lo_tree->m_parent = lo_tree.
|
||||
result = lo_tree.
|
||||
" result->mo_runtime = runtime.
|
||||
|
||||
if check_shell = abap_true.
|
||||
|
||||
result = result->_generic( 'Shell' ).
|
||||
|
||||
endif.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
@ -894,17 +896,10 @@ CLASS z2ui5_cl_xml_view_helper IMPLEMENTATION.
|
|||
result = result && ` ` && lr_ns->* && ` `.
|
||||
ENDLOOP.
|
||||
result = result && `>`.
|
||||
result = result && COND #( WHEN check_shell = abap_true THEN `<Shell>` ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD xml_get_end.
|
||||
|
||||
result = COND #( WHEN check_shell = abap_true THEN `</Shell>` ) && `</mvc:View>`.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD header.
|
||||
|
||||
result = _generic(
|
||||
|
@ -986,6 +981,7 @@ CLASS z2ui5_cl_xml_view_helper IMPLEMENTATION.
|
|||
result = me.
|
||||
_generic(
|
||||
name = `Button`
|
||||
ns = ns
|
||||
t_prop = VALUE #(
|
||||
( n = `press` v = press )
|
||||
( n = `text` v = text )
|
||||
|
@ -1530,6 +1526,7 @@ CLASS z2ui5_cl_xml_view_helper IMPLEMENTATION.
|
|||
result = me.
|
||||
_generic(
|
||||
name = `Link`
|
||||
ns = ns
|
||||
t_prop = VALUE #(
|
||||
( n = `text` v = text )
|
||||
( n = `target` v = `_blank` )
|
||||
|
@ -1706,6 +1703,7 @@ CLASS z2ui5_cl_xml_view_helper IMPLEMENTATION.
|
|||
|
||||
result = _generic(
|
||||
name = `Page`
|
||||
ns = ns
|
||||
t_prop = VALUE #(
|
||||
( n = `title` v = title )
|
||||
( n = `showNavButton` v = _=>get_json_boolean( shownavbutton ) )
|
||||
|
@ -2014,6 +2012,7 @@ CLASS z2ui5_cl_xml_view_helper IMPLEMENTATION.
|
|||
result = me.
|
||||
_generic(
|
||||
name = `Text`
|
||||
ns = ns
|
||||
t_prop = VALUE #(
|
||||
( n = `text` v = text )
|
||||
( n = `class` v = class )
|
||||
|
@ -2060,7 +2059,7 @@ CLASS z2ui5_cl_xml_view_helper IMPLEMENTATION.
|
|||
result = me.
|
||||
_generic(
|
||||
ns = ns
|
||||
name = cond #( when ns = 'f' then 'title' else `Title` )
|
||||
name = COND #( WHEN ns = 'f' THEN 'title' ELSE `Title` )
|
||||
t_prop = VALUE #(
|
||||
( n = `text` v = text )
|
||||
( n = `wrapping` v = _=>get_json_boolean( wrapping ) )
|
||||
|
@ -2111,7 +2110,10 @@ CLASS z2ui5_cl_xml_view_helper IMPLEMENTATION.
|
|||
METHOD toolbar_spacer.
|
||||
|
||||
result = me.
|
||||
_generic( `ToolbarSpacer` ).
|
||||
_generic(
|
||||
name = `ToolbarSpacer`
|
||||
ns = ns
|
||||
).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
@ -2150,13 +2152,13 @@ CLASS z2ui5_cl_xml_view_helper IMPLEMENTATION.
|
|||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
result = xml_get_begin( check_shell ).
|
||||
result = xml_get_begin( ).
|
||||
|
||||
LOOP AT t_child INTO DATA(lr_child).
|
||||
result = result && CAST z2ui5_cl_xml_view_helper( lr_child )->xml_get( ).
|
||||
ENDLOOP.
|
||||
|
||||
result = result && xml_get_end( check_shell ).
|
||||
result = result && `</mvc:View>`.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
|
@ -2165,6 +2167,9 @@ CLASS z2ui5_cl_xml_view_helper IMPLEMENTATION.
|
|||
WHEN `ZZHTML`.
|
||||
result = mt_prop[ n = `VALUE` ]-v.
|
||||
RETURN.
|
||||
WHEN `ZZPLAIN`.
|
||||
result = mt_prop[ n = `VALUE` ]-v.
|
||||
RETURN.
|
||||
ENDCASE.
|
||||
|
||||
DATA(lv_tmp2) = COND #( WHEN m_ns <> `` THEN |{ m_ns }:| ).
|
||||
|
@ -2205,31 +2210,6 @@ CLASS z2ui5_cl_xml_view_helper IMPLEMENTATION.
|
|||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD zz_html.
|
||||
|
||||
SPLIT val AT `<` INTO TABLE DATA(lt_table).
|
||||
|
||||
DATA(lv_html) = ``.
|
||||
lv_html = VALUE #( lt_table[ 1 ] OPTIONAL ).
|
||||
|
||||
LOOP AT lt_table REFERENCE INTO DATA(lr_line) FROM 2.
|
||||
IF lr_line->*(1) = `/`.
|
||||
lv_html = `</html:` && lr_line->*.
|
||||
ELSE.
|
||||
lv_html = `<html:` && lr_line->*.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
|
||||
result = me.
|
||||
_generic(
|
||||
name = `ZZHTML`
|
||||
t_prop = VALUE #( ( n = `VALUE` v = lv_html ) )
|
||||
).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD _generic.
|
||||
|
||||
DATA(result2) = NEW z2ui5_cl_xml_view_helper( ).
|
||||
|
@ -2293,4 +2273,14 @@ CLASS z2ui5_cl_xml_view_helper IMPLEMENTATION.
|
|||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD zz_plain.
|
||||
|
||||
result = me.
|
||||
_generic(
|
||||
name = `ZZPLAIN`
|
||||
t_prop = VALUE #( ( n = `VALUE` v = val ) )
|
||||
).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
|
|
|
@ -58,7 +58,7 @@ CLASS z2ui5_cl_http_handler IMPLEMENTATION.
|
|||
result = lo_runtime->request_end( ).
|
||||
|
||||
CATCH cx_root INTO DATA(x).
|
||||
lo_runtime = lo_runtime->set_app_system_error( x ).
|
||||
lo_runtime = lo_runtime->set_app_system( x ).
|
||||
CONTINUE.
|
||||
ENDTRY.
|
||||
|
||||
|
@ -108,8 +108,8 @@ CLASS z2ui5_cl_http_handler IMPLEMENTATION.
|
|||
r_result = r_result && `<script>` && |\n| &&
|
||||
` sap.ui.getCore().attachInit(function () {` && |\n| &&
|
||||
` "use strict";` && |\n| &&
|
||||
|
||||
` sap.ui.define(["sap/ui/core/mvc/Controller", "sap/ui/model/odata/v2/ODataModel", "sap/ui/model/json/JSONModel", "sap/m/MessageBox", "sap/ui/core/Fragment"], function (Controller, ODataModel, JSONModel, MessageBox, Fragment) {` && |\n| &&
|
||||
|\n| &&
|
||||
` sap.ui.define(["sap/ui/core/mvc/Controller", "sap/ui/model/json/JSONModel", "sap/m/MessageBox", "sap/ui/core/Fragment"], function (Controller, JSONModel, MessageBox, Fragment) {` && |\n| &&
|
||||
` "use strict";` && |\n| &&
|
||||
` return Controller.extend("z2ui5_controller", {` && |\n| &&
|
||||
|\n| &&
|
||||
|
@ -139,25 +139,29 @@ CLASS z2ui5_cl_http_handler IMPLEMENTATION.
|
|||
` // index: the ordinal position of the key within the object ` && |\n| &&
|
||||
` }));` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` if (sap.z2ui5.oResponse.vViewPopup) {` && |\n| &&
|
||||
` new sap.ui.core.Fragment.load({` && |\n| &&
|
||||
` definition: sap.z2ui5.oResponse.vViewPopup,` && |\n| &&
|
||||
` controller: this,` && |\n| &&
|
||||
` }).then(function (oFragment) {` && |\n| &&
|
||||
` oFragment.setModel(new JSONModel(sap.z2ui5.oResponse.oViewModel))` && |\n| &&
|
||||
` this.getView().addDependent(oFragment);` && |\n| &&
|
||||
` if (!sap.z2ui5.oResponse.OPENBY){ oFragment.open(); }else{` && |\n| &&
|
||||
` oFragment.openBy( this.getView().byId( sap.z2ui5.oResponse.OPENBY ) ) } ` && |\n| &&
|
||||
` sap.z2ui5.oResponse.oViewPopup = oFragment;` && |\n| &&
|
||||
` sap.ui.core.BusyIndicator.hide();` && |\n| &&
|
||||
` }.bind(this)); }` && |\n| &&
|
||||
` if (sap.z2ui5.oResponse.vViewPopup) {` && |\n| &&
|
||||
` new sap.ui.core.Fragment.load({` && |\n| &&
|
||||
` definition: sap.z2ui5.oResponse.vViewPopup,` && |\n| &&
|
||||
` controller: this,` && |\n| &&
|
||||
` }).then(function (oFragment) {` && |\n| &&
|
||||
` oFragment.setModel(new JSONModel(sap.z2ui5.oResponse.oViewModel))` && |\n| &&
|
||||
` this.getView().addDependent(oFragment);` && |\n| &&
|
||||
` if (!sap.z2ui5.oResponse.OPENBY) { oFragment.open(); } else {` && |\n| &&
|
||||
` oFragment.openBy(this.getView().byId(sap.z2ui5.oResponse.OPENBY))` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` sap.z2ui5.oResponse.oViewPopup = oFragment;` && |\n| &&
|
||||
` sap.ui.core.BusyIndicator.hide();` && |\n| &&
|
||||
` }.bind(this));` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` sap.ui.core.BusyIndicator.hide();` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
|\n| &&
|
||||
` onEventFrontend: function (vAction) {` && |\n| &&
|
||||
|\n| &&
|
||||
` if (vAction == 'POPUP_CLOSE') {` && |\n| &&
|
||||
` sap.z2ui5.oResponse.oViewPopup.close();` && |\n| &&
|
||||
` if (sap.z2ui5.oResponse.oViewPopup.close) {` && |\n| &&
|
||||
` sap.z2ui5.oResponse.oViewPopup.close();` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` sap.z2ui5.oResponse.oViewPopup.destroy();` && |\n| &&
|
||||
` delete sap.z2ui5.oResponse.oViewPopup;` && |\n| &&
|
||||
` delete sap.z2ui5.oResponse.oSystem.VIEW_POPUP;` && |\n| &&
|
||||
|
@ -174,10 +178,12 @@ CLASS z2ui5_cl_http_handler IMPLEMENTATION.
|
|||
|\n| &&
|
||||
` sap.ui.core.BusyIndicator.show();` && |\n| &&
|
||||
` this.oBody = {};` && |\n| &&
|
||||
` ` && |\n| &&
|
||||
|\n| &&
|
||||
` if (sap.z2ui5.oResponse.oViewPopup) {` && |\n| &&
|
||||
` this.oBody.oUpdate = sap.z2ui5.oResponse.oViewPopup.getModel().oData.oUpdate;` && |\n| &&
|
||||
` sap.z2ui5.oResponse.oViewPopup.close();` && |\n| &&
|
||||
` if (sap.z2ui5.oResponse.oViewPopup.close) {` && |\n| &&
|
||||
` sap.z2ui5.oResponse.oViewPopup.close();` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` sap.z2ui5.oResponse.oViewPopup.destroy();` && |\n| &&
|
||||
` } else {` && |\n| &&
|
||||
` this.oBody.oUpdate = this.oView.getModel().oData.oUpdate;` && |\n| &&
|
||||
|
@ -201,7 +207,7 @@ CLASS z2ui5_cl_http_handler IMPLEMENTATION.
|
|||
` Roundtrip: function () {` && |\n| &&
|
||||
|\n| &&
|
||||
` var xhr = new XMLHttpRequest();` && |\n| &&
|
||||
` var url = '` && lv_url && `';` && |\n| &&
|
||||
` var url = '` && lv_url && `';` && |\n| &&
|
||||
` xhr.open("POST", url, true);` && |\n| &&
|
||||
` xhr.onload = function (that) {` && |\n| &&
|
||||
|\n| &&
|
||||
|
@ -227,8 +233,6 @@ CLASS z2ui5_cl_http_handler IMPLEMENTATION.
|
|||
` if (sap.z2ui5.oResponse.oAfter) {` && |\n| &&
|
||||
` sap.z2ui5.oResponse.oAfter.forEach(item => sap.m[item[0]][item[1]](item[2]));` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
|\n| &&
|
||||
|
||||
|\n| &&
|
||||
` if (sap.z2ui5.oResponse.vView) {` && |\n| &&
|
||||
` var oModel = new JSONModel(sap.z2ui5.oResponse.oViewModel);` && |\n| &&
|
||||
|
@ -239,11 +243,10 @@ CLASS z2ui5_cl_http_handler IMPLEMENTATION.
|
|||
` oView.placeAt("content");` && |\n| &&
|
||||
` this.oView = oView;` && |\n| &&
|
||||
` sap.z2ui5.oView = oView;` && |\n| &&
|
||||
` } ); ` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` } else if (sap.z2ui5.oResponse.SET_PREV_VIEW == true) {` && |\n| &&
|
||||
|\n| &&
|
||||
` var oModel = new JSONModel(sap.z2ui5.oResponseOld.oViewModel);` && |\n| &&
|
||||
` var oView = new sap.ui.core.mvc.XMLView.create({ ` && |\n| &&
|
||||
` var oView = new sap.ui.core.mvc.XMLView.create({` && |\n| &&
|
||||
` definition: sap.z2ui5.oResponseOld.vView` && |\n| &&
|
||||
` }).then(oView => {` && |\n| &&
|
||||
` oView.setModel(oModel);` && |\n| &&
|
||||
|
@ -251,144 +254,26 @@ CLASS z2ui5_cl_http_handler IMPLEMENTATION.
|
|||
` this.oView = oView;` && |\n| &&
|
||||
` sap.z2ui5.oView = oView;` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` } }.bind(this);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` }.bind(this);` && |\n| &&
|
||||
` xhr.send(JSON.stringify(this.oBody));` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` var oView = sap.ui.xmlview({` && |\n| &&
|
||||
` viewContent: "<mvc:View controllerName='z2ui5_controller' xmlns:mvc='sap.ui.core.mvc' />"` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
|\n| &&
|
||||
` sap.z2ui5 = {};` && |\n| &&
|
||||
` oView.getController().Roundtrip();`.
|
||||
` var oView = new sap.ui.core.mvc.View.create({` && |\n| &&
|
||||
` type: 'XML',` && |\n| &&
|
||||
` definition: "<mvc:View controllerName='z2ui5_controller' xmlns:mvc='sap.ui.core.mvc' />",` && |\n| &&
|
||||
` }).then(oView => {` && |\n| &&
|
||||
` oView.getController().Roundtrip();` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
|\n| &&
|
||||
` });` && |\n| &&
|
||||
|\n| &&
|
||||
`</script>` && |\n| &&
|
||||
|\n| &&
|
||||
`</html>`.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
r_result = r_result && ` jQuery.sap.declare("my.library");` && |\n| &&
|
||||
` jQuery.sap.require("sap.ui.core.Core");` && |\n| &&
|
||||
` jQuery.sap.require("sap.ui.core.library");` && |\n| &&
|
||||
|\n| &&
|
||||
` sap.ui.getCore().initLibrary({` && |\n| &&
|
||||
` name: "z2ui5",` && |\n| &&
|
||||
` dependencies: ["sap.ui.core"],` && |\n| &&
|
||||
` types: [],` && |\n| &&
|
||||
` interfaces: [],` && |\n| &&
|
||||
` controls: ["z2ui5.FileUploader"],` && |\n| &&
|
||||
` elements: [],` && |\n| &&
|
||||
` version: "0.0.1-SNAPSHOT"` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
|\n| &&
|
||||
` jQuery.sap.declare("z2ui5.FileUploader");` && |\n| &&
|
||||
|\n| &&
|
||||
` sap.ui.define([` && |\n| &&
|
||||
` "sap/ui/core/Control",` && |\n| &&
|
||||
` "sap/m/Button",` && |\n| &&
|
||||
` "sap/ui/unified/FileUploader"` && |\n| &&
|
||||
` ], function (Control, Button, FileUploader) {` && |\n| &&
|
||||
` "use strict";` && |\n| &&
|
||||
|\n| &&
|
||||
` return Control.extend("z2ui5.FileUploader", {` && |\n| &&
|
||||
|\n| &&
|
||||
` metadata: {` && |\n| &&
|
||||
` properties: {` && |\n| &&
|
||||
` value: {` && |\n| &&
|
||||
` type: "string",` && |\n| &&
|
||||
` defaultValue: ""` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` path: {` && |\n| &&
|
||||
` type: "string",` && |\n| &&
|
||||
` defaultValue: ""` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` tooltip: {` && |\n| &&
|
||||
` type: "string",` && |\n| &&
|
||||
` defaultValue: ""` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` fileType: {` && |\n| &&
|
||||
` type: "string",` && |\n| &&
|
||||
` defaultValue: ""` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` placeholder: {` && |\n| &&
|
||||
` type: "string",` && |\n| &&
|
||||
` defaultValue: ""` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` buttonText: {` && |\n| &&
|
||||
` type: "string",` && |\n| &&
|
||||
` defaultValue: "Upload"` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` enabled: {` && |\n| &&
|
||||
` type: "boolean",` && |\n| &&
|
||||
` defaultValue: true` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` multiple: {` && |\n| &&
|
||||
` type: "boolean",` && |\n| &&
|
||||
` defaultValue: false` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
|\n| &&
|
||||
|\n| &&
|
||||
` aggregations: {` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` events: {` && |\n| &&
|
||||
` "upload": {` && |\n| &&
|
||||
` allowPreventDefault: true,` && |\n| &&
|
||||
` parameters: {}` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
` renderer: null` && |\n| &&
|
||||
` },` && |\n| &&
|
||||
|\n| &&
|
||||
` renderer: function (oRm, oControl) {` && |\n| &&
|
||||
|\n| &&
|
||||
` oControl.oUploadButton = new Button({` && |\n| &&
|
||||
` text: oControl.getProperty("buttonText"),` && |\n| &&
|
||||
` enabled: oControl.getProperty("path") !== "",` && |\n| &&
|
||||
` press: function (oEvent) {` && |\n| &&
|
||||
|\n| &&
|
||||
` this.setProperty("path", this.oFileUploader.getProperty("value"));` && |\n| &&
|
||||
|\n| &&
|
||||
` var file = this.oFileUploader.oFileUpload.files[0];` && |\n| &&
|
||||
` var reader = new FileReader();` && |\n| &&
|
||||
|\n| &&
|
||||
` reader.onload = function (evt) {` && |\n| &&
|
||||
` var vContent = evt.currentTarget.result;` && |\n| &&
|
||||
` this.setProperty("value", vContent);` && |\n| &&
|
||||
` this.fireUpload();` && |\n| &&
|
||||
` //this.getView().byId('picture' ).getDomRef().src = vContent;` && |\n| &&
|
||||
` }.bind(this)` && |\n| &&
|
||||
|\n| &&
|
||||
` reader.readAsDataURL(file);` && |\n| &&
|
||||
` }.bind(oControl)` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
|\n| &&
|
||||
` oControl.oFileUploader = new FileUploader({` && |\n| &&
|
||||
` icon: "sap-icon://browse-folder",` && |\n| &&
|
||||
` iconOnly: true,` && |\n| &&
|
||||
` value: oControl.getProperty("path"),` && |\n| &&
|
||||
` placeholder: oControl.getProperty("placeholder"),` && |\n| &&
|
||||
` change: function (oEvent) {` && |\n| &&
|
||||
` var value = oEvent.getSource().getProperty("value");` && |\n| &&
|
||||
` this.setProperty("path", value);` && |\n| &&
|
||||
` if (value) {` && |\n| &&
|
||||
` this.oUploadButton.setEnabled();` && |\n| &&
|
||||
` } else {` && |\n| &&
|
||||
` this.oUploadButton.setEnabled(false);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` this.oUploadButton.rerender();` && |\n| &&
|
||||
` }.bind(oControl)` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
|\n| &&
|
||||
` var hbox = new sap.m.HBox();` && |\n| &&
|
||||
` hbox.addItem(oControl.oFileUploader);` && |\n| &&
|
||||
` hbox.addItem(oControl.oUploadButton);` && |\n| &&
|
||||
` oRm.renderControl(hbox);` && |\n| &&
|
||||
` }` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
` });` && |\n| &&
|
||||
`</script>` && |\n| &&
|
||||
|\n| &&
|
||||
`</html>`.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
|
|
|
@ -956,9 +956,11 @@ CLASS z2ui5_lcl_system_runtime DEFINITION.
|
|||
RETURNING
|
||||
VALUE(result) TYPE REF TO z2ui5_lcl_system_runtime.
|
||||
|
||||
METHODS set_app_system_error
|
||||
METHODS set_app_system
|
||||
IMPORTING
|
||||
ix TYPE REF TO cx_root
|
||||
VALUE(ix) TYPE REF TO cx_root OPTIONAL
|
||||
error_text TYPE string OPTIONAL
|
||||
PREFERRED PARAMETER ix
|
||||
RETURNING
|
||||
VALUE(result) TYPE REF TO z2ui5_lcl_system_runtime.
|
||||
|
||||
|
@ -1293,7 +1295,7 @@ CLASS z2ui5_lcl_db IMPLEMENTATION.
|
|||
|
||||
METHOD create.
|
||||
|
||||
CAST z2ui5_if_app( db-o_app )->id = id.
|
||||
" CAST z2ui5_if_app( db-o_app )->id = id.
|
||||
|
||||
DATA(ls_db) = VALUE z2ui5_t_draft(
|
||||
uuid = id
|
||||
|
@ -1486,26 +1488,22 @@ CLASS z2ui5_lcl_system_runtime IMPLEMENTATION.
|
|||
|
||||
result = NEW #( ).
|
||||
result->ms_db-id = _=>get_uuid( ).
|
||||
" DO.
|
||||
|
||||
TRY.
|
||||
DATA(lv_classname) = to_upper( z2ui5_cl_http_handler=>client-t_param[ name = `app` ]-value ).
|
||||
|
||||
TRY.
|
||||
CREATE OBJECT result->ms_db-o_app TYPE (lv_classname).
|
||||
|
||||
CATCH cx_root.
|
||||
DATA(lo_error) = NEW z2ui5_lcl_system_app( ).
|
||||
lo_error->ms_error-x_error = NEW z2ui5_lcl_utility(
|
||||
val = `class with name ` && lv_classname && ` not found, app call not possible` ).
|
||||
result->ms_db-o_app = lo_error.
|
||||
ENDTRY.
|
||||
|
||||
CATCH cx_root.
|
||||
result->ms_db-o_app = NEW z2ui5_lcl_system_app( ).
|
||||
result = result->set_app_system( ).
|
||||
RETURN.
|
||||
ENDTRY.
|
||||
|
||||
TRY.
|
||||
CREATE OBJECT result->ms_db-o_app TYPE (lv_classname).
|
||||
|
||||
" ENDDO.
|
||||
CATCH cx_root.
|
||||
result = result->set_app_system( error_text = `class with name ` && lv_classname && ` not found` ).
|
||||
RETURN.
|
||||
ENDTRY.
|
||||
|
||||
result->ms_db-o_app->id = result->ms_db-id.
|
||||
result->ms_db-t_attri = _=>get_t_attri_by_ref( result->ms_db-o_app ).
|
||||
|
@ -1523,6 +1521,7 @@ CLASS z2ui5_lcl_system_runtime IMPLEMENTATION.
|
|||
DATA(ls_draft) = z2ui5_lcl_db=>read( id = result->ms_db-o_app->id check_load_app = abap_false ).
|
||||
result->ms_db-id_prev_app_stack = ls_draft-uuid_prev_app_stack.
|
||||
|
||||
result->ms_db-t_attri = _=>get_t_attri_by_ref( result->ms_db-o_app ).
|
||||
result->ms_db-id = _=>get_uuid( ).
|
||||
result->ms_db-o_app->id = result->ms_db-id.
|
||||
result->ms_db-id_prev_app = ms_db-id.
|
||||
|
@ -1604,20 +1603,38 @@ CLASS z2ui5_lcl_system_runtime IMPLEMENTATION.
|
|||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD set_app_system_error.
|
||||
METHOD set_app_system.
|
||||
|
||||
IF ms_db-o_app IS BOUND.
|
||||
z2ui5_lcl_db=>create( id = ms_db-id db = ms_db ).
|
||||
ENDIF.
|
||||
|
||||
z2ui5_lcl_db=>create( id = ms_db-id db = ms_db ).
|
||||
result = NEW #( ).
|
||||
result->ms_db-id = _=>get_uuid( ).
|
||||
result->ms_db-o_app = z2ui5_lcl_system_app=>factory_error( error = ix app = ms_db-o_app ).
|
||||
|
||||
result->ms_db-id_prev_app = ms_db-id.
|
||||
result->ms_db-id_prev_app_stack = ms_db-id.
|
||||
IF ix IS NOT BOUND AND error_text IS NOT INITIAL.
|
||||
ix = NEW z2ui5_lcl_utility( val = error_text ).
|
||||
ENDIF.
|
||||
|
||||
IF ix IS BOUND.
|
||||
|
||||
z2ui5_lcl_db=>create( id = ms_db-id db = ms_db ).
|
||||
result->ms_db-o_app = z2ui5_lcl_system_app=>factory_error( error = ix app = ms_db-o_app ).
|
||||
|
||||
result->ms_db-id_prev_app = ms_db-id.
|
||||
result->ms_db-id_prev_app_stack = ms_db-id.
|
||||
|
||||
result->ms_next-t_after = ms_next-t_after.
|
||||
|
||||
|
||||
result->ms_db-id_prev_app = ms_db-id.
|
||||
|
||||
ELSE.
|
||||
result->ms_db-o_app = NEW z2ui5_lcl_system_app( ).
|
||||
ENDIF.
|
||||
|
||||
result->ms_next-t_after = ms_next-t_after.
|
||||
result->ms_db-t_attri = _=>get_t_attri_by_ref( result->ms_db-o_app ).
|
||||
|
||||
result->ms_db-id_prev_app = ms_db-id.
|
||||
result->ms_db-o_app->id = result->ms_db-id.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
@ -1740,14 +1757,12 @@ CLASS z2ui5_lcl_if_client IMPLEMENTATION.
|
|||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD z2ui5_if_client~set_next.
|
||||
|
||||
mo_runtime->ms_next-s_set = val.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD z2ui5_if_client~_bind.
|
||||
|
||||
result = mo_runtime->_create_binding( value = val type = z2ui5_lcl_system_runtime=>cs_bind_type-two_way ).
|
||||
|
|
Loading…
Reference in New Issue
Block a user