@sap-ux/preview-middleware 0.16.50 → 0.16.52
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/api-handler.js +2 -2
- package/dist/client/adp/api-handler.ts +1 -1
- package/dist/client/adp/command-executor.js +2 -2
- package/dist/client/adp/command-executor.ts +1 -1
- package/dist/client/adp/controllers/BaseDialog.controller.js +2 -2
- package/dist/client/adp/controllers/BaseDialog.controller.ts +1 -1
- package/dist/client/adp/init-dialogs.js +10 -10
- package/dist/client/adp/init-dialogs.ts +11 -10
- package/dist/client/adp/init.js +19 -16
- package/dist/client/adp/init.ts +16 -16
- package/dist/client/cpe/changes/service.js +3 -3
- package/dist/client/cpe/changes/service.ts +1 -1
- package/dist/client/cpe/connector-service.js +8 -7
- package/dist/client/cpe/connector-service.ts +5 -8
- package/dist/client/cpe/init.js +3 -3
- package/dist/client/cpe/init.ts +1 -1
- package/dist/client/cpe/outline/index.js +3 -3
- package/dist/client/cpe/outline/index.ts +3 -3
- 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/cpe/selection.js +3 -3
- package/dist/client/cpe/selection.ts +1 -1
- 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 +12 -10
- package/dist/client/flp/init.ts +8 -9
- package/dist/client/flp/initConnectors.js +7 -8
- package/dist/client/flp/initConnectors.ts +2 -8
- package/dist/client/{cpe/error-utils.js → utils/error.js} +1 -1
- 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
- /package/dist/client/{cpe/error-utils.ts → utils/error.ts} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
sap.ui.define(["../
|
|
3
|
+
sap.ui.define(["../utils/error"], function (___utils_error) {
|
|
4
4
|
"use strict";
|
|
5
5
|
|
|
6
|
-
const getError =
|
|
6
|
+
const getError = ___utils_error["getError"];
|
|
7
7
|
var ApiEndpoints = /*#__PURE__*/function (ApiEndpoints) {
|
|
8
8
|
ApiEndpoints["CHANGES"] = "/preview/api/changes";
|
|
9
9
|
ApiEndpoints["FRAGMENT"] = "/adp/api/fragment";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
sap.ui.define(["sap/m/MessageToast", "sap/ui/rta/command/CommandFactory", "../
|
|
3
|
+
sap.ui.define(["sap/m/MessageToast", "sap/ui/rta/command/CommandFactory", "../utils/error"], function (MessageToast, CommandFactory, ___utils_error) {
|
|
4
4
|
"use strict";
|
|
5
5
|
|
|
6
|
-
const getError =
|
|
6
|
+
const getError = ___utils_error["getError"];
|
|
7
7
|
/**
|
|
8
8
|
* Class responsible for handling rta calls
|
|
9
9
|
*/
|
|
@@ -5,7 +5,7 @@ import type RuntimeAuthoring from 'sap/ui/rta/RuntimeAuthoring';
|
|
|
5
5
|
import type { FlexSettings } from 'sap/ui/rta/RuntimeAuthoring';
|
|
6
6
|
import type DesignTimeMetadata from 'sap/ui/dt/DesignTimeMetadata';
|
|
7
7
|
import type FlexCommand from 'sap/ui/rta/command/FlexCommand';
|
|
8
|
-
import { getError } from '../
|
|
8
|
+
import { getError } from '../utils/error';
|
|
9
9
|
|
|
10
10
|
type CommandNames = 'addXML';
|
|
11
11
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
sap.ui.define(["sap/ui/core/library", "sap/ui/core/mvc/Controller", "sap/m/MessageToast", "../utils", "../../
|
|
3
|
+
sap.ui.define(["sap/ui/core/library", "sap/ui/core/mvc/Controller", "sap/m/MessageToast", "../utils", "../../utils/error"], function (sap_ui_core_library, Controller, MessageToast, ___utils, ____utils_error) {
|
|
4
4
|
"use strict";
|
|
5
5
|
|
|
6
6
|
const ValueState = sap_ui_core_library["ValueState"];
|
|
7
7
|
const matchesFragmentName = ___utils["matchesFragmentName"];
|
|
8
|
-
const getError =
|
|
8
|
+
const getError = ____utils_error["getError"];
|
|
9
9
|
/**
|
|
10
10
|
* @namespace open.ux.preview.client.adp.controllers
|
|
11
11
|
*/
|
|
@@ -12,7 +12,7 @@ import MessageToast from 'sap/m/MessageToast';
|
|
|
12
12
|
import CommandExecutor from '../command-executor';
|
|
13
13
|
import { matchesFragmentName } from '../utils';
|
|
14
14
|
import type { Fragments } from '../api-handler';
|
|
15
|
-
import { getError } from '../../
|
|
15
|
+
import { getError } from '../../utils/error';
|
|
16
16
|
|
|
17
17
|
type BaseDialogModel = JSONModel & {
|
|
18
18
|
getProperty(sPath: '/fragmentList'): Fragments;
|
|
@@ -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
|
-
'
|
|
8
|
-
'../cpe/error-utils',
|
|
7
|
+
'../utils/error',
|
|
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, ___utils_error, ___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
|
|
34
|
-
const getError = ___cpe_error_utils['getError'];
|
|
32
|
+
const getError = ___utils_error['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
|
-
import { getError } from '../
|
|
15
|
-
import {
|
|
13
|
+
import { getError } from '../utils/error';
|
|
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) => {
|
|
@@ -4,8 +4,8 @@ sap.ui.define([
|
|
|
4
4
|
'./flex-change',
|
|
5
5
|
'sap/base/Log',
|
|
6
6
|
'../rta-service',
|
|
7
|
-
'
|
|
8
|
-
], function (___sap_ux_private_control_property_editor_common, ___flex_change, Log, ___rta_service,
|
|
7
|
+
'../../utils/error'
|
|
8
|
+
], function (___sap_ux_private_control_property_editor_common, ___flex_change, Log, ___rta_service, ____utils_error) {
|
|
9
9
|
'use strict';
|
|
10
10
|
const changeProperty = ___sap_ux_private_control_property_editor_common['changeProperty'];
|
|
11
11
|
const changeStackModified = ___sap_ux_private_control_property_editor_common['changeStackModified'];
|
|
@@ -15,7 +15,7 @@ sap.ui.define([
|
|
|
15
15
|
const reloadApplication = ___sap_ux_private_control_property_editor_common['reloadApplication'];
|
|
16
16
|
const applyChange = ___flex_change['applyChange'];
|
|
17
17
|
const modeAndStackChangeHandler = ___rta_service['modeAndStackChangeHandler'];
|
|
18
|
-
const getError =
|
|
18
|
+
const getError = ____utils_error['getError'];
|
|
19
19
|
function assertProperties(properties, target) {
|
|
20
20
|
for (const property of properties) {
|
|
21
21
|
const value = target[property];
|
|
@@ -20,7 +20,7 @@ import type Event from 'sap/ui/base/Event';
|
|
|
20
20
|
import type FlexCommand from 'sap/ui/rta/command/FlexCommand';
|
|
21
21
|
import Log from 'sap/base/Log';
|
|
22
22
|
import { modeAndStackChangeHandler } from '../rta-service';
|
|
23
|
-
import { getError } from '
|
|
23
|
+
import { getError } from '../../utils/error';
|
|
24
24
|
|
|
25
25
|
interface ChangeContent {
|
|
26
26
|
property: string;
|
|
@@ -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
|
}
|
package/dist/client/cpe/init.js
CHANGED
|
@@ -10,8 +10,8 @@ sap.ui.define([
|
|
|
10
10
|
'./ui5-utils',
|
|
11
11
|
'./connector-service',
|
|
12
12
|
'./rta-service',
|
|
13
|
-
'
|
|
14
|
-
], function (___sap_ux_private_control_property_editor_common, ___outline_index, ___selection, ___changes_service, ___documentation, Log, ___logger, ___ui5_utils, ___connector_service, ___rta_service,
|
|
13
|
+
'../utils/error'
|
|
14
|
+
], function (___sap_ux_private_control_property_editor_common, ___outline_index, ___selection, ___changes_service, ___documentation, Log, ___logger, ___ui5_utils, ___connector_service, ___rta_service, ___utils_error) {
|
|
15
15
|
'use strict';
|
|
16
16
|
const startPostMessageCommunication = ___sap_ux_private_control_property_editor_common['startPostMessageCommunication'];
|
|
17
17
|
const iconsLoaded = ___sap_ux_private_control_property_editor_common['iconsLoaded'];
|
|
@@ -25,7 +25,7 @@ sap.ui.define([
|
|
|
25
25
|
const getIcons = ___ui5_utils['getIcons'];
|
|
26
26
|
const WorkspaceConnectorService = ___connector_service['WorkspaceConnectorService'];
|
|
27
27
|
const RtaService = ___rta_service['RtaService'];
|
|
28
|
-
const getError =
|
|
28
|
+
const getError = ___utils_error['getError'];
|
|
29
29
|
function init(rta) {
|
|
30
30
|
Log.info('Initializing Control Property Editor');
|
|
31
31
|
const flexSettings = rta.getFlexSettings();
|
package/dist/client/cpe/init.ts
CHANGED
|
@@ -17,7 +17,7 @@ import { logger } from './logger';
|
|
|
17
17
|
import { getIcons } from './ui5-utils';
|
|
18
18
|
import { WorkspaceConnectorService } from './connector-service';
|
|
19
19
|
import { RtaService } from './rta-service';
|
|
20
|
-
import { getError } from '
|
|
20
|
+
import { getError } from '../utils/error';
|
|
21
21
|
|
|
22
22
|
export default function init(rta: RuntimeAuthoring): Promise<void> {
|
|
23
23
|
Log.info('Initializing Control Property Editor');
|
|
@@ -3,13 +3,13 @@ sap.ui.define([
|
|
|
3
3
|
'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
|
|
4
4
|
'./nodes',
|
|
5
5
|
'sap/base/Log',
|
|
6
|
-
'
|
|
7
|
-
], function (___sap_ux_private_control_property_editor_common, ___nodes, Log,
|
|
6
|
+
'../../utils/error'
|
|
7
|
+
], function (___sap_ux_private_control_property_editor_common, ___nodes, Log, ____utils_error) {
|
|
8
8
|
'use strict';
|
|
9
9
|
const outlineChanged = ___sap_ux_private_control_property_editor_common['outlineChanged'];
|
|
10
10
|
const showMessage = ___sap_ux_private_control_property_editor_common['showMessage'];
|
|
11
11
|
const transformNodes = ___nodes['transformNodes'];
|
|
12
|
-
const getError =
|
|
12
|
+
const getError = ____utils_error['getError'];
|
|
13
13
|
async function initOutline(rta, sendAction) {
|
|
14
14
|
const outline = await rta.getService('outline');
|
|
15
15
|
const scenario = rta.getFlexSettings().scenario;
|
|
@@ -6,7 +6,7 @@ import type OutlineService from 'sap/ui/rta/command/OutlineService';
|
|
|
6
6
|
|
|
7
7
|
import { transformNodes } from './nodes';
|
|
8
8
|
import Log from 'sap/base/Log';
|
|
9
|
-
import { getError } from '
|
|
9
|
+
import { getError } from '../../utils/error';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
*
|
|
@@ -26,8 +26,8 @@ export async function initOutline(rta: RuntimeAuthoring, sendAction: (action: Ex
|
|
|
26
26
|
if(reuseComponentsIds.size > 0 && scenario === 'ADAPTATION_PROJECT' && !hasSentWarning) {
|
|
27
27
|
sendAction(showMessage({ message: 'Have in mind that reuse components are detected for some views in this application and controller extensions and adding fragments are not supported for such views. Controller extension and adding fragment functionality on these views will be disabled.', shouldHideIframe: false}));
|
|
28
28
|
hasSentWarning = true;
|
|
29
|
-
}
|
|
30
|
-
|
|
29
|
+
}
|
|
30
|
+
|
|
31
31
|
} catch (error) {
|
|
32
32
|
Log.error('Outline sync failed!', getError(error));
|
|
33
33
|
}
|
|
@@ -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);
|