@coolon/angular-ui-powerups 0.0.51 → 0.0.54
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 +382 -746
- 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 +2 -2
- package/esm2015/lib/place/guards/place-route.guard.js +2 -2
- package/esm2015/lib/place/index.js +2 -2
- package/esm2015/lib/place/route/parameter-definition.class.js +11 -35
- package/esm2015/lib/place/route/parameter-sanitiser.js +3 -4
- package/esm2015/lib/place/route/parameter-snapshot.js +65 -209
- package/esm2015/lib/place/route/route-parameter-value.js +223 -0
- 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 +2 -2
- package/esm5/lib/place/guards/place-route.guard.js +2 -2
- package/esm5/lib/place/index.js +2 -2
- package/esm5/lib/place/route/parameter-definition.class.js +12 -44
- package/esm5/lib/place/route/parameter-sanitiser.js +3 -4
- package/esm5/lib/place/route/parameter-snapshot.js +69 -274
- package/esm5/lib/place/route/route-parameter-value.js +309 -0
- package/esm5/public_api.js +2 -2
- package/fesm2015/coolon-angular-ui-powerups.js +298 -539
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +385 -748
- package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/place/index.d.ts +1 -1
- package/lib/place/route/parameter-definition.class.d.ts +2 -2
- package/lib/place/route/parameter-sanitiser.d.ts +2 -2
- package/lib/place/route/parameter-snapshot.d.ts +5 -27
- package/lib/place/route/route-parameter-value.d.ts +42 -0
- package/package.json +1 -1
- package/esm2015/lib/place/route/route-parameter-sanitiser.js +0 -296
- package/esm5/lib/place/route/route-parameter-sanitiser.js +0 -435
- package/lib/place/route/route-parameter-sanitiser.d.ts +0 -44
|
@@ -2677,62 +2677,30 @@
|
|
|
2677
2677
|
this.placeHistory = placeHistory;
|
|
2678
2678
|
}
|
|
2679
2679
|
/**
|
|
2680
|
-
* @param {?}
|
|
2681
|
-
* @param {?} value
|
|
2680
|
+
* @param {?} parameter
|
|
2682
2681
|
* @param {?=} visit
|
|
2683
2682
|
* @return {?}
|
|
2684
2683
|
*/
|
|
2685
2684
|
DefaultParameterSanitiser.prototype.sanitise = /**
|
|
2686
|
-
* @param {?}
|
|
2687
|
-
* @param {?} value
|
|
2685
|
+
* @param {?} parameter
|
|
2688
2686
|
* @param {?=} visit
|
|
2689
2687
|
* @return {?}
|
|
2690
2688
|
*/
|
|
2691
|
-
function (
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
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); }));
|
|
2689
|
+
function (parameter, visit) {
|
|
2690
|
+
/** @type {?} */
|
|
2691
|
+
var value = parameter.value;
|
|
2692
|
+
if (parameter.isMissing()) {
|
|
2693
|
+
/** @type {?} */
|
|
2694
|
+
var previousVisit = ___default__default.first(this.placeHistory.getHistory(visit.placeDefinition));
|
|
2695
|
+
if (this.remember && previousVisit) {
|
|
2696
|
+
value = previousVisit.getValueOf(parameter.definition);
|
|
2712
2697
|
}
|
|
2713
|
-
return
|
|
2698
|
+
return parameter.isEmptyValue(value) ? this.defaultValue : value;
|
|
2714
2699
|
}
|
|
2715
2700
|
else {
|
|
2716
2701
|
return value;
|
|
2717
2702
|
}
|
|
2718
2703
|
};
|
|
2719
|
-
/**
|
|
2720
|
-
* @private
|
|
2721
|
-
* @param {?} def
|
|
2722
|
-
* @param {?} value
|
|
2723
|
-
* @return {?}
|
|
2724
|
-
*/
|
|
2725
|
-
DefaultParameterSanitiser.prototype.isBlank = /**
|
|
2726
|
-
* @private
|
|
2727
|
-
* @param {?} def
|
|
2728
|
-
* @param {?} value
|
|
2729
|
-
* @return {?}
|
|
2730
|
-
*/
|
|
2731
|
-
function (def, value) {
|
|
2732
|
-
/** @type {?} */
|
|
2733
|
-
var isNil = ___default__default.isNil(value);
|
|
2734
|
-
return isNil ? true : def.isArray ? value['length'] < 1 : false;
|
|
2735
|
-
};
|
|
2736
2704
|
return DefaultParameterSanitiser;
|
|
2737
2705
|
}());
|
|
2738
2706
|
ParameterDefinition.DefaultParameterSanitiser = DefaultParameterSanitiser;
|
|
@@ -2746,14 +2714,315 @@
|
|
|
2746
2714
|
}
|
|
2747
2715
|
})(exports.ParameterDefinition || (exports.ParameterDefinition = {}));
|
|
2748
2716
|
|
|
2717
|
+
/**
|
|
2718
|
+
* @fileoverview added by tsickle
|
|
2719
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2720
|
+
*/
|
|
2721
|
+
/**
|
|
2722
|
+
* @abstract
|
|
2723
|
+
* @template S, T, R
|
|
2724
|
+
*/
|
|
2725
|
+
/**
|
|
2726
|
+
* @abstract
|
|
2727
|
+
* @template S, T, R
|
|
2728
|
+
*/
|
|
2729
|
+
exports.RouteParameterValue = /** @class */ (function () {
|
|
2730
|
+
function RouteParameterValue(definition, rawValue) {
|
|
2731
|
+
this.definition = definition;
|
|
2732
|
+
this.rawValue = rawValue;
|
|
2733
|
+
}
|
|
2734
|
+
/**
|
|
2735
|
+
* @return {?}
|
|
2736
|
+
*/
|
|
2737
|
+
RouteParameterValue.prototype.isRouteId = /**
|
|
2738
|
+
* @return {?}
|
|
2739
|
+
*/
|
|
2740
|
+
function () {
|
|
2741
|
+
return this.definition.isRouteId;
|
|
2742
|
+
};
|
|
2743
|
+
/**
|
|
2744
|
+
* @param {?} otherValue
|
|
2745
|
+
* @return {?}
|
|
2746
|
+
*/
|
|
2747
|
+
RouteParameterValue.prototype.hasChanged = /**
|
|
2748
|
+
* @param {?} otherValue
|
|
2749
|
+
* @return {?}
|
|
2750
|
+
*/
|
|
2751
|
+
function (otherValue) {
|
|
2752
|
+
return this.isEmpty() ?
|
|
2753
|
+
!this.isEmptyValue(otherValue) :
|
|
2754
|
+
this.isEmptyValue(otherValue) || !this.isSameValue(otherValue);
|
|
2755
|
+
};
|
|
2756
|
+
/**
|
|
2757
|
+
* Return's true if the current value is empty.
|
|
2758
|
+
*/
|
|
2759
|
+
/**
|
|
2760
|
+
* Return's true if the current value is empty.
|
|
2761
|
+
* @return {?}
|
|
2762
|
+
*/
|
|
2763
|
+
RouteParameterValue.prototype.isEmpty = /**
|
|
2764
|
+
* Return's true if the current value is empty.
|
|
2765
|
+
* @return {?}
|
|
2766
|
+
*/
|
|
2767
|
+
function () {
|
|
2768
|
+
return this.isEmptyValue(this.value);
|
|
2769
|
+
};
|
|
2770
|
+
/**
|
|
2771
|
+
* Returns true if the rawValue is undefined. This
|
|
2772
|
+
*/
|
|
2773
|
+
/**
|
|
2774
|
+
* Returns true if the rawValue is undefined. This
|
|
2775
|
+
* @return {?}
|
|
2776
|
+
*/
|
|
2777
|
+
RouteParameterValue.prototype.isMissing = /**
|
|
2778
|
+
* Returns true if the rawValue is undefined. This
|
|
2779
|
+
* @return {?}
|
|
2780
|
+
*/
|
|
2781
|
+
function () {
|
|
2782
|
+
return ___default__default.isUndefined(this.rawValue);
|
|
2783
|
+
};
|
|
2784
|
+
/**
|
|
2785
|
+
* @param {?} visit
|
|
2786
|
+
* @param {?} injector
|
|
2787
|
+
* @return {?}
|
|
2788
|
+
*/
|
|
2789
|
+
RouteParameterValue.prototype.sanitise = /**
|
|
2790
|
+
* @param {?} visit
|
|
2791
|
+
* @param {?} injector
|
|
2792
|
+
* @return {?}
|
|
2793
|
+
*/
|
|
2794
|
+
function (visit, injector) {
|
|
2795
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2796
|
+
var sanitiser;
|
|
2797
|
+
return __generator(this, function (_a) {
|
|
2798
|
+
sanitiser = this.definition.getSanitiser(injector);
|
|
2799
|
+
if (sanitiser) {
|
|
2800
|
+
return [2 /*return*/, sanitiser.sanitise(this, visit)];
|
|
2801
|
+
}
|
|
2802
|
+
else {
|
|
2803
|
+
return [2 /*return*/, this.value];
|
|
2804
|
+
}
|
|
2805
|
+
return [2 /*return*/];
|
|
2806
|
+
});
|
|
2807
|
+
});
|
|
2808
|
+
};
|
|
2809
|
+
return RouteParameterValue;
|
|
2810
|
+
}());
|
|
2811
|
+
if (false) {
|
|
2812
|
+
/** @type {?} */
|
|
2813
|
+
exports.RouteParameterValue.prototype.value;
|
|
2814
|
+
/** @type {?} */
|
|
2815
|
+
exports.RouteParameterValue.prototype.definition;
|
|
2816
|
+
/**
|
|
2817
|
+
* @type {?}
|
|
2818
|
+
* @protected
|
|
2819
|
+
*/
|
|
2820
|
+
exports.RouteParameterValue.prototype.rawValue;
|
|
2821
|
+
/**
|
|
2822
|
+
* @abstract
|
|
2823
|
+
* @param {?} otherValue
|
|
2824
|
+
* @return {?}
|
|
2825
|
+
*/
|
|
2826
|
+
exports.RouteParameterValue.prototype.isSameValue = function (otherValue) { };
|
|
2827
|
+
/**
|
|
2828
|
+
* @abstract
|
|
2829
|
+
* @return {?}
|
|
2830
|
+
*/
|
|
2831
|
+
exports.RouteParameterValue.prototype.formattedValue = function () { };
|
|
2832
|
+
/**
|
|
2833
|
+
* @abstract
|
|
2834
|
+
* @param {?} value
|
|
2835
|
+
* @return {?}
|
|
2836
|
+
*/
|
|
2837
|
+
exports.RouteParameterValue.prototype.replace = function (value) { };
|
|
2838
|
+
/**
|
|
2839
|
+
* @abstract
|
|
2840
|
+
* @param {?} value
|
|
2841
|
+
* @return {?}
|
|
2842
|
+
*/
|
|
2843
|
+
exports.RouteParameterValue.prototype.isEmptyValue = function (value) { };
|
|
2844
|
+
}
|
|
2845
|
+
(function (RouteParameterValue) {
|
|
2846
|
+
/**
|
|
2847
|
+
* @template T
|
|
2848
|
+
* @param {?} def
|
|
2849
|
+
* @param {?} paramMap
|
|
2850
|
+
* @return {?}
|
|
2851
|
+
*/
|
|
2852
|
+
function create(def, paramMap) {
|
|
2853
|
+
// NOTE: Using undefined is important as it triggers the isMissing flag which is used by defaultValue and remember flags
|
|
2854
|
+
return def.isArray ?
|
|
2855
|
+
new RouteParameterValue.Array(def, paramMap.has(def.name) ? paramMap.getAll(def.name) : undefined) :
|
|
2856
|
+
new RouteParameterValue.Scalar(def, paramMap.has(def.name) ? paramMap.get(def.name) : undefined);
|
|
2857
|
+
}
|
|
2858
|
+
RouteParameterValue.create = create;
|
|
2859
|
+
/**
|
|
2860
|
+
* @template T
|
|
2861
|
+
*/
|
|
2862
|
+
var Scalar = /** @class */ (function (_super) {
|
|
2863
|
+
__extends(Scalar, _super);
|
|
2864
|
+
function Scalar() {
|
|
2865
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
2866
|
+
}
|
|
2867
|
+
Object.defineProperty(Scalar.prototype, "value", {
|
|
2868
|
+
get: /**
|
|
2869
|
+
* @return {?}
|
|
2870
|
+
*/
|
|
2871
|
+
function () {
|
|
2872
|
+
return this.definition.type.parse(this.rawValue);
|
|
2873
|
+
},
|
|
2874
|
+
enumerable: true,
|
|
2875
|
+
configurable: true
|
|
2876
|
+
});
|
|
2877
|
+
/**
|
|
2878
|
+
* @param {?} otherValue
|
|
2879
|
+
* @return {?}
|
|
2880
|
+
*/
|
|
2881
|
+
Scalar.prototype.isSameValue = /**
|
|
2882
|
+
* @param {?} otherValue
|
|
2883
|
+
* @return {?}
|
|
2884
|
+
*/
|
|
2885
|
+
function (otherValue) {
|
|
2886
|
+
return this.value === otherValue;
|
|
2887
|
+
};
|
|
2888
|
+
/**
|
|
2889
|
+
* @param {?} value
|
|
2890
|
+
* @return {?}
|
|
2891
|
+
*/
|
|
2892
|
+
Scalar.prototype.replace = /**
|
|
2893
|
+
* @param {?} value
|
|
2894
|
+
* @return {?}
|
|
2895
|
+
*/
|
|
2896
|
+
function (value) {
|
|
2897
|
+
return new RouteParameterValue.Scalar(this.definition, this.isEmptyValue(value) ? undefined : this.definition.type.format(value));
|
|
2898
|
+
};
|
|
2899
|
+
/**
|
|
2900
|
+
* @return {?}
|
|
2901
|
+
*/
|
|
2902
|
+
Scalar.prototype.formattedValue = /**
|
|
2903
|
+
* @return {?}
|
|
2904
|
+
*/
|
|
2905
|
+
function () {
|
|
2906
|
+
return this.isEmpty() ? undefined : this.definition.type.format(this.value);
|
|
2907
|
+
};
|
|
2908
|
+
/**
|
|
2909
|
+
* @param {?} value
|
|
2910
|
+
* @return {?}
|
|
2911
|
+
*/
|
|
2912
|
+
Scalar.prototype.isEmptyValue = /**
|
|
2913
|
+
* @param {?} value
|
|
2914
|
+
* @return {?}
|
|
2915
|
+
*/
|
|
2916
|
+
function (value) {
|
|
2917
|
+
return ___default__default.isNil(value);
|
|
2918
|
+
};
|
|
2919
|
+
__decorate([
|
|
2920
|
+
src.Memoize(),
|
|
2921
|
+
__metadata("design:type", Object),
|
|
2922
|
+
__metadata("design:paramtypes", [])
|
|
2923
|
+
], Scalar.prototype, "value", null);
|
|
2924
|
+
return Scalar;
|
|
2925
|
+
}(RouteParameterValue));
|
|
2926
|
+
RouteParameterValue.Scalar = Scalar;
|
|
2927
|
+
/**
|
|
2928
|
+
* @template T
|
|
2929
|
+
*/
|
|
2930
|
+
var Array = /** @class */ (function (_super) {
|
|
2931
|
+
__extends(Array, _super);
|
|
2932
|
+
function Array() {
|
|
2933
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
2934
|
+
}
|
|
2935
|
+
Object.defineProperty(Array.prototype, "value", {
|
|
2936
|
+
get: /**
|
|
2937
|
+
* @return {?}
|
|
2938
|
+
*/
|
|
2939
|
+
function () {
|
|
2940
|
+
var _this = this;
|
|
2941
|
+
return (this.rawValue || [])
|
|
2942
|
+
.filter((/**
|
|
2943
|
+
* @param {?} s
|
|
2944
|
+
* @return {?}
|
|
2945
|
+
*/
|
|
2946
|
+
function (s) { return !___default__default.isEmpty(s); }))
|
|
2947
|
+
.map((/**
|
|
2948
|
+
* @param {?} raw
|
|
2949
|
+
* @return {?}
|
|
2950
|
+
*/
|
|
2951
|
+
function (raw) { return _this.definition.type.parse(raw); }));
|
|
2952
|
+
},
|
|
2953
|
+
enumerable: true,
|
|
2954
|
+
configurable: true
|
|
2955
|
+
});
|
|
2956
|
+
/**
|
|
2957
|
+
* @param {?} otherValue
|
|
2958
|
+
* @return {?}
|
|
2959
|
+
*/
|
|
2960
|
+
Array.prototype.isSameValue = /**
|
|
2961
|
+
* @param {?} otherValue
|
|
2962
|
+
* @return {?}
|
|
2963
|
+
*/
|
|
2964
|
+
function (otherValue) {
|
|
2965
|
+
return ___default__default.isEqual(this.value, otherValue);
|
|
2966
|
+
};
|
|
2967
|
+
/**
|
|
2968
|
+
* @param {?} value
|
|
2969
|
+
* @return {?}
|
|
2970
|
+
*/
|
|
2971
|
+
Array.prototype.replace = /**
|
|
2972
|
+
* @param {?} value
|
|
2973
|
+
* @return {?}
|
|
2974
|
+
*/
|
|
2975
|
+
function (value) {
|
|
2976
|
+
var _this = this;
|
|
2977
|
+
return new RouteParameterValue.Array(this.definition, this.isEmptyValue(value) ? undefined : value.map((/**
|
|
2978
|
+
* @param {?} v
|
|
2979
|
+
* @return {?}
|
|
2980
|
+
*/
|
|
2981
|
+
function (v) { return _this.definition.type.format(v); })));
|
|
2982
|
+
};
|
|
2983
|
+
/**
|
|
2984
|
+
* @return {?}
|
|
2985
|
+
*/
|
|
2986
|
+
Array.prototype.formattedValue = /**
|
|
2987
|
+
* @return {?}
|
|
2988
|
+
*/
|
|
2989
|
+
function () {
|
|
2990
|
+
var _this = this;
|
|
2991
|
+
return this.isEmpty() ? [] : this.value.map((/**
|
|
2992
|
+
* @param {?} v
|
|
2993
|
+
* @return {?}
|
|
2994
|
+
*/
|
|
2995
|
+
function (v) { return _this.definition.type.format(v); }));
|
|
2996
|
+
};
|
|
2997
|
+
/**
|
|
2998
|
+
* @param {?} value
|
|
2999
|
+
* @return {?}
|
|
3000
|
+
*/
|
|
3001
|
+
Array.prototype.isEmptyValue = /**
|
|
3002
|
+
* @param {?} value
|
|
3003
|
+
* @return {?}
|
|
3004
|
+
*/
|
|
3005
|
+
function (value) {
|
|
3006
|
+
return ___default__default.isNil(value) || value.length < 1;
|
|
3007
|
+
};
|
|
3008
|
+
__decorate([
|
|
3009
|
+
src.Memoize(),
|
|
3010
|
+
__metadata("design:type", Array),
|
|
3011
|
+
__metadata("design:paramtypes", [])
|
|
3012
|
+
], Array.prototype, "value", null);
|
|
3013
|
+
return Array;
|
|
3014
|
+
}(RouteParameterValue));
|
|
3015
|
+
RouteParameterValue.Array = Array;
|
|
3016
|
+
})(exports.RouteParameterValue || (exports.RouteParameterValue = {}));
|
|
3017
|
+
|
|
2749
3018
|
/**
|
|
2750
3019
|
* @fileoverview added by tsickle
|
|
2751
3020
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2752
3021
|
*/
|
|
2753
3022
|
exports.ParameterSnapshot = /** @class */ (function () {
|
|
2754
|
-
function ParameterSnapshot(placeDefinition,
|
|
3023
|
+
function ParameterSnapshot(placeDefinition, parameters) {
|
|
2755
3024
|
this.placeDefinition = placeDefinition;
|
|
2756
|
-
this.
|
|
3025
|
+
this.parameters = parameters;
|
|
2757
3026
|
}
|
|
2758
3027
|
/**
|
|
2759
3028
|
* @param {?} other
|
|
@@ -2768,18 +3037,18 @@
|
|
|
2768
3037
|
function (other, debug) {
|
|
2769
3038
|
if (debug === void 0) { debug = false; }
|
|
2770
3039
|
/** @type {?} */
|
|
2771
|
-
var changed = this.
|
|
3040
|
+
var changed = this.parameters.find((/**
|
|
2772
3041
|
* @param {?} r
|
|
2773
3042
|
* @return {?}
|
|
2774
3043
|
*/
|
|
2775
3044
|
function (r) {
|
|
2776
|
-
return
|
|
3045
|
+
return r.hasChanged(other.getValueOf(r.definition));
|
|
2777
3046
|
}));
|
|
2778
3047
|
if (changed && debug) {
|
|
2779
3048
|
console.log({
|
|
2780
|
-
name: changed.
|
|
3049
|
+
name: changed.definition.name,
|
|
2781
3050
|
mine: changed.value,
|
|
2782
|
-
theirs: other.getValueOf(changed.
|
|
3051
|
+
theirs: other.getValueOf(changed.definition)
|
|
2783
3052
|
});
|
|
2784
3053
|
}
|
|
2785
3054
|
return !!changed;
|
|
@@ -2795,11 +3064,11 @@
|
|
|
2795
3064
|
* @return {?}
|
|
2796
3065
|
*/
|
|
2797
3066
|
function (parameterDef) {
|
|
2798
|
-
return this.
|
|
3067
|
+
return this.parameters.find((/**
|
|
2799
3068
|
* @param {?} r
|
|
2800
3069
|
* @return {?}
|
|
2801
3070
|
*/
|
|
2802
|
-
function (r) { return r.
|
|
3071
|
+
function (r) { return r.definition === parameterDef; }));
|
|
2803
3072
|
};
|
|
2804
3073
|
/**
|
|
2805
3074
|
* @template T, S
|
|
@@ -2835,11 +3104,11 @@
|
|
|
2835
3104
|
*/
|
|
2836
3105
|
function (name) {
|
|
2837
3106
|
/** @type {?} */
|
|
2838
|
-
var resolvedParameter = this.
|
|
3107
|
+
var resolvedParameter = this.parameters.find((/**
|
|
2839
3108
|
* @param {?} r
|
|
2840
3109
|
* @return {?}
|
|
2841
3110
|
*/
|
|
2842
|
-
function (r) { return r.
|
|
3111
|
+
function (r) { return r.definition.name === name; }));
|
|
2843
3112
|
return resolvedParameter ? resolvedParameter.value : null;
|
|
2844
3113
|
};
|
|
2845
3114
|
/**
|
|
@@ -2853,11 +3122,11 @@
|
|
|
2853
3122
|
function () {
|
|
2854
3123
|
// RouteId's are never arrays: see parameter-decorators.ts createDefinition methods. It would be nice to
|
|
2855
3124
|
// capture this in the type system though
|
|
2856
|
-
return (/** @type {?} */ (this.
|
|
3125
|
+
return (/** @type {?} */ (this.parameters.find((/**
|
|
2857
3126
|
* @param {?} p
|
|
2858
3127
|
* @return {?}
|
|
2859
3128
|
*/
|
|
2860
|
-
function (p) { return p.
|
|
3129
|
+
function (p) { return p.definition.isRouteId; }))));
|
|
2861
3130
|
};
|
|
2862
3131
|
/**
|
|
2863
3132
|
* @private
|
|
@@ -2868,11 +3137,11 @@
|
|
|
2868
3137
|
* @return {?}
|
|
2869
3138
|
*/
|
|
2870
3139
|
function () {
|
|
2871
|
-
return this.
|
|
3140
|
+
return this.parameters.filter((/**
|
|
2872
3141
|
* @param {?} r
|
|
2873
3142
|
* @return {?}
|
|
2874
3143
|
*/
|
|
2875
|
-
function (r) { return !r.
|
|
3144
|
+
function (r) { return !r.definition.isRouteId; }));
|
|
2876
3145
|
};
|
|
2877
3146
|
/**
|
|
2878
3147
|
* @return {?}
|
|
@@ -2897,43 +3166,37 @@
|
|
|
2897
3166
|
/**
|
|
2898
3167
|
* @return {?}
|
|
2899
3168
|
*/
|
|
2900
|
-
ParameterSnapshot.prototype.
|
|
3169
|
+
ParameterSnapshot.prototype.getNonEmptyParameters = /**
|
|
2901
3170
|
* @return {?}
|
|
2902
3171
|
*/
|
|
2903
3172
|
function () {
|
|
2904
|
-
/**
|
|
2905
|
-
var params = {};
|
|
2906
|
-
/** @type {?} */
|
|
2907
|
-
var routeIdParam = this.resolved.filter((/**
|
|
2908
|
-
* @param {?} p
|
|
2909
|
-
* @return {?}
|
|
2910
|
-
*/
|
|
2911
|
-
function (p) { return !p.parameterDef.isRouteId; })).forEach((/**
|
|
3173
|
+
return this.parameters.filter((/**
|
|
2912
3174
|
* @param {?} p
|
|
2913
3175
|
* @return {?}
|
|
2914
3176
|
*/
|
|
2915
|
-
function (p) {
|
|
2916
|
-
params[p.parameterDef.name] = p.formattedValue();
|
|
2917
|
-
}));
|
|
2918
|
-
return params;
|
|
3177
|
+
function (p) { return !p.isEmpty(); }));
|
|
2919
3178
|
};
|
|
2920
3179
|
/**
|
|
2921
3180
|
* @return {?}
|
|
2922
3181
|
*/
|
|
2923
|
-
ParameterSnapshot.prototype.
|
|
3182
|
+
ParameterSnapshot.prototype.getFormattedParameters = /**
|
|
2924
3183
|
* @return {?}
|
|
2925
3184
|
*/
|
|
2926
3185
|
function () {
|
|
2927
3186
|
/** @type {?} */
|
|
2928
3187
|
var params = {};
|
|
2929
3188
|
/** @type {?} */
|
|
2930
|
-
var routeIdParam = this.
|
|
3189
|
+
var routeIdParam = this.getNonEmptyParameters()
|
|
3190
|
+
.filter((/**
|
|
2931
3191
|
* @param {?} p
|
|
2932
3192
|
* @return {?}
|
|
2933
3193
|
*/
|
|
2934
|
-
function (p) {
|
|
2935
|
-
|
|
2936
|
-
|
|
3194
|
+
function (p) { return !p.definition.isRouteId; }))
|
|
3195
|
+
.forEach((/**
|
|
3196
|
+
* @param {?} p
|
|
3197
|
+
* @return {?}
|
|
3198
|
+
*/
|
|
3199
|
+
function (p) { return params[p.definition.name] = p.formattedValue(); }));
|
|
2937
3200
|
return params;
|
|
2938
3201
|
};
|
|
2939
3202
|
/**
|
|
@@ -2946,12 +3209,12 @@
|
|
|
2946
3209
|
/** @type {?} */
|
|
2947
3210
|
var params = {};
|
|
2948
3211
|
/** @type {?} */
|
|
2949
|
-
var routeIdParam = this.
|
|
3212
|
+
var routeIdParam = this.parameters.forEach((/**
|
|
2950
3213
|
* @param {?} p
|
|
2951
3214
|
* @return {?}
|
|
2952
3215
|
*/
|
|
2953
3216
|
function (p) {
|
|
2954
|
-
params[p.
|
|
3217
|
+
params[p.definition.name] = p.value;
|
|
2955
3218
|
}));
|
|
2956
3219
|
return params;
|
|
2957
3220
|
};
|
|
@@ -2968,12 +3231,12 @@
|
|
|
2968
3231
|
* @return {?}
|
|
2969
3232
|
*/
|
|
2970
3233
|
function (parameter, value) {
|
|
2971
|
-
return new ParameterSnapshot(this.placeDefinition, this.
|
|
3234
|
+
return new ParameterSnapshot(this.placeDefinition, this.parameters.map((/**
|
|
2972
3235
|
* @param {?} p
|
|
2973
3236
|
* @return {?}
|
|
2974
3237
|
*/
|
|
2975
3238
|
function (p) {
|
|
2976
|
-
return p.
|
|
3239
|
+
return p.definition === parameter ? p.replace(value) : p;
|
|
2977
3240
|
})));
|
|
2978
3241
|
};
|
|
2979
3242
|
/**
|
|
@@ -2995,10 +3258,10 @@
|
|
|
2995
3258
|
return [4 /*yield*/, routeId.sanitise(this, injector)];
|
|
2996
3259
|
case 1:
|
|
2997
3260
|
sanitisedValue = _a.sent();
|
|
2998
|
-
if (
|
|
3261
|
+
if (routeId.hasChanged(sanitisedValue)) {
|
|
2999
3262
|
// if the route id has changed we redirect immediately as other
|
|
3000
3263
|
// parameter sanitisers might use it.
|
|
3001
|
-
return [2 /*return*/, this.replace(routeId.
|
|
3264
|
+
return [2 /*return*/, this.replace(routeId.definition, sanitisedValue)];
|
|
3002
3265
|
}
|
|
3003
3266
|
_a.label = 2;
|
|
3004
3267
|
case 2:
|
|
@@ -3012,8 +3275,8 @@
|
|
|
3012
3275
|
return [4 /*yield*/, routeParameter.sanitise(this, injector)];
|
|
3013
3276
|
case 4:
|
|
3014
3277
|
sanitisedValue = _a.sent();
|
|
3015
|
-
if (
|
|
3016
|
-
result = result.replace(routeParameter.
|
|
3278
|
+
if (routeParameter.hasChanged(sanitisedValue)) {
|
|
3279
|
+
result = result.replace(routeParameter.definition, sanitisedValue);
|
|
3017
3280
|
}
|
|
3018
3281
|
_a.label = 5;
|
|
3019
3282
|
case 5:
|
|
@@ -3029,7 +3292,7 @@
|
|
|
3029
3292
|
src.Memoize(),
|
|
3030
3293
|
__metadata("design:type", Function),
|
|
3031
3294
|
__metadata("design:paramtypes", [exports.ParameterDefinition]),
|
|
3032
|
-
__metadata("design:returntype",
|
|
3295
|
+
__metadata("design:returntype", exports.RouteParameterValue)
|
|
3033
3296
|
], ParameterSnapshot.prototype, "getParameter", null);
|
|
3034
3297
|
__decorate([
|
|
3035
3298
|
src.Memoize(),
|
|
@@ -3047,7 +3310,7 @@
|
|
|
3047
3310
|
src.Memoize(),
|
|
3048
3311
|
__metadata("design:type", Function),
|
|
3049
3312
|
__metadata("design:paramtypes", []),
|
|
3050
|
-
__metadata("design:returntype",
|
|
3313
|
+
__metadata("design:returntype", exports.RouteParameterValue.Scalar)
|
|
3051
3314
|
], ParameterSnapshot.prototype, "getRouteIdParameter", null);
|
|
3052
3315
|
__decorate([
|
|
3053
3316
|
src.Memoize(),
|
|
@@ -3055,6 +3318,12 @@
|
|
|
3055
3318
|
__metadata("design:paramtypes", []),
|
|
3056
3319
|
__metadata("design:returntype", Array)
|
|
3057
3320
|
], ParameterSnapshot.prototype, "getRouteParameters", null);
|
|
3321
|
+
__decorate([
|
|
3322
|
+
pectin.Trace(),
|
|
3323
|
+
__metadata("design:type", Function),
|
|
3324
|
+
__metadata("design:paramtypes", []),
|
|
3325
|
+
__metadata("design:returntype", void 0)
|
|
3326
|
+
], ParameterSnapshot.prototype, "getFormattedParameters", null);
|
|
3058
3327
|
return ParameterSnapshot;
|
|
3059
3328
|
}());
|
|
3060
3329
|
if (false) {
|
|
@@ -3064,7 +3333,7 @@
|
|
|
3064
3333
|
* @type {?}
|
|
3065
3334
|
* @private
|
|
3066
3335
|
*/
|
|
3067
|
-
exports.ParameterSnapshot.prototype.
|
|
3336
|
+
exports.ParameterSnapshot.prototype.parameters;
|
|
3068
3337
|
}
|
|
3069
3338
|
(function (ParameterSnapshot) {
|
|
3070
3339
|
/**
|
|
@@ -3077,31 +3346,11 @@
|
|
|
3077
3346
|
/** @type {?} */
|
|
3078
3347
|
var paramMap = new ConsolidatedParameterMap(params, urlSegments);
|
|
3079
3348
|
/** @type {?} */
|
|
3080
|
-
var resolvedParameters = placeDef.getRouteParameters()
|
|
3081
|
-
.map((/**
|
|
3349
|
+
var resolvedParameters = placeDef.getRouteParameters().map((/**
|
|
3082
3350
|
* @param {?} def
|
|
3083
3351
|
* @return {?}
|
|
3084
3352
|
*/
|
|
3085
|
-
function (def) {
|
|
3086
|
-
if (def.isArray) {
|
|
3087
|
-
/** @type {?} */
|
|
3088
|
-
var value = paramMap.has(def.name) ? paramMap.getAll(def.name).filter((/**
|
|
3089
|
-
* @param {?} s
|
|
3090
|
-
* @return {?}
|
|
3091
|
-
*/
|
|
3092
|
-
function (s) { return !___default__default.isEmpty(s); })).map((/**
|
|
3093
|
-
* @param {?} raw
|
|
3094
|
-
* @return {?}
|
|
3095
|
-
*/
|
|
3096
|
-
function (raw) { return def.type.parse(raw); })) : null;
|
|
3097
|
-
return new ResolvedArrayParameter(def, value);
|
|
3098
|
-
}
|
|
3099
|
-
else {
|
|
3100
|
-
/** @type {?} */
|
|
3101
|
-
var value = paramMap.has(def.name) ? def.type.parse(paramMap.get(def.name)) : null;
|
|
3102
|
-
return new ResolvedValueParameter(def, value);
|
|
3103
|
-
}
|
|
3104
|
-
}));
|
|
3353
|
+
function (def) { return exports.RouteParameterValue.create(def, paramMap); }));
|
|
3105
3354
|
return new ParameterSnapshot(placeDef, resolvedParameters);
|
|
3106
3355
|
}
|
|
3107
3356
|
ParameterSnapshot.create = create;
|
|
@@ -3110,12 +3359,7 @@
|
|
|
3110
3359
|
* include the segment params in the paramMap as well as each segment returns an empty
|
|
3111
3360
|
* param map even when `parameter`s has content.
|
|
3112
3361
|
*/
|
|
3113
|
-
var /**
|
|
3114
|
-
* This a work around for the fact that an activated route with multiple segments doesn't
|
|
3115
|
-
* include the segment params in the paramMap as well as each segment returns an empty
|
|
3116
|
-
* param map even when `parameter`s has content.
|
|
3117
|
-
*/
|
|
3118
|
-
ConsolidatedParameterMap = /** @class */ (function () {
|
|
3362
|
+
var ConsolidatedParameterMap = /** @class */ (function () {
|
|
3119
3363
|
function ConsolidatedParameterMap(paramMap, urlSegments) {
|
|
3120
3364
|
this.paramMaps = [paramMap].concat((urlSegments || []).map((/**
|
|
3121
3365
|
* @param {?} s
|
|
@@ -3172,6 +3416,26 @@
|
|
|
3172
3416
|
*/
|
|
3173
3417
|
function (m) { return m.has(name); }));
|
|
3174
3418
|
};
|
|
3419
|
+
Object.defineProperty(ConsolidatedParameterMap.prototype, "keys", {
|
|
3420
|
+
get: /**
|
|
3421
|
+
* @return {?}
|
|
3422
|
+
*/
|
|
3423
|
+
function () {
|
|
3424
|
+
return this.paramMaps.reduce((/**
|
|
3425
|
+
* @param {?} result
|
|
3426
|
+
* @param {?} params
|
|
3427
|
+
* @return {?}
|
|
3428
|
+
*/
|
|
3429
|
+
function (result, params) { return result.concat(params.keys); }), []);
|
|
3430
|
+
},
|
|
3431
|
+
enumerable: true,
|
|
3432
|
+
configurable: true
|
|
3433
|
+
});
|
|
3434
|
+
__decorate([
|
|
3435
|
+
src.Memoize(),
|
|
3436
|
+
__metadata("design:type", Array),
|
|
3437
|
+
__metadata("design:paramtypes", [])
|
|
3438
|
+
], ConsolidatedParameterMap.prototype, "keys", null);
|
|
3175
3439
|
return ConsolidatedParameterMap;
|
|
3176
3440
|
}());
|
|
3177
3441
|
if (false) {
|
|
@@ -3239,207 +3503,6 @@
|
|
|
3239
3503
|
*/
|
|
3240
3504
|
ParamMapAdapter.prototype.params;
|
|
3241
3505
|
}
|
|
3242
|
-
/**
|
|
3243
|
-
* @abstract
|
|
3244
|
-
* @template T, S
|
|
3245
|
-
*/
|
|
3246
|
-
var /**
|
|
3247
|
-
* @abstract
|
|
3248
|
-
* @template T, S
|
|
3249
|
-
*/
|
|
3250
|
-
ResolvedParameter = /** @class */ (function () {
|
|
3251
|
-
function ResolvedParameter(parameterDef, value) {
|
|
3252
|
-
this.parameterDef = parameterDef;
|
|
3253
|
-
this.value = value;
|
|
3254
|
-
}
|
|
3255
|
-
/**
|
|
3256
|
-
* @return {?}
|
|
3257
|
-
*/
|
|
3258
|
-
ResolvedParameter.prototype.isRouteId = /**
|
|
3259
|
-
* @return {?}
|
|
3260
|
-
*/
|
|
3261
|
-
function () {
|
|
3262
|
-
return this.parameterDef.isRouteId;
|
|
3263
|
-
};
|
|
3264
|
-
/**
|
|
3265
|
-
* @param {?} visit
|
|
3266
|
-
* @param {?} injector
|
|
3267
|
-
* @return {?}
|
|
3268
|
-
*/
|
|
3269
|
-
ResolvedParameter.prototype.sanitise = /**
|
|
3270
|
-
* @param {?} visit
|
|
3271
|
-
* @param {?} injector
|
|
3272
|
-
* @return {?}
|
|
3273
|
-
*/
|
|
3274
|
-
function (visit, injector) {
|
|
3275
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
3276
|
-
var sanitiser;
|
|
3277
|
-
return __generator(this, function (_a) {
|
|
3278
|
-
sanitiser = this.parameterDef.getSanitiser(injector);
|
|
3279
|
-
if (sanitiser) {
|
|
3280
|
-
return [2 /*return*/, sanitiser.sanitise(this.parameterDef, this.value, visit)];
|
|
3281
|
-
}
|
|
3282
|
-
else {
|
|
3283
|
-
return [2 /*return*/, this.value];
|
|
3284
|
-
}
|
|
3285
|
-
return [2 /*return*/];
|
|
3286
|
-
});
|
|
3287
|
-
});
|
|
3288
|
-
};
|
|
3289
|
-
return ResolvedParameter;
|
|
3290
|
-
}());
|
|
3291
|
-
ParameterSnapshot.ResolvedParameter = ResolvedParameter;
|
|
3292
|
-
if (false) {
|
|
3293
|
-
/** @type {?} */
|
|
3294
|
-
ResolvedParameter.prototype.parameterDef;
|
|
3295
|
-
/** @type {?} */
|
|
3296
|
-
ResolvedParameter.prototype.value;
|
|
3297
|
-
/**
|
|
3298
|
-
* @abstract
|
|
3299
|
-
* @param {?} dest
|
|
3300
|
-
* @return {?}
|
|
3301
|
-
*/
|
|
3302
|
-
ResolvedParameter.prototype.injectRouteParam = function (dest) { };
|
|
3303
|
-
/**
|
|
3304
|
-
* @abstract
|
|
3305
|
-
* @param {?} otherValue
|
|
3306
|
-
* @return {?}
|
|
3307
|
-
*/
|
|
3308
|
-
ResolvedParameter.prototype.isSame = function (otherValue) { };
|
|
3309
|
-
/**
|
|
3310
|
-
* @abstract
|
|
3311
|
-
* @return {?}
|
|
3312
|
-
*/
|
|
3313
|
-
ResolvedParameter.prototype.formattedValue = function () { };
|
|
3314
|
-
/**
|
|
3315
|
-
* @abstract
|
|
3316
|
-
* @param {?} value
|
|
3317
|
-
* @return {?}
|
|
3318
|
-
*/
|
|
3319
|
-
ResolvedParameter.prototype.replace = function (value) { };
|
|
3320
|
-
}
|
|
3321
|
-
/**
|
|
3322
|
-
* @template T
|
|
3323
|
-
*/
|
|
3324
|
-
var /**
|
|
3325
|
-
* @template T
|
|
3326
|
-
*/
|
|
3327
|
-
ResolvedValueParameter = /** @class */ (function (_super) {
|
|
3328
|
-
__extends(ResolvedValueParameter, _super);
|
|
3329
|
-
function ResolvedValueParameter() {
|
|
3330
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
3331
|
-
}
|
|
3332
|
-
/**
|
|
3333
|
-
* @param {?} otherValue
|
|
3334
|
-
* @return {?}
|
|
3335
|
-
*/
|
|
3336
|
-
ResolvedValueParameter.prototype.isSame = /**
|
|
3337
|
-
* @param {?} otherValue
|
|
3338
|
-
* @return {?}
|
|
3339
|
-
*/
|
|
3340
|
-
function (otherValue) {
|
|
3341
|
-
return this.value === otherValue;
|
|
3342
|
-
};
|
|
3343
|
-
/**
|
|
3344
|
-
* @param {?} dest
|
|
3345
|
-
* @return {?}
|
|
3346
|
-
*/
|
|
3347
|
-
ResolvedValueParameter.prototype.injectRouteParam = /**
|
|
3348
|
-
* @param {?} dest
|
|
3349
|
-
* @return {?}
|
|
3350
|
-
*/
|
|
3351
|
-
function (dest) {
|
|
3352
|
-
dest[this.parameterDef.name] = this.parameterDef.type.format(this.value);
|
|
3353
|
-
};
|
|
3354
|
-
/**
|
|
3355
|
-
* @param {?} value
|
|
3356
|
-
* @return {?}
|
|
3357
|
-
*/
|
|
3358
|
-
ResolvedValueParameter.prototype.replace = /**
|
|
3359
|
-
* @param {?} value
|
|
3360
|
-
* @return {?}
|
|
3361
|
-
*/
|
|
3362
|
-
function (value) {
|
|
3363
|
-
return new ResolvedValueParameter(this.parameterDef, value);
|
|
3364
|
-
};
|
|
3365
|
-
/**
|
|
3366
|
-
* @return {?}
|
|
3367
|
-
*/
|
|
3368
|
-
ResolvedValueParameter.prototype.formattedValue = /**
|
|
3369
|
-
* @return {?}
|
|
3370
|
-
*/
|
|
3371
|
-
function () {
|
|
3372
|
-
return !___default__default.isNil(this.value) ? this.parameterDef.type.format(this.value) : null;
|
|
3373
|
-
};
|
|
3374
|
-
return ResolvedValueParameter;
|
|
3375
|
-
}(ResolvedParameter));
|
|
3376
|
-
ParameterSnapshot.ResolvedValueParameter = ResolvedValueParameter;
|
|
3377
|
-
/**
|
|
3378
|
-
* @template T
|
|
3379
|
-
*/
|
|
3380
|
-
var /**
|
|
3381
|
-
* @template T
|
|
3382
|
-
*/
|
|
3383
|
-
ResolvedArrayParameter = /** @class */ (function (_super) {
|
|
3384
|
-
__extends(ResolvedArrayParameter, _super);
|
|
3385
|
-
function ResolvedArrayParameter() {
|
|
3386
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
3387
|
-
}
|
|
3388
|
-
/**
|
|
3389
|
-
* @param {?} otherValue
|
|
3390
|
-
* @return {?}
|
|
3391
|
-
*/
|
|
3392
|
-
ResolvedArrayParameter.prototype.isSame = /**
|
|
3393
|
-
* @param {?} otherValue
|
|
3394
|
-
* @return {?}
|
|
3395
|
-
*/
|
|
3396
|
-
function (otherValue) {
|
|
3397
|
-
return ___default__default.isEqual(this.value, otherValue);
|
|
3398
|
-
};
|
|
3399
|
-
/**
|
|
3400
|
-
* @param {?} dest
|
|
3401
|
-
* @return {?}
|
|
3402
|
-
*/
|
|
3403
|
-
ResolvedArrayParameter.prototype.injectRouteParam = /**
|
|
3404
|
-
* @param {?} dest
|
|
3405
|
-
* @return {?}
|
|
3406
|
-
*/
|
|
3407
|
-
function (dest) {
|
|
3408
|
-
var _this = this;
|
|
3409
|
-
dest[this.parameterDef.name] = this.value.map((/**
|
|
3410
|
-
* @param {?} v
|
|
3411
|
-
* @return {?}
|
|
3412
|
-
*/
|
|
3413
|
-
function (v) { return _this.parameterDef.type.format(v); }));
|
|
3414
|
-
};
|
|
3415
|
-
/**
|
|
3416
|
-
* @param {?} value
|
|
3417
|
-
* @return {?}
|
|
3418
|
-
*/
|
|
3419
|
-
ResolvedArrayParameter.prototype.replace = /**
|
|
3420
|
-
* @param {?} value
|
|
3421
|
-
* @return {?}
|
|
3422
|
-
*/
|
|
3423
|
-
function (value) {
|
|
3424
|
-
return new ResolvedArrayParameter(this.parameterDef, value);
|
|
3425
|
-
};
|
|
3426
|
-
/**
|
|
3427
|
-
* @return {?}
|
|
3428
|
-
*/
|
|
3429
|
-
ResolvedArrayParameter.prototype.formattedValue = /**
|
|
3430
|
-
* @return {?}
|
|
3431
|
-
*/
|
|
3432
|
-
function () {
|
|
3433
|
-
var _this = this;
|
|
3434
|
-
return this.value ? this.value.map((/**
|
|
3435
|
-
* @param {?} v
|
|
3436
|
-
* @return {?}
|
|
3437
|
-
*/
|
|
3438
|
-
function (v) { return _this.parameterDef.type.format(v); })) : [];
|
|
3439
|
-
};
|
|
3440
|
-
return ResolvedArrayParameter;
|
|
3441
|
-
}(ResolvedParameter));
|
|
3442
|
-
ParameterSnapshot.ResolvedArrayParameter = ResolvedArrayParameter;
|
|
3443
3506
|
})(exports.ParameterSnapshot || (exports.ParameterSnapshot = {}));
|
|
3444
3507
|
|
|
3445
3508
|
/**
|
|
@@ -3565,8 +3628,8 @@
|
|
|
3565
3628
|
* @return {?}
|
|
3566
3629
|
*/
|
|
3567
3630
|
function (next, previous) {
|
|
3568
|
-
_this.pushChangesToRoute(next, previous);
|
|
3569
3631
|
_this.placeHistory.add(next); // the above route change doesn't seem to propagate back in, so I'm add the state to the history manually for now.
|
|
3632
|
+
_this.pushChangesToRoute(next, previous);
|
|
3570
3633
|
}), {
|
|
3571
3634
|
unless: _this.incomingRouteChange
|
|
3572
3635
|
});
|
|
@@ -4438,7 +4501,7 @@
|
|
|
4438
4501
|
* @return {?}
|
|
4439
4502
|
*/
|
|
4440
4503
|
function (sanitised) {
|
|
4441
|
-
pectin.Logger.get(_this).info("ParameterSnapshot.sanitise
|
|
4504
|
+
pectin.Logger.get(_this).info("ParameterSnapshot.sanitise ->", sanitised.getAllParameters());
|
|
4442
4505
|
if (sanitised.hasChanged(snapshot_1, true)) {
|
|
4443
4506
|
return _this.placeRouter.getRedirectUrlTree(activatedRoute, sanitised);
|
|
4444
4507
|
}
|
|
@@ -4593,12 +4656,11 @@
|
|
|
4593
4656
|
function ParameterSanitiser() { }
|
|
4594
4657
|
if (false) {
|
|
4595
4658
|
/**
|
|
4596
|
-
* @param {?}
|
|
4597
|
-
* @param {?} value
|
|
4659
|
+
* @param {?} paramter
|
|
4598
4660
|
* @param {?=} visit
|
|
4599
4661
|
* @return {?}
|
|
4600
4662
|
*/
|
|
4601
|
-
ParameterSanitiser.prototype.sanitise = function (
|
|
4663
|
+
ParameterSanitiser.prototype.sanitise = function (paramter, visit) { };
|
|
4602
4664
|
}
|
|
4603
4665
|
|
|
4604
4666
|
/**
|
|
@@ -4694,431 +4756,6 @@
|
|
|
4694
4756
|
ParameterType.BOOLEAN = new BooleanType();
|
|
4695
4757
|
})(exports.ParameterType || (exports.ParameterType = {}));
|
|
4696
4758
|
|
|
4697
|
-
/**
|
|
4698
|
-
* @fileoverview added by tsickle
|
|
4699
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4700
|
-
*/
|
|
4701
|
-
/**
|
|
4702
|
-
* @template T, S
|
|
4703
|
-
*/
|
|
4704
|
-
/**
|
|
4705
|
-
* @template T, S
|
|
4706
|
-
*/
|
|
4707
|
-
exports.Sanitiser = /** @class */ (function () {
|
|
4708
|
-
function Sanitiser(parameterDef, snapshot, sanitiser) {
|
|
4709
|
-
this.parameterDef = parameterDef;
|
|
4710
|
-
this.snapshot = snapshot;
|
|
4711
|
-
this.sanitiser = sanitiser;
|
|
4712
|
-
}
|
|
4713
|
-
/**
|
|
4714
|
-
* @return {?}
|
|
4715
|
-
*/
|
|
4716
|
-
Sanitiser.prototype.isRouteId = /**
|
|
4717
|
-
* @return {?}
|
|
4718
|
-
*/
|
|
4719
|
-
function () {
|
|
4720
|
-
return this.parameterDef.isRouteId;
|
|
4721
|
-
};
|
|
4722
|
-
Object.defineProperty(Sanitiser.prototype, "valueChanged", {
|
|
4723
|
-
get: /**
|
|
4724
|
-
* @return {?}
|
|
4725
|
-
*/
|
|
4726
|
-
function () {
|
|
4727
|
-
return !___default__default.isNil(this.initialValue) && this.hasChanged(this.initialValue, this.sanitisedValue);
|
|
4728
|
-
},
|
|
4729
|
-
enumerable: true,
|
|
4730
|
-
configurable: true
|
|
4731
|
-
});
|
|
4732
|
-
Object.defineProperty(Sanitiser.prototype, "sanitisedValue", {
|
|
4733
|
-
get: /**
|
|
4734
|
-
* @return {?}
|
|
4735
|
-
*/
|
|
4736
|
-
function () {
|
|
4737
|
-
return this._sanitisedValue;
|
|
4738
|
-
},
|
|
4739
|
-
enumerable: true,
|
|
4740
|
-
configurable: true
|
|
4741
|
-
});
|
|
4742
|
-
/**
|
|
4743
|
-
* @protected
|
|
4744
|
-
* @param {?} snapshot
|
|
4745
|
-
* @return {?}
|
|
4746
|
-
*/
|
|
4747
|
-
Sanitiser.prototype.readFrom = /**
|
|
4748
|
-
* @protected
|
|
4749
|
-
* @param {?} snapshot
|
|
4750
|
-
* @return {?}
|
|
4751
|
-
*/
|
|
4752
|
-
function (snapshot) {
|
|
4753
|
-
return pectin.lang.abstractMethod(this.constructor);
|
|
4754
|
-
};
|
|
4755
|
-
/**
|
|
4756
|
-
* @protected
|
|
4757
|
-
* @param {?} initialValue
|
|
4758
|
-
* @param {?} sanitisedValue
|
|
4759
|
-
* @return {?}
|
|
4760
|
-
*/
|
|
4761
|
-
Sanitiser.prototype.hasChanged = /**
|
|
4762
|
-
* @protected
|
|
4763
|
-
* @param {?} initialValue
|
|
4764
|
-
* @param {?} sanitisedValue
|
|
4765
|
-
* @return {?}
|
|
4766
|
-
*/
|
|
4767
|
-
function (initialValue, sanitisedValue) {
|
|
4768
|
-
return pectin.lang.abstractMethod(this.constructor);
|
|
4769
|
-
};
|
|
4770
|
-
/**
|
|
4771
|
-
* @param {?} dest
|
|
4772
|
-
* @return {?}
|
|
4773
|
-
*/
|
|
4774
|
-
Sanitiser.prototype.injectRouteParam = /**
|
|
4775
|
-
* @param {?} dest
|
|
4776
|
-
* @return {?}
|
|
4777
|
-
*/
|
|
4778
|
-
function (dest) {
|
|
4779
|
-
pectin.lang.abstractMethod(this.constructor);
|
|
4780
|
-
};
|
|
4781
|
-
/**
|
|
4782
|
-
* @return {?}
|
|
4783
|
-
*/
|
|
4784
|
-
Sanitiser.prototype.sanitize = /**
|
|
4785
|
-
* @return {?}
|
|
4786
|
-
*/
|
|
4787
|
-
function () {
|
|
4788
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
4789
|
-
var _a;
|
|
4790
|
-
return __generator(this, function (_b) {
|
|
4791
|
-
switch (_b.label) {
|
|
4792
|
-
case 0:
|
|
4793
|
-
if (!this.sanitiser) return [3 /*break*/, 2];
|
|
4794
|
-
this.initialValue = this.readFrom(this.snapshot);
|
|
4795
|
-
_a = this;
|
|
4796
|
-
return [4 /*yield*/, this.sanitiser.sanitise(null, this.initialValue)];
|
|
4797
|
-
case 1:
|
|
4798
|
-
_a._sanitisedValue = _b.sent();
|
|
4799
|
-
if (this.initialValue !== this._sanitisedValue) {
|
|
4800
|
-
return [2 /*return*/, false];
|
|
4801
|
-
}
|
|
4802
|
-
_b.label = 2;
|
|
4803
|
-
case 2: return [2 /*return*/, true];
|
|
4804
|
-
}
|
|
4805
|
-
});
|
|
4806
|
-
});
|
|
4807
|
-
};
|
|
4808
|
-
return Sanitiser;
|
|
4809
|
-
}());
|
|
4810
|
-
if (false) {
|
|
4811
|
-
/**
|
|
4812
|
-
* @type {?}
|
|
4813
|
-
* @private
|
|
4814
|
-
*/
|
|
4815
|
-
exports.Sanitiser.prototype.initialValue;
|
|
4816
|
-
/**
|
|
4817
|
-
* @type {?}
|
|
4818
|
-
* @private
|
|
4819
|
-
*/
|
|
4820
|
-
exports.Sanitiser.prototype._sanitisedValue;
|
|
4821
|
-
/** @type {?} */
|
|
4822
|
-
exports.Sanitiser.prototype.parameterDef;
|
|
4823
|
-
/** @type {?} */
|
|
4824
|
-
exports.Sanitiser.prototype.snapshot;
|
|
4825
|
-
/** @type {?} */
|
|
4826
|
-
exports.Sanitiser.prototype.sanitiser;
|
|
4827
|
-
}
|
|
4828
|
-
var RouteParameterSanitiser = /** @class */ (function () {
|
|
4829
|
-
function RouteParameterSanitiser(parameterDefs, snapshot, injector) {
|
|
4830
|
-
var _this = this;
|
|
4831
|
-
this.parameterDefs = parameterDefs;
|
|
4832
|
-
this.snapshot = snapshot;
|
|
4833
|
-
this.injector = injector;
|
|
4834
|
-
this.parameterSanitisers = [];
|
|
4835
|
-
/** @type {?} */
|
|
4836
|
-
var sanitisers = parameterDefs.map((/**
|
|
4837
|
-
* @param {?} def
|
|
4838
|
-
* @return {?}
|
|
4839
|
-
*/
|
|
4840
|
-
function (def) {
|
|
4841
|
-
return def.isArray ?
|
|
4842
|
-
new exports.Sanitiser.Array(def, snapshot, _this.getSanitiser(def)) :
|
|
4843
|
-
new exports.Sanitiser.Value(def, snapshot, _this.getSanitiser(def));
|
|
4844
|
-
}));
|
|
4845
|
-
this.routeIdSanitiser = sanitisers.find((/**
|
|
4846
|
-
* @param {?} p
|
|
4847
|
-
* @return {?}
|
|
4848
|
-
*/
|
|
4849
|
-
function (p) { return p.isRouteId(); }));
|
|
4850
|
-
this.parameterSanitisers = sanitisers.filter((/**
|
|
4851
|
-
* @param {?} p
|
|
4852
|
-
* @return {?}
|
|
4853
|
-
*/
|
|
4854
|
-
function (p) { return !p.isRouteId(); }));
|
|
4855
|
-
}
|
|
4856
|
-
/**
|
|
4857
|
-
* @return {?}
|
|
4858
|
-
*/
|
|
4859
|
-
RouteParameterSanitiser.prototype.sanitise = /**
|
|
4860
|
-
* @return {?}
|
|
4861
|
-
*/
|
|
4862
|
-
function () {
|
|
4863
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
4864
|
-
var e_1, _a, _b, _c, sanitiser, e_1_1;
|
|
4865
|
-
return __generator(this, function (_d) {
|
|
4866
|
-
switch (_d.label) {
|
|
4867
|
-
case 0:
|
|
4868
|
-
if (!this.routeIdSanitiser) return [3 /*break*/, 2];
|
|
4869
|
-
return [4 /*yield*/, this.routeIdSanitiser.sanitize()];
|
|
4870
|
-
case 1:
|
|
4871
|
-
_d.sent();
|
|
4872
|
-
if (this.routeIdSanitiser.valueChanged) {
|
|
4873
|
-
// if the route id isn't ok we redirect immediately as the query params may need to be sanitised in the
|
|
4874
|
-
// context of the route id.
|
|
4875
|
-
return [2 /*return*/, false];
|
|
4876
|
-
}
|
|
4877
|
-
_d.label = 2;
|
|
4878
|
-
case 2:
|
|
4879
|
-
_d.trys.push([2, 7, 8, 9]);
|
|
4880
|
-
_b = __values(this.parameterSanitisers), _c = _b.next();
|
|
4881
|
-
_d.label = 3;
|
|
4882
|
-
case 3:
|
|
4883
|
-
if (!!_c.done) return [3 /*break*/, 6];
|
|
4884
|
-
sanitiser = _c.value;
|
|
4885
|
-
return [4 /*yield*/, sanitiser.sanitize()];
|
|
4886
|
-
case 4:
|
|
4887
|
-
_d.sent();
|
|
4888
|
-
_d.label = 5;
|
|
4889
|
-
case 5:
|
|
4890
|
-
_c = _b.next();
|
|
4891
|
-
return [3 /*break*/, 3];
|
|
4892
|
-
case 6: return [3 /*break*/, 9];
|
|
4893
|
-
case 7:
|
|
4894
|
-
e_1_1 = _d.sent();
|
|
4895
|
-
e_1 = { error: e_1_1 };
|
|
4896
|
-
return [3 /*break*/, 9];
|
|
4897
|
-
case 8:
|
|
4898
|
-
try {
|
|
4899
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
4900
|
-
}
|
|
4901
|
-
finally { if (e_1) throw e_1.error; }
|
|
4902
|
-
return [7 /*endfinally*/];
|
|
4903
|
-
case 9: return [2 /*return*/, !this.parameterSanitisers.find((/**
|
|
4904
|
-
* @param {?} s
|
|
4905
|
-
* @return {?}
|
|
4906
|
-
*/
|
|
4907
|
-
function (s) { return s.valueChanged; }))];
|
|
4908
|
-
}
|
|
4909
|
-
});
|
|
4910
|
-
});
|
|
4911
|
-
};
|
|
4912
|
-
/**
|
|
4913
|
-
* @private
|
|
4914
|
-
* @template T, S
|
|
4915
|
-
* @param {?} def
|
|
4916
|
-
* @return {?}
|
|
4917
|
-
*/
|
|
4918
|
-
RouteParameterSanitiser.prototype.getSanitiser = /**
|
|
4919
|
-
* @private
|
|
4920
|
-
* @template T, S
|
|
4921
|
-
* @param {?} def
|
|
4922
|
-
* @return {?}
|
|
4923
|
-
*/
|
|
4924
|
-
function (def) {
|
|
4925
|
-
return def.getSanitiser(this.injector);
|
|
4926
|
-
};
|
|
4927
|
-
/**
|
|
4928
|
-
* @return {?}
|
|
4929
|
-
*/
|
|
4930
|
-
RouteParameterSanitiser.prototype.routeIdHasChanged = /**
|
|
4931
|
-
* @return {?}
|
|
4932
|
-
*/
|
|
4933
|
-
function () {
|
|
4934
|
-
pectin.assert.isTruthy(this.parameterSanitisers.length !== 0);
|
|
4935
|
-
return this.routeIdSanitiser && this.routeIdSanitiser.valueChanged;
|
|
4936
|
-
};
|
|
4937
|
-
// @Trace()
|
|
4938
|
-
// @Trace()
|
|
4939
|
-
/**
|
|
4940
|
-
* @return {?}
|
|
4941
|
-
*/
|
|
4942
|
-
RouteParameterSanitiser.prototype.getRedirectParams =
|
|
4943
|
-
// @Trace()
|
|
4944
|
-
/**
|
|
4945
|
-
* @return {?}
|
|
4946
|
-
*/
|
|
4947
|
-
function () {
|
|
4948
|
-
if (this.routeIdHasChanged()) {
|
|
4949
|
-
return [this.routeIdSanitiser.sanitisedValue];
|
|
4950
|
-
}
|
|
4951
|
-
else {
|
|
4952
|
-
/** @type {?} */
|
|
4953
|
-
var routeParams_1 = {};
|
|
4954
|
-
this.parameterSanitisers.forEach((/**
|
|
4955
|
-
* @param {?} s
|
|
4956
|
-
* @return {?}
|
|
4957
|
-
*/
|
|
4958
|
-
function (s) { return s.injectRouteParam(routeParams_1); }));
|
|
4959
|
-
return [routeParams_1];
|
|
4960
|
-
}
|
|
4961
|
-
};
|
|
4962
|
-
/**
|
|
4963
|
-
* @private
|
|
4964
|
-
* @template S
|
|
4965
|
-
* @param {?} value
|
|
4966
|
-
* @return {?}
|
|
4967
|
-
*/
|
|
4968
|
-
RouteParameterSanitiser.prototype.isSanitiserContructor = /**
|
|
4969
|
-
* @private
|
|
4970
|
-
* @template S
|
|
4971
|
-
* @param {?} value
|
|
4972
|
-
* @return {?}
|
|
4973
|
-
*/
|
|
4974
|
-
function (value) {
|
|
4975
|
-
return ___default__default.isFunction(value) && pectin.lang.constructorChain((/** @type {?} */ ((/** @type {?} */ (value))))).includes(exports.Sanitiser);
|
|
4976
|
-
};
|
|
4977
|
-
__decorate([
|
|
4978
|
-
src.Memoize(),
|
|
4979
|
-
__metadata("design:type", Function),
|
|
4980
|
-
__metadata("design:paramtypes", [exports.ParameterDefinition]),
|
|
4981
|
-
__metadata("design:returntype", Object)
|
|
4982
|
-
], RouteParameterSanitiser.prototype, "getSanitiser", null);
|
|
4983
|
-
return RouteParameterSanitiser;
|
|
4984
|
-
}());
|
|
4985
|
-
if (false) {
|
|
4986
|
-
/**
|
|
4987
|
-
* @type {?}
|
|
4988
|
-
* @private
|
|
4989
|
-
*/
|
|
4990
|
-
RouteParameterSanitiser.prototype.routeIdSanitiser;
|
|
4991
|
-
/**
|
|
4992
|
-
* @type {?}
|
|
4993
|
-
* @private
|
|
4994
|
-
*/
|
|
4995
|
-
RouteParameterSanitiser.prototype.parameterSanitisers;
|
|
4996
|
-
/** @type {?} */
|
|
4997
|
-
RouteParameterSanitiser.prototype.parameterDefs;
|
|
4998
|
-
/** @type {?} */
|
|
4999
|
-
RouteParameterSanitiser.prototype.snapshot;
|
|
5000
|
-
/** @type {?} */
|
|
5001
|
-
RouteParameterSanitiser.prototype.injector;
|
|
5002
|
-
}
|
|
5003
|
-
(function (Sanitiser) {
|
|
5004
|
-
/**
|
|
5005
|
-
* @template T
|
|
5006
|
-
*/
|
|
5007
|
-
var /**
|
|
5008
|
-
* @template T
|
|
5009
|
-
*/
|
|
5010
|
-
Value = /** @class */ (function (_super) {
|
|
5011
|
-
__extends(Value, _super);
|
|
5012
|
-
function Value() {
|
|
5013
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
5014
|
-
}
|
|
5015
|
-
/**
|
|
5016
|
-
* @param {?} snapshot
|
|
5017
|
-
* @return {?}
|
|
5018
|
-
*/
|
|
5019
|
-
Value.prototype.readFrom = /**
|
|
5020
|
-
* @param {?} snapshot
|
|
5021
|
-
* @return {?}
|
|
5022
|
-
*/
|
|
5023
|
-
function (snapshot) {
|
|
5024
|
-
/** @type {?} */
|
|
5025
|
-
var rawValue = snapshot.paramMap.get(this.parameterDef.name);
|
|
5026
|
-
return this.parameterDef.type.parse(rawValue);
|
|
5027
|
-
};
|
|
5028
|
-
/**
|
|
5029
|
-
* @protected
|
|
5030
|
-
* @param {?} initialValue
|
|
5031
|
-
* @param {?} sanitisedValue
|
|
5032
|
-
* @return {?}
|
|
5033
|
-
*/
|
|
5034
|
-
Value.prototype.hasChanged = /**
|
|
5035
|
-
* @protected
|
|
5036
|
-
* @param {?} initialValue
|
|
5037
|
-
* @param {?} sanitisedValue
|
|
5038
|
-
* @return {?}
|
|
5039
|
-
*/
|
|
5040
|
-
function (initialValue, sanitisedValue) {
|
|
5041
|
-
return initialValue !== sanitisedValue;
|
|
5042
|
-
};
|
|
5043
|
-
/**
|
|
5044
|
-
* @param {?} dest
|
|
5045
|
-
* @return {?}
|
|
5046
|
-
*/
|
|
5047
|
-
Value.prototype.injectRouteParam = /**
|
|
5048
|
-
* @param {?} dest
|
|
5049
|
-
* @return {?}
|
|
5050
|
-
*/
|
|
5051
|
-
function (dest) {
|
|
5052
|
-
dest[this.parameterDef.name] = this.parameterDef.type.format(this.sanitisedValue);
|
|
5053
|
-
};
|
|
5054
|
-
return Value;
|
|
5055
|
-
}(Sanitiser));
|
|
5056
|
-
Sanitiser.Value = Value;
|
|
5057
|
-
/**
|
|
5058
|
-
* @template T
|
|
5059
|
-
*/
|
|
5060
|
-
var /**
|
|
5061
|
-
* @template T
|
|
5062
|
-
*/
|
|
5063
|
-
Array = /** @class */ (function (_super) {
|
|
5064
|
-
__extends(Array, _super);
|
|
5065
|
-
function Array() {
|
|
5066
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
5067
|
-
}
|
|
5068
|
-
/**
|
|
5069
|
-
* @param {?} snapshot
|
|
5070
|
-
* @return {?}
|
|
5071
|
-
*/
|
|
5072
|
-
Array.prototype.readFrom = /**
|
|
5073
|
-
* @param {?} snapshot
|
|
5074
|
-
* @return {?}
|
|
5075
|
-
*/
|
|
5076
|
-
function (snapshot) {
|
|
5077
|
-
var _this = this;
|
|
5078
|
-
/** @type {?} */
|
|
5079
|
-
var rawValues = snapshot.paramMap.getAll(this.parameterDef.name);
|
|
5080
|
-
return rawValues.map((/**
|
|
5081
|
-
* @param {?} value
|
|
5082
|
-
* @return {?}
|
|
5083
|
-
*/
|
|
5084
|
-
function (value) { return _this.parameterDef.type.parse(value); }));
|
|
5085
|
-
};
|
|
5086
|
-
/**
|
|
5087
|
-
* @protected
|
|
5088
|
-
* @param {?} initialValue
|
|
5089
|
-
* @param {?} sanitisedValue
|
|
5090
|
-
* @return {?}
|
|
5091
|
-
*/
|
|
5092
|
-
Array.prototype.hasChanged = /**
|
|
5093
|
-
* @protected
|
|
5094
|
-
* @param {?} initialValue
|
|
5095
|
-
* @param {?} sanitisedValue
|
|
5096
|
-
* @return {?}
|
|
5097
|
-
*/
|
|
5098
|
-
function (initialValue, sanitisedValue) {
|
|
5099
|
-
return initialValue !== sanitisedValue;
|
|
5100
|
-
};
|
|
5101
|
-
/**
|
|
5102
|
-
* @param {?} dest
|
|
5103
|
-
* @return {?}
|
|
5104
|
-
*/
|
|
5105
|
-
Array.prototype.injectRouteParam = /**
|
|
5106
|
-
* @param {?} dest
|
|
5107
|
-
* @return {?}
|
|
5108
|
-
*/
|
|
5109
|
-
function (dest) {
|
|
5110
|
-
var _this = this;
|
|
5111
|
-
dest[this.parameterDef.name] = this.sanitisedValue.map((/**
|
|
5112
|
-
* @param {?} v
|
|
5113
|
-
* @return {?}
|
|
5114
|
-
*/
|
|
5115
|
-
function (v) { return _this.parameterDef.type.format(v); }));
|
|
5116
|
-
};
|
|
5117
|
-
return Array;
|
|
5118
|
-
}(Sanitiser));
|
|
5119
|
-
Sanitiser.Array = Array;
|
|
5120
|
-
})(exports.Sanitiser || (exports.Sanitiser = {}));
|
|
5121
|
-
|
|
5122
4759
|
exports.ACTIVITY_DATA = ACTIVITY_DATA;
|
|
5123
4760
|
exports.AbstractActivity = AbstractActivity;
|
|
5124
4761
|
exports.AbstractInputComponent = AbstractInputComponent;
|
|
@@ -5157,7 +4794,6 @@
|
|
|
5157
4794
|
exports.RouteId = RouteId;
|
|
5158
4795
|
exports.RouteParameter = RouteParameter;
|
|
5159
4796
|
exports.RouteParameterList = RouteParameterList;
|
|
5160
|
-
exports.RouteParameterSanitiser = RouteParameterSanitiser;
|
|
5161
4797
|
exports.SelectInputComponent = SelectInputComponent;
|
|
5162
4798
|
exports.StringInputComponent = StringInputComponent;
|
|
5163
4799
|
exports.TabbedPlaceNavigationComponent = TabbedPlaceNavigationComponent;
|