@abp/ng.theme.shared 8.1.0-rc.3 → 8.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,20 +1,21 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, Component, Input, ChangeDetectionStrategy, EventEmitter, Output, ViewChild, InjectionToken, Inject, inject, ViewEncapsulation, Optional, ContentChild, Directive, HostListener, forwardRef, HostBinding, NgModule, Host, RendererFactory2, ComponentFactoryResolver, Injector, ApplicationRef, APP_INITIALIZER, LOCALE_ID } from '@angular/core';
2
+ import { Injectable, Component, Input, ChangeDetectionStrategy, EventEmitter, Output, ViewChild, InjectionToken, Inject, inject, DestroyRef, createComponent, ViewEncapsulation, Optional, ContentChild, Directive, HostListener, forwardRef, HostBinding, NgModule, ChangeDetectorRef, Host, RendererFactory2, Injector, EnvironmentInjector, ApplicationRef, APP_INITIALIZER, LOCALE_ID } from '@angular/core';
3
3
  import * as i1 from '@angular/common';
4
- import { formatDate, DOCUMENT, CommonModule, NgIf, DatePipe } from '@angular/common';
4
+ import { formatDate, DOCUMENT, CommonModule, DatePipe } from '@angular/common';
5
5
  import * as i3 from '@ng-bootstrap/ng-bootstrap';
6
- import { NgbDateAdapter, NgbTimeAdapter, NgbInputDatepickerConfig, NgbTypeaheadConfig, NgbDateParserFormatter, NgbPaginationModule } from '@ng-bootstrap/ng-bootstrap';
6
+ import { NgbDateAdapter, NgbTimeAdapter, NgbTooltip, NgbInputDatepickerConfig, NgbTypeaheadConfig, NgbDateParserFormatter, NgbPaginationModule } from '@ng-bootstrap/ng-bootstrap';
7
7
  import { animation, style, animate, keyframes, trigger, state, transition, useAnimation, query } from '@angular/animations';
8
8
  import * as i1$1 from '@angular/router';
9
- import { ResolveEnd } from '@angular/router';
9
+ import { Router, ResolveEnd } from '@angular/router';
10
10
  import * as i2 from '@abp/ng.core';
11
11
  import { getRoutePath, SubscriptionService, PROJECTION_STRATEGY, uuid, AbstractNgModelComponent, InternetConnectionService, LocalizationModule, LocalizationService, getLocaleDirection, DomInsertionService, CONTENT_STRATEGY, InternalStore, RouterEvents, AuthService, SessionStateService, HttpErrorReporterService, RoutesService, TENANT_NOT_FOUND_BY_NAME, CoreModule, noop, ConfigStateService } from '@abp/ng.core';
12
12
  import { startWith, map, debounceTime, filter, takeUntil, distinctUntilChanged, take, switchMap } from 'rxjs/operators';
13
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
13
14
  import { fromEvent, Subscription, combineLatest, timer, ReplaySubject, Subject, of, from, Observable, EMPTY, BehaviorSubject } from 'rxjs';
14
15
  import * as i2$1 from '@angular/forms';
15
16
  import { NG_VALUE_ACCESSOR, FormsModule, Validators } from '@angular/forms';
16
17
  import * as i1$2 from '@swimlane/ngx-datatable';
17
- import { ColumnMode, NgxDatatableModule } from '@swimlane/ngx-datatable';
18
+ import { ColumnMode, DatatableComponent, NgxDatatableModule } from '@swimlane/ngx-datatable';
18
19
  import { HttpErrorResponse } from '@angular/common/http';
19
20
  import { NgxValidateCoreModule, VALIDATION_BLUEPRINTS, VALIDATION_MAP_ERRORS_FN, defaultMapErrorsFn, VALIDATION_VALIDATE_ON_SUBMIT, normalizeDiacritics } from '@ngx-validate/core';
20
21
 
@@ -468,13 +469,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImpor
468
469
  }] }] });
469
470
 
