|
|
|
@ -1,13 +1,14 @@
|
|
|
|
|
import {ICellRendererAngularComp} from 'ag-grid-angular';
|
|
|
|
|
import {Component} from '@angular/core';
|
|
|
|
|
import {ICellRendererParams} from 'ag-grid-community';
|
|
|
|
|
import {EditorService} from '../../../../service/editor.service';
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'editor-boolean-renderer',
|
|
|
|
|
template: `
|
|
|
|
|
<ng-container *ngIf="!checkbox">{{ display }}</ng-container>
|
|
|
|
|
<div *ngIf="checkbox" style="width: 100%; text-align: center; padding-top: 3px;">
|
|
|
|
|
<ion-checkbox [checked]="params.value" (ionChange)="onChecked($event)"></ion-checkbox>
|
|
|
|
|
<ion-checkbox [checked]="params.value" (ionChange)="onChecked($event)" [disabled]="!editorService.canEdit()"></ion-checkbox>
|
|
|
|
|
</div>
|
|
|
|
|
`,
|
|
|
|
|
styles: [`
|
|
|
|
@ -27,9 +28,20 @@ export class BooleanRendererComponent implements ICellRendererAngularComp {
|
|
|
|
|
|
|
|
|
|
public checked = false;
|
|
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
|
public editorService: EditorService,
|
|
|
|
|
) { }
|
|
|
|
|
|
|
|
|
|
agInit(params: ICellRendererParams): void {
|
|
|
|
|
console.log('bool renderer', this);
|
|
|
|
|
this.params = params;
|
|
|
|
|
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
if ( this.params.colDef._parentEditorUUID ) {
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
this.editorService = this.editorService.getEditor(this.params.colDef._parentEditorUUID)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
this.checkbox = params.colDef.additionalData.labelType === 'checkbox';
|
|
|
|
|
|
|
|
|
|