UNPKG

bixi

Version:

企业级中后台前端解决方案

29 lines (24 loc) 1.01 kB
import { ChangeDetectionStrategy, Component, Input, OnInit, TemplateRef } from '@angular/core'; import { NzSafeAny } from 'ng-zorro-antd/core/types'; import { EBixiCustomTplType, IRow, ITemplateCol } from '../table.type'; import { ColTemplateService } from './col-template.service'; import { ColBase } from './col.base'; @Component({ selector: 'bixi-table-col-template', host: { '[class.bixi-table-col-template]': 'true' }, template: ` <ng-template [ngTemplateOutlet]="outletRef" [ngTemplateOutletContext]="{$implicit: row, index: index}"></ng-template> `, changeDetection: ChangeDetectionStrategy.OnPush }) export class BixiTableColTemplateComponent extends ColBase implements OnInit { @Input() row: IRow; @Input() col: ITemplateCol; outletRef: TemplateRef<NzSafeAny> | undefined; constructor(private colTemplateService: ColTemplateService) { super(); } ngOnInit() { this.outletRef = this.colTemplateService.getTemplateRef(this.col.ref, EBixiCustomTplType.body); } }