@sap-ux/preview-middleware 0.19.29 → 0.19.31

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 (96) hide show
  1. package/dist/base/flp.d.ts +2 -2
  2. package/dist/base/flp.js +3 -3
  3. package/dist/client/adp/add-fragment.js +48 -0
  4. package/dist/client/adp/add-fragment.ts +51 -0
  5. package/dist/client/adp/api-handler.js +155 -153
  6. package/dist/client/adp/api-handler.ts +2 -2
  7. package/dist/client/adp/command-executor.js +75 -75
  8. package/dist/client/adp/control-utils.js +44 -44
  9. package/dist/client/adp/controllers/AddFragment.controller.js +26 -86
  10. package/dist/client/adp/controllers/AddFragment.controller.ts +29 -113
  11. package/dist/client/adp/controllers/ControllerExtension.controller.js +210 -210
  12. package/dist/client/adp/controllers/ExtensionPoint.controller.js +139 -139
  13. package/dist/client/adp/controllers/FileExistsDialog.controller.js +66 -66
  14. package/dist/client/adp/dialog-factory.js +135 -135
  15. package/dist/client/adp/dialog-factory.ts +21 -13
  16. package/dist/client/adp/extension-point.js +3 -3
  17. package/dist/client/adp/extension-point.ts +3 -3
  18. package/dist/client/adp/init-dialogs.js +163 -138
  19. package/dist/client/adp/init-dialogs.ts +13 -8
  20. package/dist/client/adp/init.js +2 -0
  21. package/dist/client/adp/init.ts +5 -0
  22. package/dist/client/adp/quick-actions/add-new-subpage-quick-action-base.js +96 -96
  23. package/dist/client/adp/quick-actions/common/add-controller-to-page.js +60 -60
  24. package/dist/client/adp/quick-actions/common/create-page-action.js +54 -54
  25. package/dist/client/adp/quick-actions/common/op-add-custom-section.js +39 -39
  26. package/dist/client/adp/quick-actions/common/op-add-header-field.js +67 -67
  27. package/dist/client/adp/quick-actions/common/utils.js +18 -18
  28. package/dist/client/adp/quick-actions/control-types.js +23 -23
  29. package/dist/client/adp/quick-actions/dialog-enablement-validator.js +24 -24
  30. package/dist/client/adp/quick-actions/enablement-validator.js +4 -4
  31. package/dist/client/adp/quick-actions/fe-v2/add-new-subpage.js +81 -81
  32. package/dist/client/adp/quick-actions/fe-v2/change-table-actions.js +67 -67
  33. package/dist/client/adp/quick-actions/fe-v2/change-table-columns.js +101 -101
  34. package/dist/client/adp/quick-actions/fe-v2/create-table-action.js +107 -107
  35. package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +99 -99
  36. package/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.js +78 -78
  37. package/dist/client/adp/quick-actions/fe-v2/lr-enable-table-filtering.js +77 -77
  38. package/dist/client/adp/quick-actions/fe-v2/lr-enable-variant-management.js +69 -69
  39. package/dist/client/adp/quick-actions/fe-v2/lr-toggle-clear-filter-bar.js +59 -59
  40. package/dist/client/adp/quick-actions/fe-v2/op-enable-empty-row-mode.js +93 -93
  41. package/dist/client/adp/quick-actions/fe-v2/op-enable-variant-management.js +84 -84
  42. package/dist/client/adp/quick-actions/fe-v2/registry.js +77 -77
  43. package/dist/client/adp/quick-actions/fe-v2/utils.js +116 -116
  44. package/dist/client/adp/quick-actions/fe-v4/add-new-subpage.js +138 -138
  45. package/dist/client/adp/quick-actions/fe-v4/change-table-actions.js +79 -79
  46. package/dist/client/adp/quick-actions/fe-v4/change-table-columns.js +75 -75
  47. package/dist/client/adp/quick-actions/fe-v4/create-table-action.js +53 -53
  48. package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column.js +49 -49
  49. package/dist/client/adp/quick-actions/fe-v4/enable-variant-management.js +81 -81
  50. package/dist/client/adp/quick-actions/fe-v4/lr-enable-semantic-date-range-filter-bar.js +56 -56
  51. package/dist/client/adp/quick-actions/fe-v4/lr-enable-table-filtering.js +84 -84
  52. package/dist/client/adp/quick-actions/fe-v4/lr-toggle-clear-filter-bar.js +53 -53
  53. package/dist/client/adp/quick-actions/fe-v4/op-enable-empty-row-mode.js +89 -89
  54. package/dist/client/adp/quick-actions/fe-v4/registry.js +60 -60
  55. package/dist/client/adp/quick-actions/fe-v4/utils.js +72 -72
  56. package/dist/client/adp/quick-actions/load.js +44 -44
  57. package/dist/client/adp/quick-actions/quick-action-base.js +64 -64
  58. package/dist/client/adp/utils.js +218 -218
  59. package/dist/client/cpe/additional-change-info/add-xml-additional-info.js +77 -0
  60. package/dist/client/cpe/additional-change-info/add-xml-additional-info.ts +84 -0
  61. package/dist/client/cpe/changes/index.js +10 -10
  62. package/dist/client/cpe/changes/service.js +5 -2
  63. package/dist/client/cpe/changes/service.ts +2 -0
  64. package/dist/client/cpe/changes/validator.js +39 -39
  65. package/dist/client/cpe/connector-service.js +2 -1
  66. package/dist/client/cpe/connector-service.ts +8 -4
  67. package/dist/client/cpe/documentation.js +164 -164
  68. package/dist/client/cpe/feature-service.js +36 -36
  69. package/dist/client/cpe/logger.js +30 -30
  70. package/dist/client/cpe/outline/editable.js +37 -37
  71. package/dist/client/cpe/outline/nodes.js +203 -203
  72. package/dist/client/cpe/quick-actions/quick-action-definition.js +4 -4
  73. package/dist/client/cpe/quick-actions/registry.js +143 -143
  74. package/dist/client/cpe/quick-actions/utils.js +92 -92
  75. package/dist/client/cpe/types.js +4 -4
  76. package/dist/client/cpe/ui5-utils.js +33 -33
  77. package/dist/client/cpe/utils.js +111 -111
  78. package/dist/client/flp/WorkspaceConnector.js +92 -86
  79. package/dist/client/flp/WorkspaceConnector.ts +10 -2
  80. package/dist/client/flp/common.js +28 -28
  81. package/dist/client/flp/enableFakeConnector.js +89 -83
  82. package/dist/client/flp/enableFakeConnector.ts +11 -2
  83. package/dist/client/flp/homepage/Component.js +14 -14
  84. package/dist/client/flp/initCdm.js +117 -117
  85. package/dist/client/flp/initConnectors.js +28 -28
  86. package/dist/client/flp/initRta.js +178 -178
  87. package/dist/client/i18n.js +56 -56
  88. package/dist/client/utils/additional-change-info.js +43 -0
  89. package/dist/client/utils/additional-change-info.ts +42 -0
  90. package/dist/client/utils/application.js +32 -32
  91. package/dist/client/utils/core.js +84 -84
  92. package/dist/client/utils/error.js +19 -19
  93. package/dist/client/utils/fe-v2.js +56 -56
  94. package/dist/client/utils/fe-v4.js +140 -140
  95. package/dist/client/utils/version.js +104 -104
  96. package/package.json +4 -4
