Browse Source

feat: use new interfaces

pull/6372/head
mehmet-erim 6 years ago
parent
commit
247172e552
  1. 7
      npm/ng-packs/packages/core/src/lib/utils/date-utils.ts
  2. 11
      npm/ng-packs/packages/core/src/lib/utils/initial-utils.ts
  3. 10
      npm/ng-packs/packages/core/src/lib/utils/localization-utils.ts
  4. 7
      npm/ng-packs/packages/core/src/lib/utils/multi-tenancy-utils.ts
  5. 8
      npm/ng-packs/packages/core/src/public-api.ts
  6. 10
      npm/ng-packs/packages/feature-management/src/lib/components/feature-management/feature-management.component.ts
  7. 14
      npm/ng-packs/packages/permission-management/src/lib/components/permission-management.component.ts
  8. 11
      npm/ng-packs/packages/theme-basic/src/lib/components/nav-items/current-user.component.ts
  9. 8
      npm/ng-packs/packages/theme-basic/src/lib/components/nav-items/languages.component.ts
  10. 7
      npm/ng-packs/packages/theme-shared/extensions/src/lib/utils/localization.util.ts
  11. 4
      npm/ng-packs/packages/theme-shared/extensions/src/lib/utils/state.util.ts
  12. 5
      npm/ng-packs/packages/theme-shared/extensions/src/tests/localization.util.spec.ts
  13. 11
      npm/ng-packs/packages/theme-shared/src/lib/handlers/error.handler.ts
  14. 6
      npm/ng-packs/packages/theme-shared/src/lib/models/confirmation.ts
  15. 10
      npm/ng-packs/packages/theme-shared/src/lib/models/toaster.ts
  16. 22
      npm/ng-packs/packages/theme-shared/src/lib/services/confirmation.service.ts
  17. 29
      npm/ng-packs/packages/theme-shared/src/lib/services/toaster.service.ts
  18. 4
      npm/ng-packs/packages/theme-shared/src/lib/utils/date-parser-formatter.ts
  19. 100
      templates/app/angular/yarn.lock

7
npm/ng-packs/packages/core/src/lib/utils/date-utils.ts

