@sap-ux/preview-middleware 0.19.41 → 0.19.43

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 (83) hide show
  1. package/dist/client/adp/add-fragment.js +46 -46
  2. package/dist/client/adp/api-handler.js +159 -159
  3. package/dist/client/adp/command-executor.js +75 -75
  4. package/dist/client/adp/control-utils.js +44 -44
  5. package/dist/client/adp/controllers/ControllerExtension.controller.js +210 -210
  6. package/dist/client/adp/controllers/ExtensionPoint.controller.js +139 -139
  7. package/dist/client/adp/controllers/FileExistsDialog.controller.js +66 -66
  8. package/dist/client/adp/dialog-factory.js +135 -135
  9. package/dist/client/adp/init-dialogs.js +163 -163
  10. package/dist/client/adp/quick-actions/add-new-subpage-quick-action-base.js +96 -96
  11. package/dist/client/adp/quick-actions/common/add-controller-to-page.js +60 -60
  12. package/dist/client/adp/quick-actions/common/create-page-action.js +54 -54
  13. package/dist/client/adp/quick-actions/common/op-add-custom-section.js +39 -39
  14. package/dist/client/adp/quick-actions/common/op-add-header-field.js +67 -67
  15. package/dist/client/adp/quick-actions/common/utils.js +18 -18
  16. package/dist/client/adp/quick-actions/control-types.js +23 -23
  17. package/dist/client/adp/quick-actions/dialog-enablement-validator.js +24 -24
  18. package/dist/client/adp/quick-actions/enablement-validator.js +4 -4
  19. package/dist/client/adp/quick-actions/fe-v2/add-new-subpage.js +81 -81
  20. package/dist/client/adp/quick-actions/fe-v2/change-table-actions.js +67 -67
  21. package/dist/client/adp/quick-actions/fe-v2/change-table-columns.js +101 -101
  22. package/dist/client/adp/quick-actions/fe-v2/create-table-action.js +107 -107
  23. package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +99 -99
  24. package/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.js +78 -78
  25. package/dist/client/adp/quick-actions/fe-v2/lr-enable-table-filtering.js +77 -77
  26. package/dist/client/adp/quick-actions/fe-v2/lr-enable-variant-management.js +69 -69
  27. package/dist/client/adp/quick-actions/fe-v2/lr-toggle-clear-filter-bar.js +59 -59
  28. package/dist/client/adp/quick-actions/fe-v2/op-enable-empty-row-mode.js +93 -93
  29. package/dist/client/adp/quick-actions/fe-v2/op-enable-variant-management.js +84 -84
  30. package/dist/client/adp/quick-actions/fe-v2/registry.js +77 -77
  31. package/dist/client/adp/quick-actions/fe-v2/utils.js +116 -116
  32. package/dist/client/adp/quick-actions/fe-v4/add-new-subpage.js +138 -138
  33. package/dist/client/adp/quick-actions/fe-v4/change-table-actions.js +79 -79
  34. package/dist/client/adp/quick-actions/fe-v4/change-table-columns.js +75 -75
  35. package/dist/client/adp/quick-actions/fe-v4/create-table-action.js +53 -53
  36. package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column.js +49 -49
  37. package/dist/client/adp/quick-actions/fe-v4/enable-variant-management.js +81 -81
  38. package/dist/client/adp/quick-actions/fe-v4/lr-enable-semantic-date-range-filter-bar.js +56 -56
  39. package/dist/client/adp/quick-actions/fe-v4/lr-enable-table-filtering.js +84 -84
  40. package/dist/client/adp/quick-actions/fe-v4/lr-toggle-clear-filter-bar.js +53 -53
  41. package/dist/client/adp/quick-actions/fe-v4/op-enable-empty-row-mode.js +89 -89
  42. package/dist/client/adp/quick-actions/fe-v4/registry.js +60 -60
  43. package/dist/client/adp/quick-actions/fe-v4/utils.js +72 -72
  44. package/dist/client/adp/quick-actions/load.js +44 -44
  45. package/dist/client/adp/quick-actions/quick-action-base.js +64 -64
  46. package/dist/client/adp/utils.js +218 -218
  47. package/dist/client/cpe/additional-change-info/add-xml-additional-info.js +75 -75
  48. package/dist/client/cpe/changes/generic-change.js +328 -0
  49. package/dist/client/cpe/changes/generic-change.ts +462 -0
  50. package/dist/client/cpe/changes/index.js +10 -10
  51. package/dist/client/cpe/changes/service.js +75 -237
  52. package/dist/client/cpe/changes/service.ts +141 -403
  53. package/dist/client/cpe/changes/validator.js +39 -39
  54. package/dist/client/cpe/documentation.js +164 -164
  55. package/dist/client/cpe/feature-service.js +36 -36
  56. package/dist/client/cpe/logger.js +30 -30
  57. package/dist/client/cpe/outline/editable.js +37 -37
  58. package/dist/client/cpe/outline/nodes.js +203 -203
  59. package/dist/client/cpe/outline/service.ts +0 -1
  60. package/dist/client/cpe/quick-actions/quick-action-definition.js +4 -4
  61. package/dist/client/cpe/quick-actions/registry.js +143 -143
  62. package/dist/client/cpe/quick-actions/utils.js +92 -92
  63. package/dist/client/cpe/types.js +4 -4
  64. package/dist/client/cpe/ui5-utils.js +33 -33
  65. package/dist/client/cpe/utils.js +111 -111
  66. package/dist/client/flp/WorkspaceConnector.js +92 -92
  67. package/dist/client/flp/common.js +28 -28
  68. package/dist/client/flp/enableFakeConnector.js +89 -89
  69. package/dist/client/flp/homepage/Component.js +14 -14
  70. package/dist/client/flp/initCdm.js +117 -117
  71. package/dist/client/flp/initConnectors.js +28 -28
  72. package/dist/client/flp/initRta.js +178 -178
  73. package/dist/client/i18n.js +56 -56
  74. package/dist/client/messagebundle.properties +21 -0
  75. package/dist/client/thirdparty/@sap-ux-private/control-property-editor-common.js +2 -4
  76. package/dist/client/utils/additional-change-info.js +54 -54
  77. package/dist/client/utils/application.js +32 -32
  78. package/dist/client/utils/core.js +84 -84
  79. package/dist/client/utils/error.js +19 -19
  80. package/dist/client/utils/fe-v2.js +56 -56
  81. package/dist/client/utils/fe-v4.js +140 -140
  82. package/dist/client/utils/version.js +104 -104
  83. package/package.json +4 -4
