vue-apexgantt 1.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/LICENSE ADDED
@@ -0,0 +1,4 @@
1
+ [LICENSE TEXT TO BE ADDED]
2
+
3
+ This is a placeholder for your custom license.
4
+ Replace this content with your actual license text.
package/README.md ADDED
@@ -0,0 +1,401 @@
1
+ # Vue ApexGantt
2
+
3
+ Vue 3 wrapper for [ApexGantt](https://github.com/apexcharts/apexgantt) - A JavaScript library to create interactive Gantt charts.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install vue-apexgantt apexgantt
9
+ # or
10
+ yarn add vue-apexgantt apexgantt
11
+ # or
12
+ pnpm add vue-apexgantt apexgantt
13
+ ```
14
+
15
+ ## License Setup
16
+
17
+ If you have a commercial license, set it once at app initialization before rendering any charts:
18
+
19
+ ```ts
20
+ import { setApexGanttLicense } from 'vue-apexgantt';
21
+
22
+ // call this at the top of your app
23
+ setApexGanttLicense('your-license-key-here');
24
+ ```
25
+
26
+ **Example with Vue app entry point:**
27
+
28
+ ```ts
29
+ // main.ts
30
+ import { createApp } from 'vue';
31
+ import { setApexGanttLicense } from 'vue-apexgantt';
32
+ import App from './App.vue';
33
+
34
+ // set license before rendering
35
+ setApexGanttLicense('your-license-key-here');
36
+
37
+ createApp(App).mount('#app');
38
+ ```
39
+
40
+ ## Quick Start
41
+
42
+ ```vue
43
+ <template>
44
+ <ApexGanttChart
45
+ :tasks="tasks"
46
+ view-mode="week"
47
+ height="500px"
48
+ />
49
+ </template>
50
+
51
+ <script setup lang="ts">
52
+ import { ref } from 'vue';
53
+ import { ApexGanttChart } from 'vue-apexgantt';
54
+ import type { TaskInput } from 'vue-apexgantt';
55
+
56
+ const tasks = ref<TaskInput[]>([
57
+ {
58
+ id: 'task-1',
59
+ name: 'Project Planning',
60
+ startTime: '01-01-2024',
61
+ endTime: '01-08-2024',
62
+ progress: 75,
63
+ },
64
+ {
65
+ id: 'task-2',
66
+ name: 'Development',
67
+ startTime: '01-09-2024',
68
+ endTime: '01-20-2024',
69
+ progress: 40,
70
+ dependency: 'task-1',
71
+ },
72
+ ]);
73
+ </script>
74
+ ```
75
+
76
+ ## API Reference
77
+
78
+ ### Component Props
79
+
80
+ | Prop | Type | Default | Description |
81
+ | ----------- | -------------------------- | --------- | ---------------------------------------------------- |
82
+ | `tasks` | `TaskInput[]` | Required | Array of tasks to display |
83
+ | `options` | `Partial<GanttUserOptions>`| `{}` | ApexGantt configuration options |
84
+ | `width` | `string \| number` | `'100%'` | Chart width |
85
+ | `height` | `string \| number` | `'500px'` | Chart height |
86
+ | `viewMode` | `ViewMode` | `'month'` | View mode: 'day', 'week', 'month', 'quarter', 'year' |
87
+ | `theme` | `'light' \| 'dark'` | `'light'` | Color theme |
88
+ | `className` | `string` | `''` | CSS class name |
89
+ | `style` | `CSSProperties` | `{}` | Inline styles |
90
+
91
+ ### Component Events
92
+
93
+ | Event | Payload Type | Description |
94
+ | --------------------- | --------------------------------- | ---------------------------------- |
95
+ | `taskUpdate` | `TaskUpdateEventDetail` | Fired when a task is being updated |
96
+ | `taskUpdateSuccess` | `TaskUpdateSuccessEventDetail` | Fired after successful task update |
97
+ | `taskValidationError` | `TaskValidationErrorEventDetail` | Fired when validation fails |
98
+ | `taskUpdateError` | `TaskUpdateErrorEventDetail` | Fired when update fails |
99
+ | `taskDragged` | `TaskDraggedEventDetail` | Fired when a task is dragged |
100
+ | `taskResized` | `TaskResizedEventDetail` | Fired when a task is resized |
101
+
102
+ ### Event Handling Example
103
+
104
+ ```vue
105
+ <template>
106
+ <ApexGanttChart
107
+ :tasks="tasks"
108
+ @task-dragged="handleTaskDragged"
109
+ @task-resized="handleTaskResized"
110
+ @task-update-success="handleTaskUpdateSuccess"
111
+ />
112
+ </template>
113
+
114
+ <script setup lang="ts">
115
+ import type {
116
+ TaskDraggedEventDetail,
117
+ TaskResizedEventDetail,
118
+ TaskUpdateSuccessEventDetail
119
+ } from 'vue-apexgantt';
120
+
121
+ const handleTaskDragged = (detail: TaskDraggedEventDetail) => {
122
+ console.log('Task dragged:', detail);
123
+ // save to backend, etc.
124
+ };
125
+
126
+ const handleTaskResized = (detail: TaskResizedEventDetail) => {
127
+ console.log('Task resized:', detail);
128
+ };
129
+
130
+ const handleTaskUpdateSuccess = (detail: TaskUpdateSuccessEventDetail) => {
131
+ console.log('Task updated:', detail);
132
+ };
133
+ </script>
134
+ ```
135
+
136
+ ### Template Ref Methods
137
+
138
+ Access chart methods using template ref:
139
+
140
+ ```vue
141
+ <template>
142
+ <ApexGanttChart
143
+ ref="ganttRef"
144
+ :tasks="tasks"
145
+ />
146
+
147
+ <button @click="handleZoomIn">Zoom In</button>
148
+ <button @click="handleZoomOut">Zoom Out</button>
149
+ </template>
150
+
151
+ <script setup lang="ts">
152
+ import { ref } from 'vue';
153
+ import { ApexGanttChart } from 'vue-apexgantt';
154
+
155
+ const ganttRef = ref<InstanceType<typeof ApexGanttChart> | null>(null);
156
+
157
+ const handleZoomIn = () => {
158
+ ganttRef.value?.zoomIn();
159
+ };
160
+
161
+ const handleZoomOut = () => {
162
+ ganttRef.value?.zoomOut();
163
+ };
164
+
165
+ // available methods:
166
+ // ganttRef.value?.update(options)
167
+ // ganttRef.value?.updateTask(taskId, data)
168
+ // ganttRef.value?.zoomIn()
169
+ // ganttRef.value?.zoomOut()
170
+ // ganttRef.value?.destroy()
171
+ // ganttRef.value?.getInstance() // get raw ApexGantt instance
172
+ </script>
173
+ ```
174
+
175
+ ## Composables
176
+
177
+ ### useGanttData
178
+
179
+ Parse external data into ApexGantt format:
180
+
181
+ ```vue
182
+ <script setup lang="ts">
183
+ import { ref } from 'vue';
184
+ import { ApexGanttChart, useGanttData } from 'vue-apexgantt';
185
+ import type { ParsingConfig } from 'vue-apexgantt';
186
+
187
+ // raw API data
188
+ const apiData = ref([
189
+ {
190
+ task_id: 'T1',
191
+ task_name: 'Design Phase',
192
+ start_date: '01-01-2024',
193
+ end_date: '01-15-2024',
194
+ completion: 0.75,
195
+ },
196
+ // ...more tasks
197
+ ]);
198
+
199
+ // parsing configuration
200
+ const parsingConfig: ParsingConfig = {
201
+ id: 'task_id',
202
+ name: 'task_name',
203
+ startTime: 'start_date',
204
+ endTime: 'end_date',
205
+ progress: {
206
+ key: 'completion',
207
+ transform: (value) => value * 100, // convert to percentage
208
+ },
209
+ };
210
+
211
+ // parse data
212
+ const tasks = useGanttData({
213
+ data: apiData,
214
+ parsing: parsingConfig,
215
+ });
216
+ </script>
217
+
218
+ <template>
219
+ <ApexGanttChart :tasks="tasks" />
220
+ </template>
221
+ ```
222
+
223
+ ### Nested Objects & Transforms
224
+
225
+ Use dot notation for nested properties:
226
+
227
+ ```ts
228
+ const nestedData = ref([
229
+ {
230
+ project: {
231
+ task: { id: 'T1', title: 'Design' },
232
+ dates: { start: '01-01-2024', end: '01-15-2024' },
233
+ status: { completion: 0.75 },
234
+ },
235
+ },
236
+ ]);
237
+
238
+ const tasks = useGanttData({
239
+ data: nestedData,
240
+ parsing: {
241
+ id: 'project.task.id',
242
+ name: 'project.task.title',
243
+ startTime: 'project.dates.start',
244
+ endTime: 'project.dates.end',
245
+ progress: {
246
+ key: 'project.status.completion',
247
+ transform: (value) => value * 100,
248
+ },
249
+ },
250
+ });
251
+ ```
252
+
253
+ ## Advanced Usage
254
+
255
+ ### Custom Options
256
+
257
+ ```vue
258
+ <template>
259
+ <ApexGanttChart
260
+ :tasks="tasks"
261
+ :options="ganttOptions"
262
+ view-mode="week"
263
+ theme="dark"
264
+ />
265
+ </template>
266
+
267
+ <script setup lang="ts">
268
+ import type { GanttUserOptions } from 'vue-apexgantt';
269
+
270
+ const ganttOptions: Partial<GanttUserOptions> = {
271
+ enableTaskDrag: true,
272
+ enableTaskResize: true,
273
+ enableTaskEdit: true,
274
+ barBackgroundColor: '#537CFA',
275
+ rowBackgroundColors: ['#FFFFFF', '#F8F9FA'],
276
+ // ...more options
277
+ };
278
+ </script>
279
+ ```
280
+
281
+ ### Dynamic View Mode
282
+
283
+ ```vue
284
+ <template>
285
+ <div>
286
+ <select v-model="viewMode">
287
+ <option value="day">Day</option>
288
+ <option value="week">Week</option>
289
+ <option value="month">Month</option>
290
+ <option value="quarter">Quarter</option>
291
+ <option value="year">Year</option>
292
+ </select>
293
+
294
+ <ApexGanttChart
295
+ :tasks="tasks"
296
+ :view-mode="viewMode"
297
+ />
298
+ </div>
299
+ </template>
300
+
301
+ <script setup lang="ts">
302
+ import { ref } from 'vue';
303
+ import type { ViewMode } from 'vue-apexgantt';
304
+
305
+ const viewMode = ref<ViewMode>('month');
306
+ </script>
307
+ ```
308
+
309
+ ### Theme Switching
310
+
311
+ ```vue
312
+ <template>
313
+ <div>
314
+ <button @click="toggleTheme">
315
+ {{ theme === 'light' ? '🌙 Dark' : '☀️ Light' }}
316
+ </button>
317
+
318
+ <ApexGanttChart
319
+ :tasks="tasks"
320
+ :theme="theme"
321
+ />
322
+ </div>
323
+ </template>
324
+
325
+ <script setup lang="ts">
326
+ import { ref } from 'vue';
327
+ import type { ThemeMode } from 'vue-apexgantt';
328
+
329
+ const theme = ref<ThemeMode>('light');
330
+
331
+ const toggleTheme = () => {
332
+ theme.value = theme.value === 'light' ? 'dark' : 'light';
333
+ };
334
+ </script>
335
+ ```
336
+
337
+ ## TypeScript Support
338
+
339
+ The package includes full TypeScript definitions. Import types as needed:
340
+
341
+ ```ts
342
+ import type {
343
+ TaskInput,
344
+ TaskType,
345
+ ViewMode,
346
+ ThemeMode,
347
+ GanttUserOptions,
348
+ ParsingConfig,
349
+ TaskUpdateEventDetail,
350
+ TaskDraggedEventDetail,
351
+ TaskResizedEventDetail,
352
+ // ...more types
353
+ } from 'vue-apexgantt';
354
+ ```
355
+
356
+ ## Development
357
+
358
+ ### Setup
359
+
360
+ ```bash
361
+ # install dependencies
362
+ npm install
363
+
364
+ # run demo app
365
+ npm run dev
366
+
367
+ # build library
368
+ npm run build
369
+
370
+ # type check
371
+ npm run type-check
372
+ ```
373
+
374
+ ### Testing Examples Locally
375
+
376
+ The demo app is included in the repository:
377
+
378
+ ```bash
379
+ npm install
380
+ npm run dev
381
+ ```
382
+
383
+ The demo app will be available at `http://localhost:5173` and includes:
384
+
385
+ - **Basic Example**: Simple Gantt with zoom controls
386
+ - **Advanced Example**: View mode switching, theme toggle, interaction controls
387
+ - **Events Example**: Interactive testing of drag, resize, and update events
388
+ - **Data Parsing Example**: Using `useGanttData` with nested data structures
389
+
390
+ ## Browser Support
391
+
392
+ - Modern browsers (Chrome, Firefox, Safari, Edge)
393
+ - Requires ES2020+ support
394
+
395
+ ## License
396
+
397
+ See LICENSE file for details.
398
+
399
+ ## Credits
400
+
401
+ This is a Vue 3 wrapper for [ApexGantt](https://github.com/apexcharts/apexgantt).
@@ -0,0 +1,87 @@
1
+ import { CSSProperties } from 'vue';
2
+ import { default as ApexGantt, GanttUserOptions, TaskInput, ViewMode, ThemeMode, TaskUpdateEventDetail, TaskUpdateSuccessEventDetail, TaskValidationErrorEventDetail, TaskUpdateErrorEventDetail, TaskDraggedEventDetail, TaskResizedEventDetail } from 'apexgantt';
3
+
4
+ export interface ApexGanttChartProps {
5
+ tasks: TaskInput[];
6
+ options?: Partial<GanttUserOptions>;
7
+ width?: string | number;
8
+ height?: string | number;
9
+ viewMode?: ViewMode;
10
+ theme?: ThemeMode;
11
+ className?: string;
12
+ style?: CSSProperties;
13
+ }
14
+ export interface ApexGanttChartEmits {
15
+ (e: "taskUpdate", detail: TaskUpdateEventDetail): void;
16
+ (e: "taskUpdateSuccess", detail: TaskUpdateSuccessEventDetail): void;
17
+ (e: "taskValidationError", detail: TaskValidationErrorEventDetail): void;
18
+ (e: "taskUpdateError", detail: TaskUpdateErrorEventDetail): void;
19
+ (e: "taskDragged", detail: TaskDraggedEventDetail): void;
20
+ (e: "taskResized", detail: TaskResizedEventDetail): void;
21
+ }
22
+ export interface ApexGanttChartExpose {
23
+ update: (options: Partial<GanttUserOptions>) => void;
24
+ updateTask: (taskId: string, taskData: Partial<TaskInput>) => void;
25
+ zoomIn: () => void;
26
+ zoomOut: () => void;
27
+ destroy: () => void;
28
+ getInstance: () => ApexGantt | null;
29
+ }
30
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ApexGanttChartProps>, {
31
+ width: string;
32
+ height: string;
33
+ viewMode: ViewMode;
34
+ theme: ThemeMode;
35
+ className: string;
36
+ }>>, {
37
+ update: (options: Partial<GanttUserOptions>) => void;
38
+ updateTask: (taskId: string, taskData: Partial<TaskInput>) => void;
39
+ zoomIn: () => void;
40
+ zoomOut: () => void;
41
+ destroy: () => void;
42
+ getInstance: () => ApexGantt | null;
43
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
44
+ taskUpdate: (detail: TaskUpdateEventDetail) => void;
45
+ taskUpdateSuccess: (detail: TaskUpdateSuccessEventDetail) => void;
46
+ taskValidationError: (detail: TaskValidationErrorEventDetail) => void;
47
+ taskUpdateError: (detail: TaskUpdateErrorEventDetail) => void;
48
+ taskDragged: (detail: TaskDraggedEventDetail) => void;
49
+ taskResized: (detail: TaskResizedEventDetail) => void;
50
+ }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ApexGanttChartProps>, {
51
+ width: string;
52
+ height: string;
53
+ viewMode: ViewMode;
54
+ theme: ThemeMode;
55
+ className: string;
56
+ }>>> & Readonly<{
57
+ onTaskUpdate?: ((detail: TaskUpdateEventDetail) => any) | undefined;
58
+ onTaskUpdateSuccess?: ((detail: TaskUpdateSuccessEventDetail) => any) | undefined;
59
+ onTaskValidationError?: ((detail: TaskValidationErrorEventDetail) => any) | undefined;
60
+ onTaskUpdateError?: ((detail: TaskUpdateErrorEventDetail) => any) | undefined;
61
+ onTaskDragged?: ((detail: TaskDraggedEventDetail) => any) | undefined;
62
+ onTaskResized?: ((detail: TaskResizedEventDetail) => any) | undefined;
63
+ }>, {
64
+ width: string | number;
65
+ height: string | number;
66
+ viewMode: ViewMode;
67
+ theme: ThemeMode;
68
+ className: string;
69
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
70
+ export default _default;
71
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
72
+ type __VLS_TypePropsToRuntimeProps<T> = {
73
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
74
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
75
+ } : {
76
+ type: import('vue').PropType<T[K]>;
77
+ required: true;
78
+ };
79
+ };
80
+ type __VLS_WithDefaults<P, D> = {
81
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
82
+ default: D[K];
83
+ }> : P[K];
84
+ };
85
+ type __VLS_Prettify<T> = {
86
+ [K in keyof T]: T[K];
87
+ } & {};
@@ -0,0 +1,23 @@
1
+ import { Ref } from 'vue';
2
+ import { ParsingConfig } from 'apexgantt';
3
+
4
+ /**
5
+ * composable for parsing external data into ApexGantt format
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * const tasks = useGanttData({
10
+ * data: apiData,
11
+ * parsing: {
12
+ * id: 'task_id',
13
+ * name: 'task_name',
14
+ * startTime: 'start_date',
15
+ * endTime: 'end_date',
16
+ * }
17
+ * });
18
+ * ```
19
+ */
20
+ export declare function useGanttData(options: {
21
+ data: Ref<any[]> | any[];
22
+ parsing: ParsingConfig;
23
+ }): import('vue').ComputedRef<import('apexgantt').TaskInput[]>;
@@ -0,0 +1,6 @@
1
+ export { default as ApexGanttChart } from './components/ApexGanttChart.vue';
2
+ export type { ApexGanttChartProps, ApexGanttChartEmits, ApexGanttChartExpose, } from './components/ApexGanttChart.vue';
3
+ export { useGanttData } from './composables/useGanttData';
4
+ export { setApexGanttLicense } from './utils/license';
5
+ export type { Annotation, GanttUserOptions, TaskInput, TaskType, ThemeMode, GanttTheme, ParsingConfig, ParsingValue, TaskUpdateEventDetail, TaskValidationErrorEventDetail, TaskUpdateSuccessEventDetail, TaskUpdateErrorEventDetail, TaskDraggedEventDetail, TaskResizedEventDetail, } from 'apexgantt';
6
+ export { ViewMode, ColumnKey, GanttEvents, LightTheme, DarkTheme, getTheme, DataParser, } from 'apexgantt';
@@ -0,0 +1,12 @@
1
+ /**
2
+ * set the ApexGantt license key
3
+ * call this once at app initialization before rendering any charts
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * import { setApexGanttLicense } from 'vue-apexgantt';
8
+ *
9
+ * setApexGanttLicense('your-license-key-here');
10
+ * ```
11
+ */
12
+ export declare function setApexGanttLicense(key: string): void;
@@ -0,0 +1,137 @@
1
+ import { defineComponent as S, ref as E, computed as c, watch as u, onMounted as _, onBeforeUnmount as x, createElementBlock as D, openBlock as L, normalizeStyle as R, normalizeClass as U } from "vue";
2
+ import h, { GanttEvents as o, DataParser as C } from "apexgantt";
3
+ import { ColumnKey as V, DarkTheme as B, DataParser as N, GanttEvents as $, LightTheme as Z, ViewMode as j, getTheme as q } from "apexgantt";
4
+ const K = /* @__PURE__ */ S({
5
+ __name: "ApexGanttChart",
6
+ props: {
7
+ tasks: {},
8
+ options: {},
9
+ width: { default: "100%" },
10
+ height: { default: "500px" },
11
+ viewMode: { default: "month" },
12
+ theme: { default: "light" },
13
+ className: { default: "" },
14
+ style: {}
15
+ },
16
+ emits: ["taskUpdate", "taskUpdateSuccess", "taskValidationError", "taskUpdateError", "taskDragged", "taskResized"],
17
+ setup(s, { expose: p, emit: i }) {
18
+ const t = s, r = i, d = E(null), n = E(null), g = c(
19
+ () => ({
20
+ width: typeof t.width == "number" ? `${t.width}px` : t.width,
21
+ height: typeof t.height == "number" ? `${t.height}px` : t.height,
22
+ ...t.style
23
+ })
24
+ ), v = c(
25
+ () => ({
26
+ series: t.tasks,
27
+ viewMode: t.viewMode,
28
+ theme: t.theme,
29
+ width: t.width,
30
+ height: t.height,
31
+ ...t.options
32
+ })
33
+ ), k = () => {
34
+ if (!d.value) return;
35
+ const e = d.value;
36
+ e.addEventListener(o.TASK_UPDATE, (a) => {
37
+ r("taskUpdate", a.detail);
38
+ }), e.addEventListener(o.TASK_UPDATE_SUCCESS, (a) => {
39
+ r("taskUpdateSuccess", a.detail);
40
+ }), e.addEventListener(o.TASK_VALIDATION_ERROR, (a) => {
41
+ r("taskValidationError", a.detail);
42
+ }), e.addEventListener(o.TASK_UPDATE_ERROR, (a) => {
43
+ r("taskUpdateError", a.detail);
44
+ }), e.addEventListener(o.TASK_DRAGGED, (a) => {
45
+ r("taskDragged", a.detail);
46
+ }), e.addEventListener(o.TASK_RESIZED, (a) => {
47
+ r("taskResized", a.detail);
48
+ });
49
+ }, A = () => {
50
+ d.value && (n.value && n.value.destroy(), n.value = new h(d.value, v.value), n.value.render(), k());
51
+ }, l = (e) => {
52
+ var a;
53
+ (a = n.value) == null || a.update({
54
+ ...v.value,
55
+ ...e
56
+ });
57
+ }, y = (e, a) => {
58
+ var f;
59
+ (f = n.value) == null || f.updateTask(e, a);
60
+ }, w = () => {
61
+ var e;
62
+ (e = n.value) == null || e.zoomIn();
63
+ }, T = () => {
64
+ var e;
65
+ (e = n.value) == null || e.zoomOut();
66
+ }, m = () => {
67
+ var e;
68
+ (e = n.value) == null || e.destroy(), n.value = null;
69
+ };
70
+ return p({
71
+ update: l,
72
+ updateTask: y,
73
+ zoomIn: w,
74
+ zoomOut: T,
75
+ destroy: m,
76
+ getInstance: () => n.value
77
+ }), u(
78
+ () => t.tasks,
79
+ () => {
80
+ l({ series: t.tasks });
81
+ },
82
+ { deep: !0 }
83
+ ), u(
84
+ () => t.viewMode,
85
+ (e) => {
86
+ l({ viewMode: e });
87
+ }
88
+ ), u(
89
+ () => t.theme,
90
+ (e) => {
91
+ l({ theme: e });
92
+ }
93
+ ), u(
94
+ () => t.options,
95
+ (e) => {
96
+ l(e || {});
97
+ },
98
+ { deep: !0 }
99
+ ), _(() => {
100
+ A();
101
+ }), x(() => {
102
+ m();
103
+ }), (e, a) => (L(), D("div", {
104
+ ref_key: "chartContainer",
105
+ ref: d,
106
+ class: U(s.className),
107
+ style: R(g.value)
108
+ }, null, 6));
109
+ }
110
+ });
111
+ function M(s) {
112
+ return c(() => {
113
+ const i = Array.isArray(s.data) ? s.data : s.data.value;
114
+ if (!i || i.length === 0)
115
+ return [];
116
+ try {
117
+ return C.parse(i, s.parsing);
118
+ } catch (t) {
119
+ return console.error("Error parsing gantt data:", t), [];
120
+ }
121
+ });
122
+ }
123
+ function O(s) {
124
+ typeof h.setLicense == "function" ? h.setLicense(s) : console.warn("ApexGantt.setLicense is not available. Please ensure you are using a compatible version of apexgantt.");
125
+ }
126
+ export {
127
+ K as ApexGanttChart,
128
+ V as ColumnKey,
129
+ B as DarkTheme,
130
+ N as DataParser,
131
+ $ as GanttEvents,
132
+ Z as LightTheme,
133
+ j as ViewMode,
134
+ q as getTheme,
135
+ O as setApexGanttLicense,
136
+ M as useGanttData
137
+ };
@@ -0,0 +1 @@
1
+ (function(n,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("apexgantt")):typeof define=="function"&&define.amd?define(["exports","vue","apexgantt"],t):(n=typeof globalThis<"u"?globalThis:n||self,t(n.VueApexGantt={},n.Vue,n.ApexGantt))})(this,function(n,t,r){"use strict";const p=t.defineComponent({__name:"ApexGanttChart",props:{tasks:{},options:{},width:{default:"100%"},height:{default:"500px"},viewMode:{default:"month"},theme:{default:"light"},className:{default:""},style:{}},emits:["taskUpdate","taskUpdateSuccess","taskValidationError","taskUpdateError","taskDragged","taskResized"],setup(o,{expose:h,emit:u}){const a=o,d=u,l=t.ref(null),i=t.ref(null),y=t.computed(()=>({width:typeof a.width=="number"?`${a.width}px`:a.width,height:typeof a.height=="number"?`${a.height}px`:a.height,...a.style})),f=t.computed(()=>({series:a.tasks,viewMode:a.viewMode,theme:a.theme,width:a.width,height:a.height,...a.options})),k=()=>{if(!l.value)return;const e=l.value;e.addEventListener(r.GanttEvents.TASK_UPDATE,s=>{d("taskUpdate",s.detail)}),e.addEventListener(r.GanttEvents.TASK_UPDATE_SUCCESS,s=>{d("taskUpdateSuccess",s.detail)}),e.addEventListener(r.GanttEvents.TASK_VALIDATION_ERROR,s=>{d("taskValidationError",s.detail)}),e.addEventListener(r.GanttEvents.TASK_UPDATE_ERROR,s=>{d("taskUpdateError",s.detail)}),e.addEventListener(r.GanttEvents.TASK_DRAGGED,s=>{d("taskDragged",s.detail)}),e.addEventListener(r.GanttEvents.TASK_RESIZED,s=>{d("taskResized",s.detail)})},T=()=>{l.value&&(i.value&&i.value.destroy(),i.value=new r(l.value,f.value),i.value.render(),k())},c=e=>{var s;(s=i.value)==null||s.update({...f.value,...e})},w=(e,s)=>{var g;(g=i.value)==null||g.updateTask(e,s)},b=()=>{var e;(e=i.value)==null||e.zoomIn()},D=()=>{var e;(e=i.value)==null||e.zoomOut()},m=()=>{var e;(e=i.value)==null||e.destroy(),i.value=null};return h({update:c,updateTask:w,zoomIn:b,zoomOut:D,destroy:m,getInstance:()=>i.value}),t.watch(()=>a.tasks,()=>{c({series:a.tasks})},{deep:!0}),t.watch(()=>a.viewMode,e=>{c({viewMode:e})}),t.watch(()=>a.theme,e=>{c({theme:e})}),t.watch(()=>a.options,e=>{c(e||{})},{deep:!0}),t.onMounted(()=>{T()}),t.onBeforeUnmount(()=>{m()}),(e,s)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"chartContainer",ref:l,class:t.normalizeClass(o.className),style:t.normalizeStyle(y.value)},null,6))}});function v(o){return t.computed(()=>{const u=Array.isArray(o.data)?o.data:o.data.value;if(!u||u.length===0)return[];try{return r.DataParser.parse(u,o.parsing)}catch(a){return console.error("Error parsing gantt data:",a),[]}})}function E(o){typeof r.setLicense=="function"?r.setLicense(o):console.warn("ApexGantt.setLicense is not available. Please ensure you are using a compatible version of apexgantt.")}Object.defineProperty(n,"ColumnKey",{enumerable:!0,get:()=>r.ColumnKey}),Object.defineProperty(n,"DarkTheme",{enumerable:!0,get:()=>r.DarkTheme}),Object.defineProperty(n,"DataParser",{enumerable:!0,get:()=>r.DataParser}),Object.defineProperty(n,"GanttEvents",{enumerable:!0,get:()=>r.GanttEvents}),Object.defineProperty(n,"LightTheme",{enumerable:!0,get:()=>r.LightTheme}),Object.defineProperty(n,"ViewMode",{enumerable:!0,get:()=>r.ViewMode}),Object.defineProperty(n,"getTheme",{enumerable:!0,get:()=>r.getTheme}),n.ApexGanttChart=p,n.setApexGanttLicense=E,n.useGanttData=v,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
package/package.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "vue-apexgantt",
3
+ "version": "1.0.0",
4
+ "description": "Vue 3 wrapper for ApexGantt - Interactive Gantt chart library",
5
+ "type": "module",
6
+ "main": "./dist/vue-apexgantt.umd.js",
7
+ "module": "./dist/vue-apexgantt.es.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/vue-apexgantt.es.js"
14
+ },
15
+ "require": {
16
+ "types": "./dist/index.d.ts",
17
+ "default": "./dist/vue-apexgantt.umd.js"
18
+ }
19
+ }
20
+ },
21
+ "files": [
22
+ "dist",
23
+ "LICENSE"
24
+ ],
25
+ "scripts": {
26
+ "dev": "vite",
27
+ "build": "vite build",
28
+ "preview": "vite preview",
29
+ "type-check": "vue-tsc --noEmit"
30
+ },
31
+ "peerDependencies": {
32
+ "vue": "^3.3.0"
33
+ },
34
+ "dependencies": {
35
+ "apexgantt": "^3.4.1"
36
+ },
37
+ "devDependencies": {
38
+ "@types/node": "^20.0.0",
39
+ "@vitejs/plugin-vue": "^5.0.0",
40
+ "typescript": "^5.3.0",
41
+ "vite": "^5.0.0",
42
+ "vite-plugin-dts": "^3.7.0",
43
+ "vue": "^3.4.0",
44
+ "vue-tsc": "^2.0.0"
45
+ },
46
+ "keywords": [
47
+ "vue",
48
+ "vue3",
49
+ "gantt",
50
+ "gantt-chart",
51
+ "apexgantt",
52
+ "timeline",
53
+ "project-management"
54
+ ],
55
+ "author": "",
56
+ "repository": {
57
+ "type": "git",
58
+ "url": ""
59
+ }
60
+ }