@coolon/angular-ui-powerups 0.0.80 → 0.0.83

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.
Files changed (24) hide show
  1. package/bundles/coolon-angular-ui-powerups.umd.js +86 -35
  2. package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
  3. package/bundles/coolon-angular-ui-powerups.umd.min.js +1 -1
  4. package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
  5. package/coolon-angular-ui-powerups.metadata.json +1 -1
  6. package/esm2015/lib/interaction/components/alert-dialog/alert-dialog.component.js +3 -3
  7. package/esm2015/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.js +3 -3
  8. package/esm2015/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.js +3 -3
  9. package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +52 -19
  10. package/esm2015/lib/place/place-component.js +13 -4
  11. package/esm2015/lib/place/place.module.js +5 -2
  12. package/esm5/lib/interaction/components/alert-dialog/alert-dialog.component.js +3 -3
  13. package/esm5/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.js +3 -3
  14. package/esm5/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.js +3 -3
  15. package/esm5/lib/place/components/place-outlet/place-outlet.component.js +57 -29
  16. package/esm5/lib/place/place-component.js +26 -4
  17. package/esm5/lib/place/place.module.js +5 -2
  18. package/fesm2015/coolon-angular-ui-powerups.js +69 -26
  19. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  20. package/fesm5/coolon-angular-ui-powerups.js +87 -36
  21. package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
  22. package/lib/place/components/place-outlet/place-outlet.component.d.ts +3 -9
  23. package/lib/place/place-component.d.ts +8 -3
  24. package/package.json +1 -1
