/
ReduceDialog.ts
37 lines (30 loc) · 985 Bytes
/
ReduceDialog.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import {EAdvancedSortMethod, ReduceColumn} from '../../model';
import ADialog, {IDialogContext} from './ADialog';
import {sortMethods} from './utils';
import {IToolbarDialogAddonHandler} from '../interfaces';
/** @internal */
export default class ReduceDialog extends ADialog {
private handler: IToolbarDialogAddonHandler | null = null;
constructor(private readonly column: ReduceColumn, dialog: IDialogContext) {
super(dialog, {
livePreview: 'reduce'
});
}
protected build(node: HTMLElement) {
const wrapper = {
getSortMethod: () => this.column.getReduce(),
setSortMethod: (s: EAdvancedSortMethod) => this.column.setReduce(s)
};
this.handler = sortMethods(node, wrapper, Object.keys(EAdvancedSortMethod));
this.enableLivePreviews(this.handler.elems);
}
protected submit() {
return this.handler!.submit();
}
protected reset() {
this.handler!.reset();
}
protected cancel() {
this.handler!.cancel();
}
}