import {Directive, ElementRef, Input, OnInit, Renderer2} from '@angular/core';
import {FrameVariable} from '../../frame/frame-variable';

@Directive({
  selector: '[frameRole]'
})
/************************
 * 权限判断，用于是否显示按钮
 */
export class FrameRoleDirective implements OnInit {


  @Input() res;

  constructor(private renderer: Renderer2, public element: ElementRef) {
  }

  ngOnInit(): void {
    if (this.res === undefined) {
      this.res = 0 ;
    }
    const flag = FrameVariable.validateRole(this.res);
    this.element.nativeElement.style.display = (flag ? '' : 'none');

  }
}
