@seniorsistemas/angular-components 16.12.1 → 16.12.2

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.
@@ -5590,20 +5590,7 @@ var TableFrozenPositionDirective = /** @class */ (function () {
5590
5590
  this.table.styleClass = (this.table.styleClass || "") + " s-table-frozen-position";
5591
5591
  this.setUpTableEvents();
5592
5592
  window.addEventListener("resize", this.handleWindowResize.bind(this));
5593
- var componentId = new Date().getTime();
5594
5593
  var htmlHead = document.getElementsByTagName("head")[0];
5595
- this.resetRowHeightClassName = "resetTableRowsHeight_" + componentId;
5596
- var styleReset = document.createElement("style");
5597
- styleReset.innerHTML = "." + this.resetRowHeightClassName + " tbody > tr, ." + this.resetRowHeightClassName + " thead > tr { height: auto; }";
5598
- htmlHead.appendChild(styleReset);
5599
- this.fixBodyRowClassName = "fixTableBodyRowsHeight_" + componentId;
5600
- this.styleFixBodyRowHeight = document.createElement("style");
5601
- this.styleFixBodyRowHeight.innerHTML = "." + this.fixBodyRowClassName + " tbody > tr { height: auto; }";
5602
- htmlHead.appendChild(this.styleFixBodyRowHeight);
5603
- this.fixHeadRowClassName = "fixTableHeadRowsHeight_" + componentId;
5604
- this.styleFixHeadRowHeight = document.createElement("style");
5605
- this.styleFixHeadRowHeight.innerHTML = "." + this.fixHeadRowClassName + " thead > tr { height: auto; }";
5606
- htmlHead.appendChild(this.styleFixHeadRowHeight);
5607
5594
  var expandFrozenStyle = document.createElement("style");
5608
5595
  expandFrozenStyle.innerHTML = ".s-table-frozen-position .ui-table-frozen-view .sds-expanded-row > td { visibility: hidden; }";
5609
5596
  htmlHead.appendChild(expandFrozenStyle);
@@ -5733,98 +5720,84 @@ var TableFrozenPositionDirective = /** @class */ (function () {
5733
5720
  TableFrozenPositionDirective.prototype.synchronizeRowHeight = function () {
5734
5721
  var tableBodyWrappers = this.el.nativeElement.getElementsByClassName("ui-table-scrollable-body");
5735
5722
  var tableBodies = __spread(tableBodyWrappers).map(function (divWrapper) { return __spread(divWrapper.childNodes).find(function (p) { return p.tagName === "TABLE"; }); });
5736
- this.recalculateDefaultRowHeight(tableBodies);
5737
- this.applyMaxRowHeight(tableBodies);
5723
+ this._resetRowHeight(tableBodies);
5724
+ this._applyMaxRowHeight(tableBodies);
5738
5725
  var tableHeadWrappers = this.el.nativeElement.getElementsByClassName("ui-table-scrollable-header-box");
5739
5726
  var tableHeads = __spread(tableHeadWrappers).map(function (divWrapper) { return __spread(divWrapper.childNodes).find(function (p) { return p.tagName === "TABLE"; }); });
5740
- this.recalculateDefaultRowHeight(tableHeads);
5741
- this.applyMaxRowHeight(tableHeads, true);
5727
+ this._resetRowHeight(tableHeads);
5728
+ this._applyMaxRowHeight(tableHeads);
5742
5729
  };
5743
- TableFrozenPositionDirective.prototype.recalculateDefaultRowHeight = function (tables) {
5744
- var e_1, _a;
5745
- try {
5746
- for (var tables_1 = __values(tables), tables_1_1 = tables_1.next(); !tables_1_1.done; tables_1_1 = tables_1.next()) {
5747
- var table = tables_1_1.value;
5748
- table.classList.remove(this.fixBodyRowClassName);
5749
- table.classList.remove(this.fixHeadRowClassName);
5750
- table.classList.add(this.resetRowHeightClassName);
5751
- }
5730
+ TableFrozenPositionDirective.prototype._applyMaxRowHeight = function (tables) {
5731
+ var e_1, _a, e_2, _b;
5732
+ if (!tables || !tables.length) {
5733
+ return;
5752
5734
  }
5753
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
5754
- finally {
5735
+ var lengths = tables.map(function (table) { return table.rows.length; });
5736
+ var maxLength = lengths.reduce(function (accumulator, currentValue) { return Math.max(accumulator, currentValue); }, lengths[0]);
5737
+ var minLength = lengths.reduce(function (accumulator, currentValue) { return Math.min(accumulator, currentValue); }, lengths[0]);
5738
+ if (maxLength !== minLength) {
5739
+ throw new Error("The number of rows in both tables must be the same");
5740
+ }
5741
+ var table = tables[0];
5742
+ for (var i = 0; i < table.rows.length; i++) {
5743
+ var trs = [];
5755
5744
  try {
5756
- if (tables_1_1 && !tables_1_1.done && (_a = tables_1.return)) _a.call(tables_1);
5745
+ for (var tables_1 = (e_1 = void 0, __values(tables)), tables_1_1 = tables_1.next(); !tables_1_1.done; tables_1_1 = tables_1.next()) {
5746
+ var table_1 = tables_1_1.value;
5747
+ trs.push(table_1.rows[i]);
5748
+ }
5749
+ }
5750
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
5751
+ finally {
5752
+ try {
5753
+ if (tables_1_1 && !tables_1_1.done && (_a = tables_1.return)) _a.call(tables_1);
5754
+ }
5755
+ finally { if (e_1) throw e_1.error; }
5756
+ }
5757
+ var max = trs.reduce(function (accumulator, currentValue) {
5758
+ return Math.max(accumulator, currentValue.getBoundingClientRect().height);
5759
+ }, trs[0].getBoundingClientRect().height);
5760
+ try {
5761
+ for (var trs_1 = (e_2 = void 0, __values(trs)), trs_1_1 = trs_1.next(); !trs_1_1.done; trs_1_1 = trs_1.next()) {
5762
+ var tr = trs_1_1.value;
5763
+ tr.style.height = max + "px";
5764
+ }
5765
+ }
5766
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
5767
+ finally {
5768
+ try {
5769
+ if (trs_1_1 && !trs_1_1.done && (_b = trs_1.return)) _b.call(trs_1);
5770
+ }
5771
+ finally { if (e_2) throw e_2.error; }
5757
5772
  }
5758
- finally { if (e_1) throw e_1.error; }
5759
5773
  }
5760
5774
  };
5761
- TableFrozenPositionDirective.prototype.applyMaxRowHeight = function (tables, isHead) {
5762
- var e_2, _a, e_3, _b, e_4, _c, e_5, _d;
5763
- if (isHead === void 0) { isHead = false; }
5764
- var rowSizes = [];
5775
+ TableFrozenPositionDirective.prototype._resetRowHeight = function (tables) {
5776
+ var e_3, _a, e_4, _b;
5765
5777
  try {
5766
5778
  for (var tables_2 = __values(tables), tables_2_1 = tables_2.next(); !tables_2_1.done; tables_2_1 = tables_2.next()) {
5767
5779
  var table = tables_2_1.value;
5768
5780
  try {
5769
- for (var _e = (e_3 = void 0, __values(table.rows)), _f = _e.next(); !_f.done; _f = _e.next()) {
5770
- var tr = _f.value;
5771
- if (tr.classList.contains("sds-expanded-row"))
5772
- continue;
5773
- rowSizes.push(tr.getBoundingClientRect().height);
5781
+ for (var _c = (e_4 = void 0, __values(table.rows)), _d = _c.next(); !_d.done; _d = _c.next()) {
5782
+ var row = _d.value;
5783
+ row.style.height = "unset";
5774
5784
  }
5775
5785
  }
5776
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
5786
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
5777
5787
  finally {
5778
5788
  try {
5779
- if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
5789
+ if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
5780
5790
  }
5781
- finally { if (e_3) throw e_3.error; }
5791
+ finally { if (e_4) throw e_4.error; }
5782
5792
  }
5783
5793
  }
5784
5794
  }
5785
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
5795
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
5786
5796
  finally {
5787
5797
  try {
5788
5798
  if (tables_2_1 && !tables_2_1.done && (_a = tables_2.return)) _a.call(tables_2);
5789
5799
  }
5790
- finally { if (e_2) throw e_2.error; }
5791
- }
5792
- if (!rowSizes.length)
5793
- return;
5794
- var maxHeight = Math.max.apply(Math, __spread(rowSizes));
5795
- if (isHead) {
5796
- this.styleFixHeadRowHeight.innerHTML = "." + this.fixHeadRowClassName + " thead > tr { height: " + maxHeight + "px; }";
5797
- try {
5798
- for (var tables_3 = __values(tables), tables_3_1 = tables_3.next(); !tables_3_1.done; tables_3_1 = tables_3.next()) {
5799
- var table = tables_3_1.value;
5800
- table.classList.remove(this.resetRowHeightClassName);
5801
- table.classList.add(this.fixHeadRowClassName);
5802
- }
5803
- }
5804
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
5805
- finally {
5806
- try {
5807
- if (tables_3_1 && !tables_3_1.done && (_c = tables_3.return)) _c.call(tables_3);
5808
- }
5809
- finally { if (e_4) throw e_4.error; }
5810
- }
5811
- }
5812
- else {
5813
- this.styleFixBodyRowHeight.innerHTML = "." + this.fixBodyRowClassName + " tbody > tr { height: " + maxHeight + "px; }";
5814
- try {
5815
- for (var tables_4 = __values(tables), tables_4_1 = tables_4.next(); !tables_4_1.done; tables_4_1 = tables_4.next()) {
5816
- var table = tables_4_1.value;
5817
- table.classList.remove(this.resetRowHeightClassName);
5818
- table.classList.add(this.fixBodyRowClassName);
5819
- }
5820
- }
5821
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
5822
- finally {
5823
- try {
5824
- if (tables_4_1 && !tables_4_1.done && (_d = tables_4.return)) _d.call(tables_4);
5825
- }
5826
- finally { if (e_5) throw e_5.error; }
5827
- }
5800
+ finally { if (e_3) throw e_3.error; }
5828
5801
  }
5829
5802
  };
5830
5803
  TableFrozenPositionDirective.ctorParameters = function () { return [