@sap-ux/preview-middleware 0.16.94 → 0.16.96
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/client/adp/controllers/AddFragment.controller.js +2 -0
- package/dist/client/adp/controllers/AddFragment.controller.ts +2 -0
- package/dist/client/adp/quick-actions/{fe-v2 → common}/create-page-action.js +11 -3
- package/dist/client/adp/quick-actions/{fe-v2 → common}/create-page-action.ts +9 -2
- package/dist/client/adp/quick-actions/fe-v2/registry.js +2 -2
- package/dist/client/adp/quick-actions/fe-v2/registry.ts +1 -1
- package/dist/client/adp/quick-actions/fe-v4/change-table-columns.js +47 -87
- package/dist/client/adp/quick-actions/fe-v4/change-table-columns.ts +7 -55
- package/dist/client/adp/quick-actions/fe-v4/create-table-action.js +47 -0
- package/dist/client/adp/quick-actions/fe-v4/create-table-action.ts +44 -0
- package/dist/client/adp/quick-actions/fe-v4/registry.js +5 -3
- package/dist/client/adp/quick-actions/fe-v4/registry.ts +9 -4
- package/dist/client/adp/quick-actions/fe-v4/table-quick-action-base.js +64 -0
- package/dist/client/adp/quick-actions/fe-v4/table-quick-action-base.ts +66 -0
- package/dist/client/cpe/changes/service.js +8 -5
- package/dist/client/cpe/changes/service.ts +10 -5
- package/package.json +4 -4
|
@@ -218,6 +218,8 @@ sap.ui.define([
|
|
|
218
218
|
return 'CUSTOM_ACTION';
|
|
219
219
|
} else if (this.isObjectPageHeaderField(currentControlName, targetAggregation)) {
|
|
220
220
|
return 'OBJECT_PAGE_HEADER_FIELD';
|
|
221
|
+
} else if (currentControlName === 'sap.ui.mdc.ActionToolbar' && targetAggregation === 'actions') {
|
|
222
|
+
return 'TABLE_ACTION';
|
|
221
223
|
}
|
|
222
224
|
return '';
|
|
223
225
|
},
|
|
@@ -329,6 +329,8 @@ export default class AddFragment extends BaseDialog<AddFragmentModel> {
|
|
|
329
329
|
return 'CUSTOM_ACTION';
|
|
330
330
|
} else if (this.isObjectPageHeaderField(currentControlName, targetAggregation)) {
|
|
331
331
|
return 'OBJECT_PAGE_HEADER_FIELD';
|
|
332
|
+
} else if (currentControlName === 'sap.ui.mdc.ActionToolbar' && targetAggregation === 'actions') {
|
|
333
|
+
return 'TABLE_ACTION';
|
|
332
334
|
}
|
|
333
335
|
return '';
|
|
334
336
|
}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../../cpe/feature-service", "../../init-dialogs", "../simple-quick-action-base"], function (OverlayRegistry, _____cpe_feature_service, ____init_dialogs, ___simple_quick_action_base) {
|
|
3
|
+
sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../../cpe/feature-service", "../../init-dialogs", "../simple-quick-action-base", "../../../utils/application", "../../../utils/version"], function (OverlayRegistry, _____cpe_feature_service, ____init_dialogs, ___simple_quick_action_base, _____utils_application, _____utils_version) {
|
|
4
4
|
"use strict";
|
|
5
5
|
|
|
6
6
|
const FeatureService = _____cpe_feature_service["FeatureService"];
|
|
7
7
|
const DialogNames = ____init_dialogs["DialogNames"];
|
|
8
8
|
const handler = ____init_dialogs["handler"];
|
|
9
9
|
const SimpleQuickActionDefinitionBase = ___simple_quick_action_base["SimpleQuickActionDefinitionBase"];
|
|
10
|
+
const getApplicationType = _____utils_application["getApplicationType"];
|
|
11
|
+
const getUi5Version = _____utils_version["getUi5Version"];
|
|
12
|
+
const isLowerThanMinimalUi5Version = _____utils_version["isLowerThanMinimalUi5Version"];
|
|
10
13
|
const ADD_PAGE_ACTION = 'add-page-action';
|
|
11
14
|
const CONTROL_TYPES = ['sap.f.DynamicPageTitle', 'sap.uxap.ObjectPageHeader', 'sap.uxap.ObjectPageDynamicHeaderTitle'];
|
|
12
15
|
|
|
@@ -17,8 +20,13 @@ sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../../cpe/feature-service", "../
|
|
|
17
20
|
constructor(context) {
|
|
18
21
|
super(ADD_PAGE_ACTION, CONTROL_TYPES, 'QUICK_ACTION_ADD_CUSTOM_PAGE_ACTION', context);
|
|
19
22
|
}
|
|
20
|
-
initialize() {
|
|
21
|
-
|
|
23
|
+
async initialize() {
|
|
24
|
+
const appType = getApplicationType(this.context.rta.getRootControlInstance().getManifest());
|
|
25
|
+
const version = await getUi5Version();
|
|
26
|
+
if (FeatureService.isFeatureEnabled('cpe.beta.quick-actions') === false || appType === 'fe-v4' && isLowerThanMinimalUi5Version(version, {
|
|
27
|
+
major: 1,
|
|
28
|
+
minor: 130
|
|
29
|
+
})) {
|
|
22
30
|
return;
|
|
23
31
|
}
|
|
24
32
|
return super.initialize();
|
|
@@ -5,6 +5,8 @@ import { FeatureService } from '../../../cpe/feature-service';
|
|
|
5
5
|
import { DialogNames, handler } from '../../init-dialogs';
|
|
6
6
|
import { QuickActionContext, SimpleQuickActionDefinition } from '../../../cpe/quick-actions/quick-action-definition';
|
|
7
7
|
import { SimpleQuickActionDefinitionBase } from '../simple-quick-action-base';
|
|
8
|
+
import { getApplicationType } from '../../../utils/application';
|
|
9
|
+
import { getUi5Version, isLowerThanMinimalUi5Version } from '../../../utils/version';
|
|
8
10
|
|
|
9
11
|
export const ADD_PAGE_ACTION = 'add-page-action';
|
|
10
12
|
const CONTROL_TYPES = ['sap.f.DynamicPageTitle', 'sap.uxap.ObjectPageHeader', 'sap.uxap.ObjectPageDynamicHeaderTitle'];
|
|
@@ -17,8 +19,13 @@ export class AddPageActionQuickAction extends SimpleQuickActionDefinitionBase im
|
|
|
17
19
|
super(ADD_PAGE_ACTION, CONTROL_TYPES, 'QUICK_ACTION_ADD_CUSTOM_PAGE_ACTION', context);
|
|
18
20
|
}
|
|
19
21
|
|
|
20
|
-
initialize(): void {
|
|
21
|
-
|
|
22
|
+
async initialize(): Promise<void> {
|
|
23
|
+
const appType = getApplicationType(this.context.rta.getRootControlInstance().getManifest());
|
|
24
|
+
const version = await getUi5Version();
|
|
25
|
+
if (
|
|
26
|
+
FeatureService.isFeatureEnabled('cpe.beta.quick-actions') === false ||
|
|
27
|
+
(appType === 'fe-v4' && isLowerThanMinimalUi5Version(version, { major: 1, minor: 130 }))
|
|
28
|
+
) {
|
|
22
29
|
return;
|
|
23
30
|
}
|
|
24
31
|
return super.initialize();
|
|
@@ -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", "../fe-v2/create-table-action", "../
|
|
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", "../common/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, ___common_create_page_action) {
|
|
4
4
|
"use strict";
|
|
5
5
|
|
|
6
6
|
const QuickActionDefinitionRegistry = _____cpe_quick_actions_registry["QuickActionDefinitionRegistry"];
|
|
@@ -10,7 +10,7 @@ sap.ui.define(["sap/ui/core/mvc/XMLView", "sap/ui/core/ComponentContainer", "../
|
|
|
10
10
|
const AddHeaderFieldQuickAction = ___common_op_add_header_field["AddHeaderFieldQuickAction"];
|
|
11
11
|
const AddCustomSectionQuickAction = ___common_op_add_custom_section["AddCustomSectionQuickAction"];
|
|
12
12
|
const AddTableActionQuickAction = ___fe_v2_create_table_action["AddTableActionQuickAction"];
|
|
13
|
-
const AddPageActionQuickAction =
|
|
13
|
+
const AddPageActionQuickAction = ___common_create_page_action["AddPageActionQuickAction"];
|
|
14
14
|
const OBJECT_PAGE_TYPE = 'sap.suite.ui.generic.template.ObjectPage.view.Details';
|
|
15
15
|
const LIST_REPORT_TYPE = 'sap.suite.ui.generic.template.ListReport.view.ListReport';
|
|
16
16
|
|
|
@@ -15,7 +15,7 @@ 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 '../
|
|
18
|
+
import { AddPageActionQuickAction } from '../common/create-page-action';
|
|
19
19
|
type PageName = 'listReport' | 'objectPage';
|
|
20
20
|
|
|
21
21
|
const OBJECT_PAGE_TYPE = 'sap.suite.ui.generic.template.ObjectPage.view.Details';
|
|
@@ -1,89 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const hasVariantManagement = FlexRuntimeInfoAPI.hasVariantManagement({ element: smartTable });
|
|
38
|
-
if (!hasVariantManagement) {
|
|
39
|
-
continue;
|
|
40
|
-
}
|
|
41
|
-
const actions = await this.context.actionService.get(smartTable.getId());
|
|
42
|
-
const changeColumnAction = actions.find(action => action.id === ACTION_ID);
|
|
43
|
-
if (changeColumnAction) {
|
|
44
|
-
this.children.push({
|
|
45
|
-
label: `'${ smartTable.getHeader() }' table`,
|
|
46
|
-
children: []
|
|
47
|
-
});
|
|
48
|
-
this.tableMap[`${ this.children.length - 1 }`] = index;
|
|
49
|
-
index++;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
if (this.children.length > 0) {
|
|
53
|
-
this.isActive = true;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
getActionObject() {
|
|
57
|
-
return {
|
|
58
|
-
kind: NESTED_QUICK_ACTION_KIND,
|
|
59
|
-
id: this.id,
|
|
60
|
-
enabled: this.isActive,
|
|
61
|
-
title: this.context.resourceBundle.getText('V4_QUICK_ACTION_CHANGE_TABLE_COLUMNS'),
|
|
62
|
-
children: this.children
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
async execute(path) {
|
|
66
|
-
const index = this.tableMap[path];
|
|
67
|
-
const smartTables = getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, [CONTROL_TYPE]);
|
|
68
|
-
for (let i = 0; i < smartTables.length; i++) {
|
|
69
|
-
if (i === index) {
|
|
70
|
-
const section = getControlById(smartTables[i].getId());
|
|
71
|
-
const controlOverlay = OverlayUtil.getClosestOverlayFor(section);
|
|
72
|
-
if (controlOverlay) {
|
|
73
|
-
controlOverlay.setSelected(true);
|
|
74
|
-
}
|
|
75
|
-
const hasVariantManagement = FlexRuntimeInfoAPI.hasVariantManagement({ element: smartTables[i] });
|
|
76
|
-
if (!hasVariantManagement) {
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
79
|
-
await this.context.actionService.execute(smartTables[i].getId(), ACTION_ID);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return [];
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["sap/ui/dt/OverlayUtil", "sap/ui/fl/apply/api/FlexRuntimeInfoAPI", "../../../cpe/quick-actions/utils", "../../../utils/core", "./table-quick-action-base"], function (OverlayUtil, FlexRuntimeInfoAPI, _____cpe_quick_actions_utils, _____utils_core, ___table_quick_action_base) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
const getRelevantControlFromActivePage = _____cpe_quick_actions_utils["getRelevantControlFromActivePage"];
|
|
7
|
+
const getControlById = _____utils_core["getControlById"];
|
|
8
|
+
const TableQuickActionDefinitionBase = ___table_quick_action_base["TableQuickActionDefinitionBase"];
|
|
9
|
+
const CHANGE_TABLE_COLUMNS = 'change-table-columns';
|
|
10
|
+
const ACTION_ID = 'CTX_SETTINGS0';
|
|
11
|
+
const CONTROL_TYPE = 'sap.ui.mdc.Table';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Quick Action for changing table columns.
|
|
15
|
+
*/
|
|
16
|
+
class ChangeTableColumnsQuickAction extends TableQuickActionDefinitionBase {
|
|
17
|
+
constructor(context) {
|
|
18
|
+
super(CHANGE_TABLE_COLUMNS, 'V4_QUICK_ACTION_CHANGE_TABLE_COLUMNS', context);
|
|
19
|
+
}
|
|
20
|
+
async execute(path) {
|
|
21
|
+
const index = this.tableMap[path];
|
|
22
|
+
const smartTables = getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, [CONTROL_TYPE]);
|
|
23
|
+
for (let i = 0; i < smartTables.length; i++) {
|
|
24
|
+
if (i === index) {
|
|
25
|
+
const section = getControlById(smartTables[i].getId());
|
|
26
|
+
const controlOverlay = OverlayUtil.getClosestOverlayFor(section);
|
|
27
|
+
if (controlOverlay) {
|
|
28
|
+
controlOverlay.setSelected(true);
|
|
29
|
+
}
|
|
30
|
+
const hasVariantManagement = FlexRuntimeInfoAPI.hasVariantManagement({
|
|
31
|
+
element: smartTables[i]
|
|
32
|
+
});
|
|
33
|
+
if (!hasVariantManagement) {
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
await this.context.actionService.execute(smartTables[i].getId(), ACTION_ID);
|
|
83
37
|
}
|
|
38
|
+
}
|
|
39
|
+
return [];
|
|
84
40
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
41
|
+
}
|
|
42
|
+
var __exports = {
|
|
43
|
+
__esModule: true
|
|
44
|
+
};
|
|
45
|
+
__exports.CHANGE_TABLE_COLUMNS = CHANGE_TABLE_COLUMNS;
|
|
46
|
+
__exports.ChangeTableColumnsQuickAction = ChangeTableColumnsQuickAction;
|
|
47
|
+
return __exports;
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=change-table-columns.js.map
|
|
@@ -1,72 +1,24 @@
|
|
|
1
1
|
import OverlayUtil from 'sap/ui/dt/OverlayUtil';
|
|
2
2
|
import FlexCommand from 'sap/ui/rta/command/FlexCommand';
|
|
3
|
-
import Table from 'sap/ui/mdc/Table';
|
|
4
3
|
import FlexRuntimeInfoAPI from 'sap/ui/fl/apply/api/FlexRuntimeInfoAPI';
|
|
5
|
-
|
|
6
|
-
import type { NestedQuickActionChild, NestedQuickAction } from '@sap-ux-private/control-property-editor-common';
|
|
7
|
-
import { NESTED_QUICK_ACTION_KIND } from '@sap-ux-private/control-property-editor-common';
|
|
8
|
-
|
|
9
4
|
import { QuickActionContext, NestedQuickActionDefinition } from '../../../cpe/quick-actions/quick-action-definition';
|
|
10
5
|
import { getRelevantControlFromActivePage } from '../../../cpe/quick-actions/utils';
|
|
11
|
-
import { FeatureService } from '../../../cpe/feature-service';
|
|
12
6
|
import { getControlById } from '../../../utils/core';
|
|
7
|
+
import { TableQuickActionDefinitionBase } from './table-quick-action-base';
|
|
13
8
|
|
|
14
9
|
export const CHANGE_TABLE_COLUMNS = 'change-table-columns';
|
|
15
10
|
const ACTION_ID = 'CTX_SETTINGS0';
|
|
16
11
|
const CONTROL_TYPE = 'sap.ui.mdc.Table';
|
|
17
12
|
|
|
18
|
-
|
|
19
13
|
/**
|
|
20
14
|
* Quick Action for changing table columns.
|
|
21
15
|
*/
|
|
22
|
-
export class ChangeTableColumnsQuickAction
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
isActive = false;
|
|
29
|
-
isClearButtonEnabled = false;
|
|
30
|
-
children: NestedQuickActionChild[] = [];
|
|
31
|
-
tableMap: Record<string, number> = {};
|
|
32
|
-
constructor(private context: QuickActionContext) {}
|
|
33
|
-
|
|
34
|
-
async initialize(): Promise<void> {
|
|
35
|
-
if (FeatureService.isFeatureEnabled('cpe.beta.quick-actions') === false) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
let index = 0;
|
|
39
|
-
for (const smartTable of getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, [
|
|
40
|
-
CONTROL_TYPE
|
|
41
|
-
])) {
|
|
42
|
-
const hasVariantManagement = FlexRuntimeInfoAPI.hasVariantManagement({ element: smartTable });
|
|
43
|
-
if (!hasVariantManagement) {
|
|
44
|
-
continue;
|
|
45
|
-
}
|
|
46
|
-
const actions = await this.context.actionService.get(smartTable.getId());
|
|
47
|
-
const changeColumnAction = actions.find((action) => action.id === ACTION_ID);
|
|
48
|
-
if (changeColumnAction) {
|
|
49
|
-
this.children.push({
|
|
50
|
-
label: `'${(smartTable as Table).getHeader()}' table`,
|
|
51
|
-
children: []
|
|
52
|
-
});
|
|
53
|
-
this.tableMap[`${this.children.length - 1}`] = index;
|
|
54
|
-
index++;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
if (this.children.length > 0) {
|
|
58
|
-
this.isActive = true;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
getActionObject(): NestedQuickAction {
|
|
63
|
-
return {
|
|
64
|
-
kind: NESTED_QUICK_ACTION_KIND,
|
|
65
|
-
id: this.id,
|
|
66
|
-
enabled: this.isActive,
|
|
67
|
-
title: this.context.resourceBundle.getText('V4_QUICK_ACTION_CHANGE_TABLE_COLUMNS'),
|
|
68
|
-
children: this.children
|
|
69
|
-
};
|
|
16
|
+
export class ChangeTableColumnsQuickAction
|
|
17
|
+
extends TableQuickActionDefinitionBase
|
|
18
|
+
implements NestedQuickActionDefinition
|
|
19
|
+
{
|
|
20
|
+
constructor(context: QuickActionContext) {
|
|
21
|
+
super(CHANGE_TABLE_COLUMNS, 'V4_QUICK_ACTION_CHANGE_TABLE_COLUMNS', context);
|
|
70
22
|
}
|
|
71
23
|
|
|
72
24
|
async execute(path: string): Promise<FlexCommand[]> {
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["sap/ui/dt/OverlayUtil", "../../../cpe/quick-actions/utils", "../../../utils/core", "../../init-dialogs", "./table-quick-action-base"], function (OverlayUtil, _____cpe_quick_actions_utils, _____utils_core, ____init_dialogs, ___table_quick_action_base) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
const getRelevantControlFromActivePage = _____cpe_quick_actions_utils["getRelevantControlFromActivePage"];
|
|
7
|
+
const getControlById = _____utils_core["getControlById"];
|
|
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 TOOLBAR_ACTION = 'sap.ui.mdc.ActionToolbar';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Quick Action for creating table action.
|
|
16
|
+
*/
|
|
17
|
+
class AddTableActionQuickAction extends TableQuickActionDefinitionBase {
|
|
18
|
+
constructor(context) {
|
|
19
|
+
super(CREATE_TABLE_ACTION, 'QUICK_ACTION_ADD_CUSTOM_TABLE_ACTION', context);
|
|
20
|
+
}
|
|
21
|
+
async execute(path) {
|
|
22
|
+
const index = this.tableMap[path];
|
|
23
|
+
const smartTablesToolbarAction = getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, [TOOLBAR_ACTION]);
|
|
24
|
+
for (let i = 0; i < smartTablesToolbarAction.length; i++) {
|
|
25
|
+
if (i === index) {
|
|
26
|
+
const section = getControlById(smartTablesToolbarAction[i].getId());
|
|
27
|
+
const controlOverlay = OverlayUtil.getClosestOverlayFor(section);
|
|
28
|
+
if (controlOverlay) {
|
|
29
|
+
controlOverlay.setSelected(true);
|
|
30
|
+
await handler(controlOverlay, this.context.rta, DialogNames.ADD_FRAGMENT, undefined, {
|
|
31
|
+
aggregation: 'actions',
|
|
32
|
+
title: 'QUICK_ACTION_ADD_CUSTOM_TABLE_ACTION'
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
var __exports = {
|
|
41
|
+
__esModule: true
|
|
42
|
+
};
|
|
43
|
+
__exports.CREATE_TABLE_ACTION = CREATE_TABLE_ACTION;
|
|
44
|
+
__exports.AddTableActionQuickAction = AddTableActionQuickAction;
|
|
45
|
+
return __exports;
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=create-table-action.js.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import OverlayUtil from 'sap/ui/dt/OverlayUtil';
|
|
2
|
+
import FlexCommand from 'sap/ui/rta/command/FlexCommand';
|
|
3
|
+
|
|
4
|
+
import { QuickActionContext, NestedQuickActionDefinition } from '../../../cpe/quick-actions/quick-action-definition';
|
|
5
|
+
import { getRelevantControlFromActivePage } from '../../../cpe/quick-actions/utils';
|
|
6
|
+
import { getControlById } from '../../../utils/core';
|
|
7
|
+
import { DialogNames, handler } from '../../init-dialogs';
|
|
8
|
+
import { TableQuickActionDefinitionBase } from './table-quick-action-base';
|
|
9
|
+
|
|
10
|
+
export const CREATE_TABLE_ACTION = 'create_table_action';
|
|
11
|
+
const TOOLBAR_ACTION = 'sap.ui.mdc.ActionToolbar';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Quick Action for creating table action.
|
|
15
|
+
*/
|
|
16
|
+
export class AddTableActionQuickAction extends TableQuickActionDefinitionBase implements NestedQuickActionDefinition {
|
|
17
|
+
constructor(context: QuickActionContext) {
|
|
18
|
+
super(CREATE_TABLE_ACTION, 'QUICK_ACTION_ADD_CUSTOM_TABLE_ACTION', context);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async execute(path: string): Promise<FlexCommand[]> {
|
|
22
|
+
const index = this.tableMap[path];
|
|
23
|
+
const smartTablesToolbarAction = getRelevantControlFromActivePage(
|
|
24
|
+
this.context.controlIndex,
|
|
25
|
+
this.context.view,
|
|
26
|
+
[TOOLBAR_ACTION]
|
|
27
|
+
);
|
|
28
|
+
for (let i = 0; i < smartTablesToolbarAction.length; i++) {
|
|
29
|
+
if (i === index) {
|
|
30
|
+
const section = getControlById(smartTablesToolbarAction[i].getId());
|
|
31
|
+
const controlOverlay = OverlayUtil.getClosestOverlayFor(section);
|
|
32
|
+
if (controlOverlay) {
|
|
33
|
+
controlOverlay.setSelected(true);
|
|
34
|
+
await handler(controlOverlay, this.context.rta, DialogNames.ADD_FRAGMENT, undefined, {
|
|
35
|
+
aggregation: 'actions',
|
|
36
|
+
title: 'QUICK_ACTION_ADD_CUSTOM_TABLE_ACTION'
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
sap.ui.define(["../../../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 (_____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(["../../../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", "../common/create-page-action", "./create-table-action"], function (_____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, ___common_create_page_action, ___create_table_action) {
|
|
4
4
|
"use strict";
|
|
5
5
|
|
|
6
6
|
const QuickActionDefinitionRegistry = _____cpe_quick_actions_registry["QuickActionDefinitionRegistry"];
|
|
@@ -9,6 +9,8 @@ sap.ui.define(["../../../cpe/quick-actions/registry", "../common/add-controller-
|
|
|
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 AddPageActionQuickAction = ___common_create_page_action["AddPageActionQuickAction"];
|
|
13
|
+
const AddTableActionQuickAction = ___create_table_action["AddTableActionQuickAction"];
|
|
12
14
|
const LIST_REPORT_TYPE = 'sap.fe.templates.ListReport.ListReport';
|
|
13
15
|
const OBJECT_PAGE_TYPE = 'sap.fe.templates.ObjectPage.ObjectPage';
|
|
14
16
|
|
|
@@ -31,14 +33,14 @@ sap.ui.define(["../../../cpe/quick-actions/registry", "../common/add-controller-
|
|
|
31
33
|
if (name === 'listReport') {
|
|
32
34
|
definitionGroups.push({
|
|
33
35
|
title: 'LIST REPORT',
|
|
34
|
-
definitions: [ToggleClearFilterBarQuickAction, AddControllerToPageQuickAction, ChangeTableColumnsQuickAction],
|
|
36
|
+
definitions: [ToggleClearFilterBarQuickAction, AddControllerToPageQuickAction, ChangeTableColumnsQuickAction, AddPageActionQuickAction, AddTableActionQuickAction],
|
|
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, AddPageActionQuickAction, AddTableActionQuickAction],
|
|
42
44
|
view,
|
|
43
45
|
key: name + index
|
|
44
46
|
});
|
|
@@ -9,6 +9,8 @@ import { ToggleClearFilterBarQuickAction } from './lr-toggle-clear-filter-bar';
|
|
|
9
9
|
import { ChangeTableColumnsQuickAction } from './change-table-columns';
|
|
10
10
|
import { AddHeaderFieldQuickAction } from '../common/op-add-header-field';
|
|
11
11
|
import { AddCustomSectionQuickAction } from '../common/op-add-custom-section';
|
|
12
|
+
import { AddPageActionQuickAction } from '../common/create-page-action';
|
|
13
|
+
import { AddTableActionQuickAction } from './create-table-action';
|
|
12
14
|
|
|
13
15
|
type PageName = 'listReport' | 'objectPage';
|
|
14
16
|
|
|
@@ -23,20 +25,21 @@ export default class FEV4QuickActionRegistry extends QuickActionDefinitionRegist
|
|
|
23
25
|
[LIST_REPORT_TYPE]: 'listReport',
|
|
24
26
|
[OBJECT_PAGE_TYPE]: 'objectPage'
|
|
25
27
|
};
|
|
28
|
+
|
|
26
29
|
getDefinitions(context: QuickActionActivationContext): QuickActionDefinitionGroup[] {
|
|
27
30
|
const activePages = this.getActivePageContent(context.controlIndex);
|
|
28
|
-
|
|
29
31
|
const definitionGroups: QuickActionDefinitionGroup[] = [];
|
|
30
32
|
for (let index = 0; index < activePages.length; index++) {
|
|
31
33
|
const { name, view } = activePages[index];
|
|
32
|
-
|
|
33
34
|
if (name === 'listReport') {
|
|
34
35
|
definitionGroups.push({
|
|
35
36
|
title: 'LIST REPORT',
|
|
36
37
|
definitions: [
|
|
37
38
|
ToggleClearFilterBarQuickAction,
|
|
38
39
|
AddControllerToPageQuickAction,
|
|
39
|
-
ChangeTableColumnsQuickAction
|
|
40
|
+
ChangeTableColumnsQuickAction,
|
|
41
|
+
AddPageActionQuickAction,
|
|
42
|
+
AddTableActionQuickAction
|
|
40
43
|
],
|
|
41
44
|
view,
|
|
42
45
|
key: name + index
|
|
@@ -48,7 +51,9 @@ export default class FEV4QuickActionRegistry extends QuickActionDefinitionRegist
|
|
|
48
51
|
AddControllerToPageQuickAction,
|
|
49
52
|
ChangeTableColumnsQuickAction,
|
|
50
53
|
AddHeaderFieldQuickAction,
|
|
51
|
-
AddCustomSectionQuickAction
|
|
54
|
+
AddCustomSectionQuickAction,
|
|
55
|
+
AddPageActionQuickAction,
|
|
56
|
+
AddTableActionQuickAction
|
|
52
57
|
],
|
|
53
58
|
view,
|
|
54
59
|
key: name + index
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
sap.ui.define([
|
|
3
|
+
'sap/ui/fl/apply/api/FlexRuntimeInfoAPI',
|
|
4
|
+
'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
|
|
5
|
+
'../../../cpe/quick-actions/utils'
|
|
6
|
+
], function (FlexRuntimeInfoAPI, ___sap_ux_private_control_property_editor_common, _____cpe_quick_actions_utils) {
|
|
7
|
+
'use strict';
|
|
8
|
+
const NESTED_QUICK_ACTION_KIND = ___sap_ux_private_control_property_editor_common['NESTED_QUICK_ACTION_KIND'];
|
|
9
|
+
const getRelevantControlFromActivePage = _____cpe_quick_actions_utils['getRelevantControlFromActivePage'];
|
|
10
|
+
const ACTION_ID = 'CTX_SETTINGS0';
|
|
11
|
+
const CONTROL_TYPE = 'sap.ui.mdc.Table';
|
|
12
|
+
class TableQuickActionDefinitionBase {
|
|
13
|
+
kind = NESTED_QUICK_ACTION_KIND;
|
|
14
|
+
get id() {
|
|
15
|
+
return `${ this.context.key }-${ this.type }`;
|
|
16
|
+
}
|
|
17
|
+
get textKey() {
|
|
18
|
+
return this.defaultTextKey;
|
|
19
|
+
}
|
|
20
|
+
isActive = false;
|
|
21
|
+
isClearButtonEnabled = false;
|
|
22
|
+
children = [];
|
|
23
|
+
tableMap = {};
|
|
24
|
+
constructor(type, defaultTextKey, context) {
|
|
25
|
+
this.type = type;
|
|
26
|
+
this.defaultTextKey = defaultTextKey;
|
|
27
|
+
this.context = context;
|
|
28
|
+
}
|
|
29
|
+
async initialize() {
|
|
30
|
+
let index = 0;
|
|
31
|
+
for (const smartTable of getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, [CONTROL_TYPE])) {
|
|
32
|
+
const hasVariantManagement = FlexRuntimeInfoAPI.hasVariantManagement({ element: smartTable });
|
|
33
|
+
if (!hasVariantManagement) {
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
const actions = await this.context.actionService.get(smartTable.getId());
|
|
37
|
+
const changeColumnAction = actions.find(action => action.id === ACTION_ID);
|
|
38
|
+
if (changeColumnAction) {
|
|
39
|
+
this.children.push({
|
|
40
|
+
label: `'${ smartTable.getHeader() }' table`,
|
|
41
|
+
children: []
|
|
42
|
+
});
|
|
43
|
+
this.tableMap[`${ this.children.length - 1 }`] = index;
|
|
44
|
+
index++;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (this.children.length > 0) {
|
|
48
|
+
this.isActive = true;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
getActionObject() {
|
|
52
|
+
return {
|
|
53
|
+
kind: NESTED_QUICK_ACTION_KIND,
|
|
54
|
+
id: this.id,
|
|
55
|
+
enabled: this.isActive,
|
|
56
|
+
title: this.context.resourceBundle.getText(this.textKey),
|
|
57
|
+
children: this.children
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
var __exports = { __esModule: true };
|
|
62
|
+
__exports.TableQuickActionDefinitionBase = TableQuickActionDefinitionBase;
|
|
63
|
+
return __exports;
|
|
64
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import Table from 'sap/ui/mdc/Table';
|
|
2
|
+
import FlexRuntimeInfoAPI from 'sap/ui/fl/apply/api/FlexRuntimeInfoAPI';
|
|
3
|
+
|
|
4
|
+
import type { NestedQuickActionChild, NestedQuickAction } from '@sap-ux-private/control-property-editor-common';
|
|
5
|
+
import { NESTED_QUICK_ACTION_KIND } from '@sap-ux-private/control-property-editor-common';
|
|
6
|
+
|
|
7
|
+
import { QuickActionContext } from '../../../cpe/quick-actions/quick-action-definition';
|
|
8
|
+
import { getRelevantControlFromActivePage } from '../../../cpe/quick-actions/utils';
|
|
9
|
+
|
|
10
|
+
const ACTION_ID = 'CTX_SETTINGS0';
|
|
11
|
+
const CONTROL_TYPE = 'sap.ui.mdc.Table';
|
|
12
|
+
export abstract class TableQuickActionDefinitionBase {
|
|
13
|
+
readonly kind = NESTED_QUICK_ACTION_KIND;
|
|
14
|
+
public get id(): string {
|
|
15
|
+
return `${this.context.key}-${this.type}`;
|
|
16
|
+
}
|
|
17
|
+
protected get textKey(): string {
|
|
18
|
+
return this.defaultTextKey;
|
|
19
|
+
}
|
|
20
|
+
isActive = false;
|
|
21
|
+
isClearButtonEnabled = false;
|
|
22
|
+
children: NestedQuickActionChild[] = [];
|
|
23
|
+
tableMap: Record<string, number> = {};
|
|
24
|
+
constructor(
|
|
25
|
+
public readonly type: string,
|
|
26
|
+
protected readonly defaultTextKey: string,
|
|
27
|
+
protected readonly context: QuickActionContext
|
|
28
|
+
) {}
|
|
29
|
+
|
|
30
|
+
async initialize(): Promise<void> {
|
|
31
|
+
let index = 0;
|
|
32
|
+
for (const smartTable of getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, [
|
|
33
|
+
CONTROL_TYPE
|
|
34
|
+
])) {
|
|
35
|
+
const hasVariantManagement = FlexRuntimeInfoAPI.hasVariantManagement({ element: smartTable });
|
|
36
|
+
if (!hasVariantManagement) {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const actions = await this.context.actionService.get(smartTable.getId());
|
|
41
|
+
const changeColumnAction = actions.find((action) => action.id === ACTION_ID);
|
|
42
|
+
if (changeColumnAction) {
|
|
43
|
+
this.children.push({
|
|
44
|
+
label: `'${(smartTable as Table).getHeader()}' table`,
|
|
45
|
+
children: []
|
|
46
|
+
});
|
|
47
|
+
this.tableMap[`${this.children.length - 1}`] = index;
|
|
48
|
+
index++;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (this.children.length > 0) {
|
|
53
|
+
this.isActive = true;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
getActionObject(): NestedQuickAction {
|
|
58
|
+
return {
|
|
59
|
+
kind: NESTED_QUICK_ACTION_KIND,
|
|
60
|
+
id: this.id,
|
|
61
|
+
enabled: this.isActive,
|
|
62
|
+
title: this.context.resourceBundle.getText(this.textKey),
|
|
63
|
+
children: this.children
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -199,17 +199,20 @@ sap.ui.define([
|
|
|
199
199
|
const stack = this.options.rta.getCommandStack();
|
|
200
200
|
const allCommands = stack.getCommands();
|
|
201
201
|
const executedCommands = stack.getAllExecutedCommands();
|
|
202
|
-
const
|
|
203
|
-
|
|
204
|
-
|
|
202
|
+
const allCommandsFlattened = allCommands.flatMap(command => typeof command.getCommands === 'function' ? command.getCommands() : [command]);
|
|
203
|
+
const activeCommandCount = allCommandsFlattened.length - executedCommands.length;
|
|
204
|
+
let i = 0;
|
|
205
|
+
for (const command of allCommands) {
|
|
205
206
|
try {
|
|
206
207
|
if (typeof command.getCommands === 'function') {
|
|
207
208
|
const subCommands = command.getCommands();
|
|
208
209
|
for (const subCommand of subCommands) {
|
|
209
|
-
await this.handleCommand(subCommand,
|
|
210
|
+
await this.handleCommand(subCommand, activeCommandCount, i, pendingChanges);
|
|
211
|
+
i++;
|
|
210
212
|
}
|
|
211
213
|
} else {
|
|
212
|
-
await this.handleCommand(command,
|
|
214
|
+
await this.handleCommand(command, activeCommandCount, i, pendingChanges);
|
|
215
|
+
i++;
|
|
213
216
|
}
|
|
214
217
|
} catch (error) {
|
|
215
218
|
Log.error('CPE: Change creation Failed', getError(error));
|
|
@@ -307,17 +307,22 @@ export class ChangeService {
|
|
|
307
307
|
const stack = this.options.rta.getCommandStack();
|
|
308
308
|
const allCommands = stack.getCommands();
|
|
309
309
|
const executedCommands = stack.getAllExecutedCommands();
|
|
310
|
-
const
|
|
311
|
-
|
|
312
|
-
|
|
310
|
+
const allCommandsFlattened = allCommands.flatMap((command: FlexCommand) =>
|
|
311
|
+
typeof command.getCommands === 'function' ? command.getCommands() : [command]
|
|
312
|
+
);
|
|
313
|
+
const activeCommandCount = allCommandsFlattened.length - executedCommands.length;
|
|
314
|
+
let i = 0;
|
|
315
|
+
for (const command of allCommands) {
|
|
313
316
|
try {
|
|
314
317
|
if (typeof command.getCommands === 'function') {
|
|
315
318
|
const subCommands = command.getCommands();
|
|
316
319
|
for (const subCommand of subCommands) {
|
|
317
|
-
await this.handleCommand(subCommand,
|
|
320
|
+
await this.handleCommand(subCommand, activeCommandCount, i, pendingChanges);
|
|
321
|
+
i++;
|
|
318
322
|
}
|
|
319
323
|
} else {
|
|
320
|
-
await this.handleCommand(command,
|
|
324
|
+
await this.handleCommand(command, activeCommandCount, i, pendingChanges);
|
|
325
|
+
i++;
|
|
321
326
|
}
|
|
322
327
|
} catch (error) {
|
|
323
328
|
Log.error('CPE: Change creation Failed', getError(error));
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"bugs": {
|
|
10
10
|
"url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Apreview-middleware"
|
|
11
11
|
},
|
|
12
|
-
"version": "0.16.
|
|
12
|
+
"version": "0.16.96",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"@sap-ux/logger": "0.6.0",
|
|
29
29
|
"@sap-ux/feature-toggle": "0.2.2",
|
|
30
30
|
"@sap-ux/btp-utils": "0.15.2",
|
|
31
|
-
"@sap-ux/adp-tooling": "0.12.
|
|
32
|
-
"@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.5.
|
|
31
|
+
"@sap-ux/adp-tooling": "0.12.63",
|
|
32
|
+
"@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.5.24",
|
|
33
33
|
"@sap-ux/project-access": "1.28.2"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"supertest": "6.3.3",
|
|
47
47
|
"@sap-ux-private/playwright": "0.1.0",
|
|
48
48
|
"dotenv": "16.3.1",
|
|
49
|
-
"@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.11.
|
|
49
|
+
"@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.11.20",
|
|
50
50
|
"@sap-ux/axios-extension": "1.16.7",
|
|
51
51
|
"@sap-ux/store": "0.9.2",
|
|
52
52
|
"@sap-ux/ui5-info": "0.8.1",
|