@sap-ux/preview-middleware 0.23.48 → 0.23.50

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 (36) hide show
  1. package/dist/client/adp/command-executor.js +99 -66
  2. package/dist/client/adp/controllers/AddCustomFragment.controller.js +120 -102
  3. package/dist/client/adp/controllers/AddFragment.controller.js +189 -163
  4. package/dist/client/adp/controllers/AddSubpage.controller.js +146 -137
  5. package/dist/client/adp/controllers/AddTableColumnFragments.controller.js +230 -188
  6. package/dist/client/adp/controllers/BaseDialog.controller.js +187 -164
  7. package/dist/client/adp/controllers/ControllerExtension.controller.js +329 -253
  8. package/dist/client/adp/controllers/ExtensionPoint.controller.js +158 -114
  9. package/dist/client/adp/extension-point.js +81 -60
  10. package/dist/client/adp/init.js +100 -99
  11. package/dist/client/adp/quick-actions/common/add-new-annotation-file.js +165 -147
  12. package/dist/client/adp/quick-actions/enablement-validator.js +0 -4
  13. package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +105 -100
  14. package/dist/client/adp/quick-actions/simple-quick-action-base.js +44 -40
  15. package/dist/client/adp/quick-actions/table-quick-action-base.js +309 -266
  16. package/dist/client/adp/sync-views-utils.js +119 -83
  17. package/dist/client/cpe/changes/flex-change.js +64 -48
  18. package/dist/client/cpe/changes/service.js +492 -367
  19. package/dist/client/cpe/communication-service.js +41 -29
  20. package/dist/client/cpe/connector-service.js +87 -64
  21. package/dist/client/cpe/context-menu-service.js +87 -74
  22. package/dist/client/cpe/control-data.js +353 -263
  23. package/dist/client/cpe/documentation.js +183 -126
  24. package/dist/client/cpe/init.js +69 -75
  25. package/dist/client/cpe/outline/service.js +60 -45
  26. package/dist/client/cpe/quick-actions/quick-action-definition.js +0 -4
  27. package/dist/client/cpe/quick-actions/quick-action-service.js +154 -129
  28. package/dist/client/cpe/rta-service.js +91 -69
  29. package/dist/client/cpe/selection.js +239 -187
  30. package/dist/client/cpe/types.js +0 -4
  31. package/dist/client/flp/init.js +403 -296
  32. package/dist/client/manifest.json +7 -4
  33. package/dist/client/thirdparty/@sap-ux-private/control-property-editor-common.js +444 -370
  34. package/dist/client/utils/info-center-message.js +59 -31
  35. package/dist/client/utils/version.js +128 -72
  36. package/package.json +4 -4
