@c8y/ngx-components
Version:
Angular modules for Cumulocity IoT applications
101 lines (94 loc) • 4.11 kB
JavaScript
import * as i1 from '@c8y/ngx-components';
import { NavigatorNode, hookRoute, hookNavigator, hookTab } from '@c8y/ngx-components';
import * as i0 from '@angular/core';
import { Injectable } from '@angular/core';
import { gettext } from '@c8y/ngx-components/gettext';
import * as i1$1 from '@angular/router';
class TranslationEditorNaviagtorFactoryService {
constructor(permissions) {
this.permissions = permissions;
this.node = new NavigatorNode({
icon: 'language1',
label: gettext('Localization'),
parent: 'Settings',
path: 'localization'
});
}
get() {
if (!this.permissions.hasRole('ROLE_APPLICATION_MANAGEMENT_ADMIN')) {
return [];
}
return this.node;
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TranslationEditorNaviagtorFactoryService, deps: [{ token: i1.Permissions }], target: i0.ɵɵFactoryTarget.Injectable }); }
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TranslationEditorNaviagtorFactoryService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TranslationEditorNaviagtorFactoryService, decorators: [{
type: Injectable,
args: [{
providedIn: 'root'
}]
}], ctorParameters: () => [{ type: i1.Permissions }] });
const translationEditorBasePath = 'localization';
const translationEditorBasicPath = 'basic';
const translationEditorAdvancedPath = 'advanced';
class TranslationEditorTabFactoryService {
constructor(router) {
this.router = router;
this.tabs = [
{
label: gettext('Basic'),
path: `/${translationEditorBasePath}/${translationEditorBasicPath}`,
priority: 200,
icon: 'language1'
},
{
label: gettext('Advanced'),
path: `/${translationEditorBasePath}/${translationEditorAdvancedPath}`,
priority: 100,
icon: 'c8y-css'
}
];
}
get() {
if (this.router.url.startsWith(`/${translationEditorBasePath}/`)) {
return this.tabs;
}
return [];
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TranslationEditorTabFactoryService, deps: [{ token: i1$1.Router }], target: i0.ɵɵFactoryTarget.Injectable }); }
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TranslationEditorTabFactoryService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TranslationEditorTabFactoryService, decorators: [{
type: Injectable,
args: [{
providedIn: 'root'
}]
}], ctorParameters: () => [{ type: i1$1.Router }] });
const tranlationEditorProviders = [
hookRoute({
path: translationEditorBasePath,
children: [
{
path: '',
pathMatch: 'full',
redirectTo: translationEditorBasicPath
},
{
path: translationEditorBasicPath,
loadComponent: () => import('@c8y/ngx-components/translation-editor/lazy').then(m => m.TranslationEditorComponent)
},
{
path: translationEditorAdvancedPath,
loadComponent: () => import('@c8y/ngx-components/translation-editor/lazy').then(m => m.AdvancedTranslationEditorComponent)
}
]
}),
hookNavigator(TranslationEditorNaviagtorFactoryService),
hookTab(TranslationEditorTabFactoryService)
];
/**
* Generated bundle index. Do not edit.
*/
export { tranlationEditorProviders };
//# sourceMappingURL=c8y-ngx-components-translation-editor.mjs.map