scrolling (#673)

This commit is contained in:
oblomov 2023-11-24 16:34:03 +01:00 committed by GitHub
parent 6991c036d5
commit 5b9fa8a1db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 46 additions and 29 deletions

View File

@ -52,7 +52,7 @@ CLASS z2ui5_cl_fw_client IMPLEMENTATION.
event = mo_handler->ms_actual-event
check_launchpad_active = mo_handler->ms_actual-check_launchpad_active
t_event_arg = mo_handler->ms_actual-t_event_arg
t_scroll_pos = mo_handler->ms_actual-t_scroll_pos
* t_scroll_pos = mo_handler->ms_actual-t_scroll_pos
t_message_manager = mo_handler->ms_actual-t_message_manager
s_draft = CORRESPONDING #( mo_handler->ms_db )
check_on_navigated = mo_handler->ms_actual-check_on_navigated
@ -180,7 +180,7 @@ CLASS z2ui5_cl_fw_client IMPLEMENTATION.
METHOD z2ui5_if_client~scroll_position_set.
mo_handler->ms_next-s_set-t_scroll = val.
* mo_handler->ms_next-s_set-t_scroll = val.
ENDMETHOD.

View File

@ -277,15 +277,15 @@ CLASS z2ui5_cl_fw_handler IMPLEMENTATION.
CATCH cx_root.
ENDTRY.
TRY.
DATA(lo_scroll) = so_body->get_attribute( `OSCROLL` ).
z2ui5_cl_fw_utility=>trans_ref_tab_2_tab(
EXPORTING
ir_tab_from = lo_scroll->mr_actual
IMPORTING
t_result = result->ms_actual-t_scroll_pos ).
CATCH cx_root.
ENDTRY.
* TRY.
* DATA(lo_scroll) = so_body->get_attribute( `OSCROLL` ).
* z2ui5_cl_fw_utility=>trans_ref_tab_2_tab(
* EXPORTING
* ir_tab_from = lo_scroll->mr_actual
* IMPORTING
* t_result = result->ms_actual-t_scroll_pos ).
* CATCH cx_root.
* ENDTRY.
TRY.
DATA(lo_cursor) = so_body->get_attribute( `OCURSOR` ).

View File

@ -124,19 +124,19 @@ CLASS Z2UI5_CL_FW_INTEGRATION_TEST IMPLEMENTATION.
ENDCASE.
IF sv_state = 'TEST_SCROLL_CURSOR'.
client->view_display( `test` ).
client->cursor_set( id = 'id_text2'
cursorpos = '5'
selectionstart = '5'
selectionend = '10' ).
client->scroll_position_set( VALUE #( v = '99999'
( n = 'id_page' )
( n = 'id_text3' ) ) ).
ENDIF.
* IF sv_state = 'TEST_SCROLL_CURSOR'.
*
** client->view_display( `test` ).
** client->cursor_set( id = 'id_text2'
** cursorpos = '5'
** selectionstart = '5'
** selectionend = '10' ).
**
** client->scroll_position_set( VALUE #( v = '99999'
** ( n = 'id_page' )
** ( n = 'id_text3' ) ) ).
*
* ENDIF.
IF sv_state = 'TEST_NAVIGATE'.
DATA(lo_app) = NEW z2ui5_cl_fw_integration_test( ).

View File

@ -61,7 +61,7 @@ CLASS Z2UI5_CL_CC_FOCUS IMPLEMENTATION.
METHOD get_js.
result = `debugger; jQuery.sap.declare("z2ui5.Focus");` && |\n| &&
result = `jQuery.sap.declare("z2ui5.Focus");` && |\n| &&
`sap.ui.require([` && |\n| &&
` "sap/ui/core/Control",` && |\n| &&
`], (Control) => {` && |\n| &&
@ -82,7 +82,7 @@ CLASS Z2UI5_CL_CC_FOCUS IMPLEMENTATION.
|\n| &&
` renderer(oRm, oControl) {` && |\n| &&
|\n| &&
` debugger; if (!oControl.getProperty("setUpdate")){ return; }` && |\n| &&
` if (!oControl.getProperty("setUpdate")){ return; }` && |\n| &&
` oControl.setProperty("setUpdate", false);` && |\n| &&
|\n| &&
` setTimeout((oControl) => {` && |\n| &&

