@quadrel-enterprise-ui/framework 20.27.3-beta.234.1 → 20.27.3-beta.241.1

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,9 +1,9 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { inject, ElementRef, Directive, InjectionToken, HostBinding, Input, ViewEncapsulation, Component, Injectable, Injector, HostListener, ChangeDetectionStrategy, ChangeDetectorRef, ViewChild, NgModule, EventEmitter, Output, Renderer2, Pipe, ViewContainerRef, NO_ERRORS_SCHEMA, DestroyRef, SecurityContext, NgZone, ViewChildren, forwardRef, ContentChildren, ContentChild, afterNextRender, isDevMode, QueryList, TemplateRef, CUSTOM_ELEMENTS_SCHEMA, provideAppInitializer } from '@angular/core';
3
- import { Dialog, DialogRef, DialogModule } from '@angular/cdk/dialog';
3
+ import { Dialog, DialogRef, DialogModule, DIALOG_DATA } from '@angular/cdk/dialog';
4
4
  import * as i1 from '@angular/common';
5
5
  import { CommonModule, NgFor, NgIf, NgClass, NgTemplateOutlet, AsyncPipe } from '@angular/common';
6
- import { BehaviorSubject, pairwise, from, switchMap, map as map$1, Subject, throwError, of, ReplaySubject, merge, fromEvent, isObservable, NEVER, Observable, EMPTY, shareReplay, Subscription, distinctUntilChanged as distinctUntilChanged$1, debounce, timer, startWith as startWith$1, debounceTime as debounceTime$1, takeUntil as takeUntil$1, firstValueFrom, combineLatest, concat, take as take$1, tap as tap$1, delay, first, scan, queueScheduler, filter as filter$1, concatMap as concatMap$1, exhaustMap, finalize, forkJoin, delayWhen, combineLatestWith, withLatestFrom as withLatestFrom$1, async } from 'rxjs';
6
+ import { BehaviorSubject, pairwise, Subject, throwError, of, ReplaySubject, merge, fromEvent, isObservable, NEVER, Observable, EMPTY, shareReplay, Subscription, distinctUntilChanged as distinctUntilChanged$1, debounce, timer, map as map$1, switchMap, startWith as startWith$1, debounceTime as debounceTime$1, takeUntil as takeUntil$1, firstValueFrom, combineLatest, concat, take as take$1, tap as tap$1, from, delay, first, scan, queueScheduler, filter as filter$1, concatMap as concatMap$1, exhaustMap, finalize, forkJoin, delayWhen, combineLatestWith, withLatestFrom as withLatestFrom$1, async } from 'rxjs';
7
7
  import { map, takeUntil, take, filter, catchError, debounceTime, startWith, distinctUntilChanged, concatMap, skip, tap, auditTime, withLatestFrom, observeOn, switchMap as switchMap$1, pairwise as pairwise$1, mergeMap, delay as delay$1 } from 'rxjs/operators';
8
8
  import { v4 } from 'uuid';
9
9
  import * as i3 from '@ngx-translate/core';
@@ -1161,58 +1161,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
1161
1161
  }]
1162
1162
  }] });
1163
1163
 
