@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.
- package/dist/base/flp.d.ts +2 -2
- package/dist/base/flp.js +3 -3
- package/dist/client/adp/add-fragment.js +48 -0
- package/dist/client/adp/add-fragment.ts +51 -0
- package/dist/client/adp/api-handler.js +155 -153
- package/dist/client/adp/api-handler.ts +2 -2
- package/dist/client/adp/command-executor.js +75 -75
- package/dist/client/adp/control-utils.js +44 -44
- package/dist/client/adp/controllers/AddFragment.controller.js +26 -86
- package/dist/client/adp/controllers/AddFragment.controller.ts +29 -113
- package/dist/client/adp/controllers/ControllerExtension.controller.js +210 -210
- 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 +21 -13
- package/dist/client/adp/extension-point.js +3 -3
- package/dist/client/adp/extension-point.ts +3 -3
- package/dist/client/adp/init-dialogs.js +163 -138
- package/dist/client/adp/init-dialogs.ts +13 -8
- package/dist/client/adp/init.js +2 -0
- package/dist/client/adp/init.ts +5 -0
- 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 +60 -60
- 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/utils.js +218 -218
- package/dist/client/cpe/additional-change-info/add-xml-additional-info.js +77 -0
- package/dist/client/cpe/additional-change-info/add-xml-additional-info.ts +84 -0
- package/dist/client/cpe/changes/index.js +10 -10
- package/dist/client/cpe/changes/service.js +5 -2
- package/dist/client/cpe/changes/service.ts +2 -0
- package/dist/client/cpe/changes/validator.js +39 -39
- package/dist/client/cpe/connector-service.js +2 -1
- package/dist/client/cpe/connector-service.ts +8 -4
- 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 -86
- package/dist/client/flp/WorkspaceConnector.ts +10 -2
- package/dist/client/flp/common.js +28 -28
- package/dist/client/flp/enableFakeConnector.js +89 -83
- package/dist/client/flp/enableFakeConnector.ts +11 -2
- 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/utils/additional-change-info.js +43 -0
- package/dist/client/utils/additional-change-info.ts +42 -0
- 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,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
|
-
|
|
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
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
* @param
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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
|
-
|
|
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
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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',
|
package/dist/client/adp/init.js
CHANGED
|
@@ -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,
|
package/dist/client/adp/init.ts
CHANGED
|
@@ -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
|