@operato/gantt 7.0.20 → 7.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/src/ox-gantt-chart.d.ts +4 -1
- package/dist/src/ox-gantt-chart.js +13 -8
- package/dist/src/ox-gantt-chart.js.map +1 -1
- package/dist/src/ox-gantt-resize-splitter.js +8 -7
- package/dist/src/ox-gantt-resize-splitter.js.map +1 -1
- package/dist/src/ox-gantt.d.ts +27 -15
- package/dist/src/ox-gantt.js +208 -76
- package/dist/src/ox-gantt.js.map +1 -1
- package/dist/src/ox-resource-chart.d.ts +19 -0
- package/dist/src/ox-resource-chart.js +194 -0
- package/dist/src/ox-resource-chart.js.map +1 -0
- package/dist/src/types.d.ts +5 -0
- package/dist/src/types.js.map +1 -1
- package/dist/stories/ox-gantt.stories.js +66 -2
- package/dist/stories/ox-gantt.stories.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/ox-gantt-chart.ts +16 -9
- package/src/ox-gantt-resize-splitter.ts +8 -7
- package/src/ox-gantt.ts +209 -80
- package/src/ox-resource-chart.ts +192 -0
- package/src/types.ts +6 -0
- package/stories/ox-gantt.stories.ts +66 -2
- package/translations/en.json +2 -1
- package/translations/ko.json +2 -1
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { LitElement, html, css } from 'lit';
|
|
3
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
4
|
+
import * as d3 from 'd3';
|
|
5
|
+
import { ScrollbarStyles } from '@operato/styles';
|
|
6
|
+
let OxResourceChart = class OxResourceChart extends LitElement {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.fromDate = new Date(new Date().getFullYear(), 0, 1).toISOString().split('T')[0];
|
|
10
|
+
this.toDate = new Date(new Date().getFullYear(), 11, 31).toISOString().split('T')[0];
|
|
11
|
+
this.axisScale = 'week-day';
|
|
12
|
+
this.resources = [];
|
|
13
|
+
this._baseWidth = 30;
|
|
14
|
+
this._level = 'week-day';
|
|
15
|
+
}
|
|
16
|
+
static { this.styles = [
|
|
17
|
+
ScrollbarStyles,
|
|
18
|
+
css `
|
|
19
|
+
:host {
|
|
20
|
+
display: flex;
|
|
21
|
+
overflow: hidden;
|
|
22
|
+
position: relative;
|
|
23
|
+
}
|
|
24
|
+
div[chart-container] {
|
|
25
|
+
display: block;
|
|
26
|
+
overflow-x: auto;
|
|
27
|
+
overflow-y: hidden;
|
|
28
|
+
}
|
|
29
|
+
svg {
|
|
30
|
+
min-width: 100%;
|
|
31
|
+
}
|
|
32
|
+
svg[header] {
|
|
33
|
+
display: block;
|
|
34
|
+
min-width: 100%;
|
|
35
|
+
box-sizing: border-box;
|
|
36
|
+
border-bottom: 1px solid var(--ox-gantt-header-border-color, var(--md-sys-color-on-secondary-container));
|
|
37
|
+
height: 40px;
|
|
38
|
+
background-color: var(--ox-gantt-header-background-color, var(--md-sys-color-secondary-container));
|
|
39
|
+
color: var(--ox-gantt-header-color, var(--md-sys-color-on-secondary-container));
|
|
40
|
+
position: sticky;
|
|
41
|
+
top: 0;
|
|
42
|
+
z-index: 1;
|
|
43
|
+
}
|
|
44
|
+
svg[body] {
|
|
45
|
+
display: block;
|
|
46
|
+
min-width: 100%;
|
|
47
|
+
}
|
|
48
|
+
.top-axis text,
|
|
49
|
+
.bottom-axis text {
|
|
50
|
+
font-size: 12px;
|
|
51
|
+
}
|
|
52
|
+
.grid line {
|
|
53
|
+
stroke: #e0e0e0;
|
|
54
|
+
}
|
|
55
|
+
.grid path {
|
|
56
|
+
stroke-width: 0;
|
|
57
|
+
}
|
|
58
|
+
.no-select {
|
|
59
|
+
user-select: none;
|
|
60
|
+
}
|
|
61
|
+
.selected {
|
|
62
|
+
stroke-width: 2px;
|
|
63
|
+
stroke: var(--ox-gantt-selected-color, blue);
|
|
64
|
+
}
|
|
65
|
+
`
|
|
66
|
+
]; }
|
|
67
|
+
render() {
|
|
68
|
+
return html `
|
|
69
|
+
<div chart-container>
|
|
70
|
+
<svg header></svg>
|
|
71
|
+
<svg body></svg>
|
|
72
|
+
</div>
|
|
73
|
+
`;
|
|
74
|
+
}
|
|
75
|
+
updated(changedProperties) {
|
|
76
|
+
if (changedProperties.has('fromDate') || changedProperties.has('toDate') || changedProperties.has('axisScale')) {
|
|
77
|
+
this.updateTimeScale();
|
|
78
|
+
}
|
|
79
|
+
if (changedProperties.has('resources')) {
|
|
80
|
+
this.drawBody();
|
|
81
|
+
}
|
|
82
|
+
this.drawAxes();
|
|
83
|
+
}
|
|
84
|
+
updateTimeScale() {
|
|
85
|
+
this._timeScale = d3
|
|
86
|
+
.scaleTime()
|
|
87
|
+
.domain([d3.timeDay.floor(new Date(this.fromDate)), d3.timeDay.offset(new Date(this.toDate), 1)])
|
|
88
|
+
.range([0, this.getChartWidth()]);
|
|
89
|
+
}
|
|
90
|
+
getChartWidth() {
|
|
91
|
+
const totalDays = d3.timeDay.count(new Date(this.fromDate), d3.timeDay.offset(new Date(this.toDate), 1));
|
|
92
|
+
return (totalDays * this._baseWidth) / this.getScale();
|
|
93
|
+
}
|
|
94
|
+
getScale() {
|
|
95
|
+
if (this._level == 'quarter-week') {
|
|
96
|
+
return 7 / 2;
|
|
97
|
+
}
|
|
98
|
+
else if (this._level == 'year-month') {
|
|
99
|
+
return 30 / 2;
|
|
100
|
+
}
|
|
101
|
+
else if (this._level == 'year-quarter') {
|
|
102
|
+
return 90 / 2;
|
|
103
|
+
}
|
|
104
|
+
return 1;
|
|
105
|
+
}
|
|
106
|
+
drawAxes() {
|
|
107
|
+
const header = d3.select(this.renderRoot.querySelector('svg[header]'));
|
|
108
|
+
header.selectAll('*').remove();
|
|
109
|
+
header.attr('width', this.getChartWidth());
|
|
110
|
+
const axisTop = d3.axisTop(this._timeScale).tickSize(-20);
|
|
111
|
+
const axisBottom = d3.axisBottom(this._timeScale).tickSize(-20);
|
|
112
|
+
header.append('g').attr('class', 'top-axis').attr('transform', 'translate(0, 20)').call(axisTop);
|
|
113
|
+
header.append('g').attr('class', 'bottom-axis').attr('transform', 'translate(0, 40)').call(axisBottom);
|
|
114
|
+
}
|
|
115
|
+
drawBody() {
|
|
116
|
+
const body = d3.select(this.renderRoot.querySelector('svg[body]'));
|
|
117
|
+
body.selectAll('*').remove();
|
|
118
|
+
body.attr('width', this.getChartWidth());
|
|
119
|
+
// Add grid lines for resource chart
|
|
120
|
+
if (this.resources.length > 0) {
|
|
121
|
+
const addVerticalGridLines = (ticks) => {
|
|
122
|
+
ticks.forEach(tick => {
|
|
123
|
+
const startX = this._timeScale(tick);
|
|
124
|
+
body
|
|
125
|
+
.append('line')
|
|
126
|
+
.attr('x1', startX)
|
|
127
|
+
.attr('x2', startX)
|
|
128
|
+
.attr('y1', 0)
|
|
129
|
+
.attr('y2', this.resources.length * 30) // Adjust according to the number of resource rows
|
|
130
|
+
.attr('stroke', 'var(--ox-gantt-color-gridlines, var(--md-sys-color-outline))')
|
|
131
|
+
.attr('stroke-width', 1);
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
const addHorizontalGridLines = () => {
|
|
135
|
+
this.resources.forEach((_, index) => {
|
|
136
|
+
const y = (index + 1) * 30;
|
|
137
|
+
body
|
|
138
|
+
.append('line')
|
|
139
|
+
.attr('x1', 0)
|
|
140
|
+
.attr('x2', this.getChartWidth())
|
|
141
|
+
.attr('y1', y)
|
|
142
|
+
.attr('y2', y)
|
|
143
|
+
.attr('stroke', 'var(--ox-gantt-color-gridlines, var(--md-sys-color-outline))')
|
|
144
|
+
.attr('stroke-width', 1);
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
if (this._level === 'week-day') {
|
|
148
|
+
const dayTicks = d3.timeDay
|
|
149
|
+
.every(1)
|
|
150
|
+
.range(d3.timeDay.floor(new Date(this.fromDate)), d3.timeDay.offset(new Date(this.toDate), 1));
|
|
151
|
+
addVerticalGridLines(dayTicks);
|
|
152
|
+
}
|
|
153
|
+
else if (this._level === 'quarter-week') {
|
|
154
|
+
const weekTicks = d3.timeWeek
|
|
155
|
+
.every(1)
|
|
156
|
+
.range(d3.timeWeek.floor(new Date(this.fromDate)), d3.timeWeek.offset(new Date(this.toDate), 1));
|
|
157
|
+
addVerticalGridLines(weekTicks);
|
|
158
|
+
}
|
|
159
|
+
else if (this._level === 'year-month') {
|
|
160
|
+
const monthTicks = d3.timeMonth
|
|
161
|
+
.every(1)
|
|
162
|
+
.range(d3.timeMonth.floor(new Date(this.fromDate)), d3.timeMonth.offset(new Date(this.toDate), 1));
|
|
163
|
+
addVerticalGridLines(monthTicks);
|
|
164
|
+
}
|
|
165
|
+
else if (this._level === 'year-quarter') {
|
|
166
|
+
const quarterTicks = d3.timeMonth
|
|
167
|
+
.every(3)
|
|
168
|
+
.range(d3.timeMonth.floor(new Date(this.fromDate)), d3.timeMonth.offset(new Date(this.toDate), 3));
|
|
169
|
+
addVerticalGridLines(quarterTicks);
|
|
170
|
+
}
|
|
171
|
+
addHorizontalGridLines();
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
syncScroll(e) {
|
|
175
|
+
this.shadowRoot.querySelector('div[chart-container]').scrollLeft = e.detail.offset;
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
__decorate([
|
|
179
|
+
property({ type: String })
|
|
180
|
+
], OxResourceChart.prototype, "fromDate", void 0);
|
|
181
|
+
__decorate([
|
|
182
|
+
property({ type: String })
|
|
183
|
+
], OxResourceChart.prototype, "toDate", void 0);
|
|
184
|
+
__decorate([
|
|
185
|
+
property({ type: String })
|
|
186
|
+
], OxResourceChart.prototype, "axisScale", void 0);
|
|
187
|
+
__decorate([
|
|
188
|
+
property({ type: Array })
|
|
189
|
+
], OxResourceChart.prototype, "resources", void 0);
|
|
190
|
+
OxResourceChart = __decorate([
|
|
191
|
+
customElement('ox-resource-chart')
|
|
192
|
+
], OxResourceChart);
|
|
193
|
+
export { OxResourceChart };
|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BAC1C,MAAM,YAAY,GAAG,EAAE,CAAC,SAAS;qBAC9B,KAAK,CAAC,CAAC,CAAE;qBACT,KAAK,CAAC,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;gBACpG,oBAAoB,CAAC,YAAY,CAAC,CAAA;YACpC,CAAC;YAED,sBAAsB,EAAE,CAAA;QAC1B,CAAC;IACH,CAAC;IAED,UAAU,CAAC,CAAc;QACvB,IAAI,CAAC,UAAW,CAAC,aAAa,CAAC,sBAAsB,CAAE,CAAC,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC,MAAM,CAAA;IACtF,CAAC;;AAlI2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDAAwF;AACvF;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAwF;AACvF;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAA+B;AAC/B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;kDAAsB;AAxDrC,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CAwL3B","sourcesContent":["import { LitElement, html, css, PropertyValues } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport * as d3 from 'd3'\n\nimport { ScrollbarStyles } from '@operato/styles'\n\n@customElement('ox-resource-chart')\nexport class OxResourceChart extends LitElement {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n overflow: hidden;\n position: relative;\n }\n div[chart-container] {\n display: block;\n overflow-x: auto;\n overflow-y: hidden;\n }\n svg {\n min-width: 100%;\n }\n svg[header] {\n display: block;\n min-width: 100%;\n box-sizing: border-box;\n border-bottom: 1px solid var(--ox-gantt-header-border-color, var(--md-sys-color-on-secondary-container));\n height: 40px;\n background-color: var(--ox-gantt-header-background-color, var(--md-sys-color-secondary-container));\n color: var(--ox-gantt-header-color, var(--md-sys-color-on-secondary-container));\n position: sticky;\n top: 0;\n z-index: 1;\n }\n svg[body] {\n display: block;\n min-width: 100%;\n }\n .top-axis text,\n .bottom-axis text {\n font-size: 12px;\n }\n .grid line {\n stroke: #e0e0e0;\n }\n .grid path {\n stroke-width: 0;\n }\n .no-select {\n user-select: none;\n }\n .selected {\n stroke-width: 2px;\n stroke: var(--ox-gantt-selected-color, blue);\n }\n `\n ]\n\n @property({ type: String }) fromDate: string = new Date(new Date().getFullYear(), 0, 1).toISOString().split('T')[0]\n @property({ type: String }) toDate: string = new Date(new Date().getFullYear(), 11, 31).toISOString().split('T')[0]\n @property({ type: String }) axisScale: string = 'week-day'\n @property({ type: Array }) resources: any[] = []\n\n private _timeScale: any\n private _baseWidth: number = 30\n private _level: string = 'week-day'\n\n render() {\n return html`\n <div chart-container>\n <svg header></svg>\n <svg body></svg>\n </div>\n `\n }\n\n updated(changedProperties: PropertyValues<this>) {\n if (changedProperties.has('fromDate') || changedProperties.has('toDate') || changedProperties.has('axisScale')) {\n this.updateTimeScale()\n }\n\n if (changedProperties.has('resources')) {\n this.drawBody()\n }\n\n this.drawAxes()\n }\n\n updateTimeScale() {\n this._timeScale = d3\n .scaleTime()\n .domain([d3.timeDay.floor(new Date(this.fromDate)), d3.timeDay.offset(new Date(this.toDate), 1)])\n .range([0, this.getChartWidth()])\n }\n\n getChartWidth() {\n const totalDays = d3.timeDay.count(new Date(this.fromDate), d3.timeDay.offset(new Date(this.toDate), 1))\n return (totalDays * this._baseWidth) / this.getScale()\n }\n\n getScale() {\n if (this._level == 'quarter-week') {\n return 7 / 2\n } else if (this._level == 'year-month') {\n return 30 / 2\n } else if (this._level == 'year-quarter') {\n return 90 / 2\n }\n return 1\n }\n\n drawAxes() {\n const header = d3.select(this.renderRoot.querySelector('svg[header]')!)\n\n header.selectAll('*').remove()\n header.attr('width', this.getChartWidth())\n\n const axisTop = d3.axisTop(this._timeScale).tickSize(-20)\n const axisBottom = d3.axisBottom(this._timeScale).tickSize(-20)\n\n header.append('g').attr('class', 'top-axis').attr('transform', 'translate(0, 20)').call(axisTop)\n header.append('g').attr('class', 'bottom-axis').attr('transform', 'translate(0, 40)').call(axisBottom)\n }\n\n drawBody() {\n const body = d3.select(this.renderRoot.querySelector('svg[body]')!)\n\n body.selectAll('*').remove()\n body.attr('width', this.getChartWidth())\n\n // Add grid lines for resource chart\n if (this.resources.length > 0) {\n const addVerticalGridLines = (ticks: Date[]) => {\n ticks.forEach(tick => {\n const startX = this._timeScale(tick)\n body\n .append('line')\n .attr('x1', startX)\n .attr('x2', startX)\n .attr('y1', 0)\n .attr('y2', this.resources.length * 30) // Adjust according to the number of resource rows\n .attr('stroke', 'var(--ox-gantt-color-gridlines, var(--md-sys-color-outline))')\n .attr('stroke-width', 1)\n })\n }\n\n const addHorizontalGridLines = () => {\n this.resources.forEach((_, index) => {\n const y = (index + 1) * 30\n body\n .append('line')\n .attr('x1', 0)\n .attr('x2', this.getChartWidth())\n .attr('y1', y)\n .attr('y2', y)\n .attr('stroke', 'var(--ox-gantt-color-gridlines, var(--md-sys-color-outline))')\n .attr('stroke-width', 1)\n })\n }\n\n if (this._level === 'week-day') {\n const dayTicks = d3.timeDay\n .every(1)!\n .range(d3.timeDay.floor(new Date(this.fromDate)), d3.timeDay.offset(new Date(this.toDate), 1))\n addVerticalGridLines(dayTicks)\n } else if (this._level === 'quarter-week') {\n const weekTicks = d3.timeWeek\n .every(1)!\n .range(d3.timeWeek.floor(new Date(this.fromDate)), d3.timeWeek.offset(new Date(this.toDate), 1))\n addVerticalGridLines(weekTicks)\n } else if (this._level === 'year-month') {\n const monthTicks = d3.timeMonth\n .every(1)!\n .range(d3.timeMonth.floor(new Date(this.fromDate)), d3.timeMonth.offset(new Date(this.toDate), 1))\n addVerticalGridLines(monthTicks)\n } else if (this._level === 'year-quarter') {\n const quarterTicks = d3.timeMonth\n .every(3)!\n .range(d3.timeMonth.floor(new Date(this.fromDate)), d3.timeMonth.offset(new Date(this.toDate), 3))\n addVerticalGridLines(quarterTicks)\n }\n\n addHorizontalGridLines()\n }\n }\n\n syncScroll(e: CustomEvent) {\n this.shadowRoot!.querySelector('div[chart-container]')!.scrollLeft = e.detail.offset\n }\n}\n"]}
|
package/dist/src/types.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export interface Task {
|
|
|
12
12
|
length: string;
|
|
13
13
|
tags?: TaskTag[];
|
|
14
14
|
children?: Task[];
|
|
15
|
+
resources?: Resource[];
|
|
15
16
|
}
|
|
16
17
|
export interface Section {
|
|
17
18
|
name: string;
|
|
@@ -24,3 +25,7 @@ export interface ColumnConfig {
|
|
|
24
25
|
order: number;
|
|
25
26
|
}
|
|
26
27
|
export type TimeScale = 'year-quarter' | 'year-month' | 'quarter-week' | 'week-day';
|
|
28
|
+
export interface Resource {
|
|
29
|
+
type: string;
|
|
30
|
+
allocated: number;
|
|
31
|
+
}
|
package/dist/src/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"","sourcesContent":["export type TaskTag = 'done' | 'active' | 'critical' | 'milestone'\nexport type TaskType = 'task' | 'milestone' | 'phase'\n\nexport interface Task {\n id: string\n title: string\n type: TaskType\n section?: Section\n startDate: Date | string\n endDate: Date | string\n progress?: number\n dependsOn?: string\n length: string\n tags?: TaskTag[]\n children?: Task[]\n}\n\nexport interface Section {\n name: string\n}\n\nexport interface ColumnConfig {\n name: string\n label: string\n visible: boolean\n width: number\n order: number\n}\n\nexport type TimeScale = 'year-quarter' | 'year-month' | 'quarter-week' | 'week-day'\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"","sourcesContent":["export type TaskTag = 'done' | 'active' | 'critical' | 'milestone'\nexport type TaskType = 'task' | 'milestone' | 'phase'\n\nexport interface Task {\n id: string\n title: string\n type: TaskType\n section?: Section\n startDate: Date | string\n endDate: Date | string\n progress?: number\n dependsOn?: string\n length: string\n tags?: TaskTag[]\n children?: Task[]\n resources?: Resource[]\n}\n\nexport interface Section {\n name: string\n}\n\nexport interface ColumnConfig {\n name: string\n label: string\n visible: boolean\n width: number\n order: number\n}\n\nexport type TimeScale = 'year-quarter' | 'year-month' | 'quarter-week' | 'week-day'\n\nexport interface Resource {\n type: string\n allocated: number\n}\n"]}
|
|
@@ -102,6 +102,7 @@ Regular.args = {
|
|
|
102
102
|
dependsOn: '',
|
|
103
103
|
length: '5d',
|
|
104
104
|
tags: ['active'],
|
|
105
|
+
resources: [{ type: '철근/형틀공', allocated: 6 }],
|
|
105
106
|
children: []
|
|
106
107
|
},
|
|
107
108
|
{
|
|
@@ -115,6 +116,7 @@ Regular.args = {
|
|
|
115
116
|
dependsOn: '1',
|
|
116
117
|
length: '1d',
|
|
117
118
|
tags: ['milestone'],
|
|
119
|
+
resources: [{ type: '철근/형틀공', allocated: 6 }],
|
|
118
120
|
children: []
|
|
119
121
|
},
|
|
120
122
|
{
|
|
@@ -140,7 +142,35 @@ Regular.args = {
|
|
|
140
142
|
dependsOn: '',
|
|
141
143
|
length: '4d',
|
|
142
144
|
tags: ['done'],
|
|
143
|
-
children: [
|
|
145
|
+
children: [
|
|
146
|
+
{
|
|
147
|
+
id: '3-1-1',
|
|
148
|
+
title: 'Coding-A',
|
|
149
|
+
type: 'task',
|
|
150
|
+
// section: developmentSection,
|
|
151
|
+
startDate: '2023-01-07',
|
|
152
|
+
endDate: '2023-01-10',
|
|
153
|
+
progress: 60,
|
|
154
|
+
dependsOn: '',
|
|
155
|
+
length: '4d',
|
|
156
|
+
tags: ['done'],
|
|
157
|
+
resources: [{ type: '창호공', allocated: 6 }],
|
|
158
|
+
children: []
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
id: '3-1-2',
|
|
162
|
+
title: 'Coding-B',
|
|
163
|
+
type: 'task',
|
|
164
|
+
// section: developmentSection,
|
|
165
|
+
startDate: '2023-01-11',
|
|
166
|
+
endDate: '2023-01-15',
|
|
167
|
+
dependsOn: '3-1-1',
|
|
168
|
+
length: '5d',
|
|
169
|
+
tags: ['active'],
|
|
170
|
+
resources: [{ type: '창호공', allocated: 6 }],
|
|
171
|
+
children: []
|
|
172
|
+
}
|
|
173
|
+
]
|
|
144
174
|
},
|
|
145
175
|
{
|
|
146
176
|
id: '3-2',
|
|
@@ -152,6 +182,7 @@ Regular.args = {
|
|
|
152
182
|
dependsOn: '3-1',
|
|
153
183
|
length: '5d',
|
|
154
184
|
tags: ['active'],
|
|
185
|
+
resources: [{ type: '창호공', allocated: 6 }],
|
|
155
186
|
children: []
|
|
156
187
|
}
|
|
157
188
|
]
|
|
@@ -167,6 +198,7 @@ Regular.args = {
|
|
|
167
198
|
dependsOn: '1',
|
|
168
199
|
length: '1d',
|
|
169
200
|
tags: ['done'],
|
|
201
|
+
resources: [{ type: '방수공', allocated: 6 }],
|
|
170
202
|
children: []
|
|
171
203
|
},
|
|
172
204
|
{
|
|
@@ -179,6 +211,7 @@ Regular.args = {
|
|
|
179
211
|
dependsOn: '4',
|
|
180
212
|
length: '1d',
|
|
181
213
|
tags: ['milestone'],
|
|
214
|
+
resources: [{ type: '목공', allocated: 6 }],
|
|
182
215
|
children: []
|
|
183
216
|
},
|
|
184
217
|
{
|
|
@@ -191,6 +224,7 @@ Regular.args = {
|
|
|
191
224
|
dependsOn: '5',
|
|
192
225
|
length: '1d',
|
|
193
226
|
tags: ['milestone'],
|
|
227
|
+
resources: [{ type: '금속공', allocated: 6 }],
|
|
194
228
|
children: []
|
|
195
229
|
},
|
|
196
230
|
{
|
|
@@ -203,6 +237,7 @@ Regular.args = {
|
|
|
203
237
|
dependsOn: '6',
|
|
204
238
|
length: '1d',
|
|
205
239
|
tags: ['milestone'],
|
|
240
|
+
resources: [{ type: '타일공', allocated: 6 }],
|
|
206
241
|
children: []
|
|
207
242
|
},
|
|
208
243
|
{
|
|
@@ -215,6 +250,7 @@ Regular.args = {
|
|
|
215
250
|
dependsOn: '7',
|
|
216
251
|
length: '1d',
|
|
217
252
|
tags: ['critical'],
|
|
253
|
+
resources: [{ type: '창호공', allocated: 6 }],
|
|
218
254
|
children: []
|
|
219
255
|
},
|
|
220
256
|
{
|
|
@@ -227,6 +263,7 @@ Regular.args = {
|
|
|
227
263
|
dependsOn: '8',
|
|
228
264
|
length: '1d',
|
|
229
265
|
tags: ['active'],
|
|
266
|
+
resources: [{ type: '도배공', allocated: 6 }],
|
|
230
267
|
children: []
|
|
231
268
|
},
|
|
232
269
|
{
|
|
@@ -239,6 +276,7 @@ Regular.args = {
|
|
|
239
276
|
dependsOn: '9',
|
|
240
277
|
length: '1d',
|
|
241
278
|
tags: ['critical'],
|
|
279
|
+
resources: [{ type: '조적공', allocated: 6 }],
|
|
242
280
|
children: []
|
|
243
281
|
},
|
|
244
282
|
{
|
|
@@ -263,7 +301,33 @@ Regular.args = {
|
|
|
263
301
|
dependsOn: '9',
|
|
264
302
|
length: '1d',
|
|
265
303
|
tags: ['milestone'],
|
|
266
|
-
children: [
|
|
304
|
+
children: [
|
|
305
|
+
{
|
|
306
|
+
id: '12-1',
|
|
307
|
+
title: 'Coding-A',
|
|
308
|
+
type: 'task',
|
|
309
|
+
// section: developmentSection,
|
|
310
|
+
startDate: '2023-01-07',
|
|
311
|
+
endDate: '2023-01-10',
|
|
312
|
+
progress: 60,
|
|
313
|
+
dependsOn: '',
|
|
314
|
+
length: '4d',
|
|
315
|
+
tags: ['done'],
|
|
316
|
+
children: []
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
id: '12-2',
|
|
320
|
+
title: 'Coding-B',
|
|
321
|
+
type: 'task',
|
|
322
|
+
// section: developmentSection,
|
|
323
|
+
startDate: '2023-01-11',
|
|
324
|
+
endDate: '2023-01-15',
|
|
325
|
+
dependsOn: '12-1',
|
|
326
|
+
length: '5d',
|
|
327
|
+
tags: ['active'],
|
|
328
|
+
children: []
|
|
329
|
+
}
|
|
330
|
+
]
|
|
267
331
|
},
|
|
268
332
|
{
|
|
269
333
|
id: '13',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ox-gantt.stories.js","sourceRoot":"","sources":["../../stories/ox-gantt.stories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,oBAAoB,CAAA;AAE3B,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAC1C,OAAO,EAAE,MAAM,IAAI,iBAAiB,EAAE,MAAM,8CAA8C,CAAA;AAI1F,eAAe;IACb,KAAK,EAAE,UAAU;IACjB,SAAS,EAAE,UAAU;IACrB,QAAQ,EAAE;QACR,QAAQ,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;QAC7B,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;QAC3B,SAAS,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,cAAc,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,CAAC,EAAE;QACrG,eAAe,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;QACvC,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;KAC7B;CACF,CAAA;AAgBD,MAAM,QAAQ,GAAoB,CAAC,EACjC,KAAK,EACL,QAAQ,EACR,MAAM,EACN,eAAe,EACf,SAAS,GAAG,UAAU,EACb,EAAE,EAAE,CAAC,IAAI,CAAA;;;;;;;;;;;;;;;;;;;;;;MAsBd,iBAAiB,CAAC,OAAO;;;;MAIzB,kBAAkB,CAAC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;gBAwBhB,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC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,EAAE,EAAE;SACb;KACF;CACF,CAAA","sourcesContent":["import { CommonHeaderStyles } from '@operato/styles'\nimport '../src/ox-gantt.js'\n\nimport { html, TemplateResult } from 'lit'\nimport { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles'\n\nimport { Task, Section, TimeScale } from '../src/types.js'\n\nexport default {\n title: 'ox-gantt',\n component: 'ox-gantt',\n argTypes: {\n fromDate: { control: 'date' },\n toDate: { control: 'date' },\n timeScale: { control: 'select', options: ['year-quarter', 'year-month', 'quarter-week', 'week-day'] },\n extendGridLines: { control: 'boolean' },\n tasks: { control: 'object' }\n }\n}\n\ninterface Story<T> {\n (args: T): TemplateResult\n args?: Partial<T>\n argTypes?: Record<string, unknown>\n}\n\ninterface ArgTypes {\n tasks: Task[]\n fromDate: number | string\n toDate: number | string\n extendGridLines: boolean\n timeScale: TimeScale\n}\n\nconst Template: Story<ArgTypes> = ({\n tasks,\n fromDate,\n toDate,\n extendGridLines,\n timeScale = 'week-day'\n}: ArgTypes) => html`\n <link href=\"https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap\" rel=\"stylesheet\" />\n\n <link href=\"/themes/light.css\" rel=\"stylesheet\" />\n <link href=\"/themes/dark.css\" rel=\"stylesheet\" />\n <link href=\"/themes/spacing.css\" rel=\"stylesheet\" />\n <link href=\"/themes/md-typescale-styles.css\" rel=\"stylesheet\" />\n\n <link\n href=\"https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1\"\n rel=\"stylesheet\"\n />\n <link\n href=\"https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1\"\n rel=\"stylesheet\"\n />\n <link\n href=\"https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1\"\n rel=\"stylesheet\"\n />\n\n <style>\n ${MDTypeScaleStyles.cssText}\n </style>\n\n <style>\n ${CommonHeaderStyles.cssText}\n </style>\n\n <style>\n body {\n width: 100%;\n height: 800px;\n text-align: center;\n\n background-color: var(--md-sys-color-background);\n color: var(--md-sys-color-on-background);\n }\n\n ox-gantt {\n width: 90%;\n height: 500px;\n box-sizing: border-box;\n\n background-color: var(--md-sys-color-primary-container);\n color: var(--md-sys-color-on-primary-container);\n }\n </style>\n\n <ox-gantt\n from-date=${new Date(fromDate).toISOString().split('T')[0]}\n to-date=${new Date(toDate).toISOString().split('T')[0]}\n .timeScale=${timeScale}\n .tasks=${tasks}\n @date-range-selected=${(e: CustomEvent) => {\n console.log('date-range-selected', e.detail)\n }}\n @task-clicked=${(e: CustomEvent) => {\n console.log('task-clicked', e.detail)\n }}\n ?extend-grid-lines=${extendGridLines}\n >\n </ox-gantt>\n`\n\nconst developmentSection: Section = {\n name: 'Development'\n}\n\nconst testSection: Section = {\n name: 'Test'\n}\n\nconst releaseSection: Section = {\n name: 'Release'\n}\n\nexport const Regular = Template.bind({})\nRegular.args = {\n fromDate: '2022-12-27',\n toDate: '2024-12-31',\n tasks: [\n {\n id: '1',\n title: 'Design',\n type: 'task',\n // section: developmentSection,\n startDate: '2023-01-01',\n endDate: '2023-01-05',\n progress: 60,\n dependsOn: '',\n length: '5d',\n tags: ['active'],\n children: []\n },\n {\n id: '2',\n title: 'Development',\n type: 'milestone',\n // section: developmentSection,\n startDate: '2023-01-06',\n endDate: '2023-01-06',\n progress: 30,\n dependsOn: '1',\n length: '1d',\n tags: ['milestone'],\n children: []\n },\n {\n id: '3',\n title: 'Coding',\n type: 'phase',\n // section: developmentSection,\n startDate: '2023-01-07',\n endDate: '2023-01-15',\n progress: 10,\n dependsOn: '2',\n length: '9d',\n tags: ['critical'],\n children: [\n {\n id: '3-1',\n title: 'Coding-A',\n type: 'task',\n // section: developmentSection,\n startDate: '2023-01-07',\n endDate: '2023-01-10',\n progress: 60,\n dependsOn: '',\n length: '4d',\n tags: ['done'],\n children: []\n },\n {\n id: '3-2',\n title: 'Coding-B',\n type: 'task',\n // section: developmentSection,\n startDate: '2023-01-11',\n endDate: '2023-01-15',\n dependsOn: '3-1',\n length: '5d',\n tags: ['active'],\n children: []\n }\n ]\n },\n {\n id: '4',\n title: 'Test',\n type: 'milestone',\n // section: developmentSection,\n startDate: '2023-01-07',\n endDate: '2023-01-10',\n progress: 100,\n dependsOn: '1',\n length: '1d',\n tags: ['done'],\n children: []\n },\n {\n id: '5',\n title: 'Deploy',\n type: 'milestone',\n // section: developmentSection,\n startDate: '2023-01-15',\n endDate: '2023-01-21',\n dependsOn: '4',\n length: '1d',\n tags: ['milestone'],\n children: []\n },\n {\n id: '6',\n title: 'Publishing',\n type: 'milestone',\n // section: developmentSection,\n startDate: '2023-01-11',\n endDate: '2023-01-15',\n dependsOn: '5',\n length: '1d',\n tags: ['milestone'],\n children: []\n },\n {\n id: '7',\n title: 'Provisioning',\n type: 'milestone',\n // section: developmentSection,\n startDate: '2023-01-12',\n endDate: '2023-01-15',\n dependsOn: '6',\n length: '1d',\n tags: ['milestone'],\n children: []\n },\n {\n id: '8',\n title: 'Alpha Test',\n type: 'milestone',\n // section: testSection,\n startDate: '2023-01-15',\n endDate: '2023-01-17',\n dependsOn: '7',\n length: '1d',\n tags: ['critical'],\n children: []\n },\n {\n id: '9',\n title: 'Beta Task',\n type: 'milestone',\n // section: testSection,\n startDate: '2023-01-15',\n endDate: '2023-01-18',\n dependsOn: '8',\n length: '1d',\n tags: ['active'],\n children: []\n },\n {\n id: '10',\n title: 'Gamma Test',\n type: 'milestone',\n // section: testSection,\n startDate: '2023-01-18',\n endDate: '2023-01-19',\n dependsOn: '9',\n length: '1d',\n tags: ['critical'],\n children: []\n },\n {\n id: '11',\n title: 'Zeta Test',\n type: 'milestone',\n // section: testSection,\n startDate: '2023-01-18',\n endDate: '2023-01-22',\n dependsOn: '9',\n length: '1d',\n tags: ['milestone'],\n children: []\n },\n {\n id: '12',\n title: 'Release',\n type: 'milestone',\n // section: releaseSection,\n startDate: '2023-01-18',\n endDate: '2023-01-23',\n dependsOn: '9',\n length: '1d',\n tags: ['milestone'],\n children: []\n },\n {\n id: '13',\n title: 'Release',\n type: 'milestone',\n // section: releaseSection,\n startDate: '2023-01-22',\n endDate: '2023-01-27',\n dependsOn: '12',\n length: '1d',\n tags: ['done'],\n children: []\n },\n {\n id: '14',\n title: 'Release',\n type: 'milestone',\n // section: releaseSection,\n startDate: '2023-01-27',\n endDate: '2023-01-30',\n dependsOn: '13',\n length: '1d',\n tags: ['milestone'],\n children: []\n },\n {\n id: '15',\n title: 'Release',\n type: 'milestone',\n // section: releaseSection,\n startDate: '2023-01-30',\n endDate: '2023-01-31',\n dependsOn: '14',\n length: '1d',\n tags: ['milestone'],\n children: []\n },\n {\n id: '16',\n title: 'Release',\n type: 'milestone',\n // section: releaseSection,\n startDate: '2023-01-31',\n endDate: '2023-02-05',\n dependsOn: '15',\n length: '1d',\n tags: ['active'],\n children: []\n },\n {\n id: '17',\n title: 'Release',\n type: 'milestone',\n // section: releaseSection,\n startDate: '2023-02-06',\n endDate: '2023-02-07',\n dependsOn: '16',\n length: '1d',\n tags: ['milestone'],\n children: []\n },\n {\n id: '18',\n title: 'Release',\n type: 'milestone',\n // section: releaseSection,\n startDate: '2023-02-08',\n endDate: '2023-02-09',\n dependsOn: '17',\n length: '1d',\n tags: ['critical'],\n children: []\n },\n {\n id: '19',\n title: 'Release',\n type: 'milestone',\n // section: releaseSection,\n startDate: '2023-02-10',\n endDate: '2023-02-25',\n dependsOn: '18',\n length: '1d',\n tags: ['milestone'],\n children: []\n }\n ]\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ox-gantt.stories.js","sourceRoot":"","sources":["../../stories/ox-gantt.stories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,oBAAoB,CAAA;AAE3B,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAC1C,OAAO,EAAE,MAAM,IAAI,iBAAiB,EAAE,MAAM,8CAA8C,C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,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,WAAW;YACjB,2BAA2B;YAC3B,SAAS,EAAE,YAAY;YACvB,OAAO,EAAE,YAAY;YACrB,SAAS,EAAE,IAAI;YACf,MAAM,EAAE,IAAI;YACZ,IAAI,EAAE,CAAC,UAAU,CAAC;YAClB,QAAQ,EAAE,EAAE;SACb;QACD;YACE,EAAE,EAAE,IAAI;YACR,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,WAAW;YACjB,2BAA2B;YAC3B,SAAS,EAAE,YAAY;YACvB,OAAO,EAAE,YAAY;YACrB,SAAS,EAAE,IAAI;YACf,MAAM,EAAE,IAAI;YACZ,IAAI,EAAE,CAAC,WAAW,CAAC;YACnB,QAAQ,EAAE,EAAE;SACb;KACF;CACF,CAAA","sourcesContent":["import { CommonHeaderStyles } from '@operato/styles'\nimport '../src/ox-gantt.js'\n\nimport { html, TemplateResult } from 'lit'\nimport { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles'\n\nimport { Task, Section, TimeScale } from '../src/types.js'\n\nexport default {\n title: 'ox-gantt',\n component: 'ox-gantt',\n argTypes: {\n fromDate: { control: 'date' },\n toDate: { control: 'date' },\n timeScale: { control: 'select', options: ['year-quarter', 'year-month', 'quarter-week', 'week-day'] },\n extendGridLines: { control: 'boolean' },\n tasks: { control: 'object' }\n }\n}\n\ninterface Story<T> {\n (args: T): TemplateResult\n args?: Partial<T>\n argTypes?: Record<string, unknown>\n}\n\ninterface ArgTypes {\n tasks: Task[]\n fromDate: number | string\n toDate: number | string\n extendGridLines: boolean\n timeScale: TimeScale\n}\n\nconst Template: Story<ArgTypes> = ({\n tasks,\n fromDate,\n toDate,\n extendGridLines,\n timeScale = 'week-day'\n}: ArgTypes) => html`\n <link href=\"https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap\" rel=\"stylesheet\" />\n\n <link href=\"/themes/light.css\" rel=\"stylesheet\" />\n <link href=\"/themes/dark.css\" rel=\"stylesheet\" />\n <link href=\"/themes/spacing.css\" rel=\"stylesheet\" />\n <link href=\"/themes/md-typescale-styles.css\" rel=\"stylesheet\" />\n\n <link\n href=\"https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1\"\n rel=\"stylesheet\"\n />\n <link\n href=\"https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1\"\n rel=\"stylesheet\"\n />\n <link\n href=\"https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1\"\n rel=\"stylesheet\"\n />\n\n <style>\n ${MDTypeScaleStyles.cssText}\n </style>\n\n <style>\n ${CommonHeaderStyles.cssText}\n </style>\n\n <style>\n body {\n width: 100%;\n height: 800px;\n text-align: center;\n\n background-color: var(--md-sys-color-background);\n color: var(--md-sys-color-on-background);\n }\n\n ox-gantt {\n width: 90%;\n height: 500px;\n box-sizing: border-box;\n\n background-color: var(--md-sys-color-primary-container);\n color: var(--md-sys-color-on-primary-container);\n }\n </style>\n\n <ox-gantt\n from-date=${new Date(fromDate).toISOString().split('T')[0]}\n to-date=${new Date(toDate).toISOString().split('T')[0]}\n .timeScale=${timeScale}\n .tasks=${tasks}\n @date-range-selected=${(e: CustomEvent) => {\n console.log('date-range-selected', e.detail)\n }}\n @task-clicked=${(e: CustomEvent) => {\n console.log('task-clicked', e.detail)\n }}\n ?extend-grid-lines=${extendGridLines}\n >\n </ox-gantt>\n`\n\nconst developmentSection: Section = {\n name: 'Development'\n}\n\nconst testSection: Section = {\n name: 'Test'\n}\n\nconst releaseSection: Section = {\n name: 'Release'\n}\n\nexport const Regular = Template.bind({})\nRegular.args = {\n fromDate: '2022-12-27',\n toDate: '2024-12-31',\n tasks: [\n {\n id: '1',\n title: 'Design',\n type: 'task',\n // section: developmentSection,\n startDate: '2023-01-01',\n endDate: '2023-01-05',\n progress: 60,\n dependsOn: '',\n length: '5d',\n tags: ['active'],\n resources: [{ type: '철근/형틀공', allocated: 6 }],\n children: []\n },\n {\n id: '2',\n title: 'Development',\n type: 'milestone',\n // section: developmentSection,\n startDate: '2023-01-06',\n endDate: '2023-01-06',\n progress: 30,\n dependsOn: '1',\n length: '1d',\n tags: ['milestone'],\n resources: [{ type: '철근/형틀공', allocated: 6 }],\n children: []\n },\n {\n id: '3',\n title: 'Coding',\n type: 'phase',\n // section: developmentSection,\n startDate: '2023-01-07',\n endDate: '2023-01-15',\n progress: 10,\n dependsOn: '2',\n length: '9d',\n tags: ['critical'],\n children: [\n {\n id: '3-1',\n title: 'Coding-A',\n type: 'task',\n // section: developmentSection,\n startDate: '2023-01-07',\n endDate: '2023-01-10',\n progress: 60,\n dependsOn: '',\n length: '4d',\n tags: ['done'],\n children: [\n {\n id: '3-1-1',\n title: 'Coding-A',\n type: 'task',\n // section: developmentSection,\n startDate: '2023-01-07',\n endDate: '2023-01-10',\n progress: 60,\n dependsOn: '',\n length: '4d',\n tags: ['done'],\n resources: [{ type: '창호공', allocated: 6 }],\n children: []\n },\n {\n id: '3-1-2',\n title: 'Coding-B',\n type: 'task',\n // section: developmentSection,\n startDate: '2023-01-11',\n endDate: '2023-01-15',\n dependsOn: '3-1-1',\n length: '5d',\n tags: ['active'],\n resources: [{ type: '창호공', allocated: 6 }],\n children: []\n }\n ]\n },\n {\n id: '3-2',\n title: 'Coding-B',\n type: 'task',\n // section: developmentSection,\n startDate: '2023-01-11',\n endDate: '2023-01-15',\n dependsOn: '3-1',\n length: '5d',\n tags: ['active'],\n resources: [{ type: '창호공', allocated: 6 }],\n children: []\n }\n ]\n },\n {\n id: '4',\n title: 'Test',\n type: 'milestone',\n // section: developmentSection,\n startDate: '2023-01-07',\n endDate: '2023-01-10',\n progress: 100,\n dependsOn: '1',\n length: '1d',\n tags: ['done'],\n resources: [{ type: '방수공', allocated: 6 }],\n children: []\n },\n {\n id: '5',\n title: 'Deploy',\n type: 'milestone',\n // section: developmentSection,\n startDate: '2023-01-15',\n endDate: '2023-01-21',\n dependsOn: '4',\n length: '1d',\n tags: ['milestone'],\n resources: [{ type: '목공', allocated: 6 }],\n children: []\n },\n {\n id: '6',\n title: 'Publishing',\n type: 'milestone',\n // section: developmentSection,\n startDate: '2023-01-11',\n endDate: '2023-01-15',\n dependsOn: '5',\n length: '1d',\n tags: ['milestone'],\n resources: [{ type: '금속공', allocated: 6 }],\n children: []\n },\n {\n id: '7',\n title: 'Provisioning',\n type: 'milestone',\n // section: developmentSection,\n startDate: '2023-01-12',\n endDate: '2023-01-15',\n dependsOn: '6',\n length: '1d',\n tags: ['milestone'],\n resources: [{ type: '타일공', allocated: 6 }],\n children: []\n },\n {\n id: '8',\n title: 'Alpha Test',\n type: 'milestone',\n // section: testSection,\n startDate: '2023-01-15',\n endDate: '2023-01-17',\n dependsOn: '7',\n length: '1d',\n tags: ['critical'],\n resources: [{ type: '창호공', allocated: 6 }],\n children: []\n },\n {\n id: '9',\n title: 'Beta Task',\n type: 'milestone',\n // section: testSection,\n startDate: '2023-01-15',\n endDate: '2023-01-18',\n dependsOn: '8',\n length: '1d',\n tags: ['active'],\n resources: [{ type: '도배공', allocated: 6 }],\n children: []\n },\n {\n id: '10',\n title: 'Gamma Test',\n type: 'milestone',\n // section: testSection,\n startDate: '2023-01-18',\n endDate: '2023-01-19',\n dependsOn: '9',\n length: '1d',\n tags: ['critical'],\n resources: [{ type: '조적공', allocated: 6 }],\n children: []\n },\n {\n id: '11',\n title: 'Zeta Test',\n type: 'milestone',\n // section: testSection,\n startDate: '2023-01-18',\n endDate: '2023-01-22',\n dependsOn: '9',\n length: '1d',\n tags: ['milestone'],\n children: []\n },\n {\n id: '12',\n title: 'Release',\n type: 'milestone',\n // section: releaseSection,\n startDate: '2023-01-18',\n endDate: '2023-01-23',\n dependsOn: '9',\n length: '1d',\n tags: ['milestone'],\n children: [\n {\n id: '12-1',\n title: 'Coding-A',\n type: 'task',\n // section: developmentSection,\n startDate: '2023-01-07',\n endDate: '2023-01-10',\n progress: 60,\n dependsOn: '',\n length: '4d',\n tags: ['done'],\n children: []\n },\n {\n id: '12-2',\n title: 'Coding-B',\n type: 'task',\n // section: developmentSection,\n startDate: '2023-01-11',\n endDate: '2023-01-15',\n dependsOn: '12-1',\n length: '5d',\n tags: ['active'],\n children: []\n }\n ]\n },\n {\n id: '13',\n title: 'Release',\n type: 'milestone',\n // section: releaseSection,\n startDate: '2023-01-22',\n endDate: '2023-01-27',\n dependsOn: '12',\n length: '1d',\n tags: ['done'],\n children: []\n },\n {\n id: '14',\n title: 'Release',\n type: 'milestone',\n // section: releaseSection,\n startDate: '2023-01-27',\n endDate: '2023-01-30',\n dependsOn: '13',\n length: '1d',\n tags: ['milestone'],\n children: []\n },\n {\n id: '15',\n title: 'Release',\n type: 'milestone',\n // section: releaseSection,\n startDate: '2023-01-30',\n endDate: '2023-01-31',\n dependsOn: '14',\n length: '1d',\n tags: ['milestone'],\n children: []\n },\n {\n id: '16',\n title: 'Release',\n type: 'milestone',\n // section: releaseSection,\n startDate: '2023-01-31',\n endDate: '2023-02-05',\n dependsOn: '15',\n length: '1d',\n tags: ['active'],\n children: []\n },\n {\n id: '17',\n title: 'Release',\n type: 'milestone',\n // section: releaseSection,\n startDate: '2023-02-06',\n endDate: '2023-02-07',\n dependsOn: '16',\n length: '1d',\n tags: ['milestone'],\n children: []\n },\n {\n id: '18',\n title: 'Release',\n type: 'milestone',\n // section: releaseSection,\n startDate: '2023-02-08',\n endDate: '2023-02-09',\n dependsOn: '17',\n length: '1d',\n tags: ['critical'],\n children: []\n },\n {\n id: '19',\n title: 'Release',\n type: 'milestone',\n // section: releaseSection,\n startDate: '2023-02-10',\n endDate: '2023-02-25',\n dependsOn: '18',\n length: '1d',\n tags: ['milestone'],\n children: []\n }\n ]\n}\n"]}
|