@seniorsistemas/angular-components 14.11.0 → 14.12.0

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.
@@ -3859,6 +3859,191 @@
3859
3859
  return RowTogllerDirective;
3860
3860
  }(table.RowToggler));
3861
3861
 
3862
+ var TableFrozenPositionDirective = /** @class */ (function () {
3863
+ function TableFrozenPositionDirective(el, host) {
3864
+ var _this = this;
3865
+ this.el = el;
3866
+ this.host = host;
3867
+ this.sTableFrozenPosition = "left";
3868
+ this.host.onColResize.subscribe(function () {
3869
+ _this.handleColResize();
3870
+ });
3871
+ window.addEventListener("resize", this.handleWindowResize.bind(this));
3872
+ var componentId = new Date().getTime();
3873
+ this.resetRowHeightClassName = "resetTableRowsHeight_" + componentId;
3874
+ var styleReset = document.createElement("style");
3875
+ styleReset.innerHTML = "." + this.resetRowHeightClassName + " tbody > tr, ." + this.resetRowHeightClassName + " thead > tr { height: auto; }";
3876
+ document.getElementsByTagName("head")[0].appendChild(styleReset);
3877
+ this.fixBodyRowClassName = "fixTableBodyRowsHeight_" + componentId;
3878
+ this.styleFixBodyRowHeight = document.createElement("style");
3879
+ this.styleFixBodyRowHeight.innerHTML = "." + this.fixBodyRowClassName + " tbody > tr { height: auto; }";
3880
+ document.getElementsByTagName("head")[0].appendChild(this.styleFixBodyRowHeight);
3881
+ this.fixHeadRowClassName = "fixTableHeadRowsHeight_" + componentId;
3882
+ this.styleFixHeadRowHeight = document.createElement("style");
3883
+ this.styleFixHeadRowHeight.innerHTML = "." + this.fixHeadRowClassName + " thead > tr { height: auto; }";
3884
+ document.getElementsByTagName("head")[0].appendChild(this.styleFixHeadRowHeight);
3885
+ }
3886
+ Object.defineProperty(TableFrozenPositionDirective.prototype, "sTableFrozenValue", {
3887
+ set: function (_) {
3888
+ var _this = this;
3889
+ setTimeout(function () {
3890
+ _this.synchronizeRowHeight();
3891
+ });
3892
+ },
3893
+ enumerable: true,
3894
+ configurable: true
3895
+ });
3896
+ TableFrozenPositionDirective.prototype.ngAfterViewInit = function () {
3897
+ if (this.sTableFrozenPosition === "left")
3898
+ return;
3899
+ this.applyStylesForTable();
3900
+ };
3901
+ TableFrozenPositionDirective.prototype.ngOnDestroy = function () {
3902
+ window.removeEventListener("resize", this.handleWindowResize.bind(this));
3903
+ };
3904
+ TableFrozenPositionDirective.prototype.applyStylesForTable = function () {
3905
+ var scrollWrapper = this.el.nativeElement.querySelector(".ui-table-scrollable-wrapper");
3906
+ if (!scrollWrapper) {
3907
+ console.warn("Unable to find scroll-wrapper element from table. Is the table configured with frozen template?");
3908
+ return;
3909
+ }
3910
+ scrollWrapper.style.display = "flex";
3911
+ scrollWrapper.style.flexDirection = "row";
3912
+ var frozenTable = this.el.nativeElement.querySelector(".ui-table-frozen-view");
3913
+ if (!frozenTable) {
3914
+ console.warn("Unable to find frozen element from table. Is the table configured with frozen template?");
3915
+ return;
3916
+ }
3917
+ frozenTable.style.order = "1";
3918
+ frozenTable.style.borderRight = "none";
3919
+ frozenTable.style.borderLeft = "1px solid #dddddd";
3920
+ frozenTable.style.boxShadow = "-5px 0 5px -5px #cccccc";
3921
+ var unfrozenTable = this.el.nativeElement.querySelector(".ui-table-unfrozen-view");
3922
+ if (!unfrozenTable) {
3923
+ console.warn("Unable to find unfrozen element from table. Is the table configured with frozen template?");
3924
+ return;
3925
+ }
3926
+ unfrozenTable.style.position = "unset";
3927
+ };
3928
+ TableFrozenPositionDirective.prototype.handleWindowResize = function () {
3929
+ this.synchronizeRowHeight();
3930
+ };
3931
+ TableFrozenPositionDirective.prototype.handleColResize = function () {
3932
+ this.synchronizeRowHeight();
3933
+ };
3934
+ TableFrozenPositionDirective.prototype.synchronizeRowHeight = function () {
3935
+ var tableBodyWrappers = this.el.nativeElement.getElementsByClassName("ui-table-scrollable-body");
3936
+ var tableBodies = __spread(tableBodyWrappers).map(function (divWrapper) { return __spread(divWrapper.childNodes).find(function (p) { return p.tagName === "TABLE"; }); });
3937
+ this.recalculateDefaultRowHeight(tableBodies);
3938
+ this.applyMaxRowHeight(tableBodies);
3939
+ var tableHeadWrappers = this.el.nativeElement.getElementsByClassName("ui-table-scrollable-header-box");
3940
+ var tableHeads = __spread(tableHeadWrappers).map(function (divWrapper) { return __spread(divWrapper.childNodes).find(function (p) { return p.tagName === "TABLE"; }); });
3941
+ this.recalculateDefaultRowHeight(tableHeads);
3942
+ this.applyMaxRowHeight(tableHeads, true);
3943
+ };
3944
+ TableFrozenPositionDirective.prototype.recalculateDefaultRowHeight = function (tables) {
3945
+ var e_1, _a;
3946
+ try {
3947
+ for (var tables_1 = __values(tables), tables_1_1 = tables_1.next(); !tables_1_1.done; tables_1_1 = tables_1.next()) {
3948
+ var table = tables_1_1.value;
3949
+ table.classList.remove(this.fixBodyRowClassName);
3950
+ table.classList.remove(this.fixHeadRowClassName);
3951
+ table.classList.add(this.resetRowHeightClassName);
3952
+ }
3953
+ }
3954
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
3955
+ finally {
3956
+ try {
3957
+ if (tables_1_1 && !tables_1_1.done && (_a = tables_1.return)) _a.call(tables_1);
3958
+ }
3959
+ finally { if (e_1) throw e_1.error; }
3960
+ }
3961
+ };
3962
+ TableFrozenPositionDirective.prototype.applyMaxRowHeight = function (tables, isHead) {
3963
+ var e_2, _a, e_3, _b, e_4, _c, e_5, _d;
3964
+ if (isHead === void 0) { isHead = false; }
3965
+ var rowSizes = [];
3966
+ try {
3967
+ for (var tables_2 = __values(tables), tables_2_1 = tables_2.next(); !tables_2_1.done; tables_2_1 = tables_2.next()) {
3968
+ var table = tables_2_1.value;
3969
+ try {
3970
+ for (var _e = (e_3 = void 0, __values(table.rows)), _f = _e.next(); !_f.done; _f = _e.next()) {
3971
+ var tr = _f.value;
3972
+ rowSizes.push(tr.getBoundingClientRect().height);
3973
+ }
3974
+ }
3975
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
3976
+ finally {
3977
+ try {
3978
+ if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
3979
+ }
3980
+ finally { if (e_3) throw e_3.error; }
3981
+ }
3982
+ }
3983
+ }
3984
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
3985
+ finally {
3986
+ try {
3987
+ if (tables_2_1 && !tables_2_1.done && (_a = tables_2.return)) _a.call(tables_2);
3988
+ }
3989
+ finally { if (e_2) throw e_2.error; }
3990
+ }
3991
+ if (!rowSizes.length)
3992
+ return;
3993
+ var maxHeight = Math.max.apply(Math, __spread(rowSizes));
3994
+ if (isHead) {
3995
+ this.styleFixHeadRowHeight.innerHTML = "." + this.fixHeadRowClassName + " thead > tr { height: " + maxHeight + "px; }";
3996
+ try {
3997
+ for (var tables_3 = __values(tables), tables_3_1 = tables_3.next(); !tables_3_1.done; tables_3_1 = tables_3.next()) {
3998
+ var table = tables_3_1.value;
3999
+ table.classList.remove(this.resetRowHeightClassName);
4000
+ table.classList.add(this.fixHeadRowClassName);
4001
+ }
4002
+ }
4003
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
4004
+ finally {
4005
+ try {
4006
+ if (tables_3_1 && !tables_3_1.done && (_c = tables_3.return)) _c.call(tables_3);
4007
+ }
4008
+ finally { if (e_4) throw e_4.error; }
4009
+ }
4010
+ }
4011
+ else {
4012
+ this.styleFixBodyRowHeight.innerHTML = "." + this.fixBodyRowClassName + " tbody > tr { height: " + maxHeight + "px; }";
4013
+ try {
4014
+ for (var tables_4 = __values(tables), tables_4_1 = tables_4.next(); !tables_4_1.done; tables_4_1 = tables_4.next()) {
4015
+ var table = tables_4_1.value;
4016
+ table.classList.remove(this.resetRowHeightClassName);
4017
+ table.classList.add(this.fixBodyRowClassName);
4018
+ }
4019
+ }
4020
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
4021
+ finally {
4022
+ try {
4023
+ if (tables_4_1 && !tables_4_1.done && (_d = tables_4.return)) _d.call(tables_4);
4024
+ }
4025
+ finally { if (e_5) throw e_5.error; }
4026
+ }
4027
+ }
4028
+ };
4029
+ TableFrozenPositionDirective.ctorParameters = function () { return [
4030
+ { type: core.ElementRef },
4031
+ { type: table.Table }
4032
+ ]; };
4033
+ __decorate([
4034
+ core.Input()
4035
+ ], TableFrozenPositionDirective.prototype, "sTableFrozenPosition", void 0);
4036
+ __decorate([
4037
+ core.Input()
4038
+ ], TableFrozenPositionDirective.prototype, "sTableFrozenValue", null);
4039
+ TableFrozenPositionDirective = __decorate([
4040
+ core.Directive({
4041
+ selector: "[sTableFrozenPosition]"
4042
+ })
4043
+ ], TableFrozenPositionDirective);
4044
+ return TableFrozenPositionDirective;
4045
+ }());
4046
+
3862
4047
 
