@sapui5/sap.ushell_abap 1.97.0 → 1.99.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 (95) 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 +2 -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 +1 -1
  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 +35 -15
  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 +1 -1
  23. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.bootstrap.utils.js +1 -1
  24. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.configure.ushell.js +2 -2
  25. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.constants.js +1 -1
  26. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.get.server.config.Urls.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.server.config.js +1 -1
  31. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.request.startup.js +1 -1
  32. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.theme.handler.js +1 -1
  33. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.ui5.boot.handler.js +1 -1
  34. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.validate.Url.js +1 -1
  35. package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.xhr.handler.js +1 -1
  36. package/src/main/js/sap/ushell_abap/bootstrap/evo/boottask.js +6 -12
  37. package/src/main/js/sap/ushell_abap/library.js +3 -3
  38. package/src/main/js/sap/ushell_abap/pbServices/ui2/AllCatalogs.js +1 -1
  39. package/src/main/js/sap/ushell_abap/pbServices/ui2/Bag.js +1 -6
  40. package/src/main/js/sap/ushell_abap/pbServices/ui2/Catalog.js +1 -1
  41. package/src/main/js/sap/ushell_abap/pbServices/ui2/Chip.js +127 -15
  42. package/src/main/js/sap/ushell_abap/pbServices/ui2/ChipDefinition.js +1 -1
  43. package/src/main/js/sap/ushell_abap/pbServices/ui2/ChipInstance.js +14 -6
  44. package/src/main/js/sap/ushell_abap/pbServices/ui2/Error.js +1 -1
  45. package/src/main/js/sap/ushell_abap/pbServices/ui2/Factory.js +1 -1
  46. package/src/main/js/sap/ushell_abap/pbServices/ui2/ODataService.js +1 -1
  47. package/src/main/js/sap/ushell_abap/pbServices/ui2/ODataWrapper.js +1 -1
  48. package/src/main/js/sap/ushell_abap/pbServices/ui2/Page.js +1 -8
  49. package/src/main/js/sap/ushell_abap/pbServices/ui2/PageBuildingService.js +1 -1
  50. package/src/main/js/sap/ushell_abap/pbServices/ui2/PageSet.js +1 -1
  51. package/src/main/js/sap/ushell_abap/pbServices/ui2/RemoteCatalogService.js +1 -1
  52. package/src/main/js/sap/ushell_abap/pbServices/ui2/Utils.js +1 -8
  53. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/actions.js +1 -1
  54. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/bag.js +1 -1
  55. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/configuration.js +1 -1
  56. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/configurationUi.js +1 -1
  57. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/fullscreen.js +1 -1
  58. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/preview.js +1 -1
  59. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/refresh.js +1 -1
  60. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/search.js +1 -1
  61. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/types.js +1 -1
  62. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/url.js +1 -1
  63. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/visible.js +1 -1
  64. package/src/main/js/sap/ushell_abap/support/plugins/app-infra/AppInfraOnSapNetWeaverSupportPlugin.js +1 -1
  65. package/src/main/js/sap/ushell_abap/ui5appruntime/AppInfoAdapter.js +1 -1
  66. package/ui5.yaml +376 -30
  67. package/src/main/js/sap/ui2/srvc/ODataService.js +0 -267
  68. package/src/main/js/sap/ui2/srvc/ODataWrapper.js +0 -1283
  69. package/src/main/js/sap/ui2/srvc/PageBuildingService.js +0 -1508
  70. package/src/main/js/sap/ui2/srvc/RemoteCatalogService.js +0 -49
  71. package/src/main/js/sap/ui2/srvc/allcatalogs.js +0 -197
  72. package/src/main/js/sap/ui2/srvc/bag.js +0 -711
  73. package/src/main/js/sap/ui2/srvc/catalog.js +0 -946
  74. package/src/main/js/sap/ui2/srvc/chip.js +0 -1035
  75. package/src/main/js/sap/ui2/srvc/chipdefinition.js +0 -228
  76. package/src/main/js/sap/ui2/srvc/chipinstance.js +0 -944
  77. package/src/main/js/sap/ui2/srvc/contracts/actions.js +0 -239
  78. package/src/main/js/sap/ui2/srvc/contracts/bag.js +0 -145
  79. package/src/main/js/sap/ui2/srvc/contracts/configuration.js +0 -161
  80. package/src/main/js/sap/ui2/srvc/contracts/configurationUi.js +0 -326
  81. package/src/main/js/sap/ui2/srvc/contracts/fullscreen.js +0 -69
  82. package/src/main/js/sap/ui2/srvc/contracts/navigation.js +0 -48
  83. package/src/main/js/sap/ui2/srvc/contracts/preview.js +0 -289
  84. package/src/main/js/sap/ui2/srvc/contracts/refresh.js +0 -42
  85. package/src/main/js/sap/ui2/srvc/contracts/search.js +0 -109
  86. package/src/main/js/sap/ui2/srvc/contracts/searchProvider.js +0 -46
  87. package/src/main/js/sap/ui2/srvc/contracts/types.js +0 -9
  88. package/src/main/js/sap/ui2/srvc/contracts/url.js +0 -104
  89. package/src/main/js/sap/ui2/srvc/contracts/visible.js +0 -122
  90. package/src/main/js/sap/ui2/srvc/error.js +0 -54
  91. package/src/main/js/sap/ui2/srvc/factory.js +0 -656
  92. package/src/main/js/sap/ui2/srvc/page.js +0 -934
  93. package/src/main/js/sap/ui2/srvc/pageset.js +0 -466
  94. package/src/main/js/sap/ui2/srvc/utils.js +0 -923
  95. package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/navigation.js +0 -50
