Refactored project
This commit is contained in:
parent
bf086e9c13
commit
2a8264b675
|
@ -1,10 +1,10 @@
|
|||
del ryzjsext.min.js
|
||||
del ryzjsext.min.tmp
|
||||
|
||||
type ryzjsext-version.txt >> ryzjsext.min.js
|
||||
|
||||
cd javascript-extensions
|
||||
|
||||
type version.txt >> ../ryzjsext.min.js
|
||||
|
||||
"C:\B\Portable Files (dev)\Google Closure Compiler\closure-compiler-v20231112.jar" --js *.js --js_output_file ../ryzjsext.min.tmp
|
||||
|
||||
cd..
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
/**
|
||||
* Ray's JavaScript Extension
|
||||
* @version v0.1.0.071 (2023/12/27 1551)
|
||||
*/
|
|
@ -0,0 +1,4 @@
|
|||
/**
|
||||
* Ray's Projects
|
||||
* @version v0.1.0.104 (2023/12/27 1051)
|
||||
*/
|
|
@ -1,4 +0,0 @@
|
|||
/**
|
||||
* Ray's JavaScript Extension
|
||||
* @version v0.1.0.051 (2023/12/24 0115)
|
||||
*/
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* Ray's JavaScript Extension
|
||||
* @version v0.1.0.051 (2023/12/24 0115)
|
||||
* @version v0.1.0.071 (2023/12/27 1551)
|
||||
*/
|
||||
Array.toFlatten=function(a,b,c){for(let d=0;d<a.length;d++)c.push(a[d]),0<a[d][b].length&&Array.toFlatten(a[d][b],b,c)};Array.prototype.addRange=function(a){if(null==a)return this;for(let b=0;b<a.length;b++)this.push(a[b]);return this};Array.prototype.any=function(a,b){return 0<this.count(a,b)};Array.prototype.copy=function(){return JSON.parse(JSON.stringify(this))};Array.prototype.count=function(a,b){let c=0;for(let d=0;d<this.length;d++)"undefined"!=typeof this[d][a]&&this[d][a]==b&&c++;return c};
|
||||
Array.prototype.countMany=function(...a){let b=0;a.forEach(c=>{b+=this.count(c.propName,c.value)});return b};Array.prototype.flatten=function(a){let b=[];Array.toFlatten(this,a,b);return b};Array.prototype.index=function(a,b){for(let c=0;c<this.length;c++)if("undefined"!=typeof this[c][a]&&this[c][a]==b)return c;return-1};Array.prototype.insert=function(a,b){0>a?this.splice(0,0,b):a>=this.length?this.push(b):this.splice(a,0,b);return this};
|
||||
|
|
|
@ -9,8 +9,9 @@
|
|||
|
||||
<script src="ryzjsext.min.js"></script>
|
||||
|
||||
<script src="ryz-proj.js"></script>
|
||||
<!-- <script src="bsdialog4.min.js"></script> -->
|
||||
<script src="ryzproj.js"></script>
|
||||
<link href="ryzproj.css" rel="stylesheet" />
|
||||
|
||||
<title></title>
|
||||
|
||||
<style>
|
||||
|
@ -20,76 +21,6 @@ body {
|
|||
font-size: 10pt;
|
||||
}
|
||||
|
||||
|
||||
.ryz-project {
|
||||
border-spacing: 0px;
|
||||
border-collapse: separate;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.ryz-project .b {
|
||||
font-weight: bold;
|
||||
}
|
||||
.ryz-project .c {
|
||||
text-align: center;
|
||||
}
|
||||
.ryz-project .i {
|
||||
display: inline-block;
|
||||
width: 20px;
|
||||
}
|
||||
|
||||
.ryz-project thead tr {
|
||||
font-weight: bold;
|
||||
font-size: 0.8em;
|
||||
user-select: none;
|
||||
height: 40px;
|
||||
text-align: center;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
.ryz-project thead tr th {
|
||||
background-color: #E1E1E1;
|
||||
border-color: #B8B8B8;
|
||||
border-style: solid;
|
||||
border-width: 0px 0px 1px 1px;
|
||||
color: #3E7138;
|
||||
margin: 0px;
|
||||
padding: 6px 10px 5px 10px;
|
||||
min-width: 20px;
|
||||
}
|
||||
.ryz-project thead tr th:first-child {
|
||||
background-color: inherit;
|
||||
border-left-width: 0px;
|
||||
}
|
||||
.ryz-project thead tr th:last-child {
|
||||
border-right-width: 1px;
|
||||
}
|
||||
|
||||
.ryz-project tbody tr td {
|
||||
border-color: #B8B8B8;
|
||||
border-style: solid;
|
||||
border-width: 0px 0px 1px 0px;
|
||||
margin: 0px;
|
||||
padding: 5px 5px 5px 5px;
|
||||
}
|
||||
.ryz-project tbody tr td:first-child {
|
||||
border-right-width: 1px;
|
||||
color: #7E7E7E;
|
||||
font-size: 0.8em;
|
||||
text-align: center;
|
||||
user-select: none;
|
||||
}
|
||||
.ryz-project tbody tr td:last-child {
|
||||
border-right-width: 1px;
|
||||
}
|
||||
|
||||
.ryz-project tbody tr:hover td:first-child {
|
||||
background-color: #D1F2C7;
|
||||
color: #3E7138;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
<script>
|
||||
|
@ -116,26 +47,6 @@ gantt1.AddTask({
|
|||
CollatedTaskID: null
|
||||
});
|
||||
|
||||
gantt1.AddTask({
|
||||
ID: 3,
|
||||
Name: "Task C",
|
||||
StartDelay: 5,
|
||||
Duration: 1,
|
||||
PredecessorTaskID: null,
|
||||
IsCollated: false,
|
||||
CollatedTaskID: null
|
||||
});
|
||||
|
||||
gantt1.AddTask({
|
||||
ID: 4,
|
||||
Name: "Task D",
|
||||
StartDelay: 1,
|
||||
Duration: 1,
|
||||
PredecessorTaskID: 3,
|
||||
IsCollated: false,
|
||||
CollatedTaskID: null
|
||||
});
|
||||
|
||||
gantt1.AddTask({
|
||||
ID: 5,
|
||||
Name: "Task B1",
|
||||
|
@ -187,15 +98,37 @@ gantt1.AddTask({
|
|||
CollatedTaskID: 8
|
||||
});
|
||||
|
||||
gantt1.AddTask({
|
||||
ID: 3,
|
||||
Name: "Task C",
|
||||
StartDelay: 5,
|
||||
Duration: 1,
|
||||
PredecessorTaskID: 8,
|
||||
IsCollated: false,
|
||||
CollatedTaskID: null
|
||||
});
|
||||
|
||||
gantt1.AddTask({
|
||||
ID: 4,
|
||||
Name: "Task D",
|
||||
StartDelay: 1,
|
||||
Duration: 1,
|
||||
PredecessorTaskID: 3,
|
||||
IsCollated: false,
|
||||
CollatedTaskID: null
|
||||
});
|
||||
|
||||
gantt1.Invalidate();
|
||||
|
||||
console.log(gantt1.ExportTasks());
|
||||
// console.log(gantt1.ExportTasks());
|
||||
|
||||
Document.ready(async function() {
|
||||
const taskGrid1 = document.getElementById("projectTaskGrid1");
|
||||
|
||||
taskGrid1.innerHTML = gantt1.RenderTaskGrid();
|
||||
|
||||
console.log(new Date(gantt1.StartDate).toLocaleDateString() + " - " + new Date(gantt1.FinishDate).toLocaleDateString());
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
@ -220,26 +153,8 @@ Document.ready(async function() {
|
|||
</thead>
|
||||
<tbody id="projectTaskGrid1">
|
||||
<tr>
|
||||
<td>1</td>
|
||||
<td>2</td>
|
||||
<td>3</td>
|
||||
<td>4</td>
|
||||
<td>5</td>
|
||||
<td>6</td>
|
||||
<td>7</td>
|
||||
<td>8</td>
|
||||
<td>9</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>1</td>
|
||||
<td>2</td>
|
||||
<td>3</td>
|
||||
<td>4</td>
|
||||
<td>5</td>
|
||||
<td>6</td>
|
||||
<td>7</td>
|
||||
<td>8</td>
|
||||
<td>9</td>
|
||||
<td></td>
|
||||
<td colspan="8" class="c">Loading...</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
.ryz-project {
|
||||
border-spacing: 0px;
|
||||
border-collapse: separate;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.ryz-project .b {
|
||||
font-weight: bold;
|
||||
}
|
||||
.ryz-project .c {
|
||||
text-align: center;
|
||||
}
|
||||
.ryz-project .i {
|
||||
display: inline-block;
|
||||
width: 20px;
|
||||
}
|
||||
|
||||
.ryz-project thead tr {
|
||||
font-weight: bold;
|
||||
font-size: 0.8em;
|
||||
user-select: none;
|
||||
height: 40px;
|
||||
text-align: center;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
.ryz-project thead tr th {
|
||||
background-color: #E1E1E1;
|
||||
border-color: #B8B8B8;
|
||||
border-style: solid;
|
||||
border-width: 0px 0px 1px 1px;
|
||||
color: #3E7138;
|
||||
margin: 0px;
|
||||
padding: 6px 10px 5px 10px;
|
||||
min-width: 20px;
|
||||
}
|
||||
.ryz-project thead tr th:first-child {
|
||||
background-color: inherit;
|
||||
border-left-width: 0px;
|
||||
}
|
||||
.ryz-project thead tr th:last-child {
|
||||
border-right-width: 1px;
|
||||
}
|
||||
|
||||
.ryz-project tbody tr td {
|
||||
border-color: #B8B8B8;
|
||||
border-style: solid;
|
||||
border-width: 0px 0px 1px 0px;
|
||||
margin: 0px;
|
||||
padding: 5px 5px 5px 5px;
|
||||
}
|
||||
.ryz-project tbody tr td:first-child {
|
||||
border-right-width: 1px;
|
||||
color: #7E7E7E;
|
||||
font-size: 0.8em;
|
||||
text-align: center;
|
||||
user-select: none;
|
||||
}
|
||||
.ryz-project tbody tr td:last-child {
|
||||
border-right-width: 1px;
|
||||
}
|
||||
|
||||
.ryz-project tbody tr:hover td:first-child {
|
||||
background-color: #D1F2C7;
|
||||
color: #3E7138;
|
||||
font-weight: bold;
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
class RyzGantt {
|
||||
constructor(options) {
|
||||
const a = this;
|
||||
const _options = Object.assign(a.NewProject, options);
|
||||
const _options = Object.assign(a.#newProject, options);
|
||||
|
||||
a.Project = _options;
|
||||
a.Tasks = [];
|
||||
|
@ -14,17 +14,6 @@ class RyzGantt {
|
|||
}
|
||||
|
||||
|
||||
get NewProject() {
|
||||
return {
|
||||
Name: "",
|
||||
Description: "",
|
||||
StartDate: Date.today(),
|
||||
Tag: null,
|
||||
StartOfWeek: 1, // Monday
|
||||
WorkHours: [0, 7.5, 7.5, 7.5, 7.5, 7.5, 0] // 0 = Sunday
|
||||
};
|
||||
}
|
||||
|
||||
get NewTask() {
|
||||
return {
|
||||
// Order: null,
|
||||
|
@ -46,7 +35,45 @@ class RyzGantt {
|
|||
};
|
||||
}
|
||||
|
||||
get NewTaskNode() {
|
||||
get StartDate() {
|
||||
const a = this;
|
||||
|
||||
return new Date(a.Project.StartDate);
|
||||
}
|
||||
|
||||
get FinishDate() {
|
||||
const a = this;
|
||||
|
||||
let result = new Date(a.Project.StartDate);
|
||||
|
||||
a.Tasks.forEach(e => {
|
||||
if (e.FinishDate == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.FinishDate <= result) {
|
||||
return;
|
||||
}
|
||||
|
||||
result = new Date(e.FinishDate);
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
get #newProject() {
|
||||
return {
|
||||
Name: "",
|
||||
Description: "",
|
||||
StartDate: Date.today(),
|
||||
Tag: null,
|
||||
StartOfWeek: 1, // Monday
|
||||
WorkHours: [0, 7.5, 7.5, 7.5, 7.5, 7.5, 0] // 0 = Sunday
|
||||
};
|
||||
}
|
||||
|
||||
get #newTaskNode() {
|
||||
return {
|
||||
Order: null,
|
||||
ID: null,
|
||||
|
@ -73,7 +100,7 @@ class RyzGantt {
|
|||
AddTask(task) {
|
||||
const a = this;
|
||||
const newTask = Object.assign(a.NewTask, task);
|
||||
const newTaskNode = Object.assign(a.NewTaskNode, newTask);
|
||||
const newTaskNode = Object.assign(a.#newTaskNode, newTask);
|
||||
|
||||
if ((newTaskNode.PredecessorTaskID == null) && (newTaskNode.CollatedTaskID == null)) {
|
||||
a.Tasks.push(newTaskNode);
|
Loading…
Reference in New Issue