@sap-ux/preview-middleware 0.16.144 → 0.16.146
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 +142 -142
- 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 +213 -213
- package/dist/client/adp/controllers/ExtensionPoint.controller.js +138 -138
- package/dist/client/adp/init-dialogs.js +157 -157
- package/dist/client/adp/quick-actions/common/add-controller-to-page.js +54 -54
- package/dist/client/adp/quick-actions/common/create-page-action.js +49 -49
- package/dist/client/adp/quick-actions/common/op-add-custom-section.js +35 -35
- package/dist/client/adp/quick-actions/common/op-add-header-field.js +47 -47
- package/dist/client/adp/quick-actions/fe-v2/change-table-columns.js +100 -100
- package/dist/client/adp/quick-actions/fe-v2/create-table-action.js +69 -69
- package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +95 -95
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.js +56 -56
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-table-filtering.js +67 -67
- package/dist/client/adp/quick-actions/fe-v2/lr-toggle-clear-filter-bar.js +57 -57
- package/dist/client/adp/quick-actions/fe-v2/registry.js +71 -71
- package/dist/client/adp/quick-actions/fe-v2/utils.js +86 -86
- package/dist/client/adp/quick-actions/fe-v4/change-table-columns.js +47 -47
- package/dist/client/adp/quick-actions/fe-v4/create-table-action.js +45 -45
- package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column.js +45 -45
- package/dist/client/adp/quick-actions/fe-v4/lr-enable-semantic-date-range-filter-bar.js +55 -55
- 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 +52 -52
- package/dist/client/adp/quick-actions/fe-v4/registry.js +55 -55
- 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/utils.js +160 -160
- package/dist/client/cpe/changes/index.js +10 -10
- package/dist/client/cpe/changes/validator.js +34 -34
- 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 +217 -217
- 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 +30 -30
- 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-v4.js +114 -114
- package/dist/client/utils/version.js +85 -85
- package/package.json +3 -3
|
@@ -1,140 +1,140 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["sap/ui/model/json/JSONModel", "../api-handler", "./BaseDialog.controller", "../utils"], function (JSONModel, ___api_handler, __BaseDialog, ___utils) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
function _interopRequireDefault(obj) {
|
|
7
|
-
return obj && obj.__esModule && typeof obj.default !== "undefined" ? obj.default : obj;
|
|
8
|
-
}
|
|
9
|
-
const getFragments = ___api_handler["getFragments"];
|
|
10
|
-
const BaseDialog = _interopRequireDefault(__BaseDialog);
|
|
11
|
-
const notifyUser = ___utils["notifyUser"];
|
|
12
|
-
/**
|
|
13
|
-
* @namespace open.ux.preview.client.adp.controllers
|
|
14
|
-
*/
|
|
15
|
-
const ExtensionPoint = BaseDialog.extend("open.ux.preview.client.adp.controllers.ExtensionPoint", {
|
|
16
|
-
constructor: function _constructor(name, _overlays, rta, data) {
|
|
17
|
-
BaseDialog.prototype.constructor.call(this, name);
|
|
18
|
-
this.model = new JSONModel();
|
|
19
|
-
this.data = data;
|
|
20
|
-
this.rta = rta;
|
|
21
|
-
},
|
|
22
|
-
/**
|
|
23
|
-
* Setups the Dialog and the JSON Model
|
|
24
|
-
*
|
|
25
|
-
* @param {Dialog} dialog - Dialog instance
|
|
26
|
-
*/
|
|
27
|
-
setup: async function _setup(dialog) {
|
|
28
|
-
this.dialog = dialog;
|
|
29
|
-
this.setEscapeHandler();
|
|
30
|
-
await this.buildDialogData();
|
|
31
|
-
this.dialog.setModel(this.model);
|
|
32
|
-
this.dialog.open();
|
|
33
|
-
},
|
|
34
|
-
/**
|
|
35
|
-
* Handles create button press
|
|
36
|
-
*
|
|
37
|
-
* @param event Event
|
|
38
|
-
*/
|
|
39
|
-
onCreateBtnPress: function _onCreateBtnPress(event) {
|
|
40
|
-
const source = event.getSource();
|
|
41
|
-
source.setEnabled(false);
|
|
42
|
-
const fragmentName = this.model.getProperty('/newFragmentName');
|
|
43
|
-
this.createExtensionPointFragmentChange(fragmentName);
|
|
44
|
-
notifyUser(`Note: The '${fragmentName}.fragment.xml' fragment will be created once you save the change.`, 8000);
|
|
45
|
-
this.handleDialogClose();
|
|
46
|
-
},
|
|
47
|
-
/**
|
|
48
|
-
* Handler for extension point select control
|
|
49
|
-
*
|
|
50
|
-
* @param event Select control change event
|
|
51
|
-
*/
|
|
52
|
-
onExtensionPointHandler: function _onExtensionPointHandler(event) {
|
|
53
|
-
const source = event.getSource();
|
|
54
|
-
const selectedItem = source.getSelectedItem();
|
|
55
|
-
let extensionPointName = '';
|
|
56
|
-
if (selectedItem) {
|
|
57
|
-
extensionPointName = selectedItem.getText();
|
|
58
|
-
}
|
|
59
|
-
this.model.setProperty('/extensionPointName', extensionPointName);
|
|
60
|
-
const hasDefaultContent = this.hasDefaultContentForName(extensionPointName);
|
|
61
|
-
this.model.setProperty('/hasDefaultContent', hasDefaultContent);
|
|
62
|
-
},
|
|
63
|
-
/**
|
|
64
|
-
* Determines whether there is default content associated with the given name.
|
|
65
|
-
*
|
|
66
|
-
* @param {string} name - The name to check for associated default content.
|
|
67
|
-
* @returns {boolean} - True if there is non-empty default content associated with the name, false otherwise.
|
|
68
|
-
*/
|
|
69
|
-
hasDefaultContentForName: function _hasDefaultContentForName(name) {
|
|
70
|
-
const defaultContent = this.data?.info.find(v => v.name === name)?.defaultContent;
|
|
71
|
-
return defaultContent ? defaultContent.length > 0 : false;
|
|
72
|
-
},
|
|
73
|
-
/**
|
|
74
|
-
* Builds data that is used in the dialog
|
|
75
|
-
*/
|
|
76
|
-
buildDialogData: async function _buildDialogData() {
|
|
77
|
-
const name = this.data?.name;
|
|
78
|
-
if (name) {
|
|
79
|
-
const hasDefaultContent = this.hasDefaultContentForName(name);
|
|
80
|
-
const extensionPointList = [{
|
|
81
|
-
key: 0,
|
|
82
|
-
value: name
|
|
83
|
-
}];
|
|
84
|
-
this.updateModel(name, 0, extensionPointList, false, hasDefaultContent);
|
|
85
|
-
} else {
|
|
86
|
-
// In this case we are selecting from the application. There can be many extension points under one control.
|
|
87
|
-
const extensionPointList = this.data.info.map((v, idx) => {
|
|
88
|
-
return {
|
|
89
|
-
key: idx,
|
|
90
|
-
value: v.name
|
|
91
|
-
};
|
|
92
|
-
});
|
|
93
|
-
const firstElName = extensionPointList[0].value;
|
|
94
|
-
const enabled = extensionPointList.length > 1;
|
|
95
|
-
const hasDefaultContent = this.hasDefaultContentForName(firstElName);
|
|
96
|
-
this.updateModel(firstElName, 0, extensionPointList, enabled, hasDefaultContent);
|
|
97
|
-
}
|
|
98
|
-
try {
|
|
99
|
-
const {
|
|
100
|
-
fragments
|
|
101
|
-
} = await getFragments();
|
|
102
|
-
this.model.setProperty('/fragmentList', fragments);
|
|
103
|
-
} catch (e) {
|
|
104
|
-
this.handleError(e);
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
/**
|
|
108
|
-
* Updates the Select control according to provided values
|
|
109
|
-
*
|
|
110
|
-
* @param name Extension point name
|
|
111
|
-
* @param key Selected extension point key
|
|
112
|
-
* @param list All of the extension points that are under a view
|
|
113
|
-
* @param enabled Enables the select control
|
|
114
|
-
* @param hasDefaultContent Whether there is default content associated with the extension name
|
|
115
|
-
*/
|
|
116
|
-
updateModel: function _updateModel(name, key, list, enabled, hasDefaultContent) {
|
|
117
|
-
this.model.setProperty('/extensionPointName', name);
|
|
118
|
-
this.model.setProperty('/extensionPointKey', key);
|
|
119
|
-
this.model.setProperty('/extensionPointList', list);
|
|
120
|
-
this.model.setProperty('/extensionListEnabled', enabled);
|
|
121
|
-
this.model.setProperty('/hasDefaultContent', hasDefaultContent);
|
|
122
|
-
},
|
|
123
|
-
/**
|
|
124
|
-
* Creates add xml at extension point changes
|
|
125
|
-
*
|
|
126
|
-
* @param fragmentName Fragment name
|
|
127
|
-
*/
|
|
128
|
-
createExtensionPointFragmentChange: function _createExtensionPointFragmentChange(fragmentName) {
|
|
129
|
-
const extensionPointName = this.model.getProperty('/extensionPointName');
|
|
130
|
-
const modifiedValue = {
|
|
131
|
-
fragment: `<core:FragmentDefinition xmlns:core='sap.ui.core'></core:FragmentDefinition>`,
|
|
132
|
-
fragmentPath: `fragments/${fragmentName}.fragment.xml`,
|
|
133
|
-
extensionPointName
|
|
134
|
-
};
|
|
135
|
-
this.data.deferred.resolve(modifiedValue);
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
return ExtensionPoint;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["sap/ui/model/json/JSONModel", "../api-handler", "./BaseDialog.controller", "../utils"], function (JSONModel, ___api_handler, __BaseDialog, ___utils) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
function _interopRequireDefault(obj) {
|
|
7
|
+
return obj && obj.__esModule && typeof obj.default !== "undefined" ? obj.default : obj;
|
|
8
|
+
}
|
|
9
|
+
const getFragments = ___api_handler["getFragments"];
|
|
10
|
+
const BaseDialog = _interopRequireDefault(__BaseDialog);
|
|
11
|
+
const notifyUser = ___utils["notifyUser"];
|
|
12
|
+
/**
|
|
13
|
+
* @namespace open.ux.preview.client.adp.controllers
|
|
14
|
+
*/
|
|
15
|
+
const ExtensionPoint = BaseDialog.extend("open.ux.preview.client.adp.controllers.ExtensionPoint", {
|
|
16
|
+
constructor: function _constructor(name, _overlays, rta, data) {
|
|
17
|
+
BaseDialog.prototype.constructor.call(this, name);
|
|
18
|
+
this.model = new JSONModel();
|
|
19
|
+
this.data = data;
|
|
20
|
+
this.rta = rta;
|
|
21
|
+
},
|
|
22
|
+
/**
|
|
23
|
+
* Setups the Dialog and the JSON Model
|
|
24
|
+
*
|
|
25
|
+
* @param {Dialog} dialog - Dialog instance
|
|
26
|
+
*/
|
|
27
|
+
setup: async function _setup(dialog) {
|
|
28
|
+
this.dialog = dialog;
|
|
29
|
+
this.setEscapeHandler();
|
|
30
|
+
await this.buildDialogData();
|
|
31
|
+
this.dialog.setModel(this.model);
|
|
32
|
+
this.dialog.open();
|
|
33
|
+
},
|
|
34
|
+
/**
|
|
35
|
+
* Handles create button press
|
|
36
|
+
*
|
|
37
|
+
* @param event Event
|
|
38
|
+
*/
|
|
39
|
+
onCreateBtnPress: function _onCreateBtnPress(event) {
|
|
40
|
+
const source = event.getSource();
|
|
41
|
+
source.setEnabled(false);
|
|
42
|
+
const fragmentName = this.model.getProperty('/newFragmentName');
|
|
43
|
+
this.createExtensionPointFragmentChange(fragmentName);
|
|
44
|
+
notifyUser(`Note: The '${fragmentName}.fragment.xml' fragment will be created once you save the change.`, 8000);
|
|
45
|
+
this.handleDialogClose();
|
|
46
|
+
},
|
|
47
|
+
/**
|
|
48
|
+
* Handler for extension point select control
|
|
49
|
+
*
|
|
50
|
+
* @param event Select control change event
|
|
51
|
+
*/
|
|
52
|
+
onExtensionPointHandler: function _onExtensionPointHandler(event) {
|
|
53
|
+
const source = event.getSource();
|
|
54
|
+
const selectedItem = source.getSelectedItem();
|
|
55
|
+
let extensionPointName = '';
|
|
56
|
+
if (selectedItem) {
|
|
57
|
+
extensionPointName = selectedItem.getText();
|
|
58
|
+
}
|
|
59
|
+
this.model.setProperty('/extensionPointName', extensionPointName);
|
|
60
|
+
const hasDefaultContent = this.hasDefaultContentForName(extensionPointName);
|
|
61
|
+
this.model.setProperty('/hasDefaultContent', hasDefaultContent);
|
|
62
|
+
},
|
|
63
|
+
/**
|
|
64
|
+
* Determines whether there is default content associated with the given name.
|
|
65
|
+
*
|
|
66
|
+
* @param {string} name - The name to check for associated default content.
|
|
67
|
+
* @returns {boolean} - True if there is non-empty default content associated with the name, false otherwise.
|
|
68
|
+
*/
|
|
69
|
+
hasDefaultContentForName: function _hasDefaultContentForName(name) {
|
|
70
|
+
const defaultContent = this.data?.info.find(v => v.name === name)?.defaultContent;
|
|
71
|
+
return defaultContent ? defaultContent.length > 0 : false;
|
|
72
|
+
},
|
|
73
|
+
/**
|
|
74
|
+
* Builds data that is used in the dialog
|
|
75
|
+
*/
|
|
76
|
+
buildDialogData: async function _buildDialogData() {
|
|
77
|
+
const name = this.data?.name;
|
|
78
|
+
if (name) {
|
|
79
|
+
const hasDefaultContent = this.hasDefaultContentForName(name);
|
|
80
|
+
const extensionPointList = [{
|
|
81
|
+
key: 0,
|
|
82
|
+
value: name
|
|
83
|
+
}];
|
|
84
|
+
this.updateModel(name, 0, extensionPointList, false, hasDefaultContent);
|
|
85
|
+
} else {
|
|
86
|
+
// In this case we are selecting from the application. There can be many extension points under one control.
|
|
87
|
+
const extensionPointList = this.data.info.map((v, idx) => {
|
|
88
|
+
return {
|
|
89
|
+
key: idx,
|
|
90
|
+
value: v.name
|
|
91
|
+
};
|
|
92
|
+
});
|
|
93
|
+
const firstElName = extensionPointList[0].value;
|
|
94
|
+
const enabled = extensionPointList.length > 1;
|
|
95
|
+
const hasDefaultContent = this.hasDefaultContentForName(firstElName);
|
|
96
|
+
this.updateModel(firstElName, 0, extensionPointList, enabled, hasDefaultContent);
|
|
97
|
+
}
|
|
98
|
+
try {
|
|
99
|
+
const {
|
|
100
|
+
fragments
|
|
101
|
+
} = await getFragments();
|
|
102
|
+
this.model.setProperty('/fragmentList', fragments);
|
|
103
|
+
} catch (e) {
|
|
104
|
+
this.handleError(e);
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
/**
|
|
108
|
+
* Updates the Select control according to provided values
|
|
109
|
+
*
|
|
110
|
+
* @param name Extension point name
|
|
111
|
+
* @param key Selected extension point key
|
|
112
|
+
* @param list All of the extension points that are under a view
|
|
113
|
+
* @param enabled Enables the select control
|
|
114
|
+
* @param hasDefaultContent Whether there is default content associated with the extension name
|
|
115
|
+
*/
|
|
116
|
+
updateModel: function _updateModel(name, key, list, enabled, hasDefaultContent) {
|
|
117
|
+
this.model.setProperty('/extensionPointName', name);
|
|
118
|
+
this.model.setProperty('/extensionPointKey', key);
|
|
119
|
+
this.model.setProperty('/extensionPointList', list);
|
|
120
|
+
this.model.setProperty('/extensionListEnabled', enabled);
|
|
121
|
+
this.model.setProperty('/hasDefaultContent', hasDefaultContent);
|
|
122
|
+
},
|
|
123
|
+
/**
|
|
124
|
+
* Creates add xml at extension point changes
|
|
125
|
+
*
|
|
126
|
+
* @param fragmentName Fragment name
|
|
127
|
+
*/
|
|
128
|
+
createExtensionPointFragmentChange: function _createExtensionPointFragmentChange(fragmentName) {
|
|
129
|
+
const extensionPointName = this.model.getProperty('/extensionPointName');
|
|
130
|
+
const modifiedValue = {
|
|
131
|
+
fragment: `<core:FragmentDefinition xmlns:core='sap.ui.core'></core:FragmentDefinition>`,
|
|
132
|
+
fragmentPath: `fragments/${fragmentName}.fragment.xml`,
|
|
133
|
+
extensionPointName
|
|
134
|
+
};
|
|
135
|
+
this.data.deferred.resolve(modifiedValue);
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
return ExtensionPoint;
|
|
139
139
|
});
|
|
140
140
|
//# sourceMappingURL=ExtensionPoint.controller.js.map
|
|
@@ -1,159 +1,159 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["sap/ui/core/Fragment", "sap/ui/rta/util/hasStableId", "sap/ui/fl/Utils", "./controllers/AddFragment.controller", "./controllers/ControllerExtension.controller", "./controllers/ExtensionPoint.controller", "../cpe/utils", "../i18n", "./controllers/AddTableColumnFragments.controller"], function (Fragment, hasStableId, FlUtils, __AddFragment, __ControllerExtension, __ExtensionPoint, ___cpe_utils, ___i18n, __AddTableColumnFragments) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
function _interopRequireDefault(obj) {
|
|
7
|
-
return obj && obj.__esModule && typeof obj.default !== "undefined" ? obj.default : obj;
|
|
8
|
-
}
|
|
9
|
-
const AddFragment = _interopRequireDefault(__AddFragment);
|
|
10
|
-
const ControllerExtension = _interopRequireDefault(__ControllerExtension);
|
|
11
|
-
const ExtensionPoint = _interopRequireDefault(__ExtensionPoint);
|
|
12
|
-
const isReuseComponent = ___cpe_utils["isReuseComponent"];
|
|
13
|
-
const getTextBundle = ___i18n["getTextBundle"];
|
|
14
|
-
const AddTableColumnFragments = _interopRequireDefault(__AddTableColumnFragments);
|
|
15
|
-
var DialogNames = /*#__PURE__*/function (DialogNames) {
|
|
16
|
-
DialogNames["ADD_FRAGMENT"] = "AddFragment";
|
|
17
|
-
DialogNames["ADD_TABLE_COLUMN_FRAGMENTS"] = "AddTableColumnFragments";
|
|
18
|
-
DialogNames["CONTROLLER_EXTENSION"] = "ControllerExtension";
|
|
19
|
-
DialogNames["ADD_FRAGMENT_AT_EXTENSION_POINT"] = "ExtensionPoint";
|
|
20
|
-
return DialogNames;
|
|
21
|
-
}(DialogNames || {});
|
|
22
|
-
/**
|
|
23
|
-
* Handler for enablement of Extend With Controller context menu entry
|
|
24
|
-
*
|
|
25
|
-
* @param control UI5 control.
|
|
26
|
-
* @param syncViewsIds Runtime Authoring
|
|
27
|
-
* @param ui5VersionInfo UI5 version information
|
|
28
|
-
*
|
|
29
|
-
* @returns boolean whether menu item is enabled or not
|
|
30
|
-
*/
|
|
31
|
-
function isControllerExtensionEnabledForControl(control, syncViewsIds, ui5VersionInfo) {
|
|
32
|
-
const clickedControlId = FlUtils.getViewForControl(control).getId();
|
|
33
|
-
const isClickedControlReuseComponent = isReuseComponent(clickedControlId, ui5VersionInfo);
|
|
34
|
-
return !syncViewsIds.includes(clickedControlId) && !isClickedControlReuseComponent;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Handler for enablement of Extend With Controller context menu entry
|
|
39
|
-
*
|
|
40
|
-
* @param overlays Control overlays
|
|
41
|
-
* @param syncViewsIds Runtime Authoring
|
|
42
|
-
* @param ui5VersionInfo UI5 version information
|
|
43
|
-
*
|
|
44
|
-
* @returns boolean whether menu item is enabled or not
|
|
45
|
-
*/
|
|
46
|
-
const isControllerExtensionEnabled = (overlays, syncViewsIds, ui5VersionInfo) => {
|
|
47
|
-
if (overlays.length === 0 || overlays.length > 1) {
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
|
-
return isControllerExtensionEnabledForControl(overlays[0].getElement(), syncViewsIds, ui5VersionInfo);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Determines whether the fragment command should be enabled based on the provided overlays.
|
|
55
|
-
*
|
|
56
|
-
* @param {ElementOverlay[]} overlays - An array of ElementOverlay objects representing the UI overlays.
|
|
57
|
-
* @param ui5VersionInfo UI5 version information
|
|
58
|
-
* @returns {boolean} True if the fragment command is enabled, false otherwise.
|
|
59
|
-
*/
|
|
60
|
-
const isFragmentCommandEnabled = (overlays, ui5VersionInfo) => {
|
|
61
|
-
if (overlays.length === 0 || overlays.length > 1) {
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
const control = overlays[0].getElement();
|
|
65
|
-
return hasStableId(overlays[0]) && !isReuseComponent(control.getId(), ui5VersionInfo);
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Determines the text that should be displayed for the Add Fragment context menu item.
|
|
70
|
-
*
|
|
71
|
-
* @param {ElementOverlay} overlay - An ElementOverlay object representing the UI overlay.
|
|
72
|
-
* @returns {string} The text of the Add Fragment context menu item.
|
|
73
|
-
*/
|
|
74
|
-
const getAddFragmentItemText = overlay => {
|
|
75
|
-
if (!hasStableId(overlay)) {
|
|
76
|
-
return 'Add: Fragment (Unavailable due to unstable ID of the control or its parent control)';
|
|
77
|
-
}
|
|
78
|
-
return 'Add: Fragment';
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Handler for new context menu entry
|
|
83
|
-
*
|
|
84
|
-
* @param overlay Control overlays
|
|
85
|
-
* @param rta Runtime Authoring
|
|
86
|
-
* @param dialogName Dialog name
|
|
87
|
-
* @param extensionPointData Control ID
|
|
88
|
-
* @param options Dialog options
|
|
89
|
-
*/
|
|
90
|
-
async function handler(overlay, rta, dialogName, extensionPointData) {
|
|
91
|
-
let options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
92
|
-
let controller;
|
|
93
|
-
const resources = await getTextBundle();
|
|
94
|
-
switch (dialogName) {
|
|
95
|
-
case DialogNames.ADD_FRAGMENT:
|
|
96
|
-
controller = new AddFragment(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, {
|
|
97
|
-
aggregation: options.aggregation,
|
|
98
|
-
title: resources.getText(options.title ?? 'ADP_ADD_FRAGMENT_DIALOG_TITLE')
|
|
99
|
-
});
|
|
100
|
-
break;
|
|
101
|
-
case DialogNames.ADD_TABLE_COLUMN_FRAGMENTS:
|
|
102
|
-
controller = new AddTableColumnFragments(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, {
|
|
103
|
-
aggregation: options.aggregation,
|
|
104
|
-
title: resources.getText(options.title ?? 'ADP_ADD_FRAGMENT_DIALOG_TITLE')
|
|
105
|
-
});
|
|
106
|
-
break;
|
|
107
|
-
case DialogNames.CONTROLLER_EXTENSION:
|
|
108
|
-
controller = new ControllerExtension(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta);
|
|
109
|
-
break;
|
|
110
|
-
case DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT:
|
|
111
|
-
controller = new ExtensionPoint(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, extensionPointData);
|
|
112
|
-
break;
|
|
113
|
-
}
|
|
114
|
-
const id = dialogName === DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT ? `dialog--${dialogName}` : undefined;
|
|
115
|
-
const dialog = await Fragment.load({
|
|
116
|
-
name: `open.ux.preview.client.adp.ui.${dialogName}`,
|
|
117
|
-
controller,
|
|
118
|
-
id
|
|
119
|
-
});
|
|
120
|
-
await controller.setup(dialog);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Adds a new item to the context menu
|
|
125
|
-
*
|
|
126
|
-
* @param rta Runtime Authoring
|
|
127
|
-
* @param syncViewsIds Ids of all application sync views
|
|
128
|
-
* @param ui5VersionInfo UI5 version information
|
|
129
|
-
*/
|
|
130
|
-
const initDialogs = (rta, syncViewsIds, ui5VersionInfo) => {
|
|
131
|
-
const contextMenu = rta.getDefaultPlugins().contextMenu;
|
|
132
|
-
contextMenu.addMenuItem({
|
|
133
|
-
id: 'ADD_FRAGMENT',
|
|
134
|
-
text: getAddFragmentItemText,
|
|
135
|
-
handler: async overlays => await handler(overlays[0], rta, DialogNames.ADD_FRAGMENT),
|
|
136
|
-
icon: 'sap-icon://attachment-html',
|
|
137
|
-
enabled: overlays => isFragmentCommandEnabled(overlays, ui5VersionInfo)
|
|
138
|
-
});
|
|
139
|
-
contextMenu.addMenuItem({
|
|
140
|
-
id: 'EXTEND_CONTROLLER',
|
|
141
|
-
text: 'Extend With Controller',
|
|
142
|
-
handler: async overlays => await handler(overlays[0], rta, DialogNames.CONTROLLER_EXTENSION),
|
|
143
|
-
icon: 'sap-icon://create-form',
|
|
144
|
-
enabled: overlays => isControllerExtensionEnabled(overlays, syncViewsIds, ui5VersionInfo)
|
|
145
|
-
});
|
|
146
|
-
};
|
|
147
|
-
var __exports = {
|
|
148
|
-
__esModule: true
|
|
149
|
-
};
|
|
150
|
-
__exports.DialogNames = DialogNames;
|
|
151
|
-
__exports.isControllerExtensionEnabledForControl = isControllerExtensionEnabledForControl;
|
|
152
|
-
__exports.isControllerExtensionEnabled = isControllerExtensionEnabled;
|
|
153
|
-
__exports.isFragmentCommandEnabled = isFragmentCommandEnabled;
|
|
154
|
-
__exports.getAddFragmentItemText = getAddFragmentItemText;
|
|
155
|
-
__exports.handler = handler;
|
|
156
|
-
__exports.initDialogs = initDialogs;
|
|
157
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["sap/ui/core/Fragment", "sap/ui/rta/util/hasStableId", "sap/ui/fl/Utils", "./controllers/AddFragment.controller", "./controllers/ControllerExtension.controller", "./controllers/ExtensionPoint.controller", "../cpe/utils", "../i18n", "./controllers/AddTableColumnFragments.controller"], function (Fragment, hasStableId, FlUtils, __AddFragment, __ControllerExtension, __ExtensionPoint, ___cpe_utils, ___i18n, __AddTableColumnFragments) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
function _interopRequireDefault(obj) {
|
|
7
|
+
return obj && obj.__esModule && typeof obj.default !== "undefined" ? obj.default : obj;
|
|
8
|
+
}
|
|
9
|
+
const AddFragment = _interopRequireDefault(__AddFragment);
|
|
10
|
+
const ControllerExtension = _interopRequireDefault(__ControllerExtension);
|
|
11
|
+
const ExtensionPoint = _interopRequireDefault(__ExtensionPoint);
|
|
12
|
+
const isReuseComponent = ___cpe_utils["isReuseComponent"];
|
|
13
|
+
const getTextBundle = ___i18n["getTextBundle"];
|
|
14
|
+
const AddTableColumnFragments = _interopRequireDefault(__AddTableColumnFragments);
|
|
15
|
+
var DialogNames = /*#__PURE__*/function (DialogNames) {
|
|
16
|
+
DialogNames["ADD_FRAGMENT"] = "AddFragment";
|
|
17
|
+
DialogNames["ADD_TABLE_COLUMN_FRAGMENTS"] = "AddTableColumnFragments";
|
|
18
|
+
DialogNames["CONTROLLER_EXTENSION"] = "ControllerExtension";
|
|
19
|
+
DialogNames["ADD_FRAGMENT_AT_EXTENSION_POINT"] = "ExtensionPoint";
|
|
20
|
+
return DialogNames;
|
|
21
|
+
}(DialogNames || {});
|
|
22
|
+
/**
|
|
23
|
+
* Handler for enablement of Extend With Controller context menu entry
|
|
24
|
+
*
|
|
25
|
+
* @param control UI5 control.
|
|
26
|
+
* @param syncViewsIds Runtime Authoring
|
|
27
|
+
* @param ui5VersionInfo UI5 version information
|
|
28
|
+
*
|
|
29
|
+
* @returns boolean whether menu item is enabled or not
|
|
30
|
+
*/
|
|
31
|
+
function isControllerExtensionEnabledForControl(control, syncViewsIds, ui5VersionInfo) {
|
|
32
|
+
const clickedControlId = FlUtils.getViewForControl(control).getId();
|
|
33
|
+
const isClickedControlReuseComponent = isReuseComponent(clickedControlId, ui5VersionInfo);
|
|
34
|
+
return !syncViewsIds.includes(clickedControlId) && !isClickedControlReuseComponent;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Handler for enablement of Extend With Controller context menu entry
|
|
39
|
+
*
|
|
40
|
+
* @param overlays Control overlays
|
|
41
|
+
* @param syncViewsIds Runtime Authoring
|
|
42
|
+
* @param ui5VersionInfo UI5 version information
|
|
43
|
+
*
|
|
44
|
+
* @returns boolean whether menu item is enabled or not
|
|
45
|
+
*/
|
|
46
|
+
const isControllerExtensionEnabled = (overlays, syncViewsIds, ui5VersionInfo) => {
|
|
47
|
+
if (overlays.length === 0 || overlays.length > 1) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
return isControllerExtensionEnabledForControl(overlays[0].getElement(), syncViewsIds, ui5VersionInfo);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Determines whether the fragment command should be enabled based on the provided overlays.
|
|
55
|
+
*
|
|
56
|
+
* @param {ElementOverlay[]} overlays - An array of ElementOverlay objects representing the UI overlays.
|
|
57
|
+
* @param ui5VersionInfo UI5 version information
|
|
58
|
+
* @returns {boolean} True if the fragment command is enabled, false otherwise.
|
|
59
|
+
*/
|
|
60
|
+
const isFragmentCommandEnabled = (overlays, ui5VersionInfo) => {
|
|
61
|
+
if (overlays.length === 0 || overlays.length > 1) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
const control = overlays[0].getElement();
|
|
65
|
+
return hasStableId(overlays[0]) && !isReuseComponent(control.getId(), ui5VersionInfo);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Determines the text that should be displayed for the Add Fragment context menu item.
|
|
70
|
+
*
|
|
71
|
+
* @param {ElementOverlay} overlay - An ElementOverlay object representing the UI overlay.
|
|
72
|
+
* @returns {string} The text of the Add Fragment context menu item.
|
|
73
|
+
*/
|
|
74
|
+
const getAddFragmentItemText = overlay => {
|
|
75
|
+
if (!hasStableId(overlay)) {
|
|
76
|
+
return 'Add: Fragment (Unavailable due to unstable ID of the control or its parent control)';
|
|
77
|
+
}
|
|
78
|
+
return 'Add: Fragment';
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Handler for new context menu entry
|
|
83
|
+
*
|
|
84
|
+
* @param overlay Control overlays
|
|
85
|
+
* @param rta Runtime Authoring
|
|
86
|
+
* @param dialogName Dialog name
|
|
87
|
+
* @param extensionPointData Control ID
|
|
88
|
+
* @param options Dialog options
|
|
89
|
+
*/
|
|
90
|
+
async function handler(overlay, rta, dialogName, extensionPointData) {
|
|
91
|
+
let options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
92
|
+
let controller;
|
|
93
|
+
const resources = await getTextBundle();
|
|
94
|
+
switch (dialogName) {
|
|
95
|
+
case DialogNames.ADD_FRAGMENT:
|
|
96
|
+
controller = new AddFragment(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, {
|
|
97
|
+
aggregation: options.aggregation,
|
|
98
|
+
title: resources.getText(options.title ?? 'ADP_ADD_FRAGMENT_DIALOG_TITLE')
|
|
99
|
+
});
|
|
100
|
+
break;
|
|
101
|
+
case DialogNames.ADD_TABLE_COLUMN_FRAGMENTS:
|
|
102
|
+
controller = new AddTableColumnFragments(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, {
|
|
103
|
+
aggregation: options.aggregation,
|
|
104
|
+
title: resources.getText(options.title ?? 'ADP_ADD_FRAGMENT_DIALOG_TITLE')
|
|
105
|
+
});
|
|
106
|
+
break;
|
|
107
|
+
case DialogNames.CONTROLLER_EXTENSION:
|
|
108
|
+
controller = new ControllerExtension(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta);
|
|
109
|
+
break;
|
|
110
|
+
case DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT:
|
|
111
|
+
controller = new ExtensionPoint(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, extensionPointData);
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
const id = dialogName === DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT ? `dialog--${dialogName}` : undefined;
|
|
115
|
+
const dialog = await Fragment.load({
|
|
116
|
+
name: `open.ux.preview.client.adp.ui.${dialogName}`,
|
|
117
|
+
controller,
|
|
118
|
+
id
|
|
119
|
+
});
|
|
120
|
+
await controller.setup(dialog);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Adds a new item to the context menu
|
|
125
|
+
*
|
|
126
|
+
* @param rta Runtime Authoring
|
|
127
|
+
* @param syncViewsIds Ids of all application sync views
|
|
128
|
+
* @param ui5VersionInfo UI5 version information
|
|
129
|
+
*/
|
|
130
|
+
const initDialogs = (rta, syncViewsIds, ui5VersionInfo) => {
|
|
131
|
+
const contextMenu = rta.getDefaultPlugins().contextMenu;
|
|
132
|
+
contextMenu.addMenuItem({
|
|
133
|
+
id: 'ADD_FRAGMENT',
|
|
134
|
+
text: getAddFragmentItemText,
|
|
135
|
+
handler: async overlays => await handler(overlays[0], rta, DialogNames.ADD_FRAGMENT),
|
|
136
|
+
icon: 'sap-icon://attachment-html',
|
|
137
|
+
enabled: overlays => isFragmentCommandEnabled(overlays, ui5VersionInfo)
|
|
138
|
+
});
|
|
139
|
+
contextMenu.addMenuItem({
|
|
140
|
+
id: 'EXTEND_CONTROLLER',
|
|
141
|
+
text: 'Extend With Controller',
|
|
142
|
+
handler: async overlays => await handler(overlays[0], rta, DialogNames.CONTROLLER_EXTENSION),
|
|
143
|
+
icon: 'sap-icon://create-form',
|
|
144
|
+
enabled: overlays => isControllerExtensionEnabled(overlays, syncViewsIds, ui5VersionInfo)
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
var __exports = {
|
|
148
|
+
__esModule: true
|
|
149
|
+
};
|
|
150
|
+
__exports.DialogNames = DialogNames;
|
|
151
|
+
__exports.isControllerExtensionEnabledForControl = isControllerExtensionEnabledForControl;
|
|
152
|
+
__exports.isControllerExtensionEnabled = isControllerExtensionEnabled;
|
|
153
|
+
__exports.isFragmentCommandEnabled = isFragmentCommandEnabled;
|
|
154
|
+
__exports.getAddFragmentItemText = getAddFragmentItemText;
|
|
155
|
+
__exports.handler = handler;
|
|
156
|
+
__exports.initDialogs = initDialogs;
|
|
157
|
+
return __exports;
|
|
158
158
|
});
|
|
159
159
|
//# sourceMappingURL=init-dialogs.js.map
|