import { Directive, Host, Input, OnInit, TemplateRef } from '@angular/core';
import { NzSafeAny } from 'ng-zorro-antd/core/types';
import { EBixiCustomTplType } from '../table.type';
import { ColTemplateService } from './col-template.service';

@Directive({
  selector: '[bixi-row]'
})
export class BixiRowDirective implements OnInit {
  @Input('bixi-row') tplName: string; // 获取定义的列名
  @Input() type: string = EBixiCustomTplType.body;

  constructor(private ref: TemplateRef<NzSafeAny>, @Host() private colTemplateService: ColTemplateService) { }

  ngOnInit() {
    this.colTemplateService.add(this.tplName, this.ref, this.type as EBixiCustomTplType);
  }
}
