mantine-gantt 0.4.1 → 0.6.0

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 (53) hide show
  1. package/README.md +60 -17
  2. package/dist/cjs/Gantt/DependencyLinks.cjs +28 -25
  3. package/dist/cjs/Gantt/DependencyLinks.cjs.map +1 -1
  4. package/dist/cjs/Gantt/Gantt.cjs +192 -53
  5. package/dist/cjs/Gantt/Gantt.cjs.map +1 -1
  6. package/dist/cjs/Gantt/Gantt.module.css.cjs +1 -1
  7. package/dist/cjs/Gantt/TaskBar.cjs +36 -12
  8. package/dist/cjs/Gantt/TaskBar.cjs.map +1 -1
  9. package/dist/cjs/Gantt/TaskList.cjs +51 -38
  10. package/dist/cjs/Gantt/TaskList.cjs.map +1 -1
  11. package/dist/cjs/Gantt/TimelineGrid.cjs +7 -27
  12. package/dist/cjs/Gantt/TimelineGrid.cjs.map +1 -1
  13. package/dist/cjs/Gantt/TimelineHeader.cjs +21 -38
  14. package/dist/cjs/Gantt/TimelineHeader.cjs.map +1 -1
  15. package/dist/cjs/Gantt/use-gantt-drag.cjs +65 -61
  16. package/dist/cjs/Gantt/use-gantt-drag.cjs.map +1 -1
  17. package/dist/cjs/Gantt/utils.cjs +163 -81
  18. package/dist/cjs/Gantt/utils.cjs.map +1 -1
  19. package/dist/cjs/index.cjs +3 -4
  20. package/dist/cjs/index.cjs.map +1 -1
  21. package/dist/esm/Gantt/DependencyLinks.mjs +29 -26
  22. package/dist/esm/Gantt/DependencyLinks.mjs.map +1 -1
  23. package/dist/esm/Gantt/Gantt.mjs +196 -57
  24. package/dist/esm/Gantt/Gantt.mjs.map +1 -1
  25. package/dist/esm/Gantt/Gantt.module.css.mjs +1 -1
  26. package/dist/esm/Gantt/TaskBar.mjs +37 -13
  27. package/dist/esm/Gantt/TaskBar.mjs.map +1 -1
  28. package/dist/esm/Gantt/TaskList.mjs +52 -39
  29. package/dist/esm/Gantt/TaskList.mjs.map +1 -1
  30. package/dist/esm/Gantt/TimelineGrid.mjs +7 -27
  31. package/dist/esm/Gantt/TimelineGrid.mjs.map +1 -1
  32. package/dist/esm/Gantt/TimelineHeader.mjs +22 -39
  33. package/dist/esm/Gantt/TimelineHeader.mjs.map +1 -1
  34. package/dist/esm/Gantt/use-gantt-drag.mjs +66 -62
  35. package/dist/esm/Gantt/use-gantt-drag.mjs.map +1 -1
  36. package/dist/esm/Gantt/utils.mjs +157 -82
  37. package/dist/esm/Gantt/utils.mjs.map +1 -1
  38. package/dist/esm/index.mjs +1 -5
  39. package/dist/esm/index.mjs.map +1 -1
  40. package/dist/styles.css +2 -2
  41. package/dist/styles.layer.css +2 -2
  42. package/dist/types/Gantt/DependencyLinks.d.ts +3 -3
  43. package/dist/types/Gantt/TaskBar.d.ts +12 -1
  44. package/dist/types/Gantt/TaskList.d.ts +3 -1
  45. package/dist/types/Gantt/TimelineGrid.d.ts +2 -1
  46. package/dist/types/Gantt/TimelineHeader.d.ts +3 -1
  47. package/dist/types/Gantt/index.d.ts +2 -6
  48. package/dist/types/Gantt/types.d.ts +127 -19
  49. package/dist/types/Gantt/use-gantt-drag.d.ts +4 -2
  50. package/dist/types/Gantt/utils.d.ts +51 -12
  51. package/dist/types/index.d.mts +2 -2
  52. package/dist/types/index.d.ts +2 -2
  53. package/package.json +1 -1
