@sapui5/sap.fe.core 1.92.0 → 1.93.3

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 (84) hide show
  1. package/package.json +2 -3
  2. package/src/sap/fe/core/.library +1 -1
  3. package/src/sap/fe/core/AnnotationHelper.js +2 -2
  4. package/src/sap/fe/core/AppComponent.js +21 -1
  5. package/src/sap/fe/core/CommonUtils.js +130 -48
  6. package/src/sap/fe/core/ExtensionAPI.js +238 -226
  7. package/src/sap/fe/core/PageController.js +5 -2
  8. package/src/sap/fe/core/TemplateComponent.js +1 -0
  9. package/src/sap/fe/core/TransactionHelper.js +35 -8
  10. package/src/sap/fe/core/actions/draft.js +1 -1
  11. package/src/sap/fe/core/actions/messageHandling.js +18 -6
  12. package/src/sap/fe/core/actions/operations.js +17 -41
  13. package/src/sap/fe/core/controllerextensions/EditFlow.js +127 -43
  14. package/src/sap/fe/core/controllerextensions/InternalRouting.js +11 -11
  15. package/src/sap/fe/core/controllerextensions/KPIManagement.js +417 -0
  16. package/src/sap/fe/core/controllerextensions/KPIManagement.ts +399 -0
  17. package/src/sap/fe/core/controllerextensions/PageReady.js +2 -3
  18. package/src/sap/fe/core/controllerextensions/PageReady.ts +1 -1
  19. package/src/sap/fe/core/controllerextensions/Share.js +102 -66
  20. package/src/sap/fe/core/controllerextensions/SideEffects.js +60 -14
  21. package/src/sap/fe/core/controllerextensions/SideEffects.ts +53 -12
  22. package/src/sap/fe/core/controllerextensions/ViewState.js +18 -18
  23. package/src/sap/fe/core/controls/filterbar/FilterContainer.js +13 -0
  24. package/src/sap/fe/core/controls/filterbar/VisualFilter.js +68 -2
  25. package/src/sap/fe/core/converters/ConverterContext.js +15 -1
  26. package/src/sap/fe/core/converters/ConverterContext.ts +11 -0
  27. package/src/sap/fe/core/converters/ManifestSettings.js +1 -1
  28. package/src/sap/fe/core/converters/ManifestSettings.ts +14 -2
  29. package/src/sap/fe/core/converters/ManifestWrapper.js +14 -14
  30. package/src/sap/fe/core/converters/ManifestWrapper.ts +13 -12
  31. package/src/sap/fe/core/converters/MetaModelConverter.js +32 -2
  32. package/src/sap/fe/core/converters/MetaModelConverter.ts +39 -2
  33. package/src/sap/fe/core/converters/annotations/DataField.js +10 -6
  34. package/src/sap/fe/core/converters/annotations/DataField.ts +9 -5
  35. package/src/sap/fe/core/converters/common/AnnotationConverter.js +14 -4
  36. package/src/sap/fe/core/converters/controls/Common/Action.js +25 -15
  37. package/src/sap/fe/core/converters/controls/Common/Action.ts +33 -19
  38. package/src/sap/fe/core/converters/controls/Common/Criticality.js +50 -0
  39. package/src/sap/fe/core/converters/controls/Common/Criticality.ts +33 -0
  40. package/src/sap/fe/core/converters/controls/Common/Form.js +2 -3
  41. package/src/sap/fe/core/converters/controls/Common/Form.ts +1 -2
  42. package/src/sap/fe/core/converters/controls/Common/KPI.js +181 -0
  43. package/src/sap/fe/core/converters/controls/Common/KPI.ts +220 -0
  44. package/src/sap/fe/core/converters/controls/Common/Table.js +121 -59
  45. package/src/sap/fe/core/converters/controls/Common/Table.ts +130 -62
  46. package/src/sap/fe/core/converters/controls/ObjectPage/HeaderFacet.js +5 -4
  47. package/src/sap/fe/core/converters/controls/ObjectPage/HeaderFacet.ts +9 -3
  48. package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.js +62 -7
  49. package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.ts +58 -6
  50. package/src/sap/fe/core/converters/helpers/Aggregation.js +86 -11
  51. package/src/sap/fe/core/converters/helpers/Aggregation.ts +79 -8
  52. package/src/sap/fe/core/converters/helpers/BindingHelper.js +44 -2
  53. package/src/sap/fe/core/converters/helpers/BindingHelper.ts +43 -2
  54. package/src/sap/fe/core/converters/helpers/ID.js +3 -1
  55. package/src/sap/fe/core/converters/helpers/ID.ts +1 -0
  56. package/src/sap/fe/core/converters/helpers/IssueManager.js +8 -2
  57. package/src/sap/fe/core/converters/helpers/IssueManager.ts +7 -1
  58. package/src/sap/fe/core/converters/helpers/SelectionVariantHelper.js +93 -0
  59. package/src/sap/fe/core/converters/helpers/SelectionVariantHelper.ts +92 -0
  60. package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.js +102 -23
  61. package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.ts +111 -17
  62. package/src/sap/fe/core/converters/templates/ListReportConverter.js +44 -5
  63. package/src/sap/fe/core/converters/templates/ListReportConverter.ts +39 -2
  64. package/src/sap/fe/core/converters/templates/ObjectPageConverter.js +41 -30
  65. package/src/sap/fe/core/converters/templates/ObjectPageConverter.ts +47 -30
  66. package/src/sap/fe/core/designtime/AppComponent.designtime.js +4 -1
  67. package/src/sap/fe/core/formatters/CriticalityFormatter.js +77 -0
  68. package/src/sap/fe/core/formatters/CriticalityFormatter.ts +58 -0
  69. package/src/sap/fe/core/formatters/KPIFormatter.js +103 -0
  70. package/src/sap/fe/core/formatters/KPIFormatter.ts +88 -0
  71. package/src/sap/fe/core/fpm/manifest.json +1 -3
  72. package/src/sap/fe/core/helpers/BindingExpression.js +161 -97
  73. package/src/sap/fe/core/helpers/BindingExpression.ts +188 -117
  74. package/src/sap/fe/core/library.js +1 -1
  75. package/src/sap/fe/core/messagebundle.properties +45 -1
  76. package/src/sap/fe/core/services/AsyncComponentServiceFactory.js +3 -1
  77. package/src/sap/fe/core/services/AsyncComponentServiceFactory.ts +3 -0
  78. package/src/sap/fe/core/services/RoutingServiceFactory.js +30 -8
  79. package/src/sap/fe/core/services/SideEffectsServiceFactory.js +16 -4
  80. package/src/sap/fe/core/services/SideEffectsServiceFactory.ts +13 -3
  81. package/src/sap/fe/core/templating/DataModelPathHelper.js +7 -3
  82. package/src/sap/fe/core/templating/DataModelPathHelper.ts +7 -2
  83. package/src/sap/fe/core/templating/UIFormatters.js +1 -5
  84. package/src/sap/fe/core/templating/UIFormatters.ts +0 -3
