@seniorsistemas/angular-components 16.12.0 → 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.
@@ -2806,6 +2806,9 @@ var BooleanSwitchField = /** @class */ (function (_super) {
2806
2806
  function BooleanSwitchField(config) {
2807
2807
  var _this = _super.call(this, config) || this;
2808
2808
  _this.onChange = config.onChange;
2809
+ if (config.optionsLabel) {
2810
+ _this.optionsLabel = new BooleanOptionsLabel(config.optionsLabel);
2811
+ }
2809
2812
  _this.representedBy = "switch";
2810
2813
  return _this;
2811
2814
  }
@@ -5587,20 +5590,7 @@ var TableFrozenPositionDirective = /** @class */ (function () {
5587
5590
  this.table.styleClass = (this.table.styleClass || "") + " s-table-frozen-position";
5588
5591
  this.setUpTableEvents();
5589
5592
  window.addEventListener("resize", this.handleWindowResize.bind(this));
5590
- var componentId = new Date().getTime();
5591
5593
  var htmlHead = document.getElementsByTagName("head")[0];
5592
- this.resetRowHeightClassName = "resetTableRowsHeight_" + componentId;
5593
- var styleReset = document.createElement("style");
5594
- styleReset.innerHTML = "." + this.resetRowHeightClassName + " tbody > tr, ." + this.resetRowHeightClassName + " thead > tr { height: auto; }";
5595
- htmlHead.appendChild(styleReset);
5596
- this.fixBodyRowClassName = "fixTableBodyRowsHeight_" + componentId;
5597
- this.styleFixBodyRowHeight = document.createElement("style");
5598
- this.styleFixBodyRowHeight.innerHTML = "." + this.fixBodyRowClassName + " tbody > tr { height: auto; }";
5599
- htmlHead.appendChild(this.styleFixBodyRowHeight);
5600
- this.fixHeadRowClassName = "fixTableHeadRowsHeight_" + componentId;
5601
- this.styleFixHeadRowHeight = document.createElement("style");
5602
- this.styleFixHeadRowHeight.innerHTML = "." + this.fixHeadRowClassName + " thead > tr { height: auto; }";
5603
- htmlHead.appendChild(this.styleFixHeadRowHeight);
5604
5594
  var expandFrozenStyle = document.createElement("style");
5605
5595
  expandFrozenStyle.innerHTML = ".s-table-frozen-position .ui-table-frozen-view .sds-expanded-row > td { visibility: hidden; }";
5606
5596
  htmlHead.appendChild(expandFrozenStyle);
@@ -5730,98 +5720,84 @@ var TableFrozenPositionDirective = /** @class */ (function () {
5730
5720
  TableFrozenPositionDirective.prototype.synchronizeRowHeight = function () {
5731
5721
  var tableBodyWrappers = this.el.nativeElement.getElementsByClassName("ui-table-scrollable-body");
5732
5722
  var tableBodies = __spread(tableBodyWrappers).map(function (divWrapper) { return __spread(divWrapper.childNodes).find(function (p) { return p.tagName === "TABLE"; }); });
5733
- this.recalculateDefaultRowHeight(tableBodies);
5734
- this.applyMaxRowHeight(tableBodies);
5723
+ this._resetRowHeight(tableBodies);
5724
+ this._applyMaxRowHeight(tableBodies);
5735
5725
  var tableHeadWrappers = this.el.nativeElement.getElementsByClassName("ui-table-scrollable-header-box");
5736
5726
  var tableHeads = __spread(tableHeadWrappers).map(function (divWrapper) { return __spread(divWrapper.childNodes).find(function (p) { return p.tagName === "TABLE"; }); });
5737
- this.recalculateDefaultRowHeight(tableHeads);
5738
- this.applyMaxRowHeight(tableHeads, true);
5727
+ this._resetRowHeight(tableHeads);
5728
+ this._applyMaxRowHeight(tableHeads);
5739
5729
  };
5740
- TableFrozenPositionDirective.prototype.recalculateDefaultRowHeight = function (tables) {
5741
- var e_1, _a;
5742
- try {
5743
- for (var tables_1 = __values(tables), tables_1_1 = tables_1.next(); !tables_1_1.done; tables_1_1 = tables_1.next()) {
5744
- var table = tables_1_1.value;
5745
- table.classList.remove(this.fixBodyRowClassName);
5746
- table.classList.remove(this.fixHeadRowClassName);
5747
- table.classList.add(this.resetRowHeightClassName);
5748
- }
5730
+ TableFrozenPositionDirective.prototype._applyMaxRowHeight = function (tables) {
5731
+ var e_1, _a, e_2, _b;
5732
+ if (!tables || !tables.length) {
5733
+ return;
5749
5734
  }
5750
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
5751
- 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 = [];
5752
5744
  try {
5753
- 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; }
5754
5772
  }
5755
- finally { if (e_1) throw e_1.error; }
5756
5773
  }
5757
5774
  };
5758
- TableFrozenPositionDirective.prototype.applyMaxRowHeight = function (tables, isHead) {
5759
- var e_2, _a, e_3, _b, e_4, _c, e_5, _d;
5760
- if (isHead === void 0) { isHead = false; }
5761
- var rowSizes = [];
5775
+ TableFrozenPositionDirective.prototype._resetRowHeight = function (tables) {
5776
+ var e_3, _a, e_4, _b;
5762
5777
  try {
5763
5778
  for (var tables_2 = __values(tables), tables_2_1 = tables_2.next(); !tables_2_1.done; tables_2_1 = tables_2.next()) {
5764
5779
  var table = tables_2_1.value;
5765
5780
  try {
5766
- for (var _e = (e_3 = void 0, __values(table.rows)), _f = _e.next(); !_f.done; _f = _e.next()) {
5767
- var tr = _f.value;
5768
- if (tr.classList.contains("sds-expanded-row"))
5769
- continue;
5770
- 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";
5771
5784
  }
5772
5785
  }
5773
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
5786
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
5774
5787
  finally {
5775
5788
  try {
5776
- if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
5789
+ if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
5777
5790
  }
5778
- finally { if (e_3) throw e_3.error; }
5791
+ finally { if (e_4) throw e_4.error; }
5779
5792
  }
5780
5793
  }
5781
5794
  }
5782
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
5795
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
5783
5796
  finally {
5784
5797
  try {
5785
5798
  if (tables_2_1 && !tables_2_1.done && (_a = tables_2.return)) _a.call(tables_2);
5786
5799
  }
5787
- finally { if (e_2) throw e_2.error; }
5788
- }
5789
- if (!rowSizes.length)
5790
- return;
5791
- var maxHeight = Math.max.apply(Math, __spread(rowSizes));
5792
- if (isHead) {
5793
- this.styleFixHeadRowHeight.innerHTML = "." + this.fixHeadRowClassName + " thead > tr { height: " + maxHeight + "px; }";
5794
- try {
5795
- for (var tables_3 = __values(tables), tables_3_1 = tables_3.next(); !tables_3_1.done; tables_3_1 = tables_3.next()) {
5796
- var table = tables_3_1.value;
5797
- table.classList.remove(this.resetRowHeightClassName);
5798
- table.classList.add(this.fixHeadRowClassName);
5799
- }
5800
- }
5801
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
5802
- finally {
5803
- try {
5804
- if (tables_3_1 && !tables_3_1.done && (_c = tables_3.return)) _c.call(tables_3);
5805
- }
5806
- finally { if (e_4) throw e_4.error; }
5807
- }
5808
- }
5809
- else {
5810
- this.styleFixBodyRowHeight.innerHTML = "." + this.fixBodyRowClassName + " tbody > tr { height: " + maxHeight + "px; }";
5811
- try {
5812
- for (var tables_4 = __values(tables), tables_4_1 = tables_4.next(); !tables_4_1.done; tables_4_1 = tables_4.next()) {
5813
- var table = tables_4_1.value;
5814
- table.classList.remove(this.resetRowHeightClassName);
5815
- table.classList.add(this.fixBodyRowClassName);
5816
- }
5817
- }
5818
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
5819
- finally {
5820
- try {
5821
- if (tables_4_1 && !tables_4_1.done && (_d = tables_4.return)) _d.call(tables_4);
5822
- }
5823
- finally { if (e_5) throw e_5.error; }
5824
- }
5800
+ finally { if (e_3) throw e_3.error; }
5825
5801
  }
5826
5802
  };
5827
5803
  TableFrozenPositionDirective.ctorParameters = function () { return [
@@ -6992,7 +6968,7 @@ var BooleanSwitchFieldComponent = /** @class */ (function () {
6992
6968
  ], BooleanSwitchFieldComponent.prototype, "formControl", void 0);
6993
6969
  BooleanSwitchFieldComponent = __decorate([
6994
6970
  Component({
6995
- template: "<div class=\"ui-g\">\n <p-inputSwitch\n [id]=\"(field.id || field.name)\"\n [name]=\"field.name\"\n [formControl]=\"formControl\"\n [sTooltip]=\"field.tooltip\"\n tooltipPosition=\"top\"\n (onChange)=\"field.onChange ? field.onChange($event) : null\">\n </p-inputSwitch>\n</div>"
6971
+ template: "<div class=\"ui-grid ui-grid-responsive ui-grid-pad ui-fluid\">\n <div class=\"ui-grid-row\">\n <div class=\"i-grid-col-1\">\n <p-inputSwitch [id]=\"(field.id || field.name)\" [name]=\"field.name\" [formControl]=\"formControl\"\n [sTooltip]=\"field.tooltip\" tooltipPosition=\"top\"\n (onChange)=\"field.onChange ? field.onChange($event) : null\">\n </p-inputSwitch>\n </div>\n <div class=\"i-grid-col-1\" *ngIf=\"field.optionsLabel\">\n <ng-container *ngIf=\"formControl.value; else caseFalse\">\n <span>{{ field.optionsLabel.true }}</span>\n </ng-container>\n <ng-template #caseFalse>\n <span>{{ field.optionsLabel.false }}</span>\n </ng-template>\n </div>\n </div>\n</div>"
6996
6972
  })
6997
6973
  ], BooleanSwitchFieldComponent);
6998
6974
  return BooleanSwitchFieldComponent;