@sap-ux/preview-middleware 0.16.97 → 0.16.100

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 (28) hide show
  1. package/dist/client/adp/command-executor.js +17 -0
  2. package/dist/client/adp/command-executor.ts +19 -1
  3. package/dist/client/adp/controllers/AddFragment.controller.js +14 -63
  4. package/dist/client/adp/controllers/AddFragment.controller.ts +10 -74
  5. package/dist/client/adp/controllers/AddTableColumnFragments.controller.js +179 -0
  6. package/dist/client/adp/controllers/AddTableColumnFragments.controller.ts +298 -0
  7. package/dist/client/adp/controllers/BaseDialog.controller.js +83 -1
  8. package/dist/client/adp/controllers/BaseDialog.controller.ts +84 -0
  9. package/dist/client/adp/init-dialogs.js +9 -1
  10. package/dist/client/adp/init-dialogs.ts +9 -1
  11. package/dist/client/adp/quick-actions/fe-v2/change-table-columns.js +1 -1
  12. package/dist/client/adp/quick-actions/fe-v2/change-table-columns.ts +1 -1
  13. package/dist/client/adp/quick-actions/fe-v2/create-table-action.js +1 -1
  14. package/dist/client/adp/quick-actions/fe-v2/create-table-action.ts +1 -1
  15. package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +106 -0
  16. package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.ts +128 -0
  17. package/dist/client/adp/quick-actions/fe-v2/registry.js +14 -5
  18. package/dist/client/adp/quick-actions/fe-v2/registry.ts +18 -4
  19. package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column.js +58 -0
  20. package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column.ts +54 -0
  21. package/dist/client/adp/quick-actions/fe-v4/registry.js +4 -3
  22. package/dist/client/adp/quick-actions/fe-v4/registry.ts +5 -2
  23. package/dist/client/adp/quick-actions/{fe-v2/table-quick-action-base.js → table-quick-action-base.js} +29 -21
  24. package/dist/client/adp/quick-actions/{fe-v2/table-quick-action-base.ts → table-quick-action-base.ts} +16 -17
  25. package/dist/client/adp/ui/AddTableColumnFragments.fragment.xml +63 -0
  26. package/dist/client/messagebundle.properties +6 -0
  27. package/dist/client/tsconfig.tsbuildinfo +1 -0
  28. package/package.json +4 -4
@@ -37,6 +37,23 @@ sap.ui.define(["sap/m/MessageToast", "sap/ui/rta/command/CommandFactory", "../ut
37
37
  }
38
38
  }
39
39
 
40
+ /**
41
+ * Creates composite command without nested commands
42
+ *
43
+ * @param runtimeControl Managed object
44
+ */
45
+ async createCompositeCommand(runtimeControl) {
46
+ try {
47
+ return await CommandFactory.getCommandFor(runtimeControl, 'composite');
48
+ } catch (e) {
49
+ const error = getError(e);
50
+ const msgToastErrorMsg = `Could not get composite command'. ${error.message}`;
51
+ error.message = msgToastErrorMsg;
52
+ MessageToast.show(msgToastErrorMsg);
53
+ throw error;
54
+ }
55
+ }
56
+
40
57
  /**
41
58
  * Pushed and executes the provided command
42
59
  *
@@ -2,6 +2,7 @@ import MessageToast from 'sap/m/MessageToast';
2
2
  import type ManagedObject from 'sap/ui/base/ManagedObject';
3
3
  import CommandFactory from 'sap/ui/rta/command/CommandFactory';
4
4
  import type RuntimeAuthoring from 'sap/ui/rta/RuntimeAuthoring';
5
+ import type CompositeCommand from 'sap/ui/rta/command/CompositeCommand';
5
6
  import type { FlexSettings } from 'sap/ui/rta/RuntimeAuthoring';
6
7
  import type DesignTimeMetadata from 'sap/ui/dt/DesignTimeMetadata';
7
8
  import type FlexCommand from 'sap/ui/rta/command/FlexCommand';
@@ -52,12 +53,29 @@ export default class CommandExecutor {
52
53
  }
53
54
  }
54
55
 
56
+ /**
57
+ * Creates composite command without nested commands
58
+ *
59
+ * @param runtimeControl Managed object
60
+ */
61
+ public async createCompositeCommand(runtimeControl: ManagedObject): Promise<CompositeCommand> {
62
+ try {
63
+ return await CommandFactory.getCommandFor<CompositeCommand>(runtimeControl, 'composite');
64
+ } catch (e) {
65
+ const error = getError(e);
66
+ const msgToastErrorMsg = `Could not get composite command'. ${error.message}`;
67
+ error.message = msgToastErrorMsg;
68
+ MessageToast.show(msgToastErrorMsg);
69
+ throw error;
70
+ }
71
+ }
72
+
55
73
  /**
56
74
  * Pushed and executes the provided command
57
75
  *
58
76
  * @param command Command
59
77
  */
