fix(core): update

This commit is contained in:
2020-07-15 19:55:35 +00:00
parent ba83aad026
commit 53ff02c490
6 changed files with 2411 additions and 2002 deletions

View File

@ -11,6 +11,8 @@ import './wcc-properties';
@customElement('wcc-dashboard')
export class WccDashboard extends LitElement {
public domtools: plugins.deesDomtools.DomTools;
@property()
public selectedItem: TemplateResult | LitElement;
@ -35,6 +37,18 @@ export class WccDashboard extends LitElement {
if (pagesArg) {
this.pages = pagesArg;
}
this.init();
}
public async init() {
this.domtools = await plugins.deesDomtools.DomTools.setupDomTools();
this.domtools.router.on('/elements/:elementName', async routeInfo => {
this.selectedItem = this.elements[routeInfo.params.elementName];
});
this.domtools.router.on('/pages/:pageName', async routeInfo => {
this.selectedItem = this.pages[routeInfo.params.pageName];
});
}
public render(): TemplateResult {
@ -51,7 +65,7 @@ export class WccDashboard extends LitElement {
display: none;
}
</style>
<wcc-sidebar .pages=${this.pages} .elements=${this.elements} @selectedItem=${eventArg => {
<wcc-sidebar .dashboardRef=${this} @selectedItem=${eventArg => {
this.selectedItem = eventArg.detail;
}}></wcc-sidebar>
<wcc-properties .warning="${this.warning}" .selectedItem=${this.selectedItem} @selectedViewport=${eventArg => {this.selectedViewport = eventArg.detail; this.updateSlot();}}></wcc-properties>
@ -90,9 +104,9 @@ export class WccDashboard extends LitElement {
const localSelectedItem = this.selectedItem;
this.selectedItem = null;
console.log('updateSlot');
const domtools = await plugins.deesDomtools.DomTools.setupDomTools();
domtools.setVirtualViewport(this.selectedViewport);
await super.performUpdate();
this.domtools = await plugins.deesDomtools.DomTools.setupDomTools();
this.domtools.setVirtualViewport(this.selectedViewport);
// await super.performUpdate();
this.selectedItem = localSelectedItem;
await super.performUpdate();
this.currentlyUpdating = false;