@operato/gantt 7.0.74 → 7.0.76
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 +18 -0
- package/dist/src/gantt-chart-controller.d.ts +2 -0
- package/dist/src/gantt-chart-controller.js +4 -1
- package/dist/src/gantt-chart-controller.js.map +1 -1
- package/dist/src/ox-gantt-chart.d.ts +1 -0
- package/dist/src/ox-gantt-chart.js +6 -0
- package/dist/src/ox-gantt-chart.js.map +1 -1
- package/dist/src/ox-gantt.d.ts +1 -0
- package/dist/src/ox-gantt.js +19 -0
- package/dist/src/ox-gantt.js.map +1 -1
- package/dist/src/ox-resource-chart.d.ts +1 -0
- package/dist/src/ox-resource-chart.js +6 -4
- package/dist/src/ox-resource-chart.js.map +1 -1
- package/dist/stories/ox-gantt.stories.js +0 -24
- package/dist/stories/ox-gantt.stories.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/gantt-chart-controller.ts +7 -1
- package/src/ox-gantt-chart.ts +5 -0
- package/src/ox-gantt.ts +13 -0
- package/src/ox-resource-chart.ts +9 -4
- package/stories/ox-gantt.stories.ts +0 -24
|
@@ -16,6 +16,8 @@ export class GanttChartController implements ReactiveController {
|
|
|
16
16
|
private scrollStartX?: number
|
|
17
17
|
private scrollStartY?: number
|
|
18
18
|
|
|
19
|
+
private colorProvider?: (task: Task) => string
|
|
20
|
+
|
|
19
21
|
public baseWidth: number = 30
|
|
20
22
|
public level: TimeScale
|
|
21
23
|
public selectedTaskId?: string
|
|
@@ -36,6 +38,10 @@ export class GanttChartController implements ReactiveController {
|
|
|
36
38
|
this.updateTimeScale()
|
|
37
39
|
}
|
|
38
40
|
|
|
41
|
+
setColorProvider(colorProvider: (task: Task) => string) {
|
|
42
|
+
this.colorProvider = colorProvider
|
|
43
|
+
}
|
|
44
|
+
|
|
39
45
|
get timeScale() {
|
|
40
46
|
if (!this._timeScale) {
|
|
41
47
|
this._timeScale = d3
|
|
@@ -174,7 +180,7 @@ export class GanttChartController implements ReactiveController {
|
|
|
174
180
|
.attr('y', taskY)
|
|
175
181
|
.attr('width', taskWidth)
|
|
176
182
|
.attr('height', 15)
|
|
177
|
-
.attr('fill', this.
|
|
183
|
+
.attr('fill', this.colorProvider ? this.colorProvider(task) : 'gray')
|
|
178
184
|
.attr('stroke', 'black')
|
|
179
185
|
.attr('stroke-width', 1)
|
|
180
186
|
|
package/src/ox-gantt-chart.ts
CHANGED
|
@@ -79,6 +79,7 @@ export class OxGanttChart extends LitElement {
|
|
|
79
79
|
@property({ type: Array }) tasks: Task[] = []
|
|
80
80
|
@property({ type: String, attribute: 'selected-task-id' }) selectedTaskId?: string
|
|
81
81
|
@property({ type: String }) locale: string = 'en-US'
|
|
82
|
+
@property({ type: Object }) colorProvider!: (task: Task) => string
|
|
82
83
|
|
|
83
84
|
@query('svg[header]') svgHeader!: SVGElement
|
|
84
85
|
@query('svg[body]') svgBody!: SVGElement
|
|
@@ -119,6 +120,10 @@ export class OxGanttChart extends LitElement {
|
|
|
119
120
|
this.ganttChartController.updateTimeScale()
|
|
120
121
|
}
|
|
121
122
|
|
|
123
|
+
if (changedProperties.has('colorProvider')) {
|
|
124
|
+
this.ganttChartController.setColorProvider(this.colorProvider)
|
|
125
|
+
}
|
|
126
|
+
|
|
122
127
|
this.ganttChartController.drawAxes(this.svgHeader)
|
|
123
128
|
this.ganttChartController.drawBody(this.svgBody, this.tooltip)
|
|
124
129
|
}
|
package/src/ox-gantt.ts
CHANGED
|
@@ -145,6 +145,18 @@ export class OxGantt extends localize(i18next)(LitElement) {
|
|
|
145
145
|
toDate: string = new Date(new Date().getFullYear(), 11, 31).toISOString().split('T')[0] /* end of this year */
|
|
146
146
|
@property({ type: Boolean, attribute: 'extend-grid-lines' }) extendGridLines: boolean = false
|
|
147
147
|
@property({ type: String, attribute: 'time-scale' }) timeScale: TimeScale = 'week-day'
|
|
148
|
+
@property({ type: Object }) colorProvider: (task: Task) => string = function (task: Task) {
|
|
149
|
+
const { tags = [] } = task
|
|
150
|
+
if (tags.includes('critical')) {
|
|
151
|
+
return 'red'
|
|
152
|
+
} else if (tags.includes('milestone')) {
|
|
153
|
+
return 'blue'
|
|
154
|
+
} else if (tags.includes('done')) {
|
|
155
|
+
return 'green'
|
|
156
|
+
} else {
|
|
157
|
+
return 'grey'
|
|
158
|
+
}
|
|
159
|
+
}
|
|
148
160
|
@property({ type: Object }) columnConfigProvider: () => ColumnConfig[] = function () {
|
|
149
161
|
return [
|
|
150
162
|
{ name: 'id', label: i18next.t('label.gantt-task-id') || 'ID', visible: true, width: 50, order: 1 },
|
|
@@ -229,6 +241,7 @@ export class OxGantt extends localize(i18next)(LitElement) {
|
|
|
229
241
|
.tasks=${this.tasks}
|
|
230
242
|
.selectedTaskId=${this.selectedTaskId}
|
|
231
243
|
.axisScale=${this.timeScale}
|
|
244
|
+
.colorProvider=${this.colorProvider}
|
|
232
245
|
?extend-grid-lines=${this.extendGridLines}
|
|
233
246
|
@task-clicked=${this.handleTaskClicked}
|
|
234
247
|
@timescale-changed=${(e: CustomEvent) => this.syncTimeScale(e)}
|
package/src/ox-resource-chart.ts
CHANGED
|
@@ -76,12 +76,12 @@ export class OxResourceChart extends LitElement {
|
|
|
76
76
|
|
|
77
77
|
if (changedProperties.has('resources')) {
|
|
78
78
|
this.resourceChartController.setResources(this.resources)
|
|
79
|
-
this.updateChartHeight()
|
|
79
|
+
this.updateChartHeight()
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
if (changedProperties.has('tasks')) {
|
|
83
|
-
this.resourceChartController.setTasks(this.tasks)
|
|
84
|
-
this.updateChartHeight()
|
|
83
|
+
this.resourceChartController.setTasks(this.flattenTasks(this.tasks))
|
|
84
|
+
this.updateChartHeight()
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
if (changedProperties.has('axisScale')) {
|
|
@@ -89,7 +89,6 @@ export class OxResourceChart extends LitElement {
|
|
|
89
89
|
this.resourceChartController.updateTimeScale()
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
// 차트 렌더링
|
|
93
92
|
this.resourceChartController.drawAxes(this.svgHeader)
|
|
94
93
|
this.resourceChartController.drawBody(this.svgBody)
|
|
95
94
|
}
|
|
@@ -137,4 +136,10 @@ export class OxResourceChart extends LitElement {
|
|
|
137
136
|
setVerticalOffset(offset: number) {
|
|
138
137
|
this.container.scrollTop = offset
|
|
139
138
|
}
|
|
139
|
+
|
|
140
|
+
flattenTasks(tasks: Task[], level: number = 0): Task[] {
|
|
141
|
+
return tasks.flatMap(task =>
|
|
142
|
+
task.collapsed ? [{ ...task, level }] : [{ ...task, level }, ...this.flattenTasks(task.children || [], level + 1)]
|
|
143
|
+
)
|
|
144
|
+
}
|
|
140
145
|
}
|
|
@@ -124,7 +124,6 @@ Regular.args = {
|
|
|
124
124
|
id: '1',
|
|
125
125
|
title: 'Design',
|
|
126
126
|
type: 'task',
|
|
127
|
-
// section: developmentSection,
|
|
128
127
|
startDate: '2023-01-01',
|
|
129
128
|
endDate: '2023-01-05',
|
|
130
129
|
progress: 60,
|
|
@@ -138,7 +137,6 @@ Regular.args = {
|
|
|
138
137
|
id: '2',
|
|
139
138
|
title: 'Development',
|
|
140
139
|
type: 'milestone',
|
|
141
|
-
// section: developmentSection,
|
|
142
140
|
startDate: '2023-01-06',
|
|
143
141
|
endDate: '2023-01-06',
|
|
144
142
|
progress: 30,
|
|
@@ -152,7 +150,6 @@ Regular.args = {
|
|
|
152
150
|
id: '3',
|
|
153
151
|
title: 'Coding',
|
|
154
152
|
type: 'phase',
|
|
155
|
-
// section: developmentSection,
|
|
156
153
|
startDate: '2023-01-07',
|
|
157
154
|
endDate: '2023-01-15',
|
|
158
155
|
progress: 10,
|
|
@@ -164,7 +161,6 @@ Regular.args = {
|
|
|
164
161
|
id: '3-1',
|
|
165
162
|
title: 'Coding-A',
|
|
166
163
|
type: 'task',
|
|
167
|
-
// section: developmentSection,
|
|
168
164
|
startDate: '2023-01-07',
|
|
169
165
|
endDate: '2023-01-10',
|
|
170
166
|
progress: 60,
|
|
@@ -176,7 +172,6 @@ Regular.args = {
|
|
|
176
172
|
id: '3-1-1',
|
|
177
173
|
title: 'Coding-A',
|
|
178
174
|
type: 'task',
|
|
179
|
-
// section: developmentSection,
|
|
180
175
|
startDate: '2023-01-07',
|
|
181
176
|
endDate: '2023-01-10',
|
|
182
177
|
progress: 60,
|
|
@@ -190,7 +185,6 @@ Regular.args = {
|
|
|
190
185
|
id: '3-1-2',
|
|
191
186
|
title: 'Coding-B',
|
|
192
187
|
type: 'task',
|
|
193
|
-
// section: developmentSection,
|
|
194
188
|
startDate: '2023-01-11',
|
|
195
189
|
endDate: '2023-01-15',
|
|
196
190
|
dependsOn: '3-1-1',
|
|
@@ -205,7 +199,6 @@ Regular.args = {
|
|
|
205
199
|
id: '3-2',
|
|
206
200
|
title: 'Coding-B',
|
|
207
201
|
type: 'task',
|
|
208
|
-
// section: developmentSection,
|
|
209
202
|
startDate: '2023-01-11',
|
|
210
203
|
endDate: '2023-01-15',
|
|
211
204
|
dependsOn: '3-1',
|
|
@@ -220,7 +213,6 @@ Regular.args = {
|
|
|
220
213
|
id: '4',
|
|
221
214
|
title: 'Test',
|
|
222
215
|
type: 'milestone',
|
|
223
|
-
// section: developmentSection,
|
|
224
216
|
startDate: '2023-01-07',
|
|
225
217
|
endDate: '2023-01-10',
|
|
226
218
|
progress: 100,
|
|
@@ -234,7 +226,6 @@ Regular.args = {
|
|
|
234
226
|
id: '5',
|
|
235
227
|
title: 'Deploy',
|
|
236
228
|
type: 'milestone',
|
|
237
|
-
// section: developmentSection,
|
|
238
229
|
startDate: '2023-01-15',
|
|
239
230
|
endDate: '2023-01-21',
|
|
240
231
|
dependsOn: '4',
|
|
@@ -247,7 +238,6 @@ Regular.args = {
|
|
|
247
238
|
id: '6',
|
|
248
239
|
title: 'Publishing',
|
|
249
240
|
type: 'milestone',
|
|
250
|
-
// section: developmentSection,
|
|
251
241
|
startDate: '2023-01-11',
|
|
252
242
|
endDate: '2023-01-15',
|
|
253
243
|
dependsOn: '5',
|
|
@@ -260,7 +250,6 @@ Regular.args = {
|
|
|
260
250
|
id: '7',
|
|
261
251
|
title: 'Provisioning',
|
|
262
252
|
type: 'milestone',
|
|
263
|
-
// section: developmentSection,
|
|
264
253
|
startDate: '2023-01-12',
|
|
265
254
|
endDate: '2023-01-15',
|
|
266
255
|
dependsOn: '6',
|
|
@@ -273,7 +262,6 @@ Regular.args = {
|
|
|
273
262
|
id: '8',
|
|
274
263
|
title: 'Alpha Test',
|
|
275
264
|
type: 'milestone',
|
|
276
|
-
// section: testSection,
|
|
277
265
|
startDate: '2023-01-15',
|
|
278
266
|
endDate: '2023-01-17',
|
|
279
267
|
dependsOn: '7',
|
|
@@ -286,7 +274,6 @@ Regular.args = {
|
|
|
286
274
|
id: '9',
|
|
287
275
|
title: 'Beta Task',
|
|
288
276
|
type: 'milestone',
|
|
289
|
-
// section: testSection,
|
|
290
277
|
startDate: '2023-01-15',
|
|
291
278
|
endDate: '2023-01-18',
|
|
292
279
|
dependsOn: '8',
|
|
@@ -312,7 +299,6 @@ Regular.args = {
|
|
|
312
299
|
id: '11',
|
|
313
300
|
title: 'Zeta Test',
|
|
314
301
|
type: 'milestone',
|
|
315
|
-
// section: testSection,
|
|
316
302
|
startDate: '2023-01-18',
|
|
317
303
|
endDate: '2023-01-22',
|
|
318
304
|
dependsOn: '9',
|
|
@@ -325,7 +311,6 @@ Regular.args = {
|
|
|
325
311
|
id: '12',
|
|
326
312
|
title: 'Release',
|
|
327
313
|
type: 'milestone',
|
|
328
|
-
// section: releaseSection,
|
|
329
314
|
startDate: '2023-01-18',
|
|
330
315
|
endDate: '2023-01-23',
|
|
331
316
|
dependsOn: '9',
|
|
@@ -337,7 +322,6 @@ Regular.args = {
|
|
|
337
322
|
id: '12-1',
|
|
338
323
|
title: 'Coding-A',
|
|
339
324
|
type: 'task',
|
|
340
|
-
// section: developmentSection,
|
|
341
325
|
startDate: '2023-01-07',
|
|
342
326
|
endDate: '2023-01-10',
|
|
343
327
|
progress: 60,
|
|
@@ -351,7 +335,6 @@ Regular.args = {
|
|
|
351
335
|
id: '12-2',
|
|
352
336
|
title: 'Coding-B',
|
|
353
337
|
type: 'task',
|
|
354
|
-
// section: developmentSection,
|
|
355
338
|
startDate: '2023-01-11',
|
|
356
339
|
endDate: '2023-01-15',
|
|
357
340
|
dependsOn: '12-1',
|
|
@@ -366,7 +349,6 @@ Regular.args = {
|
|
|
366
349
|
id: '13',
|
|
367
350
|
title: 'Release',
|
|
368
351
|
type: 'milestone',
|
|
369
|
-
// section: releaseSection,
|
|
370
352
|
startDate: '2023-01-22',
|
|
371
353
|
endDate: '2023-01-27',
|
|
372
354
|
dependsOn: '12',
|
|
@@ -378,7 +360,6 @@ Regular.args = {
|
|
|
378
360
|
id: '14',
|
|
379
361
|
title: 'Release',
|
|
380
362
|
type: 'milestone',
|
|
381
|
-
// section: releaseSection,
|
|
382
363
|
startDate: '2023-01-27',
|
|
383
364
|
endDate: '2023-01-30',
|
|
384
365
|
dependsOn: '13',
|
|
@@ -391,7 +372,6 @@ Regular.args = {
|
|
|
391
372
|
id: '15',
|
|
392
373
|
title: 'Release',
|
|
393
374
|
type: 'milestone',
|
|
394
|
-
// section: releaseSection,
|
|
395
375
|
startDate: '2023-01-30',
|
|
396
376
|
endDate: '2023-01-31',
|
|
397
377
|
dependsOn: '14',
|
|
@@ -403,7 +383,6 @@ Regular.args = {
|
|
|
403
383
|
id: '16',
|
|
404
384
|
title: 'Release',
|
|
405
385
|
type: 'milestone',
|
|
406
|
-
// section: releaseSection,
|
|
407
386
|
startDate: '2023-01-31',
|
|
408
387
|
endDate: '2023-02-05',
|
|
409
388
|
dependsOn: '15',
|
|
@@ -416,7 +395,6 @@ Regular.args = {
|
|
|
416
395
|
id: '17',
|
|
417
396
|
title: 'Release',
|
|
418
397
|
type: 'milestone',
|
|
419
|
-
// section: releaseSection,
|
|
420
398
|
startDate: '2023-02-06',
|
|
421
399
|
endDate: '2023-02-07',
|
|
422
400
|
dependsOn: '16',
|
|
@@ -428,7 +406,6 @@ Regular.args = {
|
|
|
428
406
|
id: '18',
|
|
429
407
|
title: 'Release',
|
|
430
408
|
type: 'milestone',
|
|
431
|
-
// section: releaseSection,
|
|
432
409
|
startDate: '2023-02-08',
|
|
433
410
|
endDate: '2023-02-09',
|
|
434
411
|
dependsOn: '17',
|
|
@@ -440,7 +417,6 @@ Regular.args = {
|
|
|
440
417
|
id: '19',
|
|
441
418
|
title: 'Release',
|
|
442
419
|
type: 'milestone',
|
|
443
|
-
// section: releaseSection,
|
|
444
420
|
startDate: '2023-02-10',
|
|
445
421
|
endDate: '2023-02-25',
|
|
446
422
|
dependsOn: '18',
|