angular-clickable-click
Version:
Angular 2+ Directive setting 'cursor: pointer' for all elements using (click) directive
29 lines (28 loc) • 1.13 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var core_1 = require("@angular/core");
var ClickDirective = /** @class */ (function () {
function ClickDirective() {
this.disabled = false;
this.cursor = 'pointer';
this.pointerEvents = 'auto';
}
ClickDirective.prototype.ngOnChanges = function (changes) {
if (changes['disabled']) {
this.pointerEvents = this.disabled ? 'none' : 'auto';
this.cursor = this.disabled ? 'not-allowed' : 'pointer';
}
};
ClickDirective.decorators = [
{ type: core_1.Directive, args: [{ selector: '[click],[click][disabled]' },] },
];
/** @nocollapse */
ClickDirective.ctorParameters = function () { return []; };
ClickDirective.propDecorators = {
'disabled': [{ type: core_1.Input, args: ['disabled',] },],
'cursor': [{ type: core_1.HostBinding, args: ['style.cursor',] },],
'pointerEvents': [{ type: core_1.HostBinding, args: ['style.pointer-events',] },],
};
return ClickDirective;
}());
exports.ClickDirective = ClickDirective;