@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.
@@ -2952,6 +2952,9 @@
2952
2952
  function BooleanSwitchField(config) {
2953
2953
  var _this = _super.call(this, config) || this;
2954
2954
  _this.onChange = config.onChange;
2955
+ if (config.optionsLabel) {
2956
+ _this.optionsLabel = new BooleanOptionsLabel(config.optionsLabel);
2957
+ }
2955
2958
  _this.representedBy = "switch";
2956
2959
  return _this;
2957
2960
  }
@@ -5733,20 +5736,7 @@
5733
5736
  this.table.styleClass = (this.table.styleClass || "") + " s-table-frozen-position";
5734
5737
  this.setUpTableEvents();
5735
5738
  window.addEventListener("resize", this.handleWindowResize.bind(this));
5736
- var componentId = new Date().getTime();
5737
5739
  var htmlHead = document.getElementsByTagName("head")[0];
5738
- this.resetRowHeightClassName = "resetTableRowsHeight_" + componentId;
5739
- var styleReset = document.createElement("style");
5740
- styleReset.innerHTML = "." + this.resetRowHeightClassName + " tbody > tr, ." + this.resetRowHeightClassName + " thead > tr { height: auto; }";
5741
- htmlHead.appendChild(styleReset);
5742
- this.fixBodyRowClassName = "fixTableBodyRowsHeight_" + componentId;
5743
- this.styleFixBodyRowHeight = document.createElement("style");
5744
- this.styleFixBodyRowHeight.innerHTML = "." + this.fixBodyRowClassName + " tbody > tr { height: auto; }";
5745
- htmlHead.appendChild(this.styleFixBodyRowHeight);
5746
- this.fixHeadRowClassName = "fixTableHeadRowsHeight_" + componentId;
5747
- this.styleFixHeadRowHeight = document.createElement("style");
5748
- this.styleFixHeadRowHeight.innerHTML = "." + this.fixHeadRowClassName + " thead > tr { height: auto; }";
5749
- htmlHead.appendChild(this.styleFixHeadRowHeight);
5750
5740
  var expandFrozenStyle = document.createElement("style");
5751
5741
  expandFrozenStyle.innerHTML = ".s-table-frozen-position .ui-table-frozen-view .sds-expanded-row > td { visibility: hidden; }";
5752
5742
  htmlHead.appendChild(expandFrozenStyle);
@@ -5876,98 +5866,84 @@
5876
5866
  TableFrozenPositionDirective.prototype.synchronizeRowHeight = function () {
5877
5867
  var tableBodyWrappers = this.el.nativeElement.getElementsByClassName("ui-table-scrollable-body");
5878
5868
  var tableBodies = __spread(tableBodyWrappers).map(function (divWrapper) { return __spread(divWrapper.childNodes).find(function (p) { return p.tagName === "TABLE"; }); });
5879
- this.recalculateDefaultRowHeight(tableBodies);
5880
- this.applyMaxRowHeight(tableBodies);
5869
+ this._resetRowHeight(tableBodies);
5870
+ this._applyMaxRowHeight(tableBodies);
5881
5871
  var tableHeadWrappers = this.el.nativeElement.getElementsByClassName("ui-table-scrollable-header-box");
5882
5872
  var tableHeads = __spread(tableHeadWrappers).map(function (divWrapper) { return __spread(divWrapper.childNodes).find(function (p) { return p.tagName === "TABLE"; }); });
5883
- this.recalculateDefaultRowHeight(tableHeads);
5884
- this.applyMaxRowHeight(tableHeads, true);
5873
+ this._resetRowHeight(tableHeads);
5874
+ this._applyMaxRowHeight(tableHeads);
5885
5875
  };
5886
- TableFrozenPositionDirective.prototype.recalculateDefaultRowHeight = function (tables) {
5887
- var e_1, _a;
5888
- try {
5889
- for (var tables_1 = __values(tables), tables_1_1 = tables_1.next(); !tables_1_1.done; tables_1_1 = tables_1.next()) {
5890
- var table = tables_1_1.value;
5891
- table.classList.remove(this.fixBodyRowClassName);
5892
- table.classList.remove(this.fixHeadRowClassName);
5893
- table.classList.add(this.resetRowHeightClassName);
5894
- }
5876
+ TableFrozenPositionDirective.prototype._applyMaxRowHeight = function (tables) {
5877
+ var e_1, _a, e_2, _b;
5878
+ if (!tables || !tables.length) {
5879
+ return;
5895
5880
  }
5896
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
5897
- 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 = [];
5898
5890
  try {
5899
- 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; }
5900
5918
  }
5901
- finally { if (e_1) throw e_1.error; }
5902
5919
  }
5903
5920
  };
