@esfaenza/forms-and-validations 11.2.38 → 11.2.42

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.
@@ -2340,6 +2340,10 @@
2340
2340
  * Numero minimo di caratteri con cui cercare
2341
2341
  */
2342
2342
  _this.MinChars = 3;
2343
+ /**
2344
+ * Indica se i controlli devono essere effettuati tenendo conto del Case o meno. Vale solo qualora la **Source** fosse fornita
2345
+ */
2346
+ _this.CaseSensitive = false;
2343
2347
  /**
2344
2348
  * Variabile interna che gestisce se effettuare il riallineamento dei dati o meno
2345
2349
  */
@@ -2373,8 +2377,10 @@
2373
2377
  if (newSource) {
2374
2378
  this.tryBindSourceDisplay();
2375
2379
  // Prima assegnazione se cambia la source sotto (quindi se viene bindata direttamente da HTML)
2376
- if (this.Type == "autocomplete" && ((_a = this.Model) === null || _a === void 0 ? void 0 : _a.length) >= this.MinChars && !this.SearchFunction)
2380
+ if (this.Type == "autocomplete" && (((_a = this.Model) === null || _a === void 0 ? void 0 : _a.length) || 0) >= this.MinChars && !this.SearchFunction)
2377
2381
  this.FilteredBoundSource = this.BoundSource;
2382
+ else
2383
+ this.FilteredBoundSource = [];
2378
2384
  this.cdr.markForCheck();
2379
2385
  }
2380
2386
  if (newType && this.Model)
@@ -2445,8 +2451,14 @@
2445
2451
  }
2446
2452
  // Quando filtro la source, se non devo ignorare l'evento devo comunque assicurarmi di impostare il valore selezionato a null
2447
2453
  _super.prototype.changed.call(this, "");
2448
- if (!event || event.length < this.MinChars)
2454
+ if (!event && this.MinChars == 0 && !this.SearchFunction) {
2455
+ this.FilteredBoundSource = this.BoundSource;
2456
+ return;
2457
+ }
2458
+ if (!event || event.length < this.MinChars) {
2459
+ this.FilteredBoundSource = [];
2449
2460
  return;
2461
+ }
2450
2462
  if (!this.SearchFunction && (!this.Source || this.Source.length == 0))
2451
2463
  throw "Impossibile filtrare gli elementi senza una funzione di ricerca che restituisca una lista di { id: string, description: string }";
2452
2464
  if (this.SearchFunction) {
@@ -2463,7 +2475,7 @@
2463
2475
  else {
2464
2476
  this.throttla("filtersource", function () {
2465
2477
  // In questo caso devo filtrare io in memoria
2466
- _this.FilteredBoundSource = _this.BoundSource.filter(function (t) { return t.description.includes(event); });
2478
+ _this.FilteredBoundSource = _this.BoundSource.filter(function (t) { return (_this.CaseSensitive && t.description.includes(event)) || (!_this.CaseSensitive && t.description.toLowerCase().includes(event.toLowerCase())); });
2467
2479
  _this.cdr.markForCheck();
2468
2480
  }, 100);
2469
2481
  }
@@ -2562,7 +2574,8 @@
2562
2574
  Precision: [{ type: core.Input }],
2563
2575
  Alignment: [{ type: core.Input }],
2564
2576
  SearchFunction: [{ type: core.Input }],
2565
- MinChars: [{ type: core.Input }]
2577
+ MinChars: [{ type: core.Input }],
2578
+ CaseSensitive: [{ type: core.Input }]
2566
2579
  };
2567
2580
 
2568
2581
  // Angular
@@ -3149,7 +3162,8 @@
3149
3162
  text: this.SelectLabel || this.lc.loc("Select one or more values..."),
3150
3163
  enableCheckAll: true,
3151
3164
  disabled: disabled,
3152
- labelKey: "description"
3165
+ labelKey: "description",
3166
+ tagToBody: false
3153
3167
  };
3154
3168
  };
3155
3169
  /**
@@ -3309,6 +3323,10 @@
3309
3323
  * Override del placeholder per select requried
3310
3324
  */
3311
3325
  _this.RequiredPlaceholder = null;
3326
+ /**
3327
+ * Indica se i controlli devono essere effettuati tenendo conto del Case o meno. Vale solo qualora la **Source** fosse fornita
3328
+ */
3329
+ _this.CaseSensitive = false;
3312
3330
  /**
3313
3331
  * Indica se ignorare il prossimo evento writeValue che normalmente dovrebbe richiedere la nuova source. Serve per quando l'utente seleziona un elemento:
3314
3332
  * Subito dopo partirebbe un altro evento modelChange che ricaricherebbe nuovamente la source
@@ -3364,8 +3382,14 @@
3364
3382
  }
3365
3383
  // Quando filtro la source, se non devo ignorare l'evento devo comunque assicurarmi di impostare il valore selezionato a null
3366
3384
  _super.prototype.changed.call(this, "");
3367
- if (!event || event.length < this.MinChars)
3385
+ if (!event && this.MinChars == 0 && !this.SearchFunction) {
3386
+ this.FilteredBoundSource = this.BoundSource;
3387
+ return;
3388
+ }
3389
+ if (!event || event.length < this.MinChars) {
3390
+ this.FilteredBoundSource = [];
3368
3391
  return;
3392
+ }
3369
3393
  if (!this.SearchFunction && (!this.Source || this.Source.length == 0))
3370
3394
  throw "Impossibile filtrare gli elementi senza una funzione di ricerca che restituisca una lista di { id: string, description: string }";
3371
3395
  if (this.SearchFunction) {
@@ -3382,7 +3406,7 @@
3382
3406
  else {
3383
3407
  this.throttla("filtersource", function () {
3384
3408
  // In questo caso devo filtrare io in memoria
3385
- _this.FilteredBoundSource = _this.BoundSource.filter(function (t) { return t.description.includes(event); });
3409
+ _this.FilteredBoundSource = _this.BoundSource.filter(function (t) { return (_this.CaseSensitive && t.description.includes(event)) || (!_this.CaseSensitive && t.description.toLowerCase().includes(event.toLowerCase())); });
3386
3410
  _this.cdr.markForCheck();
3387
3411
  }, 100);
3388
3412
  }
@@ -3396,8 +3420,10 @@
3396
3420
  if (newSource) {
3397
3421
  this.tryBindSourceDisplay();
3398
3422
  // Prima assegnazione se cambia la source sotto (quindi se viene bindata direttamente da HTML)
3399
- if (((_a = this.Model) === null || _a === void 0 ? void 0 : _a.length) >= this.MinChars && !this.SearchFunction)
3423
+ if ((((_a = this.Model) === null || _a === void 0 ? void 0 : _a.length) || 0) >= this.MinChars && !this.SearchFunction)
3400
3424
  this.FilteredBoundSource = this.BoundSource;
3425
+ else
3426
+ this.FilteredBoundSource = [];
3401
3427
  this.cdr.markForCheck();
3402
3428
  }
3403
3429
  };
@@ -3448,7 +3474,8 @@
3448
3474
  SelectLabel: [{ type: core.Input }],
3449
3475
  SearchFunction: [{ type: core.Input }],
3450
3476
  MinChars: [{ type: core.Input }],
3451
- RequiredPlaceholder: [{ type: core.Input }]
3477
+ RequiredPlaceholder: [{ type: core.Input }],
3478
+ CaseSensitive: [{ type: core.Input }]
3452
3479
  };
3453
3480
 
3454
3481
  /**