This commit is contained in:
Niels Lyngsø
2024-11-07 15:45:45 +01:00
parent 4dcd2b1729
commit a26d49e5b7
3 changed files with 19 additions and 57 deletions

View File

@@ -21,31 +21,16 @@ export class UmbDashboardElement extends UmbElementMixin(LitElement) {
},
];
/**
*
*/
constructor() {
super();
console.log('modal element loaded');
}
override render() {
return html`
<div>
umb-example modal
Dashboard 1
<ul>
<li><a href="section/content/dashboard/example/tab1">Tab 1</a></li>
<li><a href="section/content/dashboard/example/tab2">Tab 2 (with modal)</a></li>
</ul>
<hr />
<umb-router-slot
.routes=${this._routes}
@init=${(event: UmbRouterSlotInitEvent) => {
console.log('tab routes init', event);
}}
@change=${(event: UmbRouterSlotChangeEvent) => {
console.log('modal routes change', event);
}}></umb-router-slot>
<umb-router-slot .routes=${this._routes}></umb-router-slot>
</div>
`;
}

View File

@@ -17,9 +17,7 @@ export class UmbDashboard2Element extends UmbElementMixin(LitElement) {
Clicking this link will not load the slots inside the modal, however, going to the "Modal Dashboard", clicking
on tab 2 and opening the modal from there will work.
</p>
<a href="section/content/dashboard/example/tab2/modal/example-routed-modal/view/abc123/overview"
>Open Modal Route</a
>
<a href="section/content/dashboard/example/tab2/modal/example-routed-modal/view/abc123/">Open Modal Route</a>
</div>
`;
}

View File

@@ -6,48 +6,27 @@ import type { UmbRoute, UmbRouterSlotChangeEvent, UmbRouterSlotInitEvent } from
@customElement('umb-example-modal')
export class UmbExampleModal extends UmbModalBaseElement {
@state()
private _routes: UmbRoute[] = [];
/**
*
*/
constructor() {
super();
console.log('modal element loaded');
}
override connectedCallback(): void {
super.connectedCallback();
this._routes = [
{
path: `overview`,
component: () => import('./steps/example-modal-step1.element.js'),
},
{
path: `details`,
component: () => import('./steps/example-modal-step2.element.js'),
},
// NL: There is a problem with this one, but there is more problems as the modal does not close when navigating the browser history.
/*{
path: '',
redirectTo: 'overview',
},*/
];
}
private _routes: UmbRoute[] = [
{
path: `overview`,
component: () => import('./steps/example-modal-step1.element.js'),
},
{
path: `details`,
component: () => import('./steps/example-modal-step2.element.js'),
},
{
path: '',
redirectTo: 'overview',
},
];
override render() {
return html`
<div>
umb-example modal
umb-example modal element
<hr />
<umb-router-slot
.routes=${this._routes}
@init=${(event: UmbRouterSlotInitEvent) => {
console.log('modal route init fired', event);
}}
@change=${(event: UmbRouterSlotChangeEvent) => {
console.log('modal routes change', event);
}}></umb-router-slot>
<umb-router-slot .routes=${this._routes}></umb-router-slot>
</div>
`;
}