From e2d097f03ac72442984f027ece1e51d1aa8d9b83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Tue, 6 Aug 2024 10:20:56 +0200 Subject: [PATCH] more clean up --- .../modal-routed/dashboard.element.ts | 7 +- .../modal-routed/tabs/tab1.element.ts | 36 ++++------- .../modal-routed/tabs/tab2.element.ts | 64 +++++++++---------- 3 files changed, 44 insertions(+), 63 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/examples/modal-routed/dashboard.element.ts b/src/Umbraco.Web.UI.Client/examples/modal-routed/dashboard.element.ts index a4b1cd73d1..6fcae676ba 100644 --- a/src/Umbraco.Web.UI.Client/examples/modal-routed/dashboard.element.ts +++ b/src/Umbraco.Web.UI.Client/examples/modal-routed/dashboard.element.ts @@ -1,12 +1,7 @@ import { css, html, LitElement, customElement, state } from '@umbraco-cms/backoffice/external/lit'; import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; import { UmbElementMixin } from '@umbraco-cms/backoffice/element-api'; -import type { - UmbModalRouteRegistrationController, - UmbRoute, - UmbRouterSlotChangeEvent, - UmbRouterSlotInitEvent, -} from '@umbraco-cms/backoffice/router'; +import type { UmbRoute, UmbRouterSlotChangeEvent, UmbRouterSlotInitEvent } from '@umbraco-cms/backoffice/router'; @customElement('umb-dashboard') export class UmbDashboardElement extends UmbElementMixin(LitElement) { diff --git a/src/Umbraco.Web.UI.Client/examples/modal-routed/tabs/tab1.element.ts b/src/Umbraco.Web.UI.Client/examples/modal-routed/tabs/tab1.element.ts index 1c361976a0..463b31824e 100644 --- a/src/Umbraco.Web.UI.Client/examples/modal-routed/tabs/tab1.element.ts +++ b/src/Umbraco.Web.UI.Client/examples/modal-routed/tabs/tab1.element.ts @@ -1,38 +1,28 @@ -import { css, html, LitElement } from 'lit'; -import { customElement, state } from 'lit/decorators.js'; -import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; +import { css, html, LitElement, customElement, state } from '@umbraco-cms/backoffice/external/lit'; import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; import { UmbElementMixin } from '@umbraco-cms/backoffice/element-api'; -import { UmbModalRouteRegistrationController } from '@umbraco-cms/backoffice/router'; -import { EXAMPLE_ROUTED_MODAL } from './modal/example-modal-token'; @customElement('umb-dashboard-tab1') export class UmbDashboardTab1Element extends UmbElementMixin(LitElement) { - - #workspaceModal?: UmbModalRouteRegistrationController; - - @state() + @state() _editLinkPath?: string; - constructor() { - super(); + constructor() { + super(); + } - } - - override render() { - return html` -
-

tab 1

- -
- ` - - } + override render() { + return html` +
+

tab 1

+
+ `; + } static override styles = [UmbTextStyles, css``]; } -export default UmbDashboardTab1Element +export default UmbDashboardTab1Element; declare global { interface UmbDashboardTab1Element { diff --git a/src/Umbraco.Web.UI.Client/examples/modal-routed/tabs/tab2.element.ts b/src/Umbraco.Web.UI.Client/examples/modal-routed/tabs/tab2.element.ts index 85c761a461..11799d01b0 100644 --- a/src/Umbraco.Web.UI.Client/examples/modal-routed/tabs/tab2.element.ts +++ b/src/Umbraco.Web.UI.Client/examples/modal-routed/tabs/tab2.element.ts @@ -1,56 +1,52 @@ -import { css, html, LitElement } from 'lit'; -import { customElement, state } from 'lit/decorators.js'; -import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; +import { EXAMPLE_ROUTED_MODAL } from '../modal/example-modal-token.js'; +import { css, html, LitElement, customElement, state } from '@umbraco-cms/backoffice/external/lit'; import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; import { UmbElementMixin } from '@umbraco-cms/backoffice/element-api'; import { UmbModalRouteRegistrationController } from '@umbraco-cms/backoffice/router'; -import { EXAMPLE_ROUTED_MODAL } from './../modal/example-modal-token'; @customElement('umb-dashboard-tab2') export class UmbDashboardTab2Element extends UmbElementMixin(LitElement) { - #workspaceModal?: UmbModalRouteRegistrationController; - @state() + @state() _editLinkPath?: string; - constructor() { - super(); + constructor() { + super(); - // Using workspace modal context - this.#workspaceModal?.destroy(); - this.#workspaceModal = new UmbModalRouteRegistrationController(this, EXAMPLE_ROUTED_MODAL) - .addAdditionalPath('view/:entityKey') - .onSetup(() => { - return { - data: {}, - value: {} - }; - }) - .observeRouteBuilder((routeBuilder) => { - this._editLinkPath = routeBuilder({entityKey : 'abc123'}); - }); - } + // Using workspace modal context + this.#workspaceModal?.destroy(); + this.#workspaceModal = new UmbModalRouteRegistrationController(this, EXAMPLE_ROUTED_MODAL) + .addAdditionalPath('view/:entityKey') + .onSetup(() => { + return { + data: {}, + value: {}, + }; + }) + .observeRouteBuilder((routeBuilder) => { + this._editLinkPath = routeBuilder({ entityKey: 'abc123' }); + }); + } - override render() { - return html` -
-

tab 2

+ override render() { + return html` +
+

tab 2

This element hosts the UmbModalRouteRegistrationController

- Open modal -
+ Open modal +
- Path: ${this._editLinkPath} -
- ` - - } + Path: ${this._editLinkPath} +
+ `; + } static override styles = [UmbTextStyles, css``]; } -export default UmbDashboardTab2Element +export default UmbDashboardTab2Element; declare global { interface UmbDashboardTab2Element {