@sap-ux/fe-fpm-writer 0.27.4 → 0.27.6
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/dist/building-block/index.js +5 -7
- package/dist/building-block/prompts/questions/filter-bar.js +10 -1
- package/dist/building-block/prompts/utils/questions.js +2 -8
- package/dist/building-block/prompts/utils/service.d.ts +4 -4
- package/dist/building-block/prompts/utils/service.js +8 -13
- package/dist/prompts/translations/i18n.en.json +2 -1
- package/package.json +2 -2
|
@@ -141,11 +141,9 @@ function getMetaPath(type, metaPath, usePlaceholders) {
|
|
|
141
141
|
if (!metaPath) {
|
|
142
142
|
return getDefaultMetaPath(type, usePlaceholders);
|
|
143
143
|
}
|
|
144
|
-
const {
|
|
145
|
-
let { qualifier } = metaPath;
|
|
146
|
-
|
|
147
|
-
const lastIndex = entityPath.lastIndexOf('.');
|
|
148
|
-
entityPath = lastIndex >= 0 ? entityPath.substring?.(lastIndex + 1) : entityPath;
|
|
144
|
+
const { bindingContextType = 'absolute' } = metaPath;
|
|
145
|
+
let { entitySet, qualifier } = metaPath;
|
|
146
|
+
entitySet = entitySet || (usePlaceholders ? PLACEHOLDERS.entitySet : '');
|
|
149
147
|
const qualifierOrPlaceholder = qualifier || (usePlaceholders ? PLACEHOLDERS.qualifier : '');
|
|
150
148
|
if (type === types_1.BuildingBlockType.Chart) {
|
|
151
149
|
// Special handling for chart - while runtime does not support approach without contextPath
|
|
@@ -153,11 +151,11 @@ function getMetaPath(type, metaPath, usePlaceholders) {
|
|
|
153
151
|
qualifier = qualifierParts.pop();
|
|
154
152
|
return {
|
|
155
153
|
metaPath: qualifier,
|
|
156
|
-
contextPath: qualifierParts.length ? `/${
|
|
154
|
+
contextPath: qualifierParts.length ? `/${entitySet}/${qualifierParts.join('/')}` : `/${entitySet}`
|
|
157
155
|
};
|
|
158
156
|
}
|
|
159
157
|
return {
|
|
160
|
-
metaPath: bindingContextType === 'absolute' ? `/${
|
|
158
|
+
metaPath: bindingContextType === 'absolute' ? `/${entitySet}/${qualifierOrPlaceholder}` : qualifierOrPlaceholder
|
|
161
159
|
};
|
|
162
160
|
}
|
|
163
161
|
/**
|
|
@@ -5,7 +5,8 @@ const i18n_1 = require("../../../i18n");
|
|
|
5
5
|
const utils_1 = require("../utils");
|
|
6
6
|
const types_1 = require("../../types");
|
|
7
7
|
const defaultAnswers = {
|
|
8
|
-
id: 'FilterBar'
|
|
8
|
+
id: 'FilterBar',
|
|
9
|
+
bindingContextType: 'absolute'
|
|
9
10
|
};
|
|
10
11
|
/**
|
|
11
12
|
* Returns a list of prompts required to generate a filterbar building block.
|
|
@@ -32,6 +33,14 @@ async function getFilterBarBuildingBlockPrompts(context) {
|
|
|
32
33
|
mandatory: true
|
|
33
34
|
}
|
|
34
35
|
}),
|
|
36
|
+
(0, utils_1.getBindingContextTypePrompt)({
|
|
37
|
+
message: t('bindingContextType'),
|
|
38
|
+
default: defaultAnswers.bindingContextType,
|
|
39
|
+
guiOptions: {
|
|
40
|
+
mandatory: true,
|
|
41
|
+
dependantPromptNames: ['buildingBlockData.metaPath.qualifier']
|
|
42
|
+
}
|
|
43
|
+
}),
|
|
35
44
|
...(project && (0, utils_1.isCapProject)(project)
|
|
36
45
|
? [
|
|
37
46
|
await (0, utils_1.getCAPServicePrompt)(context, {
|
|
@@ -149,14 +149,8 @@ function getEntityPrompt(context, properties = {}) {
|
|
|
149
149
|
name: 'buildingBlockData.metaPath.entitySet',
|
|
150
150
|
choices: project
|
|
151
151
|
? async () => {
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
for (const entityType of entityTypes) {
|
|
155
|
-
const value = entityType.fullyQualifiedName;
|
|
156
|
-
const qualifierParts = value.split('.');
|
|
157
|
-
entityTypeMap[qualifierParts[qualifierParts.length - 1]] = value;
|
|
158
|
-
}
|
|
159
|
-
return transformChoices(entityTypeMap);
|
|
152
|
+
const entitySets = (await (0, service_1.getEntitySets)(project, appId)).map((entitySet) => entitySet.name);
|
|
153
|
+
return transformChoices(entitySets);
|
|
160
154
|
}
|
|
161
155
|
: [],
|
|
162
156
|
guiOptions: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ConvertedMetadata,
|
|
1
|
+
import type { ConvertedMetadata, EntitySet } from '@sap-ux/vocabularies-types';
|
|
2
2
|
import type { EntityTypeAnnotations } from '@sap-ux/vocabularies-types/vocabularies/Edm_Types';
|
|
3
3
|
import type { UIAnnotationTerms } from '@sap-ux/vocabularies-types/vocabularies/UI';
|
|
4
4
|
import { FioriAnnotationService } from '@sap-ux/fiori-annotation-api';
|
|
@@ -38,13 +38,13 @@ export declare function getAnnotationService(project: Project, serviceName: stri
|
|
|
38
38
|
*/
|
|
39
39
|
export declare function getMergedMetadata(annotationService: FioriAnnotationService): ConvertedMetadata;
|
|
40
40
|
/**
|
|
41
|
-
* Method gets available entity
|
|
41
|
+
* Method gets available entity sets in project.
|
|
42
42
|
*
|
|
43
43
|
* @param project = project
|
|
44
44
|
* @param appId = app id
|
|
45
|
-
* @returns an array of entity
|
|
45
|
+
* @returns an array of entity sets
|
|
46
46
|
*/
|
|
47
|
-
export declare function
|
|
47
|
+
export declare function getEntitySets(project: Project, appId: string): Promise<EntitySet[]>;
|
|
48
48
|
/**
|
|
49
49
|
* Method to get the annotation term alias.
|
|
50
50
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getAnnotationPathQualifiers = exports.getAnnotationTermAlias = exports.
|
|
3
|
+
exports.getAnnotationPathQualifiers = exports.getAnnotationTermAlias = exports.getEntitySets = exports.getMergedMetadata = exports.getAnnotationService = exports.getMappedServiceName = void 0;
|
|
4
4
|
const annotation_converter_1 = require("@sap-ux/annotation-converter");
|
|
5
5
|
const fiori_annotation_api_1 = require("@sap-ux/fiori-annotation-api");
|
|
6
6
|
const project_access_1 = require("@sap-ux/project-access");
|
|
@@ -88,17 +88,17 @@ function getMainService(project, appId) {
|
|
|
88
88
|
return mainService ?? 'mainService';
|
|
89
89
|
}
|
|
90
90
|
/**
|
|
91
|
-
* Method gets available entity
|
|
91
|
+
* Method gets available entity sets in project.
|
|
92
92
|
*
|
|
93
93
|
* @param project = project
|
|
94
94
|
* @param appId = app id
|
|
95
|
-
* @returns an array of entity
|
|
95
|
+
* @returns an array of entity sets
|
|
96
96
|
*/
|
|
97
|
-
async function
|
|
97
|
+
async function getEntitySets(project, appId) {
|
|
98
98
|
const metadata = await getServiceMetadata(project, getMainService(project, appId), appId);
|
|
99
|
-
return Array.from(metadata.
|
|
99
|
+
return Array.from(metadata.entitySets);
|
|
100
100
|
}
|
|
101
|
-
exports.
|
|
101
|
+
exports.getEntitySets = getEntitySets;
|
|
102
102
|
/**
|
|
103
103
|
* Method to get the annotation term alias.
|
|
104
104
|
*
|
|
@@ -126,13 +126,8 @@ async function getAnnotationPathQualifiers(project, appId, entity, annotationTer
|
|
|
126
126
|
try {
|
|
127
127
|
const annotationService = await getAnnotationService(project, getMainService(project, appId), appId);
|
|
128
128
|
const mergedMetadata = getMergedMetadata(annotationService);
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
const entitySet = mergedMetadata.entitySets.by_name(entity);
|
|
132
|
-
if (entitySet) {
|
|
133
|
-
entityType = entitySet.entityType;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
129
|
+
const entitySet = mergedMetadata.entitySets.by_name(entity);
|
|
130
|
+
const entityType = entitySet?.entityType;
|
|
136
131
|
if (entityType) {
|
|
137
132
|
getAnnotationPathQualifiersForEntityType(entityType, annotationTerm, result, useNamespace, bindingContext);
|
|
138
133
|
}
|
|
@@ -103,7 +103,8 @@
|
|
|
103
103
|
"qualifier": "Selection Fields Qualifier",
|
|
104
104
|
"qualifierPlaceholder": "Select selection fields qualifier",
|
|
105
105
|
"aggregation": "Aggregation Path",
|
|
106
|
-
"valuesDependentOnEntityTypeInfo": "Values are dependent on entity type"
|
|
106
|
+
"valuesDependentOnEntityTypeInfo": "Values are dependent on entity type",
|
|
107
|
+
"bindingContextType": "Binding Context Path Type"
|
|
107
108
|
},
|
|
108
109
|
"table": {
|
|
109
110
|
"tableBuildingBlockPropertiesTitle": "Table Building Block Properties",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/fe-fpm-writer",
|
|
3
3
|
"description": "SAP Fiori elements flexible programming model writer",
|
|
4
|
-
"version": "0.27.
|
|
4
|
+
"version": "0.27.6",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@types/mem-fs-editor": "7.0.1",
|
|
43
43
|
"@types/semver": "7.5.2",
|
|
44
44
|
"@types/vinyl": "2.0.7",
|
|
45
|
-
"@sap-ux/ui-prompting": "0.1.
|
|
45
|
+
"@sap-ux/ui-prompting": "0.1.4"
|
|
46
46
|
},
|
|
47
47
|
"engines": {
|
|
48
48
|
"node": ">=18.x"
|