jsgantt-improved
Advanced tools
Comparing version 2.0.2 to 2.0.3
@@ -8,3 +8,3 @@ "use strict"; | ||
NgPackagedPage.prototype.navigateTo = function () { | ||
return protractor_1.browser.get('/'); | ||
return protractor_1.browser.get('/demo.html'); | ||
}; | ||
@@ -11,0 +11,0 @@ NgPackagedPage.prototype.getParagraphText = function () { |
@@ -28,2 +28,3 @@ "use strict"; | ||
this.vShowPlanStartDate = 0; | ||
this.vShowPlanEndDate = 0; | ||
this.vShowCost = 0; | ||
@@ -39,3 +40,14 @@ this.vShowPlanEndDate = 0; | ||
this.vShowTaskInfoLink = 0; | ||
this.vShowDeps = 1; | ||
this.vEventClickRow = 1; | ||
this.vEvents = { | ||
taskname: null, | ||
res: null, | ||
dur: null, | ||
comp: null, | ||
startdate: null, | ||
enddate: null, | ||
planstartdate: null, | ||
planenddate: null, | ||
cost: null, | ||
}; | ||
this.vShowSelector = new Array('top'); | ||
@@ -242,5 +254,4 @@ this.vDateInputFormat = 'yyyy-mm-dd'; | ||
} | ||
// I wish I could do this with setAttribute but older IEs don't play nice | ||
if (pId) | ||
vNewNode.id = pId; | ||
vNewNode.id = pId; // I wish I could do this with setAttribute but older IEs don't play nice | ||
if (pClass) | ||
@@ -252,4 +263,10 @@ vNewNode.className = pClass; | ||
vNewNode.style.left = (isNaN(pLeft * 1)) ? pLeft : pLeft + 'px'; | ||
if (pText) | ||
vNewNode.appendChild(document.createTextNode(pText)); | ||
if (pText) { | ||
if (pText.indexOf && pText.indexOf('<') === -1) { | ||
vNewNode.appendChild(document.createTextNode(pText)); | ||
} | ||
else { | ||
vNewNode.insertAdjacentHTML('beforeend', pText); | ||
} | ||
} | ||
if (pDisplay) | ||
@@ -353,67 +370,86 @@ vNewNode.style.display = pDisplay; | ||
vTmpTBody = this.newNode(vTmpTab, 'tbody'); | ||
for (i = 0; i < this.vTaskList.length; i++) { | ||
if (this.vTaskList[i].getGroup() == 1) | ||
var vBGColor = 'ggroupitem'; | ||
var _loop_1 = function () { | ||
if (this_1.vTaskList[i].getGroup() == 1) | ||
vBGColor = 'ggroupitem'; | ||
else | ||
vBGColor = 'glineitem'; | ||
vID = this.vTaskList[i].getID(); | ||
if ((!(this.vTaskList[i].getParItem() && this.vTaskList[i].getParItem().getGroup() == 2)) || this.vTaskList[i].getGroup() == 2) { | ||
if (this.vTaskList[i].getVisible() == 0) | ||
vTmpRow = this.newNode(vTmpTBody, 'tr', this.vDivId + 'child_' + vID, 'gname ' + vBGColor, null, null, null, 'none'); | ||
vID = this_1.vTaskList[i].getID(); | ||
if ((!(this_1.vTaskList[i].getParItem() && this_1.vTaskList[i].getParItem().getGroup() == 2)) || this_1.vTaskList[i].getGroup() == 2) { | ||
if (this_1.vTaskList[i].getVisible() == 0) | ||
vTmpRow = this_1.newNode(vTmpTBody, 'tr', this_1.vDivId + 'child_' + vID, 'gname ' + vBGColor, null, null, null, 'none'); | ||
else | ||
vTmpRow = this.newNode(vTmpTBody, 'tr', this.vDivId + 'child_' + vID, 'gname ' + vBGColor); | ||
this.vTaskList[i].setListChildRow(vTmpRow); | ||
this.newNode(vTmpRow, 'td', null, 'gtasklist', '\u00A0'); | ||
vTmpCell = this.newNode(vTmpRow, 'td', null, 'gtaskname'); | ||
var vCellContents = ''; | ||
for (j = 1; j < this.vTaskList[i].getLevel(); j++) { | ||
vTmpRow = this_1.newNode(vTmpTBody, 'tr', this_1.vDivId + 'child_' + vID, 'gname ' + vBGColor); | ||
this_1.vTaskList[i].setListChildRow(vTmpRow); | ||
this_1.newNode(vTmpRow, 'td', null, 'gtasklist', '\u00A0'); | ||
vTmpCell = this_1.newNode(vTmpRow, 'td', null, 'gtaskname'); | ||
vCellContents = ''; | ||
for (j = 1; j < this_1.vTaskList[i].getLevel(); j++) { | ||
vCellContents += '\u00A0\u00A0\u00A0\u00A0'; | ||
} | ||
if (this.vTaskList[i].getGroup() == 1) { | ||
vTmpDiv = this.newNode(vTmpCell, 'div', null, null, vCellContents); | ||
var vTmpSpan = this.newNode(vTmpDiv, 'span', this.vDivId + 'group_' + vID, 'gfoldercollapse', (this.vTaskList[i].getOpen() == 1) ? '-' : '+'); | ||
this.vTaskList[i].setGroupSpan(vTmpSpan); | ||
events_1.addFolderListeners(this, vTmpSpan, vID); | ||
vTmpDiv.appendChild(document.createTextNode('\u00A0' + this.vTaskList[i].getName())); | ||
var task_2 = this_1.vTaskList[i]; | ||
var vEventClickRow_1 = this_1.vEventClickRow; | ||
events_1.addListener('click', function () { | ||
if (vEventClickRow_1 && typeof vEventClickRow_1 === "function") { | ||
vEventClickRow_1(task_2); | ||
} | ||
}, vTmpRow); | ||
if (this_1.vTaskList[i].getGroup() == 1) { | ||
vTmpDiv = this_1.newNode(vTmpCell, 'div', null, null, vCellContents); | ||
vTmpSpan = this_1.newNode(vTmpDiv, 'span', this_1.vDivId + 'group_' + vID, 'gfoldercollapse', (this_1.vTaskList[i].getOpen() == 1) ? '-' : '+'); | ||
this_1.vTaskList[i].setGroupSpan(vTmpSpan); | ||
events_1.addFolderListeners(this_1, vTmpSpan, vID); | ||
vTmpDiv.appendChild(document.createTextNode('\u00A0' + this_1.vTaskList[i].getName())); | ||
} | ||
else { | ||
vCellContents += '\u00A0\u00A0\u00A0\u00A0'; | ||
vTmpDiv = this.newNode(vTmpCell, 'div', null, null, vCellContents + this.vTaskList[i].getName()); | ||
vTmpDiv = this_1.newNode(vTmpCell, 'div', null, null, vCellContents + this_1.vTaskList[i].getName()); | ||
} | ||
if (this.vShowRes == 1) { | ||
vTmpCell = this.newNode(vTmpRow, 'td', null, 'gresource'); | ||
vTmpDiv = this.newNode(vTmpCell, 'div', null, null, this.vTaskList[i].getResource()); | ||
if (this_1.vShowRes == 1) { | ||
vTmpCell = this_1.newNode(vTmpRow, 'td', null, 'gresource'); | ||
vTmpDiv = this_1.newNode(vTmpCell, 'div', null, null, this_1.vTaskList[i].getResource()); | ||
events_1.addListenerClickCell(vTmpCell, this_1.vEvents, this_1.vTaskList[i], 'res'); | ||
} | ||
if (this.vShowDur == 1) { | ||
vTmpCell = this.newNode(vTmpRow, 'td', null, 'gduration'); | ||
vTmpDiv = this.newNode(vTmpCell, 'div', null, null, this.vTaskList[i].getDuration(this.vFormat, this.vLangs[this.vLang])); | ||
if (this_1.vShowDur == 1) { | ||
vTmpCell = this_1.newNode(vTmpRow, 'td', null, 'gduration'); | ||
vTmpDiv = this_1.newNode(vTmpCell, 'div', null, null, this_1.vTaskList[i].getDuration(this_1.vFormat, this_1.vLangs[this_1.vLang])); | ||
events_1.addListenerClickCell(vTmpCell, this_1.vEvents, this_1.vTaskList[i], 'dur'); | ||
} | ||
if (this.vShowComp == 1) { | ||
vTmpCell = this.newNode(vTmpRow, 'td', null, 'gpccomplete'); | ||
vTmpDiv = this.newNode(vTmpCell, 'div', null, null, this.vTaskList[i].getCompStr()); | ||
if (this_1.vShowComp == 1) { | ||
vTmpCell = this_1.newNode(vTmpRow, 'td', null, 'gpccomplete'); | ||
vTmpDiv = this_1.newNode(vTmpCell, 'div', null, null, this_1.vTaskList[i].getCompStr()); | ||
events_1.addListenerClickCell(vTmpCell, this_1.vEvents, this_1.vTaskList[i], 'comp'); | ||
} | ||
if (this.vShowStartDate == 1) { | ||
vTmpCell = this.newNode(vTmpRow, 'td', null, 'gstartdate'); | ||
vTmpDiv = this.newNode(vTmpCell, 'div', null, null, utils_1.formatDateStr(this.vTaskList[i].getStart(), this.vDateTaskTableDisplayFormat, this.vLangs[this.vLang])); | ||
if (this_1.vShowStartDate == 1) { | ||
vTmpCell = this_1.newNode(vTmpRow, 'td', null, 'gstartdate'); | ||
vTmpDiv = this_1.newNode(vTmpCell, 'div', null, null, utils_1.formatDateStr(this_1.vTaskList[i].getStart(), this_1.vDateTaskTableDisplayFormat, this_1.vLangs[this_1.vLang])); | ||
events_1.addListenerClickCell(vTmpCell, this_1.vEvents, this_1.vTaskList[i], 'startdate'); | ||
} | ||
if (this.vShowEndDate == 1) { | ||
vTmpCell = this.newNode(vTmpRow, 'td', null, 'genddate'); | ||
vTmpDiv = this.newNode(vTmpCell, 'div', null, null, utils_1.formatDateStr(this.vTaskList[i].getEnd(), this.vDateTaskTableDisplayFormat, this.vLangs[this.vLang])); | ||
if (this_1.vShowEndDate == 1) { | ||
vTmpCell = this_1.newNode(vTmpRow, 'td', null, 'genddate'); | ||
vTmpDiv = this_1.newNode(vTmpCell, 'div', null, null, utils_1.formatDateStr(this_1.vTaskList[i].getEnd(), this_1.vDateTaskTableDisplayFormat, this_1.vLangs[this_1.vLang])); | ||
events_1.addListenerClickCell(vTmpCell, this_1.vEvents, this_1.vTaskList[i], 'enddate'); | ||
} | ||
if (this.vShowPlanStartDate == 1) { | ||
vTmpCell = this.newNode(vTmpRow, 'td', null, 'gplanstartdate'); | ||
var v = this.vTaskList[i].getPlanStart() ? utils_1.formatDateStr(this.vTaskList[i].getPlanStart(), this.vDateTaskTableDisplayFormat, this.vLangs[this.vLang]) : ''; | ||
vTmpDiv = this.newNode(vTmpCell, 'div', null, null, v); | ||
if (this_1.vShowPlanStartDate == 1) { | ||
vTmpCell = this_1.newNode(vTmpRow, 'td', null, 'gplanstartdate'); | ||
var v = this_1.vTaskList[i].getPlanStart() ? utils_1.formatDateStr(this_1.vTaskList[i].getPlanStart(), this_1.vDateTaskTableDisplayFormat, this_1.vLangs[this_1.vLang]) : ''; | ||
vTmpDiv = this_1.newNode(vTmpCell, 'div', null, null, v); | ||
events_1.addListenerClickCell(vTmpCell, this_1.vEvents, this_1.vTaskList[i], 'planstartdate'); | ||
} | ||
if (this.vShowPlanEndDate == 1) { | ||
vTmpCell = this.newNode(vTmpRow, 'td', null, 'gplanenddate'); | ||
var v = this.vTaskList[i].getPlanEnd() ? utils_1.formatDateStr(this.vTaskList[i].getPlanEnd(), this.vDateTaskTableDisplayFormat, this.vLangs[this.vLang]) : ''; | ||
vTmpDiv = this.newNode(vTmpCell, 'div', null, null, v); | ||
if (this_1.vShowPlanEndDate == 1) { | ||
vTmpCell = this_1.newNode(vTmpRow, 'td', null, 'gplanenddate'); | ||
var v = this_1.vTaskList[i].getPlanEnd() ? utils_1.formatDateStr(this_1.vTaskList[i].getPlanEnd(), this_1.vDateTaskTableDisplayFormat, this_1.vLangs[this_1.vLang]) : ''; | ||
vTmpDiv = this_1.newNode(vTmpCell, 'div', null, null, v); | ||
events_1.addListenerClickCell(vTmpCell, this_1.vEvents, this_1.vTaskList[i], 'planenddate'); | ||
} | ||
if (this.vShowCost == 1) { | ||
vTmpCell = this.newNode(vTmpRow, 'td', null, 'gcost'); | ||
vTmpDiv = this.newNode(vTmpCell, 'div', null, null, this.vTaskList[i].getCost()); | ||
if (this_1.vShowCost == 1) { | ||
vTmpCell = this_1.newNode(vTmpRow, 'td', null, 'gcost'); | ||
vTmpDiv = this_1.newNode(vTmpCell, 'div', null, null, this_1.vTaskList[i].getCost()); | ||
events_1.addListenerClickCell(vTmpCell, this_1.vEvents, this_1.vTaskList[i], 'costdate'); | ||
} | ||
vNumRows++; | ||
} | ||
}; | ||
var this_1 = this, vBGColor, vCellContents, vTmpSpan; | ||
for (i = 0; i < this.vTaskList.length; i++) { | ||
_loop_1(); | ||
} | ||
@@ -439,2 +475,4 @@ // DRAW the date format selector at bottom left. | ||
this.newNode(vTmpRow, 'td', null, 'gspanning gplanenddate', '\u00A0'); | ||
if (this.vShowCost == 1) | ||
this.newNode(vTmpRow, 'td', null, 'gspanning gcost', '\u00A0'); | ||
// Add some white space so the vertical scroll distance should always be greater | ||
@@ -609,3 +647,2 @@ // than for the right pane (keep to a minimum as it is seen in unconstrained height designs) | ||
var vTmpItem = this.vTaskList[i]; | ||
var vCaptionStr = ''; | ||
var vCaptClass = null; | ||
@@ -618,3 +655,3 @@ if (this.vTaskList[i].getMile() && !vComb) { | ||
vTmpDiv = this.newNode(vTmpCell, 'div', null, 'gtaskcelldiv', '\u00A0\u00A0'); | ||
vTmpDiv = this.newNode(vTmpDiv, 'div', this.vDivId + 'bardiv_' + vID, 'gtaskbarcontainer', null, 12, vTaskLeftPx - 6); | ||
vTmpDiv = this.newNode(vTmpDiv, 'div', this.vDivId + 'bardiv_' + vID, 'gtaskbarcontainer', null, 12, vTaskLeftPx + vTaskRightPx - 6); | ||
this.vTaskList[i].setBarDiv(vTmpDiv); | ||
@@ -724,18 +761,18 @@ vTmpDiv2 = this.newNode(vTmpDiv, 'div', this.vDivId + 'taskbar_' + vID, this.vTaskList[i].getClass(), null, 12); | ||
if (this.getCaptionType() && vCaptClass !== null) { | ||
var vCaptionStr_1 = void 0; | ||
var vCaptionStr = void 0; | ||
switch (this.getCaptionType()) { | ||
case 'Caption': | ||
vCaptionStr_1 = vTmpItem.getCaption(); | ||
vCaptionStr = vTmpItem.getCaption(); | ||
break; | ||
case 'Resource': | ||
vCaptionStr_1 = vTmpItem.getResource(); | ||
vCaptionStr = vTmpItem.getResource(); | ||
break; | ||
case 'Duration': | ||
vCaptionStr_1 = vTmpItem.getDuration(this.vFormat, this.vLangs[this.vLang]); | ||
vCaptionStr = vTmpItem.getDuration(this.vFormat, this.vLangs[this.vLang]); | ||
break; | ||
case 'Complete': | ||
vCaptionStr_1 = vTmpItem.getCompStr(); | ||
vCaptionStr = vTmpItem.getCompStr(); | ||
break; | ||
} | ||
this.newNode(vTmpDiv, 'div', null, vCaptClass, vCaptionStr_1, 120, (vCaptClass == 'gmilecaption') ? 12 : 0); | ||
this.newNode(vTmpDiv, 'div', null, vCaptClass, vCaptionStr, 120, (vCaptClass == 'gmilecaption') ? 12 : 0); | ||
} | ||
@@ -742,0 +779,0 @@ // Add Task Info div for tooltip |
@@ -135,2 +135,9 @@ "use strict"; | ||
}; | ||
exports.addListenerClickCell = function (vTmpCell, vEvents, task, column) { | ||
exports.addListener('click', function () { | ||
if (vEvents[column] && typeof vEvents[column] === 'function') { | ||
vEvents[column](task); | ||
} | ||
}, vTmpCell); | ||
}; | ||
//# sourceMappingURL=events.js.map |
@@ -249,3 +249,3 @@ "use strict"; | ||
'planenddate': 'Plan Data final', | ||
'cost': 'Cost', | ||
'cost': 'Custo', | ||
'jan': 'Jan', | ||
@@ -252,0 +252,0 @@ 'feb': 'Fev', |
@@ -5,2 +5,5 @@ "use strict"; | ||
exports.includeGetSet = function () { | ||
/** | ||
* SETTERS | ||
*/ | ||
this.setOptions = function (options) { | ||
@@ -113,2 +116,7 @@ var keys = Object.keys(options); | ||
}; | ||
this.setEvents = function (pEvents) { this.vEvents = pEvents; }; | ||
this.setEventClickRow = function (fn) { this.vEventClickRow = fn; }; | ||
/** | ||
* GETTERS | ||
*/ | ||
this.getDivId = function () { return this.vDivId; }; | ||
@@ -170,3 +178,5 @@ this.getUseFade = function () { return this.vUseFade; }; | ||
this.getList = function () { return this.vTaskList; }; | ||
this.getEventsClickCell = function () { return this.vEvents; }; | ||
this.getEventClickRow = function () { return this.vEventClickRow; }; | ||
}; | ||
//# sourceMappingURL=options.js.map |
@@ -136,4 +136,5 @@ "use strict"; | ||
if (pPlanEnd === void 0) { pPlanEnd = null; } | ||
var vBenchTime = new Date().getTime(); | ||
var vID = parseInt(document.createTextNode(pID).data); | ||
var vGantt = pGantt ? pGantt : g; //hack for backwards compatibility | ||
var _id = document.createTextNode(pID).data; | ||
var vID = utils_1.hashKey(document.createTextNode(pID).data); | ||
var vName = document.createTextNode(pName).data; | ||
@@ -153,3 +154,7 @@ var vStart = null; | ||
var vGroup = parseInt(document.createTextNode(pGroup).data); | ||
var vParent = document.createTextNode(pParent).data; | ||
var parent = document.createTextNode(pParent).data; | ||
if (parent && parent !== '0') { | ||
parent = utils_1.hashKey(parent).toString(); | ||
} | ||
var vParent = parent; | ||
var vOpen = (vGroup == 2) ? 1 : parseInt(document.createTextNode(pOpen).data); | ||
@@ -170,3 +175,2 @@ var vDepend = new Array(); | ||
var vCellDiv = null; | ||
var vGantt = pGantt ? pGantt : g; //hack for backwards compatibility | ||
var vBarDiv = null; | ||
@@ -203,2 +207,3 @@ var vTaskDiv = null; | ||
var n = vDepList.length; | ||
var vGantt_1 = pGantt ? pGantt : g; | ||
for (var k = 0; k < n; k++) { | ||
@@ -225,5 +230,9 @@ if (vDepList[k].toUpperCase().indexOf('SS') != -1) { | ||
} | ||
if (vDepend[k]) { | ||
vDepend[k] = utils_1.hashKey(vDepend[k]).toString(); | ||
} | ||
} | ||
} | ||
this.getID = function () { return vID; }; | ||
this.getOriginalID = function () { return _id; }; | ||
this.getName = function () { return vName; }; | ||
@@ -254,6 +263,8 @@ this.getStart = function () { | ||
this.getMile = function () { return vMile; }; | ||
this.getDepend = function () { if (vDepend) | ||
return vDepend; | ||
else | ||
return null; }; | ||
this.getDepend = function () { | ||
if (vDepend) | ||
return vDepend; | ||
else | ||
return null; | ||
}; | ||
this.getDepType = function () { if (vDependType) | ||
@@ -314,3 +325,3 @@ return vDependType; | ||
if (Math.floor(tmpPer) != tmpPer) | ||
tmpPer = Math.round(tmpPer * 10) / 10; | ||
tmpPer = Math.round(tmpPer); | ||
switch (vUnits) { | ||
@@ -317,0 +328,0 @@ case 'hour': |
@@ -171,3 +171,3 @@ "use strict"; | ||
case 'qq': | ||
vDateStr += 'Q'; // now fall through | ||
vDateStr += pL['qtr']; // now fall through | ||
case 'q': | ||
@@ -414,2 +414,22 @@ vDateStr += Math.floor(pDate.getMonth() / 3) + 1; | ||
}; | ||
exports.hashString = function (key) { | ||
if (!key) { | ||
key = 'default'; | ||
} | ||
key += ''; | ||
var hash = 5381; | ||
for (var i = 0; i < key.length; i++) { | ||
if (key.charCodeAt) { | ||
// tslint:disable-next-line:no-bitwise | ||
hash = (hash << 5) + hash + key.charCodeAt(i); | ||
} | ||
// tslint:disable-next-line:no-bitwise | ||
hash = hash & hash; | ||
} | ||
// tslint:disable-next-line:no-bitwise | ||
return hash >>> 0; | ||
}; | ||
exports.hashKey = function (key) { | ||
return this.hashString(key) % 10000; | ||
}; | ||
//# sourceMappingURL=utils.js.map |
@@ -5,3 +5,3 @@ import { browser, by, element } from 'protractor'; | ||
navigateTo() { | ||
return browser.get('/'); | ||
return browser.get('/demo.html'); | ||
} | ||
@@ -8,0 +8,0 @@ |
{ | ||
"name": "jsgantt-improved", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "jsgantt-improved", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"start": "node server.js", | ||
"build": "tsc", | ||
@@ -14,3 +15,3 @@ "watch": "onchange 'src/**' '*.*' -- npm run build", | ||
"browserify": "browserify dist/index.js --standalone JSGantt > jsgantt.js", | ||
"dist": "npm run build && npm run browserify && cp src/jsgantt.css dist/ && cp jsgantt.js dist/ && cp jsgantt.js demo/ && cp src/jsgantt.css demo/ && echo 'DIST finished'", | ||
"dist": "npm run build && npm run browserify && cp src/jsgantt.css dist/ && cp jsgantt.js dist/ && cp jsgantt.js docs/ && cp src/jsgantt.css docs/ && echo 'DIST finished'", | ||
"publish-npm": "npm run dist && npm publish", | ||
@@ -17,0 +18,0 @@ "demo": "nodemon server.js", |
@@ -1,2 +0,2 @@ | ||
[![Build Status](https://travis-ci.org/mariohmol/jsgantt-improved.svg?branch=master)](https://travis-ci.org/mariohmol/jsgantt-improved) | ||
[![Build Status](https://travis-ci.com/jsGanttImproved/jsgantt-improved.svg?branch=master)](https://travis-ci.com/jsGanttImproved/jsgantt-improved) | ||
@@ -7,6 +7,6 @@ | ||
![Demo Image](/demo/demo.png) | ||
![Demo Image](/docs/demo.png) | ||
Start using with including the files `jsgantt.js` and `jsgantt.css` that are inside `demo/` folder. | ||
Start using with including the files `jsgantt.js` and `jsgantt.css` that are inside `docs/` folder. | ||
@@ -26,7 +26,11 @@ Or install and use in JS | ||
You can view a live example at | ||
Take a look at this Landing Page with docs and live examples: | ||
https://mariohmol.github.io/jsgantt-improved/demo | ||
* https://jsganttimproved.github.io/jsgantt-improved/docs | ||
You can view a Solo live example at: | ||
https://jsganttimproved.github.io/jsgantt-improved/docs/demo.html | ||
## Easy to Use | ||
@@ -63,3 +67,3 @@ | ||
"pID": 1, | ||
"pName": "Define Chart API", | ||
"pName": "Define Chart <strong>API</strong>", | ||
"pStart": "2017-02-25", | ||
@@ -93,3 +97,3 @@ "pEnd": "2017-03-17", | ||
* Task Completion | ||
* Task Styling | ||
* Task Styling or as HTML tags | ||
* Milestones | ||
@@ -109,3 +113,3 @@ * Resources | ||
See the [Documentation](./Documentation.md) wiki page or the included ``demo/index.html`` file for instructions on use. | ||
See the [Documentation](./Documentation.md) wiki page or the included ``docs/index.html`` file for instructions on use. | ||
@@ -117,5 +121,10 @@ Project based on https://code.google.com/p/jsgantt/. | ||
Clone this repo and run `npm run demo-full`, this will start a `localhost:8080` with a live example. | ||
Do your change in `src` and restart this command to test. | ||
Its easy to get it set: | ||
* Clone this repo | ||
* Install lib dependencies: `npm i` | ||
* Install global dependencies: `npm i -g browserify nodemon` | ||
* Run the demo, This will start a `localhost:8080` with a live example: `npm start`. | ||
* Use `npm run watch:dist` or do your change in `src` and restart this command refresh the changes. | ||
For testing use `npm run test` with e2e tests. |
@@ -5,4 +5,4 @@ const express = require('express'); | ||
app.use(express.static('demo')); | ||
app.use(express.static('docs')); | ||
app.listen(8080, ()=>{ console.log('listening')}); | ||
app.listen(8080, ()=>{ console.log('listening to port 8080')}); |
import * as lang from './lang'; | ||
import { mouseOver, mouseOut, addThisRowListeners, addTooltipListeners, addScrollListeners, addFormatListeners, moveToolTip, addFolderListeners } from "./events"; | ||
import { | ||
mouseOver, mouseOut, addThisRowListeners, addTooltipListeners, addScrollListeners, addFormatListeners, moveToolTip, | ||
addFolderListeners, addListenerClickCell, addListener | ||
} from "./events"; | ||
import { | ||
parseDateFormatStr, formatDateStr, getOffset, parseDateStr, getZoomFactor, | ||
@@ -33,2 +36,3 @@ getScrollPositions, getMaxDate, getMinDate | ||
this.vShowPlanStartDate = 0; | ||
this.vShowPlanEndDate = 0; | ||
this.vShowCost = 0; | ||
@@ -44,3 +48,16 @@ this.vShowPlanEndDate = 0; | ||
this.vShowTaskInfoLink = 0; | ||
this.vShowDeps = 1; | ||
this.vEventClickRow = 1; | ||
this.vEvents = { | ||
taskname: null, | ||
res: null, | ||
dur: null, | ||
comp: null, | ||
startdate: null, | ||
enddate: null, | ||
planstartdate: null, | ||
planenddate: null, | ||
cost: null, | ||
}; | ||
this.vShowSelector = new Array('top'); | ||
@@ -259,8 +276,13 @@ this.vDateInputFormat = 'yyyy-mm-dd'; | ||
} | ||
// I wish I could do this with setAttribute but older IEs don't play nice | ||
if (pId) vNewNode.id = pId; | ||
if (pId) vNewNode.id = pId; // I wish I could do this with setAttribute but older IEs don't play nice | ||
if (pClass) vNewNode.className = pClass; | ||
if (pWidth) vNewNode.style.width = (isNaN(pWidth * 1)) ? pWidth : pWidth + 'px'; | ||
if (pLeft) vNewNode.style.left = (isNaN(pLeft * 1)) ? pLeft : pLeft + 'px'; | ||
if (pText) vNewNode.appendChild(document.createTextNode(pText)); | ||
if (pText) { | ||
if (pText.indexOf && pText.indexOf('<') === -1) { | ||
vNewNode.appendChild(document.createTextNode(pText)); | ||
} else { | ||
vNewNode.insertAdjacentHTML('beforeend', pText); | ||
} | ||
} | ||
if (pDisplay) vNewNode.style.display = pDisplay; | ||
@@ -369,2 +391,12 @@ if (pColspan) vNewNode.colSpan = pColspan; | ||
const task = this.vTaskList[i]; | ||
const vEventClickRow = this.vEventClickRow; | ||
addListener('click', function () { | ||
if (vEventClickRow && typeof vEventClickRow === "function") { | ||
vEventClickRow(task); | ||
} | ||
}, vTmpRow); | ||
if (this.vTaskList[i].getGroup() == 1) { | ||
@@ -385,2 +417,3 @@ vTmpDiv = this.newNode(vTmpCell, 'div', null, null, vCellContents); | ||
vTmpDiv = this.newNode(vTmpCell, 'div', null, null, this.vTaskList[i].getResource()); | ||
addListenerClickCell(vTmpCell, this.vEvents, this.vTaskList[i], 'res'); | ||
} | ||
@@ -390,2 +423,3 @@ if (this.vShowDur == 1) { | ||
vTmpDiv = this.newNode(vTmpCell, 'div', null, null, this.vTaskList[i].getDuration(this.vFormat, this.vLangs[this.vLang])); | ||
addListenerClickCell(vTmpCell, this.vEvents, this.vTaskList[i], 'dur'); | ||
} | ||
@@ -395,2 +429,3 @@ if (this.vShowComp == 1) { | ||
vTmpDiv = this.newNode(vTmpCell, 'div', null, null, this.vTaskList[i].getCompStr()); | ||
addListenerClickCell(vTmpCell, this.vEvents, this.vTaskList[i], 'comp'); | ||
} | ||
@@ -400,2 +435,3 @@ if (this.vShowStartDate == 1) { | ||
vTmpDiv = this.newNode(vTmpCell, 'div', null, null, formatDateStr(this.vTaskList[i].getStart(), this.vDateTaskTableDisplayFormat, this.vLangs[this.vLang])); | ||
addListenerClickCell(vTmpCell, this.vEvents, this.vTaskList[i], 'startdate'); | ||
} | ||
@@ -405,2 +441,3 @@ if (this.vShowEndDate == 1) { | ||
vTmpDiv = this.newNode(vTmpCell, 'div', null, null, formatDateStr(this.vTaskList[i].getEnd(), this.vDateTaskTableDisplayFormat, this.vLangs[this.vLang])); | ||
addListenerClickCell(vTmpCell, this.vEvents, this.vTaskList[i], 'enddate'); | ||
} | ||
@@ -411,2 +448,3 @@ if (this.vShowPlanStartDate == 1) { | ||
vTmpDiv = this.newNode(vTmpCell, 'div', null, null, v); | ||
addListenerClickCell(vTmpCell, this.vEvents, this.vTaskList[i], 'planstartdate'); | ||
} | ||
@@ -417,2 +455,3 @@ if (this.vShowPlanEndDate == 1) { | ||
vTmpDiv = this.newNode(vTmpCell, 'div', null, null, v); | ||
addListenerClickCell(vTmpCell, this.vEvents, this.vTaskList[i], 'planenddate'); | ||
} | ||
@@ -422,2 +461,3 @@ if (this.vShowCost == 1) { | ||
vTmpDiv = this.newNode(vTmpCell, 'div', null, null, this.vTaskList[i].getCost()); | ||
addListenerClickCell(vTmpCell, this.vEvents, this.vTaskList[i], 'costdate'); | ||
} | ||
@@ -440,2 +480,4 @@ vNumRows++; | ||
if (this.vShowPlanEndDate == 1) this.newNode(vTmpRow, 'td', null, 'gspanning gplanenddate', '\u00A0'); | ||
if (this.vShowCost == 1) this.newNode(vTmpRow, 'td', null, 'gspanning gcost', '\u00A0'); | ||
// Add some white space so the vertical scroll distance should always be greater | ||
@@ -632,3 +674,2 @@ // than for the right pane (keep to a minimum as it is seen in unconstrained height designs) | ||
var vTmpItem = this.vTaskList[i]; | ||
var vCaptionStr = ''; | ||
var vCaptClass = null; | ||
@@ -641,3 +682,4 @@ if (this.vTaskList[i].getMile() && !vComb) { | ||
vTmpDiv = this.newNode(vTmpCell, 'div', null, 'gtaskcelldiv', '\u00A0\u00A0'); | ||
vTmpDiv = this.newNode(vTmpDiv, 'div', this.vDivId + 'bardiv_' + vID, 'gtaskbarcontainer', null, 12, vTaskLeftPx - 6); | ||
vTmpDiv = this.newNode(vTmpDiv, 'div', this.vDivId + 'bardiv_' + vID, 'gtaskbarcontainer', null, 12, vTaskLeftPx + vTaskRightPx - 6); | ||
this.vTaskList[i].setBarDiv(vTmpDiv); | ||
@@ -644,0 +686,0 @@ vTmpDiv2 = this.newNode(vTmpDiv, 'div', this.vDivId + 'taskbar_' + vID, this.vTaskList[i].getClass(), null, 12); |
@@ -150,1 +150,9 @@ import { delayedHide, changeFormat, stripIds, isIE, findObj, fadeToolTip } from "./utils"; | ||
}; | ||
export const addListenerClickCell = function (vTmpCell, vEvents, task, column) { | ||
addListener('click', function(){ | ||
if(vEvents[column] && typeof vEvents[column] === 'function'){ | ||
vEvents[column](task); | ||
} | ||
}, vTmpCell); | ||
} |
@@ -250,3 +250,3 @@ const es = { | ||
'planenddate': 'Plan Data final', | ||
'cost': 'Cost', | ||
'cost': 'Custo', | ||
'jan': 'Jan', | ||
@@ -253,0 +253,0 @@ 'feb': 'Fev', |
@@ -5,11 +5,17 @@ import { parseDateFormatStr } from "./utils"; | ||
this.setOptions = function(options){ | ||
/** | ||
* SETTERS | ||
*/ | ||
this.setOptions = function (options) { | ||
const keys = Object.keys(options); | ||
for(let i=0; i< keys.length; i++){ | ||
for (let i = 0; i < keys.length; i++) { | ||
const key = keys[i]; | ||
const val = options[key]; | ||
let ev; | ||
if(val instanceof Array){ | ||
if (val instanceof Array) { | ||
ev = `this.set${key.substr(1)}(...val)`; | ||
}else{ | ||
} else { | ||
ev = `this.set${key.substr(1)}(val)`; | ||
@@ -107,3 +113,10 @@ | ||
}; | ||
this.setEvents = function (pEvents) { this.vEvents = pEvents; }; | ||
this.setEventClickRow = function (fn) { this.vEventClickRow = fn; }; | ||
/** | ||
* GETTERS | ||
*/ | ||
this.getDivId = function () { return this.vDivId; }; | ||
@@ -165,2 +178,4 @@ this.getUseFade = function () { return this.vUseFade; }; | ||
this.getList = function () { return this.vTaskList; }; | ||
this.getEventsClickCell = function () { return this.vEvents; }; | ||
this.getEventClickRow = function () { return this.vEventClickRow; }; | ||
} |
@@ -1,2 +0,2 @@ | ||
import { parseDateStr, isIE, stripUnwanted, getOffset, formatDateStr } from "./utils"; | ||
import { parseDateStr, isIE, stripUnwanted, getOffset, formatDateStr, hashKey } from "./utils"; | ||
@@ -155,4 +155,6 @@ declare var g: any; | ||
pDepend, pCaption, pNotes, pGantt, pCost = null, pPlanStart = null, pPlanEnd = null) { | ||
let vBenchTime = new Date().getTime(); | ||
let vID = parseInt(document.createTextNode(pID).data); | ||
let vGantt = pGantt ? pGantt : g; //hack for backwards compatibility | ||
let _id = document.createTextNode(pID).data; | ||
let vID = hashKey(document.createTextNode(pID).data); | ||
let vName = document.createTextNode(pName).data; | ||
@@ -172,3 +174,9 @@ let vStart = null; | ||
let vGroup = parseInt(document.createTextNode(pGroup).data); | ||
let vParent = document.createTextNode(pParent).data; | ||
let parent = document.createTextNode(pParent).data; | ||
if (parent && parent !== '0') { | ||
parent = hashKey(parent).toString(); | ||
} | ||
let vParent = parent; | ||
let vOpen = (vGroup == 2) ? 1 : parseInt(document.createTextNode(pOpen).data); | ||
@@ -189,3 +197,2 @@ let vDepend = new Array(); | ||
let vCellDiv = null; | ||
let vGantt = pGantt ? pGantt : g; //hack for backwards compatibility | ||
let vBarDiv = null; | ||
@@ -229,3 +236,3 @@ let vTaskDiv = null; | ||
var n = vDepList.length; | ||
let vGantt = pGantt ? pGantt : g; | ||
for (var k = 0; k < n; k++) { | ||
@@ -252,6 +259,12 @@ if (vDepList[k].toUpperCase().indexOf('SS') != -1) { | ||
} | ||
if (vDepend[k]) { | ||
vDepend[k] = hashKey(vDepend[k]).toString(); | ||
} | ||
} | ||
} | ||
this.getID = function () { return vID; }; | ||
this.getOriginalID = function () { return _id; }; | ||
this.getName = function () { return vName; }; | ||
@@ -276,3 +289,5 @@ this.getStart = function () { | ||
this.getMile = function () { return vMile; }; | ||
this.getDepend = function () { if (vDepend) return vDepend; else return null; }; | ||
this.getDepend = function () { | ||
if (vDepend) return vDepend; else return null; | ||
}; | ||
this.getDepType = function () { if (vDependType) return vDependType; else return null; }; | ||
@@ -308,3 +323,3 @@ this.getCaption = function () { if (vCaption) return vCaption; else return ''; }; | ||
var tmpPer = (getOffset(this.getStart(), vTaskEnd, 999, vUnits)) / 1000; | ||
if (Math.floor(tmpPer) != tmpPer) tmpPer = Math.round(tmpPer * 10) / 10; | ||
if (Math.floor(tmpPer) != tmpPer) tmpPer = Math.round(tmpPer); | ||
switch (vUnits) { | ||
@@ -311,0 +326,0 @@ case 'hour': vDuration = tmpPer + ' ' + ((tmpPer != 1) ? pLang['hrs'] : pLang['hr']); break; |
@@ -167,3 +167,3 @@ | ||
case 'qq': | ||
vDateStr += 'Q'; // now fall through | ||
vDateStr += pL['qtr']; // now fall through | ||
case 'q': | ||
@@ -417,2 +417,25 @@ vDateStr += Math.floor(pDate.getMonth() / 3) + 1; | ||
} | ||
}; | ||
}; | ||
export const hashString = function (key) { | ||
if (!key) { | ||
key = 'default'; | ||
} | ||
key += ''; | ||
let hash = 5381; | ||
for (let i = 0; i < key.length; i++) { | ||
if (key.charCodeAt) { | ||
// tslint:disable-next-line:no-bitwise | ||
hash = (hash << 5) + hash + key.charCodeAt(i); | ||
} | ||
// tslint:disable-next-line:no-bitwise | ||
hash = hash & hash; | ||
} | ||
// tslint:disable-next-line:no-bitwise | ||
return hash >>> 0; | ||
} | ||
export const hashKey = function (key) { | ||
return this.hashString(key) % 10000; | ||
} |
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
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 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
1631495
68
15439
125