diff --git a/SAMPLES.md b/SAMPLES.md index 517065a..04f7eab 100644 --- a/SAMPLES.md +++ b/SAMPLES.md @@ -3,7 +3,7 @@ # The sample catalogue -Every app in this repository — 46 of them — with what it shows and a +Every app in this repository — 47 of them — with what it shows and a link to its source. This is the [overview app](src/z2ui5_cl_smps_app_000.clas.abap) as a page you can read here, before installing anything. @@ -105,6 +105,7 @@ type who does not know it exists. `Ctrl+F` on this page uses them. |---|---| | Build the URL of a Launchpad App
Builds the URL of a launchpad app from semantic object, action and parameters - through cl_lsapi_manager where the system has it, as an intent URL of its own where it does not
launchpad fiori flp url intent semantic object action link cl_lsapi_manager open_new_tab | [`Z2UI5_CL_SMPS_APP_025`](src/09/z2ui5_cl_smps_app_025.clas.abap) | | Smart Link Popover with getLinks
a list of products whose ids are smart links - a press asks the launchpad which apps the user may open for the product and lists them in a popover
launchpad fiori flp smart link popover getlinks intent semantic object cross_app_nav_get_links | [`Z2UI5_CL_SMPS_APP_026`](src/09/z2ui5_cl_smps_app_026.clas.abap) | +| Full Width
follow_up_action( cs_event-set_app_full_width ) - the app takes the launchpad's whole width instead of the shell's letterbox
launchpad fiori flp full width letterbox screen width fullwidth set_app_full_width follow_up_action | [`Z2UI5_CL_SMPS_APP_027`](src/09/z2ui5_cl_smps_app_027.clas.abap) | | Read Startup Parameters
what the tile passed in - client->get( )-t_comp_params
launchpad fiori flp startup parameters intent | [`Z2UI5_CL_SMPS_APP_481`](src/09/z2ui5_cl_smps_app_481.clas.abap) | | Set Shell Title
follow_up_action( cs_event-set_title_launchpad )
launchpad fiori flp shell title follow_up_action | [`Z2UI5_CL_SMPS_APP_482`](src/09/z2ui5_cl_smps_app_482.clas.abap) | | Cross-App Navigation Sender
hands two values over to another tile
launchpad fiori flp cross app navigation sender intent | [`Z2UI5_CL_SMPS_APP_483`](src/09/z2ui5_cl_smps_app_483.clas.abap) | diff --git a/catalogue-derived.json b/catalogue-derived.json index b4c97ff..f0e90b5 100644 --- a/catalogue-derived.json +++ b/catalogue-derived.json @@ -59,19 +59,19 @@ "sap.m.ToggleButton", "z2ui5.cc.Websocket", "sap.m.StandardListItem", + "sap.m.Switch", "sap.m.CheckBox", "sap.m.Select", "sap.ui.core.Item", "sap.m.ObjectNumber", "z2ui5.cc.FileUploader", - "sap.m.Switch", "sap.m.SegmentedButton", "sap.m.SegmentedButtonItem", "sap.m.StepInput", "sap.m.TextArea" ], "counts": { - "samples": 46, + "samples": 47, "controls": 61, "noChain": 0 }, @@ -89,20 +89,21 @@ {"class":"Z2UI5_CL_SMPS_APP_010","minUi5":"1.71","needs":[],"controls":[1,2,3,39,40,22,37,6,7,10,11,12,13,18,41,15,17,38],"controlCount":55}, {"class":"Z2UI5_CL_SMPS_APP_011","minUi5":"1.71","needs":[],"controls":[1,2,3,22,37,5,7,10,11,12,13,18,41,17,38],"controlCount":33}, {"class":"Z2UI5_CL_SMPS_APP_012","minUi5":"1.71","needs":[],"controls":[1,2,3,7,10,11,12,13,18,41,17],"controlCount":18}, - {"class":"Z2UI5_CL_SMPS_APP_013","minUi5":"1.71","needs":[],"controls":[1,51,22,37,5,23,7,52,10,41,53,17,38],"controlCount":28}, + {"class":"Z2UI5_CL_SMPS_APP_013","minUi5":"1.71","needs":[],"controls":[1,52,22,37,5,23,7,53,10,41,54,17,38],"controlCount":28}, {"class":"Z2UI5_CL_SMPS_APP_014","minUi5":"1.71","needs":[],"controls":[1,43,44,22,45,5,7,10,14,17],"controlCount":11}, - {"class":"Z2UI5_CL_SMPS_APP_015","minUi5":"1.71","needs":[],"controls":[1,2,3,22,37,5,54,7,8,10,11,12,14,17],"controlCount":38}, - {"class":"Z2UI5_CL_SMPS_APP_016","minUi5":"1.71","needs":[],"controls":[1,2,3,31,22,37,5,7,10,11,12,13,18,41,17,38,55],"controlCount":35}, - {"class":"Z2UI5_CL_SMPS_APP_017","minUi5":"1.71","needs":[],"controls":[1,2,3,31,37,5,6,7,10,56,11,12,13,18,41,17],"controlCount":31}, + {"class":"Z2UI5_CL_SMPS_APP_015","minUi5":"1.71","needs":[],"controls":[1,2,3,22,37,5,55,7,8,10,11,12,14,17],"controlCount":38}, + {"class":"Z2UI5_CL_SMPS_APP_016","minUi5":"1.71","needs":[],"controls":[1,2,3,31,22,37,5,7,10,11,12,13,18,41,17,38,56],"controlCount":35}, + {"class":"Z2UI5_CL_SMPS_APP_017","minUi5":"1.71","needs":[],"controls":[1,2,3,31,37,5,6,7,10,51,11,12,13,18,41,17],"controlCount":31}, {"class":"Z2UI5_CL_SMPS_APP_018","minUi5":"1.71","needs":[],"controls":[1,2,3,40,31,22,37,5,7,57,58,10,59,11,12,60,13,18,41,15,17,38],"controlCount":50}, {"class":"Z2UI5_CL_SMPS_APP_019","minUi5":"1.71","needs":[],"controls":[1,22,37,5,23,7,10,12,41,17,38],"controlCount":15}, {"class":"Z2UI5_CL_SMPS_APP_020","minUi5":"1.71","needs":[],"controls":[1,2,3,31,5,7,10,11,12,13,18,41,17],"controlCount":25}, - {"class":"Z2UI5_CL_SMPS_APP_021","minUi5":"1.71","needs":[],"controls":[1,2,3,31,5,7,10,11,12,17,55],"controlCount":27}, + {"class":"Z2UI5_CL_SMPS_APP_021","minUi5":"1.71","needs":[],"controls":[1,2,3,31,5,7,10,11,12,17,56],"controlCount":27}, {"class":"Z2UI5_CL_SMPS_APP_022","minUi5":"1.71","needs":[],"controls":[1,2,3,22,5,7,10,11,12,13,18,41,17],"controlCount":22}, {"class":"Z2UI5_CL_SMPS_APP_023","minUi5":"1.71","needs":[],"controls":[1,22,37,5,23,7,10,12,60,41,17,38],"controlCount":18}, {"class":"Z2UI5_CL_SMPS_APP_024","minUi5":"1.71","needs":[],"controls":[1,2,3,37,5,6,23,7,10,11,12,60,41,17,38],"controlCount":22}, {"class":"Z2UI5_CL_SMPS_APP_025","minUi5":"1.71","needs":[],"controls":[1,2,3,22,37,5,23,7,10,11,12,13,18,41,17,38],"controlCount":31}, {"class":"Z2UI5_CL_SMPS_APP_026","minUi5":"1.71","needs":[],"controls":[2,3,22,37,4,45,5,7,9,10,50,11,12,13,18,15,17,38],"controlCount":24}, + {"class":"Z2UI5_CL_SMPS_APP_027","minUi5":"1.71","needs":[],"controls":[2,3,37,5,7,10,51,11,12,18,17],"controlCount":12}, {"class":"Z2UI5_CL_SMPS_APP_313","minUi5":"1.71","needs":[],"controls":[7,10,19,20,21,17],"controlCount":6}, {"class":"Z2UI5_CL_SMPS_APP_314","minUi5":"1.71","needs":[],"controls":[2,3,22,7,10,11,12,13,18,17],"controlCount":31}, {"class":"Z2UI5_CL_SMPS_APP_315","minUi5":"1.71","needs":[],"controls":[2,3,7,10,11,12,13,18,17],"controlCount":35}, diff --git a/catalogue.json b/catalogue.json index e999e32..5ab7bb9 100644 --- a/catalogue.json +++ b/catalogue.json @@ -846,6 +846,32 @@ "branch": "09-launchpad", "setup": "src/09/README.md" }, + { + "class": "Z2UI5_CL_SMPS_APP_027", + "path": "src/09/z2ui5_cl_smps_app_027.clas.abap", + "package": "src/09", + "technology": "Launchpad", + "title": "Full Width", + "summary": "follow_up_action( cs_event-set_app_full_width ) - the app takes the launchpad's whole width instead of the shell's letterbox", + "keywords": [ + "launchpad", + "fiori", + "flp", + "full", + "width", + "letterbox", + "screen", + "width", + "fullwidth", + "set_app_full_width", + "follow_up_action" + ], + "runsOn": "Cloud + Standard ≥ 7.40 SP08", + "cloud": true, + "needs": "a Fiori Launchpad with a tile pointing at abap2UI5", + "branch": "09-launchpad", + "setup": "src/09/README.md" + }, { "class": "Z2UI5_CL_SMPS_APP_481", "path": "src/09/z2ui5_cl_smps_app_481.clas.abap", diff --git a/src/09/README.md b/src/09/README.md index 1b2f5d8..fcbc22e 100644 --- a/src/09/README.md +++ b/src/09/README.md @@ -31,7 +31,7 @@ The target mapping's URL is the abap2UI5 ICF node plus the app to start: The framework detects the launchpad from that context (`scenario=LAUNCHPAD` in the query, or `/ui2/flp` / `test/flpSandbox` in the path) and sets -`check_launchpad_active`. `481` to `483` and `026` check the flag and tell you with a message +`check_launchpad_active`. `481` to `483`, `026` and `027` check the flag and tell you with a message box when they were started standalone — where they then have no shell to talk to; `484`, the receiver, shows the flag in its form and hides its two navigation buttons instead. @@ -46,6 +46,7 @@ buttons instead. | [`484`](z2ui5_cl_smps_app_484.clas.abap) | cross-app navigation, **receiver** — reads them back out of its startup parameters | | [`025`](z2ui5_cl_smps_app_025.clas.abap) | build the URL of a launchpad app from semantic object, action and parameters — `cl_lsapi_manager` where the system has it, an intent URL of its own where it does not. Runs standalone too | | [`026`](z2ui5_cl_smps_app_026.clas.abap) | a **smart link popover** — asks the launchpad which apps the user may open for a product and lists them next to the pressed link — `follow_up_action( cs_event-cross_app_nav_get_links )` | +| [`027`](z2ui5_cl_smps_app_027.clas.abap) | the launchpad's **full width** instead of the letterbox — `follow_up_action( cs_event-set_app_full_width )` with `X`, and without an argument back to the letterbox. Needs abap2UI5 newer than 1.148.0 | Start any of them with `?app_start=z2ui5_cl_smps_app_` — from a tile, that is what the target mapping's URL carries. The overview app diff --git a/src/09/z2ui5_cl_smps_app_027.clas.abap b/src/09/z2ui5_cl_smps_app_027.clas.abap new file mode 100644 index 0000000..81b5282 --- /dev/null +++ b/src/09/z2ui5_cl_smps_app_027.clas.abap @@ -0,0 +1,145 @@ +" @keywords launchpad fiori flp full width letterbox screen width fullwidth set_app_full_width follow_up_action +" @summary follow_up_action( cs_event-set_app_full_width ) - the app takes the launchpad's whole width instead of the shell's letterbox +"!

Launchpad - Full Width

+"! The launchpad shows an app at a limited width with empty margins left +"! and right (the letterbox), unless the app asks for the full screen. A +"! Fiori elements app asks with "fullWidth" in its manifest; all abap2UI5 +"! apps share one component and one manifest, so an abap2UI5 app asks at +"! runtime instead, with the frontend action cs_event-set_app_full_width: +"! +"! client->follow_up_action( +"! val = client->cs_event-set_app_full_width +"! t_arg = VALUE #( ( `X` ) ) ). +"! +"! X for the full width, no argument for the letterbox again. The sample +"! asks for the full width on start - a wide table is where it pays off - +"! and the switch toggles between the two. +"! +"! The sap.m.Shell around the page limits the width on its own as well, +"! so it is rendered with appWidthLimited = false - otherwise the app +"! stays boxed in however wide the launchpad lets it be. +"! +"! Needs abap2UI5 newer than 1.148.0 (set_app_full_width) and a launchpad. +"! Some launchpads start every app at full width already - there the +"! switch shows the letterbox when it is turned off. +CLASS z2ui5_cl_smps_app_027 DEFINITION PUBLIC. + + PUBLIC SECTION. + INTERFACES z2ui5_if_app. + + TYPES: + BEGIN OF ty_s_row, + col01 TYPE string, + col02 TYPE string, + col03 TYPE string, + col04 TYPE string, + col05 TYPE string, + col06 TYPE string, + col07 TYPE string, + col08 TYPE string, + col09 TYPE string, + col10 TYPE string, + col11 TYPE string, + col12 TYPE string, + END OF ty_s_row. + TYPES ty_t_row TYPE STANDARD TABLE OF ty_s_row WITH EMPTY KEY. + + DATA full_width TYPE abap_bool VALUE abap_true. + DATA rows TYPE ty_t_row. + + PROTECTED SECTION. + DATA client TYPE REF TO z2ui5_if_client. + + METHODS view_display. + METHODS width_apply. + + PRIVATE SECTION. +ENDCLASS. + + +CLASS z2ui5_cl_smps_app_027 IMPLEMENTATION. + + METHOD z2ui5_if_app~main. + + me->client = client. + IF client->check_on_init( ). + + IF client->get( )-check_launchpad_active = abap_false. + client->message_box_display( `No Launchpad Active, Sample not working!` ). + ENDIF. + rows = VALUE #( FOR i = 1 THEN i + 1 UNTIL i > 10 + ( col01 = |Row { i }| col02 = `Lorem` col03 = `ipsum` col04 = `dolor` + col05 = `sit` col06 = `amet` col07 = `consetetur` col08 = `sadipscing` + col09 = `elitr` col10 = `sed` col11 = `diam` col12 = `nonumy` ) ). + view_display( ). + width_apply( ). + + ELSEIF client->check_on_navigated( ). + view_display( ). + width_apply( ). + + ELSEIF client->check_on_event( `WIDTH` ). + width_apply( ). + + ENDIF. + + ENDMETHOD. + + + METHOD width_apply. + + " X asks for the full width; without an argument the launchpad's + " letterbox comes back (an empty argument is never sent at all) + client->follow_up_action( + val = z2ui5_if_client=>cs_event-set_app_full_width + t_arg = COND #( WHEN full_width = abap_true THEN VALUE #( ( `X` ) ) ) ). + + ENDMETHOD. + + + METHOD view_display. + + DATA(view) = z2ui5_cl_ui5_view_builder=>factory( + )->ele( n = `View` ns = `mvc` + )->a( n = `displayBlock` v = `true` + )->a( n = `height` v = `100%` + )->a( n = `xmlns` v = `sap.m` + )->a( n = `xmlns:mvc` v = `sap.ui.core.mvc` ). + DATA(page) = view->ele( `Shell` + )->a( n = `appWidthLimited` b = abap_false + )->ele( `Page` + )->a( n = `title` v = `abap2UI5 - Launchpad - Full Width` + )->a( n = `showNavButton` b = client->check_app_prev_stack( ) + )->a( n = `navButtonPress` v = client->_event_nav_app_leave( ) + )->a( n = `showHeader` b = xsdbool( client->get( )-check_launchpad_active = abap_false ) ). + + page->tag( `MessageStrip` + )->a( n = `text` v = `follow_up_action( cs_event-set_app_full_width ) lets the app take the ` && + `launchpad's whole width instead of the letterbox - toggle the switch and ` && + `watch the margins left and right. Only works inside a launchpad.` + )->a( n = `type` v = `Information` + )->a( n = `showIcon` b = abap_true + )->a( n = `class` v = `sapUiSmallMargin` ). + + page->ele( `Toolbar` + )->tag( `Label` + )->a( n = `text` v = `Full width` + )->tag( `Switch` + )->a( n = `state` v = client->_bind( full_width ) + )->a( n = `change` v = client->_event( `WIDTH` ) ). + + DATA(table) = page->ele( `Table` + )->a( n = `items` v = client->_bind( rows ) ). + DATA(columns) = table->ele( `columns` ). + DATA(cells) = table->ele( `items` )->ele( `ColumnListItem` )->ele( `cells` ). + DO 12 TIMES. + DATA(name) = |COL{ sy-index WIDTH = 2 ALIGN = RIGHT PAD = `0` }|. + columns->ele( `Column` )->tag( `Text` )->a( n = `text` t = |Column { sy-index }| ). + cells->tag( `Text` )->a( n = `text` v = |\{{ name }\}| ). + ENDDO. + + client->view_display( view->stringify( ) ). + + ENDMETHOD. + +ENDCLASS. diff --git a/src/09/z2ui5_cl_smps_app_027.clas.xml b/src/09/z2ui5_cl_smps_app_027.clas.xml new file mode 100644 index 0000000..b8b109a --- /dev/null +++ b/src/09/z2ui5_cl_smps_app_027.clas.xml @@ -0,0 +1,16 @@ + + + + + + Z2UI5_CL_SMPS_APP_027 + E + Launchpad - Full Width + 1 + X + X + X + + + + diff --git a/src/z2ui5_cl_smps_app_000.clas.abap b/src/z2ui5_cl_smps_app_000.clas.abap index 609dc01..4fd97cd 100644 --- a/src/z2ui5_cl_smps_app_000.clas.abap +++ b/src/z2ui5_cl_smps_app_000.clas.abap @@ -1060,7 +1060,11 @@ CLASS z2ui5_cl_smps_app_000 IMPLEMENTATION. ( sample( no = `026` title = `Smart link popover with getLinks` detail = `a list of products whose ids are smart links - a press asks the launchpad which apps the user may open for the product and lists them in a popover` - classname = `Z2UI5_CL_SMPS_APP_026` ) ) ). + classname = `Z2UI5_CL_SMPS_APP_026` ) ) + ( sample( no = `027` + title = `Full width` + detail = `follow_up_action( cs_event-set_app_full_width ) - the app takes the launchpad's whole width instead of the shell's letterbox` + classname = `Z2UI5_CL_SMPS_APP_027` ) ) ). t_ai = VALUE #( ( sample( no = `013`