tg-ganttchart 0.0.1

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.
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ presets: [
3
+ '@vue/cli-plugin-babel/preset'
4
+ ]
5
+ }
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "tg-ganttchart",
3
+ "version": "0.0.1",
4
+ "description": "Vue js compnonet for dynamic list in which we can provide and schema and data. It will render the table view according to the dynamic fields",
5
+ "main": "./dist/tgganttchart.umd.cjs",
6
+ "module": "./dist/tgganttchart.es.js",
7
+ "export": {
8
+ ".": {
9
+ "require": "./dist/tgganttchart.umd.cjs",
10
+ "import": "./dist/tgganttchart.es.js"
11
+ }
12
+ },
13
+ "private": false,
14
+ "scripts": {
15
+ "serve": "vue-cli-service serve",
16
+ "build": "vue-cli-service build --target lib --name tgganttchart ./src/index.js"
17
+ },
18
+ "dependencies": {
19
+ "core-js": "^3.8.3",
20
+ "dayjs": "^1.11.13",
21
+ "resize-observer-polyfill": "^1.5.1",
22
+ "vue": "^2.6.10",
23
+ "vue-loader": "^15.11.1",
24
+ "vue-slider-component": "^3.0.31",
25
+ "vue-switches": "^2.0.1",
26
+ "vue-template-compiler": "^2.6.10"
27
+ },
28
+ "devDependencies": {
29
+ "@babel/core": "^7.12.16",
30
+ "@babel/eslint-parser": "^7.12.16",
31
+ "@types/chai": "^4.2.2",
32
+ "@types/cypress": "^1.1.3",
33
+ "@types/mocha": "^5.2.7",
34
+ "@vue/cli-plugin-babel": "~5.0.0",
35
+ "@vue/cli-plugin-eslint": "~5.0.0",
36
+ "@vue/cli-service": "~5.0.0",
37
+ "cypress": "^3.4.1",
38
+ "eslint": "^7.32.0",
39
+ "eslint-plugin-vue": "^8.7.1"
40
+ },
41
+ "eslintConfig": {
42
+ "root": true,
43
+ "env": {
44
+ "node": true
45
+ },
46
+ "extends": [
47
+ "plugin:vue/vue3-essential",
48
+ "eslint:recommended"
49
+ ],
50
+ "parserOptions": {
51
+ "parser": "@babel/eslint-parser"
52
+ },
53
+ "rules": {}
54
+ },
55
+ "browserslist": [
56
+ "> 1%",
57
+ "last 2 versions",
58
+ "not dead",
59
+ "not ie 11"
60
+ ],
61
+ "keywords": [],
62
+ "author": "",
63
+ "license": "ISC"
64
+ }
@@ -0,0 +1,349 @@
1
+ <template>
2
+
3
+ <gantt-elastic :tasks="tasks" :options="options" :dynamicStyle="dynamicStyle">
4
+ <component v-if="components.header" :is="components.header" slot="header"></component>
5
+ <component v-if="components.footer" :is="components.footer" slot="footer"></component>
6
+ <gantt-header slot="header"></gantt-header>
7
+ </gantt-elastic>
8
+ </template>
9
+
10
+ <script>
11
+ import GanttElastic from './GanttElastic.vue';
12
+ import GanttHeader from './components/Header/Header.vue';
13
+ import dayjs from "dayjs";
14
+
15
+ function getDate(hours) {
16
+ const currentDate = new Date();
17
+ const currentYear = currentDate.getFullYear();
18
+ const currentMonth = currentDate.getMonth();
19
+ const currentDay = currentDate.getDate();
20
+ const timeStamp = new Date(
21
+ currentYear,
22
+ currentMonth,
23
+ currentDay,
24
+ 0,
25
+ 0,
26
+ 0
27
+ ).getTime();
28
+ return new Date(timeStamp + hours * 60 * 60 * 1000).getTime();
29
+ }
30
+
31
+ export default {
32
+ name: 'GanttElasticStandalone',
33
+ components: {
34
+ 'gantt-elastic': GanttElastic,
35
+ 'gantt-header': GanttHeader
36
+ },
37
+ props: {
38
+ header: {
39
+ type: Object,
40
+ default: () => ({}),
41
+ },
42
+ footer: {
43
+ type: Object,
44
+ default: () => ({}),
45
+ },
46
+ },
47
+ data() {
48
+ return {
49
+ components: {
50
+ header: this.header,
51
+ footer: this.footer,
52
+ },
53
+ tasks: [
54
+ {
55
+ id: 1,
56
+ label: "Make some noise",
57
+ user:
58
+ '<a href="https://www.google.com/search?q=John+Doe" target="_blank" style="color:#0077c0;">John Doe</a>',
59
+ start: getDate(-24 * 5),
60
+ duration: 15 * 24 * 60 * 60 * 1000,
61
+ percent: 10,
62
+ type: "project"
63
+ //collapsed: true,
64
+ },
65
+ {
66
+ id: 2,
67
+ label: "With great power comes great responsibility",
68
+ user:
69
+ '<a href="https://www.google.com/search?q=Peter+Parker" target="_blank" style="color:#0077c0;">Peter Parker</a>',
70
+ parentId: 1,
71
+ start: getDate(-24 * 4),
72
+ duration: 4 * 24 * 60 * 60 * 1000,
73
+ percent: 50,
74
+ type: "milestone",
75
+ collapsed: true,
76
+ style: {
77
+ base: {
78
+ fill: "#1EBC61",
79
+ stroke: "#0EAC51"
80
+ }
81
+ }
82
+ },
83
+ {
84
+ id: 3,
85
+ label: "Courage is being scared to death, but saddling up anyway.",
86
+ user:
87
+ '<a href="https://www.google.com/search?q=John+Wayne" target="_blank" style="color:#0077c0;">John Wayne</a>',
88
+ parentId: 2,
89
+ start: getDate(-24 * 3),
90
+ duration: 2 * 24 * 60 * 60 * 1000,
91
+ percent: 100,
92
+ type: "task"
93
+ },
94
+ {
95
+ id: 4,
96
+ label: "Put that toy AWAY!",
97
+ user:
98
+ '<a href="https://www.google.com/search?q=Clark+Kent" target="_blank" style="color:#0077c0;">Clark Kent</a>',
99
+ start: getDate(-24 * 2),
100
+ duration: 2 * 24 * 60 * 60 * 1000,
101
+ percent: 50,
102
+ type: "task",
103
+ dependentOn: [3]
104
+ },
105
+ {
106
+ id: 5,
107
+ label:
108
+ "One billion, gajillion, fafillion... shabadylu...mil...shabady......uh, Yen.",
109
+ user:
110
+ '<a href="https://www.google.com/search?q=Austin+Powers" target="_blank" style="color:#0077c0;">Austin Powers</a>',
111
+ parentId: 4,
112
+ start: getDate(0),
113
+ duration: 2 * 24 * 60 * 60 * 1000,
114
+ percent: 10,
115
+ type: "milestone",
116
+ style: {
117
+ base: {
118
+ fill: "#0287D0",
119
+ stroke: "#0077C0"
120
+ }
121
+ }
122
+ },
123
+ {
124
+ id: 6,
125
+ label: "Butch Mario and the Luigi Kid",
126
+ user:
127
+ '<a href="https://www.google.com/search?q=Mario+Bros" target="_blank" style="color:#0077c0;">Mario Bros</a>',
128
+ parentId: 5,
129
+ start: getDate(24),
130
+ duration: 1 * 24 * 60 * 60 * 1000,
131
+ percent: 50,
132
+ type: "task",
133
+ collapsed: true,
134
+ style: {
135
+ base: {
136
+ fill: "#8E44AD",
137
+ stroke: "#7E349D"
138
+ }
139
+ }
140
+ },
141
+ {
142
+ id: 7,
143
+ label: "Devon, the old man wanted me, it was his dying request",
144
+ user:
145
+ '<a href="https://www.google.com/search?q=Knight+Rider" target="_blank" style="color:#0077c0;">Knight Rider</a>',
146
+ parentId: 2,
147
+ dependentOn: [6],
148
+ start: getDate(24 * 2),
149
+ duration: 4 * 60 * 60 * 1000,
150
+ percent: 20,
151
+ type: "task",
152
+ collapsed: true
153
+ },
154
+ {
155
+ id: 8,
156
+ label: "Hey, Baby! Anybody ever tell you I have beautiful eyes?",
157
+ user:
158
+ '<a href="https://www.google.com/search?q=Johhny+Bravo" target="_blank" style="color:#0077c0;">Johhny Bravo</a>',
159
+ parentId: 7,
160
+ dependentOn: [7],
161
+ start: getDate(24 * 3),
162
+ duration: 1 * 24 * 60 * 60 * 1000,
163
+ percent: 0,
164
+ type: "task"
165
+ },
166
+ {
167
+ id: 9,
168
+ label:
169
+ "This better be important, woman. You are interrupting my very delicate calculations.",
170
+ user:
171
+ '<a href="https://www.google.com/search?q=Dexter\'s+Laboratory" target="_blank" style="color:#0077c0;">Dexter\'s Laboratory</a>',
172
+ parentId: 8,
173
+ dependentOn: [8, 7],
174
+ start: getDate(24 * 4),
175
+ duration: 4 * 60 * 60 * 1000,
176
+ percent: 20,
177
+ type: "task",
178
+ style: {
179
+ base: {
180
+ fill: "#8E44AD",
181
+ stroke: "#7E349D"
182
+ }
183
+ }
184
+ },
185
+ {
186
+ id: 10,
187
+ label: "current task",
188
+ user:
189
+ '<a href="https://www.google.com/search?q=Johnattan+Owens" target="_blank" style="color:#0077c0;">Johnattan Owens</a>',
190
+ start: getDate(24 * 5),
191
+ duration: 24 * 60 * 60 * 1000,
192
+ percent: 0,
193
+ type: "task"
194
+ },
195
+ {
196
+ id: 11,
197
+ label: "test task",
198
+ user:
199
+ '<a href="https://www.google.com/search?q=Johnattan+Owens" target="_blank" style="color:#0077c0;">Johnattan Owens</a>',
200
+ start: getDate(24 * 6),
201
+ duration: 24 * 60 * 60 * 1000,
202
+ percent: 0,
203
+ type: "task"
204
+ },
205
+ {
206
+ id: 12,
207
+ label: "test task",
208
+ user:
209
+ '<a href="https://www.google.com/search?q=Johnattan+Owens" target="_blank" style="color:#0077c0;">Johnattan Owens</a>',
210
+ start: getDate(24 * 7),
211
+ duration: 24 * 60 * 60 * 1000,
212
+ percent: 0,
213
+ type: "task",
214
+ parentId: 11
215
+ },
216
+ {
217
+ id: 13,
218
+ label: "test task",
219
+ user:
220
+ '<a href="https://www.google.com/search?q=Johnattan+Owens" target="_blank" style="color:#0077c0;">Johnattan Owens</a>',
221
+ start: getDate(24 * 8),
222
+ duration: 24 * 60 * 60 * 1000,
223
+ percent: 0,
224
+ type: "task"
225
+ },
226
+ {
227
+ id: 14,
228
+ label: "test task",
229
+ user:
230
+ '<a href="https://www.google.com/search?q=Johnattan+Owens" target="_blank" style="color:#0077c0;">Johnattan Owens</a>',
231
+ start: getDate(24 * 9),
232
+ duration: 24 * 60 * 60 * 1000,
233
+ percent: 0,
234
+ type: "task"
235
+ },
236
+ {
237
+ id: 15,
238
+ label: "test task",
239
+ user:
240
+ '<a href="https://www.google.com/search?q=Johnattan+Owens" target="_blank" style="color:#0077c0;">Johnattan Owens</a>',
241
+ start: getDate(24 * 16),
242
+ duration: 24 * 60 * 60 * 1000,
243
+ percent: 0,
244
+ type: "task"
245
+ }
246
+ ],
247
+ options: {
248
+ taskMapping: {
249
+ progress: "percent"
250
+ },
251
+ maxRows: 100,
252
+ maxHeight: 500,
253
+ title: {
254
+ label: "Your project title as html (link or whatever...)",
255
+ html: false
256
+ },
257
+ row: {
258
+ height: 24
259
+ },
260
+ calendar: {
261
+ hour: {
262
+ display: true
263
+ }
264
+ },
265
+ chart: {
266
+ progress: {
267
+ bar: false
268
+ },
269
+ expander: {
270
+ display: true
271
+ }
272
+ },
273
+ taskList: {
274
+ expander: {
275
+ straight: false
276
+ },
277
+ columns: [
278
+ {
279
+ id: 1,
280
+ label: "ID",
281
+ value: "id",
282
+ width: 10
283
+ },
284
+ {
285
+ id: 2,
286
+ label: "Description",
287
+ value: "label",
288
+ width: 200,
289
+ expander: true,
290
+ html: true,
291
+ events: {
292
+ click({ data }) {
293
+ alert("description clicked!\n" + data.label);
294
+ }
295
+ }
296
+ },
297
+ {
298
+ id: 3,
299
+ label: "Assigned to",
300
+ value: "user",
301
+ width: 130,
302
+ html: true
303
+ },
304
+ {
305
+ id: 3,
306
+ label: "Start",
307
+ value: task => dayjs(task.start).format("YYYY-MM-DD"),
308
+ width: 78
309
+ },
310
+ {
311
+ id: 4,
312
+ label: "Type",
313
+ value: "type",
314
+ width: 68
315
+ },
316
+ {
317
+ id: 5,
318
+ label: "%",
319
+ value: "progress",
320
+ width: 35,
321
+ style: {
322
+ "task-list-header-label": {
323
+ "text-align": "center",
324
+ width: "100%"
325
+ },
326
+ "task-list-item-value-container": {
327
+ "text-align": "center",
328
+ width: "100%"
329
+ }
330
+ }
331
+ }
332
+ ]
333
+ },
334
+ locale: {
335
+ name: "en",
336
+ Now: "Now",
337
+ "X-Scale": "Zoom-X",
338
+ "Y-Scale": "Zoom-Y",
339
+ "Task list width": "Task list",
340
+ "Before/After": "Expand",
341
+ "Display task list": "Task list"
342
+ }
343
+ }
344
+ ,
345
+ dynamicStyle: {},
346
+ };
347
+ },
348
+ };
349
+ </script>