@coolon/angular-ui-powerups 0.0.44 → 0.0.47

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.
Files changed (53) hide show
  1. package/bundles/coolon-angular-ui-powerups.umd.js +489 -167
  2. package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
  3. package/bundles/coolon-angular-ui-powerups.umd.min.js +1 -1
  4. package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
  5. package/coolon-angular-ui-powerups.metadata.json +1 -1
  6. package/esm2015/coolon-angular-ui-powerups.js +2 -2
  7. package/esm2015/index.js +2 -2
  8. package/esm2015/lib/interaction/abstract-activity.js +3 -9
  9. package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +17 -12
  10. package/esm2015/lib/place/guards/place-route.guard.js +4 -4
  11. package/esm2015/lib/place/index.js +1 -2
  12. package/esm2015/lib/place/place-component.js +2 -2
  13. package/esm2015/lib/place/place-history.js +29 -6
  14. package/esm2015/lib/place/place-router.js +29 -22
  15. package/esm2015/lib/place/route/parameter-decorators.js +1 -1
  16. package/esm2015/lib/place/route/parameter-definition.class.js +92 -9
  17. package/esm2015/lib/place/route/parameter-sanitiser.js +4 -3
  18. package/esm2015/lib/place/route/parameter-snapshot.js +214 -23
  19. package/esm2015/lib/place/route/route-parameter-sanitiser.js +4 -9
  20. package/esm2015/lib/place/visit.js +3 -3
  21. package/esm2015/public_api.js +2 -2
  22. package/esm5/coolon-angular-ui-powerups.js +2 -2
  23. package/esm5/index.js +2 -2
  24. package/esm5/lib/interaction/abstract-activity.js +14 -10
  25. package/esm5/lib/place/components/place-outlet/place-outlet.component.js +17 -12
  26. package/esm5/lib/place/guards/place-route.guard.js +4 -4
  27. package/esm5/lib/place/index.js +1 -2
  28. package/esm5/lib/place/place-component.js +2 -2
  29. package/esm5/lib/place/place-history.js +39 -6
  30. package/esm5/lib/place/place-router.js +39 -27
  31. package/esm5/lib/place/route/parameter-decorators.js +1 -1
  32. package/esm5/lib/place/route/parameter-definition.class.js +104 -9
  33. package/esm5/lib/place/route/parameter-sanitiser.js +4 -3
  34. package/esm5/lib/place/route/parameter-snapshot.js +273 -24
  35. package/esm5/lib/place/route/route-parameter-sanitiser.js +8 -10
  36. package/esm5/lib/place/visit.js +3 -3
  37. package/esm5/public_api.js +2 -2
  38. package/fesm2015/coolon-angular-ui-powerups.js +388 -153
  39. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  40. package/fesm5/coolon-angular-ui-powerups.js +491 -168
  41. package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
  42. package/lib/place/components/place-outlet/place-outlet.component.d.ts +0 -1
  43. package/lib/place/index.d.ts +0 -1
  44. package/lib/place/place-history.d.ts +3 -0
  45. package/lib/place/place-router.d.ts +4 -3
  46. package/lib/place/route/parameter-definition.class.d.ts +12 -2
  47. package/lib/place/route/parameter-sanitiser.d.ts +3 -2
  48. package/lib/place/route/parameter-snapshot.d.ts +11 -8
  49. package/lib/place/visit.d.ts +2 -2
  50. package/package.json +1 -1
  51. package/esm2015/lib/place/route/default-parameter-sanitiser.js +0 -66
  52. package/esm5/lib/place/route/default-parameter-sanitiser.js +0 -73
  53. package/lib/place/route/default-parameter-sanitiser.d.ts +0 -11
@@ -1266,7 +1266,10 @@
1266
1266
  /**
1267
1267
  * @template D, R, E
1268
1268
  */
