@sapui5/sap.ushell_abap 1.97.1 → 1.100.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 (97) hide show
  1. package/package.json +1 -1
  2. package/src/main/js/sap/ushell_abap/.library +2 -2
  3. package/src/main/js/sap/ushell_abap/adapters/abap/AdapterContainer.js +1 -1
  4. package/src/main/js/sap/ushell_abap/adapters/abap/AppStateAdapter.js +2 -2
  5. package/src/main/js/sap/ushell_abap/adapters/abap/ClientSideTargetResolutionAdapter.js +2 -2
  6. package/src/main/js/sap/ushell_abap/adapters/abap/ConfigurationDefaultsAdapter.js +2 -2
  7. package/src/main/js/sap/ushell_abap/adapters/abap/ContainerAdapter.js +16 -2
  8. package/src/main/js/sap/ushell_abap/adapters/abap/LaunchPageAdapter.js +37 -4
  9. package/src/main/js/sap/ushell_abap/adapters/abap/MenuAdapter.js +65 -15
  10. package/src/main/js/sap/ushell_abap/adapters/abap/NavTargetResolutionAdapter.js +2 -2
  11. package/src/main/js/sap/ushell_abap/adapters/abap/PageBuildingAdapter.js +2 -2
  12. package/src/main/js/sap/ushell_abap/adapters/abap/PagePersistenceAdapter.js +1577 -36
  13. package/src/main/js/sap/ushell_abap/adapters/abap/PersonalizationAdapter.js +2 -2
  14. package/src/main/js/sap/ushell_abap/adapters/abap/SearchAdapter.js +2 -2
  15. package/src/main/js/sap/ushell_abap/adapters/abap/SupportTicketAdapter.js +2 -2
  16. package/src/main/js/sap/ushell_abap/adapters/abap/Ui5ComponentLoaderAdapter.js +2 -2
  17. package/src/main/js/sap/ushell_abap/adapters/abap/UserInfoAdapter.js +1 -1
  18. package/src/main/js/sap/ushell_abap/adapters/hana/ContainerAdapter.js +2 -2
  19. package/src/main/js/sap/ushell_abap/bootstrap/evo/XhrLogonEventHandler.js +1 -1
  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-loader.js +7 -0
  22. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap-def.js +13 -10
  23. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.backend.config.requestor.js +198 -0
  24. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.bootstrap.utils.js +6 -4
  25. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.configure.ushell.js +2 -2
  26. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.constants.js +1 -1
  27. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.js +1 -1
  28. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.load.launchpad.js +2 -17
  29. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.request.pageset.js +1 -1
  30. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.request.startup.js +1 -1
  31. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.theme.handler.js +1 -1
  32. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.ui5.boot.handler.js +1 -1
  33. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.xhr.handler.js +1 -1
  34. package/src/main/js/sap/ushell_abap/bootstrap/evo/boottask.js +10 -16
  35. package/src/main/js/sap/ushell_abap/library.js +3 -3
  36. package/src/main/js/sap/ushell_abap/pbServices/ui2/AllCatalogs.js +1 -1
  37. package/src/main/js/sap/ushell_abap/pbServices/ui2/Bag.js +1 -6
  38. package/src/main/js/sap/ushell_abap/pbServices/ui2/Catalog.js +1 -1
  39. package/src/main/js/sap/ushell_abap/pbServices/ui2/Chip.js +172 -17
  40. package/src/main/js/sap/ushell_abap/pbServices/ui2/ChipDefinition.js +1 -1
  41. package/src/main/js/sap/ushell_abap/pbServices/ui2/ChipInstance.js +14 -6
  42. package/src/main/js/sap/ushell_abap/pbServices/ui2/Error.js +1 -1
  43. package/src/main/js/sap/ushell_abap/pbServices/ui2/Factory.js +1 -1
  44. package/src/main/js/sap/ushell_abap/pbServices/ui2/ODataService.js +1 -1
  45. package/src/main/js/sap/ushell_abap/pbServices/ui2/ODataWrapper.js +1 -1
  46. package/src/main/js/sap/ushell_abap/pbServices/ui2/Page.js +1 -8
  47. package/src/main/js/sap/ushell_abap/pbServices/ui2/PageBuildingService.js +1 -1
  48. package/src/main/js/sap/ushell_abap/pbServices/ui2/PageSet.js +1 -1
  49. package/src/main/js/sap/ushell_abap/pbServices/ui2/RemoteCatalogService.js +1 -1
  50. package/src/main/js/sap/ushell_abap/pbServices/ui2/Utils.js +1 -8
  51. package/src/main/js/sap/ushell_abap/pbServices/ui2/chipdefinition.xsd +0 -1
  52. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/actions.js +1 -1
  53. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/bag.js +1 -1
  54. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/configuration.js +1 -1
  55. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/configurationUi.js +48 -6
  56. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/fullscreen.js +1 -1
  57. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/preview.js +1 -1
  58. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/refresh.js +1 -1
  59. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/search.js +1 -1
  60. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/types.js +1 -1
  61. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/url.js +1 -1
  62. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/visible.js +1 -1
  63. package/src/main/js/sap/ushell_abap/support/plugins/app-infra/AppInfraOnSapNetWeaverSupportPlugin.js +1 -1
  64. package/src/main/js/sap/ushell_abap/ui5appruntime/AppInfoAdapter.js +1 -1
  65. package/ui5.yaml +379 -32
  66. package/src/main/js/sap/ui2/srvc/ODataService.js +0 -267
  67. package/src/main/js/sap/ui2/srvc/ODataWrapper.js +0 -1283
  68. package/src/main/js/sap/ui2/srvc/PageBuildingService.js +0 -1508
  69. package/src/main/js/sap/ui2/srvc/RemoteCatalogService.js +0 -49
  70. package/src/main/js/sap/ui2/srvc/allcatalogs.js +0 -197
  71. package/src/main/js/sap/ui2/srvc/bag.js +0 -711
  72. package/src/main/js/sap/ui2/srvc/catalog.js +0 -946
  73. package/src/main/js/sap/ui2/srvc/chip.js +0 -1035
  74. package/src/main/js/sap/ui2/srvc/chipdefinition.js +0 -228
  75. package/src/main/js/sap/ui2/srvc/chipinstance.js +0 -944
  76. package/src/main/js/sap/ui2/srvc/contracts/actions.js +0 -239
  77. package/src/main/js/sap/ui2/srvc/contracts/bag.js +0 -145
  78. package/src/main/js/sap/ui2/srvc/contracts/configuration.js +0 -161
  79. package/src/main/js/sap/ui2/srvc/contracts/configurationUi.js +0 -326
  80. package/src/main/js/sap/ui2/srvc/contracts/fullscreen.js +0 -69
  81. package/src/main/js/sap/ui2/srvc/contracts/navigation.js +0 -48
  82. package/src/main/js/sap/ui2/srvc/contracts/preview.js +0 -289
  83. package/src/main/js/sap/ui2/srvc/contracts/refresh.js +0 -42
  84. package/src/main/js/sap/ui2/srvc/contracts/search.js +0 -109
  85. package/src/main/js/sap/ui2/srvc/contracts/searchProvider.js +0 -46
  86. package/src/main/js/sap/ui2/srvc/contracts/types.js +0 -9
  87. package/src/main/js/sap/ui2/srvc/contracts/url.js +0 -104
  88. package/src/main/js/sap/ui2/srvc/contracts/visible.js +0 -122
  89. package/src/main/js/sap/ui2/srvc/error.js +0 -54
  90. package/src/main/js/sap/ui2/srvc/factory.js +0 -656
  91. package/src/main/js/sap/ui2/srvc/page.js +0 -934
  92. package/src/main/js/sap/ui2/srvc/pageset.js +0 -466
  93. package/src/main/js/sap/ui2/srvc/utils.js +0 -923
  94. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.get.server.config.Urls.js +0 -108
  95. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.request.server.config.js +0 -69
  96. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.validate.Url.js +0 -54
  97. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/navigation.js +0 -50
