@sap-ux/preview-middleware 0.16.111 → 0.16.113

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 (41) hide show
  1. package/dist/client/adp/quick-actions/common/create-page-action.js +2 -3
  2. package/dist/client/adp/quick-actions/common/create-page-action.ts +1 -5
  3. package/dist/client/adp/quick-actions/fe-v2/change-table-columns.js +1 -8
  4. package/dist/client/adp/quick-actions/fe-v2/change-table-columns.ts +1 -10
  5. package/dist/client/adp/quick-actions/fe-v2/create-table-action.js +1 -8
  6. package/dist/client/adp/quick-actions/fe-v2/create-table-action.ts +0 -8
  7. package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +1 -12
  8. package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.ts +0 -11
  9. package/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.js +5 -1
  10. package/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.ts +5 -1
  11. package/dist/client/adp/quick-actions/fe-v2/registry.js +2 -2
  12. package/dist/client/adp/quick-actions/fe-v2/registry.ts +6 -5
  13. package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column.js +1 -12
  14. package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column.ts +0 -11
  15. package/dist/client/adp/quick-actions/fe-v4/registry.js +2 -2
  16. package/dist/client/adp/quick-actions/fe-v4/registry.ts +6 -6
  17. package/dist/client/adp/quick-actions/fe-v4/utils.js +4 -44
  18. package/dist/client/adp/quick-actions/fe-v4/utils.ts +2 -47
  19. package/dist/client/cpe/changes/flex-change.js +60 -51
  20. package/dist/client/cpe/changes/flex-change.ts +59 -26
  21. package/dist/client/cpe/changes/service.js +150 -34
  22. package/dist/client/cpe/changes/service.ts +239 -54
  23. package/dist/client/cpe/control-data.js +104 -28
  24. package/dist/client/cpe/control-data.ts +134 -43
  25. package/dist/client/cpe/init.js +3 -3
  26. package/dist/client/cpe/init.ts +5 -8
  27. package/dist/client/cpe/outline/editable.js +3 -3
  28. package/dist/client/cpe/outline/editable.ts +3 -2
  29. package/dist/client/cpe/outline/nodes.js +39 -9
  30. package/dist/client/cpe/outline/nodes.ts +61 -10
  31. package/dist/client/cpe/outline/service.js +3 -2
  32. package/dist/client/cpe/outline/service.ts +11 -3
  33. package/dist/client/cpe/selection.js +29 -16
  34. package/dist/client/cpe/selection.ts +38 -20
  35. package/dist/client/cpe/utils.js +42 -1
  36. package/dist/client/cpe/utils.ts +74 -0
  37. package/dist/client/thirdparty/@sap-ux-private/control-property-editor-common.js +7 -1
  38. package/dist/client/tsconfig.tsbuildinfo +1 -0
  39. package/dist/client/utils/fe-v4.js +87 -0
  40. package/dist/client/utils/fe-v4.ts +81 -0
  41. package/package.json +8 -8