@@ -1,220 +1,220 @@
1
- "use strict";
2
-
3
- sap.ui.define(["sap/m/MessageToast", "sap/ui/core/Element", "sap/base/Log", "sap/ui/fl/Utils", "../utils/core", "../utils/error", "../utils/version"], function (MessageToast, Element, Log, FlexUtils, ___utils_core, ___utils_error, ___utils_version) {
4
- "use strict";
5
-
6
- function __ui5_require_async(path) {
7
- return new Promise(function (resolve, reject) {
8
- sap.ui.require([path], function (module) {
9
- if (!(module && module.__esModule)) {
10
- module = module === null || !(typeof module === "object" && path.endsWith("/library")) ? {
11
- default: module
12
- } : module;
13
- Object.defineProperty(module, "__esModule", {
14
- value: true
15
- });
16
- }
17
- resolve(module);
18
- }, function (err) {
19
- reject(err);
20
- });
21
- });
22
- }
23
- const getControlById = ___utils_core["getControlById"];
24
- const getError = ___utils_error["getError"];
25
- const isLowerThanMinimalUi5Version = ___utils_version["isLowerThanMinimalUi5Version"];
26
- let reuseComponentChecker;
27
-
28
- /**
29
- * Resets the reuse component checker.
30
- */
31
- function resetReuseComponentChecker() {
32
- reuseComponentChecker = undefined;
33
- }
34
-
35
- /**
36
- * Defers the resolution of the promise, stores resolve/reject functions so that they can be accessed at a later stage.
37
- *
38
- * @description A Deferred object contains an unresolved promise along with the functions to resolve or reject that promise.
39
- *
40
- * @returns {Deferred} Deferred object
41
- */
42
- function createDeferred() {
43
- let resolve = null;
44
- let reject = null;
45
- const promise = new Promise((res, rej) => {
46
- resolve = res;
47
- reject = rej;
48
- });
49
- if (resolve === null || reject === null) {
50
- throw new Error('Failed to initialize resolve and reject functions.');
51
- }
52
- return {
53
- promise,
54
- resolve,
55
- reject
56
- };
57
- }
58
-
59
- /**
60
- * Checks if the fragment name associated with a command matches the specified fragment name.
61
- *
62
- * @param {FlexCommand} command - The command object containing the prepared change to be examined.
63
- * @param {string} fragmentName - The name of the fragment to match against the command's change.
64
- * @returns {boolean} Returns true if the command's change contains a fragment path that matches
65
- * the specified fragment name; otherwise, returns false.
66
- */
67
- function matchesFragmentName(command, fragmentName) {
68
- if (typeof command.getPreparedChange !== 'function') {
69
- return false;
70
- }
71
- const change = command.getPreparedChange().getDefinition();
72
- return change.content?.fragmentPath?.includes(`${fragmentName}.fragment.xml`) || false;
73
- }
74
-
75
- /**
76
- * Displays a message to the user indicating that an XML fragment will be created upon saving a change.
77
- *
78
- * @param {string} message - The message to be shown in the message toast.
79
- * @param {number} duration - The duration during which message toast will be active.
80
- */
81
- function notifyUser(message) {
82
- let duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5000;
83
- MessageToast.show(message, {
84
- duration
85
- });
86
- }
87
-
88
- /**
89
- * Check if element is sync view
90
- *
91
- * @param element Design time Element
92
- * @returns boolean if element is sync view or not
93
- */
94
- function isSyncView(element) {
95
- return element?.getMetadata()?.getName()?.includes('XMLView') && element?.oAsyncState === undefined;
96
- }
97
-
98
- /**
99
- * Get Ids for all sync views
100
- *
101
- * @param ui5VersionInfo UI5 Version Information
102
- *
103
- * @returns array of Ids for application sync views
104
- */
105
- async function getAllSyncViewsIds(ui5VersionInfo) {
106
- const syncViewIds = [];
107
- try {
108
- if (isLowerThanMinimalUi5Version(ui5VersionInfo, {
109
- major: 1,
110
- minor: 120
111
- })) {
112
- const elements = Element.registry.filter(() => true);
113
- elements.forEach(ui5Element => {
114
- if (isSyncView(ui5Element)) {
115
- syncViewIds.push(ui5Element.getId());
116
- }
117
- });
118
- } else {
119
- const ElementRegistry = (await __ui5_require_async('sap/ui/core/ElementRegistry')).default;
120
- const elements = ElementRegistry.all();
121
- Object.entries(elements).forEach(_ref => {
122
- let [key, ui5Element] = _ref;
123
- if (isSyncView(ui5Element)) {
124
- syncViewIds.push(key);
125
- }
126
- });
127
- }
128
- } catch (error) {
129
- Log.error('Could not get application sync views', getError(error));
130
- }
131
- return syncViewIds;
132
- }
133
- /**
134
- * Gets controller name and view ID for the given UI5 control.
135
- *
136
- * @param control UI5 control.
137
- * @returns The controller name and view ID.
138
- */
139
-
140
- function getControllerInfoForControl(control) {
141
- const view = FlexUtils.getViewForControl(control);
142
- const controllerName = view.getController().getMetadata().getName();
143
- const viewId = view.getId();
144
- return {
145
- controllerName,
146
- viewId
147
- };
148
- }
149
-
150
- /**
151
- * Gets controller name and view ID for the given overlay control.
152
- *
153
- * @param overlayControl The overlay control.
154
- * @returns The controller name and view ID.
155
- */
156
-
157
- function getControllerInfo(overlayControl) {
158
- const control = overlayControl.getElement();
159
- return getControllerInfoForControl(control);
160
- }
161
-
162
- /**
163
- * Gets the reuse component checker function.
164
- *
165
- * @param ui5VersionInfo UI5 version information.
166
- * @returns The reuse component checker function.
167
- */
168
- async function getReuseComponentChecker(ui5VersionInfo) {
169
- if (reuseComponentChecker) {
170
- return reuseComponentChecker;
171
- }
172
- let reuseComponentApi;
173
- if (!isLowerThanMinimalUi5Version(ui5VersionInfo, {
174
- major: 1,
175
- minor: 134
176
- })) {
177
- reuseComponentApi = (await __ui5_require_async('sap/ui/rta/util/isReuseComponent')).default;
178
- }
179
- reuseComponentChecker = function isReuseComponent(controlId) {
180
- const ui5Control = getControlById(controlId);
181
- if (!ui5Control) {
182
- return false;
183
- }
184
- const component = FlexUtils.getComponentForControl(ui5Control);
185
- if (reuseComponentApi) {
186
- return reuseComponentApi(component);
187
- }
188
- if (!component) {
189
- return false;
190
- }
191
- const appComponent = FlexUtils.getAppComponentForControl(component);
192
- if (!appComponent) {
193
- return false;
194
- }
195
- const manifest = component.getManifest();
196
- const appManifest = appComponent.getManifest();
197
- const componentName = manifest?.['sap.app']?.id;
198
-
199
- // Look for component name in component usages of app component manifest
200
- const componentUsages = appManifest?.['sap.ui5']?.componentUsages;
201
- return Object.values(componentUsages || {}).some(componentUsage => {
202
- return componentUsage.name === componentName;
203
- });
204
- };
205
- return reuseComponentChecker;
206
- }
207
- var __exports = {
208
- __esModule: true
209
- };
210
- __exports.resetReuseComponentChecker = resetReuseComponentChecker;
211
- __exports.createDeferred = createDeferred;
212
- __exports.matchesFragmentName = matchesFragmentName;
213
- __exports.notifyUser = notifyUser;
214
- __exports.getAllSyncViewsIds = getAllSyncViewsIds;
215
- __exports.getControllerInfoForControl = getControllerInfoForControl;
216
- __exports.getControllerInfo = getControllerInfo;
217
- __exports.getReuseComponentChecker = getReuseComponentChecker;
218
- return __exports;
1
+ "use strict";
2
+
3
+ sap.ui.define(["sap/m/MessageToast", "sap/ui/core/Element", "sap/base/Log", "sap/ui/fl/Utils", "../utils/core", "../utils/error", "../utils/version"], function (MessageToast, Element, Log, FlexUtils, ___utils_core, ___utils_error, ___utils_version) {
4
+ "use strict";
5
+
6
+ function __ui5_require_async(path) {
7
+ return new Promise(function (resolve, reject) {
8
+ sap.ui.require([path], function (module) {
9
+ if (!(module && module.__esModule)) {
10
+ module = module === null || !(typeof module === "object" && path.endsWith("/library")) ? {
11
+ default: module
12
+ } : module;
13
+ Object.defineProperty(module, "__esModule", {
14
+ value: true
15
+ });
16
+ }
17
+ resolve(module);
18
+ }, function (err) {
19
+ reject(err);
20
+ });
21
+ });
22
+ }
23
+ const getControlById = ___utils_core["getControlById"];
24
+ const getError = ___utils_error["getError"];
25
+ const isLowerThanMinimalUi5Version = ___utils_version["isLowerThanMinimalUi5Version"];
26
+ let reuseComponentChecker;
27
+
28
+ /**
29
+ * Resets the reuse component checker.
30
+ */
31
+ function resetReuseComponentChecker() {
32
+ reuseComponentChecker = undefined;
33
+ }
34
+
35
+ /**
36
+ * Defers the resolution of the promise, stores resolve/reject functions so that they can be accessed at a later stage.
37
+ *
38
+ * @description A Deferred object contains an unresolved promise along with the functions to resolve or reject that promise.
39
+ *
40
+ * @returns {Deferred} Deferred object
41
+ */
42
+ function createDeferred() {
43
+ let resolve = null;
44
+ let reject = null;
45
+ const promise = new Promise((res, rej) => {
46
+ resolve = res;
47
+ reject = rej;
48
+ });
49
+ if (resolve === null || reject === null) {
50
+ throw new Error('Failed to initialize resolve and reject functions.');
51
+ }
52
+ return {
53
+ promise,
54
+ resolve,
55
+ reject
56
+ };
57
+ }
58
+
59
+ /**
60
+ * Checks if the fragment name associated with a command matches the specified fragment name.
61
+ *
62
+ * @param {FlexCommand} command - The command object containing the prepared change to be examined.
63
+ * @param {string} fragmentName - The name of the fragment to match against the command's change.
64
+ * @returns {boolean} Returns true if the command's change contains a fragment path that matches
65
+ * the specified fragment name; otherwise, returns false.
66
+ */
67
+ function matchesFragmentName(command, fragmentName) {
68
+ if (typeof command.getPreparedChange !== 'function') {
69
+ return false;
70
+ }
71
+ const change = command.getPreparedChange().getDefinition();
72
+ return change.content?.fragmentPath?.includes(`${fragmentName}.fragment.xml`) || false;
73
+ }
74
+
75
+ /**
76
+ * Displays a message to the user indicating that an XML fragment will be created upon saving a change.
77
+ *
78
+ * @param {string} message - The message to be shown in the message toast.
79
+ * @param {number} duration - The duration during which message toast will be active.
80
+ */
81
+ function notifyUser(message) {
82
+ let duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5000;
83
+ MessageToast.show(message, {
84
+ duration
85
+ });
86
+ }
87
+
88
+ /**
89
+ * Check if element is sync view
90
+ *
91
+ * @param element Design time Element
92
+ * @returns boolean if element is sync view or not
93
+ */
94
+ function isSyncView(element) {
95
+ return element?.getMetadata()?.getName()?.includes('XMLView') && element?.oAsyncState === undefined;
96
+ }
97
+
98
+ /**
99
+ * Get Ids for all sync views
100
+ *
101
+ * @param ui5VersionInfo UI5 Version Information
102
+ *
103
+ * @returns array of Ids for application sync views
104
+ */
105
+ async function getAllSyncViewsIds(ui5VersionInfo) {
106
+ const syncViewIds = [];
107
+ try {
108
+ if (isLowerThanMinimalUi5Version(ui5VersionInfo, {
109
+ major: 1,
110
+ minor: 120
111
+ })) {
112
+ const elements = Element.registry.filter(() => true);
113
+ elements.forEach(ui5Element => {
114
+ if (isSyncView(ui5Element)) {
115
+ syncViewIds.push(ui5Element.getId());
116
+ }
117
+ });
118
+ } else {
119
+ const ElementRegistry = (await __ui5_require_async('sap/ui/core/ElementRegistry')).default;
120
+ const elements = ElementRegistry.all();
121
+ Object.entries(elements).forEach(_ref => {
122
+ let [key, ui5Element] = _ref;
123
+ if (isSyncView(ui5Element)) {
124
+ syncViewIds.push(key);
125
+ }
126
+ });
127
+ }
128
+ } catch (error) {
129
+ Log.error('Could not get application sync views', getError(error));
130
+ }
131
+ return syncViewIds;
132
+ }
133
+ /**
134
+ * Gets controller name and view ID for the given UI5 control.
135
+ *
136
+ * @param control UI5 control.
137
+ * @returns The controller name and view ID.
138
+ */
139
+
140
+ function getControllerInfoForControl(control) {
141
+ const view = FlexUtils.getViewForControl(control);
142
+ const controllerName = view.getController().getMetadata().getName();
143
+ const viewId = view.getId();
144
+ return {
145
+ controllerName,
146
+ viewId
147
+ };
148
+ }
149
+
150
+ /**
151
+ * Gets controller name and view ID for the given overlay control.
152
+ *
153
+ * @param overlayControl The overlay control.
154
+ * @returns The controller name and view ID.
155
+ */
156
+
157
+ function getControllerInfo(overlayControl) {
158
+ const control = overlayControl.getElement();
159
+ return getControllerInfoForControl(control);
160
+ }
161
+
162
+ /**
163
+ * Gets the reuse component checker function.
164
+ *
165
+ * @param ui5VersionInfo UI5 version information.
166
+ * @returns The reuse component checker function.
167
+ */
168
+ async function getReuseComponentChecker(ui5VersionInfo) {
169
+ if (reuseComponentChecker) {
170
+ return reuseComponentChecker;
171
+ }
172
+ let reuseComponentApi;
173
+ if (!isLowerThanMinimalUi5Version(ui5VersionInfo, {
174
+ major: 1,
175
+ minor: 134
176
+ })) {
177
+ reuseComponentApi = (await __ui5_require_async('sap/ui/rta/util/isReuseComponent')).default;
178
+ }
179
+ reuseComponentChecker = function isReuseComponent(controlId) {
180
+ const ui5Control = getControlById(controlId);
181
+ if (!ui5Control) {
182
+ return false;
183
+ }
184
+ const component = FlexUtils.getComponentForControl(ui5Control);
185
+ if (reuseComponentApi) {
186
+ return reuseComponentApi(component);
187
+ }
188
+ if (!component) {
189
+ return false;
190
+ }
191
+ const appComponent = FlexUtils.getAppComponentForControl(component);
192
+ if (!appComponent) {
193
+ return false;
194
+ }
195
+ const manifest = component.getManifest();
196
+ const appManifest = appComponent.getManifest();
197
+ const componentName = manifest?.['sap.app']?.id;
198
+
199
+ // Look for component name in component usages of app component manifest
200
+ const componentUsages = appManifest?.['sap.ui5']?.componentUsages;
201
+ return Object.values(componentUsages || {}).some(componentUsage => {
202
+ return componentUsage.name === componentName;
203
+ });
204
+ };
205
+ return reuseComponentChecker;
206
+ }
207
+ var __exports = {
208
+ __esModule: true
209
+ };
210
+ __exports.resetReuseComponentChecker = resetReuseComponentChecker;
211
+ __exports.createDeferred = createDeferred;
212
+ __exports.matchesFragmentName = matchesFragmentName;
213
+ __exports.notifyUser = notifyUser;
214
+ __exports.getAllSyncViewsIds = getAllSyncViewsIds;
215
+ __exports.getControllerInfoForControl = getControllerInfoForControl;
216
+ __exports.getControllerInfo = getControllerInfo;
217
+ __exports.getReuseComponentChecker = getReuseComponentChecker;
218
+ return __exports;
219
219
  });
220
220
  //# sourceMappingURL=utils.js.map
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+
3
+ sap.ui.define(["../../utils/core", "../../adp/quick-actions/control-types"], function (____utils_core, ____adp_quick_actions_control_types) {
4
+ "use strict";
5
+
6
+ const getControlById = ____utils_core["getControlById"];
7
+ const ANALYTICAL_TABLE_TYPE = ____adp_quick_actions_control_types["ANALYTICAL_TABLE_TYPE"];
8
+ const GRID_TABLE_TYPE = ____adp_quick_actions_control_types["GRID_TABLE_TYPE"];
9
+ const MDC_TABLE_TYPE = ____adp_quick_actions_control_types["MDC_TABLE_TYPE"];
10
+ const TREE_TABLE_TYPE = ____adp_quick_actions_control_types["TREE_TABLE_TYPE"];
11
+ function getAddXMLAdditionalInfo(change) {
12
+ const selectorId = change.getSelector()?.id ?? '';
13
+ const targetAggregation = change.getContent()?.targetAggregation ?? '';
14
+ const templateName = getFragmentTemplateName(selectorId, targetAggregation);
15
+ if (templateName) {
16
+ return {
17
+ templateName
18
+ };
19
+ }
20
+ return undefined;
21
+ }
22
+ function getFragmentTemplateName(selectorId, targetAggregation) {
23
+ const control = getControlById(selectorId);
24
+ if (!control) {
25
+ return '';
26
+ }
27
+ const controlName = control.getMetadata().getName();
28
+ if (controlName === 'sap.uxap.ObjectPageLayout' && targetAggregation === 'sections') {
29
+ return 'OBJECT_PAGE_CUSTOM_SECTION';
30
+ } else if (isCustomAction(controlName, targetAggregation)) {
31
+ return 'CUSTOM_ACTION';
32
+ } else if (isObjectPageHeaderField(control, controlName, targetAggregation)) {
33
+ return 'OBJECT_PAGE_HEADER_FIELD';
34
+ } else if (targetAggregation === 'columns') {
35
+ switch (controlName) {
36
+ case MDC_TABLE_TYPE:
37
+ return 'V4_MDC_TABLE_COLUMN';
38
+ case TREE_TABLE_TYPE:
39
+ case GRID_TABLE_TYPE:
40
+ return 'GRID_TREE_TABLE_COLUMN';
41
+ case ANALYTICAL_TABLE_TYPE:
42
+ return 'ANALYTICAL_TABLE_COLUMN';
43
+ default:
44
+ return '';
45
+ }
46
+ } else if (controlName === 'sap.ui.mdc.Table' && targetAggregation === 'actions') {
47
+ return 'TABLE_ACTION';
48
+ }
49
+ return '';
50
+ }
51
+ function isCustomAction(controlName, targetAggregation) {
52
+ if (['sap.f.DynamicPageTitle', 'sap.uxap.ObjectPageHeader', 'sap.uxap.ObjectPageDynamicHeaderTitle'].includes(controlName)) {
53
+ return targetAggregation === 'actions';
54
+ } else if (controlName === 'sap.m.OverflowToolbar' || controlName === 'sap.m.Toolbar') {
55
+ return targetAggregation === 'content';
56
+ }
57
+ return false;
58
+ }
59
+ function isObjectPageHeaderField(control, controlName, targetAggregation) {
60
+ if (controlName === 'sap.uxap.ObjectPageLayout') {
61
+ return targetAggregation === 'headerContent';
62
+ } else if (controlName === 'sap.m.FlexBox') {
63
+ const parentName = control.getParent()?.getMetadata().getName();
64
+ if (parentName === 'sap.uxap.ObjectPageDynamicHeaderContent' || parentName === 'sap.uxap.ObjectPageLayout') {
65
+ return targetAggregation === 'items';
66
+ }
67
+ }
68
+ return false;
69
+ }
70
+ var __exports = {
71
+ __esModule: true
72
+ };
73
+ __exports.getAddXMLAdditionalInfo = getAddXMLAdditionalInfo;
74
+ __exports.getFragmentTemplateName = getFragmentTemplateName;
75
+ return __exports;
76
+ });
77
+ //# sourceMappingURL=add-xml-additional-info.js.map
@@ -0,0 +1,84 @@
1
+ import FlexChange from 'sap/ui/fl/Change';
2
+ import { getControlById } from '../../utils/core';
3
+ import {
4
+ ANALYTICAL_TABLE_TYPE,
5
+ GRID_TABLE_TYPE,
6
+ MDC_TABLE_TYPE,
7
+ TREE_TABLE_TYPE
8
+ } from '../../adp/quick-actions/control-types';
9
+ import Element from 'sap/ui/core/Element';
10
+
11
+ export type AddXMLAdditionalInfo = {
12
+ templateName: string;
13
+ };
14
+
15
+ export type AddXMLChangeContent = {
16
+ targetAggregation?: string;
17
+ };
18
+
19
+ export function getAddXMLAdditionalInfo(change: FlexChange<AddXMLChangeContent>): AddXMLAdditionalInfo | undefined {
20
+ const selectorId = change.getSelector()?.id ?? '';
21
+ const targetAggregation = change.getContent()?.targetAggregation ?? '';
22
+ const templateName = getFragmentTemplateName(selectorId, targetAggregation);
23
+ if (templateName) {
24
+ return { templateName };
25
+ }
26
+ return undefined;
27
+ }
28
+
29
+ export function getFragmentTemplateName(selectorId: string, targetAggregation: string): string {
30
+ const control = getControlById(selectorId);
31
+
32
+ if (!control) {
33
+ return '';
34
+ }
35
+
36
+ const controlName = control.getMetadata().getName();
37
+ if (controlName === 'sap.uxap.ObjectPageLayout' && targetAggregation === 'sections') {
38
+ return 'OBJECT_PAGE_CUSTOM_SECTION';
39
+ } else if (isCustomAction(controlName, targetAggregation)) {
40
+ return 'CUSTOM_ACTION';
41
+ } else if (isObjectPageHeaderField(control, controlName, targetAggregation)) {
42
+ return 'OBJECT_PAGE_HEADER_FIELD';
43
+ } else if (targetAggregation === 'columns') {
44
+ switch (controlName) {
45
+ case MDC_TABLE_TYPE:
46
+ return 'V4_MDC_TABLE_COLUMN';
47
+ case TREE_TABLE_TYPE:
48
+ case GRID_TABLE_TYPE:
49
+ return 'GRID_TREE_TABLE_COLUMN';
50
+ case ANALYTICAL_TABLE_TYPE:
51
+ return 'ANALYTICAL_TABLE_COLUMN';
52
+ default:
53
+ return '';
54
+ }
55
+ } else if (controlName === 'sap.ui.mdc.Table' && targetAggregation === 'actions') {
56
+ return 'TABLE_ACTION';
57
+ }
58
+ return '';
59
+ }
60
+
61
+ function isCustomAction(controlName: string, targetAggregation: string): boolean {
62
+ if (
63
+ ['sap.f.DynamicPageTitle', 'sap.uxap.ObjectPageHeader', 'sap.uxap.ObjectPageDynamicHeaderTitle'].includes(
64
+ controlName
65
+ )
66
+ ) {
67
+ return targetAggregation === 'actions';
68
+ } else if (controlName === 'sap.m.OverflowToolbar' || controlName === 'sap.m.Toolbar') {
69
+ return targetAggregation === 'content';
70
+ }
71
+ return false;
72
+ }
73
+
74
+ function isObjectPageHeaderField(control: Element, controlName: string, targetAggregation: string): boolean {
75
+ if (controlName === 'sap.uxap.ObjectPageLayout') {
76
+ return targetAggregation === 'headerContent';
77
+ } else if (controlName === 'sap.m.FlexBox') {
78
+ const parentName = control.getParent()?.getMetadata().getName();
79
+ if (parentName === 'sap.uxap.ObjectPageDynamicHeaderContent' || parentName === 'sap.uxap.ObjectPageLayout') {
80
+ return targetAggregation === 'items';
81
+ }
82
+ }
83
+ return false;
84
+ }
@@ -1,12 +1,12 @@
1
- "use strict";
2
-
3
- sap.ui.define(["./service"], function (___service) {
4
- "use strict";
5
-
6
- var __exports = {
7
- __esModule: true
8
- };
9
- __exports.ChangeService = ___service.ChangeService;
10
- return __exports;
1
+ "use strict";
2
+
3
+ sap.ui.define(["./service"], function (___service) {
4
+ "use strict";
5
+
6
+ var __exports = {
7
+ __esModule: true
8
+ };
9
+ __exports.ChangeService = ___service.ChangeService;
10
+ return __exports;
11
11
  });
12
12
  //# sourceMappingURL=index.js.map
@@ -10,8 +10,9 @@ sap.ui.define([
10
10
  'sap/m/MessageToast',
11
11
  '../../i18n',
12
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
+ '../../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) {
15
16
  'use strict';
16
17
  function __ui5_require_async(path) {
17
18
  return new Promise(function (resolve, reject) {
@@ -48,6 +49,7 @@ sap.ui.define([
48
49
  const getControlById = ____utils_core['getControlById'];
49
50
  const isA = ____utils_core['isA'];
50
51
  const getConfigMapControlIdMap = ____utils_fe_v4['getConfigMapControlIdMap'];
52
+ const setAdditionalChangeInfo = ____utils_additional_change_info['setAdditionalChangeInfo'];
51
53
  const TITLE_MAP = { appdescr_app_addAnnotationsToOData: 'Add New Annotation File' };
52
54
  const STACK_CHANGE_EVENT = 'STACK_CHANGED';
53
55
  const PROPERTY_CHANGE = 'propertyChange';
@@ -327,6 +329,7 @@ sap.ui.define([
327
329
  this.updateStack();
328
330
  }
329
331
  async handleCommand(command, inactiveCommandCount, index, pendingChanges) {
332
+ setAdditionalChangeInfo(command?.getPreparedChange?.());
330
333
  const pendingChange = await this.prepareChangeType(command, inactiveCommandCount, index);
331
334
  if (pendingChange) {
332
335
  pendingChanges.push(pendingChange);
@@ -38,6 +38,7 @@ import { getTextBundle } from '../../i18n';
38
38
  import { getControlById, isA } from '../../utils/core';
39
39
  import UI5Element from 'sap/ui/core/Element';
40
40
  import { getConfigMapControlIdMap } from '../../utils/fe-v4';
41
+ import { setAdditionalChangeInfo } from '../../utils/additional-change-info';
41
42
 
42
43
  const TITLE_MAP: { [key: string]: string } = {
43
44
  appdescr_app_addAnnotationsToOData: 'Add New Annotation File'
@@ -518,6 +519,7 @@ export class ChangeService extends EventTarget {
518
519
  index: number,
519
520
  pendingChanges: PendingChange[]
520
521
  ): Promise<void> {
522
+ setAdditionalChangeInfo(command?.getPreparedChange?.());
521
523
  const pendingChange = await this.prepareChangeType(command, inactiveCommandCount, index);
522
524
  if (pendingChange) {
523
525
  pendingChanges.push(pendingChange);