@sap-ux/preview-middleware 0.13.54 → 0.13.55

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.
@@ -25,7 +25,7 @@ sap.ui.define(["sap/ui/core/Fragment", "sap/ui/fl/Utils", "./controllers/AddFrag
25
25
  const contextMenu = rta.getDefaultPlugins().contextMenu;
26
26
  contextMenu.addMenuItem({
27
27
  id: 'ADD_FRAGMENT',
28
- text: 'Add: Fragment',
28
+ text: getAddFragmentItemText,
29
29
  handler: async overlays => await handler(overlays[0], rta, DialogNames.ADD_FRAGMENT),
30
30
  enabled: isFragmentCommandEnabled,
31
31
  icon: 'sap-icon://attachment-html'
@@ -67,6 +67,19 @@ sap.ui.define(["sap/ui/core/Fragment", "sap/ui/fl/Utils", "./controllers/AddFrag
67
67
  return hasStableId && overlays.length <= 1;
68
68
  };
69
69
 
70
+ /**
71
+ * Determines the text that should be displayed for the Add Fragment context menu item.
72
+ *
73
+ * @param {ElementOverlay} overlay - An ElementOverlay object representing the UI overlay.
74
+ * @returns {string} The text of the Add Fragment context menu item.
75
+ */
76
+ const getAddFragmentItemText = overlay => {
77
+ if (!isFragmentCommandEnabled([overlay])) {
78
+ return 'Add: Fragment (Unavailable due to unstable ID of the control or its parent control)';
79
+ }
80
+ return 'Add: Fragment';
81
+ };
82
+
70
83
  /**
71
84
  * Handler for new context menu entry
72
85
  *
@@ -103,6 +116,7 @@ sap.ui.define(["sap/ui/core/Fragment", "sap/ui/fl/Utils", "./controllers/AddFrag
103
116
  __exports.initDialogs = initDialogs;
104
117
  __exports.isControllerExtensionEnabled = isControllerExtensionEnabled;
105
118
  __exports.isFragmentCommandEnabled = isFragmentCommandEnabled;
119
+ __exports.getAddFragmentItemText = getAddFragmentItemText;
106
120
  __exports.handler = handler;
107
121
  return __exports;
108
122
  });
@@ -38,7 +38,7 @@ export const initDialogs = (rta: RuntimeAuthoring, syncViewsIds: string[]): void
38
38
 
39
39
  contextMenu.addMenuItem({
40
40
  id: 'ADD_FRAGMENT',
41
- text: 'Add: Fragment',
41
+ text: getAddFragmentItemText,
42
42
  handler: async (overlays: UI5Element[]) => await handler(overlays[0], rta, DialogNames.ADD_FRAGMENT),
43
43
  enabled: isFragmentCommandEnabled,
44
44
  icon: 'sap-icon://attachment-html'
@@ -82,6 +82,20 @@ export const isFragmentCommandEnabled = (overlays: ElementOverlay[]): boolean =>
82
82
  return hasStableId && overlays.length <= 1;
83
83
  };
84
84
 
85
+ /**
86
+ * Determines the text that should be displayed for the Add Fragment context menu item.
87
+ *
88
+ * @param {ElementOverlay} overlay - An ElementOverlay object representing the UI overlay.
89
+ * @returns {string} The text of the Add Fragment context menu item.
90
+ */
91
+ export const getAddFragmentItemText = (overlay: ElementOverlay) => {
92
+ if (!isFragmentCommandEnabled([overlay])) {
93
+ return 'Add: Fragment (Unavailable due to unstable ID of the control or its parent control)';
94
+ }
95
+
96
+ return 'Add: Fragment';
97
+ };
98
+
85
99
  /**
86
100
  * Handler for new context menu entry
87
101
  *
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.13.54",
12
+ "version": "0.13.55",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -25,11 +25,11 @@
25
25
  "ejs": "3.1.10",
26
26
  "mem-fs": "2.1.0",
27
27
  "mem-fs-editor": "9.4.0",
28
- "@sap-ux/btp-utils": "0.14.4",
29
28
  "@sap-ux/logger": "0.5.1",
30
- "@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.4.23",
29
+ "@sap-ux/btp-utils": "0.14.4",
31
30
  "@sap-ux/adp-tooling": "0.10.14",
32
- "@sap-ux/project-access": "1.20.3"
31
+ "@sap-ux/project-access": "1.20.3",
32
+ "@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.4.23"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/ejs": "3.1.2",
@@ -45,10 +45,10 @@
45
45
  "supertest": "6.3.3",
46
46
  "@sap-ux-private/playwright": "0.0.3",
47
47
  "dotenv": "16.3.1",
48
+ "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.9.15",
48
49
  "@sap-ux/axios-extension": "1.12.6",
49
50
  "@sap-ux/store": "0.5.0",
50
51
  "@sap-ux/ui5-info": "0.5.0",
51
- "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.9.14",
52
52
  "@sap-ux/i18n": "0.0.7"
53
53
  },
54
54
  "peerDependencies": {