@sap/ux-specification 1.96.52 → 1.96.54

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.
Files changed (135) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/dist/documentation/runDocu-min.js +4 -4
  3. package/dist/documentation/runDocu-min.js.map +3 -3
  4. package/dist/documentation/styleDocu.css +4 -0
  5. package/dist/documentation/v2/v2-AnalyticalListPage.html +2 -2
  6. package/dist/documentation/v2/v2-ApplicationV2.html +2 -2
  7. package/dist/documentation/v2/v2-ListReport.html +2 -2
  8. package/dist/documentation/v2/v2-ObjectPage.html +2 -2
  9. package/dist/documentation/v2/v2-OverviewPage.html +2 -2
  10. package/dist/documentation/v4/v4-ApplicationV4.html +2 -2
  11. package/dist/documentation/v4/v4-BuildingBlocks.html +2 -2
  12. package/dist/documentation/v4/v4-FreestylePage.html +2 -2
  13. package/dist/documentation/v4/v4-ListReport.html +2 -2
  14. package/dist/documentation/v4/v4-ObjectPage.html +2 -2
  15. package/dist/index-min.js +166 -169
  16. package/dist/index-min.js.map +4 -4
  17. package/dist/package.json +11 -12
  18. package/dist/schemas/v2/ObjectPageConfig.json +229 -163
  19. package/dist/schemas/v2/OverviewPageConfig.json +962 -704
  20. package/dist/src/api.js +2 -2
  21. package/dist/src/api.js.map +1 -1
  22. package/dist/src/extensionLogger.d.ts.map +1 -1
  23. package/dist/src/extensionLogger.js +6 -1
  24. package/dist/src/extensionLogger.js.map +1 -1
  25. package/dist/src/sync/common/decoration/control.d.ts +4 -0
  26. package/dist/src/sync/common/decoration/control.d.ts.map +1 -1
  27. package/dist/src/sync/common/decoration/control.js +8 -1
  28. package/dist/src/sync/common/decoration/control.js.map +1 -1
  29. package/dist/src/sync/common/distTagEvaluator.d.ts.map +1 -1
  30. package/dist/src/sync/common/distTagEvaluator.js +1 -1
  31. package/dist/src/sync/common/distTagEvaluator.js.map +1 -1
  32. package/dist/src/sync/common/generate/objectPage.d.ts +5 -5
  33. package/dist/src/sync/common/generate/objectPage.d.ts.map +1 -1
  34. package/dist/src/sync/common/generate/objectPage.js +14 -12
  35. package/dist/src/sync/common/generate/objectPage.js.map +1 -1
  36. package/dist/src/sync/common/generate/utils.d.ts.map +1 -1
  37. package/dist/src/sync/common/generate/utils.js +56 -47
  38. package/dist/src/sync/common/generate/utils.js.map +1 -1
  39. package/dist/src/sync/common/i18n.json +1 -0
  40. package/dist/src/sync/common/importProject.d.ts.map +1 -1
  41. package/dist/src/sync/common/importProject.js +15 -13
  42. package/dist/src/sync/common/importProject.js.map +1 -1
  43. package/dist/src/sync/common/utils.d.ts.map +1 -1
  44. package/dist/src/sync/common/utils.js +53 -46
  45. package/dist/src/sync/common/utils.js.map +1 -1
  46. package/dist/src/sync/v2/application.d.ts +2 -1
  47. package/dist/src/sync/v2/application.d.ts.map +1 -1
  48. package/dist/src/sync/v2/application.js +8 -3
  49. package/dist/src/sync/v2/application.js.map +1 -1
  50. package/dist/src/sync/v2/export/controls/Card.d.ts +71 -76
  51. package/dist/src/sync/v2/export/controls/Card.d.ts.map +1 -1
  52. package/dist/src/sync/v2/export/controls/Card.js +103 -246
  53. package/dist/src/sync/v2/export/controls/Card.js.map +1 -1
  54. package/dist/src/sync/v2/export/controls/ObjectPageTable.d.ts +17 -6
  55. package/dist/src/sync/v2/export/controls/ObjectPageTable.d.ts.map +1 -1
  56. package/dist/src/sync/v2/export/controls/ObjectPageTable.js +109 -19
  57. package/dist/src/sync/v2/export/controls/ObjectPageTable.js.map +1 -1
  58. package/dist/src/sync/v2/export/controls/Table.d.ts.map +1 -1
  59. package/dist/src/sync/v2/export/controls/Table.js +0 -1
  60. package/dist/src/sync/v2/export/controls/Table.js.map +1 -1
  61. package/dist/src/sync/v2/export/export.d.ts +2 -1
  62. package/dist/src/sync/v2/export/export.d.ts.map +1 -1
  63. package/dist/src/sync/v2/export/export.js +38 -61
  64. package/dist/src/sync/v2/export/export.js.map +1 -1
  65. package/dist/src/sync/v2/export/exportPage.d.ts.map +1 -1
  66. package/dist/src/sync/v2/export/exportPage.js +0 -14
  67. package/dist/src/sync/v2/export/exportPage.js.map +1 -1
  68. package/dist/src/sync/v2/export/pages/ObjectPage.d.ts +1 -0
  69. package/dist/src/sync/v2/export/pages/ObjectPage.d.ts.map +1 -1
  70. package/dist/src/sync/v2/export/pages/ObjectPage.js +18 -0
  71. package/dist/src/sync/v2/export/pages/ObjectPage.js.map +1 -1
  72. package/dist/src/sync/v2/export/pages/OverviewPage.d.ts +12 -5
  73. package/dist/src/sync/v2/export/pages/OverviewPage.d.ts.map +1 -1
  74. package/dist/src/sync/v2/export/pages/OverviewPage.js +39 -21
  75. package/dist/src/sync/v2/export/pages/OverviewPage.js.map +1 -1
  76. package/dist/src/sync/v2/generate/analyticalListReport.d.ts.map +1 -1
  77. package/dist/src/sync/v2/generate/analyticalListReport.js +56 -8
  78. package/dist/src/sync/v2/generate/analyticalListReport.js.map +1 -1
  79. package/dist/src/sync/v2/generate/generate.d.ts.map +1 -1
  80. package/dist/src/sync/v2/generate/generate.js +1 -4
  81. package/dist/src/sync/v2/generate/generate.js.map +1 -1
  82. package/dist/src/sync/v2/generate/listReport.d.ts.map +1 -1
  83. package/dist/src/sync/v2/generate/listReport.js +9 -9
  84. package/dist/src/sync/v2/generate/listReport.js.map +1 -1
  85. package/dist/src/sync/v2/generate/objectPage.d.ts.map +1 -1
  86. package/dist/src/sync/v2/generate/objectPage.js +51 -51
  87. package/dist/src/sync/v2/generate/objectPage.js.map +1 -1
  88. package/dist/src/sync/v2/generate/utils.d.ts +23 -5
  89. package/dist/src/sync/v2/generate/utils.d.ts.map +1 -1
  90. package/dist/src/sync/v2/generate/utils.js +35 -7
  91. package/dist/src/sync/v2/generate/utils.js.map +1 -1
  92. package/dist/src/sync/v2/import/pages/listReport.d.ts.map +1 -1
  93. package/dist/src/sync/v2/import/pages/listReport.js +1 -4
  94. package/dist/src/sync/v2/import/pages/listReport.js.map +1 -1
  95. package/dist/src/sync/v2/import/pages/objectPage.d.ts.map +1 -1
  96. package/dist/src/sync/v2/import/pages/objectPage.js +7 -1
  97. package/dist/src/sync/v2/import/pages/objectPage.js.map +1 -1
  98. package/dist/src/sync/v2/import/pages/overviewPage.d.ts.map +1 -1
  99. package/dist/src/sync/v2/import/pages/overviewPage.js +54 -61
  100. package/dist/src/sync/v2/import/pages/overviewPage.js.map +1 -1
  101. package/dist/src/sync/v2/types.d.ts +1 -0
  102. package/dist/src/sync/v2/types.d.ts.map +1 -1
  103. package/dist/src/sync/v2/types.js +2 -1
  104. package/dist/src/sync/v2/types.js.map +1 -1
  105. package/dist/src/sync/v4/export/controls/Table.d.ts +1 -1
  106. package/dist/src/sync/v4/export/controls/Table.d.ts.map +1 -1
  107. package/dist/src/sync/v4/export/controls/Table.js +5 -11
  108. package/dist/src/sync/v4/export/controls/Table.js.map +1 -1
  109. package/dist/src/sync/v4/generate/fpm-custom-page/generator.d.ts.map +1 -1
  110. package/dist/src/sync/v4/generate/fpm-custom-page/generator.js +34 -19
  111. package/dist/src/sync/v4/generate/fpm-custom-page/generator.js.map +1 -1
  112. package/dist/src/sync/v4/generate/fpm-custom-page/{pageExtenstions.d.ts → pageExtensions.d.ts} +1 -1
  113. package/dist/src/sync/v4/generate/fpm-custom-page/pageExtensions.d.ts.map +1 -0
  114. package/dist/src/sync/v4/generate/fpm-custom-page/{pageExtenstions.js → pageExtensions.js} +1 -1
  115. package/dist/src/sync/v4/generate/fpm-custom-page/pageExtensions.js.map +1 -0
  116. package/dist/src/sync/v4/generate/generate.d.ts.map +1 -1
  117. package/dist/src/sync/v4/generate/generate.js +1 -1
  118. package/dist/src/sync/v4/generate/generate.js.map +1 -1
  119. package/dist/src/sync/v4/generate/listReport.d.ts +3 -2
  120. package/dist/src/sync/v4/generate/listReport.d.ts.map +1 -1
  121. package/dist/src/sync/v4/generate/listReport.js +19 -16
  122. package/dist/src/sync/v4/generate/listReport.js.map +1 -1
  123. package/dist/src/sync/v4/generate/objectPage.d.ts +2 -2
  124. package/dist/src/sync/v4/generate/objectPage.d.ts.map +1 -1
  125. package/dist/src/sync/v4/generate/objectPage.js +280 -97
  126. package/dist/src/sync/v4/generate/objectPage.js.map +1 -1
  127. package/dist/src/sync/v4/import/pages/listReport.d.ts.map +1 -1
  128. package/dist/src/sync/v4/import/pages/listReport.js +1 -4
  129. package/dist/src/sync/v4/import/pages/listReport.js.map +1 -1
  130. package/dist/src/sync/v4/import/pages/objectPage.d.ts.map +1 -1
  131. package/dist/src/sync/v4/import/pages/objectPage.js +27 -11
  132. package/dist/src/sync/v4/import/pages/objectPage.js.map +1 -1
  133. package/package.json +11 -12
  134. package/dist/src/sync/v4/generate/fpm-custom-page/pageExtenstions.d.ts.map +0 -1
  135. package/dist/src/sync/v4/generate/fpm-custom-page/pageExtenstions.js.map +0 -1