@@ -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, ActivatedRouteSnapshot, RouterStateSnapshot, UrlSerializer } from '@angular/router';
10
+ import { Router, RouterModule, UrlSegment, NavigationStart, NavigationEnd, NavigationError, RouterOutlet, 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';
@@ -1043,8 +1043,8 @@ class AlertDialogComponent extends AbstractActivity {
1043
1043
  AlertDialogComponent.decorators = [
1044
1044
  { type: Component, args: [{
1045
1045
  selector: 'aup-alert-dialog',
1046
- template: "<h3 matDialogTitle *ngIf=\"alert.title\">{{alert.title()}}</h3>\n<div matDialogContent>\n <p *ngFor=\"let line of alert.content()\">{{line}}</p>\n</div>\n<p matDialogActions>\n <button mat-raised-button color=\"primary\" (click)=\"done()\" data-cy=\"close-button\">{{alert.ok()}}</button>\n</p>\n",
1047
- styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-actions{justify-content:flex-end}"]
1046
+ template: "<h3 matDialogTitle *ngIf=\"alert.title\">{{alert.title()}}</h3>\n<div matDialogContent>\n <p *ngFor=\"let line of alert.content()\">{{line}}</p>\n</div>\n<div matDialogActions>\n <button mat-raised-button color=\"primary\" (click)=\"done()\" data-cy=\"close-button\">{{alert.ok()}}</button>\n</div>\n",
1047
+ styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-content{margin:0;padding:0}.mat-dialog-actions{justify-content:flex-end}"]
1048
1048
  }] }
1049
1049
  ];
1050
1050
  /** @nocollapse */
@@ -1111,8 +1111,8 @@ class ConfirmThenDialogComponent extends AbstractActivity {
1111
1111
  ConfirmThenDialogComponent.decorators = [
1112
1112
  { type: Component, args: [{
1113
1113
  selector: 'aup-confirmation-dialog',
1114
- template: "<h3 matDialogTitle *ngIf=\"confirm.title\">{{confirm.title()}}</h3>\n<div matDialogContent>\n <p *ngFor=\"let line of confirm.content()\">{{line}}</p>\n</div>\n<p matDialogActions>\n <button mat-button (click)=\"cancel()\" data-cy=\"cancel-button\">{{confirm.cancel()}}</button>\n <button mat-raised-button [color]=\"isDestructive() ? 'warn' : 'primary'\"\n (click)=\"onConfirm()\" data-cy=\"confirm-button\">{{confirm.ok()}}</button>\n</p>\n\n",
1115
- styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-actions{justify-content:flex-end}"]
1114
+ template: "<h3 matDialogTitle *ngIf=\"confirm.title\">{{confirm.title()}}</h3>\n<div matDialogContent>\n <p *ngFor=\"let line of confirm.content()\">{{line}}</p>\n</div>\n<div matDialogActions>\n <button mat-button (click)=\"cancel()\" data-cy=\"cancel-button\">{{confirm.cancel()}}</button>\n <button mat-raised-button [color]=\"isDestructive() ? 'warn' : 'primary'\"\n (click)=\"onConfirm()\" data-cy=\"confirm-button\">{{confirm.ok()}}</button>\n</div>\n\n",
1115
+ styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-content{margin:0;padding:0}.mat-dialog-actions{justify-content:flex-end}"]
1116
1116
  }] }
1117
1117
  ];
1118
1118
  /** @nocollapse */
@@ -1171,8 +1171,8 @@ class ConfirmationDialogComponent extends AbstractActivity {
1171
1171
  ConfirmationDialogComponent.decorators = [
1172
1172
  { type: Component, args: [{
1173
1173
  selector: 'aup-confirmation-dialog',
1174
- template: "<h3 matDialogTitle *ngIf=\"confirm.title\">{{confirm.title()}}</h3>\n<div matDialogContent>\n <p *ngFor=\"let line of confirm.content()\">{{line}}</p>\n</div>\n<p matDialogActions>\n <button mat-button (click)=\"cancel()\" data-cy=\"cancel-button\">{{confirm.cancel()}}</button>\n <button mat-raised-button [color]=\"isDestructive() ? 'warn' : 'primary'\"\n (click)=\"done()\" data-cy=\"confirm-button\">{{confirm.ok()}}</button>\n</p>\n\n",
1175
- styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-actions{justify-content:flex-end}"]
1174
+ template: "<h3 matDialogTitle *ngIf=\"confirm.title\">{{confirm.title()}}</h3>\n<div matDialogContent>\n <p *ngFor=\"let line of confirm.content()\">{{line}}</p>\n</div>\n<div matDialogActions>\n <button mat-button (click)=\"cancel()\" data-cy=\"cancel-button\">{{confirm.cancel()}}</button>\n <button mat-raised-button [color]=\"isDestructive() ? 'warn' : 'primary'\"\n (click)=\"done()\" data-cy=\"confirm-button\">{{confirm.ok()}}</button>\n</div>\n\n",
1175
+ styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-content{margin:0;padding:0}.mat-dialog-actions{justify-content:flex-end}"]
1176
1176
  }] }
1177
1177
  ];
1178
1178
  /** @nocollapse */
@@ -2584,7 +2584,7 @@ const DEFINITION_META_DATA_KEY = 'PLACE_DEFINITION_OPTIONS';
2584
2584
  // this one seems ok.
2585
2585
  /** @type {?} */
2586
2586
  const ROUTE_PARAMETER_LIST_KEY = Symbol('place:route:parameters');
2587
- class PlaceComponent extends DisposableComponent {
2587
+ class PlaceComponent extends GarbageCollector {
2588
2588
  constructor() {
2589
2589
  super();
2590
2590
  }
@@ -2662,6 +2662,16 @@ class PlaceComponent extends DisposableComponent {
2662
2662
  */
2663
2663
  onPlaceReady() {
2664
2664
  }
2665
+ /**
2666
+ * Called by the place outlet after all animations have finished. We need this instead of ngOnDestroy
2667
+ * to avoid the fact that the angular router calls it before the animations have run causing the component
2668
+ * to loose any pectin bindings.
2669
+ * @return {?}
2670
+ */
2671
+ // @Trace()
2672
+ onPlaceDestroyed() {
2673
+ this.dispose();
2674
+ }
2665
2675
  }
2666
2676
  __decorate([
2667
2677
  Memoize$1(),
@@ -3425,13 +3435,14 @@ class PlaceOutletComponent extends DisposableComponent {
3425
3435
  this.animate = true;
3426
3436
  this.placeChanged = new EventEmitter();
3427
3437
  this._activePlace = new MutableValueModel();
3428
- this._placeVisit = new MutableValueModel();
3438
+ this._activePlaceVisitModel = new DelegatingValueModel();
3429
3439
  this._inOutletUpdate = new Guard$1();
3430
3440
  this._activatedRouteModel = new MutableValueModel();
3431
3441
  this._placeDefinition = new MutableValueModel();
3432
3442
  this.isOnInitialPlace = true;
3433
3443
  const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
3434
3444
  this.parentOutletModel = new MutableValueModel(parentOutlet);
3445
+ this._activePlaceVisitModel.setDelegate(new MutableValueModel());
3435
3446
  /** @type {?} */
3436
3447
  const defaultPlaceAnimationOrder = chain(this.parentOutletModel)
3437
3448
  .pullValueModel((/**
@@ -3439,9 +3450,9 @@ class PlaceOutletComponent extends DisposableComponent {
3439
3450
  * @return {?}
3440
3451
  */
3441
3452
  o => o.activePlaceModel))
3442
- .pluck("placeDefinition")
3443
- .pluckList("children")
3444
- .pluck("component");
3453
+ .pluck('placeDefinition')
3454
+ .pluckList('children')
3455
+ .pluck('component');
3445
3456
  /** @type {?} */
3446
3457
  const activatePlaceType = chain(this.activePlaceModel).map((/**
3447
3458
  * @param {?} p
@@ -3471,17 +3482,18 @@ class PlaceOutletComponent extends DisposableComponent {
3471
3482
  * @return {?}
3472
3483
  */
3473
3484
  (visit) => {
3485
+ console.log("### Route visit changed");
3474
3486
  if (visit) { // can be null while the place and index sync up
3475
3487
  inRouteVisitUpdate.whileTrue((/**
3476
3488
  * @return {?}
3477
3489
  */
3478
3490
  () => {
3479
- this._placeVisit.value = visit;
3491
+ this._activePlaceVisitModel.value = visit;
3480
3492
  }));
3481
3493
  }
3482
3494
  }));
3483
3495
  // Handle component based changes
3484
- when.valueOf(this._placeVisit).changes((/**
3496
+ when.valueOf(this._activePlaceVisitModel).changes((/**
3485
3497
  * @param {?} next
3486
3498
  * @param {?} previous
3487
3499
  * @return {?}
@@ -3489,7 +3501,7 @@ class PlaceOutletComponent extends DisposableComponent {
3489
3501
  (next, previous) => {
3490
3502
  this.pushVisitChangesToRoute(next, previous);
3491
3503
  }), {
3492
- unless: inRouteVisitUpdate
3504
+ unless: valueOf.any(this._inOutletUpdate, inRouteVisitUpdate).areTruthy()
3493
3505
  });
3494
3506
  chain(this._activePlace)
3495
3507
  .postponeWhile(placeRouter.navigationSessionActive)
@@ -3510,7 +3522,7 @@ class PlaceOutletComponent extends DisposableComponent {
3510
3522
  * @return {?}
3511
3523
  */
3512
3524
  get animationDuration() {
3513
- return this.placeConfig && this.placeConfig.animationDuration ? this.placeConfig.animationDuration : "500ms";
3525
+ return this.placeConfig && this.placeConfig.animationDuration ? this.placeConfig.animationDuration : '500ms';
3514
3526
  }
3515
3527
  /**
3516
3528
  * @param {?} visit
@@ -3550,7 +3562,6 @@ class PlaceOutletComponent extends DisposableComponent {
3550
3562
  get activatedRouteModel() {
3551
3563
  return this._activatedRouteModel.readonly;
3552
3564
  }
3553
- // @Trace()
3554
3565
  /**
3555
3566
  * @param {?} routerOutlet
3556
3567
  * @param {?} place
@@ -3565,7 +3576,10 @@ class PlaceOutletComponent extends DisposableComponent {
3565
3576
  this._activePlace.value = place;
3566
3577
  this._activatedRouteModel.value = routerOutlet.activatedRoute;
3567
3578
  this._placeDefinition.value = place.placeDefinition;
3568
- place.initialiseBindings(this._placeVisit);
3579
+ /** @type {?} */
3580
+ const visitModel = new MutableValueModel();
3581
+ this._activePlaceVisitModel.setDelegate(visitModel);
3582
+ place.initialiseBindings(visitModel);
3569
3583
  }
3570
3584
  catch (error) {
3571
3585
  console.error(error);
@@ -3576,23 +3590,27 @@ class PlaceOutletComponent extends DisposableComponent {
3576
3590
  this.animationDone();
3577
3591
  }
3578
3592
  }
3579
- // @Trace()
3580
3593
  /**
3581
- * @param {?} routerOutlet
3582
- * @param {?} $event
3583
3594
  * @return {?}
3584
3595
  */
3585
- onOutletDeactivated(routerOutlet, $event) {
3596
+ onOutletDeactivated() {
3586
3597
  this._inOutletUpdate.whileTrue((/**
3587
3598
  * @return {?}
3588
3599
  */
3589
3600
  () => {
3601
+ this._activePlaceVisitModel.setDelegate(null);
3590
3602
  this.isOnInitialPlace = false;
3591
3603
  this._activePlace.value = null;
3592
3604
  this._activatedRouteModel.value = null;
3593
3605
  this._placeDefinition.value = null;
3594
3606
  }));
3595
3607
  }
3608
+ /**
3609
+ * @return {?}
3610
+ */
3611
+ animationStarted() {
3612
+ console.log({ activePlace: this._activePlace.value });
3613
+ }
3596
3614
  /**
3597
3615
  * @return {?}
3598
3616
  */
@@ -3605,7 +3623,7 @@ class PlaceOutletComponent extends DisposableComponent {
3605
3623
  PlaceOutletComponent.decorators = [
3606
3624
  { type: Component, args: [{
3607
3625
  selector: 'aup-place-outlet',
3608
- template: "<div class=\"router-outlet-container\"\n [@routeAnimations]=\"{value: placeAnimationOrder.value, params:{duration: animationDuration}}\"\n (@routeAnimations.done)=\"animationDone()\"\n>\n <router-outlet #routerOutlet=\"outlet\"\n (activate)=\"onOutletActivated(routerOutlet, $event)\"\n (deactivate)=\"onOutletDeactivated(routerOutlet, $event)\">\n </router-outlet>\n</div>\n\n",
3626
+ 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",
3609
3627
  animations: [LEFT_RIGHT_PLACE_ANIMATION],
3610
3628
  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}"]
3611
3629
  }] }
@@ -3629,7 +3647,7 @@ __decorate([
3629
3647
  __metadata("design:type", ListModel)
3630
3648
  ], PlaceOutletComponent.prototype, "customPlaceAnimationOrderModel", void 0);
3631
3649
  __decorate([
3632
- StoreInListModel("customPlaceAnimationOrderModel"),
3650
+ StoreInListModel('customPlaceAnimationOrderModel'),
3633
3651
  __metadata("design:type", Array)
3634
3652
  ], PlaceOutletComponent.prototype, "customPlaceAnimationOrder", void 0);
3635
3653
  __decorate([
@@ -3638,6 +3656,30 @@ __decorate([
3638
3656
  __metadata("design:paramtypes", [Visit]),
3639
3657
  __metadata("design:returntype", void 0)
3640
3658
  ], PlaceOutletComponent.prototype, "navigate", null);
3659
+ __decorate([
3660
+ Trace(),
3661
+ __metadata("design:type", Function),
3662
+ __metadata("design:paramtypes", [RouterOutlet, PlaceComponent]),
3663
+ __metadata("design:returntype", void 0)
3664
+ ], PlaceOutletComponent.prototype, "onOutletActivated", null);
3665
+ __decorate([
3666
+ Trace(),
3667
+ __metadata("design:type", Function),
3668
+ __metadata("design:paramtypes", []),
3669
+ __metadata("design:returntype", void 0)
3670
+ ], PlaceOutletComponent.prototype, "onOutletDeactivated", null);
3671
+ __decorate([
3672
+ Trace(),
3673
+ __metadata("design:type", Function),
3674
+ __metadata("design:paramtypes", []),
3675
+ __metadata("design:returntype", void 0)
3676
+ ], PlaceOutletComponent.prototype, "animationStarted", null);
3677
+ __decorate([
3678
+ Trace(),
3679
+ __metadata("design:type", Function),
3680
+ __metadata("design:paramtypes", []),
3681
+ __metadata("design:returntype", void 0)
3682
+ ], PlaceOutletComponent.prototype, "animationDone", null);
3641
3683
  if (false) {
3642
3684
  /** @type {?} */
3643
3685
  PlaceOutletComponent.prototype.animate;
@@ -3658,7 +3700,7 @@ if (false) {
3658
3700
  * @type {?}
3659
3701
  * @private
3660
3702
  */
3661
- PlaceOutletComponent.prototype._placeVisit;
3703
+ PlaceOutletComponent.prototype._activePlaceVisitModel;
3662
3704
  /**
3663
3705
  * @type {?}
3664
3706
  * @private
@@ -3874,6 +3916,7 @@ TabbedPlaceNavigationComponent.ctorParameters = () => [];
3874
3916
  * @fileoverview added by tsickle
3875
3917
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3876
3918
  */
3919
+ const ɵ0 = { animationDuration: "2000ms" };
3877
3920
  class PlaceModule {
3878
3921
  }
3879
3922
  PlaceModule.decorators = [
@@ -3905,7 +3948,7 @@ PlaceModule.decorators = [
3905
3948
  ListPlaceNavComponent
3906
3949
  ],
3907
3950
  providers: [
3908
- // {provide: AUP_PLACE_CONFIG, useValue: {animationDuration: "100ms"}}
3951
+ { provide: AUP_PLACE_CONFIG, useValue: ɵ0 }
3909
3952
  ]
3910
3953
  },] }
3911
3954
  ];