@sap-ux/preview-middleware 0.16.76 → 0.16.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base/config.js +3 -2
- package/dist/client/adp/controllers/AddFragment.controller.js +22 -8
- package/dist/client/adp/controllers/AddFragment.controller.ts +42 -9
- package/dist/client/adp/quick-actions/fe-v2/change-table-columns.js +95 -256
- package/dist/client/adp/quick-actions/fe-v2/change-table-columns.ts +21 -232
- package/dist/client/adp/quick-actions/fe-v2/create-page-action.js +37 -0
- package/dist/client/adp/quick-actions/fe-v2/create-page-action.ts +29 -0
- package/dist/client/adp/quick-actions/fe-v2/create-table-action.js +71 -0
- package/dist/client/adp/quick-actions/fe-v2/create-table-action.ts +62 -0
- package/dist/client/adp/quick-actions/fe-v2/registry.js +5 -3
- package/dist/client/adp/quick-actions/fe-v2/registry.ts +8 -3
- package/dist/client/adp/quick-actions/fe-v2/table-quick-action-base.js +208 -0
- package/dist/client/adp/quick-actions/fe-v2/table-quick-action-base.ts +276 -0
- package/dist/client/messagebundle.properties +2 -0
- package/dist/client/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -1,237 +1,24 @@
|
|
|
1
|
-
import OverlayUtil from 'sap/ui/dt/OverlayUtil';
|
|
2
1
|
import FlexCommand from 'sap/ui/rta/command/FlexCommand';
|
|
3
|
-
import UI5Element from 'sap/ui/core/Element';
|
|
4
|
-
import type IconTabBar from 'sap/m/IconTabBar';
|
|
5
|
-
import type IconTabFilter from 'sap/m/IconTabFilter';
|
|
6
2
|
import type Table from 'sap/m/Table';
|
|
7
3
|
import type SmartTable from 'sap/ui/comp/smarttable/SmartTable';
|
|
8
4
|
|
|
9
|
-
import type { NestedQuickAction, NestedQuickActionChild } from '@sap-ux-private/control-property-editor-common';
|
|
10
|
-
import { NESTED_QUICK_ACTION_KIND } from '@sap-ux-private/control-property-editor-common';
|
|
11
|
-
|
|
12
5
|
import { QuickActionContext, NestedQuickActionDefinition } from '../../../cpe/quick-actions/quick-action-definition';
|
|
13
|
-
import {
|
|
14
|
-
import { getControlById, isA, isManagedObject } from '../../../utils/core';
|
|
15
|
-
import { getUi5Version, isLowerThanMinimalUi5Version } from '../../../utils/version';
|
|
16
|
-
import ObjectPageSection from 'sap/uxap/ObjectPageSection';
|
|
17
|
-
import ObjectPageSubSection from 'sap/uxap/ObjectPageSubSection';
|
|
18
|
-
import TreeTable from 'sap/ui/table/TreeTable';
|
|
19
|
-
import ObjectPageLayout from 'sap/uxap/ObjectPageLayout';
|
|
6
|
+
import { getControlById, isA } from '../../../utils/core';
|
|
20
7
|
import ManagedObject from 'sap/ui/base/ManagedObject';
|
|
8
|
+
import { TableQuickActionDefinitionBase } from './table-quick-action-base';
|
|
21
9
|
|
|
22
10
|
export const CHANGE_TABLE_COLUMNS = 'change-table-columns';
|
|
23
|
-
const SMART_TABLE_ACTION_ID = 'CTX_COMP_VARIANT_CONTENT';
|
|
24
|
-
const M_TABLE_ACTION_ID = 'CTX_ADD_ELEMENTS_AS_CHILD';
|
|
25
|
-
const SETTINGS_ID = 'CTX_SETTINGS';
|
|
26
|
-
const ICON_TAB_BAR_TYPE = 'sap.m.IconTabBar';
|
|
27
11
|
const SMART_TABLE_TYPE = 'sap.ui.comp.smarttable.SmartTable';
|
|
28
12
|
const M_TABLE_TYPE = 'sap.m.Table';
|
|
29
13
|
// maintain order if action id
|
|
30
14
|
const CONTROL_TYPES = [SMART_TABLE_TYPE, M_TABLE_TYPE, 'sap.ui.table.TreeTable', 'sap.ui.table.Table'];
|
|
31
15
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
} else {
|
|
39
|
-
return [SMART_TABLE_ACTION_ID];
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return [M_TABLE_ACTION_ID, SETTINGS_ID];
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export class ChangeTableColumnsQuickAction implements NestedQuickActionDefinition {
|
|
47
|
-
readonly kind = NESTED_QUICK_ACTION_KIND;
|
|
48
|
-
readonly type = CHANGE_TABLE_COLUMNS;
|
|
49
|
-
public get id(): string {
|
|
50
|
-
return `${this.context.key}-${this.type}`;
|
|
51
|
-
}
|
|
52
|
-
isActive = false;
|
|
53
|
-
isClearButtonEnabled = false;
|
|
54
|
-
children: NestedQuickActionChild[] = [];
|
|
55
|
-
tableMap: Record<
|
|
56
|
-
string,
|
|
57
|
-
{
|
|
58
|
-
table: UI5Element;
|
|
59
|
-
tableUpdateEventAttachedOnce: boolean;
|
|
60
|
-
iconTabBarFilterKey?: string;
|
|
61
|
-
changeColumnActionId: string;
|
|
62
|
-
sectionInfo?: {
|
|
63
|
-
section: ObjectPageSection;
|
|
64
|
-
subSection: ObjectPageSubSection;
|
|
65
|
-
layout?: ObjectPageLayout;
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
> = {};
|
|
69
|
-
private iconTabBar: IconTabBar | undefined;
|
|
70
|
-
constructor(private context: QuickActionContext) {}
|
|
71
|
-
|
|
72
|
-
async initialize(): Promise<void> {
|
|
73
|
-
// No action found in control design time for version < 1.96
|
|
74
|
-
const version = await getUi5Version();
|
|
75
|
-
if (isLowerThanMinimalUi5Version(version, { major: 1, minor: 96 })) {
|
|
76
|
-
this.isActive = false;
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
const iconTabBarfilterMap = this.buildIconTabBarFilterMap();
|
|
80
|
-
for (const table of getRelevantControlFromActivePage(
|
|
81
|
-
this.context.controlIndex,
|
|
82
|
-
this.context.view,
|
|
83
|
-
CONTROL_TYPES
|
|
84
|
-
)) {
|
|
85
|
-
const actions = await this.context.actionService.get(table.getId());
|
|
86
|
-
const actionsIds = await getActionId(table);
|
|
87
|
-
const changeColumnAction = actionsIds.find(
|
|
88
|
-
(actionId) => actions.findIndex((action) => action.id === actionId) > -1
|
|
89
|
-
);
|
|
90
|
-
const tabKey = Object.keys(iconTabBarfilterMap).find((key) => table.getId().endsWith(key));
|
|
91
|
-
if (changeColumnAction) {
|
|
92
|
-
const section = getParentContainer<ObjectPageSection>(table, 'sap.uxap.ObjectPageSection');
|
|
93
|
-
if (section) {
|
|
94
|
-
this.collectChildrenInSection(section, table, changeColumnAction);
|
|
95
|
-
} else if (this.iconTabBar && tabKey) {
|
|
96
|
-
this.children.push({
|
|
97
|
-
label: `'${iconTabBarfilterMap[tabKey]}' table`,
|
|
98
|
-
children: []
|
|
99
|
-
});
|
|
100
|
-
this.tableMap[`${this.children.length - 1}`] = {
|
|
101
|
-
table,
|
|
102
|
-
iconTabBarFilterKey: tabKey,
|
|
103
|
-
changeColumnActionId: changeColumnAction,
|
|
104
|
-
tableUpdateEventAttachedOnce: false
|
|
105
|
-
};
|
|
106
|
-
} else {
|
|
107
|
-
this.processTable(table, changeColumnAction);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
if (this.children.length > 0) {
|
|
112
|
-
this.isActive = true;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
private getTableLabel(table: UI5Element): string {
|
|
117
|
-
if (isA<SmartTable>(SMART_TABLE_TYPE, table)) {
|
|
118
|
-
const header = table.getHeader();
|
|
119
|
-
if (header) {
|
|
120
|
-
return `'${header}' table`;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
if (isA<Table>(M_TABLE_TYPE, table)) {
|
|
124
|
-
const tilte = table?.getHeaderToolbar()?.getTitleControl()?.getText();
|
|
125
|
-
if (tilte) {
|
|
126
|
-
return `'${tilte}' table`;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
return 'Unnamed table';
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
private buildIconTabBarFilterMap(): { [key: string]: string } {
|
|
134
|
-
const iconTabBarfilterMap: { [key: string]: string } = {};
|
|
135
|
-
|
|
136
|
-
// Assumption only a tab bar control per page.
|
|
137
|
-
const tabBar = getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, [
|
|
138
|
-
ICON_TAB_BAR_TYPE
|
|
139
|
-
])[0];
|
|
140
|
-
if (tabBar) {
|
|
141
|
-
const control = getControlById(tabBar.getId());
|
|
142
|
-
if (isA<IconTabBar>(ICON_TAB_BAR_TYPE, control)) {
|
|
143
|
-
this.iconTabBar = control;
|
|
144
|
-
for (const item of control.getItems()) {
|
|
145
|
-
if (isManagedObject(item) && isA<IconTabFilter>('sap.m.IconTabFilter', item)) {
|
|
146
|
-
iconTabBarfilterMap[item.getKey()] = item.getText();
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
return iconTabBarfilterMap;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
private collectChildrenInSection(section: ObjectPageSection, table: UI5Element, changeColumnAction: string): void {
|
|
156
|
-
const layout = getParentContainer<ObjectPageLayout>(table, 'sap.uxap.ObjectPageLayout');
|
|
157
|
-
const subSections = section.getSubSections();
|
|
158
|
-
const subSection = getParentContainer<ObjectPageSubSection>(table, 'sap.uxap.ObjectPageSubSection');
|
|
159
|
-
if (subSection) {
|
|
160
|
-
if (subSections?.length === 1) {
|
|
161
|
-
this.processTable(table, changeColumnAction, { section, subSection: subSections[0], layout });
|
|
162
|
-
} else if (subSections.length > 1) {
|
|
163
|
-
const sectionChild = this.children.find((val) => val.label === `${section.getTitle()} section`);
|
|
164
|
-
let tableMapIndex = `${this.children.length - 1}`;
|
|
165
|
-
if (!sectionChild) {
|
|
166
|
-
tableMapIndex = `${tableMapIndex}/0`;
|
|
167
|
-
this.children.push({
|
|
168
|
-
label: `'${section?.getTitle()}' section`,
|
|
169
|
-
children: [
|
|
170
|
-
{
|
|
171
|
-
label: this.getTableLabel(table),
|
|
172
|
-
children: []
|
|
173
|
-
}
|
|
174
|
-
]
|
|
175
|
-
});
|
|
176
|
-
} else {
|
|
177
|
-
tableMapIndex = `${tableMapIndex}/${sectionChild.children.length - 1}`;
|
|
178
|
-
sectionChild.children.push({
|
|
179
|
-
label: this.getTableLabel(table),
|
|
180
|
-
children: []
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
this.tableMap[tableMapIndex] = {
|
|
185
|
-
table,
|
|
186
|
-
changeColumnActionId: changeColumnAction,
|
|
187
|
-
sectionInfo: { section, subSection, layout },
|
|
188
|
-
tableUpdateEventAttachedOnce: false
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
private processTable(
|
|
195
|
-
table: UI5Element,
|
|
196
|
-
changeColumnActionId: string,
|
|
197
|
-
sectionInfo?: { section: ObjectPageSection; subSection: ObjectPageSubSection; layout?: ObjectPageLayout }
|
|
198
|
-
): void {
|
|
199
|
-
if (isA<SmartTable>(SMART_TABLE_TYPE, table) || isA<TreeTable>('sap.ui.table.TreeTable', table)) {
|
|
200
|
-
this.children.push({
|
|
201
|
-
label: this.getTableLabel(table),
|
|
202
|
-
children: []
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
if (isA<Table>(M_TABLE_TYPE, table)) {
|
|
206
|
-
this.children.push({
|
|
207
|
-
label: this.getTableLabel(table),
|
|
208
|
-
children: []
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
this.tableMap[`${this.children.length - 1}`] = {
|
|
212
|
-
table,
|
|
213
|
-
changeColumnActionId,
|
|
214
|
-
sectionInfo: sectionInfo,
|
|
215
|
-
tableUpdateEventAttachedOnce: false
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
getActionObject(): NestedQuickAction {
|
|
220
|
-
return {
|
|
221
|
-
kind: NESTED_QUICK_ACTION_KIND,
|
|
222
|
-
id: this.id,
|
|
223
|
-
enabled: this.isActive,
|
|
224
|
-
title:
|
|
225
|
-
this.context.resourceBundle.getText('V2_QUICK_ACTION_CHANGE_TABLE_COLUMNS') ?? 'Change table columns',
|
|
226
|
-
children: this.children
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
private selectOverlay(table: UI5Element): void {
|
|
231
|
-
const controlOverlay = OverlayUtil.getClosestOverlayFor(table);
|
|
232
|
-
if (controlOverlay) {
|
|
233
|
-
controlOverlay.setSelected(true);
|
|
234
|
-
}
|
|
16
|
+
export class ChangeTableColumnsQuickAction
|
|
17
|
+
extends TableQuickActionDefinitionBase
|
|
18
|
+
implements NestedQuickActionDefinition
|
|
19
|
+
{
|
|
20
|
+
constructor(context: QuickActionContext) {
|
|
21
|
+
super(CHANGE_TABLE_COLUMNS, CONTROL_TYPES, 'V2_QUICK_ACTION_CHANGE_TABLE_COLUMNS', context, true);
|
|
235
22
|
}
|
|
236
23
|
|
|
237
24
|
async execute(path: string): Promise<FlexCommand[]> {
|
|
@@ -253,17 +40,19 @@ export class ChangeTableColumnsQuickAction implements NestedQuickActionDefinitio
|
|
|
253
40
|
if (this.iconTabBar && iconTabBarFilterKey) {
|
|
254
41
|
this.iconTabBar.setSelectedKey(iconTabBarFilterKey);
|
|
255
42
|
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
} else if (isA<Table>(M_TABLE_TYPE, table)) {
|
|
261
|
-
// if table is busy, i.e. lazy loading, then we subscribe to 'updateFinished' event and call action service when loading is done
|
|
262
|
-
// to avoid reopening the dialog after close
|
|
263
|
-
if (this.isTableLoaded(table)) {
|
|
43
|
+
if (changeColumnActionId) {
|
|
44
|
+
const executeAction = async () =>
|
|
45
|
+
await this.context.actionService.execute(table.getId(), changeColumnActionId);
|
|
46
|
+
if (isA<SmartTable>(SMART_TABLE_TYPE, table)) {
|
|
264
47
|
await executeAction();
|
|
265
|
-
} else {
|
|
266
|
-
table.
|
|
48
|
+
} else if (isA<Table>(M_TABLE_TYPE, table)) {
|
|
49
|
+
// if table is busy, i.e. lazy loading, then we subscribe to 'updateFinished' event and call action service when loading is done
|
|
50
|
+
// to avoid reopening the dialog after close
|
|
51
|
+
if (this.isTableLoaded(table)) {
|
|
52
|
+
await executeAction();
|
|
53
|
+
} else {
|
|
54
|
+
table.attachEventOnce('updateFinished', executeAction, this);
|
|
55
|
+
}
|
|
267
56
|
}
|
|
268
57
|
}
|
|
269
58
|
|
|
@@ -302,4 +91,4 @@ export class ChangeTableColumnsQuickAction implements NestedQuickActionDefinitio
|
|
|
302
91
|
return !!bindingContext;
|
|
303
92
|
}
|
|
304
93
|
}
|
|
305
|
-
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../init-dialogs", "../simple-quick-action-base"], function (OverlayRegistry, ____init_dialogs, ___simple_quick_action_base) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
const DialogNames = ____init_dialogs["DialogNames"];
|
|
7
|
+
const handler = ____init_dialogs["handler"];
|
|
8
|
+
const SimpleQuickActionDefinitionBase = ___simple_quick_action_base["SimpleQuickActionDefinitionBase"];
|
|
9
|
+
const ADD_PAGE_ACTION = 'add-page-action';
|
|
10
|
+
const CONTROL_TYPES = ['sap.f.DynamicPageTitle', 'sap.uxap.ObjectPageHeader'];
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Quick Action for adding a custom page action.
|
|
14
|
+
*/
|
|
15
|
+
class AddPageActionQuickAction extends SimpleQuickActionDefinitionBase {
|
|
16
|
+
constructor(context) {
|
|
17
|
+
super(ADD_PAGE_ACTION, CONTROL_TYPES, 'QUICK_ACTION_ADD_CUSTOM_PAGE_ACTION', context);
|
|
18
|
+
}
|
|
19
|
+
async execute() {
|
|
20
|
+
if (this.control) {
|
|
21
|
+
const overlay = OverlayRegistry.getOverlay(this.control) || [];
|
|
22
|
+
await handler(overlay, this.context.rta, DialogNames.ADD_FRAGMENT, undefined, {
|
|
23
|
+
aggregation: 'actions',
|
|
24
|
+
title: 'QUICK_ACTION_ADD_CUSTOM_PAGE_ACTION'
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
var __exports = {
|
|
31
|
+
__esModule: true
|
|
32
|
+
};
|
|
33
|
+
__exports.ADD_PAGE_ACTION = ADD_PAGE_ACTION;
|
|
34
|
+
__exports.AddPageActionQuickAction = AddPageActionQuickAction;
|
|
35
|
+
return __exports;
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=create-page-action.js.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import OverlayRegistry from 'sap/ui/dt/OverlayRegistry';
|
|
2
|
+
import FlexCommand from 'sap/ui/rta/command/FlexCommand';
|
|
3
|
+
|
|
4
|
+
import { DialogNames, handler } from '../../init-dialogs';
|
|
5
|
+
import { QuickActionContext, SimpleQuickActionDefinition } from '../../../cpe/quick-actions/quick-action-definition';
|
|
6
|
+
import { SimpleQuickActionDefinitionBase } from '../simple-quick-action-base';
|
|
7
|
+
|
|
8
|
+
export const ADD_PAGE_ACTION = 'add-page-action';
|
|
9
|
+
const CONTROL_TYPES = ['sap.f.DynamicPageTitle', 'sap.uxap.ObjectPageHeader'];
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Quick Action for adding a custom page action.
|
|
13
|
+
*/
|
|
14
|
+
export class AddPageActionQuickAction extends SimpleQuickActionDefinitionBase implements SimpleQuickActionDefinition {
|
|
15
|
+
constructor(context: QuickActionContext) {
|
|
16
|
+
super(ADD_PAGE_ACTION, CONTROL_TYPES, 'QUICK_ACTION_ADD_CUSTOM_PAGE_ACTION', context);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async execute(): Promise<FlexCommand[]> {
|
|
20
|
+
if (this.control) {
|
|
21
|
+
const overlay = OverlayRegistry.getOverlay(this.control) || [];
|
|
22
|
+
await handler(overlay, this.context.rta, DialogNames.ADD_FRAGMENT, undefined, {
|
|
23
|
+
aggregation: 'actions',
|
|
24
|
+
title: 'QUICK_ACTION_ADD_CUSTOM_PAGE_ACTION'
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["../../../utils/core", "sap/ui/dt/OverlayRegistry", "../../init-dialogs", "./table-quick-action-base"], function (_____utils_core, OverlayRegistry, ____init_dialogs, ___table_quick_action_base) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
const getControlById = _____utils_core["getControlById"];
|
|
7
|
+
const isA = _____utils_core["isA"];
|
|
8
|
+
const DialogNames = ____init_dialogs["DialogNames"];
|
|
9
|
+
const handler = ____init_dialogs["handler"];
|
|
10
|
+
const TableQuickActionDefinitionBase = ___table_quick_action_base["TableQuickActionDefinitionBase"];
|
|
11
|
+
const CREATE_TABLE_ACTION = 'create-table-action';
|
|
12
|
+
const SMART_TABLE_TYPE = 'sap.ui.comp.smarttable.SmartTable';
|
|
13
|
+
const M_TABLE_TYPE = 'sap.m.Table';
|
|
14
|
+
// maintain order if action id
|
|
15
|
+
|
|
16
|
+
const CONTROL_TYPES = [SMART_TABLE_TYPE, M_TABLE_TYPE, 'sap.ui.table.TreeTable', 'sap.ui.table.Table'];
|
|
17
|
+
class AddTableActionQuickAction extends TableQuickActionDefinitionBase {
|
|
18
|
+
constructor(context) {
|
|
19
|
+
super(CREATE_TABLE_ACTION, CONTROL_TYPES, 'QUICK_ACTION_ADD_CUSTOM_TABLE_ACTION', context);
|
|
20
|
+
}
|
|
21
|
+
async execute(path) {
|
|
22
|
+
const {
|
|
23
|
+
table,
|
|
24
|
+
iconTabBarFilterKey,
|
|
25
|
+
sectionInfo
|
|
26
|
+
} = this.tableMap[path];
|
|
27
|
+
if (!table) {
|
|
28
|
+
return [];
|
|
29
|
+
}
|
|
30
|
+
if (sectionInfo) {
|
|
31
|
+
const {
|
|
32
|
+
layout,
|
|
33
|
+
section,
|
|
34
|
+
subSection
|
|
35
|
+
} = sectionInfo;
|
|
36
|
+
layout?.setSelectedSection(section);
|
|
37
|
+
section.setSelectedSubSection(subSection);
|
|
38
|
+
this.selectOverlay(table);
|
|
39
|
+
} else {
|
|
40
|
+
getControlById(table.getId())?.getDomRef()?.scrollIntoView();
|
|
41
|
+
this.selectOverlay(table);
|
|
42
|
+
}
|
|
43
|
+
if (this.iconTabBar && iconTabBarFilterKey) {
|
|
44
|
+
this.iconTabBar.setSelectedKey(iconTabBarFilterKey);
|
|
45
|
+
}
|
|
46
|
+
let headerToolbar;
|
|
47
|
+
if (isA(SMART_TABLE_TYPE, table)) {
|
|
48
|
+
headerToolbar = table.getAggregation('items')[0].getAggregation('headerToolbar');
|
|
49
|
+
} else if (isA(M_TABLE_TYPE, table)) {
|
|
50
|
+
headerToolbar = table.getAggregation('headerToolbar');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// open dialogBox to add, and content is selected ByDefault
|
|
54
|
+
if (headerToolbar) {
|
|
55
|
+
const overlay = OverlayRegistry.getOverlay(headerToolbar) || [];
|
|
56
|
+
await handler(overlay, this.context.rta, DialogNames.ADD_FRAGMENT, undefined, {
|
|
57
|
+
aggregation: 'content',
|
|
58
|
+
title: 'QUICK_ACTION_ADD_CUSTOM_TABLE_ACTION'
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return [];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
var __exports = {
|
|
65
|
+
__esModule: true
|
|
66
|
+
};
|
|
67
|
+
__exports.CREATE_TABLE_ACTION = CREATE_TABLE_ACTION;
|
|
68
|
+
__exports.AddTableActionQuickAction = AddTableActionQuickAction;
|
|
69
|
+
return __exports;
|
|
70
|
+
});
|
|
71
|
+
//# sourceMappingURL=create-table-action.js.map
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import FlexCommand from 'sap/ui/rta/command/FlexCommand';
|
|
2
|
+
import type Table from 'sap/m/Table';
|
|
3
|
+
import type SmartTable from 'sap/ui/comp/smarttable/SmartTable';
|
|
4
|
+
|
|
5
|
+
import { QuickActionContext, NestedQuickActionDefinition } from '../../../cpe/quick-actions/quick-action-definition';
|
|
6
|
+
import { getControlById, isA } from '../../../utils/core';
|
|
7
|
+
import OverlayRegistry from 'sap/ui/dt/OverlayRegistry';
|
|
8
|
+
import { DialogNames, handler } from '../../init-dialogs';
|
|
9
|
+
import { TableQuickActionDefinitionBase } from './table-quick-action-base';
|
|
10
|
+
import ManagedObject from 'sap/ui/base/ManagedObject';
|
|
11
|
+
import UI5Element from 'sap/ui/core/Element';
|
|
12
|
+
|
|
13
|
+
export const CREATE_TABLE_ACTION = 'create-table-action';
|
|
14
|
+
const SMART_TABLE_TYPE = 'sap.ui.comp.smarttable.SmartTable';
|
|
15
|
+
const M_TABLE_TYPE = 'sap.m.Table';
|
|
16
|
+
// maintain order if action id
|
|
17
|
+
|
|
18
|
+
const CONTROL_TYPES = [SMART_TABLE_TYPE, M_TABLE_TYPE, 'sap.ui.table.TreeTable', 'sap.ui.table.Table'];
|
|
19
|
+
|
|
20
|
+
export class AddTableActionQuickAction extends TableQuickActionDefinitionBase implements NestedQuickActionDefinition {
|
|
21
|
+
constructor(context: QuickActionContext) {
|
|
22
|
+
super(CREATE_TABLE_ACTION, CONTROL_TYPES, 'QUICK_ACTION_ADD_CUSTOM_TABLE_ACTION', context);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async execute(path: string): Promise<FlexCommand[]> {
|
|
26
|
+
const { table, iconTabBarFilterKey, sectionInfo } = this.tableMap[path];
|
|
27
|
+
if (!table) {
|
|
28
|
+
return [];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (sectionInfo) {
|
|
32
|
+
const { layout, section, subSection } = sectionInfo;
|
|
33
|
+
layout?.setSelectedSection(section);
|
|
34
|
+
section.setSelectedSubSection(subSection);
|
|
35
|
+
this.selectOverlay(table);
|
|
36
|
+
} else {
|
|
37
|
+
getControlById(table.getId())?.getDomRef()?.scrollIntoView();
|
|
38
|
+
this.selectOverlay(table);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (this.iconTabBar && iconTabBarFilterKey) {
|
|
42
|
+
this.iconTabBar.setSelectedKey(iconTabBarFilterKey);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
let headerToolbar;
|
|
46
|
+
if (isA<SmartTable>(SMART_TABLE_TYPE, table)) {
|
|
47
|
+
headerToolbar = (table.getAggregation('items') as ManagedObject[])[0].getAggregation('headerToolbar');
|
|
48
|
+
} else if (isA<Table>(M_TABLE_TYPE, table)) {
|
|
49
|
+
headerToolbar = table.getAggregation('headerToolbar');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// open dialogBox to add, and content is selected ByDefault
|
|
53
|
+
if (headerToolbar) {
|
|
54
|
+
const overlay = OverlayRegistry.getOverlay(headerToolbar as UI5Element) || [];
|
|
55
|
+
await handler(overlay, this.context.rta, DialogNames.ADD_FRAGMENT, undefined, {
|
|
56
|
+
aggregation: 'content',
|
|
57
|
+
title: 'QUICK_ACTION_ADD_CUSTOM_TABLE_ACTION'
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return [];
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
sap.ui.define(["sap/ui/core/mvc/XMLView", "sap/ui/core/ComponentContainer", "../../../cpe/quick-actions/registry", "../common/add-controller-to-page", "./lr-toggle-clear-filter-bar", "./change-table-columns", "../common/op-add-header-field", "../common/op-add-custom-section"], function (XMLView, ComponentContainer, _____cpe_quick_actions_registry, ___common_add_controller_to_page, ___lr_toggle_clear_filter_bar, ___change_table_columns, ___common_op_add_header_field, ___common_op_add_custom_section) {
|
|
3
|
+
sap.ui.define(["sap/ui/core/mvc/XMLView", "sap/ui/core/ComponentContainer", "../../../cpe/quick-actions/registry", "../common/add-controller-to-page", "./lr-toggle-clear-filter-bar", "./change-table-columns", "../common/op-add-header-field", "../common/op-add-custom-section", "../fe-v2/create-table-action", "../fe-v2/create-page-action"], function (XMLView, ComponentContainer, _____cpe_quick_actions_registry, ___common_add_controller_to_page, ___lr_toggle_clear_filter_bar, ___change_table_columns, ___common_op_add_header_field, ___common_op_add_custom_section, ___fe_v2_create_table_action, ___fe_v2_create_page_action) {
|
|
4
4
|
"use strict";
|
|
5
5
|
|
|
6
6
|
const QuickActionDefinitionRegistry = _____cpe_quick_actions_registry["QuickActionDefinitionRegistry"];
|
|
@@ -9,6 +9,8 @@ sap.ui.define(["sap/ui/core/mvc/XMLView", "sap/ui/core/ComponentContainer", "../
|
|
|
9
9
|
const ChangeTableColumnsQuickAction = ___change_table_columns["ChangeTableColumnsQuickAction"];
|
|
10
10
|
const AddHeaderFieldQuickAction = ___common_op_add_header_field["AddHeaderFieldQuickAction"];
|
|
11
11
|
const AddCustomSectionQuickAction = ___common_op_add_custom_section["AddCustomSectionQuickAction"];
|
|
12
|
+
const AddTableActionQuickAction = ___fe_v2_create_table_action["AddTableActionQuickAction"];
|
|
13
|
+
const AddPageActionQuickAction = ___fe_v2_create_page_action["AddPageActionQuickAction"];
|
|
12
14
|
const OBJECT_PAGE_TYPE = 'sap.suite.ui.generic.template.ObjectPage.view.Details';
|
|
13
15
|
const LIST_REPORT_TYPE = 'sap.suite.ui.generic.template.ListReport.view.ListReport';
|
|
14
16
|
|
|
@@ -31,14 +33,14 @@ sap.ui.define(["sap/ui/core/mvc/XMLView", "sap/ui/core/ComponentContainer", "../
|
|
|
31
33
|
if (name === 'listReport') {
|
|
32
34
|
definitionGroups.push({
|
|
33
35
|
title: 'LIST REPORT',
|
|
34
|
-
definitions: [ToggleClearFilterBarQuickAction, AddControllerToPageQuickAction, ChangeTableColumnsQuickAction],
|
|
36
|
+
definitions: [ToggleClearFilterBarQuickAction, AddControllerToPageQuickAction, ChangeTableColumnsQuickAction, AddTableActionQuickAction, AddPageActionQuickAction],
|
|
35
37
|
view,
|
|
36
38
|
key: name + index
|
|
37
39
|
});
|
|
38
40
|
} else if (name === 'objectPage') {
|
|
39
41
|
definitionGroups.push({
|
|
40
42
|
title: 'OBJECT PAGE',
|
|
41
|
-
definitions: [AddControllerToPageQuickAction, ChangeTableColumnsQuickAction, AddHeaderFieldQuickAction, AddCustomSectionQuickAction],
|
|
43
|
+
definitions: [AddControllerToPageQuickAction, ChangeTableColumnsQuickAction, AddHeaderFieldQuickAction, AddCustomSectionQuickAction, AddTableActionQuickAction, AddPageActionQuickAction],
|
|
42
44
|
view,
|
|
43
45
|
key: name + index
|
|
44
46
|
});
|
|
@@ -14,7 +14,8 @@ import { ToggleClearFilterBarQuickAction } from './lr-toggle-clear-filter-bar';
|
|
|
14
14
|
import { ChangeTableColumnsQuickAction } from './change-table-columns';
|
|
15
15
|
import { AddHeaderFieldQuickAction } from '../common/op-add-header-field';
|
|
16
16
|
import { AddCustomSectionQuickAction } from '../common/op-add-custom-section';
|
|
17
|
-
|
|
17
|
+
import { AddTableActionQuickAction } from '../fe-v2/create-table-action';
|
|
18
|
+
import { AddPageActionQuickAction } from '../fe-v2/create-page-action';
|
|
18
19
|
type PageName = 'listReport' | 'objectPage';
|
|
19
20
|
|
|
20
21
|
const OBJECT_PAGE_TYPE = 'sap.suite.ui.generic.template.ObjectPage.view.Details';
|
|
@@ -40,7 +41,9 @@ export default class FEV2QuickActionRegistry extends QuickActionDefinitionRegist
|
|
|
40
41
|
definitions: [
|
|
41
42
|
ToggleClearFilterBarQuickAction,
|
|
42
43
|
AddControllerToPageQuickAction,
|
|
43
|
-
ChangeTableColumnsQuickAction
|
|
44
|
+
ChangeTableColumnsQuickAction,
|
|
45
|
+
AddTableActionQuickAction,
|
|
46
|
+
AddPageActionQuickAction
|
|
44
47
|
],
|
|
45
48
|
view,
|
|
46
49
|
key: name + index
|
|
@@ -52,7 +55,9 @@ export default class FEV2QuickActionRegistry extends QuickActionDefinitionRegist
|
|
|
52
55
|
AddControllerToPageQuickAction,
|
|
53
56
|
ChangeTableColumnsQuickAction,
|
|
54
57
|
AddHeaderFieldQuickAction,
|
|
55
|
-
AddCustomSectionQuickAction
|
|
58
|
+
AddCustomSectionQuickAction,
|
|
59
|
+
AddTableActionQuickAction,
|
|
60
|
+
AddPageActionQuickAction
|
|
56
61
|
],
|
|
57
62
|
view,
|
|
58
63
|
key: name + index
|