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-12-08 12:04:01 +00:00
|
|
|
import * as interfaces from '../../interfaces/index.js';
|
|
|
|
|
import * as plugins from '../../00plugins.js';
|
Refactor import paths for consistency and clarity across multiple components
- Updated import paths in dees-panel, dees-pdf, dees-progressbar, dees-searchbar, dees-shopping-productcard, dees-simple-appdash, dees-speechbubble, dees-statsgrid, dees-table, dees-toast, dees-updater, and dees-windowlayer to use consistent directory structure.
- Created index.ts files for various components to streamline imports and improve modularity.
- Ensured all imports point to the correct subdirectory structure, enhancing maintainability and readability of the codebase.
2025-12-05 10:19:37 +00:00
|
|
|
import type { DeesAppuiBar } from '../dees-appui-appbar/index.js';
|
|
|
|
|
import type { DeesAppuiMainmenu } from '../dees-appui-mainmenu/dees-appui-mainmenu.js';
|
2025-12-08 14:35:06 +00:00
|
|
|
import type { DeesAppuiSecondarymenu } from '../dees-appui-secondarymenu/dees-appui-secondarymenu.js';
|
Refactor import paths for consistency and clarity across multiple components
- Updated import paths in dees-panel, dees-pdf, dees-progressbar, dees-searchbar, dees-shopping-productcard, dees-simple-appdash, dees-speechbubble, dees-statsgrid, dees-table, dees-toast, dees-updater, and dees-windowlayer to use consistent directory structure.
- Created index.ts files for various components to streamline imports and improve modularity.
- Ensured all imports point to the correct subdirectory structure, enhancing maintainability and readability of the codebase.
2025-12-05 10:19:37 +00:00
|
|
|
import type { DeesAppuiMaincontent } from '../dees-appui-maincontent/dees-appui-maincontent.js';
|
|
|
|
|
import type { DeesAppuiActivitylog } from '../dees-appui-activitylog/dees-appui-activitylog.js';
|
2025-06-17 08:41:36 +00:00
|
|
|
import { demoFunc } from './dees-appui-base.demo.js';
|
|
|
|
|
|
|
|
|
|
// Import child components
|
2025-12-06 13:54:17 +00:00
|
|
|
import '../dees-appui-appbar/index.js';
|
|
|
|
|
import '../dees-appui-mainmenu/dees-appui-mainmenu.js';
|
2025-12-08 14:35:06 +00:00
|
|
|
import '../dees-appui-secondarymenu/dees-appui-secondarymenu.js';
|
2025-12-06 13:54:17 +00:00
|
|
|
import '../dees-appui-maincontent/dees-appui-maincontent.js';
|
|
|
|
|
import '../dees-appui-activitylog/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 })
|
2025-11-17 13:27:11 +00:00
|
|
|
accessor appbarMenuItems: interfaces.IAppBarMenuItem[] = [];
|
2025-06-17 08:41:36 +00:00
|
|
|
|
|
|
|
|
@property({ type: String })
|
2025-11-17 13:27:11 +00:00
|
|
|
accessor appbarBreadcrumbs: string = '';
|
2025-06-17 08:41:36 +00:00
|
|
|
|
|
|
|
|
@property({ type: String })
|
2025-11-17 13:27:11 +00:00
|
|
|
accessor appbarBreadcrumbSeparator: string = ' > ';
|
2025-06-17 08:41:36 +00:00
|
|
|
|
|
|
|
|
@property({ type: Boolean })
|
2025-11-17 13:27:11 +00:00
|
|
|
accessor appbarShowWindowControls: boolean = true;
|
2025-06-17 08:41:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
@property({ type: Object })
|
2025-11-17 13:27:11 +00:00
|
|
|
accessor appbarUser: {
|
2025-06-17 08:41:36 +00:00
|
|
|
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-11-17 13:27:11 +00:00
|
|
|
} | undefined = undefined;
|
2025-06-17 08:41:36 +00:00
|
|
|
|
2025-06-17 09:55:28 +00:00
|
|
|
@property({ type: Array })
|
2025-11-17 13:27:11 +00:00
|
|
|
accessor appbarProfileMenuItems: (plugins.tsclass.website.IMenuItem & { shortcut?: string } | { divider: true })[] = [];
|
2025-06-17 09:55:28 +00:00
|
|
|
|
2025-06-17 08:41:36 +00:00
|
|
|
@property({ type: Boolean })
|
2025-11-17 13:27:11 +00:00
|
|
|
accessor appbarShowSearch: boolean = false;
|
2025-06-17 08:41:36 +00:00
|
|
|
|
|
|
|
|
// Properties for mainmenu
|
2025-12-08 12:04:01 +00:00
|
|
|
@property({ type: String })
|
|
|
|
|
accessor mainmenuLogoIcon: string = '';
|
|
|
|
|
|
|
|
|
|
@property({ type: String })
|
|
|
|
|
accessor mainmenuLogoText: string = '';
|
|
|
|
|
|
|
|
|
|
@property({ type: Array })
|
|
|
|
|
accessor mainmenuGroups: interfaces.IMenuGroup[] = [];
|
|
|
|
|
|
|
|
|
|
@property({ type: Array })
|
|
|
|
|
accessor mainmenuBottomTabs: interfaces.ITab[] = [];
|
|
|
|
|
|
2025-06-17 08:41:36 +00:00
|
|
|
@property({ type: Array })
|
2025-11-17 13:27:11 +00:00
|
|
|
accessor mainmenuTabs: interfaces.ITab[] = [];
|
2025-06-17 08:41:36 +00:00
|
|
|
|
|
|
|
|
@property({ type: Object })
|
2025-11-17 13:27:11 +00:00
|
|
|
accessor mainmenuSelectedTab: interfaces.ITab | undefined = undefined;
|
2025-06-17 08:41:36 +00:00
|
|
|
|
2025-12-08 14:35:06 +00:00
|
|
|
// Properties for secondarymenu
|
|
|
|
|
@property({ type: String })
|
|
|
|
|
accessor secondarymenuHeading: string = 'Menu';
|
|
|
|
|
|
2025-06-17 08:41:36 +00:00
|
|
|
@property({ type: Array })
|
2025-12-08 14:35:06 +00:00
|
|
|
accessor secondarymenuGroups: interfaces.ISecondaryMenuGroup[] = [];
|
2025-06-17 08:41:36 +00:00
|
|
|
|
|
|
|
|
@property({ type: Object })
|
2025-12-08 14:35:06 +00:00
|
|
|
accessor secondarymenuSelectedItem: interfaces.ISecondaryMenuItem | undefined = undefined;
|
|
|
|
|
|
|
|
|
|
/** Legacy support for flat options (backward compatibility) */
|
|
|
|
|
@property({ type: Array })
|
|
|
|
|
accessor secondarymenuOptions: (interfaces.ISelectionOption | { divider: true })[] = [];
|
2025-06-17 08:41:36 +00:00
|
|
|
|
2025-12-08 15:40:12 +00:00
|
|
|
// Collapse states
|
|
|
|
|
@property({ type: Boolean })
|
|
|
|
|
accessor mainmenuCollapsed: boolean = false;
|
|
|
|
|
|
|
|
|
|
@property({ type: Boolean })
|
|
|
|
|
accessor secondarymenuCollapsed: boolean = false;
|
|
|
|
|
|
2025-06-17 08:41:36 +00:00
|
|
|
// Properties for maincontent
|
|
|
|
|
@property({ type: Array })
|
2025-11-17 13:27:11 +00:00
|
|
|
accessor maincontentTabs: interfaces.ITab[] = [];
|
2025-06-17 08:41:36 +00:00
|
|
|
|
|
|
|
|
// References to child components
|
|
|
|
|
@state()
|
2025-11-17 13:27:11 +00:00
|
|
|
accessor appbar: DeesAppuiBar | undefined = undefined;
|
2025-06-17 08:41:36 +00:00
|
|
|
|
|
|
|
|
@state()
|
2025-11-17 13:27:11 +00:00
|
|
|
accessor mainmenu: DeesAppuiMainmenu | undefined = undefined;
|
2025-06-17 08:41:36 +00:00
|
|
|
|
|
|
|
|
@state()
|
2025-12-08 14:35:06 +00:00
|
|
|
accessor secondarymenu: DeesAppuiSecondarymenu | undefined = undefined;
|
2025-06-17 08:41:36 +00:00
|
|
|
|
|
|
|
|
@state()
|
2025-11-17 13:27:11 +00:00
|
|
|
accessor maincontent: DeesAppuiMaincontent | undefined = undefined;
|
2025-06-17 08:41:36 +00:00
|
|
|
|
|
|
|
|
@state()
|
2025-11-17 13:27:11 +00:00
|
|
|
accessor activitylog: DeesAppuiActivitylog | undefined = undefined;
|
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-12-08 15:40:12 +00:00
|
|
|
grid-template-columns: auto auto 1fr 240px;
|
2025-12-08 12:04:01 +00:00
|
|
|
grid-template-rows: 1fr;
|
2024-01-24 12:18:37 +01:00
|
|
|
}
|
2025-12-08 15:40:12 +00:00
|
|
|
|
|
|
|
|
/* Z-index layering for proper stacking (position: relative required for z-index to work) */
|
|
|
|
|
.maingrid > dees-appui-mainmenu {
|
|
|
|
|
position: relative;
|
|
|
|
|
z-index: 3;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.maingrid > dees-appui-secondarymenu {
|
|
|
|
|
position: relative;
|
|
|
|
|
z-index: 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.maingrid > dees-appui-maincontent {
|
|
|
|
|
position: relative;
|
|
|
|
|
z-index: 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.maingrid > dees-appui-activitylog {
|
|
|
|
|
position: relative;
|
|
|
|
|
z-index: 1;
|
|
|
|
|
}
|
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
|
2025-12-08 12:04:01 +00:00
|
|
|
.logoIcon=${this.mainmenuLogoIcon}
|
|
|
|
|
.logoText=${this.mainmenuLogoText}
|
|
|
|
|
.menuGroups=${this.mainmenuGroups}
|
|
|
|
|
.bottomTabs=${this.mainmenuBottomTabs}
|
2025-06-17 08:41:36 +00:00
|
|
|
.tabs=${this.mainmenuTabs}
|
|
|
|
|
.selectedTab=${this.mainmenuSelectedTab}
|
2025-12-08 15:40:12 +00:00
|
|
|
.collapsed=${this.mainmenuCollapsed}
|
2025-06-17 08:41:36 +00:00
|
|
|
@tab-select=${(e: CustomEvent) => this.handleMainmenuTabSelect(e)}
|
2025-12-08 15:40:12 +00:00
|
|
|
@collapse-change=${(e: CustomEvent) => this.handleMainmenuCollapseChange(e)}
|
2025-06-17 08:41:36 +00:00
|
|
|
></dees-appui-mainmenu>
|
2025-12-08 14:35:06 +00:00
|
|
|
<dees-appui-secondarymenu
|
|
|
|
|
.heading=${this.secondarymenuHeading}
|
|
|
|
|
.groups=${this.secondarymenuGroups}
|
|
|
|
|
.selectionOptions=${this.secondarymenuOptions}
|
|
|
|
|
.selectedItem=${this.secondarymenuSelectedItem}
|
2025-12-08 15:40:12 +00:00
|
|
|
.collapsed=${this.secondarymenuCollapsed}
|
2025-12-08 14:35:06 +00:00
|
|
|
@item-select=${(e: CustomEvent) => this.handleSecondarymenuItemSelect(e)}
|
2025-12-08 15:40:12 +00:00
|
|
|
@collapse-change=${(e: CustomEvent) => this.handleSecondarymenuCollapseChange(e)}
|
2025-12-08 14:35:06 +00:00
|
|
|
></dees-appui-secondarymenu>
|
2025-06-17 08:41:36 +00:00
|
|
|
<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');
|
2025-12-08 14:35:06 +00:00
|
|
|
this.secondarymenu = this.shadowRoot.querySelector('dees-appui-secondarymenu');
|
2025-06-17 08:41:36 +00:00
|
|
|
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;
|
2025-12-08 14:35:06 +00:00
|
|
|
// Update secondary menu heading based on main menu selection
|
|
|
|
|
this.secondarymenuHeading = e.detail.tab.key;
|
2025-06-17 08:41:36 +00:00
|
|
|
this.dispatchEvent(new CustomEvent('mainmenu-tab-select', {
|
|
|
|
|
detail: e.detail,
|
|
|
|
|
bubbles: true,
|
|
|
|
|
composed: true
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-08 14:35:06 +00:00
|
|
|
// Event handlers for secondarymenu
|
|
|
|
|
private handleSecondarymenuItemSelect(e: CustomEvent) {
|
|
|
|
|
this.secondarymenuSelectedItem = e.detail.item;
|
|
|
|
|
this.dispatchEvent(new CustomEvent('secondarymenu-item-select', {
|
2025-06-17 08:41:36 +00:00
|
|
|
detail: e.detail,
|
|
|
|
|
bubbles: true,
|
|
|
|
|
composed: true
|
|
|
|
|
}));
|
|
|
|
|
}
|
2025-12-08 15:40:12 +00:00
|
|
|
|
|
|
|
|
// Event handlers for collapse state changes
|
|
|
|
|
private handleMainmenuCollapseChange(e: CustomEvent) {
|
|
|
|
|
this.mainmenuCollapsed = e.detail.collapsed;
|
|
|
|
|
this.dispatchEvent(new CustomEvent('mainmenu-collapse-change', {
|
|
|
|
|
detail: e.detail,
|
|
|
|
|
bubbles: true,
|
|
|
|
|
composed: true
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private handleSecondarymenuCollapseChange(e: CustomEvent) {
|
|
|
|
|
this.secondarymenuCollapsed = e.detail.collapsed;
|
|
|
|
|
this.dispatchEvent(new CustomEvent('secondarymenu-collapse-change', {
|
|
|
|
|
detail: e.detail,
|
|
|
|
|
bubbles: true,
|
|
|
|
|
composed: true
|
|
|
|
|
}));
|
|
|
|
|
}
|
2024-01-24 12:18:37 +01:00
|
|
|
}
|