@sapui5/sap.ushell_abap 1.94.1 → 1.97.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/package.json +1 -1
  2. package/src/main/js/sap/ui2/srvc/ODataWrapper.js +1 -1
  3. package/src/main/js/sap/ushell_abap/.library +4 -9
  4. package/src/main/js/sap/ushell_abap/adapters/abap/AdapterContainer.js +12 -5
  5. package/src/main/js/sap/ushell_abap/adapters/abap/AppStateAdapter.js +11 -7
  6. package/src/main/js/sap/ushell_abap/adapters/abap/ClientSideTargetResolutionAdapter.js +47 -32
  7. package/src/main/js/sap/ushell_abap/adapters/abap/ConfigurationDefaultsAdapter.js +1 -1
  8. package/src/main/js/sap/ushell_abap/adapters/abap/ContainerAdapter.js +46 -38
  9. package/src/main/js/sap/ushell_abap/adapters/abap/LaunchPageAdapter.js +574 -454
  10. package/src/main/js/sap/ushell_abap/adapters/abap/NavTargetResolutionAdapter.js +1 -1
  11. package/src/main/js/sap/ushell_abap/adapters/abap/PageBuildingAdapter.js +25 -15
  12. package/src/main/js/sap/ushell_abap/adapters/abap/PagePersistenceAdapter.js +3 -2
  13. package/src/main/js/sap/ushell_abap/adapters/abap/PersonalizationAdapter.js +16 -7
  14. package/src/main/js/sap/ushell_abap/adapters/abap/SearchAdapter.js +1 -1
  15. package/src/main/js/sap/ushell_abap/adapters/abap/SupportTicketAdapter.js +8 -8
  16. package/src/main/js/sap/ushell_abap/adapters/abap/Ui5ComponentLoaderAdapter.js +1 -1
  17. package/src/main/js/sap/ushell_abap/adapters/abap/UserInfoAdapter.js +11 -4
  18. package/src/main/js/sap/ushell_abap/adapters/hana/ContainerAdapter.js +9 -3
  19. package/src/main/js/sap/ushell_abap/bootstrap/evo/XhrLogonEventHandler.js +13 -11
  20. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap-def-dev.js +1 -1
  21. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap-def.js +1 -1
  22. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.bootstrap.utils.js +8 -4
  23. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.configure.ushell.js +1 -1
  24. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.constants.js +9 -0
  25. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.get.server.config.Urls.js +12 -5
  26. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.load.launchpad.js +21 -22
  27. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.request.pageset.js +8 -2
  28. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.request.server.config.js +6 -3
  29. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.request.startup.js +10 -5
  30. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.ui5.boot.handler.js +7 -4
  31. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.xhr.handler.js +10 -3
  32. package/src/main/js/sap/ushell_abap/bootstrap/evo/boottask.js +21 -16
  33. package/src/main/js/sap/ushell_abap/library.js +2 -2
  34. package/src/main/js/sap/ushell_abap/pbServices/ui2/AllCatalogs.js +186 -0
  35. package/src/main/js/sap/ushell_abap/pbServices/ui2/Bag.js +718 -0
  36. package/src/main/js/sap/ushell_abap/pbServices/ui2/Catalog.js +930 -0
  37. package/src/main/js/sap/ushell_abap/pbServices/ui2/Chip.js +1027 -0
  38. package/src/main/js/sap/ushell_abap/pbServices/ui2/ChipDefinition.js +216 -0
  39. package/src/main/js/sap/ushell_abap/pbServices/ui2/ChipInstance.js +951 -0
  40. package/src/main/js/sap/ushell_abap/pbServices/ui2/Error.js +45 -0
  41. package/src/main/js/sap/ushell_abap/pbServices/ui2/Factory.js +647 -0
  42. package/src/main/js/sap/ushell_abap/pbServices/ui2/ODataService.js +251 -0
  43. package/src/main/js/sap/ushell_abap/pbServices/ui2/ODataWrapper.js +1262 -0
  44. package/src/main/js/sap/ushell_abap/pbServices/ui2/Page.js +920 -0
  45. package/src/main/js/sap/ushell_abap/pbServices/ui2/PageBuildingService.js +1498 -0
  46. package/src/main/js/sap/ushell_abap/pbServices/ui2/PageSet.js +466 -0
  47. package/src/main/js/sap/ushell_abap/pbServices/ui2/RemoteCatalogService.js +52 -0
  48. package/src/main/js/sap/ushell_abap/pbServices/ui2/Utils.js +767 -0
  49. package/src/main/js/sap/ushell_abap/pbServices/ui2/chipdefinition.xsd +139 -0
  50. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/actions.js +244 -0
  51. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/bag.js +150 -0
  52. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/configuration.js +165 -0
  53. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/configurationUi.js +330 -0
  54. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/fullscreen.js +70 -0
  55. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/navigation.js +50 -0
  56. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/preview.js +289 -0
  57. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/refresh.js +43 -0
  58. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/search.js +115 -0
  59. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/types.js +9 -0
  60. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/url.js +105 -0
  61. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/visible.js +128 -0
  62. package/ui5.yaml +31 -0
  63. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/Component.js +0 -426
  64. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/css/style.css +0 -1
  65. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n.properties +0 -56
  66. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_ar.properties +0 -36
  67. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_bg.properties +0 -36
  68. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_ca.properties +0 -36
  69. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_cs.properties +0 -36
  70. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_cy.properties +0 -36
  71. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_da.properties +0 -36
  72. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_de.properties +0 -36
  73. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_el.properties +0 -36
  74. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_en.properties +0 -36
  75. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_en_GB.properties +0 -36
  76. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_en_US_sappsd.properties +0 -36
  77. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_en_US_saprigi.properties +0 -36
  78. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_en_US_saptrc.properties +0 -36
  79. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_es.properties +0 -36
  80. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_es_MX.properties +0 -36
  81. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_et.properties +0 -36
  82. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_fi.properties +0 -36
  83. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_fr.properties +0 -36
  84. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_fr_CA.properties +0 -36
  85. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_hi.properties +0 -36
  86. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_hr.properties +0 -36
  87. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_hu.properties +0 -36
  88. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_id.properties +0 -36
  89. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_it.properties +0 -36
  90. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_iw.properties +0 -36
  91. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_ja.properties +0 -36
  92. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_kk.properties +0 -36
  93. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_ko.properties +0 -36
  94. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_lt.properties +0 -36
  95. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_lv.properties +0 -36
  96. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_ms.properties +0 -36
  97. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_nl.properties +0 -36
  98. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_no.properties +0 -36
  99. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_pl.properties +0 -36
  100. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_pt.properties +0 -36
  101. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_pt_PT.properties +0 -36
  102. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_ro.properties +0 -36
  103. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_ru.properties +0 -36
  104. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_sh.properties +0 -36
  105. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_sk.properties +0 -36
  106. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_sl.properties +0 -36
  107. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_sv.properties +0 -36
  108. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_th.properties +0 -36
  109. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_tr.properties +0 -36
  110. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_uk.properties +0 -36
  111. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_vi.properties +0 -36
  112. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_zh_CN.properties +0 -36
  113. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/i18n/i18n_zh_TW.properties +0 -36
  114. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/manifest.json +0 -153
  115. package/src/main/js/sap/ushell_abap/plugins/fcc-transport-ui/model/models.js +0 -14