@@ -11,84 +11,262 @@ const common_1 = require("../../common");
11
11
  const utils_1 = require("../utils/utils");
12
12
  const utils_2 = require("../utils/utils");
13
13
  const StableIdHelper_1 = require("../../v4/utils/StableIdHelper");
14
- const pageExtenstions_1 = require("./fpm-custom-page/pageExtenstions");
14
+ const pageExtensions_1 = require("./fpm-custom-page/pageExtensions");
15
+ const utils_3 = require("../../v2/generate/utils");
15
16
  const ROOT_PROPERTIES_ORDER = ['header', 'layout', 'sections', 'footer'];
17
+ const CRITICAL_ACTION_TYPES = [
18
+ 'UI.CriticalityType/Positive',
19
+ 'UI.CriticalityType/VeryPositive',
20
+ 'UI.CriticalityType/Negative',
21
+ 'UI.CriticalityType/VeryNegative'
22
+ ];
16
23
  const CUSTOM_ACTION_DEFINITION_DESCRIPTION = 'Custom Action';
17
24
  /**
18
- * Callback for adding a single action to headerActions of V4
19
- * @param {EntityType} entityType - current entity type
25
+ * V4 callback - adds a single header action to schema
26
+ * @param {ConvertedMetadata} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
27
+ * @param {ActionListType} action - item of the Ui.Identification collection and its original index
28
+ * @param {ActionType} actionType - action classification for grouping
20
29
  * @param {Definition} appSchema Schema of the app
21
- * @param actionAnnotation - annotation as present in AVT ConvertedMetadata
30
+ * @param {EntityType} entityType - current entity type
22
31
  * @param {Definition} headerActions - list of header actions, to be enhanced
23
- * @param {ConvertedMetadata} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
24
32
  */
