import { SessionState, takeUntilDestroy, SetLanguage, GetAppConfiguration, ConfigState, LazyLoadService, CoreModule } from '@abp/ng.core'; import { slideFromBottom, ThemeSharedModule } from '@abp/ng.theme.shared'; import { Component, ViewChild, TemplateRef, ViewChildren, ChangeDetectionStrategy, ViewEncapsulation, Injectable, ɵɵdefineInjectable, ɵɵinject, NgModule } from '@angular/core'; import { NgbDropdown, NgbCollapseModule, NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap'; import { ValidationErrorComponent as ValidationErrorComponent$1, NgxValidateCoreModule } from '@ngx-validate/core'; import { Action, Selector, State, Store, Select, NgxsModule } from '@ngxs/store'; import { ToastModule } from 'primeng/toast'; import { __decorate, __metadata } from 'tslib'; import { Navigate, RouterState } from '@ngxs/router-plugin'; import { OAuthService } from 'angular-oauth2-oidc'; import compare from 'just-compare'; import { fromEvent, Observable } from 'rxjs'; import { map, filter, debounceTime } from 'rxjs/operators'; import snq from 'snq'; /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class AccountLayoutComponent { } // required for dynamic component AccountLayoutComponent.type = "account" /* account */; AccountLayoutComponent.decorators = [ { type: Component, args: [{ selector: 'abp-layout-account', template: "\n" }] } ]; if (false) { /** @type {?} */ AccountLayoutComponent.type; } /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class AddNavigationElement { /** * @param {?} payload */ constructor(payload) { this.payload = payload; } } AddNavigationElement.type = '[Layout] Add Navigation Element'; if (false) { /** @type {?} */ AddNavigationElement.type; /** @type {?} */ AddNavigationElement.prototype.payload; } class RemoveNavigationElementByName { /** * @param {?} name */ constructor(name) { this.name = name; } } RemoveNavigationElementByName.type = '[Layout] Remove Navigation ElementByName'; if (false) { /** @type {?} */ RemoveNavigationElementByName.type; /** @type {?} */ RemoveNavigationElementByName.prototype.name; } /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ let LayoutState = class LayoutState { /** * @param {?} __0 * @return {?} */ static getNavigationElements({ navigationElements }) { return navigationElements; } /** * @param {?} __0 * @param {?} __1 * @return {?} */ layoutAddAction({ getState, patchState }, { payload = [] }) { let { navigationElements } = getState(); if (!Array.isArray(payload)) { payload = [payload]; } if (navigationElements.length) { payload = snq((/** * @return {?} */ () => ((/** @type {?} */ (payload))).filter((/** * @param {?} __0 * @return {?} */ ({ name }) => navigationElements.findIndex((/** * @param {?} nav * @return {?} */ nav => nav.name === name)) < 0))), []); } if (!payload.length) return; navigationElements = [...navigationElements, ...payload] .map((/** * @param {?} element * @return {?} */ element => (Object.assign({}, element, { order: element.order || 99 })))) .sort((/** * @param {?} a * @param {?} b * @return {?} */ (a, b) => a.order - b.order)); return patchState({ navigationElements, }); } /** * @param {?} __0 * @param {?} __1 * @return {?} */ layoutRemoveAction({ getState, patchState }, { name }) { let { navigationElements } = getState(); /** @type {?} */ const index = navigationElements.findIndex((/** * @param {?} element * @return {?} */ element => element.name === name)); if (index > -1) { navigationElements = navigationElements.splice(index, 1); } return patchState({ navigationElements, }); } }; __decorate([ Action(AddNavigationElement), __metadata("design:type", Function), __metadata("design:paramtypes", [Object, AddNavigationElement]), __metadata("design:returntype", void 0) ], LayoutState.prototype, "layoutAddAction", null); __decorate([ Action(RemoveNavigationElementByName), __metadata("design:type", Function), __metadata("design:paramtypes", [Object, RemoveNavigationElementByName]), __metadata("design:returntype", void 0) ], LayoutState.prototype, "layoutRemoveAction", null); __decorate([ Selector(), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", Array) ], LayoutState, "getNavigationElements", null); LayoutState = __decorate([ State({ name: 'LayoutState', defaults: (/** @type {?} */ ({ navigationElements: [] })), }) ], LayoutState); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class ApplicationLayoutComponent { /** * @param {?} store * @param {?} oauthService */ constructor(store, oauthService) { this.store = store; this.oauthService = oauthService; this.isOpenChangePassword = false; this.isOpenProfile = false; this.rightPartElements = []; this.trackByFn = (/** * @param {?} _ * @param {?} item * @return {?} */ (_, item) => item.name); this.trackElementByFn = (/** * @param {?} _ * @param {?} element * @return {?} */ (_, element) => element); } /** * @return {?} */ get visibleRoutes$() { return this.routes$.pipe(map((/** * @param {?} routes * @return {?} */ routes => getVisibleRoutes(routes)))); } /** * @return {?} */ get defaultLanguage$() { return this.languages$.pipe(map((/** * @param {?} languages * @return {?} */ languages => snq((/** * @return {?} */ () => languages.find((/** * @param {?} lang * @return {?} */ lang => lang.cultureName === this.selectedLangCulture)).displayName))), '')); } /** * @return {?} */ get dropdownLanguages$() { return this.languages$.pipe(map((/** * @param {?} languages * @return {?} */ languages => snq((/** * @return {?} */ () => languages.filter((/** * @param {?} lang * @return {?} */ lang => lang.cultureName !== this.selectedLangCulture))))), [])); } /** * @return {?} */ get selectedLangCulture() { return this.store.selectSnapshot(SessionState.getLanguage); } /** * @private * @return {?} */ checkWindowWidth() { setTimeout((/** * @return {?} */ () => { this.navbarRootDropdowns.forEach((/** * @param {?} item * @return {?} */ item => { item.close(); })); if (window.innerWidth < 768) { this.isDropdownChildDynamic = false; } else { this.isDropdownChildDynamic = true; } }), 0); } /** * @return {?} */ ngAfterViewInit() { /** @type {?} */ const navigations = this.store.selectSnapshot(LayoutState.getNavigationElements).map((/** * @param {?} __0 * @return {?} */ ({ name }) => name)); if (navigations.indexOf('LanguageRef') < 0) { this.store.dispatch(new AddNavigationElement([ { element: this.languageRef, order: 4, name: 'LanguageRef' }, { element: this.currentUserRef, order: 5, name: 'CurrentUserRef' }, ])); } this.navElements$ .pipe(map((/** * @param {?} elements * @return {?} */ elements => elements.map((/** * @param {?} __0 * @return {?} */ ({ element }) => element)))), filter((/** * @param {?} elements * @return {?} */ elements => !compare(elements, this.rightPartElements))), takeUntilDestroy(this)) .subscribe((/** * @param {?} elements * @return {?} */ elements => { setTimeout((/** * @return {?} */ () => (this.rightPartElements = elements)), 0); })); this.checkWindowWidth(); fromEvent(window, 'resize') .pipe(takeUntilDestroy(this), debounceTime(250)) .subscribe((/** * @return {?} */ () => { this.checkWindowWidth(); })); } /** * @return {?} */ ngOnDestroy() { } /** * @param {?} cultureName * @return {?} */ onChangeLang(cultureName) { this.store.dispatch(new SetLanguage(cultureName)); } /** * @return {?} */ logout() { this.oauthService.logOut(); this.store.dispatch(new Navigate(['/'], null, { state: { redirectUrl: this.store.selectSnapshot(RouterState).state.url }, })); this.store.dispatch(new GetAppConfiguration()); } } // required for dynamic component ApplicationLayoutComponent.type = "application" /* application */; ApplicationLayoutComponent.decorators = [ { type: Component, args: [{ selector: 'abp-layout-application', template: "\n \n\n \n\n\n\n
  • \n \n {{ defaultLanguage$ | async }}\n \n
    \n {{ lang?.displayName }}\n
    \n
  • \n
    \n\n\n
  • \n \n {{ (currentUser$ | async)?.userName }}\n \n \n
  • \n\n \n\n \n
    \n" }] } ]; /** @nocollapse */ ApplicationLayoutComponent.ctorParameters = () => [ { type: Store }, { type: OAuthService } ]; ApplicationLayoutComponent.propDecorators = { currentUserRef: [{ type: ViewChild, args: ['currentUser', { static: false, read: TemplateRef },] }], languageRef: [{ type: ViewChild, args: ['language', { static: false, read: TemplateRef },] }], navbarRootDropdowns: [{ type: ViewChildren, args: ['navbarRootDropdown', { read: NgbDropdown },] }] }; __decorate([ Select(ConfigState.getOne('routes')), __metadata("design:type", Observable) ], ApplicationLayoutComponent.prototype, "routes$", void 0); __decorate([ Select(ConfigState.getOne('currentUser')), __metadata("design:type", Observable) ], ApplicationLayoutComponent.prototype, "currentUser$", void 0); __decorate([ Select(ConfigState.getDeep('localization.languages')), __metadata("design:type", Observable) ], ApplicationLayoutComponent.prototype, "languages$", void 0); __decorate([ Select(LayoutState.getNavigationElements), __metadata("design:type", Observable) ], ApplicationLayoutComponent.prototype, "navElements$", void 0); if (false) { /** @type {?} */ ApplicationLayoutComponent.type; /** @type {?} */ ApplicationLayoutComponent.prototype.routes$; /** @type {?} */ ApplicationLayoutComponent.prototype.currentUser$; /** @type {?} */ ApplicationLayoutComponent.prototype.languages$; /** @type {?} */ ApplicationLayoutComponent.prototype.navElements$; /** @type {?} */ ApplicationLayoutComponent.prototype.currentUserRef; /** @type {?} */ ApplicationLayoutComponent.prototype.languageRef; /** @type {?} */ ApplicationLayoutComponent.prototype.navbarRootDropdowns; /** @type {?} */ ApplicationLayoutComponent.prototype.isOpenChangePassword; /** @type {?} */ ApplicationLayoutComponent.prototype.isOpenProfile; /** @type {?} */ ApplicationLayoutComponent.prototype.isDropdownChildDynamic; /** @type {?} */ ApplicationLayoutComponent.prototype.rightPartElements; /** @type {?} */ ApplicationLayoutComponent.prototype.trackByFn; /** @type {?} */ ApplicationLayoutComponent.prototype.trackElementByFn; /** * @type {?} * @private */ ApplicationLayoutComponent.prototype.store; /** * @type {?} * @private */ ApplicationLayoutComponent.prototype.oauthService; } /** * @param {?} routes * @return {?} */ function getVisibleRoutes(routes) { return routes.reduce((/** * @param {?} acc * @param {?} val * @return {?} */ (acc, val) => { if (val.invisible) return acc; if (val.children && val.children.length) { val.children = getVisibleRoutes(val.children); } return [...acc, val]; }), []); } /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class EmptyLayoutComponent { } EmptyLayoutComponent.type = "empty" /* empty */; EmptyLayoutComponent.decorators = [ { type: Component, args: [{ selector: 'abp-layout-empty', template: ` Layout-empty ` }] } ]; if (false) { /** @type {?} */ EmptyLayoutComponent.type; } /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class LayoutComponent { /** * @param {?} store */ constructor(store) { this.store = store; this.isCollapsed = true; } /** * @return {?} */ get appInfo() { return this.store.selectSnapshot(ConfigState.getApplicationInfo); } } LayoutComponent.decorators = [ { type: Component, args: [{ selector: ' abp-layout', template: "\n\n\n \n\n\n\n\n\n\n {{ appInfo.name }}\n\n", animations: [slideFromBottom] }] } ]; /** @nocollapse */ LayoutComponent.ctorParameters = () => [ { type: Store } ]; if (false) { /** @type {?} */ LayoutComponent.prototype.isCollapsed; /** * @type {?} * @private */ LayoutComponent.prototype.store; } /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class ValidationErrorComponent extends ValidationErrorComponent$1 { /** * @return {?} */ get abpErrors() { if (!this.errors || !this.errors.length) return []; return this.errors.map((/** * @param {?} error * @return {?} */ error => { if (!error.message) return error; /** @type {?} */ const index = error.message.indexOf('['); if (index > -1) { return Object.assign({}, error, { message: error.message.slice(0, index), interpoliteParams: error.message.slice(index + 1, error.message.length - 1).split(',') }); } return error; })); } } ValidationErrorComponent.decorators = [ { type: Component, args: [{ selector: 'abp-validation-error', template: `
    {{ error.message | abpLocalization: error.interpoliteParams }}
    `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None }] } ]; /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var styles = ` .content-header-title { font-size: 24px; } .entry-row { margin-bottom: 15px; } `; /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class InitialService { /** * @param {?} lazyLoadService */ constructor(lazyLoadService) { this.lazyLoadService = lazyLoadService; this.appendStyle().subscribe(); } /** * @return {?} */ appendStyle() { return this.lazyLoadService.load(null, 'style', styles, 'head', 'afterbegin'); } } InitialService.decorators = [ { type: Injectable, args: [{ providedIn: 'root' },] } ]; /** @nocollapse */ InitialService.ctorParameters = () => [ { type: LazyLoadService } ]; /** @nocollapse */ InitialService.ngInjectableDef = ɵɵdefineInjectable({ factory: function InitialService_Factory() { return new InitialService(ɵɵinject(LazyLoadService)); }, token: InitialService, providedIn: "root" }); if (false) { /** * @type {?} * @private */ InitialService.prototype.lazyLoadService; } /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ const LAYOUTS = [ApplicationLayoutComponent, AccountLayoutComponent, EmptyLayoutComponent]; class ThemeBasicModule { /** * @param {?} initialService */ constructor(initialService) { this.initialService = initialService; } } ThemeBasicModule.decorators = [ { type: NgModule, args: [{ declarations: [...LAYOUTS, LayoutComponent, ValidationErrorComponent], imports: [ CoreModule, ThemeSharedModule, NgbCollapseModule, NgbDropdownModule, ToastModule, NgxValidateCoreModule, NgxsModule.forFeature([LayoutState]), NgxValidateCoreModule.forRoot({ targetSelector: '.form-group', blueprints: { email: `AbpAccount::ThisFieldIsNotAValidEmailAddress.`, max: `AbpAccount::ThisFieldMustBeBetween{0}And{1}[{{ min }},{{ max }}]`, maxlength: `AbpAccount::ThisFieldMustBeAStringWithAMaximumLengthOf{1}[{{ requiredLength }}]`, min: `AbpAccount::ThisFieldMustBeBetween{0}And{1}[{{ min }},{{ max }}]`, minlength: `AbpAccount::ThisFieldMustBeAStringOrArrayTypeWithAMinimumLengthOf[{{ min }},{{ max }}]`, required: `AbpAccount::ThisFieldIsRequired.`, passwordMismatch: `AbpIdentity::Identity.PasswordConfirmationFailed`, }, errorTemplate: ValidationErrorComponent, }), ], exports: [...LAYOUTS], entryComponents: [...LAYOUTS, ValidationErrorComponent], },] } ]; /** @nocollapse */ ThemeBasicModule.ctorParameters = () => [ { type: InitialService } ]; if (false) { /** * @type {?} * @private */ ThemeBasicModule.prototype.initialService; } /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var Layout; (function (Layout) { /** * @record */ function State() { } Layout.State = State; if (false) { /** @type {?} */ State.prototype.navigationElements; } /** * @record */ function NavigationElement() { } Layout.NavigationElement = NavigationElement; if (false) { /** @type {?} */ NavigationElement.prototype.name; /** @type {?} */ NavigationElement.prototype.element; /** @type {?|undefined} */ NavigationElement.prototype.order; } })(Layout || (Layout = {})); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ export { AccountLayoutComponent, AddNavigationElement, ApplicationLayoutComponent, EmptyLayoutComponent, LAYOUTS, LayoutState, RemoveNavigationElementByName, ThemeBasicModule, ValidationErrorComponent, ApplicationLayoutComponent as ɵa, LayoutState as ɵb, AccountLayoutComponent as ɵc, EmptyLayoutComponent as ɵd, LayoutComponent as ɵe, ValidationErrorComponent as ɵf, LayoutState as ɵg, AddNavigationElement as ɵh, RemoveNavigationElementByName as ɵi, InitialService as ɵk }; //# sourceMappingURL=abp-ng.theme.basic.js.map