Skip to content

Commit 67a6a3e

Browse files
authored
update (#3)
1 parent 5832a79 commit 67a6a3e

9 files changed

+715
-331
lines changed

package-lock.json

Lines changed: 37 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"transpile": "rm -rf output && cp test/*.abap downport && abap_transpile abap_transpile.json",
99
"express": "node test/express.mjs",
1010
"downport": "rm -rf downport && cp -r src downport && abaplint --fix abaplint-downport.jsonc",
11+
"unit": "npm run downport && npm run transpile && node output/index.mjs",
1112
"test": "npm run downport && npm run transpile && npm run express"
1213
},
1314
"repository": {
@@ -20,10 +21,10 @@
2021
},
2122
"homepage": "https://github.com/oblomov-dev/abap2UI5#readme",
2223
"devDependencies": {
23-
"@abaplint/cli": "^2.97.17",
24-
"@abaplint/runtime": "^2.6.35",
25-
"@abaplint/database-sqlite": "^2.6.0",
24+
"@abaplint/cli": "^2.100.3",
25+
"@abaplint/runtime": "^2.7.1",
26+
"@abaplint/database-sqlite": "^2.7.0",
2627
"express": "^4.18.2",
27-
"@abaplint/transpiler-cli": "^2.6.35"
28+
"@abaplint/transpiler-cli": "^2.7.1"
2829
}
2930
}

src/00/z2ui5_cl_app_demo_09.clas.abap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ CLASS Z2UI5_CL_APP_DEMO_09 IMPLEMENTATION.
207207

208208
METHOD z2ui5_on_rendering.
209209

