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
1 change: 0 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ src/
vite.config.js
tsconfig.json
eslint.config.js
AGENTS.md
CONTRIBUTING.md
86 changes: 45 additions & 41 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,50 @@
# AGENTS.md

Guidance for AI coding agents working in this repository.
Guidance for AI coding agents working with DHTMLX Gantt in this project.

## What this is

DHTMLX Gantt, MIT edition — an open source JavaScript Gantt chart library. The repository ships library sources, samples, and a smoke test suite. It is generated from an internal source tree on each release (see CONTRIBUTING.md), so structural refactors should stay minimal and focused.

## Layout

| Path | Content |
|---|---|
| `src/dhtmlxgantt.ts` | library entry point |
| `src/core/` | core: datastores, task data layer, UI (grid, timeline, lightbox), worktime |
| `src/core/plugins/` | always-on plugins (batch update, task types, formatters…) |
| `src/ext/` | opt-in extensions activated via `gantt.plugins({...})` (tooltip, quick_info, keyboard_navigation…) |
| `src/css/` | LESS styles, fonts, skins |
| `src/locale/` | locales |
| `samples/` | runnable demos; served by `npm run start`, and the corpus the smoke test loads |
| `scripts/` | build/dev/test node scripts, sample-data backend |
| `codebase/` | build output (generated; never edit by hand) |

## Commands

```bash
npm install
npm run build # vite build -> codebase/ + d.ts
npm run start # watch build + backend (:9200) + vite devserver
npm run test # build + smoke test: every sample loads without console errors
npm run test 07_grid # smoke just one samples folder
npm run lint # eslint over src/ (flat config, intentionally lax)
```

## Working on the code

- The build must stay green: `npm run build` after any `src/` change, and `npm run lint` should pass.
- `npm run test` is a smoke pass: it loads every sample headless and fails on a page error or `console.error`. It is the regression net — keep it green after `src/` changes.
- Sample pages reference `../../codebase/dhtmlxgantt.js` — run a build before opening them.
- `src/types.d.ts` declares the compile-time globals (`VERSION`, `LICENSE`, …) injected by vite `define`.
- Some modules are intentional basic implementations of Pro features (e.g. `src/core/ui/render/dummy_layer.js`, re-export shims like `src/core/ui/grid/resource_grid.js`, and `src/core/worktime/strategy/calendar_strategy.js` which re-exports the disabled `no_work_time` strategy — working-time calendars are out of scope). Do not "complete" them — the Pro feature set is out of scope for this edition (see README).

## Conventions

- Match the style of the file you edit (the codebase mixes older ES5-style JS and newer TS — both are fine in their places).
- Tabs for indentation.
- No new runtime dependencies — the library bundle must stay dependency-free.
DHTMLX Gantt, MIT edition (`dhtmlx-gantt` v10+) — an open source JavaScript Gantt chart library. Many Gantt examples online describe the PRO edition, so some APIs you know may be missing here (see Edition limits).

