@sap-ux/preview-middleware 0.19.39 → 0.19.40
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/add-fragment.js +46 -46
- package/dist/client/adp/api-handler.js +159 -159
- package/dist/client/adp/command-executor.js +75 -75
- package/dist/client/adp/control-utils.js +44 -44
- package/dist/client/adp/controllers/ControllerExtension.controller.js +210 -210
- package/dist/client/adp/controllers/ExtensionPoint.controller.js +139 -139
- package/dist/client/adp/controllers/FileExistsDialog.controller.js +66 -66
- package/dist/client/adp/dialog-factory.js +135 -135
- package/dist/client/adp/init-dialogs.js +163 -163
- package/dist/client/adp/quick-actions/add-new-subpage-quick-action-base.js +96 -96
- package/dist/client/adp/quick-actions/common/add-controller-to-page.js +60 -60
- package/dist/client/adp/quick-actions/common/create-page-action.js +54 -54
- package/dist/client/adp/quick-actions/common/op-add-custom-section.js +39 -39
- package/dist/client/adp/quick-actions/common/op-add-header-field.js +67 -67
- package/dist/client/adp/quick-actions/common/utils.js +18 -18
- package/dist/client/adp/quick-actions/control-types.js +23 -23
- package/dist/client/adp/quick-actions/dialog-enablement-validator.js +24 -24
- package/dist/client/adp/quick-actions/enablement-validator.js +4 -4
- package/dist/client/adp/quick-actions/fe-v2/add-new-subpage.js +81 -81
- package/dist/client/adp/quick-actions/fe-v2/change-table-actions.js +67 -67
- package/dist/client/adp/quick-actions/fe-v2/change-table-columns.js +101 -101
- package/dist/client/adp/quick-actions/fe-v2/create-table-action.js +107 -107
- package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +99 -99
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.js +78 -78
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-table-filtering.js +77 -77
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-variant-management.js +69 -69
- package/dist/client/adp/quick-actions/fe-v2/lr-toggle-clear-filter-bar.js +59 -59
- package/dist/client/adp/quick-actions/fe-v2/op-enable-empty-row-mode.js +93 -93
- package/dist/client/adp/quick-actions/fe-v2/op-enable-variant-management.js +84 -84
- package/dist/client/adp/quick-actions/fe-v2/registry.js +77 -77
- package/dist/client/adp/quick-actions/fe-v2/utils.js +116 -116
- package/dist/client/adp/quick-actions/fe-v4/add-new-subpage.js +138 -138
- package/dist/client/adp/quick-actions/fe-v4/change-table-actions.js +79 -79
- package/dist/client/adp/quick-actions/fe-v4/change-table-columns.js +75 -75
- package/dist/client/adp/quick-actions/fe-v4/create-table-action.js +53 -53
- package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column.js +49 -49
- package/dist/client/adp/quick-actions/fe-v4/enable-variant-management.js +81 -81
- package/dist/client/adp/quick-actions/fe-v4/lr-enable-semantic-date-range-filter-bar.js +56 -56
- package/dist/client/adp/quick-actions/fe-v4/lr-enable-table-filtering.js +84 -84
- package/dist/client/adp/quick-actions/fe-v4/lr-toggle-clear-filter-bar.js +53 -53
- package/dist/client/adp/quick-actions/fe-v4/op-enable-empty-row-mode.js +89 -89
- package/dist/client/adp/quick-actions/fe-v4/registry.js +60 -60
- package/dist/client/adp/quick-actions/fe-v4/utils.js +72 -72
- package/dist/client/adp/quick-actions/load.js +44 -44
- package/dist/client/adp/quick-actions/quick-action-base.js +64 -64
- package/dist/client/adp/utils.js +218 -218
- package/dist/client/cpe/additional-change-info/add-xml-additional-info.js +75 -75
- package/dist/client/cpe/changes/index.js +10 -10
- package/dist/client/cpe/changes/validator.js +39 -39
- package/dist/client/cpe/documentation.js +164 -164
- package/dist/client/cpe/feature-service.js +36 -36
- package/dist/client/cpe/logger.js +30 -30
- package/dist/client/cpe/outline/editable.js +37 -37
- package/dist/client/cpe/outline/nodes.js +203 -203
- package/dist/client/cpe/quick-actions/quick-action-definition.js +4 -4
- package/dist/client/cpe/quick-actions/registry.js +143 -143
- package/dist/client/cpe/quick-actions/utils.js +92 -92
- package/dist/client/cpe/types.js +4 -4
- package/dist/client/cpe/ui5-utils.js +33 -33
- package/dist/client/cpe/utils.js +111 -111
- package/dist/client/flp/WorkspaceConnector.js +92 -92
- package/dist/client/flp/common.js +28 -28
- package/dist/client/flp/enableFakeConnector.js +89 -89
- package/dist/client/flp/homepage/Component.js +14 -14
- package/dist/client/flp/initCdm.js +117 -117
- package/dist/client/flp/initConnectors.js +28 -28
- package/dist/client/flp/initRta.js +178 -178
- package/dist/client/i18n.js +56 -56
- package/dist/client/utils/additional-change-info.js +54 -54
- package/dist/client/utils/application.js +32 -32
- package/dist/client/utils/core.js +84 -84
- package/dist/client/utils/error.js +19 -19
- package/dist/client/utils/fe-v2.js +56 -56
- package/dist/client/utils/fe-v4.js +140 -140
- package/dist/client/utils/version.js +104 -104
- package/package.json +2 -2
|
@@ -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 data - Data to be passed to the dialog.
|
|
44
|
-
* @param options - Dialog options.
|
|
45
|
-
* @param telemetryData - Telemetry data.
|
|
46
|
-
*/
|
|
47
|
-
static async createDialog(overlay, rta, dialogName, data) {
|
|
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
|
-
}, data, 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, data);
|
|
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 data - Data to be passed to the dialog.
|
|
44
|
+
* @param options - Dialog options.
|
|
45
|
+
* @param telemetryData - Telemetry data.
|
|
46
|
+
*/
|
|
47
|
+
static async createDialog(overlay, rta, dialogName, data) {
|
|
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
|
+
}, data, 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, data);
|
|
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,165 +1,165 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["sap/ui/rta/util/hasStableId", "sap/ui/fl/Utils", "./dialog-factory", "../i18n", "./utils", "../utils/version"], function (hasStableId, FlUtils, ___dialog_factory, ___i18n, ___utils, ___utils_version) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
function __ui5_require_async(path) {
|
|
7
|
-
return new Promise(function (resolve, reject) {
|
|
8
|
-
sap.ui.require([path], function (module) {
|
|
9
|
-
if (!(module && module.__esModule)) {
|
|
10
|
-
module = module === null || !(typeof module === "object" && path.endsWith("/library")) ? {
|
|
11
|
-
default: module
|
|
12
|
-
} : module;
|
|
13
|
-
Object.defineProperty(module, "__esModule", {
|
|
14
|
-
value: true
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
resolve(module);
|
|
18
|
-
}, function (err) {
|
|
19
|
-
reject(err);
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
const DialogFactory = ___dialog_factory["DialogFactory"];
|
|
24
|
-
const DialogNames = ___dialog_factory["DialogNames"];
|
|
25
|
-
const getTextBundle = ___i18n["getTextBundle"];
|
|
26
|
-
const getReuseComponentChecker = ___utils["getReuseComponentChecker"];
|
|
27
|
-
const isLowerThanMinimalUi5Version = ___utils_version["isLowerThanMinimalUi5Version"];
|
|
28
|
-
/**
|
|
29
|
-
* Handler for enablement of Extend With Controller context menu entry
|
|
30
|
-
*
|
|
31
|
-
* @param control UI5 control.
|
|
32
|
-
* @param syncViewsIds Runtime Authoring
|
|
33
|
-
* @param isReuseComponent Function to check if the control is a reuse component.
|
|
34
|
-
* @param isCloud Whether the application is running in the cloud
|
|
35
|
-
*
|
|
36
|
-
* @returns boolean whether menu item is enabled or not
|
|
37
|
-
*/
|
|
38
|
-
function isControllerExtensionEnabledForControl(control, syncViewsIds, isReuseComponent, isCloud) {
|
|
39
|
-
const viewId = FlUtils.getViewForControl(control).getId();
|
|
40
|
-
const isControlInSyncView = syncViewsIds.includes(viewId);
|
|
41
|
-
if (isCloud) {
|
|
42
|
-
const isClickedControlReuseComponent = isReuseComponent(control.getId());
|
|
43
|
-
return !isControlInSyncView && !isClickedControlReuseComponent;
|
|
44
|
-
}
|
|
45
|
-
return !isControlInSyncView;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Handler for enablement of Extend With Controller context menu entry
|
|
50
|
-
*
|
|
51
|
-
* @param overlays Control overlays
|
|
52
|
-
* @param syncViewsIds Runtime Authoring
|
|
53
|
-
* @param isReuseComponent Function to check if the control is a reuse component.
|
|
54
|
-
* @param isCloud Whether the application is running in the cloud
|
|
55
|
-
*
|
|
56
|
-
* @returns boolean whether menu item is enabled or not
|
|
57
|
-
*/
|
|
58
|
-
const isControllerExtensionEnabled = (overlays, syncViewsIds, isReuseComponent, isCloud) => {
|
|
59
|
-
if (overlays.length === 0 || overlays.length > 1) {
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
return isControllerExtensionEnabledForControl(overlays[0].getElement(), syncViewsIds, isReuseComponent, isCloud);
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Determines whether the fragment command should be enabled based on the provided overlays.
|
|
67
|
-
*
|
|
68
|
-
* @param {ElementOverlay[]} overlays - An array of ElementOverlay objects representing the UI overlays.
|
|
69
|
-
* @param {isReuseComponentApi} isReuseComponent - Function to check if the control is a reuse component.
|
|
70
|
-
* @param {boolean} isCloud - Whether the application is running in the cloud.
|
|
71
|
-
* @returns {boolean} True if the fragment command is enabled, false otherwise.
|
|
72
|
-
*/
|
|
73
|
-
const isFragmentCommandEnabled = (overlays, isReuseComponent, isCloud) => {
|
|
74
|
-
if (overlays.length === 0 || overlays.length > 1) {
|
|
75
|
-
return false;
|
|
76
|
-
}
|
|
77
|
-
const control = overlays[0].getElement();
|
|
78
|
-
const stableId = hasStableId(overlays[0]);
|
|
79
|
-
if (isCloud) {
|
|
80
|
-
return stableId && !isReuseComponent(control.getId());
|
|
81
|
-
}
|
|
82
|
-
return stableId;
|
|
83
|
-
};
|
|
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
|
-
* @param {isReuseComponentApi} isReuseComponentChecker - Function to check if the control is a reuse component.
|
|
90
|
-
* @param {boolean} isCloud - Whether the application is running in the cloud.
|
|
91
|
-
* @param {TextBundle} resources - The text bundle.
|
|
92
|
-
* @returns {string} The text of the Add Fragment context menu item.
|
|
93
|
-
*/
|
|
94
|
-
const getAddFragmentItemText = (overlay, isReuseComponentChecker, isCloud, resources) => {
|
|
95
|
-
if (isCloud && isReuseComponentChecker(overlay.getElement().getId())) {
|
|
96
|
-
return resources.getText('ADP_ADD_FRAGMENT_MENU_ITEM_REUSE_COMPONENT');
|
|
97
|
-
}
|
|
98
|
-
if (!hasStableId(overlay)) {
|
|
99
|
-
return resources.getText('ADP_ADD_FRAGMENT_MENU_ITEM_UNSTABLE_ID');
|
|
100
|
-
}
|
|
101
|
-
return resources.getText('ADP_ADD_FRAGMENT_MENU_ITEM');
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Determines the text that should be displayed for Controller Extension context menu item.
|
|
106
|
-
*
|
|
107
|
-
* @param {ElementOverlay} overlay - An ElementOverlay object representing the UI overlay.
|
|
108
|
-
* @param {isReuseComponentApi} isReuseComponentChecker - Function to check if the control is a reuse component.
|
|
109
|
-
* @param {boolean} isCloud - Whether the application is running in the cloud.
|
|
110
|
-
* @param {TextBundle} resources - The text bundle.
|
|
111
|
-
* @returns {string} The text of the Add Fragment context menu item.
|
|
112
|
-
*/
|
|
113
|
-
const getExtendControllerItemText = (overlay, isReuseComponentChecker, isCloud, resources) => {
|
|
114
|
-
if (isCloud && isReuseComponentChecker(overlay.getElement().getId())) {
|
|
115
|
-
return resources.getText('ADP_ADD_CONTROLLER_EXTENSION_MENU_ITEM_REUSE_COMPONENT');
|
|
116
|
-
}
|
|
117
|
-
return resources.getText('ADP_ADD_CONTROLLER_EXTENSION_MENU_ITEM');
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Adds a new item to the context menu
|
|
122
|
-
*
|
|
123
|
-
* @param rta Runtime Authoring
|
|
124
|
-
* @param syncViewsIds Ids of all application sync views
|
|
125
|
-
* @param ui5VersionInfo UI5 version information
|
|
126
|
-
*/
|
|
127
|
-
const initDialogs = async (rta, syncViewsIds, ui5VersionInfo) => {
|
|
128
|
-
const contextMenu = rta.getDefaultPlugins().contextMenu;
|
|
129
|
-
const isCloud = rta.getFlexSettings().isCloud;
|
|
130
|
-
const resources = await getTextBundle();
|
|
131
|
-
const isReuseComponentChecker = await getReuseComponentChecker(ui5VersionInfo);
|
|
132
|
-
if (isLowerThanMinimalUi5Version(ui5VersionInfo, {
|
|
133
|
-
major: 1,
|
|
134
|
-
minor: 136
|
|
135
|
-
})) {
|
|
136
|
-
contextMenu.addMenuItem({
|
|
137
|
-
id: 'ADD_FRAGMENT',
|
|
138
|
-
text: overlay => getAddFragmentItemText(overlay, isReuseComponentChecker, isCloud, resources),
|
|
139
|
-
handler: async overlays => await DialogFactory.createDialog(overlays[0], rta, DialogNames.ADD_FRAGMENT),
|
|
140
|
-
icon: 'sap-icon://attachment-html',
|
|
141
|
-
enabled: overlays => isFragmentCommandEnabled(overlays, isReuseComponentChecker, isCloud)
|
|
142
|
-
});
|
|
143
|
-
} else {
|
|
144
|
-
(await __ui5_require_async('open/ux/preview/client/adp/add-fragment')).initAddXMLPlugin(rta);
|
|
145
|
-
}
|
|
146
|
-
contextMenu.addMenuItem({
|
|
147
|
-
id: 'EXTEND_CONTROLLER',
|
|
148
|
-
text: overlay => getExtendControllerItemText(overlay, isReuseComponentChecker, isCloud, resources),
|
|
149
|
-
handler: async overlays => await DialogFactory.createDialog(overlays[0], rta, DialogNames.CONTROLLER_EXTENSION),
|
|
150
|
-
icon: 'sap-icon://create-form',
|
|
151
|
-
enabled: overlays => isControllerExtensionEnabled(overlays, syncViewsIds, isReuseComponentChecker, isCloud)
|
|
152
|
-
});
|
|
153
|
-
};
|
|
154
|
-
var __exports = {
|
|
155
|
-
__esModule: true
|
|
156
|
-
};
|
|
157
|
-
__exports.isControllerExtensionEnabledForControl = isControllerExtensionEnabledForControl;
|
|
158
|
-
__exports.isControllerExtensionEnabled = isControllerExtensionEnabled;
|
|
159
|
-
__exports.isFragmentCommandEnabled = isFragmentCommandEnabled;
|
|
160
|
-
__exports.getAddFragmentItemText = getAddFragmentItemText;
|
|
161
|
-
__exports.getExtendControllerItemText = getExtendControllerItemText;
|
|
162
|
-
__exports.initDialogs = initDialogs;
|
|
163
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["sap/ui/rta/util/hasStableId", "sap/ui/fl/Utils", "./dialog-factory", "../i18n", "./utils", "../utils/version"], function (hasStableId, FlUtils, ___dialog_factory, ___i18n, ___utils, ___utils_version) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
function __ui5_require_async(path) {
|
|
7
|
+
return new Promise(function (resolve, reject) {
|
|
8
|
+
sap.ui.require([path], function (module) {
|
|
9
|
+
if (!(module && module.__esModule)) {
|
|
10
|
+
module = module === null || !(typeof module === "object" && path.endsWith("/library")) ? {
|
|
11
|
+
default: module
|
|
12
|
+
} : module;
|
|
13
|
+
Object.defineProperty(module, "__esModule", {
|
|
14
|
+
value: true
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
resolve(module);
|
|
18
|
+
}, function (err) {
|
|
19
|
+
reject(err);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
const DialogFactory = ___dialog_factory["DialogFactory"];
|
|
24
|
+
const DialogNames = ___dialog_factory["DialogNames"];
|
|
25
|
+
const getTextBundle = ___i18n["getTextBundle"];
|
|
26
|
+
const getReuseComponentChecker = ___utils["getReuseComponentChecker"];
|
|
27
|
+
const isLowerThanMinimalUi5Version = ___utils_version["isLowerThanMinimalUi5Version"];
|
|
28
|
+
/**
|
|
29
|
+
* Handler for enablement of Extend With Controller context menu entry
|
|
30
|
+
*
|
|
31
|
+
* @param control UI5 control.
|
|
32
|
+
* @param syncViewsIds Runtime Authoring
|
|
33
|
+
* @param isReuseComponent Function to check if the control is a reuse component.
|
|
34
|
+
* @param isCloud Whether the application is running in the cloud
|
|
35
|
+
*
|
|
36
|
+
* @returns boolean whether menu item is enabled or not
|
|
37
|
+
*/
|
|
38
|
+
function isControllerExtensionEnabledForControl(control, syncViewsIds, isReuseComponent, isCloud) {
|
|
39
|
+
const viewId = FlUtils.getViewForControl(control).getId();
|
|
40
|
+
const isControlInSyncView = syncViewsIds.includes(viewId);
|
|
41
|
+
if (isCloud) {
|
|
42
|
+
const isClickedControlReuseComponent = isReuseComponent(control.getId());
|
|
43
|
+
return !isControlInSyncView && !isClickedControlReuseComponent;
|
|
44
|
+
}
|
|
45
|
+
return !isControlInSyncView;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Handler for enablement of Extend With Controller context menu entry
|
|
50
|
+
*
|
|
51
|
+
* @param overlays Control overlays
|
|
52
|
+
* @param syncViewsIds Runtime Authoring
|
|
53
|
+
* @param isReuseComponent Function to check if the control is a reuse component.
|
|
54
|
+
* @param isCloud Whether the application is running in the cloud
|
|
55
|
+
*
|
|
56
|
+
* @returns boolean whether menu item is enabled or not
|
|
57
|
+
*/
|
|
58
|
+
const isControllerExtensionEnabled = (overlays, syncViewsIds, isReuseComponent, isCloud) => {
|
|
59
|
+
if (overlays.length === 0 || overlays.length > 1) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
return isControllerExtensionEnabledForControl(overlays[0].getElement(), syncViewsIds, isReuseComponent, isCloud);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Determines whether the fragment command should be enabled based on the provided overlays.
|
|
67
|
+
*
|
|
68
|
+
* @param {ElementOverlay[]} overlays - An array of ElementOverlay objects representing the UI overlays.
|
|
69
|
+
* @param {isReuseComponentApi} isReuseComponent - Function to check if the control is a reuse component.
|
|
70
|
+
* @param {boolean} isCloud - Whether the application is running in the cloud.
|
|
71
|
+
* @returns {boolean} True if the fragment command is enabled, false otherwise.
|
|
72
|
+
*/
|
|
73
|
+
const isFragmentCommandEnabled = (overlays, isReuseComponent, isCloud) => {
|
|
74
|
+
if (overlays.length === 0 || overlays.length > 1) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
const control = overlays[0].getElement();
|
|
78
|
+
const stableId = hasStableId(overlays[0]);
|
|
79
|
+
if (isCloud) {
|
|
80
|
+
return stableId && !isReuseComponent(control.getId());
|
|
81
|
+
}
|
|
82
|
+
return stableId;
|
|
83
|
+
};
|
|
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
|
+
* @param {isReuseComponentApi} isReuseComponentChecker - Function to check if the control is a reuse component.
|
|
90
|
+
* @param {boolean} isCloud - Whether the application is running in the cloud.
|
|
91
|
+
* @param {TextBundle} resources - The text bundle.
|
|
92
|
+
* @returns {string} The text of the Add Fragment context menu item.
|
|
93
|
+
*/
|
|
94
|
+
const getAddFragmentItemText = (overlay, isReuseComponentChecker, isCloud, resources) => {
|
|
95
|
+
if (isCloud && isReuseComponentChecker(overlay.getElement().getId())) {
|
|
96
|
+
return resources.getText('ADP_ADD_FRAGMENT_MENU_ITEM_REUSE_COMPONENT');
|
|
97
|
+
}
|
|
98
|
+
if (!hasStableId(overlay)) {
|
|
99
|
+
return resources.getText('ADP_ADD_FRAGMENT_MENU_ITEM_UNSTABLE_ID');
|
|
100
|
+
}
|
|
101
|
+
return resources.getText('ADP_ADD_FRAGMENT_MENU_ITEM');
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Determines the text that should be displayed for Controller Extension context menu item.
|
|
106
|
+
*
|
|
107
|
+
* @param {ElementOverlay} overlay - An ElementOverlay object representing the UI overlay.
|
|
108
|
+
* @param {isReuseComponentApi} isReuseComponentChecker - Function to check if the control is a reuse component.
|
|
109
|
+
* @param {boolean} isCloud - Whether the application is running in the cloud.
|
|
110
|
+
* @param {TextBundle} resources - The text bundle.
|
|
111
|
+
* @returns {string} The text of the Add Fragment context menu item.
|
|
112
|
+
*/
|
|
113
|
+
const getExtendControllerItemText = (overlay, isReuseComponentChecker, isCloud, resources) => {
|
|
114
|
+
if (isCloud && isReuseComponentChecker(overlay.getElement().getId())) {
|
|
115
|
+
return resources.getText('ADP_ADD_CONTROLLER_EXTENSION_MENU_ITEM_REUSE_COMPONENT');
|
|
116
|
+
}
|
|
117
|
+
return resources.getText('ADP_ADD_CONTROLLER_EXTENSION_MENU_ITEM');
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Adds a new item to the context menu
|
|
122
|
+
*
|
|
123
|
+
* @param rta Runtime Authoring
|
|
124
|
+
* @param syncViewsIds Ids of all application sync views
|
|
125
|
+
* @param ui5VersionInfo UI5 version information
|
|
126
|
+
*/
|
|
127
|
+
const initDialogs = async (rta, syncViewsIds, ui5VersionInfo) => {
|
|
128
|
+
const contextMenu = rta.getDefaultPlugins().contextMenu;
|
|
129
|
+
const isCloud = rta.getFlexSettings().isCloud;
|
|
130
|
+
const resources = await getTextBundle();
|
|
131
|
+
const isReuseComponentChecker = await getReuseComponentChecker(ui5VersionInfo);
|
|
132
|
+
if (isLowerThanMinimalUi5Version(ui5VersionInfo, {
|
|
133
|
+
major: 1,
|
|
134
|
+
minor: 136
|
|
135
|
+
})) {
|
|
136
|
+
contextMenu.addMenuItem({
|
|
137
|
+
id: 'ADD_FRAGMENT',
|
|
138
|
+
text: overlay => getAddFragmentItemText(overlay, isReuseComponentChecker, isCloud, resources),
|
|
139
|
+
handler: async overlays => await DialogFactory.createDialog(overlays[0], rta, DialogNames.ADD_FRAGMENT),
|
|
140
|
+
icon: 'sap-icon://attachment-html',
|
|
141
|
+
enabled: overlays => isFragmentCommandEnabled(overlays, isReuseComponentChecker, isCloud)
|
|
142
|
+
});
|
|
143
|
+
} else {
|
|
144
|
+
(await __ui5_require_async('open/ux/preview/client/adp/add-fragment')).initAddXMLPlugin(rta);
|
|
145
|
+
}
|
|
146
|
+
contextMenu.addMenuItem({
|
|
147
|
+
id: 'EXTEND_CONTROLLER',
|
|
148
|
+
text: overlay => getExtendControllerItemText(overlay, isReuseComponentChecker, isCloud, resources),
|
|
149
|
+
handler: async overlays => await DialogFactory.createDialog(overlays[0], rta, DialogNames.CONTROLLER_EXTENSION),
|
|
150
|
+
icon: 'sap-icon://create-form',
|
|
151
|
+
enabled: overlays => isControllerExtensionEnabled(overlays, syncViewsIds, isReuseComponentChecker, isCloud)
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
var __exports = {
|
|
155
|
+
__esModule: true
|
|
156
|
+
};
|
|
157
|
+
__exports.isControllerExtensionEnabledForControl = isControllerExtensionEnabledForControl;
|
|
158
|
+
__exports.isControllerExtensionEnabled = isControllerExtensionEnabled;
|
|
159
|
+
__exports.isFragmentCommandEnabled = isFragmentCommandEnabled;
|
|
160
|
+
__exports.getAddFragmentItemText = getAddFragmentItemText;
|
|
161
|
+
__exports.getExtendControllerItemText = getExtendControllerItemText;
|
|
162
|
+
__exports.initDialogs = initDialogs;
|
|
163
|
+
return __exports;
|
|
164
164
|
});
|
|
165
165
|
//# sourceMappingURL=init-dialogs.js.map
|