@sapui5/sap.fe.core 1.124.1 → 1.124.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.
- package/package.json +1 -1
- package/src/sap/fe/core/.library +1 -1
- package/src/sap/fe/core/AppStateHandler.js +2 -2
- package/src/sap/fe/core/AppStateHandler.ts +1 -1
- package/src/sap/fe/core/controllerextensions/Routing.js +5 -3
- package/src/sap/fe/core/controllerextensions/Routing.ts +4 -2
- package/src/sap/fe/core/controllerextensions/SideEffects.js +35 -29
- package/src/sap/fe/core/controllerextensions/SideEffects.ts +53 -37
- package/src/sap/fe/core/controllerextensions/messageHandler/messageHandling.js +3 -2
- package/src/sap/fe/core/controllerextensions/messageHandler/messageHandling.ts +2 -1
- package/src/sap/fe/core/converters/annotations/DataField.js +36 -13
- package/src/sap/fe/core/converters/annotations/DataField.ts +50 -14
- package/src/sap/fe/core/converters/controls/ListReport/FilterBar.js +1 -1
- package/src/sap/fe/core/converters/controls/ListReport/FilterBar.ts +2 -0
- package/src/sap/fe/core/fpm/manifest.json +1 -1
- package/src/sap/fe/core/helpers/BindingToolkit.js +17 -5
- package/src/sap/fe/core/helpers/BindingToolkit.ts +8 -1
- package/src/sap/fe/core/library.js +1 -1
- package/src/sap/fe/core/services/RoutingServiceFactory.js +2 -2
- package/src/sap/fe/core/services/RoutingServiceFactory.ts +8 -1
- package/src/sap/fe/core/templating/UIFormatters.js +17 -9
- package/src/sap/fe/core/templating/UIFormatters.ts +26 -14
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Log from "sap/base/Log";
|
|
2
2
|
import type { FEView } from "sap/fe/core/BaseController";
|
|
3
|
+
import { getInvolvedDataModelObjectsForTargetPath } from "sap/fe/core/converters/MetaModelConverter";
|
|
3
4
|
import { getResourceModel } from "sap/fe/core/helpers/ResourceModelHelper";
|
|
4
5
|
import type {
|
|
5
6
|
ControlSideEffectsType,
|
|
@@ -11,13 +12,13 @@ import type {
|
|
|
11
12
|
import Button from "sap/m/Button";
|
|
12
13
|
import Dialog from "sap/m/Dialog";
|
|
13
14
|
import MessageToast from "sap/m/MessageToast";
|
|
15
|
+
import type { RadioButtonGroup$SelectEvent } from "sap/m/RadioButtonGroup";
|
|
14
16
|
import Text from "sap/m/Text";
|
|
15
17
|
import type UI5Event from "sap/ui/base/Event";
|
|
16
18
|
import type Control from "sap/ui/core/Control";
|
|
17
19
|
import type { Control$ValidateFieldGroupEvent } from "sap/ui/core/Control";
|
|
18
20
|
import ControllerExtension from "sap/ui/core/mvc/ControllerExtension";
|
|
19
21
|
import OverrideExecution from "sap/ui/core/mvc/OverrideExecution";
|
|
20
|
-
import type Field from "sap/ui/mdc/Field";
|
|
21
22
|
import type { Field$ChangeEvent } from "sap/ui/mdc/Field";
|
|
22
23
|
import type { MultiValueField$ChangeEvent } from "sap/ui/mdc/MultiValueField";
|
|
23
24
|
import type Context from "sap/ui/model/odata/v4/Context";
|
|
@@ -25,9 +26,13 @@ import type ODataContextBinding from "sap/ui/model/odata/v4/ODataContextBinding"
|
|
|
25
26
|
import type ODataListBinding from "sap/ui/model/odata/v4/ODataListBinding";
|
|
26
27
|
import CommonUtils from "../CommonUtils";
|
|
27
28
|
import type PageController from "../PageController";
|
|
28
|
-
import type {
|
|
29
|
+
import type { EnhanceWithUI5 } from "../helpers/ClassSupport";
|
|
29
30
|
import { defineUI5Class, extensible, finalExtension, methodOverride, privateExtension, publicExtension } from "../helpers/ClassSupport";
|
|
30
31
|
|
|
32
|
+
import type { EntitySet, NavigationProperty } from "@sap-ux/vocabularies-types";
|
|
33
|
+
import Component from "sap/ui/core/Component";
|
|
34
|
+
import type TemplateComponent from "../TemplateComponent";
|
|
35
|
+
|
|
31
36
|
type BaseSideEffectPropertyType = {
|
|
32
37
|
name: string;
|
|
33
38
|
immediate?: boolean;
|
|
@@ -56,6 +61,8 @@ class SideEffectsControllerExtension extends ControllerExtension {
|
|
|
56
61
|
|
|
57
62
|
private _view!: FEView;
|
|
58
63
|
|
|
64
|
+
private _pageComponent: EnhanceWithUI5<TemplateComponent> | undefined;
|
|
65
|
+
|
|
59
66
|
private _registeredFieldGroupMap!: Record<string, FieldGroupSideEffectType>;
|
|
60
67
|
|
|
61
68
|
private _fieldGroupInvalidity!: Record<string, Record<string, boolean>>;
|
|
@@ -69,6 +76,8 @@ class SideEffectsControllerExtension extends ControllerExtension {
|
|
|
69
76
|
@methodOverride()
|
|
70
77
|
onInit(): void {
|
|
71
78
|
this._view = this.base.getView();
|
|
79
|
+
this._pageComponent = Component.getOwnerComponentFor(this._view) as EnhanceWithUI5<TemplateComponent> | undefined;
|
|
80
|
+
|
|
72
81
|
this._sideEffectsService = CommonUtils.getAppComponent(this._view).getSideEffectsService();
|
|
73
82
|
this._registeredFieldGroupMap = {};
|
|
74
83
|
this._fieldGroupInvalidity = {};
|
|
@@ -148,38 +157,45 @@ class SideEffectsControllerExtension extends ControllerExtension {
|
|
|
148
157
|
@finalExtension()
|
|
149
158
|
getFieldSideEffectsMap(field: Control): FieldSideEffectDictionary {
|
|
150
159
|
let sideEffectsMap: FieldSideEffectDictionary = {};
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
160
|
+
if (this._pageComponent) {
|
|
161
|
+
const entitySet = this._pageComponent.getEntitySet?.();
|
|
162
|
+
const contextPath = this._pageComponent.getContextPath?.() || (entitySet && `/${entitySet}`);
|
|
163
|
+
|
|
164
|
+
if (contextPath) {
|
|
165
|
+
const fieldGroupIds = field.getFieldGroupIds(),
|
|
166
|
+
contextDataModelObject = getInvolvedDataModelObjectsForTargetPath<EntitySet | NavigationProperty>(
|
|
167
|
+
contextPath,
|
|
168
|
+
this._view.getModel().getMetaModel()
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
// SideEffects coming from an OData Service
|
|
172
|
+
sideEffectsMap = this.getSideEffectsMapForFieldGroups(
|
|
173
|
+
fieldGroupIds,
|
|
174
|
+
field.getBindingContext() as Context | null | undefined
|
|
175
|
+
) as FieldSideEffectDictionary;
|
|
176
|
+
|
|
177
|
+
// SideEffects coming from control(s)
|
|
178
|
+
if (contextDataModelObject) {
|
|
179
|
+
const viewEntityType = contextDataModelObject.targetEntityType.fullyQualifiedName,
|
|
180
|
+
fieldPath = this.getTargetProperty(field),
|
|
181
|
+
context = this.getContextForSideEffects(field.getBindingContext() as Context, viewEntityType);
|
|
182
|
+
|
|
183
|
+
if (fieldPath && context) {
|
|
184
|
+
const controlSideEffectsEntityType = this._sideEffectsService.getControlEntitySideEffects(viewEntityType);
|
|
185
|
+
Object.keys(controlSideEffectsEntityType).forEach((sideEffectsName) => {
|
|
186
|
+
const oControlSideEffects = controlSideEffectsEntityType[sideEffectsName];
|
|
187
|
+
if (oControlSideEffects.sourceProperties.includes(fieldPath)) {
|
|
188
|
+
const name = `${sideEffectsName}::${viewEntityType}`;
|
|
189
|
+
sideEffectsMap[name] = {
|
|
190
|
+
name: name,
|
|
191
|
+
immediate: true,
|
|
192
|
+
sideEffects: oControlSideEffects,
|
|
193
|
+
context: context
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
});
|
|
181
197
|
}
|
|
182
|
-
}
|
|
198
|
+
}
|
|
183
199
|
}
|
|
184
200
|
}
|
|
185
201
|
return sideEffectsMap;
|
|
@@ -267,11 +283,11 @@ class SideEffectsControllerExtension extends ControllerExtension {
|
|
|
267
283
|
@publicExtension()
|
|
268
284
|
@finalExtension()
|
|
269
285
|
prepareDeferredSideEffectsForField(
|
|
270
|
-
event: Field$ChangeEvent | MultiValueField$ChangeEvent,
|
|
286
|
+
event: Field$ChangeEvent | MultiValueField$ChangeEvent | RadioButtonGroup$SelectEvent,
|
|
271
287
|
fieldValidity: boolean,
|
|
272
288
|
fieldGroupPreRequisite?: Promise<unknown>
|
|
273
289
|
): void {
|
|
274
|
-
const field = (event as UI5Event<{},
|
|
290
|
+
const field = (event as UI5Event<{}, Control>).getSource();
|
|
275
291
|
this._saveFieldPropertiesStatus(field, fieldValidity);
|
|
276
292
|
if (!fieldValidity) {
|
|
277
293
|
return;
|
|
@@ -302,12 +318,12 @@ class SideEffectsControllerExtension extends ControllerExtension {
|
|
|
302
318
|
@publicExtension()
|
|
303
319
|
@finalExtension()
|
|
304
320
|
async handleFieldChange(
|
|
305
|
-
event: Field$ChangeEvent,
|
|
321
|
+
event: Field$ChangeEvent | MultiValueField$ChangeEvent | RadioButtonGroup$SelectEvent,
|
|
306
322
|
fieldValidity: boolean,
|
|
307
323
|
fieldGroupPreRequisite?: Promise<unknown>,
|
|
308
324
|
skipDeferredRegistration = false
|
|
309
325
|
): Promise<void> {
|
|
310
|
-
const field = event.getSource()
|
|
326
|
+
const field = (event as UI5Event<{}, Control>).getSource();
|
|
311
327
|
if (!skipDeferredRegistration) {
|
|
312
328
|
this.prepareDeferredSideEffectsForField(event, fieldValidity, fieldGroupPreRequisite);
|
|
313
329
|
} else {
|