Skip to content

Commit e8f3fb4

Browse files
authored
Merge pull request #1 from jsGanttImproved/master
Update repo
2 parents 3e84584 + 071209a commit e8f3fb4

File tree

4 files changed

+41
-23
lines changed

4 files changed

+41
-23
lines changed

dist/jsgantt.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,7 @@ exports.GanttChart = function (pDiv, pFormat) {
457457
this.setChartTable(vTmpTab);
458458
draw_utils_1.newNode(vTmpDiv, 'div', null, 'rhscrpad', null, null, vTaskLeftPx + 1);
459459
var vTmpTBody = draw_utils_1.newNode(vTmpTab, 'tbody');
460+
var vTmpTFoot = draw_utils_1.newNode(vTmpTab, 'tfoot');
460461
events_1.syncScroll([vTmpContentTabWrapper, vTmpDiv], 'scrollTop');
461462
events_1.syncScroll([gChartLbl, vTmpDiv], 'scrollLeft');
462463
events_1.syncScroll([vTmpContentTabWrapper, gListLbl], 'scrollLeft');
@@ -514,7 +515,7 @@ exports.GanttChart = function (pDiv, pFormat) {
514515
}
515516
else {
516517
var vTaskWidth = vTaskRightPx;
517-
// Draw Group Bar which has outer div with inner group div
518+
// Draw Group Bar which has outer div with inner group div
518519
// and several small divs to left and right to create angled-end indicators
519520
if (this.vTaskList[i].getGroup()) {
520521
vTaskWidth = (vTaskWidth > this.vMinGpLen && vTaskWidth < this.vMinGpLen * 2) ? this.vMinGpLen * 2 : vTaskWidth; // Expand to show two end points
@@ -626,7 +627,16 @@ exports.GanttChart = function (pDiv, pFormat) {
626627
}
627628
}
628629
// Include the footer with the days/week/month...
629-
vTmpTBody.appendChild(vDateRow.cloneNode(true));
630+
if (vSingleCell) {
631+
var vTmpTFootTRow = draw_utils_1.newNode(vTmpTFoot, 'tr');
632+
var vTmpTFootTCell = draw_utils_1.newNode(vTmpTFootTRow, 'td', null, null, null, '100%');
633+
var vTmpTFootTCellTable = draw_utils_1.newNode(vTmpTFootTCell, 'table', null, 'gcharttableh', null, '100%');
634+
var vTmpTFootTCellTableTBody = draw_utils_1.newNode(vTmpTFootTCellTable, 'tbody');
635+
vTmpTFootTCellTableTBody.appendChild(vDateRow.cloneNode(true));
636+
}
637+
else {
638+
vTmpTFoot.appendChild(vDateRow.cloneNode(true));
639+
}
630640
return { vRightTable: vRightTable };
631641
};
632642
this.drawColsChart = function (vNumCols, vTmpRow, taskCellWidth) {
@@ -3739,8 +3749,12 @@ exports.processRows = function (pList, pID, pRow, pLevel, pOpen, pUseSort, vDebu
37393749
if (pList[pRow].getGroupMinPlanEnd() != null && pList[pRow].getGroupMinPlanEnd() > vMaxPlanDate) {
37403750
vMaxPlanDate = pList[pRow].getGroupMinPlanEnd();
37413751
}
3742-
pList[pRow].setPlanStart(vMinPlanDate);
3743-
pList[pRow].setPlanEnd(vMaxPlanDate);
3752+
if (vMinPlanDate) {
3753+
pList[pRow].setPlanStart(vMinPlanDate);
3754+
}
3755+
if (vMaxPlanDate) {
3756+
pList[pRow].setPlanEnd(vMaxPlanDate);
3757+
}
37443758
pList[pRow].setNumKid(vNumKid);
37453759
pList[pRow].setWeight(vWeight);
37463760
pList[pRow].setCompVal(Math.ceil(vCompSum / vWeight));

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jsgantt-improved",
3-
"version": "2.6.3",
3+
"version": "2.6.4",
44
"description": "jsgantt-improved",
55
"main": "dist/index.js",
66
"scripts": {

src/draw.ts

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -315,9 +315,9 @@ export const GanttChart = function (pDiv, pFormat) {
315315
}
316316

317317
/**
318-
*
318+
*
319319
* DRAW CHAR HEAD
320-
*
320+
*
321321
*/
322322
this.drawChartHead = function (vMinDate, vMaxDate, vColWidth, vNumRows) {
323323
let vRightHeader = document.createDocumentFragment();
@@ -474,7 +474,7 @@ export const GanttChart = function (pDiv, pFormat) {
474474
vTmpTab.style.width = vTaskLeftPx + 'px'; // Ensure that the headings has exactly the same width as the chart grid
475475
// const vTaskPlanLeftPx = (vNumCols * (vColWidth + 3)) + 1;
476476
let vSingleCell = false;
477-
477+
478478
if (this.vUseSingleCell !== 0 && this.vUseSingleCell < (vNumCols * vNumRows)) vSingleCell = true;
479479

480480
newNode(vTmpDiv, 'div', null, 'rhscrpad', null, null, vTaskLeftPx + 1);
@@ -485,9 +485,9 @@ export const GanttChart = function (pDiv, pFormat) {
485485
}
486486

487487
/**
488-
*
488+
*
489489
* DRAW CHART BODY
490-
*
490+
*
491491
*/
492492
this.drawCharBody = function (vTaskLeftPx, vTmpContentTabWrapper, gChartLbl, gListLbl,
493493
vMinDate, vSingleCell, vNumCols, vColWidth, vDateRow) {
@@ -498,6 +498,7 @@ export const GanttChart = function (pDiv, pFormat) {
498498
this.setChartTable(vTmpTab);
499499
newNode(vTmpDiv, 'div', null, 'rhscrpad', null, null, vTaskLeftPx + 1);
500500
const vTmpTBody = newNode(vTmpTab, 'tbody');
501+
const vTmpTFoot = newNode(vTmpTab, 'tfoot');
501502

502503
syncScroll([vTmpContentTabWrapper, vTmpDiv], 'scrollTop');
503504
syncScroll([gChartLbl, vTmpDiv], 'scrollLeft');
@@ -569,7 +570,7 @@ export const GanttChart = function (pDiv, pFormat) {
569570
else {
570571
let vTaskWidth = vTaskRightPx;
571572

572-
// Draw Group Bar which has outer div with inner group div
573+
// Draw Group Bar which has outer div with inner group div
573574
// and several small divs to left and right to create angled-end indicators
574575
if (this.vTaskList[i].getGroup()) {
575576
vTaskWidth = (vTaskWidth > this.vMinGpLen && vTaskWidth < this.vMinGpLen * 2) ? this.vMinGpLen * 2 : vTaskWidth; // Expand to show two end points
@@ -689,7 +690,15 @@ export const GanttChart = function (pDiv, pFormat) {
689690
}
690691

691692
// Include the footer with the days/week/month...
692-
vTmpTBody.appendChild(vDateRow.cloneNode(true));
693+
if (vSingleCell) {
694+
const vTmpTFootTRow = newNode(vTmpTFoot, 'tr');
695+
const vTmpTFootTCell = newNode(vTmpTFootTRow, 'td', null, null, null, '100%');
696+
const vTmpTFootTCellTable = newNode(vTmpTFootTCell, 'table', null, 'gcharttableh', null, '100%');
697+
const vTmpTFootTCellTableTBody = newNode(vTmpTFootTCellTable, 'tbody');
698+
vTmpTFootTCellTableTBody.appendChild(vDateRow.cloneNode(true));
699+
} else {
700+
vTmpTFoot.appendChild(vDateRow.cloneNode(true));
701+
}
693702

694703
return { vRightTable }
695704
}
@@ -702,22 +711,22 @@ export const GanttChart = function (pDiv, pFormat) {
702711
newNode(vTmpRow, 'td', null, vCellFormat, '\u00A0\u00A0', taskCellWidth);
703712
}
704713

705-
714+
706715
}
707716

708717
/**
709-
*
710-
*
718+
*
719+
*
711720
* DRAWING PROCESS
712-
*
721+
*
713722
* vTaskRightPx,vTaskWidth,vTaskPlanLeftPx,vTaskPlanRightPx,vID
714723
*/
715724
this.Draw = function () {
716725
let vMaxDate = new Date();
717726
let vMinDate = new Date();
718727
let vColWidth = 0;
719728
let bd;
720-
729+
721730
if (this.vEvents && this.vEvents.beforeDraw) {
722731
this.vEvents.beforeDraw();
723732
}
@@ -752,7 +761,7 @@ export const GanttChart = function (pDiv, pFormat) {
752761

753762

754763
/**
755-
* LIST HEAD
764+
* LIST HEAD
756765
*/
757766
const gListLbl = this.drawListHead(vLeftHeader);
758767

@@ -889,4 +898,3 @@ export const GanttChart = function (pDiv, pFormat) {
889898

890899
if (this.vDiv && this.vDiv.nodeName && this.vDiv.nodeName.toLowerCase() == 'div') this.vDivId = this.vDiv.id;
891900
}; //GanttChart
892-

src/draw_columns.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { AddTaskItemObject } from "./task";
33
import { addListenerInputCell, addListenerClickCell } from "./events";
44
import { newNode, makeInput } from "./utils/draw_utils";
55

6-
76
export const COLUMN_ORDER = [
87
'vShowRes',
98
'vShowDur',
@@ -17,7 +16,6 @@ export const COLUMN_ORDER = [
1716
'vShowAddEntries'
1817
];
1918

20-
2119
export const draw_header = function (column, i, vTmpRow, vTaskList, vEditable, vEventsChange, vEvents,
2220
vDateTaskTableDisplayFormat, vAdditionalHeaders, vFormat, vLangs, vLang, vResources, Draw) {
2321
let vTmpCell, vTmpDiv;
@@ -141,7 +139,6 @@ export const draw_bottom = function (column, vTmpRow, vAdditionalHeaders) {
141139
}
142140

143141
export const draw_list_headings = function (column, vTmpRow, vAdditionalHeaders) {
144-
145142
if ('vShowRes' === column) newNode(vTmpRow, 'td', null, 'gspanning gresource', '\u00A0');
146143
if ('vShowDur' === column) newNode(vTmpRow, 'td', null, 'gspanning gduration', '\u00A0');
147144
if ('vShowComp' === column) newNode(vTmpRow, 'td', null, 'gspanning gpccomplete', '\u00A0');
@@ -161,7 +158,6 @@ export const draw_list_headings = function (column, vTmpRow, vAdditionalHeaders)
161158
}
162159

163160
export const draw_task_headings = function (column, vTmpRow, vLangs, vLang, vAdditionalHeaders) {
164-
165161
if ('vShowRes' === column) newNode(vTmpRow, 'td', null, 'gtaskheading gresource', vLangs[vLang]['resource']);
166162
if ('vShowDur' === column) newNode(vTmpRow, 'td', null, 'gtaskheading gduration', vLangs[vLang]['duration']);
167163
if ('vShowComp' === column) newNode(vTmpRow, 'td', null, 'gtaskheading gpccomplete', vLangs[vLang]['comp']);

0 commit comments

Comments
 (0)