@paperless/angular 3.6.1 → 3.6.3

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,8 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, EventEmitter, ViewChild, Output, Input, ChangeDetectionStrategy, HostListener, Directive, Self, signal, effect, inject, Injector, TemplateRef, Injectable, NgModule, HostBinding, ContentChild, Host, ElementRef, ContentChildren, ViewChildren, Pipe, provideAppInitializer } from '@angular/core';
3
- import * as i1 from '@angular/forms';
4
- import { FormControl, FormGroup, FormArray, NG_VALUE_ACCESSOR, NumberValueAccessor } from '@angular/forms';
5
- import { BehaviorSubject, filter, Subject, timer, fromEvent, distinctUntilChanged, debounceTime, take, map as map$1 } from 'rxjs';
2
+ import { Component, input, output, viewChild, signal, effect, ChangeDetectionStrategy, inject, ElementRef, HostListener, Directive, Injector, TemplateRef, Injectable, NgModule, HostBinding, Input, ContentChild, EventEmitter, Output, ContentChildren, ViewChild, ViewChildren, NgZone, Pipe, provideAppInitializer } from '@angular/core';
3
+ import { FormControl, FormGroup, FormArray, NG_VALUE_ACCESSOR, NumberValueAccessor, NgControl } from '@angular/forms';
4
+ import { filter, Subject, timer, fromEvent, BehaviorSubject, distinctUntilChanged, debounceTime, take, map as map$1 } from 'rxjs';
6
5
  import { ObserversModule } from '@angular/cdk/observers';
7
6
  import { Overlay, OverlayConfig, createOverlayRef, OverlayModule as OverlayModule$1 } from '@angular/cdk/overlay';
8
7
  import { PlatformModule } from '@angular/cdk/platform';
@@ -11,8 +10,7 @@ import { __decorate } from 'tslib';
11
10
  import { untilDestroyed, UntilDestroy } from '@ngneat/until-destroy';
12
11
  import { startWith, tap, pairwise, map, filter as filter$1, debounce } from 'rxjs/operators';
13
12
  import { PAGINATION_DEFAULT_PAGE_SIZE, cn, getTableCellColumnClasses, objectGetByPath, state, isMobile, floatingMenuContainerClass, onStateChange, TABLE_COLUMN_SIZES, SELECT_DEFAULT_MAX_DISPLAYED_ITEMS } from '@paperless/core';
14
- import * as i1$1 from '@angular/common';
15
- import { NgTemplateOutlet, AsyncPipe, CommonModule, DatePipe, CurrencyPipe } from '@angular/common';
13
+ import { NgTemplateOutlet, AsyncPipe, CommonModule, CurrencyPipe, DatePipe } from '@angular/common';
16
14
  import { defineCustomElement as defineCustomElement$1 } from '@paperless/core/components/p-accordion.js';
17
15
  import { defineCustomElement as defineCustomElement$2 } from '@paperless/core/components/p-attachment.js';
18
16
  import { defineCustomElement as defineCustomElement$3 } from '@paperless/core/components/p-avatar.js';
@@ -89,7 +87,7 @@ import { defineCustomElement as defineCustomElement$19 } from '@paperless/core/c
89
87
  import { RouterLink, RouterModule } from '@angular/router';
90
88
  import { v4 } from 'uuid';
91
89
  import { defineCustomElements } from '@paperless/core/loader';
92
- import * as i1$2 from '@angular/platform-browser';
90
+ import { DomSanitizer } from '@angular/platform-browser';
93
91
 
94
92
  class BaseFormComponent {
95
93
  markedDirty = false;
@@ -192,75 +190,67 @@ class BaseFormComponent {
192
190
  this.markedDirty = false;
193
191
  }
194
192
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: BaseFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
195
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.0", type: BaseFormComponent, isStandalone: false, selector: "ng-component", ngImport: i0, template: ``, isInline: true });
193
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.0", type: BaseFormComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: ``, isInline: true });
196
194
  }