@@ -1,22 +1,23 @@
1
1
  import { ActionType } from "../ManifestSettings";
2
2
  import { EntityType } from "@sap-ux/annotation-converter";
3
3
  import { AnnotationAction, BaseAction, ButtonType, getSemanticObjectMapping } from "sap/fe/core/converters/controls/Common/Action";
4
- import { DataFieldForActionTypes, DataFieldForIntentBasedNavigationTypes } from "@sap-ux/vocabularies-types";
4
+ import { DataFieldForActionTypes, DataFieldForIntentBasedNavigationTypes, PropertyAnnotationValue } from "@sap-ux/vocabularies-types";
5
5
  import { Placement } from "sap/fe/core/converters/helpers/ConfigurableObject";
6
- import { annotationExpression, compileBinding, not, equal, fn } from "sap/fe/core/helpers/BindingExpression";
6
+ import { annotationExpression, compileBinding, not, equal, fn, Expression, and, ifElse } from "sap/fe/core/helpers/BindingExpression";
7
7
  import { KeyHelper } from "sap/fe/core/converters/helpers/Key";
8
8
  import { isPathDeletable } from "sap/fe/core/templating/DataModelPathHelper";
9
9
  import ConverterContext from "../ConverterContext";
10
+ import { Draft, singletonPathVisitor, UI } from "../helpers/BindingHelper";
10
11
 
11
12
  /**
12
- * Retrieve all the data field for actions for the identification annotation
13
+ * Retrieves all the data field for actions for the identification annotation
13
14
  * They must be
14
15
  * - Not statically hidden
15
- * - Either linked to an Unbound action or to an action which has an OperationAvailable not statically false.
16
+ * - Either linked to an Unbound action or to an action which has an OperationAvailable that is not set to false statically.
16
17
  *
17
- * @param {EntityType} entityType The current entitytype
18
- * @param {boolean} bDetermining Whether or not the action should be determining
19
- * @returns {DataFieldForActionTypes[]} An array of DataField for action respecting the bDetermining property
18
+ * @param {EntityType} entityType The current entity type
19
+ * @param {boolean} bDetermining The flag which denotes whether or not the action is a determining action
20
+ * @returns {DataFieldForActionTypes[]} An array of DataField for action respecting the input parameter 'bDetermining'
20
21
  */
