@coolon/angular-ui-powerups 0.0.96 → 0.0.97

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 (93) hide show
  1. package/bundles/coolon-angular-ui-powerups.umd.js +3099 -2285
  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.d.ts +17 -20
  6. package/coolon-angular-ui-powerups.metadata.json +1 -1
  7. package/esm2015/coolon-angular-ui-powerups.js +17 -20
  8. package/esm2015/index.js +2 -2
  9. package/esm2015/lib/interaction/components/activity-container/activity-container.component.js +15 -51
  10. package/esm2015/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.js +15 -47
  11. package/esm2015/lib/interaction/index.js +4 -2
  12. package/esm2015/lib/interaction/interaction-context-base.js +158 -0
  13. package/esm2015/lib/interaction/interaction-context.js +58 -78
  14. package/esm2015/lib/interaction/interaction.module.js +1 -1
  15. package/esm2015/lib/interaction/services/dialog-interaction-context.js +163 -0
  16. package/esm2015/lib/interaction/services/dialog-interaction.service.js +68 -181
  17. package/esm2015/lib/interaction/services/modal-interaction.service.js +109 -0
  18. package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +9 -43
  19. package/esm2015/lib/place/guards/abstract-place.guard.js +165 -0
  20. package/esm2015/lib/place/guards/consolidated-param-map.js +133 -0
  21. package/esm2015/lib/place/guards/interaction.guard.js +113 -0
  22. package/esm2015/lib/place/guards/navigation-session.js +590 -0
  23. package/esm2015/lib/place/guards/place-component-deactivation-handler.js +110 -0
  24. package/esm2015/lib/place/index.js +7 -5
  25. package/esm2015/lib/place/place-component.js +1 -1
  26. package/esm2015/lib/place/place-router.js +205 -236
  27. package/esm2015/lib/place/place.module.js +2 -4
  28. package/esm2015/lib/place/route/visit-sanitiser.js +2 -2
  29. package/esm2015/lib/place/url-snapshot.js +96 -0
  30. package/esm2015/public_api.js +3 -3
  31. package/esm5/coolon-angular-ui-powerups.js +17 -20
  32. package/esm5/index.js +2 -2
  33. package/esm5/lib/interaction/components/activity-container/activity-container.component.js +22 -73
  34. package/esm5/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.js +25 -76
  35. package/esm5/lib/interaction/index.js +4 -2
  36. package/esm5/lib/interaction/interaction-context-base.js +211 -0
  37. package/esm5/lib/interaction/interaction-context.js +72 -94
  38. package/esm5/lib/interaction/interaction.module.js +1 -1
  39. package/esm5/lib/interaction/services/dialog-interaction-context.js +188 -0
  40. package/esm5/lib/interaction/services/dialog-interaction.service.js +83 -232
  41. package/esm5/lib/interaction/services/modal-interaction.service.js +153 -0
  42. package/esm5/lib/place/components/place-outlet/place-outlet.component.js +9 -43
  43. package/esm5/lib/place/guards/abstract-place.guard.js +212 -0
  44. package/esm5/lib/place/guards/consolidated-param-map.js +161 -0
  45. package/esm5/lib/place/guards/interaction.guard.js +125 -0
  46. package/esm5/lib/place/guards/navigation-session.js +741 -0
  47. package/esm5/lib/place/guards/place-component-deactivation-handler.js +138 -0
  48. package/esm5/lib/place/index.js +7 -5
  49. package/esm5/lib/place/place-component.js +1 -1
  50. package/esm5/lib/place/place-router.js +324 -295
  51. package/esm5/lib/place/place.module.js +2 -4
  52. package/esm5/lib/place/route/visit-sanitiser.js +2 -2
  53. package/esm5/lib/place/url-snapshot.js +120 -0
  54. package/esm5/public_api.js +3 -3
  55. package/fesm2015/coolon-angular-ui-powerups.js +2244 -1654
  56. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  57. package/fesm5/coolon-angular-ui-powerups.js +3220 -2407
  58. package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
  59. package/lib/interaction/components/activity-container/activity-container.component.d.ts +5 -10
  60. package/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.d.ts +4 -9
  61. package/lib/interaction/index.d.ts +3 -1
  62. package/lib/interaction/interaction-context-base.d.ts +27 -0
  63. package/lib/interaction/interaction-context.d.ts +18 -15
  64. package/lib/interaction/services/dialog-interaction-context.d.ts +18 -0
  65. package/lib/interaction/services/dialog-interaction.service.d.ts +14 -23
  66. package/lib/interaction/services/modal-interaction.service.d.ts +15 -0
  67. package/lib/place/components/place-outlet/place-outlet.component.d.ts +1 -4
  68. package/lib/place/guards/abstract-place.guard.d.ts +19 -0
  69. package/lib/place/guards/consolidated-param-map.d.ts +14 -0
  70. package/lib/{interaction/guards/interaction-guard.service.d.ts → place/guards/interaction.guard.d.ts} +8 -4
  71. package/lib/place/guards/navigation-session.d.ts +96 -0
  72. package/lib/place/guards/place-component-deactivation-handler.d.ts +14 -0
  73. package/lib/place/index.d.ts +6 -4
  74. package/lib/place/place-component.d.ts +1 -1
  75. package/lib/place/place-router.d.ts +23 -31
  76. package/lib/place/url-snapshot.d.ts +16 -0
  77. package/package.json +1 -1
  78. package/schematics/place-routes/place-def.js +2 -2
  79. package/schematics/place-routes/templates/place-routes.ts.template +9 -16
  80. package/esm2015/lib/interaction/guards/interaction-guard.service.js +0 -85
  81. package/esm2015/lib/place/guards/abstract-enter-place.guard.js +0 -315
  82. package/esm2015/lib/place/guards/leave-place.guard.js +0 -47
  83. package/esm2015/lib/place/navigation-session.js +0 -279
  84. package/esm2015/lib/place/places/noop-gateway-place.component.js +0 -58
  85. package/esm5/lib/interaction/guards/interaction-guard.service.js +0 -94
  86. package/esm5/lib/place/guards/abstract-enter-place.guard.js +0 -387
  87. package/esm5/lib/place/guards/leave-place.guard.js +0 -55
  88. package/esm5/lib/place/navigation-session.js +0 -353
  89. package/esm5/lib/place/places/noop-gateway-place.component.js +0 -61
  90. package/lib/place/guards/abstract-enter-place.guard.d.ts +0 -33
  91. package/lib/place/guards/leave-place.guard.d.ts +0 -8
  92. package/lib/place/navigation-session.d.ts +0 -43
  93. package/lib/place/places/noop-gateway-place.component.d.ts +0 -10
@@ -1,16 +1,16 @@
1
1
  import { DOCUMENT, CommonModule, Location } from '@angular/common';
2
- import { Directive, ElementRef, Inject, Input, HostListener, NgZone, NgModule, EventEmitter, Output, Component, InjectionToken, Injector, ComponentFactoryResolver, ViewContainerRef, ViewChild, ViewChildren, Injectable, Optional, ɵɵdefineInjectable, ɵɵinject, SkipSelf, HostBinding, INJECTOR } from '@angular/core';
2
+ import { Directive, ElementRef, Inject, Input, HostListener, NgZone, NgModule, EventEmitter, Output, Component, InjectionToken, Injector, ComponentFactoryResolver, ViewContainerRef, ViewChild, ViewChildren, Injectable, ɵɵdefineInjectable, ɵɵinject, Optional, SkipSelf, HostBinding, INJECTOR } from '@angular/core';
3
3
  import { FormsModule } from '@angular/forms';
4
4
  import { MatInputModule, MatFormFieldModule, MatSelectModule, MatDialog, MatButtonModule, MatDialogModule, MatTabsModule as MatTabsModule$1, MatProgressSpinnerModule } from '@angular/material';
5
5
  import { MatTabsModule } from '@angular/material/tabs';
6
6
  import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
7
- import { GarbageCollector, DelegatingValueModel, assert, UnaryCommand, lang, Dsl, Logger, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, DelegatingListModel, Deferred, MutableStream, MutableListModel, MutableValueModel, Binding, Trace, Guard as Guard$1, StoreInValueModel, Command, OptionsHelper, ValueHolder } from '@coolon/pectin';
7
+ import { GarbageCollector, DelegatingValueModel, assert, UnaryCommand, lang, Dsl, Logger, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, EventListenerList, DelegatingListModel, Deferred, MutableStream, MutableValueModel, MutableListModel, Binding, Trace, Guard as Guard$1, StoreInValueModel, 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, NavigationStart, NavigationEnd, NavigationError, UrlSerializer, UrlSegment, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
10
+ import { RouterModule, NavigationStart, NavigationCancel, NavigationEnd, UrlSegment, NavigationError, Router, UrlSerializer, ActivatedRouteSnapshot, RouterStateSnapshot } 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
- import { MatDialogConfig, MAT_DIALOG_DEFAULT_OPTIONS, MatDialog as MatDialog$1 } from '@angular/material/dialog';
13
+ import { MatDialogConfig, MatDialog as MatDialog$1, MAT_DIALOG_DEFAULT_OPTIONS } from '@angular/material/dialog';
14
14
  import { MatIconModule } from '@angular/material/icon';
15
15
  import { MatListModule } from '@angular/material/list';
16
16
  import { MatTooltipModule } from '@angular/material/tooltip';
@@ -752,145 +752,6 @@ ComponentsModule.decorators = [
752
752
  },] }
753
753
  ];
754
754
 
755
- /**
756
- * @fileoverview added by tsickle
757
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
758
- */
759
- /**
760
- * @abstract
761
- */
762
- class InteractionContext extends GarbageCollector {
763
- /**
764
- * @protected
765
- */
766
- constructor() {
767
- super();
768
- /**
769
- * Returns the current list of activities that are in progress.
770
- * This model is only updated in the next tick after the view has been updated.
771
- */
772
- this._activityListDelegate = new DelegatingListModel();
773
- const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
774
- when.listOf(this.activityList).becomesPopulated((/**
775
- * @param {?} activities
776
- * @return {?}
777
- */
778
- (activities) => {
779
- if (this.deferredGetCurrentActivity) {
780
- this.deferredGetCurrentActivity.resolve(last(activities));
781
- this.deferredGetCurrentActivity = null;
782
- }
783
- }));
784
- }
785
- /**
786
- * @protected
787
- * @param {?} activityList
788
- * @return {?}
789
- */
790
- setActivityList(activityList) {
791
- this._activityListDelegate.setDelegate(activityList);
792
- }
793
- /**
794
- * @return {?}
795
- */
796
- get activityList() {
797
- return this._activityListDelegate.readonly;
798
- }
799
- /**
800
- * Returns the activity that is currently active.
801
- * This model is only updated in the next tick after the view has been updated.
802
- * @return {?}
803
- */
804
- getCurrentActivity() {
805
- return __awaiter(this, void 0, void 0, function* () {
806
- if (!this.isActive()) {
807
- return Promise.reject('no activity in progress');
808
- }
809
- else {
810
- if (this.deferredGetCurrentActivity) {
811
- // we're already waiting then just return the same promise
812
- return this.deferredGetCurrentActivity.promise;
813
- }
814
- else {
815
- if (this.activityList.length < 1) {
816
- this.deferredGetCurrentActivity = Deferred.defer();
817
- return this.deferredGetCurrentActivity.promise;
818
- }
819
- else {
820
- return last(this.activityList.value);
821
- }
822
- }
823
- }
824
- });
825
- }
826
- /**
827
- * @param {?} confirm
828
- * @return {?}
829
- */
830
- confirm(confirm) {
831
- // Important: we have to implement confirmOrReject as the main entry point
832
- // as the canDeactivation guards need to be able to cancel an interaction
833
- // without caring about returning a value.
834
- return this.confirmOrReject(confirm).then((/**
835
- * @return {?}
836
- */
837
- () => true)).catch((/**
838
- * @return {?}
839
- */
840
- () => false));
841
- }
842
- }
843
- if (false) {
844
- /**
845
- * Returns the current list of activities that are in progress.
846
- * This model is only updated in the next tick after the view has been updated.
847
- * @type {?}
848
- * @private
849
- */
850
- InteractionContext.prototype._activityListDelegate;
851
- /**
852
- * @type {?}
853
- * @private
854
- */
855
- InteractionContext.prototype.deferredGetCurrentActivity;
856
- /**
857
- * Returns true if an activity is currently running.
858
- * @abstract
859
- * @return {?}
860
- */
861
- InteractionContext.prototype.isActive = function () { };
862
- /**
863
- * @abstract
864
- * @template D, R, E
865
- * @param {?} activityType
866
- * @param {?=} data
867
- * @return {?}
868
- */
869
- InteractionContext.prototype.startActivity = function (activityType, data) { };
870
- /**
871
- * @abstract
872
- * @param {?} confirm
873
- * @return {?}
874
- */
875
- InteractionContext.prototype.confirmOrReject = function (confirm) { };
876
- /**
877
- * Presents the confirmation to the user and runs the activity only if the user confirms.
878
- * @abstract
879
- * @template D, R, E
880
- * @param {?} confirm
881
- * @param {?} activityType the activity to run if confirmed.
882
- * @param {?=} data the activity data.
883
- * @return {?}
884
- */
885
- InteractionContext.prototype.confirmThen = function (confirm, activityType, data) { };
886
- /**
887
- * @abstract
888
- * @param {?} alert
889
- * @return {?}
890
- */
891
- InteractionContext.prototype.alert = function (alert) { };
892
- }
893
-
894
755
  /**
895
756
  * @fileoverview added by tsickle
896
757
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -986,170 +847,167 @@ if (false) {
986
847
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
987
848
  */
988
849
  /**
989
- * ActivityOutletComponent creates and displays an activity and delegates the interaction context functionality to an
990
- * external service.
991
- *
992
- * It might be nice to have wrapper component that allows more declarative use, i.e.
993
- * <activity-view [activityClass]="...", [activityData]="..." (done)=".." (cancel)="..."></activity-view>
850
+ * Deprecated. You can now extend the Activity class directly.
851
+ * @abstract
994
852
  * @template D, R, E
995
853
  */
