@paperless/angular 0.1.0-alpha.313 → 0.1.0-alpha.315

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.
@@ -14,6 +14,7 @@ import { PortalModule, CdkPortal, ComponentPortal } from '@angular/cdk/portal';
14
14
  import { untilDestroyed, UntilDestroy } from '@ngneat/until-destroy';
15
15
  import { startWith, pairwise, map, filter, debounce } from 'rxjs/operators';
16
16
  import { objectGetByPath } from '@paperless/core';
17
+ import { v4 } from 'uuid';
17
18
  import * as i1$2 from '@angular/platform-browser';
18
19
 
19
20
  const FADE_IN = trigger('pFadeIn', [
@@ -3292,17 +3293,22 @@ class ToastService {
3292
3293
  ? { ...this.defaultOptions.icon, ...options.icon }
3293
3294
  : this.defaultOptions.icon,
3294
3295
  };
3296
+ const identifier = v4();
3295
3297
  this._toasts.push({
3298
+ identifier,
3296
3299
  header,
3297
3300
  content,
3298
3301
  variant,
3299
3302
  options,
3300
3303
  });
3301
3304
  this.toasts$.next(this._toasts);
3305
+ return identifier;
3302
3306
  }
3303
- hide(index) {
3307
+ hide(id) {
3308
+ const index = this._toasts.findIndex(({ identifier }) => identifier === id);
3304
3309
  this._toasts.splice(index, 1);
3305
3310
  this.toasts$.next(this._toasts);
3311
+ return id;
3306
3312
  }
3307
3313
  }
3308
3314
  ToastService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ToastService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
@@ -3317,7 +3323,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImpor
3317
3323
  class ToastDirective {
3318
3324
  constructor() {
3319
3325
  this.delay = 5000;
3320
- this.index = 0;
3321
3326
  this.dismissOnAction = true;
3322
3327
  this.actionData = {};
3323
3328
  this.dismiss = new EventEmitter();
@@ -3337,11 +3342,11 @@ class ToastDirective {
3337
3342
  }
3338
3343
  }
3339
3344
  doDismiss() {
3340
- this.dismiss.next(this.index);
3345
+ this.dismiss.next(this.identifier);
3341
3346
  }
3342
3347
  }
3343
3348
  ToastDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ToastDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
3344
- ToastDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.3", type: ToastDirective, selector: "p-toast", inputs: { delay: "delay", index: "index", dismissOnAction: "dismissOnAction", actionFunc: "actionFunc", actionData: "actionData" }, outputs: { dismiss: "dismiss" }, host: { listeners: { "action": "onAction()" } }, ngImport: i0 });
3349
+ ToastDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.3", type: ToastDirective, selector: "p-toast", inputs: { delay: "delay", identifier: "identifier", dismissOnAction: "dismissOnAction", actionFunc: "actionFunc", actionData: "actionData" }, outputs: { dismiss: "dismiss" }, host: { listeners: { "action": "onAction()" } }, ngImport: i0 });
3345
3350
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ToastDirective, decorators: [{
3346
3351
  type: Directive,
3347
3352
  args: [{
@@ -3352,7 +3357,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImpor
3352
3357
  }]
3353
3358
  }], propDecorators: { delay: [{
3354
3359
  type: Input
3355
- }], index: [{
3360
+ }], identifier: [{
3356
3361
  type: Input
3357
3362
  }], dismissOnAction: [{
3358
3363
  type: Input
@@ -3372,12 +3377,12 @@ let ToastContainer = class ToastContainer {
3372
3377
  this.toasts$ = this._toastService.toasts$.pipe(map$1((arr) => arr.reverse()));
3373
3378
  this.el = r.nativeElement;
3374
3379
  }
3375
- dismiss(index) {
3376
- this._toastService.hide(index);
3380
+ dismiss(identifier) {
3381
+ this._toastService.hide(identifier);
3377
3382
  }
3378
3383
  };
3379
3384
  ToastContainer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ToastContainer, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: ToastService }], target: i0.ɵɵFactoryTarget.Component });