@@ -1,196 +1,248 @@
1
- 'use strict';
2
- sap.ui.define([
3
- 'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
4
- './control-data',
5
- './utils',
6
- 'sap/base/Log',
7
- 'sap/ui/dt/OverlayRegistry',
8
- 'sap/ui/dt/OverlayUtil',
9
- '../utils/core',
10
- '../utils/error',
11
- './documentation'
12
- ], function (___sap_ux_private_control_property_editor_common, ___control_data, ___utils, Log, OverlayRegistry, OverlayUtil, ___utils_core, ___utils_error, ___documentation) {
13
- 'use strict';
14
- const changeProperty = ___sap_ux_private_control_property_editor_common['changeProperty'];
15
- const controlSelected = ___sap_ux_private_control_property_editor_common['controlSelected'];
16
- const propertyChanged = ___sap_ux_private_control_property_editor_common['propertyChanged'];
17
- const PropertyType = ___sap_ux_private_control_property_editor_common['PropertyType'];
18
- const reportTelemetry = ___sap_ux_private_control_property_editor_common['reportTelemetry'];
19
- const selectControl = ___sap_ux_private_control_property_editor_common['selectControl'];
20
- const buildControlData = ___control_data['buildControlData'];
21
- const getOverlay = ___utils['getOverlay'];
22
- const getRuntimeControl = ___utils['getRuntimeControl'];
23
- const getComponent = ___utils_core['getComponent'];
24
- const getControlById = ___utils_core['getControlById'];
25
- const getError = ___utils_error['getError'];
26
- const getDocumentation = ___documentation['getDocumentation'];
27
- function propertyChangeId(controlId, propertyName) {
28
- return [
29
- controlId,
30
- propertyName
31
- ].join(',');
32
- }
33
- function getPropertyDocument(property, ui5Type, document) {
34
- return document?.[property.name] ? document[property.name] : {
35
- defaultValue: property.defaultValue ?? '-',
36
- description: '',
37
- propertyName: property.name,
38
- type: ui5Type ?? '-',
39
- propertyType: ui5Type ?? '-'
40
- };
41
- }
42
- async function addDocumentationForProperties(control, controlData) {
43
- try {
44
- const controlMetadata = control.getMetadata();
45
- const allProperties = controlMetadata.getAllProperties();
46
- const selectedControlName = controlMetadata.getName();
47
- const selContLibName = controlMetadata.getLibraryName();
48
- const document = await getDocumentation(selectedControlName, selContLibName);
49
- controlData.properties.forEach(controlProp => {
50
- if (controlProp.propertyType === PropertyType.ControlProperty) {
51
- const property = allProperties[controlProp.name];
52
- controlProp.documentation = getPropertyDocument(property, controlProp.ui5Type, document);
53
- }
54
- });
55
- } catch (e) {
56
- Log.error('Document loading failed', getError(e));
1
+ "use strict";
2
+
3
+ sap.ui.define(["open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common", "./control-data", "./utils", "sap/base/Log", "sap/ui/dt/OverlayRegistry", "sap/ui/dt/OverlayUtil", "../utils/core", "../utils/error", "./documentation"], function (___sap_ux_private_control_property_editor_common, ___control_data, ___utils, Log, OverlayRegistry, OverlayUtil, ___utils_core, ___utils_error, ___documentation) {
4
+ "use strict";
5
+
6
+ const changeProperty = ___sap_ux_private_control_property_editor_common["changeProperty"];
7
+ const controlSelected = ___sap_ux_private_control_property_editor_common["controlSelected"];
8
+ const propertyChanged = ___sap_ux_private_control_property_editor_common["propertyChanged"];
9
+ const PropertyType = ___sap_ux_private_control_property_editor_common["PropertyType"];
10
+ const reportTelemetry = ___sap_ux_private_control_property_editor_common["reportTelemetry"];
11
+ const selectControl = ___sap_ux_private_control_property_editor_common["selectControl"];
12
+ const buildControlData = ___control_data["buildControlData"];
13
+ const getOverlay = ___utils["getOverlay"];
14
+ const getRuntimeControl = ___utils["getRuntimeControl"];
15
+ const getComponent = ___utils_core["getComponent"];
16
+ const getControlById = ___utils_core["getControlById"];
17
+ const getError = ___utils_error["getError"];
18
+ const getDocumentation = ___documentation["getDocumentation"];
19
+ /**
20
+ * Change id is a combination of controlId and propertyName.
21
+ *
22
+ * @param controlId unique identifier for a control.
23
+ * @param propertyName name of the control property.
24
+ * @returns string
25
+ */
26
+ function propertyChangeId(controlId, propertyName) {
27
+ return [controlId, propertyName].join(',');
28
+ }
29
+
30
+ /**
31
+ * Return document of a property.
32
+ *
33
+ * @param property - control metadata props.
34
+ * @param ui5Type - ui5 type
35
+ * @param document - property that is ignored during design time
36
+ * @returns PropertiesInfo
37
+ */
38
+ function getPropertyDocument(property, ui5Type, document) {
39
+ return document?.[property.name] ? document[property.name] : {
40
+ defaultValue: property.defaultValue ?? '-',
41
+ description: '',
42
+ propertyName: property.name,
43
+ type: ui5Type ?? '-',
44
+ propertyType: ui5Type ?? '-'
45
+ };
46
+ }
47
+ async function addDocumentationForProperties(control, controlData) {
48
+ try {
49
+ const controlMetadata = control.getMetadata();
50
+ const allProperties = controlMetadata.getAllProperties();
51
+ const selectedControlName = controlMetadata.getName();
52
+ const selContLibName = controlMetadata.getLibraryName();
53
+ // Add the control's properties
54
+ const document = await getDocumentation(selectedControlName, selContLibName);
55
+ controlData.properties.forEach(controlProp => {
56
+ if (controlProp.propertyType === PropertyType.ControlProperty) {
57
+ const property = allProperties[controlProp.name];
58
+ controlProp.documentation = getPropertyDocument(property, controlProp.ui5Type, document);
57
59
  }
60
+ });
61
+ } catch (e) {
62
+ Log.error('Document loading failed', getError(e));
58
63
  }
59
- class SelectionService {
60
- appliedChangeCache = ((() => new Map())());
61
- activeChangeHandlers = ((() => new Set())());
62
- constructor(rta, changeService) {
63
- this.rta = rta;
64
- this.changeService = changeService;
64
+ }
65
+
66
+ /**
67
+ *
68
+ */
69
+ class SelectionService {
70
+ appliedChangeCache = (() => new Map())();
71
+ activeChangeHandlers = (() => new Set())();
72
+ /**
73
+ *
74
+ * @param rta - rta object.
75
+ * @param ui5 - facade for ui5 framework methods
76
+ */
77
+ constructor(rta, changeService) {
78
+ this.rta = rta;
79
+ this.changeService = changeService;
80
+ }
81
+
82
+ /**
83
+ * Initialize selection service.
84
+ *
85
+ * @param sendAction action sender function
86
+ * @param subscribe subscriber function
87
+ */
88
+ init(sendAction, subscribe) {
89
+ const eventOrigin = new Set();
90
+ const onselectionChange = this.createOnSelectionChangeHandler(sendAction, eventOrigin);
91
+ this.rta.attachSelectionChange(event => {
92
+ onselectionChange(event).catch(error => Log.error('Event interrupted: ', getError(error)));
93
+ });
94
+ subscribe(async action => {
95
+ if (changeProperty.match(action)) {
96
+ this.applyControlPropertyChange(action.payload.controlId, action.payload.propertyName);
97
+ } else if (selectControl.match(action)) {
98
+ const id = action.payload;
99
+ const control = getControlById(id);
100
+ if (!control) {
101
+ const component = getComponent(id);
102
+ if (component) {
103
+ await this.buildProperties(component, sendAction);
104
+ }
105
+ return;
106
+ }
107
+ this.currentSelection = control;
108
+ eventOrigin.add('outline');
109
+ let controlOverlay = OverlayRegistry.getOverlay(control);
110
+ const selectedOverlayControls = this.rta.getSelection() ?? [];
111
+ //remove previous selection
112
+ for (const selectedOverlayControl of selectedOverlayControls) {
113
+ selectedOverlayControl.setSelected(false); //deselect previously selected control
114
+ }
115
+ const controlRef = controlOverlay?.getDomRef?.();
116
+ controlRef?.scrollIntoView({
117
+ behavior: 'smooth',
118
+ block: 'center',
119
+ inline: 'nearest'
120
+ });
121
+ if (!controlRef) {
122
+ //look for closest control in order to highlight in UI the (without firing the selection event)
123
+ controlOverlay = OverlayUtil.getClosestOverlayFor(control);
124
+ }
125
+ if (controlOverlay?.isSelectable()) {
126
+ controlOverlay.setSelected(true); //highlight without firing event only if the layer is selectable
127
+ } else {
128
+ await this.buildProperties(control, sendAction);
129
+ }
65
130
  }
66
- init(sendAction, subscribe) {
67
- const eventOrigin = new Set();
68
- const onselectionChange = this.createOnSelectionChangeHandler(sendAction, eventOrigin);
69
- this.rta.attachSelectionChange(event => {
70
- onselectionChange(event).catch(error => Log.error('Event interrupted: ', getError(error)));
71
- });
72
- subscribe(async action => {
73
- if (changeProperty.match(action)) {
74
- this.applyControlPropertyChange(action.payload.controlId, action.payload.propertyName);
75
- } else if (selectControl.match(action)) {
76
- const id = action.payload;
77
- const control = getControlById(id);
78
- if (!control) {
79
- const component = getComponent(id);
80
- if (component) {
81
- await this.buildProperties(component, sendAction);
82
- }
83
- return;
84
- }
85
- this.currentSelection = control;
86
- eventOrigin.add('outline');
87
- let controlOverlay = OverlayRegistry.getOverlay(control);
88
- const selectedOverlayControls = this.rta.getSelection() ?? [];
89
- for (const selectedOverlayControl of selectedOverlayControls) {
90
- selectedOverlayControl.setSelected(false);
91
- }
92
- const controlRef = controlOverlay?.getDomRef?.();
93
- controlRef?.scrollIntoView({
94
- behavior: 'smooth',
95
- block: 'center',
96
- inline: 'nearest'
97
- });
98
- if (!controlRef) {
99
- controlOverlay = OverlayUtil.getClosestOverlayFor(control);
100
- }
101
- if (controlOverlay?.isSelectable()) {
102
- controlOverlay.setSelected(true);
103
- } else {
104
- await this.buildProperties(control, sendAction);
105
- }
106
- }
107
- });
108
- this.changeService.onStackChange(async event => {
109
- const control = event.detail.controls.find(ctrl => ctrl === this.currentSelection);
110
- if (control) {
111
- const overlay = getOverlay(control);
112
- await this.buildProperties(control, sendAction, overlay);
113
- }
114
- });
131
+ });
132
+ // rebuild config properties in panel for the selected control onStackChange event
133
+ this.changeService.onStackChange(async event => {
134
+ const control = event.detail.controls.find(ctrl => ctrl === this.currentSelection);
135
+ if (control) {
136
+ const overlay = getOverlay(control);
137
+ await this.buildProperties(control, sendAction, overlay);
115
138
  }
116
- async buildProperties(control, sendAction, overlay) {
117
- const controlData = buildControlData(control, this.changeService, overlay);
118
- await addDocumentationForProperties(control, controlData);
119
- const action = controlSelected(controlData);
120
- sendAction(action);
139
+ });
140
+ }
141
+ async buildProperties(control, sendAction, overlay) {
142
+ const controlData = buildControlData(control, this.changeService, overlay);
143
+ await addDocumentationForProperties(control, controlData);
144
+ const action = controlSelected(controlData);
145
+ sendAction(action);
146
+ }
147
+
148
+ /**
149
+ *
150
+ * @param controlId unique identifier for a control
151
+ * @param propertyName name of the control property.
152
+ */
153
+ applyControlPropertyChange(controlId, propertyName) {
154
+ const changeId = propertyChangeId(controlId, propertyName);
155
+ this.appliedChangeCache.set(changeId, Date.now());
156
+ }
157
+
158
+ /**
159
+ * Create handler for onSelectionChange.
160
+ *
161
+ * @param sendAction sending action method
162
+ * @param eventOrigin origin of the event.
163
+ * @returns (event: Event) => Promise<void>
164
+ */
165
+ createOnSelectionChangeHandler(sendAction, eventOrigin) {
166
+ return async event => {
167
+ const selection = event.getParameter('selection');
168
+ for (const dispose of this.activeChangeHandlers) {
169
+ dispose();
121
170
  }
122
- applyControlPropertyChange(controlId, propertyName) {
123
- const changeId = propertyChangeId(controlId, propertyName);
124
- this.appliedChangeCache.set(changeId, Date.now());
171
+ this.activeChangeHandlers.clear();
172
+ if (Array.isArray(selection) && selection.length === 1) {
173
+ const overlayControl = sap.ui.getCore().byId(selection[0].getId());
174
+ if (overlayControl) {
175
+ const runtimeControl = getRuntimeControl(overlayControl);
176
+ this.currentSelection = runtimeControl;
177
+ const controlName = runtimeControl.getMetadata().getName();
178
+ this.handlePropertyChanges(runtimeControl, sendAction);
179
+ try {
180
+ const isOutline = eventOrigin.has('outline');
181
+ const name = controlName.toLowerCase().startsWith('sap') ? controlName : 'Other Control Types';
182
+ if (isOutline) {
183
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
184
+ reportTelemetry({
185
+ category: 'Outline Selection',
186
+ controlName: name
187
+ });
188
+ } else {
189
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
190
+ reportTelemetry({
191
+ category: 'Overlay Selection',
192
+ controlName: name
193
+ });
194
+ }
195
+ } catch (error) {
196
+ const extendedError = getError(error);
197
+ Log.error('Failed to report telemetry', extendedError);
198
+ } finally {
199
+ await this.buildProperties(runtimeControl, sendAction, overlayControl);
200
+ eventOrigin.delete('outline');
201
+ }
202
+ }
125
203
  }
126
- createOnSelectionChangeHandler(sendAction, eventOrigin) {
127
- return async event => {
128
- const selection = event.getParameter('selection');
129
- for (const dispose of this.activeChangeHandlers) {
130
- dispose();
131
- }
132
- this.activeChangeHandlers.clear();
133
- if (Array.isArray(selection) && selection.length === 1) {
134
- const overlayControl = sap.ui.getCore().byId(selection[0].getId());
135
- if (overlayControl) {
136
- const runtimeControl = getRuntimeControl(overlayControl);
137
- this.currentSelection = runtimeControl;
138
- const controlName = runtimeControl.getMetadata().getName();
139
- this.handlePropertyChanges(runtimeControl, sendAction);
140
- try {
141
- const isOutline = eventOrigin.has('outline');
142
- const name = controlName.toLowerCase().startsWith('sap') ? controlName : 'Other Control Types';
143
- if (isOutline) {
144
- reportTelemetry({
145
- category: 'Outline Selection',
146
- controlName: name
147
- });
148
- } else {
149
- reportTelemetry({
150
- category: 'Overlay Selection',
151
- controlName: name
152
- });
153
- }
154
- } catch (error) {
155
- const extendedError = getError(error);
156
- Log.error('Failed to report telemetry', extendedError);
157
- } finally {
158
- await this.buildProperties(runtimeControl, sendAction, overlayControl);
159
- eventOrigin.delete('outline');
160
- }
161
- }
162
- }
163
- };
204
+ };
205
+ }
206
+
207
+ /**
208
+ *
209
+ * @param runtimeControl sap/ui/base/ManagedObject
210
+ * @param sendAction send action method.
211
+ */
212
+ handlePropertyChanges(runtimeControl, sendAction) {
213
+ const handler = e => {
214
+ const propertyName = e.getParameter('name');
215
+ const controlId = e.getParameter('id');
216
+ const changeId = propertyChangeId(controlId, propertyName);
217
+ const timestamp = this.appliedChangeCache.get(changeId);
218
+ if (timestamp) {
219
+ // Change originated from control property editor, we do not need to notify it
220
+ this.appliedChangeCache.delete(changeId);
221
+ return;
164
222
  }
165
- handlePropertyChanges(runtimeControl, sendAction) {
166
- const handler = e => {
167
- const propertyName = e.getParameter('name');
168
- const controlId = e.getParameter('id');
169
- const changeId = propertyChangeId(controlId, propertyName);
170
- const timestamp = this.appliedChangeCache.get(changeId);
171
- if (timestamp) {
172
- this.appliedChangeCache.delete(changeId);
173
- return;
174
- }
175
- const info = runtimeControl.getBindingInfo(propertyName);
176
- const newValue = info?.bindingString ?? e.getParameter('newValue');
177
- const change = propertyChanged({
178
- controlId,
179
- propertyName,
180
- newValue
181
- });
182
- sendAction(change);
183
- };
184
- runtimeControl.attachEvent('_change', handler);
185
- this.activeChangeHandlers.add(() => {
186
- try {
187
- runtimeControl.detachEvent('_change', handler);
188
- } catch {
189
- }
190
- });
223
+ const info = runtimeControl.getBindingInfo(propertyName);
224
+ const newValue = info?.bindingString ?? e.getParameter('newValue');
225
+ const change = propertyChanged({
226
+ controlId,
227
+ propertyName,
228
+ newValue
229
+ });
230
+ sendAction(change);
231
+ };
232
+ runtimeControl.attachEvent('_change', handler);
233
+ this.activeChangeHandlers.add(() => {
234
+ try {
235
+ runtimeControl.detachEvent('_change', handler);
236
+ } catch {
237
+ // control has already been cleaned up, nothing to do here
191
238
  }
239
+ });
192
240
  }
193
- var __exports = { __esModule: true };
194
- __exports.SelectionService = SelectionService;
195
- return __exports;
196
- });
241
+ }
242
+ var __exports = {
243
+ __esModule: true
244
+ };
245
+ __exports.SelectionService = SelectionService;
246
+ return __exports;
247
+ });
248
+ //# sourceMappingURL=selection.js.map
@@ -1,6 +1,2 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
2
  //# sourceMappingURL=types.js.map