@art-tools/react-gantt 0.1.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.
- package/LICENSE +21 -0
- package/README.md +626 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1042 -0
- package/dist/index.d.ts +1042 -0
- package/dist/index.mjs +3288 -0
- package/dist/index.mjs.map +1 -0
- package/dist/style.css +2 -0
- package/dist/style.css.d.ts +15 -0
- package/package.json +96 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1042 @@
|
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
import { CSSProperties } from 'react';
|
|
3
|
+
import { default as default_2 } from 'react';
|
|
4
|
+
import { ElementType } from 'react';
|
|
5
|
+
import { JSX } from 'react/jsx-runtime';
|
|
6
|
+
import { ReactNode } from 'react';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Key of the built-in edit/add/delete column, dropped when `readOnly` is set.
|
|
10
|
+
*
|
|
11
|
+
* Exported so a consumer can extend the built-in set rather than replace it:
|
|
12
|
+
* `[...DEFAULT_COLUMNS.filter((c) => c.key !== ACTION_COLUMN_KEY), myColumn]`.
|
|
13
|
+
*/
|
|
14
|
+
export declare const ACTION_COLUMN_KEY = "__action";
|
|
15
|
+
|
|
16
|
+
declare interface BarA11yProps {
|
|
17
|
+
role: string;
|
|
18
|
+
"aria-colindex": number;
|
|
19
|
+
"aria-colspan": number;
|
|
20
|
+
"aria-label": string;
|
|
21
|
+
"aria-selected": boolean | undefined;
|
|
22
|
+
title: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** State passed to the function form of each BarProgress slotProps. */
|
|
26
|
+
export declare interface BarProgressOwnerState {
|
|
27
|
+
progress: number;
|
|
28
|
+
width: number;
|
|
29
|
+
height: number;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** State passed to the function form of the BarProgressResizeHandle slotProps. */
|
|
33
|
+
export declare interface BarProgressResizeHandleOwnerState {
|
|
34
|
+
width: number;
|
|
35
|
+
parentWidth: number;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export declare type BarProgressResizeHandleSlotConfig = SlotConfig<BarProgressResizeHandleSlots, BarProgressResizeHandleSlotProps>;
|
|
39
|
+
|
|
40
|
+
export declare interface BarProgressResizeHandleSlotProps {
|
|
41
|
+
root?: SlotPropsInput<ComponentProps<"div">, BarProgressResizeHandleOwnerState>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export declare interface BarProgressResizeHandleSlots {
|
|
45
|
+
/** The progress resize handle element. Default: `"div"`. */
|
|
46
|
+
root?: ElementType;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Slot config for the bar progress fill. */
|
|
50
|
+
export declare type BarProgressSlotConfig = SlotConfig<BarProgressSlots, BarProgressSlotProps>;
|
|
51
|
+
|
|
52
|
+
export declare interface BarProgressSlotProps {
|
|
53
|
+
root?: SlotPropsInput<ComponentProps<"div">, BarProgressOwnerState>;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export declare interface BarProgressSlots {
|
|
57
|
+
/** The progress fill element. Default: `"div"`. */
|
|
58
|
+
root?: ElementType;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Axis-aligned pixel bounds. */
|
|
62
|
+
export declare interface Bounds {
|
|
63
|
+
minX: number;
|
|
64
|
+
minY: number;
|
|
65
|
+
maxX: number;
|
|
66
|
+
maxY: number;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export declare function Calendar({ colWidth, rowHeight, scales, dates, colRange, }: CalendarProps): JSX.Element;
|
|
70
|
+
|
|
71
|
+
/** State passed to the function form of the CalendarRow `cell` slotProps (per group). */
|
|
72
|
+
export declare interface CalendarCellOwnerState {
|
|
73
|
+
scale: Scale;
|
|
74
|
+
/** Start date of the group this cell represents. */
|
|
75
|
+
date: Date;
|
|
76
|
+
/** Index of the group's first date column. */
|
|
77
|
+
startIndex: number;
|
|
78
|
+
/** Number of date columns the group spans. */
|
|
79
|
+
count: number;
|
|
80
|
+
/**
|
|
81
|
+
* Whether the calendar excludes this cell from working time. Prefer this over
|
|
82
|
+
* {@link CalendarCellOwnerState.isWeekend} — it also covers holidays.
|
|
83
|
+
*/
|
|
84
|
+
isNonWorking: boolean;
|
|
85
|
+
/** Why the cell is non-working, for styling weekends and holidays apart. */
|
|
86
|
+
nonWorkingReason?: NonWorkingReason;
|
|
87
|
+
/**
|
|
88
|
+
* @deprecated Use {@link CalendarCellOwnerState.isNonWorking}. Retained as an
|
|
89
|
+
* alias so existing slot code keeps working.
|
|
90
|
+
*/
|
|
91
|
+
isWeekend: boolean;
|
|
92
|
+
colWidth: number;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export declare type CalendarProps = {
|
|
96
|
+
colWidth: number;
|
|
97
|
+
rowHeight: number;
|
|
98
|
+
scales?: Scale[];
|
|
99
|
+
dates: Date[];
|
|
100
|
+
/** Half-open range of date indices in view (virtualization window). */
|
|
101
|
+
colRange: IndexRange;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
/** State passed to the function form of the CalendarRow `row` slotProps. */
|
|
105
|
+
export declare interface CalendarRowOwnerState {
|
|
106
|
+
scale: Scale;
|
|
107
|
+
colWidth: number;
|
|
108
|
+
rowHeight: number;
|
|
109
|
+
highlightWeekends: boolean;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Slot config for a calendar (header) row. Pass via the calendar's slot props.
|
|
114
|
+
*
|
|
115
|
+
* NOTE: pass a referentially stable / memoized object so downstream memoization
|
|
116
|
+
* is not defeated by a fresh object each render.
|
|
117
|
+
*/
|
|
118
|
+
export declare type CalendarRowSlotConfig = SlotConfig<CalendarRowSlots, CalendarRowSlotProps>;
|
|
119
|
+
|
|
120
|
+
export declare interface CalendarRowSlotProps {
|
|
121
|
+
row?: SlotPropsInput<ComponentProps<"div">, CalendarRowOwnerState>;
|
|
122
|
+
cell?: SlotPropsInput<ComponentProps<"div">, CalendarCellOwnerState>;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export declare interface CalendarRowSlots {
|
|
126
|
+
/** The row container. Default: `"div"`. */
|
|
127
|
+
row?: ElementType;
|
|
128
|
+
/** A per-group header cell. Default: `"div"`. */
|
|
129
|
+
cell?: ElementType;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export declare type CalendarUnit = "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
|
|
133
|
+
|
|
134
|
+
/** API passed as the 2nd arg to `ColumnDef.render`, for building actionable columns. */
|
|
135
|
+
export declare interface ColumnApi extends GanttHandle {
|
|
136
|
+
/** Fires the consumer's `onTaskEdit` callback for this task. */
|
|
137
|
+
editTask: (task: GanttTask) => void;
|
|
138
|
+
/**
|
|
139
|
+
* The chart's `readOnly` prop. The mutating members above still work (they are
|
|
140
|
+
* the imperative API — see ADR-021), so a column that renders edit/delete
|
|
141
|
+
* controls should check this and render nothing instead.
|
|
142
|
+
*/
|
|
143
|
+
readOnly: boolean;
|
|
144
|
+
/** Resolved accessible strings, for labelling controls a column renders.
|
|
145
|
+
* `ColumnDef.render` is a plain function, not a component, so it can't call
|
|
146
|
+
* `useGanttLabels()` — this is its channel to the `labels` prop. */
|
|
147
|
+
labels: ResolvedGanttLabels;
|
|
148
|
+
/**
|
|
149
|
+
* Display helpers that already know the chart's calendar and `durationUnit` —
|
|
150
|
+
* the same channel as `labels`, for the same reason.
|
|
151
|
+
*
|
|
152
|
+
* Stored dates are exclusive instants, which read wrong in a column: a task
|
|
153
|
+
* running Monday to Friday stores Saturday. Use these to show a user-facing
|
|
154
|
+
* end date or duration rather than formatting `task.endDate` directly.
|
|
155
|
+
*/
|
|
156
|
+
format: {
|
|
157
|
+
/** The inclusive last-occupied day, or `undefined` for an instant. */
|
|
158
|
+
endDate: (task: GanttTask) => Date | undefined;
|
|
159
|
+
/** Working time the task occupies, in the chart's `durationUnit`. */
|
|
160
|
+
duration: (task: GanttTask) => number;
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export declare interface ColumnDef<T extends GanttTask = GanttTask> {
|
|
165
|
+
key: string;
|
|
166
|
+
header: string;
|
|
167
|
+
width?: number;
|
|
168
|
+
render: (task: T, api: ColumnApi) => default_2.ReactNode;
|
|
169
|
+
isTreeColumn?: boolean;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
declare type ConnectorHandle = "start" | "end";
|
|
173
|
+
|
|
174
|
+
/** State passed to the function form of each ConnectorHandles slotProps. */
|
|
175
|
+
export declare interface ConnectorHandlesOwnerState {
|
|
176
|
+
taskId: Id;
|
|
177
|
+
barLeft: number;
|
|
178
|
+
barWidth: number;
|
|
179
|
+
barCenterY: number;
|
|
180
|
+
show: boolean;
|
|
181
|
+
isDragging: boolean;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export declare type ConnectorHandlesSlotConfig = SlotConfig<ConnectorHandlesSlots, ConnectorHandlesSlotProps>;
|
|
185
|
+
|
|
186
|
+
export declare interface ConnectorHandlesSlotProps {
|
|
187
|
+
startHandle?: SlotPropsInput<ComponentProps<"div">, ConnectorHandlesOwnerState>;
|
|
188
|
+
endHandle?: SlotPropsInput<ComponentProps<"div">, ConnectorHandlesOwnerState>;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export declare interface ConnectorHandlesSlots {
|
|
192
|
+
/** The left/start dependency-connector handle. Default: `"div"`. */
|
|
193
|
+
startHandle?: ElementType;
|
|
194
|
+
/** The right/end dependency-connector handle. Default: `"div"`. */
|
|
195
|
+
endHandle?: ElementType;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Working hours for a single day, or `false` for a day off. Gaps *between*
|
|
200
|
+
* ranges are non-working — that is how a lunch break is expressed:
|
|
201
|
+
* `["8:00-12:00", "13:00-17:00"]`.
|
|
202
|
+
*/
|
|
203
|
+
export declare type DayHours = WorkTimeRange[] | false;
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* The columns `<Gantt>` renders when no `columns` prop is given.
|
|
207
|
+
*
|
|
208
|
+
* Treat as immutable — it is module state shared by every chart on the page.
|
|
209
|
+
*/
|
|
210
|
+
export declare const DEFAULT_COLUMNS: ColumnDef[];
|
|
211
|
+
|
|
212
|
+
/** Index of the default (month / day) rung in {@link DEFAULT_ZOOM_LEVELS}. */
|
|
213
|
+
export declare const DEFAULT_ZOOM_INDEX = 3;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Default zoom ladder, ordered coarse → fine. Zooming in moves toward finer
|
|
217
|
+
* (higher-index) levels; each rung pairs a coarse header row with a finer
|
|
218
|
+
* bottom row whose unit is the column unit.
|
|
219
|
+
*/
|
|
220
|
+
export declare const DEFAULT_ZOOM_LEVELS: ZoomLevel[];
|
|
221
|
+
|
|
222
|
+
/** State passed to the `deleteButton` slotProps. */
|
|
223
|
+
export declare interface DependencyDeleteButtonOwnerState {
|
|
224
|
+
/** The dependency the button will delete when clicked. */
|
|
225
|
+
dependency: TaskDependency;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
declare interface DependencyDragState {
|
|
229
|
+
fromTaskId: Id;
|
|
230
|
+
handle: ConnectorHandle;
|
|
231
|
+
startX: number;
|
|
232
|
+
startY: number;
|
|
233
|
+
currentX: number;
|
|
234
|
+
currentY: number;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/** State passed to the `lagLabel` slotProps. */
|
|
238
|
+
export declare interface DependencyLagLabelOwnerState extends DependencyLinkOwnerState {
|
|
239
|
+
/** The lag value in days (non-zero when the label renders). */
|
|
240
|
+
lag: number;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export declare interface DependencyLink {
|
|
244
|
+
/** Stable key, e.g. `"1->2"`. */
|
|
245
|
+
id: string;
|
|
246
|
+
type: TaskDependencyType;
|
|
247
|
+
/** Orthogonal polyline from the source edge to the target edge. */
|
|
248
|
+
points: Point[];
|
|
249
|
+
/** Bounding box of {@link DependencyLink.points}, precomputed for culling. */
|
|
250
|
+
bounds: Bounds;
|
|
251
|
+
/** The original dependency for callbacks. */
|
|
252
|
+
dep: TaskDependency;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/** State shared by the per-link slots (`arrow`). */
|
|
256
|
+
export declare interface DependencyLinkOwnerState {
|
|
257
|
+
/** The dependency link being rendered. */
|
|
258
|
+
link: DependencyLink;
|
|
259
|
+
/** Whether this link is currently selected. */
|
|
260
|
+
isSelected: boolean;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/** State passed to the function form of the `layer` slotProps. */
|
|
264
|
+
export declare interface DependencyLinksLayerOwnerState {
|
|
265
|
+
width: number;
|
|
266
|
+
height: number;
|
|
267
|
+
/** Number of dependency links currently in the layer. */
|
|
268
|
+
linkCount: number;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/** Slot config for the dependency links layer. */
|
|
272
|
+
export declare type DependencyLinksSlotConfig = SlotConfig<DependencyLinksSlots, DependencyLinksSlotProps>;
|
|
273
|
+
|
|
274
|
+
export declare interface DependencyLinksSlotProps {
|
|
275
|
+
layer?: SlotPropsInput<ComponentProps<"div">, DependencyLinksLayerOwnerState>;
|
|
276
|
+
segment?: SlotPropsInput<ComponentProps<"div">, DependencySegmentOwnerState>;
|
|
277
|
+
arrow?: SlotPropsInput<ComponentProps<"div">, DependencyLinkOwnerState>;
|
|
278
|
+
lagLabel?: SlotPropsInput<ComponentProps<"div">, DependencyLagLabelOwnerState>;
|
|
279
|
+
deleteButton?: SlotPropsInput<ComponentProps<"button">, DependencyDeleteButtonOwnerState>;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export declare interface DependencyLinksSlots {
|
|
283
|
+
/** The absolutely-positioned links layer container. Default: `"div"`. */
|
|
284
|
+
layer?: ElementType;
|
|
285
|
+
/** A single visible link segment. Default: `"div"`. */
|
|
286
|
+
segment?: ElementType;
|
|
287
|
+
/** The arrowhead at the target end of a link. Default: `"div"`. */
|
|
288
|
+
arrow?: ElementType;
|
|
289
|
+
/** The `+Nd` / `-Nd` lag label. Default: `"div"`. */
|
|
290
|
+
lagLabel?: ElementType;
|
|
291
|
+
/** The `×` delete button shown for the selected link. Default: `"button"`. */
|
|
292
|
+
deleteButton?: ElementType;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/** State passed to the function form of the `root` slotProps. */
|
|
296
|
+
export declare interface DependencyPreviewOwnerState {
|
|
297
|
+
/** The in-progress dependency drag. */
|
|
298
|
+
drag: DependencyDragState;
|
|
299
|
+
/** Horizontal length of the rubber-band, in pixels. */
|
|
300
|
+
length: number;
|
|
301
|
+
/** Rotation of the rubber-band, in degrees. */
|
|
302
|
+
angle: number;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/** Slot config for the dependency drag preview. */
|
|
306
|
+
export declare type DependencyPreviewSlotConfig = SlotConfig<DependencyPreviewSlots, DependencyPreviewSlotProps>;
|
|
307
|
+
|
|
308
|
+
export declare interface DependencyPreviewSlotProps {
|
|
309
|
+
root?: SlotPropsInput<ComponentProps<"div">, DependencyPreviewOwnerState>;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
export declare interface DependencyPreviewSlots {
|
|
313
|
+
/** The rubber-band preview line. Default: `"div"`. */
|
|
314
|
+
root?: ElementType;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/** State passed to the `segment` slotProps, per visible segment of a link. */
|
|
318
|
+
export declare interface DependencySegmentOwnerState extends DependencyLinkOwnerState {
|
|
319
|
+
/** Start point of this segment. */
|
|
320
|
+
from: Point;
|
|
321
|
+
/** End point of this segment. */
|
|
322
|
+
to: Point;
|
|
323
|
+
/** Index of this segment within the link's polyline. */
|
|
324
|
+
index: number;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* The inclusive last-occupied civil day, for **display only**.
|
|
329
|
+
*
|
|
330
|
+
* Stored dates are exclusive instants, which reads wrong in a column: a task
|
|
331
|
+
* running Monday through Friday stores Saturday. This converts back for humans —
|
|
332
|
+
* the day containing the last worked moment. Never write the result back to a task.
|
|
333
|
+
*/
|
|
334
|
+
export declare function displayEndDate(startDate: Date, endInstant: Date): Date;
|
|
335
|
+
|
|
336
|
+
/** The unit an input `duration` is expressed in, and the unit it displays in. */
|
|
337
|
+
export declare type DurationUnit = "day" | "hour" | "minute";
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Inverse of {@link displayEndDate} for a whole-day edit: the exclusive instant
|
|
341
|
+
* starting the day after `displayEnd`.
|
|
342
|
+
*
|
|
343
|
+
* This is what a `<input type="date">` end-date editor needs — the user picks the
|
|
344
|
+
* last day they mean, and the task stores the following midnight.
|
|
345
|
+
*/
|
|
346
|
+
export declare function endInstantFromDisplayDate(displayEnd: Date): Date;
|
|
347
|
+
|
|
348
|
+
export declare function Gantt({ tasks, dependencies, rowHeight, colWidth, height, scales, padDays, zoomLevels, defaultZoomIndex, onZoomChange, zoomWheel, zoomKeyboard, onTaskClick, columns: columnsProp, defaultTaskListWidth, onDependencyCreate, onDependencyDelete, onTaskCreate, onTaskDelete, onTaskEdit, onTasksChange, calendar, snapToWorking, durationUnit, readOnly, apiRef, hideTaskList, taskList, bars, dependencySlots, timeline, labels, }: GanttProps): JSX.Element;
|
|
349
|
+
|
|
350
|
+
/** Slots for the timeline bars and their handles. Delivered via context. */
|
|
351
|
+
export declare interface GanttBarsSlots {
|
|
352
|
+
taskBar?: TaskBarSlotConfig;
|
|
353
|
+
projectBar?: ProjectBarSlotConfig;
|
|
354
|
+
milestoneBar?: MilestoneBarSlotConfig;
|
|
355
|
+
barProgress?: BarProgressSlotConfig;
|
|
356
|
+
barProgressResizeHandle?: BarProgressResizeHandleSlotConfig;
|
|
357
|
+
taskResizer?: TaskResizerSlotConfig;
|
|
358
|
+
connectorHandles?: ConnectorHandlesSlotConfig;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* The chart's working-time calendar. Three scopes resolve in the order
|
|
363
|
+
* `dates` → `days` → `hours`, so a specific date beats a weekday rule, which
|
|
364
|
+
* beats the global default.
|
|
365
|
+
*
|
|
366
|
+
* Passing a calendar at all is the opt-in: with no `calendar` prop the chart
|
|
367
|
+
* schedules in plain linear time exactly as it did before this feature existed.
|
|
368
|
+
*
|
|
369
|
+
* The object may be written inline — it is keyed by content, not identity, so a
|
|
370
|
+
* fresh-but-equal object on every render costs nothing.
|
|
371
|
+
*/
|
|
372
|
+
export declare interface GanttCalendar {
|
|
373
|
+
/**
|
|
374
|
+
* Working hours for every day with no override below. Omitted means the
|
|
375
|
+
* *full* day (`"0:00-24:00"`), so a calendar that only lists weekend days off
|
|
376
|
+
* stays day-granular rather than silently acquiring business hours.
|
|
377
|
+
*/
|
|
378
|
+
hours?: DayHours;
|
|
379
|
+
/** Per-weekday override. Beats {@link GanttCalendar.hours}. */
|
|
380
|
+
days?: Partial<Record<Weekday, DayHours>>;
|
|
381
|
+
/**
|
|
382
|
+
* Per-date override keyed by local civil date, `"YYYY-MM-DD"`. Beats both
|
|
383
|
+
* {@link GanttCalendar.days} and {@link GanttCalendar.hours}. Use it for
|
|
384
|
+
* holidays (`false`), half days, or a one-off working Saturday.
|
|
385
|
+
*/
|
|
386
|
+
dates?: Record<string, DayHours>;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/** Slots for dependency links. Delivered via context. */
|
|
390
|
+
export declare interface GanttDependenciesSlots {
|
|
391
|
+
links?: DependencyLinksSlotConfig;
|
|
392
|
+
preview?: DependencyPreviewSlotConfig;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* Everything the chart engine needs: data, callbacks, scheduling, zoom.
|
|
397
|
+
*
|
|
398
|
+
* Shared verbatim by `<Gantt>` and `<GanttProvider>` — `<Gantt>` destructures
|
|
399
|
+
* every one of these and forwards it untouched, then adds layout and slots of its
|
|
400
|
+
* own. Declared once so the two cannot drift apart, which they already had:
|
|
401
|
+
* `GanttProps.height` was required while the provider's was optional, with a doc
|
|
402
|
+
* on the required one saying "omit to grow with content".
|
|
403
|
+
*/
|
|
404
|
+
export declare interface GanttEngineProps {
|
|
405
|
+
tasks: GanttTask[];
|
|
406
|
+
rowHeight?: number;
|
|
407
|
+
colWidth?: number;
|
|
408
|
+
/** Total component height in px. When set, rows scroll vertically within it
|
|
409
|
+
* (calendar/header stay pinned); omit to grow with content. */
|
|
410
|
+
height?: number;
|
|
411
|
+
scales?: Scale[];
|
|
412
|
+
padDays?: number;
|
|
413
|
+
/** Custom zoom ladder (coarse → fine). Defaults to the built-in ladder; when
|
|
414
|
+
* omitted, `scales`/`colWidth` seed the default rung. */
|
|
415
|
+
zoomLevels?: ZoomLevel[];
|
|
416
|
+
/** Starting rung of the zoom ladder (default: the month/day level). */
|
|
417
|
+
defaultZoomIndex?: number;
|
|
418
|
+
/** Fired when the zoom level changes (and once on mount). */
|
|
419
|
+
onZoomChange?: (state: {
|
|
420
|
+
index: number;
|
|
421
|
+
count: number;
|
|
422
|
+
}) => void;
|
|
423
|
+
/** Enable Ctrl/Cmd + mouse-wheel zoom over the grid (anchors on the cursor). */
|
|
424
|
+
zoomWheel?: boolean;
|
|
425
|
+
/** Enable +/- keyboard zoom when the grid is focused. */
|
|
426
|
+
zoomKeyboard?: boolean;
|
|
427
|
+
onTaskClick?: (task: GanttTask) => void;
|
|
428
|
+
dependencies?: TaskDependency[];
|
|
429
|
+
onDependencyCreate?: (dep: TaskDependency) => void;
|
|
430
|
+
onDependencyDelete?: (dep: TaskDependency) => void;
|
|
431
|
+
onTaskCreate?: (task: GanttTask, afterId?: Id | null) => void;
|
|
432
|
+
onTaskDelete?: (id: Id) => void;
|
|
433
|
+
/** Fired when a column's edit action is invoked (e.g. the actions-column pencil button). */
|
|
434
|
+
onTaskEdit?: (task: GanttTask) => void;
|
|
435
|
+
/** Fired with the resolved task list whenever it changes (after create/delete/edit/undo/redo). */
|
|
436
|
+
onTasksChange?: (tasks: GanttTask[]) => void;
|
|
437
|
+
/**
|
|
438
|
+
* Working-time calendar. Supplying it is the opt-in: with no `calendar` the
|
|
439
|
+
* chart schedules in plain linear time exactly as before. Safe to write inline —
|
|
440
|
+
* it is keyed by content, not identity.
|
|
441
|
+
*/
|
|
442
|
+
calendar?: GanttCalendar;
|
|
443
|
+
/**
|
|
444
|
+
* Snap library-authored dates (drag commits, cascade results) onto working
|
|
445
|
+
* time. Defaults to `true` when a `calendar` is supplied; `false` keeps the
|
|
446
|
+
* non-working shading but leaves dates untouched.
|
|
447
|
+
*/
|
|
448
|
+
snapToWorking?: boolean;
|
|
449
|
+
/** How an input `duration` is interpreted and displayed. Defaults to `"day"`. */
|
|
450
|
+
durationUnit?: DurationUnit;
|
|
451
|
+
/**
|
|
452
|
+
* Remove every editing affordance: bars stop moving/resizing, the progress
|
|
453
|
+
* handle and dependency connectors disappear, links can no longer be selected
|
|
454
|
+
* or deleted, and the built-in actions column is dropped.
|
|
455
|
+
*
|
|
456
|
+
* Viewing is untouched — selection, expand/collapse, scroll and zoom all still
|
|
457
|
+
* work — and so is `apiRef`: `readOnly` is about the pointer, not the data (see
|
|
458
|
+
* ADR-021). Custom `columns` are yours to gate; read `api.readOnly` in `render`.
|
|
459
|
+
*/
|
|
460
|
+
readOnly?: boolean;
|
|
461
|
+
/** Receives the imperative API: `apiRef.current.createTask(...)`, `.undo()`, etc. */
|
|
462
|
+
apiRef?: default_2.Ref<GanttHandle>;
|
|
463
|
+
/**
|
|
464
|
+
* Overrides for the library's accessible strings (screen-reader names).
|
|
465
|
+
* Pass a referentially stable object — see `GanttLabels`.
|
|
466
|
+
*/
|
|
467
|
+
labels?: GanttLabels;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
export declare function GanttGrid({ slots: slotsProp, slotProps: slotPropsProp }?: GanttGridProps): JSX.Element | null;
|
|
471
|
+
|
|
472
|
+
export declare namespace GanttGrid {
|
|
473
|
+
var displayName: string;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
declare interface GanttGridProps {
|
|
477
|
+
slots?: GridSlots;
|
|
478
|
+
slotProps?: GridSlotProps;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
/** Imperative API exposed via `<Gantt apiRef={ref} />` for create/update/delete/undo/redo. */
|
|
482
|
+
export declare interface GanttHandle {
|
|
483
|
+
createTask: (task: GanttTask, afterId?: Id | null) => void;
|
|
484
|
+
updateTask: (id: Id, patch: TaskPatch) => void;
|
|
485
|
+
deleteTask: (id: Id) => void;
|
|
486
|
+
undo: () => void;
|
|
487
|
+
redo: () => void;
|
|
488
|
+
/**
|
|
489
|
+
* Bring a task into view. Vertical by default; pass `{ horizontal: true }` to
|
|
490
|
+
* also scroll the grid to the task's bar.
|
|
491
|
+
*
|
|
492
|
+
* Expands any collapsed ancestors first, so a task nested under a collapsed
|
|
493
|
+
* parent is revealed rather than silently ignored. Still a no-op for an id that
|
|
494
|
+
* is not in the chart at all.
|
|
495
|
+
*/
|
|
496
|
+
revealTask: (id: Id, options?: RevealOptions) => void;
|
|
497
|
+
/** Step the zoom ladder one level finer. No-op at the finest level. */
|
|
498
|
+
zoomIn: () => void;
|
|
499
|
+
/** Step the zoom ladder one level coarser. No-op at the coarsest level. */
|
|
500
|
+
zoomOut: () => void;
|
|
501
|
+
/** Jump to a zoom-ladder index (clamped to the ladder bounds). */
|
|
502
|
+
setZoom: (index: number) => void;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* Overrides for every accessible string the library emits. Pass any subset via
|
|
507
|
+
* `<Gantt labels={...} />`; omitted keys keep their English defaults (see
|
|
508
|
+
* `DEFAULT_LABELS` in `core/labels.ts`).
|
|
509
|
+
*
|
|
510
|
+
* NOTE: pass a referentially stable / memoized object — a fresh object each render
|
|
511
|
+
* invalidates the labels context and re-renders every row and bar.
|
|
512
|
+
*/
|
|
513
|
+
export declare interface GanttLabels {
|
|
514
|
+
/** Accessible name for the whole widget. Default: `"Gantt chart"`. */
|
|
515
|
+
gantt?: string;
|
|
516
|
+
/** Accessible name for the task-list treegrid. Default: `"Task list"`. */
|
|
517
|
+
taskList?: string;
|
|
518
|
+
/** Accessible name for the timeline grid. Default: `"Timeline"`. */
|
|
519
|
+
timeline?: string;
|
|
520
|
+
/** Expand toggle, collapsed state. Default: `"Expand"`. */
|
|
521
|
+
expand?: string;
|
|
522
|
+
/** Expand toggle, expanded state. Default: `"Collapse"`. */
|
|
523
|
+
collapse?: string;
|
|
524
|
+
/** The task-list / timeline splitter. Default: `"Resize task list"`. */
|
|
525
|
+
resizeTaskList?: string;
|
|
526
|
+
/** The dependency-link delete button. Default: `"Delete dependency"`. */
|
|
527
|
+
deleteDependency?: string;
|
|
528
|
+
/** Actions-column edit button. Default: `` `Edit ${task.name}` ``. */
|
|
529
|
+
editTask?: (task: GanttTask) => string;
|
|
530
|
+
/** Actions-column insert button. Default: `` `Add task after ${task.name}` ``. */
|
|
531
|
+
addTaskAfter?: (task: GanttTask) => string;
|
|
532
|
+
/** Actions-column delete button. Default: `` `Delete ${task.name}` ``. */
|
|
533
|
+
deleteTask?: (task: GanttTask) => string;
|
|
534
|
+
/**
|
|
535
|
+
* The single announcement for a timeline bar. The bar's inner subtree is
|
|
536
|
+
* `aria-hidden`, so this must carry everything the bar shows visually.
|
|
537
|
+
* Default: `"{name}, {type}, {start} to {end}, {progress}% complete"`.
|
|
538
|
+
*/
|
|
539
|
+
bar?: (task: GanttTask, state: {
|
|
540
|
+
progress: number;
|
|
541
|
+
}) => string;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
/** Props of the all-in-one `<Gantt>`: the engine plus layout and slots. */
|
|
545
|
+
export declare interface GanttProps extends GanttEngineProps {
|
|
546
|
+
columns?: ColumnDef[];
|
|
547
|
+
defaultTaskListWidth?: number;
|
|
548
|
+
hideTaskList?: boolean;
|
|
549
|
+
/**
|
|
550
|
+
* Slot overrides for the task-list pane (`treeCell`, `header`). Prop-drilled.
|
|
551
|
+
* Pass a referentially stable object — rows are memoized, so a fresh object each
|
|
552
|
+
* render re-renders every row.
|
|
553
|
+
*/
|
|
554
|
+
taskList?: GanttTaskListSlots;
|
|
555
|
+
/** Slot overrides for the timeline bars and their handles. */
|
|
556
|
+
bars?: GanttBarsSlots;
|
|
557
|
+
/** Slot overrides for dependency links (named `dependencySlots` to avoid
|
|
558
|
+
* colliding with the `dependencies` data prop above). */
|
|
559
|
+
dependencySlots?: GanttDependenciesSlots;
|
|
560
|
+
/** Slot overrides for the calendar/grid timeline chrome. */
|
|
561
|
+
timeline?: GanttTimelineSlots;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* The composition root: owns every piece of chart state and publishes it through
|
|
566
|
+
* the twelve contexts defined in `contexts.ts`.
|
|
567
|
+
*
|
|
568
|
+
* The provider nesting at the bottom is ordered stable-outermost, hottest-inside,
|
|
569
|
+
* mirroring the cadence table in `contexts.ts`. That order is not load-bearing
|
|
570
|
+
* today — no layer derives its value from another, and React resolves `useContext`
|
|
571
|
+
* to the nearest provider at any depth — but it documents the architecture, and it
|
|
572
|
+
* *becomes* load-bearing the moment a layer starts reading another context. Keep
|
|
573
|
+
* it.
|
|
574
|
+
*/
|
|
575
|
+
export declare function GanttProvider({ tasks, rowHeight, colWidth, height, scales, padDays, zoomLevels, defaultZoomIndex, onZoomChange, zoomWheel, zoomKeyboard, dependencies, onTaskClick, onDependencyCreate, onDependencyDelete, onTaskCreate: onTaskCreateProp, onTaskDelete, onTaskEdit, onTasksChange, apiRef, labels, calendar, snapToWorking, durationUnit, readOnly, children, }: GanttProviderProps): JSX.Element;
|
|
576
|
+
|
|
577
|
+
/** Props of the composable `<GanttProvider>`: the engine plus its subtree. */
|
|
578
|
+
export declare interface GanttProviderProps extends GanttEngineProps {
|
|
579
|
+
children: default_2.ReactNode;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
export declare function GanttSlotsProvider({ value, children, }: {
|
|
583
|
+
value: GanttSlotsValue;
|
|
584
|
+
children: ReactNode;
|
|
585
|
+
}): JSX.Element;
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* The grid-side slot groups delivered through context (bars/dependencies/
|
|
589
|
+
* timeline). The `taskList` group is prop-drilled separately and is NOT here.
|
|
590
|
+
*/
|
|
591
|
+
export declare interface GanttSlotsValue {
|
|
592
|
+
bars?: GanttBarsSlots;
|
|
593
|
+
dependencies?: GanttDependenciesSlots;
|
|
594
|
+
timeline?: GanttTimelineSlots;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
export declare interface GanttTask {
|
|
598
|
+
id: Id;
|
|
599
|
+
name: string;
|
|
600
|
+
startDate: Date;
|
|
601
|
+
endDate?: Date;
|
|
602
|
+
duration?: number;
|
|
603
|
+
progress?: number;
|
|
604
|
+
type?: GanttTaskType;
|
|
605
|
+
parentId?: Id | null;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
/** Slots for the task-list pane. Delivered by prop-drilling (see `<Gantt taskList>`). */
|
|
609
|
+
export declare interface GanttTaskListSlots {
|
|
610
|
+
treeCell?: TreeCellSlotConfig;
|
|
611
|
+
header?: TaskListHeaderSlotConfig;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
declare type GanttTaskType = "task" | "milestone" | "summary";
|
|
615
|
+
|
|
616
|
+
/** Slots for the calendar/grid timeline chrome. Delivered via context. */
|
|
617
|
+
export declare interface GanttTimelineSlots {
|
|
618
|
+
calendarRow?: CalendarRowSlotConfig;
|
|
619
|
+
gridColumn?: GridColumnsSlotConfig;
|
|
620
|
+
grid?: GridSlotConfig;
|
|
621
|
+
gridResizeHandle?: GridResizeHandleSlotConfig;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
/** State passed to the function form of the GridColumns `column` slotProps (per day). */
|
|
625
|
+
export declare interface GridColumnOwnerState {
|
|
626
|
+
/** The day this column paints. */
|
|
627
|
+
date: Date;
|
|
628
|
+
/** Absolute date-column index. */
|
|
629
|
+
index: number;
|
|
630
|
+
/**
|
|
631
|
+
* Whether the calendar excludes this column from working time. Prefer this over
|
|
632
|
+
* {@link GridColumnOwnerState.isWeekend} — it also covers holidays and, at hour
|
|
633
|
+
* scale, off-hours.
|
|
634
|
+
*/
|
|
635
|
+
isNonWorking: boolean;
|
|
636
|
+
/** Why the column is non-working, for styling weekends and holidays apart. */
|
|
637
|
+
nonWorkingReason?: NonWorkingReason;
|
|
638
|
+
/**
|
|
639
|
+
* @deprecated Use {@link GridColumnOwnerState.isNonWorking}. Retained as an
|
|
640
|
+
* alias so existing slot code keeps working; it is now true for any
|
|
641
|
+
* non-working column, not only Saturday and Sunday.
|
|
642
|
+
*/
|
|
643
|
+
isWeekend: boolean;
|
|
644
|
+
colWidth: number;
|
|
645
|
+
bodyHeight: number;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
/**
|
|
649
|
+
* Slot config for the grid background columns. Pass via the grid's slot props.
|
|
650
|
+
*
|
|
651
|
+
* NOTE: pass a referentially stable / memoized object so downstream memoization
|
|
652
|
+
* is not defeated by a fresh object each render.
|
|
653
|
+
*/
|
|
654
|
+
export declare type GridColumnsSlotConfig = SlotConfig<GridColumnsSlots, GridColumnsSlotProps>;
|
|
655
|
+
|
|
656
|
+
export declare interface GridColumnsSlotProps {
|
|
657
|
+
column?: SlotPropsInput<ComponentProps<"div">, GridColumnOwnerState>;
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
export declare interface GridColumnsSlots {
|
|
661
|
+
/** A per-day background column. Default: `"div"`. */
|
|
662
|
+
column?: ElementType;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
/** State passed to the function form of the Grid slotProps. */
|
|
666
|
+
export declare interface GridOwnerState {
|
|
667
|
+
/** Total content width in px (`dates.length * colWidth`). */
|
|
668
|
+
totalWidth: number;
|
|
669
|
+
/** Total body height in px (`visibleTasks.length * rowHeight`). */
|
|
670
|
+
bodyHeight: number;
|
|
671
|
+
/** Fixed grid-wrapper height when configured, else `undefined` (auto). */
|
|
672
|
+
height: number | undefined;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
/** State passed to the function form of the GridResizeHandle slotProps. */
|
|
676
|
+
export declare interface GridResizeHandleOwnerState {
|
|
677
|
+
/** Whether a resize drag is currently in progress. */
|
|
678
|
+
isResizing: boolean;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
export declare type GridResizeHandleSlotConfig = SlotConfig<GridResizeHandleSlots, GridResizeHandleSlotProps>;
|
|
682
|
+
|
|
683
|
+
export declare interface GridResizeHandleSlotProps {
|
|
684
|
+
root?: SlotPropsInput<ComponentProps<"div">, GridResizeHandleOwnerState>;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
export declare interface GridResizeHandleSlots {
|
|
688
|
+
/** The pane splitter element. Default: `"div"`. */
|
|
689
|
+
root?: ElementType;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
/**
|
|
693
|
+
* Slot config for the Gantt grid. Threaded from `<Gantt>` in a later pass.
|
|
694
|
+
*
|
|
695
|
+
* NOTE: pass a referentially stable / memoized object so downstream memoization
|
|
696
|
+
* is not defeated by a fresh object each render.
|
|
697
|
+
*/
|
|
698
|
+
export declare type GridSlotConfig = SlotConfig<GridSlots, GridSlotProps>;
|
|
699
|
+
|
|
700
|
+
export declare interface GridSlotProps {
|
|
701
|
+
root?: SlotPropsInput<ComponentProps<"div">, GridOwnerState>;
|
|
702
|
+
body?: SlotPropsInput<ComponentProps<"div">, GridOwnerState>;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
export declare interface GridSlots {
|
|
706
|
+
/** The scroll wrapper (`styles.gridWrapper`). Default: `"div"`. */
|
|
707
|
+
root?: ElementType;
|
|
708
|
+
/** The scrollable body layer (`styles.body`). Default: `"div"`. */
|
|
709
|
+
body?: ElementType;
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
export declare type Id = string | number;
|
|
713
|
+
|
|
714
|
+
export declare interface IndexRange {
|
|
715
|
+
/** First visible item index (inclusive). */
|
|
716
|
+
start: number;
|
|
717
|
+
/** One past the last visible item index (exclusive). */
|
|
718
|
+
end: number;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
/**
|
|
722
|
+
* Merge library-owned internal props with a consumer's `slotProps` for one slot.
|
|
723
|
+
*
|
|
724
|
+
* - `className`: `clsx(internal, external)` — both apply, the consumer's comes last.
|
|
725
|
+
* - `style`: shallow-merged, the consumer wins per key.
|
|
726
|
+
* - all other props: the consumer overrides the internal value (MUI semantics — e.g.
|
|
727
|
+
* passing `onClick` replaces the default handler; this is the consumer's
|
|
728
|
+
* responsibility to preserve behavior).
|
|
729
|
+
*/
|
|
730
|
+
export declare function mergeSlotProps<Props extends {
|
|
731
|
+
className?: string;
|
|
732
|
+
style?: CSSProperties;
|
|
733
|
+
}, OwnerState>(internalProps: Props, slotProps: SlotPropsInput<Props, OwnerState> | undefined, ownerState: OwnerState): Props;
|
|
734
|
+
|
|
735
|
+
export declare function MilestoneBar({ size, centerLeft, top, colWidth, title, a11y, onMove, onMoveEnd, slots: slotsProp, slotProps: slotPropsProp, }: MilestoneBarProps): JSX.Element;
|
|
736
|
+
|
|
737
|
+
export declare interface MilestoneBarOwnerState {
|
|
738
|
+
size: number;
|
|
739
|
+
title: string;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
declare interface MilestoneBarProps {
|
|
743
|
+
size: number;
|
|
744
|
+
centerLeft: number;
|
|
745
|
+
top: number;
|
|
746
|
+
colWidth: number;
|
|
747
|
+
title: string;
|
|
748
|
+
a11y?: BarA11yProps;
|
|
749
|
+
/** Editing handlers; omitted on a read-only chart (see `TaskBar`). */
|
|
750
|
+
onMove?: (newCenterLeft: number) => void;
|
|
751
|
+
onMoveEnd?: (newCenterLeft: number) => void;
|
|
752
|
+
slots?: MilestoneBarSlots;
|
|
753
|
+
slotProps?: MilestoneBarSlotProps;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
export declare type MilestoneBarSlotConfig = SlotConfig<MilestoneBarSlots, MilestoneBarSlotProps>;
|
|
757
|
+
|
|
758
|
+
export declare interface MilestoneBarSlotProps {
|
|
759
|
+
root?: SlotPropsInput<ComponentProps<"div">, MilestoneBarOwnerState>;
|
|
760
|
+
shape?: SlotPropsInput<ComponentProps<"div">, MilestoneBarOwnerState>;
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
export declare interface MilestoneBarSlots {
|
|
764
|
+
/** The draggable bar wrapper. Default: `DraggableBar`. */
|
|
765
|
+
root?: ElementType;
|
|
766
|
+
/** The diamond shape. Default: `"div"`. */
|
|
767
|
+
shape?: ElementType;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
/** Why a column is shaded. Weekend vs holiday matters only for styling. */
|
|
771
|
+
export declare type NonWorkingReason = "weekend" | "holiday" | "offHours";
|
|
772
|
+
|
|
773
|
+
export declare interface Point {
|
|
774
|
+
x: number;
|
|
775
|
+
y: number;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
export declare function ProjectBar({ width, height, left, top, colWidth, title, a11y, progress, onProgressChange, onProgressEnd, onMove, onMoveEnd, slots: slotsProp, slotProps: slotPropsProp, }: ProjectBarProps): JSX.Element;
|
|
779
|
+
|
|
780
|
+
/** State passed to the function form of each ProjectBar slotProps. */
|
|
781
|
+
export declare interface ProjectBarOwnerState {
|
|
782
|
+
width: number;
|
|
783
|
+
height: number;
|
|
784
|
+
progress: number;
|
|
785
|
+
title: string;
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
declare interface ProjectBarProps {
|
|
789
|
+
width: number;
|
|
790
|
+
height: number;
|
|
791
|
+
left: number;
|
|
792
|
+
top: number;
|
|
793
|
+
colWidth: number;
|
|
794
|
+
title: string;
|
|
795
|
+
a11y?: BarA11yProps;
|
|
796
|
+
progress: number;
|
|
797
|
+
/** Editing handlers; omitted on a read-only chart (see `TaskBar`). */
|
|
798
|
+
onProgressChange?: (newProgress: number) => void;
|
|
799
|
+
onProgressEnd?: (newProgress: number) => void;
|
|
800
|
+
onMove?: (newLeft: number) => void;
|
|
801
|
+
onMoveEnd?: (newLeft: number) => void;
|
|
802
|
+
slots?: ProjectBarSlots;
|
|
803
|
+
slotProps?: ProjectBarSlotProps;
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
/** Slot config for the project bar. */
|
|
807
|
+
export declare type ProjectBarSlotConfig = SlotConfig<ProjectBarSlots, ProjectBarSlotProps>;
|
|
808
|
+
|
|
809
|
+
export declare interface ProjectBarSlotProps {
|
|
810
|
+
root?: SlotPropsInput<ComponentProps<"div">, ProjectBarOwnerState>;
|
|
811
|
+
inner?: SlotPropsInput<ComponentProps<"div">, ProjectBarOwnerState>;
|
|
812
|
+
label?: SlotPropsInput<ComponentProps<"div">, ProjectBarOwnerState>;
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
export declare interface ProjectBarSlots {
|
|
816
|
+
/** The draggable bar wrapper. Default: `DraggableBar`. */
|
|
817
|
+
root?: ElementType;
|
|
818
|
+
/** The inner layout wrapper holding progress/label. Default: `"div"`. */
|
|
819
|
+
inner?: ElementType;
|
|
820
|
+
/** The title label. Default: `"div"`. */
|
|
821
|
+
label?: ElementType;
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
/** {@link DEFAULT_COLUMNS} without the actions column — the `readOnly` default. */
|
|
825
|
+
export declare const READ_ONLY_COLUMNS: ColumnDef[];
|
|
826
|
+
|
|
827
|
+
/** `GanttLabels` with every key filled in from the defaults. */
|
|
828
|
+
export declare type ResolvedGanttLabels = Required<GanttLabels>;
|
|
829
|
+
|
|
830
|
+
/** Which axes to reveal on. Defaults match the historical `scrollToTask(id)`. */
|
|
831
|
+
export declare interface RevealOptions {
|
|
832
|
+
/** Reveal the task's row vertically, in whichever pane is mounted. Default `true`. */
|
|
833
|
+
vertical?: boolean;
|
|
834
|
+
/** Reveal the task's bar horizontally in the grid. Default `false`. */
|
|
835
|
+
horizontal?: boolean;
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
export declare type Scale = {
|
|
839
|
+
unit: CalendarUnit;
|
|
840
|
+
step: number;
|
|
841
|
+
format: (date: Date) => string;
|
|
842
|
+
ariaFormat?: (date: Date) => string;
|
|
843
|
+
};
|
|
844
|
+
|
|
845
|
+
/** Convenience shape for a component's public `{ slots, slotProps }` config prop. */
|
|
846
|
+
export declare interface SlotConfig<Slots, SlotProps> {
|
|
847
|
+
slots?: Slots;
|
|
848
|
+
slotProps?: SlotProps;
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
/**
|
|
852
|
+
* A consumer-supplied `slotProps` value for a single slot: either a props object,
|
|
853
|
+
* or a function of the component's `ownerState` returning props.
|
|
854
|
+
*
|
|
855
|
+
* `P` is the target element's prop type. Per-slot we pass the native element props
|
|
856
|
+
* (e.g. `ComponentProps<"button">`) so consumers get `className` / `onClick` / aria /
|
|
857
|
+
* `data-*` autocomplete. If a consumer replaces the element with a custom component
|
|
858
|
+
* via `slots`, the props stay loosely typed against the native shape (MUI's default).
|
|
859
|
+
*/
|
|
860
|
+
export declare type SlotPropsInput<P, OwnerState> = Partial<P> | ((ownerState: OwnerState) => Partial<P>);
|
|
861
|
+
|
|
862
|
+
export declare function TaskBar({ width, height, left, top, colWidth, title, a11y, progress, onProgressChange, onProgressEnd, onResize, onResizeEnd, onMove, onMoveEnd, slots: slotsProp, slotProps: slotPropsProp, }: TaskBarProps): JSX.Element;
|
|
863
|
+
|
|
864
|
+
/** State passed to the function form of each TaskBar slotProps. */
|
|
865
|
+
export declare interface TaskBarOwnerState {
|
|
866
|
+
width: number;
|
|
867
|
+
height: number;
|
|
868
|
+
progress: number;
|
|
869
|
+
title: string;
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
declare interface TaskBarProps {
|
|
873
|
+
width: number;
|
|
874
|
+
height: number;
|
|
875
|
+
left: number;
|
|
876
|
+
top: number;
|
|
877
|
+
colWidth: number;
|
|
878
|
+
title: string;
|
|
879
|
+
a11y?: BarA11yProps;
|
|
880
|
+
progress: number;
|
|
881
|
+
/**
|
|
882
|
+
* Editing handlers. All optional: a read-only chart omits them, and each
|
|
883
|
+
* affordance is only rendered/wired when its handlers are present.
|
|
884
|
+
*/
|
|
885
|
+
onProgressChange?: (newProgress: number) => void;
|
|
886
|
+
onProgressEnd?: (newProgress: number) => void;
|
|
887
|
+
onResize?: (newWidth: number, newLeft: number) => void;
|
|
888
|
+
onResizeEnd?: (edge: "start" | "end", edgePx: number) => void;
|
|
889
|
+
onMove?: (newLeft: number) => void;
|
|
890
|
+
onMoveEnd?: (newLeft: number) => void;
|
|
891
|
+
slots?: TaskBarSlots;
|
|
892
|
+
slotProps?: TaskBarSlotProps;
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
/** Slot config for the task bar. */
|
|
896
|
+
export declare type TaskBarSlotConfig = SlotConfig<TaskBarSlots, TaskBarSlotProps>;
|
|
897
|
+
|
|
898
|
+
export declare interface TaskBarSlotProps {
|
|
899
|
+
root?: SlotPropsInput<ComponentProps<"div">, TaskBarOwnerState>;
|
|
900
|
+
inner?: SlotPropsInput<ComponentProps<"div">, TaskBarOwnerState>;
|
|
901
|
+
label?: SlotPropsInput<ComponentProps<"div">, TaskBarOwnerState>;
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
export declare interface TaskBarSlots {
|
|
905
|
+
/** The draggable bar wrapper. Default: `DraggableBar`. */
|
|
906
|
+
root?: ElementType;
|
|
907
|
+
/** The inner layout wrapper holding progress/label/resizer. Default: `"div"`. */
|
|
908
|
+
inner?: ElementType;
|
|
909
|
+
/** The title label. Default: `"div"`. */
|
|
910
|
+
label?: ElementType;
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
export declare type TaskDependency = {
|
|
914
|
+
from: Id;
|
|
915
|
+
to: Id;
|
|
916
|
+
type: TaskDependencyType;
|
|
917
|
+
lag?: number;
|
|
918
|
+
};
|
|
919
|
+
|
|
920
|
+
export declare type TaskDependencyType = "FS" | "FF" | "SS" | "SF";
|
|
921
|
+
|
|
922
|
+
export declare function TaskList({ columns, taskList }: TaskListProps): JSX.Element;
|
|
923
|
+
|
|
924
|
+
/** State passed to the function form of the per-column slotProps. */
|
|
925
|
+
export declare interface TaskListHeaderCellOwnerState {
|
|
926
|
+
column: ColumnDef;
|
|
927
|
+
index: number;
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
/** State passed to the function form of the header (container) slotProps. */
|
|
931
|
+
export declare interface TaskListHeaderOwnerState {
|
|
932
|
+
columns: ColumnDef[];
|
|
933
|
+
headerHeight: number;
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
export declare type TaskListHeaderSlotConfig = SlotConfig<TaskListHeaderSlots, TaskListHeaderSlotProps>;
|
|
937
|
+
|
|
938
|
+
export declare interface TaskListHeaderSlotProps {
|
|
939
|
+
header?: SlotPropsInput<ComponentProps<"div">, TaskListHeaderOwnerState>;
|
|
940
|
+
headerCell?: SlotPropsInput<ComponentProps<"div">, TaskListHeaderCellOwnerState>;
|
|
941
|
+
columnResizeHandle?: SlotPropsInput<ComponentProps<"div">, TaskListHeaderCellOwnerState>;
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
export declare interface TaskListHeaderSlots {
|
|
945
|
+
/** The header row container. Default: `"div"`. */
|
|
946
|
+
header?: ElementType;
|
|
947
|
+
/** A per-column header cell. Default: `"div"`. */
|
|
948
|
+
headerCell?: ElementType;
|
|
949
|
+
/** The per-column resize handle (divider). Default: `"div"`. */
|
|
950
|
+
columnResizeHandle?: ElementType;
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
declare interface TaskListProps {
|
|
954
|
+
columns?: ColumnDef[];
|
|
955
|
+
/** Slot overrides for the task-list pane (`treeCell`, `header`). Pass a stable object. */
|
|
956
|
+
taskList?: GanttTaskListSlots;
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
/** Patch passed to the imperative `updateTask`; only the provided fields change. */
|
|
960
|
+
export declare interface TaskPatch {
|
|
961
|
+
name?: string;
|
|
962
|
+
startDate?: Date;
|
|
963
|
+
endDate?: Date;
|
|
964
|
+
progress?: number;
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
/** State passed to the function form of each TaskResizer slotProps. */
|
|
968
|
+
export declare interface TaskResizerOwnerState {
|
|
969
|
+
width: number;
|
|
970
|
+
left: number;
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
export declare type TaskResizerSlotConfig = SlotConfig<TaskResizerSlots, TaskResizerSlotProps>;
|
|
974
|
+
|
|
975
|
+
export declare interface TaskResizerSlotProps {
|
|
976
|
+
startHandle?: SlotPropsInput<ComponentProps<"button">, TaskResizerOwnerState>;
|
|
977
|
+
endHandle?: SlotPropsInput<ComponentProps<"button">, TaskResizerOwnerState>;
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
export declare interface TaskResizerSlots {
|
|
981
|
+
/** The left/start resize button. Default: `"button"`. */
|
|
982
|
+
startHandle?: ElementType;
|
|
983
|
+
/** The right/end resize button. Default: `"button"`. */
|
|
984
|
+
endHandle?: ElementType;
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
/** State passed to the function form of each TreeCell slotProps. */
|
|
988
|
+
export declare interface TreeCellOwnerState {
|
|
989
|
+
taskId: Id;
|
|
990
|
+
depth: number;
|
|
991
|
+
isParent: boolean;
|
|
992
|
+
isExpanded: boolean;
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
/**
|
|
996
|
+
* Slot config for the tree cell. Pass via `<Gantt treeCell={...} />`.
|
|
997
|
+
*
|
|
998
|
+
* NOTE: pass a referentially stable / memoized object — `TaskListRow` is memoized,
|
|
999
|
+
* so a fresh object each render defeats its memo and re-renders every row.
|
|
1000
|
+
*/
|
|
1001
|
+
export declare type TreeCellSlotConfig = SlotConfig<TreeCellSlots, TreeCellSlotProps>;
|
|
1002
|
+
|
|
1003
|
+
export declare interface TreeCellSlotProps {
|
|
1004
|
+
root?: SlotPropsInput<ComponentProps<"span">, TreeCellOwnerState>;
|
|
1005
|
+
expandButton?: SlotPropsInput<ComponentProps<"button">, TreeCellOwnerState>;
|
|
1006
|
+
placeholder?: SlotPropsInput<ComponentProps<"span">, TreeCellOwnerState>;
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
export declare interface TreeCellSlots {
|
|
1010
|
+
/** The `nameContent` wrapper. Default: `"span"`. */
|
|
1011
|
+
root?: ElementType;
|
|
1012
|
+
/** The ▾/▸ expand/collapse toggle. Default: `"button"`. */
|
|
1013
|
+
expandButton?: ElementType;
|
|
1014
|
+
/** The spacer rendered for leaf (non-parent) rows. Default: `"span"`. */
|
|
1015
|
+
placeholder?: ElementType;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
export declare function useGanttReadOnly(): boolean;
|
|
1019
|
+
|
|
1020
|
+
/** Read the grid-side slot groups. Returns `{}` outside a provider. */
|
|
1021
|
+
export declare function useGanttSlots(): GanttSlotsValue;
|
|
1022
|
+
|
|
1023
|
+
/** `0` = Sunday … `6` = Saturday, matching `Date.prototype.getDay`. */
|
|
1024
|
+
export declare type Weekday = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* A span of working hours within one day, `"H:MM-H:MM"` in local civil time with
|
|
1028
|
+
* minute precision — e.g. `"8:30-12:00"`. Half-open: the end minute is the first
|
|
1029
|
+
* non-working minute. `"24:00"` is legal only as an end.
|
|
1030
|
+
*/
|
|
1031
|
+
export declare type WorkTimeRange = string;
|
|
1032
|
+
|
|
1033
|
+
/**
|
|
1034
|
+
* One rung of the zoom ladder: the calendar `scales` to render and the pixel
|
|
1035
|
+
* width of a single (finest-unit) column. Zooming steps between levels.
|
|
1036
|
+
*/
|
|
1037
|
+
export declare interface ZoomLevel {
|
|
1038
|
+
scales: Scale[];
|
|
1039
|
+
colWidth: number;
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
export { }
|