apexgantt 2.0.0 → 3.1.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.
Files changed (49) hide show
  1. package/README.md +127 -3
  2. package/apexgantt.es.min.js +17104 -48169
  3. package/apexgantt.min.js +2 -1453
  4. package/demo/data-parsing.html +85 -0
  5. package/demo/gantt-with-interactions.html +5 -0
  6. package/demo/milestones.html +4 -16
  7. package/demo/multiple-gantts-in-shadow.html +378 -0
  8. package/index.d.ts +7 -1
  9. package/lib/gantt.d.ts +52 -12
  10. package/lib/models/Annotation.d.ts +4 -1
  11. package/lib/models/ArrowLink.d.ts +28 -0
  12. package/lib/models/Bar.d.ts +5 -1
  13. package/lib/models/BarDragManager.d.ts +5 -1
  14. package/lib/models/BarResizeManager.d.ts +5 -1
  15. package/lib/models/DataManager.d.ts +9 -70
  16. package/lib/models/DataParser.d.ts +57 -0
  17. package/lib/models/Dialog.d.ts +9 -1
  18. package/lib/models/Options.d.ts +12 -5
  19. package/lib/models/SplitView.d.ts +29 -0
  20. package/lib/models/StateManager.d.ts +20 -0
  21. package/lib/models/TaskForm.d.ts +7 -1
  22. package/lib/models/Tasks.d.ts +25 -14
  23. package/lib/models/Theme.d.ts +36 -0
  24. package/lib/models/TimeLine.d.ts +6 -1
  25. package/lib/styles/Dialog.style.d.ts +1 -1
  26. package/lib/styles/Dropdown.style.d.ts +1 -1
  27. package/lib/styles/Gantt.style.d.ts +1 -1
  28. package/lib/styles/Scrollbar.style.d.ts +1 -0
  29. package/lib/styles/TaskForm.style.d.ts +1 -1
  30. package/lib/styles/Tasks.style.d.ts +1 -1
  31. package/lib/styles/Timeline.style.d.ts +1 -1
  32. package/lib/styles/Toolbar.style.d.ts +1 -1
  33. package/lib/styles/Tooltip.style.d.ts +1 -1
  34. package/lib/types/events.d.ts +54 -0
  35. package/lib/util/arrow.util.d.ts +3 -1
  36. package/lib/util/bar.util.d.ts +4 -2
  37. package/lib/util/ganttExport.d.ts +1 -1
  38. package/lib/util/icon.util.d.ts +7 -0
  39. package/lib/util/style-injection.util.d.ts +9 -6
  40. package/lib/util/task.util.d.ts +7 -6
  41. package/package.json +2 -3
  42. package/html2canvas-D1hTQM0b.js +0 -29
  43. package/html2canvas-DY15eh9-.js +0 -25
  44. package/index-BWP5PfTm.js +0 -37542
  45. package/index-BvOcbiui.js +0 -28716
  46. package/index.es-CkiCpPKL.js +0 -5742
  47. package/index.es-DQCDSqMd.js +0 -9442
  48. package/purify.es-IAoVk_s_.js +0 -538
  49. package/purify.es-V92tbb_N.js +0 -991
package/README.md CHANGED
@@ -52,9 +52,10 @@ The layout can be configured by either setting the properties in the table below
52
52
 
53
53
  | Options | Default | Description |
54
54
  | ------------------------- | ----------------------------- | --------------------------------------------------- |
55
- | width | `800` | The width of graph container |
56
- | height | `800` | The height of graph container |
55
+ | width | `100%` | The width of graph container |
56
+ | height | `500px` | The height of graph container |
57
57
  | series, | `[]` | Data for gantt. See format below |
58
+ | theme, | `light` | Built in light and dark theme for easy styling |
58
59
  | canvasStyle | `None` | The css styles for canvas root container |
59
60
  | viewMode | `ViewMode.Month` | View mode |
60
61
  | arrowColor | `#0D6EFD` | Color for the dependency arrows |
@@ -74,7 +75,7 @@ The layout can be configured by either setting the properties in the table below
74
75
  | enableTaskResize | `true` | Enable/disable gantt export options |
75
76
  | headerBackground | `#f3f3f3` | Background color for header |
76
77
  | inputDateFormat | `MM-DD-YYYY` | Input date format |
77
- | tasksContainerWidth | `440` | Task sidebar container width |
78
+ | tasksContainerWidth | `425` | Task sidebar container width |
78
79
  | tooltipId | `apexgantt-tooltip-container` | The tooltip HTML element id |
79
80
  | tooltipTemplate | `tooltipTemplate` | The HTML template for tooltip |
80
81
  | tooltipBorderColor | `#BCBCBC` | The border color of tooltip |
@@ -184,6 +185,65 @@ Each tasks should be in below format
184
185
  ];
