@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,15 +1,73 @@
|
|
|
1
|
-
import
|
|
1
|
+
import merge from "sap/base/util/merge";
|
|
2
2
|
import ObjectPath from "sap/base/util/ObjectPath";
|
|
3
|
-
import ElementMetadata from "sap/ui/core/ElementMetadata";
|
|
4
|
-
import RenderManager from "sap/ui/core/RenderManager";
|
|
5
|
-
import Metadata from "sap/ui/base/Metadata";
|
|
6
|
-
import ControllerExtensionMetadata from "sap/fe/core/controllerextensions/ControllerExtensionMetadata";
|
|
7
|
-
import ControllerMetadata from "sap/ui/core/mvc/ControllerMetadata";
|
|
8
3
|
import uid from "sap/base/util/uid";
|
|
9
|
-
import merge from "sap/base/util/merge";
|
|
10
4
|
import UI5Event from "sap/ui/base/Event";
|
|
5
|
+
import Metadata from "sap/ui/base/Metadata";
|
|
6
|
+
import ControllerExtension from "sap/ui/core/mvc/ControllerExtension";
|
|
7
|
+
import ControllerMetadata from "sap/ui/core/mvc/ControllerMetadata";
|
|
8
|
+
import OverrideExecution from "sap/ui/core/mvc/OverrideExecution";
|
|
11
9
|
|
|
12
|
-
|
|
10
|
+
type OverrideDefinition = Record<string, Function>;
|
|
11
|
+
type UI5ControllerMethodDefinition = {
|
|
12
|
+
overrideExecution?: OverrideExecution;
|
|
13
|
+
public?: boolean;
|
|
14
|
+
final?: boolean;
|
|
15
|
+
};
|
|
16
|
+
type UI5PropertyMetadata = {
|
|
17
|
+
type: string;
|
|
18
|
+
required?: boolean;
|
|
19
|
+
group?: string;
|
|
20
|
+
defaultValue?: any;
|
|
21
|
+
};
|
|
22
|
+
type UI5AggregationMetadata = {
|
|
23
|
+
type: string;
|
|
24
|
+
multiple?: boolean;
|
|
25
|
+
isDefault?: boolean;
|
|
26
|
+
singularName?: string;
|
|
27
|
+
visibility?: string;
|
|
28
|
+
};
|
|
29
|
+
type UI5AssociationMetadata = {
|
|
30
|
+
type: string;
|
|
31
|
+
multiple?: boolean;
|
|
32
|
+
singularName?: string;
|
|
33
|
+
};
|
|
34
|
+
type UI5ControlMetadataDefinition = {
|
|
35
|
+
defaultAggregation?: string;
|
|
36
|
+
controllerExtensions: Record<string, typeof ControllerExtension | Function>;
|
|
37
|
+
properties: Record<string, UI5PropertyMetadata>;
|
|
38
|
+
macroContexts: Record<string, UI5PropertyMetadata>;
|
|
39
|
+
aggregations: Record<string, UI5AggregationMetadata>;
|
|
40
|
+
associations: Record<string, UI5AssociationMetadata>;
|
|
41
|
+
methods: Record<string, UI5ControllerMethodDefinition>;
|
|
42
|
+
events: Record<string, {}>;
|
|
43
|
+
interfaces: string[];
|
|
44
|
+
};
|
|
45
|
+
type UI5Controller = {
|
|
46
|
+
override?: { extension?: Record<string, OverrideDefinition> } & {
|
|
47
|
+
[k: string]: Function;
|
|
48
|
+
};
|
|
49
|
+
metadata?: UI5ControlMetadataDefinition;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
type UI5Control = {
|
|
53
|
+
metadata?: UI5ControlMetadataDefinition;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
type UI5APIControl = UI5Control & {
|
|
57
|
+
getAPI(event: UI5Event): UI5APIControl;
|
|
58
|
+
[k: string]: Function;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
type ControlPropertyNames<T> = {
|
|
62
|
+
[K in keyof T]: T[K] extends Function ? never : K;
|
|
63
|
+
}[keyof T];
|
|
64
|
+
export type PropertiesOf<T> = Partial<Pick<T, ControlPropertyNames<T>>>;
|
|
65
|
+
export type StrictPropertiesOf<T> = Pick<T, ControlPropertyNames<T>>;
|
|
66
|
+
export type EnhanceWithUI5<T> = T & {
|
|
67
|
+
// Add all the getXXX method, might add too much as i'm not filtering on actual properties actually...
|
|
68
|
+
[P in keyof T as `get${Capitalize<string & P>}`]: () => T[P];
|
|
69
|
+
};
|
|
70
|
+
const ensureMetadata = function (target: UI5Controller) {
|
|
13
71
|
target.metadata = merge(
|
|
14
72
|
{
|
|
15
73
|
controllerExtensions: {},
|
|
@@ -18,205 +76,259 @@ const ensureMetadata = function(target: any) {
|
|
|
18
76
|
aggregations: {},
|
|
19
77
|
associations: {},
|
|
20
78
|
methods: {},
|
|
21
|
-
events: {}
|
|
79
|
+
events: {},
|
|
80
|
+
interfaces: []
|
|
22
81
|
},
|
|
23
82
|
target.metadata || {}
|
|
24
|
-
);
|
|
83
|
+
) as UI5ControlMetadataDefinition;
|
|
25
84
|
return target.metadata;
|
|
26
85
|
};
|
|
27
|
-
|
|
28
|
-
|
|
86
|
+
|
|
87
|
+
/* #region CONTROLLER EXTENSIONS */
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Defines that the following method is an override for the method name with the same name in the specific controller extension or base implementation.
|
|
91
|
+
*
|
|
92
|
+
* @param extensionName The name of the extension that will be overriden
|
|
93
|
+
* @returns The decorated method
|
|
94
|
+
*/
|
|
95
|
+
export function methodOverride(extensionName?: string): MethodDecorator {
|
|
96
|
+
return function (target: UI5Controller, propertyKey) {
|
|
29
97
|
if (!target.override) {
|
|
30
98
|
target.override = {};
|
|
31
99
|
}
|
|
32
100
|
let currentTarget = target.override;
|
|
33
|
-
if (
|
|
101
|
+
if (extensionName) {
|
|
34
102
|
if (!currentTarget.extension) {
|
|
35
103
|
currentTarget.extension = {};
|
|
36
104
|
}
|
|
37
|
-
if (!currentTarget.extension[
|
|
38
|
-
currentTarget.extension[
|
|
105
|
+
if (!currentTarget.extension[extensionName]) {
|
|
106
|
+
currentTarget.extension[extensionName] = {};
|
|
39
107
|
}
|
|
40
|
-
currentTarget = currentTarget.extension[
|
|
108
|
+
currentTarget = currentTarget.extension[extensionName];
|
|
41
109
|
}
|
|
42
|
-
currentTarget[propertyKey] = target[propertyKey];
|
|
110
|
+
currentTarget[propertyKey.toString()] = (target as any)[propertyKey.toString()];
|
|
43
111
|
};
|
|
44
112
|
}
|
|
45
|
-
|
|
46
|
-
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Defines that the method can be extended by other controller extension based on the defined overrideExecutionType.
|
|
116
|
+
*
|
|
117
|
+
* @param overrideExecutionType The OverrideExecution defining when the override should run (Before / After / Instead)
|
|
118
|
+
* @returns The decorated method
|
|
119
|
+
*/
|
|
120
|
+
export function extensible(overrideExecutionType?: OverrideExecution): MethodDecorator {
|
|
121
|
+
return function (target: UI5Controller, propertyKey) {
|
|
47
122
|
const metadata = ensureMetadata(target);
|
|
48
|
-
if (!metadata.methods[propertyKey]) {
|
|
49
|
-
metadata.methods[propertyKey] = {};
|
|
123
|
+
if (!metadata.methods[propertyKey.toString()]) {
|
|
124
|
+
metadata.methods[propertyKey.toString()] = {};
|
|
50
125
|
}
|
|
51
|
-
metadata.methods[propertyKey].overrideExecution =
|
|
126
|
+
metadata.methods[propertyKey.toString()].overrideExecution = overrideExecutionType;
|
|
52
127
|
};
|
|
53
128
|
}
|
|
54
|
-
export function Public(target: any, propertyKey: string, descriptor: any): any {
|
|
55
|
-
const metadata = ensureMetadata(target);
|
|
56
|
-
descriptor.enumerable = true;
|
|
57
|
-
if (!metadata.methods[propertyKey]) {
|
|
58
|
-
metadata.methods[propertyKey] = {};
|
|
59
|
-
}
|
|
60
|
-
metadata.methods[propertyKey].public = true;
|
|
61
|
-
}
|
|
62
|
-
export function Private(target: any, propertyKey: string, descriptor: any) {
|
|
63
|
-
const metadata = ensureMetadata(target);
|
|
64
|
-
descriptor.enumerable = true;
|
|
65
|
-
if (!metadata.methods[propertyKey]) {
|
|
66
|
-
metadata.methods[propertyKey] = {};
|
|
67
|
-
}
|
|
68
|
-
metadata.methods[propertyKey].public = false;
|
|
69
|
-
}
|
|
70
|
-
export function Final(target: any, propertyKey: string, descriptor: any) {
|
|
71
|
-
const metadata = ensureMetadata(target);
|
|
72
|
-
descriptor.enumerable = true;
|
|
73
|
-
if (!metadata.methods[propertyKey]) {
|
|
74
|
-
metadata.methods[propertyKey] = {};
|
|
75
|
-
}
|
|
76
|
-
metadata.methods[propertyKey].final = true;
|
|
77
|
-
}
|
|
78
129
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
130
|
+
/**
|
|
131
|
+
* Defines that the method will be publicly available for controller extension usage.
|
|
132
|
+
*
|
|
133
|
+
* @returns The decorated method
|
|
134
|
+
*/
|
|
135
|
+
export function publicExtension(): MethodDecorator {
|
|
136
|
+
return function (target: UI5Controller, propertyKey, descriptor): void {
|
|
137
|
+
const metadata = ensureMetadata(target);
|
|
138
|
+
descriptor.enumerable = true;
|
|
139
|
+
if (!metadata.methods[propertyKey.toString()]) {
|
|
140
|
+
metadata.methods[propertyKey.toString()] = {};
|
|
141
|
+
}
|
|
142
|
+
metadata.methods[propertyKey.toString()].public = true;
|
|
143
|
+
};
|
|
84
144
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
145
|
+
/**
|
|
146
|
+
* Defines that the method will be only available for internal usage of the controller extension.
|
|
147
|
+
*
|
|
148
|
+
* @returns The decorated method
|
|
149
|
+
*/
|
|
150
|
+
export function privateExtension(): MethodDecorator {
|
|
151
|
+
return function (target: UI5Controller, propertyKey, descriptor) {
|
|
152
|
+
const metadata = ensureMetadata(target);
|
|
153
|
+
descriptor.enumerable = true;
|
|
154
|
+
if (!metadata.methods[propertyKey.toString()]) {
|
|
155
|
+
metadata.methods[propertyKey.toString()] = {};
|
|
156
|
+
}
|
|
157
|
+
metadata.methods[propertyKey.toString()].public = false;
|
|
90
158
|
};
|
|
91
159
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
160
|
+
/**
|
|
161
|
+
* Defines that the method cannot be further extended by other controller extension.
|
|
162
|
+
*
|
|
163
|
+
* @returns The decorated method
|
|
164
|
+
*/
|
|
165
|
+
export function finalExtension(): MethodDecorator {
|
|
166
|
+
return function (target: UI5Controller, propertyKey, descriptor) {
|
|
167
|
+
const metadata = ensureMetadata(target);
|
|
168
|
+
descriptor.enumerable = true;
|
|
169
|
+
if (!metadata.methods[propertyKey.toString()]) {
|
|
170
|
+
metadata.methods[propertyKey.toString()] = {};
|
|
171
|
+
}
|
|
172
|
+
metadata.methods[propertyKey.toString()].final = true;
|
|
173
|
+
};
|
|
95
174
|
}
|
|
96
175
|
|
|
97
|
-
|
|
98
|
-
|
|
176
|
+
/**
|
|
177
|
+
* Defines that we are going to use instantiate a controller extension under the following variable name.
|
|
178
|
+
*
|
|
179
|
+
* @param extensionClass The controller extension that will be instantiated
|
|
180
|
+
* @returns The decorated property
|
|
181
|
+
*/
|
|
182
|
+
export function usingExtension(extensionClass: typeof ControllerExtension | Function): PropertyDecorator {
|
|
183
|
+
return function (target: UI5Controller, propertyKey: string, propertyDescriptor: TypedPropertyDescriptor<any>) {
|
|
99
184
|
const metadata = ensureMetadata(target);
|
|
100
185
|
delete (propertyDescriptor as any).initializer;
|
|
101
|
-
metadata.controllerExtensions[propertyKey] = extensionClass;
|
|
186
|
+
metadata.controllerExtensions[propertyKey.toString()] = extensionClass;
|
|
102
187
|
return propertyDescriptor;
|
|
103
|
-
};
|
|
188
|
+
} as any; // This is technically an accessor decorator, but somehow the compiler doesn't like it if i declare it as such.
|
|
104
189
|
}
|
|
105
|
-
|
|
106
|
-
|
|
190
|
+
|
|
191
|
+
/* #endregion */
|
|
192
|
+
|
|
193
|
+
/* #region CONTROL */
|
|
194
|
+
/**
|
|
195
|
+
* Indicates that the property shall be declared as an event on the control metadata.
|
|
196
|
+
*
|
|
197
|
+
* @returns The decorated property
|
|
198
|
+
*/
|
|
199
|
+
export function event(): PropertyDecorator {
|
|
200
|
+
return function (target: UI5Control, eventKey) {
|
|
107
201
|
const metadata = ensureMetadata(target);
|
|
108
|
-
if (
|
|
109
|
-
|
|
110
|
-
metadata.macroContexts[propertyKey] = oPropertyParams;
|
|
111
|
-
}
|
|
202
|
+
if (!metadata.events[eventKey.toString()]) {
|
|
203
|
+
metadata.events[eventKey.toString()] = {};
|
|
112
204
|
}
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Defines the following property in the control metatada.
|
|
210
|
+
*
|
|
211
|
+
* @param ui5PropertyMetadata The property definition
|
|
212
|
+
* @returns The decorated property.
|
|
213
|
+
*/
|
|
214
|
+
export function property(ui5PropertyMetadata: UI5PropertyMetadata): PropertyDecorator {
|
|
215
|
+
return function (target: UI5Control, propertyKey: string, propertyDescriptor: TypedPropertyDescriptor<any>) {
|
|
216
|
+
const metadata = ensureMetadata(target);
|
|
113
217
|
if (!metadata.properties[propertyKey]) {
|
|
114
|
-
metadata.properties[propertyKey] =
|
|
218
|
+
metadata.properties[propertyKey] = ui5PropertyMetadata;
|
|
115
219
|
}
|
|
116
220
|
delete propertyDescriptor.writable;
|
|
117
221
|
delete (propertyDescriptor as any).initializer;
|
|
118
|
-
// (propertyDescriptor as any).set = function(v: any) {
|
|
119
|
-
// return this.setProperty(propertyKey, v);
|
|
120
|
-
// };
|
|
121
|
-
// (propertyDescriptor as any).get = function() {
|
|
122
|
-
// return this.getProperty(propertyKey);
|
|
123
|
-
// };
|
|
124
222
|
|
|
125
223
|
return propertyDescriptor;
|
|
126
|
-
};
|
|
224
|
+
} as any; // This is technically an accessor decorator, but somehow the compiler doesn't like it if i declare it as such.;
|
|
127
225
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
226
|
+
/**
|
|
227
|
+
* Defines and configure the following aggregation in the control metatada.
|
|
228
|
+
*
|
|
229
|
+
* @param ui5AggregationMetadata The aggregation definition
|
|
230
|
+
* @returns The decorated property.
|
|
231
|
+
*/
|
|
232
|
+
export function aggregation(ui5AggregationMetadata: UI5AggregationMetadata): PropertyDecorator {
|
|
233
|
+
return function (target: UI5Control, propertyKey: string, propertyDescriptor: TypedPropertyDescriptor<any>) {
|
|
131
234
|
const metadata = ensureMetadata(target);
|
|
235
|
+
if (ui5AggregationMetadata.multiple === undefined) {
|
|
236
|
+
// UI5 defaults this to true but this is just weird...
|
|
237
|
+
ui5AggregationMetadata.multiple = false;
|
|
238
|
+
}
|
|
132
239
|
if (!metadata.aggregations[propertyKey]) {
|
|
133
|
-
metadata.aggregations[propertyKey] =
|
|
240
|
+
metadata.aggregations[propertyKey] = ui5AggregationMetadata;
|
|
134
241
|
}
|
|
135
|
-
if (
|
|
242
|
+
if (ui5AggregationMetadata.isDefault) {
|
|
136
243
|
metadata.defaultAggregation = propertyKey;
|
|
137
244
|
}
|
|
138
245
|
delete propertyDescriptor.writable;
|
|
139
246
|
delete (propertyDescriptor as any).initializer;
|
|
140
|
-
// (propertyDescriptor as any).set = function(v: any) {
|
|
141
|
-
// return this.setAggregation(propertyKey, v);
|
|
142
|
-
// };
|
|
143
|
-
// (propertyDescriptor as any).get = function() {
|
|
144
|
-
// return this.getAggregation(propertyKey);
|
|
145
|
-
// };
|
|
146
247
|
|
|
147
248
|
return propertyDescriptor;
|
|
148
|
-
};
|
|
249
|
+
} as any; // This is technically an accessor decorator, but somehow the compiler doesn't like it if i declare it as such.;
|
|
149
250
|
}
|
|
150
251
|
|
|
151
|
-
|
|
152
|
-
|
|
252
|
+
/**
|
|
253
|
+
* Defines and configure the following association in the control metatada.
|
|
254
|
+
*
|
|
255
|
+
* @param ui5AssociationMetadata The definition of the association.
|
|
256
|
+
* @returns The decorated property
|
|
257
|
+
*/
|
|
258
|
+
export function association(ui5AssociationMetadata: UI5AssociationMetadata): PropertyDecorator {
|
|
259
|
+
return function (target: UI5Control, propertyKey: string, propertyDescriptor: TypedPropertyDescriptor<any>) {
|
|
153
260
|
const metadata = ensureMetadata(target);
|
|
154
261
|
if (!metadata.associations[propertyKey]) {
|
|
155
|
-
metadata.associations[propertyKey] =
|
|
262
|
+
metadata.associations[propertyKey] = ui5AssociationMetadata;
|
|
156
263
|
}
|
|
157
264
|
delete propertyDescriptor.writable;
|
|
158
265
|
delete (propertyDescriptor as any).initializer;
|
|
159
|
-
// (propertyDescriptor as any).set = function(v: any) {
|
|
160
|
-
// return this.setAggregation(propertyKey, v);
|
|
161
|
-
// };
|
|
162
|
-
// (propertyDescriptor as any).get = function() {
|
|
163
|
-
// return this.getAggregation(propertyKey);
|
|
164
|
-
// };
|
|
165
266
|
|
|
166
267
|
return propertyDescriptor;
|
|
167
|
-
};
|
|
268
|
+
} as any; // This is technically an accessor decorator, but somehow the compiler doesn't like it if i declare it as such.;
|
|
168
269
|
}
|
|
169
|
-
type ControlPropertyNames<T> = {
|
|
170
|
-
[K in keyof T]: T[K] extends Function ? never : K;
|
|
171
|
-
}[keyof T];
|
|
172
|
-
export type PropertiesOf<T> = Partial<Pick<T, ControlPropertyNames<T>>>;
|
|
173
270
|
|
|
174
271
|
/**
|
|
175
|
-
*
|
|
272
|
+
* Defines in the metadata that this control implements a specific interface.
|
|
176
273
|
*
|
|
177
|
-
* @param
|
|
178
|
-
* @
|
|
179
|
-
* @class
|
|
274
|
+
* @param interfaceName The name of the implemented interface
|
|
275
|
+
* @returns The decorated method
|
|
180
276
|
*/
|
|
181
|
-
export function
|
|
182
|
-
return function(
|
|
183
|
-
|
|
184
|
-
constructor.prototype.metadata = {};
|
|
185
|
-
}
|
|
277
|
+
export function implementInterface(interfaceName: string): PropertyDecorator {
|
|
278
|
+
return function (target: UI5Control) {
|
|
279
|
+
const metadata = ensureMetadata(target);
|
|
186
280
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
constructor.prototype.metadata.interfaces.push("sap.ui.core.IFormContent");
|
|
191
|
-
(constructor as any).isDependentBound = isDependentBound;
|
|
192
|
-
if (!constructor.prototype.renderer) {
|
|
193
|
-
constructor.prototype.renderer = {
|
|
194
|
-
apiVersion: 2,
|
|
195
|
-
render: function(oRm: RenderManager, oControl: any) {
|
|
196
|
-
oRm.renderControl(oControl.getContent());
|
|
197
|
-
}
|
|
198
|
-
};
|
|
199
|
-
}
|
|
281
|
+
metadata.interfaces.push(interfaceName);
|
|
282
|
+
};
|
|
283
|
+
}
|
|
200
284
|
|
|
201
|
-
|
|
285
|
+
/**
|
|
286
|
+
* Indicates that the following method should also be exposed statically so we can call it from the XML.
|
|
287
|
+
*
|
|
288
|
+
* @returns The decorated method
|
|
289
|
+
*/
|
|
290
|
+
export function xmlEventHandler(): MethodDecorator {
|
|
291
|
+
return function (target: UI5Control, propertykey) {
|
|
292
|
+
const currentConstructor: UI5APIControl = target.constructor as unknown as UI5APIControl;
|
|
293
|
+
currentConstructor[propertykey.toString()] = function (...args: any[]) {
|
|
294
|
+
const currentTarget = currentConstructor.getAPI(args[0] as UI5Event);
|
|
295
|
+
currentTarget[propertykey.toString()](...args);
|
|
296
|
+
};
|
|
202
297
|
};
|
|
203
298
|
}
|
|
204
|
-
|
|
205
|
-
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Indicates that the following class should define a ui5 control of the specified name.
|
|
302
|
+
*
|
|
303
|
+
* @param sTarget The fully qualified name of the macro API
|
|
304
|
+
* @param metadataDefinition Inline metadata definition
|
|
305
|
+
* @class
|
|
306
|
+
*/
|
|
307
|
+
export function defineUI5Class(sTarget: string, metadataDefinition?: any): ClassDecorator {
|
|
308
|
+
return function (constructor: Function) {
|
|
206
309
|
if (!constructor.prototype.metadata) {
|
|
207
310
|
constructor.prototype.metadata = {};
|
|
208
311
|
}
|
|
209
312
|
if (metadataDefinition) {
|
|
210
|
-
|
|
211
|
-
constructor.prototype.metadata[key] = metadataDefinition[key];
|
|
212
|
-
}
|
|
313
|
+
for (const key in metadataDefinition) {
|
|
314
|
+
constructor.prototype.metadata[key] = metadataDefinition[key as keyof UI5ControlMetadataDefinition];
|
|
315
|
+
}
|
|
213
316
|
}
|
|
214
|
-
return
|
|
317
|
+
return registerUI5Metadata(constructor, sTarget, constructor.prototype);
|
|
215
318
|
};
|
|
216
319
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Internal heavy lifting that will take care of creating the class property for ui5 to use.
|
|
323
|
+
*
|
|
324
|
+
* @param clazz The class prototype
|
|
325
|
+
* @param name The name of the class to create
|
|
326
|
+
* @param inObj The metadata object
|
|
327
|
+
* @returns The metadata class
|
|
328
|
+
*/
|
|
329
|
+
function registerUI5Metadata(clazz: any, name: string, inObj: any): any {
|
|
330
|
+
if (clazz.getMetadata && clazz.getMetadata().isA("sap.ui.core.mvc.ControllerExtension")) {
|
|
331
|
+
Object.getOwnPropertyNames(inObj).forEach((objName) => {
|
|
220
332
|
const descriptor = Object.getOwnPropertyDescriptor(inObj, objName);
|
|
221
333
|
if (descriptor && !descriptor.enumerable) {
|
|
222
334
|
descriptor.enumerable = true;
|
|
@@ -228,104 +340,90 @@ function describe(clazz: any, name: string, inObj: any, metadataClass?: any, use
|
|
|
228
340
|
obj.metadata = inObj.metadata || {};
|
|
229
341
|
obj.override = inObj.override;
|
|
230
342
|
obj.constructor = clazz;
|
|
231
|
-
obj.metadata.baseType = Object.getPrototypeOf(clazz.prototype)
|
|
232
|
-
.getMetadata()
|
|
233
|
-
.getName();
|
|
343
|
+
obj.metadata.baseType = Object.getPrototypeOf(clazz.prototype).getMetadata().getName();
|
|
234
344
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
345
|
+
if (clazz?.getMetadata()?.getStereotype() === "control") {
|
|
346
|
+
const rendererDefinition = inObj.renderer || clazz.renderer || clazz.render;
|
|
347
|
+
obj.renderer = { apiVersion: 2 };
|
|
348
|
+
if (typeof rendererDefinition === "function") {
|
|
349
|
+
obj.renderer.render = rendererDefinition;
|
|
350
|
+
} else if (rendererDefinition != undefined) {
|
|
351
|
+
obj.renderer = rendererDefinition;
|
|
352
|
+
}
|
|
241
353
|
}
|
|
242
354
|
obj.metadata.interfaces = inObj.metadata?.interfaces || clazz.metadata?.interfaces;
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
//console.log(e);
|
|
250
|
-
}
|
|
355
|
+
Object.keys(clazz.prototype).forEach((key) => {
|
|
356
|
+
if (key !== "metadata") {
|
|
357
|
+
try {
|
|
358
|
+
obj[key] = clazz.prototype[key];
|
|
359
|
+
} catch (e) {
|
|
360
|
+
//console.log(e);
|
|
251
361
|
}
|
|
252
|
-
}
|
|
253
|
-
}
|
|
362
|
+
}
|
|
363
|
+
});
|
|
254
364
|
if (obj.metadata?.controllerExtensions && Object.keys(obj.metadata.controllerExtensions).length > 0) {
|
|
255
365
|
for (const cExtName in obj.metadata.controllerExtensions) {
|
|
256
366
|
obj[cExtName] = obj.metadata.controllerExtensions[cExtName];
|
|
257
367
|
}
|
|
258
368
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
fnInit && fnInit.apply(this, args);
|
|
265
|
-
this.metadata = obj.metadata;
|
|
369
|
+
const output = clazz.extend(name, obj);
|
|
370
|
+
const fnInit = output.prototype.init;
|
|
371
|
+
output.prototype.init = function (...args: any[]) {
|
|
372
|
+
fnInit && fnInit.apply(this, args);
|
|
373
|
+
this.metadata = obj.metadata;
|
|
266
374
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
375
|
+
if (obj.metadata.properties) {
|
|
376
|
+
const aPropertyKeys = Object.keys(obj.metadata.properties);
|
|
377
|
+
aPropertyKeys.forEach((propertyKey) => {
|
|
378
|
+
Object.defineProperty(this, propertyKey, {
|
|
379
|
+
configurable: true,
|
|
380
|
+
set: (v: any) => {
|
|
381
|
+
return this.setProperty(propertyKey, v);
|
|
382
|
+
},
|
|
383
|
+
get: () => {
|
|
384
|
+
return this.getProperty(propertyKey);
|
|
385
|
+
}
|
|
386
|
+
});
|
|
387
|
+
});
|
|
388
|
+
const aAggregationKeys = Object.keys(obj.metadata.aggregations);
|
|
389
|
+
aAggregationKeys.forEach((aggregationKey) => {
|
|
390
|
+
Object.defineProperty(this, aggregationKey, {
|
|
391
|
+
configurable: true,
|
|
392
|
+
set: (v: any) => {
|
|
393
|
+
return this.setAggregation(aggregationKey, v);
|
|
394
|
+
},
|
|
395
|
+
get: () => {
|
|
396
|
+
const aggregationContent = this.getAggregation(aggregationKey);
|
|
397
|
+
if (obj.metadata.aggregations[aggregationKey].multiple) {
|
|
398
|
+
return aggregationContent || [];
|
|
399
|
+
} else {
|
|
400
|
+
return aggregationContent;
|
|
279
401
|
}
|
|
280
|
-
}
|
|
402
|
+
}
|
|
281
403
|
});
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
404
|
+
});
|
|
405
|
+
const aAssociationKeys = Object.keys(obj.metadata.associations);
|
|
406
|
+
aAssociationKeys.forEach((associationKey) => {
|
|
407
|
+
Object.defineProperty(this, associationKey, {
|
|
408
|
+
configurable: true,
|
|
409
|
+
set: (v: any) => {
|
|
410
|
+
return this.setAssociation(associationKey, v);
|
|
411
|
+
},
|
|
412
|
+
get: () => {
|
|
413
|
+
const aggregationContent = this.getAssociation(associationKey);
|
|
414
|
+
if (obj.metadata.associations[associationKey].multiple) {
|
|
415
|
+
return aggregationContent || [];
|
|
416
|
+
} else {
|
|
417
|
+
return aggregationContent;
|
|
291
418
|
}
|
|
292
|
-
}
|
|
419
|
+
}
|
|
293
420
|
});
|
|
294
|
-
}
|
|
295
|
-
};
|
|
296
|
-
} else {
|
|
297
|
-
let metadata: any;
|
|
298
|
-
if (metadataClass) {
|
|
299
|
-
metadata = new metadataClass(name, obj);
|
|
300
|
-
} else {
|
|
301
|
-
metadata = new ElementMetadata(name, obj);
|
|
302
|
-
}
|
|
303
|
-
clazz.getMetadata = clazz.prototype.getMetadata = function() {
|
|
304
|
-
return metadata;
|
|
305
|
-
};
|
|
306
|
-
if (!clazz.getMetadata().isFinal()) {
|
|
307
|
-
clazz.extend = function(sSCName: string, oSCClassInfo: any, fnSCMetaImpl: Function) {
|
|
308
|
-
// the default constructor created by ui5 does not return the value which is problematic with TS
|
|
309
|
-
oSCClassInfo.constructor = function(...args: any[]) {
|
|
310
|
-
return clazz.apply(this, args);
|
|
311
|
-
};
|
|
312
|
-
|
|
313
|
-
const fnClass = (Metadata as any).createClass(
|
|
314
|
-
clazz,
|
|
315
|
-
sSCName,
|
|
316
|
-
oSCClassInfo,
|
|
317
|
-
fnSCMetaImpl || metadataClass || ElementMetadata
|
|
318
|
-
);
|
|
319
|
-
// fnClass.prototype.constructor = function(...args: any[]) {
|
|
320
|
-
// return clazz.apply(this, ...args);
|
|
321
|
-
// };
|
|
322
|
-
return fnClass;
|
|
323
|
-
};
|
|
421
|
+
});
|
|
324
422
|
}
|
|
325
|
-
}
|
|
326
|
-
clazz.override = function(oExtension: any) {
|
|
423
|
+
};
|
|
424
|
+
clazz.override = function (oExtension: any) {
|
|
327
425
|
const pol = {};
|
|
328
|
-
(pol as any).constructor = function(...args: any[]) {
|
|
426
|
+
(pol as any).constructor = function (...args: any[]) {
|
|
329
427
|
return clazz.apply(this, args as any);
|
|
330
428
|
};
|
|
331
429
|
const oClass = (Metadata as any).createClass(clazz, "anonymousExtension~" + uid(), pol, ControllerMetadata);
|
|
@@ -334,26 +432,6 @@ function describe(clazz: any, name: string, inObj: any, metadataClass?: any, use
|
|
|
334
432
|
return oClass;
|
|
335
433
|
};
|
|
336
434
|
|
|
337
|
-
const fnInit = clazz.prototype.init;
|
|
338
|
-
output.prototype.init = function(...args: any[]) {
|
|
339
|
-
fnInit && fnInit.apply(this, args);
|
|
340
|
-
if (obj.metadata.properties) {
|
|
341
|
-
const aPropertyKeys = Object.keys(obj.metadata.properties);
|
|
342
|
-
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
343
|
-
const that = this;
|
|
344
|
-
aPropertyKeys.forEach(propertyKey => {
|
|
345
|
-
Object.defineProperty(that, propertyKey, {
|
|
346
|
-
configurable: true,
|
|
347
|
-
set: (v: any) => {
|
|
348
|
-
return that.setProperty(propertyKey, v);
|
|
349
|
-
},
|
|
350
|
-
get: () => {
|
|
351
|
-
return that.getProperty(propertyKey);
|
|
352
|
-
}
|
|
353
|
-
});
|
|
354
|
-
});
|
|
355
|
-
}
|
|
356
|
-
};
|
|
357
435
|
ObjectPath.set(name, output);
|
|
358
436
|
return output;
|
|
359
437
|
}
|