@coreui/angular 4.0.0-alpha.14 → 4.0.0-alpha.15

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.
@@ -289,7 +289,7 @@ class CollapseDirective {
289
289
  this.collapseChange = new EventEmitter();
290
290
  this.collapsing = false;
291
291
  this.host = this.hostElement.nativeElement;
292
- this.setDisplay(false);
292
+ this.renderer.setStyle(this.host, 'display', 'none');
293
293
  }
294
294
  /**
295
295
  * @ignore
@@ -334,7 +334,7 @@ class CollapseDirective {
334
334
  show: this.visible,
335
335
  'collapse-horizontal': this.horizontal,
336
336
  collapsing: this.collapsing
337
- // collapse: !this.collapsing
337
+ // collapse: !this.collapsing && !this.visible
338
338
  };
339
339
  }
340
340
  ngAfterViewInit() {
@@ -358,9 +358,7 @@ class CollapseDirective {
358
358
  }
359
359
  }
360
360
  toggle(visible = this.visible) {
361
- this.setDisplay(true);
362
361
  this.createPlayer(visible);
363
- this.visible = visible;
364
362
  this.player?.play();
365
363
  }
366
364
  destroyPlayer() {
@@ -370,14 +368,17 @@ class CollapseDirective {
370
368
  if (this.player?.hasStarted()) {
371
369
  this.destroyPlayer();
372
370
  }
373
- let animationFactory;
371
+ if (visible) {
372
+ this.renderer.removeStyle(this.host, 'display');
373
+ }
374
374
  const duration = this.animate ? this.duration : '0ms';
375
375
  const expand = this.horizontal ? expandHorizontalAnimation : expandAnimation;
376
376
  const collapse = this.horizontal ? collapseHorizontalAnimation : collapseAnimation;
377
- animationFactory = this.animationBuilder.build(useAnimation(visible ? expand : collapse, { params: { time: duration, easing: this.transition } }));
377
+ const animationFactory = this.animationBuilder.build(useAnimation(visible ? expand : collapse, { params: { time: duration, easing: this.transition } }));
378
378
  this.player = animationFactory.create(this.host);
379
379
  this.player.onStart(() => {
380
380
  this.setMaxSize();
381
+ this.visible = visible;
381
382
  this.collapsing = true;
382
383
  this.collapseChange.emit(visible ? 'opening' : 'collapsing');
383
384
  });
@@ -397,9 +398,6 @@ class CollapseDirective {
397
398
  }
398
399
  });
399
400
  }
400
- setDisplay(display) {
401
- display ? this.renderer.removeStyle(this.host, 'display') : this.renderer.setStyle(this.host, 'display', 'none');
402
- }
403
401
  }
404
402
  CollapseDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: CollapseDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i1.AnimationBuilder }], target: i0.ɵɵFactoryTarget.Directive });
405
403
  CollapseDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.6", type: CollapseDirective, selector: "[cCollapse]", inputs: { animate: "animate", horizontal: "horizontal", visible: "visible", navbar: "navbar", duration: "duration", transition: "transition" }, outputs: { collapseChange: "collapseChange" }, host: { properties: { "class": "this.hostClasses" } }, exportAs: ["cCollapse"], usesOnChanges: true, ngImport: i0 });