Automatically stop editing when rich cell editor closes (#2)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
e3402f7501
commit
4f777855a5
@ -18,6 +18,7 @@
|
|||||||
[ngClass]="isDark() ? 'ag-theme-balham-dark' : 'ag-theme-balham'"
|
[ngClass]="isDark() ? 'ag-theme-balham-dark' : 'ag-theme-balham'"
|
||||||
[rowData]="rowData"
|
[rowData]="rowData"
|
||||||
[columnDefs]="columnDefs"
|
[columnDefs]="columnDefs"
|
||||||
|
[singleClickEdit]="true"
|
||||||
suppressMovableColumns="true"
|
suppressMovableColumns="true"
|
||||||
(rowClicked)="onRowClicked($event)"
|
(rowClicked)="onRowClicked($event)"
|
||||||
(cellValueChanged)="onCellValueChanged()"
|
(cellValueChanged)="onCellValueChanged()"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import {ICellEditorAngularComp} from 'ag-grid-angular';
|
import {ICellEditorAngularComp} from 'ag-grid-angular';
|
||||||
import {AfterViewInit, Component, ElementRef, ViewChild} from '@angular/core';
|
import {AfterViewInit, Component, ElementRef, ViewChild} from '@angular/core';
|
||||||
import {ICellEditorParams} from 'ag-grid-community';
|
import {ICellEditorParams} from 'ag-grid-community';
|
||||||
|
import {debounce} from '../../../../../utility';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'cell-editor-paragraph',
|
selector: 'cell-editor-paragraph',
|
||||||
@ -29,6 +30,9 @@ export class BooleanEditorComponent implements ICellEditorAngularComp, AfterView
|
|||||||
protected trueValue = 'True';
|
protected trueValue = 'True';
|
||||||
protected falseValue = 'False';
|
protected falseValue = 'False';
|
||||||
protected emptyValue = '';
|
protected emptyValue = '';
|
||||||
|
protected autoDismissDebounce = debounce(() => {
|
||||||
|
this.params.stopEditing();
|
||||||
|
}, 2000);
|
||||||
|
|
||||||
@ViewChild('input') input: ElementRef;
|
@ViewChild('input') input: ElementRef;
|
||||||
|
|
||||||
@ -59,5 +63,7 @@ export class BooleanEditorComponent implements ICellEditorAngularComp, AfterView
|
|||||||
} else {
|
} else {
|
||||||
this.value = true;
|
this.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.autoDismissDebounce();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,9 @@ import {IonDatetime} from '@ionic/angular';
|
|||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'cell-editor-select',
|
selector: 'cell-editor-select',
|
||||||
template: `<ion-datetime #picker [displayFormat]="format" [(ngModel)]="value" style="padding: 0 0 0 5px;"></ion-datetime>`,
|
template: `<ion-datetime
|
||||||
|
#picker [displayFormat]="format" [(ngModel)]="value" style="padding: 0 0 0 5px;" (ionChange)="finishEdit($event)"
|
||||||
|
></ion-datetime>`,
|
||||||
})
|
})
|
||||||
export class DatetimeEditorComponent implements ICellEditorAngularComp, AfterViewInit {
|
export class DatetimeEditorComponent implements ICellEditorAngularComp, AfterViewInit {
|
||||||
public params: ICellEditorParams;
|
public params: ICellEditorParams;
|
||||||
@ -30,4 +32,8 @@ export class DatetimeEditorComponent implements ICellEditorAngularComp, AfterVie
|
|||||||
ngAfterViewInit(): void {
|
ngAfterViewInit(): void {
|
||||||
this.picker.open();
|
this.picker.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
finishEdit($event) {
|
||||||
|
this.params.stopEditing();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,9 +48,14 @@ export class ParagraphEditorComponent implements ICellEditorAngularComp, AfterVi
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.value = String(value.data);
|
this.value = String(value.data);
|
||||||
|
this.finishEdit();
|
||||||
});
|
});
|
||||||
modal.present();
|
modal.present();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
finishEdit() {
|
||||||
|
this.params.stopEditing();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import {IonSelect} from '@ionic/angular';
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'cell-editor-multiselect',
|
selector: 'cell-editor-multiselect',
|
||||||
template: `
|
template: `
|
||||||
<ion-select #select [(ngModel)]="value" style="padding: 0;"
|
<ion-select #select [(ngModel)]="value" style="padding: 0;" (ionChange)="finishEdit()"
|
||||||
[interfaceOptions]="{header: params.colDef.headerName, cssClass: 'big-alert'}" multiple="true">
|
[interfaceOptions]="{header: params.colDef.headerName, cssClass: 'big-alert'}" multiple="true">
|
||||||
<ion-select-option *ngFor="let option of options" [value]="option.value">{{ option.value }}</ion-select-option>
|
<ion-select-option *ngFor="let option of options" [value]="option.value">{{ option.value }}</ion-select-option>
|
||||||
</ion-select>
|
</ion-select>
|
||||||
@ -33,4 +33,8 @@ export class MultiSelectEditorComponent implements ICellEditorAngularComp, After
|
|||||||
ngAfterViewInit(): void {
|
ngAfterViewInit(): void {
|
||||||
this.select.open();
|
this.select.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
finishEdit() {
|
||||||
|
this.params.stopEditing();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import {IonSelect} from '@ionic/angular';
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'cell-editor-select',
|
selector: 'cell-editor-select',
|
||||||
template: `
|
template: `
|
||||||
<ion-select #select [(ngModel)]="value" style="padding: 0;"
|
<ion-select #select [(ngModel)]="value" style="padding: 0;" (ionChange)="finishEdit()"
|
||||||
[interfaceOptions]="{header: params.colDef.headerName, cssClass: 'big-alert'}">
|
[interfaceOptions]="{header: params.colDef.headerName, cssClass: 'big-alert'}">
|
||||||
<ion-select-option *ngFor="let option of options" [value]="option.value">{{ option.value }}</ion-select-option>
|
<ion-select-option *ngFor="let option of options" [value]="option.value">{{ option.value }}</ion-select-option>
|
||||||
</ion-select>
|
</ion-select>
|
||||||
@ -32,4 +32,8 @@ export class SelectEditorComponent implements ICellEditorAngularComp, AfterViewI
|
|||||||
ngAfterViewInit(): void {
|
ngAfterViewInit(): void {
|
||||||
this.select.open();
|
this.select.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
finishEdit() {
|
||||||
|
this.params.stopEditing();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user