@esfaenza/forms-and-validations 11.2.91 → 11.2.92

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.
@@ -2280,12 +2280,16 @@
2280
2280
  *
2281
2281
  * Non posso tenerlo protected altrimenti posso eseguirlo solo dal .ts e non dall' .html
2282
2282
  */
2283
- BaseFormControl.prototype.changed = function (forcedValue, markForCheck) {
2283
+ BaseFormControl.prototype.changed = function (forcedValue, markForCheck, modelEvaluationHandled) {
2284
2284
  if (forcedValue === void 0) { forcedValue = null; }
2285
2285
  if (markForCheck === void 0) { markForCheck = false; }
2286
- var _a, _b;
2287
- this.propagateChange(forcedValue == null || forcedValue == "" ? (_a = this.Model) !== null && _a !== void 0 ? _a : "" : forcedValue);
2288
- this.inputChange.emit(forcedValue == null || forcedValue == "" ? (_b = this.Model) !== null && _b !== void 0 ? _b : "" : forcedValue);
2286
+ if (modelEvaluationHandled === void 0) { modelEvaluationHandled = false; }
2287
+ var _a;
2288
+ var toEmit = forcedValue == null || forcedValue == "" ? (_a = this.Model) !== null && _a !== void 0 ? _a : "" : forcedValue;
2289
+ if (!modelEvaluationHandled)
2290
+ this.EvaluatedModel = toEmit;
2291
+ this.propagateChange(toEmit);
2292
+ this.inputChange.emit(toEmit);
2289
2293
  if (markForCheck)
2290
2294
  this.cdr.markForCheck();
2291
2295
  };
@@ -2436,7 +2440,8 @@
2436
2440
  model.nativefiles = files;
2437
2441
  model.fileb64 = null;
2438
2442
  }
2439
- this.changed(null, true);
2443
+ this.EvaluatedModel = model.filename;
2444
+ this.changed(null, true, true);
2440
2445
  };
2441
2446
  /** Permette di scaricare l'eventuale file selezionato */
2442
2447
  FormFileComponent.prototype.downloadAttachment = function () {
@@ -2491,6 +2496,10 @@
2491
2496
  this.EvaluatedModel = this.datesExts.getFormatted(obj, false, true);
2492
2497
  _super.prototype.writeValue.call(this, obj);
2493
2498
  };
2499
+ FormDateTimeComponent.prototype.changed = function () {
2500
+ this.EvaluatedModel = this.Model ? this.datesExts.getFormatted(this.Model, false, true) : '';
2501
+ _super.prototype.changed.call(this, null, false, true);
2502
+ };
2494
2503
  /** @ignore */
2495
2504
  FormDateTimeComponent.prototype.onNotNullValueSet = function () { };
2496
2505
  return FormDateTimeComponent;
@@ -2742,14 +2751,23 @@
2742
2751
  this.dateAdapter.clone(this.datesExts.getDateConvertion(this.Model))
2743
2752
  : JSON.parse(JSON.stringify(this.Model)))
2744
2753
  : null;
2745
- if ((this.Type == "float" || this.Type == "number") && toEmit)
2754
+ if ((this.Type == "float" || this.Type == "number") && toEmit) {
2746
2755
  toEmit = toEmit.replace(".", "").replace(",", ".");
2747
- else if (this.Type == "boolean")
2756
+ this.EvaluatedModel = toEmit;
2757
+ }
2758
+ else if (this.Type == "boolean") {
2748
2759
  toEmit = toEmit ? true : false;
2749
- else if (this.Type == "time")
2760
+ this.EvaluatedModel = this.lc.loc(toEmit ? 'Yes' : 'No');
2761
+ ;
2762
+ }
2763
+ else if (this.Type == "time") {
2750
2764
  toEmit = toEmit.format("HH:mm:ss");
2751
- else if ((this.Type == "date" || this.Type == "datetime") && this.useJsDates)
2765
+ this.EvaluatedModel = toEmit;
2766
+ }
2767
+ else if ((this.Type == "date" || this.Type == "datetime") && this.useJsDates) {
2752
2768
  toEmit = toEmit.toDate();
2769
+ this.EvaluatedModel = this.datesExts.getFormatted(this.Model, this.Type == "date", this.Type == "datetime");
2770
+ }
2753
2771
  return toEmit;
2754
2772
  };
2755
2773
  /**
@@ -3015,6 +3033,10 @@
3015
3033
  this.EvaluatedModel = this.lc.loc(obj ? 'Yes' : 'No');
3016
3034
  _super.prototype.writeValue.call(this, obj);
3017
3035
  };
3036
+ FormCheckboxComponent.prototype.changed = function () {
3037
+ this.EvaluatedModel = this.lc.loc(this.Model ? 'Yes' : 'No');
3038
+ _super.prototype.changed.call(this, null, false, true);
3039
+ };
3018
3040
  /** @ignore */
