mirror of
https://github.com/abap2UI5/abap2UI5.git
synced 2025-04-29 02:58:20 +08:00

* lint check * lint check * Update abaplint.jsonc * Update abaplint.jsonc * Update abaplint.jsonc * Update abaplint.jsonc * popups - draft handling - utility * lint fix * downport test * update * fix popup select * utility extensions * lint fix test * update lint * update * update * update * update * update * Delete src/03/01/z2ui5_cl_popup_to_select.clas.abap * Delete src/03/01/z2ui5_cl_popup_to_select.clas.xml * added class again * popups * popup get range multi + clear function * fix date in table * fix popup model update * update * update * popups * Update abaplint.jsonc * update lint fixes * extended error message by serialization error * update downport fix * update
177 lines
4.9 KiB
ABAP
177 lines
4.9 KiB
ABAP
CLASS z2ui5_cl_popup_get_range DEFINITION
|
|
PUBLIC
|
|
FINAL
|
|
CREATE PUBLIC .
|
|
|
|
PUBLIC SECTION.
|
|
|
|
INTERFACES z2ui5_if_app.
|
|
|
|
TYPES:
|
|
BEGIN OF ty_s_filter_pop,
|
|
option TYPE string,
|
|
low TYPE string,
|
|
high TYPE string,
|
|
key TYPE string,
|
|
END OF ty_s_filter_pop.
|
|
DATA mt_filter TYPE STANDARD TABLE OF ty_s_filter_pop WITH EMPTY KEY.
|
|
|
|
CLASS-METHODS factory
|
|
IMPORTING
|
|
t_range TYPE z2ui5_cl_util_func=>ty_t_range OPTIONAL
|
|
RETURNING
|
|
VALUE(r_result) TYPE REF TO z2ui5_cl_popup_get_range.
|
|
|
|
TYPES:
|
|
BEGIN OF ty_s_result,
|
|
t_range TYPE z2ui5_cl_util_func=>ty_t_range,
|
|
check_confirmed TYPE abap_bool,
|
|
END OF ty_s_result.
|
|
DATA ms_result TYPE ty_s_result.
|
|
|
|
METHODS result
|
|
RETURNING
|
|
VALUE(result) TYPE ty_s_result.
|
|
|
|
PROTECTED SECTION.
|
|
|
|
DATA client TYPE REF TO z2ui5_if_client.
|
|
DATA check_initialized TYPE abap_bool.
|
|
METHODS view_display.
|
|
PRIVATE SECTION.
|
|
ENDCLASS.
|
|
|
|
|
|
|
|
CLASS z2ui5_cl_popup_get_range IMPLEMENTATION.
|
|
|
|
METHOD factory.
|
|
|
|
r_result = NEW #( ).
|
|
r_result->ms_result-t_range = t_range.
|
|
INSERT VALUE #( ) INTO TABLE r_result->ms_result-t_range.
|
|
|
|
ENDMETHOD.
|
|
|
|
|
|
METHOD result.
|
|
|
|
result = ms_result.
|
|
|
|
ENDMETHOD.
|
|
|
|
|
|
METHOD view_display.
|
|
|
|
DATA(lo_popup) = z2ui5_cl_xml_view=>factory_popup( client ).
|
|
|
|
lo_popup = lo_popup->dialog(
|
|
afterclose = client->_event( 'BUTTON_CANCEL' )
|
|
contentheight = `50%`
|
|
contentwidth = `50%`
|
|
title = 'Define Filter Conditons' ).
|
|
|
|
DATA(vbox) = lo_popup->vbox( height = `100%` justifycontent = 'SpaceBetween' ).
|
|
|
|
DATA(item) = vbox->list(
|
|
" headertext = `Product`
|
|
nodata = `no conditions defined`
|
|
items = client->_bind_edit( mt_filter )
|
|
selectionchange = client->_event( 'SELCHANGE' )
|
|
)->custom_list_item( ).
|
|
|
|
DATA(grid) = item->grid( ).
|
|
|
|
grid->combobox(
|
|
selectedkey = `{OPTION}`
|
|
items = client->_bind_local( z2ui5_cl_util_func=>get_token_range_mapping( ) )
|
|
)->item(
|
|
key = '{N}'
|
|
text = '{N}'
|
|
)->get_parent(
|
|
)->input( value = `{LOW}` submit = client->_event( 'BUTTON_CONFIRM' )
|
|
)->input( value = `{HIGH}` visible = `{= ${OPTION} === 'BT' }` submit = client->_event( 'BUTTON_CONFIRM' )
|
|
)->button( icon = 'sap-icon://decline' type = `Transparent` press = client->_event( val = `POPUP_DELETE` t_arg = VALUE #( ( `${KEY}` ) ) )
|
|
).
|
|
|
|
lo_popup->footer( )->overflow_toolbar(
|
|
)->button( text = `Delete All` icon = 'sap-icon://delete' type = `Transparent` press = client->_event( val = `POPUP_DELETE_ALL` )
|
|
)->button( text = `Add Item` icon = `sap-icon://add` press = client->_event( val = `POPUP_ADD` )
|
|
)->toolbar_spacer(
|
|
)->button(
|
|
text = 'Cancel'
|
|
press = client->_event( 'BUTTON_CANCEL' )
|
|
)->button(
|
|
text = 'OK'
|
|
press = client->_event( 'BUTTON_CONFIRM' )
|
|
type = 'Emphasized'
|
|
).
|
|
|
|
client->popup_display( lo_popup->stringify( ) ).
|
|
|
|
ENDMETHOD.
|
|
|
|
|
|
METHOD z2ui5_if_app~main.
|
|
|
|
me->client = client.
|
|
|
|
IF check_initialized = abap_false.
|
|
check_initialized = abap_true.
|
|
|
|
CLEAR mt_filter.
|
|
LOOP AT ms_result-t_range REFERENCE INTO DATA(lr_product).
|
|
INSERT VALUE #(
|
|
low = lr_product->low
|
|
high = lr_product->high
|
|
option = lr_product->option
|
|
key = z2ui5_cl_util_func=>func_get_uuid_32( )
|
|
) INTO TABLE mt_filter.
|
|
ENDLOOP.
|
|
|
|
view_display( ).
|
|
RETURN.
|
|
ENDIF.
|
|
|
|
CASE client->get( )-event.
|
|
WHEN `BUTTON_CONFIRM`.
|
|
|
|
CLEAR ms_result-t_range.
|
|
LOOP AT mt_filter REFERENCE INTO DATA(lr_filter).
|
|
IF lr_filter->low IS INITIAL AND lr_filter->high IS INITIAL.
|
|
CONTINUE.
|
|
ENDIF.
|
|
INSERT VALUE #(
|
|
sign = `I`
|
|
option = lr_filter->option
|
|
low = lr_filter->low
|
|
high = lr_filter->high
|
|
) INTO TABLE ms_result-t_range.
|
|
ENDLOOP.
|
|
|
|
ms_result-check_confirmed = abap_true.
|
|
client->popup_destroy( ).
|
|
client->nav_app_leave( client->get_app( client->get( )-s_draft-id_prev_app_stack ) ).
|
|
|
|
WHEN `BUTTON_CANCEL`.
|
|
client->popup_destroy( ).
|
|
client->nav_app_leave( client->get_app( client->get( )-s_draft-id_prev_app_stack ) ).
|
|
|
|
WHEN `POPUP_ADD`.
|
|
INSERT VALUE #( key = z2ui5_cl_util_func=>func_get_uuid_32( ) ) INTO TABLE mt_filter.
|
|
client->popup_model_update( ).
|
|
|
|
WHEN `POPUP_DELETE`.
|
|
DATA(lt_event) = client->get( )-t_event_arg.
|
|
DELETE mt_filter WHERE key = lt_event[ 1 ].
|
|
client->popup_model_update( ).
|
|
|
|
WHEN `POPUP_DELETE_ALL`.
|
|
mt_filter = VALUE #( ).
|
|
client->popup_model_update( ).
|
|
|
|
ENDCASE.
|
|
|
|
ENDMETHOD.
|
|
ENDCLASS.
|