apexgantt 2.0.0 → 3.0.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/README.md +67 -2
- package/apexgantt.es.min.js +20829 -8854
- package/apexgantt.min.js +545 -588
- package/demo/gantt-with-interactions.html +5 -0
- package/demo/milestones.html +4 -16
- package/demo/multiple-gantts-in-shadow.html +378 -0
- package/index.d.ts +4 -0
- package/lib/gantt.d.ts +34 -11
- package/lib/models/Annotation.d.ts +4 -1
- package/lib/models/Bar.d.ts +5 -1
- package/lib/models/BarDragManager.d.ts +5 -1
- package/lib/models/BarResizeManager.d.ts +5 -1
- package/lib/models/DataManager.d.ts +4 -65
- package/lib/models/Dialog.d.ts +9 -1
- package/lib/models/Options.d.ts +7 -2
- package/lib/models/TaskForm.d.ts +7 -1
- package/lib/models/Tasks.d.ts +6 -2
- package/lib/models/Theme.d.ts +36 -0
- package/lib/models/TimeLine.d.ts +5 -1
- package/lib/styles/Dialog.style.d.ts +1 -1
- package/lib/styles/Dropdown.style.d.ts +1 -1
- package/lib/styles/Gantt.style.d.ts +1 -1
- package/lib/styles/Scrollbar.style.d.ts +1 -0
- package/lib/styles/TaskForm.style.d.ts +1 -1
- package/lib/styles/Tasks.style.d.ts +1 -1
- package/lib/styles/Timeline.style.d.ts +1 -1
- package/lib/styles/Toolbar.style.d.ts +1 -1
- package/lib/styles/Tooltip.style.d.ts +1 -1
- package/lib/types/events.d.ts +54 -0
- package/lib/util/arrow.util.d.ts +3 -1
- package/lib/util/bar.util.d.ts +7 -2
- package/lib/util/icon.util.d.ts +7 -0
- package/lib/util/style-injection.util.d.ts +9 -6
- package/lib/util/task.util.d.ts +7 -5
- package/package.json +2 -2
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 | `
|
|
56
|
-
| height | `
|
|
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 |
|
|
@@ -255,3 +256,67 @@ Zooms out the gantt based on current view mode. View mode direction for zoom in
|
|
|
255
256
|
```js
|
|
256
257
|
ganttInstance.zoomOut();
|
|
257
258
|
```
|
|
259
|
+
|
|
260
|
+
## Events
|
|
261
|
+
|
|
262
|
+
ApexGantt emits CustomEvents on the container element when tasks are updated through the dialog form.
|
|
263
|
+
|
|
264
|
+
| Event | When | Detail |
|
|
265
|
+
| --------------------- | ----------------------------- | --------------------------------------------- |
|
|
266
|
+
| `taskUpdate` | Task is being updated | `{ taskId, updates, updatedTask, timestamp }` |
|
|
267
|
+
| `taskUpdateSuccess` | Update completed successfully | `{ taskId, updatedTask, timestamp }` |
|
|
268
|
+
| `taskValidationError` | Form validation failed | `{ taskId, errors, timestamp }` |
|
|
269
|
+
| `taskUpdateError` | Update failed | `{ taskId, error, timestamp }` |
|
|
270
|
+
|
|
271
|
+
### Events Usage
|
|
272
|
+
|
|
273
|
+
#### Vanilla JS
|
|
274
|
+
|
|
275
|
+
```javascript
|
|
276
|
+
import ApexGantt, {GanttEvents} from 'apexgantt';
|
|
277
|
+
|
|
278
|
+
const container = document.getElementById('gantt');
|
|
279
|
+
const chart = new ApexGantt(container, {series: tasks});
|
|
280
|
+
chart.render();
|
|
281
|
+
|
|
282
|
+
// Hook into updates to save to your backend
|
|
283
|
+
container.addEventListener(GanttEvents.TASK_UPDATE_SUCCESS, async (e) => {
|
|
284
|
+
const {updatedTask} = e.detail;
|
|
285
|
+
/* use this updatedTask for any server operations */
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
// handle any errors
|
|
289
|
+
container.addEventListener(GanttEvents.TASK_UPDATE_ERROR, (e) => {
|
|
290
|
+
console.error('Update failed:', e.detail.error);
|
|
291
|
+
});
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
#### React
|
|
295
|
+
|
|
296
|
+
```jsx
|
|
297
|
+
import {useRef, useEffect} from 'react';
|
|
298
|
+
import ApexGantt, {GanttEvents} from 'apexgantt';
|
|
299
|
+
|
|
300
|
+
function GanttChart({tasks}) {
|
|
301
|
+
const containerRef = useRef(null);
|
|
302
|
+
|
|
303
|
+
useEffect(() => {
|
|
304
|
+
const chart = new ApexGantt(containerRef.current, {series: tasks});
|
|
305
|
+
chart.render();
|
|
306
|
+
|
|
307
|
+
const handleSuccess = async (e) => {
|
|
308
|
+
const {updatedTask} = e.detail;
|
|
309
|
+
/* use this updatedTask for any server operations */
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
containerRef.current.addEventListener(GanttEvents.TASK_UPDATE_SUCCESS, handleSuccess);
|
|
313
|
+
|
|
314
|
+
return () => {
|
|
315
|
+
containerRef.current?.removeEventListener(GanttEvents.TASK_UPDATE_SUCCESS, handleSuccess);
|
|
316
|
+
chart.destroy();
|
|
317
|
+
};
|
|
318
|
+
}, [tasks]);
|
|
319
|
+
|
|
320
|
+
return <div ref={containerRef} />;
|
|
321
|
+
}
|
|
322
|
+
```
|