@sap/ux-specification 1.124.19 → 1.124.21
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/CHANGELOG.md +30 -0
- package/dist/documentation/v2/v2-AnalyticalListPage.html +2 -2
- package/dist/documentation/v2/v2-ApplicationV2.html +2 -2
- package/dist/documentation/v2/v2-ListReport.html +2 -2
- package/dist/documentation/v2/v2-ListReportNew.html +73 -0
- package/dist/documentation/v2/v2-ObjectPage.html +2 -2
- package/dist/documentation/v2/v2-OverviewPage.html +2 -2
- package/dist/documentation/v4/v4-ApplicationV4.html +2 -2
- package/dist/documentation/v4/v4-BuildingBlocks.html +2 -2
- package/dist/documentation/v4/v4-FreestylePage.html +2 -2
- package/dist/documentation/v4/v4-ListReport.html +2 -2
- package/dist/documentation/v4/v4-ObjectPage.html +2 -2
- package/dist/index-min.js +112 -112
- package/dist/index-min.js.map +4 -4
- package/dist/schemas/v2/ListReportNewConfig.json +16 -0
- package/dist/schemas/v4/ListReportConfig.json +18 -0
- package/dist/schemas/v4/ObjectPageConfig.json +27 -0
- package/dist/specification/package.json +4 -4
- package/dist/specification/scripts/schema/to-json-schema.d.ts +4 -0
- package/dist/specification/scripts/schema/to-json-schema.d.ts.map +1 -1
- package/dist/specification/scripts/schema/to-json-schema.js +25 -1
- package/dist/specification/scripts/schema/to-json-schema.js.map +1 -1
- package/dist/specification/src/api.js +2 -1
- package/dist/specification/src/api.js.map +1 -1
- package/dist/specification/src/sync/common/DataFieldStrategy.d.ts +63 -0
- package/dist/specification/src/sync/common/DataFieldStrategy.d.ts.map +1 -0
- package/dist/specification/src/sync/common/DataFieldStrategy.js +357 -0
- package/dist/specification/src/sync/common/DataFieldStrategy.js.map +1 -0
- package/dist/specification/src/sync/common/generate/objectPage.d.ts +62 -1
- package/dist/specification/src/sync/common/generate/objectPage.d.ts.map +1 -1
- package/dist/specification/src/sync/common/generate/objectPage.js +172 -59
- package/dist/specification/src/sync/common/generate/objectPage.js.map +1 -1
- package/dist/specification/src/sync/common/generate/utils.d.ts +19 -1
- package/dist/specification/src/sync/common/generate/utils.d.ts.map +1 -1
- package/dist/specification/src/sync/common/generate/utils.js +45 -0
- package/dist/specification/src/sync/common/generate/utils.js.map +1 -1
- package/dist/specification/src/sync/common/i18n.json +2 -1
- package/dist/specification/src/sync/common/index.d.ts +1 -0
- package/dist/specification/src/sync/common/index.d.ts.map +1 -1
- package/dist/specification/src/sync/common/index.js +1 -0
- package/dist/specification/src/sync/common/index.js.map +1 -1
- package/dist/specification/src/sync/common/utils.d.ts +25 -5
- package/dist/specification/src/sync/common/utils.d.ts.map +1 -1
- package/dist/specification/src/sync/common/utils.js +40 -65
- package/dist/specification/src/sync/common/utils.js.map +1 -1
- package/dist/specification/src/sync/v2/export/exportPage.d.ts +10 -1
- package/dist/specification/src/sync/v2/export/exportPage.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/export/exportPage.js +9 -2
- package/dist/specification/src/sync/v2/export/exportPage.js.map +1 -1
- package/dist/specification/src/sync/v2/export/exportPageGeneric.d.ts +2 -2
- package/dist/specification/src/sync/v2/export/exportPageGeneric.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/export/exportPageGeneric.js.map +1 -1
- package/dist/specification/src/sync/v2/generate/generate.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/generate/generate.js +5 -2
- package/dist/specification/src/sync/v2/generate/generate.js.map +1 -1
- package/dist/specification/src/sync/v2/generate/index.d.ts +1 -1
- package/dist/specification/src/sync/v2/generate/index.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/generate/index.js +5 -2
- package/dist/specification/src/sync/v2/generate/index.js.map +1 -1
- package/dist/specification/src/sync/v2/generate/listReport.d.ts +1 -1
- package/dist/specification/src/sync/v2/generate/listReport.js +1 -1
- package/dist/specification/src/sync/v2/generate/schemaAdaptation.d.ts +5 -2
- package/dist/specification/src/sync/v2/generate/schemaAdaptation.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/generate/schemaAdaptation.js +2 -2
- package/dist/specification/src/sync/v2/generate/schemaAdaptation.js.map +1 -1
- package/dist/specification/src/sync/v2/genericSchemaHandling/pages/ListReportNew.d.ts +27 -0
- package/dist/specification/src/sync/v2/genericSchemaHandling/pages/ListReportNew.d.ts.map +1 -0
- package/dist/specification/src/sync/v2/genericSchemaHandling/pages/ListReportNew.js +60 -0
- package/dist/specification/src/sync/v2/genericSchemaHandling/pages/ListReportNew.js.map +1 -0
- package/dist/specification/src/sync/v2/genericSchemaHandling/pages/pageAccess.d.ts +84 -0
- package/dist/specification/src/sync/v2/genericSchemaHandling/pages/pageAccess.d.ts.map +1 -0
- package/dist/specification/src/sync/v2/genericSchemaHandling/pages/pageAccess.js +262 -0
- package/dist/specification/src/sync/v2/genericSchemaHandling/pages/pageAccess.js.map +1 -0
- package/dist/specification/src/sync/v2/import/app/appProvider.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/import/app/appProvider.js +6 -2
- package/dist/specification/src/sync/v2/import/app/appProvider.js.map +1 -1
- package/dist/specification/src/sync/v2/import/importPage.d.ts +2 -2
- package/dist/specification/src/sync/v2/import/importPage.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/import/importPage.js.map +1 -1
- package/dist/specification/src/sync/v2/utils.d.ts +2 -2
- package/dist/specification/src/sync/v2/utils.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/utils.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ObjectPageForm.d.ts +4 -1
- package/dist/specification/src/sync/v4/export/controls/ObjectPageForm.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ObjectPageForm.js +4 -1
- package/dist/specification/src/sync/v4/export/controls/ObjectPageForm.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ObjectPageHeader.d.ts +2 -2
- package/dist/specification/src/sync/v4/export/controls/ObjectPageHeader.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ObjectPageHeader.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ObjectPageHeaderAction.d.ts +3 -0
- package/dist/specification/src/sync/v4/export/controls/ObjectPageHeaderAction.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ObjectPageHeaderAction.js +4 -1
- package/dist/specification/src/sync/v4/export/controls/ObjectPageHeaderAction.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ObjectPageToolBarAction.d.ts +6 -0
- package/dist/specification/src/sync/v4/export/controls/ObjectPageToolBarAction.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ObjectPageToolBarAction.js +7 -1
- package/dist/specification/src/sync/v4/export/controls/ObjectPageToolBarAction.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ToolBar.d.ts +2 -2
- package/dist/specification/src/sync/v4/export/controls/ToolBar.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ToolBarAction.d.ts +6 -0
- package/dist/specification/src/sync/v4/export/controls/ToolBarAction.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ToolBarAction.js +7 -1
- package/dist/specification/src/sync/v4/export/controls/ToolBarAction.js.map +1 -1
- package/dist/specification/src/sync/v4/export/export.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/export.js +11 -1
- package/dist/specification/src/sync/v4/export/export.js.map +1 -1
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/annotations.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/annotations.js +2 -1
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/annotations.js.map +1 -1
- package/dist/specification/src/sync/v4/generate/objectPage.d.ts +21 -0
- package/dist/specification/src/sync/v4/generate/objectPage.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/generate/objectPage.js +44 -36
- package/dist/specification/src/sync/v4/generate/objectPage.js.map +1 -1
- package/dist/specification/src/sync/v4/import/pages/listReport.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/import/pages/listReport.js +13 -5
- package/dist/specification/src/sync/v4/import/pages/listReport.js.map +1 -1
- package/dist/specification/src/sync/v4/import/pages/objectPage.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/import/pages/objectPage.js +36 -38
- package/dist/specification/src/sync/v4/import/pages/objectPage.js.map +1 -1
- package/dist/specification/src/sync/v4/utils/StableIdHelper.d.ts +21 -0
- package/dist/specification/src/sync/v4/utils/StableIdHelper.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/utils/StableIdHelper.js +24 -53
- package/dist/specification/src/sync/v4/utils/StableIdHelper.js.map +1 -1
- package/dist/specification/src/sync/v4/utils/utils.d.ts +71 -2
- package/dist/specification/src/sync/v4/utils/utils.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/utils/utils.js +289 -123
- package/dist/specification/src/sync/v4/utils/utils.js.map +1 -1
- package/dist/types/src/common/types.d.ts +5 -0
- package/dist/types/src/common/types.d.ts.map +1 -1
- package/dist/types/src/common/types.js +5 -0
- package/dist/types/src/common/types.js.map +1 -1
- package/dist/types/src/v4/controls/ObjectPageForm.d.ts +4 -1
- package/dist/types/src/v4/controls/ObjectPageForm.d.ts.map +1 -1
- package/dist/types/src/v4/controls/ObjectPageHeader.d.ts +4 -1
- package/dist/types/src/v4/controls/ObjectPageHeader.d.ts.map +1 -1
- package/dist/types/src/v4/controls/ObjectPageToolBar.d.ts +4 -1
- package/dist/types/src/v4/controls/ObjectPageToolBar.d.ts.map +1 -1
- package/dist/types/src/v4/controls/ToolBar.d.ts +8 -2
- package/dist/types/src/v4/controls/ToolBar.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -3,9 +3,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DATA_FIELD_FOR_ACTION_GROUP = void 0;
|
|
6
7
|
exports.addExtensionToArray = addExtensionToArray;
|
|
7
8
|
exports.addEnumForProperties = addEnumForProperties;
|
|
8
9
|
exports.addCustomColumnDefinition = addCustomColumnDefinition;
|
|
10
|
+
exports.addActionRecordToSchema = addActionRecordToSchema;
|
|
11
|
+
exports.addGroupActionRecordToSchema = addGroupActionRecordToSchema;
|
|
12
|
+
exports.addLineItemActionDefinition = addLineItemActionDefinition;
|
|
13
|
+
exports.addLineItemRecordToSchema = addLineItemRecordToSchema;
|
|
9
14
|
exports.appendLineItemsToSchema = appendLineItemsToSchema;
|
|
10
15
|
exports.addLineItemsTypeToSchema = addLineItemsTypeToSchema;
|
|
11
16
|
exports.addFragmentEnumForAnchor = addFragmentEnumForAnchor;
|
|
@@ -19,20 +24,25 @@ exports.getPageCustomExtensionFile = getPageCustomExtensionFile;
|
|
|
19
24
|
exports.getPageCustomViewFile = getPageCustomViewFile;
|
|
20
25
|
exports.addCustomSectionDefinition = addCustomSectionDefinition;
|
|
21
26
|
exports.addCustomFilterFieldDefinition = addCustomFilterFieldDefinition;
|
|
27
|
+
exports.importActionSettingsOfReference = importActionSettingsOfReference;
|
|
22
28
|
const utils_1 = require("../../common/utils");
|
|
23
29
|
const StableIdHelper_1 = require("./StableIdHelper");
|
|
24
30
|
const common_1 = require("../../common");
|
|
25
31
|
const i18next_1 = __importDefault(require("i18next"));
|
|
26
32
|
const __1 = require("../../..");
|
|
27
33
|
const ux_specification_types_1 = require("@sap/ux-specification-types");
|
|
34
|
+
const ux_specification_types_2 = require("@sap/ux-specification-types");
|
|
28
35
|
const path_1 = require("path");
|
|
36
|
+
const DataFieldStrategy_1 = require("../../common/DataFieldStrategy");
|
|
37
|
+
const utils_2 = require("../import/utils");
|
|
38
|
+
exports.DATA_FIELD_FOR_ACTION_GROUP = 'DataFieldForActionGroup';
|
|
29
39
|
/**
|
|
30
40
|
* Returns a comparator function to sort objects by their property index.
|
|
31
41
|
*
|
|
32
42
|
* @returns A comparator function that compares two objects based on their property index.
|
|
33
43
|
*/
|
|
34
44
|
function sortByPropertyIndex() {
|
|
35
|
-
return ([_key1, value1], [_key2, value2]) => value1[
|
|
45
|
+
return ([_key1, value1], [_key2, value2]) => value1[ux_specification_types_2.SchemaTag.propertyIndex] - value2[ux_specification_types_2.SchemaTag.propertyIndex];
|
|
36
46
|
}
|
|
37
47
|
/**
|
|
38
48
|
* Sort function for properties in schema definitions.
|
|
@@ -87,8 +97,8 @@ function getExtensionText(extension) {
|
|
|
87
97
|
* @param newExtensionReference.description - A description of the new extension.
|
|
88
98
|
*/
|
|
89
99
|
function addExtensionToSortedArray(extension, sortedExtensionsArray, targetIndex, extId, newExtensionReference) {
|
|
90
|
-
const placement = extension.position?.placement ||
|
|
91
|
-
if (placement ===
|
|
100
|
+
const placement = extension.position?.placement || ux_specification_types_2.v4.Placement.After;
|
|
101
|
+
if (placement === ux_specification_types_2.v4.Placement.Before) {
|
|
92
102
|
sortedExtensionsArray.splice(targetIndex, 0, [extId, newExtensionReference]);
|
|
93
103
|
}
|
|
94
104
|
else {
|
|
@@ -126,14 +136,14 @@ function addRemainingTargetByBefore(remainingExtensions, extId, extension, sorte
|
|
|
126
136
|
* @returns Custom extension details
|
|
127
137
|
*/
|
|
128
138
|
function getExtensionDetails(extension, extensionDefinitionName, extId, actionType) {
|
|
129
|
-
const refDefinition = extensionDefinitionName.includes(
|
|
139
|
+
const refDefinition = extensionDefinitionName.includes(ux_specification_types_2.DefinitionName.ObjectPageCustomSectionFragment)
|
|
130
140
|
? `${extensionDefinitionName}<${extId}>`
|
|
131
141
|
: extensionDefinitionName;
|
|
132
142
|
const description = getExtensionText(extension);
|
|
133
143
|
return {
|
|
134
144
|
$ref: `${utils_1.DEFINITION_LINK_PREFIX}${refDefinition}`,
|
|
135
145
|
description,
|
|
136
|
-
keys: [{ name:
|
|
146
|
+
keys: [{ name: ux_specification_types_2.SchemaKeyName.key, value: `${extId}` }],
|
|
137
147
|
...(actionType !== undefined && { actionType })
|
|
138
148
|
};
|
|
139
149
|
}
|
|
@@ -164,8 +174,8 @@ function adjustCustomExtReferringToCustomExt(remainingExtensions, extensionDefin
|
|
|
164
174
|
severity: "error" /* LogSeverity.Error */,
|
|
165
175
|
message: i18next_1.default.t('INVALIDANCHOR', { id: extId, anchor: extension.position.anchor }),
|
|
166
176
|
location: {
|
|
167
|
-
path:
|
|
168
|
-
range: [
|
|
177
|
+
path: ux_specification_types_2.MANIFESTPATH,
|
|
178
|
+
range: [ux_specification_types_2.ManifestSection.ui5]
|
|
169
179
|
}
|
|
170
180
|
});
|
|
171
181
|
sortedExtArray.splice(sortedExtArray.length, 0, [extId, newCustomExt]);
|
|
@@ -199,12 +209,12 @@ function adjustCustomExtReferringToCustomExt(remainingExtensions, extensionDefin
|
|
|
199
209
|
*/
|
|
200
210
|
function getExtensionAnchor(extension, sortedExtensionsArray) {
|
|
201
211
|
// Default placement is After
|
|
202
|
-
const placement = extension.position?.placement ||
|
|
212
|
+
const placement = extension.position?.placement || ux_specification_types_2.v4.Placement.After;
|
|
203
213
|
let anchor = extension.position?.anchor;
|
|
204
214
|
if (!anchor) {
|
|
205
215
|
// Simulate runtime behavior - if there no anchor, then logic uses first or last annotation node
|
|
206
216
|
// In some cases last extension can be previously inserted extension - in such case we still need use annotation node
|
|
207
|
-
const index = placement ===
|
|
217
|
+
const index = placement === ux_specification_types_2.v4.Placement.Before ? 0 : sortedExtensionsArray.length - 1;
|
|
208
218
|
anchor = sortedExtensionsArray[index] ? sortedExtensionsArray[index][0] : undefined;
|
|
209
219
|
}
|
|
210
220
|
return anchor;
|
|
@@ -238,7 +248,7 @@ function getLocalExtensionsToSkip(localExtensions, annotationEntries) {
|
|
|
238
248
|
* @returns Index of extension using merged annotation nodes approach.
|
|
239
249
|
*/
|
|
240
250
|
function getExtensionIndexByMergedApproach(extension, extensions, sortedExtensionsArray) {
|
|
241
|
-
const placement = extension.position?.placement ||
|
|
251
|
+
const placement = extension.position?.placement || ux_specification_types_2.v4.Placement.After;
|
|
242
252
|
const originalAnchor = extension.position?.anchor;
|
|
243
253
|
if (originalAnchor) {
|
|
244
254
|
// Custom extension is anchored to any extension
|
|
@@ -259,7 +269,7 @@ function getExtensionIndexByMergedApproach(extension, extensions, sortedExtensio
|
|
|
259
269
|
return index;
|
|
260
270
|
};
|
|
261
271
|
let index = 0;
|
|
262
|
-
if (placement ===
|
|
272
|
+
if (placement === ux_specification_types_2.v4.Placement.Before) {
|
|
263
273
|
// Special case when no anchor but placement is "Before" - then rendered as very first
|
|
264
274
|
// Find index before first annotation node
|
|
265
275
|
index = findNextIndex(0, (innerExtension) => !innerExtension);
|
|
@@ -268,7 +278,7 @@ function getExtensionIndexByMergedApproach(extension, extensions, sortedExtensio
|
|
|
268
278
|
// Special case when no anchor but placement is "After" - then rendered right after last annotation node
|
|
269
279
|
index = findNextIndex(-1, (innerExtension) => !!(innerExtension &&
|
|
270
280
|
// Ignore extension without anchor but with position "Before"
|
|
271
|
-
(innerExtension?.position?.anchor || innerExtension?.position?.placement !==
|
|
281
|
+
(innerExtension?.position?.anchor || innerExtension?.position?.placement !== ux_specification_types_2.v4.Placement.Before)));
|
|
272
282
|
}
|
|
273
283
|
return index > -1 ? index : 0;
|
|
274
284
|
}
|
|
@@ -304,7 +314,7 @@ function handleInvalidExtension(logger, extensionId, sortedExtensionsArray, newE
|
|
|
304
314
|
severity: "error" /* LogSeverity.Error */,
|
|
305
315
|
message: i18next_1.default.t('INVALIDEXTENSION', { id: extensionId }),
|
|
306
316
|
location: {
|
|
307
|
-
path:
|
|
317
|
+
path: ux_specification_types_2.MANIFESTPATH
|
|
308
318
|
}
|
|
309
319
|
});
|
|
310
320
|
sortedExtensionsArray.push([extensionId, newExtensionReference]);
|
|
@@ -333,7 +343,7 @@ function addExtensionToArray(extensions, sortedExtensionsArray, extensionDefinit
|
|
|
333
343
|
if (localExtensionsToSkip?.includes(extensionId)) {
|
|
334
344
|
continue;
|
|
335
345
|
}
|
|
336
|
-
const newExtensionReference = getExtensionDetails(extension, extensionDefinitionName, extensionId,
|
|
346
|
+
const newExtensionReference = getExtensionDetails(extension, extensionDefinitionName, extensionId, ux_specification_types_2.ActionType.Custom);
|
|
337
347
|
if (typeof extension !== 'object') {
|
|
338
348
|
handleInvalidExtension(logger, extensionId, sortedExtensionsArray, newExtensionReference, localExtensions);
|
|
339
349
|
continue;
|
|
@@ -386,9 +396,9 @@ function addEnumForProperties(lineItems, customColumnDefinition) {
|
|
|
386
396
|
* @param lineItems - content of the line item annotation
|
|
387
397
|
* @param {DefinitionName} customColumnDefinitionName - custom column definition name, distinguishes LR from OP
|
|
388
398
|
*/
|
|
389
|
-
function addColumnPropertyIndexAndEnum(sortedColumnsArray, appSchema, lineItems, customColumnDefinitionName =
|
|
390
|
-
if (customColumnDefinitionName ===
|
|
391
|
-
customColumnDefinitionName.indexOf(
|
|
399
|
+
function addColumnPropertyIndexAndEnum(sortedColumnsArray, appSchema, lineItems, customColumnDefinitionName = ux_specification_types_2.DefinitionName.CustomColumn) {
|
|
400
|
+
if (customColumnDefinitionName === ux_specification_types_2.DefinitionName.CustomColumn ||
|
|
401
|
+
customColumnDefinitionName.indexOf(ux_specification_types_2.DefinitionName.ViewCustomColumn) > -1) {
|
|
392
402
|
//Table custom column: Add enum for properties
|
|
393
403
|
const customColumnDefinition = appSchema.definitions[customColumnDefinitionName];
|
|
394
404
|
addEnumForProperties(lineItems, customColumnDefinition);
|
|
@@ -396,7 +406,7 @@ function addColumnPropertyIndexAndEnum(sortedColumnsArray, appSchema, lineItems,
|
|
|
396
406
|
//Add property index
|
|
397
407
|
for (let index = 0; index < sortedColumnsArray.length; index++) {
|
|
398
408
|
const column = sortedColumnsArray[index][1];
|
|
399
|
-
column[
|
|
409
|
+
column[ux_specification_types_2.SchemaTag.propertyIndex] = index;
|
|
400
410
|
}
|
|
401
411
|
}
|
|
402
412
|
/**
|
|
@@ -409,8 +419,8 @@ function addColumnPropertyIndexAndEnum(sortedColumnsArray, appSchema, lineItems,
|
|
|
409
419
|
* @param sectionId - identifier of the current object page section in schema
|
|
410
420
|
* @param sectionIdInManifest - identifier of the current object page section in manifest
|
|
411
421
|
*/
|
|
412
|
-
function addCustomColumnDefinition(appSchema, v4Page, logger, customColumnDefinitionName =
|
|
413
|
-
const lineItemId = sectionId ||
|
|
422
|
+
function addCustomColumnDefinition(appSchema, v4Page, logger, customColumnDefinitionName = ux_specification_types_2.DefinitionName.CustomColumn, sectionId, sectionIdInManifest) {
|
|
423
|
+
const lineItemId = sectionId || ux_specification_types_2.DefinitionName.LineItems;
|
|
414
424
|
const lineItems = appSchema.definitions[lineItemId];
|
|
415
425
|
if (!lineItems) {
|
|
416
426
|
return;
|
|
@@ -429,21 +439,25 @@ function addCustomColumnDefinition(appSchema, v4Page, logger, customColumnDefini
|
|
|
429
439
|
appSchema.definitions[lineItemId].properties = sortedColumnsAsObject;
|
|
430
440
|
}
|
|
431
441
|
/**
|
|
432
|
-
* Determines the name
|
|
442
|
+
* Determines the appropriate action definition name based on the provided line item data and record type.
|
|
433
443
|
*
|
|
434
|
-
* @param {LineItemDataForSchema} data - data
|
|
435
|
-
* @
|
|
444
|
+
* @param {LineItemDataForSchema} data - The schema data for the line item, including its identifier and metadata.
|
|
445
|
+
* @param {DataFieldAbstractTypes} lineItemRecord - The record representing a data field or action within the line item.
|
|
446
|
+
* @returns {DefinitionName} The determined action definition name based on the provided data and group type.
|
|
436
447
|
*/
|
|
437
|
-
function determineActionDefinitionName(data) {
|
|
448
|
+
function determineActionDefinitionName(data, lineItemRecord) {
|
|
449
|
+
const isGrouped = lineItemRecord.$Type === "com.sap.vocabularies.UI.v1.DataFieldForActionGroup" /* UIAnnotationTypes.DataFieldForActionGroup */;
|
|
438
450
|
let actionDefinitionName;
|
|
439
|
-
if (data.lineItemId.startsWith(
|
|
440
|
-
actionDefinitionName =
|
|
451
|
+
if (data.lineItemId.startsWith(ux_specification_types_2.DefinitionName.LineItemsOfView)) {
|
|
452
|
+
actionDefinitionName = isGrouped ? ux_specification_types_2.DefinitionName.ViewToolBarActionGroup : ux_specification_types_2.DefinitionName.ViewToolBarAction;
|
|
441
453
|
}
|
|
442
|
-
else if (data.lineItemId.startsWith(
|
|
443
|
-
actionDefinitionName =
|
|
454
|
+
else if (data.lineItemId.startsWith(ux_specification_types_2.DefinitionName.LineItems)) {
|
|
455
|
+
actionDefinitionName = isGrouped ? ux_specification_types_2.DefinitionName.ToolBarActionGroup : ux_specification_types_2.DefinitionName.ToolBarAction;
|
|
444
456
|
}
|
|
445
457
|
else {
|
|
446
|
-
actionDefinitionName =
|
|
458
|
+
actionDefinitionName = isGrouped
|
|
459
|
+
? ux_specification_types_2.DefinitionName.ObjectPageToolBarActionGroup
|
|
460
|
+
: ux_specification_types_2.DefinitionName.ObjectPageToolBarAction;
|
|
447
461
|
}
|
|
448
462
|
return actionDefinitionName;
|
|
449
463
|
}
|
|
@@ -455,89 +469,153 @@ function determineActionDefinitionName(data) {
|
|
|
455
469
|
* @param {string} actionId - ID of the action, according to the lineItem definition
|
|
456
470
|
*/
|
|
457
471
|
function addTargetAndKeysOfAction(actionDefinition, lineItemRecord, actionId) {
|
|
458
|
-
actionDefinition[
|
|
459
|
-
if (lineItemRecord[
|
|
460
|
-
actionDefinition[
|
|
461
|
-
name:
|
|
462
|
-
value: lineItemRecord[
|
|
472
|
+
actionDefinition[ux_specification_types_2.SchemaTag.keys] = [];
|
|
473
|
+
if (lineItemRecord[ux_specification_types_2.SchemaKeyName.semanticObject]) {
|
|
474
|
+
actionDefinition[ux_specification_types_2.SchemaTag.keys].push({
|
|
475
|
+
name: ux_specification_types_2.SchemaKeyName.semanticObject,
|
|
476
|
+
value: lineItemRecord[ux_specification_types_2.SchemaKeyName.semanticObject]
|
|
463
477
|
});
|
|
464
478
|
}
|
|
465
479
|
const { key, ns } = (0, common_1.getActionKey)(actionId, true);
|
|
466
|
-
actionDefinition[
|
|
480
|
+
actionDefinition[ux_specification_types_2.SchemaTag.keys].push({ name: ux_specification_types_2.SchemaKeyName.action, value: key });
|
|
467
481
|
if (ns) {
|
|
468
|
-
actionDefinition[
|
|
482
|
+
actionDefinition[ux_specification_types_2.SchemaTag.target] = ns;
|
|
469
483
|
}
|
|
470
484
|
}
|
|
471
485
|
/**
|
|
472
|
-
*
|
|
486
|
+
* Adds an action record to a schema definition based on the provided line item definition parameters.
|
|
487
|
+
* This involves defining action-specific properties, references, and metadata, and updating the schema accordingly.
|
|
473
488
|
*
|
|
474
|
-
* @param
|
|
475
|
-
* @param
|
|
476
|
-
* @
|
|
477
|
-
* @param lineItemRecord - actual record of the line item collection
|
|
478
|
-
* @param recordIndex - record index in the collection
|
|
479
|
-
* @param createRef - defines whether the $ref attribute should be created for the action
|
|
489
|
+
* @param {AddLineItemDefinitionParams} lineItemDefinitionParams - The parameters describing the line item definition, including data, actions, path, record, and index.
|
|
490
|
+
* @param {boolean} [createRef] - A flag indicating whether to create a reference for the action definition.
|
|
491
|
+
* @returns {void} This function does not return a value.
|
|
480
492
|
*/
|
|
481
|
-
function addActionRecordToSchema(
|
|
493
|
+
function addActionRecordToSchema(lineItemDefinitionParams, createRef = true) {
|
|
494
|
+
const { lineItemData: data, actions: actionsDefinition, lineItemPath, lineItemRecord, index: recordIndex } = lineItemDefinitionParams;
|
|
482
495
|
// Action but not inline action
|
|
483
496
|
if (lineItemRecord.Determining === true) {
|
|
484
497
|
return;
|
|
485
498
|
}
|
|
486
499
|
//no footer bar -> toolbar action
|
|
487
|
-
const actionDefinitionName = determineActionDefinitionName(data);
|
|
488
|
-
const description = (0,
|
|
489
|
-
const prefix = lineItemRecord.$Type.split(`${
|
|
500
|
+
const actionDefinitionName = determineActionDefinitionName(data, lineItemRecord);
|
|
501
|
+
const description = (0, common_1.getDataFieldDescription)(lineItemRecord, data.entityType);
|
|
502
|
+
const prefix = lineItemRecord.$Type.split(`${ux_specification_types_2.UIVOCABULARY}.`)[1];
|
|
490
503
|
const actionId = typeof lineItemRecord.Action === 'string' ? lineItemRecord.Action : lineItemRecord.Action['path'];
|
|
491
504
|
const propertyKey = (0, StableIdHelper_1.replaceSpecialChars)(actionId);
|
|
492
505
|
const actionDefinition = (actionsDefinition.properties[`${prefix}::${propertyKey}`] = {
|
|
493
506
|
description
|
|
494
507
|
});
|
|
495
508
|
if (createRef) {
|
|
496
|
-
actionDefinition.$ref = (0, common_1.
|
|
509
|
+
actionDefinition.$ref = (0, common_1.getUniqueFacetDefinitionLink)(actionDefinitionName, (0, common_1.prepareRef)(propertyKey), data.appSchema, lineItemPath);
|
|
497
510
|
}
|
|
498
511
|
else {
|
|
499
512
|
actionDefinition.properties = {};
|
|
500
513
|
actionDefinition.type = 'object';
|
|
501
514
|
actionDefinition.isViewNode = true;
|
|
502
515
|
}
|
|
503
|
-
actionDefinition[
|
|
504
|
-
actionDefinition[
|
|
516
|
+
actionDefinition[ux_specification_types_2.SchemaTag.propertyIndex] = recordIndex;
|
|
517
|
+
actionDefinition[ux_specification_types_2.SchemaTag.dataType] = (0, common_1.determineDataType)(lineItemRecord);
|
|
505
518
|
//keys
|
|
506
519
|
addTargetAndKeysOfAction(actionDefinition, lineItemRecord, actionId);
|
|
507
|
-
actionDefinition[
|
|
520
|
+
actionDefinition[ux_specification_types_2.SchemaTag.annotationType] = lineItemRecord.$Type;
|
|
508
521
|
if (createRef) {
|
|
509
|
-
|
|
510
|
-
|
|
522
|
+
// Using previously computed ref instead of generating new one to support action duplication
|
|
523
|
+
const previouslyComputedRef = actionDefinition.$ref.replace(utils_1.DEFINITION_LINK_PREFIX, '');
|
|
524
|
+
const action = (0, common_1.parseSchemaDefinition)(actionDefinitionName, previouslyComputedRef, data.appSchema, false);
|
|
525
|
+
action[ux_specification_types_2.SchemaTag.annotationPath] = `${lineItemPath}/${recordIndex}`;
|
|
511
526
|
}
|
|
512
527
|
else {
|
|
513
|
-
actionDefinition[
|
|
528
|
+
actionDefinition[ux_specification_types_2.SchemaTag.annotationPath] = `${lineItemPath}/${recordIndex}`;
|
|
514
529
|
}
|
|
515
530
|
}
|
|
516
531
|
/**
|
|
517
|
-
*
|
|
532
|
+
* Adds a group action record to the schema based on the given parameters. This involves determining
|
|
533
|
+
* action definitions, creating or referencing schema properties, and setting metadata fields.
|
|
518
534
|
*
|
|
519
|
-
* @param data
|
|
520
|
-
* @param
|
|
521
|
-
* @
|
|
522
|
-
* @param recordIndex - record index in the collection
|
|
523
|
-
* @param lineItemDefinition - line item definition
|
|
535
|
+
* @param {AddLineItemDefinitionParams} lineItemDefinitionParams - Parameters that define the line item, including data, record, path, index, and actions.
|
|
536
|
+
* @param {boolean} [createRef] - Indicates whether to create a reference for the action definition or to use an inline object.
|
|
537
|
+
* @returns {void} - Does not return any value.
|
|
524
538
|
*/
|
|
525
|
-
function
|
|
526
|
-
const
|
|
527
|
-
|
|
539
|
+
function addGroupActionRecordToSchema(lineItemDefinitionParams, createRef = true) {
|
|
540
|
+
const { lineItemData, lineItemRecord, lineItemPath, index, actions } = lineItemDefinitionParams;
|
|
541
|
+
//no footer bar -> toolbar action
|
|
542
|
+
const actionDefinitionName = determineActionDefinitionName(lineItemData, lineItemRecord);
|
|
543
|
+
const propertyKey = (0, StableIdHelper_1.getStableIdPartFromDataField)(lineItemRecord);
|
|
544
|
+
let actionDefinition = {};
|
|
545
|
+
if (createRef) {
|
|
546
|
+
actions.properties[`${propertyKey}`] = {
|
|
547
|
+
$ref: (0, common_1.getFacetDefinitionLink)(actionDefinitionName, (0, common_1.prepareRef)(propertyKey))
|
|
548
|
+
};
|
|
549
|
+
actionDefinition = (0, common_1.parseSchemaDefinition)(actionDefinitionName, (0, common_1.prepareRef)(propertyKey), lineItemData.appSchema);
|
|
550
|
+
}
|
|
551
|
+
else {
|
|
552
|
+
actions.properties[`${propertyKey}`] = actionDefinition;
|
|
553
|
+
}
|
|
554
|
+
// add a warning message for all versions that don't support action groups
|
|
555
|
+
(0, common_1.addMessageToSchema)(actionDefinition, i18next_1.default.t('ACTION_GROUPS_ARENT_SUPPORTED'));
|
|
556
|
+
actionDefinition.properties = {};
|
|
557
|
+
actionDefinition.description = (0, common_1.getDataFieldDescription)(lineItemRecord, lineItemData.entityType);
|
|
558
|
+
actionDefinition.type = 'object';
|
|
559
|
+
actionDefinition.isViewNode = true;
|
|
560
|
+
actionDefinition[ux_specification_types_2.SchemaTag.propertyIndex] = index;
|
|
561
|
+
actionDefinition[ux_specification_types_2.SchemaTag.dataType] = (0, common_1.determineDataType)(lineItemRecord);
|
|
562
|
+
actionDefinition[ux_specification_types_2.SchemaTag.annotationPath] = `${lineItemPath}/${index}`;
|
|
563
|
+
(lineItemRecord['Actions'] ?? []).forEach((action, index) => {
|
|
564
|
+
const lineItemActionDefinitionParams = {
|
|
565
|
+
...lineItemDefinitionParams,
|
|
566
|
+
lineItemRecord: action,
|
|
567
|
+
lineItemPath: `${actionDefinition[ux_specification_types_2.SchemaTag.annotationPath]}/Actions`,
|
|
568
|
+
actions: actionDefinition,
|
|
569
|
+
index
|
|
570
|
+
};
|
|
571
|
+
addActionRecordToSchema(lineItemActionDefinitionParams, createRef);
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* Adds a line item action definition to the schema based on the provided parameters.
|
|
576
|
+
* Handles determining which action to take based on specific conditions of the line item record.
|
|
577
|
+
*
|
|
578
|
+
* @param {AddLineItemDefinitionParams} data - An object containing the details of the line item record and the line item definition.
|
|
579
|
+
* @param {object} data.lineItemRecord - The record of the line item to be processed, containing relevant properties.
|
|
580
|
+
* @param {boolean} data.lineItemRecord.Inline - Indicates whether the line item is inline.
|
|
581
|
+
* @param {boolean} data.lineItemRecord.Determining - Indicates if the line item is determining.
|
|
582
|
+
* @param {boolean} data.lineItemDefinition - Indicates whether the line item definition is present.
|
|
583
|
+
* @returns {void} This method does not return a value.
|
|
584
|
+
*/
|
|
585
|
+
function addLineItemActionDefinition(data) {
|
|
586
|
+
const { lineItemRecord, lineItemDefinition } = data;
|
|
587
|
+
if (lineItemRecord.Inline !== true || lineItemRecord.Determining === true) {
|
|
588
|
+
addActionRecordToSchema(data, !lineItemDefinition);
|
|
589
|
+
}
|
|
590
|
+
else {
|
|
591
|
+
addLineItemRecordToSchema(data);
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
595
|
+
* Adds a line item record to the provided schema based on the definition parameters.
|
|
596
|
+
*
|
|
597
|
+
* @param {AddLineItemDefinitionParams} lineItemDefinitionParams - The parameters defining the line item data, schema information, and record.
|
|
598
|
+
* @returns {void} This function does not return a value.
|
|
599
|
+
*/
|
|
600
|
+
function addLineItemRecordToSchema(lineItemDefinitionParams) {
|
|
601
|
+
const { lineItemData, lineItemRecord, lineItemDefinition, lineItemPath, index, columnDefinitionName } = lineItemDefinitionParams;
|
|
602
|
+
const columnDefinition = lineItemRecord.$Type === "com.sap.vocabularies.UI.v1.DataFieldForAction" /* UIAnnotationTypes.DataFieldForAction */
|
|
603
|
+
? `${columnDefinitionName}Action`
|
|
604
|
+
: columnDefinitionName;
|
|
605
|
+
const lineItemId = lineItemData.lineItemId;
|
|
528
606
|
if (lineItemRecord['Target']?.['value']) {
|
|
529
|
-
const regex = `@${(0, utils_1.findAlias)(
|
|
607
|
+
const regex = `@${(0, utils_1.findAlias)(ux_specification_types_2.UIVOCABULARY, lineItemData.oDataServiceAVT)}.`;
|
|
530
608
|
lineItemRecord['Target']['value'] = lineItemRecord['Target']['value'].replace(regex, '@');
|
|
531
609
|
}
|
|
532
610
|
const schemaKey = (0, StableIdHelper_1.getStableIdPartFromDataField)(lineItemRecord).replace(/\//g, '::');
|
|
533
611
|
if (schemaKey) {
|
|
534
612
|
let columnsDefinition = lineItemDefinition;
|
|
535
613
|
if (!columnsDefinition) {
|
|
536
|
-
columnsDefinition =
|
|
614
|
+
columnsDefinition = lineItemData.appSchema.definitions[lineItemId];
|
|
537
615
|
}
|
|
538
616
|
const properties = columnsDefinition.properties;
|
|
539
617
|
const property = {
|
|
540
|
-
description: (0,
|
|
618
|
+
description: (0, common_1.getDataFieldDescription)(lineItemRecord, lineItemData.entityType)
|
|
541
619
|
};
|
|
542
620
|
if (lineItemDefinition) {
|
|
543
621
|
property.properties = {};
|
|
@@ -545,12 +623,12 @@ function addLineItemRecordToSchema(data, lineItem, columnDefinitionName, recordI
|
|
|
545
623
|
property.isViewNode = true;
|
|
546
624
|
}
|
|
547
625
|
else {
|
|
548
|
-
property.$ref = utils_1.DEFINITION_LINK_PREFIX +
|
|
626
|
+
property.$ref = utils_1.DEFINITION_LINK_PREFIX + columnDefinition;
|
|
549
627
|
}
|
|
550
|
-
property[
|
|
551
|
-
property[
|
|
552
|
-
property[
|
|
553
|
-
property[
|
|
628
|
+
property[ux_specification_types_2.SchemaTag.annotationType] = lineItemRecord?.$Type;
|
|
629
|
+
property[ux_specification_types_2.SchemaTag.annotationPath] = `${lineItemPath}/${index}`;
|
|
630
|
+
property[ux_specification_types_2.SchemaTag.propertyIndex] = index;
|
|
631
|
+
property[ux_specification_types_2.SchemaTag.dataType] = (0, common_1.determineDataType)(lineItemRecord);
|
|
554
632
|
properties[schemaKey] = property;
|
|
555
633
|
(0, common_1.addKeyToDefinition)(lineItemRecord, properties, schemaKey);
|
|
556
634
|
}
|
|
@@ -570,24 +648,23 @@ function addLineItemRecordToSchema(data, lineItem, columnDefinitionName, recordI
|
|
|
570
648
|
* @param {Definition | undefined} lineItemDefinition - line item definition
|
|
571
649
|
* @param {string} columnDefinitionName - line item definition name
|
|
572
650
|
*/
|
|
573
|
-
function appendLineItemsToSchema(data, actions, lineItemPath, lineItemDefinition, columnDefinitionName =
|
|
651
|
+
function appendLineItemsToSchema(data, actions, lineItemPath, lineItemDefinition, columnDefinitionName = ux_specification_types_2.DefinitionName.TableColumn) {
|
|
574
652
|
if (!data.lineItemAnnotation) {
|
|
575
653
|
return;
|
|
576
654
|
}
|
|
577
655
|
let i = 0;
|
|
578
656
|
data.lineItemAnnotation.forEach((lineItemRecord) => {
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
}
|
|
657
|
+
const addLineItemDefinitionsParams = {
|
|
658
|
+
lineItemData: data,
|
|
659
|
+
actions,
|
|
660
|
+
lineItemPath,
|
|
661
|
+
lineItemRecord: lineItemRecord,
|
|
662
|
+
index: i,
|
|
663
|
+
lineItemDefinition,
|
|
664
|
+
columnDefinitionName
|
|
665
|
+
};
|
|
666
|
+
const strategy = DataFieldStrategy_1.dataFieldStrategyContext.getStrategy(lineItemRecord.$Type);
|
|
667
|
+
strategy.addLineItemDefinition(addLineItemDefinitionsParams);
|
|
591
668
|
i++;
|
|
592
669
|
});
|
|
593
670
|
}
|
|
@@ -606,7 +683,7 @@ function appendLineItemsToSchema(data, actions, lineItemPath, lineItemDefinition
|
|
|
606
683
|
* @param customColumnDefinitionName - name of the custom column definition
|
|
607
684
|
* @param customActionDefinitionName - name of the custom action definition
|
|
608
685
|
*/
|
|
609
|
-
function addLineItemsTypeToSchema(data, columnDefinitionName =
|
|
686
|
+
function addLineItemsTypeToSchema(data, columnDefinitionName = ux_specification_types_2.DefinitionName.TableColumn, customColumnDefinitionName = ux_specification_types_2.DefinitionName.CustomColumn, customActionDefinitionName = ux_specification_types_2.DefinitionName.CustomTableAction) {
|
|
610
687
|
const { actions, lineItemPath } = (0, common_1.addCommonLineItemDefinitions)(data.isObjectPage, data.appSchema, data.lineItemAnnotation, data.entityType, data.lineItemId, customColumnDefinitionName, customActionDefinitionName);
|
|
611
688
|
appendLineItemsToSchema(data, actions, lineItemPath, undefined, columnDefinitionName);
|
|
612
689
|
}
|
|
@@ -619,7 +696,7 @@ function addLineItemsTypeToSchema(data, columnDefinitionName = ux_specification_
|
|
|
619
696
|
* @param positionName - ID of the definition of custom column position in schema
|
|
620
697
|
* @param sectionIdInManifest - identifier of the current object page section in manifest
|
|
621
698
|
*/
|
|
622
|
-
function addFragmentEnumForAnchor(appSchema, lineItemId, v4Page, positionName =
|
|
699
|
+
function addFragmentEnumForAnchor(appSchema, lineItemId, v4Page, positionName = ux_specification_types_2.DefinitionName.Position, sectionIdInManifest) {
|
|
623
700
|
const columns = appSchema.definitions[lineItemId]?.properties;
|
|
624
701
|
const enumEntries = [];
|
|
625
702
|
if (columns) {
|
|
@@ -629,7 +706,7 @@ function addFragmentEnumForAnchor(appSchema, lineItemId, v4Page, positionName =
|
|
|
629
706
|
}
|
|
630
707
|
}
|
|
631
708
|
}
|
|
632
|
-
const id = lineItemId !==
|
|
709
|
+
const id = lineItemId !== ux_specification_types_2.DefinitionName.LineItems ? sectionIdInManifest : `@${"com.sap.vocabularies.UI.v1.LineItem" /* UIAnnotationTerms.LineItem */}`;
|
|
633
710
|
const columnsInManifest = v4Page.options?.settings?.controlConfiguration?.[id]?.['columns'];
|
|
634
711
|
if (columnsInManifest) {
|
|
635
712
|
for (const key in columnsInManifest) {
|
|
@@ -650,7 +727,7 @@ function addFragmentEnumForAnchor(appSchema, lineItemId, v4Page, positionName =
|
|
|
650
727
|
* @param definitionId - definition key of actions
|
|
651
728
|
* @param positionName - target definition to update
|
|
652
729
|
*/
|
|
653
|
-
function addEnumForActionAnchor(appSchema, definitionId, positionName =
|
|
730
|
+
function addEnumForActionAnchor(appSchema, definitionId, positionName = ux_specification_types_2.DefinitionName.CustomActionPosition) {
|
|
654
731
|
(0, common_1.addDescriptiveEnumDefinition)(appSchema, appSchema.definitions[definitionId], {
|
|
655
732
|
definition: positionName,
|
|
656
733
|
property: 'anchor'
|
|
@@ -675,7 +752,7 @@ function findPageV4(pages, templateName, entitySet, contextPath) {
|
|
|
675
752
|
(entitySet?.name && pageSettings.entitySet === entitySet.name);
|
|
676
753
|
if (isConnectionMatches &&
|
|
677
754
|
((0, common_1.compareTemplateNames)(templateName, pages[i].name) ||
|
|
678
|
-
(templateName ===
|
|
755
|
+
(templateName === ux_specification_types_2.v4.FE_TEMPLATE_V4_ALP && pages[i].name === ux_specification_types_2.v4.FE_TEMPLATE_V4_LIST_REPORT))) {
|
|
679
756
|
v4Page = pages[i];
|
|
680
757
|
break;
|
|
681
758
|
}
|
|
@@ -691,23 +768,23 @@ function findPageV4(pages, templateName, entitySet, contextPath) {
|
|
|
691
768
|
*/
|
|
692
769
|
function alignSchemaWithTemplateType(appSchema, generateParameters) {
|
|
693
770
|
let tableDefinitionName;
|
|
694
|
-
const tableDefinition = appSchema.properties[
|
|
695
|
-
if (generateParameters.templateType ===
|
|
696
|
-
tableDefinitionName =
|
|
771
|
+
const tableDefinition = appSchema.properties[ux_specification_types_2.PropertyName.table];
|
|
772
|
+
if (generateParameters.templateType === ux_specification_types_2.TemplateType.AnalyticalListPageV4) {
|
|
773
|
+
tableDefinitionName = ux_specification_types_2.DefinitionName.ALPTableView;
|
|
697
774
|
delete tableDefinition.anyOf;
|
|
698
|
-
tableDefinition.$ref = `${utils_1.DEFINITION_LINK_PREFIX}${
|
|
699
|
-
delete appSchema.definitions[
|
|
700
|
-
delete appSchema.definitions[
|
|
701
|
-
delete appSchema.definitions[
|
|
702
|
-
delete appSchema.definitions[
|
|
703
|
-
}
|
|
704
|
-
else if (generateParameters.templateType ===
|
|
705
|
-
tableDefinitionName =
|
|
775
|
+
tableDefinition.$ref = `${utils_1.DEFINITION_LINK_PREFIX}${ux_specification_types_2.DefinitionName.ALPTableView}`;
|
|
776
|
+
delete appSchema.definitions[ux_specification_types_2.DefinitionName.Table];
|
|
777
|
+
delete appSchema.definitions[ux_specification_types_2.DefinitionName.LRChartView];
|
|
778
|
+
delete appSchema.definitions[ux_specification_types_2.DefinitionName.LRTableView];
|
|
779
|
+
delete appSchema.definitions[ux_specification_types_2.DefinitionName.MultiTableModeV4];
|
|
780
|
+
}
|
|
781
|
+
else if (generateParameters.templateType === ux_specification_types_2.TemplateType.ListReportObjectPageV4) {
|
|
782
|
+
tableDefinitionName = ux_specification_types_2.DefinitionName.Table;
|
|
706
783
|
delete tableDefinition.anyOf;
|
|
707
|
-
tableDefinition.$ref = `${utils_1.DEFINITION_LINK_PREFIX}${
|
|
708
|
-
appSchema.definitions[tableDefinitionName].properties[
|
|
709
|
-
delete appSchema.definitions[
|
|
710
|
-
appSchema.properties[
|
|
784
|
+
tableDefinition.$ref = `${utils_1.DEFINITION_LINK_PREFIX}${ux_specification_types_2.DefinitionName.Table}`;
|
|
785
|
+
appSchema.definitions[tableDefinitionName].properties[ux_specification_types_2.PropertyName.annotationPath][ux_specification_types_2.SchemaTag.hidden] = true;
|
|
786
|
+
delete appSchema.definitions[ux_specification_types_2.DefinitionName.ALPTableView];
|
|
787
|
+
appSchema.properties[ux_specification_types_2.PropertyName.defaultPath][ux_specification_types_2.SchemaTag.hidden] = true;
|
|
711
788
|
}
|
|
712
789
|
return tableDefinitionName;
|
|
713
790
|
}
|
|
@@ -721,7 +798,7 @@ function alignSchemaWithTemplateType(appSchema, generateParameters) {
|
|
|
721
798
|
* @param sectionDefinitionName - identifier of the current object page section in schema
|
|
722
799
|
* @param sectionIdInManifest - identifier of the current object page section in manifest
|
|
723
800
|
*/
|
|
724
|
-
function addCustomActionDefinition(appSchema, v4Page, logger, customActionDefinitionName =
|
|
801
|
+
function addCustomActionDefinition(appSchema, v4Page, logger, customActionDefinitionName = ux_specification_types_2.DefinitionName.CustomTableAction, sectionDefinitionName = '', sectionIdInManifest = '') {
|
|
725
802
|
const definition = appSchema.definitions[sectionDefinitionName];
|
|
726
803
|
if (!definition) {
|
|
727
804
|
return;
|
|
@@ -730,7 +807,7 @@ function addCustomActionDefinition(appSchema, v4Page, logger, customActionDefini
|
|
|
730
807
|
let sortedActionsArray = sortPropertiesRecords(definition);
|
|
731
808
|
let configId;
|
|
732
809
|
if (sectionIdInManifest) {
|
|
733
|
-
if (customActionDefinitionName.indexOf(
|
|
810
|
+
if (customActionDefinitionName.indexOf(ux_specification_types_2.DefinitionName.CustomFormActionOP) !== -1) {
|
|
734
811
|
configId = sectionIdInManifest.replace(/::/g, '#');
|
|
735
812
|
}
|
|
736
813
|
else {
|
|
@@ -738,7 +815,7 @@ function addCustomActionDefinition(appSchema, v4Page, logger, customActionDefini
|
|
|
738
815
|
}
|
|
739
816
|
}
|
|
740
817
|
else {
|
|
741
|
-
if (customActionDefinitionName ===
|
|
818
|
+
if (customActionDefinitionName === ux_specification_types_2.DefinitionName.CustomFormActionOP) {
|
|
742
819
|
configId = `@${"com.sap.vocabularies.UI.v1.FieldGroup" /* UIAnnotationTerms.FieldGroup */}`;
|
|
743
820
|
}
|
|
744
821
|
else {
|
|
@@ -746,7 +823,7 @@ function addCustomActionDefinition(appSchema, v4Page, logger, customActionDefini
|
|
|
746
823
|
}
|
|
747
824
|
}
|
|
748
825
|
let actions;
|
|
749
|
-
if (sectionDefinitionName.includes(
|
|
826
|
+
if (sectionDefinitionName.includes(ux_specification_types_2.DefinitionName.ObjectPageCustomSectionActions)) {
|
|
750
827
|
actions = v4Page.options?.settings?.content?.body?.sections?.[configId]?.['actions'];
|
|
751
828
|
}
|
|
752
829
|
else {
|
|
@@ -758,7 +835,7 @@ function addCustomActionDefinition(appSchema, v4Page, logger, customActionDefini
|
|
|
758
835
|
// Adjust propertyIndex
|
|
759
836
|
if (sortedActionsArray) {
|
|
760
837
|
for (let index = 0; index < sortedActionsArray.length; index++) {
|
|
761
|
-
sortedActionsArray[index][1][
|
|
838
|
+
sortedActionsArray[index][1][ux_specification_types_2.SchemaTag.propertyIndex] = index;
|
|
762
839
|
}
|
|
763
840
|
const sortedActionsAsObject = {};
|
|
764
841
|
sortedActionsArray.forEach(([key, value]) => (sortedActionsAsObject[key] = value));
|
|
@@ -774,7 +851,7 @@ function addCustomActionDefinition(appSchema, v4Page, logger, customActionDefini
|
|
|
774
851
|
* @param customActionDefinitionName - definition name of custom action
|
|
775
852
|
* @param sectionId - identifier of the current object page section in schema
|
|
776
853
|
*/
|
|
777
|
-
function addHeaderFooterCustomActionDefinition(appSchema, v4Page, logger, customActionDefinitionName =
|
|
854
|
+
function addHeaderFooterCustomActionDefinition(appSchema, v4Page, logger, customActionDefinitionName = ux_specification_types_2.DefinitionName.CustomHeaderActionOP, sectionId = '') {
|
|
778
855
|
const definition = appSchema.definitions[sectionId];
|
|
779
856
|
if (!definition) {
|
|
780
857
|
return;
|
|
@@ -782,7 +859,7 @@ function addHeaderFooterCustomActionDefinition(appSchema, v4Page, logger, custom
|
|
|
782
859
|
// Sort existing actions
|
|
783
860
|
let sortedActionsArray = sortPropertiesRecords(definition);
|
|
784
861
|
let actions;
|
|
785
|
-
if ([
|
|
862
|
+
if ([ux_specification_types_2.DefinitionName.CustomHeaderAction, ux_specification_types_2.DefinitionName.CustomHeaderActionOP].includes(customActionDefinitionName)) {
|
|
786
863
|
actions = v4Page.options?.settings?.content?.header?.['actions'];
|
|
787
864
|
}
|
|
788
865
|
else {
|
|
@@ -795,7 +872,7 @@ function addHeaderFooterCustomActionDefinition(appSchema, v4Page, logger, custom
|
|
|
795
872
|
const sortedActionsAsObject = {};
|
|
796
873
|
if (sortedActionsArray) {
|
|
797
874
|
for (let index = 0; index < sortedActionsArray.length; index++) {
|
|
798
|
-
sortedActionsArray[index][1][
|
|
875
|
+
sortedActionsArray[index][1][ux_specification_types_2.SchemaTag.propertyIndex] = index;
|
|
799
876
|
}
|
|
800
877
|
sortedActionsArray.forEach(([key, value]) => (sortedActionsAsObject[key] = value));
|
|
801
878
|
}
|
|
@@ -811,7 +888,7 @@ function addHeaderFooterCustomActionDefinition(appSchema, v4Page, logger, custom
|
|
|
811
888
|
*/
|
|
812
889
|
function getManifestPage(manifest, pageId, logger) {
|
|
813
890
|
const pages = (0, utils_1.getJSONPropertyByPath)(manifest, [
|
|
814
|
-
|
|
891
|
+
ux_specification_types_2.ManifestSection.ui5,
|
|
815
892
|
'routing',
|
|
816
893
|
'targets'
|
|
817
894
|
]);
|
|
@@ -820,8 +897,8 @@ function getManifestPage(manifest, pageId, logger) {
|
|
|
820
897
|
severity: "error" /* LogSeverity.Error */,
|
|
821
898
|
message: i18next_1.default.t('NOTARGETS'),
|
|
822
899
|
location: {
|
|
823
|
-
path:
|
|
824
|
-
range: [
|
|
900
|
+
path: ux_specification_types_2.MANIFESTPATH,
|
|
901
|
+
range: [ux_specification_types_2.ManifestSection.ui5, 'routing']
|
|
825
902
|
}
|
|
826
903
|
});
|
|
827
904
|
return;
|
|
@@ -832,8 +909,8 @@ function getManifestPage(manifest, pageId, logger) {
|
|
|
832
909
|
severity: "error" /* LogSeverity.Error */,
|
|
833
910
|
message: i18next_1.default.t('NOROUTINGID', { routingId: pageId }),
|
|
834
911
|
location: {
|
|
835
|
-
path:
|
|
836
|
-
range: [
|
|
912
|
+
path: ux_specification_types_2.MANIFESTPATH,
|
|
913
|
+
range: [ux_specification_types_2.ManifestSection.ui5, 'routing']
|
|
837
914
|
}
|
|
838
915
|
});
|
|
839
916
|
return;
|
|
@@ -909,7 +986,7 @@ function addCustomSectionDefinition(appSchema, definition, v4Page, customSection
|
|
|
909
986
|
const annotationSectionsMap = new Map();
|
|
910
987
|
sortedSectionsArray = sortedSectionsArray.map((annotationSection) => {
|
|
911
988
|
const entry = (0, common_1.getEnumEntry)(appSchema, annotationSection[1], annotationSection[0], {
|
|
912
|
-
keyProperties: [
|
|
989
|
+
keyProperties: [ux_specification_types_2.SchemaKeyName.id],
|
|
913
990
|
descriptionAsFallback: true,
|
|
914
991
|
resolveDefinition: true
|
|
915
992
|
});
|
|
@@ -924,7 +1001,7 @@ function addCustomSectionDefinition(appSchema, definition, v4Page, customSection
|
|
|
924
1001
|
sortedSectionsArray = addExtensionToArray(section.subSections, sortedSectionsArray, customSectionRef, 'template', logger, isMergedSections);
|
|
925
1002
|
}
|
|
926
1003
|
}
|
|
927
|
-
else if (customSectionRef.includes(
|
|
1004
|
+
else if (customSectionRef.includes(ux_specification_types_2.DefinitionName.ObjectPageCustomHeaderSectionFragment)) {
|
|
928
1005
|
// header custom section extensions
|
|
929
1006
|
const header = v4Page.options?.settings?.content?.header;
|
|
930
1007
|
if (header && 'facets' in header) {
|
|
@@ -942,7 +1019,7 @@ function addCustomSectionDefinition(appSchema, definition, v4Page, customSection
|
|
|
942
1019
|
}
|
|
943
1020
|
// Adjust propertyIndex
|
|
944
1021
|
for (let index = 0; index < sortedSectionsArray.length; index++) {
|
|
945
|
-
sortedSectionsArray[index][1][
|
|
1022
|
+
sortedSectionsArray[index][1][ux_specification_types_2.SchemaTag.propertyIndex] = index;
|
|
946
1023
|
}
|
|
947
1024
|
const sortedActionsAsObject = {};
|
|
948
1025
|
sortedSectionsArray.forEach(([key, value]) => {
|
|
@@ -963,7 +1040,7 @@ function addCustomFilterFieldDefinition(appSchema, definition, v4Page) {
|
|
|
963
1040
|
const annotationSectionsMap = new Map();
|
|
964
1041
|
sortedFilterFieldsArray = sortedFilterFieldsArray.map((annotationSection) => {
|
|
965
1042
|
const entry = (0, common_1.getEnumEntry)(appSchema, annotationSection[1], annotationSection[0], {
|
|
966
|
-
keyProperties: [
|
|
1043
|
+
keyProperties: [ux_specification_types_2.SchemaKeyName.value],
|
|
967
1044
|
descriptionAsFallback: true,
|
|
968
1045
|
resolveDefinition: true
|
|
969
1046
|
});
|
|
@@ -974,11 +1051,11 @@ function addCustomFilterFieldDefinition(appSchema, definition, v4Page) {
|
|
|
974
1051
|
const selectionFieldsEntry = v4Page.options?.settings?.controlConfiguration?.[`@${"com.sap.vocabularies.UI.v1.SelectionFields" /* UIAnnotationTerms.SelectionFields */}`];
|
|
975
1052
|
if (typeof selectionFieldsEntry === 'object' && 'filterFields' in selectionFieldsEntry) {
|
|
976
1053
|
// add extension to subsection of section
|
|
977
|
-
sortedFilterFieldsArray = addExtensionToArray(selectionFieldsEntry.filterFields, sortedFilterFieldsArray,
|
|
1054
|
+
sortedFilterFieldsArray = addExtensionToArray(selectionFieldsEntry.filterFields, sortedFilterFieldsArray, ux_specification_types_2.DefinitionName.CustomFilterField, 'template');
|
|
978
1055
|
}
|
|
979
1056
|
// Adjust propertyIndex
|
|
980
1057
|
for (let index = 0; index < sortedFilterFieldsArray.length; index++) {
|
|
981
|
-
sortedFilterFieldsArray[index][1][
|
|
1058
|
+
sortedFilterFieldsArray[index][1][ux_specification_types_2.SchemaTag.propertyIndex] = index;
|
|
982
1059
|
}
|
|
983
1060
|
const sortedFilterFieldsAsObject = {};
|
|
984
1061
|
sortedFilterFieldsArray.forEach(([key, value]) => {
|
|
@@ -987,4 +1064,93 @@ function addCustomFilterFieldDefinition(appSchema, definition, v4Page) {
|
|
|
987
1064
|
});
|
|
988
1065
|
definition.properties = sortedFilterFieldsAsObject;
|
|
989
1066
|
}
|
|
1067
|
+
/**
|
|
1068
|
+
* Imports action settings into a configuration object and applies necessary transformations based on provided parameters.
|
|
1069
|
+
*
|
|
1070
|
+
* @param {object} importActionParams - Parameters required for importing action settings, including schema, factory, and action specifications.
|
|
1071
|
+
* @param {string} key - The key used to identify the specific configuration or schema definition.
|
|
1072
|
+
* @param {boolean} [keepEmptyAction] - Determines whether to keep empty actions in the configuration object.
|
|
1073
|
+
* @returns {void} This method does not return any value.
|
|
1074
|
+
*/
|
|
1075
|
+
function importActionToConfigurationObject(importActionParams, key, keepEmptyAction = false) {
|
|
1076
|
+
const { appSchema, factory, actionsInConfig, actionKey, manifest, routingId, manifestSectionId, targetAnnotation } = importActionParams;
|
|
1077
|
+
const schemaPropertyName = (key ?? '').split('<')[0];
|
|
1078
|
+
const metaInstance = factory.createInstance(ux_specification_types_1.PageTypeV4.ObjectPage, schemaPropertyName);
|
|
1079
|
+
const breadcrumbs = [actionKey.replace('/', '??')];
|
|
1080
|
+
if (targetAnnotation) {
|
|
1081
|
+
breadcrumbs.push(targetAnnotation);
|
|
1082
|
+
}
|
|
1083
|
+
if (metaInstance) {
|
|
1084
|
+
const action = (actionsInConfig[actionKey] = metaInstance);
|
|
1085
|
+
(0, utils_2.importSettingsOfObject)(action, manifest, appSchema.definitions[key], routingId, breadcrumbs, manifestSectionId);
|
|
1086
|
+
if (!keepEmptyAction) {
|
|
1087
|
+
(0, common_1.removeEmptyStructure)(actionsInConfig, actionKey);
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
/**
|
|
1092
|
+
* Imports the settings of a single action reference into the configuration object.
|
|
1093
|
+
*
|
|
1094
|
+
* @param {ImportActionSettingsOfReferenceParams} importActionParams - The parameters required for importing action settings, including property definitions.
|
|
1095
|
+
* @param {Definition} definitionOfReference - The reference definition object used to resolve the action.
|
|
1096
|
+
* @returns {void} This function does not return a value.
|
|
1097
|
+
*/
|
|
1098
|
+
function importSingleActionSettingsOfReference(importActionParams, definitionOfReference) {
|
|
1099
|
+
const { actionPropertyDefinition } = importActionParams;
|
|
1100
|
+
const key = (0, utils_1.getDefinitionKey)(definitionOfReference.$ref || actionPropertyDefinition.$ref);
|
|
1101
|
+
importActionToConfigurationObject(importActionParams, key);
|
|
1102
|
+
}
|
|
1103
|
+
/**
|
|
1104
|
+
* Imports and processes the settings for a group of actions based on a reference definition.
|
|
1105
|
+
*
|
|
1106
|
+
* @param {ImportActionSettingsOfReferenceParams} importActionParams - The parameters used for importing and configuring the action settings.
|
|
1107
|
+
* @param {Definition} definitionOfReference - The reference definition from which the action group settings are imported.
|
|
1108
|
+
* @returns {void} This function does not return a value; it modifies the configurations directly.
|
|
1109
|
+
*/
|
|
1110
|
+
function importGroupActionSettingsOfReference(importActionParams, definitionOfReference) {
|
|
1111
|
+
const { actionPropertyDefinition, appSchema, actionsInConfig, actionKey } = importActionParams;
|
|
1112
|
+
// create an instance of the action group in the configuration object
|
|
1113
|
+
const key = (0, utils_1.getDefinitionKey)(definitionOfReference.$ref ?? actionPropertyDefinition.$ref);
|
|
1114
|
+
importActionToConfigurationObject(importActionParams, key, true);
|
|
1115
|
+
// newly created action group instance is available in the actionsInConfig object
|
|
1116
|
+
const actionGroup = actionsInConfig[actionKey];
|
|
1117
|
+
// add a warning message for all versions that don't support action groups
|
|
1118
|
+
(0, common_1.addMessageToSchema)(actionGroup, i18next_1.default.t('ACTION_GROUPS_ARENT_SUPPORTED'));
|
|
1119
|
+
// fill the action group with the action settings of the group action
|
|
1120
|
+
const { properties } = definitionOfReference;
|
|
1121
|
+
for (const propertyKey in properties) {
|
|
1122
|
+
const actionInGroupProperty = properties[propertyKey];
|
|
1123
|
+
const actionInGroupPropertyKey = (0, utils_1.getDefinitionKey)(actionInGroupProperty['$ref']);
|
|
1124
|
+
const actionInGroupDefinition = appSchema.definitions[actionInGroupPropertyKey];
|
|
1125
|
+
const key = (0, utils_1.getDefinitionKey)(actionInGroupDefinition.$ref ?? actionInGroupProperty['$ref']);
|
|
1126
|
+
const importGroupedActionParams = {
|
|
1127
|
+
...importActionParams,
|
|
1128
|
+
actionsInConfig: actionGroup,
|
|
1129
|
+
actionKey: propertyKey
|
|
1130
|
+
// targetAnnotation: undefined
|
|
1131
|
+
};
|
|
1132
|
+
importActionToConfigurationObject(importGroupedActionParams, key);
|
|
1133
|
+
}
|
|
1134
|
+
(0, common_1.removeEmptyStructure)(actionsInConfig, actionKey);
|
|
1135
|
+
}
|
|
1136
|
+
/**
|
|
1137
|
+
* Imports the action settings of a specified reference based on the given parameters.
|
|
1138
|
+
*
|
|
1139
|
+
* @param {object} importActionParams - The parameters required for importing action settings.
|
|
1140
|
+
* @param {object} importActionParams.actionPropertyDefinition - The action property definition containing the $ref to the reference.
|
|
1141
|
+
* @param {object} importActionParams.appSchema - The application schema containing definitions and other related metadata.
|
|
1142
|
+
* @returns {void} This function does not return a value.
|
|
1143
|
+
*/
|
|
1144
|
+
function importActionSettingsOfReference(importActionParams) {
|
|
1145
|
+
const { actionPropertyDefinition, appSchema } = importActionParams;
|
|
1146
|
+
const definitionKey = (0, utils_1.getDefinitionKey)(actionPropertyDefinition.$ref);
|
|
1147
|
+
const definitionOfReference = appSchema.definitions[definitionKey];
|
|
1148
|
+
const actionType = definitionOfReference['dataType'];
|
|
1149
|
+
if (actionType === exports.DATA_FIELD_FOR_ACTION_GROUP) {
|
|
1150
|
+
importGroupActionSettingsOfReference(importActionParams, definitionOfReference);
|
|
1151
|
+
}
|
|
1152
|
+
else {
|
|
1153
|
+
importSingleActionSettingsOfReference(importActionParams, definitionOfReference);
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
990
1156
|
//# sourceMappingURL=utils.js.map
|