@sap-ux/preview-middleware 0.19.4 → 0.19.5

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 (40) hide show
  1. package/dist/client/adp/controllers/AddFragment.controller.js +3 -2
  2. package/dist/client/adp/controllers/AddFragment.controller.ts +10 -2
  3. package/dist/client/adp/controllers/AddSubpage.controller.js +3 -2
  4. package/dist/client/adp/controllers/AddSubpage.controller.ts +12 -4
  5. package/dist/client/adp/controllers/AddTableColumnFragments.controller.js +3 -2
  6. package/dist/client/adp/controllers/AddTableColumnFragments.controller.ts +11 -2
  7. package/dist/client/adp/controllers/BaseDialog.controller.js +171 -188
  8. package/dist/client/adp/controllers/BaseDialog.controller.ts +14 -0
  9. package/dist/client/adp/controllers/ControllerExtension.controller.js +3 -2
  10. package/dist/client/adp/controllers/ControllerExtension.controller.ts +4 -2
  11. package/dist/client/adp/controllers/ExtensionPoint.controller.js +2 -1
  12. package/dist/client/adp/controllers/ExtensionPoint.controller.ts +2 -1
  13. package/dist/client/adp/dialog-factory.js +5 -3
  14. package/dist/client/adp/dialog-factory.ts +11 -4
  15. package/dist/client/adp/quick-actions/common/add-controller-to-page.js +4 -1
  16. package/dist/client/adp/quick-actions/common/add-controller-to-page.ts +14 -2
  17. package/dist/client/adp/quick-actions/common/add-new-annotation-file.js +3 -0
  18. package/dist/client/adp/quick-actions/common/add-new-annotation-file.ts +7 -1
  19. package/dist/client/adp/quick-actions/common/add-new-subpage.js +6 -2
  20. package/dist/client/adp/quick-actions/common/add-new-subpage.ts +16 -7
  21. package/dist/client/adp/quick-actions/common/create-page-action.js +3 -0
  22. package/dist/client/adp/quick-actions/common/create-page-action.ts +12 -5
  23. package/dist/client/adp/quick-actions/common/op-add-custom-section.js +3 -0
  24. package/dist/client/adp/quick-actions/common/op-add-custom-section.ts +11 -4
  25. package/dist/client/adp/quick-actions/common/op-add-header-field.js +6 -0
  26. package/dist/client/adp/quick-actions/common/op-add-header-field.ts +22 -8
  27. package/dist/client/adp/quick-actions/fe-v2/create-table-action.js +3 -0
  28. package/dist/client/adp/quick-actions/fe-v2/create-table-action.ts +16 -6
  29. package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +3 -0
  30. package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.ts +22 -6
  31. package/dist/client/adp/quick-actions/fe-v4/create-table-action.js +3 -0
  32. package/dist/client/adp/quick-actions/fe-v4/create-table-action.ts +16 -6
  33. package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column.js +3 -0
  34. package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column.ts +15 -5
  35. package/dist/client/adp/quick-actions/quick-action-base.js +12 -1
  36. package/dist/client/adp/quick-actions/quick-action-base.ts +16 -0
  37. package/dist/client/cpe/quick-actions/quick-action-definition.ts +16 -0
  38. package/dist/client/cpe/quick-actions/quick-action-service.js +12 -1
  39. package/dist/client/cpe/quick-actions/quick-action-service.ts +13 -2
  40. package/package.json +2 -2
