@sap-ux/preview-middleware 0.16.123 → 0.16.125
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 +3 -13
- package/dist/client/adp/init-dialogs.ts +3 -12
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.js +25 -2
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.ts +14 -1
- package/dist/client/utils/version.js +19 -2
- package/dist/client/utils/version.ts +28 -9
- package/package.json +4 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
sap.ui.define(["sap/ui/core/Fragment", "sap/ui/fl/Utils", "./controllers/AddFragment.controller", "./controllers/ControllerExtension.controller", "./controllers/ExtensionPoint.controller", "../cpe/utils", "../i18n", "./controllers/AddTableColumnFragments.controller"], function (Fragment, FlUtils, __AddFragment, __ControllerExtension, __ExtensionPoint, ___cpe_utils, ___i18n, __AddTableColumnFragments) {
|
|
3
|
+
sap.ui.define(["sap/ui/core/Fragment", "sap/ui/rta/util/hasStableId", "sap/ui/fl/Utils", "./controllers/AddFragment.controller", "./controllers/ControllerExtension.controller", "./controllers/ExtensionPoint.controller", "../cpe/utils", "../i18n", "./controllers/AddTableColumnFragments.controller"], function (Fragment, hasStableId, FlUtils, __AddFragment, __ControllerExtension, __ExtensionPoint, ___cpe_utils, ___i18n, __AddTableColumnFragments) {
|
|
4
4
|
"use strict";
|
|
5
5
|
|
|
6
6
|
function _interopRequireDefault(obj) {
|
|
@@ -62,16 +62,7 @@ sap.ui.define(["sap/ui/core/Fragment", "sap/ui/fl/Utils", "./controllers/AddFrag
|
|
|
62
62
|
return false;
|
|
63
63
|
}
|
|
64
64
|
const control = overlays[0].getElement();
|
|
65
|
-
return hasStableId(
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Determines whether control has stable id
|
|
70
|
-
* @param {ManagedObject} control - ManagedObject object representing the UI control.
|
|
71
|
-
* @returns {boolean} True if control has stable Id, false otherwise
|
|
72
|
-
*/
|
|
73
|
-
const hasStableId = control => {
|
|
74
|
-
return FlUtils.checkControlId(control);
|
|
65
|
+
return hasStableId(overlays[0]) && !isReuseComponent(control.getId(), ui5VersionInfo);
|
|
75
66
|
};
|
|
76
67
|
|
|
77
68
|
/**
|
|
@@ -81,8 +72,7 @@ sap.ui.define(["sap/ui/core/Fragment", "sap/ui/fl/Utils", "./controllers/AddFrag
|
|
|
81
72
|
* @returns {string} The text of the Add Fragment context menu item.
|
|
82
73
|
*/
|
|
83
74
|
const getAddFragmentItemText = overlay => {
|
|
84
|
-
|
|
85
|
-
if (control && !hasStableId(control)) {
|
|
75
|
+
if (!hasStableId(overlay)) {
|
|
86
76
|
return 'Add: Fragment (Unavailable due to unstable ID of the control or its parent control)';
|
|
87
77
|
}
|
|
88
78
|
return 'Add: Fragment';
|
|
@@ -7,6 +7,7 @@ import UI5Element from 'sap/ui/core/Element';
|
|
|
7
7
|
|
|
8
8
|
/** sap.ui.rta */
|
|
9
9
|
import type RuntimeAuthoring from 'sap/ui/rta/RuntimeAuthoring';
|
|
10
|
+
import hasStableId from 'sap/ui/rta/util/hasStableId';
|
|
10
11
|
|
|
11
12
|
/** sap.ui.fl */
|
|
12
13
|
import FlUtils from 'sap/ui/fl/Utils';
|
|
@@ -87,16 +88,7 @@ export const isFragmentCommandEnabled = (overlays: ElementOverlay[], ui5VersionI
|
|
|
87
88
|
|
|
88
89
|
const control = overlays[0].getElement();
|
|
89
90
|
|
|
90
|
-
return hasStableId(
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Determines whether control has stable id
|
|
95
|
-
* @param {ManagedObject} control - ManagedObject object representing the UI control.
|
|
96
|
-
* @returns {boolean} True if control has stable Id, false otherwise
|
|
97
|
-
*/
|
|
98
|
-
const hasStableId = (control: ManagedObject): boolean => {
|
|
99
|
-
return FlUtils.checkControlId(control);
|
|
91
|
+
return hasStableId(overlays[0]) && !isReuseComponent(control.getId(), ui5VersionInfo);
|
|
100
92
|
};
|
|
101
93
|
|
|
102
94
|
/**
|
|
@@ -106,8 +98,7 @@ const hasStableId = (control: ManagedObject): boolean => {
|
|
|
106
98
|
* @returns {string} The text of the Add Fragment context menu item.
|
|
107
99
|
*/
|
|
108
100
|
export const getAddFragmentItemText = (overlay: ElementOverlay) => {
|
|
109
|
-
|
|
110
|
-
if (control && !hasStableId(control)) {
|
|
101
|
+
if (!hasStableId(overlay)) {
|
|
111
102
|
return 'Add: Fragment (Unavailable due to unstable ID of the control or its parent control)';
|
|
112
103
|
}
|
|
113
104
|
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
sap.ui.define(["sap/ui/rta/command/CommandFactory", "../../../cpe/feature-service", "../../../cpe/quick-actions/utils", "../../../utils/core", "../simple-quick-action-base"], function (CommandFactory, _____cpe_feature_service, _____cpe_quick_actions_utils, _____utils_core, ___simple_quick_action_base) {
|
|
3
|
+
sap.ui.define(["sap/ui/rta/command/CommandFactory", "../../../cpe/feature-service", "../../../cpe/quick-actions/utils", "../../../utils/core", "../simple-quick-action-base", "../../../utils/version"], function (CommandFactory, _____cpe_feature_service, _____cpe_quick_actions_utils, _____utils_core, ___simple_quick_action_base, _____utils_version) {
|
|
4
4
|
"use strict";
|
|
5
5
|
|
|
6
6
|
const FeatureService = _____cpe_feature_service["FeatureService"];
|
|
7
7
|
const pageHasControlId = _____cpe_quick_actions_utils["pageHasControlId"];
|
|
8
8
|
const getControlById = _____utils_core["getControlById"];
|
|
9
9
|
const SimpleQuickActionDefinitionBase = ___simple_quick_action_base["SimpleQuickActionDefinitionBase"];
|
|
10
|
+
const getUi5Version = _____utils_version["getUi5Version"];
|
|
11
|
+
const isVersionEqualOrHasNewerPatch = _____utils_version["isVersionEqualOrHasNewerPatch"];
|
|
12
|
+
const isLowerThanMinimalUi5Version = _____utils_version["isLowerThanMinimalUi5Version"];
|
|
10
13
|
const ENABLE_SEMANTIC_DATE_RANGE_FILTER_BAR = 'enable-semantic-daterange-filterbar';
|
|
11
14
|
const CONTROL_TYPE = 'sap.ui.comp.smartfilterbar.SmartFilterBar';
|
|
12
15
|
|
|
@@ -19,7 +22,27 @@ sap.ui.define(["sap/ui/rta/command/CommandFactory", "../../../cpe/feature-servic
|
|
|
19
22
|
}
|
|
20
23
|
forceRefreshAfterExecution = true;
|
|
21
24
|
isUseDateRangeTypeEnabled = false;
|
|
22
|
-
initialize() {
|
|
25
|
+
async initialize() {
|
|
26
|
+
const version = await getUi5Version();
|
|
27
|
+
const isUI5VersionNotSupported = isLowerThanMinimalUi5Version(version, {
|
|
28
|
+
major: 1,
|
|
29
|
+
minor: 128
|
|
30
|
+
}) && !(isVersionEqualOrHasNewerPatch(version, {
|
|
31
|
+
major: 1,
|
|
32
|
+
minor: 96,
|
|
33
|
+
patch: 37
|
|
34
|
+
}) || isVersionEqualOrHasNewerPatch(version, {
|
|
35
|
+
major: 1,
|
|
36
|
+
minor: 108,
|
|
37
|
+
patch: 38
|
|
38
|
+
}) || isVersionEqualOrHasNewerPatch(version, {
|
|
39
|
+
major: 1,
|
|
40
|
+
minor: 120,
|
|
41
|
+
patch: 23
|
|
42
|
+
}));
|
|
43
|
+
if (isUI5VersionNotSupported) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
23
46
|
if (FeatureService.isFeatureEnabled('cpe.beta.quick-actions') === false) {
|
|
24
47
|
return;
|
|
25
48
|
}
|
|
@@ -8,6 +8,7 @@ import { QuickActionContext, SimpleQuickActionDefinition } from '../../../cpe/qu
|
|
|
8
8
|
import { pageHasControlId } from '../../../cpe/quick-actions/utils';
|
|
9
9
|
import { getControlById } from '../../../utils/core';
|
|
10
10
|
import { SimpleQuickActionDefinitionBase } from '../simple-quick-action-base';
|
|
11
|
+
import { getUi5Version, isVersionEqualOrHasNewerPatch, isLowerThanMinimalUi5Version } from '../../../utils/version';
|
|
11
12
|
|
|
12
13
|
export const ENABLE_SEMANTIC_DATE_RANGE_FILTER_BAR = 'enable-semantic-daterange-filterbar';
|
|
13
14
|
const CONTROL_TYPE = 'sap.ui.comp.smartfilterbar.SmartFilterBar';
|
|
@@ -25,7 +26,19 @@ export class ToggleSemanticDateRangeFilterBar
|
|
|
25
26
|
readonly forceRefreshAfterExecution = true;
|
|
26
27
|
private isUseDateRangeTypeEnabled = false;
|
|
27
28
|
|
|
28
|
-
initialize(): void {
|
|
29
|
+
async initialize(): Promise<void> {
|
|
30
|
+
const version = await getUi5Version();
|
|
31
|
+
const isUI5VersionNotSupported =
|
|
32
|
+
isLowerThanMinimalUi5Version(version, { major: 1, minor: 128 }) &&
|
|
33
|
+
!(
|
|
34
|
+
isVersionEqualOrHasNewerPatch(version, { major: 1, minor: 96, patch: 37 }) ||
|
|
35
|
+
isVersionEqualOrHasNewerPatch(version, { major: 1, minor: 108, patch: 38 }) ||
|
|
36
|
+
isVersionEqualOrHasNewerPatch(version, { major: 1, minor: 120, patch: 23 })
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
if (isUI5VersionNotSupported) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
29
42
|
if (FeatureService.isFeatureEnabled('cpe.beta.quick-actions') === false) {
|
|
30
43
|
return;
|
|
31
44
|
}
|
|
@@ -24,10 +24,11 @@ sap.ui.define(["sap/ui/VersionInfo", "sap/base/Log"], function (VersionInfo, Log
|
|
|
24
24
|
Log.error('Could not get UI5 version of application. Using 1.121.0 as fallback.');
|
|
25
25
|
version = '1.121.0';
|
|
26
26
|
}
|
|
27
|
-
const [major, minor] = version.split('.').map(versionPart => parseInt(versionPart, 10));
|
|
27
|
+
const [major, minor, patch] = version.split('.').map(versionPart => parseInt(versionPart, 10));
|
|
28
28
|
return {
|
|
29
29
|
major: major,
|
|
30
|
-
minor: minor
|
|
30
|
+
minor: minor,
|
|
31
|
+
patch: patch
|
|
31
32
|
};
|
|
32
33
|
}
|
|
33
34
|
|
|
@@ -51,6 +52,21 @@ sap.ui.define(["sap/ui/VersionInfo", "sap/base/Log"], function (VersionInfo, Log
|
|
|
51
52
|
return false;
|
|
52
53
|
}
|
|
53
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Checks if the given version is equal to the specified version.
|
|
57
|
+
* @param ui5VersionInfo to check
|
|
58
|
+
* @param targetUi5VersionInfo to check against (default is 1.71)
|
|
59
|
+
*
|
|
60
|
+
* @returns boolean
|
|
61
|
+
*/
|
|
62
|
+
function isVersionEqualOrHasNewerPatch(ui5VersionInfo) {
|
|
63
|
+
let targetUi5VersionInfo = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minVersionInfo;
|
|
64
|
+
if (!isNaN(ui5VersionInfo.major) && !isNaN(ui5VersionInfo.minor)) {
|
|
65
|
+
return ui5VersionInfo.major === targetUi5VersionInfo.major && ui5VersionInfo.minor === targetUi5VersionInfo.minor && (ui5VersionInfo?.patch ?? 0) >= (targetUi5VersionInfo?.patch ?? 0);
|
|
66
|
+
}
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
|
|
54
70
|
/**
|
|
55
71
|
* Get UI5 version validation message.
|
|
56
72
|
* @param ui5VersionInfo to be mentioned in the message
|
|
@@ -64,6 +80,7 @@ sap.ui.define(["sap/ui/VersionInfo", "sap/base/Log"], function (VersionInfo, Log
|
|
|
64
80
|
};
|
|
65
81
|
__exports.getUi5Version = getUi5Version;
|
|
66
82
|
__exports.isLowerThanMinimalUi5Version = isLowerThanMinimalUi5Version;
|
|
83
|
+
__exports.isVersionEqualOrHasNewerPatch = isVersionEqualOrHasNewerPatch;
|
|
67
84
|
__exports.getUI5VersionValidationMessage = getUI5VersionValidationMessage;
|
|
68
85
|
return __exports;
|
|
69
86
|
});
|
|
@@ -3,14 +3,15 @@ import Log from 'sap/base/Log';
|
|
|
3
3
|
|
|
4
4
|
type SingleVersionInfo =
|
|
5
5
|
| {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
name: string;
|
|
7
|
+
version: string;
|
|
8
|
+
}
|
|
9
9
|
| undefined;
|
|
10
10
|
|
|
11
11
|
export type Ui5VersionInfo = {
|
|
12
12
|
major: number;
|
|
13
13
|
minor: number;
|
|
14
|
+
patch?: number;
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
/**
|
|
@@ -32,11 +33,12 @@ export async function getUi5Version(): Promise<Ui5VersionInfo> {
|
|
|
32
33
|
Log.error('Could not get UI5 version of application. Using 1.121.0 as fallback.');
|
|
33
34
|
version = '1.121.0';
|
|
34
35
|
}
|
|
35
|
-
const [major, minor] = version.split('.').map(versionPart => parseInt(versionPart, 10));
|
|
36
|
+
const [major, minor, patch] = version.split('.').map((versionPart) => parseInt(versionPart, 10));
|
|
36
37
|
|
|
37
38
|
return {
|
|
38
39
|
major: major,
|
|
39
|
-
minor: minor
|
|
40
|
+
minor: minor,
|
|
41
|
+
patch: patch
|
|
40
42
|
} satisfies Ui5VersionInfo;
|
|
41
43
|
}
|
|
42
44
|
|
|
@@ -55,16 +57,33 @@ export function isLowerThanMinimalUi5Version(
|
|
|
55
57
|
if (ui5VersionInfo.major < minUi5VersionInfo.major) {
|
|
56
58
|
return true;
|
|
57
59
|
}
|
|
58
|
-
if (
|
|
59
|
-
ui5VersionInfo.major === minUi5VersionInfo.major &&
|
|
60
|
-
ui5VersionInfo.minor < minUi5VersionInfo.minor
|
|
61
|
-
) {
|
|
60
|
+
if (ui5VersionInfo.major === minUi5VersionInfo.major && ui5VersionInfo.minor < minUi5VersionInfo.minor) {
|
|
62
61
|
return true;
|
|
63
62
|
}
|
|
64
63
|
}
|
|
65
64
|
return false;
|
|
66
65
|
}
|
|
67
66
|
|
|
67
|
+
/**
|
|
68
|
+
* Checks if the given version is equal to the specified version.
|
|
69
|
+
* @param ui5VersionInfo to check
|
|
70
|
+
* @param targetUi5VersionInfo to check against (default is 1.71)
|
|
71
|
+
*
|
|
72
|
+
* @returns boolean
|
|
73
|
+
*/
|
|
74
|
+
export function isVersionEqualOrHasNewerPatch(
|
|
75
|
+
ui5VersionInfo: Ui5VersionInfo,
|
|
76
|
+
targetUi5VersionInfo: Ui5VersionInfo = minVersionInfo
|
|
77
|
+
): boolean {
|
|
78
|
+
if (!isNaN(ui5VersionInfo.major) && !isNaN(ui5VersionInfo.minor)) {
|
|
79
|
+
return (
|
|
80
|
+
ui5VersionInfo.major === targetUi5VersionInfo.major &&
|
|
81
|
+
ui5VersionInfo.minor === targetUi5VersionInfo.minor &&
|
|
82
|
+
(ui5VersionInfo?.patch ?? 0) >= (targetUi5VersionInfo?.patch ?? 0));
|
|
83
|
+
}
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
|
|
68
87
|
/**
|
|
69
88
|
* Get UI5 version validation message.
|
|
70
89
|
* @param ui5VersionInfo to be mentioned in the message
|
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.125",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"mem-fs-editor": "9.4.0",
|
|
28
28
|
"@sap-ux/logger": "0.6.0",
|
|
29
29
|
"@sap-ux/feature-toggle": "0.2.2",
|
|
30
|
-
"@sap-ux/btp-utils": "0.17.0",
|
|
31
30
|
"@sap-ux/adp-tooling": "0.12.81",
|
|
31
|
+
"@sap-ux/btp-utils": "0.17.0",
|
|
32
32
|
"@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.5.26",
|
|
33
33
|
"@sap-ux/project-access": "1.28.7"
|
|
34
34
|
},
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
"supertest": "6.3.3",
|
|
47
47
|
"@sap-ux-private/playwright": "0.1.0",
|
|
48
48
|
"dotenv": "16.3.1",
|
|
49
|
-
"@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.11.
|
|
49
|
+
"@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.11.34",
|
|
50
50
|
"@sap-ux/axios-extension": "1.17.4",
|
|
51
|
-
"@sap-ux/store": "0.9.3",
|
|
52
51
|
"@sap-ux/ui5-info": "0.8.3",
|
|
52
|
+
"@sap-ux/store": "0.9.3",
|
|
53
53
|
"@sap-ux/i18n": "0.2.0"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|