3863
4048
  (function (EnumColumnFieldType) {
3864
4049
  EnumColumnFieldType["STRING"] = "STRING";
@@ -4185,12 +4370,14 @@
4185
4370
  exports: [
4186
4371
  RowTogllerDirective,
4187
4372
  NavigationDirective,
4188
- TableColumnsComponent
4373
+ TableColumnsComponent,
4374
+ TableFrozenPositionDirective
4189
4375
  ],
4190
4376
  declarations: [
4191
4377
  RowTogllerDirective,
4192
4378
  NavigationDirective,
4193
- TableColumnsComponent
4379
+ TableColumnsComponent,
4380
+ TableFrozenPositionDirective
4194
4381
  ],
4195
4382
  })
4196
4383
  ], TableModule);
@@ -8881,6 +9068,7 @@
8881
9068
  exports.StepsComponent = StepsComponent;
8882
9069
  exports.StepsModule = StepsModule;
8883
9070
  exports.Structure = Structure;
9071
+ exports.TableFrozenPositionDirective = TableFrozenPositionDirective;
8884
9072
  exports.TableHeaderCheckboxComponent = TableHeaderCheckboxComponent;
8885
9073
  exports.TableHeaderCheckboxModule = TableHeaderCheckboxModule;
8886
9074
  exports.TableModule = TableModule;