@sap-ux/preview-middleware 0.16.136 → 0.16.139

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.
Files changed (59) hide show
  1. package/dist/base/flp.d.ts +32 -0
  2. package/dist/base/flp.js +101 -18
  3. package/dist/client/adp/api-handler.js +142 -142
  4. package/dist/client/adp/command-executor.js +75 -75
  5. package/dist/client/adp/control-utils.js +44 -44
  6. package/dist/client/adp/controllers/BaseDialog.controller.js +187 -187
  7. package/dist/client/adp/controllers/ControllerExtension.controller.js +213 -213
  8. package/dist/client/adp/controllers/ExtensionPoint.controller.js +138 -138
  9. package/dist/client/adp/init-dialogs.js +157 -157
  10. package/dist/client/adp/quick-actions/common/add-controller-to-page.js +54 -54
  11. package/dist/client/adp/quick-actions/common/create-page-action.js +49 -49
  12. package/dist/client/adp/quick-actions/common/op-add-custom-section.js +35 -35
  13. package/dist/client/adp/quick-actions/common/op-add-header-field.js +47 -47
  14. package/dist/client/adp/quick-actions/fe-v2/change-table-columns.js +100 -100
  15. package/dist/client/adp/quick-actions/fe-v2/create-table-action.js +69 -69
  16. package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +95 -95
  17. package/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.js +56 -56
  18. package/dist/client/adp/quick-actions/fe-v2/lr-enable-table-filtering.js +67 -67
  19. package/dist/client/adp/quick-actions/fe-v2/lr-toggle-clear-filter-bar.js +57 -57
  20. package/dist/client/adp/quick-actions/fe-v2/registry.js +71 -71
  21. package/dist/client/adp/quick-actions/fe-v2/utils.js +75 -75
  22. package/dist/client/adp/quick-actions/fe-v4/change-table-columns.js +47 -47
  23. package/dist/client/adp/quick-actions/fe-v4/create-table-action.js +45 -45
  24. package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column.js +45 -45
  25. package/dist/client/adp/quick-actions/fe-v4/lr-enable-semantic-date-range-filter-bar.js +55 -55
  26. package/dist/client/adp/quick-actions/fe-v4/lr-enable-table-filtering.js +82 -82
  27. package/dist/client/adp/quick-actions/fe-v4/lr-toggle-clear-filter-bar.js +52 -52
  28. package/dist/client/adp/quick-actions/fe-v4/registry.js +55 -55
  29. package/dist/client/adp/quick-actions/fe-v4/utils.js +47 -47
  30. package/dist/client/adp/quick-actions/load.js +44 -44
  31. package/dist/client/adp/utils.js +160 -160
  32. package/dist/client/cpe/changes/index.js +10 -10
  33. package/dist/client/cpe/changes/validator.js +34 -34
  34. package/dist/client/cpe/documentation.js +164 -164
  35. package/dist/client/cpe/feature-service.js +36 -36
  36. package/dist/client/cpe/logger.js +30 -30
  37. package/dist/client/cpe/outline/editable.js +37 -37
  38. package/dist/client/cpe/outline/nodes.js +217 -217
  39. package/dist/client/cpe/quick-actions/quick-action-definition.js +4 -4
  40. package/dist/client/cpe/quick-actions/registry.js +143 -143
  41. package/dist/client/cpe/quick-actions/utils.js +92 -92
  42. package/dist/client/cpe/types.js +4 -4
  43. package/dist/client/cpe/ui5-utils.js +33 -33
  44. package/dist/client/cpe/utils.js +138 -138
  45. package/dist/client/flp/WorkspaceConnector.js +86 -86
  46. package/dist/client/flp/common.js +28 -28
  47. package/dist/client/flp/enableFakeConnector.js +83 -83
  48. package/dist/client/flp/initConnectors.js +30 -30
  49. package/dist/client/flp/initRta.js +178 -178
  50. package/dist/client/i18n.js +56 -56
  51. package/dist/client/utils/application.js +32 -32
  52. package/dist/client/utils/core.js +68 -68
  53. package/dist/client/utils/error.js +19 -19
  54. package/dist/client/utils/fe-v4.js +114 -114
  55. package/dist/client/utils/version.js +85 -85
  56. package/package.json +6 -6
  57. package/templates/flp/sandbox.html +2 -3
  58. package/templates/flp/sandbox2.html +87 -0
  59. package/dist/client/flp/bootstrap.js +0 -77