470
471
  class HttpErrorWrapperComponent {
471
- get statusText() {
472
- return this.status ? `[${this.status}]` : '';
473
- }
474
- constructor(subscription) {
475
- this.subscription = subscription;
472
+ constructor() {
473
+ this.destroyRef = inject(DestroyRef);
476
474
  this.document = inject(DOCUMENT);
477
475
  this.window = this.document.defaultView;
476
+ this.router = inject(Router);
478
477
  this.status = 0;
479
478
  this.title = 'Oops!';
480
479
  this.details = 'Sorry, an error has occured.';
@@ -482,16 +481,27 @@ class HttpErrorWrapperComponent {
482
481
  this.hideCloseIcon = false;
483
482
  this.isHomeShow = true;
484
483
  }
484
+ get statusText() {
485
+ return this.status ? `[${this.status}]` : '';
486
+ }
485
487
  ngOnInit() {
486
- this.backgroundColor =
487
- this.window.getComputedStyle(this.document.body)?.getPropertyValue('background-color') || '#fff';
488
+ const computedStyle = this.window.getComputedStyle(this.document.body);
489
+ const backgroundColor = computedStyle?.getPropertyValue('background-color');
490
+ this.backgroundColor = backgroundColor || '#fff';
488
491
  }
489
492
  ngAfterViewInit() {
490
493
  if (this.customComponent) {
491
- const customComponentRef = this.cfRes
492
- .resolveComponentFactory(this.customComponent)
493
- .create(this.injector);
494
+ const customComponentRef = createComponent(this.customComponent, {
495
+ environmentInjector: this.environmentInjector,
496
+ });
494
497
  customComponentRef.instance.errorStatus = this.status;
498
+ //In our custom "HttpErrorComponent", we have a "status" property.
499
+ //We used to have "errorStatus", but it wasn't signal type. "status" variable is signal type.
500
+ //I've checked because of backward compatibility. Developers might have their own custom HttpErrorComponent.
501
+ //We need to deprecated and remove "errorStatus" in the future.
502
+ if (customComponentRef.instance.status) {
503
+ customComponentRef.instance.status.set(this.status);
504
+ }
495
505
  customComponentRef.instance.destroy$ = this.destroy$;
496
506
  this.appRef.attachView(customComponentRef.hostView);
497
507
  if (this.containerRef) {
@@ -499,23 +509,28 @@ class HttpErrorWrapperComponent {
499
509
  }
500
510
  customComponentRef.changeDetectorRef.detectChanges();
501
511
  }
502
- const keyup$ = fromEvent(this.document, 'keyup').pipe(debounceTime(150), filter((key) => key && key.key === 'Escape'));
503
- this.subscription.addOne(keyup$, () => this.destroy());
512
+ fromEvent(this.document, 'keyup')
513
+ .pipe(debounceTime(150), filter((key) => key && key.key === 'Escape'), takeUntilDestroyed(this.destroyRef))
514
+ .subscribe(() => this.destroy());
504
515
  }
505
- ngOnDestroy() {
516
+ goHome() {
517
+ this.router.navigateByUrl('/', { onSameUrlNavigation: 'reload' });
506
518
  this.destroy();
507
519
  }
508
520
  destroy() {
509
521
  this.destroy$.next();
510
522
  this.destroy$.complete();
511
523
  }
512
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: HttpErrorWrapperComponent, deps: [{ token: i2.SubscriptionService }], target: i0.ɵɵFactoryTarget.Component }); }
513
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.3", type: HttpErrorWrapperComponent, selector: "abp-http-error-wrapper", providers: [SubscriptionService], viewQueries: [{ propertyName: "containerRef", first: true, predicate: ["container"], descendants: true }], ngImport: i0, template: "<div\r\n #container\r\n id=\"abp-http-error-container\"\r\n class=\"error\"\r\n [style.backgroundColor]=\"backgroundColor\"\r\n>\r\n <button\r\n *ngIf=\"!hideCloseIcon\"\r\n id=\"abp-close-button\"\r\n type=\"button\"\r\n class=\"btn-close me-2\"\r\n (click)=\"destroy()\"\r\n ></button>\r\n\r\n <div *ngIf=\"!customComponent\" class=\"row centered\">\r\n <div class=\"col-md-12\">\r\n <div class=\"error-template\">\r\n <h1>{{ statusText }} {{ title | abpLocalization }}</h1>\r\n <div class=\"error-details\">\r\n {{ details | abpLocalization }}\r\n </div>\r\n <div class=\"error-actions\">\r\n <a\r\n *ngIf=\"isHomeShow\"\r\n (click)=\"destroy()\"\r\n routerLink=\"/\"\r\n class=\"btn btn-primary btn-md mt-2\"\r\n ><span class=\"glyphicon glyphicon-home\"></span>\r\n {{ { key: '::Menu:Home', defaultValue: 'Home' } | abpLocalization }}\r\n </a>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".error{position:fixed;top:0;width:100vw;height:100vh;z-index:999999}.centered{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%)}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "pipe", type: i2.LocalizationPipe, name: "abpLocalization" }] }); }
524
+ ngOnDestroy() {
525
+ this.destroy();
526
+ }
527
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: HttpErrorWrapperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
528
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.1.3", type: HttpErrorWrapperComponent, selector: "abp-http-error-wrapper", viewQueries: [{ propertyName: "containerRef", first: true, predicate: ["container"], descendants: true }], ngImport: i0, template: "<div\r\n #container\r\n id=\"abp-http-error-container\"\r\n class=\"error\"\r\n [style.backgroundColor]=\"backgroundColor\"\r\n>\r\n @if (!hideCloseIcon) {\r\n <button id=\"abp-close-button\" type=\"button\" class=\"btn-close me-2\" (click)=\"destroy()\"></button>\r\n }\r\n\r\n @if (!customComponent) {\r\n <div class=\"row centered\">\r\n <div class=\"col-md-12\">\r\n <div class=\"error-template\">\r\n <h1>{{ statusText }} {{ title | abpLocalization }}</h1>\r\n <div class=\"error-details\">\r\n {{ details | abpLocalization }}\r\n </div>\r\n <div class=\"error-actions\">\r\n @if (isHomeShow) {\r\n <a (click)=\"goHome()\" class=\"btn btn-primary btn-md mt-2\"\r\n ><span class=\"glyphicon glyphicon-home\"></span>\r\n {{ { key: '::Menu:Home', defaultValue: 'Home' } | abpLocalization }}\r\n </a>\r\n }\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n }\r\n</div>\r\n", styles: [".error{position:fixed;top:0;width:100vw;height:100vh;z-index:999999}.centered{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%)}\n"], dependencies: [{ kind: "pipe", type: i2.LocalizationPipe, name: "abpLocalization" }] }); }
514
529
  }
515
530
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: HttpErrorWrapperComponent, decorators: [{
516
531
  type: Component,
517
- args: [{ selector: 'abp-http-error-wrapper', providers: [SubscriptionService], template: "<div\r\n #container\r\n id=\"abp-http-error-container\"\r\n class=\"error\"\r\n [style.backgroundColor]=\"backgroundColor\"\r\n>\r\n <button\r\n *ngIf=\"!hideCloseIcon\"\r\n id=\"abp-close-button\"\r\n type=\"button\"\r\n class=\"btn-close me-2\"\r\n (click)=\"destroy()\"\r\n ></button>\r\n\r\n <div *ngIf=\"!customComponent\" class=\"row centered\">\r\n <div class=\"col-md-12\">\r\n <div class=\"error-template\">\r\n <h1>{{ statusText }} {{ title | abpLocalization }}</h1>\r\n <div class=\"error-details\">\r\n {{ details | abpLocalization }}\r\n </div>\r\n <div class=\"error-actions\">\r\n <a\r\n *ngIf=\"isHomeShow\"\r\n (click)=\"destroy()\"\r\n routerLink=\"/\"\r\n class=\"btn btn-primary btn-md mt-2\"\r\n ><span class=\"glyphicon glyphicon-home\"></span>\r\n {{ { key: '::Menu:Home', defaultValue: 'Home' } | abpLocalization }}\r\n </a>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".error{position:fixed;top:0;width:100vw;height:100vh;z-index:999999}.centered{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%)}\n"] }]
518
- }], ctorParameters: () => [{ type: i2.SubscriptionService }], propDecorators: { containerRef: [{
532
+ args: [{ selector: 'abp-http-error-wrapper', template: "<div\r\n #container\r\n id=\"abp-http-error-container\"\r\n class=\"error\"\r\n [style.backgroundColor]=\"backgroundColor\"\r\n>\r\n @if (!hideCloseIcon) {\r\n <button id=\"abp-close-button\" type=\"button\" class=\"btn-close me-2\" (click)=\"destroy()\"></button>\r\n }\r\n\r\n @if (!customComponent) {\r\n <div class=\"row centered\">\r\n <div class=\"col-md-12\">\r\n <div class=\"error-template\">\r\n <h1>{{ statusText }} {{ title | abpLocalization }}</h1>\r\n <div class=\"error-details\">\r\n {{ details | abpLocalization }}\r\n </div>\r\n <div class=\"error-actions\">\r\n @if (isHomeShow) {\r\n <a (click)=\"goHome()\" class=\"btn btn-primary btn-md mt-2\"\r\n ><span class=\"glyphicon glyphicon-home\"></span>\r\n {{ { key: '::Menu:Home', defaultValue: 'Home' } | abpLocalization }}\r\n </a>\r\n }\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n }\r\n</div>\r\n", styles: [".error{position:fixed;top:0;width:100vw;height:100vh;z-index:999999}.centered{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%)}\n"] }]
533
+ }], propDecorators: { containerRef: [{
519
534
  type: ViewChild,
520
535
  args: ['container', { static: false }]
521
536
  }] } });
@@ -1454,96 +1469,37 @@ class InternetConnectionStatusComponent {
1454
1469
  this.isOnline = this.internetConnectionService.networkStatus;
1455
1470
  }
1456
1471
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: InternetConnectionStatusComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1457
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.3", type: InternetConnectionStatusComponent, isStandalone: true, selector: "abp-internet-status", ngImport: i0, template: `
1458
- <div class="status-icon" *ngIf="!isOnline()">
1459
- <i data-toggle="tooltip" title="{{ 'AbpUi::InternetConnectionInfo' | abpLocalization }}" data-placement="left" class="fa fa-circle text-blinking blink">
1460
- </i>
1461
- </div>
1462
- `, isInline: true, styles: [".blink{animation:blinker .9s cubic-bezier(.5,0,1,1) infinite alternate}@keyframes blinker{0%{color:#c1c1c1}70%{color:#dc3545}to{color:#dc3545}}.text-blinking{font-size:1.2rem}.status-icon{position:fixed;z-index:999999;top:10px;right:10px}@media (width < 768px){.status-icon{top:26px;right:134px}}\n"], dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: LocalizationModule }, { kind: "pipe", type: i2.LocalizationPipe, name: "abpLocalization" }] }); }
1472
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.1.3", type: InternetConnectionStatusComponent, isStandalone: true, selector: "abp-internet-status", ngImport: i0, template: `
1473
+ @if (!isOnline()) {
1474
+ <div class="status-icon">
1475
+ <i
1476
+ ngbTooltip="{{ 'AbpUi::InternetConnectionInfo' | abpLocalization }}"
1477
+ container="body"
1478
+ placement="left-top"
1479
+ class="fa fa-wifi text-blinking blink"
1480
+ >
1481
+ </i>
1482
+ </div>
1483
+ }
1484
+ `, isInline: true, styles: [".blink{animation:blinker .9s cubic-bezier(.5,0,1,1) infinite alternate}@keyframes blinker{0%{color:#c1c1c1}70%{color:#fa2379}to{color:#fa2379}}.text-blinking{font-size:30px}.status-icon{position:fixed;z-index:999999;top:50%;left:50%;width:30px;text-align:center;margin-left:-15px;margin-top:-15px;translate:transform(-50%,-50%)}\n"], dependencies: [{ kind: "ngmodule", type: LocalizationModule }, { kind: "pipe", type: i2.LocalizationPipe, name: "abpLocalization" }, { kind: "directive", type: NgbTooltip, selector: "[ngbTooltip]", inputs: ["animation", "autoClose", "placement", "popperOptions", "triggers", "positionTarget", "container", "disableTooltip", "tooltipClass", "tooltipContext", "openDelay", "closeDelay", "ngbTooltip"], outputs: ["shown", "hidden"], exportAs: ["ngbTooltip"] }] }); }
1463
1485
  }
1464
1486
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: InternetConnectionStatusComponent, decorators: [{
1465
1487
  type: Component,
1466
- args: [{ selector: 'abp-internet-status', standalone: true, imports: [NgIf, LocalizationModule], template: `
1467
- <div class="status-icon" *ngIf="!isOnline()">
1468
- <i data-toggle="tooltip" title="{{ 'AbpUi::InternetConnectionInfo' | abpLocalization }}" data-placement="left" class="fa fa-circle text-blinking blink">
1469
- </i>
1470
- </div>
1471
- `, styles: [".blink{animation:blinker .9s cubic-bezier(.5,0,1,1) infinite alternate}@keyframes blinker{0%{color:#c1c1c1}70%{color:#dc3545}to{color:#dc3545}}.text-blinking{font-size:1.2rem}.status-icon{position:fixed;z-index:999999;top:10px;right:10px}@media (width < 768px){.status-icon{top:26px;right:134px}}\n"] }]
1488
+ args: [{ selector: 'abp-internet-status', standalone: true, imports: [LocalizationModule, NgbTooltip], template: `
1489
+ @if (!isOnline()) {
1490
+ <div class="status-icon">
1491
+ <i
1492
+ ngbTooltip="{{ 'AbpUi::InternetConnectionInfo' | abpLocalization }}"
1493
+ container="body"
1494
+ placement="left-top"
1495
+ class="fa fa-wifi text-blinking blink"
1496
+ >
1497
+ </i>
1498
+ </div>
1499
+ }
1500
+ `, styles: [".blink{animation:blinker .9s cubic-bezier(.5,0,1,1) infinite alternate}@keyframes blinker{0%{color:#c1c1c1}70%{color:#fa2379}to{color:#fa2379}}.text-blinking{font-size:30px}.status-icon{position:fixed;z-index:999999;top:50%;left:50%;width:30px;text-align:center;margin-left:-15px;margin-top:-15px;translate:transform(-50%,-50%)}\n"] }]
1472
1501
  }] });
1473
1502
 
1474
- const DEFAULT_VALIDATION_BLUEPRINTS = {
1475
- creditCard: 'AbpValidation::ThisFieldIsNotAValidCreditCardNumber.',
1476
- email: 'AbpValidation::ThisFieldIsNotAValidEmailAddress.',
1477
- invalid: 'AbpValidation::ThisFieldIsNotValid.',
1478
- max: 'AbpValidation::ThisFieldMustBeLessOrEqual{0}[{{ max }}]',
1479
- maxlength: 'AbpValidation::ThisFieldMustBeAStringOrArrayTypeWithAMaximumLengthOf{0}[{{ requiredLength }}]',
1480
- min: 'AbpValidation::ThisFieldMustBeGreaterThanOrEqual{0}[{{ min }}]',
1481
- minlength: 'AbpValidation::ThisFieldMustBeAStringOrArrayTypeWithAMinimumLengthOf{0}[{{ requiredLength }}]',
1482
- ngbDate: 'AbpValidation::ThisFieldIsNotValid.',
1483
- passwordMismatch: 'AbpIdentity::Volo.Abp.Identity:PasswordConfirmationFailed',
1484
- range: 'AbpValidation::ThisFieldMustBeBetween{0}And{1}[{{ min }},{{ max }}]',
1485
- required: 'AbpValidation::ThisFieldIsRequired.',
1486
- url: 'AbpValidation::ThisFieldIsNotAValidFullyQualifiedHttpHttpsOrFtpUrl',
1487
- passwordRequiresLower: 'AbpIdentity::Volo.Abp.Identity:PasswordRequiresLower',
1488
- passwordRequiresUpper: 'AbpIdentity::Volo.Abp.Identity:PasswordRequiresUpper',
1489
- passwordRequiresDigit: 'AbpIdentity::Volo.Abp.Identity:PasswordRequiresDigit',
1490
- passwordRequiresNonAlphanumeric: 'AbpIdentity::Volo.Abp.Identity:PasswordRequiresNonAlphanumeric',
1491
- usernamePattern: 'AbpIdentity::Volo.Abp.Identity:InvalidUserName[{{ actualValue }}]',
1492
- customMessage: '{{ customMessage }}'
1493
- };
1494
-
1495
- const DEFAULT_ERROR_MESSAGES = {
1496
- defaultError: {
1497
- title: 'An error has occurred!',
1498
- details: 'Error detail not sent by server.',
1499
- },
1500
- defaultError401: {
1501
- title: 'You are not authenticated!',
1502
- details: 'You should be authenticated (sign in) in order to perform this operation.',
1503
- },
1504
- defaultError403: {
1505
- title: 'You are not authorized!',
1506
- details: 'You are not allowed to perform this operation.',
1507
- },
1508
- defaultError404: {
1509
- title: 'Resource not found!',
1510
- details: 'The resource requested could not found on the server.',
1511
- },
1512
- defaultError500: {
1513
- title: 'Internal server error',
1514
- details: 'Error detail not sent by server.',
1515
- },
1516
- };
1517
- const DEFAULT_ERROR_LOCALIZATIONS = {
1518
- defaultError: {
1519
- title: 'AbpUi::DefaultErrorMessage',
1520
- details: 'AbpUi::DefaultErrorMessageDetail',
1521
- },
1522
- defaultError401: {
1523
- title: 'AbpUi::DefaultErrorMessage401',
1524
- details: 'AbpUi::DefaultErrorMessage401Detail',
1525
- },
1526
- defaultError403: {
1527
- title: 'AbpUi::DefaultErrorMessage403',
1528
- details: 'AbpUi::DefaultErrorMessage403Detail',
1529
- },
1530
- defaultError404: {
1531
- title: 'AbpUi::DefaultErrorMessage404',
1532
- details: 'AbpUi::DefaultErrorMessage404Detail',
1533
- },
1534
- defaultError500: {
1535
- title: 'AbpUi::500Message',
1536
- details: 'AbpUi::DefaultErrorMessage',
1537
- },
1538
- };
1539
- const CUSTOM_HTTP_ERROR_HANDLER_PRIORITY = Object.freeze({
1540
- veryLow: -99,
1541
- low: -9,
1542
- normal: 0,
1543
- high: 9,
1544
- veryHigh: 99,
1545
- });
1546
-
1547
1503
  class EllipsisDirective {
1548
1504
  get inlineClass() {
1549
1505
  return this.enabled && this.width;
@@ -1755,15 +1711,29 @@ const defaultNgxDatatableMessages = {
1755
1711
  const NGX_DATATABLE_MESSAGES = new InjectionToken('NGX_DATATABLE_MESSAGES');
1756
1712
 
1757
1713
  class NgxDatatableListDirective {
1758
- constructor(table, cdRef, localizationService, ngxDatatableMessages) {
1759
- this.table = table;
1760
- this.cdRef = cdRef;
1761
- this.localizationService = localizationService;
1762
- this.ngxDatatableMessages = ngxDatatableMessages;
1763
- this.subscription = new Subscription();
1764
- this.querySubscription = new Subscription();
1714
+ constructor() {
1715
+ this.table = inject(DatatableComponent);
1716
+ this.cdRef = inject(ChangeDetectorRef);
1717
+ this.destroyRef = inject(DestroyRef);
1718
+ this.localizationService = inject(LocalizationService);
1719
+ this.ngxDatatableMessages = inject(NGX_DATATABLE_MESSAGES, { optional: true });
1765
1720
  this.setInitialValues();
1766
1721
  }
1722
+ ngDoCheck() {
1723
+ this.refreshPageIfDataExist();
1724
+ }
1725
+ ngOnInit() {
1726
+ this.subscribeToPage();
1727
+ this.subscribeToSort();
1728
+ }
1729
+ ngOnChanges({ list }) {
1730
+ this.subscribeToQuery();
1731
+ if (!list.firstChange)
1732
+ return;
1733
+ const { maxResultCount, page } = list.currentValue;
1734
+ this.table.limit = maxResultCount;
1735
+ this.table.offset = page;
1736
+ }
1767
1737
  setInitialValues() {
1768
1738
  this.table.externalPaging = true;
1769
1739
  this.table.externalSorting = true;
@@ -1775,7 +1745,7 @@ class NgxDatatableListDirective {
1775
1745
  };
1776
1746
  }
1777
1747
  subscribeToSort() {
1778
- const sub = this.table.sort.subscribe(({ sorts: [{ prop, dir }] }) => {
1748
+ this.table.sort.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(({ sorts: [{ prop, dir }] }) => {
1779
1749
  if (prop === this.list.sortKey && this.list.sortOrder === 'desc') {
1780
1750
  this.list.sortKey = '';
1781
1751
  this.list.sortOrder = '';
@@ -1787,33 +1757,41 @@ class NgxDatatableListDirective {
1787
1757
  this.list.sortOrder = dir;
1788
1758
  }
1789
1759
  });
1790
- this.subscription.add(sub);
1760
+ }
1761
+ subscribeToPage() {
1762
+ this.table.page.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(({ offset }) => {
1763
+ this.setTablePage(offset);
1764
+ });
1791
1765
  }
1792
1766
  subscribeToQuery() {
1793
- if (!this.querySubscription.closed)
1794
- this.querySubscription.unsubscribe();
1795
- this.querySubscription = this.list.query$.subscribe(() => {
1767
+ this.list.query$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {
1796
1768
  const offset = this.list.page;
1797
1769
  if (this.table.offset !== offset)
1798
1770
  this.table.offset = offset;
1799
1771
  });
1800
1772
  }
1801
- ngOnChanges({ list }) {
1802
- this.subscribeToQuery();
1803
- if (!list.firstChange)
1804
- return;
1805
- const { maxResultCount, page } = list.currentValue;
1806
- this.table.limit = maxResultCount;
1807
- this.table.offset = page;
1808
- }
1809
- ngOnDestroy() {
1810
- this.subscription.unsubscribe();
1811
- this.querySubscription.unsubscribe();
1773
+ setTablePage(pageNum) {
1774
+ this.list.page = pageNum;
1775
+ this.table.offset = pageNum;
1812
1776
  }
1813
- ngOnInit() {
1814
- this.subscribeToSort();
1777
+ refreshPageIfDataExist() {
1778
+ if (this.table.rows?.length < 1 && this.table.count > 0) {
1779
+ let maxPage = Math.floor(Number(this.table.count / this.list.maxResultCount));
1780
+ if (this.table.count < this.list.maxResultCount) {
1781
+ this.setTablePage(0);
1782
+ return;
1783
+ }
1784
+ if (this.table.count % this.list.maxResultCount === 0) {
1785
+ maxPage -= 1;
1786
+ }
1787
+ if (this.list.page < maxPage) {
1788
+ this.setTablePage(this.list.page);
1789
+ return;
1790
+ }
1791
+ this.setTablePage(maxPage);
1792
+ }
1815
1793
  }
1816
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: NgxDatatableListDirective, deps: [{ token: i1$2.DatatableComponent }, { token: i0.ChangeDetectorRef }, { token: i2.LocalizationService }, { token: NGX_DATATABLE_MESSAGES, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
1794
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: NgxDatatableListDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1817
1795
  static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.1.3", type: NgxDatatableListDirective, isStandalone: true, selector: "ngx-datatable[list]", inputs: { list: "list" }, exportAs: ["ngxDatatableList"], usesOnChanges: true, ngImport: i0 }); }
1818
1796
  }
1819
1797
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: NgxDatatableListDirective, decorators: [{
@@ -1824,12 +1802,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImpor
1824
1802
  standalone: true,
1825
1803
  exportAs: 'ngxDatatableList',
1826
1804
  }]
1827
- }], ctorParameters: () => [{ type: i1$2.DatatableComponent }, { type: i0.ChangeDetectorRef }, { type: i2.LocalizationService }, { type: undefined, decorators: [{
1828
- type: Optional
1829
- }, {
1830
- type: Inject,
1831
- args: [NGX_DATATABLE_MESSAGES]
1832
- }] }], propDecorators: { list: [{
1805
+ }], ctorParameters: () => [], propDecorators: { list: [{
1833
1806
  type: Input
1834
1807
  }] } });
1835
1808
 
@@ -1958,6 +1931,70 @@ const HTTP_ERROR_CONFIG = new InjectionToken('HTTP_ERROR_CONFIG');
1958
1931
  const HTTP_ERROR_HANDLER = new InjectionToken('HTTP_ERROR_HANDLER');
1959
1932
  const CUSTOM_ERROR_HANDLERS = new InjectionToken('CUSTOM_ERROR_HANDLERS');
1960
1933
 
1934
+ const DEFAULT_ERROR_MESSAGES = {
1935
+ defaultError: {
1936
+ title: 'An error has occurred!',
1937
+ details: 'Error detail not sent by server.',
1938
+ },
1939
+ defaultError401: {
1940
+ title: 'You are not authenticated!',
1941
+ details: 'You should be authenticated (sign in) in order to perform this operation.',
1942
+ },
1943
+ defaultError403: {
1944
+ title: 'You are not authorized!',
1945
+ details: 'You are not allowed to perform this operation.',
1946
+ },
1947
+ defaultError404: {
1948
+ title: 'Resource not found!',
1949
+ details: 'The resource requested could not found on the server.',
1950
+ },
1951
+ defaultError500: {
1952
+ title: 'Internal server error',
1953
+ details: 'Error detail not sent by server.',
1954
+ },
1955
+ };
1956
+ const DEFAULT_ERROR_LOCALIZATIONS = {
1957
+ defaultError: {
1958
+ title: 'AbpUi::DefaultErrorMessage',
1959
+ details: 'AbpUi::DefaultErrorMessageDetail',
1960
+ },
1961
+ defaultError401: {
1962
+ title: 'AbpUi::DefaultErrorMessage401',
1963
+ details: 'AbpUi::DefaultErrorMessage401Detail',
1964
+ },
1965
+ defaultError403: {
1966
+ title: 'AbpUi::DefaultErrorMessage403',
1967
+ details: 'AbpUi::DefaultErrorMessage403Detail',
1968
+ },
1969
+ defaultError404: {
1970
+ title: 'AbpUi::DefaultErrorMessage404',
1971
+ details: 'AbpUi::DefaultErrorMessage404Detail',
1972
+ },
1973
+ defaultError500: {
1974
+ title: 'AbpUi::500Message',
1975
+ details: 'AbpUi::DefaultErrorMessage',
1976
+ },
1977
+ };
1978
+ const CUSTOM_HTTP_ERROR_HANDLER_PRIORITY = Object.freeze({
1979
+ veryLow: -99,
1980
+ low: -9,
1981
+ normal: 0,
1982
+ high: 9,
1983
+ veryHigh: 99,
1984
+ });
1985
+ const HTTP_ERROR_STATUS = {
1986
+ '401': 'AbpUi::401Message',
1987
+ '403': 'AbpUi::403Message',
1988
+ '404': 'AbpUi::404Message',
1989
+ '500': 'AbpUi::500Message',
1990
+ };
1991
+ const HTTP_ERROR_DETAIL = {
1992
+ '401': 'AbpUi::DefaultErrorMessage401Detail',
1993
+ '403': 'AbpUi::DefaultErrorMessage403Detail',
1994
+ '404': 'AbpUi::DefaultErrorMessage404Detail',
1995
+ '500': 'AbpUi::DefaultErrorMessage',
1996
+ };
1997
+
1961
1998
  var styles = `
1962
1999
  .is-invalid .form-control {
1963
2000
  border-color: #dc3545;
@@ -2363,9 +2400,9 @@ class CreateErrorComponentService {
2363
2400
  constructor() {
2364
2401
  this.document = inject(DOCUMENT);
2365
2402
  this.rendererFactory = inject(RendererFactory2);
2366
- this.cfRes = inject(ComponentFactoryResolver);
2367
2403
  this.routerEvents = inject(RouterEvents);
2368
2404
  this.injector = inject(Injector);
2405
+ this.envInjector = inject(EnvironmentInjector);
2369
2406
  this.httpErrorConfig = inject(HTTP_ERROR_CONFIG);
2370
2407
  this.componentRef = null;
2371
2408
  this.listenToRouterDataResolved();
@@ -2396,9 +2433,9 @@ class CreateErrorComponentService {
2396
2433
  const renderer = this.rendererFactory.createRenderer(null, null);
2397
2434
  const hostElement = this.getErrorHostElement();
2398
2435
  const host = renderer.selectRootElement(hostElement, true);
2399
- this.componentRef = this.cfRes
2400
- .resolveComponentFactory(HttpErrorWrapperComponent)
2401
- .create(this.injector);
2436
+ this.componentRef = createComponent(HttpErrorWrapperComponent, {
2437
+ environmentInjector: this.envInjector,
2438
+ });
2402
2439
  for (const key in instance) {
2403
2440
  /* istanbul ignore else */
2404
2441
  if (Object.prototype.hasOwnProperty.call(this.componentRef.instance, key)) {
@@ -2408,9 +2445,8 @@ class CreateErrorComponentService {
2408
2445
  this.componentRef.instance.hideCloseIcon = this.isCloseIconHidden();
2409
2446
  const appRef = this.injector.get(ApplicationRef);
2410
2447
  if (this.canCreateCustomError(instance.status)) {
2411
- this.componentRef.instance.cfRes = this.cfRes;
2412
2448
  this.componentRef.instance.appRef = appRef;
2413
- this.componentRef.instance.injector = this.injector;
2449
+ this.componentRef.instance.environmentInjector = this.envInjector;
2414
2450
  this.componentRef.instance.customComponent = this.httpErrorConfig.errorScreen?.component;
2415
2451
  }
2416
2452
  appRef.attachView(this.componentRef.hostView);
@@ -2804,6 +2840,27 @@ const DEFAULT_HANDLERS_PROVIDERS = [
2804
2840
  },
2805
2841
  ];
2806
2842
 
2843
+ const DEFAULT_VALIDATION_BLUEPRINTS = {
2844
+ creditCard: 'AbpValidation::ThisFieldIsNotAValidCreditCardNumber.',
2845
+ email: 'AbpValidation::ThisFieldIsNotAValidEmailAddress.',
2846
+ invalid: 'AbpValidation::ThisFieldIsNotValid.',
2847
+ max: 'AbpValidation::ThisFieldMustBeLessOrEqual{0}[{{ max }}]',
2848
+ maxlength: 'AbpValidation::ThisFieldMustBeAStringOrArrayTypeWithAMaximumLengthOf{0}[{{ requiredLength }}]',
2849
+ min: 'AbpValidation::ThisFieldMustBeGreaterThanOrEqual{0}[{{ min }}]',
2850
+ minlength: 'AbpValidation::ThisFieldMustBeAStringOrArrayTypeWithAMinimumLengthOf{0}[{{ requiredLength }}]',
2851
+ ngbDate: 'AbpValidation::ThisFieldIsNotValid.',
2852
+ passwordMismatch: 'AbpIdentity::Volo.Abp.Identity:PasswordConfirmationFailed',
2853
+ range: 'AbpValidation::ThisFieldMustBeBetween{0}And{1}[{{ min }},{{ max }}]',
2854
+ required: 'AbpValidation::ThisFieldIsRequired.',
2855
+ url: 'AbpValidation::ThisFieldIsNotAValidFullyQualifiedHttpHttpsOrFtpUrl',
2856
+ passwordRequiresLower: 'AbpIdentity::Volo.Abp.Identity:PasswordRequiresLower',
2857
+ passwordRequiresUpper: 'AbpIdentity::Volo.Abp.Identity:PasswordRequiresUpper',
2858
+ passwordRequiresDigit: 'AbpIdentity::Volo.Abp.Identity:PasswordRequiresDigit',
2859
+ passwordRequiresNonAlphanumeric: 'AbpIdentity::Volo.Abp.Identity:PasswordRequiresNonAlphanumeric',
2860
+ usernamePattern: 'AbpIdentity::Volo.Abp.Identity:InvalidUserName[{{ actualValue }}]',
2861
+ customMessage: '{{ customMessage }}'
2862
+ };
2863
+
2807
2864
  function isNumber(value) {
2808
2865
  return !isNaN(toInteger(value));
2809
2866
  }
@@ -3079,6 +3136,8 @@ function validatePassword(shouldContain) {
3079
3136
  };
3080
3137
  }
3081
3138
 
3139
+ var scripts = '';
3140
+
3082
3141
  /*
3083
3142
  * Public API Surface of theme-shared
3084
3143
  */
@@ -3087,5 +3146,5 @@ function validatePassword(shouldContain) {
3087
3146
  * Generated bundle index. Do not edit.
3088
3147
  */
3089
3148
 
3090
- export { AbpFormatErrorHandlerService, AbpVisibleDirective, BaseThemeSharedModule, BreadcrumbComponent, BreadcrumbItemsComponent, ButtonComponent, CUSTOM_ERROR_HANDLERS, CUSTOM_HTTP_ERROR_HANDLER_PRIORITY, CardBodyComponent, CardComponent, CardFooterComponent, CardHeaderComponent, CardHeaderDirective, CardImgTopDirective, CardModule, CardSubtitleDirective, CardTitleDirective, Confirmation, ConfirmationComponent, ConfirmationService, CreateErrorComponentService, DEFAULT_ERROR_LOCALIZATIONS, DEFAULT_ERROR_MESSAGES, DEFAULT_HANDLERS_PROVIDERS, DEFAULT_VALIDATION_BLUEPRINTS, DateAdapter, DateParserFormatter, DateTimeAdapter, DisabledDirective, DocumentDirHandlerService, EllipsisDirective, ErrorHandler, FormCheckboxComponent, FormInputComponent, HTTP_ERROR_CONFIG, HTTP_ERROR_HANDLER, HttpErrorWrapperComponent, InternetConnectionStatusComponent, LoaderBarComponent, LoadingComponent, LoadingDirective, ModalCloseDirective, ModalComponent, ModalRefService, NGX_DATATABLE_MESSAGES, NG_BOOTSTRAP_CONFIG_PROVIDERS, NavItem, NavItemsService, NgxDatatableDefaultDirective, NgxDatatableListDirective, PageAlertService, PasswordComponent, RouterErrorHandlerService, SUPPRESS_UNSAVED_CHANGES_WARNING, StatusCodeErrorHandlerService, THEME_SHARED_APPEND_CONTENT, THEME_SHARED_ROUTE_PROVIDERS, TenantResolveErrorHandlerService, ThemeSharedModule, TimeAdapter, ToastComponent, ToastContainerComponent, ToasterService, UnknownStatusCodeErrorHandlerService, UserMenu, UserMenuService, bounceIn, collapse, collapseLinearWithMargin, collapseWithMargin, collapseX, collapseY, collapseYWithMargin, configureNgBootstrap, configureRoutes, defaultNgxDatatableMessages, dialogAnimation, eFormComponets, expandX, expandY, expandYWithMargin, fadeAnimation, fadeIn, fadeInDown, fadeInLeft, fadeInRight, fadeInUp, fadeOut, fadeOutDown, fadeOutLeft, fadeOutRight, fadeOutUp, getErrorFromRequestBody, getPasswordValidators, slideFromBottom, tenantNotFoundProvider, toastInOut, validatePassword };
3149
+ export { AbpFormatErrorHandlerService, AbpVisibleDirective, BaseThemeSharedModule, BreadcrumbComponent, BreadcrumbItemsComponent, ButtonComponent, CUSTOM_ERROR_HANDLERS, CUSTOM_HTTP_ERROR_HANDLER_PRIORITY, CardBodyComponent, CardComponent, CardFooterComponent, CardHeaderComponent, CardHeaderDirective, CardImgTopDirective, CardModule, CardSubtitleDirective, CardTitleDirective, Confirmation, ConfirmationComponent, ConfirmationService, CreateErrorComponentService, DEFAULT_ERROR_LOCALIZATIONS, DEFAULT_ERROR_MESSAGES, DEFAULT_HANDLERS_PROVIDERS, DEFAULT_VALIDATION_BLUEPRINTS, DateAdapter, DateParserFormatter, DateTimeAdapter, DisabledDirective, DocumentDirHandlerService, EllipsisDirective, ErrorHandler, FormCheckboxComponent, FormInputComponent, HTTP_ERROR_CONFIG, HTTP_ERROR_DETAIL, HTTP_ERROR_HANDLER, HTTP_ERROR_STATUS, HttpErrorWrapperComponent, InternetConnectionStatusComponent, LoaderBarComponent, LoadingComponent, LoadingDirective, ModalCloseDirective, ModalComponent, ModalRefService, NGX_DATATABLE_MESSAGES, NG_BOOTSTRAP_CONFIG_PROVIDERS, NavItem, NavItemsService, NgxDatatableDefaultDirective, NgxDatatableListDirective, PageAlertService, PasswordComponent, RouterErrorHandlerService, SUPPRESS_UNSAVED_CHANGES_WARNING, StatusCodeErrorHandlerService, THEME_SHARED_APPEND_CONTENT, THEME_SHARED_ROUTE_PROVIDERS, TenantResolveErrorHandlerService, ThemeSharedModule, TimeAdapter, ToastComponent, ToastContainerComponent, ToasterService, UnknownStatusCodeErrorHandlerService, UserMenu, UserMenuService, bounceIn, collapse, collapseLinearWithMargin, collapseWithMargin, collapseX, collapseY, collapseYWithMargin, configureNgBootstrap, configureRoutes, defaultNgxDatatableMessages, dialogAnimation, eFormComponets, expandX, expandY, expandYWithMargin, fadeAnimation, fadeIn, fadeInDown, fadeInLeft, fadeInRight, fadeInUp, fadeOut, fadeOutDown, fadeOutLeft, fadeOutRight, fadeOutUp, getErrorFromRequestBody, getPasswordValidators, slideFromBottom, tenantNotFoundProvider, toastInOut, validatePassword };
3091
3150
  //# sourceMappingURL=abp-ng.theme.shared.mjs.map