@sapui5/sap.fe.core 1.124.2 → 1.126.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 +1 -1
- package/src/sap/fe/core/.library +5 -1
- package/src/sap/fe/core/ActionRuntime.js +2 -2
- package/src/sap/fe/core/ActionRuntime.ts +4 -4
- package/src/sap/fe/core/AppComponent.js +2 -2
- package/src/sap/fe/core/AppComponent.ts +1 -1
- package/src/sap/fe/core/AppStateHandler.js +2 -2
- package/src/sap/fe/core/AppStateHandler.ts +1 -1
- package/src/sap/fe/core/BaseController.js +2 -2
- package/src/sap/fe/core/BaseController.ts +1 -1
- package/src/sap/fe/core/CommonUtils.js +3 -3
- package/src/sap/fe/core/CommonUtils.ts +12 -15
- package/src/sap/fe/core/ExtensionAPI.js +2 -2
- package/src/sap/fe/core/ExtensionAPI.ts +4 -3
- package/src/sap/fe/core/PageController.js +2 -2
- package/src/sap/fe/core/PageController.ts +1 -1
- package/src/sap/fe/core/ResourceModel.js +2 -2
- package/src/sap/fe/core/ResourceModel.ts +1 -1
- package/src/sap/fe/core/ReuseComponent.js +172 -0
- package/src/sap/fe/core/ReuseComponent.ts +165 -0
- package/src/sap/fe/core/TemplateComponent.js +2 -2
- package/src/sap/fe/core/TemplateComponent.ts +5 -1
- package/src/sap/fe/core/TemplateModel.js +2 -2
- package/src/sap/fe/core/TemplateModel.ts +1 -1
- package/src/sap/fe/core/buildingBlocks/BuildingBlockBase.js +92 -6
- package/src/sap/fe/core/buildingBlocks/BuildingBlockBase.ts +90 -10
- package/src/sap/fe/core/buildingBlocks/templating/BuildingBlockSupport.js +1 -1
- package/src/sap/fe/core/buildingBlocks/templating/BuildingBlockSupport.ts +1 -1
- package/src/sap/fe/core/buildingBlocks/templating/BuildingBlockTemplateProcessor.js +30 -3
- package/src/sap/fe/core/buildingBlocks/templating/BuildingBlockTemplateProcessor.ts +28 -4
- package/src/sap/fe/core/buildingBlocks/templating/BuildingBlockTemplatingBase.js +10 -16
- package/src/sap/fe/core/buildingBlocks/templating/BuildingBlockTemplatingBase.ts +19 -16
- package/src/sap/fe/core/buildingBlocks/templating/RuntimeBuildingBlockFragment.js +3 -3
- package/src/sap/fe/core/buildingBlocks/templating/RuntimeBuildingBlockFragment.ts +5 -5
- package/src/sap/fe/core/controllerextensions/BaseControllerExtension.js +2 -2
- package/src/sap/fe/core/controllerextensions/BaseControllerExtension.ts +1 -1
- package/src/sap/fe/core/controllerextensions/CollaborativeDraft.js +17 -5
- package/src/sap/fe/core/controllerextensions/CollaborativeDraft.ts +14 -6
- package/src/sap/fe/core/controllerextensions/ContextSharing.js +2 -2
- package/src/sap/fe/core/controllerextensions/ContextSharing.ts +1 -1
- package/src/sap/fe/core/controllerextensions/EditFlow.js +57 -43
- package/src/sap/fe/core/controllerextensions/EditFlow.ts +61 -46
- package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.js +2 -2
- package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.ts +1 -1
- package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.js +8 -11
- package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.ts +8 -16
- package/src/sap/fe/core/controllerextensions/InternalRouting.js +10 -7
- package/src/sap/fe/core/controllerextensions/InternalRouting.ts +5 -5
- package/src/sap/fe/core/controllerextensions/KPIManagement.js +22 -18
- package/src/sap/fe/core/controllerextensions/KPIManagement.ts +28 -23
- package/src/sap/fe/core/controllerextensions/MessageHandler.js +4 -4
- package/src/sap/fe/core/controllerextensions/MessageHandler.ts +4 -1
- package/src/sap/fe/core/controllerextensions/PageReady.js +21 -15
- package/src/sap/fe/core/controllerextensions/PageReady.ts +29 -20
- package/src/sap/fe/core/controllerextensions/Paginator.js +2 -2
- package/src/sap/fe/core/controllerextensions/Paginator.ts +1 -1
- package/src/sap/fe/core/controllerextensions/Placeholder.js +12 -6
- package/src/sap/fe/core/controllerextensions/Placeholder.ts +15 -1
- package/src/sap/fe/core/controllerextensions/Recommendations.js +26 -8
- package/src/sap/fe/core/controllerextensions/Recommendations.ts +29 -3
- package/src/sap/fe/core/controllerextensions/Routing.js +5 -7
- package/src/sap/fe/core/controllerextensions/Routing.ts +4 -4
- package/src/sap/fe/core/controllerextensions/Share.js +4 -4
- package/src/sap/fe/core/controllerextensions/Share.ts +10 -6
- package/src/sap/fe/core/controllerextensions/SideEffects.js +20 -5
- package/src/sap/fe/core/controllerextensions/SideEffects.ts +22 -2
- package/src/sap/fe/core/controllerextensions/Telemetry.js +2 -2
- package/src/sap/fe/core/controllerextensions/Telemetry.ts +1 -1
- package/src/sap/fe/core/controllerextensions/ViewState.js +79 -81
- package/src/sap/fe/core/controllerextensions/ViewState.ts +117 -105
- package/src/sap/fe/core/controllerextensions/cards/CollaborationManager.js +3 -3
- package/src/sap/fe/core/controllerextensions/cards/CollaborationManager.ts +1 -1
- package/src/sap/fe/core/controllerextensions/collaboration/CollaborationCommon.js +2 -2
- package/src/sap/fe/core/controllerextensions/collaboration/CollaborationCommon.ts +2 -2
- package/src/sap/fe/core/controllerextensions/dialog/OperationsDialog.block.js +17 -8
- package/src/sap/fe/core/controllerextensions/dialog/OperationsDialog.block.tsx +8 -2
- package/src/sap/fe/core/controllerextensions/editFlow/NotApplicableContextDialog.js +1 -1
- package/src/sap/fe/core/controllerextensions/editFlow/TransactionHelper.js +10 -9
- package/src/sap/fe/core/controllerextensions/editFlow/TransactionHelper.ts +15 -10
- package/src/sap/fe/core/controllerextensions/editFlow/draftDataLossPopup.js +2 -2
- package/src/sap/fe/core/controllerextensions/editFlow/draftDataLossPopup.ts +1 -1
- package/src/sap/fe/core/controllerextensions/editFlow/operations/facade.js +130 -158
- package/src/sap/fe/core/controllerextensions/editFlow/operations/facade.ts +240 -275
- package/src/sap/fe/core/controllerextensions/editFlow/sticky.js +2 -2
- package/src/sap/fe/core/controllerextensions/editFlow/sticky.ts +1 -1
- package/src/sap/fe/core/controllerextensions/messageHandler/messageHandling.js +46 -28
- package/src/sap/fe/core/controllerextensions/messageHandler/messageHandling.ts +60 -32
- package/src/sap/fe/core/controllerextensions/routing/RouterProxy.js +2 -2
- package/src/sap/fe/core/controllerextensions/routing/RouterProxy.ts +1 -1
- package/src/sap/fe/core/controllerextensions/viewState/IViewStateContributor.js +2 -2
- package/src/sap/fe/core/controllerextensions/viewState/IViewStateContributor.ts +27 -3
- package/src/sap/fe/core/controls/CommandExecution.js +2 -2
- package/src/sap/fe/core/controls/CommandExecution.ts +2 -2
- package/src/sap/fe/core/controls/ComponentLoader.js +3 -3
- package/src/sap/fe/core/controls/ComponentLoader.ts +2 -2
- package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DraftDataLossDialog.block.js +3 -3
- package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DraftDataLossDialog.block.tsx +2 -2
- package/src/sap/fe/core/controls/EventDelegateHook.js +2 -2
- package/src/sap/fe/core/controls/EventDelegateHook.ts +2 -2
- package/src/sap/fe/core/controls/FormElementWrapper.js +51 -6
- package/src/sap/fe/core/controls/FormElementWrapper.ts +43 -2
- package/src/sap/fe/core/controls/Recommendations/ConfirmRecommendationDialog.block.js +3 -3
- package/src/sap/fe/core/controls/Recommendations/ConfirmRecommendationDialog.block.tsx +3 -3
- package/src/sap/fe/core/converters/ConverterContext.js +4 -2
- package/src/sap/fe/core/converters/ConverterContext.ts +5 -2
- package/src/sap/fe/core/converters/ManifestSettings.js +8 -2
- package/src/sap/fe/core/converters/ManifestSettings.ts +25 -3
- package/src/sap/fe/core/converters/ManifestWrapper.js +12 -3
- package/src/sap/fe/core/converters/ManifestWrapper.ts +11 -1
- package/src/sap/fe/core/converters/MetaModelConverter.js +7 -6
- package/src/sap/fe/core/converters/MetaModelConverter.ts +6 -2
- package/src/sap/fe/core/converters/annotations/DataField.js +56 -16
- package/src/sap/fe/core/converters/annotations/DataField.ts +74 -25
- package/src/sap/fe/core/converters/common/AnnotationConverter.js +19 -18
- package/src/sap/fe/core/converters/controls/Common/Action.js +5 -5
- package/src/sap/fe/core/converters/controls/Common/Action.ts +14 -14
- package/src/sap/fe/core/converters/controls/Common/Chart.js +40 -7
- package/src/sap/fe/core/converters/controls/Common/Chart.ts +56 -20
- package/src/sap/fe/core/converters/controls/Common/DataVisualization.js +8 -11
- package/src/sap/fe/core/converters/controls/Common/DataVisualization.ts +23 -27
- package/src/sap/fe/core/converters/controls/Common/Form.js +10 -3
- package/src/sap/fe/core/converters/controls/Common/Form.ts +13 -4
- package/src/sap/fe/core/converters/controls/Common/KPI.js +3 -2
- package/src/sap/fe/core/converters/controls/Common/KPI.ts +6 -2
- package/src/sap/fe/core/converters/controls/Common/Table.js +137 -48
- package/src/sap/fe/core/converters/controls/Common/Table.ts +174 -52
- package/src/sap/fe/core/converters/controls/Common/table/StandardActions.js +73 -21
- package/src/sap/fe/core/converters/controls/Common/table/StandardActions.ts +91 -20
- package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.js +4 -4
- package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.ts +2 -2
- package/src/sap/fe/core/converters/controls/ObjectPage/Avatar.js +2 -2
- package/src/sap/fe/core/converters/controls/ObjectPage/Avatar.ts +2 -2
- package/src/sap/fe/core/converters/controls/ObjectPage/HeaderFacet.js +3 -3
- package/src/sap/fe/core/converters/controls/ObjectPage/HeaderFacet.ts +1 -1
- package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.js +17 -16
- package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.ts +18 -17
- package/src/sap/fe/core/converters/helpers/InsightsHelpers.js +2 -2
- package/src/sap/fe/core/converters/helpers/InsightsHelpers.ts +1 -1
- package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.js +9 -9
- package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.ts +12 -12
- package/src/sap/fe/core/converters/templates/ListReportConverter.js +13 -7
- package/src/sap/fe/core/converters/templates/ListReportConverter.ts +12 -5
- package/src/sap/fe/core/converters/templates/ObjectPageConverter.js +9 -73
- package/src/sap/fe/core/converters/templates/ObjectPageConverter.ts +4 -74
- package/src/sap/fe/core/designtime/AppComponent.designtime.js +5 -10
- package/src/sap/fe/core/designtime/AppComponent.designtime.ts +3 -12
- package/src/sap/fe/core/formatters/CriticalityFormatter.js +4 -7
- package/src/sap/fe/core/formatters/CriticalityFormatter.ts +3 -3
- package/src/sap/fe/core/formatters/FiscalFormat.js +5 -3
- package/src/sap/fe/core/formatters/FiscalFormat.ts +4 -2
- package/src/sap/fe/core/formatters/StandardFormatter.js +2 -2
- package/src/sap/fe/core/formatters/StandardFormatter.ts +3 -3
- package/src/sap/fe/core/fpm/Component.js +3 -3
- package/src/sap/fe/core/fpm/Component.ts +3 -3
- package/src/sap/fe/core/fpm/manifest.json +1 -1
- package/src/sap/fe/core/helpers/AdaptiveCardExpressionCompiler.js +2 -2
- package/src/sap/fe/core/helpers/AdaptiveCardExpressionCompiler.ts +1 -1
- package/src/sap/fe/core/helpers/BindingHelper.js +2 -2
- package/src/sap/fe/core/helpers/BindingHelper.ts +2 -2
- package/src/sap/fe/core/helpers/BindingToolkitEvaluator.js +2 -2
- package/src/sap/fe/core/helpers/BindingToolkitEvaluator.ts +2 -2
- package/src/sap/fe/core/helpers/DeleteHelper.js +7 -4
- package/src/sap/fe/core/helpers/DeleteHelper.ts +9 -3
- package/src/sap/fe/core/helpers/MetaModelFunction.js +5 -5
- package/src/sap/fe/core/helpers/MetaModelFunction.ts +2 -2
- package/src/sap/fe/core/helpers/MetaPath.js +9 -3
- package/src/sap/fe/core/helpers/MetaPath.ts +8 -2
- package/src/sap/fe/core/helpers/ModelHelper.js +149 -3
- package/src/sap/fe/core/helpers/ModelHelper.ts +202 -6
- package/src/sap/fe/core/helpers/StandardRecommendationHelper.js +3 -3
- package/src/sap/fe/core/helpers/StandardRecommendationHelper.ts +2 -2
- package/src/sap/fe/core/helpers/TitleHelper.js +4 -4
- package/src/sap/fe/core/helpers/TitleHelper.ts +4 -4
- package/src/sap/fe/core/library.js +4 -4
- package/src/sap/fe/core/library.ts +2 -1
- package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.js +11 -3
- package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.ts +10 -2
- package/src/sap/fe/core/messagebundle.properties +8 -57
- package/src/sap/fe/core/messagebundle_ar.properties +2 -0
- package/src/sap/fe/core/messagebundle_bg.properties +2 -0
- package/src/sap/fe/core/messagebundle_ca.properties +2 -0
- package/src/sap/fe/core/messagebundle_cnr.properties +2 -0
- package/src/sap/fe/core/messagebundle_cs.properties +2 -0
- package/src/sap/fe/core/messagebundle_cy.properties +4 -2
- package/src/sap/fe/core/messagebundle_da.properties +2 -0
- package/src/sap/fe/core/messagebundle_de.properties +2 -0
- package/src/sap/fe/core/messagebundle_el.properties +2 -0
- package/src/sap/fe/core/messagebundle_en.properties +6 -57
- package/src/sap/fe/core/messagebundle_en_GB.properties +2 -0
- package/src/sap/fe/core/messagebundle_en_US_saprigi.properties +3 -36
- package/src/sap/fe/core/messagebundle_es.properties +2 -0
- package/src/sap/fe/core/messagebundle_es_MX.properties +2 -0
- package/src/sap/fe/core/messagebundle_et.properties +2 -0
- package/src/sap/fe/core/messagebundle_fi.properties +2 -0
- package/src/sap/fe/core/messagebundle_fr.properties +2 -0
- package/src/sap/fe/core/messagebundle_fr_CA.properties +3 -1
- package/src/sap/fe/core/messagebundle_hi.properties +2 -0
- package/src/sap/fe/core/messagebundle_hr.properties +2 -0
- package/src/sap/fe/core/messagebundle_hu.properties +3 -1
- package/src/sap/fe/core/messagebundle_id.properties +2 -0
- package/src/sap/fe/core/messagebundle_it.properties +2 -0
- package/src/sap/fe/core/messagebundle_iw.properties +3 -1
- package/src/sap/fe/core/messagebundle_ja.properties +2 -0
- package/src/sap/fe/core/messagebundle_kk.properties +2 -0
- package/src/sap/fe/core/messagebundle_ko.properties +2 -0
- package/src/sap/fe/core/messagebundle_lt.properties +2 -0
- package/src/sap/fe/core/messagebundle_lv.properties +2 -0
- package/src/sap/fe/core/messagebundle_mk.properties +2 -0
- package/src/sap/fe/core/messagebundle_ms.properties +2 -0
- package/src/sap/fe/core/messagebundle_nl.properties +2 -0
- package/src/sap/fe/core/messagebundle_no.properties +2 -0
- package/src/sap/fe/core/messagebundle_pl.properties +2 -0
- package/src/sap/fe/core/messagebundle_pt.properties +2 -0
- package/src/sap/fe/core/messagebundle_pt_PT.properties +2 -0
- package/src/sap/fe/core/messagebundle_ro.properties +2 -0
- package/src/sap/fe/core/messagebundle_ru.properties +2 -0
- package/src/sap/fe/core/messagebundle_sh.properties +64 -62
- package/src/sap/fe/core/messagebundle_sk.properties +2 -0
- package/src/sap/fe/core/messagebundle_sl.properties +2 -0
- package/src/sap/fe/core/messagebundle_sr.properties +2 -0
- package/src/sap/fe/core/messagebundle_sv.properties +2 -0
- package/src/sap/fe/core/messagebundle_th.properties +2 -0
- package/src/sap/fe/core/messagebundle_tr.properties +2 -0
- package/src/sap/fe/core/messagebundle_uk.properties +3 -1
- package/src/sap/fe/core/messagebundle_vi.properties +2 -0
- package/src/sap/fe/core/messagebundle_zh_CN.properties +2 -0
- package/src/sap/fe/core/messagebundle_zh_TW.properties +2 -0
- package/src/sap/fe/core/operationsHelper.js +3 -3
- package/src/sap/fe/core/operationsHelper.ts +2 -2
- package/src/sap/fe/core/rootView/Fcl.controller.js +3 -3
- package/src/sap/fe/core/rootView/Fcl.controller.ts +2 -2
- package/src/sap/fe/core/rootView/NavContainer.controller.js +2 -2
- package/src/sap/fe/core/rootView/NavContainer.controller.ts +1 -1
- package/src/sap/fe/core/rootView/RootViewBaseController.js +114 -92
- package/src/sap/fe/core/rootView/RootViewBaseController.ts +120 -106
- package/src/sap/fe/core/services/CollaborativeToolsServiceFactory.js +2 -2
- package/src/sap/fe/core/services/CollaborativeToolsServiceFactory.ts +1 -1
- package/src/sap/fe/core/services/NavigationServiceFactory.js +6 -4
- package/src/sap/fe/core/services/NavigationServiceFactory.ts +4 -3
- package/src/sap/fe/core/services/RoutingServiceFactory.js +2 -2
- package/src/sap/fe/core/services/RoutingServiceFactory.ts +1 -1
- package/src/sap/fe/core/services/ShellServicesFactory.js +1 -1
- package/src/sap/fe/core/services/ShellServicesFactory.ts +12 -2
- package/src/sap/fe/core/services/TelemetryServiceFactory.js +8 -2
- package/src/sap/fe/core/services/TelemetryServiceFactory.ts +7 -1
- package/src/sap/fe/core/services/TemplatedViewServiceFactory.js +16 -9
- package/src/sap/fe/core/services/TemplatedViewServiceFactory.ts +22 -11
- package/src/sap/fe/core/services/ValueHelpHistoryServiceFactory.js +2 -2
- package/src/sap/fe/core/services/ValueHelpHistoryServiceFactory.ts +1 -1
- package/src/sap/fe/core/services/view/TemplatingErrorPage.controller.js +2 -2
- package/src/sap/fe/core/services/view/TemplatingErrorPage.controller.ts +1 -1
- package/src/sap/fe/core/templating/ActionHelper.js +2 -2
- package/src/sap/fe/core/templating/ActionHelper.ts +2 -2
- package/src/sap/fe/core/templating/CommonFormatters.js +2 -2
- package/src/sap/fe/core/templating/CommonFormatters.ts +3 -3
- package/src/sap/fe/core/templating/CriticalityFormatters.js +2 -2
- package/src/sap/fe/core/templating/CriticalityFormatters.ts +2 -2
- package/src/sap/fe/core/templating/DataFieldFormatters.js +4 -4
- package/src/sap/fe/core/templating/DataFieldFormatters.ts +2 -2
- package/src/sap/fe/core/templating/DataModelPathHelper.js +2 -2
- package/src/sap/fe/core/templating/DataModelPathHelper.ts +2 -2
- package/src/sap/fe/core/templating/EntityTypeHelper.js +2 -2
- package/src/sap/fe/core/templating/EntityTypeHelper.ts +2 -2
- package/src/sap/fe/core/templating/FieldControlHelper.js +2 -2
- package/src/sap/fe/core/templating/FieldControlHelper.ts +2 -2
- package/src/sap/fe/core/templating/SemanticObjectHelper.js +2 -2
- package/src/sap/fe/core/templating/SemanticObjectHelper.ts +2 -2
- package/src/sap/fe/core/templating/UIFormatters.js +7 -7
- package/src/sap/fe/core/templating/UIFormatters.ts +6 -6
- package/src/sap/fe/core/type/DateTimeWithTimezone.js +2 -2
- package/src/sap/fe/core/type/DateTimeWithTimezone.ts +1 -1
- package/src/sap/fe/core/type/Email.js +2 -2
- package/src/sap/fe/core/type/Email.ts +1 -1
- package/src/sap/fe/core/type/FiscalDate.js +2 -2
- package/src/sap/fe/core/type/FiscalDate.ts +1 -1
- package/src/sap/fe/core/type/InputMask.js +124 -0
- package/src/sap/fe/core/type/InputMask.ts +131 -0
- package/ui5.yaml +19 -0
- package/src/sap/fe/core/controllerextensions/editFlow/operations/_internal.js +0 -81
- package/src/sap/fe/core/controllerextensions/editFlow/operations/_internal.ts +0 -117
- package/src/sap/fe/core/helpers/AnnotationEnum.js +0 -33
- package/src/sap/fe/core/helpers/AnnotationEnum.ts +0 -21
- package/src/sap/fe/core/helpers/BindingToolkit.js +0 -1813
- package/src/sap/fe/core/helpers/BindingToolkit.ts +0 -2450
- package/src/sap/fe/core/helpers/ClassSupport.js +0 -584
- package/src/sap/fe/core/helpers/ClassSupport.ts +0 -697
- package/src/sap/fe/core/jsx-runtime/Fragment.js +0 -14
- package/src/sap/fe/core/jsx-runtime/Fragment.ts +0 -3
- package/src/sap/fe/core/jsx-runtime/ViewLoader.js +0 -93
- package/src/sap/fe/core/jsx-runtime/ViewLoader.tsx +0 -86
- package/src/sap/fe/core/jsx-runtime/jsx-control.js +0 -177
- package/src/sap/fe/core/jsx-runtime/jsx-control.ts +0 -197
- package/src/sap/fe/core/jsx-runtime/jsx-xml.js +0 -237
- package/src/sap/fe/core/jsx-runtime/jsx-xml.ts +0 -246
- package/src/sap/fe/core/jsx-runtime/jsx.js +0 -47
- package/src/sap/fe/core/jsx-runtime/jsx.ts +0 -71
- package/src/sap/fe/core/jsx-runtime/jsxs.js +0 -10
- package/src/sap/fe/core/jsx-runtime/jsxs.ts +0 -3
- package/src/sap/fe/core/jsx-runtime/useMDXComponents.js +0 -172
- package/src/sap/fe/core/jsx-runtime/useMDXComponents.tsx +0 -194
|
@@ -1,697 +0,0 @@
|
|
|
1
|
-
import ObjectPath from "sap/base/util/ObjectPath";
|
|
2
|
-
import merge from "sap/base/util/merge";
|
|
3
|
-
import uid from "sap/base/util/uid";
|
|
4
|
-
import type { Ref } from "sap/fe/core/jsx-runtime/jsx";
|
|
5
|
-
import type UI5Event from "sap/ui/base/Event";
|
|
6
|
-
import type ManagedObject from "sap/ui/base/ManagedObject";
|
|
7
|
-
import Metadata from "sap/ui/base/Metadata";
|
|
8
|
-
import BaseObject from "sap/ui/base/Object";
|
|
9
|
-
import type Control from "sap/ui/core/Control";
|
|
10
|
-
import type UI5Element from "sap/ui/core/Element";
|
|
11
|
-
import type ControllerExtension from "sap/ui/core/mvc/ControllerExtension";
|
|
12
|
-
import ControllerMetadata from "sap/ui/core/mvc/ControllerMetadata";
|
|
13
|
-
import type OverrideExecution from "sap/ui/core/mvc/OverrideExecution";
|
|
14
|
-
import type { $ControlSettings } from "sap/ui/mdc/Control";
|
|
15
|
-
import type { EventHandler } from "types/extension_types";
|
|
16
|
-
|
|
17
|
-
type OverrideDefinition = Record<string, Function>;
|
|
18
|
-
type UI5ControllerMethodDefinition = {
|
|
19
|
-
overrideExecution?: OverrideExecution;
|
|
20
|
-
public?: boolean;
|
|
21
|
-
final?: boolean;
|
|
22
|
-
};
|
|
23
|
-
type UI5PropertyMetadata = {
|
|
24
|
-
type: string;
|
|
25
|
-
bindable?: boolean;
|
|
26
|
-
required?: boolean;
|
|
27
|
-
group?: string;
|
|
28
|
-
defaultValue?: unknown;
|
|
29
|
-
byValue?: boolean;
|
|
30
|
-
isBindingInfo?: boolean;
|
|
31
|
-
expectedAnnotations?: string[];
|
|
32
|
-
expectedTypes?: string[];
|
|
33
|
-
allowedValues?: string[];
|
|
34
|
-
};
|
|
35
|
-
export type UI5AggregationMetadata = {
|
|
36
|
-
type: string;
|
|
37
|
-
altTypes?: string[];
|
|
38
|
-
multiple?: boolean;
|
|
39
|
-
isDefault?: boolean;
|
|
40
|
-
defaultClass?: unknown;
|
|
41
|
-
singularName?: string;
|
|
42
|
-
visibility?: string;
|
|
43
|
-
};
|
|
44
|
-
export type UI5AssociationMetadata = {
|
|
45
|
-
type: string;
|
|
46
|
-
multiple?: boolean;
|
|
47
|
-
singularName?: string;
|
|
48
|
-
};
|
|
49
|
-
export type UI5ControlMetadataDefinition = {
|
|
50
|
-
defaultAggregation?: string;
|
|
51
|
-
controllerExtensions: Record<string, typeof ControllerExtension | Function>;
|
|
52
|
-
properties: Record<string, UI5PropertyMetadata>;
|
|
53
|
-
aggregations: Record<string, UI5AggregationMetadata>;
|
|
54
|
-
references: Record<string, boolean>;
|
|
55
|
-
associations: Record<string, UI5AssociationMetadata>;
|
|
56
|
-
methods: Record<string, UI5ControllerMethodDefinition>;
|
|
57
|
-
events: Record<string, {}>;
|
|
58
|
-
interfaces: string[];
|
|
59
|
-
library?: string;
|
|
60
|
-
designtime?: string;
|
|
61
|
-
config?: {
|
|
62
|
-
fullWidth?: boolean;
|
|
63
|
-
};
|
|
64
|
-
manifest?: string | unknown;
|
|
65
|
-
returnTypes?: string[];
|
|
66
|
-
buildingBlockMetadata?: unknown;
|
|
67
|
-
};
|
|
68
|
-
type UI5ControllerDefinition = {
|
|
69
|
-
override?: { extension?: Record<string, OverrideDefinition> } & {
|
|
70
|
-
[k: string]: Function;
|
|
71
|
-
};
|
|
72
|
-
metadata?: UI5ControlMetadataDefinition;
|
|
73
|
-
renderer?: Function;
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
type UI5ControlDefinition = {
|
|
77
|
-
metadata?: UI5ControlMetadataDefinition;
|
|
78
|
-
override?: unknown;
|
|
79
|
-
renderer?: Function;
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
type UI5APIControl = Control & {
|
|
83
|
-
getAPI(event: UI5Event, fqdn?: string): UI5APIControl | undefined;
|
|
84
|
-
instanceMap: WeakMap<object, object[]>;
|
|
85
|
-
__apiRegistered: boolean;
|
|
86
|
-
} & {
|
|
87
|
-
[k: string]: Function;
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
export type XMLEventHolder = {
|
|
91
|
-
getAPI(event: UI5Event, fqdn?: string): UI5APIControl | undefined;
|
|
92
|
-
instanceMap: WeakMap<object, object[]>;
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
type ControlPropertyNames<T> = {
|
|
96
|
-
[K in keyof T]: T[K] extends Function ? (T[K] extends EventHandler ? K : never) : K;
|
|
97
|
-
}[keyof T];
|
|
98
|
-
export type PropertiesOf<T> = Partial<Pick<T, ControlPropertyNames<T>>>;
|
|
99
|
-
export type StrictPropertiesOf<T> = Pick<T, ControlPropertyNames<T>>;
|
|
100
|
-
export type UI5Accessors<T> = {
|
|
101
|
-
// Add all the getXXX method, might add too much as I'm not filtering on actual properties...
|
|
102
|
-
[P in keyof Required<T> as `get${Capitalize<string & P>}`]: () => T[P];
|
|
103
|
-
};
|
|
104
|
-
export type UI5Setters<T> = {
|
|
105
|
-
// Add all the setXXX method, might add too much as I'm not filtering on actual properties...
|
|
106
|
-
[P in keyof Required<T> as `set${Capitalize<string & P>}`]: (value: T[P]) => T;
|
|
107
|
-
};
|
|
108
|
-
export type EnhanceWithUI5<T> = {
|
|
109
|
-
new (props: PropertiesOf<T> & $ControlSettings): EnhanceWithUI5<T>;
|
|
110
|
-
new (sId: string, props: PropertiesOf<T> & $ControlSettings): EnhanceWithUI5<T>;
|
|
111
|
-
} & T &
|
|
112
|
-
UI5Accessors<T> &
|
|
113
|
-
UI5Setters<T>;
|
|
114
|
-
|
|
115
|
-
const ensureMetadata = function (target: UI5ControllerDefinition | UI5ControlDefinition): UI5ControlMetadataDefinition {
|
|
116
|
-
target.metadata = merge(
|
|
117
|
-
{
|
|
118
|
-
controllerExtensions: {},
|
|
119
|
-
properties: {},
|
|
120
|
-
aggregations: {},
|
|
121
|
-
references: {},
|
|
122
|
-
associations: {},
|
|
123
|
-
methods: {},
|
|
124
|
-
events: {},
|
|
125
|
-
interfaces: []
|
|
126
|
-
},
|
|
127
|
-
target.metadata ?? {}
|
|
128
|
-
) as UI5ControlMetadataDefinition;
|
|
129
|
-
return target.metadata;
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Method that will find the correct API object based on the current control hierarchy.
|
|
134
|
-
*
|
|
135
|
-
* @param target
|
|
136
|
-
* @returns The proper getAPI function for this constructor
|
|
137
|
-
*/
|
|
138
|
-
function prepareGetAPIFunction(target: UI5APIControl) {
|
|
139
|
-
return function <T extends UI5APIControl>(
|
|
140
|
-
this: UI5APIControl,
|
|
141
|
-
oEvent: UI5Event,
|
|
142
|
-
apiFQN: string = target.getMetadata().getName()
|
|
143
|
-
): T | undefined {
|
|
144
|
-
let oSource = oEvent.getSource() as ManagedObject | null;
|
|
145
|
-
if (target._getAPIExtension) {
|
|
146
|
-
oSource = target._getAPIExtension(oSource) ?? oSource;
|
|
147
|
-
}
|
|
148
|
-
while (oSource && !oSource.isA<T>(apiFQN) && oSource.getParent) {
|
|
149
|
-
if (this.isDependentBound) {
|
|
150
|
-
const oDependents = (oSource as Control).getDependents();
|
|
151
|
-
const hasCorrectDependent = oDependents.find((oDependent: UI5Element) => oDependent.isA(apiFQN));
|
|
152
|
-
if (hasCorrectDependent) {
|
|
153
|
-
oSource = hasCorrectDependent as unknown as T;
|
|
154
|
-
} else {
|
|
155
|
-
oSource = oSource.getParent() as unknown as T;
|
|
156
|
-
}
|
|
157
|
-
} else {
|
|
158
|
-
oSource = oSource.getParent();
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
if (!oSource || !oSource.isA<T>(apiFQN)) {
|
|
163
|
-
const oSourceMap = this.instanceMap.get(this) as T[];
|
|
164
|
-
oSource = oSourceMap?.[oSourceMap.length - 1];
|
|
165
|
-
}
|
|
166
|
-
let targetControl;
|
|
167
|
-
if (oSource && oSource.isA<T>(apiFQN)) {
|
|
168
|
-
targetControl = oSource;
|
|
169
|
-
}
|
|
170
|
-
return targetControl;
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Ensures that when an xmlEventHandler is defined, the `getAPI` function is properly assigned.
|
|
176
|
-
*
|
|
177
|
-
* @param target The class constructor that should hold the static functions
|
|
178
|
-
*/
|
|
179
|
-
const ensureGetAPI = function (target: UI5APIControl): void {
|
|
180
|
-
if (!target.__apiRegistered) {
|
|
181
|
-
target.__apiRegistered = true;
|
|
182
|
-
target.instanceMap = new WeakMap<object, object[]>();
|
|
183
|
-
target.registerInstance = function (_instance: Function): void {
|
|
184
|
-
if (!this.instanceMap.get(_instance.constructor)) {
|
|
185
|
-
this.instanceMap.set(_instance.constructor, []);
|
|
186
|
-
}
|
|
187
|
-
(this.instanceMap.get(_instance.constructor) as object[]).push(_instance);
|
|
188
|
-
};
|
|
189
|
-
target.getAPI = prepareGetAPIFunction(target);
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
/* #region CONTROLLER EXTENSIONS */
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Defines that the following method is an override for the method name with the same name in the specific controller extension or base implementation.
|
|
197
|
-
*
|
|
198
|
-
* @param extensionName The name of the extension that will be overridden
|
|
199
|
-
* @returns The decorated method
|
|
200
|
-
*/
|
|
201
|
-
export function methodOverride(extensionName?: string): MethodDecorator {
|
|
202
|
-
return function (target: UI5ControllerDefinition, propertyKey) {
|
|
203
|
-
if (!target.override) {
|
|
204
|
-
target.override = {};
|
|
205
|
-
}
|
|
206
|
-
let currentTarget = target.override;
|
|
207
|
-
if (extensionName) {
|
|
208
|
-
if (!currentTarget.extension) {
|
|
209
|
-
currentTarget.extension = {};
|
|
210
|
-
}
|
|
211
|
-
if (!currentTarget.extension[extensionName]) {
|
|
212
|
-
currentTarget.extension[extensionName] = {};
|
|
213
|
-
}
|
|
214
|
-
currentTarget = currentTarget.extension[extensionName];
|
|
215
|
-
}
|
|
216
|
-
currentTarget[propertyKey.toString()] = (target as Record<string, Function>)[propertyKey.toString()];
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
* Defines that the method can be extended by other controller extension based on the defined overrideExecutionType.
|
|
222
|
-
*
|
|
223
|
-
* @param overrideExecutionType The OverrideExecution defining when the override should run (Before / After / Instead)
|
|
224
|
-
* @returns The decorated method
|
|
225
|
-
*/
|
|
226
|
-
export function extensible(overrideExecutionType?: OverrideExecution | "AfterAsync" | "BeforeAsync"): MethodDecorator {
|
|
227
|
-
return function (target: UI5ControllerDefinition, propertyKey) {
|
|
228
|
-
const metadata = ensureMetadata(target);
|
|
229
|
-
if (!metadata.methods[propertyKey.toString()]) {
|
|
230
|
-
metadata.methods[propertyKey.toString()] = {};
|
|
231
|
-
}
|
|
232
|
-
metadata.methods[propertyKey.toString()].overrideExecution = overrideExecutionType as unknown as OverrideExecution;
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* Defines that the method will be publicly available for controller extension usage.
|
|
238
|
-
*
|
|
239
|
-
* @returns The decorated method
|
|
240
|
-
*/
|
|
241
|
-
export function publicExtension(): MethodDecorator {
|
|
242
|
-
return function (target: UI5ControllerDefinition, propertyKey, descriptor): void {
|
|
243
|
-
const metadata = ensureMetadata(target);
|
|
244
|
-
descriptor.enumerable = true;
|
|
245
|
-
if (!metadata.methods[propertyKey.toString()]) {
|
|
246
|
-
metadata.methods[propertyKey.toString()] = {};
|
|
247
|
-
}
|
|
248
|
-
metadata.methods[propertyKey.toString()].public = true;
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* Defines that the method will be only available for internal usage of the controller extension.
|
|
253
|
-
*
|
|
254
|
-
* @returns The decorated method
|
|
255
|
-
*/
|
|
256
|
-
export function privateExtension(): MethodDecorator {
|
|
257
|
-
return function (target: UI5ControllerDefinition, propertyKey, descriptor) {
|
|
258
|
-
const metadata = ensureMetadata(target);
|
|
259
|
-
descriptor.enumerable = true;
|
|
260
|
-
if (!metadata.methods[propertyKey.toString()]) {
|
|
261
|
-
metadata.methods[propertyKey.toString()] = {};
|
|
262
|
-
}
|
|
263
|
-
metadata.methods[propertyKey.toString()].public = false;
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* Defines that the method cannot be further extended by other controller extension.
|
|
268
|
-
*
|
|
269
|
-
* @returns The decorated method
|
|
270
|
-
*/
|
|
271
|
-
export function finalExtension(): MethodDecorator {
|
|
272
|
-
return function (target: UI5ControllerDefinition, propertyKey, descriptor) {
|
|
273
|
-
const metadata = ensureMetadata(target);
|
|
274
|
-
descriptor.enumerable = true;
|
|
275
|
-
if (!metadata.methods[propertyKey.toString()]) {
|
|
276
|
-
metadata.methods[propertyKey.toString()] = {};
|
|
277
|
-
}
|
|
278
|
-
metadata.methods[propertyKey.toString()].final = true;
|
|
279
|
-
};
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* Defines that we are going to use instantiate a controller extension under the following variable name.
|
|
284
|
-
*
|
|
285
|
-
* @param extensionClass The controller extension that will be instantiated
|
|
286
|
-
* @returns The decorated property
|
|
287
|
-
*/
|
|
288
|
-
export function usingExtension(extensionClass: typeof ControllerExtension | Function): PropertyDecorator {
|
|
289
|
-
return function (target: UI5ControllerDefinition, propertyKey: string, propertyDescriptor: TypedPropertyDescriptor<unknown>) {
|
|
290
|
-
const metadata = ensureMetadata(target);
|
|
291
|
-
delete (propertyDescriptor as { initializer?: unknown }).initializer;
|
|
292
|
-
metadata.controllerExtensions[propertyKey.toString()] = extensionClass;
|
|
293
|
-
return propertyDescriptor;
|
|
294
|
-
} as unknown as PropertyDecorator; // This is technically an accessor decorator, but somehow the compiler doesn't like it if I declare it as such.
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
/* #endregion */
|
|
298
|
-
|
|
299
|
-
/* #region CONTROL */
|
|
300
|
-
/**
|
|
301
|
-
* Indicates that the property shall be declared as an event on the control metadata.
|
|
302
|
-
*
|
|
303
|
-
* @returns The decorated property
|
|
304
|
-
*/
|
|
305
|
-
export function event(): PropertyDecorator {
|
|
306
|
-
return function (target: UI5ControlDefinition, eventKey) {
|
|
307
|
-
const metadata = ensureMetadata(target);
|
|
308
|
-
if (!metadata.events[eventKey.toString()]) {
|
|
309
|
-
metadata.events[eventKey.toString()] = {};
|
|
310
|
-
}
|
|
311
|
-
};
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
/**
|
|
315
|
-
* Defines the following property in the control metatada.
|
|
316
|
-
*
|
|
317
|
-
* @param attributeDefinition The property definition
|
|
318
|
-
* @returns The decorated property.
|
|
319
|
-
*/
|
|
320
|
-
export function property(attributeDefinition: UI5PropertyMetadata): PropertyDecorator {
|
|
321
|
-
return function (target: UI5ControlDefinition, propertyKey: string, propertyDescriptor: TypedPropertyDescriptor<unknown>) {
|
|
322
|
-
const metadata = ensureMetadata(target);
|
|
323
|
-
if (attributeDefinition.bindable === undefined) {
|
|
324
|
-
attributeDefinition.bindable = true;
|
|
325
|
-
}
|
|
326
|
-
if (attributeDefinition.isBindingInfo === true) {
|
|
327
|
-
attributeDefinition.bindable = false;
|
|
328
|
-
attributeDefinition.group = "Data";
|
|
329
|
-
}
|
|
330
|
-
if (!metadata.properties[propertyKey]) {
|
|
331
|
-
metadata.properties[propertyKey] = attributeDefinition;
|
|
332
|
-
}
|
|
333
|
-
delete propertyDescriptor.writable;
|
|
334
|
-
attributeDefinition.defaultValue ??= (propertyDescriptor as { initializer?: Function }).initializer?.();
|
|
335
|
-
delete (propertyDescriptor as { initializer?: unknown }).initializer;
|
|
336
|
-
|
|
337
|
-
return propertyDescriptor;
|
|
338
|
-
} as unknown as PropertyDecorator; // This is technically an accessor decorator, but somehow the compiler doesn't like it if i declare it as such.;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
/**
|
|
342
|
-
* Defines and configure the following aggregation in the control metatada.
|
|
343
|
-
*
|
|
344
|
-
* @param aggregationDefinition The aggregation definition
|
|
345
|
-
* @returns The decorated property.
|
|
346
|
-
*/
|
|
347
|
-
export function aggregation(aggregationDefinition: UI5AggregationMetadata): PropertyDecorator {
|
|
348
|
-
return function (target: UI5ControlDefinition, propertyKey: string, propertyDescriptor: TypedPropertyDescriptor<unknown>) {
|
|
349
|
-
const metadata = ensureMetadata(target);
|
|
350
|
-
if (aggregationDefinition.multiple === undefined) {
|
|
351
|
-
// UI5 defaults this to true but this is just weird...
|
|
352
|
-
aggregationDefinition.multiple = false;
|
|
353
|
-
}
|
|
354
|
-
if (!metadata.aggregations[propertyKey]) {
|
|
355
|
-
metadata.aggregations[propertyKey] = aggregationDefinition;
|
|
356
|
-
}
|
|
357
|
-
if (aggregationDefinition.isDefault) {
|
|
358
|
-
metadata.defaultAggregation = propertyKey;
|
|
359
|
-
}
|
|
360
|
-
delete propertyDescriptor.writable;
|
|
361
|
-
delete (propertyDescriptor as { initializer?: unknown }).initializer;
|
|
362
|
-
|
|
363
|
-
return propertyDescriptor;
|
|
364
|
-
} as unknown as PropertyDecorator; // This is technically an accessor decorator, but somehow the compiler doesn't like it if i declare it as such.;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
/**
|
|
368
|
-
* Defines and configure the following association in the control metatada.
|
|
369
|
-
*
|
|
370
|
-
* @param ui5AssociationMetadata The definition of the association.
|
|
371
|
-
* @returns The decorated property
|
|
372
|
-
*/
|
|
373
|
-
export function association(ui5AssociationMetadata: UI5AssociationMetadata): PropertyDecorator {
|
|
374
|
-
return function (target: UI5ControlDefinition, propertyKey: string, propertyDescriptor: TypedPropertyDescriptor<unknown>) {
|
|
375
|
-
const metadata = ensureMetadata(target);
|
|
376
|
-
if (!metadata.associations[propertyKey]) {
|
|
377
|
-
metadata.associations[propertyKey] = ui5AssociationMetadata;
|
|
378
|
-
}
|
|
379
|
-
delete propertyDescriptor.writable;
|
|
380
|
-
delete (propertyDescriptor as { initializer?: unknown }).initializer;
|
|
381
|
-
|
|
382
|
-
return propertyDescriptor;
|
|
383
|
-
} as unknown as PropertyDecorator; // This is technically an accessor decorator, but somehow the compiler doesn't like it if i declare it as such.;
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
/**
|
|
387
|
-
* Defines in the metadata that this control implements a specific interface.
|
|
388
|
-
*
|
|
389
|
-
* @param interfaceName The name of the implemented interface
|
|
390
|
-
* @returns The decorated method
|
|
391
|
-
*/
|
|
392
|
-
export function implementInterface(interfaceName: string): PropertyDecorator {
|
|
393
|
-
return function (target: UI5ControlDefinition) {
|
|
394
|
-
const metadata = ensureMetadata(target);
|
|
395
|
-
|
|
396
|
-
metadata.interfaces.push(interfaceName);
|
|
397
|
-
};
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
/**
|
|
401
|
-
* Indicates that the following method should also be exposed statically so we can call it from XML.
|
|
402
|
-
*
|
|
403
|
-
* @returns The decorated method
|
|
404
|
-
*/
|
|
405
|
-
export function xmlEventHandler(): MethodDecorator {
|
|
406
|
-
return function (target: UI5ControlDefinition, propertykey) {
|
|
407
|
-
const currentConstructor: UI5APIControl = target.constructor as unknown as UI5APIControl;
|
|
408
|
-
ensureGetAPI(currentConstructor);
|
|
409
|
-
currentConstructor[propertykey.toString()] = function (...args: unknown[]): void {
|
|
410
|
-
if (args && args.length) {
|
|
411
|
-
const currentTarget = currentConstructor.getAPI(args[0] as UI5Event);
|
|
412
|
-
currentTarget?.[propertykey.toString()](...args);
|
|
413
|
-
}
|
|
414
|
-
};
|
|
415
|
-
};
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
type UI5ControlAndMore = typeof Control &
|
|
419
|
-
Function & {
|
|
420
|
-
registerInstance?: Function;
|
|
421
|
-
override?: Function;
|
|
422
|
-
renderer?: unknown;
|
|
423
|
-
render: Function;
|
|
424
|
-
metadata?: UI5ControlMetadataDefinition;
|
|
425
|
-
};
|
|
426
|
-
|
|
427
|
-
/**
|
|
428
|
-
* Indicates that the following class should define a UI5 control of the specified name.
|
|
429
|
-
*
|
|
430
|
-
* @param sTarget The fully qualified name of the UI5 class
|
|
431
|
-
* @param metadataDefinition Inline metadata definition
|
|
432
|
-
* @param forceDefineCall Whether a define call should be added for this, useful when defining sub classes
|
|
433
|
-
* @returns A class decorator that will create a ui5 class
|
|
434
|
-
*/
|
|
435
|
-
export function defineUI5Class(
|
|
436
|
-
sTarget: string,
|
|
437
|
-
metadataDefinition?: Partial<UI5ControlMetadataDefinition>,
|
|
438
|
-
forceDefineCall = false
|
|
439
|
-
): ClassDecorator {
|
|
440
|
-
return function (constructor: UI5ControlAndMore) {
|
|
441
|
-
if (!constructor.prototype.metadata) {
|
|
442
|
-
constructor.prototype.metadata = {};
|
|
443
|
-
}
|
|
444
|
-
if (metadataDefinition) {
|
|
445
|
-
for (const key in metadataDefinition) {
|
|
446
|
-
if (constructor.prototype.metadata[key]) {
|
|
447
|
-
if (Array.isArray(constructor.prototype.metadata[key])) {
|
|
448
|
-
constructor.prototype.metadata[key] = constructor.prototype.metadata[key].concat(
|
|
449
|
-
metadataDefinition[key as keyof UI5ControlMetadataDefinition]
|
|
450
|
-
);
|
|
451
|
-
} else {
|
|
452
|
-
constructor.prototype.metadata[key] = {
|
|
453
|
-
...constructor.prototype.metadata[key],
|
|
454
|
-
...(metadataDefinition[key as keyof UI5ControlMetadataDefinition] as object)
|
|
455
|
-
};
|
|
456
|
-
}
|
|
457
|
-
} else {
|
|
458
|
-
constructor.prototype.metadata[key] = metadataDefinition[key as keyof UI5ControlMetadataDefinition];
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
return registerUI5Metadata(constructor, sTarget, constructor.prototype, forceDefineCall);
|
|
463
|
-
} as ClassDecorator;
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
export function createReference<T extends UI5Element>(): Ref<T> {
|
|
467
|
-
return {
|
|
468
|
-
current: undefined as unknown as T,
|
|
469
|
-
setCurrent: function (oControlInstance: T): void {
|
|
470
|
-
this.current = oControlInstance;
|
|
471
|
-
}
|
|
472
|
-
};
|
|
473
|
-
}
|
|
474
|
-
/**
|
|
475
|
-
* Defines that the following object will hold a reference to a control through jsx templating.
|
|
476
|
-
*
|
|
477
|
-
* @returns The decorated property.
|
|
478
|
-
*/
|
|
479
|
-
export function defineReference(): PropertyDecorator {
|
|
480
|
-
return function (target: UI5ControlDefinition, propertyKey: string, propertyDescriptor: TypedPropertyDescriptor<unknown>) {
|
|
481
|
-
const metadata = ensureMetadata(target);
|
|
482
|
-
delete propertyDescriptor.writable;
|
|
483
|
-
delete (propertyDescriptor as { initializer?: unknown }).initializer;
|
|
484
|
-
if (BaseObject.isObjectA(target, "sap.ui.core.Control")) {
|
|
485
|
-
if (!metadata.references[propertyKey]) {
|
|
486
|
-
metadata.references[propertyKey] = true;
|
|
487
|
-
}
|
|
488
|
-
} else {
|
|
489
|
-
(propertyDescriptor as { initializer?: unknown }).initializer = createReference;
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
return propertyDescriptor;
|
|
493
|
-
} as unknown as PropertyDecorator; // This is technically an accessor decorator, but somehow the compiler doesn't like it if i declare it as such.;
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
/**
|
|
497
|
-
* Internal heavy lifting that will take care of creating the class property for ui5 to use.
|
|
498
|
-
*
|
|
499
|
-
* @param clazz The class prototype
|
|
500
|
-
* @param name The name of the class to create
|
|
501
|
-
* @param inObj The metadata object
|
|
502
|
-
* @param forceDefineCall Whether a define call should be added for this, useful when defining sub classes
|
|
503
|
-
* @returns The metadata class
|
|
504
|
-
*/
|
|
505
|
-
function registerUI5Metadata(
|
|
506
|
-
clazz: UI5ControlAndMore,
|
|
507
|
-
name: string,
|
|
508
|
-
inObj: UI5ControllerDefinition | UI5ControlDefinition,
|
|
509
|
-
forceDefineCall: boolean
|
|
510
|
-
): Function {
|
|
511
|
-
if (clazz.getMetadata?.().isA("sap.ui.core.mvc.ControllerExtension")) {
|
|
512
|
-
Object.getOwnPropertyNames(inObj).forEach((objName) => {
|
|
513
|
-
const descriptor = Object.getOwnPropertyDescriptor(inObj, objName);
|
|
514
|
-
if (descriptor && !descriptor.enumerable) {
|
|
515
|
-
descriptor.enumerable = true;
|
|
516
|
-
}
|
|
517
|
-
});
|
|
518
|
-
}
|
|
519
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
520
|
-
const obj: any = {};
|
|
521
|
-
obj.metadata = inObj.metadata || {};
|
|
522
|
-
obj.override = inObj.override;
|
|
523
|
-
obj.constructor = clazz;
|
|
524
|
-
obj.metadata.baseType = Object.getPrototypeOf(clazz.prototype).getMetadata().getName();
|
|
525
|
-
|
|
526
|
-
if ((clazz?.getMetadata() as unknown as { getStereotype: Function })?.getStereotype() === "control") {
|
|
527
|
-
const rendererDefinition = inObj.renderer || clazz.renderer || clazz.render;
|
|
528
|
-
obj.renderer = { apiVersion: 2 };
|
|
529
|
-
if (typeof rendererDefinition === "function") {
|
|
530
|
-
obj.renderer.render = rendererDefinition;
|
|
531
|
-
} else if (rendererDefinition != undefined) {
|
|
532
|
-
obj.renderer = rendererDefinition;
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
obj.metadata.interfaces = inObj.metadata?.interfaces || clazz.metadata?.interfaces;
|
|
536
|
-
Object.keys(clazz.prototype).forEach((key) => {
|
|
537
|
-
if (key !== "metadata") {
|
|
538
|
-
try {
|
|
539
|
-
obj[key] = clazz.prototype[key];
|
|
540
|
-
} catch (e) {
|
|
541
|
-
// Do nothing
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
});
|
|
545
|
-
|
|
546
|
-
if (obj.metadata?.controllerExtensions && Object.keys(obj.metadata.controllerExtensions).length > 0) {
|
|
547
|
-
for (const cExtName in obj.metadata.controllerExtensions) {
|
|
548
|
-
obj[cExtName] = obj.metadata.controllerExtensions[cExtName];
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
const output = clazz.extend(name, obj) as typeof Control & Function;
|
|
552
|
-
const fnInit = output.prototype.init;
|
|
553
|
-
output.prototype.init = function (...args: unknown[]): void {
|
|
554
|
-
if (fnInit) {
|
|
555
|
-
fnInit.apply(this, args);
|
|
556
|
-
}
|
|
557
|
-
if (clazz.registerInstance) {
|
|
558
|
-
clazz.registerInstance(this);
|
|
559
|
-
}
|
|
560
|
-
this.metadata = obj.metadata;
|
|
561
|
-
|
|
562
|
-
if (obj.metadata.properties) {
|
|
563
|
-
const aPropertyKeys = Object.keys(obj.metadata.properties);
|
|
564
|
-
aPropertyKeys.forEach((propertyKey) => {
|
|
565
|
-
const propertyDef = obj.metadata.properties[propertyKey];
|
|
566
|
-
if (propertyDef.isBindingInfo === true) {
|
|
567
|
-
this._bindingProperties ??= {};
|
|
568
|
-
Object.defineProperty(this, propertyKey, {
|
|
569
|
-
configurable: true,
|
|
570
|
-
set: (v: unknown) => {
|
|
571
|
-
this._bindingProperties[propertyKey] = v;
|
|
572
|
-
this.mProperties[propertyKey] = v;
|
|
573
|
-
return this;
|
|
574
|
-
},
|
|
575
|
-
get(): unknown {
|
|
576
|
-
const propValue = this._bindingProperties[propertyKey] ?? this.getProperty(propertyKey);
|
|
577
|
-
if (typeof propValue === "object") {
|
|
578
|
-
return { ...propValue }; // Create shallow copy
|
|
579
|
-
} else {
|
|
580
|
-
return propValue;
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
});
|
|
584
|
-
} else {
|
|
585
|
-
Object.defineProperty(this, propertyKey, {
|
|
586
|
-
configurable: true,
|
|
587
|
-
set: (v: unknown) => {
|
|
588
|
-
return this.setProperty(propertyKey, v);
|
|
589
|
-
},
|
|
590
|
-
get: () => {
|
|
591
|
-
return this.getProperty(propertyKey);
|
|
592
|
-
}
|
|
593
|
-
});
|
|
594
|
-
}
|
|
595
|
-
if (propertyDef.defaultValue !== undefined) {
|
|
596
|
-
this[propertyKey] = propertyDef.defaultValue;
|
|
597
|
-
}
|
|
598
|
-
});
|
|
599
|
-
const aAggregationKeys = Object.keys(obj.metadata.aggregations);
|
|
600
|
-
aAggregationKeys.forEach((aggregationKey) => {
|
|
601
|
-
Object.defineProperty(this, aggregationKey, {
|
|
602
|
-
configurable: true,
|
|
603
|
-
set: (v: unknown) => {
|
|
604
|
-
return this.setAggregation(aggregationKey, v);
|
|
605
|
-
},
|
|
606
|
-
get: () => {
|
|
607
|
-
const aggregationContent = this.getAggregation(aggregationKey);
|
|
608
|
-
if (obj.metadata.aggregations[aggregationKey].multiple) {
|
|
609
|
-
return aggregationContent || [];
|
|
610
|
-
} else {
|
|
611
|
-
return aggregationContent;
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
});
|
|
615
|
-
});
|
|
616
|
-
const aAssociationKeys = Object.keys(obj.metadata.associations);
|
|
617
|
-
aAssociationKeys.forEach((associationKey) => {
|
|
618
|
-
Object.defineProperty(this, associationKey, {
|
|
619
|
-
configurable: true,
|
|
620
|
-
set: (v: unknown) => {
|
|
621
|
-
return this.setAssociation(associationKey, v);
|
|
622
|
-
},
|
|
623
|
-
get: () => {
|
|
624
|
-
const aggregationContent = this.getAssociation(associationKey);
|
|
625
|
-
if (obj.metadata.associations[associationKey].multiple) {
|
|
626
|
-
return aggregationContent || [];
|
|
627
|
-
} else {
|
|
628
|
-
return aggregationContent;
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
});
|
|
632
|
-
});
|
|
633
|
-
}
|
|
634
|
-
if (obj.metadata.references) {
|
|
635
|
-
const referenceProperties = Object.keys(obj.metadata.references);
|
|
636
|
-
referenceProperties.forEach((propertyKey) => {
|
|
637
|
-
Object.defineProperty(this, propertyKey, {
|
|
638
|
-
configurable: true,
|
|
639
|
-
value: createReference()
|
|
640
|
-
});
|
|
641
|
-
});
|
|
642
|
-
}
|
|
643
|
-
if (obj.metadata.methods) {
|
|
644
|
-
for (const methodName in obj.metadata.methods) {
|
|
645
|
-
const methodDefinition = obj.metadata.methods[methodName];
|
|
646
|
-
if (methodDefinition.overrideExecution === "AfterAsync" || methodDefinition.overrideExecution === "BeforeAsync") {
|
|
647
|
-
if (!this.methodHolder) {
|
|
648
|
-
this.methodHolder = [];
|
|
649
|
-
}
|
|
650
|
-
this.methodHolder[methodName] = [this[methodName]];
|
|
651
|
-
Object.defineProperty(this, methodName, {
|
|
652
|
-
configurable: true,
|
|
653
|
-
set: (v: Function) => {
|
|
654
|
-
return this.methodHolder[methodName].push(v);
|
|
655
|
-
},
|
|
656
|
-
get: () => {
|
|
657
|
-
return async (...methodArgs: unknown[]) => {
|
|
658
|
-
const methodArrays = this.methodHolder[methodName];
|
|
659
|
-
if (methodDefinition.overrideExecution === "BeforeAsync") {
|
|
660
|
-
methodArrays.reverse();
|
|
661
|
-
}
|
|
662
|
-
for (const arg of methodArrays) {
|
|
663
|
-
await arg.apply(this, methodArgs);
|
|
664
|
-
}
|
|
665
|
-
};
|
|
666
|
-
}
|
|
667
|
-
});
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
};
|
|
672
|
-
clazz.override = function (oExtension: unknown): Function {
|
|
673
|
-
const pol = {};
|
|
674
|
-
(pol as Function).constructor = function (...args: unknown[]): Function {
|
|
675
|
-
return clazz.apply(this, args);
|
|
676
|
-
};
|
|
677
|
-
const oClass = (Metadata as unknown as { createClass: Function }).createClass(
|
|
678
|
-
clazz,
|
|
679
|
-
`anonymousExtension~${uid()}`,
|
|
680
|
-
pol,
|
|
681
|
-
ControllerMetadata
|
|
682
|
-
);
|
|
683
|
-
oClass.getMetadata()._staticOverride = oExtension;
|
|
684
|
-
oClass.getMetadata()._override = (clazz.getMetadata() as { _override?: unknown })._override;
|
|
685
|
-
return oClass;
|
|
686
|
-
};
|
|
687
|
-
|
|
688
|
-
ObjectPath.set(name, output);
|
|
689
|
-
|
|
690
|
-
if (forceDefineCall) {
|
|
691
|
-
sap.ui.define(output.getMetadata().getName().replaceAll(".", "/"), () => {
|
|
692
|
-
return output;
|
|
693
|
-
});
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
return output;
|
|
697
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* SAP UI development toolkit for HTML5 (SAPUI5)
|
|
3
|
-
* (c) Copyright 2009-2024 SAP SE. All rights reserved
|
|
4
|
-
*/
|
|
5
|
-
sap.ui.define([], function () {
|
|
6
|
-
"use strict";
|
|
7
|
-
|
|
8
|
-
var _exports = {};
|
|
9
|
-
let Fragment = function Fragment() {};
|
|
10
|
-
Fragment.isFragment = true;
|
|
11
|
-
_exports = Fragment;
|
|
12
|
-
return _exports;
|
|
13
|
-
}, false);
|
|
14
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJGcmFnbWVudCIsImlzRnJhZ21lbnQiXSwic291cmNlUm9vdCI6Ii4iLCJzb3VyY2VzIjpbIkZyYWdtZW50LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBkZWZhdWx0IGNsYXNzIEZyYWdtZW50IHtcblx0c3RhdGljIGlzRnJhZ21lbnQgPSB0cnVlO1xufVxuIl0sIm1hcHBpbmdzIjoiO0FBQUE7QUFBQTtBQUFBOzs7OztNQUFxQkEsUUFBUTtFQUFSQSxRQUFRLENBQ3JCQyxVQUFVLEdBQUcsSUFBSTtFQUFBO0VBQUE7QUFBQSJ9
|