openui5
openui5 copied to clipboard
Consider making `MessageMixin` public for usage in custom controls
OpenUI5 version: 1.101.0
As a developer of custom controls, I want to be able to use the messaging mechanisms (compare docs of UI5 in as simple a manner as possible.
My custom control hence implements setValueState
and setValueStateText
. I know that in order for messaging to work properly, against messages from a data binding, I must implement refreshDataState
in a specific way. This is already done generically in MessageMixin
. Implementing the method myself is hard, especially because a few of the important details (like setting the associated control id to enable navigation from the message popover to the control, I presume) rely on non-public methods of both Message and MessageModel.
Please consider making the MessageMixin
public to make this integration easier for developers of custom controls.
Kind regards Lukas
Note: This is related to https://github.com/SAP/openui5/issues/3553, which describes a bug within MessageMixin
for messages w/o databinding via ControlMessageProcessor
, which has been broken for quite a while.
Hi @LukasHeimann,
as discussed via phone we do not want to make the MessageMixin.js public, because it only covers some specific use-case. In order to use the MessageMixin it's necessary, that a control provides at least the properties valueState and valueStateText. The MessageMixin also does only cover property bindings because it's not easily possible to handle the value state for aggregation bindings in a generic manner. Last but not least it's not possible to handle several bound properties because it's only designed to cover datastate changes of the value property.
Since the MessageMixin is only protected and it covers the your control use-case it should be sufficient for you to use it in order to solve your requirement. In addition we may consider to make the API sap.ui.core.Message#addControlId and sap.ui.core.Message#removeControlId public in the future. AFAIS these two APIs are the only private APIs which would be needed in order to implement a control specific behavior.
Kind regards, Johannes