@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.
- package/dist/client/adp/add-fragment.js +46 -46
- package/dist/client/adp/api-handler.js +159 -159
- package/dist/client/adp/command-executor.js +75 -75
- package/dist/client/adp/command-executor.ts +4 -4
- package/dist/client/adp/control-utils.js +44 -44
- package/dist/client/adp/controllers/AddFragment.controller.js +1 -1
- package/dist/client/adp/controllers/AddFragment.controller.ts +2 -2
- package/dist/client/adp/controllers/AddTableColumnFragments.controller.js +1 -1
- package/dist/client/adp/controllers/AddTableColumnFragments.controller.ts +2 -2
- package/dist/client/adp/controllers/BaseDialog.controller.js +2 -13
- package/dist/client/adp/controllers/BaseDialog.controller.ts +7 -25
- package/dist/client/adp/controllers/ControllerExtension.controller.js +268 -210
- package/dist/client/adp/controllers/ControllerExtension.controller.ts +110 -22
- package/dist/client/adp/controllers/ExtensionPoint.controller.js +139 -139
- package/dist/client/adp/controllers/FileExistsDialog.controller.js +66 -66
- package/dist/client/adp/dialog-factory.js +135 -135
- package/dist/client/adp/dialog-factory.ts +3 -1
- package/dist/client/adp/extend-controller.js +48 -0
- package/dist/client/adp/extend-controller.ts +49 -0
- package/dist/client/adp/init-dialogs.js +143 -163
- package/dist/client/adp/init-dialogs.ts +42 -20
- package/dist/client/adp/init.js +9 -1
- package/dist/client/adp/init.ts +6 -1
- package/dist/client/adp/quick-actions/add-new-subpage-quick-action-base.js +96 -96
- package/dist/client/adp/quick-actions/common/add-controller-to-page.js +74 -60
- package/dist/client/adp/quick-actions/common/add-controller-to-page.ts +25 -3
- package/dist/client/adp/quick-actions/common/create-page-action.js +54 -54
- package/dist/client/adp/quick-actions/common/op-add-custom-section.js +39 -39
- package/dist/client/adp/quick-actions/common/op-add-header-field.js +67 -67
- package/dist/client/adp/quick-actions/common/utils.js +18 -18
- package/dist/client/adp/quick-actions/control-types.js +23 -23
- package/dist/client/adp/quick-actions/dialog-enablement-validator.js +24 -24
- package/dist/client/adp/quick-actions/enablement-validator.js +4 -4
- package/dist/client/adp/quick-actions/fe-v2/add-new-subpage.js +81 -81
- package/dist/client/adp/quick-actions/fe-v2/change-table-actions.js +67 -67
- package/dist/client/adp/quick-actions/fe-v2/change-table-columns.js +101 -101
- package/dist/client/adp/quick-actions/fe-v2/create-table-action.js +107 -107
- package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +99 -99
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.js +78 -78
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-table-filtering.js +77 -77
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-variant-management.js +69 -69
- package/dist/client/adp/quick-actions/fe-v2/lr-toggle-clear-filter-bar.js +59 -59
- package/dist/client/adp/quick-actions/fe-v2/op-enable-empty-row-mode.js +93 -93
- package/dist/client/adp/quick-actions/fe-v2/op-enable-variant-management.js +84 -84
- package/dist/client/adp/quick-actions/fe-v2/registry.js +77 -77
- package/dist/client/adp/quick-actions/fe-v2/utils.js +116 -116
- package/dist/client/adp/quick-actions/fe-v4/add-new-subpage.js +138 -138
- package/dist/client/adp/quick-actions/fe-v4/change-table-actions.js +79 -79
- package/dist/client/adp/quick-actions/fe-v4/change-table-columns.js +75 -75
- package/dist/client/adp/quick-actions/fe-v4/create-table-action.js +53 -53
- package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column.js +49 -49
- package/dist/client/adp/quick-actions/fe-v4/enable-variant-management.js +81 -81
- package/dist/client/adp/quick-actions/fe-v4/lr-enable-semantic-date-range-filter-bar.js +56 -56
- package/dist/client/adp/quick-actions/fe-v4/lr-enable-table-filtering.js +84 -84
- package/dist/client/adp/quick-actions/fe-v4/lr-toggle-clear-filter-bar.js +53 -53
- package/dist/client/adp/quick-actions/fe-v4/op-enable-empty-row-mode.js +89 -89
- package/dist/client/adp/quick-actions/fe-v4/registry.js +60 -60
- package/dist/client/adp/quick-actions/fe-v4/utils.js +72 -72
- package/dist/client/adp/quick-actions/load.js +44 -44
- package/dist/client/adp/quick-actions/quick-action-base.js +64 -64
- package/dist/client/adp/ui/ControllerExtension.fragment.xml +14 -3
- package/dist/client/adp/utils.js +259 -218
- package/dist/client/adp/utils.ts +55 -7
- package/dist/client/cpe/additional-change-info/add-xml-additional-info.js +75 -75
- package/dist/client/cpe/changes/generic-change.js +326 -326
- package/dist/client/cpe/changes/index.js +10 -10
- package/dist/client/cpe/changes/validator.js +39 -39
- package/dist/client/cpe/connector-service.ts +1 -0
- package/dist/client/cpe/documentation.js +164 -164
- package/dist/client/cpe/feature-service.js +36 -36
- package/dist/client/cpe/logger.js +30 -30
- package/dist/client/cpe/outline/editable.js +37 -37
- package/dist/client/cpe/outline/nodes.js +203 -203
- package/dist/client/cpe/quick-actions/quick-action-definition.js +4 -4
- package/dist/client/cpe/quick-actions/registry.js +143 -143
- package/dist/client/cpe/quick-actions/utils.js +92 -92
- package/dist/client/cpe/types.js +4 -4
- package/dist/client/cpe/ui5-utils.js +33 -33
- package/dist/client/cpe/utils.js +111 -111
- package/dist/client/flp/WorkspaceConnector.js +92 -92
- package/dist/client/flp/common.js +28 -28
- package/dist/client/flp/enableFakeConnector.js +89 -89
- package/dist/client/flp/homepage/Component.js +14 -14
- package/dist/client/flp/initCdm.js +117 -117
- package/dist/client/flp/initConnectors.js +28 -28
- package/dist/client/flp/initRta.js +178 -178
- package/dist/client/i18n.js +56 -56
- package/dist/client/messagebundle.properties +5 -0
- package/dist/client/utils/additional-change-info.js +54 -54
- package/dist/client/utils/application.js +32 -32
- package/dist/client/utils/core.js +84 -84
- package/dist/client/utils/error.js +19 -19
- package/dist/client/utils/fe-v2.js +56 -56
- package/dist/client/utils/fe-v4.js +140 -140
- package/dist/client/utils/version.js +104 -104
- 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"
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* @param
|
|
34
|
-
* @param
|
|
35
|
-
*
|
|
36
|
-
* @
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* @param
|
|
52
|
-
* @param
|
|
53
|
-
* @
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* @param {
|
|
71
|
-
* @
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
* @param {
|
|
90
|
-
* @param {
|
|
91
|
-
* @param {
|
|
92
|
-
* @
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
if (
|
|
99
|
-
return resources.getText('
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
* @param
|
|
111
|
-
* @
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
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 = (
|
|
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 = (
|
|
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 = (
|
|
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 (
|
|
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
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
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) =>
|
|
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[]) =>
|
|
182
|
+
enabled: (overlays: ElementOverlay[]) =>
|
|
183
|
+
isControllerExtensionEnabled(overlays, syncViewsIds, isReuseComponentChecker, isCloud)
|
|
162
184
|
});
|
|
163
185
|
};
|
package/dist/client/adp/init.js
CHANGED
|
@@ -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
|
-
|
|
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
|
package/dist/client/adp/init.ts
CHANGED
|
@@ -28,7 +28,12 @@ export default async function (rta: RuntimeAuthoring) {
|
|
|
28
28
|
const defaultPlugins = rta.getDefaultPlugins();
|
|
29
29
|
rta.setPlugins(defaultPlugins);
|
|
30
30
|
|
|
31
|
-
|
|
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;
|