3019
3041
  FormCheckboxComponent.prototype.onNotNullValueSet = function () { };
3020
3042
  return FormCheckboxComponent;
@@ -3052,6 +3074,10 @@
3052
3074
  this.EvaluatedModel = this.datesExts.getFormatted(obj, true, false);
3053
3075
  _super.prototype.writeValue.call(this, obj);
3054
3076
  };
3077
+ FormDateComponent.prototype.changed = function () {
3078
+ this.EvaluatedModel = this.Model ? this.datesExts.getFormatted(this.Model, true, false) : '';
3079
+ _super.prototype.changed.call(this, null, false, true);
3080
+ };
3055
3081
  /** @ignore */
3056
3082
  FormDateComponent.prototype.onNotNullValueSet = function () { };
3057
3083
  return FormDateComponent;
@@ -3256,6 +3282,12 @@
3256
3282
  this.EvaluatedModel = this.BoundSource && this.BoundSource.length > 0 ? (_a = this.BoundSource.find(function (t) { return t.id == _this.Model; })) === null || _a === void 0 ? void 0 : _a.description : "";
3257
3283
  _super.prototype.writeValue.call(this, obj);
3258
3284
  };
3285
+ FormSelectComponent.prototype.changed = function () {
3286
+ var _this = this;
3287
+ var _a;
3288
+ this.EvaluatedModel = this.BoundSource && this.BoundSource.length > 0 ? (_a = this.BoundSource.find(function (t) { return t.id == _this.Model; })) === null || _a === void 0 ? void 0 : _a.description : "";
3289
+ _super.prototype.changed.call(this, null, false, true);
3290
+ };
3259
3291
  /** @ignore */
3260
3292
  FormSelectComponent.prototype.onNotNullValueSet = function () { };
3261
3293
  return FormSelectComponent;
@@ -3419,7 +3451,8 @@
3419
3451
  toEmit = this.Model.map(function (m) { return ({ id: m.id, description: m.itemName }); });
3420
3452
  else if (this.UseCommaSeparatedList)
3421
3453
  toEmit = this.Model.map(function (m) { return m.id; }).join(',');
3422
- _super.prototype.changed.call(this, toEmit);
3454
+ this.EvaluatedModel = this.Model.map(function (t) { return t.itemName; }).join(', ');
3455
+ _super.prototype.changed.call(this, toEmit, false, true);
3423
3456
  _super.prototype.finalized.call(this);
3424
3457
  };
3425
3458
  return FormMultiSelectComponent;
@@ -3655,12 +3688,15 @@
3655
3688
  };
3656
3689
  /** @ignore Override che marca anche il prossimo evento di filterSource da ignorare */
3657
3690
  FormAutocompleteComponent.prototype.changed = function (forcedValue, markForCheck) {
3691
+ var _this = this;
3658
3692
  if (forcedValue === void 0) { forcedValue = null; }
3659
3693
  if (markForCheck === void 0) { markForCheck = false; }
3660
3694
  if (!this.Multi)
3661
3695
  this.ignoreNextWriteValue = true;
3662
3696
  if (forcedValue == "" && this.Multi)
3663
3697
  this.Model = "";
3698
+ var selecteds = this.Model ? this.Model.split(',') : [];
3699
+ this.EvaluatedModel = selecteds.map(function (t) { var _a; return _this.BoundSource && _this.BoundSource.length > 0 ? (_a = _this.BoundSource.find(function (t) { return t.id == _this.Model; })) === null || _a === void 0 ? void 0 : _a.description : ""; }).join(', ');
3664
3700
  _super.prototype.changed.call(this, forcedValue, markForCheck);
3665
3701
  };
3666
3702
  /** @ignore */
@@ -3759,12 +3795,15 @@
3759
3795
  switch (this.InOutFormat) {
3760
3796
  case 'date':
3761
3797
  toEmit = toEmit.toDate();
3798
+ this.EvaluatedModel = toEmit.format('HH:mm:ss');
3762
3799
  break;
3763
3800
  case 'timestring':
3764
3801
  toEmit = toEmit.format("HH:mm" + (this.ShowSeconds ? ":ss" : ""));
3802
+ this.EvaluatedModel = toEmit;
3765
3803
  break;
3766
3804
  case 'dayjs':
3767
3805
  toEmit = toEmit;
3806
+ this.EvaluatedModel = toEmit.format('HH:mm:ss');
3768
3807
  break;
3769
3808
  }
3770
3809
  _super.prototype.changed.call(this, toEmit);