@stemy/ngx-utils 19.4.14 → 19.4.16

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.
@@ -4399,6 +4399,43 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
4399
4399
  args: [DOCUMENT]
4400
4400
  }] }, { type: UniversalService }] });
4401
4401
 
4402
+ class ResizeDetector {
4403
+ constructor(resizeStrategy) {
4404
+ this.resizeStrategy = resizeStrategy;
4405
+ this.detector = elementResizeDetectorMaker({
4406
+ strategy: resizeStrategy === "observer" ? "object" : resizeStrategy
4407
+ });
4408
+ this.isObservable = resizeStrategy === "observer" && typeof ResizeObserver === "function";
4409
+ this.observers = new Map();
4410
+ }
4411
+ listenTo(elem, cb) {
4412
+ if (!this.isObservable) {
4413
+ this.detector.listenTo(elem, cb);
4414
+ return;
4415
+ }
4416
+ if (this.observers.has(elem))
4417
+ return;
4418
+ const observer = new ResizeObserver(() => {
4419
+ requestAnimationFrame(() => {
4420
+ cb(elem);
4421
+ });
4422
+ });
4423
+ observer.observe(elem);
4424
+ this.observers.set(elem, observer);
4425
+ }
4426
+ uninstall(elem) {
4427
+ if (!this.isObservable) {
4428
+ this.detector.uninstall(elem);
4429
+ return;
4430
+ }
4431
+ if (!this.observers.has(elem))
4432
+ return;
4433
+ const observer = this.observers.get(elem);
4434
+ observer.unobserve(elem);
4435
+ this.observers.delete(elem);
4436
+ }
4437
+ }
4438
+
4402
4439
  function emptyRemove$1() {
4403
4440
  }
4404
4441
  function isWindow(el) {
@@ -4411,9 +4448,7 @@ class ResizeEventPlugin extends _DomEventsPlugin {
4411
4448
  this.resizeDelay = resizeDelay;
4412
4449
  this.resizeStrategy = resizeStrategy;
4413
4450
  this.universal = universal;
4414
- this.detector = elementResizeDetectorMaker({
4415
- strategy: resizeStrategy
4416
- });
4451
+ this.detector = new ResizeDetector(resizeStrategy);
4417
4452
  }
4418
4453
  supports(eventName) {
4419
4454
  return eventName === ResizeEventPlugin.EVENT_NAME;
@@ -4424,7 +4459,7 @@ class ResizeEventPlugin extends _DomEventsPlugin {
4424
4459
  if (this.universal.isServer)
4425
4460
  return emptyRemove$1;
4426
4461
  const timer = TimerUtils.createTimeout();
4427
- const cb = el => {
4462
+ const cb = (el) => {
4428
4463
  timer.set(() => {
4429
4464
  zone.run(() => handler(el));
4430
4465
  }, this.resizeDelay);
@@ -7604,13 +7639,13 @@ class UploadComponent {
7604
7639
  }
7605
7640
  const request = this.http.post(baseUrl, makeUpload(p.file), {
7606
7641
  headers, observe: "events", reportProgress: true
7607
- });
7608
- request.subscribe(value => {
7642
+ }).pipe(map(value => {
7609
7643
  if (value.type === HttpEventType.UploadProgress) {
7610
7644
  p.progress = Math.round(value.loaded / value.total * 100);
7611
7645
  this.cdr.detectChanges();
7612
7646
  }
7613
- });
7647
+ return value;
7648
+ }));
7614
7649
  return lastValueFrom(request)
7615
7650
  .then((res) => {
7616
7651
  const body = res.body;
@@ -8057,7 +8092,7 @@ class NgxUtilsModule {
8057
8092
  },
8058
8093
  {
8059
8094
  provide: RESIZE_STRATEGY,
8060
- useValue: (!config ? null : config.resizeStrategy) ?? "object",
8095
+ useValue: (!config ? null : config.resizeStrategy) ?? "observer",
8061
8096
  },
8062
8097
  {
8063
8098
  provide: SOCKET_IO_PATH,