60
- public async pushAndExecuteCommand(command: FlexCommand): Promise<void> {
78
+ public async pushAndExecuteCommand(command: FlexCommand | CompositeCommand): Promise<void> {
61
79
  try {
62
80
  /**
63
81
  * The change will have pending state and will only be saved to the workspace when the user clicks save icon
@@ -10,8 +10,8 @@ sap.ui.define([
10
10
  '../api-handler',
11
11
  './BaseDialog.controller',
12
12
  '../utils',
13
- '../../utils/core'
14
- ], function (JSONModel, OverlayRegistry, ___sap_ux_private_control_property_editor_common, ____i18n, ____cpe_communication_service, __ControlUtils, __CommandExecutor, ___api_handler, __BaseDialog, ___utils, ____utils_core) {
13
+ '../quick-actions/table-quick-action-base'
14
+ ], function (JSONModel, OverlayRegistry, ___sap_ux_private_control_property_editor_common, ____i18n, ____cpe_communication_service, __ControlUtils, __CommandExecutor, ___api_handler, __BaseDialog, ___utils, ___quick_actions_table_quick_action_base) {
15
15
  'use strict';
16
16
  function _interopRequireDefault(obj) {
17
17
  return obj && obj.__esModule && typeof obj.default !== 'undefined' ? obj.default : obj;
@@ -25,7 +25,9 @@ sap.ui.define([
25
25
  const getFragments = ___api_handler['getFragments'];
26
26
  const BaseDialog = _interopRequireDefault(__BaseDialog);
27
27
  const notifyUser = ___utils['notifyUser'];
28
- const getControlById = ____utils_core['getControlById'];
28
+ const ANALYTICAL_TABLE_TYPE = ___quick_actions_table_quick_action_base['ANALYTICAL_TABLE_TYPE'];
29
+ const GRID_TABLE_TYPE = ___quick_actions_table_quick_action_base['GRID_TABLE_TYPE'];
30
+ const TREE_TABLE_TYPE = ___quick_actions_table_quick_action_base['TREE_TABLE_TYPE'];
29
31
  const radix = 10;
30
32
  const AddFragment = BaseDialog.extend('open.ux.preview.client.adp.controllers.AddFragment', {
31
33
  constructor: function _constructor(name, overlays, rta, options) {
@@ -49,20 +51,6 @@ sap.ui.define([
49
51
  this.dialog.setModel(this.model);
50
52
  this.dialog.open();
51
53
  },
52
- specialIndexHandling: function _specialIndexHandling(specialIndexAggregation) {
53
- const overlay = OverlayRegistry.getOverlay(this.runtimeControl);
54
- const aggregations = overlay.getDesignTimeMetadata().getData().aggregations;
55
- if (specialIndexAggregation in aggregations && 'specialIndexHandling' in aggregations[specialIndexAggregation]) {
56
- const controlType = this.runtimeControl.getMetadata().getName();
57
- this.model.setProperty('/indexHandlingFlag', false);
58
- this.model.setProperty('/specialIndexHandlingIcon', true);
59
- this.model.setProperty('/iconTooltip', `Index is defined by special logic of ${ controlType } and can't be set here`);
60
- } else {
61
- this.model.setProperty('/indexHandlingFlag', true);
62
- this.model.setProperty('/specialIndexHandlingIcon', false);
63
- this.model.setProperty('/specialIndexHandlingIconPressed', false);
64
- }
65
- },
66
54
  onAggregationChanged: function _onAggregationChanged(event) {
67
55
  const source = event.getSource();
68
56
  const selectedKey = source.getSelectedKey();
@@ -100,27 +88,7 @@ sap.ui.define([
100
88
  this.handleDialogClose();
101
89
  },
102
90
  buildDialogData: async function _buildDialogData() {
103
- const selectorId = this.overlays.getId();
104
- let controlMetadata;
105
- const overlayControl = getControlById(selectorId);
106
- if (overlayControl) {
107
- this.runtimeControl = ControlUtils.getRuntimeControl(overlayControl);
108
- controlMetadata = this.runtimeControl.getMetadata();
109
- } else {
110
- throw new Error('Cannot get overlay control');
111
- }
112
- const allAggregations = Object.keys(controlMetadata.getAllAggregations());
113
- const hiddenAggregations = [
114
- 'customData',
115
- 'layoutData',
116
- 'dependents'
117
- ];
118
- const targetAggregation = allAggregations.filter(item => {
119
- if (hiddenAggregations.indexOf(item) === -1) {
120
- return item;
121
- }
122
- return false;
123
- });
91
+ const {controlMetadata, targetAggregation} = this.getControlMetadata();
124
92
  const defaultAggregation = this.options.aggregation ?? controlMetadata.getDefaultAggregationName();
125
93
  const selectedControlName = controlMetadata.getName();
126
94
  let selectedControlChildren = Object.keys(ControlUtils.getControlAggregationByName(this.runtimeControl, defaultAggregation));
@@ -160,31 +128,6 @@ sap.ui.define([
160
128
  this.model.setProperty('/targetAggregation', controlAggregation);
161
129
  this.model.setProperty('/index', indexArray);
162
130
  },
163
- fillIndexArray: function _fillIndexArray(selectedControlChildren) {
164
- let indexArray = [];
165
- if (selectedControlChildren.length === 0) {
166
- indexArray.push({
167
- key: 0,
168
- value: 0
169
- });
170
- } else {
171
- indexArray = selectedControlChildren.map((elem, index) => {
172
- return {
173
- key: index + 1,
174
- value: elem + 1
175
- };
176
- });
177
- indexArray.unshift({
178
- key: 0,
179
- value: 0
180
- });
181
- indexArray.push({
182
- key: selectedControlChildren.length + 1,
183
- value: selectedControlChildren.length + 1
184
- });
185
- }
186
- return indexArray;
187
- },
188
131
  createFragmentChange: async function _createFragmentChange(fragmentData) {
189
132
  const {fragmentName, index, targetAggregation} = fragmentData;
190
133
  const flexSettings = this.rta.getFlexSettings();
@@ -218,6 +161,14 @@ sap.ui.define([
218
161
  return 'CUSTOM_ACTION';
219
162
  } else if (this.isObjectPageHeaderField(currentControlName, targetAggregation)) {
220
163
  return 'OBJECT_PAGE_HEADER_FIELD';
164
+ } else if (currentControlName === 'sap.ui.mdc.Table' && targetAggregation === 'columns') {
165
+ return 'V4_MDC_TABLE_COLUMN';
166
+ } else if ([
167
+ TREE_TABLE_TYPE,
168
+ GRID_TABLE_TYPE,
169
+ ANALYTICAL_TABLE_TYPE
170
+ ].includes(currentControlName) && targetAggregation === 'columns') {
171
+ return 'ANALYTICAL_TABLE_COLUMN';
221
172
  } else if (currentControlName === 'sap.ui.mdc.ActionToolbar' && targetAggregation === 'actions') {
222
173
  return 'TABLE_ACTION';
223
174
  }
@@ -8,7 +8,6 @@ import type UI5Element from 'sap/ui/core/Element';
8
8
 
9
9
  /** sap.ui.base */
10
10
  import type Event from 'sap/ui/base/Event';
11
- import type ManagedObjectMetadata from 'sap/ui/base/ManagedObjectMetadata';
12
11
 
13
12
  /** sap.ui.model */
14
13
  import JSONModel from 'sap/ui/model/json/JSONModel';
@@ -18,7 +17,6 @@ import type RuntimeAuthoring from 'sap/ui/rta/RuntimeAuthoring';
18
17
 
19
18
  /** sap.ui.dt */
20
19
  import OverlayRegistry from 'sap/ui/dt/OverlayRegistry';
21
- import type ElementOverlay from 'sap/ui/dt/ElementOverlay';
22
20
 
23
21
  /** sap.ui.fl */
24
22
  import { type AddFragmentChangeContentType } from 'sap/ui/fl/Change';
@@ -33,7 +31,7 @@ import CommandExecutor from '../command-executor';
33
31
  import { getFragments } from '../api-handler';
34
32
  import BaseDialog from './BaseDialog.controller';
35
33
  import { notifyUser } from '../utils';
36
- import { getControlById } from '../../utils/core';
34
+ import { ANALYTICAL_TABLE_TYPE, GRID_TABLE_TYPE, TREE_TABLE_TYPE } from '../quick-actions/table-quick-action-base';
37
35
 
38
36
  interface CreateFragmentProps {
39
37
  fragmentName: string;
@@ -43,7 +41,7 @@ interface CreateFragmentProps {
43
41
 
44
42
  const radix = 10;
45
43
 
46
- type AddFragmentModel = JSONModel & {
44
+ export type AddFragmentModel = JSONModel & {
47
45
  getProperty(sPath: '/title'): string;
48
46
  getProperty(sPath: '/completeView'): boolean;
49
47
  getProperty(sPath: '/newFragmentName'): string;
@@ -91,33 +89,6 @@ export default class AddFragment extends BaseDialog<AddFragmentModel> {
91
89
  this.dialog.open();
92
90
  }
93
91
 
94
- /**
95
- * Handles the index field whenever a specific aggregation is chosen
96
- *
97
- * @param specialIndexAggregation string | number
98
- */
99
- private specialIndexHandling(specialIndexAggregation: string | number): void {
100
- const overlay = OverlayRegistry.getOverlay(this.runtimeControl as UI5Element);
101
- const aggregations = overlay.getDesignTimeMetadata().getData().aggregations;
102
-
103
- if (
104
- specialIndexAggregation in aggregations &&
105
- 'specialIndexHandling' in aggregations[specialIndexAggregation]
106
- ) {
107
- const controlType = this.runtimeControl.getMetadata().getName();
108
- this.model.setProperty('/indexHandlingFlag', false);
109
- this.model.setProperty('/specialIndexHandlingIcon', true);
110
- this.model.setProperty(
111
- '/iconTooltip',
112
- `Index is defined by special logic of ${controlType} and can't be set here`
113
- );
114
- } else {
115
- this.model.setProperty('/indexHandlingFlag', true);
116
- this.model.setProperty('/specialIndexHandlingIcon', false);
117
- this.model.setProperty('/specialIndexHandlingIconPressed', false);
118
- }
119
- }
120
-
121
92
  /**
122
93
  * Handles the change in aggregations
123
94
  *
@@ -184,26 +155,7 @@ export default class AddFragment extends BaseDialog<AddFragmentModel> {
184
155
  * Builds data that is used in the dialog
185
156
  */
186
157
  async buildDialogData(): Promise<void> {
187
- const selectorId = this.overlays.getId();
188
-
189
- let controlMetadata: ManagedObjectMetadata;
190
-
191
- const overlayControl = getControlById(selectorId) as unknown as ElementOverlay;
192
- if (overlayControl) {
193
- this.runtimeControl = ControlUtils.getRuntimeControl(overlayControl);
194
- controlMetadata = this.runtimeControl.getMetadata();
195
- } else {
196
- throw new Error('Cannot get overlay control');
197
- }
198
-
199
- const allAggregations = Object.keys(controlMetadata.getAllAggregations());
200
- const hiddenAggregations = ['customData', 'layoutData', 'dependents'];
201
- const targetAggregation = allAggregations.filter((item) => {
202
- if (hiddenAggregations.indexOf(item) === -1) {
203
- return item;
204
- }
205
- return false;
206
- });
158
+ const { controlMetadata, targetAggregation } = this.getControlMetadata();
207
159
  const defaultAggregation = this.options.aggregation ?? controlMetadata.getDefaultAggregationName();
208
160
  const selectedControlName = controlMetadata.getName();
209
161
 
@@ -254,29 +206,6 @@ export default class AddFragment extends BaseDialog<AddFragmentModel> {
254
206
  this.model.setProperty('/index', indexArray);
255
207
  }
256
208
 
257
- /**
258
- * Fills indexArray from selected control children
259
- *
260
- * @param selectedControlChildren Array of numbers
261
- * @returns Array of key value pairs
262
- */
263
- private fillIndexArray(selectedControlChildren: number[]) {
264
- let indexArray: { key: number; value: number }[] = [];
265
- if (selectedControlChildren.length === 0) {
266
- indexArray.push({ key: 0, value: 0 });
267
- } else {
268
- indexArray = selectedControlChildren.map((elem, index) => {
269
- return { key: index + 1, value: elem + 1 };
270
- });
271
- indexArray.unshift({ key: 0, value: 0 });
272
- indexArray.push({
273
- key: selectedControlChildren.length + 1,
274
- value: selectedControlChildren.length + 1
275
- });
276
- }
277
- return indexArray;
278
- }
279
-
280
209
  /**
281
210
  * Creates an addXML fragment command and pushes it to the command stack
282
211
  *
@@ -329,6 +258,13 @@ export default class AddFragment extends BaseDialog<AddFragmentModel> {
329
258
  return 'CUSTOM_ACTION';
330
259
  } else if (this.isObjectPageHeaderField(currentControlName, targetAggregation)) {
331
260
  return 'OBJECT_PAGE_HEADER_FIELD';
261
+ } else if (currentControlName === 'sap.ui.mdc.Table' && targetAggregation === 'columns') {
262
+ return 'V4_MDC_TABLE_COLUMN';
263
+ } else if (
264
+ [TREE_TABLE_TYPE, GRID_TABLE_TYPE, ANALYTICAL_TABLE_TYPE].includes(currentControlName) &&
265
+ targetAggregation === 'columns'
266
+ ) {
267
+ return 'ANALYTICAL_TABLE_COLUMN';
332
268
  } else if (currentControlName === 'sap.ui.mdc.ActionToolbar' && targetAggregation === 'actions') {
333
269
  return 'TABLE_ACTION';
334
270
  }
@@ -0,0 +1,179 @@
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
+ '../../i18n',
7
+ '../../cpe/communication-service',
8
+ '../control-utils',
9
+ '../command-executor',
10
+ '../api-handler',
11
+ './BaseDialog.controller',
12
+ '../utils',
13
+ 'sap/ui/core/library'
14
+ ], function (JSONModel, OverlayRegistry, ___sap_ux_private_control_property_editor_common, ____i18n, ____cpe_communication_service, __ControlUtils, __CommandExecutor, ___api_handler, __BaseDialog, ___utils, sap_ui_core_library) {
15
+ 'use strict';
16
+ function _interopRequireDefault(obj) {
17
+ return obj && obj.__esModule && typeof obj.default !== 'undefined' ? obj.default : obj;
18
+ }
19
+ const setApplicationRequiresReload = ___sap_ux_private_control_property_editor_common['setApplicationRequiresReload'];
20
+ const getResourceModel = ____i18n['getResourceModel'];
21
+ const getTextBundle = ____i18n['getTextBundle'];
22
+ const CommunicationService = ____cpe_communication_service['CommunicationService'];
23
+ const ControlUtils = _interopRequireDefault(__ControlUtils);
24
+ const CommandExecutor = _interopRequireDefault(__CommandExecutor);
25
+ const getFragments = ___api_handler['getFragments'];
26
+ const BaseDialog = _interopRequireDefault(__BaseDialog);
27
+ const notifyUser = ___utils['notifyUser'];
28
+ const ValueState = sap_ui_core_library['ValueState'];
29
+ const radix = 10;
30
+ const COLUMNS_AGGREGATION = 'columns';
31
+ const ITEMS_AGGREGATION = 'items';
32
+ const CELLS_AGGREGATION = 'cells';
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);
36
+ this.options = options;
37
+ this.rta = rta;
38
+ this.overlays = overlays;
39
+ this.model = new JSONModel({ title: options.title });
40
+ this.ui5Version = sap.ui.version;
41
+ this.commandExecutor = new CommandExecutor(this.rta);
42
+ },
43
+ setup: async function _setup(dialog) {
44
+ this.dialog = dialog;
45
+ this.setEscapeHandler();
46
+ await this.buildDialogData();
47
+ const resourceModel = await getResourceModel('open.ux.preview.client');
48
+ this.dialog.setModel(resourceModel, 'i18n');
49
+ this.dialog.setModel(this.model);
50
+ this.dialog.open();
51
+ },
52
+ onCreateBtnPress: async function _onCreateBtnPress(event) {
53
+ const source = event.getSource();
54
+ source.setEnabled(false);
55
+ const columnFragmentName = this.model.getProperty('/newColumnFragmentName');
56
+ const cellFragmentName = this.model.getProperty('/newCellFragmentName');
57
+ const index = this.model.getProperty('/selectedIndex');
58
+ const fragmentData = {
59
+ index,
60
+ fragments: [
61
+ {
62
+ fragmentName: columnFragmentName,
63
+ targetAggregation: this.model.getProperty('/selectedColumnsAggregation')
64
+ },
65
+ {
66
+ fragmentName: cellFragmentName,
67
+ targetAggregation: this.model.getProperty('/selectedItemsAggregation')
68
+ }
69
+ ]
70
+ };
71
+ await this.createFragmentChange(fragmentData);
72
+ const textKey = 'ADP_ADD_TWO_FRAGMENTS_WITH_TEMPLATE_NOTIFICATION';
73
+ const bundle = await getTextBundle();
74
+ notifyUser(bundle.getText(textKey, fragmentData.fragments.map(item => item.fragmentName)), 8000);
75
+ this.handleDialogClose();
76
+ },
77
+ buildDialogData: async function _buildDialogData() {
78
+ const {controlMetadata, targetAggregation} = this.getControlMetadata();
79
+ const defaultAggregation = this.options.aggregation ?? controlMetadata.getDefaultAggregationName();
80
+ const selectedControlName = controlMetadata.getName();
81
+ let selectedControlChildren = Object.keys(ControlUtils.getControlAggregationByName(this.runtimeControl, defaultAggregation));
82
+ selectedControlChildren = selectedControlChildren.map(key => {
83
+ return parseInt(key, radix);
84
+ });
85
+ this.model.setProperty('/selectedControlName', selectedControlName);
86
+ const indexArray = this.fillIndexArray(selectedControlChildren);
87
+ if (!targetAggregation.includes(COLUMNS_AGGREGATION)) {
88
+ throw new Error(`Selected control does not have "${ COLUMNS_AGGREGATION }" aggregation`);
89
+ }
90
+ this.model.setProperty('/selectedColumnsAggregation', COLUMNS_AGGREGATION);
91
+ this.specialIndexHandling(COLUMNS_AGGREGATION);
92
+ if (!targetAggregation.includes(ITEMS_AGGREGATION)) {
93
+ throw new Error(`Selected control does not have "${ ITEMS_AGGREGATION }" aggregation`);
94
+ }
95
+ this.model.setProperty('/selectedItemsAggregation', ITEMS_AGGREGATION);
96
+ try {
97
+ const {fragments} = await getFragments();
98
+ this.model.setProperty('/fragmentList', fragments);
99
+ } catch (e) {
100
+ this.handleError(e);
101
+ }
102
+ this.model.setProperty('/index', indexArray);
103
+ this.model.setProperty('/selectedIndex', indexArray.length - 1);
104
+ },
105
+ updateFormState: function _updateFormState() {
106
+ const form = this.dialog.getContent()[0];
107
+ const formContent = form.getContent();
108
+ const inputs = formContent.filter(item => item.isA('sap.m.Input'));
109
+ const value1 = inputs[0].getValue();
110
+ const value2 = inputs[1].getValue();
111
+ if (value1 === value2 && value1.length) {
112
+ inputs.forEach(input => {
113
+ if (input.getValueState() === ValueState.Success) {
114
+ input.setValueState(ValueState.Error).setValueStateText('Duplicate name');
115
+ }
116
+ });
117
+ } else {
118
+ inputs.forEach(input => {
119
+ if (input.getValueState() === ValueState.Error && input.getValueStateText() === 'Duplicate name') {
120
+ input.setValueState(ValueState.Success);
121
+ }
122
+ });
123
+ }
124
+ const beginBtn = this.dialog.getBeginButton();
125
+ beginBtn.setEnabled(inputs.every(input => input.getValueState() === ValueState.Success));
126
+ },
127
+ onColumnFragmentNameInputChange: function _onColumnFragmentNameInputChange(event) {
128
+ BaseDialog.prototype.onFragmentNameInputChange.call(this, event);
129
+ const input = event.getSource();
130
+ let modelValue = input.getValue();
131
+ if (modelValue.length < 1) {
132
+ modelValue = null;
133
+ }
134
+ this.model.setProperty('/newColumnFragmentName', modelValue);
135
+ this.updateFormState();
136
+ },
137
+ onCellFragmentNameInputChange: function _onCellFragmentNameInputChange(event) {
138
+ BaseDialog.prototype.onFragmentNameInputChange.call(this, event);
139
+ const input = event.getSource();
140
+ let modelValue = input.getValue();
141
+ if (input.getValue().length < 1) {
142
+ modelValue = null;
143
+ }
144
+ this.model.setProperty('/newCellFragmentName', modelValue);
145
+ this.updateFormState();
146
+ },
147
+ createFragmentChange: async function _createFragmentChange(fragmentData) {
148
+ const {fragments, index} = fragmentData;
149
+ const flexSettings = this.rta.getFlexSettings();
150
+ const overlay = OverlayRegistry.getOverlay(this.runtimeControl);
151
+ const designMetadata = overlay.getDesignTimeMetadata();
152
+ const result = [];
153
+ const compositeCommand = await this.commandExecutor.createCompositeCommand(this.runtimeControl);
154
+ for (const fragment of fragments) {
155
+ const modifiedValue = {
156
+ fragment: `<core:FragmentDefinition xmlns:core='sap.ui.core'></core:FragmentDefinition>`,
157
+ fragmentPath: `fragments/${ fragment.fragmentName }.fragment.xml`,
158
+ index: index ?? 0,
159
+ targetAggregation: fragment.targetAggregation === ITEMS_AGGREGATION ? CELLS_AGGREGATION : fragment.targetAggregation
160
+ };
161
+ const targetObject = fragment.targetAggregation === COLUMNS_AGGREGATION ? this.runtimeControl : this.runtimeControl.getAggregation(ITEMS_AGGREGATION)[0];
162
+ const command = await this.commandExecutor.getCommand(targetObject, 'addXML', modifiedValue, designMetadata, flexSettings);
163
+ const templateName = fragment.targetAggregation === COLUMNS_AGGREGATION ? `V2_SMART_TABLE_COLUMN` : 'V2_SMART_TABLE_CELL';
164
+ const preparedChange = command.getPreparedChange();
165
+ const content = {
166
+ ...preparedChange.getContent(),
167
+ templateName
168
+ };
169
+ preparedChange.setContent(content);
170
+ compositeCommand.addCommand(command, false);
171
+ result.push(templateName);
172
+ }
173
+ await this.commandExecutor.pushAndExecuteCommand(compositeCommand);
174
+ CommunicationService.sendAction(setApplicationRequiresReload(true));
175
+ return result;
176
+ }
177
+ });
178
+ return AddTableColumnFragments;
179
+ });