fix(core): update
This commit is contained in:
@ -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;
|
||||
|
@ -1,19 +1,17 @@
|
||||
import { LitElement, property, html, customElement, TemplateResult } from 'lit-element';
|
||||
import { WccDashboard } from './wcc-dashboard';
|
||||
|
||||
@customElement('wcc-sidebar')
|
||||
export class WccSidebar extends LitElement {
|
||||
@property({type: Array})
|
||||
public websites: string[] = [];
|
||||
|
||||
@property()
|
||||
public pages: { [key: string]: TemplateResult } = {};
|
||||
|
||||
@property()
|
||||
public elements: { [key: string]: LitElement } = {};
|
||||
|
||||
@property({ attribute: false })
|
||||
public selectedItem: LitElement | TemplateResult;
|
||||
|
||||
@property()
|
||||
public dashboardRef: WccDashboard;
|
||||
|
||||
public render(): TemplateResult {
|
||||
return html`
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />
|
||||
@ -100,14 +98,15 @@ export class WccSidebar extends LitElement {
|
||||
})}
|
||||
<h3>Pages</h3>
|
||||
${(() => {
|
||||
const pages = Object.keys(this.pages);
|
||||
const pages = Object.keys(this.dashboardRef.pages);
|
||||
return pages.map(pageName => {
|
||||
const item = this.pages[pageName];
|
||||
const item = this.dashboardRef.pages[pageName];
|
||||
return html`
|
||||
<div
|
||||
class="selectOption ${this.selectedItem === item ? 'selected' : console.log('hi')}"
|
||||
@click=${() => {
|
||||
this.selectItem(item);
|
||||
this.dashboardRef.domtools.router.pushUrl(`/pages/${pageName}`);
|
||||
}}
|
||||
>
|
||||
<i class="material-icons">insert_drive_file</i>
|
||||
@ -118,14 +117,15 @@ export class WccSidebar extends LitElement {
|
||||
})()}
|
||||
<h3>Elements</h3>
|
||||
${(() => {
|
||||
const elements = Object.keys(this.elements);
|
||||
const elements = Object.keys(this.dashboardRef.elements);
|
||||
return elements.map(elementName => {
|
||||
const item = this.elements[elementName];
|
||||
const item = this.dashboardRef.elements[elementName];
|
||||
return html`
|
||||
<div
|
||||
class="selectOption ${this.selectedItem === item ? 'selected' : console.log('hi')}"
|
||||
@click=${() => {
|
||||
this.selectItem(item);
|
||||
this.dashboardRef.domtools.router.pushUrl(`/elements/${elementName}`);
|
||||
}}
|
||||
>
|
||||
<i class="material-icons">featured_video</i>
|
||||
|
Reference in New Issue
Block a user