@fluxhub/fluxhub-lib 19.0.253 → 19.0.254
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.
|
@@ -14251,10 +14251,26 @@ class FHNumericFieldComponent {
|
|
|
14251
14251
|
constructor(uti_s) {
|
|
14252
14252
|
this.uti_s = uti_s;
|
|
14253
14253
|
this.modelChangeSubject.pipe(debounceTime(300)).subscribe(value => {
|
|
14254
|
-
|
|
14254
|
+
// Al modello va sempre un numero (come in chg()), non la stringa formattata ("10.624,66"):
|
|
14255
|
+
// il testo nel campo non viene toccato. Se nel frattempo c'e' stato blur/invio/writeValue
|
|
14256
|
+
// il valore e' gia' stato propagato e questa emissione e' superata. (change) resta invariato.
|
|
14257
|
+
if (this.typingPending) {
|
|
14258
|
+
this.typingPending = false;
|
|
14259
|
+
const num = this.parseFormatted(value);
|
|
14260
|
+
if (num != null)
|
|
14261
|
+
this.onChange(num);
|
|
14262
|
+
}
|
|
14255
14263
|
this.change.emit(value.split(this.suffixSymbol).join(""));
|
|
14256
14264
|
});
|
|
14257
14265
|
}
|
|
14266
|
+
typingPending = false;
|
|
14267
|
+
// Stesso parsing di chg(); null se il testo non e' (ancora) un numero, es. solo "-"
|
|
14268
|
+
parseFormatted(text) {
|
|
14269
|
+
if (text == null || text == "")
|
|
14270
|
+
return this.uti_s.round(0, this.decimal);
|
|
14271
|
+
const num = this.uti_s.round(parseFloat(text.split(".").join("").split(",").join(".").split(this.suffixSymbol).join("")), this.decimal);
|
|
14272
|
+
return isNaN(num) ? null : num;
|
|
14273
|
+
}
|
|
14258
14274
|
keyDownFunctioncl(event) {
|
|
14259
14275
|
if (event.keyCode == 13) {
|
|
14260
14276
|
this.chg();
|
|
@@ -14262,6 +14278,7 @@ class FHNumericFieldComponent {
|
|
|
14262
14278
|
}
|
|
14263
14279
|
}
|
|
14264
14280
|
modelch() {
|
|
14281
|
+
this.typingPending = true;
|
|
14265
14282
|
setTimeout(() => {
|
|
14266
14283
|
this.modelChangeSubject.next(this.formattedAmount);
|
|
14267
14284
|
});
|
|
@@ -14290,11 +14307,13 @@ class FHNumericFieldComponent {
|
|
|
14290
14307
|
this.formattedAmount = this.transform(this.value, this.decimal) + this.suffixSymbol;
|
|
14291
14308
|
}
|
|
14292
14309
|
this.chgf = true;
|
|
14310
|
+
this.typingPending = false;
|
|
14293
14311
|
this.onChange(this.value);
|
|
14294
14312
|
}
|
|
14295
14313
|
writeValue(value) {
|
|
14296
14314
|
if (value == null)
|
|
14297
14315
|
value = 0.0;
|
|
14316
|
+
this.typingPending = false;
|
|
14298
14317
|
this.innerValue = value;
|
|
14299
14318
|
this.value = value;
|
|
14300
14319
|
this.formattedAmount = this.transform(this.value, this.decimal) + this.suffixSymbol;
|