197
195
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: BaseFormComponent, decorators: [{
198
196
  type: Component,
199
197
  args: [{
200
198
  template: ``,
201
- standalone: false,
202
199
  }]
203
200
  }] });
204
201
 
205
202
  class BaseUploadComponent {
206
- fileId;
207
- uploaded = false;
208
- set loading(value) {
209
- this.loading$.next(value);
210
- }
203
+ fileId = input(...(ngDevMode ? [undefined, { debugName: "fileId" }] : []));
204
+ uploaded = input(false, ...(ngDevMode ? [{ debugName: "uploaded" }] : []));
205
+ loading = input(false, ...(ngDevMode ? [{ debugName: "loading" }] : []));
211
206
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
212
- fileChange = new EventEmitter();
213
- uploaderInput;
207
+ fileChange = output();
208
+ uploaderInput = viewChild('uploaderInput', ...(ngDevMode ? [{ debugName: "uploaderInput" }] : []));
209
+ loadingParsed = signal(false, ...(ngDevMode ? [{ debugName: "loadingParsed" }] : []));
214
210
  file;
215
- loading$ = new BehaviorSubject(false);
211
+ constructor() {
212
+ effect(() => {
213
+ const loading = this.loading();
214
+ this.loadingParsed.set(loading);
215
+ });
216
+ }
216
217
  onChange($event) {
217
218
  const target = $event.target;
218
219
  const file = target.files?.[0];
219
220
  if (file) {
220
- this.loading$.next(true);
221
+ this.loadingParsed.set(true);
221
222
  const reader = new FileReader();
222
223
  reader.addEventListener('load', _ => this.onLoad(file, reader.result));
223
224
  reader.readAsDataURL(file);
224
225
  }
225
226
  }
226
227
  onLoad(file, result) {
227
- this.fileChange.next({
228
- fileId: this.fileId,
228
+ this.fileChange.emit({
229
+ fileId: this.fileId(),
229
230
  result,
230
231
  file,
231
232
  });
232
- if (this.uploaderInput?.nativeElement) {
233
- this.uploaderInput.nativeElement.value = '';
233
+ const uploaderInput = this.uploaderInput();
234
+ if (uploaderInput?.nativeElement) {
235
+ uploaderInput.nativeElement.value = '';
234
236
  }
235
237
  this.file = file;
236
- this.loading$.next(false);
238
+ this.loadingParsed.set(false);
237
239
  }
238
240
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: BaseUploadComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
239
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.0", type: BaseUploadComponent, isStandalone: false, selector: "ng-component", inputs: { fileId: "fileId", uploaded: "uploaded", loading: "loading" }, outputs: { fileChange: "fileChange" }, viewQueries: [{ propertyName: "uploaderInput", first: true, predicate: ["uploaderInput"], descendants: true }], ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
241
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.1.0", type: BaseUploadComponent, isStandalone: true, selector: "ng-component", inputs: { fileId: { classPropertyName: "fileId", publicName: "fileId", isSignal: true, isRequired: false, transformFunction: null }, uploaded: { classPropertyName: "uploaded", publicName: "uploaded", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { fileChange: "fileChange" }, viewQueries: [{ propertyName: "uploaderInput", first: true, predicate: ["uploaderInput"], descendants: true, isSignal: true }], ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
240
242
  }
241
243
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: BaseUploadComponent, decorators: [{
242
244
  type: Component,
243
245
  args: [{
244
246
  template: ``,
245
247
  changeDetection: ChangeDetectionStrategy.OnPush,
246
- standalone: false,
247
248
  }]
248
- }], propDecorators: { fileId: [{
249
- type: Input
250
- }], uploaded: [{
251
- type: Input
252
- }], loading: [{
253
- type: Input
254
- }], fileChange: [{
255
- type: Output
256
- }], uploaderInput: [{
257
- type: ViewChild,
258
- args: ['uploaderInput']
259
- }] } });
249
+ }], ctorParameters: () => [], propDecorators: { fileId: [{ type: i0.Input, args: [{ isSignal: true, alias: "fileId", required: false }] }], uploaded: [{ type: i0.Input, args: [{ isSignal: true, alias: "uploaded", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], fileChange: [{ type: i0.Output, args: ["fileChange"] }], uploaderInput: [{ type: i0.ViewChild, args: ['uploaderInput', { isSignal: true }] }] } });
260
250
 
261
251
  /* eslint-disable @typescript-eslint/no-explicit-any */
262
252
  class BaseValueAccessor {
263
- el;
253
+ el = inject(ElementRef);
264
254
  onChange = () => {
265
255
  /**/
266
256
  };
@@ -268,9 +258,6 @@ class BaseValueAccessor {
268
258
  /**/
269
259
  };
270
260
  lastValue;
271
- constructor(el) {
272
- this.el = el;
273
- }
274
261
  writeValue(value) {
275
262
  this.el.nativeElement.value = this.lastValue = value == null ? '' : value;
276
263
  }
@@ -290,15 +277,12 @@ class BaseValueAccessor {
290
277
  _handleBlurEvent() {
291
278
  this.onTouched();
292
279
  }
293
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: BaseValueAccessor, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
294
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.0", type: BaseValueAccessor, isStandalone: false, host: { listeners: { "focusout": "_handleBlurEvent()" } }, ngImport: i0 });
280
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: BaseValueAccessor, deps: [], target: i0.ɵɵFactoryTarget.Directive });
281
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.0", type: BaseValueAccessor, isStandalone: true, host: { listeners: { "focusout": "_handleBlurEvent()" } }, ngImport: i0 });
295
282
  }
