@ecodev/natural 47.1.0 → 47.3.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/dropdown-components/type-natural-select/type-natural-select.component.mjs +1 -1
- package/esm2020/lib/modules/icon/icon.component.mjs +6 -3
- package/esm2020/lib/modules/relations/relations.component.mjs +1 -1
- package/esm2020/lib/modules/select/select/select.component.mjs +48 -16
- package/fesm2015/ecodev-natural.mjs +156 -96
- package/fesm2015/ecodev-natural.mjs.map +1 -1
- package/fesm2020/ecodev-natural.mjs +159 -96
- package/fesm2020/ecodev-natural.mjs.map +1 -1
- package/lib/modules/common/services/seo.service.d.ts +9 -1
- package/lib/modules/select/select/select.component.d.ts +25 -9
- 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';
|
|
@@ -49,6 +49,7 @@ import * as i2$2 from '@angular/platform-browser';
|
|
|
49
49
|
import * as i7$1 from '@angular/material/legacy-tooltip';
|
|
50
50
|
import { MatLegacyTooltipModule } from '@angular/material/legacy-tooltip';
|
|
51
51
|
import * as i1$7 from '@angular/material/legacy-tabs';
|
|
52
|
+
import { __rest } from 'tslib';
|
|
52
53
|
import * as i4$4 from '@angular/material/legacy-list';
|
|
53
54
|
import { MatLegacySelectionList, MatLegacyListModule } from '@angular/material/legacy-list';
|
|
54
55
|
import * as i2$3 from '@angular/material/legacy-autocomplete';
|
|
@@ -67,7 +68,6 @@ import * as i9 from '@angular/material/legacy-paginator';
|
|
|
67
68
|
import { MatLegacyPaginatorModule } from '@angular/material/legacy-paginator';
|
|
68
69
|
import * as i3$4 from '@angular/material/sidenav';
|
|
69
70
|
import { MatSidenavContainer, MatSidenav, MatSidenavModule } from '@angular/material/sidenav';
|
|
70
|
-
import { __rest } from 'tslib';
|
|
71
71
|
import * as i1$8 from '@angular/common/http';
|
|
72
72
|
import { HttpHeaders, HttpClientModule } from '@angular/common/http';
|
|
73
73
|
|
|
@@ -5122,6 +5122,9 @@ class NaturalIconComponent {
|
|
|
5122
5122
|
this.fontSize = 24;
|
|
5123
5123
|
this.labelColor = 'accent';
|
|
5124
5124
|
this.labelPosition = 'top-right';
|
|
5125
|
+
this.icon = {
|
|
5126
|
+
name: '',
|
|
5127
|
+
};
|
|
5125
5128
|
this.registerIcons(config);
|
|
5126
5129
|
}
|
|
5127
5130
|
set name(value) {
|
|
@@ -5157,10 +5160,10 @@ class NaturalIconComponent {
|
|
|
5157
5160
|
}
|
|
5158
5161
|
}
|
|
5159
5162
|
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 });
|
|
5160
|
-
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
|
|
5163
|
+
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"] }] });
|
|
5161
5164
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NaturalIconComponent, decorators: [{
|
|
5162
5165
|
type: Component,
|
|
5163
|
-
args: [{ selector: 'natural-icon', template: "<mat-icon *ngIf=\"icon
|
|
5166
|
+
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"] }]
|
|
5164
5167
|
}], ctorParameters: function () {
|
|
5165
5168
|
return [{ type: i1$6.MatIconRegistry }, { type: i2$2.DomSanitizer }, { type: undefined, decorators: [{
|
|
5166
5169
|
type: Inject,
|
|
@@ -5760,6 +5763,68 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImpor
|
|
|
5760
5763
|
}]
|
|
5761
5764
|
}] });
|
|
5762
5765
|
|
|
5766
|
+
class NaturalDialogTriggerComponent {
|
|
5767
|
+
constructor(dialog, route, router) {
|
|
5768
|
+
this.dialog = dialog;
|
|
5769
|
+
this.route = route;
|
|
5770
|
+
this.router = router;
|
|
5771
|
+
// Data from activated route
|
|
5772
|
+
this.triggerConfig = this.route.snapshot.data.trigger;
|
|
5773
|
+
// Get data relative to dialog service configuration
|
|
5774
|
+
const _a = this.triggerConfig.dialogConfig, { data } = _a, config = __rest(_a, ["data"]);
|
|
5775
|
+
const dialogConfig = Object.assign(Object.assign({}, config), { data: {
|
|
5776
|
+
data: data,
|
|
5777
|
+
// Set data accessible into component instantiated by the dialog service
|
|
5778
|
+
activatedRoute: this.route,
|
|
5779
|
+
} });
|
|
5780
|
+
this.dialogRef = this.dialog.open(this.triggerConfig.component, dialogConfig);
|
|
5781
|
+
// Redirect on closing (if applicable)
|
|
5782
|
+
this.dialogRef.beforeClosed().subscribe(exitValue => this.redirect(exitValue));
|
|
5783
|
+
}
|
|
5784
|
+
/**
|
|
5785
|
+
* Called when router leaves route, and so on, closes the modal with undefined value to prevent a new redirection
|
|
5786
|
+
*/
|
|
5787
|
+
ngOnDestroy() {
|
|
5788
|
+
if (this.dialogRef) {
|
|
5789
|
+
this.dialogRef.close(-1); // -1 = no redirection
|
|
5790
|
+
}
|
|
5791
|
+
}
|
|
5792
|
+
/**
|
|
5793
|
+
* Redirects on modal closing under following rules/conditions
|
|
5794
|
+
*
|
|
5795
|
+
* If -1 : no redirection
|
|
5796
|
+
* If undefined, null or empty string : uses the router provided redirection route or fallbacks on parent route if router don't provide
|
|
5797
|
+
* If a value is provided, should be of type any[] and it's used for redirection.
|
|
5798
|
+
*/
|
|
5799
|
+
redirect(exitValue) {
|
|
5800
|
+
const isEmptyExitValue = exitValue == null || exitValue === ''; // undefined, null or ''
|
|
5801
|
+
if (exitValue === -1) {
|
|
5802
|
+
// if -1, don't redirect
|
|
5803
|
+
return;
|
|
5804
|
+
}
|
|
5805
|
+
else if (!isEmptyExitValue) {
|
|
5806
|
+
// If value provided, redirect to that route
|
|
5807
|
+
this.router.navigate(exitValue);
|
|
5808
|
+
}
|
|
5809
|
+
else if (isEmptyExitValue && this.triggerConfig.afterClosedRoute) {
|
|
5810
|
+
// If value is not provided (null) and router context specified default redirection route, use it
|
|
5811
|
+
this.router.navigate(this.triggerConfig.afterClosedRoute);
|
|
5812
|
+
}
|
|
5813
|
+
else if (isEmptyExitValue) {
|
|
5814
|
+
// If neither of component or router provides redirection, go to parent (care : parent can't have empty path : ''),
|
|
5815
|
+
this.router.navigate(['.'], { relativeTo: this.route.parent });
|
|
5816
|
+
}
|
|
5817
|
+
}
|
|
5818
|
+
}
|
|
5819
|
+
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 });
|
|
5820
|
+
NaturalDialogTriggerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.2", type: NaturalDialogTriggerComponent, selector: "ng-component", ngImport: i0, template: '', isInline: true });
|
|
5821
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NaturalDialogTriggerComponent, decorators: [{
|
|
5822
|
+
type: Component,
|
|
5823
|
+
args: [{
|
|
5824
|
+
template: '',
|
|
5825
|
+
}]
|
|
5826
|
+
}], ctorParameters: function () { return [{ type: i1.MatLegacyDialog }, { type: i2$1.ActivatedRoute }, { type: i2$1.Router }]; } });
|
|
5827
|
+
|
|
5763
5828
|
const NATURAL_SEO_CONFIG = new InjectionToken('Configuration for SEO service');
|
|
5764
5829
|
function stripTags(str) {
|
|
5765
5830
|
return str.replace(/<\/?[^>]+>/g, '');
|
|
@@ -5773,7 +5838,10 @@ function stripTags(str) {
|
|
|
5773
5838
|
*
|
|
5774
5839
|
* The full title has the following structure:
|
|
5775
5840
|
*
|
|
5776
|
-
* page title - extra part - app name
|
|
5841
|
+
* dialog title - page title - extra part - app name
|
|
5842
|
+
*
|
|
5843
|
+
* `dialog title` only exists if a `NaturalDialogTriggerComponent` is currently open, and that some SEO is
|
|
5844
|
+
* configured for it in the routing.
|
|
5777
5845
|
*/
|
|
5778
5846
|
class NaturalSeoService {
|
|
5779
5847
|
constructor(config, router, titleService, metaTagService) {
|
|
@@ -5783,9 +5851,16 @@ class NaturalSeoService {
|
|
|
5783
5851
|
this.metaTagService = metaTagService;
|
|
5784
5852
|
this.router.events.pipe(filter(event => event instanceof NavigationEnd)).subscribe(() => {
|
|
5785
5853
|
var _a;
|
|
5786
|
-
|
|
5854
|
+
const root = this.router.routerState.root.snapshot;
|
|
5855
|
+
this.routeData = this.getRouteData(root);
|
|
5787
5856
|
const seo = (_a = this.routeData.seo) !== null && _a !== void 0 ? _a : { title: '' };
|
|
5788
|
-
const
|
|
5857
|
+
const dialogRouteData = this.getDialogRouteData(root);
|
|
5858
|
+
const dialogSeo = dialogRouteData === null || dialogRouteData === void 0 ? void 0 : dialogRouteData.seo;
|
|
5859
|
+
let basic = this.toBasic(seo, this.routeData);
|
|
5860
|
+
if (dialogRouteData && dialogSeo) {
|
|
5861
|
+
const dialogBasic = this.toBasic(dialogSeo, dialogRouteData);
|
|
5862
|
+
basic = Object.assign(Object.assign({}, dialogBasic), { title: this.join([dialogBasic.title, basic.title]) });
|
|
5863
|
+
}
|
|
5789
5864
|
this.update(basic);
|
|
5790
5865
|
});
|
|
5791
5866
|
}
|
|
@@ -5803,10 +5878,10 @@ class NaturalSeoService {
|
|
|
5803
5878
|
// Title
|
|
5804
5879
|
const parts = [
|
|
5805
5880
|
seo.title,
|
|
5806
|
-
this.config.extraPart && this.routeData ? this.config.extraPart(this.routeData) :
|
|
5881
|
+
this.config.extraPart && this.routeData ? this.config.extraPart(this.routeData) : '',
|
|
5807
5882
|
this.config.applicationName,
|
|
5808
5883
|
];
|
|
5809
|
-
const title =
|
|
5884
|
+
const title = this.join(parts);
|
|
5810
5885
|
this.titleService.setTitle(title);
|
|
5811
5886
|
// Description
|
|
5812
5887
|
const description = (_a = seo === null || seo === void 0 ? void 0 : seo.description) !== null && _a !== void 0 ? _a : this.config.defaultDescription;
|
|
@@ -5815,6 +5890,9 @@ class NaturalSeoService {
|
|
|
5815
5890
|
const robots = (_b = seo === null || seo === void 0 ? void 0 : seo.robots) !== null && _b !== void 0 ? _b : this.config.defaultRobots;
|
|
5816
5891
|
this.updateTag('robots', robots);
|
|
5817
5892
|
}
|
|
5893
|
+
join(parts) {
|
|
5894
|
+
return parts.filter(s => !!s).join(' - ');
|
|
5895
|
+
}
|
|
5818
5896
|
updateTag(name, value) {
|
|
5819
5897
|
if (value) {
|
|
5820
5898
|
this.metaTagService.updateTag({
|
|
@@ -5830,24 +5908,35 @@ class NaturalSeoService {
|
|
|
5830
5908
|
* Returns the data from the most deep/specific activated route
|
|
5831
5909
|
*/
|
|
5832
5910
|
getRouteData(route) {
|
|
5833
|
-
var _a;
|
|
5834
5911
|
if (route.firstChild) {
|
|
5835
5912
|
return this.getRouteData(route.firstChild);
|
|
5836
5913
|
}
|
|
5837
5914
|
else {
|
|
5838
|
-
return
|
|
5915
|
+
return route.data;
|
|
5839
5916
|
}
|
|
5840
5917
|
}
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
|
|
5844
|
-
|
|
5918
|
+
/**
|
|
5919
|
+
* Returns the data from the `NaturalDialogTriggerComponent` if one is open
|
|
5920
|
+
*/
|
|
5921
|
+
getDialogRouteData(route) {
|
|
5922
|
+
if (route.component === NaturalDialogTriggerComponent && route.outlet !== PRIMARY_OUTLET) {
|
|
5923
|
+
return route.data;
|
|
5845
5924
|
}
|
|
5925
|
+
for (const child of route.children) {
|
|
5926
|
+
const data = this.getDialogRouteData(child);
|
|
5927
|
+
if (data) {
|
|
5928
|
+
return data;
|
|
5929
|
+
}
|
|
5930
|
+
}
|
|
5931
|
+
return null;
|
|
5932
|
+
}
|
|
5933
|
+
toBasic(seo, routeData) {
|
|
5934
|
+
var _a, _b, _c, _d, _e;
|
|
5846
5935
|
if (typeof seo === 'function') {
|
|
5847
|
-
return seo(
|
|
5936
|
+
return seo(routeData);
|
|
5848
5937
|
}
|
|
5849
5938
|
else if ('resolveKey' in seo) {
|
|
5850
|
-
const data =
|
|
5939
|
+
const data = routeData[seo.resolveKey];
|
|
5851
5940
|
if (!data) {
|
|
5852
5941
|
throw new Error('Could not find resolved data for SEO service with key: ' + seo.resolveKey);
|
|
5853
5942
|
}
|
|
@@ -6406,28 +6495,40 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImpor
|
|
|
6406
6495
|
|
|
6407
6496
|
/**
|
|
6408
6497
|
* Default usage:
|
|
6409
|
-
*
|
|
6498
|
+
* ```html
|
|
6499
|
+
* <natural-select [service]="myServiceInstance" [(model)]="myModel" (modelChange)=myChangeFn($event)></natural-select>
|
|
6500
|
+
* ```
|
|
6410
6501
|
*
|
|
6411
6502
|
* Custom template usage :
|
|
6503
|
+
* ```html
|
|
6412
6504
|
* <natural-select [service]="svc" [(ngModel)]="model">
|
|
6413
6505
|
* <ng-template let-item="item">
|
|
6414
6506
|
* <span>{{ item.xxx }}</span>
|
|
6415
6507
|
* </ng-template>
|
|
6416
6508
|
* </natural-select>
|
|
6509
|
+
* ```
|
|
6417
6510
|
*
|
|
6418
|
-
* [(ngModel)] and (ngModelChange) are optional
|
|
6511
|
+
* `[(ngModel)]` and `(ngModelChange)` are optional.
|
|
6419
6512
|
*
|
|
6420
6513
|
* Placeholder :
|
|
6421
|
-
*
|
|
6514
|
+
* ```html
|
|
6515
|
+
* <natural-select placeholder="my placeholder"></natural-select>
|
|
6516
|
+
* ```
|
|
6422
6517
|
*
|
|
6423
6518
|
* Never float placeholder :
|
|
6424
|
-
*
|
|
6519
|
+
* ```html
|
|
6520
|
+
* <natural-select placeholder="my placeholder" floatPlaceholder="never"></natural-select>
|
|
6521
|
+
* ```
|
|
6425
6522
|
*
|
|
6426
|
-
* Search with like %xxx% on specified
|
|
6427
|
-
*
|
|
6523
|
+
* Search with like %xxx% on specified field `name` instead of custom filter on whole object
|
|
6524
|
+
* ```html
|
|
6525
|
+
* <natural-select searchField="name"></natural-select>
|
|
6526
|
+
* ```
|
|
6428
6527
|
*
|
|
6429
6528
|
* Allows to input free string without selecting an option from autocomplete suggestions
|
|
6430
|
-
*
|
|
6529
|
+
* ```html
|
|
6530
|
+
* <natural-select [optionRequired]="false"></natural-select>
|
|
6531
|
+
* ```
|
|
6431
6532
|
*/
|
|
6432
6533
|
class NaturalSelectComponent extends AbstractSelect {
|
|
6433
6534
|
constructor() {
|
|
@@ -6437,9 +6538,13 @@ class NaturalSelectComponent extends AbstractSelect {
|
|
|
6437
6538
|
*/
|
|
6438
6539
|
this.optionRequired = true;
|
|
6439
6540
|
/**
|
|
6440
|
-
* The
|
|
6541
|
+
* The field on which to search for, default to 'custom'.
|
|
6441
6542
|
*/
|
|
6442
6543
|
this.searchField = 'custom';
|
|
6544
|
+
/**
|
|
6545
|
+
* The operator with which to search for, default to 'search' if `searchField` is 'custom', else 'like'.
|
|
6546
|
+
*/
|
|
6547
|
+
this.searchOperator = null;
|
|
6443
6548
|
/**
|
|
6444
6549
|
* Items returned by server to show in listing
|
|
6445
6550
|
*/
|
|
@@ -6561,18 +6666,33 @@ class NaturalSelectComponent extends AbstractSelect {
|
|
|
6561
6666
|
return ((_a = this.internalCtrl) === null || _a === void 0 ? void 0 : _a.enabled) && !!this.clearLabel && !!this.internalCtrl.value;
|
|
6562
6667
|
}
|
|
6563
6668
|
getSearchFilter(term) {
|
|
6564
|
-
|
|
6565
|
-
if (
|
|
6566
|
-
|
|
6669
|
+
var _a;
|
|
6670
|
+
if (!term) {
|
|
6671
|
+
return {};
|
|
6567
6672
|
}
|
|
6568
|
-
|
|
6569
|
-
|
|
6673
|
+
const searchOperator = (_a = this.searchOperator) !== null && _a !== void 0 ? _a : (this.searchField === 'custom' ? 'search' : 'like');
|
|
6674
|
+
if (searchOperator === 'like') {
|
|
6675
|
+
term = '%' + term + '%';
|
|
6570
6676
|
}
|
|
6571
|
-
return {
|
|
6677
|
+
return {
|
|
6678
|
+
filter: {
|
|
6679
|
+
groups: [
|
|
6680
|
+
{
|
|
6681
|
+
conditions: [
|
|
6682
|
+
{
|
|
6683
|
+
[this.searchField]: {
|
|
6684
|
+
[searchOperator]: { value: term },
|
|
6685
|
+
},
|
|
6686
|
+
},
|
|
6687
|
+
],
|
|
6688
|
+
},
|
|
6689
|
+
],
|
|
6690
|
+
},
|
|
6691
|
+
};
|
|
6572
6692
|
}
|
|
6573
6693
|
}
|
|
6574
6694
|
NaturalSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NaturalSelectComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
6575
|
-
NaturalSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.2", type: NaturalSelectComponent, selector: "natural-select", inputs: { service: "service", optionRequired: "optionRequired", searchField: "searchField", filter: "filter", disabled: "disabled" }, queries: [{ propertyName: "itemTemplate", first: true, predicate: TemplateRef, descendants: true }], viewQueries: [{ propertyName: "autoTrigger", first: true, predicate: MatLegacyAutocompleteTrigger, descendants: true }], usesInheritance: true, ngImport: i0, template: "<!-- Autocomplete menu -->\n<mat-autocomplete\n #ac=\"matAutocomplete\"\n (optionSelected)=\"propagateValue($event.option.value)\"\n [displayWith]=\"getDisplayFn()\"\n panelWidth=\"auto !important\"\n>\n <mat-option *ngFor=\"let item of items | async\" [value]=\"item\">\n <ng-template\n [ngTemplateOutletContext]=\"{item: item}\"\n [ngTemplateOutlet]=\"itemTemplate ? itemTemplate : defaultACItem\"\n ></ng-template>\n </mat-option>\n <div *ngIf=\"moreNbItems > 0\" class=\"mat-caption\" i18n style=\"padding: 5px 10px\"\n >{{ moreNbItems }} \u00E9l\u00E9ment(s) suppl\u00E9mentaire(s)</div\n >\n</mat-autocomplete>\n\n<ng-template #defaultACItem let-item=\"item\">\n <span>{{ getDisplayFn()(item) }}</span>\n</ng-template>\n\n<!-- Input for autocomplete -->\n<mat-form-field [floatLabel]=\"floatPlaceholder\">\n <mat-label>{{ placeholder }}</mat-label>\n\n <input\n (blur)=\"touch(); blur.emit()\"\n (change)=\"onInternalFormChange()\"\n (click)=\"autoTrigger.openPanel()\"\n (focus)=\"startSearch()\"\n (keydown.esc)=\"clear()\"\n [formControl]=\"internalCtrl\"\n [matAutocomplete]=\"ac\"\n aria-label=\"Recherche et s\u00E9lection\"\n i18n-aria-label\n matInput\n [errorStateMatcher]=\"matcher\"\n />\n\n <!-- Meta data -->\n <natural-icon *ngIf=\"!loading && showIcon\" [name]=\"icon\" matPrefix></natural-icon>\n <mat-progress-spinner\n *ngIf=\"loading\"\n [diameter]=\"21\"\n [strokeWidth]=\"5\"\n matPrefix\n mode=\"indeterminate\"\n ></mat-progress-spinner>\n\n <!-- Clear button -->\n <div class=\"suffix-buttons\" matSuffix>\n <button\n (click)=\"clear(); $event.stopPropagation()\"\n *ngIf=\"internalCtrl.value && internalCtrl.enabled && !clearLabel\"\n mat-icon-button\n i18n-matTooltip\n matTooltip=\"D\u00E9s\u00E9lectionner\"\n >\n <natural-icon name=\"close\"></natural-icon>\n </button>\n <button\n *ngIf=\"internalCtrl.value && navigateTo\"\n [routerLink]=\"navigateTo\"\n (click)=\"$event.stopPropagation()\"\n mat-button\n mat-icon-button\n i18n-matTooltip\n matTooltip=\"Naviguer vers\"\n >\n <natural-icon name=\"open_in_browser\"></natural-icon>\n </button>\n </div>\n\n <mat-error *ngIf=\"hasRequiredError()\" i18n>Ce champ est requis</mat-error>\n</mat-form-field>\n\n<!-- Additional (un)select/(un)link buttons for more visual cohesion with natural-relations --><!-- [clearLabel] and/or [selectLabel] has to be given as attribute input -->\n<div *ngIf=\"showClearButton()\" class=\"external-buttons\">\n <button (click)=\"clear()\" *ngIf=\"showClearButton()\" color=\"warn\" mat-button>{{ clearLabel }}</button>\n</div>\n", styles: [":host{display:flex;flex-direction:column}:host>*:not(:last-child){margin-bottom:20px}:host>mat-autocomplete{margin-bottom:0!important}:host .suffix-buttons,:host .external-buttons{display:flex;flex-direction:row}:host .external-buttons{display:flex;flex-direction:row}:host .external-buttons>*:not(:last-child){margin-right:10px}\n"], dependencies: [{ kind: "directive", type: i1$2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i2$3.MatLegacyAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { kind: "directive", type: i2$3.MatLegacyAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { kind: "component", type: i5$1.MatLegacyOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "component", type: i4.MatLegacyButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i4$2.MatLegacyError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: i4$2.MatLegacyFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4$2.MatLegacyLabel, selector: "mat-label" }, { kind: "directive", type: i4$2.MatLegacyPrefix, selector: "[matPrefix]" }, { kind: "directive", type: i4$2.MatLegacySuffix, selector: "[matSuffix]" }, { kind: "directive", type: i5.MatLegacyInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", exportAs: ["matInput"] }, { kind: "component", type: i7$2.MatLegacyProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "diameter", "strokeWidth", "mode", "value"], exportAs: ["matProgressSpinner"] }, { kind: "directive", type: i7$1.MatLegacyTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: NaturalIconComponent, selector: "natural-icon", inputs: ["label", "labelColor", "labelPosition", "name", "size"] }, { kind: "directive", type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "pipe", type: i1$2.AsyncPipe, name: "async" }] });
|
|
6695
|
+
NaturalSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.2", type: NaturalSelectComponent, selector: "natural-select", inputs: { service: "service", optionRequired: "optionRequired", searchField: "searchField", searchOperator: "searchOperator", filter: "filter", disabled: "disabled" }, queries: [{ propertyName: "itemTemplate", first: true, predicate: TemplateRef, descendants: true }], viewQueries: [{ propertyName: "autoTrigger", first: true, predicate: MatLegacyAutocompleteTrigger, descendants: true }], usesInheritance: true, ngImport: i0, template: "<!-- Autocomplete menu -->\n<mat-autocomplete\n #ac=\"matAutocomplete\"\n (optionSelected)=\"propagateValue($event.option.value)\"\n [displayWith]=\"getDisplayFn()\"\n panelWidth=\"auto !important\"\n>\n <mat-option *ngFor=\"let item of items | async\" [value]=\"item\">\n <ng-template\n [ngTemplateOutletContext]=\"{item: item}\"\n [ngTemplateOutlet]=\"itemTemplate ? itemTemplate : defaultACItem\"\n ></ng-template>\n </mat-option>\n <div *ngIf=\"moreNbItems > 0\" class=\"mat-caption\" i18n style=\"padding: 5px 10px\"\n >{{ moreNbItems }} \u00E9l\u00E9ment(s) suppl\u00E9mentaire(s)</div\n >\n</mat-autocomplete>\n\n<ng-template #defaultACItem let-item=\"item\">\n <span>{{ getDisplayFn()(item) }}</span>\n</ng-template>\n\n<!-- Input for autocomplete -->\n<mat-form-field [floatLabel]=\"floatPlaceholder\">\n <mat-label>{{ placeholder }}</mat-label>\n\n <input\n (blur)=\"touch(); blur.emit()\"\n (change)=\"onInternalFormChange()\"\n (click)=\"autoTrigger.openPanel()\"\n (focus)=\"startSearch()\"\n (keydown.esc)=\"clear()\"\n [formControl]=\"internalCtrl\"\n [matAutocomplete]=\"ac\"\n aria-label=\"Recherche et s\u00E9lection\"\n i18n-aria-label\n matInput\n [errorStateMatcher]=\"matcher\"\n />\n\n <!-- Meta data -->\n <natural-icon *ngIf=\"!loading && showIcon\" [name]=\"icon\" matPrefix></natural-icon>\n <mat-progress-spinner\n *ngIf=\"loading\"\n [diameter]=\"21\"\n [strokeWidth]=\"5\"\n matPrefix\n mode=\"indeterminate\"\n ></mat-progress-spinner>\n\n <!-- Clear button -->\n <div class=\"suffix-buttons\" matSuffix>\n <button\n (click)=\"clear(); $event.stopPropagation()\"\n *ngIf=\"internalCtrl.value && internalCtrl.enabled && !clearLabel\"\n mat-icon-button\n i18n-matTooltip\n matTooltip=\"D\u00E9s\u00E9lectionner\"\n >\n <natural-icon name=\"close\"></natural-icon>\n </button>\n <button\n *ngIf=\"internalCtrl.value && navigateTo\"\n [routerLink]=\"navigateTo\"\n (click)=\"$event.stopPropagation()\"\n mat-button\n mat-icon-button\n i18n-matTooltip\n matTooltip=\"Naviguer vers\"\n >\n <natural-icon name=\"open_in_browser\"></natural-icon>\n </button>\n </div>\n\n <mat-error *ngIf=\"hasRequiredError()\" i18n>Ce champ est requis</mat-error>\n</mat-form-field>\n\n<!-- Additional (un)select/(un)link buttons for more visual cohesion with natural-relations --><!-- [clearLabel] and/or [selectLabel] has to be given as attribute input -->\n<div *ngIf=\"showClearButton()\" class=\"external-buttons\">\n <button (click)=\"clear()\" *ngIf=\"showClearButton()\" color=\"warn\" mat-button>{{ clearLabel }}</button>\n</div>\n", styles: [":host{display:flex;flex-direction:column}:host>*:not(:last-child){margin-bottom:20px}:host>mat-autocomplete{margin-bottom:0!important}:host .suffix-buttons,:host .external-buttons{display:flex;flex-direction:row}:host .external-buttons{display:flex;flex-direction:row}:host .external-buttons>*:not(:last-child){margin-right:10px}\n"], dependencies: [{ kind: "directive", type: i1$2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i2$3.MatLegacyAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { kind: "directive", type: i2$3.MatLegacyAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { kind: "component", type: i5$1.MatLegacyOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "component", type: i4.MatLegacyButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i4$2.MatLegacyError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: i4$2.MatLegacyFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4$2.MatLegacyLabel, selector: "mat-label" }, { kind: "directive", type: i4$2.MatLegacyPrefix, selector: "[matPrefix]" }, { kind: "directive", type: i4$2.MatLegacySuffix, selector: "[matSuffix]" }, { kind: "directive", type: i5.MatLegacyInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", exportAs: ["matInput"] }, { kind: "component", type: i7$2.MatLegacyProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "diameter", "strokeWidth", "mode", "value"], exportAs: ["matProgressSpinner"] }, { kind: "directive", type: i7$1.MatLegacyTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: NaturalIconComponent, selector: "natural-icon", inputs: ["label", "labelColor", "labelPosition", "name", "size"] }, { kind: "directive", type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "pipe", type: i1$2.AsyncPipe, name: "async" }] });
|
|
6576
6696
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NaturalSelectComponent, decorators: [{
|
|
6577
6697
|
type: Component,
|
|
6578
6698
|
args: [{ selector: 'natural-select', template: "<!-- Autocomplete menu -->\n<mat-autocomplete\n #ac=\"matAutocomplete\"\n (optionSelected)=\"propagateValue($event.option.value)\"\n [displayWith]=\"getDisplayFn()\"\n panelWidth=\"auto !important\"\n>\n <mat-option *ngFor=\"let item of items | async\" [value]=\"item\">\n <ng-template\n [ngTemplateOutletContext]=\"{item: item}\"\n [ngTemplateOutlet]=\"itemTemplate ? itemTemplate : defaultACItem\"\n ></ng-template>\n </mat-option>\n <div *ngIf=\"moreNbItems > 0\" class=\"mat-caption\" i18n style=\"padding: 5px 10px\"\n >{{ moreNbItems }} \u00E9l\u00E9ment(s) suppl\u00E9mentaire(s)</div\n >\n</mat-autocomplete>\n\n<ng-template #defaultACItem let-item=\"item\">\n <span>{{ getDisplayFn()(item) }}</span>\n</ng-template>\n\n<!-- Input for autocomplete -->\n<mat-form-field [floatLabel]=\"floatPlaceholder\">\n <mat-label>{{ placeholder }}</mat-label>\n\n <input\n (blur)=\"touch(); blur.emit()\"\n (change)=\"onInternalFormChange()\"\n (click)=\"autoTrigger.openPanel()\"\n (focus)=\"startSearch()\"\n (keydown.esc)=\"clear()\"\n [formControl]=\"internalCtrl\"\n [matAutocomplete]=\"ac\"\n aria-label=\"Recherche et s\u00E9lection\"\n i18n-aria-label\n matInput\n [errorStateMatcher]=\"matcher\"\n />\n\n <!-- Meta data -->\n <natural-icon *ngIf=\"!loading && showIcon\" [name]=\"icon\" matPrefix></natural-icon>\n <mat-progress-spinner\n *ngIf=\"loading\"\n [diameter]=\"21\"\n [strokeWidth]=\"5\"\n matPrefix\n mode=\"indeterminate\"\n ></mat-progress-spinner>\n\n <!-- Clear button -->\n <div class=\"suffix-buttons\" matSuffix>\n <button\n (click)=\"clear(); $event.stopPropagation()\"\n *ngIf=\"internalCtrl.value && internalCtrl.enabled && !clearLabel\"\n mat-icon-button\n i18n-matTooltip\n matTooltip=\"D\u00E9s\u00E9lectionner\"\n >\n <natural-icon name=\"close\"></natural-icon>\n </button>\n <button\n *ngIf=\"internalCtrl.value && navigateTo\"\n [routerLink]=\"navigateTo\"\n (click)=\"$event.stopPropagation()\"\n mat-button\n mat-icon-button\n i18n-matTooltip\n matTooltip=\"Naviguer vers\"\n >\n <natural-icon name=\"open_in_browser\"></natural-icon>\n </button>\n </div>\n\n <mat-error *ngIf=\"hasRequiredError()\" i18n>Ce champ est requis</mat-error>\n</mat-form-field>\n\n<!-- Additional (un)select/(un)link buttons for more visual cohesion with natural-relations --><!-- [clearLabel] and/or [selectLabel] has to be given as attribute input -->\n<div *ngIf=\"showClearButton()\" class=\"external-buttons\">\n <button (click)=\"clear()\" *ngIf=\"showClearButton()\" color=\"warn\" mat-button>{{ clearLabel }}</button>\n</div>\n", styles: [":host{display:flex;flex-direction:column}:host>*:not(:last-child){margin-bottom:20px}:host>mat-autocomplete{margin-bottom:0!important}:host .suffix-buttons,:host .external-buttons{display:flex;flex-direction:row}:host .external-buttons{display:flex;flex-direction:row}:host .external-buttons>*:not(:last-child){margin-right:10px}\n"] }]
|
|
@@ -6588,6 +6708,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImpor
|
|
|
6588
6708
|
type: Input
|
|
6589
6709
|
}], searchField: [{
|
|
6590
6710
|
type: Input
|
|
6711
|
+
}], searchOperator: [{
|
|
6712
|
+
type: Input
|
|
6591
6713
|
}], filter: [{
|
|
6592
6714
|
type: Input
|
|
6593
6715
|
}], disabled: [{
|
|
@@ -6617,7 +6739,7 @@ class TypeNaturalSelectComponent extends AbstractAssociationSelectComponent {
|
|
|
6617
6739
|
}
|
|
6618
6740
|
}
|
|
6619
6741
|
TypeNaturalSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: TypeNaturalSelectComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
6620
|
-
TypeNaturalSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.2", type: TypeNaturalSelectComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<form [formGroup]=\"form\">\n <mat-form-field style=\"max-width: 7em; margin-right: 1em\">\n <mat-label i18n=\"Mathematical operator < > =\">Op\u00E9rateur</mat-label>\n <mat-select [formControl]=\"operatorCtrl\" [required]=\"true\">\n <mat-option *ngFor=\"let item of operators\" [value]=\"item.key\">\n {{ item.label }}\n </mat-option>\n </mat-select>\n </mat-form-field>\n\n <natural-select\n style=\"display: inline\"\n *ngIf=\"configuration && requireValueCtrl\"\n [formControl]=\"valueCtrl\"\n [placeholder]=\"configuration.placeholder\"\n [service]=\"configuration.service\"\n [filter]=\"configuration.filter\"\n ></natural-select>\n</form>\n", dependencies: [{ kind: "directive", type: i1$2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "component", type: i4$2.MatLegacyFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4$2.MatLegacyLabel, selector: "mat-label" }, { kind: "directive", type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i4$3.MatLegacySelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { kind: "component", type: i5$1.MatLegacyOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "component", type: NaturalSelectComponent, selector: "natural-select", inputs: ["service", "optionRequired", "searchField", "filter", "disabled"] }] });
|
|
6742
|
+
TypeNaturalSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.2", type: TypeNaturalSelectComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<form [formGroup]=\"form\">\n <mat-form-field style=\"max-width: 7em; margin-right: 1em\">\n <mat-label i18n=\"Mathematical operator < > =\">Op\u00E9rateur</mat-label>\n <mat-select [formControl]=\"operatorCtrl\" [required]=\"true\">\n <mat-option *ngFor=\"let item of operators\" [value]=\"item.key\">\n {{ item.label }}\n </mat-option>\n </mat-select>\n </mat-form-field>\n\n <natural-select\n style=\"display: inline\"\n *ngIf=\"configuration && requireValueCtrl\"\n [formControl]=\"valueCtrl\"\n [placeholder]=\"configuration.placeholder\"\n [service]=\"configuration.service\"\n [filter]=\"configuration.filter\"\n ></natural-select>\n</form>\n", dependencies: [{ kind: "directive", type: i1$2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "component", type: i4$2.MatLegacyFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4$2.MatLegacyLabel, selector: "mat-label" }, { kind: "directive", type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i4$3.MatLegacySelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { kind: "component", type: i5$1.MatLegacyOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "component", type: NaturalSelectComponent, selector: "natural-select", inputs: ["service", "optionRequired", "searchField", "searchOperator", "filter", "disabled"] }] });
|
|
6621
6743
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: TypeNaturalSelectComponent, decorators: [{
|
|
6622
6744
|
type: Component,
|
|
6623
6745
|
args: [{ template: "<form [formGroup]=\"form\">\n <mat-form-field style=\"max-width: 7em; margin-right: 1em\">\n <mat-label i18n=\"Mathematical operator < > =\">Op\u00E9rateur</mat-label>\n <mat-select [formControl]=\"operatorCtrl\" [required]=\"true\">\n <mat-option *ngFor=\"let item of operators\" [value]=\"item.key\">\n {{ item.label }}\n </mat-option>\n </mat-select>\n </mat-form-field>\n\n <natural-select\n style=\"display: inline\"\n *ngIf=\"configuration && requireValueCtrl\"\n [formControl]=\"valueCtrl\"\n [placeholder]=\"configuration.placeholder\"\n [service]=\"configuration.service\"\n [filter]=\"configuration.filter\"\n ></natural-select>\n</form>\n" }]
|
|
@@ -9894,7 +10016,7 @@ class NaturalRelationsComponent extends NaturalAbstractController {
|
|
|
9894
10016
|
}
|
|
9895
10017
|
}
|
|
9896
10018
|
NaturalRelationsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NaturalRelationsComponent, deps: [{ token: NaturalLinkMutationService }, { token: NaturalHierarchicSelectorDialogService }], target: i0.ɵɵFactoryTarget.Component });
|
|
9897
|
-
NaturalRelationsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.2", type: NaturalRelationsComponent, selector: "natural-relations", inputs: { service: "service", placeholder: "placeholder", autocompleteSelectorFilter: "autocompleteSelectorFilter", displayWith: "displayWith", disabled: "disabled", main: "main", hierarchicSelectorFilters: "hierarchicSelectorFilters", hierarchicSelectorConfig: "hierarchicSelectorConfig", otherName: "otherName", filter: "filter" }, outputs: { selectionChange: "selectionChange" }, queries: [{ propertyName: "itemTemplate", first: true, predicate: TemplateRef, descendants: true }], viewQueries: [{ propertyName: "select", first: true, predicate: NaturalSelectComponent, descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<div class=\"body\">\n <ng-template #defaultNameCell let-item=\"item\">\n {{ getDisplayFn()(item) }}\n </ng-template>\n\n <table *ngIf=\"dataSource\" [dataSource]=\"dataSource\" class=\"natural-row-click\" mat-table>\n <tr *matHeaderRowDef=\"displayedColumns\" mat-header-row style=\"display: none\"></tr>\n <tr *matRowDef=\"let row; columns: displayedColumns\" mat-row></tr>\n\n <ng-container matColumnDef=\"name\">\n <th *matHeaderCellDef i18n mat-header-cell>Titre</th>\n <td *matCellDef=\"let item\" mat-cell>\n <ng-template\n [ngTemplateOutletContext]=\"{item: item}\"\n [ngTemplateOutlet]=\"itemTemplate ? itemTemplate : defaultNameCell\"\n ></ng-template>\n </td>\n </ng-container>\n\n <ng-container matColumnDef=\"unlink\">\n <th *matHeaderCellDef mat-header-cell></th>\n <td *matCellDef=\"let element\" mat-cell>\n <button\n *ngIf=\"!disabled\"\n (click)=\"removeRelation(element)\"\n [disabled]=\"removing.has(element)\"\n color=\"warn\"\n mat-icon-button\n i18n-matTooltip\n matTooltip=\"Dissocier\"\n >\n <natural-icon name=\"link_off\"></natural-icon>\n </button>\n </td>\n </ng-container>\n </table>\n\n <mat-paginator\n (page)=\"pagination($event)\"\n *ngIf=\"dataSource?.data && (dataSource?.data?.length || 0) > (dataSource?.data?.pageSize || 0)\"\n [length]=\"dataSource?.data?.length || 0\"\n [pageIndex]=\"dataSource?.data?.pageIndex || 0\"\n [pageSizeOptions]=\"pageSizeOptions\"\n [pageSize]=\"dataSource?.data?.pageSize || 0\"\n ></mat-paginator>\n\n <div *ngIf=\"!loading && dataSource?.data?.length === 0\" class=\"margin-v mat-body\">\n <span i18n>Aucun r\u00E9sultat</span>\n </div>\n\n <mat-progress-spinner *ngIf=\"loading\" [diameter]=\"40\" class=\"loading\" mode=\"indeterminate\"></mat-progress-spinner>\n</div>\n\n<natural-select\n #select\n (selectionChange)=\"addRelations([$any($event)])\"\n *ngIf=\"!hierarchicSelectorConfig && service && !disabled\"\n [displayWith]=\"getDisplayFn()\"\n [filter]=\"autocompleteSelectorFilter\"\n [placeholder]=\"placeholder\"\n [service]=\"service\"\n [showIcon]=\"false\"\n></natural-select>\n\n<div *ngIf=\"hierarchicSelectorConfig && !disabled\">\n <button (click)=\"openNaturalHierarchicSelector()\" color=\"primary\" mat-flat-button>{{ placeholder }}</button>\n</div>\n", styles: [":host{display:flex;flex-direction:column}:host>*:not(:last-child){margin-bottom:20px}:host .body{display:flex;flex-direction:column}:host .loading{margin:20px auto}:host .mat-column-unlink{width:2.5em}\n"], dependencies: [{ kind: "directive", type: i1$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i4.MatLegacyButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i7$2.MatLegacyProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "diameter", "strokeWidth", "mode", "value"], exportAs: ["matProgressSpinner"] }, { kind: "component", type: NaturalIconComponent, selector: "natural-icon", inputs: ["label", "labelColor", "labelPosition", "name", "size"] }, { kind: "component", type: i7$3.MatLegacyTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i7$3.MatLegacyHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i7$3.MatLegacyHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i7$3.MatLegacyColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { kind: "directive", type: i7$3.MatLegacyCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i7$3.MatLegacyRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i7$3.MatLegacyHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i7$3.MatLegacyCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i7$3.MatLegacyHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i7$3.MatLegacyRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "component", type: NaturalSelectComponent, selector: "natural-select", inputs: ["service", "optionRequired", "searchField", "filter", "disabled"] }, { kind: "component", type: i9.MatLegacyPaginator, selector: "mat-paginator", inputs: ["disabled"], exportAs: ["matPaginator"] }, { kind: "directive", type: i7$1.MatLegacyTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }] });
|
|
10019
|
+
NaturalRelationsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.2", type: NaturalRelationsComponent, selector: "natural-relations", inputs: { service: "service", placeholder: "placeholder", autocompleteSelectorFilter: "autocompleteSelectorFilter", displayWith: "displayWith", disabled: "disabled", main: "main", hierarchicSelectorFilters: "hierarchicSelectorFilters", hierarchicSelectorConfig: "hierarchicSelectorConfig", otherName: "otherName", filter: "filter" }, outputs: { selectionChange: "selectionChange" }, queries: [{ propertyName: "itemTemplate", first: true, predicate: TemplateRef, descendants: true }], viewQueries: [{ propertyName: "select", first: true, predicate: NaturalSelectComponent, descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<div class=\"body\">\n <ng-template #defaultNameCell let-item=\"item\">\n {{ getDisplayFn()(item) }}\n </ng-template>\n\n <table *ngIf=\"dataSource\" [dataSource]=\"dataSource\" class=\"natural-row-click\" mat-table>\n <tr *matHeaderRowDef=\"displayedColumns\" mat-header-row style=\"display: none\"></tr>\n <tr *matRowDef=\"let row; columns: displayedColumns\" mat-row></tr>\n\n <ng-container matColumnDef=\"name\">\n <th *matHeaderCellDef i18n mat-header-cell>Titre</th>\n <td *matCellDef=\"let item\" mat-cell>\n <ng-template\n [ngTemplateOutletContext]=\"{item: item}\"\n [ngTemplateOutlet]=\"itemTemplate ? itemTemplate : defaultNameCell\"\n ></ng-template>\n </td>\n </ng-container>\n\n <ng-container matColumnDef=\"unlink\">\n <th *matHeaderCellDef mat-header-cell></th>\n <td *matCellDef=\"let element\" mat-cell>\n <button\n *ngIf=\"!disabled\"\n (click)=\"removeRelation(element)\"\n [disabled]=\"removing.has(element)\"\n color=\"warn\"\n mat-icon-button\n i18n-matTooltip\n matTooltip=\"Dissocier\"\n >\n <natural-icon name=\"link_off\"></natural-icon>\n </button>\n </td>\n </ng-container>\n </table>\n\n <mat-paginator\n (page)=\"pagination($event)\"\n *ngIf=\"dataSource?.data && (dataSource?.data?.length || 0) > (dataSource?.data?.pageSize || 0)\"\n [length]=\"dataSource?.data?.length || 0\"\n [pageIndex]=\"dataSource?.data?.pageIndex || 0\"\n [pageSizeOptions]=\"pageSizeOptions\"\n [pageSize]=\"dataSource?.data?.pageSize || 0\"\n ></mat-paginator>\n\n <div *ngIf=\"!loading && dataSource?.data?.length === 0\" class=\"margin-v mat-body\">\n <span i18n>Aucun r\u00E9sultat</span>\n </div>\n\n <mat-progress-spinner *ngIf=\"loading\" [diameter]=\"40\" class=\"loading\" mode=\"indeterminate\"></mat-progress-spinner>\n</div>\n\n<natural-select\n #select\n (selectionChange)=\"addRelations([$any($event)])\"\n *ngIf=\"!hierarchicSelectorConfig && service && !disabled\"\n [displayWith]=\"getDisplayFn()\"\n [filter]=\"autocompleteSelectorFilter\"\n [placeholder]=\"placeholder\"\n [service]=\"service\"\n [showIcon]=\"false\"\n></natural-select>\n\n<div *ngIf=\"hierarchicSelectorConfig && !disabled\">\n <button (click)=\"openNaturalHierarchicSelector()\" color=\"primary\" mat-flat-button>{{ placeholder }}</button>\n</div>\n", styles: [":host{display:flex;flex-direction:column}:host>*:not(:last-child){margin-bottom:20px}:host .body{display:flex;flex-direction:column}:host .loading{margin:20px auto}:host .mat-column-unlink{width:2.5em}\n"], dependencies: [{ kind: "directive", type: i1$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i4.MatLegacyButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i7$2.MatLegacyProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "diameter", "strokeWidth", "mode", "value"], exportAs: ["matProgressSpinner"] }, { kind: "component", type: NaturalIconComponent, selector: "natural-icon", inputs: ["label", "labelColor", "labelPosition", "name", "size"] }, { kind: "component", type: i7$3.MatLegacyTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i7$3.MatLegacyHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i7$3.MatLegacyHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i7$3.MatLegacyColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { kind: "directive", type: i7$3.MatLegacyCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i7$3.MatLegacyRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i7$3.MatLegacyHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i7$3.MatLegacyCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i7$3.MatLegacyHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i7$3.MatLegacyRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "component", type: NaturalSelectComponent, selector: "natural-select", inputs: ["service", "optionRequired", "searchField", "searchOperator", "filter", "disabled"] }, { kind: "component", type: i9.MatLegacyPaginator, selector: "mat-paginator", inputs: ["disabled"], exportAs: ["matPaginator"] }, { kind: "directive", type: i7$1.MatLegacyTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }] });
|
|
9898
10020
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NaturalRelationsComponent, decorators: [{
|
|
9899
10021
|
type: Component,
|
|
9900
10022
|
args: [{ selector: 'natural-relations', template: "<div class=\"body\">\n <ng-template #defaultNameCell let-item=\"item\">\n {{ getDisplayFn()(item) }}\n </ng-template>\n\n <table *ngIf=\"dataSource\" [dataSource]=\"dataSource\" class=\"natural-row-click\" mat-table>\n <tr *matHeaderRowDef=\"displayedColumns\" mat-header-row style=\"display: none\"></tr>\n <tr *matRowDef=\"let row; columns: displayedColumns\" mat-row></tr>\n\n <ng-container matColumnDef=\"name\">\n <th *matHeaderCellDef i18n mat-header-cell>Titre</th>\n <td *matCellDef=\"let item\" mat-cell>\n <ng-template\n [ngTemplateOutletContext]=\"{item: item}\"\n [ngTemplateOutlet]=\"itemTemplate ? itemTemplate : defaultNameCell\"\n ></ng-template>\n </td>\n </ng-container>\n\n <ng-container matColumnDef=\"unlink\">\n <th *matHeaderCellDef mat-header-cell></th>\n <td *matCellDef=\"let element\" mat-cell>\n <button\n *ngIf=\"!disabled\"\n (click)=\"removeRelation(element)\"\n [disabled]=\"removing.has(element)\"\n color=\"warn\"\n mat-icon-button\n i18n-matTooltip\n matTooltip=\"Dissocier\"\n >\n <natural-icon name=\"link_off\"></natural-icon>\n </button>\n </td>\n </ng-container>\n </table>\n\n <mat-paginator\n (page)=\"pagination($event)\"\n *ngIf=\"dataSource?.data && (dataSource?.data?.length || 0) > (dataSource?.data?.pageSize || 0)\"\n [length]=\"dataSource?.data?.length || 0\"\n [pageIndex]=\"dataSource?.data?.pageIndex || 0\"\n [pageSizeOptions]=\"pageSizeOptions\"\n [pageSize]=\"dataSource?.data?.pageSize || 0\"\n ></mat-paginator>\n\n <div *ngIf=\"!loading && dataSource?.data?.length === 0\" class=\"margin-v mat-body\">\n <span i18n>Aucun r\u00E9sultat</span>\n </div>\n\n <mat-progress-spinner *ngIf=\"loading\" [diameter]=\"40\" class=\"loading\" mode=\"indeterminate\"></mat-progress-spinner>\n</div>\n\n<natural-select\n #select\n (selectionChange)=\"addRelations([$any($event)])\"\n *ngIf=\"!hierarchicSelectorConfig && service && !disabled\"\n [displayWith]=\"getDisplayFn()\"\n [filter]=\"autocompleteSelectorFilter\"\n [placeholder]=\"placeholder\"\n [service]=\"service\"\n [showIcon]=\"false\"\n></natural-select>\n\n<div *ngIf=\"hierarchicSelectorConfig && !disabled\">\n <button (click)=\"openNaturalHierarchicSelector()\" color=\"primary\" mat-flat-button>{{ placeholder }}</button>\n</div>\n", styles: [":host{display:flex;flex-direction:column}:host>*:not(:last-child){margin-bottom:20px}:host .body{display:flex;flex-direction:column}:host .loading{margin:20px auto}:host .mat-column-unlink{width:2.5em}\n"] }]
|
|
@@ -10455,68 +10577,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImpor
|
|
|
10455
10577
|
* Public API Surface of natural
|
|
10456
10578
|
*/
|
|
10457
10579
|
|
|
10458
|
-
class NaturalDialogTriggerComponent {
|
|
10459
|
-
constructor(dialog, route, router) {
|
|
10460
|
-
this.dialog = dialog;
|
|
10461
|
-
this.route = route;
|
|
10462
|
-
this.router = router;
|
|
10463
|
-
// Data from activated route
|
|
10464
|
-
this.triggerConfig = this.route.snapshot.data.trigger;
|
|
10465
|
-
// Get data relative to dialog service configuration
|
|
10466
|
-
const _a = this.triggerConfig.dialogConfig, { data } = _a, config = __rest(_a, ["data"]);
|
|
10467
|
-
const dialogConfig = Object.assign(Object.assign({}, config), { data: {
|
|
10468
|
-
data: data,
|
|
10469
|
-
// Set data accessible into component instantiated by the dialog service
|
|
10470
|
-
activatedRoute: this.route,
|
|
10471
|
-
} });
|
|
10472
|
-
this.dialogRef = this.dialog.open(this.triggerConfig.component, dialogConfig);
|
|
10473
|
-
// Redirect on closing (if applicable)
|
|
10474
|
-
this.dialogRef.beforeClosed().subscribe(exitValue => this.redirect(exitValue));
|
|
10475
|
-
}
|
|
10476
|
-
/**
|
|
10477
|
-
* Called when router leaves route, and so on, closes the modal with undefined value to prevent a new redirection
|
|
10478
|
-
*/
|
|
10479
|
-
ngOnDestroy() {
|
|
10480
|
-
if (this.dialogRef) {
|
|
10481
|
-
this.dialogRef.close(-1); // -1 = no redirection
|
|
10482
|
-
}
|
|
10483
|
-
}
|
|
10484
|
-
/**
|
|
10485
|
-
* Redirects on modal closing under following rules/conditions
|
|
10486
|
-
*
|
|
10487
|
-
* If -1 : no redirection
|
|
10488
|
-
* If undefined, null or empty string : uses the router provided redirection route or fallbacks on parent route if router don't provide
|
|
10489
|
-
* If a value is provided, should be of type any[] and it's used for redirection.
|
|
10490
|
-
*/
|
|
10491
|
-
redirect(exitValue) {
|
|
10492
|
-
const isEmptyExitValue = exitValue == null || exitValue === ''; // undefined, null or ''
|
|
10493
|
-
if (exitValue === -1) {
|
|
10494
|
-
// if -1, don't redirect
|
|
10495
|
-
return;
|
|
10496
|
-
}
|
|
10497
|
-
else if (!isEmptyExitValue) {
|
|
10498
|
-
// If value provided, redirect to that route
|
|
10499
|
-
this.router.navigate(exitValue);
|
|
10500
|
-
}
|
|
10501
|
-
else if (isEmptyExitValue && this.triggerConfig.afterClosedRoute) {
|
|
10502
|
-
// If value is not provided (null) and router context specified default redirection route, use it
|
|
10503
|
-
this.router.navigate(this.triggerConfig.afterClosedRoute);
|
|
10504
|
-
}
|
|
10505
|
-
else if (isEmptyExitValue) {
|
|
10506
|
-
// If neither of component or router provides redirection, go to parent (care : parent can't have empty path : ''),
|
|
10507
|
-
this.router.navigate(['.'], { relativeTo: this.route.parent });
|
|
10508
|
-
}
|
|
10509
|
-
}
|
|
10510
|
-
}
|
|
10511
|
-
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 });
|
|
10512
|
-
NaturalDialogTriggerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.2", type: NaturalDialogTriggerComponent, selector: "ng-component", ngImport: i0, template: '', isInline: true });
|
|
10513
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NaturalDialogTriggerComponent, decorators: [{
|
|
10514
|
-
type: Component,
|
|
10515
|
-
args: [{
|
|
10516
|
-
template: '',
|
|
10517
|
-
}]
|
|
10518
|
-
}], ctorParameters: function () { return [{ type: i1.MatLegacyDialog }, { type: i2$1.ActivatedRoute }, { type: i2$1.Router }]; } });
|
|
10519
|
-
|
|
10520
10580
|
class NaturalDialogTriggerModule {
|
|
10521
10581
|
}
|
|
10522
10582
|
NaturalDialogTriggerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NaturalDialogTriggerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|