@sap-ux/preview-middleware 0.16.112 → 0.16.114

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 (42) 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/messagebundle.properties +4 -4
  38. package/dist/client/thirdparty/@sap-ux-private/control-property-editor-common.js +7 -1
  39. package/dist/client/tsconfig.tsbuildinfo +1 -1
  40. package/dist/client/utils/fe-v4.js +87 -0
  41. package/dist/client/utils/fe-v4.ts +81 -0
  42. package/package.json +5 -5
@@ -1,12 +1,15 @@
1
1
  "use strict";
2
2
 
3
- sap.ui.define(["../../utils/version", "../../utils/core", "../utils", "./editable"], function (____utils_version, ____utils_core, ___utils, ___editable) {
3
+ sap.ui.define(["../../utils/version", "../../utils/core", "../utils", "./editable", "../../utils/fe-v4"], function (____utils_version, ____utils_core, ___utils, ___editable, ____utils_fe_v4) {
4
4
  "use strict";
5
5
 
6
6
  const getUi5Version = ____utils_version["getUi5Version"];
7
7
  const getControlById = ____utils_core["getControlById"];
8
+ const getOverlay = ___utils["getOverlay"];
8
9
  const isReuseComponent = ___utils["isReuseComponent"];
9
10
  const isEditable = ___editable["isEditable"];
11
+ const getConfigMapControlIdMap = ____utils_fe_v4["getConfigMapControlIdMap"];
12
+ const getPageName = ____utils_fe_v4["getPageName"];
10
13
  /**
11
14
  * Retrieves additional data for a given control ID.
12
15
  *
@@ -48,13 +51,14 @@ sap.ui.define(["../../utils/version", "../../utils/core", "../utils", "./editabl
48
51
  *
49
52
  * @param {string} id - The unique identifier of the control to be added as a child node.
50
53
  * @param {OutlineNode[]} children - The array of children nodes to which the new node will be added.
54
+ * @param {ChangeService} changeService - Change service for change stack event handling.
51
55
  */
52
- function addChildToExtensionPoint(id, children) {
56
+ function addChildToExtensionPoint(id, children, changeService) {
53
57
  const {
54
58
  text,
55
59
  technicalName
56
60
  } = getAdditionalData(id);
57
- const editable = isEditable(id);
61
+ const editable = isEditable(changeService, id);
58
62
  children.push({
59
63
  controlId: id,
60
64
  controlType: technicalName ?? 'sap.ui.extensionpoint.child',
@@ -79,6 +83,27 @@ sap.ui.define(["../../utils/version", "../../utils/core", "../utils", "./editabl
79
83
  controlIndex[node.controlType] = [node];
80
84
  }
81
85
  }
86
+ function addToPropertyIdMap(node, propertyIdMap) {
87
+ const control = getControlById(node.controlId);
88
+ if (control) {
89
+ const overlay = getOverlay(control);
90
+ const overlayData = overlay?.getDesignTimeMetadata().getData();
91
+ if (!overlayData?.manifestPropertyPath) {
92
+ return;
93
+ }
94
+ if (overlayData) {
95
+ const path = overlayData?.manifestPropertyPath?.(control);
96
+ const pageName = getPageName(control);
97
+ const key = getConfigMapControlIdMap(pageName, path.split('/').filter(item => item));
98
+ if (key) {
99
+ if (!propertyIdMap.get(key)) {
100
+ propertyIdMap.set(key, []);
101
+ }
102
+ propertyIdMap.get(key)?.push(node.controlId);
103
+ }
104
+ }
105
+ }
106
+ }
82
107
 
83
108
  /**
84
109
  * Transform node.
@@ -87,15 +112,17 @@ sap.ui.define(["../../utils/version", "../../utils/core", "../utils", "./editabl
87
112
  * @param scenario type of project
88
113
  * @param reuseComponentsIds ids of reuse components that are filled when outline nodes are transformed
89
114
  * @param controlIndex Control tree index
115
+ * @param changeService ChanegService for change stack event handling.
116
+ * @param propertyIdMap ChanegService for change stack event handling.
90
117
  * @returns transformed outline tree nodes
91
118
  */
92
- async function transformNodes(input, scenario, reuseComponentsIds, controlIndex) {
119
+ async function transformNodes(input, scenario, reuseComponentsIds, controlIndex, changeService, propertyIdMap) {
93
120
  const stack = [...input];
94
121
  const items = [];
95
122
  const ui5VersionInfo = await getUi5Version();
96
123
  while (stack.length) {
97
124
  const current = stack.shift();
98
- const editable = isEditable(current?.id);
125
+ const editable = isEditable(changeService, current?.id);
99
126
  const isAdp = scenario === 'ADAPTATION_PROJECT';
100
127
  const isExtPoint = current?.type === 'extensionPoint';
101
128
  if (current?.type === 'element') {
@@ -104,7 +131,7 @@ sap.ui.define(["../../utils/version", "../../utils/core", "../utils", "./editabl
104
131
  text
105
132
  } = getAdditionalData(current.id);
106
133
  const technicalName = current.technicalName.split('.').slice(-1)[0];
107
- const transformedChildren = isAdp ? await handleDuplicateNodes(children, scenario, reuseComponentsIds, controlIndex) : await transformNodes(children, scenario, reuseComponentsIds, controlIndex);
134
+ const transformedChildren = isAdp ? await handleDuplicateNodes(children, scenario, reuseComponentsIds, controlIndex, changeService, propertyIdMap) : await transformNodes(children, scenario, reuseComponentsIds, controlIndex, changeService, propertyIdMap);
108
135
  const node = {
109
136
  controlId: current.id,
110
137
  controlType: current.technicalName,
@@ -114,6 +141,7 @@ sap.ui.define(["../../utils/version", "../../utils/core", "../utils", "./editabl
114
141
  children: transformedChildren
115
142
  };
116
143
  indexNode(controlIndex, node);
144
+ addToPropertyIdMap(node, propertyIdMap);
117
145
  fillReuseComponents(reuseComponentsIds, current, scenario, ui5VersionInfo);
118
146
  items.push(node);
119
147
  }
@@ -125,7 +153,7 @@ sap.ui.define(["../../utils/version", "../../utils/core", "../utils", "./editabl
125
153
  let children = [];
126
154
  // We can combine both because there can only be either defaultContent or createdControls for one extension point node.
127
155
  [...defaultContent, ...createdControls].forEach(id => {
128
- addChildToExtensionPoint(id, children);
156
+ addChildToExtensionPoint(id, children, changeService);
129
157
  });
130
158
  const node = {
131
159
  controlId: current.id,
@@ -163,9 +191,11 @@ sap.ui.define(["../../utils/version", "../../utils/core", "../utils", "./editabl
163
191
  * @param scenario type of project
164
192
  * @param reuseComponentsIds ids of reuse components that are filled when outline nodes are transformed
165
193
  * @param controlIndex Control tree index
194
+ * @param changeService ChangeService for change stack event handling.
195
+ * @param propertyIdMap Map<string, string[]>.
166
196
  * @returns transformed outline tree nodes
167
197
  */
168
- async function handleDuplicateNodes(children, scenario, reuseComponentsIds, controlIndex) {
198
+ async function handleDuplicateNodes(children, scenario, reuseComponentsIds, controlIndex, changeService, propertyIdMap) {
169
199
  const extPointIDs = new Set();
170
200
  children.forEach(child => {
171
201
  if (child.type === 'extensionPoint') {
@@ -177,7 +207,7 @@ sap.ui.define(["../../utils/version", "../../utils/core", "../utils", "./editabl
177
207
  }
178
208
  });
179
209
  const uniqueChildren = children.filter(child => !extPointIDs.has(child.id));
180
- return transformNodes(uniqueChildren, scenario, reuseComponentsIds, controlIndex);
210
+ return transformNodes(uniqueChildren, scenario, reuseComponentsIds, controlIndex, changeService, propertyIdMap);
181
211
  }
182
212
  var __exports = {
183
213
  __esModule: true
@@ -6,9 +6,11 @@ import { getUi5Version, Ui5VersionInfo } from '../../utils/version';
6
6
  import { getControlById } from '../../utils/core';
7
7
 
8
8
  import type { ControlTreeIndex } from '../types';
9
- import { isReuseComponent } from '../utils';
9
+ import { getOverlay, isReuseComponent } from '../utils';
10
10
 
11
11
  import { isEditable } from './editable';
12
+ import { ChangeService } from '../changes';
13
+ import { getConfigMapControlIdMap, getPageName } from '../../utils/fe-v4';
12
14
 
13
15
  interface AdditionalData {
14
16
  text?: string;
@@ -62,10 +64,11 @@ function getChildren(current: OutlineViewNode): OutlineViewNode[] {
62
64
  *
63
65
  * @param {string} id - The unique identifier of the control to be added as a child node.
64
66
  * @param {OutlineNode[]} children - The array of children nodes to which the new node will be added.
67
+ * @param {ChangeService} changeService - Change service for change stack event handling.
65
68
  */
66
- function addChildToExtensionPoint(id: string, children: OutlineNode[]) {
69
+ function addChildToExtensionPoint(id: string, children: OutlineNode[], changeService: ChangeService) {
67
70
  const { text, technicalName } = getAdditionalData(id);
68
- const editable = isEditable(id);
71
+ const editable = isEditable(changeService, id);
69
72
 
70
73
  children.push({
71
74
  controlId: id,
@@ -92,6 +95,31 @@ function indexNode(controlIndex: ControlTreeIndex, node: OutlineNode): void {
92
95
  }
93
96
  }
94
97
 
98
+ function addToPropertyIdMap(node: OutlineNode, propertyIdMap: Map<string, string[]>): void {
99
+ const control = getControlById(node.controlId);
100
+ if (control) {
101
+ const overlay = getOverlay(control);
102
+ const overlayData = overlay?.getDesignTimeMetadata().getData();
103
+ if (!overlayData?.manifestPropertyPath) {
104
+ return;
105
+ }
106
+ if (overlayData) {
107
+ const path = overlayData?.manifestPropertyPath?.(control);
108
+ const pageName = getPageName(control);
109
+ const key = getConfigMapControlIdMap(
110
+ pageName,
111
+ path.split('/').filter((item) => item)
112
+ );
113
+ if (key) {
114
+ if (!propertyIdMap.get(key)) {
115
+ propertyIdMap.set(key, []);
116
+ }
117
+ propertyIdMap.get(key)?.push(node.controlId);
118
+ }
119
+ }
120
+ }
121
+ }
122
+
95
123
  /**
96
124
  * Transform node.
97
125
  *
@@ -99,20 +127,24 @@ function indexNode(controlIndex: ControlTreeIndex, node: OutlineNode): void {
99
127
  * @param scenario type of project
100
128
  * @param reuseComponentsIds ids of reuse components that are filled when outline nodes are transformed
101
129
  * @param controlIndex Control tree index
130
+ * @param changeService ChanegService for change stack event handling.
131
+ * @param propertyIdMap ChanegService for change stack event handling.
102
132
  * @returns transformed outline tree nodes
103
133
  */
104
134
  export async function transformNodes(
105
135
  input: OutlineViewNode[],
106
136
  scenario: Scenario,
107
137
  reuseComponentsIds: Set<string>,
108
- controlIndex: ControlTreeIndex
138
+ controlIndex: ControlTreeIndex,
139
+ changeService: ChangeService,
140
+ propertyIdMap: Map<string, string[]>
109
141
  ): Promise<OutlineNode[]> {
110
142
  const stack = [...input];
111
143
  const items: OutlineNode[] = [];
112
144
  const ui5VersionInfo = await getUi5Version();
113
145
  while (stack.length) {
114
146
  const current = stack.shift();
115
- const editable = isEditable(current?.id);
147
+ const editable = isEditable(changeService, current?.id);
116
148
  const isAdp = scenario === 'ADAPTATION_PROJECT';
117
149
  const isExtPoint = current?.type === 'extensionPoint';
118
150
 
@@ -122,8 +154,22 @@ export async function transformNodes(
122
154
  const technicalName = current.technicalName.split('.').slice(-1)[0];
123
155
 
124
156
  const transformedChildren = isAdp
125
- ? await handleDuplicateNodes(children, scenario, reuseComponentsIds, controlIndex)
126
- : await transformNodes(children, scenario, reuseComponentsIds, controlIndex);
157
+ ? await handleDuplicateNodes(
158
+ children,
159
+ scenario,
160
+ reuseComponentsIds,
161
+ controlIndex,
162
+ changeService,
163
+ propertyIdMap
164
+ )
165
+ : await transformNodes(
166
+ children,
167
+ scenario,
168
+ reuseComponentsIds,
169
+ controlIndex,
170
+ changeService,
171
+ propertyIdMap
172
+ );
127
173
 
128
174
  const node: OutlineNode = {
129
175
  controlId: current.id,
@@ -135,6 +181,7 @@ export async function transformNodes(
135
181
  };
136
182
 
137
183
  indexNode(controlIndex, node);
184
+ addToPropertyIdMap(node, propertyIdMap);
138
185
  fillReuseComponents(reuseComponentsIds, current, scenario, ui5VersionInfo);
139
186
 
140
187
  items.push(node);
@@ -146,7 +193,7 @@ export async function transformNodes(
146
193
  let children: OutlineNode[] = [];
147
194
  // We can combine both because there can only be either defaultContent or createdControls for one extension point node.
148
195
  [...defaultContent, ...createdControls].forEach((id: string) => {
149
- addChildToExtensionPoint(id, children);
196
+ addChildToExtensionPoint(id, children, changeService);
150
197
  });
151
198
 
152
199
  const node: OutlineNode = {
@@ -191,13 +238,17 @@ function fillReuseComponents(
191
238
  * @param scenario type of project
192
239
  * @param reuseComponentsIds ids of reuse components that are filled when outline nodes are transformed
193
240
  * @param controlIndex Control tree index
241
+ * @param changeService ChangeService for change stack event handling.
242
+ * @param propertyIdMap Map<string, string[]>.
194
243
  * @returns transformed outline tree nodes
195
244
  */
196
245
  export async function handleDuplicateNodes(
197
246
  children: OutlineViewNode[],
198
247
  scenario: Scenario,
199
248
  reuseComponentsIds: Set<string>,
200
- controlIndex: ControlTreeIndex
249
+ controlIndex: ControlTreeIndex,
250
+ changeService: ChangeService,
251
+ propertyIdMap: Map<string, string[]>
201
252
  ): Promise<OutlineNode[]> {
202
253
  const extPointIDs = new Set<string>();
203
254
 
@@ -210,5 +261,5 @@ export async function handleDuplicateNodes(
210
261
 
211
262
  const uniqueChildren = children.filter((child) => !extPointIDs.has(child.id));
212
263
 
213
- return transformNodes(uniqueChildren, scenario, reuseComponentsIds, controlIndex);
264
+ return transformNodes(uniqueChildren, scenario, reuseComponentsIds, controlIndex, changeService, propertyIdMap);
214
265
  }
@@ -32,8 +32,8 @@ sap.ui.define([
32
32
  try {
33
33
  const viewNodes = await outline.get();
34
34
  const controlIndex = {};
35
- const outlineNodes = await transformNodes(viewNodes, scenario, reuseComponentsIds, controlIndex);
36
- await this.changeService.syncOutlineChanges();
35
+ const configPropertyIdMap = new Map();
36
+ const outlineNodes = await transformNodes(viewNodes, scenario, reuseComponentsIds, controlIndex, this.changeService, configPropertyIdMap);
37
37
  const event = new CustomEvent(OUTLINE_CHANGE_EVENT, { detail: { controlIndex } });
38
38
  this.dispatchEvent(event);
39
39
  sendAction(outlineChanged(outlineNodes));
@@ -44,6 +44,7 @@ sap.ui.define([
44
44
  }));
45
45
  hasSentWarning = true;
46
46
  }
47
+ await this.changeService.updateConfigurationProps(configPropertyIdMap);
47
48
  } catch (error) {
48
49
  Log.error('Outline sync failed!', getError(error));
49
50
  }
@@ -1,7 +1,6 @@
1
1
  import Log from 'sap/base/Log';
2
2
  import type RuntimeAuthoring from 'sap/ui/rta/RuntimeAuthoring';
3
3
  import type RTAOutlineService from 'sap/ui/rta/command/OutlineService';
4
- import type { ChangeService } from '../changes/service';
5
4
 
6
5
  import type { ExternalAction } from '@sap-ux-private/control-property-editor-common';
7
6
  import { outlineChanged, SCENARIO, showMessage } from '@sap-ux-private/control-property-editor-common';
@@ -10,6 +9,7 @@ import { getError } from '../../utils/error';
10
9
  import { getTextBundle } from '../../i18n';
11
10
  import { ControlTreeIndex } from '../types';
12
11
  import { transformNodes } from './nodes';
12
+ import { ChangeService } from '../changes';
13
13
 
14
14
  export const OUTLINE_CHANGE_EVENT = 'OUTLINE_CHANGED';
15
15
 
@@ -41,8 +41,15 @@ export class OutlineService extends EventTarget {
41
41
  try {
42
42
  const viewNodes = await outline.get();
43
43
  const controlIndex: ControlTreeIndex = {};
44
- const outlineNodes = await transformNodes(viewNodes, scenario, reuseComponentsIds, controlIndex);
45
- await this.changeService.syncOutlineChanges();
44
+ const configPropertyIdMap = new Map<string, string[]>();
45
+ const outlineNodes = await transformNodes(
46
+ viewNodes,
47
+ scenario,
48
+ reuseComponentsIds,
49
+ controlIndex,
50
+ this.changeService,
51
+ configPropertyIdMap
52
+ );
46
53
 
47
54
  const event = new CustomEvent(OUTLINE_CHANGE_EVENT, {
48
55
  detail: {
@@ -61,6 +68,7 @@ export class OutlineService extends EventTarget {
61
68
  );
62
69
  hasSentWarning = true;
63
70
  }
71
+ await this.changeService.updateConfigurationProps(configPropertyIdMap);
64
72
  } catch (error) {
65
73
  Log.error('Outline sync failed!', getError(error));
66
74
  }
@@ -15,7 +15,10 @@ sap.ui.define([
15
15
  const propertyChanged = ___sap_ux_private_control_property_editor_common['propertyChanged'];
16
16
  const selectControl = ___sap_ux_private_control_property_editor_common['selectControl'];
17
17
  const reportTelemetry = ___sap_ux_private_control_property_editor_common['reportTelemetry'];
18
+ const changeProperty = ___sap_ux_private_control_property_editor_common['changeProperty'];
19
+ const PropertyType = ___sap_ux_private_control_property_editor_common['PropertyType'];
18
20
  const buildControlData = ___control_data['buildControlData'];
21
+ const getOverlay = ___utils['getOverlay'];
19
22
  const getRuntimeControl = ___utils['getRuntimeControl'];
20
23
  const getDocumentation = ___documentation['getDocumentation'];
21
24
  const getComponent = ___utils_core['getComponent'];
@@ -43,8 +46,10 @@ sap.ui.define([
43
46
  const selContLibName = controlMetadata.getLibraryName();
44
47
  const document = await getDocumentation(selectedControlName, selContLibName);
45
48
  controlData.properties.forEach(controlProp => {
46
- const property = allProperties[controlProp.name];
47
- controlProp.documentation = getPropertyDocument(property, controlProp.ui5Type, document);
49
+ if (controlProp.propertyType === PropertyType.ControlProperty) {
50
+ const property = allProperties[controlProp.name];
51
+ controlProp.documentation = getPropertyDocument(property, controlProp.ui5Type, document);
52
+ }
48
53
  });
49
54
  } catch (e) {
50
55
  Log.error('Document loading failed', getError(e));
@@ -53,8 +58,9 @@ sap.ui.define([
53
58
  class SelectionService {
54
59
  appliedChangeCache = new Map();
55
60
  activeChangeHandlers = new Set();
56
- constructor(rta) {
61
+ constructor(rta, changeService) {
57
62
  this.rta = rta;
63
+ this.changeService = changeService;
58
64
  }
59
65
  init(sendAction, subscribe) {
60
66
  const eventOrigin = new Set();
@@ -63,19 +69,19 @@ sap.ui.define([
63
69
  onselectionChange(event).catch(error => Log.error('Event interrupted: ', getError(error)));
64
70
  });
65
71
  subscribe(async action => {
66
- if (selectControl.match(action)) {
72
+ if (changeProperty.match(action)) {
73
+ this.applyControlPropertyChange(action.payload.controlId, action.payload.propertyName);
74
+ } else if (selectControl.match(action)) {
67
75
  const id = action.payload;
68
76
  const control = sap.ui.getCore().byId(id);
69
77
  if (!control) {
70
78
  const component = getComponent(id);
71
79
  if (component) {
72
- const controlData = buildControlData(component);
73
- await addDocumentationForProperties(component, controlData);
74
- const controlSelectedAction = controlSelected(controlData);
75
- sendAction(controlSelectedAction);
80
+ await this.buildProperties(component, sendAction);
76
81
  }
77
82
  return;
78
83
  }
84
+ this.currentSelection = control;
79
85
  eventOrigin.add('outline');
80
86
  let controlOverlay = OverlayRegistry.getOverlay(control);
81
87
  const selectedOverlayControls = this.rta.getSelection() ?? [];
@@ -88,13 +94,23 @@ sap.ui.define([
88
94
  if (controlOverlay?.isSelectable()) {
89
95
  controlOverlay.setSelected(true);
90
96
  } else {
91
- const controlData = buildControlData(control);
92
- await addDocumentationForProperties(control, controlData);
93
- const controlSelectedAction = controlSelected(controlData);
94
- sendAction(controlSelectedAction);
97
+ await this.buildProperties(control, sendAction);
95
98
  }
96
99
  }
97
100
  });
101
+ this.changeService.onStackChange(async event => {
102
+ const control = event.detail.controls.find(ctrl => ctrl === this.currentSelection);
103
+ if (control) {
104
+ const overlay = getOverlay(control);
105
+ await this.buildProperties(control, sendAction, overlay);
106
+ }
107
+ });
108
+ }
109
+ async buildProperties(control, sendAction, overlay) {
110
+ const controlData = buildControlData(control, this.changeService, overlay);
111
+ await addDocumentationForProperties(control, controlData);
112
+ const action = controlSelected(controlData);
113
+ sendAction(action);
98
114
  }
99
115
  applyControlPropertyChange(controlId, propertyName) {
100
116
  const changeId = propertyChangeId(controlId, propertyName);
@@ -130,10 +146,7 @@ sap.ui.define([
130
146
  } catch (error) {
131
147
  Log.error('Failed to report telemetry', getError(error));
132
148
  } finally {
133
- const controlData = buildControlData(runtimeControl, overlayControl);
134
- await addDocumentationForProperties(runtimeControl, controlData);
135
- const action = controlSelected(controlData);
136
- sendAction(action);
149
+ await this.buildProperties(runtimeControl, sendAction, overlayControl);
137
150
  eventOrigin.delete('outline');
138
151
  }
139
152
  }
@@ -4,10 +4,12 @@ import {
4
4
  propertyChanged,
5
5
  selectControl,
6
6
  reportTelemetry,
7
- Properties
7
+ Properties,
8
+ changeProperty,
9
+ PropertyType
8
10
  } from '@sap-ux-private/control-property-editor-common';
9
11
  import { buildControlData } from './control-data';
10
- import { getRuntimeControl, ManagedObjectMetadataProperties, PropertiesInfo } from './utils';
12
+ import { getOverlay, getRuntimeControl, ManagedObjectMetadataProperties, PropertiesInfo } from './utils';
11
13
  import type { ActionSenderFunction, Service, SubscribeFunction } from './types';
12
14
 
13
15
  import type Event from 'sap/ui/base/Event';
@@ -21,6 +23,8 @@ import OverlayRegistry from 'sap/ui/dt/OverlayRegistry';
21
23
  import OverlayUtil from 'sap/ui/dt/OverlayUtil';
22
24
  import { getComponent } from '../utils/core';
23
25
  import { getError } from '../utils/error';
26
+ import { ChangeService } from './changes';
27
+ import UI5Element from 'sap/ui/core/Element';
24
28
 
25
29
  export interface PropertyChangeParams {
26
30
  name: string;
@@ -75,8 +79,10 @@ async function addDocumentationForProperties(control: ManagedObject, controlData
75
79
  // Add the control's properties
76
80
  const document = await getDocumentation(selectedControlName, selContLibName);
77
81
  controlData.properties.forEach((controlProp) => {
78
- const property = allProperties[controlProp.name];
79
- controlProp.documentation = getPropertyDocument(property, controlProp.ui5Type, document);
82
+ if (controlProp.propertyType === PropertyType.ControlProperty) {
83
+ const property = allProperties[controlProp.name];
84
+ controlProp.documentation = getPropertyDocument(property, controlProp.ui5Type, document);
85
+ }
80
86
  });
81
87
  } catch (e) {
82
88
  Log.error('Document loading failed', getError(e));
@@ -89,12 +95,13 @@ async function addDocumentationForProperties(control: ManagedObject, controlData
89
95
  export class SelectionService implements Service {
90
96
  private appliedChangeCache = new Map<string, number>();
91
97
  private activeChangeHandlers = new Set<() => void>();
98
+ private currentSelection: UI5Element;
92
99
  /**
93
100
  *
94
101
  * @param rta - rta object.
95
102
  * @param ui5 - facade for ui5 framework methods
96
103
  */
97
- constructor(private readonly rta: RuntimeAuthoring) {}
104
+ constructor(private readonly rta: RuntimeAuthoring, private readonly changeService: ChangeService) {}
98
105
 
99
106
  /**
100
107
  * Initialize selection service.
@@ -109,21 +116,19 @@ export class SelectionService implements Service {
109
116
  onselectionChange(event).catch((error) => Log.error('Event interrupted: ', getError(error)));
110
117
  });
111
118
  subscribe(async (action: ExternalAction): Promise<void> => {
112
- if (selectControl.match(action)) {
119
+ if (changeProperty.match(action)) {
120
+ this.applyControlPropertyChange(action.payload.controlId, action.payload.propertyName);
121
+ } else if (selectControl.match(action)) {
113
122
  const id = action.payload;
114
123
  const control = sap.ui.getCore().byId(id);
115
124
  if (!control) {
116
125
  const component = getComponent(id);
117
126
  if (component) {
118
- const controlData = buildControlData(component);
119
-
120
- // add document
121
- await addDocumentationForProperties(component, controlData);
122
- const controlSelectedAction = controlSelected(controlData);
123
- sendAction(controlSelectedAction);
127
+ await this.buildProperties(component, sendAction);
124
128
  }
125
129
  return;
126
130
  }
131
+ this.currentSelection = control;
127
132
  eventOrigin.add('outline');
128
133
  let controlOverlay = OverlayRegistry.getOverlay(control);
129
134
  const selectedOverlayControls = this.rta.getSelection() ?? [];
@@ -140,13 +145,29 @@ export class SelectionService implements Service {
140
145
  if (controlOverlay?.isSelectable()) {
141
146
  controlOverlay.setSelected(true); //highlight without firing event only if the layer is selectable
142
147
  } else {
143
- const controlData = buildControlData(control);
144
- await addDocumentationForProperties(control, controlData);
145
- const controlSelectedAction = controlSelected(controlData);
146
- sendAction(controlSelectedAction);
148
+ await this.buildProperties(control, sendAction);
147
149
  }
148
150
  }
149
151
  });
152
+ // rebuild config properties in panel for the selected control onStackChange event
153
+ this.changeService.onStackChange(async (event) => {
154
+ const control = event.detail.controls.find((ctrl) => ctrl === this.currentSelection);
155
+ if (control) {
156
+ const overlay = getOverlay(control);
157
+ await this.buildProperties(control, sendAction, overlay);
158
+ }
159
+ });
160
+ }
161
+
162
+ private async buildProperties(
163
+ control: ManagedObject,
164
+ sendAction: ActionSenderFunction,
165
+ overlay?: ElementOverlay
166
+ ): Promise<void> {
167
+ const controlData = buildControlData(control, this.changeService, overlay);
168
+ await addDocumentationForProperties(control, controlData);
169
+ const action = controlSelected(controlData);
170
+ sendAction(action);
150
171
  }
151
172
 
152
173
  /**
@@ -195,10 +216,7 @@ export class SelectionService implements Service {
195
216
  } catch (error) {
196
217
  Log.error('Failed to report telemetry', getError(error));
197
218
  } finally {
198
- const controlData = buildControlData(runtimeControl, overlayControl);
199
- await addDocumentationForProperties(runtimeControl, controlData);
200
- const action = controlSelected(controlData);
201
- sendAction(action);
219
+ await this.buildProperties(runtimeControl, sendAction, overlayControl);
202
220
  eventOrigin.delete('outline');
203
221
  }
204
222
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- sap.ui.define(["sap/ui/core/mvc/XMLView", "sap/ui/core/UIComponent", "../utils/core", "../utils/version"], function (XMLView, UIComponent, ___utils_core, ___utils_version) {
3
+ sap.ui.define(["sap/ui/core/mvc/XMLView", "sap/ui/core/UIComponent", "../utils/core", "../utils/version", "sap/ui/dt/OverlayRegistry", "sap/ui/dt/OverlayUtil"], function (XMLView, UIComponent, ___utils_core, ___utils_version, OverlayRegistry, OverlayUtil) {
4
4
  "use strict";
5
5
 
6
6
  const getComponent = ___utils_core["getComponent"];
@@ -87,6 +87,45 @@ sap.ui.define(["sap/ui/core/mvc/XMLView", "sap/ui/core/UIComponent", "../utils/c
87
87
  }
88
88
  return undefined;
89
89
  }
90
+ function getManifestProperties(control, changeService, controlOverlay) {
91
+ const overlayData = controlOverlay?.getDesignTimeMetadata().getData();
92
+ if (!controlOverlay || !overlayData?.manifestSettings) {
93
+ return {};
94
+ }
95
+ const manifestPropertiesValue = overlayData?.manifestSettingsValues(overlayData?.manifestSettings(control), control);
96
+ const manifestProperties = overlayData?.manifestSettings(control).reduce((acc, item) => {
97
+ const propertyId = item.id;
98
+ const value = changeService.getConfigurationPropertyValue(control.getId(), propertyId);
99
+ let propertyValue = value === 0 || value === false || value ? value : manifestPropertiesValue[propertyId];
100
+ if (item?.type && ['boolean', 'number', 'string'].includes(item?.type)) {
101
+ if (propertyValue === undefined) {
102
+ propertyValue = item.value; // set default value of property
103
+ }
104
+ }
105
+ if (!acc[propertyId]) {
106
+ acc[propertyId] = {
107
+ ...item,
108
+ defaultValue: item.value,
109
+ configuration: true,
110
+ name: item.id,
111
+ readableName: item.name,
112
+ manifestPropertyPath: `${overlayData?.manifestPropertyPath(control)}/${propertyId}`,
113
+ type: item.type === 'number' ? 'int' : item.type,
114
+ value: propertyValue
115
+ };
116
+ }
117
+ return acc;
118
+ }, {});
119
+ return manifestProperties;
120
+ }
121
+ const getOverlay = control => {
122
+ let controlOverlay = OverlayRegistry.getOverlay(control);
123
+ if (!controlOverlay?.getDomRef()) {
124
+ //look for closest control
125
+ controlOverlay = OverlayUtil.getClosestOverlayFor(control);
126
+ }
127
+ return controlOverlay;
128
+ };
90
129
  var __exports = {
91
130
  __esModule: true
92
131
  };
@@ -94,6 +133,8 @@ sap.ui.define(["sap/ui/core/mvc/XMLView", "sap/ui/core/UIComponent", "../utils/c
94
133
  __exports.getLibrary = getLibrary;
95
134
  __exports.isReuseComponent = isReuseComponent;
96
135
  __exports.getRootControlFromComponentContainer = getRootControlFromComponentContainer;
136
+ __exports.getManifestProperties = getManifestProperties;
137
+ __exports.getOverlay = getOverlay;
97
138
  return __exports;
98
139
  });
99
140
  //# sourceMappingURL=utils.js.map