296
283
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: BaseValueAccessor, decorators: [{
297
- type: Directive,
298
- args: [{
299
- standalone: false,
300
- }]
301
- }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { _handleBlurEvent: [{
284
+ type: Directive
285
+ }], propDecorators: { _handleBlurEvent: [{
302
286
  type: HostListener,
303
287
  args: ['focusout']
304
288
  }] } });
@@ -430,16 +414,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
430
414
 
431
415
  /* eslint-disable @typescript-eslint/no-explicit-any */
432
416
  class BaseNumberValueAccessor extends NumberValueAccessor {
433
- el;
434
- renderer;
417
+ _el = inject(ElementRef);
435
418
  lastValue;
436
- constructor(el, renderer) {
437
- super(renderer, el);
438
- this.el = el;
439
- this.renderer = renderer;
440
- }
441
419
  writeValue(value) {
442
- this.el.nativeElement.value = this.lastValue = value == null ? '' : value;
420
+ this._el.nativeElement.value = this.lastValue = value == null ? '' : value;
443
421
  super.writeValue(value);
444
422
  }
445
423
  handleChangeEvent(value) {
@@ -452,15 +430,12 @@ class BaseNumberValueAccessor extends NumberValueAccessor {
452
430
  _handleBlurEvent() {
453
431
  this.onTouched();
454
432
  }
455
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: BaseNumberValueAccessor, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
456
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.0", type: BaseNumberValueAccessor, isStandalone: false, host: { listeners: { "focusout": "_handleBlurEvent()" } }, usesInheritance: true, ngImport: i0 });
433
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: BaseNumberValueAccessor, deps: null, target: i0.ɵɵFactoryTarget.Directive });
434
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.0", type: BaseNumberValueAccessor, isStandalone: true, host: { listeners: { "focusout": "_handleBlurEvent()" } }, usesInheritance: true, ngImport: i0 });
457
435
  }
458
436
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: BaseNumberValueAccessor, decorators: [{
459
- type: Directive,
460
- args: [{
461
- standalone: false,
462
- }]
463
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }], propDecorators: { _handleBlurEvent: [{
437
+ type: Directive
438
+ }], propDecorators: { _handleBlurEvent: [{
464
439
  type: HostListener,
465
440
  args: ['focusout']
466
441
  }] } });
@@ -559,13 +534,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
559
534
  }] });
560
535
 
