@sap-ux/preview-middleware 0.19.28 → 0.19.30

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 (97) 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/adp/utils.ts +2 -2
  60. package/dist/client/cpe/additional-change-info/add-xml-additional-info.js +77 -0
  61. package/dist/client/cpe/additional-change-info/add-xml-additional-info.ts +84 -0
  62. package/dist/client/cpe/changes/index.js +10 -10
  63. package/dist/client/cpe/changes/service.js +5 -2
  64. package/dist/client/cpe/changes/service.ts +2 -0
  65. package/dist/client/cpe/changes/validator.js +39 -39
  66. package/dist/client/cpe/connector-service.js +2 -1
  67. package/dist/client/cpe/connector-service.ts +8 -4
  68. package/dist/client/cpe/documentation.js +164 -164
  69. package/dist/client/cpe/feature-service.js +36 -36
  70. package/dist/client/cpe/logger.js +30 -30
  71. package/dist/client/cpe/outline/editable.js +37 -37
  72. package/dist/client/cpe/outline/nodes.js +203 -203
  73. package/dist/client/cpe/quick-actions/quick-action-definition.js +4 -4
  74. package/dist/client/cpe/quick-actions/registry.js +143 -143
  75. package/dist/client/cpe/quick-actions/utils.js +92 -92
  76. package/dist/client/cpe/types.js +4 -4
  77. package/dist/client/cpe/ui5-utils.js +33 -33
  78. package/dist/client/cpe/utils.js +111 -111
  79. package/dist/client/flp/WorkspaceConnector.js +92 -86
  80. package/dist/client/flp/WorkspaceConnector.ts +10 -2
  81. package/dist/client/flp/common.js +28 -28
  82. package/dist/client/flp/enableFakeConnector.js +89 -83
  83. package/dist/client/flp/enableFakeConnector.ts +11 -2
  84. package/dist/client/flp/homepage/Component.js +14 -14
  85. package/dist/client/flp/initCdm.js +117 -117
  86. package/dist/client/flp/initConnectors.js +28 -28
  87. package/dist/client/flp/initRta.js +178 -178
  88. package/dist/client/i18n.js +56 -56
  89. package/dist/client/utils/additional-change-info.js +43 -0
  90. package/dist/client/utils/additional-change-info.ts +42 -0
  91. package/dist/client/utils/application.js +32 -32
  92. package/dist/client/utils/core.js +84 -84
  93. package/dist/client/utils/error.js +19 -19
  94. package/dist/client/utils/fe-v2.js +56 -56
  95. package/dist/client/utils/fe-v4.js +140 -140
  96. package/dist/client/utils/version.js +104 -104
  97. package/package.json +3 -3
@@ -1,140 +1,165 @@
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 {isReuseComponentApi} isReuseComponentChecker - Function to check if the control is a reuse component.
91
- * @param {boolean} isCloud - Whether the application is running in the cloud.
92
- * @param {TextBundle} resources - The text bundle.
93
- * @returns {string} The text of the Add Fragment context menu item.
94
- */
95
- const getExtendControllerItemText = (overlay, isReuseComponentChecker, isCloud, resources) => {
96
- if (isCloud && isReuseComponentChecker(overlay.getElement().getId())) {
97
- return resources.getText('ADP_ADD_CONTROLLER_EXTENSION_MENU_ITEM_REUSE_COMPONENT');
98
- }
99
- return resources.getText('ADP_ADD_CONTROLLER_EXTENSION_MENU_ITEM');
100
- };
101
-
102
- /**
103
- * Adds a new item to the context menu
104
- *
105
- * @param rta Runtime Authoring
106
- * @param syncViewsIds Ids of all application sync views
107
- * @param ui5VersionInfo UI5 version information
108
- */
109
- const initDialogs = async (rta, syncViewsIds, ui5VersionInfo) => {
110
- const contextMenu = rta.getDefaultPlugins().contextMenu;
111
- const isCloud = rta.getFlexSettings().isCloud;
112
- const resources = await getTextBundle();
113
- const isReuseComponentChecker = await getReuseComponentChecker(ui5VersionInfo);
114
- contextMenu.addMenuItem({
115
- id: 'ADD_FRAGMENT',
116
- text: overlay => getAddFragmentItemText(overlay, isReuseComponentChecker, isCloud, resources),
117
- handler: async overlays => await DialogFactory.createDialog(overlays[0], rta, DialogNames.ADD_FRAGMENT),
118
- icon: 'sap-icon://attachment-html',
119
- enabled: overlays => isFragmentCommandEnabled(overlays, isReuseComponentChecker, isCloud)
120
- });
121
- contextMenu.addMenuItem({
122
- id: 'EXTEND_CONTROLLER',
123
- text: overlay => getExtendControllerItemText(overlay, isReuseComponentChecker, isCloud, resources),
124
- handler: async overlays => await DialogFactory.createDialog(overlays[0], rta, DialogNames.CONTROLLER_EXTENSION),
125
- icon: 'sap-icon://create-form',
126
- enabled: overlays => isControllerExtensionEnabled(overlays, syncViewsIds, isReuseComponentChecker, isCloud)
127
- });
128
- };
129
- var __exports = {
130
- __esModule: true
131
- };
132
- __exports.isControllerExtensionEnabledForControl = isControllerExtensionEnabledForControl;
133
- __exports.isControllerExtensionEnabled = isControllerExtensionEnabled;
134
- __exports.isFragmentCommandEnabled = isFragmentCommandEnabled;
135
- __exports.getAddFragmentItemText = getAddFragmentItemText;
136
- __exports.getExtendControllerItemText = getExtendControllerItemText;
137
- __exports.initDialogs = initDialogs;
138
- return __exports;
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;
139
164
  });