- Install, import and the first chart: [README.md](README.md), "Quick start".
- Changing the library source code: see `CONTRIBUTING.md` in the [GitHub repository](https://github.com/DHTMLX/gantt).

## Before you write code

Use these instead of working from memory:

- **DHTMLX MCP server** (`https://docs.dhtmlx.com/mcp`): current API and docs. Use it to confirm config, method and event names and signatures.
- Claude Code: `claude mcp add --transport http dhtmlx-mcp https://docs.dhtmlx.com/mcp`
- Codex: `codex mcp add dhtmlx-mcp --url https://docs.dhtmlx.com/mcp`
- Other clients: add the same URL as an HTTP MCP server.
- **Agent skill** `dhtmlx-js-gantt`: integration patterns and known pitfalls. Install: `npx skills add DHTMLX/skills --skill dhtmlx-js-gantt` ([source](https://github.com/DHTMLX/skills/tree/main/dhtmlx-js-gantt)).

If they are not installed, suggest that the user installs them. Without MCP, use the [docs](https://docs.dhtmlx.com/gantt/).

## Edition limits

Some features are kept out of this community build; the PRO edition has them. The list is in [README.md](README.md), "Community vs PRO".

- These APIs do not throw. They are missing or silent no-ops, so a chart that loads fine can still lack the feature. Enabling a plugin that is not in this build does nothing.
- `codebase/dhtmlxgantt.d.ts` describes the full product. Types and autocomplete do not prove a feature exists here.
- MCP and the docs cover PRO too. Check every feature you use against the list above.
- If a requested feature is not in this edition, tell the user before writing code: name the feature and say it is a PRO feature ([comparison](https://docs.dhtmlx.com/gantt/guides/editions-comparison/), [30-day trial](https://dhtmlx.com/docs/products/dhtmlxGantt/download.shtml)). Then still write the requested code. Do not silently replace or drop it.
- Check the edition at runtime with `gantt.license` (`"mit"` here).
- `ReactGantt`, `VueGantt` and `AngularGantt` are PRO components. For React, Angular and Vue, use the [integration guides](https://docs.dhtmlx.com/gantt/integrations/react/js-gantt-react/) with the core library.

## Rules that prevent common bugs

- Give the Gantt container an explicit height, and import `dhtmlx-gantt/codebase/dhtmlxgantt.css`.
- Set config and call `gantt.plugins({...})` before `gantt.init()`.
- Pass dates as `Date` objects or strings that match `gantt.config.date_format`. A mismatch shifts dates by years.
- Template return values are inserted as raw HTML. Escape user-supplied text before it reaches a template.
- For several charts, or a chart inside a component lifecycle, use `Gantt.getGanttInstance()` and call `destructor()` on that instance. Never call `destructor()` on the default `gantt` export, and never use `gantt.detachAllEvents()`.
- `gantt.init()` fires `onGanttReady` every time. Attach handlers and create the DataProcessor once, not inside a repeated `onGanttReady`.
- Apply changes that come from outside (a socket, another user) inside `gantt.silent(...)`, so the DataProcessor does not send them back.
- Use documented API only. Verify unfamiliar names and signatures with MCP.

## Links

- [Documentation](https://docs.dhtmlx.com/gantt/) and [API reference](https://docs.dhtmlx.com/gantt/api/)
- [Samples](https://docs.dhtmlx.com/gantt/samples/) (also in `samples/` of the repository)
- [Community forum](https://forum.dhtmlx.com/c/gantt)
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@AGENTS.md
41 changes: 37 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

Thank you for your interest in improving DHTMLX Gantt!

This file is for people who change the library code in this repository. If you only use the library in your own project, see [AGENTS.md](AGENTS.md) and [README.md](README.md).

## How this repository is maintained

This repository is **generated from an internal source tree** on every release. The content of each release replaces the previous content wholesale — pull requests cannot be merged here directly.
This repository is **generated from an internal source tree** on every release. The content of each release replaces the previous content wholesale — pull requests cannot be merged here directly. Because of this, structural refactors should stay minimal and focused.

That said, contributions are welcome and are handled like this:

Expand All @@ -24,15 +26,46 @@ Please include:

## Development

### Repository layout

| Path | Content |
|---|---|
| `src/dhtmlxgantt.ts` | library entry point |
| `src/core/` | core: datastores, task data layer, UI (grid, timeline, lightbox), worktime |
| `src/core/plugins/` | always-on plugins (batch update, task types, formatters…) |
| `src/ext/` | opt-in extensions activated via `gantt.plugins({...})` (tooltip, quick_info, keyboard_navigation…) |
| `src/css/` | LESS styles, fonts, skins |
| `src/locale/` | locales |
| `samples/` | runnable demos; served by `npm run start`, and the corpus the smoke test loads |
| `scripts/` | build/dev/test node scripts, sample-data backend |
| `codebase/` | build output (generated; never edit by hand) |

### Commands

```bash
npm install
npm run start # watch build + dev server with samples
npm run test # smoke test: every sample loads without console errors
npm run lint # eslint over src/
npm run build # vite build -> codebase/ + d.ts
npm run start # watch build + backend (:9200) + vite devserver
npm run test # build + smoke test: every sample loads without console errors
npm run test 07_grid # smoke just one samples folder
npm run lint # eslint over src/ (flat config, intentionally lax)
```

`npm run test` is a smoke pass: it builds the library, then loads every sample headless and fails on a page error or `console.error`. Run it before opening a PR — a red result means your change broke a sample.

### Working on the code

- The build must stay green: run `npm run build` after any `src/` change, and `npm run lint` should pass.
- Sample pages reference `../../codebase/dhtmlxgantt.js` — run a build before opening them.
- `src/types.d.ts` declares the compile-time globals (`VERSION`, `LICENSE`, …) injected by vite `define`.
- Some modules are intentional basic implementations of Pro features (e.g. `src/core/ui/render/dummy_layer.js`, re-export shims like `src/core/ui/grid/resource_grid.js`, and `src/core/worktime/strategy/calendar_strategy.js` which re-exports the disabled `no_work_time` strategy — working-time calendars are out of scope). Do not "complete" them — the Pro feature set is out of scope for this edition (see Scope below).

### Conventions

- Match the style of the file you edit (the codebase mixes older ES5-style JS and newer TS — both are fine in their places).
- Tabs for indentation.
- No new runtime dependencies — the library bundle must stay dependency-free.

## Scope

This edition intentionally excludes the Pro-only features (auto scheduling, critical path, resources, baselines, split tasks, and others) as well as some features kept out of this community build (markers, multiselect, undo/redo, unscheduled tasks, the new-task placeholder) — see README. PRs that re-implement out-of-scope features will be declined.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DHTMLX Gantt - JavaScript Gantt Chart (Community Edition)

[![npm: v.10.0.3](https://img.shields.io/badge/npm-v.10.0.3-blue.svg)](https://www.npmjs.com/package/dhtmlx-gantt) · [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.md) · [![made by DHTMLX](https://img.shields.io/badge/made%20by-DHTMLX-blue)](https://dhtmlx.com/)
[![npm: v.10.0.4](https://img.shields.io/badge/npm-v.10.0.4-blue.svg)](https://www.npmjs.com/package/dhtmlx-gantt) · [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.md) · [![made by DHTMLX](https://img.shields.io/badge/made%20by-DHTMLX-blue)](https://dhtmlx.com/)

![](dhtmlx_logo.svg)

Expand Down Expand Up @@ -206,7 +206,7 @@ The Community Edition covers the everyday Gantt feature set, **including project
- **Drag-and-drop scheduling** - move task bars to reschedule; resize bars to change duration
- **Progress indicators** - completion shown as a filled bar segment, editable in the lightbox
- **Lightbox task editor** - configurable modal dialog; add your own controls
- **Smart rendering** - only visible rows/columns are drawn, for large datasets
- **Large-dataset rendering** - row and timeline virtualization renders only visible tasks, links, and timeline cells to reduce rendering overhead
- **Multiple chart instances** - render several independent Gantts on one page via the `Gantt` factory
- **Templates** - override any rendered element (bars, grid cells, scale cells, tooltips)
- **Plugins** - tooltips, quick info, keyboard navigation, fullscreen, drag-timeline, click-drag
Expand All @@ -220,6 +220,8 @@ The Community Edition covers the everyday Gantt feature set, **including project

> **Note:** `codebase/dhtmlxgantt.d.ts` describes the full product API, so it lists some PRO-only methods that are not present in this edition.

**Performance at scale**: Explore [benchmarks with up to 100,000 tasks](https://dhtmlx.com/blog/javascript-gantt-performance-benchmark-handling-up-to-100000-tasks/) and [performance optimization tips](https://docs.dhtmlx.com/gantt/guides/performance/). The benchmarks cover both rendering and scheduling workloads, including PRO-only features.

---

## Community vs PRO
Expand Down Expand Up @@ -315,6 +317,8 @@ Building with an AI coding assistant (Claude Code, Cursor, Codex…)? Two free h
- [DHTMLX MCP Server](https://docs.dhtmlx.com/gantt/integrations/ai-tools/mcp-server/) - connects your assistant to up-to-date DHTMLX documentation and API reference.
- [Agent Skills](https://docs.dhtmlx.com/gantt/integrations/ai-tools/agent-skills/) - teach the assistant correct integration patterns and known pitfalls.

The package also ships [AGENTS.md](AGENTS.md) with rules for AI agents (edition limits, common pitfalls). Point your assistant to `node_modules/dhtmlx-gantt/AGENTS.md`.

## Useful links

- [Export services](https://dhtmlx.com/docs/products/dhtmlxGantt/export.shtml)
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gantt",
"version": "10.0.3",
"version": "10.0.4",
"homepage": "https://dhtmlx.com/docs/products/dhtmlxGantt/",
"description": "An open source JavaScript Gantt chart that helps you illustrate a project schedule in a nice-looking chart.",
"main": [
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dhtmlx-gantt",
"version": "10.0.3",
"version": "10.0.4",
"description": "DHTMLX Gantt - open source JavaScript Gantt chart (Community edition)",
"type": "module",
"main": "codebase/dhtmlxgantt.js",
Expand All @@ -11,7 +11,9 @@
"codebase",
"whatsnew.md",
"README.md",
"LICENSE.md"
"LICENSE.md",
"AGENTS.md",
"CLAUDE.md"
],
"scripts": {
"build": "vite build && node scripts/postbuild.js",
Expand Down
76 changes: 38 additions & 38 deletions samples/04_customization/05_tree_template.html
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
<!DOCTYPE html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Template for tree nodes</title>

<script src="../../codebase/dhtmlxgantt.js"></script>
<link rel="stylesheet" href="../../codebase/dhtmlxgantt.css">

<script src="../common/testdata.js"></script>
<style>
.important {
color: red;
}
html, body{
padding:0;
margin: 0;
}
</style>
</head>

<body>
<div id="gantt_here" style='height:100vh;'></div>


<script>
gantt.config.columns = [
{name: "text", label: "Task name", tree: true, resize: true, width: 230, template: function (task) {
if (task.priority == 1)
return "<div class='important'>" + task.text + " (" + task.users + ") </div>";
return task.text + " (" + task.users + ")";
}},
{name: "start_date", label: "Start time", resize: true, align: "center"},
{name: "duration", label: "Duration", align: "center"}
];
gantt.init("gantt_here");
gantt.parse(users_data);

</script>
<!DOCTYPE html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Template for tree nodes</title>
<script src="../../codebase/dhtmlxgantt.js"></script>
<link rel="stylesheet" href="../../codebase/dhtmlxgantt.css">
<script src="../common/testdata.js"></script>
<style>
.important {
color: red;
}
html, body{
padding:0;
margin: 0;
}
</style>
</head>
<body>
<div id="gantt_here" style='height:100vh;'></div>
<script>
gantt.config.columns = [
{name: "text", label: "Task name", tree: true, resize: true, width: 230, template: function (task) {
if (task.priority == 1)
return "<div class='important'>" + task.text + " (" + task.users + ") </div>";
return task.text + " (" + task.users + ")";
}},
{name: "start_date", label: "Start time", resize: true, align: "center"},
{name: "duration", label: "Duration", align: "center"}
];
gantt.init("gantt_here");
gantt.parse(users_data);
</script>
</body>
Loading
Loading