Skip to content
Snippets Groups Projects
Commit 3abf164b authored by mathias.chouet's avatar mathias.chouet
Browse files

#157 : add help button option on select and input

parent 72899c6c
No related branches found
No related tags found
No related merge requests found
...@@ -33,12 +33,12 @@ ...@@ -33,12 +33,12 @@
"source": "device_loi_debit", "source": "device_loi_debit",
"help": "pab/cloisonsSelect" "help": "pab/cloisonsSelect"
}, },
"h1",
{ {
"id": "h1", "id": "L",
"type": "input", "type": "input",
"help": "pab/cloisonsInput" "help": "pab/cloisonsInput"
}, },
"L",
"CdWSL", "CdWSL",
"CdWR", "CdWR",
"CdGR", "CdGR",
......
...@@ -4,5 +4,11 @@ ...@@ -4,5 +4,11 @@
(keydown.Tab)="onTabPressed($event, false)" (keydown.shift.Tab)="onTabPressed($event, true)" (keydown.Tab)="onTabPressed($event, false)" (keydown.shift.Tab)="onTabPressed($event, true)"
pattern="^-?([0-9]*\.)?([0-9]+[Ee]-?)?[0-9]+$" required> pattern="^-?([0-9]*\.)?([0-9]+[Ee]-?)?[0-9]+$" required>
<div *ngIf="enableHelpButton" class="overlap-input">
<mat-icon (click)="openHelp($event)" [title]="uitextOpenHelp" color="accent">
help
</mat-icon>
</div>
<mat-error>{{ errorMessage }}</mat-error> <mat-error>{{ errorMessage }}</mat-error>
</mat-form-field> </mat-form-field>
...@@ -4,4 +4,9 @@ ...@@ -4,4 +4,9 @@
{{ entryLabel(e) }} {{ entryLabel(e) }}
</mat-option> </mat-option>
</mat-select> </mat-select>
<div *ngIf="enableHelpButton" class="overlap-select">
<mat-icon (click)="openHelp($event)" [title]="uitextOpenHelp" color="accent">
help
</mat-icon>
</div>
</mat-form-field> </mat-form-field>
...@@ -20,4 +20,16 @@ mat-form-field { ...@@ -20,4 +20,16 @@ mat-form-field {
font-size: 1em; font-size: 1em;
} }
} }
.overlap-input {
position: absolute;
right: 0;
text-align: right;
top: 0;
mat-icon {
cursor: pointer;
transform: scale(0.9);
}
}
} }
...@@ -112,4 +112,19 @@ export class NgParamInputComponent extends GenericInputComponent implements Obse ...@@ -112,4 +112,19 @@ export class NgParamInputComponent extends GenericInputComponent implements Obse
public ngOnDestroy() { public ngOnDestroy() {
this._paramDef.removeObserver(this); this._paramDef.removeObserver(this);
} }
public openHelp($event: any) {
window.open("assets/docs-fr/calculators/" + this._model.helpLink + ".html", "_blank");
$event.preventDefault();
$event.stopPropagation();
return false;
}
public get enableHelpButton() {
return this._model && this._model.helpLink;
}
public get uitextOpenHelp() {
return this.intlService.localizeText("INFO_CALCULATOR_OPEN_HELP");
}
} }
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
.param-computed-more { .param-computed-more {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
right: 0; right: -7px;
} }
::ng-deep .mat-form-field-label { ::ng-deep .mat-form-field-label {
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
.param-values-more { .param-values-more {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
right: 0; right: -7px;
} }
::ng-deep .mat-form-field-label { ::ng-deep .mat-form-field-label {
......
...@@ -21,4 +21,16 @@ mat-form-field { ...@@ -21,4 +21,16 @@ mat-form-field {
font-size: 1em; font-size: 1em;
} }
} }
.overlap-select {
position: absolute;
right: 20px;
text-align: right;
top: 2px;
mat-icon {
cursor: pointer;
transform: scale(0.9);
}
}
} }
...@@ -2,6 +2,7 @@ import { Component, Input } from "@angular/core"; ...@@ -2,6 +2,7 @@ import { Component, Input } from "@angular/core";
import { SelectField } from "../../formulaire/select-field"; import { SelectField } from "../../formulaire/select-field";
import { SelectEntry } from "../../formulaire/select-entry"; import { SelectEntry } from "../../formulaire/select-entry";
import { I18nService } from "../../services/internationalisation/internationalisation.service";
@Component({ @Component({
selector: "select-field-line", selector: "select-field-line",
...@@ -14,6 +15,8 @@ export class SelectFieldLineComponent { ...@@ -14,6 +15,8 @@ export class SelectFieldLineComponent {
@Input() @Input()
private _select: SelectField; private _select: SelectField;
public constructor(private i18nService: I18nService) {}
public get selectId() { public get selectId() {
return this._select.id; return this._select.id;
} }
...@@ -44,4 +47,19 @@ export class SelectFieldLineComponent { ...@@ -44,4 +47,19 @@ export class SelectFieldLineComponent {
return ""; return "";
} }
} }
public openHelp($event: any) {
window.open("assets/docs-fr/calculators/" + this._select.helpLink + ".html", "_blank");
$event.preventDefault();
$event.stopPropagation();
return false;
}
public get enableHelpButton() {
return this._select && this._select.helpLink;
}
public get uitextOpenHelp() {
return this.i18nService.localizeText("INFO_CALCULATOR_OPEN_HELP");
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment