@libs-ui/components-image-editor 0.2.274 → 0.2.276

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,6 +1,7 @@
1
1
  import { NgTemplateOutlet } from '@angular/common';
2
2
  import * as i0 from '@angular/core';
3
- import { EventEmitter, Output, Input, Component, signal, input, model, viewChild, output, inject, Optional, Inject, ChangeDetectionStrategy, ViewChild } from '@angular/core';
3
+ import { EventEmitter, Output, Input, Component, signal, input, model, viewChild, output, inject, DestroyRef, Optional, Inject, ChangeDetectionStrategy, ViewChild } from '@angular/core';
4
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
4
5
  import { LibsUiComponentsButtonsButtonComponent } from '@libs-ui/components-buttons-button';
5
6
  import { LibsUiComponentsInputsValidComponent } from '@libs-ui/components-inputs-valid';
6
7
  import { LibsUiComponentsModalComponent } from '@libs-ui/components-modal';
@@ -10,7 +11,7 @@ import { LibsUiDynamicComponentService } from '@libs-ui/services-dynamic-compone
10
11
  import { get, convertBase64ToBlob, getLabelBySizeFile, convertBlobToFile, isNil, set, LINK_IMAGE_ERROR_TOKEN_INJECT } from '@libs-ui/utils';
11
12
  import * as i1 from '@ngx-translate/core';
12
13
  import { TranslateModule } from '@ngx-translate/core';
13
- import { Subject, fromEvent } from 'rxjs';
14
+ import { fromEvent } from 'rxjs';
14
15
  import { takeUntil, tap, mergeMap } from 'rxjs/operators';
15
16
 
16
17
  const cropRationItems = () => {
@@ -244,7 +245,6 @@ class LibsUiComponentsImageEditorComponent {
244
245
  ratioValue = signal(0);
245
246
  minHeight = 20;
246
247
  minWidth = 20;
247
- onDestroy = new Subject();
248
248
  resizeComponentRef;
249
249
  modeShowButton = input('save-file');
250
250
  mimetype = input();
@@ -275,6 +275,7 @@ class LibsUiComponentsImageEditorComponent {
275
275
  outClose = output();
276
276
  outSaveFile = output();
277
277
  outFunctionsControl = output();
278
+ destroyRef = inject(DestroyRef);
278
279
  dynamicComponentService = inject(LibsUiDynamicComponentService);
279
280
  constructor(linkImageError) {
280
281
  this.linkImageError = linkImageError;
@@ -355,9 +356,9 @@ class LibsUiComponentsImageEditorComponent {
355
356
  if (callback) {
356
357
  callback(e);
357
358
  }
358
- }), takeUntil(this.onDestroy));
359
+ }), takeUntilDestroyed(this.destroyRef));
359
360
  if (obsMerge) {
360
- return obs.pipe(mergeMap(() => obsMerge), (takeUntil(this.onDestroy)));
361
+ return obs.pipe(mergeMap(() => obsMerge), (takeUntilDestroyed(this.destroyRef)));
361
362
  }
362
363
  return obs;
363
364
  }
@@ -845,7 +846,7 @@ class LibsUiComponentsImageEditorComponent {
845
846
  }
846
847
  this.resizeComponentRef = this.dynamicComponentService.resolveComponentFactory(LibsUiComponentsImageEditorResizeComponent);
847
848
  const instance = this.resizeComponentRef.instance;
848
- const subs = instance.outClose.pipe(takeUntil(this.onDestroy)).subscribe(() => {
849
+ const subs = instance.outClose.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {
849
850
  this.dynamicComponentService.remove(this.resizeComponentRef);
850
851
  this.resizeComponentRef = undefined;
851
852
  subs.unsubscribe();
@@ -853,7 +854,7 @@ class LibsUiComponentsImageEditorComponent {
853
854
  instance.src = this.imgSrc();
854
855
  instance.mimetype = this.mimetype();
855
856
  instance.zIndex = this.zIndex();
856
- subs.add(instance.outSave.pipe(takeUntil(this.onDestroy)).subscribe(event => {
857
+ subs.add(instance.outSave.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(event => {
857
858
  this.resizeData.set(event);
858
859
  this.saveResize();
859
860
  }));
@@ -964,8 +965,6 @@ class LibsUiComponentsImageEditorComponent {
964
965
  }
965
966
  }
966
967
  ngOnDestroy() {
967
- this.onDestroy.next();
968
- this.onDestroy.complete();
969
968
  this.dynamicComponentService.remove(this.resizeComponentRef);
970
969
  }
971
970
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsImageEditorComponent, deps: [{ token: LINK_IMAGE_ERROR_TOKEN_INJECT, optional: true }], target: i0.ɵɵFactoryTarget.Component });