@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.
Files changed (36) hide show
  1. package/dist/client/adp/command-executor.js +99 -66
  2. package/dist/client/adp/controllers/AddCustomFragment.controller.js +120 -102
  3. package/dist/client/adp/controllers/AddFragment.controller.js +189 -163
  4. package/dist/client/adp/controllers/AddSubpage.controller.js +146 -137
  5. package/dist/client/adp/controllers/AddTableColumnFragments.controller.js +230 -188
  6. package/dist/client/adp/controllers/BaseDialog.controller.js +187 -164
  7. package/dist/client/adp/controllers/ControllerExtension.controller.js +329 -253
  8. package/dist/client/adp/controllers/ExtensionPoint.controller.js +158 -114
  9. package/dist/client/adp/extension-point.js +81 -60
  10. package/dist/client/adp/init.js +100 -99
  11. package/dist/client/adp/quick-actions/common/add-new-annotation-file.js +165 -147
  12. package/dist/client/adp/quick-actions/enablement-validator.js +0 -4
  13. package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +105 -100
  14. package/dist/client/adp/quick-actions/simple-quick-action-base.js +44 -40
  15. package/dist/client/adp/quick-actions/table-quick-action-base.js +309 -266
  16. package/dist/client/adp/sync-views-utils.js +119 -83
  17. package/dist/client/cpe/changes/flex-change.js +64 -48
  18. package/dist/client/cpe/changes/service.js +492 -367
  19. package/dist/client/cpe/communication-service.js +41 -29
  20. package/dist/client/cpe/connector-service.js +87 -64
  21. package/dist/client/cpe/context-menu-service.js +87 -74
  22. package/dist/client/cpe/control-data.js +353 -263
  23. package/dist/client/cpe/documentation.js +183 -126
  24. package/dist/client/cpe/init.js +69 -75
  25. package/dist/client/cpe/outline/service.js +60 -45
  26. package/dist/client/cpe/quick-actions/quick-action-definition.js +0 -4
  27. package/dist/client/cpe/quick-actions/quick-action-service.js +154 -129
  28. package/dist/client/cpe/rta-service.js +91 -69
  29. package/dist/client/cpe/selection.js +239 -187
  30. package/dist/client/cpe/types.js +0 -4
  31. package/dist/client/flp/init.js +403 -296
  32. package/dist/client/manifest.json +7 -4
  33. package/dist/client/thirdparty/@sap-ux-private/control-property-editor-common.js +444 -370
  34. package/dist/client/utils/info-center-message.js +59 -31
  35. package/dist/client/utils/version.js +128 -72
  36. package/package.json +4 -4
