@sap-ux/preview-middleware 0.16.131 → 0.16.133
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/quick-actions/fe-v2/change-table-columns.js +3 -1
- package/dist/client/adp/quick-actions/fe-v2/change-table-columns.ts +3 -1
- package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +3 -1
- package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.ts +3 -1
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.js +11 -48
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.ts +16 -44
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-table-filtering.js +69 -0
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-table-filtering.ts +79 -0
- package/dist/client/adp/quick-actions/fe-v2/registry.js +3 -2
- package/dist/client/adp/quick-actions/fe-v2/registry.ts +3 -1
- package/dist/client/adp/quick-actions/fe-v2/utils.js +77 -0
- package/dist/client/adp/quick-actions/fe-v2/utils.ts +72 -0
- package/dist/client/adp/quick-actions/fe-v4/lr-enable-semantic-date-range-filter-bar.js +1 -5
- package/dist/client/adp/quick-actions/fe-v4/lr-enable-semantic-date-range-filter-bar.ts +0 -4
- package/dist/client/adp/quick-actions/fe-v4/lr-enable-table-filtering.js +84 -0
- package/dist/client/adp/quick-actions/fe-v4/lr-enable-table-filtering.ts +96 -0
- package/dist/client/adp/quick-actions/fe-v4/registry.js +3 -2
- package/dist/client/adp/quick-actions/fe-v4/registry.ts +3 -1
- package/dist/client/adp/quick-actions/fe-v4/table-quick-action-base.js +9 -3
- package/dist/client/adp/quick-actions/fe-v4/table-quick-action-base.ts +10 -3
- package/dist/client/adp/quick-actions/simple-quick-action-base.js +6 -2
- package/dist/client/adp/quick-actions/simple-quick-action-base.ts +9 -2
- package/dist/client/adp/quick-actions/table-quick-action-base.js +57 -23
- package/dist/client/adp/quick-actions/table-quick-action-base.ts +73 -25
- package/dist/client/cpe/changes/flex-change.js +7 -19
- package/dist/client/cpe/changes/flex-change.ts +5 -29
- package/dist/client/cpe/quick-actions/quick-action-definition.ts +1 -6
- package/dist/client/cpe/quick-actions/quick-action-service.js +1 -1
- package/dist/client/cpe/quick-actions/quick-action-service.ts +1 -1
- package/dist/client/messagebundle.properties +4 -1
- package/dist/client/utils/fe-v4.js +30 -1
- package/dist/client/utils/fe-v4.ts +45 -1
- package/package.json +4 -4
|
@@ -14,6 +14,7 @@ import { getUi5Version, isLowerThanMinimalUi5Version } from '../../utils/version
|
|
|
14
14
|
import ObjectPageSection from 'sap/uxap/ObjectPageSection';
|
|
15
15
|
import ObjectPageSubSection from 'sap/uxap/ObjectPageSubSection';
|
|
16
16
|
import ObjectPageLayout from 'sap/uxap/ObjectPageLayout';
|
|
17
|
+
import ManagedObject from 'sap/ui/base/ManagedObject';
|
|
17
18
|
|
|
18
19
|
const SMART_TABLE_ACTION_ID = 'CTX_COMP_VARIANT_CONTENT';
|
|
19
20
|
const M_TABLE_ACTION_ID = 'CTX_ADD_ELEMENTS_AS_CHILD';
|
|
@@ -39,6 +40,10 @@ async function getActionId(table: UI5Element): Promise<string[]> {
|
|
|
39
40
|
|
|
40
41
|
return [M_TABLE_ACTION_ID, SETTINGS_ID];
|
|
41
42
|
}
|
|
43
|
+
export type TableQuickActionsOptions = {
|
|
44
|
+
includeServiceAction?: boolean;
|
|
45
|
+
areTableRowsRequired?: boolean;
|
|
46
|
+
};
|
|
42
47
|
|
|
43
48
|
/**
|
|
44
49
|
* Base class for table quick actions.
|
|
@@ -49,7 +54,13 @@ export abstract class TableQuickActionDefinitionBase {
|
|
|
49
54
|
return `${this.context.key}-${this.type}`;
|
|
50
55
|
}
|
|
51
56
|
|
|
52
|
-
public
|
|
57
|
+
public isApplicable = false;
|
|
58
|
+
|
|
59
|
+
protected isDisabled: boolean | undefined;
|
|
60
|
+
|
|
61
|
+
public get tooltip(): string | undefined {
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
53
64
|
|
|
54
65
|
public children: NestedQuickActionChild[] = [];
|
|
55
66
|
public tableMap: Record<
|
|
@@ -79,7 +90,7 @@ export abstract class TableQuickActionDefinitionBase {
|
|
|
79
90
|
protected readonly controlTypes: string[],
|
|
80
91
|
protected readonly defaultTextKey: string,
|
|
81
92
|
protected readonly context: QuickActionContext,
|
|
82
|
-
protected
|
|
93
|
+
protected options: TableQuickActionsOptions = {}
|
|
83
94
|
) {}
|
|
84
95
|
|
|
85
96
|
/**
|
|
@@ -89,7 +100,7 @@ export abstract class TableQuickActionDefinitionBase {
|
|
|
89
100
|
// No action found in control design time for version < 1.96
|
|
90
101
|
const version = await getUi5Version();
|
|
91
102
|
if (isLowerThanMinimalUi5Version(version, { major: 1, minor: 96 })) {
|
|
92
|
-
this.
|
|
103
|
+
this.isApplicable = false;
|
|
93
104
|
return;
|
|
94
105
|
}
|
|
95
106
|
const iconTabBarfilterMap = this.buildIconTabBarFilterMap();
|
|
@@ -103,10 +114,9 @@ export abstract class TableQuickActionDefinitionBase {
|
|
|
103
114
|
if (section) {
|
|
104
115
|
this.collectChildrenInSection(section, table);
|
|
105
116
|
} else if (this.iconTabBar && tabKey) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
});
|
|
117
|
+
const label = `'${iconTabBarfilterMap[tabKey]}' table`;
|
|
118
|
+
const child = this.createChild(label, table);
|
|
119
|
+
this.children.push(child);
|
|
110
120
|
this.tableMap[`${this.children.length - 1}`] = {
|
|
111
121
|
table,
|
|
112
122
|
iconTabBarFilterKey: tabKey,
|
|
@@ -117,7 +127,7 @@ export abstract class TableQuickActionDefinitionBase {
|
|
|
117
127
|
}
|
|
118
128
|
|
|
119
129
|
// add action id to the table map, if the service actions are needed.
|
|
120
|
-
if (this.includeServiceAction) {
|
|
130
|
+
if (this.options.includeServiceAction) {
|
|
121
131
|
const actions = await this.context.actionService.get(table.getId());
|
|
122
132
|
const actionsIds = await getActionId(table);
|
|
123
133
|
|
|
@@ -131,7 +141,31 @@ export abstract class TableQuickActionDefinitionBase {
|
|
|
131
141
|
}
|
|
132
142
|
}
|
|
133
143
|
if (this.children.length > 0) {
|
|
134
|
-
this.
|
|
144
|
+
this.isApplicable = true;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Retrieves the internal table control from a UI5Element.
|
|
150
|
+
*
|
|
151
|
+
* @param table - The UI5Element instance to analyze.
|
|
152
|
+
* @returns The internal table otherwise undefined.
|
|
153
|
+
*/
|
|
154
|
+
protected getInternalTable(table: UI5Element): UI5Element | undefined {
|
|
155
|
+
try {
|
|
156
|
+
let tableInternal: ManagedObject | undefined;
|
|
157
|
+
|
|
158
|
+
if (isA<SmartTable>(SMART_TABLE_TYPE, table)) {
|
|
159
|
+
const itemsAggregation = table.getAggregation('items') as ManagedObject[];
|
|
160
|
+
tableInternal = itemsAggregation.find((item) =>
|
|
161
|
+
[M_TABLE_TYPE, TREE_TABLE_TYPE, ANALYTICAL_TABLE_TYPE, GRID_TABLE_TYPE].some((tType) =>
|
|
162
|
+
isA(tType, item)
|
|
163
|
+
)
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
return tableInternal as UI5Element | undefined;
|
|
167
|
+
} catch (error) {
|
|
168
|
+
return undefined;
|
|
135
169
|
}
|
|
136
170
|
}
|
|
137
171
|
|
|
@@ -160,7 +194,7 @@ export abstract class TableQuickActionDefinitionBase {
|
|
|
160
194
|
* Builds a map kay/tab_name for ICON_TAB_BAR control of the active page, if such exists
|
|
161
195
|
* @returns built map
|
|
162
196
|
*/
|
|
163
|
-
|
|
197
|
+
protected buildIconTabBarFilterMap(): { [key: string]: string } {
|
|
164
198
|
const iconTabBarFilterMap: { [key: string]: string } = {};
|
|
165
199
|
|
|
166
200
|
// Assumption only a tab bar control per page.
|
|
@@ -197,23 +231,19 @@ export abstract class TableQuickActionDefinitionBase {
|
|
|
197
231
|
} else if (subSections.length > 1) {
|
|
198
232
|
const sectionChild = this.children.find((val) => val.label === `${section.getTitle()} section`);
|
|
199
233
|
let tableMapIndex = `${this.children.length - 1}`;
|
|
234
|
+
const label = this.getTableLabel(table);
|
|
235
|
+
const child = this.createChild(label, table);
|
|
200
236
|
if (!sectionChild) {
|
|
201
237
|
tableMapIndex = `${tableMapIndex}/0`;
|
|
238
|
+
|
|
202
239
|
this.children.push({
|
|
203
240
|
label: `'${section?.getTitle()}' section`,
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
label: this.getTableLabel(table),
|
|
207
|
-
children: []
|
|
208
|
-
}
|
|
209
|
-
]
|
|
241
|
+
enabled: true,
|
|
242
|
+
children: [child]
|
|
210
243
|
});
|
|
211
244
|
} else {
|
|
212
245
|
tableMapIndex = `${tableMapIndex}/${sectionChild.children.length - 1}`;
|
|
213
|
-
sectionChild.children.push(
|
|
214
|
-
label: this.getTableLabel(table),
|
|
215
|
-
children: []
|
|
216
|
-
});
|
|
246
|
+
sectionChild.children.push(child);
|
|
217
247
|
}
|
|
218
248
|
|
|
219
249
|
this.tableMap[tableMapIndex] = {
|
|
@@ -235,10 +265,9 @@ export abstract class TableQuickActionDefinitionBase {
|
|
|
235
265
|
sectionInfo?: { section: ObjectPageSection; subSection: ObjectPageSubSection; layout?: ObjectPageLayout }
|
|
236
266
|
): void {
|
|
237
267
|
if ([SMART_TABLE_TYPE, M_TABLE_TYPE, MDC_TABLE_TYPE, TREE_TABLE_TYPE].some((type) => isA(type, table))) {
|
|
238
|
-
this.
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
});
|
|
268
|
+
const label = this.getTableLabel(table);
|
|
269
|
+
const child = this.createChild(label, table);
|
|
270
|
+
this.children.push(child);
|
|
242
271
|
}
|
|
243
272
|
|
|
244
273
|
this.tableMap[`${this.children.length - 1}`] = {
|
|
@@ -267,9 +296,28 @@ export abstract class TableQuickActionDefinitionBase {
|
|
|
267
296
|
return {
|
|
268
297
|
kind: NESTED_QUICK_ACTION_KIND,
|
|
269
298
|
id: this.id,
|
|
270
|
-
enabled: this.
|
|
299
|
+
enabled: !this.isDisabled,
|
|
300
|
+
tooltip: this.tooltip,
|
|
271
301
|
title: this.context.resourceBundle.getText(this.textKey),
|
|
272
302
|
children: this.children
|
|
273
303
|
};
|
|
274
304
|
}
|
|
305
|
+
|
|
306
|
+
createChild(label: string, table: UI5Element): NestedQuickActionChild {
|
|
307
|
+
const child: NestedQuickActionChild = {
|
|
308
|
+
label,
|
|
309
|
+
enabled: true,
|
|
310
|
+
children: []
|
|
311
|
+
};
|
|
312
|
+
if (!this.options.areTableRowsRequired) {
|
|
313
|
+
return child;
|
|
314
|
+
}
|
|
315
|
+
const innerTable = this.getInternalTable(table);
|
|
316
|
+
const tableRows = (innerTable?.getAggregation('items') as ManagedObject[]) || [];
|
|
317
|
+
if (isA(M_TABLE_TYPE, innerTable) && !tableRows.length) {
|
|
318
|
+
child.enabled = false;
|
|
319
|
+
child.tooltip = this.context.resourceBundle.getText('TABLE_CUSTOM_COLUMN_ACTION_NOT_AVAILABLE');
|
|
320
|
+
}
|
|
321
|
+
return child;
|
|
322
|
+
}
|
|
275
323
|
}
|
|
@@ -3,14 +3,12 @@ sap.ui.define([
|
|
|
3
3
|
'sap/ui/rta/command/CommandFactory',
|
|
4
4
|
'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
|
|
5
5
|
'./validator',
|
|
6
|
-
'../../utils/fe-v4'
|
|
7
|
-
|
|
8
|
-
], function (CommandFactory, ___sap_ux_private_control_property_editor_common, ___validator, ____utils_fe_v4, ___utils) {
|
|
6
|
+
'../../utils/fe-v4'
|
|
7
|
+
], function (CommandFactory, ___sap_ux_private_control_property_editor_common, ___validator, ____utils_fe_v4) {
|
|
9
8
|
'use strict';
|
|
10
9
|
const PropertyType = ___sap_ux_private_control_property_editor_common['PropertyType'];
|
|
11
10
|
const validateBindingModel = ___validator['validateBindingModel'];
|
|
12
|
-
const
|
|
13
|
-
const getOverlay = ___utils['getOverlay'];
|
|
11
|
+
const createManifestPropertyChange = ____utils_fe_v4['createManifestPropertyChange'];
|
|
14
12
|
function isBindingExpression(value) {
|
|
15
13
|
return value.includes('{') && value.includes('}') && value.indexOf('{') < value.indexOf('}');
|
|
16
14
|
}
|
|
@@ -38,22 +36,12 @@ sap.ui.define([
|
|
|
38
36
|
const command = await CommandFactory.getCommandFor(modifiedControl, changeType, modifiedValue, null, flexSettings);
|
|
39
37
|
await rta.getCommandStack().pushAndExecute(command);
|
|
40
38
|
} else if (change.propertyType === PropertyType.Configuration) {
|
|
41
|
-
const
|
|
42
|
-
if (
|
|
39
|
+
const command = await createManifestPropertyChange(modifiedControl, flexSettings, { [change.propertyName]: change.value });
|
|
40
|
+
if (command) {
|
|
41
|
+
await rta.getCommandStack().pushAndExecute(command);
|
|
42
|
+
} else {
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
|
-
const overlayData = overlay?.getDesignTimeMetadata().getData();
|
|
46
|
-
const manifestPropertyPath = overlayData.manifestPropertyPath(modifiedControl);
|
|
47
|
-
const [manifestPropertyChange] = overlayData.manifestPropertyChange({ [change.propertyName]: change.value }, manifestPropertyPath, modifiedControl);
|
|
48
|
-
const modifiedValue = {
|
|
49
|
-
reference: getReference(modifiedControl),
|
|
50
|
-
appComponent: manifestPropertyChange.appComponent,
|
|
51
|
-
changeType: manifestPropertyChange.changeSpecificData.appDescriptorChangeType,
|
|
52
|
-
parameters: manifestPropertyChange.changeSpecificData.content.parameters,
|
|
53
|
-
selector: manifestPropertyChange.selector
|
|
54
|
-
};
|
|
55
|
-
const command = await CommandFactory.getCommandFor(modifiedControl, 'appDescriptor', modifiedValue, null, flexSettings);
|
|
56
|
-
await rta.getCommandStack().pushAndExecute(command);
|
|
57
45
|
}
|
|
58
46
|
}
|
|
59
47
|
var __exports = { __esModule: true };
|
|
@@ -3,9 +3,7 @@ import CommandFactory from 'sap/ui/rta/command/CommandFactory';
|
|
|
3
3
|
import { PropertyType, type PropertyChange } from '@sap-ux-private/control-property-editor-common';
|
|
4
4
|
import type { UI5AdaptationOptions } from '../types';
|
|
5
5
|
import { validateBindingModel } from './validator';
|
|
6
|
-
import {
|
|
7
|
-
import { getOverlay } from '../utils';
|
|
8
|
-
|
|
6
|
+
import { createManifestPropertyChange } from '../../utils/fe-v4';
|
|
9
7
|
/**
|
|
10
8
|
* Function to check a give value is a binding expression.
|
|
11
9
|
*
|
|
@@ -56,33 +54,11 @@ export async function applyChange(options: UI5AdaptationOptions, change: Propert
|
|
|
56
54
|
);
|
|
57
55
|
await rta.getCommandStack().pushAndExecute(command);
|
|
58
56
|
} else if (change.propertyType === PropertyType.Configuration) {
|
|
59
|
-
const
|
|
60
|
-
if (
|
|
57
|
+
const command = await createManifestPropertyChange(modifiedControl, flexSettings, { [change.propertyName]: change.value });
|
|
58
|
+
if (command) {
|
|
59
|
+
await rta.getCommandStack().pushAndExecute(command);
|
|
60
|
+
} else {
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
|
-
const overlayData = overlay?.getDesignTimeMetadata().getData();
|
|
64
|
-
const manifestPropertyPath = overlayData.manifestPropertyPath(modifiedControl);
|
|
65
|
-
const [manifestPropertyChange] = overlayData.manifestPropertyChange(
|
|
66
|
-
{ [change.propertyName]: change.value },
|
|
67
|
-
manifestPropertyPath,
|
|
68
|
-
modifiedControl
|
|
69
|
-
);
|
|
70
|
-
|
|
71
|
-
const modifiedValue = {
|
|
72
|
-
reference: getReference(modifiedControl),
|
|
73
|
-
appComponent: manifestPropertyChange.appComponent,
|
|
74
|
-
changeType: manifestPropertyChange.changeSpecificData.appDescriptorChangeType,
|
|
75
|
-
parameters: manifestPropertyChange.changeSpecificData.content.parameters,
|
|
76
|
-
selector: manifestPropertyChange.selector
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
const command = await CommandFactory.getCommandFor(
|
|
80
|
-
modifiedControl,
|
|
81
|
-
'appDescriptor',
|
|
82
|
-
modifiedValue,
|
|
83
|
-
null,
|
|
84
|
-
flexSettings
|
|
85
|
-
);
|
|
86
|
-
await rta.getCommandStack().pushAndExecute(command);
|
|
87
63
|
}
|
|
88
64
|
}
|
|
@@ -42,11 +42,6 @@ export interface QuickActionContext {
|
|
|
42
42
|
changeService: ChangeService;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
export type QuickActionActivationData = {
|
|
46
|
-
isActive: boolean;
|
|
47
|
-
title: string;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
45
|
interface QuickActionDefinitionBase {
|
|
51
46
|
/**
|
|
52
47
|
* Used to identify between different Quick Action definitions.
|
|
@@ -65,7 +60,7 @@ interface QuickActionDefinitionBase {
|
|
|
65
60
|
/**
|
|
66
61
|
* Indicates that the Quick Action is applicable to the given context and should be displayed.
|
|
67
62
|
*/
|
|
68
|
-
|
|
63
|
+
isApplicable: boolean;
|
|
69
64
|
/**
|
|
70
65
|
* Initializes the action and checks if it should be enabled in current context.
|
|
71
66
|
*/
|
|
@@ -85,7 +85,7 @@ sap.ui.define([
|
|
|
85
85
|
this.sendAction(quickActionListChanged(groups));
|
|
86
86
|
}
|
|
87
87
|
addAction(group, instance) {
|
|
88
|
-
if (instance.
|
|
88
|
+
if (instance.isApplicable) {
|
|
89
89
|
const quickAction = instance.getActionObject();
|
|
90
90
|
group.actions.push(quickAction);
|
|
91
91
|
this.actions.push(instance);
|
|
@@ -132,7 +132,7 @@ export class QuickActionService implements Service {
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
private addAction(group: QuickActionGroup, instance: QuickActionDefinition): void {
|
|
135
|
-
if (instance.
|
|
135
|
+
if (instance.isApplicable) {
|
|
136
136
|
const quickAction = instance.getActionObject();
|
|
137
137
|
group.actions.push(quickAction);
|
|
138
138
|
this.actions.push(instance);
|
|
@@ -5,6 +5,7 @@ QUICK_ACTION_OP_ADD_CUSTOM_SECTION=Add Custom Section
|
|
|
5
5
|
QUICK_ACTION_ADD_CUSTOM_PAGE_ACTION=Add Custom Page Action
|
|
6
6
|
QUICK_ACTION_ADD_CUSTOM_TABLE_ACTION=Add Custom Table Action
|
|
7
7
|
QUICK_ACTION_ADD_CUSTOM_TABLE_COLUMN=Add Custom Table Column
|
|
8
|
+
QUICK_ACTION_ENABLE_TABLE_FILTERING=Enable Table Filtering for Page Variants
|
|
8
9
|
|
|
9
10
|
V2_QUICK_ACTION_CHANGE_TABLE_COLUMNS=Change Table Columns
|
|
10
11
|
|
|
@@ -14,7 +15,6 @@ V2_QUICK_ACTION_LR_DISABLE_CLEAR_FILTER_BAR=Disable "Clear" Button in Filter Bar
|
|
|
14
15
|
QUICK_ACTION_LR_ENABLE_SEMANTIC_DATE_RANGE_FILTER_BAR=Enable Semantic Date Range in Filter Bar
|
|
15
16
|
QUICK_ACTION_LR_DISABLE_SEMANTIC_DATE_RANGE_FILTER_BAR=Disable Semantic Date Range in Filter Bar
|
|
16
17
|
|
|
17
|
-
|
|
18
18
|
V4_QUICK_ACTION_CHANGE_TABLE_COLUMNS=Change Table Columns
|
|
19
19
|
|
|
20
20
|
V4_QUICK_ACTION_LR_ENABLE_CLEAR_FILTER_BAR=Enable "Clear" Button in Filter Bar
|
|
@@ -38,3 +38,6 @@ CPE_CHANGES_VISIBLE_AFTER_SAVE_AND_RELOAD_MESSAGE = Note: The change will be vis
|
|
|
38
38
|
TABLE_ROWS_NEEDED_TO_CREATE_CUSTOM_COLUMN=At least one table row is required to create new custom column. Make sure the table data is loaded and try again.
|
|
39
39
|
|
|
40
40
|
HIGHER_LAYER_CHANGES_INFO_MESSAGE=The preview of the project was reloaded due to detected changes in higher layer than the one used in your project.
|
|
41
|
+
|
|
42
|
+
TABLE_CUSTOM_COLUMN_ACTION_NOT_AVAILABLE=This action has been disabled because the table rows are not available. Please load the table data and try again
|
|
43
|
+
THE_CHANGE_HAS_ALREADY_BEEN_MADE=This option has been disabled because the change has already been made
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
sap.ui.define(["sap/ui/core/Component", "./core"], function (Component, ___core) {
|
|
3
|
+
sap.ui.define(["sap/ui/core/Component", "./core", "sap/ui/rta/command/CommandFactory", "../cpe/utils"], function (Component, ___core, CommandFactory, ___cpe_utils) {
|
|
4
4
|
"use strict";
|
|
5
5
|
|
|
6
6
|
const isA = ___core["isA"];
|
|
7
|
+
const getOverlay = ___cpe_utils["getOverlay"];
|
|
7
8
|
/**
|
|
8
9
|
* Gets app component of a v4 project.
|
|
9
10
|
*
|
|
@@ -74,6 +75,33 @@ sap.ui.define(["sap/ui/core/Component", "./core"], function (Component, ___core)
|
|
|
74
75
|
}
|
|
75
76
|
return propertyPathSegments.join('/');
|
|
76
77
|
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Get the modified value for a control.
|
|
81
|
+
* @param modifiedControl - The modified control.
|
|
82
|
+
* @param flexSettings - Flex Settings of the control.
|
|
83
|
+
* @param propertyChanges - The change object
|
|
84
|
+
*
|
|
85
|
+
* @returns A Promise resolving to an array of FlexCommand objects.
|
|
86
|
+
*/
|
|
87
|
+
async function createManifestPropertyChange(modifiedControl, flexSettings, propertyChanges) {
|
|
88
|
+
const overlay = getOverlay(modifiedControl);
|
|
89
|
+
if (!overlay) {
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
const overlayData = overlay?.getDesignTimeMetadata().getData();
|
|
93
|
+
const manifestPropertyPath = overlayData.manifestPropertyPath(modifiedControl);
|
|
94
|
+
const [manifestPropertyChange] = overlayData.manifestPropertyChange(propertyChanges, manifestPropertyPath, modifiedControl);
|
|
95
|
+
const modifiedValue = {
|
|
96
|
+
reference: getReference(modifiedControl),
|
|
97
|
+
appComponent: manifestPropertyChange.appComponent,
|
|
98
|
+
changeType: manifestPropertyChange.changeSpecificData.appDescriptorChangeType,
|
|
99
|
+
parameters: manifestPropertyChange.changeSpecificData.content.parameters,
|
|
100
|
+
selector: manifestPropertyChange.selector
|
|
101
|
+
};
|
|
102
|
+
const command = await CommandFactory.getCommandFor(modifiedControl, 'appDescriptor', modifiedValue, null, flexSettings);
|
|
103
|
+
return command;
|
|
104
|
+
}
|
|
77
105
|
var __exports = {
|
|
78
106
|
__esModule: true
|
|
79
107
|
};
|
|
@@ -82,6 +110,7 @@ sap.ui.define(["sap/ui/core/Component", "./core"], function (Component, ___core)
|
|
|
82
110
|
__exports.getV4PageType = getV4PageType;
|
|
83
111
|
__exports.getPageName = getPageName;
|
|
84
112
|
__exports.getConfigMapControlIdMap = getConfigMapControlIdMap;
|
|
113
|
+
__exports.createManifestPropertyChange = createManifestPropertyChange;
|
|
85
114
|
return __exports;
|
|
86
115
|
});
|
|
87
116
|
//# sourceMappingURL=fe-v4.js.map
|
|
@@ -3,8 +3,12 @@ import TemplateComponent from 'sap/fe/core/TemplateComponent';
|
|
|
3
3
|
import Component from 'sap/ui/core/Component';
|
|
4
4
|
import AppComponent from 'sap/fe/core/AppComponent';
|
|
5
5
|
import XMLView from 'sap/ui/core/mvc/XMLView';
|
|
6
|
-
import type { Manifest } from 'sap/ui/rta/RuntimeAuthoring';
|
|
6
|
+
import type { FlexSettings, Manifest } from 'sap/ui/rta/RuntimeAuthoring';
|
|
7
7
|
import { isA } from './core';
|
|
8
|
+
import CommandFactory from 'sap/ui/rta/command/CommandFactory';
|
|
9
|
+
import { getOverlay } from '../cpe/utils';
|
|
10
|
+
import UI5Element from 'sap/ui/core/Element';
|
|
11
|
+
import FlexCommand from 'sap/ui/rta/command/FlexCommand';
|
|
8
12
|
|
|
9
13
|
|
|
10
14
|
/**
|
|
@@ -79,3 +83,43 @@ export function getConfigMapControlIdMap(page: string | undefined, propertyPathS
|
|
|
79
83
|
}
|
|
80
84
|
return propertyPathSegments.join('/');
|
|
81
85
|
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Get the modified value for a control.
|
|
89
|
+
* @param modifiedControl - The modified control.
|
|
90
|
+
* @param flexSettings - Flex Settings of the control.
|
|
91
|
+
* @param propertyChanges - The change object
|
|
92
|
+
*
|
|
93
|
+
* @returns A Promise resolving to an array of FlexCommand objects.
|
|
94
|
+
*/
|
|
95
|
+
export async function createManifestPropertyChange(modifiedControl: UI5Element, flexSettings: FlexSettings, propertyChanges: Record<string, string | string[] | boolean | number | object | undefined>): Promise<FlexCommand | undefined> {
|
|
96
|
+
const overlay = getOverlay(modifiedControl);
|
|
97
|
+
if (!overlay) {
|
|
98
|
+
return undefined;
|
|
99
|
+
}
|
|
100
|
+
const overlayData = overlay?.getDesignTimeMetadata().getData();
|
|
101
|
+
const manifestPropertyPath = overlayData.manifestPropertyPath(modifiedControl);
|
|
102
|
+
const [manifestPropertyChange] = overlayData.manifestPropertyChange(
|
|
103
|
+
propertyChanges,
|
|
104
|
+
manifestPropertyPath,
|
|
105
|
+
modifiedControl
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
const modifiedValue = {
|
|
109
|
+
reference: getReference(modifiedControl),
|
|
110
|
+
appComponent: manifestPropertyChange.appComponent,
|
|
111
|
+
changeType: manifestPropertyChange.changeSpecificData.appDescriptorChangeType,
|
|
112
|
+
parameters: manifestPropertyChange.changeSpecificData.content.parameters,
|
|
113
|
+
selector: manifestPropertyChange.selector
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const command = await CommandFactory.getCommandFor(
|
|
117
|
+
modifiedControl,
|
|
118
|
+
'appDescriptor',
|
|
119
|
+
modifiedValue,
|
|
120
|
+
null,
|
|
121
|
+
flexSettings
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
return command;
|
|
125
|
+
}
|
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.133",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@sap-ux/feature-toggle": "0.2.2",
|
|
30
30
|
"@sap-ux/btp-utils": "0.17.0",
|
|
31
31
|
"@sap-ux/adp-tooling": "0.12.85",
|
|
32
|
-
"@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.5.
|
|
32
|
+
"@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.5.28",
|
|
33
33
|
"@sap-ux/project-access": "1.28.7"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
@@ -46,9 +46,9 @@
|
|
|
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.
|
|
50
|
-
"@sap-ux/axios-extension": "1.17.4",
|
|
49
|
+
"@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.11.38",
|
|
51
50
|
"@sap-ux/store": "0.9.3",
|
|
51
|
+
"@sap-ux/axios-extension": "1.17.4",
|
|
52
52
|
"@sap-ux/ui5-info": "0.8.3",
|
|
53
53
|
"@sap-ux/i18n": "0.2.0"
|
|
54
54
|
},
|