@sap/ux-specification 1.84.95 → 1.84.97
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 +36 -19
- 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-ListReport.html +2 -2
- package/dist/documentation/v4/v4-ObjectPage.html +2 -2
- package/dist/index-min.js +35 -35
- package/dist/index-min.js.map +3 -3
- package/dist/schemas/v2/ApplicationV2.json +1 -5
- package/dist/schemas/v4/ApplicationV4.json +1 -5
- package/dist/specification/package.json +10 -8
- package/dist/specification/scripts/to-json-schema.js +4 -1
- package/dist/specification/scripts/to-json-schema.js.map +1 -1
- package/dist/specification/src/specification/schemaAccess.d.ts +1 -1
- package/dist/specification/src/specification/schemaAccess.d.ts.map +1 -1
- package/dist/specification/src/specification/schemaAccess.js +4 -3
- package/dist/specification/src/specification/schemaAccess.js.map +1 -1
- package/dist/specification/src/sync/common/appProvider.d.ts +2 -3
- package/dist/specification/src/sync/common/appProvider.d.ts.map +1 -1
- package/dist/specification/src/sync/common/appProvider.js +14 -8
- package/dist/specification/src/sync/common/appProvider.js.map +1 -1
- package/dist/specification/src/sync/common/decoration/control.d.ts.map +1 -1
- package/dist/specification/src/sync/common/decoration/control.js.map +1 -1
- package/dist/specification/src/sync/common/dist_tag.json +10 -5
- package/dist/specification/src/sync/common/importProject.d.ts.map +1 -1
- package/dist/specification/src/sync/common/importProject.js +14 -5
- package/dist/specification/src/sync/common/importProject.js.map +1 -1
- package/dist/specification/src/sync/common/utils.d.ts +21 -2
- package/dist/specification/src/sync/common/utils.d.ts.map +1 -1
- package/dist/specification/src/sync/common/utils.js +139 -99
- package/dist/specification/src/sync/common/utils.js.map +1 -1
- package/dist/specification/src/sync/v2/import/app/appProvider.d.ts +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 +31 -34
- package/dist/specification/src/sync/v2/import/app/appProvider.js.map +1 -1
- package/dist/specification/src/sync/v2/import/app/ovpProvider.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/import/app/ovpProvider.js +1 -1
- package/dist/specification/src/sync/v2/import/app/ovpProvider.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 +1 -2
- package/dist/specification/src/sync/v4/export/export.js.map +1 -1
- package/dist/specification/src/sync/v4/export/flexibleColumnLayout.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/flexibleColumnLayout.js +3 -13
- package/dist/specification/src/sync/v4/export/flexibleColumnLayout.js.map +1 -1
- package/dist/specification/src/sync/v4/export/manifest.js +2 -2
- package/dist/specification/src/sync/v4/export/manifest.js.map +1 -1
- package/dist/specification/src/sync/v4/generate/objectPage.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/generate/objectPage.js.map +1 -1
- package/dist/specification/src/sync/v4/import/app/appProvider.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/import/app/appProvider.js +3 -3
- package/dist/specification/src/sync/v4/import/app/appProvider.js.map +1 -1
- package/dist/specification/src/sync/v4/utils/StableIdHelper.js +4 -4
- package/dist/specification/src/sync/v4/utils/StableIdHelper.js.map +1 -1
- package/dist/types/src/apiTypes.d.ts +3 -1
- package/dist/types/src/apiTypes.d.ts.map +1 -1
- package/dist/types/src/apiTypes.js.map +1 -1
- package/dist/types/src/common/page.d.ts +2 -2
- package/dist/types/src/common/page.d.ts.map +1 -1
- package/package.json +10 -8
|
@@ -3,14 +3,22 @@ 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.replaceNamespaces = exports.removeNamespaces = exports.updatePropertyIndices = exports.getErrorMessage = exports.getDefinitionKey = exports.convertActionKeyToStableId = exports.convertEnumToCSV = exports.arrayCombineMerge = exports.getNextTargetDefinition = exports.findMatchingKeysByAdditionalProperties = exports.generatePageId = exports.getSchemaFilePath = exports.deleteEmptyStructure = exports.getObjectPageFacetSection = exports.createDefaultSection = exports.addTargetTitleAndSectionDescription = exports.addSectionTitleAndDescription = exports.getTemplateTypeFromManifest = exports.determineV4Template = exports.determineV4PageTemplateType = exports.determineV2Template = exports.
|
|
6
|
+
exports.replaceNamespaces = exports.removeNamespaces = exports.updatePropertyIndices = exports.getErrorMessage = exports.getDefinitionKey = exports.convertActionKeyToStableId = exports.convertEnumToCSV = exports.arrayCombineMerge = exports.getNextTargetDefinition = exports.findMatchingKeysByAdditionalProperties = exports.generatePageId = exports.getSchemaFilePath = exports.deleteEmptyStructure = exports.getObjectPageFacetSection = exports.createDefaultSection = exports.addTargetTitleAndSectionDescription = exports.addSectionTitleAndDescription = exports.getTemplateTypeFromManifest = exports.determineV4Template = exports.determineV4PageTemplateType = exports.determineV2Template = exports.getODataVersionFromManifest = exports.getMainService = exports.getFEVersionFromManifest = exports.getObjectPageFacets = exports.getObjectPageHeaderFacets = exports.getSchemaKeyOfLineItemRecord = exports.getManifestSectionByPathV4 = exports.getSectionFacet = exports.findAlias = exports.getPageTypeV4 = exports.getPageTypeV2 = exports.prepareRef = exports.getDataFieldDescription = exports.getLabelForDataField = exports.getLabelForPropertyPath = exports.evaluateCommonLabel = exports.getAnnotationPropertyValue = exports.parseAndMergeAndConvert = exports.createAnnotationPath = exports.arrayIncludes = exports.V4_LIBS = exports.V4_TEMPLATES = exports.DEFINITION_LINK_PREFIX = void 0;
|
|
7
7
|
const ux_specification_types_1 = require("@sap/ux-specification-types");
|
|
8
|
+
const ux_specification_types_2 = require("@sap/ux-specification-types");
|
|
8
9
|
const i18next_1 = __importDefault(require("i18next"));
|
|
9
10
|
const deepmerge_1 = __importDefault(require("deepmerge"));
|
|
10
11
|
const annotation_converter_1 = require("@sap-ux/annotation-converter");
|
|
11
12
|
const edmx_parser_1 = require("@sap-ux/edmx-parser");
|
|
12
13
|
const extensionLogger_1 = require("../../extensionLogger");
|
|
13
14
|
exports.DEFINITION_LINK_PREFIX = '#/definitions/';
|
|
15
|
+
exports.V4_TEMPLATES = [
|
|
16
|
+
ux_specification_types_2.v4.FE_TEMPLATE_V4_LIST_REPORT,
|
|
17
|
+
ux_specification_types_2.v4.FE_TEMPLATE_V4_ALP,
|
|
18
|
+
ux_specification_types_2.v4.FE_TEMPLATE_V4_OBJECT_PAGE,
|
|
19
|
+
ux_specification_types_2.v4.FE_TEMPLATE_V4_CUSTOM_PAGE
|
|
20
|
+
];
|
|
21
|
+
exports.V4_LIBS = ['sap.fe.core', 'sap.fe.templates'];
|
|
14
22
|
const arrayIncludes = (arr, target) => target.every((v) => arr.includes(v));
|
|
15
23
|
exports.arrayIncludes = arrayIncludes;
|
|
16
24
|
/**
|
|
@@ -55,7 +63,8 @@ function parseAndMergeAndConvert(annotationFiles, logger) {
|
|
|
55
63
|
});
|
|
56
64
|
}
|
|
57
65
|
if (parseResult.length > 0) {
|
|
58
|
-
|
|
66
|
+
const mergedParserResult = (0, edmx_parser_1.merge)(...parseResult);
|
|
67
|
+
converterOutput = (0, annotation_converter_1.convert)(mergedParserResult);
|
|
59
68
|
}
|
|
60
69
|
return converterOutput;
|
|
61
70
|
}
|
|
@@ -245,7 +254,7 @@ exports.prepareRef = prepareRef;
|
|
|
245
254
|
*/
|
|
246
255
|
function getPageTypeV2(name) {
|
|
247
256
|
if (name) {
|
|
248
|
-
const templatePart = `${
|
|
257
|
+
const templatePart = `${ux_specification_types_2.v2.FE_TEMPLATE_V2}.`;
|
|
249
258
|
return name.split(templatePart)[1];
|
|
250
259
|
}
|
|
251
260
|
}
|
|
@@ -255,14 +264,14 @@ exports.getPageTypeV2 = getPageTypeV2;
|
|
|
255
264
|
* @param name - page component name
|
|
256
265
|
*/
|
|
257
266
|
function getPageTypeV4(v4App) {
|
|
258
|
-
if (v4App.name && v4App.name !==
|
|
259
|
-
const templatePart = `${
|
|
267
|
+
if (v4App.name && v4App.name !== ux_specification_types_2.v4.FE_TEMPLATE_V4_CUSTOM_PAGE) {
|
|
268
|
+
const templatePart = `${ux_specification_types_2.v4.FE_TEMPLATE_V4}.`;
|
|
260
269
|
return v4App.name.split(templatePart)[1];
|
|
261
270
|
}
|
|
262
|
-
else if (v4App?.name ===
|
|
271
|
+
else if (v4App?.name === ux_specification_types_2.v4.FE_TEMPLATE_V4_CUSTOM_PAGE ||
|
|
263
272
|
v4App.viewId ||
|
|
264
273
|
v4App.viewName) {
|
|
265
|
-
return
|
|
274
|
+
return ux_specification_types_2.PageTypeV4.CustomPage;
|
|
266
275
|
}
|
|
267
276
|
}
|
|
268
277
|
exports.getPageTypeV4 = getPageTypeV4;
|
|
@@ -324,11 +333,11 @@ function adjustKey(key, navigationParts, keyForRelatedFacetKeys) {
|
|
|
324
333
|
key = pathParts.join('::');
|
|
325
334
|
}
|
|
326
335
|
else {
|
|
327
|
-
key = uiClass.replace('@UI', `${!keyForRelatedFacetKeys ? '@' : ''}${
|
|
336
|
+
key = uiClass.replace('@UI', `${!keyForRelatedFacetKeys ? '@' : ''}${ux_specification_types_2.UIVOCABULARY}`);
|
|
328
337
|
}
|
|
329
338
|
return key;
|
|
330
339
|
}
|
|
331
|
-
function getKeyAndEntityTypeOfReferenceFacet(oDataServiceAVT, key, entityType, propertyValue, oDataVersion =
|
|
340
|
+
function getKeyAndEntityTypeOfReferenceFacet(oDataServiceAVT, key, entityType, propertyValue, oDataVersion = ux_specification_types_2.FioriElementsVersion.v2, keyForRelatedFacetKeys = false) {
|
|
332
341
|
let stopProcessing = false;
|
|
333
342
|
let namespace;
|
|
334
343
|
const navigationParts = propertyValue.split('/');
|
|
@@ -339,7 +348,7 @@ function getKeyAndEntityTypeOfReferenceFacet(oDataServiceAVT, key, entityType, p
|
|
|
339
348
|
key = adjustKey(key, navigationParts, keyForRelatedFacetKeys);
|
|
340
349
|
const targetAnnotation = determineTargetAnnotation(navigationParts, entityType, oDataServiceAVT);
|
|
341
350
|
if (targetAnnotation) {
|
|
342
|
-
const separator = oDataVersion ===
|
|
351
|
+
const separator = oDataVersion === ux_specification_types_2.FioriElementsVersion.v2 ? '::' : '#';
|
|
343
352
|
key = getTargetAnnotationName(targetAnnotation, keyForRelatedFacetKeys).replace('#', separator);
|
|
344
353
|
namespace = targetAnnotation.fullyQualifiedName?.split('@')[0];
|
|
345
354
|
}
|
|
@@ -348,7 +357,7 @@ function getKeyAndEntityTypeOfReferenceFacet(oDataServiceAVT, key, entityType, p
|
|
|
348
357
|
return { key, entityType, stopProcessing, namespace };
|
|
349
358
|
}
|
|
350
359
|
if (navigation) {
|
|
351
|
-
const navSeparator = oDataVersion ===
|
|
360
|
+
const navSeparator = oDataVersion === ux_specification_types_2.FioriElementsVersion.v2 ? '::' : '/';
|
|
352
361
|
navigationParts.pop();
|
|
353
362
|
const navigationIDs = [...navigationParts].join(navSeparator);
|
|
354
363
|
key = `${navigationIDs}${navSeparator}${key}`;
|
|
@@ -364,7 +373,7 @@ function getKeyAndEntityTypeOfReferenceFacet(oDataServiceAVT, key, entityType, p
|
|
|
364
373
|
* @param {ExtensionLogger} logger - Logger class for logging messages
|
|
365
374
|
* @returns {FacetSection} - object comprising the relevant facet information
|
|
366
375
|
*/
|
|
367
|
-
function getSectionFacet(facetDefinition, sourceEntityType, oDataServiceAVT, logger, oDataVersion =
|
|
376
|
+
function getSectionFacet(facetDefinition, sourceEntityType, oDataServiceAVT, logger, oDataVersion = ux_specification_types_2.FioriElementsVersion.v2, keyForRelatedFacetKeys = false) {
|
|
368
377
|
//Take facet ID as fallback
|
|
369
378
|
const facetName = facetDefinition.fullyQualifiedName?.substring(facetDefinition.fullyQualifiedName?.lastIndexOf('@'));
|
|
370
379
|
let key = facetDefinition.ID ? facetDefinition.ID.toString() : facetName;
|
|
@@ -463,7 +472,7 @@ function getSchemaKeyOfLineItemRecord(lineItemRecord) {
|
|
|
463
472
|
schemaKey =
|
|
464
473
|
'DataFieldForAnnotation:::sTarget::' +
|
|
465
474
|
target
|
|
466
|
-
.replace('@UI', `@${
|
|
475
|
+
.replace('@UI', `@${ux_specification_types_2.UIVOCABULARY}`)
|
|
467
476
|
.replace('@Communication', '@com.sap.vocabularies.Communication.v1')
|
|
468
477
|
.replace('@Contact', '@com.sap.vocabularies.Contact.v1');
|
|
469
478
|
}
|
|
@@ -559,20 +568,20 @@ function getAnnotationTerm(path, alias, entityType) {
|
|
|
559
568
|
* @param {ConvertedMetadata} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
|
|
560
569
|
*/
|
|
561
570
|
function evaluateTargetAnnotation(section, annotationRecord, facets, entityType, oDataServiceAVT) {
|
|
562
|
-
const alias = findAlias(
|
|
571
|
+
const alias = findAlias(ux_specification_types_2.UIVOCABULARY, oDataServiceAVT);
|
|
563
572
|
let path = section ? section.key : '';
|
|
564
573
|
const targetEntityType = section.entityType;
|
|
565
574
|
const annotationTerm = getAnnotationTerm(path, alias, entityType);
|
|
566
575
|
switch (annotationTerm) {
|
|
567
576
|
case "com.sap.vocabularies.UI.v1.Chart" /* UIAnnotationTerms.Chart */: {
|
|
568
|
-
facets[path] = { base:
|
|
577
|
+
facets[path] = { base: ux_specification_types_2.FacetBase.Chart };
|
|
569
578
|
facets[path].target = annotationRecord?.Target?.$target;
|
|
570
579
|
facets[path].entityType = targetEntityType;
|
|
571
580
|
facets[path].namespace = section.namespace;
|
|
572
581
|
break;
|
|
573
582
|
}
|
|
574
583
|
case "com.sap.vocabularies.UI.v1.Identification" /* UIAnnotationTerms.Identification */: {
|
|
575
|
-
facets[path] = { base:
|
|
584
|
+
facets[path] = { base: ux_specification_types_2.FacetBase.Identification };
|
|
576
585
|
facets[path].target = annotationRecord?.Target?.$target;
|
|
577
586
|
facets[path].entityType = targetEntityType;
|
|
578
587
|
facets[path].namespace = section.namespace;
|
|
@@ -584,21 +593,21 @@ function evaluateTargetAnnotation(section, annotationRecord, facets, entityType,
|
|
|
584
593
|
pathParts[pathParts.length - 1] = `@${"com.sap.vocabularies.UI.v1.LineItem" /* UIAnnotationTerms.LineItem */}`;
|
|
585
594
|
path = pathParts.join('::');
|
|
586
595
|
}
|
|
587
|
-
facets[path] = { base:
|
|
596
|
+
facets[path] = { base: ux_specification_types_2.FacetBase.LineItem };
|
|
588
597
|
facets[path].target = annotationRecord?.Target?.$target;
|
|
589
598
|
facets[path].entityType = targetEntityType;
|
|
590
599
|
facets[path].namespace = section.namespace;
|
|
591
600
|
break;
|
|
592
601
|
}
|
|
593
602
|
case "com.sap.vocabularies.UI.v1.FieldGroup" /* UIAnnotationTerms.FieldGroup */: {
|
|
594
|
-
facets[path] = { base:
|
|
603
|
+
facets[path] = { base: ux_specification_types_2.FacetBase.Form };
|
|
595
604
|
facets[path].target = annotationRecord?.Target?.$target;
|
|
596
605
|
facets[path].entityType = targetEntityType;
|
|
597
606
|
facets[path].namespace = section.namespace;
|
|
598
607
|
break;
|
|
599
608
|
}
|
|
600
609
|
case "com.sap.vocabularies.UI.v1.DataPoint" /* UIAnnotationTerms.DataPoint */: {
|
|
601
|
-
facets[path] = { base:
|
|
610
|
+
facets[path] = { base: ux_specification_types_2.FacetBase.DataPoint };
|
|
602
611
|
facets[path].Label = annotationRecord?.Target?.$target['Title'];
|
|
603
612
|
facets[path].target = annotationRecord?.Target?.$target;
|
|
604
613
|
facets[path].entityType = targetEntityType;
|
|
@@ -606,32 +615,32 @@ function evaluateTargetAnnotation(section, annotationRecord, facets, entityType,
|
|
|
606
615
|
break;
|
|
607
616
|
}
|
|
608
617
|
case "com.sap.vocabularies.UI.v1.PresentationVariant" /* UIAnnotationTerms.PresentationVariant */: {
|
|
609
|
-
facets[path] = { base:
|
|
618
|
+
facets[path] = { base: ux_specification_types_2.FacetBase.PresentationVariant };
|
|
610
619
|
facets[path].target = annotationRecord?.Target?.$target;
|
|
611
620
|
facets[path].entityType = targetEntityType;
|
|
612
621
|
facets[path].namespace = section.namespace;
|
|
613
622
|
break;
|
|
614
623
|
}
|
|
615
624
|
case "com.sap.vocabularies.Communication.v1.Contact" /* CommunicationAnnotationTerms.Contact */: {
|
|
616
|
-
facets[path] = { base:
|
|
625
|
+
facets[path] = { base: ux_specification_types_2.FacetBase.Contact };
|
|
617
626
|
facets[path].target = annotationRecord?.Target?.$target;
|
|
618
627
|
facets[path].entityType = targetEntityType;
|
|
619
628
|
facets[path].namespace = section.namespace;
|
|
620
629
|
break;
|
|
621
630
|
}
|
|
622
631
|
case "com.sap.vocabularies.Communication.v1.Address" /* CommunicationAnnotationTerms.Address */: {
|
|
623
|
-
facets[path] = { base:
|
|
632
|
+
facets[path] = { base: ux_specification_types_2.FacetBase.Address };
|
|
624
633
|
facets[path].target = annotationRecord?.Target?.$target;
|
|
625
634
|
facets[path].entityType = targetEntityType;
|
|
626
635
|
facets[path].namespace = section.namespace;
|
|
627
636
|
break;
|
|
628
637
|
}
|
|
629
638
|
default: {
|
|
630
|
-
facets[path] = { base:
|
|
639
|
+
facets[path] = { base: ux_specification_types_2.FacetBase.Unknown };
|
|
631
640
|
}
|
|
632
641
|
}
|
|
633
642
|
if (facets[path]) {
|
|
634
|
-
facets[path].annotationPath = `/${annotationRecord.fullyQualifiedName.replace('@com.sap.vocabularies',
|
|
643
|
+
facets[path].annotationPath = `/${annotationRecord.fullyQualifiedName.replace('@com.sap.vocabularies', ux_specification_types_2.VOCWITHSLASH)}`;
|
|
635
644
|
if (annotationRecord.Label) {
|
|
636
645
|
facets[path].Label = annotationRecord.Label;
|
|
637
646
|
}
|
|
@@ -654,7 +663,7 @@ function evaluateTargetAnnotation(section, annotationRecord, facets, entityType,
|
|
|
654
663
|
* @param {FioriElementsVersion} oDataVersion - OData version
|
|
655
664
|
* @param {ExtensionLogger} logger - Logger class for logging messages
|
|
656
665
|
*/
|
|
657
|
-
function addFacetToConfig(annotationRecord, oDataServiceAVT, serviceName, entityType, facets, oDataVersion =
|
|
666
|
+
function addFacetToConfig(annotationRecord, oDataServiceAVT, serviceName, entityType, facets, oDataVersion = ux_specification_types_2.FioriElementsVersion.v2, logger) {
|
|
658
667
|
const section = getSectionFacet(annotationRecord, entityType, oDataServiceAVT, logger, oDataVersion, false);
|
|
659
668
|
if (section) {
|
|
660
669
|
switch (annotationRecord.$Type) {
|
|
@@ -665,14 +674,14 @@ function addFacetToConfig(annotationRecord, oDataServiceAVT, serviceName, entity
|
|
|
665
674
|
case "com.sap.vocabularies.UI.v1.CollectionFacet" /* UIAnnotationTypes.CollectionFacet */: {
|
|
666
675
|
const annotationPath = `/${entityType.fullyQualifiedName}/${annotationRecord.fullyQualifiedName.split(entityType.fullyQualifiedName)[1]}`;
|
|
667
676
|
const facet = (facets[section.key] = {
|
|
668
|
-
base:
|
|
677
|
+
base: ux_specification_types_2.FacetBase.CollectionFacet,
|
|
669
678
|
facets: {},
|
|
670
679
|
ID: section.ID,
|
|
671
680
|
annotationPath: annotationPath,
|
|
672
681
|
Label: section.label,
|
|
673
682
|
namespace: section.namespace
|
|
674
683
|
});
|
|
675
|
-
if (!facet.ID && oDataVersion ===
|
|
684
|
+
if (!facet.ID && oDataVersion === ux_specification_types_2.FioriElementsVersion.v4) {
|
|
676
685
|
(0, extensionLogger_1.log)(logger, {
|
|
677
686
|
severity: "error" /* LogSeverity.Error */,
|
|
678
687
|
message: i18next_1.default.t('NOID4SECTION', { facet: annotationRecord.fullyQualifiedName })
|
|
@@ -693,12 +702,12 @@ function addFacetToConfig(annotationRecord, oDataServiceAVT, serviceName, entity
|
|
|
693
702
|
* @param {FioriElementsVersion} oDataVersion - OData version
|
|
694
703
|
* @param {ExtensionLogger} logger - Logger class for logging messages
|
|
695
704
|
*/
|
|
696
|
-
function getObjectPageHeaderFacets(entityType, oDataServiceAVT, oDataVersion =
|
|
705
|
+
function getObjectPageHeaderFacets(entityType, oDataServiceAVT, oDataVersion = ux_specification_types_2.FioriElementsVersion.v2, logger) {
|
|
697
706
|
const facets = {};
|
|
698
707
|
if (!entityType || !entityType.annotations) {
|
|
699
708
|
return;
|
|
700
709
|
}
|
|
701
|
-
const alias = findAlias(
|
|
710
|
+
const alias = findAlias(ux_specification_types_2.UIVOCABULARY, oDataServiceAVT);
|
|
702
711
|
const facetAnnotation = alias && entityType?.annotations?.[alias]?.HeaderFacets;
|
|
703
712
|
if (facetAnnotation) {
|
|
704
713
|
const lastDot = entityType && entityType.fullyQualifiedName.lastIndexOf('.');
|
|
@@ -718,12 +727,12 @@ exports.getObjectPageHeaderFacets = getObjectPageHeaderFacets;
|
|
|
718
727
|
* @param {FioriElementsVersion} oDataVersion - OData version
|
|
719
728
|
* @param {ExtensionLogger} logger - Logger class for logging messages
|
|
720
729
|
*/
|
|
721
|
-
function getObjectPageFacets(entityType, oDataServiceAVT, oDataVersion =
|
|
730
|
+
function getObjectPageFacets(entityType, oDataServiceAVT, oDataVersion = ux_specification_types_2.FioriElementsVersion.v2, logger) {
|
|
722
731
|
const facets = {};
|
|
723
732
|
if (!entityType || !entityType.annotations) {
|
|
724
733
|
return;
|
|
725
734
|
}
|
|
726
|
-
const alias = findAlias(
|
|
735
|
+
const alias = findAlias(ux_specification_types_2.UIVOCABULARY, oDataServiceAVT);
|
|
727
736
|
const facetAnnotation = alias && entityType?.annotations[alias]?.Facets;
|
|
728
737
|
if (facetAnnotation) {
|
|
729
738
|
const lastDot = entityType && entityType.fullyQualifiedName.lastIndexOf('.');
|
|
@@ -739,16 +748,58 @@ exports.getObjectPageFacets = getObjectPageFacets;
|
|
|
739
748
|
/**
|
|
740
749
|
* Returns the version of Fiori elements (v2/v4) from a given manifest
|
|
741
750
|
* @param manifest - the manifest.json file
|
|
751
|
+
* @returns FioriElementsVersion
|
|
742
752
|
*/
|
|
743
|
-
function
|
|
744
|
-
if (manifest[
|
|
745
|
-
|
|
753
|
+
function getFEVersionFromManifest(manifest) {
|
|
754
|
+
if ((manifest[ux_specification_types_2.ManifestSection.generic] && Object.keys(manifest[ux_specification_types_2.ManifestSection.generic]).length > 0) ||
|
|
755
|
+
(manifest[ux_specification_types_2.ManifestSection.ovp] && Object.keys(manifest[ux_specification_types_2.ManifestSection.ovp]).length > 0)) {
|
|
756
|
+
return ux_specification_types_2.FioriElementsVersion.v2;
|
|
746
757
|
}
|
|
747
758
|
else {
|
|
748
|
-
|
|
759
|
+
const targets = manifest[ux_specification_types_2.ManifestSection.ui5]?.routing?.targets;
|
|
760
|
+
const libs = manifest[ux_specification_types_2.ManifestSection.ui5]?.dependencies?.libs;
|
|
761
|
+
if ((targets &&
|
|
762
|
+
Object.keys(targets).find((targetKey) => exports.V4_TEMPLATES.indexOf(targets[targetKey].name) > -1)) ||
|
|
763
|
+
(libs && Object.keys(libs).find((lib) => exports.V4_LIBS.indexOf(lib) > -1))) {
|
|
764
|
+
return ux_specification_types_2.FioriElementsVersion.v4;
|
|
765
|
+
}
|
|
766
|
+
else {
|
|
767
|
+
return undefined;
|
|
768
|
+
}
|
|
749
769
|
}
|
|
750
770
|
}
|
|
751
|
-
exports.
|
|
771
|
+
exports.getFEVersionFromManifest = getFEVersionFromManifest;
|
|
772
|
+
/**
|
|
773
|
+
* Get the main service name from the manifest.
|
|
774
|
+
* LROP: by definition the service name can be read from the UI5 model with "" as name.
|
|
775
|
+
* OVP: the main model needs to be read from the sap.ovp config and then the service can be derived.
|
|
776
|
+
*
|
|
777
|
+
* @param manifest - application manifest
|
|
778
|
+
* @returns - main service name
|
|
779
|
+
*/
|
|
780
|
+
function getMainService(manifest) {
|
|
781
|
+
const model = typeof manifest?.[ux_specification_types_2.ManifestSection.ovp]?.globalFilterModel === 'string'
|
|
782
|
+
? manifest[ux_specification_types_2.ManifestSection.ovp].globalFilterModel
|
|
783
|
+
: '';
|
|
784
|
+
return typeof manifest?.[ux_specification_types_2.ManifestSection.ui5]?.models?.[model]?.dataSource === 'string'
|
|
785
|
+
? manifest[ux_specification_types_2.ManifestSection.ui5].models[model].dataSource
|
|
786
|
+
: undefined;
|
|
787
|
+
}
|
|
788
|
+
exports.getMainService = getMainService;
|
|
789
|
+
/**
|
|
790
|
+
* Returns the oData version of the service (if any) from a given manifest
|
|
791
|
+
* @param manifest - the manifest.json file
|
|
792
|
+
* @returns the OData version
|
|
793
|
+
*/
|
|
794
|
+
function getODataVersionFromManifest(manifest) {
|
|
795
|
+
const mainService = getMainService(manifest);
|
|
796
|
+
if (!mainService) {
|
|
797
|
+
return ux_specification_types_1.OdataVersion.v2;
|
|
798
|
+
}
|
|
799
|
+
const dataSource = manifest[ux_specification_types_2.ManifestSection.app].dataSources?.[mainService];
|
|
800
|
+
return dataSource?.settings?.odataVersion === '4.0' ? ux_specification_types_1.OdataVersion.v4 : ux_specification_types_1.OdataVersion.v2;
|
|
801
|
+
}
|
|
802
|
+
exports.getODataVersionFromManifest = getODataVersionFromManifest;
|
|
752
803
|
/**
|
|
753
804
|
* Determines the template type of a V2 app
|
|
754
805
|
* @param manifest - the manifest.json file
|
|
@@ -757,27 +808,27 @@ exports.getVersionFromManifest = getVersionFromManifest;
|
|
|
757
808
|
*/
|
|
758
809
|
function determineV2Template(manifest, logger) {
|
|
759
810
|
let templateType;
|
|
760
|
-
if (manifest[
|
|
761
|
-
const v2Pages = manifest[
|
|
811
|
+
if (manifest[ux_specification_types_2.ManifestSection.generic]) {
|
|
812
|
+
const v2Pages = manifest[ux_specification_types_2.ManifestSection.generic].pages;
|
|
762
813
|
if (!v2Pages) {
|
|
763
814
|
(0, extensionLogger_1.log)(logger, {
|
|
764
815
|
severity: "error" /* LogSeverity.Error */,
|
|
765
816
|
message: i18next_1.default.t('NOPAGES', { appId: manifest['sap.app']['id'] }),
|
|
766
817
|
location: {
|
|
767
|
-
path:
|
|
768
|
-
range: [
|
|
818
|
+
path: ux_specification_types_2.MANIFESTPATH,
|
|
819
|
+
range: [ux_specification_types_2.ManifestSection.generic]
|
|
769
820
|
}
|
|
770
821
|
});
|
|
771
822
|
return;
|
|
772
823
|
}
|
|
773
824
|
for (const pageKey in v2Pages) {
|
|
774
825
|
const v2Page = v2Pages[pageKey];
|
|
775
|
-
if (getPageTypeV2(v2Page.component?.name) ===
|
|
776
|
-
templateType =
|
|
826
|
+
if (getPageTypeV2(v2Page.component?.name) === ux_specification_types_2.PageTypeV2.AnalyticalListPage) {
|
|
827
|
+
templateType = ux_specification_types_2.TemplateType.AnalyticalListPageV2;
|
|
777
828
|
break;
|
|
778
829
|
}
|
|
779
|
-
else if (getPageTypeV2(v2Page.component?.name) ===
|
|
780
|
-
templateType =
|
|
830
|
+
else if (getPageTypeV2(v2Page.component?.name) === ux_specification_types_2.PageTypeV2.ListReport) {
|
|
831
|
+
templateType = ux_specification_types_2.TemplateType.ListReportObjectPageV2;
|
|
781
832
|
break;
|
|
782
833
|
}
|
|
783
834
|
}
|
|
@@ -786,10 +837,10 @@ function determineV2Template(manifest, logger) {
|
|
|
786
837
|
if (!templateType) {
|
|
787
838
|
(0, extensionLogger_1.log)(logger, {
|
|
788
839
|
severity: "error" /* LogSeverity.Error */,
|
|
789
|
-
message: i18next_1.default.t('NOTEMPLATE', { section:
|
|
840
|
+
message: i18next_1.default.t('NOTEMPLATE', { section: ux_specification_types_2.ManifestSection.generic }),
|
|
790
841
|
location: {
|
|
791
|
-
path:
|
|
792
|
-
range: [
|
|
842
|
+
path: ux_specification_types_2.MANIFESTPATH,
|
|
843
|
+
range: [ux_specification_types_2.ManifestSection.generic]
|
|
793
844
|
}
|
|
794
845
|
});
|
|
795
846
|
}
|
|
@@ -805,24 +856,24 @@ exports.determineV2Template = determineV2Template;
|
|
|
805
856
|
function determineV4PageTemplateType(v4Page) {
|
|
806
857
|
let templateType;
|
|
807
858
|
const pageType = getPageTypeV4(v4Page);
|
|
808
|
-
if (pageType ===
|
|
809
|
-
templateType =
|
|
859
|
+
if (pageType === ux_specification_types_2.PageTypeV4.AnalyticalListPage) {
|
|
860
|
+
templateType = ux_specification_types_2.TemplateType.AnalyticalListPageV4;
|
|
810
861
|
}
|
|
811
|
-
else if (pageType ===
|
|
862
|
+
else if (pageType === ux_specification_types_2.PageTypeV4.ListReport) {
|
|
812
863
|
const viewPath = v4Page.options?.settings?.views?.paths?.[0];
|
|
813
|
-
if (viewPath && (viewPath[
|
|
814
|
-
templateType =
|
|
864
|
+
if (viewPath && (viewPath[ux_specification_types_2.ALPViewType.Primary] || viewPath[ux_specification_types_2.ALPViewType.Secondary])) {
|
|
865
|
+
templateType = ux_specification_types_2.TemplateType.AnalyticalListPageV4;
|
|
815
866
|
}
|
|
816
867
|
else {
|
|
817
|
-
templateType =
|
|
868
|
+
templateType = ux_specification_types_2.TemplateType.ListReportObjectPageV4;
|
|
818
869
|
}
|
|
819
870
|
}
|
|
820
|
-
else if (pageType ===
|
|
821
|
-
templateType =
|
|
871
|
+
else if (pageType === ux_specification_types_2.PageTypeV4.ObjectPage) {
|
|
872
|
+
templateType = ux_specification_types_2.TemplateType.ListReportObjectPageV4;
|
|
822
873
|
//fixed now for FEOP scenario, bit continue to check if LR/ALP exists
|
|
823
874
|
}
|
|
824
|
-
else if (pageType ===
|
|
825
|
-
templateType =
|
|
875
|
+
else if (pageType === ux_specification_types_2.PageTypeV4.CustomPage) {
|
|
876
|
+
templateType = ux_specification_types_2.TemplateType.FreestylePageV4;
|
|
826
877
|
}
|
|
827
878
|
return templateType;
|
|
828
879
|
}
|
|
@@ -850,29 +901,29 @@ function determineV4TemplateFromPages(v4Pages) {
|
|
|
850
901
|
* @returns {TemplateType} the template type
|
|
851
902
|
*/
|
|
852
903
|
function determineV4Template(manifest, logger) {
|
|
853
|
-
const v4Pages = manifest[
|
|
854
|
-
manifest[
|
|
904
|
+
const v4Pages = manifest[ux_specification_types_2.ManifestSection.ui5].routing &&
|
|
905
|
+
manifest[ux_specification_types_2.ManifestSection.ui5].routing.targets;
|
|
855
906
|
// if there are no pages in routing targets, we use LROPV4 as default template type
|
|
856
907
|
if (!v4Pages || Object.keys(v4Pages).length === 0) {
|
|
857
908
|
(0, extensionLogger_1.log)(logger, {
|
|
858
909
|
severity: "info" /* LogSeverity.Info */,
|
|
859
910
|
message: i18next_1.default.t('NOPAGES', { appId: manifest['sap.app']['id'] }),
|
|
860
911
|
location: {
|
|
861
|
-
path:
|
|
862
|
-
range: [
|
|
912
|
+
path: ux_specification_types_2.MANIFESTPATH,
|
|
913
|
+
range: [ux_specification_types_2.ManifestSection.ui5, 'routing']
|
|
863
914
|
}
|
|
864
915
|
});
|
|
865
|
-
return
|
|
916
|
+
return ux_specification_types_2.TemplateType.ListReportObjectPageV4;
|
|
866
917
|
}
|
|
867
918
|
// else try to determine template type from routing targets
|
|
868
919
|
const templateType = determineV4TemplateFromPages(v4Pages);
|
|
869
920
|
if (!templateType) {
|
|
870
921
|
(0, extensionLogger_1.log)(logger, {
|
|
871
922
|
severity: "error" /* LogSeverity.Error */,
|
|
872
|
-
message: i18next_1.default.t('NOTEMPLATE', { section:
|
|
923
|
+
message: i18next_1.default.t('NOTEMPLATE', { section: ux_specification_types_2.ManifestSection.ui5 }),
|
|
873
924
|
location: {
|
|
874
|
-
path:
|
|
875
|
-
range: [
|
|
925
|
+
path: ux_specification_types_2.MANIFESTPATH,
|
|
926
|
+
range: [ux_specification_types_2.ManifestSection.ui5, 'routing', 'targets']
|
|
876
927
|
}
|
|
877
928
|
});
|
|
878
929
|
}
|
|
@@ -888,26 +939,15 @@ exports.determineV4Template = determineV4Template;
|
|
|
888
939
|
*/
|
|
889
940
|
function getTemplateTypeFromManifest(manifest, fioriElementsVersion, logger) {
|
|
890
941
|
let templateType;
|
|
891
|
-
if (manifest[
|
|
892
|
-
templateType =
|
|
942
|
+
if (manifest[ux_specification_types_2.ManifestSection.ovp]) {
|
|
943
|
+
templateType = ux_specification_types_2.TemplateType.OverviewPageV2;
|
|
893
944
|
}
|
|
894
|
-
else if (fioriElementsVersion ===
|
|
945
|
+
else if (fioriElementsVersion === ux_specification_types_2.FioriElementsVersion.v2) {
|
|
895
946
|
templateType = determineV2Template(manifest, logger);
|
|
896
947
|
}
|
|
897
|
-
else if (fioriElementsVersion ===
|
|
948
|
+
else if (fioriElementsVersion === ux_specification_types_2.FioriElementsVersion.v4) {
|
|
898
949
|
templateType = determineV4Template(manifest, logger);
|
|
899
950
|
}
|
|
900
|
-
else {
|
|
901
|
-
if (!templateType) {
|
|
902
|
-
(0, extensionLogger_1.log)(logger, {
|
|
903
|
-
severity: "error" /* LogSeverity.Error */,
|
|
904
|
-
message: i18next_1.default.t('NOFE'),
|
|
905
|
-
location: {
|
|
906
|
-
path: ux_specification_types_1.MANIFESTPATH
|
|
907
|
-
}
|
|
908
|
-
});
|
|
909
|
-
}
|
|
910
|
-
}
|
|
911
951
|
return templateType;
|
|
912
952
|
}
|
|
913
953
|
exports.getTemplateTypeFromManifest = getTemplateTypeFromManifest;
|
|
@@ -919,12 +959,12 @@ exports.getTemplateTypeFromManifest = getTemplateTypeFromManifest;
|
|
|
919
959
|
*/
|
|
920
960
|
function addSectionTitleAndDescription(facet, section, facetKey) {
|
|
921
961
|
if (facet?.ID) {
|
|
922
|
-
section.title =
|
|
923
|
-
section[
|
|
962
|
+
section.title = ux_specification_types_2.FacetTitlePrefix + facet.ID;
|
|
963
|
+
section[ux_specification_types_2.SchemaTag.keys] = [{ name: ux_specification_types_2.SchemaKeyName.id, value: facet.ID }];
|
|
924
964
|
}
|
|
925
965
|
else {
|
|
926
966
|
section.title = facetKey.replace(/@com.sap/g, 'com.sap');
|
|
927
|
-
section[
|
|
967
|
+
section[ux_specification_types_2.SchemaTag.keys] = [{ name: ux_specification_types_2.SchemaKeyName.id, value: facetKey.replace(ux_specification_types_2.UIVOCABULARYALPHADOT, '') }];
|
|
928
968
|
}
|
|
929
969
|
// Description
|
|
930
970
|
if (facet?.Label) {
|
|
@@ -971,8 +1011,8 @@ function createDefaultSection(appSchema, facet, facetKey) {
|
|
|
971
1011
|
properties: {},
|
|
972
1012
|
additionalProperties: false
|
|
973
1013
|
};
|
|
974
|
-
section[
|
|
975
|
-
section[
|
|
1014
|
+
section[ux_specification_types_2.SchemaTag.isViewNode] = true;
|
|
1015
|
+
section[ux_specification_types_2.SchemaTag.annotationPath] = facet.annotationPath;
|
|
976
1016
|
addTargetTitleAndSectionDescription(facet, section, facetKey);
|
|
977
1017
|
return section;
|
|
978
1018
|
}
|
|
@@ -986,8 +1026,8 @@ exports.createDefaultSection = createDefaultSection;
|
|
|
986
1026
|
* @param {boolean} [checkUnresolvableFacets=false] - Check and avoid facets and sections without ID and Target.
|
|
987
1027
|
* @returns {FacetSection[]} - Array of facets or sections
|
|
988
1028
|
*/
|
|
989
|
-
function getObjectPageFacetSection(entityType, oDataServiceAVT, logger, oDataVersion =
|
|
990
|
-
const alias = findAlias(
|
|
1029
|
+
function getObjectPageFacetSection(entityType, oDataServiceAVT, logger, oDataVersion = ux_specification_types_2.FioriElementsVersion.v2, checkUnresolvableFacets = false) {
|
|
1030
|
+
const alias = findAlias(ux_specification_types_2.UIVOCABULARY, oDataServiceAVT);
|
|
991
1031
|
let sections = [];
|
|
992
1032
|
if (entityType) {
|
|
993
1033
|
const facetAnnotation = alias && entityType?.annotations?.[alias]?.Facets;
|
|
@@ -1053,8 +1093,8 @@ exports.deleteEmptyStructure = deleteEmptyStructure;
|
|
|
1053
1093
|
* @return {string} File name of generic schema.
|
|
1054
1094
|
*/
|
|
1055
1095
|
const getGenericSchemaFileName = (schemaType) => {
|
|
1056
|
-
if (schemaType ===
|
|
1057
|
-
return
|
|
1096
|
+
if (schemaType === ux_specification_types_2.SchemaType.FreestylePage) {
|
|
1097
|
+
return ux_specification_types_2.PageTypeV2.CustomPage;
|
|
1058
1098
|
}
|
|
1059
1099
|
return `${schemaType}`;
|
|
1060
1100
|
};
|
|
@@ -1071,20 +1111,20 @@ const getSchemaFilePath = (schemaType, entitySet) => {
|
|
|
1071
1111
|
};
|
|
1072
1112
|
switch (schemaType) {
|
|
1073
1113
|
// Application schema
|
|
1074
|
-
case
|
|
1114
|
+
case ux_specification_types_2.SchemaType.Application: {
|
|
1075
1115
|
// File name
|
|
1076
1116
|
schemaFile.filename = `App`;
|
|
1077
1117
|
// Full path
|
|
1078
|
-
schemaFile.path = `./${
|
|
1118
|
+
schemaFile.path = `./${ux_specification_types_2.DirName.Schemas}/${schemaFile.filename}`;
|
|
1079
1119
|
break;
|
|
1080
1120
|
}
|
|
1081
1121
|
// List report and object page
|
|
1082
|
-
case
|
|
1083
|
-
case
|
|
1122
|
+
case ux_specification_types_2.SchemaType.ListReport:
|
|
1123
|
+
case ux_specification_types_2.SchemaType.ObjectPage: {
|
|
1084
1124
|
// File name
|
|
1085
1125
|
schemaFile.filename = entitySet ? `${schemaType}_${entitySet}` : getGenericSchemaFileName(schemaType);
|
|
1086
1126
|
// Full path
|
|
1087
|
-
schemaFile.path = `../${
|
|
1127
|
+
schemaFile.path = `../${ux_specification_types_2.DirName.Schemas}/${schemaFile.filename}`;
|
|
1088
1128
|
break;
|
|
1089
1129
|
}
|
|
1090
1130
|
// Other page configs
|
|
@@ -1092,7 +1132,7 @@ const getSchemaFilePath = (schemaType, entitySet) => {
|
|
|
1092
1132
|
// File name
|
|
1093
1133
|
schemaFile.filename = getGenericSchemaFileName(schemaType);
|
|
1094
1134
|
// Full path
|
|
1095
|
-
schemaFile.path = `../${
|
|
1135
|
+
schemaFile.path = `../${ux_specification_types_2.DirName.Schemas}/${schemaFile.filename}`;
|
|
1096
1136
|
break;
|
|
1097
1137
|
}
|
|
1098
1138
|
}
|
|
@@ -1110,7 +1150,7 @@ exports.getSchemaFilePath = getSchemaFilePath;
|
|
|
1110
1150
|
* @returns {string} Generated page id
|
|
1111
1151
|
*/
|
|
1112
1152
|
function generatePageId(pageType, entitySet, viewId, pageName) {
|
|
1113
|
-
if (pageType ===
|
|
1153
|
+
if (pageType === ux_specification_types_2.PageTypeV2.CustomPage) {
|
|
1114
1154
|
const names = viewId && viewId.split('.');
|
|
1115
1155
|
return names && names[names.length - 1] + 'Page';
|
|
1116
1156
|
}
|
|
@@ -1318,7 +1358,7 @@ exports.convertEnumToCSV = convertEnumToCSV;
|
|
|
1318
1358
|
*/
|
|
1319
1359
|
function convertActionKeyToStableId(actionId) {
|
|
1320
1360
|
if (!actionId) {
|
|
1321
|
-
return;
|
|
1361
|
+
return '';
|
|
1322
1362
|
}
|
|
1323
1363
|
return (actionId.indexOf('??') > -1 ? actionId.split('??')[1] : actionId).replace(/@/g, '::');
|
|
1324
1364
|
}
|
|
@@ -1363,7 +1403,7 @@ exports.updatePropertyIndices = updatePropertyIndices;
|
|
|
1363
1403
|
* @returns {string} modified string without namespace
|
|
1364
1404
|
*/
|
|
1365
1405
|
function removeNamespaces(sId) {
|
|
1366
|
-
sId = sId.replace(
|
|
1406
|
+
sId = sId.replace(ux_specification_types_2.UIVOCABULARYDOT, '');
|
|
1367
1407
|
sId = sId.replace('com.sap.vocabularies.Communication.v1.', '');
|
|
1368
1408
|
return sId;
|
|
1369
1409
|
}
|
|
@@ -1374,7 +1414,7 @@ exports.removeNamespaces = removeNamespaces;
|
|
|
1374
1414
|
* @returns {string} modified string with replaced namespaces
|
|
1375
1415
|
*/
|
|
1376
1416
|
function replaceNamespaces(sId) {
|
|
1377
|
-
sId = sId.replace(
|
|
1417
|
+
sId = sId.replace(ux_specification_types_2.UIVOCABULARY, 'UI');
|
|
1378
1418
|
sId = sId.replace('com.sap.vocabularies.Communication.v1', 'Communication');
|
|
1379
1419
|
return sId;
|
|
1380
1420
|
}
|