@coolon/angular-ui-powerups 0.0.44 → 0.0.46
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 +545 -218
- 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/place/components/place-outlet/place-outlet.component.js +17 -12
- package/esm2015/lib/place/guards/place-route.guard.js +4 -4
- package/esm2015/lib/place/index.js +1 -2
- package/esm2015/lib/place/place-component.js +2 -2
- package/esm2015/lib/place/place-history.js +29 -6
- package/esm2015/lib/place/place-router.js +38 -23
- package/esm2015/lib/place/route/parameter-decorators.js +1 -1
- package/esm2015/lib/place/route/parameter-definition.class.js +92 -9
- package/esm2015/lib/place/route/parameter-sanitiser.js +4 -3
- package/esm2015/lib/place/route/parameter-snapshot.js +221 -23
- package/esm2015/lib/place/route/route-parameter-sanitiser.js +2 -2
- package/esm2015/lib/place/visit.js +3 -3
- 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/place/components/place-outlet/place-outlet.component.js +17 -12
- package/esm5/lib/place/guards/place-route.guard.js +4 -4
- package/esm5/lib/place/index.js +1 -2
- package/esm5/lib/place/place-component.js +2 -2
- package/esm5/lib/place/place-history.js +39 -6
- package/esm5/lib/place/place-router.js +45 -28
- package/esm5/lib/place/route/parameter-decorators.js +1 -1
- package/esm5/lib/place/route/parameter-definition.class.js +104 -9
- package/esm5/lib/place/route/parameter-sanitiser.js +4 -3
- package/esm5/lib/place/route/parameter-snapshot.js +276 -23
- package/esm5/lib/place/route/route-parameter-sanitiser.js +2 -2
- package/esm5/lib/place/visit.js +3 -3
- package/esm5/public_api.js +2 -2
- package/fesm2015/coolon-angular-ui-powerups.js +453 -198
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +547 -219
- package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/place/components/place-outlet/place-outlet.component.d.ts +0 -1
- package/lib/place/index.d.ts +0 -1
- package/lib/place/place-history.d.ts +3 -0
- package/lib/place/place-router.d.ts +4 -3
- package/lib/place/route/parameter-definition.class.d.ts +12 -2
- package/lib/place/route/parameter-sanitiser.d.ts +3 -2
- package/lib/place/route/parameter-snapshot.d.ts +11 -8
- package/lib/place/visit.d.ts +2 -2
- package/package.json +1 -1
- package/esm2015/lib/place/route/default-parameter-sanitiser.js +0 -66
- package/esm5/lib/place/route/default-parameter-sanitiser.js +0 -73
- package/lib/place/route/default-parameter-sanitiser.d.ts +0 -11
|
@@ -2085,7 +2085,7 @@
|
|
|
2085
2085
|
* @return {?}
|
|
2086
2086
|
*/
|
|
2087
2087
|
function (parameters) {
|
|
2088
|
-
return parameters.
|
|
2088
|
+
return parameters.getValueOf(parameterDef);
|
|
2089
2089
|
},
|
|
2090
2090
|
toLeft: /**
|
|
2091
2091
|
* @param {?} value
|
|
@@ -2331,7 +2331,7 @@
|
|
|
2331
2331
|
var PlaceHistory = /** @class */ (function () {
|
|
2332
2332
|
function PlaceHistory(router) {
|
|
2333
2333
|
this.router = router;
|
|
2334
|
-
this._history =
|
|
2334
|
+
this._history = new Map();
|
|
2335
2335
|
}
|
|
2336
2336
|
/**
|
|
2337
2337
|
* @param {?} state
|
|
@@ -2343,131 +2343,69 @@
|
|
|
2343
2343
|
*/
|
|
2344
2344
|
function (state) {
|
|
2345
2345
|
/** @type {?} */
|
|
2346
|
-
var
|
|
2346
|
+
var history = this.getHistory(state.placeDefinition);
|
|
2347
|
+
/** @type {?} */
|
|
2348
|
+
var previousState = ___default__default.last(history);
|
|
2347
2349
|
if (!previousState || state.hasChanged(previousState)) {
|
|
2348
|
-
|
|
2349
|
-
// limit our history to
|
|
2350
|
-
this._history = this._history.slice(-100);
|
|
2350
|
+
history.unshift(state); // LIFO
|
|
2351
|
+
this.setHistory(state.placeDefinition, history.slice(-3)); // limit our history to 3 visits
|
|
2351
2352
|
}
|
|
2352
2353
|
};
|
|
2353
|
-
PlaceHistory.decorators = [
|
|
2354
|
-
{ type: core.Injectable, args: [{
|
|
2355
|
-
providedIn: 'root'
|
|
2356
|
-
},] }
|
|
2357
|
-
];
|
|
2358
|
-
/** @nocollapse */
|
|
2359
|
-
PlaceHistory.ctorParameters = function () { return [
|
|
2360
|
-
{ type: router.Router }
|
|
2361
|
-
]; };
|
|
2362
|
-
/** @nocollapse */ PlaceHistory.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function PlaceHistory_Factory() { return new PlaceHistory(core.ɵɵinject(router.Router)); }, token: PlaceHistory, providedIn: "root" });
|
|
2363
|
-
return PlaceHistory;
|
|
2364
|
-
}());
|
|
2365
|
-
if (false) {
|
|
2366
2354
|
/**
|
|
2367
|
-
* @
|
|
2368
|
-
* @private
|
|
2369
|
-
*/
|
|
2370
|
-
PlaceHistory.prototype._history;
|
|
2371
|
-
/**
|
|
2372
|
-
* @type {?}
|
|
2373
|
-
* @private
|
|
2374
|
-
*/
|
|
2375
|
-
PlaceHistory.prototype.router;
|
|
2376
|
-
}
|
|
2377
|
-
|
|
2378
|
-
/**
|
|
2379
|
-
* @fileoverview added by tsickle
|
|
2380
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2381
|
-
*/
|
|
2382
|
-
var PlaceRouter = /** @class */ (function () {
|
|
2383
|
-
function PlaceRouter(router) {
|
|
2384
|
-
this.router = router;
|
|
2385
|
-
}
|
|
2386
|
-
/**
|
|
2387
|
-
* @param {?} activatedRoute
|
|
2388
|
-
* @param {?} previous
|
|
2389
|
-
* @param {?} next
|
|
2390
|
-
* @return {?}
|
|
2391
|
-
*/
|
|
2392
|
-
PlaceRouter.prototype.pushParameterChangesToRoute = /**
|
|
2393
|
-
* @param {?} activatedRoute
|
|
2394
|
-
* @param {?} previous
|
|
2395
|
-
* @param {?} next
|
|
2396
|
-
* @return {?}
|
|
2397
|
-
*/
|
|
2398
|
-
function (activatedRoute, previous, next) {
|
|
2399
|
-
this.router.navigate(this.redirect(activatedRoute.snapshot, previous, next), {
|
|
2400
|
-
relativeTo: activatedRoute
|
|
2401
|
-
});
|
|
2402
|
-
};
|
|
2403
|
-
/**
|
|
2404
|
-
* @param {?} activatedRoute
|
|
2405
|
-
* @param {?} sanitised
|
|
2406
|
-
* @param {?} snapshot
|
|
2355
|
+
* @param {?} placeDef
|
|
2407
2356
|
* @return {?}
|
|
2408
2357
|
*/
|
|
2409
|
-
|
|
2410
|
-
* @param {?}
|
|
2411
|
-
* @param {?} sanitised
|
|
2412
|
-
* @param {?} snapshot
|
|
2358
|
+
PlaceHistory.prototype.getHistory = /**
|
|
2359
|
+
* @param {?} placeDef
|
|
2413
2360
|
* @return {?}
|
|
2414
2361
|
*/
|
|
2415
|
-
function (
|
|
2416
|
-
|
|
2362
|
+
function (placeDef) {
|
|
2363
|
+
/** @type {?} */
|
|
2364
|
+
var history = this._history.get(placeDef);
|
|
2365
|
+
if (!history) {
|
|
2366
|
+
history = [];
|
|
2367
|
+
this.setHistory(placeDef, history);
|
|
2368
|
+
}
|
|
2369
|
+
return history;
|
|
2417
2370
|
};
|
|
2418
2371
|
/**
|
|
2419
|
-
* @
|
|
2420
|
-
* @param {?}
|
|
2421
|
-
* @param {?}
|
|
2422
|
-
* @param {?} next
|
|
2372
|
+
* @private
|
|
2373
|
+
* @param {?} placeDef
|
|
2374
|
+
* @param {?} history
|
|
2423
2375
|
* @return {?}
|
|
2424
2376
|
*/
|
|
2425
|
-
|
|
2426
|
-
* @
|
|
2427
|
-
* @param {?}
|
|
2428
|
-
* @param {?}
|
|
2429
|
-
* @param {?} next
|
|
2377
|
+
PlaceHistory.prototype.setHistory = /**
|
|
2378
|
+
* @private
|
|
2379
|
+
* @param {?} placeDef
|
|
2380
|
+
* @param {?} history
|
|
2430
2381
|
* @return {?}
|
|
2431
2382
|
*/
|
|
2432
|
-
function (
|
|
2433
|
-
|
|
2434
|
-
var childSegments = ___default__default.flatten(activatedRoute.children.map((/**
|
|
2435
|
-
* @param {?} child
|
|
2436
|
-
* @return {?}
|
|
2437
|
-
*/
|
|
2438
|
-
function (child) { return child.url; })));
|
|
2439
|
-
/** @type {?} */
|
|
2440
|
-
var relativePath = !!previous.hasRouteId() ? '..' : '.';
|
|
2441
|
-
/** @type {?} */
|
|
2442
|
-
var routeId = next.getFormattedRouteId();
|
|
2443
|
-
/** @type {?} */
|
|
2444
|
-
var path = routeId ?
|
|
2445
|
-
[relativePath, routeId, next.getFormattedParameters()] :
|
|
2446
|
-
[relativePath, next.getFormattedParameters()];
|
|
2447
|
-
return path.concat(childSegments.map((/**
|
|
2448
|
-
* @param {?} s
|
|
2449
|
-
* @return {?}
|
|
2450
|
-
*/
|
|
2451
|
-
function (s) { return s.path; })));
|
|
2383
|
+
function (placeDef, history) {
|
|
2384
|
+
this._history.set(placeDef, history);
|
|
2452
2385
|
};
|
|
2453
|
-
|
|
2386
|
+
PlaceHistory.decorators = [
|
|
2454
2387
|
{ type: core.Injectable, args: [{
|
|
2455
2388
|
providedIn: 'root'
|
|
2456
2389
|
},] }
|
|
2457
2390
|
];
|
|
2458
2391
|
/** @nocollapse */
|
|
2459
|
-
|
|
2392
|
+
PlaceHistory.ctorParameters = function () { return [
|
|
2460
2393
|
{ type: router.Router }
|
|
2461
2394
|
]; };
|
|
2462
|
-
/** @nocollapse */
|
|
2463
|
-
return
|
|
2395
|
+
/** @nocollapse */ PlaceHistory.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function PlaceHistory_Factory() { return new PlaceHistory(core.ɵɵinject(router.Router)); }, token: PlaceHistory, providedIn: "root" });
|
|
2396
|
+
return PlaceHistory;
|
|
2464
2397
|
}());
|
|
2465
2398
|
if (false) {
|
|
2466
2399
|
/**
|
|
2467
2400
|
* @type {?}
|
|
2468
2401
|
* @private
|
|
2469
2402
|
*/
|
|
2470
|
-
|
|
2403
|
+
PlaceHistory.prototype._history;
|
|
2404
|
+
/**
|
|
2405
|
+
* @type {?}
|
|
2406
|
+
* @private
|
|
2407
|
+
*/
|
|
2408
|
+
PlaceHistory.prototype.router;
|
|
2471
2409
|
}
|
|
2472
2410
|
|
|
2473
2411
|
/**
|
|
@@ -2489,11 +2427,8 @@
|
|
|
2489
2427
|
/** @type {?} */
|
|
2490
2428
|
var opts = typescriptUtilities.Opts.get(options);
|
|
2491
2429
|
this.name = opts.getOptional('as', propertyName);
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
// opts.getOptional('remember', false),
|
|
2495
|
-
// opts.getOptional('defaultValue', null)
|
|
2496
|
-
// );
|
|
2430
|
+
this.remember = opts.getOptional('remember', false);
|
|
2431
|
+
this.defaultValue = opts.getOptional('defaultValue', null);
|
|
2497
2432
|
}
|
|
2498
2433
|
/**
|
|
2499
2434
|
* @param {?} injector
|
|
@@ -2504,7 +2439,12 @@
|
|
|
2504
2439
|
* @return {?}
|
|
2505
2440
|
*/
|
|
2506
2441
|
function (injector) {
|
|
2507
|
-
|
|
2442
|
+
if (this.remember || !___default__default.isNil(this.defaultValue)) {
|
|
2443
|
+
return new ParameterDefinition.DefaultParameterSanitiser(this.remember, this.defaultValue, injector.get(PlaceHistory));
|
|
2444
|
+
}
|
|
2445
|
+
else {
|
|
2446
|
+
return null;
|
|
2447
|
+
}
|
|
2508
2448
|
};
|
|
2509
2449
|
return ParameterDefinition;
|
|
2510
2450
|
}());
|
|
@@ -2515,8 +2455,16 @@
|
|
|
2515
2455
|
exports.ParameterDefinition.prototype.isArray;
|
|
2516
2456
|
/** @type {?} */
|
|
2517
2457
|
exports.ParameterDefinition.prototype.name;
|
|
2518
|
-
/**
|
|
2519
|
-
|
|
2458
|
+
/**
|
|
2459
|
+
* @type {?}
|
|
2460
|
+
* @private
|
|
2461
|
+
*/
|
|
2462
|
+
exports.ParameterDefinition.prototype.remember;
|
|
2463
|
+
/**
|
|
2464
|
+
* @type {?}
|
|
2465
|
+
* @private
|
|
2466
|
+
*/
|
|
2467
|
+
exports.ParameterDefinition.prototype.defaultValue;
|
|
2520
2468
|
/** @type {?} */
|
|
2521
2469
|
exports.ParameterDefinition.prototype.propertyName;
|
|
2522
2470
|
/** @type {?} */
|
|
@@ -2608,6 +2556,89 @@
|
|
|
2608
2556
|
/** @type {?} */
|
|
2609
2557
|
ArrayParameter.prototype.isArray;
|
|
2610
2558
|
}
|
|
2559
|
+
/**
|
|
2560
|
+
* @template T, S
|
|
2561
|
+
*/
|
|
2562
|
+
var /**
|
|
2563
|
+
* @template T, S
|
|
2564
|
+
*/
|
|
2565
|
+
DefaultParameterSanitiser = /** @class */ (function () {
|
|
2566
|
+
function DefaultParameterSanitiser(remember, defaultValue, placeHistory) {
|
|
2567
|
+
this.remember = remember;
|
|
2568
|
+
this.defaultValue = defaultValue;
|
|
2569
|
+
this.placeHistory = placeHistory;
|
|
2570
|
+
}
|
|
2571
|
+
/**
|
|
2572
|
+
* @param {?} parameterDef
|
|
2573
|
+
* @param {?} value
|
|
2574
|
+
* @param {?=} visit
|
|
2575
|
+
* @return {?}
|
|
2576
|
+
*/
|
|
2577
|
+
DefaultParameterSanitiser.prototype.sanitise = /**
|
|
2578
|
+
* @param {?} parameterDef
|
|
2579
|
+
* @param {?} value
|
|
2580
|
+
* @param {?=} visit
|
|
2581
|
+
* @return {?}
|
|
2582
|
+
*/
|
|
2583
|
+
function (parameterDef, value, visit) {
|
|
2584
|
+
var _this = this;
|
|
2585
|
+
if (this.isBlank(parameterDef, value)) {
|
|
2586
|
+
if (this.remember) {
|
|
2587
|
+
/** @type {?} */
|
|
2588
|
+
var visits = this.placeHistory.getHistory(visit.placeDefinition);
|
|
2589
|
+
value = visits.map((/**
|
|
2590
|
+
* @param {?} v
|
|
2591
|
+
* @return {?}
|
|
2592
|
+
*/
|
|
2593
|
+
function (v) { return v.getValueOf(parameterDef); }))
|
|
2594
|
+
.filter((/**
|
|
2595
|
+
* @param {?} v
|
|
2596
|
+
* @return {?}
|
|
2597
|
+
*/
|
|
2598
|
+
function (v) { return !___default__default.isNil(v); }))
|
|
2599
|
+
.find((/**
|
|
2600
|
+
* @param {?} v
|
|
2601
|
+
* @return {?}
|
|
2602
|
+
*/
|
|
2603
|
+
function (v) { return !_this.isBlank(parameterDef, v); }));
|
|
2604
|
+
}
|
|
2605
|
+
value = this.isBlank(parameterDef, value) ? this.defaultValue : value;
|
|
2606
|
+
console.log(parameterDef.name + " is blank, returning: " + value);
|
|
2607
|
+
return value;
|
|
2608
|
+
}
|
|
2609
|
+
else {
|
|
2610
|
+
console.log(parameterDef.name + " is not blank");
|
|
2611
|
+
return value;
|
|
2612
|
+
}
|
|
2613
|
+
};
|
|
2614
|
+
/**
|
|
2615
|
+
* @private
|
|
2616
|
+
* @param {?} def
|
|
2617
|
+
* @param {?} value
|
|
2618
|
+
* @return {?}
|
|
2619
|
+
*/
|
|
2620
|
+
DefaultParameterSanitiser.prototype.isBlank = /**
|
|
2621
|
+
* @private
|
|
2622
|
+
* @param {?} def
|
|
2623
|
+
* @param {?} value
|
|
2624
|
+
* @return {?}
|
|
2625
|
+
*/
|
|
2626
|
+
function (def, value) {
|
|
2627
|
+
/** @type {?} */
|
|
2628
|
+
var isNil = ___default__default.isNil(value);
|
|
2629
|
+
return isNil ? true : def.isArray ? value['length'] < 1 : false;
|
|
2630
|
+
};
|
|
2631
|
+
return DefaultParameterSanitiser;
|
|
2632
|
+
}());
|
|
2633
|
+
ParameterDefinition.DefaultParameterSanitiser = DefaultParameterSanitiser;
|
|
2634
|
+
if (false) {
|
|
2635
|
+
/** @type {?} */
|
|
2636
|
+
DefaultParameterSanitiser.prototype.remember;
|
|
2637
|
+
/** @type {?} */
|
|
2638
|
+
DefaultParameterSanitiser.prototype.defaultValue;
|
|
2639
|
+
/** @type {?} */
|
|
2640
|
+
DefaultParameterSanitiser.prototype.placeHistory;
|
|
2641
|
+
}
|
|
2611
2642
|
})(exports.ParameterDefinition || (exports.ParameterDefinition = {}));
|
|
2612
2643
|
|
|
2613
2644
|
/**
|
|
@@ -2621,24 +2652,31 @@
|
|
|
2621
2652
|
}
|
|
2622
2653
|
/**
|
|
2623
2654
|
* @param {?} other
|
|
2655
|
+
* @param {?=} debug
|
|
2624
2656
|
* @return {?}
|
|
2625
2657
|
*/
|
|
2626
2658
|
ParameterSnapshot.prototype.hasChanged = /**
|
|
2627
2659
|
* @param {?} other
|
|
2660
|
+
* @param {?=} debug
|
|
2628
2661
|
* @return {?}
|
|
2629
2662
|
*/
|
|
2630
|
-
function (other) {
|
|
2663
|
+
function (other, debug) {
|
|
2664
|
+
if (debug === void 0) { debug = false; }
|
|
2631
2665
|
/** @type {?} */
|
|
2632
2666
|
var changed = this.resolved.find((/**
|
|
2633
2667
|
* @param {?} r
|
|
2634
2668
|
* @return {?}
|
|
2635
2669
|
*/
|
|
2636
2670
|
function (r) {
|
|
2637
|
-
return !r.isSame(other.
|
|
2671
|
+
return !r.isSame(other.getValueOf(r.parameterDef));
|
|
2638
2672
|
}));
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2673
|
+
if (changed && debug) {
|
|
2674
|
+
console.log({
|
|
2675
|
+
name: changed.parameterDef.name,
|
|
2676
|
+
mine: changed.value,
|
|
2677
|
+
theirs: other.getValueOf(changed.parameterDef)
|
|
2678
|
+
});
|
|
2679
|
+
}
|
|
2642
2680
|
return !!changed;
|
|
2643
2681
|
};
|
|
2644
2682
|
/**
|
|
@@ -2646,7 +2684,7 @@
|
|
|
2646
2684
|
* @param {?} parameterDef
|
|
2647
2685
|
* @return {?}
|
|
2648
2686
|
*/
|
|
2649
|
-
ParameterSnapshot.prototype.
|
|
2687
|
+
ParameterSnapshot.prototype.getParameter = /**
|
|
2650
2688
|
* @template T, S
|
|
2651
2689
|
* @param {?} parameterDef
|
|
2652
2690
|
* @return {?}
|
|
@@ -2663,30 +2701,30 @@
|
|
|
2663
2701
|
* @param {?} parameterDef
|
|
2664
2702
|
* @return {?}
|
|
2665
2703
|
*/
|
|
2666
|
-
ParameterSnapshot.prototype.
|
|
2704
|
+
ParameterSnapshot.prototype.getValueOf = /**
|
|
2667
2705
|
* @template T, S
|
|
2668
2706
|
* @param {?} parameterDef
|
|
2669
2707
|
* @return {?}
|
|
2670
2708
|
*/
|
|
2671
2709
|
function (parameterDef) {
|
|
2672
2710
|
/** @type {?} */
|
|
2673
|
-
var resolvedParameter = this.
|
|
2711
|
+
var resolvedParameter = this.getParameter(parameterDef);
|
|
2674
2712
|
return resolvedParameter ? resolvedParameter.value : null;
|
|
2675
2713
|
};
|
|
2676
2714
|
/**
|
|
2677
2715
|
* @return {?}
|
|
2678
2716
|
*/
|
|
2679
|
-
ParameterSnapshot.prototype.
|
|
2717
|
+
ParameterSnapshot.prototype.getRouteIdValue = /**
|
|
2680
2718
|
* @return {?}
|
|
2681
2719
|
*/
|
|
2682
2720
|
function () {
|
|
2683
|
-
return this.
|
|
2721
|
+
return this.getRouteIdParameter() ? this.getRouteIdParameter().value : null;
|
|
2684
2722
|
};
|
|
2685
2723
|
/**
|
|
2686
2724
|
* @param {?} name
|
|
2687
2725
|
* @return {?}
|
|
2688
2726
|
*/
|
|
2689
|
-
ParameterSnapshot.prototype.
|
|
2727
|
+
ParameterSnapshot.prototype.getParameterValue = /**
|
|
2690
2728
|
* @param {?} name
|
|
2691
2729
|
* @return {?}
|
|
2692
2730
|
*/
|
|
@@ -2703,7 +2741,7 @@
|
|
|
2703
2741
|
* @private
|
|
2704
2742
|
* @return {?}
|
|
2705
2743
|
*/
|
|
2706
|
-
ParameterSnapshot.prototype.
|
|
2744
|
+
ParameterSnapshot.prototype.getRouteIdParameter = /**
|
|
2707
2745
|
* @private
|
|
2708
2746
|
* @return {?}
|
|
2709
2747
|
*/
|
|
@@ -2716,6 +2754,21 @@
|
|
|
2716
2754
|
*/
|
|
2717
2755
|
function (p) { return p.parameterDef.isRouteId; }))));
|
|
2718
2756
|
};
|
|
2757
|
+
/**
|
|
2758
|
+
* @private
|
|
2759
|
+
* @return {?}
|
|
2760
|
+
*/
|
|
2761
|
+
ParameterSnapshot.prototype.getRouteParameters = /**
|
|
2762
|
+
* @private
|
|
2763
|
+
* @return {?}
|
|
2764
|
+
*/
|
|
2765
|
+
function () {
|
|
2766
|
+
return this.resolved.filter((/**
|
|
2767
|
+
* @param {?} r
|
|
2768
|
+
* @return {?}
|
|
2769
|
+
*/
|
|
2770
|
+
function (r) { return !r.parameterDef.isRouteId; }));
|
|
2771
|
+
};
|
|
2719
2772
|
/**
|
|
2720
2773
|
* @return {?}
|
|
2721
2774
|
*/
|
|
@@ -2723,7 +2776,7 @@
|
|
|
2723
2776
|
* @return {?}
|
|
2724
2777
|
*/
|
|
2725
2778
|
function () {
|
|
2726
|
-
return !!this.
|
|
2779
|
+
return !!this.getRouteIdParameter();
|
|
2727
2780
|
};
|
|
2728
2781
|
/**
|
|
2729
2782
|
* @return {?}
|
|
@@ -2733,7 +2786,7 @@
|
|
|
2733
2786
|
*/
|
|
2734
2787
|
function () {
|
|
2735
2788
|
/** @type {?} */
|
|
2736
|
-
var routeIdParam = this.
|
|
2789
|
+
var routeIdParam = this.getRouteIdParameter();
|
|
2737
2790
|
return routeIdParam ? routeIdParam.formattedValue() : null;
|
|
2738
2791
|
};
|
|
2739
2792
|
/**
|
|
@@ -2759,6 +2812,25 @@
|
|
|
2759
2812
|
}));
|
|
2760
2813
|
return params;
|
|
2761
2814
|
};
|
|
2815
|
+
/**
|
|
2816
|
+
* @return {?}
|
|
2817
|
+
*/
|
|
2818
|
+
ParameterSnapshot.prototype.getAllFormattedParameters = /**
|
|
2819
|
+
* @return {?}
|
|
2820
|
+
*/
|
|
2821
|
+
function () {
|
|
2822
|
+
/** @type {?} */
|
|
2823
|
+
var params = {};
|
|
2824
|
+
/** @type {?} */
|
|
2825
|
+
var routeIdParam = this.resolved.forEach((/**
|
|
2826
|
+
* @param {?} p
|
|
2827
|
+
* @return {?}
|
|
2828
|
+
*/
|
|
2829
|
+
function (p) {
|
|
2830
|
+
params[p.parameterDef.name] = p.formattedValue();
|
|
2831
|
+
}));
|
|
2832
|
+
return params;
|
|
2833
|
+
};
|
|
2762
2834
|
/**
|
|
2763
2835
|
* @template T, S
|
|
2764
2836
|
* @param {?} parameter
|
|
@@ -2790,8 +2862,40 @@
|
|
|
2790
2862
|
*/
|
|
2791
2863
|
function (injector) {
|
|
2792
2864
|
return __awaiter(this, void 0, void 0, function () {
|
|
2865
|
+
var routeId, sanitisedValue, result, routeParameters, i, sanitisedValue;
|
|
2793
2866
|
return __generator(this, function (_a) {
|
|
2794
|
-
|
|
2867
|
+
switch (_a.label) {
|
|
2868
|
+
case 0:
|
|
2869
|
+
if (!this.hasRouteId()) return [3 /*break*/, 2];
|
|
2870
|
+
routeId = this.getRouteIdParameter();
|
|
2871
|
+
return [4 /*yield*/, routeId.sanitise(this, injector)];
|
|
2872
|
+
case 1:
|
|
2873
|
+
sanitisedValue = _a.sent();
|
|
2874
|
+
if (!routeId.isSame(sanitisedValue)) {
|
|
2875
|
+
// if the route id has changed we redirect immediately as other
|
|
2876
|
+
// parameter sanitisers might use it.
|
|
2877
|
+
return [2 /*return*/, this.replace(routeId.parameterDef, sanitisedValue)];
|
|
2878
|
+
}
|
|
2879
|
+
_a.label = 2;
|
|
2880
|
+
case 2:
|
|
2881
|
+
result = this;
|
|
2882
|
+
routeParameters = this.getRouteParameters();
|
|
2883
|
+
i = 0;
|
|
2884
|
+
_a.label = 3;
|
|
2885
|
+
case 3:
|
|
2886
|
+
if (!(i < routeParameters.length)) return [3 /*break*/, 6];
|
|
2887
|
+
return [4 /*yield*/, routeParameters[i].sanitise(this, injector)];
|
|
2888
|
+
case 4:
|
|
2889
|
+
sanitisedValue = _a.sent();
|
|
2890
|
+
if (!routeParameters[i].isSame(sanitisedValue)) {
|
|
2891
|
+
result = this.replace(routeParameters[i].parameterDef, sanitisedValue);
|
|
2892
|
+
}
|
|
2893
|
+
_a.label = 5;
|
|
2894
|
+
case 5:
|
|
2895
|
+
i++;
|
|
2896
|
+
return [3 /*break*/, 3];
|
|
2897
|
+
case 6: return [2 /*return*/, result];
|
|
2898
|
+
}
|
|
2795
2899
|
});
|
|
2796
2900
|
});
|
|
2797
2901
|
};
|
|
@@ -2801,25 +2905,37 @@
|
|
|
2801
2905
|
__metadata("design:type", Function),
|
|
2802
2906
|
__metadata("design:paramtypes", [exports.ParameterDefinition]),
|
|
2803
2907
|
__metadata("design:returntype", ParameterSnapshot.ResolvedParameter)
|
|
2804
|
-
], ParameterSnapshot.prototype, "
|
|
2908
|
+
], ParameterSnapshot.prototype, "getParameter", null);
|
|
2805
2909
|
__decorate([
|
|
2806
2910
|
src.Memoize(),
|
|
2807
2911
|
__metadata("design:type", Function),
|
|
2808
2912
|
__metadata("design:paramtypes", [exports.ParameterDefinition]),
|
|
2809
2913
|
__metadata("design:returntype", typeof (_a = typeof S !== "undefined" && S) === "function" ? _a : Object)
|
|
2810
|
-
], ParameterSnapshot.prototype, "
|
|
2914
|
+
], ParameterSnapshot.prototype, "getValueOf", null);
|
|
2811
2915
|
__decorate([
|
|
2812
2916
|
src.Memoize(),
|
|
2813
2917
|
__metadata("design:type", Function),
|
|
2814
2918
|
__metadata("design:paramtypes", [String]),
|
|
2815
2919
|
__metadata("design:returntype", Object)
|
|
2816
|
-
], ParameterSnapshot.prototype, "
|
|
2920
|
+
], ParameterSnapshot.prototype, "getParameterValue", null);
|
|
2817
2921
|
__decorate([
|
|
2818
2922
|
src.Memoize(),
|
|
2819
2923
|
__metadata("design:type", Function),
|
|
2820
2924
|
__metadata("design:paramtypes", []),
|
|
2821
2925
|
__metadata("design:returntype", ParameterSnapshot.ResolvedValueParameter)
|
|
2822
|
-
], ParameterSnapshot.prototype, "
|
|
2926
|
+
], ParameterSnapshot.prototype, "getRouteIdParameter", null);
|
|
2927
|
+
__decorate([
|
|
2928
|
+
src.Memoize(),
|
|
2929
|
+
__metadata("design:type", Function),
|
|
2930
|
+
__metadata("design:paramtypes", []),
|
|
2931
|
+
__metadata("design:returntype", Array)
|
|
2932
|
+
], ParameterSnapshot.prototype, "getRouteParameters", null);
|
|
2933
|
+
__decorate([
|
|
2934
|
+
pectin.Trace(),
|
|
2935
|
+
__metadata("design:type", Function),
|
|
2936
|
+
__metadata("design:paramtypes", [core.Injector]),
|
|
2937
|
+
__metadata("design:returntype", Promise)
|
|
2938
|
+
], ParameterSnapshot.prototype, "sanitise", null);
|
|
2823
2939
|
return ParameterSnapshot;
|
|
2824
2940
|
}());
|
|
2825
2941
|
if (false) {
|
|
@@ -2834,10 +2950,13 @@
|
|
|
2834
2950
|
(function (ParameterSnapshot) {
|
|
2835
2951
|
/**
|
|
2836
2952
|
* @param {?} placeDef
|
|
2837
|
-
* @param {?}
|
|
2953
|
+
* @param {?} params
|
|
2954
|
+
* @param {?} urlSegments
|
|
2838
2955
|
* @return {?}
|
|
2839
2956
|
*/
|
|
2840
|
-
function create(placeDef,
|
|
2957
|
+
function create(placeDef, params, urlSegments) {
|
|
2958
|
+
/** @type {?} */
|
|
2959
|
+
var paramMap = new ConsolidatedParameterMap(params, urlSegments);
|
|
2841
2960
|
/** @type {?} */
|
|
2842
2961
|
var resolvedParameters = placeDef.getRouteParameters()
|
|
2843
2962
|
.map((/**
|
|
@@ -2847,7 +2966,11 @@
|
|
|
2847
2966
|
function (def) {
|
|
2848
2967
|
if (def.isArray) {
|
|
2849
2968
|
/** @type {?} */
|
|
2850
|
-
var value = paramMap.has(def.name) ? paramMap.getAll(def.name).
|
|
2969
|
+
var value = paramMap.has(def.name) ? paramMap.getAll(def.name).filter((/**
|
|
2970
|
+
* @param {?} s
|
|
2971
|
+
* @return {?}
|
|
2972
|
+
*/
|
|
2973
|
+
function (s) { return !___default__default.isEmpty(s); })).map((/**
|
|
2851
2974
|
* @param {?} raw
|
|
2852
2975
|
* @return {?}
|
|
2853
2976
|
*/
|
|
@@ -2863,6 +2986,140 @@
|
|
|
2863
2986
|
return new ParameterSnapshot(placeDef, resolvedParameters);
|
|
2864
2987
|
}
|
|
2865
2988
|
ParameterSnapshot.create = create;
|
|
2989
|
+
/**
|
|
2990
|
+
* This a work around for the fact that an activated route with multiple segments doesn't
|
|
2991
|
+
* include the segment params in the paramMap as well as each segment returns an empty
|
|
2992
|
+
* param map even when `parameter`s has content.
|
|
2993
|
+
*/
|
|
2994
|
+
var /**
|
|
2995
|
+
* This a work around for the fact that an activated route with multiple segments doesn't
|
|
2996
|
+
* include the segment params in the paramMap as well as each segment returns an empty
|
|
2997
|
+
* param map even when `parameter`s has content.
|
|
2998
|
+
*/
|
|
2999
|
+
ConsolidatedParameterMap = /** @class */ (function () {
|
|
3000
|
+
function ConsolidatedParameterMap(paramMap, urlSegments) {
|
|
3001
|
+
this.paramMaps = [paramMap].concat((urlSegments || []).map((/**
|
|
3002
|
+
* @param {?} s
|
|
3003
|
+
* @return {?}
|
|
3004
|
+
*/
|
|
3005
|
+
function (s) { return new ParamMapAdapter(s.parameters); }))).filter((/**
|
|
3006
|
+
* @param {?} m
|
|
3007
|
+
* @return {?}
|
|
3008
|
+
*/
|
|
3009
|
+
function (m) { return !!m; })); // the activated route param map can be null
|
|
3010
|
+
}
|
|
3011
|
+
/**
|
|
3012
|
+
* @param {?} name
|
|
3013
|
+
* @return {?}
|
|
3014
|
+
*/
|
|
3015
|
+
ConsolidatedParameterMap.prototype.get = /**
|
|
3016
|
+
* @param {?} name
|
|
3017
|
+
* @return {?}
|
|
3018
|
+
*/
|
|
3019
|
+
function (name) {
|
|
3020
|
+
return this.paramMaps.find((/**
|
|
3021
|
+
* @param {?} m
|
|
3022
|
+
* @return {?}
|
|
3023
|
+
*/
|
|
3024
|
+
function (m) { return m.has(name); })).get(name);
|
|
3025
|
+
};
|
|
3026
|
+
/**
|
|
3027
|
+
* @param {?} name
|
|
3028
|
+
* @return {?}
|
|
3029
|
+
*/
|
|
3030
|
+
ConsolidatedParameterMap.prototype.getAll = /**
|
|
3031
|
+
* @param {?} name
|
|
3032
|
+
* @return {?}
|
|
3033
|
+
*/
|
|
3034
|
+
function (name) {
|
|
3035
|
+
return this.paramMaps.find((/**
|
|
3036
|
+
* @param {?} m
|
|
3037
|
+
* @return {?}
|
|
3038
|
+
*/
|
|
3039
|
+
function (m) { return m.has(name); })).getAll(name);
|
|
3040
|
+
};
|
|
3041
|
+
/**
|
|
3042
|
+
* @param {?} name
|
|
3043
|
+
* @return {?}
|
|
3044
|
+
*/
|
|
3045
|
+
ConsolidatedParameterMap.prototype.has = /**
|
|
3046
|
+
* @param {?} name
|
|
3047
|
+
* @return {?}
|
|
3048
|
+
*/
|
|
3049
|
+
function (name) {
|
|
3050
|
+
return !!this.paramMaps.find((/**
|
|
3051
|
+
* @param {?} m
|
|
3052
|
+
* @return {?}
|
|
3053
|
+
*/
|
|
3054
|
+
function (m) { return m.has(name); }));
|
|
3055
|
+
};
|
|
3056
|
+
return ConsolidatedParameterMap;
|
|
3057
|
+
}());
|
|
3058
|
+
if (false) {
|
|
3059
|
+
/**
|
|
3060
|
+
* @type {?}
|
|
3061
|
+
* @private
|
|
3062
|
+
*/
|
|
3063
|
+
ConsolidatedParameterMap.prototype.paramMaps;
|
|
3064
|
+
}
|
|
3065
|
+
var ParamMapAdapter = /** @class */ (function () {
|
|
3066
|
+
function ParamMapAdapter(params) {
|
|
3067
|
+
this.params = params;
|
|
3068
|
+
}
|
|
3069
|
+
/**
|
|
3070
|
+
* @param {?} name
|
|
3071
|
+
* @return {?}
|
|
3072
|
+
*/
|
|
3073
|
+
ParamMapAdapter.prototype.get = /**
|
|
3074
|
+
* @param {?} name
|
|
3075
|
+
* @return {?}
|
|
3076
|
+
*/
|
|
3077
|
+
function (name) {
|
|
3078
|
+
return this.params[name];
|
|
3079
|
+
};
|
|
3080
|
+
/**
|
|
3081
|
+
* @param {?} name
|
|
3082
|
+
* @return {?}
|
|
3083
|
+
*/
|
|
3084
|
+
ParamMapAdapter.prototype.getAll = /**
|
|
3085
|
+
* @param {?} name
|
|
3086
|
+
* @return {?}
|
|
3087
|
+
*/
|
|
3088
|
+
function (name) {
|
|
3089
|
+
/** @type {?} */
|
|
3090
|
+
var value = this.get(name);
|
|
3091
|
+
return Array.isArray(value) ? value : [value];
|
|
3092
|
+
};
|
|
3093
|
+
/**
|
|
3094
|
+
* @param {?} name
|
|
3095
|
+
* @return {?}
|
|
3096
|
+
*/
|
|
3097
|
+
ParamMapAdapter.prototype.has = /**
|
|
3098
|
+
* @param {?} name
|
|
3099
|
+
* @return {?}
|
|
3100
|
+
*/
|
|
3101
|
+
function (name) {
|
|
3102
|
+
return this.keys.includes(name);
|
|
3103
|
+
};
|
|
3104
|
+
Object.defineProperty(ParamMapAdapter.prototype, "keys", {
|
|
3105
|
+
get: /**
|
|
3106
|
+
* @return {?}
|
|
3107
|
+
*/
|
|
3108
|
+
function () {
|
|
3109
|
+
return Object.keys(this.params);
|
|
3110
|
+
},
|
|
3111
|
+
enumerable: true,
|
|
3112
|
+
configurable: true
|
|
3113
|
+
});
|
|
3114
|
+
return ParamMapAdapter;
|
|
3115
|
+
}());
|
|
3116
|
+
if (false) {
|
|
3117
|
+
/**
|
|
3118
|
+
* @type {?}
|
|
3119
|
+
* @private
|
|
3120
|
+
*/
|
|
3121
|
+
ParamMapAdapter.prototype.params;
|
|
3122
|
+
}
|
|
2866
3123
|
/**
|
|
2867
3124
|
* @abstract
|
|
2868
3125
|
* @template T, S
|
|
@@ -2885,6 +3142,31 @@
|
|
|
2885
3142
|
function () {
|
|
2886
3143
|
return this.parameterDef.isRouteId;
|
|
2887
3144
|
};
|
|
3145
|
+
/**
|
|
3146
|
+
* @param {?} visit
|
|
3147
|
+
* @param {?} injector
|
|
3148
|
+
* @return {?}
|
|
3149
|
+
*/
|
|
3150
|
+
ResolvedParameter.prototype.sanitise = /**
|
|
3151
|
+
* @param {?} visit
|
|
3152
|
+
* @param {?} injector
|
|
3153
|
+
* @return {?}
|
|
3154
|
+
*/
|
|
3155
|
+
function (visit, injector) {
|
|
3156
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3157
|
+
var sanitiser;
|
|
3158
|
+
return __generator(this, function (_a) {
|
|
3159
|
+
sanitiser = this.parameterDef.getSanitiser(injector);
|
|
3160
|
+
if (sanitiser) {
|
|
3161
|
+
return [2 /*return*/, sanitiser.sanitise(this.parameterDef, this.value, visit)];
|
|
3162
|
+
}
|
|
3163
|
+
else {
|
|
3164
|
+
return [2 /*return*/, this.value];
|
|
3165
|
+
}
|
|
3166
|
+
return [2 /*return*/];
|
|
3167
|
+
});
|
|
3168
|
+
});
|
|
3169
|
+
};
|
|
2888
3170
|
return ResolvedParameter;
|
|
2889
3171
|
}());
|
|
2890
3172
|
ParameterSnapshot.ResolvedParameter = ResolvedParameter;
|
|
@@ -3041,6 +3323,115 @@
|
|
|
3041
3323
|
ParameterSnapshot.ResolvedArrayParameter = ResolvedArrayParameter;
|
|
3042
3324
|
})(exports.ParameterSnapshot || (exports.ParameterSnapshot = {}));
|
|
3043
3325
|
|
|
3326
|
+
/**
|
|
3327
|
+
* @fileoverview added by tsickle
|
|
3328
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
3329
|
+
*/
|
|
3330
|
+
var PlaceRouter = /** @class */ (function () {
|
|
3331
|
+
function PlaceRouter(router) {
|
|
3332
|
+
this.router = router;
|
|
3333
|
+
}
|
|
3334
|
+
/**
|
|
3335
|
+
* @param {?} activatedRoute
|
|
3336
|
+
* @param {?} previous
|
|
3337
|
+
* @param {?} next
|
|
3338
|
+
* @return {?}
|
|
3339
|
+
*/
|
|
3340
|
+
PlaceRouter.prototype.pushParameterChangesToRoute = /**
|
|
3341
|
+
* @param {?} activatedRoute
|
|
3342
|
+
* @param {?} previous
|
|
3343
|
+
* @param {?} next
|
|
3344
|
+
* @return {?}
|
|
3345
|
+
*/
|
|
3346
|
+
function (activatedRoute, previous, next) {
|
|
3347
|
+
/** @type {?} */
|
|
3348
|
+
var relativePath = !!previous.hasRouteId() ? '..' : '.';
|
|
3349
|
+
this.router.navigate([relativePath].concat(this.createRouteParameters(next), this.getChildPath(activatedRoute.snapshot)), {
|
|
3350
|
+
relativeTo: activatedRoute
|
|
3351
|
+
});
|
|
3352
|
+
};
|
|
3353
|
+
/**
|
|
3354
|
+
* @param {?} activatedRoute
|
|
3355
|
+
* @param {?} sanitised
|
|
3356
|
+
* @return {?}
|
|
3357
|
+
*/
|
|
3358
|
+
PlaceRouter.prototype.getRedirectUrlTree = /**
|
|
3359
|
+
* @param {?} activatedRoute
|
|
3360
|
+
* @param {?} sanitised
|
|
3361
|
+
* @return {?}
|
|
3362
|
+
*/
|
|
3363
|
+
function (activatedRoute, sanitised) {
|
|
3364
|
+
/** @type {?} */
|
|
3365
|
+
var urlSegments = activatedRoute.url;
|
|
3366
|
+
/** @type {?} */
|
|
3367
|
+
var weHaveARouteId = sanitised.hasRouteId() && sanitised.getFormattedRouteId();
|
|
3368
|
+
/** @type {?} */
|
|
3369
|
+
var commands = (weHaveARouteId) ?
|
|
3370
|
+
[urlSegments[0].path, sanitised.getFormattedRouteId(), sanitised.getFormattedParameters()] :
|
|
3371
|
+
[urlSegments[0].path, sanitised.getFormattedParameters()];
|
|
3372
|
+
console.log("redirect path", commands);
|
|
3373
|
+
return this.router.createUrlTree(commands);
|
|
3374
|
+
};
|
|
3375
|
+
/**
|
|
3376
|
+
* @protected
|
|
3377
|
+
* @param {?} activatedRoute
|
|
3378
|
+
* @return {?}
|
|
3379
|
+
*/
|
|
3380
|
+
PlaceRouter.prototype.getChildPath = /**
|
|
3381
|
+
* @protected
|
|
3382
|
+
* @param {?} activatedRoute
|
|
3383
|
+
* @return {?}
|
|
3384
|
+
*/
|
|
3385
|
+
function (activatedRoute) {
|
|
3386
|
+
return ___default__default.flatten(activatedRoute.children.map((/**
|
|
3387
|
+
* @param {?} child
|
|
3388
|
+
* @return {?}
|
|
3389
|
+
*/
|
|
3390
|
+
function (child) { return child.url; })));
|
|
3391
|
+
};
|
|
3392
|
+
/**
|
|
3393
|
+
* @protected
|
|
3394
|
+
* @param {?} parameters
|
|
3395
|
+
* @return {?}
|
|
3396
|
+
*/
|
|
3397
|
+
PlaceRouter.prototype.createRouteParameters = /**
|
|
3398
|
+
* @protected
|
|
3399
|
+
* @param {?} parameters
|
|
3400
|
+
* @return {?}
|
|
3401
|
+
*/
|
|
3402
|
+
function (parameters) {
|
|
3403
|
+
/** @type {?} */
|
|
3404
|
+
var routeId = parameters.getFormattedRouteId();
|
|
3405
|
+
return routeId ?
|
|
3406
|
+
[routeId, parameters.getFormattedParameters()] :
|
|
3407
|
+
[parameters.getFormattedParameters()];
|
|
3408
|
+
};
|
|
3409
|
+
PlaceRouter.decorators = [
|
|
3410
|
+
{ type: core.Injectable, args: [{
|
|
3411
|
+
providedIn: 'root'
|
|
3412
|
+
},] }
|
|
3413
|
+
];
|
|
3414
|
+
/** @nocollapse */
|
|
3415
|
+
PlaceRouter.ctorParameters = function () { return [
|
|
3416
|
+
{ type: router.Router }
|
|
3417
|
+
]; };
|
|
3418
|
+
/** @nocollapse */ PlaceRouter.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(core.ɵɵinject(router.Router)); }, token: PlaceRouter, providedIn: "root" });
|
|
3419
|
+
__decorate([
|
|
3420
|
+
pectin.Trace(),
|
|
3421
|
+
__metadata("design:type", Function),
|
|
3422
|
+
__metadata("design:paramtypes", [router.ActivatedRouteSnapshot, exports.ParameterSnapshot]),
|
|
3423
|
+
__metadata("design:returntype", router.UrlTree)
|
|
3424
|
+
], PlaceRouter.prototype, "getRedirectUrlTree", null);
|
|
3425
|
+
return PlaceRouter;
|
|
3426
|
+
}());
|
|
3427
|
+
if (false) {
|
|
3428
|
+
/**
|
|
3429
|
+
* @type {?}
|
|
3430
|
+
* @private
|
|
3431
|
+
*/
|
|
3432
|
+
PlaceRouter.prototype.router;
|
|
3433
|
+
}
|
|
3434
|
+
|
|
3044
3435
|
/**
|
|
3045
3436
|
* @fileoverview added by tsickle
|
|
3046
3437
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -3128,19 +3519,25 @@
|
|
|
3128
3519
|
_this._placeDefinition = new pectin.MutableValueModel();
|
|
3129
3520
|
_this._resolvedParameters = new pectin.MutableValueModel();
|
|
3130
3521
|
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;
|
|
3131
|
-
|
|
3522
|
+
/** @type {?} */
|
|
3523
|
+
var paramMap = chain(_this._activatedRouteModel).pullObservableValue((/**
|
|
3132
3524
|
* @param {?} ar
|
|
3133
3525
|
* @return {?}
|
|
3134
3526
|
*/
|
|
3135
3527
|
function (ar) { return ar.paramMap; }));
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
* @param {?}
|
|
3528
|
+
/** @type {?} */
|
|
3529
|
+
var urls = chain(_this._activatedRouteModel).pullObservableValue((/**
|
|
3530
|
+
* @param {?} ar
|
|
3531
|
+
* @return {?}
|
|
3532
|
+
*/
|
|
3533
|
+
function (ar) { return ar.url; }));
|
|
3534
|
+
_this.placeConfigured = valueOf.all(chain(_this._inOutletUpdate).isFalsey(), _this._placeDefinition, paramMap, urls).areTruthy();
|
|
3535
|
+
when.anyOf(paramMap, urls).changes((/**
|
|
3139
3536
|
* @return {?}
|
|
3140
3537
|
*/
|
|
3141
|
-
function (
|
|
3538
|
+
function () {
|
|
3142
3539
|
/** @type {?} */
|
|
3143
|
-
var snapshot = exports.ParameterSnapshot.create(_this._placeDefinition.value,
|
|
3540
|
+
var snapshot = exports.ParameterSnapshot.create(_this._placeDefinition.value, paramMap.value, urls.value);
|
|
3144
3541
|
_this._incomingRouteChange.whileTrue((/**
|
|
3145
3542
|
* @return {?}
|
|
3146
3543
|
*/
|
|
@@ -3163,6 +3560,10 @@
|
|
|
3163
3560
|
unless: _this.incomingRouteChange
|
|
3164
3561
|
});
|
|
3165
3562
|
return _this;
|
|
3563
|
+
// const txo = new TransactionObserver().onEvent(e => console.log(e.toString()));
|
|
3564
|
+
// txo.observe('paramMap', paramMap);
|
|
3565
|
+
// txo.observe('urls', urls);
|
|
3566
|
+
// txo.observe('this._resolvedParameters', this._resolvedParameters);
|
|
3166
3567
|
}
|
|
3167
3568
|
Object.defineProperty(PlaceOutletComponent.prototype, "incomingRouteChange", {
|
|
3168
3569
|
get: /**
|
|
@@ -3333,11 +3734,6 @@
|
|
|
3333
3734
|
* @private
|
|
3334
3735
|
*/
|
|
3335
3736
|
PlaceOutletComponent.prototype._placeDefinition;
|
|
3336
|
-
/**
|
|
3337
|
-
* @type {?}
|
|
3338
|
-
* @private
|
|
3339
|
-
*/
|
|
3340
|
-
PlaceOutletComponent.prototype._paramMap;
|
|
3341
3737
|
/** @type {?} */
|
|
3342
3738
|
PlaceOutletComponent.prototype._resolvedParameters;
|
|
3343
3739
|
/**
|
|
@@ -3911,12 +4307,12 @@
|
|
|
3911
4307
|
/**
|
|
3912
4308
|
* @return {?}
|
|
3913
4309
|
*/
|
|
3914
|
-
Visit.prototype.
|
|
4310
|
+
Visit.prototype.getRouteIdValue = function () { };
|
|
3915
4311
|
/**
|
|
3916
4312
|
* @param {?} name
|
|
3917
4313
|
* @return {?}
|
|
3918
4314
|
*/
|
|
3919
|
-
Visit.prototype.
|
|
4315
|
+
Visit.prototype.getParameterValue = function (name) { };
|
|
3920
4316
|
}
|
|
3921
4317
|
|
|
3922
4318
|
/**
|
|
@@ -4015,14 +4411,14 @@
|
|
|
4015
4411
|
/** @type {?} */
|
|
4016
4412
|
var placeDefinition = exports.PlaceComponent.getDefinition(activatedRoute.component);
|
|
4017
4413
|
/** @type {?} */
|
|
4018
|
-
var snapshot_1 = exports.ParameterSnapshot.create(placeDefinition, activatedRoute.paramMap);
|
|
4414
|
+
var snapshot_1 = exports.ParameterSnapshot.create(placeDefinition, activatedRoute.paramMap, activatedRoute.url);
|
|
4019
4415
|
return snapshot_1.sanitise(this.injector).then((/**
|
|
4020
4416
|
* @param {?} sanitised
|
|
4021
4417
|
* @return {?}
|
|
4022
4418
|
*/
|
|
4023
4419
|
function (sanitised) {
|
|
4024
|
-
if (sanitised.hasChanged(snapshot_1)) {
|
|
4025
|
-
return _this.placeRouter.
|
|
4420
|
+
if (sanitised.hasChanged(snapshot_1, true)) {
|
|
4421
|
+
return _this.placeRouter.getRedirectUrlTree(activatedRoute, sanitised);
|
|
4026
4422
|
}
|
|
4027
4423
|
else {
|
|
4028
4424
|
return true;
|
|
@@ -4059,75 +4455,6 @@
|
|
|
4059
4455
|
PlaceRouteGuard.prototype.injector;
|
|
4060
4456
|
}
|
|
4061
4457
|
|
|
4062
|
-
/**
|
|
4063
|
-
* @fileoverview added by tsickle
|
|
4064
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4065
|
-
*/
|
|
4066
|
-
/**
|
|
4067
|
-
* @template T, S
|
|
4068
|
-
*/
|
|
4069
|
-
var DefaultParameterSanitiser = /** @class */ (function () {
|
|
4070
|
-
function DefaultParameterSanitiser(def, remember, defaultValue) {
|
|
4071
|
-
this.def = def;
|
|
4072
|
-
this.remember = remember;
|
|
4073
|
-
this.defaultValue = defaultValue;
|
|
4074
|
-
}
|
|
4075
|
-
/**
|
|
4076
|
-
* @param {?} value
|
|
4077
|
-
* @param {?} visit
|
|
4078
|
-
* @return {?}
|
|
4079
|
-
*/
|
|
4080
|
-
DefaultParameterSanitiser.prototype.sanitise = /**
|
|
4081
|
-
* @param {?} value
|
|
4082
|
-
* @param {?} visit
|
|
4083
|
-
* @return {?}
|
|
4084
|
-
*/
|
|
4085
|
-
function (value, visit) {
|
|
4086
|
-
if (this.isBlank(value)) {
|
|
4087
|
-
if (this.remember) {
|
|
4088
|
-
// value = null;
|
|
4089
|
-
}
|
|
4090
|
-
return this.isBlank(value) && !___default__default.isNil(this.defaultValue) ? this.defaultValue : value;
|
|
4091
|
-
}
|
|
4092
|
-
else {
|
|
4093
|
-
return value;
|
|
4094
|
-
}
|
|
4095
|
-
};
|
|
4096
|
-
/**
|
|
4097
|
-
* @private
|
|
4098
|
-
* @param {?} value
|
|
4099
|
-
* @return {?}
|
|
4100
|
-
*/
|
|
4101
|
-
DefaultParameterSanitiser.prototype.isBlank = /**
|
|
4102
|
-
* @private
|
|
4103
|
-
* @param {?} value
|
|
4104
|
-
* @return {?}
|
|
4105
|
-
*/
|
|
4106
|
-
function (value) {
|
|
4107
|
-
/** @type {?} */
|
|
4108
|
-
var isNil = ___default__default.isNil(value);
|
|
4109
|
-
return this.def.isArray ? !isNil || value['length'] < 1 : isNil;
|
|
4110
|
-
};
|
|
4111
|
-
__decorate([
|
|
4112
|
-
pectin.Trace(),
|
|
4113
|
-
__metadata("design:type", Function),
|
|
4114
|
-
__metadata("design:paramtypes", [Object, Object]),
|
|
4115
|
-
__metadata("design:returntype", Object)
|
|
4116
|
-
], DefaultParameterSanitiser.prototype, "sanitise", null);
|
|
4117
|
-
return DefaultParameterSanitiser;
|
|
4118
|
-
}());
|
|
4119
|
-
if (false) {
|
|
4120
|
-
/**
|
|
4121
|
-
* @type {?}
|
|
4122
|
-
* @private
|
|
4123
|
-
*/
|
|
4124
|
-
DefaultParameterSanitiser.prototype.def;
|
|
4125
|
-
/** @type {?} */
|
|
4126
|
-
DefaultParameterSanitiser.prototype.remember;
|
|
4127
|
-
/** @type {?} */
|
|
4128
|
-
DefaultParameterSanitiser.prototype.defaultValue;
|
|
4129
|
-
}
|
|
4130
|
-
|
|
4131
4458
|
/**
|
|
4132
4459
|
* @fileoverview added by tsickle
|
|
4133
4460
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -4239,16 +4566,17 @@
|
|
|
4239
4566
|
*/
|
|
4240
4567
|
/**
|
|
4241
4568
|
* @record
|
|
4242
|
-
* @template
|
|
4569
|
+
* @template S
|
|
4243
4570
|
*/
|
|
4244
4571
|
function ParameterSanitiser() { }
|
|
4245
4572
|
if (false) {
|
|
4246
4573
|
/**
|
|
4574
|
+
* @param {?} parameterDef
|
|
4247
4575
|
* @param {?} value
|
|
4248
4576
|
* @param {?=} visit
|
|
4249
4577
|
* @return {?}
|
|
4250
4578
|
*/
|
|
4251
|
-
ParameterSanitiser.prototype.sanitise = function (value, visit) { };
|
|
4579
|
+
ParameterSanitiser.prototype.sanitise = function (parameterDef, value, visit) { };
|
|
4252
4580
|
}
|
|
4253
4581
|
|
|
4254
4582
|
/**
|
|
@@ -4443,7 +4771,7 @@
|
|
|
4443
4771
|
if (!this.sanitiser) return [3 /*break*/, 2];
|
|
4444
4772
|
this.initialValue = this.readFrom(this.snapshot);
|
|
4445
4773
|
_a = this;
|
|
4446
|
-
return [4 /*yield*/, this.sanitiser.sanitise(this.initialValue)];
|
|
4774
|
+
return [4 /*yield*/, this.sanitiser.sanitise(null, this.initialValue)];
|
|
4447
4775
|
case 1:
|
|
4448
4776
|
_a._sanitisedValue = _b.sent();
|
|
4449
4777
|
if (this.initialValue !== this._sanitisedValue) {
|
|
@@ -4783,7 +5111,6 @@
|
|
|
4783
5111
|
exports.CommandDirective = CommandDirective;
|
|
4784
5112
|
exports.ConfirmationDialogComponent = ConfirmationDialogComponent;
|
|
4785
5113
|
exports.DEFINITION_META_DATA_KEY = DEFINITION_META_DATA_KEY;
|
|
4786
|
-
exports.DefaultParameterSanitiser = DefaultParameterSanitiser;
|
|
4787
5114
|
exports.DialogInteractionService = DialogInteractionService;
|
|
4788
5115
|
exports.Dimension = Dimension;
|
|
4789
5116
|
exports.DisposableComponent = DisposableComponent;
|