@coolon/angular-ui-powerups 0.0.101 → 0.0.102
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 +896 -620
- 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.metadata.json +1 -1
- package/esm2015/coolon-angular-ui-powerups.js +2 -2
- package/esm2015/index.js +2 -2
- package/esm2015/lib/interaction/components/activity-container/activity-container.component.js +2 -1
- package/esm2015/lib/interaction/interaction-context-base.js +21 -8
- package/esm2015/lib/interaction/interaction-context.js +56 -3
- package/esm2015/lib/interaction/services/interaction.service.js +11 -7
- package/esm2015/lib/place/guards/navigation-state.js +216 -135
- package/esm2015/lib/place/guards/place-component-deactivation-handler.js +63 -28
- package/esm2015/lib/place/guards/place.guard.js +215 -0
- package/esm2015/lib/place/index.js +2 -3
- package/esm2015/lib/place/place-router.js +34 -36
- package/esm2015/lib/place/url-snapshot.js +69 -53
- package/esm2015/public_api.js +2 -2
- package/esm5/coolon-angular-ui-powerups.js +2 -2
- package/esm5/index.js +2 -2
- package/esm5/lib/interaction/components/activity-container/activity-container.component.js +2 -1
- package/esm5/lib/interaction/interaction-context-base.js +25 -8
- package/esm5/lib/interaction/interaction-context.js +88 -10
- package/esm5/lib/interaction/services/interaction.service.js +17 -8
- package/esm5/lib/place/guards/navigation-state.js +280 -162
- package/esm5/lib/place/guards/place-component-deactivation-handler.js +73 -27
- package/esm5/lib/place/guards/place.guard.js +300 -0
- package/esm5/lib/place/index.js +2 -3
- package/esm5/lib/place/place-router.js +52 -39
- package/esm5/lib/place/url-snapshot.js +85 -58
- package/esm5/public_api.js +2 -2
- package/fesm2015/coolon-angular-ui-powerups.js +661 -519
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +896 -619
- package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/interaction/interaction-context-base.d.ts +3 -1
- package/lib/interaction/interaction-context.d.ts +9 -2
- package/lib/interaction/services/interaction.service.d.ts +2 -2
- package/lib/place/guards/navigation-state.d.ts +44 -38
- package/lib/place/guards/place-component-deactivation-handler.d.ts +7 -4
- package/lib/place/guards/{abstract-place.guard.d.ts → place.guard.d.ts} +8 -3
- package/lib/place/index.d.ts +1 -2
- package/lib/place/place-router.d.ts +2 -0
- package/lib/place/url-snapshot.d.ts +14 -9
- package/package.json +1 -1
- package/schematics/place-routes/place-def.js +1 -0
- package/schematics/place-routes/place-def.js.map +1 -1
- package/schematics/place-routes/templates/place-routes.ts.template +10 -11
- package/esm2015/lib/place/guards/abstract-place.guard.js +0 -166
- package/esm2015/lib/place/guards/interaction.guard.js +0 -121
- package/esm5/lib/place/guards/abstract-place.guard.js +0 -213
- package/esm5/lib/place/guards/interaction.guard.js +0 -133
- package/lib/place/guards/interaction.guard.d.ts +0 -17
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@angular/forms'), require('@angular/material'), require('@angular/material/tabs'), require('@angular/platform-browser/animations'), require('@coolon/pectin'), require('@angular/cdk/portal'), require('@angular/router'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@coolon/angular-ui-powerups', ['exports', '@angular/common', '@angular/core', '@angular/forms', '@angular/material', '@angular/material/tabs', '@angular/platform-browser/animations', '@coolon/pectin', '@angular/cdk/portal', '@angular/router', '
|
|
4
|
-
(global = global || self, factory((global.coolon = global.coolon || {}, global.coolon['angular-ui-powerups'] = {}), global.ng.common, global.ng.core, global.ng.forms, global.ng.material, global.ng.material.tabs, global.ng.platformBrowser.animations, global.pectin, global.ng.cdk.portal, global.ng.router, global.
|
|
5
|
-
}(this, function (exports, common, core, forms, material, tabs, animations, pectin, portal, router,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@angular/forms'), require('@angular/material'), require('@angular/material/tabs'), require('@angular/platform-browser/animations'), require('@coolon/pectin'), require('@angular/cdk/portal'), require('@angular/router'), require('@coolon/typescript-utilities'), require('@angular/material/icon'), require('@angular/material/list'), require('@angular/material/tooltip'), require('@typescript-plus/fast-memoize-decorator/dist/src'), require('@typescript-plus/fast-memoize-decorator'), require('reflect-metadata'), require('lodash'), require('@angular/animations'), require('resize-observer-polyfill'), require('@angular/material/dialog'), require('rxjs')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@coolon/angular-ui-powerups', ['exports', '@angular/common', '@angular/core', '@angular/forms', '@angular/material', '@angular/material/tabs', '@angular/platform-browser/animations', '@coolon/pectin', '@angular/cdk/portal', '@angular/router', '@coolon/typescript-utilities', '@angular/material/icon', '@angular/material/list', '@angular/material/tooltip', '@typescript-plus/fast-memoize-decorator/dist/src', '@typescript-plus/fast-memoize-decorator', 'reflect-metadata', 'lodash', '@angular/animations', 'resize-observer-polyfill', '@angular/material/dialog', 'rxjs'], factory) :
|
|
4
|
+
(global = global || self, factory((global.coolon = global.coolon || {}, global.coolon['angular-ui-powerups'] = {}), global.ng.common, global.ng.core, global.ng.forms, global.ng.material, global.ng.material.tabs, global.ng.platformBrowser.animations, global.pectin, global.ng.cdk.portal, global.ng.router, global.typescriptUtilities, global.ng.material.icon, global.ng.material.list, global.ng.material.tooltip, global.src, global.fastMemoizeDecorator, null, global.___default, global.ng.animations, global.ResizeObserver, global.ng.material.dialog, global.rxjs));
|
|
5
|
+
}(this, function (exports, common, core, forms, material, tabs, animations, pectin, portal, router, typescriptUtilities, icon, list, tooltip, src, fastMemoizeDecorator, reflectMetadata, ___default, animations$1, ResizeObserver, dialog, rxjs) { 'use strict';
|
|
6
6
|
|
|
7
7
|
var ___default__default = 'default' in ___default ? ___default['default'] : ___default;
|
|
8
8
|
ResizeObserver = ResizeObserver && ResizeObserver.hasOwnProperty('default') ? ResizeObserver['default'] : ResizeObserver;
|
|
@@ -1283,10 +1283,7 @@
|
|
|
1283
1283
|
/**
|
|
1284
1284
|
* @abstract
|
|
1285
1285
|
*/
|
|
1286
|
-
var
|
|
1287
|
-
* @abstract
|
|
1288
|
-
*/
|
|
1289
|
-
InteractionContext = /** @class */ (function (_super) {
|
|
1286
|
+
var InteractionContext = /** @class */ (function (_super) {
|
|
1290
1287
|
__extends(InteractionContext, _super);
|
|
1291
1288
|
function InteractionContext() {
|
|
1292
1289
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
@@ -1317,17 +1314,101 @@
|
|
|
1317
1314
|
pectin.assert.isFalsey(this.isActive());
|
|
1318
1315
|
_super.prototype.dispose.call(this);
|
|
1319
1316
|
};
|
|
1317
|
+
/**
|
|
1318
|
+
* Cancels the current activity and returns true the context is no longer active, false if
|
|
1319
|
+
* there is still another activity running.
|
|
1320
|
+
*/
|
|
1321
|
+
/**
|
|
1322
|
+
* Cancels the current activity and returns true the context is no longer active, false if
|
|
1323
|
+
* there is still another activity running.
|
|
1324
|
+
* @return {?}
|
|
1325
|
+
*/
|
|
1326
|
+
InteractionContext.prototype.cancelCurrentActivity = /**
|
|
1327
|
+
* Cancels the current activity and returns true the context is no longer active, false if
|
|
1328
|
+
* there is still another activity running.
|
|
1329
|
+
* @return {?}
|
|
1330
|
+
*/
|
|
1331
|
+
function () {
|
|
1332
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1333
|
+
var when, activity;
|
|
1334
|
+
var _this = this;
|
|
1335
|
+
return __generator(this, function (_a) {
|
|
1336
|
+
switch (_a.label) {
|
|
1337
|
+
case 0:
|
|
1338
|
+
when = pectin.Dsl.disposeWith(this).when;
|
|
1339
|
+
return [4 /*yield*/, this.getCurrentActivity()];
|
|
1340
|
+
case 1:
|
|
1341
|
+
activity = _a.sent();
|
|
1342
|
+
return [2 /*return*/, new Promise((/**
|
|
1343
|
+
* @param {?} resolve
|
|
1344
|
+
* @return {?}
|
|
1345
|
+
*/
|
|
1346
|
+
function (resolve) {
|
|
1347
|
+
when.valueOf(_this.activeActivity)
|
|
1348
|
+
.changes((/**
|
|
1349
|
+
* @param {?} nextActivity
|
|
1350
|
+
* @return {?}
|
|
1351
|
+
*/
|
|
1352
|
+
function (nextActivity) {
|
|
1353
|
+
resolve(!nextActivity);
|
|
1354
|
+
}), { once: true });
|
|
1355
|
+
activity.cancel();
|
|
1356
|
+
}))];
|
|
1357
|
+
}
|
|
1358
|
+
});
|
|
1359
|
+
});
|
|
1360
|
+
};
|
|
1361
|
+
/**
|
|
1362
|
+
* @return {?}
|
|
1363
|
+
*/
|
|
1364
|
+
InteractionContext.prototype.abort = /**
|
|
1365
|
+
* @return {?}
|
|
1366
|
+
*/
|
|
1367
|
+
function () {
|
|
1368
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1369
|
+
var count;
|
|
1370
|
+
return __generator(this, function (_a) {
|
|
1371
|
+
switch (_a.label) {
|
|
1372
|
+
case 0:
|
|
1373
|
+
pectin.assert.isTruthy(this.isActive());
|
|
1374
|
+
count = 1;
|
|
1375
|
+
return [4 /*yield*/, this.cancelCurrentActivity()];
|
|
1376
|
+
case 1:
|
|
1377
|
+
_a.sent();
|
|
1378
|
+
console.log("aborted -> " + count++);
|
|
1379
|
+
_a.label = 2;
|
|
1380
|
+
case 2:
|
|
1381
|
+
if (!this.isActive()) return [3 /*break*/, 4];
|
|
1382
|
+
return [4 /*yield*/, this.cancelCurrentActivity()];
|
|
1383
|
+
case 3:
|
|
1384
|
+
_a.sent();
|
|
1385
|
+
console.log("aborted -> " + count++);
|
|
1386
|
+
return [3 /*break*/, 2];
|
|
1387
|
+
case 4: return [2 /*return*/];
|
|
1388
|
+
}
|
|
1389
|
+
});
|
|
1390
|
+
});
|
|
1391
|
+
};
|
|
1392
|
+
__decorate([
|
|
1393
|
+
pectin.Trace(),
|
|
1394
|
+
__metadata("design:type", Function),
|
|
1395
|
+
__metadata("design:paramtypes", []),
|
|
1396
|
+
__metadata("design:returntype", Promise)
|
|
1397
|
+
], InteractionContext.prototype, "abort", null);
|
|
1320
1398
|
return InteractionContext;
|
|
1321
1399
|
}(pectin.GarbageCollector));
|
|
1322
1400
|
if (false) {
|
|
1401
|
+
/** @type {?} */
|
|
1402
|
+
InteractionContext.prototype.active;
|
|
1323
1403
|
/** @type {?} */
|
|
1324
1404
|
InteractionContext.prototype.activityList;
|
|
1325
1405
|
/** @type {?} */
|
|
1326
|
-
InteractionContext.prototype.
|
|
1406
|
+
InteractionContext.prototype.activeActivity;
|
|
1327
1407
|
/**
|
|
1328
1408
|
* Returns the activity that is currently active.
|
|
1329
1409
|
* This model is only updated in the next tick after the view has been updated.
|
|
1330
1410
|
* @abstract
|
|
1411
|
+
* @protected
|
|
1331
1412
|
* @return {?}
|
|
1332
1413
|
*/
|
|
1333
1414
|
InteractionContext.prototype.getCurrentActivity = function () { };
|
|
@@ -1536,13 +1617,14 @@
|
|
|
1536
1617
|
*/
|
|
1537
1618
|
_this._activityListDelegate = new pectin.DelegatingListModel();
|
|
1538
1619
|
var _a = pectin.Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
|
|
1539
|
-
|
|
1540
|
-
|
|
1620
|
+
_this._currentActivity = chain(_this.activityList).last();
|
|
1621
|
+
when.valueOf(_this._currentActivity).becomesTruthy((/**
|
|
1622
|
+
* @param {?} activity
|
|
1541
1623
|
* @return {?}
|
|
1542
1624
|
*/
|
|
1543
|
-
function (
|
|
1625
|
+
function (activity) {
|
|
1544
1626
|
if (_this.deferredGetCurrentActivity) {
|
|
1545
|
-
_this.deferredGetCurrentActivity.resolve(
|
|
1627
|
+
_this.deferredGetCurrentActivity.resolve(activity);
|
|
1546
1628
|
_this.deferredGetCurrentActivity = null;
|
|
1547
1629
|
}
|
|
1548
1630
|
}));
|
|
@@ -1571,6 +1653,16 @@
|
|
|
1571
1653
|
enumerable: true,
|
|
1572
1654
|
configurable: true
|
|
1573
1655
|
});
|
|
1656
|
+
Object.defineProperty(InteractionContextBase.prototype, "activeActivity", {
|
|
1657
|
+
get: /**
|
|
1658
|
+
* @return {?}
|
|
1659
|
+
*/
|
|
1660
|
+
function () {
|
|
1661
|
+
return this._currentActivity;
|
|
1662
|
+
},
|
|
1663
|
+
enumerable: true,
|
|
1664
|
+
configurable: true
|
|
1665
|
+
});
|
|
1574
1666
|
/**
|
|
1575
1667
|
* Returns the activity that is currently active.
|
|
1576
1668
|
* This model is only updated in the next tick after the view has been updated.
|
|
@@ -1597,12 +1689,14 @@
|
|
|
1597
1689
|
return [2 /*return*/, this.deferredGetCurrentActivity.promise];
|
|
1598
1690
|
}
|
|
1599
1691
|
else {
|
|
1600
|
-
if (this.
|
|
1692
|
+
if (!this._currentActivity.value) {
|
|
1693
|
+
// we'be been asked before we've got any activities, create a deferred promise
|
|
1694
|
+
// that we resolve when the list populates.
|
|
1601
1695
|
this.deferredGetCurrentActivity = pectin.Deferred.defer();
|
|
1602
1696
|
return [2 /*return*/, this.deferredGetCurrentActivity.promise];
|
|
1603
1697
|
}
|
|
1604
1698
|
else {
|
|
1605
|
-
return [2 /*return*/,
|
|
1699
|
+
return [2 /*return*/, this._currentActivity.value];
|
|
1606
1700
|
}
|
|
1607
1701
|
}
|
|
1608
1702
|
}
|
|
@@ -1704,6 +1798,11 @@
|
|
|
1704
1798
|
* @private
|
|
1705
1799
|
*/
|
|
1706
1800
|
InteractionContextBase.prototype.deferredGetCurrentActivity;
|
|
1801
|
+
/**
|
|
1802
|
+
* @type {?}
|
|
1803
|
+
* @private
|
|
1804
|
+
*/
|
|
1805
|
+
InteractionContextBase.prototype._currentActivity;
|
|
1707
1806
|
/**
|
|
1708
1807
|
* @abstract
|
|
1709
1808
|
* @protected
|
|
@@ -2130,6 +2229,7 @@
|
|
|
2130
2229
|
* @return {?}
|
|
2131
2230
|
*/
|
|
2132
2231
|
function () {
|
|
2232
|
+
this.updateActivityList();
|
|
2133
2233
|
this._initialActivityOutletContext.value = null;
|
|
2134
2234
|
this.initialActivityOutletContextEvent.emit(null);
|
|
2135
2235
|
};
|
|
@@ -2365,6 +2465,15 @@
|
|
|
2365
2465
|
function () {
|
|
2366
2466
|
return this.active.value;
|
|
2367
2467
|
};
|
|
2468
|
+
/**
|
|
2469
|
+
* @return {?}
|
|
2470
|
+
*/
|
|
2471
|
+
InteractionService.prototype.isModalActive = /**
|
|
2472
|
+
* @return {?}
|
|
2473
|
+
*/
|
|
2474
|
+
function () {
|
|
2475
|
+
return this.modelInteractionActive.value;
|
|
2476
|
+
};
|
|
2368
2477
|
/**
|
|
2369
2478
|
* @param {?} disposable
|
|
2370
2479
|
* @return {?}
|
|
@@ -2390,19 +2499,19 @@
|
|
|
2390
2499
|
function (interactionContext) {
|
|
2391
2500
|
interactionContext.registerDisposable(new InteractionService.Monitor("ip" + ++inplaceMonitorCount, interactionContext, this._activeInlineInteractionContextModel, this.exclusiveContext));
|
|
2392
2501
|
};
|
|
2502
|
+
// @Trace()
|
|
2503
|
+
// @Trace()
|
|
2393
2504
|
/**
|
|
2394
2505
|
* @return {?}
|
|
2395
2506
|
*/
|
|
2396
|
-
InteractionService.prototype.
|
|
2507
|
+
InteractionService.prototype.getActiveContext =
|
|
2508
|
+
// @Trace()
|
|
2509
|
+
/**
|
|
2397
2510
|
* @return {?}
|
|
2398
2511
|
*/
|
|
2399
2512
|
function () {
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
typescriptUtilities.assert.isTruthy(this.isActive());
|
|
2403
|
-
return [2 /*return*/, this._activeInteractionContext.value.getCurrentActivity()];
|
|
2404
|
-
});
|
|
2405
|
-
});
|
|
2513
|
+
typescriptUtilities.assert.isTruthy(this.isActive());
|
|
2514
|
+
return this._activeInteractionContext.value;
|
|
2406
2515
|
};
|
|
2407
2516
|
/**
|
|
2408
2517
|
* Creates an interaction context that will prevent any other contexts from starting an
|
|
@@ -3735,67 +3844,110 @@
|
|
|
3735
3844
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
3736
3845
|
*/
|
|
3737
3846
|
var PlaceComponentDeactivationHandler = /** @class */ (function () {
|
|
3738
|
-
function PlaceComponentDeactivationHandler(component,
|
|
3847
|
+
function PlaceComponentDeactivationHandler(component, navigationState, isPrimaryComponent) {
|
|
3739
3848
|
this.component = component;
|
|
3740
|
-
this.
|
|
3849
|
+
this.navigationState = navigationState;
|
|
3850
|
+
this.isPrimaryComponent = isPrimaryComponent;
|
|
3741
3851
|
}
|
|
3852
|
+
Object.defineProperty(PlaceComponentDeactivationHandler.prototype, "interactionService", {
|
|
3853
|
+
get: /**
|
|
3854
|
+
* @return {?}
|
|
3855
|
+
*/
|
|
3856
|
+
function () {
|
|
3857
|
+
return this.navigationState.interactionService;
|
|
3858
|
+
},
|
|
3859
|
+
enumerable: true,
|
|
3860
|
+
configurable: true
|
|
3861
|
+
});
|
|
3862
|
+
Object.defineProperty(PlaceComponentDeactivationHandler.prototype, "placeRouter", {
|
|
3863
|
+
get: /**
|
|
3864
|
+
* @return {?}
|
|
3865
|
+
*/
|
|
3866
|
+
function () {
|
|
3867
|
+
return this.navigationState.placeRouter;
|
|
3868
|
+
},
|
|
3869
|
+
enumerable: true,
|
|
3870
|
+
configurable: true
|
|
3871
|
+
});
|
|
3742
3872
|
/**
|
|
3873
|
+
* @param {?} currentUrl
|
|
3743
3874
|
* @param {?} nextState
|
|
3744
3875
|
* @return {?}
|
|
3745
3876
|
*/
|
|
3746
3877
|
PlaceComponentDeactivationHandler.prototype.canDeactivate = /**
|
|
3878
|
+
* @param {?} currentUrl
|
|
3747
3879
|
* @param {?} nextState
|
|
3748
3880
|
* @return {?}
|
|
3749
3881
|
*/
|
|
3750
|
-
function (nextState) {
|
|
3882
|
+
function (currentUrl, nextState) {
|
|
3751
3883
|
return __awaiter(this, void 0, void 0, function () {
|
|
3752
3884
|
return __generator(this, function (_a) {
|
|
3753
3885
|
// We'll get called multiple times if there's any parameter sanitisation so
|
|
3754
3886
|
// we always return true if we accepted promise from a previous cycle of the current
|
|
3755
3887
|
// navigation session.
|
|
3756
3888
|
if (!this.canDeactivatePromise) {
|
|
3757
|
-
|
|
3889
|
+
console.log("creating deactivate promise for -> " + this.component.constructor.name);
|
|
3890
|
+
this.canDeactivatePromise = this.canDeactivateComponent(currentUrl, nextState);
|
|
3758
3891
|
}
|
|
3759
3892
|
return [2 /*return*/, this.canDeactivatePromise];
|
|
3760
3893
|
});
|
|
3761
3894
|
});
|
|
3762
3895
|
};
|
|
3896
|
+
// @Trace()
|
|
3897
|
+
// @Trace()
|
|
3763
3898
|
/**
|
|
3764
3899
|
* @protected
|
|
3900
|
+
* @param {?} currentUrl
|
|
3765
3901
|
* @param {?} nextState
|
|
3766
3902
|
* @return {?}
|
|
3767
3903
|
*/
|
|
3768
|
-
PlaceComponentDeactivationHandler.prototype.canDeactivateComponent =
|
|
3904
|
+
PlaceComponentDeactivationHandler.prototype.canDeactivateComponent =
|
|
3905
|
+
// @Trace()
|
|
3906
|
+
/**
|
|
3769
3907
|
* @protected
|
|
3908
|
+
* @param {?} currentUrl
|
|
3770
3909
|
* @param {?} nextState
|
|
3771
3910
|
* @return {?}
|
|
3772
3911
|
*/
|
|
3773
|
-
function (nextState) {
|
|
3912
|
+
function (currentUrl, nextState) {
|
|
3774
3913
|
return __awaiter(this, void 0, void 0, function () {
|
|
3775
|
-
var
|
|
3914
|
+
var routeIds, currentIds;
|
|
3776
3915
|
return __generator(this, function (_a) {
|
|
3777
3916
|
switch (_a.label) {
|
|
3778
3917
|
case 0:
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
// Now we just cancel the current activity...
|
|
3787
|
-
return [4 /*yield*/, this.component.interactionContext.getCurrentActivity()];
|
|
3918
|
+
console.log(this.navigationState.toString());
|
|
3919
|
+
if (!this.navigationState.isPopState) return [3 /*break*/, 5];
|
|
3920
|
+
if (!(this.isPrimaryComponent && this.interactionService.isModalActive())) return [3 /*break*/, 3];
|
|
3921
|
+
routeIds = this.placeRouter.getActiveInteractionIdsFromUrl(nextState.url);
|
|
3922
|
+
currentIds = this.interactionService.activeInteractionContextIds.value;
|
|
3923
|
+
if (!!___default.isEqual(currentIds, routeIds)) return [3 /*break*/, 2];
|
|
3924
|
+
return [4 /*yield*/, this.interactionService.getActiveContext().cancelCurrentActivity()];
|
|
3788
3925
|
case 1:
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
case
|
|
3926
|
+
_a.sent();
|
|
3927
|
+
return [2 /*return*/, currentUrl.updateInteractionIds(this.interactionService.activeInteractionContextIds.value)];
|
|
3928
|
+
case 2: return [3 /*break*/, 5];
|
|
3929
|
+
case 3:
|
|
3930
|
+
if (!(this.component.interactionContext && this.component.interactionContext.isActive())) return [3 /*break*/, 5];
|
|
3931
|
+
return [4 /*yield*/, this.component.interactionContext.cancelCurrentActivity()];
|
|
3932
|
+
case 4:
|
|
3933
|
+
_a.sent();
|
|
3934
|
+
return [2 /*return*/, currentUrl
|
|
3935
|
+
.updateInteractionIds(this.interactionService.activeInteractionContextIds.value)];
|
|
3936
|
+
case 5:
|
|
3793
3937
|
// Ok, so now we're really leaving, so we ask the component if we should.;
|
|
3794
|
-
if (this.isNotJustAChangeInRouteId(nextState)
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3938
|
+
if (this.isNotJustAChangeInRouteId(nextState)) {
|
|
3939
|
+
if (this.component.canDeactivate) {
|
|
3940
|
+
// No interaction in progress, so ask the component .
|
|
3941
|
+
// This may start an interaction, hence checking the interaction context before now. I.e. if the place pops up the dialog, and
|
|
3942
|
+
// the user clicks back again, we'll re-enter here and go bang when the component tries to open another dialog.
|
|
3943
|
+
return [2 /*return*/, this.component.canDeactivate(this.navigationState.interactionContext)];
|
|
3944
|
+
}
|
|
3945
|
+
// The component has an active interaction but no deactivation hook. Rather than guessing what to do
|
|
3946
|
+
// we'll just cancel the navigation and print a warning.
|
|
3947
|
+
if (this.component.interactionContext && this.component.interactionContext.isActive()) {
|
|
3948
|
+
console.warn('Route changed while component has active interaction, cancelling navigation');
|
|
3949
|
+
return [2 /*return*/, false];
|
|
3950
|
+
}
|
|
3799
3951
|
}
|
|
3800
3952
|
return [2 /*return*/, true];
|
|
3801
3953
|
}
|
|
@@ -3829,7 +3981,9 @@
|
|
|
3829
3981
|
/** @type {?} */
|
|
3830
3982
|
PlaceComponentDeactivationHandler.prototype.component;
|
|
3831
3983
|
/** @type {?} */
|
|
3832
|
-
PlaceComponentDeactivationHandler.prototype.
|
|
3984
|
+
PlaceComponentDeactivationHandler.prototype.navigationState;
|
|
3985
|
+
/** @type {?} */
|
|
3986
|
+
PlaceComponentDeactivationHandler.prototype.isPrimaryComponent;
|
|
3833
3987
|
}
|
|
3834
3988
|
|
|
3835
3989
|
/**
|
|
@@ -3850,6 +4004,16 @@
|
|
|
3850
4004
|
_this._visits = new Map();
|
|
3851
4005
|
return _this;
|
|
3852
4006
|
}
|
|
4007
|
+
Object.defineProperty(NavigationState.prototype, "name", {
|
|
4008
|
+
get: /**
|
|
4009
|
+
* @return {?}
|
|
4010
|
+
*/
|
|
4011
|
+
function () {
|
|
4012
|
+
return this.constructor.name;
|
|
4013
|
+
},
|
|
4014
|
+
enumerable: true,
|
|
4015
|
+
configurable: true
|
|
4016
|
+
});
|
|
3853
4017
|
Object.defineProperty(NavigationState.prototype, "idle", {
|
|
3854
4018
|
get: /**
|
|
3855
4019
|
* @return {?}
|
|
@@ -3912,6 +4076,19 @@
|
|
|
3912
4076
|
function (placeDef) {
|
|
3913
4077
|
return this._visits.get(placeDef);
|
|
3914
4078
|
};
|
|
4079
|
+
/**
|
|
4080
|
+
* @param {?} visit
|
|
4081
|
+
* @param {?} initialUrl
|
|
4082
|
+
* @return {?}
|
|
4083
|
+
*/
|
|
4084
|
+
NavigationState.prototype.onPlaceNavigationStart = /**
|
|
4085
|
+
* @param {?} visit
|
|
4086
|
+
* @param {?} initialUrl
|
|
4087
|
+
* @return {?}
|
|
4088
|
+
*/
|
|
4089
|
+
function (visit, initialUrl) {
|
|
4090
|
+
return this.illegalTransition('onPlaceNavigationStart');
|
|
4091
|
+
};
|
|
3915
4092
|
/**
|
|
3916
4093
|
* @param {?} event
|
|
3917
4094
|
* @return {?}
|
|
@@ -3927,7 +4104,7 @@
|
|
|
3927
4104
|
* @param {?} event
|
|
3928
4105
|
* @return {?}
|
|
3929
4106
|
*/
|
|
3930
|
-
NavigationState.prototype.
|
|
4107
|
+
NavigationState.prototype.onRouterStarted = /**
|
|
3931
4108
|
* @param {?} event
|
|
3932
4109
|
* @return {?}
|
|
3933
4110
|
*/
|
|
@@ -3938,7 +4115,7 @@
|
|
|
3938
4115
|
* @param {?} event
|
|
3939
4116
|
* @return {?}
|
|
3940
4117
|
*/
|
|
3941
|
-
NavigationState.prototype.
|
|
4118
|
+
NavigationState.prototype.onRouterCancelled = /**
|
|
3942
4119
|
* @param {?} event
|
|
3943
4120
|
* @return {?}
|
|
3944
4121
|
*/
|
|
@@ -3949,7 +4126,7 @@
|
|
|
3949
4126
|
* @param {?} event
|
|
3950
4127
|
* @return {?}
|
|
3951
4128
|
*/
|
|
3952
|
-
NavigationState.prototype.
|
|
4129
|
+
NavigationState.prototype.onRouterError = /**
|
|
3953
4130
|
* @param {?} event
|
|
3954
4131
|
* @return {?}
|
|
3955
4132
|
*/
|
|
@@ -3960,7 +4137,7 @@
|
|
|
3960
4137
|
* @param {?} event
|
|
3961
4138
|
* @return {?}
|
|
3962
4139
|
*/
|
|
3963
|
-
NavigationState.prototype.
|
|
4140
|
+
NavigationState.prototype.onRouterEnd = /**
|
|
3964
4141
|
* @param {?} event
|
|
3965
4142
|
* @return {?}
|
|
3966
4143
|
*/
|
|
@@ -3980,15 +4157,17 @@
|
|
|
3980
4157
|
};
|
|
3981
4158
|
/**
|
|
3982
4159
|
* @param {?} component
|
|
3983
|
-
* @param {?}
|
|
4160
|
+
* @param {?} currentUrl
|
|
4161
|
+
* @param {?} nextUrl
|
|
3984
4162
|
* @return {?}
|
|
3985
4163
|
*/
|
|
3986
4164
|
NavigationState.prototype.canDeactivatePlace = /**
|
|
3987
4165
|
* @param {?} component
|
|
3988
|
-
* @param {?}
|
|
4166
|
+
* @param {?} currentUrl
|
|
4167
|
+
* @param {?} nextUrl
|
|
3989
4168
|
* @return {?}
|
|
3990
4169
|
*/
|
|
3991
|
-
function (component,
|
|
4170
|
+
function (component, currentUrl, nextUrl) {
|
|
3992
4171
|
return __awaiter(this, void 0, void 0, function () {
|
|
3993
4172
|
return __generator(this, function (_a) {
|
|
3994
4173
|
return [2 /*return*/, this.illegalTransition('canDeactivatePlace')];
|
|
@@ -4041,12 +4220,29 @@
|
|
|
4041
4220
|
* @return {?}
|
|
4042
4221
|
*/
|
|
4043
4222
|
function (event) {
|
|
4044
|
-
// TODO: check if the event is purely for interaction context changes.
|
|
4045
4223
|
/** @type {?} */
|
|
4046
4224
|
var popstate = event.navigationTrigger === 'popstate';
|
|
4047
4225
|
return popstate ?
|
|
4048
|
-
|
|
4049
|
-
|
|
4226
|
+
this.interactionService.isActive() ?
|
|
4227
|
+
new NavigationState.InteractionPopStateTransition(this.context, this.currentRouterUrl()) :
|
|
4228
|
+
new NavigationState.PopStateTransition(this.context, this.currentRouterUrl())
|
|
4229
|
+
:
|
|
4230
|
+
this.interactionService.isActive() ?
|
|
4231
|
+
new NavigationState.InteractionTransition(this.context, this.currentRouterUrl()) :
|
|
4232
|
+
new NavigationState.NavigationTransition(this.context, this.currentRouterUrl());
|
|
4233
|
+
};
|
|
4234
|
+
/**
|
|
4235
|
+
* @protected
|
|
4236
|
+
* @return {?}
|
|
4237
|
+
*/
|
|
4238
|
+
NavigationState.prototype.createIdleState = /**
|
|
4239
|
+
* @protected
|
|
4240
|
+
* @return {?}
|
|
4241
|
+
*/
|
|
4242
|
+
function () {
|
|
4243
|
+
return this.interactionService.isActive() ?
|
|
4244
|
+
new NavigationState.IdleDuringInteraction(this.context, this.currentRouterUrl()) :
|
|
4245
|
+
new NavigationState.Idle(this.context);
|
|
4050
4246
|
};
|
|
4051
4247
|
/**
|
|
4052
4248
|
* @param {?} url
|
|
@@ -4057,12 +4253,7 @@
|
|
|
4057
4253
|
* @return {?}
|
|
4058
4254
|
*/
|
|
4059
4255
|
function (url) {
|
|
4060
|
-
|
|
4061
|
-
// TODO: Should this be a navigate operation to avoid confusing the router...??
|
|
4062
|
-
setTimeout((/**
|
|
4063
|
-
* @return {?}
|
|
4064
|
-
*/
|
|
4065
|
-
function () { return _this.placeRouter.resetBrowserLocation(url); }));
|
|
4256
|
+
this.placeRouter.resetBrowserLocation(url);
|
|
4066
4257
|
};
|
|
4067
4258
|
/**
|
|
4068
4259
|
* @return {?}
|
|
@@ -4120,11 +4311,27 @@
|
|
|
4120
4311
|
_this.isPopState = false;
|
|
4121
4312
|
return _this;
|
|
4122
4313
|
}
|
|
4314
|
+
/**
|
|
4315
|
+
* @param {?} visit
|
|
4316
|
+
* @param {?} initialUrl
|
|
4317
|
+
* @return {?}
|
|
4318
|
+
*/
|
|
4319
|
+
Idle.prototype.onPlaceNavigationStart = /**
|
|
4320
|
+
* @param {?} visit
|
|
4321
|
+
* @param {?} initialUrl
|
|
4322
|
+
* @return {?}
|
|
4323
|
+
*/
|
|
4324
|
+
function (visit, initialUrl) {
|
|
4325
|
+
/** @type {?} */
|
|
4326
|
+
var navigationTransition = new NavigationTransition(this.context, initialUrl);
|
|
4327
|
+
navigationTransition.storeVisit(visit);
|
|
4328
|
+
return navigationTransition;
|
|
4329
|
+
};
|
|
4123
4330
|
/**
|
|
4124
4331
|
* @param {?} event
|
|
4125
4332
|
* @return {?}
|
|
4126
4333
|
*/
|
|
4127
|
-
Idle.prototype.
|
|
4334
|
+
Idle.prototype.onRouterStarted = /**
|
|
4128
4335
|
* @param {?} event
|
|
4129
4336
|
* @return {?}
|
|
4130
4337
|
*/
|
|
@@ -4172,9 +4379,8 @@
|
|
|
4172
4379
|
*/
|
|
4173
4380
|
AbstractNavigationTransition = /** @class */ (function (_super) {
|
|
4174
4381
|
__extends(AbstractNavigationTransition, _super);
|
|
4175
|
-
function AbstractNavigationTransition(context,
|
|
4382
|
+
function AbstractNavigationTransition(context, startingUrl) {
|
|
4176
4383
|
var _this = _super.call(this, context) || this;
|
|
4177
|
-
_this.isPopState = isPopState;
|
|
4178
4384
|
_this.startingUrl = startingUrl;
|
|
4179
4385
|
_this.isTransitional = true;
|
|
4180
4386
|
_this.componentDeactivationHandlers = new Map();
|
|
@@ -4207,7 +4413,7 @@
|
|
|
4207
4413
|
* @param {?} event
|
|
4208
4414
|
* @return {?}
|
|
4209
4415
|
*/
|
|
4210
|
-
AbstractNavigationTransition.prototype.
|
|
4416
|
+
AbstractNavigationTransition.prototype.onRouterStarted = /**
|
|
4211
4417
|
* @param {?} event
|
|
4212
4418
|
* @return {?}
|
|
4213
4419
|
*/
|
|
@@ -4220,7 +4426,7 @@
|
|
|
4220
4426
|
* @param {?} event
|
|
4221
4427
|
* @return {?}
|
|
4222
4428
|
*/
|
|
4223
|
-
AbstractNavigationTransition.prototype.
|
|
4429
|
+
AbstractNavigationTransition.prototype.onRouterEnd = /**
|
|
4224
4430
|
* @param {?} event
|
|
4225
4431
|
* @return {?}
|
|
4226
4432
|
*/
|
|
@@ -4238,37 +4444,38 @@
|
|
|
4238
4444
|
* @return {?}
|
|
4239
4445
|
*/
|
|
4240
4446
|
function (locationTriggerUrl) {
|
|
4241
|
-
|
|
4242
|
-
// has completed.
|
|
4447
|
+
pectin.Logger.get(this).info("back button pressed during navigation session interaction promise");
|
|
4448
|
+
// detach the interaction from the session so it doesn't get disposed until the activity has completed.
|
|
4243
4449
|
/** @type {?} */
|
|
4244
|
-
var
|
|
4245
|
-
var when = pectin.Dsl.disposeWith(
|
|
4450
|
+
var navigationInteraction = this.detachInteractionContext();
|
|
4451
|
+
var when = pectin.Dsl.disposeWith(navigationInteraction).when;
|
|
4246
4452
|
// TODO: I need to make the exclusive interaction context disallow nested activities or
|
|
4247
|
-
// that would mess things up entirely.
|
|
4248
|
-
|
|
4249
|
-
* @param {?} activity
|
|
4453
|
+
// that would mess things up entirely. Or, can I do a context.abortAll().then(..)
|
|
4454
|
+
navigationInteraction.cancelCurrentActivity().then((/**
|
|
4250
4455
|
* @return {?}
|
|
4251
4456
|
*/
|
|
4252
|
-
function (
|
|
4253
|
-
|
|
4254
|
-
* @return {?}
|
|
4255
|
-
*/
|
|
4256
|
-
function () { return context.dispose(); }), { once: true });
|
|
4257
|
-
activity.cancel(null);
|
|
4457
|
+
function () {
|
|
4458
|
+
navigationInteraction.dispose();
|
|
4258
4459
|
}));
|
|
4259
|
-
return new CancelledDuringNavigationInteraction(this.context, this.startingUrl, locationTriggerUrl);
|
|
4460
|
+
return new CancelledDuringNavigationInteraction(this.context, this.startingUrl, this.isPopState, locationTriggerUrl);
|
|
4260
4461
|
};
|
|
4462
|
+
// @Trace()
|
|
4463
|
+
// @Trace()
|
|
4261
4464
|
/**
|
|
4262
4465
|
* @param {?} component
|
|
4263
|
-
* @param {?}
|
|
4466
|
+
* @param {?} currentUrl
|
|
4467
|
+
* @param {?} nextUrl
|
|
4264
4468
|
* @return {?}
|
|
4265
4469
|
*/
|
|
4266
|
-
AbstractNavigationTransition.prototype.canDeactivatePlace =
|
|
4470
|
+
AbstractNavigationTransition.prototype.canDeactivatePlace =
|
|
4471
|
+
// @Trace()
|
|
4472
|
+
/**
|
|
4267
4473
|
* @param {?} component
|
|
4268
|
-
* @param {?}
|
|
4474
|
+
* @param {?} currentUrl
|
|
4475
|
+
* @param {?} nextUrl
|
|
4269
4476
|
* @return {?}
|
|
4270
4477
|
*/
|
|
4271
|
-
function (component,
|
|
4478
|
+
function (component, currentUrl, nextUrl) {
|
|
4272
4479
|
return __awaiter(this, void 0, void 0, function () {
|
|
4273
4480
|
var handler, isPrimaryHandler;
|
|
4274
4481
|
return __generator(this, function (_a) {
|
|
@@ -4276,10 +4483,10 @@
|
|
|
4276
4483
|
handler = this.componentDeactivationHandlers.get(component);
|
|
4277
4484
|
if (!handler) {
|
|
4278
4485
|
isPrimaryHandler = this.componentDeactivationHandlers.size === 0;
|
|
4279
|
-
handler = new PlaceComponentDeactivationHandler(component, this);
|
|
4486
|
+
handler = new PlaceComponentDeactivationHandler(component, this, isPrimaryHandler);
|
|
4280
4487
|
this.componentDeactivationHandlers.set(component, handler);
|
|
4281
4488
|
}
|
|
4282
|
-
return [2 /*return*/, handler.canDeactivate(
|
|
4489
|
+
return [2 /*return*/, handler.canDeactivate(currentUrl, nextUrl)];
|
|
4283
4490
|
});
|
|
4284
4491
|
});
|
|
4285
4492
|
};
|
|
@@ -4314,8 +4521,6 @@
|
|
|
4314
4521
|
*/
|
|
4315
4522
|
AbstractNavigationTransition.prototype._interactionContext;
|
|
4316
4523
|
/** @type {?} */
|
|
4317
|
-
AbstractNavigationTransition.prototype.isPopState;
|
|
4318
|
-
/** @type {?} */
|
|
4319
4524
|
AbstractNavigationTransition.prototype.startingUrl;
|
|
4320
4525
|
}
|
|
4321
4526
|
var NavigationTransition = /** @class */ (function (_super) {
|
|
@@ -4329,44 +4534,18 @@
|
|
|
4329
4534
|
* @param {?} event
|
|
4330
4535
|
* @return {?}
|
|
4331
4536
|
*/
|
|
4332
|
-
NavigationTransition.prototype.
|
|
4537
|
+
NavigationTransition.prototype.onRouterCancelled = /**
|
|
4333
4538
|
* @param {?} event
|
|
4334
4539
|
* @return {?}
|
|
4335
4540
|
*/
|
|
4336
4541
|
function (event) {
|
|
4337
|
-
// active sessions can have many cancel start cycles due
|
|
4338
|
-
// to place guard redirects
|
|
4339
4542
|
return this;
|
|
4340
4543
|
};
|
|
4341
4544
|
/**
|
|
4342
4545
|
* @param {?} event
|
|
4343
4546
|
* @return {?}
|
|
4344
4547
|
*/
|
|
4345
|
-
NavigationTransition.prototype.
|
|
4346
|
-
* @param {?} event
|
|
4347
|
-
* @return {?}
|
|
4348
|
-
*/
|
|
4349
|
-
function (event) {
|
|
4350
|
-
// navigation succeeded
|
|
4351
|
-
this.context.notifySuccess(this);
|
|
4352
|
-
return new Idle(this.context);
|
|
4353
|
-
};
|
|
4354
|
-
/**
|
|
4355
|
-
* @param {?} event
|
|
4356
|
-
* @return {?}
|
|
4357
|
-
*/
|
|
4358
|
-
NavigationTransition.prototype.onCancel = /**
|
|
4359
|
-
* @param {?} event
|
|
4360
|
-
* @return {?}
|
|
4361
|
-
*/
|
|
4362
|
-
function (event) {
|
|
4363
|
-
return new Idle(this.context);
|
|
4364
|
-
};
|
|
4365
|
-
/**
|
|
4366
|
-
* @param {?} event
|
|
4367
|
-
* @return {?}
|
|
4368
|
-
*/
|
|
4369
|
-
NavigationTransition.prototype.onError = /**
|
|
4548
|
+
NavigationTransition.prototype.onRouterError = /**
|
|
4370
4549
|
* @param {?} event
|
|
4371
4550
|
* @return {?}
|
|
4372
4551
|
*/
|
|
@@ -4390,9 +4569,9 @@
|
|
|
4390
4569
|
/** @type {?} */
|
|
4391
4570
|
NavigationTransition.prototype.isPopState;
|
|
4392
4571
|
}
|
|
4393
|
-
var
|
|
4394
|
-
__extends(
|
|
4395
|
-
function
|
|
4572
|
+
var PopStateTransition = /** @class */ (function (_super) {
|
|
4573
|
+
__extends(PopStateTransition, _super);
|
|
4574
|
+
function PopStateTransition() {
|
|
4396
4575
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
4397
4576
|
_this.isPopState = true;
|
|
4398
4577
|
return _this;
|
|
@@ -4401,7 +4580,7 @@
|
|
|
4401
4580
|
* @param {?} event
|
|
4402
4581
|
* @return {?}
|
|
4403
4582
|
*/
|
|
4404
|
-
|
|
4583
|
+
PopStateTransition.prototype.onRouterCancelled = /**
|
|
4405
4584
|
* @param {?} event
|
|
4406
4585
|
* @return {?}
|
|
4407
4586
|
*/
|
|
@@ -4416,7 +4595,7 @@
|
|
|
4416
4595
|
* @param {?} event
|
|
4417
4596
|
* @return {?}
|
|
4418
4597
|
*/
|
|
4419
|
-
|
|
4598
|
+
PopStateTransition.prototype.onRouterError = /**
|
|
4420
4599
|
* @param {?} event
|
|
4421
4600
|
* @return {?}
|
|
4422
4601
|
*/
|
|
@@ -4430,12 +4609,82 @@
|
|
|
4430
4609
|
}
|
|
4431
4610
|
return new Idle(this.context);
|
|
4432
4611
|
};
|
|
4433
|
-
return
|
|
4612
|
+
return PopStateTransition;
|
|
4434
4613
|
}(AbstractNavigationTransition));
|
|
4435
|
-
NavigationState.
|
|
4614
|
+
NavigationState.PopStateTransition = PopStateTransition;
|
|
4615
|
+
if (false) {
|
|
4616
|
+
/** @type {?} */
|
|
4617
|
+
PopStateTransition.prototype.isPopState;
|
|
4618
|
+
}
|
|
4619
|
+
var IdleDuringInteraction = /** @class */ (function (_super) {
|
|
4620
|
+
__extends(IdleDuringInteraction, _super);
|
|
4621
|
+
function IdleDuringInteraction(context, startingUrl) {
|
|
4622
|
+
var _this = _super.call(this, context) || this;
|
|
4623
|
+
_this.startingUrl = startingUrl;
|
|
4624
|
+
_this.isTransitional = false;
|
|
4625
|
+
_this.isPopState = false;
|
|
4626
|
+
return _this;
|
|
4627
|
+
}
|
|
4628
|
+
/**
|
|
4629
|
+
* @param {?} visit
|
|
4630
|
+
* @param {?} initialUrl
|
|
4631
|
+
* @return {?}
|
|
4632
|
+
*/
|
|
4633
|
+
IdleDuringInteraction.prototype.onPlaceNavigationStart = /**
|
|
4634
|
+
* @param {?} visit
|
|
4635
|
+
* @param {?} initialUrl
|
|
4636
|
+
* @return {?}
|
|
4637
|
+
*/
|
|
4638
|
+
function (visit, initialUrl) {
|
|
4639
|
+
/** @type {?} */
|
|
4640
|
+
var navigationTransition = new InteractionTransition(this.context, initialUrl);
|
|
4641
|
+
navigationTransition.storeVisit(visit);
|
|
4642
|
+
return navigationTransition;
|
|
4643
|
+
};
|
|
4644
|
+
/**
|
|
4645
|
+
* @param {?} event
|
|
4646
|
+
* @return {?}
|
|
4647
|
+
*/
|
|
4648
|
+
IdleDuringInteraction.prototype.onRouterStarted = /**
|
|
4649
|
+
* @param {?} event
|
|
4650
|
+
* @return {?}
|
|
4651
|
+
*/
|
|
4652
|
+
function (event) {
|
|
4653
|
+
return new InteractionTransition(this.context, event.url);
|
|
4654
|
+
};
|
|
4655
|
+
/**
|
|
4656
|
+
* @param {?} event
|
|
4657
|
+
* @return {?}
|
|
4658
|
+
*/
|
|
4659
|
+
IdleDuringInteraction.prototype.onPopState = /**
|
|
4660
|
+
* @param {?} event
|
|
4661
|
+
* @return {?}
|
|
4662
|
+
*/
|
|
4663
|
+
function (event) {
|
|
4664
|
+
return new InteractionPopStateTransition(this.context, event.url);
|
|
4665
|
+
};
|
|
4666
|
+
__decorate([
|
|
4667
|
+
pectin.Trace(),
|
|
4668
|
+
__metadata("design:type", Function),
|
|
4669
|
+
__metadata("design:paramtypes", [router.NavigationStart]),
|
|
4670
|
+
__metadata("design:returntype", NavigationState)
|
|
4671
|
+
], IdleDuringInteraction.prototype, "onRouterStarted", null);
|
|
4672
|
+
__decorate([
|
|
4673
|
+
pectin.Trace(),
|
|
4674
|
+
__metadata("design:type", Function),
|
|
4675
|
+
__metadata("design:paramtypes", [router.NavigationStart]),
|
|
4676
|
+
__metadata("design:returntype", NavigationState)
|
|
4677
|
+
], IdleDuringInteraction.prototype, "onPopState", null);
|
|
4678
|
+
return IdleDuringInteraction;
|
|
4679
|
+
}(NavigationState));
|
|
4680
|
+
NavigationState.IdleDuringInteraction = IdleDuringInteraction;
|
|
4436
4681
|
if (false) {
|
|
4437
4682
|
/** @type {?} */
|
|
4438
|
-
|
|
4683
|
+
IdleDuringInteraction.prototype.isTransitional;
|
|
4684
|
+
/** @type {?} */
|
|
4685
|
+
IdleDuringInteraction.prototype.isPopState;
|
|
4686
|
+
/** @type {?} */
|
|
4687
|
+
IdleDuringInteraction.prototype.startingUrl;
|
|
4439
4688
|
}
|
|
4440
4689
|
/**
|
|
4441
4690
|
* @abstract
|
|
@@ -4446,29 +4695,13 @@
|
|
|
4446
4695
|
AbstractInteractionTransition = /** @class */ (function (_super) {
|
|
4447
4696
|
__extends(AbstractInteractionTransition, _super);
|
|
4448
4697
|
function AbstractInteractionTransition(context, startingUrl) {
|
|
4449
|
-
var _this = _super.call(this, context) || this;
|
|
4698
|
+
var _this = _super.call(this, context, startingUrl) || this;
|
|
4450
4699
|
_this.startingUrl = startingUrl;
|
|
4451
4700
|
_this.isTransitional = true;
|
|
4452
4701
|
return _this;
|
|
4453
4702
|
}
|
|
4454
|
-
/**
|
|
4455
|
-
* @protected
|
|
4456
|
-
* @return {?}
|
|
4457
|
-
*/
|
|
4458
|
-
AbstractInteractionTransition.prototype.reinstateInteractionRoute = /**
|
|
4459
|
-
* @protected
|
|
4460
|
-
* @return {?}
|
|
4461
|
-
*/
|
|
4462
|
-
function () {
|
|
4463
|
-
var _this = this;
|
|
4464
|
-
console.log(this.startingUrl);
|
|
4465
|
-
setTimeout((/**
|
|
4466
|
-
* @return {?}
|
|
4467
|
-
*/
|
|
4468
|
-
function () { return _this.placeRouter.syncInteractionIdsWithRouter(); }));
|
|
4469
|
-
};
|
|
4470
4703
|
return AbstractInteractionTransition;
|
|
4471
|
-
}(
|
|
4704
|
+
}(AbstractNavigationTransition));
|
|
4472
4705
|
NavigationState.AbstractInteractionTransition = AbstractInteractionTransition;
|
|
4473
4706
|
if (false) {
|
|
4474
4707
|
/** @type {?} */
|
|
@@ -4495,115 +4728,122 @@
|
|
|
4495
4728
|
* @param {?} event
|
|
4496
4729
|
* @return {?}
|
|
4497
4730
|
*/
|
|
4498
|
-
InteractionTransition.prototype.
|
|
4731
|
+
InteractionTransition.prototype.onRouterCancelled = /**
|
|
4499
4732
|
* @param {?} event
|
|
4500
4733
|
* @return {?}
|
|
4501
4734
|
*/
|
|
4502
4735
|
function (event) {
|
|
4503
4736
|
if (this.context.interactionService.isActive()) {
|
|
4504
|
-
|
|
4737
|
+
/** @type {?} */
|
|
4738
|
+
var interactionIds = this.interactionService.activeInteractionContextIds.value;
|
|
4739
|
+
this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);
|
|
4505
4740
|
return new IdleDuringInteraction(this.context, this.startingUrl);
|
|
4506
4741
|
}
|
|
4507
4742
|
else {
|
|
4508
4743
|
return new Idle(this.context);
|
|
4509
4744
|
}
|
|
4510
4745
|
};
|
|
4511
|
-
return InteractionTransition;
|
|
4512
|
-
}(AbstractInteractionTransition));
|
|
4513
|
-
NavigationState.InteractionTransition = InteractionTransition;
|
|
4514
|
-
if (false) {
|
|
4515
|
-
/** @type {?} */
|
|
4516
|
-
InteractionTransition.prototype.isPopState;
|
|
4517
|
-
}
|
|
4518
|
-
/**
|
|
4519
|
-
* This state exists to handle all events while any kind of navigation is in progress. That way all other states can
|
|
4520
|
-
* happily ignore interaction contexts.
|
|
4521
|
-
*/
|
|
4522
|
-
var /**
|
|
4523
|
-
* This state exists to handle all events while any kind of navigation is in progress. That way all other states can
|
|
4524
|
-
* happily ignore interaction contexts.
|
|
4525
|
-
*/
|
|
4526
|
-
InteractionBackTransition = /** @class */ (function (_super) {
|
|
4527
|
-
__extends(InteractionBackTransition, _super);
|
|
4528
|
-
function InteractionBackTransition() {
|
|
4529
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
4530
|
-
_this.isPopState = true;
|
|
4531
|
-
return _this;
|
|
4532
|
-
}
|
|
4533
4746
|
/**
|
|
4534
4747
|
* @param {?} event
|
|
4535
4748
|
* @return {?}
|
|
4536
4749
|
*/
|
|
4537
|
-
|
|
4750
|
+
InteractionTransition.prototype.onRouterError = /**
|
|
4538
4751
|
* @param {?} event
|
|
4539
4752
|
* @return {?}
|
|
4540
4753
|
*/
|
|
4541
4754
|
function (event) {
|
|
4542
|
-
|
|
4543
|
-
|
|
4755
|
+
// navigation was aborted.
|
|
4756
|
+
return new IdleDuringInteraction(this.context, this.startingUrl);
|
|
4757
|
+
};
|
|
4758
|
+
/**
|
|
4759
|
+
* @param {?} event
|
|
4760
|
+
* @return {?}
|
|
4761
|
+
*/
|
|
4762
|
+
InteractionTransition.prototype.onRouterEnd = /**
|
|
4763
|
+
* @param {?} event
|
|
4764
|
+
* @return {?}
|
|
4765
|
+
*/
|
|
4766
|
+
function (event) {
|
|
4767
|
+
if (this.context.interactionService.isActive()) {
|
|
4544
4768
|
return new IdleDuringInteraction(this.context, this.startingUrl);
|
|
4545
4769
|
}
|
|
4546
4770
|
else {
|
|
4547
4771
|
return new Idle(this.context);
|
|
4548
4772
|
}
|
|
4549
4773
|
};
|
|
4550
|
-
return
|
|
4774
|
+
return InteractionTransition;
|
|
4551
4775
|
}(AbstractInteractionTransition));
|
|
4552
|
-
NavigationState.
|
|
4776
|
+
NavigationState.InteractionTransition = InteractionTransition;
|
|
4553
4777
|
if (false) {
|
|
4554
4778
|
/** @type {?} */
|
|
4555
|
-
|
|
4779
|
+
InteractionTransition.prototype.isPopState;
|
|
4556
4780
|
}
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4781
|
+
/**
|
|
4782
|
+
* This state exists to handle all events while any kind of navigation is in progress. That way all other states can
|
|
4783
|
+
* happily ignore interaction contexts.
|
|
4784
|
+
*/
|
|
4785
|
+
var /**
|
|
4786
|
+
* This state exists to handle all events while any kind of navigation is in progress. That way all other states can
|
|
4787
|
+
* happily ignore interaction contexts.
|
|
4788
|
+
*/
|
|
4789
|
+
InteractionPopStateTransition = /** @class */ (function (_super) {
|
|
4790
|
+
__extends(InteractionPopStateTransition, _super);
|
|
4791
|
+
function InteractionPopStateTransition() {
|
|
4792
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
4793
|
+
_this.isPopState = true;
|
|
4564
4794
|
return _this;
|
|
4565
4795
|
}
|
|
4566
4796
|
/**
|
|
4567
4797
|
* @param {?} event
|
|
4568
4798
|
* @return {?}
|
|
4569
4799
|
*/
|
|
4570
|
-
|
|
4800
|
+
InteractionPopStateTransition.prototype.onRouterCancelled = /**
|
|
4571
4801
|
* @param {?} event
|
|
4572
4802
|
* @return {?}
|
|
4573
4803
|
*/
|
|
4574
4804
|
function (event) {
|
|
4575
|
-
|
|
4805
|
+
if (this.interactionService.isActive()) {
|
|
4806
|
+
/** @type {?} */
|
|
4807
|
+
var interactionIds = this.interactionService.activeInteractionContextIds.value;
|
|
4808
|
+
this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);
|
|
4809
|
+
return new IdleDuringInteraction(this.context, this.startingUrl);
|
|
4810
|
+
}
|
|
4811
|
+
else {
|
|
4812
|
+
return new Idle(this.context);
|
|
4813
|
+
}
|
|
4576
4814
|
};
|
|
4577
4815
|
/**
|
|
4578
4816
|
* @param {?} event
|
|
4579
4817
|
* @return {?}
|
|
4580
4818
|
*/
|
|
4581
|
-
|
|
4819
|
+
InteractionPopStateTransition.prototype.onRouterEnd = /**
|
|
4582
4820
|
* @param {?} event
|
|
4583
4821
|
* @return {?}
|
|
4584
4822
|
*/
|
|
4585
4823
|
function (event) {
|
|
4586
|
-
|
|
4824
|
+
if (this.context.interactionService.isActive()) {
|
|
4825
|
+
return new IdleDuringInteraction(this.context, this.startingUrl);
|
|
4826
|
+
}
|
|
4827
|
+
else {
|
|
4828
|
+
return new Idle(this.context);
|
|
4829
|
+
}
|
|
4587
4830
|
};
|
|
4588
|
-
return
|
|
4589
|
-
}(
|
|
4590
|
-
NavigationState.
|
|
4831
|
+
return InteractionPopStateTransition;
|
|
4832
|
+
}(AbstractInteractionTransition));
|
|
4833
|
+
NavigationState.InteractionPopStateTransition = InteractionPopStateTransition;
|
|
4591
4834
|
if (false) {
|
|
4592
4835
|
/** @type {?} */
|
|
4593
|
-
|
|
4594
|
-
/** @type {?} */
|
|
4595
|
-
IdleDuringInteraction.prototype.isPopState;
|
|
4596
|
-
/** @type {?} */
|
|
4597
|
-
IdleDuringInteraction.prototype.startingUrl;
|
|
4836
|
+
InteractionPopStateTransition.prototype.isPopState;
|
|
4598
4837
|
}
|
|
4599
4838
|
var CancelledDuringNavigationInteraction = /** @class */ (function (_super) {
|
|
4600
4839
|
__extends(CancelledDuringNavigationInteraction, _super);
|
|
4601
|
-
function CancelledDuringNavigationInteraction(context, startingUrl, locationChangeTriggerUrl) {
|
|
4840
|
+
function CancelledDuringNavigationInteraction(context, startingUrl, startingEventWasAPopState, locationChangeTriggerUrl) {
|
|
4602
4841
|
var _this = _super.call(this, context) || this;
|
|
4603
4842
|
_this.startingUrl = startingUrl;
|
|
4843
|
+
_this.startingEventWasAPopState = startingEventWasAPopState;
|
|
4604
4844
|
_this.locationChangeTriggerUrl = locationChangeTriggerUrl;
|
|
4605
4845
|
_this.isPopState = false;
|
|
4606
|
-
_this.
|
|
4846
|
+
_this.gotPopStateWithLeavingUrl = false;
|
|
4607
4847
|
return _this;
|
|
4608
4848
|
}
|
|
4609
4849
|
Object.defineProperty(CancelledDuringNavigationInteraction.prototype, "isTransitional", {
|
|
@@ -4611,7 +4851,7 @@
|
|
|
4611
4851
|
* @return {?}
|
|
4612
4852
|
*/
|
|
4613
4853
|
function () {
|
|
4614
|
-
return
|
|
4854
|
+
return true;
|
|
4615
4855
|
},
|
|
4616
4856
|
enumerable: true,
|
|
4617
4857
|
configurable: true
|
|
@@ -4620,35 +4860,34 @@
|
|
|
4620
4860
|
* @param {?} event
|
|
4621
4861
|
* @return {?}
|
|
4622
4862
|
*/
|
|
4623
|
-
CancelledDuringNavigationInteraction.prototype.
|
|
4863
|
+
CancelledDuringNavigationInteraction.prototype.onRouterStarted = /**
|
|
4624
4864
|
* @param {?} event
|
|
4625
4865
|
* @return {?}
|
|
4626
4866
|
*/
|
|
4627
4867
|
function (event) {
|
|
4628
|
-
|
|
4629
|
-
this.capturedFauxRouterStart = true;
|
|
4630
|
-
return this.ignore(event, 'url matched back button location change');
|
|
4631
|
-
}
|
|
4632
|
-
else {
|
|
4633
|
-
return this.createTransitionStateFor(event);
|
|
4634
|
-
}
|
|
4868
|
+
return this.ignore(event);
|
|
4635
4869
|
};
|
|
4636
4870
|
/**
|
|
4637
4871
|
* @param {?} event
|
|
4638
4872
|
* @return {?}
|
|
4639
4873
|
*/
|
|
4640
|
-
CancelledDuringNavigationInteraction.prototype.
|
|
4874
|
+
CancelledDuringNavigationInteraction.prototype.onRouterCancelled = /**
|
|
4641
4875
|
* @param {?} event
|
|
4642
4876
|
* @return {?}
|
|
4643
4877
|
*/
|
|
4644
4878
|
function (event) {
|
|
4645
|
-
|
|
4879
|
+
// Depending on the state of the router and what was done we get a different
|
|
4880
|
+
// sequence of events. I.e. If they just clicked a link we'll get a cancel
|
|
4881
|
+
// with the locationChangeTriggerUrl as the final event. However the user
|
|
4882
|
+
// started the initial navigation with a pop state then we'll get one of
|
|
4883
|
+
// those with the locationChangeTriggerUrl but no cancel event with it.
|
|
4884
|
+
return this.gotPopStateWithLeavingUrl || this.locationChangeTriggerUrl === event.url ? this.createIdleState() : this.ignore(event);
|
|
4646
4885
|
};
|
|
4647
4886
|
/**
|
|
4648
4887
|
* @param {?} event
|
|
4649
4888
|
* @return {?}
|
|
4650
4889
|
*/
|
|
4651
|
-
CancelledDuringNavigationInteraction.prototype.
|
|
4890
|
+
CancelledDuringNavigationInteraction.prototype.onRouterEnd = /**
|
|
4652
4891
|
* @param {?} event
|
|
4653
4892
|
* @return {?}
|
|
4654
4893
|
*/
|
|
@@ -4659,7 +4898,7 @@
|
|
|
4659
4898
|
* @param {?} event
|
|
4660
4899
|
* @return {?}
|
|
4661
4900
|
*/
|
|
4662
|
-
CancelledDuringNavigationInteraction.prototype.
|
|
4901
|
+
CancelledDuringNavigationInteraction.prototype.onRouterError = /**
|
|
4663
4902
|
* @param {?} event
|
|
4664
4903
|
* @return {?}
|
|
4665
4904
|
*/
|
|
@@ -4675,7 +4914,31 @@
|
|
|
4675
4914
|
* @return {?}
|
|
4676
4915
|
*/
|
|
4677
4916
|
function (event) {
|
|
4678
|
-
|
|
4917
|
+
this.gotPopStateWithLeavingUrl = this.gotPopStateWithLeavingUrl || event.url === this.locationChangeTriggerUrl;
|
|
4918
|
+
return this.ignore(event);
|
|
4919
|
+
};
|
|
4920
|
+
// @Trace()
|
|
4921
|
+
// @Trace()
|
|
4922
|
+
/**
|
|
4923
|
+
* @param {?} component
|
|
4924
|
+
* @param {?} currentUrl
|
|
4925
|
+
* @param {?} nextUrl
|
|
4926
|
+
* @return {?}
|
|
4927
|
+
*/
|
|
4928
|
+
CancelledDuringNavigationInteraction.prototype.canDeactivatePlace =
|
|
4929
|
+
// @Trace()
|
|
4930
|
+
/**
|
|
4931
|
+
* @param {?} component
|
|
4932
|
+
* @param {?} currentUrl
|
|
4933
|
+
* @param {?} nextUrl
|
|
4934
|
+
* @return {?}
|
|
4935
|
+
*/
|
|
4936
|
+
function (component, currentUrl, nextUrl) {
|
|
4937
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4938
|
+
return __generator(this, function (_a) {
|
|
4939
|
+
return [2 /*return*/, false];
|
|
4940
|
+
});
|
|
4941
|
+
});
|
|
4679
4942
|
};
|
|
4680
4943
|
/**
|
|
4681
4944
|
* @param {?} event
|
|
@@ -4688,7 +4951,7 @@
|
|
|
4688
4951
|
* @return {?}
|
|
4689
4952
|
*/
|
|
4690
4953
|
function (event, reason) {
|
|
4691
|
-
reason = reason ? "
|
|
4954
|
+
reason = reason ? " -> " + reason : '';
|
|
4692
4955
|
pectin.Logger.get(this).info("ignoring router event" + reason + ": " + event.constructor.name + " -> " + event.url);
|
|
4693
4956
|
return this;
|
|
4694
4957
|
};
|
|
@@ -4699,8 +4962,14 @@
|
|
|
4699
4962
|
* @return {?}
|
|
4700
4963
|
*/
|
|
4701
4964
|
function () {
|
|
4702
|
-
return this.constructor.name + "(startingUrl: " + this.startingUrl + ", locationChangeTriggerUrl:" + this.locationChangeTriggerUrl + ")";
|
|
4965
|
+
return this.constructor.name + "(isIdl: " + this.idle + ", startingUrl: " + this.startingUrl + ", locationChangeTriggerUrl:" + this.locationChangeTriggerUrl + ")";
|
|
4703
4966
|
};
|
|
4967
|
+
__decorate([
|
|
4968
|
+
pectin.Trace(),
|
|
4969
|
+
__metadata("design:type", Function),
|
|
4970
|
+
__metadata("design:paramtypes", [router.NavigationCancel]),
|
|
4971
|
+
__metadata("design:returntype", NavigationState)
|
|
4972
|
+
], CancelledDuringNavigationInteraction.prototype, "onRouterCancelled", null);
|
|
4704
4973
|
return CancelledDuringNavigationInteraction;
|
|
4705
4974
|
}(NavigationState));
|
|
4706
4975
|
NavigationState.CancelledDuringNavigationInteraction = CancelledDuringNavigationInteraction;
|
|
@@ -4711,10 +4980,12 @@
|
|
|
4711
4980
|
* @type {?}
|
|
4712
4981
|
* @private
|
|
4713
4982
|
*/
|
|
4714
|
-
CancelledDuringNavigationInteraction.prototype.
|
|
4983
|
+
CancelledDuringNavigationInteraction.prototype.gotPopStateWithLeavingUrl;
|
|
4715
4984
|
/** @type {?} */
|
|
4716
4985
|
CancelledDuringNavigationInteraction.prototype.startingUrl;
|
|
4717
4986
|
/** @type {?} */
|
|
4987
|
+
CancelledDuringNavigationInteraction.prototype.startingEventWasAPopState;
|
|
4988
|
+
/** @type {?} */
|
|
4718
4989
|
CancelledDuringNavigationInteraction.prototype.locationChangeTriggerUrl;
|
|
4719
4990
|
}
|
|
4720
4991
|
})(exports.NavigationState || (exports.NavigationState = {}));
|
|
@@ -4805,25 +5076,26 @@
|
|
|
4805
5076
|
*/
|
|
4806
5077
|
exports.UrlSnapshot = /** @class */ (function () {
|
|
4807
5078
|
// TODO: Update this accept a url Parser so it can be immutable and generate new trees on mutation using toString() are parseUrl.
|
|
4808
|
-
function UrlSnapshot(urlSerializer, url) {
|
|
5079
|
+
function UrlSnapshot(urlSerializer, url, options) {
|
|
4809
5080
|
this.urlSerializer = urlSerializer;
|
|
4810
5081
|
this.url = url;
|
|
5082
|
+
this.options = options;
|
|
4811
5083
|
this.urlTree = urlSerializer.parse(url);
|
|
4812
5084
|
}
|
|
4813
5085
|
/**
|
|
4814
|
-
* @protected
|
|
4815
5086
|
* @param {?} visit
|
|
4816
5087
|
* @return {?}
|
|
4817
5088
|
*/
|
|
4818
|
-
UrlSnapshot.prototype.
|
|
4819
|
-
* @protected
|
|
5089
|
+
UrlSnapshot.prototype.updateVisitSegments = /**
|
|
4820
5090
|
* @param {?} visit
|
|
4821
5091
|
* @return {?}
|
|
4822
5092
|
*/
|
|
4823
5093
|
function (visit) {
|
|
5094
|
+
/** @type {?} */
|
|
5095
|
+
var urlTree = this.urlSerializer.parse(this.url);
|
|
4824
5096
|
// Ugly, but it works for now.
|
|
4825
5097
|
/** @type {?} */
|
|
4826
|
-
var segments = __spread(this.getPrimarySegments());
|
|
5098
|
+
var segments = __spread(this.getPrimarySegments(urlTree));
|
|
4827
5099
|
/** @type {?} */
|
|
4828
5100
|
var visitSegments = this.getSegmentsFor(visit);
|
|
4829
5101
|
/** @type {?} */
|
|
@@ -4834,17 +5106,20 @@
|
|
|
4834
5106
|
function (segment) { return segment.path === visitSegments[0].path; }));
|
|
4835
5107
|
// do not use the return value, it's the items that were removed!
|
|
4836
5108
|
segments.splice.apply(segments, __spread([replaceAt, visitSegments.length], visitSegments));
|
|
4837
|
-
|
|
5109
|
+
urlTree.root.children.primary.segments = segments;
|
|
5110
|
+
return new UrlSnapshot(this.urlSerializer, urlTree.toString(), this.options);
|
|
4838
5111
|
};
|
|
4839
5112
|
/**
|
|
4840
5113
|
* @private
|
|
5114
|
+
* @param {?} urlTree
|
|
4841
5115
|
* @return {?}
|
|
4842
5116
|
*/
|
|
4843
5117
|
UrlSnapshot.prototype.getPrimarySegments = /**
|
|
4844
5118
|
* @private
|
|
5119
|
+
* @param {?} urlTree
|
|
4845
5120
|
* @return {?}
|
|
4846
5121
|
*/
|
|
4847
|
-
function () {
|
|
5122
|
+
function (urlTree) {
|
|
4848
5123
|
return this.urlTree.root.children.primary.segments;
|
|
4849
5124
|
};
|
|
4850
5125
|
/**
|
|
@@ -4877,31 +5152,6 @@
|
|
|
4877
5152
|
new router.UrlSegment(visit.placeDefinition.path, visit.placeDefinition.getFormattedRouteParameters(visit))
|
|
4878
5153
|
];
|
|
4879
5154
|
};
|
|
4880
|
-
/**
|
|
4881
|
-
* @param {?} visit
|
|
4882
|
-
* @return {?}
|
|
4883
|
-
*/
|
|
4884
|
-
UrlSnapshot.prototype.createRedirectCommandsFor = /**
|
|
4885
|
-
* @param {?} visit
|
|
4886
|
-
* @return {?}
|
|
4887
|
-
*/
|
|
4888
|
-
function (visit) {
|
|
4889
|
-
/** @type {?} */
|
|
4890
|
-
var segments = this.replaceExistingVisitSegmentsWith(visit);
|
|
4891
|
-
/** @type {?} */
|
|
4892
|
-
var commands = [];
|
|
4893
|
-
segments.forEach((/**
|
|
4894
|
-
* @param {?} s
|
|
4895
|
-
* @return {?}
|
|
4896
|
-
*/
|
|
4897
|
-
function (s) {
|
|
4898
|
-
commands.push(s.path);
|
|
4899
|
-
if (s.parameterMap.keys.length > 0) {
|
|
4900
|
-
commands.push(s.parameters);
|
|
4901
|
-
}
|
|
4902
|
-
}));
|
|
4903
|
-
return commands;
|
|
4904
|
-
};
|
|
4905
5155
|
/**
|
|
4906
5156
|
* @param {?} placeDef
|
|
4907
5157
|
* @return {?}
|
|
@@ -4911,7 +5161,7 @@
|
|
|
4911
5161
|
* @return {?}
|
|
4912
5162
|
*/
|
|
4913
5163
|
function (placeDef) {
|
|
4914
|
-
return this.getPrimarySegments().find((/**
|
|
5164
|
+
return this.getPrimarySegments(this.urlTree).find((/**
|
|
4915
5165
|
* @param {?} s
|
|
4916
5166
|
* @return {?}
|
|
4917
5167
|
*/
|
|
@@ -4925,53 +5175,101 @@
|
|
|
4925
5175
|
*/
|
|
4926
5176
|
function () {
|
|
4927
5177
|
/** @type {?} */
|
|
4928
|
-
var
|
|
4929
|
-
if (
|
|
4930
|
-
|
|
4931
|
-
pectin.assert.isTruthy(interactionOutlet.segments[0].path === UrlSnapshot.INTERACTION_ROUTER_PATH);
|
|
4932
|
-
return UrlSnapshot.parseInteractionIds(interactionOutlet.segments[1].path);
|
|
5178
|
+
var queryParam = this.urlTree.queryParams[UrlSnapshot.INTERACTION_QUERY_PARAM];
|
|
5179
|
+
if (queryParam) {
|
|
5180
|
+
return UrlSnapshot.parseInteractionIds(queryParam);
|
|
4933
5181
|
}
|
|
4934
5182
|
else {
|
|
4935
5183
|
return [];
|
|
4936
5184
|
}
|
|
4937
5185
|
};
|
|
5186
|
+
/**
|
|
5187
|
+
* @return {?}
|
|
5188
|
+
*/
|
|
5189
|
+
UrlSnapshot.prototype.hasInteractionIds = /**
|
|
5190
|
+
* @return {?}
|
|
5191
|
+
*/
|
|
5192
|
+
function () {
|
|
5193
|
+
return this.getInteractionIds().length > 0;
|
|
5194
|
+
};
|
|
4938
5195
|
// @Trace()
|
|
4939
5196
|
// @Trace()
|
|
4940
5197
|
/**
|
|
4941
5198
|
* @param {?} ids
|
|
4942
5199
|
* @return {?}
|
|
4943
5200
|
*/
|
|
4944
|
-
UrlSnapshot.prototype.
|
|
5201
|
+
UrlSnapshot.prototype.updateInteractionIds =
|
|
4945
5202
|
// @Trace()
|
|
4946
5203
|
/**
|
|
4947
5204
|
* @param {?} ids
|
|
4948
5205
|
* @return {?}
|
|
4949
5206
|
*/
|
|
4950
5207
|
function (ids) {
|
|
5208
|
+
if (ids.length === 0) {
|
|
5209
|
+
return this.removeInteractionIds();
|
|
5210
|
+
}
|
|
5211
|
+
else {
|
|
5212
|
+
/** @type {?} */
|
|
5213
|
+
var urlTree = this.urlSerializer.parse(this.url);
|
|
5214
|
+
urlTree.queryParams[UrlSnapshot.INTERACTION_QUERY_PARAM] = UrlSnapshot.createPathIdFor(ids);
|
|
5215
|
+
return new UrlSnapshot(this.urlSerializer, urlTree.toString(), this.options);
|
|
5216
|
+
}
|
|
5217
|
+
};
|
|
5218
|
+
// @Trace()
|
|
5219
|
+
// @Trace()
|
|
5220
|
+
/**
|
|
5221
|
+
* @return {?}
|
|
5222
|
+
*/
|
|
5223
|
+
UrlSnapshot.prototype.removeInteractionIds =
|
|
5224
|
+
// @Trace()
|
|
5225
|
+
/**
|
|
5226
|
+
* @return {?}
|
|
5227
|
+
*/
|
|
5228
|
+
function () {
|
|
4951
5229
|
/** @type {?} */
|
|
4952
5230
|
var urlTree = this.urlSerializer.parse(this.url);
|
|
4953
|
-
urlTree.
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
5231
|
+
if (urlTree.queryParams && urlTree.queryParams[UrlSnapshot.INTERACTION_QUERY_PARAM]) {
|
|
5232
|
+
urlTree.queryParams = {}; //[UrlSnapshot.INTERACTION_ROUTER_OUTLET]
|
|
5233
|
+
}
|
|
5234
|
+
return new UrlSnapshot(this.urlSerializer, urlTree.toString(), this.options);
|
|
5235
|
+
};
|
|
5236
|
+
/**
|
|
5237
|
+
* @param {?} options
|
|
5238
|
+
* @return {?}
|
|
5239
|
+
*/
|
|
5240
|
+
UrlSnapshot.prototype.withOptions = /**
|
|
5241
|
+
* @param {?} options
|
|
5242
|
+
* @return {?}
|
|
5243
|
+
*/
|
|
5244
|
+
function (options) {
|
|
5245
|
+
return new UrlSnapshot(this.urlSerializer, this.url, options);
|
|
5246
|
+
};
|
|
5247
|
+
/**
|
|
5248
|
+
* @return {?}
|
|
5249
|
+
*/
|
|
5250
|
+
UrlSnapshot.prototype.getNavigationExtras = /**
|
|
5251
|
+
* @return {?}
|
|
5252
|
+
*/
|
|
5253
|
+
function () {
|
|
5254
|
+
return this.options;
|
|
4958
5255
|
};
|
|
4959
5256
|
return UrlSnapshot;
|
|
4960
5257
|
}());
|
|
4961
5258
|
if (false) {
|
|
4962
|
-
/**
|
|
4963
|
-
* @type {?}
|
|
4964
|
-
* @private
|
|
4965
|
-
*/
|
|
5259
|
+
/** @type {?} */
|
|
4966
5260
|
exports.UrlSnapshot.prototype.urlTree;
|
|
4967
5261
|
/** @type {?} */
|
|
4968
5262
|
exports.UrlSnapshot.prototype.urlSerializer;
|
|
4969
5263
|
/** @type {?} */
|
|
4970
5264
|
exports.UrlSnapshot.prototype.url;
|
|
5265
|
+
/**
|
|
5266
|
+
* @type {?}
|
|
5267
|
+
* @private
|
|
5268
|
+
*/
|
|
5269
|
+
exports.UrlSnapshot.prototype.options;
|
|
4971
5270
|
}
|
|
4972
5271
|
(function (UrlSnapshot) {
|
|
4973
|
-
UrlSnapshot.
|
|
4974
|
-
UrlSnapshot.INTERACTION_ROUTER_PATH = 'active';
|
|
5272
|
+
UrlSnapshot.INTERACTION_QUERY_PARAM = 'aup-interactions';
|
|
4975
5273
|
UrlSnapshot.INTERACTION_ID_SEPARATOR = '--';
|
|
4976
5274
|
/**
|
|
4977
5275
|
* @param {?} path
|
|
@@ -4990,13 +5288,14 @@
|
|
|
4990
5288
|
}
|
|
4991
5289
|
UrlSnapshot.createPathIdFor = createPathIdFor;
|
|
4992
5290
|
/**
|
|
4993
|
-
* @
|
|
4994
|
-
* @return {?}
|
|
5291
|
+
* @record
|
|
4995
5292
|
*/
|
|
4996
|
-
function
|
|
4997
|
-
|
|
5293
|
+
function NavigationOptions() { }
|
|
5294
|
+
UrlSnapshot.NavigationOptions = NavigationOptions;
|
|
5295
|
+
if (false) {
|
|
5296
|
+
/** @type {?|undefined} */
|
|
5297
|
+
NavigationOptions.prototype.replaceUrl;
|
|
4998
5298
|
}
|
|
4999
|
-
UrlSnapshot.createInteractionOutletRouterCommands = createInteractionOutletRouterCommands;
|
|
5000
5299
|
})(exports.UrlSnapshot || (exports.UrlSnapshot = {}));
|
|
5001
5300
|
|
|
5002
5301
|
/**
|
|
@@ -5043,7 +5342,6 @@
|
|
|
5043
5342
|
// NavigationStart -> .... -> NavigationError --> navigation aborted, end session.
|
|
5044
5343
|
// =======================
|
|
5045
5344
|
if (event instanceof router.NavigationStart) {
|
|
5046
|
-
console.log(event);
|
|
5047
5345
|
if (event.navigationTrigger === 'popstate') {
|
|
5048
5346
|
_this.runStateTransition((/**
|
|
5049
5347
|
* @param {?} state
|
|
@@ -5056,7 +5354,7 @@
|
|
|
5056
5354
|
* @param {?} state
|
|
5057
5355
|
* @return {?}
|
|
5058
5356
|
*/
|
|
5059
|
-
function (state) { return state.
|
|
5357
|
+
function (state) { return state.onRouterStarted(event); }));
|
|
5060
5358
|
}
|
|
5061
5359
|
}
|
|
5062
5360
|
if (event instanceof router.NavigationEnd) {
|
|
@@ -5065,7 +5363,7 @@
|
|
|
5065
5363
|
* @param {?} state
|
|
5066
5364
|
* @return {?}
|
|
5067
5365
|
*/
|
|
5068
|
-
function (state) { return state.
|
|
5366
|
+
function (state) { return state.onRouterEnd(event); }));
|
|
5069
5367
|
}
|
|
5070
5368
|
if (event instanceof router.NavigationError) {
|
|
5071
5369
|
console.log(event);
|
|
@@ -5073,7 +5371,7 @@
|
|
|
5073
5371
|
* @param {?} state
|
|
5074
5372
|
* @return {?}
|
|
5075
5373
|
*/
|
|
5076
|
-
function (state) { return state.
|
|
5374
|
+
function (state) { return state.onRouterError(event); }));
|
|
5077
5375
|
}
|
|
5078
5376
|
if (event instanceof router.NavigationCancel) {
|
|
5079
5377
|
console.log(event);
|
|
@@ -5081,7 +5379,7 @@
|
|
|
5081
5379
|
* @param {?} state
|
|
5082
5380
|
* @return {?}
|
|
5083
5381
|
*/
|
|
5084
|
-
function (state) { return state.
|
|
5382
|
+
function (state) { return state.onRouterCancelled(event); }));
|
|
5085
5383
|
}
|
|
5086
5384
|
}));
|
|
5087
5385
|
// Push dialog state to the url so we can capture the back button.
|
|
@@ -5110,12 +5408,11 @@
|
|
|
5110
5408
|
var navigationState = _this._navigationStateModel.value;
|
|
5111
5409
|
console.log("URLChange -> " + url, { state: navigationState });
|
|
5112
5410
|
urlChanges.publish({ url: url, state: navigationState });
|
|
5113
|
-
//
|
|
5114
|
-
if (navigationState
|
|
5411
|
+
// The url has changed while we're in a transitional state
|
|
5412
|
+
if (navigationState.isTransitional) {
|
|
5115
5413
|
/** @type {?} */
|
|
5116
5414
|
var navigationInteraction = _this.navigationState.interactionContext;
|
|
5117
5415
|
if (navigationInteraction && navigationInteraction.isActive()) {
|
|
5118
|
-
pectin.Logger.get(_this).info("back button pressed during navigation session interaction promise");
|
|
5119
5416
|
_this.runStateTransition((/**
|
|
5120
5417
|
* @param {?} state
|
|
5121
5418
|
* @return {?}
|
|
@@ -5256,9 +5553,9 @@
|
|
|
5256
5553
|
*/
|
|
5257
5554
|
function (router) {
|
|
5258
5555
|
/** @type {?} */
|
|
5259
|
-
var
|
|
5260
|
-
console.log('### Push Changes to route Redirect', { commands:
|
|
5261
|
-
return
|
|
5556
|
+
var urlSnapshot = _this.parseUrl(_this.router.routerState.snapshot.url).updateVisitSegments(next);
|
|
5557
|
+
console.log('### Push Changes to route Redirect', { commands: urlSnapshot.url });
|
|
5558
|
+
return _this.navigateByUrl(urlSnapshot);
|
|
5262
5559
|
}))];
|
|
5263
5560
|
}
|
|
5264
5561
|
return [2 /*return*/];
|
|
@@ -5290,7 +5587,7 @@
|
|
|
5290
5587
|
*/
|
|
5291
5588
|
function (current) {
|
|
5292
5589
|
/** @type {?} */
|
|
5293
|
-
var session =
|
|
5590
|
+
var session = _this.navigationState.onPlaceNavigationStart(visit, _this.getCurrentRouterUrl());
|
|
5294
5591
|
session.storeVisit(visit);
|
|
5295
5592
|
return session;
|
|
5296
5593
|
}));
|
|
@@ -5309,7 +5606,7 @@
|
|
|
5309
5606
|
* @param {?} session
|
|
5310
5607
|
* @return {?}
|
|
5311
5608
|
*/
|
|
5312
|
-
function (session) { return session.
|
|
5609
|
+
function (session) { return session.onRouterEnd(new router.NavigationEnd(-1, '', '')); }));
|
|
5313
5610
|
}
|
|
5314
5611
|
return [7 /*endfinally*/];
|
|
5315
5612
|
case 4: return [2 /*return*/];
|
|
@@ -5317,12 +5614,16 @@
|
|
|
5317
5614
|
});
|
|
5318
5615
|
});
|
|
5319
5616
|
};
|
|
5617
|
+
// @Trace()
|
|
5618
|
+
// @Trace()
|
|
5320
5619
|
/**
|
|
5321
5620
|
* @protected
|
|
5322
5621
|
* @param {?} transition
|
|
5323
5622
|
* @return {?}
|
|
5324
5623
|
*/
|
|
5325
|
-
PlaceRouter.prototype.runStateTransition =
|
|
5624
|
+
PlaceRouter.prototype.runStateTransition =
|
|
5625
|
+
// @Trace()
|
|
5626
|
+
/**
|
|
5326
5627
|
* @protected
|
|
5327
5628
|
* @param {?} transition
|
|
5328
5629
|
* @return {?}
|
|
@@ -5379,7 +5680,7 @@
|
|
|
5379
5680
|
* @return {?}
|
|
5380
5681
|
*/
|
|
5381
5682
|
function (url) {
|
|
5382
|
-
return new exports.UrlSnapshot(this.urlSerializer, url);
|
|
5683
|
+
return new exports.UrlSnapshot(this.urlSerializer, url, {});
|
|
5383
5684
|
};
|
|
5384
5685
|
/**
|
|
5385
5686
|
* @param {?} url
|
|
@@ -5401,6 +5702,15 @@
|
|
|
5401
5702
|
function () {
|
|
5402
5703
|
return this.router.routerState ? this.router.routerState.snapshot.url : null;
|
|
5403
5704
|
};
|
|
5705
|
+
/**
|
|
5706
|
+
* @return {?}
|
|
5707
|
+
*/
|
|
5708
|
+
PlaceRouter.prototype.getCurrentRouteSnapshot = /**
|
|
5709
|
+
* @return {?}
|
|
5710
|
+
*/
|
|
5711
|
+
function () {
|
|
5712
|
+
return this.parseUrl(this.getCurrentRouterUrl());
|
|
5713
|
+
};
|
|
5404
5714
|
/**
|
|
5405
5715
|
* @param {?} url
|
|
5406
5716
|
* @return {?}
|
|
@@ -5427,14 +5737,32 @@
|
|
|
5427
5737
|
function (url) {
|
|
5428
5738
|
return this.getActiveInteractionIdsFromUrl(url).length > 0;
|
|
5429
5739
|
};
|
|
5740
|
+
// @Trace()
|
|
5741
|
+
// @Trace()
|
|
5742
|
+
/**
|
|
5743
|
+
* @param {?} urlSnapshot
|
|
5744
|
+
* @return {?}
|
|
5745
|
+
*/
|
|
5746
|
+
PlaceRouter.prototype.navigateByUrl =
|
|
5747
|
+
// @Trace()
|
|
5748
|
+
/**
|
|
5749
|
+
* @param {?} urlSnapshot
|
|
5750
|
+
* @return {?}
|
|
5751
|
+
*/
|
|
5752
|
+
function (urlSnapshot) {
|
|
5753
|
+
this.router.navigateByUrl(urlSnapshot.urlTree, urlSnapshot.getNavigationExtras());
|
|
5754
|
+
};
|
|
5755
|
+
// @Trace()
|
|
5756
|
+
// @Trace()
|
|
5430
5757
|
/**
|
|
5431
5758
|
* @return {?}
|
|
5432
5759
|
*/
|
|
5433
|
-
PlaceRouter.prototype.syncInteractionIdsWithRouter =
|
|
5760
|
+
PlaceRouter.prototype.syncInteractionIdsWithRouter =
|
|
5761
|
+
// @Trace()
|
|
5762
|
+
/**
|
|
5434
5763
|
* @return {?}
|
|
5435
5764
|
*/
|
|
5436
5765
|
function () {
|
|
5437
|
-
var _a, _b;
|
|
5438
5766
|
pectin.assert.isFalsey(this.navigationInProgress.value); // Updating interaction routes during an existing navigation breaks all the things.
|
|
5439
5767
|
// Updating interaction routes during an existing navigation breaks all the things.
|
|
5440
5768
|
/** @type {?} */
|
|
@@ -5444,22 +5772,12 @@
|
|
|
5444
5772
|
}
|
|
5445
5773
|
else {
|
|
5446
5774
|
if (currentIds.length < 1) {
|
|
5447
|
-
|
|
5448
|
-
|
|
5449
|
-
_a[exports.UrlSnapshot.INTERACTION_ROUTER_OUTLET] = null,
|
|
5450
|
-
_a)
|
|
5451
|
-
}], {
|
|
5452
|
-
replaceUrl: true // remove the interaction from the history.
|
|
5453
|
-
});
|
|
5775
|
+
// no more interactions to remove from history.
|
|
5776
|
+
this.navigateByUrl(this.getCurrentRouteSnapshot().removeInteractionIds());
|
|
5454
5777
|
}
|
|
5455
5778
|
else {
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
this.router.navigate(['.', {
|
|
5459
|
-
outlets: (_b = {},
|
|
5460
|
-
_b[exports.UrlSnapshot.INTERACTION_ROUTER_OUTLET] = exports.UrlSnapshot.createInteractionOutletRouterCommands(currentIds),
|
|
5461
|
-
_b)
|
|
5462
|
-
}]);
|
|
5779
|
+
// todo was or is...
|
|
5780
|
+
this.navigateByUrl(this.getCurrentRouteSnapshot().updateInteractionIds(currentIds));
|
|
5463
5781
|
}
|
|
5464
5782
|
}
|
|
5465
5783
|
};
|
|
@@ -5477,12 +5795,6 @@
|
|
|
5477
5795
|
{ type: exports.ɵv }
|
|
5478
5796
|
]; };
|
|
5479
5797
|
/** @nocollapse */ PlaceRouter.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(core.ɵɵinject(router.Router), core.ɵɵinject(router.UrlSerializer), core.ɵɵinject(common.Location), core.ɵɵinject(PlaceHistory), core.ɵɵinject(exports.ɵv)); }, token: PlaceRouter, providedIn: "root" });
|
|
5480
|
-
__decorate([
|
|
5481
|
-
pectin.Trace(),
|
|
5482
|
-
__metadata("design:type", Function),
|
|
5483
|
-
__metadata("design:paramtypes", []),
|
|
5484
|
-
__metadata("design:returntype", void 0)
|
|
5485
|
-
], PlaceRouter.prototype, "syncInteractionIdsWithRouter", null);
|
|
5486
5798
|
return PlaceRouter;
|
|
5487
5799
|
}(pectin.GarbageCollector));
|
|
5488
5800
|
if (false) {
|
|
@@ -7048,139 +7360,42 @@
|
|
|
7048
7360
|
* @fileoverview added by tsickle
|
|
7049
7361
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
7050
7362
|
*/
|
|
7051
|
-
|
|
7052
|
-
|
|
7053
|
-
|
|
7054
|
-
|
|
7055
|
-
|
|
7056
|
-
|
|
7363
|
+
/**
|
|
7364
|
+
* This a work around for the fact that an activated route with multiple segments doesn't
|
|
7365
|
+
* include the segment params in the paramMap as well as each segment returns an empty
|
|
7366
|
+
* param map even when `parameter`s has content.
|
|
7367
|
+
*/
|
|
7368
|
+
var ConsolidatedParameterMap = /** @class */ (function () {
|
|
7369
|
+
function ConsolidatedParameterMap(paramMap, urlSegments) {
|
|
7370
|
+
this.paramMaps = [paramMap].concat((urlSegments || []).map((/**
|
|
7371
|
+
* @param {?} s
|
|
7372
|
+
* @return {?}
|
|
7373
|
+
*/
|
|
7374
|
+
function (s) { return new ParamMapAdapter(s.parameters); }))).filter((/**
|
|
7375
|
+
* @param {?} m
|
|
7376
|
+
* @return {?}
|
|
7377
|
+
*/
|
|
7378
|
+
function (m) { return !!m; })); // the activated route param map can be null
|
|
7057
7379
|
}
|
|
7058
|
-
// @Trace()
|
|
7059
|
-
// @Trace()
|
|
7060
7380
|
/**
|
|
7061
|
-
* @param {?}
|
|
7381
|
+
* @param {?} name
|
|
7062
7382
|
* @return {?}
|
|
7063
7383
|
*/
|
|
7064
|
-
|
|
7065
|
-
|
|
7384
|
+
ConsolidatedParameterMap.prototype.get = /**
|
|
7385
|
+
* @param {?} name
|
|
7386
|
+
* @return {?}
|
|
7387
|
+
*/
|
|
7388
|
+
function (name) {
|
|
7389
|
+
/** @type {?} */
|
|
7390
|
+
var paramMap = this.paramMaps.find((/**
|
|
7391
|
+
* @param {?} m
|
|
7392
|
+
* @return {?}
|
|
7393
|
+
*/
|
|
7394
|
+
function (m) { return m.has(name); }));
|
|
7395
|
+
return paramMap.get(name);
|
|
7396
|
+
};
|
|
7066
7397
|
/**
|
|
7067
|
-
* @param {?}
|
|
7068
|
-
* @return {?}
|
|
7069
|
-
*/
|
|
7070
|
-
function (visit) {
|
|
7071
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
7072
|
-
var placeDef, routeIdDef, routeId, sanitisedValue, parameterDefs, sanitisedVisit, i, def, value, sanitisedValue;
|
|
7073
|
-
return __generator(this, function (_a) {
|
|
7074
|
-
switch (_a.label) {
|
|
7075
|
-
case 0:
|
|
7076
|
-
placeDef = visit.placeDefinition;
|
|
7077
|
-
if (!placeDef.hasRouteId()) return [3 /*break*/, 2];
|
|
7078
|
-
routeIdDef = placeDef.getRouteIdParameterDef();
|
|
7079
|
-
routeId = visit.getRouteId();
|
|
7080
|
-
return [4 /*yield*/, routeIdDef.sanitise(routeId, visit, this.placeHistory, this.injector)];
|
|
7081
|
-
case 1:
|
|
7082
|
-
sanitisedValue = _a.sent();
|
|
7083
|
-
// console.log({routeId, sanitisedValue});
|
|
7084
|
-
// ###------- EARLY EXIT --------###
|
|
7085
|
-
if (routeIdDef.hasChanged(routeId, sanitisedValue)) {
|
|
7086
|
-
// if the route id has changed we redirect immediately as other
|
|
7087
|
-
// parameter sanitisers might use it.
|
|
7088
|
-
return [2 /*return*/, visit.replace(routeIdDef, sanitisedValue)];
|
|
7089
|
-
}
|
|
7090
|
-
_a.label = 2;
|
|
7091
|
-
case 2:
|
|
7092
|
-
// if we didn't replace the routeId we continue the url present parameters.
|
|
7093
|
-
parameterDefs = placeDef.getVisitParameterDefs({
|
|
7094
|
-
includeRouteParameters: true,
|
|
7095
|
-
includeNonRouteParameters: true
|
|
7096
|
-
});
|
|
7097
|
-
sanitisedVisit = visit;
|
|
7098
|
-
i = 0;
|
|
7099
|
-
_a.label = 3;
|
|
7100
|
-
case 3:
|
|
7101
|
-
if (!(i < parameterDefs.length)) return [3 /*break*/, 6];
|
|
7102
|
-
def = parameterDefs[i];
|
|
7103
|
-
value = visit.getParameter(def.name);
|
|
7104
|
-
return [4 /*yield*/, def.sanitise(value, sanitisedVisit, this.placeHistory, this.injector)];
|
|
7105
|
-
case 4:
|
|
7106
|
-
sanitisedValue = _a.sent();
|
|
7107
|
-
if (def.hasChanged(value, sanitisedValue)) {
|
|
7108
|
-
sanitisedVisit = sanitisedVisit.replace(def, sanitisedValue);
|
|
7109
|
-
}
|
|
7110
|
-
_a.label = 5;
|
|
7111
|
-
case 5:
|
|
7112
|
-
i++;
|
|
7113
|
-
return [3 /*break*/, 3];
|
|
7114
|
-
case 6: return [2 /*return*/, sanitisedVisit.hasChangedFrom(visit) ? sanitisedVisit : visit];
|
|
7115
|
-
}
|
|
7116
|
-
});
|
|
7117
|
-
});
|
|
7118
|
-
};
|
|
7119
|
-
return VisitSanitiser;
|
|
7120
|
-
}());
|
|
7121
|
-
if (false) {
|
|
7122
|
-
/**
|
|
7123
|
-
* @type {?}
|
|
7124
|
-
* @private
|
|
7125
|
-
*/
|
|
7126
|
-
VisitSanitiser.prototype.activatedRoute;
|
|
7127
|
-
/**
|
|
7128
|
-
* @type {?}
|
|
7129
|
-
* @private
|
|
7130
|
-
*/
|
|
7131
|
-
VisitSanitiser.prototype.router;
|
|
7132
|
-
/**
|
|
7133
|
-
* @type {?}
|
|
7134
|
-
* @private
|
|
7135
|
-
*/
|
|
7136
|
-
VisitSanitiser.prototype.placeHistory;
|
|
7137
|
-
/**
|
|
7138
|
-
* @type {?}
|
|
7139
|
-
* @private
|
|
7140
|
-
*/
|
|
7141
|
-
VisitSanitiser.prototype.injector;
|
|
7142
|
-
}
|
|
7143
|
-
|
|
7144
|
-
/**
|
|
7145
|
-
* @fileoverview added by tsickle
|
|
7146
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
7147
|
-
*/
|
|
7148
|
-
/**
|
|
7149
|
-
* This a work around for the fact that an activated route with multiple segments doesn't
|
|
7150
|
-
* include the segment params in the paramMap as well as each segment returns an empty
|
|
7151
|
-
* param map even when `parameter`s has content.
|
|
7152
|
-
*/
|
|
7153
|
-
var ConsolidatedParameterMap = /** @class */ (function () {
|
|
7154
|
-
function ConsolidatedParameterMap(paramMap, urlSegments) {
|
|
7155
|
-
this.paramMaps = [paramMap].concat((urlSegments || []).map((/**
|
|
7156
|
-
* @param {?} s
|
|
7157
|
-
* @return {?}
|
|
7158
|
-
*/
|
|
7159
|
-
function (s) { return new ParamMapAdapter(s.parameters); }))).filter((/**
|
|
7160
|
-
* @param {?} m
|
|
7161
|
-
* @return {?}
|
|
7162
|
-
*/
|
|
7163
|
-
function (m) { return !!m; })); // the activated route param map can be null
|
|
7164
|
-
}
|
|
7165
|
-
/**
|
|
7166
|
-
* @param {?} name
|
|
7167
|
-
* @return {?}
|
|
7168
|
-
*/
|
|
7169
|
-
ConsolidatedParameterMap.prototype.get = /**
|
|
7170
|
-
* @param {?} name
|
|
7171
|
-
* @return {?}
|
|
7172
|
-
*/
|
|
7173
|
-
function (name) {
|
|
7174
|
-
/** @type {?} */
|
|
7175
|
-
var paramMap = this.paramMaps.find((/**
|
|
7176
|
-
* @param {?} m
|
|
7177
|
-
* @return {?}
|
|
7178
|
-
*/
|
|
7179
|
-
function (m) { return m.has(name); }));
|
|
7180
|
-
return paramMap.get(name);
|
|
7181
|
-
};
|
|
7182
|
-
/**
|
|
7183
|
-
* @param {?} name
|
|
7398
|
+
* @param {?} name
|
|
7184
7399
|
* @return {?}
|
|
7185
7400
|
*/
|
|
7186
7401
|
ConsolidatedParameterMap.prototype.getAll = /**
|
|
@@ -7303,15 +7518,151 @@
|
|
|
7303
7518
|
* @fileoverview added by tsickle
|
|
7304
7519
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
7305
7520
|
*/
|
|
7521
|
+
var NoopAuthGuard = /** @class */ (function () {
|
|
7522
|
+
function NoopAuthGuard() {
|
|
7523
|
+
}
|
|
7524
|
+
/**
|
|
7525
|
+
* @param {?} activatedRoute
|
|
7526
|
+
* @param {?} state
|
|
7527
|
+
* @return {?}
|
|
7528
|
+
*/
|
|
7529
|
+
NoopAuthGuard.prototype.canActivate = /**
|
|
7530
|
+
* @param {?} activatedRoute
|
|
7531
|
+
* @param {?} state
|
|
7532
|
+
* @return {?}
|
|
7533
|
+
*/
|
|
7534
|
+
function (activatedRoute, state) {
|
|
7535
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7536
|
+
return __generator(this, function (_a) {
|
|
7537
|
+
return [2 /*return*/, true];
|
|
7538
|
+
});
|
|
7539
|
+
});
|
|
7540
|
+
};
|
|
7541
|
+
NoopAuthGuard.decorators = [
|
|
7542
|
+
{ type: core.Injectable, args: [{
|
|
7543
|
+
providedIn: 'root'
|
|
7544
|
+
},] }
|
|
7545
|
+
];
|
|
7546
|
+
/** @nocollapse */
|
|
7547
|
+
NoopAuthGuard.ctorParameters = function () { return []; };
|
|
7548
|
+
/** @nocollapse */ NoopAuthGuard.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function NoopAuthGuard_Factory() { return new NoopAuthGuard(); }, token: NoopAuthGuard, providedIn: "root" });
|
|
7549
|
+
return NoopAuthGuard;
|
|
7550
|
+
}());
|
|
7551
|
+
|
|
7306
7552
|
/**
|
|
7553
|
+
* @fileoverview added by tsickle
|
|
7554
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
7555
|
+
*/
|
|
7556
|
+
var VisitSanitiser = /** @class */ (function () {
|
|
7557
|
+
function VisitSanitiser(activatedRoute, router, placeHistory, injector) {
|
|
7558
|
+
this.activatedRoute = activatedRoute;
|
|
7559
|
+
this.router = router;
|
|
7560
|
+
this.placeHistory = placeHistory;
|
|
7561
|
+
this.injector = injector;
|
|
7562
|
+
}
|
|
7563
|
+
// @Trace()
|
|
7564
|
+
// @Trace()
|
|
7565
|
+
/**
|
|
7566
|
+
* @param {?} visit
|
|
7567
|
+
* @return {?}
|
|
7568
|
+
*/
|
|
7569
|
+
VisitSanitiser.prototype.sanitise =
|
|
7570
|
+
// @Trace()
|
|
7571
|
+
/**
|
|
7572
|
+
* @param {?} visit
|
|
7573
|
+
* @return {?}
|
|
7574
|
+
*/
|
|
7575
|
+
function (visit) {
|
|
7576
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7577
|
+
var placeDef, routeIdDef, routeId, sanitisedValue, parameterDefs, sanitisedVisit, i, def, value, sanitisedValue;
|
|
7578
|
+
return __generator(this, function (_a) {
|
|
7579
|
+
switch (_a.label) {
|
|
7580
|
+
case 0:
|
|
7581
|
+
placeDef = visit.placeDefinition;
|
|
7582
|
+
if (!placeDef.hasRouteId()) return [3 /*break*/, 2];
|
|
7583
|
+
routeIdDef = placeDef.getRouteIdParameterDef();
|
|
7584
|
+
routeId = visit.getRouteId();
|
|
7585
|
+
return [4 /*yield*/, routeIdDef.sanitise(routeId, visit, this.placeHistory, this.injector)];
|
|
7586
|
+
case 1:
|
|
7587
|
+
sanitisedValue = _a.sent();
|
|
7588
|
+
// console.log({routeId, sanitisedValue});
|
|
7589
|
+
// ###------- EARLY EXIT --------###
|
|
7590
|
+
if (routeIdDef.hasChanged(routeId, sanitisedValue)) {
|
|
7591
|
+
// if the route id has changed we redirect immediately as other
|
|
7592
|
+
// parameter sanitisers might use it.
|
|
7593
|
+
return [2 /*return*/, visit.replace(routeIdDef, sanitisedValue)];
|
|
7594
|
+
}
|
|
7595
|
+
_a.label = 2;
|
|
7596
|
+
case 2:
|
|
7597
|
+
// if we didn't replace the routeId we continue the url present parameters.
|
|
7598
|
+
parameterDefs = placeDef.getVisitParameterDefs({
|
|
7599
|
+
includeRouteParameters: true,
|
|
7600
|
+
includeNonRouteParameters: true
|
|
7601
|
+
});
|
|
7602
|
+
sanitisedVisit = visit;
|
|
7603
|
+
i = 0;
|
|
7604
|
+
_a.label = 3;
|
|
7605
|
+
case 3:
|
|
7606
|
+
if (!(i < parameterDefs.length)) return [3 /*break*/, 6];
|
|
7607
|
+
def = parameterDefs[i];
|
|
7608
|
+
value = visit.getParameter(def.name);
|
|
7609
|
+
return [4 /*yield*/, def.sanitise(value, sanitisedVisit, this.placeHistory, this.injector)];
|
|
7610
|
+
case 4:
|
|
7611
|
+
sanitisedValue = _a.sent();
|
|
7612
|
+
if (def.hasChanged(value, sanitisedValue)) {
|
|
7613
|
+
sanitisedVisit = sanitisedVisit.replace(def, sanitisedValue);
|
|
7614
|
+
}
|
|
7615
|
+
_a.label = 5;
|
|
7616
|
+
case 5:
|
|
7617
|
+
i++;
|
|
7618
|
+
return [3 /*break*/, 3];
|
|
7619
|
+
case 6: return [2 /*return*/, sanitisedVisit.hasChangedFrom(visit) ? sanitisedVisit : visit];
|
|
7620
|
+
}
|
|
7621
|
+
});
|
|
7622
|
+
});
|
|
7623
|
+
};
|
|
7624
|
+
return VisitSanitiser;
|
|
7625
|
+
}());
|
|
7626
|
+
if (false) {
|
|
7627
|
+
/**
|
|
7628
|
+
* @type {?}
|
|
7629
|
+
* @private
|
|
7630
|
+
*/
|
|
7631
|
+
VisitSanitiser.prototype.activatedRoute;
|
|
7632
|
+
/**
|
|
7633
|
+
* @type {?}
|
|
7634
|
+
* @private
|
|
7635
|
+
*/
|
|
7636
|
+
VisitSanitiser.prototype.router;
|
|
7637
|
+
/**
|
|
7638
|
+
* @type {?}
|
|
7639
|
+
* @private
|
|
7640
|
+
*/
|
|
7641
|
+
VisitSanitiser.prototype.placeHistory;
|
|
7642
|
+
/**
|
|
7643
|
+
* @type {?}
|
|
7644
|
+
* @private
|
|
7645
|
+
*/
|
|
7646
|
+
VisitSanitiser.prototype.injector;
|
|
7647
|
+
}
|
|
7648
|
+
|
|
7649
|
+
/**
|
|
7650
|
+
* @fileoverview added by tsickle
|
|
7651
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
7652
|
+
*/
|
|
7653
|
+
/**
|
|
7654
|
+
* @abstract
|
|
7655
|
+
*/
|
|
7656
|
+
var /**
|
|
7307
7657
|
* @abstract
|
|
7308
7658
|
*/
|
|
7309
|
-
|
|
7310
|
-
function
|
|
7659
|
+
PlaceGuard = /** @class */ (function () {
|
|
7660
|
+
function PlaceGuard(router, urlSerializer, placeRouter, placeHistory, interactionService, injector) {
|
|
7311
7661
|
this.router = router;
|
|
7312
7662
|
this.urlSerializer = urlSerializer;
|
|
7313
7663
|
this.placeRouter = placeRouter;
|
|
7314
7664
|
this.placeHistory = placeHistory;
|
|
7665
|
+
this.interactionService = interactionService;
|
|
7315
7666
|
this.injector = injector;
|
|
7316
7667
|
}
|
|
7317
7668
|
// @Trace()
|
|
@@ -7321,7 +7672,7 @@
|
|
|
7321
7672
|
* @param {?} state
|
|
7322
7673
|
* @return {?}
|
|
7323
7674
|
*/
|
|
7324
|
-
|
|
7675
|
+
PlaceGuard.prototype.canActivate =
|
|
7325
7676
|
// @Trace()
|
|
7326
7677
|
/**
|
|
7327
7678
|
* @param {?} activatedRoute
|
|
@@ -7332,44 +7683,59 @@
|
|
|
7332
7683
|
return __awaiter(this, void 0, void 0, function () {
|
|
7333
7684
|
var _this = this;
|
|
7334
7685
|
return __generator(this, function (_a) {
|
|
7686
|
+
// TODO: this is ugly now that I'm return UrlSnapshots and not UrlTrees. It'd be better if the functions
|
|
7687
|
+
// weren't nested or if I implemented a handler chain.
|
|
7335
7688
|
return [2 /*return*/, this.authorisePlaceThen(activatedRoute, state, (/**
|
|
7336
7689
|
* @param {?} placeDefinition
|
|
7337
7690
|
* @return {?}
|
|
7338
7691
|
*/
|
|
7339
7692
|
function (placeDefinition) { return __awaiter(_this, void 0, void 0, function () {
|
|
7340
|
-
var
|
|
7693
|
+
var result;
|
|
7694
|
+
var _this = this;
|
|
7341
7695
|
return __generator(this, function (_a) {
|
|
7342
7696
|
switch (_a.label) {
|
|
7343
|
-
case 0:
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
|
|
7349
|
-
|
|
7697
|
+
case 0: return [4 /*yield*/, this.cleanInteractionState(activatedRoute, state, (/**
|
|
7698
|
+
* @return {?}
|
|
7699
|
+
*/
|
|
7700
|
+
function () { return __awaiter(_this, void 0, void 0, function () {
|
|
7701
|
+
var params, parsedParams, initialVisit, sanitiser, sanitisedVisit, urlSnapshot;
|
|
7702
|
+
return __generator(this, function (_a) {
|
|
7703
|
+
switch (_a.label) {
|
|
7704
|
+
case 0:
|
|
7705
|
+
// Parse our route params.
|
|
7706
|
+
params = new ConsolidatedParameterMap(activatedRoute.paramMap, activatedRoute.url);
|
|
7707
|
+
parsedParams = placeDefinition.parseRouteParams(params);
|
|
7708
|
+
initialVisit = this.placeRouter.navigationState.getVisitFor(placeDefinition) || new Visit(placeDefinition, parsedParams);
|
|
7709
|
+
sanitiser = new VisitSanitiser(activatedRoute, this.router, this.placeHistory, this.injector);
|
|
7710
|
+
return [4 /*yield*/, sanitiser.sanitise(initialVisit.mergeRouteParameters(parsedParams))];
|
|
7711
|
+
case 1:
|
|
7712
|
+
sanitisedVisit = _a.sent();
|
|
7713
|
+
// Save the visit with any updated parameters. We need to save it so we remember any non route parameters
|
|
7714
|
+
this.placeRouter.navigationState.storeVisit(sanitisedVisit);
|
|
7715
|
+
if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {
|
|
7716
|
+
// Regenerate the url
|
|
7717
|
+
urlSnapshot = this.placeRouter.parseUrl(state.url).updateVisitSegments(sanitisedVisit);
|
|
7718
|
+
console.log('##### Place Guard Redirect', urlSnapshot);
|
|
7719
|
+
return [2 /*return*/, urlSnapshot];
|
|
7720
|
+
}
|
|
7721
|
+
else {
|
|
7722
|
+
return [2 /*return*/, true];
|
|
7723
|
+
}
|
|
7724
|
+
return [2 /*return*/];
|
|
7725
|
+
}
|
|
7726
|
+
});
|
|
7727
|
+
}); }))];
|
|
7350
7728
|
case 1:
|
|
7351
|
-
|
|
7352
|
-
|
|
7353
|
-
this.placeRouter.navigationState.storeVisit(sanitisedVisit);
|
|
7354
|
-
if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {
|
|
7355
|
-
// Regenerate the url
|
|
7356
|
-
commands = this.placeRouter.parseUrl(state.url).createRedirectCommandsFor(sanitisedVisit);
|
|
7357
|
-
console.log('##### Place Guard Redirect', commands);
|
|
7358
|
-
return [2 /*return*/, this.router.createUrlTree(commands, {
|
|
7359
|
-
replaceUrl: true,
|
|
7360
|
-
skipLocationChange: false
|
|
7361
|
-
})];
|
|
7362
|
-
}
|
|
7363
|
-
else {
|
|
7364
|
-
return [2 /*return*/, true];
|
|
7365
|
-
}
|
|
7366
|
-
return [2 /*return*/];
|
|
7729
|
+
result = _a.sent();
|
|
7730
|
+
return [2 /*return*/, this.handleGuardResult(result)];
|
|
7367
7731
|
}
|
|
7368
7732
|
});
|
|
7369
7733
|
}); }))];
|
|
7370
7734
|
});
|
|
7371
7735
|
});
|
|
7372
7736
|
};
|
|
7737
|
+
// @Trace()
|
|
7738
|
+
// @Trace()
|
|
7373
7739
|
/**
|
|
7374
7740
|
* @param {?} component
|
|
7375
7741
|
* @param {?} currentRoute
|
|
@@ -7377,7 +7743,9 @@
|
|
|
7377
7743
|
* @param {?=} nextState
|
|
7378
7744
|
* @return {?}
|
|
7379
7745
|
*/
|
|
7380
|
-
|
|
7746
|
+
PlaceGuard.prototype.canDeactivate =
|
|
7747
|
+
// @Trace()
|
|
7748
|
+
/**
|
|
7381
7749
|
* @param {?} component
|
|
7382
7750
|
* @param {?} currentRoute
|
|
7383
7751
|
* @param {?} currentState
|
|
@@ -7386,11 +7754,38 @@
|
|
|
7386
7754
|
*/
|
|
7387
7755
|
function (component, currentRoute, currentState, nextState) {
|
|
7388
7756
|
return __awaiter(this, void 0, void 0, function () {
|
|
7757
|
+
var currentUrl, nextUrl, result;
|
|
7389
7758
|
return __generator(this, function (_a) {
|
|
7390
|
-
|
|
7759
|
+
switch (_a.label) {
|
|
7760
|
+
case 0:
|
|
7761
|
+
currentUrl = this.placeRouter.parseUrl(currentState.url);
|
|
7762
|
+
nextUrl = this.placeRouter.parseUrl(nextState.url);
|
|
7763
|
+
return [4 /*yield*/, this.placeRouter.navigationState.canDeactivatePlace(component, currentUrl, nextUrl)];
|
|
7764
|
+
case 1:
|
|
7765
|
+
result = _a.sent();
|
|
7766
|
+
return [2 /*return*/, this.handleGuardResult(result)];
|
|
7767
|
+
}
|
|
7391
7768
|
});
|
|
7392
7769
|
});
|
|
7393
7770
|
};
|
|
7771
|
+
/**
|
|
7772
|
+
* @private
|
|
7773
|
+
* @param {?} result
|
|
7774
|
+
* @return {?}
|
|
7775
|
+
*/
|
|
7776
|
+
PlaceGuard.prototype.handleGuardResult = /**
|
|
7777
|
+
* @private
|
|
7778
|
+
* @param {?} result
|
|
7779
|
+
* @return {?}
|
|
7780
|
+
*/
|
|
7781
|
+
function (result) {
|
|
7782
|
+
if (result instanceof exports.UrlSnapshot) {
|
|
7783
|
+
return result.urlTree;
|
|
7784
|
+
}
|
|
7785
|
+
else {
|
|
7786
|
+
return result;
|
|
7787
|
+
}
|
|
7788
|
+
};
|
|
7394
7789
|
// @Trace()
|
|
7395
7790
|
// @Trace()
|
|
7396
7791
|
/**
|
|
@@ -7400,7 +7795,7 @@
|
|
|
7400
7795
|
* @param {?} runPlaceGuards
|
|
7401
7796
|
* @return {?}
|
|
7402
7797
|
*/
|
|
7403
|
-
|
|
7798
|
+
PlaceGuard.prototype.authorisePlaceThen =
|
|
7404
7799
|
// @Trace()
|
|
7405
7800
|
/**
|
|
7406
7801
|
* @protected
|
|
@@ -7442,12 +7837,16 @@
|
|
|
7442
7837
|
});
|
|
7443
7838
|
});
|
|
7444
7839
|
};
|
|
7840
|
+
// @Trace()
|
|
7841
|
+
// @Trace()
|
|
7445
7842
|
/**
|
|
7446
7843
|
* @param {?} activatedRoute
|
|
7447
7844
|
* @param {?} state
|
|
7448
7845
|
* @return {?}
|
|
7449
7846
|
*/
|
|
7450
|
-
|
|
7847
|
+
PlaceGuard.prototype.isAuthorised =
|
|
7848
|
+
// @Trace()
|
|
7849
|
+
/**
|
|
7451
7850
|
* @param {?} activatedRoute
|
|
7452
7851
|
* @param {?} state
|
|
7453
7852
|
* @return {?}
|
|
@@ -7461,201 +7860,79 @@
|
|
|
7461
7860
|
});
|
|
7462
7861
|
});
|
|
7463
7862
|
};
|
|
7464
|
-
|
|
7465
|
-
|
|
7466
|
-
__metadata("design:type", Function),
|
|
7467
|
-
__metadata("design:paramtypes", [router.ActivatedRouteSnapshot, router.RouterStateSnapshot]),
|
|
7468
|
-
__metadata("design:returntype", Promise)
|
|
7469
|
-
], AbstractPlaceGuard.prototype, "isAuthorised", null);
|
|
7470
|
-
return AbstractPlaceGuard;
|
|
7471
|
-
}());
|
|
7472
|
-
if (false) {
|
|
7473
|
-
/**
|
|
7474
|
-
* @type {?}
|
|
7475
|
-
* @private
|
|
7476
|
-
*/
|
|
7477
|
-
AbstractPlaceGuard.prototype.router;
|
|
7478
|
-
/**
|
|
7479
|
-
* @type {?}
|
|
7480
|
-
* @private
|
|
7481
|
-
*/
|
|
7482
|
-
AbstractPlaceGuard.prototype.urlSerializer;
|
|
7483
|
-
/**
|
|
7484
|
-
* @type {?}
|
|
7485
|
-
* @private
|
|
7486
|
-
*/
|
|
7487
|
-
AbstractPlaceGuard.prototype.placeRouter;
|
|
7488
|
-
/**
|
|
7489
|
-
* @type {?}
|
|
7490
|
-
* @private
|
|
7491
|
-
*/
|
|
7492
|
-
AbstractPlaceGuard.prototype.placeHistory;
|
|
7493
|
-
/**
|
|
7494
|
-
* @type {?}
|
|
7495
|
-
* @private
|
|
7496
|
-
*/
|
|
7497
|
-
AbstractPlaceGuard.prototype.injector;
|
|
7498
|
-
/**
|
|
7499
|
-
* @abstract
|
|
7500
|
-
* @param {?} injector
|
|
7501
|
-
* @return {?}
|
|
7502
|
-
*/
|
|
7503
|
-
AbstractPlaceGuard.prototype.getAuthGuard = function (injector) { };
|
|
7504
|
-
}
|
|
7505
|
-
|
|
7506
|
-
/**
|
|
7507
|
-
* @fileoverview added by tsickle
|
|
7508
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
7509
|
-
*/
|
|
7510
|
-
var InteractionGuard = /** @class */ (function () {
|
|
7511
|
-
function InteractionGuard(router, injector, placeRouter, angularLocation, interactionService) {
|
|
7512
|
-
this.router = router;
|
|
7513
|
-
this.injector = injector;
|
|
7514
|
-
this.placeRouter = placeRouter;
|
|
7515
|
-
this.angularLocation = angularLocation;
|
|
7516
|
-
this.interactionService = interactionService;
|
|
7517
|
-
}
|
|
7863
|
+
// @Trace()
|
|
7864
|
+
// @Trace()
|
|
7518
7865
|
/**
|
|
7519
7866
|
* @param {?} route
|
|
7520
7867
|
* @param {?} state
|
|
7868
|
+
* @param {?} then
|
|
7521
7869
|
* @return {?}
|
|
7522
7870
|
*/
|
|
7523
|
-
|
|
7871
|
+
PlaceGuard.prototype.cleanInteractionState =
|
|
7872
|
+
// @Trace()
|
|
7873
|
+
/**
|
|
7524
7874
|
* @param {?} route
|
|
7525
7875
|
* @param {?} state
|
|
7876
|
+
* @param {?} then
|
|
7526
7877
|
* @return {?}
|
|
7527
7878
|
*/
|
|
7528
|
-
function (route, state) {
|
|
7529
|
-
/** @type {?} */
|
|
7530
|
-
var url = this.router.parseUrl(state.url);
|
|
7531
|
-
if (!this.interactionService.isActive() && url.root.children[exports.UrlSnapshot.INTERACTION_ROUTER_OUTLET]) {
|
|
7532
|
-
// This happens if we reload the page or the url was pasted as the route should only be activated
|
|
7533
|
-
// after the interaction context has become active.
|
|
7534
|
-
delete url.root.children[exports.UrlSnapshot.INTERACTION_ROUTER_OUTLET];
|
|
7535
|
-
return url;
|
|
7536
|
-
}
|
|
7537
|
-
else {
|
|
7538
|
-
return true;
|
|
7539
|
-
}
|
|
7540
|
-
};
|
|
7541
|
-
/**
|
|
7542
|
-
* @param {?} component
|
|
7543
|
-
* @param {?} currentRoute
|
|
7544
|
-
* @param {?} currentState
|
|
7545
|
-
* @param {?=} nextState
|
|
7546
|
-
* @return {?}
|
|
7547
|
-
*/
|
|
7548
|
-
InteractionGuard.prototype.canDeactivate = /**
|
|
7549
|
-
* @param {?} component
|
|
7550
|
-
* @param {?} currentRoute
|
|
7551
|
-
* @param {?} currentState
|
|
7552
|
-
* @param {?=} nextState
|
|
7553
|
-
* @return {?}
|
|
7554
|
-
*/
|
|
7555
|
-
function (component, currentRoute, currentState, nextState) {
|
|
7879
|
+
function (route, state, then) {
|
|
7556
7880
|
return __awaiter(this, void 0, void 0, function () {
|
|
7557
|
-
var
|
|
7881
|
+
var url;
|
|
7558
7882
|
return __generator(this, function (_a) {
|
|
7559
|
-
|
|
7560
|
-
|
|
7561
|
-
|
|
7562
|
-
|
|
7563
|
-
|
|
7564
|
-
if (!!___default.isEqual(currentIds, routeIds)) return [3 /*break*/, 2];
|
|
7565
|
-
// The activity is still active so the route change was triggered by the back button.
|
|
7566
|
-
return [4 /*yield*/, this.interactionService.getCurrentActivity()];
|
|
7567
|
-
case 1:
|
|
7568
|
-
activity = _a.sent();
|
|
7569
|
-
activity.cancel();
|
|
7570
|
-
_a.label = 2;
|
|
7571
|
-
case 2:
|
|
7572
|
-
// IMPORTANT:
|
|
7573
|
-
// We always return true, the router state engine will redirect as required. Return false
|
|
7574
|
-
// during the guard causes all kinds of grief. It might be worth trying a redirect here
|
|
7575
|
-
// again now that our state engine is more thorough.
|
|
7576
|
-
return [2 /*return*/, true];
|
|
7883
|
+
url = this.placeRouter.parseUrl(state.url);
|
|
7884
|
+
if (!this.interactionService.isActive() && url.hasInteractionIds()) {
|
|
7885
|
+
// This happens if we reload the page or the url was pasted as the route should only be activated
|
|
7886
|
+
// after the interaction context has become active.
|
|
7887
|
+
return [2 /*return*/, url.removeInteractionIds()];
|
|
7577
7888
|
}
|
|
7889
|
+
else {
|
|
7890
|
+
return [2 /*return*/, then()];
|
|
7891
|
+
}
|
|
7892
|
+
return [2 /*return*/];
|
|
7578
7893
|
});
|
|
7579
7894
|
});
|
|
7580
7895
|
};
|
|
7581
|
-
|
|
7582
|
-
{ type: core.Injectable, args: [{
|
|
7583
|
-
providedIn: 'root'
|
|
7584
|
-
},] }
|
|
7585
|
-
];
|
|
7586
|
-
/** @nocollapse */
|
|
7587
|
-
InteractionGuard.ctorParameters = function () { return [
|
|
7588
|
-
{ type: router.Router },
|
|
7589
|
-
{ type: core.Injector },
|
|
7590
|
-
{ type: PlaceRouter },
|
|
7591
|
-
{ type: common.Location },
|
|
7592
|
-
{ type: exports.ɵv }
|
|
7593
|
-
]; };
|
|
7594
|
-
/** @nocollapse */ InteractionGuard.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function InteractionGuard_Factory() { return new InteractionGuard(core.ɵɵinject(router.Router), core.ɵɵinject(core.INJECTOR), core.ɵɵinject(PlaceRouter), core.ɵɵinject(common.Location), core.ɵɵinject(exports.ɵv)); }, token: InteractionGuard, providedIn: "root" });
|
|
7595
|
-
return InteractionGuard;
|
|
7896
|
+
return PlaceGuard;
|
|
7596
7897
|
}());
|
|
7597
7898
|
if (false) {
|
|
7598
7899
|
/**
|
|
7599
7900
|
* @type {?}
|
|
7600
7901
|
* @private
|
|
7601
7902
|
*/
|
|
7602
|
-
|
|
7903
|
+
PlaceGuard.prototype.router;
|
|
7603
7904
|
/**
|
|
7604
7905
|
* @type {?}
|
|
7605
7906
|
* @private
|
|
7606
7907
|
*/
|
|
7607
|
-
|
|
7908
|
+
PlaceGuard.prototype.urlSerializer;
|
|
7608
7909
|
/**
|
|
7609
7910
|
* @type {?}
|
|
7610
7911
|
* @private
|
|
7611
7912
|
*/
|
|
7612
|
-
|
|
7913
|
+
PlaceGuard.prototype.placeRouter;
|
|
7613
7914
|
/**
|
|
7614
7915
|
* @type {?}
|
|
7615
7916
|
* @private
|
|
7616
7917
|
*/
|
|
7617
|
-
|
|
7918
|
+
PlaceGuard.prototype.placeHistory;
|
|
7618
7919
|
/**
|
|
7619
7920
|
* @type {?}
|
|
7620
7921
|
* @private
|
|
7621
7922
|
*/
|
|
7622
|
-
|
|
7623
|
-
}
|
|
7624
|
-
|
|
7625
|
-
/**
|
|
7626
|
-
* @fileoverview added by tsickle
|
|
7627
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
7628
|
-
*/
|
|
7629
|
-
var NoopAuthGuard = /** @class */ (function () {
|
|
7630
|
-
function NoopAuthGuard() {
|
|
7631
|
-
}
|
|
7923
|
+
PlaceGuard.prototype.interactionService;
|
|
7632
7924
|
/**
|
|
7633
|
-
* @
|
|
7634
|
-
* @
|
|
7635
|
-
* @return {?}
|
|
7925
|
+
* @type {?}
|
|
7926
|
+
* @private
|
|
7636
7927
|
*/
|
|
7637
|
-
|
|
7638
|
-
|
|
7639
|
-
* @
|
|
7928
|
+
PlaceGuard.prototype.injector;
|
|
7929
|
+
/**
|
|
7930
|
+
* @abstract
|
|
7931
|
+
* @param {?} injector
|
|
7640
7932
|
* @return {?}
|
|
7641
7933
|
*/
|
|
7642
|
-
function (
|
|
7643
|
-
|
|
7644
|
-
return __generator(this, function (_a) {
|
|
7645
|
-
return [2 /*return*/, true];
|
|
7646
|
-
});
|
|
7647
|
-
});
|
|
7648
|
-
};
|
|
7649
|
-
NoopAuthGuard.decorators = [
|
|
7650
|
-
{ type: core.Injectable, args: [{
|
|
7651
|
-
providedIn: 'root'
|
|
7652
|
-
},] }
|
|
7653
|
-
];
|
|
7654
|
-
/** @nocollapse */
|
|
7655
|
-
NoopAuthGuard.ctorParameters = function () { return []; };
|
|
7656
|
-
/** @nocollapse */ NoopAuthGuard.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function NoopAuthGuard_Factory() { return new NoopAuthGuard(); }, token: NoopAuthGuard, providedIn: "root" });
|
|
7657
|
-
return NoopAuthGuard;
|
|
7658
|
-
}());
|
|
7934
|
+
PlaceGuard.prototype.getAuthGuard = function (injector) { };
|
|
7935
|
+
}
|
|
7659
7936
|
|
|
7660
7937
|
/**
|
|
7661
7938
|
* @fileoverview added by tsickle
|
|
@@ -7921,7 +8198,6 @@
|
|
|
7921
8198
|
exports.AUP_PLACE_CONFIG = AUP_PLACE_CONFIG;
|
|
7922
8199
|
exports.AbstractActivity = AbstractActivity;
|
|
7923
8200
|
exports.AbstractInputComponent = AbstractInputComponent;
|
|
7924
|
-
exports.AbstractPlaceGuard = AbstractPlaceGuard;
|
|
7925
8201
|
exports.AbstractPlaceNavigationComponent = AbstractPlaceNavigationComponent;
|
|
7926
8202
|
exports.Activity = exports.ɵbi;
|
|
7927
8203
|
exports.ActivityContainerComponent = ActivityContainerComponent;
|
|
@@ -7946,7 +8222,6 @@
|
|
|
7946
8222
|
exports.InplaceInteractionContextComponent = InplaceInteractionContextComponent;
|
|
7947
8223
|
exports.InteractionContext = InteractionContext;
|
|
7948
8224
|
exports.InteractionContextBase = InteractionContextBase;
|
|
7949
|
-
exports.InteractionGuard = InteractionGuard;
|
|
7950
8225
|
exports.InteractionModule = InteractionModule;
|
|
7951
8226
|
exports.InteractionOutletComponent = InteractionOutletComponent;
|
|
7952
8227
|
exports.InteractionService = exports.ɵv;
|
|
@@ -7959,6 +8234,7 @@
|
|
|
7959
8234
|
exports.PasswordInputComponent = PasswordInputComponent;
|
|
7960
8235
|
exports.Place = Place;
|
|
7961
8236
|
exports.PlaceComponentDeactivationHandler = PlaceComponentDeactivationHandler;
|
|
8237
|
+
exports.PlaceGuard = PlaceGuard;
|
|
7962
8238
|
exports.PlaceHistory = PlaceHistory;
|
|
7963
8239
|
exports.PlaceModule = PlaceModule;
|
|
7964
8240
|
exports.PlaceOutletComponent = PlaceOutletComponent;
|