@ecodev/natural 47.0.1 → 47.2.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/esm2020/lib/modules/common/services/seo.service.mjs +42 -13
- package/esm2020/lib/modules/icon/icon.component.mjs +6 -3
- package/esm2020/lib/modules/select/select-hierarchic/select-hierarchic.component.mjs +13 -8
- package/fesm2015/ecodev-natural.mjs +119 -86
- package/fesm2015/ecodev-natural.mjs.map +1 -1
- package/fesm2020/ecodev-natural.mjs +122 -86
- package/fesm2020/ecodev-natural.mjs.map +1 -1
- package/lib/modules/common/services/seo.service.d.ts +9 -1
- package/lib/modules/select/select-hierarchic/select-hierarchic.component.d.ts +3 -1
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ import { Subject, BehaviorSubject, of, timer, switchMap as switchMap$1, endWith,
|
|
|
5
5
|
import * as i3 from '@angular/forms';
|
|
6
6
|
import { FormGroup, FormArray, Validators, UntypedFormGroup, UntypedFormArray, FormControl, UntypedFormControl, FormsModule, FormControlDirective, FormControlName, ReactiveFormsModule } from '@angular/forms';
|
|
7
7
|
import * as i2$1 from '@angular/router';
|
|
8
|
-
import { Router, ActivatedRoute, NavigationStart, NavigationEnd, RouterModule, NavigationError, DefaultUrlSerializer } from '@angular/router';
|
|
8
|
+
import { Router, ActivatedRoute, NavigationStart, NavigationEnd, PRIMARY_OUTLET, RouterModule, NavigationError, DefaultUrlSerializer } from '@angular/router';
|
|
9
9
|
import { merge, isArray, pickBy, isEmpty, cloneDeep, uniq, groupBy, mergeWith, defaultsDeep, omit, kebabCase, clone, pick, isEqual, defaults, isObject, intersection, flatten, differenceWith } from 'lodash-es';
|
|
10
10
|
import * as i1 from '@angular/material/legacy-dialog';
|
|
11
11
|
import { MAT_LEGACY_DIALOG_DATA, MatLegacyDialogModule } from '@angular/material/legacy-dialog';
|
|
@@ -5107,6 +5107,9 @@ class NaturalIconComponent {
|
|
|
5107
5107
|
this.fontSize = 24;
|
|
5108
5108
|
this.labelColor = 'accent';
|
|
5109
5109
|
this.labelPosition = 'top-right';
|
|
5110
|
+
this.icon = {
|
|
5111
|
+
name: '',
|
|
5112
|
+
};
|
|
5110
5113
|
this.registerIcons(config);
|
|
5111
5114
|
}
|
|
5112
5115
|
set name(value) {
|
|
@@ -5142,10 +5145,10 @@ class NaturalIconComponent {
|
|
|
5142
5145
|
}
|
|
5143
5146
|
}
|
|
5144
5147
|
NaturalIconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NaturalIconComponent, deps: [{ token: i1$6.MatIconRegistry }, { token: i2$2.DomSanitizer }, { token: IconsConfigService }], target: i0.ɵɵFactoryTarget.Component });
|
|
5145
|
-
NaturalIconComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.2", type: NaturalIconComponent, selector: "natural-icon", inputs: { label: "label", labelColor: "labelColor", labelPosition: "labelPosition", name: "name", size: "size" }, host: { properties: { "style.color": "this.fgColor", "class.material-icons": "this.isMaterialIcon", "class.mat-icon": "this.isIcon", "style.min-width.px": "this.width", "style.min-height.px": "this.height", "style.font-size.px": "this.fontSize" } }, ngImport: i0, template: "<mat-icon *ngIf=\"icon
|
|
5148
|
+
NaturalIconComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.2", type: NaturalIconComponent, selector: "natural-icon", inputs: { label: "label", labelColor: "labelColor", labelPosition: "labelPosition", name: "name", size: "size" }, host: { properties: { "style.color": "this.fgColor", "class.material-icons": "this.isMaterialIcon", "class.mat-icon": "this.isIcon", "style.min-width.px": "this.width", "style.min-height.px": "this.height", "style.font-size.px": "this.fontSize" } }, ngImport: i0, template: "<mat-icon *ngIf=\"icon.font\" [class]=\"icon.class\" [fontIcon]=\"icon.font\"></mat-icon>\n<mat-icon *ngIf=\"icon.svg\" [class]=\"icon.class\" [svgIcon]=\"icon.name\" class=\"svg-icon\"></mat-icon>\n\n<div *ngIf=\"label\" [ngClass]=\"labelColor + ' ' + labelPosition\" class=\"label\">{{ label }}</div>\n", styles: [":host{position:relative}:host mat-icon{background-repeat:inherit;display:inherit;fill:inherit;height:inherit;width:inherit;font-family:inherit;font-weight:inherit;font-style:inherit;font-size:inherit;line-height:inherit;text-transform:inherit;letter-spacing:inherit;word-wrap:inherit;white-space:inherit;direction:inherit;-webkit-font-smoothing:inherit;text-rendering:inherit;-moz-osx-font-smoothing:inherit;font-feature-settings:inherit;min-height:inherit;min-width:inherit;vertical-align:unset}:host .label{position:absolute;padding:2px;border-radius:100%;font-family:Quicksand sans-serif;font-size:14px;line-height:1em;height:14px;min-width:14px;text-align:center}:host .label.top-left{top:0;left:0;transform:translate(-50%)}:host .label.top-right{top:0;right:0;transform:translate(50%)}:host .label.bottom-left{bottom:0;left:0;transform:translate(-50%)}:host .label.bottom-right{bottom:0;right:0;transform:translate(50%)}\n"], dependencies: [{ kind: "directive", type: i1$2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i1$6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
|
|
5146
5149
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NaturalIconComponent, decorators: [{
|
|
5147
5150
|
type: Component,
|
|
5148
|
-
args: [{ selector: 'natural-icon', template: "<mat-icon *ngIf=\"icon
|
|
5151
|
+
args: [{ selector: 'natural-icon', template: "<mat-icon *ngIf=\"icon.font\" [class]=\"icon.class\" [fontIcon]=\"icon.font\"></mat-icon>\n<mat-icon *ngIf=\"icon.svg\" [class]=\"icon.class\" [svgIcon]=\"icon.name\" class=\"svg-icon\"></mat-icon>\n\n<div *ngIf=\"label\" [ngClass]=\"labelColor + ' ' + labelPosition\" class=\"label\">{{ label }}</div>\n", styles: [":host{position:relative}:host mat-icon{background-repeat:inherit;display:inherit;fill:inherit;height:inherit;width:inherit;font-family:inherit;font-weight:inherit;font-style:inherit;font-size:inherit;line-height:inherit;text-transform:inherit;letter-spacing:inherit;word-wrap:inherit;white-space:inherit;direction:inherit;-webkit-font-smoothing:inherit;text-rendering:inherit;-moz-osx-font-smoothing:inherit;font-feature-settings:inherit;min-height:inherit;min-width:inherit;vertical-align:unset}:host .label{position:absolute;padding:2px;border-radius:100%;font-family:Quicksand sans-serif;font-size:14px;line-height:1em;height:14px;min-width:14px;text-align:center}:host .label.top-left{top:0;left:0;transform:translate(-50%)}:host .label.top-right{top:0;right:0;transform:translate(50%)}:host .label.bottom-left{bottom:0;left:0;transform:translate(-50%)}:host .label.bottom-right{bottom:0;right:0;transform:translate(50%)}\n"] }]
|
|
5149
5152
|
}], ctorParameters: function () { return [{ type: i1$6.MatIconRegistry }, { type: i2$2.DomSanitizer }, { type: undefined, decorators: [{
|
|
5150
5153
|
type: Inject,
|
|
5151
5154
|
args: [IconsConfigService]
|
|
@@ -5734,6 +5737,71 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImpor
|
|
|
5734
5737
|
}]
|
|
5735
5738
|
}] });
|
|
5736
5739
|
|
|
5740
|
+
class NaturalDialogTriggerComponent {
|
|
5741
|
+
constructor(dialog, route, router) {
|
|
5742
|
+
this.dialog = dialog;
|
|
5743
|
+
this.route = route;
|
|
5744
|
+
this.router = router;
|
|
5745
|
+
// Data from activated route
|
|
5746
|
+
this.triggerConfig = this.route.snapshot.data.trigger;
|
|
5747
|
+
// Get data relative to dialog service configuration
|
|
5748
|
+
const { data, ...config } = this.triggerConfig.dialogConfig;
|
|
5749
|
+
const dialogConfig = {
|
|
5750
|
+
...config,
|
|
5751
|
+
data: {
|
|
5752
|
+
data: data,
|
|
5753
|
+
// Set data accessible into component instantiated by the dialog service
|
|
5754
|
+
activatedRoute: this.route,
|
|
5755
|
+
},
|
|
5756
|
+
};
|
|
5757
|
+
this.dialogRef = this.dialog.open(this.triggerConfig.component, dialogConfig);
|
|
5758
|
+
// Redirect on closing (if applicable)
|
|
5759
|
+
this.dialogRef.beforeClosed().subscribe(exitValue => this.redirect(exitValue));
|
|
5760
|
+
}
|
|
5761
|
+
/**
|
|
5762
|
+
* Called when router leaves route, and so on, closes the modal with undefined value to prevent a new redirection
|
|
5763
|
+
*/
|
|
5764
|
+
ngOnDestroy() {
|
|
5765
|
+
if (this.dialogRef) {
|
|
5766
|
+
this.dialogRef.close(-1); // -1 = no redirection
|
|
5767
|
+
}
|
|
5768
|
+
}
|
|
5769
|
+
/**
|
|
5770
|
+
* Redirects on modal closing under following rules/conditions
|
|
5771
|
+
*
|
|
5772
|
+
* If -1 : no redirection
|
|
5773
|
+
* If undefined, null or empty string : uses the router provided redirection route or fallbacks on parent route if router don't provide
|
|
5774
|
+
* If a value is provided, should be of type any[] and it's used for redirection.
|
|
5775
|
+
*/
|
|
5776
|
+
redirect(exitValue) {
|
|
5777
|
+
const isEmptyExitValue = exitValue == null || exitValue === ''; // undefined, null or ''
|
|
5778
|
+
if (exitValue === -1) {
|
|
5779
|
+
// if -1, don't redirect
|
|
5780
|
+
return;
|
|
5781
|
+
}
|
|
5782
|
+
else if (!isEmptyExitValue) {
|
|
5783
|
+
// If value provided, redirect to that route
|
|
5784
|
+
this.router.navigate(exitValue);
|
|
5785
|
+
}
|
|
5786
|
+
else if (isEmptyExitValue && this.triggerConfig.afterClosedRoute) {
|
|
5787
|
+
// If value is not provided (null) and router context specified default redirection route, use it
|
|
5788
|
+
this.router.navigate(this.triggerConfig.afterClosedRoute);
|
|
5789
|
+
}
|
|
5790
|
+
else if (isEmptyExitValue) {
|
|
5791
|
+
// If neither of component or router provides redirection, go to parent (care : parent can't have empty path : ''),
|
|
5792
|
+
this.router.navigate(['.'], { relativeTo: this.route.parent });
|
|
5793
|
+
}
|
|
5794
|
+
}
|
|
5795
|
+
}
|
|
5796
|
+
NaturalDialogTriggerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NaturalDialogTriggerComponent, deps: [{ token: i1.MatLegacyDialog }, { token: i2$1.ActivatedRoute }, { token: i2$1.Router }], target: i0.ɵɵFactoryTarget.Component });
|
|
5797
|
+
NaturalDialogTriggerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.2", type: NaturalDialogTriggerComponent, selector: "ng-component", ngImport: i0, template: '', isInline: true });
|
|
5798
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NaturalDialogTriggerComponent, decorators: [{
|
|
5799
|
+
type: Component,
|
|
5800
|
+
args: [{
|
|
5801
|
+
template: '',
|
|
5802
|
+
}]
|
|
5803
|
+
}], ctorParameters: function () { return [{ type: i1.MatLegacyDialog }, { type: i2$1.ActivatedRoute }, { type: i2$1.Router }]; } });
|
|
5804
|
+
|
|
5737
5805
|
const NATURAL_SEO_CONFIG = new InjectionToken('Configuration for SEO service');
|
|
5738
5806
|
function stripTags(str) {
|
|
5739
5807
|
return str.replace(/<\/?[^>]+>/g, '');
|
|
@@ -5747,7 +5815,10 @@ function stripTags(str) {
|
|
|
5747
5815
|
*
|
|
5748
5816
|
* The full title has the following structure:
|
|
5749
5817
|
*
|
|
5750
|
-
* page title - extra part - app name
|
|
5818
|
+
* dialog title - page title - extra part - app name
|
|
5819
|
+
*
|
|
5820
|
+
* `dialog title` only exists if a `NaturalDialogTriggerComponent` is currently open, and that some SEO is
|
|
5821
|
+
* configured for it in the routing.
|
|
5751
5822
|
*/
|
|
5752
5823
|
class NaturalSeoService {
|
|
5753
5824
|
constructor(config, router, titleService, metaTagService) {
|
|
@@ -5756,9 +5827,19 @@ class NaturalSeoService {
|
|
|
5756
5827
|
this.titleService = titleService;
|
|
5757
5828
|
this.metaTagService = metaTagService;
|
|
5758
5829
|
this.router.events.pipe(filter(event => event instanceof NavigationEnd)).subscribe(() => {
|
|
5759
|
-
|
|
5830
|
+
const root = this.router.routerState.root.snapshot;
|
|
5831
|
+
this.routeData = this.getRouteData(root);
|
|
5760
5832
|
const seo = this.routeData.seo ?? { title: '' };
|
|
5761
|
-
const
|
|
5833
|
+
const dialogRouteData = this.getDialogRouteData(root);
|
|
5834
|
+
const dialogSeo = dialogRouteData?.seo;
|
|
5835
|
+
let basic = this.toBasic(seo, this.routeData);
|
|
5836
|
+
if (dialogRouteData && dialogSeo) {
|
|
5837
|
+
const dialogBasic = this.toBasic(dialogSeo, dialogRouteData);
|
|
5838
|
+
basic = {
|
|
5839
|
+
...dialogBasic,
|
|
5840
|
+
title: this.join([dialogBasic.title, basic.title]),
|
|
5841
|
+
};
|
|
5842
|
+
}
|
|
5762
5843
|
this.update(basic);
|
|
5763
5844
|
});
|
|
5764
5845
|
}
|
|
@@ -5775,10 +5856,10 @@ class NaturalSeoService {
|
|
|
5775
5856
|
// Title
|
|
5776
5857
|
const parts = [
|
|
5777
5858
|
seo.title,
|
|
5778
|
-
this.config.extraPart && this.routeData ? this.config.extraPart(this.routeData) :
|
|
5859
|
+
this.config.extraPart && this.routeData ? this.config.extraPart(this.routeData) : '',
|
|
5779
5860
|
this.config.applicationName,
|
|
5780
5861
|
];
|
|
5781
|
-
const title =
|
|
5862
|
+
const title = this.join(parts);
|
|
5782
5863
|
this.titleService.setTitle(title);
|
|
5783
5864
|
// Description
|
|
5784
5865
|
const description = seo?.description ?? this.config.defaultDescription;
|
|
@@ -5787,6 +5868,9 @@ class NaturalSeoService {
|
|
|
5787
5868
|
const robots = seo?.robots ?? this.config.defaultRobots;
|
|
5788
5869
|
this.updateTag('robots', robots);
|
|
5789
5870
|
}
|
|
5871
|
+
join(parts) {
|
|
5872
|
+
return parts.filter(s => !!s).join(' - ');
|
|
5873
|
+
}
|
|
5790
5874
|
updateTag(name, value) {
|
|
5791
5875
|
if (value) {
|
|
5792
5876
|
this.metaTagService.updateTag({
|
|
@@ -5806,18 +5890,30 @@ class NaturalSeoService {
|
|
|
5806
5890
|
return this.getRouteData(route.firstChild);
|
|
5807
5891
|
}
|
|
5808
5892
|
else {
|
|
5809
|
-
return route.data
|
|
5893
|
+
return route.data;
|
|
5810
5894
|
}
|
|
5811
5895
|
}
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5896
|
+
/**
|
|
5897
|
+
* Returns the data from the `NaturalDialogTriggerComponent` if one is open
|
|
5898
|
+
*/
|
|
5899
|
+
getDialogRouteData(route) {
|
|
5900
|
+
if (route.component === NaturalDialogTriggerComponent && route.outlet !== PRIMARY_OUTLET) {
|
|
5901
|
+
return route.data;
|
|
5902
|
+
}
|
|
5903
|
+
for (const child of route.children) {
|
|
5904
|
+
const data = this.getDialogRouteData(child);
|
|
5905
|
+
if (data) {
|
|
5906
|
+
return data;
|
|
5907
|
+
}
|
|
5815
5908
|
}
|
|
5909
|
+
return null;
|
|
5910
|
+
}
|
|
5911
|
+
toBasic(seo, routeData) {
|
|
5816
5912
|
if (typeof seo === 'function') {
|
|
5817
|
-
return seo(
|
|
5913
|
+
return seo(routeData);
|
|
5818
5914
|
}
|
|
5819
5915
|
else if ('resolveKey' in seo) {
|
|
5820
|
-
const data =
|
|
5916
|
+
const data = routeData[seo.resolveKey];
|
|
5821
5917
|
if (!data) {
|
|
5822
5918
|
throw new Error('Could not find resolved data for SEO service with key: ' + seo.resolveKey);
|
|
5823
5919
|
}
|
|
@@ -8172,6 +8268,12 @@ class NaturalSelectHierarchicComponent extends AbstractSelect {
|
|
|
8172
8268
|
constructor(hierarchicSelectorDialogService, ngControl) {
|
|
8173
8269
|
super(ngControl);
|
|
8174
8270
|
this.hierarchicSelectorDialogService = hierarchicSelectorDialogService;
|
|
8271
|
+
/**
|
|
8272
|
+
* Configuration for hierarchic relations
|
|
8273
|
+
*
|
|
8274
|
+
* It should be an array with at least one element with `selectableAtKey` configured, otherwise the selector will never open.
|
|
8275
|
+
*/
|
|
8276
|
+
this.config = null;
|
|
8175
8277
|
/**
|
|
8176
8278
|
* The selected value as an object. The internal value is `internalCtrl.value`, and that is a string.
|
|
8177
8279
|
*/
|
|
@@ -8205,11 +8307,14 @@ class NaturalSelectHierarchicComponent extends AbstractSelect {
|
|
|
8205
8307
|
if (this.lockOpenDialog) {
|
|
8206
8308
|
return;
|
|
8207
8309
|
}
|
|
8310
|
+
const selectAtKey = this.getSelectKey();
|
|
8311
|
+
if (!selectAtKey || !this.config) {
|
|
8312
|
+
return;
|
|
8313
|
+
}
|
|
8208
8314
|
this.lockOpenDialog = true;
|
|
8209
8315
|
if (this.onTouched) {
|
|
8210
8316
|
this.onTouched();
|
|
8211
8317
|
}
|
|
8212
|
-
const selectAtKey = this.getSelectKey();
|
|
8213
8318
|
const selected = {};
|
|
8214
8319
|
if (this.internalCtrl.value) {
|
|
8215
8320
|
selected[selectAtKey] = [this.value];
|
|
@@ -8237,14 +8342,10 @@ class NaturalSelectHierarchicComponent extends AbstractSelect {
|
|
|
8237
8342
|
});
|
|
8238
8343
|
}
|
|
8239
8344
|
showSelectButton() {
|
|
8240
|
-
return !!(this.internalCtrl?.enabled && this.selectLabel && this.
|
|
8345
|
+
return !!(this.internalCtrl?.enabled && this.selectLabel && this.getSelectKey());
|
|
8241
8346
|
}
|
|
8242
8347
|
getSelectKey() {
|
|
8243
|
-
|
|
8244
|
-
if (!selectKey) {
|
|
8245
|
-
throw new Error('Hierarchic selector must be configured with at least one selectableAtKey');
|
|
8246
|
-
}
|
|
8247
|
-
return selectKey;
|
|
8348
|
+
return this.config?.filter(c => !!c.selectableAtKey)[0]?.selectableAtKey;
|
|
8248
8349
|
}
|
|
8249
8350
|
}
|
|
8250
8351
|
NaturalSelectHierarchicComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NaturalSelectHierarchicComponent, deps: [{ token: NaturalHierarchicSelectorDialogService }, { token: i3.NgControl, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
@@ -10370,71 +10471,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImpor
|
|
|
10370
10471
|
* Public API Surface of natural
|
|
10371
10472
|
*/
|
|
10372
10473
|
|
|
10373
|
-
class NaturalDialogTriggerComponent {
|
|
10374
|
-
constructor(dialog, route, router) {
|
|
10375
|
-
this.dialog = dialog;
|
|
10376
|
-
this.route = route;
|
|
10377
|
-
this.router = router;
|
|
10378
|
-
// Data from activated route
|
|
10379
|
-
this.triggerConfig = this.route.snapshot.data.trigger;
|
|
10380
|
-
// Get data relative to dialog service configuration
|
|
10381
|
-
const { data, ...config } = this.triggerConfig.dialogConfig;
|
|
10382
|
-
const dialogConfig = {
|
|
10383
|
-
...config,
|
|
10384
|
-
data: {
|
|
10385
|
-
data: data,
|
|
10386
|
-
// Set data accessible into component instantiated by the dialog service
|
|
10387
|
-
activatedRoute: this.route,
|
|
10388
|
-
},
|
|
10389
|
-
};
|
|
10390
|
-
this.dialogRef = this.dialog.open(this.triggerConfig.component, dialogConfig);
|
|
10391
|
-
// Redirect on closing (if applicable)
|
|
10392
|
-
this.dialogRef.beforeClosed().subscribe(exitValue => this.redirect(exitValue));
|
|
10393
|
-
}
|
|
10394
|
-
/**
|
|
10395
|
-
* Called when router leaves route, and so on, closes the modal with undefined value to prevent a new redirection
|
|
10396
|
-
*/
|
|
10397
|
-
ngOnDestroy() {
|
|
10398
|
-
if (this.dialogRef) {
|
|
10399
|
-
this.dialogRef.close(-1); // -1 = no redirection
|
|
10400
|
-
}
|
|
10401
|
-
}
|
|
10402
|
-
/**
|
|
10403
|
-
* Redirects on modal closing under following rules/conditions
|
|
10404
|
-
*
|
|
10405
|
-
* If -1 : no redirection
|
|
10406
|
-
* If undefined, null or empty string : uses the router provided redirection route or fallbacks on parent route if router don't provide
|
|
10407
|
-
* If a value is provided, should be of type any[] and it's used for redirection.
|
|
10408
|
-
*/
|
|
10409
|
-
redirect(exitValue) {
|
|
10410
|
-
const isEmptyExitValue = exitValue == null || exitValue === ''; // undefined, null or ''
|
|
10411
|
-
if (exitValue === -1) {
|
|
10412
|
-
// if -1, don't redirect
|
|
10413
|
-
return;
|
|
10414
|
-
}
|
|
10415
|
-
else if (!isEmptyExitValue) {
|
|
10416
|
-
// If value provided, redirect to that route
|
|
10417
|
-
this.router.navigate(exitValue);
|
|
10418
|
-
}
|
|
10419
|
-
else if (isEmptyExitValue && this.triggerConfig.afterClosedRoute) {
|
|
10420
|
-
// If value is not provided (null) and router context specified default redirection route, use it
|
|
10421
|
-
this.router.navigate(this.triggerConfig.afterClosedRoute);
|
|
10422
|
-
}
|
|
10423
|
-
else if (isEmptyExitValue) {
|
|
10424
|
-
// If neither of component or router provides redirection, go to parent (care : parent can't have empty path : ''),
|
|
10425
|
-
this.router.navigate(['.'], { relativeTo: this.route.parent });
|
|
10426
|
-
}
|
|
10427
|
-
}
|
|
10428
|
-
}
|
|
10429
|
-
NaturalDialogTriggerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NaturalDialogTriggerComponent, deps: [{ token: i1.MatLegacyDialog }, { token: i2$1.ActivatedRoute }, { token: i2$1.Router }], target: i0.ɵɵFactoryTarget.Component });
|
|
10430
|
-
NaturalDialogTriggerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.2", type: NaturalDialogTriggerComponent, selector: "ng-component", ngImport: i0, template: '', isInline: true });
|
|
10431
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NaturalDialogTriggerComponent, decorators: [{
|
|
10432
|
-
type: Component,
|
|
10433
|
-
args: [{
|
|
10434
|
-
template: '',
|
|
10435
|
-
}]
|
|
10436
|
-
}], ctorParameters: function () { return [{ type: i1.MatLegacyDialog }, { type: i2$1.ActivatedRoute }, { type: i2$1.Router }]; } });
|
|
10437
|
-
|
|
10438
10474
|
class NaturalDialogTriggerModule {
|
|
10439
10475
|
}
|
|
10440
10476
|
NaturalDialogTriggerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NaturalDialogTriggerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|