fix: a bug
This commit is contained in:
parent
9cd3633dd7
commit
30a8d5a78b
20
dist/frappe-gantt.js
vendored
20
dist/frappe-gantt.js
vendored
@ -1,4 +1,4 @@
|
|||||||
const k = "year", D = "month", v = "day", E = "hour", Y = "minute", A = "second", L = "millisecond", T = {
|
const M = "year", D = "month", v = "day", E = "hour", Y = "minute", A = "second", L = "millisecond", T = {
|
||||||
January: "Jan",
|
January: "Jan",
|
||||||
February: "Feb",
|
February: "Feb",
|
||||||
March: "Mar",
|
March: "Mar",
|
||||||
@ -95,7 +95,7 @@ const k = "year", D = "month", v = "day", E = "hour", Y = "minute", A = "second"
|
|||||||
add(n, t, e) {
|
add(n, t, e) {
|
||||||
t = parseInt(t, 10);
|
t = parseInt(t, 10);
|
||||||
const s = [
|
const s = [
|
||||||
n.getFullYear() + (e === k ? t : 0),
|
n.getFullYear() + (e === M ? t : 0),
|
||||||
n.getMonth() + (e === D ? t : 0),
|
n.getMonth() + (e === D ? t : 0),
|
||||||
n.getDate() + (e === v ? t : 0),
|
n.getDate() + (e === v ? t : 0),
|
||||||
n.getHours() + (e === E ? t : 0),
|
n.getHours() + (e === E ? t : 0),
|
||||||
@ -107,7 +107,7 @@ const k = "year", D = "month", v = "day", E = "hour", Y = "minute", A = "second"
|
|||||||
},
|
},
|
||||||
start_of(n, t) {
|
start_of(n, t) {
|
||||||
const e = {
|
const e = {
|
||||||
[k]: 6,
|
[M]: 6,
|
||||||
[D]: 5,
|
[D]: 5,
|
||||||
[v]: 4,
|
[v]: 4,
|
||||||
[E]: 3,
|
[E]: 3,
|
||||||
@ -121,7 +121,7 @@ const k = "year", D = "month", v = "day", E = "hour", Y = "minute", A = "second"
|
|||||||
}
|
}
|
||||||
const i = [
|
const i = [
|
||||||
n.getFullYear(),
|
n.getFullYear(),
|
||||||
s(k) ? 0 : n.getMonth(),
|
s(M) ? 0 : n.getMonth(),
|
||||||
s(D) ? 1 : n.getDate(),
|
s(D) ? 1 : n.getDate(),
|
||||||
s(v) ? 0 : n.getHours(),
|
s(v) ? 0 : n.getHours(),
|
||||||
s(E) ? 0 : n.getMinutes(),
|
s(E) ? 0 : n.getMinutes(),
|
||||||
@ -554,7 +554,7 @@ class O {
|
|||||||
const t = this.$bar;
|
const t = this.$bar;
|
||||||
this.handle_group.querySelector(".handle.left").setAttribute("x", t.getX() - 12), this.handle_group.querySelector(".handle.right").setAttribute("x", t.getEndX() + 4);
|
this.handle_group.querySelector(".handle.left").setAttribute("x", t.getX() - 12), this.handle_group.querySelector(".handle.right").setAttribute("x", t.getEndX() + 4);
|
||||||
const e = this.group.querySelector(".handle.progress");
|
const e = this.group.querySelector(".handle.progress");
|
||||||
e && e.setAttribute("points", this.get_progress_polygon_points());
|
console.log(e, this.$bar_progress.getEndX()), e && e.setAttribute("cx", this.$bar_progress.getEndX());
|
||||||
}
|
}
|
||||||
update_arrow_position() {
|
update_arrow_position() {
|
||||||
this.arrows = this.arrows || [];
|
this.arrows = this.arrows || [];
|
||||||
@ -685,7 +685,7 @@ class F {
|
|||||||
e = t;
|
e = t;
|
||||||
else
|
else
|
||||||
throw new TypeError(
|
throw new TypeError(
|
||||||
"Frappé Gantt only supports usage of a string CSS selector, HTML DOM element or SVG DOM element for the 'element' parameter"
|
"Frappe Gantt only supports usage of a string CSS selector, HTML DOM element or SVG DOM element for the 'element' parameter"
|
||||||
);
|
);
|
||||||
e ? (this.$svg = e, this.$svg.classList.add("gantt")) : this.$svg = c("svg", {
|
e ? (this.$svg = e, this.$svg.classList.add("gantt")) : this.$svg = c("svg", {
|
||||||
append_to: s,
|
append_to: s,
|
||||||
@ -1101,7 +1101,7 @@ class F {
|
|||||||
bind_grid_click() {
|
bind_grid_click() {
|
||||||
_.on(
|
_.on(
|
||||||
this.$svg,
|
this.$svg,
|
||||||
this.options.popup_trigger,
|
"click",
|
||||||
".grid-row, .grid-header",
|
".grid-row, .grid-header",
|
||||||
() => {
|
() => {
|
||||||
this.unselect_all(), this.hide_popup();
|
this.unselect_all(), this.hide_popup();
|
||||||
@ -1145,10 +1145,10 @@ class F {
|
|||||||
if (x && !x.classList.contains("current-upper")) {
|
if (x && !x.classList.contains("current-upper")) {
|
||||||
const m = document.querySelector(".current-upper");
|
const m = document.querySelector(".current-upper");
|
||||||
m && (m.classList.remove("current-upper"), m.style.left = this.upper_texts_x[m.textContent] + "px", m.style.top = this.options.header_height - 50 + "px"), x.classList.add("current-upper");
|
m && (m.classList.remove("current-upper"), m.style.left = this.upper_texts_x[m.textContent] + "px", m.style.top = this.options.header_height - 50 + "px"), x.classList.add("current-upper");
|
||||||
let M = this.$svg.getBoundingClientRect();
|
let k = this.$svg.getBoundingClientRect();
|
||||||
x.style.left = M.x + this.$container.scrollLeft + 10 + "px", x.style.top = M.y + this.options.header_height - 50 + "px";
|
x.style.left = k.x + this.$container.scrollLeft + 10 + "px", x.style.top = k.y + this.options.header_height - 50 + "px";
|
||||||
}
|
}
|
||||||
Array.prototype.forEach.call(g, function(m, M) {
|
Array.prototype.forEach.call(g, function(m, k) {
|
||||||
f.push(m.getAttribute("data-id"));
|
f.push(m.getAttribute("data-id"));
|
||||||
}), w && (u = f.map((m) => this.get_bar(m)), this.options.auto_move_label && u.forEach((m) => {
|
}), w && (u = f.map((m) => this.get_bar(m)), this.options.auto_move_label && u.forEach((m) => {
|
||||||
m.update_label_position_on_horizontal_scroll({
|
m.update_label_position_on_horizontal_scroll({
|
||||||
|
|||||||
12
dist/frappe-gantt.umd.cjs
vendored
12
dist/frappe-gantt.umd.cjs
vendored
File diff suppressed because one or more lines are too long
@ -7,6 +7,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "yarn run dev",
|
"start": "yarn run dev",
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
"build-dev": "vite build --watch",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"lint": "eslint src/**/*.js",
|
"lint": "eslint src/**/*.js",
|
||||||
|
|||||||
@ -634,8 +634,9 @@ export default class Bar {
|
|||||||
.querySelector('.handle.right')
|
.querySelector('.handle.right')
|
||||||
.setAttribute('x', bar.getEndX() + 4);
|
.setAttribute('x', bar.getEndX() + 4);
|
||||||
const handle = this.group.querySelector('.handle.progress');
|
const handle = this.group.querySelector('.handle.progress');
|
||||||
|
console.log(handle, this.$bar_progress.getEndX())
|
||||||
handle &&
|
handle &&
|
||||||
handle.setAttribute('points', this.get_progress_polygon_points());
|
handle.setAttribute('cx', this.$bar_progress.getEndX());
|
||||||
}
|
}
|
||||||
|
|
||||||
update_arrow_position() {
|
update_arrow_position() {
|
||||||
|
|||||||
@ -77,7 +77,7 @@ export default class Gantt {
|
|||||||
svg_element = element;
|
svg_element = element;
|
||||||
} else {
|
} else {
|
||||||
throw new TypeError(
|
throw new TypeError(
|
||||||
'Frappé Gantt only supports usage of a string CSS selector,' +
|
'Frappe Gantt only supports usage of a string CSS selector,' +
|
||||||
" HTML DOM element or SVG DOM element for the 'element' parameter",
|
" HTML DOM element or SVG DOM element for the 'element' parameter",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -931,7 +931,7 @@ export default class Gantt {
|
|||||||
bind_grid_click() {
|
bind_grid_click() {
|
||||||
$.on(
|
$.on(
|
||||||
this.$svg,
|
this.$svg,
|
||||||
this.options.popup_trigger,
|
'click',
|
||||||
'.grid-row, .grid-header',
|
'.grid-row, .grid-header',
|
||||||
() => {
|
() => {
|
||||||
this.unselect_all();
|
this.unselect_all();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user