@operato/gantt 7.0.20 → 7.0.22

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.
Files changed (37) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/src/draw-time-scale-header.d.ts +5 -0
  3. package/dist/src/draw-time-scale-header.js +154 -0
  4. package/dist/src/draw-time-scale-header.js.map +1 -0
  5. package/dist/src/gantt-chart-controller.d.ts +1 -1
  6. package/dist/src/gantt-chart-controller.js +6 -161
  7. package/dist/src/gantt-chart-controller.js.map +1 -1
  8. package/dist/src/ox-gantt-chart.d.ts +6 -1
  9. package/dist/src/ox-gantt-chart.js +39 -8
  10. package/dist/src/ox-gantt-chart.js.map +1 -1
  11. package/dist/src/ox-gantt-resize-splitter.js +8 -7
  12. package/dist/src/ox-gantt-resize-splitter.js.map +1 -1
  13. package/dist/src/ox-gantt.d.ts +24 -15
  14. package/dist/src/ox-gantt.js +224 -82
  15. package/dist/src/ox-gantt.js.map +1 -1
  16. package/dist/src/ox-resource-chart.d.ts +42 -0
  17. package/dist/src/ox-resource-chart.js +317 -0
  18. package/dist/src/ox-resource-chart.js.map +1 -0
  19. package/dist/src/types.d.ts +5 -0
  20. package/dist/src/types.js.map +1 -1
  21. package/dist/stories/ox-gantt.stories.js +75 -4
  22. package/dist/stories/ox-gantt.stories.js.map +1 -1
  23. package/dist/tsconfig.tsbuildinfo +1 -1
  24. package/package.json +2 -2
  25. package/src/draw-time-scale-header.ts +192 -0
  26. package/src/gantt-chart-controller.ts +6 -189
  27. package/src/ox-gantt-chart.ts +46 -9
  28. package/src/ox-gantt-resize-splitter.ts +8 -7
  29. package/src/ox-gantt.ts +231 -86
  30. package/src/ox-resource-chart.ts +328 -0
  31. package/src/types.ts +6 -0
  32. package/stories/ox-gantt.stories.ts +75 -4
  33. package/translations/en.json +4 -1
  34. package/translations/ja.json +3 -1
  35. package/translations/ko.json +4 -1
  36. package/translations/ms.json +3 -1
  37. package/translations/zh.json +3 -1
@@ -1,15 +1,18 @@
1
1
  import { __decorate } from "tslib";
2
- import { LitElement, html, css } from 'lit';
2
+ import { LitElement, html, css, nothing } from 'lit';
3
+ import * as d3 from 'd3';
3
4
  import i18next from 'i18next';
4
5
  import { customElement, property, query, state } from 'lit/decorators.js';
