@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,188 @@
|
|
|
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
|
-
const targetAggregation = allAggregations.filter(item => {
|
|
60
|
-
if (hiddenAggregations.indexOf(item) === -1) {
|
|
61
|
-
return item;
|
|
62
|
-
}
|
|
63
|
-
return false;
|
|
64
|
-
});
|
|
65
|
-
return {
|
|
66
|
-
controlMetadata,
|
|
67
|
-
targetAggregation
|
|
68
|
-
};
|
|
69
|
-
},
|
|
70
|
-
fillIndexArray: function _fillIndexArray(selectedControlChildren) {
|
|
71
|
-
let indexArray = [];
|
|
72
|
-
if (selectedControlChildren.length === 0) {
|
|
73
|
-
indexArray.push({
|
|
74
|
-
key: 0,
|
|
75
|
-
value: 0
|
|
76
|
-
});
|
|
77
|
-
} else {
|
|
78
|
-
indexArray = selectedControlChildren.map((elem, index) => {
|
|
79
|
-
return {
|
|
80
|
-
key: index + 1,
|
|
81
|
-
value: elem + 1
|
|
82
|
-
};
|
|
83
|
-
});
|
|
84
|
-
indexArray.unshift({
|
|
85
|
-
key: 0,
|
|
86
|
-
value: 0
|
|
87
|
-
});
|
|
88
|
-
indexArray.push({
|
|
89
|
-
key: selectedControlChildren.length + 1,
|
|
90
|
-
value: selectedControlChildren.length + 1
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
return indexArray;
|
|
94
|
-
},
|
|
95
|
-
onFragmentNameInputChange: function _onFragmentNameInputChange(event) {
|
|
96
|
-
const input = event.getSource();
|
|
97
|
-
const beginBtn = this.dialog.getBeginButton();
|
|
98
|
-
const fragmentName = input.getValue();
|
|
99
|
-
const fragmentList = this.model.getProperty('/fragmentList');
|
|
100
|
-
const updateDialogState = function (valueState) {
|
|
101
|
-
let valueStateText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
102
|
-
input.setValueState(valueState).setValueStateText(valueStateText);
|
|
103
|
-
beginBtn.setEnabled(valueState === ValueState.Success);
|
|
104
|
-
};
|
|
105
|
-
if (fragmentName.length <= 0) {
|
|
106
|
-
updateDialogState(ValueState.None);
|
|
107
|
-
this.model.setProperty('/newFragmentName', null);
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
const fileExists = fragmentList.some(f => f.fragmentName === `${ fragmentName }.fragment.xml`);
|
|
111
|
-
if (fileExists) {
|
|
112
|
-
updateDialogState(ValueState.Error, 'Enter a different name. The fragment name that you entered already exists in your project.');
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
const isValidName = /^[a-zA-Z_][a-zA-Z0-9_-]*$/.test(fragmentName);
|
|
116
|
-
if (!isValidName) {
|
|
117
|
-
updateDialogState(ValueState.Error, 'The fragment name cannot contain white spaces or special characters.');
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
if (fragmentName.length > 64) {
|
|
121
|
-
updateDialogState(ValueState.Error, 'A fragment file name cannot contain more than 64 characters.');
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
const changeExists = checkForExistingChange(this.rta, 'addXMLAtExtensionPoint', 'content.fragmentPath', `${ fragmentName }.fragment.xml`);
|
|
125
|
-
if (changeExists) {
|
|
126
|
-
updateDialogState(ValueState.Error, 'Enter a different name. The fragment name entered matches the name of an unsaved fragment.');
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
const template = `${ this.rta.getFlexSettings()?.projectId }.changes.fragments.${ fragmentName }`;
|
|
130
|
-
const v4CustomXMLChange = checkForExistingChange(this.rta, 'appdescr_fe_changePageConfiguration', 'content.entityPropertyChange.propertyValue.template', template);
|
|
131
|
-
if (v4CustomXMLChange) {
|
|
132
|
-
updateDialogState(ValueState.Error, 'Enter a different name. The fragment name entered matches the name of an unsaved fragment.');
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
updateDialogState(ValueState.Success);
|
|
136
|
-
this.model.setProperty('/newFragmentName', fragmentName);
|
|
137
|
-
},
|
|
138
|
-
setEscapeHandler: function _setEscapeHandler() {
|
|
139
|
-
this.dialog.setEscapeHandler(_ref => {
|
|
140
|
-
let {resolve} = _ref;
|
|
141
|
-
this.handleDialogClose();
|
|
142
|
-
resolve();
|
|
143
|
-
});
|
|
144
|
-
},
|
|
145
|
-
handleDialogClose: function _handleDialogClose() {
|
|
146
|
-
this.dialog.close();
|
|
147
|
-
this.dialog.destroy();
|
|
148
|
-
},
|
|
149
|
-
specialIndexHandling: function _specialIndexHandling(specialIndexAggregation) {
|
|
150
|
-
const overlay = OverlayRegistry.getOverlay(this.getRuntimeControl());
|
|
151
|
-
const aggregations = overlay.getDesignTimeMetadata().getData().aggregations;
|
|
152
|
-
if (specialIndexAggregation in aggregations && 'specialIndexHandling' in aggregations[specialIndexAggregation]) {
|
|
153
|
-
const controlType = this.getRuntimeControl().getMetadata().getName();
|
|
154
|
-
this.model.setProperty('/indexHandlingFlag', false);
|
|
155
|
-
this.model.setProperty('/specialIndexHandlingIcon', true);
|
|
156
|
-
this.model.setProperty('/iconTooltip', `Index is defined by special logic of ${ controlType } and can't be set here`);
|
|
157
|
-
} else {
|
|
158
|
-
this.model.setProperty('/indexHandlingFlag', true);
|
|
159
|
-
this.model.setProperty('/specialIndexHandlingIcon', false);
|
|
160
|
-
this.model.setProperty('/specialIndexHandlingIconPressed', false);
|
|
161
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["sap/ui/core/library", "sap/ui/core/mvc/Controller", "../utils", "../../utils/core", "../control-utils", "sap/ui/dt/OverlayRegistry", "open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common", "sap/base/Log"], function (sap_ui_core_library, Controller, ___utils, ____utils_core, __ControlUtils, OverlayRegistry, ___sap_ux_private_control_property_editor_common, Log) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
function _interopRequireDefault(obj) {
|
|
7
|
+
return obj && obj.__esModule && typeof obj.default !== "undefined" ? obj.default : obj;
|
|
8
|
+
}
|
|
9
|
+
const ValueState = sap_ui_core_library["ValueState"];
|
|
10
|
+
const checkForExistingChange = ___utils["checkForExistingChange"];
|
|
11
|
+
const getControlById = ____utils_core["getControlById"];
|
|
12
|
+
const ControlUtils = _interopRequireDefault(__ControlUtils);
|
|
13
|
+
const reportTelemetry = ___sap_ux_private_control_property_editor_common["reportTelemetry"];
|
|
14
|
+
/**
|
|
15
|
+
* @namespace open.ux.preview.client.adp.controllers
|
|
16
|
+
*/
|
|
17
|
+
const BaseDialog = Controller.extend("open.ux.preview.client.adp.controllers.BaseDialog", {
|
|
18
|
+
constructor: function _constructor(name, telemetryData) {
|
|
19
|
+
Controller.prototype.constructor.call(this, name);
|
|
20
|
+
this.telemetryData = telemetryData;
|
|
21
|
+
},
|
|
22
|
+
onCreateBtnPressHandler: async function _onCreateBtnPressHandler() {
|
|
23
|
+
try {
|
|
24
|
+
await reportTelemetry({
|
|
25
|
+
category: 'Dialog',
|
|
26
|
+
dialogName: this.dialog.getId(),
|
|
27
|
+
...this.telemetryData
|
|
28
|
+
});
|
|
29
|
+
} catch (error) {
|
|
30
|
+
Log.error('Error in reporting Telemetry:', error);
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
getRuntimeControl: function _getRuntimeControl() {
|
|
34
|
+
if (!this._runtimeControl && this.overlays) {
|
|
35
|
+
const selectorId = this.overlays.getId();
|
|
36
|
+
const overlayControl = getControlById(selectorId);
|
|
37
|
+
if (!overlayControl) {
|
|
38
|
+
throw new Error('Cannot get overlay control');
|
|
39
|
+
}
|
|
40
|
+
this._runtimeControl = ControlUtils.getRuntimeControl(overlayControl);
|
|
41
|
+
}
|
|
42
|
+
return this._runtimeControl;
|
|
43
|
+
},
|
|
44
|
+
/**
|
|
45
|
+
* Method is used in add fragment dialog controllers to get current control metadata which are needed on the dialog
|
|
46
|
+
* @returns control metadata and target aggregations
|
|
47
|
+
*/
|
|
48
|
+
getControlMetadata: function _getControlMetadata() {
|
|
49
|
+
const controlMetadata = this.getRuntimeControl().getMetadata();
|
|
50
|
+
if (!controlMetadata) {
|
|
51
|
+
throw new Error('Cannot get control metadata');
|
|
52
|
+
}
|
|
53
|
+
const allAggregations = Object.keys(controlMetadata.getAllAggregations());
|
|
54
|
+
const hiddenAggregations = ['customData', 'layoutData', 'dependents'];
|
|
55
|
+
const targetAggregation = allAggregations.filter(item => {
|
|
56
|
+
if (hiddenAggregations.indexOf(item) === -1) {
|
|
57
|
+
return item;
|
|
162
58
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
59
|
+
return false;
|
|
60
|
+
});
|
|
61
|
+
return {
|
|
62
|
+
controlMetadata,
|
|
63
|
+
targetAggregation
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
/**
|
|
67
|
+
* Fills indexArray from selected control children
|
|
68
|
+
*
|
|
69
|
+
* @param selectedControlChildren Array of numbers
|
|
70
|
+
* @returns Array of key value pairs
|
|
71
|
+
*/
|
|
72
|
+
fillIndexArray: function _fillIndexArray(selectedControlChildren) {
|
|
73
|
+
let indexArray = [];
|
|
74
|
+
if (selectedControlChildren.length === 0) {
|
|
75
|
+
indexArray.push({
|
|
76
|
+
key: 0,
|
|
77
|
+
value: 0
|
|
78
|
+
});
|
|
79
|
+
} else {
|
|
80
|
+
indexArray = selectedControlChildren.map((elem, index) => {
|
|
81
|
+
return {
|
|
82
|
+
key: index + 1,
|
|
83
|
+
value: elem + 1
|
|
84
|
+
};
|
|
85
|
+
});
|
|
86
|
+
indexArray.unshift({
|
|
87
|
+
key: 0,
|
|
88
|
+
value: 0
|
|
89
|
+
});
|
|
90
|
+
indexArray.push({
|
|
91
|
+
key: selectedControlChildren.length + 1,
|
|
92
|
+
value: selectedControlChildren.length + 1
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
return indexArray;
|
|
96
|
+
},
|
|
97
|
+
/**
|
|
98
|
+
* Handles fragment name input change
|
|
99
|
+
*
|
|
100
|
+
* @param event Event
|
|
101
|
+
*/
|
|
102
|
+
onFragmentNameInputChange: function _onFragmentNameInputChange(event) {
|
|
103
|
+
const input = event.getSource();
|
|
104
|
+
const beginBtn = this.dialog.getBeginButton();
|
|
105
|
+
const fragmentName = input.getValue();
|
|
106
|
+
const fragmentList = this.model.getProperty('/fragmentList');
|
|
107
|
+
const updateDialogState = function (valueState) {
|
|
108
|
+
let valueStateText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
109
|
+
input.setValueState(valueState).setValueStateText(valueStateText);
|
|
110
|
+
beginBtn.setEnabled(valueState === ValueState.Success);
|
|
111
|
+
};
|
|
112
|
+
if (fragmentName.length <= 0) {
|
|
113
|
+
updateDialogState(ValueState.None);
|
|
114
|
+
this.model.setProperty('/newFragmentName', null);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const fileExists = fragmentList.some(f => f.fragmentName === `${fragmentName}.fragment.xml`);
|
|
118
|
+
if (fileExists) {
|
|
119
|
+
updateDialogState(ValueState.Error, 'Enter a different name. The fragment name that you entered already exists in your project.');
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
const isValidName = /^[a-zA-Z_][a-zA-Z0-9_-]*$/.test(fragmentName);
|
|
123
|
+
if (!isValidName) {
|
|
124
|
+
updateDialogState(ValueState.Error, 'The fragment name cannot contain white spaces or special characters.');
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
if (fragmentName.length > 64) {
|
|
128
|
+
updateDialogState(ValueState.Error, 'A fragment file name cannot contain more than 64 characters.');
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
const changeExists = checkForExistingChange(this.rta, 'addXMLAtExtensionPoint', 'content.fragmentPath', `${fragmentName}.fragment.xml`);
|
|
132
|
+
if (changeExists) {
|
|
133
|
+
updateDialogState(ValueState.Error, 'Enter a different name. The fragment name entered matches the name of an unsaved fragment.');
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
// 'changes.fragments' is the current folder structure where fragment changes are written.
|
|
137
|
+
// following value is subjected to change if the folder structure changes
|
|
138
|
+
const template = `${this.rta.getFlexSettings()?.projectId}.changes.fragments.${fragmentName}`;
|
|
139
|
+
const v4CustomXMLChange = checkForExistingChange(this.rta, 'appdescr_fe_changePageConfiguration', 'content.entityPropertyChange.propertyValue.template', template);
|
|
140
|
+
if (v4CustomXMLChange) {
|
|
141
|
+
updateDialogState(ValueState.Error, 'Enter a different name. The fragment name entered matches the name of an unsaved fragment.');
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
updateDialogState(ValueState.Success);
|
|
145
|
+
this.model.setProperty('/newFragmentName', fragmentName);
|
|
146
|
+
},
|
|
147
|
+
/**
|
|
148
|
+
* Sets custom function that fires when user presses escape key.
|
|
149
|
+
*/
|
|
150
|
+
setEscapeHandler: function _setEscapeHandler() {
|
|
151
|
+
this.dialog.setEscapeHandler(_ref => {
|
|
152
|
+
let {
|
|
153
|
+
resolve
|
|
154
|
+
} = _ref;
|
|
155
|
+
this.handleDialogClose();
|
|
156
|
+
resolve();
|
|
157
|
+
});
|
|
158
|
+
},
|
|
159
|
+
/**
|
|
160
|
+
* Handles the dialog closing and destruction of it.
|
|
161
|
+
*/
|
|
162
|
+
handleDialogClose: function _handleDialogClose() {
|
|
163
|
+
this.dialog.close();
|
|
164
|
+
this.dialog.destroy();
|
|
165
|
+
},
|
|
166
|
+
/**
|
|
167
|
+
* Handles the index field whenever a specific aggregation is chosen
|
|
168
|
+
*
|
|
169
|
+
* @param specialIndexAggregation string | number
|
|
170
|
+
*/
|
|
171
|
+
specialIndexHandling: function _specialIndexHandling(specialIndexAggregation) {
|
|
172
|
+
const overlay = OverlayRegistry.getOverlay(this.getRuntimeControl());
|
|
173
|
+
const aggregations = overlay.getDesignTimeMetadata().getData().aggregations;
|
|
174
|
+
if (specialIndexAggregation in aggregations && 'specialIndexHandling' in aggregations[specialIndexAggregation]) {
|
|
175
|
+
const controlType = this.getRuntimeControl().getMetadata().getName();
|
|
176
|
+
this.model.setProperty('/indexHandlingFlag', false);
|
|
177
|
+
this.model.setProperty('/specialIndexHandlingIcon', true);
|
|
178
|
+
this.model.setProperty('/iconTooltip', `Index is defined by special logic of ${controlType} and can't be set here`);
|
|
179
|
+
} else {
|
|
180
|
+
this.model.setProperty('/indexHandlingFlag', true);
|
|
181
|
+
this.model.setProperty('/specialIndexHandlingIcon', false);
|
|
182
|
+
this.model.setProperty('/specialIndexHandlingIconPressed', false);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
return BaseDialog;
|
|
187
|
+
});
|
|
188
|
+
//# sourceMappingURL=BaseDialog.controller.js.map
|