@ts-core/angular 13.1.26 → 13.1.29
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/manager/ResizeManager.mjs +19 -5
- package/esm2020/util/ViewUtil.mjs +19 -3
- package/fesm2015/ts-core-angular.mjs +36 -6
- package/fesm2015/ts-core-angular.mjs.map +1 -1
- package/fesm2020/ts-core-angular.mjs +36 -6
- package/fesm2020/ts-core-angular.mjs.map +1 -1
- package/manager/ResizeManager.d.ts +2 -2
- package/package.json +1 -1
- package/util/ViewUtil.d.ts +1 -0
|
@@ -14,7 +14,6 @@ import { CommonModule, isPlatformServer, isPlatformBrowser, DOCUMENT, DatePipe }
|
|
|
14
14
|
import * as i5 from '@angular/forms';
|
|
15
15
|
import { FormsModule, Validators } from '@angular/forms';
|
|
16
16
|
import * as Cookie from 'ngx-cookie';
|
|
17
|
-
import { ResizeSensor } from 'css-element-queries';
|
|
18
17
|
import * as interact from 'interactjs';
|
|
19
18
|
import * as i4$2 from '@angular/material/paginator';
|
|
20
19
|
import { MatPaginatorIntl, MatPaginatorModule } from '@angular/material/paginator';
|
|
@@ -509,6 +508,22 @@ class ViewUtil {
|
|
|
509
508
|
static getStageHeight() {
|
|
510
509
|
return ViewUtil.window.innerHeight || ViewUtil.document.body.clientHeight;
|
|
511
510
|
}
|
|
511
|
+
static getBoundingRectangle(container) {
|
|
512
|
+
container = ViewUtil.parseElement(container);
|
|
513
|
+
if (_.isNil(container) || _.isNil(container.getBoundingClientRect)) {
|
|
514
|
+
return {
|
|
515
|
+
x: NaN,
|
|
516
|
+
y: NaN,
|
|
517
|
+
width: NaN,
|
|
518
|
+
height: NaN,
|
|
519
|
+
top: NaN,
|
|
520
|
+
right: NaN,
|
|
521
|
+
left: NaN,
|
|
522
|
+
bottom: NaN
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
return container.getBoundingClientRect();
|
|
526
|
+
}
|
|
512
527
|
static getWidth(container) {
|
|
513
528
|
container = ViewUtil.parseElement(container);
|
|
514
529
|
if (_.isNil(container)) {
|
|
@@ -516,7 +531,7 @@ class ViewUtil {
|
|
|
516
531
|
}
|
|
517
532
|
let value = parseFloat(ViewUtil.getStyle(container, 'width'));
|
|
518
533
|
if (_.isNaN(value)) {
|
|
519
|
-
value =
|
|
534
|
+
value = ViewUtil.getBoundingRectangle(container).width;
|
|
520
535
|
}
|
|
521
536
|
if (_.isNaN(value)) {
|
|
522
537
|
value = container.offsetWidth;
|
|
@@ -561,7 +576,7 @@ class ViewUtil {
|
|
|
561
576
|
}
|
|
562
577
|
let value = parseFloat(ViewUtil.getStyle(container, 'height'));
|
|
563
578
|
if (_.isNaN(value)) {
|
|
564
|
-
value =
|
|
579
|
+
value = ViewUtil.getBoundingRectangle(container).height;
|
|
565
580
|
}
|
|
566
581
|
if (_.isNaN(value)) {
|
|
567
582
|
value = container.offsetHeight;
|
|
@@ -1915,6 +1930,7 @@ class CanDeactivateGuard {
|
|
|
1915
1930
|
}
|
|
1916
1931
|
|
|
1917
1932
|
class ResizeManager {
|
|
1933
|
+
// protected sensor: ResizeSensor;
|
|
1918
1934
|
// --------------------------------------------------------------------------
|
|
1919
1935
|
//
|
|
1920
1936
|
// Constructor
|
|
@@ -1936,9 +1952,19 @@ class ResizeManager {
|
|
|
1936
1952
|
this.size = item;
|
|
1937
1953
|
this.subject.next(item);
|
|
1938
1954
|
};
|
|
1955
|
+
this.handler2 = (items) => {
|
|
1956
|
+
if (!_.isEmpty(items)) {
|
|
1957
|
+
this.handler(items[0].contentRect);
|
|
1958
|
+
}
|
|
1959
|
+
};
|
|
1939
1960
|
this.element = ViewUtil.parseElement(element);
|
|
1940
1961
|
this.subject = new BehaviorSubject({ width: ViewUtil.getWidth(this.element), height: ViewUtil.getHeight(this.element) });
|
|
1941
|
-
this.sensor = new ResizeSensor(this.element, this.handler);
|
|
1962
|
+
// this.sensor = new ResizeSensor(this.element, this.handler);
|
|
1963
|
+
try {
|
|
1964
|
+
this.sensor = new ResizeObserver(this.handler2);
|
|
1965
|
+
this.sensor.observe(this.element);
|
|
1966
|
+
}
|
|
1967
|
+
catch (error) { }
|
|
1942
1968
|
}
|
|
1943
1969
|
// --------------------------------------------------------------------------
|
|
1944
1970
|
//
|
|
@@ -1969,12 +1995,16 @@ class ResizeManager {
|
|
|
1969
1995
|
// --------------------------------------------------------------------------
|
|
1970
1996
|
destroy() {
|
|
1971
1997
|
if (!_.isNil(this.sensor)) {
|
|
1998
|
+
this.sensor.unobserve(this.element);
|
|
1999
|
+
this.sensor.disconnect();
|
|
2000
|
+
this.sensor = null;
|
|
2001
|
+
/*
|
|
1972
2002
|
this.sensor.detach(this.handler);
|
|
1973
2003
|
try {
|
|
1974
2004
|
this.sensor.reset();
|
|
1975
|
-
}
|
|
1976
|
-
catch (error) { }
|
|
2005
|
+
} catch (error) {}
|
|
1977
2006
|
this.sensor = null;
|
|
2007
|
+
*/
|
|
1978
2008
|
}
|
|
1979
2009
|
if (!_.isNil(this.subject)) {
|
|
1980
2010
|
this.subject.complete();
|