@coolon/angular-ui-powerups 3.7.2 → 3.7.4
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/CHANGELOG.md +10 -0
- package/bundles/coolon-angular-ui-powerups.umd.js +174 -122
- package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
- package/bundles/coolon-angular-ui-powerups.umd.min.js +1 -1
- package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
- package/coolon-angular-ui-powerups.metadata.json +1 -1
- package/esm2015/lib/components/forms/number-input/number-input.component.js.map +1 -1
- package/esm2015/lib/components/table/column-model.js +8 -0
- package/esm2015/lib/components/table/column-model.js.map +1 -1
- package/esm2015/lib/components/table/column-model.metadata.json +1 -1
- package/esm2015/lib/components/table/table.component.js +1 -1
- package/esm2015/lib/components/table/table.component.metadata.json +1 -1
- package/esm2015/lib/place/components/abstract-place-navigation.component.js +9 -5
- package/esm2015/lib/place/components/abstract-place-navigation.component.js.map +1 -1
- package/esm2015/lib/place/components/abstract-place-navigation.component.metadata.json +1 -1
- package/esm2015/lib/place/components/list-place-nav/list-place-nav.component.js +5 -5
- package/esm2015/lib/place/components/list-place-nav/list-place-nav.component.js.map +1 -1
- package/esm2015/lib/place/components/list-place-nav/list-place-nav.component.metadata.json +1 -1
- package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +8 -23
- package/esm2015/lib/place/components/place-outlet/place-outlet.component.js.map +1 -1
- package/esm2015/lib/place/components/place-outlet/place-outlet.component.metadata.json +1 -1
- package/esm2015/lib/place/components/side-place-navigation/side-place-navigation.component.js +5 -8
- package/esm2015/lib/place/components/side-place-navigation/side-place-navigation.component.js.map +1 -1
- package/esm2015/lib/place/components/side-place-navigation/side-place-navigation.component.metadata.json +1 -1
- package/esm2015/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.js +5 -5
- package/esm2015/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.js.map +1 -1
- package/esm2015/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.metadata.json +1 -1
- package/esm2015/lib/place/exports.js +1 -1
- package/esm2015/lib/place/exports.js.map +1 -1
- package/esm2015/lib/place/exports.metadata.json +1 -1
- package/esm2015/lib/place/guards/place.guard.js +9 -13
- package/esm2015/lib/place/guards/place.guard.js.map +1 -1
- package/esm2015/lib/place/guards/place.guard.metadata.json +1 -1
- package/esm2015/lib/place/navigation/session/navigation-session.js +3 -3
- package/esm2015/lib/place/navigation/session/navigation-session.js.map +1 -1
- package/esm2015/lib/place/place-access-guard.js +28 -0
- package/esm2015/lib/place/place-access-guard.js.map +1 -0
- package/esm2015/lib/place/place-access-guard.metadata.json +1 -0
- package/esm2015/lib/place/place-router.js +32 -3
- package/esm2015/lib/place/place-router.js.map +1 -1
- package/esm2015/lib/place/place-router.metadata.json +1 -1
- package/esm2015/lib/place/visit.js +1 -1
- package/esm2015/lib/place/visit.js.map +1 -1
- package/esm2015/lib/place/visit.metadata.json +1 -1
- package/fesm2015/coolon-angular-ui-powerups.js +166 -119
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/components/table/column-model.d.ts +6 -0
- package/lib/place/components/abstract-place-navigation.component.d.ts +3 -2
- package/lib/place/components/list-place-nav/list-place-nav.component.d.ts +2 -2
- package/lib/place/components/place-outlet/place-outlet.component.d.ts +1 -3
- package/lib/place/components/side-place-navigation/side-place-navigation.component.d.ts +2 -4
- package/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.d.ts +2 -2
- package/lib/place/exports.d.ts +1 -1
- package/lib/place/guards/place.guard.d.ts +1 -3
- package/lib/place/place-access-guard.d.ts +11 -0
- package/lib/place/place-router.d.ts +18 -4
- package/package.json +1 -1
- package/schematics/place-add/index.js.map +1 -1
- package/schematics/utils/workspace.js.map +1 -1
- package/esm2015/lib/place/place-auth-service.js +0 -3
- package/esm2015/lib/place/place-auth-service.js.map +0 -1
- package/esm2015/lib/place/place-auth-service.metadata.json +0 -1
- package/lib/place/place-auth-service.d.ts +0 -36
- package/schematics/bootstrap-app/templates/app/auth/place-auth.service.ts.template +0 -41
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [3.7.4](https://bitbucket.org/coolon/angular-ui-powerups/compare/v3.7.3...v3.7.4) (2021-02-01)
|
|
6
|
+
|
|
7
|
+
### [3.7.3](https://bitbucket.org/coolon/angular-ui-powerups/compare/v3.7.2...v3.7.3) (2021-01-28)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* added css fix for firefox rendering of aup tables ([fa73ea5](https://bitbucket.org/coolon/angular-ui-powerups/commit/fa73ea5bb3b0b6de48abb5a89dbdf1d8ddb80f19))
|
|
13
|
+
* improved auth service design ([f6af33d](https://bitbucket.org/coolon/angular-ui-powerups/commit/f6af33d036d5fee3039871479d09d673ca3ef0bc))
|
|
14
|
+
|
|
5
15
|
### [3.7.2](https://bitbucket.org/coolon/angular-ui-powerups/compare/v3.7.1...v3.7.2) (2021-01-22)
|
|
6
16
|
|
|
7
17
|
|
|
@@ -2654,6 +2654,14 @@
|
|
|
2654
2654
|
}));
|
|
2655
2655
|
return this;
|
|
2656
2656
|
};
|
|
2657
|
+
PropertyColumnModel.prototype.liveEditCellRenderer = function (componentType, options) {
|
|
2658
|
+
return this.mutableCellRenderer(componentType, options);
|
|
2659
|
+
};
|
|
2660
|
+
/**
|
|
2661
|
+
* Deprecated. Use #liveEditCellRenderer instead.
|
|
2662
|
+
* @param componentType
|
|
2663
|
+
* @param options
|
|
2664
|
+
*/
|
|
2657
2665
|
PropertyColumnModel.prototype.mutableCellRenderer = function (componentType, options) {
|
|
2658
2666
|
var _this = this;
|
|
2659
2667
|
this.configureCellRenderer(new ComponentCellRendererPortalRef(componentType, function (component, rowData, firstTime) {
|
|
@@ -3176,7 +3184,7 @@
|
|
|
3176
3184
|
{ type: i0.Component, args: [{
|
|
3177
3185
|
selector: 'aup-table',
|
|
3178
3186
|
template: "<table mat-table [dataSource]=\"tableModel.dataSource.value\" [trackBy]=\"tableModel.trackBy\">\n\n <ng-container *ngFor=\"let column of columns.value; index as index; first as first; last as last\" matColumnDef=\"{{column.columnId}}\">\n <th mat-header-cell *matHeaderCellDef>\n <aup-table-header-cell-renderer [column]=\"column\"\n [attr.column-index]=\"index\"\n [attr.column-id]=\"column.columnId\"\n [class.first-column]=\"first\"\n [class.last-column]=\"last\"\n ></aup-table-header-cell-renderer>\n </th>\n <td mat-cell *matCellDef=\"let row\" (click)=\"onCellClicked(column, row)\" [class.enable-cursor]=\"tableModel.isRowSelectionEnabledFor(column)\">\n <aup-table-cell-renderer [column]=\"column\"\n [row]=\"row\"\n [tableModel]=\"tableModel\"\n [editSession]=\"tableModel.getEditSessionFor(row)\"\n [attr.column-index]=\"index\"\n [attr.column-id]=\"column.columnId\"\n [class.first-column]=\"first\"\n [class.last-column]=\"last\"\n ></aup-table-cell-renderer>\n </td>\n </ng-container>\n\n <tr mat-header-row *matHeaderRowDef=\"columnIds.value\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: columnIds.value; let i = index\"\n [ngClass]=\"tableModel.getRowClasses(row)\" [attr.trackBy]=\"tableModel.trackBy(i, row)\"\n ></tr>\n\n</table>\n",
|
|
3179
|
-
styles: [":host{align-items:stretch;display:flex;flex-direction:column}:host table{flex:1}"]
|
|
3187
|
+
styles: [":host{align-items:stretch;display:flex;flex-direction:column}:host table{flex:1;width:100%}"]
|
|
3180
3188
|
},] }
|
|
3181
3189
|
];
|
|
3182
3190
|
TableComponent.ctorParameters = function () { return []; };
|
|
@@ -4939,8 +4947,6 @@
|
|
|
4939
4947
|
},] }
|
|
4940
4948
|
];
|
|
4941
4949
|
|
|
4942
|
-
var PLACE_AUTH_SERVICE = new i0.InjectionToken("PlaceAuthService");
|
|
4943
|
-
|
|
4944
4950
|
exports.ParameterDefinition = /** @class */ (function () {
|
|
4945
4951
|
function ParameterDefinition(propertyName, options, urlFormat) {
|
|
4946
4952
|
this.propertyName = propertyName;
|
|
@@ -5312,77 +5318,6 @@
|
|
|
5312
5318
|
PlaceComponent.injectDefinition = injectDefinition;
|
|
5313
5319
|
})(exports.PlaceComponent || (exports.PlaceComponent = {}));
|
|
5314
5320
|
|
|
5315
|
-
var Visit = /** @class */ (function () {
|
|
5316
|
-
function Visit(placeDefinition, visitParameters) {
|
|
5317
|
-
if (visitParameters === void 0) { visitParameters = {}; }
|
|
5318
|
-
this.placeDefinition = placeDefinition;
|
|
5319
|
-
this.visitParameters = visitParameters;
|
|
5320
|
-
}
|
|
5321
|
-
// @Trace()
|
|
5322
|
-
Visit.prototype.getRouteId = function () {
|
|
5323
|
-
return this.placeDefinition.getRouteIdFrom(this);
|
|
5324
|
-
};
|
|
5325
|
-
// @Trace()
|
|
5326
|
-
Visit.prototype.hasRouteId = function () {
|
|
5327
|
-
return !_.isNil(this.getRouteId());
|
|
5328
|
-
};
|
|
5329
|
-
/**
|
|
5330
|
-
* Returns the value of the place parameter with the specified name. The parameter
|
|
5331
|
-
* name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
|
|
5332
|
-
* same as the the ValueModel property name.
|
|
5333
|
-
* @param parameterName the field name of the property model or the `as` option if specified.
|
|
5334
|
-
*/
|
|
5335
|
-
Visit.prototype.getParameter = function (parameterName) {
|
|
5336
|
-
return this.visitParameters[parameterName];
|
|
5337
|
-
};
|
|
5338
|
-
// @Trace()
|
|
5339
|
-
Visit.prototype.hasParameter = function (parameterName) {
|
|
5340
|
-
return Object.keys(this.visitParameters).includes(parameterName);
|
|
5341
|
-
};
|
|
5342
|
-
Visit.prototype.replace = function (parameter, value) {
|
|
5343
|
-
var _a;
|
|
5344
|
-
return new Visit(this.placeDefinition, Object.assign(Object.assign({}, this.visitParameters), (_a = {}, _a[parameter.name] = value, _a)));
|
|
5345
|
-
};
|
|
5346
|
-
Visit.prototype.mergeRouteParameters = function (routeParams) {
|
|
5347
|
-
var _this = this;
|
|
5348
|
-
// todo: whitelist parameters.
|
|
5349
|
-
var routeParameterKeys = Object.keys(routeParams);
|
|
5350
|
-
var params = {};
|
|
5351
|
-
this.placeDefinition.getVisitParameterDefs().forEach(function (def) {
|
|
5352
|
-
if (def.isRouteId || def.isRouteParameter) {
|
|
5353
|
-
if (routeParameterKeys.includes(def.name)) {
|
|
5354
|
-
params[def.name] = routeParams[def.name];
|
|
5355
|
-
}
|
|
5356
|
-
}
|
|
5357
|
-
else {
|
|
5358
|
-
// copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the
|
|
5359
|
-
// defaults and remember sanitisation process.
|
|
5360
|
-
var value = _this.getParameter(def.name);
|
|
5361
|
-
if (_this.hasParameter(def.name)) {
|
|
5362
|
-
params[def.name] = value;
|
|
5363
|
-
}
|
|
5364
|
-
}
|
|
5365
|
-
});
|
|
5366
|
-
return new Visit(this.placeDefinition, params);
|
|
5367
|
-
};
|
|
5368
|
-
Visit.prototype.hasRoutingChangedFrom = function (other) {
|
|
5369
|
-
var samePlace = other.placeDefinition === this.placeDefinition;
|
|
5370
|
-
var sameRouteParameters = _.isEqual(this.placeDefinition.getFormattedRouteParameters(this, true), this.placeDefinition.getFormattedRouteParameters(other, true));
|
|
5371
|
-
return !samePlace || !sameRouteParameters;
|
|
5372
|
-
};
|
|
5373
|
-
Visit.prototype.hasChangedFrom = function (other) {
|
|
5374
|
-
var sameNonRouteParameters = _.isEqual(this.placeDefinition.getNonRouteParameters(this), this.placeDefinition.getNonRouteParameters(other));
|
|
5375
|
-
return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);
|
|
5376
|
-
};
|
|
5377
|
-
Visit.prototype.toDebugString = function () {
|
|
5378
|
-
var _this = this;
|
|
5379
|
-
return Object.keys(this.visitParameters).map(function (k) { return k + "=" + _this.visitParameters[k]; }).join(",");
|
|
5380
|
-
};
|
|
5381
|
-
return Visit;
|
|
5382
|
-
}());
|
|
5383
|
-
|
|
5384
|
-
var AUP_PLACE_CONFIG = new i0.InjectionToken('AUP_PLACE_CONFIG');
|
|
5385
|
-
|
|
5386
5321
|
/**
|
|
5387
5322
|
* This class handles the logic around canDeactivate for a given router state transition. It's core responsibilities are:
|
|
5388
5323
|
* 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.)
|
|
@@ -5590,14 +5525,14 @@
|
|
|
5590
5525
|
// Important: I tried to perform this fix at a later point int he routing cycle but it created all kinds of
|
|
5591
5526
|
// strangeness.
|
|
5592
5527
|
pectin.Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
|
|
5593
|
-
console.log(
|
|
5528
|
+
// console.log(`replacing ${this.urlService.getCurrentLocationUrlSnapshot().url} with ${poppedHistoryToReplace}`);
|
|
5594
5529
|
this.urlService.resetBrowserLocation(poppedHistoryToReplace, { replaceCurrent: true });
|
|
5595
|
-
console.log(
|
|
5530
|
+
// console.log(`pushing ${activeUrl} back onto the history.`);
|
|
5596
5531
|
this.urlService.resetBrowserLocation(activeUrl, { replaceCurrent: false });
|
|
5597
5532
|
};
|
|
5598
5533
|
NavigationSession.prototype.ignore = function (event, reason) {
|
|
5599
5534
|
reason = reason ? " -> " + reason : '';
|
|
5600
|
-
|
|
5535
|
+
// Logger.get(this).info(`Ignoring router event${reason}: ${event.constructor.name} -> ${event.url} :: ${this.toString()}`);
|
|
5601
5536
|
};
|
|
5602
5537
|
NavigationSession.prototype.toString = function () {
|
|
5603
5538
|
return this.constructor.name + "(" + this.debugState() + ")";
|
|
@@ -6247,6 +6182,33 @@
|
|
|
6247
6182
|
return PopStateNavigation;
|
|
6248
6183
|
}(AbstractPopStateNavigation));
|
|
6249
6184
|
|
|
6185
|
+
(function (PlaceAccessGuard) {
|
|
6186
|
+
var NoAuth = /** @class */ (function () {
|
|
6187
|
+
function NoAuth() {
|
|
6188
|
+
}
|
|
6189
|
+
NoAuth.prototype.isAuthenticated = function () {
|
|
6190
|
+
return true;
|
|
6191
|
+
};
|
|
6192
|
+
NoAuth.prototype.isAuthorised = function (placeDefinition) {
|
|
6193
|
+
return true;
|
|
6194
|
+
};
|
|
6195
|
+
return NoAuth;
|
|
6196
|
+
}());
|
|
6197
|
+
__decorate([
|
|
6198
|
+
pectin.Trace(),
|
|
6199
|
+
__metadata("design:type", Function),
|
|
6200
|
+
__metadata("design:paramtypes", []),
|
|
6201
|
+
__metadata("design:returntype", Object)
|
|
6202
|
+
], NoAuth.prototype, "isAuthenticated", null);
|
|
6203
|
+
__decorate([
|
|
6204
|
+
pectin.Trace(),
|
|
6205
|
+
__metadata("design:type", Function),
|
|
6206
|
+
__metadata("design:paramtypes", [PlaceDefinition]),
|
|
6207
|
+
__metadata("design:returntype", Boolean)
|
|
6208
|
+
], NoAuth.prototype, "isAuthorised", null);
|
|
6209
|
+
PlaceAccessGuard.NoAuth = NoAuth;
|
|
6210
|
+
})(exports.PlaceAccessGuard || (exports.PlaceAccessGuard = {}));
|
|
6211
|
+
|
|
6250
6212
|
exports.PlaceHistory = /** @class */ (function () {
|
|
6251
6213
|
function PlaceHistory() {
|
|
6252
6214
|
this._archive = new Map();
|
|
@@ -6557,6 +6519,11 @@
|
|
|
6557
6519
|
_this.navigationSessionModel = new pectin.MutableValueModel();
|
|
6558
6520
|
_this._activeVisits = new pectin.MutableListModel();
|
|
6559
6521
|
_this.sessionFinishedJobs = [];
|
|
6522
|
+
/**
|
|
6523
|
+
* An observable model containing the authoriser function. This allows places to react to changes
|
|
6524
|
+
* in permissions when any underlying auth logic changes, e.g. a role being removed from a user.
|
|
6525
|
+
*/
|
|
6526
|
+
_this._accessGuard = new pectin.DelegatingValueModel().withDefault(new exports.PlaceAccessGuard.NoAuth());
|
|
6560
6527
|
if (window['Cypress']) {
|
|
6561
6528
|
window['aup.PlaceRouter'] = _this;
|
|
6562
6529
|
}
|
|
@@ -6616,6 +6583,33 @@
|
|
|
6616
6583
|
angularLocation.onUrlChange(function (url) { return _this.onUrlChanged(url); });
|
|
6617
6584
|
return _this;
|
|
6618
6585
|
}
|
|
6586
|
+
Object.defineProperty(PlaceRouter.prototype, "accessGuard", {
|
|
6587
|
+
get: function () {
|
|
6588
|
+
return this._accessGuard.readonly;
|
|
6589
|
+
},
|
|
6590
|
+
enumerable: false,
|
|
6591
|
+
configurable: true
|
|
6592
|
+
});
|
|
6593
|
+
// @Trace()
|
|
6594
|
+
PlaceRouter.prototype.configureAuth = function (accessGrant, redirections) {
|
|
6595
|
+
// We need a shitty mutable model until setDelegate is clever enough to work with readonly models.
|
|
6596
|
+
var hackyMutableModel = new pectin.MutableValueModel();
|
|
6597
|
+
var binding = new pectin.Binding(hackyMutableModel, accessGrant, {
|
|
6598
|
+
toRight: function (leftValue) {
|
|
6599
|
+
return pectin.lang.illegalState('hackyMutableModel is read only');
|
|
6600
|
+
},
|
|
6601
|
+
toLeft: function (rightValue) { return rightValue; }
|
|
6602
|
+
});
|
|
6603
|
+
binding.writeLeft();
|
|
6604
|
+
this._accessGuard.setDelegate(hackyMutableModel);
|
|
6605
|
+
this.redirections = redirections;
|
|
6606
|
+
};
|
|
6607
|
+
PlaceRouter.prototype.getAuthenticationFailureRedirect = function (activatedRoute, state) {
|
|
6608
|
+
return this.redirections.onAuthenticationFailure(activatedRoute, state);
|
|
6609
|
+
};
|
|
6610
|
+
PlaceRouter.prototype.getAuthorisationFailureRedirect = function (activatedRoute, state) {
|
|
6611
|
+
return this.redirections.onAuthorisationFailure(activatedRoute, state);
|
|
6612
|
+
};
|
|
6619
6613
|
Object.defineProperty(PlaceRouter.prototype, "navigationSession", {
|
|
6620
6614
|
get: function () {
|
|
6621
6615
|
return this.navigationSessionModel.value;
|
|
@@ -6777,7 +6771,7 @@
|
|
|
6777
6771
|
this.placeHistory.notifyNavigationStarted();
|
|
6778
6772
|
}
|
|
6779
6773
|
pectin.assert.isTruthy(next !== previous);
|
|
6780
|
-
|
|
6774
|
+
// Logger.get(this).info(`### Router State Transition: ${previous ? previous.toString() : 'null'} -> ${next.toString()}`);
|
|
6781
6775
|
this.navigationSessionModel.value = next;
|
|
6782
6776
|
if (!!previous) {
|
|
6783
6777
|
previous.dispose();
|
|
@@ -6797,7 +6791,7 @@
|
|
|
6797
6791
|
var session = this.currentSession;
|
|
6798
6792
|
session.dispose();
|
|
6799
6793
|
this.navigationSessionModel.value = null;
|
|
6800
|
-
console.log(
|
|
6794
|
+
// console.log(`### Router Session Finished (was ${session.toString()})`);
|
|
6801
6795
|
this.sessionFinishedJobs.forEach(function (job) { return job(); });
|
|
6802
6796
|
this.sessionFinishedJobs = [];
|
|
6803
6797
|
};
|
|
@@ -6855,6 +6849,77 @@
|
|
|
6855
6849
|
{ type: exports.PlaceHistory }
|
|
6856
6850
|
]; };
|
|
6857
6851
|
|
|
6852
|
+
var Visit = /** @class */ (function () {
|
|
6853
|
+
function Visit(placeDefinition, visitParameters) {
|
|
6854
|
+
if (visitParameters === void 0) { visitParameters = {}; }
|
|
6855
|
+
this.placeDefinition = placeDefinition;
|
|
6856
|
+
this.visitParameters = visitParameters;
|
|
6857
|
+
}
|
|
6858
|
+
// @Trace()
|
|
6859
|
+
Visit.prototype.getRouteId = function () {
|
|
6860
|
+
return this.placeDefinition.getRouteIdFrom(this);
|
|
6861
|
+
};
|
|
6862
|
+
// @Trace()
|
|
6863
|
+
Visit.prototype.hasRouteId = function () {
|
|
6864
|
+
return !_.isNil(this.getRouteId());
|
|
6865
|
+
};
|
|
6866
|
+
/**
|
|
6867
|
+
* Returns the value of the place parameter with the specified name. The parameter
|
|
6868
|
+
* name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
|
|
6869
|
+
* same as the the ValueModel property name.
|
|
6870
|
+
* @param parameterName the field name of the property model or the `as` option if specified.
|
|
6871
|
+
*/
|
|
6872
|
+
Visit.prototype.getParameter = function (parameterName) {
|
|
6873
|
+
return this.visitParameters[parameterName];
|
|
6874
|
+
};
|
|
6875
|
+
// @Trace()
|
|
6876
|
+
Visit.prototype.hasParameter = function (parameterName) {
|
|
6877
|
+
return Object.keys(this.visitParameters).includes(parameterName);
|
|
6878
|
+
};
|
|
6879
|
+
Visit.prototype.replace = function (parameter, value) {
|
|
6880
|
+
var _a;
|
|
6881
|
+
return new Visit(this.placeDefinition, Object.assign(Object.assign({}, this.visitParameters), (_a = {}, _a[parameter.name] = value, _a)));
|
|
6882
|
+
};
|
|
6883
|
+
Visit.prototype.mergeRouteParameters = function (routeParams) {
|
|
6884
|
+
var _this = this;
|
|
6885
|
+
// todo: whitelist parameters.
|
|
6886
|
+
var routeParameterKeys = Object.keys(routeParams);
|
|
6887
|
+
var params = {};
|
|
6888
|
+
this.placeDefinition.getVisitParameterDefs().forEach(function (def) {
|
|
6889
|
+
if (def.isRouteId || def.isRouteParameter) {
|
|
6890
|
+
if (routeParameterKeys.includes(def.name)) {
|
|
6891
|
+
params[def.name] = routeParams[def.name];
|
|
6892
|
+
}
|
|
6893
|
+
}
|
|
6894
|
+
else {
|
|
6895
|
+
// copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the
|
|
6896
|
+
// defaults and remember sanitisation process.
|
|
6897
|
+
var value = _this.getParameter(def.name);
|
|
6898
|
+
if (_this.hasParameter(def.name)) {
|
|
6899
|
+
params[def.name] = value;
|
|
6900
|
+
}
|
|
6901
|
+
}
|
|
6902
|
+
});
|
|
6903
|
+
return new Visit(this.placeDefinition, params);
|
|
6904
|
+
};
|
|
6905
|
+
Visit.prototype.hasRoutingChangedFrom = function (other) {
|
|
6906
|
+
var samePlace = other.placeDefinition === this.placeDefinition;
|
|
6907
|
+
var sameRouteParameters = _.isEqual(this.placeDefinition.getFormattedRouteParameters(this, true), this.placeDefinition.getFormattedRouteParameters(other, true));
|
|
6908
|
+
return !samePlace || !sameRouteParameters;
|
|
6909
|
+
};
|
|
6910
|
+
Visit.prototype.hasChangedFrom = function (other) {
|
|
6911
|
+
var sameNonRouteParameters = _.isEqual(this.placeDefinition.getNonRouteParameters(this), this.placeDefinition.getNonRouteParameters(other));
|
|
6912
|
+
return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);
|
|
6913
|
+
};
|
|
6914
|
+
Visit.prototype.toDebugString = function () {
|
|
6915
|
+
var _this = this;
|
|
6916
|
+
return Object.keys(this.visitParameters).map(function (k) { return k + "=" + _this.visitParameters[k]; }).join(',');
|
|
6917
|
+
};
|
|
6918
|
+
return Visit;
|
|
6919
|
+
}());
|
|
6920
|
+
|
|
6921
|
+
var AUP_PLACE_CONFIG = new i0.InjectionToken('AUP_PLACE_CONFIG');
|
|
6922
|
+
|
|
6858
6923
|
// Freezes the state of the components at the start of the animation.
|
|
6859
6924
|
var animationStartStyle = animations$1.style({ position: 'absolute', top: '0', left: '0', bottom: '0', right: '0' });
|
|
6860
6925
|
var left = [
|
|
@@ -6901,11 +6966,10 @@
|
|
|
6901
6966
|
|
|
6902
6967
|
var PlaceOutletComponent = /** @class */ (function (_super) {
|
|
6903
6968
|
__extends(PlaceOutletComponent, _super);
|
|
6904
|
-
function PlaceOutletComponent(router, placeRouter,
|
|
6969
|
+
function PlaceOutletComponent(router, placeRouter, placeConfig, parentOutlet) {
|
|
6905
6970
|
var _this = _super.call(this) || this;
|
|
6906
6971
|
_this.router = router;
|
|
6907
6972
|
_this.placeRouter = placeRouter;
|
|
6908
|
-
_this.placeAuthService = placeAuthService;
|
|
6909
6973
|
_this.placeConfig = placeConfig;
|
|
6910
6974
|
_this.placeChanged = new i0.EventEmitter();
|
|
6911
6975
|
_this.outletActivated = new pectin.MutableValueModel(false);
|
|
@@ -6950,11 +7014,11 @@
|
|
|
6950
7014
|
chain(_this._activePlaceModel)
|
|
6951
7015
|
.postponeWhile(_this.navigationInProgress)
|
|
6952
7016
|
.subscribe(function (place) { return _this.placeChanged.emit(place); });
|
|
6953
|
-
when(
|
|
7017
|
+
when(placeRouter.accessGuard).changes(function (guard) {
|
|
6954
7018
|
var activePlace = _this._activePlaceModel.value;
|
|
6955
|
-
if (activePlace && !isAuthorised(activePlace.placeDefinition)) {
|
|
6956
|
-
var
|
|
6957
|
-
_this.placeRouter.navigate(
|
|
7019
|
+
if (activePlace && !guard.isAuthorised(activePlace.placeDefinition)) {
|
|
7020
|
+
var visit = placeRouter.getAuthorisationFailureRedirect(_this._activatedRouteModel.value.snapshot, _this.router.routerState.snapshot);
|
|
7021
|
+
_this.placeRouter.navigate(visit);
|
|
6958
7022
|
}
|
|
6959
7023
|
});
|
|
6960
7024
|
return _this;
|
|
@@ -7004,6 +7068,7 @@
|
|
|
7004
7068
|
enumerable: false,
|
|
7005
7069
|
configurable: true
|
|
7006
7070
|
});
|
|
7071
|
+
// @Trace()
|
|
7007
7072
|
PlaceOutletComponent.prototype.onOutletActivated = function (routerOutlet, place) {
|
|
7008
7073
|
this._activatedRouteModel.value = routerOutlet.activatedRoute;
|
|
7009
7074
|
this._activePlaceModel.value = place;
|
|
@@ -7023,6 +7088,7 @@
|
|
|
7023
7088
|
}
|
|
7024
7089
|
}
|
|
7025
7090
|
};
|
|
7091
|
+
// @Trace()
|
|
7026
7092
|
PlaceOutletComponent.prototype.onOutletDeactivated = function () {
|
|
7027
7093
|
this.outletActivated.value = false;
|
|
7028
7094
|
this._activePlaceModel.value = null;
|
|
@@ -7098,7 +7164,6 @@
|
|
|
7098
7164
|
PlaceOutletComponent.ctorParameters = function () { return [
|
|
7099
7165
|
{ type: i1$1.Router },
|
|
7100
7166
|
{ type: PlaceRouter },
|
|
7101
|
-
{ type: undefined, decorators: [{ type: i0.Inject, args: [PLACE_AUTH_SERVICE,] }] },
|
|
7102
7167
|
{ type: undefined, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [AUP_PLACE_CONFIG,] }] },
|
|
7103
7168
|
{ type: PlaceOutletComponent, decorators: [{ type: i0.SkipSelf }, { type: i0.Optional }] }
|
|
7104
7169
|
]; };
|
|
@@ -7126,28 +7191,20 @@
|
|
|
7126
7191
|
pectin.StoreInListModel('customPlaceAnimationOrderModel'),
|
|
7127
7192
|
__metadata("design:type", Array)
|
|
7128
7193
|
], PlaceOutletComponent.prototype, "customPlaceAnimationOrder", void 0);
|
|
7129
|
-
__decorate([
|
|
7130
|
-
pectin.Trace(),
|
|
7131
|
-
__metadata("design:type", Function),
|
|
7132
|
-
__metadata("design:paramtypes", [i1$1.RouterOutlet, exports.PlaceComponent]),
|
|
7133
|
-
__metadata("design:returntype", void 0)
|
|
7134
|
-
], PlaceOutletComponent.prototype, "onOutletActivated", null);
|
|
7135
|
-
__decorate([
|
|
7136
|
-
pectin.Trace(),
|
|
7137
|
-
__metadata("design:type", Function),
|
|
7138
|
-
__metadata("design:paramtypes", []),
|
|
7139
|
-
__metadata("design:returntype", void 0)
|
|
7140
|
-
], PlaceOutletComponent.prototype, "onOutletDeactivated", null);
|
|
7141
7194
|
|
|
7142
7195
|
var AbstractPlaceNavigationComponent = /** @class */ (function (_super) {
|
|
7143
7196
|
__extends(AbstractPlaceNavigationComponent, _super);
|
|
7144
|
-
function AbstractPlaceNavigationComponent(
|
|
7197
|
+
function AbstractPlaceNavigationComponent(placeRouter) {
|
|
7145
7198
|
var _this = _super.call(this) || this;
|
|
7199
|
+
_this.placeRouter = placeRouter;
|
|
7146
7200
|
_this._activePlaceComponent = new pectin.DelegatingValueModel();
|
|
7147
7201
|
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;
|
|
7148
7202
|
_this.placeDefinitions = chain(_this.placesModel)
|
|
7149
7203
|
.map(function (c) { return exports.PlaceComponent.getDefinition(c); })
|
|
7150
|
-
.select(function (d) {
|
|
7204
|
+
.select(function (d) {
|
|
7205
|
+
var guard = placeRouter.accessGuard.value;
|
|
7206
|
+
return guard.isAuthorised(d);
|
|
7207
|
+
}, { dependsOn: placeRouter.accessGuard });
|
|
7151
7208
|
_this.commandFactory = pectin.Command.createFactory(function (placeDefinition) {
|
|
7152
7209
|
_this.placeOutlet.navigate(new Visit(placeDefinition));
|
|
7153
7210
|
});
|
|
@@ -7181,7 +7238,7 @@
|
|
|
7181
7238
|
},] }
|
|
7182
7239
|
];
|
|
7183
7240
|
AbstractPlaceNavigationComponent.ctorParameters = function () { return [
|
|
7184
|
-
{ type:
|
|
7241
|
+
{ type: PlaceRouter }
|
|
7185
7242
|
]; };
|
|
7186
7243
|
AbstractPlaceNavigationComponent.propDecorators = {
|
|
7187
7244
|
places: [{ type: i0.Input }],
|
|
@@ -7258,8 +7315,8 @@
|
|
|
7258
7315
|
|
|
7259
7316
|
var ListPlaceNavComponent = /** @class */ (function (_super) {
|
|
7260
7317
|
__extends(ListPlaceNavComponent, _super);
|
|
7261
|
-
function ListPlaceNavComponent(
|
|
7262
|
-
return _super.call(this,
|
|
7318
|
+
function ListPlaceNavComponent(router) {
|
|
7319
|
+
return _super.call(this, router) || this;
|
|
7263
7320
|
}
|
|
7264
7321
|
return ListPlaceNavComponent;
|
|
7265
7322
|
}(AbstractPlaceNavigationComponent));
|
|
@@ -7271,7 +7328,7 @@
|
|
|
7271
7328
|
},] }
|
|
7272
7329
|
];
|
|
7273
7330
|
ListPlaceNavComponent.ctorParameters = function () { return [
|
|
7274
|
-
{ type:
|
|
7331
|
+
{ type: PlaceRouter }
|
|
7275
7332
|
]; };
|
|
7276
7333
|
|
|
7277
7334
|
/**
|
|
@@ -7318,9 +7375,8 @@
|
|
|
7318
7375
|
*/
|
|
7319
7376
|
var SidePlaceNavigationComponent = /** @class */ (function (_super) {
|
|
7320
7377
|
__extends(SidePlaceNavigationComponent, _super);
|
|
7321
|
-
function SidePlaceNavigationComponent(router
|
|
7322
|
-
var _this = _super.call(this,
|
|
7323
|
-
_this.router = router;
|
|
7378
|
+
function SidePlaceNavigationComponent(router) {
|
|
7379
|
+
var _this = _super.call(this, router) || this;
|
|
7324
7380
|
_this.expanded = false;
|
|
7325
7381
|
return _this;
|
|
7326
7382
|
}
|
|
@@ -7343,8 +7399,7 @@
|
|
|
7343
7399
|
},] }
|
|
7344
7400
|
];
|
|
7345
7401
|
SidePlaceNavigationComponent.ctorParameters = function () { return [
|
|
7346
|
-
{ type:
|
|
7347
|
-
{ type: undefined, decorators: [{ type: i0.Inject, args: [PLACE_AUTH_SERVICE,] }] }
|
|
7402
|
+
{ type: PlaceRouter }
|
|
7348
7403
|
]; };
|
|
7349
7404
|
SidePlaceNavigationComponent.propDecorators = {
|
|
7350
7405
|
expanded: [{ type: i0.HostBinding, args: ['class.expanded',] }],
|
|
@@ -7353,8 +7408,8 @@
|
|
|
7353
7408
|
|
|
7354
7409
|
var TabbedPlaceNavigationComponent = /** @class */ (function (_super) {
|
|
7355
7410
|
__extends(TabbedPlaceNavigationComponent, _super);
|
|
7356
|
-
function TabbedPlaceNavigationComponent(
|
|
7357
|
-
return _super.call(this,
|
|
7411
|
+
function TabbedPlaceNavigationComponent(router) {
|
|
7412
|
+
return _super.call(this, router) || this;
|
|
7358
7413
|
}
|
|
7359
7414
|
return TabbedPlaceNavigationComponent;
|
|
7360
7415
|
}(AbstractPlaceNavigationComponent));
|
|
@@ -7366,7 +7421,7 @@
|
|
|
7366
7421
|
},] }
|
|
7367
7422
|
];
|
|
7368
7423
|
TabbedPlaceNavigationComponent.ctorParameters = function () { return [
|
|
7369
|
-
{ type:
|
|
7424
|
+
{ type: PlaceRouter }
|
|
7370
7425
|
]; };
|
|
7371
7426
|
|
|
7372
7427
|
var PlaceModule = /** @class */ (function () {
|
|
@@ -7719,12 +7774,11 @@
|
|
|
7719
7774
|
}());
|
|
7720
7775
|
|
|
7721
7776
|
var PlaceGuard = /** @class */ (function () {
|
|
7722
|
-
function PlaceGuard(router, urlService, placeRouter, placeHistory,
|
|
7777
|
+
function PlaceGuard(router, urlService, placeRouter, placeHistory, interactionService, injector) {
|
|
7723
7778
|
this.router = router;
|
|
7724
7779
|
this.urlService = urlService;
|
|
7725
7780
|
this.placeRouter = placeRouter;
|
|
7726
7781
|
this.placeHistory = placeHistory;
|
|
7727
|
-
this.placeAuthService = placeAuthService;
|
|
7728
7782
|
this.interactionService = interactionService;
|
|
7729
7783
|
this.injector = injector;
|
|
7730
7784
|
}
|
|
@@ -7739,20 +7793,20 @@
|
|
|
7739
7793
|
if (!exports.PlaceComponent.isPlaceComponentConstructor(activatedRoute.component)) return [3 /*break*/, 4];
|
|
7740
7794
|
placeDefinition_1 = exports.PlaceComponent.getDefinition(activatedRoute.component);
|
|
7741
7795
|
if (!placeDefinition_1.authenticate) return [3 /*break*/, 2];
|
|
7742
|
-
return [4 /*yield*/, this.
|
|
7796
|
+
return [4 /*yield*/, this.placeRouter.accessGuard.value.isAuthenticated()];
|
|
7743
7797
|
case 1:
|
|
7744
7798
|
if (!(_a.sent())) {
|
|
7745
|
-
redirectLocation = this.
|
|
7799
|
+
redirectLocation = this.placeRouter.getAuthenticationFailureRedirect(activatedRoute, state);
|
|
7746
7800
|
nextPlaceDef = this.getPlaceDefinition(redirectLocation);
|
|
7747
7801
|
if (nextPlaceDef.authenticate) {
|
|
7748
7802
|
pectin.lang.illegalState("handleNotAuthenticated hook returned place " + nextPlaceDef.component.name + " that requires authentication.");
|
|
7749
7803
|
}
|
|
7750
7804
|
return [2 /*return*/, this.createUrlTree(redirectLocation)];
|
|
7751
7805
|
}
|
|
7752
|
-
if (!this.
|
|
7753
|
-
redirectLocation = this.
|
|
7806
|
+
if (!(this.placeRouter.accessGuard.value ? this.placeRouter.accessGuard.value.isAuthorised(placeDefinition_1) : true)) {
|
|
7807
|
+
redirectLocation = this.placeRouter.getAuthorisationFailureRedirect(activatedRoute, state);
|
|
7754
7808
|
nextPlaceDef = this.getPlaceDefinition(redirectLocation);
|
|
7755
|
-
if (!this.
|
|
7809
|
+
if (!(this.placeRouter.accessGuard.value ? this.placeRouter.accessGuard.value.isAuthorised(nextPlaceDef) : true)) {
|
|
7756
7810
|
pectin.lang.illegalState("handleNotAuthorised hook returned place " + nextPlaceDef.component.name + " that is not authorised for the current user.");
|
|
7757
7811
|
}
|
|
7758
7812
|
return [2 /*return*/, this.createUrlTree(redirectLocation)];
|
|
@@ -7860,7 +7914,7 @@
|
|
|
7860
7914
|
};
|
|
7861
7915
|
return PlaceGuard;
|
|
7862
7916
|
}());
|
|
7863
|
-
PlaceGuard.ɵprov = i0.ɵɵdefineInjectable({ factory: function PlaceGuard_Factory() { return new PlaceGuard(i0.ɵɵinject(i1$1.Router), i0.ɵɵinject(UrlService), i0.ɵɵinject(PlaceRouter), i0.ɵɵinject(exports.PlaceHistory), i0.ɵɵinject(
|
|
7917
|
+
PlaceGuard.ɵprov = i0.ɵɵdefineInjectable({ factory: function PlaceGuard_Factory() { return new PlaceGuard(i0.ɵɵinject(i1$1.Router), i0.ɵɵinject(UrlService), i0.ɵɵinject(PlaceRouter), i0.ɵɵinject(exports.PlaceHistory), i0.ɵɵinject(exports.InteractionService), i0.ɵɵinject(i0.INJECTOR)); }, token: PlaceGuard, providedIn: "root" });
|
|
7864
7918
|
PlaceGuard.decorators = [
|
|
7865
7919
|
{ type: i0.Injectable, args: [{ providedIn: 'root' },] }
|
|
7866
7920
|
];
|
|
@@ -7869,7 +7923,6 @@
|
|
|
7869
7923
|
{ type: UrlService },
|
|
7870
7924
|
{ type: PlaceRouter },
|
|
7871
7925
|
{ type: exports.PlaceHistory },
|
|
7872
|
-
{ type: undefined, decorators: [{ type: i0.Inject, args: [PLACE_AUTH_SERVICE,] }] },
|
|
7873
7926
|
{ type: exports.InteractionService },
|
|
7874
7927
|
{ type: i0.Injector }
|
|
7875
7928
|
]; };
|
|
@@ -8059,7 +8112,6 @@
|
|
|
8059
8112
|
exports.NoopAuthGuard = NoopAuthGuard;
|
|
8060
8113
|
exports.NoopComponent = NoopComponent;
|
|
8061
8114
|
exports.NumberInputComponent = NumberInputComponent;
|
|
8062
|
-
exports.PLACE_AUTH_SERVICE = PLACE_AUTH_SERVICE;
|
|
8063
8115
|
exports.POPUP_CONTAINER = POPUP_CONTAINER;
|
|
8064
8116
|
exports.PORTAL_EDITOR_COMPONENT = PORTAL_EDITOR_COMPONENT;
|
|
8065
8117
|
exports.PORTAL_RENDERER_COMPONENT = PORTAL_RENDERER_COMPONENT;
|