@sapui5/sap.fe.core 1.102.0 → 1.103.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 +5 -5
- package/src/sap/fe/core/.library +1 -1
- package/src/sap/fe/core/AppComponent.js +62 -26
- package/src/sap/fe/core/AppComponent.ts +56 -40
- package/src/sap/fe/core/AppStateHandler.js +10 -10
- package/src/sap/fe/core/AppStateHandler.ts +9 -9
- package/src/sap/fe/core/BaseController.js +11 -9
- package/src/sap/fe/core/BaseController.ts +15 -13
- package/src/sap/fe/core/CommonUtils.js +236 -109
- package/src/sap/fe/core/CommonUtils.ts +252 -136
- package/src/sap/fe/core/ExtensionAPI.js +24 -27
- package/src/sap/fe/core/ExtensionAPI.ts +36 -38
- package/src/sap/fe/core/PageController.js +4 -4
- package/src/sap/fe/core/PageController.ts +4 -5
- package/src/sap/fe/core/TemplateComponent.js +1 -1
- package/src/sap/fe/core/TemplateComponent.ts +6 -6
- package/src/sap/fe/core/TemplateModel.js +1 -1
- package/src/sap/fe/core/TemplateModel.ts +1 -1
- package/src/sap/fe/core/buildingBlocks/AttributeModel.js +1 -1
- package/src/sap/fe/core/buildingBlocks/AttributeModel.ts +1 -1
- package/src/sap/fe/core/buildingBlocks/BuildingBlockRuntime.js +8 -8
- package/src/sap/fe/core/buildingBlocks/BuildingBlockRuntime.ts +11 -10
- package/src/sap/fe/core/buildingBlocks/TraceInfo.js +27 -27
- package/src/sap/fe/core/buildingBlocks/TraceInfo.ts +28 -26
- package/src/sap/fe/core/controllerextensions/EditFlow.js +129 -118
- package/src/sap/fe/core/controllerextensions/EditFlow.ts +154 -141
- package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.js +9 -9
- package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.ts +10 -10
- package/src/sap/fe/core/controllerextensions/InternalEditFlow.js +31 -26
- package/src/sap/fe/core/controllerextensions/InternalEditFlow.ts +34 -35
- package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.js +70 -70
- package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.ts +77 -77
- package/src/sap/fe/core/controllerextensions/InternalRouting.js +84 -78
- package/src/sap/fe/core/controllerextensions/InternalRouting.ts +105 -101
- package/src/sap/fe/core/controllerextensions/KPIManagement.js +66 -68
- package/src/sap/fe/core/controllerextensions/KPIManagement.ts +106 -123
- package/src/sap/fe/core/controllerextensions/MassEdit.js +8 -8
- package/src/sap/fe/core/controllerextensions/MassEdit.ts +19 -26
- package/src/sap/fe/core/controllerextensions/MessageHandler.js +20 -12
- package/src/sap/fe/core/controllerextensions/MessageHandler.ts +29 -14
- package/src/sap/fe/core/controllerextensions/PageReady.js +97 -25
- package/src/sap/fe/core/controllerextensions/PageReady.ts +94 -34
- package/src/sap/fe/core/controllerextensions/Paginator.js +21 -22
- package/src/sap/fe/core/controllerextensions/Paginator.ts +24 -25
- package/src/sap/fe/core/controllerextensions/Placeholder.js +4 -6
- package/src/sap/fe/core/controllerextensions/Placeholder.ts +12 -14
- package/src/sap/fe/core/controllerextensions/Routing.js +10 -11
- package/src/sap/fe/core/controllerextensions/Routing.ts +12 -13
- package/src/sap/fe/core/controllerextensions/Share.js +22 -22
- package/src/sap/fe/core/controllerextensions/Share.ts +30 -29
- package/src/sap/fe/core/controllerextensions/SideEffects.js +46 -50
- package/src/sap/fe/core/controllerextensions/SideEffects.ts +56 -60
- package/src/sap/fe/core/controllerextensions/ViewState.js +65 -62
- package/src/sap/fe/core/controllerextensions/ViewState.ts +68 -63
- package/src/sap/fe/core/controllerextensions/collaboration/ActivityBase.js +5 -5
- package/src/sap/fe/core/controllerextensions/collaboration/ActivityBase.ts +8 -7
- package/src/sap/fe/core/controllerextensions/collaboration/ActivitySync.js +6 -6
- package/src/sap/fe/core/controllerextensions/collaboration/ActivitySync.ts +12 -17
- package/src/sap/fe/core/controllerextensions/collaboration/CollaborationCommon.js +2 -2
- package/src/sap/fe/core/controllerextensions/collaboration/CollaborationCommon.ts +4 -4
- package/src/sap/fe/core/controllerextensions/collaboration/Manage.js +7 -9
- package/src/sap/fe/core/controllerextensions/collaboration/Manage.ts +18 -19
- package/src/sap/fe/core/controllerextensions/editFlow/TransactionHelper.js +184 -137
- package/src/sap/fe/core/controllerextensions/editFlow/TransactionHelper.ts +253 -206
- package/src/sap/fe/core/controllerextensions/editFlow/draft.js +113 -121
- package/src/sap/fe/core/controllerextensions/editFlow/draft.ts +148 -158
- package/src/sap/fe/core/controllerextensions/editFlow/operations.js +198 -148
- package/src/sap/fe/core/controllerextensions/editFlow/operations.ts +223 -159
- package/src/sap/fe/core/controllerextensions/editFlow/sticky.js +24 -26
- package/src/sap/fe/core/controllerextensions/editFlow/sticky.ts +35 -33
- package/src/sap/fe/core/controllerextensions/messageHandler/messageHandling.js +78 -44
- package/src/sap/fe/core/controllerextensions/messageHandler/messageHandling.ts +90 -60
- package/src/sap/fe/core/controllerextensions/routing/RouterProxy.js +52 -55
- package/src/sap/fe/core/controllerextensions/routing/RouterProxy.ts +55 -58
- package/src/sap/fe/core/controls/Any.js +9 -5
- package/src/sap/fe/core/controls/Any.ts +10 -4
- package/src/sap/fe/core/controls/CommandExecution.js +11 -25
- package/src/sap/fe/core/controls/CommandExecution.ts +11 -25
- package/src/sap/fe/core/controls/ConditionalWrapper.js +2 -2
- package/src/sap/fe/core/controls/ConditionalWrapper.ts +3 -3
- package/src/sap/fe/core/controls/CustomFilterFieldContentWrapper.js +22 -22
- package/src/sap/fe/core/controls/CustomFilterFieldContentWrapper.ts +25 -24
- package/src/sap/fe/core/controls/CustomQuickViewPage.js +2 -2
- package/src/sap/fe/core/controls/CustomQuickViewPage.ts +2 -2
- package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.js +3 -3
- package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.ts +5 -5
- package/src/sap/fe/core/controls/FieldWrapper.js +2 -2
- package/src/sap/fe/core/controls/FieldWrapper.ts +3 -3
- package/src/sap/fe/core/controls/FileWrapper.js +2 -2
- package/src/sap/fe/core/controls/FileWrapper.ts +11 -11
- package/src/sap/fe/core/controls/FilterBar.js +6 -2
- package/src/sap/fe/core/controls/FilterBar.ts +13 -9
- package/src/sap/fe/core/controls/FormElementWrapper.js +1 -1
- package/src/sap/fe/core/controls/FormElementWrapper.ts +2 -2
- package/src/sap/fe/core/controls/MassEditSelect.js +1 -1
- package/src/sap/fe/core/controls/MassEditSelect.ts +0 -4
- package/src/sap/fe/core/controls/NonComputedVisibleKeyFieldsDialog.fragment.xml +3 -3
- package/src/sap/fe/core/controls/filterbar/VisualFilter.js +16 -12
- package/src/sap/fe/core/controls/filterbar/VisualFilter.ts +20 -22
- package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.js +3 -3
- package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.ts +8 -8
- package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.js +47 -47
- package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.ts +52 -52
- package/src/sap/fe/core/controls/massEdit/MassEditDialog.fragment.xml +8 -2
- package/src/sap/fe/core/controls/massEdit/MassEditHandlers.js +89 -88
- package/src/sap/fe/core/controls/massEdit/MassEditHandlers.ts +107 -106
- package/src/sap/fe/core/converters/ConverterContext.js +26 -33
- package/src/sap/fe/core/converters/ConverterContext.ts +51 -60
- package/src/sap/fe/core/converters/ManifestSettings.js +1 -1
- package/src/sap/fe/core/converters/ManifestSettings.ts +14 -14
- package/src/sap/fe/core/converters/ManifestWrapper.js +59 -45
- package/src/sap/fe/core/converters/ManifestWrapper.ts +55 -45
- package/src/sap/fe/core/converters/MetaModelConverter.js +50 -32
- package/src/sap/fe/core/converters/MetaModelConverter.ts +145 -127
- package/src/sap/fe/core/converters/TemplateConverter.js +21 -20
- package/src/sap/fe/core/converters/TemplateConverter.ts +27 -24
- package/src/sap/fe/core/converters/annotations/DataField.js +54 -34
- package/src/sap/fe/core/converters/annotations/DataField.ts +97 -75
- package/src/sap/fe/core/converters/common/AnnotationConverter.js +1911 -1495
- package/src/sap/fe/core/converters/controls/Common/Action.js +50 -41
- package/src/sap/fe/core/converters/controls/Common/Action.ts +56 -46
- package/src/sap/fe/core/converters/controls/Common/Chart.js +14 -14
- package/src/sap/fe/core/converters/controls/Common/Chart.ts +23 -26
- package/src/sap/fe/core/converters/controls/Common/Criticality.js +3 -3
- package/src/sap/fe/core/converters/controls/Common/Criticality.ts +4 -4
- package/src/sap/fe/core/converters/controls/Common/DataVisualization.js +28 -28
- package/src/sap/fe/core/converters/controls/Common/DataVisualization.ts +40 -36
- package/src/sap/fe/core/converters/controls/Common/Form.js +25 -27
- package/src/sap/fe/core/converters/controls/Common/Form.ts +37 -45
- package/src/sap/fe/core/converters/controls/Common/KPI.js +11 -11
- package/src/sap/fe/core/converters/controls/Common/KPI.ts +35 -39
- package/src/sap/fe/core/converters/controls/Common/Table.js +174 -183
- package/src/sap/fe/core/converters/controls/Common/Table.ts +237 -250
- package/src/sap/fe/core/converters/controls/Common/table/StandardActions.js +119 -119
- package/src/sap/fe/core/converters/controls/Common/table/StandardActions.ts +144 -141
- package/src/sap/fe/core/converters/controls/ListReport/FilterBar.js +45 -41
- package/src/sap/fe/core/converters/controls/ListReport/FilterBar.ts +64 -57
- package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.js +28 -26
- package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.ts +46 -43
- package/src/sap/fe/core/converters/controls/ObjectPage/Avatar.js +9 -9
- package/src/sap/fe/core/converters/controls/ObjectPage/Avatar.ts +14 -13
- package/src/sap/fe/core/converters/controls/ObjectPage/HeaderFacet.js +67 -64
- package/src/sap/fe/core/converters/controls/ObjectPage/HeaderFacet.ts +69 -66
- package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.js +73 -72
- package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.ts +98 -96
- package/src/sap/fe/core/converters/helpers/Aggregation.js +2 -4
- package/src/sap/fe/core/converters/helpers/Aggregation.ts +10 -13
- package/src/sap/fe/core/converters/helpers/BindingHelper.js +31 -31
- package/src/sap/fe/core/converters/helpers/BindingHelper.ts +30 -29
- package/src/sap/fe/core/converters/helpers/ConfigurableObject.js +4 -4
- package/src/sap/fe/core/converters/helpers/ConfigurableObject.ts +9 -9
- package/src/sap/fe/core/converters/helpers/ID.js +46 -46
- package/src/sap/fe/core/converters/helpers/ID.ts +25 -25
- package/src/sap/fe/core/converters/helpers/Key.js +7 -7
- package/src/sap/fe/core/converters/helpers/Key.ts +7 -7
- package/src/sap/fe/core/converters/helpers/SelectionVariantHelper.js +1 -1
- package/src/sap/fe/core/converters/helpers/SelectionVariantHelper.ts +4 -4
- package/src/sap/fe/core/converters/objectPage/FormMenuActions.js +6 -6
- package/src/sap/fe/core/converters/objectPage/FormMenuActions.ts +10 -10
- package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.js +46 -62
- package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.ts +54 -82
- package/src/sap/fe/core/converters/templates/ListReportConverter.js +30 -29
- package/src/sap/fe/core/converters/templates/ListReportConverter.ts +40 -40
- package/src/sap/fe/core/converters/templates/ObjectPageConverter.js +39 -38
- package/src/sap/fe/core/converters/templates/ObjectPageConverter.ts +52 -61
- package/src/sap/fe/core/designtime/AppComponent.designtime.js +4 -4
- package/src/sap/fe/core/designtime/AppComponent.designtime.ts +4 -4
- package/src/sap/fe/core/formatters/CollaborationFormatter.js +2 -2
- package/src/sap/fe/core/formatters/CollaborationFormatter.ts +3 -3
- package/src/sap/fe/core/formatters/FPMFormatter.js +5 -5
- package/src/sap/fe/core/formatters/FPMFormatter.ts +10 -10
- package/src/sap/fe/core/formatters/KPIFormatter.js +7 -7
- package/src/sap/fe/core/formatters/KPIFormatter.ts +10 -10
- package/src/sap/fe/core/formatters/StandardFormatter.js +89 -0
- package/src/sap/fe/core/formatters/StandardFormatter.ts +64 -0
- package/src/sap/fe/core/formatters/TableFormatter.js +11 -11
- package/src/sap/fe/core/formatters/TableFormatter.ts +12 -12
- package/src/sap/fe/core/formatters/ValueFormatter.js +8 -8
- package/src/sap/fe/core/formatters/ValueFormatter.ts +9 -9
- package/src/sap/fe/core/helpers/AppStartupHelper.js +15 -15
- package/src/sap/fe/core/helpers/AppStartupHelper.ts +37 -40
- package/src/sap/fe/core/helpers/BindingToolkit.js +1809 -0
- package/src/sap/fe/core/helpers/{BindingExpression.ts → BindingToolkit.ts} +365 -264
- package/src/sap/fe/core/helpers/ClassSupport.js +20 -11
- package/src/sap/fe/core/helpers/ClassSupport.ts +14 -10
- package/src/sap/fe/core/helpers/DynamicAnnotationPathHelper.js +2 -2
- package/src/sap/fe/core/helpers/DynamicAnnotationPathHelper.ts +1 -1
- package/src/sap/fe/core/helpers/EditState.js +1 -6
- package/src/sap/fe/core/helpers/EditState.ts +5 -10
- package/src/sap/fe/core/helpers/ExcelFormatHelper.js +2 -2
- package/src/sap/fe/core/helpers/ExcelFormatHelper.ts +4 -4
- package/src/sap/fe/core/helpers/FPMHelper.js +1 -1
- package/src/sap/fe/core/helpers/FPMHelper.ts +2 -2
- package/src/sap/fe/core/helpers/KeepAliveHelper.js +31 -31
- package/src/sap/fe/core/helpers/KeepAliveHelper.ts +52 -56
- package/src/sap/fe/core/helpers/MassEditHelper.js +281 -254
- package/src/sap/fe/core/helpers/MassEditHelper.ts +337 -289
- package/src/sap/fe/core/helpers/ModelHelper.js +25 -25
- package/src/sap/fe/core/helpers/ModelHelper.ts +34 -32
- package/src/sap/fe/core/helpers/PasteHelper.js +3 -10
- package/src/sap/fe/core/helpers/PasteHelper.ts +20 -25
- package/src/sap/fe/core/helpers/SemanticDateOperators.js +1 -1
- package/src/sap/fe/core/helpers/SemanticDateOperators.ts +11 -11
- package/src/sap/fe/core/helpers/SemanticKeyHelper.js +3 -3
- package/src/sap/fe/core/helpers/SemanticKeyHelper.ts +8 -8
- package/src/sap/fe/core/helpers/StableIdHelper.js +12 -12
- package/src/sap/fe/core/helpers/StableIdHelper.ts +12 -12
- package/src/sap/fe/core/jsx-runtime/jsx.js +1 -1
- package/src/sap/fe/core/jsx-runtime/jsx.ts +8 -8
- package/src/sap/fe/core/library.js +42 -3
- package/src/sap/fe/core/library.ts +38 -0
- package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.js +3 -3
- package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.ts +2 -2
- package/src/sap/fe/core/messagebundle.properties +49 -35
- package/src/sap/fe/core/messagebundle_ar.properties +13 -5
- package/src/sap/fe/core/messagebundle_bg.properties +13 -5
- package/src/sap/fe/core/messagebundle_ca.properties +13 -5
- package/src/sap/fe/core/messagebundle_cs.properties +13 -5
- package/src/sap/fe/core/messagebundle_cy.properties +14 -6
- package/src/sap/fe/core/messagebundle_da.properties +13 -5
- package/src/sap/fe/core/messagebundle_de.properties +15 -7
- package/src/sap/fe/core/messagebundle_el.properties +14 -6
- package/src/sap/fe/core/messagebundle_en.properties +9 -1
- package/src/sap/fe/core/messagebundle_en_GB.properties +11 -3
- package/src/sap/fe/core/messagebundle_en_US_sappsd.properties +7 -1
- package/src/sap/fe/core/messagebundle_en_US_saprigi.properties +9 -1
- package/src/sap/fe/core/messagebundle_en_US_saptrc.properties +44 -85
- package/src/sap/fe/core/messagebundle_es.properties +13 -5
- package/src/sap/fe/core/messagebundle_es_MX.properties +13 -5
- package/src/sap/fe/core/messagebundle_et.properties +13 -5
- package/src/sap/fe/core/messagebundle_fi.properties +14 -6
- package/src/sap/fe/core/messagebundle_fr.properties +14 -6
- package/src/sap/fe/core/messagebundle_fr_CA.properties +14 -6
- package/src/sap/fe/core/messagebundle_hi.properties +14 -6
- package/src/sap/fe/core/messagebundle_hr.properties +14 -6
- package/src/sap/fe/core/messagebundle_hu.properties +13 -5
- package/src/sap/fe/core/messagebundle_id.properties +13 -5
- package/src/sap/fe/core/messagebundle_it.properties +33 -25
- package/src/sap/fe/core/messagebundle_iw.properties +13 -5
- package/src/sap/fe/core/messagebundle_ja.properties +14 -6
- package/src/sap/fe/core/messagebundle_kk.properties +13 -5
- package/src/sap/fe/core/messagebundle_ko.properties +13 -5
- package/src/sap/fe/core/messagebundle_lt.properties +13 -5
- package/src/sap/fe/core/messagebundle_lv.properties +14 -6
- package/src/sap/fe/core/messagebundle_ms.properties +13 -5
- package/src/sap/fe/core/messagebundle_nl.properties +13 -5
- package/src/sap/fe/core/messagebundle_no.properties +13 -5
- package/src/sap/fe/core/messagebundle_pl.properties +13 -5
- package/src/sap/fe/core/messagebundle_pt.properties +13 -5
- package/src/sap/fe/core/messagebundle_pt_PT.properties +14 -6
- package/src/sap/fe/core/messagebundle_ro.properties +13 -5
- package/src/sap/fe/core/messagebundle_ru.properties +13 -5
- package/src/sap/fe/core/messagebundle_sh.properties +13 -5
- package/src/sap/fe/core/messagebundle_sk.properties +13 -5
- package/src/sap/fe/core/messagebundle_sl.properties +17 -9
- package/src/sap/fe/core/messagebundle_sv.properties +14 -6
- package/src/sap/fe/core/messagebundle_th.properties +13 -5
- package/src/sap/fe/core/messagebundle_tr.properties +13 -5
- package/src/sap/fe/core/messagebundle_uk.properties +13 -5
- package/src/sap/fe/core/messagebundle_vi.properties +13 -5
- package/src/sap/fe/core/messagebundle_zh_CN.properties +14 -6
- package/src/sap/fe/core/messagebundle_zh_TW.properties +13 -5
- package/src/sap/fe/core/services/AsyncComponentServiceFactory.js +2 -2
- package/src/sap/fe/core/services/AsyncComponentServiceFactory.ts +5 -5
- package/src/sap/fe/core/services/CacheHandlerServiceFactory.js +2 -2
- package/src/sap/fe/core/services/CacheHandlerServiceFactory.ts +14 -14
- package/src/sap/fe/core/services/EnvironmentServiceFactory.js +1 -1
- package/src/sap/fe/core/services/EnvironmentServiceFactory.ts +3 -2
- package/src/sap/fe/core/services/NavigationServiceFactory.js +53 -44
- package/src/sap/fe/core/services/NavigationServiceFactory.ts +54 -46
- package/src/sap/fe/core/services/ResourceModelServiceFactory.js +2 -2
- package/src/sap/fe/core/services/ResourceModelServiceFactory.ts +4 -4
- package/src/sap/fe/core/services/RoutingServiceFactory.js +55 -55
- package/src/sap/fe/core/services/RoutingServiceFactory.ts +67 -65
- package/src/sap/fe/core/services/ShellServicesFactory.js +72 -76
- package/src/sap/fe/core/services/ShellServicesFactory.ts +76 -82
- package/src/sap/fe/core/services/SideEffectsServiceFactory.js +61 -61
- package/src/sap/fe/core/services/SideEffectsServiceFactory.ts +102 -92
- package/src/sap/fe/core/services/TemplatedViewServiceFactory.js +20 -15
- package/src/sap/fe/core/services/TemplatedViewServiceFactory.ts +26 -21
- package/src/sap/fe/core/support/CommonHelper.js +3 -2
- package/src/sap/fe/core/support/CommonHelper.ts +9 -13
- package/src/sap/fe/core/support/Diagnostics.js +1 -1
- package/src/sap/fe/core/support/Diagnostics.ts +5 -5
- package/src/sap/fe/core/templating/CommonFormatters.js +84 -0
- package/src/sap/fe/core/templating/CommonFormatters.ts +86 -0
- package/src/sap/fe/core/templating/CriticalityFormatters.js +31 -31
- package/src/sap/fe/core/templating/CriticalityFormatters.ts +42 -40
- package/src/sap/fe/core/templating/DataFieldFormatters.js +8 -8
- package/src/sap/fe/core/templating/DataFieldFormatters.ts +13 -10
- package/src/sap/fe/core/templating/DataModelPathHelper.js +16 -15
- package/src/sap/fe/core/templating/DataModelPathHelper.ts +42 -32
- package/src/sap/fe/core/templating/DisplayModeFormatter.js +1 -1
- package/src/sap/fe/core/templating/DisplayModeFormatter.ts +2 -3
- package/src/sap/fe/core/templating/EntitySetHelper.js +7 -7
- package/src/sap/fe/core/templating/EntitySetHelper.ts +6 -8
- package/src/sap/fe/core/templating/FieldControlHelper.js +35 -34
- package/src/sap/fe/core/templating/FieldControlHelper.ts +29 -46
- package/src/sap/fe/core/templating/FilterHelper.js +10 -9
- package/src/sap/fe/core/templating/FilterHelper.ts +13 -13
- package/src/sap/fe/core/templating/FilterTemplating.js +1 -1
- package/src/sap/fe/core/templating/FilterTemplating.ts +3 -3
- package/src/sap/fe/core/templating/PropertyFormatters.js +7 -7
- package/src/sap/fe/core/templating/PropertyFormatters.ts +21 -19
- package/src/sap/fe/core/templating/PropertyHelper.js +25 -25
- package/src/sap/fe/core/templating/PropertyHelper.ts +25 -26
- package/src/sap/fe/core/templating/UIFormatters.js +148 -93
- package/src/sap/fe/core/templating/UIFormatters.ts +196 -124
- package/src/sap/fe/core/type/Email.js +2 -2
- package/src/sap/fe/core/type/Email.ts +2 -2
- package/src/sap/fe/core/helpers/BindingExpression.js +0 -1732
|
@@ -1,31 +1,29 @@
|
|
|
1
|
-
import { NavigationProperty, Property } from "@sap-ux/
|
|
2
|
-
import { DataFieldAbstractTypes } from "@sap-ux/vocabularies-types";
|
|
3
|
-
import {
|
|
4
|
-
import { UIAnnotationTypes } from "@sap-ux/vocabularies-types/types/generated/UI";
|
|
1
|
+
import type { NavigationProperty, PathAnnotationExpression, Property } from "@sap-ux/vocabularies-types";
|
|
2
|
+
import type { DataFieldAbstractTypes } from "@sap-ux/vocabularies-types/vocabularies/UI";
|
|
3
|
+
import { UIAnnotationTypes } from "@sap-ux/vocabularies-types/vocabularies/UI";
|
|
5
4
|
import { singletonPathVisitor, UI } from "sap/fe/core/converters/helpers/BindingHelper";
|
|
6
5
|
import { convertMetaModelContext, getInvolvedDataModelObjects } from "sap/fe/core/converters/MetaModelConverter";
|
|
7
6
|
import valueFormatters from "sap/fe/core/formatters/ValueFormatter";
|
|
7
|
+
import type { BindingToolkitExpression, CompiledBindingToolkitExpression, PathInModelExpression } from "sap/fe/core/helpers/BindingToolkit";
|
|
8
8
|
import {
|
|
9
9
|
addTypeInformation,
|
|
10
10
|
and,
|
|
11
|
-
|
|
12
|
-
bindingExpression,
|
|
13
|
-
BindingExpression,
|
|
14
|
-
BindingExpressionExpression,
|
|
15
|
-
compileBinding,
|
|
11
|
+
compileExpression,
|
|
16
12
|
constant,
|
|
17
13
|
equal,
|
|
18
|
-
Expression,
|
|
19
|
-
ExpressionOrPrimitive,
|
|
20
14
|
formatResult,
|
|
15
|
+
getExpressionFromAnnotation,
|
|
21
16
|
ifElse,
|
|
22
17
|
isConstant,
|
|
23
18
|
isTruthy,
|
|
24
19
|
not,
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
notEqual,
|
|
21
|
+
or,
|
|
22
|
+
pathInModel
|
|
23
|
+
} from "sap/fe/core/helpers/BindingToolkit";
|
|
27
24
|
import {
|
|
28
25
|
DataModelObjectPath,
|
|
26
|
+
getContextRelativeTargetObjectPath,
|
|
29
27
|
getPathRelativeLocation,
|
|
30
28
|
getTargetObjectPath,
|
|
31
29
|
isPathUpdatable
|
|
@@ -47,7 +45,7 @@ import {
|
|
|
47
45
|
isPathExpression,
|
|
48
46
|
isProperty
|
|
49
47
|
} from "sap/fe/core/templating/PropertyHelper";
|
|
50
|
-
import Context from "sap/ui/model/odata/v4/Context";
|
|
48
|
+
import type Context from "sap/ui/model/odata/v4/Context";
|
|
51
49
|
|
|
52
50
|
// Import-export method used by the converter to use them in the templating through the UIFormatters.
|
|
53
51
|
export type DisplayMode = DisplayModeFormatter.DisplayMode;
|
|
@@ -90,28 +88,41 @@ export type configType = {
|
|
|
90
88
|
export const getDisplayMode = function (oDataModelObjectPath: DataModelObjectPath): DisplayMode {
|
|
91
89
|
return DisplayModeFormatter.getDisplayMode(oDataModelObjectPath.targetObject, oDataModelObjectPath);
|
|
92
90
|
};
|
|
93
|
-
|
|
91
|
+
export const getEditableExpressionAsObject = function (
|
|
92
|
+
oPropertyPath: PropertyOrPath<Property>,
|
|
93
|
+
oDataFieldConverted: any = null,
|
|
94
|
+
oDataModelObjectPath: DataModelObjectPath,
|
|
95
|
+
isEditable: BindingToolkitExpression<boolean> = UI.IsEditable
|
|
96
|
+
): BindingToolkitExpression<boolean> {
|
|
97
|
+
return getEditableExpression(
|
|
98
|
+
oPropertyPath,
|
|
99
|
+
oDataFieldConverted,
|
|
100
|
+
oDataModelObjectPath,
|
|
101
|
+
true,
|
|
102
|
+
isEditable
|
|
103
|
+
) as BindingToolkitExpression<boolean>;
|
|
104
|
+
};
|
|
94
105
|
/**
|
|
95
106
|
* Create the expression to generate an "editable" boolean value.
|
|
96
107
|
*
|
|
97
|
-
* @param
|
|
98
|
-
* @param
|
|
99
|
-
* @param
|
|
100
|
-
* @param
|
|
101
|
-
* @param
|
|
102
|
-
* @returns
|
|
108
|
+
* @param oPropertyPath The input property
|
|
109
|
+
* @param oDataFieldConverted The DataFieldConverted object to read the fieldControl annotation
|
|
110
|
+
* @param oDataModelObjectPath The path to this property object
|
|
111
|
+
* @param bAsObject Whether or not this should be returned as an object or a binding string
|
|
112
|
+
* @param isEditable Whether or not UI.IsEditable be considered.
|
|
113
|
+
* @returns The binding expression used to determine if a property is editable or not
|
|
103
114
|
*/
|
|
104
115
|
export const getEditableExpression = function (
|
|
105
116
|
oPropertyPath: PropertyOrPath<Property>,
|
|
106
117
|
oDataFieldConverted: any = null,
|
|
107
118
|
oDataModelObjectPath: DataModelObjectPath,
|
|
108
119
|
bAsObject: boolean = false,
|
|
109
|
-
isEditable:
|
|
110
|
-
):
|
|
120
|
+
isEditable: BindingToolkitExpression<boolean> = UI.IsEditable
|
|
121
|
+
): CompiledBindingToolkitExpression | BindingToolkitExpression<boolean> {
|
|
111
122
|
if (!oPropertyPath || typeof oPropertyPath === "string") {
|
|
112
|
-
return
|
|
123
|
+
return compileExpression(false);
|
|
113
124
|
}
|
|
114
|
-
let dataFieldEditableExpression:
|
|
125
|
+
let dataFieldEditableExpression: BindingToolkitExpression<boolean> = constant(true);
|
|
115
126
|
if (oDataFieldConverted !== null) {
|
|
116
127
|
dataFieldEditableExpression = ifElse(isNonEditableExpression(oDataFieldConverted), false, isEditable);
|
|
117
128
|
}
|
|
@@ -146,38 +157,46 @@ export const getEditableExpression = function (
|
|
|
146
157
|
if (bAsObject) {
|
|
147
158
|
return and(editableExpression, dataFieldEditableExpression);
|
|
148
159
|
}
|
|
149
|
-
return
|
|
160
|
+
return compileExpression(and(editableExpression, dataFieldEditableExpression));
|
|
150
161
|
};
|
|
151
162
|
|
|
152
|
-
export const getCollaborationExpression = function (
|
|
163
|
+
export const getCollaborationExpression = function (
|
|
164
|
+
dataModelObjectPath: DataModelObjectPath,
|
|
165
|
+
formatter: any
|
|
166
|
+
): BindingToolkitExpression<any> {
|
|
153
167
|
const objectPath = getTargetObjectPath(dataModelObjectPath);
|
|
154
|
-
const activityExpression =
|
|
168
|
+
const activityExpression = pathInModel(`/collaboration/activities${objectPath}`, "internal");
|
|
155
169
|
const keys = dataModelObjectPath?.targetEntityType?.keys;
|
|
156
|
-
const keysExpressions:
|
|
170
|
+
const keysExpressions: BindingToolkitExpression<any>[] = [];
|
|
157
171
|
keys?.forEach(function (key) {
|
|
158
|
-
const keyExpression =
|
|
172
|
+
const keyExpression = pathInModel(key.name);
|
|
159
173
|
keysExpressions.push(keyExpression);
|
|
160
174
|
});
|
|
161
175
|
return formatResult([activityExpression, ...keysExpressions], formatter);
|
|
162
176
|
};
|
|
163
|
-
|
|
177
|
+
export const getEnabledExpressionAsObject = function (
|
|
178
|
+
oPropertyPath: PropertyOrPath<Property>,
|
|
179
|
+
oDataFieldConverted?: any
|
|
180
|
+
): BindingToolkitExpression<boolean> {
|
|
181
|
+
return getEnabledExpression(oPropertyPath, oDataFieldConverted, true) as BindingToolkitExpression<boolean>;
|
|
182
|
+
};
|
|
164
183
|
/**
|
|
165
184
|
* Create the expression to generate an "enabled" boolean value.
|
|
166
185
|
*
|
|
167
|
-
* @param
|
|
168
|
-
* @param
|
|
169
|
-
* @param
|
|
170
|
-
* @returns
|
|
186
|
+
* @param oPropertyPath The input property
|
|
187
|
+
* @param oDataFieldConverted The DataFieldConverted Object to read the fieldControl annotation
|
|
188
|
+
* @param bAsObject Whether or not this should be returned as an object or a binding string
|
|
189
|
+
* @returns The binding expression to determine if a property is enabled or not
|
|
171
190
|
*/
|
|
172
191
|
export const getEnabledExpression = function (
|
|
173
192
|
oPropertyPath: PropertyOrPath<Property>,
|
|
174
193
|
oDataFieldConverted?: any,
|
|
175
194
|
bAsObject: boolean = false
|
|
176
|
-
):
|
|
195
|
+
): CompiledBindingToolkitExpression | BindingToolkitExpression<boolean> {
|
|
177
196
|
if (!oPropertyPath || typeof oPropertyPath === "string") {
|
|
178
|
-
return
|
|
197
|
+
return compileExpression(true);
|
|
179
198
|
}
|
|
180
|
-
let dataFieldEnabledExpression:
|
|
199
|
+
let dataFieldEnabledExpression: BindingToolkitExpression<boolean> = constant(true);
|
|
181
200
|
if (oDataFieldConverted !== null) {
|
|
182
201
|
dataFieldEnabledExpression = ifElse(isDisabledExpression(oDataFieldConverted), false, true);
|
|
183
202
|
}
|
|
@@ -189,19 +208,19 @@ export const getEnabledExpression = function (
|
|
|
189
208
|
if (bAsObject) {
|
|
190
209
|
return and(enabledExpression, dataFieldEnabledExpression);
|
|
191
210
|
}
|
|
192
|
-
return
|
|
211
|
+
return compileExpression(and(enabledExpression, dataFieldEnabledExpression));
|
|
193
212
|
};
|
|
194
213
|
|
|
195
214
|
/**
|
|
196
215
|
* Create the expression to generate an "editMode" enum value.
|
|
197
216
|
*
|
|
198
|
-
* @param
|
|
199
|
-
* @param
|
|
200
|
-
* @param
|
|
201
|
-
* @param
|
|
202
|
-
* @param
|
|
203
|
-
* @param
|
|
204
|
-
* @returns
|
|
217
|
+
* @param oPropertyPath The input property
|
|
218
|
+
* @param oDataModelObjectPath The list of data model objects that are involved to reach that property
|
|
219
|
+
* @param bMeasureReadOnly Whether we should set UoM / currency field mode to read only
|
|
220
|
+
* @param bAsObject Whether we should return this as an expression or as a string
|
|
221
|
+
* @param oDataFieldConverted The dataField object
|
|
222
|
+
* @param isEditable Whether or not UI.IsEditable be considered.
|
|
223
|
+
* @returns The binding expression representing the current property edit mode, compliant with the MDC Field definition of editMode.
|
|
205
224
|
*/
|
|
206
225
|
export const getEditMode = function (
|
|
207
226
|
oPropertyPath: PropertyOrPath<Property>,
|
|
@@ -209,8 +228,8 @@ export const getEditMode = function (
|
|
|
209
228
|
bMeasureReadOnly: boolean = false,
|
|
210
229
|
bAsObject: boolean = false,
|
|
211
230
|
oDataFieldConverted: any = null,
|
|
212
|
-
isEditable:
|
|
213
|
-
):
|
|
231
|
+
isEditable: BindingToolkitExpression<boolean> = UI.IsEditable
|
|
232
|
+
): CompiledBindingToolkitExpression | BindingToolkitExpression<string> {
|
|
214
233
|
if (!oPropertyPath || typeof oPropertyPath === "string") {
|
|
215
234
|
return "Display";
|
|
216
235
|
}
|
|
@@ -221,18 +240,12 @@ export const getEditMode = function (
|
|
|
221
240
|
// If there is an associated unit, and it has a field control also use consider the following
|
|
222
241
|
// if the unit field control is readonly -> EditableReadOnly
|
|
223
242
|
// otherwise -> Editable
|
|
224
|
-
const editableExpression =
|
|
225
|
-
oPropertyPath,
|
|
226
|
-
oDataFieldConverted,
|
|
227
|
-
oDataModelObjectPath,
|
|
228
|
-
true,
|
|
229
|
-
isEditable
|
|
230
|
-
) as ExpressionOrPrimitive<boolean>;
|
|
243
|
+
const editableExpression = getEditableExpressionAsObject(oPropertyPath, oDataFieldConverted, oDataModelObjectPath, isEditable);
|
|
231
244
|
|
|
232
|
-
const enabledExpression =
|
|
245
|
+
const enabledExpression = getEnabledExpressionAsObject(oPropertyPath, oDataFieldConverted);
|
|
233
246
|
const associatedCurrencyProperty = getAssociatedCurrencyProperty(oProperty);
|
|
234
247
|
const unitProperty = associatedCurrencyProperty || getAssociatedUnitProperty(oProperty);
|
|
235
|
-
let resultExpression:
|
|
248
|
+
let resultExpression: BindingToolkitExpression<string> = constant("Editable");
|
|
236
249
|
if (unitProperty) {
|
|
237
250
|
resultExpression = ifElse(
|
|
238
251
|
or(isReadOnlyExpression(unitProperty), isComputed(unitProperty), bMeasureReadOnly),
|
|
@@ -256,54 +269,56 @@ export const getEditMode = function (
|
|
|
256
269
|
if (bAsObject) {
|
|
257
270
|
return editModeExpression;
|
|
258
271
|
}
|
|
259
|
-
return
|
|
272
|
+
return compileExpression(editModeExpression);
|
|
260
273
|
};
|
|
261
274
|
|
|
262
|
-
export const hasValidAnalyticalCurrencyOrUnit = function (
|
|
275
|
+
export const hasValidAnalyticalCurrencyOrUnit = function (
|
|
276
|
+
oPropertyDataModelObjectPath: DataModelObjectPath
|
|
277
|
+
): CompiledBindingToolkitExpression {
|
|
263
278
|
const oPropertyDefinition = oPropertyDataModelObjectPath.targetObject as Property;
|
|
264
279
|
const currency = oPropertyDefinition.annotations?.Measures?.ISOCurrency;
|
|
265
280
|
const measure = currency ? currency : oPropertyDefinition.annotations?.Measures?.Unit;
|
|
266
281
|
if (measure) {
|
|
267
|
-
return
|
|
282
|
+
return compileExpression(or(isTruthy(getExpressionFromAnnotation(measure) as BindingToolkitExpression<string>), not(UI.IsTotal)));
|
|
268
283
|
} else {
|
|
269
|
-
return
|
|
284
|
+
return compileExpression(constant(true));
|
|
270
285
|
}
|
|
271
286
|
};
|
|
272
287
|
|
|
273
288
|
export const ifUnitEditable = function (
|
|
274
289
|
oPropertyPath: PropertyOrPath<Property>,
|
|
275
|
-
sEditableValue:
|
|
276
|
-
sNonEditableValue:
|
|
277
|
-
):
|
|
290
|
+
sEditableValue: BindingToolkitExpression<string> | string,
|
|
291
|
+
sNonEditableValue: BindingToolkitExpression<string> | string
|
|
292
|
+
): CompiledBindingToolkitExpression {
|
|
278
293
|
const oProperty = (isPathExpression(oPropertyPath) && oPropertyPath.$target) || (oPropertyPath as Property);
|
|
279
294
|
const unitProperty = getAssociatedCurrencyProperty(oProperty) || getAssociatedUnitProperty(oProperty);
|
|
280
295
|
if (!unitProperty) {
|
|
281
|
-
return
|
|
296
|
+
return compileExpression(sNonEditableValue);
|
|
282
297
|
}
|
|
283
298
|
const editableExpression = and(not(isReadOnlyExpression(unitProperty)), not(isComputed(unitProperty)));
|
|
284
|
-
return
|
|
299
|
+
return compileExpression(ifElse(editableExpression, sEditableValue, sNonEditableValue));
|
|
285
300
|
};
|
|
286
301
|
|
|
287
302
|
export const getFieldDisplay = function (
|
|
288
303
|
oPropertyPath: PropertyOrPath<Property>,
|
|
289
304
|
sTargetDisplayMode: string,
|
|
290
|
-
oComputedEditMode:
|
|
291
|
-
):
|
|
305
|
+
oComputedEditMode: BindingToolkitExpression<string>
|
|
306
|
+
): CompiledBindingToolkitExpression {
|
|
292
307
|
const oProperty = (isPathExpression(oPropertyPath) && oPropertyPath.$target) || (oPropertyPath as Property);
|
|
293
308
|
|
|
294
309
|
return hasValueHelp(oProperty)
|
|
295
|
-
?
|
|
296
|
-
:
|
|
310
|
+
? compileExpression(sTargetDisplayMode)
|
|
311
|
+
: compileExpression(ifElse(equal(oComputedEditMode, "Editable"), "Value", sTargetDisplayMode));
|
|
297
312
|
};
|
|
298
313
|
|
|
299
314
|
export const formatWithTypeInformation = function (
|
|
300
315
|
oProperty: Property,
|
|
301
|
-
propertyBindingExpression:
|
|
316
|
+
propertyBindingExpression: BindingToolkitExpression<string>,
|
|
302
317
|
ignoreConstraints?: boolean
|
|
303
|
-
):
|
|
304
|
-
const outExpression:
|
|
318
|
+
): BindingToolkitExpression<string> {
|
|
319
|
+
const outExpression: PathInModelExpression<any> = propertyBindingExpression as PathInModelExpression<any>;
|
|
305
320
|
if (oProperty._type === "Property") {
|
|
306
|
-
const oTargetMapping = EDM_TYPE_MAPPING[
|
|
321
|
+
const oTargetMapping = EDM_TYPE_MAPPING[oProperty.type];
|
|
307
322
|
if (oTargetMapping) {
|
|
308
323
|
outExpression.type = oTargetMapping.type;
|
|
309
324
|
if (oTargetMapping.constraints && !ignoreConstraints) {
|
|
@@ -403,7 +418,7 @@ export const getTypeConfig = function (oProperty: Property | DataFieldAbstractTy
|
|
|
403
418
|
isDigitSequence:
|
|
404
419
|
propertyTypeConfig.type === "sap.ui.model.odata.type.String" &&
|
|
405
420
|
oTargetMapping.constraints?.["@com.sap.vocabularies.Common.v1.IsDigitSequence"] &&
|
|
406
|
-
|
|
421
|
+
oProperty.annotations?.Common?.IsDigitSequence
|
|
407
422
|
? true
|
|
408
423
|
: undefined,
|
|
409
424
|
V4: oTargetMapping.constraints?.$V4 ? true : undefined
|
|
@@ -427,9 +442,10 @@ export const getTypeConfig = function (oProperty: Property | DataFieldAbstractTy
|
|
|
427
442
|
|
|
428
443
|
export const getBindingWithUnitOrCurrency = function (
|
|
429
444
|
oPropertyDataModelPath: DataModelObjectPath,
|
|
430
|
-
propertyBindingExpression:
|
|
431
|
-
ignoreUnitConstraint?: boolean
|
|
432
|
-
|
|
445
|
+
propertyBindingExpression: BindingToolkitExpression<string>,
|
|
446
|
+
ignoreUnitConstraint?: boolean,
|
|
447
|
+
formatOptions?: any
|
|
448
|
+
): BindingToolkitExpression<string> {
|
|
433
449
|
const oPropertyDefinition = oPropertyDataModelPath.targetObject as Property;
|
|
434
450
|
let unit = oPropertyDefinition.annotations?.Measures?.Unit;
|
|
435
451
|
const relativeLocation = getPathRelativeLocation(
|
|
@@ -445,20 +461,53 @@ export const getBindingWithUnitOrCurrency = function (
|
|
|
445
461
|
const unitBindingExpression = (unit as any).$target
|
|
446
462
|
? formatWithTypeInformation(
|
|
447
463
|
(unit as any).$target,
|
|
448
|
-
|
|
464
|
+
getExpressionFromAnnotation(unit, relativeLocation) as BindingToolkitExpression<string>,
|
|
449
465
|
ignoreUnitConstraint
|
|
450
466
|
)
|
|
451
|
-
: (
|
|
467
|
+
: (getExpressionFromAnnotation(unit, relativeLocation) as BindingToolkitExpression<string>);
|
|
452
468
|
|
|
453
|
-
return addTypeInformation([propertyBindingExpression, unitBindingExpression], complexType);
|
|
469
|
+
return addTypeInformation([propertyBindingExpression, unitBindingExpression], complexType, undefined, formatOptions);
|
|
454
470
|
};
|
|
455
471
|
|
|
472
|
+
export const getBindingForUnitOrCurrency = function (
|
|
473
|
+
oPropertyDataModelPath: DataModelObjectPath
|
|
474
|
+
): BindingToolkitExpression<string> | string {
|
|
475
|
+
const oPropertyDefinition = oPropertyDataModelPath.targetObject as Property;
|
|
476
|
+
|
|
477
|
+
let unit = oPropertyDefinition.annotations?.Measures?.Unit;
|
|
478
|
+
if (unit?.toString() === "%") {
|
|
479
|
+
return constant("%");
|
|
480
|
+
}
|
|
481
|
+
const relativeLocation = getPathRelativeLocation(
|
|
482
|
+
oPropertyDataModelPath.contextLocation,
|
|
483
|
+
oPropertyDataModelPath.navigationProperties
|
|
484
|
+
).map((np) => np.name);
|
|
485
|
+
|
|
486
|
+
const complexType = unit ? "sap.ui.model.odata.type.Unit" : "sap.ui.model.odata.type.Currency";
|
|
487
|
+
unit = unit ? unit : oPropertyDefinition.annotations?.Measures?.ISOCurrency;
|
|
488
|
+
const unitBindingExpression = (unit as any).$target
|
|
489
|
+
? formatWithTypeInformation(
|
|
490
|
+
(unit as any).$target,
|
|
491
|
+
getExpressionFromAnnotation(unit, relativeLocation) as BindingToolkitExpression<string>
|
|
492
|
+
)
|
|
493
|
+
: (getExpressionFromAnnotation(unit, relativeLocation) as BindingToolkitExpression<string>);
|
|
494
|
+
|
|
495
|
+
let propertyBindingExpression = pathInModel(
|
|
496
|
+
getContextRelativeTargetObjectPath(oPropertyDataModelPath)
|
|
497
|
+
) as BindingToolkitExpression<string>;
|
|
498
|
+
propertyBindingExpression = formatWithTypeInformation(oPropertyDefinition, propertyBindingExpression, true);
|
|
499
|
+
return addTypeInformation([propertyBindingExpression, unitBindingExpression], complexType, undefined, {
|
|
500
|
+
parseKeepsEmptyString: true,
|
|
501
|
+
emptyString: "",
|
|
502
|
+
showNumber: false
|
|
503
|
+
});
|
|
504
|
+
};
|
|
456
505
|
export const getBindingWithTimezone = function (
|
|
457
506
|
oPropertyDataModelPath: DataModelObjectPath,
|
|
458
|
-
propertyBindingExpression:
|
|
507
|
+
propertyBindingExpression: BindingToolkitExpression<string>,
|
|
459
508
|
ignoreUnitConstraint?: boolean,
|
|
460
509
|
hideTimezoneForEmptyValues?: boolean
|
|
461
|
-
):
|
|
510
|
+
): BindingToolkitExpression<string> {
|
|
462
511
|
const oPropertyDefinition = oPropertyDataModelPath.targetObject as Property;
|
|
463
512
|
const timezone = oPropertyDefinition.annotations?.Common?.Timezone;
|
|
464
513
|
const relativeLocation = getPathRelativeLocation(
|
|
@@ -471,10 +520,10 @@ export const getBindingWithTimezone = function (
|
|
|
471
520
|
const unitBindingExpression = (timezone as any).$target
|
|
472
521
|
? formatWithTypeInformation(
|
|
473
522
|
(timezone as any).$target,
|
|
474
|
-
|
|
523
|
+
getExpressionFromAnnotation(timezone, relativeLocation) as BindingToolkitExpression<string>,
|
|
475
524
|
ignoreUnitConstraint
|
|
476
525
|
)
|
|
477
|
-
: (
|
|
526
|
+
: (getExpressionFromAnnotation(timezone, relativeLocation) as BindingToolkitExpression<string>);
|
|
478
527
|
let formatOptions;
|
|
479
528
|
if (hideTimezoneForEmptyValues) {
|
|
480
529
|
formatOptions = {
|
|
@@ -485,19 +534,19 @@ export const getBindingWithTimezone = function (
|
|
|
485
534
|
};
|
|
486
535
|
|
|
487
536
|
export const getAlignmentExpression = function (
|
|
488
|
-
oComputedEditMode:
|
|
537
|
+
oComputedEditMode: BindingToolkitExpression<string>,
|
|
489
538
|
sAlignDisplay: string = "Begin",
|
|
490
539
|
sAlignEdit: string = "Begin"
|
|
491
|
-
):
|
|
492
|
-
return
|
|
540
|
+
): CompiledBindingToolkitExpression | BindingToolkitExpression<string> {
|
|
541
|
+
return compileExpression(ifElse(equal(oComputedEditMode, "Display"), sAlignDisplay, sAlignEdit));
|
|
493
542
|
};
|
|
494
543
|
|
|
495
544
|
/**
|
|
496
545
|
* Formatter helper to retrieve the converterContext from the metamodel context.
|
|
497
546
|
*
|
|
498
|
-
* @param
|
|
499
|
-
* @param
|
|
500
|
-
* @returns
|
|
547
|
+
* @param oContext The original metamodel context
|
|
548
|
+
* @param oInterface The current templating context
|
|
549
|
+
* @returns The ConverterContext representing that object
|
|
501
550
|
*/
|
|
502
551
|
export const getConverterContext = function (oContext: MetaModelContext, oInterface: ComputedAnnotationInterface): object | null {
|
|
503
552
|
if (oInterface && oInterface.context) {
|
|
@@ -510,9 +559,9 @@ getConverterContext.requiresIContext = true;
|
|
|
510
559
|
/**
|
|
511
560
|
* Formatter helper to retrieve the data model objects that are involved from the metamodel context.
|
|
512
561
|
*
|
|
513
|
-
* @param
|
|
514
|
-
* @param
|
|
515
|
-
* @returns
|
|
562
|
+
* @param oContext The original ODataMetaModel context
|
|
563
|
+
* @param oInterface The current templating context
|
|
564
|
+
* @returns An array of entitysets and navproperties that are involved to get to a specific object in the metamodel
|
|
516
565
|
*/
|
|
517
566
|
export const getDataModelObjectPath = function (
|
|
518
567
|
oContext: MetaModelContext,
|
|
@@ -525,16 +574,6 @@ export const getDataModelObjectPath = function (
|
|
|
525
574
|
};
|
|
526
575
|
getDataModelObjectPath.requiresIContext = true;
|
|
527
576
|
|
|
528
|
-
/**
|
|
529
|
-
* Retrieves the expressionBinding created out of a binding expression.
|
|
530
|
-
*
|
|
531
|
-
* @param {Expression<any>} expression The expression which needs to be compiled
|
|
532
|
-
* @returns {BindingExpression<string>} The expression-binding string
|
|
533
|
-
*/
|
|
534
|
-
export const getExpressionBinding = function (expression: Expression<any>): BindingExpression<string> {
|
|
535
|
-
return compileBinding(expression);
|
|
536
|
-
};
|
|
537
|
-
|
|
538
577
|
export const isCollectionField = function (oDataModelPath: DataModelObjectPath): boolean {
|
|
539
578
|
if (oDataModelPath.navigationProperties?.length) {
|
|
540
579
|
const hasOneToManyNavigation =
|
|
@@ -558,39 +597,71 @@ export const isCollectionField = function (oDataModelPath: DataModelObjectPath):
|
|
|
558
597
|
}
|
|
559
598
|
return false;
|
|
560
599
|
};
|
|
561
|
-
|
|
600
|
+
export const getRequiredExpressionAsObject = function (
|
|
601
|
+
oPropertyPath: PropertyOrPath<Property>,
|
|
602
|
+
oDataFieldConverted?: any,
|
|
603
|
+
forceEditMode: boolean = false
|
|
604
|
+
): BindingToolkitExpression<boolean> {
|
|
605
|
+
return getRequiredExpression(oPropertyPath, oDataFieldConverted, forceEditMode, true) as BindingToolkitExpression<boolean>;
|
|
606
|
+
};
|
|
562
607
|
export const getRequiredExpression = function (
|
|
563
608
|
oPropertyPath: PropertyOrPath<Property>,
|
|
564
609
|
oDataFieldConverted?: any,
|
|
565
610
|
forceEditMode: boolean = false,
|
|
566
|
-
bAsObject: boolean = false
|
|
567
|
-
|
|
611
|
+
bAsObject: boolean = false,
|
|
612
|
+
oRequiredProperties: any = {}
|
|
613
|
+
): CompiledBindingToolkitExpression | BindingToolkitExpression<boolean> {
|
|
614
|
+
let returnExpression: BindingToolkitExpression<boolean>;
|
|
615
|
+
const aRequiredPropertiesFromInsertRestrictions = oRequiredProperties.requiredPropertiesFromInsertRestrictions || [];
|
|
616
|
+
const aRequiredPropertiesFromUpdateRestrictions = oRequiredProperties.requiredPropertiesFromUpdateRestrictions || [];
|
|
568
617
|
if (!oPropertyPath || typeof oPropertyPath === "string") {
|
|
569
|
-
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
618
|
+
returnExpression = constant(false);
|
|
619
|
+
} else {
|
|
620
|
+
let dataFieldRequiredExpression: BindingToolkitExpression<boolean> = constant(true);
|
|
621
|
+
if (oDataFieldConverted !== null) {
|
|
622
|
+
dataFieldRequiredExpression = isRequiredExpression(oDataFieldConverted);
|
|
623
|
+
}
|
|
624
|
+
let requiredPropertyFromInsertRestrictionsExpression: BindingToolkitExpression<boolean> = constant(false);
|
|
625
|
+
let requiredPropertyFromUpdateRestrictionsExpression: BindingToolkitExpression<boolean> = constant(false);
|
|
626
|
+
|
|
627
|
+
const oProperty: Property = (isPathExpression(oPropertyPath) && oPropertyPath.$target) || (oPropertyPath as Property);
|
|
628
|
+
// Enablement depends on the field control expression
|
|
629
|
+
// If the Field control is statically in Inapplicable (disabled) -> not enabled
|
|
630
|
+
const requiredExpression = isRequiredExpression(oProperty);
|
|
631
|
+
const editMode = forceEditMode || UI.IsEditable;
|
|
632
|
+
if (
|
|
633
|
+
aRequiredPropertiesFromInsertRestrictions.length &&
|
|
634
|
+
aRequiredPropertiesFromInsertRestrictions.includes((oPropertyPath as any).name)
|
|
635
|
+
) {
|
|
636
|
+
requiredPropertyFromInsertRestrictionsExpression = and(constant(true), UI.IsCreateMode);
|
|
637
|
+
}
|
|
638
|
+
if (
|
|
639
|
+
aRequiredPropertiesFromUpdateRestrictions.length &&
|
|
640
|
+
aRequiredPropertiesFromUpdateRestrictions.includes((oPropertyPath as any).name)
|
|
641
|
+
) {
|
|
642
|
+
requiredPropertyFromUpdateRestrictionsExpression = and(constant(true), notEqual(UI.IsCreateMode, true));
|
|
643
|
+
}
|
|
644
|
+
returnExpression = or(
|
|
645
|
+
and(or(requiredExpression, dataFieldRequiredExpression), editMode),
|
|
646
|
+
requiredPropertyFromInsertRestrictionsExpression,
|
|
647
|
+
requiredPropertyFromUpdateRestrictionsExpression
|
|
648
|
+
);
|
|
575
649
|
}
|
|
576
650
|
|
|
577
|
-
const oProperty: Property = (isPathExpression(oPropertyPath) && oPropertyPath.$target) || (oPropertyPath as Property);
|
|
578
|
-
// Enablement depends on the field control expression
|
|
579
|
-
// If the Field control is statically in Inapplicable (disabled) -> not enabled
|
|
580
|
-
const requiredExpression = isRequiredExpression(oProperty);
|
|
581
|
-
const editMode = forceEditMode || UI.IsEditable;
|
|
582
651
|
if (bAsObject) {
|
|
583
|
-
return
|
|
652
|
+
return returnExpression;
|
|
584
653
|
}
|
|
585
|
-
return
|
|
654
|
+
return compileExpression(returnExpression);
|
|
586
655
|
};
|
|
587
656
|
|
|
588
|
-
export const getRequiredExpressionForConnectedDataField = function (
|
|
657
|
+
export const getRequiredExpressionForConnectedDataField = function (
|
|
658
|
+
dataFieldObjectPath: DataModelObjectPath
|
|
659
|
+
): CompiledBindingToolkitExpression {
|
|
589
660
|
const data = dataFieldObjectPath?.targetObject?.$target?.Data;
|
|
590
661
|
const keys: Array<string> = Object.keys(data);
|
|
591
662
|
const dataFields = [];
|
|
592
663
|
let propertyPath;
|
|
593
|
-
const isRequiredExpressions: (
|
|
664
|
+
const isRequiredExpressions: (CompiledBindingToolkitExpression | BindingToolkitExpression<boolean>)[] | undefined = [];
|
|
594
665
|
for (const key of keys) {
|
|
595
666
|
if (data[key]["$Type"] && data[key]["$Type"].indexOf("DataField") > -1) {
|
|
596
667
|
dataFields.push(data[key]);
|
|
@@ -624,8 +695,9 @@ export const getRequiredExpressionForConnectedDataField = function (dataFieldObj
|
|
|
624
695
|
}
|
|
625
696
|
}
|
|
626
697
|
break;
|
|
698
|
+
// no default
|
|
627
699
|
}
|
|
628
|
-
isRequiredExpressions.push(
|
|
700
|
+
isRequiredExpressions.push(getRequiredExpressionAsObject(propertyPath, dataField, false));
|
|
629
701
|
}
|
|
630
|
-
return
|
|
702
|
+
return compileExpression(or(...(isRequiredExpressions as BindingToolkitExpression<boolean>[])));
|
|
631
703
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* SAP UI development toolkit for HTML5 (SAPUI5)
|
|
3
3
|
* (c) Copyright 2009-2021 SAP SE. All rights reserved
|
|
4
4
|
*/
|
|
5
|
-
sap.ui.define(["sap/ui/core/Core", "sap/ui/model/odata/type/String", "sap/ui/model/ValidateException"
|
|
5
|
+
sap.ui.define(["sap/fe/core/helpers/ClassSupport", "sap/ui/core/Core", "sap/ui/model/odata/type/String", "sap/ui/model/ValidateException"], function (ClassSupport, Core, ODataStringType, ValidateException) {
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
8
|
var _dec, _class;
|
|
@@ -35,4 +35,4 @@ sap.ui.define(["sap/ui/core/Core", "sap/ui/model/odata/type/String", "sap/ui/mod
|
|
|
35
35
|
}(ODataStringType)) || _class);
|
|
36
36
|
return EmailType;
|
|
37
37
|
}, false);
|
|
38
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
38
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkVtYWlsLnRzIl0sIm5hbWVzIjpbImVtYWlsVzNDUmVnZXhwIiwiRW1haWxUeXBlIiwiZGVmaW5lVUk1Q2xhc3MiLCJ2YWxpZGF0ZVZhbHVlIiwic1ZhbHVlIiwidGVzdCIsIlZhbGlkYXRlRXhjZXB0aW9uIiwiQ29yZSIsImdldExpYnJhcnlSZXNvdXJjZUJ1bmRsZSIsImdldFRleHQiLCJPRGF0YVN0cmluZ1R5cGUiXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7Ozs7Ozs7Ozs7OztBQUlBLE1BQU1BLGNBQWMsR0FBRyxxRUFBdkI7TUFFTUMsUyxXQURMQyxjQUFjLENBQUMsd0JBQUQsQzs7Ozs7Ozs7O1dBRWRDLGEsR0FBQSx1QkFBY0MsTUFBZCxFQUE4QjtBQUM3QixVQUFJLENBQUNKLGNBQWMsQ0FBQ0ssSUFBZixDQUFvQkQsTUFBcEIsQ0FBTCxFQUFrQztBQUNqQyxjQUFNLElBQUlFLGlCQUFKLENBQXVCQyxJQUFELENBQWlCQyx3QkFBakIsQ0FBMEMsYUFBMUMsRUFBeURDLE9BQXpELENBQWlFLDJCQUFqRSxDQUF0QixDQUFOO0FBQ0E7O0FBQ0QsaUNBQU1OLGFBQU4sWUFBb0JDLE1BQXBCO0FBQ0EsSzs7O0lBTnNCTSxlO1NBUVRULFMiLCJzb3VyY2VSb290IjoiLiIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGRlZmluZVVJNUNsYXNzIH0gZnJvbSBcInNhcC9mZS9jb3JlL2hlbHBlcnMvQ2xhc3NTdXBwb3J0XCI7XG5pbXBvcnQgQ29yZSBmcm9tIFwic2FwL3VpL2NvcmUvQ29yZVwiO1xuaW1wb3J0IE9EYXRhU3RyaW5nVHlwZSBmcm9tIFwic2FwL3VpL21vZGVsL29kYXRhL3R5cGUvU3RyaW5nXCI7XG5pbXBvcnQgVmFsaWRhdGVFeGNlcHRpb24gZnJvbSBcInNhcC91aS9tb2RlbC9WYWxpZGF0ZUV4Y2VwdGlvblwiO1xuaW1wb3J0IHR5cGUgeyBDb3JlRXggfSBmcm9tIFwidHlwZXMvZXh0ZW5zaW9uX3R5cGVzXCI7XG5cbmNvbnN0IGVtYWlsVzNDUmVnZXhwID0gL15bYS16QS1aMC05LiEjJCUm4oCZKisvPT9eX2B7fH1+LV0rQFthLXpBLVowLTktXSsoPzouW2EtekEtWjAtOS1dKykqJC87XG5AZGVmaW5lVUk1Q2xhc3MoXCJzYXAuZmUuY29yZS50eXBlLkVtYWlsXCIpXG5jbGFzcyBFbWFpbFR5cGUgZXh0ZW5kcyBPRGF0YVN0cmluZ1R5cGUge1xuXHR2YWxpZGF0ZVZhbHVlKHNWYWx1ZTogc3RyaW5nKSB7XG5cdFx0aWYgKCFlbWFpbFczQ1JlZ2V4cC50ZXN0KHNWYWx1ZSkpIHtcblx0XHRcdHRocm93IG5ldyBWYWxpZGF0ZUV4Y2VwdGlvbigoQ29yZSBhcyBDb3JlRXgpLmdldExpYnJhcnlSZXNvdXJjZUJ1bmRsZShcInNhcC5mZS5jb3JlXCIpLmdldFRleHQoXCJUX0VNQUlMVFlQRV9JTlZBTElEX1ZBTFVFXCIpKTtcblx0XHR9XG5cdFx0c3VwZXIudmFsaWRhdGVWYWx1ZShzVmFsdWUpO1xuXHR9XG59XG5leHBvcnQgZGVmYXVsdCBFbWFpbFR5cGU7XG4iXX0=
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { defineUI5Class } from "sap/fe/core/helpers/ClassSupport";
|
|
1
2
|
import Core from "sap/ui/core/Core";
|
|
2
3
|
import ODataStringType from "sap/ui/model/odata/type/String";
|
|
3
|
-
import { CoreEx } from "types/extension_types";
|
|
4
4
|
import ValidateException from "sap/ui/model/ValidateException";
|
|
5
|
-
import {
|
|
5
|
+
import type { CoreEx } from "types/extension_types";
|
|
6
6
|
|
|
7
7
|
const emailW3CRegexp = /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:.[a-zA-Z0-9-]+)*$/;
|
|
8
8
|
@defineUI5Class("sap.fe.core.type.Email")
|