@coolon/angular-ui-powerups 0.0.84 → 0.0.85

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.
@@ -7,7 +7,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
7
7
  import { GarbageCollector, assert, UnaryCommand, lang, Dsl, Logger, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, DelegatingValueModel, MutableStream, MutableListModel, DelegatingListModel, StoreInValueModel, Binding, MutableValueModel, Trace, Guard as Guard$1, Command, OptionsHelper, ValueHolder } from '@coolon/pectin';
8
8
  import { __decorate, __metadata, __awaiter } from 'tslib';
9
9
  import { PortalModule } from '@angular/cdk/portal';
10
- import { Router, RouterModule, UrlSegment, NavigationStart, NavigationEnd, NavigationError, RouterOutlet, ActivatedRouteSnapshot, RouterStateSnapshot, UrlSerializer } from '@angular/router';
10
+ import { Router, RouterModule, UrlSegment, NavigationStart, NavigationEnd, NavigationError, ActivatedRouteSnapshot, RouterStateSnapshot, UrlSerializer } from '@angular/router';
11
11
  import ___default, { last, isNil, isEqual } from 'lodash';
12
12
  import { assert as assert$1, Opts, Klass } from '@coolon/typescript-utilities';
13
13
  import { MatDialogConfig, MAT_DIALOG_DEFAULT_OPTIONS, MatDialog as MatDialog$1 } from '@angular/material/dialog';
@@ -3451,7 +3451,7 @@ class PlaceOutletComponent extends DisposableComponent {
3451
3451
  this._inRouteVisitUpdate = new Guard$1();
3452
3452
  this._activatedRouteModel = new MutableValueModel();
3453
3453
  this._placeDefinition = new MutableValueModel();
3454
- this.isOnInitialPlace = true;
3454
+ this.initialPlaceIndex = null;
3455
3455
  const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
3456
3456
  this.parentOutletModel = new MutableValueModel(parentOutlet);
3457
3457
  this._activePlaceVisitModel.setDelegate(new MutableValueModel());
@@ -3474,17 +3474,21 @@ class PlaceOutletComponent extends DisposableComponent {
3474
3474
  p => (/** @type {?} */ (p.constructor))));
3475
3475
  this.placeAnimationOrder = chain(this.customPlaceAnimationOrderModel)
3476
3476
  .otherwise(defaultPlaceAnimationOrder)
3477
- .indexOf(activatePlaceType)
3478
- .map((/**
3479
- * @param {?} order
3477
+ .reduce((/**
3478
+ * @param {?} placesInOrder
3480
3479
  * @return {?}
3481
3480
  */
3482
- order => {
3483
- // we get -1 on the first load which triggers an animation to the first page, so alway pin it to 0
3484
- // if we're animating.
3485
- return this.isOnInitialPlace ? 0 :
3486
- this.animate ? Math.max(order, 0) : 0;
3487
- }));
3481
+ (placesInOrder) => {
3482
+ /** @type {?} */
3483
+ let placeIndex = 0;
3484
+ if (activatePlaceType.value) {
3485
+ placeIndex = placesInOrder.indexOf(activatePlaceType.value);
3486
+ if (isNil(this.initialPlaceIndex)) {
3487
+ this.initialPlaceIndex = placeIndex;
3488
+ }
3489
+ }
3490
+ return isNil(this.initialPlaceIndex) ? 0 : placeIndex - this.initialPlaceIndex;
3491
+ }), { dependsOn: activatePlaceType });
3488
3492
  // Push incoming changes into the component
3489
3493
  this.routerVisit = chain(this._activePlace).pluck('placeDefinition').findIn(placeRouter.activeVisitIndex);
3490
3494
  // Our router visit will change when our active is nullified during deactivation, which will push a null visit