@@ -1,239 +0,0 @@
1
- // Copyright (c) 2009-2020 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
- (function () {
8
- "use strict";
9
-
10
- // Note: jQuery might not yet be available!
11
- if (typeof jQuery === "function" && jQuery.sap) {
12
- jQuery.sap.declare("sap.ui2.srvc.contracts.actions");
13
- jQuery.sap.declare("sap.ui2.srvc.contracts.types");
14
- jQuery.sap.require("sap.ui2.srvc.chip");
15
- }
16
-
17
- /**
18
- * @namespace The namespace for the CHIP API's <code>actions</code> contract, which
19
- * allows you to provide a CHIP's actions with all related functionality.
20
- * @name chip.actions
21
- * @since 1.25.0
22
- */
23
-
24
- sap.ui2.srvc.Chip.addContract("actions", function (oChipInstance) {
25
- var fnActionsProvider;
26
-
27
- /**
28
- * Determines the callback function which provides the internal actions for this CHIP. The
29
- * callback has to return an array of actions. Action is an object with the following
30
- * properties: text, icon and targetURL or a press handler.
31
- * @example:
32
- * <code>[
33
- * {
34
- * text: "Some Action",
35
- * icon: "sap-icon://action",
36
- * targetURL: "#SemanticObject-Action"
37
- * },
38
- * {
39
- * text: "Settings",
40
- * icon: "sap-icon://action-settings",
41
- * press: function (oEvent){
42
- * //Open settings UI
43
- * }
44
- * }
45
- * ]
46
- * </code>.
47
- *
48
- * An embedding application calls this function each time it wants to display the CHIP's
49
- * actions.
50
- *
51
- * Use <code>Function.prototype.bind()</code> to determine the callback's <code>this</code> or
52
- * some of its arguments.
53
- *
54
- * @name chip.actions.setActionsProvider
55
- * @function
56
- * @since 1.25.0
57
- * @param {function} fnProvider
58
- * a callback which returns an array of action objects representing this CHIP's internal actions.
59
- */
60
- this.setActionsProvider = function (fnProvider) {
61
- if (typeof fnProvider !== "function") {
62
- throw new sap.ui2.srvc.Error("CHIP actions provider is not a function", "chip.actions");
63
- }
64
- fnActionsProvider = fnProvider;
65
- };
66
-
67
- /**
68
- * @namespace The namespace for the contract interface (to be used by a page builder) for
69
- * the <code>actions</code> contract, which allows you to get a CHIP's actions with all related functionality.
70
- * @name contract.actions
71
- * @since 1.25.0
72
- */
73
- return {
74
- /**
75
- * Returns this CHIP's internal actions, if available.
76
- *
77
- * @returns {Array}
78
- * this CHIP's internal actions array
79
- *
80
- * @name contract.actions.getActions
81
- * @function
82
- * @since 1.25.0
83
- *
84
- * @see chip.actions.setActionsProvider
85
- */
86
- getActions: function () {
87
- if (fnActionsProvider) {
88
- return fnActionsProvider();
89
- }
90
- return [];
91
- }
92
- };
93
- });
94
-
95
- // the "contracts" mechanism requires a host to provide the functionality
96
- // (it is not "optional")
97
- // When the EP uses the ABAP JS sources, the contract should be made available.
98
- // thus we make the contract available in this *file* to avoid
99
- // having to have a separate script tag within the EP resource
100
- // (note that contracts due to ancient design can not be required)
101
-
102
- /**
103
- * @namespace The namespace for the CHIP API's <code>types</code> contract, which allows the CHIP
104
- * to offer multiple visualizations from which the page builder can choose.
105
- * @name chip.types
106
- * @since 1.32.0
107
- */
108
-
109
- sap.ui2.srvc.Chip.addContract("types", function (oChipInstance) {
110
- var sCurrentType,
111
- fnSetTypeHandler;
112
-
113
- /**
114
- * Attaches the given event handler to the change event which is fired whenever the page builder
115
- * wants to change the current type of visualization. The CHIP has to react accordingly and
116
- * change the visualization after the handler is called. The event handler should return a
117
- * <code>jQuery.Deferred</code> object's promise to inform the caller whether the visualization
118
- * has been changed (or failed). In the latter case an error message should be provided.
119
- * In case the type was changed before the handler was attached, the handler gets called
120
- * immediately after registration. This also works when the handler is overwritten by a
121
- * different one.
122
- *
123
- * Use <code>Function.prototype.bind()</code> to determine the event handler's
124
- * <code>this</code> or some of its arguments.
125
- *
126
- * Note: Without such an event handler, it will not be possible to change the visualization of
127
- * the CHIP during runtime.
128
- *
129
- * @name chip.types.attachTypeChange
130
- * @function
131
- *
132
- * @param {function (string)} fnHandler
133
- * the handler for changing the visualization type of the CHIP. The first argument will be
134
- * the set type. The function <b>must</b> return a <code>jQuery.Deferred</code>
135
- * object's promise.
136
- *
137
- * @throws Error if <code>fnHandler</code> is not a function or if fnHandler.
138
- * @throws If fnHandler is directly called (because a type was cached) and throws an error.
139
- *
140
- * @since 1.32.0
141
- * @see contract.types.setType
142
- * @see chip.types.getAvailableTypes
143
- */
144
- this.attachSetType = function (fnHandler) {
145
- if (typeof fnHandler !== "function") {
146
- throw new sap.ui2.srvc.Error("Change event handler is not a function",
147
- "chip.types");
148
- }
149
- if (fnSetTypeHandler === fnHandler) {
150
- // nothing to do, especially do not call the handler again (assumption: better performance)
151
- return;
152
- }
153
- fnSetTypeHandler = fnHandler;
154
-
155
- // a type was already set, so fire the new handler directly
156
- if (sCurrentType) {
157
- // do not catch errors here -> fail early (the CHIP throws the error so it has to catch it)
158
- fnSetTypeHandler(sCurrentType);
159
- }
160
- };
161
-
162
- /**
163
- * @namespace The namespace for the contract interface (to be used by a page builder) for
164
- * the <code>types</code> contract, which allows you to change the CHIP's type of visualization.
165
- * @name contract.types
166
- * @since 1.32.0
167
- */
168
- return { // contract
169
- /**
170
- * Returns the list of available types of visualization. The types are always lower case.
171
- *
172
- * @name chip.types.getAvailableTypes
173
- * @function
174
- * @returns {string[]}
175
- * the available tile types in lower case, e.g. <code>["tile", "link"]</code>
176
- * @since 1.32.0
177
- */
178
- getAvailableTypes: function () {
179
- // note: getAvailableTypes does a toLowerCase
180
- return oChipInstance.getChip().getAvailableTypes();
181
- },
182
-
183
- /**
184
- * Returns the default visualization type of the chip instance
185
- *
186
- * @returns {string}
187
- * The default visualization type
188
- *
189
- * @since 1.86.0
190
- */
191
- getDefaultType: function () {
192
- return oChipInstance.getChip().getDefaultType();
193
- },
194
- /**
195
- * Informs the CHIP to change it's visualization type to <code>sType</code>. In case the CHIP
196
- * has not attached an handler for this event yet, the contract will call the handler directly
197
- * while attaching it.
198
- *
199
- * @param {string} sType
200
- * The type to be set.
201
- * Note: Before comparison <code>sType.toLowerCase()</code> will be used.
202
- *
203
- * @throws Error if <code>sType</code> is not valid.
204
- *
205
- * @name contract.types.setType
206
- * @function
207
- * @since 1.32.0
208
- *
209
- * @see chip.types.attachSetType
210
- * @see chip.types.getAvailableTypes
211
- */
212
- setType: function (sType) {
213
- var sTypeLowerCase;
214
- if (typeof sType !== "string" || sType === "") {
215
- throw new sap.ui2.srvc.Error("The given type is not a string",
216
- "contract.types");
217
- }
218
- sTypeLowerCase = sType.toLowerCase();
219
- if (this.getAvailableTypes().indexOf(sTypeLowerCase) < 0) {
220
- throw new sap.ui2.srvc.Error("The CHIP does not support type '" + sTypeLowerCase + "'",
221
- "contract.types");
222
- }
223
-
224
- // type is valid. cache it in case a (new) handler is registered
225
- sCurrentType = sTypeLowerCase;
226
-
227
- if (!fnSetTypeHandler) {
228
- return;
229
- }
230
- try {
231
- fnSetTypeHandler(sTypeLowerCase);
232
- } catch (e) {
233
- jQuery.sap.log.error("Could not set CHIP type '" + sTypeLowerCase + "': "
234
- + (e.message || e.toString()), null, "chip.types");
235
- }
236
- }
237
- };
238
- });
239
- }());
@@ -1,145 +0,0 @@
1
- // Copyright (c) 2009-2020 SAP SE, All Rights Reserved
2
-
3
- /**
4
- * @fileOverview The <code>bag</code> contract.
5
- */
6
- (function () {
7
- "use strict";
8
-
9
- // Note: jQuery might not yet be available!
10
- if (typeof jQuery === "function" && jQuery.sap) {
11
- jQuery.sap.declare("sap.ui2.srvc.contracts.bag");
12
- jQuery.sap.require("sap.ui2.srvc.chip");
13
- jQuery.sap.require("sap.ui2.srvc.utils");
14
- }
15
-
16
- /**
17
- * @namespace The namespace for the CHIP API's <code>bag</code> contract, which allows you to
18
- * access property bags attached to a CHIP instance and read or write properties in these bags.
19
- * @name chip.bag
20
- * @since 1.5.0
21
- */
22
-
23
- sap.ui2.srvc.Chip.addContract("bag", function (oChipInstance) {
24
- var fnBagsUpdatedHandler;
25
- /**
26
- * Returns the associated property bag for a given ID. If no bag with the given ID exists, a
27
- * new, empty bag is created on the fly.
28
- *
29
- * @name chip.bag.getBag
30
- * @function
31
- * @since 1.5.0
32
- * @param {string} sBagId
33
- * The ID of the bag to be returned
34
- * @returns {sap.ui2.srvc.Bag}
35
- * The associated bag
36
- */
37
- this.getBag = function (sBagId) {
38
- return oChipInstance.getBag(sBagId);
39
- };
40
-
41
- /**
42
- * Returns an array of IDs of all associated property bags which currently exist.
43
- * Note that new bags are created on the fly if you call <code>getBag</code> with any other ID.
44
- *
45
- * @name chip.bag.getBagIds
46
- * @function
47
- * @since 1.5.0
48
- * @returns {string[]}
49
- * IDs of associated bags
50
- */
51
- this.getBagIds = function () {
52
- return oChipInstance.getBagIds();
53
- };
54
-
55
- /**
56
- * Returns this CHIP instance's original language as BCP-47.
57
- * If you are logged on in the same language or if the original language is empty, translatable
58
- * texts can be created and modified for this CHIP instance and its bags.
59
- * See {@link sap.ui2.srvc.Bag#setText}.
60
- * <p>
61
- * Note: Handling of translatable texts depends on the layer used. In some layers the original
62
- * language is important; in others it does not matter. In the latter case the empty string
63
- * (<code>""</code>) is returned, which indicates that the user is allowed to edit the
64
- * translatable texts in any language.
65
- * <p>
66
- * The following code is a flexible way of checking the current situation without knowing the
67
- * current language or layer:
68
- * <pre>
69
- * if (oChipInstance.getOriginalLanguage() === "" || oChipInstance.getOriginalLanguage() ===
70
- * sap.ui.getCore().getConfiguration().getLanguage()) {
71
- * // create and modify the CHIP instance's texts
72
- * }
73
- * </pre>
74
- * <p>
75
- *
76
- * @name chip.bag.getOriginalLanguage
77
- * @function
78
- * @returns {string}
79
- * this CHIP instance's original language (BCP-47) or <code>""</code>
80
- * @since 1.17.1
81
- */
82
- this.getOriginalLanguage = function () {
83
- return oChipInstance.getPage() && oChipInstance.getPage().getOriginalLanguage();
84
- };
85
-
86
- /**
87
- * Usually the Page Builder does not know about the internals of a CHIP, but there are special
88
- * CHIPs (e.g. SAP Fiori Launchpad app launcher tiles, also serving as bookmark tiles) the
89
- * Page Builder knows about the internals. In certain cases the Page Builder changes the bag
90
- * data of the CHIP and is able to notify the CHIP Instance what bag(s) have been updated,
91
- * so the CHIP instance can update the view.
92
- *
93
- * Note: The event must be explicitly triggered by the Page Builder. There is no automatic mechanism.
94
- *
95
- * @name chip.bag.attachBagsUpdated
96
- * @function
97
- * @param {function(string[])} fnHandler
98
- * Handler which is called if the Page Builder updates one or multiple related bags. The
99
- * receives as first parameter an array containing all the IDs of the updated bags
100
- * @since 1.34.0
101
- * @private
102
- * @see contract.bag.fireBagsUpdated
103
- */
104
- this.attachBagsUpdated = function (fnHandler) {
105
- // Back channel for FLP bookmark tiles, as they are managed by the FLP Bookmark Service.
106
- // The FLP directly changes the bag data of the bookmark tile and can notify the bookmark
107
- // tiles afterwards about the changes, so the bookmark tiles can update their views with
108
- // the new bag data
109
- if (typeof fnHandler !== "function") {
110
- throw new sap.ui2.srvc.Error("The given handler is not a function", "chip.bag");
111
- }
112
- fnBagsUpdatedHandler = fnHandler;
113
- };
114
-
115
- /**
116
- * @namespace The namespace for the contract interface (to be used by a page builder) for
117
- * the <code>bag</code> contract.
118
- * @name contract.bag
119
- * @private
120
- */
121
- return { // contract - private as only used by Fiori Launchpad
122
- /**
123
- * Allows the page builder to inform the CHIP about changes in certain bags.
124
- * Note: Usually the page builder should not care about the content of the bags; however, for bookmark tiles
125
- * in the Fiori Launchpad this is required as the Fiori Launchpad manages them.
126
- *
127
- * @name contract.bag.fireBagsUpdated
128
- * @function
129
- * @param {string[]} aUpdatedBagIds
130
- * array of bag IDs which have been updated by the page builder
131
- * @since 1.34.0
132
- * @private
133
- * @see chip.bag.attachBagsUpdated
134
- */
135
- fireBagsUpdated: function (aUpdatedBagIds) {
136
- if (!sap.ui2.srvc.isArray(aUpdatedBagIds) || aUpdatedBagIds.length < 1) {
137
- throw new sap.ui2.srvc.Error("At least one bag ID must be given", "contract.bag");
138
- }
139
- if (fnBagsUpdatedHandler) {
140
- fnBagsUpdatedHandler(aUpdatedBagIds);
141
- }
142
- }
143
- };
144
- });
145
- }());
@@ -1,161 +0,0 @@
1
- // Copyright (c) 2009-2020 SAP SE, All Rights Reserved
2
-
3
- /**
4
- * @fileOverview The <code>configuration</code> contract.
5
- */
6
- (function () {
7
- "use strict";
8
-
9
- // Note: jQuery might not yet be available!
10
- if (typeof jQuery === "function" && jQuery.sap) {
11
- jQuery.sap.declare("sap.ui2.srvc.contracts.configuration");
12
- jQuery.sap.require("sap.ui2.srvc.chip");
13
- }
14
-
15
- /**
16
- * @namespace The namespace for the CHIP API's <code>configuration</code> contract, which allows
17
- * you to read configuration parameters.
18
- * @name chip.configuration
19
- * @since 1.2.0
20
- */
21
-
22
- sap.ui2.srvc.Chip.addContract("configuration", function (oChipInstance) {
23
- var fnUpdatedHandler;
24
-
25
- /**
26
- * Returns the value of the configuration parameter with the given name as a
27
- * string.
28
- *
29
- * Note: Use <code>JSON.parse(sParameterValue)</code> for values which represent
30
- * objects or arrays, use <code>parseInt(sParameterValue, 10)<code> for values
31
- * which represent integers, etc.
32
- *
33
- * @name chip.configuration.getParameterValueAsString
34
- * @function
35
- * @since 1.2.0
36
- * @param {string} sParameterName
37
- * the parameter's name
38
- * @returns {string}
39
- * the parameter's value
40
- */
41
- this.getParameterValueAsString = function (sParameterName) {
42
- return oChipInstance.getConfigurationParameter(sParameterName);
43
- };
44
-
45
- /**
46
- * Usually the Page Builder does not know about the internals of a CHIP, but there are special
47
- * CHIPs (e.g. SAP Fiori Launchpad app launcher tiles, also serving as bookmark tiles) the
48
- * Page Builder knows about the internals. In certain cases the Page Builder changes the configuration
49
- * data of the CHIP and is able to notify the CHIP Instance what configuration properties have been updated,
50
- * so the CHIP instance can update based on the new data.
51
- *
52
- * Note: The event must be explicitly triggered by the Page Builder. There is no automatic mechanism.
53
- *
54
- * @name chip.configuration.attachConfigurationUpdated
55
- * @function
56
- * @param {function(string[])} fnHandler
57
- * Handler which is called if the Page Builder updates one or multiple configuration properties on
58
- * the CHIP instance. fnHandler receives as first parameter an array containing keys of all first level
59
- * configuration properties which have been updated.
60
- * @since 1.46.0
61
- * @private
62
- * @see contract.configuration.fireConfigurationUpdated
63
- */
64
- this.attachConfigurationUpdated = function (fnHandler) {
65
- // Back channel for FLP bookmark tiles, as they are managed by the FLP Bookmark Service.
66
- // The FLP directly changes the configuration data of the bookmark tile and can notify the bookmark
67
- // tiles afterwards about the changes, so the bookmark tiles can update themselves with the new data.
68
- if (typeof fnHandler !== "function") {
69
- throw new sap.ui2.srvc.Error("The given handler is not a function",
70
- "chip.configuration");
71
- }
72
- fnUpdatedHandler = fnHandler;
73
- };
74
-
75
- /**
76
- * @namespace The namespace for the contract interface (to be used by a page builder) for
77
- * the <code>configuration</code> contract.
78
- * @name contract.configuration
79
- * @private
80
- */
81
- return { // contract - private as only used by Fiori Launchpad
82
- /**
83
- * Allows the page builder to inform the CHIP about changes of certain configuration properties.
84
- * Note: Usually the page builder should not care about the content of the CHIP's configuration; however,
85
- * for bookmark tiles in SAP Fiori Launchpad this is required as the SAP Fiori Launchpad manages them.
86
- *
87
- * @name contract.configuration.fireConfigurationUpdated
88
- * @function
89
- * @param {string[]} aUpdatedConfigKeys
90
- * array of first-level configuration property keys which have been updated by the page builder
91
- * @since 1.46.0
92
- * @private
93
- * @see chip.configuration.attachBagsUpdated
94
- */
95
- fireConfigurationUpdated: function (aUpdatedConfigKeys) {
96
- if (!sap.ui2.srvc.isArray(aUpdatedConfigKeys) || aUpdatedConfigKeys.length < 1) {
97
- throw new sap.ui2.srvc.Error("At least one configuration property key must be given",
98
- "contract.configuration");
99
- }
100
- if (fnUpdatedHandler) {
101
- fnUpdatedHandler(aUpdatedConfigKeys);
102
- }
103
- }
104
- };
105
- });
106
-
107
- /**
108
- * @namespace The namespace for the CHIP API's <code>writeConfiguration</code> contract which
109
- * allows you to write configuration parameters.
110
- * @name chip.writeConfiguration
111
- * @since 1.7.0
112
- */
113
-
114
- sap.ui2.srvc.Chip.addContract("writeConfiguration", function (oChipInstance) {
115
- /**
116
- * Sets the values of the given configuration parameters and persists the updated chip
117
- * instance. All parameters that actually were defined in the CHIP definition XML are accepted.
118
- * All others will raise a warning to the log.
119
- * <p>
120
- * The configuration is maintained as JSON string in a single property. This has the following
121
- * consequences regarding the scopes:
122
- * <ul>
123
- * <li>If the CHIP instance has never been persisted in the current scope, the configuration is
124
- * inherited from lower scopes. If there are no changes either, the properties have their
125
- * default values from the CHIP definition.
126
- * <li>When persisting the CHIP instance in a given scope for the first time (may it be due to
127
- * configuration changes or title changes...), the configuration changes are merged with
128
- * inherited changes from lower scopes and persisted in the current scope. Subsequent changes
129
- * in lower scopes will then remain invisible.
130
- * <li>A property for which never an update was supplied has the default value from the CHIP
131
- * definition. This also applies if you delete the update again by setting it to
132
- * <code>undefined</code>.
133
- * </ul>
134
- * <b>Example:</b><br>
135
- * The CHIP has two properties: <code>a</code> with default value "foo" and <code>b</code> with
136
- * default value "bar". The administrator changes <code>a</code> to "baz" in scope CUST. Later
137
- * a user changes <code>b</code> in PERS. Then the administrator decides to change
138
- * <code>a</code> back to "foo", but our user will never see this again, because the system
139
- * persisted both <code>a</code> and <code>b</code> in PERS.
140
- *
141
- * @name chip.writeConfiguration.setParameterValues
142
- * @function
143
- * @since 1.7.0
144
- * @param {map<String,String>} mConfigurationUpdates
145
- * The configuration updates. The values must be strings. You can however set a value to
146
- * <code>undefined</code>. This removes it from the list of updated properties and effectively
147
- * resets it to the default value.
148
- * @param {function ()} [fnSuccess]
149
- * no-args success handler
150
- * @param {function (string, object=)} [fnFailure]
151
- * error handler taking an error message and, since version 1.28.6, an
152
- * optional object containing the complete error information as delivered
153
- * by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
154
- * for more details.
155
- * The default error handler is provided by the page builder
156
- */
157
- this.setParameterValues = function (mConfigurationUpdates, fnSuccess, fnFailure) {
158
- oChipInstance.updateConfiguration(mConfigurationUpdates, fnSuccess, fnFailure);
159
- };
160
- });
161
- }());