@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
|
@@ -21,13 +21,13 @@ import { fas } from '@fortawesome/free-solid-svg-icons';
|
|
|
21
21
|
import { GarbageCollector, DelegatingValueModel, assert, UnaryCommand, lang, Dsl, Logger, TrackExternal, Command, ValueModel, StoreInValueModel, MutableListModel, Disposable, DelegatingListModel, StoreInListModel, MutableValueModel, FocusManager, EventListenerList, Form, Guard, Binding, DebugContext, ListModel, MultipleSelectionModel, DirtyTrackingForm, DelegatingCommand, Deferred, Trace, Functions } from '@coolon/pectin';
|
|
22
22
|
import { __decorate, __metadata, __awaiter } from 'tslib';
|
|
23
23
|
import { Memoize } from '@typescript-plus/fast-memoize-decorator/dist/src';
|
|
24
|
-
import _, {
|
|
24
|
+
import _, { isEqual, isNil } from 'lodash';
|
|
25
25
|
import { Enum } from 'typescript-string-enums';
|
|
26
26
|
import { assert as assert$1, Opts, lang as lang$1, Klass } from '@coolon/typescript-utilities';
|
|
27
27
|
import produce from 'immer';
|
|
28
28
|
import { FlexModule, GridModule } from '@angular/flex-layout';
|
|
29
29
|
import { MatDialogModule, MatDialog, MAT_DIALOG_DEFAULT_OPTIONS, MatDialogConfig } from '@angular/material/dialog';
|
|
30
|
-
import { RouterModule, ActivatedRouteSnapshot, NavigationStart, NavigationCancel, UrlSegment, Router, UrlSerializer, NavigationEnd, NavigationError
|
|
30
|
+
import { RouterModule, ActivatedRouteSnapshot, NavigationStart, NavigationCancel, UrlSegment, Router, UrlSerializer, NavigationEnd, NavigationError } from '@angular/router';
|
|
31
31
|
import { Overlay, CdkScrollable } from '@angular/cdk/overlay';
|
|
32
32
|
import ResizeObserver from 'resize-observer-polyfill';
|
|
33
33
|
import { MatListModule } from '@angular/material/list';
|
|
@@ -2118,6 +2118,14 @@ class PropertyColumnModel extends ColumnModel {
|
|
|
2118
2118
|
}));
|
|
2119
2119
|
return this;
|
|
2120
2120
|
}
|
|
2121
|
+
liveEditCellRenderer(componentType, options) {
|
|
2122
|
+
return this.mutableCellRenderer(componentType, options);
|
|
2123
|
+
}
|
|
2124
|
+
/**
|
|
2125
|
+
* Deprecated. Use #liveEditCellRenderer instead.
|
|
2126
|
+
* @param componentType
|
|
2127
|
+
* @param options
|
|
2128
|
+
*/
|
|
2121
2129
|
mutableCellRenderer(componentType, options) {
|
|
2122
2130
|
this.configureCellRenderer(new ComponentCellRendererPortalRef(componentType, (component, rowData, firstTime) => {
|
|
2123
2131
|
// keep a local copy most recent row value so it's available to teh
|
|
@@ -2580,7 +2588,7 @@ TableComponent.decorators = [
|
|
|
2580
2588
|
{ type: Component, args: [{
|
|
2581
2589
|
selector: 'aup-table',
|
|
2582
2590
|
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",
|
|
2583
|
-
styles: [":host{align-items:stretch;display:flex;flex-direction:column}:host table{flex:1}"]
|
|
2591
|
+
styles: [":host{align-items:stretch;display:flex;flex-direction:column}:host table{flex:1;width:100%}"]
|
|
2584
2592
|
},] }
|
|
2585
2593
|
];
|
|
2586
2594
|
TableComponent.ctorParameters = () => [];
|
|
@@ -4192,8 +4200,6 @@ InteractionModule.decorators = [
|
|
|
4192
4200
|
},] }
|
|
4193
4201
|
];
|
|
4194
4202
|
|
|
4195
|
-
const PLACE_AUTH_SERVICE = new InjectionToken("PlaceAuthService");
|
|
4196
|
-
|
|
4197
4203
|
class ParameterDefinition {
|
|
4198
4204
|
constructor(propertyName, options, urlFormat) {
|
|
4199
4205
|
this.propertyName = propertyName;
|
|
@@ -4522,72 +4528,6 @@ __decorate([
|
|
|
4522
4528
|
PlaceComponent.injectDefinition = injectDefinition;
|
|
4523
4529
|
})(PlaceComponent || (PlaceComponent = {}));
|
|
4524
4530
|
|
|
4525
|
-
class Visit {
|
|
4526
|
-
constructor(placeDefinition, visitParameters = {}) {
|
|
4527
|
-
this.placeDefinition = placeDefinition;
|
|
4528
|
-
this.visitParameters = visitParameters;
|
|
4529
|
-
}
|
|
4530
|
-
// @Trace()
|
|
4531
|
-
getRouteId() {
|
|
4532
|
-
return this.placeDefinition.getRouteIdFrom(this);
|
|
4533
|
-
}
|
|
4534
|
-
// @Trace()
|
|
4535
|
-
hasRouteId() {
|
|
4536
|
-
return !isNil(this.getRouteId());
|
|
4537
|
-
}
|
|
4538
|
-
/**
|
|
4539
|
-
* Returns the value of the place parameter with the specified name. The parameter
|
|
4540
|
-
* name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
|
|
4541
|
-
* same as the the ValueModel property name.
|
|
4542
|
-
* @param parameterName the field name of the property model or the `as` option if specified.
|
|
4543
|
-
*/
|
|
4544
|
-
getParameter(parameterName) {
|
|
4545
|
-
return this.visitParameters[parameterName];
|
|
4546
|
-
}
|
|
4547
|
-
// @Trace()
|
|
4548
|
-
hasParameter(parameterName) {
|
|
4549
|
-
return Object.keys(this.visitParameters).includes(parameterName);
|
|
4550
|
-
}
|
|
4551
|
-
replace(parameter, value) {
|
|
4552
|
-
return new Visit(this.placeDefinition, Object.assign(Object.assign({}, this.visitParameters), { [parameter.name]: value }));
|
|
4553
|
-
}
|
|
4554
|
-
mergeRouteParameters(routeParams) {
|
|
4555
|
-
// todo: whitelist parameters.
|
|
4556
|
-
const routeParameterKeys = Object.keys(routeParams);
|
|
4557
|
-
const params = {};
|
|
4558
|
-
this.placeDefinition.getVisitParameterDefs().forEach(def => {
|
|
4559
|
-
if (def.isRouteId || def.isRouteParameter) {
|
|
4560
|
-
if (routeParameterKeys.includes(def.name)) {
|
|
4561
|
-
params[def.name] = routeParams[def.name];
|
|
4562
|
-
}
|
|
4563
|
-
}
|
|
4564
|
-
else {
|
|
4565
|
-
// copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the
|
|
4566
|
-
// defaults and remember sanitisation process.
|
|
4567
|
-
const value = this.getParameter(def.name);
|
|
4568
|
-
if (this.hasParameter(def.name)) {
|
|
4569
|
-
params[def.name] = value;
|
|
4570
|
-
}
|
|
4571
|
-
}
|
|
4572
|
-
});
|
|
4573
|
-
return new Visit(this.placeDefinition, params);
|
|
4574
|
-
}
|
|
4575
|
-
hasRoutingChangedFrom(other) {
|
|
4576
|
-
const samePlace = other.placeDefinition === this.placeDefinition;
|
|
4577
|
-
const sameRouteParameters = isEqual(this.placeDefinition.getFormattedRouteParameters(this, true), this.placeDefinition.getFormattedRouteParameters(other, true));
|
|
4578
|
-
return !samePlace || !sameRouteParameters;
|
|
4579
|
-
}
|
|
4580
|
-
hasChangedFrom(other) {
|
|
4581
|
-
const sameNonRouteParameters = isEqual(this.placeDefinition.getNonRouteParameters(this), this.placeDefinition.getNonRouteParameters(other));
|
|
4582
|
-
return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);
|
|
4583
|
-
}
|
|
4584
|
-
toDebugString() {
|
|
4585
|
-
return Object.keys(this.visitParameters).map(k => `${k}=${this.visitParameters[k]}`).join(",");
|
|
4586
|
-
}
|
|
4587
|
-
}
|
|
4588
|
-
|
|
4589
|
-
const AUP_PLACE_CONFIG = new InjectionToken('AUP_PLACE_CONFIG');
|
|
4590
|
-
|
|
4591
4531
|
/**
|
|
4592
4532
|
* This class handles the logic around canDeactivate for a given router state transition. It's core responsibilities are:
|
|
4593
4533
|
* 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.)
|
|
@@ -4761,14 +4701,14 @@ class NavigationSession extends GarbageCollector {
|
|
|
4761
4701
|
// Important: I tried to perform this fix at a later point int he routing cycle but it created all kinds of
|
|
4762
4702
|
// strangeness.
|
|
4763
4703
|
Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
|
|
4764
|
-
console.log(`replacing ${this.urlService.getCurrentLocationUrlSnapshot().url} with ${poppedHistoryToReplace}`);
|
|
4704
|
+
// console.log(`replacing ${this.urlService.getCurrentLocationUrlSnapshot().url} with ${poppedHistoryToReplace}`);
|
|
4765
4705
|
this.urlService.resetBrowserLocation(poppedHistoryToReplace, { replaceCurrent: true });
|
|
4766
|
-
console.log(`pushing ${activeUrl} back onto the history.`);
|
|
4706
|
+
// console.log(`pushing ${activeUrl} back onto the history.`);
|
|
4767
4707
|
this.urlService.resetBrowserLocation(activeUrl, { replaceCurrent: false });
|
|
4768
4708
|
}
|
|
4769
4709
|
ignore(event, reason) {
|
|
4770
4710
|
reason = reason ? ` -> ${reason}` : '';
|
|
4771
|
-
Logger.get(this).info(`Ignoring router event${reason}: ${event.constructor.name} -> ${event.url} :: ${this.toString()}`);
|
|
4711
|
+
// Logger.get(this).info(`Ignoring router event${reason}: ${event.constructor.name} -> ${event.url} :: ${this.toString()}`);
|
|
4772
4712
|
}
|
|
4773
4713
|
toString() {
|
|
4774
4714
|
return `${this.constructor.name}(${this.debugState()})`;
|
|
@@ -5357,6 +5297,31 @@ class PopStateNavigation extends AbstractPopStateNavigation {
|
|
|
5357
5297
|
}
|
|
5358
5298
|
}
|
|
5359
5299
|
|
|
5300
|
+
var PlaceAccessGuard;
|
|
5301
|
+
(function (PlaceAccessGuard) {
|
|
5302
|
+
class NoAuth {
|
|
5303
|
+
isAuthenticated() {
|
|
5304
|
+
return true;
|
|
5305
|
+
}
|
|
5306
|
+
isAuthorised(placeDefinition) {
|
|
5307
|
+
return true;
|
|
5308
|
+
}
|
|
5309
|
+
}
|
|
5310
|
+
__decorate([
|
|
5311
|
+
Trace(),
|
|
5312
|
+
__metadata("design:type", Function),
|
|
5313
|
+
__metadata("design:paramtypes", []),
|
|
5314
|
+
__metadata("design:returntype", Object)
|
|
5315
|
+
], NoAuth.prototype, "isAuthenticated", null);
|
|
5316
|
+
__decorate([
|
|
5317
|
+
Trace(),
|
|
5318
|
+
__metadata("design:type", Function),
|
|
5319
|
+
__metadata("design:paramtypes", [PlaceDefinition]),
|
|
5320
|
+
__metadata("design:returntype", Boolean)
|
|
5321
|
+
], NoAuth.prototype, "isAuthorised", null);
|
|
5322
|
+
PlaceAccessGuard.NoAuth = NoAuth;
|
|
5323
|
+
})(PlaceAccessGuard || (PlaceAccessGuard = {}));
|
|
5324
|
+
|
|
5360
5325
|
class PlaceHistory {
|
|
5361
5326
|
constructor() {
|
|
5362
5327
|
this._archive = new Map();
|
|
@@ -5656,6 +5621,11 @@ class PlaceRouter extends GarbageCollector {
|
|
|
5656
5621
|
this.navigationSessionModel = new MutableValueModel();
|
|
5657
5622
|
this._activeVisits = new MutableListModel();
|
|
5658
5623
|
this.sessionFinishedJobs = [];
|
|
5624
|
+
/**
|
|
5625
|
+
* An observable model containing the authoriser function. This allows places to react to changes
|
|
5626
|
+
* in permissions when any underlying auth logic changes, e.g. a role being removed from a user.
|
|
5627
|
+
*/
|
|
5628
|
+
this._accessGuard = new DelegatingValueModel().withDefault(new PlaceAccessGuard.NoAuth());
|
|
5659
5629
|
if (window['Cypress']) {
|
|
5660
5630
|
window['aup.PlaceRouter'] = this;
|
|
5661
5631
|
}
|
|
@@ -5714,6 +5684,29 @@ class PlaceRouter extends GarbageCollector {
|
|
|
5714
5684
|
// the back button was clicked.
|
|
5715
5685
|
angularLocation.onUrlChange(url => this.onUrlChanged(url));
|
|
5716
5686
|
}
|
|
5687
|
+
get accessGuard() {
|
|
5688
|
+
return this._accessGuard.readonly;
|
|
5689
|
+
}
|
|
5690
|
+
// @Trace()
|
|
5691
|
+
configureAuth(accessGrant, redirections) {
|
|
5692
|
+
// We need a shitty mutable model until setDelegate is clever enough to work with readonly models.
|
|
5693
|
+
const hackyMutableModel = new MutableValueModel();
|
|
5694
|
+
const binding = new Binding(hackyMutableModel, accessGrant, {
|
|
5695
|
+
toRight(leftValue) {
|
|
5696
|
+
return lang.illegalState('hackyMutableModel is read only');
|
|
5697
|
+
},
|
|
5698
|
+
toLeft: (rightValue) => rightValue
|
|
5699
|
+
});
|
|
5700
|
+
binding.writeLeft();
|
|
5701
|
+
this._accessGuard.setDelegate(hackyMutableModel);
|
|
5702
|
+
this.redirections = redirections;
|
|
5703
|
+
}
|
|
5704
|
+
getAuthenticationFailureRedirect(activatedRoute, state) {
|
|
5705
|
+
return this.redirections.onAuthenticationFailure(activatedRoute, state);
|
|
5706
|
+
}
|
|
5707
|
+
getAuthorisationFailureRedirect(activatedRoute, state) {
|
|
5708
|
+
return this.redirections.onAuthorisationFailure(activatedRoute, state);
|
|
5709
|
+
}
|
|
5717
5710
|
get navigationSession() {
|
|
5718
5711
|
return this.navigationSessionModel.value;
|
|
5719
5712
|
}
|
|
@@ -5839,7 +5832,7 @@ class PlaceRouter extends GarbageCollector {
|
|
|
5839
5832
|
this.placeHistory.notifyNavigationStarted();
|
|
5840
5833
|
}
|
|
5841
5834
|
assert.isTruthy(next !== previous);
|
|
5842
|
-
Logger.get(this).info(`### Router State Transition: ${previous ? previous.toString() : 'null'} -> ${next.toString()}`);
|
|
5835
|
+
// Logger.get(this).info(`### Router State Transition: ${previous ? previous.toString() : 'null'} -> ${next.toString()}`);
|
|
5843
5836
|
this.navigationSessionModel.value = next;
|
|
5844
5837
|
if (!!previous) {
|
|
5845
5838
|
previous.dispose();
|
|
@@ -5859,7 +5852,7 @@ class PlaceRouter extends GarbageCollector {
|
|
|
5859
5852
|
const session = this.currentSession;
|
|
5860
5853
|
session.dispose();
|
|
5861
5854
|
this.navigationSessionModel.value = null;
|
|
5862
|
-
console.log(`### Router Session Finished (was ${session.toString()})`);
|
|
5855
|
+
// console.log(`### Router Session Finished (was ${session.toString()})`);
|
|
5863
5856
|
this.sessionFinishedJobs.forEach(job => job());
|
|
5864
5857
|
this.sessionFinishedJobs = [];
|
|
5865
5858
|
}
|
|
@@ -5915,6 +5908,72 @@ PlaceRouter.ctorParameters = () => [
|
|
|
5915
5908
|
{ type: PlaceHistory }
|
|
5916
5909
|
];
|
|
5917
5910
|
|
|
5911
|
+
class Visit {
|
|
5912
|
+
constructor(placeDefinition, visitParameters = {}) {
|
|
5913
|
+
this.placeDefinition = placeDefinition;
|
|
5914
|
+
this.visitParameters = visitParameters;
|
|
5915
|
+
}
|
|
5916
|
+
// @Trace()
|
|
5917
|
+
getRouteId() {
|
|
5918
|
+
return this.placeDefinition.getRouteIdFrom(this);
|
|
5919
|
+
}
|
|
5920
|
+
// @Trace()
|
|
5921
|
+
hasRouteId() {
|
|
5922
|
+
return !isNil(this.getRouteId());
|
|
5923
|
+
}
|
|
5924
|
+
/**
|
|
5925
|
+
* Returns the value of the place parameter with the specified name. The parameter
|
|
5926
|
+
* name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
|
|
5927
|
+
* same as the the ValueModel property name.
|
|
5928
|
+
* @param parameterName the field name of the property model or the `as` option if specified.
|
|
5929
|
+
*/
|
|
5930
|
+
getParameter(parameterName) {
|
|
5931
|
+
return this.visitParameters[parameterName];
|
|
5932
|
+
}
|
|
5933
|
+
// @Trace()
|
|
5934
|
+
hasParameter(parameterName) {
|
|
5935
|
+
return Object.keys(this.visitParameters).includes(parameterName);
|
|
5936
|
+
}
|
|
5937
|
+
replace(parameter, value) {
|
|
5938
|
+
return new Visit(this.placeDefinition, Object.assign(Object.assign({}, this.visitParameters), { [parameter.name]: value }));
|
|
5939
|
+
}
|
|
5940
|
+
mergeRouteParameters(routeParams) {
|
|
5941
|
+
// todo: whitelist parameters.
|
|
5942
|
+
const routeParameterKeys = Object.keys(routeParams);
|
|
5943
|
+
const params = {};
|
|
5944
|
+
this.placeDefinition.getVisitParameterDefs().forEach(def => {
|
|
5945
|
+
if (def.isRouteId || def.isRouteParameter) {
|
|
5946
|
+
if (routeParameterKeys.includes(def.name)) {
|
|
5947
|
+
params[def.name] = routeParams[def.name];
|
|
5948
|
+
}
|
|
5949
|
+
}
|
|
5950
|
+
else {
|
|
5951
|
+
// copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the
|
|
5952
|
+
// defaults and remember sanitisation process.
|
|
5953
|
+
const value = this.getParameter(def.name);
|
|
5954
|
+
if (this.hasParameter(def.name)) {
|
|
5955
|
+
params[def.name] = value;
|
|
5956
|
+
}
|
|
5957
|
+
}
|
|
5958
|
+
});
|
|
5959
|
+
return new Visit(this.placeDefinition, params);
|
|
5960
|
+
}
|
|
5961
|
+
hasRoutingChangedFrom(other) {
|
|
5962
|
+
const samePlace = other.placeDefinition === this.placeDefinition;
|
|
5963
|
+
const sameRouteParameters = isEqual(this.placeDefinition.getFormattedRouteParameters(this, true), this.placeDefinition.getFormattedRouteParameters(other, true));
|
|
5964
|
+
return !samePlace || !sameRouteParameters;
|
|
5965
|
+
}
|
|
5966
|
+
hasChangedFrom(other) {
|
|
5967
|
+
const sameNonRouteParameters = isEqual(this.placeDefinition.getNonRouteParameters(this), this.placeDefinition.getNonRouteParameters(other));
|
|
5968
|
+
return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);
|
|
5969
|
+
}
|
|
5970
|
+
toDebugString() {
|
|
5971
|
+
return Object.keys(this.visitParameters).map(k => `${k}=${this.visitParameters[k]}`).join(',');
|
|
5972
|
+
}
|
|
5973
|
+
}
|
|
5974
|
+
|
|
5975
|
+
const AUP_PLACE_CONFIG = new InjectionToken('AUP_PLACE_CONFIG');
|
|
5976
|
+
|
|
5918
5977
|
// Freezes the state of the components at the start of the animation.
|
|
5919
5978
|
const animationStartStyle = style({ position: 'absolute', top: '0', left: '0', bottom: '0', right: '0' });
|
|
5920
5979
|
const left = [
|
|
@@ -5960,11 +6019,10 @@ function leftRightPlaceAnimation(duration) {
|
|
|
5960
6019
|
const LEFT_RIGHT_PLACE_ANIMATION = leftRightPlaceAnimation('0.3s');
|
|
5961
6020
|
|
|
5962
6021
|
class PlaceOutletComponent extends DisposableComponent {
|
|
5963
|
-
constructor(router, placeRouter,
|
|
6022
|
+
constructor(router, placeRouter, placeConfig, parentOutlet) {
|
|
5964
6023
|
super();
|
|
5965
6024
|
this.router = router;
|
|
5966
6025
|
this.placeRouter = placeRouter;
|
|
5967
|
-
this.placeAuthService = placeAuthService;
|
|
5968
6026
|
this.placeConfig = placeConfig;
|
|
5969
6027
|
this.placeChanged = new EventEmitter();
|
|
5970
6028
|
this.outletActivated = new MutableValueModel(false);
|
|
@@ -6009,11 +6067,11 @@ class PlaceOutletComponent extends DisposableComponent {
|
|
|
6009
6067
|
chain(this._activePlaceModel)
|
|
6010
6068
|
.postponeWhile(this.navigationInProgress)
|
|
6011
6069
|
.subscribe(place => this.placeChanged.emit(place));
|
|
6012
|
-
when(
|
|
6070
|
+
when(placeRouter.accessGuard).changes(guard => {
|
|
6013
6071
|
const activePlace = this._activePlaceModel.value;
|
|
6014
|
-
if (activePlace && !isAuthorised(activePlace.placeDefinition)) {
|
|
6015
|
-
const
|
|
6016
|
-
this.placeRouter.navigate(
|
|
6072
|
+
if (activePlace && !guard.isAuthorised(activePlace.placeDefinition)) {
|
|
6073
|
+
const visit = placeRouter.getAuthorisationFailureRedirect(this._activatedRouteModel.value.snapshot, this.router.routerState.snapshot);
|
|
6074
|
+
this.placeRouter.navigate(visit);
|
|
6017
6075
|
}
|
|
6018
6076
|
});
|
|
6019
6077
|
}
|
|
@@ -6046,6 +6104,7 @@ class PlaceOutletComponent extends DisposableComponent {
|
|
|
6046
6104
|
get activatedRouteModel() {
|
|
6047
6105
|
return this._activatedRouteModel.readonly;
|
|
6048
6106
|
}
|
|
6107
|
+
// @Trace()
|
|
6049
6108
|
onOutletActivated(routerOutlet, place) {
|
|
6050
6109
|
this._activatedRouteModel.value = routerOutlet.activatedRoute;
|
|
6051
6110
|
this._activePlaceModel.value = place;
|
|
@@ -6065,6 +6124,7 @@ class PlaceOutletComponent extends DisposableComponent {
|
|
|
6065
6124
|
}
|
|
6066
6125
|
}
|
|
6067
6126
|
}
|
|
6127
|
+
// @Trace()
|
|
6068
6128
|
onOutletDeactivated() {
|
|
6069
6129
|
this.outletActivated.value = false;
|
|
6070
6130
|
this._activePlaceModel.value = null;
|
|
@@ -6137,7 +6197,6 @@ PlaceOutletComponent.decorators = [
|
|
|
6137
6197
|
PlaceOutletComponent.ctorParameters = () => [
|
|
6138
6198
|
{ type: Router },
|
|
6139
6199
|
{ type: PlaceRouter },
|
|
6140
|
-
{ type: undefined, decorators: [{ type: Inject, args: [PLACE_AUTH_SERVICE,] }] },
|
|
6141
6200
|
{ type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [AUP_PLACE_CONFIG,] }] },
|
|
6142
6201
|
{ type: PlaceOutletComponent, decorators: [{ type: SkipSelf }, { type: Optional }] }
|
|
6143
6202
|
];
|
|
@@ -6165,27 +6224,19 @@ __decorate([
|
|
|
6165
6224
|
StoreInListModel('customPlaceAnimationOrderModel'),
|
|
6166
6225
|
__metadata("design:type", Array)
|
|
6167
6226
|
], PlaceOutletComponent.prototype, "customPlaceAnimationOrder", void 0);
|
|
6168
|
-
__decorate([
|
|
6169
|
-
Trace(),
|
|
6170
|
-
__metadata("design:type", Function),
|
|
6171
|
-
__metadata("design:paramtypes", [RouterOutlet, PlaceComponent]),
|
|
6172
|
-
__metadata("design:returntype", void 0)
|
|
6173
|
-
], PlaceOutletComponent.prototype, "onOutletActivated", null);
|
|
6174
|
-
__decorate([
|
|
6175
|
-
Trace(),
|
|
6176
|
-
__metadata("design:type", Function),
|
|
6177
|
-
__metadata("design:paramtypes", []),
|
|
6178
|
-
__metadata("design:returntype", void 0)
|
|
6179
|
-
], PlaceOutletComponent.prototype, "onOutletDeactivated", null);
|
|
6180
6227
|
|
|
6181
6228
|
class AbstractPlaceNavigationComponent extends DisposableComponent {
|
|
6182
|
-
constructor(
|
|
6229
|
+
constructor(placeRouter) {
|
|
6183
6230
|
super();
|
|
6231
|
+
this.placeRouter = placeRouter;
|
|
6184
6232
|
this._activePlaceComponent = new DelegatingValueModel();
|
|
6185
6233
|
const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
|
|
6186
6234
|
this.placeDefinitions = chain(this.placesModel)
|
|
6187
6235
|
.map(c => PlaceComponent.getDefinition(c))
|
|
6188
|
-
.select(d =>
|
|
6236
|
+
.select(d => {
|
|
6237
|
+
const guard = placeRouter.accessGuard.value;
|
|
6238
|
+
return guard.isAuthorised(d);
|
|
6239
|
+
}, { dependsOn: placeRouter.accessGuard });
|
|
6189
6240
|
this.commandFactory = Command.createFactory((placeDefinition) => {
|
|
6190
6241
|
this.placeOutlet.navigate(new Visit(placeDefinition));
|
|
6191
6242
|
});
|
|
@@ -6217,7 +6268,7 @@ AbstractPlaceNavigationComponent.decorators = [
|
|
|
6217
6268
|
},] }
|
|
6218
6269
|
];
|
|
6219
6270
|
AbstractPlaceNavigationComponent.ctorParameters = () => [
|
|
6220
|
-
{ type:
|
|
6271
|
+
{ type: PlaceRouter }
|
|
6221
6272
|
];
|
|
6222
6273
|
AbstractPlaceNavigationComponent.propDecorators = {
|
|
6223
6274
|
places: [{ type: Input }],
|
|
@@ -6295,8 +6346,8 @@ EmptyStateComponent.decorators = [
|
|
|
6295
6346
|
EmptyStateComponent.ctorParameters = () => [];
|
|
6296
6347
|
|
|
6297
6348
|
class ListPlaceNavComponent extends AbstractPlaceNavigationComponent {
|
|
6298
|
-
constructor(
|
|
6299
|
-
super(
|
|
6349
|
+
constructor(router) {
|
|
6350
|
+
super(router);
|
|
6300
6351
|
}
|
|
6301
6352
|
}
|
|
6302
6353
|
ListPlaceNavComponent.decorators = [
|
|
@@ -6307,7 +6358,7 @@ ListPlaceNavComponent.decorators = [
|
|
|
6307
6358
|
},] }
|
|
6308
6359
|
];
|
|
6309
6360
|
ListPlaceNavComponent.ctorParameters = () => [
|
|
6310
|
-
{ type:
|
|
6361
|
+
{ type: PlaceRouter }
|
|
6311
6362
|
];
|
|
6312
6363
|
|
|
6313
6364
|
/**
|
|
@@ -6353,9 +6404,8 @@ ListPlaceNavComponent.ctorParameters = () => [
|
|
|
6353
6404
|
* })
|
|
6354
6405
|
*/
|
|
6355
6406
|
class SidePlaceNavigationComponent extends AbstractPlaceNavigationComponent {
|
|
6356
|
-
constructor(router
|
|
6357
|
-
super(
|
|
6358
|
-
this.router = router;
|
|
6407
|
+
constructor(router) {
|
|
6408
|
+
super(router);
|
|
6359
6409
|
this.expanded = false;
|
|
6360
6410
|
}
|
|
6361
6411
|
expandMenu() {
|
|
@@ -6376,8 +6426,7 @@ SidePlaceNavigationComponent.decorators = [
|
|
|
6376
6426
|
},] }
|
|
6377
6427
|
];
|
|
6378
6428
|
SidePlaceNavigationComponent.ctorParameters = () => [
|
|
6379
|
-
{ type:
|
|
6380
|
-
{ type: undefined, decorators: [{ type: Inject, args: [PLACE_AUTH_SERVICE,] }] }
|
|
6429
|
+
{ type: PlaceRouter }
|
|
6381
6430
|
];
|
|
6382
6431
|
SidePlaceNavigationComponent.propDecorators = {
|
|
6383
6432
|
expanded: [{ type: HostBinding, args: ['class.expanded',] }],
|
|
@@ -6385,8 +6434,8 @@ SidePlaceNavigationComponent.propDecorators = {
|
|
|
6385
6434
|
};
|
|
6386
6435
|
|
|
6387
6436
|
class TabbedPlaceNavigationComponent extends AbstractPlaceNavigationComponent {
|
|
6388
|
-
constructor(
|
|
6389
|
-
super(
|
|
6437
|
+
constructor(router) {
|
|
6438
|
+
super(router);
|
|
6390
6439
|
}
|
|
6391
6440
|
}
|
|
6392
6441
|
TabbedPlaceNavigationComponent.decorators = [
|
|
@@ -6397,7 +6446,7 @@ TabbedPlaceNavigationComponent.decorators = [
|
|
|
6397
6446
|
},] }
|
|
6398
6447
|
];
|
|
6399
6448
|
TabbedPlaceNavigationComponent.ctorParameters = () => [
|
|
6400
|
-
{ type:
|
|
6449
|
+
{ type: PlaceRouter }
|
|
6401
6450
|
];
|
|
6402
6451
|
|
|
6403
6452
|
class PlaceModule {
|
|
@@ -6707,12 +6756,11 @@ class VisitSanitiser {
|
|
|
6707
6756
|
}
|
|
6708
6757
|
|
|
6709
6758
|
class PlaceGuard {
|
|
6710
|
-
constructor(router, urlService, placeRouter, placeHistory,
|
|
6759
|
+
constructor(router, urlService, placeRouter, placeHistory, interactionService, injector) {
|
|
6711
6760
|
this.router = router;
|
|
6712
6761
|
this.urlService = urlService;
|
|
6713
6762
|
this.placeRouter = placeRouter;
|
|
6714
6763
|
this.placeHistory = placeHistory;
|
|
6715
|
-
this.placeAuthService = placeAuthService;
|
|
6716
6764
|
this.interactionService = interactionService;
|
|
6717
6765
|
this.injector = injector;
|
|
6718
6766
|
}
|
|
@@ -6722,18 +6770,18 @@ class PlaceGuard {
|
|
|
6722
6770
|
if (PlaceComponent.isPlaceComponentConstructor(activatedRoute.component)) {
|
|
6723
6771
|
const placeDefinition = PlaceComponent.getDefinition(activatedRoute.component);
|
|
6724
6772
|
if (placeDefinition.authenticate) {
|
|
6725
|
-
if (!(yield this.
|
|
6726
|
-
const redirectLocation = this.
|
|
6773
|
+
if (!(yield this.placeRouter.accessGuard.value.isAuthenticated())) {
|
|
6774
|
+
const redirectLocation = this.placeRouter.getAuthenticationFailureRedirect(activatedRoute, state);
|
|
6727
6775
|
const nextPlaceDef = this.getPlaceDefinition(redirectLocation);
|
|
6728
6776
|
if (nextPlaceDef.authenticate) {
|
|
6729
6777
|
lang.illegalState(`handleNotAuthenticated hook returned place ${nextPlaceDef.component.name} that requires authentication.`);
|
|
6730
6778
|
}
|
|
6731
6779
|
return this.createUrlTree(redirectLocation);
|
|
6732
6780
|
}
|
|
6733
|
-
if (!this.
|
|
6734
|
-
const redirectLocation = this.
|
|
6781
|
+
if (!(this.placeRouter.accessGuard.value ? this.placeRouter.accessGuard.value.isAuthorised(placeDefinition) : true)) {
|
|
6782
|
+
const redirectLocation = this.placeRouter.getAuthorisationFailureRedirect(activatedRoute, state);
|
|
6735
6783
|
const nextPlaceDef = this.getPlaceDefinition(redirectLocation);
|
|
6736
|
-
if (!this.
|
|
6784
|
+
if (!(this.placeRouter.accessGuard.value ? this.placeRouter.accessGuard.value.isAuthorised(nextPlaceDef) : true)) {
|
|
6737
6785
|
lang.illegalState(`handleNotAuthorised hook returned place ${nextPlaceDef.component.name} that is not authorised for the current user.`);
|
|
6738
6786
|
}
|
|
6739
6787
|
return this.createUrlTree(redirectLocation);
|
|
@@ -6820,7 +6868,7 @@ class PlaceGuard {
|
|
|
6820
6868
|
});
|
|
6821
6869
|
}
|
|
6822
6870
|
}
|
|
6823
|
-
PlaceGuard.ɵprov = ɵɵdefineInjectable({ factory: function PlaceGuard_Factory() { return new PlaceGuard(ɵɵinject(Router), ɵɵinject(UrlService), ɵɵinject(PlaceRouter), ɵɵinject(PlaceHistory), ɵɵinject(
|
|
6871
|
+
PlaceGuard.ɵprov = ɵɵdefineInjectable({ factory: function PlaceGuard_Factory() { return new PlaceGuard(ɵɵinject(Router), ɵɵinject(UrlService), ɵɵinject(PlaceRouter), ɵɵinject(PlaceHistory), ɵɵinject(InteractionService), ɵɵinject(INJECTOR)); }, token: PlaceGuard, providedIn: "root" });
|
|
6824
6872
|
PlaceGuard.decorators = [
|
|
6825
6873
|
{ type: Injectable, args: [{ providedIn: 'root' },] }
|
|
6826
6874
|
];
|
|
@@ -6829,7 +6877,6 @@ PlaceGuard.ctorParameters = () => [
|
|
|
6829
6877
|
{ type: UrlService },
|
|
6830
6878
|
{ type: PlaceRouter },
|
|
6831
6879
|
{ type: PlaceHistory },
|
|
6832
|
-
{ type: undefined, decorators: [{ type: Inject, args: [PLACE_AUTH_SERVICE,] }] },
|
|
6833
6880
|
{ type: InteractionService },
|
|
6834
6881
|
{ type: Injector }
|
|
6835
6882
|
];
|
|
@@ -6934,5 +6981,5 @@ function VisitParameterList(options) {
|
|
|
6934
6981
|
* Generated bundle index. Do not edit.
|
|
6935
6982
|
*/
|
|
6936
6983
|
|
|
6937
|
-
export { ACTIVITY_DATA, AUP_PLACE_CONFIG, AbstractInputActivity, AbstractInputComponent, AbstractInteractionContext, AbstractListInputComponent, AbstractPlaceNavigationComponent, AbstractPopStateNavigation, AbstractPopupMenuComponent, AbstractValueInputComponent, Activity, ActivityActionsComponent, ActivityContainerComponent, ActivityOutletComponent, ActivityRef, AddItemInteractionContextComponent, AlertDialogComponent, AngularUiPowerupsModule, AutocompleteInputComponent, Bounds, BusyOverlayComponent, CELL_EDITOR_PORTAL, CELL_RENDERER_PORTAL, CardContainerComponent, CellEditorPortalRef, CellHeaderPortalRef, CellPortalRef, CellRendererPortalRef, CheckboxInputComponent, ColumnModel, ColumnTemplateDirective, CommandComponent, CommandContainer, CommandDirective, CommandFace, CommandFaceComponent, ComponentCellRendererPortalRef, ComponentsModule, ConfirmThenDialogComponent, ConfirmationDialogComponent, ConsolidatedParameterMap, CustomTemplateColumnModel, CustomValueColumnModel, DEFINITION_META_DATA_KEY, DIALOG_INTERACTION_SERVICE_DEFAULTS, DefaultCellRendererComponent, DefaultHeaderCellRendererComponent, DialogInteractionContext, DialogInteractionContextFactory, Dimension, DirectivesModule, DisposableComponent, EditRowControls, EditSession, EditorControlColumnModel, EmptyStateComponent, EventCleanUpSession, FlexComponent, FocusBinding, FocusBindingDirective, FocusBindingFactory, FocusContainerComponent, FocusableComponent, Formatter, HEADER_CELL_RENDERER_PORTAL, IconComponent, InPlaceInteractionContextComponent, InteractionContextTriggerFor, InteractionModule, InteractionService, InteractionServiceRoutingAdapter, LEFT_RIGHT_PLACE_ANIMATION, ListPlaceNavComponent, ListPropertyColumnModel, ModalInteractionContextFactory, MoreMenuComponent, MultipleSelectInputComponent, Navigating, NavigatingDuringInteraction, NavigationContext, NavigationSession, NoopAuthGuard, NoopComponent, NumberInputComponent,
|
|
6984
|
+
export { ACTIVITY_DATA, AUP_PLACE_CONFIG, AbstractInputActivity, AbstractInputComponent, AbstractInteractionContext, AbstractListInputComponent, AbstractPlaceNavigationComponent, AbstractPopStateNavigation, AbstractPopupMenuComponent, AbstractValueInputComponent, Activity, ActivityActionsComponent, ActivityContainerComponent, ActivityOutletComponent, ActivityRef, AddItemInteractionContextComponent, AlertDialogComponent, AngularUiPowerupsModule, AutocompleteInputComponent, Bounds, BusyOverlayComponent, CELL_EDITOR_PORTAL, CELL_RENDERER_PORTAL, CardContainerComponent, CellEditorPortalRef, CellHeaderPortalRef, CellPortalRef, CellRendererPortalRef, CheckboxInputComponent, ColumnModel, ColumnTemplateDirective, CommandComponent, CommandContainer, CommandDirective, CommandFace, CommandFaceComponent, ComponentCellRendererPortalRef, ComponentsModule, ConfirmThenDialogComponent, ConfirmationDialogComponent, ConsolidatedParameterMap, CustomTemplateColumnModel, CustomValueColumnModel, DEFINITION_META_DATA_KEY, DIALOG_INTERACTION_SERVICE_DEFAULTS, DefaultCellRendererComponent, DefaultHeaderCellRendererComponent, DialogInteractionContext, DialogInteractionContextFactory, Dimension, DirectivesModule, DisposableComponent, EditRowControls, EditSession, EditorControlColumnModel, EmptyStateComponent, EventCleanUpSession, FlexComponent, FocusBinding, FocusBindingDirective, FocusBindingFactory, FocusContainerComponent, FocusableComponent, Formatter, HEADER_CELL_RENDERER_PORTAL, IconComponent, InPlaceInteractionContextComponent, InteractionContextTriggerFor, InteractionModule, InteractionService, InteractionServiceRoutingAdapter, LEFT_RIGHT_PLACE_ANIMATION, ListPlaceNavComponent, ListPropertyColumnModel, ModalInteractionContextFactory, MoreMenuComponent, MultipleSelectInputComponent, Navigating, NavigatingDuringInteraction, NavigationContext, NavigationSession, NoopAuthGuard, NoopComponent, NumberInputComponent, POPUP_CONTAINER, PORTAL_EDITOR_COMPONENT, PORTAL_RENDERER_COMPONENT, ParameterDefinition, PasswordInputComponent, Place, PlaceAccessGuard, PlaceComponent, PlaceComponentDeactivationHandler, PlaceDefinition, PlaceGuard, PlaceHistory, PlaceModule, PlaceOutletComponent, PlaceRouter, Point, PopStateDuringInteractionNavigation, PopStateNavigation, PopupAwareComponent, PopupInteractionContextComponent, PopupMenuComponent, PopupMenuRendererComponent, PropertyColumnModel, ROUTE_PARAMETER_LIST_KEY, RemoveLastInteractionFromUrlNavigationSession, ResizeAwareComponent, RouteId, ScrollContainerComponent, SectionHeaderComponent, SelectCellRendererComponent, SelectHeaderCellRendererComponent, SelectInputActivity, SelectInputComponent, SelectionColumnModel, SeparatorComponent, SidePlaceNavigationComponent, StringInputActivity, StringInputComponent, SwitchCaseComponent, SwitchCaseDefaultDirective, SwitchCaseOption, SwitchCaseWhenDirective, SynchroniseInteractionContextIdsWithRoute, TabbedPlaceNavigationComponent, TableCellRendererComponent, TableComponent, TableHeaderCellRendererComponent, TableModel, TableRowMenuComponent, TemplateCellRendererPortalRef, TextInputComponent, ToolBarComponent, TrackBy, UrlService, UrlSnapshot, VerticalFocusContainerComponent, Visit, VisitParameter, VisitParameterList, VisitSanitiser, WaitUntilLeavingInteractionTransitionCancelled, WaitUntilLinkTriggeredNavigationInteractionCancellationTypeDetermined, WaitUntilPopStateDuringCanDeactivateInteractionFinishes, leftRightPlaceAnimation, slideDownOnEnterAnimation, slideRightOnEnterAnimation, ɵ0 };
|
|
6938
6985
|
//# sourceMappingURL=coolon-angular-ui-powerups.js.map
|