feat: add extra events
This commit is contained in:
parent
c815dcd31a
commit
c13c9c08ec
103
index.html
103
index.html
@ -38,49 +38,50 @@
|
|||||||
end: '2018-10-08',
|
end: '2018-10-08',
|
||||||
name: 'Redesign website',
|
name: 'Redesign website',
|
||||||
id: "Task 0",
|
id: "Task 0",
|
||||||
progress: 100
|
progress: 80
|
||||||
|
},
|
||||||
|
{
|
||||||
|
start: '2018-09-26',
|
||||||
|
// Utilizes duration
|
||||||
|
duration: '1m 4d',
|
||||||
|
name: 'Write new content',
|
||||||
|
id: "Task 1",
|
||||||
|
progress: 5,
|
||||||
|
dependencies: 'Task 0'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
start: '2018-10-04',
|
||||||
|
end: '2018-10-08',
|
||||||
|
name: 'Apply new styles',
|
||||||
|
id: "Task 2",
|
||||||
|
progress: 100,
|
||||||
|
dependencies: 'Task 1'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
start: '2018-10-08',
|
||||||
|
end: '2018-10-09',
|
||||||
|
name: 'Review',
|
||||||
|
id: "Task 3",
|
||||||
|
progress: 5,
|
||||||
|
dependencies: 'Task 2'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
start: '2018-10-08',
|
||||||
|
end: '2018-10-10',
|
||||||
|
name: 'Deploy',
|
||||||
|
id: "Task 4",
|
||||||
|
progress: 0,
|
||||||
|
// dependencies: 'Task 2'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
start: '2018-10-11',
|
||||||
|
end: '2018-10-11',
|
||||||
|
name: 'Go Live!',
|
||||||
|
id: "Task 5",
|
||||||
|
progress: 0,
|
||||||
|
dependencies: 'Task 2',
|
||||||
|
custom_class: 'bar-milestone'
|
||||||
},
|
},
|
||||||
// {
|
|
||||||
// start: '2018-10-03',
|
|
||||||
// duration: '1m 4d',
|
|
||||||
// name: 'Write new content',
|
|
||||||
// id: "Task 1",
|
|
||||||
// progress: 5,
|
|
||||||
// dependencies: 'Task 0'
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// start: '2018-10-04',
|
|
||||||
// end: '2018-10-08',
|
|
||||||
// name: 'Apply new styles',
|
|
||||||
// id: "Task 2",
|
|
||||||
// progress: 10,
|
|
||||||
// dependencies: 'Task 1'
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// start: '2018-10-08',
|
|
||||||
// end: '2018-10-09',
|
|
||||||
// name: 'Review',
|
|
||||||
// id: "Task 3",
|
|
||||||
// progress: 5,
|
|
||||||
// dependencies: 'Task 2'
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// start: '2018-10-08',
|
|
||||||
// end: '2018-10-10',
|
|
||||||
// name: 'Deploy',
|
|
||||||
// id: "Task 4",
|
|
||||||
// progress: 0,
|
|
||||||
// dependencies: 'Task 2'
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// start: '2018-10-11',
|
|
||||||
// end: '2018-10-11',
|
|
||||||
// name: 'Go Live!',
|
|
||||||
// id: "Task 5",
|
|
||||||
// progress: 0,
|
|
||||||
// dependencies: 'Task 4',
|
|
||||||
// custom_class: 'bar-milestone'
|
|
||||||
// },
|
|
||||||
// {
|
// {
|
||||||
// start: '2014-01-05',
|
// start: '2014-01-05',
|
||||||
// end: '2019-10-12',
|
// end: '2019-10-12',
|
||||||
@ -91,19 +92,25 @@
|
|||||||
];
|
];
|
||||||
var gantt_chart = new Gantt(".gantt-target", tasks, {
|
var gantt_chart = new Gantt(".gantt-target", tasks, {
|
||||||
on_click: (task) => {
|
on_click: (task) => {
|
||||||
console.log(task);
|
console.log("Double Click", task);
|
||||||
|
},
|
||||||
|
on_double_click: (task) => {
|
||||||
|
console.log("Double Click", task);
|
||||||
},
|
},
|
||||||
on_date_change: (task, start, end) => {
|
on_date_change: (task, start, end) => {
|
||||||
console.log(task, start, end);
|
console.log("Date change", task, start, end);
|
||||||
},
|
},
|
||||||
on_progress_change: (task, progress) => {
|
on_progress_change: (task, progress) => {
|
||||||
console.log(task, progress);
|
console.log("Progress Change", task, progress);
|
||||||
},
|
},
|
||||||
on_view_change: (mode) => {
|
on_view_change: (mode) => {
|
||||||
console.log(mode);
|
console.log("View Change", mode);
|
||||||
},
|
},
|
||||||
view_mode: "Half Day",
|
on_hover: (task, x, y) => {
|
||||||
view_mode_padding: { DAY: "1d" },
|
console.log("Hover", x, y);
|
||||||
|
},
|
||||||
|
view_mode: "Day",
|
||||||
|
view_mode_padding: { DAY: "7d" },
|
||||||
language: "en",
|
language: "en",
|
||||||
});
|
});
|
||||||
console.log(gantt_chart);
|
console.log(gantt_chart);
|
||||||
|
|||||||
@ -256,7 +256,10 @@ export default class Bar {
|
|||||||
|
|
||||||
setup_click_event() {
|
setup_click_event() {
|
||||||
let in_action = false;
|
let in_action = false;
|
||||||
|
$.on(this.group, "mouseover", (e) => this.gantt.trigger_event("hover", [this.task, e.screenX, e.screenY, e]))
|
||||||
|
|
||||||
$.on(this.group, "focus " + this.gantt.options.popup_trigger, (e) => {
|
$.on(this.group, "focus " + this.gantt.options.popup_trigger, (e) => {
|
||||||
|
this.gantt.trigger_event("click", [this.task]);
|
||||||
if (this.action_completed) {
|
if (this.action_completed) {
|
||||||
// just finished a move action, wait for a few seconds
|
// just finished a move action, wait for a few seconds
|
||||||
return;
|
return;
|
||||||
@ -279,7 +282,7 @@ export default class Bar {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.gantt.trigger_event("click", [this.task]);
|
this.gantt.trigger_event("double_click", [this.task]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user