Browse Source

update: some upgrade enhancements for the theme-shared

pull/25690/head
sumeyye 4 months ago
parent
commit
796a83ca86
  1. 3
      npm/ng-packs/packages/theme-shared/src/lib/components/breadcrumb-items/breadcrumb-items.component.ts
  2. 2
      npm/ng-packs/packages/theme-shared/src/lib/components/button/button.component.ts
  3. 3
      npm/ng-packs/packages/theme-shared/src/lib/components/card/card-body.component.ts
  4. 3
      npm/ng-packs/packages/theme-shared/src/lib/components/card/card-footer.component.ts
  5. 3
      npm/ng-packs/packages/theme-shared/src/lib/components/card/card-header.component.ts
  6. 3
      npm/ng-packs/packages/theme-shared/src/lib/components/card/card.component.ts
  7. 3
      npm/ng-packs/packages/theme-shared/src/lib/components/checkbox/checkbox.component.ts
  8. 3
      npm/ng-packs/packages/theme-shared/src/lib/components/confirmation/confirmation.component.ts
  9. 3
      npm/ng-packs/packages/theme-shared/src/lib/components/form-input/form-input.component.ts
  10. 7
      npm/ng-packs/packages/theme-shared/src/lib/components/http-error-wrapper/http-error-wrapper.component.ts
  11. 3
      npm/ng-packs/packages/theme-shared/src/lib/components/internet-connection-status/internet-connection-status.component.ts
  12. 45
      npm/ng-packs/packages/theme-shared/src/lib/components/loader-bar/loader-bar.component.ts
  13. 3
      npm/ng-packs/packages/theme-shared/src/lib/components/loading/loading.component.ts
  14. 7
      npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts
  15. 3
      npm/ng-packs/packages/theme-shared/src/lib/components/password/password.component.ts
  16. 3
      npm/ng-packs/packages/theme-shared/src/lib/components/spinner/spinner.component.ts
  17. 3
      npm/ng-packs/packages/theme-shared/src/lib/components/toast-container/toast-container.component.ts
  18. 3
      npm/ng-packs/packages/theme-shared/src/lib/components/toast/toast.component.ts

3
npm/ng-packs/packages/theme-shared/src/lib/components/breadcrumb-items/breadcrumb-items.component.ts