@@ -3521,18 +3525,26 @@ class PlaceOutletComponent extends DisposableComponent {
3521
3525
  */
3522
3526
  ngOnInit() {
3523
3527
  }
3528
+ // @Trace()
3529
+ /**
3530
+ * @return {?}
3531
+ */
3532
+ getAnimationOrder() {
3533
+ return this.placeAnimationOrder.value;
3534
+ }
3524
3535
  /**
3525
3536
  * @return {?}
3526
3537
  */
3527
3538
  get animationDuration() {
3528
3539
  return this.placeConfig && this.placeConfig.animationDuration ? this.placeConfig.animationDuration : '500ms';
3529
3540
  }
3541
+ // @Trace()
3530
3542
  /**
3531
3543
  * @param {?} visit
3532
3544
  * @return {?}
3533
3545
  */
3534
3546
  navigate(visit) {
3535
- console.log({ activatedRoute: this._activatedRouteModel.value });
3547
+ // console.log({ activatedRoute: this._activatedRouteModel.value });
3536
3548
  this.placeRouter.navigate(visit, {
3537
3549
  relativeTo: this.parentOutlet ? this.parentOutlet.activatedRouteModel.value : null
3538
3550
  });
@@ -3543,6 +3555,7 @@ class PlaceOutletComponent extends DisposableComponent {
3543
3555
  get parentOutlet() {
3544
3556
  return this.parentOutletModel.value;
3545
3557
  }
3558
+ // @Trace()
3546
3559
  /**
3547
3560
  * @return {?}
3548
3561
  */
@@ -3553,7 +3566,7 @@ class PlaceOutletComponent extends DisposableComponent {
3553
3566
  visit,
3554
3567
  place: visit ? visit.placeDefinition.component : null,
3555
3568
  inOutletActivation: this._inOutletActivation.value,
3556
- inRoutingSession: this.placeRouter.navigationSessionActive.value,
3569
+ inRoutingSession: this.placeRouter.navigationSessionActive.value
3557
3570
  });
3558
3571
  if (visit) { // can be null while the place and index sync up
3559
3572
  this._inRouteVisitUpdate.whileTrue((/**
@@ -3586,6 +3599,7 @@ class PlaceOutletComponent extends DisposableComponent {
3586
3599
  get activatedRouteModel() {
3587
3600
  return this._activatedRouteModel.readonly;
3588
3601
  }
3602
+ // @Trace()
3589
3603
  /**
3590
3604
  * @param {?} routerOutlet
3591
3605
  * @param {?} place
@@ -3614,6 +3628,7 @@ class PlaceOutletComponent extends DisposableComponent {
3614
3628
  this.animationDone();
3615
3629
  }
3616
3630
  }
3631
+ // @Trace()
3617
3632
  /**
3618
3633
  * @return {?}
3619
3634
  */
@@ -3622,19 +3637,20 @@ class PlaceOutletComponent extends DisposableComponent {
3622
3637
  * @return {?}
3623
3638
  */
3624
3639
  () => {
3625
- this.isOnInitialPlace = false;
3626
3640
  this._activePlace.value = null;
3627
3641
  this._activatedRouteModel.value = null;
3628
3642
  this._placeDefinition.value = null;
3629
3643
  this._activePlaceVisitModel.setDelegate(null);
3630
3644
  }));
3631
3645
  }
3646
+ // @Trace()
3632
3647
  /**
3633
3648
  * @return {?}
3634
3649
  */
3635
3650
  animationStarted() {
3636
3651
  console.log({ activePlace: this._activePlace.value });
3637
3652
  }
3653
+ // @Trace()
3638
3654
  /**
3639
3655
  * @return {?}
3640
3656
  */
@@ -3647,7 +3663,7 @@ class PlaceOutletComponent extends DisposableComponent {
3647
3663
  PlaceOutletComponent.decorators = [
3648
3664
  { type: Component, args: [{
3649
3665
  selector: 'aup-place-outlet',
3650
- template: "<div class=\"router-outlet-container\"\n [@routeAnimations]=\"{value: placeAnimationOrder.value, params:{duration: animationDuration}}\"\n (@routeAnimations.start)=\"animationStarted()\"\n (@routeAnimations.done)=\"animationDone()\"\n>\n <router-outlet #routerOutlet=\"outlet\"\n (activate)=\"onOutletActivated(routerOutlet, $event)\"\n (deactivate)=\"onOutletDeactivated()\">\n </router-outlet>\n</div>\n\n",
3666
+ template: "<div class=\"router-outlet-container\"\n [@routeAnimations]=\"{value: getAnimationOrder(), params:{duration: animationDuration}}\"\n (@routeAnimations.start)=\"animationStarted()\"\n (@routeAnimations.done)=\"animationDone()\"\n>\n <router-outlet #routerOutlet=\"outlet\"\n (activate)=\"onOutletActivated(routerOutlet, $event)\"\n (deactivate)=\"onOutletDeactivated()\">\n </router-outlet>\n</div>\n\n",
3651
3667
  animations: [LEFT_RIGHT_PLACE_ANIMATION],
3652
3668
  styles: [":host{display:flex;flex-direction:column;min-height:0;overflow-x:hidden}.router-outlet-container{flex:1;display:block;position:relative;min-height:0}router-outlet{display:none}"]
3653
3669
  }] }
@@ -3674,42 +3690,6 @@ __decorate([
3674
3690
  StoreInListModel('customPlaceAnimationOrderModel'),
3675
3691
  __metadata("design:type", Array)
3676
3692
  ], PlaceOutletComponent.prototype, "customPlaceAnimationOrder", void 0);
3677
- __decorate([
3678
- Trace(),
3679
- __metadata("design:type", Function),
3680
- __metadata("design:paramtypes", [Visit]),
3681
- __metadata("design:returntype", void 0)
3682
- ], PlaceOutletComponent.prototype, "navigate", null);
3683
- __decorate([
3684
- Trace(),
3685
- __metadata("design:type", Function),
3686
- __metadata("design:paramtypes", []),
3687
- __metadata("design:returntype", void 0)
3688
- ], PlaceOutletComponent.prototype, "pushRouteChangesToVisit", null);
3689
- __decorate([
3690
- Trace(),
3691
- __metadata("design:type", Function),
3692
- __metadata("design:paramtypes", [RouterOutlet, PlaceComponent]),
3693
- __metadata("design:returntype", void 0)
3694
- ], PlaceOutletComponent.prototype, "onOutletActivated", null);
3695
- __decorate([
3696
- Trace(),
3697
- __metadata("design:type", Function),
3698
- __metadata("design:paramtypes", []),
3699
- __metadata("design:returntype", void 0)
3700
- ], PlaceOutletComponent.prototype, "onOutletDeactivated", null);
3701
- __decorate([
3702
- Trace(),
3703
- __metadata("design:type", Function),
3704
- __metadata("design:paramtypes", []),
3705
- __metadata("design:returntype", void 0)
3706
- ], PlaceOutletComponent.prototype, "animationStarted", null);
3707
- __decorate([
3708
- Trace(),
3709
- __metadata("design:type", Function),
3710
- __metadata("design:paramtypes", []),
3711
- __metadata("design:returntype", void 0)
3712
- ], PlaceOutletComponent.prototype, "animationDone", null);
3713
3693
  if (false) {
3714
3694
  /** @type {?} */
3715
3695
  PlaceOutletComponent.prototype.animate;
@@ -3772,7 +3752,7 @@ if (false) {
3772
3752
  * @type {?}
3773
3753
  * @private
3774
3754
  */
3775
- PlaceOutletComponent.prototype.isOnInitialPlace;
3755
+ PlaceOutletComponent.prototype.initialPlaceIndex;
3776
3756
  /**
3777
3757
  * @type {?}
3778
3758
  * @private