fix: couple ignoring bugs
This commit is contained in:
parent
9caf2322b9
commit
6c8cc993c4
@ -587,9 +587,9 @@ export default class Bar {
|
|||||||
if (
|
if (
|
||||||
!this.gantt.config.ignored_dates.find(
|
!this.gantt.config.ignored_dates.find(
|
||||||
(k) => k.getTime() === d.getTime(),
|
(k) => k.getTime() === d.getTime(),
|
||||||
) &&
|
) ||
|
||||||
this.gantt.config.ignored_function &&
|
(this.gantt.config.ignored_function &&
|
||||||
!this.gantt.config.ignored_function(d)
|
!this.gantt.config.ignored_function(d))
|
||||||
) {
|
) {
|
||||||
actual_duration_in_days++;
|
actual_duration_in_days++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -118,8 +118,17 @@ const DEFAULT_OPTIONS = {
|
|||||||
today_button: true,
|
today_button: true,
|
||||||
view_mode_select: false,
|
view_mode_select: false,
|
||||||
default_snap: '1d',
|
default_snap: '1d',
|
||||||
holiday_highlight: { green: 'weekend' },
|
holiday_highlight: {
|
||||||
ignore: ['weekend'],
|
green: [
|
||||||
|
'2024-03-01',
|
||||||
|
'2024-03-02',
|
||||||
|
'2024-03-03',
|
||||||
|
'2024-03-04',
|
||||||
|
'2024-03-05',
|
||||||
|
'2024-03-06',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
ignore: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
export { DEFAULT_OPTIONS, DEFAULT_VIEW_MODES };
|
export { DEFAULT_OPTIONS, DEFAULT_VIEW_MODES };
|
||||||
|
|||||||
17
src/index.js
17
src/index.js
@ -559,7 +559,6 @@ export default class Gantt {
|
|||||||
let check_highlight = this.options.holiday_highlight[color];
|
let check_highlight = this.options.holiday_highlight[color];
|
||||||
if (check_highlight === 'weekend')
|
if (check_highlight === 'weekend')
|
||||||
check_highlight = (d) => d.getDay() === 0 || d.getDay() === 6;
|
check_highlight = (d) => d.getDay() === 0 || d.getDay() === 6;
|
||||||
|
|
||||||
let extra_func;
|
let extra_func;
|
||||||
|
|
||||||
if (typeof check_highlight === 'object') {
|
if (typeof check_highlight === 'object') {
|
||||||
@ -600,13 +599,17 @@ export default class Gantt {
|
|||||||
const height =
|
const height =
|
||||||
(this.options.bar_height + this.options.padding) *
|
(this.options.bar_height + this.options.padding) *
|
||||||
this.tasks.length;
|
this.tasks.length;
|
||||||
|
|
||||||
createSVG('rect', {
|
createSVG('rect', {
|
||||||
x,
|
x: Math.round(x),
|
||||||
y:
|
y:
|
||||||
this.options.header_height +
|
this.options.header_height +
|
||||||
this.options.padding / 2,
|
this.options.padding / 2,
|
||||||
width: this.config.column_width,
|
width:
|
||||||
|
this.config.column_width /
|
||||||
|
date_utils.convert_scales(
|
||||||
|
this.config.view_mode.step,
|
||||||
|
'day',
|
||||||
|
),
|
||||||
height,
|
height,
|
||||||
style: `fill: ${color};`,
|
style: `fill: ${color};`,
|
||||||
append_to: this.layers.grid,
|
append_to: this.layers.grid,
|
||||||
@ -664,6 +667,7 @@ export default class Gantt {
|
|||||||
M3,5 l2,-2"
|
M3,5 l2,-2"
|
||||||
style="stroke:black; stroke-width:0.5" />
|
style="stroke:black; stroke-width:0.5" />
|
||||||
</pattern>`;
|
</pattern>`;
|
||||||
|
|
||||||
for (
|
for (
|
||||||
let d = new Date(this.gantt_start);
|
let d = new Date(this.gantt_start);
|
||||||
d <= this.gantt_end;
|
d <= this.gantt_end;
|
||||||
@ -673,10 +677,11 @@ export default class Gantt {
|
|||||||
!this.config.ignored_dates.find(
|
!this.config.ignored_dates.find(
|
||||||
(k) => k.getDate() == d.getDate(),
|
(k) => k.getDate() == d.getDate(),
|
||||||
) &&
|
) &&
|
||||||
this.config.ignored_function &&
|
(!this.config.ignored_function ||
|
||||||
!this.config.ignored_function(d)
|
!this.config.ignored_function(d))
|
||||||
)
|
)
|
||||||
continue;
|
continue;
|
||||||
|
console.log(this.config.ignored_function);
|
||||||
let diff =
|
let diff =
|
||||||
date_utils.convert_scales(
|
date_utils.convert_scales(
|
||||||
date_utils.diff(d, this.gantt_start) + 'd',
|
date_utils.diff(d, this.gantt_start) + 'd',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user