ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
1,428 lines (1,417 loc) • 150 kB
JavaScript
import { Platform, PlatformModule } from '@angular/cdk/platform';
import { CdkVirtualScrollViewport, ScrollingModule } from '@angular/cdk/scrolling';
import { CommonModule } from '@angular/common';
import { EventEmitter, Component, ChangeDetectionStrategy, ViewEncapsulation, ChangeDetectorRef, Input, Output, Directive, Renderer2, ElementRef, Injectable, Optional, ViewChild, NgZone, TemplateRef, ContentChild, ContentChildren, ViewChildren, NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { NzButtonModule } from 'ng-zorro-antd/button';
import { NzCheckboxModule } from 'ng-zorro-antd/checkbox';
import { NzOutletModule } from 'ng-zorro-antd/core/outlet';
import { NzResizeObserver, NzResizeObserversModule } from 'ng-zorro-antd/core/resize-observers';
import { NzDropDownModule } from 'ng-zorro-antd/dropdown';
import { NzEmptyModule } from 'ng-zorro-antd/empty';
import { NzI18nService, NzI18nModule } from 'ng-zorro-antd/i18n';
import { NzIconModule } from 'ng-zorro-antd/icon';
import { NzMenuModule } from 'ng-zorro-antd/menu';
import { NzPaginationModule } from 'ng-zorro-antd/pagination';
import { NzRadioModule } from 'ng-zorro-antd/radio';
import { NzSpinModule } from 'ng-zorro-antd/spin';
import { __assign, __read, __decorate, __metadata, __spread, __values } from 'tslib';
import { Subject, ReplaySubject, BehaviorSubject, combineLatest, merge, fromEvent, EMPTY, of } from 'rxjs';
import { takeUntil, map, filter, startWith, delay, distinctUntilChanged, debounceTime, skip, switchMap, flatMap } from 'rxjs/operators';
import { InputBoolean, measureScrollbar } from 'ng-zorro-antd/core/util';
import { warnDeprecation } from 'ng-zorro-antd/core/logger';
import { NzResizeService } from 'ng-zorro-antd/core/services';
import { NzConfigService, WithConfig } from 'ng-zorro-antd/core/config';
/**
* @fileoverview added by tsickle
* Generated from: src/addon/filter-trigger.component.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var NzFilterTriggerComponent = /** @class */ (function () {
function NzFilterTriggerComponent(cdr) {
this.cdr = cdr;
this.nzActive = false;
this.nzVisible = false;
this.nzVisibleChange = new EventEmitter();
}
/**
* @param {?} visible
* @return {?}
*/
NzFilterTriggerComponent.prototype.onVisibleChange = /**
* @param {?} visible
* @return {?}
*/
function (visible) {
this.nzVisible = visible;
this.nzVisibleChange.next(visible);
};
/**
* @param {?} $event
* @return {?}
*/
NzFilterTriggerComponent.prototype.onFilterClick = /**
* @param {?} $event
* @return {?}
*/
function ($event) {
$event.stopPropagation();
};
/**
* @return {?}
*/
NzFilterTriggerComponent.prototype.hide = /**
* @return {?}
*/
function () {
this.nzVisible = false;
this.cdr.markForCheck();
};
/**
* @return {?}
*/
NzFilterTriggerComponent.prototype.show = /**
* @return {?}
*/
function () {
this.nzVisible = true;
this.cdr.markForCheck();
};
NzFilterTriggerComponent.decorators = [
{ type: Component, args: [{
selector: 'nz-filter-trigger',
exportAs: "nzFilterTrigger",
changeDetection: ChangeDetectionStrategy.OnPush,
preserveWhitespaces: false,
encapsulation: ViewEncapsulation.None,
template: "\n <span\n nz-dropdown\n class=\"ant-table-filter-trigger\"\n nzTrigger=\"click\"\n nzPlacement=\"bottomRight\"\n [nzClickHide]=\"false\"\n [nzDropdownMenu]=\"nzDropdownMenu\"\n [class.active]=\"nzActive\"\n [class.ant-table-filter-open]=\"nzVisible\"\n [nzVisible]=\"nzVisible\"\n (nzVisibleChange)=\"onVisibleChange($event)\"\n (click)=\"onFilterClick($event)\"\n >\n <ng-content></ng-content>\n </span>\n ",
host: {
'[class.ant-table-filter-trigger-container]': 'true',
'[class.ant-table-filter-trigger-container-open]': 'nzVisible'
}
}] }
];
/** @nocollapse */
NzFilterTriggerComponent.ctorParameters = function () { return [
{ type: ChangeDetectorRef }
]; };
NzFilterTriggerComponent.propDecorators = {
nzActive: [{ type: Input }],
nzDropdownMenu: [{ type: Input }],
nzVisible: [{ type: Input }],
nzVisibleChange: [{ type: Output }]
};
return NzFilterTriggerComponent;
}());
if (false) {
/** @type {?} */
NzFilterTriggerComponent.prototype.nzActive;
/** @type {?} */
NzFilterTriggerComponent.prototype.nzDropdownMenu;
/** @type {?} */
NzFilterTriggerComponent.prototype.nzVisible;
/** @type {?} */
NzFilterTriggerComponent.prototype.nzVisibleChange;
/**
* @type {?}
* @private
*/
NzFilterTriggerComponent.prototype.cdr;
}
/**
* @fileoverview added by tsickle
* Generated from: src/addon/filter.component.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @record
*/
function NzThItemInterface() { }
if (false) {
/** @type {?} */
NzThItemInterface.prototype.text;
/** @type {?} */
NzThItemInterface.prototype.value;
/** @type {?} */
NzThItemInterface.prototype.checked;
}
var NzTableFilterComponent = /** @class */ (function () {
function NzTableFilterComponent(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.locale = (/** @type {?} */ ({}));
this.isChanged = false;
this.isChecked = false;
this.isVisible = false;
this.listOfParsedFilter = [];
}
/**
* @param {?} _
* @param {?} item
* @return {?}
*/
NzTableFilterComponent.prototype.trackByValue = /**
* @param {?} _
* @param {?} item
* @return {?}
*/
function (_, item) {
return item.value;
};
/**
* @param {?} filter
* @return {?}
*/
NzTableFilterComponent.prototype.check = /**
* @param {?} filter
* @return {?}
*/
function (filter) {
this.isChanged = true;
if (this.filterMultiple) {
this.listOfParsedFilter = this.listOfParsedFilter.map((/**
* @param {?} item
* @return {?}
*/
function (item) {
if (item === filter) {
return __assign(__assign({}, item), { checked: !filter.checked });
}
else {
return item;
}
}));
filter.checked = !filter.checked;
}
else {
this.listOfParsedFilter = this.listOfParsedFilter.map((/**
* @param {?} item
* @return {?}
*/
function (item) {
return __assign(__assign({}, item), { checked: item === filter });
}));
}
this.isChecked = this.getCheckedStatus(this.listOfParsedFilter);
};
/**
* @return {?}
*/
NzTableFilterComponent.prototype.confirm = /**
* @return {?}
*/
function () {
this.isVisible = false;
this.emitFilterData();
};
/**
* @return {?}
*/
NzTableFilterComponent.prototype.reset = /**
* @return {?}
*/
function () {
this.isChanged = true;
this.isVisible = false;
this.listOfParsedFilter = this.parseListOfFilter(this.listOfFilter, true);
this.isChecked = this.getCheckedStatus(this.listOfParsedFilter);
this.emitFilterData();
};
/**
* @param {?} value
* @return {?}
*/
NzTableFilterComponent.prototype.onVisibleChange = /**
* @param {?} value
* @return {?}
*/
function (value) {
this.isVisible = value;
if (!value) {
this.emitFilterData();
}
};
/**
* @return {?}
*/
NzTableFilterComponent.prototype.emitFilterData = /**
* @return {?}
*/
function () {
if (this.isChanged) {
/** @type {?} */
var listOfChecked = this.listOfParsedFilter.filter((/**
* @param {?} item
* @return {?}
*/
function (item) { return item.checked; })).map((/**
* @param {?} item
* @return {?}
*/
function (item) { return item.value; }));
if (this.filterMultiple) {
this.filterChange.emit(listOfChecked);
}
else {
this.filterChange.emit(listOfChecked[0] || null);
}
this.isChanged = false;
}
};
/**
* @param {?} listOfFilter
* @param {?=} reset
* @return {?}
*/
NzTableFilterComponent.prototype.parseListOfFilter = /**
* @param {?} listOfFilter
* @param {?=} reset
* @return {?}
*/
function (listOfFilter, reset) {
return listOfFilter.map((/**
* @param {?} item
* @return {?}
*/
function (item) {
/** @type {?} */
var checked = reset ? false : !!item.byDefault;
return { text: item.text, value: item.value, checked: checked };
}));
};
/**
* @param {?} listOfParsedFilter
* @return {?}
*/
NzTableFilterComponent.prototype.getCheckedStatus = /**
* @param {?} listOfParsedFilter
* @return {?}
*/
function (listOfParsedFilter) {
return listOfParsedFilter.some((/**
* @param {?} item
* @return {?}
*/
function (item) { return item.checked; }));
};
/**
* @return {?}
*/
NzTableFilterComponent.prototype.ngOnInit = /**
* @return {?}
*/
function () {
var _this = this;
this.i18n.localeChange.pipe(takeUntil(this.destroy$)).subscribe((/**
* @return {?}
*/
function () {
_this.locale = _this.i18n.getLocaleData('Table');
_this.cdr.markForCheck();
}));
};
/**
* @param {?} changes
* @return {?}
*/
NzTableFilterComponent.prototype.ngOnChanges = /**
* @param {?} changes
* @return {?}
*/
function (changes) {
var listOfFilter = changes.listOfFilter;
if (listOfFilter && this.listOfFilter && this.listOfFilter.length) {
this.listOfParsedFilter = this.parseListOfFilter(this.listOfFilter);
this.isChecked = this.getCheckedStatus(this.listOfParsedFilter);
}
};
/**
* @return {?}
*/
NzTableFilterComponent.prototype.ngOnDestroy = /**
* @return {?}
*/
function () {
this.destroy$.next();
this.destroy$.complete();
};
NzTableFilterComponent.decorators = [
{ type: Component, args: [{
selector: 'nz-table-filter',
preserveWhitespaces: false,
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
template: "\n <span class=\"ant-table-filter-column-title\">\n <ng-template [ngTemplateOutlet]=\"contentTemplate\"></ng-template>\n </span>\n <ng-container *ngIf=\"!customFilter; else extraTemplate\">\n <nz-filter-trigger\n [nzVisible]=\"isVisible\"\n [nzActive]=\"isChecked\"\n [nzDropdownMenu]=\"filterMenu\"\n (nzVisibleChange)=\"onVisibleChange($event)\"\n >\n <i nz-icon nzType=\"filter\" nzTheme=\"fill\"></i>\n </nz-filter-trigger>\n <nz-dropdown-menu #filterMenu=\"nzDropdownMenu\">\n <div class=\"ant-table-filter-dropdown\">\n <ul nz-menu>\n <li nz-menu-item [nzSelected]=\"f.checked\" *ngFor=\"let f of listOfParsedFilter; trackBy: trackByValue\" (click)=\"check(f)\">\n <label nz-radio *ngIf=\"!filterMultiple\" [ngModel]=\"f.checked\" (ngModelChange)=\"check(f)\"></label>\n <label nz-checkbox *ngIf=\"filterMultiple\" [ngModel]=\"f.checked\" (ngModelChange)=\"check(f)\"></label>\n <span>{{ f.text }}</span>\n </li>\n </ul>\n <div class=\"ant-table-filter-dropdown-btns\">\n <button nz-button nzType=\"link\" nzSize=\"small\" (click)=\"reset()\" [disabled]=\"!isChecked\">{{ locale.filterReset }}</button>\n <button nz-button nzType=\"primary\" nzSize=\"small\" (click)=\"confirm()\">{{ locale.filterConfirm }}</button>\n </div>\n </div>\n </nz-dropdown-menu>\n </ng-container>\n ",
host: {
'[class.ant-table-filter-column]': 'true'
}
}] }
];
/** @nocollapse */
NzTableFilterComponent.ctorParameters = function () { return [
{ type: ChangeDetectorRef },
{ type: NzI18nService }
]; };
NzTableFilterComponent.propDecorators = {
contentTemplate: [{ type: Input }],
customFilter: [{ type: Input }],
extraTemplate: [{ type: Input }],
filterMultiple: [{ type: Input }],
listOfFilter: [{ type: Input }],
filterChange: [{ type: Output }]
};
return NzTableFilterComponent;
}());
if (false) {
/** @type {?} */
NzTableFilterComponent.prototype.contentTemplate;
/** @type {?} */
NzTableFilterComponent.prototype.customFilter;
/** @type {?} */
NzTableFilterComponent.prototype.extraTemplate;
/** @type {?} */
NzTableFilterComponent.prototype.filterMultiple;
/** @type {?} */
NzTableFilterComponent.prototype.listOfFilter;
/** @type {?} */
NzTableFilterComponent.prototype.filterChange;
/**
* @type {?}
* @private
*/
NzTableFilterComponent.prototype.destroy$;
/** @type {?} */
NzTableFilterComponent.prototype.locale;
/** @type {?} */
NzTableFilterComponent.prototype.isChanged;
/** @type {?} */
NzTableFilterComponent.prototype.isChecked;
/** @type {?} */
NzTableFilterComponent.prototype.isVisible;
/** @type {?} */
NzTableFilterComponent.prototype.listOfParsedFilter;
/**
* @type {?}
* @private
*/
NzTableFilterComponent.prototype.cdr;
/**
* @type {?}
* @private
*/
NzTableFilterComponent.prototype.i18n;
}
/**
* @fileoverview added by tsickle
* Generated from: src/addon/row-expand-button.directive.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var NzRowExpandButtonDirective = /** @class */ (function () {
function NzRowExpandButtonDirective() {
this.expand = false;
this.spaceMode = false;
this.expandChange = new EventEmitter();
}
/**
* @return {?}
*/
NzRowExpandButtonDirective.prototype.onHostClick = /**
* @return {?}
*/
function () {
if (!this.spaceMode) {
this.expand = !this.expand;
this.expandChange.next(this.expand);
}
};
NzRowExpandButtonDirective.decorators = [
{ type: Directive, args: [{
selector: 'button[nz-row-expand-button]',
host: {
'[type]': "'button'",
'[class.ant-table-row-expand-icon]': 'true',
'[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()'
}
},] }
];
NzRowExpandButtonDirective.propDecorators = {
expand: [{ type: Input }],
spaceMode: [{ type: Input }],
expandChange: [{ type: Output }]
};
return NzRowExpandButtonDirective;
}());
if (false) {
/** @type {?} */
NzRowExpandButtonDirective.prototype.expand;
/** @type {?} */
NzRowExpandButtonDirective.prototype.spaceMode;
/** @type {?} */
NzRowExpandButtonDirective.prototype.expandChange;
}
/**
* @fileoverview added by tsickle
* Generated from: src/addon/row-indent.directive.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var NzRowIndentDirective = /** @class */ (function () {
function NzRowIndentDirective() {
this.indentSize = 0;
}
NzRowIndentDirective.decorators = [
{ type: Directive, args: [{
selector: 'nz-row-indent',
host: {
'[class.ant-table-row-indent]': 'true',
'[style.padding-left.px]': 'indentSize'
}
},] }
];
NzRowIndentDirective.propDecorators = {
indentSize: [{ type: Input }]
};
return NzRowIndentDirective;
}());
if (false) {
/** @type {?} */
NzRowIndentDirective.prototype.indentSize;
}
/**
* @fileoverview added by tsickle
* Generated from: src/addon/selection.component.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var NzTableSelectionComponent = /** @class */ (function () {
function NzTableSelectionComponent() {
this.listOfSelections = [];
this.checked = false;
this.disabled = false;
this.indeterminate = false;
this.showCheckbox = false;
this.showRowSelection = false;
this.checkedChange = new EventEmitter();
}
/**
* @param {?} checked
* @return {?}
*/
NzTableSelectionComponent.prototype.onCheckedChange = /**
* @param {?} checked
* @return {?}
*/
function (checked) {
this.checked = checked;
this.checkedChange.emit(checked);
};
NzTableSelectionComponent.decorators = [
{ type: Component, args: [{
selector: 'nz-table-selection',
preserveWhitespaces: false,
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
template: "\n <label\n *ngIf=\"showCheckbox\"\n nz-checkbox\n [class.ant-table-selection-select-all-custom]=\"showRowSelection\"\n [ngModel]=\"checked\"\n [nzDisabled]=\"disabled\"\n [nzIndeterminate]=\"indeterminate\"\n (ngModelChange)=\"onCheckedChange($event)\"\n >\n </label>\n <div class=\"ant-table-selection-extra\" *ngIf=\"showRowSelection\">\n <span nz-dropdown class=\"ant-table-selection-down\" nzPlacement=\"bottomLeft\" [nzDropdownMenu]=\"selectionMenu\">\n <i nz-icon nzType=\"down\"></i>\n </span>\n <nz-dropdown-menu #selectionMenu=\"nzDropdownMenu\">\n <ul nz-menu class=\"ant-table-selection-menu\">\n <li nz-menu-item *ngFor=\"let selection of listOfSelections\" (click)=\"selection.onSelect()\">\n {{ selection.text }}\n </li>\n </ul>\n </nz-dropdown-menu>\n </div>\n ",
host: {
'[class.ant-table-selection]': 'true'
}
}] }
];
NzTableSelectionComponent.propDecorators = {
listOfSelections: [{ type: Input }],
checked: [{ type: Input }],
disabled: [{ type: Input }],
indeterminate: [{ type: Input }],
showCheckbox: [{ type: Input }],
showRowSelection: [{ type: Input }],
checkedChange: [{ type: Output }]
};
return NzTableSelectionComponent;
}());
if (false) {
/** @type {?} */
NzTableSelectionComponent.prototype.listOfSelections;
/** @type {?} */
NzTableSelectionComponent.prototype.checked;
/** @type {?} */
NzTableSelectionComponent.prototype.disabled;
/** @type {?} */
NzTableSelectionComponent.prototype.indeterminate;
/** @type {?} */
NzTableSelectionComponent.prototype.showCheckbox;
/** @type {?} */
NzTableSelectionComponent.prototype.showRowSelection;
/** @type {?} */
NzTableSelectionComponent.prototype.checkedChange;
}
/**
* @fileoverview added by tsickle
* Generated from: src/addon/sorters.component.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var NzTableSortersComponent = /** @class */ (function () {
function NzTableSortersComponent() {
this.sortDirections = ['ascend', 'descend', null];
this.sortOrder = null;
this.contentTemplate = null;
this.isUp = false;
this.isDown = false;
}
/**
* @param {?} changes
* @return {?}
*/
NzTableSortersComponent.prototype.ngOnChanges = /**
* @param {?} changes
* @return {?}
*/
function (changes) {
var sortDirections = changes.sortDirections;
if (sortDirections) {
this.isUp = this.sortDirections.indexOf('ascend') !== -1;
this.isDown = this.sortDirections.indexOf('descend') !== -1;
}
};
NzTableSortersComponent.decorators = [
{ type: Component, args: [{
selector: 'nz-table-sorters',
preserveWhitespaces: false,
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
template: "\n <span><ng-template [ngTemplateOutlet]=\"contentTemplate\"></ng-template></span>\n <span class=\"ant-table-column-sorter\" [class.ant-table-column-sorter-full]=\"isDown && isUp\">\n <span class=\"ant-table-column-sorter-inner\">\n <i nz-icon nzType=\"caret-up\" *ngIf=\"isUp\" class=\"ant-table-column-sorter-up\" [class.active]=\"sortOrder == 'ascend'\"></i>\n <i nz-icon nzType=\"caret-down\" *ngIf=\"isDown\" class=\"ant-table-column-sorter-down\" [class.active]=\"sortOrder == 'descend'\"></i>\n </span>\n </span>\n ",
host: {
'[class.ant-table-column-sorters]': 'true'
}
}] }
];
NzTableSortersComponent.propDecorators = {
sortDirections: [{ type: Input }],
sortOrder: [{ type: Input }],
contentTemplate: [{ type: Input }]
};
return NzTableSortersComponent;
}());
if (false) {
/** @type {?} */
NzTableSortersComponent.prototype.sortDirections;
/** @type {?} */
NzTableSortersComponent.prototype.sortOrder;
/** @type {?} */
NzTableSortersComponent.prototype.contentTemplate;
/** @type {?} */
NzTableSortersComponent.prototype.isUp;
/** @type {?} */
NzTableSortersComponent.prototype.isDown;
}
/**
* @fileoverview added by tsickle
* Generated from: src/cell/cell-fixed.directive.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var NzCellFixedDirective = /** @class */ (function () {
function NzCellFixedDirective(cdr, renderer, elementRef) {
this.cdr = cdr;
this.renderer = renderer;
this.elementRef = elementRef;
this.nzRight = false;
this.nzLeft = false;
this.colspan = null;
this.changes$ = new Subject();
this.isFirstRight = false;
this.isLastLeft = false;
this.isAutoLeft = false;
this.isAutoRight = false;
this.isFixedLeft = false;
this.isFixedRight = false;
this.isFixed = false;
}
/**
* @param {?} isRightFirst
* @return {?}
*/
NzCellFixedDirective.prototype.setIsFirstRight = /**
* @param {?} isRightFirst
* @return {?}
*/
function (isRightFirst) {
this.isFirstRight = isRightFirst;
this.cdr.markForCheck();
};
/**
* @param {?} isLeftLast
* @return {?}
*/
NzCellFixedDirective.prototype.setIsLastLeft = /**
* @param {?} isLeftLast
* @return {?}
*/
function (isLeftLast) {
this.isLastLeft = isLeftLast;
this.cdr.markForCheck();
};
/**
* @param {?} autoLeft
* @return {?}
*/
NzCellFixedDirective.prototype.setAutoLeftWidth = /**
* @param {?} autoLeft
* @return {?}
*/
function (autoLeft) {
this.renderer.setStyle(this.elementRef.nativeElement, 'left', autoLeft);
};
/**
* @param {?} autoRight
* @return {?}
*/
NzCellFixedDirective.prototype.setAutoRightWidth = /**
* @param {?} autoRight
* @return {?}
*/
function (autoRight) {
this.renderer.setStyle(this.elementRef.nativeElement, 'right', autoRight);
};
/**
* @return {?}
*/
NzCellFixedDirective.prototype.ngOnChanges = /**
* @return {?}
*/
function () {
this.isFirstRight = false;
this.isLastLeft = 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;
/** @type {?} */
var validatePx = (/**
* @param {?} value
* @return {?}
*/
function (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.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",
'[class.ant-table-cell-fix-right-first]': "isFirstRight",
'[class.ant-table-cell-fix-left-last]': "isLastLeft",
'[style.position]': "isFixed? 'sticky' : null"
}
},] }
];
/** @nocollapse */
NzCellFixedDirective.ctorParameters = function () { return [
{ type: ChangeDetectorRef },
{ type: Renderer2 },
{ type: ElementRef }
]; };
NzCellFixedDirective.propDecorators = {
nzRight: [{ type: Input }],
nzLeft: [{ type: Input }],
colspan: [{ type: Input }]
};
return NzCellFixedDirective;
}());
if (false) {
/** @type {?} */
NzCellFixedDirective.prototype.nzRight;
/** @type {?} */
NzCellFixedDirective.prototype.nzLeft;
/** @type {?} */
NzCellFixedDirective.prototype.colspan;
/** @type {?} */
NzCellFixedDirective.prototype.changes$;
/** @type {?} */
NzCellFixedDirective.prototype.isFirstRight;
/** @type {?} */
NzCellFixedDirective.prototype.isLastLeft;
/** @type {?} */
NzCellFixedDirective.prototype.isAutoLeft;
/** @type {?} */
NzCellFixedDirective.prototype.isAutoRight;
/** @type {?} */
NzCellFixedDirective.prototype.isFixedLeft;
/** @type {?} */
NzCellFixedDirective.prototype.isFixedRight;
/** @type {?} */
NzCellFixedDirective.prototype.isFixed;
/**
* @type {?}
* @private
*/
NzCellFixedDirective.prototype.cdr;
/**
* @type {?}
* @private
*/
NzCellFixedDirective.prototype.renderer;
/**
* @type {?}
* @private
*/
NzCellFixedDirective.prototype.elementRef;
}
/**
* @fileoverview added by tsickle
* Generated from: src/table-style.service.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var NzTableStyleService = /** @class */ (function () {
function NzTableStyleService() {
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((/**
* @param {?} __0
* @return {?}
*/
function (_a) {
var _b = __read(_a, 2), widthConfig = _b[0], listOfWidth = _b[1];
return (widthConfig.length ? widthConfig : listOfWidth);
})));
this.listOfAutoWidthPx$ = new ReplaySubject(1);
this.listOfListOfThWidthPx$ = merge(this.manualWidthConfigPx$, combineLatest([this.listOfAutoWidthPx$, this.manualWidthConfigPx$]).pipe(map((/**
* @param {?} __0
* @return {?}
*/
function (_a) {
var _b = __read(_a, 2), autoWidth = _b[0], manualWidth = _b[1];
/** use autoWidth until column length match **/
return autoWidth.length !== manualWidth.length ? manualWidth : autoWidth;
}))));
this.listOfMeasureColumn$ = new ReplaySubject(1);
this.listOfListOfThWidth$ = this.listOfAutoWidthPx$.pipe(map((/**
* @param {?} list
* @return {?}
*/
function (list) { return list.map((/**
* @param {?} width
* @return {?}
*/
function (width) { return parseInt(width, 10); })); })));
this.enableAutoMeasure$ = new ReplaySubject(1);
}
/**
* @param {?} template
* @return {?}
*/
NzTableStyleService.prototype.setTheadTemplate = /**
* @param {?} template
* @return {?}
*/
function (template) {
this.theadTemplate$.next(template);
};
/**
* @param {?} hasFixLeft
* @return {?}
*/
NzTableStyleService.prototype.setHasFixLeft = /**
* @param {?} hasFixLeft
* @return {?}
*/
function (hasFixLeft) {
this.hasFixLeft$.next(hasFixLeft);
};
/**
* @param {?} hasFixRight
* @return {?}
*/
NzTableStyleService.prototype.setHasFixRight = /**
* @param {?} hasFixRight
* @return {?}
*/
function (hasFixRight) {
this.hasFixRight$.next(hasFixRight);
};
/**
* @param {?} widthConfig
* @return {?}
*/
NzTableStyleService.prototype.setTableWidthConfig = /**
* @param {?} widthConfig
* @return {?}
*/
function (widthConfig) {
this.tableWidthConfigPx$.next(widthConfig);
};
/**
* @param {?} listOfTh
* @return {?}
*/
NzTableStyleService.prototype.setListOfTh = /**
* @param {?} listOfTh
* @return {?}
*/
function (listOfTh) {
/** @type {?} */
var columnCount = 0;
listOfTh.forEach((/**
* @param {?} th
* @return {?}
*/
function (th) {
columnCount += th.colspan || 1;
}));
/** @type {?} */
var listOfThPx = listOfTh.map((/**
* @param {?} item
* @return {?}
*/
function (item) { return item.nzWidth; }));
this.columnCount$.next(columnCount);
this.listOfThWidthConfigPx$.next(listOfThPx);
};
/**
* @param {?} listOfTh
* @return {?}
*/
NzTableStyleService.prototype.setListOfMeasureColumn = /**
* @param {?} listOfTh
* @return {?}
*/
function (listOfTh) {
/** @type {?} */
var listOfKeys = [];
listOfTh.forEach((/**
* @param {?} th
* @return {?}
*/
function (th) {
/** @type {?} */
var length = th.colspan || 1;
for (var i = 0; i < length; i++) {
listOfKeys.push("measure_key_" + i);
}
}));
this.listOfMeasureColumn$.next(listOfKeys);
};
/**
* @param {?} listOfAutoWidth
* @return {?}
*/
NzTableStyleService.prototype.setListOfAutoWidth = /**
* @param {?} listOfAutoWidth
* @return {?}
*/
function (listOfAutoWidth) {
this.listOfAutoWidthPx$.next(listOfAutoWidth.map((/**
* @param {?} width
* @return {?}
*/
function (width) { return width + "px"; })));
};
/**
* @param {?} showEmpty
* @return {?}
*/
NzTableStyleService.prototype.setShowEmpty = /**
* @param {?} showEmpty
* @return {?}
*/
function (showEmpty) {
this.showEmpty$.next(showEmpty);
};
/**
* @param {?} noResult
* @return {?}
*/
NzTableStyleService.prototype.setNoResult = /**
* @param {?} noResult
* @return {?}
*/
function (noResult) {
this.noResult$.next(noResult);
};
/**
* @param {?} scrollX
* @param {?} scrollY
* @return {?}
*/
NzTableStyleService.prototype.setScroll = /**
* @param {?} scrollX
* @param {?} scrollY
* @return {?}
*/
function (scrollX, scrollY) {
/** @type {?} */
var enableAutoMeasure = !!(scrollX || scrollY);
if (!enableAutoMeasure) {
this.setListOfAutoWidth([]);
}
this.enableAutoMeasure$.next(enableAutoMeasure);
};
NzTableStyleService.decorators = [
{ type: Injectable }
];
/** @nocollapse */
NzTableStyleService.ctorParameters = function () { return []; };
return NzTableStyleService;
}());
if (false) {
/** @type {?} */
NzTableStyleService.prototype.theadTemplate$;
/** @type {?} */
NzTableStyleService.prototype.hasFixLeft$;
/** @type {?} */
NzTableStyleService.prototype.hasFixRight$;
/** @type {?} */
NzTableStyleService.prototype.hostWidth$;
/** @type {?} */
NzTableStyleService.prototype.columnCount$;
/** @type {?} */
NzTableStyleService.prototype.showEmpty$;
/** @type {?} */
NzTableStyleService.prototype.noResult$;
/**
* @type {?}
* @private
*/
NzTableStyleService.prototype.listOfThWidthConfigPx$;
/**
* @type {?}
* @private
*/
NzTableStyleService.prototype.tableWidthConfigPx$;
/**
* @type {?}
* @private
*/
NzTableStyleService.prototype.manualWidthConfigPx$;
/**
* @type {?}
* @private
*/
NzTableStyleService.prototype.listOfAutoWidthPx$;
/** @type {?} */
NzTableStyleService.prototype.listOfListOfThWidthPx$;
/** @type {?} */
NzTableStyleService.prototype.listOfMeasureColumn$;
/** @type {?} */
NzTableStyleService.prototype.listOfListOfThWidth$;
/** @type {?} */
NzTableStyleService.prototype.enableAutoMeasure$;
}
/**
* @fileoverview added by tsickle
* Generated from: src/cell/cell.directive.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var NzTableCellDirective = /** @class */ (function () {
function NzTableCellDirective(nzTableStyleService) {
this.isInsideTable = false;
this.isInsideTable = !!nzTableStyleService;
}
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'
}
},] }
];
/** @nocollapse */
NzTableCellDirective.ctorParameters = function () { return [
{ type: NzTableStyleService, decorators: [{ type: Optional }] }
]; };
return NzTableCellDirective;
}());
if (false) {
/** @type {?} */
NzTableCellDirective.prototype.isInsideTable;
}
/**
* @fileoverview added by tsickle
* Generated from: src/cell/td-addon.component.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var NzTdAddOnComponent = /** @class */ (function () {
function NzTdAddOnComponent() {
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;
}
/**
* @param {?} checked
* @return {?}
*/
NzTdAddOnComponent.prototype.onCheckedChange = /**
* @param {?} checked
* @return {?}
*/
function (checked) {
this.nzChecked = checked;
this.nzCheckedChange.emit(checked);
};
/**
* @param {?} expand
* @return {?}
*/
NzTdAddOnComponent.prototype.onExpandChange = /**
* @param {?} expand
* @return {?}
*/
function (expand) {
this.nzExpand = expand;
this.nzExpandChange.emit(expand);
};
/**
* @param {?} changes
* @return {?}
*/
NzTdAddOnComponent.prototype.ngOnChanges = /**
* @param {?} changes
* @return {?}
*/
function (changes) {
/** @type {?} */
var isFirstChange = (/**
* @param {?} value
* @return {?}
*/
function (value) { return value && value.firstChange && value.currentValue !== undefined; });
var nzExpand = changes.nzExpand, nzChecked = changes.nzChecked, nzShowExpand = changes.nzShowExpand, nzShowCheckbox = changes.nzShowCheckbox;
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.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: "\n <ng-container *ngIf=\"nzShowExpand || nzIndentSize > 0\">\n <nz-row-indent [indentSize]=\"nzIndentSize\"></nz-row-indent>\n <button nz-row-expand-button [expand]=\"nzExpand\" (expandChange)=\"onExpandChange($event)\" [spaceMode]=\"!nzShowExpand\"></button>\n </ng-container>\n <label\n nz-checkbox\n *ngIf=\"nzShowCheckbox\"\n [nzDisabled]=\"nzDisabled\"\n [ngModel]=\"nzChecked\"\n [nzIndeterminate]=\"nzIndeterminate\"\n (ngModelChange)=\"onCheckedChange($event)\"\n >\n </label>\n <ng-content></ng-content>\n ",
host: {
'[class.ant-table-cell-with-append]': "nzShowExpand || nzIndentSize > 0",
'[class.ant-table-selection-column]': "nzShowCheckbox"
}
}] }
];
NzTdAddOnComponent.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 }]
};
__decorate([
InputBoolean(),
__metadata("design:type", Object)
], NzTdAddOnComponent.prototype, "nzShowExpand", void 0);
__decorate([
InputBoolean(),
__metadata("design:type", Object)
], NzTdAddOnComponent.prototype, "nzShowCheckbox", void 0);
__decorate([
InputBoolean(),
__metadata("design:type", Object)
], NzTdAddOnComponent.prototype, "nzExpand", void 0);
return NzTdAddOnComponent;
}());
if (false) {
/** @type {?} */
NzTdAddOnComponent.ngAcceptInputType_nzShowExpand;
/** @type {?} */
NzTdAddOnComponent.ngAcceptInputType_nzShowCheckbox;
/** @type {?} */
NzTdAddOnComponent.ngAcceptInputType_nzExpand;
/** @type {?} */
NzTdAddOnComponent.prototype.nzChecked;
/** @type {?} */
NzTdAddOnComponent.prototype.nzDisabled;
/** @type {?} */
NzTdAddOnComponent.prototype.nzIndeterminate;
/** @type {?} */
NzTdAddOnComponent.prototype.nzIndentSize;
/** @type {?} */
NzTdAddOnComponent.prototype.nzShowExpand;
/** @type {?} */
NzTdAddOnComponent.prototype.nzShowCheckbox;
/** @type {?} */
NzTdAddOnComponent.prototype.nzExpand;
/** @type {?} */
NzTdAddOnComponent.prototype.nzCheckedChange;
/** @type {?} */
NzTdAddOnComponent.prototype.nzExpandChange;
/**
* @type {?}
* @private
*/
NzTdAddOnComponent.prototype.isNzShowExpandChanged;
/**
* @type {?}
* @private
*/
NzTdAddOnComponent.prototype.isNzShowCheckboxChanged;
}
/**
* @fileoverview added by tsickle
* Generated from: src/cell/th-addon.component.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var NzThAddOnComponent = /** @class */ (function () {
function NzThAddOnComponent(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();
/**
* @deprecated use nzSortOrder instead *
*/
this.nzSort = null;
/**
* @deprecated use nzSortOrderChange instead *
*/
this.nzSortChange = new EventEmitter();
}
/**
* @param {?} sortDirections
* @param {?} current
* @return {?}
*/
NzThAddOnComponent.prototype.getNextSortDirection = /**
* @param {?} sortDirections
* @param {?} current
* @return {?}
*/
function (sortDirections, current) {
/** @type {?} */
var index = sortDirections.indexOf(current);
if (index === sortDirections.length - 1) {
return sortDirections[0];
}
else {
return sortDirections[index + 1];
}
};
/**
* @return {?}
*/
NzThAddOnComponent.prototype.emitNextSortValue = /**
* @return {?}
*/
function () {
if (this.nzShowSort) {
/** @type {?} */
var nextOrder = this.getNextSortDirection(this.sortDirections, (/** @type {?} */ (this.sortOrder)));
this.setSortOrder(nextOrder);
this.manualClickOrder$.next(this);
}
};
/**
* @param {?} order
* @return {?}
*/
NzThAddOnComponent.prototype.setSortOrder = /**
* @param {?} order
* @return {?}
*/
function (order) {
this.sortOrderChange$.next(order);
};
/**
* @return {?}
*/
NzThAddOnComponent.prototype.clearSortOrder = /**
* @return {?}
*/
function () {
if (this.sortOrder !== null) {
this.setSortOrder(null);
}
};
/**
* @param {?} value
* @return {?}
*/
NzThAddOnComponent.prototype.onFilterValueChange = /**
* @param {?} value
* @return {?}
*/
function (value) {
this.nzFilterChange.emit(value);
this.nzFilterValue = value;
this.updateCalcOperator();
};
/**
* @return {?}
*/
NzThAddOnComponent.prototype.updateCalcOperator = /**
* @return {?}
*/
function () {
this.calcOperatorChange$.next();
};
/**
* @return {?}
*/
NzThAddOnComponent.prototype.ngOnInit = /**
* @return {?}
*/
function () {
var _this = this;
this.sortOrderChange$.pipe(takeUntil(this.destroy$)).subscribe((/**
* @param {?} order
* @return {?}
*/
function (order) {
if (_this.sortOrder !== order) {
_this.sortOrder = order;
_this.nzSortChange.emit(order);
_this.nzSortOrderChange.emit(order);
}
_this.updateCalcOperator();
_this.cdr.markForCheck();
}));
};
/**
* @param {?} changes
* @return {?}
*/
NzThAddOnComponent.prototype.ngOnChanges = /**
* @param {?} changes
* @return {?}
*/
function (changes) {
var nzSortKey = changes.nzSortKey, nzSort = changes.nzSort, nzSortDirections = changes.nzSortDirections, nzFilters = changes.nzFilters, nzSortOrder = changes.nzSortOrder, nzSortFn = changes.nzSortFn, nzFilterFn = changes.nzFilterFn, nzSortPriority = changes.nzSortPriority, nzFilterMultiple = changes.nzFilterMultiple, nzShowSort = changes.nzShowSort, nzShowFilter = changes.nzShowFilter;
if (nzSortDirections) {
if (this.nzSortDirections && this.nzSortDirections.length) {
this.sortDirections = this.nzSortDirections;
}
}
if (nzSort) {
this.sortOrder = this.nzSort;
this.setSortOrder(this.nzSort);
warnDeprecation("'nzSort' and 'nzSortChange' is deprecated and will be removed in 10.0.0. Please use 'nzSortOrder' and 'nzSortOrderChange' instead.");
}
if (nzSortKey) {
this.nzColumnKey = this.nzSortKey;
warnDeprecation("'nzSortKey' is deprecated and will be removed in 10.0.0. Please use 'nzColumnKey' instead.");
}
if (nzSortOrder) {
this.sortOrder = this.nzSortOrder;
this.setSortOrder(this.nzSortOrder);
}
if (nzShowSort) {
this.isNzShowSortChanged = true;
}
if (nzShowFilter) {
this.isNzShowFilterChanged = true;
}
/** @type {?} */
var isFirstChange = (/**
* @param {?} value
* @return {?}
*/
function (value) { return value && value.firstChange && value.currentValue !== undefined; });
if ((isFirstChange(nzSortKey) || isFirstChange(nzSort) || isFirstChange(nzSortOrder) || isFirstChange(nzSortFn)) &&
!this.isNzShowSortChanged) {
this.nzShowSort = true;
}
if (isFirstChange(nzFilters) && !this.isNzShowFilterChanged) {
this.nzShowFilter = true;
}
if ((nzFilters || nzFilterMultiple) && this.nzShowFilter) {
/** @type {?} */
var listOfValue = this.nzFilters.filter((/**
* @param {?} item
* @return {?}
*/
function (item) { return item.byDefault; })).map((/**
* @param {?} item
* @return {?}
*/
function (item) { return item.value; }));
this.nzFilterValue = this.nzFilterMultiple ? listOfValue : listOfValue[0] || null;
}
if (nzSortFn || nzFilterFn || nzSortPriority || nzFilters) {
this.updateCalcOperator();
}
};
/**
* @return {?}
*/
NzThAddOnComponent.prototype.ngOnDestroy = /**
* @return {?}
*/
function () {
this.destroy$.next();
this.destroy$.complete();
};
NzThAddOnComponent.decorators = [
{ type: Component, args: [{
selector: 'th[nzSortKey], th[nzColumnKey], th[nzSort], th[nzSortFn], th[nzSortOrder], th[nzFilters], th[nzShowSort], th[nzShowFilter], th[nzCustomFilter]',
preserveWhitespaces: false,
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
template: "\n <nz-table-filter\n *ngIf=\"nzShowFilter || nzCustomFilter; else notFilterTemplate\"\n [contentTemplate]=\"notFilterTemplate\"\n [extraTemplate]=\"extraTemplate\"\n [customFilter]=\"nzCustomFilter\"\n [filterMultiple]=