@elxjs/ui 0.0.243 → 0.0.244

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.
@@ -1043,11 +1043,12 @@ class EluxDataTable {
1043
1043
  constructor() {
1044
1044
  this.columns = [];
1045
1045
  this.rows = [];
1046
- this.totalRows = 1;
1046
+ this.totalRows = 0;
1047
1047
  this.itemsPerPage = 15;
1048
1048
  this.backendPagination = false;
1049
1049
  this.emptyMessage = 'Nenhum item localizado com base nos critérios de busca.';
1050
1050
  this.loading = false;
1051
+ this.hasPaginator = false;
1051
1052
  this.showPaginatorInfo = false;
1052
1053
  this.currentPageChange = new EventEmitter();
1053
1054
  this.itemsPerPageChange = new EventEmitter();
@@ -1061,7 +1062,7 @@ class EluxDataTable {
1061
1062
  this.hoveredActionCell = null;
1062
1063
  }
1063
1064
  ngOnInit() {
1064
- this.paginatorTotalPages = Math.ceil(this.totalRows / this.itemsPerPage);
1065
+ this.paginatorTotalPages = Math.ceil(this.effectiveTotalRows / this.itemsPerPage);
1065
1066
  this.populateTable();
1066
1067
  }
1067
1068
  ngOnChanges(changes) {
@@ -1074,9 +1075,15 @@ class EluxDataTable {
1074
1075
  this.populateTable();
1075
1076
  }
1076
1077
  if (changes['rows']) {
1078
+ if (!this.backendPagination) {
1079
+ this.refreshPaginator();
1080
+ }
1077
1081
  this.populateTable();
1078
1082
  }
1079
1083
  }
1084
+ get effectiveTotalRows() {
1085
+ return this.backendPagination ? this.totalRows : this.totalRows || this.rows.length;
1086
+ }
1080
1087
  onPageChange(event) {
1081
1088
  this.currentPage = event.page;
1082
1089
  if (this.backendPagination) {
@@ -1093,11 +1100,11 @@ class EluxDataTable {
1093
1100
  this.populateTable();
1094
1101
  }
1095
1102
  refreshPaginator() {
1096
- this.paginatorTotalPages = Math.ceil(this.totalRows / this.itemsPerPage);
1103
+ this.paginatorTotalPages = Math.ceil(this.effectiveTotalRows / this.itemsPerPage);
1097
1104
  this.currentPage = 1;
1098
1105
  }
1099
1106
  populateTable() {
1100
- if (this.backendPagination) {
1107
+ if (this.backendPagination || !this.hasPaginator) {
1101
1108
  this.displayRows = this.rows;
1102
1109
  }
1103
1110
  else {
@@ -1185,11 +1192,11 @@ class EluxDataTable {
1185
1192
  return classes;
1186
1193
  }
1187
1194
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.30", ngImport: i0, type: EluxDataTable, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1188
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.30", type: EluxDataTable, isStandalone: true, selector: "lib-elux-datatable", inputs: { columns: "columns", rows: "rows", totalRows: "totalRows", itemsPerPage: "itemsPerPage", backendPagination: "backendPagination", emptyMessage: "emptyMessage", loading: "loading", isRowClickable: ["isRowClickable", "isRowClickable", booleanAttribute], isCellClickable: ["isCellClickable", "isCellClickable", booleanAttribute], hasPaginator: ["hasPaginator", "hasPaginator", booleanAttribute], showPaginatorInfo: ["showPaginatorInfo", "showPaginatorInfo", booleanAttribute] }, outputs: { currentPageChange: "currentPageChange", itemsPerPageChange: "itemsPerPageChange", onClick: "onClick", onChecked: "onChecked", ontInputChange: "ontInputChange", onAction: "onAction" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"table-container\">\n <div class=\"table-scroll\">\n <div class=\"table-header\">\n @for (column of columns; track $index) {\n <div class=\"header-row-cell\" [ngClass]=\"getHeaderClasses(column)\">\n {{column.text}}\n </div>\n }\n </div>\n\n @if(loading){\n <div class=\"table-row justify-content-center\">\n <lib-elux-loading></lib-elux-loading>\n </div>\n }\n\n @if (displayRows.length == 0) {\n <div class=\"table-row pt-3 pb-3\">\n {{emptyMessage}}\n </div>\n }\n\n @for (row of displayRows; track $index) {\n <div class=\"table-row\" [ngClass]=\"{'clickable': isRowClickable}\" (click)=\"onRowClick($event, row, $index)\">\n @for (cell of row; track $index) {\n @switch (cell.type) {\n @case (\"redirect-internal\") {\n <div class=\"row-cell\" [ngClass]=\"getCellClasses(cell)\" (click)=\"onCellClick($event, row, cell, $index)\">\n <a [routerLink]=\"cell.value.toString()\" class=\"route\">{{cell.name}}</a>\n </div>\n }\n @case (\"redirect-external\") {\n <div class=\"row-cell\" [ngClass]=\"getCellClasses(cell)\" (click)=\"onCellClick($event, row, cell, $index)\">\n <a [href]=\"cell.value\" class=\"route\" target=\"_blank\">{{cell.name}}</a>\n </div>\n }\n @case (\"checkbox\") {\n <div class=\"row-cell\" [ngClass]=\"getCellClasses(cell)\">\n <input type=\"checkbox\" [checked]=\"cell.value\" (change)=\"onCheckboxChange($event, row, cell, $index)\" [attr.disabled]=\"cell.disabled ? true : null\" />\n </div>\n }\n @case (\"input\") {\n <div class=\"row-cell\" [ngClass]=\"getCellClasses(cell)\">\n <input step=\"\" type=\"text\" [value]=\"cell.value\" (blur)=\"onInputChange($event, row, cell, $index)\" />\n </div>\n }\n @case (\"input-number\") {\n <div class=\"row-cell\" [ngClass]=\"getCellClasses(cell)\">\n <input step=\"\" type=\"number\" [value]=\"cell.value\" [min]=\"cell.min\" [max]=\"cell.max\" (blur)=\"onInputChange($event, row, cell, $index)\" />\n </div>\n }\n @case (\"input-quantity\") {\n <div class=\"row-cell\" [ngClass]=\"getCellClasses(cell)\">\n <div class=\"quantity-field\">\n <button\n type=\"button\"\n class=\"quantity-btn quantity-btn-minus\"\n [disabled]=\"cell.disabled || (cell.value ?? 0) <= (cell.min ?? 0)\"\n (click)=\"onQuantityDecrease($event, row, cell, $index)\"\n >\n -\n </button>\n <input\n type=\"number\"\n class=\"quantity-input\"\n [value]=\"cell.value ?? 0\"\n [attr.min]=\"cell.min ?? 0\"\n [attr.max]=\"cell.max ?? null\"\n [attr.disabled]=\"cell.disabled ? true : null\"\n (blur)=\"onQuantityInputChange($event, row, cell, $index)\"\n />\n <button\n type=\"button\"\n class=\"quantity-btn quantity-btn-plus\"\n [disabled]=\"cell.disabled || (cell.max != null && (cell.value ?? 0) >= cell.max)\"\n (click)=\"onQuantityIncrease($event, row, cell, $index)\"\n >\n +\n </button>\n </div>\n </div>\n }\n @case (\"action\") {\n <div class=\"row-cell\" [ngClass]=\"getCellClasses(cell)\">\n <button\n type=\"button\"\n class=\"action-btn\"\n [disabled]=\"cell.disabled\"\n [attr.title]=\"cell.name\"\n (click)=\"onActionClick($event, row, cell, $index)\"\n (mouseenter)=\"hoveredActionCell = cell\"\n (mouseleave)=\"hoveredActionCell = null\"\n >\n <lib-elux-icon [icon]=\"cell.icon\" [color]=\"getActionIconColor(cell)\" [size]=\"'16'\" [sizeType]=\"'px'\"></lib-elux-icon>\n </button>\n </div>\n }\n @default {\n <div class=\"row-cell\" [ngClass]=\"getCellClasses(cell)\" (click)=\"onCellClick($event, row, cell, $index)\">\n {{cell.value}}\n </div>\n }\n }\n }\n </div>\n }\n </div>\n\n @if (hasPaginator && totalRows > itemsPerPage) {\n <div class=\"table-footer\">\n <lib-elux-paginator (paginationEvents)=\"onPageChange($event)\" (itemsPerPageChange)=\"onItemsPerPageChange($event)\"\n [anchor]=\"true\" [length]=\"paginatorTotalPages\" [current]=\"currentPage\" [totalItems]=\"totalRows\"\n [itemsPerPage]=\"itemsPerPage\" [showPaginatorInfo]=\"showPaginatorInfo\">\n </lib-elux-paginator>\n </div>\n }\n\n</div>", styles: [".display{font-family:Electrolux Sans;font-size:48px;font-weight:700;line-height:56px}.heading-1{font-family:Electrolux Sans;font-size:34px;font-weight:700;line-height:40px}.heading-2{font-family:Electrolux Sans;font-size:28px;font-weight:600;line-height:32px}.heading-3{font-family:Electrolux Sans;font-size:20px;font-weight:600;line-height:24px}.subtitle-1{font-family:Electrolux Sans;font-size:16px;font-weight:600;line-height:20px}.body{font-family:Electrolux Sans;font-size:16px;font-weight:400;line-height:21px}.caption{font-family:Electrolux Sans;font-size:14px;font-weight:400;line-height:normal}.links{font-family:Electrolux Sans;font-size:16px;font-weight:600;line-height:normal;text-decoration-line:underline}@media screen and (max-width:768px){.display{font-family:Electrolux Sans;font-size:40px;font-weight:700;line-height:46px}.heading-1{font-family:Electrolux Sans;font-size:28px;font-weight:600;line-height:32px}.heading-2{font-family:Electrolux Sans;font-size:24px;font-weight:600;line-height:28px}.heading-3{font-family:Electrolux Sans;font-size:20px;font-weight:600;line-height:24px}.subtitle-1{font-family:Electrolux Sans;font-size:16px;font-weight:600;line-height:20px}.body{font-family:Electrolux Sans;font-size:16px;font-weight:400;line-height:21px}.caption{font-family:Electrolux Sans;font-size:14px;font-weight:400;line-height:normal}.links{font-family:Electrolux Sans;font-size:16px;font-weight:600;line-height:normal;text-decoration-line:underline}}.table-container{font-family:Electrolux Sans;display:flex;flex-direction:column;flex-wrap:nowrap;border-top:1px solid #ADB9C3}.table-scroll{display:flex;flex-direction:column;flex-wrap:nowrap}.table-row{display:flex;flex-direction:row;flex-wrap:nowrap;width:100%;padding:8px 16px}.table-header{display:flex;flex-direction:row;flex-wrap:nowrap;font-size:14px;font-weight:600;padding:16px;margin-bottom:16px;color:#515253;border-bottom:1px solid #ADB9C3}.header-row-cell{display:flex;flex:1;justify-content:start;align-items:center}.row-cell{display:flex;flex:1;justify-content:start;align-items:center;font-size:14px;height:45px;font-family:Electrolux Sans;color:#515253;word-break:break-word}.row-cell a{font-family:Electrolux Sans;font-weight:700;font-size:16px;color:#515253}.clickable{cursor:pointer;transition:all .15s ease-in-out}.clickable:hover{background-color:#dee7ea}.quantity-field{display:flex;align-items:center;border:1px solid #ADB9C3;border-radius:4px;overflow:hidden;width:fit-content}.quantity-btn{font-family:Inter,Comic Sans,cursive;display:flex;align-items:center;justify-content:center;width:32px;height:32px;border:none;background-color:#fff;color:#011e41;font-weight:600}.quantity-btn:hover:not(:disabled){background-color:#eaebed}.quantity-btn:disabled{color:#eaebed;cursor:not-allowed}.quantity-btn-minus{border-right:1px solid #ADB9C3;cursor:pointer}.quantity-btn-plus{border-left:1px solid #ADB9C3}.quantity-input{width:36px;height:32px;padding:0;border:none;text-align:center;font-size:14px;font-weight:600;font-family:Electrolux Sans;color:#011e41;-moz-appearance:textfield;border-radius:0!important}.quantity-input::-webkit-inner-spin-button,.quantity-input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.action-btn{display:flex;align-items:center;justify-content:center;width:16px;height:16px;border:none;background-color:transparent;border-radius:4px;cursor:pointer}.action-btn:disabled{opacity:.4;cursor:not-allowed}.table-footer{display:flex;flex-direction:column;justify-content:center;margin-top:16px;padding:16px 0;align-items:center;border-top:1px solid #ADB9C3}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: RouterModule }, { kind: "directive", type: i1$1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: EluxPaginator, selector: "lib-elux-paginator", inputs: ["length", "current", "anchor", "scrollTo", "totalItems", "itemsPerPage", "itemsPerPageOptions", "showPaginatorInfo", "itemLabel", "showingLabel", "ofLabel", "itemsPerPageLabel"], outputs: ["paginationEvents", "itemsPerPageChange"] }, { kind: "component", type: EluxLoading, selector: "lib-elux-loading", inputs: ["size", "white"] }, { kind: "component", type: EluxIcon, selector: "lib-elux-icon", inputs: ["color", "useSubscription", "icon", "description", "size", "height", "width", "sizeType"] }] }); }
1195
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.30", type: EluxDataTable, isStandalone: true, selector: "lib-elux-datatable", inputs: { columns: "columns", rows: "rows", totalRows: "totalRows", itemsPerPage: "itemsPerPage", backendPagination: "backendPagination", emptyMessage: "emptyMessage", loading: "loading", isRowClickable: ["isRowClickable", "isRowClickable", booleanAttribute], isCellClickable: ["isCellClickable", "isCellClickable", booleanAttribute], hasPaginator: ["hasPaginator", "hasPaginator", booleanAttribute], showPaginatorInfo: ["showPaginatorInfo", "showPaginatorInfo", booleanAttribute] }, outputs: { currentPageChange: "currentPageChange", itemsPerPageChange: "itemsPerPageChange", onClick: "onClick", onChecked: "onChecked", ontInputChange: "ontInputChange", onAction: "onAction" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"table-container\">\n <div class=\"table-scroll\">\n <div class=\"table-header\">\n @for (column of columns; track $index) {\n <div class=\"header-row-cell\" [ngClass]=\"getHeaderClasses(column)\">\n {{column.text}}\n </div>\n }\n </div>\n\n @if (loading) {\n <div class=\"table-row justify-content-center\">\n <lib-elux-loading></lib-elux-loading>\n </div>\n } @else if (displayRows.length == 0) {\n <div class=\"table-row pt-3 pb-3\">\n {{emptyMessage}}\n </div>\n } @else {\n @for (row of displayRows; track $index) {\n <div class=\"table-row\" [ngClass]=\"{'clickable': isRowClickable}\" (click)=\"onRowClick($event, row, $index)\">\n @for (cell of row; track $index) {\n @switch (cell.type) {\n @case (\"redirect-internal\") {\n <div class=\"row-cell\" [ngClass]=\"getCellClasses(cell)\" (click)=\"onCellClick($event, row, cell, $index)\">\n <a [routerLink]=\"cell.value.toString()\" class=\"route\">{{cell.name}}</a>\n </div>\n }\n @case (\"redirect-external\") {\n <div class=\"row-cell\" [ngClass]=\"getCellClasses(cell)\" (click)=\"onCellClick($event, row, cell, $index)\">\n <a [href]=\"cell.value\" class=\"route\" target=\"_blank\">{{cell.name}}</a>\n </div>\n }\n @case (\"checkbox\") {\n <div class=\"row-cell\" [ngClass]=\"getCellClasses(cell)\">\n <input type=\"checkbox\" [checked]=\"cell.value\" (change)=\"onCheckboxChange($event, row, cell, $index)\"\n [attr.disabled]=\"cell.disabled ? true : null\" />\n </div>\n }\n @case (\"input\") {\n <div class=\"row-cell\" [ngClass]=\"getCellClasses(cell)\">\n <input step=\"\" type=\"text\" [value]=\"cell.value\" (blur)=\"onInputChange($event, row, cell, $index)\" />\n </div>\n }\n @case (\"input-number\") {\n <div class=\"row-cell\" [ngClass]=\"getCellClasses(cell)\">\n <input step=\"\" type=\"number\" [value]=\"cell.value\" [min]=\"cell.min\" [max]=\"cell.max\"\n (blur)=\"onInputChange($event, row, cell, $index)\" />\n </div>\n }\n @case (\"input-quantity\") {\n <div class=\"row-cell\" [ngClass]=\"getCellClasses(cell)\">\n <div class=\"quantity-field\">\n <button type=\"button\" class=\"quantity-btn quantity-btn-minus\"\n [disabled]=\"cell.disabled || (cell.value ?? 0) <= (cell.min ?? 0)\"\n (click)=\"onQuantityDecrease($event, row, cell, $index)\">\n -\n </button>\n <input type=\"number\" class=\"quantity-input\" [value]=\"cell.value ?? 0\" [attr.min]=\"cell.min ?? 0\"\n [attr.max]=\"cell.max ?? null\" [attr.disabled]=\"cell.disabled ? true : null\"\n (blur)=\"onQuantityInputChange($event, row, cell, $index)\" />\n <button type=\"button\" class=\"quantity-btn quantity-btn-plus\"\n [disabled]=\"cell.disabled || (cell.max != null && (cell.value ?? 0) >= cell.max)\"\n (click)=\"onQuantityIncrease($event, row, cell, $index)\">\n +\n </button>\n </div>\n </div>\n }\n @case (\"action\") {\n <div class=\"row-cell\" [ngClass]=\"getCellClasses(cell)\">\n <button type=\"button\" class=\"action-btn\" [disabled]=\"cell.disabled\" [attr.title]=\"cell.name\"\n (click)=\"onActionClick($event, row, cell, $index)\" (mouseenter)=\"hoveredActionCell = cell\"\n (mouseleave)=\"hoveredActionCell = null\">\n <lib-elux-icon [icon]=\"cell.icon\" [color]=\"getActionIconColor(cell)\" [size]=\"'16'\"\n [sizeType]=\"'px'\"></lib-elux-icon>\n </button>\n </div>\n }\n @default {\n <div class=\"row-cell\" [ngClass]=\"getCellClasses(cell)\" (click)=\"onCellClick($event, row, cell, $index)\">\n {{cell.value}}\n </div>\n }\n }\n }\n </div>\n }\n }\n </div>\n\n @if (hasPaginator && effectiveTotalRows > itemsPerPage) {\n <div class=\"table-footer\">\n <lib-elux-paginator (paginationEvents)=\"onPageChange($event)\" (itemsPerPageChange)=\"onItemsPerPageChange($event)\"\n [anchor]=\"true\" [length]=\"paginatorTotalPages\" [current]=\"currentPage\" [totalItems]=\"effectiveTotalRows\"\n [itemsPerPage]=\"itemsPerPage\" [showPaginatorInfo]=\"showPaginatorInfo\">\n </lib-elux-paginator>\n </div>\n }\n\n</div>", styles: [".display{font-family:Electrolux Sans;font-size:48px;font-weight:700;line-height:56px}.heading-1{font-family:Electrolux Sans;font-size:34px;font-weight:700;line-height:40px}.heading-2{font-family:Electrolux Sans;font-size:28px;font-weight:600;line-height:32px}.heading-3{font-family:Electrolux Sans;font-size:20px;font-weight:600;line-height:24px}.subtitle-1{font-family:Electrolux Sans;font-size:16px;font-weight:600;line-height:20px}.body{font-family:Electrolux Sans;font-size:16px;font-weight:400;line-height:21px}.caption{font-family:Electrolux Sans;font-size:14px;font-weight:400;line-height:normal}.links{font-family:Electrolux Sans;font-size:16px;font-weight:600;line-height:normal;text-decoration-line:underline}@media screen and (max-width:768px){.display{font-family:Electrolux Sans;font-size:40px;font-weight:700;line-height:46px}.heading-1{font-family:Electrolux Sans;font-size:28px;font-weight:600;line-height:32px}.heading-2{font-family:Electrolux Sans;font-size:24px;font-weight:600;line-height:28px}.heading-3{font-family:Electrolux Sans;font-size:20px;font-weight:600;line-height:24px}.subtitle-1{font-family:Electrolux Sans;font-size:16px;font-weight:600;line-height:20px}.body{font-family:Electrolux Sans;font-size:16px;font-weight:400;line-height:21px}.caption{font-family:Electrolux Sans;font-size:14px;font-weight:400;line-height:normal}.links{font-family:Electrolux Sans;font-size:16px;font-weight:600;line-height:normal;text-decoration-line:underline}}.table-container{font-family:Electrolux Sans;display:flex;flex-direction:column;flex-wrap:nowrap;border-top:1px solid #ADB9C3}.table-scroll{display:flex;flex-direction:column;flex-wrap:nowrap}.table-row{display:flex;flex-direction:row;flex-wrap:nowrap;width:100%;padding:8px 16px}.table-header{display:flex;flex-direction:row;flex-wrap:nowrap;font-size:14px;font-weight:600;padding:16px;margin-bottom:16px;color:#515253;border-bottom:1px solid #ADB9C3}.header-row-cell{display:flex;flex:1;justify-content:start;align-items:center}.row-cell{display:flex;flex:1;justify-content:start;align-items:center;font-size:14px;height:45px;font-family:Electrolux Sans;color:#515253;word-break:break-word}.row-cell a{font-family:Electrolux Sans;font-weight:700;font-size:16px;color:#515253}.clickable{cursor:pointer;transition:all .15s ease-in-out}.clickable:hover{background-color:#dee7ea}.quantity-field{display:flex;align-items:center;border:1px solid #ADB9C3;border-radius:4px;overflow:hidden;width:fit-content}.quantity-btn{font-family:Inter,Comic Sans,cursive;display:flex;align-items:center;justify-content:center;width:32px;height:32px;border:none;background-color:#fff;color:#011e41;font-weight:600}.quantity-btn:hover:not(:disabled){background-color:#eaebed}.quantity-btn:disabled{color:#eaebed;cursor:not-allowed}.quantity-btn-minus{border-right:1px solid #ADB9C3;cursor:pointer}.quantity-btn-plus{border-left:1px solid #ADB9C3}.quantity-input{width:36px;height:32px;padding:0;border:none;text-align:center;font-size:14px;font-weight:600;font-family:Electrolux Sans;color:#011e41;-moz-appearance:textfield;border-radius:0!important}.quantity-input::-webkit-inner-spin-button,.quantity-input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.action-btn{display:flex;align-items:center;justify-content:center;width:16px;height:16px;border:none;background-color:transparent;border-radius:4px;cursor:pointer}.action-btn:disabled{opacity:.4;cursor:not-allowed}.table-footer{display:flex;flex-direction:column;justify-content:center;margin-top:16px;padding:16px 0;align-items:center;border-top:1px solid #ADB9C3}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: RouterModule }, { kind: "directive", type: i1$1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: EluxPaginator, selector: "lib-elux-paginator", inputs: ["length", "current", "anchor", "scrollTo", "totalItems", "itemsPerPage", "itemsPerPageOptions", "showPaginatorInfo", "itemLabel", "showingLabel", "ofLabel", "itemsPerPageLabel"], outputs: ["paginationEvents", "itemsPerPageChange"] }, { kind: "component", type: EluxLoading, selector: "lib-elux-loading", inputs: ["size", "white"] }, { kind: "component", type: EluxIcon, selector: "lib-elux-icon", inputs: ["color", "useSubscription", "icon", "description", "size", "height", "width", "sizeType"] }] }); }
1189
1196
  }
1190
1197
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.30", ngImport: i0, type: EluxDataTable, decorators: [{
1191
1198
  type: Component,
1192
- args: [{ selector: 'lib-elux-datatable', imports: [CommonModule, RouterModule, EluxPaginator, EluxLoading, EluxIcon], template: "<div class=\"table-container\">\n <div class=\"table-scroll\">\n <div class=\"table-header\">\n @for (column of columns; track $index) {\n <div class=\"header-row-cell\" [ngClass]=\"getHeaderClasses(column)\">\n {{column.text}}\n </div>\n }\n </div>\n\n @if(loading){\n <div class=\"table-row justify-content-center\">\n <lib-elux-loading></lib-elux-loading>\n </div>\n }\n\n @if (displayRows.length == 0) {\n <div class=\"table-row pt-3 pb-3\">\n {{emptyMessage}}\n </div>\n }\n\n @for (row of displayRows; track $index) {\n <div class=\"table-row\" [ngClass]=\"{'clickable': isRowClickable}\" (click)=\"onRowClick($event, row, $index)\">\n @for (cell of row; track $index) {\n @switch (cell.type) {\n @case (\"redirect-internal\") {\n <div class=\"row-cell\" [ngClass]=\"getCellClasses(cell)\" (click)=\"onCellClick($event, row, cell, $index)\">\n <a [routerLink]=\"cell.value.toString()\" class=\"route\">{{cell.name}}</a>\n </div>\n }\n @case (\"redirect-external\") {\n <div class=\"row-cell\" [ngClass]=\"getCellClasses(cell)\" (click)=\"onCellClick($event, row, cell, $index)\">\n <a [href]=\"cell.value\" class=\"route\" target=\"_blank\">{{cell.name}}</a>\n </div>\n }\n @case (\"checkbox\") {\n <div class=\"row-cell\" [ngClass]=\"getCellClasses(cell)\">\n <input type=\"checkbox\" [checked]=\"cell.value\" (change)=\"onCheckboxChange($event, row, cell, $index)\" [attr.disabled]=\"cell.disabled ? true : null\" />\n </div>\n }\n @case (\"input\") {\n <div class=\"row-cell\" [ngClass]=\"getCellClasses(cell)\">\n <input step=\"\" type=\"text\" [value]=\"cell.value\" (blur)=\"onInputChange($event, row, cell, $index)\" />\n </div>\n }\n @case (\"input-number\") {\n <div class=\"row-cell\" [ngClass]=\"getCellClasses(cell)\">\n <input step=\"\" type=\"number\" [value]=\"cell.value\" [min]=\"cell.min\" [max]=\"cell.max\" (blur)=\"onInputChange($event, row, cell, $index)\" />\n </div>\n }\n @case (\"input-quantity\") {\n <div class=\"row-cell\" [ngClass]=\"getCellClasses(cell)\">\n <div class=\"quantity-field\">\n <button\n type=\"button\"\n class=\"quantity-btn quantity-btn-minus\"\n [disabled]=\"cell.disabled || (cell.value ?? 0) <= (cell.min ?? 0)\"\n (click)=\"onQuantityDecrease($event, row, cell, $index)\"\n >\n -\n </button>\n <input\n type=\"number\"\n class=\"quantity-input\"\n [value]=\"cell.value ?? 0\"\n [attr.min]=\"cell.min ?? 0\"\n [attr.max]=\"cell.max ?? null\"\n [attr.disabled]=\"cell.disabled ? true : null\"\n (blur)=\"onQuantityInputChange($event, row, cell, $index)\"\n />\n <button\n type=\"button\"\n class=\"quantity-btn quantity-btn-plus\"\n [disabled]=\"cell.disabled || (cell.max != null && (cell.value ?? 0) >= cell.max)\"\n (click)=\"onQuantityIncrease($event, row, cell, $index)\"\n >\n +\n </button>\n </div>\n </div>\n }\n @case (\"action\") {\n <div class=\"row-cell\" [ngClass]=\"getCellClasses(cell)\">\n <button\n type=\"button\"\n class=\"action-btn\"\n [disabled]=\"cell.disabled\"\n [attr.title]=\"cell.name\"\n (click)=\"onActionClick($event, row, cell, $index)\"\n (mouseenter)=\"hoveredActionCell = cell\"\n (mouseleave)=\"hoveredActionCell = null\"\n >\n <lib-elux-icon [icon]=\"cell.icon\" [color]=\"getActionIconColor(cell)\" [size]=\"'16'\" [sizeType]=\"'px'\"></lib-elux-icon>\n </button>\n </div>\n }\n @default {\n <div class=\"row-cell\" [ngClass]=\"getCellClasses(cell)\" (click)=\"onCellClick($event, row, cell, $index)\">\n {{cell.value}}\n </div>\n }\n }\n }\n </div>\n }\n </div>\n\n @if (hasPaginator && totalRows > itemsPerPage) {\n <div class=\"table-footer\">\n <lib-elux-paginator (paginationEvents)=\"onPageChange($event)\" (itemsPerPageChange)=\"onItemsPerPageChange($event)\"\n [anchor]=\"true\" [length]=\"paginatorTotalPages\" [current]=\"currentPage\" [totalItems]=\"totalRows\"\n [itemsPerPage]=\"itemsPerPage\" [showPaginatorInfo]=\"showPaginatorInfo\">\n </lib-elux-paginator>\n </div>\n }\n\n</div>", styles: [".display{font-family:Electrolux Sans;font-size:48px;font-weight:700;line-height:56px}.heading-1{font-family:Electrolux Sans;font-size:34px;font-weight:700;line-height:40px}.heading-2{font-family:Electrolux Sans;font-size:28px;font-weight:600;line-height:32px}.heading-3{font-family:Electrolux Sans;font-size:20px;font-weight:600;line-height:24px}.subtitle-1{font-family:Electrolux Sans;font-size:16px;font-weight:600;line-height:20px}.body{font-family:Electrolux Sans;font-size:16px;font-weight:400;line-height:21px}.caption{font-family:Electrolux Sans;font-size:14px;font-weight:400;line-height:normal}.links{font-family:Electrolux Sans;font-size:16px;font-weight:600;line-height:normal;text-decoration-line:underline}@media screen and (max-width:768px){.display{font-family:Electrolux Sans;font-size:40px;font-weight:700;line-height:46px}.heading-1{font-family:Electrolux Sans;font-size:28px;font-weight:600;line-height:32px}.heading-2{font-family:Electrolux Sans;font-size:24px;font-weight:600;line-height:28px}.heading-3{font-family:Electrolux Sans;font-size:20px;font-weight:600;line-height:24px}.subtitle-1{font-family:Electrolux Sans;font-size:16px;font-weight:600;line-height:20px}.body{font-family:Electrolux Sans;font-size:16px;font-weight:400;line-height:21px}.caption{font-family:Electrolux Sans;font-size:14px;font-weight:400;line-height:normal}.links{font-family:Electrolux Sans;font-size:16px;font-weight:600;line-height:normal;text-decoration-line:underline}}.table-container{font-family:Electrolux Sans;display:flex;flex-direction:column;flex-wrap:nowrap;border-top:1px solid #ADB9C3}.table-scroll{display:flex;flex-direction:column;flex-wrap:nowrap}.table-row{display:flex;flex-direction:row;flex-wrap:nowrap;width:100%;padding:8px 16px}.table-header{display:flex;flex-direction:row;flex-wrap:nowrap;font-size:14px;font-weight:600;padding:16px;margin-bottom:16px;color:#515253;border-bottom:1px solid #ADB9C3}.header-row-cell{display:flex;flex:1;justify-content:start;align-items:center}.row-cell{display:flex;flex:1;justify-content:start;align-items:center;font-size:14px;height:45px;font-family:Electrolux Sans;color:#515253;word-break:break-word}.row-cell a{font-family:Electrolux Sans;font-weight:700;font-size:16px;color:#515253}.clickable{cursor:pointer;transition:all .15s ease-in-out}.clickable:hover{background-color:#dee7ea}.quantity-field{display:flex;align-items:center;border:1px solid #ADB9C3;border-radius:4px;overflow:hidden;width:fit-content}.quantity-btn{font-family:Inter,Comic Sans,cursive;display:flex;align-items:center;justify-content:center;width:32px;height:32px;border:none;background-color:#fff;color:#011e41;font-weight:600}.quantity-btn:hover:not(:disabled){background-color:#eaebed}.quantity-btn:disabled{color:#eaebed;cursor:not-allowed}.quantity-btn-minus{border-right:1px solid #ADB9C3;cursor:pointer}.quantity-btn-plus{border-left:1px solid #ADB9C3}.quantity-input{width:36px;height:32px;padding:0;border:none;text-align:center;font-size:14px;font-weight:600;font-family:Electrolux Sans;color:#011e41;-moz-appearance:textfield;border-radius:0!important}.quantity-input::-webkit-inner-spin-button,.quantity-input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.action-btn{display:flex;align-items:center;justify-content:center;width:16px;height:16px;border:none;background-color:transparent;border-radius:4px;cursor:pointer}.action-btn:disabled{opacity:.4;cursor:not-allowed}.table-footer{display:flex;flex-direction:column;justify-content:center;margin-top:16px;padding:16px 0;align-items:center;border-top:1px solid #ADB9C3}\n"] }]
1199
+ args: [{ selector: 'lib-elux-datatable', imports: [CommonModule, RouterModule, EluxPaginator, EluxLoading, EluxIcon], template: "<div class=\"table-container\">\n <div class=\"table-scroll\">\n <div class=\"table-header\">\n @for (column of columns; track $index) {\n <div class=\"header-row-cell\" [ngClass]=\"getHeaderClasses(column)\">\n {{column.text}}\n </div>\n }\n </div>\n\n @if (loading) {\n <div class=\"table-row justify-content-center\">\n <lib-elux-loading></lib-elux-loading>\n </div>\n } @else if (displayRows.length == 0) {\n <div class=\"table-row pt-3 pb-3\">\n {{emptyMessage}}\n </div>\n } @else {\n @for (row of displayRows; track $index) {\n <div class=\"table-row\" [ngClass]=\"{'clickable': isRowClickable}\" (click)=\"onRowClick($event, row, $index)\">\n @for (cell of row; track $index) {\n @switch (cell.type) {\n @case (\"redirect-internal\") {\n <div class=\"row-cell\" [ngClass]=\"getCellClasses(cell)\" (click)=\"onCellClick($event, row, cell, $index)\">\n <a [routerLink]=\"cell.value.toString()\" class=\"route\">{{cell.name}}</a>\n </div>\n }\n @case (\"redirect-external\") {\n <div class=\"row-cell\" [ngClass]=\"getCellClasses(cell)\" (click)=\"onCellClick($event, row, cell, $index)\">\n <a [href]=\"cell.value\" class=\"route\" target=\"_blank\">{{cell.name}}</a>\n </div>\n }\n @case (\"checkbox\") {\n <div class=\"row-cell\" [ngClass]=\"getCellClasses(cell)\">\n <input type=\"checkbox\" [checked]=\"cell.value\" (change)=\"onCheckboxChange($event, row, cell, $index)\"\n [attr.disabled]=\"cell.disabled ? true : null\" />\n </div>\n }\n @case (\"input\") {\n <div class=\"row-cell\" [ngClass]=\"getCellClasses(cell)\">\n <input step=\"\" type=\"text\" [value]=\"cell.value\" (blur)=\"onInputChange($event, row, cell, $index)\" />\n </div>\n }\n @case (\"input-number\") {\n <div class=\"row-cell\" [ngClass]=\"getCellClasses(cell)\">\n <input step=\"\" type=\"number\" [value]=\"cell.value\" [min]=\"cell.min\" [max]=\"cell.max\"\n (blur)=\"onInputChange($event, row, cell, $index)\" />\n </div>\n }\n @case (\"input-quantity\") {\n <div class=\"row-cell\" [ngClass]=\"getCellClasses(cell)\">\n <div class=\"quantity-field\">\n <button type=\"button\" class=\"quantity-btn quantity-btn-minus\"\n [disabled]=\"cell.disabled || (cell.value ?? 0) <= (cell.min ?? 0)\"\n (click)=\"onQuantityDecrease($event, row, cell, $index)\">\n -\n </button>\n <input type=\"number\" class=\"quantity-input\" [value]=\"cell.value ?? 0\" [attr.min]=\"cell.min ?? 0\"\n [attr.max]=\"cell.max ?? null\" [attr.disabled]=\"cell.disabled ? true : null\"\n (blur)=\"onQuantityInputChange($event, row, cell, $index)\" />\n <button type=\"button\" class=\"quantity-btn quantity-btn-plus\"\n [disabled]=\"cell.disabled || (cell.max != null && (cell.value ?? 0) >= cell.max)\"\n (click)=\"onQuantityIncrease($event, row, cell, $index)\">\n +\n </button>\n </div>\n </div>\n }\n @case (\"action\") {\n <div class=\"row-cell\" [ngClass]=\"getCellClasses(cell)\">\n <button type=\"button\" class=\"action-btn\" [disabled]=\"cell.disabled\" [attr.title]=\"cell.name\"\n (click)=\"onActionClick($event, row, cell, $index)\" (mouseenter)=\"hoveredActionCell = cell\"\n (mouseleave)=\"hoveredActionCell = null\">\n <lib-elux-icon [icon]=\"cell.icon\" [color]=\"getActionIconColor(cell)\" [size]=\"'16'\"\n [sizeType]=\"'px'\"></lib-elux-icon>\n </button>\n </div>\n }\n @default {\n <div class=\"row-cell\" [ngClass]=\"getCellClasses(cell)\" (click)=\"onCellClick($event, row, cell, $index)\">\n {{cell.value}}\n </div>\n }\n }\n }\n </div>\n }\n }\n </div>\n\n @if (hasPaginator && effectiveTotalRows > itemsPerPage) {\n <div class=\"table-footer\">\n <lib-elux-paginator (paginationEvents)=\"onPageChange($event)\" (itemsPerPageChange)=\"onItemsPerPageChange($event)\"\n [anchor]=\"true\" [length]=\"paginatorTotalPages\" [current]=\"currentPage\" [totalItems]=\"effectiveTotalRows\"\n [itemsPerPage]=\"itemsPerPage\" [showPaginatorInfo]=\"showPaginatorInfo\">\n </lib-elux-paginator>\n </div>\n }\n\n</div>", styles: [".display{font-family:Electrolux Sans;font-size:48px;font-weight:700;line-height:56px}.heading-1{font-family:Electrolux Sans;font-size:34px;font-weight:700;line-height:40px}.heading-2{font-family:Electrolux Sans;font-size:28px;font-weight:600;line-height:32px}.heading-3{font-family:Electrolux Sans;font-size:20px;font-weight:600;line-height:24px}.subtitle-1{font-family:Electrolux Sans;font-size:16px;font-weight:600;line-height:20px}.body{font-family:Electrolux Sans;font-size:16px;font-weight:400;line-height:21px}.caption{font-family:Electrolux Sans;font-size:14px;font-weight:400;line-height:normal}.links{font-family:Electrolux Sans;font-size:16px;font-weight:600;line-height:normal;text-decoration-line:underline}@media screen and (max-width:768px){.display{font-family:Electrolux Sans;font-size:40px;font-weight:700;line-height:46px}.heading-1{font-family:Electrolux Sans;font-size:28px;font-weight:600;line-height:32px}.heading-2{font-family:Electrolux Sans;font-size:24px;font-weight:600;line-height:28px}.heading-3{font-family:Electrolux Sans;font-size:20px;font-weight:600;line-height:24px}.subtitle-1{font-family:Electrolux Sans;font-size:16px;font-weight:600;line-height:20px}.body{font-family:Electrolux Sans;font-size:16px;font-weight:400;line-height:21px}.caption{font-family:Electrolux Sans;font-size:14px;font-weight:400;line-height:normal}.links{font-family:Electrolux Sans;font-size:16px;font-weight:600;line-height:normal;text-decoration-line:underline}}.table-container{font-family:Electrolux Sans;display:flex;flex-direction:column;flex-wrap:nowrap;border-top:1px solid #ADB9C3}.table-scroll{display:flex;flex-direction:column;flex-wrap:nowrap}.table-row{display:flex;flex-direction:row;flex-wrap:nowrap;width:100%;padding:8px 16px}.table-header{display:flex;flex-direction:row;flex-wrap:nowrap;font-size:14px;font-weight:600;padding:16px;margin-bottom:16px;color:#515253;border-bottom:1px solid #ADB9C3}.header-row-cell{display:flex;flex:1;justify-content:start;align-items:center}.row-cell{display:flex;flex:1;justify-content:start;align-items:center;font-size:14px;height:45px;font-family:Electrolux Sans;color:#515253;word-break:break-word}.row-cell a{font-family:Electrolux Sans;font-weight:700;font-size:16px;color:#515253}.clickable{cursor:pointer;transition:all .15s ease-in-out}.clickable:hover{background-color:#dee7ea}.quantity-field{display:flex;align-items:center;border:1px solid #ADB9C3;border-radius:4px;overflow:hidden;width:fit-content}.quantity-btn{font-family:Inter,Comic Sans,cursive;display:flex;align-items:center;justify-content:center;width:32px;height:32px;border:none;background-color:#fff;color:#011e41;font-weight:600}.quantity-btn:hover:not(:disabled){background-color:#eaebed}.quantity-btn:disabled{color:#eaebed;cursor:not-allowed}.quantity-btn-minus{border-right:1px solid #ADB9C3;cursor:pointer}.quantity-btn-plus{border-left:1px solid #ADB9C3}.quantity-input{width:36px;height:32px;padding:0;border:none;text-align:center;font-size:14px;font-weight:600;font-family:Electrolux Sans;color:#011e41;-moz-appearance:textfield;border-radius:0!important}.quantity-input::-webkit-inner-spin-button,.quantity-input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.action-btn{display:flex;align-items:center;justify-content:center;width:16px;height:16px;border:none;background-color:transparent;border-radius:4px;cursor:pointer}.action-btn:disabled{opacity:.4;cursor:not-allowed}.table-footer{display:flex;flex-direction:column;justify-content:center;margin-top:16px;padding:16px 0;align-items:center;border-top:1px solid #ADB9C3}\n"] }]
1193
1200
  }], propDecorators: { columns: [{
1194
1201
  type: Input
1195
1202
  }], rows: [{