561
536
  class PRadioDirective extends BaseValueAccessor {
562
- _control;
537
+ _control = inject(NgControl, {
538
+ self: true,
539
+ });
563
540
  _modelValue;
564
541
  _valueChanges;
565
- constructor(_control, el) {
566
- super(el);
567
- this._control = _control;
568
- _control.valueAccessor = this;
542
+ constructor() {
543
+ super();
544
+ this._control.valueAccessor = this;
569
545
  }
570
546
  ngOnInit() {
571
547
  this._valueChanges = this._control
@@ -597,7 +573,7 @@ class PRadioDirective extends BaseValueAccessor {
597
573
  }
598
574
  return value;
599
575
  }
600
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: PRadioDirective, deps: [{ token: i1.NgControl, self: true }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
576
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: PRadioDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
601
577
  static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.0", type: PRadioDirective, isStandalone: true, selector: "p-radio", host: { listeners: { "checkedChange": "handleChangeEvent()" } }, usesInheritance: true, ngImport: i0 });
602
578
  }
603
579
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: PRadioDirective, decorators: [{
@@ -608,9 +584,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
608
584
  '(checkedChange)': 'handleChangeEvent()',
609
585
  },
610
586
  }]
611
- }], ctorParameters: () => [{ type: i1.NgControl, decorators: [{
612
- type: Self
613
- }] }, { type: i0.ElementRef }] });
587
+ }], ctorParameters: () => [] });
614
588
 
615
589
  class PSelectDirective extends BaseValueAccessor {
616
590
  writeValue(value) {
@@ -837,7 +811,7 @@ const createFormFilters = (values, quickFilters, quickFilterKey) => {
837
811
  };
838
812
 
839
813
  let BaseTableComponent = class BaseTableComponent extends BaseFormComponent {
840
- tableOptionsChange = new EventEmitter();
814
+ tableOptionsChange = output();
841
815
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
842
816
  quickFilters = [];
843
817
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -951,7 +925,7 @@ let BaseTableComponent = class BaseTableComponent extends BaseFormComponent {
951
925
  selectedRows: this.parsedDefaultTableValues.selectedRows,
952
926
  });
953
927
  this.tableOptions.valueChanges
954
- .pipe(untilDestroyed(this), startWith(this.tableOptions.value), tap((value) => this.tableOptionsChange.next(value)), pairwise(), map(([previous, next]) => this._getChanges(previous, next)), filter$1(changes => !!changes), debounce(changes => {
928
+ .pipe(untilDestroyed(this), startWith(this.tableOptions.value), tap((value) => this.tableOptionsChange.emit(value)), pairwise(), map(([previous, next]) => this._getChanges(previous, next)), filter$1(changes => !!changes), debounce(changes => {
955
929
  if (changes?.query && Object.keys(changes)?.length === 1) {
956
930
  return timer(300);
957
931
  }
@@ -1045,7 +1019,7 @@ let BaseTableComponent = class BaseTableComponent extends BaseFormComponent {
1045
1019
  }), map(([_, current]) => current));
1046
1020
  }
1047
1021
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: BaseTableComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1048
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.0", type: BaseTableComponent, isStandalone: false, selector: "ng-component", outputs: { tableOptionsChange: "tableOptionsChange" }, usesInheritance: true, ngImport: i0, template: ``, isInline: true });
1022
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.0", type: BaseTableComponent, isStandalone: true, selector: "ng-component", outputs: { tableOptionsChange: "tableOptionsChange" }, usesInheritance: true, ngImport: i0, template: ``, isInline: true });
1049
1023
  };
1050
1024
  BaseTableComponent = __decorate([
1051
1025
  UntilDestroy({ checkProperties: true })
@@ -1054,11 +1028,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
1054
1028
  type: Component,
1055
1029
  args: [{
1056
1030
  template: ``,
1057
- standalone: false,
1058
1031
  }]
1059
- }], propDecorators: { tableOptionsChange: [{
1060
- type: Output
1061
- }] } });
1032
+ }], propDecorators: { tableOptionsChange: [{ type: i0.Output, args: ["tableOptionsChange"] }] } });
1062
1033
 
1063
1034
  /* eslint-disable */
