keevo-components 0.2.0 → 0.2.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.
- package/esm2020/lib/table/table.component.mjs +20 -4
- package/fesm2015/keevo-components.mjs +19 -3
- package/fesm2015/keevo-components.mjs.map +1 -1
- package/fesm2020/keevo-components.mjs +19 -3
- package/fesm2020/keevo-components.mjs.map +1 -1
- package/lib/table/table.component.d.ts +4 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Component, Input, EventEmitter, Injectable, Output, ViewChildren, ContentChildren, forwardRef, ViewChild, Directive, Pipe, NgModule } from '@angular/core';
|
|
2
|
+
import { Component, Input, EventEmitter, Injectable, Output, ViewChildren, ContentChildren, forwardRef, ViewChild, Directive, Pipe, HostListener, NgModule } from '@angular/core';
|
|
3
3
|
import { Subject, of } from 'rxjs';
|
|
4
4
|
import * as i1 from '@angular/common';
|
|
5
5
|
import { CommonModule } from '@angular/common';
|
|
@@ -827,6 +827,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
|
|
|
827
827
|
}] });
|
|
828
828
|
|
|
829
829
|
class TableComponent {
|
|
830
|
+
onWindowResize() {
|
|
831
|
+
this.screenSize = window.innerWidth;
|
|
832
|
+
this.adjustTableSize();
|
|
833
|
+
}
|
|
830
834
|
set setConfig(value) {
|
|
831
835
|
this.config = {
|
|
832
836
|
enableCation: value.enableCation || true,
|
|
@@ -847,6 +851,7 @@ class TableComponent {
|
|
|
847
851
|
this.cpfCnpjPipe = cpfCnpjPipe;
|
|
848
852
|
this.telefonePipe = telefonePipe;
|
|
849
853
|
this.globalFilterFields = [];
|
|
854
|
+
this.selectedSize = '';
|
|
850
855
|
this.lazy = true;
|
|
851
856
|
this.paginator = true;
|
|
852
857
|
this.onActiveItem = new EventEmitter();
|
|
@@ -854,6 +859,8 @@ class TableComponent {
|
|
|
854
859
|
this.onSelectionChange = new EventEmitter();
|
|
855
860
|
}
|
|
856
861
|
ngOnInit() {
|
|
862
|
+
this.screenSize = window.innerWidth;
|
|
863
|
+
this.adjustTableSize();
|
|
857
864
|
}
|
|
858
865
|
activeItem(rowData) {
|
|
859
866
|
this.onActiveItem.emit(rowData);
|
|
@@ -909,15 +916,24 @@ class TableComponent {
|
|
|
909
916
|
}
|
|
910
917
|
return value;
|
|
911
918
|
}
|
|
919
|
+
adjustTableSize() {
|
|
920
|
+
if (this.screenSize > 762)
|
|
921
|
+
this.selectedSize = '';
|
|
922
|
+
else
|
|
923
|
+
this.selectedSize = 'p-datatable-sm';
|
|
924
|
+
}
|
|
912
925
|
}
|
|
913
926
|
TableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: TableComponent, deps: [{ token: i1.DatePipe }, { token: i1.DecimalPipe }, { token: CodigoFipePipe }, { token: CpfCnpjPipe }, { token: TelefonePipe }], target: i0.ɵɵFactoryTarget.Component });
|
|
914
|
-
TableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.8", type: TableComponent, selector: "kv-table", inputs: { setConfig: ["config", "setConfig"], dataSource: "dataSource", selectedItems: "selectedItems", totalRecords: "totalRecords", lazy: "lazy", paginator: "paginator" }, outputs: { onActiveItem: "onActiveItem", onPaginate: "onPaginate", onSelectionChange: "onSelectionChange" }, queries: [{ propertyName: "templates", predicate: TemplateDirective }], viewQueries: [{ propertyName: "table", first: true, predicate: ["table"], descendants: true }], ngImport: i0, template: "<p-table *ngIf=\"config\" #dt styleClass=\"p-datatable-striped\" [value]=\"dataSource\" [(selection)]=\"selectedItems\"\n [columns]=\"config.columns\" [globalFilterFields]=\"globalFilterFields\" [rows]=\"5\" [paginator]=\"paginator\"\n [rowsPerPageOptions]=\"[5,10,25,50,100,200]\" [showCurrentPageReport]=\"true\"\n currentPageReportTemplate=\"{first} - {last} de {totalRecords}\" [rowHover]=\"true\" [totalRecords]=\"totalRecords\"\n [lazy]=\"config.lazy\" (onLazyLoad)=\"paginate($event)\" (selectionChange)=\"selectionChange($event)\"\n rowGroupMode=\"rowspan\" [groupRowsBy]=\"config.fieldGroup\" [showFirstLastIcon]=\"false\">\n\n <ng-template pTemplate=\"caption\" *ngIf=\"config.enableCation\">\n <div class=\"flex flex-column md:flex-row md:justify-content-between\n md:align-items-center\">\n <h5 class=\"m-0\">{{ config.title }}</h5>\n <span *ngIf=\"config.enableFilter\" class=\"block mt-2 md:mt-0\n p-input-icon-left\">\n <i class=\"pi pi-search\"></i>\n <input pInputText pAutoFocus [autofocus]=\"true\" type=\"text\" (input)=\"onGlobalFilter(dt, $event)\"\n placeholder=\"Pesquisar...\" class=\"w-full sm:w-auto\" />\n </span>\n </div>\n </ng-template>\n\n <ng-template pTemplate=\"header\" let-columns>\n <tr>\n <th style=\"width: 4rem\" *ngIf=\"config.enableSelect\">\n <p-tableHeaderCheckbox></p-tableHeaderCheckbox>\n </th>\n <th *ngFor=\"let col of columns
|
|
927
|
+
TableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.8", type: TableComponent, selector: "kv-table", inputs: { setConfig: ["config", "setConfig"], dataSource: "dataSource", selectedItems: "selectedItems", totalRecords: "totalRecords", lazy: "lazy", paginator: "paginator" }, outputs: { onActiveItem: "onActiveItem", onPaginate: "onPaginate", onSelectionChange: "onSelectionChange" }, host: { listeners: { "window:resize": "onWindowResize($event)" } }, queries: [{ propertyName: "templates", predicate: TemplateDirective }], viewQueries: [{ propertyName: "table", first: true, predicate: ["table"], descendants: true }], ngImport: i0, template: "<p-table *ngIf=\"config\" #dt styleClass=\"p-datatable-striped {{selectedSize}}\" [value]=\"dataSource\" [(selection)]=\"selectedItems\"\n [columns]=\"config.columns\" [globalFilterFields]=\"globalFilterFields\" [rows]=\"5\" [paginator]=\"paginator\"\n [rowsPerPageOptions]=\"[5,10,25,50,100,200]\" [showCurrentPageReport]=\"true\"\n currentPageReportTemplate=\"{first} - {last} de {totalRecords}\" [rowHover]=\"true\" [totalRecords]=\"totalRecords\"\n [lazy]=\"config.lazy\" (onLazyLoad)=\"paginate($event)\" (selectionChange)=\"selectionChange($event)\"\n rowGroupMode=\"rowspan\" [groupRowsBy]=\"config.fieldGroup\" [showFirstLastIcon]=\"false\" [tableStyle]=\"{ 'min-width': '35rem' }\">\n\n <ng-template pTemplate=\"caption\" *ngIf=\"config.enableCation\">\n <div class=\"flex flex-column md:flex-row md:justify-content-between\n md:align-items-center\">\n <h5 class=\"m-0\">{{ config.title }}</h5>\n <span *ngIf=\"config.enableFilter\" class=\"block mt-2 md:mt-0\n p-input-icon-left\">\n <i class=\"pi pi-search\"></i>\n <input pInputText pAutoFocus [autofocus]=\"true\" type=\"text\" (input)=\"onGlobalFilter(dt, $event)\"\n placeholder=\"Pesquisar...\" class=\"w-full sm:w-auto\" />\n </span>\n </div>\n </ng-template>\n\n <ng-template pTemplate=\"header\" let-columns>\n <tr>\n <th style=\"width: 4rem\" *ngIf=\"config.enableSelect\">\n <p-tableHeaderCheckbox></p-tableHeaderCheckbox>\n </th>\n <th *ngFor=\"let col of columns;\" [pSortableColumn]=\"col.field\" [pSortableColumnDisabled]=\"col.sortable === false\"\n [style.width]=\"col.width\" class=\"text-sm\">\n <div class=\"flex flex-row\">\n {{col.header}}\n <p-sortIcon *ngIf=\"col.sortable === true\" [field]=\"col.field\" style=\"font-size: 10px;\"></p-sortIcon>\n </div>\n\n </th>\n <th *ngIf=\"config.actions && config.actions.length> 0\"></th>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\" let-rowgroup=\"rowgroup\" let-rowspan=\"rowspan\">\n <tr>\n <td *ngIf=\"config.enableSelect\">\n <p-tableCheckbox [value]=\"rowData\"></p-tableCheckbox>\n </td>\n\n <ng-container *ngFor=\"let col of columns\">\n\n <td *ngIf=\"rowgroup\" [attr.rowspan]=\"rowgroup && col.grouped? rowspan: null\">\n <span class=\"p-column-title\">{{col.header}}</span>\n <span *ngIf=\"!isBooleanField(rowData, col); else booleanField\" class=\"text-xs md:text-sm lg:text-base\">\n {{ transformValue(rowData, col) }}\n </span>\n\n <ng-template #booleanField>\n <i [ngClass]=\"rowData[col.field] ? 'pi pi-check' : 'pi pi-times'\"></i>\n </ng-template>\n </td>\n\n <td *ngIf=\"!rowgroup && !col.grouped\">\n <span class=\"p-column-title\">{{col.header}}</span>\n <span *ngIf=\"!isBooleanField(rowData, col); else booleanField\" class=\"text-xs md:text-sm lg:text-base\">\n {{ transformValue(rowData, col) }}\n </span>\n\n <ng-template #booleanField>\n <i [ngClass]=\"rowData[col.field] ? 'pi pi-check' : 'pi pi-times'\"></i>\n </ng-template>\n </td>\n\n </ng-container>\n\n <!-- <td *ngIf=\"config.actions && config.actions.length> 0\">\n <i class=\"pi pi-ellipsis-h\" style=\"cursor: pointer\"\n (click)=\"activeItem(rowData);menu.toggle($event)\"></i>\n </td> -->\n\n <td *ngIf=\"config.actions && config.actions.length> 0\" class=\"flex flex-row\">\n <div *ngFor=\"let action of config.actions\">\n <i class=\"pi {{action.icon}}\" style=\"cursor: pointer\" class=\"mr-2 ml-2\" (click)=\"action?.command()\"></i>\n </div>\n </td>\n\n </tr>\n </ng-template>\n <ng-template pTemplate=\"emptymessage\" let-columns>\n <tr>\n <td [attr.colspan]=\"columns.length\" style=\"text-align: center;\">\n Nenhum registro encontrado\n </td>\n </tr>\n </ng-template>\n</p-table>\n<p-menu #menu [popup]=\"true\" [model]=\"config.actions\"></p-menu>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "directive", type: i6$1.AutoFocus, selector: "[pAutoFocus]", inputs: ["autofocus"] }, { kind: "directive", type: i4$5.InputText, selector: "[pInputText]" }, { kind: "component", type: i8$1.Menu, selector: "p-menu", inputs: ["model", "popup", "style", "styleClass", "appendTo", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions"], outputs: ["onShow", "onHide"] }, { kind: "component", type: i9$1.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "selectionPageOnly", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowSelectable", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "groupRowsByOrder", "responsiveLayout", "breakpoint", "virtualRowHeight", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "selectAll"], outputs: ["selectAllChange", "selectionChange", "contextMenuSelectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { kind: "directive", type: i9$1.SortableColumn, selector: "[pSortableColumn]", inputs: ["pSortableColumn", "pSortableColumnDisabled"] }, { kind: "component", type: i9$1.SortIcon, selector: "p-sortIcon", inputs: ["field"] }, { kind: "component", type: i9$1.TableCheckbox, selector: "p-tableCheckbox", inputs: ["disabled", "value", "index", "inputId", "name", "required", "ariaLabel"] }, { kind: "component", type: i9$1.TableHeaderCheckbox, selector: "p-tableHeaderCheckbox", inputs: ["disabled", "inputId", "name", "ariaLabel"] }] });
|
|
915
928
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: TableComponent, decorators: [{
|
|
916
929
|
type: Component,
|
|
917
|
-
args: [{ selector: 'kv-table', template: "<p-table *ngIf=\"config\" #dt styleClass=\"p-datatable-striped\" [value]=\"dataSource\" [(selection)]=\"selectedItems\"\n [columns]=\"config.columns\" [globalFilterFields]=\"globalFilterFields\" [rows]=\"5\" [paginator]=\"paginator\"\n [rowsPerPageOptions]=\"[5,10,25,50,100,200]\" [showCurrentPageReport]=\"true\"\n currentPageReportTemplate=\"{first} - {last} de {totalRecords}\" [rowHover]=\"true\" [totalRecords]=\"totalRecords\"\n [lazy]=\"config.lazy\" (onLazyLoad)=\"paginate($event)\" (selectionChange)=\"selectionChange($event)\"\n rowGroupMode=\"rowspan\" [groupRowsBy]=\"config.fieldGroup\" [showFirstLastIcon]=\"false\">\n\n <ng-template pTemplate=\"caption\" *ngIf=\"config.enableCation\">\n <div class=\"flex flex-column md:flex-row md:justify-content-between\n md:align-items-center\">\n <h5 class=\"m-0\">{{ config.title }}</h5>\n <span *ngIf=\"config.enableFilter\" class=\"block mt-2 md:mt-0\n p-input-icon-left\">\n <i class=\"pi pi-search\"></i>\n <input pInputText pAutoFocus [autofocus]=\"true\" type=\"text\" (input)=\"onGlobalFilter(dt, $event)\"\n placeholder=\"Pesquisar...\" class=\"w-full sm:w-auto\" />\n </span>\n </div>\n </ng-template>\n\n <ng-template pTemplate=\"header\" let-columns>\n <tr>\n <th style=\"width: 4rem\" *ngIf=\"config.enableSelect\">\n <p-tableHeaderCheckbox></p-tableHeaderCheckbox>\n </th>\n <th *ngFor=\"let col of columns
|
|
930
|
+
args: [{ selector: 'kv-table', template: "<p-table *ngIf=\"config\" #dt styleClass=\"p-datatable-striped {{selectedSize}}\" [value]=\"dataSource\" [(selection)]=\"selectedItems\"\n [columns]=\"config.columns\" [globalFilterFields]=\"globalFilterFields\" [rows]=\"5\" [paginator]=\"paginator\"\n [rowsPerPageOptions]=\"[5,10,25,50,100,200]\" [showCurrentPageReport]=\"true\"\n currentPageReportTemplate=\"{first} - {last} de {totalRecords}\" [rowHover]=\"true\" [totalRecords]=\"totalRecords\"\n [lazy]=\"config.lazy\" (onLazyLoad)=\"paginate($event)\" (selectionChange)=\"selectionChange($event)\"\n rowGroupMode=\"rowspan\" [groupRowsBy]=\"config.fieldGroup\" [showFirstLastIcon]=\"false\" [tableStyle]=\"{ 'min-width': '35rem' }\">\n\n <ng-template pTemplate=\"caption\" *ngIf=\"config.enableCation\">\n <div class=\"flex flex-column md:flex-row md:justify-content-between\n md:align-items-center\">\n <h5 class=\"m-0\">{{ config.title }}</h5>\n <span *ngIf=\"config.enableFilter\" class=\"block mt-2 md:mt-0\n p-input-icon-left\">\n <i class=\"pi pi-search\"></i>\n <input pInputText pAutoFocus [autofocus]=\"true\" type=\"text\" (input)=\"onGlobalFilter(dt, $event)\"\n placeholder=\"Pesquisar...\" class=\"w-full sm:w-auto\" />\n </span>\n </div>\n </ng-template>\n\n <ng-template pTemplate=\"header\" let-columns>\n <tr>\n <th style=\"width: 4rem\" *ngIf=\"config.enableSelect\">\n <p-tableHeaderCheckbox></p-tableHeaderCheckbox>\n </th>\n <th *ngFor=\"let col of columns;\" [pSortableColumn]=\"col.field\" [pSortableColumnDisabled]=\"col.sortable === false\"\n [style.width]=\"col.width\" class=\"text-sm\">\n <div class=\"flex flex-row\">\n {{col.header}}\n <p-sortIcon *ngIf=\"col.sortable === true\" [field]=\"col.field\" style=\"font-size: 10px;\"></p-sortIcon>\n </div>\n\n </th>\n <th *ngIf=\"config.actions && config.actions.length> 0\"></th>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\" let-rowgroup=\"rowgroup\" let-rowspan=\"rowspan\">\n <tr>\n <td *ngIf=\"config.enableSelect\">\n <p-tableCheckbox [value]=\"rowData\"></p-tableCheckbox>\n </td>\n\n <ng-container *ngFor=\"let col of columns\">\n\n <td *ngIf=\"rowgroup\" [attr.rowspan]=\"rowgroup && col.grouped? rowspan: null\">\n <span class=\"p-column-title\">{{col.header}}</span>\n <span *ngIf=\"!isBooleanField(rowData, col); else booleanField\" class=\"text-xs md:text-sm lg:text-base\">\n {{ transformValue(rowData, col) }}\n </span>\n\n <ng-template #booleanField>\n <i [ngClass]=\"rowData[col.field] ? 'pi pi-check' : 'pi pi-times'\"></i>\n </ng-template>\n </td>\n\n <td *ngIf=\"!rowgroup && !col.grouped\">\n <span class=\"p-column-title\">{{col.header}}</span>\n <span *ngIf=\"!isBooleanField(rowData, col); else booleanField\" class=\"text-xs md:text-sm lg:text-base\">\n {{ transformValue(rowData, col) }}\n </span>\n\n <ng-template #booleanField>\n <i [ngClass]=\"rowData[col.field] ? 'pi pi-check' : 'pi pi-times'\"></i>\n </ng-template>\n </td>\n\n </ng-container>\n\n <!-- <td *ngIf=\"config.actions && config.actions.length> 0\">\n <i class=\"pi pi-ellipsis-h\" style=\"cursor: pointer\"\n (click)=\"activeItem(rowData);menu.toggle($event)\"></i>\n </td> -->\n\n <td *ngIf=\"config.actions && config.actions.length> 0\" class=\"flex flex-row\">\n <div *ngFor=\"let action of config.actions\">\n <i class=\"pi {{action.icon}}\" style=\"cursor: pointer\" class=\"mr-2 ml-2\" (click)=\"action?.command()\"></i>\n </div>\n </td>\n\n </tr>\n </ng-template>\n <ng-template pTemplate=\"emptymessage\" let-columns>\n <tr>\n <td [attr.colspan]=\"columns.length\" style=\"text-align: center;\">\n Nenhum registro encontrado\n </td>\n </tr>\n </ng-template>\n</p-table>\n<p-menu #menu [popup]=\"true\" [model]=\"config.actions\"></p-menu>\n" }]
|
|
918
931
|
}], ctorParameters: function () { return [{ type: i1.DatePipe }, { type: i1.DecimalPipe }, { type: CodigoFipePipe }, { type: CpfCnpjPipe }, { type: TelefonePipe }]; }, propDecorators: { templates: [{
|
|
919
932
|
type: ContentChildren,
|
|
920
933
|
args: [TemplateDirective]
|
|
934
|
+
}], onWindowResize: [{
|
|
935
|
+
type: HostListener,
|
|
936
|
+
args: ['window:resize', ['$event']]
|
|
921
937
|
}], table: [{
|
|
922
938
|
type: ViewChild,
|
|
923
939
|
args: ['table', { static: false }]
|