Skip to content

Commit 12c1797

Browse files
committed
10.0.0
1 parent 38a7792 commit 12c1797

File tree

365 files changed

+9424
-9736
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

365 files changed

+9424
-9736
lines changed

common/data.js

Lines changed: 1053 additions & 833 deletions
Large diffs are not rendered by default.

common/data.ts

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,4 +1283,140 @@ export function GetKanbanHierarchicalData() {
12831283

12841284
data = data.concat(GetKanbanData());
12851285
return data;
1286+
}
1287+
1288+
export function GetGanttChartTreeData(count: number = 50, minDate?: Date, maxDate?: Date) {
1289+
const data = [];
1290+
1291+
if (!minDate || isNaN(new Date(minDate).getTime())) {
1292+
minDate = new Date();
1293+
}
1294+
1295+
if (!maxDate || isNaN(new Date(maxDate).getTime())) {
1296+
maxDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate() + 1);
1297+
}
1298+
1299+
const dateMin = new Date(minDate),
1300+
dateMax = new Date(maxDate);
1301+
let [taskCounter, projectCounter] = [0, 0];
1302+
1303+
function getTasks(n: number = 1, includeSubProjects?: boolean) {
1304+
let tasks = [];
1305+
1306+
for (let i = 0; i < n; i += 1) {
1307+
const rand = getRandom();
1308+
let task;
1309+
1310+
if (includeSubProjects && rand % 5 === 0) {
1311+
task = getProject(rand);
1312+
}
1313+
else {
1314+
task = {
1315+
label: 'Task ' + taskCounter,
1316+
dateStart: `${dateMin.getFullYear()}-${dateMin.getMonth()}-${dateMin.getDate()}`,
1317+
dateEnd: `${dateMax.getFullYear()}-${dateMax.getMonth()}-${dateMax.getDate()}`,
1318+
type: 'task'
1319+
};
1320+
}
1321+
1322+
// if (i % 5 === 0) {
1323+
// task.connections = [{
1324+
// target: rand % count,
1325+
// type: rand % 3
1326+
// }];
1327+
// }
1328+
1329+
tasks.push(task);
1330+
1331+
dateMin.setDate(dateMin.getDate() + rand);
1332+
dateMax.setDate(dateMax.getDate() + rand + getRandom());
1333+
taskCounter++;
1334+
}
1335+
1336+
return tasks
1337+
}
1338+
1339+
function getProject(rand: number) {
1340+
const isEven = rand % 2 === 0,
1341+
projObj = {
1342+
label: 'Project ' + projectCounter,
1343+
dateStart: `${dateMin.getFullYear()}-${dateMin.getMonth()}-${dateMin.getDate()}`,
1344+
dateEnd: `${dateMax.getFullYear()}-${dateMax.getMonth()}-${dateMax.getDate()}`,
1345+
type: 'project',
1346+
expanded: isEven,
1347+
tasks: getTasks(rand, isEven)
1348+
}
1349+
1350+
projectCounter++;
1351+
dateMin.setDate(dateMin.getDate() + rand);
1352+
dateMax.setDate(dateMax.getDate() + rand + getRandom());
1353+
1354+
return projObj
1355+
}
1356+
1357+
for (let i = 0; i < count; i += 1) {
1358+
const rand = getRandom();
1359+
1360+
if (rand % 5 === 0) {
1361+
data.push(getProject(rand));
1362+
}
1363+
else {
1364+
data.push(getTasks()[0]);
1365+
}
1366+
}
1367+
1368+
return data
1369+
}
1370+
1371+
function getRandom(coeff = 10) {
1372+
return Math.round(Math.random() * coeff)
1373+
}
1374+
1375+
export function GetGanttChartFlatData(count: number = 50, minDate?: Date, maxDate?: Date) {
1376+
const data = [];
1377+
1378+
if (!minDate || isNaN(new Date(minDate).getTime())) {
1379+
minDate = new Date();
1380+
}
1381+
1382+
if (!maxDate || isNaN(new Date(maxDate).getTime())) {
1383+
maxDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate() + getRandom(50));
1384+
}
1385+
1386+
const dateMin = new Date(minDate),
1387+
dateMax = new Date(maxDate);
1388+
let dateMinYear = dateMin.getFullYear(),
1389+
dateMinMonth = dateMin.getMonth(),
1390+
dateMinDate = dateMin.getDate(),
1391+
dateMaxYear = dateMax.getFullYear(),
1392+
dateMaxMonth = dateMax.getMonth(),
1393+
dateMaxDate = dateMax.getDate(),
1394+
[taskCounter, projectCounter] = [0, 0];
1395+
1396+
for (let i = 0; i < count; i += 1) {
1397+
const rand = getRandom(),
1398+
task: any = {
1399+
label: 'Task ' + (taskCounter + 1),
1400+
dateStart: `${dateMinYear}-${dateMinMonth}-${dateMinDate}`,
1401+
dateEnd: `${dateMaxYear}-${dateMaxMonth}-${dateMaxDate}`,
1402+
type: 'task'
1403+
};
1404+
1405+
if (i % 4 === 0) {
1406+
task.connections = [{
1407+
target: i + rand % count,
1408+
type: rand % 3
1409+
}];
1410+
}
1411+
1412+
dateMinMonth = rand;
1413+
dateMaxMonth = rand + getRandom(20);
1414+
dateMinDate = getRandom();
1415+
dateMaxDate = getRandom(20);
1416+
taskCounter++;
1417+
1418+
data.push(task);
1419+
}
1420+
1421+
return data
12861422
}

common/jasmine-ready.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
window.__karma__.start = (function (originalStartFn) {
2+
return function () {
3+
var args = arguments
4+
jQuery(function () {
5+
originalStartFn.apply(null, args);
6+
});
7+
};
8+
}(window.__karma__.start));

common/jquery-3.5.1.slim.min.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

common/marked.import.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import '../../common/marked.min.js';

common/rrule.import.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import '../../common/rrule.min.js';

0 commit comments

Comments
 (0)