Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 33 additions & 13 deletions packages/plugin-gantt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,14 @@ When you embed the lower-level `<GanttView>` directly, pass `onTaskUpdate`
to opt in:

```tsx
<GanttView
import { GanttView } from '@object-ui/plugin-gantt';
import type { GanttTask } from '@object-ui/plugin-gantt';

// `tasks` is whatever you loaded; `save` stands in for your own write path.
declare const tasks: GanttTask[];
declare const save: (id: GanttTask['id'], changes: { start: Date; end: Date }) => void;

const editableChart = <GanttView
tasks={tasks}
onTaskUpdate={(task, { start, end }) => {
// `changes` is a Partial<Pick<GanttTask, 'title' | 'start' | 'end' | 'progress'>>:
Expand All @@ -86,7 +93,7 @@ to opt in:
if (!start || !end) return;
save(task.id, { start, end });
}}
/>
/>;
```

## Installation
Expand Down Expand Up @@ -212,14 +219,14 @@ that is present wins; if none is present there is no data config at all and the
chart renders empty:

```typescript
{
const recordSource = {
type: 'gantt',

// Pick ONE of the three:
objectName: 'project_tasks', // load through the host DataSource
// data: { provider: 'value', items: [ /* records */ ] }, // inline records
// staticData: [ /* records */ ], // shorthand for the above
}
};
```

`data` is the spec's `ViewData` union — `{ provider: 'object', object }`,
Expand All @@ -239,7 +246,7 @@ it here. Before that flip the flat branch returned first, so an authored `gantt`
block was discarded silently.

```typescript
{
const fieldMapping = {
type: 'gantt',
objectName: 'project_tasks',

Expand All @@ -257,7 +264,7 @@ block was discarded silently.

// (b) …or the same configuration as one block, which OUTRANKS (a):
// gantt: { startDateField: 'start_date', endDateField: 'end_date', … }
}
};
```

`viewMode` is real authoring surface (`ObjectGanttSchema`, derived from the
Expand Down Expand Up @@ -391,6 +398,8 @@ the label field is `title` (`src/GanttView.tsx`):

<!-- readme-exports: partial GanttTask — deliberate excerpt: `fields` and `hasOwnDates` are populated by ObjectGantt itself, as the paragraph below the block says -->
```typescript
import type { GanttDependency, GanttTaskType } from '@object-ui/plugin-gantt';

interface GanttTask {
id: string | number;
title: string;
Expand Down Expand Up @@ -486,18 +495,23 @@ When you render the component yourself, hand the callbacks in as React props:

```tsx
import { ObjectGantt } from '@object-ui/plugin-gantt';
import type { DataSource } from '@object-ui/types';

<ObjectGantt
// The adapter your host already talks to — see "Integration with Data
// Sources" below for where it comes from.
declare const dataSource: DataSource;

const interactiveChart = <ObjectGantt
schema={{
type: 'gantt',
type: 'object-gantt',
objectName: 'project_tasks',
startDateField: 'start_date',
endDateField: 'end_date',
titleField: 'name',
}}
dataSource={dataSource}
onTaskClick={(record) => console.log('Task clicked:', record)}
/>
/>;
```

To turn editing off from the metadata instead, set `readOnly: true` on the
Expand Down Expand Up @@ -633,13 +647,18 @@ Two more chrome features ship with it:
- **Custom markers** — vertical reference lines beyond the Today marker:

```tsx
<GanttView
import { GanttView } from '@object-ui/plugin-gantt';
import type { GanttTask } from '@object-ui/plugin-gantt';

declare const tasks: GanttTask[];

const chartWithMarkers = <GanttView
tasks={tasks}
markers={[
{ date: '2026-07-01', label: 'Code freeze', color: '#ef4444' },
{ date: '2026-07-15', label: 'Release' }, // defaults to the primary theme color
]}
/>
/>;
```

Through the schema, pass the same array as `markers` on the gantt node.
Expand Down Expand Up @@ -712,13 +731,14 @@ the object and the fields:
```tsx
import { createObjectStackAdapter } from '@object-ui/data-objectstack';
import { ObjectGantt } from '@object-ui/plugin-gantt';
import type { ObjectGanttSchema } from '@object-ui/types';

const dataSource = createObjectStackAdapter({
baseUrl: 'https://api.example.com',
token: 'your-auth-token'
});

const schema = {
const schema: ObjectGanttSchema = {
type: 'object-gantt',
objectName: 'tasks',
titleField: 'task_name',
Expand All @@ -727,7 +747,7 @@ const schema = {
progressField: 'progress_percent'
};

<ObjectGantt schema={schema} dataSource={dataSource} />
const ganttWithAdapter = <ObjectGantt schema={schema} dataSource={dataSource} />;
```

⚠️ A `dataSource` key **on the schema node** is a different thing with the same
Expand Down
2 changes: 0 additions & 2 deletions scripts/check-doc-snippet-types.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -733,8 +733,6 @@ const UNGATED_DOCS = {
'5 parse diagnostic(s) — blocks fenced `ts` that are bare object literals or elided bodies; 15 undefined-name diagnostic(s) — blocks continue an earlier block, or use ambient names the page never defines',
'packages/plugin-editor/README.md':
'6 parse diagnostic(s) — blocks fenced `ts` that are bare object literals or elided bodies',
'packages/plugin-gantt/README.md':
'9 parse diagnostic(s) — blocks fenced `ts` that are bare object literals or elided bodies; 12 undefined-name diagnostic(s) — blocks continue an earlier block, or use ambient names the page never defines',
'packages/plugin-kanban/README.md':
'6 parse diagnostic(s) — blocks fenced `ts` that are bare object literals or elided bodies',
'packages/plugin-list/README.md':
Expand Down
Loading