new compress_mode (#799)

This commit is contained in:
oblomov 2024-01-21 09:38:33 +01:00 committed by GitHub
parent 119ac94ffc
commit cdf2a62646
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 38 additions and 11 deletions

View File

@ -87,7 +87,7 @@ CLASS z2ui5_cl_util_func DEFINITION
IMPORTING IMPORTING
!any TYPE any !any TYPE any
!pretty_name TYPE clike DEFAULT /ui2/cl_json=>pretty_mode-none !pretty_name TYPE clike DEFAULT /ui2/cl_json=>pretty_mode-none
!compress TYPE abap_bool DEFAULT abap_true !compress TYPE clike DEFAULT abap_true
RETURNING RETURNING
VALUE(result) TYPE string. VALUE(result) TYPE string.
@ -266,7 +266,7 @@ ENDCLASS.
CLASS Z2UI5_CL_UTIL_FUNC IMPLEMENTATION. CLASS z2ui5_cl_util_func IMPLEMENTATION.
METHOD app_get_url. METHOD app_get_url.
@ -793,11 +793,31 @@ CLASS Z2UI5_CL_UTIL_FUNC IMPLEMENTATION.
METHOD trans_json_any_2. METHOD trans_json_any_2.
DATA(lo_json) = NEW z2ui5_cl_util_ui2_json( CASE compress.
compress = compress
WHEN z2ui5_if_client=>cs_compress_mode-full.
result = /ui2/cl_json=>serialize(
data = any
compress = abap_true
pretty_name = pretty_name ).
WHEN z2ui5_if_client=>cs_compress_mode-none.
result = /ui2/cl_json=>serialize(
data = any
compress = abap_false
pretty_name = pretty_name ).
WHEN OTHERS.
DATA(lo_json) = NEW z2ui5_cl_util_ui2_json(
compress = abap_true
pretty_name = pretty_name ). pretty_name = pretty_name ).
result = lo_json->serialize_int( data = any ). result = lo_json->serialize_int( any ).
ENDCASE.
ENDMETHOD. ENDMETHOD.

View File

@ -28,7 +28,7 @@ CLASS z2ui5_cl_fw_binding DEFINITION
check_temp TYPE abap_bool, check_temp TYPE abap_bool,
viewname TYPE string, viewname TYPE string,
pretty_name TYPE abap_bool, pretty_name TYPE abap_bool,
compress TYPE abap_bool, compress TYPE string,
depth TYPE i, depth TYPE i,
END OF ty_s_attri. END OF ty_s_attri.
TYPES ty_t_attri TYPE SORTED TABLE OF ty_s_attri WITH UNIQUE KEY name. TYPES ty_t_attri TYPE SORTED TABLE OF ty_s_attri WITH UNIQUE KEY name.
@ -42,7 +42,7 @@ CLASS z2ui5_cl_fw_binding DEFINITION
check_attri TYPE data OPTIONAL check_attri TYPE data OPTIONAL
view TYPE clike OPTIONAL view TYPE clike OPTIONAL
pretty_name TYPE clike OPTIONAL pretty_name TYPE clike OPTIONAL
compress TYPE abap_bool OPTIONAL compress TYPE clike OPTIONAL
RETURNING RETURNING
VALUE(r_result) TYPE REF TO z2ui5_cl_fw_binding. VALUE(r_result) TYPE REF TO z2ui5_cl_fw_binding.
@ -57,7 +57,7 @@ CLASS z2ui5_cl_fw_binding DEFINITION
DATA mv_check_attri TYPE abap_bool. DATA mv_check_attri TYPE abap_bool.
DATA mv_view TYPE string. DATA mv_view TYPE string.
DATA mv_pretty_name TYPE string. DATA mv_pretty_name TYPE string.
DATA mv_compress TYPE abap_bool. DATA mv_compress TYPE string.
CLASS-METHODS update_attri CLASS-METHODS update_attri
IMPORTING IMPORTING

View File

@ -23,6 +23,13 @@ INTERFACE z2ui5_if_client
popup TYPE string VALUE `POPUP`, popup TYPE string VALUE `POPUP`,
END OF cs_view. END OF cs_view.
CONSTANTS:
BEGIN OF cs_compress_mode,
standard TYPE string VALUE `STANDARD`,
full TYPE string VALUE `FULL`,
none TYPE string VALUE `NONE`,
END OF cs_compress_mode.
TYPES: TYPES:
BEGIN OF ty_s_name_value, BEGIN OF ty_s_name_value,
n TYPE string, n TYPE string,
@ -155,7 +162,7 @@ INTERFACE z2ui5_if_client
val TYPE data val TYPE data
path TYPE abap_bool DEFAULT abap_false path TYPE abap_bool DEFAULT abap_false
pretty_name TYPE clike DEFAULT /ui2/cl_json=>pretty_mode-none pretty_name TYPE clike DEFAULT /ui2/cl_json=>pretty_mode-none
compress TYPE abap_bool DEFAULT abap_true compress TYPE clike DEFAULT cs_compress_mode-standard
tab TYPE STANDARD TABLE OPTIONAL tab TYPE STANDARD TABLE OPTIONAL
tab_index TYPE i OPTIONAL tab_index TYPE i OPTIONAL
RETURNING RETURNING
@ -167,7 +174,7 @@ INTERFACE z2ui5_if_client
path TYPE abap_bool DEFAULT abap_false path TYPE abap_bool DEFAULT abap_false
view TYPE string DEFAULT cs_view-main view TYPE string DEFAULT cs_view-main
pretty_name TYPE clike DEFAULT /ui2/cl_json=>pretty_mode-none pretty_name TYPE clike DEFAULT /ui2/cl_json=>pretty_mode-none
compress TYPE abap_bool DEFAULT abap_true compress TYPE clike DEFAULT cs_compress_mode-standard
tab TYPE STANDARD TABLE OPTIONAL tab TYPE STANDARD TABLE OPTIONAL
tab_index TYPE i OPTIONAL tab_index TYPE i OPTIONAL
RETURNING RETURNING
@ -178,7 +185,7 @@ INTERFACE z2ui5_if_client
val TYPE data val TYPE data
path TYPE abap_bool DEFAULT abap_false path TYPE abap_bool DEFAULT abap_false
pretty_name TYPE clike DEFAULT /ui2/cl_json=>pretty_mode-none pretty_name TYPE clike DEFAULT /ui2/cl_json=>pretty_mode-none
compress TYPE abap_bool DEFAULT abap_true compress TYPE clike DEFAULT cs_compress_mode-standard
RETURNING RETURNING
VALUE(result) TYPE string. VALUE(result) TYPE string.