1164
- const GENERIC_DEFAULTS = {
1165
- title: { i18n: 'i18n.qd.dialog.confirm.title' },
1166
- confirm: { i18n: 'i18n.qd.dialog.confirm.proceed' },
1167
- cancel: { i18n: 'i18n.qd.dialog.action.cancel' }
1168
- };
1169
- const CANCEL_DEFAULTS = {
1170
- title: { i18n: 'i18n.qd.page.cancel.confirmation.dialog.title' },
1171
- message: { i18n: 'i18n.qd.page.cancel.confirmation.dialog.message' },
1172
- confirm: { i18n: 'i18n.qd.page.cancel.confirmation.dialog.proceed' },
1173
- cancel: { i18n: 'i18n.qd.page.cancel.confirmation.dialog.close' }
1174
- };
1175
- class QdConfirmationDialogOpenerService {
1176
- dialog = inject(Dialog);
1177
- showConfirmDialog(config, testId = 'dialog-confirm') {
1178
- const resolved = {
1179
- title: config.title ?? GENERIC_DEFAULTS.title,
1180
- message: config.message,
1181
- confirm: config.confirm ?? GENERIC_DEFAULTS.confirm,
1182
- cancel: config.cancel ?? GENERIC_DEFAULTS.cancel
1183
- };
1184
- return from(import('./quadrel-enterprise-ui-framework-dialog-confirm.module-BQLiEzSo.mjs').then(m => m.QdDialogConfirmComponent)).pipe(switchMap(component => {
1185
- const dialogRef = this.open(component, {
1186
- title: resolved.title,
1187
- dialogSize: QdDialogSize.Small,
1188
- data: { ...resolved, testId }
1189
- });
1190
- return dialogRef.closed.pipe(map$1(result => !!result));
1191
- }));
1192
- }
1193
- showDiscardConfirmDialog(message, testId = 'cancel-confirmation') {
1194
- return this.showConfirmDialog({
1195
- title: CANCEL_DEFAULTS.title,
1196
- message: message ?? CANCEL_DEFAULTS.message,
1197
- confirm: CANCEL_DEFAULTS.confirm,
1198
- cancel: CANCEL_DEFAULTS.cancel
1199
- }, testId);
1200
- }
1201
- open(component, config) {
1202
- config.panelClass = 'qd-custom-panel';
1203
- config.width = config.dialogSize || QdDialogSize.Default;
1204
- config.disableClose = true;
1205
- return this.dialog.open(component, config);
1206
- }
1207
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: QdConfirmationDialogOpenerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1208
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: QdConfirmationDialogOpenerService, providedIn: 'root' });
1209
- }
1210
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: QdConfirmationDialogOpenerService, decorators: [{
1211
- type: Injectable,
1212
- args: [{
1213
- providedIn: 'root'
1214
- }]
1215
- }] });
1164
+ /**
1165
+ * DI token that provides the discard-confirmation dialog opener.
1166
+ */
1167
+ const QD_DISCARD_CONFIRM_DIALOG_OPENER_TOKEN = new InjectionToken('QD_DISCARD_CONFIRM_DIALOG_OPENER_TOKEN');
1216
1168
 
1217
1169
  /**
1218
1170
  * Injection token for the host component of page dialogs with breadcrumbs.
@@ -1454,7 +1406,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
1454
1406
  * */
1455
1407
  class QdDialogComponent {
1456
1408
  dialogRef = inject(DialogRef);
1457
- dialog = inject(QdConfirmationDialogOpenerService);
1409
+ dialog = inject(QD_DISCARD_CONFIRM_DIALOG_OPENER_TOKEN);
1458
1410
  changeDetectorRef = inject(ChangeDetectorRef);
1459
1411
  dialogChangeGuard = inject(QdDialogChangeGuardService);
1460
1412
  dialogService = inject(QdDialogService);
@@ -11767,41 +11719,47 @@ class QdInputComponent {
11767
11719
  if (input?.validity?.badInput)
11768
11720
  return;
11769
11721
  const value = event.target.value;
11770
- if (this.inputType === 'number' && value && !this.numberInputService.isValidNumber(value)) {
11771
- this.control?.setErrors({
11772
- ...this.control.errors,
11773
- invalidCharacters: this.numberInputService.invalidCharactersErrorKey
11774
- });
11722
+ if (this.inputType === 'number' && value && !this.handleNumberInput(value))
11775
11723
  return;
11776
- }
11777
- if (this.inputType === 'number' && value) {
11778
- const valueWithoutGroups = value.split(this.numberInputService.groupSeparator).join('');
11779
- const filtered = this.numberInputService.filterValue(valueWithoutGroups);
11780
- const hasInvalidChars = filtered !== valueWithoutGroups;
11781
- if (hasInvalidChars) {
11782
- this._value = { ...this._value, value: filtered };
11783
- if (this.control) {
11784
- this.control.setErrors({
11785
- ...this.control.errors,
11786
- invalidCharacters: this.numberInputService.invalidCharactersErrorKey
11787
- });
11788
- }
11789
- this._isUserTyped = true;
11790
- this._onTouch();
11791
- this.emitValue();
11792
- return;
11793
- }
11794
- if (this.control?.errors?.['invalidCharacters']) {
11795
- const remainingErrors = Object.fromEntries(Object.entries(this.control.errors).filter(([key]) => key !== 'invalidCharacters'));
11796
- this.control.setErrors(Object.keys(remainingErrors).length ? remainingErrors : null);
11797
- }
11798
- }
11799
11724
  this._isUserTyped = true;
11800
11725
  this._value = { ...this._value, value };
11726
+ this._displayValue = String(value ?? '');
11801
11727
  this.loadOptionsForTypedValue(value);
11802
11728
  this.emitValue();
11803
11729
  this._onTouch();
11804
11730
  }
11731
+ handleNumberInput(value) {
11732
+ if (!this.numberInputService.isValidNumber(value)) {
11733
+ this.setInvalidCharactersError();
11734
+ return false;
11735
+ }
11736
+ const valueWithoutGroups = value.split(this.numberInputService.groupSeparator).join('');
11737
+ const filtered = this.numberInputService.filterValue(valueWithoutGroups);
11738
+ if (filtered !== valueWithoutGroups) {
11739
+ this._value = { ...this._value, value: filtered };
11740
+ this.setInvalidCharactersError();
11741
+ this._isUserTyped = true;
11742
+ this._onTouch();
11743
+ this.emitValue();
11744
+ return false;
11745
+ }
11746
+ this.clearInvalidCharactersError();
11747
+ return true;
11748
+ }
11749
+ setInvalidCharactersError() {
11750
+ if (!this.control)
11751
+ return;
11752
+ this.control.setErrors({
11753
+ ...this.control.errors,
11754
+ invalidCharacters: this.numberInputService.invalidCharactersErrorKey
11755
+ });
11756
+ }
11757
+ clearInvalidCharactersError() {
11758
+ if (!this.control?.errors?.['invalidCharacters'])
11759
+ return;
11760
+ const remainingErrors = Object.fromEntries(Object.entries(this.control.errors).filter(([key]) => key !== 'invalidCharacters'));
11761
+ this.control.setErrors(Object.keys(remainingErrors).length ? remainingErrors : null);
11762
+ }
11805
11763
  handleOptionSelected(option) {
11806
11764
  this._value = { ...this._value, value: option.i18n };
11807
11765
  this.popover?.close();
@@ -18818,6 +18776,69 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
18818
18776
  }]
