@kirbydesign/designsystem 4.0.12 → 4.0.13

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.
@@ -3809,6 +3809,42 @@
3809
3809
  return Array.isArray(value) && value.every(function (item) { return typeof item === 'number'; });
3810
3810
  }
3811
3811
 
3812
+ var ComponentLoaderDirective = /** @class */ (function () {
3813
+ function ComponentLoaderDirective(componentFactoryResolver, viewContainerRef, renderer) {
3814
+ this.componentFactoryResolver = componentFactoryResolver;
3815
+ this.viewContainerRef = viewContainerRef;
3816
+ this.renderer = renderer;
3817
+ }
3818
+ ComponentLoaderDirective.prototype.ngOnInit = function () {
3819
+ this.loadCard();
3820
+ };
3821
+ ComponentLoaderDirective.prototype.loadCard = function () {
3822
+ var componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.configuration.component);
3823
+ this.viewContainerRef.clear();
3824
+ var componentRef = this.viewContainerRef.createComponent(componentFactory);
3825
+ if (componentRef && componentRef.location && componentRef.location.nativeElement) {
3826
+ this.renderer.addClass(componentRef.location.nativeElement, this.cssClass);
3827
+ }
3828
+ componentRef.instance.data = this.configuration.data;
3829
+ };
3830
+ return ComponentLoaderDirective;
3831
+ }());
3832
+ ComponentLoaderDirective.decorators = [
3833
+ { type: i0.Directive, args: [{
3834
+ selector: '[kirbyLoadComponent]',
3835
+ },] }
3836
+ ];
3837
+ /** @nocollapse */
3838
+ ComponentLoaderDirective.ctorParameters = function () { return [
3839
+ { type: i0.ComponentFactoryResolver },
3840
+ { type: i0.ViewContainerRef },
3841
+ { type: i0.Renderer2 }
3842
+ ]; };
3843
+ ComponentLoaderDirective.propDecorators = {
3844
+ configuration: [{ type: i0.Input, args: ['kirbyLoadComponent',] }],
3845
+ cssClass: [{ type: i0.Input }]
3846
+ };
3847
+
3812
3848
  function deepCopy(obj) {
3813
3849
  return JSON.parse(JSON.stringify(obj));
3814
3850
  }
@@ -4246,7 +4282,34 @@
4246
4282
  configurable: true
4247
4283
  });
4248
4284
  ChartComponent.prototype.ngAfterViewInit = function () {
4249
- this.renderChart();
4285
+ var _this = this;
4286
+ /*
4287
+ A chart is not rendered until it has both a height and a width.
4288
+ If ChartComponent is slotted in an ionic component it will
4289
+ not have any height or width on afterViewInit. This will cause
4290
+ the animation to not be played on first draw.
4291
+ */
4292
+ var canvasElement = this.canvasElement.nativeElement;
4293
+ this.whenElementHasHeightAndWidth(canvasElement).then(function () { return _this.renderChart(); });
4294
+ };
4295
+ ChartComponent.prototype.whenElementHasHeightAndWidth = function (element) {
4296
+ var rectIs2D = function (_a) {
4297
+ var width = _a.width, height = _a.height;
4298
+ return height > 0 && width > 0;
4299
+ };
4300
+ return new Promise(function (resolve) {
4301
+ var initialClientRect = element.getBoundingClientRect();
4302
+ if (rectIs2D(initialClientRect))
4303
+ resolve();
4304
+ var resizeObserver = new ResizeObserverFactory().create(function (_a) {
4305
+ var _b = __read(_a, 1), resizeObserverEntry = _b[0];
4306
+ if (rectIs2D(resizeObserverEntry.contentRect)) {
4307
+ resizeObserver.unobserve(element);
4308
+ resolve();
4309
+ }
4310
+ });
4311
+ resizeObserver.observe(element);
4312
+ });
4250
4313
  };
4251
4314
  ChartComponent.prototype.ngOnChanges = function (simpleChanges) {
4252
4315
  var _this = this;
@@ -8584,42 +8647,6 @@
8584
8647
  },] }
8585
8648
  ];
8586
8649
 
8587
- var ComponentLoaderDirective = /** @class */ (function () {
8588
- function ComponentLoaderDirective(componentFactoryResolver, viewContainerRef, renderer) {
8589
- this.componentFactoryResolver = componentFactoryResolver;
8590
- this.viewContainerRef = viewContainerRef;
8591
- this.renderer = renderer;
8592
- }
8593
- ComponentLoaderDirective.prototype.ngOnInit = function () {
8594
- this.loadCard();
8595
- };
8596
- ComponentLoaderDirective.prototype.loadCard = function () {
8597
- var componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.configuration.component);
8598
- this.viewContainerRef.clear();
8599
- var componentRef = this.viewContainerRef.createComponent(componentFactory);
8600
- if (componentRef && componentRef.location && componentRef.location.nativeElement) {
8601
- this.renderer.addClass(componentRef.location.nativeElement, this.cssClass);
8602
- }
8603
- componentRef.instance.data = this.configuration.data;
8604
- };
8605
- return ComponentLoaderDirective;
8606
- }());
8607
- ComponentLoaderDirective.decorators = [
8608
- { type: i0.Directive, args: [{
8609
- selector: '[kirbyLoadComponent]',
8610
- },] }
8611
- ];
8612
- /** @nocollapse */
8613
- ComponentLoaderDirective.ctorParameters = function () { return [
8614
- { type: i0.ComponentFactoryResolver },
8615
- { type: i0.ViewContainerRef },
8616
- { type: i0.Renderer2 }
8617
- ]; };
8618
- ComponentLoaderDirective.propDecorators = {
8619
- configuration: [{ type: i0.Input, args: ['kirbyLoadComponent',] }],
8620
- cssClass: [{ type: i0.Input }]
8621
- };
8622
-
8623
8650
  (function (SegmentedControlMode) {
8624
8651
  SegmentedControlMode["chip"] = "chip";
8625
8652
  SegmentedControlMode["compactChip"] = "compactChip";