@sapui5/sap.fe.core 1.100.0 → 1.102.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/AppComponent.js +23 -30
- package/src/sap/fe/core/AppComponent.ts +35 -40
- package/src/sap/fe/core/AppStateHandler.js +8 -8
- package/src/sap/fe/core/AppStateHandler.ts +11 -11
- 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 +122 -101
- package/src/sap/fe/core/CommonUtils.ts +239 -193
- package/src/sap/fe/core/ExtensionAPI.js +12 -13
- package/src/sap/fe/core/ExtensionAPI.ts +21 -31
- package/src/sap/fe/core/PageController.js +19 -13
- package/src/sap/fe/core/PageController.ts +40 -34
- package/src/sap/fe/core/TemplateComponent.js +198 -123
- package/src/sap/fe/core/TemplateComponent.ts +109 -121
- package/src/sap/fe/core/TemplateModel.js +7 -9
- package/src/sap/fe/core/TemplateModel.ts +3 -3
- 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 +935 -0
- package/src/sap/fe/core/buildingBlocks/BuildingBlockRuntime.ts +837 -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/{BusyLocker.js → controllerextensions/BusyLocker.js} +1 -1
- package/src/sap/fe/core/{BusyLocker.ts → controllerextensions/BusyLocker.ts} +7 -7
- package/src/sap/fe/core/controllerextensions/EditFlow.js +660 -288
- package/src/sap/fe/core/controllerextensions/EditFlow.ts +513 -331
- 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 +43 -25
- package/src/sap/fe/core/controllerextensions/InternalEditFlow.ts +132 -103
- package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.js +16 -16
- package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.ts +64 -55
- package/src/sap/fe/core/controllerextensions/InternalRouting.js +166 -99
- package/src/sap/fe/core/controllerextensions/InternalRouting.ts +187 -149
- 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 +13 -12
- package/src/sap/fe/core/controllerextensions/MassEdit.ts +22 -22
- package/src/sap/fe/core/controllerextensions/MessageHandler.js +14 -26
- package/src/sap/fe/core/controllerextensions/MessageHandler.ts +20 -30
- 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 +24 -15
- package/src/sap/fe/core/controllerextensions/Paginator.ts +35 -20
- 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 +34 -16
- package/src/sap/fe/core/controllerextensions/Share.ts +50 -32
- package/src/sap/fe/core/controllerextensions/SideEffects.js +15 -15
- package/src/sap/fe/core/controllerextensions/SideEffects.ts +64 -65
- package/src/sap/fe/core/controllerextensions/ViewState.js +27 -31
- package/src/sap/fe/core/controllerextensions/ViewState.ts +103 -102
- package/src/sap/fe/core/controllerextensions/collaboration/ActivityBase.js +105 -0
- package/src/sap/fe/core/controllerextensions/collaboration/ActivityBase.ts +98 -0
- package/src/sap/fe/core/controllerextensions/collaboration/ActivitySync.js +360 -0
- package/src/sap/fe/core/{actions → controllerextensions}/collaboration/ActivitySync.ts +90 -132
- package/src/sap/fe/core/controllerextensions/collaboration/CollaborationCommon.js +146 -0
- package/src/sap/fe/core/{actions → controllerextensions}/collaboration/CollaborationCommon.ts +18 -8
- package/src/sap/fe/core/controllerextensions/collaboration/Manage.js +264 -0
- package/src/sap/fe/core/{actions → controllerextensions}/collaboration/Manage.ts +35 -33
- package/src/sap/fe/core/controllerextensions/collaboration/ManageDialog.fragment.xml +100 -0
- package/src/sap/fe/core/{actions → controllerextensions}/collaboration/UserDetails.fragment.xml +5 -7
- package/src/sap/fe/core/controllerextensions/editFlow/TransactionHelper.js +1584 -0
- package/src/sap/fe/core/{TransactionHelper.ts → controllerextensions/editFlow/TransactionHelper.ts} +190 -159
- package/src/sap/fe/core/controllerextensions/editFlow/draft.js +780 -0
- package/src/sap/fe/core/{actions → controllerextensions/editFlow}/draft.ts +329 -76
- package/src/sap/fe/core/controllerextensions/editFlow/operations.js +1149 -0
- package/src/sap/fe/core/{actions → controllerextensions/editFlow}/operations.ts +169 -97
- package/src/sap/fe/core/controllerextensions/editFlow/sticky.js +190 -0
- package/src/sap/fe/core/{actions → controllerextensions/editFlow}/sticky.ts +76 -12
- package/src/sap/fe/core/controllerextensions/messageHandler/messageHandling.js +592 -0
- package/src/sap/fe/core/{actions → controllerextensions/messageHandler}/messageHandling.ts +83 -60
- package/src/sap/fe/core/controllerextensions/routing/RouterProxy.js +940 -0
- package/src/sap/fe/core/{RouterProxy.ts → controllerextensions/routing/RouterProxy.ts} +52 -36
- package/src/sap/fe/core/controls/ActionParameterDialog.fragment.xml +21 -18
- 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 +50 -16
- package/src/sap/fe/core/controls/CommandExecution.ts +31 -22
- 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 +371 -0
- package/src/sap/fe/core/controls/CustomFilterFieldContentWrapper.ts +282 -0
- package/src/sap/fe/core/controls/CustomQuickViewPage.js +74 -36
- package/src/sap/fe/core/controls/CustomQuickViewPage.ts +23 -32
- package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossDraft.fragment.xml +52 -5
- package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.js +127 -67
- package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.ts +127 -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 +360 -0
- package/src/sap/fe/core/controls/FileWrapper.ts +202 -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 +102 -37
- package/src/sap/fe/core/controls/FormElementWrapper.ts +43 -35
- package/src/sap/fe/core/controls/MassEditSelect.js +33 -0
- package/src/sap/fe/core/controls/MassEditSelect.ts +45 -0
- 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 +2 -2
- package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.ts +23 -28
- package/src/sap/fe/core/controls/massEdit/MassEditDialog.fragment.xml +41 -81
- package/src/sap/fe/core/controls/massEdit/MassEditField.fragment.xml +107 -0
- package/src/sap/fe/core/controls/massEdit/MassEditHandlers.js +550 -35
- package/src/sap/fe/core/controls/massEdit/MassEditHandlers.ts +604 -35
- package/src/sap/fe/core/converters/ManifestSettings.js +3 -1
- package/src/sap/fe/core/converters/ManifestSettings.ts +9 -2
- package/src/sap/fe/core/converters/MetaModelConverter.js +11 -40
- package/src/sap/fe/core/converters/MetaModelConverter.ts +56 -84
- package/src/sap/fe/core/converters/annotations/DataField.js +20 -5
- package/src/sap/fe/core/converters/annotations/DataField.ts +27 -6
- package/src/sap/fe/core/converters/controls/Common/Action.js +14 -21
- package/src/sap/fe/core/converters/controls/Common/Action.ts +23 -28
- package/src/sap/fe/core/converters/controls/Common/Chart.js +17 -10
- package/src/sap/fe/core/converters/controls/Common/Chart.ts +20 -14
- package/src/sap/fe/core/converters/controls/Common/Form.js +16 -18
- package/src/sap/fe/core/converters/controls/Common/Form.ts +20 -20
- 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 +389 -173
- package/src/sap/fe/core/converters/controls/Common/Table.ts +440 -244
- package/src/sap/fe/core/converters/controls/Common/table/StandardActions.js +26 -16
- package/src/sap/fe/core/converters/controls/Common/table/StandardActions.ts +27 -19
- package/src/sap/fe/core/converters/controls/ListReport/FilterBar.js +78 -47
- package/src/sap/fe/core/converters/controls/ListReport/FilterBar.ts +146 -107
- 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 +30 -25
- package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.ts +39 -34
- package/src/sap/fe/core/converters/helpers/Aggregation.js +10 -2
- package/src/sap/fe/core/converters/helpers/Aggregation.ts +18 -13
- package/src/sap/fe/core/converters/helpers/BindingHelper.js +3 -2
- package/src/sap/fe/core/converters/helpers/BindingHelper.ts +6 -5
- 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 +28 -28
- package/src/sap/fe/core/converters/templates/ObjectPageConverter.ts +38 -45
- package/src/sap/fe/core/designtime/AppComponent.designtime.js +3 -3
- package/src/sap/fe/core/designtime/AppComponent.designtime.ts +8 -6
- 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 +74 -13
- package/src/sap/fe/core/formatters/TableFormatter.ts +71 -16
- 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/BindingExpression.js +10 -7
- package/src/sap/fe/core/helpers/BindingExpression.ts +37 -35
- package/src/sap/fe/core/helpers/ClassSupport.js +273 -256
- package/src/sap/fe/core/helpers/ClassSupport.ts +315 -237
- package/src/sap/fe/core/helpers/FPMHelper.js +3 -2
- package/src/sap/fe/core/helpers/FPMHelper.ts +9 -8
- package/src/sap/fe/core/helpers/MassEditHelper.js +522 -147
- package/src/sap/fe/core/helpers/MassEditHelper.ts +563 -236
- package/src/sap/fe/core/helpers/ModelHelper.js +29 -1
- package/src/sap/fe/core/helpers/ModelHelper.ts +39 -26
- 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 +5 -7
- package/src/sap/fe/core/helpers/StableIdHelper.ts +8 -8
- package/src/sap/fe/core/{Synchronization.js → helpers/Synchronization.js} +1 -1
- package/src/sap/fe/core/{Synchronization.ts → helpers/Synchronization.ts} +1 -1
- 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 +13 -5
- package/src/sap/fe/core/library.ts +26 -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 +135 -180
- package/src/sap/fe/core/messagebundle_ar.properties +31 -64
- package/src/sap/fe/core/messagebundle_bg.properties +31 -64
- package/src/sap/fe/core/messagebundle_ca.properties +31 -64
- package/src/sap/fe/core/messagebundle_cs.properties +31 -64
- package/src/sap/fe/core/messagebundle_cy.properties +32 -65
- package/src/sap/fe/core/messagebundle_da.properties +31 -64
- package/src/sap/fe/core/messagebundle_de.properties +29 -62
- package/src/sap/fe/core/messagebundle_el.properties +32 -65
- package/src/sap/fe/core/messagebundle_en.properties +32 -65
- package/src/sap/fe/core/messagebundle_en_GB.properties +29 -62
- package/src/sap/fe/core/messagebundle_en_US_sappsd.properties +41 -74
- package/src/sap/fe/core/messagebundle_en_US_saprigi.properties +32 -65
- package/src/sap/fe/core/messagebundle_en_US_saptrc.properties +20 -6
- package/src/sap/fe/core/messagebundle_es.properties +31 -64
- package/src/sap/fe/core/messagebundle_es_MX.properties +31 -64
- package/src/sap/fe/core/messagebundle_et.properties +31 -64
- package/src/sap/fe/core/messagebundle_fi.properties +29 -62
- package/src/sap/fe/core/messagebundle_fr.properties +36 -69
- package/src/sap/fe/core/messagebundle_fr_CA.properties +33 -66
- package/src/sap/fe/core/messagebundle_hi.properties +29 -62
- package/src/sap/fe/core/messagebundle_hr.properties +32 -65
- package/src/sap/fe/core/messagebundle_hu.properties +30 -63
- package/src/sap/fe/core/messagebundle_id.properties +32 -65
- package/src/sap/fe/core/messagebundle_it.properties +31 -64
- package/src/sap/fe/core/messagebundle_iw.properties +31 -64
- package/src/sap/fe/core/messagebundle_ja.properties +29 -62
- package/src/sap/fe/core/messagebundle_kk.properties +31 -64
- package/src/sap/fe/core/messagebundle_ko.properties +31 -64
- package/src/sap/fe/core/messagebundle_lt.properties +31 -64
- package/src/sap/fe/core/messagebundle_lv.properties +32 -65
- package/src/sap/fe/core/messagebundle_ms.properties +31 -64
- package/src/sap/fe/core/messagebundle_nl.properties +31 -64
- package/src/sap/fe/core/messagebundle_no.properties +31 -64
- package/src/sap/fe/core/messagebundle_pl.properties +34 -67
- package/src/sap/fe/core/messagebundle_pt.properties +32 -65
- package/src/sap/fe/core/messagebundle_pt_PT.properties +31 -64
- package/src/sap/fe/core/messagebundle_ro.properties +33 -66
- package/src/sap/fe/core/messagebundle_ru.properties +33 -66
- package/src/sap/fe/core/messagebundle_sh.properties +31 -64
- package/src/sap/fe/core/messagebundle_sk.properties +31 -64
- package/src/sap/fe/core/messagebundle_sl.properties +29 -62
- package/src/sap/fe/core/messagebundle_sv.properties +30 -63
- package/src/sap/fe/core/messagebundle_th.properties +31 -64
- package/src/sap/fe/core/messagebundle_tr.properties +31 -64
- package/src/sap/fe/core/messagebundle_uk.properties +32 -65
- package/src/sap/fe/core/messagebundle_vi.properties +31 -64
- package/src/sap/fe/core/messagebundle_zh_CN.properties +32 -65
- package/src/sap/fe/core/messagebundle_zh_TW.properties +34 -67
- 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 +11 -8
- package/src/sap/fe/core/services/EnvironmentServiceFactory.ts +15 -13
- package/src/sap/fe/core/services/NavigationServiceFactory.js +5 -5
- package/src/sap/fe/core/services/NavigationServiceFactory.ts +9 -5
- 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 +105 -66
- package/src/sap/fe/core/services/RoutingServiceFactory.ts +59 -49
- package/src/sap/fe/core/services/ShellServicesFactory.js +104 -29
- package/src/sap/fe/core/services/ShellServicesFactory.ts +64 -30
- 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 +11 -10
- package/src/sap/fe/core/services/TemplatedViewServiceFactory.ts +38 -51
- 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 +27 -6
- package/src/sap/fe/core/templating/EntitySetHelper.js +1 -9
- package/src/sap/fe/core/templating/EntitySetHelper.ts +11 -13
- package/src/sap/fe/core/templating/FilterHelper.js +4 -4
- package/src/sap/fe/core/templating/FilterHelper.ts +6 -5
- package/src/sap/fe/core/templating/PropertyHelper.js +70 -33
- package/src/sap/fe/core/templating/PropertyHelper.ts +49 -27
- package/src/sap/fe/core/templating/UIFormatters.js +133 -22
- package/src/sap/fe/core/templating/UIFormatters.ts +144 -50
- package/src/sap/fe/core/type/DateTimeWithTimezone.js +47 -0
- package/src/sap/fe/core/type/DateTimeWithTimezone.ts +23 -0
- 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/AnnotationHelper.js +0 -312
- package/src/sap/fe/core/AnnotationHelper.ts +0 -315
- package/src/sap/fe/core/RouterProxy.js +0 -926
- package/src/sap/fe/core/TransactionHelper.js +0 -1562
- package/src/sap/fe/core/actions/collaboration/ActivitySync.js +0 -392
- package/src/sap/fe/core/actions/collaboration/CollaborationCommon.js +0 -136
- package/src/sap/fe/core/actions/collaboration/Manage.js +0 -262
- package/src/sap/fe/core/actions/collaboration/ManageDialog.fragment.xml +0 -103
- package/src/sap/fe/core/actions/draft.js +0 -523
- package/src/sap/fe/core/actions/messageHandling.js +0 -567
- package/src/sap/fe/core/actions/nonDraft.js +0 -20
- package/src/sap/fe/core/actions/nonDraft.ts +0 -12
- package/src/sap/fe/core/actions/operations.js +0 -1096
- package/src/sap/fe/core/actions/sticky.js +0 -130
- package/src/sap/fe/core/controllerextensions/ControllerExtensionMetadata.js +0 -78
- package/src/sap/fe/core/controllerextensions/ControllerExtensionMetadata.ts +0 -65
- package/src/sap/fe/core/formatters/CriticalityFormatter.js +0 -77
- package/src/sap/fe/core/formatters/CriticalityFormatter.ts +0 -58
|
@@ -1,19 +1,30 @@
|
|
|
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 FELibrary from "sap/fe/core/library";
|
|
5
|
+
import PageController from "sap/fe/core/PageController";
|
|
6
|
+
import { DataModelObjectPath, enhanceDataModelPath } from "sap/fe/core/templating/DataModelPathHelper";
|
|
7
|
+
import { hasValueHelpWithFixedValues } from "sap/fe/core/templating/PropertyHelper";
|
|
8
|
+
import { getTextBinding, setEditStyleProperties } from "sap/fe/macros/field/FieldTemplating";
|
|
9
|
+
import { FieldProperties } from "sap/fe/macros/internal/Field.metadata";
|
|
10
|
+
import Button from "sap/m/Button";
|
|
1
11
|
import Dialog from "sap/m/Dialog";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
12
|
+
import MessageToast from "sap/m/MessageToast";
|
|
13
|
+
import Core from "sap/ui/core/Core";
|
|
4
14
|
import Fragment from "sap/ui/core/Fragment";
|
|
5
15
|
import XMLPreprocessor from "sap/ui/core/util/XMLPreprocessor";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
16
|
+
import XMLTemplateProcessor from "sap/ui/core/XMLTemplateProcessor";
|
|
17
|
+
import EditMode from "sap/ui/mdc/enum/EditMode";
|
|
8
18
|
import Table from "sap/ui/mdc/Table";
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
19
|
+
import JSONModel from "sap/ui/model/json/JSONModel";
|
|
20
|
+
import Context from "sap/ui/model/odata/v4/Context";
|
|
21
|
+
import ODataListBinding from "sap/ui/model/odata/v4/ODataListBinding";
|
|
22
|
+
import { CoreEx } from "types/extension_types";
|
|
23
|
+
import Any, { AnyType } from "../controls/Any";
|
|
12
24
|
import { convertMetaModelContext, getInvolvedDataModelObjects } from "../converters/MetaModelConverter";
|
|
13
|
-
import { getTextBinding } from "sap/fe/macros/field/FieldTemplating";
|
|
14
|
-
import { getEditableExpression, getRequiredExpression } from "../templating/UIFormatters";
|
|
15
25
|
import { isReadOnlyExpression } from "../templating/FieldControlHelper";
|
|
16
|
-
import {
|
|
26
|
+
import { getEditMode, getRequiredExpression, isCollectionField } from "../templating/UIFormatters";
|
|
27
|
+
import { InternalModelContext } from "./ModelHelper";
|
|
17
28
|
|
|
18
29
|
/* This class contains helpers to be used for mass edit functionality */
|
|
19
30
|
type TextArrangementInfo = {
|
|
@@ -24,20 +35,13 @@ type TextArrangementInfo = {
|
|
|
24
35
|
description: string;
|
|
25
36
|
fullText: string;
|
|
26
37
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"Edm.Int16",
|
|
35
|
-
"Edm.Int32",
|
|
36
|
-
"Edm.Int64",
|
|
37
|
-
"Edm.SByte",
|
|
38
|
-
"Edm.Single",
|
|
39
|
-
"Edm.String"
|
|
40
|
-
];
|
|
38
|
+
|
|
39
|
+
type BindingInfo = {
|
|
40
|
+
path?: string;
|
|
41
|
+
model?: string | object;
|
|
42
|
+
parameters?: Array<BindingInfo>;
|
|
43
|
+
};
|
|
44
|
+
|
|
41
45
|
const MassEditHelper = {
|
|
42
46
|
/**
|
|
43
47
|
* Initializes the value at final or deepest level path with a blank array.
|
|
@@ -47,12 +51,12 @@ const MassEditHelper = {
|
|
|
47
51
|
* @param {Array} aValues Array instance where the default data needs to be added
|
|
48
52
|
* @returns {Array}
|
|
49
53
|
*/
|
|
50
|
-
initLastLevelOfPropertyPath: function(sPath: string, aValues: any) {
|
|
54
|
+
initLastLevelOfPropertyPath: function (sPath: string, aValues: any /*, transCtx: Context */) {
|
|
51
55
|
let aFinalPath: any;
|
|
52
56
|
let index = 0;
|
|
53
57
|
const aPaths = sPath.split("/");
|
|
54
58
|
let sFullPath = "";
|
|
55
|
-
aPaths.forEach(function(sPropertyPath: string) {
|
|
59
|
+
aPaths.forEach(function (sPropertyPath: string) {
|
|
56
60
|
if (!aValues[sPropertyPath] && index === 0) {
|
|
57
61
|
aValues[sPropertyPath] = {};
|
|
58
62
|
aFinalPath = aValues[sPropertyPath];
|
|
@@ -79,8 +83,8 @@ const MassEditHelper = {
|
|
|
79
83
|
* @param {Array} self Instance of the array
|
|
80
84
|
* @returns {boolean}
|
|
81
85
|
*/
|
|
82
|
-
getUniqueValues: function(sValue: string, index: number, self: any[]) {
|
|
83
|
-
if (sValue) {
|
|
86
|
+
getUniqueValues: function (sValue: string, index: number, self: any[]) {
|
|
87
|
+
if (sValue != undefined && sValue != null) {
|
|
84
88
|
return self.indexOf(sValue) === index;
|
|
85
89
|
}
|
|
86
90
|
},
|
|
@@ -93,11 +97,11 @@ const MassEditHelper = {
|
|
|
93
97
|
* @param {object} oValues Object of property values
|
|
94
98
|
* @returns {*}
|
|
95
99
|
*/
|
|
96
|
-
getValueForMultiLevelPath: function(sDataPropertyPath: string, oValues: any) {
|
|
100
|
+
getValueForMultiLevelPath: function (sDataPropertyPath: string, oValues: any) {
|
|
97
101
|
if (sDataPropertyPath && sDataPropertyPath.indexOf("/") > 0) {
|
|
98
102
|
const aPropertyPaths = sDataPropertyPath.split("/");
|
|
99
103
|
let Result: any;
|
|
100
|
-
aPropertyPaths.forEach(function(sPath: string) {
|
|
104
|
+
aPropertyPaths.forEach(function (sPath: string) {
|
|
101
105
|
Result = oValues && oValues[sPath] ? oValues[sPath] : Result && Result[sPath];
|
|
102
106
|
});
|
|
103
107
|
return Result;
|
|
@@ -115,11 +119,11 @@ const MassEditHelper = {
|
|
|
115
119
|
* @param {string} sDataPropertyPath Data property path
|
|
116
120
|
* @returns {string}
|
|
117
121
|
*/
|
|
118
|
-
getDefaultSelectionPathComboBox: function(aContexts: any[], sDataPropertyPath: string) {
|
|
122
|
+
getDefaultSelectionPathComboBox: function (aContexts: any[], sDataPropertyPath: string) {
|
|
119
123
|
if (sDataPropertyPath && aContexts.length > 0) {
|
|
120
124
|
const oSelectedContext = aContexts,
|
|
121
125
|
aPropertyValues: any[] = [];
|
|
122
|
-
oSelectedContext.forEach(function(oContext: any) {
|
|
126
|
+
oSelectedContext.forEach(function (oContext: any) {
|
|
123
127
|
const oDataObject = oContext.getObject();
|
|
124
128
|
const sMultiLevelPathCondition =
|
|
125
129
|
sDataPropertyPath.indexOf("/") > -1 && oDataObject.hasOwnProperty(sDataPropertyPath.split("/")[0]);
|
|
@@ -133,7 +137,7 @@ const MassEditHelper = {
|
|
|
133
137
|
} else if (aUniquePropertyValues.length === 0) {
|
|
134
138
|
return "Empty/" + sDataPropertyPath;
|
|
135
139
|
} else if (aUniquePropertyValues.length === 1) {
|
|
136
|
-
return sDataPropertyPath;
|
|
140
|
+
return sDataPropertyPath + "/" + aUniquePropertyValues[0];
|
|
137
141
|
}
|
|
138
142
|
}
|
|
139
143
|
},
|
|
@@ -145,15 +149,65 @@ const MassEditHelper = {
|
|
|
145
149
|
* @param {Array} aContexts Contexts for mass edit
|
|
146
150
|
* @returns {boolean}
|
|
147
151
|
*/
|
|
148
|
-
getHiddenValueForContexts: function(hiddenValue: any, aContexts: any[]) {
|
|
152
|
+
getHiddenValueForContexts: function (hiddenValue: any, aContexts: any[]) {
|
|
149
153
|
if (hiddenValue && hiddenValue.$Path) {
|
|
150
|
-
return !aContexts.some(function(oSelectedContext: any) {
|
|
154
|
+
return !aContexts.some(function (oSelectedContext: any) {
|
|
151
155
|
return oSelectedContext.getObject(hiddenValue.$Path) === false;
|
|
152
156
|
});
|
|
153
157
|
}
|
|
154
158
|
return hiddenValue;
|
|
155
159
|
},
|
|
156
160
|
|
|
161
|
+
getInputType: function (propertyInfo: any, dataFieldConverted: any, oDataModelPath: DataModelObjectPath): string {
|
|
162
|
+
const editStyleProperties = {} as FieldProperties;
|
|
163
|
+
let inputType!: string;
|
|
164
|
+
if (propertyInfo) {
|
|
165
|
+
setEditStyleProperties(editStyleProperties, dataFieldConverted, oDataModelPath, true);
|
|
166
|
+
inputType = editStyleProperties?.editStyle || "";
|
|
167
|
+
}
|
|
168
|
+
const isValidForMassEdit =
|
|
169
|
+
inputType &&
|
|
170
|
+
["DatePicker", "TimePicker", "DateTimePicker", "RatingIndicator"].indexOf(inputType) === -1 &&
|
|
171
|
+
!isCollectionField(oDataModelPath) &&
|
|
172
|
+
!hasValueHelpWithFixedValues(propertyInfo);
|
|
173
|
+
|
|
174
|
+
return (isValidForMassEdit || "") && inputType;
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
getIsFieldGrp: function (dataFieldConverted: any): boolean {
|
|
178
|
+
return (
|
|
179
|
+
dataFieldConverted &&
|
|
180
|
+
dataFieldConverted.$Type === "com.sap.vocabularies.UI.v1.DataFieldForAnnotation" &&
|
|
181
|
+
dataFieldConverted.Target &&
|
|
182
|
+
dataFieldConverted.Target.value &&
|
|
183
|
+
dataFieldConverted.Target.value.indexOf("FieldGroup") > -1
|
|
184
|
+
);
|
|
185
|
+
},
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Get text path for the mass edit field.
|
|
189
|
+
*
|
|
190
|
+
* @param {string} property Property path
|
|
191
|
+
* @param {any} textBinding Text Binding Info
|
|
192
|
+
* @param {string} displayMode Display mode
|
|
193
|
+
* @returns {string | undefined} Text Property Path if it exists
|
|
194
|
+
*/
|
|
195
|
+
getTextPath: function (property: string, textBinding: any, displayMode: string): string | undefined {
|
|
196
|
+
let descriptionPath;
|
|
197
|
+
if (textBinding && (textBinding.path || (textBinding.parameters && textBinding.parameters.length)) && property) {
|
|
198
|
+
if (textBinding.path && displayMode === "Description") {
|
|
199
|
+
descriptionPath = textBinding.path;
|
|
200
|
+
} else if (textBinding.parameters) {
|
|
201
|
+
textBinding.parameters.forEach(function (props: BindingInfo) {
|
|
202
|
+
if (props.path && props.path !== property) {
|
|
203
|
+
descriptionPath = props.path;
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return descriptionPath;
|
|
209
|
+
},
|
|
210
|
+
|
|
157
211
|
/**
|
|
158
212
|
* Initializes a JSON Model for properties of dialog fields [label, visiblity, dataproperty, etc.].
|
|
159
213
|
*
|
|
@@ -162,11 +216,12 @@ const MassEditHelper = {
|
|
|
162
216
|
* @param {Array} aDataArray Array containing data related to the dialog used by both the static and the runtime model
|
|
163
217
|
* @returns {object}
|
|
164
218
|
*/
|
|
165
|
-
prepareDataForDialog: function(oTable: Table, aContexts: any[], aDataArray: any[]) {
|
|
219
|
+
prepareDataForDialog: function (oTable: Table, aContexts: any[], aDataArray: any[]) {
|
|
166
220
|
const oMetaModel = oTable && (oTable.getModel().getMetaModel() as any),
|
|
167
221
|
sCurrentEntitySetName = oTable.data("metaPath"),
|
|
168
222
|
aTableFields = MassEditHelper.getTableFields(oTable),
|
|
169
223
|
oEntityTypeContext = oMetaModel.getContext(sCurrentEntitySetName + "/@"),
|
|
224
|
+
oEntitySetContext = oMetaModel.getContext(sCurrentEntitySetName),
|
|
170
225
|
oDataModelObjectPath = getInvolvedDataModelObjects(oEntityTypeContext);
|
|
171
226
|
|
|
172
227
|
const oDataFieldModel = new JSONModel();
|
|
@@ -175,14 +230,9 @@ const MassEditHelper = {
|
|
|
175
230
|
let bValueHelpEnabled;
|
|
176
231
|
let sUnitPropertyPath;
|
|
177
232
|
let bValueHelpEnabledForUnit;
|
|
178
|
-
let bIsImmutable;
|
|
179
|
-
let bIsComputed;
|
|
180
|
-
let bChartProperty;
|
|
181
233
|
let oTextBinding;
|
|
182
|
-
let bValidDataType;
|
|
183
|
-
let bInValidInputType;
|
|
184
234
|
|
|
185
|
-
aTableFields.forEach(function(oColumnInfo: any) {
|
|
235
|
+
aTableFields.forEach(function (oColumnInfo: any) {
|
|
186
236
|
const sDataPropertyPath = oColumnInfo.dataProperty;
|
|
187
237
|
if (sDataPropertyPath) {
|
|
188
238
|
let oPropertyInfo = sDataPropertyPath && oMetaModel.getObject(sCurrentEntitySetName + "/" + sDataPropertyPath + "@");
|
|
@@ -197,7 +247,10 @@ const MassEditHelper = {
|
|
|
197
247
|
(oPropertyInfo &&
|
|
198
248
|
oPropertyInfo["@Org.OData.Measures.V1.ISOCurrency"] &&
|
|
199
249
|
oPropertyInfo["@Org.OData.Measures.V1.ISOCurrency"].$Path);
|
|
200
|
-
sLabelText =
|
|
250
|
+
sLabelText =
|
|
251
|
+
oColumnInfo.label ||
|
|
252
|
+
(oPropertyInfo && oPropertyInfo["@com.sap.vocabularies.Common.v1.Label"]) ||
|
|
253
|
+
oColumnInfo.dataProperty;
|
|
201
254
|
bValueHelpEnabledForUnit =
|
|
202
255
|
sUnitPropertyPath &&
|
|
203
256
|
oMetaModel.getObject(sCurrentEntitySetName + "/" + sUnitPropertyPath + "@") &&
|
|
@@ -205,7 +258,7 @@ const MassEditHelper = {
|
|
|
205
258
|
"@com.sap.vocabularies.Common.v1.ValueList"
|
|
206
259
|
];
|
|
207
260
|
if (oDataModelObjectPath) {
|
|
208
|
-
oDataModelObjectPath.targetObject = oDataModelObjectPath.targetEntityType.entityProperties.filter(function(
|
|
261
|
+
oDataModelObjectPath.targetObject = oDataModelObjectPath.targetEntityType.entityProperties.filter(function (
|
|
209
262
|
oProperty: any
|
|
210
263
|
) {
|
|
211
264
|
return oProperty.name === sDataPropertyPath;
|
|
@@ -217,54 +270,59 @@ const MassEditHelper = {
|
|
|
217
270
|
oDataFieldConverted = convertMetaModelContext(oFieldContext),
|
|
218
271
|
oPropertyContext = oMetaModel.getContext(sCurrentEntitySetName + "/" + sDataPropertyPath + "@"),
|
|
219
272
|
oInterface = oPropertyContext && oPropertyContext.getInterface();
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
273
|
+
|
|
274
|
+
let oDataModelPath = getInvolvedDataModelObjects(oFieldContext, oEntitySetContext);
|
|
275
|
+
if (oDataFieldConverted?.Value?.path?.length > 0) {
|
|
276
|
+
oDataModelPath = enhanceDataModelPath(oDataModelPath, sDataPropertyPath);
|
|
277
|
+
}
|
|
224
278
|
const bHiddenField =
|
|
225
279
|
MassEditHelper.getHiddenValueForContexts(
|
|
226
280
|
oFieldContext && oFieldContext.getObject()["@com.sap.vocabularies.UI.v1.Hidden"],
|
|
227
281
|
aContexts
|
|
228
282
|
) || false;
|
|
283
|
+
const isImage = oPropertyInfo && oPropertyInfo["@com.sap.vocabularies.UI.v1.IsImageURL"];
|
|
284
|
+
|
|
229
285
|
oInterface.context = {
|
|
230
|
-
getModel: function() {
|
|
286
|
+
getModel: function () {
|
|
231
287
|
return oInterface.getModel();
|
|
232
288
|
},
|
|
233
|
-
getPath: function() {
|
|
289
|
+
getPath: function () {
|
|
234
290
|
return sCurrentEntitySetName + "/" + sDataPropertyPath;
|
|
235
291
|
}
|
|
236
292
|
};
|
|
237
293
|
oPropertyInfo =
|
|
238
|
-
|
|
239
|
-
|
|
294
|
+
oDataFieldConverted._type === "Property"
|
|
295
|
+
? oDataFieldConverted
|
|
296
|
+
: (oDataFieldConverted && oDataFieldConverted.Value && oDataFieldConverted.Value.$target) ||
|
|
297
|
+
(oDataFieldConverted && oDataFieldConverted.Target && oDataFieldConverted.Target.$target);
|
|
240
298
|
// 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
|
-
|
|
299
|
+
|
|
300
|
+
const chartProperty = oPropertyInfo && oPropertyInfo.term && oPropertyInfo.term === "com.sap.vocabularies.UI.v1.Chart";
|
|
301
|
+
const isAction = !!oDataFieldConverted.Action;
|
|
302
|
+
const isFieldGrp = MassEditHelper.getIsFieldGrp(oDataFieldConverted);
|
|
303
|
+
|
|
304
|
+
if (isImage || bHiddenField || chartProperty || isAction || isFieldGrp) {
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// EditMode and InputType
|
|
309
|
+
const propertyForFieldControl = oPropertyInfo && oPropertyInfo.Value ? oPropertyInfo.Value : oPropertyInfo;
|
|
310
|
+
const expBinding = getEditMode(propertyForFieldControl, oDataModelPath, false, false, oDataFieldConverted, true);
|
|
311
|
+
const editModeValues = Object.keys(EditMode);
|
|
312
|
+
const editModeIsStatic = !!expBinding && editModeValues.includes(expBinding as EditMode);
|
|
313
|
+
const editable = !!expBinding && ((editModeIsStatic && expBinding === EditMode.Editable) || !editModeIsStatic);
|
|
314
|
+
|
|
315
|
+
if (!editable) {
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
const inputType = MassEditHelper.getInputType(oPropertyInfo, oDataFieldConverted, oDataModelPath);
|
|
320
|
+
|
|
321
|
+
if (inputType) {
|
|
322
|
+
const isReadOnly = isReadOnlyExpression(oPropertyInfo);
|
|
323
|
+
const displayMode = CommonUtils.computeDisplayMode(oPropertyContext.getObject());
|
|
260
324
|
oResult = {
|
|
261
|
-
"label": sLabelText
|
|
262
|
-
"visible":
|
|
263
|
-
sDataPropertyPath &&
|
|
264
|
-
!bHiddenField &&
|
|
265
|
-
!bIsImmutable &&
|
|
266
|
-
!bIsComputed &&
|
|
267
|
-
getEditableExpression(oPropertyInfo, oDataFieldConverted, oDataModelObjectPath),
|
|
325
|
+
"label": sLabelText,
|
|
268
326
|
"dataProperty": sDataPropertyPath,
|
|
269
327
|
"isValueHelpEnabled": bValueHelpEnabled ? bValueHelpEnabled : false,
|
|
270
328
|
"unitProperty": sUnitPropertyPath ? sUnitPropertyPath : false,
|
|
@@ -279,9 +337,14 @@ const MassEditHelper = {
|
|
|
279
337
|
? MassEditHelper.getDefaultSelectionPathComboBox(aContexts, sUnitPropertyPath)
|
|
280
338
|
: false,
|
|
281
339
|
"entitySet": sCurrentEntitySetName,
|
|
282
|
-
"
|
|
340
|
+
"display": displayMode,
|
|
341
|
+
"descriptionPath": MassEditHelper.getTextPath(sDataPropertyPath, oTextBinding, displayMode),
|
|
283
342
|
"nullable": oPropertyInfo.nullable !== undefined ? oPropertyInfo.nullable : true,
|
|
284
|
-
"isPropertyReadOnly": isReadOnly !== undefined ? isReadOnly : false
|
|
343
|
+
"isPropertyReadOnly": isReadOnly !== undefined ? isReadOnly : false,
|
|
344
|
+
"inputType": inputType,
|
|
345
|
+
"editMode": editable ? expBinding : undefined,
|
|
346
|
+
"unitDataPath": sUnitPropertyPath && "fieldsInfo>/unitData/",
|
|
347
|
+
"valuesPath": "fieldsInfo>/values/"
|
|
285
348
|
};
|
|
286
349
|
aDataArray.push(oResult);
|
|
287
350
|
}
|
|
@@ -291,47 +354,25 @@ const MassEditHelper = {
|
|
|
291
354
|
return oDataFieldModel;
|
|
292
355
|
},
|
|
293
356
|
|
|
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) {
|
|
357
|
+
getTableFields: function (oTable: any) {
|
|
317
358
|
const aColumns = (oTable && oTable.getColumns()) || [];
|
|
318
|
-
|
|
359
|
+
const columnsData = oTable && oTable.getParent().getTableDefinition().columns;
|
|
360
|
+
return aColumns.map(function (oColumn: any) {
|
|
319
361
|
const sDataProperty = oColumn && oColumn.getDataProperty(),
|
|
320
362
|
aRealtedColumnInfo =
|
|
321
|
-
|
|
322
|
-
|
|
363
|
+
columnsData &&
|
|
364
|
+
columnsData.filter(function (oColumnInfo: any) {
|
|
323
365
|
return oColumnInfo.name === sDataProperty && oColumnInfo.type === "Annotation";
|
|
324
366
|
});
|
|
325
367
|
return {
|
|
326
368
|
"dataProperty": sDataProperty,
|
|
327
369
|
"label": oColumn.getHeader(),
|
|
328
|
-
"annotationPath": aRealtedColumnInfo && aRealtedColumnInfo[0] && aRealtedColumnInfo[0].annotationPath
|
|
329
|
-
"inputType": MassEditHelper.getInputTypeForColumn(oColumn)
|
|
370
|
+
"annotationPath": aRealtedColumnInfo && aRealtedColumnInfo[0] && aRealtedColumnInfo[0].annotationPath
|
|
330
371
|
};
|
|
331
372
|
});
|
|
332
373
|
},
|
|
333
374
|
|
|
334
|
-
getDefaultTextsForDialog: function(oResourceBundle: any, iSelectedContexts: any, oTable: any) {
|
|
375
|
+
getDefaultTextsForDialog: function (oResourceBundle: any, iSelectedContexts: any, oTable: any) {
|
|
335
376
|
// 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
377
|
const bDisplayMode = oTable.data("displayModePropertyBinding") === "true";
|
|
337
378
|
|
|
@@ -343,6 +384,7 @@ const MassEditHelper = {
|
|
|
343
384
|
"applyButtonText": bDisplayMode
|
|
344
385
|
? oResourceBundle.getText("C_MASS_EDIT_SAVE_BUTTON_TEXT")
|
|
345
386
|
: oResourceBundle.getText("C_MASS_EDIT_APPLY_BUTTON_TEXT"),
|
|
387
|
+
"useValueHelpValue": "< Use Value Help >",
|
|
346
388
|
"cancelButtonText": oResourceBundle.getText("C_MASS_EDIT_CANCEL_BUTTON_TEXT")
|
|
347
389
|
};
|
|
348
390
|
},
|
|
@@ -353,17 +395,19 @@ const MassEditHelper = {
|
|
|
353
395
|
* @param {string} sInputType InputType of the field
|
|
354
396
|
* @returns {string}
|
|
355
397
|
*/
|
|
356
|
-
getSuffixForKeepExisiting: function(sInputType: string) {
|
|
398
|
+
getSuffixForKeepExisiting: function (sInputType: string) {
|
|
357
399
|
let sResult = "Values";
|
|
358
400
|
|
|
359
401
|
switch (sInputType) {
|
|
360
402
|
//TODO - Add for other control types as well (Radio Button, Email, Input, MDC Fields, Image etc.)
|
|
361
|
-
case "
|
|
403
|
+
case "DatePicker":
|
|
362
404
|
sResult = "Dates";
|
|
363
405
|
break;
|
|
364
|
-
case "
|
|
406
|
+
case "CheckBox":
|
|
365
407
|
sResult = "Settings";
|
|
366
408
|
break;
|
|
409
|
+
default:
|
|
410
|
+
sResult = "Values";
|
|
367
411
|
}
|
|
368
412
|
return sResult;
|
|
369
413
|
},
|
|
@@ -377,72 +421,190 @@ const MassEditHelper = {
|
|
|
377
421
|
* @param {object} oPropertyInfo Property information
|
|
378
422
|
* @param {boolean} bUOMField
|
|
379
423
|
*/
|
|
380
|
-
setDefaultValuesToDialog: function(aValues: any
|
|
381
|
-
const sPropertyPath = oPropertyInfo.dataProperty,
|
|
424
|
+
setDefaultValuesToDialog: function (aValues: any, aContexts: any[], oDefaultValues: any, oPropertyInfo: any, bUOMField?: boolean) {
|
|
425
|
+
const sPropertyPath = bUOMField ? oPropertyInfo.unitProperty : oPropertyInfo.dataProperty,
|
|
382
426
|
sInputType = oPropertyInfo.inputType,
|
|
383
427
|
bPropertyRequired = oPropertyInfo.isFieldRequired;
|
|
384
428
|
const sSuffixForKeepExisting = MassEditHelper.getSuffixForKeepExisiting(sInputType);
|
|
429
|
+
aValues.defaultOptions = aValues.defaultOptions || [];
|
|
385
430
|
//TODO - Add <<Use Value Help or control implmentation>> and related key by checking if value help is enabled for property or Unit.
|
|
386
431
|
//TODO - Add option Apply to Empty Fields only for Both Value Help and controls.
|
|
387
|
-
const bValueExistsForPropertyPath = aContexts.some(function(oSelectedContext: any) {
|
|
432
|
+
const bValueExistsForPropertyPath = aContexts.some(function (oSelectedContext: any) {
|
|
388
433
|
return oSelectedContext.getObject(sPropertyPath);
|
|
389
434
|
});
|
|
435
|
+
|
|
436
|
+
if (sInputType === "CheckBox") {
|
|
437
|
+
const falseEntry = { text: "No", key: `${sPropertyPath}/false`, textInfo: { value: false } };
|
|
438
|
+
const truthyEntry = { text: "Yes", key: `${sPropertyPath}/true`, textInfo: { value: true } };
|
|
439
|
+
aValues.unshift(falseEntry);
|
|
440
|
+
aValues.defaultOptions.unshift(falseEntry);
|
|
441
|
+
aValues.unshift(truthyEntry);
|
|
442
|
+
aValues.defaultOptions.unshift(truthyEntry);
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
if (oPropertyInfo.isValueHelpEnabled || (oPropertyInfo.isValueHelpEnabledForUnit && bUOMField)) {
|
|
446
|
+
const vhdEntry = { text: oDefaultValues.useValueHelpValue, key: "UseValueHelpValue/" + sPropertyPath };
|
|
447
|
+
aValues.unshift(vhdEntry);
|
|
448
|
+
aValues.defaultOptions.unshift(vhdEntry);
|
|
449
|
+
}
|
|
450
|
+
|
|
390
451
|
if (bValueExistsForPropertyPath) {
|
|
391
452
|
if (bPropertyRequired !== "true" && !bUOMField) {
|
|
392
|
-
|
|
453
|
+
const clearEntry = { text: oDefaultValues.clearFieldValue, key: "ClearFieldValue/" + sPropertyPath };
|
|
454
|
+
aValues.unshift(clearEntry);
|
|
455
|
+
aValues.defaultOptions.unshift(clearEntry);
|
|
393
456
|
}
|
|
394
457
|
} else {
|
|
395
|
-
|
|
458
|
+
const emptyEntry = { text: oDefaultValues.leaveBlankValue, key: "Empty/" + sPropertyPath };
|
|
459
|
+
aValues.unshift(emptyEntry);
|
|
460
|
+
aValues.defaultOptions.unshift(emptyEntry);
|
|
396
461
|
}
|
|
397
|
-
|
|
462
|
+
const keepEntry = {
|
|
398
463
|
text: oDefaultValues.keepExistingPrefix + " " + sSuffixForKeepExisting + " >",
|
|
399
464
|
key: "Default/" + sPropertyPath
|
|
400
|
-
}
|
|
465
|
+
};
|
|
466
|
+
aValues.unshift(keepEntry);
|
|
467
|
+
aValues.defaultOptions.unshift(keepEntry);
|
|
401
468
|
},
|
|
402
469
|
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
470
|
+
/**
|
|
471
|
+
* Get text arrangement info for a context property.
|
|
472
|
+
*
|
|
473
|
+
* @param {string} property Property Path
|
|
474
|
+
* @param {string} descriptionPath Path to text association of the property
|
|
475
|
+
* @param {string} displayMode Display mode of the property and text association
|
|
476
|
+
* @param {Context} selectedContext Context to find the full text
|
|
477
|
+
* @returns {TextArrangementInfo}
|
|
478
|
+
*/
|
|
479
|
+
getTextArrangementInfo: function (
|
|
480
|
+
property: string,
|
|
481
|
+
descriptionPath: string,
|
|
482
|
+
displayMode: string,
|
|
483
|
+
selectedContext: Context
|
|
484
|
+
): TextArrangementInfo {
|
|
485
|
+
let value = selectedContext.getObject(property),
|
|
486
|
+
descriptionValue,
|
|
487
|
+
fullText;
|
|
488
|
+
if (descriptionPath && property) {
|
|
489
|
+
switch (displayMode) {
|
|
490
|
+
case "Description":
|
|
491
|
+
descriptionValue = selectedContext.getObject(descriptionPath);
|
|
492
|
+
fullText = descriptionValue;
|
|
493
|
+
break;
|
|
494
|
+
case "Value":
|
|
495
|
+
value = selectedContext.getObject(property);
|
|
496
|
+
fullText = value;
|
|
497
|
+
break;
|
|
498
|
+
case "ValueDescription":
|
|
499
|
+
value = selectedContext.getObject(property);
|
|
500
|
+
descriptionValue = selectedContext.getObject(descriptionPath);
|
|
501
|
+
fullText = value + " (" + descriptionValue + ")";
|
|
502
|
+
break;
|
|
503
|
+
case "DescriptionValue":
|
|
504
|
+
value = selectedContext.getObject(property);
|
|
505
|
+
descriptionValue = selectedContext.getObject(descriptionPath);
|
|
506
|
+
fullText = descriptionValue + " (" + value + ")";
|
|
507
|
+
break;
|
|
508
|
+
default:
|
|
509
|
+
Log.info("Display Property not applicable: " + property);
|
|
510
|
+
break;
|
|
435
511
|
}
|
|
436
|
-
return {
|
|
437
|
-
"textArrangement": sDisplayMode,
|
|
438
|
-
"valuePath": sProperty,
|
|
439
|
-
"descriptionPath": sDescriptionPath,
|
|
440
|
-
"value": sValue,
|
|
441
|
-
"description": sDescriptionValue,
|
|
442
|
-
"fullText": sFullText
|
|
443
|
-
};
|
|
444
512
|
}
|
|
445
|
-
|
|
513
|
+
|
|
514
|
+
return {
|
|
515
|
+
"textArrangement": displayMode,
|
|
516
|
+
"valuePath": property,
|
|
517
|
+
"descriptionPath": descriptionPath,
|
|
518
|
+
"value": value,
|
|
519
|
+
"description": descriptionValue,
|
|
520
|
+
"fullText": fullText
|
|
521
|
+
};
|
|
522
|
+
},
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* Return the visibility valuue for the ManagedObject Any.
|
|
526
|
+
*
|
|
527
|
+
* @param {AnyType} any The ManagedObject Any to be used to calculate the visible value of the binding.
|
|
528
|
+
* @returns {boolean} Returns true if the mass edit field is editable.
|
|
529
|
+
*/
|
|
530
|
+
isEditable: function (any: AnyType): boolean {
|
|
531
|
+
const binding = any.getBinding("any");
|
|
532
|
+
const value = (binding as any).getExternalValue();
|
|
533
|
+
return value === EditMode.Editable;
|
|
534
|
+
},
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* Calculate and update the visibility of mass edit field on change of the ManagedObject Any binding.
|
|
538
|
+
*
|
|
539
|
+
* @param {JSONModel} oDialogDataModel Model to be used runtime.
|
|
540
|
+
* @param {string} dataProperty Field name.
|
|
541
|
+
*/
|
|
542
|
+
onContextEditableChange: function (oDialogDataModel: JSONModel, dataProperty: string): void {
|
|
543
|
+
const objectsForVisibility = oDialogDataModel.getProperty("/values/" + dataProperty + "/objectsForVisibility") || [];
|
|
544
|
+
const editable = objectsForVisibility.some(MassEditHelper.isEditable);
|
|
545
|
+
|
|
546
|
+
if (editable) {
|
|
547
|
+
oDialogDataModel.setProperty("/values/" + dataProperty + "/visible", editable);
|
|
548
|
+
}
|
|
549
|
+
},
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* Update Managed Object Any for visibility of the mass edit fields.
|
|
553
|
+
*
|
|
554
|
+
* @param {AnyType} mOToUse The ManagedObject Any to be used to calculate the visible value of the binding.
|
|
555
|
+
* @param {JSONModel} oDialogDataModel Model to be used runtime.
|
|
556
|
+
* @param {string} dataProperty Field name.
|
|
557
|
+
* @param {any} values Values of the field.
|
|
558
|
+
*/
|
|
559
|
+
updateOnContextChange: function (mOToUse: AnyType, oDialogDataModel: JSONModel, dataProperty: string, values: any) {
|
|
560
|
+
const binding = mOToUse.getBinding("any");
|
|
561
|
+
|
|
562
|
+
values.objectsForVisibility = values.objectsForVisibility || [];
|
|
563
|
+
values.objectsForVisibility.push(mOToUse);
|
|
564
|
+
|
|
565
|
+
binding.attachChange(MassEditHelper.onContextEditableChange.bind(null, oDialogDataModel, dataProperty));
|
|
566
|
+
},
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* Get bound object to calculate the visibility of contexts.
|
|
570
|
+
*
|
|
571
|
+
* @param {BindingExpression<boolean> | ExpressionOrPrimitive<boolean>} expBinding Binding String object.
|
|
572
|
+
* @param {object} context Context the binding value.
|
|
573
|
+
* @returns {AnyType} The ManagedObject Any to be used to calculate the visible value of the binding.
|
|
574
|
+
*/
|
|
575
|
+
getBoundObject: function (expBinding: BindingExpression<string> | ExpressionOrPrimitive<string>, context: Context): AnyType {
|
|
576
|
+
const mOToUse = new Any({ any: expBinding });
|
|
577
|
+
const model = context.getModel();
|
|
578
|
+
mOToUse.setModel(model);
|
|
579
|
+
mOToUse.setBindingContext(context);
|
|
580
|
+
|
|
581
|
+
return mOToUse;
|
|
582
|
+
},
|
|
583
|
+
|
|
584
|
+
/**
|
|
585
|
+
* Get the visibility of the field.
|
|
586
|
+
*
|
|
587
|
+
* @param {BindingExpression<boolean> | ExpressionOrPrimitive<boolean>} expBinding Binding String object.
|
|
588
|
+
* @param {JSONModel} oDialogDataModel Model to be used runtime.
|
|
589
|
+
* @param {string} dataProperty Field name.
|
|
590
|
+
* @param {any} values Values of the field.
|
|
591
|
+
* @param {object} context Context the binding value.
|
|
592
|
+
* @returns {boolean} Returns true if the mass edit field is editable.
|
|
593
|
+
*/
|
|
594
|
+
getFieldVisiblity: function (
|
|
595
|
+
expBinding: BindingExpression<string> | ExpressionOrPrimitive<string>,
|
|
596
|
+
oDialogDataModel: JSONModel,
|
|
597
|
+
dataProperty: string,
|
|
598
|
+
values: any,
|
|
599
|
+
context: Context
|
|
600
|
+
): boolean {
|
|
601
|
+
const mOToUse = MassEditHelper.getBoundObject(expBinding, context);
|
|
602
|
+
const isContextEditable = MassEditHelper.isEditable(mOToUse);
|
|
603
|
+
|
|
604
|
+
if (!isContextEditable) {
|
|
605
|
+
MassEditHelper.updateOnContextChange(mOToUse, oDialogDataModel, dataProperty, values);
|
|
606
|
+
}
|
|
607
|
+
return isContextEditable;
|
|
446
608
|
},
|
|
447
609
|
|
|
448
610
|
/**
|
|
@@ -453,82 +615,124 @@ const MassEditHelper = {
|
|
|
453
615
|
* @param {Array} aContexts Contexts for mass edit
|
|
454
616
|
* @param {Array} aDataArray Array containing data related to the dialog used by both the static and the runtime model
|
|
455
617
|
* @param {object} oDefaultValues Default values from i18n
|
|
618
|
+
* @param {Context} dialogContext Transient context for mass edit dialog.
|
|
456
619
|
* @returns {object}
|
|
457
620
|
*/
|
|
458
|
-
setRuntimeModelOnDialog: function(aContexts: any[], aDataArray: any[], oDefaultValues: any) {
|
|
621
|
+
setRuntimeModelOnDialog: function (aContexts: any[], aDataArray: any[], oDefaultValues: any, dialogContext: Context) {
|
|
459
622
|
const aValues: any[] = [];
|
|
460
623
|
const aUnitData: any[] = [];
|
|
461
624
|
const aResults: any[] = [];
|
|
462
625
|
const aReadOnlyFieldInfo: any[] = [];
|
|
463
|
-
const
|
|
464
|
-
|
|
465
|
-
|
|
626
|
+
const oData = {
|
|
627
|
+
"values": aValues,
|
|
628
|
+
"unitData": aUnitData,
|
|
629
|
+
"results": aResults,
|
|
630
|
+
"readablePropertyData": aReadOnlyFieldInfo,
|
|
631
|
+
"selectedKey": undefined
|
|
632
|
+
};
|
|
633
|
+
const oDialogDataModel = new JSONModel(oData);
|
|
634
|
+
aDataArray.forEach(function (oData: any) {
|
|
466
635
|
let oTextInfo;
|
|
636
|
+
let sPropertyKey;
|
|
637
|
+
let sUnitPropertyName;
|
|
638
|
+
const oDistinctValueMap: any = {};
|
|
639
|
+
const oDistinctUnitMap: any = {};
|
|
467
640
|
if (oData.dataProperty && oData.dataProperty.indexOf("/") > -1) {
|
|
468
|
-
const aFinalPath = MassEditHelper.initLastLevelOfPropertyPath(oData.dataProperty, aValues);
|
|
641
|
+
const aFinalPath = MassEditHelper.initLastLevelOfPropertyPath(oData.dataProperty, aValues /*, dialogContext */);
|
|
469
642
|
const aPropertyPaths = oData.dataProperty.split("/");
|
|
470
|
-
|
|
471
|
-
for (
|
|
472
|
-
const sMultiLevelPathValue =
|
|
643
|
+
|
|
644
|
+
for (const context of aContexts) {
|
|
645
|
+
const sMultiLevelPathValue = context.getObject(oData.dataProperty);
|
|
473
646
|
sPropertyKey = oData.dataProperty + "/" + sMultiLevelPathValue;
|
|
474
647
|
if (!oDistinctValueMap[sPropertyKey] && aFinalPath[aPropertyPaths[aPropertyPaths.length - 1]]) {
|
|
475
648
|
oTextInfo = MassEditHelper.getTextArrangementInfo(
|
|
476
649
|
oData.dataProperty,
|
|
477
|
-
oData.
|
|
478
|
-
oData.
|
|
479
|
-
|
|
650
|
+
oData.descriptionPath,
|
|
651
|
+
oData.display,
|
|
652
|
+
context
|
|
480
653
|
);
|
|
481
654
|
aFinalPath[aPropertyPaths[aPropertyPaths.length - 1]].push({
|
|
482
655
|
"text": (oTextInfo && oTextInfo.fullText) || sMultiLevelPathValue,
|
|
483
|
-
"key":
|
|
656
|
+
"key": sPropertyKey,
|
|
484
657
|
"textInfo": oTextInfo
|
|
485
658
|
});
|
|
486
659
|
oDistinctValueMap[sPropertyKey] = sMultiLevelPathValue;
|
|
487
660
|
}
|
|
488
661
|
}
|
|
662
|
+
// if (Object.keys(oDistinctValueMap).length === 1) {
|
|
663
|
+
// dialogContext.setProperty(oData.dataProperty, sPropertyKey && oDistinctValueMap[sPropertyKey]);
|
|
664
|
+
// }
|
|
665
|
+
|
|
666
|
+
aFinalPath[aPropertyPaths[aPropertyPaths.length - 1]].textInfo = {
|
|
667
|
+
descriptionPath: oData.descriptionPath,
|
|
668
|
+
valuePath: oData.dataProperty,
|
|
669
|
+
displayMode: oData.display
|
|
670
|
+
};
|
|
489
671
|
} else {
|
|
490
672
|
aValues[oData.dataProperty] = aValues[oData.dataProperty] || [];
|
|
673
|
+
aValues[oData.dataProperty]["selectOptions"] = aValues[oData.dataProperty]["selectOptions"] || [];
|
|
491
674
|
if (oData.unitProperty) {
|
|
492
675
|
aUnitData[oData.unitProperty] = aUnitData[oData.unitProperty] || [];
|
|
676
|
+
aUnitData[oData.unitProperty]["selectOptions"] = aUnitData[oData.unitProperty]["selectOptions"] || [];
|
|
493
677
|
}
|
|
494
|
-
for (
|
|
495
|
-
const oDataObject =
|
|
496
|
-
|
|
497
|
-
if (oData.dataProperty && oDataObject[oData.dataProperty] && !oDistinctValueMap[
|
|
498
|
-
|
|
499
|
-
oData.dataProperty,
|
|
500
|
-
oData.textBinding,
|
|
501
|
-
oData.entitySet,
|
|
502
|
-
aContexts[i]
|
|
503
|
-
);
|
|
504
|
-
aValues[oData.dataProperty].push({
|
|
505
|
-
"text": (oTextInfo && oTextInfo.fullText) || oDataObject[oData.dataProperty],
|
|
506
|
-
"key": oData.dataProperty,
|
|
507
|
-
"textInfo": oTextInfo
|
|
508
|
-
});
|
|
509
|
-
oDistinctValueMap[sPropertyName] = oDataObject[oData.dataProperty];
|
|
510
|
-
}
|
|
511
|
-
if (oData.unitProperty && oDataObject[oData.unitProperty]) {
|
|
512
|
-
sPropertyName = oData.unitProperty + "/" + oDataObject[oData.unitProperty];
|
|
513
|
-
if (!oDistinctValueMap[sPropertyName]) {
|
|
678
|
+
for (const context of aContexts) {
|
|
679
|
+
const oDataObject = context.getObject();
|
|
680
|
+
sPropertyKey = oData.dataProperty + "/" + oDataObject[oData.dataProperty];
|
|
681
|
+
if (oData.dataProperty && oDataObject[oData.dataProperty] && !oDistinctValueMap[sPropertyKey]) {
|
|
682
|
+
if (oData.inputType != "CheckBox") {
|
|
514
683
|
oTextInfo = MassEditHelper.getTextArrangementInfo(
|
|
515
|
-
oData.
|
|
516
|
-
oData.
|
|
517
|
-
oData.
|
|
518
|
-
|
|
684
|
+
oData.dataProperty,
|
|
685
|
+
oData.descriptionPath,
|
|
686
|
+
oData.display,
|
|
687
|
+
context
|
|
519
688
|
);
|
|
520
|
-
|
|
521
|
-
"text": (oTextInfo && oTextInfo.fullText) || oDataObject[oData.
|
|
522
|
-
"key":
|
|
689
|
+
const entry = {
|
|
690
|
+
"text": (oTextInfo && oTextInfo.fullText) || oDataObject[oData.dataProperty],
|
|
691
|
+
"key": sPropertyKey,
|
|
523
692
|
"textInfo": oTextInfo
|
|
524
|
-
}
|
|
525
|
-
|
|
693
|
+
};
|
|
694
|
+
aValues[oData.dataProperty].push(entry);
|
|
695
|
+
aValues[oData.dataProperty]["selectOptions"].push(entry);
|
|
696
|
+
}
|
|
697
|
+
oDistinctValueMap[sPropertyKey] = oDataObject[oData.dataProperty];
|
|
698
|
+
}
|
|
699
|
+
if (oData.unitProperty && oDataObject[oData.unitProperty]) {
|
|
700
|
+
sUnitPropertyName = oData.unitProperty + "/" + oDataObject[oData.unitProperty];
|
|
701
|
+
if (!oDistinctUnitMap[sUnitPropertyName]) {
|
|
702
|
+
if (oData.inputType != "CheckBox") {
|
|
703
|
+
oTextInfo = MassEditHelper.getTextArrangementInfo(
|
|
704
|
+
oData.unitProperty,
|
|
705
|
+
oData.descriptionPath,
|
|
706
|
+
oData.display,
|
|
707
|
+
context
|
|
708
|
+
);
|
|
709
|
+
const unitEntry = {
|
|
710
|
+
"text": (oTextInfo && oTextInfo.fullText) || oDataObject[oData.unitProperty],
|
|
711
|
+
"key": sUnitPropertyName,
|
|
712
|
+
"textInfo": oTextInfo
|
|
713
|
+
};
|
|
714
|
+
aUnitData[oData.unitProperty].push(unitEntry);
|
|
715
|
+
aUnitData[oData.unitProperty]["selectOptions"].push(unitEntry);
|
|
716
|
+
}
|
|
717
|
+
oDistinctUnitMap[sUnitPropertyName] = oDataObject[oData.unitProperty];
|
|
526
718
|
}
|
|
527
719
|
}
|
|
528
720
|
}
|
|
721
|
+
aValues[oData.dataProperty].textInfo = {
|
|
722
|
+
descriptionPath: oData.descriptionPath,
|
|
723
|
+
valuePath: oData.dataProperty,
|
|
724
|
+
displayMode: oData.display
|
|
725
|
+
};
|
|
726
|
+
}
|
|
727
|
+
if (Object.keys(oDistinctValueMap).length === 1) {
|
|
728
|
+
dialogContext.setProperty(oData.dataProperty, sPropertyKey && oDistinctValueMap[sPropertyKey]);
|
|
729
|
+
}
|
|
730
|
+
if (Object.keys(oDistinctUnitMap).length === 1) {
|
|
731
|
+
dialogContext.setProperty(oData.unitProperty, sUnitPropertyName && oDistinctUnitMap[sUnitPropertyName]);
|
|
529
732
|
}
|
|
530
733
|
});
|
|
531
|
-
aDataArray.forEach(function(oData: any) {
|
|
734
|
+
aDataArray.forEach(function (oData: any) {
|
|
735
|
+
let values: any = {};
|
|
532
736
|
if (oData.dataProperty.indexOf("/") > -1) {
|
|
533
737
|
const sMultiLevelPropPathValue = MassEditHelper.getValueForMultiLevelPath(oData.dataProperty, aValues);
|
|
534
738
|
if (!sMultiLevelPropPathValue) {
|
|
@@ -536,18 +740,25 @@ const MassEditHelper = {
|
|
|
536
740
|
} else {
|
|
537
741
|
MassEditHelper.setDefaultValuesToDialog(sMultiLevelPropPathValue, aContexts, oDefaultValues, oData);
|
|
538
742
|
}
|
|
539
|
-
|
|
743
|
+
values = sMultiLevelPropPathValue;
|
|
744
|
+
} else if (aValues[oData.dataProperty]) {
|
|
745
|
+
aValues[oData.dataProperty] = aValues[oData.dataProperty] || [];
|
|
540
746
|
MassEditHelper.setDefaultValuesToDialog(aValues[oData.dataProperty], aContexts, oDefaultValues, oData);
|
|
747
|
+
values = aValues[oData.dataProperty];
|
|
541
748
|
}
|
|
749
|
+
|
|
542
750
|
if (aUnitData[oData.unitProperty] && aUnitData[oData.unitProperty].length) {
|
|
543
751
|
MassEditHelper.setDefaultValuesToDialog(aUnitData[oData.unitProperty], aContexts, oDefaultValues, oData, true);
|
|
752
|
+
aUnitData[oData.unitProperty].textInfo = {};
|
|
753
|
+
aUnitData[oData.unitProperty].selectedKey = MassEditHelper.getDefaultSelectionPathComboBox(aContexts, oData.unitProperty);
|
|
754
|
+
aUnitData[oData.unitProperty].inputType = oData.inputType;
|
|
544
755
|
} else if (
|
|
545
756
|
(oData.dataProperty && aValues[oData.dataProperty] && !aValues[oData.dataProperty].length) ||
|
|
546
757
|
(oData.unitProperty && aUnitData[oData.unitProperty] && !aUnitData[oData.unitProperty].length)
|
|
547
758
|
) {
|
|
548
759
|
const bClearFieldOrBlankValueExists =
|
|
549
760
|
aValues[oData.dataProperty] &&
|
|
550
|
-
aValues[oData.dataProperty].some(function(obj: any) {
|
|
761
|
+
aValues[oData.dataProperty].some(function (obj: any) {
|
|
551
762
|
return obj.text === "< Clear Values >" || obj.text === "< Leave Blank >";
|
|
552
763
|
});
|
|
553
764
|
if (oData.dataProperty && !bClearFieldOrBlankValueExists) {
|
|
@@ -555,14 +766,22 @@ const MassEditHelper = {
|
|
|
555
766
|
}
|
|
556
767
|
const bClearFieldOrBlankUnitValueExists =
|
|
557
768
|
aUnitData[oData.unitProperty] &&
|
|
558
|
-
aUnitData[oData.unitProperty].some(function(obj: any) {
|
|
769
|
+
aUnitData[oData.unitProperty].some(function (obj: any) {
|
|
559
770
|
return obj.text === "< Clear Values >" || obj.text === "< Leave Blank >";
|
|
560
771
|
});
|
|
561
|
-
if (oData.unitProperty
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
772
|
+
if (oData.unitProperty) {
|
|
773
|
+
if (!bClearFieldOrBlankUnitValueExists) {
|
|
774
|
+
aUnitData[oData.unitProperty].push({
|
|
775
|
+
text: oDefaultValues.leaveBlankValue,
|
|
776
|
+
key: "Empty/" + oData.unitProperty
|
|
777
|
+
});
|
|
778
|
+
}
|
|
779
|
+
aUnitData[oData.unitProperty].textInfo = {};
|
|
780
|
+
aUnitData[oData.unitProperty].selectedKey = MassEditHelper.getDefaultSelectionPathComboBox(
|
|
781
|
+
aContexts,
|
|
782
|
+
oData.unitProperty
|
|
783
|
+
);
|
|
784
|
+
aUnitData[oData.unitProperty].inputType = oData.inputType;
|
|
566
785
|
}
|
|
567
786
|
}
|
|
568
787
|
if (oData.isPropertyReadOnly && typeof oData.isPropertyReadOnly === "boolean") {
|
|
@@ -582,11 +801,54 @@ const MassEditHelper = {
|
|
|
582
801
|
type: "Path"
|
|
583
802
|
});
|
|
584
803
|
}
|
|
804
|
+
|
|
805
|
+
// Setting visbility of the mass edit field.
|
|
806
|
+
if (oData.editMode) {
|
|
807
|
+
values.visible =
|
|
808
|
+
oData.editMode === EditMode.Editable ||
|
|
809
|
+
aContexts.some(
|
|
810
|
+
MassEditHelper.getFieldVisiblity.bind(MassEditHelper, oData.editMode, oDialogDataModel, oData.dataProperty, values)
|
|
811
|
+
);
|
|
812
|
+
} else {
|
|
813
|
+
values.visible = true;
|
|
814
|
+
}
|
|
815
|
+
values.selectedKey = MassEditHelper.getDefaultSelectionPathComboBox(aContexts, oData.dataProperty);
|
|
816
|
+
values.inputType = oData.inputType;
|
|
817
|
+
values.unitProperty = oData.unitProperty;
|
|
585
818
|
});
|
|
586
|
-
|
|
587
|
-
const oDialogDataModel = new JSONModel(oData);
|
|
819
|
+
|
|
588
820
|
return oDialogDataModel;
|
|
589
821
|
},
|
|
822
|
+
/**
|
|
823
|
+
* Gets transient context for dialog.
|
|
824
|
+
*
|
|
825
|
+
* @param {Table} table Instance of Table.
|
|
826
|
+
* @param {Dialog} dialog Mass Edit Dialog.
|
|
827
|
+
* @returns {object} Promise returning instance of dialog.
|
|
828
|
+
*/
|
|
829
|
+
getDialogContext: function (table: Table, dialog?: Dialog): Context {
|
|
830
|
+
let transCtx: Context = (dialog && dialog.getBindingContext()) as Context;
|
|
831
|
+
|
|
832
|
+
if (!transCtx) {
|
|
833
|
+
const model = table.getModel();
|
|
834
|
+
const listBinding = table.getRowBinding();
|
|
835
|
+
const transientListBinding = model.bindList(listBinding.getPath(), listBinding.getContext(), [], [], {
|
|
836
|
+
$$updateGroupId: "submitLater"
|
|
837
|
+
}) as ODataListBinding;
|
|
838
|
+
(transientListBinding as any).refreshInternal = function () {
|
|
839
|
+
/* */
|
|
840
|
+
};
|
|
841
|
+
transCtx = transientListBinding.create({}, true);
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
return transCtx;
|
|
845
|
+
},
|
|
846
|
+
|
|
847
|
+
onDialogOpen: function (event: any): void {
|
|
848
|
+
const source = event.getSource();
|
|
849
|
+
const fieldsInfoModel = source.getModel("fieldsInfo");
|
|
850
|
+
fieldsInfoModel.setProperty("/isOpen", true);
|
|
851
|
+
},
|
|
590
852
|
|
|
591
853
|
/**
|
|
592
854
|
* Create the mass edit dialog.
|
|
@@ -596,15 +858,16 @@ const MassEditHelper = {
|
|
|
596
858
|
* @param {object} oController Controller for the view
|
|
597
859
|
* @returns {object} Promise returning instance of dialog.
|
|
598
860
|
*/
|
|
599
|
-
createDialog: function(oTable: Table, aContexts: any[], oController: PageController) {
|
|
861
|
+
createDialog: function (oTable: Table, aContexts: any[], oController: PageController) {
|
|
600
862
|
const sFragmentName = "sap/fe/core/controls/massEdit/MassEditDialog",
|
|
601
863
|
aDataArray: any[] = [],
|
|
602
|
-
oResourceBundle =
|
|
864
|
+
oResourceBundle = (Core as CoreEx).getLibraryResourceBundle("sap.fe.core"),
|
|
603
865
|
oDefaultValues = MassEditHelper.getDefaultTextsForDialog(oResourceBundle, aContexts.length, oTable),
|
|
604
866
|
oDataFieldModel = MassEditHelper.prepareDataForDialog(oTable, aContexts, aDataArray),
|
|
605
|
-
|
|
867
|
+
dialogContext = MassEditHelper.getDialogContext(oTable),
|
|
868
|
+
oDialogDataModel = MassEditHelper.setRuntimeModelOnDialog(aContexts, aDataArray, oDefaultValues, dialogContext);
|
|
606
869
|
|
|
607
|
-
return new Promise(function(resolve: (value: any) => void, reject: (reason?: any) => void) {
|
|
870
|
+
return new Promise(function (resolve: (value: any) => void, reject: (reason?: any) => void) {
|
|
608
871
|
const oFragment = XMLTemplateProcessor.loadTemplate(sFragmentName, "fragment");
|
|
609
872
|
return Promise.resolve(
|
|
610
873
|
XMLPreprocessor.process(
|
|
@@ -620,27 +883,35 @@ const MassEditHelper = {
|
|
|
620
883
|
}
|
|
621
884
|
)
|
|
622
885
|
)
|
|
623
|
-
.then(function(oFragment: any) {
|
|
624
|
-
return Fragment.load({ definition: oFragment }).then(function(oDialogContent: any) {
|
|
886
|
+
.then(function (oFragment: any) {
|
|
887
|
+
return Fragment.load({ definition: oFragment }).then(function (oDialogContent: any) {
|
|
888
|
+
const DraftStatus = FELibrary.DraftStatus;
|
|
625
889
|
const oDialog = new Dialog({
|
|
626
890
|
title: oDefaultValues.massEditTitle,
|
|
627
891
|
content: [oDialogContent],
|
|
892
|
+
afterOpen: MassEditHelper.onDialogOpen,
|
|
628
893
|
beginButton: new Button({
|
|
629
894
|
text: oDefaultValues.applyButtonText,
|
|
630
895
|
type: "Emphasized",
|
|
631
|
-
press: function(oEvent: any) {
|
|
896
|
+
press: function (oEvent: any) {
|
|
897
|
+
(oController.getView()?.getBindingContext("internal") as InternalModelContext)?.setProperty(
|
|
898
|
+
"skipPatchHandlers",
|
|
899
|
+
true
|
|
900
|
+
);
|
|
632
901
|
const oDialog = oEvent.getSource().getParent();
|
|
633
902
|
const oModel = oDialog.getModel("fieldsInfo");
|
|
634
903
|
const aResults = oModel.getProperty("/results");
|
|
635
904
|
const aPropertyReadableInfo = oModel.getProperty("/readablePropertyData");
|
|
636
905
|
const changePromise: any[] = [];
|
|
637
906
|
let bReadOnlyField = false;
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
907
|
+
let groupId;
|
|
908
|
+
//let index = 0;
|
|
909
|
+
let errorValues: any[] = [];
|
|
910
|
+
aContexts.forEach(function (oSelectedContext: any, idx: number) {
|
|
911
|
+
aResults.forEach(function (oResult: any) {
|
|
641
912
|
//TODO - Add save implementation for Value Help.
|
|
642
913
|
if (aPropertyReadableInfo) {
|
|
643
|
-
bReadOnlyField = aPropertyReadableInfo.some(function(oPropertyInfo: any) {
|
|
914
|
+
bReadOnlyField = aPropertyReadableInfo.some(function (oPropertyInfo: any) {
|
|
644
915
|
if (oResult.keyValue === oPropertyInfo.property) {
|
|
645
916
|
if (oPropertyInfo.type === "Default") {
|
|
646
917
|
return oPropertyInfo.value === true;
|
|
@@ -657,37 +928,93 @@ const MassEditHelper = {
|
|
|
657
928
|
}
|
|
658
929
|
});
|
|
659
930
|
}
|
|
931
|
+
groupId = "$auto." + idx;
|
|
932
|
+
//index += 1;
|
|
933
|
+
oController._editFlow.setDraftStatus(DraftStatus.Saving);
|
|
934
|
+
//let promiseCount = 0;
|
|
660
935
|
if (oResult.keyValue && oResult.value !== "Default" && !bReadOnlyField) {
|
|
661
|
-
changePromise.push(
|
|
936
|
+
changePromise.push(
|
|
937
|
+
oSelectedContext
|
|
938
|
+
.setProperty(oResult.keyValue, oResult.value, groupId)
|
|
939
|
+
.then(function () {
|
|
940
|
+
return oSelectedContext;
|
|
941
|
+
})
|
|
942
|
+
.catch(function (oError: any) {
|
|
943
|
+
errorValues.push(oSelectedContext.getObject());
|
|
944
|
+
Log.error("Mass Edit: Something went wrong in updating entries.", oError);
|
|
945
|
+
})
|
|
946
|
+
);
|
|
662
947
|
}
|
|
663
948
|
});
|
|
664
949
|
});
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
950
|
+
|
|
951
|
+
(Promise as any).allSettled(changePromise).then(function () {
|
|
952
|
+
const oListBinding = oTable.getRowBinding();
|
|
953
|
+
const oExtensionAPI = oController && (oController.getExtensionAPI() as any);
|
|
954
|
+
return oExtensionAPI.refresh(oListBinding.getPath()).then(function () {
|
|
955
|
+
let subtitleColumn = CommonUtils.getMessageColumn(oTable);
|
|
956
|
+
let messages = sap.ui.getCore().getMessageManager().getMessageModel().getData();
|
|
957
|
+
let boundTransitionErrorContexts = [] as any;
|
|
958
|
+
messages.forEach(function (message: any, idx: any) {
|
|
959
|
+
const messageTargets = message.getTargets();
|
|
960
|
+
if (
|
|
961
|
+
messageTargets &&
|
|
962
|
+
messageTargets.length === 1 &&
|
|
963
|
+
messageTargets[0].length &&
|
|
964
|
+
message.persistent === true
|
|
965
|
+
) {
|
|
966
|
+
let boundTransitionErrorContext = aContexts.find(function (oContext: any) {
|
|
967
|
+
return message.getTarget().indexOf(oContext.getPath()) !== -1;
|
|
968
|
+
});
|
|
969
|
+
boundTransitionErrorContexts.push(boundTransitionErrorContext);
|
|
970
|
+
message.additionalText = boundTransitionErrorContext
|
|
971
|
+
? boundTransitionErrorContext.getObject()[subtitleColumn]
|
|
972
|
+
: undefined;
|
|
973
|
+
}
|
|
974
|
+
});
|
|
975
|
+
if (boundTransitionErrorContexts.length === 0 && errorValues.length === 0) {
|
|
976
|
+
oController._editFlow.setDraftStatus(DraftStatus.Saved);
|
|
977
|
+
const successToast = oResourceBundle.getText("C_MASS_EDIT_SUCCESS_TOAST");
|
|
978
|
+
MessageToast.show(successToast);
|
|
979
|
+
} else {
|
|
980
|
+
if (
|
|
981
|
+
errorValues.length + boundTransitionErrorContexts.length <
|
|
982
|
+
(oTable as any).getSelectedContexts().length
|
|
983
|
+
) {
|
|
984
|
+
oController._editFlow.setDraftStatus(DraftStatus.Saved);
|
|
985
|
+
} else if (
|
|
986
|
+
errorValues.length + boundTransitionErrorContexts.length ===
|
|
987
|
+
(oTable as any).getSelectedContexts().length
|
|
988
|
+
) {
|
|
989
|
+
oController._editFlow.setDraftStatus(DraftStatus.Clear);
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
oController._editFlow.getMessageHandler().showMessages();
|
|
993
|
+
if (oDialog.isOpen()) {
|
|
670
994
|
oDialog.close();
|
|
671
995
|
oDialog.destroy();
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
Log.error("Mass Edit: Something went wrong in updating entries.", oError);
|
|
996
|
+
(oController.getView()?.getBindingContext("internal") as InternalModelContext)?.setProperty(
|
|
997
|
+
"skipPatchHandlers",
|
|
998
|
+
false
|
|
999
|
+
);
|
|
1000
|
+
}
|
|
678
1001
|
});
|
|
1002
|
+
});
|
|
679
1003
|
}
|
|
680
1004
|
}),
|
|
681
1005
|
endButton: new Button({
|
|
682
1006
|
text: oDefaultValues.cancelButtonText,
|
|
683
|
-
press: function(oEvent: any) {
|
|
1007
|
+
press: function (oEvent: any) {
|
|
684
1008
|
const oDialog = oEvent.getSource().getParent();
|
|
685
1009
|
oDialog.close();
|
|
686
1010
|
oDialog.destroy();
|
|
687
1011
|
}
|
|
688
1012
|
})
|
|
689
1013
|
});
|
|
1014
|
+
const model = oTable.getModel();
|
|
690
1015
|
oDialog.setModel(oDialogDataModel, "fieldsInfo");
|
|
1016
|
+
oDialog.setModel(model);
|
|
1017
|
+
oDialog.setBindingContext(dialogContext);
|
|
691
1018
|
resolve(oDialog);
|
|
692
1019
|
});
|
|
693
1020
|
})
|