@esfaenza/es-table 11.2.31 → 11.2.35

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.
@@ -1605,8 +1605,19 @@
1605
1605
  this.est.OrderDirectives.push(order);
1606
1606
  }
1607
1607
  }
1608
- else
1608
+ else {
1609
1609
  this.est.OrderDirectives = orderings;
1610
+ var _loop_2 = function (i) {
1611
+ var th = ths[i];
1612
+ var thId = this_2.utilities.isEsTh(th) ? th.ID : th.th;
1613
+ if (!this_2.est.OrderDirectives.find(function (o) { return o == thId; }))
1614
+ this_2.est.OrderDirectives.push(thId);
1615
+ };
1616
+ var this_2 = this;
1617
+ for (var i = 0; i < ths.length; i++) {
1618
+ _loop_2(i);
1619
+ }
1620
+ }
1610
1621
  };
1611
1622
  /**
1612
1623
  * Applica l'ordine specificato alle varie colonne
@@ -1630,19 +1641,19 @@
1630
1641
  newHeaders.push(heaedrItem);
1631
1642
  });
1632
1643
  this.est.TMPRowTHs = newHeaders;
1633
- var _loop_2 = function (i) {
1634
- var context = this_2.est.TMPRowTDs[this_2.est.RowContexts[i]];
1644
+ var _loop_3 = function (i) {
1645
+ var context = this_3.est.TMPRowTDs[this_3.est.RowContexts[i]];
1635
1646
  var newContext = [];
1636
- this_2.est.OrderDirectives.forEach(function (o) {
1647
+ this_3.est.OrderDirectives.forEach(function (o) {
1637
1648
  var contextItem = context.filter(function (t) { return t.ID == o; })[0];
1638
1649
  newContext.push(contextItem);
1639
1650
  });
1640
- this_2.est.TMPRowTDs[this_2.est.RowContexts[i]] = newContext;
1651
+ this_3.est.TMPRowTDs[this_3.est.RowContexts[i]] = newContext;
1641
1652
  };
1642
- var this_2 = this;
1653
+ var this_3 = this;
1643
1654
  // Genero ordinamento per le celle
1644
1655
  for (var i = 0; i < this.est.RowContexts.length; i++) {
1645
- _loop_2(i);
1656
+ _loop_3(i);
1646
1657
  }
1647
1658
  }
1648
1659
  if (this.est.viewMode)
@@ -1806,7 +1817,7 @@
1806
1817
  var columns = this.est.arrayMode ? this.est.arrayColumns : castedView.columns;
1807
1818
  var columnsOrderings = this.est.arrayMode ? this.est.arrayColumnOrdering : castedView.column_ordering;
1808
1819
  var toStore = { columns: JSON.parse(JSON.stringify(columns)), column_ordering: JSON.parse(JSON.stringify(columnsOrderings)) };
1809
- this.prefService.store(this.est.ngControl.name, toStore).subscribe();
1820
+ this.prefService.store(this.est.ngControl.name, toStore, 'preference').subscribe();
1810
1821
  }
1811
1822
  // Rieseguo l'ultima ricerca bindata alla tabella
1812
1823
  // Mi assicuro di farlo dopo l'espansione del changed o rischio che la ricerca mi ridia colonne che in realtà non esistono
@@ -2008,12 +2019,18 @@
2008
2019
  h = this.est.headers[i_1];
2009
2020
  cell = row.getCell(i_1 + 1);
2010
2021
  val = item[h.key];
2011
- if (h.type == 'date')
2012
- cell.value = this.dateExts.getDateConvertion(val).toDate();
2013
- else if (h.type == 'number')
2014
- cell.value = parseFloat(val.replace(',', '.'));
2015
- else
2016
- cell.value = val;
2022
+ if (val == null || val == undefined)
2023
+ cell.value = "";
2024
+ else {
2025
+ switch (h.type) {
2026
+ case 'date':
2027
+ cell.value = this.dateExts.getDateConvertion(val).toDate();
2028
+ case 'number':
2029
+ cell.value = parseFloat(val.replace(',', '.'));
2030
+ default:
2031
+ cell.value = val;
2032
+ }
2033
+ }
2017
2034
  }
2018
2035
  }
2019
2036
  return [4 /*yield*/, workbook.xlsx.writeBuffer()];
@@ -4095,8 +4112,8 @@
4095
4112
  case 3: return [4 /*yield*/, this.prefService.retrieve(this.ngControl.name).toPromise()];
4096
4113
  case 4:
4097
4114
  prefs = _s.sent();
4098
- this.View.columns = prefs.columns;
4099
- this.View.column_ordering = prefs.column_ordering;
4115
+ this.View.columns = (prefs === null || prefs === void 0 ? void 0 : prefs.columns) || [];
4116
+ this.View.column_ordering = (prefs === null || prefs === void 0 ? void 0 : prefs.column_ordering) || [];
4100
4117
  _s.label = 5;
4101
4118
  case 5:
4102
4119
  // La paginazione devo farla solamente quando richiedo o un gruppo principale (se sono in row grouping) o se non richiedo gruppi (in tutti lgi altri casi)
@@ -4122,8 +4139,8 @@
4122
4139
  case 8: return [4 /*yield*/, this.prefService.retrieve(this.ngControl.name).toPromise()];
4123
4140
  case 9:
4124
4141
  prefs = _s.sent();
4125
- this.arrayColumns = prefs.columns;
4126
- this.arrayColumnOrdering = prefs.column_ordering;
4142
+ this.arrayColumns = (prefs === null || prefs === void 0 ? void 0 : prefs.columns) || [];
4143
+ this.arrayColumnOrdering = (prefs === null || prefs === void 0 ? void 0 : prefs.column_ordering) || [];
4127
4144
  _s.label = 10;
4128
4145
  case 10:
4129
4146
  if (this.SearchView)