@leanix/components 0.2.241 → 0.2.244
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.
- package/esm2020/lib/core-ui/services/resize-observer.service.mjs +51 -2
- package/fesm2015/leanix-components.mjs +47 -2
- package/fesm2015/leanix-components.mjs.map +1 -1
- package/fesm2020/leanix-components.mjs +50 -2
- package/fesm2020/leanix-components.mjs.map +1 -1
- package/lib/core-ui/services/resize-observer.service.d.ts +8 -0
- package/package.json +1 -1
@@ -8,7 +8,7 @@ import * as i1 from '@angular/cdk/overlay';
|
|
8
8
|
import { OverlayModule, CdkConnectedOverlay } from '@angular/cdk/overlay';
|
9
9
|
import { __decorate } from 'tslib';
|
10
10
|
import * as i6 from 'rxjs';
|
11
|
-
import { BehaviorSubject, Subject, combineLatest, merge, concat, fromEvent, Observable, ReplaySubject, of
|
11
|
+
import { BehaviorSubject, timer, Subject, combineLatest, merge, concat, fromEvent, Observable, ReplaySubject, of } from 'rxjs';
|
12
12
|
import { skipWhile, map, switchMap, startWith, pairwise, filter, take, debounceTime, skip, withLatestFrom, distinctUntilChanged, takeUntil, first, delay, mapTo, tap } from 'rxjs/operators';
|
13
13
|
import * as i1$1 from '@ngx-translate/core';
|
14
14
|
import { TranslatePipe, TranslateModule } from '@ngx-translate/core';
|
@@ -513,7 +513,16 @@ function isResizeableElement(element) {
|
|
513
513
|
class ResizeObserverService {
|
514
514
|
observe(element, callback, options) {
|
515
515
|
if (!this.resizeObserver) {
|
516
|
-
|
516
|
+
try {
|
517
|
+
this.resizeObserver = new ResizeObserver(this.resizeObserverCallback.bind(this));
|
518
|
+
}
|
519
|
+
catch {
|
520
|
+
// All the browsers we support implement the ResizeObserver API.
|
521
|
+
// For unsupported browsers, there's this "one time artifical resize event".
|
522
|
+
// They will not get the functionality tied to later resize events.
|
523
|
+
timer(500).subscribe(() => callback(this.getMockOneTimeResizeEventForUnsupportedBrowsers(element)));
|
524
|
+
return;
|
525
|
+
}
|
517
526
|
}
|
518
527
|
element.handleResize = callback;
|
519
528
|
this.resizeObserver.observe(element, options);
|
@@ -531,6 +540,45 @@ class ResizeObserverService {
|
|
531
540
|
}
|
532
541
|
});
|
533
542
|
}
|
543
|
+
/**
|
544
|
+
* All browsers we officially support implement the ResizeObserver API.
|
545
|
+
* Still as a curtesy do customers who for some reason have older browsers
|
546
|
+
* we call the callback once with the initial dimensions of the element
|
547
|
+
* and then do not react on resize events afterwards.
|
548
|
+
* This should still make them happier than a "browser not supported" warning.
|
549
|
+
*/
|
550
|
+
getMockOneTimeResizeEventForUnsupportedBrowsers(element) {
|
551
|
+
const contentRect = {
|
552
|
+
bottom: element.clientHeight,
|
553
|
+
height: element.clientHeight,
|
554
|
+
left: 0,
|
555
|
+
right: element.clientWidth,
|
556
|
+
top: 0,
|
557
|
+
width: element.clientWidth,
|
558
|
+
x: 0,
|
559
|
+
y: 0
|
560
|
+
};
|
561
|
+
return {
|
562
|
+
borderBoxSize: [{ blockSize: element.clientHeight, inlineSize: element.clientWidth }],
|
563
|
+
contentBoxSize: [
|
564
|
+
{
|
565
|
+
blockSize: element.clientHeight,
|
566
|
+
inlineSize: element.clientWidth
|
567
|
+
}
|
568
|
+
],
|
569
|
+
contentRect: {
|
570
|
+
...contentRect,
|
571
|
+
toJSON: () => JSON.stringify(contentRect)
|
572
|
+
},
|
573
|
+
devicePixelContentBoxSize: [
|
574
|
+
{
|
575
|
+
blockSize: element.clientWidth,
|
576
|
+
inlineSize: element.clientWidth
|
577
|
+
}
|
578
|
+
],
|
579
|
+
target: element
|
580
|
+
};
|
581
|
+
}
|
534
582
|
}
|
535
583
|
ResizeObserverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: ResizeObserverService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
536
584
|
ResizeObserverService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: ResizeObserverService, providedIn: 'root' });
|