@colijnit/corecomponents_v12 12.0.100 → 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.
@@ -2027,21 +2027,34 @@
2027
2027
  ];
2028
2028
 
2029
2029
  var ImageComponent = /** @class */ (function () {
2030
- function ImageComponent() {
2030
+ function ImageComponent(_sanitizer) {
2031
+ this._sanitizer = _sanitizer;
2032
+ this.showClass = true;
2033
+ this.error = false;
2034
+ this._defaultPlaceholder = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50"><path d="M35,18l-3-4H22l-3,4H16V36H40V18ZM24,16h6v2H24Zm2.5,18A6.5,6.5,0,1,1,33,27.5,6.51,6.51,0,0,1,26.5,34ZM38,22H36V20h2Z" fill="#484f60"/><rect x="10" y="18" width="5" height="18" fill="#484f60"/><rect x="11" y="15" width="3" height="2" fill="#484f60"/><path d="M26.5,32A4.5,4.5,0,1,1,31,27.5,4.51,4.51,0,0,1,26.5,32Z" fill="#484f60"/></svg>';
2031
2035
  }
2036
+ ImageComponent.prototype.ngOnInit = function () {
2037
+ this.innerPlaceHolder = this._sanitizer.bypassSecurityTrustHtml(this.placeHolder ? this.placeHolder : this._defaultPlaceholder);
2038
+ };
2039
+ ImageComponent.prototype.handleImageError = function (event) {
2040
+ this.error = true;
2041
+ };
2032
2042
  return ImageComponent;
2033
2043
  }());
2034
2044
  ImageComponent.decorators = [
2035
2045
  { type: i0.Component, args: [{
2036
2046
  selector: "co-image",
2037
- template: "\n <img *ngIf=\"!!source\" [src]=\"source\">\n ",
2038
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
2039
- styles: [":host{display:inline-block}img{width:100%;height:100%;object-fit:contain}\n"]
2047
+ template: "\n <ng-container *ngIf=\"!error\">\n <img *ngIf=\"!!source\" [src]=\"source\" (error)=\"handleImageError($event)\">\n </ng-container>\n <ng-container *ngIf=\"error || !source\">\n <div class=\"no-image-wrapper\">\n <co-icon [iconData]=\"innerPlaceHolder\"></co-icon>\n <span [textContent]=\"'geen afbeelding'\"></span>\n </div>\n </ng-container>\n ",
2048
+ encapsulation: i0.ViewEncapsulation.None
2040
2049
  },] }
2041
2050
  ];
2042
- ImageComponent.ctorParameters = function () { return []; };
2051
+ ImageComponent.ctorParameters = function () { return [
2052
+ { type: platformBrowser.DomSanitizer }
2053
+ ]; };
2043
2054
  ImageComponent.propDecorators = {
2044
- source: [{ type: i0.Input }]
2055
+ source: [{ type: i0.Input }],
2056
+ placeHolder: [{ type: i0.Input }],
2057
+ showClass: [{ type: i0.HostBinding, args: ["class.co-image",] }]
2045
2058
  };
2046
2059
 
2047
2060
  var ImageModule = /** @class */ (function () {
@@ -2051,7 +2064,7 @@
2051
2064
  }());
2052
2065
  ImageModule.decorators = [
2053
2066
  { type: i0.NgModule, args: [{
2054
- imports: [common.CommonModule],
2067
+ imports: [common.CommonModule, IconModule],
2055
2068
  declarations: [ImageComponent],
2056
2069
  exports: [ImageComponent]
2057
2070
  },] }
@@ -11449,6 +11462,7 @@
11449
11462
 
11450
11463
  var OverlayDirective = /** @class */ (function () {
11451
11464
  function OverlayDirective(elementRef) {
11465
+ this.keepInView = false;
11452
11466
  this._elementRef = elementRef;
11453
11467
  }
11454
11468
  Object.defineProperty(OverlayDirective.prototype, "parent", {
@@ -11465,26 +11479,25 @@
11465
11479
  enumerable: false,
11466
11480
  configurable: true
11467
11481
  });
11482
+ OverlayDirective.prototype.handleScroll = function (event) {
11483
+ this._checkAndPlaceElement();
11484
+ };
11468
11485
  OverlayDirective.prototype.ngOnDestroy = function () {
11469
- var _this = this;
11470
- window.removeEventListener("scroll", function (event) { return _this._handleScroll; });
11486
+ // document.removeEventListener("scroll", (event) => this._handleScroll(event), false);
11471
11487
  this._observer.disconnect();
11472
11488
  this._elementRef = undefined;
11473
11489
  this._parent = undefined;
11474
11490
  };
11475
11491
  OverlayDirective.prototype.ngOnInit = function () {
11476
11492
  var _this = this;
11477
- window.addEventListener("scroll", function (event) { return _this._handleScroll; });
11478
- this._initiallyPlaceElement();
11493
+ // document.addEventListener("scroll", (event) => this._handleScroll(event), false);
11494
+ this._checkAndPlaceElement();
11479
11495
  this._observer = new ResizeObserver(function (entries) {
11480
- var entry = entries[0];
11481
- var elementRect = _this._elementRef.nativeElement.getBoundingClientRect();
11482
- var parentRect = _this._parent.nativeElement.getBoundingClientRect();
11483
- _this._placeElement(entry.contentRect.bottom, entry.contentRect.right, parentRect, elementRect);
11496
+ _this._checkAndPlaceElement();
11484
11497
  });
11485
11498
  this._observer.observe(document.body);
11486
11499
  };
11487
- OverlayDirective.prototype._initiallyPlaceElement = function () {
11500
+ OverlayDirective.prototype._checkAndPlaceElement = function () {
11488
11501
  var elementRect = this._elementRef.nativeElement.getBoundingClientRect();
11489
11502
  var parentRect = this._parent.nativeElement.getBoundingClientRect();
11490
11503
  this._placeElement(window.innerHeight, window.innerWidth, parentRect, elementRect);
@@ -11496,16 +11509,19 @@
11496
11509
  else {
11497
11510
  this._elementRef.nativeElement.style.top = parentRect.bottom + "px";
11498
11511
  }
11499
- if (right < parentRect.left + elementRect.width) { // make sure it fits at the right
11500
- this._elementRef.nativeElement.style.left = (parentRect.right - elementRect.width) + "px";
11501
- }
11502
- else {
11503
- this._elementRef.nativeElement.style.left = parentRect.left + "px";
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
+ }
11504
11523
  }
11505
11524
  };
11506
- OverlayDirective.prototype._handleScroll = function (event) {
11507
- console.log("scroll");
11508
- };
11509
11525
  return OverlayDirective;
11510
11526
  }());
11511
11527
  OverlayDirective.decorators = [
@@ -11517,7 +11533,9 @@
11517
11533
  { type: i0.ElementRef }
11518
11534
  ]; };
11519
11535
  OverlayDirective.propDecorators = {
11520
- 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"],] }]
11521
11539
  };
11522
11540
 
11523
11541
  var OverlayParentDirective = /** @class */ (function () {