210-
DATA(page) = Z2UI5_CL_XML_VIEW=>factory(
210+
DATA(page) = Z2UI5_CL_XML_VIEW=>factory( )->shell(
211211
)->page(
212212
title = 'abap2UI5 - Value Help Examples'
213213
navbuttonpress = client->_event( 'BACK' )

src/00/z2ui5_cl_app_demo_10.clas.abap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ CLASS Z2UI5_CL_APP_DEMO_10 IMPLEMENTATION.
1919
client->nav_app_leave( client->get_app( client->get( )-id_prev_app_stack ) ).
2020
ENDCASE.
2121

22-
DATA(page) = Z2UI5_CL_XML_VIEW=>factory(
22+
DATA(page) = Z2UI5_CL_XML_VIEW=>factory( )->shell(
2323
)->page(
2424
title = 'abap2UI5 - Demo Layout'
2525
navbuttonpress = client->_event( 'BACK' )

src/00/z2ui5_cl_app_demo_22.clas.abap

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,13 @@ ENDCLASS.
3434

3535

3636

37-
CLASS Z2UI5_CL_APP_DEMO_22 IMPLEMENTATION.
37+
CLASS z2ui5_cl_app_demo_22 IMPLEMENTATION.
3838

3939

4040
METHOD z2ui5_if_app~main.
4141

4242
app-client = client.
4343
app-s_get = client->get( ).
44-
app-view_popup = ``.
4544

4645
IF app-check_initialized = abap_false.
4746
app-check_initialized = abap_true.
@@ -60,6 +59,11 @@ CLASS Z2UI5_CL_APP_DEMO_22 IMPLEMENTATION.
6059

6160
ENDIF.
6261

62+
app-s_next-t_scroll_pos = VALUE #(
63+
( name = 'id_page' )
64+
( name = 'id_text3' )
65+
).
66+
6367
CASE client->get( )-event.
6468

6569
WHEN 'BUTTON_SCROLL_TOP'.
@@ -68,15 +72,16 @@ CLASS Z2UI5_CL_APP_DEMO_22 IMPLEMENTATION.
6872
WHEN 'BUTTON_SCROLL_BOTTOM'.
6973
app-s_next-t_scroll_pos = VALUE #( ( name = 'id_page' value = '99999' ) ).
7074

71-
" WHEN 'BUTTON_SCROLL_UP'.
72-
" DATA(lv_pos) = client->get( )-page_scroll_pos - 500.
73-
" client->set( page_scroll_pos = COND #( WHEN lv_pos < 0 THEN 0 ELSE lv_pos ) ).
75+
WHEN 'BUTTON_SCROLL_UP'.
76+
DATA(lv_pos) = CONV i( app-s_get-t_scroll_pos[ name = `id_page` ]-value ) - 500.
77+
app-s_next-t_scroll_pos = VALUE #( ( name = 'id_page' value = lv_pos ) ).
7478

75-
" WHEN 'BUTTON_SCROLL_DOWN'.
76-
" client->set( page_scroll_pos = client->get( )-page_scroll_pos + 500 ).
79+
WHEN 'BUTTON_SCROLL_DOWN'.
80+
lv_pos = CONV i( app-s_get-t_scroll_pos[ name = `id_page` ]-value ) + 500.
81+
app-s_next-t_scroll_pos = VALUE #( ( name = 'id_page' value = lv_pos ) ).
7782

78-
" WHEN 'BUTTON_SCROLL_HOLD'.
79-
" client->set( page_scroll_pos = client->get( )-page_scroll_pos ).
83+
WHEN 'BUTTON_SCROLL_HOLD'.
84+
app-s_next-t_scroll_pos = app-s_get-t_scroll_pos.
8085

8186
WHEN 'BUTTON_FOCUS_FIRST'.
8287
app-s_next-s_cursor_pos = VALUE #( id = 'id_text1' cursorpos = '3' selectionstart = '3' selectionend = '3' ).
@@ -100,15 +105,15 @@ CLASS Z2UI5_CL_APP_DEMO_22 IMPLEMENTATION.
100105
ENDCASE.
101106

102107

103-
DATA(view) = Z2UI5_CL_XML_VIEW=>factory( )->shell( ).
108+
DATA(view) = z2ui5_cl_xml_view=>factory( )->shell( ).
104109
DATA(page) = view->page(
105110
id = 'id_page'
106111
title = 'abap2ui5 - Scrolling and Cursor (use the browser Chrome to avoid incompatibilities)'
107112
navbuttonpress = client->_event( 'BACK' )
108113
shownavbutton = abap_true
109114
).
110115

111-
page->header_content( )->link( text = 'Source_Code' target = '_blank' href = Z2UI5_CL_XML_VIEW=>hlp_get_source_code_url( app = me get = client->get( ) ) ).
116+
page->header_content( )->link( text = 'Source_Code' target = '_blank' href = z2ui5_cl_xml_view=>hlp_get_source_code_url( app = me get = client->get( ) ) ).
112117

113118

114119
page->input(
@@ -147,15 +152,18 @@ CLASS Z2UI5_CL_APP_DEMO_22 IMPLEMENTATION.
147152

148153
page->footer( )->overflow_toolbar(
149154
)->button( text = 'Scroll Top' press = client->_event( 'BUTTON_SCROLL_TOP' )
150-
" )->button( text = 'Scroll 500 up' press = view->_event( 'BUTTON_SCROLL_UP' )
151-
" )->button( text = 'Scroll 500 down' press = view->_event( 'BUTTON_SCROLL_DOWN' )
155+
)->button( text = 'Scroll 500 up' press = client->_event( 'BUTTON_SCROLL_UP' )
156+
)->button( text = 'Scroll 500 down' press = client->_event( 'BUTTON_SCROLL_DOWN' )
152157
)->button( text = 'Scroll Bottom' press = client->_event( 'BUTTON_SCROLL_BOTTOM' )
153-
" )->toolbar_spacer(
154-
" )->button( text = 'Server Event and hold position' press = view->_event( 'BUTTON_SCROLL_HOLD' )
158+
)->toolbar_spacer(
159+
)->button( text = 'Server Event and hold position' press = client->_event( 'BUTTON_SCROLL_HOLD' )
155160
).
156161

157162
app-s_next-xml_main = page->get_root( )->xml_get( ).
158163
client->set_next( app-s_next ).
159164

165+
app-view_popup = ``.
166+
CLEAR app-s_next.
167+
160168
ENDMETHOD.
161169
ENDCLASS.

src/z2ui5_cl_http_handler.clas.abap

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -123,27 +123,23 @@ CLASS Z2UI5_CL_HTTP_HANDLER IMPLEMENTATION.
123123
` var oView = this.getView();` && |\n| &&
124124
` try {` && |\n| &&
125125
` if (sap.z2ui5.oResponse.oCursor) {` && |\n| &&
126-
` var ofocus = oView.byId(sap.z2ui5.oResponse.oCursor.id).getFocusInfo();` && |\n| &&
127-
` ofocus.cursorPos = sap.z2ui5.oResponse.oCursor.cursorPos;` && |\n| &&
128-
` ofocus.selectionStart = sap.z2ui5.oResponse.oCursor.selectionStart;` && |\n| &&
129-
` ofocus.selectionEnd = sap.z2ui5.oResponse.oCursor.selectionEnd;` && |\n| &&
126+
` var ofocus = oView.byId(sap.z2ui5.oResponse.oCursor.ID).getFocusInfo();` && |\n| &&
127+
` ofocus.cursorPos = parseInt( sap.z2ui5.oResponse.oCursor.CURSORPOS );` && |\n| &&
128+
` ofocus.selectionStart = parseInt( sap.z2ui5.oResponse.oCursor.SELECTIONSTART );` && |\n| &&
129+
` ofocus.selectionEnd = parseInt( sap.z2ui5.oResponse.oCursor.SELECTIONEND );` && |\n| &&
130130
` }` && |\n| &&
131-
` oView.byId(sap.z2ui5.oResponse.oCursor.id).applyFocusInfo(ofocus);` && |\n| &&
131+
` oView.byId(sap.z2ui5.oResponse.oCursor.ID).applyFocusInfo(ofocus);` && |\n| &&
132132
` } catch (error) { };` && |\n| &&
133133
` try {` && |\n| &&
134-
` // oView.getContent()[0].getApp().scrollTo(sap.z2ui5.oResponse.PAGE_SCROLL_POS);` && |\n| &&
135134
` } catch (error) { };` && |\n| &&
136-
` //todo` && |\n| &&
137135
` if (sap.z2ui5.oResponse.oScroll) {` && |\n| &&
138-
` sap.z2ui5.oResponse.oScroll.forEach(item => Object.keys(item).forEach(function (key, index) {` && |\n| &&
139-
` try {` && |\n| &&
140-
` oView.byId(key).scrollTo(item[key]);` && |\n| &&
141-
` } catch (e) {` && |\n| &&
142-
` var ele = '#' + oView.byId(key).getId() + '-inner';` && |\n| &&
143-
` $(ele).scrollTop(item[key]);` && |\n| &&
144-
` }` && |\n| &&
145-
` // index: the ordinal position of the key within the object ` && |\n| &&
146-
` }));` && |\n| &&
136+
` sap.z2ui5.oResponse.oScroll.forEach(` && |\n| &&
137+
` item => { try { oView.byId(item.NAME).scrollTo( parseInt( item.VALUE ) ); ` && |\n| &&
138+
` } catch (e) {` && |\n| &&
139+
` var ele = '#' + oView.byId(item.NAME).getId() + '-inner';` && |\n| &&
140+
` $(ele).scrollTop(item.VALUE); ` && |\n| &&
141+
` } ` && |\n| &&
142+
` } );` && |\n| &&
147143
` }` && |\n| &&
148144
` if (sap.z2ui5.oResponse.vViewPopup) {` && |\n| &&
149145
` ` && |\n| &&
@@ -163,9 +159,9 @@ CLASS Z2UI5_CL_HTTP_HANDLER IMPLEMENTATION.
163159
` }` && |\n| &&
164160
` if (sap.z2ui5.oResponse.oTimer){ ` && |\n| &&
165161
` var oEvent = { 'EVENT' : 'BUTTON_CHECK', 'METHOD' : 'UPDATE' };` && |\n| &&
166-
` oEvent.EVENT = sap.z2ui5.oResponse.oTimer.eventFinished;` && |\n| &&
162+
` oEvent.EVENT = sap.z2ui5.oResponse.oTimer.EVENT_FINISHED;` && |\n| &&
167163
` sap.z2ui5.checkTimerActive = true;` && |\n| &&
168-
` setTimeout( ( ) => { if ( sap.z2ui5.checkTimerActive ) { sap.z2ui5.oView.getController().onEvent( oEvent ); } }, sap.z2ui5.oResponse.oTimer.intervalMs, oEvent );` && |\n| &&
164+
` setTimeout( ( ) => { if ( sap.z2ui5.checkTimerActive ) { sap.z2ui5.oView.getController().onEvent( oEvent ); } }, parseInt( sap.z2ui5.oResponse.oTimer.INTERVAL_MS ) , oEvent );` && |\n| &&
169165
` }` && |\n| &&
170166
` sap.ui.core.BusyIndicator.hide();` && |\n| &&
171167
` },` && |\n| &&
@@ -203,6 +199,19 @@ CLASS Z2UI5_CL_HTTP_HANDLER IMPLEMENTATION.
203199
` this.oBody.oUpdate = sap.z2ui5.oView.getModel().oData.oUpdate;` && |\n| &&
204200
` }` && |\n| &&
205201
|\n| &&
202+
` if (sap.z2ui5.oResponse.oScroll) {` && |\n| &&
203+
` this.oBody.oScroll = sap.z2ui5.oResponse.oScroll; ` && |\n| &&
204+
` this.oBody.oScroll .forEach(` && |\n| &&
205+
` item => { try { ` && |\n| &&
206+
` item.VALUE = this.getView().byId( item.NAME ).getScrollDelegate().getScrollTop(); ` && |\n| &&
207+
` } catch (e) {` && |\n| &&
208+
` var ele = '#' + this.getView( ).byId(item.NAME).getId() + '-inner';` && |\n| &&
209+
` item.VALUE = $(ele).scrollTop(); ` && |\n| &&
210+
` } ` && |\n| &&
211+
` } );` && |\n| &&
212+
` }` && |\n| &&
213+
214+
206215
` this.oBody.oSystem = sap.z2ui5.oResponse.oSystem;` && |\n| &&
207216
` this.oBody.oEvent = oEvent;` && |\n| &&
208217
` this.oBody.oEvent.vData = vData;` && |\n| &&
@@ -251,9 +260,9 @@ CLASS Z2UI5_CL_HTTP_HANDLER IMPLEMENTATION.
251260
` }` && |\n| &&
252261
` }` && |\n| &&
253262
|\n| &&
254-
` if (sap.z2ui5.oResponse.oAfter) {` && |\n| &&
255-
` sap.z2ui5.oResponse.oAfter.forEach(item => sap.m[item[0]][item[1]](item[2]));` && |\n| &&
256-
` }` && |\n| &&
263+
` if (sap.z2ui5.oResponse.oMessage) {` && |\n| &&
264+
` sap.m[sap.z2ui5.oResponse.oMessage.CONTROL][sap.z2ui5.oResponse.oMessage.TYPE](sap.z2ui5.oResponse.oMessage.TEXT);` && |\n| &&
265+
` }` && |\n| &&
257266
|\n| &&
258267
` if (sap.z2ui5.oResponse.vView) {` && |\n| &&
259268
` var oModel = new sap.ui.model.json.JSONModel(sap.z2ui5.oResponse.oViewModel);` && |\n| &&

0 commit comments

Comments
 (0)