996
- class ActivityOutletComponent {
854
+ class AbstractActivity extends Activity {
855
+ }
856
+
857
+ /**
858
+ * @fileoverview added by tsickle
859
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
860
+ */
861
+ class AlertDialogComponent extends AbstractActivity {
997
862
  /**
998
- * @param {?} componentFactoryResolver
999
- * @param {?} viewContainerRef
1000
- * @param {?} injector
863
+ * @param {?} alert
1001
864
  */
1002
- constructor(componentFactoryResolver, viewContainerRef, injector) {
1003
- this.componentFactoryResolver = componentFactoryResolver;
1004
- this.viewContainerRef = viewContainerRef;
1005
- this.injector = injector;
865
+ constructor(alert) {
866
+ super();
867
+ this.alert = alert;
1006
868
  }
1007
869
  /**
1008
- * @param {?} activityContext
1009
870
  * @return {?}
1010
871
  */
1011
- set activityContext(activityContext) {
1012
- assert.isNil(this._activityContext);
1013
- this._activityContext = activityContext;
1014
- this.loadActivity(activityContext);
872
+ ngOnInit() {
873
+ }
874
+ }
875
+ AlertDialogComponent.decorators = [
876
+ { type: Component, args: [{
877
+ selector: 'aup-alert-dialog',
878
+ 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",
879
+ styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-content{margin:0;padding:0}.mat-dialog-actions{justify-content:flex-end}"]
880
+ }] }
881
+ ];
882
+ /** @nocollapse */
883
+ AlertDialogComponent.ctorParameters = () => [
884
+ { type: undefined, decorators: [{ type: Inject, args: [ACTIVITY_DATA,] }] }
885
+ ];
886
+ if (false) {
887
+ /** @type {?} */
888
+ AlertDialogComponent.prototype.alert;
889
+ }
890
+
891
+ /**
892
+ * @fileoverview added by tsickle
893
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
894
+ */
895
+ /**
896
+ * @abstract
897
+ */
898
+ class InteractionContext extends GarbageCollector {
899
+ constructor() {
900
+ super(...arguments);
901
+ this.activityListeners = new EventListenerList();
1015
902
  }
1016
- ;
1017
903
  /**
904
+ * Returns true if an activity is currently running.
1018
905
  * @return {?}
1019
906
  */
1020
- get activityContext() {
1021
- return this._activityContext;
907
+ isActive() {
908
+ return this.active.value;
1022
909
  }
1023
910
  /**
911
+ * @param {?} listener
1024
912
  * @return {?}
1025
913
  */
1026
- ngOnInit() {
914
+ addActivityListener(listener) {
915
+ return this.activityListeners.add(listener);
1027
916
  }
1028
917
  /**
1029
- * @param {?} activityContext
918
+ * @protected
1030
919
  * @return {?}
1031
920
  */
1032
- loadActivity(activityContext) {
1033
- /** @type {?} */
1034
- const injector = Injector.create({
1035
- providers: [
1036
- {
1037
- provide: InteractionContext,
1038
- useValue: this.interactionContext
1039
- },
1040
- { provide: ACTIVITY_DATA, useValue: activityContext.activityData }
1041
- ],
1042
- parent: this.injector
1043
- });
1044
- /** @type {?} */
1045
- const componentFactory = this.componentFactoryResolver.resolveComponentFactory(activityContext.activityClass);
1046
- this.viewContainerRef.clear();
1047
- this.activityComponentRef = this.viewContainerRef.createComponent(componentFactory, 0, injector);
1048
- this.activityComponentRef.instance.initialise(activityContext);
1049
- if (this.activityContext.componentReady) {
1050
- this.activityContext.componentReady(this.component);
1051
- }
921
+ notifyActivityStarted() {
922
+ this.activityListeners.fire((/**
923
+ * @param {?} l
924
+ * @return {?}
925
+ */
926
+ l => l.onActivityStarted()));
1052
927
  }
1053
928
  /**
929
+ * @protected
1054
930
  * @return {?}
1055
931
  */
1056
- get component() {
1057
- return this.activityComponentRef.instance;
932
+ notifyActivityFinished() {
933
+ this.activityListeners.fire((/**
934
+ * @param {?} l
935
+ * @return {?}
936
+ */
937
+ l => l.onActivityFinished()));
1058
938
  }
1059
939
  }
1060
- ActivityOutletComponent.decorators = [
1061
- { type: Component, args: [{
1062
- selector: 'aup-activity-outlet',
1063
- template: '',
1064
- styles: [":host{display:block}"]
1065
- }] }
1066
- ];
1067
- /** @nocollapse */
1068
- ActivityOutletComponent.ctorParameters = () => [
1069
- { type: ComponentFactoryResolver },
1070
- { type: ViewContainerRef },
1071
- { type: Injector }
1072
- ];
1073
- ActivityOutletComponent.propDecorators = {
1074
- interactionContext: [{ type: Input }],
1075
- activityContext: [{ type: Input }]
1076
- };
1077
940
  if (false) {
1078
- /** @type {?} */
1079
- ActivityOutletComponent.prototype.interactionContext;
1080
941
  /**
1081
942
  * @type {?}
1082
943
  * @private
1083
944
  */
1084
- ActivityOutletComponent.prototype._activityContext;
945
+ InteractionContext.prototype.activityListeners;
946
+ /** @type {?} */
947
+ InteractionContext.prototype.activityList;
948
+ /** @type {?} */
949
+ InteractionContext.prototype.active;
1085
950
  /**
1086
- * @type {?}
1087
- * @private
951
+ * Returns the activity that is currently active.
952
+ * This model is only updated in the next tick after the view has been updated.
953
+ * @abstract
954
+ * @return {?}
1088
955
  */
1089
- ActivityOutletComponent.prototype.activityComponentRef;
956
+ InteractionContext.prototype.getCurrentActivity = function () { };
1090
957
  /**
1091
- * @type {?}
1092
- * @private
958
+ * @abstract
959
+ * @template D, R, E
960
+ * @param {?} activityType
961
+ * @param {?=} data
962
+ * @return {?}
1093
963
  */
1094
- ActivityOutletComponent.prototype.componentFactoryResolver;
964
+ InteractionContext.prototype.startActivity = function (activityType, data) { };
1095
965
  /**
1096
- * @type {?}
1097
- * @private
966
+ * @abstract
967
+ * @param {?} alert
968
+ * @return {?}
1098
969
  */
1099
- ActivityOutletComponent.prototype.viewContainerRef;
970
+ InteractionContext.prototype.alert = function (alert) { };
1100
971
  /**
1101
- * @type {?}
1102
- * @private
972
+ * @abstract
973
+ * @param {?} confirm
974
+ * @return {?}
1103
975
  */
1104
- ActivityOutletComponent.prototype.injector;
1105
- /* Skipping unhandled member: ;*/
1106
- }
1107
-
1108
- /**
1109
- * @fileoverview added by tsickle
1110
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1111
- */
1112
- /**
1113
- * Deprecated. You can now extend the Activity class directly.
1114
- * @abstract
1115
- * @template D, R, E
1116
- */
1117
- class AbstractActivity extends Activity {
1118
- }
1119
-
1120
- /**
1121
- * @fileoverview added by tsickle
1122
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1123
- */
1124
- class AlertDialogComponent extends AbstractActivity {
976
+ InteractionContext.prototype.confirm = function (confirm) { };
1125
977
  /**
1126
- * @param {?} alert
978
+ * @abstract
979
+ * @param {?} confirm
980
+ * @return {?}
1127
981
  */
1128
- constructor(alert) {
1129
- super();
1130
- this.alert = alert;
1131
- }
982
+ InteractionContext.prototype.confirmOrReject = function (confirm) { };
1132
983
  /**
984
+ * Presents the confirmation to the user and runs the activity only if the user confirms.
985
+ * @abstract
986
+ * @template D, R, E
987
+ * @param {?} confirm
988
+ * @param {?} activityType the activity to run if confirmed.
989
+ * @param {?=} data the activity data.
1133
990
  * @return {?}
1134
991
  */
1135
- ngOnInit() {
1136
- }
1137
- }
1138
- AlertDialogComponent.decorators = [
1139
- { type: Component, args: [{
1140
- selector: 'aup-alert-dialog',
1141
- 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",
1142
- styles: [":host{display:block;padding:var(--aup-default-padding)}.mat-dialog-content{margin:0;padding:0}.mat-dialog-actions{justify-content:flex-end}"]
1143
- }] }
1144
- ];
1145
- /** @nocollapse */
1146
- AlertDialogComponent.ctorParameters = () => [
1147
- { type: undefined, decorators: [{ type: Inject, args: [ACTIVITY_DATA,] }] }
1148
- ];
1149
- if (false) {
1150
- /** @type {?} */
1151
- AlertDialogComponent.prototype.alert;
992
+ InteractionContext.prototype.confirmThen = function (confirm, activityType, data) { };
1152
993
  }
994
+ (function (InteractionContext) {
995
+ /**
996
+ * @record
997
+ */
998
+ function Listener() { }
999
+ InteractionContext.Listener = Listener;
1000
+ if (false) {
1001
+ /**
1002
+ * @return {?}
1003
+ */
1004
+ Listener.prototype.onActivityStarted = function () { };
1005
+ /**
1006
+ * @return {?}
1007
+ */
1008
+ Listener.prototype.onActivityFinished = function () { };
1009
+ }
1010
+ })(InteractionContext || (InteractionContext = {}));
1153
1011
 
1154
1012
  /**
1155
1013
  * @fileoverview added by tsickle
@@ -1284,115 +1142,392 @@ if (false) {
1284
1142
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1285
1143
  */
1286
1144
  /**
1287
- * Note: this class is mutable and is stored in a list model. This is normally a big no no but
1288
- * we're manually deriving other models from the list after view state changes. I.e. we not
1289
- * using pectin chains on any of the mutable fields.
1290
- * @template D, R, E
1145
+ * @abstract
1291
1146
  */
1292
- class TabContext {
1147
+ class InteractionContextBase extends InteractionContext {
1293
1148
  /**
1294
- * @param {?} activityData
1295
- * @param {?} activityClass
1296
- * @param {?} interactionContext
1297
- * @param {?} activityCallbacks
1149
+ * @protected
1298
1150
  */
1299
- constructor(activityData, activityClass, interactionContext, activityCallbacks) {
1300
- this.activityData = activityData;
1301
- this.activityClass = activityClass;
1302
- this.interactionContext = interactionContext;
1303
- this.activityCallbacks = activityCallbacks;
1304
- this._complete = false;
1151
+ constructor() {
1152
+ super();
1153
+ /**
1154
+ * Returns the current list of activities that are in progress.
1155
+ * This model is only updated in the next tick after the view has been updated.
1156
+ */
1157
+ this._activityListDelegate = new DelegatingListModel();
1158
+ const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
1159
+ when.listOf(this.activityList).becomesPopulated((/**
1160
+ * @param {?} activities
1161
+ * @return {?}
1162
+ */
1163
+ (activities) => {
1164
+ if (this.deferredGetCurrentActivity) {
1165
+ this.deferredGetCurrentActivity.resolve(last(activities));
1166
+ this.deferredGetCurrentActivity = null;
1167
+ }
1168
+ }));
1169
+ }
1170
+ /**
1171
+ * @protected
1172
+ * @param {?} activityList
1173
+ * @return {?}
1174
+ */
1175
+ setActivityList(activityList) {
1176
+ this._activityListDelegate.setDelegate(activityList);
1305
1177
  }
1306
1178
  /**
1307
1179
  * @return {?}
1308
1180
  */
1309
- isComponentRealised() {
1310
- return !!this._component;
1181
+ get activityList() {
1182
+ return this._activityListDelegate.readonly;
1311
1183
  }
1312
1184
  /**
1185
+ * Returns the activity that is currently active.
1186
+ * This model is only updated in the next tick after the view has been updated.
1313
1187
  * @return {?}
1314
1188
  */
1315
- isComplete() {
1316
- return this._complete;
1189
+ getCurrentActivity() {
1190
+ return __awaiter(this, void 0, void 0, function* () {
1191
+ if (!this.isActive()) {
1192
+ return Promise.reject('no activity in progress');
1193
+ }
1194
+ else {
1195
+ if (this.deferredGetCurrentActivity) {
1196
+ // we're already waiting then just return the same promise
1197
+ return this.deferredGetCurrentActivity.promise;
1198
+ }
1199
+ else {
1200
+ if (this.activityList.length < 1) {
1201
+ this.deferredGetCurrentActivity = Deferred.defer();
1202
+ return this.deferredGetCurrentActivity.promise;
1203
+ }
1204
+ else {
1205
+ return last(this.activityList.value);
1206
+ }
1207
+ }
1208
+ }
1209
+ });
1317
1210
  }
1318
1211
  /**
1319
- * @param {?} component
1212
+ * @template D, R, E
1213
+ * @param {?} activityType
1214
+ * @param {?=} data
1320
1215
  * @return {?}
1321
1216
  */
1322
- componentReady(component) {
1323
- assert.isNil(this._component);
1324
- this._component = component;
1217
+ startActivity(activityType, data) {
1218
+ return this._startActivity(activityType, data);
1325
1219
  }
1326
1220
  /**
1221
+ * @param {?} confirm
1327
1222
  * @return {?}
1328
1223
  */
1329
- get component() {
1330
- return this._component;
1224
+ confirm(confirm) {
1225
+ // Important: we have to implement confirmOrReject as the main entry point
1226
+ // as the canDeactivation guards need to be able to cancel an interaction
1227
+ // without caring about returning a value.
1228
+ return this.confirmOrReject(confirm).then((/**
1229
+ * @return {?}
1230
+ */
1231
+ () => true)).catch((/**
1232
+ * @return {?}
1233
+ */
1234
+ () => false));
1331
1235
  }
1332
- // @Trace()
1333
1236
  /**
1334
- * @param {?} result
1237
+ * @param {?} alert
1335
1238
  * @return {?}
1336
1239
  */
1337
- onDone(result) {
1338
- this._complete = true;
1339
- this.activityCallbacks.onDone(result);
1240
+ alert(alert) {
1241
+ // TODO: Test disableClose === false
1242
+ return this._startActivity(AlertDialogComponent, alert, false);
1340
1243
  }
1341
- // @Trace()
1342
1244
  /**
1343
- * @param {?} error
1245
+ * @param {?} confirm
1344
1246
  * @return {?}
1345
1247
  */
1346
- onCancel(error) {
1347
- this._complete = true;
1348
- this.activityCallbacks.onCancel(error);
1248
+ confirmOrReject(confirm) {
1249
+ return this._startActivity(ConfirmationDialogComponent, confirm, true);
1250
+ }
1251
+ /**
1252
+ * @template D, R, E
1253
+ * @param {?} confirm
1254
+ * @param {?} activityType
1255
+ * @param {?=} data
1256
+ * @return {?}
1257
+ */
1258
+ confirmThen(confirm, activityType, data) {
1259
+ return this._startActivity(ConfirmThenDialogComponent, {
1260
+ confirm,
1261
+ activityType: activityType,
1262
+ data: data
1263
+ }, true);
1349
1264
  }
1350
1265
  }
1351
1266
  if (false) {
1352
1267
  /**
1268
+ * Returns the current list of activities that are in progress.
1269
+ * This model is only updated in the next tick after the view has been updated.
1353
1270
  * @type {?}
1354
1271
  * @private
1355
1272
  */
1356
- TabContext.prototype._complete;
1273
+ InteractionContextBase.prototype._activityListDelegate;
1357
1274
  /**
1358
1275
  * @type {?}
1359
1276
  * @private
1360
1277
  */
1361
- TabContext.prototype._component;
1362
- /** @type {?} */
1363
- TabContext.prototype.activityData;
1364
- /** @type {?} */
1365
- TabContext.prototype.activityClass;
1366
- /** @type {?} */
1367
- TabContext.prototype.interactionContext;
1368
- /** @type {?} */
1369
- TabContext.prototype.activityCallbacks;
1278
+ InteractionContextBase.prototype.deferredGetCurrentActivity;
1279
+ /**
1280
+ * @abstract
1281
+ * @protected
1282
+ * @template D, R, E
1283
+ * @param {?} activityType
1284
+ * @param {?=} data
1285
+ * @param {?=} disableClose
1286
+ * @return {?}
1287
+ */
1288
+ InteractionContextBase.prototype._startActivity = function (activityType, data, disableClose) { };
1370
1289
  }
1290
+
1291
+ /**
1292
+ * @fileoverview added by tsickle
1293
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1294
+ */
1371
1295
  /**
1296
+ * ActivityOutletComponent creates and displays an activity and delegates the interaction context functionality to an
1297
+ * external service.
1298
+ *
1299
+ * It might be nice to have wrapper component that allows more declarative use, i.e.
1300
+ * <activity-view [activityClass]="...", [activityData]="..." (done)=".." (cancel)="..."></activity-view>
1372
1301
  * @template D, R, E
1373
1302
  */
1374
- class ActivityContainerComponent extends InteractionContext {
1375
- constructor() {
1376
- super();
1377
- this.throttledNestedActivityFinishEvents = new MutableStream();
1378
- // tslint:disable-next-line:no-output-rename
1379
- this.initialActivityOutletContextEvent = new EventEmitter();
1380
- this.dynamicHeight = false;
1381
- this.activityTabs = new MutableListModel();
1382
- this._activityList = new MutableListModel();
1303
+ class ActivityOutletComponent {
1304
+ /**
1305
+ * @param {?} componentFactoryResolver
1306
+ * @param {?} viewContainerRef
1307
+ * @param {?} injector
1308
+ */
1309
+ constructor(componentFactoryResolver, viewContainerRef, injector) {
1310
+ this.componentFactoryResolver = componentFactoryResolver;
1311
+ this.viewContainerRef = viewContainerRef;
1312
+ this.injector = injector;
1313
+ }
1314
+ /**
1315
+ * @param {?} activityContext
1316
+ * @return {?}
1317
+ */
1318
+ set activityContext(activityContext) {
1319
+ assert.isNil(this._activityContext);
1320
+ this._activityContext = activityContext;
1321
+ this.loadActivity(activityContext);
1322
+ }
1323
+ ;
1324
+ /**
1325
+ * @return {?}
1326
+ */
1327
+ get activityContext() {
1328
+ return this._activityContext;
1329
+ }
1330
+ /**
1331
+ * @return {?}
1332
+ */
1333
+ ngOnInit() {
1334
+ }
1335
+ /**
1336
+ * @param {?} activityContext
1337
+ * @return {?}
1338
+ */
1339
+ loadActivity(activityContext) {
1340
+ /** @type {?} */
1341
+ const injector = Injector.create({
1342
+ providers: [
1343
+ {
1344
+ provide: InteractionContext,
1345
+ useValue: this.interactionContext
1346
+ },
1347
+ { provide: ACTIVITY_DATA, useValue: activityContext.activityData }
1348
+ ],
1349
+ parent: this.injector
1350
+ });
1351
+ /** @type {?} */
1352
+ const componentFactory = this.componentFactoryResolver.resolveComponentFactory(activityContext.activityClass);
1353
+ this.viewContainerRef.clear();
1354
+ this.activityComponentRef = this.viewContainerRef.createComponent(componentFactory, 0, injector);
1355
+ this.activityComponentRef.instance.initialise(activityContext);
1356
+ if (this.activityContext.componentReady) {
1357
+ this.activityContext.componentReady(this.component);
1358
+ }
1359
+ }
1360
+ /**
1361
+ * @return {?}
1362
+ */
1363
+ get component() {
1364
+ return this.activityComponentRef.instance;
1365
+ }
1366
+ }
1367
+ ActivityOutletComponent.decorators = [
1368
+ { type: Component, args: [{
1369
+ selector: 'aup-activity-outlet',
1370
+ template: '',
1371
+ styles: [":host{display:block}"]
1372
+ }] }
1373
+ ];
1374
+ /** @nocollapse */
1375
+ ActivityOutletComponent.ctorParameters = () => [
1376
+ { type: ComponentFactoryResolver },
1377
+ { type: ViewContainerRef },
1378
+ { type: Injector }
1379
+ ];
1380
+ ActivityOutletComponent.propDecorators = {
1381
+ interactionContext: [{ type: Input }],
1382
+ activityContext: [{ type: Input }]
1383
+ };
1384
+ if (false) {
1385
+ /** @type {?} */
1386
+ ActivityOutletComponent.prototype.interactionContext;
1387
+ /**
1388
+ * @type {?}
1389
+ * @private
1390
+ */
1391
+ ActivityOutletComponent.prototype._activityContext;
1392
+ /**
1393
+ * @type {?}
1394
+ * @private
1395
+ */
1396
+ ActivityOutletComponent.prototype.activityComponentRef;
1397
+ /**
1398
+ * @type {?}
1399
+ * @private
1400
+ */
1401
+ ActivityOutletComponent.prototype.componentFactoryResolver;
1402
+ /**
1403
+ * @type {?}
1404
+ * @private
1405
+ */
1406
+ ActivityOutletComponent.prototype.viewContainerRef;
1407
+ /**
1408
+ * @type {?}
1409
+ * @private
1410
+ */
1411
+ ActivityOutletComponent.prototype.injector;
1412
+ /* Skipping unhandled member: ;*/
1413
+ }
1414
+
1415
+ /**
1416
+ * @fileoverview added by tsickle
1417
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1418
+ */
1419
+ /**
1420
+ * Note: this class is mutable and is stored in a list model. This is normally a big no no but
1421
+ * we're manually deriving other models from the list after view state changes. I.e. we not
1422
+ * using pectin chains on any of the mutable fields.
1423
+ * @template D, R, E
1424
+ */
1425
+ class TabContext {
1426
+ /**
1427
+ * @param {?} activityData
1428
+ * @param {?} activityClass
1429
+ * @param {?} interactionContext
1430
+ * @param {?} activityCallbacks
1431
+ */
1432
+ constructor(activityData, activityClass, interactionContext, activityCallbacks) {
1433
+ this.activityData = activityData;
1434
+ this.activityClass = activityClass;
1435
+ this.interactionContext = interactionContext;
1436
+ this.activityCallbacks = activityCallbacks;
1437
+ this._complete = false;
1438
+ }
1439
+ /**
1440
+ * @return {?}
1441
+ */
1442
+ isComponentRealised() {
1443
+ return !!this._component;
1444
+ }
1445
+ /**
1446
+ * @return {?}
1447
+ */
1448
+ isComplete() {
1449
+ return this._complete;
1450
+ }
1451
+ /**
1452
+ * @param {?} component
1453
+ * @return {?}
1454
+ */
1455
+ componentReady(component) {
1456
+ assert.isNil(this._component);
1457
+ this._component = component;
1458
+ }
1459
+ /**
1460
+ * @return {?}
1461
+ */
1462
+ get component() {
1463
+ return this._component;
1464
+ }
1465
+ // @Trace()
1466
+ /**
1467
+ * @param {?} result
1468
+ * @return {?}
1469
+ */
1470
+ onDone(result) {
1471
+ this._complete = true;
1472
+ this.activityCallbacks.onDone(result);
1473
+ }
1474
+ // @Trace()
1475
+ /**
1476
+ * @param {?} error
1477
+ * @return {?}
1478
+ */
1479
+ onCancel(error) {
1480
+ this._complete = true;
1481
+ this.activityCallbacks.onCancel(error);
1482
+ }
1483
+ }
1484
+ if (false) {
1485
+ /**
1486
+ * @type {?}
1487
+ * @private
1488
+ */
1489
+ TabContext.prototype._complete;
1490
+ /**
1491
+ * @type {?}
1492
+ * @private
1493
+ */
1494
+ TabContext.prototype._component;
1495
+ /** @type {?} */
1496
+ TabContext.prototype.activityData;
1497
+ /** @type {?} */
1498
+ TabContext.prototype.activityClass;
1499
+ /** @type {?} */
1500
+ TabContext.prototype.interactionContext;
1501
+ /** @type {?} */
1502
+ TabContext.prototype.activityCallbacks;
1503
+ }
1504
+ /**
1505
+ * @template D, R, E
1506
+ */
1507
+ class ActivityContainerComponent extends InteractionContextBase {
1508
+ constructor() {
1509
+ super();
1510
+ this.throttledNestedActivityFinishEvents = new MutableStream();
1511
+ this._initialActivityOutletContext = new MutableValueModel();
1512
+ // tslint:disable-next-line:no-output-rename
1513
+ this.initialActivityOutletContextEvent = new EventEmitter();
1514
+ this.dynamicHeight = false;
1515
+ this.activityTabs = new MutableListModel();
1516
+ this._activityList = new MutableListModel();
1383
1517
  const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
1384
1518
  chain(this.throttledNestedActivityFinishEvents).throttle(50).subscribe((/**
1385
1519
  * @return {?}
1386
1520
  */
1387
1521
  () => this.onNestedActivityFinished()));
1388
1522
  this.setActivityList(this._activityList.readonly);
1523
+ this.active = chain(this._initialActivityOutletContext).isNotNil();
1389
1524
  }
1390
1525
  /**
1391
1526
  * @param {?} initialContext
1392
1527
  * @return {?}
1393
1528
  */
1394
1529
  set initialActivityOutletContext(initialContext) {
1395
- assert.isNil(this._initialActivityOutletContext);
1530
+ assert.isNil(this._initialActivityOutletContext.value);
1396
1531
  // we clean up at the start as we leave the initial activity in place after it finishes
1397
1532
  // so that the activity remains visible during the inplace-interaction-context animations.
1398
1533
  this.activityTabs.value = [];
@@ -1400,7 +1535,7 @@ class ActivityContainerComponent extends InteractionContext {
1400
1535
  /** @type {?} */
1401
1536
  const self = this;
1402
1537
  if (initialContext) {
1403
- this._initialActivityOutletContext = initialContext;
1538
+ this._initialActivityOutletContext.value = initialContext;
1404
1539
  this.activityTabs.push(new TabContext(initialContext.activityData, initialContext.activityClass, this, {
1405
1540
  onDone: (/**
1406
1541
  * @param {?} result
@@ -1425,20 +1560,11 @@ class ActivityContainerComponent extends InteractionContext {
1425
1560
  * @return {?}
1426
1561
  */
1427
1562
  get initialActivityOutletContext() {
1428
- return this._initialActivityOutletContext;
1429
- }
1430
- /**
1431
- * @return {?}
1432
- */
1433
- isActive() {
1434
- return !!this._initialActivityOutletContext;
1435
- }
1436
- /**
1437
- * @return {?}
1438
- */
1439
- get isFinished() {
1440
- return !this._initialActivityOutletContext;
1563
+ return this._initialActivityOutletContext.value;
1441
1564
  }
1565
+ // get isFinished() {
1566
+ // return !this._initialActivityOutletContext;
1567
+ // }
1442
1568
  /**
1443
1569
  * @return {?}
1444
1570
  */
@@ -1468,7 +1594,7 @@ class ActivityContainerComponent extends InteractionContext {
1468
1594
  * @param {?=} data
1469
1595
  * @return {?}
1470
1596
  */
1471
- startActivity(activityType, data) {
1597
+ _startActivity(activityType, data) {
1472
1598
  this.cleanupStaleNestedActivities();
1473
1599
  /** @type {?} */
1474
1600
  const self = this;
@@ -1501,34 +1627,6 @@ class ActivityContainerComponent extends InteractionContext {
1501
1627
  self.tabs.selectedIndex = this.activityTabs.length;
1502
1628
  }));
1503
1629
  }
1504
- /**
1505
- * @param {?} alert
1506
- * @return {?}
1507
- */
1508
- alert(alert) {
1509
- return this.startActivity(AlertDialogComponent, alert);
1510
- }
1511
- /**
1512
- * @param {?} confirm
1513
- * @return {?}
1514
- */
1515
- confirmOrReject(confirm) {
1516
- return this.startActivity(ConfirmationDialogComponent, confirm);
1517
- }
1518
- /**
1519
- * @template D1, R1, E1
1520
- * @param {?} confirm
1521
- * @param {?} activityType
1522
- * @param {?=} data
1523
- * @return {?}
1524
- */
1525
- confirmThen(confirm, activityType, data) {
1526
- return this.startActivity(ConfirmThenDialogComponent, {
1527
- confirm,
1528
- activityType: activityType,
1529
- data: data
1530
- });
1531
- }
1532
1630
  /**
1533
1631
  * @private
1534
1632
  * @return {?}
@@ -1650,6 +1748,8 @@ if (false) {
1650
1748
  ActivityContainerComponent.prototype.outlets;
1651
1749
  /** @type {?} */
1652
1750
  ActivityContainerComponent.prototype.activityTabs;
1751
+ /** @type {?} */
1752
+ ActivityContainerComponent.prototype.active;
1653
1753
  /**
1654
1754
  * @type {?}
1655
1755
  * @private
@@ -1664,59 +1764,24 @@ if (false) {
1664
1764
  /**
1665
1765
  * @template D, R, E
1666
1766
  */
1667
- class InplaceInteractionContextComponent extends InteractionContext {
1767
+ class InplaceInteractionContextComponent extends InteractionContextBase {
1668
1768
  constructor() {
1669
1769
  super();
1770
+ this._active = new DelegatingValueModel().withDefault(false);
1771
+ const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
1670
1772
  }
1671
1773
  /**
1672
1774
  * @return {?}
1673
1775
  */
1674
1776
  ngAfterViewInit() {
1675
1777
  this.setActivityList(this.interactionContext.activityList);
1778
+ this._active.setDelegate(this.interactionContext.active);
1676
1779
  }
1677
1780
  /**
1678
1781
  * @return {?}
1679
1782
  */
1680
- isActive() {
1681
- return this.interactionContext.isActive();
1682
- }
1683
- /**
1684
- * @param {?} alert
1685
- * @return {?}
1686
- */
1687
- alert(alert) {
1688
- // TODO: Test disableClose === false
1689
- return this._startActivity(AlertDialogComponent, alert);
1690
- }
1691
- /**
1692
- * @param {?} confirm
1693
- * @return {?}
1694
- */
1695
- confirmOrReject(confirm) {
1696
- return this._startActivity(ConfirmationDialogComponent, confirm);
1697
- }
1698
- /**
1699
- * @template D1, R1, E1
1700
- * @param {?} confirm
1701
- * @param {?} activityType
1702
- * @param {?=} data
1703
- * @return {?}
1704
- */
1705
- confirmThen(confirm, activityType, data) {
1706
- return this._startActivity(ConfirmThenDialogComponent, {
1707
- confirm,
1708
- activityType: activityType,
1709
- data: data
1710
- });
1711
- }
1712
- /**
1713
- * @template D1, R1, E1
1714
- * @param {?} activityType
1715
- * @param {?=} data
1716
- * @return {?}
1717
- */
1718
- startActivity(activityType, data) {
1719
- return this._startActivity(activityType, data);
1783
+ get active() {
1784
+ return this._active.readonly;
1720
1785
  }
1721
1786
  /**
1722
1787
  * @protected
@@ -1765,13 +1830,18 @@ InplaceInteractionContextComponent.decorators = [
1765
1830
  /** @nocollapse */
1766
1831
  InplaceInteractionContextComponent.ctorParameters = () => [];
1767
1832
  InplaceInteractionContextComponent.propDecorators = {
1768
- interactionContext: [{ type: ViewChild, args: ["activityContainer", { static: true },] }]
1833
+ interactionContext: [{ type: ViewChild, args: ['activityContainer', { static: true },] }]
1769
1834
  };
1770
1835
  if (false) {
1771
1836
  /** @type {?} */
1772
1837
  InplaceInteractionContextComponent.prototype.interactionContext;
1773
1838
  /** @type {?} */
1774
1839
  InplaceInteractionContextComponent.prototype.initialActivityContext;
1840
+ /**
1841
+ * @type {?}
1842
+ * @private
1843
+ */
1844
+ InplaceInteractionContextComponent.prototype._active;
1775
1845
  }
1776
1846
 
1777
1847
  /**
@@ -1796,84 +1866,34 @@ InteractionOutletComponent.ctorParameters = () => [];
1796
1866
  * @fileoverview added by tsickle
1797
1867
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1798
1868
  */
1799
- /** @type {?} */
1800
- const DIALOG_INTERACTION_SERVICE_DEFAULTS = new InjectionToken('DIALOG_INTERACTION_SERVICE_DEFAULTS');
1801
- class Guard extends ValueModel {
1802
- constructor() {
1803
- super({ initialValue: false });
1804
- }
1805
- /**
1806
- * @return {?}
1807
- */
1808
- get value() {
1809
- return this.store.read();
1810
- }
1811
- /**
1812
- * @template R
1813
- * @param {?} fun
1814
- * @return {?}
1815
- */
1816
- whileTrue(fun) {
1817
- this.startTransaction().commit(true);
1818
- try {
1819
- return fun();
1820
- }
1821
- finally {
1822
- this.startTransaction().commit(false);
1823
- }
1824
- }
1825
- /**
1826
- * @template R
1827
- * @param {?} fun
1828
- * @param {?=} defaultValue
1829
- * @return {?}
1830
- */
1831
- runIfFalse(fun, defaultValue = null) {
1832
- return !this.value ? fun() : defaultValue;
1833
- }
1834
- }
1835
- class DialogInteractionService extends InteractionContext {
1869
+ class DialogInteractionContext extends InteractionContextBase {
1836
1870
  /**
1837
1871
  * @param {?} dialogService
1838
- * @param {?} location
1839
- * @param {?} router
1840
- * @param {?} dialogServiceDefaults
1841
- * @param {?} matDialogDefaultConfig
1872
+ * @param {?} config
1842
1873
  */
1843
- constructor(dialogService, location, router, dialogServiceDefaults, matDialogDefaultConfig) {
1874
+ constructor(dialogService, config) {
1844
1875
  super();
1845
1876
  this.dialogService = dialogService;
1846
- this.location = location;
1847
- this.router = router;
1848
- this.dialogServiceDefaults = dialogServiceDefaults;
1849
- this.matDialogDefaultConfig = matDialogDefaultConfig;
1850
- this.startingGuard = new Guard();
1851
- this._inActivityPromise = new MutableValueModel(false);
1877
+ this.config = config;
1878
+ this._activeModel = new MutableValueModel(false);
1852
1879
  assert$1.notNil(dialogService);
1853
- }
1854
- /**
1855
- * @return {?}
1856
- */
1857
- isActive() {
1858
- return this._inActivityPromise.value;
1880
+ this.onDispose((/**
1881
+ * @return {?}
1882
+ */
1883
+ () => {
1884
+ if (this.isActive()) {
1885
+ lang.illegalState('Dispose called while active.');
1886
+ }
1887
+ }));
1859
1888
  }
1860
1889
  /**
1861
1890
  * @return {?}
1862
1891
  */
1863
1892
  get active() {
1864
- return this._inActivityPromise.readonly;
1865
- }
1866
- /**
1867
- * @template D, R, E
1868
- * @param {?} activityType
1869
- * @param {?=} data
1870
- * @return {?}
1871
- */
1872
- startActivity(activityType, data) {
1873
- return this._startActivity(activityType, data);
1893
+ return this._activeModel.readonly;
1874
1894
  }
1875
1895
  /**
1876
- * @private
1896
+ * @protected
1877
1897
  * @template D, R, E
1878
1898
  * @param {?} activityType
1879
1899
  * @param {?} data
@@ -1888,75 +1908,74 @@ class DialogInteractionService extends InteractionContext {
1888
1908
  */
1889
1909
  a => a.constructor.name)).join(', ')}`);
1890
1910
  }
1891
- return this.startingGuard.whileTrue((/**
1911
+ this._activeModel.value = true;
1912
+ this.notifyActivityStarted();
1913
+ /** @type {?} */
1914
+ const config = Object.assign({}, this.config, {
1915
+ data,
1916
+ disableClose,
1917
+ panelClass: 'dialog-interaction-service'
1918
+ });
1919
+ /** @type {?} */
1920
+ const self = this;
1921
+ /** @type {?} */
1922
+ const matDialogRef = (/** @type {?} */ (this.dialogService.open(ActivityContainerComponent, config)));
1923
+ return new Promise((/**
1924
+ * @param {?} resolve
1925
+ * @param {?} reject
1892
1926
  * @return {?}
1893
1927
  */
1894
- () => {
1895
- // console.log('###### STARTING');
1896
- this._inActivityPromise.value = true;
1897
- // this.currentActivityId = uuid.v1();
1898
- // this.location.go(this.router.routerState.snapshot.url, "aup");
1899
- /** @type {?} */
1900
- const self = this;
1901
- /** @type {?} */
1902
- const config = Object.assign({ autoFocus: false, hasBackdrop: true, closeOnNavigation: false }, this.matDialogDefaultConfig, this.dialogServiceDefaults, {
1903
- data,
1904
- disableClose,
1905
- panelClass: 'dialog-interaction-service'
1906
- });
1928
+ (resolve, reject) => {
1907
1929
  /** @type {?} */
1908
- const matDialogRef = (/** @type {?} */ (this.dialogService.open(ActivityContainerComponent, config)));
1909
- return new Promise((/**
1910
- * @param {?} resolve
1911
- * @param {?} reject
1912
- * @return {?}
1913
- */
1914
- (resolve, reject) => {
1915
- /** @type {?} */
1916
- const activityContainer = matDialogRef.componentInstance;
1917
- self.safelyUpdateActivityListDelegate(activityContainer.activityList);
1918
- activityContainer.initialActivityOutletContext = {
1919
- activityClass: activityType,
1920
- activityData: data,
1921
- /**
1922
- * @param {?} result
1923
- * @return {?}
1924
- */
1925
- onDone(result) {
1926
- resolve(result);
1927
- matDialogRef.close(true); // return true to let the after close listener know we've already handled it.
1928
- },
1929
- /**
1930
- * @param {?} error
1931
- * @return {?}
1932
- */
1933
- onCancel(error) {
1934
- reject(error);
1935
- matDialogRef.close(true); // return true to let the after close listener know we've already handled it.
1936
- }
1937
- };
1938
- // we need to check if our onDone/onCancel methods above we called or if we were
1939
- // closed by the user clicking the backdrop. If the later then we need to reject
1940
- // our promise.
1941
- matDialogRef.afterClosed().subscribe((/**
1942
- * @param {?} promiseAlreadyFinished
1930
+ const activityContainer = matDialogRef.componentInstance;
1931
+ self.safelyUpdateActivityListDelegate(activityContainer.activityList);
1932
+ activityContainer.initialActivityOutletContext = {
1933
+ activityClass: activityType,
1934
+ activityData: data,
1935
+ /**
1936
+ * @param {?} result
1943
1937
  * @return {?}
1944
1938
  */
1945
- promiseAlreadyFinished => {
1946
- if (!promiseAlreadyFinished) {
1947
- reject('auto-closed');
1948
- }
1949
- }));
1950
- matDialogRef.updateSize();
1951
- })).finally((/**
1939
+ onDone(result) {
1940
+ resolve(result);
1941
+ matDialogRef.close(true); // return true to let the after close listener know we've already handled it.
1942
+ },
1943
+ /**
1944
+ * @param {?} error
1945
+ * @return {?}
1946
+ */
1947
+ onCancel(error) {
1948
+ reject(error);
1949
+ matDialogRef.close(true); // return true to let the after close listener know we've already handled it.
1950
+ }
1951
+ };
1952
+ // we need to check if our onDone/onCancel methods above we called or if we were
1953
+ // closed by the user clicking the backdrop. If the later then we need to reject
1954
+ // our promise.
1955
+ matDialogRef.afterClosed().subscribe((/**
1956
+ * @param {?} promiseAlreadyFinished
1952
1957
  * @return {?}
1953
1958
  */
1954
- () => {
1955
- this._inActivityPromise.value = false;
1956
- // console.log('###### FINISHED');
1957
- // this.currentActivityId = null;
1958
- self.safelyUpdateActivityListDelegate(null);
1959
+ promiseAlreadyFinished => {
1960
+ if (!promiseAlreadyFinished) {
1961
+ reject('auto-closed');
1962
+ }
1963
+ }));
1964
+ matDialogRef.updateSize();
1965
+ matDialogRef.afterOpened().subscribe((/**
1966
+ * @param {?} promiseAlreadyFinished
1967
+ * @return {?}
1968
+ */
1969
+ promiseAlreadyFinished => {
1970
+ matDialogRef.updateSize();
1959
1971
  }));
1972
+ })).finally((/**
1973
+ * @return {?}
1974
+ */
1975
+ () => {
1976
+ this._activeModel.value = false;
1977
+ this.notifyActivityFinished();
1978
+ self.safelyUpdateActivityListDelegate(null);
1960
1979
  }));
1961
1980
  }
1962
1981
  /**
@@ -1970,135 +1989,341 @@ class DialogInteractionService extends InteractionContext {
1970
1989
  */
1971
1990
  () => this.setActivityList(delegate)));
1972
1991
  }
1973
- /**
1974
- * @param {?} alert
1975
- * @return {?}
1976
- */
1977
- alert(alert) {
1978
- // TODO: Test disableClose === false
1979
- return this._startActivity(AlertDialogComponent, alert, false);
1980
- }
1981
- /**
1982
- * @param {?} confirm
1983
- * @return {?}
1984
- */
1985
- confirmOrReject(confirm) {
1986
- return this._startActivity(ConfirmationDialogComponent, confirm, true);
1987
- }
1988
- /**
1989
- * @template D, R, E
1990
- * @param {?} confirm
1991
- * @param {?} activityType
1992
- * @param {?=} data
1993
- * @return {?}
1994
- */
1995
- confirmThen(confirm, activityType, data) {
1996
- return this._startActivity(ConfirmThenDialogComponent, {
1997
- confirm,
1998
- activityType: activityType,
1999
- data: data
2000
- }, true);
2001
- }
2002
1992
  }
2003
- DialogInteractionService.decorators = [
1993
+ DialogInteractionContext.decorators = [
2004
1994
  { type: Injectable, args: [{
2005
1995
  providedIn: 'root'
2006
1996
  },] }
2007
1997
  ];
2008
1998
  /** @nocollapse */
2009
- DialogInteractionService.ctorParameters = () => [
1999
+ DialogInteractionContext.ctorParameters = () => [
2010
2000
  { type: MatDialog },
2011
- { type: Location },
2012
- { type: Router },
2013
- { type: MatDialogConfig, decorators: [{ type: Optional }, { type: Inject, args: [DIALOG_INTERACTION_SERVICE_DEFAULTS,] }] },
2014
- { type: MatDialogConfig, decorators: [{ type: Optional }, { type: Inject, args: [MAT_DIALOG_DEFAULT_OPTIONS,] }] }
2001
+ { type: MatDialogConfig }
2015
2002
  ];
2016
- /** @nocollapse */ DialogInteractionService.ngInjectableDef = ɵɵdefineInjectable({ factory: function DialogInteractionService_Factory() { return new DialogInteractionService(ɵɵinject(MatDialog$1), ɵɵinject(Location), ɵɵinject(Router), ɵɵinject(DIALOG_INTERACTION_SERVICE_DEFAULTS, 8), ɵɵinject(MAT_DIALOG_DEFAULT_OPTIONS, 8)); }, token: DialogInteractionService, providedIn: "root" });
2003
+ /** @nocollapse */ DialogInteractionContext.ngInjectableDef = ɵɵdefineInjectable({ factory: function DialogInteractionContext_Factory() { return new DialogInteractionContext(ɵɵinject(MatDialog$1), ɵɵinject(MatDialogConfig)); }, token: DialogInteractionContext, providedIn: "root" });
2017
2004
  if (false) {
2018
2005
  /**
2019
2006
  * @type {?}
2020
2007
  * @private
2021
2008
  */
2022
- DialogInteractionService.prototype.startingGuard;
2023
- /**
2024
- * @type {?}
2025
- * @private
2026
- */
2027
- DialogInteractionService.prototype._inActivityPromise;
2009
+ DialogInteractionContext.prototype._activeModel;
2028
2010
  /**
2029
2011
  * @type {?}
2030
2012
  * @private
2031
2013
  */
2032
- DialogInteractionService.prototype.dialogService;
2033
- /** @type {?} */
2034
- DialogInteractionService.prototype.location;
2035
- /** @type {?} */
2036
- DialogInteractionService.prototype.router;
2037
- /** @type {?} */
2038
- DialogInteractionService.prototype.dialogServiceDefaults;
2014
+ DialogInteractionContext.prototype.dialogService;
2039
2015
  /** @type {?} */
2040
- DialogInteractionService.prototype.matDialogDefaultConfig;
2041
- }
2042
-
2043
- /**
2044
- * @fileoverview added by tsickle
2045
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2046
- */
2047
- class InteractionModule {
2016
+ DialogInteractionContext.prototype.config;
2048
2017
  }
2049
- InteractionModule.decorators = [
2050
- { type: NgModule, args: [{
2051
- imports: [
2052
- CommonModule,
2053
- MatButtonModule,
2054
- MatDialogModule,
2055
- MatTabsModule$1,
2056
- PortalModule,
2057
- RouterModule
2058
- ],
2059
- declarations: [
2060
- ActivityContainerComponent,
2061
- ConfirmationDialogComponent,
2062
- ConfirmThenDialogComponent,
2063
- AlertDialogComponent,
2064
- ActivityOutletComponent,
2065
- InteractionOutletComponent,
2066
- InplaceInteractionContextComponent
2067
- ],
2068
- exports: [
2069
- ActivityContainerComponent,
2070
- ActivityOutletComponent,
2071
- InteractionOutletComponent,
2072
- InplaceInteractionContextComponent
2073
- ],
2074
- entryComponents: [
2075
- ActivityContainerComponent,
2076
- ConfirmationDialogComponent,
2077
- ConfirmThenDialogComponent,
2078
- AlertDialogComponent
2079
- ],
2080
- providers: [
2081
- DialogInteractionService,
2082
- ]
2083
- },] }
2084
- ];
2085
2018
 
2086
2019
  /**
2087
2020
  * @fileoverview added by tsickle
2088
2021
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2089
2022
  */
2090
- /**
2091
- * @abstract
2092
- * @template T, E
2093
- */
2094
- class ParameterDefinition {
2023
+ class Guard extends ValueModel {
2024
+ constructor() {
2025
+ super({ initialValue: false });
2026
+ }
2095
2027
  /**
2096
- * @param {?} propertyName
2097
- * @param {?} options
2098
- * @param {?=} urlFormat
2028
+ * @return {?}
2099
2029
  */
2100
- constructor(propertyName, options, urlFormat) {
2101
- this.propertyName = propertyName;
2030
+ get value() {
2031
+ return this.store.read();
2032
+ }
2033
+ /**
2034
+ * @template R
2035
+ * @param {?} fun
2036
+ * @return {?}
2037
+ */
2038
+ whileTrue(fun) {
2039
+ this.startTransaction().commit(true);
2040
+ try {
2041
+ return fun();
2042
+ }
2043
+ finally {
2044
+ this.startTransaction().commit(false);
2045
+ }
2046
+ }
2047
+ /**
2048
+ * @template R
2049
+ * @param {?} fun
2050
+ * @param {?=} defaultValue
2051
+ * @return {?}
2052
+ */
2053
+ runIfFalse(fun, defaultValue = null) {
2054
+ return !this.value ? fun() : defaultValue;
2055
+ }
2056
+ }
2057
+ /**
2058
+ * @abstract
2059
+ */
2060
+ class ModalInteractionService extends GarbageCollector {
2061
+ constructor() {
2062
+ super();
2063
+ this._activityListeners = new EventListenerList();
2064
+ }
2065
+ /**
2066
+ * @return {?}
2067
+ */
2068
+ isActive() {
2069
+ return this.active.value;
2070
+ }
2071
+ /**
2072
+ * @param {?} listener
2073
+ * @return {?}
2074
+ */
2075
+ addActivityListener(listener) {
2076
+ return this._activityListeners.add(listener);
2077
+ }
2078
+ /**
2079
+ * @protected
2080
+ * @return {?}
2081
+ */
2082
+ notifyActivityStarted() {
2083
+ this._activityListeners.fire((/**
2084
+ * @param {?} l
2085
+ * @return {?}
2086
+ */
2087
+ l => l.onActivityStarted()));
2088
+ }
2089
+ /**
2090
+ * @protected
2091
+ * @return {?}
2092
+ */
2093
+ notifyActivityFinished() {
2094
+ this._activityListeners.fire((/**
2095
+ * @param {?} l
2096
+ * @return {?}
2097
+ */
2098
+ l => l.onActivityFinished()));
2099
+ }
2100
+ }
2101
+ if (false) {
2102
+ /**
2103
+ * @type {?}
2104
+ * @private
2105
+ */
2106
+ ModalInteractionService.prototype._activityListeners;
2107
+ /** @type {?} */
2108
+ ModalInteractionService.prototype.active;
2109
+ /**
2110
+ * @abstract
2111
+ * @param {?} disposable
2112
+ * @return {?}
2113
+ */
2114
+ ModalInteractionService.prototype.createInteractionContextFor = function (disposable) { };
2115
+ /**
2116
+ * @abstract
2117
+ * @return {?}
2118
+ */
2119
+ ModalInteractionService.prototype.createExclusiveInteractionContext = function () { };
2120
+ /**
2121
+ * @abstract
2122
+ * @return {?}
2123
+ */
2124
+ ModalInteractionService.prototype.getCurrentActivity = function () { };
2125
+ }
2126
+
2127
+ /**
2128
+ * @fileoverview added by tsickle
2129
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2130
+ */
2131
+ /** @type {?} */
2132
+ const DIALOG_INTERACTION_SERVICE_DEFAULTS = new InjectionToken('DIALOG_INTERACTION_SERVICE_DEFAULTS');
2133
+ class DialogInteractionService extends ModalInteractionService {
2134
+ /**
2135
+ * @param {?} dialogService
2136
+ * @param {?} dialogServiceDefaults
2137
+ * @param {?} matDialogDefaultConfig
2138
+ */
2139
+ constructor(dialogService, dialogServiceDefaults, matDialogDefaultConfig) {
2140
+ super();
2141
+ this.dialogService = dialogService;
2142
+ this.dialogServiceDefaults = dialogServiceDefaults;
2143
+ this.matDialogDefaultConfig = matDialogDefaultConfig;
2144
+ this._activeInteractionContextModel = new MutableValueModel();
2145
+ assert$1.notNil(dialogService);
2146
+ const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
2147
+ this.active = chain(this._activeInteractionContextModel).isNotNil();
2148
+ }
2149
+ /**
2150
+ * @param {?} disposable
2151
+ * @return {?}
2152
+ */
2153
+ createInteractionContextFor(disposable) {
2154
+ return disposable.registerDisposable(this._createInteractionContext());
2155
+ }
2156
+ /**
2157
+ * @return {?}
2158
+ */
2159
+ _createInteractionContext() {
2160
+ /** @type {?} */
2161
+ const config = Object.assign({ autoFocus: false, hasBackdrop: true, closeOnNavigation: false }, this.matDialogDefaultConfig, this.dialogServiceDefaults);
2162
+ /** @type {?} */
2163
+ const self = this;
2164
+ /** @type {?} */
2165
+ const dialogInteractionContext = new DialogInteractionContext(this.dialogService, config);
2166
+ dialogInteractionContext.registerDisposable(dialogInteractionContext.addActivityListener({
2167
+ /**
2168
+ * @return {?}
2169
+ */
2170
+ onActivityStarted() {
2171
+ self.onActivityStarted(dialogInteractionContext);
2172
+ },
2173
+ /**
2174
+ * @return {?}
2175
+ */
2176
+ onActivityFinished() {
2177
+ self.onActivityFinished(dialogInteractionContext);
2178
+ }
2179
+ }));
2180
+ return dialogInteractionContext;
2181
+ }
2182
+ /**
2183
+ * @return {?}
2184
+ */
2185
+ createExclusiveInteractionContext() {
2186
+ this.exclusiveContext = this._createInteractionContext();
2187
+ /** @type {?} */
2188
+ const self = this;
2189
+ this.exclusiveContext.registerDisposable({
2190
+ /**
2191
+ * @return {?}
2192
+ */
2193
+ dispose() {
2194
+ self.exclusiveContext = null;
2195
+ }
2196
+ });
2197
+ return this.exclusiveContext;
2198
+ }
2199
+ // @Trace()
2200
+ /**
2201
+ * @param {?} dialogInteractionContext
2202
+ * @return {?}
2203
+ */
2204
+ onActivityStarted(dialogInteractionContext) {
2205
+ assert$1.isFalsey(this.isActive());
2206
+ if (this.exclusiveContext && dialogInteractionContext !== this.exclusiveContext) {
2207
+ lang.illegalState("Interaction started while exclusive lock active. This is usually because you using a different context during place.canDeactivate(interactionContext)");
2208
+ }
2209
+ this._activeInteractionContextModel.value = dialogInteractionContext;
2210
+ this.notifyActivityStarted();
2211
+ }
2212
+ // @Trace()
2213
+ /**
2214
+ * @param {?} dialogInteractionContext
2215
+ * @return {?}
2216
+ */
2217
+ onActivityFinished(dialogInteractionContext) {
2218
+ assert$1.isTruthy(this._activeInteractionContextModel.value === dialogInteractionContext);
2219
+ this._activeInteractionContextModel.value = null;
2220
+ this.notifyActivityFinished();
2221
+ }
2222
+ /**
2223
+ * @return {?}
2224
+ */
2225
+ getCurrentActivity() {
2226
+ return __awaiter(this, void 0, void 0, function* () {
2227
+ assert$1.isTruthy(this.isActive());
2228
+ return this._activeInteractionContextModel.value.getCurrentActivity();
2229
+ });
2230
+ }
2231
+ }
2232
+ DialogInteractionService.decorators = [
2233
+ { type: Injectable, args: [{
2234
+ providedIn: 'root'
2235
+ },] }
2236
+ ];
2237
+ /** @nocollapse */
2238
+ DialogInteractionService.ctorParameters = () => [
2239
+ { type: MatDialog },
2240
+ { type: MatDialogConfig, decorators: [{ type: Optional }, { type: Inject, args: [DIALOG_INTERACTION_SERVICE_DEFAULTS,] }] },
2241
+ { type: MatDialogConfig, decorators: [{ type: Optional }, { type: Inject, args: [MAT_DIALOG_DEFAULT_OPTIONS,] }] }
2242
+ ];
2243
+ /** @nocollapse */ DialogInteractionService.ngInjectableDef = ɵɵdefineInjectable({ factory: function DialogInteractionService_Factory() { return new DialogInteractionService(ɵɵinject(MatDialog$1), ɵɵinject(DIALOG_INTERACTION_SERVICE_DEFAULTS, 8), ɵɵinject(MAT_DIALOG_DEFAULT_OPTIONS, 8)); }, token: DialogInteractionService, providedIn: "root" });
2244
+ if (false) {
2245
+ /**
2246
+ * @type {?}
2247
+ * @private
2248
+ */
2249
+ DialogInteractionService.prototype._activeInteractionContextModel;
2250
+ /** @type {?} */
2251
+ DialogInteractionService.prototype.active;
2252
+ /**
2253
+ * @type {?}
2254
+ * @private
2255
+ */
2256
+ DialogInteractionService.prototype.exclusiveContext;
2257
+ /**
2258
+ * @type {?}
2259
+ * @private
2260
+ */
2261
+ DialogInteractionService.prototype.dialogService;
2262
+ /** @type {?} */
2263
+ DialogInteractionService.prototype.dialogServiceDefaults;
2264
+ /** @type {?} */
2265
+ DialogInteractionService.prototype.matDialogDefaultConfig;
2266
+ }
2267
+
2268
+ /**
2269
+ * @fileoverview added by tsickle
2270
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2271
+ */
2272
+ class InteractionModule {
2273
+ }
2274
+ InteractionModule.decorators = [
2275
+ { type: NgModule, args: [{
2276
+ imports: [
2277
+ CommonModule,
2278
+ MatButtonModule,
2279
+ MatDialogModule,
2280
+ MatTabsModule$1,
2281
+ PortalModule,
2282
+ RouterModule
2283
+ ],
2284
+ declarations: [
2285
+ ActivityContainerComponent,
2286
+ ConfirmationDialogComponent,
2287
+ ConfirmThenDialogComponent,
2288
+ AlertDialogComponent,
2289
+ ActivityOutletComponent,
2290
+ InteractionOutletComponent,
2291
+ InplaceInteractionContextComponent
2292
+ ],
2293
+ exports: [
2294
+ ActivityContainerComponent,
2295
+ ActivityOutletComponent,
2296
+ InteractionOutletComponent,
2297
+ InplaceInteractionContextComponent
2298
+ ],
2299
+ entryComponents: [
2300
+ ActivityContainerComponent,
2301
+ ConfirmationDialogComponent,
2302
+ ConfirmThenDialogComponent,
2303
+ AlertDialogComponent
2304
+ ],
2305
+ providers: [
2306
+ DialogInteractionService,
2307
+ ]
2308
+ },] }
2309
+ ];
2310
+
2311
+ /**
2312
+ * @fileoverview added by tsickle
2313
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2314
+ */
2315
+ /**
2316
+ * @abstract
2317
+ * @template T, E
2318
+ */
2319
+ class ParameterDefinition {
2320
+ /**
2321
+ * @param {?} propertyName
2322
+ * @param {?} options
2323
+ * @param {?=} urlFormat
2324
+ */
2325
+ constructor(propertyName, options, urlFormat) {
2326
+ this.propertyName = propertyName;
2102
2327
  this.urlFormat = urlFormat;
2103
2328
  this.options = Opts.get(options);
2104
2329
  this.remember = this.options.getOptional('remember', false);
@@ -2853,74 +3078,153 @@ if (false) {
2853
3078
  * @fileoverview added by tsickle
2854
3079
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2855
3080
  */
2856
- /**
2857
- * @abstract
2858
- */
2859
- class NavigationSession {
3081
+ class PlaceComponentDeactivationHandler {
2860
3082
  /**
2861
- * @protected
2862
- * @param {?} firstNavigation
2863
- * @param {?} appModalInteractionContext
3083
+ * @param {?} component
3084
+ * @param {?} navigationSession
2864
3085
  */
2865
- constructor(firstNavigation, appModalInteractionContext) {
2866
- this.firstNavigation = firstNavigation;
2867
- this.appModalInteractionContext = appModalInteractionContext;
2868
- this._alreadyAccepted = [];
2869
- this._visits = new Map();
2870
- this.componentDeactivationHandlers = new Map();
2871
- this.dialogOpenOnStart = this.appModalInteractionContext.isActive();
3086
+ constructor(component, navigationSession) {
3087
+ this.component = component;
3088
+ this.navigationSession = navigationSession;
2872
3089
  }
2873
3090
  /**
2874
- * @param {?} visit
3091
+ * @param {?} nextState
2875
3092
  * @return {?}
2876
3093
  */
2877
- storeVisit(visit) {
2878
- this._visits.set(visit.placeDefinition, visit);
3094
+ canDeactivate(nextState) {
3095
+ return __awaiter(this, void 0, void 0, function* () {
3096
+ // We'll get called multiple times if there's any parameter sanitisation so
3097
+ // we always return true if we accepted promise from a previous cycle of the current
3098
+ // navigation session.
3099
+ if (!this.canDeactivatePromise) {
3100
+ this.canDeactivatePromise = this.canDeactivateComponent(nextState);
3101
+ }
3102
+ return this.canDeactivatePromise;
3103
+ });
2879
3104
  }
2880
3105
  /**
2881
- * @param {?} placeDef
3106
+ * @protected
3107
+ * @param {?} nextState
2882
3108
  * @return {?}
2883
3109
  */
2884
- getVisitFor(placeDef) {
2885
- return this._visits.get(placeDef);
3110
+ canDeactivateComponent(nextState) {
3111
+ return __awaiter(this, void 0, void 0, function* () {
3112
+ // Automatically cancel any active activities if the navigation session was triggered
3113
+ // by the back button.
3114
+ if (this.navigationSession.isPopState && this.component.interactionContext && this.component.interactionContext.isActive()) {
3115
+ // Note: any modal interactions run in a different router outlet so we should never get place deactivated while
3116
+ // one is active. This is because:
3117
+ // 1. the user can't click anything to navigate away
3118
+ // 2. clicking the back button will only change the outlet route and will leave the component route alone. This
3119
+ // is all handled by the InteractionGuard and so the component guards will never run.
3120
+ // TODO: how will I handle this now??
3121
+ // BUT: activities could call navigate while they're still active.. but we'll barf and tell them
3122
+ // to call activity.done(newVisitToNavigateTo) and let the caller do the navigate after the
3123
+ // dialog has closed.
3124
+ // Can I capture this in placeRouter.navigate(..) ? i.e. navigationSession && navigationSession.interactionContext.isActive()
3125
+ // Or can I just ignore it altogether?
3126
+ // 1. I no longer have a singleton dialog interaction that can be returned from any component in the deactivation cycle.
3127
+ // 2. We only ever check the component once per nav cycle
3128
+ // 3. The navigation session interaction context will barf if multiple components try and use it at once.
3129
+ // if (this.component.interactionContext instanceof DialogInteractionContext) {
3130
+ // // BUT: activities could call navigate while they're still active.. but we'll barf and tell them
3131
+ // // to call activity.done(newVisitToNavigateTo) and let the caller do the navigate after the
3132
+ // // dialog has closed.
3133
+ // lang.illegalState('Navigation started from an activity in a modal dialog. Have your activity return a Visit instead and navigate after the activity has finished');
3134
+ // }
3135
+ // Now we just cancel the current activity and stay where we are
3136
+ this.cancelCurrentActivityOf(this.component.interactionContext);
3137
+ return false;
3138
+ }
3139
+ // Ok, so now we're really leaving, so we ask the component if we should.;
3140
+ if (this.isNotJustAChangeInRouteId(nextState) && this.component.canDeactivate) {
3141
+ // No interaction in progress, so ask the component .
3142
+ // This may start an interaction, hence checking the interaction context before now. I.e. if the place pops up the dialog, and
3143
+ // the user clicks back again, we'll re-enter here and go bang when the component tries to open another dialog.
3144
+ return this.component.canDeactivate(this.navigationSession.interactionContext);
3145
+ }
3146
+ return true;
3147
+ });
2886
3148
  }
2887
3149
  /**
2888
- * @param {?} component
2889
- * @param {?} nextState
3150
+ * @protected
3151
+ * @param {?} interactionContext
2890
3152
  * @return {?}
2891
3153
  */
2892
- canDeactivate(component, nextState) {
3154
+ cancelCurrentActivityOf(interactionContext) {
2893
3155
  return __awaiter(this, void 0, void 0, function* () {
2894
- // lookup the handler and create it if we've not seen it yet
2895
3156
  /** @type {?} */
2896
- let handler = this.componentDeactivationHandlers.get(component);
2897
- if (!handler) {
2898
- /** @type {?} */
2899
- const isPrimaryHandler = this.componentDeactivationHandlers.size === 0;
2900
- handler = new NavigationSession.ComponentDeactivationHandler(component, this.appModalInteractionContext, isPrimaryHandler);
2901
- this.componentDeactivationHandlers.set(component, handler);
2902
- }
2903
- return handler.canDeactivate(nextState);
3157
+ const activity = yield interactionContext.getCurrentActivity();
3158
+ console.log('cancelling', { activity });
3159
+ activity.cancel(null);
2904
3160
  });
2905
3161
  }
2906
3162
  /**
2907
- * @param {?} url
3163
+ * @protected
3164
+ * @param {?} nextState
3165
+ * @return {?}
3166
+ */
3167
+ isNotJustAChangeInRouteId(nextState) {
3168
+ // Because places with a route-id cover two route segments we get asked to deactivate
3169
+ // if the route id is added or removed. So if our path is still present the url
3170
+ // then we shouldn't deactivate the place.
3171
+ return !nextState.includesPathOf(this.component.placeDefinition);
3172
+ }
3173
+ }
3174
+ if (false) {
3175
+ /**
3176
+ * @type {?}
3177
+ * @private
3178
+ */
3179
+ PlaceComponentDeactivationHandler.prototype.canDeactivatePromise;
3180
+ /** @type {?} */
3181
+ PlaceComponentDeactivationHandler.prototype.component;
3182
+ /** @type {?} */
3183
+ PlaceComponentDeactivationHandler.prototype.navigationSession;
3184
+ }
3185
+
3186
+ /**
3187
+ * @fileoverview added by tsickle
3188
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3189
+ */
3190
+ /**
3191
+ * @abstract
3192
+ */
3193
+ class NavigationSession extends GarbageCollector {
3194
+ /**
3195
+ * @param {?} context
3196
+ */
3197
+ constructor(context) {
3198
+ super();
3199
+ this.context = context;
3200
+ this._visits = new Map();
3201
+ }
3202
+ /**
2908
3203
  * @return {?}
2909
3204
  */
2910
- setPopstateReturnUrl(url) {
2911
- this._popStateReturnUrl = url;
3205
+ get interactionContext() {
3206
+ return null;
2912
3207
  }
2913
3208
  /**
3209
+ * @param {?} visit
3210
+ * @return {?}
3211
+ */
3212
+ storeVisit(visit) {
3213
+ this._visits.set(visit.placeDefinition, visit);
3214
+ }
3215
+ /**
3216
+ * @param {?} placeDef
2914
3217
  * @return {?}
2915
3218
  */
2916
- get isPopState() {
2917
- return !!this._popStateReturnUrl;
3219
+ getVisitFor(placeDef) {
3220
+ return this._visits.get(placeDef);
2918
3221
  }
2919
3222
  /**
3223
+ * @param {?} newUrl
2920
3224
  * @return {?}
2921
3225
  */
2922
- get popStateReturnUrl() {
2923
- return this._popStateReturnUrl;
3226
+ onBackClickedDuringNavigationInteraction(newUrl) {
3227
+ return this.illegalTransition('onBackClickedDuringNavigationInteraction');
2924
3228
  }
2925
3229
  /**
2926
3230
  * @return {?}
@@ -2928,573 +3232,733 @@ class NavigationSession {
2928
3232
  getVisits() {
2929
3233
  return Array.from(this._visits.values());
2930
3234
  }
2931
- }
2932
- if (false) {
2933
3235
  /**
2934
- * @type {?}
2935
- * @private
3236
+ * @protected
3237
+ * @template R
3238
+ * @param {?} message
3239
+ * @return {?}
2936
3240
  */
2937
- NavigationSession.prototype._alreadyAccepted;
3241
+ illegalTransition(message) {
3242
+ return lang.illegalState(`${message.toString()} not supported by ${this.toString()}`);
3243
+ }
2938
3244
  /**
2939
- * @type {?}
2940
- * @private
3245
+ * @protected
3246
+ * @return {?}
2941
3247
  */
2942
- NavigationSession.prototype._visits;
3248
+ currentRouterUrl() {
3249
+ return this.context.router.routerState ? this.context.router.routerState.snapshot.url : null;
3250
+ }
3251
+ /**
3252
+ * @protected
3253
+ * @param {?} event
3254
+ * @return {?}
3255
+ */
3256
+ createActiveSession(event) {
3257
+ // TODO: check if the event is purely for interaction context changes.
3258
+ return new NavigationSession.Active(this.context, event.navigationTrigger === 'popstate', this.currentRouterUrl());
3259
+ }
3260
+ /**
3261
+ * @protected
3262
+ * @param {?} url
3263
+ * @return {?}
3264
+ */
3265
+ updateLocation(url) {
3266
+ this.context.angularLocation.go(url);
3267
+ }
3268
+ /**
3269
+ * @return {?}
3270
+ */
3271
+ toString() {
3272
+ return this.constructor.name;
3273
+ }
3274
+ }
3275
+ __decorate([
3276
+ Trace(),
3277
+ __metadata("design:type", Function),
3278
+ __metadata("design:paramtypes", [Object]),
3279
+ __metadata("design:returntype", void 0)
3280
+ ], NavigationSession.prototype, "updateLocation", null);
3281
+ if (false) {
2943
3282
  /**
2944
3283
  * @type {?}
2945
3284
  * @private
2946
3285
  */
2947
- NavigationSession.prototype._popStateReturnUrl;
3286
+ NavigationSession.prototype._visits;
3287
+ /** @type {?} */
3288
+ NavigationSession.prototype.isPopState;
2948
3289
  /** @type {?} */
2949
- NavigationSession.prototype.isExternal;
3290
+ NavigationSession.prototype.active;
2950
3291
  /** @type {?} */
2951
- NavigationSession.prototype.dialogOpenOnStart;
3292
+ NavigationSession.prototype.startingUrl;
2952
3293
  /**
2953
3294
  * @type {?}
2954
- * @private
3295
+ * @protected
2955
3296
  */
2956
- NavigationSession.prototype.componentDeactivationHandlers;
2957
- /** @type {?} */
2958
- NavigationSession.prototype.firstNavigation;
3297
+ NavigationSession.prototype.context;
2959
3298
  /**
2960
- * @type {?}
2961
- * @private
3299
+ * @abstract
3300
+ * @param {?} event
3301
+ * @return {?}
2962
3302
  */
2963
- NavigationSession.prototype.appModalInteractionContext;
3303
+ NavigationSession.prototype.onStart = function (event) { };
3304
+ /**
3305
+ * @abstract
3306
+ * @param {?} event
3307
+ * @return {?}
3308
+ */
3309
+ NavigationSession.prototype.onCancel = function (event) { };
3310
+ /**
3311
+ * @abstract
3312
+ * @param {?} event
3313
+ * @return {?}
3314
+ */
3315
+ NavigationSession.prototype.onError = function (event) { };
3316
+ /**
3317
+ * @abstract
3318
+ * @param {?} event
3319
+ * @return {?}
3320
+ */
3321
+ NavigationSession.prototype.onEnd = function (event) { };
3322
+ /**
3323
+ * @abstract
3324
+ * @param {?} component
3325
+ * @param {?} nextState
3326
+ * @return {?}
3327
+ */
3328
+ NavigationSession.prototype.canDeactivatePlace = function (component, nextState) { };
2964
3329
  }
2965
3330
  (function (NavigationSession) {
2966
- class External extends NavigationSession {
3331
+ class Context {
2967
3332
  /**
2968
- * @param {?} isFirstTime
2969
- * @param {?} appModelInteractionContext
3333
+ * @param {?} router
3334
+ * @param {?} modalInteractionService
3335
+ * @param {?} angularLocation
3336
+ * @param {?} notifySuccess
2970
3337
  */
2971
- constructor(isFirstTime, appModelInteractionContext) {
2972
- super(isFirstTime, appModelInteractionContext);
2973
- this.isExternal = true;
3338
+ constructor(router, modalInteractionService, angularLocation, notifySuccess) {
3339
+ this.router = router;
3340
+ this.modalInteractionService = modalInteractionService;
3341
+ this.angularLocation = angularLocation;
3342
+ this.notifySuccess = notifySuccess;
2974
3343
  }
2975
3344
  }
3345
+ NavigationSession.Context = Context;
2976
3346
  if (false) {
2977
3347
  /** @type {?} */
2978
- External.prototype.isExternal;
3348
+ Context.prototype.router;
3349
+ /** @type {?} */
3350
+ Context.prototype.modalInteractionService;
3351
+ /** @type {?} */
3352
+ Context.prototype.angularLocation;
3353
+ /** @type {?} */
3354
+ Context.prototype.notifySuccess;
2979
3355
  }
2980
- class Internal extends NavigationSession {
3356
+ class Idle extends NavigationSession {
2981
3357
  /**
2982
- * @param {?} visit
2983
- * @param {?} appModelInteractionContext
3358
+ * @param {?} context
2984
3359
  */
2985
- constructor(visit, appModelInteractionContext) {
2986
- super(false, appModelInteractionContext);
2987
- this.isExternal = false;
2988
- this.storeVisit(visit);
3360
+ constructor(context) {
3361
+ super(context);
3362
+ this.active = false;
3363
+ this.startingUrl = null;
3364
+ }
3365
+ /**
3366
+ * @param {?} component
3367
+ * @param {?} nextState
3368
+ * @return {?}
3369
+ */
3370
+ canDeactivatePlace(component, nextState) {
3371
+ return __awaiter(this, void 0, void 0, function* () {
3372
+ return this.illegalTransition('canDeactivatePlace');
3373
+ });
3374
+ }
3375
+ /**
3376
+ * @param {?} event
3377
+ * @return {?}
3378
+ */
3379
+ onStart(event) {
3380
+ // calling angularLocation.go() to clear back state can trigger router cycles to the current url if we don't ignore them
3381
+ if (event.url === this.currentRouterUrl()) {
3382
+ Logger.get(this).info(`navigation started to same url -> ${event.url}`);
3383
+ return this;
3384
+ }
3385
+ if (event.url === (`${this.currentRouterUrl()}(aup-interaction:modal)`)) {
3386
+ Logger.get(this).info(`navigation started with interaction outlet -> ${event.url}`);
3387
+ return new ModalInteractionSession(this.context, event.url);
3388
+ }
3389
+ return this.createActiveSession(event);
2989
3390
  }
2990
- }
2991
- if (false) {
2992
- /** @type {?} */
2993
- Internal.prototype.isExternal;
2994
- }
2995
- class Factory {
2996
3391
  /**
2997
- * @param {?} interactionContext
3392
+ * @param {?} event
3393
+ * @return {?}
2998
3394
  */
2999
- constructor(interactionContext) {
3000
- this.interactionContext = interactionContext;
3395
+ onCancel(event) {
3396
+ return this.illegalTransition(event);
3001
3397
  }
3002
3398
  /**
3003
- * @param {?} visit
3399
+ * @param {?} event
3004
3400
  * @return {?}
3005
3401
  */
3006
- createInternal(visit) {
3007
- return new Internal(visit, this.interactionContext);
3402
+ onEnd(event) {
3403
+ return this.illegalTransition(event);
3008
3404
  }
3009
3405
  /**
3010
- * @param {?} firstTimeRoute
3406
+ * @param {?} event
3011
3407
  * @return {?}
3012
3408
  */
3013
- createExternal(firstTimeRoute) {
3014
- return new External(firstTimeRoute, this.interactionContext);
3409
+ onError(event) {
3410
+ return this.illegalTransition(event);
3015
3411
  }
3016
3412
  }
3017
- NavigationSession.Factory = Factory;
3413
+ NavigationSession.Idle = Idle;
3018
3414
  if (false) {
3019
3415
  /** @type {?} */
3020
- Factory.prototype.interactionContext;
3416
+ Idle.prototype.isPopState;
3417
+ /** @type {?} */
3418
+ Idle.prototype.active;
3419
+ /** @type {?} */
3420
+ Idle.prototype.startingUrl;
3021
3421
  }
3022
- class ComponentDeactivationHandler {
3422
+ class Active extends NavigationSession {
3023
3423
  /**
3024
- * @param {?} component
3025
- * @param {?} appModelInteractionContext
3026
- * @param {?} primary
3424
+ * @param {?} context
3425
+ * @param {?} isPopState
3426
+ * @param {?} startingUrl
3027
3427
  */
3028
- constructor(component, appModelInteractionContext, primary) {
3029
- this.component = component;
3030
- this.appModelInteractionContext = appModelInteractionContext;
3031
- this.primary = primary;
3032
- this.alreadyAccepted = false;
3033
- // super();
3428
+ constructor(context, isPopState, startingUrl) {
3429
+ super(context);
3430
+ this.isPopState = isPopState;
3431
+ this.startingUrl = startingUrl;
3432
+ this.active = true;
3433
+ this.componentDeactivationHandlers = new Map();
3434
+ this._interactionContext = this.context.modalInteractionService.createExclusiveInteractionContext();
3435
+ this.onDispose((/**
3436
+ * @return {?}
3437
+ */
3438
+ () => {
3439
+ // the interaction context can be detached during the back button cancellation state transition
3440
+ // as the transition is synchronous and activityCancellation isn't. Otherwise dispose will be
3441
+ // called before the context has been cancelled. It might be work having the interaction context
3442
+ // automatically cancel if the context is disposed.
3443
+ if (this._interactionContext) {
3444
+ this._interactionContext.dispose();
3445
+ }
3446
+ }));
3034
3447
  }
3035
3448
  /**
3036
- * @param {?} nextState
3037
3449
  * @return {?}
3038
3450
  */
3039
- canDeactivate(nextState) {
3040
- return __awaiter(this, void 0, void 0, function* () {
3041
- console.log(`${this.constructor.name}.canDeactivate`, { component: this.component });
3042
- if (this.alreadyAccepted) {
3043
- // We'll get called multiple times if there's any parameter sanitisation so
3044
- // we always return true if we accepted on a previous cycle of the current
3045
- // navigation session.
3046
- return true;
3047
- }
3048
- else {
3049
- if (this.primary && this.appModelInteractionContext.isActive()) {
3050
- // We check the global interaction first
3051
- yield this.cancelCurrentActivityOf(this.appModelInteractionContext);
3052
- return false;
3053
- }
3054
- this.alreadyAccepted = yield this.canDeactivateComponent(nextState);
3055
- return this.alreadyAccepted;
3056
- }
3057
- });
3451
+ get interactionContext() {
3452
+ return this._interactionContext;
3058
3453
  }
3059
3454
  /**
3060
- * @protected
3061
- * @param {?} nextState
3455
+ * @param {?} event
3062
3456
  * @return {?}
3063
3457
  */
3064
- canDeactivateComponent(nextState) {
3065
- return __awaiter(this, void 0, void 0, function* () {
3066
- // check if the component has an active interaction. This will handle
3067
- // an inplace interaction contexts
3068
- /** @type {?} */
3069
- const hasCustomInteractionContext = this.component.interactionContext &&
3070
- !this.isAppModalInteractionContext(this.component.interactionContext) &&
3071
- this.component.interactionContext.isActive();
3072
- if (hasCustomInteractionContext) {
3073
- this.cancelCurrentActivityOf(this.component.interactionContext);
3074
- return false;
3075
- }
3076
- if (this.isLeavingCurrentPlace(nextState) && this.component.canDeactivate) {
3077
- // No interaction in progress, so ask the component .
3078
- // This may start an interaction, hence checking the interaction context before now. I.e. if the place pops up the dialog, and
3079
- // the user clicks back again, we'll re-enter here and go bang when the component tries to open another dialog.
3080
- return this.component.canDeactivate();
3081
- }
3082
- return true;
3083
- });
3458
+ onStart(event) {
3459
+ // active sessions can have many cancel start cycles.
3460
+ return this;
3461
+ }
3462
+ /**
3463
+ * @param {?} event
3464
+ * @return {?}
3465
+ */
3466
+ onEnd(event) {
3467
+ // navigation succeeded
3468
+ this.context.notifySuccess(this);
3469
+ return new Idle(this.context);
3470
+ }
3471
+ /**
3472
+ * @param {?} event
3473
+ * @return {?}
3474
+ */
3475
+ onCancel(event) {
3476
+ // active sessions can have many cancel start cycles.
3477
+ return this;
3478
+ }
3479
+ /**
3480
+ * @param {?} event
3481
+ * @return {?}
3482
+ */
3483
+ onError(event) {
3484
+ // navigation was aborted.
3485
+ if (this.isPopState && this.currentRouterUrl() !== this.startingUrl) {
3486
+ // Angular doesn't preserve the url when a guard cancels the back button.
3487
+ // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
3488
+ Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
3489
+ this.updateLocation(this.startingUrl);
3490
+ }
3491
+ return new Idle(this.context);
3084
3492
  }
3085
3493
  /**
3086
- * @param {?} interactionContext
3494
+ * @param {?} locationTriggerUrl
3087
3495
  * @return {?}
3088
3496
  */
3089
- isAppModalInteractionContext(interactionContext) {
3090
- return this.appModelInteractionContext === interactionContext;
3497
+ onBackClickedDuringNavigationInteraction(locationTriggerUrl) {
3498
+ /** @type {?} */
3499
+ const context = this.detachInteractionContext();
3500
+ context.getCurrentActivity().then((/**
3501
+ * @param {?} activity
3502
+ * @return {?}
3503
+ */
3504
+ activity => {
3505
+ context.addActivityListener({
3506
+ /**
3507
+ * @return {?}
3508
+ */
3509
+ onActivityFinished() {
3510
+ context.dispose();
3511
+ },
3512
+ /**
3513
+ * @return {?}
3514
+ */
3515
+ onActivityStarted() {
3516
+ }
3517
+ });
3518
+ activity.cancel(null);
3519
+ }));
3520
+ return new CancelledDuringNavigationInteraction(this.context, this.startingUrl, locationTriggerUrl);
3091
3521
  }
3092
3522
  /**
3093
- * @protected
3094
- * @param {?} interactionContext
3523
+ * @param {?} component
3524
+ * @param {?} nextState
3095
3525
  * @return {?}
3096
3526
  */
3097
- cancelCurrentActivityOf(interactionContext) {
3527
+ canDeactivatePlace(component, nextState) {
3098
3528
  return __awaiter(this, void 0, void 0, function* () {
3529
+ // lookup the handler and create it if we've not seen it yet
3099
3530
  /** @type {?} */
3100
- const activity = yield interactionContext.getCurrentActivity();
3101
- console.log('cancelling', { activity });
3102
- activity.cancel(null);
3531
+ let handler = this.componentDeactivationHandlers.get(component);
3532
+ if (!handler) {
3533
+ /** @type {?} */
3534
+ const isPrimaryHandler = this.componentDeactivationHandlers.size === 0;
3535
+ handler = new PlaceComponentDeactivationHandler(component, this);
3536
+ this.componentDeactivationHandlers.set(component, handler);
3537
+ }
3538
+ return handler.canDeactivate(nextState);
3103
3539
  });
3104
3540
  }
3105
3541
  /**
3106
- * @protected
3107
- * @param {?} nextState
3542
+ * @private
3543
+ * @return {?}
3544
+ */
3545
+ detachInteractionContext() {
3546
+ /** @type {?} */
3547
+ const context = this._interactionContext;
3548
+ this._interactionContext = null;
3549
+ return context;
3550
+ }
3551
+ /**
3108
3552
  * @return {?}
3109
3553
  */
3110
- isLeavingCurrentPlace(nextState) {
3111
- return !nextState.includesPathOf(this.component.placeDefinition);
3554
+ toString() {
3555
+ return `${this.constructor.name}(startingUrl: ${this.startingUrl}, isPopState:${this.isPopState})`;
3112
3556
  }
3113
3557
  }
3114
- NavigationSession.ComponentDeactivationHandler = ComponentDeactivationHandler;
3558
+ NavigationSession.Active = Active;
3115
3559
  if (false) {
3560
+ /** @type {?} */
3561
+ Active.prototype.active;
3116
3562
  /**
3117
3563
  * @type {?}
3118
3564
  * @private
3119
3565
  */
3120
- ComponentDeactivationHandler.prototype.alreadyAccepted;
3121
- /** @type {?} */
3122
- ComponentDeactivationHandler.prototype.component;
3566
+ Active.prototype.componentDeactivationHandlers;
3567
+ /**
3568
+ * @type {?}
3569
+ * @private
3570
+ */
3571
+ Active.prototype._interactionContext;
3123
3572
  /** @type {?} */
3124
- ComponentDeactivationHandler.prototype.appModelInteractionContext;
3573
+ Active.prototype.isPopState;
3125
3574
  /** @type {?} */
3126
- ComponentDeactivationHandler.prototype.primary;
3127
- }
3128
- })(NavigationSession || (NavigationSession = {}));
3129
-
3130
- /**
3131
- * @fileoverview added by tsickle
3132
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3133
- */
3134
- class PlaceHistory {
3135
- constructor() {
3136
- this._history = new Map();
3575
+ Active.prototype.startingUrl;
3137
3576
  }
3138
- // @Trace()
3139
- /**
3140
- * @param {?} state
3141
- * @return {?}
3142
- */
3143
- add(state) {
3144
- /** @type {?} */
3145
- const history = this.getHistory(state.placeDefinition);
3146
- /** @type {?} */
3147
- const previousState = ___default.first(history);
3148
- if (!previousState || state.hasChangedFrom(previousState)) {
3149
- history.unshift(state); // LIFO
3150
- this.setHistory(state.placeDefinition, history.slice(0, 3)); // limit our history to 4 visits
3577
+ class ModalInteractionSession extends NavigationSession {
3578
+ /**
3579
+ * @param {?} context
3580
+ * @param {?} startingUrl
3581
+ */
3582
+ constructor(context, startingUrl) {
3583
+ super(context);
3584
+ this.startingUrl = startingUrl;
3585
+ this.active = false;
3586
+ this.isPopState = false;
3151
3587
  }
3152
- }
3153
- /**
3154
- * @param {?} placeDef
3155
- * @return {?}
3156
- */
3157
- getHistory(placeDef) {
3158
- /** @type {?} */
3159
- let history = this._history.get(placeDef);
3160
- if (!history) {
3161
- history = [];
3162
- this.setHistory(placeDef, history);
3588
+ /**
3589
+ * @param {?} url
3590
+ * @return {?}
3591
+ */
3592
+ static hasInteraction(url) {
3593
+ return url.endsWith('(aup-interaction:modal)');
3163
3594
  }
3164
- return history;
3165
- }
3166
- /**
3167
- * @private
3168
- * @param {?} placeDef
3169
- * @param {?} history
3170
- * @return {?}
3171
- */
3172
- setHistory(placeDef, history) {
3173
- this._history.set(placeDef, history);
3174
- }
3175
- }
3176
- PlaceHistory.decorators = [
3177
- { type: Injectable, args: [{
3178
- providedIn: 'root'
3179
- },] }
3180
- ];
3181
- /** @nocollapse */
3182
- PlaceHistory.ctorParameters = () => [];
3183
- /** @nocollapse */ PlaceHistory.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceHistory_Factory() { return new PlaceHistory(); }, token: PlaceHistory, providedIn: "root" });
3184
- if (false) {
3185
- /**
3186
- * @type {?}
3187
- * @private
3188
- */
3189
- PlaceHistory.prototype._history;
3190
- }
3191
-
3192
- /**
3193
- * @fileoverview added by tsickle
3194
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3195
- */
3196
- /**
3197
- * @param {?} options
3198
- * @return {?}
3199
- */
3200
- function Place(options) {
3201
- return (/**
3202
- * @param {?} target
3203
- * @return {?}
3204
- */
3205
- (target) => {
3206
- if (PlaceComponent.isPlaceComponentConstructor(target)) {
3207
- PlaceComponent.injectDefinition(target, new PlaceDefinition(target, options.path, isNil(options.authenticate) ? false : options.authenticate, options.data, PlaceComponent.getRouteParameters(target), (options.children || []).map((/**
3208
- * @param {?} c
3209
- * @return {?}
3210
- */
3211
- c => PlaceComponent.getDefinition(c)))));
3595
+ /**
3596
+ * @param {?} event
3597
+ * @return {?}
3598
+ */
3599
+ onStart(event) {
3600
+ // VERY VERY IMPORTANT BACK BUTTON NOTE:
3601
+ // When the back button is clicked we'll enter here first, and push the url
3602
+ // back to the browser. Angular seems to ignore it from a routing perspective
3603
+ // and then the InteractionGuard will cancel the navigation. This process seems
3604
+ // to keep the brower history in a sane state.
3605
+ if (this.context.modalInteractionService.isActive()) {
3606
+ if (!ModalInteractionSession.hasInteraction(event.url)) {
3607
+ // this capture the case where
3608
+ this.updateLocation(this.startingUrl);
3609
+ }
3610
+ }
3611
+ return this;
3212
3612
  }
3213
- else {
3214
- lang.illegalState(`${target} must extend PlaceComponent to use the @Place decorator`);
3613
+ /**
3614
+ * @param {?} event
3615
+ * @return {?}
3616
+ */
3617
+ onCancel(event) {
3618
+ // this.updateLocation(this.startingUrl);
3619
+ return this;
3215
3620
  }
3216
- });
3217
- }
3218
- (function (Place) {
3219
- /**
3220
- * @record
3221
- */
3222
- function Options() { }
3223
- Place.Options = Options;
3621
+ /**
3622
+ * @param {?} event
3623
+ * @return {?}
3624
+ */
3625
+ onEnd(event) {
3626
+ if (this.context.modalInteractionService.isActive()) {
3627
+ return this;
3628
+ }
3629
+ else {
3630
+ return new Idle(this.context);
3631
+ }
3632
+ }
3633
+ /**
3634
+ * @param {?} event
3635
+ * @return {?}
3636
+ */
3637
+ onError(event) {
3638
+ return this.illegalTransition(event);
3639
+ }
3640
+ /**
3641
+ * @param {?} component
3642
+ * @param {?} nextState
3643
+ * @return {?}
3644
+ */
3645
+ canDeactivatePlace(component, nextState) {
3646
+ return __awaiter(this, void 0, void 0, function* () {
3647
+ return true;
3648
+ });
3649
+ }
3650
+ }
3651
+ __decorate([
3652
+ Trace(),
3653
+ __metadata("design:type", Function),
3654
+ __metadata("design:paramtypes", [NavigationStart]),
3655
+ __metadata("design:returntype", NavigationSession)
3656
+ ], ModalInteractionSession.prototype, "onStart", null);
3657
+ __decorate([
3658
+ Trace(),
3659
+ __metadata("design:type", Function),
3660
+ __metadata("design:paramtypes", [NavigationCancel]),
3661
+ __metadata("design:returntype", NavigationSession)
3662
+ ], ModalInteractionSession.prototype, "onCancel", null);
3663
+ __decorate([
3664
+ Trace(),
3665
+ __metadata("design:type", Function),
3666
+ __metadata("design:paramtypes", [NavigationEnd]),
3667
+ __metadata("design:returntype", NavigationSession)
3668
+ ], ModalInteractionSession.prototype, "onEnd", null);
3669
+ NavigationSession.ModalInteractionSession = ModalInteractionSession;
3224
3670
  if (false) {
3225
3671
  /** @type {?} */
3226
- Options.prototype.path;
3227
- /** @type {?|undefined} */
3228
- Options.prototype.data;
3229
- /** @type {?|undefined} */
3230
- Options.prototype.authenticate;
3231
- /** @type {?|undefined} */
3232
- Options.prototype.children;
3233
- /** @type {?|undefined} */
3234
- Options.prototype.defaultChild;
3672
+ ModalInteractionSession.prototype.active;
3673
+ /** @type {?} */
3674
+ ModalInteractionSession.prototype.isPopState;
3675
+ /** @type {?} */
3676
+ ModalInteractionSession.prototype.startingUrl;
3235
3677
  }
3236
- })(Place || (Place = {}));
3237
-
3238
- /**
3239
- * @fileoverview added by tsickle
3240
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3241
- */
3242
- // WARNING: interface has both a type and a value, skipping emit
3243
- var Formatter;
3244
- (function (Formatter) {
3245
- class StringType {
3678
+ class CancelledDuringNavigationInteraction extends NavigationSession {
3246
3679
  /**
3247
- * @param {?} value
3680
+ * @param {?} context
3681
+ * @param {?} startingUrl
3682
+ * @param {?} locationChangeTriggerUrl
3683
+ */
3684
+ constructor(context, startingUrl, locationChangeTriggerUrl) {
3685
+ super(context);
3686
+ this.startingUrl = startingUrl;
3687
+ this.locationChangeTriggerUrl = locationChangeTriggerUrl;
3688
+ this.active = false;
3689
+ this.capturedFauxRouterStart = false;
3690
+ // This will trigger a return to the route we originally started with.
3691
+ // this.angularLocation.go(this.startingUrl);
3692
+ }
3693
+ /**
3694
+ * @param {?} component
3695
+ * @param {?} nextState
3248
3696
  * @return {?}
3249
3697
  */
3250
- format(value) {
3251
- return value;
3698
+ canDeactivatePlace(component, nextState) {
3699
+ return __awaiter(this, void 0, void 0, function* () {
3700
+ return false;
3701
+ });
3252
3702
  }
3253
3703
  /**
3254
- * @param {?} value
3704
+ * @param {?} event
3255
3705
  * @return {?}
3256
3706
  */
3257
- parse(value) {
3258
- return value;
3707
+ onCancel(event) {
3708
+ return this.ignore(event);
3259
3709
  }
3260
- }
3261
- class NumberType {
3262
3710
  /**
3263
- * @param {?} value
3711
+ * @param {?} event
3264
3712
  * @return {?}
3265
3713
  */
3266
- format(value) {
3267
- return ___default.isNumber(value) && !___default.isNaN(value) ? `${value}` : null;
3714
+ onEnd(event) {
3715
+ return this.ignore(event);
3268
3716
  }
3269
3717
  /**
3270
- * @param {?} value
3718
+ * @param {?} event
3271
3719
  * @return {?}
3272
3720
  */
3273
- parse(value) {
3274
- /** @type {?} */
3275
- const parsed = Number.parseFloat(value);
3276
- return ___default.isNaN(parsed) ? null : parsed;
3721
+ onError(event) {
3722
+ return this.ignore(event);
3277
3723
  }
3278
- }
3279
- class BooleanType {
3280
3724
  /**
3281
- * @param {?} value
3725
+ * @param {?} event
3282
3726
  * @return {?}
3283
3727
  */
3284
- format(value) {
3285
- return value ? 'true' : 'false';
3728
+ onStart(event) {
3729
+ if (event.url === this.locationChangeTriggerUrl && !this.capturedFauxRouterStart) {
3730
+ this.capturedFauxRouterStart = true;
3731
+ return this.ignore(event, 'url matched back button location change');
3732
+ }
3733
+ else {
3734
+ return this.createActiveSession(event);
3735
+ }
3286
3736
  }
3287
3737
  /**
3288
- * @param {?} value
3738
+ * @param {?} event
3739
+ * @param {?=} reason
3289
3740
  * @return {?}
3290
3741
  */
3291
- parse(value) {
3292
- return value === 'true';
3742
+ ignore(event, reason) {
3743
+ reason = reason ? ` (${reason})` : '';
3744
+ Logger.get(this).info(`ignoring router event${reason}: ${event.constructor.name} -> ${event.url}`);
3745
+ return this;
3746
+ }
3747
+ /**
3748
+ * @return {?}
3749
+ */
3750
+ toString() {
3751
+ return `${this.constructor.name}(startingUrl: ${this.startingUrl}, locationChangeTriggerUrl:${this.locationChangeTriggerUrl})`;
3293
3752
  }
3294
3753
  }
3295
- Formatter.STRING = new StringType();
3296
- Formatter.NUMBER = new NumberType();
3297
- Formatter.BOOLEAN = new BooleanType();
3298
- })(Formatter || (Formatter = {}));
3754
+ NavigationSession.CancelledDuringNavigationInteraction = CancelledDuringNavigationInteraction;
3755
+ if (false) {
3756
+ /** @type {?} */
3757
+ CancelledDuringNavigationInteraction.prototype.active;
3758
+ /** @type {?} */
3759
+ CancelledDuringNavigationInteraction.prototype.isPopState;
3760
+ /**
3761
+ * @type {?}
3762
+ * @private
3763
+ */
3764
+ CancelledDuringNavigationInteraction.prototype.capturedFauxRouterStart;
3765
+ /** @type {?} */
3766
+ CancelledDuringNavigationInteraction.prototype.startingUrl;
3767
+ /** @type {?} */
3768
+ CancelledDuringNavigationInteraction.prototype.locationChangeTriggerUrl;
3769
+ }
3770
+ })(NavigationSession || (NavigationSession = {}));
3299
3771
 
3300
3772
  /**
3301
3773
  * @fileoverview added by tsickle
3302
3774
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3303
3775
  */
3304
- /**
3305
- * @record
3306
- * @template T
3307
- */
3308
- function RouteIdOptions() { }
3309
- if (false) {
3310
- /** @type {?|undefined} */
3311
- RouteIdOptions.prototype.as;
3312
- /** @type {?|undefined} */
3313
- RouteIdOptions.prototype.optional;
3314
- /** @type {?|undefined} */
3315
- RouteIdOptions.prototype.remember;
3316
- /** @type {?|undefined} */
3317
- RouteIdOptions.prototype.defaultValue;
3318
- }
3319
- /**
3320
- * @record
3321
- * @template T
3322
- */
3323
- function RouteParameterOptions() { }
3324
- if (false) {
3325
- /** @type {?|undefined} */
3326
- RouteParameterOptions.prototype.as;
3327
- /** @type {?|undefined} */
3328
- RouteParameterOptions.prototype.optional;
3329
- /** @type {?|undefined} */
3330
- RouteParameterOptions.prototype.remember;
3331
- /** @type {?|undefined} */
3332
- RouteParameterOptions.prototype.defaultValue;
3333
- /** @type {?|undefined} */
3334
- RouteParameterOptions.prototype.storeInUrl;
3335
- }
3336
- /**
3337
- * @record
3338
- * @template T
3339
- */
3340
- function RouteListParameterOptions() { }
3341
- if (false) {
3342
- /** @type {?|undefined} */
3343
- RouteListParameterOptions.prototype.as;
3344
- /** @type {?|undefined} */
3345
- RouteListParameterOptions.prototype.optional;
3346
- /** @type {?|undefined} */
3347
- RouteListParameterOptions.prototype.remember;
3348
- /** @type {?|undefined} */
3349
- RouteListParameterOptions.prototype.defaultValue;
3350
- /** @type {?|undefined} */
3351
- RouteListParameterOptions.prototype.storeInUrl;
3352
- }
3353
- /**
3354
- * @template T
3355
- * @param {?} type
3356
- * @param {?=} options
3357
- * @return {?}
3358
- */
3359
- function RouteId(type, options) {
3360
- return (/**
3361
- * @param {?} prototype
3362
- * @param {?} propertyKey
3776
+ class PlaceHistory {
3777
+ constructor() {
3778
+ this._history = new Map();
3779
+ }
3780
+ // @Trace()
3781
+ /**
3782
+ * @param {?} state
3363
3783
  * @return {?}
3364
3784
  */
3365
- (prototype, propertyKey) => {
3785
+ add(state) {
3366
3786
  /** @type {?} */
3367
- const param = new ParameterDefinition.RouteId(propertyKey.toString(), options, type);
3368
- Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
3369
- UseDelegate()(prototype, propertyKey);
3370
- });
3371
- }
3372
- /**
3373
- * @template T
3374
- * @param {?=} options
3375
- * @return {?}
3376
- */
3377
- function VisitParameter(options) {
3378
- /** @type {?} */
3379
- const opts = Opts.get(options);
3380
- return (/**
3381
- * @param {?} prototype
3382
- * @param {?} propertyKey
3787
+ const history = this.getHistory(state.placeDefinition);
3788
+ /** @type {?} */
3789
+ const previousState = ___default.first(history);
3790
+ if (!previousState || state.hasChangedFrom(previousState)) {
3791
+ history.unshift(state); // LIFO
3792
+ this.setHistory(state.placeDefinition, history.slice(0, 3)); // limit our history to 4 visits
3793
+ }
3794
+ }
3795
+ /**
3796
+ * @param {?} placeDef
3383
3797
  * @return {?}
3384
3798
  */
3385
- (prototype, propertyKey) => {
3799
+ getHistory(placeDef) {
3386
3800
  /** @type {?} */
3387
- const param = new ParameterDefinition.ValueParameter(propertyKey.toString(), options, opts.getOptional("storeInUrl", null));
3388
- Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
3389
- UseDelegate()(prototype, propertyKey);
3390
- });
3391
- }
3392
- /**
3393
- * @template E
3394
- * @param {?=} options
3395
- * @return {?}
3396
- */
3397
- function VisitParameterList(options) {
3398
- /** @type {?} */
3399
- const opts = Opts.get(options);
3400
- return (/**
3401
- * @param {?} prototype
3402
- * @param {?} propertyKey
3801
+ let history = this._history.get(placeDef);
3802
+ if (!history) {
3803
+ history = [];
3804
+ this.setHistory(placeDef, history);
3805
+ }
3806
+ return history;
3807
+ }
3808
+ /**
3809
+ * @private
3810
+ * @param {?} placeDef
3811
+ * @param {?} history
3403
3812
  * @return {?}
3404
3813
  */
3405
- (prototype, propertyKey) => {
3406
- /** @type {?} */
3407
- const param = new ParameterDefinition.ArrayParameter(propertyKey.toString(), options, opts.getOptional("storeInUrl", null));
3408
- Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
3409
- UseDelegate()(prototype, propertyKey);
3410
- });
3814
+ setHistory(placeDef, history) {
3815
+ this._history.set(placeDef, history);
3816
+ }
3817
+ }
3818
+ PlaceHistory.decorators = [
3819
+ { type: Injectable, args: [{
3820
+ providedIn: 'root'
3821
+ },] }
3822
+ ];
3823
+ /** @nocollapse */
3824
+ PlaceHistory.ctorParameters = () => [];
3825
+ /** @nocollapse */ PlaceHistory.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceHistory_Factory() { return new PlaceHistory(); }, token: PlaceHistory, providedIn: "root" });
3826
+ if (false) {
3827
+ /**
3828
+ * @type {?}
3829
+ * @private
3830
+ */
3831
+ PlaceHistory.prototype._history;
3411
3832
  }
3412
3833
 
3413
3834
  /**
3414
3835
  * @fileoverview added by tsickle
3415
3836
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3416
3837
  */
3417
- let NoopGatewayPlace = class NoopGatewayPlace extends PlaceComponent {
3838
+ class UrlSnapshot {
3418
3839
  /**
3419
- * @param {?} router
3840
+ * @param {?} urlTree
3420
3841
  */
3421
- constructor(router) {
3422
- super();
3423
- this.router = router;
3842
+ constructor(urlTree) {
3843
+ this.urlTree = urlTree;
3844
+ // console.log({ segments: this.urlTree.root.children.primary.segments });
3424
3845
  }
3425
3846
  /**
3426
3847
  * @return {?}
3427
3848
  */
3428
- ngOnInit() {
3429
- this.router.navigateByUrl(this.returnUrl.value);
3849
+ cloneUrlSegmentList() {
3850
+ return [...this.urlTree.root.children.primary.segments];
3430
3851
  }
3431
- };
3432
- NoopGatewayPlace.ctorParameters = () => [
3433
- { type: Router }
3434
- ];
3435
- NoopGatewayPlace.decorators = [
3436
- { type: Component, args: [{
3437
- template: ''
3438
- }] }
3439
- ];
3440
- /** @nocollapse */
3441
- NoopGatewayPlace.ctorParameters = () => [
3442
- { type: Router }
3443
- ];
3444
- __decorate([
3445
- VisitParameter({ storeInUrl: Formatter.STRING }),
3446
- __metadata("design:type", MutableValueModel)
3447
- ], NoopGatewayPlace.prototype, "returnUrl", void 0);
3448
- NoopGatewayPlace = __decorate([
3449
- Place({
3450
- path: 'aup-gateway-route',
3451
- authenticate: false
3452
- }),
3453
- __metadata("design:paramtypes", [Router])
3454
- ], NoopGatewayPlace);
3852
+ /**
3853
+ * @param {?} visit
3854
+ * @return {?}
3855
+ */
3856
+ updateVisitSegments(visit) {
3857
+ // Ugly, but it works for now.
3858
+ /** @type {?} */
3859
+ const segments = this.cloneUrlSegmentList();
3860
+ /** @type {?} */
3861
+ const visitSegments = this.convertToUrlSegments(visit);
3862
+ /** @type {?} */
3863
+ const replaceAt = segments.findIndex((/**
3864
+ * @param {?} segment
3865
+ * @return {?}
3866
+ */
3867
+ segment => segment.path === visitSegments[0].path));
3868
+ // do not use the return value, it's the items that were removed!
3869
+ segments.splice(replaceAt, visitSegments.length, ...visitSegments);
3870
+ return segments;
3871
+ }
3872
+ /**
3873
+ * Converts the visit into segments. Please not that these segments are not e
3874
+ * @param {?} visit
3875
+ * @return {?}
3876
+ */
3877
+ convertToUrlSegments(visit) {
3878
+ return visit.placeDefinition.hasRouteId() ?
3879
+ [
3880
+ // NOTE:
3881
+ // It's important to attach the params to the root path and not the id. If we attach them
3882
+ // to an empty id then the angular router won't match the pattern.
3883
+ new UrlSegment(visit.placeDefinition.path, visit.placeDefinition.getFormattedRouteParameters(visit)),
3884
+ new UrlSegment(visit.placeDefinition.getFormattedRouteId(visit), {})
3885
+ ]
3886
+ :
3887
+ [
3888
+ new UrlSegment(visit.placeDefinition.path, visit.placeDefinition.getFormattedRouteParameters(visit))
3889
+ ];
3890
+ }
3891
+ /**
3892
+ * @param {?} visit
3893
+ * @return {?}
3894
+ */
3895
+ createRedirectCommandsFor(visit) {
3896
+ /** @type {?} */
3897
+ const segments = this.updateVisitSegments(visit);
3898
+ /** @type {?} */
3899
+ const commands = [];
3900
+ segments.forEach((/**
3901
+ * @param {?} s
3902
+ * @return {?}
3903
+ */
3904
+ s => {
3905
+ commands.push(s.path);
3906
+ if (s.parameterMap.keys.length > 0) {
3907
+ commands.push(s.parameters);
3908
+ }
3909
+ }));
3910
+ return commands;
3911
+ }
3912
+ /**
3913
+ * @param {?} placeDef
3914
+ * @return {?}
3915
+ */
3916
+ includesPathOf(placeDef) {
3917
+ return this.cloneUrlSegmentList().find((/**
3918
+ * @param {?} s
3919
+ * @return {?}
3920
+ */
3921
+ s => s.path === placeDef.path));
3922
+ }
3923
+ }
3455
3924
  if (false) {
3456
3925
  /** @type {?} */
3457
- NoopGatewayPlace.prototype.returnUrl;
3458
- /** @type {?} */
3459
- NoopGatewayPlace.prototype.router;
3926
+ UrlSnapshot.prototype.urlTree;
3460
3927
  }
3461
3928
 
3462
3929
  /**
3463
3930
  * @fileoverview added by tsickle
3464
3931
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3465
3932
  */
3466
- /** @type {?} */
3467
- const noopPlaceDef = PlaceComponent.getDefinition(NoopGatewayPlace);
3468
3933
  class PlaceRouter extends GarbageCollector {
3469
3934
  /**
3470
3935
  * @param {?} router
3471
3936
  * @param {?} urlSerializer
3472
- * @param {?} interactionContext
3473
3937
  * @param {?} angularLocation
3474
3938
  * @param {?} placeHistory
3939
+ * @param {?} modalInteractionService
3475
3940
  */
3476
- constructor(router, urlSerializer, interactionContext, angularLocation, placeHistory) {
3941
+ constructor(router, urlSerializer, angularLocation, placeHistory, modalInteractionService) {
3477
3942
  super();
3478
3943
  this.router = router;
3479
3944
  this.urlSerializer = urlSerializer;
3480
- this.interactionContext = interactionContext;
3481
3945
  this.angularLocation = angularLocation;
3482
3946
  this.placeHistory = placeHistory;
3947
+ this.modalInteractionService = modalInteractionService;
3483
3948
  this.firstRoute = true;
3484
3949
  this._navigationSessionModel = new MutableValueModel();
3485
3950
  this._activeVisits = new MutableListModel();
3486
- this.initialRedirectStarted = false;
3487
- this.initialRedirectFinished = false;
3488
3951
  const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
3489
3952
  this.activeVisitIndex = chain(this._activeVisits).indexBy('placeDefinition');
3490
- this.navigationSessionFactory = new NavigationSession.Factory(interactionContext);
3491
- angularLocation.onUrlChange((/**
3492
- * @param {?} url
3953
+ this.navigationSessionActive = chain(this.navigationSessionModel).pluck('active');
3954
+ this._navigationSessionContext = new NavigationSession.Context(this.router, this.modalInteractionService, this.angularLocation, (/**
3955
+ * @param {?} session
3493
3956
  * @return {?}
3494
3957
  */
3495
- url => {
3496
- console.log(`location.onUrlChange -> ${url}`);
3958
+ session => {
3959
+ this.processNavigationSuccess(session);
3497
3960
  }));
3961
+ this._navigationSessionModel.value = new NavigationSession.Idle(this._navigationSessionContext);
3498
3962
  // TODO: make setup the callbacks in during module initiation to make this testable.
3499
3963
  this.router.events.subscribe((/**
3500
3964
  * @param {?} event
@@ -3505,28 +3969,75 @@ class PlaceRouter extends GarbageCollector {
3505
3969
  // ======================
3506
3970
  // NavigationStart -> .... -> NavigationCancel --> redirect, go around again in the same session
3507
3971
  // NavigationStart -> .... -> NavigationEnd --> navigation complete, end session.
3508
- // NavigationStart -> .... -> NavigationError --> navigation canceled, end session.
3972
+ // NavigationStart -> .... -> NavigationError --> navigation aborted, end session.
3509
3973
  // =======================
3510
3974
  if (event instanceof NavigationStart) {
3511
- this.onAngularRouterStarted(event);
3975
+ this.runStateTransition((/**
3976
+ * @param {?} session
3977
+ * @return {?}
3978
+ */
3979
+ session => session.onStart(event)));
3512
3980
  }
3513
3981
  if (event instanceof NavigationEnd) {
3514
- this.onAngularRouterFinished(false);
3982
+ this.runStateTransition((/**
3983
+ * @param {?} session
3984
+ * @return {?}
3985
+ */
3986
+ session => session.onEnd(event)));
3515
3987
  }
3516
3988
  if (event instanceof NavigationError) {
3517
- this.onAngularRouterFinished(true);
3989
+ this.runStateTransition((/**
3990
+ * @param {?} session
3991
+ * @return {?}
3992
+ */
3993
+ session => session.onError(event)));
3994
+ }
3995
+ if (event instanceof NavigationCancel) {
3996
+ this.runStateTransition((/**
3997
+ * @param {?} session
3998
+ * @return {?}
3999
+ */
4000
+ session => session.onCancel(event)));
3518
4001
  }
3519
4002
  }));
3520
- this.navigationSessionActive = chain(this.navigationSessionModel).isNotNil();
3521
- this.navigationSessionActive.subscribe((/**
3522
- * @param {?} active
4003
+ // Push dialog state to the url so we can capture the back button.
4004
+ this.modalInteractionService.addActivityListener(new PlaceRouter.InteractionRouteMediator(this.navigationSessionActive, this.router));
4005
+ // The angular router doesn't always fire router events when the back button is pushed while a navigation
4006
+ // session is in progress. Sometimes we only know about it from the url change.
4007
+ angularLocation.onUrlChange((/**
4008
+ * @param {?} url
3523
4009
  * @return {?}
3524
4010
  */
3525
- active => {
3526
- console.log('navigationSessionActive', active);
4011
+ url => {
4012
+ console.log(`#### url changed -> ${url}`);
4013
+ /** @type {?} */
4014
+ const interactionContext = this.navigationSessionActive.value && this.navigationSession.interactionContext;
4015
+ if (interactionContext && interactionContext.isActive()) {
4016
+ Logger.get(this).info(`back button pressed during navigation session interaction`);
4017
+ this.runStateTransition((/**
4018
+ * @param {?} navigationSession
4019
+ * @return {?}
4020
+ */
4021
+ navigationSession => navigationSession.onBackClickedDuringNavigationInteraction(url)));
4022
+ }
3527
4023
  }));
3528
- // const txo = new TransactionObserver().onEvent(e => console.log(e.toString()));
3529
- // txo.observe('this.navigationSessionModel', this.navigationSessionModel);
4024
+ }
4025
+ /**
4026
+ * @private
4027
+ * @param {?} session
4028
+ * @return {?}
4029
+ */
4030
+ processNavigationSuccess(session) {
4031
+ /** @type {?} */
4032
+ const visits = session.getVisits();
4033
+ visits.forEach((/**
4034
+ * @param {?} v
4035
+ * @return {?}
4036
+ */
4037
+ v => this.placeHistory.add(v)));
4038
+ // Update visits before we end the navigation session. This allows the placeOutets to
4039
+ // ignore visit changes that occur while the navigation is in progress
4040
+ this._activeVisits.value = visits;
3530
4041
  }
3531
4042
  /**
3532
4043
  * @return {?}
@@ -3570,14 +4081,6 @@ class PlaceRouter extends GarbageCollector {
3570
4081
  })));
3571
4082
  });
3572
4083
  }
3573
- /**
3574
- * @param {?} visit
3575
- * @param {?=} navigationExtras
3576
- * @return {?}
3577
- */
3578
- createRedirectFor(visit, navigationExtras) {
3579
- return this.router.createUrlTree(this.createRouteParameters(visit), navigationExtras);
3580
- }
3581
4084
  // @Trace()
3582
4085
  /**
3583
4086
  * @param {?} activatedRoute
@@ -3599,15 +4102,6 @@ class PlaceRouter extends GarbageCollector {
3599
4102
  router => {
3600
4103
  /** @type {?} */
3601
4104
  const commands = this.parseUrl(this.router.routerState.snapshot).createRedirectCommandsFor(next);
3602
- // // we have to to use the definition for route id as our redirection always includes
3603
- // // the id in the url segements (but leaves it blank when there's no id). I.e. in the
3604
- // // no id case we're doing the following redirect [<placePath>, ""] -> ["..", <id>]
3605
- // const relativePath = !!previous.placeDefinition.hasRouteId() ? '..' : '.';
3606
- // const commands = [
3607
- // relativePath,
3608
- // ...this.createRouteParameters(next),
3609
- // ...this.extractChildPath(activatedRoute.snapshot)
3610
- // ];
3611
4105
  console.log('### Push Changes to route Redirect', { commands });
3612
4106
  return router.navigate(commands);
3613
4107
  }));
@@ -3616,85 +4110,112 @@ class PlaceRouter extends GarbageCollector {
3616
4110
  }
3617
4111
  /**
3618
4112
  * @param {?} visit
3619
- * @param {?} customNavigation
4113
+ * @param {?} runNavigationCommands
3620
4114
  * @return {?}
3621
4115
  */
3622
- doNavigation(visit, customNavigation) {
4116
+ doNavigation(visit, runNavigationCommands) {
3623
4117
  return __awaiter(this, void 0, void 0, function* () {
3624
- this._navigationSessionModel.value = this.navigationSessionFactory.createInternal(visit);
4118
+ if (this.navigationSessionActive.value) {
4119
+ lang.illegalState('Navigation already in progress');
4120
+ }
4121
+ this.runStateTransition((/**
4122
+ * @param {?} current
4123
+ * @return {?}
4124
+ */
4125
+ current => {
4126
+ /** @type {?} */
4127
+ const session = new NavigationSession.Active(this._navigationSessionContext, false, this.router.routerState.snapshot.url);
4128
+ session.storeVisit(visit);
4129
+ return session;
4130
+ }));
3625
4131
  try {
3626
- yield customNavigation(this.router);
4132
+ yield runNavigationCommands(this.router);
3627
4133
  }
3628
4134
  finally {
3629
4135
  // Router has finished (since there was no router change required) so we
3630
4136
  // need to end the navigation session.
3631
- if (this.navigationSession && !this.router.getCurrentNavigation()) {
3632
- this.onAngularRouterFinished(false);
4137
+ if (this.navigationSession.active && !this.router.getCurrentNavigation()) {
4138
+ this.runStateTransition((/**
4139
+ * @param {?} session
4140
+ * @return {?}
4141
+ */
4142
+ session => session.onEnd(new NavigationEnd(-1, '', ''))));
3633
4143
  }
3634
4144
  }
3635
4145
  });
3636
4146
  }
3637
4147
  /**
3638
- * @private
3639
- * @param {?} visit
4148
+ * @protected
4149
+ * @param {?} transition
3640
4150
  * @return {?}
3641
4151
  */
3642
- createRouteParameters(visit) {
4152
+ runStateTransition(transition) {
3643
4153
  /** @type {?} */
3644
- const def = visit.placeDefinition;
3645
- return visit.hasRouteId() ?
3646
- [def.getFormattedRouteId(visit), def.getFormattedRouteParameters(visit)] :
3647
- [def.getFormattedRouteParameters(visit)];
3648
- }
3649
- // @Trace()
3650
- /**
3651
- * @private
3652
- * @param {?} event
3653
- * @return {?}
3654
- */
3655
- onAngularRouterStarted(event) {
3656
- if (!this.navigationSession) { // We been activated by an external route rather than placeRouter.go(visit)
3657
- console.log('navigation started', { firstTime: this.firstRoute });
3658
- /** @type {?} */
3659
- const session = this.navigationSessionFactory.createExternal(this.firstRoute);
3660
- if (event.navigationTrigger === 'popstate') {
3661
- session.setPopstateReturnUrl(this.router.routerState.snapshot.url);
3662
- }
3663
- this._navigationSessionModel.value = session;
4154
+ const previous = this._navigationSessionModel.value;
4155
+ /** @type {?} */
4156
+ const next = transition(this.navigationSession);
4157
+ this._navigationSessionModel.value = next;
4158
+ if (next !== previous) {
4159
+ previous.dispose();
4160
+ Logger.get(this).info(`Router State Transition: ${previous.toString()} -> ${next.toString()}`);
3664
4161
  }
3665
- this.firstRoute = false;
3666
4162
  }
3667
- // @Trace()
3668
4163
  /**
3669
4164
  * @private
3670
- * @param {?} cancelled
4165
+ * @param {?} visit
3671
4166
  * @return {?}
3672
4167
  */
3673
- onAngularRouterFinished(cancelled) {
4168
+ createRouteParameters(visit) {
3674
4169
  /** @type {?} */
3675
- const session = this._navigationSessionModel.value;
3676
- if (!cancelled) {
3677
- // Update visits before we end the navigation session. This allows the placeOutets to
3678
- // ignore visit changes that occur while the navigation is in progress
3679
- /** @type {?} */
3680
- const visits = session.getVisits();
3681
- visits.forEach((/**
3682
- * @param {?} v
3683
- * @return {?}
3684
- */
3685
- v => this.placeHistory.add(v)));
3686
- this._activeVisits.value = visits;
3687
- }
3688
- else {
3689
- // Angular doesn't preserve the url when a guard cancels the back button.
3690
- // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
3691
- if (session.isPopState) {
3692
- console.log('cancelled during popstate');
3693
- this.angularLocation.go(session.popStateReturnUrl);
3694
- }
3695
- }
3696
- this._navigationSessionModel.value = null;
4170
+ const def = visit.placeDefinition;
4171
+ return visit.hasRouteId() ?
4172
+ [def.getFormattedRouteId(visit), def.getFormattedRouteParameters(visit)] :
4173
+ [def.getFormattedRouteParameters(visit)];
3697
4174
  }
4175
+ // private onAngularRouterStarted(event: NavigationStart) {
4176
+ // if (!this.navigationSession) {
4177
+ // // We been activated by an external route rather than placeRouter.go(visit)
4178
+ // this._navigationSessionModel.value = this.createExternalNavigationSession(event);
4179
+ // }
4180
+ // this.firstRoute = false;
4181
+ // }
4182
+ //
4183
+ // private createExternalNavigationSession(event: NavigationStart) {
4184
+ // return new NavigationSession.Active(
4185
+ // this.modalInteractionService,
4186
+ // this.angularLocation,
4187
+ // // event.url,
4188
+ // event.navigationTrigger === 'popstate'
4189
+ // );
4190
+ // }
4191
+ // private onAngularRouterFinished(cancelled: boolean) {
4192
+ // const session = this._navigationSessionModel.value;
4193
+ // if (session.backClickedDuringCanDeactivateInteraction) {
4194
+ // // we swallow this finished event but keep the session alive as we're going to
4195
+ // // get another route started event, which will trigger anohter canDeactivate dialog
4196
+ // // if we start a new session.
4197
+ // // session.resetInteractionSession()
4198
+ // } else {
4199
+ // if (!cancelled) {
4200
+ // const visits = session.getVisits();
4201
+ // visits.forEach(v => this.placeHistory.add(v));
4202
+ // // Update visits before we end the navigation session. This allows the placeOutets to
4203
+ // // ignore visit changes that occur while the navigation is in progress
4204
+ // this._activeVisits.value = visits;
4205
+ // } else {
4206
+ // // TODO: move this to the navigation session
4207
+ // // Angular doesn't preserve the url when a guard cancels the back button.
4208
+ // // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
4209
+ // // session.rememberPopStateReturnUrl(this.router.routerState.snapshot.url);
4210
+ // if (session.isPopState) {
4211
+ // console.log('cancelled during popstate');
4212
+ // // this.angularLocation.go(session.previousUrl);
4213
+ // }
4214
+ // }
4215
+ // session.dispose();
4216
+ // this._navigationSessionModel.value = null;
4217
+ // }
4218
+ // }
3698
4219
  /**
3699
4220
  * @param {?} activatedRoute
3700
4221
  * @return {?}
@@ -3711,35 +4232,7 @@ class PlaceRouter extends GarbageCollector {
3711
4232
  * @return {?}
3712
4233
  */
3713
4234
  parseUrl(snapshot) {
3714
- return new PlaceRouter.UrlHelper(this.urlSerializer.parse(snapshot.url));
3715
- }
3716
- // TODO: this all only sort of works. Opening dialogs and clicking back multiple times breaks things.
3717
- // TODO: next stage is to investigate tracking dialog state in a different placeoutlet and keeping those
3718
- // TODO: urls out of the history.
3719
- /**
3720
- * @param {?} activatedRoute
3721
- * @param {?} state
3722
- * @return {?}
3723
- */
3724
- performInitialNavigationIntercept(activatedRoute, state) {
3725
- assert.isTruthy(this.isInitialNavigation());
3726
- Logger.get(this).info(`Redirecting to: ${noopPlaceDef.path}`, { returnUrl: state.url });
3727
- if (!this.initialRedirectFinished) {
3728
- this.initialRedirectFinished = true;
3729
- return this.router.createUrlTree([noopPlaceDef.path, {
3730
- returnUrl: state.url
3731
- }], {
3732
- replaceUrl: true,
3733
- // make sure we update our history
3734
- skipLocationChange: false
3735
- });
3736
- }
3737
- }
3738
- /**
3739
- * @return {?}
3740
- */
3741
- isInitialNavigation() {
3742
- return this.navigationSession.firstNavigation && !this.initialRedirectFinished;
4235
+ return new UrlSnapshot(this.urlSerializer.parse(snapshot.url));
3743
4236
  }
3744
4237
  }
3745
4238
  PlaceRouter.decorators = [
@@ -3751,17 +4244,11 @@ PlaceRouter.decorators = [
3751
4244
  PlaceRouter.ctorParameters = () => [
3752
4245
  { type: Router },
3753
4246
  { type: UrlSerializer },
3754
- { type: InteractionContext },
3755
4247
  { type: Location },
3756
- { type: PlaceHistory }
4248
+ { type: PlaceHistory },
4249
+ { type: ModalInteractionService }
3757
4250
  ];
3758
- /** @nocollapse */ PlaceRouter.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(ɵɵinject(Router), ɵɵinject(UrlSerializer), ɵɵinject(InteractionContext), ɵɵinject(Location), ɵɵinject(PlaceHistory)); }, token: PlaceRouter, providedIn: "root" });
3759
- __decorate([
3760
- Trace(),
3761
- __metadata("design:type", Function),
3762
- __metadata("design:paramtypes", [Visit, Object]),
3763
- __metadata("design:returntype", Promise)
3764
- ], PlaceRouter.prototype, "navigate", null);
4251
+ /** @nocollapse */ PlaceRouter.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(ɵɵinject(Router), ɵɵinject(UrlSerializer), ɵɵinject(Location), ɵɵinject(PlaceHistory), ɵɵinject(ModalInteractionService)); }, token: PlaceRouter, providedIn: "root" });
3765
4252
  if (false) {
3766
4253
  /**
3767
4254
  * @type {?}
@@ -3786,137 +4273,88 @@ if (false) {
3786
4273
  * @type {?}
3787
4274
  * @private
3788
4275
  */
3789
- PlaceRouter.prototype.navigationSessionFactory;
4276
+ PlaceRouter.prototype._navigationSessionContext;
3790
4277
  /**
3791
4278
  * @type {?}
3792
4279
  * @private
3793
4280
  */
3794
- PlaceRouter.prototype.initialRedirectStarted;
4281
+ PlaceRouter.prototype.router;
3795
4282
  /**
3796
4283
  * @type {?}
3797
4284
  * @private
3798
4285
  */
3799
- PlaceRouter.prototype.initialRedirectFinished;
4286
+ PlaceRouter.prototype.urlSerializer;
3800
4287
  /**
3801
4288
  * @type {?}
3802
4289
  * @private
3803
4290
  */
3804
- PlaceRouter.prototype.router;
4291
+ PlaceRouter.prototype.angularLocation;
3805
4292
  /**
3806
4293
  * @type {?}
3807
4294
  * @private
3808
4295
  */
3809
- PlaceRouter.prototype.urlSerializer;
4296
+ PlaceRouter.prototype.placeHistory;
3810
4297
  /**
3811
4298
  * @type {?}
3812
4299
  * @private
3813
4300
  */
3814
- PlaceRouter.prototype.interactionContext;
3815
- /** @type {?} */
3816
- PlaceRouter.prototype.angularLocation;
3817
- /** @type {?} */
3818
- PlaceRouter.prototype.placeHistory;
4301
+ PlaceRouter.prototype.modalInteractionService;
3819
4302
  }
3820
4303
  (function (PlaceRouter) {
3821
- class UrlHelper {
3822
- /**
3823
- * @param {?} urlTree
3824
- */
3825
- constructor(urlTree) {
3826
- this.urlTree = urlTree;
3827
- console.log({ segments: this.urlTree.root.children.primary.segments });
3828
- }
4304
+ PlaceRouter.INTERACTION_ROUTER_OUTLET = 'aup-interaction';
4305
+ class InteractionRouteMediator {
3829
4306
  /**
3830
- * @return {?}
3831
- */
3832
- cloneUrlSegmentList() {
3833
- return [...this.urlTree.root.children.primary.segments];
3834
- }
3835
- /**
3836
- * @param {?} visit
3837
- * @return {?}
4307
+ * @param {?} navigationSessionModelActive
4308
+ * @param {?} router
3838
4309
  */
3839
- updateVisitSegments(visit) {
3840
- // Ugly, but it works for now.
3841
- /** @type {?} */
3842
- const segments = this.cloneUrlSegmentList();
3843
- /** @type {?} */
3844
- const visitSegments = this.convertToUrlSegments(visit);
3845
- /** @type {?} */
3846
- const replaceAt = segments.findIndex((/**
3847
- * @param {?} segment
3848
- * @return {?}
3849
- */
3850
- segment => segment.path === visitSegments[0].path));
3851
- // do not use the return value, it's the items that were removed!
3852
- segments.splice(replaceAt, visitSegments.length, ...visitSegments);
3853
- return segments;
4310
+ constructor(navigationSessionModelActive, router) {
4311
+ this.navigationSessionModelActive = navigationSessionModelActive;
4312
+ this.router = router;
3854
4313
  }
3855
4314
  /**
3856
- * Converts the visit into segments. Please not that these segments are not e
3857
- * @param {?} visit
3858
4315
  * @return {?}
3859
4316
  */
3860
- convertToUrlSegments(visit) {
3861
- return visit.placeDefinition.hasRouteId() ?
3862
- [
3863
- // NOTE:
3864
- // It's important to attach the params to the root path and not the id. If we attach them
3865
- // to an empty id then the angular router won't match the pattern.
3866
- new UrlSegment(visit.placeDefinition.path, visit.placeDefinition.getFormattedRouteParameters(visit)),
3867
- new UrlSegment(visit.placeDefinition.getFormattedRouteId(visit), {})
3868
- ]
3869
- :
3870
- [
3871
- new UrlSegment(visit.placeDefinition.path, visit.placeDefinition.getFormattedRouteParameters(visit))
3872
- ];
4317
+ get isNavigating() {
4318
+ return this.navigationSessionModelActive.value;
3873
4319
  }
4320
+ // If we're not in a navigation we push
4321
+ // @Trace()
3874
4322
  /**
3875
- * @param {?} visit
3876
4323
  * @return {?}
3877
4324
  */
3878
- createRedirectCommandsFor(visit) {
3879
- /** @type {?} */
3880
- const segments = this.updateVisitSegments(visit);
3881
- /** @type {?} */
3882
- const commands = [];
3883
- segments.forEach((/**
3884
- * @param {?} s
3885
- * @return {?}
3886
- */
3887
- s => {
3888
- commands.push(s.path);
3889
- if (s.parameterMap.keys.length > 0) {
3890
- commands.push(s.parameters);
3891
- }
3892
- }));
3893
- return commands;
4325
+ onActivityStarted() {
4326
+ if (!this.isNavigating) {
4327
+ this.router.navigate(['.', {
4328
+ outlets: {
4329
+ [PlaceRouter.INTERACTION_ROUTER_OUTLET]: ['modal'] // "open" must be a valid route for this outlet.
4330
+ }
4331
+ }], {
4332
+ replaceUrl: false,
4333
+ });
4334
+ }
3894
4335
  }
4336
+ // @Trace()
3895
4337
  /**
3896
- * @param {?} placeDef
3897
4338
  * @return {?}
3898
4339
  */
3899
- includesPathOf(placeDef) {
3900
- return this.cloneUrlSegmentList().find((/**
3901
- * @param {?} s
3902
- * @return {?}
3903
- */
3904
- s => s.path === placeDef.path));
4340
+ onActivityFinished() {
4341
+ if (!this.isNavigating) {
4342
+ this.router.navigate(['.', {
4343
+ outlets: {
4344
+ [PlaceRouter.INTERACTION_ROUTER_OUTLET]: null
4345
+ }
4346
+ }], {
4347
+ replaceUrl: true // remove the interaction from the history.
4348
+ });
4349
+ }
3905
4350
  }
3906
4351
  }
3907
- __decorate([
3908
- Trace(),
3909
- __metadata("design:type", Function),
3910
- __metadata("design:paramtypes", [Visit]),
3911
- __metadata("design:returntype", Array)
3912
- ], UrlHelper.prototype, "createRedirectCommandsFor", null);
3913
- PlaceRouter.UrlHelper = UrlHelper;
4352
+ PlaceRouter.InteractionRouteMediator = InteractionRouteMediator;
3914
4353
  if (false) {
3915
- /**
3916
- * @type {?}
3917
- * @private
3918
- */
3919
- UrlHelper.prototype.urlTree;
4354
+ /** @type {?} */
4355
+ InteractionRouteMediator.prototype.navigationSessionModelActive;
4356
+ /** @type {?} */
4357
+ InteractionRouteMediator.prototype.router;
3920
4358
  }
3921
4359
  })(PlaceRouter || (PlaceRouter = {}));
3922
4360
 
@@ -4011,7 +4449,6 @@ class PlaceOutletComponent extends DisposableComponent {
4011
4449
  this.placeConfig = placeConfig;
4012
4450
  this.placeChanged = new EventEmitter();
4013
4451
  this._activePlace = new MutableValueModel();
4014
- this._previousPlace = new MutableValueModel();
4015
4452
  this._activePlaceVisitModel = new DelegatingValueModel();
4016
4453
  this._inOutletActivation = new Guard$1();
4017
4454
  this._inOutletDeactivation = new Guard$1();
@@ -4033,32 +4470,12 @@ class PlaceOutletComponent extends DisposableComponent {
4033
4470
  .pluck('placeDefinition')
4034
4471
  .pluckList('children')
4035
4472
  .pluck('component');
4036
- // TODO: This is a hack to prevent animation during the NoopGatewayPlace
4037
- /** @type {?} */
4038
- const activePlaceType = chain(this._activePlace).map((/**
4039
- * @param {?} p
4040
- * @return {?}
4041
- */
4042
- p => {
4043
- return (/** @type {?} */ (p.constructor));
4044
- }), {
4045
- postponeWhile: chain(this.activePlaceModel).isNil()
4046
- });
4047
4473
  /** @type {?} */
4048
- const previousPlaceType = chain(this._previousPlace).map((/**
4474
+ const activatePlaceType = chain(this.activePlaceModel).map((/**
4049
4475
  * @param {?} p
4050
4476
  * @return {?}
4051
4477
  */
4052
4478
  p => (/** @type {?} */ (p.constructor))));
4053
- this.ready = chain.reduce(activePlaceType, previousPlaceType, (/**
4054
- * @param {?} current
4055
- * @param {?} previous
4056
- * @return {?}
4057
- */
4058
- (current, previous) => {
4059
- return !!current && current !== NoopGatewayPlace && previous !== NoopGatewayPlace;
4060
- }));
4061
- this.enableAnimation = valueOf.all(this.ready, this.animateModel).areTruthy();
4062
4479
  this.placeAnimationOrder = chain(this.customPlaceAnimationOrderModel)
4063
4480
  .otherwise(defaultPlaceAnimationOrder)
4064
4481
  .reduce((/**
@@ -4068,14 +4485,14 @@ class PlaceOutletComponent extends DisposableComponent {
4068
4485
  (placesInOrder) => {
4069
4486
  /** @type {?} */
4070
4487
  let placeIndex = 0;
4071
- if (activePlaceType.value) {
4072
- placeIndex = placesInOrder.indexOf(activePlaceType.value);
4073
- if (isNil(this.initialPlaceIndex && placeIndex >= 0)) {
4488
+ if (activatePlaceType.value) {
4489
+ placeIndex = placesInOrder.indexOf(activatePlaceType.value);
4490
+ if (isNil(this.initialPlaceIndex)) {
4074
4491
  this.initialPlaceIndex = placeIndex;
4075
4492
  }
4076
4493
  }
4077
4494
  return isNil(this.initialPlaceIndex) ? 0 : placeIndex - this.initialPlaceIndex;
4078
- }), { dependsOn: activePlaceType });
4495
+ }), { dependsOn: activatePlaceType });
4079
4496
  // Push incoming changes into the component
4080
4497
  this.routerVisit = chain(this._activePlace).pluck('placeDefinition').findIn(placeRouter.activeVisitIndex);
4081
4498
  // Our router visit will change when our active is nullified during deactivation, which will push a null visit
@@ -4104,8 +4521,6 @@ class PlaceOutletComponent extends DisposableComponent {
4104
4521
  * @return {?}
4105
4522
  */
4106
4523
  place => this.placeChanged.emit(place)));
4107
- // const txo = new TransactionObserver().onEvent(e => console.log(e.toString()));
4108
- // txo.observe('inRouteVisitUpdate', inRouteVisitUpdate);
4109
4524
  }
4110
4525
  /**
4111
4526
  * @return {?}
@@ -4210,7 +4625,7 @@ class PlaceOutletComponent extends DisposableComponent {
4210
4625
  console.error(error);
4211
4626
  }
4212
4627
  }));
4213
- if (!this.enableAnimation.value) {
4628
+ if (!this.animateModel.value) {
4214
4629
  // we're not animating so trigger any post animation callbacks now.
4215
4630
  this.animationDone();
4216
4631
  }
@@ -4224,7 +4639,6 @@ class PlaceOutletComponent extends DisposableComponent {
4224
4639
  * @return {?}
4225
4640
  */
4226
4641
  () => {
4227
- this._previousPlace.value = this._activePlace.value;
4228
4642
  this._activePlace.value = null;
4229
4643
  this._activatedRouteModel.value = null;
4230
4644
  this._placeDefinition.value = null;
@@ -4251,7 +4665,7 @@ class PlaceOutletComponent extends DisposableComponent {
4251
4665
  PlaceOutletComponent.decorators = [
4252
4666
  { type: Component, args: [{
4253
4667
  selector: 'aup-place-outlet',
4254
- template: "<div class=\"router-outlet-container\"\n [@routeAnimations]=\"{value: getAnimationOrder(), params:{duration: animationDuration}}\"\n [@.disabled]=\"!enableAnimation.value\"\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",
4668
+ template: "<div class=\"router-outlet-container\"\n [@routeAnimations]=\"{value: getAnimationOrder(), params:{duration: animationDuration}}\"\n [@.disabled]=\"!animateModel.value\"\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",
4255
4669
  animations: [LEFT_RIGHT_PLACE_ANIMATION],
4256
4670
  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}"]
4257
4671
  }] }
@@ -4265,7 +4679,7 @@ PlaceOutletComponent.ctorParameters = () => [
4265
4679
  ];
4266
4680
  PlaceOutletComponent.propDecorators = {
4267
4681
  animate: [{ type: Input }],
4268
- animateModel: [{ type: Input, args: ['animateModel',] }],
4682
+ animateModel: [{ type: Input }],
4269
4683
  customPlaceAnimationOrderModel: [{ type: Input, args: ['placeAnimationOrderModel',] }],
4270
4684
  customPlaceAnimationOrder: [{ type: Input, args: ['placeAnimationOrder',] }],
4271
4685
  placeChanged: [{ type: Output }],
@@ -4305,11 +4719,6 @@ if (false) {
4305
4719
  * @private
4306
4720
  */
4307
4721
  PlaceOutletComponent.prototype._activePlace;
4308
- /**
4309
- * @type {?}
4310
- * @private
4311
- */
4312
- PlaceOutletComponent.prototype._previousPlace;
4313
4722
  /**
4314
4723
  * @type {?}
4315
4724
  * @private
@@ -4362,10 +4771,6 @@ if (false) {
4362
4771
  * @private
4363
4772
  */
4364
4773
  PlaceOutletComponent.prototype.routerVisit;
4365
- /** @type {?} */
4366
- PlaceOutletComponent.prototype.ready;
4367
- /** @type {?} */
4368
- PlaceOutletComponent.prototype.enableAnimation;
4369
4774
  /**
4370
4775
  * @type {?}
4371
4776
  * @private
@@ -4650,8 +5055,7 @@ PlaceModule.decorators = [
4650
5055
  PlaceOutletComponent,
4651
5056
  TabbedPlaceNavigationComponent,
4652
5057
  ListPlaceNavComponent,
4653
- AbstractPlaceNavigationComponent,
4654
- NoopGatewayPlace
5058
+ AbstractPlaceNavigationComponent
4655
5059
  ],
4656
5060
  entryComponents: [BusyOverlayComponent],
4657
5061
  exports: [
@@ -5031,82 +5435,6 @@ if (false) {
5031
5435
  ActivityOutletContext.prototype.componentReady = function (component) { };
5032
5436
  }
5033
5437
 
5034
- /**
5035
- * @fileoverview added by tsickle
5036
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5037
- */
5038
- class InteractionGuard {
5039
- /**
5040
- * @param {?} router
5041
- * @param {?} injector
5042
- * @param {?} interactionContext
5043
- */
5044
- constructor(router, injector, interactionContext) {
5045
- this.router = router;
5046
- this.injector = injector;
5047
- this.interactionContext = interactionContext;
5048
- }
5049
- /**
5050
- * @param {?} route
5051
- * @param {?} state
5052
- * @return {?}
5053
- */
5054
- canActivate(route, state) {
5055
- return true;
5056
- }
5057
- /**
5058
- * @param {?} component
5059
- * @param {?} currentRoute
5060
- * @param {?} currentState
5061
- * @param {?=} nextState
5062
- * @return {?}
5063
- */
5064
- canDeactivate(component, currentRoute, currentState, nextState) {
5065
- return !this.interactionContext.isActive();
5066
- }
5067
- }
5068
- InteractionGuard.decorators = [
5069
- { type: Injectable, args: [{
5070
- providedIn: 'root'
5071
- },] }
5072
- ];
5073
- /** @nocollapse */
5074
- InteractionGuard.ctorParameters = () => [
5075
- { type: Router },
5076
- { type: Injector },
5077
- { type: InteractionContext }
5078
- ];
5079
- /** @nocollapse */ InteractionGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function InteractionGuard_Factory() { return new InteractionGuard(ɵɵinject(Router), ɵɵinject(INJECTOR), ɵɵinject(InteractionContext)); }, token: InteractionGuard, providedIn: "root" });
5080
- __decorate([
5081
- Trace(),
5082
- __metadata("design:type", Function),
5083
- __metadata("design:paramtypes", [ActivatedRouteSnapshot, RouterStateSnapshot]),
5084
- __metadata("design:returntype", Object)
5085
- ], InteractionGuard.prototype, "canActivate", null);
5086
- __decorate([
5087
- Trace(),
5088
- __metadata("design:type", Function),
5089
- __metadata("design:paramtypes", [NoopComponent, ActivatedRouteSnapshot, RouterStateSnapshot, RouterStateSnapshot]),
5090
- __metadata("design:returntype", Object)
5091
- ], InteractionGuard.prototype, "canDeactivate", null);
5092
- if (false) {
5093
- /**
5094
- * @type {?}
5095
- * @private
5096
- */
5097
- InteractionGuard.prototype.router;
5098
- /**
5099
- * @type {?}
5100
- * @private
5101
- */
5102
- InteractionGuard.prototype.injector;
5103
- /**
5104
- * @type {?}
5105
- * @private
5106
- */
5107
- InteractionGuard.prototype.interactionContext;
5108
- }
5109
-
5110
5438
  /**
5111
5439
  * @fileoverview added by tsickle
5112
5440
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -5130,10 +5458,56 @@ if (false) {
5130
5458
  */
5131
5459
  NavItem.prototype.icon = function () { };
5132
5460
  /**
5133
- * @return {?}
5461
+ * @return {?}
5462
+ */
5463
+ NavItem.prototype.tooltip = function () { };
5464
+ }
5465
+
5466
+ /**
5467
+ * @fileoverview added by tsickle
5468
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5469
+ */
5470
+ /**
5471
+ * @param {?} options
5472
+ * @return {?}
5473
+ */
5474
+ function Place(options) {
5475
+ return (/**
5476
+ * @param {?} target
5477
+ * @return {?}
5478
+ */
5479
+ (target) => {
5480
+ if (PlaceComponent.isPlaceComponentConstructor(target)) {
5481
+ PlaceComponent.injectDefinition(target, new PlaceDefinition(target, options.path, isNil(options.authenticate) ? false : options.authenticate, options.data, PlaceComponent.getRouteParameters(target), (options.children || []).map((/**
5482
+ * @param {?} c
5483
+ * @return {?}
5484
+ */
5485
+ c => PlaceComponent.getDefinition(c)))));
5486
+ }
5487
+ else {
5488
+ lang.illegalState(`${target} must extend PlaceComponent to use the @Place decorator`);
5489
+ }
5490
+ });
5491
+ }
5492
+ (function (Place) {
5493
+ /**
5494
+ * @record
5134
5495
  */
5135
- NavItem.prototype.tooltip = function () { };
5136
- }
5496
+ function Options() { }
5497
+ Place.Options = Options;
5498
+ if (false) {
5499
+ /** @type {?} */
5500
+ Options.prototype.path;
5501
+ /** @type {?|undefined} */
5502
+ Options.prototype.data;
5503
+ /** @type {?|undefined} */
5504
+ Options.prototype.authenticate;
5505
+ /** @type {?|undefined} */
5506
+ Options.prototype.children;
5507
+ /** @type {?|undefined} */
5508
+ Options.prototype.defaultChild;
5509
+ }
5510
+ })(Place || (Place = {}));
5137
5511
 
5138
5512
  /**
5139
5513
  * @fileoverview added by tsickle
@@ -5168,7 +5542,7 @@ class VisitSanitiser {
5168
5542
  const routeId = visit.getRouteId();
5169
5543
  /** @type {?} */
5170
5544
  const sanitisedValue = yield routeIdDef.sanitise(routeId, visit, this.placeHistory, this.injector);
5171
- console.log({ routeId, sanitisedValue });
5545
+ // console.log({routeId, sanitisedValue});
5172
5546
  // ###------- EARLY EXIT --------###
5173
5547
  if (routeIdDef.hasChanged(routeId, sanitisedValue)) {
5174
5548
  // if the route id has changed we redirect immediately as other
@@ -5222,6 +5596,137 @@ if (false) {
5222
5596
  VisitSanitiser.prototype.injector;
5223
5597
  }
5224
5598
 
5599
+ /**
5600
+ * @fileoverview added by tsickle
5601
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5602
+ */
5603
+ /**
5604
+ * This a work around for the fact that an activated route with multiple segments doesn't
5605
+ * include the segment params in the paramMap as well as each segment returns an empty
5606
+ * param map even when `parameter`s has content.
5607
+ */
5608
+ class ConsolidatedParameterMap {
5609
+ /**
5610
+ * @param {?} paramMap
5611
+ * @param {?} urlSegments
5612
+ */
5613
+ constructor(paramMap, urlSegments) {
5614
+ this.paramMaps = [paramMap].concat((urlSegments || []).map((/**
5615
+ * @param {?} s
5616
+ * @return {?}
5617
+ */
5618
+ s => new ParamMapAdapter(s.parameters)))).filter((/**
5619
+ * @param {?} m
5620
+ * @return {?}
5621
+ */
5622
+ m => !!m)); // the activated route param map can be null
5623
+ }
5624
+ /**
5625
+ * @param {?} name
5626
+ * @return {?}
5627
+ */
5628
+ get(name) {
5629
+ /** @type {?} */
5630
+ const paramMap = this.paramMaps.find((/**
5631
+ * @param {?} m
5632
+ * @return {?}
5633
+ */
5634
+ m => m.has(name)));
5635
+ return paramMap.get(name);
5636
+ }
5637
+ /**
5638
+ * @param {?} name
5639
+ * @return {?}
5640
+ */
5641
+ getAll(name) {
5642
+ /** @type {?} */
5643
+ const paramMap = this.paramMaps.find((/**
5644
+ * @param {?} m
5645
+ * @return {?}
5646
+ */
5647
+ m => m.has(name)));
5648
+ return paramMap.getAll(name);
5649
+ }
5650
+ /**
5651
+ * @param {?} name
5652
+ * @return {?}
5653
+ */
5654
+ has(name) {
5655
+ return !!this.paramMaps.find((/**
5656
+ * @param {?} m
5657
+ * @return {?}
5658
+ */
5659
+ m => m.has(name)));
5660
+ }
5661
+ /**
5662
+ * @return {?}
5663
+ */
5664
+ get keys() {
5665
+ return this.paramMaps.reduce((/**
5666
+ * @param {?} result
5667
+ * @param {?} params
5668
+ * @return {?}
5669
+ */
5670
+ (result, params) => result.concat(params.keys)), []);
5671
+ }
5672
+ }
5673
+ __decorate([
5674
+ Memoize(),
5675
+ __metadata("design:type", Array),
5676
+ __metadata("design:paramtypes", [])
5677
+ ], ConsolidatedParameterMap.prototype, "keys", null);
5678
+ if (false) {
5679
+ /**
5680
+ * @type {?}
5681
+ * @private
5682
+ */
5683
+ ConsolidatedParameterMap.prototype.paramMaps;
5684
+ }
5685
+ class ParamMapAdapter {
5686
+ /**
5687
+ * @param {?} params
5688
+ */
5689
+ constructor(params) {
5690
+ this.params = params;
5691
+ }
5692
+ /**
5693
+ * @param {?} name
5694
+ * @return {?}
5695
+ */
5696
+ get(name) {
5697
+ return this.params[name];
5698
+ }
5699
+ /**
5700
+ * @param {?} name
5701
+ * @return {?}
5702
+ */
5703
+ getAll(name) {
5704
+ /** @type {?} */
5705
+ const value = this.get(name);
5706
+ return Array.isArray(value) ? value : [value];
5707
+ }
5708
+ /**
5709
+ * @param {?} name
5710
+ * @return {?}
5711
+ */
5712
+ has(name) {
5713
+ return this.keys.includes(name);
5714
+ }
5715
+ /**
5716
+ * @return {?}
5717
+ */
5718
+ get keys() {
5719
+ return Object.keys(this.params);
5720
+ }
5721
+ }
5722
+ if (false) {
5723
+ /**
5724
+ * @type {?}
5725
+ * @private
5726
+ */
5727
+ ParamMapAdapter.prototype.params;
5728
+ }
5729
+
5225
5730
  /**
5226
5731
  * @fileoverview added by tsickle
5227
5732
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -5229,7 +5734,7 @@ if (false) {
5229
5734
  /**
5230
5735
  * @abstract
5231
5736
  */
5232
- class AbstractEnterPlaceGuard {
5737
+ class AbstractPlaceGuard {
5233
5738
  /**
5234
5739
  * @param {?} router
5235
5740
  * @param {?} urlSerializer
@@ -5252,45 +5757,53 @@ class AbstractEnterPlaceGuard {
5252
5757
  */
5253
5758
  canActivate(activatedRoute, state) {
5254
5759
  return __awaiter(this, void 0, void 0, function* () {
5255
- return this.interceptInitialRouteOtherwise(activatedRoute, state, (/**
5760
+ return this.authorisePlaceThen(activatedRoute, state, (/**
5761
+ * @param {?} placeDefinition
5256
5762
  * @return {?}
5257
5763
  */
5258
- () => {
5259
- return this.authorisePlaceThen(activatedRoute, state, (/**
5260
- * @param {?} placeDefinition
5261
- * @return {?}
5262
- */
5263
- (placeDefinition) => __awaiter(this, void 0, void 0, function* () {
5264
- // Parse our route params.
5265
- /** @type {?} */
5266
- const params = new AbstractEnterPlaceGuard.ConsolidatedParameterMap(activatedRoute.paramMap, activatedRoute.url);
5267
- /** @type {?} */
5268
- const parsedParams = placeDefinition.parseRouteParams(params);
5269
- /** @type {?} */
5270
- const initialVisit = this.placeRouter.navigationSession.getVisitFor(placeDefinition) || new Visit(placeDefinition, parsedParams);
5271
- /** @type {?} */
5272
- const sanitiser = new VisitSanitiser(activatedRoute, this.router, this.placeHistory, this.injector);
5764
+ (placeDefinition) => __awaiter(this, void 0, void 0, function* () {
5765
+ // Parse our route params.
5766
+ /** @type {?} */
5767
+ const params = new ConsolidatedParameterMap(activatedRoute.paramMap, activatedRoute.url);
5768
+ /** @type {?} */
5769
+ const parsedParams = placeDefinition.parseRouteParams(params);
5770
+ /** @type {?} */
5771
+ const initialVisit = this.placeRouter.navigationSession.getVisitFor(placeDefinition) || new Visit(placeDefinition, parsedParams);
5772
+ /** @type {?} */
5773
+ const sanitiser = new VisitSanitiser(activatedRoute, this.router, this.placeHistory, this.injector);
5774
+ /** @type {?} */
5775
+ const sanitisedVisit = yield sanitiser.sanitise(initialVisit.mergeRouteParameters(parsedParams));
5776
+ // Save the visit with any updated parameters. We need to save it so we remember any non route parameters
5777
+ this.placeRouter.navigationSession.storeVisit(sanitisedVisit);
5778
+ if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {
5779
+ // Regenerate the url
5273
5780
  /** @type {?} */
5274
- const sanitisedVisit = yield sanitiser.sanitise(initialVisit.mergeRouteParameters(parsedParams));
5275
- // Save the visit with any updated parameters. We need to save it so we remember any non route parameters
5276
- this.placeRouter.navigationSession.storeVisit(sanitisedVisit);
5277
- if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {
5278
- // Regenerate the url
5279
- /** @type {?} */
5280
- const commands = this.placeRouter.parseUrl(state).createRedirectCommandsFor(sanitisedVisit);
5281
- console.log('##### Place Guard Redirect', commands);
5282
- return this.router.createUrlTree(commands, {
5283
- replaceUrl: true,
5284
- skipLocationChange: false
5285
- });
5286
- }
5287
- else {
5288
- return true;
5289
- }
5290
- })));
5291
- }));
5781
+ const commands = this.placeRouter.parseUrl(state).createRedirectCommandsFor(sanitisedVisit);
5782
+ console.log('##### Place Guard Redirect', commands);
5783
+ return this.router.createUrlTree(commands, {
5784
+ replaceUrl: true,
5785
+ skipLocationChange: false
5786
+ });
5787
+ }
5788
+ else {
5789
+ return true;
5790
+ }
5791
+ })));
5792
+ });
5793
+ }
5794
+ /**
5795
+ * @param {?} component
5796
+ * @param {?} currentRoute
5797
+ * @param {?} currentState
5798
+ * @param {?=} nextState
5799
+ * @return {?}
5800
+ */
5801
+ canDeactivate(component, currentRoute, currentState, nextState) {
5802
+ return __awaiter(this, void 0, void 0, function* () {
5803
+ return this.placeRouter.navigationSession.canDeactivatePlace(component, this.placeRouter.parseUrl(nextState));
5292
5804
  });
5293
5805
  }
5806
+ // @Trace()
5294
5807
  /**
5295
5808
  * @protected
5296
5809
  * @param {?} activatedRoute
@@ -5309,7 +5822,7 @@ class AbstractEnterPlaceGuard {
5309
5822
  return canActivate(placeDefinition);
5310
5823
  }
5311
5824
  else {
5312
- console.log("not authorised result", authorised);
5825
+ console.log('not authorised result', authorised);
5313
5826
  return authorised;
5314
5827
  }
5315
5828
  }
@@ -5318,29 +5831,6 @@ class AbstractEnterPlaceGuard {
5318
5831
  }
5319
5832
  });
5320
5833
  }
5321
- /**
5322
- * @protected
5323
- * @param {?} activatedRoute
5324
- * @param {?} state
5325
- * @param {?} canActivate
5326
- * @return {?}
5327
- */
5328
- interceptInitialRouteOtherwise(activatedRoute, state, canActivate) {
5329
- return __awaiter(this, void 0, void 0, function* () {
5330
- // TODO: this all only sort of works. Opening dialogs and clicking back multiple times breaks things.
5331
- // TODO: next stage is to investigate tracking dialog state in a different placeoutlet and keeping those
5332
- // TODO: urls out of the history.
5333
- if (this.placeRouter.isInitialNavigation()) {
5334
- // This is the very first entry into our app so we redirect to a dummy place so we can get bump our
5335
- // history by one. This ensures that we can capture back button presses on the initial page without
5336
- // leaving our app.
5337
- return this.placeRouter.performInitialNavigationIntercept(activatedRoute, state);
5338
- }
5339
- else {
5340
- return canActivate();
5341
- }
5342
- });
5343
- }
5344
5834
  /**
5345
5835
  * @param {?} activatedRoute
5346
5836
  * @param {?} state
@@ -5351,194 +5841,85 @@ class AbstractEnterPlaceGuard {
5351
5841
  /** @type {?} */
5352
5842
  const authorised = this.getAuthGuard(this.injector).canActivate(activatedRoute, state);
5353
5843
  return (authorised instanceof Observable) ? authorised.toPromise() : authorised;
5354
- });
5355
- }
5356
- }
5357
- __decorate([
5358
- Trace(),
5359
- __metadata("design:type", Function),
5360
- __metadata("design:paramtypes", [ActivatedRouteSnapshot, RouterStateSnapshot, Function]),
5361
- __metadata("design:returntype", Promise)
5362
- ], AbstractEnterPlaceGuard.prototype, "authorisePlaceThen", null);
5363
- __decorate([
5364
- Trace(),
5365
- __metadata("design:type", Function),
5366
- __metadata("design:paramtypes", [ActivatedRouteSnapshot, RouterStateSnapshot]),
5367
- __metadata("design:returntype", Promise)
5368
- ], AbstractEnterPlaceGuard.prototype, "isAuthorised", null);
5369
- if (false) {
5370
- /**
5371
- * @type {?}
5372
- * @private
5373
- */
5374
- AbstractEnterPlaceGuard.prototype.router;
5375
- /**
5376
- * @type {?}
5377
- * @private
5378
- */
5379
- AbstractEnterPlaceGuard.prototype.urlSerializer;
5380
- /**
5381
- * @type {?}
5382
- * @private
5383
- */
5384
- AbstractEnterPlaceGuard.prototype.placeRouter;
5385
- /**
5386
- * @type {?}
5387
- * @private
5388
- */
5389
- AbstractEnterPlaceGuard.prototype.placeHistory;
5390
- /**
5391
- * @type {?}
5392
- * @private
5393
- */
5394
- AbstractEnterPlaceGuard.prototype.injector;
5395
- /**
5396
- * @abstract
5397
- * @param {?} injector
5398
- * @return {?}
5399
- */
5400
- AbstractEnterPlaceGuard.prototype.getAuthGuard = function (injector) { };
5401
- }
5402
- (function (AbstractEnterPlaceGuard) {
5403
- /**
5404
- * This a work around for the fact that an activated route with multiple segments doesn't
5405
- * include the segment params in the paramMap as well as each segment returns an empty
5406
- * param map even when `parameter`s has content.
5407
- */
5408
- class ConsolidatedParameterMap {
5409
- /**
5410
- * @param {?} paramMap
5411
- * @param {?} urlSegments
5412
- */
5413
- constructor(paramMap, urlSegments) {
5414
- this.paramMaps = [paramMap].concat((urlSegments || []).map((/**
5415
- * @param {?} s
5416
- * @return {?}
5417
- */
5418
- s => new ParamMapAdapter(s.parameters)))).filter((/**
5419
- * @param {?} m
5420
- * @return {?}
5421
- */
5422
- m => !!m)); // the activated route param map can be null
5423
- }
5424
- /**
5425
- * @param {?} name
5426
- * @return {?}
5427
- */
5428
- get(name) {
5429
- /** @type {?} */
5430
- const paramMap = this.paramMaps.find((/**
5431
- * @param {?} m
5432
- * @return {?}
5433
- */
5434
- m => m.has(name)));
5435
- return paramMap.get(name);
5436
- }
5437
- /**
5438
- * @param {?} name
5439
- * @return {?}
5440
- */
5441
- getAll(name) {
5442
- /** @type {?} */
5443
- const paramMap = this.paramMaps.find((/**
5444
- * @param {?} m
5445
- * @return {?}
5446
- */
5447
- m => m.has(name)));
5448
- return paramMap.getAll(name);
5449
- }
5450
- /**
5451
- * @param {?} name
5452
- * @return {?}
5453
- */
5454
- has(name) {
5455
- return !!this.paramMaps.find((/**
5456
- * @param {?} m
5457
- * @return {?}
5458
- */
5459
- m => m.has(name)));
5460
- }
5461
- /**
5462
- * @return {?}
5463
- */
5464
- get keys() {
5465
- return this.paramMaps.reduce((/**
5466
- * @param {?} result
5467
- * @param {?} params
5468
- * @return {?}
5469
- */
5470
- (result, params) => result.concat(params.keys)), []);
5471
- }
5472
- }
5473
- __decorate([
5474
- Memoize(),
5475
- __metadata("design:type", Array),
5476
- __metadata("design:paramtypes", [])
5477
- ], ConsolidatedParameterMap.prototype, "keys", null);
5478
- AbstractEnterPlaceGuard.ConsolidatedParameterMap = ConsolidatedParameterMap;
5479
- if (false) {
5480
- /**
5481
- * @type {?}
5482
- * @private
5483
- */
5484
- ConsolidatedParameterMap.prototype.paramMaps;
5485
- }
5486
- class ParamMapAdapter {
5487
- /**
5488
- * @param {?} params
5489
- */
5490
- constructor(params) {
5491
- this.params = params;
5492
- }
5493
- /**
5494
- * @param {?} name
5495
- * @return {?}
5496
- */
5497
- get(name) {
5498
- return this.params[name];
5499
- }
5500
- /**
5501
- * @param {?} name
5502
- * @return {?}
5503
- */
5504
- getAll(name) {
5505
- /** @type {?} */
5506
- const value = this.get(name);
5507
- return Array.isArray(value) ? value : [value];
5508
- }
5509
- /**
5510
- * @param {?} name
5511
- * @return {?}
5512
- */
5513
- has(name) {
5514
- return this.keys.includes(name);
5515
- }
5516
- /**
5517
- * @return {?}
5518
- */
5519
- get keys() {
5520
- return Object.keys(this.params);
5521
- }
5522
- }
5523
- if (false) {
5524
- /**
5525
- * @type {?}
5526
- * @private
5527
- */
5528
- ParamMapAdapter.prototype.params;
5844
+ });
5529
5845
  }
5530
- })(AbstractEnterPlaceGuard || (AbstractEnterPlaceGuard = {}));
5846
+ }
5847
+ __decorate([
5848
+ Trace(),
5849
+ __metadata("design:type", Function),
5850
+ __metadata("design:paramtypes", [ActivatedRouteSnapshot, RouterStateSnapshot]),
5851
+ __metadata("design:returntype", Promise)
5852
+ ], AbstractPlaceGuard.prototype, "isAuthorised", null);
5853
+ if (false) {
5854
+ /**
5855
+ * @type {?}
5856
+ * @private
5857
+ */
5858
+ AbstractPlaceGuard.prototype.router;
5859
+ /**
5860
+ * @type {?}
5861
+ * @private
5862
+ */
5863
+ AbstractPlaceGuard.prototype.urlSerializer;
5864
+ /**
5865
+ * @type {?}
5866
+ * @private
5867
+ */
5868
+ AbstractPlaceGuard.prototype.placeRouter;
5869
+ /**
5870
+ * @type {?}
5871
+ * @private
5872
+ */
5873
+ AbstractPlaceGuard.prototype.placeHistory;
5874
+ /**
5875
+ * @type {?}
5876
+ * @private
5877
+ */
5878
+ AbstractPlaceGuard.prototype.injector;
5879
+ /**
5880
+ * @abstract
5881
+ * @param {?} injector
5882
+ * @return {?}
5883
+ */
5884
+ AbstractPlaceGuard.prototype.getAuthGuard = function (injector) { };
5885
+ }
5531
5886
 
5532
5887
  /**
5533
5888
  * @fileoverview added by tsickle
5534
5889
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5535
5890
  */
5536
- class LeavePlaceGuard {
5891
+ class InteractionGuard {
5537
5892
  /**
5893
+ * @param {?} router
5894
+ * @param {?} injector
5538
5895
  * @param {?} placeRouter
5896
+ * @param {?} angularLocation
5897
+ * @param {?} modalInteractionService
5539
5898
  */
5540
- constructor(placeRouter) {
5899
+ constructor(router, injector, placeRouter, angularLocation, modalInteractionService) {
5900
+ this.router = router;
5901
+ this.injector = injector;
5541
5902
  this.placeRouter = placeRouter;
5903
+ this.angularLocation = angularLocation;
5904
+ this.modalInteractionService = modalInteractionService;
5905
+ }
5906
+ /**
5907
+ * @param {?} route
5908
+ * @param {?} state
5909
+ * @return {?}
5910
+ */
5911
+ canActivate(route, state) {
5912
+ /** @type {?} */
5913
+ const url = this.router.parseUrl(state.url);
5914
+ if (!this.modalInteractionService.isActive() && url.root.children[PlaceRouter.INTERACTION_ROUTER_OUTLET]) {
5915
+ // This happens if we reload the page or the url was pasted as the route should only be activated
5916
+ // after the interaction context has become active.
5917
+ delete url.root.children[PlaceRouter.INTERACTION_ROUTER_OUTLET];
5918
+ return url;
5919
+ }
5920
+ else {
5921
+ return true;
5922
+ }
5542
5923
  }
5543
5924
  /**
5544
5925
  * @param {?} component
@@ -5549,26 +5930,60 @@ class LeavePlaceGuard {
5549
5930
  */
5550
5931
  canDeactivate(component, currentRoute, currentState, nextState) {
5551
5932
  return __awaiter(this, void 0, void 0, function* () {
5552
- return this.placeRouter.navigationSession.canDeactivate(component, this.placeRouter.parseUrl(nextState));
5933
+ /** @type {?} */
5934
+ const popstateReturnUrl = this.placeRouter.navigationSession.startingUrl;
5935
+ if (this.modalInteractionService.isActive()) {
5936
+ // The activity is still active so the route change was triggered by the back button.
5937
+ /** @type {?} */
5938
+ const activity = yield this.modalInteractionService.getCurrentActivity();
5939
+ activity.cancel();
5940
+ // See ModalInteractionSession#onStart() for the url updating.
5941
+ return false;
5942
+ }
5943
+ return true;
5553
5944
  });
5554
5945
  }
5555
5946
  }
5556
- LeavePlaceGuard.decorators = [
5947
+ InteractionGuard.decorators = [
5557
5948
  { type: Injectable, args: [{
5558
5949
  providedIn: 'root'
5559
5950
  },] }
5560
5951
  ];
5561
5952
  /** @nocollapse */
5562
- LeavePlaceGuard.ctorParameters = () => [
5563
- { type: PlaceRouter }
5953
+ InteractionGuard.ctorParameters = () => [
5954
+ { type: Router },
5955
+ { type: Injector },
5956
+ { type: PlaceRouter },
5957
+ { type: Location },
5958
+ { type: ModalInteractionService }
5564
5959
  ];
5565
- /** @nocollapse */ LeavePlaceGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function LeavePlaceGuard_Factory() { return new LeavePlaceGuard(ɵɵinject(PlaceRouter)); }, token: LeavePlaceGuard, providedIn: "root" });
5960
+ /** @nocollapse */ InteractionGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function InteractionGuard_Factory() { return new InteractionGuard(ɵɵinject(Router), ɵɵinject(INJECTOR), ɵɵinject(PlaceRouter), ɵɵinject(Location), ɵɵinject(ModalInteractionService)); }, token: InteractionGuard, providedIn: "root" });
5566
5961
  if (false) {
5567
5962
  /**
5568
5963
  * @type {?}
5569
5964
  * @private
5570
5965
  */
5571
- LeavePlaceGuard.prototype.placeRouter;
5966
+ InteractionGuard.prototype.router;
5967
+ /**
5968
+ * @type {?}
5969
+ * @private
5970
+ */
5971
+ InteractionGuard.prototype.injector;
5972
+ /**
5973
+ * @type {?}
5974
+ * @private
5975
+ */
5976
+ InteractionGuard.prototype.placeRouter;
5977
+ /**
5978
+ * @type {?}
5979
+ * @private
5980
+ */
5981
+ InteractionGuard.prototype.angularLocation;
5982
+ /**
5983
+ * @type {?}
5984
+ * @private
5985
+ */
5986
+ InteractionGuard.prototype.modalInteractionService;
5572
5987
  }
5573
5988
 
5574
5989
  /**
@@ -5598,6 +6013,68 @@ NoopAuthGuard.decorators = [
5598
6013
  NoopAuthGuard.ctorParameters = () => [];
5599
6014
  /** @nocollapse */ NoopAuthGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function NoopAuthGuard_Factory() { return new NoopAuthGuard(); }, token: NoopAuthGuard, providedIn: "root" });
5600
6015
 
6016
+ /**
6017
+ * @fileoverview added by tsickle
6018
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
6019
+ */
6020
+ // WARNING: interface has both a type and a value, skipping emit
6021
+ var Formatter;
6022
+ (function (Formatter) {
6023
+ class StringType {
6024
+ /**
6025
+ * @param {?} value
6026
+ * @return {?}
6027
+ */
6028
+ format(value) {
6029
+ return value;
6030
+ }
6031
+ /**
6032
+ * @param {?} value
6033
+ * @return {?}
6034
+ */
6035
+ parse(value) {
6036
+ return value;
6037
+ }
6038
+ }
6039
+ class NumberType {
6040
+ /**
6041
+ * @param {?} value
6042
+ * @return {?}
6043
+ */
6044
+ format(value) {
6045
+ return ___default.isNumber(value) && !___default.isNaN(value) ? `${value}` : null;
6046
+ }
6047
+ /**
6048
+ * @param {?} value
6049
+ * @return {?}
6050
+ */
6051
+ parse(value) {
6052
+ /** @type {?} */
6053
+ const parsed = Number.parseFloat(value);
6054
+ return ___default.isNaN(parsed) ? null : parsed;
6055
+ }
6056
+ }
6057
+ class BooleanType {
6058
+ /**
6059
+ * @param {?} value
6060
+ * @return {?}
6061
+ */
6062
+ format(value) {
6063
+ return value ? 'true' : 'false';
6064
+ }
6065
+ /**
6066
+ * @param {?} value
6067
+ * @return {?}
6068
+ */
6069
+ parse(value) {
6070
+ return value === 'true';
6071
+ }
6072
+ }
6073
+ Formatter.STRING = new StringType();
6074
+ Formatter.NUMBER = new NumberType();
6075
+ Formatter.BOOLEAN = new BooleanType();
6076
+ })(Formatter || (Formatter = {}));
6077
+
5601
6078
  /**
5602
6079
  * @fileoverview added by tsickle
5603
6080
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -5611,6 +6088,119 @@ function JsonArray() { }
5611
6088
  */
5612
6089
  function JsonMap() { }
5613
6090
 
6091
+ /**
6092
+ * @fileoverview added by tsickle
6093
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
6094
+ */
6095
+ /**
6096
+ * @record
6097
+ * @template T
6098
+ */
6099
+ function RouteIdOptions() { }
6100
+ if (false) {
6101
+ /** @type {?|undefined} */
6102
+ RouteIdOptions.prototype.as;
6103
+ /** @type {?|undefined} */
6104
+ RouteIdOptions.prototype.optional;
6105
+ /** @type {?|undefined} */
6106
+ RouteIdOptions.prototype.remember;
6107
+ /** @type {?|undefined} */
6108
+ RouteIdOptions.prototype.defaultValue;
6109
+ }
6110
+ /**
6111
+ * @record
6112
+ * @template T
6113
+ */
6114
+ function RouteParameterOptions() { }
6115
+ if (false) {
6116
+ /** @type {?|undefined} */
6117
+ RouteParameterOptions.prototype.as;
6118
+ /** @type {?|undefined} */
6119
+ RouteParameterOptions.prototype.optional;
6120
+ /** @type {?|undefined} */
6121
+ RouteParameterOptions.prototype.remember;
6122
+ /** @type {?|undefined} */
6123
+ RouteParameterOptions.prototype.defaultValue;
6124
+ /** @type {?|undefined} */
6125
+ RouteParameterOptions.prototype.storeInUrl;
6126
+ }
6127
+ /**
6128
+ * @record
6129
+ * @template T
6130
+ */
6131
+ function RouteListParameterOptions() { }
6132
+ if (false) {
6133
+ /** @type {?|undefined} */
6134
+ RouteListParameterOptions.prototype.as;
6135
+ /** @type {?|undefined} */
6136
+ RouteListParameterOptions.prototype.optional;
6137
+ /** @type {?|undefined} */
6138
+ RouteListParameterOptions.prototype.remember;
6139
+ /** @type {?|undefined} */
6140
+ RouteListParameterOptions.prototype.defaultValue;
6141
+ /** @type {?|undefined} */
6142
+ RouteListParameterOptions.prototype.storeInUrl;
6143
+ }
6144
+ /**
6145
+ * @template T
6146
+ * @param {?} type
6147
+ * @param {?=} options
6148
+ * @return {?}
6149
+ */
6150
+ function RouteId(type, options) {
6151
+ return (/**
6152
+ * @param {?} prototype
6153
+ * @param {?} propertyKey
6154
+ * @return {?}
6155
+ */
6156
+ (prototype, propertyKey) => {
6157
+ /** @type {?} */
6158
+ const param = new ParameterDefinition.RouteId(propertyKey.toString(), options, type);
6159
+ Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
6160
+ UseDelegate()(prototype, propertyKey);
6161
+ });
6162
+ }
6163
+ /**
6164
+ * @template T
6165
+ * @param {?=} options
6166
+ * @return {?}
6167
+ */
6168
+ function VisitParameter(options) {
6169
+ /** @type {?} */
6170
+ const opts = Opts.get(options);
6171
+ return (/**
6172
+ * @param {?} prototype
6173
+ * @param {?} propertyKey
6174
+ * @return {?}
6175
+ */
6176
+ (prototype, propertyKey) => {
6177
+ /** @type {?} */
6178
+ const param = new ParameterDefinition.ValueParameter(propertyKey.toString(), options, opts.getOptional("storeInUrl", null));
6179
+ Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
6180
+ UseDelegate()(prototype, propertyKey);
6181
+ });
6182
+ }
6183
+ /**
6184
+ * @template E
6185
+ * @param {?=} options
6186
+ * @return {?}
6187
+ */
6188
+ function VisitParameterList(options) {
6189
+ /** @type {?} */
6190
+ const opts = Opts.get(options);
6191
+ return (/**
6192
+ * @param {?} prototype
6193
+ * @param {?} propertyKey
6194
+ * @return {?}
6195
+ */
6196
+ (prototype, propertyKey) => {
6197
+ /** @type {?} */
6198
+ const param = new ParameterDefinition.ArrayParameter(propertyKey.toString(), options, opts.getOptional("storeInUrl", null));
6199
+ Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
6200
+ UseDelegate()(prototype, propertyKey);
6201
+ });
6202
+ }
6203
+
5614
6204
  /**
5615
6205
  * @fileoverview added by tsickle
5616
6206
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -5670,5 +6260,5 @@ if (false) {
5670
6260
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5671
6261
  */
5672
6262
 
5673
- export { ACTIVITY_DATA, AUP_PLACE_CONFIG, AbstractActivity, AbstractEnterPlaceGuard, AbstractInputComponent, AbstractPlaceNavigationComponent, Activity, ActivityContainerComponent, ActivityOutletComponent, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent, CommandDirective, ComponentsModule, ConfirmThenDialogComponent, ConfirmationDialogComponent, DEFINITION_META_DATA_KEY, DIALOG_INTERACTION_SERVICE_DEFAULTS, DialogInteractionService, Dimension, DirectivesModule, DisposableComponent, EmptyStateComponent, FocusBindingDirective, Formatter, InplaceInteractionContextComponent, InteractionContext, InteractionGuard, InteractionModule, InteractionOutletComponent, LEFT_RIGHT_PLACE_ANIMATION, LeavePlaceGuard, ListPlaceNavComponent, NavigationSession, NoopAuthGuard, NoopComponent, NoopGatewayPlace, NumberInputComponent, ParameterDefinition, PasswordInputComponent, Place, PlaceComponent, PlaceDefinition, PlaceHistory, PlaceModule, PlaceOutletComponent, PlaceRouter, Point, ROUTE_PARAMETER_LIST_KEY, ResizeAwareComponent, RouteId, SelectInputComponent, StringInputComponent, TabbedPlaceNavigationComponent, Visit, VisitParameter, VisitParameterList, VisitSanitiser, leftRightPlaceAnimation, slideDownAndUpAnimation, DirectivesModule as ɵa, CommandDirective as ɵb, PlaceComponent as ɵba, Place as ɵbb, VisitParameter as ɵbc, Formatter as ɵbd, InteractionModule as ɵbe, ActivityContainerComponent as ɵbf, ActivityOutletComponent as ɵbg, ConfirmationDialogComponent as ɵbh, AbstractActivity as ɵbi, ACTIVITY_DATA as ɵbj, Activity as ɵbk, ConfirmThenDialogComponent as ɵbm, AlertDialogComponent as ɵbn, InteractionOutletComponent as ɵbp, InplaceInteractionContextComponent as ɵbq, DIALOG_INTERACTION_SERVICE_DEFAULTS as ɵbr, DialogInteractionService as ɵbs, FocusBindingDirective as ɵc, DisposableComponent as ɵd, ComponentsModule as ɵe, NumberInputComponent as ɵf, AbstractInputComponent as ɵg, StringInputComponent as ɵh, PasswordInputComponent as ɵi, SelectInputComponent as ɵj, NoopComponent as ɵk, PlaceModule as ɵl, EmptyStateComponent as ɵm, BusyOverlayComponent as ɵn, PlaceOutletComponent as ɵo, leftRightPlaceAnimation as ɵp, LEFT_RIGHT_PLACE_ANIMATION as ɵq, AUP_PLACE_CONFIG as ɵr, PlaceRouter as ɵt, InteractionContext as ɵu, PlaceHistory as ɵv, TabbedPlaceNavigationComponent as ɵw, AbstractPlaceNavigationComponent as ɵx, ListPlaceNavComponent as ɵy, NoopGatewayPlace as ɵz };
6263
+ export { ACTIVITY_DATA, AUP_PLACE_CONFIG, AbstractActivity, AbstractInputComponent, AbstractPlaceGuard, AbstractPlaceNavigationComponent, Activity, ActivityContainerComponent, ActivityOutletComponent, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent, CommandDirective, ComponentsModule, ConfirmThenDialogComponent, ConfirmationDialogComponent, ConsolidatedParameterMap, DEFINITION_META_DATA_KEY, DIALOG_INTERACTION_SERVICE_DEFAULTS, DialogInteractionContext, DialogInteractionService, Dimension, DirectivesModule, DisposableComponent, EmptyStateComponent, FocusBindingDirective, Formatter, InplaceInteractionContextComponent, InteractionContext, InteractionContextBase, InteractionGuard, InteractionModule, InteractionOutletComponent, LEFT_RIGHT_PLACE_ANIMATION, ListPlaceNavComponent, ModalInteractionService, NavigationSession, NoopAuthGuard, NoopComponent, NumberInputComponent, ParameterDefinition, PasswordInputComponent, Place, PlaceComponent, PlaceComponentDeactivationHandler, PlaceDefinition, PlaceHistory, PlaceModule, PlaceOutletComponent, PlaceRouter, Point, ROUTE_PARAMETER_LIST_KEY, ResizeAwareComponent, RouteId, SelectInputComponent, StringInputComponent, TabbedPlaceNavigationComponent, UrlSnapshot, Visit, VisitParameter, VisitParameterList, VisitSanitiser, leftRightPlaceAnimation, slideDownAndUpAnimation, DirectivesModule as ɵa, CommandDirective as ɵb, ActivityContainerComponent as ɵba, InteractionContextBase as ɵbb, InteractionContext as ɵbc, ActivityOutletComponent as ɵbd, ConfirmationDialogComponent as ɵbe, AbstractActivity as ɵbf, ACTIVITY_DATA as ɵbg, Activity as ɵbh, ConfirmThenDialogComponent as ɵbj, AlertDialogComponent as ɵbk, InteractionOutletComponent as ɵbm, InplaceInteractionContextComponent as ɵbn, DIALOG_INTERACTION_SERVICE_DEFAULTS as ɵbo, DialogInteractionService as ɵbp, FocusBindingDirective as ɵc, DisposableComponent as ɵd, ComponentsModule as ɵe, NumberInputComponent as ɵf, AbstractInputComponent as ɵg, StringInputComponent as ɵh, PasswordInputComponent as ɵi, SelectInputComponent as ɵj, NoopComponent as ɵk, PlaceModule as ɵl, EmptyStateComponent as ɵm, BusyOverlayComponent as ɵn, PlaceOutletComponent as ɵo, leftRightPlaceAnimation as ɵp, LEFT_RIGHT_PLACE_ANIMATION as ɵq, AUP_PLACE_CONFIG as ɵr, PlaceRouter as ɵt, PlaceHistory as ɵu, ModalInteractionService as ɵv, TabbedPlaceNavigationComponent as ɵw, AbstractPlaceNavigationComponent as ɵx, ListPlaceNavComponent as ɵy, InteractionModule as ɵz };
5674
6264
  //# sourceMappingURL=coolon-angular-ui-powerups.js.map