@volosoft/abp.ng.theme.lepton-x
Version:
ABP Framework is a complete open-source infrastructure to create modern web applications by following the best practices and conventions of software development. This package is a part of the [ABP Framework](https://abp.io) and contains client-side files.
581 lines (559 loc) • 29.8 kB
JavaScript
import * as i0 from '@angular/core';
import { ChangeDetectionStrategy, Component, NgModule, inject, signal, computed, Inject, Optional, Injectable, InjectionToken, provideAppInitializer } from '@angular/core';
import { ValidationErrorComponent, VALIDATION_ERROR_TEMPLATE, VALIDATION_INVALID_CLASSES, VALIDATION_TARGET_SELECTOR, NgxValidateCoreModule } from '@ngx-validate/core';
import * as i1 from '@angular/common';
import { CommonModule, Location } from '@angular/common';
import * as i1$1 from '@abp/ng.core';
import { CoreModule, RouterEvents, LocalizationModule, ReplaceableTemplateDirective, getLocaleDirection, NAVIGATE_TO_MANAGE_PROFILE, AuthService, ConfigStateService, EnvironmentService, ReplaceableComponentsService } from '@abp/ng.core';
import { Router, ActivatedRoute, provideRouter } from '@angular/router';
import * as i3 from '@abp/ng.theme.shared';
import { HTTP_ERROR_STATUS, HTTP_ERROR_DETAIL, CreateErrorComponentService, UserMenuService } from '@abp/ng.theme.shared';
import { filter, switchMap, map } from 'rxjs/operators';
import * as i4 from 'rxjs';
import { combineLatest, of, map as map$1 } from 'rxjs';
import * as i2 from '@volo/ngx-lepton-x.core';
import { flatArrayDeepToObject, LPX_TRANSLATE_SERVICE_TOKEN, LanguageTranslateKeys } from '@volo/ngx-lepton-x.core';
import { PROFILE_PICTURE, NAVIGATE_TO_MY_SECURITY_LOGS, OPEN_MY_LINK_USERS_MODAL, NAVIGATE_TO_MY_SESSIONS, NAVIGATE_TO_MY_EXTERNAL_LOGINS, OPEN_AUTHORITY_DELEGATION_MODAL, PROFILE_PICTURE_PROVIDERS } from '@volo/abp.commercial.ng.ui/config';
import { AbpNavbarService, AbpToolbarService, LeptonXAbpCoreModule } from '@volo/abp.ng.lepton-x.core';
import { ThemeTranslateKeys, LpxModule } from '@volosoft/ngx-lepton-x';
import { AccountLayoutComponent } from '@volosoft/abp.ng.theme.lepton-x/account';
class AbpValidationErrorComponent extends ValidationErrorComponent {
get abpErrors() {
if (!this.errors || !this.errors.length) {
return [];
}
return this.errors.map((error) => {
if (!error.message) {
return error;
}
const index = error.message.indexOf('[');
if (index > -1) {
return {
...error,
message: error.message.slice(0, index),
interpoliteParams: error.message
.slice(index + 1, error.message.length - 1)
.split(','),
};
}
return error;
});
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: AbpValidationErrorComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.8", type: AbpValidationErrorComponent, isStandalone: false, selector: "abp-validation-error", usesInheritance: true, ngImport: i0, template: `
<span
class="text-danger"
data-valmsg-for="Role.Name"
data-valmsg-replace="true"
><span *ngFor="let error of abpErrors; trackBy: trackByFn">
{{ error.message | abpLocalization: error.interpoliteParams }}</span
></span
>
`, isInline: true, styles: [":host-context{order:3}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "pipe", type: i1$1.LocalizationPipe, name: "abpLocalization" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: AbpValidationErrorComponent, decorators: [{
type: Component,
args: [{ standalone: false, selector: 'abp-validation-error', template: `
<span
class="text-danger"
data-valmsg-for="Role.Name"
data-valmsg-replace="true"
><span *ngFor="let error of abpErrors; trackBy: trackByFn">
{{ error.message | abpLocalization: error.interpoliteParams }}</span
></span
>
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host-context{order:3}\n"] }]
}] });
class AbpValidationErrorModule {
static forRoot() {
return {
ngModule: AbpValidationErrorModule,
providers: [
{
provide: VALIDATION_ERROR_TEMPLATE,
useValue: AbpValidationErrorComponent,
},
{
provide: VALIDATION_INVALID_CLASSES,
useValue: 'is-invalid',
},
{
provide: VALIDATION_TARGET_SELECTOR,
useValue: '.form-group',
},
],
};
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: AbpValidationErrorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.8", ngImport: i0, type: AbpValidationErrorModule, declarations: [AbpValidationErrorComponent], imports: [CommonModule, CoreModule, NgxValidateCoreModule], exports: [AbpValidationErrorComponent, NgxValidateCoreModule] }); }
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: AbpValidationErrorModule, imports: [CommonModule, CoreModule, NgxValidateCoreModule, NgxValidateCoreModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: AbpValidationErrorModule, decorators: [{
type: NgModule,
args: [{
declarations: [AbpValidationErrorComponent],
imports: [CommonModule, CoreModule, NgxValidateCoreModule],
exports: [AbpValidationErrorComponent, NgxValidateCoreModule],
}]
}] });
class HttpErrorComponent {
constructor() {
this.router = inject(Router);
this.activatedRoute = inject(ActivatedRoute);
this.location = inject(Location);
this.routerEvents = inject(RouterEvents);
this.errorComponentKey = "Theme.HttpErrorComponent" /* eThemeLeptonXComponents.HttpError */;
this.status = signal(0);
this.lastNavigation = this.routerEvents.previousNavigation;
this.currentNavigation = this.routerEvents.currentNavigation;
this.statusText = computed(() => HTTP_ERROR_STATUS[this.status()] ?? '');
this.detail = computed(() => HTTP_ERROR_DETAIL[this.status()] ?? '');
const { status } = this.activatedRoute.snapshot.queryParams;
if (!isNaN(status)) {
this.status.set(+status);
}
}
goBack() {
const url = this.status() === 404 ? this.currentNavigation() : this.lastNavigation();
if (url) {
this.router.navigateByUrl(url, { onSameUrlNavigation: 'reload' });
}
else {
this.location.back();
}
this.destroy$?.next();
}
goHome() {
this.router.navigateByUrl('/', { onSameUrlNavigation: 'reload' });
this.destroy$?.next();
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: HttpErrorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.8", type: HttpErrorComponent, isStandalone: true, selector: "abp-http-error", ngImport: i0, template: "<ng-container *abpReplaceableTemplate=\"{ componentKey: errorComponentKey }\">\r\n <div class=\"container\">\r\n <div class=\"row\">\r\n <div class=\"col-lg-10 col-md-11 mx-auto\">\r\n <div\r\n class=\"d-flex flex-column justify-content-center min-vh-100 align-items-center\"\r\n >\r\n <div class=\"card\">\r\n <div class=\"card-body p-lg-5\">\r\n <div class=\"row\">\r\n <div class=\"col-auto d-flex align-items-center\">\r\n <i\r\n class=\"bi bi-emoji-frown text-primary mb-3 mb-md-0 mx-3 mx-md-4\"\r\n style=\"font-size: 12em\"\r\n ></i>\r\n </div>\r\n <div class=\"col flex-center ps-lg-4\">\r\n <div class=\"status-content\">\r\n <h1 class=\"fw-bolder display-1 text-brand\">\r\n {{ status() }}\r\n </h1>\r\n <h2 class=\"mb-0\">{{ statusText() | abpLocalization }}</h2>\r\n <h5 class=\"text-muted\">{{ detail() | abpLocalization }}</h5>\r\n\r\n @if (lastNavigation() && status() !== 403) {\r\n <a class=\"btn btn-primary soft me-2\" (click)=\"goBack()\">\r\n {{ 'AbpUi::GoBack' | abpLocalization }}\r\n </a>\r\n }\r\n <a class=\"btn btn-primary\" (click)=\"goHome()\">\r\n {{ 'AbpUi::GoHomePage' | abpLocalization }}\r\n </a>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</ng-container>\r\n", dependencies: [{ kind: "ngmodule", type: LocalizationModule }, { kind: "pipe", type: i1$1.LocalizationPipe, name: "abpLocalization" }, { kind: "directive", type: ReplaceableTemplateDirective, selector: "[abpReplaceableTemplate]", inputs: ["abpReplaceableTemplate"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: HttpErrorComponent, decorators: [{
type: Component,
args: [{ selector: 'abp-http-error', imports: [LocalizationModule, ReplaceableTemplateDirective], template: "<ng-container *abpReplaceableTemplate=\"{ componentKey: errorComponentKey }\">\r\n <div class=\"container\">\r\n <div class=\"row\">\r\n <div class=\"col-lg-10 col-md-11 mx-auto\">\r\n <div\r\n class=\"d-flex flex-column justify-content-center min-vh-100 align-items-center\"\r\n >\r\n <div class=\"card\">\r\n <div class=\"card-body p-lg-5\">\r\n <div class=\"row\">\r\n <div class=\"col-auto d-flex align-items-center\">\r\n <i\r\n class=\"bi bi-emoji-frown text-primary mb-3 mb-md-0 mx-3 mx-md-4\"\r\n style=\"font-size: 12em\"\r\n ></i>\r\n </div>\r\n <div class=\"col flex-center ps-lg-4\">\r\n <div class=\"status-content\">\r\n <h1 class=\"fw-bolder display-1 text-brand\">\r\n {{ status() }}\r\n </h1>\r\n <h2 class=\"mb-0\">{{ statusText() | abpLocalization }}</h2>\r\n <h5 class=\"text-muted\">{{ detail() | abpLocalization }}</h5>\r\n\r\n @if (lastNavigation() && status() !== 403) {\r\n <a class=\"btn btn-primary soft me-2\" (click)=\"goBack()\">\r\n {{ 'AbpUi::GoBack' | abpLocalization }}\r\n </a>\r\n }\r\n <a class=\"btn btn-primary\" (click)=\"goHome()\">\r\n {{ 'AbpUi::GoHomePage' | abpLocalization }}\r\n </a>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</ng-container>\r\n" }]
}], ctorParameters: () => [] });
var httpError_component = /*#__PURE__*/Object.freeze({
__proto__: null,
HttpErrorComponent: HttpErrorComponent
});
var eUserMenuItems;
(function (eUserMenuItems) {
eUserMenuItems["Sessions"] = "Sessions";
eUserMenuItems["ExternalLogins"] = "ExternalLogins";
eUserMenuItems["LinkedAccounts"] = "LinkedAccounts";
eUserMenuItems["MyAccount"] = "MyAccount";
eUserMenuItems["SecurityLogs"] = "SecurityLogs";
eUserMenuItems["BackToImpersonator"] = "BackToImpersonator";
eUserMenuItems["AuthorityDelegation"] = "AuthorityDelegation";
eUserMenuItems["Logout"] = "Logout";
})(eUserMenuItems || (eUserMenuItems = {}));
class AbpSettingsService {
constructor(sessionService, configStateService, languageService, userProfileService, profilePicture$, navigateToManageProfile, navigateToMySecurityLogs, openMyLinkUsersModal, userMenuService) {
this.sessionService = sessionService;
this.configStateService = configStateService;
this.languageService = languageService;
this.userProfileService = userProfileService;
this.profilePicture$ = profilePicture$;
this.navigateToManageProfile = navigateToManageProfile;
this.navigateToMySecurityLogs = navigateToMySecurityLogs;
this.openMyLinkUsersModal = openMyLinkUsersModal;
this.userMenuService = userMenuService;
}
setUpListeners() {
this.listenToLangChange();
this.setLanguageOptions();
this.setUserProfile();
this.setProfilePicture();
this.setUserMenuGroups();
}
setUserProfile() {
const emptyStringOnNull = (value) => value || '';
const currentUser$ = this.configStateService
.getOne$('currentUser')
.pipe(filter(Boolean));
const currentTenant$ = this.configStateService
.getOne$('currentTenant')
.pipe(filter(Boolean));
combineLatest([currentUser$, currentTenant$]).subscribe(([currentUser, currentTenant]) => {
this.userProfileService.patchUser({
id: currentUser.id,
isAuthenticated: currentUser.isAuthenticated,
userName: currentUser.userName,
fullName: emptyStringOnNull(currentUser.name) +
' ' +
emptyStringOnNull(currentUser.surName),
email: currentUser.email,
tenant: currentTenant,
});
});
}
setUserMenuGroups() {
this.userMenuService.items$.subscribe((userMenu) => {
const userActionGroups = userMenu.reduce((acc, curr, index) => {
const menuItem = {
icon: curr.textTemplate?.icon,
text: curr.textTemplate?.text,
component: curr?.component,
action: () => {
curr.action();
return of(true);
},
visible: curr.visible,
};
const setIndex = index === userMenu.length - 1 ? 1 : 0;
acc[setIndex].push(menuItem);
return acc;
}, [[], []]);
this.userProfileService.patchUser({
userActionGroups,
});
});
}
setProfilePicture() {
this.profilePicture$
.pipe(filter(Boolean))
.subscribe((avatar) => this.userProfileService.patchUser({
avatar: {
type: avatar.type,
source: avatar.source || '',
},
}));
}
setLanguageOptions() {
this.sessionService
.getLanguage$()
.pipe(switchMap((currentLang) => this.configStateService.getDeep$('localization.languages').pipe(filter(Boolean), map((languages) => languages.map(({ cultureName, ...rest }) => ({
...rest,
cultureName,
selected: cultureName === currentLang,
isRTL: getLocaleDirection(cultureName) === 'rtl',
}))))))
.subscribe((settings) => {
this.languageService.setLanguages(settings);
});
}
listenToLangChange() {
this.languageService.selectedLanguage$
.pipe(filter(Boolean))
.subscribe((lang) => {
this.sessionService.setLanguage(lang?.cultureName || '');
});
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: AbpSettingsService, deps: [{ token: i1$1.SessionStateService }, { token: i1$1.ConfigStateService }, { token: i2.LanguageService }, { token: i2.UserProfileService }, { token: PROFILE_PICTURE }, { token: NAVIGATE_TO_MANAGE_PROFILE }, { token: NAVIGATE_TO_MY_SECURITY_LOGS }, { token: OPEN_MY_LINK_USERS_MODAL, optional: true }, { token: i3.UserMenuService }], target: i0.ɵɵFactoryTarget.Injectable }); }
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: AbpSettingsService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: AbpSettingsService, decorators: [{
type: Injectable,
args: [{ providedIn: 'root' }]
}], ctorParameters: () => [{ type: i1$1.SessionStateService }, { type: i1$1.ConfigStateService }, { type: i2.LanguageService }, { type: i2.UserProfileService }, { type: i4.BehaviorSubject, decorators: [{
type: Inject,
args: [PROFILE_PICTURE]
}] }, { type: undefined, decorators: [{
type: Inject,
args: [NAVIGATE_TO_MANAGE_PROFILE]
}] }, { type: undefined, decorators: [{
type: Inject,
args: [NAVIGATE_TO_MY_SECURITY_LOGS]
}] }, { type: undefined, decorators: [{
type: Optional
}, {
type: Inject,
args: [OPEN_MY_LINK_USERS_MODAL]
}] }, { type: i3.UserMenuService }] });
const HTTP_ERROR_PATH = new InjectionToken('HTTP_ERROR_PATH');
const LPX_TRANSLATE_KEY_MAP_TOKEN = new InjectionToken('LPX_TRANSLATE_KEY_MAP_TOKEN');
class AbpCreateErrorComponentService extends CreateErrorComponentService {
constructor() {
super();
this.router = inject(Router);
this.httpErrorPath = inject(HTTP_ERROR_PATH);
}
execute(instance) {
if (this.canCreateCustomError(instance.status)) {
super.execute(instance);
return;
}
const queryParams = { status: instance.status };
this.router.navigate([this.httpErrorPath], { queryParams });
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: AbpCreateErrorComponentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: AbpCreateErrorComponentService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: AbpCreateErrorComponentService, decorators: [{
type: Injectable
}], ctorParameters: () => [] });
class AbpTranslateService {
constructor(localization, translateKeys) {
this.localization = localization;
this.translateKeys = translateKeys;
}
get(key, defaultValue) {
const keyToTranslate = this.getKey(key);
if (keyToTranslate) {
return this.localization.instant({
key: keyToTranslate,
defaultValue,
});
}
return defaultValue || key;
}
get$(key, defaultValue) {
const keyToTranslate = this.getKey(key);
if (keyToTranslate) {
return this.localization.get({
key: keyToTranslate,
defaultValue,
});
}
return of(defaultValue || key);
}
getKey(key) {
const keys = flatArrayDeepToObject(this.translateKeys);
return keys[key] ? keys[key] : key.includes('::') ? key : undefined;
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: AbpTranslateService, deps: [{ token: i1$1.LocalizationService }, { token: LPX_TRANSLATE_KEY_MAP_TOKEN }], target: i0.ɵɵFactoryTarget.Injectable }); }
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: AbpTranslateService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: AbpTranslateService, decorators: [{
type: Injectable
}], ctorParameters: () => [{ type: i1$1.LocalizationService }, { type: Array, decorators: [{
type: Inject,
args: [LPX_TRANSLATE_KEY_MAP_TOKEN]
}] }] });
class AbpAuthService {
constructor(userProfileService, authService) {
this.userProfileService = userProfileService;
this.authService = authService;
this.isUserExists$ = this.userProfileService.user$.pipe(map((user) => user && !!user.userName));
}
navigateToLogin() {
this.authService.navigateToLogin();
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: AbpAuthService, deps: [{ token: i2.UserProfileService }, { token: i1$1.AuthService }], target: i0.ɵɵFactoryTarget.Injectable }); }
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: AbpAuthService }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: AbpAuthService, decorators: [{
type: Injectable
}], ctorParameters: () => [{ type: i2.UserProfileService }, { type: i1$1.AuthService }] });
const LPX_STYLE_PROVIDER = provideAppInitializer(() => {
initStyles();
});
function initStyles() {
const loader = document.querySelector('#lp-page-loader');
if (loader) {
loader.style.background = 'var(--background)';
setTimeout(() => loader.parentNode?.removeChild(loader), 500);
}
return Promise.resolve();
}
const INIT_SERVICE_PROVIDER = provideAppInitializer(() => {
initServices();
});
function initServices() {
const navbar = inject(AbpNavbarService);
const abpToolbar = inject(AbpToolbarService);
const setting = inject(AbpSettingsService);
abpToolbar.listenNavItems();
setting.setUpListeners();
navbar.initRoutes();
}
const LPX_TRANSLATE_PROVIDER = {
provide: LPX_TRANSLATE_SERVICE_TOKEN,
useClass: AbpTranslateService,
};
const translateKeys = {
[LanguageTranslateKeys.SettingsTitle]: 'LeptonX::Language',
[ThemeTranslateKeys.AppearanceTitle]: 'LeptonX::Appearance',
[ThemeTranslateKeys.DarkMode]: 'LeptonX::Theme:dark',
[ThemeTranslateKeys.LightMode]: 'LeptonX::Theme:light',
[ThemeTranslateKeys.SemiDarkMode]: 'LeptonX::Theme:dim',
[ThemeTranslateKeys.System]: 'LeptonX::Theme:system',
};
const LPX_TRANSLATE_KEYS_PROVIDER = {
provide: LPX_TRANSLATE_KEY_MAP_TOKEN,
multi: true,
useValue: translateKeys,
};
const LEPTON_X_USER_MENU_PROVIDERS = [
provideAppInitializer(() => {
configureUserMenu();
}),
];
function configureUserMenu() {
const userMenu = inject(UserMenuService);
const authService = inject(AuthService);
const configState = inject(ConfigStateService);
const environment = inject(EnvironmentService);
const navigateToMySessions = inject(NAVIGATE_TO_MY_SESSIONS);
const navigateToMyExternalLogins = inject(NAVIGATE_TO_MY_EXTERNAL_LOGINS);
const navigateToManageProfile = inject(NAVIGATE_TO_MANAGE_PROFILE);
const navigateToMySecurityLogs = inject(NAVIGATE_TO_MY_SECURITY_LOGS);
const openMyLinkUsersModal = inject(OPEN_MY_LINK_USERS_MODAL, {
optional: true,
});
const openAuthorityDelegationModal = inject(OPEN_AUTHORITY_DELEGATION_MODAL, {
optional: true,
});
userMenu.addItems([
{
id: eUserMenuItems.Sessions,
order: 100,
textTemplate: {
icon: 'bi bi-clock-fill',
text: 'AbpAccount::Sessions',
},
action: () => navigateToMySessions(),
},
{
id: eUserMenuItems.ExternalLogins,
order: 101,
textTemplate: {
icon: 'bi bi-person-circle',
text: 'AbpAccount::ExternalLogins',
},
action: () => navigateToMyExternalLogins(),
visible: () => {
return environment.getEnvironment$().pipe(map$1(({ oAuthConfig }) => {
return oAuthConfig?.responseType === 'code';
}));
},
},
{
id: eUserMenuItems.LinkedAccounts,
order: 102,
textTemplate: {
icon: 'bi bi-link',
text: 'AbpAccount::LinkedAccounts',
},
action: () => openMyLinkUsersModal(),
visible: () => !!openMyLinkUsersModal,
},
{
id: eUserMenuItems.AuthorityDelegation,
order: 103,
textTemplate: {
text: 'AbpAccount::AuthorityDelegation',
icon: 'fa fa-users',
},
visible: () => {
return configState
.getOne$('currentUser')
.pipe(map$1(({ impersonatorUserId }) => !Boolean(impersonatorUserId)));
},
action: () => openAuthorityDelegationModal(),
},
{
id: eUserMenuItems.MyAccount,
order: 104,
textTemplate: {
icon: 'bi bi-sliders',
text: 'AbpAccount::MyAccount',
},
action: () => navigateToManageProfile(),
},
{
id: eUserMenuItems.SecurityLogs,
order: 105,
textTemplate: {
icon: 'bi bi-list-ul',
text: 'AbpAccount::MySecurityLogs',
},
action: () => navigateToMySecurityLogs(),
},
{
id: eUserMenuItems.Logout,
order: 106,
textTemplate: {
icon: 'bi bi-box-arrow-right',
text: 'AbpUi::Logout',
},
action: () => {
authService.logout().subscribe();
},
},
]);
}
const ACCOUNT_LAYOUT_PROVIDER = provideAppInitializer(() => {
initAccountLayout();
});
function initAccountLayout() {
const replaceableComponents = inject(ReplaceableComponentsService);
replaceableComponents.add({
key: "Theme.AccountLayoutComponent" /* eThemeLeptonXComponents.AccountLayout */,
component: AccountLayoutComponent,
});
}
function leptonXRoutes(options) {
const { httpError } = options || {};
return provideRouter([
{
pathMatch: 'full',
path: httpError?.errorPath || 'error',
loadComponent: () => Promise.resolve().then(function () { return httpError_component; }).then((c) => c.HttpErrorComponent),
},
]);
}
function httpErrorProvider(options) {
const { httpError } = options || {};
return [
{
provide: HTTP_ERROR_PATH,
useValue: httpError?.errorPath || 'error',
},
{
provide: CreateErrorComponentService,
useClass: AbpCreateErrorComponentService,
},
leptonXRoutes(options),
];
}
class ThemeLeptonXModule {
static forRoot(options) {
return {
ngModule: ThemeLeptonXModule,
providers: [
LPX_STYLE_PROVIDER,
PROFILE_PICTURE_PROVIDERS,
LEPTON_X_USER_MENU_PROVIDERS,
INIT_SERVICE_PROVIDER,
AbpValidationErrorModule.forRoot().providers,
// TODO: muhammed: Create an injection token for theme settings
LpxModule.forRoot({
...createLpxModuleOptions(options),
}).providers,
LPX_TRANSLATE_KEYS_PROVIDER,
LPX_TRANSLATE_PROVIDER,
LeptonXAbpCoreModule.forRoot().providers,
ACCOUNT_LAYOUT_PROVIDER,
httpErrorProvider(options),
],
};
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: ThemeLeptonXModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.8", ngImport: i0, type: ThemeLeptonXModule }); }
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: ThemeLeptonXModule }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: ThemeLeptonXModule, decorators: [{
type: NgModule
}] });
function createLpxModuleOptions(options) {
return {
...options,
styleFactory: (styles) => {
styles.push({
bundleName: 'abp-bundle',
});
if (options?.styleFactory) {
return options.styleFactory(styles);
}
return styles;
},
};
}
/**
* Generated bundle index. Do not edit.
*/
export { AbpAuthService, AbpCreateErrorComponentService, AbpSettingsService, AbpTranslateService, AbpValidationErrorComponent, AbpValidationErrorModule, HTTP_ERROR_PATH, HttpErrorComponent, LPX_TRANSLATE_KEY_MAP_TOKEN, ThemeLeptonXModule, eUserMenuItems };
//# sourceMappingURL=volosoft-abp.ng.theme.lepton-x.mjs.map