@@ -31,8 +31,8 @@ sap.ui.define([
31
31
  const TREE_TABLE_TYPE = ___quick_actions_control_types['TREE_TABLE_TYPE'];
32
32
  const radix = 10;
33
33
  const AddFragment = BaseDialog.extend('open.ux.preview.client.adp.controllers.AddFragment', {
34
- constructor: function _constructor(name, overlays, rta, options) {
35
- BaseDialog.prototype.constructor.call(this, name);
34
+ constructor: function _constructor(name, overlays, rta, options, telemetryData) {
35
+ BaseDialog.prototype.constructor.call(this, name, telemetryData);
36
36
  this.options = options;
37
37
  this.rta = rta;
38
38
  this.overlays = overlays;
@@ -71,6 +71,7 @@ sap.ui.define([
71
71
  this.model.setProperty('/selectedIndex', updatedIndexArray.length - 1);
72
72
  },
73
73
  onCreateBtnPress: async function _onCreateBtnPress(event) {
74
+ await BaseDialog.prototype.onCreateBtnPressHandler.call(this);
74
75
  const source = event.getSource();
75
76
  source.setEnabled(false);
76
77
  const fragmentName = this.model.getProperty('/newFragmentName');
@@ -37,6 +37,7 @@ import {
37
37
  MDC_TABLE_TYPE,
38
38
  TREE_TABLE_TYPE
39
39
  } from '../quick-actions/control-types';
40
+ import { QuickActionTelemetryData } from '../../cpe/quick-actions/quick-action-definition';
40
41
 
41
42
  interface CreateFragmentProps {
42
43
  fragmentName: string;
@@ -64,8 +65,14 @@ export interface AddFragmentOptions {
64
65
  * @namespace open.ux.preview.client.adp.controllers
65
66
  */
66
67
  export default class AddFragment extends BaseDialog<AddFragmentModel> {
67
- constructor(name: string, overlays: UI5Element, rta: RuntimeAuthoring, readonly options: AddFragmentOptions) {
68
- super(name);
68
+ constructor(
69
+ name: string,
70
+ overlays: UI5Element,
71
+ rta: RuntimeAuthoring,
72
+ readonly options: AddFragmentOptions,
73
+ telemetryData?: QuickActionTelemetryData
74
+ ) {
75
+ super(name, telemetryData);
69
76
  this.rta = rta;
70
77
  this.overlays = overlays;
71
78
  this.model = new JSONModel({
@@ -135,6 +142,7 @@ export default class AddFragment extends BaseDialog<AddFragmentModel> {
135
142
  * @param event Event
136
143
  */
137
144
  async onCreateBtnPress(event: Event) {
145
+ await super.onCreateBtnPressHandler();
138
146
  const source = event.getSource<Button>();
139
147
  source.setEnabled(false);
140
148
 
@@ -18,8 +18,8 @@ sap.ui.define([
18
18
  const CommunicationService = ____cpe_communication_service['CommunicationService'];
19
19
  const setApplicationRequiresReload = ___sap_ux_private_control_property_editor_common['setApplicationRequiresReload'];
20
20
  const AddSubpage = BaseDialog.extend('open.ux.preview.client.adp.controllers.AddSubpage', {
21
- constructor: function _constructor(name, overlays, rta, options) {
22
- BaseDialog.prototype.constructor.call(this, name);
21
+ constructor: function _constructor(name, overlays, rta, options, telemetryData) {
22
+ BaseDialog.prototype.constructor.call(this, name, telemetryData);
23
23
  this.options = options;
24
24
  this.rta = rta;
25
25
  this.overlays = overlays;
@@ -50,6 +50,7 @@ sap.ui.define([
50
50
  this.model.setProperty('/selectedNavigation/key', selectedKey);
51
51
  },
52
52
  onCreateBtnPress: async function _onCreateBtnPress(event) {
53
+ await BaseDialog.prototype.onCreateBtnPressHandler.call(this);
53
54
  const source = event.getSource();
54
55
  source.setEnabled(false);
55
56
  const flexSettings = this.rta.getFlexSettings();
@@ -25,6 +25,7 @@ import CommandFactory from 'sap/ui/rta/command/CommandFactory';
25
25
  import { ApplicationType } from '../../utils/application';
26
26
  import { CommunicationService } from '../../cpe/communication-service';
27
27
  import { setApplicationRequiresReload } from '@sap-ux-private/control-property-editor-common';
28
+ import { QuickActionTelemetryData } from '../../cpe/quick-actions/quick-action-definition';
28
29
 
29
30
  type SubpageType = 'ObjectPage' | 'CustomPage';
30
31
 
@@ -46,16 +47,22 @@ export interface AddSubpageOptions {
46
47
  pageDescriptor: {
47
48
  pageType: string;
48
49
  entitySet: string;
49
- navProperties: { navProperty: string; entitySet: string }[];
50
- }
50
+ navProperties: { navProperty: string; entitySet: string }[];
51
+ };
51
52
  }
52
53
 
53
54
  /**
54
55
  * @namespace open.ux.preview.client.adp.controllers
55
56
  */
56
57
  export default class AddSubpage extends BaseDialog<AddSubpageModel> {
57
- constructor(name: string, overlays: UI5Element, rta: RuntimeAuthoring, readonly options: AddSubpageOptions) {
58
- super(name);
58
+ constructor(
59
+ name: string,
60
+ overlays: UI5Element,
61
+ rta: RuntimeAuthoring,
62
+ readonly options: AddSubpageOptions,
63
+ telemetryData?: QuickActionTelemetryData
64
+ ) {
65
+ super(name, telemetryData);
59
66
  this.rta = rta;
60
67
  this.overlays = overlays;
61
68
  this.model = new JSONModel({
@@ -104,6 +111,7 @@ export default class AddSubpage extends BaseDialog<AddSubpageModel> {
104
111
  * @param event Event
105
112
  */
106
113
  async onCreateBtnPress(event: Event) {
114
+ await super.onCreateBtnPressHandler();
107
115
  const source = event.getSource<Button>();
108
116
  source.setEnabled(false);
109
117
 
@@ -31,8 +31,8 @@ sap.ui.define([
31
31
  const ITEMS_AGGREGATION = 'items';
32
32
  const CELLS_AGGREGATION = 'cells';
33
33
  const AddTableColumnFragments = BaseDialog.extend('open.ux.preview.client.adp.controllers.AddTableColumnFragments', {
34
- constructor: function _constructor(name, overlays, rta, options) {
35
- BaseDialog.prototype.constructor.call(this, name);
34
+ constructor: function _constructor(name, overlays, rta, options, telemetryData) {
35
+ BaseDialog.prototype.constructor.call(this, name, telemetryData);
36
36
  this.options = options;
37
37
  this.rta = rta;
38
38
  this.overlays = overlays;
@@ -49,6 +49,7 @@ sap.ui.define([
49
49
  this.dialog.open();
50
50
  },
51
51
  onCreateBtnPress: async function _onCreateBtnPress(event) {
52
+ await BaseDialog.prototype.onCreateBtnPressHandler.call(this);
52
53
  const source = event.getSource();
53
54
  source.setEnabled(false);
54
55
  const columnFragmentName = this.model.getProperty('/newColumnFragmentName');
@@ -38,6 +38,7 @@ import { ValueState } from 'sap/ui/core/library';
38
38
  import Input from 'sap/m/Input';
39
39
  import Control from 'sap/ui/core/Control';
40
40
  import ManagedObject from 'sap/ui/base/ManagedObject';
41
+ import { QuickActionTelemetryData } from '../../cpe/quick-actions/quick-action-definition';
41
42
 
42
43
  const radix = 10;
43
44
 
@@ -59,8 +60,15 @@ interface CreateFragmentProps {
59
60
  * @namespace open.ux.preview.client.adp.controllers
60
61
  */
61
62
  export default class AddTableColumnFragments extends BaseDialog<AddTableColumnsFragmentsModel> {
62
- constructor(name: string, overlays: UI5Element, rta: RuntimeAuthoring, readonly options: AddFragmentOptions) {
63
- super(name);
63
+
64
+ constructor(
65
+ name: string,
66
+ overlays: UI5Element,
67
+ rta: RuntimeAuthoring,
68
+ readonly options: AddFragmentOptions,
69
+ telemetryData?: QuickActionTelemetryData
70
+ ) {
71
+ super(name, telemetryData);
64
72
  this.rta = rta;
65
73
  this.overlays = overlays;
66
74
  this.model = new JSONModel({
@@ -94,6 +102,7 @@ export default class AddTableColumnFragments extends BaseDialog<AddTableColumnsF
94
102
  * @param event Event
95
103
  */
96
104
  async onCreateBtnPress(event: Event) {
105
+ await super.onCreateBtnPressHandler();
97
106
  const source = event.getSource<Button>();
98
107
  source.setEnabled(false);
99
108
 
@@ -1,189 +1,172 @@
1
- "use strict";
2
-
3
- sap.ui.define(["sap/ui/core/library", "sap/ui/core/mvc/Controller", "sap/m/MessageToast", "../utils", "../../utils/error", "../../utils/core", "../control-utils", "sap/ui/dt/OverlayRegistry"], function (sap_ui_core_library, Controller, MessageToast, ___utils, ____utils_error, ____utils_core, __ControlUtils, OverlayRegistry) {
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 matchesFragmentName = ___utils["matchesFragmentName"];
11
- const getError = ____utils_error["getError"];
12
- const getControlById = ____utils_core["getControlById"];
13
- const ControlUtils = _interopRequireDefault(__ControlUtils);
14
- /**
15
- * @namespace open.ux.preview.client.adp.controllers
16
- */
17
- const BaseDialog = Controller.extend("open.ux.preview.client.adp.controllers.BaseDialog", {
18
- /**
19
- * Method is used in add fragment dialog controllers to get current control metadata which are needed on the dialog
20
- * @returns control metadata and target aggregations
21
- */
22
- getControlMetadata: function _getControlMetadata() {
23
- const selectorId = this.overlays.getId();
24
- let controlMetadata;
25
- const overlayControl = getControlById(selectorId);
26
- if (overlayControl) {
27
- this.runtimeControl = ControlUtils.getRuntimeControl(overlayControl);
28
- controlMetadata = this.runtimeControl.getMetadata();
29
- } else {
30
- throw new Error('Cannot get overlay control');
31
- }
32
- const allAggregations = Object.keys(controlMetadata.getAllAggregations());
33
- const hiddenAggregations = ['customData', 'layoutData', 'dependents'];
34
- const targetAggregation = allAggregations.filter(item => {
35
- if (hiddenAggregations.indexOf(item) === -1) {
36
- return item;
37
- }
38
- return false;
39
- });
40
- return {
41
- controlMetadata,
42
- targetAggregation
43
- };
44
- },
45
- /**
46
- * Fills indexArray from selected control children
47
- *
48
- * @param selectedControlChildren Array of numbers
49
- * @returns Array of key value pairs
50
- */
51
- fillIndexArray: function _fillIndexArray(selectedControlChildren) {
52
- let indexArray = [];
53
- if (selectedControlChildren.length === 0) {
54
- indexArray.push({
55
- key: 0,
56
- value: 0
57
- });
58
- } else {
59
- indexArray = selectedControlChildren.map((elem, index) => {
60
- return {
61
- key: index + 1,
62
- value: elem + 1
63
- };
64
- });
65
- indexArray.unshift({
66
- key: 0,
67
- value: 0
68
- });
69
- indexArray.push({
70
- key: selectedControlChildren.length + 1,
71
- value: selectedControlChildren.length + 1
72
- });
73
- }
74
- return indexArray;
75
- },
76
- /**
77
- * Handles fragment name input change
78
- *
79
- * @param event Event
80
- */
81
- onFragmentNameInputChange: function _onFragmentNameInputChange(event) {
82
- const input = event.getSource();
83
- const beginBtn = this.dialog.getBeginButton();
84
- const fragmentName = input.getValue();
85
- const fragmentList = this.model.getProperty('/fragmentList');
86
- const updateDialogState = function (valueState) {
87
- let valueStateText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
88
- input.setValueState(valueState).setValueStateText(valueStateText);
89
- beginBtn.setEnabled(valueState === ValueState.Success);
90
- };
91
- if (fragmentName.length <= 0) {
92
- updateDialogState(ValueState.None);
93
- this.model.setProperty('/newFragmentName', null);
94
- return;
95
- }
96
- const fileExists = fragmentList.some(f => f.fragmentName === `${fragmentName}.fragment.xml`);
97
- if (fileExists) {
98
- updateDialogState(ValueState.Error, 'Enter a different name. The fragment name that you entered already exists in your project.');
99
- return;
100
- }
101
- const isValidName = /^[a-zA-Z_][a-zA-Z0-9_-]*$/.test(fragmentName);
102
- if (!isValidName) {
103
- updateDialogState(ValueState.Error, 'The fragment name cannot contain white spaces or special characters.');
104
- return;
105
- }
106
- if (fragmentName.length > 64) {
107
- updateDialogState(ValueState.Error, 'A fragment file name cannot contain more than 64 characters.');
108
- return;
109
- }
110
- const changeExists = this.checkForExistingChange(fragmentName);
111
- if (changeExists) {
112
- updateDialogState(ValueState.Error, 'Enter a different name. The fragment name entered matches the name of an unsaved fragment.');
113
- return;
114
- }
115
- updateDialogState(ValueState.Success);
116
- this.model.setProperty('/newFragmentName', fragmentName);
117
- },
118
- /**
119
- * Checks for the existence of a change associated with a specific fragment name in the RTA command stack.
120
- *
121
- * @param {string} fragmentName - The name of the fragment to check for existing changes.
122
- * @returns {Promise<boolean>} A promise that resolves to `true` if a matching change is found, otherwise `false`.
123
- */
124
- checkForExistingChange: function _checkForExistingChange(fragmentName) {
125
- const allCommands = this.rta.getCommandStack().getCommands();
126
- return allCommands.some(command => {
127
- if (typeof command.getCommands === 'function') {
128
- const addXmlCommand = command.getCommands().find(c => c?.getProperty('name') === 'addXMLAtExtensionPoint');
129
- return addXmlCommand && matchesFragmentName(addXmlCommand, fragmentName);
130
- } else {
131
- return matchesFragmentName(command, fragmentName);
132
- }
133
- });
134
- },
135
- /**
136
- * Sets custom function that fires when user presses escape key.
137
- */
138
- setEscapeHandler: function _setEscapeHandler() {
139
- this.dialog.setEscapeHandler(_ref => {
140
- let {
141
- resolve
142
- } = _ref;
143
- this.handleDialogClose();
144
- resolve();
145
- });
146
- },
147
- /**
148
- * Handles the dialog closing and destruction of it.
149
- */
150
- handleDialogClose: function _handleDialogClose() {
151
- this.dialog.close();
152
- this.dialog.destroy();
153
- },
154
- /**
155
- * Function that handles runtime thrown errors with MessageToast
156
- *
157
- * @param e error instance
158
- * @throws {Error}.
159
- */
160
- handleError: function _handleError(e) {
161
- const error = getError(e);
162
- MessageToast.show(error.message, {
163
- duration: 5000
164
- });
165
- throw error;
166
- },
167
- /**
168
- * Handles the index field whenever a specific aggregation is chosen
169
- *
170
- * @param specialIndexAggregation string | number
171
- */
172
- specialIndexHandling: function _specialIndexHandling(specialIndexAggregation) {
173
- const overlay = OverlayRegistry.getOverlay(this.runtimeControl);
174
- const aggregations = overlay.getDesignTimeMetadata().getData().aggregations;
175
- if (specialIndexAggregation in aggregations && 'specialIndexHandling' in aggregations[specialIndexAggregation]) {
176
- const controlType = this.runtimeControl.getMetadata().getName();
177
- this.model.setProperty('/indexHandlingFlag', false);
178
- this.model.setProperty('/specialIndexHandlingIcon', true);
179
- this.model.setProperty('/iconTooltip', `Index is defined by special logic of ${controlType} and can't be set here`);
180
- } else {
181
- this.model.setProperty('/indexHandlingFlag', true);
182
- this.model.setProperty('/specialIndexHandlingIcon', false);
183
- this.model.setProperty('/specialIndexHandlingIconPressed', false);
184
- }
1
+ 'use strict';
2
+ sap.ui.define([
3
+ 'sap/ui/core/library',
4
+ 'sap/ui/core/mvc/Controller',
5
+ 'sap/m/MessageToast',
6
+ '../utils',
7
+ '../../utils/error',
8
+ '../../utils/core',
9
+ '../control-utils',
10
+ 'sap/ui/dt/OverlayRegistry',
11
+ 'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
12
+ 'sap/base/Log'
13
+ ], function (sap_ui_core_library, Controller, MessageToast, ___utils, ____utils_error, ____utils_core, __ControlUtils, OverlayRegistry, ___sap_ux_private_control_property_editor_common, Log) {
14
+ 'use strict';
15
+ function _interopRequireDefault(obj) {
16
+ return obj && obj.__esModule && typeof obj.default !== 'undefined' ? obj.default : obj;
185
17
  }
186
- });
187
- return BaseDialog;
188
- });
189
- //# sourceMappingURL=BaseDialog.controller.js.map
18
+ const ValueState = sap_ui_core_library['ValueState'];
19
+ const matchesFragmentName = ___utils['matchesFragmentName'];
20
+ const getError = ____utils_error['getError'];
21
+ const getControlById = ____utils_core['getControlById'];
22
+ const ControlUtils = _interopRequireDefault(__ControlUtils);
23
+ const reportTelemetry = ___sap_ux_private_control_property_editor_common['reportTelemetry'];
24
+ const BaseDialog = Controller.extend('open.ux.preview.client.adp.controllers.BaseDialog', {
25
+ constructor: function _constructor(name, telemetryData) {
26
+ Controller.prototype.constructor.call(this, name);
27
+ this.telemetryData = telemetryData;
28
+ },
29
+ onCreateBtnPressHandler: async function _onCreateBtnPressHandler() {
30
+ try {
31
+ await reportTelemetry({
32
+ category: 'Dialog',
33
+ dialogName: this.dialog.getId(),
34
+ ...this.telemetryData
35
+ });
36
+ } catch (error) {
37
+ Log.error('Error in reporting Telemetry:', error);
38
+ }
39
+ },
40
+ getControlMetadata: function _getControlMetadata() {
41
+ const selectorId = this.overlays.getId();
42
+ let controlMetadata;
43
+ const overlayControl = getControlById(selectorId);
44
+ if (overlayControl) {
45
+ this.runtimeControl = ControlUtils.getRuntimeControl(overlayControl);
46
+ controlMetadata = this.runtimeControl.getMetadata();
47
+ } else {
48
+ throw new Error('Cannot get overlay control');
49
+ }
50
+ const allAggregations = Object.keys(controlMetadata.getAllAggregations());
51
+ const hiddenAggregations = [
52
+ 'customData',
53
+ 'layoutData',
54
+ 'dependents'
55
+ ];
56
+ const targetAggregation = allAggregations.filter(item => {
57
+ if (hiddenAggregations.indexOf(item) === -1) {
58
+ return item;
59
+ }
60
+ return false;
61
+ });
62
+ return {
63
+ controlMetadata,
64
+ targetAggregation
65
+ };
66
+ },
67
+ fillIndexArray: function _fillIndexArray(selectedControlChildren) {
68
+ let indexArray = [];
69
+ if (selectedControlChildren.length === 0) {
70
+ indexArray.push({
71
+ key: 0,
72
+ value: 0
73
+ });
74
+ } else {
75
+ indexArray = selectedControlChildren.map((elem, index) => {
76
+ return {
77
+ key: index + 1,
78
+ value: elem + 1
79
+ };
80
+ });
81
+ indexArray.unshift({
82
+ key: 0,
83
+ value: 0
84
+ });
85
+ indexArray.push({
86
+ key: selectedControlChildren.length + 1,
87
+ value: selectedControlChildren.length + 1
88
+ });
89
+ }
90
+ return indexArray;
91
+ },
92
+ onFragmentNameInputChange: function _onFragmentNameInputChange(event) {
93
+ const input = event.getSource();
94
+ const beginBtn = this.dialog.getBeginButton();
95
+ const fragmentName = input.getValue();
96
+ const fragmentList = this.model.getProperty('/fragmentList');
97
+ const updateDialogState = function (valueState) {
98
+ let valueStateText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
99
+ input.setValueState(valueState).setValueStateText(valueStateText);
100
+ beginBtn.setEnabled(valueState === ValueState.Success);
101
+ };
102
+ if (fragmentName.length <= 0) {
103
+ updateDialogState(ValueState.None);
104
+ this.model.setProperty('/newFragmentName', null);
105
+ return;
106
+ }
107
+ const fileExists = fragmentList.some(f => f.fragmentName === `${ fragmentName }.fragment.xml`);
108
+ if (fileExists) {
109
+ updateDialogState(ValueState.Error, 'Enter a different name. The fragment name that you entered already exists in your project.');
110
+ return;
111
+ }
112
+ const isValidName = /^[a-zA-Z_][a-zA-Z0-9_-]*$/.test(fragmentName);
113
+ if (!isValidName) {
114
+ updateDialogState(ValueState.Error, 'The fragment name cannot contain white spaces or special characters.');
115
+ return;
116
+ }
117
+ if (fragmentName.length > 64) {
118
+ updateDialogState(ValueState.Error, 'A fragment file name cannot contain more than 64 characters.');
119
+ return;
120
+ }
121
+ const changeExists = this.checkForExistingChange(fragmentName);
122
+ if (changeExists) {
123
+ updateDialogState(ValueState.Error, 'Enter a different name. The fragment name entered matches the name of an unsaved fragment.');
124
+ return;
125
+ }
126
+ updateDialogState(ValueState.Success);
127
+ this.model.setProperty('/newFragmentName', fragmentName);
128
+ },
129
+ checkForExistingChange: function _checkForExistingChange(fragmentName) {
130
+ const allCommands = this.rta.getCommandStack().getCommands();
131
+ return allCommands.some(command => {
132
+ if (typeof command.getCommands === 'function') {
133
+ const addXmlCommand = command.getCommands().find(c => c?.getProperty('name') === 'addXMLAtExtensionPoint');
134
+ return addXmlCommand && matchesFragmentName(addXmlCommand, fragmentName);
135
+ } else {
136
+ return matchesFragmentName(command, fragmentName);
137
+ }
138
+ });
139
+ },
140
+ setEscapeHandler: function _setEscapeHandler() {
141
+ this.dialog.setEscapeHandler(_ref => {
142
+ let {resolve} = _ref;
143
+ this.handleDialogClose();
144
+ resolve();
145
+ });
146
+ },
147
+ handleDialogClose: function _handleDialogClose() {
148
+ this.dialog.close();
149
+ this.dialog.destroy();
150
+ },
151
+ handleError: function _handleError(e) {
152
+ const error = getError(e);
153
+ MessageToast.show(error.message, { duration: 5000 });
154
+ throw error;
155
+ },
156
+ specialIndexHandling: function _specialIndexHandling(specialIndexAggregation) {
157
+ const overlay = OverlayRegistry.getOverlay(this.runtimeControl);
158
+ const aggregations = overlay.getDesignTimeMetadata().getData().aggregations;
159
+ if (specialIndexAggregation in aggregations && 'specialIndexHandling' in aggregations[specialIndexAggregation]) {
160
+ const controlType = this.runtimeControl.getMetadata().getName();
161
+ this.model.setProperty('/indexHandlingFlag', false);
162
+ this.model.setProperty('/specialIndexHandlingIcon', true);
163
+ this.model.setProperty('/iconTooltip', `Index is defined by special logic of ${ controlType } and can't be set here`);
164
+ } else {
165
+ this.model.setProperty('/indexHandlingFlag', true);
166
+ this.model.setProperty('/specialIndexHandlingIcon', false);
167
+ this.model.setProperty('/specialIndexHandlingIconPressed', false);
168
+ }
169
+ }
170
+ });
171
+ return BaseDialog;
172
+ });
@@ -18,6 +18,9 @@ import { getControlById } from '../../utils/core';
18
18
  import ControlUtils from '../control-utils';
19
19
  import type ElementOverlay from 'sap/ui/dt/ElementOverlay';
20
20
  import OverlayRegistry from 'sap/ui/dt/OverlayRegistry';
21
+ import { QuickActionTelemetryData } from '../../cpe/quick-actions/quick-action-definition';
22
+ import { reportTelemetry } from '@sap-ux-private/control-property-editor-common';
23
+ import Log from 'sap/base/Log';
21
24
 
22
25
  type BaseDialogModel = JSONModel & {
23
26
  getProperty(sPath: '/fragmentList'): Fragments;
@@ -58,6 +61,17 @@ export default abstract class BaseDialog<T extends BaseDialogModel = BaseDialogM
58
61
 
59
62
  abstract buildDialogData(): Promise<void> | void;
60
63
 
64
+ constructor(name: string, private readonly telemetryData?: QuickActionTelemetryData | undefined) {
65
+ super(name);
66
+ }
67
+ public async onCreateBtnPressHandler(): Promise<void> {
68
+ try {
69
+ await reportTelemetry({ category: 'Dialog', dialogName: this.dialog.getId(), ...this.telemetryData });
70
+ } catch (error) {
71
+ Log.error('Error in reporting Telemetry:', error);
72
+ }
73
+ }
74
+
61
75
  /**
62
76
  * Method is used in add fragment dialog controllers to get current control metadata which are needed on the dialog
63
77
  * @returns control metadata and target aggregations
@@ -19,8 +19,8 @@ sap.ui.define(["sap/m/MessageToast", "sap/ui/core/library", "sap/ui/model/json/J
19
19
  * @namespace open.ux.preview.client.adp.controllers
20
20
  */
21
21
  const ControllerExtension = BaseDialog.extend("open.ux.preview.client.adp.controllers.ControllerExtension", {
22
- constructor: function _constructor(name, overlays, rta) {
23
- BaseDialog.prototype.constructor.call(this, name);
22
+ constructor: function _constructor(name, overlays, rta, telemetryData) {
23
+ BaseDialog.prototype.constructor.call(this, name, telemetryData);
24
24
  this.rta = rta;
25
25
  this.overlays = overlays;
26
26
  this.model = new JSONModel();
@@ -80,6 +80,7 @@ sap.ui.define(["sap/m/MessageToast", "sap/ui/core/library", "sap/ui/model/json/J
80
80
  * @param event Event
81
81
  */
82
82
  onCreateBtnPress: async function _onCreateBtnPress(event) {
83
+ await BaseDialog.prototype.onCreateBtnPressHandler.call(this);
83
84
  const source = event.getSource();
84
85
  const controllerExists = this.model.getProperty('/controllerExists');
85
86
  if (!controllerExists) {
@@ -27,6 +27,7 @@ import type { CodeExtResponse, ControllersResponse } from '../api-handler';
27
27
  import { getExistingController, readControllers, writeChange, writeController } from '../api-handler';
28
28
  import BaseDialog from './BaseDialog.controller';
29
29
  import { getControllerInfo } from '../utils';
30
+ import { QuickActionTelemetryData } from '../../cpe/quick-actions/quick-action-definition';
30
31
 
31
32
  interface ControllerExtensionService {
32
33
  add: (codeRef: string, viewId: string) => Promise<{ creation: string }>;
@@ -45,8 +46,8 @@ type ControllerModel = JSONModel & {
45
46
  * @namespace open.ux.preview.client.adp.controllers
46
47
  */
47
48
  export default class ControllerExtension extends BaseDialog<ControllerModel> {
48
- constructor(name: string, overlays: UI5Element, rta: RuntimeAuthoring) {
49
- super(name);
49
+ constructor(name: string, overlays: UI5Element, rta: RuntimeAuthoring, telemetryData?: QuickActionTelemetryData) {
50
+ super(name, telemetryData);
50
51
  this.rta = rta;
51
52
  this.overlays = overlays;
52
53
  this.model = new JSONModel();
@@ -127,6 +128,7 @@ export default class ControllerExtension extends BaseDialog<ControllerModel> {
127
128
  * @param event Event
128
129
  */
129
130
  async onCreateBtnPress(event: Event) {
131
+ await super.onCreateBtnPressHandler();
130
132
  const source = event.getSource<Button>();
131
133
  const controllerExists = this.model.getProperty('/controllerExists');
132
134
 
@@ -36,7 +36,8 @@ sap.ui.define(["sap/ui/model/json/JSONModel", "../api-handler", "./BaseDialog.co
36
36
  *
37
37
  * @param event Event
38
38
  */
39
- onCreateBtnPress: function _onCreateBtnPress(event) {
39
+ onCreateBtnPress: async function _onCreateBtnPress(event) {
40
+ await BaseDialog.prototype.onCreateBtnPressHandler.call(this);
40
41
  const source = event.getSource();
41
42
  source.setEnabled(false);
42
43
  const fragmentName = this.model.getProperty('/newFragmentName');
@@ -60,7 +60,8 @@ export default class ExtensionPoint extends BaseDialog<ExtensionPointModel> {
60
60
  *
61
61
  * @param event Event
62
62
  */
63
- onCreateBtnPress(event: Event): void {
63
+ async onCreateBtnPress(event: Event) {
64
+ await super.onCreateBtnPressHandler();
64
65
  const source = event.getSource<Button>();
65
66
  source.setEnabled(false);
66
67
 
@@ -42,9 +42,11 @@ sap.ui.define(["sap/ui/core/Fragment", "../i18n", "./controllers/AddFragment.con
42
42
  * @param dialogName - Dialog name.
43
43
  * @param extensionPointData - Control ID.
44
44
  * @param options - Dialog options.
45
+ * @param telemetryData - Telemetry data.
45
46
  */
46
47
  static async createDialog(overlay, rta, dialogName, extensionPointData) {
47
48
  let options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
49
+ let telemetryData = arguments.length > 5 ? arguments[5] : undefined;
48
50
  if (this.isDialogOpen) {
49
51
  return;
50
52
  }
@@ -60,7 +62,7 @@ sap.ui.define(["sap/ui/core/Fragment", "../i18n", "./controllers/AddFragment.con
60
62
  defaultAggregationArrayIndex: options.defaultAggregationArrayIndex
61
63
  }),
62
64
  title: resources.getText(options.title ?? 'ADP_ADD_FRAGMENT_DIALOG_TITLE')
63
- });
65
+ }, telemetryData);
64
66
  break;
65
67
  case DialogNames.ADD_TABLE_COLUMN_FRAGMENTS:
66
68
  controller = new AddTableColumnFragments(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, {
@@ -68,10 +70,10 @@ sap.ui.define(["sap/ui/core/Fragment", "../i18n", "./controllers/AddFragment.con
68
70
  aggregation: options.aggregation
69
71
  }),
70
72
  title: resources.getText(options.title ?? 'ADP_ADD_FRAGMENT_DIALOG_TITLE')
71
- });
73
+ }, telemetryData);
72
74
  break;
73
75
  case DialogNames.CONTROLLER_EXTENSION:
74
- controller = new ControllerExtension(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta);
76
+ controller = new ControllerExtension(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, telemetryData);
75
77
  break;
76
78
  case DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT:
77
79
  controller = new ExtensionPoint(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, extensionPointData);