@ -1,9 +1,10 @@
import { Component, input } from '@angular/core'; import {Component, input, ChangeDetectionStrategy,} from '@angular/core';
import { NgTemplateOutlet } from '@angular/common'; import { NgTemplateOutlet } from '@angular/common';
import { RouterLink } from '@angular/router'; import { RouterLink } from '@angular/router';
import { ABP, AbpRouteCultureUrlPipe, LocalizationPipe } from '@abp/ng.core'; import { ABP, AbpRouteCultureUrlPipe, LocalizationPipe } from '@abp/ng.core';
@Component({ @Component({
changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'abp-breadcrumb-items', selector: 'abp-breadcrumb-items',
templateUrl: './breadcrumb-items.component.html', templateUrl: './breadcrumb-items.component.html',
imports: [NgTemplateOutlet, RouterLink, LocalizationPipe, AbpRouteCultureUrlPipe], imports: [NgTemplateOutlet, RouterLink, LocalizationPipe, AbpRouteCultureUrlPipe],

2
npm/ng-packs/packages/theme-shared/src/lib/components/button/button.component.ts

@ -10,10 +10,12 @@ import {
output, output,
signal, signal,
viewChild, viewChild,
ChangeDetectionStrategy,
} from '@angular/core'; } from '@angular/core';
import { ABP, StopPropagationDirective } from '@abp/ng.core'; import { ABP, StopPropagationDirective } from '@abp/ng.core';
@Component({ @Component({
changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'abp-button', selector: 'abp-button',
template: ` template: `
<button <button

3
npm/ng-packs/packages/theme-shared/src/lib/components/card/card-body.component.ts

@ -1,6 +1,7 @@
import { Component, HostBinding, input } from '@angular/core'; import { Component, HostBinding, input, ChangeDetectionStrategy } from '@angular/core';
@Component({ @Component({
changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'abp-card-body', selector: 'abp-card-body',
template: ` <div [class]="cardBodyClass()" [style]="cardBodyStyle()"> template: ` <div [class]="cardBodyClass()" [style]="cardBodyStyle()">
<ng-content></ng-content> <ng-content></ng-content>

3
npm/ng-packs/packages/theme-shared/src/lib/components/card/card-footer.component.ts

@ -1,6 +1,7 @@
import { Component, HostBinding, input } from '@angular/core'; import {Component, HostBinding, input, ChangeDetectionStrategy,} from '@angular/core';
@Component({ @Component({
changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'abp-card-footer', selector: 'abp-card-footer',
template: ` template: `
<div [style]="cardFooterStyle()" [class]="cardFooterClass()"> <div [style]="cardFooterStyle()" [class]="cardFooterClass()">

3
npm/ng-packs/packages/theme-shared/src/lib/components/card/card-header.component.ts

@ -1,6 +1,7 @@
import { Component, HostBinding, input } from '@angular/core'; import {Component, HostBinding, input, ChangeDetectionStrategy,} from '@angular/core';
@Component({ @Component({
changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'abp-card-header', selector: 'abp-card-header',
template: ` template: `
<div [class]="cardHeaderClass()" [style]="cardHeaderStyle()"> <div [class]="cardHeaderClass()" [style]="cardHeaderStyle()">

3
npm/ng-packs/packages/theme-shared/src/lib/components/card/card.component.ts

@ -1,6 +1,7 @@
import { Component, input } from '@angular/core'; import {Component, input, ChangeDetectionStrategy,} from '@angular/core';
@Component({ @Component({
changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'abp-card', selector: 'abp-card',
template: ` <div class="card" [class]="cardClass()" [style]="cardStyle()"> template: ` <div class="card" [class]="cardClass()" [style]="cardStyle()">
<ng-content></ng-content> <ng-content></ng-content>

3
npm/ng-packs/packages/theme-shared/src/lib/components/checkbox/checkbox.component.ts

@ -1,8 +1,9 @@
import { Component, forwardRef, input, output } from '@angular/core'; import {Component, forwardRef, input, output, ChangeDetectionStrategy,} from '@angular/core';
import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms'; import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
import { AbstractNgModelComponent, LocalizationPipe } from '@abp/ng.core'; import { AbstractNgModelComponent, LocalizationPipe } from '@abp/ng.core';
@Component({ @Component({
changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'abp-checkbox', selector: 'abp-checkbox',
template: ` template: `
<div class="mb-3"> <div class="mb-3">

3
npm/ng-packs/packages/theme-shared/src/lib/components/confirmation/confirmation.component.ts

@ -1,11 +1,12 @@
import { AsyncPipe } from '@angular/common'; import { AsyncPipe } from '@angular/common';
import { Component, inject } from '@angular/core'; import {Component, inject, ChangeDetectionStrategy,} from '@angular/core';
import { ReplaySubject } from 'rxjs'; import { ReplaySubject } from 'rxjs';
import { Confirmation } from '../../models/confirmation'; import { Confirmation } from '../../models/confirmation';
import { CONFIRMATION_ICONS, ConfirmationIcons } from '../../tokens/confirmation-icons.token'; import { CONFIRMATION_ICONS, ConfirmationIcons } from '../../tokens/confirmation-icons.token';
import { LocalizationPipe } from '@abp/ng.core'; import { LocalizationPipe } from '@abp/ng.core';
@Component({ @Component({
changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'abp-confirmation', selector: 'abp-confirmation',
templateUrl: './confirmation.component.html', templateUrl: './confirmation.component.html',
styleUrls: ['./confirmation.component.scss'], styleUrls: ['./confirmation.component.scss'],

3
npm/ng-packs/packages/theme-shared/src/lib/components/form-input/form-input.component.ts

@ -1,8 +1,9 @@
import { Component, forwardRef, input, output } from '@angular/core'; import {Component, forwardRef, input, output, ChangeDetectionStrategy,} from '@angular/core';
import { FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms'; import { FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
import { AbstractNgModelComponent, LocalizationPipe } from '@abp/ng.core'; import { AbstractNgModelComponent, LocalizationPipe } from '@abp/ng.core';
@Component({ @Component({
changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'abp-form-input', selector: 'abp-form-input',
template: ` template: `
<div class="mb-3"> <div class="mb-3">

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

@ -1,5 +1,4 @@
import { import {ApplicationRef,
ApplicationRef,
Component, Component,
inject, inject,
OnInit, OnInit,
@ -11,8 +10,7 @@ import {
createComponent, createComponent,
EnvironmentInjector, EnvironmentInjector,
DestroyRef, DestroyRef,
viewChild viewChild, ChangeDetectionStrategy,} from '@angular/core';
} from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { DOCUMENT } from '@angular/common'; import { DOCUMENT } from '@angular/common';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
@ -22,6 +20,7 @@ import { LocalizationParam, LocalizationPipe } from '@abp/ng.core';
import { ErrorScreenErrorCodes } from '../../models'; import { ErrorScreenErrorCodes } from '../../models';
@Component({ @Component({
changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'abp-http-error-wrapper', selector: 'abp-http-error-wrapper',
templateUrl: './http-error-wrapper.component.html', templateUrl: './http-error-wrapper.component.html',
styleUrls: ['http-error-wrapper.component.scss'], styleUrls: ['http-error-wrapper.component.scss'],

3
npm/ng-packs/packages/theme-shared/src/lib/components/internet-connection-status/internet-connection-status.component.ts

@ -1,8 +1,9 @@
import { Component, inject } from '@angular/core'; import {Component, inject, ChangeDetectionStrategy,} from '@angular/core';
import { InternetConnectionService, LocalizationPipe } from '@abp/ng.core'; import { InternetConnectionService, LocalizationPipe } from '@abp/ng.core';
import { NgbTooltip } from '@ng-bootstrap/ng-bootstrap'; import { NgbTooltip } from '@ng-bootstrap/ng-bootstrap';
@Component({ @Component({
changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'abp-internet-status', selector: 'abp-internet-status',
imports: [LocalizationPipe, NgbTooltip], imports: [LocalizationPipe, NgbTooltip],
template: ` template: `

45
npm/ng-packs/packages/theme-shared/src/lib/components/loader-bar/loader-bar.component.ts

@ -1,15 +1,25 @@
import { ChangeDetectorRef, Component, OnDestroy, OnInit, inject, input, effect, signal } from '@angular/core'; import {
ChangeDetectionStrategy,
Component,
effect,
inject,
input,
OnDestroy,
OnInit,
signal,
} from '@angular/core';
import { combineLatest, Subscription, timer } from 'rxjs'; import { combineLatest, Subscription, timer } from 'rxjs';
import { HttpWaitService, RouterWaitService, SubscriptionService } from '@abp/ng.core'; import { HttpWaitService, RouterWaitService, SubscriptionService } from '@abp/ng.core';
@Component({ @Component({
changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'abp-loader-bar', selector: 'abp-loader-bar',
template: ` template: `
<div id="abp-loader-bar" [class]="containerClass()" [class.is-loading]="isLoading()"> <div id="abp-loader-bar" [class]="containerClass()" [class.is-loading]="isLoading()">
<div <div
class="abp-progress" class="abp-progress"
[class.progressing]="progressLevel" [class.progressing]="progressLevel() > 0"
[style.width.vw]="progressLevel" [style.width.vw]="progressLevel()"
[style]="{ [style]="{
'background-color': color(), 'background-color': color(),
'box-shadow': boxShadow, 'box-shadow': boxShadow,
@ -22,7 +32,6 @@ import { HttpWaitService, RouterWaitService, SubscriptionService } from '@abp/ng
imports: [], imports: [],
}) })
export class LoaderBarComponent implements OnDestroy, OnInit { export class LoaderBarComponent implements OnDestroy, OnInit {
private cdRef = inject(ChangeDetectorRef);
private subscription = inject(SubscriptionService); private subscription = inject(SubscriptionService);
private httpWaitService = inject(HttpWaitService); private httpWaitService = inject(HttpWaitService);
private routerWaitService = inject(RouterWaitService); private routerWaitService = inject(RouterWaitService);
@ -32,8 +41,8 @@ export class LoaderBarComponent implements OnDestroy, OnInit {
readonly color = input('#77b6ff'); readonly color = input('#77b6ff');
protected readonly isLoading = signal(false); protected readonly isLoading = signal(false);
protected readonly progressLevel = signal(0);
progressLevel = 0;
interval = new Subscription(); interval = new Subscription();
timer = new Subscription(); timer = new Subscription();
intervalPeriod = 350; intervalPeriod = 350;
@ -41,28 +50,25 @@ export class LoaderBarComponent implements OnDestroy, OnInit {
constructor() { constructor() {
effect(() => { effect(() => {
const value = this.isLoadingInput(); this.isLoading.set(this.isLoadingInput());
this.isLoading.set(value);
this.cdRef.detectChanges();
}); });
} }
private readonly clearProgress = () => { private readonly clearProgress = () => {
this.progressLevel = 0; this.progressLevel.set(0);
this.cdRef.detectChanges();
}; };
private readonly reportProgress = () => { private readonly reportProgress = () => {
if (this.progressLevel < 75) { const current = this.progressLevel();
this.progressLevel += 1 + Math.random() * 9; if (current < 75) {
} else if (this.progressLevel < 90) { this.progressLevel.set(current + 1 + Math.random() * 9);
this.progressLevel += 0.4; } else if (current < 90) {
} else if (this.progressLevel < 100) { this.progressLevel.set(current + 0.4);
this.progressLevel += 0.1; } else if (current < 100) {
this.progressLevel.set(current + 0.1);
} else { } else {
this.interval.unsubscribe(); this.interval.unsubscribe();
} }
this.cdRef.detectChanges();
}; };
get boxShadow(): string { get boxShadow(): string {
@ -91,8 +97,7 @@ export class LoaderBarComponent implements OnDestroy, OnInit {
if (this.isLoading() || !this.interval.closed) return; if (this.isLoading() || !this.interval.closed) return;
this.isLoading.set(true); this.isLoading.set(true);
this.progressLevel = 0; this.progressLevel.set(0);
this.cdRef.detectChanges();
this.interval = timer(0, this.intervalPeriod).subscribe(this.reportProgress); this.interval = timer(0, this.intervalPeriod).subscribe(this.reportProgress);
this.timer.unsubscribe(); this.timer.unsubscribe();
} }
@ -100,7 +105,7 @@ export class LoaderBarComponent implements OnDestroy, OnInit {
stopLoading() { stopLoading() {
this.interval.unsubscribe(); this.interval.unsubscribe();
this.progressLevel = 100; this.progressLevel.set(100);
this.isLoading.set(false); this.isLoading.set(false);
if (!this.timer.closed) return; if (!this.timer.closed) return;

3
npm/ng-packs/packages/theme-shared/src/lib/components/loading/loading.component.ts

@ -1,6 +1,7 @@
import { Component, ViewEncapsulation } from '@angular/core'; import {Component, ViewEncapsulation, ChangeDetectionStrategy,} from '@angular/core';
@Component({ @Component({
changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'abp-loading', selector: 'abp-loading',
template: ` template: `
<div class="abp-loading"> <div class="abp-loading">

7
npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts

@ -1,5 +1,4 @@
import { import {Component,
Component,
DestroyRef, DestroyRef,
OnDestroy, OnDestroy,
OnInit, OnInit,
@ -10,8 +9,7 @@ import {
input, input,
model, model,
output, output,
viewChild, viewChild, ChangeDetectionStrategy,} from '@angular/core';
} from '@angular/core';
import { DOCUMENT, NgTemplateOutlet } from '@angular/common'; import { DOCUMENT, NgTemplateOutlet } from '@angular/common';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { SubscriptionService, uuid } from '@abp/ng.core'; import { SubscriptionService, uuid } from '@abp/ng.core';
@ -27,6 +25,7 @@ import { DismissableModal, ModalDismissMode, ModalRefService } from './modal-ref
export type ModalSize = 'sm' | 'md' | 'lg' | 'xl'; export type ModalSize = 'sm' | 'md' | 'lg' | 'xl';
@Component({ @Component({
changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'abp-modal', selector: 'abp-modal',
templateUrl: './modal.component.html', templateUrl: './modal.component.html',
styleUrls: ['./modal.component.scss'], styleUrls: ['./modal.component.scss'],

3
npm/ng-packs/packages/theme-shared/src/lib/components/password/password.component.ts

@ -1,4 +1,4 @@
import { Component, forwardRef, input } from '@angular/core'; import {Component, forwardRef, input, ChangeDetectionStrategy,} from '@angular/core';
import { FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms'; import { FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
import { AbstractNgModelComponent } from '@abp/ng.core'; import { AbstractNgModelComponent } from '@abp/ng.core';
@ -9,6 +9,7 @@ import { NgxValidateCoreModule } from '@ngx-validate/core';
* https://abp.io/docs/latest/framework/ui/angular/show-password-directive * https://abp.io/docs/latest/framework/ui/angular/show-password-directive
*/ */
@Component({ @Component({
changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'abp-password', selector: 'abp-password',
imports: [FormsModule, NgxValidateCoreModule], imports: [FormsModule, NgxValidateCoreModule],
templateUrl: `./password.component.html`, templateUrl: `./password.component.html`,

3
npm/ng-packs/packages/theme-shared/src/lib/components/spinner/spinner.component.ts

@ -1,6 +1,7 @@
import { Component } from '@angular/core'; import {Component, ChangeDetectionStrategy,} from '@angular/core';
@Component({ @Component({
changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'abp-spinner', selector: 'abp-spinner',
template: ` template: `
<div class="d-flex justify-content-center align-items-center border-top" style="height: 62px"> <div class="d-flex justify-content-center align-items-center border-top" style="height: 62px">

3
npm/ng-packs/packages/theme-shared/src/lib/components/toast-container/toast-container.component.ts

@ -1,8 +1,9 @@
import { Component, input, OnInit, signal, effect } from '@angular/core'; import {Component, input, OnInit, signal, effect, ChangeDetectionStrategy,} from '@angular/core';
import { Toaster } from '../../models/toaster'; import { Toaster } from '../../models/toaster';
import { ToastComponent } from '../toast/toast.component'; import { ToastComponent } from '../toast/toast.component';
@Component({ @Component({
changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'abp-toast-container', selector: 'abp-toast-container',
templateUrl: './toast-container.component.html', templateUrl: './toast-container.component.html',
styleUrls: ['./toast-container.component.scss'], styleUrls: ['./toast-container.component.scss'],

3
npm/ng-packs/packages/theme-shared/src/lib/components/toast/toast.component.ts

@ -1,8 +1,9 @@
import { Component, OnInit, input, output } from '@angular/core'; import {Component, OnInit, input, output, ChangeDetectionStrategy,} from '@angular/core';
import { Toaster } from '../../models/toaster'; import { Toaster } from '../../models/toaster';
import { LocalizationPipe } from '@abp/ng.core'; import { LocalizationPipe } from '@abp/ng.core';
@Component({ @Component({
changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'abp-toast', selector: 'abp-toast',
templateUrl: './toast.component.html', templateUrl: './toast.component.html',
styleUrls: ['./toast.component.scss'], styleUrls: ['./toast.component.scss'],

Loading…
Cancel
Save