UNPKG

gp-crm-ui

Version:

Модуль компонентов UI Имя модуля: `gp-crm-ui`

29 lines (24 loc) 941 B
import { Component, Input, Renderer2, ViewEncapsulation } from '@angular/core'; // Перечисления import { CursorType } from '../../enums'; // Компонент предоставляет управление типом курсора на всей странице @Component({ selector: 'crm-cursor', template: '', styleUrls: ['./crm-cursor.component.scss'], encapsulation: ViewEncapsulation.None }) export class CrmCursorComponent { // Конструктор constructor(private readonly renderer: Renderer2) {} // Тип курсора для всей страницы @Input() public set type(type: CursorType) { if (type === CursorType.Auto) { document.body.style.removeProperty('--cursor-type'); this.renderer.removeAttribute(document.body, 'cursor-type'); } else { document.body.style.setProperty('--cursor-type', type); this.renderer.setAttribute(document.body, 'cursor-type', type); } } }