@coolon/angular-ui-powerups 0.0.89 → 0.0.91
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.
- package/bundles/coolon-angular-ui-powerups.umd.js +641 -488
- package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
- package/bundles/coolon-angular-ui-powerups.umd.min.js +1 -1
- package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
- package/coolon-angular-ui-powerups.d.ts +19 -18
- package/coolon-angular-ui-powerups.metadata.json +1 -1
- package/esm2015/coolon-angular-ui-powerups.js +18 -17
- package/esm2015/lib/directives/command.directive.js +28 -5
- package/esm2015/lib/interaction/components/activity-container/activity-container.component.js +3 -8
- package/esm2015/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.js +4 -9
- package/esm2015/lib/interaction/interaction-context.js +78 -6
- package/esm2015/lib/interaction/services/dialog-interaction.service.js +12 -20
- package/esm2015/lib/place/navigation-session.js +182 -39
- package/esm2015/lib/place/place-component.js +4 -19
- package/esm2015/lib/place/place-definition.js +16 -19
- package/esm2015/lib/place/place-router.js +177 -39
- package/esm2015/lib/place/route/guards/enter-place-guard.service.js +3 -38
- package/esm2015/lib/place/route/guards/leave-place.guard.js +7 -177
- package/esm2015/lib/place/visit.js +4 -11
- package/esm5/coolon-angular-ui-powerups.js +18 -17
- package/esm5/lib/directives/command.directive.js +32 -5
- package/esm5/lib/interaction/components/activity-container/activity-container.component.js +3 -12
- package/esm5/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.js +4 -13
- package/esm5/lib/interaction/interaction-context.js +100 -11
- package/esm5/lib/interaction/services/dialog-interaction.service.js +12 -23
- package/esm5/lib/place/navigation-session.js +225 -54
- package/esm5/lib/place/place-component.js +4 -35
- package/esm5/lib/place/place-definition.js +17 -39
- package/esm5/lib/place/place-router.js +202 -37
- package/esm5/lib/place/route/guards/enter-place-guard.service.js +3 -44
- package/esm5/lib/place/route/guards/leave-place.guard.js +7 -176
- package/esm5/lib/place/visit.js +4 -14
- package/fesm2015/coolon-angular-ui-powerups.js +494 -365
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +592 -439
- package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/directives/command.directive.d.ts +2 -0
- package/lib/interaction/components/activity-container/activity-container.component.d.ts +2 -3
- package/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.d.ts +4 -5
- package/lib/interaction/interaction-context.d.ts +7 -3
- package/lib/interaction/services/dialog-interaction.service.d.ts +4 -6
- package/lib/place/navigation-session.d.ts +26 -9
- package/lib/place/place-component.d.ts +4 -9
- package/lib/place/place-definition.d.ts +0 -4
- package/lib/place/place-router.d.ts +21 -2
- package/lib/place/route/guards/enter-place-guard.service.d.ts +0 -1
- package/lib/place/route/guards/leave-place.guard.d.ts +2 -10
- package/lib/place/visit.d.ts +0 -2
- package/package.json +1 -1
|
@@ -4,10 +4,10 @@ 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 { __extends, __decorate, __metadata,
|
|
8
|
-
import { assert, UnaryCommand, lang, Dsl, GarbageCollector, Logger, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel,
|
|
7
|
+
import { __extends, __decorate, __metadata, __awaiter, __generator, __assign, __spread } from 'tslib';
|
|
8
|
+
import { DelegatingValueModel, assert, UnaryCommand, lang, Dsl, GarbageCollector, Logger, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, DelegatingListModel, Deferred, MutableStream, MutableListModel, MutableValueModel, Binding, Trace, Guard as Guard$1, Command, StoreInValueModel, OptionsHelper, ValueHolder } from '@coolon/pectin';
|
|
9
9
|
import { PortalModule } from '@angular/cdk/portal';
|
|
10
|
-
import { Router, RouterModule,
|
|
10
|
+
import { Router, RouterModule, NavigationStart, NavigationEnd, NavigationError, UrlSerializer, UrlSegment, 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
13
|
import { MatDialogConfig, MAT_DIALOG_DEFAULT_OPTIONS, MatDialog as MatDialog$1 } from '@angular/material/dialog';
|
|
@@ -32,9 +32,28 @@ var CommandDirective = /** @class */ (function (_super) {
|
|
|
32
32
|
function CommandDirective(elementRef) {
|
|
33
33
|
var _this = _super.call(this) || this;
|
|
34
34
|
_this.elementRef = elementRef;
|
|
35
|
+
_this._commandEnabled = new DelegatingValueModel().withDefault(false);
|
|
35
36
|
_this._commandParameterProvided = false;
|
|
36
37
|
return _this;
|
|
37
38
|
}
|
|
39
|
+
Object.defineProperty(CommandDirective.prototype, "pectinCommand", {
|
|
40
|
+
get: /**
|
|
41
|
+
* @return {?}
|
|
42
|
+
*/
|
|
43
|
+
function () {
|
|
44
|
+
return this._command;
|
|
45
|
+
},
|
|
46
|
+
set: /**
|
|
47
|
+
* @param {?} command
|
|
48
|
+
* @return {?}
|
|
49
|
+
*/
|
|
50
|
+
function (command) {
|
|
51
|
+
this._command = command;
|
|
52
|
+
this._commandEnabled.setDelegate(command ? command.enabled : null);
|
|
53
|
+
},
|
|
54
|
+
enumerable: true,
|
|
55
|
+
configurable: true
|
|
56
|
+
});
|
|
38
57
|
Object.defineProperty(CommandDirective.prototype, "commandParameter", {
|
|
39
58
|
get: /**
|
|
40
59
|
* @return {?}
|
|
@@ -83,7 +102,7 @@ var CommandDirective = /** @class */ (function (_super) {
|
|
|
83
102
|
// for some reason mat-buttons kills the disabled host binding. It works on a regular button but for now
|
|
84
103
|
// we need to do this.
|
|
85
104
|
var chain = Dsl.disposeWith(this).chain;
|
|
86
|
-
chain(this.
|
|
105
|
+
chain(this._commandEnabled).subscribe((/**
|
|
87
106
|
* @param {?} enabled
|
|
88
107
|
* @return {?}
|
|
89
108
|
*/
|
|
@@ -152,8 +171,16 @@ var CommandDirective = /** @class */ (function (_super) {
|
|
|
152
171
|
return CommandDirective;
|
|
153
172
|
}(GarbageCollector));
|
|
154
173
|
if (false) {
|
|
155
|
-
/**
|
|
156
|
-
|
|
174
|
+
/**
|
|
175
|
+
* @type {?}
|
|
176
|
+
* @private
|
|
177
|
+
*/
|
|
178
|
+
CommandDirective.prototype._command;
|
|
179
|
+
/**
|
|
180
|
+
* @type {?}
|
|
181
|
+
* @private
|
|
182
|
+
*/
|
|
183
|
+
CommandDirective.prototype._commandEnabled;
|
|
157
184
|
/**
|
|
158
185
|
* @type {?}
|
|
159
186
|
* @private
|
|
@@ -893,24 +920,107 @@ var /**
|
|
|
893
920
|
InteractionContext = /** @class */ (function (_super) {
|
|
894
921
|
__extends(InteractionContext, _super);
|
|
895
922
|
function InteractionContext() {
|
|
896
|
-
|
|
897
|
-
}
|
|
898
|
-
Object.defineProperty(InteractionContext.prototype, "currentActivity", {
|
|
923
|
+
var _this = _super.call(this) || this;
|
|
899
924
|
/**
|
|
900
|
-
* Returns the
|
|
925
|
+
* Returns the current list of activities that are in progress.
|
|
901
926
|
* This model is only updated in the next tick after the view has been updated.
|
|
902
927
|
*/
|
|
928
|
+
_this._activityListDelegate = new DelegatingListModel();
|
|
929
|
+
var _a = Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
|
|
930
|
+
when.listOf(_this.activityList).becomesPopulated((/**
|
|
931
|
+
* @param {?} activities
|
|
932
|
+
* @return {?}
|
|
933
|
+
*/
|
|
934
|
+
function (activities) {
|
|
935
|
+
if (_this.deferredGetCurrentActivity) {
|
|
936
|
+
_this.deferredGetCurrentActivity.resolve(last(activities));
|
|
937
|
+
_this.deferredGetCurrentActivity = null;
|
|
938
|
+
}
|
|
939
|
+
}));
|
|
940
|
+
return _this;
|
|
941
|
+
}
|
|
942
|
+
/**
|
|
943
|
+
* @protected
|
|
944
|
+
* @param {?} activityList
|
|
945
|
+
* @return {?}
|
|
946
|
+
*/
|
|
947
|
+
InteractionContext.prototype.setActivityList = /**
|
|
948
|
+
* @protected
|
|
949
|
+
* @param {?} activityList
|
|
950
|
+
* @return {?}
|
|
951
|
+
*/
|
|
952
|
+
function (activityList) {
|
|
953
|
+
this._activityListDelegate.setDelegate(activityList);
|
|
954
|
+
};
|
|
955
|
+
Object.defineProperty(InteractionContext.prototype, "activityList", {
|
|
903
956
|
get: /**
|
|
904
|
-
* Returns the activity that is currently active.
|
|
905
|
-
* This model is only updated in the next tick after the view has been updated.
|
|
906
957
|
* @return {?}
|
|
907
958
|
*/
|
|
908
959
|
function () {
|
|
909
|
-
return
|
|
960
|
+
return this._activityListDelegate.readonly;
|
|
910
961
|
},
|
|
911
962
|
enumerable: true,
|
|
912
963
|
configurable: true
|
|
913
964
|
});
|
|
965
|
+
/**
|
|
966
|
+
* Returns the activity that is currently active.
|
|
967
|
+
* This model is only updated in the next tick after the view has been updated.
|
|
968
|
+
*/
|
|
969
|
+
/**
|
|
970
|
+
* Returns the activity that is currently active.
|
|
971
|
+
* This model is only updated in the next tick after the view has been updated.
|
|
972
|
+
* @return {?}
|
|
973
|
+
*/
|
|
974
|
+
InteractionContext.prototype.getCurrentActivity = /**
|
|
975
|
+
* Returns the activity that is currently active.
|
|
976
|
+
* This model is only updated in the next tick after the view has been updated.
|
|
977
|
+
* @return {?}
|
|
978
|
+
*/
|
|
979
|
+
function () {
|
|
980
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
981
|
+
return __generator(this, function (_a) {
|
|
982
|
+
if (!this.isActive()) {
|
|
983
|
+
return [2 /*return*/, Promise.reject('no activity in progress')];
|
|
984
|
+
}
|
|
985
|
+
else {
|
|
986
|
+
if (this.deferredGetCurrentActivity) {
|
|
987
|
+
// we're already waiting then just return the same promise
|
|
988
|
+
return [2 /*return*/, this.deferredGetCurrentActivity.promise];
|
|
989
|
+
}
|
|
990
|
+
else {
|
|
991
|
+
if (this.activityList.length < 1) {
|
|
992
|
+
this.deferredGetCurrentActivity = Deferred.defer();
|
|
993
|
+
return [2 /*return*/, this.deferredGetCurrentActivity.promise];
|
|
994
|
+
}
|
|
995
|
+
else {
|
|
996
|
+
return [2 /*return*/, last(this.activityList.value)];
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
return [2 /*return*/];
|
|
1001
|
+
});
|
|
1002
|
+
});
|
|
1003
|
+
};
|
|
1004
|
+
/**
|
|
1005
|
+
* @param {?} confirm
|
|
1006
|
+
* @return {?}
|
|
1007
|
+
*/
|
|
1008
|
+
InteractionContext.prototype.confirm = /**
|
|
1009
|
+
* @param {?} confirm
|
|
1010
|
+
* @return {?}
|
|
1011
|
+
*/
|
|
1012
|
+
function (confirm) {
|
|
1013
|
+
// Important: we have to implement confirmOrReject as the main entry point
|
|
1014
|
+
// as the canDeactivation guards need to be able to cancel an interaction
|
|
1015
|
+
// without caring about returning a value.
|
|
1016
|
+
return this.confirmOrReject(confirm).then((/**
|
|
1017
|
+
* @return {?}
|
|
1018
|
+
*/
|
|
1019
|
+
function () { return true; })).catch((/**
|
|
1020
|
+
* @return {?}
|
|
1021
|
+
*/
|
|
1022
|
+
function () { return false; }));
|
|
1023
|
+
};
|
|
914
1024
|
return InteractionContext;
|
|
915
1025
|
}(GarbageCollector));
|
|
916
1026
|
if (false) {
|
|
@@ -918,8 +1028,14 @@ if (false) {
|
|
|
918
1028
|
* Returns the current list of activities that are in progress.
|
|
919
1029
|
* This model is only updated in the next tick after the view has been updated.
|
|
920
1030
|
* @type {?}
|
|
1031
|
+
* @private
|
|
1032
|
+
*/
|
|
1033
|
+
InteractionContext.prototype._activityListDelegate;
|
|
1034
|
+
/**
|
|
1035
|
+
* @type {?}
|
|
1036
|
+
* @private
|
|
921
1037
|
*/
|
|
922
|
-
InteractionContext.prototype.
|
|
1038
|
+
InteractionContext.prototype.deferredGetCurrentActivity;
|
|
923
1039
|
/**
|
|
924
1040
|
* Returns true if an activity is currently running.
|
|
925
1041
|
* @abstract
|
|
@@ -939,7 +1055,7 @@ if (false) {
|
|
|
939
1055
|
* @param {?} confirm
|
|
940
1056
|
* @return {?}
|
|
941
1057
|
*/
|
|
942
|
-
InteractionContext.prototype.
|
|
1058
|
+
InteractionContext.prototype.confirmOrReject = function (confirm) { };
|
|
943
1059
|
/**
|
|
944
1060
|
* Presents the confirmation to the user and runs the activity only if the user confirms.
|
|
945
1061
|
* @abstract
|
|
@@ -1561,6 +1677,7 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
|
|
|
1561
1677
|
* @return {?}
|
|
1562
1678
|
*/
|
|
1563
1679
|
function () { return _this.onNestedActivityFinished(); }));
|
|
1680
|
+
_this.setActivityList(_this._activityList.readonly);
|
|
1564
1681
|
return _this;
|
|
1565
1682
|
}
|
|
1566
1683
|
Object.defineProperty(ActivityContainerComponent.prototype, "initialActivityOutletContext", {
|
|
@@ -1616,16 +1733,6 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
|
|
|
1616
1733
|
function () {
|
|
1617
1734
|
return !!this._initialActivityOutletContext;
|
|
1618
1735
|
};
|
|
1619
|
-
Object.defineProperty(ActivityContainerComponent.prototype, "activityList", {
|
|
1620
|
-
get: /**
|
|
1621
|
-
* @return {?}
|
|
1622
|
-
*/
|
|
1623
|
-
function () {
|
|
1624
|
-
return this._activityList.readonly;
|
|
1625
|
-
},
|
|
1626
|
-
enumerable: true,
|
|
1627
|
-
configurable: true
|
|
1628
|
-
});
|
|
1629
1736
|
Object.defineProperty(ActivityContainerComponent.prototype, "isFinished", {
|
|
1630
1737
|
get: /**
|
|
1631
1738
|
* @return {?}
|
|
@@ -1727,7 +1834,7 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
|
|
|
1727
1834
|
* @param {?} confirm
|
|
1728
1835
|
* @return {?}
|
|
1729
1836
|
*/
|
|
1730
|
-
ActivityContainerComponent.prototype.
|
|
1837
|
+
ActivityContainerComponent.prototype.confirmOrReject = /**
|
|
1731
1838
|
* @param {?} confirm
|
|
1732
1839
|
* @return {?}
|
|
1733
1840
|
*/
|
|
@@ -1943,21 +2050,12 @@ var InplaceInteractionContextComponent = /** @class */ (function (_super) {
|
|
|
1943
2050
|
/**
|
|
1944
2051
|
* @return {?}
|
|
1945
2052
|
*/
|
|
1946
|
-
InplaceInteractionContextComponent.prototype.
|
|
2053
|
+
InplaceInteractionContextComponent.prototype.ngAfterViewInit = /**
|
|
1947
2054
|
* @return {?}
|
|
1948
2055
|
*/
|
|
1949
2056
|
function () {
|
|
2057
|
+
this.setActivityList(this.interactionContext.activityList);
|
|
1950
2058
|
};
|
|
1951
|
-
Object.defineProperty(InplaceInteractionContextComponent.prototype, "activityList", {
|
|
1952
|
-
get: /**
|
|
1953
|
-
* @return {?}
|
|
1954
|
-
*/
|
|
1955
|
-
function () {
|
|
1956
|
-
return this.interactionContext.activityList;
|
|
1957
|
-
},
|
|
1958
|
-
enumerable: true,
|
|
1959
|
-
configurable: true
|
|
1960
|
-
});
|
|
1961
2059
|
/**
|
|
1962
2060
|
* @return {?}
|
|
1963
2061
|
*/
|
|
@@ -1983,7 +2081,7 @@ var InplaceInteractionContextComponent = /** @class */ (function (_super) {
|
|
|
1983
2081
|
* @param {?} confirm
|
|
1984
2082
|
* @return {?}
|
|
1985
2083
|
*/
|
|
1986
|
-
InplaceInteractionContextComponent.prototype.
|
|
2084
|
+
InplaceInteractionContextComponent.prototype.confirmOrReject = /**
|
|
1987
2085
|
* @param {?} confirm
|
|
1988
2086
|
* @return {?}
|
|
1989
2087
|
*/
|
|
@@ -2177,11 +2275,9 @@ var DialogInteractionService = /** @class */ (function (_super) {
|
|
|
2177
2275
|
_this.router = router;
|
|
2178
2276
|
_this.dialogServiceDefaults = dialogServiceDefaults;
|
|
2179
2277
|
_this.matDialogDefaultConfig = matDialogDefaultConfig;
|
|
2180
|
-
_this._activityList = new DelegatingListModel();
|
|
2181
2278
|
_this.startingGuard = new Guard();
|
|
2279
|
+
_this._inActivityPromise = new MutableValueModel(false);
|
|
2182
2280
|
assert$1.notNil(dialogService);
|
|
2183
|
-
var _a = Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
|
|
2184
|
-
_this.active = chain(_this._activityList).isNotEmpty();
|
|
2185
2281
|
return _this;
|
|
2186
2282
|
}
|
|
2187
2283
|
/**
|
|
@@ -2191,23 +2287,14 @@ var DialogInteractionService = /** @class */ (function (_super) {
|
|
|
2191
2287
|
* @return {?}
|
|
2192
2288
|
*/
|
|
2193
2289
|
function () {
|
|
2194
|
-
return this.
|
|
2290
|
+
return this._inActivityPromise.value;
|
|
2195
2291
|
};
|
|
2196
|
-
|
|
2197
|
-
* @return {?}
|
|
2198
|
-
*/
|
|
2199
|
-
DialogInteractionService.prototype.cancelActivity = /**
|
|
2200
|
-
* @return {?}
|
|
2201
|
-
*/
|
|
2202
|
-
function () {
|
|
2203
|
-
this.currentActivity.cancel(null);
|
|
2204
|
-
};
|
|
2205
|
-
Object.defineProperty(DialogInteractionService.prototype, "activityList", {
|
|
2292
|
+
Object.defineProperty(DialogInteractionService.prototype, "active", {
|
|
2206
2293
|
get: /**
|
|
2207
2294
|
* @return {?}
|
|
2208
2295
|
*/
|
|
2209
2296
|
function () {
|
|
2210
|
-
return this.
|
|
2297
|
+
return this._inActivityPromise.readonly;
|
|
2211
2298
|
},
|
|
2212
2299
|
enumerable: true,
|
|
2213
2300
|
configurable: true
|
|
@@ -2258,6 +2345,7 @@ var DialogInteractionService = /** @class */ (function (_super) {
|
|
|
2258
2345
|
*/
|
|
2259
2346
|
function () {
|
|
2260
2347
|
console.log('###### STARTING');
|
|
2348
|
+
_this._inActivityPromise.value = true;
|
|
2261
2349
|
// this.currentActivityId = uuid.v1();
|
|
2262
2350
|
// this.location.go(this.router.routerState.snapshot.url, "aup");
|
|
2263
2351
|
/** @type {?} */
|
|
@@ -2316,6 +2404,7 @@ var DialogInteractionService = /** @class */ (function (_super) {
|
|
|
2316
2404
|
* @return {?}
|
|
2317
2405
|
*/
|
|
2318
2406
|
function () {
|
|
2407
|
+
_this._inActivityPromise.value = false;
|
|
2319
2408
|
console.log('###### FINISHED');
|
|
2320
2409
|
// this.currentActivityId = null;
|
|
2321
2410
|
self.safelyUpdateActivityListDelegate(null);
|
|
@@ -2341,7 +2430,7 @@ var DialogInteractionService = /** @class */ (function (_super) {
|
|
|
2341
2430
|
setTimeout((/**
|
|
2342
2431
|
* @return {?}
|
|
2343
2432
|
*/
|
|
2344
|
-
function () { return _this.
|
|
2433
|
+
function () { return _this.setActivityList(delegate); }));
|
|
2345
2434
|
};
|
|
2346
2435
|
/**
|
|
2347
2436
|
* @param {?} alert
|
|
@@ -2359,7 +2448,7 @@ var DialogInteractionService = /** @class */ (function (_super) {
|
|
|
2359
2448
|
* @param {?} confirm
|
|
2360
2449
|
* @return {?}
|
|
2361
2450
|
*/
|
|
2362
|
-
DialogInteractionService.prototype.
|
|
2451
|
+
DialogInteractionService.prototype.confirmOrReject = /**
|
|
2363
2452
|
* @param {?} confirm
|
|
2364
2453
|
* @return {?}
|
|
2365
2454
|
*/
|
|
@@ -2408,14 +2497,12 @@ if (false) {
|
|
|
2408
2497
|
* @type {?}
|
|
2409
2498
|
* @private
|
|
2410
2499
|
*/
|
|
2411
|
-
DialogInteractionService.prototype.
|
|
2500
|
+
DialogInteractionService.prototype.startingGuard;
|
|
2412
2501
|
/**
|
|
2413
2502
|
* @type {?}
|
|
2414
2503
|
* @private
|
|
2415
2504
|
*/
|
|
2416
|
-
DialogInteractionService.prototype.
|
|
2417
|
-
/** @type {?} */
|
|
2418
|
-
DialogInteractionService.prototype.active;
|
|
2505
|
+
DialogInteractionService.prototype._inActivityPromise;
|
|
2419
2506
|
/**
|
|
2420
2507
|
* @type {?}
|
|
2421
2508
|
* @private
|
|
@@ -2912,49 +2999,25 @@ var PlaceDefinition = /** @class */ (function () {
|
|
|
2912
2999
|
return routeIdParameterDef ? visit.getParameter(routeIdParameterDef.name) : null;
|
|
2913
3000
|
};
|
|
2914
3001
|
/**
|
|
2915
|
-
* Returns angular router commands that specify the route id and any route parameters. The result does
|
|
2916
|
-
* not include any path information.
|
|
2917
|
-
*/
|
|
2918
|
-
// getFormattedRouterCommands(visit: Visit): any[] {
|
|
2919
|
-
// return this.hasRouteId() ?
|
|
2920
|
-
// [this.getFormattedRouteId(visit), this.getFormattedRouteParameters(visit)] :
|
|
2921
|
-
// [this.getFormattedRouteParameters(visit)];
|
|
2922
|
-
// }
|
|
2923
|
-
/**
|
|
2924
|
-
* Returns angular router commands that specify the route id and any route parameters. The result does
|
|
2925
|
-
* not include any path information.
|
|
2926
3002
|
* @param {?} visit
|
|
2927
3003
|
* @return {?}
|
|
2928
3004
|
*/
|
|
2929
|
-
// getFormattedRouterCommands(visit: Visit): any[] {
|
|
2930
|
-
// return this.hasRouteId() ?
|
|
2931
|
-
// [this.getFormattedRouteId(visit), this.getFormattedRouteParameters(visit)] :
|
|
2932
|
-
// [this.getFormattedRouteParameters(visit)];
|
|
2933
|
-
// }
|
|
2934
3005
|
PlaceDefinition.prototype.getFormattedRouteId = /**
|
|
2935
|
-
* Returns angular router commands that specify the route id and any route parameters. The result does
|
|
2936
|
-
* not include any path information.
|
|
2937
3006
|
* @param {?} visit
|
|
2938
3007
|
* @return {?}
|
|
2939
3008
|
*/
|
|
2940
|
-
// getFormattedRouterCommands(visit: Visit): any[] {
|
|
2941
|
-
// return this.hasRouteId() ?
|
|
2942
|
-
// [this.getFormattedRouteId(visit), this.getFormattedRouteParameters(visit)] :
|
|
2943
|
-
// [this.getFormattedRouteParameters(visit)];
|
|
2944
|
-
// }
|
|
2945
3009
|
function (visit) {
|
|
2946
|
-
|
|
3010
|
+
// Note: RouteIds are always present in the url and are just empty strings when not defined. This is
|
|
3011
|
+
// mandated by the fact that redirects from <path> to <path>/:id always include the id parameter as
|
|
3012
|
+
// an empty string.
|
|
3013
|
+
return visit.hasRouteId() ? this.getRouteIdParameterDef().urlFormat.format(visit.getRouteId()) : "";
|
|
2947
3014
|
};
|
|
2948
|
-
// @Trace()
|
|
2949
|
-
// @Trace()
|
|
2950
3015
|
/**
|
|
2951
3016
|
* @param {?} visit
|
|
2952
3017
|
* @param {?=} includeRouteId
|
|
2953
3018
|
* @return {?}
|
|
2954
3019
|
*/
|
|
2955
|
-
PlaceDefinition.prototype.getFormattedRouteParameters =
|
|
2956
|
-
// @Trace()
|
|
2957
|
-
/**
|
|
3020
|
+
PlaceDefinition.prototype.getFormattedRouteParameters = /**
|
|
2958
3021
|
* @param {?} visit
|
|
2959
3022
|
* @param {?=} includeRouteId
|
|
2960
3023
|
* @return {?}
|
|
@@ -3050,15 +3113,17 @@ var PlaceDefinition = /** @class */ (function () {
|
|
|
3050
3113
|
}
|
|
3051
3114
|
else {
|
|
3052
3115
|
/** @type {?} */
|
|
3053
|
-
var value =
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3116
|
+
var value = params.get(def.name);
|
|
3117
|
+
if (def.isRouteId) { // TODO: Move this to parameter def so it's a strategy pattern
|
|
3118
|
+
// because our id routes redirect if the id isn't present we always have a id
|
|
3119
|
+
// parameter in our params. This will bugger our remember and defaultvalue sanitisation
|
|
3120
|
+
// as it'll see that the id is present (event thought its a blank string).
|
|
3121
|
+
if (!___default.isEmpty(value)) {
|
|
3122
|
+
result[def.name] = def.urlFormat.parse(value);
|
|
3123
|
+
}
|
|
3124
|
+
}
|
|
3125
|
+
else {
|
|
3126
|
+
result[def.name] = def.urlFormat.parse(value);
|
|
3062
3127
|
}
|
|
3063
3128
|
}
|
|
3064
3129
|
}
|
|
@@ -3212,15 +3277,6 @@ var PlaceComponent = /** @class */ (function (_super) {
|
|
|
3212
3277
|
enumerable: true,
|
|
3213
3278
|
configurable: true
|
|
3214
3279
|
});
|
|
3215
|
-
/**
|
|
3216
|
-
* @return {?}
|
|
3217
|
-
*/
|
|
3218
|
-
PlaceComponent.prototype.canDeactivate = /**
|
|
3219
|
-
* @return {?}
|
|
3220
|
-
*/
|
|
3221
|
-
function () {
|
|
3222
|
-
return true;
|
|
3223
|
-
};
|
|
3224
3280
|
/**
|
|
3225
3281
|
* @return {?}
|
|
3226
3282
|
*/
|
|
@@ -3229,36 +3285,13 @@ var PlaceComponent = /** @class */ (function (_super) {
|
|
|
3229
3285
|
*/
|
|
3230
3286
|
function () {
|
|
3231
3287
|
};
|
|
3232
|
-
/**
|
|
3233
|
-
* Called by the place outlet after all animations have finished. We need this instead of ngOnDestroy
|
|
3234
|
-
* to avoid the fact that the angular router calls it before the animations have run causing the component
|
|
3235
|
-
* to loose any pectin bindings.
|
|
3236
|
-
*/
|
|
3237
|
-
// @Trace()
|
|
3238
|
-
/**
|
|
3239
|
-
* Called by the place outlet after all animations have finished. We need this instead of ngOnDestroy
|
|
3240
|
-
* to avoid the fact that the angular router calls it before the animations have run causing the component
|
|
3241
|
-
* to loose any pectin bindings.
|
|
3242
|
-
* @return {?}
|
|
3243
|
-
*/
|
|
3244
|
-
// @Trace()
|
|
3245
|
-
PlaceComponent.prototype.onPlaceDestroyed = /**
|
|
3246
|
-
* Called by the place outlet after all animations have finished. We need this instead of ngOnDestroy
|
|
3247
|
-
* to avoid the fact that the angular router calls it before the animations have run causing the component
|
|
3248
|
-
* to loose any pectin bindings.
|
|
3249
|
-
* @return {?}
|
|
3250
|
-
*/
|
|
3251
|
-
// @Trace()
|
|
3252
|
-
function () {
|
|
3253
|
-
this.dispose();
|
|
3254
|
-
};
|
|
3255
3288
|
__decorate([
|
|
3256
3289
|
Memoize$1(),
|
|
3257
3290
|
__metadata("design:type", PlaceDefinition),
|
|
3258
3291
|
__metadata("design:paramtypes", [])
|
|
3259
3292
|
], PlaceComponent.prototype, "placeDefinition", null);
|
|
3260
3293
|
return PlaceComponent;
|
|
3261
|
-
}(
|
|
3294
|
+
}(DisposableComponent));
|
|
3262
3295
|
if (false) {
|
|
3263
3296
|
/**
|
|
3264
3297
|
* @type {?}
|
|
@@ -3428,8 +3461,10 @@ var Visit = /** @class */ (function () {
|
|
|
3428
3461
|
else {
|
|
3429
3462
|
// copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the
|
|
3430
3463
|
// defaults and remember sanitisation process.
|
|
3464
|
+
/** @type {?} */
|
|
3465
|
+
var value = _this.getParameter(def.name);
|
|
3431
3466
|
if (_this.hasParameter(def.name)) {
|
|
3432
|
-
params[def.name] =
|
|
3467
|
+
params[def.name] = value;
|
|
3433
3468
|
}
|
|
3434
3469
|
}
|
|
3435
3470
|
}));
|
|
@@ -3463,17 +3498,6 @@ var Visit = /** @class */ (function () {
|
|
|
3463
3498
|
var sameNonRouteParameters = isEqual(this.placeDefinition.getNonRouteParameters(this), this.placeDefinition.getNonRouteParameters(other));
|
|
3464
3499
|
return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);
|
|
3465
3500
|
};
|
|
3466
|
-
/**
|
|
3467
|
-
* @return {?}
|
|
3468
|
-
*/
|
|
3469
|
-
Visit.prototype.getUrlSegments = /**
|
|
3470
|
-
* @return {?}
|
|
3471
|
-
*/
|
|
3472
|
-
function () {
|
|
3473
|
-
return this.placeDefinition.hasRouteId() ?
|
|
3474
|
-
[new UrlSegment(this.placeDefinition.path, {}), new UrlSegment(this.placeDefinition.getFormattedRouteId(this), this.placeDefinition.getFormattedRouteParameters(this))] :
|
|
3475
|
-
[new UrlSegment(this.placeDefinition.path, this.placeDefinition.getFormattedRouteParameters(this))];
|
|
3476
|
-
};
|
|
3477
3501
|
return Visit;
|
|
3478
3502
|
}());
|
|
3479
3503
|
if (false) {
|
|
@@ -3512,10 +3536,13 @@ var /**
|
|
|
3512
3536
|
* @abstract
|
|
3513
3537
|
*/
|
|
3514
3538
|
NavigationSession = /** @class */ (function () {
|
|
3515
|
-
function NavigationSession(firstNavigation) {
|
|
3539
|
+
function NavigationSession(firstNavigation, appModalInteractionContext) {
|
|
3516
3540
|
this.firstNavigation = firstNavigation;
|
|
3541
|
+
this.appModalInteractionContext = appModalInteractionContext;
|
|
3517
3542
|
this._alreadyAccepted = [];
|
|
3518
3543
|
this._visits = new Map();
|
|
3544
|
+
this.componentDeactivationHandlers = new Map();
|
|
3545
|
+
this.dialogOpenOnStart = this.appModalInteractionContext.isActive();
|
|
3519
3546
|
}
|
|
3520
3547
|
/**
|
|
3521
3548
|
* @param {?} visit
|
|
@@ -3539,52 +3566,36 @@ NavigationSession = /** @class */ (function () {
|
|
|
3539
3566
|
function (placeDef) {
|
|
3540
3567
|
return this._visits.get(placeDef);
|
|
3541
3568
|
};
|
|
3542
|
-
/**
|
|
3543
|
-
* @param {?} params
|
|
3544
|
-
* @return {?}
|
|
3545
|
-
*/
|
|
3546
|
-
NavigationSession.prototype.mergePrivatePlaceParameters = /**
|
|
3547
|
-
* @param {?} params
|
|
3548
|
-
* @return {?}
|
|
3549
|
-
*/
|
|
3550
|
-
function (params) {
|
|
3551
|
-
return null;
|
|
3552
|
-
};
|
|
3553
|
-
// @Trace()
|
|
3554
|
-
// @Trace()
|
|
3555
|
-
/**
|
|
3556
|
-
* @param {?} placeComponent
|
|
3557
|
-
* @return {?}
|
|
3558
|
-
*/
|
|
3559
|
-
NavigationSession.prototype.alreadyAccepted =
|
|
3560
|
-
// @Trace()
|
|
3561
|
-
/**
|
|
3562
|
-
* @param {?} placeComponent
|
|
3563
|
-
* @return {?}
|
|
3564
|
-
*/
|
|
3565
|
-
function (placeComponent) {
|
|
3566
|
-
return this._alreadyAccepted.includes(placeComponent);
|
|
3567
|
-
};
|
|
3568
|
-
// @Trace()
|
|
3569
|
-
// @Trace()
|
|
3570
3569
|
/**
|
|
3571
3570
|
* @param {?} component
|
|
3571
|
+
* @param {?} nextState
|
|
3572
3572
|
* @return {?}
|
|
3573
3573
|
*/
|
|
3574
|
-
NavigationSession.prototype.
|
|
3575
|
-
// @Trace()
|
|
3576
|
-
/**
|
|
3574
|
+
NavigationSession.prototype.canDeactivate = /**
|
|
3577
3575
|
* @param {?} component
|
|
3576
|
+
* @param {?} nextState
|
|
3578
3577
|
* @return {?}
|
|
3579
3578
|
*/
|
|
3580
|
-
function (component) {
|
|
3581
|
-
this
|
|
3579
|
+
function (component, nextState) {
|
|
3580
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3581
|
+
var handler, isPrimaryHandler;
|
|
3582
|
+
return __generator(this, function (_a) {
|
|
3583
|
+
// lookup the handler and create it if we've not seen it yet
|
|
3584
|
+
handler = this.componentDeactivationHandlers.get(component);
|
|
3585
|
+
if (!handler) {
|
|
3586
|
+
isPrimaryHandler = this.componentDeactivationHandlers.size === 0;
|
|
3587
|
+
handler = new NavigationSession.ComponentDeactivationHandler(component, this.appModalInteractionContext, isPrimaryHandler);
|
|
3588
|
+
this.componentDeactivationHandlers.set(component, handler);
|
|
3589
|
+
}
|
|
3590
|
+
return [2 /*return*/, handler.canDeactivate(nextState)];
|
|
3591
|
+
});
|
|
3592
|
+
});
|
|
3582
3593
|
};
|
|
3583
3594
|
/**
|
|
3584
3595
|
* @param {?} url
|
|
3585
3596
|
* @return {?}
|
|
3586
3597
|
*/
|
|
3587
|
-
NavigationSession.prototype.
|
|
3598
|
+
NavigationSession.prototype.setPopstateReturnUrl = /**
|
|
3588
3599
|
* @param {?} url
|
|
3589
3600
|
* @return {?}
|
|
3590
3601
|
*/
|
|
@@ -3641,13 +3652,25 @@ if (false) {
|
|
|
3641
3652
|
/** @type {?} */
|
|
3642
3653
|
NavigationSession.prototype.isExternal;
|
|
3643
3654
|
/** @type {?} */
|
|
3655
|
+
NavigationSession.prototype.dialogOpenOnStart;
|
|
3656
|
+
/**
|
|
3657
|
+
* @type {?}
|
|
3658
|
+
* @private
|
|
3659
|
+
*/
|
|
3660
|
+
NavigationSession.prototype.componentDeactivationHandlers;
|
|
3661
|
+
/** @type {?} */
|
|
3644
3662
|
NavigationSession.prototype.firstNavigation;
|
|
3663
|
+
/**
|
|
3664
|
+
* @type {?}
|
|
3665
|
+
* @private
|
|
3666
|
+
*/
|
|
3667
|
+
NavigationSession.prototype.appModalInteractionContext;
|
|
3645
3668
|
}
|
|
3646
3669
|
(function (NavigationSession) {
|
|
3647
3670
|
var External = /** @class */ (function (_super) {
|
|
3648
3671
|
__extends(External, _super);
|
|
3649
|
-
function External(isFirstTime) {
|
|
3650
|
-
var _this = _super.call(this, isFirstTime) || this;
|
|
3672
|
+
function External(isFirstTime, appModelInteractionContext) {
|
|
3673
|
+
var _this = _super.call(this, isFirstTime, appModelInteractionContext) || this;
|
|
3651
3674
|
_this.isExternal = true;
|
|
3652
3675
|
return _this;
|
|
3653
3676
|
}
|
|
@@ -3659,8 +3682,8 @@ if (false) {
|
|
|
3659
3682
|
}
|
|
3660
3683
|
var Internal = /** @class */ (function (_super) {
|
|
3661
3684
|
__extends(Internal, _super);
|
|
3662
|
-
function Internal(visit) {
|
|
3663
|
-
var _this = _super.call(this, false) || this;
|
|
3685
|
+
function Internal(visit, appModelInteractionContext) {
|
|
3686
|
+
var _this = _super.call(this, false, appModelInteractionContext) || this;
|
|
3664
3687
|
_this.isExternal = false;
|
|
3665
3688
|
_this.storeVisit(visit);
|
|
3666
3689
|
return _this;
|
|
@@ -3671,22 +3694,192 @@ if (false) {
|
|
|
3671
3694
|
/** @type {?} */
|
|
3672
3695
|
Internal.prototype.isExternal;
|
|
3673
3696
|
}
|
|
3674
|
-
/**
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3697
|
+
var Factory = /** @class */ (function () {
|
|
3698
|
+
function Factory(appModelInteractionContext) {
|
|
3699
|
+
this.appModelInteractionContext = appModelInteractionContext;
|
|
3700
|
+
}
|
|
3701
|
+
/**
|
|
3702
|
+
* @param {?} visit
|
|
3703
|
+
* @return {?}
|
|
3704
|
+
*/
|
|
3705
|
+
Factory.prototype.createInternal = /**
|
|
3706
|
+
* @param {?} visit
|
|
3707
|
+
* @return {?}
|
|
3708
|
+
*/
|
|
3709
|
+
function (visit) {
|
|
3710
|
+
return new Internal(visit, this.appModelInteractionContext);
|
|
3711
|
+
};
|
|
3712
|
+
/**
|
|
3713
|
+
* @param {?} firstTimeRoute
|
|
3714
|
+
* @return {?}
|
|
3715
|
+
*/
|
|
3716
|
+
Factory.prototype.createExternal = /**
|
|
3717
|
+
* @param {?} firstTimeRoute
|
|
3718
|
+
* @return {?}
|
|
3719
|
+
*/
|
|
3720
|
+
function (firstTimeRoute) {
|
|
3721
|
+
return new External(firstTimeRoute, this.appModelInteractionContext);
|
|
3722
|
+
};
|
|
3723
|
+
Factory.decorators = [
|
|
3724
|
+
{ type: Injectable, args: [{
|
|
3725
|
+
providedIn: 'root'
|
|
3726
|
+
},] },
|
|
3727
|
+
];
|
|
3728
|
+
/** @nocollapse */
|
|
3729
|
+
Factory.ctorParameters = function () { return [
|
|
3730
|
+
{ type: InteractionContext }
|
|
3731
|
+
]; };
|
|
3732
|
+
return Factory;
|
|
3733
|
+
}());
|
|
3734
|
+
NavigationSession.Factory = Factory;
|
|
3735
|
+
if (false) {
|
|
3736
|
+
/** @type {?} */
|
|
3737
|
+
Factory.prototype.appModelInteractionContext;
|
|
3680
3738
|
}
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3739
|
+
var ComponentDeactivationHandler = /** @class */ (function () {
|
|
3740
|
+
function ComponentDeactivationHandler(component, appModelInteractionContext, primary) {
|
|
3741
|
+
this.component = component;
|
|
3742
|
+
this.appModelInteractionContext = appModelInteractionContext;
|
|
3743
|
+
this.primary = primary;
|
|
3744
|
+
this.alreadyAccepted = false;
|
|
3745
|
+
// super();
|
|
3746
|
+
}
|
|
3747
|
+
/**
|
|
3748
|
+
* @param {?} nextState
|
|
3749
|
+
* @return {?}
|
|
3750
|
+
*/
|
|
3751
|
+
ComponentDeactivationHandler.prototype.canDeactivate = /**
|
|
3752
|
+
* @param {?} nextState
|
|
3753
|
+
* @return {?}
|
|
3754
|
+
*/
|
|
3755
|
+
function (nextState) {
|
|
3756
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3757
|
+
var _a;
|
|
3758
|
+
return __generator(this, function (_b) {
|
|
3759
|
+
switch (_b.label) {
|
|
3760
|
+
case 0:
|
|
3761
|
+
console.log(this.constructor.name + ".canDeactivate", { component: this.component });
|
|
3762
|
+
if (!this.alreadyAccepted) return [3 /*break*/, 1];
|
|
3763
|
+
// We'll get called multiple times if there's any parameter sanitisation so
|
|
3764
|
+
// we always return true if we accepted on a previous cycle of the current
|
|
3765
|
+
// navigation session.
|
|
3766
|
+
return [2 /*return*/, true];
|
|
3767
|
+
case 1:
|
|
3768
|
+
if (!(this.primary && this.appModelInteractionContext.isActive())) return [3 /*break*/, 3];
|
|
3769
|
+
// We check the global interaction first
|
|
3770
|
+
return [4 /*yield*/, this.cancelCurrentActivityOf(this.appModelInteractionContext)];
|
|
3771
|
+
case 2:
|
|
3772
|
+
// We check the global interaction first
|
|
3773
|
+
_b.sent();
|
|
3774
|
+
return [2 /*return*/, false];
|
|
3775
|
+
case 3:
|
|
3776
|
+
_a = this;
|
|
3777
|
+
return [4 /*yield*/, this.canDeactivateComponent(nextState)];
|
|
3778
|
+
case 4:
|
|
3779
|
+
_a.alreadyAccepted = _b.sent();
|
|
3780
|
+
return [2 /*return*/, this.alreadyAccepted];
|
|
3781
|
+
}
|
|
3782
|
+
});
|
|
3783
|
+
});
|
|
3784
|
+
};
|
|
3785
|
+
/**
|
|
3786
|
+
* @protected
|
|
3787
|
+
* @param {?} nextState
|
|
3788
|
+
* @return {?}
|
|
3789
|
+
*/
|
|
3790
|
+
ComponentDeactivationHandler.prototype.canDeactivateComponent = /**
|
|
3791
|
+
* @protected
|
|
3792
|
+
* @param {?} nextState
|
|
3793
|
+
* @return {?}
|
|
3794
|
+
*/
|
|
3795
|
+
function (nextState) {
|
|
3796
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3797
|
+
var hasCustomInteractionContext;
|
|
3798
|
+
return __generator(this, function (_a) {
|
|
3799
|
+
// check if the component has an active interaction. This will handle
|
|
3800
|
+
// an inplace interaction contexts
|
|
3801
|
+
hasCustomInteractionContext = this.component.interactionContext &&
|
|
3802
|
+
!this.isAppModalInteractionContext(this.component.interactionContext) &&
|
|
3803
|
+
this.component.interactionContext.isActive();
|
|
3804
|
+
if (hasCustomInteractionContext) {
|
|
3805
|
+
this.cancelCurrentActivityOf(this.component.interactionContext);
|
|
3806
|
+
return [2 /*return*/, false];
|
|
3807
|
+
}
|
|
3808
|
+
if (this.isLeavingCurrentPlace(nextState) && this.component.canDeactivate) {
|
|
3809
|
+
// No interaction in progress, so ask the component .
|
|
3810
|
+
// This may start an interaction, hence checking the interaction context before now. I.e. if the place pops up the dialog, and
|
|
3811
|
+
// the user clicks back again, we'll re-enter here and go bang when the component tries to open another dialog.
|
|
3812
|
+
return [2 /*return*/, this.component.canDeactivate()];
|
|
3813
|
+
}
|
|
3814
|
+
return [2 /*return*/, true];
|
|
3815
|
+
});
|
|
3816
|
+
});
|
|
3817
|
+
};
|
|
3818
|
+
/**
|
|
3819
|
+
* @param {?} interactionContext
|
|
3820
|
+
* @return {?}
|
|
3821
|
+
*/
|
|
3822
|
+
ComponentDeactivationHandler.prototype.isAppModalInteractionContext = /**
|
|
3823
|
+
* @param {?} interactionContext
|
|
3824
|
+
* @return {?}
|
|
3825
|
+
*/
|
|
3826
|
+
function (interactionContext) {
|
|
3827
|
+
return this.appModelInteractionContext === interactionContext;
|
|
3828
|
+
};
|
|
3829
|
+
/**
|
|
3830
|
+
* @protected
|
|
3831
|
+
* @param {?} interactionContext
|
|
3832
|
+
* @return {?}
|
|
3833
|
+
*/
|
|
3834
|
+
ComponentDeactivationHandler.prototype.cancelCurrentActivityOf = /**
|
|
3835
|
+
* @protected
|
|
3836
|
+
* @param {?} interactionContext
|
|
3837
|
+
* @return {?}
|
|
3838
|
+
*/
|
|
3839
|
+
function (interactionContext) {
|
|
3840
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3841
|
+
var activity;
|
|
3842
|
+
return __generator(this, function (_a) {
|
|
3843
|
+
switch (_a.label) {
|
|
3844
|
+
case 0: return [4 /*yield*/, interactionContext.getCurrentActivity()];
|
|
3845
|
+
case 1:
|
|
3846
|
+
activity = _a.sent();
|
|
3847
|
+
console.log('cancelling', { activity: activity });
|
|
3848
|
+
activity.cancel(null);
|
|
3849
|
+
return [2 /*return*/];
|
|
3850
|
+
}
|
|
3851
|
+
});
|
|
3852
|
+
});
|
|
3853
|
+
};
|
|
3854
|
+
/**
|
|
3855
|
+
* @protected
|
|
3856
|
+
* @param {?} nextState
|
|
3857
|
+
* @return {?}
|
|
3858
|
+
*/
|
|
3859
|
+
ComponentDeactivationHandler.prototype.isLeavingCurrentPlace = /**
|
|
3860
|
+
* @protected
|
|
3861
|
+
* @param {?} nextState
|
|
3862
|
+
* @return {?}
|
|
3863
|
+
*/
|
|
3864
|
+
function (nextState) {
|
|
3865
|
+
return !nextState.includesPathOf(this.component.placeDefinition);
|
|
3866
|
+
};
|
|
3867
|
+
return ComponentDeactivationHandler;
|
|
3868
|
+
}());
|
|
3869
|
+
NavigationSession.ComponentDeactivationHandler = ComponentDeactivationHandler;
|
|
3870
|
+
if (false) {
|
|
3871
|
+
/**
|
|
3872
|
+
* @type {?}
|
|
3873
|
+
* @private
|
|
3874
|
+
*/
|
|
3875
|
+
ComponentDeactivationHandler.prototype.alreadyAccepted;
|
|
3876
|
+
/** @type {?} */
|
|
3877
|
+
ComponentDeactivationHandler.prototype.component;
|
|
3878
|
+
/** @type {?} */
|
|
3879
|
+
ComponentDeactivationHandler.prototype.appModelInteractionContext;
|
|
3880
|
+
/** @type {?} */
|
|
3881
|
+
ComponentDeactivationHandler.prototype.primary;
|
|
3688
3882
|
}
|
|
3689
|
-
NavigationSession.createExternal = createExternal;
|
|
3690
3883
|
})(NavigationSession || (NavigationSession = {}));
|
|
3691
3884
|
|
|
3692
3885
|
/**
|
|
@@ -3775,9 +3968,11 @@ if (false) {
|
|
|
3775
3968
|
*/
|
|
3776
3969
|
var PlaceRouter = /** @class */ (function (_super) {
|
|
3777
3970
|
__extends(PlaceRouter, _super);
|
|
3778
|
-
function PlaceRouter(router, angularLocation, placeHistory) {
|
|
3971
|
+
function PlaceRouter(router, urlSerializer, navigationSessionFactory, angularLocation, placeHistory) {
|
|
3779
3972
|
var _this = _super.call(this) || this;
|
|
3780
3973
|
_this.router = router;
|
|
3974
|
+
_this.urlSerializer = urlSerializer;
|
|
3975
|
+
_this.navigationSessionFactory = navigationSessionFactory;
|
|
3781
3976
|
_this.angularLocation = angularLocation;
|
|
3782
3977
|
_this.placeHistory = placeHistory;
|
|
3783
3978
|
_this.firstRoute = true;
|
|
@@ -3807,8 +4002,11 @@ var PlaceRouter = /** @class */ (function (_super) {
|
|
|
3807
4002
|
if (event instanceof NavigationStart) {
|
|
3808
4003
|
_this.onAngularRouterStarted(event);
|
|
3809
4004
|
}
|
|
3810
|
-
if (event instanceof NavigationEnd
|
|
3811
|
-
_this.onAngularRouterFinished();
|
|
4005
|
+
if (event instanceof NavigationEnd) {
|
|
4006
|
+
_this.onAngularRouterFinished(false);
|
|
4007
|
+
}
|
|
4008
|
+
if (event instanceof NavigationError) {
|
|
4009
|
+
_this.onAngularRouterFinished(true);
|
|
3812
4010
|
}
|
|
3813
4011
|
}));
|
|
3814
4012
|
_this.navigationSessionActive = chain(_this.navigationSessionModel).isNotNil();
|
|
@@ -3928,19 +4126,19 @@ var PlaceRouter = /** @class */ (function (_super) {
|
|
|
3928
4126
|
* @return {?}
|
|
3929
4127
|
*/
|
|
3930
4128
|
function (router) {
|
|
3931
|
-
// we have to to use the definition for route id as our redirection always includes
|
|
3932
|
-
// the id in the url segements (but leaves it blank when there's no id). I.e. in the
|
|
3933
|
-
// no id case we're doing the following redirect [<placePath>, ""] -> ["..", <id>]
|
|
3934
|
-
/** @type {?} */
|
|
3935
|
-
var relativePath = !!previous.placeDefinition.hasRouteId() ? '..' : '.';
|
|
3936
4129
|
/** @type {?} */
|
|
3937
|
-
var commands =
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
4130
|
+
var commands = _this.parseUrl(_this.router.routerState.snapshot).createRedirectCommandsFor(next);
|
|
4131
|
+
// // we have to to use the definition for route id as our redirection always includes
|
|
4132
|
+
// // the id in the url segements (but leaves it blank when there's no id). I.e. in the
|
|
4133
|
+
// // no id case we're doing the following redirect [<placePath>, ""] -> ["..", <id>]
|
|
4134
|
+
// const relativePath = !!previous.placeDefinition.hasRouteId() ? '..' : '.';
|
|
4135
|
+
// const commands = [
|
|
4136
|
+
// relativePath,
|
|
4137
|
+
// ...this.createRouteParameters(next),
|
|
4138
|
+
// ...this.extractChildPath(activatedRoute.snapshot)
|
|
4139
|
+
// ];
|
|
4140
|
+
console.log('### Push Changes to route Redirect', { commands: commands });
|
|
4141
|
+
return router.navigate(commands);
|
|
3944
4142
|
}))];
|
|
3945
4143
|
}
|
|
3946
4144
|
return [2 /*return*/];
|
|
@@ -3962,7 +4160,7 @@ var PlaceRouter = /** @class */ (function (_super) {
|
|
|
3962
4160
|
return __generator(this, function (_a) {
|
|
3963
4161
|
switch (_a.label) {
|
|
3964
4162
|
case 0:
|
|
3965
|
-
this._navigationSessionModel.value =
|
|
4163
|
+
this._navigationSessionModel.value = this.navigationSessionFactory.createInternal(visit);
|
|
3966
4164
|
_a.label = 1;
|
|
3967
4165
|
case 1:
|
|
3968
4166
|
_a.trys.push([1, , 3, 4]);
|
|
@@ -3971,8 +4169,10 @@ var PlaceRouter = /** @class */ (function (_super) {
|
|
|
3971
4169
|
_a.sent();
|
|
3972
4170
|
return [3 /*break*/, 4];
|
|
3973
4171
|
case 3:
|
|
4172
|
+
// Router has finished (since there was no router change required) so we
|
|
4173
|
+
// need to end the navigation session.
|
|
3974
4174
|
if (this.navigationSession && !this.router.getCurrentNavigation()) {
|
|
3975
|
-
this.onAngularRouterFinished();
|
|
4175
|
+
this.onAngularRouterFinished(false);
|
|
3976
4176
|
}
|
|
3977
4177
|
return [7 /*endfinally*/];
|
|
3978
4178
|
case 4: return [2 /*return*/];
|
|
@@ -4015,9 +4215,9 @@ var PlaceRouter = /** @class */ (function (_super) {
|
|
|
4015
4215
|
if (!this.navigationSession) { // We been activated by an external route rather than placeRouter.go(visit)
|
|
4016
4216
|
console.log('navigation started', { firstTime: this.firstRoute });
|
|
4017
4217
|
/** @type {?} */
|
|
4018
|
-
var session =
|
|
4218
|
+
var session = this.navigationSessionFactory.createExternal(this.firstRoute);
|
|
4019
4219
|
if (event.navigationTrigger === 'popstate') {
|
|
4020
|
-
session.
|
|
4220
|
+
session.setPopstateReturnUrl(this.router.routerState.snapshot.url);
|
|
4021
4221
|
}
|
|
4022
4222
|
this._navigationSessionModel.value = session;
|
|
4023
4223
|
}
|
|
@@ -4027,30 +4227,40 @@ var PlaceRouter = /** @class */ (function (_super) {
|
|
|
4027
4227
|
// @Trace()
|
|
4028
4228
|
/**
|
|
4029
4229
|
* @private
|
|
4230
|
+
* @param {?} cancelled
|
|
4030
4231
|
* @return {?}
|
|
4031
4232
|
*/
|
|
4032
4233
|
PlaceRouter.prototype.onAngularRouterFinished =
|
|
4033
4234
|
// @Trace()
|
|
4034
4235
|
/**
|
|
4035
4236
|
* @private
|
|
4237
|
+
* @param {?} cancelled
|
|
4036
4238
|
* @return {?}
|
|
4037
4239
|
*/
|
|
4038
|
-
function () {
|
|
4240
|
+
function (cancelled) {
|
|
4039
4241
|
var _this = this;
|
|
4040
4242
|
/** @type {?} */
|
|
4041
4243
|
var session = this._navigationSessionModel.value;
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
_this.placeHistory.add(v);
|
|
4052
|
-
|
|
4053
|
-
|
|
4244
|
+
if (!cancelled) {
|
|
4245
|
+
// Update visits before we end the navigation session. This allows the placeOutets to
|
|
4246
|
+
// ignore visit changes that occur while the navigation is in progress
|
|
4247
|
+
/** @type {?} */
|
|
4248
|
+
var visits = session.getVisits();
|
|
4249
|
+
visits.forEach((/**
|
|
4250
|
+
* @param {?} v
|
|
4251
|
+
* @return {?}
|
|
4252
|
+
*/
|
|
4253
|
+
function (v) { return _this.placeHistory.add(v); }));
|
|
4254
|
+
this._activeVisits.value = visits;
|
|
4255
|
+
}
|
|
4256
|
+
else {
|
|
4257
|
+
// Angular doesn't preserve the url when a guard cancels the back button.
|
|
4258
|
+
// See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
4259
|
+
if (session.isPopState) {
|
|
4260
|
+
console.log('cancelled during popstate');
|
|
4261
|
+
this.angularLocation.go(session.popStateReturnUrl);
|
|
4262
|
+
}
|
|
4263
|
+
}
|
|
4054
4264
|
this._navigationSessionModel.value = null;
|
|
4055
4265
|
};
|
|
4056
4266
|
/**
|
|
@@ -4068,6 +4278,17 @@ var PlaceRouter = /** @class */ (function (_super) {
|
|
|
4068
4278
|
*/
|
|
4069
4279
|
function (child) { return child.url; })));
|
|
4070
4280
|
};
|
|
4281
|
+
/**
|
|
4282
|
+
* @param {?} snapshot
|
|
4283
|
+
* @return {?}
|
|
4284
|
+
*/
|
|
4285
|
+
PlaceRouter.prototype.parseUrl = /**
|
|
4286
|
+
* @param {?} snapshot
|
|
4287
|
+
* @return {?}
|
|
4288
|
+
*/
|
|
4289
|
+
function (snapshot) {
|
|
4290
|
+
return new PlaceRouter.UrlHelper(this.urlSerializer.parse(snapshot.url));
|
|
4291
|
+
};
|
|
4071
4292
|
PlaceRouter.decorators = [
|
|
4072
4293
|
{ type: Injectable, args: [{
|
|
4073
4294
|
providedIn: 'root'
|
|
@@ -4076,10 +4297,12 @@ var PlaceRouter = /** @class */ (function (_super) {
|
|
|
4076
4297
|
/** @nocollapse */
|
|
4077
4298
|
PlaceRouter.ctorParameters = function () { return [
|
|
4078
4299
|
{ type: Router },
|
|
4300
|
+
{ type: UrlSerializer },
|
|
4301
|
+
{ type: NavigationSession.Factory },
|
|
4079
4302
|
{ type: Location },
|
|
4080
4303
|
{ type: PlaceHistory }
|
|
4081
4304
|
]; };
|
|
4082
|
-
/** @nocollapse */ PlaceRouter.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(ɵɵinject(Router), ɵɵinject(Location), ɵɵinject(PlaceHistory)); }, token: PlaceRouter, providedIn: "root" });
|
|
4305
|
+
/** @nocollapse */ PlaceRouter.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(ɵɵinject(Router), ɵɵinject(UrlSerializer), ɵɵinject(NavigationSession.Factory), ɵɵinject(Location), ɵɵinject(PlaceHistory)); }, token: PlaceRouter, providedIn: "root" });
|
|
4083
4306
|
__decorate([
|
|
4084
4307
|
Trace(),
|
|
4085
4308
|
__metadata("design:type", Function),
|
|
@@ -4113,11 +4336,145 @@ if (false) {
|
|
|
4113
4336
|
* @private
|
|
4114
4337
|
*/
|
|
4115
4338
|
PlaceRouter.prototype.router;
|
|
4339
|
+
/**
|
|
4340
|
+
* @type {?}
|
|
4341
|
+
* @private
|
|
4342
|
+
*/
|
|
4343
|
+
PlaceRouter.prototype.urlSerializer;
|
|
4344
|
+
/**
|
|
4345
|
+
* @type {?}
|
|
4346
|
+
* @private
|
|
4347
|
+
*/
|
|
4348
|
+
PlaceRouter.prototype.navigationSessionFactory;
|
|
4116
4349
|
/** @type {?} */
|
|
4117
4350
|
PlaceRouter.prototype.angularLocation;
|
|
4118
4351
|
/** @type {?} */
|
|
4119
4352
|
PlaceRouter.prototype.placeHistory;
|
|
4120
4353
|
}
|
|
4354
|
+
(function (PlaceRouter) {
|
|
4355
|
+
var UrlHelper = /** @class */ (function () {
|
|
4356
|
+
function UrlHelper(urlTree) {
|
|
4357
|
+
this.urlTree = urlTree;
|
|
4358
|
+
console.log({ segments: this.urlTree.root.children.primary.segments });
|
|
4359
|
+
}
|
|
4360
|
+
/**
|
|
4361
|
+
* @return {?}
|
|
4362
|
+
*/
|
|
4363
|
+
UrlHelper.prototype.cloneUrlSegmentList = /**
|
|
4364
|
+
* @return {?}
|
|
4365
|
+
*/
|
|
4366
|
+
function () {
|
|
4367
|
+
return __spread(this.urlTree.root.children.primary.segments);
|
|
4368
|
+
};
|
|
4369
|
+
/**
|
|
4370
|
+
* @param {?} visit
|
|
4371
|
+
* @return {?}
|
|
4372
|
+
*/
|
|
4373
|
+
UrlHelper.prototype.updateVisitSegments = /**
|
|
4374
|
+
* @param {?} visit
|
|
4375
|
+
* @return {?}
|
|
4376
|
+
*/
|
|
4377
|
+
function (visit) {
|
|
4378
|
+
// Ugly, but it works for now.
|
|
4379
|
+
/** @type {?} */
|
|
4380
|
+
var segments = this.cloneUrlSegmentList();
|
|
4381
|
+
/** @type {?} */
|
|
4382
|
+
var visitSegments = this.convertToUrlSegments(visit);
|
|
4383
|
+
/** @type {?} */
|
|
4384
|
+
var replaceAt = segments.findIndex((/**
|
|
4385
|
+
* @param {?} segment
|
|
4386
|
+
* @return {?}
|
|
4387
|
+
*/
|
|
4388
|
+
function (segment) { return segment.path === visitSegments[0].path; }));
|
|
4389
|
+
// do not use the return value, it's the items that were removed!
|
|
4390
|
+
segments.splice.apply(segments, __spread([replaceAt, visitSegments.length], visitSegments));
|
|
4391
|
+
return segments;
|
|
4392
|
+
};
|
|
4393
|
+
/**
|
|
4394
|
+
* Converts the visit into segments. Please not that these segments are not e
|
|
4395
|
+
* @param visit
|
|
4396
|
+
*/
|
|
4397
|
+
/**
|
|
4398
|
+
* Converts the visit into segments. Please not that these segments are not e
|
|
4399
|
+
* @param {?} visit
|
|
4400
|
+
* @return {?}
|
|
4401
|
+
*/
|
|
4402
|
+
UrlHelper.prototype.convertToUrlSegments = /**
|
|
4403
|
+
* Converts the visit into segments. Please not that these segments are not e
|
|
4404
|
+
* @param {?} visit
|
|
4405
|
+
* @return {?}
|
|
4406
|
+
*/
|
|
4407
|
+
function (visit) {
|
|
4408
|
+
return visit.placeDefinition.hasRouteId() ?
|
|
4409
|
+
[
|
|
4410
|
+
// NOTE:
|
|
4411
|
+
// It's important to attach the params to the root path and not the id. If we attach them
|
|
4412
|
+
// to an empty id then the angular router won't match the pattern.
|
|
4413
|
+
new UrlSegment(visit.placeDefinition.path, visit.placeDefinition.getFormattedRouteParameters(visit)),
|
|
4414
|
+
new UrlSegment(visit.placeDefinition.getFormattedRouteId(visit), {})
|
|
4415
|
+
]
|
|
4416
|
+
:
|
|
4417
|
+
[
|
|
4418
|
+
new UrlSegment(visit.placeDefinition.path, visit.placeDefinition.getFormattedRouteParameters(visit))
|
|
4419
|
+
];
|
|
4420
|
+
};
|
|
4421
|
+
/**
|
|
4422
|
+
* @param {?} visit
|
|
4423
|
+
* @return {?}
|
|
4424
|
+
*/
|
|
4425
|
+
UrlHelper.prototype.createRedirectCommandsFor = /**
|
|
4426
|
+
* @param {?} visit
|
|
4427
|
+
* @return {?}
|
|
4428
|
+
*/
|
|
4429
|
+
function (visit) {
|
|
4430
|
+
/** @type {?} */
|
|
4431
|
+
var segments = this.updateVisitSegments(visit);
|
|
4432
|
+
/** @type {?} */
|
|
4433
|
+
var commands = [];
|
|
4434
|
+
segments.forEach((/**
|
|
4435
|
+
* @param {?} s
|
|
4436
|
+
* @return {?}
|
|
4437
|
+
*/
|
|
4438
|
+
function (s) {
|
|
4439
|
+
commands.push(s.path);
|
|
4440
|
+
if (s.parameterMap.keys.length > 0) {
|
|
4441
|
+
commands.push(s.parameters);
|
|
4442
|
+
}
|
|
4443
|
+
}));
|
|
4444
|
+
return commands;
|
|
4445
|
+
};
|
|
4446
|
+
/**
|
|
4447
|
+
* @param {?} placeDef
|
|
4448
|
+
* @return {?}
|
|
4449
|
+
*/
|
|
4450
|
+
UrlHelper.prototype.includesPathOf = /**
|
|
4451
|
+
* @param {?} placeDef
|
|
4452
|
+
* @return {?}
|
|
4453
|
+
*/
|
|
4454
|
+
function (placeDef) {
|
|
4455
|
+
return this.cloneUrlSegmentList().find((/**
|
|
4456
|
+
* @param {?} s
|
|
4457
|
+
* @return {?}
|
|
4458
|
+
*/
|
|
4459
|
+
function (s) { return s.path === placeDef.path; }));
|
|
4460
|
+
};
|
|
4461
|
+
__decorate([
|
|
4462
|
+
Trace(),
|
|
4463
|
+
__metadata("design:type", Function),
|
|
4464
|
+
__metadata("design:paramtypes", [Visit]),
|
|
4465
|
+
__metadata("design:returntype", Array)
|
|
4466
|
+
], UrlHelper.prototype, "createRedirectCommandsFor", null);
|
|
4467
|
+
return UrlHelper;
|
|
4468
|
+
}());
|
|
4469
|
+
PlaceRouter.UrlHelper = UrlHelper;
|
|
4470
|
+
if (false) {
|
|
4471
|
+
/**
|
|
4472
|
+
* @type {?}
|
|
4473
|
+
* @private
|
|
4474
|
+
*/
|
|
4475
|
+
UrlHelper.prototype.urlTree;
|
|
4476
|
+
}
|
|
4477
|
+
})(PlaceRouter || (PlaceRouter = {}));
|
|
4121
4478
|
|
|
4122
4479
|
/**
|
|
4123
4480
|
* @fileoverview added by tsickle
|
|
@@ -5868,7 +6225,7 @@ var EnterPlaceGuard = /** @class */ (function () {
|
|
|
5868
6225
|
*/
|
|
5869
6226
|
function (activatedRoute, state) {
|
|
5870
6227
|
return __awaiter(this, void 0, void 0, function () {
|
|
5871
|
-
var placeDefinition, params, parsedParams, initialVisit, sanitiser, sanitisedVisit,
|
|
6228
|
+
var placeDefinition, params, parsedParams, initialVisit, sanitiser, sanitisedVisit, commands;
|
|
5872
6229
|
return __generator(this, function (_a) {
|
|
5873
6230
|
switch (_a.label) {
|
|
5874
6231
|
case 0:
|
|
@@ -5885,9 +6242,8 @@ var EnterPlaceGuard = /** @class */ (function () {
|
|
|
5885
6242
|
// Save the visit with any updated parameters. We need to save it so we remember any non route parameters
|
|
5886
6243
|
this.placeRouter.navigationSession.storeVisit(sanitisedVisit);
|
|
5887
6244
|
if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {
|
|
5888
|
-
routerStateUrlTree = this.urlSerializer.parse(state.url);
|
|
5889
6245
|
// Regenerate the url
|
|
5890
|
-
commands = this.
|
|
6246
|
+
commands = this.placeRouter.parseUrl(state).createRedirectCommandsFor(sanitisedVisit);
|
|
5891
6247
|
console.log('##### Place Guard Redirect', commands);
|
|
5892
6248
|
return [2 /*return*/, this.router.createUrlTree(commands, {
|
|
5893
6249
|
replaceUrl: true,
|
|
@@ -5904,46 +6260,6 @@ var EnterPlaceGuard = /** @class */ (function () {
|
|
|
5904
6260
|
});
|
|
5905
6261
|
});
|
|
5906
6262
|
};
|
|
5907
|
-
/**
|
|
5908
|
-
* @private
|
|
5909
|
-
* @param {?} sanitisedVisit
|
|
5910
|
-
* @param {?} path
|
|
5911
|
-
* @return {?}
|
|
5912
|
-
*/
|
|
5913
|
-
EnterPlaceGuard.prototype.createRedirectCommands = /**
|
|
5914
|
-
* @private
|
|
5915
|
-
* @param {?} sanitisedVisit
|
|
5916
|
-
* @param {?} path
|
|
5917
|
-
* @return {?}
|
|
5918
|
-
*/
|
|
5919
|
-
function (sanitisedVisit, path) {
|
|
5920
|
-
// Ugly, but it works for now.
|
|
5921
|
-
/** @type {?} */
|
|
5922
|
-
var newSegments = sanitisedVisit.getUrlSegments();
|
|
5923
|
-
/** @type {?} */
|
|
5924
|
-
var replaceAt = path.findIndex((/**
|
|
5925
|
-
* @param {?} segment
|
|
5926
|
-
* @return {?}
|
|
5927
|
-
*/
|
|
5928
|
-
function (segment) { return segment.path === newSegments[0].path; }));
|
|
5929
|
-
/** @type {?} */
|
|
5930
|
-
var newPath = __spread(path);
|
|
5931
|
-
newPath.splice.apply(newPath, __spread([replaceAt, newSegments.length], newSegments)); // do not use the return value, it's the items that were removed!
|
|
5932
|
-
// do not use the return value, it's the items that were removed!
|
|
5933
|
-
/** @type {?} */
|
|
5934
|
-
var commands = [];
|
|
5935
|
-
newPath.forEach((/**
|
|
5936
|
-
* @param {?} s
|
|
5937
|
-
* @return {?}
|
|
5938
|
-
*/
|
|
5939
|
-
function (s) {
|
|
5940
|
-
commands.push(s.path);
|
|
5941
|
-
if (s.parameterMap.keys.length > 0) {
|
|
5942
|
-
commands.push(s.parameters);
|
|
5943
|
-
}
|
|
5944
|
-
}));
|
|
5945
|
-
return { newPath: newPath, commands: commands };
|
|
5946
|
-
};
|
|
5947
6263
|
EnterPlaceGuard.decorators = [
|
|
5948
6264
|
{ type: Injectable, args: [{
|
|
5949
6265
|
providedIn: 'root'
|
|
@@ -6149,90 +6465,9 @@ if (false) {
|
|
|
6149
6465
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
6150
6466
|
*/
|
|
6151
6467
|
var LeavePlaceGuard = /** @class */ (function () {
|
|
6152
|
-
function LeavePlaceGuard(
|
|
6153
|
-
this.router = router;
|
|
6154
|
-
this.injector = injector;
|
|
6468
|
+
function LeavePlaceGuard(placeRouter) {
|
|
6155
6469
|
this.placeRouter = placeRouter;
|
|
6156
|
-
this.dialogInteractionContext = dialogInteractionContext;
|
|
6157
|
-
this.angularLocation = angularLocation;
|
|
6158
6470
|
}
|
|
6159
|
-
// @Trace()
|
|
6160
|
-
// @Trace()
|
|
6161
|
-
/**
|
|
6162
|
-
* @private
|
|
6163
|
-
* @param {?} nextState
|
|
6164
|
-
* @param {?} placeDefinition
|
|
6165
|
-
* @return {?}
|
|
6166
|
-
*/
|
|
6167
|
-
LeavePlaceGuard.prototype.isLeavingTheCurrentPlace =
|
|
6168
|
-
// @Trace()
|
|
6169
|
-
/**
|
|
6170
|
-
* @private
|
|
6171
|
-
* @param {?} nextState
|
|
6172
|
-
* @param {?} placeDefinition
|
|
6173
|
-
* @return {?}
|
|
6174
|
-
*/
|
|
6175
|
-
function (nextState, placeDefinition) {
|
|
6176
|
-
// TODO: this will break with child routes... need to examine the router states properly.
|
|
6177
|
-
// console.log('canDeactivate', {
|
|
6178
|
-
// staticPath: placeDefinitionPath,
|
|
6179
|
-
// currentStateUrl: currentState.url,
|
|
6180
|
-
// nextStateUrl: nextState.url
|
|
6181
|
-
// // alreadyDeclined: this._alreadyAccepted
|
|
6182
|
-
// });
|
|
6183
|
-
// Example of the above when navigating to a different child route.
|
|
6184
|
-
// canDeactivate {staticPath: "/hero-details",
|
|
6185
|
-
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-details",
|
|
6186
|
-
// nextStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats"
|
|
6187
|
-
// }
|
|
6188
|
-
// TODO: this will break with child routes... need to examine the router states properly.
|
|
6189
|
-
// console.log('canDeactivate', {
|
|
6190
|
-
// staticPath: placeDefinitionPath,
|
|
6191
|
-
// currentStateUrl: currentState.url,
|
|
6192
|
-
// nextStateUrl: nextState.url
|
|
6193
|
-
// // alreadyDeclined: this._alreadyAccepted
|
|
6194
|
-
// });
|
|
6195
|
-
// Example of the above when navigating to a different child route.
|
|
6196
|
-
// canDeactivate {staticPath: "/hero-details",
|
|
6197
|
-
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-details",
|
|
6198
|
-
// nextStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats"
|
|
6199
|
-
// }
|
|
6200
|
-
// Example clicking on router tab of the parent component (de-activates the parent due to route param changes)
|
|
6201
|
-
// canDeactivate {
|
|
6202
|
-
// staticPath: "/hero-stats",
|
|
6203
|
-
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
6204
|
-
// nextStateUrl: "/route-parameters/"
|
|
6205
|
-
// }
|
|
6206
|
-
// canDeactivate {
|
|
6207
|
-
// staticPath: "/route-parameters",
|
|
6208
|
-
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
6209
|
-
// nextStateUrl: "/route-parameters/"
|
|
6210
|
-
// }
|
|
6211
|
-
// logger.class.js:54 ParameterSnapshot.sanitise -> {idModel: -1, pv: undefined, pl: Array(0), dv: undefined, dl: Array(0), …}
|
|
6212
|
-
// parameter-snapshot.ts:20 {name: "idModel", mine: -1, theirs: null}
|
|
6213
|
-
// place-router.ts:28 redirect path (3) ["route-parameters", "-1", {…}]
|
|
6214
|
-
// canDeactivate {
|
|
6215
|
-
// staticPath: "/hero-stats",
|
|
6216
|
-
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
6217
|
-
// nextStateUrl: "/route-parameters/-1"
|
|
6218
|
-
// }
|
|
6219
|
-
// canDeactivate {
|
|
6220
|
-
// staticPath: "/route-parameters",
|
|
6221
|
-
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
6222
|
-
// nextStateUrl: "/route-parameters/-1"
|
|
6223
|
-
// }
|
|
6224
|
-
// logger.class.js:54 ParameterSnapshot.sanitise -> {idModel: -1, pv: undefined, pl: Array(0), dv: "A", dl: Array(3), …}
|
|
6225
|
-
// parameter-snapshot.ts:20 {name: "dv", mine: "A", theirs: undefined}
|
|
6226
|
-
// place-router.ts:28 redirect path (3) ["route-parameters", "-1", {…}]
|
|
6227
|
-
// canDeactivate {
|
|
6228
|
-
// staticPath: "/hero-stats",
|
|
6229
|
-
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
6230
|
-
// nextStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c"
|
|
6231
|
-
// }
|
|
6232
|
-
/** @type {?} */
|
|
6233
|
-
var placeDefinitionPath = "/" + placeDefinition.path;
|
|
6234
|
-
return !nextState.url.startsWith(placeDefinitionPath);
|
|
6235
|
-
};
|
|
6236
6471
|
/**
|
|
6237
6472
|
* @param {?} component
|
|
6238
6473
|
* @param {?} currentRoute
|
|
@@ -6249,72 +6484,8 @@ var LeavePlaceGuard = /** @class */ (function () {
|
|
|
6249
6484
|
*/
|
|
6250
6485
|
function (component, currentRoute, currentState, nextState) {
|
|
6251
6486
|
return __awaiter(this, void 0, void 0, function () {
|
|
6252
|
-
var self_1, canLeave;
|
|
6253
6487
|
return __generator(this, function (_a) {
|
|
6254
|
-
|
|
6255
|
-
case 0:
|
|
6256
|
-
if (!this.placeRouter.navigationSession.alreadyAccepted(component)) return [3 /*break*/, 1];
|
|
6257
|
-
// We'll get called multiple times if there's any parameter sanitisation so
|
|
6258
|
-
// we always return true if we accepted on a previous cycle of the current
|
|
6259
|
-
// navigation session.
|
|
6260
|
-
return [2 /*return*/, true];
|
|
6261
|
-
case 1:
|
|
6262
|
-
self_1 = this;
|
|
6263
|
-
canLeave = true;
|
|
6264
|
-
if (!this.isLeavingTheCurrentPlace(nextState, component.placeDefinition)) return [3 /*break*/, 4];
|
|
6265
|
-
// we check the dialog interaction first, so that components that don't need to check if they're in an
|
|
6266
|
-
// interaction during the canDeactivate cycle.
|
|
6267
|
-
// TODO: Add tests: show dialog -> hit back -> same route
|
|
6268
|
-
if (this.dialogInteractionContext.isActive()) {
|
|
6269
|
-
console.log('cancelling', { activity: this.dialogInteractionContext.currentActivity });
|
|
6270
|
-
this.dialogInteractionContext.currentActivity.cancel(null);
|
|
6271
|
-
canLeave = false;
|
|
6272
|
-
}
|
|
6273
|
-
else {
|
|
6274
|
-
canLeave = true;
|
|
6275
|
-
}
|
|
6276
|
-
if (canLeave) {
|
|
6277
|
-
// now check if the component has an active interaction. This will handle
|
|
6278
|
-
// an inplace interaction contexts
|
|
6279
|
-
if (component.interactionContext && component.interactionContext.isActive()) {
|
|
6280
|
-
canLeave = false;
|
|
6281
|
-
console.log('cancelling', { activity: component.interactionContext.currentActivity });
|
|
6282
|
-
component.interactionContext.currentActivity.cancel(null);
|
|
6283
|
-
}
|
|
6284
|
-
}
|
|
6285
|
-
if (!canLeave) return [3 /*break*/, 3];
|
|
6286
|
-
return [4 /*yield*/, component.canDeactivate()];
|
|
6287
|
-
case 2:
|
|
6288
|
-
// TODO: Add tests: hit back -> confirm leave dialog -> hit back -> close dialog -> hit back -> confirm leave dialog.
|
|
6289
|
-
canLeave = _a.sent();
|
|
6290
|
-
_a.label = 3;
|
|
6291
|
-
case 3: return [3 /*break*/, 5];
|
|
6292
|
-
case 4:
|
|
6293
|
-
if (this.dialogInteractionContext.isActive()) {
|
|
6294
|
-
console.log('cancelling', { activity: this.dialogInteractionContext.currentActivity });
|
|
6295
|
-
this.dialogInteractionContext.currentActivity.cancel(null);
|
|
6296
|
-
canLeave = false;
|
|
6297
|
-
}
|
|
6298
|
-
else {
|
|
6299
|
-
canLeave = true;
|
|
6300
|
-
}
|
|
6301
|
-
_a.label = 5;
|
|
6302
|
-
case 5:
|
|
6303
|
-
if (canLeave) {
|
|
6304
|
-
// We'll get called multiple times if there's any parameter sanitisation so
|
|
6305
|
-
// we remember the acceptance for the duration of the current navigation session.
|
|
6306
|
-
self_1.placeRouter.navigationSession.rememberAcceptanceOf(component);
|
|
6307
|
-
}
|
|
6308
|
-
else {
|
|
6309
|
-
// Angular doesn't preserve the url when a guard cancels the back button.
|
|
6310
|
-
// See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
6311
|
-
if (this.placeRouter.navigationSession.isPopState) {
|
|
6312
|
-
console.log('cancelled during popstate');
|
|
6313
|
-
this.angularLocation.go(this.placeRouter.navigationSession.popStateReturnUrl);
|
|
6314
|
-
}
|
|
6315
|
-
}
|
|
6316
|
-
return [2 /*return*/, canLeave];
|
|
6317
|
-
}
|
|
6488
|
+
return [2 /*return*/, this.placeRouter.navigationSession.canDeactivate(component, this.placeRouter.parseUrl(nextState))];
|
|
6318
6489
|
});
|
|
6319
6490
|
});
|
|
6320
6491
|
};
|
|
@@ -6325,35 +6496,17 @@ var LeavePlaceGuard = /** @class */ (function () {
|
|
|
6325
6496
|
];
|
|
6326
6497
|
/** @nocollapse */
|
|
6327
6498
|
LeavePlaceGuard.ctorParameters = function () { return [
|
|
6328
|
-
{ type:
|
|
6329
|
-
{ type: Injector },
|
|
6330
|
-
{ type: PlaceRouter },
|
|
6331
|
-
{ type: InteractionContext },
|
|
6332
|
-
{ type: Location }
|
|
6499
|
+
{ type: PlaceRouter }
|
|
6333
6500
|
]; };
|
|
6334
|
-
/** @nocollapse */ LeavePlaceGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function LeavePlaceGuard_Factory() { return new LeavePlaceGuard(ɵɵinject(
|
|
6501
|
+
/** @nocollapse */ LeavePlaceGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function LeavePlaceGuard_Factory() { return new LeavePlaceGuard(ɵɵinject(PlaceRouter)); }, token: LeavePlaceGuard, providedIn: "root" });
|
|
6335
6502
|
return LeavePlaceGuard;
|
|
6336
6503
|
}());
|
|
6337
6504
|
if (false) {
|
|
6338
|
-
/**
|
|
6339
|
-
* @type {?}
|
|
6340
|
-
* @private
|
|
6341
|
-
*/
|
|
6342
|
-
LeavePlaceGuard.prototype.router;
|
|
6343
|
-
/**
|
|
6344
|
-
* @type {?}
|
|
6345
|
-
* @private
|
|
6346
|
-
*/
|
|
6347
|
-
LeavePlaceGuard.prototype.injector;
|
|
6348
6505
|
/**
|
|
6349
6506
|
* @type {?}
|
|
6350
6507
|
* @private
|
|
6351
6508
|
*/
|
|
6352
6509
|
LeavePlaceGuard.prototype.placeRouter;
|
|
6353
|
-
/** @type {?} */
|
|
6354
|
-
LeavePlaceGuard.prototype.dialogInteractionContext;
|
|
6355
|
-
/** @type {?} */
|
|
6356
|
-
LeavePlaceGuard.prototype.angularLocation;
|
|
6357
6510
|
}
|
|
6358
6511
|
|
|
6359
6512
|
/**
|
|
@@ -6376,5 +6529,5 @@ if (false) {
|
|
|
6376
6529
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
6377
6530
|
*/
|
|
6378
6531
|
|
|
6379
|
-
export { ACTIVITY_DATA, AUP_PLACE_CONFIG, AbstractActivity, 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, EnterPlaceGuard, FocusBindingDirective, Formatter, InplaceInteractionContextComponent, InteractionContext, InteractionGuard, InteractionModule, InteractionOutletComponent, LEFT_RIGHT_PLACE_ANIMATION, LeavePlaceGuard, ListPlaceNavComponent, NavigationSession, NoopComponent, 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,
|
|
6532
|
+
export { ACTIVITY_DATA, AUP_PLACE_CONFIG, AbstractActivity, 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, EnterPlaceGuard, FocusBindingDirective, Formatter, InplaceInteractionContextComponent, InteractionContext, InteractionGuard, InteractionModule, InteractionOutletComponent, LEFT_RIGHT_PLACE_ANIMATION, LeavePlaceGuard, ListPlaceNavComponent, NavigationSession, NoopComponent, 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, InteractionModule as ɵba, ActivityContainerComponent as ɵbb, ActivityOutletComponent as ɵbc, ConfirmationDialogComponent as ɵbd, AbstractActivity as ɵbe, ACTIVITY_DATA as ɵbf, Activity as ɵbg, ConfirmThenDialogComponent as ɵbi, AlertDialogComponent as ɵbj, InteractionOutletComponent as ɵbl, InplaceInteractionContextComponent as ɵbm, DIALOG_INTERACTION_SERVICE_DEFAULTS as ɵbn, DialogInteractionService as ɵbo, 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, NavigationSession as ɵu, InteractionContext as ɵv, PlaceHistory as ɵw, TabbedPlaceNavigationComponent as ɵx, AbstractPlaceNavigationComponent as ɵy, ListPlaceNavComponent as ɵz };
|
|
6380
6533
|
//# sourceMappingURL=coolon-angular-ui-powerups.js.map
|