@sap-ux/preview-middleware 0.19.18 → 0.19.19

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 (73) hide show
  1. package/dist/client/adp/api-handler.js +153 -153
  2. package/dist/client/adp/command-executor.js +75 -75
  3. package/dist/client/adp/control-utils.js +44 -44
  4. package/dist/client/adp/controllers/ControllerExtension.controller.js +210 -210
  5. package/dist/client/adp/controllers/ExtensionPoint.controller.js +139 -139
  6. package/dist/client/adp/controllers/FileExistsDialog.controller.js +66 -66
  7. package/dist/client/adp/dialog-factory.js +135 -135
  8. package/dist/client/adp/init-dialogs.js +138 -138
  9. package/dist/client/adp/quick-actions/add-new-subpage-quick-action-base.js +96 -96
  10. package/dist/client/adp/quick-actions/common/add-controller-to-page.js +60 -60
  11. package/dist/client/adp/quick-actions/common/create-page-action.js +54 -54
  12. package/dist/client/adp/quick-actions/common/op-add-custom-section.js +39 -39
  13. package/dist/client/adp/quick-actions/common/op-add-header-field.js +67 -67
  14. package/dist/client/adp/quick-actions/common/utils.js +18 -18
  15. package/dist/client/adp/quick-actions/control-types.js +23 -23
  16. package/dist/client/adp/quick-actions/dialog-enablement-validator.js +24 -24
  17. package/dist/client/adp/quick-actions/enablement-validator.js +4 -4
  18. package/dist/client/adp/quick-actions/fe-v2/add-new-subpage.js +81 -81
  19. package/dist/client/adp/quick-actions/fe-v2/change-table-actions.js +67 -67
  20. package/dist/client/adp/quick-actions/fe-v2/change-table-columns.js +101 -101
  21. package/dist/client/adp/quick-actions/fe-v2/create-table-action.js +107 -107
  22. package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +99 -99
  23. package/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.js +78 -78
  24. package/dist/client/adp/quick-actions/fe-v2/lr-enable-table-filtering.js +77 -77
  25. package/dist/client/adp/quick-actions/fe-v2/lr-enable-variant-management.js +69 -69
  26. package/dist/client/adp/quick-actions/fe-v2/lr-toggle-clear-filter-bar.js +59 -59
  27. package/dist/client/adp/quick-actions/fe-v2/op-enable-empty-row-mode.js +93 -93
  28. package/dist/client/adp/quick-actions/fe-v2/op-enable-variant-management.js +84 -84
  29. package/dist/client/adp/quick-actions/fe-v2/registry.js +77 -77
  30. package/dist/client/adp/quick-actions/fe-v2/utils.js +116 -116
  31. package/dist/client/adp/quick-actions/fe-v4/add-new-subpage.js +138 -138
  32. package/dist/client/adp/quick-actions/fe-v4/change-table-actions.js +79 -79
  33. package/dist/client/adp/quick-actions/fe-v4/change-table-columns.js +73 -73
  34. package/dist/client/adp/quick-actions/fe-v4/create-table-action.js +53 -53
  35. package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column.js +49 -49
  36. package/dist/client/adp/quick-actions/fe-v4/enable-variant-management.js +81 -81
  37. package/dist/client/adp/quick-actions/fe-v4/lr-enable-semantic-date-range-filter-bar.js +56 -56
  38. package/dist/client/adp/quick-actions/fe-v4/lr-enable-table-filtering.js +82 -82
  39. package/dist/client/adp/quick-actions/fe-v4/lr-toggle-clear-filter-bar.js +53 -53
  40. package/dist/client/adp/quick-actions/fe-v4/op-enable-empty-row-mode.js +89 -89
  41. package/dist/client/adp/quick-actions/fe-v4/registry.js +60 -60
  42. package/dist/client/adp/quick-actions/fe-v4/utils.js +72 -72
  43. package/dist/client/adp/quick-actions/load.js +44 -44
  44. package/dist/client/adp/quick-actions/quick-action-base.js +64 -64
  45. package/dist/client/adp/utils.js +218 -218
  46. package/dist/client/cpe/changes/index.js +10 -10
  47. package/dist/client/cpe/changes/validator.js +39 -39
  48. package/dist/client/cpe/documentation.js +164 -164
  49. package/dist/client/cpe/feature-service.js +36 -36
  50. package/dist/client/cpe/logger.js +30 -30
  51. package/dist/client/cpe/outline/editable.js +37 -37
  52. package/dist/client/cpe/outline/nodes.js +203 -203
  53. package/dist/client/cpe/quick-actions/quick-action-definition.js +4 -4
  54. package/dist/client/cpe/quick-actions/registry.js +143 -143
  55. package/dist/client/cpe/quick-actions/utils.js +92 -92
  56. package/dist/client/cpe/types.js +4 -4
  57. package/dist/client/cpe/ui5-utils.js +33 -33
  58. package/dist/client/cpe/utils.js +111 -111
  59. package/dist/client/flp/WorkspaceConnector.js +86 -86
  60. package/dist/client/flp/common.js +28 -28
  61. package/dist/client/flp/enableFakeConnector.js +83 -83
  62. package/dist/client/flp/homepage/Component.js +14 -14
  63. package/dist/client/flp/initCdm.js +117 -117
  64. package/dist/client/flp/initConnectors.js +28 -28
  65. package/dist/client/flp/initRta.js +178 -178
  66. package/dist/client/i18n.js +56 -56
  67. package/dist/client/utils/application.js +32 -32
  68. package/dist/client/utils/core.js +84 -84
  69. package/dist/client/utils/error.js +19 -19
  70. package/dist/client/utils/fe-v2.js +56 -56
  71. package/dist/client/utils/fe-v4.js +140 -140
  72. package/dist/client/utils/version.js +104 -104
  73. package/package.json +5 -5
