@sapui5/sap.fe.core 1.100.0 → 1.102.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/src/sap/fe/core/.library +2 -3
- package/src/sap/fe/core/AppComponent.js +23 -30
- package/src/sap/fe/core/AppComponent.ts +35 -40
- package/src/sap/fe/core/AppStateHandler.js +8 -8
- package/src/sap/fe/core/AppStateHandler.ts +11 -11
- package/src/sap/fe/core/BaseController.js +9 -9
- package/src/sap/fe/core/BaseController.ts +3 -4
- package/src/sap/fe/core/CommonUtils.js +122 -101
- package/src/sap/fe/core/CommonUtils.ts +239 -193
- package/src/sap/fe/core/ExtensionAPI.js +12 -13
- package/src/sap/fe/core/ExtensionAPI.ts +21 -31
- package/src/sap/fe/core/PageController.js +19 -13
- package/src/sap/fe/core/PageController.ts +40 -34
- package/src/sap/fe/core/TemplateComponent.js +198 -123
- package/src/sap/fe/core/TemplateComponent.ts +109 -121
- package/src/sap/fe/core/TemplateModel.js +7 -9
- package/src/sap/fe/core/TemplateModel.ts +3 -3
- package/src/sap/fe/core/buildingBlocks/AttributeModel.js +60 -0
- package/src/sap/fe/core/buildingBlocks/AttributeModel.ts +37 -0
- package/src/sap/fe/core/buildingBlocks/BuildingBlock.js +165 -0
- package/src/sap/fe/core/buildingBlocks/BuildingBlock.ts +178 -0
- package/src/sap/fe/core/buildingBlocks/BuildingBlockRuntime.js +935 -0
- package/src/sap/fe/core/buildingBlocks/BuildingBlockRuntime.ts +837 -0
- package/src/sap/fe/core/buildingBlocks/TraceInfo.js +436 -0
- package/src/sap/fe/core/buildingBlocks/TraceInfo.ts +431 -0
- package/src/sap/fe/core/{BusyLocker.js → controllerextensions/BusyLocker.js} +1 -1
- package/src/sap/fe/core/{BusyLocker.ts → controllerextensions/BusyLocker.ts} +7 -7
- package/src/sap/fe/core/controllerextensions/EditFlow.js +660 -288
- package/src/sap/fe/core/controllerextensions/EditFlow.ts +513 -331
- package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.js +11 -11
- package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.ts +6 -7
- package/src/sap/fe/core/controllerextensions/InternalEditFlow.js +43 -25
- package/src/sap/fe/core/controllerextensions/InternalEditFlow.ts +132 -103
- package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.js +16 -16
- package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.ts +64 -55
- package/src/sap/fe/core/controllerextensions/InternalRouting.js +166 -99
- package/src/sap/fe/core/controllerextensions/InternalRouting.ts +187 -149
- package/src/sap/fe/core/controllerextensions/KPIManagement.js +14 -14
- package/src/sap/fe/core/controllerextensions/KPIManagement.ts +12 -11
- package/src/sap/fe/core/controllerextensions/MassEdit.js +13 -12
- package/src/sap/fe/core/controllerextensions/MassEdit.ts +22 -22
- package/src/sap/fe/core/controllerextensions/MessageHandler.js +14 -26
- package/src/sap/fe/core/controllerextensions/MessageHandler.ts +20 -30
- package/src/sap/fe/core/controllerextensions/PageReady.js +25 -23
- package/src/sap/fe/core/controllerextensions/PageReady.ts +49 -47
- package/src/sap/fe/core/controllerextensions/Paginator.js +24 -15
- package/src/sap/fe/core/controllerextensions/Paginator.ts +35 -20
- package/src/sap/fe/core/controllerextensions/Placeholder.js +10 -10
- package/src/sap/fe/core/controllerextensions/Placeholder.ts +12 -14
- package/src/sap/fe/core/controllerextensions/Routing.js +11 -11
- package/src/sap/fe/core/controllerextensions/Routing.ts +12 -13
- package/src/sap/fe/core/controllerextensions/Share.js +34 -16
- package/src/sap/fe/core/controllerextensions/Share.ts +50 -32
- package/src/sap/fe/core/controllerextensions/SideEffects.js +15 -15
- package/src/sap/fe/core/controllerextensions/SideEffects.ts +64 -65
- package/src/sap/fe/core/controllerextensions/ViewState.js +27 -31
- package/src/sap/fe/core/controllerextensions/ViewState.ts +103 -102
- package/src/sap/fe/core/controllerextensions/collaboration/ActivityBase.js +105 -0
- package/src/sap/fe/core/controllerextensions/collaboration/ActivityBase.ts +98 -0
- package/src/sap/fe/core/controllerextensions/collaboration/ActivitySync.js +360 -0
- package/src/sap/fe/core/{actions → controllerextensions}/collaboration/ActivitySync.ts +90 -132
- package/src/sap/fe/core/controllerextensions/collaboration/CollaborationCommon.js +146 -0
- package/src/sap/fe/core/{actions → controllerextensions}/collaboration/CollaborationCommon.ts +18 -8
- package/src/sap/fe/core/controllerextensions/collaboration/Manage.js +264 -0
- package/src/sap/fe/core/{actions → controllerextensions}/collaboration/Manage.ts +35 -33
- package/src/sap/fe/core/controllerextensions/collaboration/ManageDialog.fragment.xml +100 -0
- package/src/sap/fe/core/{actions → controllerextensions}/collaboration/UserDetails.fragment.xml +5 -7
- package/src/sap/fe/core/controllerextensions/editFlow/TransactionHelper.js +1584 -0
- package/src/sap/fe/core/{TransactionHelper.ts → controllerextensions/editFlow/TransactionHelper.ts} +190 -159
- package/src/sap/fe/core/controllerextensions/editFlow/draft.js +780 -0
- package/src/sap/fe/core/{actions → controllerextensions/editFlow}/draft.ts +329 -76
- package/src/sap/fe/core/controllerextensions/editFlow/operations.js +1149 -0
- package/src/sap/fe/core/{actions → controllerextensions/editFlow}/operations.ts +169 -97
- package/src/sap/fe/core/controllerextensions/editFlow/sticky.js +190 -0
- package/src/sap/fe/core/{actions → controllerextensions/editFlow}/sticky.ts +76 -12
- package/src/sap/fe/core/controllerextensions/messageHandler/messageHandling.js +592 -0
- package/src/sap/fe/core/{actions → controllerextensions/messageHandler}/messageHandling.ts +83 -60
- package/src/sap/fe/core/controllerextensions/routing/RouterProxy.js +940 -0
- package/src/sap/fe/core/{RouterProxy.ts → controllerextensions/routing/RouterProxy.ts} +52 -36
- package/src/sap/fe/core/controls/ActionParameterDialog.fragment.xml +21 -18
- package/src/sap/fe/core/controls/Any.js +28 -0
- package/src/sap/fe/core/controls/Any.ts +30 -0
- package/src/sap/fe/core/controls/CommandExecution.js +50 -16
- package/src/sap/fe/core/controls/CommandExecution.ts +31 -22
- package/src/sap/fe/core/controls/ConditionalWrapper.js +136 -65
- package/src/sap/fe/core/controls/ConditionalWrapper.ts +49 -58
- package/src/sap/fe/core/controls/CustomFilterFieldContentWrapper.js +371 -0
- package/src/sap/fe/core/controls/CustomFilterFieldContentWrapper.ts +282 -0
- package/src/sap/fe/core/controls/CustomQuickViewPage.js +74 -36
- package/src/sap/fe/core/controls/CustomQuickViewPage.ts +23 -32
- package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossDraft.fragment.xml +52 -5
- package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.js +127 -67
- package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.ts +127 -67
- package/src/sap/fe/core/controls/FieldWrapper.js +171 -87
- package/src/sap/fe/core/controls/FieldWrapper.ts +69 -80
- package/src/sap/fe/core/controls/FileWrapper.js +360 -0
- package/src/sap/fe/core/controls/FileWrapper.ts +202 -0
- package/src/sap/fe/core/controls/FilterBar.js +154 -119
- package/src/sap/fe/core/controls/FilterBar.ts +128 -123
- package/src/sap/fe/core/controls/FormElementWrapper.js +102 -37
- package/src/sap/fe/core/controls/FormElementWrapper.ts +43 -35
- package/src/sap/fe/core/controls/MassEditSelect.js +33 -0
- package/src/sap/fe/core/controls/MassEditSelect.ts +45 -0
- package/src/sap/fe/core/controls/filterbar/FilterContainer.js +111 -89
- package/src/sap/fe/core/controls/filterbar/FilterContainer.ts +86 -82
- package/src/sap/fe/core/controls/filterbar/VisualFilter.js +242 -193
- package/src/sap/fe/core/controls/filterbar/VisualFilter.ts +211 -204
- package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.js +152 -116
- package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.ts +105 -105
- package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.js +2 -2
- package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.ts +23 -28
- package/src/sap/fe/core/controls/massEdit/MassEditDialog.fragment.xml +41 -81
- package/src/sap/fe/core/controls/massEdit/MassEditField.fragment.xml +107 -0
- package/src/sap/fe/core/controls/massEdit/MassEditHandlers.js +550 -35
- package/src/sap/fe/core/controls/massEdit/MassEditHandlers.ts +604 -35
- package/src/sap/fe/core/converters/ManifestSettings.js +3 -1
- package/src/sap/fe/core/converters/ManifestSettings.ts +9 -2
- package/src/sap/fe/core/converters/MetaModelConverter.js +11 -40
- package/src/sap/fe/core/converters/MetaModelConverter.ts +56 -84
- package/src/sap/fe/core/converters/annotations/DataField.js +20 -5
- package/src/sap/fe/core/converters/annotations/DataField.ts +27 -6
- package/src/sap/fe/core/converters/controls/Common/Action.js +14 -21
- package/src/sap/fe/core/converters/controls/Common/Action.ts +23 -28
- package/src/sap/fe/core/converters/controls/Common/Chart.js +17 -10
- package/src/sap/fe/core/converters/controls/Common/Chart.ts +20 -14
- package/src/sap/fe/core/converters/controls/Common/Form.js +16 -18
- package/src/sap/fe/core/converters/controls/Common/Form.ts +20 -20
- package/src/sap/fe/core/converters/controls/Common/KPI.js +1 -1
- package/src/sap/fe/core/converters/controls/Common/KPI.ts +2 -3
- package/src/sap/fe/core/converters/controls/Common/Table.js +389 -173
- package/src/sap/fe/core/converters/controls/Common/Table.ts +440 -244
- package/src/sap/fe/core/converters/controls/Common/table/StandardActions.js +26 -16
- package/src/sap/fe/core/converters/controls/Common/table/StandardActions.ts +27 -19
- package/src/sap/fe/core/converters/controls/ListReport/FilterBar.js +78 -47
- package/src/sap/fe/core/converters/controls/ListReport/FilterBar.ts +146 -107
- package/src/sap/fe/core/converters/controls/ObjectPage/HeaderFacet.js +6 -6
- package/src/sap/fe/core/converters/controls/ObjectPage/HeaderFacet.ts +20 -18
- package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.js +30 -25
- package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.ts +39 -34
- package/src/sap/fe/core/converters/helpers/Aggregation.js +10 -2
- package/src/sap/fe/core/converters/helpers/Aggregation.ts +18 -13
- package/src/sap/fe/core/converters/helpers/BindingHelper.js +3 -2
- package/src/sap/fe/core/converters/helpers/BindingHelper.ts +6 -5
- package/src/sap/fe/core/converters/objectPage/FormMenuActions.js +1 -1
- package/src/sap/fe/core/converters/objectPage/FormMenuActions.ts +0 -4
- package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.js +27 -24
- package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.ts +49 -40
- package/src/sap/fe/core/converters/templates/ListReportConverter.js +33 -22
- package/src/sap/fe/core/converters/templates/ListReportConverter.ts +77 -62
- package/src/sap/fe/core/converters/templates/ObjectPageConverter.js +28 -28
- package/src/sap/fe/core/converters/templates/ObjectPageConverter.ts +38 -45
- package/src/sap/fe/core/designtime/AppComponent.designtime.js +3 -3
- package/src/sap/fe/core/designtime/AppComponent.designtime.ts +8 -6
- package/src/sap/fe/core/formatters/KPIFormatter.js +3 -12
- package/src/sap/fe/core/formatters/KPIFormatter.ts +3 -2
- package/src/sap/fe/core/formatters/TableFormatter.js +74 -13
- package/src/sap/fe/core/formatters/TableFormatter.ts +71 -16
- package/src/sap/fe/core/formatters/ValueFormatter.js +4 -4
- package/src/sap/fe/core/formatters/ValueFormatter.ts +4 -7
- package/src/sap/fe/core/fpm/Component.js +46 -17
- package/src/sap/fe/core/fpm/Component.ts +11 -16
- package/src/sap/fe/core/helpers/AppStartupHelper.js +4 -4
- package/src/sap/fe/core/helpers/AppStartupHelper.ts +3 -3
- package/src/sap/fe/core/helpers/BindingExpression.js +10 -7
- package/src/sap/fe/core/helpers/BindingExpression.ts +37 -35
- package/src/sap/fe/core/helpers/ClassSupport.js +273 -256
- package/src/sap/fe/core/helpers/ClassSupport.ts +315 -237
- package/src/sap/fe/core/helpers/FPMHelper.js +3 -2
- package/src/sap/fe/core/helpers/FPMHelper.ts +9 -8
- package/src/sap/fe/core/helpers/MassEditHelper.js +522 -147
- package/src/sap/fe/core/helpers/MassEditHelper.ts +563 -236
- package/src/sap/fe/core/helpers/ModelHelper.js +29 -1
- package/src/sap/fe/core/helpers/ModelHelper.ts +39 -26
- package/src/sap/fe/core/helpers/PasteHelper.js +4 -4
- package/src/sap/fe/core/helpers/PasteHelper.ts +4 -3
- package/src/sap/fe/core/helpers/SemanticDateOperators.js +3 -3
- package/src/sap/fe/core/helpers/SemanticDateOperators.ts +3 -1
- package/src/sap/fe/core/helpers/SemanticKeyHelper.js +1 -1
- package/src/sap/fe/core/helpers/SemanticKeyHelper.ts +1 -1
- package/src/sap/fe/core/helpers/StableIdHelper.js +5 -7
- package/src/sap/fe/core/helpers/StableIdHelper.ts +8 -8
- package/src/sap/fe/core/{Synchronization.js → helpers/Synchronization.js} +1 -1
- package/src/sap/fe/core/{Synchronization.ts → helpers/Synchronization.ts} +1 -1
- package/src/sap/fe/core/jsx-runtime/jsx.js +35 -5
- package/src/sap/fe/core/jsx-runtime/jsx.ts +22 -8
- package/src/sap/fe/core/library.js +13 -5
- package/src/sap/fe/core/library.ts +26 -17
- package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.js +1 -1
- package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.ts +0 -3
- package/src/sap/fe/core/messagebundle.properties +135 -180
- package/src/sap/fe/core/messagebundle_ar.properties +31 -64
- package/src/sap/fe/core/messagebundle_bg.properties +31 -64
- package/src/sap/fe/core/messagebundle_ca.properties +31 -64
- package/src/sap/fe/core/messagebundle_cs.properties +31 -64
- package/src/sap/fe/core/messagebundle_cy.properties +32 -65
- package/src/sap/fe/core/messagebundle_da.properties +31 -64
- package/src/sap/fe/core/messagebundle_de.properties +29 -62
- package/src/sap/fe/core/messagebundle_el.properties +32 -65
- package/src/sap/fe/core/messagebundle_en.properties +32 -65
- package/src/sap/fe/core/messagebundle_en_GB.properties +29 -62
- package/src/sap/fe/core/messagebundle_en_US_sappsd.properties +41 -74
- package/src/sap/fe/core/messagebundle_en_US_saprigi.properties +32 -65
- package/src/sap/fe/core/messagebundle_en_US_saptrc.properties +20 -6
- package/src/sap/fe/core/messagebundle_es.properties +31 -64
- package/src/sap/fe/core/messagebundle_es_MX.properties +31 -64
- package/src/sap/fe/core/messagebundle_et.properties +31 -64
- package/src/sap/fe/core/messagebundle_fi.properties +29 -62
- package/src/sap/fe/core/messagebundle_fr.properties +36 -69
- package/src/sap/fe/core/messagebundle_fr_CA.properties +33 -66
- package/src/sap/fe/core/messagebundle_hi.properties +29 -62
- package/src/sap/fe/core/messagebundle_hr.properties +32 -65
- package/src/sap/fe/core/messagebundle_hu.properties +30 -63
- package/src/sap/fe/core/messagebundle_id.properties +32 -65
- package/src/sap/fe/core/messagebundle_it.properties +31 -64
- package/src/sap/fe/core/messagebundle_iw.properties +31 -64
- package/src/sap/fe/core/messagebundle_ja.properties +29 -62
- package/src/sap/fe/core/messagebundle_kk.properties +31 -64
- package/src/sap/fe/core/messagebundle_ko.properties +31 -64
- package/src/sap/fe/core/messagebundle_lt.properties +31 -64
- package/src/sap/fe/core/messagebundle_lv.properties +32 -65
- package/src/sap/fe/core/messagebundle_ms.properties +31 -64
- package/src/sap/fe/core/messagebundle_nl.properties +31 -64
- package/src/sap/fe/core/messagebundle_no.properties +31 -64
- package/src/sap/fe/core/messagebundle_pl.properties +34 -67
- package/src/sap/fe/core/messagebundle_pt.properties +32 -65
- package/src/sap/fe/core/messagebundle_pt_PT.properties +31 -64
- package/src/sap/fe/core/messagebundle_ro.properties +33 -66
- package/src/sap/fe/core/messagebundle_ru.properties +33 -66
- package/src/sap/fe/core/messagebundle_sh.properties +31 -64
- package/src/sap/fe/core/messagebundle_sk.properties +31 -64
- package/src/sap/fe/core/messagebundle_sl.properties +29 -62
- package/src/sap/fe/core/messagebundle_sv.properties +30 -63
- package/src/sap/fe/core/messagebundle_th.properties +31 -64
- package/src/sap/fe/core/messagebundle_tr.properties +31 -64
- package/src/sap/fe/core/messagebundle_uk.properties +32 -65
- package/src/sap/fe/core/messagebundle_vi.properties +31 -64
- package/src/sap/fe/core/messagebundle_zh_CN.properties +32 -65
- package/src/sap/fe/core/messagebundle_zh_TW.properties +34 -67
- package/src/sap/fe/core/services/AsyncComponentServiceFactory.js +4 -4
- package/src/sap/fe/core/services/AsyncComponentServiceFactory.ts +1 -1
- package/src/sap/fe/core/services/CacheHandlerServiceFactory.js +5 -5
- package/src/sap/fe/core/services/CacheHandlerServiceFactory.ts +1 -2
- package/src/sap/fe/core/services/EnvironmentServiceFactory.js +11 -8
- package/src/sap/fe/core/services/EnvironmentServiceFactory.ts +15 -13
- package/src/sap/fe/core/services/NavigationServiceFactory.js +5 -5
- package/src/sap/fe/core/services/NavigationServiceFactory.ts +9 -5
- package/src/sap/fe/core/services/ResourceModelServiceFactory.js +4 -4
- package/src/sap/fe/core/services/ResourceModelServiceFactory.ts +1 -1
- package/src/sap/fe/core/services/RoutingServiceFactory.js +105 -66
- package/src/sap/fe/core/services/RoutingServiceFactory.ts +59 -49
- package/src/sap/fe/core/services/ShellServicesFactory.js +104 -29
- package/src/sap/fe/core/services/ShellServicesFactory.ts +64 -30
- package/src/sap/fe/core/services/SideEffectsServiceFactory.js +4 -4
- package/src/sap/fe/core/services/SideEffectsServiceFactory.ts +1 -1
- package/src/sap/fe/core/services/TemplatedViewServiceFactory.js +11 -10
- package/src/sap/fe/core/services/TemplatedViewServiceFactory.ts +38 -51
- package/src/sap/fe/core/services/view/TemplatingErrorPage.controller.js +43 -5
- package/src/sap/fe/core/services/view/TemplatingErrorPage.controller.ts +6 -3
- package/src/sap/fe/core/support/CommonHelper.js +1 -1
- package/src/sap/fe/core/support/CommonHelper.ts +0 -3
- package/src/sap/fe/core/templating/DataModelPathHelper.js +2 -9
- package/src/sap/fe/core/templating/DataModelPathHelper.ts +32 -38
- package/src/sap/fe/core/templating/DisplayModeFormatter.js +23 -3
- package/src/sap/fe/core/templating/DisplayModeFormatter.ts +27 -6
- package/src/sap/fe/core/templating/EntitySetHelper.js +1 -9
- package/src/sap/fe/core/templating/EntitySetHelper.ts +11 -13
- package/src/sap/fe/core/templating/FilterHelper.js +4 -4
- package/src/sap/fe/core/templating/FilterHelper.ts +6 -5
- package/src/sap/fe/core/templating/PropertyHelper.js +70 -33
- package/src/sap/fe/core/templating/PropertyHelper.ts +49 -27
- package/src/sap/fe/core/templating/UIFormatters.js +133 -22
- package/src/sap/fe/core/templating/UIFormatters.ts +144 -50
- package/src/sap/fe/core/type/DateTimeWithTimezone.js +47 -0
- package/src/sap/fe/core/type/DateTimeWithTimezone.ts +23 -0
- package/src/sap/fe/core/type/Email.js +26 -8
- package/src/sap/fe/core/type/Email.ts +8 -7
- package/src/sap/fe/core/AnnotationHelper.js +0 -312
- package/src/sap/fe/core/AnnotationHelper.ts +0 -315
- package/src/sap/fe/core/RouterProxy.js +0 -926
- package/src/sap/fe/core/TransactionHelper.js +0 -1562
- package/src/sap/fe/core/actions/collaboration/ActivitySync.js +0 -392
- package/src/sap/fe/core/actions/collaboration/CollaborationCommon.js +0 -136
- package/src/sap/fe/core/actions/collaboration/Manage.js +0 -262
- package/src/sap/fe/core/actions/collaboration/ManageDialog.fragment.xml +0 -103
- package/src/sap/fe/core/actions/draft.js +0 -523
- package/src/sap/fe/core/actions/messageHandling.js +0 -567
- package/src/sap/fe/core/actions/nonDraft.js +0 -20
- package/src/sap/fe/core/actions/nonDraft.ts +0 -12
- package/src/sap/fe/core/actions/operations.js +0 -1096
- package/src/sap/fe/core/actions/sticky.js +0 -130
- package/src/sap/fe/core/controllerextensions/ControllerExtensionMetadata.js +0 -78
- package/src/sap/fe/core/controllerextensions/ControllerExtensionMetadata.ts +0 -65
- package/src/sap/fe/core/formatters/CriticalityFormatter.js +0 -77
- package/src/sap/fe/core/formatters/CriticalityFormatter.ts +0 -58
|
@@ -1,38 +1,37 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import CommonUtils from "sap/fe/core/CommonUtils";
|
|
2
|
+
import {
|
|
3
|
+
broadcastCollaborationMessage,
|
|
4
|
+
endCollaboration,
|
|
5
|
+
initializeCollaboration,
|
|
6
|
+
isCollaborationConnected
|
|
7
|
+
} from "sap/fe/core/controllerextensions/collaboration/ActivityBase";
|
|
8
|
+
import {
|
|
9
|
+
Activity,
|
|
10
|
+
CollaborationUtils,
|
|
11
|
+
Message,
|
|
12
|
+
User,
|
|
13
|
+
UserActivity
|
|
14
|
+
} from "sap/fe/core/controllerextensions/collaboration/CollaborationCommon";
|
|
4
15
|
import MessageBox from "sap/m/MessageBox";
|
|
5
|
-
import
|
|
16
|
+
import Control from "sap/ui/core/Control";
|
|
6
17
|
import View from "sap/ui/core/mvc/View";
|
|
7
|
-
import
|
|
8
|
-
import ODataMetaModel from "sap/ui/model/odata/v4/ODataMetaModel";
|
|
9
|
-
import Log from "sap/base/Log";
|
|
18
|
+
import JSONModel from "sap/ui/model/json/JSONModel";
|
|
10
19
|
import Context from "sap/ui/model/odata/v4/Context";
|
|
11
|
-
import
|
|
20
|
+
import ODataMetaModel from "sap/ui/model/odata/v4/ODataMetaModel";
|
|
12
21
|
|
|
13
|
-
const CONNECTED = "/collaboration/connected";
|
|
14
|
-
const CONNECTION = "/collaboration/connection";
|
|
15
22
|
const MYACTIVITY = "/collaboration/myActivity";
|
|
16
23
|
const ACTIVEUSERS = "/collaboration/activeUsers";
|
|
17
24
|
const ACTIVITIES = "/collaboration/activities";
|
|
18
25
|
|
|
19
|
-
export const isConnected = function(control: Control): boolean {
|
|
20
|
-
|
|
26
|
+
export const isConnected = function (control: Control): boolean {
|
|
27
|
+
const internalModel = control.getModel("internal") as JSONModel;
|
|
28
|
+
return isCollaborationConnected(internalModel);
|
|
21
29
|
};
|
|
22
30
|
|
|
23
|
-
export const send = function(control: Control, action: Activity, content: string | string[] |
|
|
31
|
+
export const send = function (control: Control, action: Activity, content: string | string[] | undefined) {
|
|
24
32
|
if (isConnected(control)) {
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
contentArray.forEach(function(c) {
|
|
28
|
-
if (c) {
|
|
29
|
-
clientContent += clientContent ? "|" : "";
|
|
30
|
-
clientContent += typeof c === "string" ? c : c.getPath();
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
const internalModel = control.getModel("internal") as any;
|
|
35
|
-
const webSocket = internalModel.getProperty(CONNECTION) as SapPcpWebSocket;
|
|
33
|
+
const internalModel = control.getModel("internal") as JSONModel;
|
|
34
|
+
const clientContent = Array.isArray(content) ? content.join("|") : content;
|
|
36
35
|
|
|
37
36
|
if (action === Activity.LiveChange) {
|
|
38
37
|
// To avoid unnecessary traffic we keep track of live changes and send it only once
|
|
@@ -47,24 +46,22 @@ export const send = function(control: Control, action: Activity, content: string
|
|
|
47
46
|
internalModel.setProperty(MYACTIVITY, null);
|
|
48
47
|
}
|
|
49
48
|
|
|
50
|
-
|
|
51
|
-
clientAction: action,
|
|
52
|
-
clientContent: clientContent
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
if (action === Activity.Activate || action === Activity.Discard) {
|
|
56
|
-
disconnect(control);
|
|
57
|
-
}
|
|
49
|
+
broadcastCollaborationMessage(action, clientContent, internalModel);
|
|
58
50
|
}
|
|
59
51
|
};
|
|
60
52
|
|
|
61
|
-
|
|
62
|
-
|
|
53
|
+
const getWebSocketBaseURL = function (bindingContext: Context): string {
|
|
54
|
+
return bindingContext.getModel().getMetaModel().getObject("/@com.sap.vocabularies.Common.v1.WebSocketBaseURL");
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const isCollaborationEnabled = function (view: View): boolean {
|
|
58
|
+
const bindingContext = view?.getBindingContext && (view.getBindingContext() as Context);
|
|
59
|
+
return !!(bindingContext && getWebSocketBaseURL(bindingContext));
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const connect = async function (view: View) {
|
|
63
|
+
const internalModel = view.getModel("internal") as JSONModel;
|
|
63
64
|
const me = CollaborationUtils.getMe(view);
|
|
64
|
-
if (internalModel.getProperty(CONNECTION)) {
|
|
65
|
-
// connection already established
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
65
|
|
|
69
66
|
// Retrieving ME from shell service
|
|
70
67
|
if (!me) {
|
|
@@ -72,13 +69,8 @@ export const connect = async function(view: View) {
|
|
|
72
69
|
return;
|
|
73
70
|
}
|
|
74
71
|
|
|
75
|
-
const activeUsers: any[] = [me];
|
|
76
|
-
internalModel.setProperty("/collaboration", { activeUsers: activeUsers, activities: {} });
|
|
77
72
|
const bindingContext = view.getBindingContext() as Context;
|
|
78
|
-
const webSocketBaseURL = bindingContext
|
|
79
|
-
.getModel()
|
|
80
|
-
.getMetaModel()
|
|
81
|
-
.getObject("/@com.sap.vocabularies.Common.v1.WebSocketBaseURL");
|
|
73
|
+
const webSocketBaseURL = getWebSocketBaseURL(bindingContext);
|
|
82
74
|
|
|
83
75
|
if (!webSocketBaseURL) {
|
|
84
76
|
return;
|
|
@@ -89,57 +81,17 @@ export const connect = async function(view: View) {
|
|
|
89
81
|
return;
|
|
90
82
|
}
|
|
91
83
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
webSocket.attachMessage(function(event: Event) {
|
|
95
|
-
const message: Message = event.getParameter("pcpFields");
|
|
96
|
-
messageReceive(message, view, webSocket);
|
|
84
|
+
initializeCollaboration(me, webSocketBaseURL, sDraftUUID, internalModel, (message: Message) => {
|
|
85
|
+
messageReceive(message, view);
|
|
97
86
|
});
|
|
98
87
|
};
|
|
99
88
|
|
|
100
|
-
export const disconnect = function(control: Control) {
|
|
101
|
-
const internalModel = control.getModel("internal") as
|
|
102
|
-
|
|
103
|
-
webSocket.close();
|
|
104
|
-
internalModel.setProperty(CONNECTION, null);
|
|
89
|
+
export const disconnect = function (control: Control) {
|
|
90
|
+
const internalModel = control.getModel("internal") as JSONModel;
|
|
91
|
+
endCollaboration(internalModel);
|
|
105
92
|
};
|
|
106
93
|
|
|
107
|
-
function
|
|
108
|
-
const internalModel: any = view.getModel("internal");
|
|
109
|
-
const hostLocation = window.location;
|
|
110
|
-
let socketURI;
|
|
111
|
-
|
|
112
|
-
// Support useBackendUrl for local testing
|
|
113
|
-
const useBackendUrl = UriParameters.fromQuery(window.location.search).get("useBackendUrl");
|
|
114
|
-
if (useBackendUrl) {
|
|
115
|
-
socketURI = useBackendUrl.replace("https", "wss");
|
|
116
|
-
} else {
|
|
117
|
-
socketURI = hostLocation.protocol === "https:" ? "wss:" : "ws:";
|
|
118
|
-
socketURI += "//" + hostLocation.host;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
socketURI += (socketBaseURL.startsWith("/") ? "" : "/") + socketBaseURL + "?draft=" + draftUUID;
|
|
122
|
-
|
|
123
|
-
const webSocket = new SapPcpWebSocket(socketURI, ["v10.pcp.sap.com"]); // TODO: use enum
|
|
124
|
-
internalModel.setProperty(CONNECTION, webSocket);
|
|
125
|
-
|
|
126
|
-
webSocket.attachOpen(function() {
|
|
127
|
-
internalModel.setProperty(CONNECTED, true);
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
webSocket.attachError(function() {
|
|
131
|
-
Log.error("The connection to the websocket channel " + socketBaseURL + " could not be established");
|
|
132
|
-
internalModel.setProperty(CONNECTED, false);
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
webSocket.attachClose(function() {
|
|
136
|
-
internalModel.setProperty(CONNECTED, false);
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
return webSocket;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
function messageReceive(message: Message, view: View, webSocket: any) {
|
|
94
|
+
function messageReceive(message: Message, view: View) {
|
|
143
95
|
const internalModel: any = view.getModel("internal");
|
|
144
96
|
let activeUsers: User[] = internalModel.getProperty(ACTIVEUSERS);
|
|
145
97
|
let activities: UserActivity[];
|
|
@@ -154,40 +106,37 @@ function messageReceive(message: Message, view: View, webSocket: any) {
|
|
|
154
106
|
color: CollaborationUtils.getUserColor(message.userID, activeUsers, [])
|
|
155
107
|
};
|
|
156
108
|
|
|
109
|
+
// eslint-disable-next-line default-case
|
|
157
110
|
switch (message.userAction) {
|
|
158
111
|
case Activity.Join:
|
|
159
112
|
case Activity.JoinEcho:
|
|
160
|
-
if (activeUsers.findIndex(user => user.id === sender.id) === -1) {
|
|
113
|
+
if (activeUsers.findIndex((user) => user.id === sender.id) === -1) {
|
|
161
114
|
activeUsers.push(sender);
|
|
162
115
|
internalModel.setProperty(ACTIVEUSERS, activeUsers);
|
|
163
116
|
}
|
|
164
117
|
|
|
165
118
|
if (message.userAction === Activity.Join) {
|
|
166
119
|
// we echo our existence to the newly entered user and also send the current activity if there is any
|
|
167
|
-
|
|
168
|
-
clientAction: Activity.JoinEcho,
|
|
169
|
-
clientContent: internalModel.getProperty(MYACTIVITY)
|
|
170
|
-
});
|
|
171
|
-
// TODO: echo current activity
|
|
120
|
+
broadcastCollaborationMessage(Activity.JoinEcho, internalModel.getProperty(MYACTIVITY), internalModel);
|
|
172
121
|
}
|
|
173
122
|
|
|
174
123
|
if (message.userAction === Activity.JoinEcho) {
|
|
175
124
|
if (message.clientContent) {
|
|
176
125
|
// another user was already typing therefore I want to see his activity immediately. Calling me again as a live change
|
|
177
126
|
message.userAction = Activity.LiveChange;
|
|
178
|
-
messageReceive(message, view
|
|
127
|
+
messageReceive(message, view);
|
|
179
128
|
}
|
|
180
129
|
}
|
|
181
130
|
|
|
182
131
|
break;
|
|
183
132
|
case Activity.Leave:
|
|
184
133
|
// Removing the active user. Not removing "me" if I had the screen open in another session
|
|
185
|
-
activeUsers = activeUsers.filter(user => user.id !== sender.id || user.me);
|
|
134
|
+
activeUsers = activeUsers.filter((user) => user.id !== sender.id || user.me);
|
|
186
135
|
internalModel.setProperty(ACTIVEUSERS, activeUsers);
|
|
187
136
|
const allActivities = internalModel.getProperty(ACTIVITIES) || {};
|
|
188
|
-
const removeUserActivities = function(bag: any) {
|
|
137
|
+
const removeUserActivities = function (bag: any) {
|
|
189
138
|
if (Array.isArray(bag)) {
|
|
190
|
-
return bag.filter(activity => activity.id !== sender.id);
|
|
139
|
+
return bag.filter((activity) => activity.id !== sender.id);
|
|
191
140
|
} else {
|
|
192
141
|
for (const p in bag) {
|
|
193
142
|
bag[p] = removeUserActivities(bag[p]);
|
|
@@ -200,12 +149,23 @@ function messageReceive(message: Message, view: View, webSocket: any) {
|
|
|
200
149
|
break;
|
|
201
150
|
|
|
202
151
|
case Activity.Change:
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
internalModel.setProperty(ACTIVITIES + metaPath, currentActivities);
|
|
152
|
+
const metaPaths = message?.clientContent?.split("|").map((path) => {
|
|
153
|
+
return (view.getModel().getMetaModel() as ODataMetaModel).getMetaPath(path);
|
|
154
|
+
});
|
|
207
155
|
|
|
208
|
-
|
|
156
|
+
metaPaths.forEach((metaPath, i) => {
|
|
157
|
+
const nesteedMessage = {
|
|
158
|
+
...message,
|
|
159
|
+
clientContent: message?.clientContent?.split("|")[i]
|
|
160
|
+
};
|
|
161
|
+
let currentActivities: any[] = internalModel.getProperty(ACTIVITIES + metaPath) || [];
|
|
162
|
+
activityKey = getActivityKey(nesteedMessage.clientContent);
|
|
163
|
+
currentActivities = currentActivities?.filter && currentActivities.filter((activity) => activity.key !== activityKey);
|
|
164
|
+
if (currentActivities) {
|
|
165
|
+
internalModel.setProperty(ACTIVITIES + metaPath, currentActivities);
|
|
166
|
+
update(view, nesteedMessage, metaPath, Activity.Change);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
209
169
|
break;
|
|
210
170
|
case Activity.Create:
|
|
211
171
|
// For create we actually just need to refresh the table
|
|
@@ -217,12 +177,12 @@ function messageReceive(message: Message, view: View, webSocket: any) {
|
|
|
217
177
|
break;
|
|
218
178
|
case Activity.Activate:
|
|
219
179
|
disconnect(view);
|
|
220
|
-
MessageBox.information(getText("C_COLLABORATIONDRAFT_ACTIVATE", sender.name));
|
|
180
|
+
MessageBox.information(CollaborationUtils.getText("C_COLLABORATIONDRAFT_ACTIVATE", sender.name));
|
|
221
181
|
navigate(message.clientContent, view);
|
|
222
182
|
break;
|
|
223
183
|
case Activity.Discard:
|
|
224
184
|
disconnect(view);
|
|
225
|
-
MessageBox.information(getText("C_COLLABORATIONDRAFT_DISCARD", sender.name));
|
|
185
|
+
MessageBox.information(CollaborationUtils.getText("C_COLLABORATIONDRAFT_DISCARD", sender.name));
|
|
226
186
|
navigate(message.clientContent, view);
|
|
227
187
|
break;
|
|
228
188
|
/*
|
|
@@ -248,7 +208,7 @@ function messageReceive(message: Message, view: View, webSocket: any) {
|
|
|
248
208
|
}
|
|
249
209
|
|
|
250
210
|
activities = internalModel.getProperty(ACTIVITIES + metaPath);
|
|
251
|
-
activities = activities ? activities.slice() : [];
|
|
211
|
+
activities = activities?.slice ? activities.slice() : [];
|
|
252
212
|
activities.push(activity);
|
|
253
213
|
internalModel.setProperty(ACTIVITIES + metaPath, activities);
|
|
254
214
|
break;
|
|
@@ -258,7 +218,7 @@ function messageReceive(message: Message, view: View, webSocket: any) {
|
|
|
258
218
|
activityKey = getActivityKey(message.clientContent);
|
|
259
219
|
internalModel.setProperty(
|
|
260
220
|
ACTIVITIES + metaPath,
|
|
261
|
-
activities.filter(a => a.key !== activityKey)
|
|
221
|
+
activities.filter((a) => a.key !== activityKey)
|
|
262
222
|
);
|
|
263
223
|
break;
|
|
264
224
|
}
|
|
@@ -268,7 +228,7 @@ function update(view: View, message: Message, metaPath: string, action: Activity
|
|
|
268
228
|
const appComponent = CollaborationUtils.getAppComponent(view);
|
|
269
229
|
const metaModel = view.getModel().getMetaModel() as ODataMetaModel;
|
|
270
230
|
const currentPage = getCurrentPage(view);
|
|
271
|
-
const sideEffectsService =
|
|
231
|
+
const sideEffectsService = appComponent.getSideEffectsService();
|
|
272
232
|
const currentContext = currentPage.getBindingContext();
|
|
273
233
|
const currentPath = currentContext.getPath();
|
|
274
234
|
const currentMetaPath = metaModel.getMetaPath(currentPath);
|
|
@@ -277,12 +237,13 @@ function update(view: View, message: Message, metaPath: string, action: Activity
|
|
|
277
237
|
if (action === Activity.Delete) {
|
|
278
238
|
// check if user currently displays one deleted object
|
|
279
239
|
const deletedObjects = message.clientContent.split("|");
|
|
280
|
-
|
|
240
|
+
const parentDeletedIndex = deletedObjects.findIndex((deletedObject) => currentPath.startsWith(deletedObject));
|
|
241
|
+
if (parentDeletedIndex > -1) {
|
|
281
242
|
// any other user deleted the object I'm currently looking at. Inform the user we will navigate to root now
|
|
282
|
-
MessageBox.information(getText("C_COLLABORATIONDRAFT_DELETE", message.userDescription), {
|
|
283
|
-
onClose: function() {
|
|
284
|
-
|
|
285
|
-
|
|
243
|
+
MessageBox.information(CollaborationUtils.getText("C_COLLABORATIONDRAFT_DELETE", message.userDescription), {
|
|
244
|
+
onClose: function () {
|
|
245
|
+
const targetContext = view.getModel().bindContext(deletedObjects[parentDeletedIndex]).getBoundContext();
|
|
246
|
+
currentPage.getController()._routing.navigateBackFromContext(targetContext);
|
|
286
247
|
}
|
|
287
248
|
});
|
|
288
249
|
}
|
|
@@ -301,7 +262,7 @@ function update(view: View, message: Message, metaPath: string, action: Activity
|
|
|
301
262
|
}
|
|
302
263
|
];
|
|
303
264
|
const entityType = sideEffectsService.getEntityTypeFromContext(currentContext);
|
|
304
|
-
const entityTypeSideEffects = sideEffectsService.getODataEntitySideEffects(entityType);
|
|
265
|
+
const entityTypeSideEffects = sideEffectsService.getODataEntitySideEffects(entityType!);
|
|
305
266
|
// Poor man solution without checking source targets, just for POC, this is throw-way coding only
|
|
306
267
|
const object: any = Object; // just to overcome TS issues, will be anyway replaced
|
|
307
268
|
const relevantSideEffects = object.fromEntries(
|
|
@@ -310,7 +271,7 @@ function update(view: View, message: Message, metaPath: string, action: Activity
|
|
|
310
271
|
.filter((x: any[]) => x[1].SourceProperties?.findIndex((source: any) => source.value === activityPath) > -1)
|
|
311
272
|
);
|
|
312
273
|
for (const p in relevantSideEffects) {
|
|
313
|
-
relevantSideEffects[p].TargetProperties.forEach(function(targetProperty: any) {
|
|
274
|
+
relevantSideEffects[p].TargetProperties.forEach(function (targetProperty: any) {
|
|
314
275
|
sideEffects.push({
|
|
315
276
|
$PropertyPath: targetProperty
|
|
316
277
|
});
|
|
@@ -327,29 +288,26 @@ function update(view: View, message: Message, metaPath: string, action: Activity
|
|
|
327
288
|
function navigate(path: string, view: View) {
|
|
328
289
|
// TODO: routing.navigate doesn't consider semantic bookmarking
|
|
329
290
|
const currentPage = getCurrentPage(view);
|
|
330
|
-
const targetContext = view
|
|
331
|
-
.getModel()
|
|
332
|
-
.bindContext(path)
|
|
333
|
-
.getBoundContext();
|
|
291
|
+
const targetContext = view.getModel().bindContext(path).getBoundContext();
|
|
334
292
|
currentPage.getController().routing.navigate(targetContext);
|
|
335
293
|
}
|
|
336
294
|
|
|
337
295
|
function getCurrentPage(view: View) {
|
|
338
296
|
const appComponent = CollaborationUtils.getAppComponent(view);
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
.
|
|
343
|
-
.getCurrentPage()
|
|
344
|
-
.getComponentInstance()
|
|
345
|
-
.getRootControl();
|
|
297
|
+
const rootViewController = appComponent.getRootViewController() as any;
|
|
298
|
+
return rootViewController.isFclEnabled()
|
|
299
|
+
? rootViewController.getRightmostView()
|
|
300
|
+
: CommonUtils.getTargetView((appComponent.getRootContainer() as any).getCurrentPage());
|
|
346
301
|
}
|
|
347
302
|
|
|
348
303
|
function getActivityKey(x: string): string {
|
|
349
304
|
return x.substring(x.lastIndexOf("(") + 1, x.lastIndexOf(")"));
|
|
350
305
|
}
|
|
351
306
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
307
|
+
export default {
|
|
308
|
+
connect: connect,
|
|
309
|
+
disconnect: disconnect,
|
|
310
|
+
isConnected: isConnected,
|
|
311
|
+
isCollaborationEnabled: isCollaborationEnabled,
|
|
312
|
+
send: send
|
|
313
|
+
};
|
|
@@ -0,0 +1,146 @@
|
|
|
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/ui/core/Component", "sap/ui/core/Core"], function (Component, Core) {
|
|
6
|
+
"use strict";
|
|
7
|
+
|
|
8
|
+
var _exports = {};
|
|
9
|
+
|
|
10
|
+
var Role;
|
|
11
|
+
|
|
12
|
+
(function (Role) {
|
|
13
|
+
Role["Owner"] = "O";
|
|
14
|
+
Role["Edit"] = "E";
|
|
15
|
+
})(Role || (Role = {}));
|
|
16
|
+
|
|
17
|
+
_exports.Role = Role;
|
|
18
|
+
var Activity;
|
|
19
|
+
|
|
20
|
+
(function (Activity) {
|
|
21
|
+
Activity["Join"] = "JOIN";
|
|
22
|
+
Activity["JoinEcho"] = "JOINECHO";
|
|
23
|
+
Activity["Leave"] = "LEAVE";
|
|
24
|
+
Activity["Change"] = "CHANGE";
|
|
25
|
+
Activity["Create"] = "CREATE";
|
|
26
|
+
Activity["Delete"] = "DELETE";
|
|
27
|
+
Activity["Action"] = "ACTION";
|
|
28
|
+
Activity["LiveChange"] = "LIVECHANGE";
|
|
29
|
+
Activity["Activate"] = "ACTIVATE";
|
|
30
|
+
Activity["Discard"] = "DISCARD";
|
|
31
|
+
Activity["Undo"] = "UNDO";
|
|
32
|
+
})(Activity || (Activity = {}));
|
|
33
|
+
|
|
34
|
+
_exports.Activity = Activity;
|
|
35
|
+
|
|
36
|
+
function formatInitials(fullName) {
|
|
37
|
+
// remove titles - those are the ones from S/4 to be checked if there are others
|
|
38
|
+
var academicTitles = ["Dr.", "Prof.", "Prof. Dr.", "B.A.", "MBA", "Ph.D."];
|
|
39
|
+
academicTitles.forEach(function (academicTitle) {
|
|
40
|
+
fullName = fullName.replace(academicTitle, "");
|
|
41
|
+
});
|
|
42
|
+
var initials;
|
|
43
|
+
var parts = fullName.trimStart().split(" ");
|
|
44
|
+
|
|
45
|
+
if (parts.length > 1) {
|
|
46
|
+
var _parts$shift, _parts$pop;
|
|
47
|
+
|
|
48
|
+
initials = ((parts === null || parts === void 0 ? void 0 : (_parts$shift = parts.shift()) === null || _parts$shift === void 0 ? void 0 : _parts$shift.charAt(0)) || "") + ((_parts$pop = parts.pop()) === null || _parts$pop === void 0 ? void 0 : _parts$pop.charAt(0));
|
|
49
|
+
} else {
|
|
50
|
+
initials = fullName.substring(0, 2);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return initials.toUpperCase();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function getUserColor(UserID, activeUsers, invitedUsers) {
|
|
57
|
+
// search if user is known
|
|
58
|
+
var user = activeUsers.find(function (u) {
|
|
59
|
+
return u.id === UserID;
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
if (user) {
|
|
63
|
+
return user.color;
|
|
64
|
+
} else {
|
|
65
|
+
var _loop = function (i) {
|
|
66
|
+
if (activeUsers.findIndex(function (u) {
|
|
67
|
+
return u.color === i;
|
|
68
|
+
}) === -1 && invitedUsers.findIndex(function (u) {
|
|
69
|
+
return u.color === i;
|
|
70
|
+
}) === -1) {
|
|
71
|
+
return {
|
|
72
|
+
v: i
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// search for next free color
|
|
78
|
+
for (var i = 1; i <= 10; i++) {
|
|
79
|
+
var _ret = _loop(i);
|
|
80
|
+
|
|
81
|
+
if (typeof _ret === "object") return _ret.v;
|
|
82
|
+
} // this seems to be a popular object :) for now just return 10 for all.
|
|
83
|
+
// for invited we should start from 1 again so the colors are different
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
return 10;
|
|
87
|
+
}
|
|
88
|
+
} // copied from CommonUtils. Due to a cycle dependency I can't use CommonUtils here.
|
|
89
|
+
// That's to be fixed. the discard popover thingy shouldn't be in the common utils at all
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
function getAppComponent(oControl) {
|
|
93
|
+
if (oControl.isA("sap.fe.core.AppComponent")) {
|
|
94
|
+
return oControl;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
var oOwner = Component.getOwnerComponentFor(oControl);
|
|
98
|
+
|
|
99
|
+
if (!oOwner) {
|
|
100
|
+
return oControl;
|
|
101
|
+
} else {
|
|
102
|
+
return getAppComponent(oOwner);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function getMe(view) {
|
|
107
|
+
var shellServiceHelper = getAppComponent(view).getShellServices();
|
|
108
|
+
|
|
109
|
+
if (!shellServiceHelper || !shellServiceHelper.hasUShell()) {
|
|
110
|
+
throw "No Shell... No User";
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
var me = {
|
|
114
|
+
initials: shellServiceHelper.getUser().getInitials(),
|
|
115
|
+
id: shellServiceHelper.getUser().getId(),
|
|
116
|
+
name: shellServiceHelper.getUser().getFullName() + " (" + getText("C_COLLABORATIONDRAFT_YOU") + ")",
|
|
117
|
+
initialName: shellServiceHelper.getUser().getFullName(),
|
|
118
|
+
color: 6,
|
|
119
|
+
// same color as FLP...
|
|
120
|
+
role: Role.Owner,
|
|
121
|
+
me: true
|
|
122
|
+
};
|
|
123
|
+
return me;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function getText(textId) {
|
|
127
|
+
var oResourceModel = Core.getLibraryResourceBundle("sap.fe.core");
|
|
128
|
+
|
|
129
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
130
|
+
args[_key - 1] = arguments[_key];
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return oResourceModel.getText(textId, args);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
var CollaborationUtils = {
|
|
137
|
+
formatInitials: formatInitials,
|
|
138
|
+
getUserColor: getUserColor,
|
|
139
|
+
getMe: getMe,
|
|
140
|
+
getAppComponent: getAppComponent,
|
|
141
|
+
getText: getText
|
|
142
|
+
};
|
|
143
|
+
_exports.CollaborationUtils = CollaborationUtils;
|
|
144
|
+
return _exports;
|
|
145
|
+
}, false);
|
|
146
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzI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Vzb3VyY2VNb2RlbCA9IChDb3JlIGFzIENvcmVFeCkuZ2V0TGlicmFyeVJlc291cmNlQnVuZGxlKFwic2FwLmZlLmNvcmVcIik7XG5cdHJldHVybiBvUmVzb3VyY2VNb2RlbC5nZXRUZXh0KHRleHRJZCwgYXJncyk7XG59XG5cbmV4cG9ydCBjb25zdCBDb2xsYWJvcmF0aW9uVXRpbHMgPSB7XG5cdGZvcm1hdEluaXRpYWxzOiBmb3JtYXRJbml0aWFscyxcblx0Z2V0VXNlckNvbG9yOiBnZXRVc2VyQ29sb3IsXG5cdGdldE1lOiBnZXRNZSxcblx0Z2V0QXBwQ29tcG9uZW50OiBnZXRBcHBDb21wb25lbnQsXG5cdGdldFRleHQ6IGdldFRleHRcbn07XG4iXX0=
|
package/src/sap/fe/core/{actions → controllerextensions}/collaboration/CollaborationCommon.ts
RENAMED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import View from "sap/ui/core/mvc/View";
|
|
2
|
-
import Component from "sap/ui/core/Component";
|
|
3
1
|
import AppComponent from "sap/fe/core/AppComponent";
|
|
2
|
+
import Component from "sap/ui/core/Component";
|
|
3
|
+
import Core from "sap/ui/core/Core";
|
|
4
|
+
import View from "sap/ui/core/mvc/View";
|
|
5
|
+
import { CoreEx } from "../../../../../../../../types/extension_types";
|
|
4
6
|
|
|
5
7
|
export type User = {
|
|
6
8
|
id: string;
|
|
@@ -10,6 +12,7 @@ export type User = {
|
|
|
10
12
|
color?: number;
|
|
11
13
|
transient?: boolean;
|
|
12
14
|
me?: boolean;
|
|
15
|
+
initialName?: string;
|
|
13
16
|
};
|
|
14
17
|
|
|
15
18
|
export type UserActivity = User & {
|
|
@@ -46,7 +49,7 @@ export type Message = {
|
|
|
46
49
|
function formatInitials(fullName: string): string {
|
|
47
50
|
// remove titles - those are the ones from S/4 to be checked if there are others
|
|
48
51
|
const academicTitles = ["Dr.", "Prof.", "Prof. Dr.", "B.A.", "MBA", "Ph.D."];
|
|
49
|
-
academicTitles.forEach(function(academicTitle) {
|
|
52
|
+
academicTitles.forEach(function (academicTitle) {
|
|
50
53
|
fullName = fullName.replace(academicTitle, "");
|
|
51
54
|
});
|
|
52
55
|
|
|
@@ -64,13 +67,13 @@ function formatInitials(fullName: string): string {
|
|
|
64
67
|
|
|
65
68
|
function getUserColor(UserID: string, activeUsers: User[], invitedUsers: User[]) {
|
|
66
69
|
// search if user is known
|
|
67
|
-
const user = activeUsers.find(u => u.id === UserID);
|
|
70
|
+
const user = activeUsers.find((u) => u.id === UserID);
|
|
68
71
|
if (user) {
|
|
69
72
|
return user.color;
|
|
70
73
|
} else {
|
|
71
74
|
// search for next free color
|
|
72
75
|
for (let i = 1; i <= 10; i++) {
|
|
73
|
-
if (activeUsers.findIndex(u => u.color === i) === -1 && invitedUsers.findIndex(u => u.color === i) === -1) {
|
|
76
|
+
if (activeUsers.findIndex((u) => u.color === i) === -1 && invitedUsers.findIndex((u) => u.color === i) === -1) {
|
|
74
77
|
return i;
|
|
75
78
|
}
|
|
76
79
|
}
|
|
@@ -102,18 +105,25 @@ function getMe(view: View): User {
|
|
|
102
105
|
const me: User = {
|
|
103
106
|
initials: shellServiceHelper.getUser().getInitials(),
|
|
104
107
|
id: shellServiceHelper.getUser().getId(),
|
|
105
|
-
name: shellServiceHelper.getUser().getFullName(),
|
|
108
|
+
name: shellServiceHelper.getUser().getFullName() + " (" + getText("C_COLLABORATIONDRAFT_YOU") + ")",
|
|
109
|
+
initialName: shellServiceHelper.getUser().getFullName(),
|
|
106
110
|
color: 6, // same color as FLP...
|
|
107
111
|
role: Role.Owner,
|
|
108
112
|
me: true
|
|
109
113
|
};
|
|
110
|
-
|
|
114
|
+
|
|
111
115
|
return me;
|
|
112
116
|
}
|
|
113
117
|
|
|
118
|
+
function getText(textId: string, ...args: string[]): string {
|
|
119
|
+
const oResourceModel = (Core as CoreEx).getLibraryResourceBundle("sap.fe.core");
|
|
120
|
+
return oResourceModel.getText(textId, args);
|
|
121
|
+
}
|
|
122
|
+
|
|
114
123
|
export const CollaborationUtils = {
|
|
115
124
|
formatInitials: formatInitials,
|
|
116
125
|
getUserColor: getUserColor,
|
|
117
126
|
getMe: getMe,
|
|
118
|
-
getAppComponent: getAppComponent
|
|
127
|
+
getAppComponent: getAppComponent,
|
|
128
|
+
getText: getText
|
|
119
129
|
};
|