185
186
  ```
186
187
 
188
+ ## Data Parsing
189
+
190
+ Map your existing data structure to ApexGantt format without manual transformation.
191
+
192
+ ```javascript
193
+ const apiData = [
194
+ {
195
+ task_id: 'T1',
196
+ task_name: 'Design Phase',
197
+ start_date: '01-01-2024',
198
+ end_date: '01-15-2024',
199
+ completion: 75,
200
+ },
201
+ ];
202
+
203
+ const gantt = new ApexGantt(document.getElementById('gantt'), {
204
+ series: apiData,
205
+ parsing: {
206
+ id: 'task_id',
207
+ name: 'task_name',
208
+ startTime: 'start_date',
209
+ endTime: 'end_date',
210
+ progress: 'completion',
211
+ },
212
+ });
213
+ ```
214
+
215
+ ### Nested Objects & Transforms
216
+
217
+ Use dot notation for nested properties and inline transforms for data conversion:
218
+
219
+ ```javascript
220
+ const nestedData = [
221
+ {
222
+ project: {
223
+ task: {id: 'T1', title: 'Design'},
224
+ dates: {start: '01-01-2024', end: '01-15-2024'},
225
+ status: {completion: 0.75},
226
+ },
227
+ },
228
+ ];
229
+
230
+ const gantt = new ApexGantt(document.getElementById('gantt'), {
231
+ series: nestedData,
232
+ parsing: {
233
+ id: 'project.task.id',
234
+ name: 'project.task.title',
235
+ startTime: 'project.dates.start',
236
+ endTime: 'project.dates.end',
237
+ progress: {
238
+ key: 'project.status.completion',
239
+ transform: (value) => value * 100, // convert to percentage
240
+ },
241
+ },
242
+ });
243
+ ```
244
+
245
+ **Supported fields:** `id`, `name`, `startTime`, `endTime`, `progress`, `type`, `parentId`, `dependency`, `barBackgroundColor`, `rowBackgroundColor`, `collapsed`
246
+
187
247
  ## 📘 Public API
188
248
 
189
249
  ### 1. `update(options)`
@@ -255,3 +315,67 @@ Zooms out the gantt based on current view mode. View mode direction for zoom in
255
315
  ```js
256
316
  ganttInstance.zoomOut();
257
317
  ```
318
+
319
+ ## Events
320
+
321
+ ApexGantt emits CustomEvents on the container element when tasks are updated through the dialog form.
322
+
323
+ | Event | When | Detail |
324
+ | --------------------- | ----------------------------- | --------------------------------------------- |
325
+ | `taskUpdate` | Task is being updated | `{ taskId, updates, updatedTask, timestamp }` |
326
+ | `taskUpdateSuccess` | Update completed successfully | `{ taskId, updatedTask, timestamp }` |
327
+ | `taskValidationError` | Form validation failed | `{ taskId, errors, timestamp }` |
328
+ | `taskUpdateError` | Update failed | `{ taskId, error, timestamp }` |
329
+
330
+ ### Events Usage
331
+
332
+ #### Vanilla JS
333
+
334
+ ```javascript
335
+ import ApexGantt, {GanttEvents} from 'apexgantt';
336
+
337
+ const container = document.getElementById('gantt');
338
+ const chart = new ApexGantt(container, {series: tasks});
339
+ chart.render();
340
+
341
+ // Hook into updates to save to your backend
342
+ container.addEventListener(GanttEvents.TASK_UPDATE_SUCCESS, async (e) => {
343
+ const {updatedTask} = e.detail;
344
+ /* use this updatedTask for any server operations */
345
+ });
346
+
347
+ // handle any errors
348
+ container.addEventListener(GanttEvents.TASK_UPDATE_ERROR, (e) => {
349
+ console.error('Update failed:', e.detail.error);
350
+ });
351
+ ```
352
+
353
+ #### React
354
+
355
+ ```jsx
356
+ import {useRef, useEffect} from 'react';
357
+ import ApexGantt, {GanttEvents} from 'apexgantt';
358
+
359
+ function GanttChart({tasks}) {
360
+ const containerRef = useRef(null);
361
+
362
+ useEffect(() => {
363
+ const chart = new ApexGantt(containerRef.current, {series: tasks});
364
+ chart.render();
365
+
366
+ const handleSuccess = async (e) => {
367
+ const {updatedTask} = e.detail;
368
+ /* use this updatedTask for any server operations */
369
+ };
370
+
371
+ containerRef.current.addEventListener(GanttEvents.TASK_UPDATE_SUCCESS, handleSuccess);
372
+
373
+ return () => {
374
+ containerRef.current?.removeEventListener(GanttEvents.TASK_UPDATE_SUCCESS, handleSuccess);
375
+ chart.destroy();
376
+ };
377
+ }, [tasks]);
378
+
379
+ return <div ref={containerRef} />;
380
+ }
381
+ ```