Cookie Consent by Free Privacy Policy Generator 📌 Creating your own UI extension points in Umbraco v14 - Part 2: Extension Slots

🏠 Team IT Security News

TSecurity.de ist eine Online-Plattform, die sich auf die Bereitstellung von Informationen,alle 15 Minuten neuste Nachrichten, Bildungsressourcen und Dienstleistungen rund um das Thema IT-Sicherheit spezialisiert hat.
Ob es sich um aktuelle Nachrichten, Fachartikel, Blogbeiträge, Webinare, Tutorials, oder Tipps & Tricks handelt, TSecurity.de bietet seinen Nutzern einen umfassenden Überblick über die wichtigsten Aspekte der IT-Sicherheit in einer sich ständig verändernden digitalen Welt.

16.12.2023 - TIP: Wer den Cookie Consent Banner akzeptiert, kann z.B. von Englisch nach Deutsch übersetzen, erst Englisch auswählen dann wieder Deutsch!

Google Android Playstore Download Button für Team IT Security



📚 Creating your own UI extension points in Umbraco v14 - Part 2: Extension Slots


💡 Newskategorie: Programmierung
🔗 Quelle: dev.to

In our first post in this series, we looked at the basics of setting up our "quick actions" section for our UI.

Quick Action Buttons

In that post we manually fetched and observed the extensions registry for quick action definitions and then rendered out our button elements individually.

In this post we'll take a look at how we can do without this repetitive manual setup and make use of some other manifest extension points.

Componentization

Lets start by moving our quick action button to it's own component.

@customElement("quick-action")
export class QuickActionElement extends UmbElementMixin(LitElement) {

    @property({ type: Object, attribute: false })
    manifest!: ManifestQuickAction;

    render() {
        return html`<uui-button 
                look=${this.manifest.meta.look ?? 'secondary'}
                @click=${() => console.log(this.manifest.meta.label)}>
                ${this.manifest.meta.label}
           </uui-button>`
    }
}

export default QuickActionElement;

declare global {
    interface HTMLElementTagNameMap {
        "quick-action": QuickActionElement;
    }
}

This should be a relatively familiar setup for creating a web component. The only "special" thing here is the manifest property which accepts a copy of the manifest definition for the given quick action that this instance of the component is rendering.

Component registration

For the time being, we need to make our component definition globally accessible and so to do this we need to export it in our root level index.ts file.

export * from "./components/quick-action.element.ts";

We'll handle this better in a future blog post, but for now, this is the simplest way to make our component easily instantiatable.

Rendering

Now we can update our workspace component, removing all the code we wrote in our constructor, and getting rid of the state variable that held out quick action definitions and we can instead make use of a helper component that will take care of all of this for us.

Update your render function as follows:

render() {
   return html`<uui-box headline="Actions">
       <umb-extension-slot 
           type="quickAction"
           default-element="quick-action-button">
       </umb-extension-slot>
   </uui-box>`
}

So now, instead of us manually fetching our definitions, the umb-extension-slot will do the manifests lookup for us. It will fetch all manifests of the defined type and render each one using our quick-action-button element, as defined by the default-element attribute (this is why we needed to register our component globally for now, as it has to be referenced by name).

In addition, each instantiated element will also have the given manifest automatically injecting into its manifest property, allowing it to configure it's behavior accordingly.

What's next?

In this post we've componentized our quick actions, and made use of the umb-extension-slot to save us having to write a bunch of repetitive code.

Effectively though are buttons are still tied to a single implementation so in the next post we'll take a look at how we can make the buttons click handler customizable.

Until then 👋

...



📌 Reusing Umbraco Properties in Umbraco v14


📈 62.06 Punkte

📌 Slots, Slots, Slots, Everybody!


📈 58.6 Punkte

📌 Early Adopter Umbraco v14 - Workspaces


📈 41.97 Punkte

📌 Early Adopter's guide to Umbraco v14 [Trees] - Types and entities.


📈 41.97 Punkte

📌 Early Adopter's guide to Umbraco v14 [Trees] - Backend c# code


📈 41.97 Punkte

📌 Simplifying Imports with TypeScript Path Aliases in Umbraco v14


📈 41.97 Punkte

📌 Enhancing Asynchronous Data Fetching in Umbraco v14 with Lit Async Directives


📈 41.97 Punkte

📌 Huawei releases it's own desktop PC with their own OS based on Linux and their own ARM CPU.


📈 26.63 Punkte

📌 317x Dominos CA With 60+ Points (Points Capture)


📈 25.42 Punkte

📌 OSCP Bonus Points Update: Sunsetting PEN-200 Legacy Course Exercises and a New Way to Achieve Points!


📈 25.42 Punkte

📌 Automattic: Gaining unlimited bonus points on websites with WooCommerce Points and Rewards


📈 25.42 Punkte

📌 Microsoft wants to let you dub videos using your own voice in your own language, new patent reveals


📈 24.73 Punkte

📌 How you can create your own custom chatbot with your own custom data using Google Gemini API all for free


📈 24.73 Punkte

📌 Use Beat Saber's Level Editor to create your own tracks with your own music


📈 24.73 Punkte

📌 How to check empty RAM slots on your Windows 10 PC


📈 23.02 Punkte

📌 How to check empty RAM slots on your Windows 10 PC


📈 23.02 Punkte

📌 Don't how many RAM slots are on your PC? Here's how to tell on Windows 10.


📈 23.02 Punkte

📌 Pathway to creating your own Action (Assistant on Air)


📈 22.58 Punkte

📌 Understanding Express.js: Creating Your Own Node HTTP Request Router


📈 22.58 Punkte

📌 Creating Your Own DeepPartial Type in Typescript to Allow Any Subset of Object Properties Deeply


📈 22.58 Punkte

📌 Creating a Fun and Engaging Workplace - Create your own Emojis


📈 22.58 Punkte

📌 Creating your own linux flavour


📈 22.58 Punkte

📌 Any good resources on creating your own distribution?


📈 22.58 Punkte

📌 Creating and using your own deb repository (not mirroring)


📈 22.58 Punkte

📌 5 Simple Steps to Creating Your Very Own npm Module


📈 22.58 Punkte

📌 HPR3995: Creating Your Own Internet Radio Streaming Device


📈 22.58 Punkte

📌 Creating your own handwriting into a usable font.


📈 22.58 Punkte

📌 Creating your own ChatGPT without coding — A Step by Step Guide


📈 22.58 Punkte

📌 ON1 Photo RAW 2020 v14.0 Englisch


📈 21.88 Punkte

📌 BAföG-Rechner 2020 v14.5.1 Deutsch


📈 21.88 Punkte

📌 ESET Internet Security 2021 v14.1 Deutsch


📈 21.88 Punkte

📌 ESET NOD32 Antivirus 2021 v14.1 Deutsch


📈 21.88 Punkte

📌 ACDSee Photo Studio Ultimate 2021 v14.0.1 Deutsch


📈 21.88 Punkte











matomo