@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
|
@@ -4,10 +4,10 @@ import { FormsModule } from '@angular/forms';
|
|
|
4
4
|
import { MatInputModule, MatFormFieldModule, MatSelectModule, MatDialog, MatButtonModule, MatDialogModule, MatTabsModule as MatTabsModule$1, MatProgressSpinnerModule } from '@angular/material';
|
|
5
5
|
import { MatTabsModule } from '@angular/material/tabs';
|
|
6
6
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
7
|
-
import { __extends, __decorate, __metadata,
|
|
7
|
+
import { __extends, __decorate, __metadata, __awaiter, __generator, __assign, __spread } from 'tslib';
|
|
8
8
|
import { assert, UnaryCommand, lang, Dsl, GarbageCollector, Logger, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, DelegatingValueModel, MutableStream, MutableListModel, DelegatingListModel, Binding, MutableValueModel, Trace, Guard as Guard$1, Command, StoreInValueModel, OptionsHelper, ValueHolder } from '@coolon/pectin';
|
|
9
9
|
import { PortalModule } from '@angular/cdk/portal';
|
|
10
|
-
import { Router, RouterModule,
|
|
10
|
+
import { Router, RouterModule, NavigationStart, NavigationEnd, NavigationError, UrlSerializer, UrlSegment, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
|
|
11
11
|
import ___default, { last, isNil, isEqual } from 'lodash';
|
|
12
12
|
import { assert as assert$1, Opts, Klass } from '@coolon/typescript-utilities';
|
|
13
13
|
import { MatDialogConfig, MAT_DIALOG_DEFAULT_OPTIONS, MatDialog as MatDialog$1 } from '@angular/material/dialog';
|
|
@@ -911,6 +911,33 @@ InteractionContext = /** @class */ (function (_super) {
|
|
|
911
911
|
enumerable: true,
|
|
912
912
|
configurable: true
|
|
913
913
|
});
|
|
914
|
+
/**
|
|
915
|
+
* @param {?} confirm
|
|
916
|
+
* @return {?}
|
|
917
|
+
*/
|
|
918
|
+
InteractionContext.prototype.confirm = /**
|
|
919
|
+
* @param {?} confirm
|
|
920
|
+
* @return {?}
|
|
921
|
+
*/
|
|
922
|
+
function (confirm) {
|
|
923
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
924
|
+
var _a;
|
|
925
|
+
return __generator(this, function (_b) {
|
|
926
|
+
switch (_b.label) {
|
|
927
|
+
case 0:
|
|
928
|
+
_b.trys.push([0, 2, , 3]);
|
|
929
|
+
return [4 /*yield*/, this.confirmOrReject(confirm)];
|
|
930
|
+
case 1:
|
|
931
|
+
_b.sent();
|
|
932
|
+
return [2 /*return*/, true];
|
|
933
|
+
case 2:
|
|
934
|
+
_a = _b.sent();
|
|
935
|
+
return [2 /*return*/, false];
|
|
936
|
+
case 3: return [2 /*return*/];
|
|
937
|
+
}
|
|
938
|
+
});
|
|
939
|
+
});
|
|
940
|
+
};
|
|
914
941
|
return InteractionContext;
|
|
915
942
|
}(GarbageCollector));
|
|
916
943
|
if (false) {
|
|
@@ -939,7 +966,7 @@ if (false) {
|
|
|
939
966
|
* @param {?} confirm
|
|
940
967
|
* @return {?}
|
|
941
968
|
*/
|
|
942
|
-
InteractionContext.prototype.
|
|
969
|
+
InteractionContext.prototype.confirmOrReject = function (confirm) { };
|
|
943
970
|
/**
|
|
944
971
|
* Presents the confirmation to the user and runs the activity only if the user confirms.
|
|
945
972
|
* @abstract
|
|
@@ -1727,7 +1754,7 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
|
|
|
1727
1754
|
* @param {?} confirm
|
|
1728
1755
|
* @return {?}
|
|
1729
1756
|
*/
|
|
1730
|
-
ActivityContainerComponent.prototype.
|
|
1757
|
+
ActivityContainerComponent.prototype.confirmOrReject = /**
|
|
1731
1758
|
* @param {?} confirm
|
|
1732
1759
|
* @return {?}
|
|
1733
1760
|
*/
|
|
@@ -1983,7 +2010,7 @@ var InplaceInteractionContextComponent = /** @class */ (function (_super) {
|
|
|
1983
2010
|
* @param {?} confirm
|
|
1984
2011
|
* @return {?}
|
|
1985
2012
|
*/
|
|
1986
|
-
InplaceInteractionContextComponent.prototype.
|
|
2013
|
+
InplaceInteractionContextComponent.prototype.confirmOrReject = /**
|
|
1987
2014
|
* @param {?} confirm
|
|
1988
2015
|
* @return {?}
|
|
1989
2016
|
*/
|
|
@@ -2359,7 +2386,7 @@ var DialogInteractionService = /** @class */ (function (_super) {
|
|
|
2359
2386
|
* @param {?} confirm
|
|
2360
2387
|
* @return {?}
|
|
2361
2388
|
*/
|
|
2362
|
-
DialogInteractionService.prototype.
|
|
2389
|
+
DialogInteractionService.prototype.confirmOrReject = /**
|
|
2363
2390
|
* @param {?} confirm
|
|
2364
2391
|
* @return {?}
|
|
2365
2392
|
*/
|
|
@@ -2912,49 +2939,25 @@ var PlaceDefinition = /** @class */ (function () {
|
|
|
2912
2939
|
return routeIdParameterDef ? visit.getParameter(routeIdParameterDef.name) : null;
|
|
2913
2940
|
};
|
|
2914
2941
|
/**
|
|
2915
|
-
* Returns angular router commands that specify the route id and any route parameters. The result does
|
|
2916
|
-
* not include any path information.
|
|
2917
|
-
*/
|
|
2918
|
-
// getFormattedRouterCommands(visit: Visit): any[] {
|
|
2919
|
-
// return this.hasRouteId() ?
|
|
2920
|
-
// [this.getFormattedRouteId(visit), this.getFormattedRouteParameters(visit)] :
|
|
2921
|
-
// [this.getFormattedRouteParameters(visit)];
|
|
2922
|
-
// }
|
|
2923
|
-
/**
|
|
2924
|
-
* Returns angular router commands that specify the route id and any route parameters. The result does
|
|
2925
|
-
* not include any path information.
|
|
2926
2942
|
* @param {?} visit
|
|
2927
2943
|
* @return {?}
|
|
2928
2944
|
*/
|
|
2929
|
-
// getFormattedRouterCommands(visit: Visit): any[] {
|
|
2930
|
-
// return this.hasRouteId() ?
|
|
2931
|
-
// [this.getFormattedRouteId(visit), this.getFormattedRouteParameters(visit)] :
|
|
2932
|
-
// [this.getFormattedRouteParameters(visit)];
|
|
2933
|
-
// }
|
|
2934
2945
|
PlaceDefinition.prototype.getFormattedRouteId = /**
|
|
2935
|
-
* Returns angular router commands that specify the route id and any route parameters. The result does
|
|
2936
|
-
* not include any path information.
|
|
2937
2946
|
* @param {?} visit
|
|
2938
2947
|
* @return {?}
|
|
2939
2948
|
*/
|
|
2940
|
-
// getFormattedRouterCommands(visit: Visit): any[] {
|
|
2941
|
-
// return this.hasRouteId() ?
|
|
2942
|
-
// [this.getFormattedRouteId(visit), this.getFormattedRouteParameters(visit)] :
|
|
2943
|
-
// [this.getFormattedRouteParameters(visit)];
|
|
2944
|
-
// }
|
|
2945
2949
|
function (visit) {
|
|
2946
|
-
|
|
2950
|
+
// Note: RouteIds are always present in the url and are just empty strings when not defined. This is
|
|
2951
|
+
// mandated by the fact that redirects from <path> to <path>/:id always include the id parameter as
|
|
2952
|
+
// an empty string.
|
|
2953
|
+
return visit.hasRouteId() ? this.getRouteIdParameterDef().urlFormat.format(visit.getRouteId()) : "";
|
|
2947
2954
|
};
|
|
2948
|
-
// @Trace()
|
|
2949
|
-
// @Trace()
|
|
2950
2955
|
/**
|
|
2951
2956
|
* @param {?} visit
|
|
2952
2957
|
* @param {?=} includeRouteId
|
|
2953
2958
|
* @return {?}
|
|
2954
2959
|
*/
|
|
2955
|
-
PlaceDefinition.prototype.getFormattedRouteParameters =
|
|
2956
|
-
// @Trace()
|
|
2957
|
-
/**
|
|
2960
|
+
PlaceDefinition.prototype.getFormattedRouteParameters = /**
|
|
2958
2961
|
* @param {?} visit
|
|
2959
2962
|
* @param {?=} includeRouteId
|
|
2960
2963
|
* @return {?}
|
|
@@ -3050,15 +3053,17 @@ var PlaceDefinition = /** @class */ (function () {
|
|
|
3050
3053
|
}
|
|
3051
3054
|
else {
|
|
3052
3055
|
/** @type {?} */
|
|
3053
|
-
var value =
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3056
|
+
var value = params.get(def.name);
|
|
3057
|
+
if (def.isRouteId) { // TODO: Move this to parameter def so it's a strategy pattern
|
|
3058
|
+
// because our id routes redirect if the id isn't present we always have a id
|
|
3059
|
+
// parameter in our params. This will bugger our remember and defaultvalue sanitisation
|
|
3060
|
+
// as it'll see that the id is present (event thought its a blank string).
|
|
3061
|
+
if (!___default.isEmpty(value)) {
|
|
3062
|
+
result[def.name] = def.urlFormat.parse(value);
|
|
3063
|
+
}
|
|
3064
|
+
}
|
|
3065
|
+
else {
|
|
3066
|
+
result[def.name] = def.urlFormat.parse(value);
|
|
3062
3067
|
}
|
|
3063
3068
|
}
|
|
3064
3069
|
}
|
|
@@ -3428,8 +3433,10 @@ var Visit = /** @class */ (function () {
|
|
|
3428
3433
|
else {
|
|
3429
3434
|
// copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the
|
|
3430
3435
|
// defaults and remember sanitisation process.
|
|
3436
|
+
/** @type {?} */
|
|
3437
|
+
var value = _this.getParameter(def.name);
|
|
3431
3438
|
if (_this.hasParameter(def.name)) {
|
|
3432
|
-
params[def.name] =
|
|
3439
|
+
params[def.name] = value;
|
|
3433
3440
|
}
|
|
3434
3441
|
}
|
|
3435
3442
|
}));
|
|
@@ -3463,17 +3470,6 @@ var Visit = /** @class */ (function () {
|
|
|
3463
3470
|
var sameNonRouteParameters = isEqual(this.placeDefinition.getNonRouteParameters(this), this.placeDefinition.getNonRouteParameters(other));
|
|
3464
3471
|
return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);
|
|
3465
3472
|
};
|
|
3466
|
-
/**
|
|
3467
|
-
* @return {?}
|
|
3468
|
-
*/
|
|
3469
|
-
Visit.prototype.getUrlSegments = /**
|
|
3470
|
-
* @return {?}
|
|
3471
|
-
*/
|
|
3472
|
-
function () {
|
|
3473
|
-
return this.placeDefinition.hasRouteId() ?
|
|
3474
|
-
[new UrlSegment(this.placeDefinition.path, {}), new UrlSegment(this.placeDefinition.getFormattedRouteId(this), this.placeDefinition.getFormattedRouteParameters(this))] :
|
|
3475
|
-
[new UrlSegment(this.placeDefinition.path, this.placeDefinition.getFormattedRouteParameters(this))];
|
|
3476
|
-
};
|
|
3477
3473
|
return Visit;
|
|
3478
3474
|
}());
|
|
3479
3475
|
if (false) {
|
|
@@ -3775,9 +3771,10 @@ if (false) {
|
|
|
3775
3771
|
*/
|
|
3776
3772
|
var PlaceRouter = /** @class */ (function (_super) {
|
|
3777
3773
|
__extends(PlaceRouter, _super);
|
|
3778
|
-
function PlaceRouter(router, angularLocation, placeHistory) {
|
|
3774
|
+
function PlaceRouter(router, urlSerializer, angularLocation, placeHistory) {
|
|
3779
3775
|
var _this = _super.call(this) || this;
|
|
3780
3776
|
_this.router = router;
|
|
3777
|
+
_this.urlSerializer = urlSerializer;
|
|
3781
3778
|
_this.angularLocation = angularLocation;
|
|
3782
3779
|
_this.placeHistory = placeHistory;
|
|
3783
3780
|
_this.firstRoute = true;
|
|
@@ -3928,19 +3925,19 @@ var PlaceRouter = /** @class */ (function (_super) {
|
|
|
3928
3925
|
* @return {?}
|
|
3929
3926
|
*/
|
|
3930
3927
|
function (router) {
|
|
3931
|
-
// we have to to use the definition for route id as our redirection always includes
|
|
3932
|
-
// the id in the url segements (but leaves it blank when there's no id). I.e. in the
|
|
3933
|
-
// no id case we're doing the following redirect [<placePath>, ""] -> ["..", <id>]
|
|
3934
|
-
/** @type {?} */
|
|
3935
|
-
var relativePath = !!previous.placeDefinition.hasRouteId() ? '..' : '.';
|
|
3936
3928
|
/** @type {?} */
|
|
3937
|
-
var commands =
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3929
|
+
var commands = _this.createUrlManipulator(_this.router.routerState.snapshot).createRedirectCommandsFor(next);
|
|
3930
|
+
// // we have to to use the definition for route id as our redirection always includes
|
|
3931
|
+
// // the id in the url segements (but leaves it blank when there's no id). I.e. in the
|
|
3932
|
+
// // no id case we're doing the following redirect [<placePath>, ""] -> ["..", <id>]
|
|
3933
|
+
// const relativePath = !!previous.placeDefinition.hasRouteId() ? '..' : '.';
|
|
3934
|
+
// const commands = [
|
|
3935
|
+
// relativePath,
|
|
3936
|
+
// ...this.createRouteParameters(next),
|
|
3937
|
+
// ...this.extractChildPath(activatedRoute.snapshot)
|
|
3938
|
+
// ];
|
|
3939
|
+
console.log('### Push Changes to route Redirect', { commands: commands });
|
|
3940
|
+
return router.navigate(commands);
|
|
3944
3941
|
}))];
|
|
3945
3942
|
}
|
|
3946
3943
|
return [2 /*return*/];
|
|
@@ -4068,6 +4065,17 @@ var PlaceRouter = /** @class */ (function (_super) {
|
|
|
4068
4065
|
*/
|
|
4069
4066
|
function (child) { return child.url; })));
|
|
4070
4067
|
};
|
|
4068
|
+
/**
|
|
4069
|
+
* @param {?} snapshot
|
|
4070
|
+
* @return {?}
|
|
4071
|
+
*/
|
|
4072
|
+
PlaceRouter.prototype.createUrlManipulator = /**
|
|
4073
|
+
* @param {?} snapshot
|
|
4074
|
+
* @return {?}
|
|
4075
|
+
*/
|
|
4076
|
+
function (snapshot) {
|
|
4077
|
+
return new PlaceRouter.UrlManipulator(this.urlSerializer.parse(snapshot.url));
|
|
4078
|
+
};
|
|
4071
4079
|
PlaceRouter.decorators = [
|
|
4072
4080
|
{ type: Injectable, args: [{
|
|
4073
4081
|
providedIn: 'root'
|
|
@@ -4076,10 +4084,11 @@ var PlaceRouter = /** @class */ (function (_super) {
|
|
|
4076
4084
|
/** @nocollapse */
|
|
4077
4085
|
PlaceRouter.ctorParameters = function () { return [
|
|
4078
4086
|
{ type: Router },
|
|
4087
|
+
{ type: UrlSerializer },
|
|
4079
4088
|
{ type: Location },
|
|
4080
4089
|
{ type: PlaceHistory }
|
|
4081
4090
|
]; };
|
|
4082
|
-
/** @nocollapse */ PlaceRouter.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(ɵɵinject(Router), ɵɵinject(Location), ɵɵinject(PlaceHistory)); }, token: PlaceRouter, providedIn: "root" });
|
|
4091
|
+
/** @nocollapse */ PlaceRouter.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(ɵɵinject(Router), ɵɵinject(UrlSerializer), ɵɵinject(Location), ɵɵinject(PlaceHistory)); }, token: PlaceRouter, providedIn: "root" });
|
|
4083
4092
|
__decorate([
|
|
4084
4093
|
Trace(),
|
|
4085
4094
|
__metadata("design:type", Function),
|
|
@@ -4113,11 +4122,125 @@ if (false) {
|
|
|
4113
4122
|
* @private
|
|
4114
4123
|
*/
|
|
4115
4124
|
PlaceRouter.prototype.router;
|
|
4125
|
+
/**
|
|
4126
|
+
* @type {?}
|
|
4127
|
+
* @private
|
|
4128
|
+
*/
|
|
4129
|
+
PlaceRouter.prototype.urlSerializer;
|
|
4116
4130
|
/** @type {?} */
|
|
4117
4131
|
PlaceRouter.prototype.angularLocation;
|
|
4118
4132
|
/** @type {?} */
|
|
4119
4133
|
PlaceRouter.prototype.placeHistory;
|
|
4120
4134
|
}
|
|
4135
|
+
(function (PlaceRouter) {
|
|
4136
|
+
var UrlManipulator = /** @class */ (function () {
|
|
4137
|
+
function UrlManipulator(urlTree) {
|
|
4138
|
+
this.urlTree = urlTree;
|
|
4139
|
+
console.log({ segments: this.urlTree.root.children.primary.segments });
|
|
4140
|
+
}
|
|
4141
|
+
/**
|
|
4142
|
+
* @return {?}
|
|
4143
|
+
*/
|
|
4144
|
+
UrlManipulator.prototype.cloneUrlSegmentList = /**
|
|
4145
|
+
* @return {?}
|
|
4146
|
+
*/
|
|
4147
|
+
function () {
|
|
4148
|
+
return __spread(this.urlTree.root.children.primary.segments);
|
|
4149
|
+
};
|
|
4150
|
+
/**
|
|
4151
|
+
* @param {?} visit
|
|
4152
|
+
* @return {?}
|
|
4153
|
+
*/
|
|
4154
|
+
UrlManipulator.prototype.updateVisitSegments = /**
|
|
4155
|
+
* @param {?} visit
|
|
4156
|
+
* @return {?}
|
|
4157
|
+
*/
|
|
4158
|
+
function (visit) {
|
|
4159
|
+
// Ugly, but it works for now.
|
|
4160
|
+
/** @type {?} */
|
|
4161
|
+
var segments = this.cloneUrlSegmentList();
|
|
4162
|
+
/** @type {?} */
|
|
4163
|
+
var visitSegments = this.convertToUrlSegments(visit);
|
|
4164
|
+
/** @type {?} */
|
|
4165
|
+
var replaceAt = segments.findIndex((/**
|
|
4166
|
+
* @param {?} segment
|
|
4167
|
+
* @return {?}
|
|
4168
|
+
*/
|
|
4169
|
+
function (segment) { return segment.path === visitSegments[0].path; }));
|
|
4170
|
+
// do not use the return value, it's the items that were removed!
|
|
4171
|
+
segments.splice.apply(segments, __spread([replaceAt, visitSegments.length], visitSegments));
|
|
4172
|
+
return segments;
|
|
4173
|
+
};
|
|
4174
|
+
/**
|
|
4175
|
+
* Converts the visit into segments. Please not that these segments are not e
|
|
4176
|
+
* @param visit
|
|
4177
|
+
*/
|
|
4178
|
+
/**
|
|
4179
|
+
* Converts the visit into segments. Please not that these segments are not e
|
|
4180
|
+
* @param {?} visit
|
|
4181
|
+
* @return {?}
|
|
4182
|
+
*/
|
|
4183
|
+
UrlManipulator.prototype.convertToUrlSegments = /**
|
|
4184
|
+
* Converts the visit into segments. Please not that these segments are not e
|
|
4185
|
+
* @param {?} visit
|
|
4186
|
+
* @return {?}
|
|
4187
|
+
*/
|
|
4188
|
+
function (visit) {
|
|
4189
|
+
return visit.placeDefinition.hasRouteId() ?
|
|
4190
|
+
[
|
|
4191
|
+
// NOTE:
|
|
4192
|
+
// It's important to attach the params to the root path and not the id. If we attach them
|
|
4193
|
+
// to an empty id then the angular router won't match the pattern.
|
|
4194
|
+
new UrlSegment(visit.placeDefinition.path, visit.placeDefinition.getFormattedRouteParameters(visit)),
|
|
4195
|
+
new UrlSegment(visit.placeDefinition.getFormattedRouteId(visit), {})
|
|
4196
|
+
]
|
|
4197
|
+
:
|
|
4198
|
+
[
|
|
4199
|
+
new UrlSegment(visit.placeDefinition.path, visit.placeDefinition.getFormattedRouteParameters(visit))
|
|
4200
|
+
];
|
|
4201
|
+
};
|
|
4202
|
+
/**
|
|
4203
|
+
* @param {?} visit
|
|
4204
|
+
* @return {?}
|
|
4205
|
+
*/
|
|
4206
|
+
UrlManipulator.prototype.createRedirectCommandsFor = /**
|
|
4207
|
+
* @param {?} visit
|
|
4208
|
+
* @return {?}
|
|
4209
|
+
*/
|
|
4210
|
+
function (visit) {
|
|
4211
|
+
/** @type {?} */
|
|
4212
|
+
var segments = this.updateVisitSegments(visit);
|
|
4213
|
+
/** @type {?} */
|
|
4214
|
+
var commands = [];
|
|
4215
|
+
segments.forEach((/**
|
|
4216
|
+
* @param {?} s
|
|
4217
|
+
* @return {?}
|
|
4218
|
+
*/
|
|
4219
|
+
function (s) {
|
|
4220
|
+
commands.push(s.path);
|
|
4221
|
+
if (s.parameterMap.keys.length > 0) {
|
|
4222
|
+
commands.push(s.parameters);
|
|
4223
|
+
}
|
|
4224
|
+
}));
|
|
4225
|
+
return commands;
|
|
4226
|
+
};
|
|
4227
|
+
__decorate([
|
|
4228
|
+
Trace(),
|
|
4229
|
+
__metadata("design:type", Function),
|
|
4230
|
+
__metadata("design:paramtypes", [Visit]),
|
|
4231
|
+
__metadata("design:returntype", Array)
|
|
4232
|
+
], UrlManipulator.prototype, "createRedirectCommandsFor", null);
|
|
4233
|
+
return UrlManipulator;
|
|
4234
|
+
}());
|
|
4235
|
+
PlaceRouter.UrlManipulator = UrlManipulator;
|
|
4236
|
+
if (false) {
|
|
4237
|
+
/**
|
|
4238
|
+
* @type {?}
|
|
4239
|
+
* @private
|
|
4240
|
+
*/
|
|
4241
|
+
UrlManipulator.prototype.urlTree;
|
|
4242
|
+
}
|
|
4243
|
+
})(PlaceRouter || (PlaceRouter = {}));
|
|
4121
4244
|
|
|
4122
4245
|
/**
|
|
4123
4246
|
* @fileoverview added by tsickle
|
|
@@ -5868,7 +5991,7 @@ var EnterPlaceGuard = /** @class */ (function () {
|
|
|
5868
5991
|
*/
|
|
5869
5992
|
function (activatedRoute, state) {
|
|
5870
5993
|
return __awaiter(this, void 0, void 0, function () {
|
|
5871
|
-
var placeDefinition, params, parsedParams, initialVisit, sanitiser, sanitisedVisit,
|
|
5994
|
+
var placeDefinition, params, parsedParams, initialVisit, sanitiser, sanitisedVisit, commands;
|
|
5872
5995
|
return __generator(this, function (_a) {
|
|
5873
5996
|
switch (_a.label) {
|
|
5874
5997
|
case 0:
|
|
@@ -5885,9 +6008,8 @@ var EnterPlaceGuard = /** @class */ (function () {
|
|
|
5885
6008
|
// Save the visit with any updated parameters. We need to save it so we remember any non route parameters
|
|
5886
6009
|
this.placeRouter.navigationSession.storeVisit(sanitisedVisit);
|
|
5887
6010
|
if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {
|
|
5888
|
-
routerStateUrlTree = this.urlSerializer.parse(state.url);
|
|
5889
6011
|
// Regenerate the url
|
|
5890
|
-
commands = this.
|
|
6012
|
+
commands = this.placeRouter.createUrlManipulator(state).createRedirectCommandsFor(sanitisedVisit);
|
|
5891
6013
|
console.log('##### Place Guard Redirect', commands);
|
|
5892
6014
|
return [2 /*return*/, this.router.createUrlTree(commands, {
|
|
5893
6015
|
replaceUrl: true,
|
|
@@ -5904,46 +6026,6 @@ var EnterPlaceGuard = /** @class */ (function () {
|
|
|
5904
6026
|
});
|
|
5905
6027
|
});
|
|
5906
6028
|
};
|
|
5907
|
-
/**
|
|
5908
|
-
* @private
|
|
5909
|
-
* @param {?} sanitisedVisit
|
|
5910
|
-
* @param {?} path
|
|
5911
|
-
* @return {?}
|
|
5912
|
-
*/
|
|
5913
|
-
EnterPlaceGuard.prototype.createRedirectCommands = /**
|
|
5914
|
-
* @private
|
|
5915
|
-
* @param {?} sanitisedVisit
|
|
5916
|
-
* @param {?} path
|
|
5917
|
-
* @return {?}
|
|
5918
|
-
*/
|
|
5919
|
-
function (sanitisedVisit, path) {
|
|
5920
|
-
// Ugly, but it works for now.
|
|
5921
|
-
/** @type {?} */
|
|
5922
|
-
var newSegments = sanitisedVisit.getUrlSegments();
|
|
5923
|
-
/** @type {?} */
|
|
5924
|
-
var replaceAt = path.findIndex((/**
|
|
5925
|
-
* @param {?} segment
|
|
5926
|
-
* @return {?}
|
|
5927
|
-
*/
|
|
5928
|
-
function (segment) { return segment.path === newSegments[0].path; }));
|
|
5929
|
-
/** @type {?} */
|
|
5930
|
-
var newPath = __spread(path);
|
|
5931
|
-
newPath.splice.apply(newPath, __spread([replaceAt, newSegments.length], newSegments)); // do not use the return value, it's the items that were removed!
|
|
5932
|
-
// do not use the return value, it's the items that were removed!
|
|
5933
|
-
/** @type {?} */
|
|
5934
|
-
var commands = [];
|
|
5935
|
-
newPath.forEach((/**
|
|
5936
|
-
* @param {?} s
|
|
5937
|
-
* @return {?}
|
|
5938
|
-
*/
|
|
5939
|
-
function (s) {
|
|
5940
|
-
commands.push(s.path);
|
|
5941
|
-
if (s.parameterMap.keys.length > 0) {
|
|
5942
|
-
commands.push(s.parameters);
|
|
5943
|
-
}
|
|
5944
|
-
}));
|
|
5945
|
-
return { newPath: newPath, commands: commands };
|
|
5946
|
-
};
|
|
5947
6029
|
EnterPlaceGuard.decorators = [
|
|
5948
6030
|
{ type: Injectable, args: [{
|
|
5949
6031
|
providedIn: 'root'
|