140
165
  //# sourceMappingURL=init-dialogs.js.map
@@ -17,6 +17,7 @@ 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';
20
21
 
21
22
  /**
22
23
  * Handler for enablement of Extend With Controller context menu entry
@@ -138,14 +139,18 @@ export const initDialogs = async (rta: RuntimeAuthoring, syncViewsIds: string[],
138
139
  const resources = await getTextBundle();
139
140
  const isReuseComponentChecker = await getReuseComponentChecker(ui5VersionInfo);
140
141
 
141
- contextMenu.addMenuItem({
142
- id: 'ADD_FRAGMENT',
143
- text: (overlay: ElementOverlay) => getAddFragmentItemText(overlay, isReuseComponentChecker, isCloud, resources),
144
- handler: async (overlays: UI5Element[]) =>
145
- await DialogFactory.createDialog(overlays[0], rta, DialogNames.ADD_FRAGMENT),
146
- icon: 'sap-icon://attachment-html',
147
- enabled: (overlays: ElementOverlay[]) => isFragmentCommandEnabled(overlays, isReuseComponentChecker, isCloud)
148
- });
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
+ }
149
154
 
150
155
  contextMenu.addMenuItem({
151
156
  id: 'EXTEND_CONTROLLER',
@@ -47,6 +47,8 @@ sap.ui.define([
47
47
  }
48
48
  const ui5VersionInfo = await getUi5Version();
49
49
  const syncViewsIds = await getAllSyncViewsIds(ui5VersionInfo);
50
+ const defaultPlugins = rta.getDefaultPlugins();
51
+ rta.setPlugins(defaultPlugins);
50
52
  await initDialogs(rta, syncViewsIds, ui5VersionInfo);
51
53
  if (!isLowerThanMinimalUi5Version(ui5VersionInfo, {
52
54
  major: 1,
@@ -23,6 +23,11 @@ export default async function (rta: RuntimeAuthoring) {
23
23
  const ui5VersionInfo = await getUi5Version();
24
24
  const syncViewsIds = await getAllSyncViewsIds(ui5VersionInfo);
25
25
 
26
+ // Plugins need to be set before adding additional plugins to prevent overriding with the default
27
+ // and allow usage of getPlugins later in the flow
28
+ const defaultPlugins = rta.getDefaultPlugins();
29
+ rta.setPlugins(defaultPlugins);
30
+
26
31
  await initDialogs(rta, syncViewsIds, ui5VersionInfo);
27
32
 
28
33
  if (!isLowerThanMinimalUi5Version(ui5VersionInfo, { major: 1, minor: 78 })) {
@@ -1,98 +1,98 @@
1
- "use strict";
2
-
3
- sap.ui.define(["sap/ui/core/Component", "sap/ui/dt/OverlayRegistry", "../../cpe/quick-actions/utils", "../../utils/core", "../dialog-factory", "../../i18n", "./simple-quick-action-base", "./dialog-enablement-validator"], function (Component, OverlayRegistry, ____cpe_quick_actions_utils, ____utils_core, ___dialog_factory, ____i18n, ___simple_quick_action_base, ___dialog_enablement_validator) {
4
- "use strict";
5
-
6
- const pageHasControlId = ____cpe_quick_actions_utils["pageHasControlId"];
7
- const getControlById = ____utils_core["getControlById"];
8
- const DialogFactory = ___dialog_factory["DialogFactory"];
9
- const DialogNames = ___dialog_factory["DialogNames"];
10
- const getTextBundle = ____i18n["getTextBundle"];
11
- const SimpleQuickActionDefinitionBase = ___simple_quick_action_base["SimpleQuickActionDefinitionBase"];
12
- const DIALOG_ENABLEMENT_VALIDATOR = ___dialog_enablement_validator["DIALOG_ENABLEMENT_VALIDATOR"];
13
- const ADD_NEW_OBJECT_PAGE_ACTION = 'add-new-subpage';
14
- const CONTROL_TYPES = ['sap.f.DynamicPage', 'sap.uxap.ObjectPageLayout'];
15
- /**
16
- * Base Quick Action class for adding a custom page action.
17
- */
18
- class AddNewSubpageBase extends SimpleQuickActionDefinitionBase {
19
- constructor(context) {
20
- super(ADD_NEW_OBJECT_PAGE_ACTION, [], 'QUICK_ACTION_ADD_NEW_SUB_PAGE', context, [{
21
- run: async () => {
22
- const i18n = await getTextBundle();
23
- if (this.navProperties.length === 0) {
24
- return {
25
- type: 'error',
26
- message: i18n.getText('NO_SUB_PAGES_TO_ADD')
27
- };
28
- }
29
- return undefined;
30
- }
31
- }, DIALOG_ENABLEMENT_VALIDATOR]);
32
- this.appReference = context.flexSettings.projectId ?? '';
33
- this.existingPages = this.getApplicationPages();
34
- }
35
- async addNavigationOptionIfAvailable(metaModel, targetEntitySet, navProperty) {
36
- if (!targetEntitySet) {
37
- return;
38
- }
39
- const pageExists = await this.isPageExists(targetEntitySet, metaModel);
40
- if (!pageExists) {
41
- this.navProperties.push({
42
- entitySet: targetEntitySet,
43
- navProperty: navProperty ?? targetEntitySet
44
- });
45
- }
46
- }
47
- async initialize() {
48
- if (!this.appReference) {
49
- throw new Error('App reference not defined');
50
- }
51
- const allControls = CONTROL_TYPES.flatMap(item => this.context.controlIndex[item] ?? []);
52
- const control = allControls.find(c => pageHasControlId(this.context.view, c.controlId));
53
- this.pageType = this.context.view.getViewName().split('.view.')[0];
54
- const metaModel = this.getODataMetaModel();
55
- if (!metaModel || !control) {
56
- return Promise.resolve();
57
- }
58
- const modifiedControl = getControlById(control.controlId);
59
- if (!modifiedControl) {
60
- return Promise.resolve();
61
- }
62
- const component = Component.getOwnerComponentFor(modifiedControl);
63
- const entitySetName = await this.getEntitySetNameFromPageComponent(component, metaModel);
64
- if (!entitySetName) {
65
- return Promise.resolve();
66
- }
67
- this.entitySet = entitySetName;
68
- this.navProperties = [];
69
- if (!this.isCurrentObjectPage()) {
70
- await this.addNavigationOptionIfAvailable(metaModel, this.entitySet);
71
- } else {
72
- await this.prepareNavigationData(metaModel);
73
- }
74
- this.control = modifiedControl;
75
- return Promise.resolve();
76
- }
77
- async execute() {
78
- const overlay = OverlayRegistry.getOverlay(this.control);
79
- await DialogFactory.createDialog(overlay, this.context.rta, DialogNames.ADD_SUBPAGE, undefined, {
80
- appReference: this.appReference,
81
- navProperties: this.navProperties,
82
- title: 'ADD_SUB_PAGE_DIALOG_TITLE',
83
- pageDescriptor: this.currentPageDescriptor
84
- }, {
85
- actionName: this.type,
86
- telemetryEventIdentifier: this.getTelemetryIdentifier()
87
- });
88
- return [];
89
- }
90
- }
91
- var __exports = {
92
- __esModule: true
93
- };
94
- __exports.ADD_NEW_OBJECT_PAGE_ACTION = ADD_NEW_OBJECT_PAGE_ACTION;
95
- __exports.AddNewSubpageBase = AddNewSubpageBase;
96
- return __exports;
1
+ "use strict";
2
+
3
+ sap.ui.define(["sap/ui/core/Component", "sap/ui/dt/OverlayRegistry", "../../cpe/quick-actions/utils", "../../utils/core", "../dialog-factory", "../../i18n", "./simple-quick-action-base", "./dialog-enablement-validator"], function (Component, OverlayRegistry, ____cpe_quick_actions_utils, ____utils_core, ___dialog_factory, ____i18n, ___simple_quick_action_base, ___dialog_enablement_validator) {
4
+ "use strict";
5
+
6
+ const pageHasControlId = ____cpe_quick_actions_utils["pageHasControlId"];
7
+ const getControlById = ____utils_core["getControlById"];
8
+ const DialogFactory = ___dialog_factory["DialogFactory"];
9
+ const DialogNames = ___dialog_factory["DialogNames"];
10
+ const getTextBundle = ____i18n["getTextBundle"];
11
+ const SimpleQuickActionDefinitionBase = ___simple_quick_action_base["SimpleQuickActionDefinitionBase"];
12
+ const DIALOG_ENABLEMENT_VALIDATOR = ___dialog_enablement_validator["DIALOG_ENABLEMENT_VALIDATOR"];
13
+ const ADD_NEW_OBJECT_PAGE_ACTION = 'add-new-subpage';
14
+ const CONTROL_TYPES = ['sap.f.DynamicPage', 'sap.uxap.ObjectPageLayout'];
15
+ /**
16
+ * Base Quick Action class for adding a custom page action.
17
+ */
18
+ class AddNewSubpageBase extends SimpleQuickActionDefinitionBase {
19
+ constructor(context) {
20
+ super(ADD_NEW_OBJECT_PAGE_ACTION, [], 'QUICK_ACTION_ADD_NEW_SUB_PAGE', context, [{
21
+ run: async () => {
22
+ const i18n = await getTextBundle();
23
+ if (this.navProperties.length === 0) {
24
+ return {
25
+ type: 'error',
26
+ message: i18n.getText('NO_SUB_PAGES_TO_ADD')
27
+ };
28
+ }
29
+ return undefined;
30
+ }
31
+ }, DIALOG_ENABLEMENT_VALIDATOR]);
32
+ this.appReference = context.flexSettings.projectId ?? '';
33
+ this.existingPages = this.getApplicationPages();
34
+ }
35
+ async addNavigationOptionIfAvailable(metaModel, targetEntitySet, navProperty) {
36
+ if (!targetEntitySet) {
37
+ return;
38
+ }
39
+ const pageExists = await this.isPageExists(targetEntitySet, metaModel);
40
+ if (!pageExists) {
41
+ this.navProperties.push({
42
+ entitySet: targetEntitySet,
43
+ navProperty: navProperty ?? targetEntitySet
44
+ });
45
+ }
46
+ }
47
+ async initialize() {
48
+ if (!this.appReference) {
49
+ throw new Error('App reference not defined');
50
+ }
51
+ const allControls = CONTROL_TYPES.flatMap(item => this.context.controlIndex[item] ?? []);
52
+ const control = allControls.find(c => pageHasControlId(this.context.view, c.controlId));
53
+ this.pageType = this.context.view.getViewName().split('.view.')[0];
54
+ const metaModel = this.getODataMetaModel();
55
+ if (!metaModel || !control) {
56
+ return Promise.resolve();
57
+ }
58
+ const modifiedControl = getControlById(control.controlId);
59
+ if (!modifiedControl) {
60
+ return Promise.resolve();
61
+ }
62
+ const component = Component.getOwnerComponentFor(modifiedControl);
63
+ const entitySetName = await this.getEntitySetNameFromPageComponent(component, metaModel);
64
+ if (!entitySetName) {
65
+ return Promise.resolve();
66
+ }
67
+ this.entitySet = entitySetName;
68
+ this.navProperties = [];
69
+ if (!this.isCurrentObjectPage()) {
70
+ await this.addNavigationOptionIfAvailable(metaModel, this.entitySet);
71
+ } else {
72
+ await this.prepareNavigationData(metaModel);
73
+ }
74
+ this.control = modifiedControl;
75
+ return Promise.resolve();
76
+ }
77
+ async execute() {
78
+ const overlay = OverlayRegistry.getOverlay(this.control);
79
+ await DialogFactory.createDialog(overlay, this.context.rta, DialogNames.ADD_SUBPAGE, undefined, {
80
+ appReference: this.appReference,
81
+ navProperties: this.navProperties,
82
+ title: 'ADD_SUB_PAGE_DIALOG_TITLE',
83
+ pageDescriptor: this.currentPageDescriptor
84
+ }, {
85
+ actionName: this.type,
86
+ telemetryEventIdentifier: this.getTelemetryIdentifier()
87
+ });
88
+ return [];
89
+ }
90
+ }
91
+ var __exports = {
92
+ __esModule: true
93
+ };
94
+ __exports.ADD_NEW_OBJECT_PAGE_ACTION = ADD_NEW_OBJECT_PAGE_ACTION;
95
+ __exports.AddNewSubpageBase = AddNewSubpageBase;
96
+ return __exports;
97
97
  });
98
98
  //# sourceMappingURL=add-new-subpage-quick-action-base.js.map