@@ -1,53 +1,62 @@
1
- "use strict";
2
-
3
- sap.ui.define(["sap/ui/rta/command/CommandFactory", "./validator"], function (CommandFactory, ___validator) {
4
- "use strict";
5
-
6
- const validateBindingModel = ___validator["validateBindingModel"];
7
- /**
8
- * Function to check a give value is a binding expression.
9
- *
10
- * @param value value to be checked.
11
- * @returns boolean
12
- */
13
- function isBindingExpression(value) {
14
- return value.includes('{') && value.includes('}') && value.indexOf('{') < value.indexOf('}');
15
- }
16
-
17
- /**
18
- *
19
- * @param options UI5 adaptation options
20
- * @param change changed property of a control
21
- */
22
- async function applyChange(options, change) {
23
- const {
24
- rta
25
- } = options;
26
- const modifiedControl = sap.ui.getCore().byId(change.controlId);
27
- if (!modifiedControl) {
28
- return;
1
+ 'use strict';
2
+ sap.ui.define([
3
+ 'sap/ui/rta/command/CommandFactory',
4
+ 'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
5
+ './validator',
6
+ '../../utils/fe-v4',
7
+ '../utils'
8
+ ], function (CommandFactory, ___sap_ux_private_control_property_editor_common, ___validator, ____utils_fe_v4, ___utils) {
9
+ 'use strict';
10
+ const PropertyType = ___sap_ux_private_control_property_editor_common['PropertyType'];
11
+ const validateBindingModel = ___validator['validateBindingModel'];
12
+ const getReference = ____utils_fe_v4['getReference'];
13
+ const getOverlay = ___utils['getOverlay'];
14
+ function isBindingExpression(value) {
15
+ return value.includes('{') && value.includes('}') && value.indexOf('{') < value.indexOf('}');
29
16
  }
30
- const isBindingString = typeof change.value === 'string' && isBindingExpression(change.value);
31
- const modifiedControlModifiedProperties = modifiedControl.getMetadata().getAllProperties()[change.propertyName];
32
- const isBindingModel = isBindingString && modifiedControlModifiedProperties?.type === 'string';
33
- const flexSettings = rta.getFlexSettings();
34
- const changeType = isBindingString ? 'BindProperty' : 'Property';
35
- if (isBindingModel) {
36
- validateBindingModel(modifiedControl, change.value);
17
+ async function applyChange(options, change) {
18
+ const {rta} = options;
19
+ const isBindingString = typeof change.value === 'string' && isBindingExpression(change.value);
20
+ const flexSettings = rta.getFlexSettings();
21
+ const modifiedControl = sap.ui.getCore().byId(change.controlId);
22
+ if (!modifiedControl) {
23
+ return;
24
+ }
25
+ if (change.propertyType === PropertyType.ControlProperty) {
26
+ const modifiedControlModifiedProperties = modifiedControl.getMetadata().getAllProperties()[change.propertyName];
27
+ const isBindingModel = isBindingString && modifiedControlModifiedProperties?.type === 'string';
28
+ const changeType = isBindingString ? 'BindProperty' : 'Property';
29
+ if (isBindingModel) {
30
+ validateBindingModel(modifiedControl, change.value);
31
+ }
32
+ const property = isBindingString ? 'newBinding' : 'newValue';
33
+ const modifiedValue = {
34
+ generator: flexSettings.generator,
35
+ propertyName: change.propertyName,
36
+ [property]: change.value
37
+ };
38
+ const command = await CommandFactory.getCommandFor(modifiedControl, changeType, modifiedValue, null, flexSettings);
39
+ await rta.getCommandStack().pushAndExecute(command);
40
+ } else if (change.propertyType === PropertyType.Configuration) {
41
+ const overlay = getOverlay(modifiedControl);
42
+ if (!overlay) {
43
+ return;
44
+ }
45
+ const overlayData = overlay?.getDesignTimeMetadata().getData();
46
+ const manifestPropertyPath = overlayData.manifestPropertyPath(modifiedControl);
47
+ const [manifestPropertyChange] = overlayData.manifestPropertyChange({ [change.propertyName]: change.value }, manifestPropertyPath, modifiedControl);
48
+ const modifiedValue = {
49
+ reference: getReference(modifiedControl),
50
+ appComponent: manifestPropertyChange.appComponent,
51
+ changeType: manifestPropertyChange.changeSpecificData.appDescriptorChangeType,
52
+ parameters: manifestPropertyChange.changeSpecificData.content.parameters,
53
+ selector: manifestPropertyChange.selector
54
+ };
55
+ const command = await CommandFactory.getCommandFor(modifiedControl, 'appDescriptor', modifiedValue, null, flexSettings);
56
+ await rta.getCommandStack().pushAndExecute(command);
57
+ }
37
58
  }
38
- const property = isBindingString ? 'newBinding' : 'newValue';
39
- const modifiedValue = {
40
- generator: flexSettings.generator,
41
- propertyName: change.propertyName,
42
- [property]: change.value
43
- };
44
- const command = await CommandFactory.getCommandFor(modifiedControl, changeType, modifiedValue, null, flexSettings);
45
- await rta.getCommandStack().pushAndExecute(command);
46
- }
47
- var __exports = {
48
- __esModule: true
49
- };
50
- __exports.applyChange = applyChange;
51
- return __exports;
52
- });
53
- //# sourceMappingURL=flex-change.js.map
59
+ var __exports = { __esModule: true };
60
+ __exports.applyChange = applyChange;
61
+ return __exports;
62
+ });
@@ -1,8 +1,10 @@
1
1
  import type FlexCommand from 'sap/ui/rta/command/FlexCommand';
2
2
  import CommandFactory from 'sap/ui/rta/command/CommandFactory';
3
- import type { PropertyChange } from '@sap-ux-private/control-property-editor-common';
3
+ import { PropertyType, type PropertyChange } from '@sap-ux-private/control-property-editor-common';
4
4
  import type { UI5AdaptationOptions } from '../types';
5
5
  import { validateBindingModel } from './validator';
6
+ import { getReference } from '../../utils/fe-v4';
7
+ import { getOverlay } from '../utils';
6
8
 
7
9
  /**
8
10
  * Function to check a give value is a binding expression.
@@ -17,39 +19,70 @@ function isBindingExpression(value: string): boolean {
17
19
  /**
18
20
  *
19
21
  * @param options UI5 adaptation options
20
- * @param change changed property of a control
22
+ * @param change changed property/app descriptor property of a control
21
23
  */
22
24
  export async function applyChange(options: UI5AdaptationOptions, change: PropertyChange): Promise<void> {
23
25
  const { rta } = options;
26
+
27
+ const isBindingString = typeof change.value === 'string' && isBindingExpression(change.value);
28
+ const flexSettings = rta.getFlexSettings();
24
29
  const modifiedControl = sap.ui.getCore().byId(change.controlId);
25
30
  if (!modifiedControl) {
26
31
  return;
27
32
  }
28
33
 
29
- const isBindingString = typeof change.value === 'string' && isBindingExpression(change.value);
30
- const modifiedControlModifiedProperties = modifiedControl.getMetadata().getAllProperties()[change.propertyName];
31
- const isBindingModel = isBindingString && modifiedControlModifiedProperties?.type === 'string';
32
- const flexSettings = rta.getFlexSettings();
33
- const changeType = isBindingString ? 'BindProperty' : 'Property';
34
+ if (change.propertyType === PropertyType.ControlProperty) {
35
+ const modifiedControlModifiedProperties = modifiedControl.getMetadata().getAllProperties()[change.propertyName];
36
+ const isBindingModel = isBindingString && modifiedControlModifiedProperties?.type === 'string';
37
+ const changeType = isBindingString ? 'BindProperty' : 'Property';
34
38
 
35
- if (isBindingModel) {
36
- validateBindingModel(modifiedControl, change.value as string);
37
- }
39
+ if (isBindingModel) {
40
+ validateBindingModel(modifiedControl, change.value as string);
41
+ }
42
+
43
+ const property = isBindingString ? 'newBinding' : 'newValue';
44
+ const modifiedValue = {
45
+ generator: flexSettings.generator,
46
+ propertyName: change.propertyName,
47
+ [property]: change.value
48
+ };
49
+
50
+ const command = await CommandFactory.getCommandFor<FlexCommand>(
51
+ modifiedControl,
52
+ changeType,
53
+ modifiedValue,
54
+ null,
55
+ flexSettings
56
+ );
57
+ await rta.getCommandStack().pushAndExecute(command);
58
+ } else if (change.propertyType === PropertyType.Configuration) {
59
+ const overlay = getOverlay(modifiedControl);
60
+ if (!overlay) {
61
+ return;
62
+ }
63
+ const overlayData = overlay?.getDesignTimeMetadata().getData();
64
+ const manifestPropertyPath = overlayData.manifestPropertyPath(modifiedControl);
65
+ const [manifestPropertyChange] = overlayData.manifestPropertyChange(
66
+ { [change.propertyName]: change.value },
67
+ manifestPropertyPath,
68
+ modifiedControl
69
+ );
38
70
 
39
- const property = isBindingString ? 'newBinding' : 'newValue';
40
- const modifiedValue = {
41
- generator: flexSettings.generator,
42
- propertyName: change.propertyName,
43
- [property]: change.value
44
- };
45
-
46
- const command = await CommandFactory.getCommandFor<FlexCommand>(
47
- modifiedControl,
48
- changeType,
49
- modifiedValue,
50
- null,
51
- flexSettings
52
- );
53
-
54
- await rta.getCommandStack().pushAndExecute(command);
71
+ const modifiedValue = {
72
+ reference: getReference(modifiedControl),
73
+ appComponent: manifestPropertyChange.appComponent,
74
+ changeType: manifestPropertyChange.changeSpecificData.appDescriptorChangeType,
75
+ parameters: manifestPropertyChange.changeSpecificData.content.parameters,
76
+ selector: manifestPropertyChange.selector
77
+ };
78
+
79
+ const command = await CommandFactory.getCommandFor(
80
+ modifiedControl,
81
+ 'appDescriptor',
82
+ modifiedValue,
83
+ null,
84
+ flexSettings
85
+ );
86
+ await rta.getCommandStack().pushAndExecute(command);
87
+ }
55
88
  }
@@ -8,8 +8,10 @@ sap.ui.define([
8
8
  '../../utils/error',
9
9
  '../../utils/version',
10
10
  'sap/m/MessageToast',
11
- '../../i18n'
12
- ], function (___sap_ux_private_control_property_editor_common, ___flex_change, Log, ___rta_service, JsControlTreeModifier, ____utils_error, ____utils_version, MessageToast, ____i18n) {
11
+ '../../i18n',
12
+ '../../utils/core',
13
+ '../../utils/fe-v4'
14
+ ], 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) {
13
15
  'use strict';
14
16
  function __ui5_require_async(path) {
15
17
  return new Promise(function (resolve, reject) {
@@ -32,12 +34,21 @@ sap.ui.define([
32
34
  const reloadApplication = ___sap_ux_private_control_property_editor_common['reloadApplication'];
33
35
  const setApplicationRequiresReload = ___sap_ux_private_control_property_editor_common['setApplicationRequiresReload'];
34
36
  const save = ___sap_ux_private_control_property_editor_common['save'];
37
+ const CONFIGURATION_CHANGE_KIND = ___sap_ux_private_control_property_editor_common['CONFIGURATION_CHANGE_KIND'];
38
+ const PropertyType = ___sap_ux_private_control_property_editor_common['PropertyType'];
35
39
  const applyChange = ___flex_change['applyChange'];
36
40
  const modeAndStackChangeHandler = ___rta_service['modeAndStackChangeHandler'];
37
41
  const getError = ____utils_error['getError'];
38
42
  const isLowerThanMinimalUi5Version = ____utils_version['isLowerThanMinimalUi5Version'];
39
43
  const getUi5Version = ____utils_version['getUi5Version'];
40
44
  const getTextBundle = ____i18n['getTextBundle'];
45
+ const getControlById = ____utils_core['getControlById'];
46
+ const isA = ____utils_core['isA'];
47
+ const getConfigMapControlIdMap = ____utils_fe_v4['getConfigMapControlIdMap'];
48
+ const STACK_CHANGE_EVENT = 'STACK_CHANGED';
49
+ const PROPRTY_CHANGE = 'propertyChange';
50
+ const PROPRTY_BINDING_CHANGE = 'propertyBindingChange';
51
+ const MANIFEST_V4_CHANGE = 'appdescr_fe_changePageConfiguration';
41
52
  function assertProperties(properties, target) {
42
53
  for (const property of properties) {
43
54
  const value = target[property];
@@ -56,25 +67,45 @@ sap.ui.define([
56
67
  assertProperties(['id'], change.selector);
57
68
  assertProperties(['property'], change.content);
58
69
  }
70
+ function assertManifestChange(change) {
71
+ assertProperties([
72
+ 'fileName',
73
+ 'content',
74
+ 'creation'
75
+ ], change);
76
+ assertProperties([
77
+ 'page',
78
+ 'entityPropertyChange'
79
+ ], change.content);
80
+ assertProperties([
81
+ 'propertyPath',
82
+ 'operation',
83
+ 'propertyValue'
84
+ ], change.content.entityPropertyChange);
85
+ }
59
86
  function modifyRTAErrorMessage(errorMessage, id, type) {
60
87
  return errorMessage.replace('Error: Applying property changes failed:', '').replace(`${ type }#${ id }`, '');
61
88
  }
62
- class ChangeService {
89
+ function getCompactV4ConfigPath(propertyPathSeg) {
90
+ return propertyPathSeg.join('/').replace(/^controlConfiguration\/(?:([^/]+\/))?@[^/]+\.v1\./, '$1');
91
+ }
92
+ class ChangeService extends EventTarget {
63
93
  savedChanges = [];
64
94
  changesRequiringReload = 0;
65
95
  pendingChanges = [];
66
96
  changedFiles = {};
67
97
  eventStack = [];
68
- constructor(options, selectionService) {
98
+ pendingConfigChangeMap = new Map();
99
+ configPropertyControlIdMap = new Map();
100
+ constructor(options) {
101
+ super();
69
102
  this.options = options;
70
- this.selectionService = selectionService;
71
103
  }
72
104
  async init(sendAction, subscribe) {
73
105
  this.sendAction = sendAction;
74
106
  subscribe(async action => {
75
107
  if (changeProperty.match(action)) {
76
108
  try {
77
- this.selectionService.applyControlPropertyChange(action.payload.controlId, action.payload.propertyName);
78
109
  await applyChange(this.options, action.payload);
79
110
  } catch (exception) {
80
111
  let name = '';
@@ -111,6 +142,26 @@ sap.ui.define([
111
142
  pending: this.pendingChanges ?? []
112
143
  }));
113
144
  }
145
+ getSavedConfigurationChange(change) {
146
+ assertManifestChange(change);
147
+ if ([change.content.entityPropertyChange.propertyValue].every(item => item === undefined || item === null)) {
148
+ throw new Error('Invalid change, missing property value on change file');
149
+ }
150
+ const propertyPathSegments = change.content.entityPropertyChange.propertyPath.split('/');
151
+ const propertyName = propertyPathSegments.pop();
152
+ const configMapKey = getConfigMapControlIdMap(change.content.page, propertyPathSegments);
153
+ const controlIds = this.configPropertyControlIdMap?.get(configMapKey) || [];
154
+ return {
155
+ type: 'saved',
156
+ kind: 'configuration',
157
+ fileName: change.fileName,
158
+ controlIds,
159
+ propertyPath: getCompactV4ConfigPath(propertyPathSegments) || change.content.page,
160
+ propertyName: propertyName ?? '',
161
+ value: change.content.entityPropertyChange.propertyValue,
162
+ timestamp: new Date(change.creation).getTime()
163
+ };
164
+ }
114
165
  async fetchSavedChanges() {
115
166
  this.changedFiles = {};
116
167
  const savedChangesResponse = await fetch(FlexChangesEndPoints.changes + `?_=${ Date.now() }`);
@@ -119,30 +170,34 @@ sap.ui.define([
119
170
  const change = savedChanges[key];
120
171
  let selectorId;
121
172
  try {
122
- const flexObject = await this.getFlexObject(change);
123
- selectorId = await this.getControlIdByChange(flexObject);
124
- assertChange(change);
125
- if ([
126
- change.content.newValue,
127
- change.content.newBinding
128
- ].every(item => item === undefined || item === null)) {
129
- throw new Error('Invalid change, missing new value in the change file');
130
- }
131
- if (change.changeType !== 'propertyChange' && change.changeType !== 'propertyBindingChange') {
132
- throw new Error('Unknown Change Type');
173
+ if (change.changeType === MANIFEST_V4_CHANGE) {
174
+ return this.getSavedConfigurationChange(change);
175
+ } else {
176
+ const flexObject = await this.getFlexObject(change);
177
+ selectorId = await this.getControlIdByChange(flexObject);
178
+ assertChange(change);
179
+ if ([
180
+ change.content.newValue,
181
+ change.content.newBinding
182
+ ].every(item => item === undefined || item === null)) {
183
+ throw new Error('Invalid change, missing new value in the change file');
184
+ }
185
+ if (change.changeType !== 'propertyChange' && change.changeType !== 'propertyBindingChange') {
186
+ throw new Error('Unknown Change Type');
187
+ }
188
+ this.changedFiles[change.fileName] = change;
189
+ return {
190
+ type: 'saved',
191
+ kind: 'property',
192
+ fileName: change.fileName,
193
+ controlId: selectorId,
194
+ propertyName: change.content.property,
195
+ value: change.content.newValue ?? change.content.newBinding,
196
+ timestamp: new Date(change.creation).getTime(),
197
+ controlName: change.selector.type ? change.selector.type.split('.').pop() : '',
198
+ changeType: change.changeType
199
+ };
133
200
  }
134
- this.changedFiles[change.fileName] = change;
135
- return {
136
- type: 'saved',
137
- kind: 'property',
138
- fileName: change.fileName,
139
- controlId: selectorId,
140
- propertyName: change.content.property,
141
- value: change.content.newValue ?? change.content.newBinding,
142
- timestamp: new Date(change.creation).getTime(),
143
- controlName: change.selector.type ? change.selector.type.split('.').pop() : '',
144
- changeType: change.changeType
145
- };
146
201
  } catch (error) {
147
202
  if (change.fileName) {
148
203
  this.changedFiles[change.fileName] = change;
@@ -182,6 +237,7 @@ sap.ui.define([
182
237
  if (change.kind === 'control') {
183
238
  return change.controlId === controlId;
184
239
  }
240
+ return false;
185
241
  }).map(change => fetch(FlexChangesEndPoints.changes, {
186
242
  method: 'DELETE',
187
243
  headers: { 'Content-Type': 'application/json' },
@@ -201,6 +257,7 @@ sap.ui.define([
201
257
  const executedCommands = stack.getAllExecutedCommands();
202
258
  const allCommandsFlattened = allCommands.flatMap(command => typeof command.getCommands === 'function' ? command.getCommands() : [command]);
203
259
  const activeCommandCount = allCommandsFlattened.length - executedCommands.length;
260
+ this.pendingConfigChangeMap = new Map();
204
261
  let i = 0;
205
262
  for (const command of allCommands) {
206
263
  try {
@@ -222,10 +279,7 @@ sap.ui.define([
222
279
  const eventIndex = this.eventStack.indexOf(event);
223
280
  if (this.eventStack.length - 1 === eventIndex) {
224
281
  this.pendingChanges = pendingChanges.filter(change => !!change);
225
- const changesRequiringReload = this.pendingChanges.reduce((sum, change) => [
226
- 'appdescr_fe_changePageConfiguration',
227
- 'appdescr_ui_generic_app_changePageConfiguration'
228
- ].includes(change.changeType) ? sum + 1 : sum, 0);
282
+ const changesRequiringReload = this.pendingChanges.reduce((sum, change) => change.kind === CONFIGURATION_CHANGE_KIND || change.changeType === 'appdescr_ui_generic_app_changePageConfiguration' ? sum + 1 : sum, 0);
229
283
  if (changesRequiringReload > this.changesRequiringReload) {
230
284
  MessageToast.show(resourceBundle.getText('CPE_CHANGES_VISIBLE_AFTER_SAVE_AND_RELOAD_MESSAGE'), { duration: 8000 });
231
285
  this.sendAction(setApplicationRequiresReload(changesRequiringReload > 0));
@@ -235,18 +289,70 @@ sap.ui.define([
235
289
  this.eventStack.splice(eventIndex, 1);
236
290
  if (Array.isArray(allCommands) && allCommands.length === 0) {
237
291
  this.pendingChanges = [];
292
+ this.pendingConfigChangeMap = new Map();
238
293
  await this.fetchSavedChanges();
239
294
  }
295
+ const configurationChanges = this.pendingChanges?.filter(item => item.kind === 'configuration');
296
+ if (configurationChanges.length) {
297
+ const stackChangeEvent = new CustomEvent(STACK_CHANGE_EVENT, {
298
+ detail: {
299
+ controls: configurationChanges.reduce((acc, item) => {
300
+ const controls = (item.controlIds || []).map(id => {
301
+ return getControlById(id);
302
+ }).filter(ui5Element => isA('sap.ui.core.Element', ui5Element));
303
+ acc.push(...controls);
304
+ return acc;
305
+ }, [])
306
+ }
307
+ });
308
+ this.dispatchEvent(stackChangeEvent);
309
+ }
240
310
  this.updateStack();
241
311
  handleStackChange();
242
312
  };
243
313
  }
314
+ getConfigurationPropertyValue(controlId, propertyName) {
315
+ const pendingChanges = this.pendingConfigChangeMap?.get(controlId);
316
+ return (pendingChanges || []).find(item => item.isActive && item.propertyName === propertyName)?.value;
317
+ }
318
+ async updateConfigurationProps(configPropertyControlIdMap) {
319
+ this.configPropertyControlIdMap = configPropertyControlIdMap;
320
+ await this.fetchSavedChanges();
321
+ this.updateStack();
322
+ }
244
323
  async handleCommand(command, inactiveCommandCount, index, pendingChanges) {
245
324
  const pendingChange = await this.prepareChangeType(command, inactiveCommandCount, index);
246
325
  if (pendingChange) {
247
326
  pendingChanges.push(pendingChange);
248
327
  }
249
328
  }
329
+ preparev4ConfigurationChange(command, value, fileName, index, inactiveCommandCount) {
330
+ const {entityPropertyChange, page} = command.getProperty('parameters');
331
+ const controlId = this.getCommandSelectorId(command) ?? '';
332
+ const propertyPathSegments = entityPropertyChange.propertyPath.split('/');
333
+ const propName = propertyPathSegments.pop();
334
+ const key = getConfigMapControlIdMap(page, propertyPathSegments);
335
+ const isActive = index >= inactiveCommandCount;
336
+ const controlIds = this.configPropertyControlIdMap?.get(key) || [controlId];
337
+ const result = {
338
+ type: 'pending',
339
+ kind: 'configuration',
340
+ controlIds,
341
+ propertyPath: getCompactV4ConfigPath(propertyPathSegments) || page,
342
+ propertyName: propName,
343
+ isActive,
344
+ value,
345
+ fileName
346
+ };
347
+ for (const id of result.controlIds) {
348
+ if (!this.pendingConfigChangeMap.get(id)) {
349
+ this.pendingConfigChangeMap.set(id, []);
350
+ }
351
+ const pendingChanges = this.pendingConfigChangeMap.get(id);
352
+ pendingChanges?.push(result);
353
+ }
354
+ return result;
355
+ }
250
356
  async prepareChangeType(command, inactiveCommandCount, index) {
251
357
  let result;
252
358
  let value = '';
@@ -263,6 +369,9 @@ sap.ui.define([
263
369
  case 'propertyBindingChange':
264
370
  value = command.getProperty('newBinding');
265
371
  break;
372
+ case 'appdescr_fe_changePageConfiguration':
373
+ value = command.getProperty('parameters').entityPropertyChange.propertyValue;
374
+ break;
266
375
  }
267
376
  const {fileName} = change.getDefinition();
268
377
  if ((changeType === 'propertyChange' || changeType === 'propertyBindingChange') && selectorId) {
@@ -271,12 +380,15 @@ sap.ui.define([
271
380
  kind: 'property',
272
381
  changeType,
273
382
  controlId: selectorId,
383
+ propertyType: PropertyType.ControlProperty,
274
384
  propertyName: command.getProperty('propertyName'),
275
385
  isActive: index >= inactiveCommandCount,
276
386
  value,
277
387
  controlName: command.getElement().getMetadata().getName().split('.').pop() ?? '',
278
388
  fileName
279
389
  };
390
+ } else if (changeType === 'appdescr_fe_changePageConfiguration') {
391
+ result = this.preparev4ConfigurationChange(command, value, fileName, index, inactiveCommandCount);
280
392
  } else {
281
393
  result = {
282
394
  type: 'pending',
@@ -359,13 +471,16 @@ sap.ui.define([
359
471
  }
360
472
  async syncOutlineChanges() {
361
473
  for (const change of this.savedChanges) {
362
- if (change.kind !== 'unknown') {
474
+ if (change.kind !== 'unknown' && change.kind !== 'configuration') {
363
475
  const flexObject = await this.getFlexObject(this.changedFiles[change.fileName]);
364
476
  change.controlId = await this.getControlIdByChange(flexObject) ?? '';
365
477
  }
366
478
  }
367
479
  this.updateStack();
368
480
  }
481
+ onStackChange(handler) {
482
+ this.addEventListener(STACK_CHANGE_EVENT, handler);
483
+ }
369
484
  async getFlexObject(change) {
370
485
  if (isLowerThanMinimalUi5Version(await getUi5Version(), {
371
486
  major: 1,
@@ -379,6 +494,7 @@ sap.ui.define([
379
494
  }
380
495
  }
381
496
  var __exports = { __esModule: true };
497
+ __exports.STACK_CHANGE_EVENT = STACK_CHANGE_EVENT;
382
498
  __exports.ChangeService = ChangeService;
383
499
  return __exports;
384
500
  });