@coolon/angular-ui-powerups 12.4.0-alpha.0 → 12.4.0-alpha.10
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/assets/empty-state.scss +11 -0
- package/assets/styles.scss +1 -0
- package/bundles/coolon-angular-ui-powerups-cypress.umd.js +382 -263
- package/bundles/coolon-angular-ui-powerups-cypress.umd.js.map +1 -1
- package/bundles/coolon-angular-ui-powerups.umd.js +241 -251
- package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
- package/coolon-angular-ui-powerups.metadata.json +1 -1
- package/cypress/builder.d.ts +48 -0
- package/cypress/components/aup-abstract-activity.d.ts +8 -0
- package/cypress/components/aup-activity.d.ts +8 -0
- package/cypress/components/aup-alert.d.ts +8 -0
- package/cypress/components/aup-command-face.d.ts +7 -0
- package/cypress/components/aup-command.d.ts +6 -18
- package/cypress/components/aup-empty-state.d.ts +3 -0
- package/cypress/components/aup-input.d.ts +8 -8
- package/cypress/components/aup-modal-activity.d.ts +4 -0
- package/cypress/components/aup-modal-alert.d.ts +6 -0
- package/cypress/components/aup-table.d.ts +1 -2
- package/cypress/components/button-mixin.d.ts +3 -1
- package/cypress/components/button.d.ts +4 -2
- package/cypress/coolon-angular-ui-powerups-cypress.metadata.json +1 -1
- package/cypress/exports.d.ts +8 -1
- package/cypress/page-builder.d.ts +10 -0
- package/cypress/page-element.d.ts +5 -2
- package/cypress/page.d.ts +10 -32
- package/cypress/path.d.ts +1 -1
- package/esm2015/cypress/builder.js +80 -0
- package/esm2015/cypress/builder.js.map +1 -0
- package/esm2015/cypress/builder.metadata.json +1 -0
- package/esm2015/cypress/components/aup-abstract-activity.js +11 -0
- package/esm2015/cypress/components/aup-abstract-activity.js.map +1 -0
- package/esm2015/cypress/components/aup-abstract-activity.metadata.json +1 -0
- package/esm2015/cypress/components/aup-activity.js +13 -0
- package/esm2015/cypress/components/aup-activity.js.map +1 -0
- package/esm2015/cypress/components/aup-activity.metadata.json +1 -0
- package/esm2015/cypress/components/aup-alert.js +13 -0
- package/esm2015/cypress/components/aup-alert.js.map +1 -0
- package/esm2015/cypress/components/aup-alert.metadata.json +1 -0
- package/esm2015/cypress/components/aup-command-face.js +20 -18
- package/esm2015/cypress/components/aup-command-face.js.map +1 -1
- package/esm2015/cypress/components/aup-command-face.metadata.json +1 -1
- package/esm2015/cypress/components/aup-command.js +25 -9
- package/esm2015/cypress/components/aup-command.js.map +1 -1
- package/esm2015/cypress/components/aup-command.metadata.json +1 -1
- package/esm2015/cypress/components/aup-empty-state.js +4 -0
- package/esm2015/cypress/components/aup-empty-state.js.map +1 -0
- package/esm2015/cypress/components/aup-empty-state.metadata.json +1 -0
- package/esm2015/cypress/components/aup-input.js +7 -7
- package/esm2015/cypress/components/aup-input.js.map +1 -1
- package/esm2015/cypress/components/aup-modal-activity.js +7 -0
- package/esm2015/cypress/components/aup-modal-activity.js.map +1 -0
- package/esm2015/cypress/components/aup-modal-activity.metadata.json +1 -0
- package/esm2015/cypress/components/aup-modal-alert.js +12 -0
- package/esm2015/cypress/components/aup-modal-alert.js.map +1 -0
- package/esm2015/cypress/components/aup-modal-alert.metadata.json +1 -0
- package/esm2015/cypress/components/aup-table.js.map +1 -1
- package/esm2015/cypress/components/aup-table.metadata.json +1 -1
- package/esm2015/cypress/components/button.js.map +1 -1
- package/esm2015/cypress/components/button.metadata.json +1 -1
- package/esm2015/cypress/exports.js +8 -1
- package/esm2015/cypress/exports.js.map +1 -1
- package/esm2015/cypress/exports.metadata.json +1 -1
- package/esm2015/cypress/page-builder.js +20 -0
- package/esm2015/cypress/page-builder.js.map +1 -0
- package/esm2015/cypress/page-builder.metadata.json +1 -0
- package/esm2015/cypress/page-element.js +9 -3
- package/esm2015/cypress/page-element.js.map +1 -1
- package/esm2015/cypress/page-element.metadata.json +1 -1
- package/esm2015/cypress/page.js +13 -14
- package/esm2015/cypress/page.js.map +1 -1
- package/esm2015/cypress/page.metadata.json +1 -1
- package/esm2015/cypress/path.js +5 -3
- package/esm2015/cypress/path.js.map +1 -1
- package/esm2015/lib/components/empty-state/empty-state.component.js +1 -1
- package/esm2015/lib/components/empty-state/empty-state.component.metadata.json +1 -1
- package/esm2015/lib/place/navigation/place-component-deactivation-handler.js +3 -9
- package/esm2015/lib/place/navigation/place-component-deactivation-handler.js.map +1 -1
- package/esm2015/lib/place/navigation/place-component-deactivation-handler.metadata.json +1 -1
- package/esm2015/lib/place/url-snapshot.js +1 -7
- package/esm2015/lib/place/url-snapshot.js.map +1 -1
- package/esm2015/lib/place/url-snapshot.metadata.json +1 -1
- package/fesm2015/coolon-angular-ui-powerups-cypress.js +284 -169
- package/fesm2015/coolon-angular-ui-powerups-cypress.js.map +1 -1
- package/fesm2015/coolon-angular-ui-powerups.js +225 -235
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/package.json +1 -1
- package/cypress/section.d.ts +0 -49
- package/esm2015/cypress/section.js +0 -58
- package/esm2015/cypress/section.js.map +0 -1
- package/esm2015/cypress/section.metadata.json +0 -1
|
@@ -1587,7 +1587,7 @@
|
|
|
1587
1587
|
{ type: i0.Component, args: [{
|
|
1588
1588
|
selector: 'aup-empty-state',
|
|
1589
1589
|
template: "\n <div class=\"container\">\n <ng-content></ng-content>\n </div>\n ",
|
|
1590
|
-
styles: [":host{display:flex;flex-direction:column;justify-content:center;align-items:center}.container{padding:var(--aup-default-padding);border:2px dashed rgba(0,0,0,.2);border-radius:5px;font-size:14px;font-weight:300}"]
|
|
1590
|
+
styles: [":host{display:flex;flex-direction:column;justify-content:center;align-items:center}.container{display:flex;flex-direction:column;align-items:stretch;padding:var(--aup-default-padding);border:2px dashed rgba(0,0,0,.2);border-radius:5px;font-size:14px;font-weight:300}"]
|
|
1591
1591
|
},] }
|
|
1592
1592
|
];
|
|
1593
1593
|
EmptyStateComponent.ctorParameters = function () { return []; };
|
|
@@ -6993,250 +6993,6 @@
|
|
|
6993
6993
|
PlaceComponent.injectDefinition = injectDefinition;
|
|
6994
6994
|
})(exports.PlaceComponent || (exports.PlaceComponent = {}));
|
|
6995
6995
|
|
|
6996
|
-
/**
|
|
6997
|
-
* This a work around for the fact that an activated route with multiple segments doesn't
|
|
6998
|
-
* include the segment params in the paramMap as well as each segment returns an empty
|
|
6999
|
-
* param map even when `parameter`s has content.
|
|
7000
|
-
*/
|
|
7001
|
-
var ConsolidatedParameterMap = /** @class */ (function () {
|
|
7002
|
-
function ConsolidatedParameterMap(urlSegments, paramMap) {
|
|
7003
|
-
this.paramMaps = [];
|
|
7004
|
-
// TODO: can we get all our params from teh url segments? If so we can drop the paramMap altogether.
|
|
7005
|
-
var segmentParams = (urlSegments || []).map(function (s) { return new ParamMapAdapter(s.parameters); });
|
|
7006
|
-
this.paramMaps = segmentParams
|
|
7007
|
-
.concat(paramMap)
|
|
7008
|
-
.filter(function (m) { return !!m; }); // the activated route param map can be null
|
|
7009
|
-
}
|
|
7010
|
-
ConsolidatedParameterMap.prototype.get = function (name) {
|
|
7011
|
-
var paramMap = this.paramMaps.find(function (m) { return m.has(name); });
|
|
7012
|
-
return paramMap.get(name);
|
|
7013
|
-
};
|
|
7014
|
-
ConsolidatedParameterMap.prototype.getAll = function (name) {
|
|
7015
|
-
var paramMap = this.paramMaps.find(function (m) { return m.has(name); });
|
|
7016
|
-
return paramMap.getAll(name);
|
|
7017
|
-
};
|
|
7018
|
-
ConsolidatedParameterMap.prototype.has = function (name) {
|
|
7019
|
-
return !!this.paramMaps.find(function (m) { return m.has(name); });
|
|
7020
|
-
};
|
|
7021
|
-
Object.defineProperty(ConsolidatedParameterMap.prototype, "keys", {
|
|
7022
|
-
get: function () {
|
|
7023
|
-
return this.paramMaps.reduce(function (result, params) { return result.concat(params.keys); }, []);
|
|
7024
|
-
},
|
|
7025
|
-
enumerable: false,
|
|
7026
|
-
configurable: true
|
|
7027
|
-
});
|
|
7028
|
-
return ConsolidatedParameterMap;
|
|
7029
|
-
}());
|
|
7030
|
-
__decorate([
|
|
7031
|
-
src.Memoize(),
|
|
7032
|
-
__metadata("design:type", Array),
|
|
7033
|
-
__metadata("design:paramtypes", [])
|
|
7034
|
-
], ConsolidatedParameterMap.prototype, "keys", null);
|
|
7035
|
-
var ParamMapAdapter = /** @class */ (function () {
|
|
7036
|
-
function ParamMapAdapter(params) {
|
|
7037
|
-
this.params = params;
|
|
7038
|
-
}
|
|
7039
|
-
ParamMapAdapter.prototype.get = function (name) {
|
|
7040
|
-
return this.params[name];
|
|
7041
|
-
};
|
|
7042
|
-
ParamMapAdapter.prototype.getAll = function (name) {
|
|
7043
|
-
var value = this.get(name);
|
|
7044
|
-
return Array.isArray(value) ? value : [value];
|
|
7045
|
-
};
|
|
7046
|
-
ParamMapAdapter.prototype.has = function (name) {
|
|
7047
|
-
return this.keys.includes(name);
|
|
7048
|
-
};
|
|
7049
|
-
Object.defineProperty(ParamMapAdapter.prototype, "keys", {
|
|
7050
|
-
get: function () {
|
|
7051
|
-
return Object.keys(this.params);
|
|
7052
|
-
},
|
|
7053
|
-
enumerable: false,
|
|
7054
|
-
configurable: true
|
|
7055
|
-
});
|
|
7056
|
-
return ParamMapAdapter;
|
|
7057
|
-
}());
|
|
7058
|
-
|
|
7059
|
-
var Visit = /** @class */ (function () {
|
|
7060
|
-
function Visit(placeDefinition, visitParameters) {
|
|
7061
|
-
if (visitParameters === void 0) { visitParameters = {}; }
|
|
7062
|
-
this.placeDefinition = placeDefinition;
|
|
7063
|
-
this.visitParameters = visitParameters;
|
|
7064
|
-
}
|
|
7065
|
-
// @Trace()
|
|
7066
|
-
Visit.prototype.getRouteId = function () {
|
|
7067
|
-
return this.placeDefinition.getRouteIdFrom(this);
|
|
7068
|
-
};
|
|
7069
|
-
// @Trace()
|
|
7070
|
-
Visit.prototype.hasRouteId = function () {
|
|
7071
|
-
return !___namespace.isNil(this.getRouteId());
|
|
7072
|
-
};
|
|
7073
|
-
/**
|
|
7074
|
-
* Returns the value of the place parameter with the specified name. The parameter
|
|
7075
|
-
* name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
|
|
7076
|
-
* same as the the ValueModel property name.
|
|
7077
|
-
* @param parameterDef the visit parameter definition
|
|
7078
|
-
*/
|
|
7079
|
-
Visit.prototype.getParameterValue = function (parameterDef) {
|
|
7080
|
-
return this.visitParameters[parameterDef.name];
|
|
7081
|
-
};
|
|
7082
|
-
// @Trace()
|
|
7083
|
-
Visit.prototype.hasParameter = function (parameterDef) {
|
|
7084
|
-
return Object.keys(this.visitParameters).includes(parameterDef.name);
|
|
7085
|
-
};
|
|
7086
|
-
Visit.prototype.replace = function (parameter, value) {
|
|
7087
|
-
var _a;
|
|
7088
|
-
return new Visit(this.placeDefinition, Object.assign(Object.assign({}, this.visitParameters), (_a = {}, _a[parameter.name] = value, _a)));
|
|
7089
|
-
};
|
|
7090
|
-
Visit.prototype.mergeRouteParameters = function (routeParams) {
|
|
7091
|
-
var _this = this;
|
|
7092
|
-
// todo: whitelist parameters.
|
|
7093
|
-
var routeParameterKeys = Object.keys(routeParams);
|
|
7094
|
-
var params = {};
|
|
7095
|
-
this.placeDefinition.getVisitParameterDefs().forEach(function (def) {
|
|
7096
|
-
if (def.isRouteId || def.isRouteParameter) {
|
|
7097
|
-
if (routeParameterKeys.includes(def.name)) {
|
|
7098
|
-
params[def.name] = routeParams[def.name];
|
|
7099
|
-
}
|
|
7100
|
-
}
|
|
7101
|
-
else {
|
|
7102
|
-
// copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the
|
|
7103
|
-
// defaults and remember sanitisation process.
|
|
7104
|
-
var value = _this.getParameterValue(def);
|
|
7105
|
-
if (_this.hasParameter(def)) {
|
|
7106
|
-
params[def.name] = value;
|
|
7107
|
-
}
|
|
7108
|
-
}
|
|
7109
|
-
});
|
|
7110
|
-
return new Visit(this.placeDefinition, params);
|
|
7111
|
-
};
|
|
7112
|
-
Visit.prototype.hasRoutingChangedFrom = function (other) {
|
|
7113
|
-
var samePlace = other.placeDefinition === this.placeDefinition;
|
|
7114
|
-
var sameRouteParameters = ___namespace.isEqual(this.placeDefinition.getFormattedRouteParameters(this, true), this.placeDefinition.getFormattedRouteParameters(other, true));
|
|
7115
|
-
return !samePlace || !sameRouteParameters;
|
|
7116
|
-
};
|
|
7117
|
-
Visit.prototype.hasChangedFrom = function (other) {
|
|
7118
|
-
var sameNonRouteParameters = ___namespace.isEqual(this.placeDefinition.getNonRouteParameters(this), this.placeDefinition.getNonRouteParameters(other));
|
|
7119
|
-
return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);
|
|
7120
|
-
};
|
|
7121
|
-
Visit.prototype.toDebugString = function () {
|
|
7122
|
-
var _this = this;
|
|
7123
|
-
return Object.keys(this.visitParameters).map(function (k) { return k + "=" + _this.visitParameters[k]; }).join(',');
|
|
7124
|
-
};
|
|
7125
|
-
return Visit;
|
|
7126
|
-
}());
|
|
7127
|
-
|
|
7128
|
-
function extractPrimarySegments(urlTree) {
|
|
7129
|
-
return urlTree.root.children.primary.segments;
|
|
7130
|
-
}
|
|
7131
|
-
exports.UrlSnapshot = /** @class */ (function () {
|
|
7132
|
-
// TODO: Update this accept a url Parser so it can be immutable and generate new trees on mutation using toString() are parseUrl.
|
|
7133
|
-
function UrlSnapshot(urlSerializer, url) {
|
|
7134
|
-
this.urlSerializer = urlSerializer;
|
|
7135
|
-
this.url = url;
|
|
7136
|
-
this.urlTree = urlSerializer.parse(url);
|
|
7137
|
-
}
|
|
7138
|
-
UrlSnapshot.prototype.updateVisitSegments = function (visit) {
|
|
7139
|
-
var newUrlTree = this.urlSerializer.parse(this.url);
|
|
7140
|
-
// Ugly, but it works for now.
|
|
7141
|
-
var segments = __spreadArray([], __read(extractPrimarySegments(newUrlTree)));
|
|
7142
|
-
var visitSegments = this.getSegmentsFor(visit);
|
|
7143
|
-
var replaceAt = segments.findIndex(function (segment) { return segment.path === visitSegments[0].path; });
|
|
7144
|
-
// do not use the return value, it's the items that were removed!
|
|
7145
|
-
segments.splice.apply(segments, __spreadArray([replaceAt, visitSegments.length], __read(visitSegments)));
|
|
7146
|
-
newUrlTree.root.children.primary.segments = segments;
|
|
7147
|
-
return new UrlSnapshot(this.urlSerializer, newUrlTree.toString());
|
|
7148
|
-
};
|
|
7149
|
-
UrlSnapshot.prototype.getPrimarySegments = function () {
|
|
7150
|
-
return extractPrimarySegments(this.urlTree);
|
|
7151
|
-
};
|
|
7152
|
-
/**
|
|
7153
|
-
* Converts the visit into segments. Please not that these segments are not e
|
|
7154
|
-
* @param visit
|
|
7155
|
-
*/
|
|
7156
|
-
UrlSnapshot.prototype.getSegmentsFor = function (visit) {
|
|
7157
|
-
return visit.placeDefinition.hasRouteId() ?
|
|
7158
|
-
[
|
|
7159
|
-
// NOTE:
|
|
7160
|
-
// It's important to attach the params to the root path and not the id. If we attach them
|
|
7161
|
-
// to an empty id then the angular router won't match the pattern.
|
|
7162
|
-
new i1$1.UrlSegment(visit.placeDefinition.path, visit.placeDefinition.getFormattedRouteParameters(visit)),
|
|
7163
|
-
new i1$1.UrlSegment(visit.placeDefinition.getFormattedRouteId(visit), {})
|
|
7164
|
-
]
|
|
7165
|
-
:
|
|
7166
|
-
[
|
|
7167
|
-
new i1$1.UrlSegment(visit.placeDefinition.path, visit.placeDefinition.getFormattedRouteParameters(visit))
|
|
7168
|
-
];
|
|
7169
|
-
};
|
|
7170
|
-
UrlSnapshot.prototype.includesPathOf = function (placeDef) {
|
|
7171
|
-
return this.getPrimarySegments().find(function (s) { return s.path === placeDef.path; });
|
|
7172
|
-
};
|
|
7173
|
-
UrlSnapshot.prototype.createVisitFor = function (placeDef) {
|
|
7174
|
-
return new Visit(placeDef, new ConsolidatedParameterMap(this.getPrimarySegments()));
|
|
7175
|
-
};
|
|
7176
|
-
UrlSnapshot.prototype.getInteractionIds = function () {
|
|
7177
|
-
var queryParam = this.urlTree.queryParams[UrlSnapshot.INTERACTION_QUERY_PARAM];
|
|
7178
|
-
if (queryParam) {
|
|
7179
|
-
return UrlSnapshot.parseInteractionIds(queryParam);
|
|
7180
|
-
}
|
|
7181
|
-
else {
|
|
7182
|
-
return [];
|
|
7183
|
-
}
|
|
7184
|
-
};
|
|
7185
|
-
UrlSnapshot.prototype.hasInteractions = function () {
|
|
7186
|
-
return this.getInteractionIds().length > 0;
|
|
7187
|
-
};
|
|
7188
|
-
UrlSnapshot.prototype.hasInteractionIds = function (ids) {
|
|
7189
|
-
return ___default['default'].isEqual(this.getInteractionIds(), ids);
|
|
7190
|
-
};
|
|
7191
|
-
// @Trace()
|
|
7192
|
-
UrlSnapshot.prototype.updateInteractionIds = function (ids) {
|
|
7193
|
-
if (ids.length === 0) {
|
|
7194
|
-
return this.removeInteractionIds();
|
|
7195
|
-
}
|
|
7196
|
-
else {
|
|
7197
|
-
var urlTree = this.urlSerializer.parse(this.url);
|
|
7198
|
-
urlTree.queryParams[UrlSnapshot.INTERACTION_QUERY_PARAM] = UrlSnapshot.createPathIdFor(ids);
|
|
7199
|
-
return new UrlSnapshot(this.urlSerializer, urlTree.toString());
|
|
7200
|
-
}
|
|
7201
|
-
};
|
|
7202
|
-
// @Trace()
|
|
7203
|
-
UrlSnapshot.prototype.removeInteractionIds = function () {
|
|
7204
|
-
var urlTree = this.urlSerializer.parse(this.url);
|
|
7205
|
-
if (urlTree.queryParams && urlTree.queryParams[UrlSnapshot.INTERACTION_QUERY_PARAM]) {
|
|
7206
|
-
urlTree.queryParams = {}; //[UrlSnapshot.INTERACTION_ROUTER_OUTLET]
|
|
7207
|
-
}
|
|
7208
|
-
return new UrlSnapshot(this.urlSerializer, urlTree.toString());
|
|
7209
|
-
};
|
|
7210
|
-
UrlSnapshot.prototype.toString = function () {
|
|
7211
|
-
return "UrlSnapshot(" + this.url + ")";
|
|
7212
|
-
};
|
|
7213
|
-
return UrlSnapshot;
|
|
7214
|
-
}());
|
|
7215
|
-
__decorate([
|
|
7216
|
-
pectin.Trace(),
|
|
7217
|
-
__metadata("design:type", Function),
|
|
7218
|
-
__metadata("design:paramtypes", [Visit]),
|
|
7219
|
-
__metadata("design:returntype", exports.UrlSnapshot)
|
|
7220
|
-
], exports.UrlSnapshot.prototype, "updateVisitSegments", null);
|
|
7221
|
-
__decorate([
|
|
7222
|
-
src.Memoize(),
|
|
7223
|
-
__metadata("design:type", Function),
|
|
7224
|
-
__metadata("design:paramtypes", []),
|
|
7225
|
-
__metadata("design:returntype", Array)
|
|
7226
|
-
], exports.UrlSnapshot.prototype, "getPrimarySegments", null);
|
|
7227
|
-
(function (UrlSnapshot) {
|
|
7228
|
-
UrlSnapshot.INTERACTION_QUERY_PARAM = 'aup-interactions';
|
|
7229
|
-
UrlSnapshot.INTERACTION_ID_SEPARATOR = '--';
|
|
7230
|
-
function parseInteractionIds(path) {
|
|
7231
|
-
return path.split(UrlSnapshot.INTERACTION_ID_SEPARATOR);
|
|
7232
|
-
}
|
|
7233
|
-
UrlSnapshot.parseInteractionIds = parseInteractionIds;
|
|
7234
|
-
function createPathIdFor(interactionIds) {
|
|
7235
|
-
return interactionIds.join(UrlSnapshot.INTERACTION_ID_SEPARATOR);
|
|
7236
|
-
}
|
|
7237
|
-
UrlSnapshot.createPathIdFor = createPathIdFor;
|
|
7238
|
-
})(exports.UrlSnapshot || (exports.UrlSnapshot = {}));
|
|
7239
|
-
|
|
7240
6996
|
/**
|
|
7241
6997
|
* This class handles the logic around canDeactivate for a given router state transition. It's core responsibilities are:
|
|
7242
6998
|
* 1. Ensure we only ask the component to deactivate once on a given navigation cycle (since visit sanitisation can result in multiple round trips to through the router.)
|
|
@@ -7287,6 +7043,7 @@
|
|
|
7287
7043
|
});
|
|
7288
7044
|
});
|
|
7289
7045
|
};
|
|
7046
|
+
// @Trace()
|
|
7290
7047
|
PlaceComponentDeactivationHandler.prototype.canDeactivateComponent = function (currentUrl, nextState) {
|
|
7291
7048
|
return __awaiter(this, void 0, void 0, function () {
|
|
7292
7049
|
var routeIds, currentIds, canLeave;
|
|
@@ -7337,12 +7094,6 @@
|
|
|
7337
7094
|
};
|
|
7338
7095
|
return PlaceComponentDeactivationHandler;
|
|
7339
7096
|
}());
|
|
7340
|
-
__decorate([
|
|
7341
|
-
pectin.Trace(),
|
|
7342
|
-
__metadata("design:type", Function),
|
|
7343
|
-
__metadata("design:paramtypes", [exports.UrlSnapshot, exports.UrlSnapshot]),
|
|
7344
|
-
__metadata("design:returntype", Promise)
|
|
7345
|
-
], PlaceComponentDeactivationHandler.prototype, "canDeactivateComponent", null);
|
|
7346
7097
|
|
|
7347
7098
|
/**
|
|
7348
7099
|
* Transient states
|
|
@@ -8259,6 +8010,245 @@
|
|
|
8259
8010
|
// }
|
|
8260
8011
|
})(exports.PlaceHistory || (exports.PlaceHistory = {}));
|
|
8261
8012
|
|
|
8013
|
+
/**
|
|
8014
|
+
* This a work around for the fact that an activated route with multiple segments doesn't
|
|
8015
|
+
* include the segment params in the paramMap as well as each segment returns an empty
|
|
8016
|
+
* param map even when `parameter`s has content.
|
|
8017
|
+
*/
|
|
8018
|
+
var ConsolidatedParameterMap = /** @class */ (function () {
|
|
8019
|
+
function ConsolidatedParameterMap(urlSegments, paramMap) {
|
|
8020
|
+
this.paramMaps = [];
|
|
8021
|
+
// TODO: can we get all our params from teh url segments? If so we can drop the paramMap altogether.
|
|
8022
|
+
var segmentParams = (urlSegments || []).map(function (s) { return new ParamMapAdapter(s.parameters); });
|
|
8023
|
+
this.paramMaps = segmentParams
|
|
8024
|
+
.concat(paramMap)
|
|
8025
|
+
.filter(function (m) { return !!m; }); // the activated route param map can be null
|
|
8026
|
+
}
|
|
8027
|
+
ConsolidatedParameterMap.prototype.get = function (name) {
|
|
8028
|
+
var paramMap = this.paramMaps.find(function (m) { return m.has(name); });
|
|
8029
|
+
return paramMap.get(name);
|
|
8030
|
+
};
|
|
8031
|
+
ConsolidatedParameterMap.prototype.getAll = function (name) {
|
|
8032
|
+
var paramMap = this.paramMaps.find(function (m) { return m.has(name); });
|
|
8033
|
+
return paramMap.getAll(name);
|
|
8034
|
+
};
|
|
8035
|
+
ConsolidatedParameterMap.prototype.has = function (name) {
|
|
8036
|
+
return !!this.paramMaps.find(function (m) { return m.has(name); });
|
|
8037
|
+
};
|
|
8038
|
+
Object.defineProperty(ConsolidatedParameterMap.prototype, "keys", {
|
|
8039
|
+
get: function () {
|
|
8040
|
+
return this.paramMaps.reduce(function (result, params) { return result.concat(params.keys); }, []);
|
|
8041
|
+
},
|
|
8042
|
+
enumerable: false,
|
|
8043
|
+
configurable: true
|
|
8044
|
+
});
|
|
8045
|
+
return ConsolidatedParameterMap;
|
|
8046
|
+
}());
|
|
8047
|
+
__decorate([
|
|
8048
|
+
src.Memoize(),
|
|
8049
|
+
__metadata("design:type", Array),
|
|
8050
|
+
__metadata("design:paramtypes", [])
|
|
8051
|
+
], ConsolidatedParameterMap.prototype, "keys", null);
|
|
8052
|
+
var ParamMapAdapter = /** @class */ (function () {
|
|
8053
|
+
function ParamMapAdapter(params) {
|
|
8054
|
+
this.params = params;
|
|
8055
|
+
}
|
|
8056
|
+
ParamMapAdapter.prototype.get = function (name) {
|
|
8057
|
+
return this.params[name];
|
|
8058
|
+
};
|
|
8059
|
+
ParamMapAdapter.prototype.getAll = function (name) {
|
|
8060
|
+
var value = this.get(name);
|
|
8061
|
+
return Array.isArray(value) ? value : [value];
|
|
8062
|
+
};
|
|
8063
|
+
ParamMapAdapter.prototype.has = function (name) {
|
|
8064
|
+
return this.keys.includes(name);
|
|
8065
|
+
};
|
|
8066
|
+
Object.defineProperty(ParamMapAdapter.prototype, "keys", {
|
|
8067
|
+
get: function () {
|
|
8068
|
+
return Object.keys(this.params);
|
|
8069
|
+
},
|
|
8070
|
+
enumerable: false,
|
|
8071
|
+
configurable: true
|
|
8072
|
+
});
|
|
8073
|
+
return ParamMapAdapter;
|
|
8074
|
+
}());
|
|
8075
|
+
|
|
8076
|
+
var Visit = /** @class */ (function () {
|
|
8077
|
+
function Visit(placeDefinition, visitParameters) {
|
|
8078
|
+
if (visitParameters === void 0) { visitParameters = {}; }
|
|
8079
|
+
this.placeDefinition = placeDefinition;
|
|
8080
|
+
this.visitParameters = visitParameters;
|
|
8081
|
+
}
|
|
8082
|
+
// @Trace()
|
|
8083
|
+
Visit.prototype.getRouteId = function () {
|
|
8084
|
+
return this.placeDefinition.getRouteIdFrom(this);
|
|
8085
|
+
};
|
|
8086
|
+
// @Trace()
|
|
8087
|
+
Visit.prototype.hasRouteId = function () {
|
|
8088
|
+
return !___namespace.isNil(this.getRouteId());
|
|
8089
|
+
};
|
|
8090
|
+
/**
|
|
8091
|
+
* Returns the value of the place parameter with the specified name. The parameter
|
|
8092
|
+
* name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
|
|
8093
|
+
* same as the the ValueModel property name.
|
|
8094
|
+
* @param parameterDef the visit parameter definition
|
|
8095
|
+
*/
|
|
8096
|
+
Visit.prototype.getParameterValue = function (parameterDef) {
|
|
8097
|
+
return this.visitParameters[parameterDef.name];
|
|
8098
|
+
};
|
|
8099
|
+
// @Trace()
|
|
8100
|
+
Visit.prototype.hasParameter = function (parameterDef) {
|
|
8101
|
+
return Object.keys(this.visitParameters).includes(parameterDef.name);
|
|
8102
|
+
};
|
|
8103
|
+
Visit.prototype.replace = function (parameter, value) {
|
|
8104
|
+
var _a;
|
|
8105
|
+
return new Visit(this.placeDefinition, Object.assign(Object.assign({}, this.visitParameters), (_a = {}, _a[parameter.name] = value, _a)));
|
|
8106
|
+
};
|
|
8107
|
+
Visit.prototype.mergeRouteParameters = function (routeParams) {
|
|
8108
|
+
var _this = this;
|
|
8109
|
+
// todo: whitelist parameters.
|
|
8110
|
+
var routeParameterKeys = Object.keys(routeParams);
|
|
8111
|
+
var params = {};
|
|
8112
|
+
this.placeDefinition.getVisitParameterDefs().forEach(function (def) {
|
|
8113
|
+
if (def.isRouteId || def.isRouteParameter) {
|
|
8114
|
+
if (routeParameterKeys.includes(def.name)) {
|
|
8115
|
+
params[def.name] = routeParams[def.name];
|
|
8116
|
+
}
|
|
8117
|
+
}
|
|
8118
|
+
else {
|
|
8119
|
+
// copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the
|
|
8120
|
+
// defaults and remember sanitisation process.
|
|
8121
|
+
var value = _this.getParameterValue(def);
|
|
8122
|
+
if (_this.hasParameter(def)) {
|
|
8123
|
+
params[def.name] = value;
|
|
8124
|
+
}
|
|
8125
|
+
}
|
|
8126
|
+
});
|
|
8127
|
+
return new Visit(this.placeDefinition, params);
|
|
8128
|
+
};
|
|
8129
|
+
Visit.prototype.hasRoutingChangedFrom = function (other) {
|
|
8130
|
+
var samePlace = other.placeDefinition === this.placeDefinition;
|
|
8131
|
+
var sameRouteParameters = ___namespace.isEqual(this.placeDefinition.getFormattedRouteParameters(this, true), this.placeDefinition.getFormattedRouteParameters(other, true));
|
|
8132
|
+
return !samePlace || !sameRouteParameters;
|
|
8133
|
+
};
|
|
8134
|
+
Visit.prototype.hasChangedFrom = function (other) {
|
|
8135
|
+
var sameNonRouteParameters = ___namespace.isEqual(this.placeDefinition.getNonRouteParameters(this), this.placeDefinition.getNonRouteParameters(other));
|
|
8136
|
+
return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);
|
|
8137
|
+
};
|
|
8138
|
+
Visit.prototype.toDebugString = function () {
|
|
8139
|
+
var _this = this;
|
|
8140
|
+
return Object.keys(this.visitParameters).map(function (k) { return k + "=" + _this.visitParameters[k]; }).join(',');
|
|
8141
|
+
};
|
|
8142
|
+
return Visit;
|
|
8143
|
+
}());
|
|
8144
|
+
|
|
8145
|
+
function extractPrimarySegments(urlTree) {
|
|
8146
|
+
return urlTree.root.children.primary.segments;
|
|
8147
|
+
}
|
|
8148
|
+
exports.UrlSnapshot = /** @class */ (function () {
|
|
8149
|
+
// TODO: Update this accept a url Parser so it can be immutable and generate new trees on mutation using toString() are parseUrl.
|
|
8150
|
+
function UrlSnapshot(urlSerializer, url) {
|
|
8151
|
+
this.urlSerializer = urlSerializer;
|
|
8152
|
+
this.url = url;
|
|
8153
|
+
this.urlTree = urlSerializer.parse(url);
|
|
8154
|
+
}
|
|
8155
|
+
// @Trace()
|
|
8156
|
+
UrlSnapshot.prototype.updateVisitSegments = function (visit) {
|
|
8157
|
+
var newUrlTree = this.urlSerializer.parse(this.url);
|
|
8158
|
+
// Ugly, but it works for now.
|
|
8159
|
+
var segments = __spreadArray([], __read(extractPrimarySegments(newUrlTree)));
|
|
8160
|
+
var visitSegments = this.getSegmentsFor(visit);
|
|
8161
|
+
var replaceAt = segments.findIndex(function (segment) { return segment.path === visitSegments[0].path; });
|
|
8162
|
+
// do not use the return value, it's the items that were removed!
|
|
8163
|
+
segments.splice.apply(segments, __spreadArray([replaceAt, visitSegments.length], __read(visitSegments)));
|
|
8164
|
+
newUrlTree.root.children.primary.segments = segments;
|
|
8165
|
+
return new UrlSnapshot(this.urlSerializer, newUrlTree.toString());
|
|
8166
|
+
};
|
|
8167
|
+
UrlSnapshot.prototype.getPrimarySegments = function () {
|
|
8168
|
+
return extractPrimarySegments(this.urlTree);
|
|
8169
|
+
};
|
|
8170
|
+
/**
|
|
8171
|
+
* Converts the visit into segments. Please not that these segments are not e
|
|
8172
|
+
* @param visit
|
|
8173
|
+
*/
|
|
8174
|
+
UrlSnapshot.prototype.getSegmentsFor = function (visit) {
|
|
8175
|
+
return visit.placeDefinition.hasRouteId() ?
|
|
8176
|
+
[
|
|
8177
|
+
// NOTE:
|
|
8178
|
+
// It's important to attach the params to the root path and not the id. If we attach them
|
|
8179
|
+
// to an empty id then the angular router won't match the pattern.
|
|
8180
|
+
new i1$1.UrlSegment(visit.placeDefinition.path, visit.placeDefinition.getFormattedRouteParameters(visit)),
|
|
8181
|
+
new i1$1.UrlSegment(visit.placeDefinition.getFormattedRouteId(visit), {})
|
|
8182
|
+
]
|
|
8183
|
+
:
|
|
8184
|
+
[
|
|
8185
|
+
new i1$1.UrlSegment(visit.placeDefinition.path, visit.placeDefinition.getFormattedRouteParameters(visit))
|
|
8186
|
+
];
|
|
8187
|
+
};
|
|
8188
|
+
UrlSnapshot.prototype.includesPathOf = function (placeDef) {
|
|
8189
|
+
return this.getPrimarySegments().find(function (s) { return s.path === placeDef.path; });
|
|
8190
|
+
};
|
|
8191
|
+
UrlSnapshot.prototype.createVisitFor = function (placeDef) {
|
|
8192
|
+
return new Visit(placeDef, new ConsolidatedParameterMap(this.getPrimarySegments()));
|
|
8193
|
+
};
|
|
8194
|
+
UrlSnapshot.prototype.getInteractionIds = function () {
|
|
8195
|
+
var queryParam = this.urlTree.queryParams[UrlSnapshot.INTERACTION_QUERY_PARAM];
|
|
8196
|
+
if (queryParam) {
|
|
8197
|
+
return UrlSnapshot.parseInteractionIds(queryParam);
|
|
8198
|
+
}
|
|
8199
|
+
else {
|
|
8200
|
+
return [];
|
|
8201
|
+
}
|
|
8202
|
+
};
|
|
8203
|
+
UrlSnapshot.prototype.hasInteractions = function () {
|
|
8204
|
+
return this.getInteractionIds().length > 0;
|
|
8205
|
+
};
|
|
8206
|
+
UrlSnapshot.prototype.hasInteractionIds = function (ids) {
|
|
8207
|
+
return ___default['default'].isEqual(this.getInteractionIds(), ids);
|
|
8208
|
+
};
|
|
8209
|
+
// @Trace()
|
|
8210
|
+
UrlSnapshot.prototype.updateInteractionIds = function (ids) {
|
|
8211
|
+
if (ids.length === 0) {
|
|
8212
|
+
return this.removeInteractionIds();
|
|
8213
|
+
}
|
|
8214
|
+
else {
|
|
8215
|
+
var urlTree = this.urlSerializer.parse(this.url);
|
|
8216
|
+
urlTree.queryParams[UrlSnapshot.INTERACTION_QUERY_PARAM] = UrlSnapshot.createPathIdFor(ids);
|
|
8217
|
+
return new UrlSnapshot(this.urlSerializer, urlTree.toString());
|
|
8218
|
+
}
|
|
8219
|
+
};
|
|
8220
|
+
// @Trace()
|
|
8221
|
+
UrlSnapshot.prototype.removeInteractionIds = function () {
|
|
8222
|
+
var urlTree = this.urlSerializer.parse(this.url);
|
|
8223
|
+
if (urlTree.queryParams && urlTree.queryParams[UrlSnapshot.INTERACTION_QUERY_PARAM]) {
|
|
8224
|
+
urlTree.queryParams = {}; //[UrlSnapshot.INTERACTION_ROUTER_OUTLET]
|
|
8225
|
+
}
|
|
8226
|
+
return new UrlSnapshot(this.urlSerializer, urlTree.toString());
|
|
8227
|
+
};
|
|
8228
|
+
UrlSnapshot.prototype.toString = function () {
|
|
8229
|
+
return "UrlSnapshot(" + this.url + ")";
|
|
8230
|
+
};
|
|
8231
|
+
return UrlSnapshot;
|
|
8232
|
+
}());
|
|
8233
|
+
__decorate([
|
|
8234
|
+
src.Memoize(),
|
|
8235
|
+
__metadata("design:type", Function),
|
|
8236
|
+
__metadata("design:paramtypes", []),
|
|
8237
|
+
__metadata("design:returntype", Array)
|
|
8238
|
+
], exports.UrlSnapshot.prototype, "getPrimarySegments", null);
|
|
8239
|
+
(function (UrlSnapshot) {
|
|
8240
|
+
UrlSnapshot.INTERACTION_QUERY_PARAM = 'aup-interactions';
|
|
8241
|
+
UrlSnapshot.INTERACTION_ID_SEPARATOR = '--';
|
|
8242
|
+
function parseInteractionIds(path) {
|
|
8243
|
+
return path.split(UrlSnapshot.INTERACTION_ID_SEPARATOR);
|
|
8244
|
+
}
|
|
8245
|
+
UrlSnapshot.parseInteractionIds = parseInteractionIds;
|
|
8246
|
+
function createPathIdFor(interactionIds) {
|
|
8247
|
+
return interactionIds.join(UrlSnapshot.INTERACTION_ID_SEPARATOR);
|
|
8248
|
+
}
|
|
8249
|
+
UrlSnapshot.createPathIdFor = createPathIdFor;
|
|
8250
|
+
})(exports.UrlSnapshot || (exports.UrlSnapshot = {}));
|
|
8251
|
+
|
|
8262
8252
|
var UrlService = /** @class */ (function () {
|
|
8263
8253
|
function UrlService(angularRouter, angularLocation, urlSerializer) {
|
|
8264
8254
|
this.angularRouter = angularRouter;
|