25
- function addHeaderActionCallBackV4(entityType, appSchema, actionAnnotation, headerActions, oDataServiceAVT) {
26
- return (item, index) => {
33
+ function addSingleHeaderActionV4(oDataServiceAVT, action, actionType, appSchema, entityType, headerActions, index) {
34
+ const { actionName, namespace } = (0, common_1.getActionNameAndId)(action.item, oDataServiceAVT);
35
+ const stableId = (0, StableIdHelper_1.getStableIdPartFromDataField)(action.item);
36
+ //stableId is used as key in V4, as the DataFieldForAction:: prefix shall be present in manifest settings
37
+ const convertedIdentification = action.item['fullyQualifiedName'].replace(`@${"com.sap.vocabularies.UI.v1.Identification" /* UIAnnotationTerms.Identification */}`, `/@${"com.sap.vocabularies.UI.v1.Identification" /* UIAnnotationTerms.Identification */}`);
38
+ const actionDefinitionKey = `ObjectPageHeaderAction<${(0, common_1.prepareRef)(stableId)}>`;
39
+ const headerAction = (appSchema.definitions[actionDefinitionKey] = {
40
+ type: 'object',
41
+ $ref: `${common_1.DEFINITION_LINK_PREFIX}${ux_specification_types_1.DefinitionName.ObjectPageHeaderAction}`,
42
+ description: (0, common_1.getDataFieldDescription)(action.item, entityType)
43
+ });
44
+ headerAction[ux_specification_types_1.SchemaTag.isViewNode] = true;
45
+ headerAction[ux_specification_types_1.SchemaTag.dataType] = (0, common_1.determineDataType)(action.item);
46
+ headerAction[ux_specification_types_1.SchemaTag.propertyIndex] = index;
47
+ //keys
48
+ headerAction[ux_specification_types_1.SchemaTag.keys] = [];
49
+ if (action.item[ux_specification_types_1.SchemaKeyName.semanticObject]) {
50
+ headerAction[ux_specification_types_1.SchemaTag.keys].push({
51
+ name: ux_specification_types_1.SchemaKeyName.semanticObject,
52
+ value: action.item[ux_specification_types_1.SchemaKeyName.semanticObject]
53
+ });
54
+ }
55
+ headerAction[ux_specification_types_1.SchemaTag.keys].push({ name: ux_specification_types_1.SchemaKeyName.action, value: actionName });
56
+ if (namespace) {
57
+ appSchema.definitions[actionDefinitionKey][ux_specification_types_1.SchemaTag.target] = namespace;
58
+ }
59
+ headerAction[ux_specification_types_1.SchemaTag.actionType] = actionType;
60
+ headerAction[ux_specification_types_1.SchemaTag.annotationPath] = `/${convertedIdentification}`;
61
+ headerActions.properties[stableId] = {
62
+ $ref: `${common_1.DEFINITION_LINK_PREFIX}${actionDefinitionKey}`
63
+ };
64
+ // add propertyIndexes
65
+ headerActions.properties[stableId][ux_specification_types_1.SchemaTag.propertyIndex] = index;
66
+ }
67
+ /**
68
+ * Adds a given standard action to the app schema of the object page
69
+ * @param {string} actionName - name of the action
70
+ * @param {Definition} appSchema - schema of the object page
71
+ * @param {Definition} headerActions - list of header actions, to be enhanced
72
+ * @param {number} index - index for propertyIndex
73
+ *
74
+ * @returns the new header action definition
75
+ */
76
+ function addStandardHeaderAction(actionName, appSchema, headerActions, index) {
77
+ const referenceKey = `${actionName}Action`;
78
+ const actionDefinitionKey = `ObjectPageHeaderAction<${referenceKey}>`;
79
+ const headerAction = (appSchema.definitions[actionDefinitionKey] = {
80
+ type: 'object',
81
+ description: `${actionName}`,
82
+ additionalProperties: true
83
+ });
84
+ headerAction[ux_specification_types_1.SchemaTag.isViewNode] = true;
85
+ headerAction[ux_specification_types_1.SchemaTag.propertyIndex] = index;
86
+ //keys
87
+ headerAction[ux_specification_types_1.SchemaTag.keys] = [];
88
+ headerAction[ux_specification_types_1.SchemaTag.keys].push({ name: ux_specification_types_1.SchemaKeyName.action, value: actionName });
89
+ headerAction[ux_specification_types_1.SchemaTag.actionType] = ux_specification_types_1.ActionType.Standard;
90
+ headerActions.properties[referenceKey] = {
91
+ $ref: `${common_1.DEFINITION_LINK_PREFIX}${actionDefinitionKey}`
92
+ };
93
+ // add propertyIndexes
94
+ headerActions.properties[referenceKey][ux_specification_types_1.SchemaTag.propertyIndex] = index;
95
+ return headerAction;
96
+ }
97
+ /**
98
+ * V4 callback - adds a single footer action to schema
99
+ * @param {ActionListType} action - item of the Ui.Identification collection and its original index
100
+ * @param {ActionType} actionType - action classification for grouping
101
+ * @param {EntityType} entityType - current entity type
102
+ * @param {Definition} appSchema - schema of the object page
103
+ * @param {Definition} footerActions - list of footer actions, to be enhanced
104
+ */
105
+ function addSingleFooterAction(action, actionType, entityType, appSchema, footerActions, index) {
106
+ const actionId = (0, StableIdHelper_1.getStableIdPartFromDataField)(action.item);
107
+ const description = (0, common_1.getDataFieldDescription)(action.item, entityType);
108
+ const actionDefinitionKey = (0, common_1.prepareRef)(`${ux_specification_types_1.DefinitionName.ObjectPageFooterAction}<${actionId}>`);
109
+ const convertedIdentification = action.item['fullyQualifiedName'].replace(`@${"com.sap.vocabularies.UI.v1.Identification" /* UIAnnotationTerms.Identification */}`, `/@${"com.sap.vocabularies.UI.v1.Identification" /* UIAnnotationTerms.Identification */}`);
110
+ const footerAction = (appSchema.definitions[actionDefinitionKey] = {
111
+ type: 'object',
112
+ $ref: `${common_1.DEFINITION_LINK_PREFIX}${ux_specification_types_1.DefinitionName.FooterActionV4}`,
113
+ description: description
114
+ });
115
+ footerAction[ux_specification_types_1.SchemaTag.isViewNode] = true;
116
+ footerAction[ux_specification_types_1.SchemaTag.actionType] = actionType;
117
+ footerAction[ux_specification_types_1.SchemaTag.propertyIndex] = index;
118
+ footerAction[ux_specification_types_1.SchemaTag.annotationPath] = `/${convertedIdentification}`;
119
+ footerActions.properties[actionId] = {
120
+ $ref: `${common_1.DEFINITION_LINK_PREFIX}${actionDefinitionKey}`
121
+ };
122
+ }
123
+ /**
124
+ * Distiguishes critical actions and others and returns two separate groups
125
+ * @param {any} identification - UI.Identification annotation as present in AVT ConvertedMetadata
126
+ * @returns two separate groups of items
127
+ */
128
+ function groupByCriticality(identification) {
129
+ const criticalActions = [];
130
+ const unCriticalActions = [];
131
+ identification.forEach((item, index) => {
27
132
  if ((!item['Determining'] && item.$Type === "com.sap.vocabularies.UI.v1.DataFieldForAction" /* UIAnnotationTypes.DataFieldForAction */) ||
28
133
  item.$Type === "com.sap.vocabularies.UI.v1.DataFieldForIntentBasedNavigation" /* UIAnnotationTypes.DataFieldForIntentBasedNavigation */) {
29
- const { actionName, actionId, namespace } = (0, common_1.getActionNameAndId)(item, oDataServiceAVT);
30
- if (!actionId) {
31
- return;
32
- }
33
- const stableId = (0, StableIdHelper_1.getStableIdPartFromDataField)(item);
34
- //stableId is used as key in V4, as the DataFieldForAction:: prefix shall be present in manifest settings
35
- const convertedIdentification = actionAnnotation.fullyQualifiedName.replace(`@${"com.sap.vocabularies.UI.v1.Identification" /* UIAnnotationTerms.Identification */}`, `/@${"com.sap.vocabularies.UI.v1.Identification" /* UIAnnotationTerms.Identification */}`);
36
- const actionDefinitionKey = `ObjectPageHeaderAction<${(0, common_1.prepareRef)(stableId)}>`;
37
- const headerAction = (appSchema.definitions[actionDefinitionKey] = {
38
- type: 'object',
39
- $ref: `${common_1.DEFINITION_LINK_PREFIX}${ux_specification_types_1.DefinitionName.ObjectPageHeaderAction}`,
40
- description: (0, common_1.getDataFieldDescription)(item, entityType)
41
- });
42
- headerAction[ux_specification_types_1.SchemaTag.isViewNode] = true;
43
- headerAction[ux_specification_types_1.SchemaTag.dataType] = (0, common_1.determineDataType)(item);
44
- //keys
45
- headerAction[ux_specification_types_1.SchemaTag.keys] = [];
46
- if (item[ux_specification_types_1.SchemaKeyName.semanticObject]) {
47
- headerAction[ux_specification_types_1.SchemaTag.keys].push({
48
- name: ux_specification_types_1.SchemaKeyName.semanticObject,
49
- value: item[ux_specification_types_1.SchemaKeyName.semanticObject]
50
- });
134
+ if (CRITICAL_ACTION_TYPES.includes(item['Criticality'])) {
135
+ criticalActions.push({ index, item });
51
136
  }
52
- headerAction[ux_specification_types_1.SchemaTag.keys].push({ name: ux_specification_types_1.SchemaKeyName.action, value: actionName });
53
- if (namespace) {
54
- appSchema.definitions[actionDefinitionKey][ux_specification_types_1.SchemaTag.target] = namespace;
137
+ else {
138
+ unCriticalActions.push({ index, item });
55
139
  }
56
- headerAction[ux_specification_types_1.SchemaTag.annotationPath] = `/${convertedIdentification}/${index}`;
57
- headerActions.properties[stableId] = {
58
- $ref: `${common_1.DEFINITION_LINK_PREFIX}${actionDefinitionKey}`
59
- };
60
140
  }
61
- };
141
+ });
142
+ return { criticalActions, unCriticalActions };
143
+ }
144
+ /**
145
+ * Adds the critical header actions to schema
146
+ * @param {ActionListType[]} criticalActions - list of critical actions
147
+ * @param {ConvertedMetadata} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
148
+ * @param {Definition} appSchema - schema of the object page
149
+ * @param {EntityType} entityType - current entity type
150
+ * @param {Definition} headerActions - list of all header actions
151
+ */
152
+ function addCriticalActions(criticalActions, oDataServiceAVT, appSchema, entityType, headerActions) {
153
+ for (let index = 0; index < criticalActions.length; index++) {
154
+ addSingleHeaderActionV4(oDataServiceAVT, criticalActions[index], ux_specification_types_1.ActionType.Criticality, appSchema, entityType, headerActions, index);
155
+ }
156
+ }
157
+ /**
158
+ * Checks if one of the uncritical actions is marked by isCopyAction.
159
+ * If so, adds this first to the schema and deletes it from the list.
160
+ * @param {ActionListType[]} unCriticalActions - list of uncritical actions
161
+ * @param {ConvertedMetadata} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
162
+ * @param {Definition} appSchema - schema of the object page
163
+ * @param {EntityType} entityType - current entity type
164
+ * @param {Definition} headerActions - list of all header actions
165
+ * @param {number} nextIndex - index for propertyIndex
166
+ */
167
+ function addCopyAction(unCriticalActions, oDataServiceAVT, appSchema, entityType, headerActions, nextIndex) {
168
+ const copyActionIndex = unCriticalActions.findIndex((action) => {
169
+ return action.item['annotations']?.UI?.IsCopyAction !== undefined;
170
+ });
171
+ if (copyActionIndex > -1) {
172
+ addSingleHeaderActionV4(oDataServiceAVT, unCriticalActions[copyActionIndex], ux_specification_types_1.ActionType.Copy, appSchema, entityType, headerActions, nextIndex);
173
+ nextIndex++;
174
+ unCriticalActions.splice(copyActionIndex, 1);
175
+ }
176
+ }
177
+ /**
178
+ * Adds the critical header actions to schema
179
+ * @param {ActionListType[]} unCriticalActions - list of uncritical actions
180
+ * @param {ConvertedMetadata} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
181
+ * @param {Definition} appSchema - schema of the object page
182
+ * @param {EntityType} entityType - current entity type
183
+ * @param {Definition} headerActions - list of all header actions
184
+ * @param {number} nextIndex - index for propertyIndex
185
+ */
186
+ function addUncriticalActions(unCriticalActions, oDataServiceAVT, appSchema, entityType, headerActions, nextIndex) {
187
+ for (const action of unCriticalActions) {
188
+ addSingleHeaderActionV4(oDataServiceAVT, action, ux_specification_types_1.ActionType.Annotation, appSchema, entityType, headerActions, nextIndex);
189
+ nextIndex++;
190
+ }
191
+ }
192
+ /**
193
+ * Fills the annotationPath of the given schema definition, by checking first the EntitySet annotation, then the EntityType annotation.
194
+ * @param {Definition} schemaDefinition - current definition in the schema
195
+ * @param {EntitySet} entitySet - current entity set
196
+ * @param {EntityType} entityType - current entity type
197
+ * @param {string} annotationName - name of the annotation term to be checked
198
+ */
199
+ function setAnnotationPathFromEntitySetOrEntityType(schemaDefinition, entitySet, entityType, annotationName) {
200
+ if (entitySet?.annotations?.UI?.[annotationName] || !entityType?.annotations?.UI?.[annotationName]) {
201
+ schemaDefinition[ux_specification_types_1.SchemaTag.annotationPath] = `/${entitySet.fullyQualifiedName}/${ux_specification_types_1.UIVOCABULARYALPHADOT}${annotationName}`;
202
+ }
203
+ else {
204
+ schemaDefinition[ux_specification_types_1.SchemaTag.annotationPath] = `/${entityType.fullyQualifiedName}/${ux_specification_types_1.UIVOCABULARYALPHADOT}${annotationName}`;
205
+ }
206
+ }
207
+ /**
208
+ * Callback for adding a single action to headerActions of V4
209
+ * @param {EntityType} entityType - current entity type
210
+ * @param {Definition} appSchema - schema of the object page
211
+ * @param {any} identification - UI.Identification annotation as present in AVT ConvertedMetadata
212
+ * @param {Definition} headerActions - list of header actions, to be enhanced
213
+ * @param {ConvertedMetadata} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
214
+ * @param {EntitySet} entitySet - current entity set
215
+ */
216
+ function addHeaderActionCallBackV4(entityType, appSchema, identification, headerActions, oDataServiceAVT, entitySet) {
217
+ //Build groups of action types
218
+ const { criticalActions = [], unCriticalActions = [] } = identification ? groupByCriticality(identification) : {};
219
+ addCriticalActions(criticalActions, oDataServiceAVT, appSchema, entityType, headerActions);
220
+ const isDeletable = (0, utils_3.isEntityDeletable)(entitySet);
221
+ const isUpdatable = (0, utils_3.isEntityUpdatable)(entitySet);
222
+ // Add standard header actions
223
+ // If ReadOnly, and all capabilities restrictions are set to true or When nothing exists i.e. no capabilities annotation and no draft root, show only Delete button
224
+ // If DraftRoot + DraftNode and dynamic value for restriction - show Edit and Delete, if bool == false then hide the button
225
+ if ((0, utils_3.isDraftEnabled)(entitySet) && isUpdatable) {
226
+ const editAction = addStandardHeaderAction('Edit', appSchema, headerActions, criticalActions.length);
227
+ setAnnotationPathFromEntitySetOrEntityType(editAction, entitySet, entityType, 'UpdateHidden');
228
+ }
229
+ if (isDeletable) {
230
+ const deleteAction = addStandardHeaderAction('Delete', appSchema, headerActions, criticalActions.length + 1);
231
+ setAnnotationPathFromEntitySetOrEntityType(deleteAction, entitySet, entityType, 'DeleteHidden');
232
+ }
233
+ const nextIndex = criticalActions.length + 2;
234
+ //Check if isCopyAction is defined, this gets rendered first after delete
235
+ addCopyAction(unCriticalActions, oDataServiceAVT, appSchema, entityType, headerActions, nextIndex);
236
+ addUncriticalActions(unCriticalActions, oDataServiceAVT, appSchema, entityType, headerActions, nextIndex);
62
237
  }
63
238
  /**
64
239
  * Callback for adding a single action to footerActions of V4
65
240
  * @param {EntityType} entityType - current entity type
66
- * @param {Definition} appSchema Schema of the app
241
+ * @param {Definition} appSchema - schema of the object page
67
242
  * @param {Definition} footerActions - list of footer actions, to be enhanced
68
- * @param {String} convertedIdentification - converted UI.Identification term
243
+ * @param {any} identification - UI.Identification annotation as present in AVT ConvertedMetadata
69
244
  */
70
- function addFooterActionCallBackV4(entityType, appSchema, footerActions, convertedIdentification) {
71
- return (item, index) => {
245
+ function addFooterActionCallBackV4(entityType, appSchema, footerActions, identification) {
246
+ const criticalActions = [];
247
+ const unCriticalActions = [];
248
+ identification.forEach((item, index) => {
72
249
  if (item['Determining'] && item.$Type === "com.sap.vocabularies.UI.v1.DataFieldForAction" /* UIAnnotationTypes.DataFieldForAction */) {
73
- const actionId = (0, StableIdHelper_1.getStableIdPartFromDataField)(item);
74
- const description = (0, common_1.getDataFieldDescription)(item, entityType);
75
- const actionDefinitionKey = (0, common_1.prepareRef)(`${ux_specification_types_1.DefinitionName.ObjectPageFooterAction}<${actionId}>`);
76
- appSchema.definitions[actionDefinitionKey] = {
77
- type: 'object',
78
- $ref: `${common_1.DEFINITION_LINK_PREFIX}${ux_specification_types_1.DefinitionName.FooterActionV4}`,
79
- description: description
80
- };
81
- appSchema.definitions[actionDefinitionKey][ux_specification_types_1.SchemaTag.isViewNode] = true;
82
- appSchema.definitions[actionDefinitionKey][ux_specification_types_1.SchemaTag.annotationPath] = `/${convertedIdentification}/${index}`;
83
- footerActions.properties[actionId] = {
84
- $ref: `${common_1.DEFINITION_LINK_PREFIX}${actionDefinitionKey}`
85
- };
250
+ if (item['Criticality']) {
251
+ criticalActions.push({ index, item });
252
+ }
253
+ else {
254
+ unCriticalActions.push({ index, item });
255
+ }
86
256
  }
87
- };
257
+ });
258
+ for (let index = 0; index < criticalActions.length; index++) {
259
+ const action = criticalActions[index];
260
+ addSingleFooterAction(action, ux_specification_types_1.ActionType.Criticality, entityType, appSchema, footerActions, index);
261
+ }
262
+ for (let index = 0; index < unCriticalActions.length; index++) {
263
+ const action = unCriticalActions[index];
264
+ addSingleFooterAction(action, ux_specification_types_1.ActionType.Annotation, entityType, appSchema, footerActions, criticalActions.length + index);
265
+ }
88
266
  }
89
267
  /**
90
268
  * Object Page specific enhancements to addCustomColumnDefinition
91
- * @param {object} appSchema App schema in general
269
+ * @param {object} appSchema - app schema of the object page
92
270
  * @param {SapUiAppPageV4} v4Page Current page in manifest
93
271
  * @param {string} lineItemId - identifier of the current table in schema
94
272
  * @param {string} facetIdInManifest - identifier of the current object page section in manifest
@@ -116,7 +294,7 @@ function addCustomColumnsOP(appSchema, v4Page, lineItemId, facetIdInManifest, lo
116
294
  }
117
295
  /**
118
296
  * Object Page specific enhancements to addCustomColumnDefinition
119
- * @param {object} appSchema App schema in general
297
+ * @param {object} appSchema - app schema of the object page
120
298
  * @param {SapUiAppPageV4} v4Page Current page in manifest
121
299
  * @param {string} lineItemId - identifier of the current table in schema
122
300
  * @param {string} facetIdInManifest - identifier of the current object page section in manifest
@@ -148,9 +326,9 @@ function addTableCustomActionsOP(appSchema, v4Page, lineItemId, facetIdInManifes
148
326
  }
149
327
  /**
150
328
  * Object Page specific custom action enhancements to header and footer
151
- * @param {object} appSchema App schema in general
152
- * @param {SapUiAppPageV4} v4Page Current page in manifest
153
- * @param {DefinitionName} customActionDefinitionKey custom action key used in definitions
329
+ * @param {object} appSchema - app schema of the object page
330
+ * @param {SapUiAppPageV4} v4Page - current page in manifest
331
+ * @param {DefinitionName} customActionDefinitionKey - custom action key used in definitions
154
332
  * @param {ExtensionLogger} logger - logger for exceptions
155
333
  */
156
334
  function addHeaderFooterCustomActionsOP(appSchema, v4Page, customActionDefinitionKey, logger) {
@@ -176,8 +354,8 @@ function addHeaderFooterCustomActionsOP(appSchema, v4Page, customActionDefinitio
176
354
  }
177
355
  /**
178
356
  * Object Page specific enhancements to handleFormIdentification
179
- * @param {object} appSchema App schema in general
180
- * @param {SapUiAppPageV4} v4Page Current page in manifest
357
+ * @param {object} appSchema - app schema of the object page
358
+ * @param {SapUiAppPageV4} v4Page - current page in manifest
181
359
  * @param {string} formItemId - identifier of the current form in schema
182
360
  * @param {string} facetIdInManifest - identifier of the current object page section in manifest
183
361
  * @param {ExtensionLogger} logger - logger for exceptions
@@ -205,7 +383,7 @@ function addFormCustomActionsOP(appSchema, v4Page, formItemId, facetIdInManifest
205
383
  * Adds definitions for line items in object page sections to the app schema
206
384
  * @param {FacetConfig} facet - the given facet from the UI annotations
207
385
  * @param {string} facetKey - key of the facet, as used in annotation
208
- * @param {Definition} appSchema - app schema in general
386
+ * @param {Definition} appSchema - app schema of the object page
209
387
  * @param {object} lineItemFacet - current lineItem facet
210
388
  * @param {ConvertedMetadata} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
211
389
  * @param {SapUiAppPageV4} v4Page Current page in manifest
@@ -243,9 +421,9 @@ function handleLineItem(facet, facetKey, appSchema, lineItemFacet, oDataServiceA
243
421
  }
244
422
  /**
245
423
  * Adds definitions for table section in object page sections to the app schema
246
- * @param {FacetConfig} facet - current facet.
247
- * @param {string} facetKey - facet key.
248
- * @param {Definition} appSchema - app specific schema that potentially gets enhanced.
424
+ * @param {FacetConfig} facet - current facet
425
+ * @param {string} facetKey - facet key
426
+ * @param {Definition} appSchema - app specific schema of the object page that gets enhanced
249
427
  * @param {object} lineItemFacet - current lineItem facet
250
428
  * @param {GenerateSchemaParameters} generateParameters - list of API input parameters
251
429
  * @param {SapUiAppPageV4} v4Page Current page in manifest
@@ -272,7 +450,7 @@ function handleSectionTable(facet, facetKey, appSchema, lineItemFacet, generateP
272
450
  * @param {v4.SapUiAppPageV4} v4Page Current page in manifest
273
451
  * @param {string} facetKey - facet key
274
452
  * @param {object} sections - schema of current sections definition
275
- * @param {object} appSchema - app specific schema that potentially gets enhanced
453
+ * @param {object} appSchema - app specific schema of the object page that gets enhanced
276
454
  * @param {SectionType} sectionPrefix - prefix to distinguish Section and HeaderSection
277
455
  * @param {ExtensionLogger} logger - logger for exceptions
278
456
  */
@@ -304,10 +482,10 @@ function handleFormIdentification(facet, v4Page, facetKey, sections, appSchema,
304
482
  }
305
483
  /**
306
484
  * Adds definitions for header sections (DataPoint, Chart) in object page sections to the app schema
307
- * @param {FacetConfig} facet - current facet.
308
- * @param {string} facetKey - facet key.
309
- * @param {object} sections - schema of current sections definition.
310
- * @param {object} appSchema - app specific schema that potentially gets enhanced.
485
+ * @param {FacetConfig} facet - current facet
486
+ * @param {string} facetKey - facet key
487
+ * @param {object} sections - schema of current sections definition
488
+ * @param {object} appSchema - app specific schema of the object page that gets enhanced
311
489
  * @param {SectionType} facetDefinitionKey - key to identify new definition
312
490
  */
313
491
  function handleHeaderFacet(facet, facetKey, sections, appSchema, facetDefinitionKey) {
@@ -325,7 +503,7 @@ function handleHeaderFacet(facet, facetKey, sections, appSchema, facetDefinition
325
503
  * Adds definitions for Chart items in object page sections to the app schema
326
504
  * @param {FacetConfig | Chart | object} facet - current facet.
327
505
  * @param {string} facetKey - facet key.
328
- * @param {object} appSchema - app specific schema that potentially gets enhanced.
506
+ * @param {object} appSchema - app specific schema of the object page that gets enhanced.
329
507
  * @param {EntityType} entityType - current entity type
330
508
  */
331
509
  function handleChartActions(facet, facetKey, appSchema, entityType) {
@@ -357,7 +535,7 @@ function handleChartActions(facet, facetKey, appSchema, entityType) {
357
535
  * Adds definitions for Chart items in object page sections to the app schema
358
536
  * @param {FacetConfig | Chart | object} facet - current facet.
359
537
  * @param {string} facetKey - facet key.
360
- * @param {object} appSchema - app specific schema that potentially gets enhanced.
538
+ * @param {object} appSchema - app specific schema of the object page that gets enhanced.
361
539
  * @param {EntityType} entityType - current entity type
362
540
  */
363
541
  function handleChart(facet, facetKey, appSchema, entityType) {
@@ -378,7 +556,7 @@ function handleChart(facet, facetKey, appSchema, entityType) {
378
556
  * Adds definitions for Chart section in object page sections to the app schema
379
557
  * @param {FacetConfig} facet - current facet.
380
558
  * @param {string} facetKey - facet key.
381
- * @param {object} appSchema - app specific schema that potentially gets enhanced.
559
+ * @param {object} appSchema - app specific schema of the object page that gets enhanced.
382
560
  * @param {object} sections - schema of current sections definition.
383
561
  * @param {EntityType} entityType - current entity type
384
562
  */
@@ -399,7 +577,7 @@ function handleSectionChart(facet, facetKey, appSchema, sections, entityType = f
399
577
  * Adds definitions for presentation variants in object page sections to the app schema
400
578
  * @param {FacetConfig} facet - the given facet from the UI annotations
401
579
  * @param {string} facetKey - key of the facet, as used in annotation
402
- * @param {Definition} appSchema - app schema in general
580
+ * @param {Definition} appSchema - app schema of the object page
403
581
  * @param {object} sections - schema of current sections definition.
404
582
  * @param {GenerateSchemaParameters} generateParameters - list of API input parameters
405
583
  * @param {SapUiAppPageV4} v4Page Current page in manifest
@@ -409,10 +587,7 @@ function handleSectionPresentationVariant(facet, facetKey, appSchema, sections,
409
587
  if (!facet?.target) {
410
588
  (0, extensionLogger_1.log)(generateParameters.logger, {
411
589
  severity: "error" /* LogSeverity.Error */,
412
- message: i18next_1.default.t('NOPRESENTATIONVARIANT', { key: facetKey }),
413
- location: {
414
- path: ux_specification_types_1.METADATAPATH
415
- }
590
+ message: i18next_1.default.t('NOPRESENTATIONVARIANT', { key: facetKey })
416
591
  });
417
592
  return;
418
593
  }
@@ -466,8 +641,8 @@ function handleSectionPresentationVariant(facet, facetKey, appSchema, sections,
466
641
  }
467
642
  /**
468
643
  * Method checks if passed facet contains any collection facet.
469
- * @param {FacetConfig} facet - facet to check.
470
- * @returns {boolean} Passed facet contains at least one collection facet.
644
+ * @param {FacetConfig} facet - facet to check
645
+ * @returns {boolean} Passed facet contains at least one collection facet
471
646
  */
472
647
  function containsCollectionFacet(facet) {
473
648
  const childFacets = facet.facets || {};
@@ -481,10 +656,10 @@ function containsCollectionFacet(facet) {
481
656
  }
482
657
  /**
483
658
  * Object Page specific enhancements to addCustomColumnDefinition
484
- * @param {object} appSchema - app schema in general
659
+ * @param {object} appSchema - app schema of the object page
485
660
  * @param {string} id - identifier of the current section facet
486
661
  * @param {string[]} featureToggles - supported features
487
- * @returns {string} Custom sub section reference id.
662
+ * @returns {string} Custom sub section reference id
488
663
  */
489
664
  function createCustomSubSectionReference(appSchema, id, featureToggles) {
490
665
  const referenceId = `${ux_specification_types_1.DefinitionName.ObjectPageCustomSubSectionFragment}<${id}>`;
@@ -516,7 +691,7 @@ function createCustomSubSectionReference(appSchema, id, featureToggles) {
516
691
  /**
517
692
  * Common method updates schema for custom header sections or custom subsections.
518
693
  * @param {Definition} sections - sections definition
519
- * @param {Definition} appSchema - app schema in general
694
+ * @param {Definition} appSchema - app schema of the object page
520
695
  * @param {GenerateSchemaParameters} generateParameters - list of API input parameters
521
696
  * @param {SapUiAppPageV4} v4Page Current page in manifest
522
697
  * @param {FacetConfig} facet - the given facet from the UI annotations
@@ -568,7 +743,7 @@ function applyCustomSections(sections, appSchema, generateParameters, v4Page, fa
568
743
  * Adds definitions for collections in object page sections to the app schema
569
744
  * @param {FacetConfig} facet - the given facet from the UI annotations
570
745
  * @param {string} facetKey - key of the facet, as used in annotation
571
- * @param {Definition} appSchema - app schema in general
746
+ * @param {Definition} appSchema - app schema of the object page
572
747
  * @param {Definition} sections - schema of current sections definition.
573
748
  * @param {SectionType} sectionPrefix - prefix to distinguish Section and HeaderSection
574
749
  * @param {GenerateSchemaParameters} generateParameters - list of API input parameters
@@ -608,10 +783,10 @@ function handleCollection(facet, facetKey, appSchema, sections, sectionPrefix, g
608
783
  /**
609
784
  * Creates a section definition in app schema.
610
785
  * @param {GenerateSchemaParameters} generateParameters - list of API input parameters
611
- * @param {FacetConfigs} facets - list of all facets.
612
- * @param {string} facetKey - facet key.
613
- * @param {object} sections - schema of current sections definition.
614
- * @param {object} appSchema - app specific schema that potentially gets enhanced.
786
+ * @param {FacetConfigs} facets - list of all facets
787
+ * @param {string} facetKey - facet key
788
+ * @param {object} sections - schema of current sections definition
789
+ * @param {object} appSchema - app specific schema of the object page that gets enhanced.
615
790
  * @param {SectionType} sectionPrefix - prefix to distinguish Section and HeaderSection
616
791
  * @param {SapUiAppPageV4} v4Page Current page in manifest
617
792
  * @param {number} [level=0] Section level in tree
@@ -666,7 +841,7 @@ function addSection(generateParameters, facets, facetKey, sections, appSchema, s
666
841
  /**
667
842
  * Derives the sections from the UI.Facets annotation and adds them to the schema
668
843
  * @param {GenerateAppSchemaParameters} generateParameters - list of API input parameters
669
- * @param {object} appSchema - application specific JSON schema
844
+ * @param {object} appSchema - application specific JSON schema of the object page
670
845
  * @param {SapUiAppPageV4} v4Page - current page
671
846
  */
672
847
  function addSections(generateParameters, appSchema, v4Page) {
@@ -691,7 +866,7 @@ function addSections(generateParameters, appSchema, v4Page) {
691
866
  /**
692
867
  * Derives the header sections from the UI.HeaderFacets annotation and adds them to the schema
693
868
  * @param {GenerateAppSchemaParameters} generateParameters - list of API input parameters
694
- * @param {object} appSchema - application specific JSON schema
869
+ * @param {object} appSchema - application specific JSON schema of the object page
695
870
  * @param {EntityType} entityType - current entity type
696
871
  * @param {SapUiAppPageV4} v4Page - current page in manifest
697
872
  */
@@ -720,7 +895,7 @@ function addHeaderSections(generateParameters, appSchema, entityType, v4Page) {
720
895
  /**
721
896
  * Adds the related facets keys 'enum' to the app schema
722
897
  * @param {GenerateAppSchemaParameters} generateParameters - list of API input parameters
723
- * @param {object} schema - app specific schema that potentially gets enhanced
898
+ * @param {object} schema - app specific schema of the object page that gets enhanced
724
899
  * @param {SapUiAppPageV4[]} pages - list of all pages
725
900
  * @param {string} contextPath - contextPath of the actual (object) page
726
901
  */
@@ -761,14 +936,14 @@ function addRelatedFacetKeysType(generateParameters, schema, pages, contextPath)
761
936
  /**
762
937
  * Add Object Page Header to app-specific schema
763
938
  * @param {GenerateAppSchemaParameters} generateParameters - list of API input parameters
764
- * @param {Definition} appSchema Schema of the app
939
+ * @param {Definition} appSchema Schema of the object page
765
940
  * @param {SapUiAppPageV4} v4Page - current page in manifest
766
941
  */
767
942
  function addHeader(generateParameters, appSchema, v4Page) {
768
943
  const entityType = generateParameters.entityType;
769
944
  (0, common_1.addCommonHeaderSchema)(appSchema, entityType);
770
945
  // Add header actions
771
- (0, common_1.addHeaderActions)(appSchema, entityType, generateParameters.serviceAVT, addHeaderActionCallBackV4);
946
+ (0, common_1.addHeaderActions)(appSchema, entityType, generateParameters.entitySet, generateParameters.serviceAVT, addHeaderActionCallBackV4);
772
947
  // Add custom header actions
773
948
  addHeaderFooterCustomActionsOP(appSchema, v4Page, ux_specification_types_1.DefinitionName.CustomHeaderActionOP, generateParameters.logger);
774
949
  // Add header sections
@@ -781,8 +956,8 @@ function addHeader(generateParameters, appSchema, v4Page) {
781
956
  * Generates an app specific schema out of the generic schema.
782
957
  * Generic types are replaced by information from the app specific annotations.
783
958
  * @param {GenerateAppSchemaParameters} generateParameters - list of API input parameters
784
- * @param genericSchema - generic JSON schema of an object page
785
- * @param contextPath - contextPath of the given page
959
+ * @param {object} genericSchema - generic JSON schema of an object page
960
+ * @param {string} contextPath - contextPath of the given page
786
961
  * @param {object} genericMacrosSchema - generic JSON schema of custom page
787
962
  *
788
963
  * @returns the app specific JSON schema
@@ -845,7 +1020,15 @@ function generateObjectPageSchemaV4(generateParameters, genericSchema, contextPa
845
1020
  appSchema['definitions'][ux_specification_types_1.DefinitionName.ObjectPageCustomSectionFragment]['properties']['controls'] = {
846
1021
  type: 'object'
847
1022
  };
848
- (0, pageExtenstions_1.resolveFragments)(appSchema, genericMacrosSchema, generateParameters, v4Page.id);
1023
+ try {
1024
+ (0, pageExtensions_1.resolveFragments)(appSchema, genericMacrosSchema, generateParameters, v4Page.id);
1025
+ }
1026
+ catch (error) {
1027
+ (0, extensionLogger_1.log)(generateParameters.logger, {
1028
+ severity: "error" /* LogSeverity.Error */,
1029
+ message: error
1030
+ });
1031
+ }
849
1032
  }
850
1033
  // Add Footer (actions only)
851
1034
  (0, common_1.addFooterActions)(appSchema, generateParameters, ux_specification_types_1.FioriElementsVersion.v4, addFooterActionCallBackV4);