@coolon/angular-ui-powerups 0.0.88 → 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 +291 -201
- 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/components/abstract-place-navigation.component.js +9 -2
- package/esm2015/lib/place/place-definition.js +16 -19
- package/esm2015/lib/place/place-router.js +122 -18
- package/esm2015/lib/place/place.module.js +6 -3
- 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/components/abstract-place-navigation.component.js +9 -2
- package/esm5/lib/place/place-definition.js +17 -39
- package/esm5/lib/place/place-router.js +143 -16
- package/esm5/lib/place/place.module.js +6 -3
- 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 +240 -156
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +279 -188
- 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,
|
|
8
|
-
import { assert, UnaryCommand, lang, Dsl, GarbageCollector, Logger, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, DelegatingValueModel, MutableStream, MutableListModel, DelegatingListModel,
|
|
7
|
+
import { __extends, __decorate, __metadata, __awaiter, __generator, __assign, __spread } from 'tslib';
|
|
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
|
*/
|
|
@@ -2477,78 +2504,6 @@ var InteractionModule = /** @class */ (function () {
|
|
|
2477
2504
|
return InteractionModule;
|
|
2478
2505
|
}());
|
|
2479
2506
|
|
|
2480
|
-
/**
|
|
2481
|
-
* @fileoverview added by tsickle
|
|
2482
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2483
|
-
*/
|
|
2484
|
-
var BusyOverlayComponent = /** @class */ (function () {
|
|
2485
|
-
function BusyOverlayComponent() {
|
|
2486
|
-
}
|
|
2487
|
-
/**
|
|
2488
|
-
* @return {?}
|
|
2489
|
-
*/
|
|
2490
|
-
BusyOverlayComponent.prototype.ngOnInit = /**
|
|
2491
|
-
* @return {?}
|
|
2492
|
-
*/
|
|
2493
|
-
function () {
|
|
2494
|
-
};
|
|
2495
|
-
BusyOverlayComponent.decorators = [
|
|
2496
|
-
{ type: Component, args: [{
|
|
2497
|
-
selector: 'aup-busy-overlay',
|
|
2498
|
-
template: "<ng-content></ng-content>\n<div class=\"busy-overlay-backdrop\" *ngIf=\"busyModel.value\">\n <mat-progress-spinner mode=\"indeterminate\" [diameter]=\"52\"></mat-progress-spinner>\n</div>\n",
|
|
2499
|
-
styles: [":host{position:relative}div.busy-overlay-backdrop{position:absolute;background-color:rgba(0,0,0,.2);top:0;left:0;bottom:0;right:0;display:-ms-grid;display:grid;-ms-grid-columns:auto;grid-template-columns:auto;-ms-grid-rows:auto;grid-template-rows:auto;place-content:center}"]
|
|
2500
|
-
}] }
|
|
2501
|
-
];
|
|
2502
|
-
/** @nocollapse */
|
|
2503
|
-
BusyOverlayComponent.ctorParameters = function () { return []; };
|
|
2504
|
-
BusyOverlayComponent.propDecorators = {
|
|
2505
|
-
busyModel: [{ type: Input }],
|
|
2506
|
-
busy: [{ type: Input }]
|
|
2507
|
-
};
|
|
2508
|
-
__decorate([
|
|
2509
|
-
UseDelegate(),
|
|
2510
|
-
__metadata("design:type", ValueModel)
|
|
2511
|
-
], BusyOverlayComponent.prototype, "busyModel", void 0);
|
|
2512
|
-
__decorate([
|
|
2513
|
-
StoreInValueModel('busyModel'),
|
|
2514
|
-
__metadata("design:type", Boolean)
|
|
2515
|
-
], BusyOverlayComponent.prototype, "busy", void 0);
|
|
2516
|
-
return BusyOverlayComponent;
|
|
2517
|
-
}());
|
|
2518
|
-
if (false) {
|
|
2519
|
-
/** @type {?} */
|
|
2520
|
-
BusyOverlayComponent.prototype.busyModel;
|
|
2521
|
-
/** @type {?} */
|
|
2522
|
-
BusyOverlayComponent.prototype.busy;
|
|
2523
|
-
}
|
|
2524
|
-
|
|
2525
|
-
/**
|
|
2526
|
-
* @fileoverview added by tsickle
|
|
2527
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2528
|
-
*/
|
|
2529
|
-
var EmptyStateComponent = /** @class */ (function () {
|
|
2530
|
-
function EmptyStateComponent() {
|
|
2531
|
-
}
|
|
2532
|
-
/**
|
|
2533
|
-
* @return {?}
|
|
2534
|
-
*/
|
|
2535
|
-
EmptyStateComponent.prototype.ngOnInit = /**
|
|
2536
|
-
* @return {?}
|
|
2537
|
-
*/
|
|
2538
|
-
function () {
|
|
2539
|
-
};
|
|
2540
|
-
EmptyStateComponent.decorators = [
|
|
2541
|
-
{ type: Component, args: [{
|
|
2542
|
-
selector: 'aup-empty-state',
|
|
2543
|
-
template: "\n <div class=\"container\">\n <ng-content></ng-content>\n </div>\n ",
|
|
2544
|
-
styles: [":host{display:flex;flex-direction:column;justify-content:center;align-items:center}.container{padding:var(--aup-default-padding);border:2px dashed rgba(0,0,0,.2);border-radius:5px;font-size:14px;font-weight:300}"]
|
|
2545
|
-
}] }
|
|
2546
|
-
];
|
|
2547
|
-
/** @nocollapse */
|
|
2548
|
-
EmptyStateComponent.ctorParameters = function () { return []; };
|
|
2549
|
-
return EmptyStateComponent;
|
|
2550
|
-
}());
|
|
2551
|
-
|
|
2552
2507
|
/**
|
|
2553
2508
|
* @fileoverview added by tsickle
|
|
2554
2509
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -2984,49 +2939,25 @@ var PlaceDefinition = /** @class */ (function () {
|
|
|
2984
2939
|
return routeIdParameterDef ? visit.getParameter(routeIdParameterDef.name) : null;
|
|
2985
2940
|
};
|
|
2986
2941
|
/**
|
|
2987
|
-
* Returns angular router commands that specify the route id and any route parameters. The result does
|
|
2988
|
-
* not include any path information.
|
|
2989
|
-
*/
|
|
2990
|
-
// getFormattedRouterCommands(visit: Visit): any[] {
|
|
2991
|
-
// return this.hasRouteId() ?
|
|
2992
|
-
// [this.getFormattedRouteId(visit), this.getFormattedRouteParameters(visit)] :
|
|
2993
|
-
// [this.getFormattedRouteParameters(visit)];
|
|
2994
|
-
// }
|
|
2995
|
-
/**
|
|
2996
|
-
* Returns angular router commands that specify the route id and any route parameters. The result does
|
|
2997
|
-
* not include any path information.
|
|
2998
2942
|
* @param {?} visit
|
|
2999
2943
|
* @return {?}
|
|
3000
2944
|
*/
|
|
3001
|
-
// getFormattedRouterCommands(visit: Visit): any[] {
|
|
3002
|
-
// return this.hasRouteId() ?
|
|
3003
|
-
// [this.getFormattedRouteId(visit), this.getFormattedRouteParameters(visit)] :
|
|
3004
|
-
// [this.getFormattedRouteParameters(visit)];
|
|
3005
|
-
// }
|
|
3006
2945
|
PlaceDefinition.prototype.getFormattedRouteId = /**
|
|
3007
|
-
* Returns angular router commands that specify the route id and any route parameters. The result does
|
|
3008
|
-
* not include any path information.
|
|
3009
2946
|
* @param {?} visit
|
|
3010
2947
|
* @return {?}
|
|
3011
2948
|
*/
|
|
3012
|
-
// getFormattedRouterCommands(visit: Visit): any[] {
|
|
3013
|
-
// return this.hasRouteId() ?
|
|
3014
|
-
// [this.getFormattedRouteId(visit), this.getFormattedRouteParameters(visit)] :
|
|
3015
|
-
// [this.getFormattedRouteParameters(visit)];
|
|
3016
|
-
// }
|
|
3017
2949
|
function (visit) {
|
|
3018
|
-
|
|
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()) : "";
|
|
3019
2954
|
};
|
|
3020
|
-
// @Trace()
|
|
3021
|
-
// @Trace()
|
|
3022
2955
|
/**
|
|
3023
2956
|
* @param {?} visit
|
|
3024
2957
|
* @param {?=} includeRouteId
|
|
3025
2958
|
* @return {?}
|
|
3026
2959
|
*/
|
|
3027
|
-
PlaceDefinition.prototype.getFormattedRouteParameters =
|
|
3028
|
-
// @Trace()
|
|
3029
|
-
/**
|
|
2960
|
+
PlaceDefinition.prototype.getFormattedRouteParameters = /**
|
|
3030
2961
|
* @param {?} visit
|
|
3031
2962
|
* @param {?=} includeRouteId
|
|
3032
2963
|
* @return {?}
|
|
@@ -3122,15 +3053,17 @@ var PlaceDefinition = /** @class */ (function () {
|
|
|
3122
3053
|
}
|
|
3123
3054
|
else {
|
|
3124
3055
|
/** @type {?} */
|
|
3125
|
-
var value =
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
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);
|
|
3134
3067
|
}
|
|
3135
3068
|
}
|
|
3136
3069
|
}
|
|
@@ -3500,8 +3433,10 @@ var Visit = /** @class */ (function () {
|
|
|
3500
3433
|
else {
|
|
3501
3434
|
// copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the
|
|
3502
3435
|
// defaults and remember sanitisation process.
|
|
3436
|
+
/** @type {?} */
|
|
3437
|
+
var value = _this.getParameter(def.name);
|
|
3503
3438
|
if (_this.hasParameter(def.name)) {
|
|
3504
|
-
params[def.name] =
|
|
3439
|
+
params[def.name] = value;
|
|
3505
3440
|
}
|
|
3506
3441
|
}
|
|
3507
3442
|
}));
|
|
@@ -3535,17 +3470,6 @@ var Visit = /** @class */ (function () {
|
|
|
3535
3470
|
var sameNonRouteParameters = isEqual(this.placeDefinition.getNonRouteParameters(this), this.placeDefinition.getNonRouteParameters(other));
|
|
3536
3471
|
return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);
|
|
3537
3472
|
};
|
|
3538
|
-
/**
|
|
3539
|
-
* @return {?}
|
|
3540
|
-
*/
|
|
3541
|
-
Visit.prototype.getUrlSegments = /**
|
|
3542
|
-
* @return {?}
|
|
3543
|
-
*/
|
|
3544
|
-
function () {
|
|
3545
|
-
return this.placeDefinition.hasRouteId() ?
|
|
3546
|
-
[new UrlSegment(this.placeDefinition.path, {}), new UrlSegment(this.placeDefinition.getFormattedRouteId(this), this.placeDefinition.getFormattedRouteParameters(this))] :
|
|
3547
|
-
[new UrlSegment(this.placeDefinition.path, this.placeDefinition.getFormattedRouteParameters(this))];
|
|
3548
|
-
};
|
|
3549
3473
|
return Visit;
|
|
3550
3474
|
}());
|
|
3551
3475
|
if (false) {
|
|
@@ -3847,9 +3771,10 @@ if (false) {
|
|
|
3847
3771
|
*/
|
|
3848
3772
|
var PlaceRouter = /** @class */ (function (_super) {
|
|
3849
3773
|
__extends(PlaceRouter, _super);
|
|
3850
|
-
function PlaceRouter(router, angularLocation, placeHistory) {
|
|
3774
|
+
function PlaceRouter(router, urlSerializer, angularLocation, placeHistory) {
|
|
3851
3775
|
var _this = _super.call(this) || this;
|
|
3852
3776
|
_this.router = router;
|
|
3777
|
+
_this.urlSerializer = urlSerializer;
|
|
3853
3778
|
_this.angularLocation = angularLocation;
|
|
3854
3779
|
_this.placeHistory = placeHistory;
|
|
3855
3780
|
_this.firstRoute = true;
|
|
@@ -4000,19 +3925,19 @@ var PlaceRouter = /** @class */ (function (_super) {
|
|
|
4000
3925
|
* @return {?}
|
|
4001
3926
|
*/
|
|
4002
3927
|
function (router) {
|
|
4003
|
-
// we have to to use the definition for route id as our redirection always includes
|
|
4004
|
-
// the id in the url segements (but leaves it blank when there's no id). I.e. in the
|
|
4005
|
-
// no id case we're doing the following redirect [<placePath>, ""] -> ["..", <id>]
|
|
4006
3928
|
/** @type {?} */
|
|
4007
|
-
var
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
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);
|
|
4016
3941
|
}))];
|
|
4017
3942
|
}
|
|
4018
3943
|
return [2 /*return*/];
|
|
@@ -4140,6 +4065,17 @@ var PlaceRouter = /** @class */ (function (_super) {
|
|
|
4140
4065
|
*/
|
|
4141
4066
|
function (child) { return child.url; })));
|
|
4142
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
|
+
};
|
|
4143
4079
|
PlaceRouter.decorators = [
|
|
4144
4080
|
{ type: Injectable, args: [{
|
|
4145
4081
|
providedIn: 'root'
|
|
@@ -4148,10 +4084,11 @@ var PlaceRouter = /** @class */ (function (_super) {
|
|
|
4148
4084
|
/** @nocollapse */
|
|
4149
4085
|
PlaceRouter.ctorParameters = function () { return [
|
|
4150
4086
|
{ type: Router },
|
|
4087
|
+
{ type: UrlSerializer },
|
|
4151
4088
|
{ type: Location },
|
|
4152
4089
|
{ type: PlaceHistory }
|
|
4153
4090
|
]; };
|
|
4154
|
-
/** @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" });
|
|
4155
4092
|
__decorate([
|
|
4156
4093
|
Trace(),
|
|
4157
4094
|
__metadata("design:type", Function),
|
|
@@ -4185,11 +4122,125 @@ if (false) {
|
|
|
4185
4122
|
* @private
|
|
4186
4123
|
*/
|
|
4187
4124
|
PlaceRouter.prototype.router;
|
|
4125
|
+
/**
|
|
4126
|
+
* @type {?}
|
|
4127
|
+
* @private
|
|
4128
|
+
*/
|
|
4129
|
+
PlaceRouter.prototype.urlSerializer;
|
|
4188
4130
|
/** @type {?} */
|
|
4189
4131
|
PlaceRouter.prototype.angularLocation;
|
|
4190
4132
|
/** @type {?} */
|
|
4191
4133
|
PlaceRouter.prototype.placeHistory;
|
|
4192
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 = {}));
|
|
4193
4244
|
|
|
4194
4245
|
/**
|
|
4195
4246
|
* @fileoverview added by tsickle
|
|
@@ -4752,6 +4803,13 @@ var AbstractPlaceNavigationComponent = /** @class */ (function (_super) {
|
|
|
4752
4803
|
*/
|
|
4753
4804
|
function () {
|
|
4754
4805
|
};
|
|
4806
|
+
AbstractPlaceNavigationComponent.decorators = [
|
|
4807
|
+
{ type: Component, args: [{
|
|
4808
|
+
template: ''
|
|
4809
|
+
}] }
|
|
4810
|
+
];
|
|
4811
|
+
/** @nocollapse */
|
|
4812
|
+
AbstractPlaceNavigationComponent.ctorParameters = function () { return []; };
|
|
4755
4813
|
AbstractPlaceNavigationComponent.propDecorators = {
|
|
4756
4814
|
places: [{ type: Input }],
|
|
4757
4815
|
placesModel: [{ type: Input }],
|
|
@@ -4799,6 +4857,78 @@ if (false) {
|
|
|
4799
4857
|
AbstractPlaceNavigationComponent.prototype.activePlaceDefinition;
|
|
4800
4858
|
}
|
|
4801
4859
|
|
|
4860
|
+
/**
|
|
4861
|
+
* @fileoverview added by tsickle
|
|
4862
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4863
|
+
*/
|
|
4864
|
+
var BusyOverlayComponent = /** @class */ (function () {
|
|
4865
|
+
function BusyOverlayComponent() {
|
|
4866
|
+
}
|
|
4867
|
+
/**
|
|
4868
|
+
* @return {?}
|
|
4869
|
+
*/
|
|
4870
|
+
BusyOverlayComponent.prototype.ngOnInit = /**
|
|
4871
|
+
* @return {?}
|
|
4872
|
+
*/
|
|
4873
|
+
function () {
|
|
4874
|
+
};
|
|
4875
|
+
BusyOverlayComponent.decorators = [
|
|
4876
|
+
{ type: Component, args: [{
|
|
4877
|
+
selector: 'aup-busy-overlay',
|
|
4878
|
+
template: "<ng-content></ng-content>\n<div class=\"busy-overlay-backdrop\" *ngIf=\"busyModel.value\">\n <mat-progress-spinner mode=\"indeterminate\" [diameter]=\"52\"></mat-progress-spinner>\n</div>\n",
|
|
4879
|
+
styles: [":host{position:relative}div.busy-overlay-backdrop{position:absolute;background-color:rgba(0,0,0,.2);top:0;left:0;bottom:0;right:0;display:-ms-grid;display:grid;-ms-grid-columns:auto;grid-template-columns:auto;-ms-grid-rows:auto;grid-template-rows:auto;place-content:center}"]
|
|
4880
|
+
}] }
|
|
4881
|
+
];
|
|
4882
|
+
/** @nocollapse */
|
|
4883
|
+
BusyOverlayComponent.ctorParameters = function () { return []; };
|
|
4884
|
+
BusyOverlayComponent.propDecorators = {
|
|
4885
|
+
busyModel: [{ type: Input }],
|
|
4886
|
+
busy: [{ type: Input }]
|
|
4887
|
+
};
|
|
4888
|
+
__decorate([
|
|
4889
|
+
UseDelegate(),
|
|
4890
|
+
__metadata("design:type", ValueModel)
|
|
4891
|
+
], BusyOverlayComponent.prototype, "busyModel", void 0);
|
|
4892
|
+
__decorate([
|
|
4893
|
+
StoreInValueModel('busyModel'),
|
|
4894
|
+
__metadata("design:type", Boolean)
|
|
4895
|
+
], BusyOverlayComponent.prototype, "busy", void 0);
|
|
4896
|
+
return BusyOverlayComponent;
|
|
4897
|
+
}());
|
|
4898
|
+
if (false) {
|
|
4899
|
+
/** @type {?} */
|
|
4900
|
+
BusyOverlayComponent.prototype.busyModel;
|
|
4901
|
+
/** @type {?} */
|
|
4902
|
+
BusyOverlayComponent.prototype.busy;
|
|
4903
|
+
}
|
|
4904
|
+
|
|
4905
|
+
/**
|
|
4906
|
+
* @fileoverview added by tsickle
|
|
4907
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4908
|
+
*/
|
|
4909
|
+
var EmptyStateComponent = /** @class */ (function () {
|
|
4910
|
+
function EmptyStateComponent() {
|
|
4911
|
+
}
|
|
4912
|
+
/**
|
|
4913
|
+
* @return {?}
|
|
4914
|
+
*/
|
|
4915
|
+
EmptyStateComponent.prototype.ngOnInit = /**
|
|
4916
|
+
* @return {?}
|
|
4917
|
+
*/
|
|
4918
|
+
function () {
|
|
4919
|
+
};
|
|
4920
|
+
EmptyStateComponent.decorators = [
|
|
4921
|
+
{ type: Component, args: [{
|
|
4922
|
+
selector: 'aup-empty-state',
|
|
4923
|
+
template: "\n <div class=\"container\">\n <ng-content></ng-content>\n </div>\n ",
|
|
4924
|
+
styles: [":host{display:flex;flex-direction:column;justify-content:center;align-items:center}.container{padding:var(--aup-default-padding);border:2px dashed rgba(0,0,0,.2);border-radius:5px;font-size:14px;font-weight:300}"]
|
|
4925
|
+
}] }
|
|
4926
|
+
];
|
|
4927
|
+
/** @nocollapse */
|
|
4928
|
+
EmptyStateComponent.ctorParameters = function () { return []; };
|
|
4929
|
+
return EmptyStateComponent;
|
|
4930
|
+
}());
|
|
4931
|
+
|
|
4802
4932
|
/**
|
|
4803
4933
|
* @fileoverview added by tsickle
|
|
4804
4934
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -4902,7 +5032,8 @@ var PlaceModule = /** @class */ (function () {
|
|
|
4902
5032
|
BusyOverlayComponent,
|
|
4903
5033
|
PlaceOutletComponent,
|
|
4904
5034
|
TabbedPlaceNavigationComponent,
|
|
4905
|
-
ListPlaceNavComponent
|
|
5035
|
+
ListPlaceNavComponent,
|
|
5036
|
+
AbstractPlaceNavigationComponent
|
|
4906
5037
|
],
|
|
4907
5038
|
entryComponents: [BusyOverlayComponent],
|
|
4908
5039
|
exports: [
|
|
@@ -4910,7 +5041,8 @@ var PlaceModule = /** @class */ (function () {
|
|
|
4910
5041
|
PlaceOutletComponent,
|
|
4911
5042
|
EmptyStateComponent,
|
|
4912
5043
|
TabbedPlaceNavigationComponent,
|
|
4913
|
-
ListPlaceNavComponent
|
|
5044
|
+
ListPlaceNavComponent,
|
|
5045
|
+
AbstractPlaceNavigationComponent
|
|
4914
5046
|
],
|
|
4915
5047
|
providers: [
|
|
4916
5048
|
// {provide: AUP_PLACE_CONFIG, useValue: {animationDuration: "2000ms"}}
|
|
@@ -5859,7 +5991,7 @@ var EnterPlaceGuard = /** @class */ (function () {
|
|
|
5859
5991
|
*/
|
|
5860
5992
|
function (activatedRoute, state) {
|
|
5861
5993
|
return __awaiter(this, void 0, void 0, function () {
|
|
5862
|
-
var placeDefinition, params, parsedParams, initialVisit, sanitiser, sanitisedVisit,
|
|
5994
|
+
var placeDefinition, params, parsedParams, initialVisit, sanitiser, sanitisedVisit, commands;
|
|
5863
5995
|
return __generator(this, function (_a) {
|
|
5864
5996
|
switch (_a.label) {
|
|
5865
5997
|
case 0:
|
|
@@ -5876,9 +6008,8 @@ var EnterPlaceGuard = /** @class */ (function () {
|
|
|
5876
6008
|
// Save the visit with any updated parameters. We need to save it so we remember any non route parameters
|
|
5877
6009
|
this.placeRouter.navigationSession.storeVisit(sanitisedVisit);
|
|
5878
6010
|
if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {
|
|
5879
|
-
routerStateUrlTree = this.urlSerializer.parse(state.url);
|
|
5880
6011
|
// Regenerate the url
|
|
5881
|
-
commands = this.
|
|
6012
|
+
commands = this.placeRouter.createUrlManipulator(state).createRedirectCommandsFor(sanitisedVisit);
|
|
5882
6013
|
console.log('##### Place Guard Redirect', commands);
|
|
5883
6014
|
return [2 /*return*/, this.router.createUrlTree(commands, {
|
|
5884
6015
|
replaceUrl: true,
|
|
@@ -5895,46 +6026,6 @@ var EnterPlaceGuard = /** @class */ (function () {
|
|
|
5895
6026
|
});
|
|
5896
6027
|
});
|
|
5897
6028
|
};
|
|
5898
|
-
/**
|
|
5899
|
-
* @private
|
|
5900
|
-
* @param {?} sanitisedVisit
|
|
5901
|
-
* @param {?} path
|
|
5902
|
-
* @return {?}
|
|
5903
|
-
*/
|
|
5904
|
-
EnterPlaceGuard.prototype.createRedirectCommands = /**
|
|
5905
|
-
* @private
|
|
5906
|
-
* @param {?} sanitisedVisit
|
|
5907
|
-
* @param {?} path
|
|
5908
|
-
* @return {?}
|
|
5909
|
-
*/
|
|
5910
|
-
function (sanitisedVisit, path) {
|
|
5911
|
-
// Ugly, but it works for now.
|
|
5912
|
-
/** @type {?} */
|
|
5913
|
-
var newSegments = sanitisedVisit.getUrlSegments();
|
|
5914
|
-
/** @type {?} */
|
|
5915
|
-
var replaceAt = path.findIndex((/**
|
|
5916
|
-
* @param {?} segment
|
|
5917
|
-
* @return {?}
|
|
5918
|
-
*/
|
|
5919
|
-
function (segment) { return segment.path === newSegments[0].path; }));
|
|
5920
|
-
/** @type {?} */
|
|
5921
|
-
var newPath = __spread(path);
|
|
5922
|
-
newPath.splice.apply(newPath, __spread([replaceAt, newSegments.length], newSegments)); // do not use the return value, it's the items that were removed!
|
|
5923
|
-
// do not use the return value, it's the items that were removed!
|
|
5924
|
-
/** @type {?} */
|
|
5925
|
-
var commands = [];
|
|
5926
|
-
newPath.forEach((/**
|
|
5927
|
-
* @param {?} s
|
|
5928
|
-
* @return {?}
|
|
5929
|
-
*/
|
|
5930
|
-
function (s) {
|
|
5931
|
-
commands.push(s.path);
|
|
5932
|
-
if (s.parameterMap.keys.length > 0) {
|
|
5933
|
-
commands.push(s.parameters);
|
|
5934
|
-
}
|
|
5935
|
-
}));
|
|
5936
|
-
return { newPath: newPath, commands: commands };
|
|
5937
|
-
};
|
|
5938
6029
|
EnterPlaceGuard.decorators = [
|
|
5939
6030
|
{ type: Injectable, args: [{
|
|
5940
6031
|
providedIn: 'root'
|