@esfaenza/es-table 11.2.1 → 11.2.5

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.
@@ -193,6 +193,31 @@ class EsTableColumn {
193
193
  }
194
194
  }
195
195
 
196
+ /**
197
+ * Identifica una selezione applicabile agli oggetti presentati in una tabella
198
+ */
199
+ class ItemsSelection {
200
+ /**
201
+ * Costruttore
202
+ *
203
+ * @param {T[]} selected Oggetti da considerare selezionati
204
+ */
205
+ constructor(selected) {
206
+ /**
207
+ * Indica se tutti gli elementi sono da considerarsi selezionati (anche quelli di altre pagine)
208
+ */
209
+ this.all = false;
210
+ /**
211
+ * Se **all** è **true**, indica gli elementi da escludere, altrimenti è insensato
212
+ */
213
+ this.exclusions = [];
214
+ this.count = selected.length;
215
+ this.items = selected;
216
+ this.all = false;
217
+ this.exclusions = [];
218
+ }
219
+ }
220
+
196
221
  //Angular
197
222
  /**
198
223
  * Componente rappresentante una singola cella del body della tabella
@@ -512,31 +537,6 @@ EsTableLoc.ctorParameters = () => [
512
537
  { type: String, decorators: [{ type: Optional }, { type: Inject, args: [EST_LOCALE,] }] }
513
538
  ];
514
539
 
515
- /**
516
- * Identifica una selezione applicabile agli oggetti presentati in una tabella
517
- */
518
- class ItemsSelection {
519
- /**
520
- * Costruttore
521
- *
522
- * @param {T[]} selected Oggetti da considerare selezionati
523
- */
524
- constructor(selected) {
525
- /**
526
- * Indica se tutti gli elementi sono da considerarsi selezionati (anche quelli di altre pagine)
527
- */
528
- this.all = false;
529
- /**
530
- * Se **all** è **true**, indica gli elementi da escludere, altrimenti è insensato
531
- */
532
- this.exclusions = [];
533
- this.count = selected.length;
534
- this.items = selected;
535
- this.all = false;
536
- this.exclusions = [];
537
- }
538
- }
539
-
540
540
  /** Componente che permette di rappresentare una griglia di valori */
541
541
  class EsTableComponent {
542
542
  /** @ignore */
@@ -806,7 +806,7 @@ class EsTableComponent {
806
806
  }
807
807
  /** @ignore */
808
808
  ngOnInit() {
809
- //Per poter cambiare il layout in base al livello gerarchico il componente deva avere il pieno controllo di ogni cella,
809
+ //Per poter cambiare il layout in base al livello gerarchico il componente deva avere il pieno controllo di ogni cella,
810
810
  //che con solo la proiezione (senza celle cusotm) non è disponibile
811
811
  if (this.Hierarchy && !this.UseCustomCells)
812
812
  throw "Es-table error: Per poter utilizzare l'es-table con [Hierarchy]=\"true\" è richiesto anche [UseCustomCells]=\"true\"";
@@ -900,7 +900,7 @@ class EsTableComponent {
900
900
  }
901
901
  this.arrayPulsanti = this.getPagesArray(6, this.View.page, this.View.pages || 1);
902
902
  }
903
- else if (this.View && this.View.length) {
903
+ else if (this.View && (this.View.length != null && this.View.length != undefined)) {
904
904
  this.setMode('array');
905
905
  if (!this.UseSelectionCache || !this.arraymodeSelection) {
906
906
  this.selOrDeselCache = {};
@@ -1723,10 +1723,12 @@ class EsTableComponent {
1723
1723
  let selectionItem = ((_a = this.View) === null || _a === void 0 ? void 0 : _a.selection) || this.arraymodeSelection;
1724
1724
  // Se sono in modalità di selezione singola e devo selezionare un'oggetto, per prima cosa devo deselezionare tutti gli altri
1725
1725
  if (this.SingleSelection && ((_b = items[0]) === null || _b === void 0 ? void 0 : _b._selected)) {
1726
- if (items.length > 0 && forcedVal == null)
1726
+ if (items.length > 1 && forcedVal == null)
1727
1727
  throw "Tentativo di selezionare o deselezionare più di un elemento con SingleSelection attivo";
1728
- if (items.length == 1 && forcedVal == null)
1728
+ if (items.length == 1 && forcedVal == null) {
1729
1729
  selectionItem = this.handleItemsSelection(this.getItemsByMode(), false, null);
1730
+ items[0]._selected = true;
1731
+ }
1730
1732
  }
1731
1733
  for (let i = 0; i < items.length; i++) {
1732
1734
  let item = items[i];
@@ -1763,7 +1765,7 @@ class EsTableComponent {
1763
1765
  }
1764
1766
  }
1765
1767
  }
1766
- // Imposto il check globale in base a se tutti gli elementi sono selezionati o meno.
1768
+ // Imposto il check globale in base a se tutti gli elementi sono selezionati o meno.
1767
1769
  // Evito di fare queste operazioni se la selezione deriva proprio dal global Check
1768
1770
  // Non è ottimizzatissimo mettere 2 some ma scrivere questo codice a for sono tipo 25 righe....
1769
1771
  if (globalCheck == null)
@@ -2448,5 +2450,5 @@ EsTableModule.decorators = [
2448
2450
  * Generated bundle index. Do not edit.
2449
2451
  */
2450
2452
 
2451
- export { AppOrdering, AppSearch, CornerMenuOption, EsTableColumn, EsTableColumnsDefinition, EsTableComponent, EsTableModule, EsTableModuleConfig, EsTableOperationDefinition, EsTd, EsTh, GenericItem, ReportColumn, ReportDefinition, ReportOrder, ReportParam, ReportResult, ReportRow, EsTableLoc as ɵa, EST_LOCALE as ɵb, TablePagerComponent as ɵc, TablePagerLoc as ɵd };
2453
+ export { AppOrdering, AppSearch, CornerMenuOption, EsTableColumn, EsTableColumnsDefinition, EsTableComponent, EsTableModule, EsTableModuleConfig, EsTableOperationDefinition, EsTd, EsTh, GenericItem, ItemsSelection, ReportColumn, ReportDefinition, ReportOrder, ReportParam, ReportResult, ReportRow, EsTableLoc as ɵa, EST_LOCALE as ɵb, TablePagerComponent as ɵc, TablePagerLoc as ɵd };
2452
2454
  //# sourceMappingURL=esfaenza-es-table.js.map