@sap/ux-specification 1.124.19 → 1.136.0
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 +7 -481
- 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-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 +106 -106
- package/dist/index-min.js.map +4 -4
- package/dist/schemas/v4/ApplicationV4.json +47 -0
- package/dist/schemas/v4/BuildingBlocksConfig.json +2499 -1001
- package/dist/schemas/v4/ListReportConfig.json +19 -1
- package/dist/schemas/v4/ObjectPageConfig.json +27 -0
- package/dist/specification/package.json +4 -4
- 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 +356 -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 +164 -59
- package/dist/specification/src/sync/common/generate/objectPage.js.map +1 -1
- package/dist/specification/src/sync/common/generate/utils.d.ts +9 -1
- package/dist/specification/src/sync/common/generate/utils.d.ts.map +1 -1
- package/dist/specification/src/sync/common/generate/utils.js +18 -0
- package/dist/specification/src/sync/common/generate/utils.js.map +1 -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 +27 -64
- package/dist/specification/src/sync/common/utils.js.map +1 -1
- package/dist/specification/src/sync/v4/application.d.ts +1 -0
- package/dist/specification/src/sync/v4/application.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/application.js +22 -0
- package/dist/specification/src/sync/v4/application.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 +15 -2
- package/dist/specification/src/sync/v4/export/export.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 +42 -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 +68 -2
- package/dist/specification/src/sync/v4/utils/utils.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/utils/utils.js +273 -121
- 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/common/webapp/manifest/Manifest.d.ts +2 -1
- package/dist/types/src/common/webapp/manifest/Manifest.d.ts.map +1 -1
- package/dist/types/src/common/webapp/manifest/Manifest.js +1 -0
- package/dist/types/src/common/webapp/manifest/Manifest.js.map +1 -1
- package/dist/types/src/v4/application.d.ts +39 -0
- package/dist/types/src/v4/application.d.ts.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/dist/types/src/v4/pages/ListReportConfigV4.d.ts +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,38 +469,37 @@ 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=true] - 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}`] = {
|
|
@@ -500,44 +513,97 @@ function addActionRecordToSchema(data, actionsDefinition, lineItemPath, lineItem
|
|
|
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
522
|
const action = (0, common_1.parseSchemaDefinition)(actionDefinitionName, (0, common_1.prepareRef)(propertyKey), data.appSchema);
|
|
510
|
-
action[
|
|
523
|
+
action[ux_specification_types_2.SchemaTag.annotationPath] = `${lineItemPath}/${recordIndex}`;
|
|
511
524
|
}
|
|
512
525
|
else {
|
|
513
|
-
actionDefinition[
|
|
526
|
+
actionDefinition[ux_specification_types_2.SchemaTag.annotationPath] = `${lineItemPath}/${recordIndex}`;
|
|
514
527
|
}
|
|
515
528
|
}
|
|
516
529
|
/**
|
|
517
|
-
*
|
|
530
|
+
* Adds a group action record to the schema definition of a line item.
|
|
518
531
|
*
|
|
519
|
-
* @param
|
|
520
|
-
* @
|
|
521
|
-
* @param columnDefinitionName - Schema definition name for the column
|
|
522
|
-
* @param recordIndex - record index in the collection
|
|
523
|
-
* @param lineItemDefinition - line item definition
|
|
532
|
+
* @param {AddLineItemDefinitionParams} lineItemDefinitionParams - Parameters required for defining the schema of a line item including data, record, path, index, and actions.
|
|
533
|
+
* @returns {void} No return value.
|
|
524
534
|
*/
|
|
525
|
-
function
|
|
526
|
-
const
|
|
527
|
-
|
|
535
|
+
function addGroupActionRecordToSchema(lineItemDefinitionParams) {
|
|
536
|
+
const { lineItemData, lineItemRecord, lineItemPath, index, actions } = lineItemDefinitionParams;
|
|
537
|
+
//no footer bar -> toolbar action
|
|
538
|
+
const actionDefinitionName = determineActionDefinitionName(lineItemData, lineItemRecord);
|
|
539
|
+
const propertyKey = (0, StableIdHelper_1.getStableIdPartFromDataField)(lineItemRecord);
|
|
540
|
+
actions.properties[`${propertyKey}`] = {
|
|
541
|
+
$ref: (0, common_1.getFacetDefinitionLink)(actionDefinitionName, (0, common_1.prepareRef)(propertyKey))
|
|
542
|
+
};
|
|
543
|
+
const actionDefinition = (0, common_1.parseSchemaDefinition)(actionDefinitionName, (0, common_1.prepareRef)(propertyKey), lineItemData.appSchema);
|
|
544
|
+
actionDefinition.properties = {};
|
|
545
|
+
actionDefinition.description = (0, common_1.getDataFieldDescription)(lineItemRecord, lineItemData.entityType);
|
|
546
|
+
actionDefinition.type = 'object';
|
|
547
|
+
actionDefinition.isViewNode = true;
|
|
548
|
+
actionDefinition[ux_specification_types_2.SchemaTag.propertyIndex] = index;
|
|
549
|
+
actionDefinition[ux_specification_types_2.SchemaTag.dataType] = (0, common_1.determineDataType)(lineItemRecord);
|
|
550
|
+
actionDefinition[ux_specification_types_2.SchemaTag.annotationPath] = `${lineItemPath}/${index}`;
|
|
551
|
+
(lineItemRecord['Actions'] ?? []).forEach((action, index) => {
|
|
552
|
+
const lineItemActionDefinitionParams = {
|
|
553
|
+
...lineItemDefinitionParams,
|
|
554
|
+
lineItemRecord: action,
|
|
555
|
+
lineItemPath: `${actionDefinition[ux_specification_types_2.SchemaTag.annotationPath]}/Actions`,
|
|
556
|
+
actions: actionDefinition,
|
|
557
|
+
index
|
|
558
|
+
};
|
|
559
|
+
addActionRecordToSchema(lineItemActionDefinitionParams);
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* Adds a line item action definition to the schema based on the provided parameters.
|
|
564
|
+
* Handles determining which action to take based on specific conditions of the line item record.
|
|
565
|
+
*
|
|
566
|
+
* @param {AddLineItemDefinitionParams} data - An object containing the details of the line item record and the line item definition.
|
|
567
|
+
* @param {object} data.lineItemRecord - The record of the line item to be processed, containing relevant properties.
|
|
568
|
+
* @param {boolean} data.lineItemRecord.Inline - Indicates whether the line item is inline.
|
|
569
|
+
* @param {boolean} data.lineItemRecord.Determining - Indicates if the line item is determining.
|
|
570
|
+
* @param {boolean} data.lineItemDefinition - Indicates whether the line item definition is present.
|
|
571
|
+
* @returns {void} This method does not return a value.
|
|
572
|
+
*/
|
|
573
|
+
function addLineItemActionDefinition(data) {
|
|
574
|
+
const { lineItemRecord, lineItemDefinition } = data;
|
|
575
|
+
if (lineItemRecord.Inline !== true || lineItemRecord.Determining === true) {
|
|
576
|
+
addActionRecordToSchema(data, !lineItemDefinition);
|
|
577
|
+
}
|
|
578
|
+
else {
|
|
579
|
+
addLineItemRecordToSchema(data);
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* Adds a line item record to the provided schema based on the definition parameters.
|
|
584
|
+
*
|
|
585
|
+
* @param {AddLineItemDefinitionParams} lineItemDefinitionParams - The parameters defining the line item data, schema information, and record.
|
|
586
|
+
* @returns {void} This function does not return a value.
|
|
587
|
+
*/
|
|
588
|
+
function addLineItemRecordToSchema(lineItemDefinitionParams) {
|
|
589
|
+
const { lineItemData, lineItemRecord, lineItemDefinition, lineItemPath, index, columnDefinitionName } = lineItemDefinitionParams;
|
|
590
|
+
const columnDefinition = lineItemRecord.$Type === "com.sap.vocabularies.UI.v1.DataFieldForAction" /* UIAnnotationTypes.DataFieldForAction */
|
|
591
|
+
? `${columnDefinitionName}Action`
|
|
592
|
+
: columnDefinitionName;
|
|
593
|
+
const lineItemId = lineItemData.lineItemId;
|
|
528
594
|
if (lineItemRecord['Target']?.['value']) {
|
|
529
|
-
const regex = `@${(0, utils_1.findAlias)(
|
|
595
|
+
const regex = `@${(0, utils_1.findAlias)(ux_specification_types_2.UIVOCABULARY, lineItemData.oDataServiceAVT)}.`;
|
|
530
596
|
lineItemRecord['Target']['value'] = lineItemRecord['Target']['value'].replace(regex, '@');
|
|
531
597
|
}
|
|
532
598
|
const schemaKey = (0, StableIdHelper_1.getStableIdPartFromDataField)(lineItemRecord).replace(/\//g, '::');
|
|
533
599
|
if (schemaKey) {
|
|
534
600
|
let columnsDefinition = lineItemDefinition;
|
|
535
601
|
if (!columnsDefinition) {
|
|
536
|
-
columnsDefinition =
|
|
602
|
+
columnsDefinition = lineItemData.appSchema.definitions[lineItemId];
|
|
537
603
|
}
|
|
538
604
|
const properties = columnsDefinition.properties;
|
|
539
605
|
const property = {
|
|
540
|
-
description: (0,
|
|
606
|
+
description: (0, common_1.getDataFieldDescription)(lineItemRecord, lineItemData.entityType)
|
|
541
607
|
};
|
|
542
608
|
if (lineItemDefinition) {
|
|
543
609
|
property.properties = {};
|
|
@@ -545,12 +611,12 @@ function addLineItemRecordToSchema(data, lineItem, columnDefinitionName, recordI
|
|
|
545
611
|
property.isViewNode = true;
|
|
546
612
|
}
|
|
547
613
|
else {
|
|
548
|
-
property.$ref = utils_1.DEFINITION_LINK_PREFIX +
|
|
614
|
+
property.$ref = utils_1.DEFINITION_LINK_PREFIX + columnDefinition;
|
|
549
615
|
}
|
|
550
|
-
property[
|
|
551
|
-
property[
|
|
552
|
-
property[
|
|
553
|
-
property[
|
|
616
|
+
property[ux_specification_types_2.SchemaTag.annotationType] = lineItemRecord?.$Type;
|
|
617
|
+
property[ux_specification_types_2.SchemaTag.annotationPath] = `${lineItemPath}/${index}`;
|
|
618
|
+
property[ux_specification_types_2.SchemaTag.propertyIndex] = index;
|
|
619
|
+
property[ux_specification_types_2.SchemaTag.dataType] = (0, common_1.determineDataType)(lineItemRecord);
|
|
554
620
|
properties[schemaKey] = property;
|
|
555
621
|
(0, common_1.addKeyToDefinition)(lineItemRecord, properties, schemaKey);
|
|
556
622
|
}
|
|
@@ -570,24 +636,23 @@ function addLineItemRecordToSchema(data, lineItem, columnDefinitionName, recordI
|
|
|
570
636
|
* @param {Definition | undefined} lineItemDefinition - line item definition
|
|
571
637
|
* @param {string} columnDefinitionName - line item definition name
|
|
572
638
|
*/
|
|
573
|
-
function appendLineItemsToSchema(data, actions, lineItemPath, lineItemDefinition, columnDefinitionName =
|
|
639
|
+
function appendLineItemsToSchema(data, actions, lineItemPath, lineItemDefinition, columnDefinitionName = ux_specification_types_2.DefinitionName.TableColumn) {
|
|
574
640
|
if (!data.lineItemAnnotation) {
|
|
575
641
|
return;
|
|
576
642
|
}
|
|
577
643
|
let i = 0;
|
|
578
644
|
data.lineItemAnnotation.forEach((lineItemRecord) => {
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
}
|
|
645
|
+
const addLineItemDefinitionsParams = {
|
|
646
|
+
lineItemData: data,
|
|
647
|
+
actions,
|
|
648
|
+
lineItemPath,
|
|
649
|
+
lineItemRecord: lineItemRecord,
|
|
650
|
+
index: i,
|
|
651
|
+
lineItemDefinition,
|
|
652
|
+
columnDefinitionName
|
|
653
|
+
};
|
|
654
|
+
const strategy = DataFieldStrategy_1.dataFieldStrategyContext.getStrategy(lineItemRecord.$Type);
|
|
655
|
+
strategy.addLineItemDefinition(addLineItemDefinitionsParams);
|
|
591
656
|
i++;
|
|
592
657
|
});
|
|
593
658
|
}
|
|
@@ -606,7 +671,7 @@ function appendLineItemsToSchema(data, actions, lineItemPath, lineItemDefinition
|
|
|
606
671
|
* @param customColumnDefinitionName - name of the custom column definition
|
|
607
672
|
* @param customActionDefinitionName - name of the custom action definition
|
|
608
673
|
*/
|
|
609
|
-
function addLineItemsTypeToSchema(data, columnDefinitionName =
|
|
674
|
+
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
675
|
const { actions, lineItemPath } = (0, common_1.addCommonLineItemDefinitions)(data.isObjectPage, data.appSchema, data.lineItemAnnotation, data.entityType, data.lineItemId, customColumnDefinitionName, customActionDefinitionName);
|
|
611
676
|
appendLineItemsToSchema(data, actions, lineItemPath, undefined, columnDefinitionName);
|
|
612
677
|
}
|
|
@@ -619,7 +684,7 @@ function addLineItemsTypeToSchema(data, columnDefinitionName = ux_specification_
|
|
|
619
684
|
* @param positionName - ID of the definition of custom column position in schema
|
|
620
685
|
* @param sectionIdInManifest - identifier of the current object page section in manifest
|
|
621
686
|
*/
|
|
622
|
-
function addFragmentEnumForAnchor(appSchema, lineItemId, v4Page, positionName =
|
|
687
|
+
function addFragmentEnumForAnchor(appSchema, lineItemId, v4Page, positionName = ux_specification_types_2.DefinitionName.Position, sectionIdInManifest) {
|
|
623
688
|
const columns = appSchema.definitions[lineItemId]?.properties;
|
|
624
689
|
const enumEntries = [];
|
|
625
690
|
if (columns) {
|
|
@@ -629,7 +694,7 @@ function addFragmentEnumForAnchor(appSchema, lineItemId, v4Page, positionName =
|
|
|
629
694
|
}
|
|
630
695
|
}
|
|
631
696
|
}
|
|
632
|
-
const id = lineItemId !==
|
|
697
|
+
const id = lineItemId !== ux_specification_types_2.DefinitionName.LineItems ? sectionIdInManifest : `@${"com.sap.vocabularies.UI.v1.LineItem" /* UIAnnotationTerms.LineItem */}`;
|
|
633
698
|
const columnsInManifest = v4Page.options?.settings?.controlConfiguration?.[id]?.['columns'];
|
|
634
699
|
if (columnsInManifest) {
|
|
635
700
|
for (const key in columnsInManifest) {
|
|
@@ -650,7 +715,7 @@ function addFragmentEnumForAnchor(appSchema, lineItemId, v4Page, positionName =
|
|
|
650
715
|
* @param definitionId - definition key of actions
|
|
651
716
|
* @param positionName - target definition to update
|
|
652
717
|
*/
|
|
653
|
-
function addEnumForActionAnchor(appSchema, definitionId, positionName =
|
|
718
|
+
function addEnumForActionAnchor(appSchema, definitionId, positionName = ux_specification_types_2.DefinitionName.CustomActionPosition) {
|
|
654
719
|
(0, common_1.addDescriptiveEnumDefinition)(appSchema, appSchema.definitions[definitionId], {
|
|
655
720
|
definition: positionName,
|
|
656
721
|
property: 'anchor'
|
|
@@ -675,7 +740,7 @@ function findPageV4(pages, templateName, entitySet, contextPath) {
|
|
|
675
740
|
(entitySet?.name && pageSettings.entitySet === entitySet.name);
|
|
676
741
|
if (isConnectionMatches &&
|
|
677
742
|
((0, common_1.compareTemplateNames)(templateName, pages[i].name) ||
|
|
678
|
-
(templateName ===
|
|
743
|
+
(templateName === ux_specification_types_2.v4.FE_TEMPLATE_V4_ALP && pages[i].name === ux_specification_types_2.v4.FE_TEMPLATE_V4_LIST_REPORT))) {
|
|
679
744
|
v4Page = pages[i];
|
|
680
745
|
break;
|
|
681
746
|
}
|
|
@@ -691,23 +756,23 @@ function findPageV4(pages, templateName, entitySet, contextPath) {
|
|
|
691
756
|
*/
|
|
692
757
|
function alignSchemaWithTemplateType(appSchema, generateParameters) {
|
|
693
758
|
let tableDefinitionName;
|
|
694
|
-
const tableDefinition = appSchema.properties[
|
|
695
|
-
if (generateParameters.templateType ===
|
|
696
|
-
tableDefinitionName =
|
|
759
|
+
const tableDefinition = appSchema.properties[ux_specification_types_2.PropertyName.table];
|
|
760
|
+
if (generateParameters.templateType === ux_specification_types_2.TemplateType.AnalyticalListPageV4) {
|
|
761
|
+
tableDefinitionName = ux_specification_types_2.DefinitionName.ALPTableView;
|
|
697
762
|
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 =
|
|
763
|
+
tableDefinition.$ref = `${utils_1.DEFINITION_LINK_PREFIX}${ux_specification_types_2.DefinitionName.ALPTableView}`;
|
|
764
|
+
delete appSchema.definitions[ux_specification_types_2.DefinitionName.Table];
|
|
765
|
+
delete appSchema.definitions[ux_specification_types_2.DefinitionName.LRChartView];
|
|
766
|
+
delete appSchema.definitions[ux_specification_types_2.DefinitionName.LRTableView];
|
|
767
|
+
delete appSchema.definitions[ux_specification_types_2.DefinitionName.MultiTableModeV4];
|
|
768
|
+
}
|
|
769
|
+
else if (generateParameters.templateType === ux_specification_types_2.TemplateType.ListReportObjectPageV4) {
|
|
770
|
+
tableDefinitionName = ux_specification_types_2.DefinitionName.Table;
|
|
706
771
|
delete tableDefinition.anyOf;
|
|
707
|
-
tableDefinition.$ref = `${utils_1.DEFINITION_LINK_PREFIX}${
|
|
708
|
-
appSchema.definitions[tableDefinitionName].properties[
|
|
709
|
-
delete appSchema.definitions[
|
|
710
|
-
appSchema.properties[
|
|
772
|
+
tableDefinition.$ref = `${utils_1.DEFINITION_LINK_PREFIX}${ux_specification_types_2.DefinitionName.Table}`;
|
|
773
|
+
appSchema.definitions[tableDefinitionName].properties[ux_specification_types_2.PropertyName.annotationPath][ux_specification_types_2.SchemaTag.hidden] = true;
|
|
774
|
+
delete appSchema.definitions[ux_specification_types_2.DefinitionName.ALPTableView];
|
|
775
|
+
appSchema.properties[ux_specification_types_2.PropertyName.defaultPath][ux_specification_types_2.SchemaTag.hidden] = true;
|
|
711
776
|
}
|
|
712
777
|
return tableDefinitionName;
|
|
713
778
|
}
|
|
@@ -721,7 +786,7 @@ function alignSchemaWithTemplateType(appSchema, generateParameters) {
|
|
|
721
786
|
* @param sectionDefinitionName - identifier of the current object page section in schema
|
|
722
787
|
* @param sectionIdInManifest - identifier of the current object page section in manifest
|
|
723
788
|
*/
|
|
724
|
-
function addCustomActionDefinition(appSchema, v4Page, logger, customActionDefinitionName =
|
|
789
|
+
function addCustomActionDefinition(appSchema, v4Page, logger, customActionDefinitionName = ux_specification_types_2.DefinitionName.CustomTableAction, sectionDefinitionName = '', sectionIdInManifest = '') {
|
|
725
790
|
const definition = appSchema.definitions[sectionDefinitionName];
|
|
726
791
|
if (!definition) {
|
|
727
792
|
return;
|
|
@@ -730,7 +795,7 @@ function addCustomActionDefinition(appSchema, v4Page, logger, customActionDefini
|
|
|
730
795
|
let sortedActionsArray = sortPropertiesRecords(definition);
|
|
731
796
|
let configId;
|
|
732
797
|
if (sectionIdInManifest) {
|
|
733
|
-
if (customActionDefinitionName.indexOf(
|
|
798
|
+
if (customActionDefinitionName.indexOf(ux_specification_types_2.DefinitionName.CustomFormActionOP) !== -1) {
|
|
734
799
|
configId = sectionIdInManifest.replace(/::/g, '#');
|
|
735
800
|
}
|
|
736
801
|
else {
|
|
@@ -738,7 +803,7 @@ function addCustomActionDefinition(appSchema, v4Page, logger, customActionDefini
|
|
|
738
803
|
}
|
|
739
804
|
}
|
|
740
805
|
else {
|
|
741
|
-
if (customActionDefinitionName ===
|
|
806
|
+
if (customActionDefinitionName === ux_specification_types_2.DefinitionName.CustomFormActionOP) {
|
|
742
807
|
configId = `@${"com.sap.vocabularies.UI.v1.FieldGroup" /* UIAnnotationTerms.FieldGroup */}`;
|
|
743
808
|
}
|
|
744
809
|
else {
|
|
@@ -746,7 +811,7 @@ function addCustomActionDefinition(appSchema, v4Page, logger, customActionDefini
|
|
|
746
811
|
}
|
|
747
812
|
}
|
|
748
813
|
let actions;
|
|
749
|
-
if (sectionDefinitionName.includes(
|
|
814
|
+
if (sectionDefinitionName.includes(ux_specification_types_2.DefinitionName.ObjectPageCustomSectionActions)) {
|
|
750
815
|
actions = v4Page.options?.settings?.content?.body?.sections?.[configId]?.['actions'];
|
|
751
816
|
}
|
|
752
817
|
else {
|
|
@@ -758,7 +823,7 @@ function addCustomActionDefinition(appSchema, v4Page, logger, customActionDefini
|
|
|
758
823
|
// Adjust propertyIndex
|
|
759
824
|
if (sortedActionsArray) {
|
|
760
825
|
for (let index = 0; index < sortedActionsArray.length; index++) {
|
|
761
|
-
sortedActionsArray[index][1][
|
|
826
|
+
sortedActionsArray[index][1][ux_specification_types_2.SchemaTag.propertyIndex] = index;
|
|
762
827
|
}
|
|
763
828
|
const sortedActionsAsObject = {};
|
|
764
829
|
sortedActionsArray.forEach(([key, value]) => (sortedActionsAsObject[key] = value));
|
|
@@ -774,7 +839,7 @@ function addCustomActionDefinition(appSchema, v4Page, logger, customActionDefini
|
|
|
774
839
|
* @param customActionDefinitionName - definition name of custom action
|
|
775
840
|
* @param sectionId - identifier of the current object page section in schema
|
|
776
841
|
*/
|
|
777
|
-
function addHeaderFooterCustomActionDefinition(appSchema, v4Page, logger, customActionDefinitionName =
|
|
842
|
+
function addHeaderFooterCustomActionDefinition(appSchema, v4Page, logger, customActionDefinitionName = ux_specification_types_2.DefinitionName.CustomHeaderActionOP, sectionId = '') {
|
|
778
843
|
const definition = appSchema.definitions[sectionId];
|
|
779
844
|
if (!definition) {
|
|
780
845
|
return;
|
|
@@ -782,7 +847,7 @@ function addHeaderFooterCustomActionDefinition(appSchema, v4Page, logger, custom
|
|
|
782
847
|
// Sort existing actions
|
|
783
848
|
let sortedActionsArray = sortPropertiesRecords(definition);
|
|
784
849
|
let actions;
|
|
785
|
-
if ([
|
|
850
|
+
if ([ux_specification_types_2.DefinitionName.CustomHeaderAction, ux_specification_types_2.DefinitionName.CustomHeaderActionOP].includes(customActionDefinitionName)) {
|
|
786
851
|
actions = v4Page.options?.settings?.content?.header?.['actions'];
|
|
787
852
|
}
|
|
788
853
|
else {
|
|
@@ -795,7 +860,7 @@ function addHeaderFooterCustomActionDefinition(appSchema, v4Page, logger, custom
|
|
|
795
860
|
const sortedActionsAsObject = {};
|
|
796
861
|
if (sortedActionsArray) {
|
|
797
862
|
for (let index = 0; index < sortedActionsArray.length; index++) {
|
|
798
|
-
sortedActionsArray[index][1][
|
|
863
|
+
sortedActionsArray[index][1][ux_specification_types_2.SchemaTag.propertyIndex] = index;
|
|
799
864
|
}
|
|
800
865
|
sortedActionsArray.forEach(([key, value]) => (sortedActionsAsObject[key] = value));
|
|
801
866
|
}
|
|
@@ -811,7 +876,7 @@ function addHeaderFooterCustomActionDefinition(appSchema, v4Page, logger, custom
|
|
|
811
876
|
*/
|
|
812
877
|
function getManifestPage(manifest, pageId, logger) {
|
|
813
878
|
const pages = (0, utils_1.getJSONPropertyByPath)(manifest, [
|
|
814
|
-
|
|
879
|
+
ux_specification_types_2.ManifestSection.ui5,
|
|
815
880
|
'routing',
|
|
816
881
|
'targets'
|
|
817
882
|
]);
|
|
@@ -820,8 +885,8 @@ function getManifestPage(manifest, pageId, logger) {
|
|
|
820
885
|
severity: "error" /* LogSeverity.Error */,
|
|
821
886
|
message: i18next_1.default.t('NOTARGETS'),
|
|
822
887
|
location: {
|
|
823
|
-
path:
|
|
824
|
-
range: [
|
|
888
|
+
path: ux_specification_types_2.MANIFESTPATH,
|
|
889
|
+
range: [ux_specification_types_2.ManifestSection.ui5, 'routing']
|
|
825
890
|
}
|
|
826
891
|
});
|
|
827
892
|
return;
|
|
@@ -832,8 +897,8 @@ function getManifestPage(manifest, pageId, logger) {
|
|
|
832
897
|
severity: "error" /* LogSeverity.Error */,
|
|
833
898
|
message: i18next_1.default.t('NOROUTINGID', { routingId: pageId }),
|
|
834
899
|
location: {
|
|
835
|
-
path:
|
|
836
|
-
range: [
|
|
900
|
+
path: ux_specification_types_2.MANIFESTPATH,
|
|
901
|
+
range: [ux_specification_types_2.ManifestSection.ui5, 'routing']
|
|
837
902
|
}
|
|
838
903
|
});
|
|
839
904
|
return;
|
|
@@ -909,7 +974,7 @@ function addCustomSectionDefinition(appSchema, definition, v4Page, customSection
|
|
|
909
974
|
const annotationSectionsMap = new Map();
|
|
910
975
|
sortedSectionsArray = sortedSectionsArray.map((annotationSection) => {
|
|
911
976
|
const entry = (0, common_1.getEnumEntry)(appSchema, annotationSection[1], annotationSection[0], {
|
|
912
|
-
keyProperties: [
|
|
977
|
+
keyProperties: [ux_specification_types_2.SchemaKeyName.id],
|
|
913
978
|
descriptionAsFallback: true,
|
|
914
979
|
resolveDefinition: true
|
|
915
980
|
});
|
|
@@ -924,7 +989,7 @@ function addCustomSectionDefinition(appSchema, definition, v4Page, customSection
|
|
|
924
989
|
sortedSectionsArray = addExtensionToArray(section.subSections, sortedSectionsArray, customSectionRef, 'template', logger, isMergedSections);
|
|
925
990
|
}
|
|
926
991
|
}
|
|
927
|
-
else if (customSectionRef.includes(
|
|
992
|
+
else if (customSectionRef.includes(ux_specification_types_2.DefinitionName.ObjectPageCustomHeaderSectionFragment)) {
|
|
928
993
|
// header custom section extensions
|
|
929
994
|
const header = v4Page.options?.settings?.content?.header;
|
|
930
995
|
if (header && 'facets' in header) {
|
|
@@ -942,7 +1007,7 @@ function addCustomSectionDefinition(appSchema, definition, v4Page, customSection
|
|
|
942
1007
|
}
|
|
943
1008
|
// Adjust propertyIndex
|
|
944
1009
|
for (let index = 0; index < sortedSectionsArray.length; index++) {
|
|
945
|
-
sortedSectionsArray[index][1][
|
|
1010
|
+
sortedSectionsArray[index][1][ux_specification_types_2.SchemaTag.propertyIndex] = index;
|
|
946
1011
|
}
|
|
947
1012
|
const sortedActionsAsObject = {};
|
|
948
1013
|
sortedSectionsArray.forEach(([key, value]) => {
|
|
@@ -963,7 +1028,7 @@ function addCustomFilterFieldDefinition(appSchema, definition, v4Page) {
|
|
|
963
1028
|
const annotationSectionsMap = new Map();
|
|
964
1029
|
sortedFilterFieldsArray = sortedFilterFieldsArray.map((annotationSection) => {
|
|
965
1030
|
const entry = (0, common_1.getEnumEntry)(appSchema, annotationSection[1], annotationSection[0], {
|
|
966
|
-
keyProperties: [
|
|
1031
|
+
keyProperties: [ux_specification_types_2.SchemaKeyName.value],
|
|
967
1032
|
descriptionAsFallback: true,
|
|
968
1033
|
resolveDefinition: true
|
|
969
1034
|
});
|
|
@@ -974,11 +1039,11 @@ function addCustomFilterFieldDefinition(appSchema, definition, v4Page) {
|
|
|
974
1039
|
const selectionFieldsEntry = v4Page.options?.settings?.controlConfiguration?.[`@${"com.sap.vocabularies.UI.v1.SelectionFields" /* UIAnnotationTerms.SelectionFields */}`];
|
|
975
1040
|
if (typeof selectionFieldsEntry === 'object' && 'filterFields' in selectionFieldsEntry) {
|
|
976
1041
|
// add extension to subsection of section
|
|
977
|
-
sortedFilterFieldsArray = addExtensionToArray(selectionFieldsEntry.filterFields, sortedFilterFieldsArray,
|
|
1042
|
+
sortedFilterFieldsArray = addExtensionToArray(selectionFieldsEntry.filterFields, sortedFilterFieldsArray, ux_specification_types_2.DefinitionName.CustomFilterField, 'template');
|
|
978
1043
|
}
|
|
979
1044
|
// Adjust propertyIndex
|
|
980
1045
|
for (let index = 0; index < sortedFilterFieldsArray.length; index++) {
|
|
981
|
-
sortedFilterFieldsArray[index][1][
|
|
1046
|
+
sortedFilterFieldsArray[index][1][ux_specification_types_2.SchemaTag.propertyIndex] = index;
|
|
982
1047
|
}
|
|
983
1048
|
const sortedFilterFieldsAsObject = {};
|
|
984
1049
|
sortedFilterFieldsArray.forEach(([key, value]) => {
|
|
@@ -987,4 +1052,91 @@ function addCustomFilterFieldDefinition(appSchema, definition, v4Page) {
|
|
|
987
1052
|
});
|
|
988
1053
|
definition.properties = sortedFilterFieldsAsObject;
|
|
989
1054
|
}
|
|
1055
|
+
/**
|
|
1056
|
+
* Imports action settings into a configuration object and applies necessary transformations based on provided parameters.
|
|
1057
|
+
*
|
|
1058
|
+
* @param {object} importActionParams - Parameters required for importing action settings, including schema, factory, and action specifications.
|
|
1059
|
+
* @param {string} key - The key used to identify the specific configuration or schema definition.
|
|
1060
|
+
* @param {boolean} [keepEmptyAction=false] - Determines whether to keep empty actions in the configuration object.
|
|
1061
|
+
* @returns {void} This method does not return any value.
|
|
1062
|
+
*/
|
|
1063
|
+
function importActionToConfigurationObject(importActionParams, key, keepEmptyAction = false) {
|
|
1064
|
+
const { appSchema, factory, actionsInConfig, actionKey, manifest, routingId, manifestSectionId, targetAnnotation } = importActionParams;
|
|
1065
|
+
const schemaPropertyName = (key ?? '').split('<')[0];
|
|
1066
|
+
const metaInstance = factory.createInstance(ux_specification_types_1.PageTypeV4.ObjectPage, schemaPropertyName);
|
|
1067
|
+
const breadcrumbs = [actionKey.replace('/', '??')];
|
|
1068
|
+
if (targetAnnotation) {
|
|
1069
|
+
breadcrumbs.push(targetAnnotation);
|
|
1070
|
+
}
|
|
1071
|
+
if (metaInstance) {
|
|
1072
|
+
const action = (actionsInConfig[actionKey] = metaInstance);
|
|
1073
|
+
(0, utils_2.importSettingsOfObject)(action, manifest, appSchema.definitions[key], routingId, breadcrumbs, manifestSectionId);
|
|
1074
|
+
if (!keepEmptyAction) {
|
|
1075
|
+
(0, common_1.removeEmptyStructure)(actionsInConfig, actionKey);
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
/**
|
|
1080
|
+
* Imports the settings of a single action reference into the configuration object.
|
|
1081
|
+
*
|
|
1082
|
+
* @param {ImportActionSettingsOfReferenceParams} importActionParams - The parameters required for importing action settings, including property definitions.
|
|
1083
|
+
* @param {Definition} definitionOfReference - The reference definition object used to resolve the action.
|
|
1084
|
+
* @returns {void} This function does not return a value.
|
|
1085
|
+
*/
|
|
1086
|
+
function importSingleActionSettingsOfReference(importActionParams, definitionOfReference) {
|
|
1087
|
+
const { actionPropertyDefinition } = importActionParams;
|
|
1088
|
+
const key = (0, utils_1.getDefinitionKey)(definitionOfReference.$ref || actionPropertyDefinition.$ref);
|
|
1089
|
+
importActionToConfigurationObject(importActionParams, key);
|
|
1090
|
+
}
|
|
1091
|
+
/**
|
|
1092
|
+
* Imports and processes the settings for a group of actions based on a reference definition.
|
|
1093
|
+
*
|
|
1094
|
+
* @param {ImportActionSettingsOfReferenceParams} importActionParams - The parameters used for importing and configuring the action settings.
|
|
1095
|
+
* @param {Definition} definitionOfReference - The reference definition from which the action group settings are imported.
|
|
1096
|
+
* @returns {void} This function does not return a value; it modifies the configurations directly.
|
|
1097
|
+
*/
|
|
1098
|
+
function importGroupActionSettingsOfReference(importActionParams, definitionOfReference) {
|
|
1099
|
+
const { actionPropertyDefinition, appSchema, actionsInConfig, actionKey } = importActionParams;
|
|
1100
|
+
// create an instance of the action group in the configuration object
|
|
1101
|
+
const key = (0, utils_1.getDefinitionKey)(definitionOfReference.$ref ?? actionPropertyDefinition.$ref);
|
|
1102
|
+
importActionToConfigurationObject(importActionParams, key, true);
|
|
1103
|
+
// newly created action group instance is available in the actionsInConfig object
|
|
1104
|
+
const actionGroup = actionsInConfig[actionKey];
|
|
1105
|
+
// fill the action group with the action settings of the group action
|
|
1106
|
+
const { properties } = definitionOfReference;
|
|
1107
|
+
for (const propertyKey in properties) {
|
|
1108
|
+
const actionInGroupProperty = properties[propertyKey];
|
|
1109
|
+
const actionInGroupPropertyKey = (0, utils_1.getDefinitionKey)(actionInGroupProperty['$ref']);
|
|
1110
|
+
const actionInGroupDefinition = appSchema.definitions[actionInGroupPropertyKey];
|
|
1111
|
+
const key = (0, utils_1.getDefinitionKey)(actionInGroupDefinition.$ref ?? actionInGroupProperty['$ref']);
|
|
1112
|
+
const importGroupedActionParams = {
|
|
1113
|
+
...importActionParams,
|
|
1114
|
+
actionsInConfig: actionGroup,
|
|
1115
|
+
actionKey: propertyKey
|
|
1116
|
+
// targetAnnotation: undefined
|
|
1117
|
+
};
|
|
1118
|
+
importActionToConfigurationObject(importGroupedActionParams, key);
|
|
1119
|
+
}
|
|
1120
|
+
(0, common_1.removeEmptyStructure)(actionsInConfig, actionKey);
|
|
1121
|
+
}
|
|
1122
|
+
/**
|
|
1123
|
+
* Imports the action settings of a specified reference based on the given parameters.
|
|
1124
|
+
*
|
|
1125
|
+
* @param {object} importActionParams - The parameters required for importing action settings.
|
|
1126
|
+
* @param {object} importActionParams.actionPropertyDefinition - The action property definition containing the $ref to the reference.
|
|
1127
|
+
* @param {object} importActionParams.appSchema - The application schema containing definitions and other related metadata.
|
|
1128
|
+
* @returns {void} This function does not return a value.
|
|
1129
|
+
*/
|
|
1130
|
+
function importActionSettingsOfReference(importActionParams) {
|
|
1131
|
+
const { actionPropertyDefinition, appSchema } = importActionParams;
|
|
1132
|
+
const definitionKey = (0, utils_1.getDefinitionKey)(actionPropertyDefinition.$ref);
|
|
1133
|
+
const definitionOfReference = appSchema.definitions[definitionKey];
|
|
1134
|
+
const actionType = definitionOfReference['dataType'];
|
|
1135
|
+
if (actionType === exports.DATA_FIELD_FOR_ACTION_GROUP) {
|
|
1136
|
+
importGroupActionSettingsOfReference(importActionParams, definitionOfReference);
|
|
1137
|
+
}
|
|
1138
|
+
else {
|
|
1139
|
+
importSingleActionSettingsOfReference(importActionParams, definitionOfReference);
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
990
1142
|
//# sourceMappingURL=utils.js.map
|