@sap/ux-specification 1.124.0 → 1.124.1
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 -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-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 +86 -86
- 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/schemas/v4/BuildingBlocksConfig.json +1812 -391
- package/dist/specification/package.json +5 -5
- package/dist/specification/src/api.js +1 -1
- 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 +140 -103
- 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 +5 -5
|
@@ -3,8 +3,10 @@ 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.
|
|
6
|
+
exports.removeNamespaces = exports.getJSONPropertyByPath = exports.updatePropertyIndices = exports.isFeatureSupported = exports.getErrorMessage = exports.getDefinitionsRef = 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.getAnnotationPathUsingFullyQualifiedName = exports.getSchemaKeyOfLineItemRecord = exports.setManifestSectionByPathV4 = exports.getManifestSectionByPathV4 = exports.prepareValueForPath = exports.getSectionFacet = exports.getAnnotationFromMetaPath = 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
|
+
exports.replaceNamespaces = void 0;
|
|
7
8
|
const ux_specification_types_1 = require("@sap/ux-specification-types");
|
|
9
|
+
const ux_specification_types_2 = require("@sap/ux-specification-types");
|
|
8
10
|
const i18next_1 = __importDefault(require("i18next"));
|
|
9
11
|
const deepmerge_1 = __importDefault(require("deepmerge"));
|
|
10
12
|
const annotation_converter_1 = require("@sap-ux/annotation-converter");
|
|
@@ -12,11 +14,12 @@ const edmx_parser_1 = require("@sap-ux/edmx-parser");
|
|
|
12
14
|
const extensionLogger_1 = require("../../extensionLogger");
|
|
13
15
|
exports.DEFINITION_LINK_PREFIX = '#/definitions/';
|
|
14
16
|
exports.V4_TEMPLATES = [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
ux_specification_types_2.v4.FE_TEMPLATE_V4_LIST_REPORT,
|
|
18
|
+
ux_specification_types_2.v4.FE_TEMPLATE_V4_ALP,
|
|
19
|
+
ux_specification_types_2.v4.FE_TEMPLATE_V4_OBJECT_PAGE,
|
|
20
|
+
ux_specification_types_2.v4.FE_TEMPLATE_V4_CUSTOM_PAGE
|
|
19
21
|
];
|
|
22
|
+
exports.V4_LIBS = ['sap.fe.core', 'sap.fe.templates'];
|
|
20
23
|
const arrayIncludes = (arr, target) => target.every((v) => arr.includes(v));
|
|
21
24
|
exports.arrayIncludes = arrayIncludes;
|
|
22
25
|
/**
|
|
@@ -252,7 +255,7 @@ exports.prepareRef = prepareRef;
|
|
|
252
255
|
*/
|
|
253
256
|
function getPageTypeV2(name) {
|
|
254
257
|
if (name) {
|
|
255
|
-
const templatePart = `${
|
|
258
|
+
const templatePart = `${ux_specification_types_2.v2.FE_TEMPLATE_V2}.`;
|
|
256
259
|
return name.split(templatePart)[1];
|
|
257
260
|
}
|
|
258
261
|
}
|
|
@@ -262,16 +265,16 @@ exports.getPageTypeV2 = getPageTypeV2;
|
|
|
262
265
|
* @param name - page component name
|
|
263
266
|
*/
|
|
264
267
|
function getPageTypeV4(v4App) {
|
|
265
|
-
if (v4App.name && v4App.name !==
|
|
266
|
-
const templatePart = `${
|
|
268
|
+
if (v4App.name && v4App.name !== ux_specification_types_2.v4.FE_TEMPLATE_V4_CUSTOM_PAGE) {
|
|
269
|
+
const templatePart = `${ux_specification_types_2.v4.FE_TEMPLATE_V4}.`;
|
|
267
270
|
return v4App.name.split(templatePart)[1];
|
|
268
271
|
}
|
|
269
|
-
else if (v4App?.name ===
|
|
270
|
-
return
|
|
272
|
+
else if (v4App?.name === ux_specification_types_2.v4.FE_TEMPLATE_V4_CUSTOM_PAGE) {
|
|
273
|
+
return ux_specification_types_2.PageTypeV4.FPMCustomPage;
|
|
271
274
|
}
|
|
272
275
|
else if (v4App.viewId ||
|
|
273
276
|
v4App.viewName) {
|
|
274
|
-
return
|
|
277
|
+
return ux_specification_types_2.PageTypeV4.CustomPage;
|
|
275
278
|
}
|
|
276
279
|
}
|
|
277
280
|
exports.getPageTypeV4 = getPageTypeV4;
|
|
@@ -342,11 +345,11 @@ function adjustKey(key, navigationParts, keyForRelatedFacetKeys) {
|
|
|
342
345
|
key = pathParts.join('::');
|
|
343
346
|
}
|
|
344
347
|
else {
|
|
345
|
-
key = uiClass.replace('@UI', `${!keyForRelatedFacetKeys ? '@' : ''}${
|
|
348
|
+
key = uiClass.replace('@UI', `${!keyForRelatedFacetKeys ? '@' : ''}${ux_specification_types_2.UIVOCABULARY}`);
|
|
346
349
|
}
|
|
347
350
|
return key;
|
|
348
351
|
}
|
|
349
|
-
function getKeyAndEntityTypeOfReferenceFacet(oDataServiceAVT, key, entityType, propertyValue, oDataVersion =
|
|
352
|
+
function getKeyAndEntityTypeOfReferenceFacet(oDataServiceAVT, key, entityType, propertyValue, oDataVersion = ux_specification_types_2.FioriElementsVersion.v2, keyForRelatedFacetKeys = false) {
|
|
350
353
|
let stopProcessing = false;
|
|
351
354
|
let namespace;
|
|
352
355
|
const navigationParts = propertyValue.split('/');
|
|
@@ -357,7 +360,7 @@ function getKeyAndEntityTypeOfReferenceFacet(oDataServiceAVT, key, entityType, p
|
|
|
357
360
|
key = adjustKey(key, navigationParts, keyForRelatedFacetKeys);
|
|
358
361
|
const targetAnnotation = determineTargetAnnotation(navigationParts, entityType, oDataServiceAVT);
|
|
359
362
|
if (targetAnnotation) {
|
|
360
|
-
const separator = oDataVersion ===
|
|
363
|
+
const separator = oDataVersion === ux_specification_types_2.FioriElementsVersion.v2 ? '::' : '#';
|
|
361
364
|
key = getTargetAnnotationName(targetAnnotation, keyForRelatedFacetKeys).replace('#', separator);
|
|
362
365
|
namespace = targetAnnotation.fullyQualifiedName?.split('@')[0];
|
|
363
366
|
}
|
|
@@ -366,7 +369,7 @@ function getKeyAndEntityTypeOfReferenceFacet(oDataServiceAVT, key, entityType, p
|
|
|
366
369
|
return { key, entityType, stopProcessing, namespace };
|
|
367
370
|
}
|
|
368
371
|
if (navigation) {
|
|
369
|
-
const navSeparator = oDataVersion ===
|
|
372
|
+
const navSeparator = oDataVersion === ux_specification_types_2.FioriElementsVersion.v2 ? '::' : '/';
|
|
370
373
|
navigationParts.pop();
|
|
371
374
|
const navigationIDs = [...navigationParts].join(navSeparator);
|
|
372
375
|
key = `${navigationIDs}${navSeparator}${key}`;
|
|
@@ -382,7 +385,7 @@ function getKeyAndEntityTypeOfReferenceFacet(oDataServiceAVT, key, entityType, p
|
|
|
382
385
|
* @param {ExtensionLogger} logger - Logger class for logging messages
|
|
383
386
|
* @returns {FacetSection} - object comprising the relevant facet information
|
|
384
387
|
*/
|
|
385
|
-
function getSectionFacet(facetDefinition, sourceEntityType, oDataServiceAVT, logger, oDataVersion =
|
|
388
|
+
function getSectionFacet(facetDefinition, sourceEntityType, oDataServiceAVT, logger, oDataVersion = ux_specification_types_2.FioriElementsVersion.v2, keyForRelatedFacetKeys = false) {
|
|
386
389
|
//Take facet ID as fallback
|
|
387
390
|
const facetName = facetDefinition.fullyQualifiedName?.substring(facetDefinition.fullyQualifiedName?.lastIndexOf('@'));
|
|
388
391
|
let key = facetDefinition.ID ? facetDefinition.ID.toString() : facetName;
|
|
@@ -539,7 +542,7 @@ function getSchemaKeyOfLineItemRecord(lineItemRecord) {
|
|
|
539
542
|
schemaKey =
|
|
540
543
|
'DataFieldForAnnotation:::sTarget::' +
|
|
541
544
|
target
|
|
542
|
-
.replace('@UI', `@${
|
|
545
|
+
.replace('@UI', `@${ux_specification_types_2.UIVOCABULARY}`)
|
|
543
546
|
.replace('@Communication', '@com.sap.vocabularies.Communication.v1')
|
|
544
547
|
.replace('@Contact', '@com.sap.vocabularies.Contact.v1');
|
|
545
548
|
}
|
|
@@ -639,20 +642,20 @@ function getAnnotationTerm(path, alias, entityType) {
|
|
|
639
642
|
* @param {ConvertedMetadata} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
|
|
640
643
|
*/
|
|
641
644
|
function evaluateTargetAnnotation(section, annotationRecord, facets, entityType, oDataServiceAVT) {
|
|
642
|
-
const alias = findAlias(
|
|
645
|
+
const alias = findAlias(ux_specification_types_2.UIVOCABULARY, oDataServiceAVT);
|
|
643
646
|
let path = section ? section.key : '';
|
|
644
647
|
const targetEntityType = section.entityType;
|
|
645
648
|
const annotationTerm = getAnnotationTerm(path, alias, entityType);
|
|
646
649
|
switch (annotationTerm) {
|
|
647
650
|
case "com.sap.vocabularies.UI.v1.Chart" /* UIAnnotationTerms.Chart */: {
|
|
648
|
-
facets[path] = { base:
|
|
651
|
+
facets[path] = { base: ux_specification_types_2.FacetBase.Chart };
|
|
649
652
|
facets[path].target = annotationRecord?.Target?.$target;
|
|
650
653
|
facets[path].entityType = targetEntityType;
|
|
651
654
|
facets[path].namespace = section.namespace;
|
|
652
655
|
break;
|
|
653
656
|
}
|
|
654
657
|
case "com.sap.vocabularies.UI.v1.Identification" /* UIAnnotationTerms.Identification */: {
|
|
655
|
-
facets[path] = { base:
|
|
658
|
+
facets[path] = { base: ux_specification_types_2.FacetBase.Identification };
|
|
656
659
|
facets[path].target = annotationRecord?.Target?.$target;
|
|
657
660
|
facets[path].entityType = targetEntityType;
|
|
658
661
|
facets[path].namespace = section.namespace;
|
|
@@ -664,21 +667,21 @@ function evaluateTargetAnnotation(section, annotationRecord, facets, entityType,
|
|
|
664
667
|
pathParts[pathParts.length - 1] = `@${"com.sap.vocabularies.UI.v1.LineItem" /* UIAnnotationTerms.LineItem */}`;
|
|
665
668
|
path = pathParts.join('::');
|
|
666
669
|
}
|
|
667
|
-
facets[path] = { base:
|
|
670
|
+
facets[path] = { base: ux_specification_types_2.FacetBase.LineItem };
|
|
668
671
|
facets[path].target = annotationRecord?.Target?.$target;
|
|
669
672
|
facets[path].entityType = targetEntityType;
|
|
670
673
|
facets[path].namespace = section.namespace;
|
|
671
674
|
break;
|
|
672
675
|
}
|
|
673
676
|
case "com.sap.vocabularies.UI.v1.FieldGroup" /* UIAnnotationTerms.FieldGroup */: {
|
|
674
|
-
facets[path] = { base:
|
|
677
|
+
facets[path] = { base: ux_specification_types_2.FacetBase.Form };
|
|
675
678
|
facets[path].target = annotationRecord?.Target?.$target;
|
|
676
679
|
facets[path].entityType = targetEntityType;
|
|
677
680
|
facets[path].namespace = section.namespace;
|
|
678
681
|
break;
|
|
679
682
|
}
|
|
680
683
|
case "com.sap.vocabularies.UI.v1.DataPoint" /* UIAnnotationTerms.DataPoint */: {
|
|
681
|
-
facets[path] = { base:
|
|
684
|
+
facets[path] = { base: ux_specification_types_2.FacetBase.DataPoint };
|
|
682
685
|
facets[path].Label = annotationRecord?.Target?.$target['Title'];
|
|
683
686
|
facets[path].target = annotationRecord?.Target?.$target;
|
|
684
687
|
facets[path].entityType = targetEntityType;
|
|
@@ -686,39 +689,39 @@ function evaluateTargetAnnotation(section, annotationRecord, facets, entityType,
|
|
|
686
689
|
break;
|
|
687
690
|
}
|
|
688
691
|
case "com.sap.vocabularies.UI.v1.PresentationVariant" /* UIAnnotationTerms.PresentationVariant */: {
|
|
689
|
-
facets[path] = { base:
|
|
692
|
+
facets[path] = { base: ux_specification_types_2.FacetBase.PresentationVariant };
|
|
690
693
|
facets[path].target = annotationRecord?.Target?.$target;
|
|
691
694
|
facets[path].entityType = targetEntityType;
|
|
692
695
|
facets[path].namespace = section.namespace;
|
|
693
696
|
break;
|
|
694
697
|
}
|
|
695
698
|
case "com.sap.vocabularies.UI.v1.SelectionPresentationVariant" /* UIAnnotationTerms.SelectionPresentationVariant */: {
|
|
696
|
-
facets[path] = { base:
|
|
699
|
+
facets[path] = { base: ux_specification_types_2.FacetBase.SelectionPresentationVariant };
|
|
697
700
|
facets[path].target = annotationRecord?.Target?.$target;
|
|
698
701
|
facets[path].entityType = targetEntityType;
|
|
699
702
|
facets[path].namespace = section.namespace;
|
|
700
703
|
break;
|
|
701
704
|
}
|
|
702
705
|
case "com.sap.vocabularies.Communication.v1.Contact" /* CommunicationAnnotationTerms.Contact */: {
|
|
703
|
-
facets[path] = { base:
|
|
706
|
+
facets[path] = { base: ux_specification_types_2.FacetBase.Contact };
|
|
704
707
|
facets[path].target = annotationRecord?.Target?.$target;
|
|
705
708
|
facets[path].entityType = targetEntityType;
|
|
706
709
|
facets[path].namespace = section.namespace;
|
|
707
710
|
break;
|
|
708
711
|
}
|
|
709
712
|
case "com.sap.vocabularies.Communication.v1.Address" /* CommunicationAnnotationTerms.Address */: {
|
|
710
|
-
facets[path] = { base:
|
|
713
|
+
facets[path] = { base: ux_specification_types_2.FacetBase.Address };
|
|
711
714
|
facets[path].target = annotationRecord?.Target?.$target;
|
|
712
715
|
facets[path].entityType = targetEntityType;
|
|
713
716
|
facets[path].namespace = section.namespace;
|
|
714
717
|
break;
|
|
715
718
|
}
|
|
716
719
|
default: {
|
|
717
|
-
facets[path] = { base:
|
|
720
|
+
facets[path] = { base: ux_specification_types_2.FacetBase.Unknown };
|
|
718
721
|
}
|
|
719
722
|
}
|
|
720
723
|
if (facets[path]) {
|
|
721
|
-
facets[path].annotationPath = `/${annotationRecord.fullyQualifiedName.replace('@com.sap.vocabularies',
|
|
724
|
+
facets[path].annotationPath = `/${annotationRecord.fullyQualifiedName.replace('@com.sap.vocabularies', ux_specification_types_2.VOCWITHSLASH)}`;
|
|
722
725
|
if (annotationRecord.Label) {
|
|
723
726
|
facets[path].Label = annotationRecord.Label;
|
|
724
727
|
}
|
|
@@ -751,7 +754,7 @@ exports.getAnnotationPathUsingFullyQualifiedName = getAnnotationPathUsingFullyQu
|
|
|
751
754
|
* @param {FioriElementsVersion} oDataVersion - OData version
|
|
752
755
|
* @param {ExtensionLogger} logger - Logger class for logging messages
|
|
753
756
|
*/
|
|
754
|
-
function addFacetToConfig(annotationRecord, oDataServiceAVT, serviceName, entityType, facets, oDataVersion =
|
|
757
|
+
function addFacetToConfig(annotationRecord, oDataServiceAVT, serviceName, entityType, facets, oDataVersion = ux_specification_types_2.FioriElementsVersion.v2, logger) {
|
|
755
758
|
const section = getSectionFacet(annotationRecord, entityType, oDataServiceAVT, logger, oDataVersion, false);
|
|
756
759
|
if (section) {
|
|
757
760
|
switch (annotationRecord.$Type) {
|
|
@@ -762,14 +765,14 @@ function addFacetToConfig(annotationRecord, oDataServiceAVT, serviceName, entity
|
|
|
762
765
|
case "com.sap.vocabularies.UI.v1.CollectionFacet" /* UIAnnotationTypes.CollectionFacet */: {
|
|
763
766
|
const annotationPath = getAnnotationPathUsingFullyQualifiedName(entityType, annotationRecord.fullyQualifiedName);
|
|
764
767
|
const facet = (facets[section.key] = {
|
|
765
|
-
base:
|
|
768
|
+
base: ux_specification_types_2.FacetBase.CollectionFacet,
|
|
766
769
|
facets: {},
|
|
767
770
|
ID: section.ID,
|
|
768
771
|
annotationPath: annotationPath,
|
|
769
772
|
Label: section.label,
|
|
770
773
|
namespace: section.namespace
|
|
771
774
|
});
|
|
772
|
-
if (!facet.ID && oDataVersion ===
|
|
775
|
+
if (!facet.ID && oDataVersion === ux_specification_types_2.FioriElementsVersion.v4) {
|
|
773
776
|
(0, extensionLogger_1.log)(logger, {
|
|
774
777
|
severity: "error" /* LogSeverity.Error */,
|
|
775
778
|
message: i18next_1.default.t('NOID4SECTION', { facet: annotationRecord.fullyQualifiedName })
|
|
@@ -790,12 +793,12 @@ function addFacetToConfig(annotationRecord, oDataServiceAVT, serviceName, entity
|
|
|
790
793
|
* @param {FioriElementsVersion} oDataVersion - OData version
|
|
791
794
|
* @param {ExtensionLogger} logger - Logger class for logging messages
|
|
792
795
|
*/
|
|
793
|
-
function getObjectPageHeaderFacets(entityType, oDataServiceAVT, oDataVersion =
|
|
796
|
+
function getObjectPageHeaderFacets(entityType, oDataServiceAVT, oDataVersion = ux_specification_types_2.FioriElementsVersion.v2, logger) {
|
|
794
797
|
const facets = {};
|
|
795
798
|
if (!entityType || !entityType.annotations) {
|
|
796
799
|
return;
|
|
797
800
|
}
|
|
798
|
-
const alias = findAlias(
|
|
801
|
+
const alias = findAlias(ux_specification_types_2.UIVOCABULARY, oDataServiceAVT);
|
|
799
802
|
const facetAnnotation = alias && entityType?.annotations?.[alias]?.HeaderFacets;
|
|
800
803
|
if (facetAnnotation) {
|
|
801
804
|
const lastDot = entityType && entityType.fullyQualifiedName.lastIndexOf('.');
|
|
@@ -815,12 +818,12 @@ exports.getObjectPageHeaderFacets = getObjectPageHeaderFacets;
|
|
|
815
818
|
* @param {FioriElementsVersion} oDataVersion - OData version
|
|
816
819
|
* @param {ExtensionLogger} logger - Logger class for logging messages
|
|
817
820
|
*/
|
|
818
|
-
function getObjectPageFacets(entityType, oDataServiceAVT, oDataVersion =
|
|
821
|
+
function getObjectPageFacets(entityType, oDataServiceAVT, oDataVersion = ux_specification_types_2.FioriElementsVersion.v2, logger) {
|
|
819
822
|
const facets = {};
|
|
820
823
|
if (!entityType || !entityType.annotations) {
|
|
821
824
|
return;
|
|
822
825
|
}
|
|
823
|
-
const alias = findAlias(
|
|
826
|
+
const alias = findAlias(ux_specification_types_2.UIVOCABULARY, oDataServiceAVT);
|
|
824
827
|
const facetAnnotation = alias && entityType?.annotations[alias]?.Facets;
|
|
825
828
|
if (facetAnnotation) {
|
|
826
829
|
const lastDot = entityType && entityType.fullyQualifiedName.lastIndexOf('.');
|
|
@@ -836,24 +839,58 @@ exports.getObjectPageFacets = getObjectPageFacets;
|
|
|
836
839
|
/**
|
|
837
840
|
* Returns the version of Fiori elements (v2/v4) from a given manifest
|
|
838
841
|
* @param manifest - the manifest.json file
|
|
842
|
+
* @returns FioriElementsVersion
|
|
839
843
|
*/
|
|
840
|
-
function
|
|
841
|
-
if ((manifest[
|
|
842
|
-
(manifest[
|
|
843
|
-
return
|
|
844
|
+
function getFEVersionFromManifest(manifest) {
|
|
845
|
+
if ((manifest[ux_specification_types_2.ManifestSection.generic] && Object.keys(manifest[ux_specification_types_2.ManifestSection.generic]).length > 0) ||
|
|
846
|
+
(manifest[ux_specification_types_2.ManifestSection.ovp] && Object.keys(manifest[ux_specification_types_2.ManifestSection.ovp]).length > 0)) {
|
|
847
|
+
return ux_specification_types_2.FioriElementsVersion.v2;
|
|
844
848
|
}
|
|
845
849
|
else {
|
|
846
|
-
const targets = manifest[
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
+
const targets = manifest[ux_specification_types_2.ManifestSection.ui5]?.routing?.targets;
|
|
851
|
+
const libs = manifest[ux_specification_types_2.ManifestSection.ui5]?.dependencies?.libs;
|
|
852
|
+
if ((targets &&
|
|
853
|
+
Object.keys(targets).find((targetKey) => exports.V4_TEMPLATES.indexOf(targets[targetKey].name) > -1)) ||
|
|
854
|
+
(libs && Object.keys(libs).find((lib) => exports.V4_LIBS.indexOf(lib) > -1))) {
|
|
855
|
+
return ux_specification_types_2.FioriElementsVersion.v4;
|
|
850
856
|
}
|
|
851
857
|
else {
|
|
852
858
|
return undefined;
|
|
853
859
|
}
|
|
854
860
|
}
|
|
855
861
|
}
|
|
856
|
-
exports.
|
|
862
|
+
exports.getFEVersionFromManifest = getFEVersionFromManifest;
|
|
863
|
+
/**
|
|
864
|
+
* Get the main service name from the manifest.
|
|
865
|
+
* LROP: by definition the service name can be read from the UI5 model with "" as name.
|
|
866
|
+
* OVP: the main model needs to be read from the sap.ovp config and then the service can be derived.
|
|
867
|
+
*
|
|
868
|
+
* @param manifest - application manifest
|
|
869
|
+
* @returns - main service name
|
|
870
|
+
*/
|
|
871
|
+
function getMainService(manifest) {
|
|
872
|
+
const model = typeof manifest?.[ux_specification_types_2.ManifestSection.ovp]?.globalFilterModel === 'string'
|
|
873
|
+
? manifest[ux_specification_types_2.ManifestSection.ovp].globalFilterModel
|
|
874
|
+
: '';
|
|
875
|
+
return typeof manifest?.[ux_specification_types_2.ManifestSection.ui5]?.models?.[model]?.dataSource === 'string'
|
|
876
|
+
? manifest[ux_specification_types_2.ManifestSection.ui5].models[model].dataSource
|
|
877
|
+
: undefined;
|
|
878
|
+
}
|
|
879
|
+
exports.getMainService = getMainService;
|
|
880
|
+
/**
|
|
881
|
+
* Returns the oData version of the service (if any) from a given manifest
|
|
882
|
+
* @param manifest - the manifest.json file
|
|
883
|
+
* @returns the OData version
|
|
884
|
+
*/
|
|
885
|
+
function getODataVersionFromManifest(manifest) {
|
|
886
|
+
const mainService = getMainService(manifest);
|
|
887
|
+
if (!mainService) {
|
|
888
|
+
return ux_specification_types_1.OdataVersion.v2;
|
|
889
|
+
}
|
|
890
|
+
const dataSource = manifest[ux_specification_types_2.ManifestSection.app].dataSources?.[mainService];
|
|
891
|
+
return dataSource?.settings?.odataVersion === '4.0' ? ux_specification_types_1.OdataVersion.v4 : ux_specification_types_1.OdataVersion.v2;
|
|
892
|
+
}
|
|
893
|
+
exports.getODataVersionFromManifest = getODataVersionFromManifest;
|
|
857
894
|
/**
|
|
858
895
|
* Determines the template type of a V2 app
|
|
859
896
|
* @param manifest - the manifest.json file
|
|
@@ -862,27 +899,27 @@ exports.getVersionFromManifest = getVersionFromManifest;
|
|
|
862
899
|
*/
|
|
863
900
|
function determineV2Template(manifest, logger) {
|
|
864
901
|
let templateType;
|
|
865
|
-
if (manifest[
|
|
866
|
-
const v2Pages = manifest[
|
|
902
|
+
if (manifest[ux_specification_types_2.ManifestSection.generic]) {
|
|
903
|
+
const v2Pages = manifest[ux_specification_types_2.ManifestSection.generic].pages;
|
|
867
904
|
if (!v2Pages) {
|
|
868
905
|
(0, extensionLogger_1.log)(logger, {
|
|
869
906
|
severity: "error" /* LogSeverity.Error */,
|
|
870
907
|
message: i18next_1.default.t('NOPAGES', { appId: manifest['sap.app']['id'] }),
|
|
871
908
|
location: {
|
|
872
|
-
path:
|
|
873
|
-
range: [
|
|
909
|
+
path: ux_specification_types_2.MANIFESTPATH,
|
|
910
|
+
range: [ux_specification_types_2.ManifestSection.generic]
|
|
874
911
|
}
|
|
875
912
|
});
|
|
876
913
|
return;
|
|
877
914
|
}
|
|
878
915
|
for (const pageKey in v2Pages) {
|
|
879
916
|
const v2Page = v2Pages[pageKey];
|
|
880
|
-
if (getPageTypeV2(v2Page.component?.name) ===
|
|
881
|
-
templateType =
|
|
917
|
+
if (getPageTypeV2(v2Page.component?.name) === ux_specification_types_2.PageTypeV2.AnalyticalListPage) {
|
|
918
|
+
templateType = ux_specification_types_2.TemplateType.AnalyticalListPageV2;
|
|
882
919
|
break;
|
|
883
920
|
}
|
|
884
|
-
else if (getPageTypeV2(v2Page.component?.name) ===
|
|
885
|
-
templateType =
|
|
921
|
+
else if (getPageTypeV2(v2Page.component?.name) === ux_specification_types_2.PageTypeV2.ListReport) {
|
|
922
|
+
templateType = ux_specification_types_2.TemplateType.ListReportObjectPageV2;
|
|
886
923
|
break;
|
|
887
924
|
}
|
|
888
925
|
}
|
|
@@ -891,10 +928,10 @@ function determineV2Template(manifest, logger) {
|
|
|
891
928
|
if (!templateType) {
|
|
892
929
|
(0, extensionLogger_1.log)(logger, {
|
|
893
930
|
severity: "error" /* LogSeverity.Error */,
|
|
894
|
-
message: i18next_1.default.t('NOTEMPLATE', { section:
|
|
931
|
+
message: i18next_1.default.t('NOTEMPLATE', { section: ux_specification_types_2.ManifestSection.generic }),
|
|
895
932
|
location: {
|
|
896
|
-
path:
|
|
897
|
-
range: [
|
|
933
|
+
path: ux_specification_types_2.MANIFESTPATH,
|
|
934
|
+
range: [ux_specification_types_2.ManifestSection.generic]
|
|
898
935
|
}
|
|
899
936
|
});
|
|
900
937
|
}
|
|
@@ -910,24 +947,24 @@ exports.determineV2Template = determineV2Template;
|
|
|
910
947
|
function determineV4PageTemplateType(v4Page) {
|
|
911
948
|
let templateType;
|
|
912
949
|
const pageType = getPageTypeV4(v4Page);
|
|
913
|
-
if (pageType ===
|
|
914
|
-
templateType =
|
|
950
|
+
if (pageType === ux_specification_types_2.PageTypeV4.AnalyticalListPage) {
|
|
951
|
+
templateType = ux_specification_types_2.TemplateType.AnalyticalListPageV4;
|
|
915
952
|
}
|
|
916
|
-
else if (pageType ===
|
|
953
|
+
else if (pageType === ux_specification_types_2.PageTypeV4.ListReport) {
|
|
917
954
|
const viewPath = v4Page.options?.settings?.views?.paths?.[0];
|
|
918
|
-
if (viewPath && (viewPath[
|
|
919
|
-
templateType =
|
|
955
|
+
if (viewPath && (viewPath[ux_specification_types_2.ALPViewType.Primary] || viewPath[ux_specification_types_2.ALPViewType.Secondary])) {
|
|
956
|
+
templateType = ux_specification_types_2.TemplateType.AnalyticalListPageV4;
|
|
920
957
|
}
|
|
921
958
|
else {
|
|
922
|
-
templateType =
|
|
959
|
+
templateType = ux_specification_types_2.TemplateType.ListReportObjectPageV4;
|
|
923
960
|
}
|
|
924
961
|
}
|
|
925
|
-
else if (pageType ===
|
|
926
|
-
templateType =
|
|
962
|
+
else if (pageType === ux_specification_types_2.PageTypeV4.ObjectPage) {
|
|
963
|
+
templateType = ux_specification_types_2.TemplateType.ListReportObjectPageV4;
|
|
927
964
|
//fixed now for FEOP scenario, bit continue to check if LR/ALP exists
|
|
928
965
|
}
|
|
929
|
-
else if ([
|
|
930
|
-
templateType =
|
|
966
|
+
else if ([ux_specification_types_2.PageTypeV4.CustomPage, ux_specification_types_2.PageTypeV4.FPMCustomPage].includes(pageType)) {
|
|
967
|
+
templateType = ux_specification_types_2.TemplateType.FreestylePageV4;
|
|
931
968
|
}
|
|
932
969
|
return templateType;
|
|
933
970
|
}
|
|
@@ -955,29 +992,29 @@ function determineV4TemplateFromPages(v4Pages) {
|
|
|
955
992
|
* @returns {TemplateType} the template type
|
|
956
993
|
*/
|
|
957
994
|
function determineV4Template(manifest, logger) {
|
|
958
|
-
const v4Pages = manifest[
|
|
959
|
-
manifest[
|
|
995
|
+
const v4Pages = manifest[ux_specification_types_2.ManifestSection.ui5].routing &&
|
|
996
|
+
manifest[ux_specification_types_2.ManifestSection.ui5].routing.targets;
|
|
960
997
|
// if there are no pages in routing targets, we use LROPV4 as default template type
|
|
961
998
|
if (!v4Pages || Object.keys(v4Pages).length === 0) {
|
|
962
999
|
(0, extensionLogger_1.log)(logger, {
|
|
963
1000
|
severity: "info" /* LogSeverity.Info */,
|
|
964
1001
|
message: i18next_1.default.t('NOPAGES', { appId: manifest['sap.app']['id'] }),
|
|
965
1002
|
location: {
|
|
966
|
-
path:
|
|
967
|
-
range: [
|
|
1003
|
+
path: ux_specification_types_2.MANIFESTPATH,
|
|
1004
|
+
range: [ux_specification_types_2.ManifestSection.ui5, 'routing']
|
|
968
1005
|
}
|
|
969
1006
|
});
|
|
970
|
-
return
|
|
1007
|
+
return ux_specification_types_2.TemplateType.ListReportObjectPageV4;
|
|
971
1008
|
}
|
|
972
1009
|
// else try to determine template type from routing targets
|
|
973
1010
|
const templateType = determineV4TemplateFromPages(v4Pages);
|
|
974
1011
|
if (!templateType) {
|
|
975
1012
|
(0, extensionLogger_1.log)(logger, {
|
|
976
1013
|
severity: "error" /* LogSeverity.Error */,
|
|
977
|
-
message: i18next_1.default.t('NOTEMPLATE', { section:
|
|
1014
|
+
message: i18next_1.default.t('NOTEMPLATE', { section: ux_specification_types_2.ManifestSection.ui5 }),
|
|
978
1015
|
location: {
|
|
979
|
-
path:
|
|
980
|
-
range: [
|
|
1016
|
+
path: ux_specification_types_2.MANIFESTPATH,
|
|
1017
|
+
range: [ux_specification_types_2.ManifestSection.ui5, 'routing', 'targets']
|
|
981
1018
|
}
|
|
982
1019
|
});
|
|
983
1020
|
}
|
|
@@ -993,13 +1030,13 @@ exports.determineV4Template = determineV4Template;
|
|
|
993
1030
|
*/
|
|
994
1031
|
function getTemplateTypeFromManifest(manifest, fioriElementsVersion, logger) {
|
|
995
1032
|
let templateType;
|
|
996
|
-
if (manifest[
|
|
997
|
-
templateType =
|
|
1033
|
+
if (manifest[ux_specification_types_2.ManifestSection.ovp]) {
|
|
1034
|
+
templateType = ux_specification_types_2.TemplateType.OverviewPageV2;
|
|
998
1035
|
}
|
|
999
|
-
else if (fioriElementsVersion ===
|
|
1036
|
+
else if (fioriElementsVersion === ux_specification_types_2.FioriElementsVersion.v2) {
|
|
1000
1037
|
templateType = determineV2Template(manifest, logger);
|
|
1001
1038
|
}
|
|
1002
|
-
else if (fioriElementsVersion ===
|
|
1039
|
+
else if (fioriElementsVersion === ux_specification_types_2.FioriElementsVersion.v4) {
|
|
1003
1040
|
templateType = determineV4Template(manifest, logger);
|
|
1004
1041
|
}
|
|
1005
1042
|
return templateType;
|
|
@@ -1013,12 +1050,12 @@ exports.getTemplateTypeFromManifest = getTemplateTypeFromManifest;
|
|
|
1013
1050
|
*/
|
|
1014
1051
|
function addSectionTitleAndDescription(facet, section, facetKey) {
|
|
1015
1052
|
if (facet?.ID) {
|
|
1016
|
-
section.title =
|
|
1017
|
-
section[
|
|
1053
|
+
section.title = ux_specification_types_2.FacetTitlePrefix + facet.ID;
|
|
1054
|
+
section[ux_specification_types_2.SchemaTag.keys] = [{ name: ux_specification_types_2.SchemaKeyName.id, value: facet.ID }];
|
|
1018
1055
|
}
|
|
1019
1056
|
else {
|
|
1020
1057
|
section.title = facetKey.replace(/@com.sap/g, 'com.sap');
|
|
1021
|
-
section[
|
|
1058
|
+
section[ux_specification_types_2.SchemaTag.keys] = [{ name: ux_specification_types_2.SchemaKeyName.id, value: facetKey.replace(ux_specification_types_2.UIVOCABULARYALPHADOT, '') }];
|
|
1022
1059
|
}
|
|
1023
1060
|
// Description
|
|
1024
1061
|
if (facet?.Label) {
|
|
@@ -1065,8 +1102,8 @@ function createDefaultSection(appSchema, facet, facetKey) {
|
|
|
1065
1102
|
properties: {},
|
|
1066
1103
|
additionalProperties: false
|
|
1067
1104
|
};
|
|
1068
|
-
section[
|
|
1069
|
-
section[
|
|
1105
|
+
section[ux_specification_types_2.SchemaTag.isViewNode] = true;
|
|
1106
|
+
section[ux_specification_types_2.SchemaTag.annotationPath] = facet.annotationPath;
|
|
1070
1107
|
addTargetTitleAndSectionDescription(facet, section, facetKey);
|
|
1071
1108
|
return section;
|
|
1072
1109
|
}
|
|
@@ -1080,8 +1117,8 @@ exports.createDefaultSection = createDefaultSection;
|
|
|
1080
1117
|
* @param {boolean} [checkUnresolvableFacets=false] - Check and avoid facets and sections without ID and Target.
|
|
1081
1118
|
* @returns {FacetSection[]} - Array of facets or sections
|
|
1082
1119
|
*/
|
|
1083
|
-
function getObjectPageFacetSection(entityType, oDataServiceAVT, logger, oDataVersion =
|
|
1084
|
-
const alias = findAlias(
|
|
1120
|
+
function getObjectPageFacetSection(entityType, oDataServiceAVT, logger, oDataVersion = ux_specification_types_2.FioriElementsVersion.v2, checkUnresolvableFacets = false) {
|
|
1121
|
+
const alias = findAlias(ux_specification_types_2.UIVOCABULARY, oDataServiceAVT);
|
|
1085
1122
|
let sections = [];
|
|
1086
1123
|
if (entityType) {
|
|
1087
1124
|
const facetAnnotation = alias && entityType?.annotations?.[alias]?.Facets;
|
|
@@ -1147,12 +1184,12 @@ exports.deleteEmptyStructure = deleteEmptyStructure;
|
|
|
1147
1184
|
* @return {string} File name of generic schema.
|
|
1148
1185
|
*/
|
|
1149
1186
|
const getGenericSchemaFileName = (schemaType) => {
|
|
1150
|
-
if (schemaType ===
|
|
1151
|
-
return
|
|
1187
|
+
if (schemaType === ux_specification_types_2.SchemaType.FreestylePage) {
|
|
1188
|
+
return ux_specification_types_2.PageTypeV2.CustomPage;
|
|
1152
1189
|
}
|
|
1153
|
-
if (schemaType ===
|
|
1190
|
+
if (schemaType === ux_specification_types_2.SchemaType.FPMCustomPage) {
|
|
1154
1191
|
// FPM custom pages uses generic schema generated for building blocks
|
|
1155
|
-
return
|
|
1192
|
+
return ux_specification_types_2.SchemaType.BuildingBlocks;
|
|
1156
1193
|
}
|
|
1157
1194
|
return `${schemaType}`;
|
|
1158
1195
|
};
|
|
@@ -1169,30 +1206,30 @@ const getSchemaFilePath = (schemaType, pageId, viewId) => {
|
|
|
1169
1206
|
};
|
|
1170
1207
|
switch (schemaType) {
|
|
1171
1208
|
// Application schema
|
|
1172
|
-
case
|
|
1209
|
+
case ux_specification_types_2.SchemaType.Application: {
|
|
1173
1210
|
// File name
|
|
1174
1211
|
schemaFile.filename = `App`;
|
|
1175
1212
|
// Full path
|
|
1176
|
-
schemaFile.path = `./${
|
|
1213
|
+
schemaFile.path = `./${ux_specification_types_2.DirName.Schemas}/${schemaFile.filename}`;
|
|
1177
1214
|
break;
|
|
1178
1215
|
}
|
|
1179
1216
|
// List report and object page
|
|
1180
|
-
case
|
|
1181
|
-
case
|
|
1217
|
+
case ux_specification_types_2.SchemaType.ListReport:
|
|
1218
|
+
case ux_specification_types_2.SchemaType.ObjectPage: {
|
|
1182
1219
|
// File name
|
|
1183
1220
|
schemaFile.filename = pageId ? `${schemaType}_${pageId}` : getGenericSchemaFileName(schemaType);
|
|
1184
1221
|
// Full path
|
|
1185
|
-
schemaFile.path = `../${
|
|
1222
|
+
schemaFile.path = `../${ux_specification_types_2.DirName.Schemas}/${schemaFile.filename}`;
|
|
1186
1223
|
break;
|
|
1187
1224
|
}
|
|
1188
|
-
case
|
|
1189
|
-
case
|
|
1225
|
+
case ux_specification_types_2.PageTypeV4.FPMCustomPage:
|
|
1226
|
+
case ux_specification_types_2.SchemaType.FPMCustomPage: {
|
|
1190
1227
|
// File name
|
|
1191
1228
|
schemaFile.filename = viewId
|
|
1192
|
-
? `${
|
|
1193
|
-
: getGenericSchemaFileName(
|
|
1229
|
+
? `${ux_specification_types_2.SchemaType.FPMCustomPage}_${viewId}`
|
|
1230
|
+
: getGenericSchemaFileName(ux_specification_types_2.SchemaType.FPMCustomPage);
|
|
1194
1231
|
// Full path
|
|
1195
|
-
schemaFile.path = `../${
|
|
1232
|
+
schemaFile.path = `../${ux_specification_types_2.DirName.Schemas}/${schemaFile.filename}`;
|
|
1196
1233
|
break;
|
|
1197
1234
|
}
|
|
1198
1235
|
// Other page configs
|
|
@@ -1200,7 +1237,7 @@ const getSchemaFilePath = (schemaType, pageId, viewId) => {
|
|
|
1200
1237
|
// File name
|
|
1201
1238
|
schemaFile.filename = getGenericSchemaFileName(schemaType);
|
|
1202
1239
|
// Full path
|
|
1203
|
-
schemaFile.path = `../${
|
|
1240
|
+
schemaFile.path = `../${ux_specification_types_2.DirName.Schemas}/${schemaFile.filename}`;
|
|
1204
1241
|
break;
|
|
1205
1242
|
}
|
|
1206
1243
|
}
|
|
@@ -1218,7 +1255,7 @@ exports.getSchemaFilePath = getSchemaFilePath;
|
|
|
1218
1255
|
* @returns {string} Generated page id
|
|
1219
1256
|
*/
|
|
1220
1257
|
function generatePageId(pageType, entitySet, viewId, pageName) {
|
|
1221
|
-
if (pageType ===
|
|
1258
|
+
if (pageType === ux_specification_types_2.PageTypeV2.CustomPage) {
|
|
1222
1259
|
const names = viewId && viewId.split('.');
|
|
1223
1260
|
return names && names[names.length - 1] + 'Page';
|
|
1224
1261
|
}
|
|
@@ -1526,7 +1563,7 @@ exports.getJSONPropertyByPath = getJSONPropertyByPath;
|
|
|
1526
1563
|
* @returns {string} modified string without namespace
|
|
1527
1564
|
*/
|
|
1528
1565
|
function removeNamespaces(sId) {
|
|
1529
|
-
sId = sId.replace(
|
|
1566
|
+
sId = sId.replace(ux_specification_types_2.UIVOCABULARYDOT, '');
|
|
1530
1567
|
sId = sId.replace('com.sap.vocabularies.Communication.v1.', '');
|
|
1531
1568
|
return sId;
|
|
1532
1569
|
}
|
|
@@ -1537,7 +1574,7 @@ exports.removeNamespaces = removeNamespaces;
|
|
|
1537
1574
|
* @returns {string} modified string with replaced namespaces
|
|
1538
1575
|
*/
|
|
1539
1576
|
function replaceNamespaces(sId) {
|
|
1540
|
-
sId = sId.replace(
|
|
1577
|
+
sId = sId.replace(ux_specification_types_2.UIVOCABULARY, 'UI');
|
|
1541
1578
|
sId = sId.replace('com.sap.vocabularies.Communication.v1', 'Communication');
|
|
1542
1579
|
return sId;
|
|
1543
1580
|
}
|