@coolon/angular-ui-powerups 14.1.0 → 14.1.2

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.
@@ -7392,14 +7392,6 @@ class ActivityContainerComponent extends AbstractInteractionContext {
7392
7392
  this.busy = this.registerDisposable(new DelegatingValueModel().withDefault(false));
7393
7393
  this.registerDisposable(this.busy);
7394
7394
  }
7395
- ngOnInit() {
7396
- }
7397
- ngAfterViewInit() {
7398
- const { chain, observe } = Dsl.disposeWith(this);
7399
- // using the component directly rather than (animationDone)=.. allows us
7400
- // to keep our callback private.
7401
- observe.valuesFrom(this.tabs.animationDone).subscribe(() => this.onAnimationFinished());
7402
- }
7403
7395
  initialise(identifier, api) {
7404
7396
  assert.isFalsey(this.isInitialised());
7405
7397
  assert.notNil(identifier);
@@ -7495,7 +7487,6 @@ class ActivityContainerComponent extends AbstractInteractionContext {
7495
7487
  this._deferredCleanUp :
7496
7488
  true;
7497
7489
  }
7498
- // @Trace()
7499
7490
  finishAndStartCleanup() {
7500
7491
  if (!this._deferredCleanUp) {
7501
7492
  // Important:
@@ -7503,7 +7494,9 @@ class ActivityContainerComponent extends AbstractInteractionContext {
7503
7494
  // Without this our animation done wasn't called when a single
7504
7495
  // new activity followed a single tab activity (since we're tracking
7505
7496
  // by activity index)
7506
- this.activityRefs = [];
7497
+ setTimeout(() => {
7498
+ this.activityRefs = []; // we have to do it after the animation timeout or the activity disappears before the animatin finsihes
7499
+ }, this.getTabAnimationDuration());
7507
7500
  const promise = this.interactionServiceApi.notifyFinished(this);
7508
7501
  this._deferredCleanUp = promise
7509
7502
  .finally(() => {
@@ -7521,13 +7514,6 @@ class ActivityContainerComponent extends AbstractInteractionContext {
7521
7514
  return index;
7522
7515
  }
7523
7516
  ;
7524
- // @Trace()
7525
- onAnimationFinished() {
7526
- if (this.onAnimationFinishedJob) {
7527
- this.onAnimationFinishedJob();
7528
- this.onAnimationFinishedJob = undefined;
7529
- }
7530
- }
7531
7517
  /**
7532
7518
  * Synchronises the selected tab index.
7533
7519
  */
@@ -7541,18 +7527,30 @@ class ActivityContainerComponent extends AbstractInteractionContext {
7541
7527
  this.activityRefs[newIndex].setFocused(false);
7542
7528
  this.busy.setDelegate(this.activityRefs[newIndex].activityBusy);
7543
7529
  this.tabs.selectedIndex = newIndex;
7544
- this.onAnimationFinishedJob = () => {
7530
+ // Note: We're not using the animation done event as it's firing almost immeadiately.
7531
+ setTimeout(() => {
7545
7532
  this.activityRefs = this.activityRefs.filter(tab => !tab.isComplete());
7546
7533
  this.inAnimation.value = false;
7547
7534
  this.activityRefs.forEach((ref, index) => {
7548
7535
  ref.setFocused(index === newIndex);
7549
7536
  });
7550
- };
7537
+ }, this.getTabAnimationDuration());
7551
7538
  }
7552
7539
  }
7553
7540
  getSelectedOutlet() {
7554
7541
  return this.activityOutlets.toArray()[this.tabs.selectedIndex];
7555
7542
  }
7543
+ getTabAnimationDuration() {
7544
+ const match = this.tabs.animationDuration.match(/(\d+)(.*)/);
7545
+ const numericValue = parseFloat(match[1]);
7546
+ switch (match[2].trim()) {
7547
+ case "ms":
7548
+ return numericValue;
7549
+ case "s":
7550
+ return 1000 * numericValue;
7551
+ }
7552
+ return lang$1.illegalState(`unsupported duration string: ${this.tabs.animationDuration}`);
7553
+ }
7556
7554
  // @Trace()
7557
7555
  getSelectedTabIndex() {
7558
7556
  return this.tabs.selectedIndex;