jsgantt-improved
Advanced tools
Comparing version 2.3.2 to 2.3.3
@@ -61,2 +61,3 @@ "use strict"; | ||
this.setShowEndWeekDate = function (pVal) { this.vShowEndWeekDate = pVal; }; | ||
this.setShowWeekends = function (pVal) { this.vShowWeekends = pVal; }; | ||
this.setShowSelector = function () { | ||
@@ -161,2 +162,3 @@ var vValidSelectors = 'top bottom'; | ||
this.getShowEndWeekDate = function () { return this.vShowEndWeekDate; }; | ||
this.getShowWeekends = function () { return this.vShowWeekends; }; | ||
this.getShowSelector = function () { return this.vShowSelector; }; | ||
@@ -163,0 +165,0 @@ this.getShowDeps = function () { return this.vShowDeps; }; |
@@ -377,3 +377,3 @@ "use strict"; | ||
}; | ||
exports.getOffset = function (pStartDate, pEndDate, pColWidth, pFormat) { | ||
exports.getOffset = function (pStartDate, pEndDate, pColWidth, pFormat, pShowWeekends) { | ||
var DAY_CELL_MARGIN_WIDTH = 3; // Cell margin for 'day' format | ||
@@ -390,5 +390,19 @@ var WEEK_CELL_MARGIN_WIDTH = 3; // Cell margin for 'week' format | ||
var tmpTaskEnd = Date.UTC(curTaskEnd.getFullYear(), curTaskEnd.getMonth(), curTaskEnd.getDate(), curTaskEnd.getHours(), 0, 0); | ||
var vTaskRight = (tmpTaskEnd - tmpTaskStart) / 3600000; // Length of task in hours | ||
var oneHour = 3600000; | ||
var vTaskRight = (tmpTaskEnd - tmpTaskStart) / oneHour; // Length of task in hours | ||
var vPosTmpDate; | ||
if (pFormat == 'day') { | ||
if (!pShowWeekends) { | ||
var start = curTaskStart; | ||
var end = curTaskEnd; | ||
var countWeekends = 0; | ||
while (start < end) { | ||
var day = start.getDay(); | ||
if (day === 6 || day == 0) { | ||
countWeekends++; | ||
} | ||
start = new Date(start.getTime() + 24 * oneHour); | ||
} | ||
vTaskRight -= countWeekends * 24; | ||
} | ||
vTaskRightPx = Math.ceil((vTaskRight / 24) * (pColWidth + DAY_CELL_MARGIN_WIDTH) - 1); | ||
@@ -395,0 +409,0 @@ } |
@@ -45,2 +45,4 @@ let dataurl; | ||
vShowWeekends = document.querySelector('#vShowWeekends:checked') ? 1 : 0; | ||
vMinDate = document.querySelector('#vMinDate').value; | ||
@@ -89,4 +91,4 @@ vMaxDate = document.querySelector('#vMaxDate').value; | ||
cost: console.log, | ||
beforeDraw: ()=>console.log('before draw listener'), | ||
afterDraw: ()=> { | ||
beforeDraw: () => console.log('before draw listener'), | ||
afterDraw: () => { | ||
console.log('after draw listener'); | ||
@@ -118,4 +120,5 @@ if (document.querySelector("#customElements:checked")) { | ||
vShowEndWeekDate, // Show/Hide the date for the last day of the week in header for daily view (1/0) | ||
vShowWeekends, // Show weekends days in the vFormat day | ||
vTooltipDelay: delay, | ||
vTooltipTemplate: | ||
vTooltipTemplate: | ||
document.querySelector("#dynamicTooltip:checked") ? | ||
@@ -177,3 +180,3 @@ generateTooltip : | ||
function clearTasks(){ | ||
function clearTasks() { | ||
g.ClearTasks(); | ||
@@ -210,3 +213,3 @@ g.Draw() | ||
if (task.getLevel() === 1) return; | ||
// string tooltip for level 2. Show completed/total child count and current timestamp | ||
@@ -233,3 +236,3 @@ if (task.getLevel() === 2) { | ||
} | ||
// async tooltip for level 3 and below | ||
@@ -236,0 +239,0 @@ return new Promise((resolve, reject) => { |
@@ -56,3 +56,3 @@ | ||
pComp: 0, | ||
pGroup: 1, | ||
pGroup: 0, | ||
pParent: 0, | ||
@@ -59,0 +59,0 @@ pOpen: 1, |
{ | ||
"name": "jsgantt-improved", | ||
"version": "2.3.2", | ||
"version": "2.3.3", | ||
"description": "jsgantt-improved", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -18,2 +18,4 @@ [![Build Status](https://travis-ci.com/jsGanttImproved/jsgantt-improved.svg?branch=master)](https://travis-ci.com/jsGanttImproved/jsgantt-improved) | ||
See the [FULL DOCUMENTATION](./docs/Documentation.md) for more details in all features. | ||
For **Angular** use the component [ng-gantt](https://github.com/jsGanttImproved/ng-gantt) | ||
@@ -20,0 +22,0 @@ |
@@ -38,2 +38,3 @@ import * as lang from './lang'; | ||
this.vShowEndWeekDate = 1; | ||
this.vShowWeekends = 1; | ||
this.vShowTaskInfoRes = 1; | ||
@@ -256,4 +257,4 @@ this.vShowTaskInfoDur = 1; | ||
if (this.getShowDeps() == 1) { | ||
//First recalculate the x,y | ||
this.CalcTaskXY(); | ||
this.CalcTaskXY(); //First recalculate the x,y | ||
this.clearDependencies(); | ||
@@ -648,3 +649,9 @@ | ||
if (this.vFormat == 'day') { | ||
vTmpCell = this.newNode(vTmpRow, 'td', null, vHeaderCellClass, null, null, null, null, 7); | ||
let colspan = 7; | ||
if (!this.vShowWeekends) { | ||
vHeaderCellClass += ' tinytext'; | ||
colspan = 5; | ||
} | ||
vTmpCell = this.newNode(vTmpRow, 'td', null, vHeaderCellClass, null, null, null, null, colspan); | ||
vCellContents += formatDateStr(vTmpDate, this.vDayMajorDateDisplayFormat, this.vLangs[this.vLang]); | ||
@@ -655,3 +662,4 @@ vTmpDate.setDate(vTmpDate.getDate() + 6); | ||
this.newNode(vTmpCell, 'div', null, null, vCellContents, vColWidth * 7); | ||
this.newNode(vTmpCell, 'div', null, null, vCellContents, vColWidth * colspan); | ||
vTmpDate.setDate(vTmpDate.getDate() + 1); | ||
@@ -702,2 +710,6 @@ } | ||
if (vTmpDate.getDay() % 6 == 0) { | ||
if (!this.vShowWeekends) { | ||
vTmpDate.setDate(vTmpDate.getDate() + 1); | ||
continue; | ||
} | ||
vHeaderCellClass += 'wkend'; | ||
@@ -811,4 +823,4 @@ } | ||
vTaskLeftPx = getOffset(vMinDate, curTaskStart, vColWidth, this.vFormat); | ||
vTaskRightPx = getOffset(curTaskStart, curTaskEnd, vColWidth, this.vFormat); | ||
vTaskLeftPx = getOffset(vMinDate, curTaskStart, vColWidth, this.vFormat, this.vShowWeekends); | ||
vTaskRightPx = getOffset(curTaskStart, curTaskEnd, vColWidth, this.vFormat, this.vShowWeekends); | ||
@@ -823,4 +835,4 @@ let curTaskPlanStart, curTaskPlanEnd; | ||
vTaskPlanLeftPx = getOffset(vMinDate, curTaskPlanStart, vColWidth, this.vFormat); | ||
vTaskPlanRightPx = getOffset(curTaskPlanStart, curTaskPlanEnd, vColWidth, this.vFormat); | ||
vTaskPlanLeftPx = getOffset(vMinDate, curTaskPlanStart, vColWidth, this.vFormat, this.vShowWeekends); | ||
vTaskPlanRightPx = getOffset(curTaskPlanStart, curTaskPlanEnd, vColWidth, this.vFormat, this.vShowWeekends); | ||
} else { | ||
@@ -1030,3 +1042,3 @@ vTaskPlanLeftPx = vTaskPlanRightPx = 0; | ||
else vScrollDate.setHours(0, 0, 0, 0); | ||
vScrollPx = getOffset(vMinDate, vScrollDate, vColWidth, this.vFormat); | ||
vScrollPx = getOffset(vMinDate, vScrollDate, vColWidth, this.vFormat, this.vShowWeekends); | ||
} | ||
@@ -1036,3 +1048,3 @@ this.getChartBody().scrollLeft = vScrollPx; | ||
if (vMinDate.getTime() <= (new Date()).getTime() && vMaxDate.getTime() >= (new Date()).getTime()) this.vTodayPx = getOffset(vMinDate, new Date(), vColWidth, this.vFormat); | ||
if (vMinDate.getTime() <= (new Date()).getTime() && vMaxDate.getTime() >= (new Date()).getTime()) this.vTodayPx = getOffset(vMinDate, new Date(), vColWidth, this.vFormat, this.vShowWeekends); | ||
else this.vTodayPx = -1; | ||
@@ -1060,3 +1072,3 @@ | ||
this.chartRowDateToX = function (date) { | ||
return getOffset(vMinDate, date, vColWidth, this.vFormat); | ||
return getOffset(vMinDate, date, vColWidth, this.vFormat, this.vShowWeekends); | ||
} | ||
@@ -1063,0 +1075,0 @@ |
@@ -60,2 +60,3 @@ import { parseDateFormatStr } from "./utils"; | ||
this.setShowEndWeekDate = function (pVal) { this.vShowEndWeekDate = pVal; }; | ||
this.setShowWeekends = function (pVal) { this.vShowWeekends = pVal; }; | ||
this.setShowSelector = function () { | ||
@@ -153,2 +154,3 @@ let vValidSelectors = 'top bottom'; | ||
this.getShowEndWeekDate = function () { return this.vShowEndWeekDate; }; | ||
this.getShowWeekends = function () { return this.vShowWeekends; }; | ||
this.getShowSelector = function () { return this.vShowSelector; }; | ||
@@ -155,0 +157,0 @@ this.getShowDeps = function () { return this.vShowDeps; }; |
@@ -383,3 +383,3 @@ | ||
export const getOffset = function (pStartDate, pEndDate, pColWidth, pFormat) { | ||
export const getOffset = function (pStartDate, pEndDate, pColWidth, pFormat, pShowWeekends) { | ||
const DAY_CELL_MARGIN_WIDTH = 3; // Cell margin for 'day' format | ||
@@ -397,7 +397,20 @@ const WEEK_CELL_MARGIN_WIDTH = 3; // Cell margin for 'week' format | ||
let tmpTaskEnd = Date.UTC(curTaskEnd.getFullYear(), curTaskEnd.getMonth(), curTaskEnd.getDate(), curTaskEnd.getHours(), 0, 0); | ||
const oneHour = 3600000 | ||
let vTaskRight = (tmpTaskEnd - tmpTaskStart) / oneHour; // Length of task in hours | ||
let vTaskRight = (tmpTaskEnd - tmpTaskStart) / 3600000; // Length of task in hours | ||
let vPosTmpDate; | ||
if (pFormat == 'day') { | ||
if (!pShowWeekends) { | ||
let start = curTaskStart; | ||
let end = curTaskEnd; | ||
let countWeekends = 0; | ||
while (start < end) { | ||
const day = start.getDay(); | ||
if (day === 6 || day == 0) { | ||
countWeekends++ | ||
} | ||
start = new Date(start.getTime() + 24 * oneHour); | ||
} | ||
vTaskRight -= countWeekends * 24; | ||
} | ||
vTaskRightPx = Math.ceil((vTaskRight / 24) * (pColWidth + DAY_CELL_MARGIN_WIDTH) - 1); | ||
@@ -404,0 +417,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5045975
116212
156