@fluxhub/fluxhub-lib 19.0.252 → 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.
@@ -2382,6 +2382,8 @@ class FHComboboxComponent {
2382
2382
  translateValue(val) {
2383
2383
  if (!val)
2384
2384
  return '';
2385
+ // descrizione_valore puo' arrivare numerica dalla query: instant() vuole una stringa
2386
+ val = '' + val;
2385
2387
  if (val == '')
2386
2388
  return '';
2387
2389
  if (!this.disableTranslation)
@@ -2764,6 +2766,8 @@ class FHAutoCompleteComponent {
2764
2766
  translateValue(val) {
2765
2767
  if ((val || '') == '')
2766
2768
  return '';
2769
+ // descrizione_valore puo' arrivare numerica dalla query: instant() vuole una stringa
2770
+ val = '' + val;
2767
2771
  if (!this.disableTranslation && this.only_from_list)
2768
2772
  return this._tsr.instant(val);
2769
2773
  else
@@ -14247,10 +14251,26 @@ class FHNumericFieldComponent {
14247
14251
  constructor(uti_s) {
14248
14252
  this.uti_s = uti_s;
14249
14253
  this.modelChangeSubject.pipe(debounceTime(300)).subscribe(value => {
14250
- this.onChange(value.split(this.suffixSymbol).join(""));
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
+ }
14251
14263
  this.change.emit(value.split(this.suffixSymbol).join(""));
14252
14264
  });
14253
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
+ }
14254
14274
  keyDownFunctioncl(event) {
14255
14275
  if (event.keyCode == 13) {
14256
14276
  this.chg();
@@ -14258,6 +14278,7 @@ class FHNumericFieldComponent {
14258
14278
  }
14259
14279
  }
14260
14280
  modelch() {
14281
+ this.typingPending = true;
14261
14282
  setTimeout(() => {
14262
14283
  this.modelChangeSubject.next(this.formattedAmount);
14263
14284
  });
@@ -14286,11 +14307,13 @@ class FHNumericFieldComponent {
14286
14307
  this.formattedAmount = this.transform(this.value, this.decimal) + this.suffixSymbol;
14287
14308
  }
14288
14309
  this.chgf = true;
14310
+ this.typingPending = false;
14289
14311
  this.onChange(this.value);
14290
14312
  }
14291
14313
  writeValue(value) {
14292
14314
  if (value == null)
14293
14315
  value = 0.0;
14316
+ this.typingPending = false;
14294
14317
  this.innerValue = value;
14295
14318
  this.value = value;
14296
14319
  this.formattedAmount = this.transform(this.value, this.decimal) + this.suffixSymbol;