@sapui5/sap.suite.ui.generic.template 1.130.2 → 1.131.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.
Files changed (100) hide show
  1. package/package.json +1 -1
  2. package/src/sap/suite/ui/generic/template/.library +1 -1
  3. package/src/sap/suite/ui/generic/template/AnalyticalListPage/controller/ControllerImplementation.js +5 -1
  4. package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_da.properties +2 -2
  5. package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_de.properties +2 -2
  6. package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_ko.properties +2 -2
  7. package/src/sap/suite/ui/generic/template/AnalyticalListPage/manifest.json +1 -1
  8. package/src/sap/suite/ui/generic/template/Canvas/manifest.json +1 -1
  9. package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_de.properties +1 -1
  10. package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_es.properties +1 -1
  11. package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_hr.properties +1 -1
  12. package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_ko.properties +2 -2
  13. package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_sl.properties +1 -1
  14. package/src/sap/suite/ui/generic/template/ListReport/manifest.json +1 -1
  15. package/src/sap/suite/ui/generic/template/ListReport/view/fragments/SmartTable.fragment.xml +6 -3
  16. package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_ar.properties +2 -2
  17. package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_da.properties +1 -1
  18. package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_es.properties +2 -2
  19. package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_ko.properties +1 -1
  20. package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_th.properties +1 -1
  21. package/src/sap/suite/ui/generic/template/ObjectPage/manifest.json +1 -1
  22. package/src/sap/suite/ui/generic/template/ObjectPage/view/fragments/Sections.fragment.xml +13 -13
  23. package/src/sap/suite/ui/generic/template/ObjectPage/view/fragments/SmartForm.fragment.xml +5 -5
  24. package/src/sap/suite/ui/generic/template/ObjectPage/view/fragments/SmartTable.fragment.xml +6 -3
  25. package/src/sap/suite/ui/generic/template/QuickCreate/manifest.json +1 -1
  26. package/src/sap/suite/ui/generic/template/QuickView/manifest.json +1 -1
  27. package/src/sap/suite/ui/generic/template/designtime/controls/DynamicPage.designtime.js +317 -0
  28. package/src/sap/suite/ui/generic/template/designtime/controls/SmartTable.designtime.js +121 -32
  29. package/src/sap/suite/ui/generic/template/designtime/floorplans/AnalyticalListPage.designtime.js +12 -5
  30. package/src/sap/suite/ui/generic/template/designtime/floorplans/ListReport.designtime.js +11 -4
  31. package/src/sap/suite/ui/generic/template/designtime/floorplans/ObjectPage.designtime.js +13 -5
  32. package/src/sap/suite/ui/generic/template/designtime/utils/designtimeHelper.js +53 -81
  33. package/src/sap/suite/ui/generic/template/designtime/utils/designtimeUtils.js +63 -21
  34. package/src/sap/suite/ui/generic/template/fragments/SmartFormDataField.fragment.xml +1 -1
  35. package/src/sap/suite/ui/generic/template/js/AnnotationHelper.js +6 -5
  36. package/src/sap/suite/ui/generic/template/js/AnnotationHelperStreamSupport.js +21 -8
  37. package/src/sap/suite/ui/generic/template/lib/AppComponent.js +227 -5
  38. package/src/sap/suite/ui/generic/template/lib/ComponentUtils.js +100 -67
  39. package/src/sap/suite/ui/generic/template/lib/FlexibleColumnLayoutHandler.js +9 -4
  40. package/src/sap/suite/ui/generic/template/lib/RetryAfterHandler.js +154 -54
  41. package/src/sap/suite/ui/generic/template/lib/SideEffectUtil.js +22 -7
  42. package/src/sap/suite/ui/generic/template/lib/StableIdDefinition.js +4 -1
  43. package/src/sap/suite/ui/generic/template/lib/TemplateAssembler.js +39 -41
  44. package/src/sap/suite/ui/generic/template/lib/ViewCreationHelper.js +39 -0
  45. package/src/sap/suite/ui/generic/template/lib/i18n/i18n.properties +20 -1
  46. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ar.properties +14 -1
  47. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_bg.properties +16 -3
  48. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ca.properties +14 -1
  49. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_cnr.properties +14 -1
  50. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_cs.properties +14 -1
  51. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_cy.properties +14 -1
  52. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_da.properties +15 -2
  53. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_de.properties +16 -3
  54. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_el.properties +14 -1
  55. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_en.properties +14 -1
  56. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_en_GB.properties +14 -1
  57. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_en_US_saprigi.properties +14 -1
  58. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_es.properties +18 -5
  59. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_es_MX.properties +14 -1
  60. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_et.properties +14 -1
  61. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_fi.properties +14 -1
  62. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_fr.properties +14 -1
  63. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_fr_CA.properties +14 -1
  64. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_hi.properties +15 -2
  65. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_hr.properties +14 -1
  66. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_hu.properties +14 -1
  67. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_id.properties +15 -2
  68. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_it.properties +14 -1
  69. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_iw.properties +15 -2
  70. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ja.properties +14 -1
  71. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_kk.properties +14 -1
  72. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ko.properties +16 -3
  73. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_lt.properties +14 -1
  74. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_lv.properties +14 -1
  75. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_mk.properties +14 -1
  76. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ms.properties +15 -2
  77. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_nl.properties +14 -1
  78. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_no.properties +14 -1
  79. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_pl.properties +14 -1
  80. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_pt.properties +14 -1
  81. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_pt_PT.properties +14 -1
  82. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ro.properties +14 -1
  83. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ru.properties +14 -1
  84. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sh.properties +14 -1
  85. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sk.properties +14 -1
  86. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sl.properties +14 -1
  87. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sr.properties +14 -1
  88. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sv.properties +15 -2
  89. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_th.properties +14 -1
  90. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_tr.properties +14 -1
  91. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_uk.properties +14 -1
  92. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_vi.properties +14 -1
  93. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_zh_CN.properties +14 -1
  94. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_zh_TW.properties +14 -1
  95. package/src/sap/suite/ui/generic/template/lib/insights/InsightsFECardProvider.js +11 -2
  96. package/src/sap/suite/ui/generic/template/lib/navigation/NavigationController.js +95 -95
  97. package/src/sap/suite/ui/generic/template/library.js +1 -1
  98. package/src/sap/suite/ui/generic/template/listTemplates/fragments/DetailSmartTable.fragment.xml +6 -3
  99. package/src/sap/suite/ui/generic/template/themes/sap_horizon/ObjectPage.less +6 -0
  100. package/src/sap/suite/ui/generic/template/themes/sap_horizon_dark/ObjectPage.less +6 -0