18819
18777
  }] });
18820
18778
 
18779
+ /**
18780
+ * DI token that provides the component rendered inside the discard-confirmation
18781
+ * dialog.
18782
+ *
18783
+ * The dialog opener service opens this component through CDK `Dialog`. Binding
18784
+ * the component through a token instead of importing it directly keeps the
18785
+ * service free of the dialog module's import graph, so the discard dialog can be
18786
+ * bundled eagerly (no lazy chunk) without creating an import cycle.
18787
+ */
18788
+ const QD_DISCARD_CONFIRM_DIALOG_COMPONENT_TOKEN = new InjectionToken('QD_DISCARD_CONFIRM_DIALOG_COMPONENT_TOKEN');
18789
+
18790
+ const GENERIC_DEFAULTS = {
18791
+ title: { i18n: 'i18n.qd.dialog.confirm.title' },
18792
+ confirm: { i18n: 'i18n.qd.dialog.confirm.proceed' },
18793
+ cancel: { i18n: 'i18n.qd.dialog.action.cancel' }
18794
+ };
18795
+ const CANCEL_DEFAULTS = {
18796
+ title: { i18n: 'i18n.qd.page.cancel.confirmation.dialog.title' },
18797
+ message: { i18n: 'i18n.qd.page.cancel.confirmation.dialog.message' },
18798
+ confirm: { i18n: 'i18n.qd.page.cancel.confirmation.dialog.proceed' },
18799
+ cancel: { i18n: 'i18n.qd.page.cancel.confirmation.dialog.close' }
18800
+ };
18801
+ class QdConfirmationDialogOpenerService {
18802
+ dialog = inject(Dialog);
18803
+ confirmDialogComponent = inject(QD_DISCARD_CONFIRM_DIALOG_COMPONENT_TOKEN);
18804
+ showConfirmDialog(config, testId = 'dialog-confirm') {
18805
+ const resolved = {
18806
+ title: config.title ?? GENERIC_DEFAULTS.title,
18807
+ message: config.message,
18808
+ confirm: config.confirm ?? GENERIC_DEFAULTS.confirm,
18809
+ cancel: config.cancel ?? GENERIC_DEFAULTS.cancel
18810
+ };
18811
+ const dialogRef = this.open(this.confirmDialogComponent, {
18812
+ title: resolved.title,
18813
+ dialogSize: QdDialogSize.Small,
18814
+ data: { ...resolved, testId }
18815
+ });
18816
+ return dialogRef.closed.pipe(map$1(result => !!result));
18817
+ }
18818
+ showDiscardConfirmDialog(message, testId = 'cancel-confirmation') {
18819
+ return this.showConfirmDialog({
18820
+ title: CANCEL_DEFAULTS.title,
18821
+ message: message ?? CANCEL_DEFAULTS.message,
18822
+ confirm: CANCEL_DEFAULTS.confirm,
18823
+ cancel: CANCEL_DEFAULTS.cancel
18824
+ }, testId);
18825
+ }
18826
+ open(component, config) {
18827
+ config.panelClass = 'qd-custom-panel';
18828
+ config.width = config.dialogSize || QdDialogSize.Default;
18829
+ config.disableClose = true;
18830
+ return this.dialog.open(component, config);
18831
+ }
18832
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: QdConfirmationDialogOpenerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
18833
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: QdConfirmationDialogOpenerService, providedIn: 'root' });
18834
+ }
18835
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: QdConfirmationDialogOpenerService, decorators: [{
18836
+ type: Injectable,
18837
+ args: [{
18838
+ providedIn: 'root'
18839
+ }]
18840
+ }] });
18841
+
18821
18842
  class QdSpinnerComponent {
18822
18843
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: QdSpinnerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
18823
18844
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: QdSpinnerComponent, isStandalone: false, selector: "qd-spinner", ngImport: i0, template: "<svg\n version=\"1.1\"\n id=\"icon\"\n xmlns=\"http://www.w3.org/2000/svg\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 32 32\"\n style=\"enable-background: new 0 0 32 32\"\n xml:space=\"preserve\"\n class=\"spinner\"\n>\n <path\n class=\"stroke\"\n d=\"M31.9,14.6l-2.3,0.2c0,0.4,0.1,0.8,0.1,1.2c0,7.6-6.1,13.7-13.7,13.7c-3.8,0-7.2-1.5-9.7-4s-4-5.9-4-9.7\n\tC2.3,8.4,8.4,2.3,16,2.3c3.8,0,7.2,1.5,9.7,4l1.6-1.6C24.4,1.8,20.4,0,16,0C7.2,0,0,7.2,0,16c0,4.4,1.8,8.4,4.7,11.3S11.6,32,16,32\n\tc8.8,0,16-7.2,16-16C32,15.5,32,15.1,31.9,14.6z\"\n />\n</svg>\n", styles: [":host{display:block}.spinner{height:32px;animation:rotateSpinner .8s linear infinite}.stroke{fill:#069}@keyframes rotateSpinner{to{transform:rotate(360deg)}}\n"] });
@@ -19224,6 +19245,10 @@ class QdDialogModule {
19224
19245
  {
19225
19246
  provide: QD_PAGE_DIALOG_WITH_BREADCRUMBS_HOST,
19226
19247
  useValue: QdPageDialogWithBreadcrumbsComponent
19248
+ },
19249
+ {
19250
+ provide: QD_DISCARD_CONFIRM_DIALOG_OPENER_TOKEN,
19251
+ useExisting: QdConfirmationDialogOpenerService
19227
19252
  }
19228
19253
  ], imports: [CommonModule,
19229
19254
  TranslateModule,
@@ -19281,6 +19306,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
19281
19306
  {
19282
19307
  provide: QD_PAGE_DIALOG_WITH_BREADCRUMBS_HOST,
19283
19308
  useValue: QdPageDialogWithBreadcrumbsComponent
19309
+ },
19310
+ {
19311
+ provide: QD_DISCARD_CONFIRM_DIALOG_OPENER_TOKEN,
19312
+ useExisting: QdConfirmationDialogOpenerService
19284
19313
  }
19285
19314
  ]
