Skip to content

Commit a1cda3c

Browse files
committed
12.0.0
1 parent dc268f8 commit a1cda3c

File tree

347 files changed

+3937
-3809
lines changed

Some content is hidden

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

347 files changed

+3937
-3809
lines changed

common/bundle.js

Lines changed: 0 additions & 1881 deletions
This file was deleted.

common/data.js

Lines changed: 961 additions & 825 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/demos.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -862,9 +862,9 @@ window.addEventListener('load', function() {
862862
'https://www.htmlelements.com/demos/styles/common.css'
863863
];
864864
let js_external = [
865-
'../../common/webcomponents-lite.js',
866-
'https://www.htmlelements.com/demos/common/common.js',
867-
'https://www.htmlelements.com/demos/common/data.js',
865+
'../../scripts/webcomponents-lite.js',
866+
'https://www.htmlelements.com/demos/scripts/common.js',
867+
'https://www.htmlelements.com/demos/scripts/data.js',
868868
'https://www.htmlelements.com/demos/source/smart.element.js',
869869
'https://www.htmlelements.com/demos/source/smart.elements.js'
870870
];
324 Bytes
Binary file not shown.

source/components/smart.ui.accordion.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/components/smart.ui.array.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/components/smart.ui.breadcrumb.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/components/smart.ui.button.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/components/smart.ui.buttongroup.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)