5904
- TableFrozenPositionDirective.prototype.applyMaxRowHeight = function (tables, isHead) {
5905
- var e_2, _a, e_3, _b, e_4, _c, e_5, _d;
5906
- if (isHead === void 0) { isHead = false; }
5907
- var rowSizes = [];
5921
+ TableFrozenPositionDirective.prototype._resetRowHeight = function (tables) {
5922
+ var e_3, _a, e_4, _b;
5908
5923
  try {
5909
5924
  for (var tables_2 = __values(tables), tables_2_1 = tables_2.next(); !tables_2_1.done; tables_2_1 = tables_2.next()) {
5910
5925
  var table = tables_2_1.value;
5911
5926
  try {
5912
- for (var _e = (e_3 = void 0, __values(table.rows)), _f = _e.next(); !_f.done; _f = _e.next()) {
5913
- var tr = _f.value;
5914
- if (tr.classList.contains("sds-expanded-row"))
5915
- continue;
5916
- 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";
5917
5930
  }
5918
5931
  }
5919
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
5932
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
5920
5933
  finally {
5921
5934
  try {
5922
- if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
5935
+ if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
5923
5936
  }
5924
- finally { if (e_3) throw e_3.error; }
5937
+ finally { if (e_4) throw e_4.error; }
5925
5938
  }
5926
5939
  }
5927
5940
  }
5928
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
5941
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
5929
5942
  finally {
5930
5943
  try {
5931
5944
  if (tables_2_1 && !tables_2_1.done && (_a = tables_2.return)) _a.call(tables_2);
5932
5945
  }
5933
- finally { if (e_2) throw e_2.error; }
5934
- }
5935
- if (!rowSizes.length)
5936
- return;
5937
- var maxHeight = Math.max.apply(Math, __spread(rowSizes));
5938
- if (isHead) {
5939
- this.styleFixHeadRowHeight.innerHTML = "." + this.fixHeadRowClassName + " thead > tr { height: " + maxHeight + "px; }";
5940
- try {
5941
- for (var tables_3 = __values(tables), tables_3_1 = tables_3.next(); !tables_3_1.done; tables_3_1 = tables_3.next()) {
5942
- var table = tables_3_1.value;
5943
- table.classList.remove(this.resetRowHeightClassName);
5944
- table.classList.add(this.fixHeadRowClassName);
5945
- }
5946
- }
5947
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
5948
- finally {
5949
- try {
5950
- if (tables_3_1 && !tables_3_1.done && (_c = tables_3.return)) _c.call(tables_3);
5951
- }
5952
- finally { if (e_4) throw e_4.error; }
5953
- }
5954
- }
5955
- else {
5956
- this.styleFixBodyRowHeight.innerHTML = "." + this.fixBodyRowClassName + " tbody > tr { height: " + maxHeight + "px; }";
5957
- try {
5958
- for (var tables_4 = __values(tables), tables_4_1 = tables_4.next(); !tables_4_1.done; tables_4_1 = tables_4.next()) {
5959
- var table = tables_4_1.value;
5960
- table.classList.remove(this.resetRowHeightClassName);
5961
- table.classList.add(this.fixBodyRowClassName);
5962
- }
5963
- }
5964
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
5965
- finally {
5966
- try {
5967
- if (tables_4_1 && !tables_4_1.done && (_d = tables_4.return)) _d.call(tables_4);
5968
- }
5969
- finally { if (e_5) throw e_5.error; }
5970
- }
5946
+ finally { if (e_3) throw e_3.error; }
5971
5947
  }
5972
5948
  };
5973
5949
  TableFrozenPositionDirective.ctorParameters = function () { return [
@@ -7138,7 +7114,7 @@
7138
7114
  ], BooleanSwitchFieldComponent.prototype, "formControl", void 0);
7139
7115
  BooleanSwitchFieldComponent = __decorate([
7140
7116
  core.Component({
7141
- 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>"
7117
+ 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>"
7142
7118
  })
7143
7119
  ], BooleanSwitchFieldComponent);
7144
7120
  return BooleanSwitchFieldComponent;