@coolon/angular-ui-powerups 3.6.0 → 3.7.0-alpha.0
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 +7 -0
- package/bundles/coolon-angular-ui-powerups-cypress.umd.js +41 -1
- package/bundles/coolon-angular-ui-powerups-cypress.umd.js.map +1 -1
- package/bundles/coolon-angular-ui-powerups-cypress.umd.min.js +1 -1
- package/bundles/coolon-angular-ui-powerups-cypress.umd.min.js.map +1 -1
- package/bundles/coolon-angular-ui-powerups.umd.js +228 -184
- 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/cypress/components/aup-navigation.d.ts +9 -0
- package/cypress/coolon-angular-ui-powerups-cypress.metadata.json +1 -1
- package/cypress/exports.d.ts +1 -0
- package/cypress/package.json +2 -1
- package/cypress/page.d.ts +3 -0
- package/cypress/section.d.ts +5 -0
- package/esm2015/cypress/components/aup-navigation.js +21 -0
- package/esm2015/cypress/components/aup-navigation.js.map +1 -0
- package/esm2015/cypress/components/aup-navigation.metadata.json +1 -0
- package/esm2015/cypress/exports.js +1 -0
- package/esm2015/cypress/exports.js.map +1 -1
- package/esm2015/cypress/exports.metadata.json +1 -1
- package/esm2015/cypress/page.js +10 -1
- package/esm2015/cypress/page.js.map +1 -1
- package/esm2015/cypress/page.metadata.json +1 -1
- package/esm2015/cypress/section.js +7 -0
- package/esm2015/cypress/section.js.map +1 -1
- package/esm2015/lib/place/components/abstract-place-navigation.component.js +7 -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 +6 -6
- 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/side-place-navigation/side-place-navigation.component.js +5 -5
- 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 -0
- 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 +94 -43
- 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/guards/place.guard.ngfactory.js.map +1 -0
- package/esm2015/lib/place/place-auth-service.js +3 -0
- package/esm2015/lib/place/place-auth-service.js.map +1 -0
- package/esm2015/lib/place/place-auth-service.metadata.json +1 -0
- package/esm2015/lib/place/place-component.js +12 -2
- package/esm2015/lib/place/place-component.js.map +1 -1
- package/esm2015/lib/place/place-component.metadata.json +1 -1
- package/esm2015/lib/place/place-definition.js +2 -1
- package/esm2015/lib/place/place-definition.js.map +1 -1
- package/esm2015/lib/place/place-definition.metadata.json +1 -1
- package/esm2015/lib/place/place-router.js +6 -0
- package/esm2015/lib/place/place-router.js.map +1 -1
- package/esm2015/lib/place/place-router.metadata.json +1 -1
- package/esm2015/lib/place/place.decorator.js +1 -1
- package/esm2015/lib/place/place.decorator.js.map +1 -1
- package/fesm2015/coolon-angular-ui-powerups-cypress.js +36 -2
- package/fesm2015/coolon-angular-ui-powerups-cypress.js.map +1 -1
- package/fesm2015/coolon-angular-ui-powerups.js +185 -128
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/place/components/abstract-place-navigation.component.d.ts +2 -2
- package/lib/place/components/list-place-nav/list-place-nav.component.d.ts +2 -2
- package/lib/place/components/side-place-navigation/side-place-navigation.component.d.ts +2 -2
- package/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.d.ts +2 -2
- package/lib/place/exports.d.ts +1 -0
- package/lib/place/guards/place.guard.d.ts +5 -7
- package/lib/place/place-auth-service.d.ts +36 -0
- package/lib/place/place-component.d.ts +2 -1
- package/lib/place/place-definition.d.ts +2 -1
- package/lib/place/place-router.d.ts +1 -0
- package/lib/place/place.decorator.d.ts +1 -0
- package/package.json +1 -1
- package/schematics/bootstrap-app/index.js +4 -0
- package/schematics/bootstrap-app/index.js.map +1 -1
- package/schematics/bootstrap-app/templates/app/app.module.ts.template +4 -2
- package/schematics/bootstrap-app/templates/app/auth/place-auth.service.ts.template +41 -0
- package/schematics/collection.json +5 -0
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.js.map +1 -1
- package/schematics/place-add/index.js +2 -1
- package/schematics/place-add/index.js.map +1 -1
- package/schematics/place-add/templates/component/__name@dasherize__.component.scss.template +1 -0
- package/schematics/place-bootstrap/index.d.ts +3 -0
- package/schematics/place-bootstrap/index.js +21 -0
- package/schematics/place-bootstrap/index.js.map +1 -0
- package/schematics/place-bootstrap/schema.d.ts +4 -0
- package/schematics/place-bootstrap/schema.js +3 -0
- package/schematics/place-bootstrap/schema.js.map +1 -0
- package/schematics/place-bootstrap/schema.json +28 -0
- package/schematics/place-routes/place-builder.d.ts +0 -1
- package/schematics/place-routes/place-builder.js +34 -24
- package/schematics/place-routes/place-builder.js.map +1 -1
- package/schematics/place-routes/place-class-scanner.js +2 -1
- package/schematics/place-routes/place-class-scanner.js.map +1 -1
- package/schematics/place-routes/place-def.d.ts +1 -0
- package/schematics/place-routes/place-def.js +2 -2
- package/schematics/place-routes/place-def.js.map +1 -1
- package/schematics/place-routes/schema.d.ts +1 -4
- package/schematics/place-routes/schema.json +9 -1
- package/schematics/place-routes/templates/place-destinations.ts.template +1 -9
- package/schematics/place-routes/templates/place-routes.ts.template +3 -39
- package/schematics/place-routes/templates/place-visits.ts.template +1 -10
- package/schematics/bootstrap-app/templates/app/auth/auth.guard.ts.template +0 -23
- package/schematics/bootstrap-app/templates/app/auth/auth.module.ts.template +0 -13
- package/schematics/bootstrap-app/templates/app/auth/auth.service.ts.template +0 -13
- package/schematics/bootstrap-app/templates/app/places/places.json5.template +0 -3
- /package/schematics/{bootstrap-app/templates/app/places → place-bootstrap/templates/__name@dasherize__}/place-routes.ts.template +0 -0
- /package/schematics/{bootstrap-app/templates/app/places → place-bootstrap/templates/__name@dasherize__}/places.module.ts.template +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@angular/forms'), require('@angular/material/form-field'), require('@angular/material/input'), require('@angular/material/select'), require('@angular/material/tabs'), require('@angular/platform-browser/animations'), require('@angular/cdk/portal'), require('@angular/cdk/scrolling'), require('@angular/material/autocomplete'), require('@angular/material/button'), require('@angular/material/checkbox'), require('@angular/material/divider'), require('@angular/material/icon'), require('@angular/material/menu'), require('@angular/material/table'), require('@angular/material/tooltip'), require('@fortawesome/angular-fontawesome'), require('@fortawesome/free-solid-svg-icons'), require('@coolon/pectin'), require('@typescript-plus/fast-memoize-decorator/dist/src'), require('lodash'), require('typescript-string-enums'), require('@coolon/typescript-utilities'), require('immer'), require('@angular/flex-layout'), require('@angular/material/dialog'), require('@angular/router'), require('@angular/cdk/overlay'), require('resize-observer-polyfill'), require('@angular/material/list'), require('@angular/material/progress-spinner'), require('@typescript-plus/fast-memoize-decorator'), require('reflect-metadata'), require('@angular/animations')
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@coolon/angular-ui-powerups', ['exports', '@angular/common', '@angular/core', '@angular/forms', '@angular/material/form-field', '@angular/material/input', '@angular/material/select', '@angular/material/tabs', '@angular/platform-browser/animations', '@angular/cdk/portal', '@angular/cdk/scrolling', '@angular/material/autocomplete', '@angular/material/button', '@angular/material/checkbox', '@angular/material/divider', '@angular/material/icon', '@angular/material/menu', '@angular/material/table', '@angular/material/tooltip', '@fortawesome/angular-fontawesome', '@fortawesome/free-solid-svg-icons', '@coolon/pectin', '@typescript-plus/fast-memoize-decorator/dist/src', 'lodash', 'typescript-string-enums', '@coolon/typescript-utilities', 'immer', '@angular/flex-layout', '@angular/material/dialog', '@angular/router', '@angular/cdk/overlay', 'resize-observer-polyfill', '@angular/material/list', '@angular/material/progress-spinner', '@typescript-plus/fast-memoize-decorator', 'reflect-metadata', '@angular/animations'
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.coolon = global.coolon || {}, global.coolon['angular-ui-powerups'] = {}), global.ng.common, global.ng.core, global.ng.forms, global.ng.material.formField, global.ng.material.input, global.ng.material.select, global.ng.material.tabs, global.ng.platformBrowser.animations, global.ng.cdk.portal, global.ng.cdk.scrolling, global.ng.material.autocomplete, global.ng.material.button, global.ng.material.checkbox, global.ng.material.divider, global.ng.material.icon, global.ng.material.menu, global.ng.material.table, global.ng.material.tooltip, global.angularFontawesome, global.freeSolidSvgIcons, global.pectin, global.src, global._, global.typescriptStringEnums, global.typescriptUtilities, global.produce, global.ng.flexLayout, global.ng.material.dialog, global.ng.router, global.ng.cdk.overlay, global.ResizeObserver, global.ng.material.list, global.ng.material.progressSpinner, global.fastMemoizeDecorator, null, global.ng.animations
|
|
5
|
-
}(this, (function (exports, i2, i0, forms, formField, input, select, tabs, animations, portal, scrolling, autocomplete, button, checkbox, divider, icon, menu, table, tooltip, angularFontawesome, freeSolidSvgIcons, pectin, src, _, typescriptStringEnums, typescriptUtilities, produce, flexLayout, i1, i1$1, overlay, ResizeObserver, list, progressSpinner, fastMemoizeDecorator, reflectMetadata, animations$1
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@angular/forms'), require('@angular/material/form-field'), require('@angular/material/input'), require('@angular/material/select'), require('@angular/material/tabs'), require('@angular/platform-browser/animations'), require('@angular/cdk/portal'), require('@angular/cdk/scrolling'), require('@angular/material/autocomplete'), require('@angular/material/button'), require('@angular/material/checkbox'), require('@angular/material/divider'), require('@angular/material/icon'), require('@angular/material/menu'), require('@angular/material/table'), require('@angular/material/tooltip'), require('@fortawesome/angular-fontawesome'), require('@fortawesome/free-solid-svg-icons'), require('@coolon/pectin'), require('@typescript-plus/fast-memoize-decorator/dist/src'), require('lodash'), require('typescript-string-enums'), require('@coolon/typescript-utilities'), require('immer'), require('@angular/flex-layout'), require('@angular/material/dialog'), require('@angular/router'), require('@angular/cdk/overlay'), require('resize-observer-polyfill'), require('@angular/material/list'), require('@angular/material/progress-spinner'), require('@typescript-plus/fast-memoize-decorator'), require('reflect-metadata'), require('@angular/animations')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@coolon/angular-ui-powerups', ['exports', '@angular/common', '@angular/core', '@angular/forms', '@angular/material/form-field', '@angular/material/input', '@angular/material/select', '@angular/material/tabs', '@angular/platform-browser/animations', '@angular/cdk/portal', '@angular/cdk/scrolling', '@angular/material/autocomplete', '@angular/material/button', '@angular/material/checkbox', '@angular/material/divider', '@angular/material/icon', '@angular/material/menu', '@angular/material/table', '@angular/material/tooltip', '@fortawesome/angular-fontawesome', '@fortawesome/free-solid-svg-icons', '@coolon/pectin', '@typescript-plus/fast-memoize-decorator/dist/src', 'lodash', 'typescript-string-enums', '@coolon/typescript-utilities', 'immer', '@angular/flex-layout', '@angular/material/dialog', '@angular/router', '@angular/cdk/overlay', 'resize-observer-polyfill', '@angular/material/list', '@angular/material/progress-spinner', '@typescript-plus/fast-memoize-decorator', 'reflect-metadata', '@angular/animations'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.coolon = global.coolon || {}, global.coolon['angular-ui-powerups'] = {}), global.ng.common, global.ng.core, global.ng.forms, global.ng.material.formField, global.ng.material.input, global.ng.material.select, global.ng.material.tabs, global.ng.platformBrowser.animations, global.ng.cdk.portal, global.ng.cdk.scrolling, global.ng.material.autocomplete, global.ng.material.button, global.ng.material.checkbox, global.ng.material.divider, global.ng.material.icon, global.ng.material.menu, global.ng.material.table, global.ng.material.tooltip, global.angularFontawesome, global.freeSolidSvgIcons, global.pectin, global.src, global._, global.typescriptStringEnums, global.typescriptUtilities, global.produce, global.ng.flexLayout, global.ng.material.dialog, global.ng.router, global.ng.cdk.overlay, global.ResizeObserver, global.ng.material.list, global.ng.material.progressSpinner, global.fastMemoizeDecorator, null, global.ng.animations));
|
|
5
|
+
}(this, (function (exports, i2, i0, forms, formField, input, select, tabs, animations, portal, scrolling, autocomplete, button, checkbox, divider, icon, menu, table, tooltip, angularFontawesome, freeSolidSvgIcons, pectin, src, _, typescriptStringEnums, typescriptUtilities, produce, flexLayout, i1, i1$1, overlay, ResizeObserver, list, progressSpinner, fastMemoizeDecorator, reflectMetadata, animations$1) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -5174,6 +5174,8 @@
|
|
|
5174
5174
|
},] }
|
|
5175
5175
|
];
|
|
5176
5176
|
|
|
5177
|
+
var PLACE_AUTH_SERVICE = new i0.InjectionToken("PlaceAuthService");
|
|
5178
|
+
|
|
5177
5179
|
exports.ParameterDefinition = /** @class */ (function () {
|
|
5178
5180
|
function ParameterDefinition(propertyName, options, urlFormat) {
|
|
5179
5181
|
this.propertyName = propertyName;
|
|
@@ -5280,10 +5282,11 @@
|
|
|
5280
5282
|
})(exports.ParameterDefinition || (exports.ParameterDefinition = {}));
|
|
5281
5283
|
|
|
5282
5284
|
var PlaceDefinition = /** @class */ (function () {
|
|
5283
|
-
function PlaceDefinition(component, path, authenticate, data, routeParameters, children) {
|
|
5285
|
+
function PlaceDefinition(component, path, authenticate, roles, data, routeParameters, children) {
|
|
5284
5286
|
this.component = component;
|
|
5285
5287
|
this.path = path;
|
|
5286
5288
|
this.authenticate = authenticate;
|
|
5289
|
+
this.roles = roles;
|
|
5287
5290
|
this.data = data;
|
|
5288
5291
|
this.routeParameters = routeParameters;
|
|
5289
5292
|
this.children = children;
|
|
@@ -5525,8 +5528,17 @@
|
|
|
5525
5528
|
return typescriptUtilities.Klass.get(klass).getMetadataList(ROUTE_PARAMETER_LIST_KEY);
|
|
5526
5529
|
}
|
|
5527
5530
|
PlaceComponent.getRouteParameters = getRouteParameters;
|
|
5528
|
-
function getDefinition(
|
|
5529
|
-
|
|
5531
|
+
function getDefinition(snapshotOrConstructor) {
|
|
5532
|
+
if (snapshotOrConstructor instanceof i1$1.ActivatedRouteSnapshot) {
|
|
5533
|
+
var component = snapshotOrConstructor.component;
|
|
5534
|
+
if (!isPlaceComponentConstructor(component)) {
|
|
5535
|
+
throw new Error("ActivatedRouteSnapshot component is not a PlaceComponent, got " + component);
|
|
5536
|
+
}
|
|
5537
|
+
return Reflect.getMetadata(DEFINITION_META_DATA_KEY, component);
|
|
5538
|
+
}
|
|
5539
|
+
else {
|
|
5540
|
+
return Reflect.getMetadata(DEFINITION_META_DATA_KEY, snapshotOrConstructor);
|
|
5541
|
+
}
|
|
5530
5542
|
}
|
|
5531
5543
|
PlaceComponent.getDefinition = getDefinition;
|
|
5532
5544
|
function injectDefinition(klass, definition) {
|
|
@@ -5535,6 +5547,77 @@
|
|
|
5535
5547
|
PlaceComponent.injectDefinition = injectDefinition;
|
|
5536
5548
|
})(exports.PlaceComponent || (exports.PlaceComponent = {}));
|
|
5537
5549
|
|
|
5550
|
+
var Visit = /** @class */ (function () {
|
|
5551
|
+
function Visit(placeDefinition, visitParameters) {
|
|
5552
|
+
if (visitParameters === void 0) { visitParameters = {}; }
|
|
5553
|
+
this.placeDefinition = placeDefinition;
|
|
5554
|
+
this.visitParameters = visitParameters;
|
|
5555
|
+
}
|
|
5556
|
+
// @Trace()
|
|
5557
|
+
Visit.prototype.getRouteId = function () {
|
|
5558
|
+
return this.placeDefinition.getRouteIdFrom(this);
|
|
5559
|
+
};
|
|
5560
|
+
// @Trace()
|
|
5561
|
+
Visit.prototype.hasRouteId = function () {
|
|
5562
|
+
return !_.isNil(this.getRouteId());
|
|
5563
|
+
};
|
|
5564
|
+
/**
|
|
5565
|
+
* Returns the value of the place parameter with the specified name. The parameter
|
|
5566
|
+
* name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
|
|
5567
|
+
* same as the the ValueModel property name.
|
|
5568
|
+
* @param parameterName the field name of the property model or the `as` option if specified.
|
|
5569
|
+
*/
|
|
5570
|
+
Visit.prototype.getParameter = function (parameterName) {
|
|
5571
|
+
return this.visitParameters[parameterName];
|
|
5572
|
+
};
|
|
5573
|
+
// @Trace()
|
|
5574
|
+
Visit.prototype.hasParameter = function (parameterName) {
|
|
5575
|
+
return Object.keys(this.visitParameters).includes(parameterName);
|
|
5576
|
+
};
|
|
5577
|
+
Visit.prototype.replace = function (parameter, value) {
|
|
5578
|
+
var _a;
|
|
5579
|
+
return new Visit(this.placeDefinition, Object.assign(Object.assign({}, this.visitParameters), (_a = {}, _a[parameter.name] = value, _a)));
|
|
5580
|
+
};
|
|
5581
|
+
Visit.prototype.mergeRouteParameters = function (routeParams) {
|
|
5582
|
+
var _this = this;
|
|
5583
|
+
// todo: whitelist parameters.
|
|
5584
|
+
var routeParameterKeys = Object.keys(routeParams);
|
|
5585
|
+
var params = {};
|
|
5586
|
+
this.placeDefinition.getVisitParameterDefs().forEach(function (def) {
|
|
5587
|
+
if (def.isRouteId || def.isRouteParameter) {
|
|
5588
|
+
if (routeParameterKeys.includes(def.name)) {
|
|
5589
|
+
params[def.name] = routeParams[def.name];
|
|
5590
|
+
}
|
|
5591
|
+
}
|
|
5592
|
+
else {
|
|
5593
|
+
// copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the
|
|
5594
|
+
// defaults and remember sanitisation process.
|
|
5595
|
+
var value = _this.getParameter(def.name);
|
|
5596
|
+
if (_this.hasParameter(def.name)) {
|
|
5597
|
+
params[def.name] = value;
|
|
5598
|
+
}
|
|
5599
|
+
}
|
|
5600
|
+
});
|
|
5601
|
+
return new Visit(this.placeDefinition, params);
|
|
5602
|
+
};
|
|
5603
|
+
Visit.prototype.hasRoutingChangedFrom = function (other) {
|
|
5604
|
+
var samePlace = other.placeDefinition === this.placeDefinition;
|
|
5605
|
+
var sameRouteParameters = _.isEqual(this.placeDefinition.getFormattedRouteParameters(this, true), this.placeDefinition.getFormattedRouteParameters(other, true));
|
|
5606
|
+
return !samePlace || !sameRouteParameters;
|
|
5607
|
+
};
|
|
5608
|
+
Visit.prototype.hasChangedFrom = function (other) {
|
|
5609
|
+
var sameNonRouteParameters = _.isEqual(this.placeDefinition.getNonRouteParameters(this), this.placeDefinition.getNonRouteParameters(other));
|
|
5610
|
+
return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);
|
|
5611
|
+
};
|
|
5612
|
+
Visit.prototype.toDebugString = function () {
|
|
5613
|
+
var _this = this;
|
|
5614
|
+
return Object.keys(this.visitParameters).map(function (k) { return k + "=" + _this.visitParameters[k]; }).join(",");
|
|
5615
|
+
};
|
|
5616
|
+
return Visit;
|
|
5617
|
+
}());
|
|
5618
|
+
|
|
5619
|
+
var AUP_PLACE_CONFIG = new i0.InjectionToken('AUP_PLACE_CONFIG');
|
|
5620
|
+
|
|
5538
5621
|
/**
|
|
5539
5622
|
* This class handles the logic around canDeactivate for a given router state transition. It's core responsibilities are:
|
|
5540
5623
|
* 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.)
|
|
@@ -6709,6 +6792,9 @@
|
|
|
6709
6792
|
_this.navigationSessionModel = new pectin.MutableValueModel();
|
|
6710
6793
|
_this._activeVisits = new pectin.MutableListModel();
|
|
6711
6794
|
_this.sessionFinishedJobs = [];
|
|
6795
|
+
if (window['Cypress']) {
|
|
6796
|
+
window['aup.PlaceRouter'] = _this;
|
|
6797
|
+
}
|
|
6712
6798
|
_this.routerInteractionAdapter = interactionService.registerPlaceRouter(_this);
|
|
6713
6799
|
// TODO: Make this an interface and use 'this' instead.
|
|
6714
6800
|
_this.navigationContext = new exports.NavigationContext.Impl(_this.urlService, _this.routerInteractionAdapter, function (urlSnapshot, options) {
|
|
@@ -6779,6 +6865,9 @@
|
|
|
6779
6865
|
enumerable: false,
|
|
6780
6866
|
configurable: true
|
|
6781
6867
|
});
|
|
6868
|
+
PlaceRouter.prototype.isNavigating = function () {
|
|
6869
|
+
return this.navigationInProgress.value;
|
|
6870
|
+
};
|
|
6782
6871
|
// @Trace()
|
|
6783
6872
|
PlaceRouter.prototype.onPopState = function (event) {
|
|
6784
6873
|
pectin.assert.isTruthy(event.navigationTrigger === 'popstate');
|
|
@@ -7001,77 +7090,6 @@
|
|
|
7001
7090
|
{ type: exports.PlaceHistory }
|
|
7002
7091
|
]; };
|
|
7003
7092
|
|
|
7004
|
-
var Visit = /** @class */ (function () {
|
|
7005
|
-
function Visit(placeDefinition, visitParameters) {
|
|
7006
|
-
if (visitParameters === void 0) { visitParameters = {}; }
|
|
7007
|
-
this.placeDefinition = placeDefinition;
|
|
7008
|
-
this.visitParameters = visitParameters;
|
|
7009
|
-
}
|
|
7010
|
-
// @Trace()
|
|
7011
|
-
Visit.prototype.getRouteId = function () {
|
|
7012
|
-
return this.placeDefinition.getRouteIdFrom(this);
|
|
7013
|
-
};
|
|
7014
|
-
// @Trace()
|
|
7015
|
-
Visit.prototype.hasRouteId = function () {
|
|
7016
|
-
return !_.isNil(this.getRouteId());
|
|
7017
|
-
};
|
|
7018
|
-
/**
|
|
7019
|
-
* Returns the value of the place parameter with the specified name. The parameter
|
|
7020
|
-
* name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
|
|
7021
|
-
* same as the the ValueModel property name.
|
|
7022
|
-
* @param parameterName the field name of the property model or the `as` option if specified.
|
|
7023
|
-
*/
|
|
7024
|
-
Visit.prototype.getParameter = function (parameterName) {
|
|
7025
|
-
return this.visitParameters[parameterName];
|
|
7026
|
-
};
|
|
7027
|
-
// @Trace()
|
|
7028
|
-
Visit.prototype.hasParameter = function (parameterName) {
|
|
7029
|
-
return Object.keys(this.visitParameters).includes(parameterName);
|
|
7030
|
-
};
|
|
7031
|
-
Visit.prototype.replace = function (parameter, value) {
|
|
7032
|
-
var _a;
|
|
7033
|
-
return new Visit(this.placeDefinition, Object.assign(Object.assign({}, this.visitParameters), (_a = {}, _a[parameter.name] = value, _a)));
|
|
7034
|
-
};
|
|
7035
|
-
Visit.prototype.mergeRouteParameters = function (routeParams) {
|
|
7036
|
-
var _this = this;
|
|
7037
|
-
// todo: whitelist parameters.
|
|
7038
|
-
var routeParameterKeys = Object.keys(routeParams);
|
|
7039
|
-
var params = {};
|
|
7040
|
-
this.placeDefinition.getVisitParameterDefs().forEach(function (def) {
|
|
7041
|
-
if (def.isRouteId || def.isRouteParameter) {
|
|
7042
|
-
if (routeParameterKeys.includes(def.name)) {
|
|
7043
|
-
params[def.name] = routeParams[def.name];
|
|
7044
|
-
}
|
|
7045
|
-
}
|
|
7046
|
-
else {
|
|
7047
|
-
// copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the
|
|
7048
|
-
// defaults and remember sanitisation process.
|
|
7049
|
-
var value = _this.getParameter(def.name);
|
|
7050
|
-
if (_this.hasParameter(def.name)) {
|
|
7051
|
-
params[def.name] = value;
|
|
7052
|
-
}
|
|
7053
|
-
}
|
|
7054
|
-
});
|
|
7055
|
-
return new Visit(this.placeDefinition, params);
|
|
7056
|
-
};
|
|
7057
|
-
Visit.prototype.hasRoutingChangedFrom = function (other) {
|
|
7058
|
-
var samePlace = other.placeDefinition === this.placeDefinition;
|
|
7059
|
-
var sameRouteParameters = _.isEqual(this.placeDefinition.getFormattedRouteParameters(this, true), this.placeDefinition.getFormattedRouteParameters(other, true));
|
|
7060
|
-
return !samePlace || !sameRouteParameters;
|
|
7061
|
-
};
|
|
7062
|
-
Visit.prototype.hasChangedFrom = function (other) {
|
|
7063
|
-
var sameNonRouteParameters = _.isEqual(this.placeDefinition.getNonRouteParameters(this), this.placeDefinition.getNonRouteParameters(other));
|
|
7064
|
-
return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);
|
|
7065
|
-
};
|
|
7066
|
-
Visit.prototype.toDebugString = function () {
|
|
7067
|
-
var _this = this;
|
|
7068
|
-
return Object.keys(this.visitParameters).map(function (k) { return k + "=" + _this.visitParameters[k]; }).join(",");
|
|
7069
|
-
};
|
|
7070
|
-
return Visit;
|
|
7071
|
-
}());
|
|
7072
|
-
|
|
7073
|
-
var AUP_PLACE_CONFIG = new i0.InjectionToken('AUP_PLACE_CONFIG');
|
|
7074
|
-
|
|
7075
7093
|
// Freezes the state of the components at the start of the animation.
|
|
7076
7094
|
var animationStartStyle = animations$1.style({ position: 'absolute', top: '0', left: '0', bottom: '0', right: '0' });
|
|
7077
7095
|
var left = [
|
|
@@ -7349,11 +7367,13 @@
|
|
|
7349
7367
|
|
|
7350
7368
|
var AbstractPlaceNavigationComponent = /** @class */ (function (_super) {
|
|
7351
7369
|
__extends(AbstractPlaceNavigationComponent, _super);
|
|
7352
|
-
function AbstractPlaceNavigationComponent(
|
|
7370
|
+
function AbstractPlaceNavigationComponent(authService) {
|
|
7353
7371
|
var _this = _super.call(this) || this;
|
|
7354
7372
|
_this._activePlaceComponent = new pectin.DelegatingValueModel();
|
|
7355
7373
|
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;
|
|
7356
|
-
_this.placeDefinitions = chain(_this.placesModel)
|
|
7374
|
+
_this.placeDefinitions = chain(_this.placesModel)
|
|
7375
|
+
.map(function (c) { return exports.PlaceComponent.getDefinition(c); })
|
|
7376
|
+
.select(function (d) { return authService.authoriserModel.value(d); }, { dependsOn: authService.authoriserModel });
|
|
7357
7377
|
_this.commandFactory = pectin.Command.createFactory(function (placeDefinition) {
|
|
7358
7378
|
_this.placeOutlet.navigate(new Visit(placeDefinition));
|
|
7359
7379
|
});
|
|
@@ -7387,7 +7407,7 @@
|
|
|
7387
7407
|
},] }
|
|
7388
7408
|
];
|
|
7389
7409
|
AbstractPlaceNavigationComponent.ctorParameters = function () { return [
|
|
7390
|
-
{ type:
|
|
7410
|
+
{ type: undefined, decorators: [{ type: i0.Inject, args: [PLACE_AUTH_SERVICE,] }] }
|
|
7391
7411
|
]; };
|
|
7392
7412
|
AbstractPlaceNavigationComponent.propDecorators = {
|
|
7393
7413
|
places: [{ type: i0.Input }],
|
|
@@ -7464,8 +7484,8 @@
|
|
|
7464
7484
|
|
|
7465
7485
|
var ListPlaceNavComponent = /** @class */ (function (_super) {
|
|
7466
7486
|
__extends(ListPlaceNavComponent, _super);
|
|
7467
|
-
function ListPlaceNavComponent(
|
|
7468
|
-
return _super.call(this,
|
|
7487
|
+
function ListPlaceNavComponent(authService) {
|
|
7488
|
+
return _super.call(this, authService) || this;
|
|
7469
7489
|
}
|
|
7470
7490
|
return ListPlaceNavComponent;
|
|
7471
7491
|
}(AbstractPlaceNavigationComponent));
|
|
@@ -7473,11 +7493,11 @@
|
|
|
7473
7493
|
{ type: i0.Component, args: [{
|
|
7474
7494
|
selector: 'aup-list-place-nav',
|
|
7475
7495
|
template: "<mat-nav-list fxFlex>\n <a mat-list-item *ngFor=\"let placeDefinition of placeDefinitions.value\"\n [pectinCommand]=\"commandFactory.create(placeDefinition)\"\n [class.active]=\"isActive(placeDefinition)\"\n [matTooltip]=\"getNavigationFace(placeDefinition).tooltip()\">\n <aup-command-face [faces]=\"[getNavigationFace(placeDefinition)]\"></aup-command-face>\n </a>\n</mat-nav-list>\n",
|
|
7476
|
-
styles: [":host{--selected-background:#f1f1f1;--selected-border-color:#838383;--selected-color:inherit;display:flex;flex-direction:column}mat-nav-list{padding-top:0}a.active{background:var(--selected-background);border-right:2px solid var(--selected-border-color);color:var(--selected-color)}"]
|
|
7496
|
+
styles: [":host{--selected-background:#f1f1f1;--selected-border-color:#838383;--selected-color:inherit;display:flex;flex-direction:column}mat-nav-list{padding-top:0}a{border-right:2px solid transparent}a.active{background:var(--selected-background);border-right:2px solid var(--selected-border-color);color:var(--selected-color)}"]
|
|
7477
7497
|
},] }
|
|
7478
7498
|
];
|
|
7479
7499
|
ListPlaceNavComponent.ctorParameters = function () { return [
|
|
7480
|
-
{ type:
|
|
7500
|
+
{ type: undefined, decorators: [{ type: i0.Inject, args: [PLACE_AUTH_SERVICE,] }] }
|
|
7481
7501
|
]; };
|
|
7482
7502
|
|
|
7483
7503
|
/**
|
|
@@ -7524,8 +7544,8 @@
|
|
|
7524
7544
|
*/
|
|
7525
7545
|
var SidePlaceNavigationComponent = /** @class */ (function (_super) {
|
|
7526
7546
|
__extends(SidePlaceNavigationComponent, _super);
|
|
7527
|
-
function SidePlaceNavigationComponent(router,
|
|
7528
|
-
var _this = _super.call(this,
|
|
7547
|
+
function SidePlaceNavigationComponent(router, authService) {
|
|
7548
|
+
var _this = _super.call(this, authService) || this;
|
|
7529
7549
|
_this.router = router;
|
|
7530
7550
|
_this.expanded = false;
|
|
7531
7551
|
return _this;
|
|
@@ -7550,7 +7570,7 @@
|
|
|
7550
7570
|
];
|
|
7551
7571
|
SidePlaceNavigationComponent.ctorParameters = function () { return [
|
|
7552
7572
|
{ type: i1$1.Router },
|
|
7553
|
-
{ type:
|
|
7573
|
+
{ type: undefined, decorators: [{ type: i0.Inject, args: [PLACE_AUTH_SERVICE,] }] }
|
|
7554
7574
|
]; };
|
|
7555
7575
|
SidePlaceNavigationComponent.propDecorators = {
|
|
7556
7576
|
expanded: [{ type: i0.HostBinding, args: ['class.expanded',] }],
|
|
@@ -7559,8 +7579,8 @@
|
|
|
7559
7579
|
|
|
7560
7580
|
var TabbedPlaceNavigationComponent = /** @class */ (function (_super) {
|
|
7561
7581
|
__extends(TabbedPlaceNavigationComponent, _super);
|
|
7562
|
-
function TabbedPlaceNavigationComponent(
|
|
7563
|
-
return _super.call(this,
|
|
7582
|
+
function TabbedPlaceNavigationComponent(authService) {
|
|
7583
|
+
return _super.call(this, authService) || this;
|
|
7564
7584
|
}
|
|
7565
7585
|
return TabbedPlaceNavigationComponent;
|
|
7566
7586
|
}(AbstractPlaceNavigationComponent));
|
|
@@ -7572,7 +7592,7 @@
|
|
|
7572
7592
|
},] }
|
|
7573
7593
|
];
|
|
7574
7594
|
TabbedPlaceNavigationComponent.ctorParameters = function () { return [
|
|
7575
|
-
{ type:
|
|
7595
|
+
{ type: undefined, decorators: [{ type: i0.Inject, args: [PLACE_AUTH_SERVICE,] }] }
|
|
7576
7596
|
]; };
|
|
7577
7597
|
|
|
7578
7598
|
var PlaceModule = /** @class */ (function () {
|
|
@@ -7778,7 +7798,7 @@
|
|
|
7778
7798
|
function Place(options) {
|
|
7779
7799
|
return function (target) {
|
|
7780
7800
|
if (exports.PlaceComponent.isPlaceComponentConstructor(target)) {
|
|
7781
|
-
exports.PlaceComponent.injectDefinition(target, new PlaceDefinition(target, options.path, _.isNil(options.authenticate) ? true : options.authenticate, options.data, exports.PlaceComponent.getRouteParameters(target), (options.children || []).map(function (c) { return exports.PlaceComponent.getDefinition(c); })));
|
|
7801
|
+
exports.PlaceComponent.injectDefinition(target, new PlaceDefinition(target, options.path, _.isNil(options.authenticate) ? true : options.authenticate, _.isNil(options.roles) ? [] : options.roles, options.data, exports.PlaceComponent.getRouteParameters(target), (options.children || []).map(function (c) { return exports.PlaceComponent.getDefinition(c); })));
|
|
7782
7802
|
}
|
|
7783
7803
|
else {
|
|
7784
7804
|
pectin.lang.illegalState(target + " must extend PlaceComponent to use the @Place decorator");
|
|
@@ -7925,63 +7945,74 @@
|
|
|
7925
7945
|
}());
|
|
7926
7946
|
|
|
7927
7947
|
var PlaceGuard = /** @class */ (function () {
|
|
7928
|
-
function PlaceGuard(router, urlService, placeRouter, placeHistory, interactionService, injector) {
|
|
7948
|
+
function PlaceGuard(router, urlService, placeRouter, placeHistory, placeAuthService, interactionService, injector) {
|
|
7929
7949
|
this.router = router;
|
|
7930
7950
|
this.urlService = urlService;
|
|
7931
7951
|
this.placeRouter = placeRouter;
|
|
7932
7952
|
this.placeHistory = placeHistory;
|
|
7953
|
+
this.placeAuthService = placeAuthService;
|
|
7933
7954
|
this.interactionService = interactionService;
|
|
7934
7955
|
this.injector = injector;
|
|
7935
7956
|
}
|
|
7936
|
-
// @Trace()
|
|
7937
7957
|
PlaceGuard.prototype.canActivate = function (activatedRoute, state) {
|
|
7938
7958
|
return __awaiter(this, void 0, void 0, function () {
|
|
7959
|
+
var placeDefinition_1, needsAuth, proceed, _a, result;
|
|
7939
7960
|
var _this = this;
|
|
7940
|
-
return __generator(this, function (
|
|
7941
|
-
|
|
7942
|
-
|
|
7943
|
-
|
|
7944
|
-
|
|
7945
|
-
|
|
7946
|
-
|
|
7947
|
-
|
|
7948
|
-
|
|
7949
|
-
|
|
7950
|
-
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
|
|
7957
|
-
|
|
7958
|
-
|
|
7959
|
-
|
|
7960
|
-
|
|
7961
|
-
|
|
7962
|
-
|
|
7963
|
-
|
|
7964
|
-
|
|
7965
|
-
|
|
7966
|
-
|
|
7967
|
-
|
|
7968
|
-
|
|
7969
|
-
|
|
7970
|
-
|
|
7971
|
-
|
|
7961
|
+
return __generator(this, function (_b) {
|
|
7962
|
+
switch (_b.label) {
|
|
7963
|
+
case 0:
|
|
7964
|
+
if (!exports.PlaceComponent.isPlaceComponentConstructor(activatedRoute.component)) return [3 /*break*/, 4];
|
|
7965
|
+
placeDefinition_1 = exports.PlaceComponent.getDefinition(activatedRoute.component);
|
|
7966
|
+
needsAuth = placeDefinition_1.authenticate;
|
|
7967
|
+
_a = !needsAuth;
|
|
7968
|
+
if (_a) return [3 /*break*/, 2];
|
|
7969
|
+
return [4 /*yield*/, this.placeAuthService.isAuthenticated()];
|
|
7970
|
+
case 1:
|
|
7971
|
+
_a = (_b.sent());
|
|
7972
|
+
_b.label = 2;
|
|
7973
|
+
case 2:
|
|
7974
|
+
proceed = _a;
|
|
7975
|
+
if (!proceed) {
|
|
7976
|
+
return [2 /*return*/, this.handleGuardResult(this.placeAuthService.handleNotAuthenticated(activatedRoute, state))];
|
|
7977
|
+
}
|
|
7978
|
+
if (!this.placeAuthService.isAuthorised(placeDefinition_1)) {
|
|
7979
|
+
return [2 /*return*/, this.handleGuardResult(this.placeAuthService.handleNotAuthorisation(activatedRoute, state))];
|
|
7980
|
+
}
|
|
7981
|
+
return [4 /*yield*/, this.cleanInteractionState(activatedRoute, state, function () { return __awaiter(_this, void 0, void 0, function () {
|
|
7982
|
+
var params, parsedParams, navigationSession, initialVisit, sanitiser, sanitisedVisit, urlSnapshot;
|
|
7983
|
+
return __generator(this, function (_a) {
|
|
7984
|
+
switch (_a.label) {
|
|
7985
|
+
case 0:
|
|
7986
|
+
params = new ConsolidatedParameterMap(activatedRoute.paramMap, activatedRoute.url);
|
|
7987
|
+
parsedParams = placeDefinition_1.parseRouteParams(params);
|
|
7988
|
+
navigationSession = this.placeRouter.navigationSession;
|
|
7989
|
+
initialVisit = navigationSession.getVisitFor(placeDefinition_1) || new Visit(placeDefinition_1, parsedParams);
|
|
7990
|
+
sanitiser = new VisitSanitiser(navigationSession, activatedRoute, this.router, this.placeHistory, this.injector);
|
|
7991
|
+
return [4 /*yield*/, sanitiser.sanitise(initialVisit.mergeRouteParameters(parsedParams))];
|
|
7992
|
+
case 1:
|
|
7993
|
+
sanitisedVisit = _a.sent();
|
|
7994
|
+
// Save the visit with any updated parameters. We need to save it so we remember any non route parameters
|
|
7995
|
+
navigationSession.storeVisit(sanitisedVisit);
|
|
7996
|
+
if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {
|
|
7997
|
+
urlSnapshot = this.urlService.parseUrl(state.url).updateVisitSegments(sanitisedVisit);
|
|
7998
|
+
// console.log('##### Place Guard Redirect', urlSnapshot);
|
|
7999
|
+
return [2 /*return*/, urlSnapshot];
|
|
7972
8000
|
}
|
|
7973
|
-
|
|
7974
|
-
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
8001
|
+
else {
|
|
8002
|
+
return [2 /*return*/, true];
|
|
8003
|
+
}
|
|
8004
|
+
return [2 /*return*/];
|
|
8005
|
+
}
|
|
8006
|
+
});
|
|
8007
|
+
}); })];
|
|
8008
|
+
case 3:
|
|
8009
|
+
result = _b.sent();
|
|
8010
|
+
return [2 /*return*/, result instanceof exports.UrlSnapshot ? result.urlTree : result];
|
|
8011
|
+
case 4: return [2 /*return*/, pectin.lang.illegalState("expected component to be an instance of PlaceComponent, got " + activatedRoute.component)];
|
|
8012
|
+
}
|
|
7981
8013
|
});
|
|
7982
8014
|
});
|
|
7983
8015
|
};
|
|
7984
|
-
// @Trace()
|
|
7985
8016
|
PlaceGuard.prototype.canDeactivate = function (component, currentRoute, currentState, nextState) {
|
|
7986
8017
|
return __awaiter(this, void 0, void 0, function () {
|
|
7987
8018
|
var currentUrl, nextUrl, result;
|
|
@@ -7993,66 +8024,41 @@
|
|
|
7993
8024
|
return [4 /*yield*/, this.placeRouter.navigationSession.canDeactivatePlace(component, currentUrl, nextUrl)];
|
|
7994
8025
|
case 1:
|
|
7995
8026
|
result = _a.sent();
|
|
7996
|
-
return [2 /*return*/,
|
|
8027
|
+
return [2 /*return*/, result instanceof exports.UrlSnapshot ? result.urlTree : result];
|
|
7997
8028
|
}
|
|
7998
8029
|
});
|
|
7999
8030
|
});
|
|
8000
8031
|
};
|
|
8001
|
-
// @Trace()
|
|
8002
8032
|
PlaceGuard.prototype.handleGuardResult = function (result) {
|
|
8003
8033
|
if (result instanceof exports.UrlSnapshot) {
|
|
8004
8034
|
return result.urlTree;
|
|
8005
8035
|
}
|
|
8006
8036
|
else {
|
|
8007
|
-
return result;
|
|
8037
|
+
return this.urlService.createUrlSnapshot(result).urlTree;
|
|
8008
8038
|
}
|
|
8009
8039
|
};
|
|
8040
|
+
// protected async ensureAuthenticatedThen(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot, next: (placeDefinition: PlaceDefinition) => Promise<boolean | UrlTree>): Promise<boolean | UrlTree> {
|
|
8041
|
+
// const authoriseResult = placeDefinition.authenticate ? await this.isAuthorised(activatedRoute, state) : true;
|
|
8042
|
+
// if (authoriseResult === true) {
|
|
8043
|
+
// // we're authorised, now run the place guards.
|
|
8044
|
+
// return next(placeDefinition);
|
|
8045
|
+
// } else {
|
|
8046
|
+
// console.log('not authorised result', authoriseResult);
|
|
8047
|
+
// return authoriseResult;
|
|
8048
|
+
// }
|
|
8049
|
+
// }
|
|
8050
|
+
//
|
|
8051
|
+
// // @Trace()
|
|
8052
|
+
// protected async ensureAuthorisedThen(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot, next: (placeDefinition: PlaceDefinition) => Promise<boolean | UrlTree>): Promise<boolean | UrlTree> {
|
|
8053
|
+
//
|
|
8054
|
+
// }
|
|
8010
8055
|
// @Trace()
|
|
8011
|
-
|
|
8012
|
-
|
|
8013
|
-
|
|
8014
|
-
|
|
8015
|
-
|
|
8016
|
-
|
|
8017
|
-
if (!exports.PlaceComponent.isPlaceComponentConstructor(activatedRoute.component)) return [3 /*break*/, 4];
|
|
8018
|
-
placeDefinition = exports.PlaceComponent.getDefinition(activatedRoute.component);
|
|
8019
|
-
if (!placeDefinition.authenticate) return [3 /*break*/, 2];
|
|
8020
|
-
return [4 /*yield*/, this.isAuthorised(activatedRoute, state)];
|
|
8021
|
-
case 1:
|
|
8022
|
-
_a = _b.sent();
|
|
8023
|
-
return [3 /*break*/, 3];
|
|
8024
|
-
case 2:
|
|
8025
|
-
_a = true;
|
|
8026
|
-
_b.label = 3;
|
|
8027
|
-
case 3:
|
|
8028
|
-
authoriseResult = _a;
|
|
8029
|
-
if (authoriseResult === true) {
|
|
8030
|
-
// we're authorised, now run the place guards.
|
|
8031
|
-
return [2 /*return*/, runPlaceGuards(placeDefinition)];
|
|
8032
|
-
}
|
|
8033
|
-
else {
|
|
8034
|
-
console.log('not authorised result', authoriseResult);
|
|
8035
|
-
return [2 /*return*/, authoriseResult];
|
|
8036
|
-
}
|
|
8037
|
-
return [3 /*break*/, 5];
|
|
8038
|
-
case 4: return [2 /*return*/, pectin.lang.illegalState("expected component to be an instance of PlaceComponent, got " + activatedRoute.component)];
|
|
8039
|
-
case 5: return [2 /*return*/];
|
|
8040
|
-
}
|
|
8041
|
-
});
|
|
8042
|
-
});
|
|
8043
|
-
};
|
|
8044
|
-
// @Trace()
|
|
8045
|
-
PlaceGuard.prototype.isAuthorised = function (activatedRoute, state) {
|
|
8046
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
8047
|
-
var authorised;
|
|
8048
|
-
return __generator(this, function (_a) {
|
|
8049
|
-
authorised = this.getAuthGuard(this.injector).canActivate(activatedRoute, state);
|
|
8050
|
-
return [2 /*return*/, (authorised instanceof rxjs.Observable) ? authorised.toPromise() : authorised];
|
|
8051
|
-
});
|
|
8052
|
-
});
|
|
8053
|
-
};
|
|
8054
|
-
// @Trace()
|
|
8055
|
-
PlaceGuard.prototype.cleanInteractionState = function (route, state, then) {
|
|
8056
|
+
// async isAuthorised(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean | UrlTree> {
|
|
8057
|
+
// const authorised = this.getAuthGuard(this.injector).canActivate(activatedRoute, state);
|
|
8058
|
+
// return (authorised instanceof Observable) ? authorised.toPromise() : authorised;
|
|
8059
|
+
// }
|
|
8060
|
+
// abstract getAuthGuard(injector: Injector): CanActivate;
|
|
8061
|
+
PlaceGuard.prototype.cleanInteractionState = function (route, state, next) {
|
|
8056
8062
|
return __awaiter(this, void 0, void 0, function () {
|
|
8057
8063
|
var url;
|
|
8058
8064
|
return __generator(this, function (_a) {
|
|
@@ -8063,7 +8069,7 @@
|
|
|
8063
8069
|
return [2 /*return*/, url.removeInteractionIds()];
|
|
8064
8070
|
}
|
|
8065
8071
|
else {
|
|
8066
|
-
return [2 /*return*/,
|
|
8072
|
+
return [2 /*return*/, next()];
|
|
8067
8073
|
}
|
|
8068
8074
|
return [2 /*return*/];
|
|
8069
8075
|
});
|
|
@@ -8071,6 +8077,43 @@
|
|
|
8071
8077
|
};
|
|
8072
8078
|
return PlaceGuard;
|
|
8073
8079
|
}());
|
|
8080
|
+
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(PLACE_AUTH_SERVICE), i0.ɵɵinject(exports.InteractionService), i0.ɵɵinject(i0.INJECTOR)); }, token: PlaceGuard, providedIn: "root" });
|
|
8081
|
+
PlaceGuard.decorators = [
|
|
8082
|
+
{ type: i0.Injectable, args: [{ providedIn: 'root' },] }
|
|
8083
|
+
];
|
|
8084
|
+
PlaceGuard.ctorParameters = function () { return [
|
|
8085
|
+
{ type: i1$1.Router },
|
|
8086
|
+
{ type: UrlService },
|
|
8087
|
+
{ type: PlaceRouter },
|
|
8088
|
+
{ type: exports.PlaceHistory },
|
|
8089
|
+
{ type: undefined, decorators: [{ type: i0.Inject, args: [PLACE_AUTH_SERVICE,] }] },
|
|
8090
|
+
{ type: exports.InteractionService },
|
|
8091
|
+
{ type: i0.Injector }
|
|
8092
|
+
]; };
|
|
8093
|
+
__decorate([
|
|
8094
|
+
pectin.Trace(),
|
|
8095
|
+
__metadata("design:type", Function),
|
|
8096
|
+
__metadata("design:paramtypes", [i1$1.ActivatedRouteSnapshot, i1$1.RouterStateSnapshot]),
|
|
8097
|
+
__metadata("design:returntype", Promise)
|
|
8098
|
+
], PlaceGuard.prototype, "canActivate", null);
|
|
8099
|
+
__decorate([
|
|
8100
|
+
pectin.Trace(),
|
|
8101
|
+
__metadata("design:type", Function),
|
|
8102
|
+
__metadata("design:paramtypes", [exports.PlaceComponent, i1$1.ActivatedRouteSnapshot, i1$1.RouterStateSnapshot, i1$1.RouterStateSnapshot]),
|
|
8103
|
+
__metadata("design:returntype", Promise)
|
|
8104
|
+
], PlaceGuard.prototype, "canDeactivate", null);
|
|
8105
|
+
__decorate([
|
|
8106
|
+
pectin.Trace(),
|
|
8107
|
+
__metadata("design:type", Function),
|
|
8108
|
+
__metadata("design:paramtypes", [Object]),
|
|
8109
|
+
__metadata("design:returntype", void 0)
|
|
8110
|
+
], PlaceGuard.prototype, "handleGuardResult", null);
|
|
8111
|
+
__decorate([
|
|
8112
|
+
pectin.Trace(),
|
|
8113
|
+
__metadata("design:type", Function),
|
|
8114
|
+
__metadata("design:paramtypes", [i1$1.ActivatedRouteSnapshot, i1$1.RouterStateSnapshot, Function]),
|
|
8115
|
+
__metadata("design:returntype", Promise)
|
|
8116
|
+
], PlaceGuard.prototype, "cleanInteractionState", null);
|
|
8074
8117
|
|
|
8075
8118
|
(function (Formatter) {
|
|
8076
8119
|
var StringType = /** @class */ (function () {
|
|
@@ -8259,6 +8302,7 @@
|
|
|
8259
8302
|
exports.NoopAuthGuard = NoopAuthGuard;
|
|
8260
8303
|
exports.NoopComponent = NoopComponent;
|
|
8261
8304
|
exports.NumberInputComponent = NumberInputComponent;
|
|
8305
|
+
exports.PLACE_AUTH_SERVICE = PLACE_AUTH_SERVICE;
|
|
8262
8306
|
exports.PORTAL_EDITOR_COMPONENT = PORTAL_EDITOR_COMPONENT;
|
|
8263
8307
|
exports.PORTAL_RENDERER_COMPONENT = PORTAL_RENDERER_COMPONENT;
|
|
8264
8308
|
exports.PasswordInputComponent = PasswordInputComponent;
|