@@ -1,87 +1,87 @@
1
- "use strict";
2
-
3
- sap.ui.define(["sap/ui/VersionInfo", "sap/base/Log"], function (VersionInfo, Log) {
4
- "use strict";
5
-
6
- /**
7
- * Default minimal supported UI5 version
8
- */
9
- const minVersionInfo = {
10
- major: 1,
11
- minor: 71
12
- };
13
-
14
- /**
15
- * Retrieve the UI5 version from sap.ui.core library
16
- *
17
- * @returns Ui5VersionInfo
18
- */
19
- async function getUi5Version() {
20
- let version = (await VersionInfo.load({
21
- library: 'sap.ui.core'
22
- }))?.version;
23
- if (!version) {
24
- Log.error('Could not get UI5 version of application. Using 1.121.0 as fallback.');
25
- version = '1.121.0';
26
- }
27
- const [major, minor, patch] = version.split('.').map(versionPart => parseInt(versionPart, 10));
28
- return {
29
- major: major,
30
- minor: minor,
31
- patch: patch
32
- };
33
- }
34
-
35
- /**
36
- * Checks if the given version is lower than the required minimal version.
37
- * @param ui5VersionInfo to check
38
- * @param minUi5VersionInfo to check against (default is 1.71)
39
- *
40
- * @returns boolean
41
- */
42
- function isLowerThanMinimalUi5Version(ui5VersionInfo) {
43
- let minUi5VersionInfo = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minVersionInfo;
44
- if (!isNaN(ui5VersionInfo.major) && !isNaN(ui5VersionInfo.minor)) {
45
- if (ui5VersionInfo.major < minUi5VersionInfo.major) {
46
- return true;
47
- }
48
- if (ui5VersionInfo.major === minUi5VersionInfo.major && ui5VersionInfo.minor < minUi5VersionInfo.minor) {
49
- return true;
50
- }
51
- }
52
- return false;
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
-
70
- /**
71
- * Get UI5 version validation message.
72
- * @param ui5VersionInfo to be mentioned in the message
73
- * @returns string with validation message.
74
- */
75
- function getUI5VersionValidationMessage(ui5VersionInfo) {
76
- 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}`;
77
- }
78
- var __exports = {
79
- __esModule: true
80
- };
81
- __exports.getUi5Version = getUi5Version;
82
- __exports.isLowerThanMinimalUi5Version = isLowerThanMinimalUi5Version;
83
- __exports.isVersionEqualOrHasNewerPatch = isVersionEqualOrHasNewerPatch;
84
- __exports.getUI5VersionValidationMessage = getUI5VersionValidationMessage;
85
- return __exports;
1
+ "use strict";
2
+
3
+ sap.ui.define(["sap/ui/VersionInfo", "sap/base/Log"], function (VersionInfo, Log) {
4
+ "use strict";
5
+
6
+ /**
7
+ * Default minimal supported UI5 version
8
+ */
9
+ const minVersionInfo = {
10
+ major: 1,
11
+ minor: 71
12
+ };
13
+
14
+ /**
15
+ * Retrieve the UI5 version from sap.ui.core library
16
+ *
17
+ * @returns Ui5VersionInfo
18
+ */
19
+ async function getUi5Version() {
20
+ let version = (await VersionInfo.load({
21
+ library: 'sap.ui.core'
22
+ }))?.version;
23
+ if (!version) {
24
+ Log.error('Could not get UI5 version of application. Using 1.121.0 as fallback.');
25
+ version = '1.121.0';
26
+ }
27
+ const [major, minor, patch] = version.split('.').map(versionPart => parseInt(versionPart, 10));
28
+ return {
29
+ major: major,
30
+ minor: minor,
31
+ patch: patch
32
+ };
33
+ }
34
+
35
+ /**
36
+ * Checks if the given version is lower than the required minimal version.
37
+ * @param ui5VersionInfo to check
38
+ * @param minUi5VersionInfo to check against (default is 1.71)
39
+ *
40
+ * @returns boolean
41
+ */
42
+ function isLowerThanMinimalUi5Version(ui5VersionInfo) {
43
+ let minUi5VersionInfo = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minVersionInfo;
44
+ if (!isNaN(ui5VersionInfo.major) && !isNaN(ui5VersionInfo.minor)) {
45
+ if (ui5VersionInfo.major < minUi5VersionInfo.major) {
46
+ return true;
47
+ }
48
+ if (ui5VersionInfo.major === minUi5VersionInfo.major && ui5VersionInfo.minor < minUi5VersionInfo.minor) {
49
+ return true;
50
+ }
51
+ }
52
+ return false;
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
+
70
+ /**
71
+ * Get UI5 version validation message.
72
+ * @param ui5VersionInfo to be mentioned in the message
73
+ * @returns string with validation message.
74
+ */
75
+ function getUI5VersionValidationMessage(ui5VersionInfo) {
76
+ 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}`;
77
+ }
78
+ var __exports = {
79
+ __esModule: true
80
+ };
81
+ __exports.getUi5Version = getUi5Version;
82
+ __exports.isLowerThanMinimalUi5Version = isLowerThanMinimalUi5Version;
83
+ __exports.isVersionEqualOrHasNewerPatch = isVersionEqualOrHasNewerPatch;
84
+ __exports.getUI5VersionValidationMessage = getUI5VersionValidationMessage;
85
+ return __exports;
86
86
  });
