@object-ui/plugin-gantt 0.3.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 +260 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +504 -0
- package/dist/index.umd.cjs +6 -0
- package/dist/src/ObjectGantt.d.ts +12 -0
- package/dist/src/ObjectGantt.d.ts.map +1 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.d.ts.map +1 -0
- package/package.json +53 -0
- package/src/ObjectGantt.tsx +408 -0
- package/src/index.tsx +29 -0
- package/tsconfig.json +18 -0
- package/vite.config.ts +50 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 ObjectQL
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
# @object-ui/plugin-gantt
|
|
2
|
+
|
|
3
|
+
Gantt chart plugin for Object UI - Visualize project timelines and task dependencies.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Gantt Charts** - Interactive Gantt chart visualization
|
|
8
|
+
- **Task Dependencies** - Link tasks with dependencies
|
|
9
|
+
- **Timeline View** - Visualize project schedules
|
|
10
|
+
- **Task Management** - Create, edit, and track tasks
|
|
11
|
+
- **Responsive** - Scrollable timeline for large projects
|
|
12
|
+
- **Customizable** - Tailwind CSS styling support
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pnpm add @object-ui/plugin-gantt
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
### Automatic Registration (Side-Effect Import)
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
// In your app entry point (e.g., App.tsx or main.tsx)
|
|
26
|
+
import '@object-ui/plugin-gantt';
|
|
27
|
+
|
|
28
|
+
// Now you can use gantt types in your schemas
|
|
29
|
+
const schema = {
|
|
30
|
+
type: 'gantt',
|
|
31
|
+
tasks: [
|
|
32
|
+
{
|
|
33
|
+
id: '1',
|
|
34
|
+
name: 'Project Setup',
|
|
35
|
+
start: '2024-01-01',
|
|
36
|
+
end: '2024-01-05',
|
|
37
|
+
progress: 100
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
};
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Manual Registration
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
import { ganttComponents } from '@object-ui/plugin-gantt';
|
|
47
|
+
import { ComponentRegistry } from '@object-ui/core';
|
|
48
|
+
|
|
49
|
+
// Register gantt components
|
|
50
|
+
Object.entries(ganttComponents).forEach(([type, component]) => {
|
|
51
|
+
ComponentRegistry.register(type, component);
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Schema API
|
|
56
|
+
|
|
57
|
+
### Gantt Chart
|
|
58
|
+
|
|
59
|
+
Display project timeline with tasks:
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
{
|
|
63
|
+
type: 'gantt',
|
|
64
|
+
tasks: GanttTask[],
|
|
65
|
+
viewMode?: 'day' | 'week' | 'month',
|
|
66
|
+
onTaskClick?: (task) => void,
|
|
67
|
+
onTaskUpdate?: (task) => void,
|
|
68
|
+
className?: string
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Task Structure
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
interface GanttTask {
|
|
76
|
+
id: string;
|
|
77
|
+
name: string;
|
|
78
|
+
start: string; // ISO date string
|
|
79
|
+
end: string; // ISO date string
|
|
80
|
+
progress: number; // 0-100
|
|
81
|
+
dependencies?: string[]; // Task IDs
|
|
82
|
+
assignee?: string;
|
|
83
|
+
color?: string; // Tailwind color class
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Examples
|
|
88
|
+
|
|
89
|
+
### Basic Gantt Chart
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
const schema = {
|
|
93
|
+
type: 'gantt',
|
|
94
|
+
viewMode: 'week',
|
|
95
|
+
tasks: [
|
|
96
|
+
{
|
|
97
|
+
id: '1',
|
|
98
|
+
name: 'Project Planning',
|
|
99
|
+
start: '2024-01-01',
|
|
100
|
+
end: '2024-01-07',
|
|
101
|
+
progress: 100,
|
|
102
|
+
color: 'bg-blue-500'
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
id: '2',
|
|
106
|
+
name: 'Design Phase',
|
|
107
|
+
start: '2024-01-08',
|
|
108
|
+
end: '2024-01-21',
|
|
109
|
+
progress: 75,
|
|
110
|
+
dependencies: ['1'],
|
|
111
|
+
color: 'bg-purple-500'
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
id: '3',
|
|
115
|
+
name: 'Development',
|
|
116
|
+
start: '2024-01-22',
|
|
117
|
+
end: '2024-02-15',
|
|
118
|
+
progress: 30,
|
|
119
|
+
dependencies: ['2'],
|
|
120
|
+
color: 'bg-green-500'
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
id: '4',
|
|
124
|
+
name: 'Testing',
|
|
125
|
+
start: '2024-02-16',
|
|
126
|
+
end: '2024-02-28',
|
|
127
|
+
progress: 0,
|
|
128
|
+
dependencies: ['3'],
|
|
129
|
+
color: 'bg-orange-500'
|
|
130
|
+
}
|
|
131
|
+
]
|
|
132
|
+
};
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Interactive Gantt
|
|
136
|
+
|
|
137
|
+
```typescript
|
|
138
|
+
const schema = {
|
|
139
|
+
type: 'gantt',
|
|
140
|
+
tasks: [/* tasks */],
|
|
141
|
+
onTaskClick: (task) => {
|
|
142
|
+
console.log('Task clicked:', task);
|
|
143
|
+
// Show task details
|
|
144
|
+
},
|
|
145
|
+
onTaskUpdate: (updatedTask) => {
|
|
146
|
+
console.log('Task updated:', updatedTask);
|
|
147
|
+
// Save changes to backend
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### With ObjectQL Integration
|
|
153
|
+
|
|
154
|
+
```typescript
|
|
155
|
+
const schema = {
|
|
156
|
+
type: 'object-gantt',
|
|
157
|
+
object: 'project_tasks',
|
|
158
|
+
nameField: 'name',
|
|
159
|
+
startField: 'start_date',
|
|
160
|
+
endField: 'end_date',
|
|
161
|
+
progressField: 'completion_percentage',
|
|
162
|
+
dependenciesField: 'dependent_task_ids'
|
|
163
|
+
};
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## View Modes
|
|
167
|
+
|
|
168
|
+
The Gantt chart supports different time scales:
|
|
169
|
+
|
|
170
|
+
- **day** - Day-by-day view
|
|
171
|
+
- **week** - Week-by-week view
|
|
172
|
+
- **month** - Month-by-month view
|
|
173
|
+
|
|
174
|
+
```typescript
|
|
175
|
+
const schema = {
|
|
176
|
+
type: 'gantt',
|
|
177
|
+
viewMode: 'month',
|
|
178
|
+
tasks: [/* tasks */]
|
|
179
|
+
};
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Task Dependencies
|
|
183
|
+
|
|
184
|
+
Link tasks to show dependencies:
|
|
185
|
+
|
|
186
|
+
```typescript
|
|
187
|
+
const tasks = [
|
|
188
|
+
{
|
|
189
|
+
id: 'task-1',
|
|
190
|
+
name: 'Foundation',
|
|
191
|
+
start: '2024-01-01',
|
|
192
|
+
end: '2024-01-10',
|
|
193
|
+
progress: 100
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
id: 'task-2',
|
|
197
|
+
name: 'Building',
|
|
198
|
+
start: '2024-01-11',
|
|
199
|
+
end: '2024-01-25',
|
|
200
|
+
progress: 50,
|
|
201
|
+
dependencies: ['task-1'] // Depends on task-1
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
id: 'task-3',
|
|
205
|
+
name: 'Finishing',
|
|
206
|
+
start: '2024-01-26',
|
|
207
|
+
end: '2024-02-05',
|
|
208
|
+
progress: 0,
|
|
209
|
+
dependencies: ['task-2'] // Depends on task-2
|
|
210
|
+
}
|
|
211
|
+
];
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## Integration with Data Sources
|
|
215
|
+
|
|
216
|
+
```typescript
|
|
217
|
+
import { createObjectStackAdapter } from '@object-ui/data-objectstack';
|
|
218
|
+
|
|
219
|
+
const dataSource = createObjectStackAdapter({
|
|
220
|
+
baseUrl: 'https://api.example.com',
|
|
221
|
+
token: 'your-auth-token'
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
const schema = {
|
|
225
|
+
type: 'object-gantt',
|
|
226
|
+
dataSource,
|
|
227
|
+
object: 'tasks',
|
|
228
|
+
fields: {
|
|
229
|
+
name: 'task_name',
|
|
230
|
+
start: 'start_date',
|
|
231
|
+
end: 'end_date',
|
|
232
|
+
progress: 'progress_percent'
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## TypeScript Support
|
|
238
|
+
|
|
239
|
+
```typescript
|
|
240
|
+
import type { GanttSchema, GanttTask } from '@object-ui/plugin-gantt';
|
|
241
|
+
|
|
242
|
+
const task: GanttTask = {
|
|
243
|
+
id: '1',
|
|
244
|
+
name: 'My Task',
|
|
245
|
+
start: '2024-01-01',
|
|
246
|
+
end: '2024-01-10',
|
|
247
|
+
progress: 50,
|
|
248
|
+
dependencies: []
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
const gantt: GanttSchema = {
|
|
252
|
+
type: 'gantt',
|
|
253
|
+
viewMode: 'week',
|
|
254
|
+
tasks: [task]
|
|
255
|
+
};
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
## License
|
|
259
|
+
|
|
260
|
+
MIT
|
package/dist/index.d.ts
ADDED