@sap-ux/preview-middleware 0.16.49 → 0.16.51
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/init-dialogs.js +10 -10
- package/dist/client/adp/init-dialogs.ts +11 -10
- package/dist/client/adp/init.js +17 -14
- package/dist/client/adp/init.ts +15 -15
- package/dist/client/cpe/connector-service.js +8 -7
- package/dist/client/cpe/connector-service.ts +5 -8
- package/dist/client/cpe/outline/nodes.js +5 -7
- package/dist/client/cpe/outline/nodes.ts +6 -8
- package/dist/client/cpe/outline/utils.js +8 -4
- package/dist/client/cpe/outline/utils.ts +5 -4
- package/dist/client/flp/WorkspaceConnector.js +5 -3
- package/dist/client/flp/WorkspaceConnector.ts +5 -4
- package/dist/client/flp/bootstrap.js +3 -4
- package/dist/client/flp/init.js +9 -7
- package/dist/client/flp/init.ts +7 -8
- package/dist/client/flp/initConnectors.js +7 -8
- package/dist/client/flp/initConnectors.ts +2 -8
- package/dist/client/utils/version.js +46 -1
- package/dist/client/utils/version.ts +63 -3
- package/package.json +4 -4
- package/dist/client/adp/ui5-version-utils.js +0 -65
- package/dist/client/adp/ui5-version-utils.ts +0 -52
|
@@ -21,16 +21,16 @@ sap.ui.define(["sap/ui/core/Fragment", "sap/ui/fl/Utils", "./controllers/AddFrag
|
|
|
21
21
|
*
|
|
22
22
|
* @param overlays Control overlays
|
|
23
23
|
* @param syncViewsIds Runtime Authoring
|
|
24
|
-
* @param
|
|
24
|
+
* @param ui5VersionInfo UI5 version information
|
|
25
25
|
*
|
|
26
26
|
* @returns boolean whether menu item is enabled or not
|
|
27
27
|
*/
|
|
28
|
-
const isControllerExtensionEnabled = (overlays, syncViewsIds,
|
|
28
|
+
const isControllerExtensionEnabled = (overlays, syncViewsIds, ui5VersionInfo) => {
|
|
29
29
|
if (overlays.length === 0 || overlays.length > 1) {
|
|
30
30
|
return false;
|
|
31
31
|
}
|
|
32
32
|
const clickedControlId = FlUtils.getViewForControl(overlays[0].getElement()).getId();
|
|
33
|
-
const isClickedControlReuseComponent = isReuseComponent(clickedControlId,
|
|
33
|
+
const isClickedControlReuseComponent = isReuseComponent(clickedControlId, ui5VersionInfo);
|
|
34
34
|
return !syncViewsIds.includes(clickedControlId) && !isClickedControlReuseComponent;
|
|
35
35
|
};
|
|
36
36
|
|
|
@@ -38,15 +38,15 @@ sap.ui.define(["sap/ui/core/Fragment", "sap/ui/fl/Utils", "./controllers/AddFrag
|
|
|
38
38
|
* Determines whether the fragment command should be enabled based on the provided overlays.
|
|
39
39
|
*
|
|
40
40
|
* @param {ElementOverlay[]} overlays - An array of ElementOverlay objects representing the UI overlays.
|
|
41
|
-
* @param
|
|
41
|
+
* @param ui5VersionInfo UI5 version information
|
|
42
42
|
* @returns {boolean} True if the fragment command is enabled, false otherwise.
|
|
43
43
|
*/
|
|
44
|
-
const isFragmentCommandEnabled = (overlays,
|
|
44
|
+
const isFragmentCommandEnabled = (overlays, ui5VersionInfo) => {
|
|
45
45
|
if (overlays.length === 0 || overlays.length > 1) {
|
|
46
46
|
return false;
|
|
47
47
|
}
|
|
48
48
|
const control = overlays[0].getElement();
|
|
49
|
-
return hasStableId(control) && !isReuseComponent(control.getId(),
|
|
49
|
+
return hasStableId(control) && !isReuseComponent(control.getId(), ui5VersionInfo);
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
/**
|
|
@@ -107,23 +107,23 @@ sap.ui.define(["sap/ui/core/Fragment", "sap/ui/fl/Utils", "./controllers/AddFrag
|
|
|
107
107
|
*
|
|
108
108
|
* @param rta Runtime Authoring
|
|
109
109
|
* @param syncViewsIds Ids of all application sync views
|
|
110
|
-
* @param
|
|
110
|
+
* @param ui5VersionInfo UI5 version information
|
|
111
111
|
*/
|
|
112
|
-
const initDialogs = (rta, syncViewsIds,
|
|
112
|
+
const initDialogs = (rta, syncViewsIds, ui5VersionInfo) => {
|
|
113
113
|
const contextMenu = rta.getDefaultPlugins().contextMenu;
|
|
114
114
|
contextMenu.addMenuItem({
|
|
115
115
|
id: 'ADD_FRAGMENT',
|
|
116
116
|
text: getAddFragmentItemText,
|
|
117
117
|
handler: async overlays => await handler(overlays[0], rta, DialogNames.ADD_FRAGMENT),
|
|
118
118
|
icon: 'sap-icon://attachment-html',
|
|
119
|
-
enabled: overlays => isFragmentCommandEnabled(overlays,
|
|
119
|
+
enabled: overlays => isFragmentCommandEnabled(overlays, ui5VersionInfo)
|
|
120
120
|
});
|
|
121
121
|
contextMenu.addMenuItem({
|
|
122
122
|
id: 'EXTEND_CONTROLLER',
|
|
123
123
|
text: 'Extend With Controller',
|
|
124
124
|
handler: async overlays => await handler(overlays[0], rta, DialogNames.CONTROLLER_EXTENSION),
|
|
125
125
|
icon: 'sap-icon://create-form',
|
|
126
|
-
enabled: overlays => isControllerExtensionEnabled(overlays, syncViewsIds,
|
|
126
|
+
enabled: overlays => isControllerExtensionEnabled(overlays, syncViewsIds, ui5VersionInfo)
|
|
127
127
|
});
|
|
128
128
|
};
|
|
129
129
|
var __exports = {
|
|
@@ -20,6 +20,7 @@ import { ExtensionPointData } from './extension-point';
|
|
|
20
20
|
import ExtensionPoint from './controllers/ExtensionPoint.controller';
|
|
21
21
|
import ManagedObject from 'sap/ui/base/ManagedObject';
|
|
22
22
|
import { isReuseComponent } from '../cpe/outline/utils';
|
|
23
|
+
import { Ui5VersionInfo } from '../utils/version';
|
|
23
24
|
|
|
24
25
|
export const enum DialogNames {
|
|
25
26
|
ADD_FRAGMENT = 'AddFragment',
|
|
@@ -34,21 +35,21 @@ type Controller = AddFragment | ControllerExtension | ExtensionPoint;
|
|
|
34
35
|
*
|
|
35
36
|
* @param overlays Control overlays
|
|
36
37
|
* @param syncViewsIds Runtime Authoring
|
|
37
|
-
* @param
|
|
38
|
+
* @param ui5VersionInfo UI5 version information
|
|
38
39
|
*
|
|
39
40
|
* @returns boolean whether menu item is enabled or not
|
|
40
41
|
*/
|
|
41
42
|
export const isControllerExtensionEnabled = (
|
|
42
43
|
overlays: ElementOverlay[],
|
|
43
44
|
syncViewsIds: string[],
|
|
44
|
-
|
|
45
|
+
ui5VersionInfo: Ui5VersionInfo
|
|
45
46
|
): boolean => {
|
|
46
47
|
if (overlays.length === 0 || overlays.length > 1) {
|
|
47
48
|
return false;
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
const clickedControlId = FlUtils.getViewForControl(overlays[0].getElement()).getId();
|
|
51
|
-
const isClickedControlReuseComponent = isReuseComponent(clickedControlId,
|
|
52
|
+
const isClickedControlReuseComponent = isReuseComponent(clickedControlId, ui5VersionInfo);
|
|
52
53
|
|
|
53
54
|
return !syncViewsIds.includes(clickedControlId) && !isClickedControlReuseComponent;
|
|
54
55
|
};
|
|
@@ -57,17 +58,17 @@ export const isControllerExtensionEnabled = (
|
|
|
57
58
|
* Determines whether the fragment command should be enabled based on the provided overlays.
|
|
58
59
|
*
|
|
59
60
|
* @param {ElementOverlay[]} overlays - An array of ElementOverlay objects representing the UI overlays.
|
|
60
|
-
* @param
|
|
61
|
+
* @param ui5VersionInfo UI5 version information
|
|
61
62
|
* @returns {boolean} True if the fragment command is enabled, false otherwise.
|
|
62
63
|
*/
|
|
63
|
-
export const isFragmentCommandEnabled = (overlays: ElementOverlay[],
|
|
64
|
+
export const isFragmentCommandEnabled = (overlays: ElementOverlay[], ui5VersionInfo: Ui5VersionInfo): boolean => {
|
|
64
65
|
if (overlays.length === 0 || overlays.length > 1) {
|
|
65
66
|
return false;
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
const control = overlays[0].getElement();
|
|
69
70
|
|
|
70
|
-
return hasStableId(control) && !isReuseComponent(control.getId(),
|
|
71
|
+
return hasStableId(control) && !isReuseComponent(control.getId(), ui5VersionInfo);
|
|
71
72
|
};
|
|
72
73
|
|
|
73
74
|
/**
|
|
@@ -143,9 +144,9 @@ export async function handler(
|
|
|
143
144
|
*
|
|
144
145
|
* @param rta Runtime Authoring
|
|
145
146
|
* @param syncViewsIds Ids of all application sync views
|
|
146
|
-
* @param
|
|
147
|
+
* @param ui5VersionInfo UI5 version information
|
|
147
148
|
*/
|
|
148
|
-
export const initDialogs = (rta: RuntimeAuthoring, syncViewsIds: string[],
|
|
149
|
+
export const initDialogs = (rta: RuntimeAuthoring, syncViewsIds: string[], ui5VersionInfo: Ui5VersionInfo): void => {
|
|
149
150
|
const contextMenu = rta.getDefaultPlugins().contextMenu;
|
|
150
151
|
|
|
151
152
|
contextMenu.addMenuItem({
|
|
@@ -153,7 +154,7 @@ export const initDialogs = (rta: RuntimeAuthoring, syncViewsIds: string[], minor
|
|
|
153
154
|
text: getAddFragmentItemText,
|
|
154
155
|
handler: async (overlays: UI5Element[]) => await handler(overlays[0], rta, DialogNames.ADD_FRAGMENT),
|
|
155
156
|
icon: 'sap-icon://attachment-html',
|
|
156
|
-
enabled: (overlays: ElementOverlay[]) => isFragmentCommandEnabled(overlays,
|
|
157
|
+
enabled: (overlays: ElementOverlay[]) => isFragmentCommandEnabled(overlays, ui5VersionInfo)
|
|
157
158
|
});
|
|
158
159
|
|
|
159
160
|
contextMenu.addMenuItem({
|
|
@@ -161,6 +162,6 @@ export const initDialogs = (rta: RuntimeAuthoring, syncViewsIds: string[], minor
|
|
|
161
162
|
text: 'Extend With Controller',
|
|
162
163
|
handler: async (overlays: UI5Element[]) => await handler(overlays[0], rta, DialogNames.CONTROLLER_EXTENSION),
|
|
163
164
|
icon: 'sap-icon://create-form',
|
|
164
|
-
enabled: (overlays: ElementOverlay[]) => isControllerExtensionEnabled(overlays, syncViewsIds,
|
|
165
|
+
enabled: (overlays: ElementOverlay[]) => isControllerExtensionEnabled(overlays, syncViewsIds, ui5VersionInfo)
|
|
165
166
|
});
|
|
166
167
|
};
|
package/dist/client/adp/init.js
CHANGED
|
@@ -4,10 +4,9 @@ sap.ui.define([
|
|
|
4
4
|
'../cpe/init',
|
|
5
5
|
'./init-dialogs',
|
|
6
6
|
'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
|
|
7
|
-
'./ui5-version-utils',
|
|
8
7
|
'../cpe/error-utils',
|
|
9
8
|
'../utils/version'
|
|
10
|
-
], function (log, __init, ___init_dialogs, ___sap_ux_private_control_property_editor_common,
|
|
9
|
+
], function (log, __init, ___init_dialogs, ___sap_ux_private_control_property_editor_common, ___cpe_error_utils, ___utils_version) {
|
|
11
10
|
'use strict';
|
|
12
11
|
function _interopRequireDefault(obj) {
|
|
13
12
|
return obj && obj.__esModule && typeof obj.default !== 'undefined' ? obj.default : obj;
|
|
@@ -30,13 +29,11 @@ sap.ui.define([
|
|
|
30
29
|
const showMessage = ___sap_ux_private_control_property_editor_common['showMessage'];
|
|
31
30
|
const startPostMessageCommunication = ___sap_ux_private_control_property_editor_common['startPostMessageCommunication'];
|
|
32
31
|
const enableTelemetry = ___sap_ux_private_control_property_editor_common['enableTelemetry'];
|
|
33
|
-
const getUI5VersionValidationMessage = ___ui5_version_utils['getUI5VersionValidationMessage'];
|
|
34
32
|
const getError = ___cpe_error_utils['getError'];
|
|
35
33
|
const getUi5Version = ___utils_version['getUi5Version'];
|
|
34
|
+
const getUI5VersionValidationMessage = ___utils_version['getUI5VersionValidationMessage'];
|
|
35
|
+
const isLowerThanMinimalUi5Version = ___utils_version['isLowerThanMinimalUi5Version'];
|
|
36
36
|
var __exports = async function (rta) {
|
|
37
|
-
const version = await getUi5Version();
|
|
38
|
-
const versionParts = version.split('.');
|
|
39
|
-
const minor = parseInt(versionParts[1], 10);
|
|
40
37
|
const flexSettings = rta.getFlexSettings();
|
|
41
38
|
if (flexSettings.telemetry === true) {
|
|
42
39
|
enableTelemetry();
|
|
@@ -54,18 +51,21 @@ sap.ui.define([
|
|
|
54
51
|
}
|
|
55
52
|
}
|
|
56
53
|
});
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
54
|
+
const ui5VersionInfo = await getUi5Version();
|
|
55
|
+
const syncViewsIds = await getAllSyncViewsIds(ui5VersionInfo);
|
|
56
|
+
initDialogs(rta, syncViewsIds, ui5VersionInfo);
|
|
57
|
+
if (!isLowerThanMinimalUi5Version(ui5VersionInfo, {
|
|
58
|
+
major: 1,
|
|
59
|
+
minor: 78
|
|
60
|
+
})) {
|
|
60
61
|
const ExtensionPointService = (await __ui5_require_async('open/ux/preview/client/adp/extension-point')).default;
|
|
61
62
|
const extPointService = new ExtensionPointService(rta);
|
|
62
63
|
extPointService.init(subscribe);
|
|
63
64
|
}
|
|
64
65
|
await init(rta);
|
|
65
|
-
|
|
66
|
-
if (ui5VersionValidationMsg) {
|
|
66
|
+
if (isLowerThanMinimalUi5Version(ui5VersionInfo)) {
|
|
67
67
|
sendAction(showMessage({
|
|
68
|
-
message:
|
|
68
|
+
message: getUI5VersionValidationMessage(ui5VersionInfo),
|
|
69
69
|
shouldHideIframe: true
|
|
70
70
|
}));
|
|
71
71
|
return;
|
|
@@ -78,10 +78,13 @@ sap.ui.define([
|
|
|
78
78
|
}
|
|
79
79
|
log.debug('ADP init executed.');
|
|
80
80
|
};
|
|
81
|
-
async function getAllSyncViewsIds(
|
|
81
|
+
async function getAllSyncViewsIds(ui5VersionInfo) {
|
|
82
82
|
const syncViewIds = [];
|
|
83
83
|
try {
|
|
84
|
-
if (
|
|
84
|
+
if (isLowerThanMinimalUi5Version(ui5VersionInfo, {
|
|
85
|
+
major: 1,
|
|
86
|
+
minor: 120
|
|
87
|
+
})) {
|
|
85
88
|
const Element = (await __ui5_require_async('sap/ui/core/Element')).default;
|
|
86
89
|
const elements = Element.registry.filter(() => true);
|
|
87
90
|
elements.forEach(ui5Element => {
|
package/dist/client/adp/init.ts
CHANGED
|
@@ -9,15 +9,16 @@ import {
|
|
|
9
9
|
enableTelemetry
|
|
10
10
|
} from '@sap-ux-private/control-property-editor-common';
|
|
11
11
|
import { ActionHandler } from '../cpe/types';
|
|
12
|
-
import { getUI5VersionValidationMessage } from './ui5-version-utils';
|
|
13
12
|
import UI5Element from 'sap/ui/dt/Element';
|
|
14
13
|
import { getError } from '../cpe/error-utils';
|
|
15
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
getUi5Version,
|
|
16
|
+
getUI5VersionValidationMessage,
|
|
17
|
+
isLowerThanMinimalUi5Version,
|
|
18
|
+
Ui5VersionInfo
|
|
19
|
+
} from '../utils/version';
|
|
16
20
|
|
|
17
21
|
export default async function (rta: RuntimeAuthoring) {
|
|
18
|
-
const version = await getUi5Version();
|
|
19
|
-
const versionParts = version.split('.');
|
|
20
|
-
const minor = parseInt(versionParts[1], 10);
|
|
21
22
|
const flexSettings = rta.getFlexSettings();
|
|
22
23
|
if (flexSettings.telemetry === true) {
|
|
23
24
|
enableTelemetry();
|
|
@@ -44,21 +45,20 @@ export default async function (rta: RuntimeAuthoring) {
|
|
|
44
45
|
}
|
|
45
46
|
);
|
|
46
47
|
|
|
47
|
-
const
|
|
48
|
-
|
|
48
|
+
const ui5VersionInfo = await getUi5Version();
|
|
49
|
+
const syncViewsIds = await getAllSyncViewsIds(ui5VersionInfo);
|
|
50
|
+
initDialogs(rta, syncViewsIds, ui5VersionInfo);
|
|
49
51
|
|
|
50
|
-
if (minor
|
|
52
|
+
if (!isLowerThanMinimalUi5Version(ui5VersionInfo, { major: 1, minor: 78 })) {
|
|
51
53
|
const ExtensionPointService = (await import('open/ux/preview/client/adp/extension-point')).default;
|
|
52
54
|
const extPointService = new ExtensionPointService(rta);
|
|
53
55
|
extPointService.init(subscribe);
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
await init(rta);
|
|
57
|
-
const ui5VersionValidationMsg = getUI5VersionValidationMessage(version);
|
|
58
|
-
|
|
59
|
-
if (ui5VersionValidationMsg) {
|
|
60
|
-
sendAction(showMessage({ message: ui5VersionValidationMsg, shouldHideIframe: true }));
|
|
61
59
|
|
|
60
|
+
if (isLowerThanMinimalUi5Version(ui5VersionInfo)) {
|
|
61
|
+
sendAction(showMessage({ message: getUI5VersionValidationMessage(ui5VersionInfo), shouldHideIframe: true }));
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
64
|
|
|
@@ -78,14 +78,14 @@ export default async function (rta: RuntimeAuthoring) {
|
|
|
78
78
|
/**
|
|
79
79
|
* Get Ids for all sync views
|
|
80
80
|
*
|
|
81
|
-
* @param
|
|
81
|
+
* @param ui5VersionInfo UI5 Version Information
|
|
82
82
|
*
|
|
83
83
|
* @returns array of Ids for application sync views
|
|
84
84
|
*/
|
|
85
|
-
async function getAllSyncViewsIds(
|
|
85
|
+
async function getAllSyncViewsIds(ui5VersionInfo: Ui5VersionInfo): Promise<string[]> {
|
|
86
86
|
const syncViewIds: string[] = [];
|
|
87
87
|
try {
|
|
88
|
-
if (minor
|
|
88
|
+
if (isLowerThanMinimalUi5Version(ui5VersionInfo, { major: 1, minor: 120 })) {
|
|
89
89
|
const Element = (await import('sap/ui/core/Element')).default;
|
|
90
90
|
const elements = Element.registry.filter(() => true) as UI5Element[];
|
|
91
91
|
elements.forEach((ui5Element) => {
|
|
@@ -19,17 +19,18 @@ sap.ui.define([
|
|
|
19
19
|
}
|
|
20
20
|
const storageFileChanged = ___sap_ux_private_control_property_editor_common['storageFileChanged'];
|
|
21
21
|
const getUi5Version = ___utils_version['getUi5Version'];
|
|
22
|
+
const isLowerThanMinimalUi5Version = ___utils_version['isLowerThanMinimalUi5Version'];
|
|
22
23
|
class WorkspaceConnectorService {
|
|
23
24
|
async init(sendAction) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const connector = (await __ui5_require_async('open/ux/preview/client/flp/WorkspaceConnector')).default;
|
|
29
|
-
connector.storage.fileChangeRequestNotifier = notifier(sendAction);
|
|
30
|
-
} else {
|
|
25
|
+
if (isLowerThanMinimalUi5Version(await getUi5Version(), {
|
|
26
|
+
major: 1,
|
|
27
|
+
minor: 73
|
|
28
|
+
})) {
|
|
31
29
|
const FakeLrepConnector = (await __ui5_require_async('sap/ui/fl/FakeLrepConnector')).default;
|
|
32
30
|
FakeLrepConnector.fileChangeRequestNotifier = notifier(sendAction);
|
|
31
|
+
} else {
|
|
32
|
+
const connector = (await __ui5_require_async('open/ux/preview/client/flp/WorkspaceConnector')).default;
|
|
33
|
+
connector.storage.fileChangeRequestNotifier = notifier(sendAction);
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
36
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExternalAction, storageFileChanged } from '@sap-ux-private/control-property-editor-common';
|
|
2
2
|
import { ActionSenderFunction } from './types';
|
|
3
|
-
import { getUi5Version } from '../utils/version';
|
|
3
|
+
import { getUi5Version, isLowerThanMinimalUi5Version } from '../utils/version';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* A Class of WorkspaceConnectorService
|
|
@@ -12,16 +12,13 @@ export class WorkspaceConnectorService {
|
|
|
12
12
|
* @param sendAction action sender function
|
|
13
13
|
*/
|
|
14
14
|
public async init(sendAction: ActionSenderFunction): Promise<void> {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
if (isLowerThanMinimalUi5Version(await getUi5Version(), { major: 1, minor: 73 })) {
|
|
16
|
+
const FakeLrepConnector = (await import('sap/ui/fl/FakeLrepConnector')).default;
|
|
17
|
+
FakeLrepConnector.fileChangeRequestNotifier = notifier(sendAction);
|
|
18
|
+
} else {
|
|
19
19
|
const connector = (await import('open/ux/preview/client/flp/WorkspaceConnector')).default;
|
|
20
20
|
// hook the file deletion listener to the UI5 workspace connector
|
|
21
21
|
connector.storage.fileChangeRequestNotifier = notifier(sendAction);
|
|
22
|
-
} else {
|
|
23
|
-
const FakeLrepConnector = (await import('sap/ui/fl/FakeLrepConnector')).default;
|
|
24
|
-
FakeLrepConnector.fileChangeRequestNotifier = notifier(sendAction);
|
|
25
22
|
}
|
|
26
23
|
}
|
|
27
24
|
}
|
|
@@ -76,9 +76,7 @@ sap.ui.define(["./utils", "../../utils/version"], function (___utils, ____utils_
|
|
|
76
76
|
async function transformNodes(input, scenario, reuseComponentsIds) {
|
|
77
77
|
const stack = [...input];
|
|
78
78
|
const items = [];
|
|
79
|
-
const
|
|
80
|
-
const versionParts = version.split('.');
|
|
81
|
-
const minor = parseInt(versionParts[1], 10);
|
|
79
|
+
const ui5VersionInfo = await getUi5Version();
|
|
82
80
|
while (stack.length) {
|
|
83
81
|
const current = stack.shift();
|
|
84
82
|
const editable = isEditable(current?.id);
|
|
@@ -99,7 +97,7 @@ sap.ui.define(["./utils", "../../utils/version"], function (___utils, ____utils_
|
|
|
99
97
|
visible: current.visible ?? true,
|
|
100
98
|
children: transformedChildren
|
|
101
99
|
};
|
|
102
|
-
fillReuseComponents(reuseComponentsIds, current, scenario,
|
|
100
|
+
fillReuseComponents(reuseComponentsIds, current, scenario, ui5VersionInfo);
|
|
103
101
|
items.push(node);
|
|
104
102
|
}
|
|
105
103
|
if (isAdp && isExtPoint) {
|
|
@@ -133,10 +131,10 @@ sap.ui.define(["./utils", "../../utils/version"], function (___utils, ____utils_
|
|
|
133
131
|
* @param reuseComponentsIds ids of reuse components that are filled when outline nodes are transformed
|
|
134
132
|
* @param node view node
|
|
135
133
|
* @param scenario type of project
|
|
136
|
-
* @param
|
|
134
|
+
* @param ui5VersionInfo UI5 version information
|
|
137
135
|
*/
|
|
138
|
-
function fillReuseComponents(reuseComponentsIds, node, scenario,
|
|
139
|
-
if (scenario === 'ADAPTATION_PROJECT' && node?.component && isReuseComponent(node.id,
|
|
136
|
+
function fillReuseComponents(reuseComponentsIds, node, scenario, ui5VersionInfo) {
|
|
137
|
+
if (scenario === 'ADAPTATION_PROJECT' && node?.component && isReuseComponent(node.id, ui5VersionInfo)) {
|
|
140
138
|
reuseComponentsIds.add(node.id);
|
|
141
139
|
}
|
|
142
140
|
}
|
|
@@ -2,7 +2,7 @@ import type { OutlineNode } from '@sap-ux-private/control-property-editor-common
|
|
|
2
2
|
import type { OutlineViewNode } from 'sap/ui/rta/command/OutlineService';
|
|
3
3
|
import type { Scenario } from 'sap/ui/fl/Scenario';
|
|
4
4
|
import { isEditable, isReuseComponent } from './utils';
|
|
5
|
-
import { getUi5Version } from '../../utils/version';
|
|
5
|
+
import { getUi5Version, Ui5VersionInfo } from '../../utils/version';
|
|
6
6
|
|
|
7
7
|
interface AdditionalData {
|
|
8
8
|
text?: string;
|
|
@@ -87,9 +87,7 @@ export async function transformNodes(
|
|
|
87
87
|
): Promise<OutlineNode[]> {
|
|
88
88
|
const stack = [...input];
|
|
89
89
|
const items: OutlineNode[] = [];
|
|
90
|
-
const
|
|
91
|
-
const versionParts = version.split('.');
|
|
92
|
-
const minor = parseInt(versionParts[1], 10);
|
|
90
|
+
const ui5VersionInfo = await getUi5Version();
|
|
93
91
|
while (stack.length) {
|
|
94
92
|
const current = stack.shift();
|
|
95
93
|
const editable = isEditable(current?.id);
|
|
@@ -114,7 +112,7 @@ export async function transformNodes(
|
|
|
114
112
|
children: transformedChildren
|
|
115
113
|
};
|
|
116
114
|
|
|
117
|
-
fillReuseComponents(reuseComponentsIds, current, scenario,
|
|
115
|
+
fillReuseComponents(reuseComponentsIds, current, scenario, ui5VersionInfo);
|
|
118
116
|
|
|
119
117
|
items.push(node);
|
|
120
118
|
}
|
|
@@ -150,15 +148,15 @@ export async function transformNodes(
|
|
|
150
148
|
* @param reuseComponentsIds ids of reuse components that are filled when outline nodes are transformed
|
|
151
149
|
* @param node view node
|
|
152
150
|
* @param scenario type of project
|
|
153
|
-
* @param
|
|
151
|
+
* @param ui5VersionInfo UI5 version information
|
|
154
152
|
*/
|
|
155
153
|
function fillReuseComponents(
|
|
156
154
|
reuseComponentsIds: Set<string>,
|
|
157
155
|
node: OutlineViewNode,
|
|
158
156
|
scenario: Scenario,
|
|
159
|
-
|
|
157
|
+
ui5VersionInfo: Ui5VersionInfo
|
|
160
158
|
): void {
|
|
161
|
-
if (scenario === 'ADAPTATION_PROJECT' && node?.component && isReuseComponent(node.id,
|
|
159
|
+
if (scenario === 'ADAPTATION_PROJECT' && node?.component && isReuseComponent(node.id, ui5VersionInfo)) {
|
|
162
160
|
reuseComponentsIds.add(node.id);
|
|
163
161
|
}
|
|
164
162
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
sap.ui.define(["../control-data", "../utils", "sap/ui/dt/OverlayUtil", "sap/ui/dt/OverlayRegistry", "../ui5-utils", "sap/ui/core/Component"], function (___control_data, ___utils, OverlayUtil, OverlayRegistry, ___ui5_utils, Component) {
|
|
3
|
+
sap.ui.define(["../control-data", "../utils", "sap/ui/dt/OverlayUtil", "sap/ui/dt/OverlayRegistry", "../ui5-utils", "sap/ui/core/Component", "../../utils/version"], function (___control_data, ___utils, OverlayUtil, OverlayRegistry, ___ui5_utils, Component, ____utils_version) {
|
|
4
4
|
"use strict";
|
|
5
5
|
|
|
6
6
|
const buildControlData = ___control_data["buildControlData"];
|
|
7
7
|
const getRuntimeControl = ___utils["getRuntimeControl"];
|
|
8
8
|
const getComponent = ___ui5_utils["getComponent"];
|
|
9
|
+
const isLowerThanMinimalUi5Version = ____utils_version["isLowerThanMinimalUi5Version"];
|
|
9
10
|
const isEditable = function () {
|
|
10
11
|
let id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
11
12
|
let editable = false;
|
|
@@ -35,11 +36,14 @@ sap.ui.define(["../control-data", "../utils", "sap/ui/dt/OverlayUtil", "sap/ui/d
|
|
|
35
36
|
* Function that checks if control is reuse component
|
|
36
37
|
*
|
|
37
38
|
* @param controlId id control
|
|
38
|
-
* @param
|
|
39
|
+
* @param ui5VersionInfo UI5 version information
|
|
39
40
|
* @returns boolean if control is from reused component view
|
|
40
41
|
*/
|
|
41
|
-
const isReuseComponent = (controlId,
|
|
42
|
-
if (
|
|
42
|
+
const isReuseComponent = (controlId, ui5VersionInfo) => {
|
|
43
|
+
if (isLowerThanMinimalUi5Version(ui5VersionInfo, {
|
|
44
|
+
major: 1,
|
|
45
|
+
minor: 115
|
|
46
|
+
})) {
|
|
43
47
|
return false;
|
|
44
48
|
}
|
|
45
49
|
const component = Component.getComponentById(controlId);
|
|
@@ -5,6 +5,7 @@ import OverlayRegistry from 'sap/ui/dt/OverlayRegistry';
|
|
|
5
5
|
import { getComponent } from '../ui5-utils';
|
|
6
6
|
import Component from 'sap/ui/core/Component';
|
|
7
7
|
import { Manifest } from 'sap/ui/rta/RuntimeAuthoring';
|
|
8
|
+
import { isLowerThanMinimalUi5Version, Ui5VersionInfo } from '../../utils/version';
|
|
8
9
|
|
|
9
10
|
export const isEditable = (id = ''): boolean => {
|
|
10
11
|
let editable = false;
|
|
@@ -34,11 +35,11 @@ export const isEditable = (id = ''): boolean => {
|
|
|
34
35
|
* Function that checks if control is reuse component
|
|
35
36
|
*
|
|
36
37
|
* @param controlId id control
|
|
37
|
-
* @param
|
|
38
|
+
* @param ui5VersionInfo UI5 version information
|
|
38
39
|
* @returns boolean if control is from reused component view
|
|
39
40
|
*/
|
|
40
|
-
export const isReuseComponent = (controlId: string,
|
|
41
|
-
if(
|
|
41
|
+
export const isReuseComponent = (controlId: string, ui5VersionInfo: Ui5VersionInfo): boolean => {
|
|
42
|
+
if (isLowerThanMinimalUi5Version(ui5VersionInfo, { major: 1, minor: 115 })) {
|
|
42
43
|
return false;
|
|
43
44
|
}
|
|
44
45
|
|
|
@@ -48,7 +49,7 @@ export const isReuseComponent = (controlId: string, minorUI5Version: number): bo
|
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
const manifest = component.getManifest() as Manifest;
|
|
51
|
-
if(!manifest) {
|
|
52
|
+
if (!manifest) {
|
|
52
53
|
return false;
|
|
53
54
|
}
|
|
54
55
|
|
|
@@ -6,6 +6,7 @@ sap.ui.define(["sap/base/util/merge", "sap/ui/fl/write/api/connectors/ObjectStor
|
|
|
6
6
|
const CHANGES_API_PATH = ___common["CHANGES_API_PATH"];
|
|
7
7
|
const getFlexSettings = ___common["getFlexSettings"];
|
|
8
8
|
const getUi5Version = ___utils_version["getUi5Version"];
|
|
9
|
+
const isLowerThanMinimalUi5Version = ___utils_version["isLowerThanMinimalUi5Version"];
|
|
9
10
|
const connector = merge({}, ObjectStorageConnector, {
|
|
10
11
|
layers: [Layer.VENDOR, Layer.CUSTOMER_BASE],
|
|
11
12
|
storage: {
|
|
@@ -69,9 +70,10 @@ sap.ui.define(["sap/base/util/merge", "sap/ui/fl/write/api/connectors/ObjectStor
|
|
|
69
70
|
},
|
|
70
71
|
loadFeatures: async function () {
|
|
71
72
|
const features = await ObjectStorageConnector.loadFeatures();
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
features.isVariantAdaptationEnabled = !isLowerThanMinimalUi5Version(await getUi5Version(), {
|
|
74
|
+
major: 1,
|
|
75
|
+
minor: 90
|
|
76
|
+
});
|
|
75
77
|
const settings = getFlexSettings();
|
|
76
78
|
if (settings?.developerMode) {
|
|
77
79
|
features.isVariantAdaptationEnabled = false;
|
|
@@ -2,7 +2,7 @@ import merge from 'sap/base/util/merge';
|
|
|
2
2
|
import ObjectStorageConnector from 'sap/ui/fl/write/api/connectors/ObjectStorageConnector';
|
|
3
3
|
import Layer from 'sap/ui/fl/Layer';
|
|
4
4
|
import { CHANGES_API_PATH, FlexChange, getFlexSettings } from './common';
|
|
5
|
-
import { getUi5Version } from '../utils/version';
|
|
5
|
+
import { getUi5Version, isLowerThanMinimalUi5Version } from '../utils/version';
|
|
6
6
|
|
|
7
7
|
const connector = merge({}, ObjectStorageConnector, {
|
|
8
8
|
layers: [Layer.VENDOR, Layer.CUSTOMER_BASE],
|
|
@@ -68,9 +68,10 @@ const connector = merge({}, ObjectStorageConnector, {
|
|
|
68
68
|
} as typeof ObjectStorageConnector.storage,
|
|
69
69
|
loadFeatures: async function () {
|
|
70
70
|
const features = await ObjectStorageConnector.loadFeatures();
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
features.isVariantAdaptationEnabled = !isLowerThanMinimalUi5Version(await getUi5Version(), {
|
|
72
|
+
major: 1,
|
|
73
|
+
minor: 90
|
|
74
|
+
});
|
|
74
75
|
const settings = getFlexSettings();
|
|
75
76
|
if (settings?.developerMode) {
|
|
76
77
|
features.isVariantAdaptationEnabled = false;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment,
|
|
2
2
|
@typescript-eslint/no-unsafe-member-access,
|
|
3
|
-
@typescript-eslint/no-unsafe-assignment,
|
|
4
3
|
@typescript-eslint/no-unsafe-argument,
|
|
5
4
|
no-console */
|
|
6
5
|
|
|
@@ -15,9 +14,9 @@ async function ushellBootstrap(fnCallback) {
|
|
|
15
14
|
try {
|
|
16
15
|
const response = await fetch(`${basePath}/resources/sap-ui-version.json`);
|
|
17
16
|
const json = await response.json();
|
|
18
|
-
const version = json?.libraries?.find((lib) => lib.name === 'sap.ui.core')?.version;
|
|
19
|
-
const
|
|
20
|
-
if (
|
|
17
|
+
const version = json?.libraries?.find((lib) => lib.name === 'sap.ui.core')?.version ?? '1.121.0';
|
|
18
|
+
const majorUi5Version = parseInt(version.split('.')[0], 10);
|
|
19
|
+
if (majorUi5Version >= 2) {
|
|
21
20
|
src = `${basePath}/resources/sap/ushell/bootstrap/sandbox2.js`;
|
|
22
21
|
}
|
|
23
22
|
} catch (error) {
|
package/dist/client/flp/init.js
CHANGED
|
@@ -18,6 +18,7 @@ sap.ui.define([
|
|
|
18
18
|
const getError = ___cpe_error_utils['getError'];
|
|
19
19
|
const initConnectors = _interopRequireDefault(__initConnectors);
|
|
20
20
|
const getUi5Version = ___utils_version['getUi5Version'];
|
|
21
|
+
const isLowerThanMinimalUi5Version = ___utils_version['isLowerThanMinimalUi5Version'];
|
|
21
22
|
const UI5_LIBS = [
|
|
22
23
|
'sap.apf',
|
|
23
24
|
'sap.base',
|
|
@@ -160,22 +161,24 @@ sap.ui.define([
|
|
|
160
161
|
const urlParams = new URLSearchParams(window.location.search);
|
|
161
162
|
const container = sap?.ushell?.Container ?? sap.ui.require('sap/ushell/Container');
|
|
162
163
|
let scenario = '';
|
|
163
|
-
const
|
|
164
|
+
const ui5VersionInfo = await getUi5Version();
|
|
164
165
|
if (flex) {
|
|
165
166
|
const flexSettings = JSON.parse(flex);
|
|
166
167
|
scenario = flexSettings.scenario;
|
|
167
168
|
container.attachRendererCreatedEvent(async function () {
|
|
168
169
|
const lifecycleService = await container.getServiceAsync('AppLifeCycle');
|
|
169
170
|
lifecycleService.attachAppLoaded(event => {
|
|
170
|
-
const minor = parseInt(version.split('.')[1], 10);
|
|
171
171
|
const view = event.getParameter('componentInstance');
|
|
172
172
|
const flexSettings = JSON.parse(flex);
|
|
173
173
|
const pluginScript = flexSettings.pluginScript ?? '';
|
|
174
174
|
let libs = [];
|
|
175
|
-
if (
|
|
176
|
-
|
|
177
|
-
|
|
175
|
+
if (isLowerThanMinimalUi5Version(ui5VersionInfo, {
|
|
176
|
+
major: 1,
|
|
177
|
+
minor: 72
|
|
178
|
+
})) {
|
|
178
179
|
libs.push('open/ux/preview/client/flp/initRta');
|
|
180
|
+
} else {
|
|
181
|
+
libs.push('sap/ui/rta/api/startAdaptation');
|
|
179
182
|
}
|
|
180
183
|
if (flexSettings.pluginScript) {
|
|
181
184
|
libs.push(pluginScript);
|
|
@@ -205,8 +208,7 @@ sap.ui.define([
|
|
|
205
208
|
const resourceBundle = await loadI18nResourceBundle(scenario);
|
|
206
209
|
setI18nTitle(resourceBundle);
|
|
207
210
|
registerSAPFonts();
|
|
208
|
-
const
|
|
209
|
-
const renderer = major < 2 ? await container.createRenderer(undefined, true) : await container.createRendererInternal(undefined, true);
|
|
211
|
+
const renderer = ui5VersionInfo.major < 2 ? await container.createRenderer(undefined, true) : await container.createRendererInternal(undefined, true);
|
|
210
212
|
renderer.placeAt('content');
|
|
211
213
|
}
|
|
212
214
|
const bootstrapConfig = document.getElementById('sap-ui-bootstrap');
|
package/dist/client/flp/init.ts
CHANGED
|
@@ -9,7 +9,7 @@ import AppState from 'sap/ushell/services/AppState';
|
|
|
9
9
|
import { getManifestAppdescr } from '../adp/api-handler';
|
|
10
10
|
import { getError } from '../cpe/error-utils';
|
|
11
11
|
import initConnectors from './initConnectors';
|
|
12
|
-
import { getUi5Version } from '../utils/version';
|
|
12
|
+
import { getUi5Version, isLowerThanMinimalUi5Version } from '../utils/version';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* SAPUI5 delivered namespaces from https://ui5.sap.com/#/api/sap
|
|
@@ -269,7 +269,7 @@ export async function init({
|
|
|
269
269
|
const urlParams = new URLSearchParams(window.location.search);
|
|
270
270
|
const container = sap?.ushell?.Container ?? sap.ui.require('sap/ushell/Container');
|
|
271
271
|
let scenario: string = '';
|
|
272
|
-
const
|
|
272
|
+
const ui5VersionInfo = await getUi5Version();
|
|
273
273
|
// Register RTA if configured
|
|
274
274
|
if (flex) {
|
|
275
275
|
const flexSettings = JSON.parse(flex) as FlexSettings;
|
|
@@ -277,16 +277,16 @@ export async function init({
|
|
|
277
277
|
container.attachRendererCreatedEvent(async function () {
|
|
278
278
|
const lifecycleService = await container.getServiceAsync<AppLifeCycle>('AppLifeCycle');
|
|
279
279
|
lifecycleService.attachAppLoaded((event) => {
|
|
280
|
-
const minor = parseInt(version.split('.')[1], 10);
|
|
281
280
|
const view = event.getParameter('componentInstance');
|
|
282
281
|
const flexSettings = JSON.parse(flex) as FlexSettings;
|
|
283
282
|
const pluginScript = flexSettings.pluginScript ?? '';
|
|
284
283
|
|
|
285
284
|
let libs: string[] = [];
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
} else {
|
|
285
|
+
|
|
286
|
+
if (isLowerThanMinimalUi5Version(ui5VersionInfo, { major: 1, minor: 72 })) {
|
|
289
287
|
libs.push('open/ux/preview/client/flp/initRta');
|
|
288
|
+
} else {
|
|
289
|
+
libs.push('sap/ui/rta/api/startAdaptation');
|
|
290
290
|
}
|
|
291
291
|
|
|
292
292
|
if (flexSettings.pluginScript) {
|
|
@@ -332,10 +332,9 @@ export async function init({
|
|
|
332
332
|
const resourceBundle = await loadI18nResourceBundle(scenario as Scenario);
|
|
333
333
|
setI18nTitle(resourceBundle);
|
|
334
334
|
registerSAPFonts();
|
|
335
|
-
const major = version ? parseInt(version.split('.')[0], 10) : 2;
|
|
336
335
|
|
|
337
336
|
const renderer =
|
|
338
|
-
major < 2
|
|
337
|
+
ui5VersionInfo.major < 2
|
|
339
338
|
? await container.createRenderer(undefined, true)
|
|
340
339
|
: await container.createRendererInternal(undefined, true);
|
|
341
340
|
renderer.placeAt('content');
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
sap.ui.define(["
|
|
3
|
+
sap.ui.define(["../utils/version"], function (___utils_version) {
|
|
4
4
|
"use strict";
|
|
5
5
|
|
|
6
|
+
const getUi5Version = ___utils_version["getUi5Version"];
|
|
7
|
+
const isLowerThanMinimalUi5Version = ___utils_version["isLowerThanMinimalUi5Version"];
|
|
6
8
|
/**
|
|
7
9
|
* Initializes UI5 connectors based on the current UI5 version.
|
|
8
10
|
*
|
|
@@ -14,13 +16,10 @@ sap.ui.define(["sap/ui/VersionInfo"], function (VersionInfo) {
|
|
|
14
16
|
* intiConnectors(); // Simply call the function without any arguments.
|
|
15
17
|
*/
|
|
16
18
|
async function initConnectors() {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const minor = parseInt(versionArray[1], 10);
|
|
22
|
-
const major = parseInt(versionArray[0], 10);
|
|
23
|
-
if (major === 1 && minor < 72) {
|
|
19
|
+
if (isLowerThanMinimalUi5Version(await getUi5Version(), {
|
|
20
|
+
major: 1,
|
|
21
|
+
minor: 72
|
|
22
|
+
})) {
|
|
24
23
|
sap.ui.require(['open/ux/preview/client/flp/enableFakeConnector'], function (enableFakeConnector) {
|
|
25
24
|
enableFakeConnector();
|
|
26
25
|
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {SingleVersionInfo} from '../../types/global';
|
|
1
|
+
import { getUi5Version, isLowerThanMinimalUi5Version } from '../utils/version';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* Initializes UI5 connectors based on the current UI5 version.
|
|
@@ -12,12 +11,7 @@ import type {SingleVersionInfo} from '../../types/global';
|
|
|
12
11
|
* intiConnectors(); // Simply call the function without any arguments.
|
|
13
12
|
*/
|
|
14
13
|
export default async function initConnectors(): Promise<void> {
|
|
15
|
-
|
|
16
|
-
const versionArray = version ? version.split('.') : ['2', '99'];
|
|
17
|
-
const minor = parseInt(versionArray[1], 10);
|
|
18
|
-
const major = parseInt(versionArray[0], 10);
|
|
19
|
-
|
|
20
|
-
if (major === 1 && minor < 72) {
|
|
14
|
+
if (isLowerThanMinimalUi5Version(await getUi5Version(), { major: 1, minor: 72 })) {
|
|
21
15
|
sap.ui.require(['open/ux/preview/client/flp/enableFakeConnector'], function (enableFakeConnector: () => void) {
|
|
22
16
|
enableFakeConnector();
|
|
23
17
|
});
|
|
@@ -3,8 +3,18 @@
|
|
|
3
3
|
sap.ui.define(["sap/ui/VersionInfo", "sap/base/Log"], function (VersionInfo, Log) {
|
|
4
4
|
"use strict";
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Default minimal supported UI5 version
|
|
8
|
+
*/
|
|
9
|
+
const minVersionInfo = {
|
|
10
|
+
major: 1,
|
|
11
|
+
minor: 71
|
|
12
|
+
};
|
|
13
|
+
|
|
6
14
|
/**
|
|
7
15
|
* Retrieve the UI5 version from sap.ui.core library
|
|
16
|
+
*
|
|
17
|
+
* @returns Ui5VersionInfo
|
|
8
18
|
*/
|
|
9
19
|
async function getUi5Version() {
|
|
10
20
|
let version = (await VersionInfo.load({
|
|
@@ -14,12 +24,47 @@ sap.ui.define(["sap/ui/VersionInfo", "sap/base/Log"], function (VersionInfo, Log
|
|
|
14
24
|
Log.error('Could not get UI5 version of application. Using 1.121.0 as fallback.');
|
|
15
25
|
version = '1.121.0';
|
|
16
26
|
}
|
|
17
|
-
|
|
27
|
+
const [major, minor] = version.split('.').map(versionPart => parseInt(versionPart, 10));
|
|
28
|
+
return {
|
|
29
|
+
major: major,
|
|
30
|
+
minor: minor
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Checks if the given version is lower than the required minimal version.
|
|
36
|
+
* @param ui5VersionInfo to check
|
|
37
|
+
* @param minUi5VersionInfo to check against (default is 1.71)
|
|
38
|
+
*
|
|
39
|
+
* @returns boolean
|
|
40
|
+
*/
|
|
41
|
+
function isLowerThanMinimalUi5Version(ui5VersionInfo) {
|
|
42
|
+
let minUi5VersionInfo = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minVersionInfo;
|
|
43
|
+
if (!isNaN(ui5VersionInfo.major) && !isNaN(ui5VersionInfo.minor)) {
|
|
44
|
+
if (ui5VersionInfo.major < minUi5VersionInfo.major) {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
if (ui5VersionInfo.major === minUi5VersionInfo.major && ui5VersionInfo.minor < minUi5VersionInfo.minor) {
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Get UI5 version validation message.
|
|
56
|
+
* @param ui5VersionInfo to be mentioned in the message
|
|
57
|
+
* @returns string with validation message.
|
|
58
|
+
*/
|
|
59
|
+
function getUI5VersionValidationMessage(ui5VersionInfo) {
|
|
60
|
+
return `The current SAPUI5 version set for this Adaptation project is ${ui5VersionInfo.major}.${ui5VersionInfo.minor}. The minimum version to use for SAPUI5 Adaptation Project and its SAPUI5 Visual Editor is ${minVersionInfo.major}.${minVersionInfo.minor}`;
|
|
18
61
|
}
|
|
19
62
|
var __exports = {
|
|
20
63
|
__esModule: true
|
|
21
64
|
};
|
|
22
65
|
__exports.getUi5Version = getUi5Version;
|
|
66
|
+
__exports.isLowerThanMinimalUi5Version = isLowerThanMinimalUi5Version;
|
|
67
|
+
__exports.getUI5VersionValidationMessage = getUI5VersionValidationMessage;
|
|
23
68
|
return __exports;
|
|
24
69
|
});
|
|
25
70
|
//# sourceMappingURL=version.js.map
|
|
@@ -1,15 +1,75 @@
|
|
|
1
|
-
import type { SingleVersionInfo } from '../../types/global';
|
|
2
1
|
import VersionInfo from 'sap/ui/VersionInfo';
|
|
3
2
|
import Log from 'sap/base/Log';
|
|
4
3
|
|
|
4
|
+
type SingleVersionInfo =
|
|
5
|
+
| {
|
|
6
|
+
name: string;
|
|
7
|
+
version: string;
|
|
8
|
+
}
|
|
9
|
+
| undefined;
|
|
10
|
+
|
|
11
|
+
export type Ui5VersionInfo = {
|
|
12
|
+
major: number;
|
|
13
|
+
minor: number;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Default minimal supported UI5 version
|
|
18
|
+
*/
|
|
19
|
+
const minVersionInfo = {
|
|
20
|
+
major: 1,
|
|
21
|
+
minor: 71
|
|
22
|
+
} as Readonly<Ui5VersionInfo>;
|
|
23
|
+
|
|
5
24
|
/**
|
|
6
25
|
* Retrieve the UI5 version from sap.ui.core library
|
|
26
|
+
*
|
|
27
|
+
* @returns Ui5VersionInfo
|
|
7
28
|
*/
|
|
8
|
-
export async function getUi5Version() {
|
|
29
|
+
export async function getUi5Version(): Promise<Ui5VersionInfo> {
|
|
9
30
|
let version = ((await VersionInfo.load({ library: 'sap.ui.core' })) as SingleVersionInfo)?.version;
|
|
10
31
|
if (!version) {
|
|
11
32
|
Log.error('Could not get UI5 version of application. Using 1.121.0 as fallback.');
|
|
12
33
|
version = '1.121.0';
|
|
13
34
|
}
|
|
14
|
-
|
|
35
|
+
const [major, minor] = version.split('.').map(versionPart => parseInt(versionPart, 10));
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
major: major,
|
|
39
|
+
minor: minor
|
|
40
|
+
} satisfies Ui5VersionInfo;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Checks if the given version is lower than the required minimal version.
|
|
45
|
+
* @param ui5VersionInfo to check
|
|
46
|
+
* @param minUi5VersionInfo to check against (default is 1.71)
|
|
47
|
+
*
|
|
48
|
+
* @returns boolean
|
|
49
|
+
*/
|
|
50
|
+
export function isLowerThanMinimalUi5Version(
|
|
51
|
+
ui5VersionInfo: Ui5VersionInfo,
|
|
52
|
+
minUi5VersionInfo: Ui5VersionInfo = minVersionInfo
|
|
53
|
+
): boolean {
|
|
54
|
+
if (!isNaN(ui5VersionInfo.major) && !isNaN(ui5VersionInfo.minor)) {
|
|
55
|
+
if (ui5VersionInfo.major < minUi5VersionInfo.major) {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
if (
|
|
59
|
+
ui5VersionInfo.major === minUi5VersionInfo.major &&
|
|
60
|
+
ui5VersionInfo.minor < minUi5VersionInfo.minor
|
|
61
|
+
) {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Get UI5 version validation message.
|
|
70
|
+
* @param ui5VersionInfo to be mentioned in the message
|
|
71
|
+
* @returns string with validation message.
|
|
72
|
+
*/
|
|
73
|
+
export function getUI5VersionValidationMessage(ui5VersionInfo: Ui5VersionInfo): string {
|
|
74
|
+
return `The current SAPUI5 version set for this Adaptation project is ${ui5VersionInfo.major}.${ui5VersionInfo.minor}. The minimum version to use for SAPUI5 Adaptation Project and its SAPUI5 Visual Editor is ${minVersionInfo.major}.${minVersionInfo.minor}`;
|
|
15
75
|
}
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"bugs": {
|
|
10
10
|
"url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Apreview-middleware"
|
|
11
11
|
},
|
|
12
|
-
"version": "0.16.
|
|
12
|
+
"version": "0.16.51",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"mem-fs-editor": "9.4.0",
|
|
28
28
|
"@sap-ux/logger": "0.6.0",
|
|
29
29
|
"@sap-ux/btp-utils": "0.15.1",
|
|
30
|
-
"@sap-ux/adp-tooling": "0.12.
|
|
30
|
+
"@sap-ux/adp-tooling": "0.12.39",
|
|
31
31
|
"@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.4.27",
|
|
32
|
-
"@sap-ux/project-access": "1.26.
|
|
32
|
+
"@sap-ux/project-access": "1.26.8"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/ejs": "3.1.2",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"supertest": "6.3.3",
|
|
46
46
|
"@sap-ux-private/playwright": "0.1.0",
|
|
47
47
|
"dotenv": "16.3.1",
|
|
48
|
-
"@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.10.
|
|
48
|
+
"@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.10.8",
|
|
49
49
|
"@sap-ux/axios-extension": "1.16.4",
|
|
50
50
|
"@sap-ux/store": "0.9.1",
|
|
51
51
|
"@sap-ux/ui5-info": "0.8.1",
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define([], function () {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Parses the UI5 version
|
|
8
|
-
* Returns NaN for snapshot or snapshot-untested
|
|
9
|
-
* Returns x.xx for snapshot-x.xx
|
|
10
|
-
*
|
|
11
|
-
* @param version the UI5 version to parse
|
|
12
|
-
* @returns The major and the minor version, e.g. 1.86
|
|
13
|
-
*/
|
|
14
|
-
function parseUI5Version(version) {
|
|
15
|
-
const versionParts = version.replace(/snapshot-untested|snapshot-|snapshot/, '').split('.');
|
|
16
|
-
const major = parseInt(versionParts[0], 10);
|
|
17
|
-
const minor = parseInt(versionParts[1], 10);
|
|
18
|
-
return {
|
|
19
|
-
major,
|
|
20
|
-
minor
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Checks if the given version is lower than the required minimal version.
|
|
26
|
-
* @param version to check
|
|
27
|
-
* @param minVersion to check
|
|
28
|
-
*
|
|
29
|
-
* @returns boolean
|
|
30
|
-
*/
|
|
31
|
-
function isLowerThanMinimalUi5Version(version, minVersion) {
|
|
32
|
-
if (version && minVersion) {
|
|
33
|
-
const minVersionParsed = parseUI5Version(minVersion);
|
|
34
|
-
const ui5VersionParsed = parseUI5Version(version);
|
|
35
|
-
if (!isNaN(ui5VersionParsed.major) && !isNaN(ui5VersionParsed.minor)) {
|
|
36
|
-
if (ui5VersionParsed.major < minVersionParsed.major) {
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
if (ui5VersionParsed.major === minVersionParsed.major && ui5VersionParsed.minor < minVersionParsed.minor) {
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Get UI5 version validation message based on conditions.
|
|
49
|
-
* @param ui5Version to validate
|
|
50
|
-
* @returns string with validation message or undefined if non condition is met.
|
|
51
|
-
*/
|
|
52
|
-
function getUI5VersionValidationMessage(ui5Version) {
|
|
53
|
-
if (isLowerThanMinimalUi5Version(ui5Version, '1.71')) {
|
|
54
|
-
return `The current SAPUI5 version set for this Adaptation project is ${ui5Version}. The minimum version to use for SAPUI5 Adaptation Project and its SAPUI5 Visual Editor is 1.71`;
|
|
55
|
-
}
|
|
56
|
-
return undefined;
|
|
57
|
-
}
|
|
58
|
-
var __exports = {
|
|
59
|
-
__esModule: true
|
|
60
|
-
};
|
|
61
|
-
__exports.isLowerThanMinimalUi5Version = isLowerThanMinimalUi5Version;
|
|
62
|
-
__exports.getUI5VersionValidationMessage = getUI5VersionValidationMessage;
|
|
63
|
-
return __exports;
|
|
64
|
-
});
|
|
65
|
-
//# sourceMappingURL=ui5-version-utils.js.map
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parses the UI5 version
|
|
3
|
-
* Returns NaN for snapshot or snapshot-untested
|
|
4
|
-
* Returns x.xx for snapshot-x.xx
|
|
5
|
-
*
|
|
6
|
-
* @param version the UI5 version to parse
|
|
7
|
-
* @returns The major and the minor version, e.g. 1.86
|
|
8
|
-
*/
|
|
9
|
-
function parseUI5Version(version: string): { major: number; minor: number } {
|
|
10
|
-
const versionParts = version.replace(/snapshot-untested|snapshot-|snapshot/, '').split('.');
|
|
11
|
-
const major = parseInt(versionParts[0], 10);
|
|
12
|
-
const minor = parseInt(versionParts[1], 10);
|
|
13
|
-
|
|
14
|
-
return { major, minor };
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Checks if the given version is lower than the required minimal version.
|
|
19
|
-
* @param version to check
|
|
20
|
-
* @param minVersion to check
|
|
21
|
-
*
|
|
22
|
-
* @returns boolean
|
|
23
|
-
*/
|
|
24
|
-
export function isLowerThanMinimalUi5Version(version: string, minVersion: string): boolean {
|
|
25
|
-
if (version && minVersion) {
|
|
26
|
-
const minVersionParsed = parseUI5Version(minVersion);
|
|
27
|
-
const ui5VersionParsed = parseUI5Version(version);
|
|
28
|
-
if (!isNaN(ui5VersionParsed.major) && !isNaN(ui5VersionParsed.minor)) {
|
|
29
|
-
if (ui5VersionParsed.major < minVersionParsed.major) {
|
|
30
|
-
return true;
|
|
31
|
-
}
|
|
32
|
-
if (ui5VersionParsed.major === minVersionParsed.major && ui5VersionParsed.minor < minVersionParsed.minor) {
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Get UI5 version validation message based on conditions.
|
|
42
|
-
* @param ui5Version to validate
|
|
43
|
-
* @returns string with validation message or undefined if non condition is met.
|
|
44
|
-
*/
|
|
45
|
-
export function getUI5VersionValidationMessage(ui5Version: string): string | undefined {
|
|
46
|
-
if (isLowerThanMinimalUi5Version(ui5Version, '1.71')) {
|
|
47
|
-
return `The current SAPUI5 version set for this Adaptation project is ${ui5Version}. The minimum version to use for SAPUI5 Adaptation Project and its SAPUI5 Visual Editor is 1.71`;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return undefined;
|
|
51
|
-
}
|
|
52
|
-
|