@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.
@@ -5736,20 +5736,7 @@
5736
5736
  this.table.styleClass = (this.table.styleClass || "") + " s-table-frozen-position";
5737
5737
  this.setUpTableEvents();
5738
5738
  window.addEventListener("resize", this.handleWindowResize.bind(this));
5739
- var componentId = new Date().getTime();
5740
5739
  var htmlHead = document.getElementsByTagName("head")[0];
5741
- this.resetRowHeightClassName = "resetTableRowsHeight_" + componentId;
5742
- var styleReset = document.createElement("style");
5743
- styleReset.innerHTML = "." + this.resetRowHeightClassName + " tbody > tr, ." + this.resetRowHeightClassName + " thead > tr { height: auto; }";
5744
- htmlHead.appendChild(styleReset);
5745
- this.fixBodyRowClassName = "fixTableBodyRowsHeight_" + componentId;
5746
- this.styleFixBodyRowHeight = document.createElement("style");
5747
- this.styleFixBodyRowHeight.innerHTML = "." + this.fixBodyRowClassName + " tbody > tr { height: auto; }";
5748
- htmlHead.appendChild(this.styleFixBodyRowHeight);
5749
- this.fixHeadRowClassName = "fixTableHeadRowsHeight_" + componentId;
5750
- this.styleFixHeadRowHeight = document.createElement("style");
5751
- this.styleFixHeadRowHeight.innerHTML = "." + this.fixHeadRowClassName + " thead > tr { height: auto; }";
5752
- htmlHead.appendChild(this.styleFixHeadRowHeight);
5753
5740
  var expandFrozenStyle = document.createElement("style");
5754
5741
  expandFrozenStyle.innerHTML = ".s-table-frozen-position .ui-table-frozen-view .sds-expanded-row > td { visibility: hidden; }";
5755
5742
  htmlHead.appendChild(expandFrozenStyle);
@@ -5879,98 +5866,84 @@
5879
5866
  TableFrozenPositionDirective.prototype.synchronizeRowHeight = function () {
5880
5867
  var tableBodyWrappers = this.el.nativeElement.getElementsByClassName("ui-table-scrollable-body");
5881
5868
  var tableBodies = __spread(tableBodyWrappers).map(function (divWrapper) { return __spread(divWrapper.childNodes).find(function (p) { return p.tagName === "TABLE"; }); });
5882
- this.recalculateDefaultRowHeight(tableBodies);
5883
- this.applyMaxRowHeight(tableBodies);
5869
+ this._resetRowHeight(tableBodies);
5870
+ this._applyMaxRowHeight(tableBodies);
5884
5871
  var tableHeadWrappers = this.el.nativeElement.getElementsByClassName("ui-table-scrollable-header-box");
5885
5872
  var tableHeads = __spread(tableHeadWrappers).map(function (divWrapper) { return __spread(divWrapper.childNodes).find(function (p) { return p.tagName === "TABLE"; }); });
5886
- this.recalculateDefaultRowHeight(tableHeads);
5887
- this.applyMaxRowHeight(tableHeads, true);
5873
+ this._resetRowHeight(tableHeads);
5874
+ this._applyMaxRowHeight(tableHeads);
5888
5875
  };