1269
- var AbstractActivity = /** @class */ (function (_super) {
1269
+ var /**
1270
+ * @template D, R, E
1271
+ */
1272
+ AbstractActivity = /** @class */ (function (_super) {
1270
1273
  __extends(AbstractActivity, _super);
1271
1274
  function AbstractActivity() {
1272
1275
  var _this = _super !== null && _super.apply(this, arguments) || this;
@@ -1340,10 +1343,14 @@
1340
1343
  */
1341
1344
  function () { return _this.finalizeAndDispose(); }));
1342
1345
  };
1346
+ // @Trace()
1347
+ // @Trace()
1343
1348
  /**
1344
1349
  * @return {?}
1345
1350
  */
1346
- AbstractActivity.prototype.onActivityReady = /**
1351
+ AbstractActivity.prototype.onActivityReady =
1352
+ // @Trace()
1353
+ /**
1347
1354
  * @return {?}
1348
1355
  */
1349
1356
  function () {
@@ -1405,12 +1412,6 @@
1405
1412
  function () {
1406
1413
  return this._busyModel.value;
1407
1414
  };
1408
- __decorate([
1409
- pectin.Trace(),
1410
- __metadata("design:type", Function),
1411
- __metadata("design:paramtypes", []),
1412
- __metadata("design:returntype", void 0)
1413
- ], AbstractActivity.prototype, "onActivityReady", null);
1414
1415
  return AbstractActivity;
1415
1416
  }(DisposableComponent));
1416
1417
  if (false) {
@@ -2085,7 +2086,7 @@
2085
2086
  * @return {?}
2086
2087
  */
2087
2088
  function (parameters) {
2088
- return parameters.getResolvedParameterValue(parameterDef);
2089
+ return parameters.getValueOf(parameterDef);
2089
2090
  },
2090
2091
  toLeft: /**
2091
2092
  * @param {?} value
@@ -2331,7 +2332,7 @@
2331
2332
  var PlaceHistory = /** @class */ (function () {
2332
2333
  function PlaceHistory(router) {
2333
2334
  this.router = router;
2334
- this._history = [];
2335
+ this._history = new Map();
2335
2336
  }
2336
2337
  /**
2337
2338
  * @param {?} state
@@ -2343,12 +2344,45 @@
2343
2344
  */
2344
2345
  function (state) {
2345
2346
  /** @type {?} */
2346
- var previousState = ___default__default.last(this._history);
2347
+ var history = this.getHistory(state.placeDefinition);
2348
+ /** @type {?} */
2349
+ var previousState = ___default__default.last(history);
2347
2350
  if (!previousState || state.hasChanged(previousState)) {
2348
- this._history.push(state);
2349
- // limit our history to 100 visits
2350
- this._history = this._history.slice(-100);
2351
+ history.unshift(state); // LIFO
2352
+ this.setHistory(state.placeDefinition, history.slice(-3)); // limit our history to 3 visits
2353
+ }
2354
+ };
2355
+ /**
2356
+ * @param {?} placeDef
2357
+ * @return {?}
2358
+ */
2359
+ PlaceHistory.prototype.getHistory = /**
2360
+ * @param {?} placeDef
2361
+ * @return {?}
2362
+ */
2363
+ function (placeDef) {
2364
+ /** @type {?} */
2365
+ var history = this._history.get(placeDef);
2366
+ if (!history) {
2367
+ history = [];
2368
+ this.setHistory(placeDef, history);
2351
2369
  }
2370
+ return history;
2371
+ };
2372
+ /**
2373
+ * @private
2374
+ * @param {?} placeDef
2375
+ * @param {?} history
2376
+ * @return {?}
2377
+ */
2378
+ PlaceHistory.prototype.setHistory = /**
2379
+ * @private
2380
+ * @param {?} placeDef
2381
+ * @param {?} history
2382
+ * @return {?}
2383
+ */
2384
+ function (placeDef, history) {
2385
+ this._history.set(placeDef, history);
2352
2386
  };
2353
2387
  PlaceHistory.decorators = [
2354
2388
  { type: core.Injectable, args: [{
@@ -2396,59 +2430,71 @@
2396
2430
  * @return {?}
2397
2431
  */
2398
2432
  function (activatedRoute, previous, next) {
2399
- this.router.navigate(this.redirect(activatedRoute.snapshot, previous, next), {
2433
+ /** @type {?} */
2434
+ var relativePath = !!previous.hasRouteId() ? '..' : '.';
2435
+ this.router.navigate([relativePath].concat(this.createRouteParameters(next), this.getChildPath(activatedRoute.snapshot)), {
2400
2436
  relativeTo: activatedRoute
2401
2437
  });
2402
2438
  };
2439
+ // @Trace()
2440
+ // @Trace()
2403
2441
  /**
2404
2442
  * @param {?} activatedRoute
2405
2443
  * @param {?} sanitised
2406
- * @param {?} snapshot
2407
2444
  * @return {?}
2408
2445
  */
2409
- PlaceRouter.prototype.createUrlTree = /**
2446
+ PlaceRouter.prototype.getRedirectUrlTree =
2447
+ // @Trace()
2448
+ /**
2410
2449
  * @param {?} activatedRoute
2411
2450
  * @param {?} sanitised
2412
- * @param {?} snapshot
2413
2451
  * @return {?}
2414
2452
  */
2415
- function (activatedRoute, sanitised, snapshot) {
2416
- return this.router.createUrlTree(this.redirect(activatedRoute, snapshot, sanitised));
2453
+ function (activatedRoute, sanitised) {
2454
+ /** @type {?} */
2455
+ var urlSegments = activatedRoute.url;
2456
+ /** @type {?} */
2457
+ var weHaveARouteId = sanitised.hasRouteId() && sanitised.getFormattedRouteId();
2458
+ /** @type {?} */
2459
+ var commands = (weHaveARouteId) ?
2460
+ [urlSegments[0].path, sanitised.getFormattedRouteId(), sanitised.getFormattedParameters()] :
2461
+ [urlSegments[0].path, sanitised.getFormattedParameters()];
2462
+ console.log("redirect path", commands);
2463
+ return this.router.createUrlTree(commands);
2417
2464
  };
2418
2465
  /**
2419
2466
  * @protected
2420
2467
  * @param {?} activatedRoute
2421
- * @param {?} previous
2422
- * @param {?} next
2423
2468
  * @return {?}
2424
2469
  */
2425
- PlaceRouter.prototype.redirect = /**
2470
+ PlaceRouter.prototype.getChildPath = /**
2426
2471
  * @protected
2427
2472
  * @param {?} activatedRoute
2428
- * @param {?} previous
2429
- * @param {?} next
2430
2473
  * @return {?}
2431
2474
  */
2432
- function (activatedRoute, previous, next) {
2433
- /** @type {?} */
2434
- var childSegments = ___default__default.flatten(activatedRoute.children.map((/**
2475
+ function (activatedRoute) {
2476
+ return ___default__default.flatten(activatedRoute.children.map((/**
2435
2477
  * @param {?} child
2436
2478
  * @return {?}
2437
2479
  */
2438
2480
  function (child) { return child.url; })));
2481
+ };
2482
+ /**
2483
+ * @protected
2484
+ * @param {?} parameters
2485
+ * @return {?}
2486
+ */
2487
+ PlaceRouter.prototype.createRouteParameters = /**
2488
+ * @protected
2489
+ * @param {?} parameters
2490
+ * @return {?}
2491
+ */
2492
+ function (parameters) {
2439
2493
  /** @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; })));
2494
+ var routeId = parameters.getFormattedRouteId();
2495
+ return routeId ?
2496
+ [routeId, parameters.getFormattedParameters()] :
2497
+ [parameters.getFormattedParameters()];
2452
2498
  };
2453
2499
  PlaceRouter.decorators = [
2454
2500
  { type: core.Injectable, args: [{
@@ -2489,11 +2535,8 @@
2489
2535
  /** @type {?} */
2490
2536
  var opts = typescriptUtilities.Opts.get(options);
2491
2537
  this.name = opts.getOptional('as', propertyName);
2492
- // this.sanitiser = new DefaultParameterSanitiser(
2493
- // this,
2494
- // opts.getOptional('remember', false),
2495
- // opts.getOptional('defaultValue', null)
2496
- // );
2538
+ this.remember = opts.getOptional('remember', false);
2539
+ this.defaultValue = opts.getOptional('defaultValue', null);
2497
2540
  }
2498
2541
  /**
2499
2542
  * @param {?} injector
@@ -2504,7 +2547,12 @@
2504
2547
  * @return {?}
2505
2548
  */
2506
2549
  function (injector) {
2507
- return this.sanitiser;
2550
+ if (this.remember || !___default__default.isNil(this.defaultValue)) {
2551
+ return new ParameterDefinition.DefaultParameterSanitiser(this.remember, this.defaultValue, injector.get(PlaceHistory));
2552
+ }
2553
+ else {
2554
+ return null;
2555
+ }
2508
2556
  };
2509
2557
  return ParameterDefinition;
2510
2558
  }());
@@ -2515,8 +2563,16 @@
2515
2563
  exports.ParameterDefinition.prototype.isArray;
2516
2564
  /** @type {?} */
2517
2565
  exports.ParameterDefinition.prototype.name;
2518
- /** @type {?} */
2519
- exports.ParameterDefinition.prototype.sanitiser;
2566
+ /**
2567
+ * @type {?}
2568
+ * @private
2569
+ */
2570
+ exports.ParameterDefinition.prototype.remember;
2571
+ /**
2572
+ * @type {?}
2573
+ * @private
2574
+ */
2575
+ exports.ParameterDefinition.prototype.defaultValue;
2520
2576
  /** @type {?} */
2521
2577
  exports.ParameterDefinition.prototype.propertyName;
2522
2578
  /** @type {?} */
@@ -2608,6 +2664,89 @@
2608
2664
  /** @type {?} */
2609
2665
  ArrayParameter.prototype.isArray;
2610
2666
  }
2667
+ /**
2668
+ * @template T, S
2669
+ */
2670
+ var /**
2671
+ * @template T, S
2672
+ */
2673
+ DefaultParameterSanitiser = /** @class */ (function () {
2674
+ function DefaultParameterSanitiser(remember, defaultValue, placeHistory) {
2675
+ this.remember = remember;
2676
+ this.defaultValue = defaultValue;
2677
+ this.placeHistory = placeHistory;
2678
+ }
2679
+ /**
2680
+ * @param {?} parameterDef
2681
+ * @param {?} value
2682
+ * @param {?=} visit
2683
+ * @return {?}
2684
+ */
2685
+ DefaultParameterSanitiser.prototype.sanitise = /**
2686
+ * @param {?} parameterDef
2687
+ * @param {?} value
2688
+ * @param {?=} visit
2689
+ * @return {?}
2690
+ */
2691
+ function (parameterDef, value, visit) {
2692
+ var _this = this;
2693
+ if (this.isBlank(parameterDef, value)) {
2694
+ if (this.remember) {
2695
+ /** @type {?} */
2696
+ var visits = this.placeHistory.getHistory(visit.placeDefinition);
2697
+ value = visits.map((/**
2698
+ * @param {?} v
2699
+ * @return {?}
2700
+ */
2701
+ function (v) { return v.getValueOf(parameterDef); }))
2702
+ .filter((/**
2703
+ * @param {?} v
2704
+ * @return {?}
2705
+ */
2706
+ function (v) { return !___default__default.isNil(v); }))
2707
+ .find((/**
2708
+ * @param {?} v
2709
+ * @return {?}
2710
+ */
2711
+ function (v) { return !_this.isBlank(parameterDef, v); }));
2712
+ }
2713
+ value = this.isBlank(parameterDef, value) ? this.defaultValue : value;
2714
+ console.log(parameterDef.name + " is blank, returning: " + value);
2715
+ return value;
2716
+ }
2717
+ else {
2718
+ console.log(parameterDef.name + " is not blank");
2719
+ return value;
2720
+ }
2721
+ };
2722
+ /**
2723
+ * @private
2724
+ * @param {?} def
2725
+ * @param {?} value
2726
+ * @return {?}
2727
+ */
2728
+ DefaultParameterSanitiser.prototype.isBlank = /**
2729
+ * @private
2730
+ * @param {?} def
2731
+ * @param {?} value
2732
+ * @return {?}
2733
+ */
2734
+ function (def, value) {
2735
+ /** @type {?} */
2736
+ var isNil = ___default__default.isNil(value);
2737
+ return isNil ? true : def.isArray ? value['length'] < 1 : false;
2738
+ };
2739
+ return DefaultParameterSanitiser;
2740
+ }());
2741
+ ParameterDefinition.DefaultParameterSanitiser = DefaultParameterSanitiser;
2742
+ if (false) {
2743
+ /** @type {?} */
2744
+ DefaultParameterSanitiser.prototype.remember;
2745
+ /** @type {?} */
2746
+ DefaultParameterSanitiser.prototype.defaultValue;
2747
+ /** @type {?} */
2748
+ DefaultParameterSanitiser.prototype.placeHistory;
2749
+ }
2611
2750
  })(exports.ParameterDefinition || (exports.ParameterDefinition = {}));
2612
2751
 
2613
2752
  /**
@@ -2621,24 +2760,31 @@
2621
2760
  }
2622
2761
  /**
2623
2762
  * @param {?} other
2763
+ * @param {?=} debug
2624
2764
  * @return {?}
2625
2765
  */
2626
2766
  ParameterSnapshot.prototype.hasChanged = /**
2627
2767
  * @param {?} other
2768
+ * @param {?=} debug
2628
2769
  * @return {?}
2629
2770
  */
2630
- function (other) {
2771
+ function (other, debug) {
2772
+ if (debug === void 0) { debug = false; }
2631
2773
  /** @type {?} */
2632
2774
  var changed = this.resolved.find((/**
2633
2775
  * @param {?} r
2634
2776
  * @return {?}
2635
2777
  */
2636
2778
  function (r) {
2637
- return !r.isSame(other.getResolvedParameterValue(r.parameterDef));
2779
+ return !r.isSame(other.getValueOf(r.parameterDef));
2638
2780
  }));
2639
- // if (changed) {
2640
- // console.log({ mine: changed, theirs: other.getResolvedParameter(changed.parameterDef) });
2641
- // }
2781
+ if (changed && debug) {
2782
+ console.log({
2783
+ name: changed.parameterDef.name,
2784
+ mine: changed.value,
2785
+ theirs: other.getValueOf(changed.parameterDef)
2786
+ });
2787
+ }
2642
2788
  return !!changed;
2643
2789
  };
2644
2790
  /**
@@ -2646,7 +2792,7 @@
2646
2792
  * @param {?} parameterDef
2647
2793
  * @return {?}
2648
2794
  */
2649
- ParameterSnapshot.prototype.getResolvedParameter = /**
2795
+ ParameterSnapshot.prototype.getParameter = /**
2650
2796
  * @template T, S
2651
2797
  * @param {?} parameterDef
2652
2798
  * @return {?}
@@ -2663,30 +2809,30 @@
2663
2809
  * @param {?} parameterDef
2664
2810
  * @return {?}
2665
2811
  */
2666
- ParameterSnapshot.prototype.getResolvedParameterValue = /**
2812
+ ParameterSnapshot.prototype.getValueOf = /**
2667
2813
  * @template T, S
2668
2814
  * @param {?} parameterDef
2669
2815
  * @return {?}
2670
2816
  */
2671
2817
  function (parameterDef) {
2672
2818
  /** @type {?} */
2673
- var resolvedParameter = this.getResolvedParameter(parameterDef);
2819
+ var resolvedParameter = this.getParameter(parameterDef);
2674
2820
  return resolvedParameter ? resolvedParameter.value : null;
2675
2821
  };
2676
2822
  /**
2677
2823
  * @return {?}
2678
2824
  */
2679
- ParameterSnapshot.prototype.getRouteId = /**
2825
+ ParameterSnapshot.prototype.getRouteIdValue = /**
2680
2826
  * @return {?}
2681
2827
  */
2682
2828
  function () {
2683
- return this.getResolvedRouteId() ? this.getResolvedRouteId().value : null;
2829
+ return this.getRouteIdParameter() ? this.getRouteIdParameter().value : null;
2684
2830
  };
2685
2831
  /**
2686
2832
  * @param {?} name
2687
2833
  * @return {?}
2688
2834
  */
2689
- ParameterSnapshot.prototype.getRouteParameter = /**
2835
+ ParameterSnapshot.prototype.getParameterValue = /**
2690
2836
  * @param {?} name
2691
2837
  * @return {?}
2692
2838
  */
@@ -2703,7 +2849,7 @@
2703
2849
  * @private
2704
2850
  * @return {?}
2705
2851
  */
2706
- ParameterSnapshot.prototype.getResolvedRouteId = /**
2852
+ ParameterSnapshot.prototype.getRouteIdParameter = /**
2707
2853
  * @private
2708
2854
  * @return {?}
2709
2855
  */
@@ -2716,6 +2862,21 @@
2716
2862
  */
2717
2863
  function (p) { return p.parameterDef.isRouteId; }))));
2718
2864
  };
2865
+ /**
2866
+ * @private
2867
+ * @return {?}
2868
+ */
2869
+ ParameterSnapshot.prototype.getRouteParameters = /**
2870
+ * @private
2871
+ * @return {?}
2872
+ */
2873
+ function () {
2874
+ return this.resolved.filter((/**
2875
+ * @param {?} r
2876
+ * @return {?}
2877
+ */
2878
+ function (r) { return !r.parameterDef.isRouteId; }));
2879
+ };
2719
2880
  /**
2720
2881
  * @return {?}
2721
2882
  */
@@ -2723,7 +2884,7 @@
2723
2884
  * @return {?}
2724
2885
  */
2725
2886
  function () {
2726
- return !!this.getResolvedRouteId();
2887
+ return !!this.getRouteIdParameter();
2727
2888
  };
2728
2889
  /**
2729
2890
  * @return {?}
@@ -2733,7 +2894,7 @@
2733
2894
  */
2734
2895
  function () {
2735
2896
  /** @type {?} */
2736
- var routeIdParam = this.getResolvedRouteId();
2897
+ var routeIdParam = this.getRouteIdParameter();
2737
2898
  return routeIdParam ? routeIdParam.formattedValue() : null;
2738
2899
  };
2739
2900
  /**
@@ -2759,6 +2920,25 @@
2759
2920
  }));
2760
2921
  return params;
2761
2922
  };
2923
+ /**
2924
+ * @return {?}
2925
+ */
2926
+ ParameterSnapshot.prototype.getAllFormattedParameters = /**
2927
+ * @return {?}
2928
+ */
2929
+ function () {
2930
+ /** @type {?} */
2931
+ var params = {};
2932
+ /** @type {?} */
2933
+ var routeIdParam = this.resolved.forEach((/**
2934
+ * @param {?} p
2935
+ * @return {?}
2936
+ */
2937
+ function (p) {
2938
+ params[p.parameterDef.name] = p.formattedValue();
2939
+ }));
2940
+ return params;
2941
+ };
2762
2942
  /**
2763
2943
  * @template T, S
2764
2944
  * @param {?} parameter
@@ -2780,18 +2960,54 @@
2780
2960
  return p.parameterDef === parameter ? p.replace(value) : p;
2781
2961
  })));
2782
2962
  };
2963
+ // @Trace()
2964
+ // @Trace()
2783
2965
  /**
2784
2966
  * @param {?} injector
2785
2967
  * @return {?}
2786
2968
  */
2787
- ParameterSnapshot.prototype.sanitise = /**
2969
+ ParameterSnapshot.prototype.sanitise =
2970
+ // @Trace()
2971
+ /**
2788
2972
  * @param {?} injector
2789
2973
  * @return {?}
2790
2974
  */
2791
2975
  function (injector) {
2792
2976
  return __awaiter(this, void 0, void 0, function () {
2977
+ var routeId, sanitisedValue, result, routeParameters, i, sanitisedValue;
2793
2978
  return __generator(this, function (_a) {
2794
- return [2 /*return*/, this];
2979
+ switch (_a.label) {
2980
+ case 0:
2981
+ if (!this.hasRouteId()) return [3 /*break*/, 2];
2982
+ routeId = this.getRouteIdParameter();
2983
+ return [4 /*yield*/, routeId.sanitise(this, injector)];
2984
+ case 1:
2985
+ sanitisedValue = _a.sent();
2986
+ if (!routeId.isSame(sanitisedValue)) {
2987
+ // if the route id has changed we redirect immediately as other
2988
+ // parameter sanitisers might use it.
2989
+ return [2 /*return*/, this.replace(routeId.parameterDef, sanitisedValue)];
2990
+ }
2991
+ _a.label = 2;
2992
+ case 2:
2993
+ result = this;
2994
+ routeParameters = this.getRouteParameters();
2995
+ i = 0;
2996
+ _a.label = 3;
2997
+ case 3:
2998
+ if (!(i < routeParameters.length)) return [3 /*break*/, 6];
2999
+ return [4 /*yield*/, routeParameters[i].sanitise(this, injector)];
3000
+ case 4:
3001
+ sanitisedValue = _a.sent();
3002
+ if (!routeParameters[i].isSame(sanitisedValue)) {
3003
+ result = this.replace(routeParameters[i].parameterDef, sanitisedValue);
3004
+ }
3005
+ _a.label = 5;
3006
+ case 5:
3007
+ i++;
3008
+ return [3 /*break*/, 3];
3009
+ case 6: return [2 /*return*/, result];
3010
+ }
2795
3011
  });
2796
3012
  });
2797
3013
  };
@@ -2801,25 +3017,31 @@
2801
3017
  __metadata("design:type", Function),
2802
3018
  __metadata("design:paramtypes", [exports.ParameterDefinition]),
2803
3019
  __metadata("design:returntype", ParameterSnapshot.ResolvedParameter)
2804
- ], ParameterSnapshot.prototype, "getResolvedParameter", null);
3020
+ ], ParameterSnapshot.prototype, "getParameter", null);
2805
3021
  __decorate([
2806
3022
  src.Memoize(),
2807
3023
  __metadata("design:type", Function),
2808
3024
  __metadata("design:paramtypes", [exports.ParameterDefinition]),
2809
3025
  __metadata("design:returntype", typeof (_a = typeof S !== "undefined" && S) === "function" ? _a : Object)
2810
- ], ParameterSnapshot.prototype, "getResolvedParameterValue", null);
3026
+ ], ParameterSnapshot.prototype, "getValueOf", null);
2811
3027
  __decorate([
2812
3028
  src.Memoize(),
2813
3029
  __metadata("design:type", Function),
2814
3030
  __metadata("design:paramtypes", [String]),
2815
3031
  __metadata("design:returntype", Object)
2816
- ], ParameterSnapshot.prototype, "getRouteParameter", null);
3032
+ ], ParameterSnapshot.prototype, "getParameterValue", null);
2817
3033
  __decorate([
2818
3034
  src.Memoize(),
2819
3035
  __metadata("design:type", Function),
2820
3036
  __metadata("design:paramtypes", []),
2821
3037
  __metadata("design:returntype", ParameterSnapshot.ResolvedValueParameter)
2822
- ], ParameterSnapshot.prototype, "getResolvedRouteId", null);
3038
+ ], ParameterSnapshot.prototype, "getRouteIdParameter", null);
3039
+ __decorate([
3040
+ src.Memoize(),
3041
+ __metadata("design:type", Function),
3042
+ __metadata("design:paramtypes", []),
3043
+ __metadata("design:returntype", Array)
3044
+ ], ParameterSnapshot.prototype, "getRouteParameters", null);
2823
3045
  return ParameterSnapshot;