@@ -1,190 +1,232 @@
1
- 'use strict';
2
- sap.ui.define([
3
- 'sap/ui/model/json/JSONModel',
4
- 'sap/ui/dt/OverlayRegistry',
5
- 'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
6
- '../../cpe/communication-service',
7
- '../../i18n',
8
- 'sap/ui/core/library',
9
- '../../utils/additional-change-info',
10
- '../../utils/error',
11
- '../../utils/info-center-message',
12
- '../api-handler',
13
- '../command-executor',
14
- '../control-utils',
15
- './BaseDialog.controller'
16
- ], function (JSONModel, OverlayRegistry, ___sap_ux_private_control_property_editor_common, ____cpe_communication_service, ____i18n, sap_ui_core_library, ____utils_additional_change_info, ____utils_error, ____utils_info_center_message, ___api_handler, __CommandExecutor, __ControlUtils, __BaseDialog) {
17
- 'use strict';
18
- function _interopRequireDefault(obj) {
19
- return obj && obj.__esModule && typeof obj.default !== 'undefined' ? obj.default : obj;
20
- }
21
- const MessageBarType = ___sap_ux_private_control_property_editor_common['MessageBarType'];
22
- const setApplicationRequiresReload = ___sap_ux_private_control_property_editor_common['setApplicationRequiresReload'];
23
- const CommunicationService = ____cpe_communication_service['CommunicationService'];
24
- const getResourceModel = ____i18n['getResourceModel'];
25
- const ValueState = sap_ui_core_library['ValueState'];
26
- const setAdditionalChangeInfoForChangeFile = ____utils_additional_change_info['setAdditionalChangeInfoForChangeFile'];
27
- const getError = ____utils_error['getError'];
28
- const sendInfoCenterMessage = ____utils_info_center_message['sendInfoCenterMessage'];
29
- const getFragments = ___api_handler['getFragments'];
30
- const CommandExecutor = _interopRequireDefault(__CommandExecutor);
31
- const ControlUtils = _interopRequireDefault(__ControlUtils);
32
- const BaseDialog = _interopRequireDefault(__BaseDialog);
33
- const radix = 10;
34
- const COLUMNS_AGGREGATION = 'columns';
35
- const ITEMS_AGGREGATION = 'items';
36
- const CELLS_AGGREGATION = 'cells';
37
- const AddTableColumnFragments = BaseDialog.extend('open.ux.preview.client.adp.controllers.AddTableColumnFragments', {
38
- constructor: function _constructor(name, overlays, rta, options, telemetryData) {
39
- BaseDialog.prototype.constructor.call(this, name, telemetryData);
40
- this.options = options;
41
- this.rta = rta;
42
- this.overlays = overlays;
43
- this.model = new JSONModel({ title: options.title });
44
- this.commandExecutor = new CommandExecutor(this.rta);
45
- },
46
- setup: async function _setup(dialog) {
47
- this.dialog = dialog;
48
- this.setEscapeHandler();
49
- await this.buildDialogData();
50
- const resourceModel = await getResourceModel('open.ux.preview.client');
51
- this.dialog.setModel(resourceModel, 'i18n');
52
- this.dialog.setModel(this.model);
53
- this.dialog.open();
54
- },
55
- onCreateBtnPress: async function _onCreateBtnPress(event) {
56
- const source = event.getSource();
57
- source.setEnabled(false);
58
- await BaseDialog.prototype.onCreateBtnPressHandler.call(this);
59
- const columnFragmentName = this.model.getProperty('/newColumnFragmentName');
60
- const cellFragmentName = this.model.getProperty('/newCellFragmentName');
61
- const index = this.model.getProperty('/selectedIndex');
62
- const fragmentData = {
63
- index,
64
- fragments: [
65
- {
66
- fragmentName: columnFragmentName,
67
- targetAggregation: this.model.getProperty('/selectedColumnsAggregation')
68
- },
69
- {
70
- fragmentName: cellFragmentName,
71
- targetAggregation: this.model.getProperty('/selectedItemsAggregation')
72
- }
73
- ]
74
- };
75
- await this.createFragmentChange(fragmentData);
76
- await sendInfoCenterMessage({
77
- title: { key: 'ADP_CREATE_XML_FRAGMENT_TITLE' },
78
- description: {
79
- key: 'ADP_ADD_TWO_FRAGMENTS_WITH_TEMPLATE_NOTIFICATION',
80
- params: [
81
- columnFragmentName,
82
- cellFragmentName
83
- ]
84
- },
85
- type: MessageBarType.info
86
- });
87
- this.handleDialogClose();
88
- },
89
- buildDialogData: async function _buildDialogData() {
90
- const {controlMetadata, targetAggregation} = this.getControlMetadata();
91
- const defaultAggregation = this.options.aggregation ?? controlMetadata.getDefaultAggregationName();
92
- const selectedControlName = controlMetadata.getName();
93
- let selectedControlChildren = Object.keys(ControlUtils.getControlAggregationByName(this.getRuntimeControl(), defaultAggregation));
94
- selectedControlChildren = selectedControlChildren.map(key => {
95
- return Number.parseInt(key, radix);
96
- });
97
- this.model.setProperty('/selectedControlName', selectedControlName);
98
- const indexArray = this.fillIndexArray(selectedControlChildren);
99
- if (!targetAggregation.includes(COLUMNS_AGGREGATION)) {
100
- throw new Error(`Selected control does not have "${ COLUMNS_AGGREGATION }" aggregation`);
101
- }
102
- this.model.setProperty('/selectedColumnsAggregation', COLUMNS_AGGREGATION);
103
- this.specialIndexHandling(COLUMNS_AGGREGATION);
104
- if (!targetAggregation.includes(ITEMS_AGGREGATION)) {
105
- throw new Error(`Selected control does not have "${ ITEMS_AGGREGATION }" aggregation`);
106
- }
107
- this.model.setProperty('/selectedItemsAggregation', ITEMS_AGGREGATION);
108
- try {
109
- const {fragments} = await getFragments();
110
- this.model.setProperty('/fragmentList', fragments);
111
- } catch (e) {
112
- const error = getError(e);
113
- await sendInfoCenterMessage({
114
- title: { key: 'ADP_GET_FRAGMENTS_FAILURE_TITLE' },
115
- description: error.message,
116
- type: MessageBarType.error
117
- });
118
- throw error;
119
- }
120
- this.model.setProperty('/index', indexArray);
121
- this.model.setProperty('/selectedIndex', indexArray.length - 1);
1
+ "use strict";
2
+
3
+ sap.ui.define(["sap/ui/model/json/JSONModel", "sap/ui/dt/OverlayRegistry", "open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common", "../../cpe/communication-service", "../../i18n", "sap/ui/core/library", "../../utils/additional-change-info", "../../utils/error", "../../utils/info-center-message", "../api-handler", "../command-executor", "../control-utils", "./BaseDialog.controller"], function (JSONModel, OverlayRegistry, ___sap_ux_private_control_property_editor_common, ____cpe_communication_service, ____i18n, sap_ui_core_library, ____utils_additional_change_info, ____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 MessageBarType = ___sap_ux_private_control_property_editor_common["MessageBarType"];
10
+ const setApplicationRequiresReload = ___sap_ux_private_control_property_editor_common["setApplicationRequiresReload"];
11
+ const CommunicationService = ____cpe_communication_service["CommunicationService"];
12
+ const getResourceModel = ____i18n["getResourceModel"];
13
+ const ValueState = sap_ui_core_library["ValueState"];
14
+ const setAdditionalChangeInfoForChangeFile = ____utils_additional_change_info["setAdditionalChangeInfoForChangeFile"];
15
+ const getError = ____utils_error["getError"];
16
+ const sendInfoCenterMessage = ____utils_info_center_message["sendInfoCenterMessage"];
17
+ const getFragments = ___api_handler["getFragments"];
18
+ const CommandExecutor = _interopRequireDefault(__CommandExecutor);
19
+ const ControlUtils = _interopRequireDefault(__ControlUtils);
20
+ const BaseDialog = _interopRequireDefault(__BaseDialog);
21
+ const radix = 10;
22
+ const COLUMNS_AGGREGATION = 'columns';
23
+ const ITEMS_AGGREGATION = 'items';
24
+ const CELLS_AGGREGATION = 'cells';
25
+ /**
26
+ * @namespace open.ux.preview.client.adp.controllers
27
+ */
28
+ const AddTableColumnFragments = BaseDialog.extend("open.ux.preview.client.adp.controllers.AddTableColumnFragments", {
29
+ constructor: function _constructor(name, overlays, rta, options, telemetryData) {
30
+ BaseDialog.prototype.constructor.call(this, name, telemetryData);
31
+ this.options = options;
32
+ this.rta = rta;
33
+ this.overlays = overlays;
34
+ this.model = new JSONModel({
35
+ title: options.title
36
+ });
37
+ this.commandExecutor = new CommandExecutor(this.rta);
38
+ },
39
+ /**
40
+ * Setups the Dialog and the JSON Model
41
+ *
42
+ * @param {Dialog} dialog - Dialog instance
43
+ */
44
+ setup: async function _setup(dialog) {
45
+ this.dialog = dialog;
46
+ this.setEscapeHandler();
47
+ await this.buildDialogData();
48
+ const resourceModel = await getResourceModel('open.ux.preview.client');
49
+ this.dialog.setModel(resourceModel, 'i18n');
50
+ this.dialog.setModel(this.model);
51
+ this.dialog.open();
52
+ },
53
+ /**
54
+ * Handles create button press
55
+ *
56
+ * @param event Event
57
+ */
58
+ onCreateBtnPress: async function _onCreateBtnPress(event) {
59
+ const source = event.getSource();
60
+ source.setEnabled(false);
61
+ await BaseDialog.prototype.onCreateBtnPressHandler.call(this);
62
+ const columnFragmentName = this.model.getProperty('/newColumnFragmentName');
63
+ const cellFragmentName = this.model.getProperty('/newCellFragmentName');
64
+ const index = this.model.getProperty('/selectedIndex');
65
+ const fragmentData = {
66
+ index,
67
+ fragments: [{
68
+ fragmentName: columnFragmentName,
69
+ targetAggregation: this.model.getProperty('/selectedColumnsAggregation')
70
+ }, {
71
+ fragmentName: cellFragmentName,
72
+ targetAggregation: this.model.getProperty('/selectedItemsAggregation')
73
+ }]
74
+ };
75
+ await this.createFragmentChange(fragmentData);
76
+ await sendInfoCenterMessage({
77
+ title: {
78
+ key: 'ADP_CREATE_XML_FRAGMENT_TITLE'
122
79
  },
123
- updateFormState: function _updateFormState() {
124
- const form = this.dialog.getContent()[0];
125
- const formContent = form.getContent();
126
- const inputs = formContent.filter(item => item.isA('sap.m.Input'));
127
- const value1 = inputs[0].getValue();
128
- const value2 = inputs[1].getValue();
129
- if (value1 === value2 && value1.length) {
130
- inputs.forEach(input => {
131
- if (input.getValueState() === ValueState.Success) {
132
- input.setValueState(ValueState.Error).setValueStateText('Duplicate name');
133
- }
134
- });
135
- } else {
136
- inputs.forEach(input => {
137
- if (input.getValueState() === ValueState.Error && input.getValueStateText() === 'Duplicate name') {
138
- input.setValueState(ValueState.Success);
139
- }
140
- });
141
- }
142
- const beginBtn = this.dialog.getBeginButton();
143
- beginBtn.setEnabled(inputs.every(input => input.getValueState() === ValueState.Success));
80
+ description: {
81
+ key: 'ADP_ADD_TWO_FRAGMENTS_WITH_TEMPLATE_NOTIFICATION',
82
+ params: [columnFragmentName, cellFragmentName]
144
83
  },
145
- onColumnFragmentNameInputChange: function _onColumnFragmentNameInputChange(event) {
146
- BaseDialog.prototype.onFragmentNameInputChange.call(this, event);
147
- const input = event.getSource();
148
- let modelValue = input.getValue();
149
- if (modelValue.length < 1) {
150
- modelValue = null;
151
- }
152
- this.model.setProperty('/newColumnFragmentName', modelValue);
153
- this.updateFormState();
154
- },
155
- onCellFragmentNameInputChange: function _onCellFragmentNameInputChange(event) {
156
- BaseDialog.prototype.onFragmentNameInputChange.call(this, event);
157
- const input = event.getSource();
158
- let modelValue = input.getValue();
159
- if (input.getValue().length < 1) {
160
- modelValue = null;
161
- }
162
- this.model.setProperty('/newCellFragmentName', modelValue);
163
- this.updateFormState();
164
- },
165
- createFragmentChange: async function _createFragmentChange(fragmentData) {
166
- const {fragments, index} = fragmentData;
167
- const flexSettings = this.rta.getFlexSettings();
168
- const overlay = OverlayRegistry.getOverlay(this.getRuntimeControl());
169
- const designMetadata = overlay.getDesignTimeMetadata();
170
- const compositeCommand = await this.commandExecutor.createCompositeCommand(this.getRuntimeControl());
171
- for (const fragment of fragments) {
172
- const modifiedValue = {
173
- fragment: `<core:FragmentDefinition xmlns:core='sap.ui.core'></core:FragmentDefinition>`,
174
- fragmentPath: `fragments/${ fragment.fragmentName }.fragment.xml`,
175
- index: index ?? 0,
176
- targetAggregation: fragment.targetAggregation === ITEMS_AGGREGATION ? CELLS_AGGREGATION : fragment.targetAggregation
177
- };
178
- const targetObject = fragment.targetAggregation === COLUMNS_AGGREGATION ? this.getRuntimeControl() : this.getRuntimeControl().getAggregation(ITEMS_AGGREGATION)[0];
179
- const command = await this.commandExecutor.getCommand(targetObject, 'addXML', modifiedValue, flexSettings, designMetadata);
180
- const templateName = fragment.targetAggregation === COLUMNS_AGGREGATION ? `V2_SMART_TABLE_COLUMN` : 'V2_SMART_TABLE_CELL';
181
- const preparedChange = command.getPreparedChange();
182
- setAdditionalChangeInfoForChangeFile(preparedChange.getDefinition().fileName, { templateName });
183
- compositeCommand.addCommand(command, false);
184
- }
185
- await this.commandExecutor.pushAndExecuteCommand(compositeCommand);
186
- CommunicationService.sendAction(setApplicationRequiresReload(true));
187
- }
188
- });
189
- return AddTableColumnFragments;
190
- });
84
+ type: MessageBarType.info
85
+ });
86
+ this.handleDialogClose();
87
+ },
88
+ /**
89
+ * Builds data that is used in the dialog
90
+ */
91
+ buildDialogData: async function _buildDialogData() {
92
+ const {
93
+ controlMetadata,
94
+ targetAggregation
95
+ } = this.getControlMetadata();
96
+ const defaultAggregation = this.options.aggregation ?? controlMetadata.getDefaultAggregationName();
97
+ const selectedControlName = controlMetadata.getName();
98
+ let selectedControlChildren = Object.keys(ControlUtils.getControlAggregationByName(this.getRuntimeControl(), defaultAggregation));
99
+ selectedControlChildren = selectedControlChildren.map(key => {
100
+ return Number.parseInt(key, radix);
101
+ });
102
+ this.model.setProperty('/selectedControlName', selectedControlName);
103
+ const indexArray = this.fillIndexArray(selectedControlChildren);
104
+ if (!targetAggregation.includes(COLUMNS_AGGREGATION)) {
105
+ throw new Error(`Selected control does not have "${COLUMNS_AGGREGATION}" aggregation`);
106
+ }
107
+ this.model.setProperty('/selectedColumnsAggregation', COLUMNS_AGGREGATION);
108
+ this.specialIndexHandling(COLUMNS_AGGREGATION);
109
+ if (!targetAggregation.includes(ITEMS_AGGREGATION)) {
110
+ throw new Error(`Selected control does not have "${ITEMS_AGGREGATION}" aggregation`);
111
+ }
112
+ this.model.setProperty('/selectedItemsAggregation', ITEMS_AGGREGATION);
113
+ try {
114
+ const {
115
+ fragments
116
+ } = await getFragments();
117
+ this.model.setProperty('/fragmentList', fragments);
118
+ } catch (e) {
119
+ const error = getError(e);
120
+ await sendInfoCenterMessage({
121
+ title: {
122
+ key: 'ADP_GET_FRAGMENTS_FAILURE_TITLE'
123
+ },
124
+ description: error.message,
125
+ type: MessageBarType.error
126
+ });
127
+ throw error;
128
+ }
129
+ this.model.setProperty('/index', indexArray);
130
+ this.model.setProperty('/selectedIndex', indexArray.length - 1);
131
+ },
132
+ /**
133
+ * Checks input values for duplicates and updates confirmation button state based on input validation states
134
+ */
135
+ updateFormState: function _updateFormState() {
136
+ const form = this.dialog.getContent()[0];
137
+ const formContent = form.getContent();
138
+ const inputs = formContent.filter(item => item.isA('sap.m.Input'));
139
+ const value1 = inputs[0].getValue();
140
+ const value2 = inputs[1].getValue();
141
+ // check duplicating fragment names
142
+ if (value1 === value2 && value1.length) {
143
+ inputs.forEach(input => {
144
+ if (input.getValueState() === ValueState.Success) {
145
+ // if there is no other validation error
146
+ input.setValueState(ValueState.Error).setValueStateText('Duplicate name');
147
+ }
148
+ });
149
+ } else {
150
+ // clear duplicates error
151
+ inputs.forEach(input => {
152
+ if (input.getValueState() === ValueState.Error && input.getValueStateText() === 'Duplicate name') {
153
+ input.setValueState(ValueState.Success);
154
+ }
155
+ });
156
+ }
157
+ const beginBtn = this.dialog.getBeginButton();
158
+ beginBtn.setEnabled(inputs.every(input => input.getValueState() === ValueState.Success));
159
+ },
160
+ /**
161
+ * Handles column fragment name input change
162
+ *
163
+ * @param event Event
164
+ */
165
+ onColumnFragmentNameInputChange: function _onColumnFragmentNameInputChange(event) {
166
+ // call parent method to update control state and show warning messages
167
+ BaseDialog.prototype.onFragmentNameInputChange.call(this, event);
168
+
169
+ // update model value
170
+ const input = event.getSource();
171
+ let modelValue = input.getValue();
172
+ if (modelValue.length < 1) {
173
+ modelValue = null;
174
+ }
175
+ this.model.setProperty('/newColumnFragmentName', modelValue);
176
+ this.updateFormState();
177
+ },
178
+ /**
179
+ * Handles cell fragment name input change
180
+ *
181
+ * @param event Event
182
+ */
183
+ onCellFragmentNameInputChange: function _onCellFragmentNameInputChange(event) {
184
+ // call parent method to update control state and show warning messages
185
+ BaseDialog.prototype.onFragmentNameInputChange.call(this, event);
186
+
187
+ // update model value
188
+ const input = event.getSource();
189
+ let modelValue = input.getValue();
190
+ if (input.getValue().length < 1) {
191
+ modelValue = null;
192
+ }
193
+ this.model.setProperty('/newCellFragmentName', modelValue);
194
+ this.updateFormState();
195
+ },
196
+ /**
197
+ * Creates an addXML fragment command and pushes it to the command stack
198
+ *
199
+ * @param fragmentData Fragment Data
200
+ */
201
+ createFragmentChange: async function _createFragmentChange(fragmentData) {
202
+ const {
203
+ fragments,
204
+ index
205
+ } = fragmentData;
206
+ const flexSettings = this.rta.getFlexSettings();
207
+ const overlay = OverlayRegistry.getOverlay(this.getRuntimeControl());
208
+ const designMetadata = overlay.getDesignTimeMetadata();
209
+ const compositeCommand = await this.commandExecutor.createCompositeCommand(this.getRuntimeControl());
210
+ for (const fragment of fragments) {
211
+ const modifiedValue = {
212
+ fragment: `<core:FragmentDefinition xmlns:core='sap.ui.core'></core:FragmentDefinition>`,
213
+ fragmentPath: `fragments/${fragment.fragmentName}.fragment.xml`,
214
+ index: index ?? 0,
215
+ targetAggregation: fragment.targetAggregation === ITEMS_AGGREGATION ? CELLS_AGGREGATION : fragment.targetAggregation
216
+ };
217
+ const targetObject = fragment.targetAggregation === COLUMNS_AGGREGATION ? this.getRuntimeControl() : this.getRuntimeControl().getAggregation(ITEMS_AGGREGATION)[0];
218
+ const command = await this.commandExecutor.getCommand(targetObject, 'addXML', modifiedValue, flexSettings, designMetadata);
219
+ const templateName = fragment.targetAggregation === COLUMNS_AGGREGATION ? `V2_SMART_TABLE_COLUMN` : 'V2_SMART_TABLE_CELL';
220
+ const preparedChange = command.getPreparedChange();
221
+ setAdditionalChangeInfoForChangeFile(preparedChange.getDefinition().fileName, {
222
+ templateName
223
+ });
224
+ compositeCommand.addCommand(command, false);
225
+ }
226
+ await this.commandExecutor.pushAndExecuteCommand(compositeCommand);
227
+ CommunicationService.sendAction(setApplicationRequiresReload(true));
228
+ }
229
+ });
230
+ return AddTableColumnFragments;
231
+ });
232
+ //# sourceMappingURL=AddTableColumnFragments.controller.js.map