1064
1035
  /* tslint:disable */
@@ -3487,7 +3458,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
3487
3458
 
3488
3459
  /* eslint-disable @typescript-eslint/no-explicit-any */
3489
3460
  class PTableNgxDirective extends BaseValueAccessor {
3490
- _base;
3461
+ _base = inject(TableComponent, {
3462
+ host: true,
3463
+ });
3491
3464
  lastValue = {
3492
3465
  query: '',
3493
3466
  quickFilter: undefined,
@@ -3496,10 +3469,6 @@ class PTableNgxDirective extends BaseValueAccessor {
3496
3469
  pageSize: 12,
3497
3470
  selectedRows: [],
3498
3471
  };
3499
- constructor(el, _base) {
3500
- super(el);
3501
- this._base = _base;
3502
- }
3503
3472
  writeValue(value) {
3504
3473
  this._base.query = this.lastValue.query = value?.query;
3505
3474
  // this.el.nativeElement.query = this.lastValue.query = value?.query;
@@ -3572,7 +3541,7 @@ class PTableNgxDirective extends BaseValueAccessor {
3572
3541
  : false;
3573
3542
  }
3574
3543
  }
3575
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: PTableNgxDirective, deps: [{ token: i0.ElementRef }, { token: TableComponent, host: true }], target: i0.ɵɵFactoryTarget.Directive });
3544
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: PTableNgxDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
3576
3545
  static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.0", type: PTableNgxDirective, isStandalone: true, selector: "p-table-ngx", host: { listeners: { "queryChange": "handleChange($event, \"query\")", "quickFilter": "handleChange($event, \"quickFilter\")", "pageChange": "handleChange($event, \"page\")", "pageSizeChange": "handleChange($event, \"pageSize\")", "selectedRowsChange": "handleChange($event, \"selectedRows\")" } }, providers: [
3577
3546
  {
3578
3547
  provide: NG_VALUE_ACCESSOR,
@@ -3600,9 +3569,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
3600
3569
  },
3601
3570
  ],
3602
3571
  }]
3603
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: TableComponent, decorators: [{
3604
- type: Host
3605
- }] }] });
3572
+ }] });
3606
3573
 
3607
3574
  /* eslint-disable @typescript-eslint/no-explicit-any */
3608
3575
  class PTableDirective extends BaseValueAccessor {
@@ -4902,32 +4869,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
4902
4869
  }] });
4903
4870
 
