@coolon/angular-ui-powerups 0.0.89 → 0.0.90
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 +208 -127
- 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/lib/interaction/components/activity-container/activity-container.component.js +2 -2
- package/esm2015/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.js +2 -2
- package/esm2015/lib/interaction/interaction-context.js +18 -2
- package/esm2015/lib/interaction/services/dialog-interaction.service.js +2 -2
- package/esm2015/lib/place/place-definition.js +16 -19
- package/esm2015/lib/place/place-router.js +122 -18
- package/esm2015/lib/place/route/guards/enter-place-guard.service.js +3 -38
- package/esm2015/lib/place/visit.js +4 -11
- package/esm5/lib/interaction/components/activity-container/activity-container.component.js +2 -2
- package/esm5/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.js +2 -2
- package/esm5/lib/interaction/interaction-context.js +29 -2
- package/esm5/lib/interaction/services/dialog-interaction.service.js +2 -2
- package/esm5/lib/place/place-definition.js +17 -39
- package/esm5/lib/place/place-router.js +143 -16
- package/esm5/lib/place/route/guards/enter-place-guard.service.js +3 -44
- package/esm5/lib/place/visit.js +4 -14
- package/fesm2015/coolon-angular-ui-powerups.js +160 -85
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +195 -113
- package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/interaction/components/activity-container/activity-container.component.d.ts +1 -1
- package/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.d.ts +1 -1
- package/lib/interaction/interaction-context.d.ts +2 -1
- package/lib/interaction/services/dialog-interaction.service.d.ts +1 -1
- package/lib/place/place-definition.d.ts +0 -4
- package/lib/place/place-router.d.ts +18 -2
- package/lib/place/route/guards/enter-place-guard.service.d.ts +0 -1
- package/lib/place/visit.d.ts +0 -2
- package/package.json +1 -1
package/esm5/lib/place/visit.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4
4
|
*/
|
|
5
5
|
import * as tslib_1 from "tslib";
|
|
6
|
-
import { UrlSegment } from '@angular/router';
|
|
7
6
|
import * as _ from 'lodash';
|
|
8
7
|
/**
|
|
9
8
|
* @record
|
|
@@ -125,8 +124,10 @@ var Visit = /** @class */ (function () {
|
|
|
125
124
|
else {
|
|
126
125
|
// copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the
|
|
127
126
|
// defaults and remember sanitisation process.
|
|
127
|
+
/** @type {?} */
|
|
128
|
+
var value = _this.getParameter(def.name);
|
|
128
129
|
if (_this.hasParameter(def.name)) {
|
|
129
|
-
params[def.name] =
|
|
130
|
+
params[def.name] = value;
|
|
130
131
|
}
|
|
131
132
|
}
|
|
132
133
|
}));
|
|
@@ -160,17 +161,6 @@ var Visit = /** @class */ (function () {
|
|
|
160
161
|
var sameNonRouteParameters = _.isEqual(this.placeDefinition.getNonRouteParameters(this), this.placeDefinition.getNonRouteParameters(other));
|
|
161
162
|
return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);
|
|
162
163
|
};
|
|
163
|
-
/**
|
|
164
|
-
* @return {?}
|
|
165
|
-
*/
|
|
166
|
-
Visit.prototype.getUrlSegments = /**
|
|
167
|
-
* @return {?}
|
|
168
|
-
*/
|
|
169
|
-
function () {
|
|
170
|
-
return this.placeDefinition.hasRouteId() ?
|
|
171
|
-
[new UrlSegment(this.placeDefinition.path, {}), new UrlSegment(this.placeDefinition.getFormattedRouteId(this), this.placeDefinition.getFormattedRouteParameters(this))] :
|
|
172
|
-
[new UrlSegment(this.placeDefinition.path, this.placeDefinition.getFormattedRouteParameters(this))];
|
|
173
|
-
};
|
|
174
164
|
return Visit;
|
|
175
165
|
}());
|
|
176
166
|
export { Visit };
|
|
@@ -183,4 +173,4 @@ if (false) {
|
|
|
183
173
|
*/
|
|
184
174
|
Visit.prototype.visitParameters;
|
|
185
175
|
}
|
|
186
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
176
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmlzaXQuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9AY29vbG9uL2FuZ3VsYXItdWktcG93ZXJ1cHMvIiwic291cmNlcyI6WyJsaWIvcGxhY2UvdmlzaXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFDQSxPQUFPLEtBQUssQ0FBQyxNQUFNLFFBQVEsQ0FBQzs7OztBQUk1QixxQkFFQztBQUdEO0lBRUUsZUFBcUIsZUFBZ0MsRUFBbUIsZUFBNEI7UUFBNUIsZ0NBQUEsRUFBQSxvQkFBNEI7UUFBL0Usb0JBQWUsR0FBZixlQUFlLENBQWlCO1FBQW1CLG9CQUFlLEdBQWYsZUFBZSxDQUFhO0lBQ3BHLENBQUM7SUFFRCxXQUFXOzs7OztJQUNYLDBCQUFVOzs7OztJQUFWO1FBQ0UsT0FBTyxJQUFJLENBQUMsZUFBZSxDQUFDLGNBQWMsQ0FBQyxJQUFJLENBQUMsQ0FBQztJQUNuRCxDQUFDO0lBRUQsV0FBVzs7Ozs7SUFDWCwwQkFBVTs7Ozs7SUFBVjtRQUNFLE9BQU8sQ0FBQyxDQUFDLENBQUMsS0FBSyxDQUFDLElBQUksQ0FBQyxVQUFVLEVBQUUsQ0FBQyxDQUFDO0lBQ3JDLENBQUM7SUFFRDs7Ozs7T0FLRzs7Ozs7Ozs7SUFDSCw0QkFBWTs7Ozs7OztJQUFaLFVBQWEsYUFBcUI7UUFDaEMsT0FBTyxJQUFJLENBQUMsZUFBZSxDQUFDLGFBQWEs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1ldGVycyh0aGlzLCB0cnVlKSxcbiAgICAgIHRoaXMucGxhY2VEZWZpbml0aW9uLmdldEZvcm1hdHRlZFJvdXRlUGFyYW1ldGVycyhvdGhlciwgdHJ1ZSlcbiAgICApO1xuICAgIHJldHVybiAhc2FtZVBsYWNlIHx8ICFzYW1lUm91dGVQYXJhbWV0ZXJzO1xuICB9XG5cbiAgaGFzQ2hhbmdlZEZyb20ob3RoZXI6IFZpc2l0KSB7XG4gICAgY29uc3Qgc2FtZU5vblJvdXRlUGFyYW1ldGVycyA9IF8uaXNFcXVhbChcbiAgICAgIHRoaXMucGxhY2VEZWZpbml0aW9uLmdldE5vblJvdXRlUGFyYW1ldGVycyh0aGlzKSxcbiAgICAgIHRoaXMucGxhY2VEZWZpbml0aW9uLmdldE5vblJvdXRlUGFyYW1ldGVycyhvdGhlcilcbiAgICApO1xuICAgIHJldHVybiAhc2FtZU5vblJvdXRlUGFyYW1ldGVycyB8fCB0aGlzLmhhc1JvdXRpbmdDaGFuZ2VkRnJvbShvdGhlcik7XG4gIH1cblxufVxuIl19
|
|
@@ -7,7 +7,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
|
7
7
|
import { GarbageCollector, assert, UnaryCommand, lang, Dsl, Logger, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, DelegatingValueModel, MutableStream, MutableListModel, DelegatingListModel, Binding, MutableValueModel, Trace, Guard as Guard$1, Command, StoreInValueModel, OptionsHelper, ValueHolder } from '@coolon/pectin';
|
|
8
8
|
import { __decorate, __metadata, __awaiter } from 'tslib';
|
|
9
9
|
import { PortalModule } from '@angular/cdk/portal';
|
|
10
|
-
import { Router, RouterModule,
|
|
10
|
+
import { Router, RouterModule, NavigationStart, NavigationEnd, NavigationError, UrlSerializer, UrlSegment, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
|
|
11
11
|
import ___default, { last, isNil, isEqual } from 'lodash';
|
|
12
12
|
import { assert as assert$1, Opts, Klass } from '@coolon/typescript-utilities';
|
|
13
13
|
import { MatDialogConfig, MAT_DIALOG_DEFAULT_OPTIONS, MatDialog as MatDialog$1 } from '@angular/material/dialog';
|
|
@@ -750,6 +750,21 @@ class InteractionContext extends GarbageCollector {
|
|
|
750
750
|
get currentActivity() {
|
|
751
751
|
return last(this.activityList.value);
|
|
752
752
|
}
|
|
753
|
+
/**
|
|
754
|
+
* @param {?} confirm
|
|
755
|
+
* @return {?}
|
|
756
|
+
*/
|
|
757
|
+
confirm(confirm) {
|
|
758
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
759
|
+
try {
|
|
760
|
+
yield this.confirmOrReject(confirm);
|
|
761
|
+
return true;
|
|
762
|
+
}
|
|
763
|
+
catch (_a) {
|
|
764
|
+
return false;
|
|
765
|
+
}
|
|
766
|
+
});
|
|
767
|
+
}
|
|
753
768
|
}
|
|
754
769
|
if (false) {
|
|
755
770
|
/**
|
|
@@ -777,7 +792,7 @@ if (false) {
|
|
|
777
792
|
* @param {?} confirm
|
|
778
793
|
* @return {?}
|
|
779
794
|
*/
|
|
780
|
-
InteractionContext.prototype.
|
|
795
|
+
InteractionContext.prototype.confirmOrReject = function (confirm) { };
|
|
781
796
|
/**
|
|
782
797
|
* Presents the confirmation to the user and runs the activity only if the user confirms.
|
|
783
798
|
* @abstract
|
|
@@ -1422,7 +1437,7 @@ class ActivityContainerComponent extends InteractionContext {
|
|
|
1422
1437
|
* @param {?} confirm
|
|
1423
1438
|
* @return {?}
|
|
1424
1439
|
*/
|
|
1425
|
-
|
|
1440
|
+
confirmOrReject(confirm) {
|
|
1426
1441
|
return this.startActivity(ConfirmationDialogComponent, confirm);
|
|
1427
1442
|
}
|
|
1428
1443
|
/**
|
|
@@ -1607,7 +1622,7 @@ class InplaceInteractionContextComponent extends InteractionContext {
|
|
|
1607
1622
|
* @param {?} confirm
|
|
1608
1623
|
* @return {?}
|
|
1609
1624
|
*/
|
|
1610
|
-
|
|
1625
|
+
confirmOrReject(confirm) {
|
|
1611
1626
|
return this._startActivity(ConfirmationDialogComponent, confirm);
|
|
1612
1627
|
}
|
|
1613
1628
|
/**
|
|
@@ -1903,7 +1918,7 @@ class DialogInteractionService extends InteractionContext {
|
|
|
1903
1918
|
* @param {?} confirm
|
|
1904
1919
|
* @return {?}
|
|
1905
1920
|
*/
|
|
1906
|
-
|
|
1921
|
+
confirmOrReject(confirm) {
|
|
1907
1922
|
return this._startActivity(ConfirmationDialogComponent, confirm, true);
|
|
1908
1923
|
}
|
|
1909
1924
|
/**
|
|
@@ -2343,20 +2358,15 @@ class PlaceDefinition {
|
|
|
2343
2358
|
return routeIdParameterDef ? visit.getParameter(routeIdParameterDef.name) : null;
|
|
2344
2359
|
}
|
|
2345
2360
|
/**
|
|
2346
|
-
* Returns angular router commands that specify the route id and any route parameters. The result does
|
|
2347
|
-
* not include any path information.
|
|
2348
2361
|
* @param {?} visit
|
|
2349
2362
|
* @return {?}
|
|
2350
2363
|
*/
|
|
2351
|
-
// getFormattedRouterCommands(visit: Visit): any[] {
|
|
2352
|
-
// return this.hasRouteId() ?
|
|
2353
|
-
// [this.getFormattedRouteId(visit), this.getFormattedRouteParameters(visit)] :
|
|
2354
|
-
// [this.getFormattedRouteParameters(visit)];
|
|
2355
|
-
// }
|
|
2356
2364
|
getFormattedRouteId(visit) {
|
|
2357
|
-
|
|
2365
|
+
// Note: RouteIds are always present in the url and are just empty strings when not defined. This is
|
|
2366
|
+
// mandated by the fact that redirects from <path> to <path>/:id always include the id parameter as
|
|
2367
|
+
// an empty string.
|
|
2368
|
+
return visit.hasRouteId() ? this.getRouteIdParameterDef().urlFormat.format(visit.getRouteId()) : "";
|
|
2358
2369
|
}
|
|
2359
|
-
// @Trace()
|
|
2360
2370
|
/**
|
|
2361
2371
|
* @param {?} visit
|
|
2362
2372
|
* @param {?=} includeRouteId
|
|
@@ -2441,15 +2451,17 @@ class PlaceDefinition {
|
|
|
2441
2451
|
}
|
|
2442
2452
|
else {
|
|
2443
2453
|
/** @type {?} */
|
|
2444
|
-
const value =
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2454
|
+
const value = params.get(def.name);
|
|
2455
|
+
if (def.isRouteId) { // TODO: Move this to parameter def so it's a strategy pattern
|
|
2456
|
+
// because our id routes redirect if the id isn't present we always have a id
|
|
2457
|
+
// parameter in our params. This will bugger our remember and defaultvalue sanitisation
|
|
2458
|
+
// as it'll see that the id is present (event thought its a blank string).
|
|
2459
|
+
if (!___default.isEmpty(value)) {
|
|
2460
|
+
result[def.name] = def.urlFormat.parse(value);
|
|
2461
|
+
}
|
|
2462
|
+
}
|
|
2463
|
+
else {
|
|
2464
|
+
result[def.name] = def.urlFormat.parse(value);
|
|
2453
2465
|
}
|
|
2454
2466
|
}
|
|
2455
2467
|
}
|
|
@@ -2736,8 +2748,10 @@ class Visit {
|
|
|
2736
2748
|
else {
|
|
2737
2749
|
// copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the
|
|
2738
2750
|
// defaults and remember sanitisation process.
|
|
2751
|
+
/** @type {?} */
|
|
2752
|
+
const value = this.getParameter(def.name);
|
|
2739
2753
|
if (this.hasParameter(def.name)) {
|
|
2740
|
-
params[def.name] =
|
|
2754
|
+
params[def.name] = value;
|
|
2741
2755
|
}
|
|
2742
2756
|
}
|
|
2743
2757
|
}));
|
|
@@ -2763,14 +2777,6 @@ class Visit {
|
|
|
2763
2777
|
const sameNonRouteParameters = isEqual(this.placeDefinition.getNonRouteParameters(this), this.placeDefinition.getNonRouteParameters(other));
|
|
2764
2778
|
return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);
|
|
2765
2779
|
}
|
|
2766
|
-
/**
|
|
2767
|
-
* @return {?}
|
|
2768
|
-
*/
|
|
2769
|
-
getUrlSegments() {
|
|
2770
|
-
return this.placeDefinition.hasRouteId() ?
|
|
2771
|
-
[new UrlSegment(this.placeDefinition.path, {}), new UrlSegment(this.placeDefinition.getFormattedRouteId(this), this.placeDefinition.getFormattedRouteParameters(this))] :
|
|
2772
|
-
[new UrlSegment(this.placeDefinition.path, this.placeDefinition.getFormattedRouteParameters(this))];
|
|
2773
|
-
}
|
|
2774
2780
|
}
|
|
2775
2781
|
if (false) {
|
|
2776
2782
|
/** @type {?} */
|
|
@@ -3013,12 +3019,14 @@ if (false) {
|
|
|
3013
3019
|
class PlaceRouter extends GarbageCollector {
|
|
3014
3020
|
/**
|
|
3015
3021
|
* @param {?} router
|
|
3022
|
+
* @param {?} urlSerializer
|
|
3016
3023
|
* @param {?} angularLocation
|
|
3017
3024
|
* @param {?} placeHistory
|
|
3018
3025
|
*/
|
|
3019
|
-
constructor(router, angularLocation, placeHistory) {
|
|
3026
|
+
constructor(router, urlSerializer, angularLocation, placeHistory) {
|
|
3020
3027
|
super();
|
|
3021
3028
|
this.router = router;
|
|
3029
|
+
this.urlSerializer = urlSerializer;
|
|
3022
3030
|
this.angularLocation = angularLocation;
|
|
3023
3031
|
this.placeHistory = placeHistory;
|
|
3024
3032
|
this.firstRoute = true;
|
|
@@ -3124,21 +3132,19 @@ class PlaceRouter extends GarbageCollector {
|
|
|
3124
3132
|
* @return {?}
|
|
3125
3133
|
*/
|
|
3126
3134
|
router => {
|
|
3127
|
-
// we have to to use the definition for route id as our redirection always includes
|
|
3128
|
-
// the id in the url segements (but leaves it blank when there's no id). I.e. in the
|
|
3129
|
-
// no id case we're doing the following redirect [<placePath>, ""] -> ["..", <id>]
|
|
3130
|
-
/** @type {?} */
|
|
3131
|
-
const relativePath = !!previous.placeDefinition.hasRouteId() ? '..' : '.';
|
|
3132
3135
|
/** @type {?} */
|
|
3133
|
-
const commands =
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3136
|
+
const commands = this.createUrlManipulator(this.router.routerState.snapshot).createRedirectCommandsFor(next);
|
|
3137
|
+
// // we have to to use the definition for route id as our redirection always includes
|
|
3138
|
+
// // the id in the url segements (but leaves it blank when there's no id). I.e. in the
|
|
3139
|
+
// // no id case we're doing the following redirect [<placePath>, ""] -> ["..", <id>]
|
|
3140
|
+
// const relativePath = !!previous.placeDefinition.hasRouteId() ? '..' : '.';
|
|
3141
|
+
// const commands = [
|
|
3142
|
+
// relativePath,
|
|
3143
|
+
// ...this.createRouteParameters(next),
|
|
3144
|
+
// ...this.extractChildPath(activatedRoute.snapshot)
|
|
3145
|
+
// ];
|
|
3146
|
+
console.log('### Push Changes to route Redirect', { commands });
|
|
3147
|
+
return router.navigate(commands);
|
|
3142
3148
|
}));
|
|
3143
3149
|
}
|
|
3144
3150
|
});
|
|
@@ -3224,6 +3230,13 @@ class PlaceRouter extends GarbageCollector {
|
|
|
3224
3230
|
*/
|
|
3225
3231
|
child => child.url)));
|
|
3226
3232
|
}
|
|
3233
|
+
/**
|
|
3234
|
+
* @param {?} snapshot
|
|
3235
|
+
* @return {?}
|
|
3236
|
+
*/
|
|
3237
|
+
createUrlManipulator(snapshot) {
|
|
3238
|
+
return new PlaceRouter.UrlManipulator(this.urlSerializer.parse(snapshot.url));
|
|
3239
|
+
}
|
|
3227
3240
|
}
|
|
3228
3241
|
PlaceRouter.decorators = [
|
|
3229
3242
|
{ type: Injectable, args: [{
|
|
@@ -3233,10 +3246,11 @@ PlaceRouter.decorators = [
|
|
|
3233
3246
|
/** @nocollapse */
|
|
3234
3247
|
PlaceRouter.ctorParameters = () => [
|
|
3235
3248
|
{ type: Router },
|
|
3249
|
+
{ type: UrlSerializer },
|
|
3236
3250
|
{ type: Location },
|
|
3237
3251
|
{ type: PlaceHistory }
|
|
3238
3252
|
];
|
|
3239
|
-
/** @nocollapse */ PlaceRouter.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(ɵɵinject(Router), ɵɵinject(Location), ɵɵinject(PlaceHistory)); }, token: PlaceRouter, providedIn: "root" });
|
|
3253
|
+
/** @nocollapse */ PlaceRouter.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(ɵɵinject(Router), ɵɵinject(UrlSerializer), ɵɵinject(Location), ɵɵinject(PlaceHistory)); }, token: PlaceRouter, providedIn: "root" });
|
|
3240
3254
|
__decorate([
|
|
3241
3255
|
Trace(),
|
|
3242
3256
|
__metadata("design:type", Function),
|
|
@@ -3268,11 +3282,107 @@ if (false) {
|
|
|
3268
3282
|
* @private
|
|
3269
3283
|
*/
|
|
3270
3284
|
PlaceRouter.prototype.router;
|
|
3285
|
+
/**
|
|
3286
|
+
* @type {?}
|
|
3287
|
+
* @private
|
|
3288
|
+
*/
|
|
3289
|
+
PlaceRouter.prototype.urlSerializer;
|
|
3271
3290
|
/** @type {?} */
|
|
3272
3291
|
PlaceRouter.prototype.angularLocation;
|
|
3273
3292
|
/** @type {?} */
|
|
3274
3293
|
PlaceRouter.prototype.placeHistory;
|
|
3275
3294
|
}
|
|
3295
|
+
(function (PlaceRouter) {
|
|
3296
|
+
class UrlManipulator {
|
|
3297
|
+
/**
|
|
3298
|
+
* @param {?} urlTree
|
|
3299
|
+
*/
|
|
3300
|
+
constructor(urlTree) {
|
|
3301
|
+
this.urlTree = urlTree;
|
|
3302
|
+
console.log({ segments: this.urlTree.root.children.primary.segments });
|
|
3303
|
+
}
|
|
3304
|
+
/**
|
|
3305
|
+
* @return {?}
|
|
3306
|
+
*/
|
|
3307
|
+
cloneUrlSegmentList() {
|
|
3308
|
+
return [...this.urlTree.root.children.primary.segments];
|
|
3309
|
+
}
|
|
3310
|
+
/**
|
|
3311
|
+
* @param {?} visit
|
|
3312
|
+
* @return {?}
|
|
3313
|
+
*/
|
|
3314
|
+
updateVisitSegments(visit) {
|
|
3315
|
+
// Ugly, but it works for now.
|
|
3316
|
+
/** @type {?} */
|
|
3317
|
+
const segments = this.cloneUrlSegmentList();
|
|
3318
|
+
/** @type {?} */
|
|
3319
|
+
const visitSegments = this.convertToUrlSegments(visit);
|
|
3320
|
+
/** @type {?} */
|
|
3321
|
+
const replaceAt = segments.findIndex((/**
|
|
3322
|
+
* @param {?} segment
|
|
3323
|
+
* @return {?}
|
|
3324
|
+
*/
|
|
3325
|
+
segment => segment.path === visitSegments[0].path));
|
|
3326
|
+
// do not use the return value, it's the items that were removed!
|
|
3327
|
+
segments.splice(replaceAt, visitSegments.length, ...visitSegments);
|
|
3328
|
+
return segments;
|
|
3329
|
+
}
|
|
3330
|
+
/**
|
|
3331
|
+
* Converts the visit into segments. Please not that these segments are not e
|
|
3332
|
+
* @param {?} visit
|
|
3333
|
+
* @return {?}
|
|
3334
|
+
*/
|
|
3335
|
+
convertToUrlSegments(visit) {
|
|
3336
|
+
return visit.placeDefinition.hasRouteId() ?
|
|
3337
|
+
[
|
|
3338
|
+
// NOTE:
|
|
3339
|
+
// It's important to attach the params to the root path and not the id. If we attach them
|
|
3340
|
+
// to an empty id then the angular router won't match the pattern.
|
|
3341
|
+
new UrlSegment(visit.placeDefinition.path, visit.placeDefinition.getFormattedRouteParameters(visit)),
|
|
3342
|
+
new UrlSegment(visit.placeDefinition.getFormattedRouteId(visit), {})
|
|
3343
|
+
]
|
|
3344
|
+
:
|
|
3345
|
+
[
|
|
3346
|
+
new UrlSegment(visit.placeDefinition.path, visit.placeDefinition.getFormattedRouteParameters(visit))
|
|
3347
|
+
];
|
|
3348
|
+
}
|
|
3349
|
+
/**
|
|
3350
|
+
* @param {?} visit
|
|
3351
|
+
* @return {?}
|
|
3352
|
+
*/
|
|
3353
|
+
createRedirectCommandsFor(visit) {
|
|
3354
|
+
/** @type {?} */
|
|
3355
|
+
const segments = this.updateVisitSegments(visit);
|
|
3356
|
+
/** @type {?} */
|
|
3357
|
+
const commands = [];
|
|
3358
|
+
segments.forEach((/**
|
|
3359
|
+
* @param {?} s
|
|
3360
|
+
* @return {?}
|
|
3361
|
+
*/
|
|
3362
|
+
s => {
|
|
3363
|
+
commands.push(s.path);
|
|
3364
|
+
if (s.parameterMap.keys.length > 0) {
|
|
3365
|
+
commands.push(s.parameters);
|
|
3366
|
+
}
|
|
3367
|
+
}));
|
|
3368
|
+
return commands;
|
|
3369
|
+
}
|
|
3370
|
+
}
|
|
3371
|
+
__decorate([
|
|
3372
|
+
Trace(),
|
|
3373
|
+
__metadata("design:type", Function),
|
|
3374
|
+
__metadata("design:paramtypes", [Visit]),
|
|
3375
|
+
__metadata("design:returntype", Array)
|
|
3376
|
+
], UrlManipulator.prototype, "createRedirectCommandsFor", null);
|
|
3377
|
+
PlaceRouter.UrlManipulator = UrlManipulator;
|
|
3378
|
+
if (false) {
|
|
3379
|
+
/**
|
|
3380
|
+
* @type {?}
|
|
3381
|
+
* @private
|
|
3382
|
+
*/
|
|
3383
|
+
UrlManipulator.prototype.urlTree;
|
|
3384
|
+
}
|
|
3385
|
+
})(PlaceRouter || (PlaceRouter = {}));
|
|
3276
3386
|
|
|
3277
3387
|
/**
|
|
3278
3388
|
* @fileoverview added by tsickle
|
|
@@ -4851,10 +4961,9 @@ class EnterPlaceGuard {
|
|
|
4851
4961
|
// Save the visit with any updated parameters. We need to save it so we remember any non route parameters
|
|
4852
4962
|
this.placeRouter.navigationSession.storeVisit(sanitisedVisit);
|
|
4853
4963
|
if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {
|
|
4854
|
-
/** @type {?} */
|
|
4855
|
-
const routerStateUrlTree = this.urlSerializer.parse(state.url);
|
|
4856
4964
|
// Regenerate the url
|
|
4857
|
-
|
|
4965
|
+
/** @type {?} */
|
|
4966
|
+
const commands = this.placeRouter.createUrlManipulator(state).createRedirectCommandsFor(sanitisedVisit);
|
|
4858
4967
|
console.log('##### Place Guard Redirect', commands);
|
|
4859
4968
|
return this.router.createUrlTree(commands, {
|
|
4860
4969
|
replaceUrl: true,
|
|
@@ -4870,40 +4979,6 @@ class EnterPlaceGuard {
|
|
|
4870
4979
|
}
|
|
4871
4980
|
});
|
|
4872
4981
|
}
|
|
4873
|
-
/**
|
|
4874
|
-
* @private
|
|
4875
|
-
* @param {?} sanitisedVisit
|
|
4876
|
-
* @param {?} path
|
|
4877
|
-
* @return {?}
|
|
4878
|
-
*/
|
|
4879
|
-
createRedirectCommands(sanitisedVisit, path) {
|
|
4880
|
-
// Ugly, but it works for now.
|
|
4881
|
-
/** @type {?} */
|
|
4882
|
-
const newSegments = sanitisedVisit.getUrlSegments();
|
|
4883
|
-
/** @type {?} */
|
|
4884
|
-
const replaceAt = path.findIndex((/**
|
|
4885
|
-
* @param {?} segment
|
|
4886
|
-
* @return {?}
|
|
4887
|
-
*/
|
|
4888
|
-
segment => segment.path === newSegments[0].path));
|
|
4889
|
-
/** @type {?} */
|
|
4890
|
-
const newPath = [...path];
|
|
4891
|
-
newPath.splice(replaceAt, newSegments.length, ...newSegments); // do not use the return value, it's the items that were removed!
|
|
4892
|
-
// do not use the return value, it's the items that were removed!
|
|
4893
|
-
/** @type {?} */
|
|
4894
|
-
const commands = [];
|
|
4895
|
-
newPath.forEach((/**
|
|
4896
|
-
* @param {?} s
|
|
4897
|
-
* @return {?}
|
|
4898
|
-
*/
|
|
4899
|
-
s => {
|
|
4900
|
-
commands.push(s.path);
|
|
4901
|
-
if (s.parameterMap.keys.length > 0) {
|
|
4902
|
-
commands.push(s.parameters);
|
|
4903
|
-
}
|
|
4904
|
-
}));
|
|
4905
|
-
return { newPath, commands };
|
|
4906
|
-
}
|
|
4907
4982
|
}
|
|
4908
4983
|
EnterPlaceGuard.decorators = [
|
|
4909
4984
|
{ type: Injectable, args: [{
|