5889
- TableFrozenPositionDirective.prototype.recalculateDefaultRowHeight = function (tables) {
5890
- var e_1, _a;
5891
- try {
5892
- for (var tables_1 = __values(tables), tables_1_1 = tables_1.next(); !tables_1_1.done; tables_1_1 = tables_1.next()) {
5893
- var table = tables_1_1.value;
5894
- table.classList.remove(this.fixBodyRowClassName);
5895
- table.classList.remove(this.fixHeadRowClassName);
5896
- table.classList.add(this.resetRowHeightClassName);
5897
- }
5876
+ TableFrozenPositionDirective.prototype._applyMaxRowHeight = function (tables) {
5877
+ var e_1, _a, e_2, _b;
5878
+ if (!tables || !tables.length) {
5879
+ return;
5898
5880
  }
5899
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
5900
- finally {
5881
+ var lengths = tables.map(function (table) { return table.rows.length; });
5882
+ var maxLength = lengths.reduce(function (accumulator, currentValue) { return Math.max(accumulator, currentValue); }, lengths[0]);
5883
+ var minLength = lengths.reduce(function (accumulator, currentValue) { return Math.min(accumulator, currentValue); }, lengths[0]);
5884
+ if (maxLength !== minLength) {
5885
+ throw new Error("The number of rows in both tables must be the same");
5886
+ }
5887
+ var table = tables[0];
5888
+ for (var i = 0; i < table.rows.length; i++) {
5889
+ var trs = [];
5901
5890
  try {
5902
- if (tables_1_1 && !tables_1_1.done && (_a = tables_1.return)) _a.call(tables_1);
5891
+ 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()) {
5892
+ var table_1 = tables_1_1.value;
5893
+ trs.push(table_1.rows[i]);
5894
+ }
5895
+ }
5896
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
5897
+ finally {
5898
+ try {
5899
+ if (tables_1_1 && !tables_1_1.done && (_a = tables_1.return)) _a.call(tables_1);
5900
+ }
5901
+ finally { if (e_1) throw e_1.error; }
5902
+ }
5903
+ var max = trs.reduce(function (accumulator, currentValue) {
5904
+ return Math.max(accumulator, currentValue.getBoundingClientRect().height);
5905
+ }, trs[0].getBoundingClientRect().height);
5906
+ try {
5907
+ 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()) {
5908
+ var tr = trs_1_1.value;
5909
+ tr.style.height = max + "px";
5910
+ }
5911
+ }
5912
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
5913
+ finally {
5914
+ try {
5915
+ if (trs_1_1 && !trs_1_1.done && (_b = trs_1.return)) _b.call(trs_1);
5916
+ }
5917
+ finally { if (e_2) throw e_2.error; }
5903
5918
  }
5904
- finally { if (e_1) throw e_1.error; }
5905
5919
  }
5906
5920
  };
5907
- TableFrozenPositionDirective.prototype.applyMaxRowHeight = function (tables, isHead) {
5908
- var e_2, _a, e_3, _b, e_4, _c, e_5, _d;
5909
- if (isHead === void 0) { isHead = false; }
5910
- var rowSizes = [];
5921
+ TableFrozenPositionDirective.prototype._resetRowHeight = function (tables) {
5922
+ var e_3, _a, e_4, _b;
5911
5923
  try {
5912
5924
  for (var tables_2 = __values(tables), tables_2_1 = tables_2.next(); !tables_2_1.done; tables_2_1 = tables_2.next()) {
5913
5925
  var table = tables_2_1.value;
5914
5926
  try {
5915
- for (var _e = (e_3 = void 0, __values(table.rows)), _f = _e.next(); !_f.done; _f = _e.next()) {
5916
- var tr = _f.value;
5917
- if (tr.classList.contains("sds-expanded-row"))
5918
- continue;
5919
- rowSizes.push(tr.getBoundingClientRect().height);
5927
+ for (var _c = (e_4 = void 0, __values(table.rows)), _d = _c.next(); !_d.done; _d = _c.next()) {
5928
+ var row = _d.value;
5929
+ row.style.height = "unset";
5920
5930
  }
5921
5931
  }
5922
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
5932
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
5923
5933
  finally {
5924
5934
  try {
5925
- if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
5935
+ if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
5926
5936
  }
5927
- finally { if (e_3) throw e_3.error; }
5937
+ finally { if (e_4) throw e_4.error; }
5928
5938
  }
5929
5939
  }
5930
5940
  }
5931
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
5941
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
5932
5942
  finally {
5933
5943
  try {
5934
5944
  if (tables_2_1 && !tables_2_1.done && (_a = tables_2.return)) _a.call(tables_2);
5935
5945
  }
5936
- finally { if (e_2) throw e_2.error; }
5937
- }
5938
- if (!rowSizes.length)
5939
- return;
5940
- var maxHeight = Math.max.apply(Math, __spread(rowSizes));
5941
- if (isHead) {
5942
- this.styleFixHeadRowHeight.innerHTML = "." + this.fixHeadRowClassName + " thead > tr { height: " + maxHeight + "px; }";
5943
- try {
5944
- for (var tables_3 = __values(tables), tables_3_1 = tables_3.next(); !tables_3_1.done; tables_3_1 = tables_3.next()) {
5945
- var table = tables_3_1.value;
5946
- table.classList.remove(this.resetRowHeightClassName);
5947
- table.classList.add(this.fixHeadRowClassName);
5948
- }
5949
- }
5950
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
5951
- finally {
5952
- try {
5953
- if (tables_3_1 && !tables_3_1.done && (_c = tables_3.return)) _c.call(tables_3);
5954
- }
5955
- finally { if (e_4) throw e_4.error; }
5956
- }
5957
- }
5958
- else {
5959
- this.styleFixBodyRowHeight.innerHTML = "." + this.fixBodyRowClassName + " tbody > tr { height: " + maxHeight + "px; }";
5960
- try {
5961
- for (var tables_4 = __values(tables), tables_4_1 = tables_4.next(); !tables_4_1.done; tables_4_1 = tables_4.next()) {
5962
- var table = tables_4_1.value;
5963
- table.classList.remove(this.resetRowHeightClassName);
5964
- table.classList.add(this.fixBodyRowClassName);
5965
- }
5966
- }
5967
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
5968
- finally {
5969
- try {
5970
- if (tables_4_1 && !tables_4_1.done && (_d = tables_4.return)) _d.call(tables_4);
5971
- }
5972
- finally { if (e_5) throw e_5.error; }
5973
- }
5946
+ finally { if (e_3) throw e_3.error; }
5974
5947
  }
5975
5948
  };
5976
5949
  TableFrozenPositionDirective.ctorParameters = function () { return [