ng-cursor
Version:
## Overview
69 lines (63 loc) • 3.01 kB
JavaScript
import * as i0 from '@angular/core';
import { Directive, Input, NgModule } from '@angular/core';
class NgCursorDirective {
constructor(el) {
this.el = el;
this.cursor = 'auto';
this.cursorImportant = false;
}
ngOnChanges(changes) {
this.setCursor();
}
setCursor() {
let cursor = this.cursor;
if (cursor.includes('!important')) {
this.cursorImportant = true;
cursor = cursor.replace('!important', '').trim();
}
if (cursor.startsWith('url(') && !cursor.includes(',')) {
cursor += ' , auto';
}
this.el.nativeElement.style.setProperty("cursor", cursor, this.cursorImportant ? 'important' : '');
}
}
NgCursorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgCursorDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
NgCursorDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.4", type: NgCursorDirective, selector: "[ngCursor]", inputs: { cursor: ["ngCursor", "cursor"], cursorImportant: ["ngCursorImportant", "cursorImportant"] }, usesOnChanges: true, ngImport: i0 });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgCursorDirective, decorators: [{
type: Directive,
args: [{
selector: '[ngCursor]'
}]
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { cursor: [{
type: Input,
args: ['ngCursor']
}], cursorImportant: [{
type: Input,
args: ['ngCursorImportant']
}] } });
class NgCursorModule {
}
NgCursorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgCursorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
NgCursorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.4", ngImport: i0, type: NgCursorModule, declarations: [NgCursorDirective], exports: [NgCursorDirective] });
NgCursorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgCursorModule });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgCursorModule, decorators: [{
type: NgModule,
args: [{
declarations: [
NgCursorDirective
],
imports: [],
exports: [
NgCursorDirective
]
}]
}] });
/*
* Public API Surface of ng-cursor
*/
/**
* Generated bundle index. Do not edit.
*/
export { NgCursorDirective, NgCursorModule };
//# sourceMappingURL=ng-cursor.mjs.map
//# sourceMappingURL=ng-cursor.mjs.map