@@ -1,137 +1,137 @@
1
- "use strict";
2
-
3
- sap.ui.define(["sap/ui/core/Fragment", "../i18n", "./controllers/AddFragment.controller", "./controllers/AddTableColumnFragments.controller", "./controllers/ControllerExtension.controller", "./controllers/ExtensionPoint.controller", "./controllers/FileExistsDialog.controller", "./controllers/AddSubpage.controller"], function (Fragment, ___i18n, __AddFragment, __AddTableColumnFragments, __ControllerExtension, __ExtensionPoint, __FileExistsDialog, __AddSubpage) {
4
- "use strict";
5
-
6
- function _interopRequireDefault(obj) {
7
- return obj && obj.__esModule && typeof obj.default !== "undefined" ? obj.default : obj;
8
- }
9
- const getTextBundle = ___i18n["getTextBundle"];
10
- const AddFragment = _interopRequireDefault(__AddFragment);
11
- const AddTableColumnFragments = _interopRequireDefault(__AddTableColumnFragments);
12
- const ControllerExtension = _interopRequireDefault(__ControllerExtension);
13
- const ExtensionPoint = _interopRequireDefault(__ExtensionPoint);
14
- const FileExistsDialog = _interopRequireDefault(__FileExistsDialog);
15
- const AddSubpage = _interopRequireDefault(__AddSubpage);
16
- var DialogNames = /*#__PURE__*/function (DialogNames) {
17
- DialogNames["ADD_FRAGMENT"] = "AddFragment";
18
- DialogNames["ADD_TABLE_COLUMN_FRAGMENTS"] = "AddTableColumnFragments";
19
- DialogNames["CONTROLLER_EXTENSION"] = "ControllerExtension";
20
- DialogNames["ADD_FRAGMENT_AT_EXTENSION_POINT"] = "ExtensionPoint";
21
- DialogNames["FILE_EXISTS"] = "FileExistsDialog";
22
- DialogNames["ADD_SUBPAGE"] = "AddSubpage";
23
- return DialogNames;
24
- }(DialogNames || {});
25
- const OPEN_DIALOG_STATUS_CHANGED = 'OPEN_DIALOG_STATUS_CHANGED';
26
- class DialogFactory {
27
- static eventTarget = new EventTarget();
28
- static isDialogOpen = false;
29
- /**
30
- * Only one dialog can be open at a time. This flag indicates if a new dialog can be opened.
31
- */
32
-
33
- static get canOpenDialog() {
34
- return !this.isDialogOpen;
35
- }
36
-
37
- /**
38
- * Factory method for creating a new dialog.
39
- *
40
- * @param overlay - Control overlay.
41
- * @param rta - Runtime Authoring instance.
42
- * @param dialogName - Dialog name.
43
- * @param extensionPointData - Control ID.
44
- * @param options - Dialog options.
45
- * @param telemetryData - Telemetry data.
46
- */
47
- static async createDialog(overlay, rta, dialogName, extensionPointData) {
48
- let options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
49
- let telemetryData = arguments.length > 5 ? arguments[5] : undefined;
50
- if (this.isDialogOpen) {
51
- return;
52
- }
53
- let controller;
54
- const resources = await getTextBundle();
55
- switch (dialogName) {
56
- case DialogNames.ADD_FRAGMENT:
57
- controller = new AddFragment(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, {
58
- ...('aggregation' in options && {
59
- aggregation: options.aggregation
60
- }),
61
- ...('defaultAggregationArrayIndex' in options && {
62
- defaultAggregationArrayIndex: options.defaultAggregationArrayIndex
63
- }),
64
- title: resources.getText(options.title ?? 'ADP_ADD_FRAGMENT_DIALOG_TITLE')
65
- }, telemetryData);
66
- break;
67
- case DialogNames.ADD_TABLE_COLUMN_FRAGMENTS:
68
- controller = new AddTableColumnFragments(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, {
69
- ...('aggregation' in options && {
70
- aggregation: options.aggregation
71
- }),
72
- title: resources.getText(options.title ?? 'ADP_ADD_FRAGMENT_DIALOG_TITLE')
73
- }, telemetryData);
74
- break;
75
- case DialogNames.CONTROLLER_EXTENSION:
76
- controller = new ControllerExtension(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, telemetryData);
77
- break;
78
- case DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT:
79
- controller = new ExtensionPoint(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, extensionPointData);
80
- break;
81
- case DialogNames.FILE_EXISTS:
82
- controller = new FileExistsDialog(`open.ux.preview.client.adp.controllers.${dialogName}`, options);
83
- break;
84
- case DialogNames.ADD_SUBPAGE:
85
- controller = new AddSubpage(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, {
86
- ...options,
87
- title: resources.getText(options.title ?? 'ADD_SUB_PAGE_DIALOG_TITLE')
88
- });
89
- break;
90
- }
91
- const id = dialogName === DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT ? `dialog--${dialogName}` : undefined;
92
- const dialog = await Fragment.load({
93
- name: `open.ux.preview.client.adp.ui.${dialogName}`,
94
- controller,
95
- id
96
- });
97
- this.isDialogOpen = true;
98
- dialog.attachBeforeClose(() => {
99
- this.updateStatus(false);
100
- });
101
- await controller.setup(dialog);
102
- this.updateStatus(true);
103
- }
104
-
105
- /**
106
- * Updates open dialog status.
107
- *
108
- * @param isDialogOpen Flag indicating if there is an open dialog.
109
- */
110
- static updateStatus(isDialogOpen) {
111
- this.isDialogOpen = isDialogOpen;
112
- const event = new CustomEvent(OPEN_DIALOG_STATUS_CHANGED);
113
- this.eventTarget.dispatchEvent(event);
114
- }
115
-
116
- /**
117
- * Attach event handler for OPEN_DIALOG_STATUS_CHANGED event.
118
- *
119
- * @param handler Event handler.
120
- * @returns Function that removes listener.
121
- */
122
- static onOpenDialogStatusChange(handler) {
123
- this.eventTarget.addEventListener(OPEN_DIALOG_STATUS_CHANGED, handler);
124
- return () => {
125
- this.eventTarget.removeEventListener(OPEN_DIALOG_STATUS_CHANGED, handler);
126
- };
127
- }
128
- }
129
- var __exports = {
130
- __esModule: true
131
- };
132
- __exports.DialogNames = DialogNames;
133
- __exports.OPEN_DIALOG_STATUS_CHANGED = OPEN_DIALOG_STATUS_CHANGED;
134
- __exports.DialogFactory = DialogFactory;
135
- return __exports;
1
+ "use strict";
2
+
3
+ sap.ui.define(["sap/ui/core/Fragment", "../i18n", "./controllers/AddFragment.controller", "./controllers/AddTableColumnFragments.controller", "./controllers/ControllerExtension.controller", "./controllers/ExtensionPoint.controller", "./controllers/FileExistsDialog.controller", "./controllers/AddSubpage.controller"], function (Fragment, ___i18n, __AddFragment, __AddTableColumnFragments, __ControllerExtension, __ExtensionPoint, __FileExistsDialog, __AddSubpage) {
4
+ "use strict";
5
+
6
+ function _interopRequireDefault(obj) {
7
+ return obj && obj.__esModule && typeof obj.default !== "undefined" ? obj.default : obj;
8
+ }
9
+ const getTextBundle = ___i18n["getTextBundle"];
10
+ const AddFragment = _interopRequireDefault(__AddFragment);
11
+ const AddTableColumnFragments = _interopRequireDefault(__AddTableColumnFragments);
12
+ const ControllerExtension = _interopRequireDefault(__ControllerExtension);
13
+ const ExtensionPoint = _interopRequireDefault(__ExtensionPoint);
14
+ const FileExistsDialog = _interopRequireDefault(__FileExistsDialog);
15
+ const AddSubpage = _interopRequireDefault(__AddSubpage);
16
+ var DialogNames = /*#__PURE__*/function (DialogNames) {
17
+ DialogNames["ADD_FRAGMENT"] = "AddFragment";
18
+ DialogNames["ADD_TABLE_COLUMN_FRAGMENTS"] = "AddTableColumnFragments";
19
+ DialogNames["CONTROLLER_EXTENSION"] = "ControllerExtension";
20
+ DialogNames["ADD_FRAGMENT_AT_EXTENSION_POINT"] = "ExtensionPoint";
21
+ DialogNames["FILE_EXISTS"] = "FileExistsDialog";
22
+ DialogNames["ADD_SUBPAGE"] = "AddSubpage";
23
+ return DialogNames;
24
+ }(DialogNames || {});
25
+ const OPEN_DIALOG_STATUS_CHANGED = 'OPEN_DIALOG_STATUS_CHANGED';
26
+ class DialogFactory {
27
+ static eventTarget = new EventTarget();
28
+ static isDialogOpen = false;
29
+ /**
30
+ * Only one dialog can be open at a time. This flag indicates if a new dialog can be opened.
31
+ */
32
+
33
+ static get canOpenDialog() {
34
+ return !this.isDialogOpen;
35
+ }
36
+
37
+ /**
38
+ * Factory method for creating a new dialog.
39
+ *
40
+ * @param overlay - Control overlay.
41
+ * @param rta - Runtime Authoring instance.
42
+ * @param dialogName - Dialog name.
43
+ * @param extensionPointData - Control ID.
44
+ * @param options - Dialog options.
45
+ * @param telemetryData - Telemetry data.
46
+ */
47
+ static async createDialog(overlay, rta, dialogName, extensionPointData) {
48
+ let options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
49
+ let telemetryData = arguments.length > 5 ? arguments[5] : undefined;
50
+ if (this.isDialogOpen) {
51
+ return;
52
+ }
53
+ let controller;
54
+ const resources = await getTextBundle();
55
+ switch (dialogName) {
56
+ case DialogNames.ADD_FRAGMENT:
57
+ controller = new AddFragment(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, {
58
+ ...('aggregation' in options && {
59
+ aggregation: options.aggregation
60
+ }),
61
+ ...('defaultAggregationArrayIndex' in options && {
62
+ defaultAggregationArrayIndex: options.defaultAggregationArrayIndex
63
+ }),
64
+ title: resources.getText(options.title ?? 'ADP_ADD_FRAGMENT_DIALOG_TITLE')
65
+ }, telemetryData);
66
+ break;
67
+ case DialogNames.ADD_TABLE_COLUMN_FRAGMENTS:
68
+ controller = new AddTableColumnFragments(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, {
69
+ ...('aggregation' in options && {
70
+ aggregation: options.aggregation
71
+ }),
72
+ title: resources.getText(options.title ?? 'ADP_ADD_FRAGMENT_DIALOG_TITLE')
73
+ }, telemetryData);
74
+ break;
75
+ case DialogNames.CONTROLLER_EXTENSION:
76
+ controller = new ControllerExtension(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, telemetryData);
77
+ break;
78
+ case DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT:
79
+ controller = new ExtensionPoint(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, extensionPointData);
80
+ break;
81
+ case DialogNames.FILE_EXISTS:
82
+ controller = new FileExistsDialog(`open.ux.preview.client.adp.controllers.${dialogName}`, options);
83
+ break;
84
+ case DialogNames.ADD_SUBPAGE:
85
+ controller = new AddSubpage(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, {
86
+ ...options,
87
+ title: resources.getText(options.title ?? 'ADD_SUB_PAGE_DIALOG_TITLE')
88
+ });
89
+ break;
90
+ }
91
+ const id = dialogName === DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT ? `dialog--${dialogName}` : undefined;
92
+ const dialog = await Fragment.load({
93
+ name: `open.ux.preview.client.adp.ui.${dialogName}`,
94
+ controller,
95
+ id
96
+ });
97
+ this.isDialogOpen = true;
98
+ dialog.attachBeforeClose(() => {
99
+ this.updateStatus(false);
100
+ });
101
+ await controller.setup(dialog);
102
+ this.updateStatus(true);
103
+ }
104
+
105
+ /**
106
+ * Updates open dialog status.
107
+ *
108
+ * @param isDialogOpen Flag indicating if there is an open dialog.
109
+ */
110
+ static updateStatus(isDialogOpen) {
111
+ this.isDialogOpen = isDialogOpen;
112
+ const event = new CustomEvent(OPEN_DIALOG_STATUS_CHANGED);
113
+ this.eventTarget.dispatchEvent(event);
114
+ }
115
+
116
+ /**
117
+ * Attach event handler for OPEN_DIALOG_STATUS_CHANGED event.
118
+ *
119
+ * @param handler Event handler.
120
+ * @returns Function that removes listener.
121
+ */
122
+ static onOpenDialogStatusChange(handler) {
123
+ this.eventTarget.addEventListener(OPEN_DIALOG_STATUS_CHANGED, handler);
124
+ return () => {
125
+ this.eventTarget.removeEventListener(OPEN_DIALOG_STATUS_CHANGED, handler);
126
+ };
127
+ }
128
+ }
129
+ var __exports = {
130
+ __esModule: true
131
+ };
132
+ __exports.DialogNames = DialogNames;
133
+ __exports.OPEN_DIALOG_STATUS_CHANGED = OPEN_DIALOG_STATUS_CHANGED;
134
+ __exports.DialogFactory = DialogFactory;
135
+ return __exports;
136
136
  });
137
137
  //# sourceMappingURL=dialog-factory.js.map
@@ -1,140 +1,140 @@
1
- "use strict";
2
-
3
- sap.ui.define(["sap/ui/rta/util/hasStableId", "sap/ui/fl/Utils", "./dialog-factory", "../i18n", "./utils"], function (hasStableId, FlUtils, ___dialog_factory, ___i18n, ___utils) {
4
- "use strict";
5
-
6
- const DialogFactory = ___dialog_factory["DialogFactory"];
7
- const DialogNames = ___dialog_factory["DialogNames"];
8
- const getTextBundle = ___i18n["getTextBundle"];
9
- const getReuseComponentChecker = ___utils["getReuseComponentChecker"];
10
- /**
11
- * Handler for enablement of Extend With Controller context menu entry
12
- *
13
- * @param control UI5 control.
14
- * @param syncViewsIds Runtime Authoring
15
- * @param isReuseComponent Function to check if the control is a reuse component.
16
- * @param isCloud Whether the application is running in the cloud
17
- *
18
- * @returns boolean whether menu item is enabled or not
19
- */
20
- function isControllerExtensionEnabledForControl(control, syncViewsIds, isReuseComponent, isCloud) {
21
- const viewId = FlUtils.getViewForControl(control).getId();
22
- const isControlInSyncView = syncViewsIds.includes(viewId);
23
- if (isCloud) {
24
- const isClickedControlReuseComponent = isReuseComponent(control.getId());
25
- return !isControlInSyncView && !isClickedControlReuseComponent;
26
- }
27
- return !isControlInSyncView;
28
- }
29
-
30
- /**
31
- * Handler for enablement of Extend With Controller context menu entry
32
- *
33
- * @param overlays Control overlays
34
- * @param syncViewsIds Runtime Authoring
35
- * @param isReuseComponent Function to check if the control is a reuse component.
36
- * @param isCloud Whether the application is running in the cloud
37
- *
38
- * @returns boolean whether menu item is enabled or not
39
- */
40
- const isControllerExtensionEnabled = (overlays, syncViewsIds, isReuseComponent, isCloud) => {
41
- if (overlays.length === 0 || overlays.length > 1) {
42
- return false;
43
- }
44
- return isControllerExtensionEnabledForControl(overlays[0].getElement(), syncViewsIds, isReuseComponent, isCloud);
45
- };
46
-
47
- /**
48
- * Determines whether the fragment command should be enabled based on the provided overlays.
49
- *
50
- * @param {ElementOverlay[]} overlays - An array of ElementOverlay objects representing the UI overlays.
51
- * @param {isReuseComponentApi} isReuseComponent - Function to check if the control is a reuse component.
52
- * @param {boolean} isCloud - Whether the application is running in the cloud.
53
- * @returns {boolean} True if the fragment command is enabled, false otherwise.
54
- */
55
- const isFragmentCommandEnabled = (overlays, isReuseComponent, isCloud) => {
56
- if (overlays.length === 0 || overlays.length > 1) {
57
- return false;
58
- }
59
- const control = overlays[0].getElement();
60
- const stableId = hasStableId(overlays[0]);
61
- if (isCloud) {
62
- return stableId && !isReuseComponent(control.getId());
63
- }
64
- return stableId;
65
- };
66
-
67
- /**
68
- * Determines the text that should be displayed for the Add Fragment context menu item.
69
- *
70
- * @param {ElementOverlay} overlay - An ElementOverlay object representing the UI overlay.
71
- * @param {isReuseComponentApi} isReuseComponentChecker - Function to check if the control is a reuse component.
72
- * @param {boolean} isCloud - Whether the application is running in the cloud.
73
- * @param {TextBundle} resources - The text bundle.
74
- * @returns {string} The text of the Add Fragment context menu item.
75
- */
76
- const getAddFragmentItemText = (overlay, isReuseComponentChecker, isCloud, resources) => {
77
- if (isCloud && isReuseComponentChecker(overlay.getElement().getId())) {
78
- return resources.getText('ADP_ADD_FRAGMENT_MENU_ITEM_REUSE_COMPONENT');
79
- }
80
- if (!hasStableId(overlay)) {
81
- return resources.getText('ADP_ADD_FRAGMENT_MENU_ITEM_UNSTABLE_ID');
82
- }
83
- return resources.getText('ADP_ADD_FRAGMENT_MENU_ITEM');
84
- };
85
-
86
- /**
87
- * Determines the text that should be displayed for Controller Extension context menu item.
88
- *
89
- * @param {ElementOverlay} overlay - An ElementOverlay object representing the UI overlay.
90
- * @param {isReuseComponentApi} isReuseComponentChecker - Function to check if the control is a reuse component.
91
- * @param {boolean} isCloud - Whether the application is running in the cloud.
92
- * @param {TextBundle} resources - The text bundle.
93
- * @returns {string} The text of the Add Fragment context menu item.
94
- */
95
- const getExtendControllerItemText = (overlay, isReuseComponentChecker, isCloud, resources) => {
96
- if (isCloud && isReuseComponentChecker(overlay.getElement().getId())) {
97
- return resources.getText('ADP_ADD_CONTROLLER_EXTENSION_MENU_ITEM_REUSE_COMPONENT');
98
- }
99
- return resources.getText('ADP_ADD_CONTROLLER_EXTENSION_MENU_ITEM');
100
- };
101
-
102
- /**
103
- * Adds a new item to the context menu
104
- *
105
- * @param rta Runtime Authoring
106
- * @param syncViewsIds Ids of all application sync views
107
- * @param ui5VersionInfo UI5 version information
108
- */
109
- const initDialogs = async (rta, syncViewsIds, ui5VersionInfo) => {
110
- const contextMenu = rta.getDefaultPlugins().contextMenu;
111
- const isCloud = rta.getFlexSettings().isCloud;
112
- const resources = await getTextBundle();
113
- const isReuseComponentChecker = await getReuseComponentChecker(ui5VersionInfo);
114
- contextMenu.addMenuItem({
115
- id: 'ADD_FRAGMENT',
116
- text: overlay => getAddFragmentItemText(overlay, isReuseComponentChecker, isCloud, resources),
117
- handler: async overlays => await DialogFactory.createDialog(overlays[0], rta, DialogNames.ADD_FRAGMENT),
118
- icon: 'sap-icon://attachment-html',
119
- enabled: overlays => isFragmentCommandEnabled(overlays, isReuseComponentChecker, isCloud)
120
- });
121
- contextMenu.addMenuItem({
122
- id: 'EXTEND_CONTROLLER',
123
- text: overlay => getExtendControllerItemText(overlay, isReuseComponentChecker, isCloud, resources),
124
- handler: async overlays => await DialogFactory.createDialog(overlays[0], rta, DialogNames.CONTROLLER_EXTENSION),
125
- icon: 'sap-icon://create-form',
126
- enabled: overlays => isControllerExtensionEnabled(overlays, syncViewsIds, isReuseComponentChecker, isCloud)
127
- });
128
- };
129
- var __exports = {
130
- __esModule: true
131
- };
132
- __exports.isControllerExtensionEnabledForControl = isControllerExtensionEnabledForControl;
133
- __exports.isControllerExtensionEnabled = isControllerExtensionEnabled;
134
- __exports.isFragmentCommandEnabled = isFragmentCommandEnabled;
135
- __exports.getAddFragmentItemText = getAddFragmentItemText;
136
- __exports.getExtendControllerItemText = getExtendControllerItemText;
137
- __exports.initDialogs = initDialogs;
138
- return __exports;
1
+ "use strict";
2
+
3
+ sap.ui.define(["sap/ui/rta/util/hasStableId", "sap/ui/fl/Utils", "./dialog-factory", "../i18n", "./utils"], function (hasStableId, FlUtils, ___dialog_factory, ___i18n, ___utils) {
4
+ "use strict";
5
+
6
+ const DialogFactory = ___dialog_factory["DialogFactory"];
7
+ const DialogNames = ___dialog_factory["DialogNames"];
8
+ const getTextBundle = ___i18n["getTextBundle"];
9
+ const getReuseComponentChecker = ___utils["getReuseComponentChecker"];
10
+ /**
11
+ * Handler for enablement of Extend With Controller context menu entry
12
+ *
13
+ * @param control UI5 control.
14
+ * @param syncViewsIds Runtime Authoring
15
+ * @param isReuseComponent Function to check if the control is a reuse component.
16
+ * @param isCloud Whether the application is running in the cloud
17
+ *
18
+ * @returns boolean whether menu item is enabled or not
19
+ */
20
+ function isControllerExtensionEnabledForControl(control, syncViewsIds, isReuseComponent, isCloud) {
21
+ const viewId = FlUtils.getViewForControl(control).getId();
22
+ const isControlInSyncView = syncViewsIds.includes(viewId);
23
+ if (isCloud) {
24
+ const isClickedControlReuseComponent = isReuseComponent(control.getId());
25
+ return !isControlInSyncView && !isClickedControlReuseComponent;
26
+ }
27
+ return !isControlInSyncView;
28
+ }
29
+
30
+ /**
31
+ * Handler for enablement of Extend With Controller context menu entry
32
+ *
33
+ * @param overlays Control overlays
34
+ * @param syncViewsIds Runtime Authoring
35
+ * @param isReuseComponent Function to check if the control is a reuse component.
36
+ * @param isCloud Whether the application is running in the cloud
37
+ *
38
+ * @returns boolean whether menu item is enabled or not
39
+ */
40
+ const isControllerExtensionEnabled = (overlays, syncViewsIds, isReuseComponent, isCloud) => {
41
+ if (overlays.length === 0 || overlays.length > 1) {
42
+ return false;
43
+ }
44
+ return isControllerExtensionEnabledForControl(overlays[0].getElement(), syncViewsIds, isReuseComponent, isCloud);
45
+ };
46
+
47
+ /**
48
+ * Determines whether the fragment command should be enabled based on the provided overlays.
49
+ *
50
+ * @param {ElementOverlay[]} overlays - An array of ElementOverlay objects representing the UI overlays.
51
+ * @param {isReuseComponentApi} isReuseComponent - Function to check if the control is a reuse component.
52
+ * @param {boolean} isCloud - Whether the application is running in the cloud.
53
+ * @returns {boolean} True if the fragment command is enabled, false otherwise.
54
+ */
55
+ const isFragmentCommandEnabled = (overlays, isReuseComponent, isCloud) => {
56
+ if (overlays.length === 0 || overlays.length > 1) {
57
+ return false;
58
+ }
59
+ const control = overlays[0].getElement();
60
+ const stableId = hasStableId(overlays[0]);
61
+ if (isCloud) {
62
+ return stableId && !isReuseComponent(control.getId());
63
+ }
64
+ return stableId;
65
+ };
66
+
67
+ /**
68
+ * Determines the text that should be displayed for the Add Fragment context menu item.
69
+ *
70
+ * @param {ElementOverlay} overlay - An ElementOverlay object representing the UI overlay.
71
+ * @param {isReuseComponentApi} isReuseComponentChecker - Function to check if the control is a reuse component.
72
+ * @param {boolean} isCloud - Whether the application is running in the cloud.
73
+ * @param {TextBundle} resources - The text bundle.
74
+ * @returns {string} The text of the Add Fragment context menu item.
75
+ */
76
+ const getAddFragmentItemText = (overlay, isReuseComponentChecker, isCloud, resources) => {
77
+ if (isCloud && isReuseComponentChecker(overlay.getElement().getId())) {
78
+ return resources.getText('ADP_ADD_FRAGMENT_MENU_ITEM_REUSE_COMPONENT');
79
+ }
80
+ if (!hasStableId(overlay)) {
81
+ return resources.getText('ADP_ADD_FRAGMENT_MENU_ITEM_UNSTABLE_ID');
82
+ }
83
+ return resources.getText('ADP_ADD_FRAGMENT_MENU_ITEM');
84
+ };
85
+
86
+ /**
87
+ * Determines the text that should be displayed for Controller Extension context menu item.
88
+ *
89
+ * @param {ElementOverlay} overlay - An ElementOverlay object representing the UI overlay.
90
+ * @param {isReuseComponentApi} isReuseComponentChecker - Function to check if the control is a reuse component.
91
+ * @param {boolean} isCloud - Whether the application is running in the cloud.
92
+ * @param {TextBundle} resources - The text bundle.
93
+ * @returns {string} The text of the Add Fragment context menu item.
94
+ */
95
+ const getExtendControllerItemText = (overlay, isReuseComponentChecker, isCloud, resources) => {
96
+ if (isCloud && isReuseComponentChecker(overlay.getElement().getId())) {
97
+ return resources.getText('ADP_ADD_CONTROLLER_EXTENSION_MENU_ITEM_REUSE_COMPONENT');
98
+ }
99
+ return resources.getText('ADP_ADD_CONTROLLER_EXTENSION_MENU_ITEM');
100
+ };
101
+
102
+ /**
103
+ * Adds a new item to the context menu
104
+ *
105
+ * @param rta Runtime Authoring
106
+ * @param syncViewsIds Ids of all application sync views
107
+ * @param ui5VersionInfo UI5 version information
108
+ */
109
+ const initDialogs = async (rta, syncViewsIds, ui5VersionInfo) => {
110
+ const contextMenu = rta.getDefaultPlugins().contextMenu;
111
+ const isCloud = rta.getFlexSettings().isCloud;
112
+ const resources = await getTextBundle();
113
+ const isReuseComponentChecker = await getReuseComponentChecker(ui5VersionInfo);
114
+ contextMenu.addMenuItem({
115
+ id: 'ADD_FRAGMENT',
116
+ text: overlay => getAddFragmentItemText(overlay, isReuseComponentChecker, isCloud, resources),
117
+ handler: async overlays => await DialogFactory.createDialog(overlays[0], rta, DialogNames.ADD_FRAGMENT),
118
+ icon: 'sap-icon://attachment-html',
119
+ enabled: overlays => isFragmentCommandEnabled(overlays, isReuseComponentChecker, isCloud)
120
+ });
121
+ contextMenu.addMenuItem({
122
+ id: 'EXTEND_CONTROLLER',
123
+ text: overlay => getExtendControllerItemText(overlay, isReuseComponentChecker, isCloud, resources),
124
+ handler: async overlays => await DialogFactory.createDialog(overlays[0], rta, DialogNames.CONTROLLER_EXTENSION),
125
+ icon: 'sap-icon://create-form',
126
+ enabled: overlays => isControllerExtensionEnabled(overlays, syncViewsIds, isReuseComponentChecker, isCloud)
127
+ });
128
+ };
129
+ var __exports = {
130
+ __esModule: true
131
+ };
132
+ __exports.isControllerExtensionEnabledForControl = isControllerExtensionEnabledForControl;
133
+ __exports.isControllerExtensionEnabled = isControllerExtensionEnabled;
134
+ __exports.isFragmentCommandEnabled = isFragmentCommandEnabled;
135
+ __exports.getAddFragmentItemText = getAddFragmentItemText;
136
+ __exports.getExtendControllerItemText = getExtendControllerItemText;
137
+ __exports.initDialogs = initDialogs;
138
+ return __exports;
139
139
  });
140
140
  //# sourceMappingURL=init-dialogs.js.map