iris-gantt 1.0.5 → 1.0.7

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/README.md CHANGED
@@ -1,83 +1,57 @@
1
- # iris-gantt
1
+ # Iris Gantt
2
2
 
3
- A comprehensive, production-ready Gantt chart component for React with TypeScript support.
3
+ A comprehensive, production-ready Gantt chart component built with React and TypeScript. Easy to install, simple to use, fully customizable, and responsive.
4
4
 
5
- [![npm version](https://img.shields.io/npm/v/iris-gantt)](https://www.npmjs.com/package/iris-gantt)
6
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
-
8
- ## 🚀 Quick Start
9
-
10
- ### 1. Install
11
-
12
- ```bash
13
- npm install iris-gantt
14
- ```
15
-
16
- ### 2. Install Peer Dependencies
17
-
18
- ```bash
19
- npm install react react-dom antd@^5.29.3 dayjs @fortawesome/react-fontawesome@^3.1.0 @fortawesome/fontawesome-svg-core@^7.1.0 @fortawesome/free-solid-svg-icons@^7.1.0
20
- ```
21
-
22
- ### 3. Use in Your Component
23
-
24
- **Important:** Don't forget to import the CSS!
25
-
26
- ```tsx
27
- // Option 1: Named import (recommended)
28
- import { Gantt } from 'iris-gantt'
29
- import 'iris-gantt/gantt.css'
30
-
31
- // Option 2: Default import (also supported)
32
- import Gantt from 'iris-gantt'
33
- import 'iris-gantt/gantt.css'
34
-
35
- function App() {
36
- const tasks = [
37
- {
38
- id: '1',
39
- text: 'My First Task',
40
- start: new Date(2024, 0, 1),
41
- end: new Date(2024, 0, 10),
42
- duration: 9,
43
- progress: 50,
44
- },
45
- ]
5
+ ## ✨ Features
46
6
 
47
- return <Gantt tasks={tasks} />
48
- }
49
- ```
7
+ ### Core Features
8
+ - ✅ Interactive task management
9
+ - ✅ Drag & drop task bars
10
+ - ✅ Task dependencies with 4 link types (end-to-start, start-to-start, end-to-end, start-to-end)
11
+ - ✅ Hierarchical tasks (parent/child)
12
+ - ✅ Progress tracking
13
+ - ✅ Multiple task types (task, milestone, project)
14
+ - ✅ Customizable timeline scales
15
+ - ✅ Light & dark themes
50
16
 
51
- **That's it!** Your Gantt chart is ready. 🎉
17
+ ### Advanced Features
18
+ - ✅ Auto-scheduling
19
+ - ✅ Critical path analysis
20
+ - ✅ **Baselines (always visible, automatically created)**
21
+ - ✅ Undo/Redo (Ctrl+Z/Y)
22
+ - ✅ Export (CSV, Excel, JSON, PDF)
23
+ - ✅ Filtering & search
24
+ - ✅ Resource leveling
25
+ - ✅ **Fully responsive** (desktop, tablet, mobile)
26
+ - ✅ **Fully customizable** (all text, buttons, colors, fonts)
52
27
 
53
28
  ## 📦 Installation
54
29
 
55
- ### Option 1: Install Everything at Once
56
-
57
30
  ```bash
58
- npm install iris-gantt react react-dom antd@^5.29.3 dayjs @fortawesome/react-fontawesome@^3.1.0 @fortawesome/fontawesome-svg-core@^7.1.0 @fortawesome/free-solid-svg-icons@^7.1.0
31
+ npm install iris-gantt
59
32
  ```
60
33
 
61
- ### Option 2: Install Separately
34
+ ### Peer Dependencies
62
35
 
63
- ```bash
64
- # Install the package
65
- npm install iris-gantt
36
+ Make sure you have these installed:
66
37
 
67
- # Install peer dependencies
68
- npm install react react-dom antd@^5.29.3 dayjs @fortawesome/react-fontawesome@^3.1.0 @fortawesome/fontawesome-svg-core@^7.1.0 @fortawesome/free-solid-svg-icons@^7.1.0
38
+ ```bash
39
+ npm install react@^18.3.1 react-dom@^18.3.1
40
+ npm install antd@^5.29.3
41
+ npm install dayjs@^1.11.0
42
+ npm install @fortawesome/fontawesome-svg-core@^7.1.0
43
+ npm install @fortawesome/free-solid-svg-icons@^7.1.0
44
+ npm install @fortawesome/react-fontawesome@^3.1.0
69
45
  ```
70
46
 
71
- ## 💻 Basic Usage
47
+ ## 🚀 Quick Start
72
48
 
73
49
  ```tsx
74
- import React from 'react'
75
50
  import { Gantt } from 'iris-gantt'
76
51
  import 'iris-gantt/gantt.css'
77
- import type { Task, Link } from 'iris-gantt'
78
52
 
79
53
  function MyGantt() {
80
- const tasks: Task[] = [
54
+ const tasks = [
81
55
  {
82
56
  id: '1',
83
57
  text: 'Project Planning',
@@ -97,46 +71,16 @@ function MyGantt() {
97
71
  },
98
72
  ]
99
73
 
100
- const links: Link[] = [
101
- { id: 'l1', source: '1', target: '2', type: 'e2s' },
102
- ]
103
-
104
- return (
105
- <Gantt
106
- tasks={tasks}
107
- links={links}
108
- onTaskUpdate={(task) => console.log('Updated:', task)}
109
- />
110
- )
74
+ return <Gantt tasks={tasks} />
111
75
  }
112
76
  ```
113
77
 
114
- ## ✨ Features
115
-
116
- ### Core Features
117
- - ✅ Interactive task management
118
- - ✅ Drag & drop task bars
119
- - ✅ Task dependencies with 4 link types
120
- - ✅ Hierarchical tasks (parent/child)
121
- - ✅ Progress tracking
122
- - ✅ Multiple task types (task, milestone, project)
123
- - ✅ Customizable timeline scales
124
- - ✅ Light & dark themes
125
-
126
- ### Advanced Features
127
- - ✅ Auto-scheduling
128
- - ✅ Critical path analysis
129
- - ✅ Baselines
130
- - ✅ Undo/Redo (Ctrl+Z/Y)
131
- - ✅ Export (CSV, Excel, JSON, PDF)
132
- - ✅ Filtering & search
133
- - ✅ Resource leveling
134
-
135
78
  ## 📚 Documentation
136
79
 
137
- - **[Complete Usage Guide](./USAGE.md)** - Comprehensive documentation with examples
80
+ - **[Complete Usage Guide](./USAGE.md)** - Comprehensive documentation with all props and examples
138
81
  - **[API Reference](./USAGE.md#api-reference)** - Full TypeScript API
139
- - **[Examples](./USAGE.md#examples)** - Real-world usage examples
82
+ - **[Responsive Design Guide](./RESPONSIVE_STYLING.md)** - How to make it responsive and match your project styles
83
+ - **[Customization Guide](./CUSTOMIZATION_GUIDE.md)** - Advanced customization options
140
84
 
141
85
  ## 🎯 Common Imports
142
86
 
@@ -148,100 +92,296 @@ import { Gantt } from 'iris-gantt'
148
92
  import Gantt from 'iris-gantt'
149
93
 
150
94
  // Types
151
- import type { Task, Link, GanttConfig } from 'iris-gantt'
95
+ import type { Task, Link, GanttConfig, GanttUIConfig, GanttStyleConfig } from 'iris-gantt'
152
96
 
153
97
  // CSS (required!)
154
98
  import 'iris-gantt/gantt.css'
155
99
  ```
156
100
 
157
- ## 🔧 Configuration Example
101
+ ## 🔧 Basic Configuration
158
102
 
159
103
  ```tsx
160
104
  <Gantt
161
105
  tasks={tasks}
162
106
  links={links}
163
107
  config={{
164
- theme: 'light', // 'light' | 'dark'
165
- weekends: true, // Highlight weekends
166
- criticalPath: true, // Show critical path
167
- autoSchedule: true, // Enable auto-scheduling
108
+ theme: 'light',
109
+ weekends: true,
110
+ containerHeight: '100%',
111
+ containerMinHeight: '400px',
112
+ }}
113
+ onTaskUpdate={(task) => console.log('Updated:', task)}
114
+ />
115
+ ```
116
+
117
+ ## 🎨 Full Customization
118
+
119
+ ### UI Configuration (All Text & Buttons)
120
+
121
+ ```tsx
122
+ <Gantt
123
+ tasks={tasks}
124
+ uiConfig={{
125
+ // Header
126
+ headerTitle: 'My Project Gantt',
127
+ showHeader: true,
128
+
129
+ // Toolbar Buttons
130
+ showAddTaskButton: true,
131
+ showZoomButtons: true,
132
+ showExportButtons: true,
133
+ showFilterSearch: true,
134
+ addTaskButtonText: 'Add New Task',
135
+
136
+ // All labels, placeholders, tooltips are configurable
137
+ // See USAGE.md for complete list
138
+ }}
139
+ />
140
+ ```
141
+
142
+ ### Style Configuration (Colors & Fonts)
143
+
144
+ ```tsx
145
+ <Gantt
146
+ tasks={tasks}
147
+ styleConfig={{
148
+ // Colors - Match your brand
149
+ primary: '#37a9ef',
150
+ success: '#77d257',
151
+ warning: '#fcba2e',
152
+ danger: '#fe6158',
153
+ background: '#ffffff',
154
+ fontColor: '#333333',
155
+
156
+ // Fonts - Use your project fonts
157
+ fontFamily: 'Inter, sans-serif',
158
+ fontSize: '14px',
159
+
160
+ // See USAGE.md for complete list
161
+ }}
162
+ />
163
+ ```
164
+
165
+ ### Responsive Design
166
+
167
+ ```tsx
168
+ <Gantt
169
+ tasks={tasks}
170
+ config={{
171
+ // Responsive container
172
+ containerHeight: '100%',
173
+ containerMinHeight: '400px',
174
+
175
+ // Responsive grid width
176
+ gridWidth: 'clamp(280px, 30vw, 720px)', // Adapts to viewport
168
177
  }}
178
+ />
179
+ ```
180
+
181
+ ### Style Integration (CSS Variables)
182
+
183
+ ```css
184
+ /* In your project's CSS */
185
+ .my-gantt-wrapper {
186
+ /* Match your brand colors */
187
+ --wx-gantt-primary: #your-brand-color;
188
+ --wx-gantt-background: var(--your-bg-color);
189
+ --wx-gantt-font-color: var(--your-text-color);
190
+
191
+ /* Use your project fonts */
192
+ --wx-gantt-font-family: 'Your Font', sans-serif;
193
+
194
+ /* Responsive sizing */
195
+ --gantt-grid-width: clamp(280px, 30vw, 720px);
196
+ }
197
+ ```
198
+
199
+ ## 📱 Responsive
200
+
201
+ The component is fully responsive and adapts to:
202
+ - ✅ Desktop (1024px+)
203
+ - ✅ Tablet (768px - 1024px)
204
+ - ✅ Mobile Landscape (480px - 768px)
205
+ - ✅ Mobile Portrait (< 480px)
206
+
207
+ ## 🎯 Baselines
208
+
209
+ Baselines are **always visible** and **automatically created** when tasks are set or updated. No button is needed - baselines are automatically generated from the current task state.
210
+
211
+ ```tsx
212
+ // Baselines are automatically created and displayed
213
+ <Gantt
214
+ tasks={tasks}
215
+ config={{
216
+ baselines: true, // Always enabled
217
+ }}
218
+ />
219
+ ```
220
+
221
+ ## 🔄 Event Handlers
222
+
223
+ ```tsx
224
+ <Gantt
225
+ tasks={tasks}
169
226
  onTaskUpdate={(task) => {
170
- // Handle task updates
171
- console.log('Task updated:', task)
227
+ // Save to your backend
172
228
  }}
173
229
  onTaskCreate={(task) => {
174
- // Handle new tasks
175
- console.log('Task created:', task)
230
+ // Add to your backend
231
+ }}
232
+ onTaskDelete={(taskId) => {
233
+ // Remove from your backend
176
234
  }}
177
- onTaskDelete={(id) => {
178
- // Handle task deletion
179
- console.log('Task deleted:', id)
235
+ onLinkCreate={(link) => {
236
+ // Save dependency to your backend
237
+ }}
238
+ onLinkDelete={(linkId) => {
239
+ // Remove dependency from your backend
180
240
  }}
181
241
  />
182
242
  ```
183
243
 
184
- ## 📖 More Examples
244
+ ## 🐛 Troubleshooting
245
+
246
+ ### CSS Import Error
247
+
248
+ If you get: `Module not found: Error: Package path ./dist/gantt.css is not exported`
249
+
250
+ **Solution:**
251
+ ```tsx
252
+ import 'iris-gantt/gantt.css'
253
+ // or
254
+ import 'iris-gantt/dist/gantt.css'
255
+ ```
256
+
257
+ ### Default Import Error
258
+
259
+ If you get: `export 'default' was not found`
260
+
261
+ **Solution:**
262
+ ```tsx
263
+ // Use named import instead
264
+ import { Gantt } from 'iris-gantt'
265
+ ```
266
+
267
+ ### Runtime Error: recentlyCreatedOwnerStacks
268
+
269
+ This is a **cached code issue** in your project, not the package.
270
+
271
+ **Solution:**
272
+ ```bash
273
+ # In your project directory
274
+ rm -rf node_modules package-lock.json .next .cache dist build
275
+ npm cache clean --force
276
+ npm install
277
+ npm start
278
+ ```
185
279
 
186
- ### With State Management
280
+ ## 📖 Complete Example
187
281
 
188
282
  ```tsx
189
- import { useState } from 'react'
283
+ import React, { useState } from 'react'
190
284
  import { Gantt } from 'iris-gantt'
191
285
  import 'iris-gantt/gantt.css'
286
+ import type { Task, Link } from 'iris-gantt'
192
287
 
193
- function App() {
194
- const [tasks, setTasks] = useState([
288
+ function ProjectGantt() {
289
+ const [tasks, setTasks] = useState<Task[]>([
195
290
  {
196
291
  id: '1',
197
- text: 'Task 1',
292
+ text: 'Project Planning',
198
293
  start: new Date(2024, 0, 1),
199
- end: new Date(2024, 0, 10),
200
- duration: 9,
201
- progress: 50,
294
+ end: new Date(2024, 0, 15),
295
+ duration: 14,
296
+ progress: 100,
297
+ type: 'project',
202
298
  },
203
299
  ])
204
300
 
301
+ const [links, setLinks] = useState<Link[]>([
302
+ { id: 'l1', source: '1', target: '2', type: 'e2s' },
303
+ ])
304
+
205
305
  return (
206
- <Gantt
207
- tasks={tasks}
208
- onTaskUpdate={(task) => {
209
- setTasks(prev => prev.map(t => t.id === task.id ? task : t))
210
- }}
211
- />
306
+ <div style={{ width: '100%', height: '100vh' }}>
307
+ <Gantt
308
+ tasks={tasks}
309
+ links={links}
310
+ config={{
311
+ theme: 'light',
312
+ weekends: true,
313
+ containerHeight: '100%',
314
+ containerMinHeight: '500px',
315
+ gridWidth: 'clamp(300px, 35vw, 800px)',
316
+ }}
317
+ uiConfig={{
318
+ headerTitle: 'My Project Timeline',
319
+ addTaskButtonText: 'New Task',
320
+ }}
321
+ styleConfig={{
322
+ primary: '#6366f1',
323
+ fontFamily: 'Inter, sans-serif',
324
+ }}
325
+ onTaskUpdate={(task) => {
326
+ setTasks(tasks.map(t => t.id === task.id ? task : t))
327
+ }}
328
+ onTaskCreate={(task) => {
329
+ setTasks([...tasks, task])
330
+ }}
331
+ onTaskDelete={(taskId) => {
332
+ setTasks(tasks.filter(t => t.id !== taskId))
333
+ }}
334
+ onLinkCreate={(link) => {
335
+ setLinks([...links, link])
336
+ }}
337
+ onLinkDelete={(linkId) => {
338
+ setLinks(links.filter(l => l.id !== linkId))
339
+ }}
340
+ />
341
+ </div>
212
342
  )
213
343
  }
344
+
345
+ export default ProjectGantt
214
346
  ```
215
347
 
216
- ### Read-Only Mode
348
+ ## 📝 TypeScript Support
349
+
350
+ Full TypeScript support is included:
217
351
 
218
352
  ```tsx
219
- <Gantt
220
- tasks={tasks}
221
- config={{ readonly: true }}
222
- />
353
+ import { Gantt } from 'iris-gantt'
354
+ import type { Task, Link, GanttConfig, GanttUIConfig, GanttStyleConfig } from 'iris-gantt'
355
+
356
+ const tasks: Task[] = [...]
357
+ const config: GanttConfig = {...}
358
+ const uiConfig: GanttUIConfig = {...}
359
+ const styleConfig: GanttStyleConfig = {...}
223
360
  ```
224
361
 
225
- ## 🛠️ Requirements
362
+ ## 🎨 Customization Highlights
226
363
 
227
- - React 18+ or 19+
228
- - TypeScript (recommended)
229
- - Peer dependencies (see installation above)
364
+ - **All text is configurable** - buttons, labels, placeholders, tooltips
365
+ - **All buttons are toggleable** - show/hide any button
366
+ - **All colors are customizable** - match your brand
367
+ - ✅ **All fonts are customizable** - use your project fonts
368
+ - ✅ **Fully responsive** - adapts to all screen sizes
369
+ - ✅ **Style integration** - uses CSS variables that inherit from your project
230
370
 
231
- ## 📝 License
371
+ ## 📚 More Documentation
232
372
 
233
- MIT License - see [LICENSE](./LICENSE) file for details
373
+ - **[USAGE.md](./USAGE.md)** - Complete usage guide with all props
374
+ - **[RESPONSIVE_STYLING.md](./RESPONSIVE_STYLING.md)** - Responsive design guide
375
+ - **[CUSTOMIZATION_GUIDE.md](./CUSTOMIZATION_GUIDE.md)** - Advanced customization
234
376
 
235
- ## 🔗 Links
377
+ ## 🤝 Contributing
236
378
 
237
- - [GitHub Repository](https://github.com/TimJerry725/ganttchart)
238
- - [Full Documentation](./USAGE.md)
239
- - [npm Package](https://www.npmjs.com/package/iris-gantt)
379
+ Contributions are welcome! Please feel free to submit a Pull Request.
240
380
 
241
- ## 🤝 Contributing
381
+ ## 📄 License
242
382
 
243
- Contributions are welcome! Please open an issue or submit a pull request.
383
+ MIT
244
384
 
245
- ---
385
+ ## 🔗 Links
246
386
 
247
- **Made with ❤️ using React + TypeScript**
387
+ - GitHub: https://github.com/TimJerry725/ganttchart.git