2024-01-24 12:18:37 +01:00
|
|
|
import {
|
|
|
|
DeesElement,
|
|
|
|
type TemplateResult,
|
|
|
|
property,
|
|
|
|
customElement,
|
|
|
|
html,
|
|
|
|
css,
|
|
|
|
cssManager,
|
2025-06-17 08:41:36 +00:00
|
|
|
state,
|
2024-01-24 12:18:37 +01:00
|
|
|
} from '@design.estate/dees-element';
|
2025-06-17 08:41:36 +00:00
|
|
|
import * as interfaces from './interfaces/index.js';
|
2025-06-17 09:55:28 +00:00
|
|
|
import * as plugins from './00plugins.js';
|
2025-06-17 08:41:36 +00:00
|
|
|
import type { DeesAppuiBar } from './dees-appui-appbar.js';
|
|
|
|
import type { DeesAppuiMainmenu } from './dees-appui-mainmenu.js';
|
|
|
|
import type { DeesAppuiMainselector } from './dees-appui-mainselector.js';
|
|
|
|
import type { DeesAppuiMaincontent } from './dees-appui-maincontent.js';
|
|
|
|
import type { DeesAppuiActivitylog } from './dees-appui-activitylog.js';
|
|
|
|
import { demoFunc } from './dees-appui-base.demo.js';
|
|
|
|
|
|
|
|
// Import child components
|
|
|
|
import './dees-appui-appbar.js';
|
|
|
|
import './dees-appui-mainmenu.js';
|
|
|
|
import './dees-appui-mainselector.js';
|
|
|
|
import './dees-appui-maincontent.js';
|
|
|
|
import './dees-appui-activitylog.js';
|
2024-01-24 12:18:37 +01:00
|
|
|
|
|
|
|
@customElement('dees-appui-base')
|
|
|
|
export class DeesAppuiBase extends DeesElement {
|
2025-06-17 08:41:36 +00:00
|
|
|
public static demo = demoFunc;
|
|
|
|
|
|
|
|
// Properties for appbar
|
|
|
|
@property({ type: Array })
|
|
|
|
public appbarMenuItems: interfaces.IAppBarMenuItem[] = [];
|
|
|
|
|
|
|
|
@property({ type: String })
|
|
|
|
public appbarBreadcrumbs: string = '';
|
|
|
|
|
|
|
|
@property({ type: String })
|
|
|
|
public appbarBreadcrumbSeparator: string = ' > ';
|
|
|
|
|
|
|
|
@property({ type: Boolean })
|
|
|
|
public appbarShowWindowControls: boolean = true;
|
|
|
|
|
|
|
|
|
|
|
|
@property({ type: Object })
|
|
|
|
public appbarUser?: {
|
|
|
|
name: string;
|
2025-06-17 09:55:28 +00:00
|
|
|
email?: string;
|
2025-06-17 08:41:36 +00:00
|
|
|
avatar?: string;
|
|
|
|
status?: 'online' | 'offline' | 'busy' | 'away';
|
|
|
|
};
|
|
|
|
|
2025-06-17 09:55:28 +00:00
|
|
|
@property({ type: Array })
|
|
|
|
public appbarProfileMenuItems: (plugins.tsclass.website.IMenuItem & { shortcut?: string } | { divider: true })[] = [];
|
|
|
|
|
2025-06-17 08:41:36 +00:00
|
|
|
@property({ type: Boolean })
|
|
|
|
public appbarShowSearch: boolean = false;
|
|
|
|
|
|
|
|
// Properties for mainmenu
|
|
|
|
@property({ type: Array })
|
|
|
|
public mainmenuTabs: interfaces.ITab[] = [];
|
|
|
|
|
|
|
|
@property({ type: Object })
|
|
|
|
public mainmenuSelectedTab?: interfaces.ITab;
|
|
|
|
|
|
|
|
// Properties for mainselector
|
|
|
|
@property({ type: Array })
|
2025-06-17 10:00:50 +00:00
|
|
|
public mainselectorOptions: (interfaces.ISelectionOption | { divider: true })[] = [];
|
2025-06-17 08:41:36 +00:00
|
|
|
|
|
|
|
@property({ type: Object })
|
|
|
|
public mainselectorSelectedOption?: interfaces.ISelectionOption;
|
|
|
|
|
|
|
|
// Properties for maincontent
|
|
|
|
@property({ type: Array })
|
|
|
|
public maincontentTabs: interfaces.ITab[] = [];
|
|
|
|
|
|
|
|
// References to child components
|
|
|
|
@state()
|
|
|
|
public appbar?: DeesAppuiBar;
|
|
|
|
|
|
|
|
@state()
|
|
|
|
public mainmenu?: DeesAppuiMainmenu;
|
|
|
|
|
|
|
|
@state()
|
|
|
|
public mainselector?: DeesAppuiMainselector;
|
|
|
|
|
|
|
|
@state()
|
|
|
|
public maincontent?: DeesAppuiMaincontent;
|
|
|
|
|
|
|
|
@state()
|
|
|
|
public activitylog?: DeesAppuiActivitylog;
|
2024-01-24 12:18:37 +01:00
|
|
|
|
|
|
|
public static styles = [
|
|
|
|
cssManager.defaultStyles,
|
|
|
|
css`
|
|
|
|
:host {
|
|
|
|
position: absolute;
|
|
|
|
height: 100%;
|
|
|
|
width: 100%;
|
2025-06-17 08:58:47 +00:00
|
|
|
background: ${cssManager.bdTheme('#f0f0f0', '#1a1a1a')};
|
2024-01-24 12:18:37 +01:00
|
|
|
}
|
|
|
|
.maingrid {
|
|
|
|
position: absolute;
|
|
|
|
top: 40px;
|
|
|
|
height: calc(100% - 40px);
|
|
|
|
width: 100%;
|
|
|
|
display: grid;
|
2025-06-17 08:41:36 +00:00
|
|
|
grid-template-columns: 60px 240px 1fr 240px;
|
2024-01-24 12:18:37 +01:00
|
|
|
}
|
|
|
|
`,
|
|
|
|
];
|
|
|
|
|
|
|
|
// INSTANCE
|
|
|
|
public render(): TemplateResult {
|
|
|
|
return html`
|
|
|
|
<style></style>
|
2025-06-17 08:41:36 +00:00
|
|
|
<dees-appui-appbar
|
|
|
|
.menuItems=${this.appbarMenuItems}
|
|
|
|
.breadcrumbs=${this.appbarBreadcrumbs}
|
|
|
|
.breadcrumbSeparator=${this.appbarBreadcrumbSeparator}
|
|
|
|
.showWindowControls=${this.appbarShowWindowControls}
|
|
|
|
.user=${this.appbarUser}
|
2025-06-17 09:55:28 +00:00
|
|
|
.profileMenuItems=${this.appbarProfileMenuItems}
|
2025-06-17 08:41:36 +00:00
|
|
|
.showSearch=${this.appbarShowSearch}
|
|
|
|
@menu-select=${(e: CustomEvent) => this.handleAppbarMenuSelect(e)}
|
|
|
|
@breadcrumb-navigate=${(e: CustomEvent) => this.handleAppbarBreadcrumbNavigate(e)}
|
|
|
|
@search-click=${() => this.handleAppbarSearchClick()}
|
|
|
|
@user-menu-open=${() => this.handleAppbarUserMenuOpen()}
|
2025-06-17 09:55:28 +00:00
|
|
|
@profile-menu-select=${(e: CustomEvent) => this.handleAppbarProfileMenuSelect(e)}
|
2025-06-17 08:41:36 +00:00
|
|
|
></dees-appui-appbar>
|
2024-01-24 12:18:37 +01:00
|
|
|
<div class="maingrid">
|
2025-06-17 08:41:36 +00:00
|
|
|
<dees-appui-mainmenu
|
|
|
|
.tabs=${this.mainmenuTabs}
|
|
|
|
.selectedTab=${this.mainmenuSelectedTab}
|
|
|
|
@tab-select=${(e: CustomEvent) => this.handleMainmenuTabSelect(e)}
|
|
|
|
></dees-appui-mainmenu>
|
|
|
|
<dees-appui-mainselector
|
|
|
|
.selectionOptions=${this.mainselectorOptions}
|
|
|
|
.selectedOption=${this.mainselectorSelectedOption}
|
|
|
|
@option-select=${(e: CustomEvent) => this.handleMainselectorOptionSelect(e)}
|
|
|
|
></dees-appui-mainselector>
|
|
|
|
<dees-appui-maincontent
|
|
|
|
.tabs=${this.maincontentTabs}
|
|
|
|
>
|
|
|
|
<slot name="maincontent"></slot>
|
|
|
|
</dees-appui-maincontent>
|
2024-01-24 12:18:37 +01:00
|
|
|
<dees-appui-activitylog></dees-appui-activitylog>
|
|
|
|
</div>
|
|
|
|
`;
|
|
|
|
}
|
2025-06-17 08:41:36 +00:00
|
|
|
|
|
|
|
async firstUpdated() {
|
|
|
|
// Get references to child components
|
|
|
|
this.appbar = this.shadowRoot.querySelector('dees-appui-appbar');
|
|
|
|
this.mainmenu = this.shadowRoot.querySelector('dees-appui-mainmenu');
|
|
|
|
this.mainselector = this.shadowRoot.querySelector('dees-appui-mainselector');
|
|
|
|
this.maincontent = this.shadowRoot.querySelector('dees-appui-maincontent');
|
|
|
|
this.activitylog = this.shadowRoot.querySelector('dees-appui-activitylog');
|
|
|
|
}
|
|
|
|
|
|
|
|
// Event handlers for appbar
|
|
|
|
private handleAppbarMenuSelect(e: CustomEvent) {
|
|
|
|
this.dispatchEvent(new CustomEvent('appbar-menu-select', {
|
|
|
|
detail: e.detail,
|
|
|
|
bubbles: true,
|
|
|
|
composed: true
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
|
|
|
|
private handleAppbarBreadcrumbNavigate(e: CustomEvent) {
|
|
|
|
this.dispatchEvent(new CustomEvent('appbar-breadcrumb-navigate', {
|
|
|
|
detail: e.detail,
|
|
|
|
bubbles: true,
|
|
|
|
composed: true
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
|
|
|
|
private handleAppbarSearchClick() {
|
|
|
|
this.dispatchEvent(new CustomEvent('appbar-search-click', {
|
|
|
|
bubbles: true,
|
|
|
|
composed: true
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
|
|
|
|
private handleAppbarUserMenuOpen() {
|
|
|
|
this.dispatchEvent(new CustomEvent('appbar-user-menu-open', {
|
|
|
|
bubbles: true,
|
|
|
|
composed: true
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
|
2025-06-17 09:55:28 +00:00
|
|
|
private handleAppbarProfileMenuSelect(e: CustomEvent) {
|
|
|
|
this.dispatchEvent(new CustomEvent('appbar-profile-menu-select', {
|
|
|
|
detail: e.detail,
|
|
|
|
bubbles: true,
|
|
|
|
composed: true
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
|
2025-06-17 08:41:36 +00:00
|
|
|
// Event handlers for mainmenu
|
|
|
|
private handleMainmenuTabSelect(e: CustomEvent) {
|
|
|
|
this.mainmenuSelectedTab = e.detail.tab;
|
|
|
|
this.dispatchEvent(new CustomEvent('mainmenu-tab-select', {
|
|
|
|
detail: e.detail,
|
|
|
|
bubbles: true,
|
|
|
|
composed: true
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
|
|
|
|
// Event handlers for mainselector
|
|
|
|
private handleMainselectorOptionSelect(e: CustomEvent) {
|
|
|
|
this.mainselectorSelectedOption = e.detail.option;
|
|
|
|
this.dispatchEvent(new CustomEvent('mainselector-option-select', {
|
|
|
|
detail: e.detail,
|
|
|
|
bubbles: true,
|
|
|
|
composed: true
|
|
|
|
}));
|
|
|
|
}
|
2024-01-24 12:18:37 +01:00
|
|
|
}
|