@smartsoft001-mobilems/angular
v2.76.0
Published
Shared Angular functionality for the MobileMS Framework.
Readme
@smartsoft001-mobilems/angular
Shared Angular functionality for the MobileMS Framework.
Components
HeaderComponent
Base header component with TypeScript logic for managing header state and navigation. Designed to be extended by child components with custom templates.
Features:
- WCAG configuration toggle
- Search panel toggle
- User authentication state
- Local collection counter
- Responsive mobile detection
- Configuration-driven visibility
- Modern Angular signals for reactive state
Usage:
import { Component } from '@angular/core';
import { HeaderComponent } from '@smartsoft001-mobilems/angular';
@Component({
selector: 'app-custom-header',
standalone: true,
imports: [],
template: `
<header class="smart-bg-white smart-border-b smart-border-gray-200">
<div class="smart-container smart-mx-auto smart-px-4">
@if (isWcagVisible()) {
<div class="smart-py-4">
<button
(click)="toggleWcagConfig()"
class="smart-px-4 smart-py-2 smart-bg-blue-500 smart-text-white smart-rounded hover:smart-bg-blue-600"
>
WCAG Settings
</button>
</div>
} @if (user()) {
<div class="smart-py-4">
<span>Welcome, {{ user()?.userID }}</span>
<button
(click)="routeToUserAccount()"
class="smart-ml-4 smart-px-4 smart-py-2 smart-bg-green-500 smart-text-white smart-rounded hover:smart-bg-green-600"
>
My Account
</button>
</div>
} @else {
<button
(click)="routeToLogin()"
class="smart-px-4 smart-py-2 smart-bg-gray-500 smart-text-white smart-rounded hover:smart-bg-gray-600"
>
Login
</button>
} @if (isLocalCollectionVisible()) {
<button
(click)="routeToLocalCollection()"
class="smart-px-4 smart-py-2 smart-bg-purple-500 smart-text-white smart-rounded hover:smart-bg-purple-600"
>
My Collection ({{ localCollectionCount() }})
</button>
}
</div>
</header>
`,
})
export class CustomHeaderComponent extends HeaderComponent {
override ngOnInit() {
super.ngOnInit();
// Custom initialization logic
this.setUser({ userID: '[email protected]' });
this.setLocalCollectionCount(5);
}
}API:
Signals:
showWcagConfig: Signal<boolean>- WCAG panel visibility stateshowSearchPanel: Signal<boolean>- Search panel visibility stateuser: Signal<IHeaderUser | null>- Current user statelocalCollectionCount: Signal<number>- Local collection items count
Computed Signals:
config: Signal<IHeaderConfig>- Header configuration from ConfigsFacadeisMobile: Signal<boolean>- Mobile device detectionheaderConfig: Signal<IHeaderConfig['theme']>- Theme-specific header configisWcagVisible: Signal<boolean>- WCAG panel visibility based on config and stateisSearchVisible: Signal<boolean>- Search visibility based on configisLocalCollectionVisible: Signal<boolean>- Local collection button visibilityisLanguageSelectorVisible: Signal<boolean>- Language selector visibilityisUserAccountVisible: Signal<boolean>- User account button visibility
Methods:
toggleWcagConfig(): void- Toggle WCAG configuration paneltoggleSearchPanel(): void- Toggle search panelonWcagCloseButtonEvent(closed: boolean): void- Handle WCAG panel close eventonSearchPanelButtonEvent(opened: boolean): void- Handle search panel open eventrouteToLogin(): void- Navigate to login pagerouteToUserAccount(): void- Navigate to user account pagerouteToLocalCollection(): void- Navigate to local collection pagesetUser(user: IHeaderUser | null): void- Set current usersetLocalCollectionCount(count: number): void- Set local collection countgetUser(): IHeaderUser | null- Get current usergetLocalCollectionCount(): number- Get local collection countupdateConfig(): void- Update header configuration
Types:
export interface IHeaderUser {
userID: string;
[key: string]: unknown;
}
export interface IHeaderConfig {
theme?: {
header?: {
showWcagConfig?: boolean;
showSearch?: boolean;
showLocalCollection?: boolean;
showLanguageSelector?: boolean;
showUserAccount?: boolean;
};
};
}FooterComponent
Base footer component with TypeScript logic for managing footer state and static pages. Designed to be extended by child components with custom templates.