@ -1,10 +1,11 @@
import { ApplicationConfiguration } from '../models/application-configuration'; import { ApplicationConfiguration } from '../models/application-configuration';
import { DateTimeFormatDto } from '../proxy/volo/abp/asp-net-core/mvc/application-configurations/models';
import { ConfigStateService } from '../services'; import { ConfigStateService } from '../services';
export function getShortDateFormat(configStateService: ConfigStateService) { export function getShortDateFormat(configStateService: ConfigStateService) {
const dateTimeFormat = configStateService.getDeep( const dateTimeFormat = configStateService.getDeep(
'localization.currentCulture.dateTimeFormat', 'localization.currentCulture.dateTimeFormat',
) as ApplicationConfiguration.DateTimeFormat; ) as DateTimeFormatDto;
return dateTimeFormat.shortDatePattern; return dateTimeFormat.shortDatePattern;
} }
@ -12,7 +13,7 @@ export function getShortDateFormat(configStateService: ConfigStateService) {
export function getShortTimeFormat(configStateService: ConfigStateService) { export function getShortTimeFormat(configStateService: ConfigStateService) {
const dateTimeFormat = configStateService.getDeep( const dateTimeFormat = configStateService.getDeep(
'localization.currentCulture.dateTimeFormat', 'localization.currentCulture.dateTimeFormat',
) as ApplicationConfiguration.DateTimeFormat; ) as DateTimeFormatDto;
return dateTimeFormat.shortTimePattern.replace('tt', 'a'); return dateTimeFormat.shortTimePattern.replace('tt', 'a');
} }
@ -20,7 +21,7 @@ export function getShortTimeFormat(configStateService: ConfigStateService) {
export function getShortDateShortTimeFormat(configStateService: ConfigStateService) { export function getShortDateShortTimeFormat(configStateService: ConfigStateService) {
const dateTimeFormat = configStateService.getDeep( const dateTimeFormat = configStateService.getDeep(
'localization.currentCulture.dateTimeFormat', 'localization.currentCulture.dateTimeFormat',
) as ApplicationConfiguration.DateTimeFormat; ) as DateTimeFormatDto;
return `${dateTimeFormat.shortDatePattern} ${dateTimeFormat.shortTimePattern.replace('tt', 'a')}`; return `${dateTimeFormat.shortDatePattern} ${dateTimeFormat.shortTimePattern.replace('tt', 'a')}`;
} }

11
npm/ng-packs/packages/core/src/lib/utils/initial-utils.ts

@ -6,7 +6,8 @@ import { tap } from 'rxjs/operators';
import { ApplicationConfiguration } from '../models/application-configuration'; import { ApplicationConfiguration } from '../models/application-configuration';
import { ABP } from '../models/common'; import { ABP } from '../models/common';
import { Environment } from '../models/environment'; import { Environment } from '../models/environment';
import { ApplicationConfigurationService } from '../services/application-configuration.service'; import { AbpApplicationConfigurationService } from '../proxy/volo/abp/asp-net-core/mvc/application-configurations/abp-application-configuration.service';
import { CurrentTenantDto } from '../proxy/volo/abp/asp-net-core/mvc/multi-tenancy/models';
import { AuthService } from '../services/auth.service'; import { AuthService } from '../services/auth.service';
import { ConfigStateService } from '../services/config-state.service'; import { ConfigStateService } from '../services/config-state.service';
import { EnvironmentService } from '../services/environment.service'; import { EnvironmentService } from '../services/environment.service';
@ -20,7 +21,7 @@ export function getInitialData(injector: Injector) {
const fn = async () => { const fn = async () => {
const environmentService = injector.get(EnvironmentService); const environmentService = injector.get(EnvironmentService);
const configState = injector.get(ConfigStateService); const configState = injector.get(ConfigStateService);
const appConfigService = injector.get(ApplicationConfigurationService); const appConfigService = injector.get(AbpApplicationConfigurationService);
const options = injector.get(CORE_OPTIONS) as ABP.Root; const options = injector.get(CORE_OPTIONS) as ABP.Root;
environmentService.setState(options.environment as Environment); environmentService.setState(options.environment as Environment);
@ -31,14 +32,12 @@ export function getInitialData(injector: Injector) {
if (options.skipGetAppConfiguration) return; if (options.skipGetAppConfiguration) return;
return appConfigService return appConfigService
.getConfiguration() .get()
.pipe( .pipe(
tap(res => configState.setState(res)), tap(res => configState.setState(res)),
tap(() => checkAccessToken(injector)), tap(() => checkAccessToken(injector)),
tap(() => { tap(() => {
const currentTenant = configState.getOne( const currentTenant = configState.getOne('currentTenant') as CurrentTenantDto;
'currentTenant',
) as ApplicationConfiguration.CurrentTenant;
if (!currentTenant?.id) return; if (!currentTenant?.id) return;
injector.get(SessionStateService).setTenant(currentTenant); injector.get(SessionStateService).setTenant(currentTenant);

10
npm/ng-packs/packages/core/src/lib/utils/localization-utils.ts

@ -1,4 +1,4 @@
import { ApplicationConfiguration } from '../models/application-configuration'; import { ApplicationLocalizationConfigurationDto } from '../proxy/volo/abp/asp-net-core/mvc/application-configurations/models';
// This will not be necessary when only Angukar 9.1+ is supported // This will not be necessary when only Angukar 9.1+ is supported
export function getLocaleDirection(locale: string): 'ltr' | 'rtl' { export function getLocaleDirection(locale: string): 'ltr' | 'rtl' {
@ -9,7 +9,7 @@ export function getLocaleDirection(locale: string): 'ltr' | 'rtl' {
: 'ltr'; : 'ltr';
} }
export function createLocalizer(localization: ApplicationConfiguration.Localization) { export function createLocalizer(localization: ApplicationLocalizationConfigurationDto) {
return (resourceName: string, key: string, defaultValue: string) => { return (resourceName: string, key: string, defaultValue: string) => {
if (resourceName === '_') return key; if (resourceName === '_') return key;
@ -21,7 +21,7 @@ export function createLocalizer(localization: ApplicationConfiguration.Localizat
}; };
} }
export function createLocalizerWithFallback(localization: ApplicationConfiguration.Localization) { export function createLocalizerWithFallback(localization: ApplicationLocalizationConfigurationDto) {
const findLocalization = createLocalizationFinder(localization); const findLocalization = createLocalizationFinder(localization);
return (resourceNames: string[], keys: string[], defaultValue: string) => { return (resourceNames: string[], keys: string[], defaultValue: string) => {
@ -31,7 +31,7 @@ export function createLocalizerWithFallback(localization: ApplicationConfigurati
} }
export function createLocalizationPipeKeyGenerator( export function createLocalizationPipeKeyGenerator(
localization: ApplicationConfiguration.Localization, localization: ApplicationLocalizationConfigurationDto,
) { ) {
const findLocalization = createLocalizationFinder(localization); const findLocalization = createLocalizationFinder(localization);
@ -41,7 +41,7 @@ export function createLocalizationPipeKeyGenerator(
}; };
} }
function createLocalizationFinder(localization: ApplicationConfiguration.Localization) { function createLocalizationFinder(localization: ApplicationLocalizationConfigurationDto) {
const localize = createLocalizer(localization); const localize = createLocalizer(localization);
return (resourceNames: string[], keys: string[]) => { return (resourceNames: string[], keys: string[]) => {

7
npm/ng-packs/packages/core/src/lib/utils/multi-tenancy-utils.ts

@ -3,6 +3,8 @@ import clone from 'just-clone';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { switchMap, tap } from 'rxjs/operators'; import { switchMap, tap } from 'rxjs/operators';
import { Environment } from '../models/environment'; import { Environment } from '../models/environment';
import { AbpTenantService } from '../proxy/pages/abp/multi-tenancy/abp-tenant.service';
import { CurrentTenantDto } from '../proxy/volo/abp/asp-net-core/mvc/multi-tenancy/models';
import { EnvironmentService } from '../services/environment.service'; import { EnvironmentService } from '../services/environment.service';
import { MultiTenancyService } from '../services/multi-tenancy.service'; import { MultiTenancyService } from '../services/multi-tenancy.service';
import { createTokenParser } from './string-utils'; import { createTokenParser } from './string-utils';
@ -20,6 +22,7 @@ function getCurrentTenancyName(appBaseUrl: string): string {
export async function parseTenantFromUrl(injector: Injector) { export async function parseTenantFromUrl(injector: Injector) {
const environmentService = injector.get(EnvironmentService); const environmentService = injector.get(EnvironmentService);
const multiTenancyService = injector.get(MultiTenancyService); const multiTenancyService = injector.get(MultiTenancyService);
const abpTenantService = injector.get(AbpTenantService);
const baseUrl = environmentService.getEnvironment()?.application?.baseUrl || ''; const baseUrl = environmentService.getEnvironment()?.application?.baseUrl || '';
const tenancyName = getCurrentTenancyName(baseUrl); const tenancyName = getCurrentTenancyName(baseUrl);
@ -30,10 +33,10 @@ export async function parseTenantFromUrl(injector: Injector) {
return of(null) return of(null)
.pipe( .pipe(
switchMap(() => multiTenancyService.findTenantByName(tenancyName, { __tenant: '' })), switchMap(() => abpTenantService.findTenantByName(tenancyName, { __tenant: '' })),
tap(res => { tap(res => {
multiTenancyService.domainTenant = res.success multiTenancyService.domainTenant = res.success
? { id: res.tenantId, name: res.name } ? ({ id: res.tenantId, name: res.name } as CurrentTenantDto)
: null; : null;
}), }),
) )

8
npm/ng-packs/packages/core/src/public-api.ts

@ -21,3 +21,11 @@ export * from './lib/strategies';
export * from './lib/tokens'; export * from './lib/tokens';
export * from './lib/utils'; export * from './lib/utils';
export * from './lib/validators'; export * from './lib/validators';
export * from './lib/proxy/volo/abp/asp-net-core/mvc/api-exploring';
export * from './lib/proxy/volo/abp/asp-net-core/mvc/multi-tenancy';
export * from './lib/proxy/volo/abp/asp-net-core/mvc/application-configurations';
export * from './lib/proxy/volo/abp/asp-net-core/mvc/application-configurations/object-extending';
export * from './lib/proxy/volo/abp/http/modeling';
export * from './lib/proxy/volo/abp/models';
export * from './lib/proxy/volo/abp/localization';
export * from './lib/proxy/pages/abp/multi-tenancy';

10
npm/ng-packs/packages/feature-management/src/lib/components/feature-management/feature-management.component.ts

@ -1,4 +1,8 @@
import { ApplicationConfigurationService, ConfigStateService, TrackByService } from '@abp/ng.core'; import {
AbpApplicationConfigurationService,
ConfigStateService,
TrackByService,
} from '@abp/ng.core';
import { LocaleDirection } from '@abp/ng.theme.shared'; import { LocaleDirection } from '@abp/ng.theme.shared';
import { Component, EventEmitter, Input, Output } from '@angular/core'; import { Component, EventEmitter, Input, Output } from '@angular/core';
import { Store } from '@ngxs/store'; import { Store } from '@ngxs/store';
@ -66,7 +70,7 @@ export class FeatureManagementComponent
protected service: FeaturesService, protected service: FeaturesService,
protected store: Store, protected store: Store,
protected configState: ConfigStateService, protected configState: ConfigStateService,
protected appConfigService: ApplicationConfigurationService, protected appConfigService: AbpApplicationConfigurationService,
) {} ) {}
openModal() { openModal() {
@ -118,7 +122,7 @@ export class FeatureManagementComponent
if (!this.providerKey) { if (!this.providerKey) {
// to refresh host's features // to refresh host's features
this.appConfigService this.appConfigService
.getConfiguration() .get()
.pipe(tap(res => this.configState.setState(res))) .pipe(tap(res => this.configState.setState(res)))
.subscribe(); .subscribe();
} }

14
npm/ng-packs/packages/permission-management/src/lib/components/permission-management.component.ts

@ -1,7 +1,7 @@
import { import {
ApplicationConfiguration, AbpApplicationConfigurationService,
ApplicationConfigurationService,
ConfigStateService, ConfigStateService,
CurrentUserDto,
} from '@abp/ng.core'; } from '@abp/ng.core';
import { LocaleDirection } from '@abp/ng.theme.shared'; import { LocaleDirection } from '@abp/ng.theme.shared';
import { Component, EventEmitter, Input, Output, TrackByFunction } from '@angular/core'; import { Component, EventEmitter, Input, Output, TrackByFunction } from '@angular/core';
@ -118,7 +118,7 @@ export class PermissionManagementComponent
constructor( constructor(
protected store: Store, protected store: Store,
protected configState: ConfigStateService, protected configState: ConfigStateService,
protected appConfigService: ApplicationConfigurationService, protected appConfigService: AbpApplicationConfigurationService,
) {} ) {}
getChecked(name: string) { getChecked(name: string) {
@ -254,9 +254,7 @@ export class PermissionManagementComponent
.pipe( .pipe(
switchMap(() => switchMap(() =>
this.shouldFetchAppConfig() this.shouldFetchAppConfig()
? this.appConfigService ? this.appConfigService.get().pipe(tap(res => this.configState.setState(res)))
.getConfiguration()
.pipe(tap(res => this.configState.setState(res)))
: of(null), : of(null),
), ),
finalize(() => (this.modalBusy = false)), finalize(() => (this.modalBusy = false)),
@ -300,9 +298,7 @@ export class PermissionManagementComponent
} }
shouldFetchAppConfig() { shouldFetchAppConfig() {
const currentUser = this.configState.getOne( const currentUser = this.configState.getOne('currentUser') as CurrentUserDto;
'currentUser',
) as ApplicationConfiguration.CurrentUser;
if (this.providerName === 'R') return currentUser.roles.some(role => role === this.providerKey); if (this.providerName === 'R') return currentUser.roles.some(role => role === this.providerKey);

11
npm/ng-packs/packages/theme-basic/src/lib/components/nav-items/current-user.component.ts

@ -1,9 +1,4 @@
import { import { AuthService, ConfigStateService, CurrentUserDto, EnvironmentService } from '@abp/ng.core';
ApplicationConfiguration,
AuthService,
ConfigStateService,
EnvironmentService,
} from '@abp/ng.core';
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
@ -52,9 +47,7 @@ import { Observable } from 'rxjs';
`, `,
}) })
export class CurrentUserComponent { export class CurrentUserComponent {
currentUser$: Observable<ApplicationConfiguration.CurrentUser> = this.configState.getOne$( currentUser$: Observable<CurrentUserDto> = this.configState.getOne$('currentUser');
'currentUser',
);
get smallScreen(): boolean { get smallScreen(): boolean {
return window.innerWidth < 992; return window.innerWidth < 992;

8
npm/ng-packs/packages/theme-basic/src/lib/components/nav-items/languages.component.ts

@ -1,4 +1,4 @@
import { ApplicationConfiguration, ConfigStateService, SessionStateService } from '@abp/ng.core'; import { ConfigStateService, LanguageInfo, SessionStateService } from '@abp/ng.core';
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { map } from 'rxjs/operators'; import { map } from 'rxjs/operators';
@ -48,9 +48,7 @@ export class LanguagesComponent {
return window.innerWidth < 992; return window.innerWidth < 992;
} }
languages$: Observable<ApplicationConfiguration.Language[]> = this.configState.getDeep$( languages$: Observable<LanguageInfo[]> = this.configState.getDeep$('localization.languages');
'localization.languages',
);
get defaultLanguage$(): Observable<string> { get defaultLanguage$(): Observable<string> {
return this.languages$.pipe( return this.languages$.pipe(
@ -64,7 +62,7 @@ export class LanguagesComponent {
); );
} }
get dropdownLanguages$(): Observable<ApplicationConfiguration.Language[]> { get dropdownLanguages$(): Observable<LanguageInfo[]> {
return this.languages$.pipe( return this.languages$.pipe(
map( map(
languages => languages =>

7
npm/ng-packs/packages/theme-shared/extensions/src/lib/utils/localization.util.ts

@ -1,8 +1,11 @@
import { ApplicationConfiguration, createLocalizationPipeKeyGenerator } from '@abp/ng.core'; import {
ApplicationLocalizationConfigurationDto,
createLocalizationPipeKeyGenerator,
} from '@abp/ng.core';
import { ObjectExtensions } from '../models/object-extensions'; import { ObjectExtensions } from '../models/object-extensions';
export function createDisplayNameLocalizationPipeKeyGenerator( export function createDisplayNameLocalizationPipeKeyGenerator(
localization: ApplicationConfiguration.Localization, localization: ApplicationLocalizationConfigurationDto,
) { ) {
const generateLocalizationPipeKey = createLocalizationPipeKeyGenerator(localization); const generateLocalizationPipeKey = createLocalizationPipeKeyGenerator(localization);

4
npm/ng-packs/packages/theme-shared/extensions/src/lib/utils/state.util.ts

@ -1,4 +1,4 @@
import { ABP, ApplicationConfiguration, ConfigStateService } from '@abp/ng.core'; import { ABP, ApplicationLocalizationConfigurationDto, ConfigStateService } from '@abp/ng.core';
import { Observable, pipe, zip } from 'rxjs'; import { Observable, pipe, zip } from 'rxjs';
import { filter, map, switchMap, take } from 'rxjs/operators'; import { filter, map, switchMap, take } from 'rxjs/operators';
import { ePropType } from '../enums/props.enum'; import { ePropType } from '../enums/props.enum';
@ -19,7 +19,7 @@ function selectObjectExtensions(
function selectLocalization( function selectLocalization(
configState: ConfigStateService, configState: ConfigStateService,
): Observable<ApplicationConfiguration.Localization> { ): Observable<ApplicationLocalizationConfigurationDto> {
return configState.getOne$('localization'); return configState.getOne$('localization');
} }

5
npm/ng-packs/packages/theme-shared/extensions/src/tests/localization.util.spec.ts

@ -1,3 +1,4 @@
import { ApplicationLocalizationConfigurationDto } from '@abp/ng.core';
import { createDisplayNameLocalizationPipeKeyGenerator } from '../lib/utils/localization.util'; import { createDisplayNameLocalizationPipeKeyGenerator } from '../lib/utils/localization.util';
describe('Localization Utils', () => { describe('Localization Utils', () => {
@ -10,7 +11,9 @@ describe('Localization Utils', () => {
defaultResourceName: 'Default', defaultResourceName: 'Default',
currentCulture: null, currentCulture: null,
languages: [], languages: [],
}); languageFilesMap: null,
languagesMap: null,
} as ApplicationLocalizationConfigurationDto);
test.each` test.each`
displayName | fallback | expected displayName | fallback | expected

11
npm/ng-packs/packages/theme-shared/src/lib/handlers/error.handler.ts

@ -1,4 +1,4 @@
import { Config, RestOccurError } from '@abp/ng.core'; import { Config, LocalizationParam, RestOccurError } from '@abp/ng.core';
import { HttpErrorResponse } from '@angular/common/http'; import { HttpErrorResponse } from '@angular/common/http';
import { import {
ApplicationRef, ApplicationRef,
@ -87,10 +87,7 @@ export class ErrorHandler {
private listenToRouterError() { private listenToRouterError() {
this.actions this.actions
.pipe( .pipe(ofActionSuccessful(RouterError), filter(this.filterRouteErrors))
ofActionSuccessful(RouterError),
filter(this.filterRouteErrors),
)
.subscribe(() => this.show404Page()); .subscribe(() => this.show404Page());
} }
@ -233,8 +230,8 @@ export class ErrorHandler {
} }
private showError( private showError(
message?: Config.LocalizationParam, message?: LocalizationParam,
title?: Config.LocalizationParam, title?: LocalizationParam,
body?: any, body?: any,
): Observable<Confirmation.Status> { ): Observable<Confirmation.Status> {
if (body) { if (body) {

6
npm/ng-packs/packages/theme-shared/src/lib/models/confirmation.ts

@ -1,4 +1,4 @@
import { Config } from '@abp/ng.core'; import { Config, LocalizationParam } from '@abp/ng.core';
export namespace Confirmation { export namespace Confirmation {
export interface Options { export interface Options {
@ -8,8 +8,8 @@ export namespace Confirmation {
titleLocalizationParams?: string[]; titleLocalizationParams?: string[];
hideCancelBtn?: boolean; hideCancelBtn?: boolean;
hideYesBtn?: boolean; hideYesBtn?: boolean;
cancelText?: Config.LocalizationParam; cancelText?: LocalizationParam;
yesText?: Config.LocalizationParam; yesText?: LocalizationParam;
} }
export interface DialogData { export interface DialogData {

10
npm/ng-packs/packages/theme-shared/src/lib/models/toaster.ts

@ -1,4 +1,4 @@
import { Config } from '@abp/ng.core'; import { Config, LocalizationParam } from '@abp/ng.core';
export namespace Toaster { export namespace Toaster {
export interface ToastOptions { export interface ToastOptions {
@ -13,8 +13,8 @@ export namespace Toaster {
} }
export interface Toast { export interface Toast {
message: Config.LocalizationParam; message: LocalizationParam;
title?: Config.LocalizationParam; title?: LocalizationParam;
severity?: string; severity?: string;
options?: ToastOptions; options?: ToastOptions;
} }
@ -24,8 +24,8 @@ export namespace Toaster {
export interface Service { export interface Service {
show: ( show: (
message: Config.LocalizationParam, message: LocalizationParam,
title: Config.LocalizationParam, title: LocalizationParam,
severity: Toaster.Severity, severity: Toaster.Severity,
options: Partial<Toaster.ToastOptions>, options: Partial<Toaster.ToastOptions>,
) => ToasterId; ) => ToasterId;

22
npm/ng-packs/packages/theme-shared/src/lib/services/confirmation.service.ts

@ -1,4 +1,4 @@
import { Config, ContentProjectionService, PROJECTION_STRATEGY } from '@abp/ng.core'; import { ContentProjectionService, LocalizationParam, PROJECTION_STRATEGY } from '@abp/ng.core';
import { ComponentRef, Injectable } from '@angular/core'; import { ComponentRef, Injectable } from '@angular/core';
import { fromEvent, Observable, ReplaySubject, Subject } from 'rxjs'; import { fromEvent, Observable, ReplaySubject, Subject } from 'rxjs';
import { debounceTime, filter, takeUntil } from 'rxjs/operators'; import { debounceTime, filter, takeUntil } from 'rxjs/operators';
@ -33,40 +33,40 @@ export class ConfirmationService {
} }
info( info(
message: Config.LocalizationParam, message: LocalizationParam,
title: Config.LocalizationParam, title: LocalizationParam,
options?: Partial<Confirmation.Options>, options?: Partial<Confirmation.Options>,
): Observable<Confirmation.Status> { ): Observable<Confirmation.Status> {
return this.show(message, title, 'info', options); return this.show(message, title, 'info', options);
} }
success( success(
message: Config.LocalizationParam, message: LocalizationParam,
title: Config.LocalizationParam, title: LocalizationParam,
options?: Partial<Confirmation.Options>, options?: Partial<Confirmation.Options>,
): Observable<Confirmation.Status> { ): Observable<Confirmation.Status> {
return this.show(message, title, 'success', options); return this.show(message, title, 'success', options);
} }
warn( warn(
message: Config.LocalizationParam, message: LocalizationParam,
title: Config.LocalizationParam, title: LocalizationParam,
options?: Partial<Confirmation.Options>, options?: Partial<Confirmation.Options>,
): Observable<Confirmation.Status> { ): Observable<Confirmation.Status> {
return this.show(message, title, 'warning', options); return this.show(message, title, 'warning', options);
} }
error( error(
message: Config.LocalizationParam, message: LocalizationParam,
title: Config.LocalizationParam, title: LocalizationParam,
options?: Partial<Confirmation.Options>, options?: Partial<Confirmation.Options>,
): Observable<Confirmation.Status> { ): Observable<Confirmation.Status> {
return this.show(message, title, 'error', options); return this.show(message, title, 'error', options);
} }
show( show(
message: Config.LocalizationParam, message: LocalizationParam,
title: Config.LocalizationParam, title: LocalizationParam,
severity?: Confirmation.Severity, severity?: Confirmation.Severity,
options = {} as Partial<Confirmation.Options>, options = {} as Partial<Confirmation.Options>,
): Observable<Confirmation.Status> { ): Observable<Confirmation.Status> {

29
npm/ng-packs/packages/theme-shared/src/lib/services/toaster.service.ts

@ -1,9 +1,14 @@
import {
ContentProjectionService,
LocalizationParam,
PROJECTION_STRATEGY,
Strict,
} from '@abp/ng.core';
import { ComponentRef, Injectable } from '@angular/core'; import { ComponentRef, Injectable } from '@angular/core';
import { Toaster } from '../models';
import { ReplaySubject } from 'rxjs'; import { ReplaySubject } from 'rxjs';
import { Config, ContentProjectionService, PROJECTION_STRATEGY, Strict } from '@abp/ng.core';
import snq from 'snq'; import snq from 'snq';
import { ToastContainerComponent } from '../components/toast-container/toast-container.component'; import { ToastContainerComponent } from '../components/toast-container/toast-container.component';
import { Toaster } from '../models';
@Injectable({ @Injectable({
providedIn: 'root', providedIn: 'root',
@ -34,8 +39,8 @@ export class ToasterService implements ToasterContract {
* @param options Spesific style or structural options for individual toast * @param options Spesific style or structural options for individual toast
*/ */
info( info(
message: Config.LocalizationParam, message: LocalizationParam,
title?: Config.LocalizationParam, title?: LocalizationParam,
options?: Partial<Toaster.ToastOptions>, options?: Partial<Toaster.ToastOptions>,
): Toaster.ToasterId { ): Toaster.ToasterId {
return this.show(message, title, 'info', options); return this.show(message, title, 'info', options);
@ -48,8 +53,8 @@ export class ToasterService implements ToasterContract {
* @param options Spesific style or structural options for individual toast * @param options Spesific style or structural options for individual toast
*/ */
success( success(
message: Config.LocalizationParam, message: LocalizationParam,
title?: Config.LocalizationParam, title?: LocalizationParam,
options?: Partial<Toaster.ToastOptions>, options?: Partial<Toaster.ToastOptions>,
): Toaster.ToasterId { ): Toaster.ToasterId {
return this.show(message, title, 'success', options); return this.show(message, title, 'success', options);
@ -62,8 +67,8 @@ export class ToasterService implements ToasterContract {
* @param options Spesific style or structural options for individual toast * @param options Spesific style or structural options for individual toast
*/ */
warn( warn(
message: Config.LocalizationParam, message: LocalizationParam,
title?: Config.LocalizationParam, title?: LocalizationParam,
options?: Partial<Toaster.ToastOptions>, options?: Partial<Toaster.ToastOptions>,
): Toaster.ToasterId { ): Toaster.ToasterId {
return this.show(message, title, 'warning', options); return this.show(message, title, 'warning', options);
@ -76,8 +81,8 @@ export class ToasterService implements ToasterContract {
* @param options Spesific style or structural options for individual toast * @param options Spesific style or structural options for individual toast
*/ */
error( error(
message: Config.LocalizationParam, message: LocalizationParam,
title?: Config.LocalizationParam, title?: LocalizationParam,
options?: Partial<Toaster.ToastOptions>, options?: Partial<Toaster.ToastOptions>,
): Toaster.ToasterId { ): Toaster.ToasterId {
return this.show(message, title, 'error', options); return this.show(message, title, 'error', options);
@ -92,8 +97,8 @@ export class ToasterService implements ToasterContract {
*/ */
show( show(
message: Config.LocalizationParam, message: LocalizationParam,
title: Config.LocalizationParam = null, title: LocalizationParam = null,
severity: Toaster.Severity = 'neutral', severity: Toaster.Severity = 'neutral',
options = {} as Partial<Toaster.ToastOptions>, options = {} as Partial<Toaster.ToastOptions>,
): Toaster.ToasterId { ): Toaster.ToasterId {

4
npm/ng-packs/packages/theme-shared/src/lib/utils/date-parser-formatter.ts

@ -1,4 +1,4 @@
import { ApplicationConfiguration, ConfigStateService } from '@abp/ng.core'; import { ApplicationLocalizationConfigurationDto, ConfigStateService } from '@abp/ng.core';
import { DatePipe } from '@angular/common'; import { DatePipe } from '@angular/common';
import { Injectable, Optional } from '@angular/core'; import { Injectable, Optional } from '@angular/core';
import { NgbDateParserFormatter, NgbDateStruct } from '@ng-bootstrap/ng-bootstrap'; import { NgbDateParserFormatter, NgbDateStruct } from '@ng-bootstrap/ng-bootstrap';
@ -51,7 +51,7 @@ export class DateParserFormatter extends NgbDateParserFormatter {
format(date: NgbDateStruct): string { format(date: NgbDateStruct): string {
const { shortDatePattern } = (this.configState.getOne( const { shortDatePattern } = (this.configState.getOne(
'localization', 'localization',
) as ApplicationConfiguration.Localization).currentCulture.dateTimeFormat; ) as ApplicationLocalizationConfigurationDto).currentCulture.dateTimeFormat;
if (date && this.datePipe) { if (date && this.datePipe) {
return this.datePipe.transform( return this.datePipe.transform(

100
templates/app/angular/yarn.lock

@ -2,15 +2,14 @@
# yarn lockfile v1 # yarn lockfile v1
"@abp/ng.core@~3.3.1": "@abp/ng.core@~4.0.0-rc.4":
version "3.3.1" version "4.0.0-rc.4"
resolved "https://registry.yarnpkg.com/@abp/ng.core/-/ng.core-3.3.1.tgz#230518da3cd1a8b4efef85df9d4d07e5c66b2549" resolved "https://registry.yarnpkg.com/@abp/ng.core/-/ng.core-4.0.0-rc.4.tgz#f1cbb7d43662579a7977c9d98bf28f7a6726537f"
integrity sha512-x2zD3zhK5YD9EaV1p8AEboj9yoqzYCvyOkb7YDDBNR1VP2v+m7T8NRASBHkVrGZLwLkyd/qwOBUjEitz8XAbUA== integrity sha512-EtvoUr52v4+DEn3j2mru4OiLJf9tcg5ptLRjwBg1psftz1t3atnmvP1F8+sIhOwnj/Zm5hlhqSqnedpTzdALPg==
dependencies: dependencies:
"@abp/utils" "^3.3.0" "@abp/utils" "^4.0.0-rc.3"
"@angular/localize" "~10.0.10" "@angular/localize" "~10.0.10"
"@ngxs/router-plugin" "^3.7.0" "@ngxs/router-plugin" "^3.7.0"
"@ngxs/storage-plugin" "^3.7.0"
"@ngxs/store" "^3.7.0" "@ngxs/store" "^3.7.0"
angular-oauth2-oidc "^10.0.0" angular-oauth2-oidc "^10.0.0"
just-clone "^3.1.0" just-clone "^3.1.0"
@ -19,29 +18,29 @@
ts-toolbelt "6.15.4" ts-toolbelt "6.15.4"
tslib "^2.0.0" tslib "^2.0.0"
"@abp/ng.feature-management@~3.3.1": "@abp/ng.feature-management@~4.0.0-rc.4":
version "3.3.1" version "4.0.0-rc.4"
resolved "https://registry.yarnpkg.com/@abp/ng.feature-management/-/ng.feature-management-3.3.1.tgz#b4497d999e87049b266473daf8d274d5fb26b248" resolved "https://registry.yarnpkg.com/@abp/ng.feature-management/-/ng.feature-management-4.0.0-rc.4.tgz#ab740e4327b8fd10ba4567bfeb24debbd4ffe8a5"
integrity sha512-SdUrZ67bGJQZ0RchS7bcA5wSF6PiD3hcJwsReWzw49nM2Qr8vbHlsstXww6slvq8nT5gwC6O0OA71zsHarpHfg== integrity sha512-PlWxAA2wECRrBGwqWeaWi+f3YPayIaOJhW4INTvD5JUFMIRJsOJZlxpmcz8x2pU64bUO42/YM26+Xy2TyVKFNg==
dependencies: dependencies:
"@abp/ng.theme.shared" "~3.3.1" "@abp/ng.theme.shared" "~4.0.0-rc.4"
tslib "^2.0.0" tslib "^2.0.0"
"@abp/ng.identity@~3.3.1": "@abp/ng.identity@~4.0.0-rc.4":
version "3.3.1" version "4.0.0-rc.4"
resolved "https://registry.yarnpkg.com/@abp/ng.identity/-/ng.identity-3.3.1.tgz#e357e8bb1281e4fcbdeb20ef9d288eee6b274d3c" resolved "https://registry.yarnpkg.com/@abp/ng.identity/-/ng.identity-4.0.0-rc.4.tgz#5b8694b1d1d6f1a039e1a445add14dcc5d6eb5ad"
integrity sha512-NjCmLdHUQtyGWPqIBo0OVSxUeQ4laQ501xPsJYZG7WOWmMJGTkBQKIFkUAG8gLKv8EDTIzBuVs8V8scr+EUSiw== integrity sha512-nqx3ofuTT5kOdJHWAyrZyEmGGp08DZNNC7IIY7L1/NueiAcfjghKrAiGkNnt5SApdk86OzdrLdIvpELnZVCMzg==
dependencies: dependencies:
"@abp/ng.permission-management" "~3.3.1" "@abp/ng.permission-management" "~4.0.0-rc.4"
"@abp/ng.theme.shared" "~3.3.1" "@abp/ng.theme.shared" "~4.0.0-rc.4"
tslib "^2.0.0" tslib "^2.0.0"
"@abp/ng.permission-management@~3.3.1": "@abp/ng.permission-management@~4.0.0-rc.4":
version "3.3.1" version "4.0.0-rc.4"
resolved "https://registry.yarnpkg.com/@abp/ng.permission-management/-/ng.permission-management-3.3.1.tgz#2870a517b00b266c064df0914f0c4227c83677d7" resolved "https://registry.yarnpkg.com/@abp/ng.permission-management/-/ng.permission-management-4.0.0-rc.4.tgz#3d838528549860e2a8b6aba2c5f35f6764089322"
integrity sha512-69h0MLXOOQ9Iav4drwg1P6dcA+tl7+Vgt34IGJW1o0Aj0pYBlqBZQqq8IOW2g/xVLRE8qkfRnmoyAGBQfbJkTA== integrity sha512-2o/1dtfNQOkqHWzdHyI8Ske5E5VseCM+N3erJu4NSLIWrj5G3CG9wwbJm3BqEjHG7hzbcvR6fYxKpDUmqvQR0A==
dependencies: dependencies:
"@abp/ng.theme.shared" "~3.3.1" "@abp/ng.theme.shared" "~4.0.0-rc.4"
tslib "^2.0.0" tslib "^2.0.0"
"@abp/ng.schematics@~3.3.1": "@abp/ng.schematics@~3.3.1":
@ -55,37 +54,37 @@
jsonc-parser "^2.3.0" jsonc-parser "^2.3.0"
typescript "~3.9.2" typescript "~3.9.2"
"@abp/ng.setting-management@~3.3.1": "@abp/ng.setting-management@~4.0.0-rc.4":
version "3.3.1" version "4.0.0-rc.4"
resolved "https://registry.yarnpkg.com/@abp/ng.setting-management/-/ng.setting-management-3.3.1.tgz#f89ed79ab5b6348a5bd57a8699ee6298279e30ec" resolved "https://registry.yarnpkg.com/@abp/ng.setting-management/-/ng.setting-management-4.0.0-rc.4.tgz#45e7fe04a8069da19d644860617e5b5aeab39281"
integrity sha512-TGIeAUemaKEFcC/HG6d9JEYOG9EIYTry1goAKJReI0CShrykZUM5WPHe3wK0CQIqgI6MChVSYeq4yC+oyl8JnQ== integrity sha512-L7liYuB+DdWdcdJwG4OkQhBdb1bNqFO08TjfbRdkPARHje/tat+z8jtZ58yQVYOVCs9M2vJt3ydHnvZ+PQWpow==
dependencies: dependencies:
"@abp/ng.theme.shared" "~3.3.1" "@abp/ng.theme.shared" "~4.0.0-rc.4"
tslib "^2.0.0" tslib "^2.0.0"
"@abp/ng.tenant-management@~3.3.1": "@abp/ng.tenant-management@~4.0.0-rc.4":
version "3.3.1" version "4.0.0-rc.4"
resolved "https://registry.yarnpkg.com/@abp/ng.tenant-management/-/ng.tenant-management-3.3.1.tgz#315fdc5980adddbc9d561fba15bed6c27d8203ec" resolved "https://registry.yarnpkg.com/@abp/ng.tenant-management/-/ng.tenant-management-4.0.0-rc.4.tgz#0978a65423b9f56df1fd58eaaa01fd912b2875ab"
integrity sha512-dehegHTe459UCc+45G0yL/ptGBk4xDk+Nl5DIRKDyf0k7l5HZstS5UrWwOAY8JO2SECUB5RjX33yvqt2/nxt4Q== integrity sha512-K7BCZMTs/nPoPrDo/yGu3IWZjXktZHcq0qg2pvjVZRqlfbgk0m+mih01H6WC+/tjKYfdb4PtWQJ36mGR17zvuQ==
dependencies: dependencies:
"@abp/ng.feature-management" "~3.3.1" "@abp/ng.feature-management" "~4.0.0-rc.4"
"@abp/ng.theme.shared" "~3.3.1" "@abp/ng.theme.shared" "~4.0.0-rc.4"
tslib "^2.0.0" tslib "^2.0.0"
"@abp/ng.theme.basic@~3.3.1": "@abp/ng.theme.basic@~4.0.0-rc.4":
version "3.3.1" version "4.0.0-rc.4"
resolved "https://registry.yarnpkg.com/@abp/ng.theme.basic/-/ng.theme.basic-3.3.1.tgz#e9d711c3d1895a481d15409f35e52608d71259fc" resolved "https://registry.yarnpkg.com/@abp/ng.theme.basic/-/ng.theme.basic-4.0.0-rc.4.tgz#438d73fed9962dae3d92b0d1f87f36e3601ab720"
integrity sha512-DcAdBQNdgpkEGhFHXClBJIfTOuG43AQkk6o4yzaglCkYKQDuJ4XRtbRdFQNb/we/OtdIFHQtxVLEeqrMTZYYcQ== integrity sha512-Gunzo6N1YoGZ3crLCYqflmvnuayekyV5Aa63dwCikOTloEBmfQy4FylAcUvncNo841BwmWOk7oDGmxQmrx+5bw==
dependencies: dependencies:
"@abp/ng.theme.shared" "~3.3.1" "@abp/ng.theme.shared" "~4.0.0-rc.4"
tslib "^2.0.0" tslib "^2.0.0"
"@abp/ng.theme.shared@~3.3.1": "@abp/ng.theme.shared@~4.0.0-rc.4":
version "3.3.1" version "4.0.0-rc.4"
resolved "https://registry.yarnpkg.com/@abp/ng.theme.shared/-/ng.theme.shared-3.3.1.tgz#694453546b4e4147a9f89058570dbbef81ef1196" resolved "https://registry.yarnpkg.com/@abp/ng.theme.shared/-/ng.theme.shared-4.0.0-rc.4.tgz#6341acbb647c8606c1147cad4387334a42908a2c"
integrity sha512-21wJPa/cNBU3OoLiact4w1sHnQpsm0R5JUD6pRCzp14EyPN3QgOY8JC+/YgGuasKY2xm5pvgbgIdTryy9j4IyQ== integrity sha512-r3V+PIJC9pCA1OD7xL6I+sJ0AFeF/wcjyUJvn7ZRvevK+eDkHf6AqTXRCNgd+VTfCqtjIpiU5oC7rSOB1gGwPw==
dependencies: dependencies:
"@abp/ng.core" "~3.3.1" "@abp/ng.core" "~4.0.0-rc.4"
"@fortawesome/fontawesome-free" "^5.14.0" "@fortawesome/fontawesome-free" "^5.14.0"
"@ng-bootstrap/ng-bootstrap" "^7.0.0" "@ng-bootstrap/ng-bootstrap" "^7.0.0"
"@ngx-validate/core" "^0.0.12" "@ngx-validate/core" "^0.0.12"
@ -94,10 +93,10 @@
chart.js "^2.9.3" chart.js "^2.9.3"
tslib "^2.0.0" tslib "^2.0.0"
"@abp/utils@^3.3.0": "@abp/utils@^4.0.0-rc.3":
version "3.3.1" version "4.0.0-rc.4"
resolved "https://registry.yarnpkg.com/@abp/utils/-/utils-3.3.1.tgz#f1759161ac8af10e57b50ac90538a24a51b64ebd" resolved "https://registry.yarnpkg.com/@abp/utils/-/utils-4.0.0-rc.4.tgz#99573069c7dac8751e3124e60511a11a169df565"
integrity sha512-XEYJYp94zDdln48P7X51wa4v1yg3Q+p0o2DdZxQbZxXChRkCwVC/B0uyMGPs75wkft6xiz965Xr7vcNvMo0nOA== integrity sha512-z1l6A07+rSgf7fzI/UTlZv1cJBiIUa0kpEvhcChe7mwlHB7oQ3SlGjZX37kzOqWcOusfMOANPuVulkZLSCOB/w==
dependencies: dependencies:
just-compare "^1.3.0" just-compare "^1.3.0"
@ -1291,13 +1290,6 @@
dependencies: dependencies:
tslib "^1.9.0" tslib "^1.9.0"
"@ngxs/storage-plugin@^3.7.0":
version "3.7.0"
resolved "https://registry.yarnpkg.com/@ngxs/storage-plugin/-/storage-plugin-3.7.0.tgz#3a0bc75f5dbba17a18e37b69cfde5d470cfceb45"
integrity sha512-j5rGYfhi1S+sAky956DIs+6AYP9FMBWL2Uz+omKBS/i42mjhyD26UfApORjwCOyW5PCb4Tq3B14ZPxyAaSi/OA==
dependencies:
tslib "^1.9.0"
"@ngxs/store@^3.7.0": "@ngxs/store@^3.7.0":
version "3.7.0" version "3.7.0"
resolved "https://registry.yarnpkg.com/@ngxs/store/-/store-3.7.0.tgz#e46387219dae610c685accc119ae42e351afcaa4" resolved "https://registry.yarnpkg.com/@ngxs/store/-/store-3.7.0.tgz#e46387219dae610c685accc119ae42e351afcaa4"

Loading…
Cancel
Save