@sapui5/sap.suite.ui.generic.template 1.108.48 → 1.108.49
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/ListReport/controller/ControllerImplementation.js +15 -9
- package/src/sap/suite/ui/generic/template/ListReport/controller/IappStateHandler.js +18 -9
- package/src/sap/suite/ui/generic/template/ListReport/view/fragments/SmartChart.fragment.xml +3 -2
- package/src/sap/suite/ui/generic/template/ListReport/view/fragments/SmartTable.fragment.xml +2 -1
- package/src/sap/suite/ui/generic/template/ObjectPage/controller/ControllerImplementation.js +4 -1
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_pt.properties +1 -1
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_sh.properties +1 -1
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_sr.properties +1 -1
- package/src/sap/suite/ui/generic/template/ObjectPage/view/fragments/SmartChart.fragment.xml +1 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/view/fragments/SmartTable.fragment.xml +2 -1
- package/src/sap/suite/ui/generic/template/genericUtilities/ControlStateWrapperFactory.js +102 -68
- 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 +76 -99
- package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/SmartTableChartCommon.js +105 -91
- package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/SmartTableWrapper.js +10 -2
- package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/SmartVariantManagementWrapper.js +83 -76
- package/src/sap/suite/ui/generic/template/js/AnnotationHelperStreamSupport.js +25 -6
- package/src/sap/suite/ui/generic/template/lib/AppComponent.js +1 -1
- package/src/sap/suite/ui/generic/template/lib/CommonUtils.js +5 -5
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_zh_CN.properties +1 -1
- package/src/sap/suite/ui/generic/template/lib/navigation/NavigationController.js +4 -4
- package/src/sap/suite/ui/generic/template/library.js +1 -1
package/package.json
CHANGED
|
@@ -51,7 +51,7 @@ sap.ui.define([
|
|
|
51
51
|
|
|
52
52
|
function onSmartFilterBarInitialise(oEvent) {
|
|
53
53
|
var oSmartFilterbar = oEvent.getSource();
|
|
54
|
-
// Apply filter defaults from the Selection Variant Annotation.
|
|
54
|
+
// Apply filter defaults from the Selection Variant Annotation.
|
|
55
55
|
var sAnnotationPath = oController.getOwnerComponent().getAnnotationPath();
|
|
56
56
|
if (sAnnotationPath !== undefined) {
|
|
57
57
|
fnApplyFilterDefaultsFromSV(oSmartFilterbar, sAnnotationPath);
|
|
@@ -137,7 +137,7 @@ sap.ui.define([
|
|
|
137
137
|
}
|
|
138
138
|
oTemplateUtils.oCommonEventHandlers.onSemanticObjectLinkNavigationTargetObtained(oState.oPresentationControlHandler.getEntitySet(), {}, oEventParameters, oState, sTitle);
|
|
139
139
|
}
|
|
140
|
-
|
|
140
|
+
|
|
141
141
|
function getItemInTable(sContextPath) {
|
|
142
142
|
var aItems = oViewProxy.getItems();
|
|
143
143
|
for (var i = 0; i < aItems.length; i++) {
|
|
@@ -321,7 +321,7 @@ sap.ui.define([
|
|
|
321
321
|
shareTilePressed: function() {
|
|
322
322
|
ShareUtils.fireBookMarkPress();
|
|
323
323
|
},
|
|
324
|
-
|
|
324
|
+
|
|
325
325
|
getDownloadUrl: function () {
|
|
326
326
|
var oBinding = oState.oPresentationControlHandler.getBinding(oState);
|
|
327
327
|
return oBinding && oBinding.getDownloadUrl() || "";
|
|
@@ -346,7 +346,7 @@ sap.ui.define([
|
|
|
346
346
|
var oMetadata = oController.getOwnerComponent().getAppComponent().getMetadata();
|
|
347
347
|
var oUIManifest = oMetadata.getManifestEntry("sap.ui");
|
|
348
348
|
var oAppManifest = oMetadata.getManifestEntry("sap.app");
|
|
349
|
-
|
|
349
|
+
|
|
350
350
|
return oFragmentController.getServiceUrl().then(function(sServiceUrl) {
|
|
351
351
|
return ShareUtils.getCurrentUrl().then(function (sCurrentUrl) {
|
|
352
352
|
return {
|
|
@@ -473,6 +473,9 @@ sap.ui.define([
|
|
|
473
473
|
});
|
|
474
474
|
}
|
|
475
475
|
|
|
476
|
+
// Expose selected private functions to unit tests
|
|
477
|
+
/* eslint-enable */
|
|
478
|
+
|
|
476
479
|
// Generation of Event Handlers
|
|
477
480
|
return {
|
|
478
481
|
onInit: function () {
|
|
@@ -488,10 +491,10 @@ sap.ui.define([
|
|
|
488
491
|
var oMultipleViewsHandler = new MultipleViewsHandler(oState, oController, oTemplateUtils);
|
|
489
492
|
oState.oMultipleViewsHandler = oMultipleViewsHandler;
|
|
490
493
|
oState.oMessageStripHelper = new MessageStripHelper(oState.oPresentationControlHandler, oMultipleViewsHandler, oController, oTemplateUtils, "listReport");
|
|
491
|
-
// proxy for oCommonUtils.refreshModel that ensures that also the other SmartTable instances
|
|
492
|
-
// pointing to the same entity set will be refreshed
|
|
494
|
+
// proxy for oCommonUtils.refreshModel that ensures that also the other SmartTable instances
|
|
495
|
+
// pointing to the same entity set will be refreshed
|
|
493
496
|
oState.refreshModel = function () {
|
|
494
|
-
/* getEntitySet should not be a method of PresentationControlHandler. For more details, refer to the comment
|
|
497
|
+
/* getEntitySet should not be a method of PresentationControlHandler. For more details, refer to the comment
|
|
495
498
|
mentioned before the method's definition in the class */
|
|
496
499
|
var bIsInvalidating = oTemplateUtils.oCommonUtils.refreshModel(oState.oPresentationControlHandler.getEntitySet());
|
|
497
500
|
if (bIsInvalidating) {
|
|
@@ -502,7 +505,7 @@ sap.ui.define([
|
|
|
502
505
|
oState.oWorklistHandler = new WorklistHandler(oState, oController, oTemplateUtils);
|
|
503
506
|
oState.oIappStateHandler = new IappStateHandler(oState, oController, oTemplateUtils);
|
|
504
507
|
oState.oMultiEditHandler = new MultiEditHandler(oState, oController, oTemplateUtils);
|
|
505
|
-
|
|
508
|
+
|
|
506
509
|
|
|
507
510
|
var oTemplatePrivateModel = oTemplateUtils.oComponentUtils.getTemplatePrivateModel();
|
|
508
511
|
oTemplatePrivateModel.setProperty("/generic/bDataAreShownInTable", false);
|
|
@@ -525,7 +528,7 @@ sap.ui.define([
|
|
|
525
528
|
|
|
526
529
|
// initialise the message trip in LR to be hidden on load
|
|
527
530
|
oTemplatePrivateModel.setProperty("/listReport/multipleViews/msgVisibility", false);
|
|
528
|
-
|
|
531
|
+
|
|
529
532
|
oViewProxy.adaptToChildContext = function(sCurrentChildContext) {
|
|
530
533
|
oState.oPresentationControlHandler.scrollToSelectedItemAsPerChildContext(sCurrentChildContext);
|
|
531
534
|
};
|
|
@@ -597,6 +600,9 @@ sap.ui.define([
|
|
|
597
600
|
},
|
|
598
601
|
|
|
599
602
|
handlers: {
|
|
603
|
+
onAfterVariantInitialise: function(oEvent) {
|
|
604
|
+
oTemplateUtils.oCommonUtils.getControlStateWrapper(oEvent.getSource()).onAfterVariantInitialise();
|
|
605
|
+
},
|
|
600
606
|
addEntry: addEntry,
|
|
601
607
|
addEntryWithFilters: addEntryWithFilters,
|
|
602
608
|
deleteEntries: fnDeleteEntries,
|
|
@@ -209,12 +209,6 @@ sap.ui.define([
|
|
|
209
209
|
// However, for iAppState case, SVM wrapper also needs to contain SFB wrapper (and not oCustomFiltersWrapper directly)
|
|
210
210
|
|
|
211
211
|
|
|
212
|
-
// DynamicPage state: header pinned
|
|
213
|
-
var oDynamicPage = oController.byId(StableIdHelper.getStableId({type: "ListReportPage", subType: "DynamicPage"}));
|
|
214
|
-
// TODO: Discuss: should this state (header pinned) be part of variant (only page variant or SFB variant)? Assumption: no
|
|
215
|
-
var oDynamicPageWrapper = oTemplateUtils.oCommonUtils.getControlStateWrapper(oDynamicPage);
|
|
216
|
-
aControlStateWrappers.push(oDynamicPageWrapper);
|
|
217
|
-
|
|
218
212
|
// SmartVariantManagement state: Selected Variant and whether it's dirty, including wrappers for managed controls (all controls, for which the corresponding state
|
|
219
213
|
// information should be part of the variant)
|
|
220
214
|
// Due to direct connection between SVM and SFB, also their wrappers need to each other directly. Remarks:
|
|
@@ -224,14 +218,19 @@ sap.ui.define([
|
|
|
224
218
|
var oSmartVariantManagement = oState.oSmartFilterbar.getSmartVariant();
|
|
225
219
|
if (oSmartVariantManagement){
|
|
226
220
|
var oSmartVariantManagementWrapper = oTemplateUtils.oCommonUtils.getControlStateWrapper(oSmartVariantManagement, {
|
|
227
|
-
managedControlWrappers: aPageVariantControlStateWrappers.concat([oSmartFilterBarWrapper])
|
|
228
|
-
dynamicPageWrapper: oDynamicPageWrapper
|
|
221
|
+
managedControlWrappers: aPageVariantControlStateWrappers.concat([oSmartFilterBarWrapper])
|
|
229
222
|
});
|
|
230
223
|
aControlStateWrappers.push(oSmartVariantManagementWrapper);
|
|
231
224
|
} else {
|
|
232
225
|
aControlStateWrappers.push(oSmartFilterBarWrapper);
|
|
233
226
|
}
|
|
234
227
|
|
|
228
|
+
// DynamicPage state: header pinned
|
|
229
|
+
var oDynamicPage = oController.byId(StableIdHelper.getStableId({type: "ListReportPage", subType: "DynamicPage"}));
|
|
230
|
+
// The DynamicPage state (header pinned) is intentionally stored only in iAppState and not included in any variant (neither page variant nor SFB variant).
|
|
231
|
+
var oDynamicPageWrapper = oTemplateUtils.oCommonUtils.getControlStateWrapper(oDynamicPage);
|
|
232
|
+
aControlStateWrappers.push(oDynamicPageWrapper);
|
|
233
|
+
|
|
235
234
|
|
|
236
235
|
// Wrapper to control whether data is loaded
|
|
237
236
|
|
|
@@ -778,7 +777,8 @@ sap.ui.define([
|
|
|
778
777
|
// For desktop devices, expand the header for Standard and Custom variants and for tablet and mobile devices,
|
|
779
778
|
// collapse the header only if search is triggered.
|
|
780
779
|
if (Device.system.desktop) {
|
|
781
|
-
|
|
780
|
+
var oTemplatePrivateModel = oTemplateUtils.oComponentUtils.getTemplatePrivateModel();
|
|
781
|
+
oTemplatePrivateModel.setProperty("/listReport/isHeaderExpanded", true);
|
|
782
782
|
} else {
|
|
783
783
|
collapseHeader();
|
|
784
784
|
}
|
|
@@ -891,6 +891,15 @@ sap.ui.define([
|
|
|
891
891
|
// regarding a), while SFB takes care to set the data for standard filters (created via annotation), for others (extension filters, edit state filter, anything else that
|
|
892
892
|
// should be controlled by VM (currently anything else we add to iAppState, but maybe that's only correct in case of page variant management)) we have to set it
|
|
893
893
|
// (independent of the context).
|
|
894
|
+
// Restore header collapse logic (originally removed in change 5641712)
|
|
895
|
+
// Collapse header when user manually selects a variant (context === undefined) that has executeOnSelect set to true
|
|
896
|
+
var oContext = oEvent.getParameter("context");
|
|
897
|
+
var bExecuteOnSelect = oEvent.getParameter("executeOnSelect");
|
|
898
|
+
|
|
899
|
+
if (oContext === undefined && bExecuteOnSelect) {
|
|
900
|
+
collapseHeader();
|
|
901
|
+
}
|
|
902
|
+
|
|
894
903
|
fnRestoreExtendedFilterDataOnAfterSFBVariantLoad(oEvent);
|
|
895
904
|
}
|
|
896
905
|
|
|
@@ -9,8 +9,9 @@
|
|
|
9
9
|
xmlns:smartChart="sap.ui.comp.smartchart">
|
|
10
10
|
<template:with path="entityType>com.sap.vocabularies.UI.v1.HeaderInfo" var="header">
|
|
11
11
|
<smartChart:SmartChart
|
|
12
|
-
id="listReport{= ${parameter>/settings/quickVariantSelectionX} ? ${path: 'tabItem>', formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getSuffixFromIconTabFilterKey'} : ''}"
|
|
13
|
-
|
|
12
|
+
id="listReport{= ${parameter>/settings/quickVariantSelectionX} ? ${path: 'tabItem>', formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getSuffixFromIconTabFilterKey'} : ''}"
|
|
13
|
+
afterVariantInitialise="._templateEventHandlers.onAfterVariantInitialise"
|
|
14
|
+
visible="{path: 'tabItem>', formatter: 'AHMultipleViews.getVisibleForTableTabs'}"
|
|
14
15
|
smartFilterId=""
|
|
15
16
|
persistencyKey="listReportChart{= ${parameter>/settings/quickVariantSelectionX} ? ${path: 'tabItem>', formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getSuffixFromIconTabFilterKey'} : ''}"
|
|
16
17
|
header="{path: 'header>TypeNamePlural', formatter: 'sap.ui.model.odata.AnnotationHelper.format'}"
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
<template:with path="parameter>/" helper="sap.suite.ui.generic.template.js.StableIdHelper.preparePathForStableId" var="smartTableId">
|
|
11
11
|
<template:if test="{= ${smartTableId>}.buildStableId({type: 'ListReportTable', subType: 'SmartTable', sQuickVariantKey: ${tabItem>key}})}" />
|
|
12
12
|
<smarttable:SmartTable id="{smartTableId>id}"
|
|
13
|
+
afterVariantInitialise="._templateEventHandlers.onAfterVariantInitialise"
|
|
13
14
|
smartFilterId="{= ${parameter>/settings/quickVariantSelectionX} ? '' : 'listReportFilter'}"
|
|
14
15
|
visible="{path: 'tabItem>', formatter: 'sap.suite.ui.generic.template.js.AnnotationHelperMultipleViews.getVisibleForTableTabs'}"
|
|
15
16
|
initialise="._templateEventHandlers.onTableInit"
|
|
@@ -204,7 +205,7 @@
|
|
|
204
205
|
<template:else >
|
|
205
206
|
<Table id="{:= ${parameter>/stableId}.getStableId({type: 'ListReportTable', subType: 'ResponsiveTable', sQuickVariantKey: ${tabItem>key}})}"
|
|
206
207
|
showOverlay="{= ${_templPriv>/listReport/firstSelection} && !${_templPriv>/generic/bDataAreShownInTable}}"
|
|
207
|
-
fixedLayout="{= !${appSettings>/enableAutoColumnWidthForSmartTable} ? (${parameter>/settings/isWorklist} ? true : false) : undefined}"
|
|
208
|
+
fixedLayout="{= !${appSettings>/enableAutoColumnWidthForSmartTable} ? (${parameter>/settings/isWorklist} ? true : false) : undefined}"
|
|
208
209
|
growing="true" growingScrollToLoad="true"
|
|
209
210
|
sticky="ColumnHeaders,HeaderToolbar"
|
|
210
211
|
mode="{tableSettings>mode}"
|
|
@@ -2271,7 +2271,10 @@ sap.ui.define([
|
|
|
2271
2271
|
}
|
|
2272
2272
|
},
|
|
2273
2273
|
handlers: {
|
|
2274
|
-
|
|
2274
|
+
onAfterVariantInitialise: function(oEvent) {
|
|
2275
|
+
oTemplateUtils.oCommonUtils.getControlStateWrapper(oEvent.getSource()).onAfterVariantInitialise();
|
|
2276
|
+
},
|
|
2277
|
+
onEditAndActiveToggle: function () { // Implementation of draft toggle for static header
|
|
2275
2278
|
var oUIModel = oObjectPage.getModel("ui");
|
|
2276
2279
|
var bIsEditable = oUIModel.getProperty("/editable");
|
|
2277
2280
|
oTemplateUtils.oServices.oApplication.performAfterSideEffectExecution(function () {
|
|
@@ -21,7 +21,7 @@ SAVE=\u0421\u0430\u0447\u0443\u0432\u0430\u0458
|
|
|
21
21
|
|
|
22
22
|
SAVE_AND_EDIT=\u0421\u0430\u0447\u0443\u0432\u0430\u0458 \u0438 \u0443\u0440\u0435\u0434\u0438
|
|
23
23
|
|
|
24
|
-
SAVE_AND_NEXT=\u0421\u0430\u0447\u0443\u0432\u0430\u0458 \u0438 \u0441\u043B\u0435\u0434\u0435\u045B\u0435
|
|
24
|
+
SAVE_AND_NEXT=\u0421\u0430\u0447\u0443\u0432\u0430\u0458 \u0438 \u0438\u0434\u0438 \u043D\u0430 \u0441\u043B\u0435\u0434\u0435\u045B\u0435
|
|
25
25
|
|
|
26
26
|
CREATE=\u041A\u0440\u0435\u0438\u0440\u0430\u0458
|
|
27
27
|
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
<template:if test="{:= ${smartChartId>}.set(AH.getStableIdPartFromFacet(${facet>}) + '::Chart') }"/>
|
|
18
18
|
<smartChart:SmartChart
|
|
19
19
|
id="{smartChartId>value}"
|
|
20
|
+
afterVariantInitialise="._templateEventHandlers.onAfterVariantInitialise"
|
|
20
21
|
header="{chartAnnotation>Title/String}"
|
|
21
22
|
initialized="._templateEventHandlers.onChartInit"
|
|
22
23
|
requestAtLeastFields="{parts: [{path: 'chartAnnotation>'}, {path: 'entitySet>entityType'}], formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getApplicablePathForChartToolbarActions'}"
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
<template:if test="{= ${facetId>}.buildStableId({type: 'ObjectPage', subType: 'Facet', sRecordType: ${facet>RecordType}, sAnnotationPath: ${facet>Target/AnnotationPath}, sAnnotationId: ${facet>ID/String}, bIsHeaderFacet: ${isHeaderFacet>value}})}"/>
|
|
17
17
|
<template:if test="{= ${smartTableId>}.buildStableId({type: 'ObjectPageTable', subType: 'SmartTable', sFacet: ${facetId>id}})}" />
|
|
18
18
|
<st:SmartTable id="{smartTableId>id}"
|
|
19
|
+
afterVariantInitialise="._templateEventHandlers.onAfterVariantInitialise"
|
|
19
20
|
initialise="._templateEventHandlers.onTableInit($event, '{facetId>id}')"
|
|
20
21
|
persistencyKey="{parts: [{path: 'smartTableId>id'}, {path: 'objectPageTableSettings>value/persistencyKeyState'}], formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.getPersistencyKey'}"
|
|
21
22
|
tableBindingPath="{= ${path: 'target>AnnotationPath'}.slice(0, ${path: 'target>AnnotationPath'}.lastIndexOf('/')) }"
|
|
@@ -117,7 +118,7 @@
|
|
|
117
118
|
<st:customData>
|
|
118
119
|
<core:CustomData key="inlineCreate" value="{parts: [{path: 'facet>'}, {path: 'parameter>/settings/sections'}, {value: 'inline'}], formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.isInlineMode'}" />
|
|
119
120
|
<core:CustomData key="disableInlineCreateSort" value="{parts: [{path: 'facet>'}, {path: 'parameter>/settings/sections'}], formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.isInlineCreateSorting'}" />
|
|
120
|
-
<core:CustomData key="inlineCreationRows" value="{parts: [{path: 'facet>'}, {path: 'parameter>/settings/sections'}, {value: 'creationRows'}], formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.isInlineMode'}" />
|
|
121
|
+
<core:CustomData key="inlineCreationRows" value="{parts: [{path: 'facet>'}, {path: 'parameter>/settings/sections'}, {value: 'creationRows'}], formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.isInlineMode'}" />
|
|
121
122
|
<core:CustomData key="isEntityCreatableUsingBooleanRestrictions" value="{= ${parts: [{path: 'listEntitySet>Org.OData.Capabilities.V1.InsertRestrictions'}, {path: 'listEntitySet>'}, {value: 'Insertable'}, {path: 'entitySet>name'}], formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.areBooleanRestrictionsValidAndPossible'}}"/>
|
|
122
123
|
<core:CustomData key="isEntityCreatableUsingPathRestrictions" value="{= ${parts: [{path: 'entitySet>'}, {path: 'listEntitySet>'}, {path: 'parameter>/settings/subPages/'}, {path: 'facet>'}, {path: 'parameter>/settings/sections'}, {path: 'parameter>/isDraftEnabled'}, {path: 'objectPageTableSettings>value/createWithParameterDialog'}], formatter: 'sap.suite.ui.generic.template.js.AnnotationHelper.isRelatedEntityCreatable'}}"/>
|
|
123
124
|
</st:customData>
|
|
@@ -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
|
-
*
|
|
99
|
-
*
|
|
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
|
+
*
|
|
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
|
+
});
|
|
@@ -2,67 +2,35 @@ sap.ui.define([
|
|
|
2
2
|
], function() {
|
|
3
3
|
"use strict";
|
|
4
4
|
|
|
5
|
-
function DynamicPageWrapper(
|
|
6
|
-
var oDynamicPage;
|
|
7
|
-
var oPreliminaryState;
|
|
8
|
-
var oControlAssignedResolve;
|
|
9
|
-
var oControlAssignedPromise = new Promise(function(resolve) {
|
|
10
|
-
oControlAssignedResolve = resolve;
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
if (typeof vTarget !== "string") {
|
|
14
|
-
fnSetControl(vTarget);
|
|
15
|
-
}
|
|
16
|
-
|
|
5
|
+
function DynamicPageWrapper(oDynamicPage) {
|
|
17
6
|
// Returns the state of the dynamic page
|
|
18
|
-
// Right now we only consider the pinned status of the dynamic page header
|
|
7
|
+
// Right now we only consider the pinned status of the dynamic page header
|
|
19
8
|
function fnGetState() {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return oControlState;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return oPreliminaryState;
|
|
9
|
+
var oControlState = {};
|
|
10
|
+
oControlState.headerPinned = oDynamicPage.getHeaderPinned();
|
|
11
|
+
return oControlState;
|
|
27
12
|
}
|
|
28
13
|
|
|
29
14
|
function fnSetState(oState) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
} else {
|
|
38
|
-
oDynamicPage.setHeaderPinned(false);
|
|
39
|
-
}
|
|
40
|
-
});
|
|
15
|
+
if (oState && oState.headerPinned) {
|
|
16
|
+
// There is a possibility that the header is collapsed at this point. Make sure it is expanded if we know the header is to be pinned.
|
|
17
|
+
oDynamicPage.setHeaderExpanded(true);
|
|
18
|
+
oDynamicPage.setHeaderPinned(true);
|
|
19
|
+
} else {
|
|
20
|
+
oDynamicPage.setHeaderPinned(false);
|
|
21
|
+
}
|
|
41
22
|
}
|
|
42
23
|
|
|
43
24
|
function fnAttachStateChanged(fnHandler) {
|
|
44
|
-
|
|
45
|
-
oDynamicPage.attachPinnedStateChange(fnHandler);
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function fnSetControl(oControl) {
|
|
50
|
-
oDynamicPage = oControl;
|
|
51
|
-
oControlAssignedResolve(oDynamicPage);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function fnSetHeaderState(oController, bHeaderToBeExpanded) {
|
|
55
|
-
oController.getOwnerComponent().getModel("_templPriv").setProperty("/listReport/isHeaderExpanded", bHeaderToBeExpanded);
|
|
25
|
+
oDynamicPage.attachPinnedStateChange(fnHandler);
|
|
56
26
|
}
|
|
57
27
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
setHeaderState: fnSetHeaderState
|
|
64
|
-
};
|
|
28
|
+
return {
|
|
29
|
+
getState: fnGetState,
|
|
30
|
+
setState: fnSetState,
|
|
31
|
+
attachStateChanged: fnAttachStateChanged
|
|
32
|
+
};
|
|
65
33
|
}
|
|
66
34
|
|
|
67
35
|
return DynamicPageWrapper;
|
|
68
|
-
});
|
|
36
|
+
});
|