@coolon/angular-ui-powerups 14.1.0 → 14.1.1

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.
@@ -39,7 +39,7 @@ import { MatTableModule } from '@angular/material/table';
39
39
  import * as i4 from '@angular/material/tooltip';
40
40
  import { MatTooltipModule } from '@angular/material/tooltip';
41
41
  import * as i1$3 from '@coolon/pectin';
42
- import { GarbageCollector, DelegatingValueModel, assert, UnaryCommand, lang, Dsl, Logger, TrackExternal, ValueModel, StoreInValueModel, Command, MutableListModel, StoreInListModel, Disposable, DelegatingListModel, MutableValueModel, FocusManager, EventListenerList, Form, Guard, Binding, DebugContext, ListModel, Functions, MultipleSelectionModel, AbstractComputedListModel, DelegatingSelectionModel, DelegateProxyHandler, DirtyTrackingForm, PagedListModel, PageController, ComputedListModel, Deferred } from '@coolon/pectin';
42
+ import { GarbageCollector, DelegatingValueModel, assert, UnaryCommand, lang, Dsl, Logger, TrackExternal, ValueModel, StoreInValueModel, Command, MutableListModel, StoreInListModel, Disposable, DelegatingListModel, MutableValueModel, FocusManager, EventListenerList, Form, Guard, Binding, DebugContext, ListModel, Functions, MultipleSelectionModel, AbstractComputedListModel, DelegatingSelectionModel, DelegateProxyHandler, DirtyTrackingForm, PagedListModel, PageController, ComputedListModel, Deferred, Trace } from '@coolon/pectin';
43
43
  import { __decorate, __param, __metadata } from 'tslib';
44
44
  import * as i1 from '@angular/platform-browser';
45
45
  import escapeStringRegexp from 'escape-string-regexp';
@@ -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;
@@ -7572,6 +7570,12 @@ class ActivityContainerComponent extends AbstractInteractionContext {
7572
7570
  }
7573
7571
  ActivityContainerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: ActivityContainerComponent, deps: [{ token: PlaceRouter }], target: i0.ɵɵFactoryTarget.Component });
7574
7572
  ActivityContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.7", type: ActivityContainerComponent, selector: "aup-activity-container", inputs: { dynamicHeight: "dynamicHeight" }, viewQueries: [{ propertyName: "tabs", first: true, predicate: ["tabs"], descendants: true, static: true }, { propertyName: "activityOutlets", predicate: ActivityOutletComponent, descendants: true }], usesInheritance: true, ngImport: i0, template: "<mat-tab-group #tabs no-tab-header\n [dynamicHeight]=\"dynamicHeight\"\n [class.full-height-tabs]=\"!dynamicHeight\">\n <mat-tab *ngFor=\"let activityRef of activityRefs; let i = index; trackBy: activityIndex\">\n <aup-busy-overlay [busyModel]=\"busy\" cdkTrapFocus cdkTrapFocusAutoCapture>\n <!--\n We have issues where angular is triggering a leave animation when an\n new activity is started, but is not running the enter animation\n when it is scrolled back into view. So we track the tab changes and\n disable all animations inside the tab while we're animating.\n -->\n <div class=\"activity-outlet-wrapper\" [@.disabled]=\"!activityRef.focused\">\n <aup-activity-outlet [nestedInteractionContext]=\"this\" [activityRef]=\"activityRef\"></aup-activity-outlet>\n </div>\n </aup-busy-overlay>\n </mat-tab>\n</mat-tab-group>\n", styles: [":host{display:flex;flex-direction:column}mat-tab-group{flex:1}aup-busy-overlay{flex:1}.activity-outlet-wrapper{flex:1}\n"], dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: i2$6.MatTabGroup, selector: "mat-tab-group", inputs: ["color", "disableRipple"], exportAs: ["matTabGroup"] }, { kind: "component", type: i2$6.MatTab, selector: "mat-tab", inputs: ["disabled", "label", "aria-label", "aria-labelledby", "labelClass", "bodyClass"], exportAs: ["matTab"] }, { kind: "component", type: BusyOverlayComponent, selector: "aup-busy-overlay", inputs: ["busyModel", "busy"] }, { kind: "directive", type: i5$1.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "component", type: ActivityOutletComponent, selector: "aup-activity-outlet", inputs: ["nestedInteractionContext", "activityRef"] }] });
7573
+ __decorate([
7574
+ Trace(),
7575
+ __metadata("design:type", Function),
7576
+ __metadata("design:paramtypes", []),
7577
+ __metadata("design:returntype", void 0)
7578
+ ], ActivityContainerComponent.prototype, "finishAndStartCleanup", null);
7575
7579
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: ActivityContainerComponent, decorators: [{
7576
7580
  type: Component,
7577
7581
  args: [{ selector: "aup-activity-container", template: "<mat-tab-group #tabs no-tab-header\n [dynamicHeight]=\"dynamicHeight\"\n [class.full-height-tabs]=\"!dynamicHeight\">\n <mat-tab *ngFor=\"let activityRef of activityRefs; let i = index; trackBy: activityIndex\">\n <aup-busy-overlay [busyModel]=\"busy\" cdkTrapFocus cdkTrapFocusAutoCapture>\n <!--\n We have issues where angular is triggering a leave animation when an\n new activity is started, but is not running the enter animation\n when it is scrolled back into view. So we track the tab changes and\n disable all animations inside the tab while we're animating.\n -->\n <div class=\"activity-outlet-wrapper\" [@.disabled]=\"!activityRef.focused\">\n <aup-activity-outlet [nestedInteractionContext]=\"this\" [activityRef]=\"activityRef\"></aup-activity-outlet>\n </div>\n </aup-busy-overlay>\n </mat-tab>\n</mat-tab-group>\n", styles: [":host{display:flex;flex-direction:column}mat-tab-group{flex:1}aup-busy-overlay{flex:1}.activity-outlet-wrapper{flex:1}\n"] }]
@@ -7583,7 +7587,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImpor
7583
7587
  }], activityOutlets: [{
7584
7588
  type: ViewChildren,
7585
7589
  args: [ActivityOutletComponent]
7586
- }] } });
7590
+ }], finishAndStartCleanup: [] } });
7587
7591
 
7588
7592
  class AbstractActivityTriggerComponent extends DisposableComponent {
7589
7593
  constructor() {