@operato/gantt 7.0.8 → 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.
@@ -1,15 +1,17 @@
1
1
  import { __decorate } from "tslib";
2
- import { LitElement, html, css } from 'lit';
2
+ import { LitElement, html, css, nothing } from 'lit';
3
3
  import i18next from 'i18next';
4
4
  import { customElement, property, query, state } from 'lit/decorators.js';
5
5
  import { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles';
6
6
  import { ScrollbarStyles } from '@operato/styles';
7
7
  import './ox-gantt-chart.js';
8
+ import './ox-resource-chart.js';
8
9
  import './ox-gantt-resize-splitter.js';
9
10
  let OxGantt = class OxGantt extends LitElement {
10
11
  constructor() {
11
12
  super(...arguments);
12
13
  this.tasks = [];
14
+ this.resources = [];
13
15
  this.fromDate = new Date(new Date().getFullYear(), 0, 1).toISOString().split('T')[0]; /* beginning of this year */
14
16
  this.toDate = new Date(new Date().getFullYear(), 11, 31).toISOString().split('T')[0]; /* end of this year */
15
17
  this.extendGridLines = false;
@@ -53,9 +55,17 @@ let OxGantt = class OxGantt extends LitElement {
53
55
  visible: true,
54
56
  width: 100,
55
57
  order: 9
58
+ },
59
+ {
60
+ name: 'resources',
61
+ label: i18next.t('label.gantt-task-resources') || 'resources',
62
+ visible: true,
63
+ width: 100,
64
+ order: 10
56
65
  }
57
66
  ];
58
67
  this._startWidth = 0;
68
+ this._startHeight = 0;
59
69
  this._isDragging = false;
60
70
  }
61
71
  static { this.styles = [
@@ -70,13 +80,24 @@ let OxGantt = class OxGantt extends LitElement {
70
80
  }
71
81
 
72
82
  .container {
83
+ flex: 1;
84
+
73
85
  display: flex;
86
+ flex-direction: column;
74
87
  width: 100%;
75
88
  height: 100%;
76
89
  box-sizing: border-box;
77
90
  }
78
91
 
79
- .task-container {
92
+ .resource-container {
93
+ height: 300px;
94
+
95
+ display: flex;
96
+ overflow: hidden;
97
+ box-sizing: border-box;
98
+ }
99
+
100
+ .resource-table-container {
80
101
  padding: 0;
81
102
  overflow: auto;
82
103
  overflow-y: overlay;
@@ -84,16 +105,34 @@ let OxGantt = class OxGantt extends LitElement {
84
105
  border: 1px solid var(--ox-gantt-border-color, var(--md-sys-color-on-surface));
85
106
  }
86
107
 
87
- .chart-container {
108
+ .resource-chart-container {
109
+ flex: 1;
110
+ padding: 0;
111
+ box-sizing: border-box;
112
+ border: 1px solid var(--ox-gantt-border-color, var(--md-sys-color-on-surface));
113
+ }
114
+
115
+ .task-container {
88
116
  flex: 1;
117
+
118
+ display: flex;
119
+ overflow: hidden;
120
+ box-sizing: border-box;
121
+ }
122
+
123
+ .task-table-container {
89
124
  padding: 0;
125
+ overflow: auto;
126
+ overflow-y: overlay;
90
127
  box-sizing: border-box;
91
128
  border: 1px solid var(--ox-gantt-border-color, var(--md-sys-color-on-surface));
92
129
  }
93
130
 
94
- ox-gantt-resize-splitter {
95
- width: 4px;
96
- cursor: ew-resize;
131
+ .task-chart-container {
132
+ flex: 1;
133
+ padding: 0;
134
+ box-sizing: border-box;
135
+ border: 1px solid var(--ox-gantt-border-color, var(--md-sys-color-on-surface));
97
136
  }
98
137
 
99
138
  table {
@@ -139,24 +178,64 @@ let OxGantt = class OxGantt extends LitElement {
139
178
  render() {
140
179
  return html `
141
180
  <div class="container md-typescale-body-medium">
142
- <div class="task-container" @scroll=${this.syncScroll}>${this.renderTaskTable()}</div>
181
+ <div class="task-container">
182
+ <div class="task-table-container" @scroll=${this.syncScroll}>${this.renderTaskTable()}</div>
183
+ <ox-gantt-resize-splitter
184
+ vertical
185
+ @splitter-dragstart=${(e) => this.resizeHorizontalStart(e)}
186
+ @splitter-drag=${(e) => this.resizeHorizontalDrag(e)}
187
+ @splitter-dragend=${(e) => this.resizeHorizontalEnd(e)}
188
+ ></ox-gantt-resize-splitter>
189
+ <ox-gantt-chart
190
+ class="task-chart-container"
191
+ @scroll=${(e) => {
192
+ this.syncScroll(e);
193
+ this.syncResourceChartScroll(e);
194
+ }}
195
+ .fromDate=${this.fromDate}
196
+ .toDate=${this.toDate}
197
+ .tasks=${this.tasks}
198
+ .selectedTaskId=${this.selectedTaskId}
199
+ .axisScale=${this.timeScale}
200
+ ?extend-grid-lines=${this.extendGridLines}
201
+ @task-clicked=${this.handleTaskClicked}
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">
212
+ <table>
213
+ <thead>
214
+ <tr>
215
+ <th style="width: 100px">type</th>
216
+ <th>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
+ .resources=${this.resources}
235
+ .axisScale=${this.timeScale}
236
+ @scroll=${this.syncTaskChartScroll}
237
+ ></ox-resource-chart>
238
+ </div>
160
239
  </div>
161
240
  `;
162
241
  }
@@ -164,35 +243,46 @@ let OxGantt = class OxGantt extends LitElement {
164
243
  if (!this.columnConfig) {
165
244
  return;
166
245
  }
167
- const mergedTasks = this.mergeTasksBySection(this.tasks);
168
246
  // Sort columns by the configured order
169
247
  const sortedColumns = [...this.columnConfig].sort((a, b) => a.order - b.order);
170
248
  return html `
171
249
  <table>
172
250
  <thead>
173
251
  <tr>
174
- ${sortedColumns.map(col => col.visible ? html `<th style="width: ${col.width}px">${col.label}</th>` : null)}
252
+ ${sortedColumns.map(col => col.visible ? html `<th style="width: ${col.width}px">${col.label}</th>` : nothing)}
175
253
  </tr>
176
254
  </thead>
177
255
  <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
- `)}
256
+ ${this.renderTaskRows(this.tasks)}
192
257
  </tbody>
193
258
  </table>
194
259
  `;
195
260
  }
261
+ renderTaskRows(tasks, level = 0) {
262
+ return tasks.flatMap(task => [
263
+ this.renderTaskRow(task, level),
264
+ ...this.renderTaskRows(task.children || [], level + 1)
265
+ ]);
266
+ }
267
+ renderTaskRow(task, level) {
268
+ return html `
269
+ <tr class=${this.selectedTaskId === task.id ? 'selected' : ''} @click=${() => this.selectTask(task.id)}>
270
+ ${this.columnConfig.map(col => col.visible
271
+ ? html `<td class="task-row" style="padding-left: ${col.name == 'id' ? level * 20 : 0}px">
272
+ ${this.getTaskFieldValue(task, col.name)}
273
+ </td>`
274
+ : null)}
275
+ </tr>
276
+ `;
277
+ }
278
+ renderResourceRow(resource) {
279
+ return html `
280
+ <tr>
281
+ <td>${resource.type}</td>
282
+ <td>${resource.allocated}</td>
283
+ </tr>
284
+ `;
285
+ }
196
286
  getTaskFieldValue(task, field) {
197
287
  switch (field) {
198
288
  case 'id':
@@ -213,30 +303,12 @@ let OxGantt = class OxGantt extends LitElement {
213
303
  return task.progress || '';
214
304
  case 'dependsOn':
215
305
  return task.dependsOn || '';
306
+ case 'resources':
307
+ return task.resources?.map(res => `${res.type}: ${res.allocated}`).join(', ') || '';
216
308
  default:
217
309
  return '';
218
310
  }
219
311
  }
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
312
  selectTask(taskId) {
241
313
  this.selectedTaskId = taskId;
242
314
  }
@@ -244,14 +316,42 @@ let OxGantt = class OxGantt extends LitElement {
244
316
  this.selectedTaskId = event.detail.taskId;
245
317
  }
246
318
  firstUpdated(_changedProperties) {
247
- this.taskContainer.style.width = '254px';
319
+ this.taskTableContainer.style.width = '254px';
320
+ this.resourceTableContainer.style.width = '254px';
321
+ }
322
+ updated(changedProperties) {
323
+ if (changedProperties.has('tasks')) {
324
+ this.resources = this.aggregateResources(this.tasks);
325
+ }
326
+ }
327
+ aggregateResources(tasks) {
328
+ const resourceMap = {};
329
+ const traverseTasks = (tasks) => {
330
+ tasks.forEach(task => {
331
+ if (task.resources) {
332
+ task.resources.forEach(resource => {
333
+ if (!resourceMap[resource.type]) {
334
+ resourceMap[resource.type] = 0;
335
+ }
336
+ resourceMap[resource.type] += resource.allocated;
337
+ });
338
+ }
339
+ if (task.children) {
340
+ traverseTasks(task.children);
341
+ }
342
+ });
343
+ };
344
+ traverseTasks(tasks);
345
+ return Object.keys(resourceMap).map(type => ({
346
+ type,
347
+ allocated: resourceMap[type]
348
+ }));
248
349
  }
249
- updated(changes) { }
250
350
  syncScroll(e) {
251
351
  const target = e.target;
252
- if (target === this.taskContainer) {
352
+ if (target === this.taskTableContainer) {
253
353
  // Sync chart scroll with table scroll
254
- const newScrollTop = this.taskContainer.scrollTop;
354
+ const newScrollTop = this.taskTableContainer.scrollTop;
255
355
  this.ganttChart.setVerticalOffset(newScrollTop);
256
356
  // Ensure chart scroll matches table scroll
257
357
  if (this.ganttChart.getVerticalOffset() !== newScrollTop) {
@@ -261,31 +361,51 @@ let OxGantt = class OxGantt extends LitElement {
261
361
  else if (target === this.ganttChart) {
262
362
  // Sync table scroll with chart scroll
263
363
  const newScrollTop = this.ganttChart.getVerticalOffset();
264
- this.taskContainer.scrollTop = newScrollTop;
364
+ this.taskTableContainer.scrollTop = newScrollTop;
265
365
  // Ensure table scroll matches chart scroll
266
- this.ganttChart.setVerticalOffset(this.taskContainer.scrollTop);
366
+ this.ganttChart.setVerticalOffset(this.taskTableContainer.scrollTop);
267
367
  }
268
368
  }
269
- resizeStart(e) {
369
+ syncResourceChartScroll(e) {
370
+ this.resourceChart.renderRoot.querySelector('div[chart-container]').scrollLeft = e.detail.offset;
371
+ }
372
+ syncTaskChartScroll(e) {
373
+ this.ganttChart.renderRoot.querySelector('div[chart-container]').scrollLeft = e.detail.offset;
374
+ }
375
+ resizeHorizontalStart(e) {
270
376
  this._startWidth = e.target?.previousElementSibling?.offsetWidth;
271
377
  this._isDragging = true;
272
378
  }
273
- resizeDrag(e) {
379
+ resizeHorizontalDrag(e) {
274
380
  if (!this._isDragging)
275
381
  return;
276
382
  const delta = e.detail;
277
- const taskContainer = this.taskContainer;
278
- if (taskContainer) {
279
- taskContainer.style.width = `${this._startWidth + delta.x}px`;
280
- }
383
+ this.taskTableContainer.style.width = `${this._startWidth + delta.x}px`;
384
+ this.resourceTableContainer.style.width = `${this._startWidth + delta.x}px`;
281
385
  }
282
- resizeEnd(e) {
386
+ resizeHorizontalEnd(e) {
387
+ this._isDragging = false;
388
+ }
389
+ resizeVerticalStart(e) {
390
+ this._startHeight = e.target?.nextElementSibling?.offsetHeight;
391
+ this._isDragging = true;
392
+ }
393
+ resizeVerticalDrag(e) {
394
+ if (!this._isDragging)
395
+ return;
396
+ const delta = e.detail;
397
+ this.resourceContainer.style.height = `${this._startHeight - delta.y}px`;
398
+ }
399
+ resizeVerticalEnd(e) {
283
400
  this._isDragging = false;
284
401
  }
285
402
  };
286
403
  __decorate([
287
404
  property({ type: Array })
288
405
  ], OxGantt.prototype, "tasks", void 0);
406
+ __decorate([
407
+ property({ type: Array })
408
+ ], OxGantt.prototype, "resources", void 0);
289
409
  __decorate([
290
410
  property({ type: String, attribute: 'from-date' })
291
411
  ], OxGantt.prototype, "fromDate", void 0);
@@ -304,21 +424,33 @@ __decorate([
304
424
  __decorate([
305
425
  state()
306
426
  ], OxGantt.prototype, "selectedTaskId", void 0);
307
- __decorate([
308
- query('.container')
309
- ], OxGantt.prototype, "container", void 0);
310
427
  __decorate([
311
428
  query('.task-container')
312
429
  ], OxGantt.prototype, "taskContainer", void 0);
313
430
  __decorate([
314
- query('.chart-container')
315
- ], OxGantt.prototype, "chartContainer", void 0);
431
+ query('.task-table-container')
432
+ ], OxGantt.prototype, "taskTableContainer", void 0);
433
+ __decorate([
434
+ query('.task-chart-container')
435
+ ], OxGantt.prototype, "taskChartContainer", void 0);
436
+ __decorate([
437
+ query('.resource-container')
438
+ ], OxGantt.prototype, "resourceContainer", void 0);
439
+ __decorate([
440
+ query('.resource-table-container')
441
+ ], OxGantt.prototype, "resourceTableContainer", void 0);
442
+ __decorate([
443
+ query('.resource-chart-container')
444
+ ], OxGantt.prototype, "resourceChartContainer", void 0);
316
445
  __decorate([
317
446
  query('table')
318
447
  ], OxGantt.prototype, "taskTable", void 0);
319
448
  __decorate([
320
449
  query('ox-gantt-chart')
321
450
  ], OxGantt.prototype, "ganttChart", void 0);
451
+ __decorate([
452
+ query('ox-resource-chart')
453
+ ], OxGantt.prototype, "resourceChart", void 0);
322
454
  OxGantt = __decorate([
323
455
  customElement('ox-gantt')
324
456
  ], 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,IAAI,iBAAiB,EAAE,MAAM,8CAA8C,CAAA;AAC1F,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,qBAAqB,CAAA;AAC5B,OAAO,+BAA+B,CAAA;AAK/B,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,UAAU;IAAhC;;QAgFsB,UAAK,GAAW,EAAE,CAAA;QAE7C,aAAQ,GAAW,IAAI,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA,CAAC,4BAA4B;QAEpH,WAAM,GAAW,IAAI,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAA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AA;QAC/D,CAAC;IACH,CAAC;IAED,SAAS,CAAC,CAAc;QACtB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAA;IAC1B,CAAC;;AAlO0B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;sCAAmB;AAE7C;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;yCACoC;AAEvF;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;uCACsC;AAC1B;IAA5D,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC;gDAAiC;AACxC;IAApD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;0CAAkC;AAC3D;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;6CAwCzB;AAEQ;IAAR,KAAK,EAAE;+CAAwB;AAEX;IAApB,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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EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;uCACsC;AAC1B;IAA5D,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC;gDAAiC;AACxC;IAApD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;0CAAkC;AAC3D;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;6CA+CzB;AAEQ;IAAR,KAAK,EAAE;+CAAwB;AAEN;IAAzB,KAAK,CAAC,iBAAiB,CAAC;8CAA+B;AACxB;IAA/B,KAAK,CAAC,uBAAuB,CAAC;mDAAoC;AACnC;IAA/B,KAAK,CAAC,uBAAuB,CAAC;mDAAoC;AACrC;IAA7B,KAAK,CAAC,qBAAqB,CAAC;kDAAmC;AAC5B;IAAnC,KAAK,CAAC,2BAA2B,CAAC;uDAAwC;AACvC;IAAnC,KAAK,CAAC,2BAA2B,CAAC;uDAAwC;AAC3D;IAAf,KAAK,CAAC,OAAO,CAAC;0CAA6B;AACnB;IAAxB,KAAK,CAAC,gBAAgB,CAAC;2CAA0B;AACtB;IAA3B,KAAK,CAAC,mBAAmB,CAAC;8CAAgC;AAhLhD,OAAO;IADnB,aAAa,CAAC,UAAU,CAAC;GACb,OAAO,CAkbnB","sourcesContent":["import { LitElement, html, css, PropertyValues, PropertyValueMap, nothing, TemplateResult } 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-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 }\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('.task-chart-container') taskChartContainer!: HTMLDivElement\n @query('.resource-container') resourceContainer!: HTMLDivElement\n @query('.resource-table-container') resourceTableContainer!: HTMLDivElement\n @query('.resource-chart-container') resourceChartContainer!: HTMLDivElement\n @query('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=${(e: CustomEvent) => {\n this.syncScroll(e)\n this.syncResourceChartScroll(e)\n }}\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 <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\">\n <table>\n <thead>\n <tr>\n <th style=\"width: 100px\">type</th>\n <th>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 .resources=${this.resources}\n .axisScale=${this.timeScale}\n @scroll=${this.syncTaskChartScroll}\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>\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 == 'id' ? level * 20 : 0}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 task.resources.forEach(resource => {\n if (!resourceMap[resource.type]) {\n resourceMap[resource.type] = 0\n }\n resourceMap[resource.type] += resource.allocated\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 if (target === this.taskTableContainer) {\n // Sync chart scroll with table scroll\n const newScrollTop = this.taskTableContainer.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.taskTableContainer.scrollTop = newScrollTop\n\n // Ensure table scroll matches chart scroll\n this.ganttChart.setVerticalOffset(this.taskTableContainer.scrollTop)\n }\n }\n\n syncResourceChartScroll(e: CustomEvent) {\n this.resourceChart.renderRoot!.querySelector('div[chart-container]')!.scrollLeft = e.detail.offset\n }\n\n syncTaskChartScroll(e: CustomEvent) {\n this.ganttChart.renderRoot!.querySelector('div[chart-container]')!.scrollLeft = e.detail.offset\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,19 @@
1
+ import { LitElement, PropertyValues } from 'lit';
2
+ export declare class OxResourceChart extends LitElement {
3
+ static styles: import("lit").CSSResult[];
4
+ fromDate: string;
5
+ toDate: string;
6
+ axisScale: string;
7
+ resources: any[];
8
+ private _timeScale;
9
+ private _baseWidth;
10
+ private _level;
11
+ render(): import("lit-html").TemplateResult<1>;
12
+ updated(changedProperties: PropertyValues<this>): void;
13
+ updateTimeScale(): void;
14
+ getChartWidth(): number;
15
+ getScale(): number;
16
+ drawAxes(): void;
17
+ drawBody(): void;
18
+ syncScroll(e: CustomEvent): void;
19
+ }