ng-zorro-antd-yj
Version:
An enterprise-class UI components based on Ant Design and Angular
150 lines • 11.8 kB
JavaScript
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
import * as tslib_1 from "tslib";
import { ChangeDetectionStrategy, Component, ElementRef, EventEmitter, Input, Output, ViewEncapsulation } from '@angular/core';
import { NzUpdateHostClassService } from '../core/services/update-host-class.service';
import { isNotNil } from '../core/util/check';
import { InputBoolean } from '../core/util/convert';
var NzTdComponent = /** @class */ (function () {
function NzTdComponent(elementRef, nzUpdateHostClassService) {
this.elementRef = elementRef;
this.nzUpdateHostClassService = nzUpdateHostClassService;
this.nzChecked = false;
this.nzDisabled = false;
this.nzIndeterminate = false;
this.nzExpand = false;
this.nzShowExpand = false;
this.nzShowCheckbox = false;
this.nzCheckedChange = new EventEmitter();
this.nzExpandChange = new EventEmitter();
}
/**
* @param {?} e
* @return {?}
*/
NzTdComponent.prototype.expandChange = /**
* @param {?} e
* @return {?}
*/
function (e) {
e.stopPropagation();
this.nzExpand = !this.nzExpand;
this.nzExpandChange.emit(this.nzExpand);
};
/**
* @return {?}
*/
NzTdComponent.prototype.setClassMap = /**
* @return {?}
*/
function () {
var _a;
this.nzUpdateHostClassService.updateHostClass(this.elementRef.nativeElement, (_a = {},
_a["ant-table-row-expand-icon-cell"] = this.nzShowExpand && !isNotNil(this.nzIndentSize),
_a["ant-table-selection-column"] = this.nzShowCheckbox,
_a["ant-table-td-left-sticky"] = isNotNil(this.nzLeft),
_a["ant-table-td-right-sticky"] = isNotNil(this.nzRight),
_a));
};
/**
* @param {?} changes
* @return {?}
*/
NzTdComponent.prototype.ngOnChanges = /**
* @param {?} changes
* @return {?}
*/
function (changes) {
if (changes.nzIndentSize || changes.nzShowExpand || changes.nzShowCheckbox || changes.nzRight || changes.nzLeft) {
this.setClassMap();
}
};
NzTdComponent.decorators = [
{ type: Component, args: [{
// tslint:disable-next-line:component-selector
selector: 'td:not(.nz-disable-td)',
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [NzUpdateHostClassService],
preserveWhitespaces: false,
encapsulation: ViewEncapsulation.None,
template: "<span class=\"ant-table-row-indent\" *ngIf=\"nzIndentSize >= 0\" [style.padding-left.px]=\"nzIndentSize\"></span>\n<label *ngIf=\"nzShowCheckbox\"\n nz-checkbox\n [nzDisabled]=\"nzDisabled\"\n [(ngModel)]=\"nzChecked\"\n [nzIndeterminate]=\"nzIndeterminate\"\n (ngModelChange)=\"nzCheckedChange.emit($event)\">\n</label>\n<span *ngIf=\"!nzShowExpand && nzIndentSize >= 0\"\n class=\"ant-table-row-expand-icon ant-table-row-spaced\">\n</span>\n<span *ngIf=\"nzShowExpand\"\n class=\"ant-table-row-expand-icon\"\n [class.ant-table-row-expanded]=\"nzExpand\"\n [class.ant-table-row-collapsed]=\"!nzExpand\"\n (click)=\"expandChange($event)\">\n</span>\n<ng-content></ng-content>",
host: {
'[style.left]': 'nzLeft',
'[style.right]': 'nzRight',
'[style.text-align]': 'nzAlign'
}
}] }
];
/** @nocollapse */
NzTdComponent.ctorParameters = function () { return [
{ type: ElementRef },
{ type: NzUpdateHostClassService }
]; };
NzTdComponent.propDecorators = {
nzChecked: [{ type: Input }],
nzDisabled: [{ type: Input }],
nzIndeterminate: [{ type: Input }],
nzLeft: [{ type: Input }],
nzRight: [{ type: Input }],
nzAlign: [{ type: Input }],
nzIndentSize: [{ type: Input }],
nzExpand: [{ type: Input }],
nzShowExpand: [{ type: Input }],
nzShowCheckbox: [{ type: Input }],
nzCheckedChange: [{ type: Output }],
nzExpandChange: [{ type: Output }]
};
tslib_1.__decorate([
InputBoolean(),
tslib_1.__metadata("design:type", Object)
], NzTdComponent.prototype, "nzExpand", void 0);
tslib_1.__decorate([
InputBoolean(),
tslib_1.__metadata("design:type", Object)
], NzTdComponent.prototype, "nzShowExpand", void 0);
tslib_1.__decorate([
InputBoolean(),
tslib_1.__metadata("design:type", Object)
], NzTdComponent.prototype, "nzShowCheckbox", void 0);
return NzTdComponent;
}());
export { NzTdComponent };
if (false) {
/** @type {?} */
NzTdComponent.prototype.nzChecked;
/** @type {?} */
NzTdComponent.prototype.nzDisabled;
/** @type {?} */
NzTdComponent.prototype.nzIndeterminate;
/** @type {?} */
NzTdComponent.prototype.nzLeft;
/** @type {?} */
NzTdComponent.prototype.nzRight;
/** @type {?} */
NzTdComponent.prototype.nzAlign;
/** @type {?} */
NzTdComponent.prototype.nzIndentSize;
/** @type {?} */
NzTdComponent.prototype.nzExpand;
/** @type {?} */
NzTdComponent.prototype.nzShowExpand;
/** @type {?} */
NzTdComponent.prototype.nzShowCheckbox;
/** @type {?} */
NzTdComponent.prototype.nzCheckedChange;
/** @type {?} */
NzTdComponent.prototype.nzExpandChange;
/**
* @type {?}
* @private
*/
NzTdComponent.prototype.elementRef;
/**
* @type {?}
* @private
*/
NzTdComponent.prototype.nzUpdateHostClassService;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnotdGQuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6Im5nOi8vbmctem9ycm8tYW50ZC15ai8iLCJzb3VyY2VzIjpbInRhYmxlL256LXRkLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLE9BQU8sRUFDTCx1QkFBdUIsRUFDdkIsU0FBUyxFQUNULFVBQVUsRUFDVixZQUFZLEVBQ1osS0FBSyxFQUVMLE1BQU0sRUFFTixpQkFBaUIsRUFDbEIsTUFBTSxlQUFlLENBQUM7QUFDdkIsT0FBTyxFQUFFLHdCQUF3QixFQUFFLE1BQU0sNENBQTRDLENBQUM7QUFFdEYsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBQzlDLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUVwRDtJQTJDRSx1QkFBb0IsVUFBc0IsRUFBVSx3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