@fluxhub/fluxhub-lib 21.0.9 → 21.0.10
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.
|
@@ -13763,10 +13763,26 @@ class FHNumericFieldComponent {
|
|
|
13763
13763
|
constructor(uti_s) {
|
|
13764
13764
|
this.uti_s = uti_s;
|
|
13765
13765
|
this.modelChangeSubject.pipe(debounceTime(300)).subscribe(value => {
|
|
13766
|
-
|
|
13766
|
+
// Al modello va sempre un numero (come in chg()), non la stringa formattata ("10.624,66"):
|
|
13767
|
+
// il testo nel campo non viene toccato. Se nel frattempo c'e' stato blur/invio/writeValue
|
|
13768
|
+
// il valore e' gia' stato propagato e questa emissione e' superata. (change) resta invariato.
|
|
13769
|
+
if (this.typingPending) {
|
|
13770
|
+
this.typingPending = false;
|
|
13771
|
+
const num = this.parseFormatted(value);
|
|
13772
|
+
if (num != null)
|
|
13773
|
+
this.onChange(num);
|
|
13774
|
+
}
|
|
13767
13775
|
this.change.emit(value.split(this.suffixSymbol).join(""));
|
|
13768
13776
|
});
|
|
13769
13777
|
}
|
|
13778
|
+
typingPending = false;
|
|
13779
|
+
// Stesso parsing di chg(); null se il testo non e' (ancora) un numero, es. solo "-"
|
|
13780
|
+
parseFormatted(text) {
|
|
13781
|
+
if (text == null || text == "")
|
|
13782
|
+
return this.uti_s.round(0, this.decimal);
|
|
13783
|
+
const num = this.uti_s.round(parseFloat(text.split(".").join("").split(",").join(".").split(this.suffixSymbol).join("")), this.decimal);
|
|
13784
|
+
return isNaN(num) ? null : num;
|
|
13785
|
+
}
|
|
13770
13786
|
keyDownFunctioncl(event) {
|
|
13771
13787
|
if (event.keyCode == 13) {
|
|
13772
13788
|
this.chg();
|
|
@@ -13774,6 +13790,7 @@ class FHNumericFieldComponent {
|
|
|
13774
13790
|
}
|
|
13775
13791
|
}
|
|
13776
13792
|
modelch() {
|
|
13793
|
+
this.typingPending = true;
|
|
13777
13794
|
setTimeout(() => {
|
|
13778
13795
|
this.modelChangeSubject.next(this.formattedAmount);
|
|
13779
13796
|
});
|
|
@@ -13802,11 +13819,13 @@ class FHNumericFieldComponent {
|
|
|
13802
13819
|
this.formattedAmount = this.transform(this.value, this.decimal) + this.suffixSymbol;
|
|
13803
13820
|
}
|
|
13804
13821
|
this.chgf = true;
|
|
13822
|
+
this.typingPending = false;
|
|
13805
13823
|
this.onChange(this.value);
|
|
13806
13824
|
}
|
|
13807
13825
|
writeValue(value) {
|
|
13808
13826
|
if (value == null)
|
|
13809
13827
|
value = 0.0;
|
|
13828
|
+
this.typingPending = false;
|
|
13810
13829
|
this.innerValue = value;
|
|
13811
13830
|
this.value = value;
|
|
13812
13831
|
this.formattedAmount = this.transform(this.value, this.decimal) + this.suffixSymbol;
|