UNPKG

ngx-easy-table

Version:
273 lines 26.9 kB
/** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ import { Component, EventEmitter, HostListener, Input, Output, TemplateRef, ViewChild, } from '@angular/core'; import { Event } from '../..'; import { StyleService } from '../../services/style.service'; import { moveItemInArray } from '@angular/cdk/drag-drop'; var TableTHeadComponent = /** @class */ (function () { function TableTHeadComponent(styleService) { this.styleService = styleService; this.menuActive = false; this.openedHeaderActionTemplate = null; this.onSelectAllBinded = this.onSelectAll.bind(this); this.filter = new EventEmitter(); this.order = new EventEmitter(); this.selectAll = new EventEmitter(); this.event = new EventEmitter(); } /** * @param {?} targetElement * @return {?} */ TableTHeadComponent.prototype.onClick = /** * @param {?} targetElement * @return {?} */ function (targetElement) { if (this.additionalActionMenu && !this.additionalActionMenu.nativeElement.contains(targetElement)) { this.menuActive = false; } }; /** * @param {?} column * @return {?} */ TableTHeadComponent.prototype.getColumnDefinition = /** * @param {?} column * @return {?} */ function (column) { return column.searchEnabled || typeof column.searchEnabled === 'undefined'; }; /** * @param {?} column * @return {?} */ TableTHeadComponent.prototype.orderBy = /** * @param {?} column * @return {?} */ function (column) { this.order.emit(column); }; /** * @param {?} column * @return {?} */ TableTHeadComponent.prototype.isOrderEnabled = /** * @param {?} column * @return {?} */ function (column) { /** @type {?} */ var columnOrderEnabled = column.orderEnabled === undefined ? true : !!column.orderEnabled; return this.config.orderEnabled && columnOrderEnabled; }; /** * @param {?} event * @return {?} */ TableTHeadComponent.prototype.columnDrop = /** * @param {?} event * @return {?} */ function (event) { moveItemInArray(this.columns, event.previousIndex, event.currentIndex); }; /** * @param {?} $event * @return {?} */ TableTHeadComponent.prototype.onSearch = /** * @param {?} $event * @return {?} */ function ($event) { this.filter.emit($event); }; /** * @param {?} column * @return {?} */ TableTHeadComponent.prototype.getColumnWidth = /** * @param {?} column * @return {?} */ function (column) { if (column.width) { return column.width; } return this.config.fixedColumnWidth ? 100 / this.columns.length + '%' : null; }; /** * @return {?} */ TableTHeadComponent.prototype.onSelectAll = /** * @return {?} */ function () { this.selectAll.emit(); }; /** * @param {?} event * @param {?} th * @return {?} */ TableTHeadComponent.prototype.onMouseDown = /** * @param {?} event * @param {?} th * @return {?} */ function (event, th) { if (!this.config.resizeColumn) { return; } this.th = th; this.startOffset = th.offsetWidth - event.pageX; this.event.emit({ event: Event.onColumnResizeMouseDown, value: event, }); }; /** * @param {?} event * @return {?} */ TableTHeadComponent.prototype.onMouseMove = /** * @param {?} event * @return {?} */ function (event) { if (!this.config.resizeColumn) { return; } if (this.th && this.th.style) { this.th.style.width = this.startOffset + event.pageX + 'px'; this.th.style.cursor = 'col-resize'; this.th.style['user-select'] = 'none'; } }; /** * @param {?} event * @return {?} */ TableTHeadComponent.prototype.onMouseUp = /** * @param {?} event * @return {?} */ function (event) { if (!this.config.resizeColumn) { return; } this.event.emit({ event: Event.onColumnResizeMouseUp, value: event, }); this.th.style.cursor = 'default'; this.th = undefined; }; /** * @param {?} column * @return {?} */ TableTHeadComponent.prototype.showHeaderActionTemplateMenu = /** * @param {?} column * @return {?} */ function (column) { if (!column.headerActionTemplate) { console.error('Column [headerActionTemplate] property not defined'); } if (this.openedHeaderActionTemplate === column.key) { this.openedHeaderActionTemplate = null; return; } this.openedHeaderActionTemplate = column.key; }; /** * @return {?} */ TableTHeadComponent.prototype.showMenu = /** * @return {?} */ function () { if (!this.additionalActionsTemplate) { console.error('[additionalActionsTemplate] property not defined'); } this.menuActive = !this.menuActive; }; TableTHeadComponent.decorators = [ { type: Component, args: [{ selector: '[table-thead]', template: "<tr class=\"ngx-table__header\" *ngIf=\"config.headerEnabled && !config.columnReorder\">\n <th *ngIf=\"config.checkboxes || config.radio\" [style.width]=\"'3%'\">\n <ng-container\n *ngIf=\"selectAllTemplate && config.checkboxes\"\n [ngTemplateOutlet]=\"selectAllTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: onSelectAllBinded }\">\n </ng-container>\n <label class=\"ngx-form-checkbox\"\n for=\"selectAllCheckboxes\"\n *ngIf=\"!selectAllTemplate && config.checkboxes\">\n <input type=\"checkbox\" id=\"selectAllCheckboxes\" (change)=\"onSelectAll()\">\n <em class=\"ngx-form-icon\" id=\"selectAllCheckbox\"></em>\n </label>\n </th>\n <ng-container *ngFor=\"let column of columns; let colIndex = index; let last = last\">\n <th class=\"ngx-table__header-cell\"\n [class.pinned-left]=\"column.pinned\"\n [ngClass]=\"column.cssClass && column.cssClass.includeHeader ? column.cssClass.name : ''\"\n [style.left]=\"styleService.pinnedWidth(column.pinned, colIndex)\"\n #th\n [style.width]=\"getColumnWidth(column)\"\n (mousedown)=\"onMouseDown($event, th)\"\n (mouseup)=\"onMouseUp($event)\"\n (mousemove)=\"onMouseMove($event)\">\n <div (click)=\"orderBy(column)\" style=\"display: inline\" [class.pointer]=\"isOrderEnabled(column)\">\n <div class=\"ngx-table__header-title\">{{ column.title }}<span>&nbsp;</span>\n <em class=\"ngx-icon ngx-icon-pin\" *ngIf=\"column.pinned\"></em>\n <div [style.display]=\"config.orderEnabled ? 'inline' : 'none' \">\n <em *ngIf=\"sortKey === column.key && this.sortState.get(sortKey) === 'asc'\"\n class=\"ngx-icon ngx-icon-arrow-up\">\n </em>\n <em *ngIf=\"sortKey === column.key && this.sortState.get(sortKey) === 'desc'\"\n class=\"ngx-icon ngx-icon-arrow-down\">\n </em>\n </div>\n </div>\n </div>\n <div class=\"ngx-dropdown\"\n *ngIf=\"!!column.headerActionTemplate\">\n <a class=\"ngx-btn ngx-btn-link\" (click)=\"showHeaderActionTemplateMenu(column)\">\n <span class=\"ngx-icon ngx-icon-more\"></span>\n </a>\n <div class=\"ngx-menu ngx-table__table-menu\"\n *ngIf=\"column.key === openedHeaderActionTemplate\">\n <ng-container\n [ngTemplateOutlet]=\"column.headerActionTemplate\">\n </ng-container>\n </div>\n </div>\n <div class=\"ngx-table__column-resizer\" *ngIf=\"config.resizeColumn && !last\"></div>\n </th>\n </ng-container>\n <th *ngIf=\"config.additionalActions || config.detailsTemplate || config.collapseAllRows || config.groupRows\"\n class=\"ngx-table__header-cell-additional-actions\">\n <div class=\"ngx-dropdown\"\n #additionalActionMenu\n *ngIf=\"config.additionalActions\">\n <a class=\"ngx-btn ngx-btn-link\" (click)=\"showMenu()\">\n <span class=\"ngx-icon ngx-icon-menu\"></span>\n </a>\n <ul class=\"ngx-menu ngx-table__table-menu\"\n *ngIf=\"menuActive\">\n <ng-container\n *ngIf=\"additionalActionsTemplate\"\n [ngTemplateOutlet]=\"additionalActionsTemplate\">\n </ng-container>\n </ul>\n </div>\n </th>\n</tr>\n<tr class=\"ngx-table__header ngx-table__header--draggable\"\n *ngIf=\"config.headerEnabled && config.columnReorder\"\n cdkDropList\n cdkDropListOrientation=\"horizontal\"\n (cdkDropListDropped)=\"columnDrop($event)\"\n>\n <th [style.width]=\"'3%'\">\n <ng-container\n *ngIf=\"selectAllTemplate && config.checkboxes\"\n [ngTemplateOutlet]=\"selectAllTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: onSelectAllBinded }\">\n </ng-container>\n <label class=\"ngx-form-checkbox\"\n for=\"selectAllCheckboxes\"\n *ngIf=\"!selectAllTemplate && config.checkboxes\">\n <input type=\"checkbox\" id=\"selectAllCheckboxesDrag\" (change)=\"onSelectAll()\">\n <em class=\"ngx-form-icon\" id=\"selectAllCheckboxDrag\"></em>\n </label>\n </th>\n <ng-container *ngFor=\"let column of columns; let colIndex = index; let last = last\">\n <th class=\"ngx-table__header-cell ngx-table__header-cell--draggable\"\n cdkDragLockAxis=\"x\"\n cdkDrag\n [class.pinned-left]=\"column.pinned\"\n [ngClass]=\"column.cssClass && column.cssClass.includeHeader ? column.cssClass.name : ''\"\n [style.left]=\"styleService.pinnedWidth(column.pinned, colIndex)\"\n #th\n [style.width]=\"getColumnWidth(column)\"\n (mousedown)=\"onMouseDown($event, th)\"\n (mouseup)=\"onMouseUp($event)\"\n (mousemove)=\"onMouseMove($event)\">\n <div (click)=\"orderBy(column)\" style=\"display: inline\"\n cdkDragHandle\n [class.pointer]=\"isOrderEnabled(column)\">\n <div class=\"ngx-table__header-title\">{{ column.title }}<span>&nbsp;</span>\n <em class=\"ngx-icon ngx-icon-pin\" *ngIf=\"column.pinned\"></em>\n <div [style.display]=\"config.orderEnabled ? 'inline' : 'none' \">\n <em *ngIf=\"sortKey === column.key && this.sortState.get(sortKey) === 'asc'\"\n class=\"ngx-icon ngx-icon-arrow-up\">\n </em>\n <em *ngIf=\"sortKey === column.key && this.sortState.get(sortKey) === 'desc'\"\n class=\"ngx-icon ngx-icon-arrow-down\">\n </em>\n </div>\n </div>\n </div>\n <div class=\"ngx-dropdown\"\n *ngIf=\"!!column.headerActionTemplate\">\n <a class=\"ngx-btn ngx-btn-link\" (click)=\"showHeaderActionTemplateMenu(column)\">\n <span class=\"ngx-icon ngx-icon-more\"></span>\n </a>\n <div class=\"ngx-menu ngx-table__table-menu\"\n *ngIf=\"column.key === openedHeaderActionTemplate\">\n <ng-container\n [ngTemplateOutlet]=\"column.headerActionTemplate\">\n </ng-container>\n </div>\n </div>\n <div class=\"ngx-table__column-resizer\" *ngIf=\"config.resizeColumn && !last\"></div>\n </th>\n </ng-container>\n <th *ngIf=\"config.additionalActions || config.detailsTemplate || config.collapseAllRows || config.groupRows\"\n class=\"ngx-table__header-cell-additional-actions\">\n <div class=\"ngx-dropdown\"\n #additionalActionMenu\n *ngIf=\"config.additionalActions\">\n <a class=\"ngx-btn ngx-btn-link\" (click)=\"showMenu()\">\n <span class=\"ngx-icon ngx-icon-menu\"></span>\n </a>\n <ul class=\"ngx-menu ngx-table__table-menu\"\n *ngIf=\"menuActive\">\n <ng-container\n *ngIf=\"additionalActionsTemplate\"\n [ngTemplateOutlet]=\"additionalActionsTemplate\">\n </ng-container>\n </ul>\n </div>\n </th>\n</tr>\n<tr *ngIf=\"config.searchEnabled && !filtersTemplate\"\n class=\"ngx-table__sort-header\">\n <th *ngIf=\"config.checkboxes || config.radio\"></th>\n <ng-container *ngFor=\"let column of columns; let colIndex = index\">\n <th\n [ngClass]=\"column.cssClass && column.cssClass.includeHeader ? column.cssClass.name : ''\"\n [class.pinned-left]=\"column.pinned\"\n [style.left]=\"styleService.pinnedWidth(column.pinned, colIndex)\">\n <table-header\n *ngIf=\"getColumnDefinition(column)\"\n (update)=\"onSearch($event)\"\n [column]=\"column\">\n </table-header>\n </th>\n </ng-container>\n <th *ngIf=\"config.additionalActions || config.detailsTemplate\"></th>\n</tr>\n<ng-container *ngIf=\"filtersTemplate\">\n <tr>\n <ng-container [ngTemplateOutlet]=\"filtersTemplate\">\n </ng-container>\n </tr>\n</ng-container>\n", providers: [StyleService], styles: ["\n .cdk-drag-preview {\n text-align: left;\n padding-top: 9px;\n padding-left: 4px;\n color: #50596c;\n border: 1px solid #e7e9ed;\n }\n "] }] } ]; /** @nocollapse */ TableTHeadComponent.ctorParameters = function () { return [ { type: StyleService } ]; }; TableTHeadComponent.propDecorators = { config: [{ type: Input }], columns: [{ type: Input }], sortKey: [{ type: Input }], sortState: [{ type: Input }], selectAllTemplate: [{ type: Input }], filtersTemplate: [{ type: Input }], additionalActionsTemplate: [{ type: Input }], filter: [{ type: Output }], order: [{ type: Output }], selectAll: [{ type: Output }], event: [{ type: Output }], th: [{ type: ViewChild, args: ['th', { static: false },] }], additionalActionMenu: [{ type: ViewChild, args: ['additionalActionMenu', { static: false },] }], onClick: [{ type: HostListener, args: ['document:click', ['$event.target'],] }] }; return TableTHeadComponent; }()); export { TableTHeadComponent }; if (false) { /** @type {?} */ TableTHeadComponent.prototype.menuActive; /** @type {?} */ TableTHeadComponent.prototype.openedHeaderActionTemplate; /** @type {?} */ TableTHeadComponent.prototype.startOffset; /** @type {?} */ TableTHeadComponent.prototype.onSelectAllBinded; /** @type {?} */ TableTHeadComponent.prototype.config; /** @type {?} */ TableTHeadComponent.prototype.columns; /** @type {?} */ TableTHeadComponent.prototype.sortKey; /** @type {?} */ TableTHeadComponent.prototype.sortState; /** @type {?} */ TableTHeadComponent.prototype.selectAllTemplate; /** @type {?} */ TableTHeadComponent.prototype.filtersTemplate; /** @type {?} */ TableTHeadComponent.prototype.additionalActionsTemplate; /** @type {?} */ TableTHeadComponent.prototype.filter; /** @type {?} */ TableTHeadComponent.prototype.order; /** @type {?} */ TableTHeadComponent.prototype.selectAll; /** @type {?} */ TableTHeadComponent.prototype.event; /** * @type {?} * @private */ TableTHeadComponent.prototype.th; /** @type {?} */ TableTHeadComponent.prototype.additionalActionMenu; /** @type {?} */ TableTHeadComponent.prototype.styleService; } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGhlYWQuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6Im5nOi8vbmd4LWVhc3ktdGFibGUvIiwic291cmNlcyI6WyJsaWIvY29tcG9uZW50cy90aGVhZC90aGVhZC5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztBQUFBLE9BQU8sRUFDTCxTQUFTLEVBQ1QsWUFBWSxFQUNaLFlBQVksRUFDWixLQUFLLEVBQ0wsTUFBTSxFQUNOLFdBQVcsRUFDWCxTQUFTLEdBQ1YsTUFBTSxlQUFlLENBQUM7QUFDdkIsT0FBTyxFQUFtQixLQUFLLEVBQUUsTUFBTSxPQUFPLENBQUM7QUFDL0MsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLDhCQUE4QixDQUFDO0FBQzVELE9BQU8sRUFBZSxlQUFlLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQUV0RTtJQXdDRSw2QkFDa0IsWUFBMEI7UUFBMUIsaUJBQVksR0FBWixZQUFZLENBQWM7UUExQnJDLGVBQVUsR0FBRyxLQUFLLENBQUM7UUFDbkIsK0JBQTBCLEdBQWtCLElBQUksQ0FBQztRQUVqRCxzQkFBaUIsR0FBRyxJQUFJLENBQUMsV0FBVyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQztRQVNwQyx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