87
87
  //# sourceMappingURL=version.js.map
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.136",
12
+ "version": "0.16.139",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -26,9 +26,9 @@
26
26
  "mem-fs": "2.1.0",
27
27
  "mem-fs-editor": "9.4.0",
28
28
  "@sap-ux/logger": "0.6.0",
29
- "@sap-ux/feature-toggle": "0.2.2",
30
- "@sap-ux/btp-utils": "0.17.0",
31
- "@sap-ux/adp-tooling": "0.12.87",
29
+ "@sap-ux/feature-toggle": "0.2.3",
30
+ "@sap-ux/btp-utils": "0.17.1",
31
+ "@sap-ux/adp-tooling": "0.12.89",
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,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.39",
50
- "@sap-ux/axios-extension": "1.17.4",
49
+ "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.11.40",
51
50
  "@sap-ux/store": "0.9.3",
52
51
  "@sap-ux/ui5-info": "0.8.3",
52
+ "@sap-ux/axios-extension": "1.17.6",
53
53
  "@sap-ux/i18n": "0.2.0"
54
54
  },
55
55
  "peerDependencies": {
@@ -44,9 +44,8 @@
44
44
  window["data-open-ux-preview-basePath"] = "<%- basePath %>";
45
45
  </script>
46
46
 
47
- <script src="<%- basePath %>/preview/client/flp/bootstrap.js" id="preview-bootstrap"></script>
48
- <script id="sap-ushell-bootstrap"></script>
49
- <!-- Bootstrap the UI5 core library. 'data-sap-ui-frameOptions="allow"'' is a NON-SECURE setting for test environments -->
47
+ <script src="<%- basePath %>/test-resources/sap/ushell/bootstrap/sandbox.js" id="sap-ushell-bootstrap"></script>
48
+ <!-- Bootstrap the UI5 core library. 'data-sap-ui-frameOptions="allow"' is a NON-SECURE setting for test environments -->
50
49
  <script id="sap-ui-bootstrap"
51
50
  src="<%- basePath %>/resources/sap-ui-core.js"
52
51
  data-sap-ui-libs="<%- ui5.libs %>"
@@ -0,0 +1,87 @@
1
+ <!DOCTYPE HTML>
2
+ <html lang="en">
3
+ <!-- Copyright (c) 2015 SAP AG, All Rights Reserved -->
4
+
5
+ <head>
6
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
7
+ <meta charset="UTF-8">
8
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
9
+ <title>Local FLP Sandbox</title>
10
+
11
+ <!-- Bootstrap the unified shell in sandbox mode for standalone usage.
12
+
13
+ The renderer is specified in the global Unified Shell configuration object "sap-ushell-config".
14
+
15
+ The fiori2 renderer will render the shell header allowing, for instance,
16
+ testing of additional application setting buttons.
17
+
18
+ The navigation target resolution service is configured in a way that the empty URL hash is
19
+ resolved to our own application.
20
+
21
+ This example uses relative path references for the SAPUI5 resources and test-resources;
22
+ it might be necessary to adapt them depending on the target runtime platform.
23
+ The sandbox platform is restricted to development or demo use cases and must NOT be used
24
+ for productive scenarios.
25
+ -->
26
+ <script type="text/javascript">
27
+ window["sap-ushell-config"] = {
28
+ defaultRenderer: "fiori2",
29
+ renderers: {
30
+ fiori2: {
31
+ componentData: {
32
+ config: {
33
+ search: "hidden",
34
+ enableSearch: false
35
+ }
36
+ }
37
+ }
38
+ },
39
+ applications: <%- JSON.stringify(apps) %>
40
+ };
41
+ </script>
42
+
43
+ <script type="text/javascript">
44
+ window["data-open-ux-preview-basePath"] = "<%- basePath %>";
45
+ </script>
46
+
47
+ <script src="<%- basePath %>/resources/sap/ushell/bootstrap/sandbox2.js" id="sap-ushell-bootstrap"></script>
48
+ <!-- Bootstrap the UI5 core library. 'data-sap-ui-frameOptions="allow"' is a NON-SECURE setting for test environments -->
49
+ <script id="sap-ui-bootstrap"
50
+ src="<%- basePath %>/resources/sap-ui-core.js"
51
+ data-sap-ui-libs="<%- ui5.libs %>"
52
+ data-sap-ui-async="true"
53
+ data-sap-ui-theme="<%- ui5.theme %>"
54
+ data-sap-ui-compat-version="edge"
55
+ data-sap-ui-language="en"
56
+ data-sap-ui-flexibility-services='<%- JSON.stringify(ui5.flex) %>'
57
+ data-sap-ui-resource-roots='<%- JSON.stringify(ui5.resources) %>'
58
+ data-sap-ui-frame-options="allow"
59
+ data-sap-ui-xx-component-preload="off"<%- ui5.bootstrapOptions %>
60
+ data-sap-ui-on-init="module:open/ux/preview/client/flp/init"<% if (locals.init) { %>
61
+ data-open-ux-preview-customInit='<%- init %>'<% } if (locals.flex) { %>
62
+ data-open-ux-preview-features='<%- JSON.stringify(features) %>'
63
+ data-open-ux-preview-flex-settings='<%- JSON.stringify(flex) %>'<% } if (locals.locateReuseLibsScript) { %>
64
+ data-open-ux-preview-libs-manifests='<%- JSON.stringify(Object.values(apps).map(app => app.url)) %>'<% } %>>
65
+ </script>
66
+
67
+ <% if (locals.flex && flex?.developerMode) { %>
68
+ <!-- Hides Rta native toolbar -->
69
+ <style>
70
+ #shell-header, .sapUiRtaToolbar {
71
+ visibility: hidden;
72
+ height: 1px;
73
+ }
74
+ .sapUshellShellCanvas {
75
+ top: 0 !important;
76
+ }
77
+ .sapUiRtaMode .sapUiShellBackgroundImage.sapUiGlobalBackgroundImageForce.sapUshellShellBG {
78
+ background-color: transparent !important;
79
+ }
80
+ </style><% } %>
81
+ </head>
82
+
83
+ <!-- UI Content -->
84
+ <body class="sapUiBody" id="content">
85
+ </body>
86
+
87
+ </html>
@@ -1,77 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-unsafe-assignment,
2
- @typescript-eslint/no-unsafe-member-access,
3
- @typescript-eslint/no-unsafe-argument,
4
- no-console */
5
-
6
- /**
7
- * Calculates the script content for accessing the right sap/ushell/bootstrap sandbox.
8
- * @param fnCallback {Function} The callback function to be executed after the bootstrap is loaded.
9
- */
10
- async function ushellBootstrap(fnCallback) {
11
- const basePath = window['data-open-ux-preview-basePath'] ?? '';
12
-
13
- let src = `${basePath}/test-resources/sap/ushell/bootstrap/sandbox.js`;
14
- try {
15
- const response = await fetch(`${basePath}/resources/sap-ui-version.json`);
16
- const json = await response.json();
17
- const version = json?.libraries?.find((lib) => lib.name === 'sap.ui.core')?.version ?? '1.121.0';
18
- const [major, minor] = version.split('.');
19
- const majorUi5Version = parseInt(major, 10);
20
- const minorUi5Version = parseInt(minor, 10);
21
- if (majorUi5Version >= 2) {
22
- src = `${basePath}/resources/sap/ushell/bootstrap/sandbox2.js`;
23
- }
24
-
25
- if (majorUi5Version === 1 && minorUi5Version < 72) {
26
- removeAsyncHintsRequests();
27
- }
28
- } catch (error) {
29
- console.warn('Failed to fetch sap-ui-version.json. Assuming it is a 1.x version.');
30
- }
31
-
32
- // eslint-disable-next-line fiori-custom/sap-no-dom-access,fiori-custom/sap-browser-api-warning
33
- const shellBootstrap = document.getElementById('sap-ushell-bootstrap');
34
- if (shellBootstrap) {
35
- shellBootstrap.onload = () => {
36
- window['sap-ui-config']['xx-bootTask'](fnCallback);
37
- };
38
- shellBootstrap.setAttribute('src', src);
39
- }
40
- }
41
-
42
- /**
43
- * For UI5 version 1.71 and below, we need to remove the asyncHints.requests
44
- * to load the changes in an Adaptation project.
45
- * This logic needs to be executed here to have a reliable check for
46
- * UI5 version and remove the asyncHints.requests before the sandbox is loaded.
47
- * The sandbox shell modifies the `window['sap-ushell-config']`.
48
- */
49
- function removeAsyncHintsRequests() {
50
- const obj = window['sap-ushell-config']['applications'];
51
-
52
- if (!obj || typeof obj !== 'object') return;
53
-
54
- const stack = [obj];
55
-
56
- while (stack.length > 0) {
57
- const current = stack.pop();
58
-
59
- if (current.asyncHints) {
60
- if (current.asyncHints.requests) {
61
- current.asyncHints.requests = [];
62
- }
63
- return;
64
- }
65
-
66
- for (const key in current) {
67
- if (typeof current[key] === 'object' && current[key] !== null) {
68
- stack.push(current[key]);
69
- }
70
- }
71
- }
72
- }
73
-
74
- // eslint-disable-next-line fiori-custom/sap-no-global-define
75
- window['sap-ui-config'] = {
76
- 'xx-bootTask': ushellBootstrap
77
- };