2824
3046
  }());
2825
3047
  if (false) {
@@ -2834,10 +3056,13 @@
2834
3056
  (function (ParameterSnapshot) {
2835
3057
  /**
2836
3058
  * @param {?} placeDef
2837
- * @param {?} paramMap
3059
+ * @param {?} params
3060
+ * @param {?} urlSegments
2838
3061
  * @return {?}
2839
3062
  */
2840
- function create(placeDef, paramMap) {
3063
+ function create(placeDef, params, urlSegments) {
3064
+ /** @type {?} */
3065
+ var paramMap = new ConsolidatedParameterMap(params, urlSegments);
2841
3066
  /** @type {?} */
2842
3067
  var resolvedParameters = placeDef.getRouteParameters()
2843
3068
  .map((/**
@@ -2847,7 +3072,11 @@
2847
3072
  function (def) {
2848
3073
  if (def.isArray) {
2849
3074
  /** @type {?} */
2850
- var value = paramMap.has(def.name) ? paramMap.getAll(def.name).map((/**
3075
+ var value = paramMap.has(def.name) ? paramMap.getAll(def.name).filter((/**
3076
+ * @param {?} s
3077
+ * @return {?}
3078
+ */
3079
+ function (s) { return !___default__default.isEmpty(s); })).map((/**
2851
3080
  * @param {?} raw
2852
3081
  * @return {?}
2853
3082
  */
@@ -2863,6 +3092,140 @@
2863
3092
  return new ParameterSnapshot(placeDef, resolvedParameters);
2864
3093
  }
2865
3094
  ParameterSnapshot.create = create;
3095
+ /**
3096
+ * This a work around for the fact that an activated route with multiple segments doesn't
3097
+ * include the segment params in the paramMap as well as each segment returns an empty
3098
+ * param map even when `parameter`s has content.
3099
+ */
3100
+ var /**
3101
+ * This a work around for the fact that an activated route with multiple segments doesn't
3102
+ * include the segment params in the paramMap as well as each segment returns an empty
3103
+ * param map even when `parameter`s has content.
3104
+ */
3105
+ ConsolidatedParameterMap = /** @class */ (function () {
3106
+ function ConsolidatedParameterMap(paramMap, urlSegments) {
3107
+ this.paramMaps = [paramMap].concat((urlSegments || []).map((/**
3108
+ * @param {?} s
3109
+ * @return {?}
3110
+ */
3111
+ function (s) { return new ParamMapAdapter(s.parameters); }))).filter((/**
3112
+ * @param {?} m
3113
+ * @return {?}
3114
+ */
3115
+ function (m) { return !!m; })); // the activated route param map can be null
3116
+ }
3117
+ /**
3118
+ * @param {?} name
3119
+ * @return {?}
3120
+ */
3121
+ ConsolidatedParameterMap.prototype.get = /**
3122
+ * @param {?} name
3123
+ * @return {?}
3124
+ */
3125
+ function (name) {
3126
+ return this.paramMaps.find((/**
3127
+ * @param {?} m
3128
+ * @return {?}
3129
+ */
3130
+ function (m) { return m.has(name); })).get(name);
3131
+ };
3132
+ /**
3133
+ * @param {?} name
3134
+ * @return {?}
3135
+ */
3136
+ ConsolidatedParameterMap.prototype.getAll = /**
3137
+ * @param {?} name
3138
+ * @return {?}
3139
+ */
3140
+ function (name) {
3141
+ return this.paramMaps.find((/**
3142
+ * @param {?} m
3143
+ * @return {?}
3144
+ */
3145
+ function (m) { return m.has(name); })).getAll(name);
3146
+ };
3147
+ /**
3148
+ * @param {?} name
3149
+ * @return {?}
3150
+ */
3151
+ ConsolidatedParameterMap.prototype.has = /**
3152
+ * @param {?} name
3153
+ * @return {?}
3154
+ */
3155
+ function (name) {
3156
+ return !!this.paramMaps.find((/**
3157
+ * @param {?} m
3158
+ * @return {?}
3159
+ */
3160
+ function (m) { return m.has(name); }));
3161
+ };
3162
+ return ConsolidatedParameterMap;
3163
+ }());
3164
+ if (false) {
3165
+ /**
3166
+ * @type {?}
3167
+ * @private
3168
+ */
3169
+ ConsolidatedParameterMap.prototype.paramMaps;
3170
+ }
3171
+ var ParamMapAdapter = /** @class */ (function () {
3172
+ function ParamMapAdapter(params) {
3173
+ this.params = params;
3174
+ }
3175
+ /**
3176
+ * @param {?} name
3177
+ * @return {?}
3178
+ */
3179
+ ParamMapAdapter.prototype.get = /**
3180
+ * @param {?} name
3181
+ * @return {?}
3182
+ */
3183
+ function (name) {
3184
+ return this.params[name];
3185
+ };
3186
+ /**
3187
+ * @param {?} name
3188
+ * @return {?}
3189
+ */
3190
+ ParamMapAdapter.prototype.getAll = /**
3191
+ * @param {?} name
3192
+ * @return {?}
3193
+ */
3194
+ function (name) {
3195
+ /** @type {?} */
3196
+ var value = this.get(name);
3197
+ return Array.isArray(value) ? value : [value];
3198
+ };
3199
+ /**
3200
+ * @param {?} name
3201
+ * @return {?}
3202
+ */
3203
+ ParamMapAdapter.prototype.has = /**
3204
+ * @param {?} name
3205
+ * @return {?}
3206
+ */
3207
+ function (name) {
3208
+ return this.keys.includes(name);
3209
+ };
3210
+ Object.defineProperty(ParamMapAdapter.prototype, "keys", {
3211
+ get: /**
3212
+ * @return {?}
3213
+ */
3214
+ function () {
3215
+ return Object.keys(this.params);
3216
+ },
3217
+ enumerable: true,
3218
+ configurable: true
3219
+ });
3220
+ return ParamMapAdapter;
3221
+ }());
3222
+ if (false) {
3223
+ /**
3224
+ * @type {?}
3225
+ * @private
3226
+ */
3227
+ ParamMapAdapter.prototype.params;
3228
+ }
2866
3229
  /**
2867
3230
  * @abstract
2868
3231
  * @template T, S
@@ -2885,6 +3248,31 @@
2885
3248
  function () {
2886
3249
  return this.parameterDef.isRouteId;
2887
3250
  };
3251
+ /**
3252
+ * @param {?} visit
3253
+ * @param {?} injector
3254
+ * @return {?}
3255
+ */
3256
+ ResolvedParameter.prototype.sanitise = /**
3257
+ * @param {?} visit
3258
+ * @param {?} injector
3259
+ * @return {?}
3260
+ */
3261
+ function (visit, injector) {
3262
+ return __awaiter(this, void 0, void 0, function () {
3263
+ var sanitiser;
3264
+ return __generator(this, function (_a) {
3265
+ sanitiser = this.parameterDef.getSanitiser(injector);
3266
+ if (sanitiser) {
3267
+ return [2 /*return*/, sanitiser.sanitise(this.parameterDef, this.value, visit)];
3268
+ }
3269
+ else {
3270
+ return [2 /*return*/, this.value];
3271
+ }
3272
+ return [2 /*return*/];
3273
+ });
3274
+ });
3275
+ };
2888
3276
  return ResolvedParameter;
2889
3277
  }());
2890
3278
  ParameterSnapshot.ResolvedParameter = ResolvedParameter;
@@ -3128,19 +3516,25 @@
3128
3516
  _this._placeDefinition = new pectin.MutableValueModel();
3129
3517
  _this._resolvedParameters = new pectin.MutableValueModel();
3130
3518
  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
- _this._paramMap = chain(_this._activatedRouteModel).pullObservableValue((/**
3519
+ /** @type {?} */
3520
+ var paramMap = chain(_this._activatedRouteModel).pullObservableValue((/**
3132
3521
  * @param {?} ar
3133
3522
  * @return {?}
3134
3523
  */
3135
3524
  function (ar) { return ar.paramMap; }));
3136
- _this.placeConfigured = valueOf.all(chain(_this._inOutletUpdate).isFalsey(), _this._placeDefinition, _this._paramMap).areTruthy();
3137
- when.valueOf(_this._paramMap).changes((/**
3138
- * @param {?} params
3525
+ /** @type {?} */
3526
+ var urls = chain(_this._activatedRouteModel).pullObservableValue((/**
3527
+ * @param {?} ar
3139
3528
  * @return {?}
3140
3529
  */
3141
- function (params) {
3530
+ function (ar) { return ar.url; }));
3531
+ _this.placeConfigured = valueOf.all(chain(_this._inOutletUpdate).isFalsey(), _this._placeDefinition, paramMap, urls).areTruthy();
3532
+ when.anyOf(paramMap, urls).changes((/**
3533
+ * @return {?}
3534
+ */
3535
+ function () {
3142
3536
  /** @type {?} */
3143
- var snapshot = exports.ParameterSnapshot.create(_this._placeDefinition.value, params);
3537
+ var snapshot = exports.ParameterSnapshot.create(_this._placeDefinition.value, paramMap.value, urls.value);
3144
3538
  _this._incomingRouteChange.whileTrue((/**
3145
3539
  * @return {?}
3146
3540
  */
@@ -3163,6 +3557,10 @@
3163
3557
  unless: _this.incomingRouteChange
3164
3558
  });
3165
3559
  return _this;
3560
+ // const txo = new TransactionObserver().onEvent(e => console.log(e.toString()));
3561
+ // txo.observe('paramMap', paramMap);
3562
+ // txo.observe('urls', urls);
3563
+ // txo.observe('this._resolvedParameters', this._resolvedParameters);
3166
3564
  }
3167
3565
  Object.defineProperty(PlaceOutletComponent.prototype, "incomingRouteChange", {
3168
3566
  get: /**
@@ -3333,11 +3731,6 @@
3333
3731
  * @private
3334
3732
  */
3335
3733
  PlaceOutletComponent.prototype._placeDefinition;
3336
- /**
3337
- * @type {?}
3338
- * @private
3339
- */
3340
- PlaceOutletComponent.prototype._paramMap;
3341
3734
  /** @type {?} */
3342
3735
  PlaceOutletComponent.prototype._resolvedParameters;
3343
3736
  /**
@@ -3911,12 +4304,12 @@
3911
4304
  /**
3912
4305
  * @return {?}
3913
4306
  */
3914
- Visit.prototype.getRouteId = function () { };
4307
+ Visit.prototype.getRouteIdValue = function () { };
3915
4308
  /**
3916
4309
  * @param {?} name
3917
4310
  * @return {?}
3918
4311
  */
3919
- Visit.prototype.getRouteParameter = function (name) { };
4312
+ Visit.prototype.getParameterValue = function (name) { };
3920
4313
  }
3921
4314
 
3922
4315
  /**
@@ -4015,14 +4408,14 @@
4015
4408
  /** @type {?} */
4016
4409
  var placeDefinition = exports.PlaceComponent.getDefinition(activatedRoute.component);
4017
4410
  /** @type {?} */
4018
- var snapshot_1 = exports.ParameterSnapshot.create(placeDefinition, activatedRoute.paramMap);
4411
+ var snapshot_1 = exports.ParameterSnapshot.create(placeDefinition, activatedRoute.paramMap, activatedRoute.url);
4019
4412
  return snapshot_1.sanitise(this.injector).then((/**
4020
4413
  * @param {?} sanitised
4021
4414
  * @return {?}
4022
4415
  */
4023
4416
  function (sanitised) {
4024
- if (sanitised.hasChanged(snapshot_1)) {
4025
- return _this.placeRouter.createUrlTree(activatedRoute, snapshot_1, sanitised);
4417
+ if (sanitised.hasChanged(snapshot_1, true)) {
4418
+ return _this.placeRouter.getRedirectUrlTree(activatedRoute, sanitised);
4026
4419
  }
4027
4420
  else {
4028
4421
  return true;
@@ -4059,75 +4452,6 @@
4059
4452
  PlaceRouteGuard.prototype.injector;
4060
4453
  }
4061
4454
 
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
4455
  /**
4132
4456
  * @fileoverview added by tsickle
4133
4457
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -4239,16 +4563,17 @@
4239
4563
  */
4240
4564
  /**
4241
4565
  * @record
4242
- * @template T
4566
+ * @template S
4243
4567
  */
4244
4568
  function ParameterSanitiser() { }
4245
4569
  if (false) {
4246
4570
  /**
4571
+ * @param {?} parameterDef
4247
4572
  * @param {?} value
4248
4573
  * @param {?=} visit
4249
4574
  * @return {?}
4250
4575
  */
4251
- ParameterSanitiser.prototype.sanitise = function (value, visit) { };
4576
+ ParameterSanitiser.prototype.sanitise = function (parameterDef, value, visit) { };
4252
4577
  }
4253
4578
 
4254
4579
  /**
@@ -4443,7 +4768,7 @@
4443
4768
  if (!this.sanitiser) return [3 /*break*/, 2];
4444
4769
  this.initialValue = this.readFrom(this.snapshot);
4445
4770
  _a = this;
4446
- return [4 /*yield*/, this.sanitiser.sanitise(this.initialValue)];
4771
+ return [4 /*yield*/, this.sanitiser.sanitise(null, this.initialValue)];
4447
4772
  case 1:
4448
4773
  _a._sanitisedValue = _b.sent();
4449
4774
  if (this.initialValue !== this._sanitisedValue) {
@@ -4584,10 +4909,14 @@
4584
4909
  pectin.assert.isTruthy(this.parameterSanitisers.length !== 0);
4585
4910
  return this.routeIdSanitiser && this.routeIdSanitiser.valueChanged;
4586
4911
  };
4912
+ // @Trace()
4913
+ // @Trace()
4587
4914
  /**
4588
4915
  * @return {?}
4589
4916
  */
4590
- RouteParameterSanitiser.prototype.getRedirectParams = /**
4917
+ RouteParameterSanitiser.prototype.getRedirectParams =
4918
+ // @Trace()
4919
+ /**
4591
4920
  * @return {?}
4592
4921
  */
4593
4922
  function () {
@@ -4626,12 +4955,6 @@
4626
4955
  __metadata("design:paramtypes", [exports.ParameterDefinition]),
4627
4956
  __metadata("design:returntype", Object)
4628
4957
  ], RouteParameterSanitiser.prototype, "getSanitiser", null);
4629
- __decorate([
4630
- pectin.Trace(),
4631
- __metadata("design:type", Function),
4632
- __metadata("design:paramtypes", []),
4633
- __metadata("design:returntype", Array)
4634
- ], RouteParameterSanitiser.prototype, "getRedirectParams", null);
4635
4958
  return RouteParameterSanitiser;
4636
4959
  }());
4637
4960
  if (false) {
@@ -4783,7 +5106,6 @@
4783
5106
  exports.CommandDirective = CommandDirective;
4784
5107
  exports.ConfirmationDialogComponent = ConfirmationDialogComponent;
4785
5108
  exports.DEFINITION_META_DATA_KEY = DEFINITION_META_DATA_KEY;
4786
- exports.DefaultParameterSanitiser = DefaultParameterSanitiser;
4787
5109
  exports.DialogInteractionService = DialogInteractionService;
4788
5110
  exports.Dimension = Dimension;
4789
5111
  exports.DisposableComponent = DisposableComponent;