UNPKG

ngx-easy-table

Version:
231 lines 25.2 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'; export class TableTHeadComponent { /** * @param {?} styleService */ constructor(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 {?} */ onClick(targetElement) { if (this.additionalActionMenu && !this.additionalActionMenu.nativeElement.contains(targetElement)) { this.menuActive = false; } } /** * @param {?} column * @return {?} */ getColumnDefinition(column) { return column.searchEnabled || typeof column.searchEnabled === 'undefined'; } /** * @param {?} column * @return {?} */ orderBy(column) { this.order.emit(column); } /** * @param {?} column * @return {?} */ isOrderEnabled(column) { /** @type {?} */ const columnOrderEnabled = column.orderEnabled === undefined ? true : !!column.orderEnabled; return this.config.orderEnabled && columnOrderEnabled; } /** * @param {?} event * @return {?} */ columnDrop(event) { moveItemInArray(this.columns, event.previousIndex, event.currentIndex); } /** * @param {?} $event * @return {?} */ onSearch($event) { this.filter.emit($event); } /** * @param {?} column * @return {?} */ getColumnWidth(column) { if (column.width) { return column.width; } return this.config.fixedColumnWidth ? 100 / this.columns.length + '%' : null; } /** * @return {?} */ onSelectAll() { this.selectAll.emit(); } /** * @param {?} event * @param {?} th * @return {?} */ onMouseDown(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 {?} */ onMouseMove(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 {?} */ onMouseUp(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 {?} */ showHeaderActionTemplateMenu(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 {?} */ showMenu() { 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: [` .cdk-drag-preview { text-align: left; padding-top: 9px; padding-left: 4px; color: #50596c; border: 1px solid #e7e9ed; } `] }] } ]; /** @nocollapse */ TableTHeadComponent.ctorParameters = () => [ { 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'],] }] }; 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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGhlYWQuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6Im5nOi8vbmd4LWVhc3ktdGFibGUvIiwic291cmNlcyI6WyJsaWIvY29tcG9uZW50cy90aGVhZC90aGVhZC5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5nc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