UNPKG

ng-zorro-antd

Version:

An enterprise-class UI components based on Ant Design and Angular

184 lines 21.9 kB
import { __decorate, __metadata } from "tslib"; /** * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ /* tslint:disable:component-selector */ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, Output, ViewEncapsulation } from '@angular/core'; import { InputBoolean } from 'ng-zorro-antd/core/util'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; export class NzThAddOnComponent { constructor(cdr) { this.cdr = cdr; this.manualClickOrder$ = new Subject(); this.calcOperatorChange$ = new Subject(); this.nzFilterValue = null; this.sortOrder = null; this.sortDirections = ['ascend', 'descend', null]; this.sortOrderChange$ = new Subject(); this.destroy$ = new Subject(); this.isNzShowSortChanged = false; this.isNzShowFilterChanged = false; this.nzFilterMultiple = true; this.nzSortOrder = null; this.nzSortPriority = false; this.nzSortDirections = ['ascend', 'descend', null]; this.nzFilters = []; this.nzSortFn = null; this.nzFilterFn = null; this.nzShowSort = false; this.nzShowFilter = false; this.nzCustomFilter = false; this.nzCheckedChange = new EventEmitter(); this.nzSortOrderChange = new EventEmitter(); this.nzFilterChange = new EventEmitter(); } getNextSortDirection(sortDirections, current) { const index = sortDirections.indexOf(current); if (index === sortDirections.length - 1) { return sortDirections[0]; } else { return sortDirections[index + 1]; } } emitNextSortValue() { if (this.nzShowSort) { const nextOrder = this.getNextSortDirection(this.sortDirections, this.sortOrder); this.setSortOrder(nextOrder); this.manualClickOrder$.next(this); } } setSortOrder(order) { this.sortOrderChange$.next(order); } clearSortOrder() { if (this.sortOrder !== null) { this.setSortOrder(null); } } onFilterValueChange(value) { this.nzFilterChange.emit(value); this.nzFilterValue = value; this.updateCalcOperator(); } updateCalcOperator() { this.calcOperatorChange$.next(); } ngOnInit() { this.sortOrderChange$.pipe(takeUntil(this.destroy$)).subscribe(order => { if (this.sortOrder !== order) { this.sortOrder = order; this.nzSortOrderChange.emit(order); } this.updateCalcOperator(); this.cdr.markForCheck(); }); } ngOnChanges(changes) { const { nzSortDirections, nzFilters, nzSortOrder, nzSortFn, nzFilterFn, nzSortPriority, nzFilterMultiple, nzShowSort, nzShowFilter } = changes; if (nzSortDirections) { if (this.nzSortDirections && this.nzSortDirections.length) { this.sortDirections = this.nzSortDirections; } } if (nzSortOrder) { this.sortOrder = this.nzSortOrder; this.setSortOrder(this.nzSortOrder); } if (nzShowSort) { this.isNzShowSortChanged = true; } if (nzShowFilter) { this.isNzShowFilterChanged = true; } const isFirstChange = (value) => value && value.firstChange && value.currentValue !== undefined; if ((isFirstChange(nzSortOrder) || isFirstChange(nzSortFn)) && !this.isNzShowSortChanged) { this.nzShowSort = true; } if (isFirstChange(nzFilters) && !this.isNzShowFilterChanged) { this.nzShowFilter = true; } if ((nzFilters || nzFilterMultiple) && this.nzShowFilter) { const listOfValue = this.nzFilters.filter(item => item.byDefault).map(item => item.value); this.nzFilterValue = this.nzFilterMultiple ? listOfValue : listOfValue[0] || null; } if (nzSortFn || nzFilterFn || nzSortPriority || nzFilters) { this.updateCalcOperator(); } } ngOnDestroy() { this.destroy$.next(); this.destroy$.complete(); } } NzThAddOnComponent.decorators = [ { type: Component, args: [{ selector: 'th[nzColumnKey], th[nzSortFn], th[nzSortOrder], th[nzFilters], th[nzShowSort], th[nzShowFilter], th[nzCustomFilter]', preserveWhitespaces: false, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: ` <nz-table-filter *ngIf="nzShowFilter || nzCustomFilter; else notFilterTemplate" [contentTemplate]="notFilterTemplate" [extraTemplate]="extraTemplate" [customFilter]="nzCustomFilter" [filterMultiple]="nzFilterMultiple" [listOfFilter]="nzFilters" (filterChange)="onFilterValueChange($event)" ></nz-table-filter> <ng-template #notFilterTemplate> <ng-template [ngTemplateOutlet]="nzShowSort ? sortTemplate : contentTemplate"></ng-template> </ng-template> <ng-template #extraTemplate> <ng-content select="[nz-th-extra]"></ng-content> <ng-content select="nz-filter-trigger"></ng-content> </ng-template> <ng-template #sortTemplate> <nz-table-sorters [sortOrder]="sortOrder" [sortDirections]="sortDirections" [contentTemplate]="contentTemplate"></nz-table-sorters> </ng-template> <ng-template #contentTemplate> <ng-content></ng-content> </ng-template> `, host: { '[class.ant-table-column-has-sorters]': 'nzShowSort', '[class.ant-table-column-sort]': `sortOrder === 'descend' || sortOrder === 'ascend'`, '(click)': 'emitNextSortValue()' } },] } ]; NzThAddOnComponent.ctorParameters = () => [ { type: ChangeDetectorRef } ]; NzThAddOnComponent.propDecorators = { nzColumnKey: [{ type: Input }], nzFilterMultiple: [{ type: Input }], nzSortOrder: [{ type: Input }], nzSortPriority: [{ type: Input }], nzSortDirections: [{ type: Input }], nzFilters: [{ type: Input }], nzSortFn: [{ type: Input }], nzFilterFn: [{ type: Input }], nzShowSort: [{ type: Input }], nzShowFilter: [{ type: Input }], nzCustomFilter: [{ type: Input }], nzCheckedChange: [{ type: Output }], nzSortOrderChange: [{ type: Output }], nzFilterChange: [{ type: Output }] }; __decorate([ InputBoolean(), __metadata("design:type", Object) ], NzThAddOnComponent.prototype, "nzShowSort", void 0); __decorate([ InputBoolean(), __metadata("design:type", Object) ], NzThAddOnComponent.prototype, "nzShowFilter", void 0); __decorate([ InputBoolean(), __metadata("design:type", Object) ], NzThAddOnComponent.prototype, "nzCustomFilter", void 0); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGgtYWRkb24uY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6Ii9ob21lL3ZzdHMvd29yay8xL3MvY29tcG9uZW50cy90YWJsZS8iLCJzb3VyY2VzIjpbInNyYy9jZWxsL3RoLWFkZG9uLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7OztHQUdHO0FBQ0gsdUNBQXVDO0FBQ3ZDLE9BQU8sRUFDTCx1QkFBdUIsRUFDdkIsaUJBQW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