@@ -58,7 +58,10 @@ sap.ui.define([
58
58
  "sap/m/IllustratedMessageType",
59
59
  "sap/suite/ui/generic/template/lib/ai/FioriAIHandler",
60
60
  "sap/suite/ui/generic/template/lib/RetryAfterHandler",
61
- "sap/suite/ui/generic/template/js/RuntimeFormatters" // just to make sure that this class is loaded
61
+ "sap/suite/ui/generic/template/js/RuntimeFormatters", // just to make sure that this class is loaded
62
+ "sap/f/FlexibleColumnLayoutData",
63
+ "sap/f/FlexibleColumnLayoutDataForDesktop",
64
+ "sap/f/FlexibleColumnLayoutDataForTablet"
62
65
  ], function(
63
66
  extend,
64
67
  isPlainObject,
@@ -96,7 +99,12 @@ sap.ui.define([
96
99
  VersionInfo,
97
100
  IllustratedMessageType,
98
101
  FioriAIHandler,
99
- RetryAfterHandler) {
102
+ RetryAfterHandler,
103
+ RuntimeFormatters,
104
+ FlexibleColumnLayoutData,
105
+ FlexibleColumnLayoutDataForDesktop,
106
+ FlexibleColumnLayoutDataForTablet
107
+ ) {
100
108
  "use strict";
101
109
  var sClassName = "lib.AppComponent";
102
110
 
@@ -138,7 +146,9 @@ sap.ui.define([
138
146
  function getMethods(oAppComponent, oAppId) {
139
147
 
140
148
  var fnLeaveAppResolve;
141
- var oTemplateContract = { // template contract object which is used for data interchange between framework classes
149
+ var oTemplateContract = { // template contract object which is used for data interchange between framework classes
150
+ getStoredLayout: getStoredLayout,
151
+ setColumnDistributionModel: setColumnDistributionModel,
142
152
  oAppComponent: oAppComponent,
143
153
  leaveAppPromise: Promise.resolve(), // promise which is resolved once the user leaves the component
144
154
  ghostapp: (function(){
@@ -270,6 +280,9 @@ sap.ui.define([
270
280
  var oNavigationController; // instance of NavigationController
271
281
  var fnDeregister; // function to be called to deregister at TemplateContract
272
282
 
283
+ var shellPersonalizationService;
284
+ var applicationPersonalizers = {};
285
+
273
286
  // Begin: Private helper methods called in init
274
287
 
275
288
  // This function instantiates the global private model that can be used as named model with name _templPrivGlobal in all views and fragments.
@@ -505,17 +518,226 @@ sap.ui.define([
505
518
  setLeaveAppPromise();
506
519
  var oRetryAfterHandler = new RetryAfterHandler(oTemplateContract, oAppComponent);
507
520
  oRetryAfterHandler.registerRetryAfterHandler();
521
+
522
+ if (UShellContainer) {
523
+ var oShellPersonalizationServicePromise = UShellContainer.getServiceAsync("PersonalizationV2");
524
+ oShellPersonalizationServicePromise.then((oShellPersonalizationService) => {
525
+ shellPersonalizationService = oShellPersonalizationService;
526
+ });
527
+ }
508
528
 
509
529
  oLogger.info("Init done for AppComponent " + sAppComponentId);
510
530
  }
511
531
 
532
+ /**
533
+ * Gets the personalizer from the shell service.
534
+ * We set some defaults for the scope object.
535
+ * @param persId Personalization object
536
+ * @param scope Scope object
537
+ * @param component
538
+ * @returns {Promise<PersonalizerType> | undefined} Personalizer object which handles personalization
539
+ */
540
+ async function getPersonalizer(persId, scope, component) {
541
+ if (!shellPersonalizationService) {
542
+ return;
543
+ }
544
+ scope = {
545
+ // merge some defaults
546
+ keyCategory: shellPersonalizationService.constants.keyCategory.FIXED_KEY,
547
+ writeFrequency: shellPersonalizationService.constants.writeFrequency.LOW,
548
+ clientStorageAllowed: false,
549
+ validity: Infinity,
550
+ ...scope
551
+ };
552
+ return shellPersonalizationService.getPersonalizer(persId, scope, component);
553
+ }
554
+
555
+ /**
556
+ * Prepares the container name for personalizer.
557
+ * @returns Container name
558
+ */
559
+ function getContainerName() {
560
+ // personalizer logs error if name longer than 40 symbols
561
+ var sContainer = `App#${(oAppComponent).getManifest()["sap.app"].id}`;
562
+ return sContainer;
563
+ }
564
+
565
+ /**
566
+ * Initializes the personalizer to access the Application data stored in the shell Personalization.
567
+ * @param {string} itemName The name of the item for which the personalizer is created.
568
+ * @returns {Promise<PersonalizerType>} A personalizer
569
+ */
570
+ async function getApplicationPersonalizer(itemName) {
571
+ if (!applicationPersonalizers[itemName]) {
572
+ applicationPersonalizers[itemName] = getPersonalizer(
573
+ {
574
+ container: getContainerName(),
575
+ item: itemName
576
+ },
577
+ {},
578
+ oAppComponent
579
+ );
580
+ }
581
+ return applicationPersonalizers[itemName];
582
+ }
583
+
584
+ /**
585
+ * Returns data from the personalization service.
586
+ * @param {string} itemName
587
+ * @returns {Promise<object | undefined>} Data
588
+ */
589
+ async function getApplicationPersonalizationData(itemName) {
590
+ return (await (await getApplicationPersonalizer(itemName))?.getPersData());
591
+ }
592
+
593
+ /**
594
+ * Stores an object in the personalization service.
595
+ * @param {string} itemName
596
+ * @param {object} data
597
+ * @returns {Promise<void>} A promise
598
+ */
599
+ async function setApplicationPersonalizationData(itemName, data) {
600
+ (await getApplicationPersonalizer(itemName)).setPersData(data);
601
+ }
602
+
603
+ /**
604
+ * Retieves the FCL state from the personalization service.
605
+ * @returns The FCL state
606
+ */
607
+ async function getFCLPersonalizationData() {
608
+ var oEmptyFCLState = {
609
+ defaultLayouts: {},
610
+ columnsDistribution: {
611
+ desktop: {},
612
+ tablet: {}
613
+ }
614
+ };
615
+ return ((await getApplicationPersonalizationData("FCL-Personalization")) ?? oEmptyFCLState);
616
+ }
617
+
618
+ /**
619
+ * Sets the FCL state in the personalization service.
620
+ * @param fclState The FCL state
621
+ */
622
+ function setFCLPersonalizationData(fclState) {
623
+ setApplicationPersonalizationData("FCL-Personalization", fclState);
624
+ }
625
+
626
+ /**
627
+ * Requests the FCL state from the personalization service and sets the model accordingly.
628
+ */
629
+ async function setColumnDistributionModel() {
630
+ if (!shellPersonalizationService) {
631
+ return;
632
+ }
633
+ var oColumnsDistribution = (await getFCLPersonalizationData()).columnsDistribution;
634
+ if (oColumnsDistribution) {
635
+ var oTemplatePrivateGlobalModel = oAppComponent.getModel("_templPrivGlobal");
636
+ oTemplatePrivateGlobalModel.setProperty("/generic/FCL/FCLColumnsDistribution", oColumnsDistribution);
637
+ }
638
+ }
639
+
640
+ /**
641
+ * Is called when the user changes the FCL columns distribution.
642
+ * Updates the FCL state in the personalization service.
643
+ * @param {Event<{ media: "tablet" | "desktop"; layout: LayoutTypeType; columnsSizes: string }>} event
644
+ */
645
+ async function onColumnsDistributionChange(event) {
646
+ if (!shellPersonalizationService) {
647
+ return;
648
+ }
649
+
650
+ var { media, layout, columnsSizes } = event.getParameters();
651
+
652
+ var oTemplatePrivateGlobalModel = oAppComponent.getModel("_templPrivGlobal");
653
+ oTemplatePrivateGlobalModel.setProperty(`/generic/FCL/FCLColumnsDistribution/${media}/${layout}`, columnsSizes);
654
+
655
+ var oFclState = await getFCLPersonalizationData();
656
+ var iColumnsDisplayed = getNumberOfColumnsFromLayout(layout);
657
+ if (iColumnsDisplayed) {
658
+ oFclState.defaultLayouts[iColumnsDisplayed] = layout;
659
+ oFclState.columnsDistribution[media][layout] = columnsSizes;
660
+ setFCLPersonalizationData(oFclState);
661
+ }
662
+ }
663
+
664
+ /**
665
+ * Gets the number of columns displayed in the FCL based on the layout.
666
+ * @param {LayoutTypeType} layout The layout
667
+ * @returns {1 | 2 | 3 | null} The number of columns displayed
668
+ */
669
+ function getNumberOfColumnsFromLayout(layout) {
670
+ var iColumnsDisplayed = /^(One|Two|Three)Column/.exec(layout)?.[1];
671
+ switch (iColumnsDisplayed) {
672
+ case "One":
673
+ return 1;
674
+ case "Two":
675
+ return 2;
676
+ case "Three":
677
+ return 3;
678
+ default:
679
+ return null;
680
+ }
681
+ }
682
+
683
+ /**
684
+ * Gets the layout stored in the personalization service based on the proposed layout.
685
+ * @param {LayoutTypeType | undefined } proposedLayout
686
+ * @returns The FCL layout stored in the personalization service
687
+ */
688
+ async function getStoredLayout(oProposedLayout) {
689
+ if (shellPersonalizationService) {
690
+ var iColumnsDisplayed = getNumberOfColumnsFromLayout(oProposedLayout);
691
+ if (iColumnsDisplayed) {
692
+ var defaultLayouts = (await getFCLPersonalizationData()).defaultLayouts;
693
+ return defaultLayouts?.[iColumnsDisplayed] ?? oProposedLayout;
694
+ }
695
+ }
696
+ return oProposedLayout;
697
+ }
698
+
699
+ function initFlexibleColumnLayout() {
700
+ var oFCL = new FlexibleColumnLayout();
701
+
702
+ var oLayoutData = new FlexibleColumnLayoutData();
703
+ var oDesktopLayoutData = new FlexibleColumnLayoutDataForDesktop();
704
+ var oTabletLayoutData = new FlexibleColumnLayoutDataForTablet();
705
+
706
+ var sFCLColumnsDistributionPath = "_templPrivGlobal>/generic/FCL/FCLColumnsDistribution";
707
+ var sDesktopFCLColumnsDistributionPath = `${sFCLColumnsDistributionPath}/desktop`;
708
+ var sTabletFCLColumnsDistributionPath = `${sFCLColumnsDistributionPath}/tablet`;
709
+
710
+ oDesktopLayoutData.bindProperty("twoColumnsBeginExpanded", `${sDesktopFCLColumnsDistributionPath}/TwoColumnsBeginExpanded`);
711
+ oDesktopLayoutData.bindProperty("twoColumnsMidExpanded", `${sDesktopFCLColumnsDistributionPath}/TwoColumnsMidExpanded`);
712
+ oDesktopLayoutData.bindProperty("threeColumnsBeginExpandedEndHidden", `${sDesktopFCLColumnsDistributionPath}/ThreeColumnsBeginExpandedEndHidden`);
713
+ oDesktopLayoutData.bindProperty("threeColumnsEndExpanded", `${sDesktopFCLColumnsDistributionPath}/ThreeColumnsEndExpanded`);
714
+ oDesktopLayoutData.bindProperty("threeColumnsMidExpanded", `${sDesktopFCLColumnsDistributionPath}/ThreeColumnsMidExpanded`);
715
+ oDesktopLayoutData.bindProperty("threeColumnsMidExpandedEndHidden", `${sDesktopFCLColumnsDistributionPath}/ThreeColumnsMidExpandedEndHidden`);
716
+
717
+ oTabletLayoutData.bindProperty("twoColumnsBeginExpanded", `${sTabletFCLColumnsDistributionPath}/TwoColumnsBeginExpanded`);
718
+ oTabletLayoutData.bindProperty("twoColumnsMidExpanded", `${sTabletFCLColumnsDistributionPath}/TwoColumnsMidExpanded`);
719
+ oTabletLayoutData.bindProperty("threeColumnsBeginExpandedEndHidden", `${sTabletFCLColumnsDistributionPath}/ThreeColumnsBeginExpandedEndHidden`);
720
+ oTabletLayoutData.bindProperty("threeColumnsEndExpanded", `${sTabletFCLColumnsDistributionPath}/ThreeColumnsEndExpanded`);
721
+ oTabletLayoutData.bindProperty("threeColumnsMidExpanded", `${sTabletFCLColumnsDistributionPath}/ThreeColumnsMidExpanded`);
722
+ oTabletLayoutData.bindProperty("threeColumnsMidExpandedEndHidden", `${sTabletFCLColumnsDistributionPath}/ThreeColumnsMidExpandedEndHidden`);
723
+
724
+ oLayoutData.setDesktopLayoutData(oDesktopLayoutData);
725
+ oLayoutData.setTabletLayoutData(oTabletLayoutData);
726
+ oFCL.setAggregation("layoutData", oLayoutData);
727
+
728
+ oFCL.attachColumnsDistributionChange(onColumnsDistributionChange);
729
+
730
+ return oFCL;
731
+ }
732
+
512
733
  function createContent(){
513
734
  // Method must only be called once
514
735
  if (oTemplateContract.oNavigationHost){
515
736
  return "";
516
737
  }
517
738
  if (oAppComponent.getFlexibleColumnLayout()){
518
- var oFCL = new FlexibleColumnLayout();
739
+ var oFCL = initFlexibleColumnLayout();
740
+
519
741
  oTemplateContract.oNavigationHost = oFCL;
520
742
  oTemplateContract.aNavigationObservers = [
521
743
  new ProcessObserver({
@@ -938,7 +1160,7 @@ sap.ui.define([
938
1160
  * @public
939
1161
  * @extends sap.ui.core.UIComponent
940
1162
  * @author SAP SE
941
- * @version 1.130.2
1163
+ * @version 1.131.0
942
1164
  * @name sap.suite.ui.generic.template.lib.AppComponent
943
1165
  */
944
1166
  var oAppComponent = UIComponent.extend("sap.suite.ui.generic.template.lib.AppComponent", {
@@ -1,4 +1,5 @@
1
- sap.ui.define(["sap/ui/base/Object",
1
+ sap.ui.define([
2
+ "sap/ui/base/Object",
2
3
  "sap/ui/model/base/ManagedObjectModel",
3
4
  "sap/suite/ui/generic/template/genericUtilities/controlHelper",
4
5
  "sap/suite/ui/generic/template/genericUtilities/FeLogger",
@@ -8,9 +9,22 @@ sap.ui.define(["sap/ui/base/Object",
8
9
  "sap/base/util/extend",
9
10
  "sap/base/util/isEmptyObject",
10
11
  "sap/suite/ui/generic/template/genericUtilities/FeError",
11
- "sap/suite/ui/generic/template/lib/CommandComponentUtils"
12
- ], function(BaseObject, ManagedObjectModel, controlHelper, FeLogger, oDataModelHelper, CRUDActionHandler, StatePreserver, extend, isEmptyObject, FeError,
13
- CommandComponentUtils) {
12
+ "sap/suite/ui/generic/template/lib/CommandComponentUtils",
13
+ "sap/suite/ui/generic/template/lib/ViewCreationHelper"
14
+ ], function(
15
+ BaseObject,
16
+ ManagedObjectModel,
17
+ controlHelper,
18
+ FeLogger,
19
+ oDataModelHelper,
20
+ CRUDActionHandler,
21
+ StatePreserver,
22
+ extend,
23
+ isEmptyObject,
24
+ FeError,
25
+ CommandComponentUtils,
26
+ ViewCreationHelper
27
+ ) {
14
28
  "use strict";
15
29
  var sClassName = "lib.ComponentUtils";
16
30
  var oLogger = new FeLogger(sClassName).getLogger();
@@ -479,78 +493,97 @@ sap.ui.define(["sap/ui/base/Object",
479
493
  }
480
494
  return;
481
495
  }
496
+ var oViewReadyPromise = Promise.resolve();
497
+ if (oComponentRegistryEntry.oController) {
498
+ var oView = oComponentRegistryEntry.oController.getView();
499
+ if (oView && oView.isDestroyed()) {
500
+ // View creation of a specific component use to happen only once in the lifecycle of the component.
501
+ // View is expected to be alive for the lifecycle of the template component. In some edge cases where
502
+ // the same application variant is used as a target application & the source application has Keep-Alive
503
+ // as true the source application, aggregated components & their corresponding views are not destroyed.
504
+ // When target application is started and component is being created FE checks for the view with ID & if
505
+ // exist it is destroyed. This means the Source App & component is active but its view will be destroyed.
506
+ // Now if user navigates back to the source application & opens the same view again. To handle this
507
+ // scenario, FE checks for such situation and re-creates the view here.
508
+ oViewReadyPromise = ViewCreationHelper.initializeViewCreation(oComponentRegistryEntry);
509
+ oComponent.onBeforeRendering(oComponentRegistryEntry);
510
+ }
511
+ }
482
512
  var oComponentContainer = oComponent.getComponentContainer();
483
513
  if (!oComponentContainer){
484
514
  return;
485
515
  }
486
- var oUIModel = oComponent.getModel("ui");
487
- var bIsNonDraftCreate = !!oComponentRegistryEntry.nonDraftCreateContext;
488
- if (bIsNonDraftCreate) {
489
- var oBindingContext = oComponentContainer.getBindingContext();
490
- if (oBindingContext === oComponentRegistryEntry.nonDraftCreateContext){
491
- return; // page is already in correct state
492
- }
493
- oUIModel.setProperty("/enabled", true);
494
- oUIModel.setProperty("/editable", true);
495
- oUIModel.setProperty("/createMode", true);
496
- fnUnbind(); // unbind if bound to another context or an element binding
497
- if (fnHeaderDataAvailableResolve){
498
- fnHeaderDataAvailableResolve(oComponentRegistryEntry.nonDraftCreateContext);
499
- fnHeaderDataAvailableResolve = null;
516
+
517
+ oViewReadyPromise.then(function() {
518
+ var oUIModel = oComponent.getModel("ui");
519
+ var bIsNonDraftCreate = !!oComponentRegistryEntry.nonDraftCreateContext;
520
+ if (bIsNonDraftCreate) {
521
+ var oBindingContext = oComponentContainer.getBindingContext();
522
+ if (oBindingContext === oComponentRegistryEntry.nonDraftCreateContext){
523
+ return; // page is already in correct state
524
+ }
525
+ oUIModel.setProperty("/enabled", true);
526
+ oUIModel.setProperty("/editable", true);
527
+ oUIModel.setProperty("/createMode", true);
528
+ fnUnbind(); // unbind if bound to another context or an element binding
529
+ if (fnHeaderDataAvailableResolve){
530
+ fnHeaderDataAvailableResolve(oComponentRegistryEntry.nonDraftCreateContext);
531
+ fnHeaderDataAvailableResolve = null;
532
+ } else {
533
+ oHeaderDataAvailablePromise = Promise.resolve(oComponentRegistryEntry.nonDraftCreateContext);
534
+ }
535
+ fnPreparePageDataLoaded();
536
+ if (oComponentRegistryEntry.methods.beforeRebind) {
537
+ oComponentRegistryEntry.methods.beforeRebind(oHeaderDataAvailablePromise);
538
+ }
539
+ oComponentContainer.setBindingContext(oComponentRegistryEntry.nonDraftCreateContext);
540
+ Promise.all([oComponentRegistryEntry.oViewRenderedPromise, oComponentRegistryEntry.viewRegistered]).then(fnCallPathUnchangedReuseCallbacks.bind(null, true, false));
541
+ if (oComponentRegistryEntry.methods.afterRebind) {
542
+ oComponentRegistryEntry.methods.afterRebind();
543
+ }
500
544
  } else {
501
- oHeaderDataAvailablePromise = Promise.resolve(oComponentRegistryEntry.nonDraftCreateContext);
502
- }
503
- fnPreparePageDataLoaded();
504
- if (oComponentRegistryEntry.methods.beforeRebind) {
505
- oComponentRegistryEntry.methods.beforeRebind(oHeaderDataAvailablePromise);
506
- }
507
- oComponentContainer.setBindingContext(oComponentRegistryEntry.nonDraftCreateContext);
508
- Promise.all([oComponentRegistryEntry.oViewRenderedPromise, oComponentRegistryEntry.viewRegistered]).then(fnCallPathUnchangedReuseCallbacks.bind(null, true, false));
509
- if (oComponentRegistryEntry.methods.afterRebind) {
510
- oComponentRegistryEntry.methods.afterRebind();
511
- }
512
- } else {
513
- var oElementBinding = oComponentContainer.getElementBinding();
514
- if (oElementBinding){
515
- if (sLogicalBindingPath === sBindingPath) {
516
- /*
517
- * component is already bound to this object - no rebound to avoid that 1:1, 1:N and expands are read
518
- * again
519
- */
520
- if (oElementBinding.isSuspended()) {
521
- oElementBinding.resume();
522
- fnAdaptToContext();
523
- }
524
- if (bIsDataLoading){
525
- fnStartBusy();
526
- }
527
- oComponentRegistryEntry.oApplication.getBusyHelper().getUnbusy().then(fnCallPathUnchangedReuseCallbacks.bind(null, bAreKeysDifferent, false));
528
- if (!bIsComponentCurrentlyActive){
529
- fnPreparePageDataLoaded();
530
- }
531
- if (!bIsComponentCurrentlyActive && !isDraftEnabled()){ // in non-draft case: even if this object has been left in edit mode we now return to display mode, since the changes have already been discarded
532
- var bEditFlowOfRoot = oComponentRegistryEntry.oApplication.getEditFlowOfRoot();
533
- if (bEditFlowOfRoot === "direct") {
534
- oUIModel.setProperty("/editable", true);
535
- } else {
536
- oUIModel.setProperty("/editable", false);
545
+ var oElementBinding = oComponentContainer.getElementBinding();
546
+ if (oElementBinding){
547
+ if (sLogicalBindingPath === sBindingPath) {
548
+ /*
549
+ * component is already bound to this object - no rebound to avoid that 1:1, 1:N and expands are read
550
+ * again
551
+ */
552
+ if (oElementBinding.isSuspended()) {
553
+ oElementBinding.resume();
554
+ fnAdaptToContext();
555
+ }
556
+ if (bIsDataLoading){
557
+ fnStartBusy();
537
558
  }
559
+ oComponentRegistryEntry.oApplication.getBusyHelper().getUnbusy().then(fnCallPathUnchangedReuseCallbacks.bind(null, bAreKeysDifferent, false));
560
+ if (!bIsComponentCurrentlyActive){
561
+ fnPreparePageDataLoaded();
562
+ }
563
+ if (!bIsComponentCurrentlyActive && !isDraftEnabled()){ // in non-draft case: even if this object has been left in edit mode we now return to display mode, since the changes have already been discarded
564
+ var bEditFlowOfRoot = oComponentRegistryEntry.oApplication.getEditFlowOfRoot();
565
+ if (bEditFlowOfRoot === "direct") {
566
+ oUIModel.setProperty("/editable", true);
567
+ } else {
568
+ oUIModel.setProperty("/editable", false);
569
+ }
570
+ }
571
+ oUIModel.setProperty("/enabled", true);
572
+ return;
573
+ } else if (!bIsComponentCurrentlyActive){
574
+ fnUnbind();
538
575
  }
539
- oUIModel.setProperty("/enabled", true);
540
- return;
541
- } else if (!bIsComponentCurrentlyActive){
542
- fnUnbind();
543
576
  }
577
+ // the following properties will be adapted by the change event of the binding
578
+ oUIModel.setProperty("/enabled", false);
579
+ oUIModel.setProperty("/editable", false);
580
+ oUIModel.setProperty("/createMode", false);
581
+ // and read the header data if necessary
582
+ fnRebindHeaderData(sBindingPath);
583
+
584
+ fnPreparePageDataLoaded();
544
585
  }
545
- // the following properties will be adapted by the change event of the binding
546
- oUIModel.setProperty("/enabled", false);
547
- oUIModel.setProperty("/editable", false);
548
- oUIModel.setProperty("/createMode", false);
549
- // and read the header data if necessary
550
- fnRebindHeaderData(sBindingPath);
551
-
552
- fnPreparePageDataLoaded();
553
- }
586
+ });
554
587
  }
555
588
 
556
589
  // This method can be called in two scenarios:
@@ -62,6 +62,8 @@ sap.ui.define(["sap/ui/base/Object", "sap/f/FlexibleColumnLayoutSemanticHelper",
62
62
  var oFCLSettings = oTemplateContract.oAppComponent.getFlexibleColumnLayout();
63
63
  var oFlexibleColumnLayoutSemanticHelper = FlexibleColumnLayoutSemanticHelper.getInstanceFor(oFlexibleColumnLayout, oFCLSettings);
64
64
 
65
+ oTemplateContract.setColumnDistributionModel();
66
+
65
67
  var oUiState;
66
68
  var sCurrentLayout;
67
69
  var sStoredTargetLayout;
@@ -293,7 +295,7 @@ sap.ui.define(["sap/ui/base/Object", "sap/f/FlexibleColumnLayoutSemanticHelper",
293
295
  oHostViewPreparationPromise = oNavigationControllerProxy.prepareHostView(oSuccessorNode);
294
296
  aPromises.push(oHostViewPreparationPromise);
295
297
  }
296
- var fnImpl = function(){ // implementation on what needs to be done. Relies on oFlexibleColumnLayoutSemanticHelper being ready to use
298
+ var fnImpl = async function(){ // implementation on what needs to be done. Relies on oFlexibleColumnLayoutSemanticHelper being ready to use
297
299
  if (isMultipleColumn(oCurrentIdentity.treeNode)){
298
300
  sCurrentLayout = getFCLLayoutFromIdentity(oCurrentIdentity);
299
301
  if (!sCurrentLayout){
@@ -319,14 +321,17 @@ sap.ui.define(["sap/ui/base/Object", "sap/f/FlexibleColumnLayoutSemanticHelper",
319
321
  } else {
320
322
  sCurrentLayout = oCurrentIdentity.treeNode.fCLLevel === 0 ? aDefaultLayouts[0] : LayoutType.EndColumnFullScreen;
321
323
  }
324
+
325
+ sCurrentLayout = await oTemplateContract.getStoredLayout(sCurrentLayout);
326
+
322
327
  oFlexibleColumnLayout.setLayout(sCurrentLayout);
323
328
  oFlexibleColumnLayout.setAutoFocus(false);
324
329
  oFlexibleColumnLayout.setRestoreFocusOnBackNavigation(true);
325
- if (oCurrentIdentity.treeNode.fCLLevel === 1 || oCurrentIdentity.treeNode.fCLLevel === 2){
330
+ if (oCurrentIdentity.treeNode.fCLLevel === 1 || oCurrentIdentity.treeNode.fCLLevel === 2) {
326
331
  var oNewUiState = oFlexibleColumnLayoutSemanticHelper.getCurrentUIState();
327
- if (oNewUiState.columnsVisibility.midColumn){
332
+ if (oNewUiState.columnsVisibility.midColumn) {
328
333
  var iDownto = 1 - oNewUiState.columnsVisibility.beginColumn;
329
- for (var oPredecessorNode = oCurrentIdentity.treeNode; oPredecessorNode.fCLLevel > iDownto;){
334
+ for (var oPredecessorNode = oCurrentIdentity.treeNode; oPredecessorNode.fCLLevel > iDownto;) {
330
335
  oPredecessorNode = oTemplateContract.mRoutingTree[oPredecessorNode.parentRoute];
331
336
  oCurrentIdentity.componentsDisplayed[oPredecessorNode.sRouteName] = 1;
332
337
  oPredecessorNode.display();