@sap-ux/preview-middleware 0.20.0 → 0.20.2

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/client/adp/add-fragment.js +46 -46
  2. package/dist/client/adp/api-handler.js +159 -159
  3. package/dist/client/adp/command-executor.js +75 -75
  4. package/dist/client/adp/command-executor.ts +4 -4
  5. package/dist/client/adp/control-utils.js +44 -44
  6. package/dist/client/adp/controllers/AddFragment.controller.js +1 -1
  7. package/dist/client/adp/controllers/AddFragment.controller.ts +2 -2
  8. package/dist/client/adp/controllers/AddTableColumnFragments.controller.js +1 -1
  9. package/dist/client/adp/controllers/AddTableColumnFragments.controller.ts +2 -2
  10. package/dist/client/adp/controllers/BaseDialog.controller.js +2 -13
  11. package/dist/client/adp/controllers/BaseDialog.controller.ts +7 -25
  12. package/dist/client/adp/controllers/ControllerExtension.controller.js +268 -210
  13. package/dist/client/adp/controllers/ControllerExtension.controller.ts +110 -22
  14. package/dist/client/adp/controllers/ExtensionPoint.controller.js +139 -139
  15. package/dist/client/adp/controllers/FileExistsDialog.controller.js +66 -66
  16. package/dist/client/adp/dialog-factory.js +135 -135
  17. package/dist/client/adp/dialog-factory.ts +3 -1
  18. package/dist/client/adp/extend-controller.js +48 -0
  19. package/dist/client/adp/extend-controller.ts +49 -0
  20. package/dist/client/adp/init-dialogs.js +143 -163
  21. package/dist/client/adp/init-dialogs.ts +42 -20
  22. package/dist/client/adp/init.js +9 -1
  23. package/dist/client/adp/init.ts +6 -1
  24. package/dist/client/adp/quick-actions/add-new-subpage-quick-action-base.js +96 -96
  25. package/dist/client/adp/quick-actions/common/add-controller-to-page.js +74 -60
  26. package/dist/client/adp/quick-actions/common/add-controller-to-page.ts +25 -3
  27. package/dist/client/adp/quick-actions/common/create-page-action.js +54 -54
  28. package/dist/client/adp/quick-actions/common/op-add-custom-section.js +39 -39
  29. package/dist/client/adp/quick-actions/common/op-add-header-field.js +67 -67
  30. package/dist/client/adp/quick-actions/common/utils.js +18 -18
  31. package/dist/client/adp/quick-actions/control-types.js +23 -23
  32. package/dist/client/adp/quick-actions/dialog-enablement-validator.js +24 -24
  33. package/dist/client/adp/quick-actions/enablement-validator.js +4 -4
  34. package/dist/client/adp/quick-actions/fe-v2/add-new-subpage.js +81 -81
  35. package/dist/client/adp/quick-actions/fe-v2/change-table-actions.js +67 -67
  36. package/dist/client/adp/quick-actions/fe-v2/change-table-columns.js +101 -101
  37. package/dist/client/adp/quick-actions/fe-v2/create-table-action.js +107 -107
  38. package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +99 -99
  39. package/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.js +78 -78
  40. package/dist/client/adp/quick-actions/fe-v2/lr-enable-table-filtering.js +77 -77
  41. package/dist/client/adp/quick-actions/fe-v2/lr-enable-variant-management.js +69 -69
  42. package/dist/client/adp/quick-actions/fe-v2/lr-toggle-clear-filter-bar.js +59 -59
  43. package/dist/client/adp/quick-actions/fe-v2/op-enable-empty-row-mode.js +93 -93
  44. package/dist/client/adp/quick-actions/fe-v2/op-enable-variant-management.js +84 -84
  45. package/dist/client/adp/quick-actions/fe-v2/registry.js +77 -77
  46. package/dist/client/adp/quick-actions/fe-v2/utils.js +116 -116
  47. package/dist/client/adp/quick-actions/fe-v4/add-new-subpage.js +138 -138
  48. package/dist/client/adp/quick-actions/fe-v4/change-table-actions.js +79 -79
  49. package/dist/client/adp/quick-actions/fe-v4/change-table-columns.js +75 -75
  50. package/dist/client/adp/quick-actions/fe-v4/create-table-action.js +53 -53
  51. package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column.js +49 -49
  52. package/dist/client/adp/quick-actions/fe-v4/enable-variant-management.js +81 -81
  53. package/dist/client/adp/quick-actions/fe-v4/lr-enable-semantic-date-range-filter-bar.js +56 -56
  54. package/dist/client/adp/quick-actions/fe-v4/lr-enable-table-filtering.js +84 -84
  55. package/dist/client/adp/quick-actions/fe-v4/lr-toggle-clear-filter-bar.js +53 -53
  56. package/dist/client/adp/quick-actions/fe-v4/op-enable-empty-row-mode.js +89 -89
  57. package/dist/client/adp/quick-actions/fe-v4/registry.js +60 -60
  58. package/dist/client/adp/quick-actions/fe-v4/utils.js +72 -72
  59. package/dist/client/adp/quick-actions/load.js +44 -44
  60. package/dist/client/adp/quick-actions/quick-action-base.js +64 -64
  61. package/dist/client/adp/ui/ControllerExtension.fragment.xml +14 -3
  62. package/dist/client/adp/utils.js +259 -218
  63. package/dist/client/adp/utils.ts +55 -7
  64. package/dist/client/cpe/additional-change-info/add-xml-additional-info.js +75 -75
  65. package/dist/client/cpe/changes/generic-change.js +326 -326
  66. package/dist/client/cpe/changes/index.js +10 -10
  67. package/dist/client/cpe/changes/validator.js +39 -39
  68. package/dist/client/cpe/connector-service.ts +1 -0
  69. package/dist/client/cpe/documentation.js +164 -164
  70. package/dist/client/cpe/feature-service.js +36 -36
  71. package/dist/client/cpe/logger.js +30 -30
  72. package/dist/client/cpe/outline/editable.js +37 -37
  73. package/dist/client/cpe/outline/nodes.js +203 -203
  74. package/dist/client/cpe/quick-actions/quick-action-definition.js +4 -4
  75. package/dist/client/cpe/quick-actions/registry.js +143 -143
  76. package/dist/client/cpe/quick-actions/utils.js +92 -92
  77. package/dist/client/cpe/types.js +4 -4
  78. package/dist/client/cpe/ui5-utils.js +33 -33
  79. package/dist/client/cpe/utils.js +111 -111
  80. package/dist/client/flp/WorkspaceConnector.js +92 -92
  81. package/dist/client/flp/common.js +28 -28
  82. package/dist/client/flp/enableFakeConnector.js +89 -89
  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/messagebundle.properties +5 -0
  89. package/dist/client/utils/additional-change-info.js +54 -54
  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,165 +1,145 @@