5
6
  import { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles';
6
7
  import { ScrollbarStyles } from '@operato/styles';
7
8
  import './ox-gantt-chart.js';
9
+ import './ox-resource-chart.js';
8
10
  import './ox-gantt-resize-splitter.js';
9
11
  let OxGantt = class OxGantt extends LitElement {
10
12
  constructor() {
11
13
  super(...arguments);
12
14
  this.tasks = [];
15
+ this.resources = [];
13
16
  this.fromDate = new Date(new Date().getFullYear(), 0, 1).toISOString().split('T')[0]; /* beginning of this year */
14
17
  this.toDate = new Date(new Date().getFullYear(), 11, 31).toISOString().split('T')[0]; /* end of this year */
15
18
  this.extendGridLines = false;
@@ -53,9 +56,17 @@ let OxGantt = class OxGantt extends LitElement {
53
56
  visible: true,
54
57
  width: 100,
55
58
  order: 9
59
+ },
60
+ {
61
+ name: 'resources',
62
+ label: i18next.t('label.gantt-task-resources') || 'resources',
63
+ visible: true,
64
+ width: 100,
65
+ order: 10
56
66
  }
57
67
  ];
58
68
  this._startWidth = 0;
69
+ this._startHeight = 0;
59
70
  this._isDragging = false;
60
71
  }
61
72
  static { this.styles = [
@@ -70,13 +81,24 @@ let OxGantt = class OxGantt extends LitElement {
70
81
  }
71
82
 
72
83
  .container {
84
+ flex: 1;
85
+
73
86
  display: flex;
87
+ flex-direction: column;
74
88
  width: 100%;
75
89
  height: 100%;
76
90
  box-sizing: border-box;
77
91
  }
78
92
 
79
- .task-container {
93
+ .resource-container {
94
+ height: 300px;
95
+
96
+ display: flex;
97
+ overflow: hidden;
98
+ box-sizing: border-box;
99
+ }
100
+
101
+ .resource-table-container {
80
102
  padding: 0;
81
103
  overflow: auto;
82
104
  overflow-y: overlay;
@@ -84,16 +106,34 @@ let OxGantt = class OxGantt extends LitElement {
84
106
  border: 1px solid var(--ox-gantt-border-color, var(--md-sys-color-on-surface));
85
107
  }
86
108
 
87
- .chart-container {
109
+ .resource-chart-container {
88
110
  flex: 1;
89
111
  padding: 0;
90
112
  box-sizing: border-box;
91
113
  border: 1px solid var(--ox-gantt-border-color, var(--md-sys-color-on-surface));
92
114
  }
93
115
 
94
- ox-gantt-resize-splitter {
95
- width: 4px;
96
- cursor: ew-resize;
116
+ .task-container {
117
+ flex: 1;
118
+
119
+ display: flex;
120
+ overflow: hidden;
121
+ box-sizing: border-box;
122
+ }
123
+
124
+ .task-table-container {
125
+ padding: 0;
126
+ overflow: auto;
127
+ overflow-y: overlay;
128
+ box-sizing: border-box;
129
+ border: 1px solid var(--ox-gantt-border-color, var(--md-sys-color-on-surface));
130
+ }
131
+
132
+ .task-chart-container {
133
+ flex: 1;
134
+ padding: 0;
135
+ box-sizing: border-box;
136
+ border: 1px solid var(--ox-gantt-border-color, var(--md-sys-color-on-surface));
97
137
  }
98
138
 
99
139
  table {
@@ -124,6 +164,7 @@ let OxGantt = class OxGantt extends LitElement {
124
164
  th {
125
165
  height: 40px;
126
166
  box-sizing: border-box;
167
+ text-align: center;
127
168
  }
128
169
 
129
170
  td {
@@ -139,24 +180,63 @@ let OxGantt = class OxGantt extends LitElement {
139
180
  render() {
140
181
  return html `
141
182
  <div class="container md-typescale-body-medium">
142
- <div class="task-container" @scroll=${this.syncScroll}>${this.renderTaskTable()}</div>
183
+ <div class="task-container">
184
+ <div class="task-table-container" @scroll=${this.syncScroll}>${this.renderTaskTable()}</div>
185
+ <ox-gantt-resize-splitter
186
+ vertical
187
+ @splitter-dragstart=${(e) => this.resizeHorizontalStart(e)}
188
+ @splitter-drag=${(e) => this.resizeHorizontalDrag(e)}
189
+ @splitter-dragend=${(e) => this.resizeHorizontalEnd(e)}
190
+ ></ox-gantt-resize-splitter>
191
+ <ox-gantt-chart
192
+ class="task-chart-container"
193
+ @scroll=${this.syncScroll}
194
+ .fromDate=${this.fromDate}
195
+ .toDate=${this.toDate}
196
+ .tasks=${this.tasks}
197
+ .selectedTaskId=${this.selectedTaskId}
198
+ .axisScale=${this.timeScale}
199
+ ?extend-grid-lines=${this.extendGridLines}
200
+ @task-clicked=${this.handleTaskClicked}
201
+ @timescale-changed=${(e) => this.syncTimeScale(e)}
202
+ ></ox-gantt-chart>
203
+ </div>
143
204
  <ox-gantt-resize-splitter
144
- vertical
145
- @splitter-dragstart=${(e) => this.resizeStart(e)}
146
- @splitter-drag=${(e) => this.resizeDrag(e)}
147
- @splitter-dragend=${(e) => this.resizeEnd(e)}
205
+ horizontal
206
+ @splitter-dragstart=${(e) => this.resizeVerticalStart(e)}
207
+ @splitter-drag=${(e) => this.resizeVerticalDrag(e)}
208
+ @splitter-dragend=${(e) => this.resizeVerticalEnd(e)}
148
209
  ></ox-gantt-resize-splitter>
149
- <ox-gantt-chart
150
- class="chart-container"
151
- @scroll=${this.syncScroll}
152
- .fromDate=${this.fromDate}
153
- .toDate=${this.toDate}
154
- .tasks=${this.tasks}
155
- .selectedTaskId=${this.selectedTaskId}
156
- .axisScale=${this.timeScale}
157
- ?extend-grid-lines=${this.extendGridLines}
158
- @task-clicked=${this.handleTaskClicked}
159
- ></ox-gantt-chart>
210
+ <div class="resource-container">
211
+ <div class="resource-table-container" @scroll=${this.syncScroll}>
212
+ <table>
213
+ <thead>
214
+ <tr>
215
+ <th style="width: 100px">${i18next.t('label.gantt-resource-type')}</th>
216
+ <th>${i18next.t('label.gantt-resource-allocated')}</th>
217
+ </tr>
218
+ </thead>
219
+ <tbody>
220
+ ${this.resources.map(resource => this.renderResourceRow(resource))}
221
+ </tbody>
222
+ </table>
223
+ </div>
224
+ <ox-gantt-resize-splitter
225
+ vertical
226
+ @splitter-dragstart=${(e) => this.resizeHorizontalStart(e)}
227
+ @splitter-drag=${(e) => this.resizeHorizontalDrag(e)}
228
+ @splitter-dragend=${(e) => this.resizeHorizontalEnd(e)}
229
+ ></ox-gantt-resize-splitter>
230
+ <ox-resource-chart
231
+ class="resource-chart-container"
232
+ .fromDate=${this.fromDate}
233
+ .toDate=${this.toDate}
234
+ .tasks=${this.tasks}
235
+ .resources=${this.resources}
236
+ .axisScale=${this.timeScale}
237
+ @scroll=${this.syncScroll}
238
+ ></ox-resource-chart>
239
+ </div>
160
240
  </div>
161
241
  `;
162
242
  }
@@ -164,35 +244,46 @@ let OxGantt = class OxGantt extends LitElement {
164
244
  if (!this.columnConfig) {
165
245
  return;
166
246
  }
167
- const mergedTasks = this.mergeTasksBySection(this.tasks);
168
247
  // Sort columns by the configured order
169
248
  const sortedColumns = [...this.columnConfig].sort((a, b) => a.order - b.order);
170
249
  return html `
171
- <table>
250
+ <table class="task-table">
172
251
  <thead>
173
252
  <tr>
174
- ${sortedColumns.map(col => col.visible ? html `<th style="width: ${col.width}px">${col.label}</th>` : null)}
253
+ ${sortedColumns.map(col => col.visible ? html `<th style="width: ${col.width}px">${col.label}</th>` : nothing)}
175
254
  </tr>
176
255
  </thead>
177
256
  <tbody>
178
- ${mergedTasks.map(({ task, showSection, rowSpan }) => html `
179
- <tr class="${this.selectedTaskId === task.id ? 'selected' : ''}" @click=${() => this.selectTask(task.id)}>
180
- ${sortedColumns.map(col => {
181
- if (col.name === 'section') {
182
- return col.visible && showSection
183
- ? html `<td rowspan=${rowSpan} style="width: ${col.width}px">${task.section?.name || ''}</td>`
184
- : null;
185
- }
186
- return col.visible
187
- ? html `<td style="width: ${col.width}px">${this.getTaskFieldValue(task, col.name)}</td>`
188
- : null;
189
- })}
190
- </tr>
191
- `)}
257
+ ${this.renderTaskRows(this.tasks)}
192
258
  </tbody>
193
259
  </table>
194
260
  `;
195
261
  }
262
+ renderTaskRows(tasks, level = 0) {
263
+ return tasks.flatMap(task => [
264
+ this.renderTaskRow(task, level),
265
+ ...this.renderTaskRows(task.children || [], level + 1)
266
+ ]);
267
+ }
268
+ renderTaskRow(task, level) {
269
+ return html `
270
+ <tr class=${this.selectedTaskId === task.id ? 'selected' : ''} @click=${() => this.selectTask(task.id)}>
271
+ ${this.columnConfig.map(col => col.visible
272
+ ? html `<td class="task-row" style="padding-left: ${col.name == 'title' ? level * 8 + 4 : 4}px">
273
+ ${this.getTaskFieldValue(task, col.name)}
274
+ </td>`
275
+ : null)}
276
+ </tr>
277
+ `;
278
+ }
279
+ renderResourceRow(resource) {
280
+ return html `
281
+ <tr>
282
+ <td>${resource.type}</td>
283
+ <td>${resource.allocated}</td>
284
+ </tr>
285
+ `;
286
+ }
196
287
  getTaskFieldValue(task, field) {
197
288
  switch (field) {
198
289
  case 'id':
@@ -213,30 +304,12 @@ let OxGantt = class OxGantt extends LitElement {
213
304
  return task.progress || '';
214
305
  case 'dependsOn':
215
306
  return task.dependsOn || '';
307
+ case 'resources':
308
+ return task.resources?.map(res => `${res.type}: ${res.allocated}`).join(', ') || '';
216
309
  default:
217
310
  return '';
218
311
  }
219
312
  }
220
- mergeTasksBySection(tasks) {
221
- const mergedTasks = [];
222
- let currentSection = '';
223
- let rowSpan = 0;
224
- (tasks || []).forEach((task, index) => {
225
- if (task.section?.name !== currentSection) {
226
- currentSection = task.section?.name || '';
227
- rowSpan = 1;
228
- mergedTasks.push({ task, showSection: true, rowSpan: 1 });
229
- }
230
- else {
231
- mergedTasks[mergedTasks.length - rowSpan].rowSpan = ++rowSpan;
232
- mergedTasks.push({ task, showSection: false, rowSpan: 0 });
233
- }
234
- if (index === tasks.length - 1 && rowSpan > 0) {
235
- mergedTasks[mergedTasks.length - rowSpan].rowSpan = rowSpan;
236
- }
237
- });
238
- return mergedTasks;
239
- }
240
313
  selectTask(taskId) {
241
314
  this.selectedTaskId = taskId;
242
315
  }
@@ -244,48 +317,111 @@ let OxGantt = class OxGantt extends LitElement {
244
317
  this.selectedTaskId = event.detail.taskId;
245
318
  }
246
319
  firstUpdated(_changedProperties) {
247
- this.taskContainer.style.width = '254px';
320
+ this.taskTableContainer.style.width = '254px';
321
+ this.resourceTableContainer.style.width = '254px';
322
+ }
323
+ updated(changedProperties) {
324
+ if (changedProperties.has('tasks')) {
325
+ this.resources = this.aggregateResources(this.tasks);
326
+ }
327
+ }
328
+ aggregateResources(tasks) {
329
+ const resourceMap = {};
330
+ const traverseTasks = (tasks) => {
331
+ tasks.forEach(task => {
332
+ if (task.resources) {
333
+ const startDate = new Date(task.startDate);
334
+ const endDate = new Date(task.endDate);
335
+ const durationDays = d3.timeDay.count(startDate, d3.timeDay.offset(endDate, 1));
336
+ task.resources.forEach(resource => {
337
+ const totalAllocation = resource.allocated * durationDays;
338
+ if (!resourceMap[resource.type]) {
339
+ resourceMap[resource.type] = 0;
340
+ }
341
+ resourceMap[resource.type] += totalAllocation;
342
+ console.log(resource.type, resource.allocated, durationDays, totalAllocation);
343
+ });
344
+ }
345
+ if (task.children) {
346
+ traverseTasks(task.children);
347
+ }
348
+ });
349
+ };
350
+ traverseTasks(tasks);
351
+ return Object.keys(resourceMap).map(type => ({
352
+ type,
353
+ allocated: resourceMap[type]
354
+ }));
248
355
  }
249
- updated(changes) { }
250
356
  syncScroll(e) {
251
357
  const target = e.target;
252
- if (target === this.taskContainer) {
253
- // Sync chart scroll with table scroll
254
- const newScrollTop = this.taskContainer.scrollTop;
358
+ if (target === this.taskTableContainer) {
359
+ const newScrollTop = this.taskTableContainer.scrollTop;
255
360
  this.ganttChart.setVerticalOffset(newScrollTop);
256
- // Ensure chart scroll matches table scroll
257
361
  if (this.ganttChart.getVerticalOffset() !== newScrollTop) {
258
362
  this.ganttChart.setVerticalOffset(newScrollTop);
259
363
  }
260
364
  }
261
365
  else if (target === this.ganttChart) {
262
- // Sync table scroll with chart scroll
263
366
  const newScrollTop = this.ganttChart.getVerticalOffset();
264
- this.taskContainer.scrollTop = newScrollTop;
265
- // Ensure table scroll matches chart scroll
266
- this.ganttChart.setVerticalOffset(this.taskContainer.scrollTop);
367
+ this.taskTableContainer.scrollTop = newScrollTop;
368
+ this.ganttChart.setVerticalOffset(this.taskTableContainer.scrollTop);
369
+ const newScrollLeft = this.ganttChart.getHorizontalOffset();
370
+ this.resourceChart.setHorizontalOffset(newScrollLeft);
371
+ }
372
+ else if (target === this.resourceChart) {
373
+ const newScrollTop = this.ganttChart.getVerticalOffset();
374
+ this.resourceTableContainer.scrollTop = newScrollTop;
375
+ this.resourceChart.setVerticalOffset(this.taskTableContainer.scrollTop);
376
+ const newScrollLeft = this.resourceChart.getHorizontalOffset();
377
+ this.ganttChart.setHorizontalOffset(newScrollLeft);
378
+ }
379
+ else if (target === this.resourceTableContainer) {
380
+ const newScrollTop = this.taskTableContainer.scrollTop;
381
+ this.resourceChart.setVerticalOffset(newScrollTop);
382
+ if (this.resourceChart.getVerticalOffset() !== newScrollTop) {
383
+ this.resourceChart.setVerticalOffset(newScrollTop);
384
+ }
267
385
  }
268
386
  }
269
- resizeStart(e) {
387
+ syncTimeScale(e) {
388
+ const detail = e.detail;
389
+ this.resourceChart.syncTimeScale(detail);
390
+ }
391
+ resizeHorizontalStart(e) {
270
392
  this._startWidth = e.target?.previousElementSibling?.offsetWidth;
271
393
  this._isDragging = true;
272
394
  }
273
- resizeDrag(e) {
395
+ resizeHorizontalDrag(e) {
274
396
  if (!this._isDragging)
275
397
  return;
276
398
  const delta = e.detail;
277
- const taskContainer = this.taskContainer;
278
- if (taskContainer) {
279
- taskContainer.style.width = `${this._startWidth + delta.x}px`;
280
- }
399
+ this.taskTableContainer.style.width = `${this._startWidth + delta.x}px`;
400
+ this.resourceTableContainer.style.width = `${this._startWidth + delta.x}px`;
401
+ }
402
+ resizeHorizontalEnd(e) {
403
+ this._isDragging = false;
404
+ }
405
+ resizeVerticalStart(e) {
406
+ this._startHeight = e.target?.nextElementSibling?.offsetHeight;
407
+ this._isDragging = true;
408
+ }
409
+ resizeVerticalDrag(e) {
410
+ if (!this._isDragging)
411
+ return;
412
+ const delta = e.detail;
413
+ this.resourceContainer.style.height = `${this._startHeight - delta.y}px`;
281
414
  }
282
- resizeEnd(e) {
415
+ resizeVerticalEnd(e) {
283
416
  this._isDragging = false;
284
417
  }
285
418
  };
286
419
  __decorate([
287
420
  property({ type: Array })
288
421
  ], OxGantt.prototype, "tasks", void 0);
422
+ __decorate([
423
+ property({ type: Array })
424
+ ], OxGantt.prototype, "resources", void 0);
289
425
  __decorate([
290
426
  property({ type: String, attribute: 'from-date' })
291
427
  ], OxGantt.prototype, "fromDate", void 0);
@@ -304,21 +440,27 @@ __decorate([
304
440
  __decorate([
305
441
  state()
306
442
  ], OxGantt.prototype, "selectedTaskId", void 0);
307
- __decorate([
308
- query('.container')
309
- ], OxGantt.prototype, "container", void 0);
310
443
  __decorate([
311
444
  query('.task-container')
312
445
  ], OxGantt.prototype, "taskContainer", void 0);
313
446
  __decorate([
314
- query('.chart-container')
315
- ], OxGantt.prototype, "chartContainer", void 0);
447
+ query('.task-table-container')
448
+ ], OxGantt.prototype, "taskTableContainer", void 0);
449
+ __decorate([
450
+ query('.resource-container')
451
+ ], OxGantt.prototype, "resourceContainer", void 0);
316
452
  __decorate([
317
- query('table')
453
+ query('.resource-table-container')
454
+ ], OxGantt.prototype, "resourceTableContainer", void 0);
455
+ __decorate([
456
+ query('.task-table')
318
457
  ], OxGantt.prototype, "taskTable", void 0);
319
458
  __decorate([
320
459
  query('ox-gantt-chart')
321
460
  ], OxGantt.prototype, "ganttChart", void 0);
461
+ __decorate([
462
+ query('ox-resource-chart')
463
+ ], OxGantt.prototype, "resourceChart", void 0);
322
464
  OxGantt = __decorate([
323
465
  customElement('ox-gantt')
324
466
  ], OxGantt);
@@ -1 +1 @@
1
- {"version":3,"file":"ox-gantt.js","sourceRoot":"","sources":["../../src/ox-gantt.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAoC,MAAM,KAAK,CAAA;AAC7E,OAAO,OAAO,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,MAAM,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B,KAAK,CAAC,YAAY,CAAC;0CAA2B;AACrB;IAAzB,KAAK,CAAC,iBAAiB,CAAC;8CAA+B;AAC7B;IAA1B,KAAK,CAAC,kBAAkB,CAAC;+CAAgC;AAC1C;IAAf,KAAK,CAAC,OAAO,CAAC;0CAA6B;AACnB;IAAxB,KAAK,CAAC,gBAAgB,CAAC;2CAA0B;AAvIvC,OAAO;IADnB,aAAa,CAAC,UAAU,CAAC;GACb,OAAO,CAmTnB","sourcesContent":["import { LitElement, html, css, PropertyValues, PropertyValueMap } from 'lit'\nimport i18next from 'i18next'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles'\nimport { ScrollbarStyles } from '@operato/styles'\n\nimport './ox-gantt-chart.js'\nimport './ox-gantt-resize-splitter.js'\nimport { OxGanttChart } from './ox-gantt-chart.js'\nimport { ColumnConfig, Task, TimeScale } from './types.js'\n\n@customElement('ox-gantt')\nexport class OxGantt extends LitElement {\n static styles = [\n MDTypeScaleStyles,\n ScrollbarStyles,\n css`\n :host {\n display: block;\n font-family: Arial, sans-serif;\n text-wrap: nowrap;\n position: relative;\n }\n\n .container {\n display: flex;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n }\n\n .task-container {\n padding: 0;\n overflow: auto;\n overflow-y: overlay;\n box-sizing: border-box;\n border: 1px solid var(--ox-gantt-border-color, var(--md-sys-color-on-surface));\n }\n\n .chart-container {\n flex: 1;\n padding: 0;\n box-sizing: border-box;\n border: 1px solid var(--ox-gantt-border-color, var(--md-sys-color-on-surface));\n }\n\n ox-gantt-resize-splitter {\n width: 4px;\n cursor: ew-resize;\n }\n\n table {\n width: 100%;\n border-collapse: collapse;\n border: 1px solid var(--ox-gantt-border-color, var(--md-sys-color-on-surface));\n margin: -1px;\n margin-right: 0;\n }\n\n thead th {\n position: sticky;\n top: -1px;\n z-index: 1;\n background-color: var(--ox-gantt-header-background-color, var(--md-sys-color-secondary-container));\n border-color: var(--ox-gantt-header-border-color, var(--md-sys-color-on-secondary-container));\n color: var(--ox-gantt-header-color, var(--md-sys-color-on-secondary-container));\n text-transform: capitalize;\n }\n\n th,\n td {\n border: 1px solid var(--ox-gantt-border-color, var(--md-sys-color-on-surface));\n padding: 4px;\n text-align: left;\n }\n\n th {\n height: 40px;\n box-sizing: border-box;\n }\n\n td {\n height: 30px;\n box-sizing: border-box;\n }\n\n tr.selected {\n background-color: var(--ox-gantt-selected-background-color, var(--md-sys-color-surface-variant));\n }\n `\n ]\n\n @property({ type: Array }) tasks: Task[] = []\n @property({ type: String, attribute: 'from-date' })\n fromDate: string = new Date(new Date().getFullYear(), 0, 1).toISOString().split('T')[0] /* beginning of this year */\n @property({ type: String, attribute: 'to-date' })\n toDate: string = new Date(new Date().getFullYear(), 11, 31).toISOString().split('T')[0] /* end of this year */\n @property({ type: Boolean, attribute: 'extend-grid-lines' }) extendGridLines: boolean = false\n @property({ type: String, attribute: 'time-scale' }) timeScale: TimeScale = 'week-day'\n @property({ type: Array }) columnConfig: ColumnConfig[] = [\n { name: 'id', label: i18next.t('label.gantt-task-id') || 'ID', visible: true, width: 50, order: 1 },\n {\n name: 'section',\n label: i18next.t('label.gantt-task-section') || 'section',\n visible: true,\n width: 100,\n order: 2\n },\n { name: 'title', label: i18next.t('label.gantt-task-title') || 'title', visible: true, width: 150, order: 3 },\n { name: 'type', label: i18next.t('label.gantt-task-type') || 'type', visible: true, width: 100, order: 4 },\n {\n name: 'startDate',\n label: i18next.t('label.gantt-task-start-date') || 'start date',\n visible: true,\n width: 100,\n order: 5\n },\n {\n name: 'endDate',\n label: i18next.t('label.gantt-task-end-date') || 'end date',\n visible: true,\n width: 100,\n order: 6\n },\n { name: 'tags', label: i18next.t('label.gantt-task-tags') || 'tags', visible: true, width: 100, order: 7 },\n {\n name: 'progress',\n label: i18next.t('label.gantt-task-progress') || 'progress',\n visible: true,\n width: 100,\n order: 8\n },\n {\n name: 'dependsOn',\n label: i18next.t('label.gantt-task-previous') || 'previous',\n visible: true,\n width: 100,\n order: 9\n }\n ]\n\n @state() selectedTaskId?: string\n\n @query('.container') container!: HTMLDivElement\n @query('.task-container') taskContainer!: HTMLDivElement\n @query('.chart-container') chartContainer!: HTMLDivElement\n @query('table') taskTable!: HTMLTableElement\n @query('ox-gantt-chart') ganttChart!: OxGanttChart\n\n private _startWidth: number = 0\n private _isDragging: boolean = false\n\n render() {\n return html`\n <div class=\"container md-typescale-body-medium\">\n <div class=\"task-container\" @scroll=${this.syncScroll}>${this.renderTaskTable()}</div>\n <ox-gantt-resize-splitter\n vertical\n @splitter-dragstart=${(e: CustomEvent) => this.resizeStart(e)}\n @splitter-drag=${(e: CustomEvent) => this.resizeDrag(e)}\n @splitter-dragend=${(e: CustomEvent) => this.resizeEnd(e)}\n ></ox-gantt-resize-splitter>\n <ox-gantt-chart\n class=\"chart-container\"\n @scroll=${this.syncScroll}\n .fromDate=${this.fromDate}\n .toDate=${this.toDate}\n .tasks=${this.tasks}\n .selectedTaskId=${this.selectedTaskId}\n .axisScale=${this.timeScale}\n ?extend-grid-lines=${this.extendGridLines}\n @task-clicked=${this.handleTaskClicked}\n ></ox-gantt-chart>\n </div>\n `\n }\n\n renderTaskTable() {\n if (!this.columnConfig) {\n return\n }\n\n const mergedTasks = this.mergeTasksBySection(this.tasks)\n\n // Sort columns by the configured order\n const sortedColumns = [...this.columnConfig].sort((a, b) => a.order - b.order)\n\n return html`\n <table>\n <thead>\n <tr>\n ${sortedColumns.map(col =>\n col.visible ? html`<th style=\"width: ${col.width}px\">${col.label}</th>` : null\n )}\n </tr>\n </thead>\n <tbody>\n ${mergedTasks.map(\n ({ task, showSection, rowSpan }) => html`\n <tr class=\"${this.selectedTaskId === task.id ? 'selected' : ''}\" @click=${() => this.selectTask(task.id)}>\n ${sortedColumns.map(col => {\n if (col.name === 'section') {\n return col.visible && showSection\n ? html`<td rowspan=${rowSpan} style=\"width: ${col.width}px\">${task.section?.name || ''}</td>`\n : null\n }\n return col.visible\n ? html`<td style=\"width: ${col.width}px\">${this.getTaskFieldValue(task, col.name)}</td>`\n : null\n })}\n </tr>\n `\n )}\n </tbody>\n </table>\n `\n }\n\n getTaskFieldValue(task: Task, field: string) {\n switch (field) {\n case 'id':\n return task.id\n case 'section':\n return task.section?.name || ''\n case 'title':\n return task.title\n case 'type':\n return task.type\n case 'startDate':\n return new Date(task.startDate).toISOString().split('T')[0]\n case 'endDate':\n return new Date(task.endDate).toISOString().split('T')[0]\n case 'tags':\n return task.tags?.join(', ') || ''\n case 'progress':\n return task.progress || ''\n case 'dependsOn':\n return task.dependsOn || ''\n default:\n return ''\n }\n }\n\n mergeTasksBySection(tasks: Task[]): Array<{ task: Task; showSection: boolean; rowSpan: number }> {\n const mergedTasks = [] as Array<{ task: Task; showSection: boolean; rowSpan: number }>\n let currentSection = ''\n let rowSpan = 0\n\n ;(tasks || []).forEach((task, index) => {\n if (task.section?.name !== currentSection) {\n currentSection = task.section?.name || ''\n rowSpan = 1\n mergedTasks.push({ task, showSection: true, rowSpan: 1 })\n } else {\n mergedTasks[mergedTasks.length - rowSpan].rowSpan = ++rowSpan\n mergedTasks.push({ task, showSection: false, rowSpan: 0 })\n }\n\n if (index === tasks.length - 1 && rowSpan > 0) {\n mergedTasks[mergedTasks.length - rowSpan].rowSpan = rowSpan\n }\n })\n\n return mergedTasks\n }\n\n selectTask(taskId: string) {\n this.selectedTaskId = taskId\n }\n\n handleTaskClicked(event: CustomEvent) {\n this.selectedTaskId = event.detail.taskId\n }\n\n protected firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void {\n this.taskContainer.style.width = '254px'\n }\n\n updated(changes: PropertyValues<this>) {}\n\n syncScroll(e: Event) {\n const target = e.target as HTMLElement\n if (target === this.taskContainer) {\n // Sync chart scroll with table scroll\n const newScrollTop = this.taskContainer.scrollTop\n this.ganttChart.setVerticalOffset(newScrollTop)\n\n // Ensure chart scroll matches table scroll\n if (this.ganttChart.getVerticalOffset() !== newScrollTop) {\n this.ganttChart.setVerticalOffset(newScrollTop)\n }\n } else if (target === this.ganttChart) {\n // Sync table scroll with chart scroll\n const newScrollTop = this.ganttChart.getVerticalOffset()\n this.taskContainer.scrollTop = newScrollTop\n\n // Ensure table scroll matches chart scroll\n this.ganttChart.setVerticalOffset(this.taskContainer.scrollTop)\n }\n }\n\n resizeStart(e: CustomEvent) {\n this._startWidth = ((e.target as HTMLElement)?.previousElementSibling as HTMLElement)?.offsetWidth\n this._isDragging = true\n }\n\n resizeDrag(e: CustomEvent) {\n if (!this._isDragging) return\n const delta = e.detail\n const taskContainer = this.taskContainer\n\n if (taskContainer) {\n taskContainer.style.width = `${this._startWidth + delta.x}px`\n }\n }\n\n resizeEnd(e: CustomEvent) {\n this._isDragging = false\n }\n}\n"]}
1
+ {"version":3,"file":"ox-gantt.js","sourceRoot":"","sources":["../../src/ox-gantt.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAoC,OAAO,EAAkB,MAAM,KAAK,CAAA;AACtG,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,OAAO,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,MAAM,IAAI,iBAAiB,EAAE,MAAM,8CAA8C,CAAA;AAC1F,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,qBAAqB,CAAA;AAC5B,OAAO,wBAAwB,CAAA;AAC/B,OAAO,+BAA+B,CAAA;AAM/B,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,UAAU;IAAhC;;QA8GsB,UAAK,GAAW,EAAE,CAAA;QAClB,cAAS,GAAe,EAAE,CAAA;QAErD,aAAQ,GAAW,IAAI,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,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KAAK,CAAC,mBAAmB,CAAC;8CAAgC;AA/KhD,OAAO;IADnB,aAAa,CAAC,UAAU,CAAC;GACb,OAAO,CAicnB","sourcesContent":["import { LitElement, html, css, PropertyValues, PropertyValueMap, nothing, TemplateResult } from 'lit'\nimport * as d3 from 'd3'\nimport i18next from 'i18next'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles'\nimport { ScrollbarStyles } from '@operato/styles'\n\nimport './ox-gantt-chart.js'\nimport './ox-resource-chart.js'\nimport './ox-gantt-resize-splitter.js'\nimport { OxGanttChart } from './ox-gantt-chart.js'\nimport { OxResourceChart } from './ox-resource-chart.js'\nimport { ColumnConfig, Task, TimeScale, Resource } from './types.js'\n\n@customElement('ox-gantt')\nexport class OxGantt extends LitElement {\n static styles = [\n MDTypeScaleStyles,\n ScrollbarStyles,\n css`\n :host {\n display: block;\n font-family: Arial, sans-serif;\n text-wrap: nowrap;\n position: relative;\n }\n\n .container {\n flex: 1;\n\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n }\n\n .resource-container {\n height: 300px;\n\n display: flex;\n overflow: hidden;\n box-sizing: border-box;\n }\n\n .resource-table-container {\n padding: 0;\n overflow: auto;\n overflow-y: overlay;\n box-sizing: border-box;\n border: 1px solid var(--ox-gantt-border-color, var(--md-sys-color-on-surface));\n }\n\n .resource-chart-container {\n flex: 1;\n padding: 0;\n box-sizing: border-box;\n border: 1px solid var(--ox-gantt-border-color, var(--md-sys-color-on-surface));\n }\n\n .task-container {\n flex: 1;\n\n display: flex;\n overflow: hidden;\n box-sizing: border-box;\n }\n\n .task-table-container {\n padding: 0;\n overflow: auto;\n overflow-y: overlay;\n box-sizing: border-box;\n border: 1px solid var(--ox-gantt-border-color, var(--md-sys-color-on-surface));\n }\n\n .task-chart-container {\n flex: 1;\n padding: 0;\n box-sizing: border-box;\n border: 1px solid var(--ox-gantt-border-color, var(--md-sys-color-on-surface));\n }\n\n table {\n width: 100%;\n border-collapse: collapse;\n border: 1px solid var(--ox-gantt-border-color, var(--md-sys-color-on-surface));\n margin: -1px;\n margin-right: 0;\n }\n\n thead th {\n position: sticky;\n top: -1px;\n z-index: 1;\n background-color: var(--ox-gantt-header-background-color, var(--md-sys-color-secondary-container));\n border-color: var(--ox-gantt-header-border-color, var(--md-sys-color-on-secondary-container));\n color: var(--ox-gantt-header-color, var(--md-sys-color-on-secondary-container));\n text-transform: capitalize;\n }\n\n th,\n td {\n border: 1px solid var(--ox-gantt-border-color, var(--md-sys-color-on-surface));\n padding: 4px;\n text-align: left;\n }\n\n th {\n height: 40px;\n box-sizing: border-box;\n text-align: center;\n }\n\n td {\n height: 30px;\n box-sizing: border-box;\n }\n\n tr.selected {\n background-color: var(--ox-gantt-selected-background-color, var(--md-sys-color-surface-variant));\n }\n `\n ]\n\n @property({ type: Array }) tasks: Task[] = []\n @property({ type: Array }) resources: Resource[] = []\n @property({ type: String, attribute: 'from-date' })\n fromDate: string = new Date(new Date().getFullYear(), 0, 1).toISOString().split('T')[0] /* beginning of this year */\n @property({ type: String, attribute: 'to-date' })\n toDate: string = new Date(new Date().getFullYear(), 11, 31).toISOString().split('T')[0] /* end of this year */\n @property({ type: Boolean, attribute: 'extend-grid-lines' }) extendGridLines: boolean = false\n @property({ type: String, attribute: 'time-scale' }) timeScale: TimeScale = 'week-day'\n @property({ type: Array }) columnConfig: ColumnConfig[] = [\n { name: 'id', label: i18next.t('label.gantt-task-id') || 'ID', visible: true, width: 50, order: 1 },\n {\n name: 'section',\n label: i18next.t('label.gantt-task-section') || 'section',\n visible: true,\n width: 100,\n order: 2\n },\n { name: 'title', label: i18next.t('label.gantt-task-title') || 'title', visible: true, width: 150, order: 3 },\n { name: 'type', label: i18next.t('label.gantt-task-type') || 'type', visible: true, width: 100, order: 4 },\n {\n name: 'startDate',\n label: i18next.t('label.gantt-task-start-date') || 'start date',\n visible: true,\n width: 100,\n order: 5\n },\n {\n name: 'endDate',\n label: i18next.t('label.gantt-task-end-date') || 'end date',\n visible: true,\n width: 100,\n order: 6\n },\n { name: 'tags', label: i18next.t('label.gantt-task-tags') || 'tags', visible: true, width: 100, order: 7 },\n {\n name: 'progress',\n label: i18next.t('label.gantt-task-progress') || 'progress',\n visible: true,\n width: 100,\n order: 8\n },\n {\n name: 'dependsOn',\n label: i18next.t('label.gantt-task-previous') || 'previous',\n visible: true,\n width: 100,\n order: 9\n },\n {\n name: 'resources',\n label: i18next.t('label.gantt-task-resources') || 'resources',\n visible: true,\n width: 100,\n order: 10\n }\n ]\n\n @state() selectedTaskId?: string\n\n @query('.task-container') taskContainer!: HTMLDivElement\n @query('.task-table-container') taskTableContainer!: HTMLDivElement\n @query('.resource-container') resourceContainer!: HTMLDivElement\n @query('.resource-table-container') resourceTableContainer!: HTMLDivElement\n @query('.task-table') taskTable!: HTMLTableElement\n @query('ox-gantt-chart') ganttChart!: OxGanttChart\n @query('ox-resource-chart') resourceChart!: OxResourceChart\n\n private _startWidth: number = 0\n private _startHeight: number = 0\n private _isDragging: boolean = false\n\n render() {\n return html`\n <div class=\"container md-typescale-body-medium\">\n <div class=\"task-container\">\n <div class=\"task-table-container\" @scroll=${this.syncScroll}>${this.renderTaskTable()}</div>\n <ox-gantt-resize-splitter\n vertical\n @splitter-dragstart=${(e: CustomEvent) => this.resizeHorizontalStart(e)}\n @splitter-drag=${(e: CustomEvent) => this.resizeHorizontalDrag(e)}\n @splitter-dragend=${(e: CustomEvent) => this.resizeHorizontalEnd(e)}\n ></ox-gantt-resize-splitter>\n <ox-gantt-chart\n class=\"task-chart-container\"\n @scroll=${this.syncScroll}\n .fromDate=${this.fromDate}\n .toDate=${this.toDate}\n .tasks=${this.tasks}\n .selectedTaskId=${this.selectedTaskId}\n .axisScale=${this.timeScale}\n ?extend-grid-lines=${this.extendGridLines}\n @task-clicked=${this.handleTaskClicked}\n @timescale-changed=${(e: CustomEvent) => this.syncTimeScale(e)}\n ></ox-gantt-chart>\n </div>\n <ox-gantt-resize-splitter\n horizontal\n @splitter-dragstart=${(e: CustomEvent) => this.resizeVerticalStart(e)}\n @splitter-drag=${(e: CustomEvent) => this.resizeVerticalDrag(e)}\n @splitter-dragend=${(e: CustomEvent) => this.resizeVerticalEnd(e)}\n ></ox-gantt-resize-splitter>\n <div class=\"resource-container\">\n <div class=\"resource-table-container\" @scroll=${this.syncScroll}>\n <table>\n <thead>\n <tr>\n <th style=\"width: 100px\">${i18next.t('label.gantt-resource-type')}</th>\n <th>${i18next.t('label.gantt-resource-allocated')}</th>\n </tr>\n </thead>\n <tbody>\n ${this.resources.map(resource => this.renderResourceRow(resource))}\n </tbody>\n </table>\n </div>\n <ox-gantt-resize-splitter\n vertical\n @splitter-dragstart=${(e: CustomEvent) => this.resizeHorizontalStart(e)}\n @splitter-drag=${(e: CustomEvent) => this.resizeHorizontalDrag(e)}\n @splitter-dragend=${(e: CustomEvent) => this.resizeHorizontalEnd(e)}\n ></ox-gantt-resize-splitter>\n <ox-resource-chart\n class=\"resource-chart-container\"\n .fromDate=${this.fromDate}\n .toDate=${this.toDate}\n .tasks=${this.tasks}\n .resources=${this.resources}\n .axisScale=${this.timeScale}\n @scroll=${this.syncScroll}\n ></ox-resource-chart>\n </div>\n </div>\n `\n }\n\n renderTaskTable() {\n if (!this.columnConfig) {\n return\n }\n\n // Sort columns by the configured order\n const sortedColumns = [...this.columnConfig].sort((a, b) => a.order - b.order)\n\n return html`\n <table class=\"task-table\">\n <thead>\n <tr>\n ${sortedColumns.map(col =>\n col.visible ? html`<th style=\"width: ${col.width}px\">${col.label}</th>` : nothing\n )}\n </tr>\n </thead>\n <tbody>\n ${this.renderTaskRows(this.tasks)}\n </tbody>\n </table>\n `\n }\n\n renderTaskRows(tasks: Task[], level: number = 0): TemplateResult[] {\n return tasks.flatMap(task => [\n this.renderTaskRow(task, level),\n ...this.renderTaskRows(task.children || [], level + 1)\n ])\n }\n\n renderTaskRow(task: Task, level: number) {\n return html`\n <tr class=${this.selectedTaskId === task.id ? 'selected' : ''} @click=${() => this.selectTask(task.id)}>\n ${this.columnConfig.map(col =>\n col.visible\n ? html`<td class=\"task-row\" style=\"padding-left: ${col.name == 'title' ? level * 8 + 4 : 4}px\">\n ${this.getTaskFieldValue(task, col.name)}\n </td>`\n : null\n )}\n </tr>\n `\n }\n\n renderResourceRow(resource: Resource) {\n return html`\n <tr>\n <td>${resource.type}</td>\n <td>${resource.allocated}</td>\n </tr>\n `\n }\n\n getTaskFieldValue(task: Task, field: string) {\n switch (field) {\n case 'id':\n return task.id\n case 'section':\n return task.section?.name || ''\n case 'title':\n return task.title\n case 'type':\n return task.type\n case 'startDate':\n return new Date(task.startDate).toISOString().split('T')[0]\n case 'endDate':\n return new Date(task.endDate).toISOString().split('T')[0]\n case 'tags':\n return task.tags?.join(', ') || ''\n case 'progress':\n return task.progress || ''\n case 'dependsOn':\n return task.dependsOn || ''\n case 'resources':\n return task.resources?.map(res => `${res.type}: ${res.allocated}`).join(', ') || ''\n default:\n return ''\n }\n }\n\n selectTask(taskId: string) {\n this.selectedTaskId = taskId\n }\n\n handleTaskClicked(event: CustomEvent) {\n this.selectedTaskId = event.detail.taskId\n }\n\n protected firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void {\n this.taskTableContainer.style.width = '254px'\n this.resourceTableContainer.style.width = '254px'\n }\n\n updated(changedProperties: PropertyValues<this>) {\n if (changedProperties.has('tasks')) {\n this.resources = this.aggregateResources(this.tasks)\n }\n }\n\n aggregateResources(tasks: Task[]): Resource[] {\n const resourceMap: { [key: string]: number } = {}\n\n const traverseTasks = (tasks: Task[]) => {\n tasks.forEach(task => {\n if (task.resources) {\n const startDate = new Date(task.startDate)\n const endDate = new Date(task.endDate)\n const durationDays = d3.timeDay.count(startDate, d3.timeDay.offset(endDate, 1))\n\n task.resources.forEach(resource => {\n const totalAllocation = resource.allocated * durationDays\n if (!resourceMap[resource.type]) {\n resourceMap[resource.type] = 0\n }\n resourceMap[resource.type] += totalAllocation\n console.log(resource.type, resource.allocated, durationDays, totalAllocation)\n })\n }\n\n if (task.children) {\n traverseTasks(task.children)\n }\n })\n }\n\n traverseTasks(tasks)\n\n return Object.keys(resourceMap).map(type => ({\n type,\n allocated: resourceMap[type]\n }))\n }\n\n syncScroll(e: Event) {\n const target = e.target as HTMLElement\n\n if (target === this.taskTableContainer) {\n const newScrollTop = this.taskTableContainer.scrollTop\n this.ganttChart.setVerticalOffset(newScrollTop)\n\n if (this.ganttChart.getVerticalOffset() !== newScrollTop) {\n this.ganttChart.setVerticalOffset(newScrollTop)\n }\n } else if (target === this.ganttChart) {\n const newScrollTop = this.ganttChart.getVerticalOffset()\n this.taskTableContainer.scrollTop = newScrollTop\n this.ganttChart.setVerticalOffset(this.taskTableContainer.scrollTop)\n\n const newScrollLeft = this.ganttChart.getHorizontalOffset()\n this.resourceChart.setHorizontalOffset(newScrollLeft)\n } else if (target === this.resourceChart) {\n const newScrollTop = this.ganttChart.getVerticalOffset()\n this.resourceTableContainer.scrollTop = newScrollTop\n this.resourceChart.setVerticalOffset(this.taskTableContainer.scrollTop)\n\n const newScrollLeft = this.resourceChart.getHorizontalOffset()\n this.ganttChart.setHorizontalOffset(newScrollLeft)\n } else if (target === this.resourceTableContainer) {\n const newScrollTop = this.taskTableContainer.scrollTop\n this.resourceChart.setVerticalOffset(newScrollTop)\n\n if (this.resourceChart.getVerticalOffset() !== newScrollTop) {\n this.resourceChart.setVerticalOffset(newScrollTop)\n }\n }\n }\n\n syncTimeScale(e: CustomEvent) {\n const detail = e.detail\n this.resourceChart.syncTimeScale(detail)\n }\n\n resizeHorizontalStart(e: CustomEvent) {\n this._startWidth = ((e.target as HTMLElement)?.previousElementSibling as HTMLElement)?.offsetWidth\n this._isDragging = true\n }\n\n resizeHorizontalDrag(e: CustomEvent) {\n if (!this._isDragging) return\n const delta = e.detail\n this.taskTableContainer.style.width = `${this._startWidth + delta.x}px`\n this.resourceTableContainer.style.width = `${this._startWidth + delta.x}px`\n }\n\n resizeHorizontalEnd(e: CustomEvent) {\n this._isDragging = false\n }\n\n resizeVerticalStart(e: CustomEvent) {\n this._startHeight = ((e.target as HTMLElement)?.nextElementSibling as HTMLElement)?.offsetHeight\n this._isDragging = true\n }\n\n resizeVerticalDrag(e: CustomEvent) {\n if (!this._isDragging) return\n const delta = e.detail\n\n this.resourceContainer.style.height = `${this._startHeight - delta.y}px`\n }\n\n resizeVerticalEnd(e: CustomEvent) {\n this._isDragging = false\n }\n}\n"]}
@@ -0,0 +1,42 @@
1
+ import { LitElement, PropertyValues } from 'lit';
2
+ import * as d3 from 'd3';
3
+ import { Task, TimeScale } from './types';
4
+ export declare class OxResourceChart extends LitElement {
5
+ static styles: import("lit").CSSResult[];
6
+ fromDate: string;
7
+ toDate: string;
8
+ axisScale: string;
9
+ resources: any[];
10
+ tasks: Task[];
11
+ private timeScale;
12
+ private baseWidth;
13
+ private level;
14
+ private fromTime?;
15
+ private toTime?;
16
+ container: HTMLDivElement;
17
+ svgHeader: SVGSVGElement;
18
+ svgBody: SVGSVGElement;
19
+ render(): import("lit-html").TemplateResult<1>;
20
+ updated(changedProperties: PropertyValues<this>): void;
21
+ updateTimeScale(): void;
22
+ getChartWidth(): number;
23
+ getScale(): number;
24
+ drawAxes(): void;
25
+ drawBody(): void;
26
+ renderResourceAllocations(body: d3.Selection<SVGSVGElement, unknown, null, undefined>, ticks: Date[]): void;
27
+ calculateResourceAllocations(ticks: Date[]): {
28
+ [key: string]: {
29
+ [key: string]: number;
30
+ };
31
+ };
32
+ getTickEnd(tick: Date): Date;
33
+ formatDateKey(start: Date, end: Date): string;
34
+ syncTimeScale(detail: {
35
+ baseWidth: number;
36
+ level: TimeScale;
37
+ }): void;
38
+ setVerticalOffset(offset: number): void;
39
+ getVerticalOffset(): number;
40
+ setHorizontalOffset(offset: number): void;
41
+ getHorizontalOffset(): number;
42
+ }