@sapui5/sap.fe.core 1.97.0 → 1.100.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 +7 -4
- package/src/sap/fe/core/.library +1 -1
- package/src/sap/fe/core/AnnotationHelper.js +309 -405
- package/src/sap/fe/core/AnnotationHelper.ts +315 -0
- package/src/sap/fe/core/AppComponent.js +389 -397
- package/src/sap/fe/core/AppComponent.ts +403 -0
- package/src/sap/fe/core/AppStateHandler.js +198 -181
- package/src/sap/fe/core/AppStateHandler.ts +171 -0
- package/src/sap/fe/core/BaseController.js +83 -58
- package/src/sap/fe/core/BaseController.ts +68 -0
- package/src/sap/fe/core/BusyLocker.js +105 -121
- package/src/sap/fe/core/BusyLocker.ts +98 -0
- package/src/sap/fe/core/CommonUtils.js +2164 -2379
- package/src/sap/fe/core/CommonUtils.ts +2177 -0
- package/src/sap/fe/core/ExtensionAPI.js +279 -266
- package/src/sap/fe/core/ExtensionAPI.ts +250 -0
- package/src/sap/fe/core/PageController.js +218 -125
- package/src/sap/fe/core/PageController.ts +129 -0
- package/src/sap/fe/core/RouterProxy.js +924 -807
- package/src/sap/fe/core/RouterProxy.ts +840 -0
- package/src/sap/fe/core/Synchronization.js +41 -35
- package/src/sap/fe/core/Synchronization.ts +29 -0
- package/src/sap/fe/core/TemplateComponent.js +173 -155
- package/src/sap/fe/core/TemplateComponent.ts +173 -0
- package/src/sap/fe/core/TemplateModel.js +79 -54
- package/src/sap/fe/core/TemplateModel.ts +63 -0
- package/src/sap/fe/core/TransactionHelper.js +1560 -1579
- package/src/sap/fe/core/TransactionHelper.ts +1717 -0
- package/src/sap/fe/core/actions/collaboration/ActivitySync.js +392 -0
- package/src/sap/fe/core/actions/collaboration/ActivitySync.ts +355 -0
- package/src/sap/fe/core/actions/collaboration/CollaborationCommon.js +136 -0
- package/src/sap/fe/core/actions/collaboration/CollaborationCommon.ts +119 -0
- package/src/sap/fe/core/actions/collaboration/Manage.js +262 -0
- package/src/sap/fe/core/actions/collaboration/Manage.ts +244 -0
- package/src/sap/fe/core/actions/collaboration/ManageDialog.fragment.xml +103 -0
- package/src/sap/fe/core/actions/collaboration/UserDetails.fragment.xml +13 -0
- package/src/sap/fe/core/actions/draft.js +521 -581
- package/src/sap/fe/core/actions/draft.ts +566 -0
- package/src/sap/fe/core/actions/messageHandling.js +564 -511
- package/src/sap/fe/core/actions/messageHandling.ts +552 -0
- package/src/sap/fe/core/actions/nonDraft.js +17 -19
- package/src/sap/fe/core/actions/nonDraft.ts +12 -0
- package/src/sap/fe/core/actions/operations.js +1093 -1211
- package/src/sap/fe/core/actions/operations.ts +1192 -0
- package/src/sap/fe/core/actions/sticky.js +114 -104
- package/src/sap/fe/core/actions/sticky.ts +119 -0
- package/src/sap/fe/core/controllerextensions/ControllerExtensionMetadata.js +70 -66
- package/src/sap/fe/core/controllerextensions/ControllerExtensionMetadata.ts +65 -0
- package/src/sap/fe/core/controllerextensions/EditFlow.js +1594 -1701
- package/src/sap/fe/core/controllerextensions/EditFlow.ts +1672 -0
- package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.js +80 -54
- package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.ts +61 -0
- package/src/sap/fe/core/controllerextensions/InternalEditFlow.js +719 -505
- package/src/sap/fe/core/controllerextensions/InternalEditFlow.ts +783 -0
- package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.js +797 -813
- package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.ts +803 -0
- package/src/sap/fe/core/controllerextensions/InternalRouting.js +1005 -973
- package/src/sap/fe/core/controllerextensions/InternalRouting.ts +978 -0
- package/src/sap/fe/core/controllerextensions/KPIManagement.js +530 -476
- package/src/sap/fe/core/controllerextensions/KPIManagement.ts +137 -46
- package/src/sap/fe/core/controllerextensions/MassEdit.js +144 -0
- package/src/sap/fe/core/controllerextensions/MassEdit.ts +156 -0
- package/src/sap/fe/core/controllerextensions/MessageHandler.js +234 -232
- package/src/sap/fe/core/controllerextensions/MessageHandler.ts +225 -0
- package/src/sap/fe/core/controllerextensions/PageReady.js +302 -337
- package/src/sap/fe/core/controllerextensions/PageReady.ts +23 -17
- package/src/sap/fe/core/controllerextensions/Paginator.js +189 -148
- package/src/sap/fe/core/controllerextensions/Paginator.ts +163 -0
- package/src/sap/fe/core/controllerextensions/Placeholder.js +158 -146
- package/src/sap/fe/core/controllerextensions/Placeholder.ts +151 -0
- package/src/sap/fe/core/controllerextensions/Routing.js +145 -106
- package/src/sap/fe/core/controllerextensions/Routing.ts +132 -0
- package/src/sap/fe/core/controllerextensions/RoutingListener.js +8 -6
- package/src/sap/fe/core/controllerextensions/RoutingListener.ts +3 -0
- package/src/sap/fe/core/controllerextensions/Share.js +220 -244
- package/src/sap/fe/core/controllerextensions/Share.ts +231 -0
- package/src/sap/fe/core/controllerextensions/SideEffects.js +593 -634
- package/src/sap/fe/core/controllerextensions/SideEffects.ts +29 -27
- package/src/sap/fe/core/controllerextensions/ViewState.js +789 -806
- package/src/sap/fe/core/controllerextensions/ViewState.ts +805 -0
- package/src/sap/fe/core/controls/ActionParameterDialog.fragment.xml +4 -3
- package/src/sap/fe/core/controls/ActionPartial.fragment.xml +2 -2
- package/src/sap/fe/core/controls/CommandExecution.js +68 -66
- package/src/sap/fe/core/controls/CommandExecution.ts +72 -0
- package/src/sap/fe/core/controls/ConditionalWrapper.js +91 -75
- package/src/sap/fe/core/controls/ConditionalWrapper.ts +83 -0
- package/src/sap/fe/core/controls/CustomQuickViewPage.js +131 -125
- package/src/sap/fe/core/controls/CustomQuickViewPage.ts +126 -0
- package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.js +105 -110
- package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.ts +101 -0
- package/src/sap/fe/core/controls/FieldWrapper.js +122 -140
- package/src/sap/fe/core/controls/FieldWrapper.ts +115 -0
- package/src/sap/fe/core/controls/FilterBar.js +163 -159
- package/src/sap/fe/core/controls/FilterBar.ts +143 -0
- package/src/sap/fe/core/controls/FormElementWrapper.js +46 -44
- package/src/sap/fe/core/controls/FormElementWrapper.ts +40 -0
- package/src/sap/fe/core/controls/MultiValueParameterDelegate.js +38 -42
- package/src/sap/fe/core/controls/MultiValueParameterDelegate.ts +31 -0
- package/src/sap/fe/core/controls/NonComputedVisibleKeyFieldsDialog.fragment.xml +2 -1
- package/src/sap/fe/core/controls/filterbar/FilterContainer.js +127 -116
- package/src/sap/fe/core/controls/filterbar/FilterContainer.ts +98 -0
- package/src/sap/fe/core/controls/filterbar/VisualFilter.js +242 -255
- package/src/sap/fe/core/controls/filterbar/VisualFilter.ts +245 -0
- package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.js +151 -141
- package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.ts +125 -0
- package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.js +336 -322
- package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.ts +337 -0
- package/src/sap/fe/core/controls/massEdit/MassEditDialog.fragment.xml +106 -0
- package/src/sap/fe/core/controls/massEdit/MassEditHandlers.js +79 -0
- package/src/sap/fe/core/controls/massEdit/MassEditHandlers.ts +70 -0
- package/src/sap/fe/core/converters/ConverterContext.js +348 -367
- package/src/sap/fe/core/converters/ConverterContext.ts +33 -19
- package/src/sap/fe/core/converters/ManifestSettings.js +12 -1
- package/src/sap/fe/core/converters/ManifestSettings.ts +16 -1
- package/src/sap/fe/core/converters/ManifestWrapper.js +354 -354
- package/src/sap/fe/core/converters/ManifestWrapper.ts +34 -6
- package/src/sap/fe/core/converters/MetaModelConverter.js +72 -9
- package/src/sap/fe/core/converters/MetaModelConverter.ts +75 -16
- package/src/sap/fe/core/converters/TemplateConverter.js +1 -1
- package/src/sap/fe/core/converters/TemplateConverter.ts +4 -3
- package/src/sap/fe/core/converters/annotations/DataField.js +28 -14
- package/src/sap/fe/core/converters/annotations/DataField.ts +38 -14
- package/src/sap/fe/core/converters/common/AnnotationConverter.js +33 -21
- package/src/sap/fe/core/converters/controls/Common/Action.js +11 -2
- package/src/sap/fe/core/converters/controls/Common/Action.ts +8 -2
- package/src/sap/fe/core/converters/controls/Common/Chart.js +5 -3
- package/src/sap/fe/core/converters/controls/Common/Chart.ts +11 -3
- package/src/sap/fe/core/converters/controls/Common/DataVisualization.js +3 -3
- package/src/sap/fe/core/converters/controls/Common/DataVisualization.ts +2 -2
- package/src/sap/fe/core/converters/controls/Common/Form.js +21 -11
- package/src/sap/fe/core/converters/controls/Common/Form.ts +28 -6
- package/src/sap/fe/core/converters/controls/Common/KPI.js +69 -4
- package/src/sap/fe/core/converters/controls/Common/KPI.ts +75 -2
- package/src/sap/fe/core/converters/controls/Common/Table.js +507 -408
- package/src/sap/fe/core/converters/controls/Common/Table.ts +618 -500
- package/src/sap/fe/core/converters/controls/Common/table/StandardActions.js +592 -0
- package/src/sap/fe/core/converters/controls/Common/table/StandardActions.ts +718 -0
- package/src/sap/fe/core/converters/controls/ListReport/FilterBar.js +465 -59
- package/src/sap/fe/core/converters/controls/ListReport/FilterBar.ts +462 -72
- package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.js +2 -2
- package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.ts +1 -1
- package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.js +17 -9
- package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.ts +24 -9
- package/src/sap/fe/core/converters/helpers/Aggregation.js +118 -121
- package/src/sap/fe/core/converters/helpers/Aggregation.ts +28 -5
- package/src/sap/fe/core/converters/helpers/BindingHelper.js +20 -6
- package/src/sap/fe/core/converters/helpers/BindingHelper.ts +16 -4
- package/src/sap/fe/core/converters/helpers/ConfigurableObject.js +12 -1
- package/src/sap/fe/core/converters/helpers/ConfigurableObject.ts +11 -0
- package/src/sap/fe/core/converters/helpers/IssueManager.js +7 -1
- package/src/sap/fe/core/converters/helpers/IssueManager.ts +6 -0
- package/src/sap/fe/core/converters/helpers/Key.js +42 -57
- package/src/sap/fe/core/converters/helpers/Key.ts +1 -1
- package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.js +28 -7
- package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.ts +23 -6
- package/src/sap/fe/core/converters/templates/ListReportConverter.js +20 -7
- package/src/sap/fe/core/converters/templates/ListReportConverter.ts +36 -14
- package/src/sap/fe/core/converters/templates/ObjectPageConverter.js +7 -5
- package/src/sap/fe/core/converters/templates/ObjectPageConverter.ts +5 -1
- package/src/sap/fe/core/designtime/AppComponent.designtime.js +93 -90
- package/src/sap/fe/core/designtime/AppComponent.designtime.ts +91 -0
- package/src/sap/fe/core/formatters/CollaborationFormatter.js +104 -0
- package/src/sap/fe/core/formatters/CollaborationFormatter.ts +60 -0
- package/src/sap/fe/core/formatters/CriticalityFormatter.js +1 -1
- package/src/sap/fe/core/formatters/CriticalityFormatter.ts +1 -1
- package/src/sap/fe/core/formatters/FPMFormatter.js +1 -1
- package/src/sap/fe/core/formatters/FPMFormatter.ts +4 -10
- package/src/sap/fe/core/formatters/KPIFormatter.js +1 -1
- package/src/sap/fe/core/formatters/KPIFormatter.ts +3 -1
- package/src/sap/fe/core/formatters/TableFormatter.js +91 -29
- package/src/sap/fe/core/formatters/TableFormatter.ts +94 -28
- package/src/sap/fe/core/formatters/ValueFormatter.js +30 -5
- package/src/sap/fe/core/formatters/ValueFormatter.ts +30 -7
- package/src/sap/fe/core/fpm/Component.js +51 -54
- package/src/sap/fe/core/fpm/Component.ts +48 -0
- package/src/sap/fe/core/helpers/AppStartupHelper.js +373 -0
- package/src/sap/fe/core/helpers/AppStartupHelper.ts +417 -0
- package/src/sap/fe/core/helpers/BindingExpression.js +489 -442
- package/src/sap/fe/core/helpers/BindingExpression.ts +486 -469
- package/src/sap/fe/core/helpers/ClassSupport.js +212 -76
- package/src/sap/fe/core/helpers/ClassSupport.ts +198 -71
- package/src/sap/fe/core/helpers/DynamicAnnotationPathHelper.js +64 -59
- package/src/sap/fe/core/helpers/DynamicAnnotationPathHelper.ts +52 -0
- package/src/sap/fe/core/helpers/EditState.js +81 -84
- package/src/sap/fe/core/helpers/EditState.ts +81 -0
- package/src/sap/fe/core/helpers/ExcelFormatHelper.js +62 -48
- package/src/sap/fe/core/helpers/ExcelFormatHelper.ts +49 -0
- package/src/sap/fe/core/helpers/FPMHelper.js +52 -56
- package/src/sap/fe/core/helpers/FPMHelper.ts +62 -0
- package/src/sap/fe/core/helpers/KeepAliveHelper.js +4 -5
- package/src/sap/fe/core/helpers/KeepAliveHelper.ts +10 -10
- package/src/sap/fe/core/helpers/MassEditHelper.js +604 -0
- package/src/sap/fe/core/helpers/MassEditHelper.ts +699 -0
- package/src/sap/fe/core/helpers/ModelHelper.js +253 -225
- package/src/sap/fe/core/helpers/ModelHelper.ts +250 -0
- package/src/sap/fe/core/helpers/PasteHelper.js +210 -132
- package/src/sap/fe/core/helpers/PasteHelper.ts +196 -0
- package/src/sap/fe/core/helpers/SemanticDateOperators.js +336 -313
- package/src/sap/fe/core/helpers/SemanticDateOperators.ts +334 -0
- package/src/sap/fe/core/helpers/SemanticKeyHelper.js +66 -67
- package/src/sap/fe/core/helpers/SemanticKeyHelper.ts +73 -0
- package/src/sap/fe/core/helpers/StableIdHelper.js +4 -7
- package/src/sap/fe/core/helpers/StableIdHelper.ts +2 -6
- package/src/sap/fe/core/jsx-runtime/jsx.js +1 -1
- package/src/sap/fe/core/jsx-runtime/jsx.ts +1 -1
- package/src/sap/fe/core/library.js +427 -425
- package/src/sap/fe/core/library.support.js +23 -27
- package/src/sap/fe/core/library.support.ts +23 -0
- package/src/sap/fe/core/library.ts +420 -0
- package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.js +64 -0
- package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.ts +69 -0
- package/src/sap/fe/core/messagebundle.properties +78 -13
- package/src/sap/fe/core/messagebundle_ar.properties +58 -7
- package/src/sap/fe/core/messagebundle_bg.properties +58 -7
- package/src/sap/fe/core/messagebundle_ca.properties +58 -7
- package/src/sap/fe/core/messagebundle_cs.properties +59 -8
- package/src/sap/fe/core/messagebundle_cy.properties +58 -7
- package/src/sap/fe/core/messagebundle_da.properties +58 -7
- package/src/sap/fe/core/messagebundle_de.properties +58 -7
- package/src/sap/fe/core/messagebundle_el.properties +58 -7
- package/src/sap/fe/core/messagebundle_en.properties +57 -6
- package/src/sap/fe/core/messagebundle_en_GB.properties +57 -6
- package/src/sap/fe/core/messagebundle_en_US_sappsd.properties +61 -6
- package/src/sap/fe/core/messagebundle_en_US_saprigi.properties +58 -7
- package/src/sap/fe/core/messagebundle_en_US_saptrc.properties +58 -7
- package/src/sap/fe/core/messagebundle_es.properties +58 -7
- package/src/sap/fe/core/messagebundle_es_MX.properties +58 -7
- package/src/sap/fe/core/messagebundle_et.properties +58 -7
- package/src/sap/fe/core/messagebundle_fi.properties +60 -9
- package/src/sap/fe/core/messagebundle_fr.properties +64 -13
- package/src/sap/fe/core/messagebundle_fr_CA.properties +59 -8
- package/src/sap/fe/core/messagebundle_hi.properties +58 -7
- package/src/sap/fe/core/messagebundle_hr.properties +58 -7
- package/src/sap/fe/core/messagebundle_hu.properties +59 -8
- package/src/sap/fe/core/messagebundle_id.properties +61 -10
- package/src/sap/fe/core/messagebundle_it.properties +58 -7
- package/src/sap/fe/core/messagebundle_iw.properties +58 -7
- package/src/sap/fe/core/messagebundle_ja.properties +58 -7
- package/src/sap/fe/core/messagebundle_kk.properties +58 -7
- package/src/sap/fe/core/messagebundle_ko.properties +58 -7
- package/src/sap/fe/core/messagebundle_lt.properties +58 -7
- package/src/sap/fe/core/messagebundle_lv.properties +59 -8
- package/src/sap/fe/core/messagebundle_ms.properties +58 -7
- package/src/sap/fe/core/messagebundle_nl.properties +58 -7
- package/src/sap/fe/core/messagebundle_no.properties +58 -7
- package/src/sap/fe/core/messagebundle_pl.properties +58 -7
- package/src/sap/fe/core/messagebundle_pt.properties +59 -8
- package/src/sap/fe/core/messagebundle_pt_PT.properties +58 -7
- package/src/sap/fe/core/messagebundle_ro.properties +58 -7
- package/src/sap/fe/core/messagebundle_ru.properties +58 -7
- package/src/sap/fe/core/messagebundle_sh.properties +58 -7
- package/src/sap/fe/core/messagebundle_sk.properties +58 -7
- package/src/sap/fe/core/messagebundle_sl.properties +58 -7
- package/src/sap/fe/core/messagebundle_sv.properties +59 -8
- package/src/sap/fe/core/messagebundle_th.properties +58 -7
- package/src/sap/fe/core/messagebundle_tr.properties +60 -9
- package/src/sap/fe/core/messagebundle_uk.properties +58 -7
- package/src/sap/fe/core/messagebundle_vi.properties +58 -7
- package/src/sap/fe/core/messagebundle_zh_CN.properties +58 -7
- package/src/sap/fe/core/messagebundle_zh_TW.properties +58 -7
- package/src/sap/fe/core/services/AsyncComponentServiceFactory.js +45 -71
- package/src/sap/fe/core/services/AsyncComponentServiceFactory.ts +3 -1
- package/src/sap/fe/core/services/CacheHandlerServiceFactory.js +231 -202
- package/src/sap/fe/core/services/CacheHandlerServiceFactory.ts +212 -0
- package/src/sap/fe/core/services/EnvironmentServiceFactory.js +67 -92
- package/src/sap/fe/core/services/EnvironmentServiceFactory.ts +10 -6
- package/src/sap/fe/core/services/NavigationServiceFactory.js +351 -300
- package/src/sap/fe/core/services/NavigationServiceFactory.ts +313 -0
- package/src/sap/fe/core/services/ResourceModelServiceFactory.js +114 -81
- package/src/sap/fe/core/services/ResourceModelServiceFactory.ts +83 -0
- package/src/sap/fe/core/services/RoutingServiceFactory.js +927 -1152
- package/src/sap/fe/core/services/RoutingServiceFactory.ts +898 -0
- package/src/sap/fe/core/services/ShellServicesFactory.js +649 -707
- package/src/sap/fe/core/services/ShellServicesFactory.ts +52 -15
- package/src/sap/fe/core/services/SideEffectsServiceFactory.js +569 -637
- package/src/sap/fe/core/services/SideEffectsServiceFactory.ts +78 -102
- package/src/sap/fe/core/services/TemplatedViewServiceFactory.js +429 -478
- package/src/sap/fe/core/services/TemplatedViewServiceFactory.ts +460 -0
- package/src/sap/fe/core/services/view/TemplatingErrorPage.controller.js +10 -8
- package/src/sap/fe/core/services/view/TemplatingErrorPage.controller.ts +8 -0
- package/src/sap/fe/core/support/AnnotationIssue.support.js +15 -3
- package/src/sap/fe/core/support/AnnotationIssue.support.ts +16 -2
- package/src/sap/fe/core/support/CollectionFacetUnsupportedLevel.support.js +2 -2
- package/src/sap/fe/core/support/CollectionFacetUnsupportedLevel.support.ts +1 -1
- package/src/sap/fe/core/support/CommonHelper.js +1 -1
- package/src/sap/fe/core/support/CommonHelper.ts +1 -1
- package/src/sap/fe/core/support/Diagnostics.js +36 -48
- package/src/sap/fe/core/support/InvalidAnnotationColumnKey.support.js +38 -0
- package/src/sap/fe/core/support/InvalidAnnotationColumnKey.support.ts +18 -0
- package/src/sap/fe/core/templating/DataModelPathHelper.js +97 -127
- package/src/sap/fe/core/templating/DataModelPathHelper.ts +112 -135
- package/src/sap/fe/core/templating/DisplayModeFormatter.js +114 -0
- package/src/sap/fe/core/templating/DisplayModeFormatter.ts +86 -0
- package/src/sap/fe/core/templating/FieldControlHelper.js +8 -8
- package/src/sap/fe/core/templating/FieldControlHelper.ts +25 -7
- package/src/sap/fe/core/templating/FilterHelper.js +140 -78
- package/src/sap/fe/core/templating/FilterHelper.ts +149 -78
- package/src/sap/fe/core/templating/PropertyHelper.js +3 -3
- package/src/sap/fe/core/templating/PropertyHelper.ts +2 -2
- package/src/sap/fe/core/templating/UIFormatters.js +76 -135
- package/src/sap/fe/core/templating/UIFormatters.ts +76 -99
- package/src/sap/fe/core/type/Email.js +1 -1
- package/src/sap/fe/core/type/Email.ts +4 -6
- package/ui5.yaml +0 -3
- package/src/sap/fe/core/controls/filterbar.d.js +0 -8
- package/src/sap/fe/core/controls/filterbar.d.ts +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { EntitySet, EntityType, NavigationProperty, Property } from "@sap-ux/annotation-converter";
|
|
2
|
-
import { annotationExpression, constant, equal, Expression } from "sap/fe/core/helpers/BindingExpression";
|
|
1
|
+
import { ConverterOutput, EntitySet, EntityType, NavigationProperty, Property } from "@sap-ux/annotation-converter";
|
|
2
|
+
import { annotationExpression, constant, equal, Expression, unresolveableExpression } from "sap/fe/core/helpers/BindingExpression";
|
|
3
3
|
import { NavigationPropertyRestrictionTypes } from "@sap-ux/vocabularies-types/dist/generated/Capabilities";
|
|
4
|
-
import { PropertyOrPath } from "sap/fe/core/templating/
|
|
4
|
+
import { PropertyOrPath } from "sap/fe/core/templating/DisplayModeFormatter";
|
|
5
5
|
import { isAnnotationPathExpression, isPathExpression } from "sap/fe/core/templating/PropertyHelper";
|
|
6
6
|
import {
|
|
7
7
|
FilterExpressionRestrictionTypeTypes,
|
|
@@ -20,6 +20,14 @@ export type DataModelObjectPath = {
|
|
|
20
20
|
targetEntitySet?: EntitySet;
|
|
21
21
|
targetEntityType: EntityType;
|
|
22
22
|
targetObject: any;
|
|
23
|
+
convertedTypes: ConverterOutput;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
type ExtractionParametersOnPath = {
|
|
27
|
+
propertyPath?: PropertyOrPath<Property>;
|
|
28
|
+
pathVisitor?: Function;
|
|
29
|
+
ignoreTargetCollection?: boolean;
|
|
30
|
+
authorizeUnresolvable?: boolean;
|
|
23
31
|
};
|
|
24
32
|
|
|
25
33
|
export const getPathRelativeLocation = function(
|
|
@@ -28,51 +36,49 @@ export const getPathRelativeLocation = function(
|
|
|
28
36
|
): NavigationProperty[] {
|
|
29
37
|
if (!contextPath) {
|
|
30
38
|
return visitedNavProps;
|
|
39
|
+
} else if (visitedNavProps.length >= contextPath.navigationProperties.length) {
|
|
40
|
+
let remainingNavProps: NavigationProperty[] = [];
|
|
41
|
+
contextPath.navigationProperties.forEach((navProp, navIndex) => {
|
|
42
|
+
if (visitedNavProps[navIndex] !== navProp) {
|
|
43
|
+
remainingNavProps.push(visitedNavProps[navIndex]);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
remainingNavProps = remainingNavProps.concat(visitedNavProps.slice(contextPath.navigationProperties.length));
|
|
47
|
+
// Clean up NavProp -> Owner
|
|
48
|
+
let currentIdx = 0;
|
|
49
|
+
while (remainingNavProps.length > 1 && currentIdx != remainingNavProps.length - 1) {
|
|
50
|
+
const currentNav = remainingNavProps[currentIdx];
|
|
51
|
+
const nextNavProp = remainingNavProps[currentIdx + 1];
|
|
52
|
+
if (currentNav.partner === nextNavProp.name) {
|
|
53
|
+
remainingNavProps.splice(0, 2);
|
|
54
|
+
} else {
|
|
55
|
+
currentIdx++;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return remainingNavProps;
|
|
31
59
|
} else {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
contextPath.navigationProperties
|
|
35
|
-
|
|
36
|
-
remainingNavProps.push(visitedNavProps[navIndex]);
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
remainingNavProps = remainingNavProps.concat(visitedNavProps.slice(contextPath.navigationProperties.length));
|
|
40
|
-
// Clean up NavProp -> Owner
|
|
41
|
-
let currentIdx = 0;
|
|
42
|
-
while (remainingNavProps.length > 1 && currentIdx != remainingNavProps.length - 1) {
|
|
43
|
-
const currentNav = remainingNavProps[currentIdx];
|
|
44
|
-
const nextNavProp = remainingNavProps[currentIdx + 1];
|
|
45
|
-
if (currentNav.partner === nextNavProp.name) {
|
|
46
|
-
remainingNavProps.splice(0, 2);
|
|
47
|
-
} else {
|
|
48
|
-
currentIdx++;
|
|
49
|
-
}
|
|
60
|
+
let extraNavProp: NavigationProperty[] = [];
|
|
61
|
+
visitedNavProps.forEach((navProp, navIndex) => {
|
|
62
|
+
if (contextPath.navigationProperties[navIndex] !== navProp) {
|
|
63
|
+
extraNavProp.push(visitedNavProps[navIndex]);
|
|
50
64
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
while (extraNavProp.length > 1 && currentIdx != extraNavProp.length - 1) {
|
|
63
|
-
const currentNav = extraNavProp[currentIdx];
|
|
64
|
-
const nextNavProp = extraNavProp[currentIdx + 1];
|
|
65
|
-
if (currentNav.partner === nextNavProp.name) {
|
|
66
|
-
extraNavProp.splice(0, 2);
|
|
67
|
-
} else {
|
|
68
|
-
currentIdx++;
|
|
69
|
-
}
|
|
65
|
+
});
|
|
66
|
+
extraNavProp = extraNavProp.concat(contextPath.navigationProperties.slice(visitedNavProps.length));
|
|
67
|
+
// Clean up NavProp -> Owner
|
|
68
|
+
let currentIdx = 0;
|
|
69
|
+
while (extraNavProp.length > 1 && currentIdx != extraNavProp.length - 1) {
|
|
70
|
+
const currentNav = extraNavProp[currentIdx];
|
|
71
|
+
const nextNavProp = extraNavProp[currentIdx + 1];
|
|
72
|
+
if (currentNav.partner === nextNavProp.name) {
|
|
73
|
+
extraNavProp.splice(0, 2);
|
|
74
|
+
} else {
|
|
75
|
+
currentIdx++;
|
|
70
76
|
}
|
|
71
|
-
extraNavProp = extraNavProp.map(navProp => {
|
|
72
|
-
return navProp.targetType.navigationProperties.find(np => np.name === navProp.partner) as NavigationProperty;
|
|
73
|
-
});
|
|
74
|
-
return extraNavProp;
|
|
75
77
|
}
|
|
78
|
+
extraNavProp = extraNavProp.map(navProp => {
|
|
79
|
+
return navProp.targetType.navigationProperties.find(np => np.name === navProp.partner) as NavigationProperty;
|
|
80
|
+
});
|
|
81
|
+
return extraNavProp;
|
|
76
82
|
}
|
|
77
83
|
};
|
|
78
84
|
|
|
@@ -122,57 +128,24 @@ export const enhanceDataModelPath = function(
|
|
|
122
128
|
contextLocation: dataModelObjectPath.contextLocation,
|
|
123
129
|
targetEntitySet: currentEntitySet,
|
|
124
130
|
targetEntityType: currentEntityType,
|
|
125
|
-
targetObject: oTarget
|
|
131
|
+
targetObject: oTarget,
|
|
132
|
+
convertedTypes: dataModelObjectPath.convertedTypes
|
|
126
133
|
};
|
|
127
134
|
};
|
|
128
135
|
|
|
129
|
-
export const getTargetEntitySetPath = function(dataModelObjectPath: DataModelObjectPath
|
|
130
|
-
let targetEntitySetPath: string =
|
|
131
|
-
if (!bRelative) {
|
|
132
|
-
targetEntitySetPath += `/${dataModelObjectPath.startingEntitySet.name}`;
|
|
133
|
-
}
|
|
134
|
-
let currentEntitySet =
|
|
135
|
-
bRelative && dataModelObjectPath.contextLocation?.targetEntitySet
|
|
136
|
-
? dataModelObjectPath.contextLocation.targetEntitySet
|
|
137
|
-
: dataModelObjectPath.startingEntitySet;
|
|
138
|
-
let navigatedPaths: string[] = [];
|
|
139
|
-
dataModelObjectPath.navigationProperties.forEach(navProp => {
|
|
140
|
-
if (
|
|
141
|
-
!bRelative ||
|
|
142
|
-
!dataModelObjectPath.contextLocation ||
|
|
143
|
-
!dataModelObjectPath.contextLocation?.navigationProperties.some(
|
|
144
|
-
contextNavProp => contextNavProp.fullyQualifiedName === navProp.fullyQualifiedName
|
|
145
|
-
)
|
|
146
|
-
) {
|
|
147
|
-
// in case of relative entitySetPath we don't consider navigationPath that are already in the context
|
|
148
|
-
navigatedPaths.push(navProp.name);
|
|
149
|
-
}
|
|
150
|
-
if (currentEntitySet && currentEntitySet.navigationPropertyBinding.hasOwnProperty(navigatedPaths.join("/"))) {
|
|
151
|
-
if (bRelative) {
|
|
152
|
-
targetEntitySetPath += `${navigatedPaths.join("/")}`;
|
|
153
|
-
} else {
|
|
154
|
-
targetEntitySetPath += `/$NavigationPropertyBinding/${navigatedPaths.join("/")}/$`;
|
|
155
|
-
}
|
|
156
|
-
currentEntitySet = currentEntitySet.navigationPropertyBinding[navigatedPaths.join("/")];
|
|
157
|
-
navigatedPaths = [];
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
return targetEntitySetPath;
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
export const getTargetEntitySetNavigation = function(dataModelObjectPath: DataModelObjectPath): NavigationProperty[] {
|
|
164
|
-
const visitedNavigationProperties: NavigationProperty[] = [];
|
|
136
|
+
export const getTargetEntitySetPath = function(dataModelObjectPath: DataModelObjectPath): string {
|
|
137
|
+
let targetEntitySetPath: string = `/${dataModelObjectPath.startingEntitySet.name}`;
|
|
165
138
|
let currentEntitySet = dataModelObjectPath.startingEntitySet;
|
|
166
139
|
let navigatedPaths: string[] = [];
|
|
167
140
|
dataModelObjectPath.navigationProperties.forEach(navProp => {
|
|
168
141
|
navigatedPaths.push(navProp.name);
|
|
169
142
|
if (currentEntitySet && currentEntitySet.navigationPropertyBinding.hasOwnProperty(navigatedPaths.join("/"))) {
|
|
170
|
-
|
|
143
|
+
targetEntitySetPath += `/$NavigationPropertyBinding/${navigatedPaths.join("/")}/$`;
|
|
171
144
|
currentEntitySet = currentEntitySet.navigationPropertyBinding[navigatedPaths.join("/")];
|
|
172
145
|
navigatedPaths = [];
|
|
173
146
|
}
|
|
174
147
|
});
|
|
175
|
-
return
|
|
148
|
+
return targetEntitySetPath;
|
|
176
149
|
};
|
|
177
150
|
|
|
178
151
|
export const getTargetObjectPath = function(dataModelObjectPath: DataModelObjectPath, bRelative: boolean = false): string {
|
|
@@ -251,59 +224,53 @@ export const getContextRelativeTargetObjectPath = function(
|
|
|
251
224
|
|
|
252
225
|
export const isPathUpdatable = function(
|
|
253
226
|
dataModelObjectPath: DataModelObjectPath | undefined,
|
|
254
|
-
|
|
255
|
-
bTableCase?: boolean
|
|
227
|
+
extractionParametersOnPath?: ExtractionParametersOnPath
|
|
256
228
|
): Expression<boolean> {
|
|
257
229
|
return checkOnPath(
|
|
258
230
|
dataModelObjectPath,
|
|
259
|
-
(annotationObject: NavigationPropertyRestriction | EntitySetAnnotations_Capabilities
|
|
231
|
+
(annotationObject: NavigationPropertyRestriction | EntitySetAnnotations_Capabilities) => {
|
|
260
232
|
return annotationObject?.UpdateRestrictions?.Updatable;
|
|
261
233
|
},
|
|
262
|
-
|
|
263
|
-
bTableCase
|
|
234
|
+
extractionParametersOnPath
|
|
264
235
|
);
|
|
265
236
|
};
|
|
266
237
|
|
|
267
238
|
export const isPathSearchable = function(
|
|
268
239
|
dataModelObjectPath: DataModelObjectPath | undefined,
|
|
269
|
-
|
|
270
|
-
bTableCase?: boolean
|
|
240
|
+
extractionParametersOnPath?: ExtractionParametersOnPath
|
|
271
241
|
): Expression<boolean> {
|
|
272
242
|
return checkOnPath(
|
|
273
243
|
dataModelObjectPath,
|
|
274
244
|
(annotationObject: NavigationPropertyRestriction | EntitySetAnnotations_Capabilities) => {
|
|
275
245
|
return annotationObject?.SearchRestrictions?.Searchable;
|
|
276
246
|
},
|
|
277
|
-
|
|
278
|
-
bTableCase
|
|
247
|
+
extractionParametersOnPath
|
|
279
248
|
);
|
|
280
249
|
};
|
|
281
250
|
|
|
282
251
|
export const isPathDeletable = function(
|
|
283
252
|
dataModelObjectPath: DataModelObjectPath | undefined,
|
|
284
|
-
|
|
285
|
-
bTableCase?: boolean
|
|
253
|
+
extractionParametersOnPath?: ExtractionParametersOnPath
|
|
286
254
|
): Expression<boolean> {
|
|
287
255
|
return checkOnPath(
|
|
288
256
|
dataModelObjectPath,
|
|
289
|
-
(annotationObject: NavigationPropertyRestriction | EntitySetAnnotations_Capabilities
|
|
257
|
+
(annotationObject: NavigationPropertyRestriction | EntitySetAnnotations_Capabilities) => {
|
|
290
258
|
return annotationObject?.DeleteRestrictions?.Deletable;
|
|
291
259
|
},
|
|
292
|
-
|
|
293
|
-
bTableCase
|
|
260
|
+
extractionParametersOnPath
|
|
294
261
|
);
|
|
295
262
|
};
|
|
296
263
|
|
|
297
264
|
export const isPathInsertable = function(
|
|
298
265
|
dataModelObjectPath: DataModelObjectPath | undefined,
|
|
299
|
-
|
|
266
|
+
extractionParametersOnPath?: ExtractionParametersOnPath
|
|
300
267
|
): Expression<boolean> {
|
|
301
268
|
return checkOnPath(
|
|
302
269
|
dataModelObjectPath,
|
|
303
|
-
(annotationObject: NavigationPropertyRestriction | EntitySetAnnotations_Capabilities
|
|
270
|
+
(annotationObject: NavigationPropertyRestriction | EntitySetAnnotations_Capabilities) => {
|
|
304
271
|
return annotationObject?.InsertRestrictions?.Insertable;
|
|
305
272
|
},
|
|
306
|
-
|
|
273
|
+
extractionParametersOnPath
|
|
307
274
|
);
|
|
308
275
|
};
|
|
309
276
|
|
|
@@ -335,13 +302,13 @@ export const checkFilterExpressionRestrictions = function(
|
|
|
335
302
|
export const checkOnPath = function(
|
|
336
303
|
dataModelObjectPath: DataModelObjectPath | undefined,
|
|
337
304
|
checkFunction: Function,
|
|
338
|
-
|
|
339
|
-
bTableCase?: boolean
|
|
305
|
+
extractionParametersOnPath?: ExtractionParametersOnPath
|
|
340
306
|
): Expression<boolean> {
|
|
341
307
|
if (!dataModelObjectPath || !dataModelObjectPath.startingEntitySet) {
|
|
342
308
|
return constant(true);
|
|
343
309
|
}
|
|
344
|
-
|
|
310
|
+
|
|
311
|
+
dataModelObjectPath = enhanceDataModelPath(dataModelObjectPath, extractionParametersOnPath?.propertyPath);
|
|
345
312
|
|
|
346
313
|
let currentEntitySet: EntitySet | null = dataModelObjectPath.startingEntitySet;
|
|
347
314
|
let parentEntitySet: EntitySet | null = null;
|
|
@@ -379,11 +346,11 @@ export const checkOnPath = function(
|
|
|
379
346
|
});
|
|
380
347
|
|
|
381
348
|
// At this point we have navigated down all the nav prop and we should have
|
|
382
|
-
// The target
|
|
383
|
-
// The parent entitySet pointing to the previous
|
|
349
|
+
// The target entitySet pointing to either null (in case of containment navprop a last part), or the actual target (non containment as target)
|
|
350
|
+
// The parent entitySet pointing to the previous entitySet used in the path
|
|
384
351
|
// VisitedNavigationPath should contain the path up to this property
|
|
385
352
|
|
|
386
|
-
// Restrictions should then be evaluated as ParentEntitySet.NavRestrictions[
|
|
353
|
+
// Restrictions should then be evaluated as ParentEntitySet.NavRestrictions[NavPropertyPath] || TargetEntitySet.Restrictions
|
|
387
354
|
const fullNavigationPath = visitedNavigationPropsName.join("/");
|
|
388
355
|
let restrictions, visitedNavProps;
|
|
389
356
|
if (parentEntitySet !== null) {
|
|
@@ -396,18 +363,19 @@ export const checkOnPath = function(
|
|
|
396
363
|
const _allVisitedNavigationProps = allVisitedNavigationProps.slice(0, -1);
|
|
397
364
|
if (targetEntitySet !== null) {
|
|
398
365
|
visitedNavProps = _allVisitedNavigationProps;
|
|
366
|
+
} else if (_allVisitedNavigationProps.length === 0) {
|
|
367
|
+
visitedNavProps = allVisitedNavigationProps.slice(0);
|
|
399
368
|
} else {
|
|
400
|
-
|
|
401
|
-
visitedNavProps = allVisitedNavigationProps.slice(0);
|
|
402
|
-
} else {
|
|
403
|
-
visitedNavProps = _allVisitedNavigationProps;
|
|
404
|
-
}
|
|
369
|
+
visitedNavProps = _allVisitedNavigationProps;
|
|
405
370
|
}
|
|
371
|
+
const pathRelativeLocation = getPathRelativeLocation(dataModelObjectPath?.contextLocation, visitedNavProps).map(
|
|
372
|
+
np => np.name
|
|
373
|
+
);
|
|
374
|
+
const pathVisitorFunction = extractionParametersOnPath?.pathVisitor
|
|
375
|
+
? getPathVisitorForSingleton(extractionParametersOnPath.pathVisitor, pathRelativeLocation)
|
|
376
|
+
: undefined; // send pathVisitor function only when it is defined and only send function or defined as a parameter
|
|
406
377
|
restrictions = equal(
|
|
407
|
-
annotationExpression(
|
|
408
|
-
restrictionDefinition,
|
|
409
|
-
getPathRelativeLocation(dataModelObjectPath?.contextLocation, visitedNavProps).map(np => np.name)
|
|
410
|
-
),
|
|
378
|
+
annotationExpression(restrictionDefinition, pathRelativeLocation, undefined, pathVisitorFunction),
|
|
411
379
|
true
|
|
412
380
|
);
|
|
413
381
|
}
|
|
@@ -416,25 +384,34 @@ export const checkOnPath = function(
|
|
|
416
384
|
);
|
|
417
385
|
}
|
|
418
386
|
let targetRestrictions;
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
restrictionDefinition
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
};
|
|
437
|
-
return oResult;
|
|
387
|
+
if (!extractionParametersOnPath?.ignoreTargetCollection) {
|
|
388
|
+
let restrictionDefinition = checkFunction(targetEntitySet?.annotations?.Capabilities);
|
|
389
|
+
if (targetEntitySet === null && restrictionDefinition === undefined) {
|
|
390
|
+
restrictionDefinition = checkFunction(targetEntityType?.annotations?.Capabilities);
|
|
391
|
+
}
|
|
392
|
+
if (restrictionDefinition !== undefined) {
|
|
393
|
+
const pathRelativeLocation = getPathRelativeLocation(dataModelObjectPath.contextLocation, allVisitedNavigationProps).map(
|
|
394
|
+
np => np.name
|
|
395
|
+
);
|
|
396
|
+
const pathVisitorFunction = extractionParametersOnPath?.pathVisitor
|
|
397
|
+
? getPathVisitorForSingleton(extractionParametersOnPath.pathVisitor, pathRelativeLocation)
|
|
398
|
+
: undefined;
|
|
399
|
+
targetRestrictions = equal(
|
|
400
|
+
annotationExpression(restrictionDefinition, pathRelativeLocation, undefined, pathVisitorFunction),
|
|
401
|
+
true
|
|
402
|
+
);
|
|
403
|
+
}
|
|
438
404
|
}
|
|
439
|
-
|
|
405
|
+
|
|
406
|
+
return (
|
|
407
|
+
restrictions || targetRestrictions || (extractionParametersOnPath?.authorizeUnresolvable ? unresolveableExpression : constant(true))
|
|
408
|
+
);
|
|
409
|
+
};
|
|
410
|
+
// This helper method is used to add relative path location argument to singletonPathVisitorFunction i.e. pathVisitor
|
|
411
|
+
// pathVisitor method is used later to get the correct bindings for singleton entity
|
|
412
|
+
// method is invoked later in bindingExpression() method to get the correct binding.
|
|
413
|
+
const getPathVisitorForSingleton = function(pathVisitor: Function, pathRelativeLocation: string[]) {
|
|
414
|
+
return function(path: string) {
|
|
415
|
+
return pathVisitor(path, pathRelativeLocation);
|
|
416
|
+
};
|
|
440
417
|
};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* SAP UI development toolkit for HTML5 (SAPUI5)
|
|
3
|
+
* (c) Copyright 2009-2021 SAP SE. All rights reserved
|
|
4
|
+
*/
|
|
5
|
+
sap.ui.define(["sap/fe/core/templating/PropertyHelper"], function (PropertyHelper) {
|
|
6
|
+
"use strict";
|
|
7
|
+
|
|
8
|
+
var _exports = {};
|
|
9
|
+
var isPathExpression = PropertyHelper.isPathExpression;
|
|
10
|
+
|
|
11
|
+
var EDM_TYPE_MAPPING = {
|
|
12
|
+
"Edm.Boolean": {
|
|
13
|
+
type: "sap.ui.model.odata.type.Boolean"
|
|
14
|
+
},
|
|
15
|
+
"Edm.Byte": {
|
|
16
|
+
type: "sap.ui.model.odata.type.Byte"
|
|
17
|
+
},
|
|
18
|
+
"Edm.Date": {
|
|
19
|
+
type: "sap.ui.model.odata.type.Date"
|
|
20
|
+
},
|
|
21
|
+
"Edm.DateTimeOffset": {
|
|
22
|
+
constraints: {
|
|
23
|
+
"$Precision": "precision"
|
|
24
|
+
},
|
|
25
|
+
type: "sap.ui.model.odata.type.DateTimeOffset"
|
|
26
|
+
},
|
|
27
|
+
"Edm.Decimal": {
|
|
28
|
+
constraints: {
|
|
29
|
+
"@Org.OData.Validation.V1.Minimum/$Decimal": "minimum",
|
|
30
|
+
"@Org.OData.Validation.V1.Minimum@Org.OData.Validation.V1.Exclusive": "minimumExclusive",
|
|
31
|
+
"@Org.OData.Validation.V1.Maximum/$Decimal": "maximum",
|
|
32
|
+
"@Org.OData.Validation.V1.Maximum@Org.OData.Validation.V1.Exclusive": "maximumExclusive",
|
|
33
|
+
"$Precision": "precision",
|
|
34
|
+
"$Scale": "scale"
|
|
35
|
+
},
|
|
36
|
+
type: "sap.ui.model.odata.type.Decimal"
|
|
37
|
+
},
|
|
38
|
+
"Edm.Double": {
|
|
39
|
+
type: "sap.ui.model.odata.type.Double"
|
|
40
|
+
},
|
|
41
|
+
"Edm.Guid": {
|
|
42
|
+
type: "sap.ui.model.odata.type.Guid"
|
|
43
|
+
},
|
|
44
|
+
"Edm.Int16": {
|
|
45
|
+
type: "sap.ui.model.odata.type.Int16"
|
|
46
|
+
},
|
|
47
|
+
"Edm.Int32": {
|
|
48
|
+
type: "sap.ui.model.odata.type.Int32"
|
|
49
|
+
},
|
|
50
|
+
"Edm.Int64": {
|
|
51
|
+
type: "sap.ui.model.odata.type.Int64"
|
|
52
|
+
},
|
|
53
|
+
"Edm.SByte": {
|
|
54
|
+
type: "sap.ui.model.odata.type.SByte"
|
|
55
|
+
},
|
|
56
|
+
"Edm.Single": {
|
|
57
|
+
type: "sap.ui.model.odata.type.Single"
|
|
58
|
+
},
|
|
59
|
+
"Edm.Stream": {
|
|
60
|
+
type: "sap.ui.model.odata.type.Stream"
|
|
61
|
+
},
|
|
62
|
+
"Edm.Binary": {
|
|
63
|
+
type: "sap.ui.model.odata.type.Stream"
|
|
64
|
+
},
|
|
65
|
+
"Edm.String": {
|
|
66
|
+
constraints: {
|
|
67
|
+
"@com.sap.vocabularies.Common.v1.IsDigitSequence": "isDigitSequence",
|
|
68
|
+
"$MaxLength": "maxLength",
|
|
69
|
+
"$Nullable": "nullable"
|
|
70
|
+
},
|
|
71
|
+
type: "sap.ui.model.odata.type.String"
|
|
72
|
+
},
|
|
73
|
+
"Edm.TimeOfDay": {
|
|
74
|
+
constraints: {
|
|
75
|
+
"$Precision": "precision"
|
|
76
|
+
},
|
|
77
|
+
type: "sap.ui.model.odata.type.TimeOfDay"
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
_exports.EDM_TYPE_MAPPING = EDM_TYPE_MAPPING;
|
|
81
|
+
|
|
82
|
+
var getDisplayMode = function (oPropertyPath, oDataModelObjectPath) {
|
|
83
|
+
var _oProperty$annotation, _oProperty$annotation2, _oTextAnnotation$anno, _oTextAnnotation$anno2, _oTextAnnotation$anno3, _oEntityType$annotati, _oEntityType$annotati2, _oEntityType$annotati3, _oEntityType$annotati4, _oEntityType$annotati5, _oEntityType$annotati6;
|
|
84
|
+
|
|
85
|
+
if (!oPropertyPath || typeof oPropertyPath === "string") {
|
|
86
|
+
return "Value";
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
var oProperty = isPathExpression(oPropertyPath) && oPropertyPath.$target || oPropertyPath;
|
|
90
|
+
var oEntityType = oDataModelObjectPath && oDataModelObjectPath.targetEntityType;
|
|
91
|
+
var oTextAnnotation = (_oProperty$annotation = oProperty.annotations) === null || _oProperty$annotation === void 0 ? void 0 : (_oProperty$annotation2 = _oProperty$annotation.Common) === null || _oProperty$annotation2 === void 0 ? void 0 : _oProperty$annotation2.Text;
|
|
92
|
+
var oTextArrangementAnnotation = typeof oTextAnnotation !== "string" && (oTextAnnotation === null || oTextAnnotation === void 0 ? void 0 : (_oTextAnnotation$anno = oTextAnnotation.annotations) === null || _oTextAnnotation$anno === void 0 ? void 0 : (_oTextAnnotation$anno2 = _oTextAnnotation$anno.UI) === null || _oTextAnnotation$anno2 === void 0 ? void 0 : (_oTextAnnotation$anno3 = _oTextAnnotation$anno2.TextArrangement) === null || _oTextAnnotation$anno3 === void 0 ? void 0 : _oTextAnnotation$anno3.toString()) || (oEntityType === null || oEntityType === void 0 ? void 0 : (_oEntityType$annotati = oEntityType.annotations) === null || _oEntityType$annotati === void 0 ? void 0 : (_oEntityType$annotati2 = _oEntityType$annotati.UI) === null || _oEntityType$annotati2 === void 0 ? void 0 : (_oEntityType$annotati3 = _oEntityType$annotati2.TextArrangement) === null || _oEntityType$annotati3 === void 0 ? void 0 : _oEntityType$annotati3.toString());
|
|
93
|
+
var sDisplayValue = oTextAnnotation ? "DescriptionValue" : "Value";
|
|
94
|
+
|
|
95
|
+
if (oTextAnnotation && oTextArrangementAnnotation || oEntityType !== null && oEntityType !== void 0 && (_oEntityType$annotati4 = oEntityType.annotations) !== null && _oEntityType$annotati4 !== void 0 && (_oEntityType$annotati5 = _oEntityType$annotati4.UI) !== null && _oEntityType$annotati5 !== void 0 && (_oEntityType$annotati6 = _oEntityType$annotati5.TextArrangement) !== null && _oEntityType$annotati6 !== void 0 && _oEntityType$annotati6.toString()) {
|
|
96
|
+
if (oTextArrangementAnnotation === "UI.TextArrangementType/TextOnly") {
|
|
97
|
+
sDisplayValue = "Description";
|
|
98
|
+
} else if (oTextArrangementAnnotation === "UI.TextArrangementType/TextLast") {
|
|
99
|
+
sDisplayValue = "ValueDescription";
|
|
100
|
+
} else if (oTextArrangementAnnotation === "UI.TextArrangementType/TextSeparate") {
|
|
101
|
+
sDisplayValue = "Value";
|
|
102
|
+
} else {
|
|
103
|
+
//Default should be TextFirst if there is a Text annotation and neither TextOnly nor TextLast are set
|
|
104
|
+
sDisplayValue = "DescriptionValue";
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return sDisplayValue;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
_exports.getDisplayMode = getDisplayMode;
|
|
112
|
+
return _exports;
|
|
113
|
+
}, false);
|
|
114
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkRpc3BsYXlNb2RlRm9ybWF0dGVyLnRzIl0sIm5hbWVzIjpbIkVETV9UWVBFX01BUFBJTkciLCJ0eXBlIiwiY29uc3RyYWludHMiLCJnZXREaXNwbGF5TW9kZSIsIm9Qcm9wZXJ0eVBhdGgiLCJvRGF0YU1vZGVsT2JqZWN0UGF0aCIsIm9Qcm9wZXJ0eSIsImlzUGF0aEV4cHJlc3Npb24iLCIkdGFyZ2V0Iiwib0VudGl0eVR5cGUiLCJ0YXJnZXRFbnRpdHlUeXBlIiwib1RleHRBbm5vdGF0aW9uIiwiYW5ub3RhdGlvbnMiLCJDb21tb24iLCJUZXh0Iiwib1RleHRBcnJhbmdlbWVudEFubm90YXRpb24iLCJVSSIsIlRleHRBcnJhbmdlbWVudCIsInRvU3RyaW5nIiwic0Rpc3BsYXlWYWx1ZSJdLCJtYXBwaW5ncyI6IjtBQUFBO0FBQ0E7QUFDQTs7Ozs7OztBQVdPLE1BQU1BLGdCQUFxQyxHQUFHO0FBQ3BELG1CQUFlO0F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fQ==
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Separating these methods from the UIFormatters as they are used also in the converter.
|
|
3
|
+
* These methods must NOT used any dependency from the UI5 runtime.
|
|
4
|
+
* When consumed outside of converters, you should call them via UIFormatters.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { Property } from "@sap-ux/annotation-converter";
|
|
8
|
+
import { DataModelObjectPath } from "sap/fe/core/templating/DataModelPathHelper";
|
|
9
|
+
import { isPathExpression } from "sap/fe/core/templating/PropertyHelper";
|
|
10
|
+
import { PathAnnotationExpression } from "@sap-ux/vocabularies-types/types/Edm";
|
|
11
|
+
|
|
12
|
+
export type PropertyOrPath<P> = string | P | PathAnnotationExpression<P>;
|
|
13
|
+
|
|
14
|
+
export const EDM_TYPE_MAPPING: Record<string, any> = {
|
|
15
|
+
"Edm.Boolean": { type: "sap.ui.model.odata.type.Boolean" },
|
|
16
|
+
"Edm.Byte": { type: "sap.ui.model.odata.type.Byte" },
|
|
17
|
+
"Edm.Date": { type: "sap.ui.model.odata.type.Date" },
|
|
18
|
+
"Edm.DateTimeOffset": {
|
|
19
|
+
constraints: {
|
|
20
|
+
"$Precision": "precision"
|
|
21
|
+
},
|
|
22
|
+
type: "sap.ui.model.odata.type.DateTimeOffset"
|
|
23
|
+
},
|
|
24
|
+
"Edm.Decimal": {
|
|
25
|
+
constraints: {
|
|
26
|
+
"@Org.OData.Validation.V1.Minimum/$Decimal": "minimum",
|
|
27
|
+
"@Org.OData.Validation.V1.Minimum@Org.OData.Validation.V1.Exclusive": "minimumExclusive",
|
|
28
|
+
"@Org.OData.Validation.V1.Maximum/$Decimal": "maximum",
|
|
29
|
+
"@Org.OData.Validation.V1.Maximum@Org.OData.Validation.V1.Exclusive": "maximumExclusive",
|
|
30
|
+
"$Precision": "precision",
|
|
31
|
+
"$Scale": "scale"
|
|
32
|
+
},
|
|
33
|
+
type: "sap.ui.model.odata.type.Decimal"
|
|
34
|
+
},
|
|
35
|
+
"Edm.Double": { type: "sap.ui.model.odata.type.Double" },
|
|
36
|
+
"Edm.Guid": { type: "sap.ui.model.odata.type.Guid" },
|
|
37
|
+
"Edm.Int16": { type: "sap.ui.model.odata.type.Int16" },
|
|
38
|
+
"Edm.Int32": { type: "sap.ui.model.odata.type.Int32" },
|
|
39
|
+
"Edm.Int64": { type: "sap.ui.model.odata.type.Int64" },
|
|
40
|
+
"Edm.SByte": { type: "sap.ui.model.odata.type.SByte" },
|
|
41
|
+
"Edm.Single": { type: "sap.ui.model.odata.type.Single" },
|
|
42
|
+
"Edm.Stream": { type: "sap.ui.model.odata.type.Stream" },
|
|
43
|
+
"Edm.Binary": { type: "sap.ui.model.odata.type.Stream" },
|
|
44
|
+
"Edm.String": {
|
|
45
|
+
constraints: {
|
|
46
|
+
"@com.sap.vocabularies.Common.v1.IsDigitSequence": "isDigitSequence",
|
|
47
|
+
"$MaxLength": "maxLength",
|
|
48
|
+
"$Nullable": "nullable"
|
|
49
|
+
},
|
|
50
|
+
type: "sap.ui.model.odata.type.String"
|
|
51
|
+
},
|
|
52
|
+
"Edm.TimeOfDay": {
|
|
53
|
+
constraints: {
|
|
54
|
+
"$Precision": "precision"
|
|
55
|
+
},
|
|
56
|
+
type: "sap.ui.model.odata.type.TimeOfDay"
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export type DisplayMode = "Value" | "Description" | "DescriptionValue" | "ValueDescription";
|
|
61
|
+
export const getDisplayMode = function(oPropertyPath: PropertyOrPath<Property>, oDataModelObjectPath?: DataModelObjectPath): DisplayMode {
|
|
62
|
+
if (!oPropertyPath || typeof oPropertyPath === "string") {
|
|
63
|
+
return "Value";
|
|
64
|
+
}
|
|
65
|
+
const oProperty = (isPathExpression(oPropertyPath) && oPropertyPath.$target) || (oPropertyPath as Property);
|
|
66
|
+
const oEntityType = oDataModelObjectPath && oDataModelObjectPath.targetEntityType;
|
|
67
|
+
const oTextAnnotation = oProperty.annotations?.Common?.Text;
|
|
68
|
+
const oTextArrangementAnnotation =
|
|
69
|
+
(typeof oTextAnnotation !== "string" && oTextAnnotation?.annotations?.UI?.TextArrangement?.toString()) ||
|
|
70
|
+
oEntityType?.annotations?.UI?.TextArrangement?.toString();
|
|
71
|
+
|
|
72
|
+
let sDisplayValue = oTextAnnotation ? "DescriptionValue" : "Value";
|
|
73
|
+
if ((oTextAnnotation && oTextArrangementAnnotation) || oEntityType?.annotations?.UI?.TextArrangement?.toString()) {
|
|
74
|
+
if (oTextArrangementAnnotation === "UI.TextArrangementType/TextOnly") {
|
|
75
|
+
sDisplayValue = "Description";
|
|
76
|
+
} else if (oTextArrangementAnnotation === "UI.TextArrangementType/TextLast") {
|
|
77
|
+
sDisplayValue = "ValueDescription";
|
|
78
|
+
} else if (oTextArrangementAnnotation === "UI.TextArrangementType/TextSeparate") {
|
|
79
|
+
sDisplayValue = "Value";
|
|
80
|
+
} else {
|
|
81
|
+
//Default should be TextFirst if there is a Text annotation and neither TextOnly nor TextLast are set
|
|
82
|
+
sDisplayValue = "DescriptionValue";
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return sDisplayValue as DisplayMode;
|
|
86
|
+
};
|