@c8y/ngx-components
Version:
Angular modules for Cumulocity IoT applications
72 lines (67 loc) • 3.27 kB
JavaScript
import * as i0 from '@angular/core';
import { Injectable, NgModule } from '@angular/core';
import * as i1 from '@c8y/ngx-components';
import { gettext, hookTab } from '@c8y/ngx-components';
import { BrandingTabFactory, BRANDING_EDIT_CHILD_ROUTES, SharedBrandingModule } from '@c8y/ngx-components/branding/shared';
import { map } from 'rxjs/operators';
const darkThemeTabName = gettext('Dark theme');
/**
* Factory for creating the dark theme tab.
* Extends the BrandingTabFactory to provide the dark theme tab.
*/
class DarkThemeTabFactory extends BrandingTabFactory {
constructor(options) {
super();
this.options = options;
}
/**
* Overrides the `getTabsForVersion` method of `BrandingTabFactory` to provide the dark theme tab.
*/
getTabsForVersion(name) {
return [
{
path: this.getPathForBranding(name, 'dark'),
label: darkThemeTabName,
icon: 'moon',
priority: 400
}
];
}
/**
* Overrides the `shouldShowTab$` method of `BrandingTabFactory` to show the dark theme tab only if the dark theme is available.
*/
shouldShowTab$() {
return this.options.get$('darkThemeAvailable', false, true).pipe(map(value => !!value));
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DarkThemeTabFactory, deps: [{ token: i1.OptionsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DarkThemeTabFactory, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DarkThemeTabFactory, decorators: [{
type: Injectable,
args: [{ providedIn: 'root' }]
}], ctorParameters: () => [{ type: i1.OptionsService }] });
BRANDING_EDIT_CHILD_ROUTES.push({
path: 'dark',
loadComponent: () => import('@c8y/ngx-components/branding/shared/lazy').then(m => m.BrandingThemeFormComponent),
data: {
dark: true,
tabName: darkThemeTabName
}
});
class DarkThemeModule {
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DarkThemeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: DarkThemeModule, imports: [SharedBrandingModule] }); }
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DarkThemeModule, providers: [hookTab(DarkThemeTabFactory)], imports: [SharedBrandingModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DarkThemeModule, decorators: [{
type: NgModule,
args: [{
imports: [SharedBrandingModule],
providers: [hookTab(DarkThemeTabFactory)]
}]
}] });
/**
* Generated bundle index. Do not edit.
*/
export { DarkThemeModule };
//# sourceMappingURL=c8y-ngx-components-branding-dark-theme.mjs.map