3380
- ToastContainer.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.3", type: ToastContainer, selector: "p-toast-container", inputs: { placement: "placement" }, ngImport: i0, template: "<p-toast\n *ngFor=\"let toast of toasts$ | async; let index = index\"\n [variant]=\"toast.variant\"\n [header]=\"toast.header\"\n [content]=\"toast.content\"\n [index]=\"index\"\n [delay]=\"toast.options.delay ?? 5000\"\n [dismissOnAction]=\"toast.options.dismissOnAction ?? true\"\n [enableAction]=\"toast.options.enableAction\"\n [actionFunc]=\"toast.options.action\"\n [actionData]=\"toast.options.actionData\"\n [actionIcon]=\"toast.options.icon?.variant\"\n [actionIconFlip]=\"toast.options.icon?.flip\"\n [actionIconRotate]=\"toast.options.icon?.rotate\"\n (dismiss)=\"dismiss($event)\"\n [@pSlideInBottomOutTop]\n></p-toast>\n", dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: PToast, selector: "p-toast", inputs: ["actionIcon", "actionIconFlip", "actionIconRotate", "content", "enableAction", "header", "variant"] }, { kind: "directive", type: ToastDirective, selector: "p-toast", inputs: ["delay", "index", "dismissOnAction", "actionFunc", "actionData"], outputs: ["dismiss"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }], animations: [SLIDE_IN_TOP_OUT_BOTTOM], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3385
+ ToastContainer.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.3", type: ToastContainer, selector: "p-toast-container", inputs: { placement: "placement" }, ngImport: i0, template: "<p-toast\n *ngFor=\"let toast of toasts$ | async; let index = index\"\n [variant]=\"toast.variant\"\n [header]=\"toast.header\"\n [content]=\"toast.content\"\n [identifier]=\"toast.identifier\"\n [delay]=\"toast.options.delay ?? 5000\"\n [dismissOnAction]=\"toast.options.dismissOnAction ?? true\"\n [enableAction]=\"toast.options.enableAction\"\n [actionFunc]=\"toast.options.action\"\n [actionData]=\"toast.options.actionData\"\n [actionIcon]=\"toast.options.icon?.variant\"\n [actionIconFlip]=\"toast.options.icon?.flip\"\n [actionIconRotate]=\"toast.options.icon?.rotate\"\n (dismiss)=\"dismiss($event)\"\n [@pSlideInBottomOutTop]\n></p-toast>\n", dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: PToast, selector: "p-toast", inputs: ["actionIcon", "actionIconFlip", "actionIconRotate", "content", "enableAction", "header", "variant"] }, { kind: "directive", type: ToastDirective, selector: "p-toast", inputs: ["delay", "identifier", "dismissOnAction", "actionFunc", "actionData"], outputs: ["dismiss"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }], animations: [SLIDE_IN_TOP_OUT_BOTTOM], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3381
3386
  ToastContainer = __decorate([
3382
3387
  ProxyCmp({
3383
3388
  defineCustomElementFn: undefined,
@@ -3386,7 +3391,7 @@ ToastContainer = __decorate([
3386
3391
  ], ToastContainer);
3387
3392
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ToastContainer, decorators: [{
3388
3393
  type: Component,
3389
- args: [{ selector: 'p-toast-container', changeDetection: ChangeDetectionStrategy.OnPush, inputs: ['placement'], animations: [SLIDE_IN_TOP_OUT_BOTTOM], template: "<p-toast\n *ngFor=\"let toast of toasts$ | async; let index = index\"\n [variant]=\"toast.variant\"\n [header]=\"toast.header\"\n [content]=\"toast.content\"\n [index]=\"index\"\n [delay]=\"toast.options.delay ?? 5000\"\n [dismissOnAction]=\"toast.options.dismissOnAction ?? true\"\n [enableAction]=\"toast.options.enableAction\"\n [actionFunc]=\"toast.options.action\"\n [actionData]=\"toast.options.actionData\"\n [actionIcon]=\"toast.options.icon?.variant\"\n [actionIconFlip]=\"toast.options.icon?.flip\"\n [actionIconRotate]=\"toast.options.icon?.rotate\"\n (dismiss)=\"dismiss($event)\"\n [@pSlideInBottomOutTop]\n></p-toast>\n" }]
3394
+ args: [{ selector: 'p-toast-container', changeDetection: ChangeDetectionStrategy.OnPush, inputs: ['placement'], animations: [SLIDE_IN_TOP_OUT_BOTTOM], template: "<p-toast\n *ngFor=\"let toast of toasts$ | async; let index = index\"\n [variant]=\"toast.variant\"\n [header]=\"toast.header\"\n [content]=\"toast.content\"\n [identifier]=\"toast.identifier\"\n [delay]=\"toast.options.delay ?? 5000\"\n [dismissOnAction]=\"toast.options.dismissOnAction ?? true\"\n [enableAction]=\"toast.options.enableAction\"\n [actionFunc]=\"toast.options.action\"\n [actionData]=\"toast.options.actionData\"\n [actionIcon]=\"toast.options.icon?.variant\"\n [actionIconFlip]=\"toast.options.icon?.flip\"\n [actionIconRotate]=\"toast.options.icon?.rotate\"\n (dismiss)=\"dismiss($event)\"\n [@pSlideInBottomOutTop]\n></p-toast>\n" }]
3390
3395
  }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: ToastService }]; } });
3391
3396
 
3392
3397
  const TOAST_COMPONENTS = [ToastContainer];