@colijnit/corecomponents_v12 12.0.101 → 12.0.102
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/bundles/colijnit-corecomponents_v12.umd.js +23 -18
- package/bundles/colijnit-corecomponents_v12.umd.js.map +1 -1
- package/colijnit-corecomponents_v12.metadata.json +1 -1
- package/esm2015/lib/directives/overlay/overlay.directive.js +25 -19
- package/fesm2015/colijnit-corecomponents_v12.js +23 -17
- package/fesm2015/colijnit-corecomponents_v12.js.map +1 -1
- package/lib/directives/overlay/overlay.directive.d.ts +4 -3
- package/package.json +1 -1
|
@@ -11462,6 +11462,7 @@
|
|
|
11462
11462
|
|
|
11463
11463
|
var OverlayDirective = /** @class */ (function () {
|
|
11464
11464
|
function OverlayDirective(elementRef) {
|
|
11465
|
+
this.keepInView = false;
|
|
11465
11466
|
this._elementRef = elementRef;
|
|
11466
11467
|
}
|
|
11467
11468
|
Object.defineProperty(OverlayDirective.prototype, "parent", {
|
|
@@ -11478,26 +11479,25 @@
|
|
|
11478
11479
|
enumerable: false,
|
|
11479
11480
|
configurable: true
|
|
11480
11481
|
});
|
|
11482
|
+
OverlayDirective.prototype.handleScroll = function (event) {
|
|
11483
|
+
this._checkAndPlaceElement();
|
|
11484
|
+
};
|
|
11481
11485
|
OverlayDirective.prototype.ngOnDestroy = function () {
|
|
11482
|
-
|
|
11483
|
-
window.removeEventListener("scroll", function (event) { return _this._handleScroll; });
|
|
11486
|
+
// document.removeEventListener("scroll", (event) => this._handleScroll(event), false);
|
|
11484
11487
|
this._observer.disconnect();
|
|
11485
11488
|
this._elementRef = undefined;
|
|
11486
11489
|
this._parent = undefined;
|
|
11487
11490
|
};
|
|
11488
11491
|
OverlayDirective.prototype.ngOnInit = function () {
|
|
11489
11492
|
var _this = this;
|
|
11490
|
-
|
|
11491
|
-
this.
|
|
11493
|
+
// document.addEventListener("scroll", (event) => this._handleScroll(event), false);
|
|
11494
|
+
this._checkAndPlaceElement();
|
|
11492
11495
|
this._observer = new ResizeObserver(function (entries) {
|
|
11493
|
-
|
|
11494
|
-
var elementRect = _this._elementRef.nativeElement.getBoundingClientRect();
|
|
11495
|
-
var parentRect = _this._parent.nativeElement.getBoundingClientRect();
|
|
11496
|
-
_this._placeElement(entry.contentRect.bottom, entry.contentRect.right, parentRect, elementRect);
|
|
11496
|
+
_this._checkAndPlaceElement();
|
|
11497
11497
|
});
|
|
11498
11498
|
this._observer.observe(document.body);
|
|
11499
11499
|
};
|
|
11500
|
-
OverlayDirective.prototype.
|
|
11500
|
+
OverlayDirective.prototype._checkAndPlaceElement = function () {
|
|
11501
11501
|
var elementRect = this._elementRef.nativeElement.getBoundingClientRect();
|
|
11502
11502
|
var parentRect = this._parent.nativeElement.getBoundingClientRect();
|
|
11503
11503
|
this._placeElement(window.innerHeight, window.innerWidth, parentRect, elementRect);
|
|
@@ -11509,16 +11509,19 @@
|
|
|
11509
11509
|
else {
|
|
11510
11510
|
this._elementRef.nativeElement.style.top = parentRect.bottom + "px";
|
|
11511
11511
|
}
|
|
11512
|
-
if (
|
|
11513
|
-
|
|
11514
|
-
|
|
11515
|
-
|
|
11516
|
-
|
|
11512
|
+
if (this.keepInView) {
|
|
11513
|
+
if (elementRect.right > window.innerWidth) {
|
|
11514
|
+
//see if we can move it to the left
|
|
11515
|
+
if ((window.innerWidth - elementRect.width) > 0) {
|
|
11516
|
+
this._elementRef.nativeElement.style.left = (window.innerWidth - elementRect.width) + "px";
|
|
11517
|
+
}
|
|
11518
|
+
else { //resize so it fits into view
|
|
11519
|
+
this._elementRef.nativeElement.style.width = window.innerWidth + "px";
|
|
11520
|
+
this._elementRef.nativeElement.style.left = 0;
|
|
11521
|
+
}
|
|
11522
|
+
}
|
|
11517
11523
|
}
|
|
11518
11524
|
};
|
|
11519
|
-
OverlayDirective.prototype._handleScroll = function (event) {
|
|
11520
|
-
console.log("scroll");
|
|
11521
|
-
};
|
|
11522
11525
|
return OverlayDirective;
|
|
11523
11526
|
}());
|
|
11524
11527
|
OverlayDirective.decorators = [
|
|
@@ -11530,7 +11533,9 @@
|
|
|
11530
11533
|
{ type: i0.ElementRef }
|
|
11531
11534
|
]; };
|
|
11532
11535
|
OverlayDirective.propDecorators = {
|
|
11533
|
-
parent: [{ type: i0.Input, args: ["overlay",] }]
|
|
11536
|
+
parent: [{ type: i0.Input, args: ["overlay",] }],
|
|
11537
|
+
keepInView: [{ type: i0.Input }],
|
|
11538
|
+
handleScroll: [{ type: i0.HostListener, args: ["document:scroll", ["$event"],] }]
|
|
11534
11539
|
};
|
|
11535
11540
|
|
|
11536
11541
|
var OverlayParentDirective = /** @class */ (function () {
|