@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.
@@ -528,6 +528,32 @@
528
528
  return EsTableColumn;
529
529
  }());
530
530
 
531
+ /**
532
+ * Identifica una selezione applicabile agli oggetti presentati in una tabella
533
+ */
534
+ var ItemsSelection = /** @class */ (function () {
535
+ /**
536
+ * Costruttore
537
+ *
538
+ * @param {T[]} selected Oggetti da considerare selezionati
539
+ */
540
+ function ItemsSelection(selected) {
541
+ /**
542
+ * Indica se tutti gli elementi sono da considerarsi selezionati (anche quelli di altre pagine)
543
+ */
544
+ this.all = false;
545
+ /**
546
+ * Se **all** è **true**, indica gli elementi da escludere, altrimenti è insensato
547
+ */
548
+ this.exclusions = [];
549
+ this.count = selected.length;
550
+ this.items = selected;
551
+ this.all = false;
552
+ this.exclusions = [];
553
+ }
554
+ return ItemsSelection;
555
+ }());
556
+
531
557
  //Angular
532
558
  /**
533
559
  * Componente rappresentante una singola cella del body della tabella
@@ -860,32 +886,6 @@
860
886
  { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [EST_LOCALE,] }] }
861
887
  ]; };
862
888
 
863
- /**
864
- * Identifica una selezione applicabile agli oggetti presentati in una tabella
865
- */
866
- var ItemsSelection = /** @class */ (function () {
867
- /**
868
- * Costruttore
869
- *
870
- * @param {T[]} selected Oggetti da considerare selezionati
871
- */
872
- function ItemsSelection(selected) {
873
- /**
874
- * Indica se tutti gli elementi sono da considerarsi selezionati (anche quelli di altre pagine)
875
- */
876
- this.all = false;
877
- /**
878
- * Se **all** è **true**, indica gli elementi da escludere, altrimenti è insensato
879
- */
880
- this.exclusions = [];
881
- this.count = selected.length;
882
- this.items = selected;
883
- this.all = false;
884
- this.exclusions = [];
885
- }
886
- return ItemsSelection;
887
- }());
888
-
889
889
  /** Componente che permette di rappresentare una griglia di valori */
890
890
  var EsTableComponent = /** @class */ (function () {
891
891
  /** @ignore */
@@ -1156,7 +1156,7 @@
1156
1156
  /** @ignore */
1157
1157
  EsTableComponent.prototype.ngOnInit = function () {
1158
1158
  var _this = this;
1159
- //Per poter cambiare il layout in base al livello gerarchico il componente deva avere il pieno controllo di ogni cella,
1159
+ //Per poter cambiare il layout in base al livello gerarchico il componente deva avere il pieno controllo di ogni cella,
1160
1160
  //che con solo la proiezione (senza celle cusotm) non è disponibile
1161
1161
  if (this.Hierarchy && !this.UseCustomCells)
1162
1162
  throw "Es-table error: Per poter utilizzare l'es-table con [Hierarchy]=\"true\" è richiesto anche [UseCustomCells]=\"true\"";
@@ -1254,7 +1254,7 @@
1254
1254
  }
1255
1255
  this.arrayPulsanti = this.getPagesArray(6, this.View.page, this.View.pages || 1);
1256
1256
  }
1257
- else if (this.View && this.View.length) {
1257
+ else if (this.View && (this.View.length != null && this.View.length != undefined)) {
1258
1258
  this.setMode('array');
1259
1259
  if (!this.UseSelectionCache || !this.arraymodeSelection) {
1260
1260
  this.selOrDeselCache = {};
@@ -2102,10 +2102,12 @@
2102
2102
  var selectionItem = ((_a = this.View) === null || _a === void 0 ? void 0 : _a.selection) || this.arraymodeSelection;
2103
2103
  // Se sono in modalità di selezione singola e devo selezionare un'oggetto, per prima cosa devo deselezionare tutti gli altri
2104
2104
  if (this.SingleSelection && ((_b = items[0]) === null || _b === void 0 ? void 0 : _b._selected)) {
2105
- if (items.length > 0 && forcedVal == null)
2105
+ if (items.length > 1 && forcedVal == null)
2106
2106
  throw "Tentativo di selezionare o deselezionare più di un elemento con SingleSelection attivo";
2107
- if (items.length == 1 && forcedVal == null)
2107
+ if (items.length == 1 && forcedVal == null) {
2108
2108
  selectionItem = this.handleItemsSelection(this.getItemsByMode(), false, null);
2109
+ items[0]._selected = true;
2110
+ }
2109
2111
  }
2110
2112
  for (var i = 0; i < items.length; i++) {
2111
2113
  var item = items[i];
@@ -2142,7 +2144,7 @@
2142
2144
  }
2143
2145
  }
2144
2146
  }
2145
- // Imposto il check globale in base a se tutti gli elementi sono selezionati o meno.
2147
+ // Imposto il check globale in base a se tutti gli elementi sono selezionati o meno.
2146
2148
  // Evito di fare queste operazioni se la selezione deriva proprio dal global Check
2147
2149
  // Non è ottimizzatissimo mettere 2 some ma scrivere questo codice a for sono tipo 25 righe....
2148
2150
  if (globalCheck == null)
@@ -2855,6 +2857,7 @@
2855
2857
  exports.EsTd = EsTd;
2856
2858
  exports.EsTh = EsTh;
2857
2859
  exports.GenericItem = GenericItem;
2860
+ exports.ItemsSelection = ItemsSelection;
2858
2861
  exports.ReportColumn = ReportColumn;
2859
2862
  exports.ReportDefinition = ReportDefinition;
2860
2863
  exports.ReportOrder = ReportOrder;