@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,277 +1,320 @@
1
- 'use strict';
2
- sap.ui.define([
3
- 'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
4
- 'sap/ui/dt/OverlayUtil',
5
- '../../cpe/quick-actions/utils',
6
- '../../utils/core',
7
- '../../utils/version',
8
- './quick-action-base',
9
- './control-types',
10
- './fe-v2/utils'
11
- ], function (___sap_ux_private_control_property_editor_common, OverlayUtil, ____cpe_quick_actions_utils, ____utils_core, ____utils_version, ___quick_action_base, ___control_types, ___fe_v2_utils) {
12
- 'use strict';
13
- const NESTED_QUICK_ACTION_KIND = ___sap_ux_private_control_property_editor_common['NESTED_QUICK_ACTION_KIND'];
14
- const getParentContainer = ____cpe_quick_actions_utils['getParentContainer'];
15
- const getRelevantControlFromActivePage = ____cpe_quick_actions_utils['getRelevantControlFromActivePage'];
16
- const getControlById = ____utils_core['getControlById'];
17
- const isA = ____utils_core['isA'];
18
- const isManagedObject = ____utils_core['isManagedObject'];
19
- const getUi5Version = ____utils_version['getUi5Version'];
20
- const isLowerThanMinimalUi5Version = ____utils_version['isLowerThanMinimalUi5Version'];
21
- const QuickActionDefinitionBase = ___quick_action_base['QuickActionDefinitionBase'];
22
- const ANALYTICAL_TABLE_TYPE = ___control_types['ANALYTICAL_TABLE_TYPE'];
23
- const GRID_TABLE_TYPE = ___control_types['GRID_TABLE_TYPE'];
24
- const M_TABLE_TYPE = ___control_types['M_TABLE_TYPE'];
25
- const MDC_TABLE_TYPE = ___control_types['MDC_TABLE_TYPE'];
26
- const SMART_TABLE_TYPE = ___control_types['SMART_TABLE_TYPE'];
27
- const TREE_TABLE_TYPE = ___control_types['TREE_TABLE_TYPE'];
28
- const isVariantManagementEnabledOPPage = ___fe_v2_utils['isVariantManagementEnabledOPPage'];
29
- const SMART_TABLE_ACTION_ID = 'CTX_COMP_VARIANT_CONTENT';
30
- const M_TABLE_ACTION_ID = 'CTX_ADD_ELEMENTS_AS_CHILD';
31
- const SETTINGS_ID = 'CTX_SETTINGS';
32
- const REARRANGE_TOOLBAR_SETTINGS_ID = 'CTX_SETTINGS0';
33
- const ICON_TAB_BAR_TYPE = 'sap.m.IconTabBar';
34
- async function getActionId(table) {
35
- const {major, minor} = await getUi5Version();
36
- if (isA(SMART_TABLE_TYPE, table)) {
37
- if (major === 1 && minor === 96) {
38
- return [SETTINGS_ID];
39
- } else {
40
- return [SMART_TABLE_ACTION_ID];
41
- }
42
- }
43
- return [
44
- M_TABLE_ACTION_ID,
45
- SETTINGS_ID
46
- ];
1
+ "use strict";
2
+
3
+ sap.ui.define(["open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common", "sap/ui/dt/OverlayUtil", "../../cpe/quick-actions/utils", "../../utils/core", "../../utils/version", "./quick-action-base", "./control-types", "./fe-v2/utils"], function (___sap_ux_private_control_property_editor_common, OverlayUtil, ____cpe_quick_actions_utils, ____utils_core, ____utils_version, ___quick_action_base, ___control_types, ___fe_v2_utils) {
4
+ "use strict";
5
+
6
+ const NESTED_QUICK_ACTION_KIND = ___sap_ux_private_control_property_editor_common["NESTED_QUICK_ACTION_KIND"];
7
+ const getParentContainer = ____cpe_quick_actions_utils["getParentContainer"];
8
+ const getRelevantControlFromActivePage = ____cpe_quick_actions_utils["getRelevantControlFromActivePage"];
9
+ const getControlById = ____utils_core["getControlById"];
10
+ const isA = ____utils_core["isA"];
11
+ const isManagedObject = ____utils_core["isManagedObject"];
12
+ const getUi5Version = ____utils_version["getUi5Version"];
13
+ const isLowerThanMinimalUi5Version = ____utils_version["isLowerThanMinimalUi5Version"];
14
+ const QuickActionDefinitionBase = ___quick_action_base["QuickActionDefinitionBase"];
15
+ const ANALYTICAL_TABLE_TYPE = ___control_types["ANALYTICAL_TABLE_TYPE"];
16
+ const GRID_TABLE_TYPE = ___control_types["GRID_TABLE_TYPE"];
17
+ const M_TABLE_TYPE = ___control_types["M_TABLE_TYPE"];
18
+ const MDC_TABLE_TYPE = ___control_types["MDC_TABLE_TYPE"];
19
+ const SMART_TABLE_TYPE = ___control_types["SMART_TABLE_TYPE"];
20
+ const TREE_TABLE_TYPE = ___control_types["TREE_TABLE_TYPE"];
21
+ const isVariantManagementEnabledOPPage = ___fe_v2_utils["isVariantManagementEnabledOPPage"];
22
+ const SMART_TABLE_ACTION_ID = 'CTX_COMP_VARIANT_CONTENT';
23
+ const M_TABLE_ACTION_ID = 'CTX_ADD_ELEMENTS_AS_CHILD';
24
+ const SETTINGS_ID = 'CTX_SETTINGS';
25
+ const REARRANGE_TOOLBAR_SETTINGS_ID = 'CTX_SETTINGS0';
26
+ const ICON_TAB_BAR_TYPE = 'sap.m.IconTabBar';
27
+ async function getActionId(table) {
28
+ const {
29
+ major,
30
+ minor
31
+ } = await getUi5Version();
32
+ if (isA(SMART_TABLE_TYPE, table)) {
33
+ if (major === 1 && minor === 96) {
34
+ return [SETTINGS_ID];
35
+ } else {
36
+ return [SMART_TABLE_ACTION_ID];
37
+ }
47
38
  }
48
- async function getRearrangeToolbarContentActionId() {
49
- const {major, minor} = await getUi5Version();
50
- if (major === 1 && minor <= 127) {
51
- return SETTINGS_ID;
52
- }
53
- return REARRANGE_TOOLBAR_SETTINGS_ID;
39
+ return [M_TABLE_ACTION_ID, SETTINGS_ID];
40
+ }
41
+ async function getRearrangeToolbarContentActionId() {
42
+ const {
43
+ major,
44
+ minor
45
+ } = await getUi5Version();
46
+ if (major === 1 && minor <= 127) {
47
+ return SETTINGS_ID;
54
48
  }
55
- class TableQuickActionDefinitionBase extends QuickActionDefinitionBase {
56
- isApplicable = false;
57
- children = [];
58
- tableMap = {};
59
- get textKey() {
60
- return this.defaultTextKey;
61
- }
62
- constructor(type, controlTypes, defaultTextKey, context) {
63
- let options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
64
- let enablementValidators = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : [];
65
- super(type, NESTED_QUICK_ACTION_KIND, defaultTextKey, context, enablementValidators);
66
- this.type = type;
67
- this.controlTypes = controlTypes;
68
- this.defaultTextKey = defaultTextKey;
69
- this.context = context;
70
- this.options = options;
71
- this.enablementValidators = enablementValidators;
72
- }
73
- async addSettingsActionId(table, tableMapKey) {
74
- if (this.options.includeServiceAction) {
75
- const actions = await this.context.actionService.get(table.getId());
76
- const actionsIds = await getActionId(table);
77
- const changeColumnActionId = actionsIds.find(actionId => actions.findIndex(action => action.id === actionId) > -1);
78
- this.tableMap[tableMapKey].changeColumnActionId = changeColumnActionId;
79
- const changeToolbarContentActionId = await getRearrangeToolbarContentActionId();
80
- const changeToolbarContentAction = actions.find(action => action.id === changeToolbarContentActionId);
81
- this.tableMap[tableMapKey].changeToolbarContentAction = changeToolbarContentAction ? {
82
- id: changeToolbarContentAction.id,
83
- enabled: changeToolbarContentAction.enabled
84
- } : undefined;
85
- }
86
- }
87
- async initialize() {
88
- const version = await getUi5Version();
89
- if (isLowerThanMinimalUi5Version(version, {
90
- major: 1,
91
- minor: 96
92
- })) {
93
- this.isApplicable = false;
94
- return;
95
- }
96
- const iconTabBarfilterMap = this.buildIconTabBarFilterMap();
97
- for (const table of getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, this.controlTypes)) {
98
- const tabKey = Object.keys(iconTabBarfilterMap).find(key => table.getId().endsWith(key));
99
- const section = getParentContainer(table, 'sap.uxap.ObjectPageSection');
100
- if (section) {
101
- await this.collectChildrenInSection(section, table);
102
- } else if (this.iconTabBar && tabKey) {
103
- const label = `'${ iconTabBarfilterMap[tabKey] }' table`;
104
- const tableMapKey = this.children.length.toString();
105
- const child = this.createChild(label, table, tableMapKey);
106
- this.children.push(child);
107
- this.tableMap[tableMapKey] = {
108
- table,
109
- iconTabBarFilterKey: tabKey,
110
- tableUpdateEventAttachedOnce: false
111
- };
112
- await this.addSettingsActionId(table, tableMapKey);
113
- } else {
114
- await this.processTable(table);
115
- }
116
- }
117
- if (this.children.length > 0) {
118
- this.isApplicable = true;
119
- }
120
- }
121
- getInternalTable(table) {
122
- try {
123
- let tableInternal;
124
- if (isA(SMART_TABLE_TYPE, table)) {
125
- const itemsAggregation = table.getAggregation('items');
126
- tableInternal = itemsAggregation.find(item => [
127
- M_TABLE_TYPE,
128
- TREE_TABLE_TYPE,
129
- ANALYTICAL_TABLE_TYPE,
130
- GRID_TABLE_TYPE
131
- ].some(tType => isA(tType, item)));
132
- }
133
- return tableInternal;
134
- } catch (error) {
135
- return undefined;
136
- }
137
- }
138
- getTableLabel(table) {
139
- if (isA(SMART_TABLE_TYPE, table) || isA(MDC_TABLE_TYPE, table)) {
140
- const header = table.getHeader();
141
- if (header) {
142
- return `'${ header }' table`;
143
- }
144
- } else if (isA(M_TABLE_TYPE, table)) {
145
- const title = table?.getHeaderToolbar()?.getTitleControl()?.getText();
146
- if (title) {
147
- return `'${ title }' table`;
148
- }
149
- }
150
- return 'Unnamed table';
49
+ return REARRANGE_TOOLBAR_SETTINGS_ID;
50
+ }
51
+ /**
52
+ * Base class for table quick actions.
53
+ */
54
+ class TableQuickActionDefinitionBase extends QuickActionDefinitionBase {
55
+ isApplicable = false;
56
+ children = [];
57
+ tableMap = {};
58
+ get textKey() {
59
+ return this.defaultTextKey;
60
+ }
61
+ constructor(type, controlTypes, defaultTextKey, context) {
62
+ let options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
63
+ let enablementValidators = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : [];
64
+ super(type, NESTED_QUICK_ACTION_KIND, defaultTextKey, context, enablementValidators);
65
+ this.type = type;
66
+ this.controlTypes = controlTypes;
67
+ this.defaultTextKey = defaultTextKey;
68
+ this.context = context;
69
+ this.options = options;
70
+ this.enablementValidators = enablementValidators;
71
+ }
72
+
73
+ /**
74
+ * Adds action id to the table map entry, if the service actions are needed.
75
+ * @param table - table element
76
+ * @param tableMapKey - map key
77
+ */
78
+ async addSettingsActionId(table, tableMapKey) {
79
+ if (this.options.includeServiceAction) {
80
+ const actions = await this.context.actionService.get(table.getId());
81
+ const actionsIds = await getActionId(table);
82
+ const changeColumnActionId = actionsIds.find(actionId => actions.findIndex(action => action.id === actionId) > -1);
83
+ this.tableMap[tableMapKey].changeColumnActionId = changeColumnActionId;
84
+ const changeToolbarContentActionId = await getRearrangeToolbarContentActionId();
85
+ const changeToolbarContentAction = actions.find(action => action.id === changeToolbarContentActionId);
86
+ this.tableMap[tableMapKey].changeToolbarContentAction = changeToolbarContentAction ? {
87
+ id: changeToolbarContentAction.id,
88
+ enabled: changeToolbarContentAction.enabled
89
+ } : undefined;
90
+ }
91
+ }
92
+
93
+ /**
94
+ * Initializes action object instance
95
+ */
96
+ async initialize() {
97
+ // No action found in control design time for version < 1.96
98
+ const version = await getUi5Version();
99
+ if (isLowerThanMinimalUi5Version(version, {
100
+ major: 1,
101
+ minor: 96
102
+ })) {
103
+ this.isApplicable = false;
104
+ return;
105
+ }
106
+ const iconTabBarfilterMap = this.buildIconTabBarFilterMap();
107
+ for (const table of getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, this.controlTypes)) {
108
+ const tabKey = Object.keys(iconTabBarfilterMap).find(key => table.getId().endsWith(key));
109
+ const section = getParentContainer(table, 'sap.uxap.ObjectPageSection');
110
+ if (section) {
111
+ await this.collectChildrenInSection(section, table);
112
+ } else if (this.iconTabBar && tabKey) {
113
+ const label = `'${iconTabBarfilterMap[tabKey]}' table`;
114
+ const tableMapKey = this.children.length.toString();
115
+ const child = this.createChild(label, table, tableMapKey);
116
+ this.children.push(child);
117
+ this.tableMap[tableMapKey] = {
118
+ table,
119
+ iconTabBarFilterKey: tabKey,
120
+ tableUpdateEventAttachedOnce: false
121
+ };
122
+ await this.addSettingsActionId(table, tableMapKey);
123
+ } else {
124
+ await this.processTable(table);
151
125
  }
152
- buildIconTabBarFilterMap() {
153
- const iconTabBarFilterMap = {};
154
- const tabBar = getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, [ICON_TAB_BAR_TYPE])[0];
155
- if (tabBar) {
156
- const control = getControlById(tabBar.getId());
157
- if (isA(ICON_TAB_BAR_TYPE, control)) {
158
- this.iconTabBar = control;
159
- for (const item of control.getItems()) {
160
- if (isManagedObject(item) && isA('sap.m.IconTabFilter', item)) {
161
- iconTabBarFilterMap[item.getKey()] = item.getText();
162
- }
163
- }
164
- }
165
- }
166
- return iconTabBarFilterMap;
126
+ }
127
+ if (this.children.length > 0) {
128
+ this.isApplicable = true;
129
+ }
130
+ }
131
+
132
+ /**
133
+ * Retrieves the internal table control from a UI5Element.
134
+ *
135
+ * @param table - The UI5Element instance to analyze.
136
+ * @returns The internal table otherwise undefined.
137
+ */
138
+ getInternalTable(table) {
139
+ try {
140
+ let tableInternal;
141
+ if (isA(SMART_TABLE_TYPE, table)) {
142
+ const itemsAggregation = table.getAggregation('items');
143
+ tableInternal = itemsAggregation.find(item => [M_TABLE_TYPE, TREE_TABLE_TYPE, ANALYTICAL_TABLE_TYPE, GRID_TABLE_TYPE].some(tType => isA(tType, item)));
167
144
  }
168
- async collectChildrenInSection(section, table) {
169
- const layout = getParentContainer(table, 'sap.uxap.ObjectPageLayout');
170
- const subSections = section.getSubSections();
171
- const subSection = getParentContainer(table, 'sap.uxap.ObjectPageSubSection');
172
- if (subSection) {
173
- if (subSections?.length === 1) {
174
- await this.processTable(table, {
175
- section,
176
- subSection: subSections[0],
177
- layout
178
- });
179
- } else if (subSections.length > 1) {
180
- const existingChildIdx = this.children.findIndex(val => val.label === `'${ section.getTitle() }' section`);
181
- let tableMapIndex;
182
- const label = this.getTableLabel(table);
183
- if (existingChildIdx < 0) {
184
- tableMapIndex = `${ this.children.length }/0`;
185
- const child = this.createChild(label, table, tableMapIndex);
186
- this.children.push({
187
- path: this.children.length.toString(),
188
- label: `'${ section?.getTitle() }' section`,
189
- enabled: true,
190
- children: [child]
191
- });
192
- } else {
193
- tableMapIndex = `${ existingChildIdx }/${ this.children[existingChildIdx].children.length }`;
194
- const child = this.createChild(label, table, tableMapIndex);
195
- this.children[existingChildIdx].children.push(child);
196
- }
197
- this.tableMap[tableMapIndex] = {
198
- table,
199
- sectionInfo: {
200
- section,
201
- subSection,
202
- layout
203
- },
204
- tableUpdateEventAttachedOnce: false
205
- };
206
- await this.addSettingsActionId(table, tableMapIndex);
207
- }
208
- }
145
+ return tableInternal;
146
+ } catch (error) {
147
+ return undefined;
148
+ }
149
+ }
150
+
151
+ /**
152
+ * Determines table label for the given table element
153
+ * @param table - table element
154
+ * @returns table label if found or 'Unnamed table'
155
+ */
156
+ getTableLabel(table) {
157
+ if (isA(SMART_TABLE_TYPE, table) || isA(MDC_TABLE_TYPE, table)) {
158
+ const header = table.getHeader();
159
+ if (header) {
160
+ return `'${header}' table`;
209
161
  }
210
- async processTable(table, sectionInfo) {
211
- const tableMapKey = this.children.length.toString();
212
- if ([
213
- SMART_TABLE_TYPE,
214
- M_TABLE_TYPE,
215
- MDC_TABLE_TYPE,
216
- TREE_TABLE_TYPE,
217
- GRID_TABLE_TYPE,
218
- ANALYTICAL_TABLE_TYPE
219
- ].some(type => isA(type, table))) {
220
- const label = this.getTableLabel(table);
221
- const child = this.createChild(label, table, tableMapKey);
222
- this.children.push(child);
223
- }
224
- this.tableMap[tableMapKey] = {
225
- table,
226
- sectionInfo: sectionInfo,
227
- tableUpdateEventAttachedOnce: false
228
- };
229
- await this.addSettingsActionId(table, tableMapKey);
162
+ } else if (isA(M_TABLE_TYPE, table)) {
163
+ const title = table?.getHeaderToolbar()?.getTitleControl()?.getText();
164
+ if (title) {
165
+ return `'${title}' table`;
230
166
  }
231
- selectOverlay(table) {
232
- const controlOverlay = OverlayUtil.getClosestOverlayFor(table);
233
- if (controlOverlay) {
234
- controlOverlay.setSelected(true);
167
+ }
168
+ return 'Unnamed table';
169
+ }
170
+
171
+ /**
172
+ * Builds a map kay/tab_name for ICON_TAB_BAR control of the active page, if such exists
173
+ * @returns built map
174
+ */
175
+ buildIconTabBarFilterMap() {
176
+ const iconTabBarFilterMap = {};
177
+
178
+ // Assumption only a tab bar control per page.
179
+ const tabBar = getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, [ICON_TAB_BAR_TYPE])[0];
180
+ if (tabBar) {
181
+ const control = getControlById(tabBar.getId());
182
+ if (isA(ICON_TAB_BAR_TYPE, control)) {
183
+ this.iconTabBar = control;
184
+ for (const item of control.getItems()) {
185
+ if (isManagedObject(item) && isA('sap.m.IconTabFilter', item)) {
186
+ iconTabBarFilterMap[item.getKey()] = item.getText();
235
187
  }
188
+ }
236
189
  }
237
- getActionObject() {
238
- return {
239
- kind: NESTED_QUICK_ACTION_KIND,
240
- id: this.id,
241
- enabled: !this.isDisabled,
242
- tooltip: this.tooltip,
243
- title: this.context.resourceBundle.getText(this.textKey),
244
- children: this.children
245
- };
190
+ }
191
+ return iconTabBarFilterMap;
192
+ }
193
+
194
+ /**
195
+ * Collects subsection data in the table map for the given section and table
196
+ * @param section - object page section
197
+ * @param table - table element
198
+ */
199
+ async collectChildrenInSection(section, table) {
200
+ const layout = getParentContainer(table, 'sap.uxap.ObjectPageLayout');
201
+ const subSections = section.getSubSections();
202
+ const subSection = getParentContainer(table, 'sap.uxap.ObjectPageSubSection');
203
+ if (subSection) {
204
+ if (subSections?.length === 1) {
205
+ await this.processTable(table, {
206
+ section,
207
+ subSection: subSections[0],
208
+ layout
209
+ });
210
+ } else if (subSections.length > 1) {
211
+ const existingChildIdx = this.children.findIndex(val => val.label === `'${section.getTitle()}' section`);
212
+ let tableMapIndex;
213
+ const label = this.getTableLabel(table);
214
+ if (existingChildIdx < 0) {
215
+ tableMapIndex = `${this.children.length}/0`;
216
+ const child = this.createChild(label, table, tableMapIndex);
217
+ this.children.push({
218
+ path: this.children.length.toString(),
219
+ label: `'${section?.getTitle()}' section`,
220
+ enabled: true,
221
+ children: [child]
222
+ });
223
+ } else {
224
+ tableMapIndex = `${existingChildIdx}/${this.children[existingChildIdx].children.length}`;
225
+ const child = this.createChild(label, table, tableMapIndex);
226
+ this.children[existingChildIdx].children.push(child);
227
+ }
228
+ this.tableMap[tableMapIndex] = {
229
+ table,
230
+ sectionInfo: {
231
+ section,
232
+ subSection,
233
+ layout
234
+ },
235
+ tableUpdateEventAttachedOnce: false
236
+ };
237
+ await this.addSettingsActionId(table, tableMapIndex);
246
238
  }
247
- createChild(label, table, path) {
248
- const child = {
249
- path,
250
- label,
251
- enabled: true,
252
- children: []
253
- };
254
- if (this.options.validatePageVariantManagement) {
255
- const variantEnabledV2 = isVariantManagementEnabledOPPage(this.context, table);
256
- if (variantEnabledV2 === false) {
257
- child.enabled = false;
258
- child.tooltip = this.context.resourceBundle.getText('TABLE_ACTION_DISABLED_VARIANT_MANAGEMENT_NOT_AVAILABLE');
259
- return child;
260
- }
261
- }
262
- if (!this.options.areTableRowsRequired) {
263
- return child;
264
- }
265
- const innerTable = this.getInternalTable(table);
266
- const tableRows = innerTable?.getAggregation('items') ?? [];
267
- if (isA(M_TABLE_TYPE, innerTable) && Array.isArray(tableRows) && tableRows.length === 0) {
268
- child.enabled = false;
269
- child.tooltip = this.context.resourceBundle.getText('TABLE_ACTION_DISABLED_ROWS_NOT_AVAILABLE');
270
- }
271
- return child;
239
+ }
240
+ }
241
+
242
+ /**
243
+ * Processes table element and pushes table data to the children array
244
+ * @param table - table element
245
+ * @param sectionInfo - section info object
246
+ */
247
+ async processTable(table, sectionInfo) {
248
+ const tableMapKey = this.children.length.toString();
249
+ if ([SMART_TABLE_TYPE, M_TABLE_TYPE, MDC_TABLE_TYPE, TREE_TABLE_TYPE, GRID_TABLE_TYPE, ANALYTICAL_TABLE_TYPE].some(type => isA(type, table))) {
250
+ const label = this.getTableLabel(table);
251
+ const child = this.createChild(label, table, tableMapKey);
252
+ this.children.push(child);
253
+ }
254
+ this.tableMap[tableMapKey] = {
255
+ table,
256
+ sectionInfo: sectionInfo,
257
+ tableUpdateEventAttachedOnce: false
258
+ };
259
+ await this.addSettingsActionId(table, tableMapKey);
260
+ }
261
+
262
+ /**
263
+ * Selects closest overlay for the given table element
264
+ * @param table - table element
265
+ */
266
+ selectOverlay(table) {
267
+ const controlOverlay = OverlayUtil.getClosestOverlayFor(table);
268
+ if (controlOverlay) {
269
+ controlOverlay.setSelected(true);
270
+ }
271
+ }
272
+
273
+ /**
274
+ * Prepares nested quick action object
275
+ * @returns action instance
276
+ */
277
+ getActionObject() {
278
+ return {
279
+ kind: NESTED_QUICK_ACTION_KIND,
280
+ id: this.id,
281
+ enabled: !this.isDisabled,
282
+ tooltip: this.tooltip,
283
+ title: this.context.resourceBundle.getText(this.textKey),
284
+ children: this.children
285
+ };
286
+ }
287
+ createChild(label, table, path) {
288
+ const child = {
289
+ path,
290
+ label,
291
+ enabled: true,
292
+ children: []
293
+ };
294
+ if (this.options.validatePageVariantManagement) {
295
+ const variantEnabledV2 = isVariantManagementEnabledOPPage(this.context, table);
296
+ if (variantEnabledV2 === false) {
297
+ child.enabled = false;
298
+ child.tooltip = this.context.resourceBundle.getText('TABLE_ACTION_DISABLED_VARIANT_MANAGEMENT_NOT_AVAILABLE');
299
+ return child;
272
300
  }
301
+ }
302
+ if (!this.options.areTableRowsRequired) {
303
+ return child;
304
+ }
305
+ const innerTable = this.getInternalTable(table);
306
+ const tableRows = innerTable?.getAggregation('items') ?? [];
307
+ if (isA(M_TABLE_TYPE, innerTable) && Array.isArray(tableRows) && tableRows.length === 0) {
308
+ child.enabled = false;
309
+ child.tooltip = this.context.resourceBundle.getText('TABLE_ACTION_DISABLED_ROWS_NOT_AVAILABLE');
310
+ }
311
+ return child;
273
312
  }
274
- var __exports = { __esModule: true };
275
- __exports.TableQuickActionDefinitionBase = TableQuickActionDefinitionBase;
276
- return __exports;
277
- });
313
+ }
314
+ var __exports = {
315
+ __esModule: true
316
+ };
317
+ __exports.TableQuickActionDefinitionBase = TableQuickActionDefinitionBase;
318
+ return __exports;
319
+ });
320
+ //# sourceMappingURL=table-quick-action-base.js.map