An error occurred while loading the file. Please try again.
-
Mathias Chouet authoredc412f91a
import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material";
import { Inject, Component, OnInit } from "@angular/core";
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
import { I18nService } from "../../services/internationalisation/internationalisation.service";
import { NgParameter } from "../../formulaire/ngparam";
import { ParamValueMode } from "jalhyd";
import { sprintf } from "sprintf-js";
@Component({
selector: "dialog-edit-param-values",
templateUrl: "dialog-edit-param-values.component.html",
styleUrls: ["dialog-edit-param-values.component.scss"]
})
export class DialogEditParamValuesComponent implements OnInit {
/** the related parameter to change the "variable" value of */
public param: NgParameter;
/** available value modes (min / max, list) */
public valueModes: { value: ParamValueMode; label: string; }[];
/** available decimal separators */
public decimalSeparators: { label: string; value: string; }[];
/** current decimal separator */
public decimalSeparator: string;
public valuesListForm: FormGroup;
constructor(
public dialogRef: MatDialogRef<DialogEditParamValuesComponent>,
private intlService: I18nService,
private fb: FormBuilder,
@Inject(MAT_DIALOG_DATA) public data: any
) {
this.param = data.param;
// an explicit ReactiveForm is required for file input component
this.valuesListForm = this.fb.group({
file: [""],
valuesList: [this.valuesList, [
Validators.required,
Validators.pattern(new RegExp(this.valuesListPattern))
]]
});
this.valueModes = [
{
value: ParamValueMode.MINMAX,
label: this.intlService.localizeText("INFO_PARAMMODE_MINMAX")
},
{
value: ParamValueMode.LISTE,
label: this.intlService.localizeText("INFO_PARAMMODE_LIST")
}
];
this.decimalSeparators = [
{
label: this.intlService.localizeText("INFO_PARAMFIELD_PARAMVARIER_SEPARATEUR_POINT"),
value: "."
},
{
label: this.intlService.localizeText("INFO_PARAMFIELD_PARAMVARIER_SEPARATEUR_VIRGULE"),
value: ","
}
];
this.decimalSeparator = this.decimalSeparators[0].value;
}
/**