@@ -0,0 +1,139 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!-- ${copyright} -->
3
+ <xs:schema xmlns="http://schemas.sap.com/sapui2/services/Chip/1"
4
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
5
+ targetNamespace="http://schemas.sap.com/sapui2/services/Chip/1"
6
+ elementFormDefault="qualified">
7
+
8
+ <xs:element name="chip" type="ChipDescription"/>
9
+
10
+ <xs:complexType name="ChipDescription">
11
+ <xs:sequence>
12
+ <xs:element name="implementation" type="Implementation" maxOccurs="1" minOccurs="1"/>
13
+ <xs:element name="appearance" type="Appearance" maxOccurs="1" minOccurs="0"/>
14
+ <xs:element name="sources" type="Sources" maxOccurs="1" minOccurs="0"/>
15
+ <xs:element name="propertyPaths" type="PropertyPaths" maxOccurs="1" minOccurs="0"/>
16
+ <xs:element name="contracts" type="Contracts" maxOccurs="1" minOccurs="0"/>
17
+ <xs:element name="parameters" type="ParameterList" maxOccurs="1" minOccurs="0"/>
18
+ </xs:sequence>
19
+ </xs:complexType>
20
+
21
+ <xs:complexType name="Implementation">
22
+ <xs:choice minOccurs="1" maxOccurs="1">
23
+ <xs:element name="sapui5" type="SAPUI5ChipImplementation"/>
24
+ </xs:choice>
25
+ </xs:complexType>
26
+
27
+ <xs:complexType name="ChipImplementation" abstract="true">
28
+ </xs:complexType>
29
+
30
+ <xs:complexType name="SAPUI5ChipImplementation">
31
+ <xs:complexContent>
32
+ <xs:extension base="ChipImplementation">
33
+ <xs:sequence>
34
+ <xs:element name="basePath" type="xs:string" maxOccurs="1" minOccurs="0" default="."/>
35
+ <xs:choice minOccurs="1" maxOccurs="1">
36
+ <xs:element name="componentName" type="ComponentName"/>
37
+ <xs:element name="viewName" type="ViewName"/>
38
+ </xs:choice>
39
+ </xs:sequence>
40
+ </xs:extension>
41
+ </xs:complexContent>
42
+ </xs:complexType>
43
+
44
+ <xs:complexType name="ComponentName">
45
+ <xs:sequence>
46
+ <xs:element name="componentName" type="xs:string" maxOccurs="1" minOccurs="0"/>
47
+ </xs:sequence>
48
+ <xs:attribute name="virtualNamespace" type="xs:boolean"/>
49
+ </xs:complexType>
50
+
51
+ <xs:complexType name="ViewName">
52
+ <xs:sequence>
53
+ <xs:element name="viewName" type="xs:string" maxOccurs="1" minOccurs="0"/>
54
+ </xs:sequence>
55
+ <xs:attribute name="virtualNamespace" type="xs:boolean"/>
56
+ </xs:complexType>
57
+
58
+ <xs:complexType name="Sources">
59
+ <xs:sequence>
60
+ <!-- the limit of 999 is arbitrary, but "unbounded" isn't accepted by Fortify -->
61
+ <xs:element name="source" type="Source" maxOccurs="999" minOccurs="0"/>
62
+ </xs:sequence>
63
+ </xs:complexType>
64
+
65
+ <xs:complexType name="Source">
66
+ <xs:sequence>
67
+ <xs:element name="location" type="xs:string" maxOccurs="1" minOccurs="1"/>
68
+ <xs:element name="base" type="xs:string" maxOccurs="1" minOccurs="1"/>
69
+ </xs:sequence>
70
+ <xs:attribute name="id" type="xs:string" use="required"/>
71
+ </xs:complexType>
72
+
73
+ <xs:complexType name="PropertyPaths">
74
+ <xs:sequence>
75
+ <!-- the limit of 999 is arbitrary, but "unbounded" isn't accepted by Fortify -->
76
+ <xs:element name="properties" type="Properties" maxOccurs="999" minOccurs="0"/>
77
+ </xs:sequence>
78
+ <xs:attribute name="source" type="xs:string"/>
79
+ </xs:complexType>
80
+
81
+ <xs:complexType name="Properties">
82
+ <xs:sequence>
83
+ <!-- the limit of 999 is arbitrary, but "unbounded" isn't accepted by Fortify -->
84
+ <xs:element name="property" type="Property" maxOccurs="999" minOccurs="0"/>
85
+ </xs:sequence>
86
+ <xs:attribute name="usage" type="xs:string" use="required"/>
87
+ <xs:attribute name="source" type="xs:string"/>
88
+ </xs:complexType>
89
+
90
+ <xs:complexType name="Property">
91
+ <xs:simpleContent>
92
+ <xs:extension base="xs:string">
93
+ <xs:attribute name="name" type="xs:string" use="required"/>
94
+ <xs:attribute name="source" type="xs:string"/>
95
+ <xs:attribute name="initialvalue" type="xs:string"/>
96
+ <xs:attribute name="true" type="xs:string"/>
97
+ <xs:attribute name="false" type="xs:string"/>
98
+ </xs:extension>
99
+ </xs:simpleContent>
100
+ </xs:complexType>
101
+
102
+ <xs:complexType name="Appearance">
103
+ <xs:sequence>
104
+ <xs:element name="title" type="xs:string" maxOccurs="1" minOccurs="0"/>
105
+ <xs:element name="description" type="xs:string" maxOccurs="1" minOccurs="0"/>
106
+ </xs:sequence>
107
+ </xs:complexType>
108
+
109
+ <xs:complexType name="Contracts">
110
+ <xs:sequence>
111
+ <!-- the limit of 100 is arbitrary, but "unbounded" isn't accepted by Fortify -->
112
+ <!-- "100 contracts should be enough for every CHIP." :-) -->
113
+ <xs:element name="consume" type="ConsumedContractInfo" maxOccurs="100" minOccurs="0"/>
114
+ </xs:sequence>
115
+ </xs:complexType>
116
+
117
+ <xs:complexType name="ConsumedContractInfo">
118
+ <xs:sequence>
119
+ <xs:element name="parameters" type="ParameterList" maxOccurs="1" minOccurs="0"/>
120
+ </xs:sequence>
121
+ <xs:attribute name="id" type="xs:string" use="required"/>
122
+ </xs:complexType>
123
+
124
+ <xs:complexType name="ParameterList">
125
+ <xs:sequence>
126
+ <!-- the limit of 100 is arbitrary, but "unbounded" isn't accepted by Fortify -->
127
+ <xs:element name="parameter" type="Parameter" maxOccurs="100" minOccurs="1"/>
128
+ </xs:sequence>
129
+ </xs:complexType>
130
+
131
+ <xs:complexType name="Parameter">
132
+ <xs:simpleContent>
133
+ <xs:extension base="xs:string">
134
+ <xs:attribute name="name" type="xs:string" use="required"/>
135
+ </xs:extension>
136
+ </xs:simpleContent>
137
+ </xs:complexType>
138
+
139
+ </xs:schema>
@@ -0,0 +1,244 @@
1
+ // Copyright (c) 2009-2021 SAP SE. All rights reserved.
2
+
3
+ /**
4
+ * @fileOverview The <code>actions</code> contract.
5
+ * since 1.32 the <code>types</code> contract.
6
+ */
7
+ sap.ui.define([
8
+ "sap/ushell_abap/pbServices/ui2/Chip",
9
+ "sap/ushell_abap/pbServices/ui2/Error",
10
+ "sap/base/Log"
11
+ ], function (
12
+ Chip,
13
+ SrvcError,
14
+ Log
15
+ ) {
16
+ "use strict";
17
+
18
+ if (typeof jQuery === "function" && jQuery.sap) {
19
+ jQuery.sap.declare("sap.ui2.srvc.contracts.actions");
20
+ jQuery.sap.declare("sap.ui2.srvc.contracts.types");
21
+ }
22
+
23
+
24
+ /**
25
+ * @namespace The namespace for the CHIP API's <code>actions</code> contract, which
26
+ * allows you to provide a CHIP's actions with all related functionality.
27
+ * @name chip.actions
28
+ * @since 1.25.0
29
+ */
30
+ Chip.addContract("actions", function (oChipInstance) {
31
+ var fnActionsProvider;
32
+
33
+ /**
34
+ * Determines the callback function which provides the internal actions for this CHIP. The
35
+ * callback has to return an array of actions. Action is an object with the following
36
+ * properties: text, icon and targetURL or a press handler.
37
+ * @example:
38
+ * <code>[
39
+ * {
40
+ * text: "Some Action",
41
+ * icon: "sap-icon://action",
42
+ * targetURL: "#SemanticObject-Action"
43
+ * },
44
+ * {
45
+ * text: "Settings",
46
+ * icon: "sap-icon://action-settings",
47
+ * press: function (oEvent){
48
+ * //Open settings UI
49
+ * }
50
+ * }
51
+ * ]
52
+ * </code>.
53
+ *
54
+ * An embedding application calls this function each time it wants to display the CHIP's
55
+ * actions.
56
+ *
57
+ * Use <code>Function.prototype.bind()</code> to determine the callback's <code>this</code> or
58
+ * some of its arguments.
59
+ *
60
+ * @name chip.actions.setActionsProvider
61
+ * @function
62
+ * @since 1.25.0
63
+ * @param {function} fnProvider
64
+ * a callback which returns an array of action objects representing this CHIP's internal actions.
65
+ */
66
+ this.setActionsProvider = function (fnProvider) {
67
+ if (typeof fnProvider !== "function") {
68
+ throw new SrvcError("CHIP actions provider is not a function", "chip.actions");
69
+ }
70
+ fnActionsProvider = fnProvider;
71
+ };
72
+
73
+ /**
74
+ * @namespace The namespace for the contract interface (to be used by a page builder) for
75
+ * the <code>actions</code> contract, which allows you to get a CHIP's actions with all related functionality.
76
+ * @name contract.actions
77
+ * @since 1.25.0
78
+ */
79
+ return {
80
+ /**
81
+ * Returns this CHIP's internal actions, if available.
82
+ *
83
+ * @returns {Array}
84
+ * this CHIP's internal actions array
85
+ *
86
+ * @name contract.actions.getActions
87
+ * @function
88
+ * @since 1.25.0
89
+ *
90
+ * @see chip.actions.setActionsProvider
91
+ */
92
+ getActions: function () {
93
+ if (fnActionsProvider) {
94
+ return fnActionsProvider();
95
+ }
96
+ return [];
97
+ }
98
+ };
99
+ });
100
+
101
+ // the "contracts" mechanism requires a host to provide the functionality
102
+ // (it is not "optional")
103
+ // When the EP uses the ABAP JS sources, the contract should be made available.
104
+ // thus we make the contract available in this *file* to avoid
105
+ // having to have a separate script tag within the EP resource
106
+ // (note that contracts due to ancient design can not be required)
107
+
108
+ /**
109
+ * @namespace The namespace for the CHIP API's <code>types</code> contract, which allows the CHIP
110
+ * to offer multiple visualizations from which the page builder can choose.
111
+ * @name chip.types
112
+ * @since 1.32.0
113
+ */
114
+ Chip.addContract("types", function (oChipInstance) {
115
+ var sCurrentType,
116
+ fnSetTypeHandler;
117
+
118
+ /**
119
+ * Attaches the given event handler to the change event which is fired whenever the page builder
120
+ * wants to change the current type of visualization. The CHIP has to react accordingly and
121
+ * change the visualization after the handler is called. The event handler should return a
122
+ * <code>jQuery.Deferred</code> object's promise to inform the caller whether the visualization
123
+ * has been changed (or failed). In the latter case an error message should be provided.
124
+ * In case the type was changed before the handler was attached, the handler gets called
125
+ * immediately after registration. This also works when the handler is overwritten by a
126
+ * different one.
127
+ *
128
+ * Use <code>Function.prototype.bind()</code> to determine the event handler's
129
+ * <code>this</code> or some of its arguments.
130
+ *
131
+ * Note: Without such an event handler, it will not be possible to change the visualization of
132
+ * the CHIP during runtime.
133
+ *
134
+ * @name chip.types.attachTypeChange
135
+ * @function
136
+ *
137
+ * @param {function (string)} fnHandler
138
+ * the handler for changing the visualization type of the CHIP. The first argument will be
139
+ * the set type. The function <b>must</b> return a <code>jQuery.Deferred</code>
140
+ * object's promise.
141
+ *
142
+ * @throws Error if <code>fnHandler</code> is not a function or if fnHandler.
143
+ * @throws If fnHandler is directly called (because a type was cached) and throws an error.
144
+ *
145
+ * @since 1.32.0
146
+ * @see contract.types.setType
147
+ * @see chip.types.getAvailableTypes
148
+ */
149
+ this.attachSetType = function (fnHandler) {
150
+ if (typeof fnHandler !== "function") {
151
+ throw new SrvcError("Change event handler is not a function",
152
+ "chip.types");
153
+ }
154
+ if (fnSetTypeHandler === fnHandler) {
155
+ // nothing to do, especially do not call the handler again (assumption: better performance)
156
+ return;
157
+ }
158
+ fnSetTypeHandler = fnHandler;
159
+
160
+ // a type was already set, so fire the new handler directly
161
+ if (sCurrentType) {
162
+ // do not catch errors here -> fail early (the CHIP throws the error so it has to catch it)
163
+ fnSetTypeHandler(sCurrentType);
164
+ }
165
+ };
166
+
167
+ /**
168
+ * @namespace The namespace for the contract interface (to be used by a page builder) for
169
+ * the <code>types</code> contract, which allows you to change the CHIP's type of visualization.
170
+ * @name contract.types
171
+ * @since 1.32.0
172
+ */
173
+ return { // contract
174
+ /**
175
+ * Returns the list of available types of visualization. The types are always lower case.
176
+ *
177
+ * @name chip.types.getAvailableTypes
178
+ * @function
179
+ * @returns {string[]}
180
+ * the available tile types in lower case, e.g. <code>["tile", "link"]</code>
181
+ * @since 1.32.0
182
+ */
183
+ getAvailableTypes: function () {
184
+ // note: getAvailableTypes does a toLowerCase
185
+ return oChipInstance.getChip().getAvailableTypes();
186
+ },
187
+
188
+ /**
189
+ * Returns the default visualization type of the chip instance
190
+ *
191
+ * @returns {string}
192
+ * The default visualization type
193
+ *
194
+ * @since 1.86.0
195
+ */
196
+ getDefaultType: function () {
197
+ return oChipInstance.getChip().getDefaultType();
198
+ },
199
+ /**
200
+ * Informs the CHIP to change it's visualization type to <code>sType</code>. In case the CHIP
201
+ * has not attached an handler for this event yet, the contract will call the handler directly
202
+ * while attaching it.
203
+ *
204
+ * @param {string} sType
205
+ * The type to be set.
206
+ * Note: Before comparison <code>sType.toLowerCase()</code> will be used.
207
+ *
208
+ * @throws Error if <code>sType</code> is not valid.
209
+ *
210
+ * @name contract.types.setType
211
+ * @function
212
+ * @since 1.32.0
213
+ *
214
+ * @see chip.types.attachSetType
215
+ * @see chip.types.getAvailableTypes
216
+ */
217
+ setType: function (sType) {
218
+ var sTypeLowerCase;
219
+ if (typeof sType !== "string" || sType === "") {
220
+ throw new SrvcError("The given type is not a string",
221
+ "contract.types");
222
+ }
223
+ sTypeLowerCase = sType.toLowerCase();
224
+ if (this.getAvailableTypes().indexOf(sTypeLowerCase) < 0) {
225
+ throw new SrvcError("The CHIP does not support type '" + sTypeLowerCase + "'",
226
+ "contract.types");
227
+ }
228
+
229
+ // type is valid. cache it in case a (new) handler is registered
230
+ sCurrentType = sTypeLowerCase;
231
+
232
+ if (!fnSetTypeHandler) {
233
+ return;
234
+ }
235
+ try {
236
+ fnSetTypeHandler(sTypeLowerCase);
237
+ } catch (e) {
238
+ Log.error("Could not set CHIP type '" + sTypeLowerCase + "': "
239
+ + (e.message || e.toString()), null, "chip.types");
240
+ }
241
+ }
242
+ };
243
+ });
244
+ });
@@ -0,0 +1,150 @@
1
+ // Copyright (c) 2009-2021 SAP SE. All rights reserved.
2
+
3
+ /**
4
+ * @fileOverview The <code>bag</code> contract.
5
+ */
6
+ sap.ui.define([
7
+ "sap/ushell_abap/pbServices/ui2/Chip",
8
+ "sap/ushell_abap/pbServices/ui2/Utils",
9
+ "sap/ushell_abap/pbServices/ui2/Error"
10
+ ], function (
11
+ Chip,
12
+ Utils,
13
+ SrvcError
14
+ ) {
15
+ "use strict";
16
+
17
+ if (typeof jQuery === "function" && jQuery.sap) {
18
+ jQuery.sap.declare("sap.ui2.srvc.contracts.bag");
19
+ }
20
+
21
+ /**
22
+ * @namespace The namespace for the CHIP API's <code>bag</code> contract, which allows you to
23
+ * access property bags attached to a CHIP instance and read or write properties in these bags.
24
+ * @name chip.bag
25
+ * @since 1.5.0
26
+ */
27
+
28
+ Chip.addContract("bag", function (oChipInstance) {
29
+ var fnBagsUpdatedHandler;
30
+ /**
31
+ * Returns the associated property bag for a given ID. If no bag with the given ID exists, a
32
+ * new, empty bag is created on the fly.
33
+ *
34
+ * @name chip.bag.getBag
35
+ * @function
36
+ * @since 1.5.0
37
+ * @param {string} sBagId
38
+ * The ID of the bag to be returned
39
+ * @returns {sap.ushell_abap.pbServices.ui2.Bag}
40
+ * The associated bag
41
+ */
42
+ this.getBag = function (sBagId) {
43
+ return oChipInstance.getBag(sBagId);
44
+ };
45
+
46
+ /**
47
+ * Returns an array of IDs of all associated property bags which currently exist.
48
+ * Note that new bags are created on the fly if you call <code>getBag</code> with any other ID.
49
+ *
50
+ * @name chip.bag.getBagIds
51
+ * @function
52
+ * @since 1.5.0
53
+ * @returns {string[]}
54
+ * IDs of associated bags
55
+ */
56
+ this.getBagIds = function () {
57
+ return oChipInstance.getBagIds();
58
+ };
59
+
60
+ /**
61
+ * Returns this CHIP instance's original language as BCP-47.
62
+ * If you are logged on in the same language or if the original language is empty, translatable
63
+ * texts can be created and modified for this CHIP instance and its bags.
64
+ * See {@link sap.ushell_abap.pbServices.ui2.Bag#setText}.
65
+ * <p>
66
+ * Note: Handling of translatable texts depends on the layer used. In some layers the original
67
+ * language is important; in others it does not matter. In the latter case the empty string
68
+ * (<code>""</code>) is returned, which indicates that the user is allowed to edit the
69
+ * translatable texts in any language.
70
+ * <p>
71
+ * The following code is a flexible way of checking the current situation without knowing the
72
+ * current language or layer:
73
+ * <pre>
74
+ * if (oChipInstance.getOriginalLanguage() === "" || oChipInstance.getOriginalLanguage() ===
75
+ * sap.ui.getCore().getConfiguration().getLanguage()) {
76
+ * // create and modify the CHIP instance's texts
77
+ * }
78
+ * </pre>
79
+ * <p>
80
+ *
81
+ * @name chip.bag.getOriginalLanguage
82
+ * @function
83
+ * @returns {string}
84
+ * this CHIP instance's original language (BCP-47) or <code>""</code>
85
+ * @since 1.17.1
86
+ */
87
+ this.getOriginalLanguage = function () {
88
+ return oChipInstance.getPage() && oChipInstance.getPage().getOriginalLanguage();
89
+ };
90
+
91
+ /**
92
+ * Usually the Page Builder does not know about the internals of a CHIP, but there are special
93
+ * CHIPs (e.g. SAP Fiori Launchpad app launcher tiles, also serving as bookmark tiles) the
94
+ * Page Builder knows about the internals. In certain cases the Page Builder changes the bag
95
+ * data of the CHIP and is able to notify the CHIP Instance what bag(s) have been updated,
96
+ * so the CHIP instance can update the view.
97
+ *
98
+ * Note: The event must be explicitly triggered by the Page Builder. There is no automatic mechanism.
99
+ *
100
+ * @name chip.bag.attachBagsUpdated
101
+ * @function
102
+ * @param {function(string[])} fnHandler
103
+ * Handler which is called if the Page Builder updates one or multiple related bags. The
104
+ * receives as first parameter an array containing all the IDs of the updated bags
105
+ * @since 1.34.0
106
+ * @private
107
+ * @see contract.bag.fireBagsUpdated
108
+ */
109
+ this.attachBagsUpdated = function (fnHandler) {
110
+ // Back channel for FLP bookmark tiles, as they are managed by the FLP Bookmark Service.
111
+ // The FLP directly changes the bag data of the bookmark tile and can notify the bookmark
112
+ // tiles afterwards about the changes, so the bookmark tiles can update their views with
113
+ // the new bag data
114
+ if (typeof fnHandler !== "function") {
115
+ throw new SrvcError("The given handler is not a function", "chip.bag");
116
+ }
117
+ fnBagsUpdatedHandler = fnHandler;
118
+ };
119
+
120
+ /**
121
+ * @namespace The namespace for the contract interface (to be used by a page builder) for
122
+ * the <code>bag</code> contract.
123
+ * @name contract.bag
124
+ * @private
125
+ */
126
+ return { // contract - private as only used by Fiori Launchpad
127
+ /**
128
+ * Allows the page builder to inform the CHIP about changes in certain bags.
129
+ * Note: Usually the page builder should not care about the content of the bags; however, for bookmark tiles
130
+ * in the Fiori Launchpad this is required as the Fiori Launchpad manages them.
131
+ *
132
+ * @name contract.bag.fireBagsUpdated
133
+ * @function
134
+ * @param {string[]} aUpdatedBagIds
135
+ * array of bag IDs which have been updated by the page builder
136
+ * @since 1.34.0
137
+ * @private
138
+ * @see chip.bag.attachBagsUpdated
139
+ */
140
+ fireBagsUpdated: function (aUpdatedBagIds) {
141
+ if (!Utils.isArray(aUpdatedBagIds) || aUpdatedBagIds.length < 1) {
142
+ throw new SrvcError("At least one bag ID must be given", "contract.bag");
143
+ }
144
+ if (fnBagsUpdatedHandler) {
145
+ fnBagsUpdatedHandler(aUpdatedBagIds);
146
+ }
147
+ }
148
+ };
149
+ });
150
+ });