rb-data-table
Version:
Angular Smart Table
46 lines • 2.88 kB
JavaScript
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Component } from '@angular/core';
import { DefaultEditor } from './default-editor';
var CheckboxEditorComponent = /** @class */ (function (_super) {
__extends(CheckboxEditorComponent, _super);
function CheckboxEditorComponent() {
return _super.call(this) || this;
}
CheckboxEditorComponent.prototype.onChange = function (event) {
var trueVal = (this.cell.getColumn().getConfig() && this.cell.getColumn().getConfig().true) || true;
var falseVal = (this.cell.getColumn().getConfig() && this.cell.getColumn().getConfig().false) || false;
this.cell.newValue = event.target.checked ? trueVal : falseVal;
};
CheckboxEditorComponent = __decorate([
Component({
selector: 'checkbox-editor',
styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em} /*# sourceMappingURL=editor.component.css.map */ "],
template: "\n <input [ngClass]=\"inputClass\"\n type=\"checkbox\"\n class=\"form-control\"\n [name]=\"cell.getId()\"\n [disabled]=\"!cell.isEditable()\"\n [checked]=\"cell.getValue() == (cell.getColumn().getConfig()?.true || true)\"\n (click)=\"onClick.emit($event)\"\n (change)=\"onChange($event)\">\n ",
}),
__metadata("design:paramtypes", [])
], CheckboxEditorComponent);
return CheckboxEditorComponent;
}(DefaultEditor));
export { CheckboxEditorComponent };
//# sourceMappingURL=checkbox-editor.component.js.map