1
- "use strict";
2
-
3
- sap.ui.define(["sap/ui/rta/util/hasStableId", "sap/ui/fl/Utils", "./dialog-factory", "../i18n", "./utils", "../utils/version"], function (hasStableId, FlUtils, ___dialog_factory, ___i18n, ___utils, ___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 DialogFactory = ___dialog_factory["DialogFactory"];
24
- const DialogNames = ___dialog_factory["DialogNames"];
25
- const getTextBundle = ___i18n["getTextBundle"];
26
- const getReuseComponentChecker = ___utils["getReuseComponentChecker"];
27
- const isLowerThanMinimalUi5Version = ___utils_version["isLowerThanMinimalUi5Version"];
28
- /**
29
- * Handler for enablement of Extend With Controller context menu entry
30
- *
31
- * @param control UI5 control.
32
- * @param syncViewsIds Runtime Authoring
33
- * @param isReuseComponent Function to check if the control is a reuse component.
34
- * @param isCloud Whether the application is running in the cloud
35
- *
36
- * @returns boolean whether menu item is enabled or not
37
- */
38
- function isControllerExtensionEnabledForControl(control, syncViewsIds, isReuseComponent, isCloud) {
39
- const viewId = FlUtils.getViewForControl(control).getId();
40
- const isControlInSyncView = syncViewsIds.includes(viewId);
41
- if (isCloud) {
42
- const isClickedControlReuseComponent = isReuseComponent(control.getId());
43
- return !isControlInSyncView && !isClickedControlReuseComponent;
44
- }
45
- return !isControlInSyncView;
46
- }
47
-
48
- /**
49
- * Handler for enablement of Extend With Controller context menu entry
50
- *
51
- * @param overlays Control overlays
52
- * @param syncViewsIds Runtime Authoring
53
- * @param isReuseComponent Function to check if the control is a reuse component.
54
- * @param isCloud Whether the application is running in the cloud
55
- *
56
- * @returns boolean whether menu item is enabled or not
57
- */
58
- const isControllerExtensionEnabled = (overlays, syncViewsIds, isReuseComponent, isCloud) => {
59
- if (overlays.length === 0 || overlays.length > 1) {
60
- return false;
61
- }
62
- return isControllerExtensionEnabledForControl(overlays[0].getElement(), syncViewsIds, isReuseComponent, isCloud);
63
- };
64
-
65
- /**
66
- * Determines whether the fragment command should be enabled based on the provided overlays.
67
- *
68
- * @param {ElementOverlay[]} overlays - An array of ElementOverlay objects representing the UI overlays.
69
- * @param {isReuseComponentApi} isReuseComponent - Function to check if the control is a reuse component.
70
- * @param {boolean} isCloud - Whether the application is running in the cloud.
71
- * @returns {boolean} True if the fragment command is enabled, false otherwise.
72
- */
73
- const isFragmentCommandEnabled = (overlays, isReuseComponent, isCloud) => {
74
- if (overlays.length === 0 || overlays.length > 1) {
75
- return false;
76
- }
77
- const control = overlays[0].getElement();
78
- const stableId = hasStableId(overlays[0]);
79
- if (isCloud) {
80
- return stableId && !isReuseComponent(control.getId());
81
- }
82
- return stableId;
83
- };
84
-
85
- /**
86
- * Determines the text that should be displayed for the Add Fragment context menu item.
87
- *
88
- * @param {ElementOverlay} overlay - An ElementOverlay object representing the UI overlay.
89
- * @param {isReuseComponentApi} isReuseComponentChecker - Function to check if the control is a reuse component.
90
- * @param {boolean} isCloud - Whether the application is running in the cloud.
91
- * @param {TextBundle} resources - The text bundle.
92
- * @returns {string} The text of the Add Fragment context menu item.
93
- */
94
- const getAddFragmentItemText = (overlay, isReuseComponentChecker, isCloud, resources) => {
95
- if (isCloud && isReuseComponentChecker(overlay.getElement().getId())) {
96
- return resources.getText('ADP_ADD_FRAGMENT_MENU_ITEM_REUSE_COMPONENT');
97
- }
98
- if (!hasStableId(overlay)) {
99
- return resources.getText('ADP_ADD_FRAGMENT_MENU_ITEM_UNSTABLE_ID');
100
- }
101
- return resources.getText('ADP_ADD_FRAGMENT_MENU_ITEM');
102
- };
103
-
104
- /**
105
- * Determines the text that should be displayed for Controller Extension context menu item.
106
- *
107
- * @param {ElementOverlay} overlay - An ElementOverlay object representing the UI overlay.
108
- * @param {isReuseComponentApi} isReuseComponentChecker - Function to check if the control is a reuse component.
109
- * @param {boolean} isCloud - Whether the application is running in the cloud.
110
- * @param {TextBundle} resources - The text bundle.
111
- * @returns {string} The text of the Add Fragment context menu item.
112
- */
113
- const getExtendControllerItemText = (overlay, isReuseComponentChecker, isCloud, resources) => {
114
- if (isCloud && isReuseComponentChecker(overlay.getElement().getId())) {
115
- return resources.getText('ADP_ADD_CONTROLLER_EXTENSION_MENU_ITEM_REUSE_COMPONENT');
116
- }
117
- return resources.getText('ADP_ADD_CONTROLLER_EXTENSION_MENU_ITEM');
118
- };
119
-
120
- /**
121
- * Adds a new item to the context menu
122
- *
123
- * @param rta Runtime Authoring
124
- * @param syncViewsIds Ids of all application sync views
125
- * @param ui5VersionInfo UI5 version information
126
- */
127
- const initDialogs = async (rta, syncViewsIds, ui5VersionInfo) => {
128
- const contextMenu = rta.getDefaultPlugins().contextMenu;
129
- const isCloud = rta.getFlexSettings().isCloud;
130
- const resources = await getTextBundle();
131
- const isReuseComponentChecker = await getReuseComponentChecker(ui5VersionInfo);
132
- if (isLowerThanMinimalUi5Version(ui5VersionInfo, {
133
- major: 1,
134
- minor: 136
135
- })) {
136
- contextMenu.addMenuItem({
137
- id: 'ADD_FRAGMENT',
138
- text: overlay => getAddFragmentItemText(overlay, isReuseComponentChecker, isCloud, resources),
139
- handler: async overlays => await DialogFactory.createDialog(overlays[0], rta, DialogNames.ADD_FRAGMENT),
140
- icon: 'sap-icon://attachment-html',
141
- enabled: overlays => isFragmentCommandEnabled(overlays, isReuseComponentChecker, isCloud)
142
- });
143
- } else {
144
- (await __ui5_require_async('open/ux/preview/client/adp/add-fragment')).initAddXMLPlugin(rta);
145
- }
146
- contextMenu.addMenuItem({
147
- id: 'EXTEND_CONTROLLER',
148
- text: overlay => getExtendControllerItemText(overlay, isReuseComponentChecker, isCloud, resources),
149
- handler: async overlays => await DialogFactory.createDialog(overlays[0], rta, DialogNames.CONTROLLER_EXTENSION),
150
- icon: 'sap-icon://create-form',
151
- enabled: overlays => isControllerExtensionEnabled(overlays, syncViewsIds, isReuseComponentChecker, isCloud)
152
- });
153
- };
154
- var __exports = {
155
- __esModule: true
156
- };
157
- __exports.isControllerExtensionEnabledForControl = isControllerExtensionEnabledForControl;
158
- __exports.isControllerExtensionEnabled = isControllerExtensionEnabled;
159
- __exports.isFragmentCommandEnabled = isFragmentCommandEnabled;
160
- __exports.getAddFragmentItemText = getAddFragmentItemText;
161
- __exports.getExtendControllerItemText = getExtendControllerItemText;
162
- __exports.initDialogs = initDialogs;
163
- return __exports;
1
+ "use strict";
2
+
3
+ sap.ui.define(["sap/ui/rta/util/hasStableId", "sap/ui/fl/Utils", "./dialog-factory", "../i18n", "./utils"], function (hasStableId, FlUtils, ___dialog_factory, ___i18n, ___utils) {
4
+ "use strict";
5
+
6
+ const DialogFactory = ___dialog_factory["DialogFactory"];
7
+ const DialogNames = ___dialog_factory["DialogNames"];
8
+ const getTextBundle = ___i18n["getTextBundle"];
9
+ const getReuseComponentChecker = ___utils["getReuseComponentChecker"];
10
+ /**
11
+ * Handler for enablement of Extend With Controller context menu entry
12
+ *
13
+ * @param control UI5 control.
14
+ * @param syncViewsIds Runtime Authoring
15
+ * @param isReuseComponent Function to check if the control is a reuse component.
16
+ * @param isCloud Whether the application is running in the cloud
17
+ *
18
+ * @returns boolean whether menu item is enabled or not
19
+ */
20
+ function isControllerExtensionEnabledForControl(control, syncViewsIds, isReuseComponent, isCloud) {
21
+ const viewId = FlUtils.getViewForControl(control).getId();
22
+ const isControlInSyncView = syncViewsIds.includes(viewId);
23
+ if (isCloud) {
24
+ const isClickedControlReuseComponent = isReuseComponent(control.getId());
25
+ return !isControlInSyncView && !isClickedControlReuseComponent;
26
+ }
27
+ return !isControlInSyncView;
28
+ }
29
+
30
+ /**
31
+ * Handler for enablement of Extend With Controller context menu entry
32
+ *
33
+ * @param overlays Control overlays
34
+ * @param syncViewsIds Runtime Authoring
35
+ * @param isReuseComponent Function to check if the control is a reuse component.
36
+ * @param isCloud Whether the application is running in the cloud
37
+ *
38
+ * @returns boolean whether menu item is enabled or not
39
+ */
40
+ const isControllerExtensionEnabled = (overlays, syncViewsIds, isReuseComponent, isCloud) => {
41
+ if (overlays.length === 0 || overlays.length > 1) {
42
+ return false;
43
+ }
44
+ return isControllerExtensionEnabledForControl(overlays[0].getElement(), syncViewsIds, isReuseComponent, isCloud);
45
+ };
46
+
47
+ /**
48
+ * Determines whether the fragment command should be enabled based on the provided overlays.
49
+ *
50
+ * @param {ElementOverlay[]} overlays - An array of ElementOverlay objects representing the UI overlays.
51
+ * @param {isReuseComponentApi} isReuseComponent - Function to check if the control is a reuse component.
52
+ * @param {boolean} isCloud - Whether the application is running in the cloud.
53
+ * @returns {boolean} True if the fragment command is enabled, false otherwise.
54
+ */
55
+ const isFragmentCommandEnabled = (overlays, isReuseComponent, isCloud) => {
56
+ if (overlays.length === 0 || overlays.length > 1) {
57
+ return false;
58
+ }
59
+ const control = overlays[0].getElement();
60
+ const stableId = hasStableId(overlays[0]);
61
+ if (isCloud) {
62
+ return stableId && !isReuseComponent(control.getId());
63
+ }
64
+ return stableId;
65
+ };
66
+
67
+ /**
68
+ * Determines the text that should be displayed for the Add Fragment context menu item.
69
+ *
70
+ * @param {ElementOverlay} overlay - An ElementOverlay object representing the UI overlay.
71
+ * @param {isReuseComponentApi} isReuseComponentChecker - Function to check if the control is a reuse component.
72
+ * @param {boolean} isCloud - Whether the application is running in the cloud.
73
+ * @param {TextBundle} resources - The text bundle.
74
+ * @returns {string} The text of the Add Fragment context menu item.
75
+ */
76
+ const getAddFragmentItemText = (overlay, isReuseComponentChecker, isCloud, resources) => {
77
+ if (isCloud && isReuseComponentChecker(overlay.getElement().getId())) {
78
+ return resources.getText('ADP_ADD_FRAGMENT_MENU_ITEM_REUSE_COMPONENT');
79
+ }
80
+ if (!hasStableId(overlay)) {
81
+ return resources.getText('ADP_ADD_FRAGMENT_MENU_ITEM_UNSTABLE_ID');
82
+ }
83
+ return resources.getText('ADP_ADD_FRAGMENT_MENU_ITEM');
84
+ };
85
+
86
+ /**
87
+ * Determines the text that should be displayed for Controller Extension context menu item.
88
+ *
89
+ * @param {ElementOverlay} overlay - An ElementOverlay object representing the UI overlay.
90
+ * @param {string[]} syncViewsIds - Array of IDs of all application sync views.
91
+ * @param {isReuseComponentApi} isReuseComponentChecker - Function to check if the control is a reuse component.
92
+ * @param {boolean} isCloud - Whether the application is running in the cloud.
93
+ * @param {TextBundle} resources - The text bundle.
94
+ * @returns {string} The text of the Add Fragment context menu item.
95
+ */
96
+ const getExtendControllerItemText = (overlay, syncViewsIds, isReuseComponentChecker, isCloud, resources) => {
97
+ const viewId = FlUtils.getViewForControl(overlay.getElement()).getId();
98
+ if (syncViewsIds.includes(viewId)) {
99
+ return resources.getText('ADP_ADD_CONTROLLER_EXTENSION_MENU_ITEM_SYNC_VIEW');
100
+ }
101
+ if (isCloud && isReuseComponentChecker(overlay.getElement().getId())) {
102
+ return resources.getText('ADP_ADD_CONTROLLER_EXTENSION_MENU_ITEM_REUSE_COMPONENT');
103
+ }
104
+ return resources.getText('ADP_ADD_CONTROLLER_EXTENSION_MENU_ITEM');
105
+ };
106
+
107
+ /**
108
+ * Adds a new item to the context menu
109
+ *
110
+ * @param rta Runtime Authoring
111
+ * @param syncViewsIds Ids of all application sync views
112
+ * @param ui5VersionInfo UI5 version information
113
+ */
114
+ const initDialogs = async (rta, syncViewsIds, ui5VersionInfo) => {
115
+ const contextMenu = rta.getDefaultPlugins().contextMenu;
116
+ const isCloud = rta.getFlexSettings().isCloud;
117
+ const resources = await getTextBundle();
118
+ const isReuseComponentChecker = await getReuseComponentChecker(ui5VersionInfo);
119
+ contextMenu.addMenuItem({
120
+ id: 'ADD_FRAGMENT',
121
+ text: overlay => getAddFragmentItemText(overlay, isReuseComponentChecker, isCloud, resources),
122
+ handler: async overlays => await DialogFactory.createDialog(overlays[0], rta, DialogNames.ADD_FRAGMENT),
123
+ icon: 'sap-icon://attachment-html',
124
+ enabled: overlays => isFragmentCommandEnabled(overlays, isReuseComponentChecker, isCloud)
125
+ });
126
+ contextMenu.addMenuItem({
127
+ id: 'EXTEND_CONTROLLER',
128
+ text: overlay => getExtendControllerItemText(overlay, syncViewsIds, isReuseComponentChecker, isCloud, resources),
129
+ handler: async overlays => await DialogFactory.createDialog(overlays[0], rta, DialogNames.CONTROLLER_EXTENSION),
130
+ icon: 'sap-icon://create-form',
131
+ enabled: overlays => isControllerExtensionEnabled(overlays, syncViewsIds, isReuseComponentChecker, isCloud)
132
+ });
133
+ };
134
+ var __exports = {
135
+ __esModule: true
136
+ };
137
+ __exports.isControllerExtensionEnabledForControl = isControllerExtensionEnabledForControl;
138
+ __exports.isControllerExtensionEnabled = isControllerExtensionEnabled;
139
+ __exports.isFragmentCommandEnabled = isFragmentCommandEnabled;
140
+ __exports.getAddFragmentItemText = getAddFragmentItemText;
141
+ __exports.getExtendControllerItemText = getExtendControllerItemText;
142
+ __exports.initDialogs = initDialogs;
143
+ return __exports;
164
144
  });
165
145
  //# sourceMappingURL=init-dialogs.js.map
@@ -17,7 +17,6 @@ import type { IsReuseComponentApi } from '../cpe/types';
17
17
  import { getTextBundle, type TextBundle } from '../i18n';
18
18
  import { getReuseComponentChecker } from './utils';
19
19
  import type { Ui5VersionInfo } from '../utils/version';
20
- import { isLowerThanMinimalUi5Version } from '../utils/version';
21
20
 
22
21
  /**
23
22
  * Handler for enablement of Extend With Controller context menu entry
@@ -38,7 +37,7 @@ export function isControllerExtensionEnabledForControl(
38
37
  const viewId = FlUtils.getViewForControl(control).getId();
39
38
  const isControlInSyncView = syncViewsIds.includes(viewId);
40
39
 
41
- if(isCloud) {
40
+ if (isCloud) {
42
41
  const isClickedControlReuseComponent = isReuseComponent(control.getId());
43
42
  return !isControlInSyncView && !isClickedControlReuseComponent;
44
43
  }
@@ -75,7 +74,11 @@ export const isControllerExtensionEnabled = (
75
74
  * @param {boolean} isCloud - Whether the application is running in the cloud.
76
75
  * @returns {boolean} True if the fragment command is enabled, false otherwise.
77
76
  */
78
- export const isFragmentCommandEnabled = (overlays: ElementOverlay[], isReuseComponent: IsReuseComponentApi, isCloud: boolean): boolean => {
77
+ export const isFragmentCommandEnabled = (
78
+ overlays: ElementOverlay[],
79
+ isReuseComponent: IsReuseComponentApi,
80
+ isCloud: boolean
81
+ ): boolean => {
79
82
  if (overlays.length === 0 || overlays.length > 1) {
80
83
  return false;
81
84
  }
@@ -98,7 +101,12 @@ export const isFragmentCommandEnabled = (overlays: ElementOverlay[], isReuseComp
98
101
  * @param {TextBundle} resources - The text bundle.
99
102
  * @returns {string} The text of the Add Fragment context menu item.
100
103
  */
101
- export const getAddFragmentItemText = (overlay: ElementOverlay, isReuseComponentChecker: IsReuseComponentApi, isCloud: boolean, resources: TextBundle) => {
104
+ export const getAddFragmentItemText = (
105
+ overlay: ElementOverlay,
106
+ isReuseComponentChecker: IsReuseComponentApi,
107
+ isCloud: boolean,
108
+ resources: TextBundle
109
+ ) => {
102
110
  if (isCloud && isReuseComponentChecker(overlay.getElement().getId())) {
103
111
  return resources.getText('ADP_ADD_FRAGMENT_MENU_ITEM_REUSE_COMPONENT');
104
112
  }
@@ -113,12 +121,24 @@ export const getAddFragmentItemText = (overlay: ElementOverlay, isReuseComponent
113
121
  * Determines the text that should be displayed for Controller Extension context menu item.
114
122
  *
115
123
  * @param {ElementOverlay} overlay - An ElementOverlay object representing the UI overlay.
124
+ * @param {string[]} syncViewsIds - Array of IDs of all application sync views.
116
125
  * @param {isReuseComponentApi} isReuseComponentChecker - Function to check if the control is a reuse component.
117
126
  * @param {boolean} isCloud - Whether the application is running in the cloud.
118
127
  * @param {TextBundle} resources - The text bundle.
119
128
  * @returns {string} The text of the Add Fragment context menu item.
120
129
  */
121
- export const getExtendControllerItemText = (overlay: ElementOverlay, isReuseComponentChecker: IsReuseComponentApi, isCloud: boolean, resources: TextBundle) => {
130
+ export const getExtendControllerItemText = (
131
+ overlay: ElementOverlay,
132
+ syncViewsIds: string[],
133
+ isReuseComponentChecker: IsReuseComponentApi,
134
+ isCloud: boolean,
135
+ resources: TextBundle
136
+ ) => {
137
+ const viewId = FlUtils.getViewForControl(overlay.getElement()).getId();
138
+ if (syncViewsIds.includes(viewId)) {
139
+ return resources.getText('ADP_ADD_CONTROLLER_EXTENSION_MENU_ITEM_SYNC_VIEW');
140
+ }
141
+
122
142
  if (isCloud && isReuseComponentChecker(overlay.getElement().getId())) {
123
143
  return resources.getText('ADP_ADD_CONTROLLER_EXTENSION_MENU_ITEM_REUSE_COMPONENT');
124
144
  }
@@ -133,31 +153,33 @@ export const getExtendControllerItemText = (overlay: ElementOverlay, isReuseComp
133
153
  * @param syncViewsIds Ids of all application sync views
134
154
  * @param ui5VersionInfo UI5 version information
135
155
  */
136
- export const initDialogs = async (rta: RuntimeAuthoring, syncViewsIds: string[], ui5VersionInfo: Ui5VersionInfo): Promise<void> => {
156
+ export const initDialogs = async (
157
+ rta: RuntimeAuthoring,
158
+ syncViewsIds: string[],
159
+ ui5VersionInfo: Ui5VersionInfo
160
+ ): Promise<void> => {
137
161
  const contextMenu = rta.getDefaultPlugins().contextMenu;
138
162
  const isCloud = rta.getFlexSettings().isCloud;
139
163
  const resources = await getTextBundle();
140
164
  const isReuseComponentChecker = await getReuseComponentChecker(ui5VersionInfo);
141
165
 
142
- if (isLowerThanMinimalUi5Version(ui5VersionInfo, { major: 1, minor: 136 })) {
143
- contextMenu.addMenuItem({
144
- id: 'ADD_FRAGMENT',
145
- text: (overlay: ElementOverlay) => getAddFragmentItemText(overlay, isReuseComponentChecker, isCloud, resources),
146
- handler: async (overlays: UI5Element[]) =>
147
- await DialogFactory.createDialog(overlays[0], rta, DialogNames.ADD_FRAGMENT),
148
- icon: 'sap-icon://attachment-html',
149
- enabled: (overlays: ElementOverlay[]) => isFragmentCommandEnabled(overlays, isReuseComponentChecker, isCloud)
150
- });
151
- } else {
152
- (await import('open/ux/preview/client/adp/add-fragment')).initAddXMLPlugin(rta);
153
- }
166
+ contextMenu.addMenuItem({
167
+ id: 'ADD_FRAGMENT',
168
+ text: (overlay: ElementOverlay) => getAddFragmentItemText(overlay, isReuseComponentChecker, isCloud, resources),
169
+ handler: async (overlays: UI5Element[]) =>
170
+ await DialogFactory.createDialog(overlays[0], rta, DialogNames.ADD_FRAGMENT),
171
+ icon: 'sap-icon://attachment-html',
172
+ enabled: (overlays: ElementOverlay[]) => isFragmentCommandEnabled(overlays, isReuseComponentChecker, isCloud)
173
+ });
154
174
 
155
175
  contextMenu.addMenuItem({
156
176
  id: 'EXTEND_CONTROLLER',
157
- text: (overlay: ElementOverlay) => getExtendControllerItemText(overlay, isReuseComponentChecker, isCloud, resources),
177
+ text: (overlay: ElementOverlay) =>
178
+ getExtendControllerItemText(overlay, syncViewsIds, isReuseComponentChecker, isCloud, resources),
158
179
  handler: async (overlays: UI5Element[]) =>
159
180
  await DialogFactory.createDialog(overlays[0], rta, DialogNames.CONTROLLER_EXTENSION),
160
181
  icon: 'sap-icon://create-form',
161
- enabled: (overlays: ElementOverlay[]) => isControllerExtensionEnabled(overlays, syncViewsIds, isReuseComponentChecker, isCloud)
182
+ enabled: (overlays: ElementOverlay[]) =>
183
+ isControllerExtensionEnabled(overlays, syncViewsIds, isReuseComponentChecker, isCloud)
162
184
  });
163
185
  };
@@ -49,7 +49,15 @@ sap.ui.define([
49
49
  const syncViewsIds = await getAllSyncViewsIds(ui5VersionInfo);
50
50
  const defaultPlugins = rta.getDefaultPlugins();
51
51
  rta.setPlugins(defaultPlugins);
52
- await initDialogs(rta, syncViewsIds, ui5VersionInfo);
52
+ if (isLowerThanMinimalUi5Version(ui5VersionInfo, {
53
+ major: 1,
54
+ minor: 136
55
+ })) {
56
+ await initDialogs(rta, syncViewsIds, ui5VersionInfo);
57
+ } else {
58
+ (await __ui5_require_async('open/ux/preview/client/adp/add-fragment')).initAddXMLPlugin(rta);
59
+ (await __ui5_require_async('open/ux/preview/client/adp/extend-controller')).initExtendControllerPlugin(rta);
60
+ }
53
61
  if (!isLowerThanMinimalUi5Version(ui5VersionInfo, {
54
62
  major: 1,
55
63
  minor: 78
@@ -28,7 +28,12 @@ export default async function (rta: RuntimeAuthoring) {
28
28
  const defaultPlugins = rta.getDefaultPlugins();
29
29
  rta.setPlugins(defaultPlugins);
30
30
 
31
- await initDialogs(rta, syncViewsIds, ui5VersionInfo);
31
+ if (isLowerThanMinimalUi5Version(ui5VersionInfo, { major: 1, minor: 136 })) {
32
+ await initDialogs(rta, syncViewsIds, ui5VersionInfo);
33
+ } else {
34
+ (await import('open/ux/preview/client/adp/add-fragment')).initAddXMLPlugin(rta);
35
+ (await import('open/ux/preview/client/adp/extend-controller')).initExtendControllerPlugin(rta);
36
+ }
32
37
 
33
38
  if (!isLowerThanMinimalUi5Version(ui5VersionInfo, { major: 1, minor: 78 })) {
34
39
  const ExtensionPointService = (await import('open/ux/preview/client/adp/extension-point')).default;