@@ -1,944 +0,0 @@
1
- // Copyright (c) 2009-2020 SAP SE, All Rights Reserved
2
-
3
- /**
4
- * @fileOverview The <code>sap.ui2.srvc.ChipInstance</code> object with related functions.
5
- */
6
-
7
- this.sap = this.sap || {};
8
-
9
- (function () {
10
- "use strict";
11
-
12
- sap.ui2 = sap.ui2 || {};
13
- sap.ui2.srvc = sap.ui2.srvc || {};
14
-
15
- // Only declare the module if jQuery.sap exists. Otherwise we do not even try to require assuming
16
- // that the script has been loaded manually (before SAPUI5).
17
- // Load time branching pattern
18
- var fnRequire = String; // NOP (String exists and is free of side-effects)
19
- if (typeof jQuery === "function" && jQuery.sap) {
20
- jQuery.sap.declare("sap.ui2.srvc.chipinstance");
21
- // avoid fnRequire = jQuery.sap.require as require cannot be spied on afterwards
22
- fnRequire = function () {
23
- jQuery.sap.require.apply(this, arguments);
24
- };
25
- }
26
-
27
- // "public class" -----------------------------------------------------------
28
-
29
- /**
30
- * Constructs a new representation (wrapper) of the CHIP instance with the given
31
- * CHIP instance data as loaded from the page building service. A CHIP instance is a usage of a
32
- * CHIP in a page
33
- * <p>
34
- * Initially a stub is created, which can later load its properties and related objects
35
- * asynchronously.
36
- * <p>
37
- * A CHIP instance is a mutable object and (page building service related) changes can be
38
- * persisted by the page building service.
39
- *
40
- * @param {sap.ui2.srvc.Factory} oFactory
41
- * the factory
42
- * @param {object} oAlterEgo
43
- * the CHIP instance data as loaded via the page building service, including embedded
44
- * CHIP instance property bags
45
- * @param {sap.ui2.srvc.Chip} oChip
46
- * the CHIP (which might still be a stub)
47
- * @param {sap.ui2.srvc.Page} [oPage]
48
- * (since 1.9.0) the page to which this CHIP instance belongs
49
- *
50
- * @class
51
- * @see sap.ui2.srvc.PageBuildingService
52
- * @since 1.2.0
53
- */
54
- sap.ui2.srvc.ChipInstance = function (oFactory, oAlterEgo, oChip, oPage) {
55
- var oApi,
56
- oBags, // {sap.ui2.srvc.Map<string,sap.ui2.srvc.Bag>}
57
- oConfiguration,
58
- oContractsByName = new sap.ui2.srvc.Map(), // {sap.ui2.srvc.Map<string,object>}
59
- bFullscreen = false,
60
- aFullscreenHandlers = [],
61
- fnRefreshHandler,
62
- sTitle, // no own temporary title so far
63
- fnTitleChange,
64
- that = this;
65
-
66
- // BEWARE: constructor code below!
67
-
68
- // "private" methods ------------------------------------------------------
69
-
70
- /**
71
- * The alter ego object has some properties indicating that a CHIP instance is a reference.
72
- * This method modifies those properties in a way, that this CHIP instance becomes a
73
- * non-reference.
74
- * Should be called when an action was executed which made a reference CHIP instance a
75
- * non-reference in the backend.
76
- * @private
77
- */
78
- function makeNonReference () {
79
- // note: server sets "" (instead of undefined) for non-references
80
- oAlterEgo.referenceChipInstanceId = "";
81
- oAlterEgo.referencePageId = "";
82
- }
83
-
84
- /**
85
- * @see sap.ui2.srvc#Bag
86
- * @param {sap.ui2.srvc.Bag} oBag
87
- * unused
88
- * @private
89
- */
90
- function bagChangeHandler () {
91
- // copy on write: cannot be a reference anymore!
92
- makeNonReference();
93
-
94
- if (oPage) {
95
- // bag changes may result in Scope changes of the page
96
- oPage.updateScope();
97
- }
98
- }
99
-
100
- /**
101
- * Makes sure this CHIP instance is not just a stub.
102
- *
103
- * @private
104
- */
105
- function checkStub () {
106
- if (!oApi) {
107
- throw new sap.ui2.srvc.Error(that + ": CHIP instance is just a stub",
108
- "sap.ui2.srvc.ChipInstance");
109
- }
110
- }
111
-
112
- /**
113
- * Complete the construction of a CHIP instance and make it ready for full use
114
- * within a page builder: create CHIP API.
115
- *
116
- * @param {function ()} fnSuccess
117
- * no-args success handler
118
- * @param {function (string=)} [fnFailure]
119
- * error handler, taking an optional error message
120
- *
121
- * @private
122
- */
123
- function initialize (fnSuccess, fnFailure) {
124
- if (!oApi) {
125
- oApi = oChip.createApi(that, oContractsByName);
126
- }
127
-
128
- jQuery.sap.log.debug("Initialized: " + that, null, "sap.ui2.srvc.ChipInstance");
129
- sap.ui2.srvc.call(fnSuccess, fnFailure); // Note: this method was already called async.
130
- }
131
-
132
- /**
133
- * Initialize the bags from raw CHIP instance bags array.
134
- * @param {object[]} aRawChipInstanceBags
135
- * Array of raw CHIP instance bags
136
- *
137
- * @private
138
- */
139
- function initializeBags (aRawChipInstanceBags) {
140
- var i,
141
- aChipBagIds = oChip.getBagIds(),
142
- oRawBag;
143
- for (i = 0; i < aRawChipInstanceBags.length; i += 1) {
144
- // for each bag instance: create wrapper
145
- fnRequire("sap.ui2.srvc.bag");
146
- oBags.put(aRawChipInstanceBags[i].id,
147
- new sap.ui2.srvc.Bag(oFactory, aRawChipInstanceBags[i],
148
- oChip.getBag(aRawChipInstanceBags[i].id), bagChangeHandler));
149
- }
150
- for (i = 0; i < aChipBagIds.length; i += 1) {
151
- oRawBag = {
152
- pageId: oAlterEgo.pageId,
153
- instanceId: oAlterEgo.instanceId,
154
- id: aChipBagIds[i],
155
- $tmp: true
156
- };
157
- if (!oBags.containsKey(oRawBag.id)) { // do not overwrite CHIP instance bags!
158
- oBags.put(oRawBag.id,
159
- new sap.ui2.srvc.Bag(oFactory, oRawBag, oChip.getBag(oRawBag.id), bagChangeHandler));
160
- }
161
- }
162
- }
163
-
164
- /**
165
- * Lazily initialize this CHIP instance's configuration. Requires a complete
166
- * CHIP, not just a stub!
167
- *
168
- * @private
169
- */
170
- function initializeConfiguration () {
171
- if (oChip.isStub()) {
172
- // BCP 1780175765
173
- // fail early as updateConfiguration will also throw in this case which results in
174
- // oConfig being initialized wrongly to an empty object
175
- throw new sap.ui2.srvc.Error(this + ": initializeConfiguration expects that the CHIP is no stub anymore",
176
- "sap.ui2.srvc.ChipInstance", /*bLogError*/false);
177
- }
178
-
179
- if (!oConfiguration) {
180
- oConfiguration = {};
181
- oChip.updateConfiguration(oConfiguration, oAlterEgo.configuration);
182
- }
183
- }
184
-
185
- /**
186
- * Persists this CHIP instance.
187
- *
188
- * @param {function ()} [fnSuccess]
189
- * no-args success handler
190
- * @param {function (string, object=)} [fnFailure]
191
- * error handler taking an error message and, since version 1.28.6, an
192
- * optional object containing the complete error information as delivered
193
- * by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
194
- * for more details.
195
- * Default: see {@link sap.ui2.srvc.ODataService#getDefaultErrorHandler}
196
- *
197
- * @private
198
- */
199
- sap.ui2.srvc.testPublishAt(that);
200
- function persist (fnSuccess, fnFailure) {
201
- oFactory.getPageBuildingService().updatePageChipInstance(oAlterEgo,
202
- function () {
203
- // copy on write: we cannot be a reference anymore!
204
- makeNonReference();
205
-
206
- if (oPage) {
207
- oPage.updateScope();
208
- }
209
- if (fnSuccess) {
210
- fnSuccess(); // no-args!
211
- }
212
- }, fnFailure);
213
- }
214
-
215
- // "public" methods -------------------------------------------------------
216
-
217
- /**
218
- * Attaches the given event handler to the "fullscreen" event which is fired whenever
219
- * fullscreen mode is toggled. There can be multiple handlers at any time.
220
- *
221
- * Use <code>Function.prototype.bind()</code> to determine the event handler's
222
- * <code>this</code> or some of its arguments.
223
- *
224
- * Note: Without such an event handler, the CHIP will simply continue to display the
225
- * same content, no matter whether fullscreen mode is on or off.
226
- *
227
- * @param {function} fnEventHandler
228
- * the event handler for the "fullscreen" event
229
- * @since 1.2.0
230
- */
231
- this.attachFullscreen = function (fnEventHandler) {
232
- if (typeof fnEventHandler !== "function") {
233
- throw new sap.ui2.srvc.Error(this + ": fullscreen event handler is not a function",
234
- "sap.ui2.srvc.ChipInstance");
235
- }
236
- aFullscreenHandlers.push(fnEventHandler);
237
- };
238
-
239
- /**
240
- * Attaches the given event handler to the "refresh" event which is fired
241
- * whenever the user requests a refresh of this CHIP instance's content.
242
- *
243
- * Use <code>Function.prototype.bind()</code> to determine the event handler's
244
- * <code>this</code> or some of its arguments.
245
- *
246
- * Note: Without such an event handler, the CHIP will be recreated to enforce a refresh!
247
- *
248
- * @param {function} [fnEventHandler]
249
- * the event handler for the "refresh" event
250
- * @since 1.2.0
251
- */
252
- this.attachRefresh = function (fnEventHandler) {
253
- if (fnEventHandler && typeof fnEventHandler !== "function") {
254
- throw new sap.ui2.srvc.Error(this + ": refresh event handler is not a function",
255
- "sap.ui2.srvc.ChipInstance");
256
- }
257
- fnRefreshHandler = fnEventHandler;
258
- };
259
-
260
- /**
261
- * Attaches the listener that is notified when setTitle is called. The caller
262
- * may be the page builder as well as the CHIP.
263
- *
264
- * @param {function (sap.ui2.srvc.ChipInstance)} fnNewTitleChange
265
- * the listener function, it will be called with the instance as parameter;
266
- * may be <code>null</code> to remove the listener
267
- * @since 1.2.0
268
- */
269
- this.attachTitleChange = function (fnNewTitleChange) {
270
- fnTitleChange = fnNewTitleChange;
271
- };
272
-
273
- /**
274
- * Detaches all event handlers from all events.
275
- *
276
- * @since 1.2.0
277
- */
278
- this.detachAll = function () {
279
- aFullscreenHandlers = [];
280
- fnRefreshHandler = null;
281
- };
282
-
283
- /**
284
- * Releases all resources associated with this CHIP instance. Call this method
285
- * just before you stop using it.
286
- *
287
- * @since 1.2.0
288
- */
289
- this.exit = function () {
290
- jQuery.sap.log.debug("Exit: " + that, null, "sap.ui2.srvc.ChipInstance");
291
-
292
- // Note: CHIPs are shared objects, do not exit them!
293
-
294
- // reset to initial state
295
- oApi = null;
296
- oBags = new sap.ui2.srvc.Map();
297
- oConfiguration = null;
298
- sTitle = null;
299
- fnTitleChange = null;
300
- };
301
-
302
- /**
303
- * Returns this CHIP instance's specific API instance.
304
- *
305
- * @returns {object}
306
- * this CHIP instance's specific API instance
307
- * @since 1.2.0
308
- */
309
- this.getApi = function () {
310
- return oApi;
311
- };
312
-
313
- /**
314
- * Returns an array of bag IDs attached to this CHIP instance.
315
- *
316
- * @returns {string[]}
317
- * array of bag IDs
318
- * @since 1.5.0
319
- */
320
- this.getBagIds = function () {
321
- return oBags.keys();
322
- };
323
-
324
- /**
325
- * Returns the property bag with given ID attached to this CHIP instance.
326
- * <p>
327
- * If there is no bag with that ID an empty bag is returned.
328
- *
329
- * @param {string} sBagId
330
- * the bag ID
331
- *
332
- * @returns {sap.ui2.srvc.Bag}
333
- * the CHIP instance's bag for given ID
334
- * @since 1.5.0
335
- */
336
- this.getBag = function (sBagId) {
337
- var oBag;
338
-
339
- if (!sBagId) {
340
- throw new sap.ui2.srvc.Error("Missing bag ID", "sap.ui2.srvc.ChipInstance");
341
- }
342
-
343
- oBag = oBags.get(sBagId);
344
- if (oBag) {
345
- return oBag;
346
- }
347
-
348
- fnRequire("sap.ui2.srvc.bag");
349
- oBag = new sap.ui2.srvc.Bag(oFactory,
350
- { pageId: oAlterEgo.pageId, instanceId: oAlterEgo.instanceId, id: sBagId, $tmp: true },
351
- /*oParentBag*/null,
352
- bagChangeHandler);
353
- oBags.put(sBagId, oBag);
354
- return oBag;
355
- };
356
-
357
- /**
358
- * Returns this instance's CHIP.
359
- *
360
- * @returns {sap.ui2.srvc.Chip}
361
- * this instance's CHIP
362
- * @since 1.2.0
363
- */
364
- this.getChip = function () {
365
- return oChip;
366
- };
367
-
368
- /**
369
- * Get the persisted CHIP instance configuration as string.
370
- *
371
- * @returns {string}
372
- * the persisted configuration
373
- * @since 1.11.0
374
- * @private
375
- */
376
- this.getConfiguration = function () {
377
- return oAlterEgo.configuration;
378
- };
379
-
380
- /**
381
- * Retrieves a parameter value from the CHIP instance configuration, the
382
- * CHIP configuration or the CHIP definition.
383
- *
384
- * @param {string} sKey
385
- * the key
386
- * @returns {string}
387
- * the configuration parameter value or <code>undefined</code> if unknown
388
- * @since 1.2.0
389
- */
390
- this.getConfigurationParameter = function (sKey) {
391
- initializeConfiguration();
392
- if (Object.prototype.hasOwnProperty.call(oConfiguration, sKey)) {
393
- return oConfiguration[sKey];
394
- }
395
- return oChip.getConfigurationParameter(sKey);
396
- };
397
-
398
- /**
399
- * @namespace The (pseudo) namespace for the instance specific CHIP API. Note that there is no
400
- * global <code>window.chip</code> property. Instead, you can access the instance specific CHIP
401
- * API from the view data of the SAPUI5 view (<code>sap.ui.core.mvc.View#getViewData()</code>)
402
- * in the CHIP coding. For CHIPs based on components, call
403
- * <code>sap.ui.core.UIComponent#getComponentData()</code> instead. In both cases, the property
404
- * is simply called <code>chip</code>.
405
- * @name chip
406
- * @since 1.2.0
407
- *
408
- * @see sap.ui2.srvc.ChipInstance#getImplementationAsSapui5
409
- */
410
-
411
- /**
412
- * @namespace The (pseudo) namespace for contract interfaces (to be used by a page builder).
413
- * Note that there is no global <code>window.contract</code> property. Instead, you can access
414
- * contracts by {@link sap.ui2.srvc.ChipInstance#getContract}.
415
- *
416
- * @name contract
417
- * @since 1.11.0
418
- *
419
- * @see sap.ui2.srvc.ChipInstance#getContract
420
- */
421
-
422
- /**
423
- * Returns the contract interface (to be used by a page builder) for the given contract name.
424
- * Can only be called if the CHIP instance is not a stub anymore.
425
- * Note that a separate contract interface is optional and need not be available for each
426
- * and every contract!
427
- *
428
- * @param {string} sName
429
- * the name of a contract, e.g. "url"
430
- * @returns {object}
431
- * an optional contract interface to be used by a page builder; may be <code>undefined</code>
432
- * @since 1.11.0
433
- *
434
- * @see #isStub()
435
- */
436
- this.getContract = function (sName) {
437
- checkStub();
438
- return oContractsByName.get(sName);
439
- };
440
-
441
- /**
442
- * Tells whether the fullscreen mode is currently turned on.
443
- *
444
- * @returns {boolean}
445
- * whether fullscreen mode is turned on
446
- * @since 1.2.0
447
- */
448
- this.getFullscreen = function () {
449
- return bFullscreen;
450
- };
451
-
452
- /**
453
- * Returns this CHIP instance's ID, as defined within the page building service.
454
- *
455
- * @returns {string}
456
- * this CHIP instance's ID
457
- * @since 1.2.0
458
- */
459
- this.getId = function () {
460
- return oAlterEgo.instanceId;
461
- };
462
-
463
- /**
464
- * Returns this CHIP instance's implementation of type SAPUI5 as a control. This control
465
- * represents the root of this CHIP instance's UI from a page builder point of view. Can only
466
- * be called if the CHIP instance is not a stub anymore.
467
- *
468
- * @returns {sap.ui.core.Control}
469
- * this CHIP instance's SAPUI5 implementation as a control
470
- * @since 1.2.0
471
- *
472
- * @see #isStub()
473
- */
474
- this.getImplementationAsSapui5 = function () {
475
- checkStub();
476
- return oChip.getImplementationAsSapui5(oApi);
477
- };
478
-
479
- /**
480
- * Returns this CHIP instance's layout data as defined by the page building service.
481
- *
482
- * @returns {string}
483
- * this CHIP instance's layout data
484
- * @since 1.2.0
485
- */
486
- this.getLayoutData = function () {
487
- return oAlterEgo.layoutData;
488
- };
489
-
490
- /**
491
- * Returns this CHIP instance's page if it has been passed explicitly to our constructor or
492
- * the corresponding factory method, or if this CHIP instance has been created by its page.
493
- *
494
- * @returns {sap.ui2.srvc.Page}
495
- * this CHIP instance's page, which might be unknown (<code>undefined</code>)
496
- * @since 1.9.0
497
- * @see sap.ui2.srvc.ChipInstance
498
- * @see sap.ui2.srvc.Factory#createChipInstance
499
- * @see sap.ui2.srvc.Page#addChipInstance
500
- * @see sap.ui2.srvc.Page#load
501
- * @see sap.ui2.srvc.Page#removeChipInstance
502
- */
503
- this.getPage = function () {
504
- return oPage;
505
- };
506
-
507
- /**
508
- * Returns this instance's title.
509
- *
510
- * @returns {string}
511
- * this instance's title
512
- * @since 1.2.0
513
- */
514
- this.getTitle = function () {
515
- // Note: we cannot have a falsy temporary title nor can we persist one!
516
- return sTitle || oAlterEgo.title || oChip.getTitle();
517
- };
518
-
519
- /**
520
- * Returns the instance's latest update date, as given by the backend.
521
- * May return <code>undefined</code> in case the CHIP instance is a stub or the date could not
522
- * be parsed.
523
- *
524
- * @param {boolean} [bInRawFormat=false]
525
- * When set to false (default), the date will be returned as <code>date</code>. When set to
526
- * true, the value will be returned as given from the backend, which means as a
527
- * <code>string</code> like <code>"/Date(1415104869000)/"</code>.
528
- * @returns {date|string}
529
- * The latest update date returned as date or string. May be undefined in case of a stub.
530
- * @private
531
- */
532
- this.getUpdated = function (bInRawFormat) {
533
- //TODO after an update of the instance, the new value must be updated in oAlterEgo
534
- function parsingFailed () {
535
- jQuery.sap.log.error("Parse Error: CHIP instance's updated property has unexpected format",
536
- "value of updated property: '" + oAlterEgo.updated + "'", "sap.ui2.srvc.ChipInstance");
537
- }
538
-
539
- var aMatches, oResultDate;
540
- if (oAlterEgo.updated && !bInRawFormat) {
541
- // ODate V2: format looks like "/Date(1415104869000)/"
542
- aMatches = /\((\d*)\)/.exec(oAlterEgo.updated);
543
-
544
- if (!aMatches) {
545
- parsingFailed();
546
- return undefined;
547
- }
548
-
549
- // Note: parseInt does not throw but returns NaN, new Date(NaN) returns InvalidDate
550
- oResultDate = new Date(parseInt(aMatches[1], 10));
551
-
552
- if (isNaN(oResultDate.getTime())) {
553
- parsingFailed();
554
- return undefined;
555
- }
556
- return oResultDate;
557
- }
558
- return oAlterEgo.updated;
559
- };
560
-
561
- /**
562
- * Tells whether this CHIP instance is marked as outdated.
563
- *
564
- * @returns {boolean}
565
- * whether this CHIP instance is marked as outdated
566
- * @since 1.9.1
567
- */
568
- this.isOutdated = function () {
569
- return oAlterEgo.outdated === "X";
570
- };
571
-
572
- /**
573
- * Tells whether this CHIP instance is readOnly.
574
- *
575
- * @throws Error if the CHIP instance is still a stub
576
- * @returns {boolean}
577
- * whether this CHIP instance is readOnly
578
- * @since 1.32.0
579
- */
580
- this.isReadOnly = function () {
581
- checkStub();
582
- return oAlterEgo.isReadOnly === "X";
583
- };
584
-
585
- /**
586
- * Tells whether this CHIP instance is a reference, pointing to its original CHIP instance.
587
- *
588
- * @returns {boolean}
589
- * whether this CHIP instance is a reference
590
- * @since 1.19.1
591
- * @see #getOriginalId()
592
- * @see #getOriginalPageId()
593
- * @see #isBrokenReference()
594
- */
595
- this.isReference = function () {
596
- // note in 1.36- and earlier broken references had the following properties:
597
- // referencePageId: "O",
598
- // referenceChipInstanceId: ""
599
- return !!oAlterEgo.referenceChipInstanceId || !!oAlterEgo.referencePageId;
600
- };
601
-
602
- /**
603
- * Tells whether this CHIP instance is a broken reference, which means the original has been deleted.
604
- *
605
- * @returns {boolean}
606
- * whether this CHIP instance is a broken reference
607
- * @since 1.36.1
608
- * @see #isReference()
609
- */
610
- this.isBrokenReference = function () {
611
- // note in 1.36- and earlier broken references had the following properties:
612
- // referencePageId: "O",
613
- // referenceChipInstanceId: ""
614
- return oAlterEgo.referenceChipInstanceId === "O" || oAlterEgo.referencePageId === "O";
615
- };
616
-
617
- /**
618
- * If this CHIP instance is a reference, this method returns the ID of the original
619
- * CHIP instance. If not <code>undefined</code> is returned.
620
- *
621
- * @returns {string}
622
- * The original CHIP instance ID or <code>undefined</code>
623
- * @since 1.34.0
624
- * @see #isReference()
625
- * @see #getOriginalPageId()
626
- */
627
- this.getOriginalId = function () {
628
- // the server returns "" for non-references but this is mapped to undefined here as this is
629
- // more JavaScript-like. In addition "O" is removed as it is indicating that the original was deleted.
630
- return (oAlterEgo.referenceChipInstanceId === "" || oAlterEgo.referenceChipInstanceId === "O") ?
631
- undefined : oAlterEgo.referenceChipInstanceId;
632
- };
633
-
634
- /**
635
- * If this CHIP instance is a reference, this method returns the page ID of the original CHIP
636
- * instance's page. If not <code>undefined</code> is returned.
637
- *
638
- * @returns {string}
639
- * Page ID of the original CHIP instance's page or <code>undefined</code>
640
- * @since 1.34.0
641
- * @see #isReference()
642
- * @see #getOriginalId()
643
- */
644
- this.getOriginalPageId = function () {
645
- // the server returns "" for non-references but this is mapped to undefined here as this is
646
- // more JavaScript-like. In addition "O" is removed as it is indicating that the original was deleted.
647
- return (oAlterEgo.referencePageId === "" || oAlterEgo.referencePageId === "O") ?
648
- undefined : oAlterEgo.referencePageId;
649
- };
650
-
651
- /**
652
- * Tells whether this CHIP instance is still only a stub and needs to be loaded.
653
- *
654
- * @returns {boolean}
655
- * whether this CHIP instance is still only a stub
656
- * @since 1.2.0
657
- *
658
- * @see #load()
659
- */
660
- this.isStub = function () {
661
- return !oApi;
662
- };
663
-
664
- /**
665
- * Completes the construction of a CHIP instance and makes it ready for full use
666
- * within a page builder: loads CHIP definition XML, creates CHIP API.
667
- *
668
- * @param {function ()} fnSuccess
669
- * no-args success handler
670
- * @param {function (string, object=)} [fnFailure]
671
- * error handler taking an error message and, since version 1.28.6, an
672
- * optional object containing the complete error information as delivered
673
- * by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
674
- * for more details.
675
- * Default: see {@link sap.ui2.srvc.ODataService#getDefaultErrorHandler}
676
- * @since 1.2.0
677
- */
678
- this.load = function (fnSuccess, fnFailure) {
679
- //TODO disallow multiple calls?
680
- var fnLoad;
681
-
682
- fnFailure = fnFailure || oFactory.getPageBuildingService().getDefaultErrorHandler();
683
- fnLoad = initialize.bind(null, fnSuccess, fnFailure);
684
-
685
- if (oChip.isStub()) {
686
- oChip.load(fnLoad, fnFailure);
687
- } else {
688
- sap.ui2.srvc.call(fnLoad, fnFailure, true);
689
- }
690
- };
691
-
692
- /**
693
- * Removes this CHIP instance from its page. This deletes the page CHIP instance
694
- * within the page building service! Since 1.9.0 it also removes it from the page to which this
695
- * CHIP instance belongs, as long as that page is known.
696
- * <p>
697
- * Note: Does not affect the page's layout.
698
- * <p>
699
- * Note (since 1.9.0): Call either {@link sap.ui2.srvc.ChipInstance#remove} or
700
- * {@link sap.ui2.srvc.Page#removeChipInstance}, the result will be the same!
701
- *
702
- * @param {function ()} [fnSuccess]
703
- * no-args success handler
704
- * @param {function (string, object=)} [fnFailure]
705
- * error handler taking an error message and, since version 1.28.6, an
706
- * optional object containing the complete error information as delivered
707
- * by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
708
- * for more details.
709
- * If not given
710
- * <code>{@link sap.ui2.srvc.ODataService#getDefaultErrorHandler}</code> is used
711
- * @since 1.2.0
712
- *
713
- * @see #getPage
714
- * @see sap.ui2.srvc.Page#removeChipInstance
715
- */
716
- this.remove = function (fnSuccess, fnFailure) {
717
- if (oPage && oPage.removeChipInstance(that, fnSuccess, fnFailure)) {
718
- return; // wait, page will call us again!
719
- }
720
-
721
- this.exit();
722
- oFactory.getPageBuildingService().deletePageChipInstance(
723
- oAlterEgo.pageId,
724
- oAlterEgo.instanceId,
725
- fnSuccess,
726
- fnFailure
727
- );
728
- };
729
-
730
- /**
731
- * Calls refresh handler if registered. Returns <code>true</code> if refresh handler has been
732
- * called successfully.
733
- *
734
- * @returns {boolean}
735
- * <code>true</code> if refresh handler has been called successfully
736
- * @since 1.2.0
737
- */
738
- this.refresh = function () {
739
- if (fnRefreshHandler) {
740
- try {
741
- fnRefreshHandler(); // Note: "this" is undefined
742
- return true;
743
- } catch (ex) {
744
- jQuery.sap.log.error(that + ": call to refresh handler failed: "
745
- + (ex.message || ex.toString()), null, "sap.ui2.srvc.ChipInstance");
746
- return false;
747
- }
748
- }
749
- return false;
750
- };
751
-
752
- /**
753
- * Turns the fullscreen mode on as indicated. Calls the attached listener in case the mode
754
- * has changed.
755
- *
756
- * @param {boolean} bOn
757
- * whether fullscreen mode is turned on
758
- * @since 1.2.0
759
- */
760
- this.setFullscreen = function (bOn) {
761
- var i, n;
762
-
763
- if (bFullscreen !== bOn) {
764
- bFullscreen = bOn;
765
-
766
- for (i = 0, n = aFullscreenHandlers.length; i < n; i += 1) {
767
- aFullscreenHandlers[i]();
768
- }
769
- }
770
- };
771
-
772
- /**
773
- * Determines this CHIP instance's layout data (encoded as a string, for
774
- * example in JSON) and persists it.
775
- *
776
- * @param {string} sLayoutData
777
- * the new layout data
778
- * @param {function ()} [fnSuccess]
779
- * no-args success handler
780
- * @param {function (string, object=)} [fnFailure]
781
- * error handler taking an error message and, since version 1.28.6, an
782
- * optional object containing the complete error information as delivered
783
- * by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
784
- * for more details.
785
- * Default: see {@link sap.ui2.srvc.ODataService#getDefaultErrorHandler}
786
- * @since 1.2.0
787
- */
788
- this.setLayoutData = function (sLayoutData, fnSuccess, fnFailure) {
789
- if (oAlterEgo.layoutData === sLayoutData) {
790
- if (fnSuccess) {
791
- fnFailure = fnFailure || oFactory.getPageBuildingService().getDefaultErrorHandler();
792
- sap.ui2.srvc.call(fnSuccess, fnFailure, true);
793
- }
794
- return;
795
- }
796
- oAlterEgo.layoutData = sLayoutData;
797
- persist(fnSuccess, fnFailure);
798
- };
799
-
800
- /**
801
- * Changes this instance's title and persists it if requested. The title change
802
- * listener (see {@link #attachTitleChange}) is called.
803
- *
804
- * This method is not reentrant.
805
- *
806
- * @param {string} sNewTitle
807
- * the new title
808
- * @param {boolean} [bDoPersist=false]
809
- * whether the change shall be persisted
810
- * @param {function ()} [fnSuccess]
811
- * no-args success handler
812
- * @param {function (string, object=)} [fnFailure]
813
- * error handler taking an error message and, since version 1.28.6, an
814
- * optional object containing the complete error information as delivered
815
- * by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
816
- * for more details.
817
- * Default: see {@link sap.ui2.srvc.ODataService#getDefaultErrorHandler}
818
- * @since 1.2.0
819
- *
820
- * @see #getPage()
821
- * @see sap.ui2.srvc.Page#getOriginalLanguage()
822
- */
823
- this.setTitle = function (sNewTitle, bDoPersist, fnSuccess, fnFailure) {
824
- var sOldTitle;
825
- fnFailure = fnFailure || oFactory.getPageBuildingService().getDefaultErrorHandler();
826
-
827
- if (sTitle !== sNewTitle) {
828
- // adjust temporary title
829
- sTitle = sNewTitle;
830
-
831
- if (fnTitleChange) {
832
- // if called by CHIP: make sure listener runs asynchronously
833
- // (thus not during initial rendering)
834
- sap.ui2.srvc.call(
835
- fnTitleChange.bind(null, this),
836
- fnFailure,
837
- !bDoPersist
838
- );
839
- }
840
- }
841
-
842
- if (bDoPersist && oAlterEgo.title !== sTitle) {
843
- sOldTitle = oAlterEgo.title;
844
- oAlterEgo.title = sTitle;
845
- sTitle = undefined;
846
- persist(fnSuccess, function () {
847
- // restore old title in case of failure
848
- oAlterEgo.title = sOldTitle;
849
- // reset temporary title too
850
- sTitle = undefined;
851
-
852
- fnFailure.apply(null, arguments);
853
- });
854
- } else if (fnSuccess) {
855
- sap.ui2.srvc.call(fnSuccess, fnFailure, true);
856
- }
857
- };
858
-
859
- /**
860
- * Returns this CHIP instance's string representation.
861
- *
862
- * @param {boolean} [bVerbose=false]
863
- * flag whether to show all properties
864
- * @returns {string}
865
- * this CHIP instance's string representation
866
- * @since 1.2.0
867
- */
868
- this.toString = function (bVerbose) {
869
- var aResult = ["sap.ui2.srvc.ChipInstance({oChip:", oChip.toString(bVerbose),
870
- ",bFullscreen:", bFullscreen
871
- ];
872
- if (bVerbose) {
873
- aResult.push(",oAlterEgo:", JSON.stringify(oAlterEgo),
874
- ",oApi:", JSON.stringify(oApi),
875
- ",oBags:", oBags.toString(),
876
- ",oConfiguration:", JSON.stringify(oConfiguration),
877
- ",oFactory:", oFactory.toString(bVerbose),
878
- ",aFullscreenHandlers.length:", aFullscreenHandlers.length,
879
- ',sTitle:"', sTitle, '"'
880
- );
881
- }
882
- aResult.push("})");
883
- return aResult.join("");
884
- };
885
-
886
- /**
887
- * Updates the configuration. All parameters that actually were defined in the CHIP definition
888
- * XML are accepted. All others will raise a warning to the log.
889
- * <p>
890
- * The configuration is maintained as JSON string in a single property. This has the following
891
- * consequences regarding the scopes:
892
- * <ul>
893
- * <li>If the CHIP instance has never been persisted in the current scope, the configuration is
894
- * inherited from lower scopes. If there are no changes either, the properties have their
895
- * default values from the CHIP definition.
896
- * <li>When persisting the CHIP instance in a given scope for the first time (may it be due to
897
- * configuration changes or title changes...), the configuration changes are merged with
898
- * inherited changes from lower scopes and persisted in the current scope. Subsequent changes
899
- * in lower scopes will then remain invisible.
900
- * <li>A property for which never an update was supplied has the default value from the CHIP
901
- * definition. This also applies if you delete the update again by setting it to
902
- * <code>undefined</code>.
903
- * </ul>
904
- * <b>Example:</b><br>
905
- * The CHIP has two properties: <code>a</code> with default value "foo" and <code>b</code> with
906
- * default value "bar". The administrator changes <code>a</code> to "baz" in scope CUST. Later
907
- * a user changes <code>b</code> in PERS. Then the administrator decides to change
908
- * <code>a</code> back to "foo", but our user will never see this again, because the system
909
- * persisted both <code>a</code> and <code>b</code> in PERS.
910
- *
911
- * @param {map<String,String>} mConfigurationUpdates
912
- * The configuration updates. The values must be strings. You can however set a value to
913
- * <code>undefined</code>. This removes it from the list of updated property and effectively
914
- * resets it to the default value.
915
- * @param {function ()} [fnSuccess]
916
- * no-args success handler
917
- * @param {function (string, object=)} [fnFailure]
918
- * error handler taking an error message and, since version 1.28.6, an
919
- * optional object containing the complete error information as delivered
920
- * by the ODataService. See fnFailure parameter of {@link sap.ui2.srvc.ODataWrapper#onError}
921
- * for more details.
922
- * Default: see {@link sap.ui2.srvc.ODataService#getDefaultErrorHandler}
923
- * @since 1.7.0
924
- */
925
- this.updateConfiguration = function (mConfigurationUpdates, fnSuccess, fnFailure) {
926
- initializeConfiguration();
927
- oChip.updateConfiguration(oConfiguration, mConfigurationUpdates);
928
- oAlterEgo.configuration = JSON.stringify(oConfiguration);
929
- persist(fnSuccess, fnFailure);
930
- };
931
-
932
- // constructor code -------------------------------------------------------
933
- if (!sap.ui2.srvc.Map) {
934
- fnRequire("sap.ui2.srvc.utils");
935
- }
936
- oBags = new sap.ui2.srvc.Map();
937
-
938
- initializeBags((oAlterEgo.ChipInstanceBags && oAlterEgo.ChipInstanceBags.results)
939
- || []);
940
-
941
- delete oAlterEgo.Chip; //TODO do not modify caller's object!
942
- jQuery.sap.log.debug("Created: " + this, null, "sap.ui2.srvc.ChipInstance");
943
- };
944
- }());