UNPKG

ng2-stable-nxtc

Version:

Angular Smart Table neXtCode Version

40 lines 2.11 kB
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'; let CheckboxEditorComponent = class CheckboxEditorComponent extends DefaultEditor { constructor() { super(); } onChange(event) { const trueVal = (this.cell.getColumn().getConfig() && this.cell.getColumn().getConfig().true) || true; const 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: ` <input [ngClass]="inputClass" type="checkbox" class="form-control" [name]="cell.getId()" [disabled]="!cell.isEditable()" [checked]="cell.getValue() == (cell.getColumn().getConfig()?.true || true)" (click)="onClick.emit($event)" (change)="onChange($event)"> `, }), __metadata("design:paramtypes", []) ], CheckboxEditorComponent); export { CheckboxEditorComponent }; //# sourceMappingURL=checkbox-editor.component.js.map