update driverjs (#612)

* update driverjs

* Update src/01/z2ui5_cl_cc_driver_js.clas.abap

Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com>

* Update src/01/z2ui5_cl_cc_driver_js.clas.abap

Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com>

* Update src/01/z2ui5_cl_cc_driver_js.clas.abap

Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com>

* Update src/01/z2ui5_cl_cc_driver_js.clas.abap

Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com>

* Update src/01/z2ui5_cl_cc_driver_js.clas.abap

Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com>

* Update src/01/z2ui5_cl_cc_driver_js.clas.abap

Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com>

* abaplint fixes

* fixes for open-abap transpiler

---------

Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com>
Co-authored-by: oblomov <102328295+oblomov-dev@users.noreply.github.com>
This commit is contained in:
choper725 2023-11-01 12:00:54 +02:00 committed by GitHub
parent bd4aeae5d6
commit e4503bba9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 194 additions and 158 deletions

View File

@ -5,47 +5,54 @@ CLASS z2ui5_cl_cc_driver_js DEFINITION
PUBLIC SECTION. PUBLIC SECTION.
TYPES showbuttons_array TYPE STANDARD TABLE OF int4 WITH NON-UNIQUE KEY table_line.
TYPES disablebuttons_array TYPE STANDARD TABLE OF int4 WITH NON-UNIQUE KEY table_line.
TYPES: TYPES:
BEGIN OF ty_config_steps_popover, BEGIN OF ty_config_steps_popover,
title TYPE string, title TYPE string,
description TYPE string, description TYPE string,
side TYPE string, side TYPE string,
align TYPE string, align TYPE string,
showbuttons TYPE string, show_buttons TYPE showbuttons_array,
disablebuttons TYPE string, disable_buttons TYPE disablebuttons_array,
nextbtntext TYPE string, next_btn_text TYPE string,
prevbtntext TYPE string, prev_btn_text TYPE string,
donebtntext TYPE string, done_btn_text TYPE string,
showprogress TYPE abap_bool, show_progress TYPE abap_bool,
progresstext TYPE string, progress_text TYPE string,
popoverclass TYPE string, popover_class TYPE string,
END OF ty_config_steps_popover . END OF ty_config_steps_popover .
TYPES: TYPES:
BEGIN OF ty_config_steps, BEGIN OF ty_config_steps,
element TYPE string, element TYPE string,
elementview TYPE string,
popover TYPE ty_config_steps_popover, popover TYPE ty_config_steps_popover,
END OF ty_config_steps . END OF ty_config_steps .
TYPES ty_config_steps_tt TYPE STANDARD TABLE OF ty_config_steps WITH DEFAULT KEY.
TYPES: TYPES:
BEGIN OF ty_config, BEGIN OF ty_config,
steps TYPE ty_config_steps, steps TYPE ty_config_steps_tt,
animate TYPE abap_bool, animate TYPE abap_bool,
overlaycolor TYPE string, overlay_color TYPE string,
smoothscroll TYPE abap_bool, smooths_croll TYPE abap_bool,
allowclose TYPE abap_bool, allow_close TYPE abap_bool,
overlayopacity TYPE i, overlay_opacity TYPE i,
stagepadding TYPE i, stage_padding TYPE i,
stageradius TYPE i, stage_radius TYPE i,
allowkeyboardcontrol TYPE abap_bool, allow_keyboard_control TYPE abap_bool,
disableactiveinteraction TYPE abap_bool, disable_active_interaction TYPE abap_bool,
popoverclass TYPE string, popover_class TYPE string,
popoveroffset TYPE i, popover_offset TYPE i,
showbuttons TYPE string, show_buttons TYPE string,
disablebuttons TYPE string, disable_buttons TYPE string,
showprogress TYPE abap_bool, show_progress TYPE abap_bool,
progresstext TYPE string, progress_text TYPE string,
nextbtntext TYPE string, next_btn_text TYPE string,
prevbtntext TYPE string, prev_btn_text TYPE string,
donebtntext TYPE string, done_btn_text TYPE string,
END OF ty_config . END OF ty_config .
@ -68,7 +75,7 @@ CLASS z2ui5_cl_cc_driver_js DEFINITION
IMPORTING IMPORTING
!config TYPE ty_config !config TYPE ty_config
RETURNING RETURNING
VALUE(result) TYPE REF TO z2ui5_cl_xml_view ##NEEDED. VALUE(result) TYPE REF TO z2ui5_cl_xml_view .
CLASS-METHODS get_css_local CLASS-METHODS get_css_local
RETURNING RETURNING
@ -77,7 +84,6 @@ CLASS z2ui5_cl_cc_driver_js DEFINITION
CLASS-METHODS get_js_local CLASS-METHODS get_js_local
RETURNING RETURNING
VALUE(result) TYPE string . VALUE(result) TYPE string .
PROTECTED SECTION. PROTECTED SECTION.
PRIVATE SECTION. PRIVATE SECTION.
@ -290,22 +296,51 @@ CLASS Z2UI5_CL_CC_DRIVER_JS IMPLEMENTATION.
METHOD set_drive_config. METHOD set_drive_config.
DATA lt_config TYPE ty_config.
DATA(selector) = `` ##NEEDED.
DATA(view) = ``.
DATA(drive_js) = `debugger; const driver = window.driver.js.driver;`.
drive_js = drive_js && lt_config = config.
`const driverObj = driver({` && |\n| &&
* ` showProgress: ` && z2ui5_cl_fw_utility=>boolean_abap_2_json( config-showprogress ) && `,` && |\n| && LOOP AT lt_config-steps ASSIGNING FIELD-SYMBOL(<fs_step>).
` showProgress: true,` && |\n| &&
` steps: [` && |\n| && CASE <fs_step>-element(1).
` { element: '#__xmlview5--choper725', popover: { title: 'Animated Tour Example', description: 'Here is the code example showing animated tour. Let\'s walk you through it.', side: "left", align: 'start' }},` && |\n| && WHEN `#`.
` { element: '#__xmlview5--choper725-1', popover: { title: 'Animated Tour Example', description: 'Here is the code example showing animated tour. Let\'s walk you through it.', side: "left", align: 'start' }},` && |\n| && WHEN `.`.
` { element: '#__xmlview5--choper725-2', popover: { title: 'Import the Library', description: 'It works the same in vanilla JavaScript as well as frameworks.', side: "bottom", align: 'start' }},` && |\n| && ENDCASE.
` ]` && |\n| &&
`});`. CASE to_upper( <fs_step>-elementview ).
WHEN `NEST`.
view = `oViewNest`.
WHEN `NEST2`.
view = `oViewNest2`.
WHEN `POPOVER`.
view = `oViewPopover`.
WHEN `POPUP`.
view = `oViewPopup`.
WHEN OTHERS.
* DEFAULT AS MAIN VIEW
view = `oView`.
ENDCASE.
CLEAR <fs_step>-elementview.
ENDLOOP.
DATA(lv_config_json) = ``.
lv_config_json = /ui2/cl_json=>serialize(
data = lt_config
compress = abap_true
pretty_name = 'X' ).
DATA(drive_js) = `const driver = window.driver.js.driver;` && |\n|.
drive_js = drive_js && `const driverObj = driver(` && |\n| && lv_config_json && |\n| && `);`.
result = mo_view->_cc_plain_xml( `<html:script>` && drive_js && `</html:script>` ). result = mo_view->_cc_plain_xml( `<html:script>` && drive_js && `</html:script>` ).
* result = drive_js.
ENDMETHOD. ENDMETHOD.
ENDCLASS. ENDCLASS.

View File

@ -2961,6 +2961,19 @@ CLASS Z2UI5_CL_XML_VIEW IMPLEMENTATION.
ENDMETHOD. ENDMETHOD.
METHOD barcode_scanner_button.
result = _generic( name = `BarcodeScannerButton`
ns = 'ndc'
t_prop = VALUE #(
( n = `id` v = id )
( n = `scanSuccess` v = scanSuccess )
( n = `scanFail` v = scanFail )
( n = `inputLiveUpdate` v = inputLiveUpdate )
( n = `dialogTitle` v = dialogTitle ) ) ).
ENDMETHOD.
METHOD bars. METHOD bars.
result = _generic( name = `bars` result = _generic( name = `bars`
ns = `mchart` ). ns = `mchart` ).
@ -3507,18 +3520,6 @@ CLASS Z2UI5_CL_XML_VIEW IMPLEMENTATION.
ENDMETHOD. ENDMETHOD.
METHOD barcode_scanner_button.
result = _generic( name = `BarcodeScannerButton`
ns = 'ndc'
t_prop = VALUE #(
( n = `id` v = id )
( n = `scanSuccess` v = scanSuccess )
( n = `scanFail` v = scanFail )
( n = `inputLiveUpdate` v = inputLiveUpdate )
( n = `dialogTitle` v = dialogTitle ) ) ).
ENDMETHOD.
METHOD end_column_pages. METHOD end_column_pages.
" todo, implement method " todo, implement method
result = me. result = me.