@sap-ux/preview-middleware 0.23.48 → 0.23.50
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/command-executor.js +99 -66
- package/dist/client/adp/controllers/AddCustomFragment.controller.js +120 -102
- package/dist/client/adp/controllers/AddFragment.controller.js +189 -163
- package/dist/client/adp/controllers/AddSubpage.controller.js +146 -137
- package/dist/client/adp/controllers/AddTableColumnFragments.controller.js +230 -188
- package/dist/client/adp/controllers/BaseDialog.controller.js +187 -164
- package/dist/client/adp/controllers/ControllerExtension.controller.js +329 -253
- package/dist/client/adp/controllers/ExtensionPoint.controller.js +158 -114
- package/dist/client/adp/extension-point.js +81 -60
- package/dist/client/adp/init.js +100 -99
- package/dist/client/adp/quick-actions/common/add-new-annotation-file.js +165 -147
- package/dist/client/adp/quick-actions/enablement-validator.js +0 -4
- package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +105 -100
- package/dist/client/adp/quick-actions/simple-quick-action-base.js +44 -40
- package/dist/client/adp/quick-actions/table-quick-action-base.js +309 -266
- package/dist/client/adp/sync-views-utils.js +119 -83
- package/dist/client/cpe/changes/flex-change.js +64 -48
- package/dist/client/cpe/changes/service.js +492 -367
- package/dist/client/cpe/communication-service.js +41 -29
- package/dist/client/cpe/connector-service.js +87 -64
- package/dist/client/cpe/context-menu-service.js +87 -74
- package/dist/client/cpe/control-data.js +353 -263
- package/dist/client/cpe/documentation.js +183 -126
- package/dist/client/cpe/init.js +69 -75
- package/dist/client/cpe/outline/service.js +60 -45
- package/dist/client/cpe/quick-actions/quick-action-definition.js +0 -4
- package/dist/client/cpe/quick-actions/quick-action-service.js +154 -129
- package/dist/client/cpe/rta-service.js +91 -69
- package/dist/client/cpe/selection.js +239 -187
- package/dist/client/cpe/types.js +0 -4
- package/dist/client/flp/init.js +403 -296
- package/dist/client/manifest.json +7 -4
- package/dist/client/thirdparty/@sap-ux-private/control-property-editor-common.js +444 -370
- package/dist/client/utils/info-center-message.js +59 -31
- package/dist/client/utils/version.js +128 -72
- package/package.json +4 -4
|
@@ -1,165 +1,191 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["sap/ui/model/json/JSONModel", "sap/ui/dt/OverlayRegistry", "../../i18n", "open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common", "../../cpe/additional-change-info/add-xml-additional-info", "../../cpe/communication-service", "../../utils/error", "../../utils/info-center-message", "../api-handler", "../command-executor", "../control-utils", "./BaseDialog.controller"], function (JSONModel, OverlayRegistry, ____i18n, ___sap_ux_private_control_property_editor_common, ____cpe_additional_change_info_add_xml_additional_info, ____cpe_communication_service, ____utils_error, ____utils_info_center_message, ___api_handler, __CommandExecutor, __ControlUtils, __BaseDialog) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
function _interopRequireDefault(obj) {
|
|
7
|
+
return obj && obj.__esModule && typeof obj.default !== "undefined" ? obj.default : obj;
|
|
8
|
+
}
|
|
9
|
+
const getResourceModel = ____i18n["getResourceModel"];
|
|
10
|
+
const MessageBarType = ___sap_ux_private_control_property_editor_common["MessageBarType"];
|
|
11
|
+
const setApplicationRequiresReload = ___sap_ux_private_control_property_editor_common["setApplicationRequiresReload"];
|
|
12
|
+
const getFragmentTemplateName = ____cpe_additional_change_info_add_xml_additional_info["getFragmentTemplateName"];
|
|
13
|
+
const CommunicationService = ____cpe_communication_service["CommunicationService"];
|
|
14
|
+
const getError = ____utils_error["getError"];
|
|
15
|
+
const sendInfoCenterMessage = ____utils_info_center_message["sendInfoCenterMessage"];
|
|
16
|
+
const getFragments = ___api_handler["getFragments"];
|
|
17
|
+
const CommandExecutor = _interopRequireDefault(__CommandExecutor);
|
|
18
|
+
const ControlUtils = _interopRequireDefault(__ControlUtils);
|
|
19
|
+
const BaseDialog = _interopRequireDefault(__BaseDialog);
|
|
20
|
+
const radix = 10;
|
|
21
|
+
/**
|
|
22
|
+
* @namespace open.ux.preview.client.adp.controllers
|
|
23
|
+
*/
|
|
24
|
+
const AddFragment = BaseDialog.extend("open.ux.preview.client.adp.controllers.AddFragment", {
|
|
25
|
+
constructor: function _constructor(name, overlays, rta, options, data, telemetryData) {
|
|
26
|
+
BaseDialog.prototype.constructor.call(this, name, telemetryData);
|
|
27
|
+
this.options = options;
|
|
28
|
+
this.rta = rta;
|
|
29
|
+
this.overlays = overlays;
|
|
30
|
+
this.model = new JSONModel({
|
|
31
|
+
title: options.title,
|
|
32
|
+
completeView: options.aggregation === undefined
|
|
33
|
+
});
|
|
34
|
+
this.commandExecutor = new CommandExecutor(this.rta);
|
|
35
|
+
this.data = data;
|
|
36
|
+
},
|
|
37
|
+
/**
|
|
38
|
+
* Setups the Dialog and the JSON Model
|
|
39
|
+
*
|
|
40
|
+
* @param {Dialog} dialog - Dialog instance
|
|
41
|
+
*/
|
|
42
|
+
setup: async function _setup(dialog) {
|
|
43
|
+
this.dialog = dialog;
|
|
44
|
+
this.setEscapeHandler();
|
|
45
|
+
await this.buildDialogData();
|
|
46
|
+
const resourceModel = await getResourceModel('open.ux.preview.client');
|
|
47
|
+
this.dialog.setModel(resourceModel, 'i18n');
|
|
48
|
+
this.dialog.setModel(this.model);
|
|
49
|
+
this.dialog.open();
|
|
50
|
+
},
|
|
51
|
+
/**
|
|
52
|
+
* Handles the change in aggregations
|
|
53
|
+
*
|
|
54
|
+
* @param event Event
|
|
55
|
+
*/
|
|
56
|
+
onAggregationChanged: function _onAggregationChanged(event) {
|
|
57
|
+
const source = event.getSource();
|
|
58
|
+
const selectedKey = source.getSelectedKey();
|
|
59
|
+
const selectedItem = source.getSelectedItem();
|
|
60
|
+
let selectedItemText = '';
|
|
61
|
+
if (selectedItem) {
|
|
62
|
+
selectedItemText = selectedItem.getText();
|
|
63
|
+
}
|
|
64
|
+
this.model.setProperty('/selectedAggregation/key', selectedKey);
|
|
65
|
+
this.model.setProperty('/selectedAggregation/value', selectedItemText);
|
|
66
|
+
let newSelectedControlChildren = Object.keys(ControlUtils.getControlAggregationByName(this.getRuntimeControl(), selectedItemText));
|
|
67
|
+
newSelectedControlChildren = newSelectedControlChildren.map(key => {
|
|
68
|
+
return Number.parseInt(key, radix);
|
|
69
|
+
});
|
|
70
|
+
this.specialIndexHandling(selectedItemText);
|
|
71
|
+
const updatedIndexArray = this.fillIndexArray(newSelectedControlChildren);
|
|
72
|
+
this.model.setProperty('/index', updatedIndexArray);
|
|
73
|
+
this.model.setProperty('/selectedIndex', updatedIndexArray.length - 1);
|
|
74
|
+
},
|
|
75
|
+
/**
|
|
76
|
+
* Handles create button press
|
|
77
|
+
*
|
|
78
|
+
* @param event Event
|
|
79
|
+
*/
|
|
80
|
+
onCreateBtnPress: async function _onCreateBtnPress(event) {
|
|
81
|
+
const source = event.getSource();
|
|
82
|
+
source.setEnabled(false);
|
|
83
|
+
await BaseDialog.prototype.onCreateBtnPressHandler.call(this);
|
|
84
|
+
const fragmentName = this.model.getProperty('/newFragmentName');
|
|
85
|
+
const index = this.model.getProperty('/selectedIndex');
|
|
86
|
+
const targetAggregation = this.model.getProperty('/selectedAggregation/value') ?? 'content';
|
|
87
|
+
const modifiedValue = {
|
|
88
|
+
fragment: `<core:FragmentDefinition xmlns:core='sap.ui.core'></core:FragmentDefinition>`,
|
|
89
|
+
fragmentPath: `fragments/${fragmentName}.fragment.xml`,
|
|
90
|
+
index: index ?? 0,
|
|
91
|
+
targetAggregation: targetAggregation ?? 'content'
|
|
92
|
+
};
|
|
93
|
+
if (this.data) {
|
|
94
|
+
this.data.deferred.resolve(modifiedValue);
|
|
95
|
+
} else {
|
|
96
|
+
await this.createFragmentChange(modifiedValue);
|
|
97
|
+
}
|
|
98
|
+
const templateName = getFragmentTemplateName(this.getRuntimeControl().getId(), targetAggregation);
|
|
99
|
+
if (templateName) {
|
|
100
|
+
CommunicationService.sendAction(setApplicationRequiresReload(true));
|
|
101
|
+
}
|
|
102
|
+
await sendInfoCenterMessage({
|
|
103
|
+
title: {
|
|
104
|
+
key: 'ADP_CREATE_XML_FRAGMENT_TITLE'
|
|
72
105
|
},
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
await BaseDialog.prototype.onCreateBtnPressHandler.call(this);
|
|
77
|
-
const fragmentName = this.model.getProperty('/newFragmentName');
|
|
78
|
-
const index = this.model.getProperty('/selectedIndex');
|
|
79
|
-
const targetAggregation = this.model.getProperty('/selectedAggregation/value') ?? 'content';
|
|
80
|
-
const modifiedValue = {
|
|
81
|
-
fragment: `<core:FragmentDefinition xmlns:core='sap.ui.core'></core:FragmentDefinition>`,
|
|
82
|
-
fragmentPath: `fragments/${ fragmentName }.fragment.xml`,
|
|
83
|
-
index: index ?? 0,
|
|
84
|
-
targetAggregation: targetAggregation ?? 'content'
|
|
85
|
-
};
|
|
86
|
-
if (this.data) {
|
|
87
|
-
this.data.deferred.resolve(modifiedValue);
|
|
88
|
-
} else {
|
|
89
|
-
await this.createFragmentChange(modifiedValue);
|
|
90
|
-
}
|
|
91
|
-
const templateName = getFragmentTemplateName(this.getRuntimeControl().getId(), targetAggregation);
|
|
92
|
-
if (templateName) {
|
|
93
|
-
CommunicationService.sendAction(setApplicationRequiresReload(true));
|
|
94
|
-
}
|
|
95
|
-
await sendInfoCenterMessage({
|
|
96
|
-
title: { key: 'ADP_CREATE_XML_FRAGMENT_TITLE' },
|
|
97
|
-
description: {
|
|
98
|
-
key: 'ADP_ADD_FRAGMENT_NOTIFICATION',
|
|
99
|
-
params: [fragmentName]
|
|
100
|
-
},
|
|
101
|
-
type: MessageBarType.info
|
|
102
|
-
});
|
|
103
|
-
this.handleDialogClose();
|
|
106
|
+
description: {
|
|
107
|
+
key: 'ADP_ADD_FRAGMENT_NOTIFICATION',
|
|
108
|
+
params: [fragmentName]
|
|
104
109
|
},
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
110
|
+
type: MessageBarType.info
|
|
111
|
+
});
|
|
112
|
+
this.handleDialogClose();
|
|
113
|
+
},
|
|
114
|
+
/**
|
|
115
|
+
* Builds data that is used in the dialog
|
|
116
|
+
*/
|
|
117
|
+
buildDialogData: async function _buildDialogData() {
|
|
118
|
+
const {
|
|
119
|
+
controlMetadata,
|
|
120
|
+
targetAggregation
|
|
121
|
+
} = this.getControlMetadata();
|
|
122
|
+
const defaultAggregation = this.options.aggregation ?? controlMetadata.getDefaultAggregationName();
|
|
123
|
+
const selectedControlName = controlMetadata.getName();
|
|
124
|
+
let selectedControlChildren = Object.keys(ControlUtils.getControlAggregationByName(this.getRuntimeControl(), defaultAggregation));
|
|
125
|
+
selectedControlChildren = selectedControlChildren.map(key => {
|
|
126
|
+
return Number.parseInt(key, radix);
|
|
127
|
+
});
|
|
128
|
+
this.model.setProperty('/selectedControlName', selectedControlName);
|
|
129
|
+
this.model.setProperty('/selectedAggregation', {});
|
|
130
|
+
const indexArray = this.fillIndexArray(selectedControlChildren);
|
|
131
|
+
const controlAggregation = targetAggregation.map((elem, index) => {
|
|
132
|
+
return {
|
|
133
|
+
key: index,
|
|
134
|
+
value: elem
|
|
135
|
+
};
|
|
136
|
+
});
|
|
137
|
+
if (defaultAggregation !== null) {
|
|
138
|
+
controlAggregation.forEach(obj => {
|
|
139
|
+
if (obj.value === defaultAggregation) {
|
|
140
|
+
obj.key = 'default';
|
|
141
|
+
this.model.setProperty('/selectedAggregation/key', obj.key);
|
|
142
|
+
this.model.setProperty('/selectedAggregation/value', obj.value);
|
|
143
|
+
this.specialIndexHandling(obj.value);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
} else {
|
|
147
|
+
this.model.setProperty('/selectedAggregation/key', controlAggregation[0].key);
|
|
148
|
+
this.model.setProperty('/selectedAggregation/value', controlAggregation[0].value);
|
|
149
|
+
this.specialIndexHandling(controlAggregation[0].value);
|
|
150
|
+
}
|
|
151
|
+
try {
|
|
152
|
+
const {
|
|
153
|
+
fragments
|
|
154
|
+
} = await getFragments();
|
|
155
|
+
this.model.setProperty('/fragmentList', fragments);
|
|
156
|
+
} catch (e) {
|
|
157
|
+
const error = getError(e);
|
|
158
|
+
await sendInfoCenterMessage({
|
|
159
|
+
title: {
|
|
160
|
+
key: 'ADP_ADD_FRAGMENT_FAILURE_TITLE'
|
|
161
|
+
},
|
|
162
|
+
description: error.message,
|
|
163
|
+
type: MessageBarType.error
|
|
164
|
+
});
|
|
165
|
+
throw error;
|
|
166
|
+
}
|
|
167
|
+
this.model.setProperty('/selectedIndex', indexArray.length - 1);
|
|
168
|
+
this.model.setProperty('/targetAggregation', controlAggregation);
|
|
169
|
+
this.model.setProperty('/index', indexArray);
|
|
170
|
+
const defaultIndex = Number(this.options.defaultAggregationArrayIndex);
|
|
171
|
+
if (defaultIndex >= 0) {
|
|
172
|
+
this.model.setProperty('/selectedIndex', indexArray.length - 1 > 0 ? defaultIndex : 0);
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
/**
|
|
176
|
+
* Creates an addXML fragment command and pushes it to the command stack
|
|
177
|
+
*
|
|
178
|
+
* @param modifiedValue - modified value
|
|
179
|
+
* @param templateName - fragment template name
|
|
180
|
+
*/
|
|
181
|
+
createFragmentChange: async function _createFragmentChange(modifiedValue) {
|
|
182
|
+
const flexSettings = this.rta.getFlexSettings();
|
|
183
|
+
const overlay = OverlayRegistry.getOverlay(this.getRuntimeControl());
|
|
184
|
+
const designMetadata = overlay.getDesignTimeMetadata();
|
|
185
|
+
const command = await this.commandExecutor.getCommand(this.getRuntimeControl(), 'addXML', modifiedValue, flexSettings, designMetadata);
|
|
186
|
+
await this.commandExecutor.pushAndExecuteCommand(command);
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
return AddFragment;
|
|
190
|
+
});
|
|
191
|
+
//# sourceMappingURL=AddFragment.controller.js.map
|