@esfaenza/forms-and-validations 11.2.139 → 11.2.141

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.
@@ -2650,6 +2650,8 @@
2650
2650
  _this.MinChars = 3;
2651
2651
  /** Indica se i controlli devono essere effettuati tenendo conto del Case o meno. Vale solo qualora la **Source** fosse fornita */
2652
2652
  _this.CaseSensitive = false;
2653
+ /** Opzioni specifiche per il componente che si va a visualizzare. Es. per i tipi date: { JsDates: true } */
2654
+ _this.Options = {};
2653
2655
  /** Variabile interna che gestisce se effettuare il riallineamento dei dati o meno */
2654
2656
  _this.alignValues = false;
2655
2657
  /**
@@ -2659,6 +2661,8 @@
2659
2661
  _this.ignoreNextWriteValue = false;
2660
2662
  /** Cache della sorgente originale POST binding, in modo da poter fare filtri in locale qualora la **SearchFunction** non fosse definita e la **Source** fosse assegnata */
2661
2663
  _this.FilteredBoundSource = [];
2664
+ /** Solo per gli input di tipo "date". Capisce che modalità usare per il validation-date sottostante */
2665
+ _this.useJsDates = null;
2662
2666
  _this.IntPattern = '^[0-9]\\d*$';
2663
2667
  _this.FloatPattern = '^([0-9]*[,])?[0-9]+$';
2664
2668
  //******************** Funzione di throttling per non spammare richieste in caso di animazioni attivate
@@ -2669,7 +2673,30 @@
2669
2673
  _this.UseUserValidators = false;
2670
2674
  return _this;
2671
2675
  }
