@sapui5/sap.suite.ui.generic.template 1.142.6 → 1.142.7
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/suite/ui/generic/template/.library +1 -1
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/manifest.json +1 -1
- package/src/sap/suite/ui/generic/template/Canvas/manifest.json +1 -1
- package/src/sap/suite/ui/generic/template/ListReport/controller/ControllerImplementation.js +94 -11
- package/src/sap/suite/ui/generic/template/ListReport/controller/IappStateHandler.js +19 -9
- package/src/sap/suite/ui/generic/template/ListReport/manifest.json +1 -1
- package/src/sap/suite/ui/generic/template/ListReport/view/fragments/SmartChart.fragment.xml +2 -1
- package/src/sap/suite/ui/generic/template/ListReport/view/fragments/SmartTable.fragment.xml +3 -2
- package/src/sap/suite/ui/generic/template/ObjectPage/controller/ControllerImplementation.js +5 -2
- package/src/sap/suite/ui/generic/template/ObjectPage/manifest.json +1 -1
- package/src/sap/suite/ui/generic/template/ObjectPage/view/fragments/SmartChart.fragment.xml +3 -2
- package/src/sap/suite/ui/generic/template/ObjectPage/view/fragments/SmartTable.fragment.xml +3 -2
- package/src/sap/suite/ui/generic/template/QuickCreate/manifest.json +1 -1
- package/src/sap/suite/ui/generic/template/QuickView/manifest.json +1 -1
- package/src/sap/suite/ui/generic/template/genericUtilities/ControlStateWrapperFactory.js +101 -67
- package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/DynamicPageWrapper.js +19 -51
- package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/ObjectPageLayoutWrapper.js +10 -32
- package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/PreliminaryWrapper.js +144 -0
- package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/SearchFieldWrapper.js +8 -30
- package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/SmartFilterBarWrapper.js +49 -162
- package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/SmartTableChartCommon.js +100 -94
- package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/SmartTableWrapper.js +22 -3
- package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/SmartVariantManagementWrapper.js +82 -75
- package/src/sap/suite/ui/generic/template/lib/AppComponent.js +1 -1
- package/src/sap/suite/ui/generic/template/lib/ai/EasyFilterBarHandler.js +21 -8
- package/src/sap/suite/ui/generic/template/lib/navigation/NavigationController.js +1 -1
- package/src/sap/suite/ui/generic/template/library.js +1 -1
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
sap.ui.define([
|
|
2
2
|
"sap/ui/model/Filter",
|
|
3
|
+
"sap/ui/model/FilterOperator",
|
|
3
4
|
"sap/suite/ui/generic/template/ListReport/extensionAPI/ExtensionAPI",
|
|
4
5
|
"sap/suite/ui/generic/template/listTemplates/listUtils",
|
|
5
6
|
"sap/suite/ui/generic/template/listTemplates/controller/MessageStripHelper",
|
|
@@ -31,6 +32,7 @@ sap.ui.define([
|
|
|
31
32
|
"sap/fe/controls/easyFilter/PXFeedback"
|
|
32
33
|
], function (
|
|
33
34
|
Filter,
|
|
35
|
+
FilterOperator,
|
|
34
36
|
ExtensionAPI,
|
|
35
37
|
listUtils,
|
|
36
38
|
MessageStripHelper,
|
|
@@ -464,7 +466,7 @@ sap.ui.define([
|
|
|
464
466
|
/**
|
|
465
467
|
* When no data message is displayed as illustration, SmartTable overrides the "illustrationType" to "NoEntries".
|
|
466
468
|
* Here, we reset back to "BeforeSearch".
|
|
467
|
-
*
|
|
469
|
+
*
|
|
468
470
|
* TODO: Sync with table colleagues
|
|
469
471
|
*/
|
|
470
472
|
function fnSetInitialNoDataMessageForTable (oSmartTable) {
|
|
@@ -590,10 +592,89 @@ sap.ui.define([
|
|
|
590
592
|
return restoreFocusHelper;
|
|
591
593
|
}
|
|
592
594
|
|
|
593
|
-
|
|
594
|
-
|
|
595
|
+
/**
|
|
596
|
+
* Helper function to get missing navigation properties from the current variant.
|
|
597
|
+
* This logic was moved from SmartFilterBarWrapper to avoid control-specific
|
|
598
|
+
* business logic in the wrapper layer.
|
|
599
|
+
* @param {object} oSmartFilterBar - The SmartFilterBar control
|
|
600
|
+
* @returns {Array} Array of missing navigation property filters
|
|
601
|
+
*/
|
|
602
|
+
function fnGetMissingNavProperties(oSmartFilterBar) {
|
|
603
|
+
//Fetch the navigation properties
|
|
604
|
+
const oMetaModel = oSmartFilterBar.getModel().getMetaModel(),
|
|
605
|
+
sEntitySet = oSmartFilterBar.getEntitySet(),
|
|
606
|
+
oDataEntitySet = oMetaModel.getODataEntitySet(sEntitySet),
|
|
607
|
+
oDataEntityType = oMetaModel.getODataEntityType(oDataEntitySet.entityType),
|
|
608
|
+
aNavigationProperties = oDataEntityType['navigationProperty'];
|
|
609
|
+
//Fetch the added filters in the current variant
|
|
610
|
+
const sCurrentVariantID = oSmartFilterBar.getVariantManagement().getCurrentVariantId(),
|
|
611
|
+
oCurrentVariant = oSmartFilterBar.getVariantManagement().getAllVariants().find(function(variant) {
|
|
612
|
+
return variant.getId() === sCurrentVariantID;
|
|
613
|
+
});
|
|
614
|
+
if (!oCurrentVariant
|
|
615
|
+
|| !oCurrentVariant.getContent()
|
|
616
|
+
|| !oCurrentVariant.getContent().searchListReportVariant
|
|
617
|
+
|| !oCurrentVariant.getContent().searchListReportVariant.filterBarVariant
|
|
618
|
+
|| !aNavigationProperties
|
|
619
|
+
|| !aNavigationProperties.length
|
|
620
|
+
) {
|
|
621
|
+
return [];
|
|
622
|
+
}
|
|
623
|
+
const oManifestNavigationProperties = oSmartFilterBar.getNavigationProperties() ?
|
|
624
|
+
oSmartFilterBar.getNavigationProperties().split(",").reduce(function(accumulator, currentValue){
|
|
625
|
+
accumulator[currentValue] = true;
|
|
626
|
+
return accumulator;
|
|
627
|
+
}, {}) : {},
|
|
628
|
+
oNavigationProperties = aNavigationProperties.reduce(function(accumulator, currentValue){
|
|
629
|
+
accumulator[currentValue.name] = true;
|
|
630
|
+
return accumulator;
|
|
631
|
+
}, {}),
|
|
632
|
+
oSmartFilterBarVariant = JSON.parse(oCurrentVariant.getContent().searchListReportVariant.filterBarVariant),
|
|
633
|
+
aMissing = [];
|
|
634
|
+
delete oSmartFilterBarVariant["_CUSTOM"];
|
|
635
|
+
|
|
636
|
+
// Compare the filter source and navigation properties
|
|
637
|
+
// Take into account if parameter is already specified in page setting in manifest.json - settings->filterSettings->navigationProperties
|
|
638
|
+
// If parameter exist in navigationProperties -> SFB will handle specific parameter and code ignore it
|
|
639
|
+
for (const sFilterKey in oSmartFilterBarVariant) {
|
|
640
|
+
const sParamName = sFilterKey.split(".")[0]; // take first part from navigation parameter. Example: to_Currency.Currency_Code -> to_Currency
|
|
641
|
+
if (!oNavigationProperties[sParamName] || oManifestNavigationProperties[sParamName]
|
|
642
|
+
) {
|
|
643
|
+
// Parameter is
|
|
644
|
+
// 1) not navigation property -> we don't process it
|
|
645
|
+
// 2) is defined in manifest.json - settings->filterSettings->navigationProperties -> value will be handled by SFB
|
|
646
|
+
continue;
|
|
647
|
+
}
|
|
648
|
+
if (oSmartFilterBarVariant[sFilterKey].items && oSmartFilterBarVariant[sFilterKey].items.length) {
|
|
649
|
+
aMissing.push(oSmartFilterBarVariant[sFilterKey].items.map(function(entry) {
|
|
650
|
+
return {
|
|
651
|
+
exclude: false,
|
|
652
|
+
field: sFilterKey,
|
|
653
|
+
operation: FilterOperator.EQ,
|
|
654
|
+
value1: entry.key
|
|
655
|
+
};
|
|
656
|
+
}));
|
|
657
|
+
continue;
|
|
658
|
+
}
|
|
659
|
+
if (oSmartFilterBarVariant[sFilterKey].ranges && oSmartFilterBarVariant[sFilterKey].ranges.length) {
|
|
660
|
+
aMissing.push(oSmartFilterBarVariant[sFilterKey].ranges.map(function(entry) {
|
|
661
|
+
return {
|
|
662
|
+
exclude: entry.exclude,
|
|
663
|
+
field: entry.keyField,
|
|
664
|
+
operation: entry.operation,
|
|
665
|
+
value1: entry.value1,
|
|
666
|
+
value2: entry.value2
|
|
667
|
+
};
|
|
668
|
+
}));
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
return aMissing;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
// Expose selected private functions to unit tests
|
|
595
675
|
/* eslint-enable */
|
|
596
676
|
testableHelper.testableStatic(onShareListReportActionButtonPressImpl, "ControllerImplementation_onShareListReportActionButtonPressImpl");
|
|
677
|
+
testableHelper.testable(fnGetMissingNavProperties, "fnGetMissingNavProperties");
|
|
597
678
|
|
|
598
679
|
// Generation of Event Handlers
|
|
599
680
|
return {
|
|
@@ -751,8 +832,11 @@ sap.ui.define([
|
|
|
751
832
|
onShareListReportActionButtonPressImpl(oMenuButton);
|
|
752
833
|
});
|
|
753
834
|
},
|
|
754
|
-
|
|
835
|
+
|
|
755
836
|
handlers: {
|
|
837
|
+
onAfterVariantInitialise: function(oEvent) {
|
|
838
|
+
oTemplateUtils.oCommonUtils.getControlStateWrapper(oEvent.getSource()).onAfterVariantInitialise();
|
|
839
|
+
},
|
|
756
840
|
addEntry: addEntry,
|
|
757
841
|
addEntryWithFilters: addEntryWithFilters,
|
|
758
842
|
deleteEntries: fnDeleteEntries,
|
|
@@ -798,6 +882,8 @@ sap.ui.define([
|
|
|
798
882
|
onAfterSFBVariantLoad: function (oEvent) {
|
|
799
883
|
oState.oIappStateHandler.onAfterSFBVariantLoad(oEvent);
|
|
800
884
|
oState.oEasyFilterBarHandler && oState.oEasyFilterBarHandler.handleVariantLoad(oEvent);
|
|
885
|
+
// Cache missing navigation property filters for performance
|
|
886
|
+
oState.aMissingNavFilters = fnGetMissingNavProperties(oState.oSmartFilterbar);
|
|
801
887
|
},
|
|
802
888
|
onSmartListDataReceived: function (oEvent) {
|
|
803
889
|
var oSmartList = oEvent.getSource();
|
|
@@ -850,11 +936,8 @@ sap.ui.define([
|
|
|
850
936
|
// However, this connection is not there in the multi view multi table scenario which is the only case in which this snapshot
|
|
851
937
|
// will be used later.
|
|
852
938
|
var aFiltersFromRebindEvent = oBindingParams.filters.slice(0);
|
|
853
|
-
// To get the missing navigation properties from the user variant
|
|
854
|
-
|
|
855
|
-
oSmartFilterBarWrapper = oTemplateUtils.oCommonUtils.getControlStateWrapperById(oSmartFilterBarId, "SmartFilterBar"),
|
|
856
|
-
aMissingFilters = oSmartFilterBarWrapper.getMissingNavProperties();
|
|
857
|
-
if (aMissingFilters.length) {
|
|
939
|
+
// To get the missing navigation properties from the user variant (cached from last variant load)
|
|
940
|
+
if (oState.aMissingNavFilters && oState.aMissingNavFilters.length) {
|
|
858
941
|
// Display message to the user, which filters currently are not visible
|
|
859
942
|
var sCurrentVariant = oState.oSmartFilterbar.getVariantManagement().getId(),
|
|
860
943
|
sCurrentVariantId = oState.oSmartFilterbar.getCurrentVariantId(),
|
|
@@ -870,7 +953,7 @@ sap.ui.define([
|
|
|
870
953
|
}
|
|
871
954
|
return accumulator;
|
|
872
955
|
}, {}),
|
|
873
|
-
aMissingPropertyNames =
|
|
956
|
+
aMissingPropertyNames = oState.aMissingNavFilters.reduce(function(accumulator, currentValue) {
|
|
874
957
|
var sName = currentValue[0].field.split(".")[0];
|
|
875
958
|
if (oMappedProperty[sName]) {
|
|
876
959
|
accumulator.push(oMappedProperty[sName]);
|
|
@@ -888,7 +971,7 @@ sap.ui.define([
|
|
|
888
971
|
// Generate filters and set them into binding parameters
|
|
889
972
|
// use same logic as in sap.ui.comp.smartfilterbar.FilterProviderUtils, method generateFilters()
|
|
890
973
|
var aFilters = [];
|
|
891
|
-
|
|
974
|
+
oState.aMissingNavFilters.forEach(function(oEntry) {
|
|
892
975
|
var aIncludeFilters = [],
|
|
893
976
|
aExcludeFilters = [];
|
|
894
977
|
oEntry.forEach(function(oFilterEntry) {
|
|
@@ -214,12 +214,6 @@ sap.ui.define([
|
|
|
214
214
|
// However, for iAppState case, SVM wrapper also needs to contain SFB wrapper (and not oCustomFiltersWrapper directly)
|
|
215
215
|
|
|
216
216
|
|
|
217
|
-
// DynamicPage state: header pinned
|
|
218
|
-
var oDynamicPage = oController.byId(StableIdHelper.getStableId({type: "ListReportPage", subType: "DynamicPage"}));
|
|
219
|
-
// TODO: Discuss: should this state (header pinned) be part of variant (only page variant or SFB variant)? Assumption: no
|
|
220
|
-
var oDynamicPageWrapper = oTemplateUtils.oCommonUtils.getControlStateWrapper(oDynamicPage);
|
|
221
|
-
aControlStateWrappers.push(oDynamicPageWrapper);
|
|
222
|
-
|
|
223
217
|
// SmartVariantManagement state: Selected Variant and whether it's dirty, including wrappers for managed controls (all controls, for which the corresponding state
|
|
224
218
|
// information should be part of the variant)
|
|
225
219
|
// Due to direct connection between SVM and SFB, also their wrappers need to each other directly. Remarks:
|
|
@@ -229,14 +223,19 @@ sap.ui.define([
|
|
|
229
223
|
var oSmartVariantManagement = oState.oSmartFilterbar.getSmartVariant();
|
|
230
224
|
if (oSmartVariantManagement){
|
|
231
225
|
var oSmartVariantManagementWrapper = oTemplateUtils.oCommonUtils.getControlStateWrapper(oSmartVariantManagement, {
|
|
232
|
-
managedControlWrappers: aPageVariantControlStateWrappers.concat([oSmartFilterBarWrapper])
|
|
233
|
-
dynamicPageWrapper: oDynamicPageWrapper
|
|
226
|
+
managedControlWrappers: aPageVariantControlStateWrappers.concat([oSmartFilterBarWrapper])
|
|
234
227
|
});
|
|
235
228
|
aControlStateWrappers.push(oSmartVariantManagementWrapper);
|
|
236
229
|
} else {
|
|
237
230
|
aControlStateWrappers.push(oSmartFilterBarWrapper);
|
|
238
231
|
}
|
|
239
232
|
|
|
233
|
+
// DynamicPage state: header pinned
|
|
234
|
+
var oDynamicPage = oController.byId(StableIdHelper.getStableId({type: "ListReportPage", subType: "DynamicPage"}));
|
|
235
|
+
// The DynamicPage state (header pinned) is intentionally stored only in iAppState and not included in any variant (neither page variant nor SFB variant).
|
|
236
|
+
var oDynamicPageWrapper = oTemplateUtils.oCommonUtils.getControlStateWrapper(oDynamicPage);
|
|
237
|
+
aControlStateWrappers.push(oDynamicPageWrapper);
|
|
238
|
+
|
|
240
239
|
|
|
241
240
|
// Wrapper to control whether data is loaded
|
|
242
241
|
|
|
@@ -774,7 +773,8 @@ sap.ui.define([
|
|
|
774
773
|
// For desktop devices, expand the header for Standard and Custom variants and for tablet and mobile devices,
|
|
775
774
|
// collapse the header only if search is triggered.
|
|
776
775
|
if (Device.system.desktop) {
|
|
777
|
-
|
|
776
|
+
var oTemplatePrivateModel = oTemplateUtils.oComponentUtils.getTemplatePrivateModel();
|
|
777
|
+
oTemplatePrivateModel.setProperty("/listReport/isHeaderExpanded", true);
|
|
778
778
|
} else {
|
|
779
779
|
collapseHeader();
|
|
780
780
|
}
|
|
@@ -909,6 +909,16 @@ sap.ui.define([
|
|
|
909
909
|
}
|
|
910
910
|
sap.ui.getCore().getMessageManager().removeMessages(removedMessages);
|
|
911
911
|
}
|
|
912
|
+
|
|
913
|
+
// Restore header collapse logic (originally removed in change 5641712)
|
|
914
|
+
// Collapse header when user manually selects a variant (context === undefined) that has executeOnSelect set to true
|
|
915
|
+
var oContext = oEvent.getParameter("context");
|
|
916
|
+
var bExecuteOnSelect = oEvent.getParameter("executeOnSelect");
|
|
917
|
+
|
|
918
|
+
if (oContext === undefined && bExecuteOnSelect) {
|
|
919
|
+
collapseHeader();
|
|
920
|
+
}
|
|
921
|
+
|
|
912
922
|
fnRestoreExtendedFilterDataOnAfterSFBVariantLoad(oEvent);
|
|
913
923
|
}
|
|
914
924
|
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
<template:with path="entityType>com.sap.vocabularies.UI.v1.HeaderInfo" var="header">
|
|
10
10
|
<smartChart:SmartChart
|
|
11
|
-
id="listReport{= ${parameter>/settings/quickVariantSelectionX} ? ${path: 'tabItem>', formatter: 'AH.getSuffixFromIconTabFilterKey'} : ''}"
|
|
11
|
+
id="listReport{= ${parameter>/settings/quickVariantSelectionX} ? ${path: 'tabItem>', formatter: 'AH.getSuffixFromIconTabFilterKey'} : ''}"
|
|
12
|
+
afterVariantInitialise="._templateEventHandlers.onAfterVariantInitialise"
|
|
12
13
|
visible="{path: 'tabItem>', formatter: 'AHMultipleViews.getVisibleForTableTabs'}"
|
|
13
14
|
smartFilterId=""
|
|
14
15
|
persistencyKey="listReportChart{= ${parameter>/settings/quickVariantSelectionX} ? ${path: 'tabItem>', formatter: 'AH.getSuffixFromIconTabFilterKey'} : ''}"
|
|
@@ -17,8 +17,9 @@
|
|
|
17
17
|
<template:with path="tableAnnotationPath>" helper="AH.searchForFirstSemKey_Title_Description" var="targetColumn">
|
|
18
18
|
<template:with path="parameter>/" helper="StableIdHelper.preparePathForStableId" var="smartControlId">
|
|
19
19
|
<template:if test="{= ${smartControlId>}.buildStableId({type: 'ListReportTable', subType: 'SmartTable', sQuickVariantKey: ${tabItem>key}})}" />
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
<smarttable:SmartTable id="{smartControlId>id}" useDateRangeType="{= ${parameter>/settings/filterSettings/dateSettings/useDateRange} }"
|
|
21
|
+
afterVariantInitialise="._templateEventHandlers.onAfterVariantInitialise"
|
|
22
|
+
smartFilterId="{= ${parameter>/settings/quickVariantSelectionX} ? '' : 'listReportFilter'}"
|
|
22
23
|
visible="{path: 'tabItem>', formatter: 'AHMultipleViews.getVisibleForTableTabs'}"
|
|
23
24
|
initialise="._templateEventHandlers.onTableInit"
|
|
24
25
|
persistencyKey="{= ${path: 'parameter>/settings/routeConfig/', formatter: 'AH.getPersistencyKeyForSmartTable'} }{= ${parameter>/settings/quickVariantSelectionX} ? ${path: 'tabItem>', formatter: 'AH.getSuffixFromIconTabFilterKey'} : ''}"
|
|
@@ -2479,8 +2479,11 @@ sap.ui.define([
|
|
|
2479
2479
|
});
|
|
2480
2480
|
}
|
|
2481
2481
|
},
|
|
2482
|
-
|
|
2483
|
-
|
|
2482
|
+
handlers: {
|
|
2483
|
+
onAfterVariantInitialise: function(oEvent) {
|
|
2484
|
+
oTemplateUtils.oCommonUtils.getControlStateWrapper(oEvent.getSource()).onAfterVariantInitialise();
|
|
2485
|
+
},
|
|
2486
|
+
onEditAndActiveToggle: function () { // Implementation of draft toggle for static header
|
|
2484
2487
|
var oUIModel = oObjectPage.getModel("ui");
|
|
2485
2488
|
var bIsEditable = oUIModel.getProperty("/editable");
|
|
2486
2489
|
|
|
@@ -11,8 +11,9 @@
|
|
|
11
11
|
<template:if test="{:= ${smartChartId>}.set(AH.getStableIdPartFromFacet(${facet>}) + '::Chart') }"/>
|
|
12
12
|
<!-- Header Level for Smart Chart is hardcoded here with "H5" for fallback scenarios, After Section Title hiding logic, if required the level is calculated on the class /ObjectPage/controller/SectionTitleHandler.js-->
|
|
13
13
|
<!-- Header Style for Smart Chart is hardcoded here with "H5" for all Scenarios.-->
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
<smartChart:SmartChart
|
|
15
|
+
id="{smartChartId>value}"
|
|
16
|
+
afterVariantInitialise="._templateEventHandlers.onAfterVariantInitialise"
|
|
16
17
|
header="{chartAnnotation>Title/String}"
|
|
17
18
|
initialized="._templateEventHandlers.onChartInit"
|
|
18
19
|
requestAtLeastFields="{parts: [{path: 'chartAnnotation>'}, {path: 'entitySet>entityType'}], formatter: 'AH.getApplicablePathForChartToolbarActions'}"
|
|
@@ -16,8 +16,9 @@
|
|
|
16
16
|
<template:if test="{= ${smartControlId>}.buildStableId({type: 'ObjectPageTable', subType: 'SmartTable', sFacet: ${facetId>id}})}" />
|
|
17
17
|
<!-- Header Level for Smart Table is hardcoded here with "H5" for fallback scenarios, After Section Title hiding logic, if required the level is calculated on the class /ObjectPage/controller/SectionTitleHandler.js-->
|
|
18
18
|
<!-- Header Style for Smart Table is hardcoded here with "H5" for all Scenarios.-->
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
<st:SmartTable id="{smartControlId>id}"
|
|
20
|
+
afterVariantInitialise="._templateEventHandlers.onAfterVariantInitialise"
|
|
21
|
+
initialise="._templateEventHandlers.onTableInit($event, '{facetId>id}')"
|
|
21
22
|
persistencyKey="{parts: [{path: 'smartControlId>id'}, {path: 'objectPageTableSettings>value/persistencyKeyState'}], formatter: 'AH.getPersistencyKey'}"
|
|
22
23
|
tableBindingPath="{= ${path: 'target>AnnotationPath'}.slice(0, ${path: 'target>AnnotationPath'}.lastIndexOf('/')) }"
|
|
23
24
|
fitContainer="false"
|
|
@@ -8,18 +8,19 @@ sap.ui.define([
|
|
|
8
8
|
"sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/DynamicPageWrapper",
|
|
9
9
|
"sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/SmartVariantManagementWrapper",
|
|
10
10
|
"sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/ObjectPageLayoutWrapper",
|
|
11
|
-
"sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/SearchFieldWrapper"
|
|
11
|
+
"sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/SearchFieldWrapper",
|
|
12
|
+
"sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/PreliminaryWrapper"
|
|
12
13
|
], function (BaseObject, extend, controlHelper, SmartFilterBarWrapper, SmartTableWrapper, SmartChartWrapper,
|
|
13
|
-
DynamicPageWrapper, SmartVariantManagementWrapper, ObjectPageLayoutWrapper, SearchFieldWrapper) {
|
|
14
|
+
DynamicPageWrapper, SmartVariantManagementWrapper, ObjectPageLayoutWrapper, SearchFieldWrapper, PreliminaryWrapper) {
|
|
14
15
|
"use strict";
|
|
15
|
-
|
|
16
|
+
|
|
16
17
|
/**
|
|
17
18
|
* Dummy wrapper for not existing or not (yet) supported controls (either not carrying a state or to be added in future). Also used as interface description for wrapper classes.
|
|
18
19
|
*/
|
|
19
20
|
var oDummyWrapper = {
|
|
20
21
|
/**
|
|
21
22
|
* Retrieve the current state of the control
|
|
22
|
-
*
|
|
23
|
+
*
|
|
23
24
|
* @return {object} serializable json object describing the current state of the control. Will be provided to setState exactly the same when restoring the state. Note: Structure of this object
|
|
24
25
|
* is up to the wrapper, no one outside will rely on it - with one exception: legacyStateHandler translates legacy states (without clear separation per control) to this format. Open:
|
|
25
26
|
* Should legacyStateHandler be responsible for providing most current version, or only first control specific version (i.e. first version using wrapper), and wrapper should be
|
|
@@ -28,7 +29,7 @@ sap.ui.define([
|
|
|
28
29
|
getState: Function.prototype,
|
|
29
30
|
/**
|
|
30
31
|
* Restore the control to the given state
|
|
31
|
-
*
|
|
32
|
+
*
|
|
32
33
|
* @param {object} oState json object describing the state as provided by getState. Note: can also be undefined, if an old state is restored (from a release where the state of this control was
|
|
33
34
|
* not stored), if a state is provided in the URL that cannot be read (anymore), or on OP in discovery mode, if the user navigates to a new object instance - in these cases, the
|
|
34
35
|
* control has to be brought (back) into its initial state. Currently, expectation is the state to be restored synchronously. Planned:
|
|
@@ -40,13 +41,13 @@ sap.ui.define([
|
|
|
40
41
|
* wrapper must provide an event to indicate a state change. Must be called whenever a user interacts with the control to change its state, but not when state is changed programmatically (e.g.
|
|
41
42
|
* from setState, or when user interacts with a different control causing also this one to change (in that case, the event from the other control should be called) Function to register for that
|
|
42
43
|
* event
|
|
43
|
-
*
|
|
44
|
+
*
|
|
44
45
|
* @param {function} fnHandler event handler function being attached
|
|
45
46
|
*/
|
|
46
47
|
attachStateChanged: Function.prototype,
|
|
47
48
|
/**
|
|
48
49
|
* Function to deregister from event. Currently not used, but should be provided for symmetry reasons.
|
|
49
|
-
*
|
|
50
|
+
*
|
|
50
51
|
* @param {function} fnHandler event handler function being attached. Should only be deregistered, if provided exactly like in registration
|
|
51
52
|
*/
|
|
52
53
|
detachStateChanged: Function.prototype,
|
|
@@ -57,7 +58,7 @@ sap.ui.define([
|
|
|
57
58
|
|
|
58
59
|
/**
|
|
59
60
|
* Returns true if the state provided as argument is same as the state applied.
|
|
60
|
-
* @param {Object} oState State object which needs to be checked against the current
|
|
61
|
+
* @param {Object} oState State object which needs to be checked against the current
|
|
61
62
|
* state of the wrapper.
|
|
62
63
|
* @returns {boolean} True in case State object passed as argument match with current state else false.
|
|
63
64
|
*/
|
|
@@ -90,15 +91,65 @@ sap.ui.define([
|
|
|
90
91
|
};
|
|
91
92
|
return extend({}, oWrapper, oOverride);
|
|
92
93
|
}
|
|
93
|
-
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Private helper function to create the real wrapper based on control and type.
|
|
97
|
+
* This function is injected into PreliminaryWrapper and not exposed in the factory's public API.
|
|
98
|
+
*
|
|
99
|
+
* @param {sap.ui.core.Control} oControl - The control instance
|
|
100
|
+
* @param {string} sType - The type of control (e.g., "SmartTable", "SmartChart")
|
|
101
|
+
* @param {object} [mParams] - Additional parameters passed to constructor of wrapper
|
|
102
|
+
* @return {object} The real wrapper object for the control with helper methods attached
|
|
103
|
+
*/
|
|
104
|
+
function fnCreateRealWrapper(oControl, sType, mParams) {
|
|
105
|
+
var oWrapper;
|
|
106
|
+
switch (sType) {
|
|
107
|
+
case "SmartFilterBar":
|
|
108
|
+
oWrapper = new SmartFilterBarWrapper(oControl, oFactory, mParams);
|
|
109
|
+
break;
|
|
110
|
+
case "SmartTable":
|
|
111
|
+
oWrapper = new SmartTableWrapper(oControl, oController, oFactory);
|
|
112
|
+
break;
|
|
113
|
+
case "SmartChart":
|
|
114
|
+
oWrapper = new SmartChartWrapper(oControl, oController, oFactory);
|
|
115
|
+
break;
|
|
116
|
+
case "DynamicPage":
|
|
117
|
+
oWrapper = new DynamicPageWrapper(oControl);
|
|
118
|
+
break;
|
|
119
|
+
case "SmartVariantManagement":
|
|
120
|
+
oWrapper = new SmartVariantManagementWrapper(oControl, oController, oFactory, mParams);
|
|
121
|
+
break;
|
|
122
|
+
case "ObjectPageLayout":
|
|
123
|
+
oWrapper = new ObjectPageLayoutWrapper(oControl);
|
|
124
|
+
break;
|
|
125
|
+
case "SearchField":
|
|
126
|
+
oWrapper = new SearchFieldWrapper(oControl);
|
|
127
|
+
break;
|
|
128
|
+
default:
|
|
129
|
+
// control not carrying a state or no wrapper built yet
|
|
130
|
+
oWrapper = oDummyWrapper;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Add helper methods to the real wrapper
|
|
134
|
+
var sId = oController.getView().getLocalId(oControl.getId());
|
|
135
|
+
oWrapper.getLocalId = function() { return sId; };
|
|
136
|
+
oWrapper.isCurrentState = oWrapper.isCurrentState || function (oState) {
|
|
137
|
+
return JSON.stringify(oState) === JSON.stringify(oWrapper.getState());
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
return oWrapper;
|
|
141
|
+
}
|
|
142
|
+
|
|
94
143
|
var oFactory = {
|
|
95
144
|
getSuppressChangeEventWhenApplyingWrapper: getSuppressChangeEventWhenApplyingWrapper,
|
|
145
|
+
|
|
96
146
|
/**
|
|
97
|
-
* Factory function to generate control wrapper object based on control type
|
|
98
|
-
*
|
|
147
|
+
* Factory function to generate control wrapper object based on control type.
|
|
148
|
+
* Always returns a PreliminaryWrapper, which delegates to the real wrapper internally.
|
|
149
|
+
*
|
|
99
150
|
* @param {sap.ui.core.Control} oControl - control a wrapper should be provided for
|
|
100
151
|
* @param {object} [mParams] - map with any additional parameters passed to constructor of wrapper
|
|
101
|
-
* @return {object} wrapper object for the control
|
|
152
|
+
* @return {object} wrapper object for the control (always a PreliminaryWrapper)
|
|
102
153
|
*/
|
|
103
154
|
getControlStateWrapper: function (oControl, mParams) {
|
|
104
155
|
// checking for control here (instead of at all callers) allows simple use for optional controls
|
|
@@ -107,52 +158,63 @@ sap.ui.define([
|
|
|
107
158
|
// no need to add the dummy to the map
|
|
108
159
|
return oDummyWrapper;
|
|
109
160
|
}
|
|
110
|
-
var sId =
|
|
161
|
+
var sId = oController.getView().getLocalId(oControl.getId());
|
|
162
|
+
|
|
111
163
|
if (!mWrappers[sId]) {
|
|
112
|
-
|
|
164
|
+
// Determine control type
|
|
165
|
+
var sType;
|
|
113
166
|
switch (true) {
|
|
114
167
|
case controlHelper.isSmartFilterBar(oControl):
|
|
115
|
-
|
|
168
|
+
sType = "SmartFilterBar";
|
|
116
169
|
break;
|
|
117
170
|
case controlHelper.isSmartTable(oControl):
|
|
118
|
-
|
|
171
|
+
sType = "SmartTable";
|
|
119
172
|
break;
|
|
120
173
|
case controlHelper.isSmartChart(oControl):
|
|
121
|
-
|
|
174
|
+
sType = "SmartChart";
|
|
122
175
|
break;
|
|
123
176
|
case controlHelper.isDynamicPage(oControl):
|
|
124
|
-
|
|
177
|
+
sType = "DynamicPage";
|
|
125
178
|
break;
|
|
126
179
|
case controlHelper.isSmartVariantManagement(oControl):
|
|
127
|
-
|
|
180
|
+
sType = "SmartVariantManagement";
|
|
128
181
|
break;
|
|
129
182
|
case controlHelper.isObjectObjectPageLayout(oControl):
|
|
130
|
-
|
|
183
|
+
sType = "ObjectPageLayout";
|
|
131
184
|
break;
|
|
132
185
|
case controlHelper.isSearchField(oControl):
|
|
133
|
-
|
|
186
|
+
sType = "SearchField";
|
|
134
187
|
break;
|
|
135
188
|
default:
|
|
136
|
-
// control not carrying a state or no wrapper
|
|
137
|
-
|
|
189
|
+
// control not carrying a state or no wrapper built yet
|
|
190
|
+
return oDummyWrapper;
|
|
138
191
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
192
|
+
|
|
193
|
+
// Always create a PreliminaryWrapper
|
|
194
|
+
var oPreliminaryWrapper = new PreliminaryWrapper(sId, sType, fnCreateRealWrapper, oController, mParams);
|
|
195
|
+
|
|
196
|
+
// Since control is available, immediately set it
|
|
197
|
+
oPreliminaryWrapper.setControl(oControl);
|
|
198
|
+
|
|
199
|
+
// Store the PreliminaryWrapper in map (not the real wrapper)
|
|
200
|
+
mWrappers[sId] = oPreliminaryWrapper;
|
|
201
|
+
} else if (mWrappers[sId].setControl) {
|
|
202
|
+
// PreliminaryWrapper already exists but control wasn't set yet - set it now
|
|
203
|
+
mWrappers[sId].setControl(oControl);
|
|
145
204
|
}
|
|
205
|
+
|
|
146
206
|
return mWrappers[sId];
|
|
147
207
|
},
|
|
148
208
|
|
|
149
209
|
/**
|
|
150
|
-
* Factory function to generate control wrapper object based on control type
|
|
151
|
-
*
|
|
152
|
-
*
|
|
210
|
+
* Factory function to generate control wrapper object based on control ID and type.
|
|
211
|
+
* Creates a PreliminaryWrapper when the control doesn't exist yet (e.g., lazy loading).
|
|
212
|
+
* Always returns a PreliminaryWrapper, which delegates to the real wrapper internally.
|
|
213
|
+
*
|
|
214
|
+
* @param {string} sControlId - ID of the control for which wrapper needs to be initiated
|
|
153
215
|
* @param {string} sControlType - Type of the control for which wrapper needs to be initiated
|
|
154
216
|
* @param {object} [mParams] - map with any additional parameters passed to constructor of wrapper
|
|
155
|
-
* @return {object} wrapper object for the control
|
|
217
|
+
* @return {object} wrapper object for the control (always a PreliminaryWrapper)
|
|
156
218
|
*/
|
|
157
219
|
getControlStateWrapperById: function (sControlId, sControlType, mParams) {
|
|
158
220
|
// checking for control here (instead of at all callers) allows simple use for optional controls
|
|
@@ -161,40 +223,12 @@ sap.ui.define([
|
|
|
161
223
|
// no need to add the dummy to the map
|
|
162
224
|
return oDummyWrapper;
|
|
163
225
|
}
|
|
164
|
-
var sId =
|
|
226
|
+
var sId = oController.getView().getLocalId(sControlId);
|
|
165
227
|
if (!mWrappers[sId]) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
break;
|
|
171
|
-
case "SmartTable":
|
|
172
|
-
oWrapper = new SmartTableWrapper(sControlId, oController, oFactory);
|
|
173
|
-
break;
|
|
174
|
-
case "SmartChart":
|
|
175
|
-
oWrapper = new SmartChartWrapper(sControlId, oController, oFactory);
|
|
176
|
-
break;
|
|
177
|
-
case "DynamicPage":
|
|
178
|
-
oWrapper = new DynamicPageWrapper();
|
|
179
|
-
break;
|
|
180
|
-
case "SmartVariantManagement":
|
|
181
|
-
oWrapper = new SmartVariantManagementWrapper(sControlId, oController, oFactory, mParams);
|
|
182
|
-
break;
|
|
183
|
-
case "ObjectPageLayout":
|
|
184
|
-
oWrapper = new ObjectPageLayoutWrapper(sControlId);
|
|
185
|
-
break;
|
|
186
|
-
case "SearchField":
|
|
187
|
-
oWrapper = new SearchFieldWrapper(sControlId);
|
|
188
|
-
break;
|
|
189
|
-
default:
|
|
190
|
-
// control not carrying a state or no wrapper build yet
|
|
191
|
-
oWrapper = oDummyWrapper;
|
|
192
|
-
}
|
|
193
|
-
oWrapper.getLocalId = function() { return sId; };
|
|
194
|
-
oWrapper.isCurrentState = oWrapper.isCurrentState || function (oState) {
|
|
195
|
-
return JSON.stringify(oState) === JSON.stringify(oWrapper.getState());
|
|
196
|
-
};
|
|
197
|
-
mWrappers[sId] = oWrapper;
|
|
228
|
+
// Create a PreliminaryWrapper (control will be set later)
|
|
229
|
+
var oPreliminaryWrapper = new PreliminaryWrapper(sId, sControlType, fnCreateRealWrapper, oController, mParams);
|
|
230
|
+
|
|
231
|
+
mWrappers[sId] = oPreliminaryWrapper;
|
|
198
232
|
}
|
|
199
233
|
return mWrappers[sId];
|
|
200
234
|
}
|
|
@@ -207,4 +241,4 @@ sap.ui.define([
|
|
|
207
241
|
extend(this, getMethods(oController));
|
|
208
242
|
}
|
|
209
243
|
});
|
|
210
|
-
});
|
|
244
|
+
});
|