@sap-ux/preview-middleware 0.16.142 → 0.16.143

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.
@@ -22,8 +22,8 @@ sap.ui.define(["../../../cpe/quick-actions/utils", "../../../utils/core", "../si
22
22
  forceRefreshAfterExecution = true;
23
23
  isUseDateRangeTypeEnabled = false;
24
24
  async initialize() {
25
- const isUI5VersionNotSupported = await areManifestChangesSupported();
26
- if (isUI5VersionNotSupported) {
25
+ const manifestChangesSupported = await areManifestChangesSupported(this.context.manifest);
26
+ if (!manifestChangesSupported) {
27
27
  return;
28
28
  }
29
29
  const controls = this.context.controlIndex[CONTROL_TYPE] ?? [];
@@ -24,8 +24,8 @@ export class ToggleSemanticDateRangeFilterBar
24
24
  private isUseDateRangeTypeEnabled = false;
25
25
 
26
26
  async initialize(): Promise<void> {
27
- const isUI5VersionNotSupported = await areManifestChangesSupported();
28
- if (isUI5VersionNotSupported) {
27
+ const manifestChangesSupported = await areManifestChangesSupported(this.context.manifest);
28
+ if (!manifestChangesSupported) {
29
29
  return;
30
30
  }
31
31
  const controls = this.context.controlIndex[CONTROL_TYPE] ?? [];
@@ -30,8 +30,8 @@ sap.ui.define(["../../../cpe/quick-actions/utils", "../table-quick-action-base",
30
30
  return this.isDisabled ? this.context.resourceBundle.getText('TABLE_FILTERING_CHANGE_HAS_ALREADY_BEEN_MADE') : undefined;
31
31
  }
32
32
  async initialize() {
33
- const isUI5VersionNotSupported = await areManifestChangesSupported();
34
- if (isUI5VersionNotSupported) {
33
+ const manifestChangesSupported = await areManifestChangesSupported(this.context.manifest);
34
+ if (!manifestChangesSupported) {
35
35
  return;
36
36
  }
37
37
  for (const table of getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, CONTROL_TYPES)) {
@@ -31,11 +31,10 @@ export class EnableTableFilteringQuickAction
31
31
  }
32
32
 
33
33
  async initialize(): Promise<void> {
34
- const isUI5VersionNotSupported = await areManifestChangesSupported();
35
- if (isUI5VersionNotSupported) {
34
+ const manifestChangesSupported = await areManifestChangesSupported(this.context.manifest);
35
+ if (!manifestChangesSupported) {
36
36
  return;
37
37
  }
38
-
39
38
  for (const table of getRelevantControlFromActivePage(
40
39
  this.context.controlIndex,
41
40
  this.context.view,
@@ -42,18 +42,28 @@ sap.ui.define(["sap/ui/rta/command/CommandFactory", "../../../utils/version"], f
42
42
  }
43
43
 
44
44
  /**
45
- * Checks if the current UI5 version supports manifest changes in v2 applications.
45
+ * Checks if the current UI5 version and manifest structure is supported in v2 applications.
46
46
  *
47
- * Returns `true` if the UI5 version is supported.
48
- * Otherwise, returns `false`.
47
+ * @param manifest - manifest changes of the current application.
48
+ *
49
+ * Returns `false`
50
+ *
51
+ * - If the manifest is structured is an array
52
+ * - If the UI5 version is not supported
53
+ * Otherwise, returns `true`.
49
54
  *
50
55
  */
51
- async function areManifestChangesSupported() {
56
+ async function areManifestChangesSupported(manifest) {
57
+ const pagesStructureInManifest = manifest['sap.ui.generic.app'].pages;
58
+ if (Array.isArray(pagesStructureInManifest)) {
59
+ return false;
60
+ }
52
61
  const version = await getUi5Version();
53
- return isLowerThanMinimalUi5Version(version, {
62
+ const isAboveOrEqualMinimalVersion = !isLowerThanMinimalUi5Version(version, {
54
63
  major: 1,
55
64
  minor: 128
56
- }) && !(isVersionEqualOrHasNewerPatch(version, {
65
+ });
66
+ const isSupportedPatchVersion = isVersionEqualOrHasNewerPatch(version, {
57
67
  major: 1,
58
68
  minor: 96,
59
69
  patch: 37
@@ -65,7 +75,8 @@ sap.ui.define(["sap/ui/rta/command/CommandFactory", "../../../utils/version"], f
65
75
  major: 1,
66
76
  minor: 120,
67
77
  patch: 23
68
- }));
78
+ });
79
+ return isAboveOrEqualMinimalVersion || isSupportedPatchVersion;
69
80
  }
70
81
  var __exports = {
71
82
  __esModule: true
@@ -4,6 +4,7 @@ import CommandFactory from 'sap/ui/rta/command/CommandFactory';
4
4
 
5
5
  import { QuickActionContext } from '../../../cpe/quick-actions/quick-action-definition';
6
6
  import { getUi5Version, isLowerThanMinimalUi5Version, isVersionEqualOrHasNewerPatch } from '../../../utils/version';
7
+ import { Manifest } from 'sap/ui/rta/RuntimeAuthoring';
7
8
 
8
9
  /**
9
10
  * Prepares the change for the manifest setting.
@@ -53,20 +54,29 @@ export async function prepareManifestChange(
53
54
  }
54
55
 
55
56
  /**
56
- * Checks if the current UI5 version supports manifest changes in v2 applications.
57
+ * Checks if the current UI5 version and manifest structure is supported in v2 applications.
57
58
  *
58
- * Returns `true` if the UI5 version is supported.
59
- * Otherwise, returns `false`.
59
+ * @param manifest - manifest changes of the current application.
60
+ *
61
+ * Returns `false`
62
+ *
63
+ * - If the manifest is structured is an array
64
+ * - If the UI5 version is not supported
65
+ * Otherwise, returns `true`.
60
66
  *
61
67
  */
62
- export async function areManifestChangesSupported(): Promise<boolean> {
68
+ export async function areManifestChangesSupported(manifest: Manifest): Promise<boolean> {
69
+ const pagesStructureInManifest = manifest['sap.ui.generic.app'].pages;
70
+ if (Array.isArray(pagesStructureInManifest)) {
71
+ return false;
72
+ }
73
+
63
74
  const version = await getUi5Version();
64
- return (
65
- isLowerThanMinimalUi5Version(version, { major: 1, minor: 128 }) &&
66
- !(
67
- isVersionEqualOrHasNewerPatch(version, { major: 1, minor: 96, patch: 37 }) ||
68
- isVersionEqualOrHasNewerPatch(version, { major: 1, minor: 108, patch: 38 }) ||
69
- isVersionEqualOrHasNewerPatch(version, { major: 1, minor: 120, patch: 23 })
70
- )
71
- );
75
+ const isAboveOrEqualMinimalVersion = !isLowerThanMinimalUi5Version(version, { major: 1, minor: 128 });
76
+ const isSupportedPatchVersion =
77
+ isVersionEqualOrHasNewerPatch(version, { major: 1, minor: 96, patch: 37 }) ||
78
+ isVersionEqualOrHasNewerPatch(version, { major: 1, minor: 108, patch: 38 }) ||
79
+ isVersionEqualOrHasNewerPatch(version, { major: 1, minor: 120, patch: 23 });
80
+
81
+ return isAboveOrEqualMinimalVersion || isSupportedPatchVersion;
72
82
  }
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.142",
12
+ "version": "0.16.143",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -25,10 +25,10 @@
25
25
  "ejs": "3.1.10",
26
26
  "mem-fs": "2.1.0",
27
27
  "mem-fs-editor": "9.4.0",
28
+ "@sap-ux/logger": "0.6.0",
28
29
  "@sap-ux/feature-toggle": "0.2.3",
29
30
  "@sap-ux/btp-utils": "0.17.1",
30
31
  "@sap-ux/adp-tooling": "0.12.91",
31
- "@sap-ux/logger": "0.6.0",
32
32
  "@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.5.28",
33
33
  "@sap-ux/project-access": "1.28.8"
34
34
  },
@@ -46,11 +46,11 @@
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.41",
50
- "@sap-ux/axios-extension": "1.17.6",
49
+ "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.11.42",
51
50
  "@sap-ux/store": "0.9.3",
52
- "@sap-ux/i18n": "0.2.0",
53
- "@sap-ux/ui5-info": "0.8.3"
51
+ "@sap-ux/axios-extension": "1.17.6",
52
+ "@sap-ux/ui5-info": "0.8.3",
53
+ "@sap-ux/i18n": "0.2.0"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "express": "4"