19286
19315
  }]
@@ -34597,6 +34626,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
34597
34626
  }]
34598
34627
  }] });
34599
34628
 
34629
+ class QdDialogConfirmComponent {
34630
+ dialogRef = inject(DialogRef);
34631
+ data = inject(DIALOG_DATA);
34632
+ config = this.data;
34633
+ testId = this.data?.testId ?? 'dialog-confirm';
34634
+ close() {
34635
+ this.dialogRef.close(false);
34636
+ }
34637
+ confirm() {
34638
+ this.dialogRef.close(true);
34639
+ }
34640
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: QdDialogConfirmComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
34641
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: QdDialogConfirmComponent, isStandalone: true, selector: "qd-dialog-confirm", ngImport: i0, template: "<qd-dialog>\n <qd-text-section>\n <qd-text-section-paragraph>\n {{ config.message.i18n | translate }}\n </qd-text-section-paragraph>\n </qd-text-section>\n\n <qd-dialog-action>\n <button qdButton qdButtonGhost color=\"secondary\" (click)=\"close()\" [data-test-id]=\"testId + '-close'\">\n {{ config.cancel.i18n | translate }}\n </button>\n\n <button qdButton color=\"error\" (click)=\"confirm()\" [data-test-id]=\"testId + '-proceed'\">\n {{ config.confirm.i18n | translate }}\n </button>\n </qd-dialog-action>\n</qd-dialog>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: TranslateModule }, { kind: "ngmodule", type: QdButtonModule }, { kind: "component", type: QdButtonComponent, selector: "button[qdButton], a[qdButton], button[qd-button]", inputs: ["disabled", "color", "icon", "data-test-id", "additionalInfo"] }, { kind: "directive", type: QdButtonGhostDirective, selector: "button[qdButtonGhost], a[qdButtonGhost]" }, { kind: "ngmodule", type: QdTextSectionModule }, { kind: "component", type: QdTextSectionComponent, selector: "qd-text-section" }, { kind: "component", type: QdTextSectionParagraphComponent, selector: "qd-text-section-paragraph" }, { kind: "ngmodule", type: QdDialogModule }, { kind: "component", type: QdDialogActionComponent, selector: "qd-dialog-action" }, { kind: "component", type: QdDialogComponent, selector: "qd-dialog" }, { kind: "pipe", type: i3.TranslatePipe, name: "translate" }] });
34642
+ }
34643
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: QdDialogConfirmComponent, decorators: [{
34644
+ type: Component,
34645
+ args: [{ selector: 'qd-dialog-confirm', standalone: true, imports: [CommonModule, TranslateModule, QdButtonModule, QdTextSectionModule, QdDialogModule], template: "<qd-dialog>\n <qd-text-section>\n <qd-text-section-paragraph>\n {{ config.message.i18n | translate }}\n </qd-text-section-paragraph>\n </qd-text-section>\n\n <qd-dialog-action>\n <button qdButton qdButtonGhost color=\"secondary\" (click)=\"close()\" [data-test-id]=\"testId + '-close'\">\n {{ config.cancel.i18n | translate }}\n </button>\n\n <button qdButton color=\"error\" (click)=\"confirm()\" [data-test-id]=\"testId + '-proceed'\">\n {{ config.confirm.i18n | translate }}\n </button>\n </qd-dialog-action>\n</qd-dialog>\n" }]
34646
+ }] });
34647
+
34600
34648
  // @ts-strict-ignore
34601
34649
  /**
34602
34650
  * The **QdPageStep** is a single step inside the **QdPageStepper** within a **QdPage**.
@@ -35355,6 +35403,10 @@ class QdUiModule {
35355
35403
  provide: HTTP_INTERCEPTORS,
35356
35404
  useClass: QdNotificationsHttpInterceptorService,
35357
35405
  multi: true
35406
+ },
35407
+ {
35408
+ provide: QD_DISCARD_CONFIRM_DIALOG_COMPONENT_TOKEN,
35409
+ useValue: QdDialogConfirmComponent
35358
35410
  }
35359
35411
  ], imports: [QD_UI_MODULES, QdButtonModule,
35360
35412
  QdChipModule,
@@ -35398,6 +35450,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
35398
35450
  provide: HTTP_INTERCEPTORS,
35399
35451
  useClass: QdNotificationsHttpInterceptorService,
35400
35452
  multi: true
35453
+ },
35454
+ {
35455
+ provide: QD_DISCARD_CONFIRM_DIALOG_COMPONENT_TOKEN,
35456
+ useValue: QdDialogConfirmComponent
35401
35457
  }
35402
35458
  ]
35403
35459
  }]