@sapui5/sap.fe.core 1.97.0 → 1.99.1
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 +5 -4
- package/src/sap/fe/core/.library +1 -1
- package/src/sap/fe/core/AnnotationHelper.js +377 -405
- package/src/sap/fe/core/AnnotationHelper.ts +385 -0
- package/src/sap/fe/core/AppComponent.js +6 -3
- package/src/sap/fe/core/AppStateHandler.js +229 -181
- package/src/sap/fe/core/AppStateHandler.ts +171 -0
- package/src/sap/fe/core/BaseController.js +3 -2
- package/src/sap/fe/core/BusyLocker.js +105 -121
- package/src/sap/fe/core/BusyLocker.ts +98 -0
- package/src/sap/fe/core/CommonUtils.js +2073 -2379
- package/src/sap/fe/core/CommonUtils.ts +2078 -0
- package/src/sap/fe/core/ExtensionAPI.js +16 -7
- package/src/sap/fe/core/PageController.js +84 -119
- package/src/sap/fe/core/PageController.ts +101 -0
- package/src/sap/fe/core/RouterProxy.js +986 -807
- package/src/sap/fe/core/RouterProxy.ts +838 -0
- package/src/sap/fe/core/Synchronization.js +51 -35
- package/src/sap/fe/core/Synchronization.ts +29 -0
- package/src/sap/fe/core/TemplateComponent.js +173 -155
- package/src/sap/fe/core/TemplateComponent.ts +166 -0
- package/src/sap/fe/core/TemplateModel.js +97 -54
- package/src/sap/fe/core/TemplateModel.ts +64 -0
- package/src/sap/fe/core/TransactionHelper.js +1576 -1579
- package/src/sap/fe/core/TransactionHelper.ts +1706 -0
- package/src/sap/fe/core/actions/draft.js +560 -581
- package/src/sap/fe/core/actions/draft.ts +594 -0
- package/src/sap/fe/core/actions/messageHandling.js +545 -511
- package/src/sap/fe/core/actions/messageHandling.ts +532 -0
- package/src/sap/fe/core/actions/nonDraft.js +17 -19
- package/src/sap/fe/core/actions/nonDraft.ts +12 -0
- package/src/sap/fe/core/actions/operations.js +1074 -1211
- package/src/sap/fe/core/actions/operations.ts +1162 -0
- package/src/sap/fe/core/actions/sticky.js +102 -105
- package/src/sap/fe/core/actions/sticky.ts +102 -0
- package/src/sap/fe/core/controllerextensions/ControllerExtensionMetadata.js +3 -2
- package/src/sap/fe/core/controllerextensions/EditFlow.js +229 -260
- package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.js +3 -2
- package/src/sap/fe/core/controllerextensions/InternalEditFlow.js +288 -13
- package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.js +27 -23
- package/src/sap/fe/core/controllerextensions/InternalRouting.js +82 -46
- package/src/sap/fe/core/controllerextensions/KPIManagement.js +113 -25
- package/src/sap/fe/core/controllerextensions/KPIManagement.ts +135 -44
- package/src/sap/fe/core/controllerextensions/MassEdit.js +172 -0
- package/src/sap/fe/core/controllerextensions/MessageHandler.js +22 -9
- package/src/sap/fe/core/controllerextensions/PageReady.js +3 -3
- package/src/sap/fe/core/controllerextensions/PageReady.ts +12 -8
- package/src/sap/fe/core/controllerextensions/Paginator.js +37 -9
- package/src/sap/fe/core/controllerextensions/Placeholder.js +8 -4
- package/src/sap/fe/core/controllerextensions/Routing.js +25 -5
- package/src/sap/fe/core/controllerextensions/RoutingListener.js +3 -2
- package/src/sap/fe/core/controllerextensions/Share.js +22 -8
- package/src/sap/fe/core/controllerextensions/SideEffects.js +9 -9
- package/src/sap/fe/core/controllerextensions/SideEffects.ts +22 -21
- package/src/sap/fe/core/controllerextensions/ViewState.js +3 -2
- package/src/sap/fe/core/controls/ActionParameterDialog.fragment.xml +2 -1
- package/src/sap/fe/core/controls/CommandExecution.js +3 -2
- package/src/sap/fe/core/controls/ConditionalWrapper.js +3 -2
- package/src/sap/fe/core/controls/CustomQuickViewPage.js +3 -2
- package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.js +9 -5
- package/src/sap/fe/core/controls/FieldWrapper.js +18 -23
- package/src/sap/fe/core/controls/FilterBar.js +3 -2
- package/src/sap/fe/core/controls/FormElementWrapper.js +3 -7
- package/src/sap/fe/core/controls/MultiValueParameterDelegate.js +3 -2
- package/src/sap/fe/core/controls/NonComputedVisibleKeyFieldsDialog.fragment.xml +2 -1
- package/src/sap/fe/core/controls/filterbar/FilterContainer.js +3 -2
- package/src/sap/fe/core/controls/filterbar/VisualFilter.js +5 -4
- package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.js +3 -2
- package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.js +3 -2
- package/src/sap/fe/core/controls/massEdit/MassEditDialog.fragment.xml +106 -0
- package/src/sap/fe/core/controls/massEdit/MassEditHandlers.js +79 -0
- package/src/sap/fe/core/converters/ConverterContext.js +14 -2
- package/src/sap/fe/core/converters/ConverterContext.ts +14 -3
- package/src/sap/fe/core/converters/ManifestSettings.js +1 -1
- package/src/sap/fe/core/converters/ManifestSettings.ts +4 -0
- package/src/sap/fe/core/converters/ManifestWrapper.js +56 -32
- package/src/sap/fe/core/converters/ManifestWrapper.ts +24 -6
- package/src/sap/fe/core/converters/MetaModelConverter.js +67 -6
- package/src/sap/fe/core/converters/MetaModelConverter.ts +70 -14
- package/src/sap/fe/core/converters/TemplateConverter.js +1 -1
- package/src/sap/fe/core/converters/TemplateConverter.ts +2 -2
- package/src/sap/fe/core/converters/annotations/DataField.js +3 -3
- package/src/sap/fe/core/converters/annotations/DataField.ts +1 -1
- package/src/sap/fe/core/converters/common/AnnotationConverter.js +33 -21
- package/src/sap/fe/core/converters/controls/Common/Action.js +11 -2
- package/src/sap/fe/core/converters/controls/Common/Action.ts +8 -2
- package/src/sap/fe/core/converters/controls/Common/Chart.js +5 -3
- package/src/sap/fe/core/converters/controls/Common/Chart.ts +11 -3
- package/src/sap/fe/core/converters/controls/Common/DataVisualization.js +3 -3
- package/src/sap/fe/core/converters/controls/Common/DataVisualization.ts +2 -2
- package/src/sap/fe/core/converters/controls/Common/Form.js +20 -10
- package/src/sap/fe/core/converters/controls/Common/Form.ts +24 -4
- package/src/sap/fe/core/converters/controls/Common/KPI.js +69 -4
- package/src/sap/fe/core/converters/controls/Common/KPI.ts +72 -0
- package/src/sap/fe/core/converters/controls/Common/Table.js +390 -398
- package/src/sap/fe/core/converters/controls/Common/Table.ts +497 -484
- package/src/sap/fe/core/converters/controls/Common/table/StandardActions.js +527 -0
- package/src/sap/fe/core/converters/controls/Common/table/StandardActions.ts +655 -0
- package/src/sap/fe/core/converters/controls/ListReport/FilterBar.js +489 -37
- package/src/sap/fe/core/converters/controls/ListReport/FilterBar.ts +506 -58
- package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.js +2 -2
- package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.ts +1 -1
- package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.js +17 -9
- package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.ts +24 -9
- package/src/sap/fe/core/converters/helpers/Aggregation.js +18 -3
- package/src/sap/fe/core/converters/helpers/Aggregation.ts +28 -5
- package/src/sap/fe/core/converters/helpers/IssueManager.js +7 -1
- package/src/sap/fe/core/converters/helpers/IssueManager.ts +6 -0
- package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.js +4 -4
- package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.ts +3 -3
- package/src/sap/fe/core/converters/templates/ListReportConverter.js +13 -6
- package/src/sap/fe/core/converters/templates/ListReportConverter.ts +26 -15
- package/src/sap/fe/core/designtime/AppComponent.designtime.js +11 -2
- package/src/sap/fe/core/formatters/CriticalityFormatter.js +1 -1
- package/src/sap/fe/core/formatters/CriticalityFormatter.ts +1 -1
- package/src/sap/fe/core/formatters/FPMFormatter.js +1 -1
- package/src/sap/fe/core/formatters/FPMFormatter.ts +4 -10
- package/src/sap/fe/core/formatters/KPIFormatter.js +1 -1
- package/src/sap/fe/core/formatters/KPIFormatter.ts +3 -1
- package/src/sap/fe/core/formatters/TableFormatter.js +39 -28
- package/src/sap/fe/core/formatters/TableFormatter.ts +43 -28
- package/src/sap/fe/core/formatters/ValueFormatter.js +30 -5
- package/src/sap/fe/core/formatters/ValueFormatter.ts +30 -7
- package/src/sap/fe/core/fpm/Component.js +3 -2
- package/src/sap/fe/core/helpers/AppStartupHelper.js +359 -0
- package/src/sap/fe/core/helpers/AppStartupHelper.ts +391 -0
- package/src/sap/fe/core/helpers/BindingExpression.js +484 -437
- package/src/sap/fe/core/helpers/BindingExpression.ts +480 -463
- package/src/sap/fe/core/helpers/ClassSupport.js +27 -15
- package/src/sap/fe/core/helpers/ClassSupport.ts +31 -20
- package/src/sap/fe/core/helpers/DynamicAnnotationPathHelper.js +63 -59
- package/src/sap/fe/core/helpers/DynamicAnnotationPathHelper.ts +56 -0
- package/src/sap/fe/core/helpers/EditState.js +81 -84
- package/src/sap/fe/core/helpers/EditState.ts +81 -0
- package/src/sap/fe/core/helpers/ExcelFormatHelper.js +62 -48
- package/src/sap/fe/core/helpers/ExcelFormatHelper.ts +49 -0
- package/src/sap/fe/core/helpers/FPMHelper.js +52 -56
- package/src/sap/fe/core/helpers/FPMHelper.ts +62 -0
- package/src/sap/fe/core/helpers/KeepAliveHelper.js +4 -5
- package/src/sap/fe/core/helpers/KeepAliveHelper.ts +10 -10
- package/src/sap/fe/core/helpers/MassEditHelper.js +687 -0
- package/src/sap/fe/core/helpers/ModelHelper.js +229 -225
- package/src/sap/fe/core/helpers/ModelHelper.ts +227 -0
- package/src/sap/fe/core/helpers/PasteHelper.js +210 -132
- package/src/sap/fe/core/helpers/PasteHelper.ts +196 -0
- package/src/sap/fe/core/helpers/SemanticDateOperators.js +332 -313
- package/src/sap/fe/core/helpers/SemanticDateOperators.ts +330 -0
- package/src/sap/fe/core/helpers/SemanticKeyHelper.js +66 -67
- package/src/sap/fe/core/helpers/SemanticKeyHelper.ts +73 -0
- package/src/sap/fe/core/helpers/StableIdHelper.js +4 -7
- package/src/sap/fe/core/helpers/StableIdHelper.ts +2 -6
- package/src/sap/fe/core/jsx-runtime/jsx.js +1 -1
- package/src/sap/fe/core/jsx-runtime/jsx.ts +1 -1
- package/src/sap/fe/core/library.js +30 -3
- package/src/sap/fe/core/library.support.js +12 -5
- package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.js +62 -0
- package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.ts +66 -0
- package/src/sap/fe/core/messagebundle.properties +61 -13
- package/src/sap/fe/core/messagebundle_ar.properties +33 -2
- package/src/sap/fe/core/messagebundle_bg.properties +33 -2
- package/src/sap/fe/core/messagebundle_ca.properties +33 -2
- package/src/sap/fe/core/messagebundle_cs.properties +34 -3
- package/src/sap/fe/core/messagebundle_cy.properties +33 -2
- package/src/sap/fe/core/messagebundle_da.properties +33 -2
- package/src/sap/fe/core/messagebundle_de.properties +33 -2
- package/src/sap/fe/core/messagebundle_el.properties +33 -2
- package/src/sap/fe/core/messagebundle_en.properties +32 -1
- package/src/sap/fe/core/messagebundle_en_GB.properties +32 -1
- package/src/sap/fe/core/messagebundle_en_US_sappsd.properties +36 -1
- package/src/sap/fe/core/messagebundle_en_US_saprigi.properties +33 -2
- package/src/sap/fe/core/messagebundle_en_US_saptrc.properties +33 -2
- package/src/sap/fe/core/messagebundle_es.properties +33 -2
- package/src/sap/fe/core/messagebundle_es_MX.properties +33 -2
- package/src/sap/fe/core/messagebundle_et.properties +33 -2
- package/src/sap/fe/core/messagebundle_fi.properties +34 -3
- package/src/sap/fe/core/messagebundle_fr.properties +38 -7
- package/src/sap/fe/core/messagebundle_fr_CA.properties +33 -2
- package/src/sap/fe/core/messagebundle_hi.properties +33 -2
- package/src/sap/fe/core/messagebundle_hr.properties +33 -2
- package/src/sap/fe/core/messagebundle_hu.properties +34 -3
- package/src/sap/fe/core/messagebundle_id.properties +36 -5
- package/src/sap/fe/core/messagebundle_it.properties +33 -2
- package/src/sap/fe/core/messagebundle_iw.properties +33 -2
- package/src/sap/fe/core/messagebundle_ja.properties +33 -2
- package/src/sap/fe/core/messagebundle_kk.properties +33 -2
- package/src/sap/fe/core/messagebundle_ko.properties +33 -2
- package/src/sap/fe/core/messagebundle_lt.properties +33 -2
- package/src/sap/fe/core/messagebundle_lv.properties +33 -2
- package/src/sap/fe/core/messagebundle_ms.properties +33 -2
- package/src/sap/fe/core/messagebundle_nl.properties +33 -2
- package/src/sap/fe/core/messagebundle_no.properties +33 -2
- package/src/sap/fe/core/messagebundle_pl.properties +33 -2
- package/src/sap/fe/core/messagebundle_pt.properties +34 -3
- package/src/sap/fe/core/messagebundle_pt_PT.properties +33 -2
- package/src/sap/fe/core/messagebundle_ro.properties +33 -2
- package/src/sap/fe/core/messagebundle_ru.properties +33 -2
- package/src/sap/fe/core/messagebundle_sh.properties +33 -2
- package/src/sap/fe/core/messagebundle_sk.properties +33 -2
- package/src/sap/fe/core/messagebundle_sl.properties +33 -2
- package/src/sap/fe/core/messagebundle_sv.properties +34 -3
- package/src/sap/fe/core/messagebundle_th.properties +33 -2
- package/src/sap/fe/core/messagebundle_tr.properties +33 -2
- package/src/sap/fe/core/messagebundle_uk.properties +33 -2
- package/src/sap/fe/core/messagebundle_vi.properties +33 -2
- package/src/sap/fe/core/messagebundle_zh_CN.properties +33 -2
- package/src/sap/fe/core/messagebundle_zh_TW.properties +33 -2
- package/src/sap/fe/core/services/AsyncComponentServiceFactory.js +2 -2
- package/src/sap/fe/core/services/AsyncComponentServiceFactory.ts +3 -1
- package/src/sap/fe/core/services/CacheHandlerServiceFactory.js +269 -202
- package/src/sap/fe/core/services/CacheHandlerServiceFactory.ts +212 -0
- package/src/sap/fe/core/services/EnvironmentServiceFactory.js +4 -3
- package/src/sap/fe/core/services/EnvironmentServiceFactory.ts +9 -5
- package/src/sap/fe/core/services/NavigationServiceFactory.js +406 -300
- package/src/sap/fe/core/services/NavigationServiceFactory.ts +316 -0
- package/src/sap/fe/core/services/ResourceModelServiceFactory.js +149 -81
- package/src/sap/fe/core/services/ResourceModelServiceFactory.ts +80 -0
- package/src/sap/fe/core/services/RoutingServiceFactory.js +987 -1152
- package/src/sap/fe/core/services/RoutingServiceFactory.ts +898 -0
- package/src/sap/fe/core/services/ShellServicesFactory.js +31 -2
- package/src/sap/fe/core/services/ShellServicesFactory.ts +45 -11
- package/src/sap/fe/core/services/SideEffectsServiceFactory.js +42 -85
- package/src/sap/fe/core/services/SideEffectsServiceFactory.ts +57 -100
- package/src/sap/fe/core/services/TemplatedViewServiceFactory.js +461 -478
- package/src/sap/fe/core/services/TemplatedViewServiceFactory.ts +453 -0
- package/src/sap/fe/core/services/view/TemplatingErrorPage.controller.js +10 -8
- package/src/sap/fe/core/services/view/TemplatingErrorPage.controller.ts +8 -0
- package/src/sap/fe/core/support/AnnotationIssue.support.js +15 -3
- package/src/sap/fe/core/support/AnnotationIssue.support.ts +16 -2
- package/src/sap/fe/core/support/CollectionFacetUnsupportedLevel.support.js +2 -2
- package/src/sap/fe/core/support/CollectionFacetUnsupportedLevel.support.ts +1 -1
- package/src/sap/fe/core/support/InvalidAnnotationColumnKey.support.js +38 -0
- package/src/sap/fe/core/support/InvalidAnnotationColumnKey.support.ts +18 -0
- package/src/sap/fe/core/templating/DataModelPathHelper.js +10 -48
- package/src/sap/fe/core/templating/DataModelPathHelper.ts +14 -46
- package/src/sap/fe/core/templating/DisplayModeFormatter.js +114 -0
- package/src/sap/fe/core/templating/DisplayModeFormatter.ts +86 -0
- package/src/sap/fe/core/templating/FieldControlHelper.js +8 -8
- package/src/sap/fe/core/templating/FieldControlHelper.ts +25 -7
- package/src/sap/fe/core/templating/FilterHelper.js +139 -70
- package/src/sap/fe/core/templating/FilterHelper.ts +140 -70
- package/src/sap/fe/core/templating/PropertyHelper.js +2 -2
- package/src/sap/fe/core/templating/PropertyHelper.ts +1 -1
- package/src/sap/fe/core/templating/UIFormatters.js +45 -110
- package/src/sap/fe/core/templating/UIFormatters.ts +39 -75
- package/src/sap/fe/core/type/Email.js +1 -1
- package/src/sap/fe/core/type/Email.ts +4 -6
- package/ui5.yaml +0 -3
- package/src/sap/fe/core/controls/filterbar.d.js +0 -8
- package/src/sap/fe/core/controls/filterbar.d.ts +0 -0
|
@@ -0,0 +1,687 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* SAP UI development toolkit for HTML5 (SAPUI5)
|
|
3
|
+
(c) Copyright 2009-2021 SAP SE. All rights reserved
|
|
4
|
+
|
|
5
|
+
*/
|
|
6
|
+
sap.ui.define(
|
|
7
|
+
[
|
|
8
|
+
"sap/m/Dialog",
|
|
9
|
+
"sap/ui/core/XMLTemplateProcessor",
|
|
10
|
+
"sap/ui/model/json/JSONModel",
|
|
11
|
+
"sap/ui/core/Fragment",
|
|
12
|
+
"sap/ui/core/util/XMLPreprocessor",
|
|
13
|
+
"sap/fe/core/templating/UIFormatters",
|
|
14
|
+
"sap/fe/core/converters/MetaModelConverter",
|
|
15
|
+
"sap/fe/macros/field/FieldHelper",
|
|
16
|
+
"sap/fe/macros/field/FieldTemplating",
|
|
17
|
+
"sap/base/Log",
|
|
18
|
+
"sap/fe/core/CommonUtils",
|
|
19
|
+
"sap/fe/core/templating/FieldControlHelper"
|
|
20
|
+
],
|
|
21
|
+
function(
|
|
22
|
+
Dialog,
|
|
23
|
+
XMLTemplateProcessor,
|
|
24
|
+
JSONModel,
|
|
25
|
+
Fragment,
|
|
26
|
+
XMLPreprocessor,
|
|
27
|
+
UIFormatters,
|
|
28
|
+
MetaModelConverter,
|
|
29
|
+
FieldHelper,
|
|
30
|
+
FieldTemplating,
|
|
31
|
+
Log,
|
|
32
|
+
CommonUtils,
|
|
33
|
+
FieldControlHelper
|
|
34
|
+
) {
|
|
35
|
+
"use strict";
|
|
36
|
+
|
|
37
|
+
/* This class contains helpers to be used for mass edit functionality */
|
|
38
|
+
|
|
39
|
+
var MassEditHelper = {
|
|
40
|
+
/**
|
|
41
|
+
* Initializes the value at final or deepest level path with a blank array.
|
|
42
|
+
* Return an empty array pointing to the final or deepest level path.
|
|
43
|
+
*
|
|
44
|
+
* @param {string} sPath Property path
|
|
45
|
+
* @param {Array} aValues Array instance where the default data needs to be added
|
|
46
|
+
* @returns {Array}
|
|
47
|
+
*/
|
|
48
|
+
initLastLevelOfPropertyPath: function(sPath, aValues) {
|
|
49
|
+
var aFinalPath,
|
|
50
|
+
index = 0,
|
|
51
|
+
aPaths = sPath.split("/"),
|
|
52
|
+
sFullPath = "";
|
|
53
|
+
aPaths.forEach(function(sPropertyPath) {
|
|
54
|
+
if (!aValues[sPropertyPath] && index === 0) {
|
|
55
|
+
aValues[sPropertyPath] = {};
|
|
56
|
+
aFinalPath = aValues[sPropertyPath];
|
|
57
|
+
sFullPath = sFullPath + sPropertyPath;
|
|
58
|
+
index++;
|
|
59
|
+
} else if (!aFinalPath[sPropertyPath]) {
|
|
60
|
+
sFullPath = sFullPath + "/" + sPropertyPath;
|
|
61
|
+
if (sFullPath !== sPath) {
|
|
62
|
+
aFinalPath[sPropertyPath] = {};
|
|
63
|
+
aFinalPath = aFinalPath[sPropertyPath];
|
|
64
|
+
} else {
|
|
65
|
+
aFinalPath[sPropertyPath] = [];
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
return aFinalPath;
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Method to get unique values for given array values.
|
|
74
|
+
*
|
|
75
|
+
* @param {string} sValue Property value
|
|
76
|
+
* @param {number} index Index of the property value
|
|
77
|
+
* @param {Array} self Instance of the array
|
|
78
|
+
* @returns {boolean}
|
|
79
|
+
*/
|
|
80
|
+
getUniqueValues: function(sValue, index, self) {
|
|
81
|
+
if (sValue) {
|
|
82
|
+
return self.indexOf(sValue) === index;
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Gets the property value for a multi-level path (for example: _Materials/Material_Details gets the value of Material_Details under _Materials Object).
|
|
88
|
+
* Returns the propertyValue, which can be of any type (string, number, etc..).
|
|
89
|
+
*
|
|
90
|
+
* @param {string} sDataPropertyPath Property path
|
|
91
|
+
* @param {object} oValues Object of property values
|
|
92
|
+
* @returns {*}
|
|
93
|
+
*/
|
|
94
|
+
getValueForMultiLevelPath: function(sDataPropertyPath, oValues) {
|
|
95
|
+
if (sDataPropertyPath && sDataPropertyPath.indexOf("/") > 0) {
|
|
96
|
+
var aPropertyPaths = sDataPropertyPath.split("/"),
|
|
97
|
+
Result;
|
|
98
|
+
aPropertyPaths.forEach(function(sPath) {
|
|
99
|
+
Result = oValues && oValues[sPath] ? oValues[sPath] : Result && Result[sPath];
|
|
100
|
+
});
|
|
101
|
+
return Result;
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Gets the key path for the key of a combo box that must be selected initially when the dialog opens:
|
|
107
|
+
* => If propertyValue for all selected contexts is different, then < Keep Existing Values > is preselected.
|
|
108
|
+
* => If propertyValue for all selected contexts is the same, then the propertyValue is preselected.
|
|
109
|
+
* => If propertyValue for all selected contexts is empty, then < Leave Blank > is preselected.
|
|
110
|
+
*
|
|
111
|
+
*
|
|
112
|
+
* @param {Array} aContexts Contexts for mass edit
|
|
113
|
+
* @param {string} sDataPropertyPath Data property path
|
|
114
|
+
* @returns {string}
|
|
115
|
+
*/
|
|
116
|
+
getDefaultSelectionPathComboBox: function(aContexts, sDataPropertyPath) {
|
|
117
|
+
if (sDataPropertyPath && aContexts.length > 0) {
|
|
118
|
+
var oSelectedContext = aContexts,
|
|
119
|
+
aPropertyValues = [];
|
|
120
|
+
oSelectedContext.forEach(function(oContext) {
|
|
121
|
+
var oDataObject = oContext.getObject();
|
|
122
|
+
var sMultiLevelPathCondition =
|
|
123
|
+
sDataPropertyPath.indexOf("/") > -1 && oDataObject.hasOwnProperty(sDataPropertyPath.split("/")[0]);
|
|
124
|
+
if (oContext && (oDataObject.hasOwnProperty(sDataPropertyPath) || sMultiLevelPathCondition)) {
|
|
125
|
+
aPropertyValues.push(oContext.getObject(sDataPropertyPath));
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
var aUniquePropertyValues = aPropertyValues.filter(MassEditHelper.getUniqueValues);
|
|
129
|
+
if (aUniquePropertyValues.length > 1) {
|
|
130
|
+
return "Default/" + sDataPropertyPath;
|
|
131
|
+
} else if (aUniquePropertyValues.length === 0) {
|
|
132
|
+
return "Empty/" + sDataPropertyPath;
|
|
133
|
+
} else if (aUniquePropertyValues.length === 1) {
|
|
134
|
+
return sDataPropertyPath;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Checks hidden annotation value [both static and path based] for table's selected context.
|
|
141
|
+
*
|
|
142
|
+
* @param {*} hiddenValue Hidden annotation value / path for field
|
|
143
|
+
* @param {Array} aContexts Contexts for mass edit
|
|
144
|
+
* @returns {boolean}
|
|
145
|
+
*/
|
|
146
|
+
getHiddenValueForContexts: function(hiddenValue, aContexts) {
|
|
147
|
+
if (hiddenValue && hiddenValue.$Path) {
|
|
148
|
+
return !aContexts.some(function(oSelectedContext) {
|
|
149
|
+
return oSelectedContext.getObject(hiddenValue.$Path) === false;
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
return hiddenValue;
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Initializes a JSON Model for properties of dialog fields [label, visiblity, dataproperty, etc.].
|
|
157
|
+
*
|
|
158
|
+
* @param {object} oTable Instance of Table
|
|
159
|
+
* @param {Array} aContexts Contexts for mass edit
|
|
160
|
+
* @param {Array} aDataArray Array containing data related to the dialog used by both the static and the runtime model
|
|
161
|
+
* @returns {object}
|
|
162
|
+
*/
|
|
163
|
+
prepareDataForDialog: function(oTable, aContexts, aDataArray) {
|
|
164
|
+
var oMetaModel = oTable && oTable.getModel().getMetaModel(),
|
|
165
|
+
sCurrentEntitySetName = oTable.data("metaPath"),
|
|
166
|
+
aTableFields = MassEditHelper.getTableFields(oTable),
|
|
167
|
+
oEntityTypeContext = oMetaModel.getContext(sCurrentEntitySetName + "/@"),
|
|
168
|
+
oDataModelObjectPath = MetaModelConverter.getInvolvedDataModelObjects(oEntityTypeContext);
|
|
169
|
+
|
|
170
|
+
var oDataFieldModel = new JSONModel(),
|
|
171
|
+
oResult,
|
|
172
|
+
sLabelText,
|
|
173
|
+
bValueHelpEnabled,
|
|
174
|
+
sUnitPropertyPath,
|
|
175
|
+
bValueHelpEnabledForUnit,
|
|
176
|
+
bIsImmutable,
|
|
177
|
+
bIsComputed,
|
|
178
|
+
bChartProperty,
|
|
179
|
+
oTextBinding;
|
|
180
|
+
|
|
181
|
+
aTableFields.forEach(function(oColumnInfo) {
|
|
182
|
+
var sDataPropertyPath = oColumnInfo.dataProperty;
|
|
183
|
+
if (sDataPropertyPath) {
|
|
184
|
+
var oPropertyInfo =
|
|
185
|
+
sDataPropertyPath && oMetaModel.getObject(sCurrentEntitySetName + "/" + sDataPropertyPath + "@");
|
|
186
|
+
bValueHelpEnabled =
|
|
187
|
+
sDataPropertyPath &&
|
|
188
|
+
oMetaModel.getObject(sCurrentEntitySetName + "/" + sDataPropertyPath + "@") &&
|
|
189
|
+
oMetaModel.getObject(sCurrentEntitySetName + "/" + sDataPropertyPath + "@")[
|
|
190
|
+
"@com.sap.vocabularies.Common.v1.ValueList"
|
|
191
|
+
];
|
|
192
|
+
sUnitPropertyPath =
|
|
193
|
+
(oPropertyInfo &&
|
|
194
|
+
oPropertyInfo["@Org.OData.Measures.V1.Unit"] &&
|
|
195
|
+
oPropertyInfo["@Org.OData.Measures.V1.Unit"].$Path) ||
|
|
196
|
+
(oPropertyInfo &&
|
|
197
|
+
oPropertyInfo["@Org.OData.Measures.V1.ISOCurrency"] &&
|
|
198
|
+
oPropertyInfo["@Org.OData.Measures.V1.ISOCurrency"].$Path);
|
|
199
|
+
sLabelText = oColumnInfo.label || (oPropertyInfo && oPropertyInfo["@com.sap.vocabularies.Common.v1.Label"]);
|
|
200
|
+
bValueHelpEnabledForUnit =
|
|
201
|
+
sUnitPropertyPath &&
|
|
202
|
+
oMetaModel.getObject(sCurrentEntitySetName + "/" + sUnitPropertyPath + "@") &&
|
|
203
|
+
oMetaModel.getObject(sCurrentEntitySetName + "/" + sUnitPropertyPath + "@")[
|
|
204
|
+
"@com.sap.vocabularies.Common.v1.ValueList"
|
|
205
|
+
];
|
|
206
|
+
if (oDataModelObjectPath) {
|
|
207
|
+
oDataModelObjectPath.targetObject = oDataModelObjectPath.targetEntityType.entityProperties.filter(function(
|
|
208
|
+
oProperty
|
|
209
|
+
) {
|
|
210
|
+
return oProperty.name === sDataPropertyPath;
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
oDataModelObjectPath.targetObject = oDataModelObjectPath.targetObject[0] || {};
|
|
214
|
+
oTextBinding = FieldTemplating.getTextBinding(oDataModelObjectPath, undefined, true) || {};
|
|
215
|
+
var oFieldContext = oMetaModel.getContext(oColumnInfo.annotationPath),
|
|
216
|
+
oDataFieldConverted = MetaModelConverter.convertMetaModelContext(oFieldContext),
|
|
217
|
+
oPropertyContext = oMetaModel.getContext(sCurrentEntitySetName + "/" + sDataPropertyPath + "@"),
|
|
218
|
+
oInterface = oPropertyContext && oPropertyContext.getInterface();
|
|
219
|
+
bIsImmutable =
|
|
220
|
+
oPropertyContext &&
|
|
221
|
+
oPropertyContext.getProperty() &&
|
|
222
|
+
oPropertyContext.getProperty()["@Org.OData.Core.V1.Immutable"];
|
|
223
|
+
bIsComputed =
|
|
224
|
+
oPropertyContext &&
|
|
225
|
+
oPropertyContext.getProperty() &&
|
|
226
|
+
oPropertyContext.getProperty()["@Org.OData.Core.V1.Computed"];
|
|
227
|
+
var bHiddenField =
|
|
228
|
+
MassEditHelper.getHiddenValueForContexts(
|
|
229
|
+
oFieldContext && oFieldContext.getObject()["@com.sap.vocabularies.UI.v1.Hidden"],
|
|
230
|
+
aContexts
|
|
231
|
+
) || false;
|
|
232
|
+
oInterface.context = {
|
|
233
|
+
getModel: function() {
|
|
234
|
+
return oInterface.getModel();
|
|
235
|
+
},
|
|
236
|
+
getPath: function() {
|
|
237
|
+
return sCurrentEntitySetName + "/" + sDataPropertyPath;
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
oPropertyInfo =
|
|
241
|
+
(oDataFieldConverted && oDataFieldConverted.Value && oDataFieldConverted.Value.$target) ||
|
|
242
|
+
(oDataFieldConverted && oDataFieldConverted.Target && oDataFieldConverted.Target.$target);
|
|
243
|
+
// Datafield is not included in the FieldControl calculation, needs to be implemented
|
|
244
|
+
var isReadOnlyExpression = FieldControlHelper.isReadOnlyExpression(oPropertyInfo);
|
|
245
|
+
bChartProperty = oPropertyInfo && oPropertyInfo.term && oPropertyInfo.term === "com.sap.vocabularies.UI.v1.Chart";
|
|
246
|
+
if (
|
|
247
|
+
sDataPropertyPath &&
|
|
248
|
+
!bHiddenField &&
|
|
249
|
+
!bIsImmutable &&
|
|
250
|
+
!bIsComputed &&
|
|
251
|
+
!bChartProperty &&
|
|
252
|
+
oColumnInfo.inputType &&
|
|
253
|
+
UIFormatters.getEditableExpression(oPropertyInfo, oDataFieldConverted, oDataModelObjectPath) !== "false"
|
|
254
|
+
) {
|
|
255
|
+
oResult = {
|
|
256
|
+
"label": sLabelText + ":",
|
|
257
|
+
"visible":
|
|
258
|
+
sDataPropertyPath &&
|
|
259
|
+
!bHiddenField &&
|
|
260
|
+
!bIsImmutable &&
|
|
261
|
+
!bIsComputed &&
|
|
262
|
+
UIFormatters.getEditableExpression(oPropertyInfo, oDataFieldConverted, oDataModelObjectPath),
|
|
263
|
+
"dataProperty": sDataPropertyPath,
|
|
264
|
+
"isValueHelpEnabled": bValueHelpEnabled ? bValueHelpEnabled : false,
|
|
265
|
+
"unitProperty": sUnitPropertyPath ? sUnitPropertyPath : false,
|
|
266
|
+
"isValueHelpEnabledForUnit": bValueHelpEnabledForUnit ? bValueHelpEnabledForUnit : false,
|
|
267
|
+
"propertyPathForValueHelp": sCurrentEntitySetName + "/" + sDataPropertyPath,
|
|
268
|
+
"propertyPathForValueHelpUnit": sCurrentEntitySetName + "/" + sUnitPropertyPath,
|
|
269
|
+
"isFieldRequired": UIFormatters.getRequiredExpression(oPropertyInfo, oDataFieldConverted, true),
|
|
270
|
+
"defaultSelectionPath": sDataPropertyPath
|
|
271
|
+
? MassEditHelper.getDefaultSelectionPathComboBox(aContexts, sDataPropertyPath)
|
|
272
|
+
: false,
|
|
273
|
+
"defaultSelectionUnitPath": sUnitPropertyPath
|
|
274
|
+
? MassEditHelper.getDefaultSelectionPathComboBox(aContexts, sUnitPropertyPath)
|
|
275
|
+
: false,
|
|
276
|
+
"entitySet": sCurrentEntitySetName,
|
|
277
|
+
"textBinding": oTextBinding,
|
|
278
|
+
"nullable": oPropertyInfo.nullable !== undefined ? oPropertyInfo.nullable : true,
|
|
279
|
+
"isPropertyReadOnly": isReadOnlyExpression !== undefined ? isReadOnlyExpression : false
|
|
280
|
+
};
|
|
281
|
+
aDataArray.push(oResult);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
oDataFieldModel.setData(aDataArray);
|
|
286
|
+
return oDataFieldModel;
|
|
287
|
+
},
|
|
288
|
+
|
|
289
|
+
getInputTypeForColumn: function(oColumn) {
|
|
290
|
+
return (
|
|
291
|
+
oColumn.getTemplate().getContent &&
|
|
292
|
+
oColumn.getTemplate().getContent() &&
|
|
293
|
+
oColumn.getTemplate().getContent().getContentEdit &&
|
|
294
|
+
oColumn
|
|
295
|
+
.getTemplate()
|
|
296
|
+
.getContent()
|
|
297
|
+
.getContentEdit() &&
|
|
298
|
+
oColumn
|
|
299
|
+
.getTemplate()
|
|
300
|
+
.getContent()
|
|
301
|
+
.getContentEdit()[0] &&
|
|
302
|
+
oColumn
|
|
303
|
+
.getTemplate()
|
|
304
|
+
.getContent()
|
|
305
|
+
.getContentEdit()[0]
|
|
306
|
+
.getMetadata()
|
|
307
|
+
.getName()
|
|
308
|
+
);
|
|
309
|
+
},
|
|
310
|
+
|
|
311
|
+
getTableFields: function(oTable) {
|
|
312
|
+
var aColumns = (oTable && oTable.getColumns()) || [];
|
|
313
|
+
return aColumns.map(function(oColumn) {
|
|
314
|
+
var sDataProperty = oColumn && oColumn.getDataProperty(),
|
|
315
|
+
aRealtedColumnInfo =
|
|
316
|
+
oTable.data("columns") &&
|
|
317
|
+
oTable.data("columns").customData.filter(function(oColumnInfo) {
|
|
318
|
+
return oColumnInfo.name === sDataProperty && oColumnInfo.type === "Annotation";
|
|
319
|
+
});
|
|
320
|
+
return {
|
|
321
|
+
"dataProperty": sDataProperty,
|
|
322
|
+
"label": oColumn.getHeader(),
|
|
323
|
+
"annotationPath": aRealtedColumnInfo && aRealtedColumnInfo[0] && aRealtedColumnInfo[0].annotationPath,
|
|
324
|
+
"inputType": MassEditHelper.getInputTypeForColumn(oColumn)
|
|
325
|
+
};
|
|
326
|
+
});
|
|
327
|
+
},
|
|
328
|
+
|
|
329
|
+
getDefaultTextsForDialog: function(oResourceBundle, iSelectedContexts, oTable) {
|
|
330
|
+
// The confirm button text is "Save" for table in Display mode and "Apply" for table in edit mode. This can be later exposed if needed.
|
|
331
|
+
var bDisplayMode = oTable.data("displayModePropertyBinding") === "true";
|
|
332
|
+
|
|
333
|
+
return {
|
|
334
|
+
"keepExistingPrefix": "< Keep",
|
|
335
|
+
"leaveBlankValue": "< Leave Blank >",
|
|
336
|
+
"clearFieldValue": "< Clear Values >",
|
|
337
|
+
"massEditTitle": oResourceBundle.getText("C_MASS_EDIT_DIALOG_TITLE", iSelectedContexts.toString()),
|
|
338
|
+
"applyButtonText": bDisplayMode
|
|
339
|
+
? oResourceBundle.getText("C_MASS_EDIT_SAVE_BUTTON_TEXT")
|
|
340
|
+
: oResourceBundle.getText("C_MASS_EDIT_APPLY_BUTTON_TEXT"),
|
|
341
|
+
"cancelButtonText": oResourceBundle.getText("C_MASS_EDIT_CANCEL_BUTTON_TEXT")
|
|
342
|
+
};
|
|
343
|
+
},
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Adds a suffix to the 'keep existing' property of the comboBox.
|
|
347
|
+
*
|
|
348
|
+
* @param {string} sInputType InputType of the field
|
|
349
|
+
* @returns {string}
|
|
350
|
+
*/
|
|
351
|
+
getSuffixForKeepExisiting: function(sInputType) {
|
|
352
|
+
var sResult = "Values";
|
|
353
|
+
|
|
354
|
+
switch (sInputType) {
|
|
355
|
+
//TODO - Add for other control types as well (Radio Button, Email, Input, MDC Fields, Image etc.)
|
|
356
|
+
case "sap.m.DatePicker":
|
|
357
|
+
sResult = "Dates";
|
|
358
|
+
break;
|
|
359
|
+
case "sap.m.CheckBox":
|
|
360
|
+
sResult = "Settings";
|
|
361
|
+
break;
|
|
362
|
+
}
|
|
363
|
+
return sResult;
|
|
364
|
+
},
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Adds default values to the model [Keep Existing Values, Leave Blank].
|
|
368
|
+
* @param {Array} aValues Array instance where the default data needs to be added
|
|
369
|
+
* @param {Array} aContexts Contexts for mass edit
|
|
370
|
+
* @param {object} oDefaultValues Default values from Application Manifest
|
|
371
|
+
* @param {object} oPropertyInfo Property information
|
|
372
|
+
* @param {boolean} bUOMField
|
|
373
|
+
*/
|
|
374
|
+
setDefaultValuesToDialog: function(aValues, aContexts, oDefaultValues, oPropertyInfo, bUOMField) {
|
|
375
|
+
var sPropertyPath = oPropertyInfo.dataProperty,
|
|
376
|
+
sInputType = oPropertyInfo.inputType,
|
|
377
|
+
bPropertyRequired = oPropertyInfo.isFieldRequired;
|
|
378
|
+
var sSuffixForKeepExisting = MassEditHelper.getSuffixForKeepExisiting(sInputType);
|
|
379
|
+
//TODO - Add <<Use Value Help or control implmentation>> and related key by checking if value help is enabled for property or Unit.
|
|
380
|
+
//TODO - Add option Apply to Empty Fields only for Both Value Help and controls.
|
|
381
|
+
var bValueExistsForPropertyPath = aContexts.some(function(oSelectedContext) {
|
|
382
|
+
return oSelectedContext.getObject(sPropertyPath);
|
|
383
|
+
});
|
|
384
|
+
if (bValueExistsForPropertyPath) {
|
|
385
|
+
if (bPropertyRequired !== "true" && !bUOMField) {
|
|
386
|
+
aValues.unshift({ text: oDefaultValues.clearFieldValue, key: "ClearFieldValue/" + sPropertyPath });
|
|
387
|
+
}
|
|
388
|
+
} else {
|
|
389
|
+
aValues.unshift({ text: oDefaultValues.leaveBlankValue, key: "Empty/" + sPropertyPath });
|
|
390
|
+
}
|
|
391
|
+
aValues.unshift({
|
|
392
|
+
text: oDefaultValues.keepExistingPrefix + " " + sSuffixForKeepExisting + " >",
|
|
393
|
+
key: "Default/" + sPropertyPath
|
|
394
|
+
});
|
|
395
|
+
},
|
|
396
|
+
|
|
397
|
+
getTextArrangementInfo: function(sProperty, oTextBinding, sCurrentEntitySet, oSelectedContext) {
|
|
398
|
+
var oMetaModel = oSelectedContext.getModel().getMetaModel();
|
|
399
|
+
var sDisplayMode = CommonUtils.computeDisplayMode(oMetaModel.getObject(sCurrentEntitySet + "/" + sProperty + "@"));
|
|
400
|
+
var sDescriptionPath, sValue, sDescriptionValue, sFullText;
|
|
401
|
+
if (oTextBinding && (oTextBinding.path || (oTextBinding.parameters && oTextBinding.parameters.length)) && sProperty) {
|
|
402
|
+
if (oTextBinding.path) {
|
|
403
|
+
if (sDisplayMode === "Description") {
|
|
404
|
+
sValue = oSelectedContext.getObject(sProperty);
|
|
405
|
+
sDescriptionValue = oSelectedContext.getObject(oTextBinding.path);
|
|
406
|
+
sFullText = sDescriptionValue;
|
|
407
|
+
} else if (sDisplayMode === "Value") {
|
|
408
|
+
sValue = oSelectedContext.getObject(sProperty);
|
|
409
|
+
sFullText = sValue;
|
|
410
|
+
}
|
|
411
|
+
} else if (oTextBinding.parameters) {
|
|
412
|
+
oTextBinding.parameters.forEach(function(oProps) {
|
|
413
|
+
if (oProps.path && oProps.path !== sProperty) {
|
|
414
|
+
sDescriptionPath = oProps.path;
|
|
415
|
+
}
|
|
416
|
+
});
|
|
417
|
+
sValue = oSelectedContext.getObject(sProperty);
|
|
418
|
+
sDescriptionValue = oSelectedContext.getObject(sDescriptionPath);
|
|
419
|
+
if (sDisplayMode === "ValueDescription" && sValue && sDescriptionValue) {
|
|
420
|
+
sFullText = sValue + " (" + sDescriptionValue + ")";
|
|
421
|
+
} else if (sDisplayMode === "DescriptionValue" && sDescriptionValue && sValue) {
|
|
422
|
+
sFullText = sDescriptionValue + " (" + sValue + ")";
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
return {
|
|
426
|
+
"textArrangement": sDisplayMode,
|
|
427
|
+
"valuePath": sProperty,
|
|
428
|
+
"descriptionPath": sDescriptionPath,
|
|
429
|
+
"value": sValue,
|
|
430
|
+
"description": sDescriptionValue,
|
|
431
|
+
"fullText": sFullText
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
return false;
|
|
435
|
+
},
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* Initializes a runtime model:
|
|
439
|
+
* => The model consists of values shown in the comboBox of the dialog (Leave Blank, Keep Existing Values, or any property value for the selected context, etc.)
|
|
440
|
+
* => The model will capture runtime changes in the results property (the value entered in the comboBox).
|
|
441
|
+
*
|
|
442
|
+
* @param {Array} aContexts Contexts for mass edit
|
|
443
|
+
* @param {Array} aDataArray Array containing data related to the dialog used by both the static and the runtime model
|
|
444
|
+
* @param {object} oDefaultValues Default values from i18n
|
|
445
|
+
* @returns {object}
|
|
446
|
+
*/
|
|
447
|
+
setRuntimeModelOnDialog: function(aContexts, aDataArray, oDefaultValues) {
|
|
448
|
+
var aValues = [],
|
|
449
|
+
aUnitData = [],
|
|
450
|
+
aResults = [],
|
|
451
|
+
aReadOnlyFieldInfo = [],
|
|
452
|
+
oDistinctValueMap = {},
|
|
453
|
+
sPropertyName;
|
|
454
|
+
aDataArray.forEach(function(oData) {
|
|
455
|
+
if (oData.dataProperty && oData.dataProperty.indexOf("/") > -1) {
|
|
456
|
+
var aFinalPath = MassEditHelper.initLastLevelOfPropertyPath(oData.dataProperty, aValues),
|
|
457
|
+
aPropertyPaths = oData.dataProperty.split("/"),
|
|
458
|
+
sPropertyKey;
|
|
459
|
+
for (var i = 0; i < aContexts.length; i++) {
|
|
460
|
+
var sMultiLevelPathValue = aContexts[i].getObject(oData.dataProperty);
|
|
461
|
+
sPropertyKey = oData.dataProperty + "/" + sMultiLevelPathValue;
|
|
462
|
+
if (!oDistinctValueMap[sPropertyKey] && aFinalPath[aPropertyPaths[aPropertyPaths.length - 1]]) {
|
|
463
|
+
var oTextInfo = MassEditHelper.getTextArrangementInfo(
|
|
464
|
+
oData.dataProperty,
|
|
465
|
+
oData.textBinding,
|
|
466
|
+
oData.entitySet,
|
|
467
|
+
aContexts[i]
|
|
468
|
+
);
|
|
469
|
+
aFinalPath[aPropertyPaths[aPropertyPaths.length - 1]].push({
|
|
470
|
+
"text": (oTextInfo && oTextInfo.fullText) || sMultiLevelPathValue,
|
|
471
|
+
"key": oData.dataProperty,
|
|
472
|
+
"textInfo": oTextInfo
|
|
473
|
+
});
|
|
474
|
+
oDistinctValueMap[sPropertyKey] = sMultiLevelPathValue;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
} else {
|
|
478
|
+
aValues[oData.dataProperty] = aValues[oData.dataProperty] || [];
|
|
479
|
+
if (oData.unitProperty) {
|
|
480
|
+
aUnitData[oData.unitProperty] = aUnitData[oData.unitProperty] || [];
|
|
481
|
+
}
|
|
482
|
+
for (var i = 0; i < aContexts.length; i++) {
|
|
483
|
+
var oDataObject = aContexts[i].getObject();
|
|
484
|
+
sPropertyName = oData.dataProperty + "/" + oDataObject[oData.dataProperty];
|
|
485
|
+
if (oData.dataProperty && oDataObject[oData.dataProperty] && !oDistinctValueMap[sPropertyName]) {
|
|
486
|
+
var oTextInfo = MassEditHelper.getTextArrangementInfo(
|
|
487
|
+
oData.dataProperty,
|
|
488
|
+
oData.textBinding,
|
|
489
|
+
oData.entitySet,
|
|
490
|
+
aContexts[i]
|
|
491
|
+
);
|
|
492
|
+
aValues[oData.dataProperty].push({
|
|
493
|
+
"text": (oTextInfo && oTextInfo.fullText) || oDataObject[oData.dataProperty],
|
|
494
|
+
"key": oData.dataProperty,
|
|
495
|
+
"textInfo": oTextInfo
|
|
496
|
+
});
|
|
497
|
+
oDistinctValueMap[sPropertyName] = oDataObject[oData.dataProperty];
|
|
498
|
+
}
|
|
499
|
+
if (oData.unitProperty && oDataObject[oData.unitProperty]) {
|
|
500
|
+
sPropertyName = oData.unitProperty + "/" + oDataObject[oData.unitProperty];
|
|
501
|
+
if (!oDistinctValueMap[sPropertyName]) {
|
|
502
|
+
var oTextInfo = MassEditHelper.getTextArrangementInfo(
|
|
503
|
+
oData.unitProperty,
|
|
504
|
+
oData.textBinding,
|
|
505
|
+
oData.entitySet,
|
|
506
|
+
aContexts[i]
|
|
507
|
+
);
|
|
508
|
+
aUnitData[oData.unitProperty].push({
|
|
509
|
+
"text": (oTextInfo && oTextInfo.fullText) || oDataObject[oData.unitProperty],
|
|
510
|
+
"key": oData.unitProperty,
|
|
511
|
+
"textInfo": oTextInfo
|
|
512
|
+
});
|
|
513
|
+
oDistinctValueMap[sPropertyName] = oDataObject[oData.unitProperty];
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
});
|
|
519
|
+
aDataArray.forEach(function(oData) {
|
|
520
|
+
if (oData.dataProperty.indexOf("/") > -1) {
|
|
521
|
+
var sMultiLevelPropPathValue = MassEditHelper.getValueForMultiLevelPath(oData.dataProperty, aValues);
|
|
522
|
+
if (!sMultiLevelPropPathValue) {
|
|
523
|
+
sMultiLevelPropPathValue.push({ text: oDefaultValues.leaveBlankValue, key: "Empty/" + oData.dataProperty });
|
|
524
|
+
} else {
|
|
525
|
+
MassEditHelper.setDefaultValuesToDialog(sMultiLevelPropPathValue, aContexts, oDefaultValues, oData);
|
|
526
|
+
}
|
|
527
|
+
} else if (aValues[oData.dataProperty] && aValues[oData.dataProperty].length) {
|
|
528
|
+
MassEditHelper.setDefaultValuesToDialog(aValues[oData.dataProperty], aContexts, oDefaultValues, oData);
|
|
529
|
+
}
|
|
530
|
+
if (aUnitData[oData.unitProperty] && aUnitData[oData.unitProperty].length) {
|
|
531
|
+
MassEditHelper.setDefaultValuesToDialog(aUnitData[oData.unitProperty], aContexts, oDefaultValues, oData, true);
|
|
532
|
+
} else if (
|
|
533
|
+
(oData.dataProperty && aValues[oData.dataProperty] && !aValues[oData.dataProperty].length) ||
|
|
534
|
+
(oData.unitProperty && aUnitData[oData.unitProperty] && !aUnitData[oData.unitProperty].length)
|
|
535
|
+
) {
|
|
536
|
+
var bClearFieldOrBlankValueExists =
|
|
537
|
+
aValues[oData.dataProperty] &&
|
|
538
|
+
aValues[oData.dataProperty].some(function(obj) {
|
|
539
|
+
return obj.text === "< Clear Values >" || obj.text === "< Leave Blank >";
|
|
540
|
+
});
|
|
541
|
+
if (oData.dataProperty && !bClearFieldOrBlankValueExists) {
|
|
542
|
+
aValues[oData.dataProperty].push({ text: oDefaultValues.leaveBlankValue, key: "Empty/" + oData.dataProperty });
|
|
543
|
+
}
|
|
544
|
+
var bClearFieldOrBlankUnitValueExists =
|
|
545
|
+
aUnitData[oData.unitProperty] &&
|
|
546
|
+
aUnitData[oData.unitProperty].some(function(obj) {
|
|
547
|
+
return obj.text === "< Clear Values >" || obj.text === "< Leave Blank >";
|
|
548
|
+
});
|
|
549
|
+
if (oData.unitProperty && !bClearFieldOrBlankUnitValueExists) {
|
|
550
|
+
aUnitData[oData.unitProperty].push({
|
|
551
|
+
text: oDefaultValues.leaveBlankValue,
|
|
552
|
+
key: "Empty/" + oData.unitProperty
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
if (oData.isPropertyReadOnly && typeof oData.isPropertyReadOnly === "boolean") {
|
|
557
|
+
aReadOnlyFieldInfo.push({ "property": oData.dataProperty, value: oData.isPropertyReadOnly, type: "Default" });
|
|
558
|
+
} else if (
|
|
559
|
+
oData.isPropertyReadOnly &&
|
|
560
|
+
oData.isPropertyReadOnly.operands &&
|
|
561
|
+
oData.isPropertyReadOnly.operands[0] &&
|
|
562
|
+
oData.isPropertyReadOnly.operands[0].operand1 &&
|
|
563
|
+
oData.isPropertyReadOnly.operands[0].operand2
|
|
564
|
+
) {
|
|
565
|
+
// This needs to be refactored in accordance with the ReadOnlyExpression change
|
|
566
|
+
aReadOnlyFieldInfo.push({
|
|
567
|
+
"property": oData.dataProperty,
|
|
568
|
+
propertyPath: oData.isPropertyReadOnly.operands[0].operand1.path,
|
|
569
|
+
propertyValue: oData.isPropertyReadOnly.operands[0].operand2.value,
|
|
570
|
+
type: "Path"
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
});
|
|
574
|
+
var oData = { "values": aValues, "unitData": aUnitData, "results": aResults, "readablePropertyData": aReadOnlyFieldInfo };
|
|
575
|
+
var oDialogDataModel = new JSONModel(oData);
|
|
576
|
+
return oDialogDataModel;
|
|
577
|
+
},
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* Create the mass edit dialog.
|
|
581
|
+
* @param {object} oTable Instance of Table
|
|
582
|
+
* @param {Array} aContexts Contexts for mass edit
|
|
583
|
+
* @param {object} oController Controller for the view
|
|
584
|
+
* @returns {object} Promise returning instance of dialog.
|
|
585
|
+
*/
|
|
586
|
+
createDialog: function(oTable, aContexts, oController) {
|
|
587
|
+
var sFragmentName = "sap/fe/core/controls/massEdit/MassEditDialog",
|
|
588
|
+
aDataArray = [],
|
|
589
|
+
oResourceBundle = sap.ui.getCore().getLibraryResourceBundle("sap.fe.core"),
|
|
590
|
+
oDefaultValues = MassEditHelper.getDefaultTextsForDialog(oResourceBundle, aContexts.length, oTable),
|
|
591
|
+
oDataFieldModel = MassEditHelper.prepareDataForDialog(oTable, aContexts, aDataArray),
|
|
592
|
+
oDialogDataModel = MassEditHelper.setRuntimeModelOnDialog(aContexts, aDataArray, oDefaultValues);
|
|
593
|
+
|
|
594
|
+
return new Promise(function(resolve, reject) {
|
|
595
|
+
var oFragment = XMLTemplateProcessor.loadTemplate(sFragmentName, "fragment");
|
|
596
|
+
return Promise.resolve(
|
|
597
|
+
XMLPreprocessor.process(
|
|
598
|
+
oFragment,
|
|
599
|
+
{ name: sFragmentName },
|
|
600
|
+
{
|
|
601
|
+
bindingContexts: {
|
|
602
|
+
dataFieldModel: oDataFieldModel.createBindingContext("/")
|
|
603
|
+
},
|
|
604
|
+
models: {
|
|
605
|
+
dataFieldModel: oDataFieldModel
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
)
|
|
609
|
+
)
|
|
610
|
+
.then(function(oFragment) {
|
|
611
|
+
return Fragment.load({ definition: oFragment }).then(function(oDialogContent) {
|
|
612
|
+
var oDialog = new Dialog({
|
|
613
|
+
title: oDefaultValues.massEditTitle,
|
|
614
|
+
content: [oDialogContent],
|
|
615
|
+
beginButton: {
|
|
616
|
+
text: oDefaultValues.applyButtonText,
|
|
617
|
+
type: "Emphasized",
|
|
618
|
+
press: function(oEvent) {
|
|
619
|
+
var oDialog = oEvent.getSource().getParent(),
|
|
620
|
+
oModel = oDialog.getModel("fieldsInfo"),
|
|
621
|
+
aResults = oModel.getProperty("/results"),
|
|
622
|
+
aPropertyReadableInfo = oModel.getProperty("/readablePropertyData"),
|
|
623
|
+
changePromise = [],
|
|
624
|
+
bReadOnlyField = false;
|
|
625
|
+
|
|
626
|
+
aContexts.forEach(function(oSelectedContext) {
|
|
627
|
+
aResults.forEach(function(oResult) {
|
|
628
|
+
//TODO - Add save implementation for Value Help.
|
|
629
|
+
if (aPropertyReadableInfo) {
|
|
630
|
+
bReadOnlyField = aPropertyReadableInfo.some(function(oPropertyInfo) {
|
|
631
|
+
if (oResult.keyValue === oPropertyInfo.property) {
|
|
632
|
+
if (oPropertyInfo.type === "Default") {
|
|
633
|
+
return oPropertyInfo.value === true;
|
|
634
|
+
} else if (
|
|
635
|
+
oPropertyInfo.type === "Path" &&
|
|
636
|
+
oPropertyInfo.propertyValue &&
|
|
637
|
+
oPropertyInfo.propertyPath
|
|
638
|
+
) {
|
|
639
|
+
return (
|
|
640
|
+
oSelectedContext.getObject(oPropertyInfo.propertyPath) ===
|
|
641
|
+
oPropertyInfo.propertyValue
|
|
642
|
+
);
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
if (oResult.keyValue && oResult.value !== "Default" && !bReadOnlyField) {
|
|
648
|
+
changePromise.push(oSelectedContext.setProperty(oResult.keyValue, oResult.value));
|
|
649
|
+
}
|
|
650
|
+
});
|
|
651
|
+
});
|
|
652
|
+
return Promise.all(changePromise)
|
|
653
|
+
.then(function(oRes) {
|
|
654
|
+
var oListBinding = oTable.getRowBinding(),
|
|
655
|
+
oExtensionAPI = oController && oController.getExtensionAPI();
|
|
656
|
+
return oExtensionAPI.refresh(oListBinding.getPath()).then(function() {
|
|
657
|
+
oDialog.close();
|
|
658
|
+
oDialog.destroy();
|
|
659
|
+
return oRes;
|
|
660
|
+
});
|
|
661
|
+
})
|
|
662
|
+
.catch(function(oError) {
|
|
663
|
+
//TODO - Add error handling part for the Dialog
|
|
664
|
+
Log.error("Mass Edit: Something went wrong in updating entries.", oError);
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
},
|
|
668
|
+
endButton: {
|
|
669
|
+
text: oDefaultValues.cancelButtonText,
|
|
670
|
+
press: function(oEvent) {
|
|
671
|
+
var oDialog = oEvent.getSource().getParent();
|
|
672
|
+
oDialog.close();
|
|
673
|
+
oDialog.destroy();
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
});
|
|
677
|
+
oDialog.setModel(oDialogDataModel, "fieldsInfo");
|
|
678
|
+
resolve(oDialog);
|
|
679
|
+
});
|
|
680
|
+
})
|
|
681
|
+
.catch(reject);
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
};
|
|
685
|
+
return MassEditHelper;
|
|
686
|
+
}
|
|
687
|
+
);
|