4904
4871
  class PToastDirective {
4905
- delay = 5000;
4906
- identifier;
4907
- dismissOnAction = true;
4908
- actionFunc;
4872
+ delay = input(5000, ...(ngDevMode ? [{ debugName: "delay" }] : []));
4873
+ identifier = input.required(...(ngDevMode ? [{ debugName: "identifier" }] : []));
4874
+ dismissOnAction = input(true, ...(ngDevMode ? [{ debugName: "dismissOnAction" }] : []));
4875
+ actionFunc = input(...(ngDevMode ? [undefined, { debugName: "actionFunc" }] : []));
4909
4876
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4910
- actionData = {};
4911
- dismiss = new EventEmitter();
4877
+ actionData = input({}, ...(ngDevMode ? [{ debugName: "actionData" }] : []));
4878
+ dismiss = output();
4912
4879
  ngOnInit() {
4913
- if (this.delay === 'infinite' || this.delay === 0) {
4880
+ const delay = this.delay();
4881
+ if (delay === 'infinite' || delay === 0) {
4914
4882
  return;
4915
4883
  }
4916
- setTimeout(() => this.doDismiss(), this.delay);
4884
+ setTimeout(() => this.doDismiss(), delay);
4917
4885
  }
4918
4886
  onAction() {
4919
- if (this.dismissOnAction && !this.actionFunc) {
4887
+ const actionFunc = this.actionFunc();
4888
+ if (this.dismissOnAction() && !actionFunc) {
4920
4889
  return this.doDismiss();
4921
4890
  }
4922
- if (this.actionFunc) {
4923
- this.actionFunc(this, this.actionData);
4891
+ if (actionFunc) {
4892
+ actionFunc(this, this.actionData());
4924
4893
  }
4925
4894
  }
4926
4895
  doDismiss() {
4927
- this.dismiss.next(this.identifier);
4896
+ this.dismiss.emit(this.identifier());
4928
4897
  }
4929
4898
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: PToastDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
4930
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.0", type: PToastDirective, isStandalone: true, selector: "p-toast", inputs: { delay: "delay", identifier: "identifier", dismissOnAction: "dismissOnAction", actionFunc: "actionFunc", actionData: "actionData" }, outputs: { dismiss: "dismiss" }, host: { listeners: { "action": "onAction()" } }, ngImport: i0 });
4899
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.0", type: PToastDirective, isStandalone: true, selector: "p-toast", inputs: { delay: { classPropertyName: "delay", publicName: "delay", isSignal: true, isRequired: false, transformFunction: null }, identifier: { classPropertyName: "identifier", publicName: "identifier", isSignal: true, isRequired: true, transformFunction: null }, dismissOnAction: { classPropertyName: "dismissOnAction", publicName: "dismissOnAction", isSignal: true, isRequired: false, transformFunction: null }, actionFunc: { classPropertyName: "actionFunc", publicName: "actionFunc", isSignal: true, isRequired: false, transformFunction: null }, actionData: { classPropertyName: "actionData", publicName: "actionData", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dismiss: "dismiss" }, host: { listeners: { "action": "onAction()" } }, ngImport: i0 });
4931
4900
  }
4932
4901
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: PToastDirective, decorators: [{
4933
4902
  type: Directive,
@@ -4938,19 +4907,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
4938
4907
  },
4939
4908
  standalone: true,
4940
4909
  }]
4941
- }], propDecorators: { delay: [{
4942
- type: Input
4943
- }], identifier: [{
4944
- type: Input
4945
- }], dismissOnAction: [{
4946
- type: Input
4947
- }], actionFunc: [{
4948
- type: Input
4949
- }], actionData: [{
4950
- type: Input
4951
- }], dismiss: [{
4952
- type: Output
4953
- }] } });
4910
+ }], propDecorators: { delay: [{ type: i0.Input, args: [{ isSignal: true, alias: "delay", required: false }] }], identifier: [{ type: i0.Input, args: [{ isSignal: true, alias: "identifier", required: true }] }], dismissOnAction: [{ type: i0.Input, args: [{ isSignal: true, alias: "dismissOnAction", required: false }] }], actionFunc: [{ type: i0.Input, args: [{ isSignal: true, alias: "actionFunc", required: false }] }], actionData: [{ type: i0.Input, args: [{ isSignal: true, alias: "actionData", required: false }] }], dismiss: [{ type: i0.Output, args: ["dismiss"] }] } });
4954
4911
 
4955
4912
  var PToastVariants;