@@ -4,29 +4,14 @@ sap.ui.define([
4
4
  './flex-change',
5
5
  'sap/base/Log',
6
6
  '../rta-service',
7
- 'sap/ui/core/util/reflection/JsControlTreeModifier',
8
7
  '../../utils/error',
9
- '../../utils/version',
10
8
  'sap/m/MessageToast',
11
9
  '../../i18n',
12
10
  '../../utils/core',
13
- '../../utils/fe-v4',
14
- '../../utils/additional-change-info'
15
- ], function (___sap_ux_private_control_property_editor_common, ___flex_change, Log, ___rta_service, JsControlTreeModifier, ____utils_error, ____utils_version, MessageToast, ____i18n, ____utils_core, ____utils_fe_v4, ____utils_additional_change_info) {
11
+ '../../utils/additional-change-info',
12
+ './generic-change'
13
+ ], function (___sap_ux_private_control_property_editor_common, ___flex_change, Log, ___rta_service, ____utils_error, MessageToast, ____i18n, ____utils_core, ____utils_additional_change_info, ___generic_change) {
16
14
  'use strict';
17
- function __ui5_require_async(path) {
18
- return new Promise(function (resolve, reject) {
19
- sap.ui.require([path], function (module) {
20
- if (!(module && module.__esModule)) {
21
- module = module === null || !(typeof module === 'object' && path.endsWith('/library')) ? { default: module } : module;
22
- Object.defineProperty(module, '__esModule', { value: true });
23
- }
24
- resolve(module);
25
- }, function (err) {
26
- reject(err);
27
- });
28
- });
29
- }
30
15
  const changeProperty = ___sap_ux_private_control_property_editor_common['changeProperty'];
31
16
  const changeStackModified = ___sap_ux_private_control_property_editor_common['changeStackModified'];
32
17
  const deletePropertyChanges = ___sap_ux_private_control_property_editor_common['deletePropertyChanges'];
@@ -35,66 +20,24 @@ sap.ui.define([
35
20
  const reloadApplication = ___sap_ux_private_control_property_editor_common['reloadApplication'];
36
21
  const setApplicationRequiresReload = ___sap_ux_private_control_property_editor_common['setApplicationRequiresReload'];
37
22
  const save = ___sap_ux_private_control_property_editor_common['save'];
38
- const CONFIGURATION_CHANGE_KIND = ___sap_ux_private_control_property_editor_common['CONFIGURATION_CHANGE_KIND'];
39
- const PropertyType = ___sap_ux_private_control_property_editor_common['PropertyType'];
40
23
  const PENDING_CHANGE_TYPE = ___sap_ux_private_control_property_editor_common['PENDING_CHANGE_TYPE'];
41
- const PROPERTY_CHANGE_KIND = ___sap_ux_private_control_property_editor_common['PROPERTY_CHANGE_KIND'];
42
24
  const UNKNOWN_CHANGE_KIND = ___sap_ux_private_control_property_editor_common['UNKNOWN_CHANGE_KIND'];
25
+ const GENERIC_CHANGE_KIND = ___sap_ux_private_control_property_editor_common['GENERIC_CHANGE_KIND'];
43
26
  const applyChange = ___flex_change['applyChange'];
44
27
  const modeAndStackChangeHandler = ___rta_service['modeAndStackChangeHandler'];
45
28
  const getError = ____utils_error['getError'];
46
- const isLowerThanMinimalUi5Version = ____utils_version['isLowerThanMinimalUi5Version'];
47
- const getUi5Version = ____utils_version['getUi5Version'];
48
29
  const getTextBundle = ____i18n['getTextBundle'];
49
30
  const getControlById = ____utils_core['getControlById'];
50
31
  const isA = ____utils_core['isA'];
51
- const getConfigMapControlIdMap = ____utils_fe_v4['getConfigMapControlIdMap'];
52
32
  const setAdditionalChangeInfo = ____utils_additional_change_info['setAdditionalChangeInfo'];
33
+ const GENERIC_CHANGE_HANDLER = ___generic_change['GENERIC_CHANGE_HANDLER'];
34
+ const getControlIdByChange = ___generic_change['getControlIdByChange'];
35
+ const getFlexObject = ___generic_change['getFlexObject'];
53
36
  const TITLE_MAP = { appdescr_app_addAnnotationsToOData: 'Add New Annotation File' };
54
37
  const STACK_CHANGE_EVENT = 'STACK_CHANGED';
55
- const PROPERTY_CHANGE = 'propertyChange';
56
- const PROPERTY_BINDING_CHANGE = 'propertyBindingChange';
57
- const MANIFEST_V4_CHANGE = 'appdescr_fe_changePageConfiguration';
58
- function assertProperties(properties, target) {
59
- for (const property of properties) {
60
- const value = target[property];
61
- if (value === null || value === undefined) {
62
- throw new Error(`Invalid change, missing ${ property } in the change file`);
63
- }
64
- }
65
- }
66
- function assertChange(change) {
67
- assertProperties([
68
- 'fileName',
69
- 'selector',
70
- 'content',
71
- 'creation'
72
- ], change);
73
- assertProperties(['id'], change.selector);
74
- assertProperties(['property'], change.content);
75
- }
76
- function assertManifestChange(change) {
77
- assertProperties([
78
- 'fileName',
79
- 'content',
80
- 'creation'
81
- ], change);
82
- assertProperties([
83
- 'page',
84
- 'entityPropertyChange'
85
- ], change.content);
86
- assertProperties([
87
- 'propertyPath',
88
- 'operation',
89
- 'propertyValue'
90
- ], change.content.entityPropertyChange);
91
- }
92
38
  function modifyRTAErrorMessage(errorMessage, id, type) {
93
39
  return errorMessage.replace('Error: Applying property changes failed:', '').replace(`${ type }#${ id }`, '');
94
40
  }
95
- function getCompactV4ConfigPath(propertyPathSeg) {
96
- return propertyPathSeg.join('/').replace(/^controlConfiguration\/(?:([^/]+\/))?@[^/]+\.v1\./, '$1');
97
- }
98
41
  class ChangeService extends EventTarget {
99
42
  savedChanges = [];
100
43
  changesRequiringReload = 0;
@@ -148,64 +91,47 @@ sap.ui.define([
148
91
  pending: this.pendingChanges ?? []
149
92
  }));
150
93
  }
151
- getSavedConfigurationChange(change) {
152
- assertManifestChange(change);
153
- if ([change.content.entityPropertyChange.propertyValue].every(item => item === undefined || item === null)) {
154
- throw new Error('Invalid change, missing property value on change file');
155
- }
156
- const propertyPathSegments = change.content.entityPropertyChange.propertyPath.split('/');
157
- const propertyName = propertyPathSegments.pop();
158
- const configMapKey = getConfigMapControlIdMap(change.content.page, propertyPathSegments);
159
- const controlIds = this.configPropertyControlIdMap?.get(configMapKey) || [];
160
- return {
161
- type: 'saved',
162
- kind: 'configuration',
163
- fileName: change.fileName,
164
- controlIds,
165
- propertyPath: getCompactV4ConfigPath(propertyPathSegments) || change.content.page,
166
- propertyName: propertyName ?? '',
167
- value: change.content.entityPropertyChange.propertyValue,
168
- timestamp: new Date(change.creation).getTime()
169
- };
94
+ isGenericChange(change) {
95
+ return change.changeType === 'appdescr_app_addAnnotationsToOData' || change.changeType === 'rename' || change.changeType === 'moveControls' || change.changeType === 'addXML' || change.changeType === 'propertyChange' || change.changeType === 'propertyBindingChange' || change.changeType === 'appdescr_fe_changePageConfiguration' || change.changeType === 'appdescr_ui_generic_app_changePageConfiguration';
170
96
  }
171
97
  async fetchSavedChanges() {
172
98
  this.changedFiles = {};
173
99
  const savedChangesResponse = await fetch(FlexChangesEndPoints.changes + `?_=${ Date.now() }`);
174
100
  const savedChanges = await savedChangesResponse.json();
101
+ const textBundle = await getTextBundle();
175
102
  const changes = (await Promise.all(Object.keys(savedChanges ?? {}).map(async key => {
176
103
  const change = savedChanges[key];
177
- let selectorId;
178
104
  try {
179
- if (change.changeType === MANIFEST_V4_CHANGE) {
180
- return this.getSavedConfigurationChange(change);
181
- } else {
182
- const flexObject = await this.getFlexObject(change);
183
- selectorId = await this.getControlIdByChange(flexObject);
184
- assertChange(change);
185
- if ([
186
- change.content.newValue,
187
- change.content.newBinding
188
- ].every(item => item === undefined || item === null)) {
189
- throw new Error('Invalid change, missing new value in the change file');
190
- }
191
- if (change.changeType !== 'propertyChange' && change.changeType !== 'propertyBindingChange') {
192
- throw new Error('Unknown Change Type');
193
- }
105
+ const handler = GENERIC_CHANGE_HANDLER[change.changeType];
106
+ if (this.isGenericChange(change)) {
107
+ const {
108
+ properties,
109
+ changeTitle,
110
+ controlId,
111
+ changeType: type,
112
+ subtitle
113
+ } = await handler(change, {
114
+ textBundle,
115
+ appComponent: this.options.rta.getRootControlInstance(),
116
+ configPropertyControlIdMap: this.configPropertyControlIdMap
117
+ });
194
118
  this.changedFiles[change.fileName] = change;
195
119
  return {
120
+ kind: GENERIC_CHANGE_KIND,
196
121
  type: 'saved',
197
- kind: 'property',
198
122
  fileName: change.fileName,
199
- controlId: selectorId,
200
- propertyName: change.content.property,
201
- value: change.content.newValue ?? change.content.newBinding,
123
+ ...subtitle && { subtitle },
124
+ changeType: type ?? change.changeType,
202
125
  timestamp: new Date(change.creation).getTime(),
203
- controlName: change.selector.type ? change.selector.type.split('.').pop() : '',
204
- changeType: change.changeType
126
+ ...controlId && { controlId },
127
+ properties,
128
+ title: textBundle.getText(changeTitle)
205
129
  };
206
130
  }
131
+ throw new Error('Unknown change type');
207
132
  } catch (error) {
208
- const title = TITLE_MAP[change.changeType] ?? '';
133
+ const flexObject = await getFlexObject(change);
134
+ const selectorId = await getControlIdByChange(flexObject, this.options.rta.getRootControlInstance());
209
135
  if (change.fileName) {
210
136
  this.changedFiles[change.fileName] = change;
211
137
  const unknownChange = {
@@ -213,8 +139,7 @@ sap.ui.define([
213
139
  kind: 'unknown',
214
140
  changeType: change.changeType,
215
141
  fileName: change.fileName,
216
- timestamp: new Date(change.creation).getTime(),
217
- ...title && { title }
142
+ timestamp: new Date(change.creation).getTime()
218
143
  };
219
144
  if (change.creation) {
220
145
  unknownChange.timestamp = new Date(change.creation).getTime();
@@ -239,9 +164,6 @@ sap.ui.define([
239
164
  if (fileName) {
240
165
  return fileName === change.fileName;
241
166
  }
242
- if (change.kind === 'property') {
243
- return change.controlId === controlId && change.propertyName === propertyName;
244
- }
245
167
  if (change.kind === 'control') {
246
168
  return change.controlId === controlId;
247
169
  }
@@ -287,7 +209,7 @@ sap.ui.define([
287
209
  const eventIndex = this.eventStack.indexOf(event);
288
210
  if (this.eventStack.length - 1 === eventIndex) {
289
211
  this.pendingChanges = pendingChanges.filter(change => !!change);
290
- const changesRequiringReload = this.pendingChanges.reduce((sum, change) => change.kind === CONFIGURATION_CHANGE_KIND || change.changeType === 'appdescr_ui_generic_app_changePageConfiguration' || change.changeType === 'appdescr_app_addAnnotationsToOData' ? sum + 1 : sum, 0);
212
+ const changesRequiringReload = this.pendingChanges.reduce((sum, change) => isGenericConfigChange(change) ? sum + 1 : sum, 0);
291
213
  if (changesRequiringReload > this.changesRequiringReload) {
292
214
  MessageToast.show(resourceBundle.getText('CPE_CHANGES_VISIBLE_AFTER_SAVE_AND_RELOAD_MESSAGE'), { duration: 8000 });
293
215
  this.sendAction(setApplicationRequiresReload(changesRequiringReload > 0));
@@ -300,12 +222,12 @@ sap.ui.define([
300
222
  this.pendingConfigChangeMap = new Map();
301
223
  await this.fetchSavedChanges();
302
224
  }
303
- const configurationChanges = this.pendingChanges?.filter(item => item.kind === 'configuration');
225
+ const configurationChanges = this.pendingChanges?.filter(isGenericConfigChange);
304
226
  if (configurationChanges.length) {
305
227
  const stackChangeEvent = new CustomEvent(STACK_CHANGE_EVENT, {
306
228
  detail: {
307
229
  controls: configurationChanges.reduce((acc, item) => {
308
- const controls = (item.controlIds || []).map(id => {
230
+ const controls = [...item.controlId ?? []].map(id => {
309
231
  return getControlById(id);
310
232
  }).filter(ui5Element => isA('sap.ui.core.Element', ui5Element));
311
233
  acc.push(...controls);
@@ -321,7 +243,7 @@ sap.ui.define([
321
243
  }
322
244
  getConfigurationPropertyValue(controlId, propertyName) {
323
245
  const pendingChanges = this.pendingConfigChangeMap?.get(controlId);
324
- return (pendingChanges || []).find(item => item.isActive && item.propertyName === propertyName)?.value;
246
+ return (pendingChanges || []).find(item => item.isActive && item.properties[0].label === propertyName)?.properties[0].value;
325
247
  }
326
248
  async updateConfigurationProps(configPropertyControlIdMap) {
327
249
  this.configPropertyControlIdMap = configPropertyControlIdMap;
@@ -335,96 +257,53 @@ sap.ui.define([
335
257
  pendingChanges.push(pendingChange);
336
258
  }
337
259
  }
338
- prepareV4ConfigurationChange(command, value, fileName, index, inactiveCommandCount) {
339
- const {entityPropertyChange, page} = command.getProperty('parameters');
340
- const controlId = this.getCommandSelectorId(command) ?? '';
341
- const propertyPathSegments = entityPropertyChange.propertyPath.split('/');
342
- const propName = propertyPathSegments.pop();
343
- const key = getConfigMapControlIdMap(page, propertyPathSegments);
344
- const isActive = index >= inactiveCommandCount;
345
- const controlIds = this.configPropertyControlIdMap?.get(key) || [controlId];
346
- const result = {
347
- type: PENDING_CHANGE_TYPE,
348
- kind: CONFIGURATION_CHANGE_KIND,
349
- controlIds,
350
- propertyPath: getCompactV4ConfigPath(propertyPathSegments) || page,
351
- propertyName: propName,
352
- isActive,
353
- value,
354
- fileName
355
- };
356
- for (const id of result.controlIds) {
357
- if (!this.pendingConfigChangeMap.get(id)) {
358
- this.pendingConfigChangeMap.set(id, []);
359
- }
360
- const pendingChanges = this.pendingConfigChangeMap.get(id);
361
- pendingChanges?.push(result);
362
- }
363
- return result;
364
- }
365
- prepareV2ConfigurationChange(command, fileName, index, inactiveCommandCount) {
366
- const {entityPropertyChange, page} = command.getProperty('parameters');
367
- const propertyPathSegments = entityPropertyChange.propertyPath.split('/');
368
- const propertyName = Object.keys(entityPropertyChange.propertyValue)?.[0] ?? propertyPathSegments[propertyPathSegments.length - 1];
369
- const propertyValue = entityPropertyChange.propertyValue?.[propertyName] ?? entityPropertyChange.propertyValue;
370
- const controlId = this.getCommandSelectorId(command) ?? '';
371
- const key = getConfigMapControlIdMap(page, propertyPathSegments);
372
- const isActive = index >= inactiveCommandCount;
373
- const controlIds = this.configPropertyControlIdMap?.get(key) || [controlId];
374
- const result = {
375
- type: PENDING_CHANGE_TYPE,
376
- kind: CONFIGURATION_CHANGE_KIND,
377
- controlIds,
378
- propertyPath: getCompactV4ConfigPath(propertyPathSegments) || page,
379
- propertyName,
380
- isActive,
381
- value: propertyValue,
382
- fileName
383
- };
384
- for (const id of result.controlIds) {
260
+ trackPendingConfigChanges(result) {
261
+ for (const id of result?.controlId ?? []) {
385
262
  if (!this.pendingConfigChangeMap.get(id)) {
386
263
  this.pendingConfigChangeMap.set(id, []);
387
264
  }
388
265
  const pendingChanges = this.pendingConfigChangeMap.get(id);
389
266
  pendingChanges?.push(result);
390
267
  }
391
- return result;
392
268
  }
393
269
  async prepareChangeType(command, inactiveCommandCount, index) {
394
270
  const change = command?.getPreparedChange?.();
395
- const selectorId = typeof change?.getSelector === 'function' ? await this.getControlIdByChange(change) : this.getCommandSelectorId(command);
271
+ const textBundle = await getTextBundle();
272
+ const selectorId = typeof change?.getSelector === 'function' ? await getControlIdByChange(change, this.options.rta.getRootControlInstance()) : this.getCommandSelectorId(command);
396
273
  const changeType = this.getCommandChangeType(command);
397
274
  if (!changeType) {
398
275
  return undefined;
399
276
  }
400
- const {fileName} = change.getDefinition ? change.getDefinition() : change.getJson();
401
- if ((changeType === 'propertyChange' || changeType === 'propertyBindingChange') && selectorId) {
402
- let value = '';
403
- switch (changeType) {
404
- case 'propertyChange':
405
- value = command.getProperty('newValue');
406
- break;
407
- case 'propertyBindingChange':
408
- value = command.getProperty('newBinding');
409
- break;
410
- }
411
- return {
412
- type: PENDING_CHANGE_TYPE,
413
- kind: PROPERTY_CHANGE_KIND,
414
- changeType,
415
- controlId: selectorId,
416
- propertyType: PropertyType.ControlProperty,
417
- propertyName: command.getProperty('propertyName'),
277
+ const changeDefinition = change.getDefinition ? change.getDefinition() : change.getJson();
278
+ const {fileName} = changeDefinition;
279
+ const handler = GENERIC_CHANGE_HANDLER[changeType];
280
+ if (handler) {
281
+ const {
282
+ properties,
283
+ changeTitle,
284
+ controlId,
285
+ changeType: type,
286
+ subtitle
287
+ } = await handler(changeDefinition, {
288
+ textBundle,
289
+ appComponent: this.options.rta.getRootControlInstance(),
290
+ configPropertyControlIdMap: this.configPropertyControlIdMap
291
+ });
292
+ const genericChange = {
293
+ kind: GENERIC_CHANGE_KIND,
294
+ type: 'pending',
295
+ changeType: type ?? changeType,
296
+ ...subtitle && { subtitle },
418
297
  isActive: index >= inactiveCommandCount,
419
- value,
420
- controlName: command.getElement().getMetadata().getName().split('.').pop() ?? '',
421
- fileName
298
+ title: textBundle.getText(changeTitle),
299
+ fileName,
300
+ ...controlId && { controlId },
301
+ properties
422
302
  };
423
- } else if (changeType === 'appdescr_fe_changePageConfiguration') {
424
- const value = command.getProperty('parameters').entityPropertyChange.propertyValue;
425
- return this.prepareV4ConfigurationChange(command, value, fileName, index, inactiveCommandCount);
426
- } else if (changeType === 'appdescr_ui_generic_app_changePageConfiguration') {
427
- return this.prepareV2ConfigurationChange(command, fileName, index, inactiveCommandCount);
303
+ if (changeType === 'appdescr_fe_changePageConfiguration') {
304
+ this.trackPendingConfigChanges(genericChange);
305
+ }
306
+ return genericChange;
428
307
  } else {
429
308
  const title = TITLE_MAP[changeType] ?? '';
430
309
  let result = {
@@ -474,44 +353,11 @@ sap.ui.define([
474
353
  () => command.getParent()?.getElement().getId()
475
354
  ]);
476
355
  }
477
- async getControlIdByChange(change) {
478
- const appComponent = this.options.rta.getRootControlInstance();
479
- const selector = typeof change.getSelector === 'function' ? change.getSelector() : undefined;
480
- const changeType = change.getChangeType();
481
- const layer = change.getLayer();
482
- if (!selector?.id) {
483
- return;
484
- }
485
- try {
486
- let control = JsControlTreeModifier.bySelector(selector, appComponent);
487
- if (!control) {
488
- return selector.id;
489
- }
490
- const changeHandlerAPI = (await __ui5_require_async('sap/ui/fl/write/api/ChangesWriteAPI')).default;
491
- if (typeof changeHandlerAPI?.getChangeHandler !== 'function') {
492
- return selector.id;
493
- }
494
- const changeHandler = await changeHandlerAPI.getChangeHandler({
495
- changeType,
496
- element: control,
497
- modifier: JsControlTreeModifier,
498
- layer
499
- });
500
- if (changeHandler && typeof changeHandler.getChangeVisualizationInfo === 'function') {
501
- const result = await changeHandler.getChangeVisualizationInfo(change, appComponent);
502
- return JsControlTreeModifier.getControlIdBySelector(result?.affectedControls?.[0] ?? selector, appComponent);
503
- }
504
- return JsControlTreeModifier.getControlIdBySelector(selector, appComponent);
505
- } catch (error) {
506
- Log.error('Getting element ID from change has failed:', getError(error));
507
- return selector.id;
508
- }
509
- }
510
356
  async syncOutlineChanges() {
511
357
  for (const change of this.savedChanges) {
512
- if (change.kind !== 'unknown' && change.kind !== 'configuration') {
513
- const flexObject = await this.getFlexObject(this.changedFiles[change.fileName]);
514
- change.controlId = await this.getControlIdByChange(flexObject) ?? '';
358
+ if (change.kind !== 'unknown' && change.changeType !== 'configuration') {
359
+ const flexObject = await getFlexObject(this.changedFiles[change.fileName]);
360
+ change.controlId = await getControlIdByChange(flexObject, this.options.rta.getRootControlInstance()) ?? '';
515
361
  }
516
362
  }
517
363
  this.updateStack();
@@ -519,17 +365,9 @@ sap.ui.define([
519
365
  onStackChange(handler) {
520
366
  this.addEventListener(STACK_CHANGE_EVENT, handler);
521
367
  }
522
- async getFlexObject(change) {
523
- if (isLowerThanMinimalUi5Version(await getUi5Version(), {
524
- major: 1,
525
- minor: 109
526
- })) {
527
- const Change = (await __ui5_require_async('sap/ui/fl/Change')).default;
528
- return new Change(change);
529
- }
530
- const FlexObjectFactory = (await __ui5_require_async('sap/ui/fl/apply/_internal/flexObjects/FlexObjectFactory')).default;
531
- return FlexObjectFactory.createFromFileContent(change);
532
- }
368
+ }
369
+ function isGenericConfigChange(change) {
370
+ return change.kind === GENERIC_CHANGE_KIND && change.changeType === 'configuration';
533
371
  }
534
372
  var __exports = { __esModule: true };
535
373
  __exports.STACK_CHANGE_EVENT = STACK_CHANGE_EVENT;