21
22
  export function getIdentificationDataFieldForActions(entityType: EntityType, bDetermining: boolean): DataFieldForActionTypes[] {
22
23
  return (entityType.annotations?.UI?.Identification?.filter(identificationDataField => {
@@ -63,17 +64,95 @@ const IMPORTANT_CRITICALITIES = [
63
64
  "UI.CriticalityType/Negative",
64
65
  "UI.CriticalityType/VeryNegative"
65
66
  ];
67
+
68
+ /**
69
+ * Method to determine the 'visible' property binding for the Delete button on an object page.
70
+ *
71
+ * @param {ConverterContext} converterContext Instance of the converter context.
72
+ * @param {PropertyAnnotationValue<boolean> | undefined} deleteHidden The value of the UI.DeleteHidden annotation on the entity set / type.
73
+ * @returns {Expression<boolean>} The binding expression for the 'visible' property of the Delete button.
74
+ */
75
+ export function getDeleteButtonVisibility(
76
+ converterContext: ConverterContext,
77
+ deleteHidden: PropertyAnnotationValue<boolean> | undefined
78
+ ): Expression<boolean> {
79
+ const dataModelObjectPath = converterContext.getDataModelObjectPath(),
80
+ visitedNavigationPaths = dataModelObjectPath.navigationProperties.map(navProp => navProp.name),
81
+ // Set absolute binding path for Singleton references, otherwise the configured annotation path itself.
82
+ // For e.g. /com.sap.namespace.EntityContainer/Singleton/Property to /Singleton/Property
83
+ deleteHiddenExpression: Expression<boolean | undefined> = annotationExpression(
84
+ deleteHidden,
85
+ visitedNavigationPaths,
86
+ undefined,
87
+ (path: string) => singletonPathVisitor(path, converterContext, visitedNavigationPaths)
88
+ ),
89
+ manifestWrapper = converterContext.getManifestWrapper(),
90
+ viewLevel = manifestWrapper.getViewLevel(),
91
+ // Delete button is visible
92
+ // In OP --> when not in edit mode
93
+ // In sub-OP --> when in edit mode
94
+ editableExpression: Expression<boolean> = viewLevel > 1 ? UI.IsEditable : not(UI.IsEditable);
95
+
96
+ // If UI.DeleteHidden annotation on entity set or type is either not defined or explicitly set to false,
97
+ // Delete button is visible based on editableExpression.
98
+ // else,
99
+ // Delete button is visible based on both annotation path and editableExpression.
100
+ return ifElse(
101
+ deleteHidden === undefined || deleteHidden.valueOf() === false,
102
+ editableExpression,
103
+ and(editableExpression, equal(deleteHiddenExpression, false))
104
+ );
105
+ }
106
+
107
+ /**
108
+ * Method to determine the 'visible' property binding for the Edit button on an object page.
109
+ *
110
+ * @param {ConverterContext} converterContext Instance of the converter context.
111
+ * @param {PropertyAnnotationValue<boolean> | undefined} updateHidden The value of the UI.UpdateHidden annotation on the entity set / type.
112
+ * @returns {Expression<boolean>} The binding expression for the 'visible' property of the Edit button.
113
+ */
114
+ export function getEditButtonVisibility(
115
+ converterContext: ConverterContext,
116
+ updateHidden: PropertyAnnotationValue<boolean> | undefined
117
+ ): Expression<boolean> {
118
+ const entitySet = converterContext.getEntitySet(),
119
+ bIsDraftRoot = entitySet && entitySet.annotations.Common?.DraftRoot ? true : false,
120
+ dataModelObjectPath = converterContext.getDataModelObjectPath(),
121
+ visitedNavigationPaths = dataModelObjectPath.navigationProperties.map(navProp => navProp.name),
122
+ // Set absolute binding path for Singleton references, otherwise the configured annotation path itself.
123
+ // For e.g. /com.sap.namespace.EntityContainer/Singleton/Property to /Singleton/Property
124
+ updateHiddenExpression: Expression<boolean | undefined> = annotationExpression(
125
+ updateHidden,
126
+ visitedNavigationPaths,
127
+ undefined,
128
+ (path: string) => singletonPathVisitor(path, converterContext, visitedNavigationPaths)
129
+ ),
130
+ notEditableExpression: Expression<boolean> = not(UI.IsEditable);
131
+
132
+ // If UI.UpdateHidden annotation on entity set or type is either not defined or explicitly set to false,
133
+ // Edit button is visible in display mode.
134
+ // else,
135
+ // Edit button is visible based on both annotation path and in display mode.
136
+ const resultantExpression: Expression<boolean> = ifElse(
137
+ updateHidden === undefined || updateHidden.valueOf() === false,
138
+ notEditableExpression,
139
+ and(notEditableExpression, equal(updateHiddenExpression, false))
140
+ );
141
+
142
+ return ifElse(bIsDraftRoot, and(resultantExpression, Draft.HasNoDraftForCurrentUser), resultantExpression);
143
+ }
144
+
66
145
  export function getHeaderDefaultActions(converterContext: ConverterContext): BaseAction[] {
67
- const entitySet = converterContext.getEntitySet();
68
- const oStickySessionSupported = entitySet && entitySet.annotations?.Session?.StickySessionSupported, //for sticky app
146
+ const entitySet = converterContext.getEntitySet(),
147
+ entityType = converterContext.getEntityType(),
148
+ oStickySessionSupported = entitySet && entitySet.annotations?.Session?.StickySessionSupported, //for sticky app
69
149
  oDraftRoot = entitySet && entitySet.annotations.Common?.DraftRoot,
70
150
  oEntityDeleteRestrictions = entitySet && entitySet.annotations?.Capabilities?.DeleteRestrictions,
71
- bUpdateHidden = entitySet && entitySet.annotations.UI?.UpdateHidden?.valueOf();
72
- const oDataModelObjectPath = converterContext.getDataModelObjectPath(),
73
- isParentDeletable = isPathDeletable(oDataModelObjectPath),
74
- bParentEntitySetDeletable = isParentDeletable ? compileBinding(isParentDeletable) : isParentDeletable;
75
-
76
- const headerDataFieldForActions = getIdentificationDataFieldForActions(converterContext.getEntityType(), false);
151
+ bUpdateHidden = entitySet && entitySet.annotations.UI?.UpdateHidden?.valueOf(),
152
+ dataModelObjectPath = converterContext.getDataModelObjectPath(),
153
+ isParentDeletable = isPathDeletable(dataModelObjectPath),
154
+ bParentEntitySetDeletable = isParentDeletable ? compileBinding(isParentDeletable) : isParentDeletable,
155
+ headerDataFieldForActions = getIdentificationDataFieldForActions(converterContext.getEntityType(), false);
77
156
 
78
157
  // First add the "Critical" DataFieldForActions
79
158
  const headerActions: BaseAction[] = headerDataFieldForActions
@@ -92,14 +171,29 @@ export function getHeaderDefaultActions(converterContext: ConverterContext): Bas
92
171
 
93
172
  // Then the edit action if it exists
94
173
  if ((oDraftRoot?.EditAction || oStickySessionSupported?.EditAction) && bUpdateHidden !== true) {
95
- headerActions.push({ type: ActionType.Primary, key: "EditAction" });
174
+ const updateHidden = (entitySet?.annotations.UI?.UpdateHidden?.valueOf() !== undefined
175
+ ? entitySet?.annotations.UI?.UpdateHidden
176
+ : entityType?.annotations.UI?.UpdateHidden) as PropertyAnnotationValue<boolean>;
177
+ headerActions.push({
178
+ type: ActionType.Primary,
179
+ key: "EditAction",
180
+ visible: compileBinding(getEditButtonVisibility(converterContext, updateHidden))
181
+ });
96
182
  }
97
183
  // Then the delete action if we're not statically not deletable
98
184
  if (
99
185
  (bParentEntitySetDeletable && bParentEntitySetDeletable !== "false") ||
100
186
  (oEntityDeleteRestrictions?.Deletable?.valueOf() !== false && bParentEntitySetDeletable !== "false")
101
187
  ) {
102
- headerActions.push({ type: ActionType.Secondary, key: "DeleteAction", parentEntityDeleteEnabled: bParentEntitySetDeletable });
188
+ const deleteHidden = (entitySet?.annotations.UI?.DeleteHidden?.valueOf() !== undefined
189
+ ? entitySet?.annotations.UI?.DeleteHidden
190
+ : entityType?.annotations.UI?.DeleteHidden) as PropertyAnnotationValue<boolean>;
191
+ headerActions.push({
192
+ type: ActionType.Secondary,
193
+ key: "DeleteAction",
194
+ visible: compileBinding(getDeleteButtonVisibility(converterContext, deleteHidden)),
195
+ parentEntityDeleteEnabled: bParentEntitySetDeletable
196
+ });
103
197
  }
104
198
 
105
199
  if (oDraftRoot?.EditAction && bUpdateHidden !== true) {