fix(sdig-workspace): make workspace view externally controllable and preserve explicit initial state
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { DeesElement, property, state, html, customElement, type TemplateResult, css } from '@design.estate/dees-element';
|
||||
import { DeesElement, property, html, customElement, type TemplateResult, css } from '@design.estate/dees-element';
|
||||
import { icon, type TDensity, type TWorkspaceTheme, type TWorkspaceView } from './sdig-workspace.shared.js';
|
||||
import './sdig-workspace-inbox.js';
|
||||
import './sdig-workspace-compose.js';
|
||||
@@ -22,11 +22,13 @@ export class SdigWorkspace extends DeesElement {
|
||||
@property({ type: String }) public accessor density: TDensity = 'comfortable';
|
||||
@property({ type: String, reflect: true }) public accessor theme: TWorkspaceTheme = 'dark';
|
||||
@property({ type: String }) public accessor initialView: TWorkspaceView = 'inbox';
|
||||
@state() private accessor view: TWorkspaceView = 'inbox';
|
||||
@property({ type: String, reflect: true }) public accessor view: TWorkspaceView = 'inbox';
|
||||
|
||||
public connectedCallback = async () => {
|
||||
await super.connectedCallback();
|
||||
this.view = this.initialView || 'inbox';
|
||||
if (this.view === 'inbox' && this.initialView !== 'inbox') {
|
||||
this.view = this.initialView;
|
||||
}
|
||||
this.addEventListener('workspace-view-request', this.handleViewRequest as EventListener);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user