@sap/ux-specification 1.84.96 → 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 +25 -0
- package/dist/documentation/v2/v2-AnalyticalListPage.html +2 -2
- package/dist/documentation/v2/v2-ApplicationV2.html +2 -2
- package/dist/documentation/v2/v2-ListReport.html +2 -2
- package/dist/documentation/v2/v2-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 +24 -24
- 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 +6 -4
- package/dist/specification/src/sync/common/appProvider.js +5 -3
- package/dist/specification/src/sync/common/appProvider.js.map +1 -1
- package/dist/specification/src/sync/common/importProject.d.ts.map +1 -1
- package/dist/specification/src/sync/common/importProject.js +5 -3
- package/dist/specification/src/sync/common/importProject.js.map +1 -1
- package/dist/specification/src/sync/common/utils.d.ts +19 -1
- package/dist/specification/src/sync/common/utils.d.ts.map +1 -1
- package/dist/specification/src/sync/common/utils.js +130 -94
- package/dist/specification/src/sync/common/utils.js.map +1 -1
- package/dist/types/src/apiTypes.d.ts +2 -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 +6 -4
|
@@ -3,8 +3,9 @@ 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");
|
|
@@ -12,11 +13,12 @@ const edmx_parser_1 = require("@sap-ux/edmx-parser");
|
|
|
12
13
|
const extensionLogger_1 = require("../../extensionLogger");
|
|
13
14
|
exports.DEFINITION_LINK_PREFIX = '#/definitions/';
|
|
14
15
|
exports.V4_TEMPLATES = [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
|
19
20
|
];
|
|
21
|
+
exports.V4_LIBS = ['sap.fe.core', 'sap.fe.templates'];
|
|
20
22
|
const arrayIncludes = (arr, target) => target.every((v) => arr.includes(v));
|
|
21
23
|
exports.arrayIncludes = arrayIncludes;
|
|
22
24
|
/**
|
|
@@ -252,7 +254,7 @@ exports.prepareRef = prepareRef;
|
|
|
252
254
|
*/
|
|
253
255
|
function getPageTypeV2(name) {
|
|
254
256
|
if (name) {
|
|
255
|
-
const templatePart = `${
|
|
257
|
+
const templatePart = `${ux_specification_types_2.v2.FE_TEMPLATE_V2}.`;
|
|
256
258
|
return name.split(templatePart)[1];
|
|
257
259
|
}
|
|
258
260
|
}
|
|
@@ -262,14 +264,14 @@ exports.getPageTypeV2 = getPageTypeV2;
|
|
|
262
264
|
* @param name - page component name
|
|
263
265
|
*/
|
|
264
266
|
function getPageTypeV4(v4App) {
|
|
265
|
-
if (v4App.name && v4App.name !==
|
|
266
|
-
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}.`;
|
|
267
269
|
return v4App.name.split(templatePart)[1];
|
|
268
270
|
}
|
|
269
|
-
else if (v4App?.name ===
|
|
271
|
+
else if (v4App?.name === ux_specification_types_2.v4.FE_TEMPLATE_V4_CUSTOM_PAGE ||
|
|
270
272
|
v4App.viewId ||
|
|
271
273
|
v4App.viewName) {
|
|
272
|
-
return
|
|
274
|
+
return ux_specification_types_2.PageTypeV4.CustomPage;
|
|
273
275
|
}
|
|
274
276
|
}
|
|
275
277
|
exports.getPageTypeV4 = getPageTypeV4;
|
|
@@ -331,11 +333,11 @@ function adjustKey(key, navigationParts, keyForRelatedFacetKeys) {
|
|
|
331
333
|
key = pathParts.join('::');
|
|
332
334
|
}
|
|
333
335
|
else {
|
|
334
|
-
key = uiClass.replace('@UI', `${!keyForRelatedFacetKeys ? '@' : ''}${
|
|
336
|
+
key = uiClass.replace('@UI', `${!keyForRelatedFacetKeys ? '@' : ''}${ux_specification_types_2.UIVOCABULARY}`);
|
|
335
337
|
}
|
|
336
338
|
return key;
|
|
337
339
|
}
|
|
338
|
-
function getKeyAndEntityTypeOfReferenceFacet(oDataServiceAVT, key, entityType, propertyValue, oDataVersion =
|
|
340
|
+
function getKeyAndEntityTypeOfReferenceFacet(oDataServiceAVT, key, entityType, propertyValue, oDataVersion = ux_specification_types_2.FioriElementsVersion.v2, keyForRelatedFacetKeys = false) {
|
|
339
341
|
let stopProcessing = false;
|
|
340
342
|
let namespace;
|
|
341
343
|
const navigationParts = propertyValue.split('/');
|
|
@@ -346,7 +348,7 @@ function getKeyAndEntityTypeOfReferenceFacet(oDataServiceAVT, key, entityType, p
|
|
|
346
348
|
key = adjustKey(key, navigationParts, keyForRelatedFacetKeys);
|
|
347
349
|
const targetAnnotation = determineTargetAnnotation(navigationParts, entityType, oDataServiceAVT);
|
|
348
350
|
if (targetAnnotation) {
|
|
349
|
-
const separator = oDataVersion ===
|
|
351
|
+
const separator = oDataVersion === ux_specification_types_2.FioriElementsVersion.v2 ? '::' : '#';
|
|
350
352
|
key = getTargetAnnotationName(targetAnnotation, keyForRelatedFacetKeys).replace('#', separator);
|
|
351
353
|
namespace = targetAnnotation.fullyQualifiedName?.split('@')[0];
|
|
352
354
|
}
|
|
@@ -355,7 +357,7 @@ function getKeyAndEntityTypeOfReferenceFacet(oDataServiceAVT, key, entityType, p
|
|
|
355
357
|
return { key, entityType, stopProcessing, namespace };
|
|
356
358
|
}
|
|
357
359
|
if (navigation) {
|
|
358
|
-
const navSeparator = oDataVersion ===
|
|
360
|
+
const navSeparator = oDataVersion === ux_specification_types_2.FioriElementsVersion.v2 ? '::' : '/';
|
|
359
361
|
navigationParts.pop();
|
|
360
362
|
const navigationIDs = [...navigationParts].join(navSeparator);
|
|
361
363
|
key = `${navigationIDs}${navSeparator}${key}`;
|
|
@@ -371,7 +373,7 @@ function getKeyAndEntityTypeOfReferenceFacet(oDataServiceAVT, key, entityType, p
|
|
|
371
373
|
* @param {ExtensionLogger} logger - Logger class for logging messages
|
|
372
374
|
* @returns {FacetSection} - object comprising the relevant facet information
|
|
373
375
|
*/
|
|
374
|
-
function getSectionFacet(facetDefinition, sourceEntityType, oDataServiceAVT, logger, oDataVersion =
|
|
376
|
+
function getSectionFacet(facetDefinition, sourceEntityType, oDataServiceAVT, logger, oDataVersion = ux_specification_types_2.FioriElementsVersion.v2, keyForRelatedFacetKeys = false) {
|
|
375
377
|
//Take facet ID as fallback
|
|
376
378
|
const facetName = facetDefinition.fullyQualifiedName?.substring(facetDefinition.fullyQualifiedName?.lastIndexOf('@'));
|
|
377
379
|
let key = facetDefinition.ID ? facetDefinition.ID.toString() : facetName;
|
|
@@ -470,7 +472,7 @@ function getSchemaKeyOfLineItemRecord(lineItemRecord) {
|
|
|
470
472
|
schemaKey =
|
|
471
473
|
'DataFieldForAnnotation:::sTarget::' +
|
|
472
474
|
target
|
|
473
|
-
.replace('@UI', `@${
|
|
475
|
+
.replace('@UI', `@${ux_specification_types_2.UIVOCABULARY}`)
|
|
474
476
|
.replace('@Communication', '@com.sap.vocabularies.Communication.v1')
|
|
475
477
|
.replace('@Contact', '@com.sap.vocabularies.Contact.v1');
|
|
476
478
|
}
|
|
@@ -566,20 +568,20 @@ function getAnnotationTerm(path, alias, entityType) {
|
|
|
566
568
|
* @param {ConvertedMetadata} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
|
|
567
569
|
*/
|
|
568
570
|
function evaluateTargetAnnotation(section, annotationRecord, facets, entityType, oDataServiceAVT) {
|
|
569
|
-
const alias = findAlias(
|
|
571
|
+
const alias = findAlias(ux_specification_types_2.UIVOCABULARY, oDataServiceAVT);
|
|
570
572
|
let path = section ? section.key : '';
|
|
571
573
|
const targetEntityType = section.entityType;
|
|
572
574
|
const annotationTerm = getAnnotationTerm(path, alias, entityType);
|
|
573
575
|
switch (annotationTerm) {
|
|
574
576
|
case "com.sap.vocabularies.UI.v1.Chart" /* UIAnnotationTerms.Chart */: {
|
|
575
|
-
facets[path] = { base:
|
|
577
|
+
facets[path] = { base: ux_specification_types_2.FacetBase.Chart };
|
|
576
578
|
facets[path].target = annotationRecord?.Target?.$target;
|
|
577
579
|
facets[path].entityType = targetEntityType;
|
|
578
580
|
facets[path].namespace = section.namespace;
|
|
579
581
|
break;
|
|
580
582
|
}
|
|
581
583
|
case "com.sap.vocabularies.UI.v1.Identification" /* UIAnnotationTerms.Identification */: {
|
|
582
|
-
facets[path] = { base:
|
|
584
|
+
facets[path] = { base: ux_specification_types_2.FacetBase.Identification };
|
|
583
585
|
facets[path].target = annotationRecord?.Target?.$target;
|
|
584
586
|
facets[path].entityType = targetEntityType;
|
|
585
587
|
facets[path].namespace = section.namespace;
|
|
@@ -591,21 +593,21 @@ function evaluateTargetAnnotation(section, annotationRecord, facets, entityType,
|
|
|
591
593
|
pathParts[pathParts.length - 1] = `@${"com.sap.vocabularies.UI.v1.LineItem" /* UIAnnotationTerms.LineItem */}`;
|
|
592
594
|
path = pathParts.join('::');
|
|
593
595
|
}
|
|
594
|
-
facets[path] = { base:
|
|
596
|
+
facets[path] = { base: ux_specification_types_2.FacetBase.LineItem };
|
|
595
597
|
facets[path].target = annotationRecord?.Target?.$target;
|
|
596
598
|
facets[path].entityType = targetEntityType;
|
|
597
599
|
facets[path].namespace = section.namespace;
|
|
598
600
|
break;
|
|
599
601
|
}
|
|
600
602
|
case "com.sap.vocabularies.UI.v1.FieldGroup" /* UIAnnotationTerms.FieldGroup */: {
|
|
601
|
-
facets[path] = { base:
|
|
603
|
+
facets[path] = { base: ux_specification_types_2.FacetBase.Form };
|
|
602
604
|
facets[path].target = annotationRecord?.Target?.$target;
|
|
603
605
|
facets[path].entityType = targetEntityType;
|
|
604
606
|
facets[path].namespace = section.namespace;
|
|
605
607
|
break;
|
|
606
608
|
}
|
|
607
609
|
case "com.sap.vocabularies.UI.v1.DataPoint" /* UIAnnotationTerms.DataPoint */: {
|
|
608
|
-
facets[path] = { base:
|
|
610
|
+
facets[path] = { base: ux_specification_types_2.FacetBase.DataPoint };
|
|
609
611
|
facets[path].Label = annotationRecord?.Target?.$target['Title'];
|
|
610
612
|
facets[path].target = annotationRecord?.Target?.$target;
|
|
611
613
|
facets[path].entityType = targetEntityType;
|
|
@@ -613,32 +615,32 @@ function evaluateTargetAnnotation(section, annotationRecord, facets, entityType,
|
|
|
613
615
|
break;
|
|
614
616
|
}
|
|
615
617
|
case "com.sap.vocabularies.UI.v1.PresentationVariant" /* UIAnnotationTerms.PresentationVariant */: {
|
|
616
|
-
facets[path] = { base:
|
|
618
|
+
facets[path] = { base: ux_specification_types_2.FacetBase.PresentationVariant };
|
|
617
619
|
facets[path].target = annotationRecord?.Target?.$target;
|
|
618
620
|
facets[path].entityType = targetEntityType;
|
|
619
621
|
facets[path].namespace = section.namespace;
|
|
620
622
|
break;
|
|
621
623
|
}
|
|
622
624
|
case "com.sap.vocabularies.Communication.v1.Contact" /* CommunicationAnnotationTerms.Contact */: {
|
|
623
|
-
facets[path] = { base:
|
|
625
|
+
facets[path] = { base: ux_specification_types_2.FacetBase.Contact };
|
|
624
626
|
facets[path].target = annotationRecord?.Target?.$target;
|
|
625
627
|
facets[path].entityType = targetEntityType;
|
|
626
628
|
facets[path].namespace = section.namespace;
|
|
627
629
|
break;
|
|
628
630
|
}
|
|
629
631
|
case "com.sap.vocabularies.Communication.v1.Address" /* CommunicationAnnotationTerms.Address */: {
|
|
630
|
-
facets[path] = { base:
|
|
632
|
+
facets[path] = { base: ux_specification_types_2.FacetBase.Address };
|
|
631
633
|
facets[path].target = annotationRecord?.Target?.$target;
|
|
632
634
|
facets[path].entityType = targetEntityType;
|
|
633
635
|
facets[path].namespace = section.namespace;
|
|
634
636
|
break;
|
|
635
637
|
}
|
|
636
638
|
default: {
|
|
637
|
-
facets[path] = { base:
|
|
639
|
+
facets[path] = { base: ux_specification_types_2.FacetBase.Unknown };
|
|
638
640
|
}
|
|
639
641
|
}
|
|
640
642
|
if (facets[path]) {
|
|
641
|
-
facets[path].annotationPath = `/${annotationRecord.fullyQualifiedName.replace('@com.sap.vocabularies',
|
|
643
|
+
facets[path].annotationPath = `/${annotationRecord.fullyQualifiedName.replace('@com.sap.vocabularies', ux_specification_types_2.VOCWITHSLASH)}`;
|
|
642
644
|
if (annotationRecord.Label) {
|
|
643
645
|
facets[path].Label = annotationRecord.Label;
|
|
644
646
|
}
|
|
@@ -661,7 +663,7 @@ function evaluateTargetAnnotation(section, annotationRecord, facets, entityType,
|
|
|
661
663
|
* @param {FioriElementsVersion} oDataVersion - OData version
|
|
662
664
|
* @param {ExtensionLogger} logger - Logger class for logging messages
|
|
663
665
|
*/
|
|
664
|
-
function addFacetToConfig(annotationRecord, oDataServiceAVT, serviceName, entityType, facets, oDataVersion =
|
|
666
|
+
function addFacetToConfig(annotationRecord, oDataServiceAVT, serviceName, entityType, facets, oDataVersion = ux_specification_types_2.FioriElementsVersion.v2, logger) {
|
|
665
667
|
const section = getSectionFacet(annotationRecord, entityType, oDataServiceAVT, logger, oDataVersion, false);
|
|
666
668
|
if (section) {
|
|
667
669
|
switch (annotationRecord.$Type) {
|
|
@@ -672,14 +674,14 @@ function addFacetToConfig(annotationRecord, oDataServiceAVT, serviceName, entity
|
|
|
672
674
|
case "com.sap.vocabularies.UI.v1.CollectionFacet" /* UIAnnotationTypes.CollectionFacet */: {
|
|
673
675
|
const annotationPath = `/${entityType.fullyQualifiedName}/${annotationRecord.fullyQualifiedName.split(entityType.fullyQualifiedName)[1]}`;
|
|
674
676
|
const facet = (facets[section.key] = {
|
|
675
|
-
base:
|
|
677
|
+
base: ux_specification_types_2.FacetBase.CollectionFacet,
|
|
676
678
|
facets: {},
|
|
677
679
|
ID: section.ID,
|
|
678
680
|
annotationPath: annotationPath,
|
|
679
681
|
Label: section.label,
|
|
680
682
|
namespace: section.namespace
|
|
681
683
|
});
|
|
682
|
-
if (!facet.ID && oDataVersion ===
|
|
684
|
+
if (!facet.ID && oDataVersion === ux_specification_types_2.FioriElementsVersion.v4) {
|
|
683
685
|
(0, extensionLogger_1.log)(logger, {
|
|
684
686
|
severity: "error" /* LogSeverity.Error */,
|
|
685
687
|
message: i18next_1.default.t('NOID4SECTION', { facet: annotationRecord.fullyQualifiedName })
|
|
@@ -700,12 +702,12 @@ function addFacetToConfig(annotationRecord, oDataServiceAVT, serviceName, entity
|
|
|
700
702
|
* @param {FioriElementsVersion} oDataVersion - OData version
|
|
701
703
|
* @param {ExtensionLogger} logger - Logger class for logging messages
|
|
702
704
|
*/
|
|
703
|
-
function getObjectPageHeaderFacets(entityType, oDataServiceAVT, oDataVersion =
|
|
705
|
+
function getObjectPageHeaderFacets(entityType, oDataServiceAVT, oDataVersion = ux_specification_types_2.FioriElementsVersion.v2, logger) {
|
|
704
706
|
const facets = {};
|
|
705
707
|
if (!entityType || !entityType.annotations) {
|
|
706
708
|
return;
|
|
707
709
|
}
|
|
708
|
-
const alias = findAlias(
|
|
710
|
+
const alias = findAlias(ux_specification_types_2.UIVOCABULARY, oDataServiceAVT);
|
|
709
711
|
const facetAnnotation = alias && entityType?.annotations?.[alias]?.HeaderFacets;
|
|
710
712
|
if (facetAnnotation) {
|
|
711
713
|
const lastDot = entityType && entityType.fullyQualifiedName.lastIndexOf('.');
|
|
@@ -725,12 +727,12 @@ exports.getObjectPageHeaderFacets = getObjectPageHeaderFacets;
|
|
|
725
727
|
* @param {FioriElementsVersion} oDataVersion - OData version
|
|
726
728
|
* @param {ExtensionLogger} logger - Logger class for logging messages
|
|
727
729
|
*/
|
|
728
|
-
function getObjectPageFacets(entityType, oDataServiceAVT, oDataVersion =
|
|
730
|
+
function getObjectPageFacets(entityType, oDataServiceAVT, oDataVersion = ux_specification_types_2.FioriElementsVersion.v2, logger) {
|
|
729
731
|
const facets = {};
|
|
730
732
|
if (!entityType || !entityType.annotations) {
|
|
731
733
|
return;
|
|
732
734
|
}
|
|
733
|
-
const alias = findAlias(
|
|
735
|
+
const alias = findAlias(ux_specification_types_2.UIVOCABULARY, oDataServiceAVT);
|
|
734
736
|
const facetAnnotation = alias && entityType?.annotations[alias]?.Facets;
|
|
735
737
|
if (facetAnnotation) {
|
|
736
738
|
const lastDot = entityType && entityType.fullyQualifiedName.lastIndexOf('.');
|
|
@@ -746,24 +748,58 @@ exports.getObjectPageFacets = getObjectPageFacets;
|
|
|
746
748
|
/**
|
|
747
749
|
* Returns the version of Fiori elements (v2/v4) from a given manifest
|
|
748
750
|
* @param manifest - the manifest.json file
|
|
751
|
+
* @returns FioriElementsVersion
|
|
749
752
|
*/
|
|
750
|
-
function
|
|
751
|
-
if ((manifest[
|
|
752
|
-
(manifest[
|
|
753
|
-
return
|
|
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;
|
|
754
757
|
}
|
|
755
758
|
else {
|
|
756
|
-
const targets = manifest[
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
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;
|
|
760
765
|
}
|
|
761
766
|
else {
|
|
762
767
|
return undefined;
|
|
763
768
|
}
|
|
764
769
|
}
|
|
765
770
|
}
|
|
766
|
-
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;
|
|
767
803
|
/**
|
|
768
804
|
* Determines the template type of a V2 app
|
|
769
805
|
* @param manifest - the manifest.json file
|
|
@@ -772,27 +808,27 @@ exports.getVersionFromManifest = getVersionFromManifest;
|
|
|
772
808
|
*/
|
|
773
809
|
function determineV2Template(manifest, logger) {
|
|
774
810
|
let templateType;
|
|
775
|
-
if (manifest[
|
|
776
|
-
const v2Pages = manifest[
|
|
811
|
+
if (manifest[ux_specification_types_2.ManifestSection.generic]) {
|
|
812
|
+
const v2Pages = manifest[ux_specification_types_2.ManifestSection.generic].pages;
|
|
777
813
|
if (!v2Pages) {
|
|
778
814
|
(0, extensionLogger_1.log)(logger, {
|
|
779
815
|
severity: "error" /* LogSeverity.Error */,
|
|
780
816
|
message: i18next_1.default.t('NOPAGES', { appId: manifest['sap.app']['id'] }),
|
|
781
817
|
location: {
|
|
782
|
-
path:
|
|
783
|
-
range: [
|
|
818
|
+
path: ux_specification_types_2.MANIFESTPATH,
|
|
819
|
+
range: [ux_specification_types_2.ManifestSection.generic]
|
|
784
820
|
}
|
|
785
821
|
});
|
|
786
822
|
return;
|
|
787
823
|
}
|
|
788
824
|
for (const pageKey in v2Pages) {
|
|
789
825
|
const v2Page = v2Pages[pageKey];
|
|
790
|
-
if (getPageTypeV2(v2Page.component?.name) ===
|
|
791
|
-
templateType =
|
|
826
|
+
if (getPageTypeV2(v2Page.component?.name) === ux_specification_types_2.PageTypeV2.AnalyticalListPage) {
|
|
827
|
+
templateType = ux_specification_types_2.TemplateType.AnalyticalListPageV2;
|
|
792
828
|
break;
|
|
793
829
|
}
|
|
794
|
-
else if (getPageTypeV2(v2Page.component?.name) ===
|
|
795
|
-
templateType =
|
|
830
|
+
else if (getPageTypeV2(v2Page.component?.name) === ux_specification_types_2.PageTypeV2.ListReport) {
|
|
831
|
+
templateType = ux_specification_types_2.TemplateType.ListReportObjectPageV2;
|
|
796
832
|
break;
|
|
797
833
|
}
|
|
798
834
|
}
|
|
@@ -801,10 +837,10 @@ function determineV2Template(manifest, logger) {
|
|
|
801
837
|
if (!templateType) {
|
|
802
838
|
(0, extensionLogger_1.log)(logger, {
|
|
803
839
|
severity: "error" /* LogSeverity.Error */,
|
|
804
|
-
message: i18next_1.default.t('NOTEMPLATE', { section:
|
|
840
|
+
message: i18next_1.default.t('NOTEMPLATE', { section: ux_specification_types_2.ManifestSection.generic }),
|
|
805
841
|
location: {
|
|
806
|
-
path:
|
|
807
|
-
range: [
|
|
842
|
+
path: ux_specification_types_2.MANIFESTPATH,
|
|
843
|
+
range: [ux_specification_types_2.ManifestSection.generic]
|
|
808
844
|
}
|
|
809
845
|
});
|
|
810
846
|
}
|
|
@@ -820,24 +856,24 @@ exports.determineV2Template = determineV2Template;
|
|
|
820
856
|
function determineV4PageTemplateType(v4Page) {
|
|
821
857
|
let templateType;
|
|
822
858
|
const pageType = getPageTypeV4(v4Page);
|
|
823
|
-
if (pageType ===
|
|
824
|
-
templateType =
|
|
859
|
+
if (pageType === ux_specification_types_2.PageTypeV4.AnalyticalListPage) {
|
|
860
|
+
templateType = ux_specification_types_2.TemplateType.AnalyticalListPageV4;
|
|
825
861
|
}
|
|
826
|
-
else if (pageType ===
|
|
862
|
+
else if (pageType === ux_specification_types_2.PageTypeV4.ListReport) {
|
|
827
863
|
const viewPath = v4Page.options?.settings?.views?.paths?.[0];
|
|
828
|
-
if (viewPath && (viewPath[
|
|
829
|
-
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;
|
|
830
866
|
}
|
|
831
867
|
else {
|
|
832
|
-
templateType =
|
|
868
|
+
templateType = ux_specification_types_2.TemplateType.ListReportObjectPageV4;
|
|
833
869
|
}
|
|
834
870
|
}
|
|
835
|
-
else if (pageType ===
|
|
836
|
-
templateType =
|
|
871
|
+
else if (pageType === ux_specification_types_2.PageTypeV4.ObjectPage) {
|
|
872
|
+
templateType = ux_specification_types_2.TemplateType.ListReportObjectPageV4;
|
|
837
873
|
//fixed now for FEOP scenario, bit continue to check if LR/ALP exists
|
|
838
874
|
}
|
|
839
|
-
else if (pageType ===
|
|
840
|
-
templateType =
|
|
875
|
+
else if (pageType === ux_specification_types_2.PageTypeV4.CustomPage) {
|
|
876
|
+
templateType = ux_specification_types_2.TemplateType.FreestylePageV4;
|
|
841
877
|
}
|
|
842
878
|
return templateType;
|
|
843
879
|
}
|
|
@@ -865,29 +901,29 @@ function determineV4TemplateFromPages(v4Pages) {
|
|
|
865
901
|
* @returns {TemplateType} the template type
|
|
866
902
|
*/
|
|
867
903
|
function determineV4Template(manifest, logger) {
|
|
868
|
-
const v4Pages = manifest[
|
|
869
|
-
manifest[
|
|
904
|
+
const v4Pages = manifest[ux_specification_types_2.ManifestSection.ui5].routing &&
|
|
905
|
+
manifest[ux_specification_types_2.ManifestSection.ui5].routing.targets;
|
|
870
906
|
// if there are no pages in routing targets, we use LROPV4 as default template type
|
|
871
907
|
if (!v4Pages || Object.keys(v4Pages).length === 0) {
|
|
872
908
|
(0, extensionLogger_1.log)(logger, {
|
|
873
909
|
severity: "info" /* LogSeverity.Info */,
|
|
874
910
|
message: i18next_1.default.t('NOPAGES', { appId: manifest['sap.app']['id'] }),
|
|
875
911
|
location: {
|
|
876
|
-
path:
|
|
877
|
-
range: [
|
|
912
|
+
path: ux_specification_types_2.MANIFESTPATH,
|
|
913
|
+
range: [ux_specification_types_2.ManifestSection.ui5, 'routing']
|
|
878
914
|
}
|
|
879
915
|
});
|
|
880
|
-
return
|
|
916
|
+
return ux_specification_types_2.TemplateType.ListReportObjectPageV4;
|
|
881
917
|
}
|
|
882
918
|
// else try to determine template type from routing targets
|
|
883
919
|
const templateType = determineV4TemplateFromPages(v4Pages);
|
|
884
920
|
if (!templateType) {
|
|
885
921
|
(0, extensionLogger_1.log)(logger, {
|
|
886
922
|
severity: "error" /* LogSeverity.Error */,
|
|
887
|
-
message: i18next_1.default.t('NOTEMPLATE', { section:
|
|
923
|
+
message: i18next_1.default.t('NOTEMPLATE', { section: ux_specification_types_2.ManifestSection.ui5 }),
|
|
888
924
|
location: {
|
|
889
|
-
path:
|
|
890
|
-
range: [
|
|
925
|
+
path: ux_specification_types_2.MANIFESTPATH,
|
|
926
|
+
range: [ux_specification_types_2.ManifestSection.ui5, 'routing', 'targets']
|
|
891
927
|
}
|
|
892
928
|
});
|
|
893
929
|
}
|
|
@@ -903,13 +939,13 @@ exports.determineV4Template = determineV4Template;
|
|
|
903
939
|
*/
|
|
904
940
|
function getTemplateTypeFromManifest(manifest, fioriElementsVersion, logger) {
|
|
905
941
|
let templateType;
|
|
906
|
-
if (manifest[
|
|
907
|
-
templateType =
|
|
942
|
+
if (manifest[ux_specification_types_2.ManifestSection.ovp]) {
|
|
943
|
+
templateType = ux_specification_types_2.TemplateType.OverviewPageV2;
|
|
908
944
|
}
|
|
909
|
-
else if (fioriElementsVersion ===
|
|
945
|
+
else if (fioriElementsVersion === ux_specification_types_2.FioriElementsVersion.v2) {
|
|
910
946
|
templateType = determineV2Template(manifest, logger);
|
|
911
947
|
}
|
|
912
|
-
else if (fioriElementsVersion ===
|
|
948
|
+
else if (fioriElementsVersion === ux_specification_types_2.FioriElementsVersion.v4) {
|
|
913
949
|
templateType = determineV4Template(manifest, logger);
|
|
914
950
|
}
|
|
915
951
|
return templateType;
|
|
@@ -923,12 +959,12 @@ exports.getTemplateTypeFromManifest = getTemplateTypeFromManifest;
|
|
|
923
959
|
*/
|
|
924
960
|
function addSectionTitleAndDescription(facet, section, facetKey) {
|
|
925
961
|
if (facet?.ID) {
|
|
926
|
-
section.title =
|
|
927
|
-
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 }];
|
|
928
964
|
}
|
|
929
965
|
else {
|
|
930
966
|
section.title = facetKey.replace(/@com.sap/g, 'com.sap');
|
|
931
|
-
section[
|
|
967
|
+
section[ux_specification_types_2.SchemaTag.keys] = [{ name: ux_specification_types_2.SchemaKeyName.id, value: facetKey.replace(ux_specification_types_2.UIVOCABULARYALPHADOT, '') }];
|
|
932
968
|
}
|
|
933
969
|
// Description
|
|
934
970
|
if (facet?.Label) {
|
|
@@ -975,8 +1011,8 @@ function createDefaultSection(appSchema, facet, facetKey) {
|
|
|
975
1011
|
properties: {},
|
|
976
1012
|
additionalProperties: false
|
|
977
1013
|
};
|
|
978
|
-
section[
|
|
979
|
-
section[
|
|
1014
|
+
section[ux_specification_types_2.SchemaTag.isViewNode] = true;
|
|
1015
|
+
section[ux_specification_types_2.SchemaTag.annotationPath] = facet.annotationPath;
|
|
980
1016
|
addTargetTitleAndSectionDescription(facet, section, facetKey);
|
|
981
1017
|
return section;
|
|
982
1018
|
}
|
|
@@ -990,8 +1026,8 @@ exports.createDefaultSection = createDefaultSection;
|
|
|
990
1026
|
* @param {boolean} [checkUnresolvableFacets=false] - Check and avoid facets and sections without ID and Target.
|
|
991
1027
|
* @returns {FacetSection[]} - Array of facets or sections
|
|
992
1028
|
*/
|
|
993
|
-
function getObjectPageFacetSection(entityType, oDataServiceAVT, logger, oDataVersion =
|
|
994
|
-
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);
|
|
995
1031
|
let sections = [];
|
|
996
1032
|
if (entityType) {
|
|
997
1033
|
const facetAnnotation = alias && entityType?.annotations?.[alias]?.Facets;
|
|
@@ -1057,8 +1093,8 @@ exports.deleteEmptyStructure = deleteEmptyStructure;
|
|
|
1057
1093
|
* @return {string} File name of generic schema.
|
|
1058
1094
|
*/
|
|
1059
1095
|
const getGenericSchemaFileName = (schemaType) => {
|
|
1060
|
-
if (schemaType ===
|
|
1061
|
-
return
|
|
1096
|
+
if (schemaType === ux_specification_types_2.SchemaType.FreestylePage) {
|
|
1097
|
+
return ux_specification_types_2.PageTypeV2.CustomPage;
|
|
1062
1098
|
}
|
|
1063
1099
|
return `${schemaType}`;
|
|
1064
1100
|
};
|
|
@@ -1075,20 +1111,20 @@ const getSchemaFilePath = (schemaType, entitySet) => {
|
|
|
1075
1111
|
};
|
|
1076
1112
|
switch (schemaType) {
|
|
1077
1113
|
// Application schema
|
|
1078
|
-
case
|
|
1114
|
+
case ux_specification_types_2.SchemaType.Application: {
|
|
1079
1115
|
// File name
|
|
1080
1116
|
schemaFile.filename = `App`;
|
|
1081
1117
|
// Full path
|
|
1082
|
-
schemaFile.path = `./${
|
|
1118
|
+
schemaFile.path = `./${ux_specification_types_2.DirName.Schemas}/${schemaFile.filename}`;
|
|
1083
1119
|
break;
|
|
1084
1120
|
}
|
|
1085
1121
|
// List report and object page
|
|
1086
|
-
case
|
|
1087
|
-
case
|
|
1122
|
+
case ux_specification_types_2.SchemaType.ListReport:
|
|
1123
|
+
case ux_specification_types_2.SchemaType.ObjectPage: {
|
|
1088
1124
|
// File name
|
|
1089
1125
|
schemaFile.filename = entitySet ? `${schemaType}_${entitySet}` : getGenericSchemaFileName(schemaType);
|
|
1090
1126
|
// Full path
|
|
1091
|
-
schemaFile.path = `../${
|
|
1127
|
+
schemaFile.path = `../${ux_specification_types_2.DirName.Schemas}/${schemaFile.filename}`;
|
|
1092
1128
|
break;
|
|
1093
1129
|
}
|
|
1094
1130
|
// Other page configs
|
|
@@ -1096,7 +1132,7 @@ const getSchemaFilePath = (schemaType, entitySet) => {
|
|
|
1096
1132
|
// File name
|
|
1097
1133
|
schemaFile.filename = getGenericSchemaFileName(schemaType);
|
|
1098
1134
|
// Full path
|
|
1099
|
-
schemaFile.path = `../${
|
|
1135
|
+
schemaFile.path = `../${ux_specification_types_2.DirName.Schemas}/${schemaFile.filename}`;
|
|
1100
1136
|
break;
|
|
1101
1137
|
}
|
|
1102
1138
|
}
|
|
@@ -1114,7 +1150,7 @@ exports.getSchemaFilePath = getSchemaFilePath;
|
|
|
1114
1150
|
* @returns {string} Generated page id
|
|
1115
1151
|
*/
|
|
1116
1152
|
function generatePageId(pageType, entitySet, viewId, pageName) {
|
|
1117
|
-
if (pageType ===
|
|
1153
|
+
if (pageType === ux_specification_types_2.PageTypeV2.CustomPage) {
|
|
1118
1154
|
const names = viewId && viewId.split('.');
|
|
1119
1155
|
return names && names[names.length - 1] + 'Page';
|
|
1120
1156
|
}
|
|
@@ -1367,7 +1403,7 @@ exports.updatePropertyIndices = updatePropertyIndices;
|
|
|
1367
1403
|
* @returns {string} modified string without namespace
|
|
1368
1404
|
*/
|
|
1369
1405
|
function removeNamespaces(sId) {
|
|
1370
|
-
sId = sId.replace(
|
|
1406
|
+
sId = sId.replace(ux_specification_types_2.UIVOCABULARYDOT, '');
|
|
1371
1407
|
sId = sId.replace('com.sap.vocabularies.Communication.v1.', '');
|
|
1372
1408
|
return sId;
|
|
1373
1409
|
}
|
|
@@ -1378,7 +1414,7 @@ exports.removeNamespaces = removeNamespaces;
|
|
|
1378
1414
|
* @returns {string} modified string with replaced namespaces
|
|
1379
1415
|
*/
|
|
1380
1416
|
function replaceNamespaces(sId) {
|
|
1381
|
-
sId = sId.replace(
|
|
1417
|
+
sId = sId.replace(ux_specification_types_2.UIVOCABULARY, 'UI');
|
|
1382
1418
|
sId = sId.replace('com.sap.vocabularies.Communication.v1', 'Communication');
|
|
1383
1419
|
return sId;
|
|
1384
1420
|
}
|