@sap-ux/preview-middleware 0.18.20 → 0.18.23
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/api-handler.js +153 -153
- package/dist/client/adp/api-handler.ts +2 -2
- package/dist/client/adp/command-executor.js +75 -75
- package/dist/client/adp/control-utils.js +44 -44
- package/dist/client/adp/controllers/BaseDialog.controller.js +187 -187
- package/dist/client/adp/controllers/ControllerExtension.controller.js +209 -209
- package/dist/client/adp/controllers/ExtensionPoint.controller.js +138 -138
- package/dist/client/adp/controllers/FileExistsDialog.controller.js +66 -66
- package/dist/client/adp/dialog-factory.js +133 -133
- package/dist/client/adp/init-dialogs.js +107 -107
- package/dist/client/adp/quick-actions/common/add-controller-to-page.js +55 -55
- package/dist/client/adp/quick-actions/common/add-new-annotation-file.js +24 -7
- package/dist/client/adp/quick-actions/common/add-new-annotation-file.ts +25 -7
- package/dist/client/adp/quick-actions/common/add-new-subpage.js +134 -138
- package/dist/client/adp/quick-actions/common/add-new-subpage.ts +0 -5
- package/dist/client/adp/quick-actions/common/create-page-action.js +51 -51
- package/dist/client/adp/quick-actions/common/op-add-custom-section.js +36 -36
- package/dist/client/adp/quick-actions/common/op-add-header-field.js +61 -61
- package/dist/client/adp/quick-actions/common/utils.js +18 -18
- package/dist/client/adp/quick-actions/control-types.js +21 -21
- 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/change-table-columns.js +101 -101
- package/dist/client/adp/quick-actions/fe-v2/create-table-action.js +104 -104
- package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +96 -96
- 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 +76 -76
- package/dist/client/adp/quick-actions/fe-v2/utils.js +116 -116
- package/dist/client/adp/quick-actions/fe-v4/change-table-columns.js +73 -73
- package/dist/client/adp/quick-actions/fe-v4/create-table-action.js +50 -50
- package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column.js +46 -46
- 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 +82 -82
- 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 +58 -58
- package/dist/client/adp/quick-actions/fe-v4/utils.js +47 -47
- package/dist/client/adp/quick-actions/load.js +44 -44
- package/dist/client/adp/quick-actions/quick-action-base.js +53 -53
- package/dist/client/adp/utils.js +160 -160
- 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 +222 -222
- 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 +138 -138
- package/dist/client/flp/WorkspaceConnector.js +86 -86
- package/dist/client/flp/common.js +28 -28
- package/dist/client/flp/enableFakeConnector.js +83 -83
- 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/application.js +32 -32
- package/dist/client/utils/core.js +68 -68
- package/dist/client/utils/error.js +19 -19
- package/dist/client/utils/fe-v2.js +56 -56
- package/dist/client/utils/fe-v4.js +141 -141
- package/dist/client/utils/version.js +104 -104
- package/package.json +6 -6
|
@@ -1,135 +1,135 @@
|
|
|
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
|
-
*/
|
|
46
|
-
static async createDialog(overlay, rta, dialogName, extensionPointData) {
|
|
47
|
-
let options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
48
|
-
if (this.isDialogOpen) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
let controller;
|
|
52
|
-
const resources = await getTextBundle();
|
|
53
|
-
switch (dialogName) {
|
|
54
|
-
case DialogNames.ADD_FRAGMENT:
|
|
55
|
-
controller = new AddFragment(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, {
|
|
56
|
-
...('aggregation' in options && {
|
|
57
|
-
aggregation: options.aggregation
|
|
58
|
-
}),
|
|
59
|
-
...('defaultAggregationArrayIndex' in options && {
|
|
60
|
-
defaultAggregationArrayIndex: options.defaultAggregationArrayIndex
|
|
61
|
-
}),
|
|
62
|
-
title: resources.getText(options.title ?? 'ADP_ADD_FRAGMENT_DIALOG_TITLE')
|
|
63
|
-
});
|
|
64
|
-
break;
|
|
65
|
-
case DialogNames.ADD_TABLE_COLUMN_FRAGMENTS:
|
|
66
|
-
controller = new AddTableColumnFragments(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, {
|
|
67
|
-
...('aggregation' in options && {
|
|
68
|
-
aggregation: options.aggregation
|
|
69
|
-
}),
|
|
70
|
-
title: resources.getText(options.title ?? 'ADP_ADD_FRAGMENT_DIALOG_TITLE')
|
|
71
|
-
});
|
|
72
|
-
break;
|
|
73
|
-
case DialogNames.CONTROLLER_EXTENSION:
|
|
74
|
-
controller = new ControllerExtension(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta);
|
|
75
|
-
break;
|
|
76
|
-
case DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT:
|
|
77
|
-
controller = new ExtensionPoint(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, extensionPointData);
|
|
78
|
-
break;
|
|
79
|
-
case DialogNames.FILE_EXISTS:
|
|
80
|
-
controller = new FileExistsDialog(`open.ux.preview.client.adp.controllers.${dialogName}`, options);
|
|
81
|
-
break;
|
|
82
|
-
case DialogNames.ADD_SUBPAGE:
|
|
83
|
-
controller = new AddSubpage(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, {
|
|
84
|
-
...options,
|
|
85
|
-
title: resources.getText(options.title ?? 'ADD_SUB_PAGE_DIALOG_TITLE')
|
|
86
|
-
});
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
const id = dialogName === DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT ? `dialog--${dialogName}` : undefined;
|
|
90
|
-
const dialog = await Fragment.load({
|
|
91
|
-
name: `open.ux.preview.client.adp.ui.${dialogName}`,
|
|
92
|
-
controller,
|
|
93
|
-
id
|
|
94
|
-
});
|
|
95
|
-
this.isDialogOpen = true;
|
|
96
|
-
dialog.attachBeforeClose(() => {
|
|
97
|
-
this.updateStatus(false);
|
|
98
|
-
});
|
|
99
|
-
await controller.setup(dialog);
|
|
100
|
-
this.updateStatus(true);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Updates open dialog status.
|
|
105
|
-
*
|
|
106
|
-
* @param isDialogOpen Flag indicating if there is an open dialog.
|
|
107
|
-
*/
|
|
108
|
-
static updateStatus(isDialogOpen) {
|
|
109
|
-
this.isDialogOpen = isDialogOpen;
|
|
110
|
-
const event = new CustomEvent(OPEN_DIALOG_STATUS_CHANGED);
|
|
111
|
-
this.eventTarget.dispatchEvent(event);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Attach event handler for OPEN_DIALOG_STATUS_CHANGED event.
|
|
116
|
-
*
|
|
117
|
-
* @param handler Event handler.
|
|
118
|
-
* @returns Function that removes listener.
|
|
119
|
-
*/
|
|
120
|
-
static onOpenDialogStatusChange(handler) {
|
|
121
|
-
this.eventTarget.addEventListener(OPEN_DIALOG_STATUS_CHANGED, handler);
|
|
122
|
-
return () => {
|
|
123
|
-
this.eventTarget.removeEventListener(OPEN_DIALOG_STATUS_CHANGED, handler);
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
var __exports = {
|
|
128
|
-
__esModule: true
|
|
129
|
-
};
|
|
130
|
-
__exports.DialogNames = DialogNames;
|
|
131
|
-
__exports.OPEN_DIALOG_STATUS_CHANGED = OPEN_DIALOG_STATUS_CHANGED;
|
|
132
|
-
__exports.DialogFactory = DialogFactory;
|
|
133
|
-
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
|
+
*/
|
|
46
|
+
static async createDialog(overlay, rta, dialogName, extensionPointData) {
|
|
47
|
+
let options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
48
|
+
if (this.isDialogOpen) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
let controller;
|
|
52
|
+
const resources = await getTextBundle();
|
|
53
|
+
switch (dialogName) {
|
|
54
|
+
case DialogNames.ADD_FRAGMENT:
|
|
55
|
+
controller = new AddFragment(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, {
|
|
56
|
+
...('aggregation' in options && {
|
|
57
|
+
aggregation: options.aggregation
|
|
58
|
+
}),
|
|
59
|
+
...('defaultAggregationArrayIndex' in options && {
|
|
60
|
+
defaultAggregationArrayIndex: options.defaultAggregationArrayIndex
|
|
61
|
+
}),
|
|
62
|
+
title: resources.getText(options.title ?? 'ADP_ADD_FRAGMENT_DIALOG_TITLE')
|
|
63
|
+
});
|
|
64
|
+
break;
|
|
65
|
+
case DialogNames.ADD_TABLE_COLUMN_FRAGMENTS:
|
|
66
|
+
controller = new AddTableColumnFragments(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, {
|
|
67
|
+
...('aggregation' in options && {
|
|
68
|
+
aggregation: options.aggregation
|
|
69
|
+
}),
|
|
70
|
+
title: resources.getText(options.title ?? 'ADP_ADD_FRAGMENT_DIALOG_TITLE')
|
|
71
|
+
});
|
|
72
|
+
break;
|
|
73
|
+
case DialogNames.CONTROLLER_EXTENSION:
|
|
74
|
+
controller = new ControllerExtension(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta);
|
|
75
|
+
break;
|
|
76
|
+
case DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT:
|
|
77
|
+
controller = new ExtensionPoint(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, extensionPointData);
|
|
78
|
+
break;
|
|
79
|
+
case DialogNames.FILE_EXISTS:
|
|
80
|
+
controller = new FileExistsDialog(`open.ux.preview.client.adp.controllers.${dialogName}`, options);
|
|
81
|
+
break;
|
|
82
|
+
case DialogNames.ADD_SUBPAGE:
|
|
83
|
+
controller = new AddSubpage(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, {
|
|
84
|
+
...options,
|
|
85
|
+
title: resources.getText(options.title ?? 'ADD_SUB_PAGE_DIALOG_TITLE')
|
|
86
|
+
});
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
const id = dialogName === DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT ? `dialog--${dialogName}` : undefined;
|
|
90
|
+
const dialog = await Fragment.load({
|
|
91
|
+
name: `open.ux.preview.client.adp.ui.${dialogName}`,
|
|
92
|
+
controller,
|
|
93
|
+
id
|
|
94
|
+
});
|
|
95
|
+
this.isDialogOpen = true;
|
|
96
|
+
dialog.attachBeforeClose(() => {
|
|
97
|
+
this.updateStatus(false);
|
|
98
|
+
});
|
|
99
|
+
await controller.setup(dialog);
|
|
100
|
+
this.updateStatus(true);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Updates open dialog status.
|
|
105
|
+
*
|
|
106
|
+
* @param isDialogOpen Flag indicating if there is an open dialog.
|
|
107
|
+
*/
|
|
108
|
+
static updateStatus(isDialogOpen) {
|
|
109
|
+
this.isDialogOpen = isDialogOpen;
|
|
110
|
+
const event = new CustomEvent(OPEN_DIALOG_STATUS_CHANGED);
|
|
111
|
+
this.eventTarget.dispatchEvent(event);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Attach event handler for OPEN_DIALOG_STATUS_CHANGED event.
|
|
116
|
+
*
|
|
117
|
+
* @param handler Event handler.
|
|
118
|
+
* @returns Function that removes listener.
|
|
119
|
+
*/
|
|
120
|
+
static onOpenDialogStatusChange(handler) {
|
|
121
|
+
this.eventTarget.addEventListener(OPEN_DIALOG_STATUS_CHANGED, handler);
|
|
122
|
+
return () => {
|
|
123
|
+
this.eventTarget.removeEventListener(OPEN_DIALOG_STATUS_CHANGED, handler);
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
var __exports = {
|
|
128
|
+
__esModule: true
|
|
129
|
+
};
|
|
130
|
+
__exports.DialogNames = DialogNames;
|
|
131
|
+
__exports.OPEN_DIALOG_STATUS_CHANGED = OPEN_DIALOG_STATUS_CHANGED;
|
|
132
|
+
__exports.DialogFactory = DialogFactory;
|
|
133
|
+
return __exports;
|
|
134
134
|
});
|
|
135
135
|
//# sourceMappingURL=dialog-factory.js.map
|
|
@@ -1,109 +1,109 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["sap/ui/rta/util/hasStableId", "sap/ui/fl/Utils", "../cpe/utils", "./dialog-factory"], function (hasStableId, FlUtils, ___cpe_utils, ___dialog_factory) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
const isReuseComponent = ___cpe_utils["isReuseComponent"];
|
|
7
|
-
const DialogFactory = ___dialog_factory["DialogFactory"];
|
|
8
|
-
const DialogNames = ___dialog_factory["DialogNames"];
|
|
9
|
-
/**
|
|
10
|
-
* Handler for enablement of Extend With Controller context menu entry
|
|
11
|
-
*
|
|
12
|
-
* @param control UI5 control.
|
|
13
|
-
* @param syncViewsIds Runtime Authoring
|
|
14
|
-
* @param ui5VersionInfo UI5 version information
|
|
15
|
-
* @param isCloud Whether the application is running in the cloud
|
|
16
|
-
*
|
|
17
|
-
* @returns boolean whether menu item is enabled or not
|
|
18
|
-
*/
|
|
19
|
-
function isControllerExtensionEnabledForControl(control, syncViewsIds, ui5VersionInfo, isCloud) {
|
|
20
|
-
const clickedControlId = FlUtils.getViewForControl(control).getId();
|
|
21
|
-
const isControlInSyncView = syncViewsIds.includes(clickedControlId);
|
|
22
|
-
if (isCloud) {
|
|
23
|
-
const isClickedControlReuseComponent = isReuseComponent(clickedControlId, ui5VersionInfo);
|
|
24
|
-
return !isControlInSyncView && !isClickedControlReuseComponent;
|
|
25
|
-
}
|
|
26
|
-
return !isControlInSyncView;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Handler for enablement of Extend With Controller context menu entry
|
|
31
|
-
*
|
|
32
|
-
* @param overlays Control overlays
|
|
33
|
-
* @param syncViewsIds Runtime Authoring
|
|
34
|
-
* @param ui5VersionInfo UI5 version information
|
|
35
|
-
* @param isCloud Whether the application is running in the cloud
|
|
36
|
-
*
|
|
37
|
-
* @returns boolean whether menu item is enabled or not
|
|
38
|
-
*/
|
|
39
|
-
const isControllerExtensionEnabled = (overlays, syncViewsIds, ui5VersionInfo, isCloud) => {
|
|
40
|
-
if (overlays.length === 0 || overlays.length > 1) {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
return isControllerExtensionEnabledForControl(overlays[0].getElement(), syncViewsIds, ui5VersionInfo, isCloud);
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Determines whether the fragment command should be enabled based on the provided overlays.
|
|
48
|
-
*
|
|
49
|
-
* @param {ElementOverlay[]} overlays - An array of ElementOverlay objects representing the UI overlays.
|
|
50
|
-
* @param ui5VersionInfo UI5 version information
|
|
51
|
-
* @returns {boolean} True if the fragment command is enabled, false otherwise.
|
|
52
|
-
*/
|
|
53
|
-
const isFragmentCommandEnabled = (overlays, ui5VersionInfo) => {
|
|
54
|
-
if (overlays.length === 0 || overlays.length > 1) {
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
const control = overlays[0].getElement();
|
|
58
|
-
return hasStableId(overlays[0]) && !isReuseComponent(control.getId(), ui5VersionInfo);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Determines the text that should be displayed for the Add Fragment context menu item.
|
|
63
|
-
*
|
|
64
|
-
* @param {ElementOverlay} overlay - An ElementOverlay object representing the UI overlay.
|
|
65
|
-
* @returns {string} The text of the Add Fragment context menu item.
|
|
66
|
-
*/
|
|
67
|
-
const getAddFragmentItemText = overlay => {
|
|
68
|
-
if (!hasStableId(overlay)) {
|
|
69
|
-
return 'Add: Fragment (Unavailable due to unstable ID of the control or its parent control)';
|
|
70
|
-
}
|
|
71
|
-
return 'Add: Fragment';
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Adds a new item to the context menu
|
|
76
|
-
*
|
|
77
|
-
* @param rta Runtime Authoring
|
|
78
|
-
* @param syncViewsIds Ids of all application sync views
|
|
79
|
-
* @param ui5VersionInfo UI5 version information
|
|
80
|
-
*/
|
|
81
|
-
const initDialogs = (rta, syncViewsIds, ui5VersionInfo) => {
|
|
82
|
-
const contextMenu = rta.getDefaultPlugins().contextMenu;
|
|
83
|
-
const isCloud = rta.getFlexSettings().isCloud;
|
|
84
|
-
contextMenu.addMenuItem({
|
|
85
|
-
id: 'ADD_FRAGMENT',
|
|
86
|
-
text: getAddFragmentItemText,
|
|
87
|
-
handler: async overlays => await DialogFactory.createDialog(overlays[0], rta, DialogNames.ADD_FRAGMENT),
|
|
88
|
-
icon: 'sap-icon://attachment-html',
|
|
89
|
-
enabled: overlays => isFragmentCommandEnabled(overlays, ui5VersionInfo)
|
|
90
|
-
});
|
|
91
|
-
contextMenu.addMenuItem({
|
|
92
|
-
id: 'EXTEND_CONTROLLER',
|
|
93
|
-
text: 'Extend With Controller',
|
|
94
|
-
handler: async overlays => await DialogFactory.createDialog(overlays[0], rta, DialogNames.CONTROLLER_EXTENSION),
|
|
95
|
-
icon: 'sap-icon://create-form',
|
|
96
|
-
enabled: overlays => isControllerExtensionEnabled(overlays, syncViewsIds, ui5VersionInfo, isCloud)
|
|
97
|
-
});
|
|
98
|
-
};
|
|
99
|
-
var __exports = {
|
|
100
|
-
__esModule: true
|
|
101
|
-
};
|
|
102
|
-
__exports.isControllerExtensionEnabledForControl = isControllerExtensionEnabledForControl;
|
|
103
|
-
__exports.isControllerExtensionEnabled = isControllerExtensionEnabled;
|
|
104
|
-
__exports.isFragmentCommandEnabled = isFragmentCommandEnabled;
|
|
105
|
-
__exports.getAddFragmentItemText = getAddFragmentItemText;
|
|
106
|
-
__exports.initDialogs = initDialogs;
|
|
107
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["sap/ui/rta/util/hasStableId", "sap/ui/fl/Utils", "../cpe/utils", "./dialog-factory"], function (hasStableId, FlUtils, ___cpe_utils, ___dialog_factory) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
const isReuseComponent = ___cpe_utils["isReuseComponent"];
|
|
7
|
+
const DialogFactory = ___dialog_factory["DialogFactory"];
|
|
8
|
+
const DialogNames = ___dialog_factory["DialogNames"];
|
|
9
|
+
/**
|
|
10
|
+
* Handler for enablement of Extend With Controller context menu entry
|
|
11
|
+
*
|
|
12
|
+
* @param control UI5 control.
|
|
13
|
+
* @param syncViewsIds Runtime Authoring
|
|
14
|
+
* @param ui5VersionInfo UI5 version information
|
|
15
|
+
* @param isCloud Whether the application is running in the cloud
|
|
16
|
+
*
|
|
17
|
+
* @returns boolean whether menu item is enabled or not
|
|
18
|
+
*/
|
|
19
|
+
function isControllerExtensionEnabledForControl(control, syncViewsIds, ui5VersionInfo, isCloud) {
|
|
20
|
+
const clickedControlId = FlUtils.getViewForControl(control).getId();
|
|
21
|
+
const isControlInSyncView = syncViewsIds.includes(clickedControlId);
|
|
22
|
+
if (isCloud) {
|
|
23
|
+
const isClickedControlReuseComponent = isReuseComponent(clickedControlId, ui5VersionInfo);
|
|
24
|
+
return !isControlInSyncView && !isClickedControlReuseComponent;
|
|
25
|
+
}
|
|
26
|
+
return !isControlInSyncView;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Handler for enablement of Extend With Controller context menu entry
|
|
31
|
+
*
|
|
32
|
+
* @param overlays Control overlays
|
|
33
|
+
* @param syncViewsIds Runtime Authoring
|
|
34
|
+
* @param ui5VersionInfo UI5 version information
|
|
35
|
+
* @param isCloud Whether the application is running in the cloud
|
|
36
|
+
*
|
|
37
|
+
* @returns boolean whether menu item is enabled or not
|
|
38
|
+
*/
|
|
39
|
+
const isControllerExtensionEnabled = (overlays, syncViewsIds, ui5VersionInfo, isCloud) => {
|
|
40
|
+
if (overlays.length === 0 || overlays.length > 1) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
return isControllerExtensionEnabledForControl(overlays[0].getElement(), syncViewsIds, ui5VersionInfo, isCloud);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Determines whether the fragment command should be enabled based on the provided overlays.
|
|
48
|
+
*
|
|
49
|
+
* @param {ElementOverlay[]} overlays - An array of ElementOverlay objects representing the UI overlays.
|
|
50
|
+
* @param ui5VersionInfo UI5 version information
|
|
51
|
+
* @returns {boolean} True if the fragment command is enabled, false otherwise.
|
|
52
|
+
*/
|
|
53
|
+
const isFragmentCommandEnabled = (overlays, ui5VersionInfo) => {
|
|
54
|
+
if (overlays.length === 0 || overlays.length > 1) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
const control = overlays[0].getElement();
|
|
58
|
+
return hasStableId(overlays[0]) && !isReuseComponent(control.getId(), ui5VersionInfo);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Determines the text that should be displayed for the Add Fragment context menu item.
|
|
63
|
+
*
|
|
64
|
+
* @param {ElementOverlay} overlay - An ElementOverlay object representing the UI overlay.
|
|
65
|
+
* @returns {string} The text of the Add Fragment context menu item.
|
|
66
|
+
*/
|
|
67
|
+
const getAddFragmentItemText = overlay => {
|
|
68
|
+
if (!hasStableId(overlay)) {
|
|
69
|
+
return 'Add: Fragment (Unavailable due to unstable ID of the control or its parent control)';
|
|
70
|
+
}
|
|
71
|
+
return 'Add: Fragment';
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Adds a new item to the context menu
|
|
76
|
+
*
|
|
77
|
+
* @param rta Runtime Authoring
|
|
78
|
+
* @param syncViewsIds Ids of all application sync views
|
|
79
|
+
* @param ui5VersionInfo UI5 version information
|
|
80
|
+
*/
|
|
81
|
+
const initDialogs = (rta, syncViewsIds, ui5VersionInfo) => {
|
|
82
|
+
const contextMenu = rta.getDefaultPlugins().contextMenu;
|
|
83
|
+
const isCloud = rta.getFlexSettings().isCloud;
|
|
84
|
+
contextMenu.addMenuItem({
|
|
85
|
+
id: 'ADD_FRAGMENT',
|
|
86
|
+
text: getAddFragmentItemText,
|
|
87
|
+
handler: async overlays => await DialogFactory.createDialog(overlays[0], rta, DialogNames.ADD_FRAGMENT),
|
|
88
|
+
icon: 'sap-icon://attachment-html',
|
|
89
|
+
enabled: overlays => isFragmentCommandEnabled(overlays, ui5VersionInfo)
|
|
90
|
+
});
|
|
91
|
+
contextMenu.addMenuItem({
|
|
92
|
+
id: 'EXTEND_CONTROLLER',
|
|
93
|
+
text: 'Extend With Controller',
|
|
94
|
+
handler: async overlays => await DialogFactory.createDialog(overlays[0], rta, DialogNames.CONTROLLER_EXTENSION),
|
|
95
|
+
icon: 'sap-icon://create-form',
|
|
96
|
+
enabled: overlays => isControllerExtensionEnabled(overlays, syncViewsIds, ui5VersionInfo, isCloud)
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
var __exports = {
|
|
100
|
+
__esModule: true
|
|
101
|
+
};
|
|
102
|
+
__exports.isControllerExtensionEnabledForControl = isControllerExtensionEnabledForControl;
|
|
103
|
+
__exports.isControllerExtensionEnabled = isControllerExtensionEnabled;
|
|
104
|
+
__exports.isFragmentCommandEnabled = isFragmentCommandEnabled;
|
|
105
|
+
__exports.getAddFragmentItemText = getAddFragmentItemText;
|
|
106
|
+
__exports.initDialogs = initDialogs;
|
|
107
|
+
return __exports;
|
|
108
108
|
});
|
|
109
109
|
//# sourceMappingURL=init-dialogs.js.map
|
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../../utils/version", "../../utils", "../../../cpe/quick-actions/utils", "../../dialog-factory", "../../init-dialogs", "../../api-handler", "../simple-quick-action-base", "../dialog-enablement-validator"], function (OverlayRegistry, _____utils_version, ____utils, _____cpe_quick_actions_utils, ____dialog_factory, ____init_dialogs, ____api_handler, ___simple_quick_action_base, ___dialog_enablement_validator) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
const getUi5Version = _____utils_version["getUi5Version"];
|
|
7
|
-
const getAllSyncViewsIds = ____utils["getAllSyncViewsIds"];
|
|
8
|
-
const getControllerInfoForControl = ____utils["getControllerInfoForControl"];
|
|
9
|
-
const getRelevantControlFromActivePage = _____cpe_quick_actions_utils["getRelevantControlFromActivePage"];
|
|
10
|
-
const DialogFactory = ____dialog_factory["DialogFactory"];
|
|
11
|
-
const DialogNames = ____dialog_factory["DialogNames"];
|
|
12
|
-
const isControllerExtensionEnabledForControl = ____init_dialogs["isControllerExtensionEnabledForControl"];
|
|
13
|
-
const getExistingController = ____api_handler["getExistingController"];
|
|
14
|
-
const SimpleQuickActionDefinitionBase = ___simple_quick_action_base["SimpleQuickActionDefinitionBase"];
|
|
15
|
-
const DIALOG_ENABLEMENT_VALIDATOR = ___dialog_enablement_validator["DIALOG_ENABLEMENT_VALIDATOR"];
|
|
16
|
-
const ADD_CONTROLLER_TO_PAGE_TYPE = 'add-controller-to-page';
|
|
17
|
-
const CONTROL_TYPES = ['sap.f.DynamicPage', 'sap.uxap.ObjectPageLayout'];
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Quick Action for adding controller to a page.
|
|
21
|
-
*/
|
|
22
|
-
class AddControllerToPageQuickAction extends SimpleQuickActionDefinitionBase {
|
|
23
|
-
constructor(context) {
|
|
24
|
-
super(ADD_CONTROLLER_TO_PAGE_TYPE, CONTROL_TYPES, '', context, [DIALOG_ENABLEMENT_VALIDATOR]);
|
|
25
|
-
}
|
|
26
|
-
controllerExists = false;
|
|
27
|
-
async initialize() {
|
|
28
|
-
for (const control of getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, CONTROL_TYPES)) {
|
|
29
|
-
const version = await getUi5Version();
|
|
30
|
-
const syncViewsIds = await getAllSyncViewsIds(version);
|
|
31
|
-
const controlInfo = getControllerInfoForControl(control);
|
|
32
|
-
const data = await getExistingController(controlInfo.controllerName);
|
|
33
|
-
this.controllerExists = data?.controllerExists;
|
|
34
|
-
const isActiveAction = isControllerExtensionEnabledForControl(control, syncViewsIds, version, this.context.flexSettings.isCloud);
|
|
35
|
-
this.control = isActiveAction ? control : undefined;
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
get textKey() {
|
|
40
|
-
return this.controllerExists ? 'QUICK_ACTION_SHOW_PAGE_CONTROLLER' : 'QUICK_ACTION_ADD_PAGE_CONTROLLER';
|
|
41
|
-
}
|
|
42
|
-
async execute() {
|
|
43
|
-
if (this.control) {
|
|
44
|
-
const overlay = OverlayRegistry.getOverlay(this.control) || [];
|
|
45
|
-
await DialogFactory.createDialog(overlay, this.context.rta, DialogNames.CONTROLLER_EXTENSION);
|
|
46
|
-
}
|
|
47
|
-
return [];
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
var __exports = {
|
|
51
|
-
__esModule: true
|
|
52
|
-
};
|
|
53
|
-
__exports.ADD_CONTROLLER_TO_PAGE_TYPE = ADD_CONTROLLER_TO_PAGE_TYPE;
|
|
54
|
-
__exports.AddControllerToPageQuickAction = AddControllerToPageQuickAction;
|
|
55
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../../utils/version", "../../utils", "../../../cpe/quick-actions/utils", "../../dialog-factory", "../../init-dialogs", "../../api-handler", "../simple-quick-action-base", "../dialog-enablement-validator"], function (OverlayRegistry, _____utils_version, ____utils, _____cpe_quick_actions_utils, ____dialog_factory, ____init_dialogs, ____api_handler, ___simple_quick_action_base, ___dialog_enablement_validator) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
const getUi5Version = _____utils_version["getUi5Version"];
|
|
7
|
+
const getAllSyncViewsIds = ____utils["getAllSyncViewsIds"];
|
|
8
|
+
const getControllerInfoForControl = ____utils["getControllerInfoForControl"];
|
|
9
|
+
const getRelevantControlFromActivePage = _____cpe_quick_actions_utils["getRelevantControlFromActivePage"];
|
|
10
|
+
const DialogFactory = ____dialog_factory["DialogFactory"];
|
|
11
|
+
const DialogNames = ____dialog_factory["DialogNames"];
|
|
12
|
+
const isControllerExtensionEnabledForControl = ____init_dialogs["isControllerExtensionEnabledForControl"];
|
|
13
|
+
const getExistingController = ____api_handler["getExistingController"];
|
|
14
|
+
const SimpleQuickActionDefinitionBase = ___simple_quick_action_base["SimpleQuickActionDefinitionBase"];
|
|
15
|
+
const DIALOG_ENABLEMENT_VALIDATOR = ___dialog_enablement_validator["DIALOG_ENABLEMENT_VALIDATOR"];
|
|
16
|
+
const ADD_CONTROLLER_TO_PAGE_TYPE = 'add-controller-to-page';
|
|
17
|
+
const CONTROL_TYPES = ['sap.f.DynamicPage', 'sap.uxap.ObjectPageLayout'];
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Quick Action for adding controller to a page.
|
|
21
|
+
*/
|
|
22
|
+
class AddControllerToPageQuickAction extends SimpleQuickActionDefinitionBase {
|
|
23
|
+
constructor(context) {
|
|
24
|
+
super(ADD_CONTROLLER_TO_PAGE_TYPE, CONTROL_TYPES, '', context, [DIALOG_ENABLEMENT_VALIDATOR]);
|
|
25
|
+
}
|
|
26
|
+
controllerExists = false;
|
|
27
|
+
async initialize() {
|
|
28
|
+
for (const control of getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, CONTROL_TYPES)) {
|
|
29
|
+
const version = await getUi5Version();
|
|
30
|
+
const syncViewsIds = await getAllSyncViewsIds(version);
|
|
31
|
+
const controlInfo = getControllerInfoForControl(control);
|
|
32
|
+
const data = await getExistingController(controlInfo.controllerName);
|
|
33
|
+
this.controllerExists = data?.controllerExists;
|
|
34
|
+
const isActiveAction = isControllerExtensionEnabledForControl(control, syncViewsIds, version, this.context.flexSettings.isCloud);
|
|
35
|
+
this.control = isActiveAction ? control : undefined;
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
get textKey() {
|
|
40
|
+
return this.controllerExists ? 'QUICK_ACTION_SHOW_PAGE_CONTROLLER' : 'QUICK_ACTION_ADD_PAGE_CONTROLLER';
|
|
41
|
+
}
|
|
42
|
+
async execute() {
|
|
43
|
+
if (this.control) {
|
|
44
|
+
const overlay = OverlayRegistry.getOverlay(this.control) || [];
|
|
45
|
+
await DialogFactory.createDialog(overlay, this.context.rta, DialogNames.CONTROLLER_EXTENSION);
|
|
46
|
+
}
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
var __exports = {
|
|
51
|
+
__esModule: true
|
|
52
|
+
};
|
|
53
|
+
__exports.ADD_CONTROLLER_TO_PAGE_TYPE = ADD_CONTROLLER_TO_PAGE_TYPE;
|
|
54
|
+
__exports.AddControllerToPageQuickAction = AddControllerToPageQuickAction;
|
|
55
|
+
return __exports;
|
|
56
56
|
});
|
|
57
57
|
//# sourceMappingURL=add-controller-to-page.js.map
|