4956
4913
  (function (PToastVariants) {
@@ -5011,18 +4968,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
5011
4968
 
5012
4969
  /* top-0 bottom-0 left-0 right-0 */
5013
4970
  let ToastContainerComponent = class ToastContainerComponent {
5014
- z;
4971
+ _elRef = inject(ElementRef);
4972
+ z = inject(NgZone);
5015
4973
  _toastService = inject(ToastService);
5016
4974
  toasts$ = this._toastService.toasts$.pipe(map$1(arr => arr.toReversed()));
5017
4975
  el;
5018
- constructor(r, z) {
5019
- this.z = z;
5020
- this.el = r.nativeElement;
4976
+ constructor() {
4977
+ this.el = this._elRef.nativeElement;
5021
4978
  }
5022
4979
  dismiss(identifier) {
5023
4980
  this._toastService.hide(identifier);
5024
4981
  }
5025
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: ToastContainerComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
4982
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: ToastContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
5026
4983
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.0", type: ToastContainerComponent, isStandalone: true, selector: "p-toast-container", inputs: { placement: "placement" }, ngImport: i0, template: "@for (toast of toasts$ | async; track toast; let index = $index) {\n\t<p-toast\n\t\tanimate.enter=\"animate-in fade-in slide-in-from-top\"\n\t\tanimate.leave=\"animate-out fade-out\"\n\t\t[actionData]=\"toast.options.actionData\"\n\t\t[actionFunc]=\"toast.options.action\"\n\t\t[actionIcon]=\"toast.options.icon?.variant\"\n\t\t[actionIconFlip]=\"toast.options.icon?.flip\"\n\t\t[actionIconRotate]=\"toast.options.icon?.rotate\"\n\t\t[content]=\"toast.content\"\n\t\t[delay]=\"toast.options.delay ?? 5000\"\n\t\t[dismissOnAction]=\"toast.options.dismissOnAction ?? true\"\n\t\t[enableAction]=\"toast.options.enableAction\"\n\t\t[header]=\"toast.header\"\n\t\t[identifier]=\"toast.identifier\"\n\t\t[variant]=\"toast.variant\"\n\t\t(dismiss)=\"dismiss($event)\"\n\t/>\n}\n", dependencies: [{ kind: "component", type: PToast, selector: "p-toast", inputs: ["actionIcon", "actionIconFlip", "actionIconRotate", "content", "enableAction", "header", "variant"] }, { kind: "directive", type: PToastDirective, selector: "p-toast", inputs: ["delay", "identifier", "dismissOnAction", "actionFunc", "actionData"], outputs: ["dismiss"] }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
5027
4984
  };
5028
4985
  ToastContainerComponent = __decorate([
@@ -5034,7 +4991,7 @@ ToastContainerComponent = __decorate([
5034
4991
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: ToastContainerComponent, decorators: [{
5035
4992
  type: Component,
5036
4993
  args: [{ selector: 'p-toast-container', changeDetection: ChangeDetectionStrategy.OnPush, inputs: ['placement'], standalone: true, imports: [PToast, PToastDirective, AsyncPipe], template: "@for (toast of toasts$ | async; track toast; let index = $index) {\n\t<p-toast\n\t\tanimate.enter=\"animate-in fade-in slide-in-from-top\"\n\t\tanimate.leave=\"animate-out fade-out\"\n\t\t[actionData]=\"toast.options.actionData\"\n\t\t[actionFunc]=\"toast.options.action\"\n\t\t[actionIcon]=\"toast.options.icon?.variant\"\n\t\t[actionIconFlip]=\"toast.options.icon?.flip\"\n\t\t[actionIconRotate]=\"toast.options.icon?.rotate\"\n\t\t[content]=\"toast.content\"\n\t\t[delay]=\"toast.options.delay ?? 5000\"\n\t\t[dismissOnAction]=\"toast.options.dismissOnAction ?? true\"\n\t\t[enableAction]=\"toast.options.enableAction\"\n\t\t[header]=\"toast.header\"\n\t\t[identifier]=\"toast.identifier\"\n\t\t[variant]=\"toast.variant\"\n\t\t(dismiss)=\"dismiss($event)\"\n\t/>\n}\n" }]
5037
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.NgZone }] });
4994
+ }], ctorParameters: () => [] });
5038
4995
 
5039
4996
  const TOAST_COMPONENTS = [ToastContainerComponent];
5040
4997
 
@@ -5056,15 +5013,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
5056
5013
 
5057
5014
  const MODULES = [TableModule, ToastModule, OverlayModule];
5058
5015
 
5016
+ /*
5017
+ This pipe overrides the default currency pipe from angular,
5018
+ this can be removed when angular supports currency defaults
5019
+ https://github.com/angular/angular/issues/25461
5020
+ */
5059
5021
  class CustomCurrencyPipe {
5060
- _currencyPipe;
5061
- constructor(_currencyPipe) {
5062
- this._currencyPipe = _currencyPipe;
5063
- }
5022
+ _currencyPipe = inject(CurrencyPipe);
5064
5023
  transform(value, currencyCode = 'EUR', display = 'symbol', digitsInfo = '1.2-2', locale = 'nl') {
5065
5024
  return this._currencyPipe.transform(value, currencyCode, display, digitsInfo, locale);
5066
5025
  }
5067
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: CustomCurrencyPipe, deps: [{ token: i1$1.CurrencyPipe }], target: i0.ɵɵFactoryTarget.Pipe });
5026
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: CustomCurrencyPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
5068
5027
  static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.1.0", ngImport: i0, type: CustomCurrencyPipe, isStandalone: true, name: "pcurrency" });
5069
5028
  }
5070
5029
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: CustomCurrencyPipe, decorators: [{
@@ -5072,17 +5031,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
5072
5031
  args: [{
5073
5032
  name: 'pcurrency',
5074
5033
  }]
5075
- }], ctorParameters: () => [{ type: i1$1.CurrencyPipe }] });
5034
+ }] });
5076
5035
 
