ui5-webcomponents icon indicating copy to clipboard operation
ui5-webcomponents copied to clipboard

UI5 Web Components Enablement in OpenUI5: support all UI5 concepts that apply to UI5 Controls

Open ilhan007 opened this issue 5 years ago • 3 comments

As part of the Retrofit topic, we aim to reuse the UI5 Web Components inside the UI5 Controls. In order to do this, we have to check all UI5 concepts that apply to UI5 Controls to ensure the ones that will start to use internally UI5 Web Components would be able to support those concepts.

For example:

  • Badge concept
  • Enabled/Disabled in container
  • Busy Indicators etc.
  • Form labelling

ilhan007 avatar Mar 09 '21 08:03 ilhan007

A couple of things to test and consider:

  • Using retrofit controls instead of their counterparts in typical sap.m apps: f.e. ui5-button in a toolbar, ui5-input in a form. Check what happens? Do they have to implement sap.m interfaces? Do they look bad since they don't get overstyled?
  • Check how many controls get as public aggregations things such as sap.m.Button and similar building blocks. Would they be able to accept also retrofit buttons? Can we change them easily?
  • Check for OpenUi5 concepts such as LabelEnablement and similar, which traverse controls and change their state. Do they work with retrofit controls?
  • Check how retrofit controls work in forms in OpenUI5 - do they have the necessary APIs to work there?

vladitasev avatar Apr 14 '21 08:04 vladitasev

  • [ ] 1. Enabled/Disabled propagation

The EnablePropagator (even used) don't work as with standard UI5 Controls.

Example: Disabled Toolbar (enabled: false) with sap.ui.webcomponents.Button instances. In this case, the buttons remains enabled, because of the aforementioned reason. In case of sap.m.Button instances - they automatically become disabled because their parent container, the Toolbar, is disabled.

Possible Solution

// Button.js
enabled: {
	type: "boolean",
	defaultValue: true,
	mapping: {
		type: "attribute",
		to: "disabled",
		formatter: "_mapEnabled"
	}
},

// WebComponent.js
WebComponent.prototype._mapEnabled = function(bEnabled) {
    return !bEnabled;
};
  • [ ] 2. Element (like CustomData) as aggregation of web component wrappers. WebComponentsRenderer should handle aggregated controls that do not have renderers, because currently case like this fails.

Example

new sap.ui.webcomponents.Button({
	customData: [
	      new sap.m.BadgeCustomData({
		  key: "badge",
		  value: "5"
	       })
       ]
}).placeAt("app");

Causes Uncaught Error: failed to load 'sap/m/BadgeCustomDataRenderer.js'

Possible Solution

// WebComponentRenderer.js
if (oValue.getRenderer && oValue.getRenderer()) {
	oRm.renderControl(oValue);
}
  • [ ] 3. Setting Busy state does not work everywhere. For the Button, List, Table the loading indicator shows correctly, but for the Avatar, RatingIndicator- it is not visible at all. The Core busy indicator is appended in the components light DOM as a child.

Example

new sap.ui.webcomponents.Avatar({
       busy: true,
}).placeAt("app");

Possible solution:

  • add slot "busy" to slot the core busy indicator in the ShadowDom

  • [ ] 4. Issues of sap.ui.webcomponents.Inputin Grid layout/ SImpleForm

  • layout issues - see how the input is cut off

Screenshot 2021-04-15 at 18 15 40
  • labelling - clicking the label does not focus the wc.Input

ilhan007 avatar Apr 14 '21 09:04 ilhan007

Findings about Check how many controls get as public aggregations things such as sap.m.Button and similar building blocks. Would they be able to accept also retrofit buttons? Can we change them easily?:

  • Controls & components are techically interchangeable as slots to both Contrls/Components wrappers aggregations.
  • There are some size & positioning issues (I would assume that it is expected that sap.m.Button and ui5-button would will have consistent behaviour, which is not the case right now). For example, we have sap.m.Button, ui5-button, sap.m.Input and ui5-input all nested as aggregation in ui5-panel. This is the result:

image

  • For the icon, there is a deviation in the default colour in addition to the size & positioning differences:

image

fifoosid avatar Apr 21 '21 09:04 fifoosid