-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathkanban.component.ts
More file actions
68 lines (61 loc) · 1.68 KB
/
Copy pathkanban.component.ts
File metadata and controls
68 lines (61 loc) · 1.68 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import { Kanban, Toolbar, defaultEditorShape } from "@dhx/trial-kanban";
import { getData } from "./data";
import {
Component,
ElementRef,
OnInit,
OnDestroy,
ViewChild,
ViewEncapsulation
} from "@angular/core";
@Component({
encapsulation: ViewEncapsulation.None,
selector: "kanban",
styleUrls: ["./kanban.component.css"],
template: `<div class="component_container">
<div #toolbar_container></div>
<div #kanban_container class = "widget"></div>
</div>`
})
export class KanbanComponent implements OnInit, OnDestroy {
@ViewChild("toolbar_container", { static: true }) toolbar_container!: ElementRef;
@ViewChild("kanban_container", { static: true }) kanban_container!: ElementRef;
private _kanban!: Kanban;
private _toolbar!: Toolbar;
ngOnInit() {
const { cards, columns, rows, cardShape } = getData();
this._kanban = new Kanban(this.kanban_container.nativeElement, {
columns,
cards,
rows,
rowKey: "type",
cardShape,
editorShape: [
...defaultEditorShape, // import default config for editorShape
{
type: "links",
key: "links",
label: "Links"
},
{
type: "comments",
key: "comments",
label: "Comments",
config: {
placement: "editor"
}
}
],
currentUser: 1,
// other configuration properties
});
this._toolbar = new Toolbar(this.toolbar_container.nativeElement, {
api: this._kanban.api,
// other configuration properties
});
}
ngOnDestroy(): void {
this._kanban.destructor();
this._toolbar.destructor();
}
}