@sap-ux/preview-middleware 0.23.132 → 0.23.135
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/AddActionFragment.controller.js +1 -1
- package/dist/client/adp/controllers/AddActionFragment.controller.ts +1 -1
- package/dist/client/adp/controllers/AddCustomFragment.controller.js +111 -12
- package/dist/client/adp/controllers/AddCustomFragment.controller.ts +114 -12
- package/dist/client/adp/quick-actions/fe-v4/create-table-action-config-change.js +2 -2
- package/dist/client/adp/quick-actions/fe-v4/create-table-action-config-change.ts +9 -11
- package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column-config-change.js +142 -0
- package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column-config-change.ts +178 -0
- package/dist/client/adp/quick-actions/fe-v4/op-add-custom-section.js +2 -1
- package/dist/client/adp/quick-actions/fe-v4/op-add-custom-section.ts +2 -1
- package/dist/client/adp/quick-actions/fe-v4/registry.js +2 -2
- package/dist/client/adp/quick-actions/fe-v4/registry.ts +1 -1
- package/dist/client/adp/quick-actions/fe-v4/utils.js +26 -22
- package/dist/client/adp/quick-actions/fe-v4/utils.ts +34 -34
- package/dist/client/adp/quick-actions/table-quick-action-base.js +50 -6
- package/dist/client/adp/quick-actions/table-quick-action-base.ts +56 -5
- package/dist/client/adp/ui/AddCustomFragment.fragment.xml +6 -0
- package/dist/client/messagebundle.properties +5 -1
- package/dist/client/utils/fe-v4.js +12 -0
- package/dist/client/utils/fe-v4.ts +17 -0
- package/package.json +11 -11
- package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column.js +0 -51
- package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column.ts +0 -52
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import type FlexCommand from 'sap/ui/rta/command/FlexCommand';
|
|
2
|
+
import OverlayRegistry from 'sap/ui/dt/OverlayRegistry';
|
|
3
|
+
|
|
4
|
+
import { QuickActionContext, NestedQuickActionDefinition } from '../../../cpe/quick-actions/quick-action-definition';
|
|
5
|
+
import { DialogFactory, DialogNames } from '../../dialog-factory';
|
|
6
|
+
import { SMART_TABLE_TYPE, GRID_TABLE_TYPE, MDC_TABLE_TYPE, TREE_TABLE_TYPE } from '../control-types';
|
|
7
|
+
import { TableQuickActionDefinitionBase } from '../table-quick-action-base';
|
|
8
|
+
|
|
9
|
+
import { DIALOG_ENABLEMENT_VALIDATOR } from '../dialog-enablement-validator';
|
|
10
|
+
import Table from 'sap/ui/mdc/Table';
|
|
11
|
+
import { getV4AppComponent, isMacroTable } from '../../../utils/fe-v4';
|
|
12
|
+
import { getLineItemAnnotation, getPropertyPath } from './utils';
|
|
13
|
+
import { getUi5Version, isLowerThanMinimalUi5Version } from '../../../utils/version';
|
|
14
|
+
import { isA } from '../../../utils/core';
|
|
15
|
+
import UI5Element from 'sap/ui/core/Element';
|
|
16
|
+
|
|
17
|
+
interface ViewDataType {
|
|
18
|
+
stableId: string;
|
|
19
|
+
}
|
|
20
|
+
export const CREATE_TABLE_CUSTOM_COLUMN = 'create-table-custom-column';
|
|
21
|
+
const regexForAnnotationPath =
|
|
22
|
+
/controlConfiguration\/(?:entity\/)?@com\.sap\.vocabularies\.UI\.v1\.LineItem(?:#[^/]+)?\/columns\//;
|
|
23
|
+
|
|
24
|
+
export const CONTROL_TYPES = [SMART_TABLE_TYPE, MDC_TABLE_TYPE, TREE_TABLE_TYPE, GRID_TABLE_TYPE];
|
|
25
|
+
|
|
26
|
+
export class AddTableCustomColumnQuickAction
|
|
27
|
+
extends TableQuickActionDefinitionBase
|
|
28
|
+
implements NestedQuickActionDefinition
|
|
29
|
+
{
|
|
30
|
+
protected pageId: string | undefined;
|
|
31
|
+
constructor(context: QuickActionContext) {
|
|
32
|
+
super(
|
|
33
|
+
CREATE_TABLE_CUSTOM_COLUMN,
|
|
34
|
+
CONTROL_TYPES,
|
|
35
|
+
'QUICK_ACTION_ADD_CUSTOM_TABLE_COLUMN',
|
|
36
|
+
context,
|
|
37
|
+
{
|
|
38
|
+
validateTableColumns: true
|
|
39
|
+
},
|
|
40
|
+
[DIALOG_ENABLEMENT_VALIDATOR]
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
async initialize(): Promise<void> {
|
|
44
|
+
this.pageId = (this.context.view.getViewData() as ViewDataType)?.stableId.split('::').pop() as string;
|
|
45
|
+
const version = await getUi5Version();
|
|
46
|
+
if (isLowerThanMinimalUi5Version(version, { major: 1, minor: 120 })) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
await super.initialize();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async execute(path: string): Promise<FlexCommand[]> {
|
|
53
|
+
const { table } = this.tableMap[path];
|
|
54
|
+
if (!table) {
|
|
55
|
+
return [];
|
|
56
|
+
}
|
|
57
|
+
if (table) {
|
|
58
|
+
const overlay = OverlayRegistry.getOverlay(table) || [];
|
|
59
|
+
const propertyPath = `${getPropertyPath(table, 'columns')}`;
|
|
60
|
+
const anchor = findAnchor(table);
|
|
61
|
+
await DialogFactory.createDialog(
|
|
62
|
+
overlay,
|
|
63
|
+
this.context.rta,
|
|
64
|
+
DialogNames.ADD_CUSTOM_FRAGMENT,
|
|
65
|
+
undefined,
|
|
66
|
+
{
|
|
67
|
+
title: 'QUICK_ACTION_ADD_CUSTOM_TABLE_COLUMN',
|
|
68
|
+
type: 'tableColumn',
|
|
69
|
+
appDescriptor: {
|
|
70
|
+
appComponent: getV4AppComponent(this.context.view)!,
|
|
71
|
+
appType: 'fe-v4',
|
|
72
|
+
pageId: this.pageId!,
|
|
73
|
+
projectId: this.context.flexSettings.projectId,
|
|
74
|
+
anchor
|
|
75
|
+
},
|
|
76
|
+
validateId: (columnId) => {
|
|
77
|
+
const customColumnInPending = [
|
|
78
|
+
...this.context.changeService.getAllPendingConfigPropertyPath()
|
|
79
|
+
].filter((path) => regexForAnnotationPath.test(path));
|
|
80
|
+
const idInPendingChanges = customColumnInPending.includes(`${propertyPath}${columnId}`);
|
|
81
|
+
if (idInPendingChanges) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
if (
|
|
85
|
+
isA(MDC_TABLE_TYPE, table) &&
|
|
86
|
+
(table as Table)
|
|
87
|
+
.getColumns()
|
|
88
|
+
.every((col) => !col.getId().endsWith(`CustomColumn::${columnId}`))
|
|
89
|
+
) {
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
return false;
|
|
93
|
+
},
|
|
94
|
+
propertyPath
|
|
95
|
+
},
|
|
96
|
+
{ actionName: this.type, telemetryEventIdentifier: this.getTelemetryIdentifier() }
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
return [];
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function findAnchor(table: UI5Element): string {
|
|
103
|
+
const macroTable = table.getParent();
|
|
104
|
+
let anchor: string = '';
|
|
105
|
+
if (isMacroTable(macroTable)) {
|
|
106
|
+
let metaPath = '';
|
|
107
|
+
if (macroTable.metaPath.includes('LineItem')) {
|
|
108
|
+
metaPath = macroTable.metaPath;
|
|
109
|
+
} else {
|
|
110
|
+
const segments = macroTable.metaPath.split('/');
|
|
111
|
+
segments.pop();
|
|
112
|
+
const path = segments.join('/');
|
|
113
|
+
metaPath = `${path}/${getLineItemAnnotation(macroTable)}`;
|
|
114
|
+
}
|
|
115
|
+
if (!metaPath) {
|
|
116
|
+
return '';
|
|
117
|
+
}
|
|
118
|
+
const columns = macroTable.getModel()?.getMetaModel()?.getObject(metaPath);
|
|
119
|
+
const filteredColumns = columns.filter(
|
|
120
|
+
(col: { $Type: string; Inline?: boolean; SemanticObject?: string; Action?: string }) =>
|
|
121
|
+
[
|
|
122
|
+
'com.sap.vocabularies.UI.v1.DataField',
|
|
123
|
+
'com.sap.vocabularies.UI.v1.DataFieldForIntentBasedNavigation',
|
|
124
|
+
'com.sap.vocabularies.UI.v1.DataFieldForAnnotation'
|
|
125
|
+
].includes(col.$Type) ||
|
|
126
|
+
('com.sap.vocabularies.UI.v1.DataFieldForAction' === col.$Type && col.Inline)
|
|
127
|
+
) as {
|
|
128
|
+
$Type: string;
|
|
129
|
+
Inline?: boolean;
|
|
130
|
+
Value: { $Path: string };
|
|
131
|
+
Action: string;
|
|
132
|
+
SemanticObject?: string;
|
|
133
|
+
Target?: { $AnnotationPath: string };
|
|
134
|
+
}[];
|
|
135
|
+
const lastColumn = filteredColumns.at(-1);
|
|
136
|
+
if (!lastColumn) {
|
|
137
|
+
return '';
|
|
138
|
+
}
|
|
139
|
+
anchor = buildColumnAnchor(lastColumn);
|
|
140
|
+
}
|
|
141
|
+
return anchor;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Builds anchor string for different column types
|
|
146
|
+
* @param column - The column object from metadata
|
|
147
|
+
* @returns The anchor string for the column
|
|
148
|
+
*/
|
|
149
|
+
function buildColumnAnchor(column: {
|
|
150
|
+
$Type: string;
|
|
151
|
+
Value?: { $Path: string };
|
|
152
|
+
Action?: string;
|
|
153
|
+
SemanticObject?: string;
|
|
154
|
+
Target?: { $AnnotationPath: string };
|
|
155
|
+
}): string {
|
|
156
|
+
if (column.$Type === 'com.sap.vocabularies.UI.v1.DataFieldForAction') {
|
|
157
|
+
return `DataFieldForAction::${column.Action}`;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (column.$Type === 'com.sap.vocabularies.UI.v1.DataField') {
|
|
161
|
+
return `DataField::${column.Value?.$Path}`;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (column.$Type === 'com.sap.vocabularies.UI.v1.DataFieldForIntentBasedNavigation') {
|
|
165
|
+
return `DataFieldForIntentBasedNavigation::${column.SemanticObject}::${column.Action}`;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (column.$Type === 'com.sap.vocabularies.UI.v1.DataFieldForAnnotation') {
|
|
169
|
+
const annotationPath = column.Target?.$AnnotationPath;
|
|
170
|
+
if (!annotationPath) {
|
|
171
|
+
return '';
|
|
172
|
+
}
|
|
173
|
+
const annotation = annotationPath.split('.').pop();
|
|
174
|
+
return `DataFieldForAnnotation::${annotation?.split('#').join('::')}`;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return '';
|
|
178
|
+
}
|
|
@@ -55,7 +55,8 @@ sap.ui.define(["../../../utils/fe-v4", "../simple-quick-action-base", "../common
|
|
|
55
55
|
await DialogFactory.createDialog(overlay, this.context.rta, DialogNames.ADD_CUSTOM_FRAGMENT, undefined, {
|
|
56
56
|
propertyPath: 'content/body/sections/',
|
|
57
57
|
title: 'QUICK_ACTION_OP_ADD_CUSTOM_SECTION',
|
|
58
|
-
appDescriptor: this.currentPageDescriptor
|
|
58
|
+
appDescriptor: this.currentPageDescriptor,
|
|
59
|
+
type: 'section'
|
|
59
60
|
}, {
|
|
60
61
|
actionName: this.type,
|
|
61
62
|
telemetryEventIdentifier: this.getTelemetryIdentifier()
|
|
@@ -81,7 +81,8 @@ export class AddCustomSectionQuickAction
|
|
|
81
81
|
{
|
|
82
82
|
propertyPath: 'content/body/sections/',
|
|
83
83
|
title: 'QUICK_ACTION_OP_ADD_CUSTOM_SECTION',
|
|
84
|
-
appDescriptor: this.currentPageDescriptor
|
|
84
|
+
appDescriptor: this.currentPageDescriptor,
|
|
85
|
+
type: 'section'
|
|
85
86
|
},
|
|
86
87
|
{ actionName: this.type, telemetryEventIdentifier: this.getTelemetryIdentifier() }
|
|
87
88
|
);
|
|
@@ -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", "./op-add-custom-section", "./create-
|
|
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", "./op-add-custom-section", "./create-page-action", "./lr-enable-table-filtering", "./lr-enable-semantic-date-range-filter-bar", "./op-enable-empty-row-mode", "../common/add-new-annotation-file", "./enable-variant-management", "../fe-v4/add-new-subpage", "../fe-v4/change-table-actions", "./create-table-action-config-change", "./create-table-custom-column-config-change"], function (_____cpe_quick_actions_registry, ___common_add_controller_to_page, ___lr_toggle_clear_filter_bar, ___change_table_columns, ___common_op_add_header_field, ___op_add_custom_section, ___create_page_action, ___lr_enable_table_filtering, ___lr_enable_semantic_date_range_filter_bar, ___op_enable_empty_row_mode, ___common_add_new_annotation_file, ___enable_variant_management, ___fe_v4_add_new_subpage, ___fe_v4_change_table_actions, ___create_table_action_config_change, ___create_table_custom_column_config_change) {
|
|
4
4
|
"use strict";
|
|
5
5
|
|
|
6
6
|
const QuickActionDefinitionRegistry = _____cpe_quick_actions_registry["QuickActionDefinitionRegistry"];
|
|
@@ -9,7 +9,6 @@ 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 = ___op_add_custom_section["AddCustomSectionQuickAction"];
|
|
12
|
-
const AddTableCustomColumnQuickAction = ___create_table_custom_column["AddTableCustomColumnQuickAction"];
|
|
13
12
|
const AddPageActionQuickAction = ___create_page_action["AddPageActionQuickAction"];
|
|
14
13
|
const EnableTableFilteringQuickAction = ___lr_enable_table_filtering["EnableTableFilteringQuickAction"];
|
|
15
14
|
const ToggleSemanticDateRangeFilterBar = ___lr_enable_semantic_date_range_filter_bar["ToggleSemanticDateRangeFilterBar"];
|
|
@@ -19,6 +18,7 @@ sap.ui.define(["../../../cpe/quick-actions/registry", "../common/add-controller-
|
|
|
19
18
|
const AddNewSubpage = ___fe_v4_add_new_subpage["AddNewSubpage"];
|
|
20
19
|
const ChangeTableActionsQuickAction = ___fe_v4_change_table_actions["ChangeTableActionsQuickAction"];
|
|
21
20
|
const AddTableActionQuickAction = ___create_table_action_config_change["AddTableActionQuickAction"];
|
|
21
|
+
const AddTableCustomColumnQuickAction = ___create_table_custom_column_config_change["AddTableCustomColumnQuickAction"];
|
|
22
22
|
const LIST_REPORT_TYPE = 'sap.fe.templates.ListReport.ListReport';
|
|
23
23
|
const OBJECT_PAGE_TYPE = 'sap.fe.templates.ObjectPage.ObjectPage';
|
|
24
24
|
|
|
@@ -9,7 +9,6 @@ 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 './op-add-custom-section';
|
|
12
|
-
import { AddTableCustomColumnQuickAction } from './create-table-custom-column';
|
|
13
12
|
import { AddPageActionQuickAction } from './create-page-action';
|
|
14
13
|
import { EnableTableFilteringQuickAction } from './lr-enable-table-filtering';
|
|
15
14
|
import { ToggleSemanticDateRangeFilterBar } from './lr-enable-semantic-date-range-filter-bar';
|
|
@@ -19,6 +18,7 @@ import { EnableVariantManagementQuickAction } from './enable-variant-management'
|
|
|
19
18
|
import { AddNewSubpage } from '../fe-v4/add-new-subpage';
|
|
20
19
|
import { ChangeTableActionsQuickAction } from '../fe-v4/change-table-actions';
|
|
21
20
|
import { AddTableActionQuickAction } from './create-table-action-config-change';
|
|
21
|
+
import { AddTableCustomColumnQuickAction } from './create-table-custom-column-config-change';
|
|
22
22
|
|
|
23
23
|
type PageName = 'listReport' | 'objectPage';
|
|
24
24
|
|
|
@@ -4,10 +4,10 @@ sap.ui.define(["../../../utils/core", "sap/ui/rta/command/CommandFactory", "../.
|
|
|
4
4
|
"use strict";
|
|
5
5
|
|
|
6
6
|
const getControlById = _____utils_core["getControlById"];
|
|
7
|
-
const isA = _____utils_core["isA"];
|
|
8
7
|
const getV4AppComponent = _____utils_fe_v4["getV4AppComponent"];
|
|
9
8
|
const getPageName = _____utils_fe_v4["getPageName"];
|
|
10
9
|
const getReference = _____utils_fe_v4["getReference"];
|
|
10
|
+
const isMacroTable = _____utils_fe_v4["isMacroTable"];
|
|
11
11
|
async function executeToggleAction(context, isButtonEnabled, controlType, propertyPath) {
|
|
12
12
|
const controls = context.controlIndex[controlType] ?? [];
|
|
13
13
|
const control = controls[0];
|
|
@@ -65,6 +65,7 @@ sap.ui.define(["../../../utils/core", "sap/ui/rta/command/CommandFactory", "../.
|
|
|
65
65
|
parts.push(PATTERN_SUFFIX);
|
|
66
66
|
return parts.join('');
|
|
67
67
|
}
|
|
68
|
+
|
|
68
69
|
/**
|
|
69
70
|
* Get LineItem annotation - tries to use design-time helper if available, falls back to local implementation.
|
|
70
71
|
*
|
|
@@ -89,18 +90,17 @@ sap.ui.define(["../../../utils/core", "sap/ui/rta/command/CommandFactory", "../.
|
|
|
89
90
|
* @param table - table control
|
|
90
91
|
* @returns string
|
|
91
92
|
*/
|
|
92
|
-
|
|
93
|
-
function getActionsPropertyPath(table) {
|
|
93
|
+
function getPropertyPath(table, property = 'actions') {
|
|
94
94
|
const macroTable = table.getParent();
|
|
95
95
|
const configPath = '';
|
|
96
|
-
if (
|
|
96
|
+
if (isMacroTable(macroTable)) {
|
|
97
97
|
const lineItemAnnotation = getLineItemAnnotation(macroTable);
|
|
98
98
|
const navigationPath = macroTable.metaPath.split(macroTable.getProperty('contextPath'))[1];
|
|
99
99
|
if (!lineItemAnnotation) {
|
|
100
100
|
throw new Error('Line item annotation could not be determined for the table.');
|
|
101
101
|
}
|
|
102
102
|
if (navigationPath) {
|
|
103
|
-
return configPath.concat('controlConfiguration/', navigationPath.split('@')[0], lineItemAnnotation,
|
|
103
|
+
return configPath.concat('controlConfiguration/', navigationPath.split('@')[0], lineItemAnnotation, `/${property}/`);
|
|
104
104
|
} else {
|
|
105
105
|
let contextString = macroTable.metaPath;
|
|
106
106
|
const firstSlash = contextString.indexOf('/');
|
|
@@ -111,7 +111,7 @@ sap.ui.define(["../../../utils/core", "sap/ui/rta/command/CommandFactory", "../.
|
|
|
111
111
|
if (secondSlash >= 0) {
|
|
112
112
|
contextString = contextString.substring(0, secondSlash);
|
|
113
113
|
}
|
|
114
|
-
return configPath.concat('controlConfiguration/', '/', contextString, '/', lineItemAnnotation,
|
|
114
|
+
return configPath.concat('controlConfiguration/', '/', contextString, '/', lineItemAnnotation, `/${property}/`);
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
return undefined;
|
|
@@ -123,22 +123,25 @@ sap.ui.define(["../../../utils/core", "sap/ui/rta/command/CommandFactory", "../.
|
|
|
123
123
|
* @param table - The table control
|
|
124
124
|
* @returns The line item annotation used to define the table
|
|
125
125
|
*/
|
|
126
|
-
function getLineItemAnnotationForTable(
|
|
127
|
-
const presentation = table.getModel()?.getMetaModel()?.getObject(table.metaPath);
|
|
126
|
+
function getLineItemAnnotationForTable(macroTable) {
|
|
128
127
|
let lineItemAnnotation = '';
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
if (presentation.
|
|
136
|
-
lineItemAnnotation = presentation.
|
|
137
|
-
} else {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
128
|
+
if (isMacroTable(macroTable)) {
|
|
129
|
+
const presentation = macroTable.getModel()?.getMetaModel()?.getObject(macroTable.metaPath);
|
|
130
|
+
|
|
131
|
+
// default line item annotation
|
|
132
|
+
if (!presentation.Visualizations && !presentation.PresentationVariant) {
|
|
133
|
+
lineItemAnnotation = macroTable.metaPath.split('/').pop();
|
|
134
|
+
} else if (presentation.Visualizations) {
|
|
135
|
+
lineItemAnnotation = presentation.Visualizations[0].$AnnotationPath;
|
|
136
|
+
} else if (presentation.PresentationVariant) {
|
|
137
|
+
if (presentation.PresentationVariant.Visualizations) {
|
|
138
|
+
lineItemAnnotation = presentation.PresentationVariant.Visualizations[0].$AnnotationPath;
|
|
139
|
+
} else {
|
|
140
|
+
const contextPath = macroTable.metaPath.startsWith('/') ? macroTable.metaPath.split('@')[0] : macroTable.contextPath;
|
|
141
|
+
const pathForLineItems = contextPath + presentation.PresentationVariant.$Path;
|
|
142
|
+
const presentationVariantType = macroTable.getModel()?.getMetaModel()?.getObject(pathForLineItems);
|
|
143
|
+
lineItemAnnotation = presentationVariantType.Visualizations[0].$AnnotationPath;
|
|
144
|
+
}
|
|
142
145
|
}
|
|
143
146
|
}
|
|
144
147
|
return lineItemAnnotation;
|
|
@@ -148,7 +151,8 @@ sap.ui.define(["../../../utils/core", "sap/ui/rta/command/CommandFactory", "../.
|
|
|
148
151
|
};
|
|
149
152
|
__exports.executeToggleAction = executeToggleAction;
|
|
150
153
|
__exports.generateRoutePattern = generateRoutePattern;
|
|
151
|
-
__exports.
|
|
154
|
+
__exports.getLineItemAnnotation = getLineItemAnnotation;
|
|
155
|
+
__exports.getPropertyPath = getPropertyPath;
|
|
152
156
|
return __exports;
|
|
153
157
|
});
|
|
154
158
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { getControlById
|
|
1
|
+
import { getControlById } from '../../../utils/core';
|
|
2
2
|
import type FlexCommand from 'sap/ui/rta/command/FlexCommand';
|
|
3
3
|
import type { QuickActionContext } from '../../../cpe/quick-actions/quick-action-definition';
|
|
4
4
|
import CommandFactory from 'sap/ui/rta/command/CommandFactory';
|
|
5
|
-
import { getV4AppComponent, getPageName, getReference } from '../../../utils/fe-v4';
|
|
6
|
-
import TableAPI from 'sap/fe/macros/table/TableAPI';
|
|
5
|
+
import { getV4AppComponent, getPageName, getReference, isMacroTable } from '../../../utils/fe-v4';
|
|
7
6
|
import UI5Element from 'sap/ui/core/Element';
|
|
8
7
|
|
|
9
8
|
export async function executeToggleAction(
|
|
@@ -79,18 +78,13 @@ export function generateRoutePattern(sourceRoutePattern: string, navProperty: st
|
|
|
79
78
|
return parts.join('');
|
|
80
79
|
}
|
|
81
80
|
|
|
82
|
-
export type MacroTable = TableAPI & {
|
|
83
|
-
metaPath: string;
|
|
84
|
-
contextPath: string;
|
|
85
|
-
};
|
|
86
|
-
|
|
87
81
|
/**
|
|
88
82
|
* Get LineItem annotation - tries to use design-time helper if available, falls back to local implementation.
|
|
89
83
|
*
|
|
90
84
|
* @param table - table control
|
|
91
85
|
* @returns LineItem annotation string
|
|
92
86
|
*/
|
|
93
|
-
function getLineItemAnnotation(table:
|
|
87
|
+
export function getLineItemAnnotation(table: UI5Element): string | undefined {
|
|
94
88
|
try {
|
|
95
89
|
const helper = sap.ui.require('sap/fe/macros/table/designtime/Table.designtime.helper');
|
|
96
90
|
if (helper && typeof helper.getLineItemAnnotation === 'function') {
|
|
@@ -108,15 +102,10 @@ function getLineItemAnnotation(table: MacroTable): string | undefined {
|
|
|
108
102
|
* @param table - table control
|
|
109
103
|
* @returns string
|
|
110
104
|
*/
|
|
111
|
-
|
|
112
|
-
export function getActionsPropertyPath(table: UI5Element): string | undefined {
|
|
105
|
+
export function getPropertyPath(table: UI5Element, property: 'actions' | 'columns' = 'actions'): string | undefined {
|
|
113
106
|
const macroTable = table.getParent();
|
|
114
107
|
const configPath = '';
|
|
115
|
-
if (
|
|
116
|
-
macroTable &&
|
|
117
|
-
(isA<MacroTable>('sap.fe.macros.Table', macroTable) ||
|
|
118
|
-
isA<MacroTable>('sap.fe.macros.table.TableAPI', macroTable))
|
|
119
|
-
) {
|
|
108
|
+
if (isMacroTable(macroTable)) {
|
|
120
109
|
const lineItemAnnotation = getLineItemAnnotation(macroTable);
|
|
121
110
|
|
|
122
111
|
const navigationPath = macroTable.metaPath.split(macroTable.getProperty('contextPath'))[1];
|
|
@@ -128,7 +117,7 @@ export function getActionsPropertyPath(table: UI5Element): string | undefined {
|
|
|
128
117
|
'controlConfiguration/',
|
|
129
118
|
navigationPath.split('@')[0],
|
|
130
119
|
lineItemAnnotation,
|
|
131
|
-
|
|
120
|
+
`/${property}/`
|
|
132
121
|
);
|
|
133
122
|
} else {
|
|
134
123
|
let contextString = macroTable.metaPath;
|
|
@@ -140,7 +129,14 @@ export function getActionsPropertyPath(table: UI5Element): string | undefined {
|
|
|
140
129
|
if (secondSlash >= 0) {
|
|
141
130
|
contextString = contextString.substring(0, secondSlash);
|
|
142
131
|
}
|
|
143
|
-
return configPath.concat(
|
|
132
|
+
return configPath.concat(
|
|
133
|
+
'controlConfiguration/',
|
|
134
|
+
'/',
|
|
135
|
+
contextString,
|
|
136
|
+
'/',
|
|
137
|
+
lineItemAnnotation,
|
|
138
|
+
`/${property}/`
|
|
139
|
+
);
|
|
144
140
|
}
|
|
145
141
|
}
|
|
146
142
|
return undefined;
|
|
@@ -152,23 +148,27 @@ export function getActionsPropertyPath(table: UI5Element): string | undefined {
|
|
|
152
148
|
* @param table - The table control
|
|
153
149
|
* @returns The line item annotation used to define the table
|
|
154
150
|
*/
|
|
155
|
-
function getLineItemAnnotationForTable(
|
|
156
|
-
const presentation = table.getModel()?.getMetaModel()?.getObject(table.metaPath);
|
|
157
|
-
|
|
151
|
+
function getLineItemAnnotationForTable(macroTable: UI5Element): string | undefined {
|
|
158
152
|
let lineItemAnnotation: string | undefined = '';
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
if (presentation.
|
|
166
|
-
lineItemAnnotation = presentation.
|
|
167
|
-
} else {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
153
|
+
if (isMacroTable(macroTable)) {
|
|
154
|
+
const presentation = macroTable.getModel()?.getMetaModel()?.getObject(macroTable.metaPath);
|
|
155
|
+
|
|
156
|
+
// default line item annotation
|
|
157
|
+
if (!presentation.Visualizations && !presentation.PresentationVariant) {
|
|
158
|
+
lineItemAnnotation = macroTable.metaPath.split('/').pop();
|
|
159
|
+
} else if (presentation.Visualizations) {
|
|
160
|
+
lineItemAnnotation = presentation.Visualizations[0].$AnnotationPath;
|
|
161
|
+
} else if (presentation.PresentationVariant) {
|
|
162
|
+
if (presentation.PresentationVariant.Visualizations) {
|
|
163
|
+
lineItemAnnotation = presentation.PresentationVariant.Visualizations[0].$AnnotationPath;
|
|
164
|
+
} else {
|
|
165
|
+
const contextPath = macroTable.metaPath.startsWith('/')
|
|
166
|
+
? macroTable.metaPath.split('@')[0]
|
|
167
|
+
: macroTable.contextPath;
|
|
168
|
+
const pathForLineItems = contextPath + presentation.PresentationVariant.$Path;
|
|
169
|
+
const presentationVariantType = macroTable.getModel()?.getMetaModel()?.getObject(pathForLineItems);
|
|
170
|
+
lineItemAnnotation = presentationVariantType.Visualizations[0].$AnnotationPath;
|
|
171
|
+
}
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
return lineItemAnnotation;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
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) {
|
|
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", "../../utils/fe-v4"], 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, ____utils_fe_v4) {
|
|
4
4
|
"use strict";
|
|
5
5
|
|
|
6
6
|
const NESTED_QUICK_ACTION_KIND = ___sap_ux_private_control_property_editor_common["NESTED_QUICK_ACTION_KIND"];
|
|
@@ -19,6 +19,7 @@ sap.ui.define(["open/ux/preview/client/thirdparty/@sap-ux-private/control-proper
|
|
|
19
19
|
const SMART_TABLE_TYPE = ___control_types["SMART_TABLE_TYPE"];
|
|
20
20
|
const TREE_TABLE_TYPE = ___control_types["TREE_TABLE_TYPE"];
|
|
21
21
|
const isVariantManagementEnabledOPPage = ___fe_v2_utils["isVariantManagementEnabledOPPage"];
|
|
22
|
+
const isMacroTable = ____utils_fe_v4["isMacroTable"];
|
|
22
23
|
const SMART_TABLE_ACTION_ID = 'CTX_COMP_VARIANT_CONTENT';
|
|
23
24
|
const M_TABLE_ACTION_ID = 'CTX_ADD_ELEMENTS_AS_CHILD';
|
|
24
25
|
const SETTINGS_ID = 'CTX_SETTINGS';
|
|
@@ -89,6 +90,34 @@ sap.ui.define(["open/ux/preview/client/thirdparty/@sap-ux-private/control-proper
|
|
|
89
90
|
}
|
|
90
91
|
}
|
|
91
92
|
|
|
93
|
+
/**
|
|
94
|
+
* Builds a map of custom tab keys to their associated table building blocks.
|
|
95
|
+
*
|
|
96
|
+
* @param iconTabBarFilterMap - A map of icon tab bar filter keys to their labels.
|
|
97
|
+
* @returns A map where each key is a combination of contextPath and metaPath, and the value is the corresponding custom tab key.
|
|
98
|
+
*/
|
|
99
|
+
getCustomViewTableBuildingBlocksMap(iconTabBarFilterMap) {
|
|
100
|
+
const customTabTableBuildingBlockMap = {};
|
|
101
|
+
const customTabs = Object.keys(iconTabBarFilterMap).filter(key => /^fe::CustomTab::\d+$/.test(key));
|
|
102
|
+
for (const key of customTabs) {
|
|
103
|
+
const items = this.iconTabBar?.getItems() ?? [];
|
|
104
|
+
const filterItem = items.find(item => isA('sap.m.IconTabFilter', item) && item.getKey() === key);
|
|
105
|
+
if (filterItem && isA('sap.m.IconTabFilter', filterItem)) {
|
|
106
|
+
filterItem.getContent().forEach(content => {
|
|
107
|
+
if (isMacroTable(content)) {
|
|
108
|
+
const {
|
|
109
|
+
metaPath,
|
|
110
|
+
contextPath
|
|
111
|
+
} = content;
|
|
112
|
+
const path = metaPath.startsWith(contextPath) ? metaPath : `${contextPath}${metaPath}`;
|
|
113
|
+
customTabTableBuildingBlockMap[path] = key;
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return customTabTableBuildingBlockMap;
|
|
119
|
+
}
|
|
120
|
+
|
|
92
121
|
/**
|
|
93
122
|
* Initializes action object instance
|
|
94
123
|
*/
|
|
@@ -102,16 +131,17 @@ sap.ui.define(["open/ux/preview/client/thirdparty/@sap-ux-private/control-proper
|
|
|
102
131
|
this.isApplicable = false;
|
|
103
132
|
return;
|
|
104
133
|
}
|
|
105
|
-
const
|
|
134
|
+
const iconTabBarFilterMap = this.buildIconTabBarFilterMap();
|
|
135
|
+
const customViewTableBuildingBlockMap = this.getCustomViewTableBuildingBlocksMap(iconTabBarFilterMap);
|
|
106
136
|
for (const table of getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, this.controlTypes)) {
|
|
107
|
-
const tabKey = Object.keys(
|
|
137
|
+
const tabKey = Object.keys(iconTabBarFilterMap).find(key => table.getId().endsWith(key));
|
|
108
138
|
const section = getParentContainer(table, 'sap.uxap.ObjectPageSection');
|
|
109
139
|
if (section) {
|
|
110
140
|
await this.collectChildrenInSection(section, table);
|
|
111
141
|
} else if (this.iconTabBar && tabKey) {
|
|
112
|
-
const label = `'${
|
|
142
|
+
const label = `'${iconTabBarFilterMap[tabKey]}' table`;
|
|
113
143
|
const tableMapKey = this.children.length.toString();
|
|
114
|
-
const child = this.createChild(label, table, tableMapKey);
|
|
144
|
+
const child = this.createChild(label, table, tableMapKey, customViewTableBuildingBlockMap);
|
|
115
145
|
this.children.push(child);
|
|
116
146
|
this.tableMap[tableMapKey] = {
|
|
117
147
|
table,
|
|
@@ -292,13 +322,27 @@ sap.ui.define(["open/ux/preview/client/thirdparty/@sap-ux-private/control-proper
|
|
|
292
322
|
children: this.children
|
|
293
323
|
};
|
|
294
324
|
}
|
|
295
|
-
createChild(label, table, path) {
|
|
325
|
+
createChild(label, table, path, customViewTableBuildingBlockMap) {
|
|
296
326
|
const child = {
|
|
297
327
|
path,
|
|
298
328
|
label,
|
|
299
329
|
enabled: true,
|
|
300
330
|
children: []
|
|
301
331
|
};
|
|
332
|
+
const parent = table.getParent();
|
|
333
|
+
const macroTable = isMacroTable(parent) ? parent : undefined;
|
|
334
|
+
if (this.options.validateTableColumns && macroTable) {
|
|
335
|
+
const {
|
|
336
|
+
metaPath,
|
|
337
|
+
contextPath
|
|
338
|
+
} = macroTable;
|
|
339
|
+
const finalPath = metaPath.startsWith(contextPath) ? metaPath : `${contextPath}${metaPath}`;
|
|
340
|
+
if (customViewTableBuildingBlockMap?.[finalPath]) {
|
|
341
|
+
child.enabled = false;
|
|
342
|
+
child.tooltip = this.context.resourceBundle.getText('CUSTOM_COLUMNS_NOT_SUPPORTED');
|
|
343
|
+
return child;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
302
346
|
if (this.options.validatePageVariantManagement) {
|
|
303
347
|
const variantEnabledV2 = isVariantManagementEnabledOPPage(this.context, table);
|
|
304
348
|
if (variantEnabledV2 === false) {
|