You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -69,7 +69,7 @@ Use it as a reference after [Overview](integrations/vue/overview.md) or [Quick S
69
69
<tr>
70
70
<td>plugins</td>
71
71
<td>GanttPlugins</td>
72
-
<td>Plugin activation map (for example <code>auto_scheduling</code>).</td>
72
+
<td><a href="/guides/extensions-list/">Gantt extensions</a> to activate (for example <a href="/guides/auto-scheduling/"><code>auto_scheduling</code></a>, <a href="/guides/critical-path/"><code>critical_path</code></a>).</td>
73
73
</tr>
74
74
<tr>
75
75
<td>templates</td>
@@ -203,6 +203,21 @@ const events = {
203
203
};
204
204
~~~
205
205
206
+
The map is typed as `VueGanttEvents`. The wrapper declares the following known events with full type signatures; any other Gantt event name is also accepted (custom events are typed as string-keyed handlers).
207
+
208
+
| Event | Signature | Notes |
209
+
|-------|-----------|-------|
210
+
|`onBeforeLightbox`|`(taskId: string \| number) => boolean \| void`| Return `false` to suppress the built-in lightbox (for example to route to an external editor). |
|`onAfterTaskAdd`|`(id: string \| number, task: Task) => void`| Fires after a task is added. |
213
+
|`onAfterTaskUpdate`|`(id: string \| number, task: Task) => void`| Fires after a task is updated. |
214
+
|`onAfterTaskDelete`|`(id: string \| number, task: Task) => void`| Fires after a task is deleted. |
215
+
|`onAfterLinkAdd`|`(id: string \| number, link: Link) => void`| Fires after a dependency link is added. |
216
+
|`onAfterLinkUpdate`|`(id: string \| number, link: Link) => void`| Fires after a dependency link is updated. |
217
+
|`onAfterLinkDelete`|`(id: string \| number, link: Link) => void`| Fires after a dependency link is deleted. |
218
+
219
+
For the full Gantt event list (including events not enumerated above), see the [Gantt events overview](api/overview/events-overview.md). Use `defineGanttEvents(...)` to author the map with autocomplete on these known events.
220
+
206
221
### `@ready`
207
222
208
223
`ready(instance)` fires once after initialization and the first sync:
@@ -278,10 +293,6 @@ Replace the built-in task form UI with a Vue component.
278
293
279
294
Map Gantt inline editor type names to Vue components.
280
295
281
-
### `templateWrapper`
282
-
283
-
Wrap VNodes produced by the wrapper template bridge.
284
-
285
296
### `modals`
286
297
287
298
Override delete confirmations and call `callback()` to confirm deletion.
@@ -326,10 +337,39 @@ From `@dhtmlx/trial-vue-gantt` or `@dhx/vue-gantt`:
326
337
327
338
### Type Exports
328
339
340
+
Import every type from the wrapper package itself (`@dhx/vue-gantt` or `@dhtmlx/trial-vue-gantt`). The wrapper bundles the underlying Gantt engine and re-exports its types alongside the Vue-specific ones - there is no separate `@dhx/gantt` package to install or import from.
341
+
342
+
**Wrapper-owned types**
343
+
329
344
| Export | Description |
330
345
|--------|------------|
331
-
|`SerializedTask`| User-facing task shape with `Date \| string` dates. Use for store state, initial data, and `batchSave` payloads. |
346
+
|`SerializedTask`| User-facing task shape with `Date \| string` dates. Use for store state, initial data, and `save`/`batchSave` payloads. |
332
347
|`SerializedLink`| User-facing link shape. Use alongside `SerializedTask` in store state and data definitions. |
348
+
|`VueGanttRef`| Type of the value exposed via component ref - `{ instance: GanttStatic \| null }`. |
349
+
|`VueGanttDataConfig`| Shape of the `data` prop (`load`, `save`, `batchSave`). |
350
+
|`BatchChanges`| Argument passed to `data.batchSave` - grouped `tasks`/`links`/`resources`/`resourceAssignments` changes. |
351
+
|`DataCallbackChange`| Individual change entry inside a `BatchChanges` bucket - `{ entity, action, data, id }`. |
352
+
|`Marker`| Shape of items in the `markers` prop. |
353
+
|`WrapperCalendar`| Wrapper-friendly calendar shape accepted by the `calendars` prop (alongside raw `CalendarConfig`). |
354
+
|`GanttModals`| Shape of the `modals` prop - `onBeforeTaskDelete` and `onBeforeLinkDelete` callback signatures. |
355
+
|`CustomLightboxProps`| Props received by your `customLightbox` component (`data`, `onSave`, `onCancel`, `onDelete`, `ganttInstance`). |
356
+
|`InlineEditorComponentProps`| Props received by your inline editor components (`initialValue`, `task`, `save`, `cancel`, `ganttInstance`). |
357
+
|`VueGanttEvents`| Type of the `events` prop - known events plus string-keyed custom events. |
358
+
359
+
**Frequently used types from the Gantt engine**
360
+
361
+
The wrapper re-exports every type from the underlying Gantt engine. The ones below come up most often in wrapper code - each row maps a core type to where it shows up in the Vue API.
362
+
363
+
| Export | Where it appears in wrapper code |
364
+
|--------|------------|
365
+
|`Task`, `Link`| Runtime task/link shapes (include `$`-prefixed properties). Used inside event handlers, template callbacks, and filter functions. |
366
+
|`GanttStatic`| Type of `ganttRef.value?.instance` and the `@ready` argument. |
367
+
|`GanttConfigOptions`| Shape of the object passed to the `config` prop. |
368
+
|`GanttTemplates`| Shape of the object passed to the `templates` prop. |
369
+
|`GanttPlugins`| Shape of the object passed to the `plugins` prop. |
370
+
|`CalendarConfig`| Raw Gantt calendar shape - alternative to `WrapperCalendar` in the `calendars` prop. |
371
+
372
+
Every other type from the Gantt engine is also exported from the wrapper - if you can import a name from `@dhx/gantt` in the standalone library, you can import it from `@dhx/vue-gantt` here.
333
373
334
374
Use `SerializedTask` and `SerializedLink` for data you own (Pinia state, `ref<>`, API responses, initial literals). Use `Task` and `Link` for data gantt owns (inside event handlers, template callbacks, filter functions), where runtime task objects include internal `$`-prefixed properties.
335
375
@@ -340,13 +380,42 @@ Use `SerializedTask` and `SerializedLink` for data you own (Pinia state, `ref<>`
340
380
-`defineGanttEvents(events)` for typed event map authoring
341
381
-`defineInlineEditors(inlineEditors)` for typed inline editor maps
342
382
383
+
These are **TypeScript-only identity helpers** - at runtime, `defineGanttTemplates(x)` returns `x` unchanged. You can skip them entirely without any behavior change. Their value is **type preservation on object literals**: you get autocomplete on `templates.task_text`, `config.scales[0].unit`, `events.onAfterTaskAdd`, etc., without manually annotating the variable.
384
+
385
+
If you skip them in TypeScript, either annotate the variable yourself or pass the literal inline on the prop:
386
+
387
+
~~~ts
388
+
// Option 1: explicit type annotation
389
+
const templates:Partial<GanttTemplates> = {
390
+
task_text: (_s, _e, task) =>task.text
391
+
};
392
+
393
+
// Option 2: helper for autocomplete on the literal
394
+
const templates =defineGanttTemplates({
395
+
task_text: (_s, _e, task) =>task.text
396
+
});
397
+
398
+
// Option 3: inline literal - inference works through the prop type
-`useWorkTime(ganttRef)` for work-time checks and date calculations
346
-
-`useResourceAssignments(ganttRef)` for task-resource/assignment reads
347
-
-`useGanttDatastore(ganttRef, storeName)` for raw datastore access
348
-
-`useGanttActions(ganttRef)` for wrapper-safe imperative actions (undo/redo/export/render)
349
-
-`useGanttEvent(ganttRef, eventName, handler)` for lifecycle-safe attach/detach of a single event
404
+
The wrapper exposes five composables that wrap common instance-side calls in a ref-aware, lifecycle-safe form. Each one takes a `Ref<VueGanttRef | null>` so it can wait for the instance to become available.
Attaches a single Gantt event with a lifecycle-safe lifetime. The handler is detached automatically on component unmount and re-attached if `ganttRef`, `eventName`, or `handler` change. Returns `{ detach }` for manual control.
Use this when one-off listeners do not fit cleanly into the `events` map (for example listeners that need to update or unsubscribe based on local state).
0 commit comments