5077
5036
  class CustomDatePipe {
5078
- _datePipe;
5079
- constructor(_datePipe) {
5080
- this._datePipe = _datePipe;
5081
- }
5037
+ _datePipe = inject(DatePipe);
5082
5038
  transform(value, format = 'd MMM yyyy') {
5083
5039
  return this._datePipe.transform(value, format);
5084
5040
  }
5085
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: CustomDatePipe, deps: [{ token: i1$1.DatePipe }], target: i0.ɵɵFactoryTarget.Pipe });
5041
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: CustomDatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
5086
5042
  static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.1.0", ngImport: i0, type: CustomDatePipe, isStandalone: true, name: "pdate" });
5087
5043
  }
5088
5044
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: CustomDatePipe, decorators: [{
@@ -5090,36 +5046,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
5090
5046
  args: [{
5091
5047
  name: 'pdate',
5092
5048
  }]
5093
- }], ctorParameters: () => [{ type: i1$1.DatePipe }] });
5049
+ }] });
5094
5050
 
5095
5051
  class SafePipe {
5096
- sanitizer;
5097
- constructor(sanitizer) {
5098
- this.sanitizer = sanitizer;
5099
- }
5052
+ _sanitizer = inject(DomSanitizer);
5100
5053
  transform(value, type) {
5101
5054
  switch (type) {
5102
5055
  case 'html': {
5103
- return this.sanitizer.bypassSecurityTrustHtml(value);
5056
+ return this._sanitizer.bypassSecurityTrustHtml(value);
5104
5057
  }
5105
5058
  case 'style': {
5106
- return this.sanitizer.bypassSecurityTrustStyle(value);
5059
+ return this._sanitizer.bypassSecurityTrustStyle(value);
5107
5060
  }
5108
5061
  case 'script': {
5109
- return this.sanitizer.bypassSecurityTrustScript(value);
5062
+ return this._sanitizer.bypassSecurityTrustScript(value);
5110
5063
  }
5111
5064
  case 'url': {
5112
- return this.sanitizer.bypassSecurityTrustUrl(value);
5065
+ return this._sanitizer.bypassSecurityTrustUrl(value);
5113
5066
  }
5114
5067
  case 'resourceUrl': {
5115
- return this.sanitizer.bypassSecurityTrustResourceUrl(value);
5068
+ return this._sanitizer.bypassSecurityTrustResourceUrl(value);
5116
5069
  }
5117
5070
  default: {
5118
5071
  throw new Error(`Invalid safe type specified: ${type}`);
5119
5072
  }
5120
5073
  }
5121
5074
  }
5122
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: SafePipe, deps: [{ token: i1$2.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
5075
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: SafePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
5123
5076
  static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.1.0", ngImport: i0, type: SafePipe, isStandalone: true, name: "psafe" });
5124
5077
  }
5125
5078
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: SafePipe, decorators: [{
@@ -5127,7 +5080,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
5127
5080
  args: [{
5128
5081
  name: 'psafe',
5129
5082
  }]
5130
- }], ctorParameters: () => [{ type: i1$2.DomSanitizer }] });
5083
+ }] });
5131
5084
 
5132
5085
  class SelectAutocompletePipe {
5133
5086
  transform(value) {