@sapui5/sap.fe.templates 1.141.2 → 1.143.0
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/templates/.library +1 -1
- package/src/sap/fe/templates/AnalyticalListPage/manifest.json +2 -2
- package/src/sap/fe/templates/ListReport/ExtensionAPI.js +1 -1
- package/src/sap/fe/templates/ListReport/ExtensionAPI.ts +1 -1
- package/src/sap/fe/templates/ListReport/LRMessageStrip.js +4 -1
- package/src/sap/fe/templates/ListReport/LRMessageStrip.ts +3 -0
- package/src/sap/fe/templates/ListReport/ListReport.view.xml +10 -12
- package/src/sap/fe/templates/ListReport/ListReportController.controller.js +95 -60
- package/src/sap/fe/templates/ListReport/ListReportController.controller.ts +93 -54
- package/src/sap/fe/templates/ListReport/controls/MultipleModeControl.js +3 -2
- package/src/sap/fe/templates/ListReport/controls/MultipleModeControl.ts +2 -1
- package/src/sap/fe/templates/ListReport/manifest.json +2 -2
- package/src/sap/fe/templates/ListReport/overrides/MessageHandler.js +25 -0
- package/src/sap/fe/templates/ListReport/overrides/MessageHandler.ts +20 -0
- package/src/sap/fe/templates/ObjectPage/ExtensionAPI.js +180 -13
- package/src/sap/fe/templates/ObjectPage/ExtensionAPI.ts +209 -13
- package/src/sap/fe/templates/ObjectPage/ObjectPage.view.xml +4 -0
- package/src/sap/fe/templates/ObjectPage/ObjectPageController.controller.js +157 -28
- package/src/sap/fe/templates/ObjectPage/ObjectPageController.controller.ts +200 -30
- package/src/sap/fe/templates/ObjectPage/ObjectPageTemplating.js +3 -2
- package/src/sap/fe/templates/ObjectPage/ObjectPageTemplating.ts +2 -1
- package/src/sap/fe/templates/ObjectPage/manifest.json +2 -2
- package/src/sap/fe/templates/ObjectPage/view/fragments/Actions.fragment.xml +7 -4
- package/src/sap/fe/templates/ObjectPage/view/fragments/Heading.fragment.xml +2 -2
- package/src/sap/fe/templates/library.js +1 -1
- package/src/sap/fe/templates/messagebundle.properties +8 -7
- package/src/sap/fe/templates/messagebundle_ar.properties +5 -5
- package/src/sap/fe/templates/messagebundle_bg.properties +6 -6
- package/src/sap/fe/templates/messagebundle_ca.properties +4 -4
- package/src/sap/fe/templates/messagebundle_cnr.properties +5 -5
- package/src/sap/fe/templates/messagebundle_cs.properties +6 -6
- package/src/sap/fe/templates/messagebundle_cy.properties +5 -5
- package/src/sap/fe/templates/messagebundle_da.properties +6 -6
- package/src/sap/fe/templates/messagebundle_de.properties +7 -7
- package/src/sap/fe/templates/messagebundle_el.properties +5 -5
- package/src/sap/fe/templates/messagebundle_en.properties +6 -6
- package/src/sap/fe/templates/messagebundle_en_GB.properties +6 -6
- package/src/sap/fe/templates/messagebundle_en_US_saprigi.properties +6 -6
- package/src/sap/fe/templates/messagebundle_es.properties +4 -4
- package/src/sap/fe/templates/messagebundle_es_MX.properties +4 -4
- package/src/sap/fe/templates/messagebundle_et.properties +4 -4
- package/src/sap/fe/templates/messagebundle_fi.properties +4 -4
- package/src/sap/fe/templates/messagebundle_fr.properties +4 -4
- package/src/sap/fe/templates/messagebundle_fr_CA.properties +5 -5
- package/src/sap/fe/templates/messagebundle_hi.properties +6 -6
- package/src/sap/fe/templates/messagebundle_hr.properties +4 -4
- package/src/sap/fe/templates/messagebundle_hu.properties +6 -6
- package/src/sap/fe/templates/messagebundle_id.properties +7 -7
- package/src/sap/fe/templates/messagebundle_it.properties +4 -4
- package/src/sap/fe/templates/messagebundle_iw.properties +6 -6
- package/src/sap/fe/templates/messagebundle_ja.properties +4 -4
- package/src/sap/fe/templates/messagebundle_kk.properties +4 -4
- package/src/sap/fe/templates/messagebundle_ko.properties +4 -4
- package/src/sap/fe/templates/messagebundle_lt.properties +4 -4
- package/src/sap/fe/templates/messagebundle_lv.properties +6 -6
- package/src/sap/fe/templates/messagebundle_mk.properties +4 -4
- package/src/sap/fe/templates/messagebundle_ms.properties +5 -5
- package/src/sap/fe/templates/messagebundle_nl.properties +4 -4
- package/src/sap/fe/templates/messagebundle_no.properties +4 -4
- package/src/sap/fe/templates/messagebundle_pl.properties +4 -4
- package/src/sap/fe/templates/messagebundle_pt.properties +5 -5
- package/src/sap/fe/templates/messagebundle_pt_PT.properties +6 -6
- package/src/sap/fe/templates/messagebundle_ro.properties +4 -4
- package/src/sap/fe/templates/messagebundle_ru.properties +4 -4
- package/src/sap/fe/templates/messagebundle_sh.properties +5 -5
- package/src/sap/fe/templates/messagebundle_sk.properties +4 -4
- package/src/sap/fe/templates/messagebundle_sl.properties +11 -11
- package/src/sap/fe/templates/messagebundle_sr.properties +5 -5
- package/src/sap/fe/templates/messagebundle_sv.properties +4 -4
- package/src/sap/fe/templates/messagebundle_th.properties +4 -4
- package/src/sap/fe/templates/messagebundle_tr.properties +4 -4
- package/src/sap/fe/templates/messagebundle_uk.properties +4 -4
- package/src/sap/fe/templates/messagebundle_vi.properties +6 -6
- package/src/sap/fe/templates/messagebundle_zh_CN.properties +4 -4
- package/src/sap/fe/templates/messagebundle_zh_TW.properties +4 -4
- package/src/sap/fe/templates/types/sap.fe.templates-auto-ext.d.js +10 -0
- package/src/sap/fe/templates/types/sap.fe.templates-auto-ext.d.ts +49 -0
- package/ui5.yaml +5 -0
|
@@ -4,6 +4,7 @@ import merge from "sap/base/util/merge";
|
|
|
4
4
|
import type { EnhanceWithUI5 } from "sap/fe/base/ClassSupport";
|
|
5
5
|
import { defineUI5Class, extensible, finalExtension, publicExtension, usingExtension } from "sap/fe/base/ClassSupport";
|
|
6
6
|
import ActionRuntime from "sap/fe/core/ActionRuntime";
|
|
7
|
+
import type { StartupParameters } from "sap/fe/core/AppComponent";
|
|
7
8
|
import type { FEView } from "sap/fe/core/BaseController";
|
|
8
9
|
import CommonUtils from "sap/fe/core/CommonUtils";
|
|
9
10
|
import PageController from "sap/fe/core/PageController";
|
|
@@ -72,6 +73,7 @@ import type Chart from "sap/ui/mdc/Chart";
|
|
|
72
73
|
import type Table from "sap/ui/mdc/Table";
|
|
73
74
|
import type TableTypeBase from "sap/ui/mdc/table/TableTypeBase";
|
|
74
75
|
import type Binding from "sap/ui/model/Binding";
|
|
76
|
+
import type CompositeBinding from "sap/ui/model/CompositeBinding";
|
|
75
77
|
import type Context from "sap/ui/model/Context";
|
|
76
78
|
import type ListBinding from "sap/ui/model/ListBinding";
|
|
77
79
|
import type JSONModel from "sap/ui/model/json/JSONModel";
|
|
@@ -102,7 +104,11 @@ export type BindingParams = {
|
|
|
102
104
|
};
|
|
103
105
|
|
|
104
106
|
const ProgrammingModel = FELibrary.ProgrammingModel;
|
|
107
|
+
const PreferredActionStatus = FELibrary.PreferredActionStatusType;
|
|
105
108
|
|
|
109
|
+
/**
|
|
110
|
+
* @public
|
|
111
|
+
*/
|
|
106
112
|
@defineUI5Class("sap.fe.templates.ObjectPage.ObjectPageController")
|
|
107
113
|
class ObjectPageController extends PageController {
|
|
108
114
|
oView!: FEView;
|
|
@@ -158,7 +164,7 @@ class ObjectPageController extends PageController {
|
|
|
158
164
|
|
|
159
165
|
private bSectionNavigated?: boolean;
|
|
160
166
|
|
|
161
|
-
private
|
|
167
|
+
private invalidateTitleHierarchyCacheSetUp = false;
|
|
162
168
|
|
|
163
169
|
private switchDraftAndActivePopOver?: Popover;
|
|
164
170
|
|
|
@@ -174,6 +180,8 @@ class ObjectPageController extends PageController {
|
|
|
174
180
|
|
|
175
181
|
private messageBinding?: Binding;
|
|
176
182
|
|
|
183
|
+
private isFirstBinding = true;
|
|
184
|
+
|
|
177
185
|
@publicExtension()
|
|
178
186
|
@finalExtension()
|
|
179
187
|
getExtensionAPI(sId?: string): ExtensionAPI {
|
|
@@ -198,12 +206,17 @@ class ObjectPageController extends PageController {
|
|
|
198
206
|
const oObjectPage = this._getObjectPageLayoutControl();
|
|
199
207
|
|
|
200
208
|
// Setting defaults of internal model context
|
|
201
|
-
const oInternalModelContext = this.
|
|
202
|
-
oInternalModelContext?.setProperty("externalNavigationContext", { page: true });
|
|
203
|
-
oInternalModelContext?.setProperty(
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
209
|
+
const oInternalModelContext = this.getOwnerComponent().getBindingContext("internal") as InternalModelContext;
|
|
210
|
+
oInternalModelContext?.setProperty("externalNavigationContext", { page: true }, undefined, true);
|
|
211
|
+
oInternalModelContext?.setProperty(
|
|
212
|
+
"relatedApps",
|
|
213
|
+
{
|
|
214
|
+
visibility: false,
|
|
215
|
+
items: null
|
|
216
|
+
},
|
|
217
|
+
undefined,
|
|
218
|
+
true
|
|
219
|
+
);
|
|
207
220
|
oInternalModelContext?.setProperty("batchGroups", this._getBatchGroupsForView());
|
|
208
221
|
oInternalModelContext?.setProperty("errorNavigationSectionFlag", false);
|
|
209
222
|
if (oObjectPage.getEnableLazyLoading()) {
|
|
@@ -213,8 +226,10 @@ class ObjectPageController extends PageController {
|
|
|
213
226
|
this.messageButton = this.getView().byId("fe::FooterBar::MessageButton") as MessageButton;
|
|
214
227
|
this.messageBinding = Messaging.getMessageModel().bindList("/");
|
|
215
228
|
this.messageBinding?.attachChange(this._fnShowOPMessage, this);
|
|
216
|
-
oInternalModelContext?.setProperty("rootEditEnabled", true);
|
|
217
|
-
oInternalModelContext?.setProperty("rootEditVisible", true);
|
|
229
|
+
oInternalModelContext?.setProperty("rootEditEnabled", true, undefined, true);
|
|
230
|
+
oInternalModelContext?.setProperty("rootEditVisible", true, undefined, true);
|
|
231
|
+
|
|
232
|
+
this._handleSmartSummaryStartupAction();
|
|
218
233
|
}
|
|
219
234
|
|
|
220
235
|
onExit(): void {
|
|
@@ -316,16 +331,34 @@ class ObjectPageController extends PageController {
|
|
|
316
331
|
* @returns Table if exists
|
|
317
332
|
*/
|
|
318
333
|
private searchTableInBlock(block: SubSectionBlock): Table | undefined {
|
|
319
|
-
const control = block.content;
|
|
320
334
|
let tableAPI: TableAPI | undefined;
|
|
321
|
-
|
|
335
|
+
const getTableAPI = (control: Control): TableAPI | undefined => {
|
|
322
336
|
// The table may currently be shown in a full screen dialog, we can then get the reference to the TableAPI
|
|
323
337
|
// control from the custom data of the place holder panel
|
|
324
338
|
if (control.isA("sap.m.Panel") && control.data("FullScreenTablePlaceHolder")) {
|
|
325
|
-
|
|
339
|
+
return control.data("tableAPIreference");
|
|
326
340
|
} else if (control.isA("sap.fe.macros.table.TableAPI")) {
|
|
327
|
-
|
|
341
|
+
return control as TableAPI;
|
|
328
342
|
}
|
|
343
|
+
};
|
|
344
|
+
if (block.isA("sap.fe.templates.ObjectPage.controls.SubSectionBlock")) {
|
|
345
|
+
const control = block.content;
|
|
346
|
+
if (control.isA("sap.ui.layout.DynamicSideContent")) {
|
|
347
|
+
const mainContent = (control as DynamicSideContent).getMainContent()[0];
|
|
348
|
+
const mainContentTableAPI = getTableAPI(mainContent);
|
|
349
|
+
if (mainContentTableAPI) {
|
|
350
|
+
tableAPI = mainContentTableAPI;
|
|
351
|
+
} else {
|
|
352
|
+
const sideContent = (control as DynamicSideContent).getSideContent()[0];
|
|
353
|
+
const sideContentTableAPI = getTableAPI(sideContent);
|
|
354
|
+
if (sideContentTableAPI) {
|
|
355
|
+
tableAPI = sideContentTableAPI;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
} else {
|
|
359
|
+
tableAPI = getTableAPI(control);
|
|
360
|
+
}
|
|
361
|
+
|
|
329
362
|
if (tableAPI) {
|
|
330
363
|
return tableAPI.content;
|
|
331
364
|
}
|
|
@@ -410,6 +443,28 @@ class ObjectPageController extends PageController {
|
|
|
410
443
|
//Set the Binding for Paginators using ListBinding ID
|
|
411
444
|
this._initializePagination(oContext, oInternalModel, mParameters?.listBinding);
|
|
412
445
|
|
|
446
|
+
const firstSubSectionVisibilityBinding = this._getfirstSubSectionVisibilityBinding();
|
|
447
|
+
|
|
448
|
+
if (
|
|
449
|
+
this.useLazyLoaderOptimizations() &&
|
|
450
|
+
oObjectPage.getEnableLazyLoading() &&
|
|
451
|
+
firstSubSectionVisibilityBinding &&
|
|
452
|
+
this.isFirstBinding
|
|
453
|
+
) {
|
|
454
|
+
// if lazy loading is enabled and at least one subsection has a visibility binding
|
|
455
|
+
oObjectPage.setVisible(false); // The objectPage Visibility is set to false to prevent the lazy loader to compute the sections
|
|
456
|
+
firstSubSectionVisibilityBinding.attachEventOnce("change", async () => {
|
|
457
|
+
const MDCTablePromises = this._getAllBlocks().map(async (block) =>
|
|
458
|
+
block.getVisible() && block.getContent?.()?.isA<TableAPI>("sap.fe.macros.table.TableAPI")
|
|
459
|
+
? (block.getContent() as TableAPI).getContent().initialized()
|
|
460
|
+
: null
|
|
461
|
+
);
|
|
462
|
+
await Promise.all(MDCTablePromises);
|
|
463
|
+
oObjectPage.setVisible(true); // Visibility is restored once the visibility bindings of the sections are resolved, allowing lazy loading to properly process them
|
|
464
|
+
this.isFirstBinding = false;
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
|
|
413
468
|
if (oObjectPage.getEnableLazyLoading()) {
|
|
414
469
|
this._disableBlocksBindings(oObjectPage);
|
|
415
470
|
}
|
|
@@ -424,6 +479,13 @@ class ObjectPageController extends PageController {
|
|
|
424
479
|
}
|
|
425
480
|
}
|
|
426
481
|
|
|
482
|
+
private useLazyLoaderOptimizations(): boolean {
|
|
483
|
+
if (new URLSearchParams(window.location.search).get("sap-ui-xx-lazyloader-optimizations") === "true") {
|
|
484
|
+
return true;
|
|
485
|
+
}
|
|
486
|
+
return false;
|
|
487
|
+
}
|
|
488
|
+
|
|
427
489
|
private getFirstEditableInput(): UI5Element | undefined {
|
|
428
490
|
const domEditableElement = this._getObjectPageLayoutControl()._getFirstEditableInput();
|
|
429
491
|
return domEditableElement ? UI5Element.closestTo(domEditableElement) : undefined;
|
|
@@ -471,22 +533,29 @@ class ObjectPageController extends PageController {
|
|
|
471
533
|
let iSkip = 3; // 3 sections/subsections are loaded initially, the others are loaded lazily
|
|
472
534
|
const bIsInEditMode = CommonUtils.getIsEditable(this.getView());
|
|
473
535
|
const bEditableHeader = this.getView().getViewData().editableHeaderContent;
|
|
536
|
+
const firstVisibilityBinding = this._getfirstSubSectionVisibilityBinding();
|
|
474
537
|
for (let iSection = 0; iSection < aSections.length; iSection++) {
|
|
475
538
|
const oSection = aSections[iSection];
|
|
476
539
|
const aSubSections = oSection.getSubSections();
|
|
477
540
|
for (let iSubSection = 0; iSubSection < aSubSections.length; iSubSection++, iSkip--) {
|
|
478
541
|
// In IconTabBar mode keep the second section bound if there is an editable header and we are switching to display mode
|
|
479
|
-
|
|
542
|
+
|
|
543
|
+
const disableBindingContextCondition =
|
|
544
|
+
(!this.useLazyLoaderOptimizations() &&
|
|
545
|
+
(iSkip < 1 || (bUseIconTabBar && (iSection > 1 || (iSection === 1 && !bEditableHeader && !bIsInEditMode))))) ||
|
|
546
|
+
(this.useLazyLoaderOptimizations() &&
|
|
547
|
+
((!bUseIconTabBar && firstVisibilityBinding) || //if some subsections have visibility binding and we are not in IconTabBar mode
|
|
548
|
+
(!bUseIconTabBar && !firstVisibilityBinding && iSkip < 1) || // if no subsection has visibility binding and we are not in IconTabBar mode
|
|
549
|
+
(bUseIconTabBar && (iSection > 1 || (iSection === 1 && !bEditableHeader && !bIsInEditMode)))));
|
|
550
|
+
if (disableBindingContextCondition) {
|
|
480
551
|
const oSubSection = aSubSections[iSubSection];
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
oSubSection.getActions().forEach((actions) => actions.setBindingContext(null));
|
|
489
|
-
}
|
|
552
|
+
// SubSection's binding is enabled.
|
|
553
|
+
oSubSection.setBindingContext(undefined);
|
|
554
|
+
const blocks = oSubSection.getBlocks() as SubSectionBlock[];
|
|
555
|
+
// SubSection's contents binding is disabled.
|
|
556
|
+
blocks.forEach((block) => block.setBindingContext(null));
|
|
557
|
+
oSubSection.getMoreBlocks().forEach((subBlock) => subBlock.setBindingContext(null));
|
|
558
|
+
oSubSection.getActions().forEach((actions) => actions.setBindingContext(null));
|
|
490
559
|
}
|
|
491
560
|
}
|
|
492
561
|
}
|
|
@@ -587,10 +656,28 @@ class ObjectPageController extends PageController {
|
|
|
587
656
|
oFieldToFocus.focus(focusInfo);
|
|
588
657
|
}
|
|
589
658
|
}.bind(this),
|
|
590
|
-
0
|
|
659
|
+
0 //300
|
|
591
660
|
);
|
|
592
661
|
}
|
|
593
662
|
|
|
663
|
+
/**
|
|
664
|
+
* Get the first sub-section with a visibility bound to the model of the view.
|
|
665
|
+
* Sections with Bindings on internal models only are ignored.
|
|
666
|
+
* @returns The visibility binding of the first sub-section or undefined if not found.
|
|
667
|
+
*/
|
|
668
|
+
_getfirstSubSectionVisibilityBinding(): Binding | undefined {
|
|
669
|
+
const allsubSections = this._getAllSubSections();
|
|
670
|
+
const currentModel = this.getView().getModel();
|
|
671
|
+
return allsubSections
|
|
672
|
+
.find(
|
|
673
|
+
(subSection) =>
|
|
674
|
+
(subSection.getBinding("visible") as CompositeBinding | undefined)
|
|
675
|
+
?.getBindings?.()
|
|
676
|
+
.some((binding) => binding.getModel() === currentModel)
|
|
677
|
+
)
|
|
678
|
+
?.getBinding("visible");
|
|
679
|
+
}
|
|
680
|
+
|
|
594
681
|
_handleSubSectionEnteredViewPort(oEvent: UI5Event<{ subSection: ObjectPageSubSection }>): void {
|
|
595
682
|
const oSubSection = oEvent.getParameter("subSection");
|
|
596
683
|
const blocks = oSubSection.getBlocks() as SubSectionBlock[];
|
|
@@ -776,6 +863,8 @@ class ObjectPageController extends PageController {
|
|
|
776
863
|
|
|
777
864
|
//To Compute the Edit Binding of the subObject page using root object page, create a context for draft root and update the edit button in sub OP using the context
|
|
778
865
|
ActionRuntime.updateEditButtonVisibilityAndEnablement(this.getView());
|
|
866
|
+
|
|
867
|
+
this._updateAvailableCards([]);
|
|
779
868
|
}
|
|
780
869
|
// we are clearing any previous data from recommendations every time we come to new OP
|
|
781
870
|
// so that cached recommendations are not shown to user
|
|
@@ -786,11 +875,10 @@ class ObjectPageController extends PageController {
|
|
|
786
875
|
return;
|
|
787
876
|
});
|
|
788
877
|
}
|
|
789
|
-
this._updateAvailableCards([]);
|
|
790
878
|
this.displayCollaborationMessage(mParameters?.redirectedToNonDraft);
|
|
791
879
|
this._setOPMessageStripInternalContext();
|
|
792
880
|
|
|
793
|
-
const applyAppState = this.getAppComponent().getAppStateHandler().applyAppState(view
|
|
881
|
+
const applyAppState = this.getAppComponent().getAppStateHandler().applyAppState(view);
|
|
794
882
|
this.pageReady.waitFor(applyAppState);
|
|
795
883
|
}
|
|
796
884
|
|
|
@@ -982,11 +1070,12 @@ class ObjectPageController extends PageController {
|
|
|
982
1070
|
const appComponent = this.getAppComponent();
|
|
983
1071
|
const rootViewController = appComponent.getRootViewController();
|
|
984
1072
|
const fnClearCacheTitle = (): void => {
|
|
985
|
-
rootViewController.
|
|
1073
|
+
rootViewController.invalidateTitleHierarchyCache(oObjectPage.getBindingContext()?.getPath() as string);
|
|
986
1074
|
};
|
|
987
|
-
if (oObjectPageSubtitle && !this.
|
|
988
|
-
oObjectPageSubtitle
|
|
989
|
-
this
|
|
1075
|
+
if ((oObjectPageDescription || oObjectPageSubtitle) && !this.invalidateTitleHierarchyCacheSetUp) {
|
|
1076
|
+
oObjectPageSubtitle?.getBinding("value")?.attachChange(fnClearCacheTitle, this);
|
|
1077
|
+
oObjectPageDescription?.getBinding("value")?.attachChange(fnClearCacheTitle, this);
|
|
1078
|
+
this.invalidateTitleHierarchyCacheSetUp = true;
|
|
990
1079
|
}
|
|
991
1080
|
const oObjectPageContext = oObjectPage.getBindingContext();
|
|
992
1081
|
const build = (): { title: string; subtitle: string; intent: string; icon: string; description: string } => ({
|
|
@@ -1650,6 +1739,86 @@ class ObjectPageController extends PageController {
|
|
|
1650
1739
|
}
|
|
1651
1740
|
}
|
|
1652
1741
|
|
|
1742
|
+
_findSummarizeButton(): Button | undefined {
|
|
1743
|
+
const objectPage = this._getObjectPageLayoutControl();
|
|
1744
|
+
const objectPageTitle = objectPage.getHeaderTitle() as ObjectPageDynamicHeaderTitle;
|
|
1745
|
+
const actions = objectPageTitle?.getActions();
|
|
1746
|
+
let summarizeButton: Button | undefined;
|
|
1747
|
+
|
|
1748
|
+
for (const action of actions) {
|
|
1749
|
+
if (action.isA<SummarizationButton>("sap.fe.macros.ai.SummarizationButton")) {
|
|
1750
|
+
const button = action.getContent() as Button | undefined;
|
|
1751
|
+
if (button && button.getId().endsWith("::Summarize::button")) {
|
|
1752
|
+
summarizeButton = button;
|
|
1753
|
+
break;
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
|
|
1758
|
+
return summarizeButton;
|
|
1759
|
+
}
|
|
1760
|
+
|
|
1761
|
+
/**
|
|
1762
|
+
* Evaluates startup parameters and triggers the smart summary action on the Object Page if required.
|
|
1763
|
+
*
|
|
1764
|
+
* This method checks whether the startup parameters indicate that a smart summary should be performed for the current Object Page level.
|
|
1765
|
+
* The level parameter determines which Object Page should be summarized, which is relevant in Flexible Column Layout (FCL) scenarios where
|
|
1766
|
+
* multiple Object Pages may be displayed simultaneously.
|
|
1767
|
+
* If no level is provided in the startup parameters, the method defaults the level to 1.
|
|
1768
|
+
* If the summary action is allowed and the SmartSummarize capability is available, it locates the summarize button and triggers its press event.
|
|
1769
|
+
* The method ensures the summary is only executed once per navigation and logs errors if prerequisites are not met or the button is unavailable.
|
|
1770
|
+
* All errors encountered during the process are caught and logged.
|
|
1771
|
+
* @private
|
|
1772
|
+
*/
|
|
1773
|
+
_handleSmartSummaryStartupAction(): void {
|
|
1774
|
+
const appComponent = this.getAppComponent();
|
|
1775
|
+
appComponent
|
|
1776
|
+
?.getStartupParameters()
|
|
1777
|
+
?.then((startupParams: StartupParameters) => {
|
|
1778
|
+
if (!startupParams.preferredAction || !startupParams.preferredAction[0].startsWith("summary")) {
|
|
1779
|
+
return;
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
// check if we are on the correct OP by checking the level provided in the startup parameters
|
|
1783
|
+
const viewLevel = this.getView().getViewData().viewLevel;
|
|
1784
|
+
const preferredActionLevel =
|
|
1785
|
+
startupParams.preferredAction[0] === "summary" ? 1 : parseInt(startupParams.preferredAction[0].split("-")[1], 10);
|
|
1786
|
+
if (isNaN(preferredActionLevel) || viewLevel !== preferredActionLevel) {
|
|
1787
|
+
return;
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1790
|
+
// Check if summary action shall be executed now (it might have already been executed by a higher level OP)
|
|
1791
|
+
if (appComponent.getPreferredActionStatus() === PreferredActionStatus.CanPerform) {
|
|
1792
|
+
appComponent.setPreferredActionStatus(PreferredActionStatus.AlreadyPerformed); // to prevent other OPs on higher levels to execute the summary again
|
|
1793
|
+
} else {
|
|
1794
|
+
return;
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1797
|
+
// Check if SmartSummarize capability is available
|
|
1798
|
+
const environmentService = appComponent.getEnvironmentCapabilities();
|
|
1799
|
+
if (!environmentService?.environmentCapabilities.SmartSummarize) {
|
|
1800
|
+
Log.error("Smart Summarization was not triggered because SmartSummarize capability is not available");
|
|
1801
|
+
return;
|
|
1802
|
+
}
|
|
1803
|
+
|
|
1804
|
+
// Find the Summary button
|
|
1805
|
+
const summarizeButton = this._findSummarizeButton();
|
|
1806
|
+
|
|
1807
|
+
if (summarizeButton && summarizeButton.getVisible() && summarizeButton.getEnabled()) {
|
|
1808
|
+
summarizeButton.firePress();
|
|
1809
|
+
return;
|
|
1810
|
+
} else {
|
|
1811
|
+
Log.error(
|
|
1812
|
+
"Smart Summarization was not triggered because the Summarize button is either not visible or not enabled or not found."
|
|
1813
|
+
);
|
|
1814
|
+
return;
|
|
1815
|
+
}
|
|
1816
|
+
})
|
|
1817
|
+
.catch((error: unknown) => {
|
|
1818
|
+
Log.error("Error while retrieving startup parameters or triggering smart summary:", error as string);
|
|
1819
|
+
});
|
|
1820
|
+
}
|
|
1821
|
+
|
|
1653
1822
|
handlers = {
|
|
1654
1823
|
onPrimaryAction(
|
|
1655
1824
|
oController: ObjectPageController,
|
|
@@ -1765,6 +1934,7 @@ class ObjectPageController extends PageController {
|
|
|
1765
1934
|
notApplicableContexts?: ODataV4Context[];
|
|
1766
1935
|
enableAutoScroll?: boolean;
|
|
1767
1936
|
defaultValuesExtensionFunction?: string;
|
|
1937
|
+
disableStrictHandling?: boolean;
|
|
1768
1938
|
}
|
|
1769
1939
|
): Promise<unknown> {
|
|
1770
1940
|
const oController = oView.getController() as ObjectPageController;
|