@sapui5/sap.fe.core 1.100.0 → 1.101.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/src/sap/fe/core/.library +2 -3
- package/src/sap/fe/core/AnnotationHelper.js +43 -24
- package/src/sap/fe/core/AnnotationHelper.ts +43 -37
- package/src/sap/fe/core/AppComponent.js +20 -27
- package/src/sap/fe/core/AppComponent.ts +19 -25
- package/src/sap/fe/core/AppStateHandler.js +5 -5
- package/src/sap/fe/core/AppStateHandler.ts +2 -2
- package/src/sap/fe/core/BaseController.js +9 -9
- package/src/sap/fe/core/BaseController.ts +3 -4
- package/src/sap/fe/core/CommonUtils.js +74 -17
- package/src/sap/fe/core/CommonUtils.ts +181 -110
- package/src/sap/fe/core/ExtensionAPI.js +11 -10
- package/src/sap/fe/core/ExtensionAPI.ts +22 -30
- package/src/sap/fe/core/PageController.js +12 -11
- package/src/sap/fe/core/PageController.ts +34 -34
- package/src/sap/fe/core/RouterProxy.js +36 -24
- package/src/sap/fe/core/RouterProxy.ts +36 -22
- package/src/sap/fe/core/TemplateComponent.js +193 -118
- package/src/sap/fe/core/TemplateComponent.ts +105 -117
- package/src/sap/fe/core/TemplateModel.js +6 -8
- package/src/sap/fe/core/TemplateModel.ts +2 -2
- package/src/sap/fe/core/TransactionHelper.js +33 -18
- package/src/sap/fe/core/TransactionHelper.ts +172 -153
- package/src/sap/fe/core/actions/collaboration/ActivitySync.js +31 -17
- package/src/sap/fe/core/actions/collaboration/ActivitySync.ts +52 -45
- package/src/sap/fe/core/actions/collaboration/CollaborationCommon.js +16 -6
- package/src/sap/fe/core/actions/collaboration/CollaborationCommon.ts +13 -3
- package/src/sap/fe/core/actions/collaboration/Manage.js +9 -7
- package/src/sap/fe/core/actions/collaboration/Manage.ts +33 -31
- package/src/sap/fe/core/actions/collaboration/ManageDialog.fragment.xml +53 -56
- package/src/sap/fe/core/actions/draft.js +308 -166
- package/src/sap/fe/core/actions/draft.ts +177 -74
- package/src/sap/fe/core/actions/messageHandling.js +25 -13
- package/src/sap/fe/core/actions/messageHandling.ts +49 -39
- package/src/sap/fe/core/actions/operations.js +4 -4
- package/src/sap/fe/core/actions/operations.ts +3 -2
- package/src/sap/fe/core/buildingBlocks/AttributeModel.js +60 -0
- package/src/sap/fe/core/buildingBlocks/AttributeModel.ts +37 -0
- package/src/sap/fe/core/buildingBlocks/BuildingBlock.js +165 -0
- package/src/sap/fe/core/buildingBlocks/BuildingBlock.ts +178 -0
- package/src/sap/fe/core/buildingBlocks/BuildingBlockRuntime.js +707 -0
- package/src/sap/fe/core/buildingBlocks/BuildingBlockRuntime.ts +628 -0
- package/src/sap/fe/core/buildingBlocks/TraceInfo.js +436 -0
- package/src/sap/fe/core/buildingBlocks/TraceInfo.ts +431 -0
- package/src/sap/fe/core/controllerextensions/EditFlow.js +506 -245
- package/src/sap/fe/core/controllerextensions/EditFlow.ts +395 -275
- package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.js +11 -11
- package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.ts +6 -7
- package/src/sap/fe/core/controllerextensions/InternalEditFlow.js +15 -17
- package/src/sap/fe/core/controllerextensions/InternalEditFlow.ts +98 -96
- package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.js +15 -15
- package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.ts +60 -53
- package/src/sap/fe/core/controllerextensions/InternalRouting.js +94 -42
- package/src/sap/fe/core/controllerextensions/InternalRouting.ts +114 -91
- package/src/sap/fe/core/controllerextensions/KPIManagement.js +14 -14
- package/src/sap/fe/core/controllerextensions/KPIManagement.ts +12 -11
- package/src/sap/fe/core/controllerextensions/MassEdit.js +12 -12
- package/src/sap/fe/core/controllerextensions/MassEdit.ts +8 -9
- package/src/sap/fe/core/controllerextensions/MessageHandler.js +13 -25
- package/src/sap/fe/core/controllerextensions/MessageHandler.ts +18 -28
- package/src/sap/fe/core/controllerextensions/PageReady.js +25 -23
- package/src/sap/fe/core/controllerextensions/PageReady.ts +49 -47
- package/src/sap/fe/core/controllerextensions/Paginator.js +13 -13
- package/src/sap/fe/core/controllerextensions/Paginator.ts +24 -18
- package/src/sap/fe/core/controllerextensions/Placeholder.js +10 -10
- package/src/sap/fe/core/controllerextensions/Placeholder.ts +12 -14
- package/src/sap/fe/core/controllerextensions/Routing.js +11 -11
- package/src/sap/fe/core/controllerextensions/Routing.ts +12 -13
- package/src/sap/fe/core/controllerextensions/Share.js +16 -16
- package/src/sap/fe/core/controllerextensions/Share.ts +32 -32
- package/src/sap/fe/core/controllerextensions/SideEffects.js +14 -14
- package/src/sap/fe/core/controllerextensions/SideEffects.ts +62 -63
- package/src/sap/fe/core/controllerextensions/ViewState.js +17 -31
- package/src/sap/fe/core/controllerextensions/ViewState.ts +93 -102
- package/src/sap/fe/core/controls/Any.js +28 -0
- package/src/sap/fe/core/controls/Any.ts +30 -0
- package/src/sap/fe/core/controls/CommandExecution.js +38 -15
- package/src/sap/fe/core/controls/CommandExecution.ts +20 -20
- package/src/sap/fe/core/controls/ConditionalWrapper.js +136 -65
- package/src/sap/fe/core/controls/ConditionalWrapper.ts +49 -58
- package/src/sap/fe/core/controls/CustomFilterFieldContentWrapper.js +366 -0
- package/src/sap/fe/core/controls/CustomFilterFieldContentWrapper.ts +278 -0
- package/src/sap/fe/core/controls/CustomQuickViewPage.js +73 -36
- package/src/sap/fe/core/controls/CustomQuickViewPage.ts +22 -32
- package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossDraft.fragment.xml +44 -5
- package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.js +116 -66
- package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.ts +121 -67
- package/src/sap/fe/core/controls/FieldWrapper.js +171 -87
- package/src/sap/fe/core/controls/FieldWrapper.ts +69 -80
- package/src/sap/fe/core/controls/FileWrapper.js +313 -0
- package/src/sap/fe/core/controls/FileWrapper.ts +169 -0
- package/src/sap/fe/core/controls/FilterBar.js +154 -119
- package/src/sap/fe/core/controls/FilterBar.ts +128 -123
- package/src/sap/fe/core/controls/FormElementWrapper.js +92 -37
- package/src/sap/fe/core/controls/FormElementWrapper.ts +32 -35
- package/src/sap/fe/core/controls/filterbar/FilterContainer.js +111 -89
- package/src/sap/fe/core/controls/filterbar/FilterContainer.ts +86 -82
- package/src/sap/fe/core/controls/filterbar/VisualFilter.js +242 -193
- package/src/sap/fe/core/controls/filterbar/VisualFilter.ts +211 -204
- package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.js +152 -116
- package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.ts +105 -105
- package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.js +1 -1
- package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.ts +2 -2
- package/src/sap/fe/core/controls/massEdit/MassEditDialog.fragment.xml +37 -42
- package/src/sap/fe/core/controls/massEdit/MassEditHandlers.js +7 -6
- package/src/sap/fe/core/controls/massEdit/MassEditHandlers.ts +15 -14
- package/src/sap/fe/core/converters/ManifestSettings.js +2 -1
- package/src/sap/fe/core/converters/ManifestSettings.ts +5 -1
- package/src/sap/fe/core/converters/annotations/DataField.js +1 -2
- package/src/sap/fe/core/converters/annotations/DataField.ts +3 -4
- package/src/sap/fe/core/converters/controls/Common/Action.js +10 -10
- package/src/sap/fe/core/converters/controls/Common/Action.ts +20 -19
- package/src/sap/fe/core/converters/controls/Common/Chart.js +8 -8
- package/src/sap/fe/core/converters/controls/Common/Chart.ts +12 -11
- package/src/sap/fe/core/converters/controls/Common/Form.js +5 -5
- package/src/sap/fe/core/converters/controls/Common/Form.ts +3 -1
- package/src/sap/fe/core/converters/controls/Common/KPI.js +1 -1
- package/src/sap/fe/core/converters/controls/Common/KPI.ts +2 -3
- package/src/sap/fe/core/converters/controls/Common/Table.js +245 -112
- package/src/sap/fe/core/converters/controls/Common/Table.ts +305 -193
- package/src/sap/fe/core/converters/controls/Common/table/StandardActions.js +5 -5
- package/src/sap/fe/core/converters/controls/Common/table/StandardActions.ts +4 -7
- package/src/sap/fe/core/converters/controls/ListReport/FilterBar.js +72 -43
- package/src/sap/fe/core/converters/controls/ListReport/FilterBar.ts +134 -100
- package/src/sap/fe/core/converters/controls/ObjectPage/HeaderFacet.js +6 -6
- package/src/sap/fe/core/converters/controls/ObjectPage/HeaderFacet.ts +20 -18
- package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.js +5 -2
- package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.ts +4 -1
- package/src/sap/fe/core/converters/objectPage/FormMenuActions.js +1 -1
- package/src/sap/fe/core/converters/objectPage/FormMenuActions.ts +0 -4
- package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.js +27 -24
- package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.ts +49 -40
- package/src/sap/fe/core/converters/templates/ListReportConverter.js +33 -22
- package/src/sap/fe/core/converters/templates/ListReportConverter.ts +77 -62
- package/src/sap/fe/core/converters/templates/ObjectPageConverter.js +5 -5
- package/src/sap/fe/core/converters/templates/ObjectPageConverter.ts +3 -7
- package/src/sap/fe/core/formatters/KPIFormatter.js +3 -12
- package/src/sap/fe/core/formatters/KPIFormatter.ts +3 -2
- package/src/sap/fe/core/formatters/TableFormatter.js +2 -2
- package/src/sap/fe/core/formatters/TableFormatter.ts +1 -1
- package/src/sap/fe/core/formatters/ValueFormatter.js +4 -4
- package/src/sap/fe/core/formatters/ValueFormatter.ts +4 -7
- package/src/sap/fe/core/fpm/Component.js +46 -17
- package/src/sap/fe/core/fpm/Component.ts +11 -16
- package/src/sap/fe/core/helpers/AppStartupHelper.js +4 -4
- package/src/sap/fe/core/helpers/AppStartupHelper.ts +3 -3
- package/src/sap/fe/core/helpers/ClassSupport.js +273 -256
- package/src/sap/fe/core/helpers/ClassSupport.ts +314 -237
- package/src/sap/fe/core/helpers/MassEditHelper.js +173 -39
- package/src/sap/fe/core/helpers/MassEditHelper.ts +236 -132
- package/src/sap/fe/core/helpers/ModelHelper.js +29 -1
- package/src/sap/fe/core/helpers/ModelHelper.ts +23 -0
- package/src/sap/fe/core/helpers/PasteHelper.js +4 -4
- package/src/sap/fe/core/helpers/PasteHelper.ts +4 -3
- package/src/sap/fe/core/helpers/SemanticDateOperators.js +3 -3
- package/src/sap/fe/core/helpers/SemanticDateOperators.ts +3 -1
- package/src/sap/fe/core/helpers/SemanticKeyHelper.js +1 -1
- package/src/sap/fe/core/helpers/SemanticKeyHelper.ts +1 -1
- package/src/sap/fe/core/helpers/StableIdHelper.js +1 -7
- package/src/sap/fe/core/helpers/StableIdHelper.ts +0 -4
- package/src/sap/fe/core/jsx-runtime/jsx.js +35 -5
- package/src/sap/fe/core/jsx-runtime/jsx.ts +22 -8
- package/src/sap/fe/core/library.js +4 -5
- package/src/sap/fe/core/library.ts +17 -17
- package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.js +1 -1
- package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.ts +0 -3
- package/src/sap/fe/core/messagebundle.properties +23 -8
- package/src/sap/fe/core/messagebundle_ar.properties +2 -0
- package/src/sap/fe/core/messagebundle_bg.properties +2 -0
- package/src/sap/fe/core/messagebundle_ca.properties +2 -0
- package/src/sap/fe/core/messagebundle_cs.properties +2 -0
- package/src/sap/fe/core/messagebundle_cy.properties +5 -3
- package/src/sap/fe/core/messagebundle_da.properties +2 -0
- package/src/sap/fe/core/messagebundle_de.properties +2 -0
- package/src/sap/fe/core/messagebundle_el.properties +2 -0
- package/src/sap/fe/core/messagebundle_en.properties +2 -0
- package/src/sap/fe/core/messagebundle_en_GB.properties +2 -0
- package/src/sap/fe/core/messagebundle_en_US_sappsd.properties +2 -0
- package/src/sap/fe/core/messagebundle_en_US_saprigi.properties +2 -0
- package/src/sap/fe/core/messagebundle_en_US_saptrc.properties +2 -0
- package/src/sap/fe/core/messagebundle_es.properties +2 -0
- package/src/sap/fe/core/messagebundle_es_MX.properties +2 -0
- package/src/sap/fe/core/messagebundle_et.properties +2 -0
- package/src/sap/fe/core/messagebundle_fi.properties +2 -0
- package/src/sap/fe/core/messagebundle_fr.properties +4 -2
- package/src/sap/fe/core/messagebundle_fr_CA.properties +5 -3
- package/src/sap/fe/core/messagebundle_hi.properties +2 -0
- package/src/sap/fe/core/messagebundle_hr.properties +5 -3
- package/src/sap/fe/core/messagebundle_hu.properties +2 -0
- package/src/sap/fe/core/messagebundle_id.properties +2 -0
- package/src/sap/fe/core/messagebundle_it.properties +2 -0
- package/src/sap/fe/core/messagebundle_iw.properties +2 -0
- package/src/sap/fe/core/messagebundle_ja.properties +2 -0
- package/src/sap/fe/core/messagebundle_kk.properties +2 -0
- package/src/sap/fe/core/messagebundle_ko.properties +2 -0
- package/src/sap/fe/core/messagebundle_lt.properties +2 -0
- package/src/sap/fe/core/messagebundle_lv.properties +5 -3
- package/src/sap/fe/core/messagebundle_ms.properties +2 -0
- package/src/sap/fe/core/messagebundle_nl.properties +2 -0
- package/src/sap/fe/core/messagebundle_no.properties +2 -0
- package/src/sap/fe/core/messagebundle_pl.properties +5 -3
- package/src/sap/fe/core/messagebundle_pt.properties +2 -0
- package/src/sap/fe/core/messagebundle_pt_PT.properties +2 -0
- package/src/sap/fe/core/messagebundle_ro.properties +5 -3
- package/src/sap/fe/core/messagebundle_ru.properties +5 -3
- package/src/sap/fe/core/messagebundle_sh.properties +2 -0
- package/src/sap/fe/core/messagebundle_sk.properties +2 -0
- package/src/sap/fe/core/messagebundle_sl.properties +2 -0
- package/src/sap/fe/core/messagebundle_sv.properties +3 -1
- package/src/sap/fe/core/messagebundle_th.properties +2 -0
- package/src/sap/fe/core/messagebundle_tr.properties +2 -0
- package/src/sap/fe/core/messagebundle_uk.properties +2 -0
- package/src/sap/fe/core/messagebundle_vi.properties +2 -0
- package/src/sap/fe/core/messagebundle_zh_CN.properties +5 -3
- package/src/sap/fe/core/messagebundle_zh_TW.properties +5 -3
- package/src/sap/fe/core/services/AsyncComponentServiceFactory.js +4 -4
- package/src/sap/fe/core/services/AsyncComponentServiceFactory.ts +1 -1
- package/src/sap/fe/core/services/CacheHandlerServiceFactory.js +5 -5
- package/src/sap/fe/core/services/CacheHandlerServiceFactory.ts +1 -2
- package/src/sap/fe/core/services/EnvironmentServiceFactory.js +7 -7
- package/src/sap/fe/core/services/EnvironmentServiceFactory.ts +6 -5
- package/src/sap/fe/core/services/NavigationServiceFactory.js +4 -4
- package/src/sap/fe/core/services/NavigationServiceFactory.ts +1 -1
- package/src/sap/fe/core/services/ResourceModelServiceFactory.js +4 -4
- package/src/sap/fe/core/services/ResourceModelServiceFactory.ts +1 -1
- package/src/sap/fe/core/services/RoutingServiceFactory.js +98 -62
- package/src/sap/fe/core/services/RoutingServiceFactory.ts +51 -42
- package/src/sap/fe/core/services/ShellServicesFactory.js +69 -29
- package/src/sap/fe/core/services/ShellServicesFactory.ts +26 -29
- package/src/sap/fe/core/services/SideEffectsServiceFactory.js +4 -4
- package/src/sap/fe/core/services/SideEffectsServiceFactory.ts +1 -1
- package/src/sap/fe/core/services/TemplatedViewServiceFactory.js +8 -8
- package/src/sap/fe/core/services/TemplatedViewServiceFactory.ts +6 -17
- package/src/sap/fe/core/services/view/TemplatingErrorPage.controller.js +43 -5
- package/src/sap/fe/core/services/view/TemplatingErrorPage.controller.ts +6 -3
- package/src/sap/fe/core/support/CommonHelper.js +1 -1
- package/src/sap/fe/core/support/CommonHelper.ts +0 -3
- package/src/sap/fe/core/templating/DataModelPathHelper.js +2 -9
- package/src/sap/fe/core/templating/DataModelPathHelper.ts +32 -38
- package/src/sap/fe/core/templating/DisplayModeFormatter.js +23 -3
- package/src/sap/fe/core/templating/DisplayModeFormatter.ts +26 -5
- package/src/sap/fe/core/templating/PropertyHelper.js +15 -1
- package/src/sap/fe/core/templating/PropertyHelper.ts +30 -23
- package/src/sap/fe/core/templating/UIFormatters.js +121 -21
- package/src/sap/fe/core/templating/UIFormatters.ts +134 -49
- package/src/sap/fe/core/type/Email.js +26 -8
- package/src/sap/fe/core/type/Email.ts +8 -7
- package/src/sap/fe/core/controllerextensions/ControllerExtensionMetadata.js +0 -78
- package/src/sap/fe/core/controllerextensions/ControllerExtensionMetadata.ts +0 -65
|
@@ -1,19 +1,26 @@
|
|
|
1
|
+
import Log from "sap/base/Log";
|
|
2
|
+
import CommonUtils from "sap/fe/core/CommonUtils";
|
|
3
|
+
import { BindingExpression, ExpressionOrPrimitive } from "sap/fe/core/helpers/BindingExpression";
|
|
4
|
+
import PageController from "sap/fe/core/PageController";
|
|
5
|
+
import { DataModelObjectPath, enhanceDataModelPath } from "sap/fe/core/templating/DataModelPathHelper";
|
|
6
|
+
import { hasValueHelpWithFixedValues } from "sap/fe/core/templating/PropertyHelper";
|
|
7
|
+
import { FieldProperties } from "sap/fe/macros/field/FieldProperties";
|
|
8
|
+
import { getTextBinding, setEditStyleProperties } from "sap/fe/macros/field/FieldTemplating";
|
|
9
|
+
import Button from "sap/m/Button";
|
|
1
10
|
import Dialog from "sap/m/Dialog";
|
|
2
|
-
import
|
|
3
|
-
import JSONModel from "sap/ui/model/json/JSONModel";
|
|
11
|
+
import Core from "sap/ui/core/Core";
|
|
4
12
|
import Fragment from "sap/ui/core/Fragment";
|
|
5
13
|
import XMLPreprocessor from "sap/ui/core/util/XMLPreprocessor";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
14
|
+
import XMLTemplateProcessor from "sap/ui/core/XMLTemplateProcessor";
|
|
15
|
+
import EditMode from "sap/ui/mdc/enum/EditMode";
|
|
8
16
|
import Table from "sap/ui/mdc/Table";
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
17
|
+
import JSONModel from "sap/ui/model/json/JSONModel";
|
|
18
|
+
import Context from "sap/ui/model/odata/v4/Context";
|
|
19
|
+
import { CoreEx } from "types/extension_types";
|
|
20
|
+
import Any, { AnyType } from "../controls/Any";
|
|
12
21
|
import { convertMetaModelContext, getInvolvedDataModelObjects } from "../converters/MetaModelConverter";
|
|
13
|
-
import { getTextBinding } from "sap/fe/macros/field/FieldTemplating";
|
|
14
|
-
import { getEditableExpression, getRequiredExpression } from "../templating/UIFormatters";
|
|
15
22
|
import { isReadOnlyExpression } from "../templating/FieldControlHelper";
|
|
16
|
-
import {
|
|
23
|
+
import { getEditMode, getRequiredExpression, isCollectionField } from "../templating/UIFormatters";
|
|
17
24
|
|
|
18
25
|
/* This class contains helpers to be used for mass edit functionality */
|
|
19
26
|
type TextArrangementInfo = {
|
|
@@ -24,20 +31,7 @@ type TextArrangementInfo = {
|
|
|
24
31
|
description: string;
|
|
25
32
|
fullText: string;
|
|
26
33
|
};
|
|
27
|
-
|
|
28
|
-
"Edm.Boolean",
|
|
29
|
-
"Edm.Byte",
|
|
30
|
-
"Edm.Decimal",
|
|
31
|
-
"Edm.Double",
|
|
32
|
-
"Edm.Float",
|
|
33
|
-
"Edm.Guid",
|
|
34
|
-
"Edm.Int16",
|
|
35
|
-
"Edm.Int32",
|
|
36
|
-
"Edm.Int64",
|
|
37
|
-
"Edm.SByte",
|
|
38
|
-
"Edm.Single",
|
|
39
|
-
"Edm.String"
|
|
40
|
-
];
|
|
34
|
+
|
|
41
35
|
const MassEditHelper = {
|
|
42
36
|
/**
|
|
43
37
|
* Initializes the value at final or deepest level path with a blank array.
|
|
@@ -47,12 +41,12 @@ const MassEditHelper = {
|
|
|
47
41
|
* @param {Array} aValues Array instance where the default data needs to be added
|
|
48
42
|
* @returns {Array}
|
|
49
43
|
*/
|
|
50
|
-
initLastLevelOfPropertyPath: function(sPath: string, aValues: any) {
|
|
44
|
+
initLastLevelOfPropertyPath: function (sPath: string, aValues: any) {
|
|
51
45
|
let aFinalPath: any;
|
|
52
46
|
let index = 0;
|
|
53
47
|
const aPaths = sPath.split("/");
|
|
54
48
|
let sFullPath = "";
|
|
55
|
-
aPaths.forEach(function(sPropertyPath: string) {
|
|
49
|
+
aPaths.forEach(function (sPropertyPath: string) {
|
|
56
50
|
if (!aValues[sPropertyPath] && index === 0) {
|
|
57
51
|
aValues[sPropertyPath] = {};
|
|
58
52
|
aFinalPath = aValues[sPropertyPath];
|
|
@@ -79,7 +73,7 @@ const MassEditHelper = {
|
|
|
79
73
|
* @param {Array} self Instance of the array
|
|
80
74
|
* @returns {boolean}
|
|
81
75
|
*/
|
|
82
|
-
getUniqueValues: function(sValue: string, index: number, self: any[]) {
|
|
76
|
+
getUniqueValues: function (sValue: string, index: number, self: any[]) {
|
|
83
77
|
if (sValue) {
|
|
84
78
|
return self.indexOf(sValue) === index;
|
|
85
79
|
}
|
|
@@ -93,11 +87,11 @@ const MassEditHelper = {
|
|
|
93
87
|
* @param {object} oValues Object of property values
|
|
94
88
|
* @returns {*}
|
|
95
89
|
*/
|
|
96
|
-
getValueForMultiLevelPath: function(sDataPropertyPath: string, oValues: any) {
|
|
90
|
+
getValueForMultiLevelPath: function (sDataPropertyPath: string, oValues: any) {
|
|
97
91
|
if (sDataPropertyPath && sDataPropertyPath.indexOf("/") > 0) {
|
|
98
92
|
const aPropertyPaths = sDataPropertyPath.split("/");
|
|
99
93
|
let Result: any;
|
|
100
|
-
aPropertyPaths.forEach(function(sPath: string) {
|
|
94
|
+
aPropertyPaths.forEach(function (sPath: string) {
|
|
101
95
|
Result = oValues && oValues[sPath] ? oValues[sPath] : Result && Result[sPath];
|
|
102
96
|
});
|
|
103
97
|
return Result;
|
|
@@ -115,11 +109,11 @@ const MassEditHelper = {
|
|
|
115
109
|
* @param {string} sDataPropertyPath Data property path
|
|
116
110
|
* @returns {string}
|
|
117
111
|
*/
|
|
118
|
-
getDefaultSelectionPathComboBox: function(aContexts: any[], sDataPropertyPath: string) {
|
|
112
|
+
getDefaultSelectionPathComboBox: function (aContexts: any[], sDataPropertyPath: string) {
|
|
119
113
|
if (sDataPropertyPath && aContexts.length > 0) {
|
|
120
114
|
const oSelectedContext = aContexts,
|
|
121
115
|
aPropertyValues: any[] = [];
|
|
122
|
-
oSelectedContext.forEach(function(oContext: any) {
|
|
116
|
+
oSelectedContext.forEach(function (oContext: any) {
|
|
123
117
|
const oDataObject = oContext.getObject();
|
|
124
118
|
const sMultiLevelPathCondition =
|
|
125
119
|
sDataPropertyPath.indexOf("/") > -1 && oDataObject.hasOwnProperty(sDataPropertyPath.split("/")[0]);
|
|
@@ -145,15 +139,41 @@ const MassEditHelper = {
|
|
|
145
139
|
* @param {Array} aContexts Contexts for mass edit
|
|
146
140
|
* @returns {boolean}
|
|
147
141
|
*/
|
|
148
|
-
getHiddenValueForContexts: function(hiddenValue: any, aContexts: any[]) {
|
|
142
|
+
getHiddenValueForContexts: function (hiddenValue: any, aContexts: any[]) {
|
|
149
143
|
if (hiddenValue && hiddenValue.$Path) {
|
|
150
|
-
return !aContexts.some(function(oSelectedContext: any) {
|
|
144
|
+
return !aContexts.some(function (oSelectedContext: any) {
|
|
151
145
|
return oSelectedContext.getObject(hiddenValue.$Path) === false;
|
|
152
146
|
});
|
|
153
147
|
}
|
|
154
148
|
return hiddenValue;
|
|
155
149
|
},
|
|
156
150
|
|
|
151
|
+
getInputType: function (propertyInfo: any, dataFieldConverted: any, oDataModelPath: DataModelObjectPath): string {
|
|
152
|
+
const editStyleProperties = {} as FieldProperties;
|
|
153
|
+
let inputType!: string;
|
|
154
|
+
if (propertyInfo) {
|
|
155
|
+
setEditStyleProperties(editStyleProperties, dataFieldConverted, oDataModelPath, true);
|
|
156
|
+
inputType = editStyleProperties?.editStyle || "";
|
|
157
|
+
}
|
|
158
|
+
const isValidForMassEdit =
|
|
159
|
+
inputType &&
|
|
160
|
+
["DatePicker", "TimePicker", "DateTimePicker", "RatingIndicator"].indexOf(inputType) === -1 &&
|
|
161
|
+
!isCollectionField(oDataModelPath) &&
|
|
162
|
+
!hasValueHelpWithFixedValues(propertyInfo);
|
|
163
|
+
|
|
164
|
+
return (isValidForMassEdit || "") && inputType;
|
|
165
|
+
},
|
|
166
|
+
|
|
167
|
+
getIsFieldGrp: function (dataFieldConverted: any): boolean {
|
|
168
|
+
return (
|
|
169
|
+
dataFieldConverted &&
|
|
170
|
+
dataFieldConverted.$Type === "com.sap.vocabularies.UI.v1.DataFieldForAnnotation" &&
|
|
171
|
+
dataFieldConverted.Target &&
|
|
172
|
+
dataFieldConverted.Target.value &&
|
|
173
|
+
dataFieldConverted.Target.value.indexOf("FieldGroup") > -1
|
|
174
|
+
);
|
|
175
|
+
},
|
|
176
|
+
|
|
157
177
|
/**
|
|
158
178
|
* Initializes a JSON Model for properties of dialog fields [label, visiblity, dataproperty, etc.].
|
|
159
179
|
*
|
|
@@ -162,11 +182,12 @@ const MassEditHelper = {
|
|
|
162
182
|
* @param {Array} aDataArray Array containing data related to the dialog used by both the static and the runtime model
|
|
163
183
|
* @returns {object}
|
|
164
184
|
*/
|
|
165
|
-
prepareDataForDialog: function(oTable: Table, aContexts: any[], aDataArray: any[]) {
|
|
185
|
+
prepareDataForDialog: function (oTable: Table, aContexts: any[], aDataArray: any[]) {
|
|
166
186
|
const oMetaModel = oTable && (oTable.getModel().getMetaModel() as any),
|
|
167
187
|
sCurrentEntitySetName = oTable.data("metaPath"),
|
|
168
188
|
aTableFields = MassEditHelper.getTableFields(oTable),
|
|
169
189
|
oEntityTypeContext = oMetaModel.getContext(sCurrentEntitySetName + "/@"),
|
|
190
|
+
oEntitySetContext = oMetaModel.getContext(sCurrentEntitySetName),
|
|
170
191
|
oDataModelObjectPath = getInvolvedDataModelObjects(oEntityTypeContext);
|
|
171
192
|
|
|
172
193
|
const oDataFieldModel = new JSONModel();
|
|
@@ -175,14 +196,9 @@ const MassEditHelper = {
|
|
|
175
196
|
let bValueHelpEnabled;
|
|
176
197
|
let sUnitPropertyPath;
|
|
177
198
|
let bValueHelpEnabledForUnit;
|
|
178
|
-
let bIsImmutable;
|
|
179
|
-
let bIsComputed;
|
|
180
|
-
let bChartProperty;
|
|
181
199
|
let oTextBinding;
|
|
182
|
-
let bValidDataType;
|
|
183
|
-
let bInValidInputType;
|
|
184
200
|
|
|
185
|
-
aTableFields.forEach(function(oColumnInfo: any) {
|
|
201
|
+
aTableFields.forEach(function (oColumnInfo: any) {
|
|
186
202
|
const sDataPropertyPath = oColumnInfo.dataProperty;
|
|
187
203
|
if (sDataPropertyPath) {
|
|
188
204
|
let oPropertyInfo = sDataPropertyPath && oMetaModel.getObject(sCurrentEntitySetName + "/" + sDataPropertyPath + "@");
|
|
@@ -205,7 +221,7 @@ const MassEditHelper = {
|
|
|
205
221
|
"@com.sap.vocabularies.Common.v1.ValueList"
|
|
206
222
|
];
|
|
207
223
|
if (oDataModelObjectPath) {
|
|
208
|
-
oDataModelObjectPath.targetObject = oDataModelObjectPath.targetEntityType.entityProperties.filter(function(
|
|
224
|
+
oDataModelObjectPath.targetObject = oDataModelObjectPath.targetEntityType.entityProperties.filter(function (
|
|
209
225
|
oProperty: any
|
|
210
226
|
) {
|
|
211
227
|
return oProperty.name === sDataPropertyPath;
|
|
@@ -217,20 +233,23 @@ const MassEditHelper = {
|
|
|
217
233
|
oDataFieldConverted = convertMetaModelContext(oFieldContext),
|
|
218
234
|
oPropertyContext = oMetaModel.getContext(sCurrentEntitySetName + "/" + sDataPropertyPath + "@"),
|
|
219
235
|
oInterface = oPropertyContext && oPropertyContext.getInterface();
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
236
|
+
|
|
237
|
+
let oDataModelPath = getInvolvedDataModelObjects(oFieldContext, oEntitySetContext);
|
|
238
|
+
if (oDataFieldConverted?.Value?.path?.length > 0) {
|
|
239
|
+
oDataModelPath = enhanceDataModelPath(oDataModelPath, sDataPropertyPath);
|
|
240
|
+
}
|
|
224
241
|
const bHiddenField =
|
|
225
242
|
MassEditHelper.getHiddenValueForContexts(
|
|
226
243
|
oFieldContext && oFieldContext.getObject()["@com.sap.vocabularies.UI.v1.Hidden"],
|
|
227
244
|
aContexts
|
|
228
245
|
) || false;
|
|
246
|
+
const isImage = oPropertyInfo && oPropertyInfo["@com.sap.vocabularies.UI.v1.IsImageURL"];
|
|
247
|
+
|
|
229
248
|
oInterface.context = {
|
|
230
|
-
getModel: function() {
|
|
249
|
+
getModel: function () {
|
|
231
250
|
return oInterface.getModel();
|
|
232
251
|
},
|
|
233
|
-
getPath: function() {
|
|
252
|
+
getPath: function () {
|
|
234
253
|
return sCurrentEntitySetName + "/" + sDataPropertyPath;
|
|
235
254
|
}
|
|
236
255
|
};
|
|
@@ -238,33 +257,33 @@ const MassEditHelper = {
|
|
|
238
257
|
(oDataFieldConverted && oDataFieldConverted.Value && oDataFieldConverted.Value.$target) ||
|
|
239
258
|
(oDataFieldConverted && oDataFieldConverted.Target && oDataFieldConverted.Target.$target);
|
|
240
259
|
// Datafield is not included in the FieldControl calculation, needs to be implemented
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
+
|
|
261
|
+
const chartProperty = oPropertyInfo && oPropertyInfo.term && oPropertyInfo.term === "com.sap.vocabularies.UI.v1.Chart";
|
|
262
|
+
const isAction = !!oDataFieldConverted.Action;
|
|
263
|
+
const isFieldGrp = MassEditHelper.getIsFieldGrp(oDataFieldConverted);
|
|
264
|
+
|
|
265
|
+
if (isImage || bHiddenField || chartProperty || isAction || isFieldGrp) {
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// EditMode and InputType
|
|
270
|
+
const propertyForFieldControl = oPropertyInfo && oPropertyInfo.Value ? oPropertyInfo.Value : oPropertyInfo;
|
|
271
|
+
const expBinding = getEditMode(propertyForFieldControl, oDataModelPath, false, false, oDataFieldConverted, true);
|
|
272
|
+
const editModeValues = Object.keys(EditMode);
|
|
273
|
+
const editModeIsStatic = !!expBinding && editModeValues.includes(expBinding as EditMode);
|
|
274
|
+
const editable = !!expBinding && ((editModeIsStatic && expBinding === EditMode.Editable) || !editModeIsStatic);
|
|
275
|
+
|
|
276
|
+
if (!editable) {
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
const inputType = MassEditHelper.getInputType(oPropertyInfo, oDataFieldConverted, oDataModelPath);
|
|
281
|
+
|
|
282
|
+
if (inputType) {
|
|
283
|
+
const isReadOnly = isReadOnlyExpression(oPropertyInfo);
|
|
284
|
+
|
|
260
285
|
oResult = {
|
|
261
286
|
"label": sLabelText + ":",
|
|
262
|
-
"visible":
|
|
263
|
-
sDataPropertyPath &&
|
|
264
|
-
!bHiddenField &&
|
|
265
|
-
!bIsImmutable &&
|
|
266
|
-
!bIsComputed &&
|
|
267
|
-
getEditableExpression(oPropertyInfo, oDataFieldConverted, oDataModelObjectPath),
|
|
268
287
|
"dataProperty": sDataPropertyPath,
|
|
269
288
|
"isValueHelpEnabled": bValueHelpEnabled ? bValueHelpEnabled : false,
|
|
270
289
|
"unitProperty": sUnitPropertyPath ? sUnitPropertyPath : false,
|
|
@@ -281,7 +300,9 @@ const MassEditHelper = {
|
|
|
281
300
|
"entitySet": sCurrentEntitySetName,
|
|
282
301
|
"textBinding": oTextBinding,
|
|
283
302
|
"nullable": oPropertyInfo.nullable !== undefined ? oPropertyInfo.nullable : true,
|
|
284
|
-
"isPropertyReadOnly": isReadOnly !== undefined ? isReadOnly : false
|
|
303
|
+
"isPropertyReadOnly": isReadOnly !== undefined ? isReadOnly : false,
|
|
304
|
+
"inputType": inputType,
|
|
305
|
+
"editMode": editable ? expBinding : undefined
|
|
285
306
|
};
|
|
286
307
|
aDataArray.push(oResult);
|
|
287
308
|
}
|
|
@@ -291,47 +312,25 @@ const MassEditHelper = {
|
|
|
291
312
|
return oDataFieldModel;
|
|
292
313
|
},
|
|
293
314
|
|
|
294
|
-
|
|
295
|
-
return (
|
|
296
|
-
oColumn.getTemplate().getContent &&
|
|
297
|
-
oColumn.getTemplate().getContent() &&
|
|
298
|
-
oColumn.getTemplate().getContent().getContentEdit &&
|
|
299
|
-
oColumn
|
|
300
|
-
.getTemplate()
|
|
301
|
-
.getContent()
|
|
302
|
-
.getContentEdit() &&
|
|
303
|
-
oColumn
|
|
304
|
-
.getTemplate()
|
|
305
|
-
.getContent()
|
|
306
|
-
.getContentEdit()[0] &&
|
|
307
|
-
oColumn
|
|
308
|
-
.getTemplate()
|
|
309
|
-
.getContent()
|
|
310
|
-
.getContentEdit()[0]
|
|
311
|
-
.getMetadata()
|
|
312
|
-
.getName()
|
|
313
|
-
);
|
|
314
|
-
},
|
|
315
|
-
|
|
316
|
-
getTableFields: function(oTable: any) {
|
|
315
|
+
getTableFields: function (oTable: any) {
|
|
317
316
|
const aColumns = (oTable && oTable.getColumns()) || [];
|
|
318
|
-
|
|
317
|
+
const columnsData = oTable && oTable.getParent().getTableDefinition().columns;
|
|
318
|
+
return aColumns.map(function (oColumn: any) {
|
|
319
319
|
const sDataProperty = oColumn && oColumn.getDataProperty(),
|
|
320
320
|
aRealtedColumnInfo =
|
|
321
|
-
|
|
322
|
-
|
|
321
|
+
columnsData &&
|
|
322
|
+
columnsData.filter(function (oColumnInfo: any) {
|
|
323
323
|
return oColumnInfo.name === sDataProperty && oColumnInfo.type === "Annotation";
|
|
324
324
|
});
|
|
325
325
|
return {
|
|
326
326
|
"dataProperty": sDataProperty,
|
|
327
327
|
"label": oColumn.getHeader(),
|
|
328
|
-
"annotationPath": aRealtedColumnInfo && aRealtedColumnInfo[0] && aRealtedColumnInfo[0].annotationPath
|
|
329
|
-
"inputType": MassEditHelper.getInputTypeForColumn(oColumn)
|
|
328
|
+
"annotationPath": aRealtedColumnInfo && aRealtedColumnInfo[0] && aRealtedColumnInfo[0].annotationPath
|
|
330
329
|
};
|
|
331
330
|
});
|
|
332
331
|
},
|
|
333
332
|
|
|
334
|
-
getDefaultTextsForDialog: function(oResourceBundle: any, iSelectedContexts: any, oTable: any) {
|
|
333
|
+
getDefaultTextsForDialog: function (oResourceBundle: any, iSelectedContexts: any, oTable: any) {
|
|
335
334
|
// 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.
|
|
336
335
|
const bDisplayMode = oTable.data("displayModePropertyBinding") === "true";
|
|
337
336
|
|
|
@@ -353,15 +352,15 @@ const MassEditHelper = {
|
|
|
353
352
|
* @param {string} sInputType InputType of the field
|
|
354
353
|
* @returns {string}
|
|
355
354
|
*/
|
|
356
|
-
getSuffixForKeepExisiting: function(sInputType: string) {
|
|
355
|
+
getSuffixForKeepExisiting: function (sInputType: string) {
|
|
357
356
|
let sResult = "Values";
|
|
358
357
|
|
|
359
358
|
switch (sInputType) {
|
|
360
359
|
//TODO - Add for other control types as well (Radio Button, Email, Input, MDC Fields, Image etc.)
|
|
361
|
-
case "
|
|
360
|
+
case "DatePicker":
|
|
362
361
|
sResult = "Dates";
|
|
363
362
|
break;
|
|
364
|
-
case "
|
|
363
|
+
case "CheckBox":
|
|
365
364
|
sResult = "Settings";
|
|
366
365
|
break;
|
|
367
366
|
}
|
|
@@ -377,14 +376,14 @@ const MassEditHelper = {
|
|
|
377
376
|
* @param {object} oPropertyInfo Property information
|
|
378
377
|
* @param {boolean} bUOMField
|
|
379
378
|
*/
|
|
380
|
-
setDefaultValuesToDialog: function(aValues: any[], aContexts: any[], oDefaultValues: any, oPropertyInfo: any, bUOMField?: boolean) {
|
|
381
|
-
const sPropertyPath = oPropertyInfo.dataProperty,
|
|
379
|
+
setDefaultValuesToDialog: function (aValues: any[], aContexts: any[], oDefaultValues: any, oPropertyInfo: any, bUOMField?: boolean) {
|
|
380
|
+
const sPropertyPath = bUOMField ? oPropertyInfo.unitProperty : oPropertyInfo.dataProperty,
|
|
382
381
|
sInputType = oPropertyInfo.inputType,
|
|
383
382
|
bPropertyRequired = oPropertyInfo.isFieldRequired;
|
|
384
383
|
const sSuffixForKeepExisting = MassEditHelper.getSuffixForKeepExisiting(sInputType);
|
|
385
384
|
//TODO - Add <<Use Value Help or control implmentation>> and related key by checking if value help is enabled for property or Unit.
|
|
386
385
|
//TODO - Add option Apply to Empty Fields only for Both Value Help and controls.
|
|
387
|
-
const bValueExistsForPropertyPath = aContexts.some(function(oSelectedContext: any) {
|
|
386
|
+
const bValueExistsForPropertyPath = aContexts.some(function (oSelectedContext: any) {
|
|
388
387
|
return oSelectedContext.getObject(sPropertyPath);
|
|
389
388
|
});
|
|
390
389
|
if (bValueExistsForPropertyPath) {
|
|
@@ -400,7 +399,7 @@ const MassEditHelper = {
|
|
|
400
399
|
});
|
|
401
400
|
},
|
|
402
401
|
|
|
403
|
-
getTextArrangementInfo: function(
|
|
402
|
+
getTextArrangementInfo: function (
|
|
404
403
|
sProperty: any,
|
|
405
404
|
oTextBinding: any,
|
|
406
405
|
sCurrentEntitySet: any,
|
|
@@ -420,7 +419,7 @@ const MassEditHelper = {
|
|
|
420
419
|
sFullText = sValue;
|
|
421
420
|
}
|
|
422
421
|
} else if (oTextBinding.parameters) {
|
|
423
|
-
oTextBinding.parameters.forEach(function(oProps: any) {
|
|
422
|
+
oTextBinding.parameters.forEach(function (oProps: any) {
|
|
424
423
|
if (oProps.path && oProps.path !== sProperty) {
|
|
425
424
|
sDescriptionPath = oProps.path;
|
|
426
425
|
}
|
|
@@ -445,6 +444,92 @@ const MassEditHelper = {
|
|
|
445
444
|
return undefined;
|
|
446
445
|
},
|
|
447
446
|
|
|
447
|
+
/**
|
|
448
|
+
* Return the visibility valuue for the ManagedObject Any.
|
|
449
|
+
*
|
|
450
|
+
* @param {AnyType} any The ManagedObject Any to be used to calculate the visible value of the binding.
|
|
451
|
+
* @returns {boolean} Returns true if the mass edit field is editable.
|
|
452
|
+
*/
|
|
453
|
+
isEditable: function (any: AnyType): boolean {
|
|
454
|
+
const binding = any.getBinding("any");
|
|
455
|
+
const value = (binding as any).getExternalValue();
|
|
456
|
+
return value === EditMode.Editable;
|
|
457
|
+
},
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* Calculate and update the visibility of mass edit field on change of the ManagedObject Any binding.
|
|
461
|
+
*
|
|
462
|
+
* @param {JSONModel} oDialogDataModel Model to be used runtime.
|
|
463
|
+
* @param {string} dataProperty Field name.
|
|
464
|
+
*/
|
|
465
|
+
onContextEditableChange: function (oDialogDataModel: JSONModel, dataProperty: string): void {
|
|
466
|
+
const objectsForVisibility = oDialogDataModel.getProperty("/values/" + dataProperty + "/objectsForVisibility") || [];
|
|
467
|
+
const editable = objectsForVisibility.some(MassEditHelper.isEditable);
|
|
468
|
+
|
|
469
|
+
if (editable) {
|
|
470
|
+
oDialogDataModel.setProperty("/values/" + dataProperty + "/visible", editable);
|
|
471
|
+
}
|
|
472
|
+
},
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* Update Managed Object Any for visibility of the mass edit fields.
|
|
476
|
+
*
|
|
477
|
+
* @param {AnyType} mOToUse The ManagedObject Any to be used to calculate the visible value of the binding.
|
|
478
|
+
* @param {JSONModel} oDialogDataModel Model to be used runtime.
|
|
479
|
+
* @param {string} dataProperty Field name.
|
|
480
|
+
* @param {any} values Values of the field.
|
|
481
|
+
*/
|
|
482
|
+
updateOnContextChange: function (mOToUse: AnyType, oDialogDataModel: JSONModel, dataProperty: string, values: any) {
|
|
483
|
+
const binding = mOToUse.getBinding("any");
|
|
484
|
+
|
|
485
|
+
values.objectsForVisibility = values.objectsForVisibility || [];
|
|
486
|
+
values.objectsForVisibility.push(mOToUse);
|
|
487
|
+
|
|
488
|
+
binding.attachChange(MassEditHelper.onContextEditableChange.bind(null, oDialogDataModel, dataProperty));
|
|
489
|
+
},
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* Get bound object to calculate the visibility of contexts.
|
|
493
|
+
*
|
|
494
|
+
* @param {BindingExpression<boolean> | ExpressionOrPrimitive<boolean>} expBinding Binding String object.
|
|
495
|
+
* @param {object} context Context the binding value.
|
|
496
|
+
* @returns {AnyType} The ManagedObject Any to be used to calculate the visible value of the binding.
|
|
497
|
+
*/
|
|
498
|
+
getBoundObject: function (expBinding: BindingExpression<string> | ExpressionOrPrimitive<string>, context: Context): AnyType {
|
|
499
|
+
const mOToUse = new Any({ any: expBinding });
|
|
500
|
+
const model = context.getModel();
|
|
501
|
+
mOToUse.setModel(model);
|
|
502
|
+
mOToUse.setBindingContext(context);
|
|
503
|
+
|
|
504
|
+
return mOToUse;
|
|
505
|
+
},
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* Get the visibility of the field.
|
|
509
|
+
*
|
|
510
|
+
* @param {BindingExpression<boolean> | ExpressionOrPrimitive<boolean>} expBinding Binding String object.
|
|
511
|
+
* @param {JSONModel} oDialogDataModel Model to be used runtime.
|
|
512
|
+
* @param {string} dataProperty Field name.
|
|
513
|
+
* @param {any} values Values of the field.
|
|
514
|
+
* @param {object} context Context the binding value.
|
|
515
|
+
* @returns {boolean} Returns true if the mass edit field is editable.
|
|
516
|
+
*/
|
|
517
|
+
getFieldVisiblity: function (
|
|
518
|
+
expBinding: BindingExpression<string> | ExpressionOrPrimitive<string>,
|
|
519
|
+
oDialogDataModel: JSONModel,
|
|
520
|
+
dataProperty: string,
|
|
521
|
+
values: any,
|
|
522
|
+
context: Context
|
|
523
|
+
): boolean {
|
|
524
|
+
const mOToUse = MassEditHelper.getBoundObject(expBinding, context);
|
|
525
|
+
const isContextEditable = MassEditHelper.isEditable(mOToUse);
|
|
526
|
+
|
|
527
|
+
if (!isContextEditable) {
|
|
528
|
+
MassEditHelper.updateOnContextChange(mOToUse, oDialogDataModel, dataProperty, values);
|
|
529
|
+
}
|
|
530
|
+
return isContextEditable;
|
|
531
|
+
},
|
|
532
|
+
|
|
448
533
|
/**
|
|
449
534
|
* Initializes a runtime model:
|
|
450
535
|
* => 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.)
|
|
@@ -455,14 +540,16 @@ const MassEditHelper = {
|
|
|
455
540
|
* @param {object} oDefaultValues Default values from i18n
|
|
456
541
|
* @returns {object}
|
|
457
542
|
*/
|
|
458
|
-
setRuntimeModelOnDialog: function(aContexts: any[], aDataArray: any[], oDefaultValues: any) {
|
|
543
|
+
setRuntimeModelOnDialog: function (aContexts: any[], aDataArray: any[], oDefaultValues: any) {
|
|
459
544
|
const aValues: any[] = [];
|
|
460
545
|
const aUnitData: any[] = [];
|
|
461
546
|
const aResults: any[] = [];
|
|
462
547
|
const aReadOnlyFieldInfo: any[] = [];
|
|
463
548
|
const oDistinctValueMap: any = {};
|
|
549
|
+
const oData = { "values": aValues, "unitData": aUnitData, "results": aResults, "readablePropertyData": aReadOnlyFieldInfo };
|
|
550
|
+
const oDialogDataModel = new JSONModel(oData);
|
|
464
551
|
let sPropertyName;
|
|
465
|
-
aDataArray.forEach(function(oData: any) {
|
|
552
|
+
aDataArray.forEach(function (oData: any) {
|
|
466
553
|
let oTextInfo;
|
|
467
554
|
if (oData.dataProperty && oData.dataProperty.indexOf("/") > -1) {
|
|
468
555
|
const aFinalPath = MassEditHelper.initLastLevelOfPropertyPath(oData.dataProperty, aValues);
|
|
@@ -528,7 +615,8 @@ const MassEditHelper = {
|
|
|
528
615
|
}
|
|
529
616
|
}
|
|
530
617
|
});
|
|
531
|
-
aDataArray.forEach(function(oData: any) {
|
|
618
|
+
aDataArray.forEach(function (oData: any) {
|
|
619
|
+
let values: any;
|
|
532
620
|
if (oData.dataProperty.indexOf("/") > -1) {
|
|
533
621
|
const sMultiLevelPropPathValue = MassEditHelper.getValueForMultiLevelPath(oData.dataProperty, aValues);
|
|
534
622
|
if (!sMultiLevelPropPathValue) {
|
|
@@ -536,8 +624,10 @@ const MassEditHelper = {
|
|
|
536
624
|
} else {
|
|
537
625
|
MassEditHelper.setDefaultValuesToDialog(sMultiLevelPropPathValue, aContexts, oDefaultValues, oData);
|
|
538
626
|
}
|
|
627
|
+
values = sMultiLevelPropPathValue;
|
|
539
628
|
} else if (aValues[oData.dataProperty] && aValues[oData.dataProperty].length) {
|
|
540
629
|
MassEditHelper.setDefaultValuesToDialog(aValues[oData.dataProperty], aContexts, oDefaultValues, oData);
|
|
630
|
+
values = aValues[oData.dataProperty];
|
|
541
631
|
}
|
|
542
632
|
if (aUnitData[oData.unitProperty] && aUnitData[oData.unitProperty].length) {
|
|
543
633
|
MassEditHelper.setDefaultValuesToDialog(aUnitData[oData.unitProperty], aContexts, oDefaultValues, oData, true);
|
|
@@ -547,7 +637,7 @@ const MassEditHelper = {
|
|
|
547
637
|
) {
|
|
548
638
|
const bClearFieldOrBlankValueExists =
|
|
549
639
|
aValues[oData.dataProperty] &&
|
|
550
|
-
aValues[oData.dataProperty].some(function(obj: any) {
|
|
640
|
+
aValues[oData.dataProperty].some(function (obj: any) {
|
|
551
641
|
return obj.text === "< Clear Values >" || obj.text === "< Leave Blank >";
|
|
552
642
|
});
|
|
553
643
|
if (oData.dataProperty && !bClearFieldOrBlankValueExists) {
|
|
@@ -555,7 +645,7 @@ const MassEditHelper = {
|
|
|
555
645
|
}
|
|
556
646
|
const bClearFieldOrBlankUnitValueExists =
|
|
557
647
|
aUnitData[oData.unitProperty] &&
|
|
558
|
-
aUnitData[oData.unitProperty].some(function(obj: any) {
|
|
648
|
+
aUnitData[oData.unitProperty].some(function (obj: any) {
|
|
559
649
|
return obj.text === "< Clear Values >" || obj.text === "< Leave Blank >";
|
|
560
650
|
});
|
|
561
651
|
if (oData.unitProperty && !bClearFieldOrBlankUnitValueExists) {
|
|
@@ -582,9 +672,18 @@ const MassEditHelper = {
|
|
|
582
672
|
type: "Path"
|
|
583
673
|
});
|
|
584
674
|
}
|
|
675
|
+
|
|
676
|
+
// Setting visbility of the mass edit field.
|
|
677
|
+
if (oData.editMode) {
|
|
678
|
+
values.visible =
|
|
679
|
+
oData.editMode === EditMode.Editable ||
|
|
680
|
+
aContexts.some(
|
|
681
|
+
MassEditHelper.getFieldVisiblity.bind(MassEditHelper, oData.editMode, oDialogDataModel, oData.dataProperty, values)
|
|
682
|
+
);
|
|
683
|
+
} else {
|
|
684
|
+
values.visible = true;
|
|
685
|
+
}
|
|
585
686
|
});
|
|
586
|
-
const oData = { "values": aValues, "unitData": aUnitData, "results": aResults, "readablePropertyData": aReadOnlyFieldInfo };
|
|
587
|
-
const oDialogDataModel = new JSONModel(oData);
|
|
588
687
|
return oDialogDataModel;
|
|
589
688
|
},
|
|
590
689
|
|
|
@@ -596,15 +695,15 @@ const MassEditHelper = {
|
|
|
596
695
|
* @param {object} oController Controller for the view
|
|
597
696
|
* @returns {object} Promise returning instance of dialog.
|
|
598
697
|
*/
|
|
599
|
-
createDialog: function(oTable: Table, aContexts: any[], oController: PageController) {
|
|
698
|
+
createDialog: function (oTable: Table, aContexts: any[], oController: PageController) {
|
|
600
699
|
const sFragmentName = "sap/fe/core/controls/massEdit/MassEditDialog",
|
|
601
700
|
aDataArray: any[] = [],
|
|
602
|
-
oResourceBundle =
|
|
701
|
+
oResourceBundle = (Core as CoreEx).getLibraryResourceBundle("sap.fe.core"),
|
|
603
702
|
oDefaultValues = MassEditHelper.getDefaultTextsForDialog(oResourceBundle, aContexts.length, oTable),
|
|
604
703
|
oDataFieldModel = MassEditHelper.prepareDataForDialog(oTable, aContexts, aDataArray),
|
|
605
704
|
oDialogDataModel = MassEditHelper.setRuntimeModelOnDialog(aContexts, aDataArray, oDefaultValues);
|
|
606
705
|
|
|
607
|
-
return new Promise(function(resolve: (value: any) => void, reject: (reason?: any) => void) {
|
|
706
|
+
return new Promise(function (resolve: (value: any) => void, reject: (reason?: any) => void) {
|
|
608
707
|
const oFragment = XMLTemplateProcessor.loadTemplate(sFragmentName, "fragment");
|
|
609
708
|
return Promise.resolve(
|
|
610
709
|
XMLPreprocessor.process(
|
|
@@ -620,27 +719,28 @@ const MassEditHelper = {
|
|
|
620
719
|
}
|
|
621
720
|
)
|
|
622
721
|
)
|
|
623
|
-
.then(function(oFragment: any) {
|
|
624
|
-
return Fragment.load({ definition: oFragment }).then(function(oDialogContent: any) {
|
|
722
|
+
.then(function (oFragment: any) {
|
|
723
|
+
return Fragment.load({ definition: oFragment }).then(function (oDialogContent: any) {
|
|
625
724
|
const oDialog = new Dialog({
|
|
626
725
|
title: oDefaultValues.massEditTitle,
|
|
627
726
|
content: [oDialogContent],
|
|
628
727
|
beginButton: new Button({
|
|
629
728
|
text: oDefaultValues.applyButtonText,
|
|
630
729
|
type: "Emphasized",
|
|
631
|
-
press: function(oEvent: any) {
|
|
730
|
+
press: function (oEvent: any) {
|
|
632
731
|
const oDialog = oEvent.getSource().getParent();
|
|
633
732
|
const oModel = oDialog.getModel("fieldsInfo");
|
|
634
733
|
const aResults = oModel.getProperty("/results");
|
|
635
734
|
const aPropertyReadableInfo = oModel.getProperty("/readablePropertyData");
|
|
636
735
|
const changePromise: any[] = [];
|
|
637
736
|
let bReadOnlyField = false;
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
737
|
+
let groupId;
|
|
738
|
+
let index = 0;
|
|
739
|
+
aContexts.forEach(function (oSelectedContext: any) {
|
|
740
|
+
aResults.forEach(function (oResult: any) {
|
|
641
741
|
//TODO - Add save implementation for Value Help.
|
|
642
742
|
if (aPropertyReadableInfo) {
|
|
643
|
-
bReadOnlyField = aPropertyReadableInfo.some(function(oPropertyInfo: any) {
|
|
743
|
+
bReadOnlyField = aPropertyReadableInfo.some(function (oPropertyInfo: any) {
|
|
644
744
|
if (oResult.keyValue === oPropertyInfo.property) {
|
|
645
745
|
if (oPropertyInfo.type === "Default") {
|
|
646
746
|
return oPropertyInfo.value === true;
|
|
@@ -657,30 +757,34 @@ const MassEditHelper = {
|
|
|
657
757
|
}
|
|
658
758
|
});
|
|
659
759
|
}
|
|
760
|
+
groupId = "$auto." + index;
|
|
761
|
+
index += 1;
|
|
660
762
|
if (oResult.keyValue && oResult.value !== "Default" && !bReadOnlyField) {
|
|
661
|
-
changePromise.push(oSelectedContext.setProperty(oResult.keyValue, oResult.value));
|
|
763
|
+
changePromise.push(oSelectedContext.setProperty(oResult.keyValue, oResult.value, groupId));
|
|
662
764
|
}
|
|
663
765
|
});
|
|
664
766
|
});
|
|
665
767
|
return Promise.all(changePromise)
|
|
666
|
-
.then(function(oRes: any[]) {
|
|
768
|
+
.then(function (oRes: any[]) {
|
|
667
769
|
const oListBinding = oTable.getRowBinding(),
|
|
668
770
|
oExtensionAPI = oController && (oController.getExtensionAPI() as any);
|
|
669
|
-
return oExtensionAPI.refresh(oListBinding.getPath()).then(function() {
|
|
771
|
+
return oExtensionAPI.refresh(oListBinding.getPath()).then(function () {
|
|
670
772
|
oDialog.close();
|
|
671
773
|
oDialog.destroy();
|
|
672
774
|
return oRes;
|
|
673
775
|
});
|
|
674
776
|
})
|
|
675
|
-
.catch(function(oError: any) {
|
|
777
|
+
.catch(function (oError: any) {
|
|
676
778
|
//TODO - Add error handling part for the Dialog
|
|
779
|
+
oDialog.close();
|
|
780
|
+
oDialog.destroy();
|
|
677
781
|
Log.error("Mass Edit: Something went wrong in updating entries.", oError);
|
|
678
782
|
});
|
|
679
783
|
}
|
|
680
784
|
}),
|
|
681
785
|
endButton: new Button({
|
|
682
786
|
text: oDefaultValues.cancelButtonText,
|
|
683
|
-
press: function(oEvent: any) {
|
|
787
|
+
press: function (oEvent: any) {
|
|
684
788
|
const oDialog = oEvent.getSource().getParent();
|
|
685
789
|
oDialog.close();
|
|
686
790
|
oDialog.destroy();
|