Browse Source

Merge branch 'dev' into salihozkara/abpUnited

pull/19876/head
Salih 3 years ago
parent
commit
543848ce1e
  1. 1
      modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Pages/SettingManagement/EmailSettingGroup/EmailSettingGroupViewComponent.razor
  2. 36
      npm/ng-packs/packages/core/src/lib/services/router-events.service.ts
  3. 9
      npm/ng-packs/packages/theme-shared/src/lib/components/http-error-wrapper/http-error-wrapper.component.ts
  4. 2
      npm/ng-packs/packages/theme-shared/src/lib/directives/ngx-datatable-list.directive.ts

1
modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Pages/SettingManagement/EmailSettingGroup/EmailSettingGroupViewComponent.razor

@ -90,6 +90,7 @@
</Column> </Column>
</Row> </Row>
</Validations> </Validations>
<hr />
<Row> <Row>
<Column> <Column>
@if (HasSendTestEmailPermission) @if (HasSendTestEmailPermission)

36
npm/ng-packs/packages/core/src/lib/services/router-events.service.ts

@ -1,4 +1,4 @@
import { Injectable, Type } from '@angular/core'; import { Injectable, Type, inject, signal } from '@angular/core';
import { import {
NavigationCancel, NavigationCancel,
NavigationEnd, NavigationEnd,
@ -6,8 +6,10 @@ import {
NavigationStart, NavigationStart,
Router, Router,
RouterEvent, RouterEvent,
Event Event,
RouterState,
} from '@angular/router'; } from '@angular/router';
import { Observable } from 'rxjs';
import { filter } from 'rxjs/operators'; import { filter } from 'rxjs/operators';
export const NavigationEvent = { export const NavigationEvent = {
@ -19,12 +21,34 @@ export const NavigationEvent = {
@Injectable({ providedIn: 'root' }) @Injectable({ providedIn: 'root' })
export class RouterEvents { export class RouterEvents {
constructor(private router: Router) {} protected readonly router = inject(Router);
getEvents<T extends RouterEventConstructors>(...eventTypes: T) { readonly #previousNavigation = signal<string | undefined>(undefined);
previousNavigation = this.#previousNavigation.asReadonly();
readonly #currentNavigation = signal<string | undefined>(undefined);
currentNavigation = this.#currentNavigation.asReadonly();
constructor() {
this.listenToNavigation();
}
const filterRouterEvents = (event: Event) => protected listenToNavigation(): void {
eventTypes.some(type => event instanceof type); (
this.router.events.pipe(
filter(e => e instanceof NavigationEvent.End && !e.url.includes('error')),
) as Observable<NavigationEnd>
).subscribe(event => {
// It must be "NavigationTransition" but it is not exported in Angular
//https://github.com/angular/angular/blob/9c486c96827a9282cbdbff176761bc95554a260b/packages/router/src/navigation_transition.ts#L282
this.#previousNavigation.set(this.#currentNavigation());
this.#currentNavigation.set(event.url);
});
}
getEvents<T extends RouterEventConstructors>(...eventTypes: T) {
const filterRouterEvents = (event: Event) => eventTypes.some(type => event instanceof type);
return this.router.events.pipe(filter(filterRouterEvents)); return this.router.events.pipe(filter(filterRouterEvents));
} }

9
npm/ng-packs/packages/theme-shared/src/lib/components/http-error-wrapper/http-error-wrapper.component.ts

@ -72,6 +72,15 @@ export class HttpErrorWrapperComponent implements OnInit, AfterViewInit, OnDestr
}); });
customComponentRef.instance.errorStatus = this.status; customComponentRef.instance.errorStatus = this.status;
//In our custom "HttpErrorComponent", we have a "status" property.
//We used to have "errorStatus", but it wasn't signal type. "status" variable is signal type.
//I've checked because of backward compatibility. Developers might have their own custom HttpErrorComponent.
//We need to deprecated and remove "errorStatus" in the future.
if (customComponentRef.instance.status) {
customComponentRef.instance.status.set(this.status);
}
customComponentRef.instance.destroy$ = this.destroy$; customComponentRef.instance.destroy$ = this.destroy$;
this.appRef.attachView(customComponentRef.hostView); this.appRef.attachView(customComponentRef.hostView);

2
npm/ng-packs/packages/theme-shared/src/lib/directives/ngx-datatable-list.directive.ts

@ -102,7 +102,7 @@ export class NgxDatatableListDirective implements OnChanges, OnInit, DoCheck {
} }
protected refreshPageIfDataExist() { protected refreshPageIfDataExist() {
if (this.table.rows.length < 1 && this.table.count > 0) { if (this.table.rows?.length < 1 && this.table.count > 0) {
let maxPage = Math.floor(Number(this.table.count / this.list.maxResultCount)); let maxPage = Math.floor(Number(this.table.count / this.list.maxResultCount));
if (this.table.count < this.list.maxResultCount) { if (this.table.count < this.list.maxResultCount) {

Loading…
Cancel
Save