ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
977 lines (966 loc) • 151 kB
JavaScript
import * as i5 from '@angular/cdk/bidi';
import { BidiModule } from '@angular/cdk/bidi';
import * as i1$5 from '@angular/cdk/platform';
import { PlatformModule } from '@angular/cdk/platform';
import * as i4$2 from '@angular/cdk/scrolling';
import { CdkVirtualScrollViewport, ScrollingModule } from '@angular/cdk/scrolling';
import * as i1$3 from '@angular/common';
import { CommonModule } from '@angular/common';
import * as i0 from '@angular/core';
import { EventEmitter, ElementRef, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, Output, ViewChild, Directive, Injectable, Optional, NgZone, ViewChildren, ContentChild, ContentChildren, NgModule } from '@angular/core';
import * as i11 from '@angular/forms';
import { FormsModule } from '@angular/forms';
import * as i6 from 'ng-zorro-antd/button';
import { NzButtonModule } from 'ng-zorro-antd/button';
import * as i1$4 from 'ng-zorro-antd/cdk/resize-observer';
import { NzResizeObserverModule } from 'ng-zorro-antd/cdk/resize-observer';
import * as i1$2 from 'ng-zorro-antd/checkbox';
import { NzCheckboxModule } from 'ng-zorro-antd/checkbox';
import * as i1$6 from 'ng-zorro-antd/core/outlet';
import { NzOutletModule } from 'ng-zorro-antd/core/outlet';
import * as i3 from 'ng-zorro-antd/dropdown';
import { NzDropDownDirective, NzDropDownModule } from 'ng-zorro-antd/dropdown';
import * as i4$1 from 'ng-zorro-antd/empty';
import { NzEmptyModule } from 'ng-zorro-antd/empty';
import * as i1$1 from 'ng-zorro-antd/i18n';
import { NzI18nModule } from 'ng-zorro-antd/i18n';
import * as i9 from 'ng-zorro-antd/icon';
import { NzIconModule } from 'ng-zorro-antd/icon';
import * as i10 from 'ng-zorro-antd/menu';
import { NzMenuModule } from 'ng-zorro-antd/menu';
import * as i10$1 from 'ng-zorro-antd/pagination';
import { NzPaginationModule } from 'ng-zorro-antd/pagination';
import * as i4 from 'ng-zorro-antd/radio';
import { NzRadioModule } from 'ng-zorro-antd/radio';
import * as i6$1 from 'ng-zorro-antd/spin';
import { NzSpinModule } from 'ng-zorro-antd/spin';
import { __decorate } from 'tslib';
import { fromEvent, Subject, ReplaySubject, BehaviorSubject, combineLatest, merge, EMPTY, of } from 'rxjs';
import { takeUntil, map, filter, startWith, switchMap, debounceTime, delay, distinctUntilChanged, skip, mergeMap } from 'rxjs/operators';
import * as i1 from 'ng-zorro-antd/core/config';
import { WithConfig } from 'ng-zorro-antd/core/config';
import * as i2 from 'ng-zorro-antd/core/services';
import { NzDestroyService } from 'ng-zorro-antd/core/services';
import { InputBoolean, arraysEqual, isNil, measureScrollbar } from 'ng-zorro-antd/core/util';
import * as i8 from 'ng-zorro-antd/core/transition-patch';
import * as i12 from 'ng-zorro-antd/core/wave';
const NZ_CONFIG_MODULE_NAME$1 = 'filterTrigger';
class NzFilterTriggerComponent {
constructor(nzConfigService, ngZone, cdr, destroy$) {
this.nzConfigService = nzConfigService;
this.ngZone = ngZone;
this.cdr = cdr;
this.destroy$ = destroy$;
this._nzModuleName = NZ_CONFIG_MODULE_NAME$1;
this.nzActive = false;
this.nzVisible = false;
this.nzBackdrop = false;
this.nzVisibleChange = new EventEmitter();
}
onVisibleChange(visible) {
this.nzVisible = visible;
this.nzVisibleChange.next(visible);
}
hide() {
this.nzVisible = false;
this.cdr.markForCheck();
}
show() {
this.nzVisible = true;
this.cdr.markForCheck();
}
ngOnInit() {
this.ngZone.runOutsideAngular(() => {
fromEvent(this.nzDropdown.nativeElement, 'click')
.pipe(takeUntil(this.destroy$))
.subscribe(event => {
event.stopPropagation();
});
});
}
}
NzFilterTriggerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: NzFilterTriggerComponent, deps: [{ token: i1.NzConfigService }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }, { token: i2.NzDestroyService }], target: i0.ɵɵFactoryTarget.Component });
NzFilterTriggerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.5", type: NzFilterTriggerComponent, selector: "nz-filter-trigger", inputs: { nzActive: "nzActive", nzDropdownMenu: "nzDropdownMenu", nzVisible: "nzVisible", nzBackdrop: "nzBackdrop" }, outputs: { nzVisibleChange: "nzVisibleChange" }, providers: [NzDestroyService], viewQueries: [{ propertyName: "nzDropdown", first: true, predicate: NzDropDownDirective, descendants: true, read: ElementRef, static: true }], exportAs: ["nzFilterTrigger"], ngImport: i0, template: `
<span
nz-dropdown
class="ant-table-filter-trigger"
nzTrigger="click"
nzPlacement="bottomRight"
[nzBackdrop]="nzBackdrop"
[nzClickHide]="false"
[nzDropdownMenu]="nzDropdownMenu"
[class.active]="nzActive"
[class.ant-table-filter-open]="nzVisible"
[nzVisible]="nzVisible"
(nzVisibleChange)="onVisibleChange($event)"
>
<ng-content></ng-content>
</span>
`, isInline: true, directives: [{ type: i3.NzDropDownDirective, selector: "[nz-dropdown]", inputs: ["nzDropdownMenu", "nzTrigger", "nzMatchWidthElement", "nzBackdrop", "nzClickHide", "nzDisabled", "nzVisible", "nzOverlayClassName", "nzOverlayStyle", "nzPlacement"], outputs: ["nzVisibleChange"], exportAs: ["nzDropdown"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
__decorate([
WithConfig(),
InputBoolean()
], NzFilterTriggerComponent.prototype, "nzBackdrop", void 0);
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: NzFilterTriggerComponent, decorators: [{
type: Component,
args: [{
selector: 'nz-filter-trigger',
exportAs: `nzFilterTrigger`,
changeDetection: ChangeDetectionStrategy.OnPush,
preserveWhitespaces: false,
encapsulation: ViewEncapsulation.None,
template: `
<span
nz-dropdown
class="ant-table-filter-trigger"
nzTrigger="click"
nzPlacement="bottomRight"
[nzBackdrop]="nzBackdrop"
[nzClickHide]="false"
[nzDropdownMenu]="nzDropdownMenu"
[class.active]="nzActive"
[class.ant-table-filter-open]="nzVisible"
[nzVisible]="nzVisible"
(nzVisibleChange)="onVisibleChange($event)"
>
<ng-content></ng-content>
</span>
`,
providers: [NzDestroyService]
}]
}], ctorParameters: function () { return [{ type: i1.NzConfigService }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }, { type: i2.NzDestroyService }]; }, propDecorators: { nzActive: [{
type: Input
}], nzDropdownMenu: [{
type: Input
}], nzVisible: [{
type: Input
}], nzBackdrop: [{
type: Input
}], nzVisibleChange: [{
type: Output
}], nzDropdown: [{
type: ViewChild,
args: [NzDropDownDirective, { static: true, read: ElementRef }]
}] } });
/**
* 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
*/
class NzTableFilterComponent {
constructor(cdr, i18n) {
this.cdr = cdr;
this.i18n = i18n;
this.contentTemplate = null;
this.customFilter = false;
this.extraTemplate = null;
this.filterMultiple = true;
this.listOfFilter = [];
this.filterChange = new EventEmitter();
this.destroy$ = new Subject();
this.isChecked = false;
this.isVisible = false;
this.listOfParsedFilter = [];
this.listOfChecked = [];
}
trackByValue(_, item) {
return item.value;
}
check(filter) {
if (this.filterMultiple) {
this.listOfParsedFilter = this.listOfParsedFilter.map(item => {
if (item === filter) {
return { ...item, checked: !filter.checked };
}
else {
return item;
}
});
filter.checked = !filter.checked;
}
else {
this.listOfParsedFilter = this.listOfParsedFilter.map(item => ({ ...item, checked: item === filter }));
}
this.isChecked = this.getCheckedStatus(this.listOfParsedFilter);
}
confirm() {
this.isVisible = false;
this.emitFilterData();
}
reset() {
this.isVisible = false;
this.listOfParsedFilter = this.parseListOfFilter(this.listOfFilter, true);
this.isChecked = this.getCheckedStatus(this.listOfParsedFilter);
this.emitFilterData();
}
onVisibleChange(value) {
this.isVisible = value;
if (!value) {
this.emitFilterData();
}
else {
this.listOfChecked = this.listOfParsedFilter.filter(item => item.checked).map(item => item.value);
}
}
emitFilterData() {
const listOfChecked = this.listOfParsedFilter.filter(item => item.checked).map(item => item.value);
if (!arraysEqual(this.listOfChecked, listOfChecked)) {
if (this.filterMultiple) {
this.filterChange.emit(listOfChecked);
}
else {
this.filterChange.emit(listOfChecked.length > 0 ? listOfChecked[0] : null);
}
}
}
parseListOfFilter(listOfFilter, reset) {
return listOfFilter.map(item => {
const checked = reset ? false : !!item.byDefault;
return { text: item.text, value: item.value, checked };
});
}
getCheckedStatus(listOfParsedFilter) {
return listOfParsedFilter.some(item => item.checked);
}
ngOnInit() {
this.i18n.localeChange.pipe(takeUntil(this.destroy$)).subscribe(() => {
this.locale = this.i18n.getLocaleData('Table');
this.cdr.markForCheck();
});
}
ngOnChanges(changes) {
const { listOfFilter } = changes;
if (listOfFilter && this.listOfFilter && this.listOfFilter.length) {
this.listOfParsedFilter = this.parseListOfFilter(this.listOfFilter);
this.isChecked = this.getCheckedStatus(this.listOfParsedFilter);
}
}
ngOnDestroy() {
this.destroy$.next();
this.destroy$.complete();
}
}
NzTableFilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: NzTableFilterComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1$1.NzI18nService }], target: i0.ɵɵFactoryTarget.Component });
NzTableFilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.5", type: NzTableFilterComponent, selector: "nz-table-filter", inputs: { contentTemplate: "contentTemplate", customFilter: "customFilter", extraTemplate: "extraTemplate", filterMultiple: "filterMultiple", listOfFilter: "listOfFilter" }, outputs: { filterChange: "filterChange" }, host: { classAttribute: "ant-table-filter-column" }, usesOnChanges: true, ngImport: i0, template: `
<span class="ant-table-column-title">
<ng-template [ngTemplateOutlet]="contentTemplate"></ng-template>
</span>
<ng-container *ngIf="!customFilter; else extraTemplate">
<nz-filter-trigger
[nzVisible]="isVisible"
[nzActive]="isChecked"
[nzDropdownMenu]="filterMenu"
(nzVisibleChange)="onVisibleChange($event)"
>
<i nz-icon nzType="filter" nzTheme="fill"></i>
</nz-filter-trigger>
<nz-dropdown-menu #filterMenu="nzDropdownMenu">
<div class="ant-table-filter-dropdown">
<ul nz-menu>
<li
nz-menu-item
[nzSelected]="f.checked"
*ngFor="let f of listOfParsedFilter; trackBy: trackByValue"
(click)="check(f)"
>
<label nz-radio *ngIf="!filterMultiple" [ngModel]="f.checked" (ngModelChange)="check(f)"></label>
<label nz-checkbox *ngIf="filterMultiple" [ngModel]="f.checked" (ngModelChange)="check(f)"></label>
<span>{{ f.text }}</span>
</li>
</ul>
<div class="ant-table-filter-dropdown-btns">
<button nz-button nzType="link" nzSize="small" (click)="reset()" [disabled]="!isChecked">
{{ locale.filterReset }}
</button>
<button nz-button nzType="primary" nzSize="small" (click)="confirm()">{{ locale.filterConfirm }}</button>
</div>
</div>
</nz-dropdown-menu>
</ng-container>
`, isInline: true, components: [{ type: NzFilterTriggerComponent, selector: "nz-filter-trigger", inputs: ["nzActive", "nzDropdownMenu", "nzVisible", "nzBackdrop"], outputs: ["nzVisibleChange"], exportAs: ["nzFilterTrigger"] }, { type: i3.NzDropdownMenuComponent, selector: "nz-dropdown-menu", exportAs: ["nzDropdownMenu"] }, { type: i4.NzRadioComponent, selector: "[nz-radio],[nz-radio-button]", inputs: ["nzValue", "nzDisabled", "nzAutoFocus"], exportAs: ["nzRadio"] }, { type: i1$2.NzCheckboxComponent, selector: "[nz-checkbox]", inputs: ["nzValue", "nzAutoFocus", "nzDisabled", "nzIndeterminate", "nzChecked", "nzId"], outputs: ["nzCheckedChange"], exportAs: ["nzCheckbox"] }, { type: i6.NzButtonComponent, selector: "button[nz-button], a[nz-button]", inputs: ["nzBlock", "nzGhost", "nzSearch", "nzLoading", "nzDanger", "disabled", "tabIndex", "nzType", "nzShape", "nzSize"], exportAs: ["nzButton"] }], directives: [{ type: i1$3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i1$3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i8.ɵNzTransitionPatchDirective, selector: "[nz-button], nz-button-group, [nz-icon], [nz-menu-item], [nz-submenu], nz-select-top-control, nz-select-placeholder, nz-input-group", inputs: ["hidden"] }, { type: i9.NzIconDirective, selector: "[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { type: i10.NzMenuDirective, selector: "[nz-menu]", inputs: ["nzInlineIndent", "nzTheme", "nzMode", "nzInlineCollapsed", "nzSelectable"], outputs: ["nzClick"], exportAs: ["nzMenu"] }, { type: i1$3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i10.NzMenuItemDirective, selector: "[nz-menu-item]", inputs: ["nzPaddingLeft", "nzDisabled", "nzSelected", "nzDanger", "nzMatchRouterExact", "nzMatchRouter"], exportAs: ["nzMenuItem"] }, { type: i11.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i11.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i12.NzWaveDirective, selector: "[nz-wave],button[nz-button]:not([nzType=\"link\"]):not([nzType=\"text\"])", inputs: ["nzWaveExtraNode"], exportAs: ["nzWave"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: NzTableFilterComponent, decorators: [{
type: Component,
args: [{
selector: 'nz-table-filter',
preserveWhitespaces: false,
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
template: `
<span class="ant-table-column-title">
<ng-template [ngTemplateOutlet]="contentTemplate"></ng-template>
</span>
<ng-container *ngIf="!customFilter; else extraTemplate">
<nz-filter-trigger
[nzVisible]="isVisible"
[nzActive]="isChecked"
[nzDropdownMenu]="filterMenu"
(nzVisibleChange)="onVisibleChange($event)"
>
<i nz-icon nzType="filter" nzTheme="fill"></i>
</nz-filter-trigger>
<nz-dropdown-menu #filterMenu="nzDropdownMenu">
<div class="ant-table-filter-dropdown">
<ul nz-menu>
<li
nz-menu-item
[nzSelected]="f.checked"
*ngFor="let f of listOfParsedFilter; trackBy: trackByValue"
(click)="check(f)"
>
<label nz-radio *ngIf="!filterMultiple" [ngModel]="f.checked" (ngModelChange)="check(f)"></label>
<label nz-checkbox *ngIf="filterMultiple" [ngModel]="f.checked" (ngModelChange)="check(f)"></label>
<span>{{ f.text }}</span>
</li>
</ul>
<div class="ant-table-filter-dropdown-btns">
<button nz-button nzType="link" nzSize="small" (click)="reset()" [disabled]="!isChecked">
{{ locale.filterReset }}
</button>
<button nz-button nzType="primary" nzSize="small" (click)="confirm()">{{ locale.filterConfirm }}</button>
</div>
</div>
</nz-dropdown-menu>
</ng-container>
`,
host: { class: 'ant-table-filter-column' }
}]
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i1$1.NzI18nService }]; }, propDecorators: { contentTemplate: [{
type: Input
}], customFilter: [{
type: Input
}], extraTemplate: [{
type: Input
}], filterMultiple: [{
type: Input
}], listOfFilter: [{
type: Input
}], filterChange: [{
type: Output
}] } });
/**
* 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
*/
class NzRowExpandButtonDirective {
constructor() {
this.expand = false;
this.spaceMode = false;
this.expandChange = new EventEmitter();
}
onHostClick() {
if (!this.spaceMode) {
this.expand = !this.expand;
this.expandChange.next(this.expand);
}
}
}
NzRowExpandButtonDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: NzRowExpandButtonDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
NzRowExpandButtonDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.5", type: NzRowExpandButtonDirective, selector: "button[nz-row-expand-button]", inputs: { expand: "expand", spaceMode: "spaceMode" }, outputs: { expandChange: "expandChange" }, host: { listeners: { "click": "onHostClick()" }, properties: { "type": "'button'", "class.ant-table-row-expand-icon-expanded": "!spaceMode && expand === true", "class.ant-table-row-expand-icon-collapsed": "!spaceMode && expand === false", "class.ant-table-row-expand-icon-spaced": "spaceMode" }, classAttribute: "ant-table-row-expand-icon" }, ngImport: i0 });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: NzRowExpandButtonDirective, decorators: [{
type: Directive,
args: [{
selector: 'button[nz-row-expand-button]',
host: {
class: 'ant-table-row-expand-icon',
'[type]': `'button'`,
'[class.ant-table-row-expand-icon-expanded]': `!spaceMode && expand === true`,
'[class.ant-table-row-expand-icon-collapsed]': `!spaceMode && expand === false`,
'[class.ant-table-row-expand-icon-spaced]': 'spaceMode',
'(click)': 'onHostClick()'
}
}]
}], ctorParameters: function () { return []; }, propDecorators: { expand: [{
type: Input
}], spaceMode: [{
type: Input
}], expandChange: [{
type: Output
}] } });
/**
* 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
*/
class NzRowIndentDirective {
constructor() {
this.indentSize = 0;
}
}
NzRowIndentDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: NzRowIndentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
NzRowIndentDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.5", type: NzRowIndentDirective, selector: "nz-row-indent", inputs: { indentSize: "indentSize" }, host: { properties: { "style.padding-left.px": "indentSize" }, classAttribute: "ant-table-row-indent" }, ngImport: i0 });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: NzRowIndentDirective, decorators: [{
type: Directive,
args: [{
selector: 'nz-row-indent',
host: {
class: 'ant-table-row-indent',
'[style.padding-left.px]': 'indentSize'
}
}]
}], ctorParameters: function () { return []; }, propDecorators: { indentSize: [{
type: Input
}] } });
/**
* 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
*/
class NzTableSelectionComponent {
constructor() {
this.listOfSelections = [];
this.checked = false;
this.disabled = false;
this.indeterminate = false;
this.showCheckbox = false;
this.showRowSelection = false;
this.checkedChange = new EventEmitter();
}
onCheckedChange(checked) {
this.checked = checked;
this.checkedChange.emit(checked);
}
}
NzTableSelectionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: NzTableSelectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
NzTableSelectionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.5", type: NzTableSelectionComponent, selector: "nz-table-selection", inputs: { listOfSelections: "listOfSelections", checked: "checked", disabled: "disabled", indeterminate: "indeterminate", showCheckbox: "showCheckbox", showRowSelection: "showRowSelection" }, outputs: { checkedChange: "checkedChange" }, host: { classAttribute: "ant-table-selection" }, ngImport: i0, template: `
<label
*ngIf="showCheckbox"
nz-checkbox
[class.ant-table-selection-select-all-custom]="showRowSelection"
[ngModel]="checked"
[nzDisabled]="disabled"
[nzIndeterminate]="indeterminate"
(ngModelChange)="onCheckedChange($event)"
></label>
<div class="ant-table-selection-extra" *ngIf="showRowSelection">
<span nz-dropdown class="ant-table-selection-down" nzPlacement="bottomLeft" [nzDropdownMenu]="selectionMenu">
<i nz-icon nzType="down"></i>
</span>
<nz-dropdown-menu #selectionMenu="nzDropdownMenu">
<ul nz-menu class="ant-table-selection-menu">
<li nz-menu-item *ngFor="let selection of listOfSelections" (click)="selection.onSelect()">
{{ selection.text }}
</li>
</ul>
</nz-dropdown-menu>
</div>
`, isInline: true, components: [{ type: i1$2.NzCheckboxComponent, selector: "[nz-checkbox]", inputs: ["nzValue", "nzAutoFocus", "nzDisabled", "nzIndeterminate", "nzChecked", "nzId"], outputs: ["nzCheckedChange"], exportAs: ["nzCheckbox"] }, { type: i3.NzDropdownMenuComponent, selector: "nz-dropdown-menu", exportAs: ["nzDropdownMenu"] }], directives: [{ type: i1$3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i11.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i11.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i3.NzDropDownDirective, selector: "[nz-dropdown]", inputs: ["nzDropdownMenu", "nzTrigger", "nzMatchWidthElement", "nzBackdrop", "nzClickHide", "nzDisabled", "nzVisible", "nzOverlayClassName", "nzOverlayStyle", "nzPlacement"], outputs: ["nzVisibleChange"], exportAs: ["nzDropdown"] }, { type: i8.ɵNzTransitionPatchDirective, selector: "[nz-button], nz-button-group, [nz-icon], [nz-menu-item], [nz-submenu], nz-select-top-control, nz-select-placeholder, nz-input-group", inputs: ["hidden"] }, { type: i9.NzIconDirective, selector: "[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { type: i10.NzMenuDirective, selector: "[nz-menu]", inputs: ["nzInlineIndent", "nzTheme", "nzMode", "nzInlineCollapsed", "nzSelectable"], outputs: ["nzClick"], exportAs: ["nzMenu"] }, { type: i1$3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i10.NzMenuItemDirective, selector: "[nz-menu-item]", inputs: ["nzPaddingLeft", "nzDisabled", "nzSelected", "nzDanger", "nzMatchRouterExact", "nzMatchRouter"], exportAs: ["nzMenuItem"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: NzTableSelectionComponent, decorators: [{
type: Component,
args: [{
selector: 'nz-table-selection',
preserveWhitespaces: false,
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
template: `
<label
*ngIf="showCheckbox"
nz-checkbox
[class.ant-table-selection-select-all-custom]="showRowSelection"
[ngModel]="checked"
[nzDisabled]="disabled"
[nzIndeterminate]="indeterminate"
(ngModelChange)="onCheckedChange($event)"
></label>
<div class="ant-table-selection-extra" *ngIf="showRowSelection">
<span nz-dropdown class="ant-table-selection-down" nzPlacement="bottomLeft" [nzDropdownMenu]="selectionMenu">
<i nz-icon nzType="down"></i>
</span>
<nz-dropdown-menu #selectionMenu="nzDropdownMenu">
<ul nz-menu class="ant-table-selection-menu">
<li nz-menu-item *ngFor="let selection of listOfSelections" (click)="selection.onSelect()">
{{ selection.text }}
</li>
</ul>
</nz-dropdown-menu>
</div>
`,
host: { class: 'ant-table-selection' }
}]
}], ctorParameters: function () { return []; }, propDecorators: { listOfSelections: [{
type: Input
}], checked: [{
type: Input
}], disabled: [{
type: Input
}], indeterminate: [{
type: Input
}], showCheckbox: [{
type: Input
}], showRowSelection: [{
type: Input
}], checkedChange: [{
type: Output
}] } });
/**
* 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
*/
class NzTableSortersComponent {
constructor() {
this.sortDirections = ['ascend', 'descend', null];
this.sortOrder = null;
this.contentTemplate = null;
this.isUp = false;
this.isDown = false;
}
ngOnChanges(changes) {
const { sortDirections } = changes;
if (sortDirections) {
this.isUp = this.sortDirections.indexOf('ascend') !== -1;
this.isDown = this.sortDirections.indexOf('descend') !== -1;
}
}
}
NzTableSortersComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: NzTableSortersComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
NzTableSortersComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.5", type: NzTableSortersComponent, selector: "nz-table-sorters", inputs: { sortDirections: "sortDirections", sortOrder: "sortOrder", contentTemplate: "contentTemplate" }, host: { classAttribute: "ant-table-column-sorters" }, usesOnChanges: true, ngImport: i0, template: `
<span class="ant-table-column-title"><ng-template [ngTemplateOutlet]="contentTemplate"></ng-template></span>
<span class="ant-table-column-sorter" [class.ant-table-column-sorter-full]="isDown && isUp">
<span class="ant-table-column-sorter-inner">
<i
nz-icon
nzType="caret-up"
*ngIf="isUp"
class="ant-table-column-sorter-up"
[class.active]="sortOrder === 'ascend'"
></i>
<i
nz-icon
nzType="caret-down"
*ngIf="isDown"
class="ant-table-column-sorter-down"
[class.active]="sortOrder === 'descend'"
></i>
</span>
</span>
`, isInline: true, directives: [{ type: i1$3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i1$3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i8.ɵNzTransitionPatchDirective, selector: "[nz-button], nz-button-group, [nz-icon], [nz-menu-item], [nz-submenu], nz-select-top-control, nz-select-placeholder, nz-input-group", inputs: ["hidden"] }, { type: i9.NzIconDirective, selector: "[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: NzTableSortersComponent, decorators: [{
type: Component,
args: [{
selector: 'nz-table-sorters',
preserveWhitespaces: false,
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
template: `
<span class="ant-table-column-title"><ng-template [ngTemplateOutlet]="contentTemplate"></ng-template></span>
<span class="ant-table-column-sorter" [class.ant-table-column-sorter-full]="isDown && isUp">
<span class="ant-table-column-sorter-inner">
<i
nz-icon
nzType="caret-up"
*ngIf="isUp"
class="ant-table-column-sorter-up"
[class.active]="sortOrder === 'ascend'"
></i>
<i
nz-icon
nzType="caret-down"
*ngIf="isDown"
class="ant-table-column-sorter-down"
[class.active]="sortOrder === 'descend'"
></i>
</span>
</span>
`,
host: { class: 'ant-table-column-sorters' }
}]
}], ctorParameters: function () { return []; }, propDecorators: { sortDirections: [{
type: Input
}], sortOrder: [{
type: Input
}], contentTemplate: [{
type: Input
}] } });
/**
* 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
*/
class NzCellFixedDirective {
constructor(renderer, elementRef) {
this.renderer = renderer;
this.elementRef = elementRef;
this.nzRight = false;
this.nzLeft = false;
this.colspan = null;
this.colSpan = null;
this.changes$ = new Subject();
this.isAutoLeft = false;
this.isAutoRight = false;
this.isFixedLeft = false;
this.isFixedRight = false;
this.isFixed = false;
}
setAutoLeftWidth(autoLeft) {
this.renderer.setStyle(this.elementRef.nativeElement, 'left', autoLeft);
}
setAutoRightWidth(autoRight) {
this.renderer.setStyle(this.elementRef.nativeElement, 'right', autoRight);
}
setIsFirstRight(isFirstRight) {
this.setFixClass(isFirstRight, 'ant-table-cell-fix-right-first');
}
setIsLastLeft(isLastLeft) {
this.setFixClass(isLastLeft, 'ant-table-cell-fix-left-last');
}
setFixClass(flag, className) {
// the setFixClass function may call many times, so remove it first.
this.renderer.removeClass(this.elementRef.nativeElement, className);
if (flag) {
this.renderer.addClass(this.elementRef.nativeElement, className);
}
}
ngOnChanges() {
this.setIsFirstRight(false);
this.setIsLastLeft(false);
this.isAutoLeft = this.nzLeft === '' || this.nzLeft === true;
this.isAutoRight = this.nzRight === '' || this.nzRight === true;
this.isFixedLeft = this.nzLeft !== false;
this.isFixedRight = this.nzRight !== false;
this.isFixed = this.isFixedLeft || this.isFixedRight;
const validatePx = (value) => {
if (typeof value === 'string' && value !== '') {
return value;
}
else {
return null;
}
};
this.setAutoLeftWidth(validatePx(this.nzLeft));
this.setAutoRightWidth(validatePx(this.nzRight));
this.changes$.next();
}
}
NzCellFixedDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: NzCellFixedDirective, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
NzCellFixedDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.5", type: NzCellFixedDirective, selector: "td[nzRight],th[nzRight],td[nzLeft],th[nzLeft]", inputs: { nzRight: "nzRight", nzLeft: "nzLeft", colspan: "colspan", colSpan: "colSpan" }, host: { properties: { "class.ant-table-cell-fix-right": "isFixedRight", "class.ant-table-cell-fix-left": "isFixedLeft", "style.position": "isFixed? 'sticky' : null" } }, usesOnChanges: true, ngImport: i0 });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: NzCellFixedDirective, decorators: [{
type: Directive,
args: [{
selector: 'td[nzRight],th[nzRight],td[nzLeft],th[nzLeft]',
host: {
'[class.ant-table-cell-fix-right]': `isFixedRight`,
'[class.ant-table-cell-fix-left]': `isFixedLeft`,
'[style.position]': `isFixed? 'sticky' : null`
}
}]
}], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }]; }, propDecorators: { nzRight: [{
type: Input
}], nzLeft: [{
type: Input
}], colspan: [{
type: Input
}], colSpan: [{
type: Input
}] } });
/**
* 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
*/
class NzTableStyleService {
constructor() {
this.theadTemplate$ = new ReplaySubject(1);
this.hasFixLeft$ = new ReplaySubject(1);
this.hasFixRight$ = new ReplaySubject(1);
this.hostWidth$ = new ReplaySubject(1);
this.columnCount$ = new ReplaySubject(1);
this.showEmpty$ = new ReplaySubject(1);
this.noResult$ = new ReplaySubject(1);
this.listOfThWidthConfigPx$ = new BehaviorSubject([]);
this.tableWidthConfigPx$ = new BehaviorSubject([]);
this.manualWidthConfigPx$ = combineLatest([this.tableWidthConfigPx$, this.listOfThWidthConfigPx$]).pipe(map(([widthConfig, listOfWidth]) => (widthConfig.length ? widthConfig : listOfWidth)));
this.listOfAutoWidthPx$ = new ReplaySubject(1);
this.listOfListOfThWidthPx$ = merge(
/** init with manual width **/
this.manualWidthConfigPx$, combineLatest([this.listOfAutoWidthPx$, this.manualWidthConfigPx$]).pipe(map(([autoWidth, manualWidth]) => {
/** use autoWidth until column length match **/
if (autoWidth.length === manualWidth.length) {
return autoWidth.map((width, index) => {
if (width === '0px') {
return manualWidth[index] || null;
}
else {
return manualWidth[index] || width;
}
});
}
else {
return manualWidth;
}
})));
this.listOfMeasureColumn$ = new ReplaySubject(1);
this.listOfListOfThWidth$ = this.listOfAutoWidthPx$.pipe(map(list => list.map(width => parseInt(width, 10))));
this.enableAutoMeasure$ = new ReplaySubject(1);
}
setTheadTemplate(template) {
this.theadTemplate$.next(template);
}
setHasFixLeft(hasFixLeft) {
this.hasFixLeft$.next(hasFixLeft);
}
setHasFixRight(hasFixRight) {
this.hasFixRight$.next(hasFixRight);
}
setTableWidthConfig(widthConfig) {
this.tableWidthConfigPx$.next(widthConfig);
}
setListOfTh(listOfTh) {
let columnCount = 0;
listOfTh.forEach(th => {
columnCount += (th.colspan && +th.colspan) || (th.colSpan && +th.colSpan) || 1;
});
const listOfThPx = listOfTh.map(item => item.nzWidth);
this.columnCount$.next(columnCount);
this.listOfThWidthConfigPx$.next(listOfThPx);
}
setListOfMeasureColumn(listOfTh) {
const listOfKeys = [];
listOfTh.forEach(th => {
const length = (th.colspan && +th.colspan) || (th.colSpan && +th.colSpan) || 1;
for (let i = 0; i < length; i++) {
listOfKeys.push(`measure_key_${i}`);
}
});
this.listOfMeasureColumn$.next(listOfKeys);
}
setListOfAutoWidth(listOfAutoWidth) {
this.listOfAutoWidthPx$.next(listOfAutoWidth.map(width => `${width}px`));
}
setShowEmpty(showEmpty) {
this.showEmpty$.next(showEmpty);
}
setNoResult(noResult) {
this.noResult$.next(noResult);
}
setScroll(scrollX, scrollY) {
const enableAutoMeasure = !!(scrollX || scrollY);
if (!enableAutoMeasure) {
this.setListOfAutoWidth([]);
}
this.enableAutoMeasure$.next(enableAutoMeasure);
}
}
NzTableStyleService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: NzTableStyleService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
NzTableStyleService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: NzTableStyleService });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: NzTableStyleService, decorators: [{
type: Injectable
}], ctorParameters: function () { return []; } });
/**
* 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
*/
class NzTableCellDirective {
constructor(nzTableStyleService) {
this.isInsideTable = false;
this.isInsideTable = !!nzTableStyleService;
}
}
NzTableCellDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: NzTableCellDirective, deps: [{ token: NzTableStyleService, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
NzTableCellDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.5", type: NzTableCellDirective, selector: "th:not(.nz-disable-th):not([mat-cell]), td:not(.nz-disable-td):not([mat-cell])", host: { properties: { "class.ant-table-cell": "isInsideTable" } }, ngImport: i0 });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: NzTableCellDirective, decorators: [{
type: Directive,
args: [{
selector: 'th:not(.nz-disable-th):not([mat-cell]), td:not(.nz-disable-td):not([mat-cell])',
host: {
'[class.ant-table-cell]': 'isInsideTable'
}
}]
}], ctorParameters: function () { return [{ type: NzTableStyleService, decorators: [{
type: Optional
}] }]; } });
class NzTdAddOnComponent {
constructor() {
this.nzChecked = false;
this.nzDisabled = false;
this.nzIndeterminate = false;
this.nzIndentSize = 0;
this.nzShowExpand = false;
this.nzShowCheckbox = false;
this.nzExpand = false;
this.nzCheckedChange = new EventEmitter();
this.nzExpandChange = new EventEmitter();
this.isNzShowExpandChanged = false;
this.isNzShowCheckboxChanged = false;
}
onCheckedChange(checked) {
this.nzChecked = checked;
this.nzCheckedChange.emit(checked);
}
onExpandChange(expand) {
this.nzExpand = expand;
this.nzExpandChange.emit(expand);
}
ngOnChanges(changes) {
const isFirstChange = (value) => value && value.firstChange && value.currentValue !== undefined;
const { nzExpand, nzChecked, nzShowExpand, nzShowCheckbox } = changes;
if (nzShowExpand) {
this.isNzShowExpandChanged = true;
}
if (nzShowCheckbox) {
this.isNzShowCheckboxChanged = true;
}
if (isFirstChange(nzExpand) && !this.isNzShowExpandChanged) {
this.nzShowExpand = true;
}
if (isFirstChange(nzChecked) && !this.isNzShowCheckboxChanged) {
this.nzShowCheckbox = true;
}
}
}
NzTdAddOnComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: NzTdAddOnComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
NzTdAddOnComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.5", type: NzTdAddOnComponent, selector: "td[nzChecked], td[nzDisabled], td[nzIndeterminate], td[nzIndentSize], td[nzExpand], td[nzShowExpand], td[nzShowCheckbox]", inputs: { nzChecked: "nzChecked", nzDisabled: "nzDisabled", nzIndeterminate: "nzIndeterminate", nzIndentSize: "nzIndentSize", nzShowExpand: "nzShowExpand", nzShowCheckbox: "nzShowCheckbox", nzExpand: "nzExpand" }, outputs: { nzCheckedChange: "nzCheckedChange", nzExpandChange: "nzExpandChange" }, host: { properties: { "class.ant-table-cell-with-append": "nzShowExpand || nzIndentSize > 0", "class.ant-table-selection-column": "nzShowCheckbox" } }, usesOnChanges: true, ngImport: i0, template: `
<ng-container *ngIf="nzShowExpand || nzIndentSize > 0">
<nz-row-indent [indentSize]="nzIndentSize"></nz-row-indent>
<button
nz-row-expand-button
[expand]="nzExpand"
(expandChange)="onExpandChange($event)"
[spaceMode]="!nzShowExpand"
></button>
</ng-container>
<label
nz-checkbox
*ngIf="nzShowCheckbox"
[nzDisabled]="nzDisabled"
[ngModel]="nzChecked"
[nzIndeterminate]="nzIndeterminate"
(ngModelChange)="onCheckedChange($event)"
></label>
<ng-content></ng-content>
`, isInline: true, components: [{ type: i1$2.NzCheckboxComponent, selector: "[nz-checkbox]", inputs: ["nzValue", "nzAutoFocus", "nzDisabled", "nzIndeterminate", "nzChecked", "nzId"], outputs: ["nzCheckedChange"], exportAs: ["nzCheckbox"] }], directives: [{ type: i1$3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: NzRowIndentDirective, selector: "nz-row-indent", inputs: ["indentSize"] }, { type: NzRowExpandButtonDirective, selector: "button[nz-row-expand-button]", inputs: ["expand", "spaceMode"], outputs: ["expandChange"] }, { type: i11.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i11.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
__decorate([
InputBoolean()
], NzTdAddOnComponent.prototype, "nzShowExpand", void 0);
__decorate([
InputBoolean()
], NzTdAddOnComponent.prototype, "nzShowCheckbox", void 0);
__decorate([
InputBoolean()
], NzTdAddOnComponent.prototype, "nzExpand", void 0);
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: NzTdAddOnComponent, decorators: [{
type: Component,
args: [{
selector: 'td[nzChecked], td[nzDisabled], td[nzIndeterminate], td[nzIndentSize], td[nzExpand], td[nzShowExpand], td[nzShowCheckbox]',
changeDetection: ChangeDetectionStrategy.OnPush,
preserveWhitespaces: false,
encapsulation: ViewEncapsulation.None,
template: `
<ng-container *ngIf="nzShowExpand || nzIndentSize > 0">
<nz-row-indent [indentSize]="nzIndentSize"></nz-row-indent>
<button
nz-row-expand-button
[expand]="nzExpand"
(expandChange)="onExpandChange($event)"
[spaceMode]="!nzShowExpand"
></button>
</ng-container>
<label
nz-checkbox
*ngIf="nzShowCheckbox"
[nzDisabled]="nzDisabled"
[ngModel]="nzChecked"
[nzIndeterminate]="nzIndeterminate"
(ngModelChange)="onCheckedChange($event)"
></label>
<ng-content></ng-content>
`,
host: {
'[class.ant-table-cell-with-append]': `nzShowExpand || nzIndentSize > 0`,
'[class.ant-table-selection-column]': `nzShowCheckbox`
}
}]
}], propDecorators: { nzChecked: [{
type: Input
}], nzDisabled: [{
type: Input
}], nzIndeterminate: [{
type: Input
}], nzIndentSize: [{
type: Input
}], nzShowExpand: [{
type: Input
}], nzShowCheckbox: [{
type: Input
}], nzExpand: [{
type: Input
}], nzCheckedChange: [{
type: Output
}], nzExpandChange: [{
type: Output
}] } });
class NzThAddOnComponent {
constructor(host, cdr, ngZone, destroy$) {
this.host = host;
this.cdr = cdr;
this.ngZone = ngZone;
this.destroy$ = destroy$;
this.manualClickOrder$ = new Subject();
this.calcOperatorChange$ = new Subject();
this.nzFilterValue = null;
this.sortOrder = null;
this.sortDirections = ['ascend', 'descend', null];
this.sortOrderChange$ = 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];
}
}
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.ngZone.runOutsideAngular(() => fromEvent(this.host.nativeElement, 'click')
.pipe(filter(() => this.nzShowSort), takeUntil(this.destroy$))
.subscribe(() => {
const nextOrder = this.getNextSortDirection(this.sortDirections, this.sortOrder);
this.ngZone.run(() => {
this.setSortOrder(nextOrder);
this.manualClickOrder$.next(this);
});
}));
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(thi