View File

@ -78,8 +78,22 @@ CLASS z2ui5_cl_cc_scroll IMPLEMENTATION.
` }` && |\n| &&
` },` && |\n| &&
|\n| &&
` setBackend() { ` && |\n| &&
` if (this.mProperties.items){ this.mProperties.items.forEach(item => {` && |\n| &&
` try {` && |\n| &&
` item.SCROLLTO = sap.z2ui5.oView.byId(item.ID).getScrollDelegate().getScrollTop();` && |\n| &&
` } catch (e) {` && |\n| &&
` try {` && |\n| &&
` var ele = '#' + sap.z2ui5.oView.byId(item.ID).getId() + '-inner';` && |\n| &&
` item.SCROLLTO = $(ele).scrollTop();` && |\n| &&
` } catch (e) { }` && |\n| &&
` }` && |\n| &&
` });` && |\n| &&
` } },` && |\n| &&
` init() { sap.z2ui5.onBeforeRoundtrip.push( this.setBackend.bind(this) ); },` && |\n| &&
` renderer(oRm, oControl) {` && |\n| &&
|\n| &&
` ` && |\n| &&
` if (!oControl.getProperty("setUpdate")){ return; }` && |\n| &&
|\n| &&
` oControl.setProperty("setUpdate", false);` && |\n| &&

View File

@ -44,7 +44,7 @@ CLASS Z2UI5_CL_CC_TITLE IMPLEMENTATION.
METHOD control.
result = mo_view.
mo_view->_generic( name = `CCTitle`
mo_view->_generic( name = `Title`
ns = `z2ui5`
t_prop = VALUE #( ( n = `title` v = title ) ) ).
@ -53,10 +53,10 @@ CLASS Z2UI5_CL_CC_TITLE IMPLEMENTATION.
METHOD get_js.
result = `jQuery.sap.declare("z2ui5.CCTitle");` && |\n| &&
result = `jQuery.sap.declare("z2ui5.Title");` && |\n| &&
`sap.ui.require(["sap/ui/core/Control"], (Control)=>{` && |\n| &&
` "use strict";` && |\n| &&
` return Control.extend("z2ui5.CCTitle", {` && |\n| &&
` return Control.extend("z2ui5.Title", {` && |\n| &&
` metadata: {` && |\n| &&
` properties: {` && |\n| &&
` title: {` && |\n| &&

View File

@ -51,6 +51,7 @@ CLASS z2ui5_cl_fw_http_handler IMPLEMENTATION.
z2ui5_cl_cc_timer=>get_js( ) &&
z2ui5_cl_cc_focus=>get_js( ) &&
z2ui5_cl_cc_title=>get_js( ) &&
z2ui5_cl_cc_scroll=>get_js( ) &&
custom_js.
* DATA(lv_cc) = ``.
* LOOP AT lt_load_cc INTO DATA(li_cc).
@ -369,6 +370,7 @@ CLASS z2ui5_cl_fw_http_handler IMPLEMENTATION.
` sap.z2ui5.oBody.VIEWNAME = 'MAIN';` && |\n| &&
` }` && |\n| &&
|\n| &&
` sap.z2ui5.onBeforeRoundtrip.forEach( item => { if( item !== undefined) { item(); } })` && |\n| &&
` if (args[ 0 ].CHECK_VIEW_DESTROY){` && |\n| &&
` sap.z2ui5.oController.ViewDestroy();` && |\n| &&
` }` && |\n| &&
@ -557,6 +559,7 @@ CLASS z2ui5_cl_fw_http_handler IMPLEMENTATION.
` sap.z2ui5.oController.oUtil.oDate = {}; ` && |\n| &&
` sap.z2ui5.oController.oUtil.oDate.createObject = (s) => { return new Date(s); }` && |\n| &&
` jQuery.sap.declare("sap.z2ui5.Helper");` && |\n| &&
`sap.z2ui5.onBeforeRoundtrip = [];` && |\n| &&
`sap.z2ui5.Helper = {};` && |\n| &&
`sap.z2ui5.Helper.DateCreateObject = (s => new Date(s));` && |\n| &&
`sap.z2ui5.Helper.DateAbapTimestampToDate = (sTimestamp => new sap.gantt.misc.Format.abapTimestampToDate(sTimestamp));` && |\n| &&