diff --git a/npm/ng-packs/packages/core/src/lib/models/application-configuration.ts b/npm/ng-packs/packages/core/src/lib/models/application-configuration.ts index 9912810399..ad34955dac 100644 --- a/npm/ng-packs/packages/core/src/lib/models/application-configuration.ts +++ b/npm/ng-packs/packages/core/src/lib/models/application-configuration.ts @@ -1,10 +1,12 @@ +import { ABP } from './common'; + export namespace ApplicationConfiguration { export interface Response { localization: Localization; auth: Auth; - setting: Setting; + setting: Value; currentUser: CurrentUser; - features: Features; + features: Value; } export interface Localization { @@ -32,8 +34,8 @@ export namespace ApplicationConfiguration { [key: string]: boolean; } - export interface Setting { - values: { [key: string]: 'Abp.Localization.DefaultLanguage' }; + export interface Value { + values: ABP.Dictionary; } export interface CurrentUser { @@ -42,8 +44,4 @@ export namespace ApplicationConfiguration { tenantId: string; userName: string; } - - export interface Features { - values: Setting; - } } diff --git a/npm/ng-packs/packages/core/src/lib/states/config.state.ts b/npm/ng-packs/packages/core/src/lib/states/config.state.ts index f454be2872..1c0f533079 100644 --- a/npm/ng-packs/packages/core/src/lib/states/config.state.ts +++ b/npm/ng-packs/packages/core/src/lib/states/config.state.ts @@ -1,14 +1,14 @@ -import { State, Selector, createSelector, Action, StateContext, Store } from '@ngxs/store'; -import { Config } from '../models/config'; -import { ABP } from '../models/common'; -import { GetAppConfiguration, PatchRouteByName } from '../actions/config.actions'; -import { ApplicationConfigurationService } from '../services/application-configuration.service'; -import { tap, switchMap } from 'rxjs/operators'; +import { Action, createSelector, Selector, State, StateContext, Store } from '@ngxs/store'; +import { of } from 'rxjs'; +import { switchMap, tap } from 'rxjs/operators'; import snq from 'snq'; +import { GetAppConfiguration, PatchRouteByName } from '../actions/config.actions'; import { SetLanguage } from '../actions/session.actions'; +import { ABP } from '../models/common'; +import { Config } from '../models/config'; +import { ApplicationConfigurationService } from '../services/application-configuration.service'; +import { organizeRoutes } from '../utils/route-utils'; import { SessionState } from './session.state'; -import { of } from 'rxjs'; -import { setChildRoute, sortRoutes, organizeRoutes } from '../utils/route-utils'; @State({ name: 'ConfigState', @@ -90,14 +90,31 @@ export class ConfigState { return selector; } - static getSetting(key: string) { + static getSetting(key: string, findContain?: boolean) { const selector = createSelector( [ConfigState], (state: Config.State) => { return snq(() => state.setting.values[key]); }, ); + return selector; + } + + static getSettings(keyword?: string) { + const selector = createSelector( + [ConfigState], + (state: Config.State) => { + if (keyword) { + const keys = snq(() => Object.keys(state.setting.values).filter(key => key.indexOf(keyword) > -1), []); + if (keys.length) { + return keys.reduce((acc, key) => ({ ...acc, [key]: state.setting.values[key] }), {}); + } + } + + return snq(() => state.setting.values, {}); + }, + ); return selector; } diff --git a/npm/ng-packs/packages/theme-basic/src/lib/components/layout/layout.component.html b/npm/ng-packs/packages/theme-basic/src/lib/components/layout/layout.component.html index 3e091aa5a1..89ab7f1b69 100644 --- a/npm/ng-packs/packages/theme-basic/src/lib/components/layout/layout.component.html +++ b/npm/ng-packs/packages/theme-basic/src/lib/components/layout/layout.component.html @@ -11,7 +11,7 @@
diff --git a/npm/ng-packs/packages/theme-shared/src/lib/animations/slide.animations.ts b/npm/ng-packs/packages/theme-shared/src/lib/animations/slide.animations.ts index 90f46662be..32ff155e55 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/animations/slide.animations.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/animations/slide.animations.ts @@ -1,6 +1,7 @@ import { animate, state, style, transition, trigger, query } from '@angular/animations'; -export const slideFromBottom = trigger('routeAnimations', [ - state('void', style({ 'margin-top': '20px', opacity: '0' })), - state('*', style({ 'margin-top': '0px', opacity: '1' })), - transition(':enter', [animate('0.2s ease-out', style({ opacity: '1', 'margin-top': '0px' }))]), +export const slideFromBottom = trigger('slideFromBottom', [ + transition('* <=> *', [ + style({ 'margin-top': '20px', opacity: '0' }), + animate('0.2s ease-out', style({ opacity: '1', 'margin-top': '0px' })), + ]), ]); diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/button/button.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/button/button.component.ts index 50dab84c0f..214f2e52de 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/button/button.component.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/button/button.component.ts @@ -3,17 +3,17 @@ import { Component, Input } from '@angular/core'; @Component({ selector: 'abp-button', template: ` - - ` + `, }) export class ButtonComponent { @Input() buttonClass = 'btn btn-primary'; @Input() - type = 'button'; + buttonType = 'button'; @Input() iconClass: string; @@ -24,6 +24,11 @@ export class ButtonComponent { @Input() disabled = false; + /** + * @deprecated Use buttonType instead. To be deleted in v1 + */ + @Input() type = 'button'; + get icon(): string { return `${this.loading ? 'fa fa-pulse fa-spinner' : this.iconClass || 'd-none'}`; }