@@ -17,8 +17,12 @@ var Gantt_module = require('./Gantt.module.css.cjs');
17
17
  const DRAG_BUFFER_DAYS = 30;
18
18
  const EMPTY_CRITICAL = /* @__PURE__ */ new Set();
19
19
  const FLEX_COLUMN_WIDTH = 200;
20
- function autoTaskListWidth(columns = TaskList.defaultColumns) {
21
- return columns.reduce((sum, col) => sum + (col.width ?? FLEX_COLUMN_WIDTH), 0);
20
+ const FLEX_COLUMN_MIN_WIDTH = 100;
21
+ function columnsWidth(columns = TaskList.defaultColumns, flexWidth) {
22
+ return columns.reduce((sum, col) => sum + (col.width ?? flexWidth), 0);
23
+ }
24
+ function resolveTaskListWidth(taskListWidth, columns) {
25
+ return taskListWidth === void 0 ? columnsWidth(columns, FLEX_COLUMN_WIDTH) : Math.max(taskListWidth, columnsWidth(columns, FLEX_COLUMN_MIN_WIDTH));
22
26
  }
23
27
  const defaultProps = {
24
28
  columnWidth: 40,
@@ -27,10 +31,12 @@ const defaultProps = {
27
31
  showTodayMarker: true,
28
32
  viewMode: "day",
29
33
  weekStart: 1,
34
+ locale: "en",
30
35
  highlightCriticalPath: false,
31
36
  criticalPathColor: "red",
32
37
  showBaselines: true,
33
- autoSchedule: false
38
+ autoSchedule: false,
39
+ showDragLabel: true
34
40
  };
35
41
  const varsResolver = core.createVarsResolver(
36
42
  (theme, { columnWidth, rowHeight, taskListWidth, columns, criticalPathColor }) => ({
@@ -38,13 +44,14 @@ const varsResolver = core.createVarsResolver(
38
44
  "--gantt-column-width": `${columnWidth}px`,
39
45
  "--gantt-row-height": `${rowHeight}px`,
40
46
  "--gantt-header-height": "50px",
41
- "--gantt-task-list-width": `${taskListWidth ?? autoTaskListWidth(columns)}px`,
47
+ "--gantt-task-list-width": `${resolveTaskListWidth(taskListWidth, columns)}px`,
42
48
  "--gantt-critical-color": core.getThemeColor(criticalPathColor, theme)
43
49
  }
44
50
  })
45
51
  );
46
52
  const Gantt = core.factory((_props, ref) => {
47
53
  const props = core.useProps("Gantt", defaultProps, _props);
54
+ const theme = core.useMantineTheme();
48
55
  const {
49
56
  classNames,
50
57
  className,
@@ -71,17 +78,29 @@ const Gantt = core.factory((_props, ref) => {
71
78
  endDate,
72
79
  viewMode = "day",
73
80
  weekStart = 1,
81
+ locale = "en",
74
82
  highlightCriticalPath,
75
83
  criticalPathColor,
76
84
  showBaselines,
77
85
  defaultExpandedIds,
78
86
  onToggleExpand,
87
+ scrollTo,
88
+ isNonWorkingDay,
89
+ selectedTaskId,
90
+ markers,
91
+ readOnly,
92
+ workingDays,
93
+ onColumnWidthChange,
94
+ showDragLabel,
79
95
  ...others
80
96
  } = props;
97
+ const [zoomWidth, setZoomWidth] = React.useState(null);
98
+ React.useEffect(() => setZoomWidth(null), [columnWidth]);
99
+ const baseColumnWidth = zoomWidth ?? columnWidth;
81
100
  const getStyles = core.useStyles({
82
101
  name: "Gantt",
83
102
  classes: Gantt_module,
84
- props,
103
+ props: { ...props, columnWidth: baseColumnWidth },
85
104
  className,
86
105
  style,
87
106
  classNames,
@@ -94,16 +113,17 @@ const Gantt = core.factory((_props, ref) => {
94
113
  const effectiveColumnWidth = React.useMemo(() => {
95
114
  switch (viewMode) {
96
115
  case "month":
97
- return Math.max(columnWidth / 6, 7);
116
+ return Math.max(baseColumnWidth / 6, 7);
98
117
  // Each day is 1/6th, min 7px
99
118
  case "week":
100
- return Math.max(columnWidth / 2, 14);
119
+ return Math.max(baseColumnWidth / 2, 14);
101
120
  // Each day is 1/2nd, min 14px
102
121
  case "day":
103
122
  default:
104
- return Math.max(columnWidth, 1);
123
+ return Math.max(baseColumnWidth, 1);
105
124
  }
106
- }, [viewMode, columnWidth]);
125
+ }, [viewMode, baseColumnWidth]);
126
+ const calendar = workingDays ? isNonWorkingDay ?? utils.isWeekend : void 0;
107
127
  const [tasks, setTasks] = hooks.useUncontrolled({
108
128
  value: tasksProp,
109
129
  defaultValue: defaultTasks,
@@ -134,7 +154,10 @@ const Gantt = core.factory((_props, ref) => {
134
154
  },
135
155
  [onToggleExpand, collapsedIds]
136
156
  );
137
- const rows = React.useMemo(() => utils.buildTaskTree(tasks, collapsedIds), [tasks, collapsedIds]);
157
+ const rows = React.useMemo(
158
+ () => utils.buildTaskTree(tasks, collapsedIds, calendar),
159
+ [tasks, collapsedIds, calendar]
160
+ );
138
161
  const criticalIds = React.useMemo(
139
162
  () => highlightCriticalPath ? utils.getCriticalPath(tasks) : EMPTY_CRITICAL,
140
163
  [highlightCriticalPath, tasks]
@@ -154,25 +177,31 @@ const Gantt = core.factory((_props, ref) => {
154
177
  contentRef: timelineContentRef,
155
178
  onTaskUpdate,
156
179
  onLinkCreate,
157
- onLinkDelete,
158
180
  autoSchedule,
181
+ isNonWorkingDay: calendar,
159
182
  announce: setAnnouncement
160
183
  });
161
184
  const active = drag.state;
162
185
  const handleLinkDelete = React.useCallback(
163
- (fromTaskId, toTaskId) => {
186
+ (fromTaskId, toTaskId, type) => {
164
187
  setTasks(
165
188
  tasks.map(
166
- (task) => task.id === toTaskId ? { ...task, dependencies: (task.dependencies ?? []).filter((id) => id !== fromTaskId) } : task
189
+ (task) => task.id === toTaskId ? {
190
+ ...task,
191
+ dependencies: (task.dependencies ?? []).filter((dep) => {
192
+ const normalized = utils.normalizeDependency(dep);
193
+ return normalized.taskId !== fromTaskId || normalized.type !== type;
194
+ })
195
+ } : task
167
196
  )
168
197
  );
169
- onLinkDelete?.(fromTaskId, toTaskId);
198
+ onLinkDelete?.(fromTaskId, toTaskId, type);
170
199
  },
171
200
  [tasks, setTasks, onLinkDelete]
172
201
  );
173
202
  const calculatedBounds = React.useMemo(
174
- () => utils.calculateTimelineBounds(tasks, startDate, endDate),
175
- [tasks, startDate, endDate]
203
+ () => utils.calculateTimelineBounds(tasks, startDate, endDate, void 0, calendar),
204
+ [tasks, startDate, endDate, calendar]
176
205
  );
177
206
  const bounds = React.useMemo(() => {
178
207
  if (!active || active.type === "link") {
@@ -183,32 +212,25 @@ const Gantt = core.factory((_props, ref) => {
183
212
  return calculatedBounds;
184
213
  }
185
214
  const startDay = dayjs(task.startDate).diff(calculatedBounds.start, "day");
186
- const barEndDay = startDay + task.duration + Math.round(active.deltaX / effectiveColumnWidth);
215
+ const barEndDay = startDay + utils.getTaskSpan(task.startDate, task.duration, calendar) + Math.round(active.deltaX / effectiveColumnWidth);
187
216
  const needed = calculatedBounds.start.add(barEndDay + DRAG_BUFFER_DAYS, "day");
188
217
  if (!needed.isAfter(calculatedBounds.end)) {
189
218
  return calculatedBounds;
190
219
  }
191
220
  return { start: calculatedBounds.start, end: needed };
192
- }, [calculatedBounds, active, tasks, effectiveColumnWidth]);
221
+ }, [calculatedBounds, active, tasks, effectiveColumnWidth, calendar]);
193
222
  const fillDays = effectiveColumnWidth > 0 ? Math.ceil(viewport.width / effectiveColumnWidth) : 0;
194
223
  const totalDays = Math.max(bounds.end.diff(bounds.start, "day") + 1, fillDays);
195
224
  const displayEnd = bounds.start.add(totalDays - 1, "day");
196
225
  const timelineWidth = totalDays * effectiveColumnWidth;
197
226
  const [firstRow, lastRow] = utils.visibleRowRange(scrollTop, viewport.height, rowHeight, rows.length);
198
227
  const visibleRows = rows.slice(firstRow, lastRow);
199
- const echoRef = React.useRef(null);
200
228
  const handleTimelineScroll = React.useCallback(() => {
201
229
  const body = timelineBodyRef.current;
202
230
  if (!body) {
203
231
  return;
204
232
  }
205
- const echo = echoRef.current;
206
- if (echo?.source === "timeline" && echo.value === body.scrollTop) {
207
- echoRef.current = null;
208
- return;
209
- }
210
233
  if (taskListBodyRef.current) {
211
- echoRef.current = { source: "timeline", value: body.scrollTop };
212
234
  taskListBodyRef.current.scrollTop = body.scrollTop;
213
235
  }
214
236
  if (timelineHeaderRef.current) {
@@ -217,18 +239,8 @@ const Gantt = core.factory((_props, ref) => {
217
239
  setScrollTop(body.scrollTop);
218
240
  }, []);
219
241
  const handleTaskListScroll = React.useCallback(() => {
220
- const list = taskListBodyRef.current;
221
- if (!list) {
222
- return;
223
- }
224
- const echo = echoRef.current;
225
- if (echo?.source === "list" && echo.value === list.scrollTop) {
226
- echoRef.current = null;
227
- return;
228
- }
229
- if (timelineBodyRef.current) {
230
- echoRef.current = { source: "list", value: list.scrollTop };
231
- timelineBodyRef.current.scrollTop = list.scrollTop;
242
+ if (taskListBodyRef.current && timelineBodyRef.current) {
243
+ timelineBodyRef.current.scrollTop = taskListBodyRef.current.scrollTop;
232
244
  }
233
245
  }, []);
234
246
  React.useEffect(() => {
@@ -247,6 +259,66 @@ const Gantt = core.factory((_props, ref) => {
247
259
  observer.observe(node);
248
260
  return () => observer.disconnect();
249
261
  }, []);
262
+ const zoomAnchorRef = React.useRef(0);
263
+ const zoomRef = React.useRef({ width: baseColumnWidth, onChange: onColumnWidthChange });
264
+ zoomRef.current = { width: baseColumnWidth, onChange: onColumnWidthChange };
265
+ React.useEffect(() => {
266
+ const body = timelineBodyRef.current;
267
+ if (!body) {
268
+ return void 0;
269
+ }
270
+ const onWheel = (e) => {
271
+ if (!e.ctrlKey) {
272
+ return;
273
+ }
274
+ e.preventDefault();
275
+ zoomAnchorRef.current = e.clientX - body.getBoundingClientRect().left;
276
+ const factor = e.deltaY < 0 ? 1.1 : 1 / 1.1;
277
+ const next = Math.round(Math.min(200, Math.max(8, zoomRef.current.width * factor)));
278
+ setZoomWidth(next);
279
+ zoomRef.current.onChange?.(next);
280
+ };
281
+ body.addEventListener("wheel", onWheel, { passive: false });
282
+ return () => body.removeEventListener("wheel", onWheel);
283
+ }, []);
284
+ const prevColumnWidthRef = React.useRef(effectiveColumnWidth);
285
+ React.useLayoutEffect(() => {
286
+ const prev = prevColumnWidthRef.current;
287
+ if (prev === effectiveColumnWidth) {
288
+ return;
289
+ }
290
+ prevColumnWidthRef.current = effectiveColumnWidth;
291
+ const body = timelineBodyRef.current;
292
+ if (body) {
293
+ const anchor = zoomAnchorRef.current;
294
+ body.scrollLeft = (body.scrollLeft + anchor) * (effectiveColumnWidth / prev) - anchor;
295
+ }
296
+ zoomAnchorRef.current = 0;
297
+ }, [effectiveColumnWidth]);
298
+ const scrollToKey = scrollTo instanceof Date ? scrollTo.getTime() : typeof scrollTo === "object" && scrollTo ? `task:${scrollTo.taskId}` : scrollTo;
299
+ React.useEffect(() => {
300
+ const body = timelineBodyRef.current;
301
+ if (!scrollTo || !body) {
302
+ return;
303
+ }
304
+ let date;
305
+ let rowIndex = -1;
306
+ if (scrollTo === "today") {
307
+ date = dayjs();
308
+ } else if (scrollTo instanceof Date) {
309
+ date = dayjs(scrollTo);
310
+ } else {
311
+ rowIndex = rows.findIndex((r) => r.task.id === scrollTo.taskId);
312
+ if (rowIndex === -1) {
313
+ return;
314
+ }
315
+ date = dayjs(rows[rowIndex].startDate);
316
+ }
317
+ body.scrollLeft = utils.dateToPixel(date, bounds.start, effectiveColumnWidth) - effectiveColumnWidth;
318
+ if (rowIndex >= 0) {
319
+ body.scrollTop = Math.max(0, rowIndex * rowHeight - (body.clientHeight - rowHeight) / 2);
320
+ }
321
+ }, [scrollToKey]);
250
322
  const handleTaskClick = React.useCallback(
251
323
  (task) => {
252
324
  onTaskClick?.(task);
@@ -254,33 +326,67 @@ const Gantt = core.factory((_props, ref) => {
254
326
  [onTaskClick]
255
327
  );
256
328
  const panRef = React.useRef(null);
257
- const handlePanStart = React.useCallback((e) => {
329
+ const autoScrollTick = React.useCallback(() => {
330
+ const pan = panRef.current;
258
331
  const body = timelineBodyRef.current;
259
- if (e.pointerType !== "mouse" || !body) {
332
+ if (!pan?.auto || !body) {
260
333
  return;
261
334
  }
262
- e.preventDefault();
263
- panRef.current = { x: e.clientX, y: e.clientY, left: body.scrollLeft, top: body.scrollTop };
264
- body.setPointerCapture?.(e.pointerId);
265
- body.style.cursor = "grabbing";
266
- document.body.style.userSelect = "none";
335
+ const speed = (d) => Math.sign(d) * Math.min(30, Math.max(0, Math.abs(d) - 8) / 4);
336
+ body.scrollLeft += speed(pan.left - pan.x);
337
+ body.scrollTop += speed(pan.top - pan.y);
338
+ pan.raf = requestAnimationFrame(autoScrollTick);
267
339
  }, []);
340
+ const handlePanStart = React.useCallback(
341
+ (e) => {
342
+ const body = timelineBodyRef.current;
343
+ if (e.pointerType !== "mouse" || !body || e.button && e.button !== 1) {
344
+ return;
345
+ }
346
+ e.preventDefault();
347
+ const auto = e.button === 1;
348
+ panRef.current = auto ? { x: e.clientX, y: e.clientY, left: e.clientX, top: e.clientY, auto, raf: null } : {
349
+ x: e.clientX,
350
+ y: e.clientY,
351
+ left: body.scrollLeft,
352
+ top: body.scrollTop,
353
+ auto,
354
+ raf: null
355
+ };
356
+ body.setPointerCapture?.(e.pointerId);
357
+ body.style.cursor = auto ? "all-scroll" : "grabbing";
358
+ document.body.style.userSelect = "none";
359
+ if (auto) {
360
+ panRef.current.raf = requestAnimationFrame(autoScrollTick);
361
+ }
362
+ },
363
+ [autoScrollTick]
364
+ );
268
365
  const handlePanMove = React.useCallback((e) => {
269
366
  const pan = panRef.current;
270
367
  const body = timelineBodyRef.current;
271
368
  if (!pan || !body) {
272
369
  return;
273
370
  }
371
+ if (pan.auto) {
372
+ pan.left = e.clientX;
373
+ pan.top = e.clientY;
374
+ return;
375
+ }
274
376
  body.scrollLeft = pan.left - (e.clientX - pan.x);
275
377
  body.scrollTop = pan.top - (e.clientY - pan.y);
276
378
  }, []);
277
379
  const handlePanEnd = React.useCallback(() => {
380
+ if (panRef.current?.raf !== null && panRef.current?.raf !== void 0) {
381
+ cancelAnimationFrame(panRef.current.raf);
382
+ }
278
383
  panRef.current = null;
279
384
  document.body.style.userSelect = "";
280
385
  if (timelineBodyRef.current) {
281
386
  timelineBodyRef.current.style.cursor = "";
282
387
  }
283
388
  }, []);
389
+ React.useEffect(() => handlePanEnd, [handlePanEnd]);
284
390
  const prevStartRef = React.useRef(bounds.start);
285
391
  React.useLayoutEffect(() => {
286
392
  const prev = prevStartRef.current;
@@ -304,8 +410,8 @@ const Gantt = core.factory((_props, ref) => {
304
410
  if (srcIndex === -1) {
305
411
  return null;
306
412
  }
307
- const src = rows[srcIndex];
308
- const x1 = utils.dateToPixel(src.startDate, bounds.start, effectiveColumnWidth) + utils.durationToPixels(src.duration, effectiveColumnWidth);
413
+ const src = { ...utils.getEffectiveTask(rows[srcIndex]), duration: rows[srcIndex].span };
414
+ const x1 = utils.barAnchors(src, bounds.start, effectiveColumnWidth, rowHeight).right;
309
415
  const y1 = srcIndex * rowHeight + rowHeight / 2;
310
416
  return { x1, y1, x2: active.linkCursor.x, y2: active.linkCursor.y };
311
417
  }, [active, rows, bounds.start, effectiveColumnWidth, rowHeight]);
@@ -317,13 +423,15 @@ const Gantt = core.factory((_props, ref) => {
317
423
  {
318
424
  rows: visibleRows,
319
425
  columns,
426
+ locale,
320
427
  getStyles,
321
428
  bodyRef: taskListBodyRef,
322
429
  onScroll: handleTaskListScroll,
323
430
  collapsedIds,
324
431
  onToggleExpand: toggleExpand,
325
432
  offsetTop: firstRow * rowHeight,
326
- contentHeight: rows.length * rowHeight
433
+ contentHeight: rows.length * rowHeight,
434
+ selectedTaskId
327
435
  }
328
436
  ), /* @__PURE__ */ React.createElement("div", { ...getStyles("timeline") }, /* @__PURE__ */ React.createElement("div", { ...getStyles("timelineHeader"), ref: timelineHeaderRef }, /* @__PURE__ */ React.createElement(
329
437
  TimelineHeader.TimelineHeader,
@@ -334,7 +442,9 @@ const Gantt = core.factory((_props, ref) => {
334
442
  getStyles,
335
443
  totalWidth: timelineWidth,
336
444
  viewMode,
337
- weekStart
445
+ weekStart,
446
+ locale,
447
+ isNonWorkingDay
338
448
  }
339
449
  )), /* @__PURE__ */ React.createElement(
340
450
  "div",
@@ -364,10 +474,30 @@ const Gantt = core.factory((_props, ref) => {
364
474
  rowHeight,
365
475
  getStyles,
366
476
  viewMode,
367
- weekStart
477
+ weekStart,
478
+ isNonWorkingDay
368
479
  }
369
480
  ),
370
481
  showTodayLine && /* @__PURE__ */ React.createElement("div", { ...getStyles("todayLine", { style: { left: todayPosition } }) }),
482
+ markers?.map((marker) => {
483
+ const date = dayjs(marker.date);
484
+ if (date.isBefore(bounds.start) || date.isAfter(displayEnd)) {
485
+ return null;
486
+ }
487
+ return /* @__PURE__ */ React.createElement(
488
+ "div",
489
+ {
490
+ key: `${marker.date}-${marker.color ?? ""}`,
491
+ ...getStyles("marker", {
492
+ style: {
493
+ left: utils.dateToPixel(date, bounds.start, effectiveColumnWidth),
494
+ ["--marker-color"]: core.getThemeColor(marker.color ?? "orange", theme)
495
+ }
496
+ })
497
+ },
498
+ marker.label != null && /* @__PURE__ */ React.createElement("span", { ...getStyles("markerLabel") }, marker.label)
499
+ );
500
+ }),
371
501
  visibleRows.map((row, i) => {
372
502
  const index = firstRow + i;
373
503
  const task = utils.getEffectiveTask(row);
@@ -376,18 +506,21 @@ const Gantt = core.factory((_props, ref) => {
376
506
  {
377
507
  key: task.id,
378
508
  ...getStyles("timelineRow"),
509
+ "data-first": index === Math.floor(scrollTop / rowHeight) || void 0,
379
510
  title: showTitle ? task.label : void 0,
380
511
  style: { top: index * rowHeight }
381
512
  },
382
513
  /* @__PURE__ */ React.createElement(
383
514
  TaskBar.TaskBar,
384
515
  {
385
- key: `taskbar-${task.id}`,
386
516
  task,
387
517
  startDate: bounds.start,
388
518
  columnWidth: effectiveColumnWidth,
389
519
  getStyles,
520
+ span: row.span,
521
+ isNonWorkingDay: calendar,
390
522
  isSummary: row.hasChildren,
523
+ isLocked: readOnly || task.locked,
391
524
  isDragging: active?.taskId === task.id && active.type !== "link",
392
525
  isLinkTarget: active?.type === "link" && active.dropTargetId === task.id,
393
526
  dragType: active?.taskId === task.id ? active.type : null,
@@ -395,9 +528,12 @@ const Gantt = core.factory((_props, ref) => {
395
528
  startDrag: drag.startDrag,
396
529
  didDrag: drag.didDrag,
397
530
  nudge: drag.nudge,
531
+ locale,
398
532
  onTaskClick: handleTaskClick,
399
533
  isCritical: criticalIds.has(task.id),
400
- showTooltip: showTitle
534
+ isSelected: task.id === selectedTaskId,
535
+ showTooltip: showTitle,
536
+ showDragLabel
401
537
  }
402
538
  ),
403
539
  showBaselines && task.baseline && /* @__PURE__ */ React.createElement(
@@ -411,7 +547,10 @@ const Gantt = core.factory((_props, ref) => {
411
547
  bounds.start,
412
548
  effectiveColumnWidth
413
549
  ),
414
- width: utils.durationToPixels(task.baseline.duration, effectiveColumnWidth)
550
+ width: utils.durationToPixels(
551
+ utils.getTaskSpan(task.baseline.startDate, task.baseline.duration, calendar),
552
+ effectiveColumnWidth
553
+ )
415
554
  }
416
555
  }
417
556
  )
@@ -432,7 +571,7 @@ const Gantt = core.factory((_props, ref) => {
432
571
  criticalIds,
433
572
  firstRow,
434
573
  lastRow,
435
- onLinkClick: handleLinkDelete
574
+ onLinkClick: readOnly ? void 0 : handleLinkDelete
436
575
  }
437
576
  )
438
577
  )