UI5con 2024 - Bring Your Own Design System

PeterMuessig1 88 views 23 slides Jun 11, 2024
Slide 1
Slide 1 of 23
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23

About This Presentation

How do you combine the OpenUI5/SAPUI5 programming model with a design system that makes its controls available as Web Components? Since OpenUI5/SAPUI5 1.120, the framework supports the integration of any Web Components. This makes it possible, for example, to natively embed own Web Components of you...


Slide Content

Bring Your Own Design System Integration of Web Components in OpenUI5/SAPUI5 Peter Muessig, SAP SE June 5 th , 2024

“What’s the best/easiest way to integrate Web Components into OpenUI5*?” Holger Schäfer, UI5con 2023 native * OpenUI5 also stands for SAPUI5

“OpenUI5 only supports UI5 Web Components!” Fake News

“Native Web Components can only be embedded using HTML in XMLViews !” Fake News

“Is it possible to use my own native Web Component with OpenUI5?” !! YES !!

kickstand-ui Kickstand UI is a design system and pattern library built with Web Components (using Stencil) with an OSS friendly license

How to Wrap a Native Web Component? TASK LIST 1. Create UI5 App

UI5 Tooling Extension for NPM packages Enables the direct usage of NPM packages in UI5 applications/libraries Configuration free (no shimming needed!) Converts any module into a UI5-AMD-like module ( sap.ui.define ) Supports loading and inclusion of assets (CSS, images, …) Provides a custom middleware: ui5-tooling-modules-middleware Extends the development server to load the modules and assets from NPM packages Provides a custom build task: ui5-tooling-modules-task Integrates the used modules and assets in the build output to allow to distribute the project Modules and assets can be included into the namespace of the application/library npm install ui5-tooling-modules --save-dev

How to Wrap a Native Web Component? TASK LIST 1. Create UI5 App 2. Install Dependencies

How to Wrap a Native Web Component? TASK LIST 1. Create UI5 App 2. Install Dependencies 3. Configure UI5 tooling ext.

How to Wrap a Native Web Component? TASK LIST 1. Create UI5 App 2. Install Dependencies 3. Configure UI5 tooling ext. 4. Include bootstrap script

Web Components Base Class Base Class to wrap Web Components as UI5 Control Lifecycle Integration (Databinding, Rendering, …) Seamless usage in SAPUI5 programming model Mapping Metadata for ( API ): HTML-Tag Properties Aggregations Events Methods Generic Renderer leveraging Metadata sap/ ui /core/ webc / WebComponent ( API ) WebComponent.extend (" my.WebComponent ", { […] metadata: { tagName : "my-web-component", properties : { […] }, aggregations : { […] }, associations : { […] }, events : { […] }, getters: [ " getterName ", … ], methods: [ " methodName ", … ], } […] });

Web Components Base Class sap /ui/ core / webc / WebComponent > metadata > properties WebComponent.extend (" my.WebComponent ", { […] metadata : { properties : { " propertyName ": { type: " string|number|boolean|object|any |…", mapping : { type: " property |style|textContent|slot|none ", [ to ]: " attribute -name", [ formatter ]: " mapPropertyValue " } } } } […] }); new my.WebComponent ({ propertyName : " value " }); < my -web- component attribute -name=" value " />

Web Components Base Class sap /ui/ core / webc / WebComponent > metadata > aggregations WebComponent.extend (" my.WebComponent ", { […] metadata : { aggregations : { " aggregationName ": { type: " sap.ui.core.Control ", [ slot ]: " slotName " } } } […] }); new my.WebComponent ({ aggregationName : [ new Button({ … }) ] }); < my -web- component > < button slot =" slotName "/> </ my -web- component >

Web Components Base Class sap /ui/ core / webc / WebComponent > metadata > associations WebComponent.extend (" my.WebComponent ", { […] metadata : { associations : { " associationName ": { type: " sap.ui.core.Control ", mapping : { type: " property ", [ to ]: " attribute -name", [ formatter ]: " mapAssociationValue " } } } } […] }); new my.WebComponent ({ aggregationName : [ new Button({ … }) ] }); < my -web- component attribute -name=" btn_ID " />

Web Components Base Class sap /ui/ core / webc / WebComponent > metadata > events WebComponent.extend (" my.WebComponent ", { […] metadata : { events : { " eventName ": { […] } } } […] }); new my.WebComponent ({ eventName : () => { … } }); Control# attachBrowserEvent ( " eventName ", … )

How to Wrap a Native Web Component? TASK LIST 1. Create UI5 App 2. Install Dependencies 3. Configure UI5 tooling ext. 4. Include bootstrap script 5. Implement Wrapper Web Component

How to Wrap a Native Web Component? TASK LIST 1. Create UI5 App 2. Install Dependencies 3. Configure UI5 tooling ext. 4. Include bootstrap script 5. Implement Wrapper Web Component 6. Use it in XMLView

How to Wrap a Native Web Component? TASK LIST 1. Create UI5 App 2. Install Dependencies 3. Configure UI5 tooling ext. 4. Include bootstrap script 5. Implement Wrapper Web Component 6. Use it in XMLView 7. Run it and enjoy…

“This is tedious, isn’t it? Is there a better way to enable my Design System for OpenUI5?” !!!! SURE !!!!

Productive Solution: Generator & UI Library Generator UI Library

Generator for Kickstand Web Components kickstand-ui (npm package created with stencil) collection- manifest.json … Button.js FormField.js UI5 Button.js … FormField.js Stencil stencil-ui5-generator Metadata

UI Library for Kickstand Web Components UI Libraries enable reusability UI Libraries bundle Controls (and Wrappers) Applications can simply reference UI Libraries Assets can be loaded once via the UI Library modules UI Libraries ensure maintainability Changes can be managed and rolled-out centrally UI Libraries optimize performance UI Library provides preloads for optimized loading UI Libraries for publishing UI Library can be published to npm for easy consumption What are the benefits of UI Libraries?