@sap/ux-specification 1.84.52 → 1.84.53
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/documentation/v2/v2-AnalyticalListPage.html +1 -1
- package/dist/documentation/v2/v2-ApplicationV2.html +1 -1
- package/dist/documentation/v2/v2-ListReport.html +1 -1
- package/dist/documentation/v2/v2-ObjectPage.html +1 -1
- package/dist/documentation/v2/v2-OverviewPage.html +1 -1
- package/dist/documentation/v4/v4-ApplicationV4.html +1 -1
- package/dist/documentation/v4/v4-ListReport.html +1 -1
- package/dist/documentation/v4/v4-ObjectPage.html +1 -1
- package/dist/index-min.js +26 -26
- package/dist/index-min.js.map +2 -2
- package/dist/src/sync/common/generate/objectPage.d.ts +6 -4
- package/dist/src/sync/common/generate/objectPage.d.ts.map +1 -1
- package/dist/src/sync/common/generate/objectPage.js +258 -74
- package/dist/src/sync/common/generate/objectPage.js.map +1 -1
- package/dist/src/sync/common/generate/utils.d.ts +1 -1
- package/dist/src/sync/common/generate/utils.d.ts.map +1 -1
- package/dist/src/sync/common/generate/utils.js +13 -5
- package/dist/src/sync/common/generate/utils.js.map +1 -1
- package/dist/src/sync/common/utils.d.ts.map +1 -1
- package/dist/src/sync/common/utils.js +29 -12
- package/dist/src/sync/common/utils.js.map +1 -1
- package/dist/src/sync/v2/generate/objectPage.d.ts.map +1 -1
- package/dist/src/sync/v2/generate/objectPage.js +15 -8
- package/dist/src/sync/v2/generate/objectPage.js.map +1 -1
- package/dist/src/sync/v2/generate/utils.d.ts +1 -1
- package/dist/src/sync/v2/generate/utils.d.ts.map +1 -1
- package/dist/src/sync/v2/generate/utils.js +22 -19
- package/dist/src/sync/v2/generate/utils.js.map +1 -1
- package/dist/src/sync/v4/export/controls/Table.js +1 -1
- package/dist/src/sync/v4/export/controls/Table.js.map +1 -1
- package/dist/src/sync/v4/generate/listReport.d.ts.map +1 -1
- package/dist/src/sync/v4/generate/listReport.js +25 -9
- package/dist/src/sync/v4/generate/listReport.js.map +1 -1
- package/dist/src/sync/v4/generate/objectPage.d.ts.map +1 -1
- package/dist/src/sync/v4/generate/objectPage.js +31 -11
- package/dist/src/sync/v4/generate/objectPage.js.map +1 -1
- package/dist/src/sync/v4/utils/utils.d.ts.map +1 -1
- package/dist/src/sync/v4/utils/utils.js +1 -1
- package/dist/src/sync/v4/utils/utils.js.map +1 -1
- package/package.json +2 -2
|
@@ -5,12 +5,14 @@ import type { Definition } from 'typescript-json-schema';
|
|
|
5
5
|
/**
|
|
6
6
|
* Adds definitions for forms in object page sections to the app schema
|
|
7
7
|
* @param {SectionType} sectionType - prefix to distinguish Section and HeaderSection
|
|
8
|
-
* @param {FacetConfig} section -
|
|
8
|
+
* @param {FacetConfig} section - section definition, as prepared from the annotations
|
|
9
9
|
* @param {object} appSchemaSection - current definition of facet or section in the JSON schema
|
|
10
10
|
* @param {object} appSchema - app specific schema that gets enhanced
|
|
11
11
|
* @param {FioriElementsVersion} version - Fiori Elements version
|
|
12
|
+
* @param {string} facetKey - facet key
|
|
13
|
+
* @returns {string | undefined} target id of form
|
|
12
14
|
*/
|
|
13
|
-
export declare function handleForm(sectionType: SectionType, section: FacetConfig, appSchemaSection: Definition, appSchema: Definition, version: FioriElementsVersion,
|
|
15
|
+
export declare function handleForm(sectionType: SectionType, section: FacetConfig, appSchemaSection: Definition, appSchema: Definition, version: FioriElementsVersion, facetKey: string): string | undefined;
|
|
14
16
|
/**
|
|
15
17
|
* Replaces an alias in an annotation ID or reference, based on the AVT references' list
|
|
16
18
|
* @param annotationIdentifier - annotation ID or reference
|
|
@@ -21,12 +23,12 @@ export declare function replaceAlias(annotationIdentifier: string, oDataServiceA
|
|
|
21
23
|
/**
|
|
22
24
|
* Common routine to determine the name and the ID of a header action
|
|
23
25
|
* @param action - action as given by AVT
|
|
24
|
-
* @param entityType - entity type by AVT
|
|
25
26
|
* @returns an object comprising action name and action id
|
|
26
27
|
*/
|
|
27
|
-
export declare function getActionNameAndId(
|
|
28
|
+
export declare function getActionNameAndId(item: any, oDataServiceAVT: ConvertedMetadata): {
|
|
28
29
|
actionName: string;
|
|
29
30
|
actionId: string;
|
|
31
|
+
namespace: string;
|
|
30
32
|
};
|
|
31
33
|
/**
|
|
32
34
|
* Add Object Page Footer Action Buttons to app-specific schema
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objectPage.d.ts","sourceRoot":"","sources":["../../../../../src/sync/common/generate/objectPage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAI3F,OAAO,KAAK,EAAE,WAAW,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"objectPage.d.ts","sourceRoot":"","sources":["../../../../../src/sync/common/generate/objectPage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAI3F,OAAO,KAAK,EAAE,WAAW,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAE5F,OAAO,EAGH,oBAAoB,EAGpB,WAAW,EAEd,MAAM,6BAA6B,CAAC;AASrC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AA2WzD;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CACtB,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,WAAW,EACpB,gBAAgB,EAAE,UAAU,EAC5B,SAAS,EAAE,UAAU,EACrB,OAAO,EAAE,oBAAoB,EAC7B,QAAQ,EAAE,MAAM,GACjB,MAAM,GAAG,SAAS,CAwDpB;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,oBAAoB,EAAE,MAAM,EAAE,eAAe,EAAE,iBAAiB,GAAG,MAAM,CAarG;AAED;;;;GAIG;AAEH,wBAAgB,kBAAkB,CAC9B,IAAI,EAAE,GAAG,EACT,eAAe,EAAE,iBAAiB,GACnC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CA0B7D;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,UAAU,EAAE,kBAAkB,EAAE,2BAA2B,GAAG,IAAI,CA+D7G;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC5B,SAAS,EAAE,UAAU,EACrB,UAAU,EAAE,UAAU,EACtB,eAAe,EAAE,iBAAiB,EAClC,uBAAuB,KAAA,GACxB,IAAI,CAoCN;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI,CAUzF;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,iBAAiB,GAAG,SAAS,GAAG,SAAS,CAMlH"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.determineEntitySetOfFacet = exports.addCommonHeaderSchema = exports.addHeaderActions = exports.addFooterActions = exports.getActionNameAndId = exports.replaceAlias = exports.handleForm = void 0;
|
|
4
4
|
const StableIdHelper_1 = require("../../v4/utils/StableIdHelper");
|
|
5
5
|
const ux_specification_types_1 = require("@sap/ux-specification-types");
|
|
6
|
+
const ux_specification_types_2 = require("@sap/ux-specification-types");
|
|
6
7
|
const __1 = require("..");
|
|
7
8
|
/**
|
|
8
9
|
* Copies the field properties from the generic definition to the specific field definition
|
|
@@ -12,7 +13,7 @@ const __1 = require("..");
|
|
|
12
13
|
* @param {string} fieldDefinition - the unique ID for the given field definition
|
|
13
14
|
*/
|
|
14
15
|
function copyFieldProperties(version, appSchema, field, fieldDefinition) {
|
|
15
|
-
if (version ===
|
|
16
|
+
if (version === ux_specification_types_2.FioriElementsVersion.v4 && appSchema['definitions']['Field']) {
|
|
16
17
|
switch (field.$Type) {
|
|
17
18
|
case "com.sap.vocabularies.UI.v1.DataField" /* DataField */:
|
|
18
19
|
case "com.sap.vocabularies.UI.v1.DataFieldForAnnotation" /* DataFieldForAnnotation */:
|
|
@@ -24,7 +25,7 @@ function copyFieldProperties(version, appSchema, field, fieldDefinition) {
|
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
|
-
else if (version ===
|
|
28
|
+
else if (version === ux_specification_types_2.FioriElementsVersion.v2 && appSchema['definitions']['Field']) {
|
|
28
29
|
switch (field.$Type) {
|
|
29
30
|
case "com.sap.vocabularies.UI.v1.DataField" /* DataField */:
|
|
30
31
|
case "com.sap.vocabularies.UI.v1.DataFieldForAnnotation" /* DataFieldForAnnotation */:
|
|
@@ -45,16 +46,102 @@ function copyFieldProperties(version, appSchema, field, fieldDefinition) {
|
|
|
45
46
|
* @returns the field definition name in schema
|
|
46
47
|
*/
|
|
47
48
|
function determineFieldDefinitionName(version, fieldReferenceId, targetID, fieldReference) {
|
|
48
|
-
const fieldReferenceType = version ===
|
|
49
|
+
const fieldReferenceType = version === ux_specification_types_2.FioriElementsVersion.v2 && fieldReferenceId && fieldReferenceId.includes('::')
|
|
49
50
|
? fieldReferenceId.split('::')[0].replace('DataField', 'Field')
|
|
50
51
|
: undefined;
|
|
51
|
-
if (version ===
|
|
52
|
+
if (version === ux_specification_types_2.FioriElementsVersion.v2) {
|
|
52
53
|
return `${fieldReferenceType}<${targetID}::${fieldReference}>`;
|
|
53
54
|
}
|
|
54
55
|
else {
|
|
55
56
|
return `${targetID}::${fieldReference}`;
|
|
56
57
|
}
|
|
57
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Add th keys and targt tag for Datafield*
|
|
61
|
+
* @param field - the given field definition
|
|
62
|
+
* @param appSchema - the app schema to be updated
|
|
63
|
+
* @param schemaKeyOfField - key for the given field in the app schema
|
|
64
|
+
*/
|
|
65
|
+
function addKeysTagForDataField(field, appSchema, schemaKeyOfField) {
|
|
66
|
+
if (typeof field.Value !== 'string' && field.Value.type === 'Path') {
|
|
67
|
+
appSchema.definitions[schemaKeyOfField][ux_specification_types_2.SchemaTag.keys] = [
|
|
68
|
+
{
|
|
69
|
+
name: 'Value',
|
|
70
|
+
value: field.Value.path
|
|
71
|
+
}
|
|
72
|
+
];
|
|
73
|
+
appSchema.definitions[schemaKeyOfField][ux_specification_types_2.SchemaTag.target] = field.Value.$target
|
|
74
|
+
? field.Value.$target.fullyQualifiedName.split('/')[0]
|
|
75
|
+
: field.Value.targetString.split('/')[0];
|
|
76
|
+
}
|
|
77
|
+
else if (typeof field.Value === 'string' && field.Value) {
|
|
78
|
+
appSchema.definitions[schemaKeyOfField][ux_specification_types_2.SchemaTag.keys] = [
|
|
79
|
+
{
|
|
80
|
+
name: 'Value',
|
|
81
|
+
value: field.Value
|
|
82
|
+
}
|
|
83
|
+
];
|
|
84
|
+
appSchema.definitions[schemaKeyOfField][ux_specification_types_2.SchemaTag.target] = field.fullyQualifiedName.split('@')[0];
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Adds the "keys" tag to a field definition in schema
|
|
89
|
+
* @param field - the given field definition
|
|
90
|
+
* @param appSchema - the app schema to be updated
|
|
91
|
+
* @param schemaKeyOfField - key for the given field in the app schema
|
|
92
|
+
*/
|
|
93
|
+
function addKeysTagToField(field, appSchema, schemaKeyOfField) {
|
|
94
|
+
if (field.$Type === "com.sap.vocabularies.UI.v1.DataField" /* DataField */ ||
|
|
95
|
+
field.$Type === "com.sap.vocabularies.UI.v1.DataFieldWithUrl" /* DataFieldWithUrl */ ||
|
|
96
|
+
field.$Type === "com.sap.vocabularies.UI.v1.DataFieldWithNavigationPath" /* DataFieldWithNavigationPath */) {
|
|
97
|
+
addKeysTagForDataField(field, appSchema, schemaKeyOfField);
|
|
98
|
+
}
|
|
99
|
+
else if (field.$Type === "com.sap.vocabularies.UI.v1.DataFieldForAnnotation" /* DataFieldForAnnotation */) {
|
|
100
|
+
appSchema.definitions[schemaKeyOfField][ux_specification_types_2.SchemaTag.keys] = [
|
|
101
|
+
{
|
|
102
|
+
name: 'Target',
|
|
103
|
+
value: field.Target.value
|
|
104
|
+
}
|
|
105
|
+
];
|
|
106
|
+
appSchema.definitions[schemaKeyOfField][ux_specification_types_2.SchemaTag.target] =
|
|
107
|
+
field.Target.$target.fullyQualifiedName.split('@')[0];
|
|
108
|
+
}
|
|
109
|
+
else if (field.$Type === "com.sap.vocabularies.UI.v1.DataFieldForAction" /* DataFieldForAction */) {
|
|
110
|
+
const separator = field.Action.lastIndexOf('.');
|
|
111
|
+
if (separator === -1) {
|
|
112
|
+
appSchema.definitions[schemaKeyOfField][ux_specification_types_2.SchemaTag.keys] = [
|
|
113
|
+
{
|
|
114
|
+
name: 'Action',
|
|
115
|
+
value: field.Action
|
|
116
|
+
}
|
|
117
|
+
];
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
appSchema.definitions[schemaKeyOfField][ux_specification_types_2.SchemaTag.keys] = [
|
|
121
|
+
{
|
|
122
|
+
name: 'Action',
|
|
123
|
+
value: field.Action.substring(separator + 1, field.Action.length)
|
|
124
|
+
}
|
|
125
|
+
];
|
|
126
|
+
appSchema.definitions[schemaKeyOfField][ux_specification_types_2.SchemaTag.target] = field.Action.substring(0, separator);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
else if (field.$Type === "com.sap.vocabularies.UI.v1.DataFieldForIntentBasedNavigation" /* DataFieldForIntentBasedNavigation */) {
|
|
130
|
+
appSchema.definitions[schemaKeyOfField][ux_specification_types_2.SchemaTag.keys] = [
|
|
131
|
+
{
|
|
132
|
+
name: 'SemanticObject',
|
|
133
|
+
value: field.SemanticObject
|
|
134
|
+
}
|
|
135
|
+
];
|
|
136
|
+
if (field.Action) {
|
|
137
|
+
appSchema.definitions[schemaKeyOfField][ux_specification_types_2.SchemaTag.keys].push({
|
|
138
|
+
name: 'Action',
|
|
139
|
+
value: field.Action
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
appSchema.definitions[schemaKeyOfField][ux_specification_types_2.SchemaTag.target] = field.fullyQualifiedName.split('@')[0];
|
|
143
|
+
}
|
|
144
|
+
}
|
|
58
145
|
/**
|
|
59
146
|
* Adds a field definition to the app specific schema
|
|
60
147
|
* @param {string} sectionType - prefix to distinguish Section and HeaderSection
|
|
@@ -68,49 +155,50 @@ function determineFieldDefinitionName(version, fieldReferenceId, targetID, field
|
|
|
68
155
|
function addField(sectionType, appSchema, field, targetID, key, section, version, withActions = true) {
|
|
69
156
|
// Calculate field reference
|
|
70
157
|
const fieldReferenceId = StableIdHelper_1.getStableIdPartFromDataField(field);
|
|
71
|
-
const fieldReference = version ===
|
|
158
|
+
const fieldReference = version === ux_specification_types_2.FioriElementsVersion.v2 && fieldReferenceId && fieldReferenceId.includes('::')
|
|
72
159
|
? fieldReferenceId.split('::').splice(1).join('::')
|
|
73
160
|
: fieldReferenceId;
|
|
74
161
|
// Determine field definition name
|
|
75
|
-
const
|
|
162
|
+
const schemaKeyOfField = determineFieldDefinitionName(version, fieldReferenceId, targetID, fieldReference);
|
|
76
163
|
// Evaluate field type, set field reference of properties of fields' or actions' definition
|
|
77
164
|
if (!field || !field.$Type) {
|
|
78
165
|
return;
|
|
79
166
|
}
|
|
80
167
|
else if (field.$Type === "com.sap.vocabularies.UI.v1.DataFieldForAction" /* DataFieldForAction */ ||
|
|
81
168
|
field.$Type === "com.sap.vocabularies.UI.v1.DataFieldForIntentBasedNavigation" /* DataFieldForIntentBasedNavigation */) {
|
|
82
|
-
if (withActions && sectionType ===
|
|
83
|
-
const actionsDefinition = __1.prepareRef(`${sectionType}${
|
|
169
|
+
if (withActions && sectionType === ux_specification_types_2.SectionType.Section) {
|
|
170
|
+
const actionsDefinition = __1.prepareRef(`${sectionType}${ux_specification_types_2.DefinitionName.Actions}<${targetID}>`);
|
|
84
171
|
const fieldInSchema = (appSchema.definitions[actionsDefinition].properties[fieldReference] =
|
|
85
172
|
{
|
|
86
|
-
$ref: `${__1.DEFINITION_LINK_PREFIX}${
|
|
173
|
+
$ref: `${__1.DEFINITION_LINK_PREFIX}${schemaKeyOfField}`
|
|
87
174
|
});
|
|
88
|
-
fieldInSchema[
|
|
175
|
+
fieldInSchema[ux_specification_types_2.SchemaTag.propertyIndex] = parseInt(key);
|
|
89
176
|
}
|
|
90
177
|
}
|
|
91
178
|
else {
|
|
92
|
-
const fieldsDefinition = __1.prepareRef(`${sectionType}${
|
|
179
|
+
const fieldsDefinition = __1.prepareRef(`${sectionType}${ux_specification_types_2.DefinitionName.Fields}<${targetID}>`);
|
|
93
180
|
appSchema.definitions[fieldsDefinition]['properties'][fieldReference] = {
|
|
94
|
-
$ref: `${__1.DEFINITION_LINK_PREFIX}${
|
|
181
|
+
$ref: `${__1.DEFINITION_LINK_PREFIX}${schemaKeyOfField}`,
|
|
95
182
|
propertyIndex: parseInt(key)
|
|
96
183
|
};
|
|
97
184
|
}
|
|
98
185
|
// Now set up the field definition
|
|
99
|
-
appSchema.definitions[
|
|
186
|
+
appSchema.definitions[schemaKeyOfField] = {
|
|
100
187
|
type: 'object',
|
|
101
188
|
properties: {},
|
|
102
189
|
description: __1.getDataFieldDescription(field, section.entityType),
|
|
103
190
|
additionalProperties: false
|
|
104
191
|
};
|
|
105
192
|
//Add tags
|
|
106
|
-
appSchema
|
|
107
|
-
appSchema.definitions[
|
|
108
|
-
appSchema.definitions[
|
|
109
|
-
|
|
193
|
+
addKeysTagToField(field, appSchema, schemaKeyOfField);
|
|
194
|
+
appSchema.definitions[schemaKeyOfField][ux_specification_types_2.SchemaTag.annotationPath] = `/${section.entityType.fullyQualifiedName}/${field.fullyQualifiedName.split(section.entityType.fullyQualifiedName)[1]}`;
|
|
195
|
+
appSchema.definitions[schemaKeyOfField][ux_specification_types_2.SchemaTag.annotationType] = field.$Type;
|
|
196
|
+
appSchema.definitions[schemaKeyOfField][ux_specification_types_2.SchemaTag.isViewNode] = true;
|
|
197
|
+
__1.addDataTypeToDefinition(appSchema.definitions[schemaKeyOfField], field);
|
|
110
198
|
// Copy the generic definition of field properties to the specific one
|
|
111
|
-
copyFieldProperties(version, appSchema, field,
|
|
199
|
+
copyFieldProperties(version, appSchema, field, schemaKeyOfField);
|
|
112
200
|
if (field.$Type === "com.sap.vocabularies.UI.v1.DataFieldForAction" /* DataFieldForAction */ && appSchema.definitions?.['FormAction']) {
|
|
113
|
-
appSchema.definitions[
|
|
201
|
+
appSchema.definitions[schemaKeyOfField].properties = appSchema.definitions[ux_specification_types_2.DefinitionName.FormAction].properties;
|
|
114
202
|
}
|
|
115
203
|
}
|
|
116
204
|
/**
|
|
@@ -132,24 +220,23 @@ function determineTargetIdOfForm(section) {
|
|
|
132
220
|
return targetID;
|
|
133
221
|
}
|
|
134
222
|
/**
|
|
135
|
-
* Adds
|
|
223
|
+
* Adds the specific definitions of the form fields to a schema
|
|
224
|
+
* @param {FacetConfig} section - section definition, as prepared from the annotations
|
|
136
225
|
* @param {SectionType} sectionType - prefix to distinguish Section and HeaderSection
|
|
137
|
-
* @param {FacetConfig} section - facet or section in the FE core model
|
|
138
|
-
* @param {object} appSchemaSection - current definition of facet or section in the JSON schema
|
|
139
226
|
* @param {object} appSchema - app specific schema that gets enhanced
|
|
227
|
+
* @param {string } targetID - target id of form
|
|
140
228
|
* @param {FioriElementsVersion} version - Fiori Elements version
|
|
141
229
|
*/
|
|
142
|
-
function
|
|
230
|
+
function addFieldsToFormDefinition(section, sectionType, appSchema, targetID, version, withActions = true) {
|
|
143
231
|
if (!section.target) {
|
|
144
232
|
return;
|
|
145
233
|
}
|
|
146
|
-
const
|
|
147
|
-
const
|
|
148
|
-
const
|
|
149
|
-
const actionsDefinition = __1.prepareRef(`${sectionType}${ux_specification_types_1.DefinitionName.Actions}<${targetID}>`);
|
|
234
|
+
const formDefinition = __1.prepareRef(`${sectionType}${ux_specification_types_2.DefinitionName.Form}<${targetID}>`);
|
|
235
|
+
const fieldsDefinition = __1.prepareRef(`${sectionType}${ux_specification_types_2.DefinitionName.Fields}<${targetID}>`);
|
|
236
|
+
const actionsDefinition = __1.prepareRef(`${sectionType}${ux_specification_types_2.DefinitionName.Actions}<${targetID}>`);
|
|
150
237
|
// Form definition
|
|
151
|
-
|
|
152
|
-
if (sectionType ===
|
|
238
|
+
appSchema.properties['form'] = { $ref: `${__1.DEFINITION_LINK_PREFIX}${formDefinition}` };
|
|
239
|
+
if (sectionType === ux_specification_types_2.SectionType.Section && withActions) {
|
|
153
240
|
appSchema['definitions'][formDefinition] = {
|
|
154
241
|
type: 'object',
|
|
155
242
|
properties: {
|
|
@@ -167,7 +254,7 @@ function handleForm(sectionType, section, appSchemaSection, appSchema, version,
|
|
|
167
254
|
description: 'Actions',
|
|
168
255
|
additionalProperties: false
|
|
169
256
|
};
|
|
170
|
-
appSchema['definitions'][actionsDefinition][
|
|
257
|
+
appSchema['definitions'][actionsDefinition][ux_specification_types_2.SchemaTag.isViewNode] = true;
|
|
171
258
|
}
|
|
172
259
|
else {
|
|
173
260
|
appSchema['definitions'][formDefinition] = {
|
|
@@ -179,9 +266,9 @@ function handleForm(sectionType, section, appSchemaSection, appSchema, version,
|
|
|
179
266
|
additionalProperties: false
|
|
180
267
|
};
|
|
181
268
|
}
|
|
182
|
-
appSchema.definitions[formDefinition][
|
|
269
|
+
appSchema.definitions[formDefinition][ux_specification_types_2.SchemaTag.isViewNode] = true;
|
|
183
270
|
if (section.entityType?.name) {
|
|
184
|
-
appSchema.definitions[formDefinition][
|
|
271
|
+
appSchema.definitions[formDefinition][ux_specification_types_2.SchemaTag.annotationPath] = __1.createAnnotationPath(section.entityType.fullyQualifiedName, section.target['term'], section.target['qualifier']);
|
|
185
272
|
}
|
|
186
273
|
// Fields definition
|
|
187
274
|
appSchema.definitions[fieldsDefinition] = {
|
|
@@ -190,9 +277,9 @@ function handleForm(sectionType, section, appSchemaSection, appSchema, version,
|
|
|
190
277
|
description: 'Fields',
|
|
191
278
|
additionalProperties: false
|
|
192
279
|
};
|
|
193
|
-
appSchema.definitions[fieldsDefinition][
|
|
280
|
+
appSchema.definitions[fieldsDefinition][ux_specification_types_2.SchemaTag.isViewNode] = true;
|
|
194
281
|
// Add fields
|
|
195
|
-
if (section.base ===
|
|
282
|
+
if (section.base === ux_specification_types_2.FacetBase.Identification) {
|
|
196
283
|
for (const key in section.target) {
|
|
197
284
|
const field = section.target[key];
|
|
198
285
|
if (field) {
|
|
@@ -207,6 +294,95 @@ function handleForm(sectionType, section, appSchemaSection, appSchema, version,
|
|
|
207
294
|
}
|
|
208
295
|
}
|
|
209
296
|
}
|
|
297
|
+
/**
|
|
298
|
+
* Adds the schema tags for a form definition
|
|
299
|
+
* @param {FacetConfig} section - section definition, as prepared from the annotations
|
|
300
|
+
* @param {object} appSchema - app specific schema that gets enhanced
|
|
301
|
+
* @param {string} formDefinitionKey - key of the form definition in schema
|
|
302
|
+
*/
|
|
303
|
+
function addTagsToFormDefinition(section, appSchema, formDefinitionKey) {
|
|
304
|
+
if (section.target) {
|
|
305
|
+
const targetValue = section.target['qualifier']
|
|
306
|
+
? `${section.target['term']}#${section.target['qualifier']}`
|
|
307
|
+
: `${section.target['term']}`;
|
|
308
|
+
appSchema.definitions[formDefinitionKey][ux_specification_types_2.SchemaTag.keys] = [
|
|
309
|
+
{
|
|
310
|
+
name: ux_specification_types_1.SchemaKeyName.target,
|
|
311
|
+
value: targetValue.replace(/com.sap.vocabularies.UI.v1./g, '')
|
|
312
|
+
}
|
|
313
|
+
];
|
|
314
|
+
appSchema.definitions[formDefinitionKey][ux_specification_types_2.SchemaTag.target] = section.target['fullyQualifiedName'].split('@')[0];
|
|
315
|
+
}
|
|
316
|
+
appSchema.definitions[formDefinitionKey][ux_specification_types_2.SchemaTag.isViewNode] = true;
|
|
317
|
+
if (section.entityType?.name) {
|
|
318
|
+
appSchema.definitions[formDefinitionKey][ux_specification_types_2.SchemaTag.annotationPath] = __1.createAnnotationPath(section.entityType.fullyQualifiedName, section.target['term'], section.target['qualifier']);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Adds definitions for forms in object page sections to the app schema
|
|
323
|
+
* @param {SectionType} sectionType - prefix to distinguish Section and HeaderSection
|
|
324
|
+
* @param {FacetConfig} section - section definition, as prepared from the annotations
|
|
325
|
+
* @param {object} appSchemaSection - current definition of facet or section in the JSON schema
|
|
326
|
+
* @param {object} appSchema - app specific schema that gets enhanced
|
|
327
|
+
* @param {FioriElementsVersion} version - Fiori Elements version
|
|
328
|
+
* @param {string} facetKey - facet key
|
|
329
|
+
* @returns {string | undefined} target id of form
|
|
330
|
+
*/
|
|
331
|
+
function handleForm(sectionType, section, appSchemaSection, appSchema, version, facetKey) {
|
|
332
|
+
if (!section.target) {
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
const targetID = determineTargetIdOfForm(section);
|
|
336
|
+
const formDefinitionKey = __1.prepareRef(`${sectionType}${ux_specification_types_2.DefinitionName.Form}<${targetID}>`);
|
|
337
|
+
const fieldsDefinitionKey = __1.prepareRef(`${sectionType}${ux_specification_types_2.DefinitionName.Fields}<${targetID}>`);
|
|
338
|
+
const actionsDefinitionKey = __1.prepareRef(`${sectionType}${ux_specification_types_2.DefinitionName.Actions}<${targetID}>`);
|
|
339
|
+
const withActions = section.base === ux_specification_types_2.FacetBase.Identification && facetKey.indexOf('#') < 0 ? false : true;
|
|
340
|
+
// Form definition
|
|
341
|
+
appSchemaSection.properties.form = { $ref: `${__1.DEFINITION_LINK_PREFIX}${formDefinitionKey}` };
|
|
342
|
+
if (sectionType === ux_specification_types_2.SectionType.Section && withActions) {
|
|
343
|
+
appSchema.definitions[formDefinitionKey] = {
|
|
344
|
+
type: 'object',
|
|
345
|
+
properties: {
|
|
346
|
+
actions: {
|
|
347
|
+
$ref: `${__1.DEFINITION_LINK_PREFIX}${actionsDefinitionKey}`
|
|
348
|
+
},
|
|
349
|
+
fields: { $ref: `${__1.DEFINITION_LINK_PREFIX}${fieldsDefinitionKey}` }
|
|
350
|
+
},
|
|
351
|
+
description: 'Form',
|
|
352
|
+
additionalProperties: false
|
|
353
|
+
};
|
|
354
|
+
appSchema.definitions[actionsDefinitionKey] = {
|
|
355
|
+
type: 'object',
|
|
356
|
+
properties: {},
|
|
357
|
+
description: 'Actions',
|
|
358
|
+
additionalProperties: false
|
|
359
|
+
};
|
|
360
|
+
appSchema.definitions[actionsDefinitionKey][ux_specification_types_2.SchemaTag.isViewNode] = true;
|
|
361
|
+
}
|
|
362
|
+
else {
|
|
363
|
+
appSchema.definitions[formDefinitionKey] = {
|
|
364
|
+
type: 'object',
|
|
365
|
+
properties: {
|
|
366
|
+
fields: { $ref: `${__1.DEFINITION_LINK_PREFIX}${fieldsDefinitionKey}` }
|
|
367
|
+
},
|
|
368
|
+
description: 'Form',
|
|
369
|
+
additionalProperties: false
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
//Add schema tags
|
|
373
|
+
addTagsToFormDefinition(section, appSchema, formDefinitionKey);
|
|
374
|
+
// Fields definition
|
|
375
|
+
appSchema.definitions[fieldsDefinitionKey] = {
|
|
376
|
+
type: 'object',
|
|
377
|
+
properties: {},
|
|
378
|
+
description: 'Fields',
|
|
379
|
+
additionalProperties: false
|
|
380
|
+
};
|
|
381
|
+
appSchema.definitions[fieldsDefinitionKey][ux_specification_types_2.SchemaTag.isViewNode] = true;
|
|
382
|
+
// Add fields
|
|
383
|
+
addFieldsToFormDefinition(section, sectionType, appSchema, targetID, version, withActions);
|
|
384
|
+
return targetID;
|
|
385
|
+
}
|
|
210
386
|
exports.handleForm = handleForm;
|
|
211
387
|
/**
|
|
212
388
|
* Replaces an alias in an annotation ID or reference, based on the AVT references' list
|
|
@@ -232,25 +408,33 @@ exports.replaceAlias = replaceAlias;
|
|
|
232
408
|
/**
|
|
233
409
|
* Common routine to determine the name and the ID of a header action
|
|
234
410
|
* @param action - action as given by AVT
|
|
235
|
-
* @param entityType - entity type by AVT
|
|
236
411
|
* @returns an object comprising action name and action id
|
|
237
412
|
*/
|
|
238
|
-
function getActionNameAndId(
|
|
239
|
-
|
|
413
|
+
function getActionNameAndId(item, oDataServiceAVT) {
|
|
414
|
+
const action = replaceAlias(item.Action, oDataServiceAVT);
|
|
415
|
+
let relevantAction = action;
|
|
416
|
+
let separatorIndex = action.indexOf('(');
|
|
417
|
+
if (separatorIndex > 0) {
|
|
418
|
+
relevantAction = action.substring(0, separatorIndex);
|
|
419
|
+
}
|
|
420
|
+
separatorIndex = relevantAction.lastIndexOf('/');
|
|
240
421
|
if (separatorIndex === -1) {
|
|
241
|
-
separatorIndex =
|
|
422
|
+
separatorIndex = relevantAction.lastIndexOf('.');
|
|
242
423
|
}
|
|
243
|
-
let actionName, actionId;
|
|
424
|
+
let actionName, actionId, namespace;
|
|
244
425
|
if (separatorIndex > -1) {
|
|
245
|
-
actionName =
|
|
246
|
-
|
|
426
|
+
actionName = relevantAction.substring(separatorIndex + 1);
|
|
427
|
+
namespace = relevantAction.substring(0, separatorIndex);
|
|
428
|
+
actionId = `${relevantAction.substring(0, separatorIndex)}::${actionName}`;
|
|
247
429
|
}
|
|
248
430
|
else {
|
|
249
|
-
actionName =
|
|
250
|
-
|
|
251
|
-
|
|
431
|
+
actionName = relevantAction;
|
|
432
|
+
namespace = item.fullyQualifiedName.split('@')[0];
|
|
433
|
+
if (actionName && actionName !== '') {
|
|
434
|
+
actionId = `${namespace.substring(0, namespace.length - 1)}::${actionName}`;
|
|
435
|
+
}
|
|
252
436
|
}
|
|
253
|
-
return { actionName, actionId };
|
|
437
|
+
return { actionName, actionId, namespace };
|
|
254
438
|
}
|
|
255
439
|
exports.getActionNameAndId = getActionNameAndId;
|
|
256
440
|
/**
|
|
@@ -261,36 +445,36 @@ exports.getActionNameAndId = getActionNameAndId;
|
|
|
261
445
|
* @param {ConvertedMetadata} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
|
|
262
446
|
*/
|
|
263
447
|
function addFooterActions(appSchema, generateParameters) {
|
|
264
|
-
appSchema.definitions[
|
|
448
|
+
appSchema.definitions[ux_specification_types_2.DefinitionName.ObjectPageFooter] = JSON.parse(JSON.stringify(appSchema.definitions[`${ux_specification_types_2.DefinitionName.ObjectPageFooter}<ObjectPageFooterActions>`]));
|
|
265
449
|
// Change reference of footer
|
|
266
450
|
appSchema.properties['footer'] = {
|
|
267
|
-
$ref: `${__1.DEFINITION_LINK_PREFIX}${
|
|
451
|
+
$ref: `${__1.DEFINITION_LINK_PREFIX}${ux_specification_types_2.DefinitionName.ObjectPageFooter}`
|
|
268
452
|
};
|
|
269
453
|
// Add action to configuration
|
|
270
|
-
appSchema.definitions[
|
|
271
|
-
$ref: `${__1.DEFINITION_LINK_PREFIX}${
|
|
454
|
+
appSchema.definitions[ux_specification_types_2.DefinitionName.ObjectPageFooter].properties[ux_specification_types_2.PropertyName.actions] = {
|
|
455
|
+
$ref: `${__1.DEFINITION_LINK_PREFIX}${ux_specification_types_2.DefinitionName.FooterActions}`
|
|
272
456
|
};
|
|
273
|
-
const footerActions = (appSchema.definitions[
|
|
457
|
+
const footerActions = (appSchema.definitions[ux_specification_types_2.DefinitionName.FooterActions] = {
|
|
274
458
|
type: 'object',
|
|
275
459
|
properties: {},
|
|
276
460
|
description: 'Actions',
|
|
277
461
|
additionalProperties: false
|
|
278
462
|
});
|
|
279
|
-
footerActions[
|
|
280
|
-
const alias = __1.findAlias(
|
|
463
|
+
footerActions[ux_specification_types_2.SchemaTag.isViewNode] = true;
|
|
464
|
+
const alias = __1.findAlias(ux_specification_types_2.UIVOCABULARY, generateParameters.serviceAVT);
|
|
281
465
|
const entityType = generateParameters.entitySet.entityType;
|
|
282
466
|
const actionAnnotation = alias && entityType.annotations?.[alias]?.Identification;
|
|
283
467
|
if (actionAnnotation) {
|
|
284
468
|
const convertedIdentification = actionAnnotation.fullyQualifiedName.replace(`@${"com.sap.vocabularies.UI.v1.Identification" /* Identification */}`, `/@${"com.sap.vocabularies.UI.v1.Identification" /* Identification */}`);
|
|
285
|
-
footerActions[
|
|
469
|
+
footerActions[ux_specification_types_2.SchemaTag.annotationPath] = `/${convertedIdentification}`;
|
|
286
470
|
actionAnnotation.forEach((item, index) => {
|
|
287
471
|
if (item['Determining'] && item.$Type === "com.sap.vocabularies.UI.v1.DataFieldForAction" /* DataFieldForAction */) {
|
|
288
|
-
const { actionName, actionId } = getActionNameAndId(item
|
|
472
|
+
const { actionName, actionId } = getActionNameAndId(item, generateParameters.serviceAVT);
|
|
289
473
|
const description = item.Label || actionName;
|
|
290
|
-
const actionDefinitionKey = __1.prepareRef(`${
|
|
291
|
-
if (appSchema.definitions[
|
|
474
|
+
const actionDefinitionKey = __1.prepareRef(`${ux_specification_types_2.DefinitionName.ObjectPageFooterAction}<${actionId}>`);
|
|
475
|
+
if (appSchema.definitions[ux_specification_types_2.DefinitionName.ObjectPageFooterAction]) {
|
|
292
476
|
appSchema.definitions[actionDefinitionKey] = {
|
|
293
|
-
...JSON.parse(JSON.stringify(appSchema.definitions[
|
|
477
|
+
...JSON.parse(JSON.stringify(appSchema.definitions[ux_specification_types_2.DefinitionName.ObjectPageFooterAction])),
|
|
294
478
|
description,
|
|
295
479
|
annotationPath: `/${convertedIdentification}/${index}`
|
|
296
480
|
};
|
|
@@ -301,8 +485,8 @@ function addFooterActions(appSchema, generateParameters) {
|
|
|
301
485
|
properties: {},
|
|
302
486
|
description: description
|
|
303
487
|
};
|
|
304
|
-
appSchema.definitions[actionDefinitionKey][
|
|
305
|
-
appSchema.definitions[actionDefinitionKey][
|
|
488
|
+
appSchema.definitions[actionDefinitionKey][ux_specification_types_2.SchemaTag.isViewNode] = true;
|
|
489
|
+
appSchema.definitions[actionDefinitionKey][ux_specification_types_2.SchemaTag.annotationPath] = `/${convertedIdentification}/${index}`;
|
|
306
490
|
}
|
|
307
491
|
footerActions.properties[actionId] = {
|
|
308
492
|
$ref: `${__1.DEFINITION_LINK_PREFIX}${actionDefinitionKey}`
|
|
@@ -311,10 +495,10 @@ function addFooterActions(appSchema, generateParameters) {
|
|
|
311
495
|
});
|
|
312
496
|
}
|
|
313
497
|
else {
|
|
314
|
-
footerActions[
|
|
498
|
+
footerActions[ux_specification_types_2.SchemaTag.annotationPath] = `/${entityType.fullyQualifiedName}/@${"com.sap.vocabularies.UI.v1.Identification" /* Identification */}`;
|
|
315
499
|
}
|
|
316
|
-
delete appSchema.definitions[
|
|
317
|
-
delete appSchema.definitions[`${
|
|
500
|
+
delete appSchema.definitions[ux_specification_types_2.DefinitionName.ObjectPageFooterActions];
|
|
501
|
+
delete appSchema.definitions[`${ux_specification_types_2.DefinitionName.ObjectPageFooter}<${ux_specification_types_2.DefinitionName.ObjectPageFooterActions}>`];
|
|
318
502
|
}
|
|
319
503
|
exports.addFooterActions = addFooterActions;
|
|
320
504
|
/**
|
|
@@ -324,32 +508,32 @@ exports.addFooterActions = addFooterActions;
|
|
|
324
508
|
* @param {ConvertedMetadata} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
|
|
325
509
|
*/
|
|
326
510
|
function addHeaderActions(appSchema, entityType, oDataServiceAVT, addHeaderActionCallBack) {
|
|
327
|
-
appSchema.definitions[
|
|
328
|
-
$ref: `${__1.DEFINITION_LINK_PREFIX}${
|
|
511
|
+
appSchema.definitions[ux_specification_types_2.DefinitionName.ObjectPageHeader].properties[ux_specification_types_2.PropertyName.actions] = {
|
|
512
|
+
$ref: `${__1.DEFINITION_LINK_PREFIX}${ux_specification_types_2.DefinitionName.HeaderActions}`
|
|
329
513
|
};
|
|
330
|
-
const headerActions = (appSchema.definitions[
|
|
514
|
+
const headerActions = (appSchema.definitions[ux_specification_types_2.DefinitionName.HeaderActions] = {
|
|
331
515
|
type: 'object',
|
|
332
516
|
properties: {},
|
|
333
517
|
description: 'Actions',
|
|
334
518
|
additionalProperties: false
|
|
335
519
|
});
|
|
336
|
-
headerActions[
|
|
337
|
-
const alias = __1.findAlias(
|
|
520
|
+
headerActions[ux_specification_types_2.SchemaTag.isViewNode] = true;
|
|
521
|
+
const alias = __1.findAlias(ux_specification_types_2.UIVOCABULARY, oDataServiceAVT);
|
|
338
522
|
const identification = alias &&
|
|
339
523
|
entityType.annotations &&
|
|
340
524
|
entityType.annotations[alias] &&
|
|
341
525
|
entityType.annotations[alias].Identification;
|
|
342
526
|
if (identification) {
|
|
343
|
-
headerActions[
|
|
527
|
+
headerActions[ux_specification_types_2.SchemaTag.annotationPath] =
|
|
344
528
|
'/' +
|
|
345
529
|
identification.fullyQualifiedName.replace(`@${"com.sap.vocabularies.UI.v1.Identification" /* Identification */}`, `/@${"com.sap.vocabularies.UI.v1.Identification" /* Identification */}`);
|
|
346
530
|
identification.forEach(addHeaderActionCallBack(entityType, appSchema, identification, headerActions, oDataServiceAVT));
|
|
347
531
|
}
|
|
348
532
|
else {
|
|
349
|
-
headerActions[
|
|
533
|
+
headerActions[ux_specification_types_2.SchemaTag.annotationPath] = `/${entityType.fullyQualifiedName}/@${"com.sap.vocabularies.UI.v1.Identification" /* Identification */}`;
|
|
350
534
|
}
|
|
351
|
-
delete appSchema.definitions[
|
|
352
|
-
delete appSchema.definitions[`${
|
|
535
|
+
delete appSchema.definitions[ux_specification_types_2.DefinitionName.GenericActions];
|
|
536
|
+
delete appSchema.definitions[`${ux_specification_types_2.DefinitionName.ObjectPageHeader}<${ux_specification_types_2.DefinitionName.GenericActions}>`];
|
|
353
537
|
}
|
|
354
538
|
exports.addHeaderActions = addHeaderActions;
|
|
355
539
|
/**
|
|
@@ -359,10 +543,10 @@ exports.addHeaderActions = addHeaderActions;
|
|
|
359
543
|
*/
|
|
360
544
|
function addCommonHeaderSchema(appSchema, entityType) {
|
|
361
545
|
appSchema.properties['header'] = {
|
|
362
|
-
$ref: `${__1.DEFINITION_LINK_PREFIX}${
|
|
546
|
+
$ref: `${__1.DEFINITION_LINK_PREFIX}${ux_specification_types_2.DefinitionName.ObjectPageHeader}`
|
|
363
547
|
};
|
|
364
|
-
appSchema.definitions[
|
|
365
|
-
appSchema.definitions[
|
|
548
|
+
appSchema.definitions[ux_specification_types_2.DefinitionName.ObjectPageHeader] = JSON.parse(JSON.stringify(appSchema.definitions[`${ux_specification_types_2.DefinitionName.ObjectPageHeader}<${ux_specification_types_2.DefinitionName.GenericActions}>`]));
|
|
549
|
+
appSchema.definitions[ux_specification_types_2.DefinitionName.ObjectPageHeader][ux_specification_types_2.SchemaTag.annotationPath] = `/${entityType.fullyQualifiedName}/@${"com.sap.vocabularies.UI.v1.HeaderInfo" /* HeaderInfo */}`;
|
|
366
550
|
}
|
|
367
551
|
exports.addCommonHeaderSchema = addCommonHeaderSchema;
|
|
368
552
|
/**
|