2676
+ /**
2677
+ * Nvl con un minimo di senso
2678
+ * @param value Valore base
2679
+ * @param ifnod Valore da usare se **value** è nullo o undefined
2680
+ * @returns Il valore preso fra i due disponibili
2681
+ */
2682
+ FormAdaptiveComponent.prototype.nvl = function (value, ifnod) {
2683
+ return value == null || value == undefined ? ifnod : value;
2684
+ };
2672
2685
  FormAdaptiveComponent.prototype.ngOnInit = function () {
2686
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
2687
+ // Assegnazione Opzioni da oggetto
2688
+ if (this.Options) {
2689
+ this.useJsDates = this.nvl((_a = this.Options) === null || _a === void 0 ? void 0 : _a.JsDates, this.useJsDates);
2690
+ ;
2691
+ this.CaseSensitive = this.nvl((_b = this.Options) === null || _b === void 0 ? void 0 : _b.CaseSensitive, this.CaseSensitive);
2692
+ this.MinChars = this.nvl((_c = this.Options) === null || _c === void 0 ? void 0 : _c.MinChars, this.MinChars);
2693
+ this.SearchFunction = this.nvl((_d = this.Options) === null || _d === void 0 ? void 0 : _d.SearchFunction, this.SearchFunction);
2694
+ this.Alignment = this.nvl((_e = this.Options) === null || _e === void 0 ? void 0 : _e.Alignment, this.Alignment);
2695
+ this.Precision = this.nvl((_f = this.Options) === null || _f === void 0 ? void 0 : _f.Precision, this.Precision);
2696
+ this.AllowDownload = this.nvl((_g = this.Options) === null || _g === void 0 ? void 0 : _g.AllowDownload, this.AllowDownload);
2697
+ this.AdjustNumber = this.nvl((_h = this.Options) === null || _h === void 0 ? void 0 : _h.AdjustNumber, this.AdjustNumber);
2698
+ this.Pattern = this.nvl((_j = this.Options) === null || _j === void 0 ? void 0 : _j.Pattern, this.Pattern);
2699
+ }
2673
2700
  if (this.ngControl) {
2674
2701
  var validators = this._validators || [];
2675
2702
  var pv = new forms.PatternValidator();
@@ -2701,7 +2728,7 @@
2701
2728
  var _a;
2702
2729
  return __awaiter(this, void 0, void 0, function () {
2703
2730
  var newSource, newType;
2704
- return __generator(this, function (_b) {
2731
+ return __generator(this, function (_k) {
2705
2732
  newSource = changes["Source"];
2706
2733
  newType = changes["Type"];
2707
2734
  if (newSource) {
@@ -2730,7 +2757,7 @@
2730
2757
  this.EvaluatedModel = obj;
2731
2758
  }
2732
2759
  if (this.Type == "date" || this.Type == "datetime") {
2733
- this.useJsDates = Object.prototype.toString.call(obj) === "[object Date]";
2760
+ this.useJsDates = this.useJsDates == null ? Object.prototype.toString.call(obj) === "[object Date]" : this.useJsDates;
2734
2761
  if (this.Type == "date")
2735
2762
  this.EvaluatedModel = this.datesExts.getFormatted(obj, true, false);
2736
2763
  if (this.Type == "datetime")
@@ -2747,7 +2774,7 @@
2747
2774
  this.EvaluatedModel = this.lc.loc(obj ? 'Yes' : 'No');
2748
2775
  }
2749
2776
  else if (this.Type == "time") {
2750
- var _b = __read((obj || "00:00:00").split(":"), 3), hours = _b[0], minutes = _b[1], seconds = _b[2];
2777
+ var _k = __read((obj || "00:00:00").split(":"), 3), hours = _k[0], minutes = _k[1], seconds = _k[2];
2751
2778
  obj = dayjs().hour(parseInt(hours !== null && hours !== void 0 ? hours : 0)).minute(parseInt(minutes !== null && minutes !== void 0 ? minutes : 0)).second(parseInt(seconds !== null && seconds !== void 0 ? seconds : 0));
2752
2779
  this.EvaluatedModel = (hours || '00') + ":" + (minutes || '00') + ":" + (seconds || '00');
2753
2780
  }
@@ -2958,7 +2985,8 @@
2958
2985
  Alignment: [{ type: core.Input }],
2959
2986
  SearchFunction: [{ type: core.Input }],
2960
2987
  MinChars: [{ type: core.Input }],
2961
- CaseSensitive: [{ type: core.Input }]
2988
+ CaseSensitive: [{ type: core.Input }],
2989
+ Options: [{ type: core.Input }]
2962
2990
  };
2963
2991
 
2964
2992
  // Angular
@@ -3342,6 +3370,8 @@
3342
3370
  _this.EmptyFieldValue = '-2';
3343
3371
  /** Se **true** rimuove il simbolino di validazione (croce rossa o tick verde) */
3344
3372
  _this.ShowValidationSymbol = true;
3373
+ /** Template per la visualizzazione delle opzioni */
3374
+ _this.OptionTemplate = null;
3345
3375
  return _this;
3346
3376
  }
3347
3377
  /** @ignore */
@@ -3439,7 +3469,7 @@
3439
3469
  { type: core.Component, args: [{
3440
3470
  selector: "form-select",
3441
3471
  providers: [{ provide: localizations.LocalizationService, useClass: FormSelectComponentLoc }],
3442
- template: "<!-- Uguale in tutti i componenti --------------------------------------------------------------------------->\r\n<ng-container *ngIf=\"!FormLayout && (!DisplayMode || (DisplayLayout != 'hidden' && DisplayCondition))\">\r\n <ng-container *ngIf=\"DisplayMode && !DisplayModeTemplate\">\r\n <ng-container *ngIf=\"DisplayLayout == 'form'\">{{ EvaluatedModel }}</ng-container>\r\n <div *ngIf=\"DisplayLayout == 'inline'\" class=\"app-inline\">{{ EvaluatedModel }}</div>\r\n </ng-container>\r\n <ng-container *ngIf=\"DisplayMode && DisplayModeTemplate\"><ng-container *ngTemplateOutlet=\"DisplayModeTemplate, context: { $implicit: EvaluatedModel }\"></ng-container></ng-container>\r\n <div [hidden]=\"DisplayMode\"><ng-container *ngTemplateOutlet=\"controlTemplate\"></ng-container></div>\r\n</ng-container>\r\n\r\n<div *ngIf=\"FormLayout && (!DisplayMode || (DisplayLayout != 'hidden' && DisplayCondition))\" class=\"{{FormGroupClass + (Last ? ' app-margin-bottom-0 app-margin-right-0 ' : '') + (DisplayLayout == 'inline' && DisplayMode ? (' app-inline-block ' + (!Last ? 'app-margin-right-10' : '')) : ' form-group row')}}\">\r\n\r\n <label class=\"col-md-{{(DisplayMode && DisplayLayout == 'inline' ? 'none app-bold app-margin-bottom-0' : LabelColWidth) + (DisplayMode ? ' app-bold' : ' m-t-5') }}\">{{Label}}{{Required && !DisplayMode ? '*' : ''}}{{Label ? \":\" : \"\"}}</label>\r\n <span *ngIf=\"DisplayMode && DisplayLayout == 'inline' && InlineSeparator != ''\">{{InlineSeparator}}</span>\r\n <div class=\"col-md-{{DisplayMode && DisplayLayout == 'inline' ? 'none app-inline-block' : InputColWidth}}\">\r\n\r\n <ng-container *ngIf=\"DisplayMode && !DisplayModeTemplate\">{{ EvaluatedModel }}</ng-container>\r\n <ng-container *ngIf=\"DisplayMode && DisplayModeTemplate\"><ng-container *ngTemplateOutlet=\"DisplayModeTemplate, context: { $implicit: EvaluatedModel }\"></ng-container></ng-container>\r\n <div [hidden]=\"DisplayMode\"><ng-container *ngTemplateOutlet=\"controlTemplate\"></ng-container></div>\r\n </div>\r\n <div class=\"clearfix\"></div>\r\n</div>\r\n<!----------------------------------------------------------------------------------------------------------->\r\n\r\n<ng-template #controlTemplate>\r\n\r\n <!-- Select vuota per quando non ho Sorgenti dati da cui selezionare. Uguale identica alla piena ma senza option\r\n Purtroppo devono essere due componenti distinti perch\u00E9 una select una volta creata non riesce pi\u00F9 ad adattarsi ai cambi di options -->\r\n <val-select *ngIf=\"!BoundSource || BoundSource.length == 0\"\r\n [FocusSubject]=\"FocusSubject\" [FieldAppearence]=\"FieldAppearence\"\r\n [required]=\"Required ? 'required' : null\"\r\n [noValidate]=\"!Validation\"\r\n [readonly]=\"Readonly\"\r\n [label]=\"SelectLabel\"\r\n [validationFailed]=\"FailedValidationMessage\"\r\n [placeholder]=\"Required ? ((RequiredPlaceholder != null ? RequiredPlaceholder : ('Select' | localize : lc) + '...')) : Placeholder\"\r\n [placeHolderValue]=\"PlaceholderValue\"\r\n [submitted]=\"Form?.submitted\"\r\n [emptyFieldValue]=\"Required || Placeholder || SelectLabel ? EmptyFieldValue : ''\"\r\n [(ngModel)]=\"Model\"\r\n [showValidationSymbol]=\"ShowValidationSymbol\"\r\n [id]=\"GeneratedName\"\r\n name=\"{{GeneratedName}}_zero\"\r\n (inputChange)=\"Model = $event.value == EmptyFieldValue ? (Required? PlaceholderValue : '') : $event.value; changed($event.internal);\"\r\n (inputFocus)=\"focused($event);\"\r\n #validationControl=\"ngModel\">\r\n </val-select>\r\n\r\n <!-- Select vera e propria per quando arrivano i dati -->\r\n <val-select *ngIf=\"BoundSource && BoundSource.length > 0\"\r\n [FocusSubject]=\"FocusSubject\" [FieldAppearence]=\"FieldAppearence\"\r\n [required]=\"Required ? 'required' : null\"\r\n [noValidate]=\"!Validation\"\r\n [readonly]=\"Readonly\"\r\n [label]=\"SelectLabel\"\r\n [validationFailed]=\"FailedValidationMessage\"\r\n [showValidationSymbol]=\"ShowValidationSymbol\"\r\n [placeholder]=\"Required ? ((RequiredPlaceholder != null ? RequiredPlaceholder : ('Select' | localize : lc) + '...')) : Placeholder\"\r\n [placeHolderValue]=\"PlaceholderValue\"\r\n [submitted]=\"Form?.submitted\"\r\n [emptyFieldValue]=\"Required || Placeholder || SelectLabel ? EmptyFieldValue : ''\"\r\n [(ngModel)]=\"Model\"\r\n [id]=\"GeneratedName\"\r\n name=\"{{GeneratedName}}_filled\"\r\n (inputChange)=\"Model = $event.value == EmptyFieldValue ? (Required? PlaceholderValue : '') : $event.value; changed($event.internal);\"\r\n (inputFocus)=\"focused($event);\"\r\n (inputFinalized)=\"finalized()\"\r\n #validationControl=\"ngModel\">\r\n <option *ngFor=\"let obj of BoundSource\" [value]=\"obj.id\">{{obj.description}}</option>\r\n </val-select>\r\n</ng-template>",
3472
+ template: "<!-- Uguale in tutti i componenti --------------------------------------------------------------------------->\r\n<ng-container *ngIf=\"!FormLayout && (!DisplayMode || (DisplayLayout != 'hidden' && DisplayCondition))\">\r\n <ng-container *ngIf=\"DisplayMode && !DisplayModeTemplate\">\r\n <ng-container *ngIf=\"DisplayLayout == 'form'\">{{ EvaluatedModel }}</ng-container>\r\n <div *ngIf=\"DisplayLayout == 'inline'\" class=\"app-inline\">{{ EvaluatedModel }}</div>\r\n </ng-container>\r\n <ng-container *ngIf=\"DisplayMode && DisplayModeTemplate\"><ng-container *ngTemplateOutlet=\"DisplayModeTemplate, context: { $implicit: EvaluatedModel }\"></ng-container></ng-container>\r\n <div [hidden]=\"DisplayMode\"><ng-container *ngTemplateOutlet=\"controlTemplate\"></ng-container></div>\r\n</ng-container>\r\n\r\n<div *ngIf=\"FormLayout && (!DisplayMode || (DisplayLayout != 'hidden' && DisplayCondition))\" class=\"{{FormGroupClass + (Last ? ' app-margin-bottom-0 app-margin-right-0 ' : '') + (DisplayLayout == 'inline' && DisplayMode ? (' app-inline-block ' + (!Last ? 'app-margin-right-10' : '')) : ' form-group row')}}\">\r\n\r\n <label class=\"col-md-{{(DisplayMode && DisplayLayout == 'inline' ? 'none app-bold app-margin-bottom-0' : LabelColWidth) + (DisplayMode ? ' app-bold' : ' m-t-5') }}\">{{Label}}{{Required && !DisplayMode ? '*' : ''}}{{Label ? \":\" : \"\"}}</label>\r\n <span *ngIf=\"DisplayMode && DisplayLayout == 'inline' && InlineSeparator != ''\">{{InlineSeparator}}</span>\r\n <div class=\"col-md-{{DisplayMode && DisplayLayout == 'inline' ? 'none app-inline-block' : InputColWidth}}\">\r\n\r\n <ng-container *ngIf=\"DisplayMode && !DisplayModeTemplate\">{{ EvaluatedModel }}</ng-container>\r\n <ng-container *ngIf=\"DisplayMode && DisplayModeTemplate\"><ng-container *ngTemplateOutlet=\"DisplayModeTemplate, context: { $implicit: EvaluatedModel }\"></ng-container></ng-container>\r\n <div [hidden]=\"DisplayMode\"><ng-container *ngTemplateOutlet=\"controlTemplate\"></ng-container></div>\r\n </div>\r\n <div class=\"clearfix\"></div>\r\n</div>\r\n<!----------------------------------------------------------------------------------------------------------->\r\n\r\n<ng-template #controlTemplate>\r\n\r\n <!-- Select vuota per quando non ho Sorgenti dati da cui selezionare. Uguale identica alla piena ma senza option\r\n Purtroppo devono essere due componenti distinti perch\u00E9 una select una volta creata non riesce pi\u00F9 ad adattarsi ai cambi di options -->\r\n <val-select *ngIf=\"!BoundSource || BoundSource.length == 0\"\r\n [FocusSubject]=\"FocusSubject\" [FieldAppearence]=\"FieldAppearence\"\r\n [required]=\"Required ? 'required' : null\"\r\n [noValidate]=\"!Validation\"\r\n [readonly]=\"Readonly\"\r\n [label]=\"SelectLabel\"\r\n [validationFailed]=\"FailedValidationMessage\"\r\n [placeholder]=\"Required ? ((RequiredPlaceholder != null ? RequiredPlaceholder : ('Select' | localize : lc) + '...')) : Placeholder\"\r\n [placeHolderValue]=\"PlaceholderValue\"\r\n [submitted]=\"Form?.submitted\"\r\n [emptyFieldValue]=\"Required || Placeholder || SelectLabel ? EmptyFieldValue : ''\"\r\n [(ngModel)]=\"Model\"\r\n [showValidationSymbol]=\"ShowValidationSymbol\"\r\n [id]=\"GeneratedName\"\r\n name=\"{{GeneratedName}}_zero\"\r\n (inputChange)=\"Model = $event.value == EmptyFieldValue ? (Required? PlaceholderValue : '') : $event.value; changed($event.internal);\"\r\n (inputFocus)=\"focused($event);\"\r\n #validationControl=\"ngModel\">\r\n </val-select>\r\n\r\n <!-- Select vera e propria per quando arrivano i dati -->\r\n <val-select *ngIf=\"BoundSource && BoundSource.length > 0\"\r\n [FocusSubject]=\"FocusSubject\" [FieldAppearence]=\"FieldAppearence\"\r\n [required]=\"Required ? 'required' : null\"\r\n [noValidate]=\"!Validation\"\r\n [readonly]=\"Readonly\"\r\n [label]=\"SelectLabel\"\r\n [validationFailed]=\"FailedValidationMessage\"\r\n [showValidationSymbol]=\"ShowValidationSymbol\"\r\n [placeholder]=\"Required ? ((RequiredPlaceholder != null ? RequiredPlaceholder : ('Select' | localize : lc) + '...')) : Placeholder\"\r\n [placeHolderValue]=\"PlaceholderValue\"\r\n [submitted]=\"Form?.submitted\"\r\n [emptyFieldValue]=\"Required || Placeholder || SelectLabel ? EmptyFieldValue : ''\"\r\n [(ngModel)]=\"Model\"\r\n [id]=\"GeneratedName\"\r\n name=\"{{GeneratedName}}_filled\"\r\n (inputChange)=\"Model = $event.value == EmptyFieldValue ? (Required? PlaceholderValue : '') : $event.value; changed($event.internal);\"\r\n (inputFocus)=\"focused($event);\"\r\n (inputFinalized)=\"finalized()\"\r\n #validationControl=\"ngModel\">\r\n <option *ngFor=\"let obj of BoundSource\" [value]=\"obj.id\">\r\n <ng-container *ngIf=\"OptionTemplate\">\r\n <ng-container *ngTemplateOutlet=\"OptionTemplate; context: { $implicit : obj }\"></ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!OptionTemplate\">{{obj.description}}</ng-container>\r\n </option>\r\n </val-select>\r\n</ng-template>",
3443
3473
  changeDetection: core.ChangeDetectionStrategy.OnPush
3444
3474
  },] }
3445
3475
  ];
@@ -3458,7 +3488,8 @@
3458
3488
  PlaceholderValue: [{ type: core.Input }],
3459
3489
  RequiredPlaceholder: [{ type: core.Input }],
3460
3490
  EmptyFieldValue: [{ type: core.Input }],
3461
- ShowValidationSymbol: [{ type: core.Input }]
3491
+ ShowValidationSymbol: [{ type: core.Input }],
3492
+ OptionTemplate: [{ type: core.Input }]
3462
3493
  };
3463
3494
 
3464
3495
  /**