@worktile/gantt 12.0.1 → 12.0.2

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 (230) hide show
  1. package/README.md +13 -116
  2. package/bundles/worktile-gantt.umd.js +3303 -0
  3. package/bundles/worktile-gantt.umd.js.map +1 -0
  4. package/class/date-point.d.ts +15 -0
  5. package/{packages/gantt/src/class/event.ts → class/event.d.ts} +6 -12
  6. package/class/group.d.ts +22 -0
  7. package/{packages/gantt/src/class/index.ts → class/index.d.ts} +0 -0
  8. package/class/item.d.ts +70 -0
  9. package/class/view-type.d.ts +7 -0
  10. package/components/bar/bar-drag.d.ts +37 -0
  11. package/components/bar/bar.component.d.ts +26 -0
  12. package/components/calendar/calendar.component.d.ts +28 -0
  13. package/components/drag-backdrop/drag-backdrop.component.d.ts +9 -0
  14. package/components/icon/icon.component.d.ts +13 -0
  15. package/components/icon/icons.d.ts +8 -0
  16. package/components/links/links.component.d.ts +47 -0
  17. package/components/main/gantt-main.component.d.ts +21 -0
  18. package/components/range/range.component.d.ts +13 -0
  19. package/components/table/gantt-table.component.d.ts +36 -0
  20. package/esm2015/class/date-point.js +10 -0
  21. package/esm2015/class/event.js +13 -0
  22. package/esm2015/class/group.js +17 -0
  23. package/esm2015/class/index.js +6 -0
  24. package/esm2015/class/item.js +78 -0
  25. package/esm2015/class/view-type.js +9 -0
  26. package/esm2015/components/bar/bar-drag.js +264 -0
  27. package/esm2015/components/bar/bar.component.js +98 -0
  28. package/esm2015/components/calendar/calendar.component.js +86 -0
  29. package/esm2015/components/drag-backdrop/drag-backdrop.component.js +21 -0
  30. package/esm2015/components/icon/icon.component.js +38 -0
  31. package/esm2015/components/icon/icons.js +87 -0
  32. package/esm2015/components/links/links.component.js +213 -0
  33. package/esm2015/components/main/gantt-main.component.js +53 -0
  34. package/esm2015/components/range/range.component.js +37 -0
  35. package/esm2015/components/table/gantt-table.component.js +146 -0
  36. package/esm2015/gantt-abstract.js +3 -0
  37. package/esm2015/gantt-dom.service.js +103 -0
  38. package/esm2015/gantt-drag-container.js +59 -0
  39. package/esm2015/gantt-item-upper.js +58 -0
  40. package/esm2015/gantt-print.service.js +94 -0
  41. package/esm2015/gantt-upper.js +254 -0
  42. package/esm2015/gantt.component.js +131 -0
  43. package/esm2015/gantt.module.js +74 -0
  44. package/esm2015/gantt.pipe.js +43 -0
  45. package/esm2015/gantt.styles.js +15 -0
  46. package/esm2015/public-api.js +18 -0
  47. package/esm2015/root.component.js +123 -0
  48. package/esm2015/table/gantt-column.component.js +37 -0
  49. package/esm2015/table/gantt-table.component.js +20 -0
  50. package/esm2015/utils/date.js +160 -0
  51. package/esm2015/utils/helpers.js +55 -0
  52. package/esm2015/views/day.js +54 -0
  53. package/esm2015/views/factory.js +23 -0
  54. package/esm2015/views/month.js +48 -0
  55. package/esm2015/views/quarter.js +51 -0
  56. package/esm2015/views/view.js +121 -0
  57. package/esm2015/views/week.js +49 -0
  58. package/esm2015/views/year.js +50 -0
  59. package/esm2015/worktile-gantt.js +5 -0
  60. package/fesm2015/worktile-gantt.js +2637 -0
  61. package/fesm2015/worktile-gantt.js.map +1 -0
  62. package/{packages/gantt/src/gantt-abstract.ts → gantt-abstract.d.ts} +1 -3
  63. package/gantt-dom.service.d.ts +32 -0
  64. package/gantt-drag-container.d.ts +23 -0
  65. package/gantt-item-upper.d.ts +20 -0
  66. package/gantt-print.service.d.ts +13 -0
  67. package/gantt-upper.d.ts +64 -0
  68. package/gantt.component.d.ts +29 -0
  69. package/gantt.module.d.ts +21 -0
  70. package/gantt.pipe.d.ts +18 -0
  71. package/gantt.styles.d.ts +15 -0
  72. package/main.bundle.scss +645 -0
  73. package/package.json +16 -113
  74. package/{packages/gantt/src/public-api.ts → public-api.d.ts} +0 -4
  75. package/root.component.d.ts +28 -0
  76. package/table/gantt-column.component.d.ts +15 -0
  77. package/table/gantt-table.component.d.ts +10 -0
  78. package/utils/date.d.ts +59 -0
  79. package/utils/helpers.d.ts +12 -0
  80. package/views/day.d.ts +14 -0
  81. package/views/factory.d.ts +8 -0
  82. package/views/month.d.ts +12 -0
  83. package/views/quarter.d.ts +12 -0
  84. package/views/view.d.ts +56 -0
  85. package/views/week.d.ts +12 -0
  86. package/views/year.d.ts +12 -0
  87. package/worktile-gantt.d.ts +5 -0
  88. package/.all-contributorsrc +0 -53
  89. package/.angulardoc.json +0 -4
  90. package/.circleci/config.yml +0 -17
  91. package/.coveralls.yml +0 -1
  92. package/.docgenirc.js +0 -64
  93. package/.editorconfig +0 -22
  94. package/.prettierrc +0 -24
  95. package/.travis.yml +0 -23
  96. package/CHANGELOG.md +0 -564
  97. package/Dockerfile +0 -4
  98. package/LICENSE +0 -21
  99. package/angular.json +0 -136
  100. package/docs/guides/basic/components.md +0 -54
  101. package/docs/guides/basic/event.md +0 -70
  102. package/docs/guides/basic/index.md +0 -4
  103. package/docs/guides/basic/style.md +0 -68
  104. package/docs/guides/basic/type.md +0 -70
  105. package/docs/guides/basic/usage.md +0 -189
  106. package/docs/guides/index.md +0 -5
  107. package/docs/guides/intro/getting-started.md +0 -79
  108. package/docs/guides/intro/index.md +0 -51
  109. package/docs/index.md +0 -0
  110. package/example/browserslist +0 -12
  111. package/example/src/app/app-routing.module.ts +0 -26
  112. package/example/src/app/app.component.html +0 -2
  113. package/example/src/app/app.component.ts +0 -11
  114. package/example/src/app/app.module.ts +0 -57
  115. package/example/src/app/components/components.component.html +0 -6
  116. package/example/src/app/components/components.component.ts +0 -33
  117. package/example/src/app/configuration/parameters/api/zh-cn.js +0 -350
  118. package/example/src/app/configuration/parameters/doc/zh-cn.md +0 -5
  119. package/example/src/app/gantt/gantt.component.html +0 -51
  120. package/example/src/app/gantt/gantt.component.ts +0 -119
  121. package/example/src/app/gantt-advanced/component/flat.component.html +0 -30
  122. package/example/src/app/gantt-advanced/component/flat.component.ts +0 -72
  123. package/example/src/app/gantt-advanced/component/flat.scss +0 -31
  124. package/example/src/app/gantt-advanced/gantt-advanced.component.html +0 -32
  125. package/example/src/app/gantt-advanced/gantt-advanced.component.ts +0 -34
  126. package/example/src/app/gantt-advanced/mocks.ts +0 -158
  127. package/example/src/app/gantt-groups/gantt-groups.component.html +0 -42
  128. package/example/src/app/gantt-groups/gantt-groups.component.ts +0 -62
  129. package/example/src/app/gantt-range/gantt-range.component.html +0 -66
  130. package/example/src/app/gantt-range/gantt-range.component.ts +0 -67
  131. package/example/src/app/gantt-range/mocks.ts +0 -150
  132. package/example/src/app/helper.ts +0 -38
  133. package/example/src/assets/.gitkeep +0 -0
  134. package/example/src/environments/environment.prod.ts +0 -3
  135. package/example/src/environments/environment.ts +0 -16
  136. package/example/src/favicon.ico +0 -0
  137. package/example/src/index.html +0 -13
  138. package/example/src/main.ts +0 -12
  139. package/example/src/polyfills.ts +0 -63
  140. package/example/src/styles.scss +0 -56
  141. package/example/tsconfig.app.json +0 -18
  142. package/nginx.conf +0 -17
  143. package/packages/gantt/README.md +0 -24
  144. package/packages/gantt/karma.conf.js +0 -46
  145. package/packages/gantt/ng-package.json +0 -7
  146. package/packages/gantt/ng-package.prod.json +0 -7
  147. package/packages/gantt/package.json +0 -16
  148. package/packages/gantt/src/class/date-point.ts +0 -14
  149. package/packages/gantt/src/class/group.ts +0 -36
  150. package/packages/gantt/src/class/item.ts +0 -129
  151. package/packages/gantt/src/class/test/group.spec.ts +0 -21
  152. package/packages/gantt/src/class/test/item.spec.ts +0 -102
  153. package/packages/gantt/src/class/view-type.ts +0 -7
  154. package/packages/gantt/src/components/bar/bar-drag.ts +0 -298
  155. package/packages/gantt/src/components/bar/bar.component.html +0 -17
  156. package/packages/gantt/src/components/bar/bar.component.scss +0 -169
  157. package/packages/gantt/src/components/bar/bar.component.ts +0 -109
  158. package/packages/gantt/src/components/bar/test/bar.component.spec.ts +0 -54
  159. package/packages/gantt/src/components/bar/test/bar.drag.spec.ts +0 -196
  160. package/packages/gantt/src/components/calendar/calendar.component.html +0 -52
  161. package/packages/gantt/src/components/calendar/calendar.component.scss +0 -77
  162. package/packages/gantt/src/components/calendar/calendar.component.ts +0 -100
  163. package/packages/gantt/src/components/drag-backdrop/drag-backdrop.component.html +0 -6
  164. package/packages/gantt/src/components/drag-backdrop/drag-backdrop.component.scss +0 -48
  165. package/packages/gantt/src/components/drag-backdrop/drag-backdrop.component.ts +0 -13
  166. package/packages/gantt/src/components/icon/icon.component.scss +0 -13
  167. package/packages/gantt/src/components/icon/icon.component.ts +0 -28
  168. package/packages/gantt/src/components/icon/icons.ts +0 -86
  169. package/packages/gantt/src/components/links/links.component.html +0 -19
  170. package/packages/gantt/src/components/links/links.component.scss +0 -27
  171. package/packages/gantt/src/components/links/links.component.ts +0 -263
  172. package/packages/gantt/src/components/main/gantt-main.component.html +0 -35
  173. package/packages/gantt/src/components/main/gantt-main.component.ts +0 -35
  174. package/packages/gantt/src/components/range/range.component.html +0 -8
  175. package/packages/gantt/src/components/range/range.component.scss +0 -35
  176. package/packages/gantt/src/components/range/range.component.ts +0 -27
  177. package/packages/gantt/src/components/range/test/range.component.spec.ts +0 -80
  178. package/packages/gantt/src/components/table/gantt-table.component.html +0 -105
  179. package/packages/gantt/src/components/table/gantt-table.component.scss +0 -144
  180. package/packages/gantt/src/components/table/gantt-table.component.ts +0 -166
  181. package/packages/gantt/src/components/table/test/table.spec.ts +0 -129
  182. package/packages/gantt/src/gantt-dom.service.ts +0 -134
  183. package/packages/gantt/src/gantt-drag-container.ts +0 -73
  184. package/packages/gantt/src/gantt-item-upper.ts +0 -50
  185. package/packages/gantt/src/gantt-print.service.ts +0 -104
  186. package/packages/gantt/src/gantt-upper.ts +0 -289
  187. package/packages/gantt/src/gantt.component.html +0 -18
  188. package/packages/gantt/src/gantt.component.scss +0 -77
  189. package/packages/gantt/src/gantt.component.ts +0 -134
  190. package/packages/gantt/src/gantt.module.ts +0 -47
  191. package/packages/gantt/src/gantt.pipe.ts +0 -31
  192. package/packages/gantt/src/gantt.styles.ts +0 -28
  193. package/packages/gantt/src/root.component.html +0 -12
  194. package/packages/gantt/src/root.component.ts +0 -121
  195. package/packages/gantt/src/styles/index.scss +0 -9
  196. package/packages/gantt/src/styles/variables.scss +0 -46
  197. package/packages/gantt/src/table/gantt-column.component.ts +0 -25
  198. package/packages/gantt/src/table/gantt-table.component.ts +0 -14
  199. package/packages/gantt/src/table/test/table.spec.ts +0 -56
  200. package/packages/gantt/src/test/gantt.component.spec.ts +0 -404
  201. package/packages/gantt/src/test/mocks/data.ts +0 -303
  202. package/packages/gantt/src/test.ts +0 -21
  203. package/packages/gantt/src/utils/date.ts +0 -276
  204. package/packages/gantt/src/utils/helpers.ts +0 -66
  205. package/packages/gantt/src/utils/test/date.spec.ts +0 -105
  206. package/packages/gantt/src/utils/test/helpers.spec.ts +0 -73
  207. package/packages/gantt/src/utils/testing.ts +0 -64
  208. package/packages/gantt/src/views/day.ts +0 -74
  209. package/packages/gantt/src/views/factory.ts +0 -25
  210. package/packages/gantt/src/views/month.ts +0 -66
  211. package/packages/gantt/src/views/quarter.ts +0 -68
  212. package/packages/gantt/src/views/test/day.spec.ts +0 -45
  213. package/packages/gantt/src/views/test/factory.spec.ts +0 -41
  214. package/packages/gantt/src/views/test/mock.ts +0 -14
  215. package/packages/gantt/src/views/test/month.spec.ts +0 -45
  216. package/packages/gantt/src/views/test/quarter.spec.ts +0 -45
  217. package/packages/gantt/src/views/test/view.spec.ts +0 -144
  218. package/packages/gantt/src/views/test/week.spec.ts +0 -45
  219. package/packages/gantt/src/views/test/year.spec.ts +0 -45
  220. package/packages/gantt/src/views/view.ts +0 -186
  221. package/packages/gantt/src/views/week.ts +0 -66
  222. package/packages/gantt/src/views/year.ts +0 -62
  223. package/packages/gantt/tsconfig.lib.json +0 -20
  224. package/packages/gantt/tsconfig.lib.prod.json +0 -9
  225. package/packages/gantt/tsconfig.schematics.json +0 -25
  226. package/packages/gantt/tsconfig.spec.json +0 -17
  227. package/packages/gantt/tslint.json +0 -18
  228. package/scss-bundle.config.json +0 -7
  229. package/tsconfig.json +0 -26
  230. package/tslint.json +0 -51
@@ -1,303 +0,0 @@
1
- import { GanttDate } from './../../utils/date';
2
-
3
- export function getMockItems() {
4
- return [
5
- {
6
- id: 'item-0101',
7
- title: 'VERSION 0101',
8
- start: new GanttDate('2020-05-21 12:34:35').getUnixTime(),
9
- color: '#FF0000',
10
- children: [
11
- {
12
- id: 'item-child-0101',
13
- title: 'VERSION Children 0101',
14
- start: new GanttDate('2020-05-21 12:34:35').getUnixTime(),
15
- color: '#FF0000',
16
- linkable: false
17
- }
18
- ]
19
- },
20
- {
21
- id: 'item-0102',
22
- title: 'VERSION 0102',
23
- start: new GanttDate('2020-05-31 22:34:35').getUnixTime(),
24
- end: new GanttDate('2020-06-05 08:53:20').getUnixTime(),
25
- color: '#9ACD32',
26
- expandable: true
27
- },
28
- {
29
- id: 'item-0103',
30
- title: 'VERSION 0103',
31
- end: new GanttDate('2020-06-13 11:20:00').getUnixTime()
32
- },
33
- {
34
- id: 'item-0104',
35
- title: 'VERSION 0104',
36
-
37
- links: ['item-0301']
38
- },
39
- {
40
- id: 'item-0201',
41
- title: 'VERSION 0201'
42
- },
43
- {
44
- id: 'item-0202',
45
- title: 'VERSION 0202',
46
- start: new GanttDate('2020-06-02 02:21:15').getUnixTime(),
47
- end: new GanttDate('2020-06-25 01:06:40').getUnixTime(),
48
- links: ['item-0203'],
49
- color: 'rgb(52, 143, 228, 0.5)',
50
- barStyle: {
51
- border: '1px solid rgb(52, 143, 228)'
52
- }
53
- },
54
- {
55
- id: 'item-0203',
56
- title: 'VERSION 0203',
57
- start: new GanttDate('2020-05-23 20:07:55').getUnixTime(),
58
- end: new GanttDate('2020-06-10 00:00:00').getUnixTime(),
59
- links: ['item-0204']
60
- },
61
- {
62
- id: 'item-0204',
63
- title: 'VERSION 0204',
64
- start: new GanttDate('2020-06-02 02:21:15').getUnixTime(),
65
- end: new GanttDate('2020-06-18 02:26:40').getUnixTime(),
66
- links: ['item-0301', 'item-0402']
67
- },
68
-
69
- {
70
- id: 'item-0301',
71
- title: 'VERSION 0301',
72
- start: new GanttDate('2020-07-29 23:14:35').getUnixTime(),
73
- end: new GanttDate('2020-09-02 11:46:40').getUnixTime()
74
- },
75
- {
76
- id: 'item-0302',
77
- title: 'VERSION 0302',
78
- start: new GanttDate('2020-06-13 16:07:55').getUnixTime(),
79
- end: new GanttDate('2020-08-21 22:00:00').getUnixTime()
80
- },
81
- {
82
- id: 'item-0303',
83
- title: 'VERSION 0303',
84
- start: new GanttDate('2020-05-22 16:21:15').getUnixTime(),
85
- end: new GanttDate('2020-07-06 14:53:20').getUnixTime()
86
- },
87
- {
88
- id: 'item-0401',
89
- title: 'VERSION 0401',
90
- start: new GanttDate('2020-05-09 22:47:55').getUnixTime(),
91
- end: new GanttDate('2020-07-06 14:53:20').getUnixTime()
92
- },
93
- {
94
- id: 'item-0402',
95
- title: 'VERSION 0402',
96
- start: new GanttDate('2020-07-29 23:14:35').getUnixTime(),
97
- end: new GanttDate('2020-09-12 21:46:40').getUnixTime()
98
- },
99
- {
100
- id: 'item-0403',
101
- title: 'VERSION 0403',
102
- start: new GanttDate('2020-06-25 05:54:35').getUnixTime(),
103
- end: new GanttDate('2020-09-02 11:46:40').getUnixTime()
104
- },
105
- {
106
- id: 'item-0404',
107
- title: 'VERSION 0404',
108
- start: new GanttDate('2020-06-02 02:21:15').getUnixTime(),
109
- end: new GanttDate('2020-06-23 21:20:00').getUnixTime()
110
- },
111
- {
112
- id: 'item-0501',
113
- title: 'VERSION 0501',
114
- start: new GanttDate('2020-09-13 02:34:35').getUnixTime(),
115
- end: new GanttDate('2020-10-07 05:06:40').getUnixTime()
116
- },
117
- {
118
- id: 'item-0502',
119
- title: 'VERSION 0502',
120
- start: new GanttDate('2020-06-02 02:21:15').getUnixTime(),
121
- end: new GanttDate('2020-07-06 14:53:20').getUnixTime()
122
- },
123
- {
124
- id: 'item-0503',
125
- title: 'VERSION 0503',
126
- start: new GanttDate('2020-07-18 09:27:55').getUnixTime(),
127
- end: new GanttDate('2020-09-02 11:46:40').getUnixTime()
128
- }
129
- ];
130
- }
131
-
132
- export function getMockGroupItems() {
133
- return [
134
- {
135
- id: 'item-0101',
136
- title: 'VERSION 0101',
137
- start: new GanttDate('2020-05-21 12:34:35').getUnixTime(),
138
- group_id: '00001',
139
- color: '#FF0000',
140
- children: [
141
- {
142
- id: 'item-child-0101',
143
- title: 'VERSION Children 0101',
144
- start: new GanttDate('2020-05-21 12:34:35').getUnixTime(),
145
- group_id: '00001',
146
- color: '#FF0000',
147
- linkable: false
148
- }
149
- ]
150
- },
151
- {
152
- id: 'item-0102',
153
- title: 'VERSION 0102',
154
- start: new GanttDate('2020-05-31 22:34:35').getUnixTime(),
155
- end: new GanttDate('2020-06-05 08:53:20').getUnixTime(),
156
- color: '#9ACD32',
157
- group_id: '00001',
158
- expandable: true
159
- },
160
- {
161
- id: 'item-0103',
162
- title: 'VERSION 0103',
163
- end: new GanttDate('2020-06-13 11:20:00').getUnixTime(),
164
- group_id: '00001'
165
- },
166
- {
167
- id: 'item-0104',
168
- title: 'VERSION 0104',
169
- group_id: '00001',
170
- links: ['item-0301']
171
- },
172
- {
173
- id: 'item-0201',
174
- title: 'VERSION 0201',
175
- group_id: '00002'
176
- },
177
- {
178
- id: 'item-0202',
179
- title: 'VERSION 0202',
180
- start: new GanttDate('2020-06-02 02:21:15').getUnixTime(),
181
- end: new GanttDate('2020-06-25 01:06:40').getUnixTime(),
182
- group_id: '00002',
183
- links: ['item-0203'],
184
- color: 'rgb(52, 143, 228, 0.5)',
185
- barStyle: {
186
- border: '1px solid rgb(52, 143, 228)'
187
- }
188
- },
189
- {
190
- id: 'item-0203',
191
- title: 'VERSION 0203',
192
- start: new GanttDate('2020-05-23 20:07:55').getUnixTime(),
193
- end: new GanttDate('2020-06-10 00:00:00').getUnixTime(),
194
- group_id: '00002',
195
- links: ['item-0204']
196
- },
197
- {
198
- id: 'item-0204',
199
- title: 'VERSION 0204',
200
- start: new GanttDate('2020-06-02 02:21:15').getUnixTime(),
201
- end: new GanttDate('2020-06-18 02:26:40').getUnixTime(),
202
- group_id: '00002',
203
- links: ['item-0301', 'item-0402']
204
- },
205
-
206
- {
207
- id: 'item-0301',
208
- title: 'VERSION 0301',
209
- start: new GanttDate('2020-07-29 23:14:35').getUnixTime(),
210
- end: new GanttDate('2020-09-02 11:46:40').getUnixTime(),
211
- group_id: '00003'
212
- },
213
- {
214
- id: 'item-0302',
215
- title: 'VERSION 0302',
216
- start: new GanttDate('2020-06-13 16:07:55').getUnixTime(),
217
- end: new GanttDate('2020-08-21 22:00:00').getUnixTime(),
218
- group_id: '00003'
219
- },
220
- {
221
- id: 'item-0303',
222
- title: 'VERSION 0303',
223
- start: new GanttDate('2020-05-22 16:21:15').getUnixTime(),
224
- end: new GanttDate('2020-07-06 14:53:20').getUnixTime(),
225
- group_id: '00003'
226
- },
227
- {
228
- id: 'item-0401',
229
- title: 'VERSION 0401',
230
- start: new GanttDate('2020-05-09 22:47:55').getUnixTime(),
231
- end: new GanttDate('2020-07-06 14:53:20').getUnixTime(),
232
- group_id: '00004'
233
- },
234
- {
235
- id: 'item-0402',
236
- title: 'VERSION 0402',
237
- start: new GanttDate('2020-07-29 23:14:35').getUnixTime(),
238
- end: new GanttDate('2020-09-12 21:46:40').getUnixTime(),
239
- group_id: '00004'
240
- },
241
- {
242
- id: 'item-0403',
243
- title: 'VERSION 0403',
244
- start: new GanttDate('2020-06-25 05:54:35').getUnixTime(),
245
- end: new GanttDate('2020-09-02 11:46:40').getUnixTime(),
246
- group_id: '00004'
247
- },
248
- {
249
- id: 'item-0404',
250
- title: 'VERSION 0404',
251
- start: new GanttDate('2020-06-02 02:21:15').getUnixTime(),
252
- end: new GanttDate('2020-06-23 21:20:00').getUnixTime(),
253
- group_id: '00004'
254
- },
255
- {
256
- id: 'item-0501',
257
- title: 'VERSION 0501',
258
- start: new GanttDate('2020-09-13 02:34:35').getUnixTime(),
259
- end: new GanttDate('2020-10-07 05:06:40').getUnixTime(),
260
- group_id: '00005'
261
- },
262
- {
263
- id: 'item-0502',
264
- title: 'VERSION 0502',
265
- start: new GanttDate('2020-06-02 02:21:15').getUnixTime(),
266
- end: new GanttDate('2020-07-06 14:53:20').getUnixTime(),
267
- group_id: '00005'
268
- },
269
- {
270
- id: 'item-0503',
271
- title: 'VERSION 0503',
272
- start: new GanttDate('2020-07-18 09:27:55').getUnixTime(),
273
- end: new GanttDate('2020-09-02 11:46:40').getUnixTime(),
274
- group_id: '00005'
275
- }
276
- ];
277
- }
278
-
279
- export function getMockGroups() {
280
- return [
281
- {
282
- id: '00001',
283
- title: 'Project 1',
284
- class: 'test'
285
- },
286
- {
287
- id: '00002',
288
- title: 'Project 2'
289
- },
290
- {
291
- id: '00003',
292
- title: 'Project 3'
293
- },
294
- {
295
- id: '00004',
296
- title: 'Project 4'
297
- },
298
- {
299
- id: '00005',
300
- title: 'Project 5'
301
- }
302
- ];
303
- }
@@ -1,21 +0,0 @@
1
- // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2
-
3
- import 'zone.js';
4
- import 'zone.js/testing';
5
- import { getTestBed } from '@angular/core/testing';
6
- import {
7
- BrowserDynamicTestingModule,
8
- platformBrowserDynamicTesting
9
- } from '@angular/platform-browser-dynamic/testing';
10
-
11
- declare const require: any;
12
-
13
- // First, initialize the Angular testing environment.
14
- getTestBed().initTestEnvironment(
15
- BrowserDynamicTestingModule,
16
- platformBrowserDynamicTesting()
17
- );
18
- // Then we find all the tests.
19
- const context = require.context('./', true, /\.spec\.ts$/);
20
- // And load the modules.
21
- context.keys().map(context);
@@ -1,276 +0,0 @@
1
- import {
2
- addYears,
3
- addMonths,
4
- addDays,
5
- addWeeks,
6
- addQuarters,
7
- getUnixTime,
8
- startOfDay,
9
- startOfWeek,
10
- startOfMonth,
11
- startOfQuarter,
12
- startOfYear,
13
- endOfDay,
14
- endOfWeek,
15
- endOfMonth,
16
- endOfQuarter,
17
- endOfYear,
18
- format,
19
- fromUnixTime,
20
- getDaysInMonth,
21
- addSeconds,
22
- setDate,
23
- addMinutes,
24
- addHours,
25
- differenceInCalendarDays,
26
- isWeekend,
27
- getWeek,
28
- isToday,
29
- differenceInDays,
30
- differenceInCalendarQuarters,
31
- eachMonthOfInterval,
32
- eachWeekOfInterval,
33
- eachDayOfInterval
34
- } from 'date-fns';
35
-
36
- export {
37
- addYears,
38
- addMonths,
39
- addDays,
40
- addWeeks,
41
- addQuarters,
42
- getUnixTime,
43
- startOfDay,
44
- startOfWeek,
45
- startOfMonth,
46
- startOfQuarter,
47
- startOfYear,
48
- endOfDay,
49
- endOfWeek,
50
- endOfMonth,
51
- endOfQuarter,
52
- endOfYear,
53
- format,
54
- fromUnixTime,
55
- getDaysInMonth,
56
- addSeconds,
57
- setDate,
58
- addMinutes,
59
- addHours,
60
- differenceInCalendarDays,
61
- isWeekend,
62
- getWeek,
63
- isToday,
64
- differenceInDays,
65
- differenceInCalendarQuarters,
66
- eachMonthOfInterval,
67
- eachWeekOfInterval,
68
- eachDayOfInterval
69
- } from 'date-fns';
70
-
71
- export type GanttDateUtil = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
72
-
73
- export class GanttDate {
74
- value: Date;
75
-
76
- constructor(date?: Date | string | number) {
77
- if (date) {
78
- if (date instanceof Date) {
79
- this.value = date;
80
- } else if (typeof date === 'string' || typeof date === 'number') {
81
- if (date.toString().length < 13) {
82
- this.value = fromUnixTime(+date);
83
- } else {
84
- this.value = new Date(date);
85
- }
86
- } else {
87
- throw new Error(
88
- `The input date type is not supported expect Date | string
89
- | number | { date: number; with_time: 0 | 1}, actual ${JSON.stringify(date)}`
90
- );
91
- }
92
- } else {
93
- this.value = new Date();
94
- }
95
- }
96
-
97
- getYear(): number {
98
- return this.value.getFullYear();
99
- }
100
-
101
- getMonth(): number {
102
- return this.value.getMonth();
103
- }
104
-
105
- getDay(): number {
106
- return this.value.getDay();
107
- }
108
-
109
- getTime(): number {
110
- return this.value.getTime();
111
- }
112
-
113
- getDate(): number {
114
- return this.value.getDate();
115
- }
116
-
117
- getHours(): number {
118
- return this.value.getHours();
119
- }
120
-
121
- getMinutes(): number {
122
- return this.value.getMinutes();
123
- }
124
-
125
- getSeconds(): number {
126
- return this.value.getSeconds();
127
- }
128
-
129
- getMilliseconds(): number {
130
- return this.value.getMilliseconds();
131
- }
132
-
133
- getWeek(options: { locale?: Locale; weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6 } = { weekStartsOn: 1 }): number {
134
- return getWeek(this.value, options);
135
- }
136
-
137
- getDaysInMonth() {
138
- return getDaysInMonth(this.value);
139
- }
140
-
141
- getDaysInQuarter() {
142
- return differenceInCalendarDays(this.endOfQuarter().addSeconds(1).value, this.startOfQuarter().value);
143
- }
144
-
145
- getDaysInYear() {
146
- return differenceInCalendarDays(this.endOfYear().addSeconds(1).value, this.startOfYear().value);
147
- }
148
-
149
- setDate(dayOfMonth: number): GanttDate {
150
- return new GanttDate(setDate(this.value, dayOfMonth));
151
- }
152
-
153
- clone(): GanttDate {
154
- return new GanttDate(new Date(this.value));
155
- }
156
-
157
- add(amount: number, unit?: GanttDateUtil) {
158
- switch (unit) {
159
- case 'second':
160
- return new GanttDate(this.value).addSeconds(amount);
161
- case 'minute':
162
- return new GanttDate(this.value).addMinutes(amount);
163
- case 'hour':
164
- return new GanttDate(this.value).addHours(amount);
165
- case 'day':
166
- return new GanttDate(this.value).addDays(amount);
167
- case 'week':
168
- return new GanttDate(this.value).addWeeks(amount);
169
- case 'month':
170
- return new GanttDate(this.value).addMonths(amount);
171
- case 'quarter':
172
- return new GanttDate(this.value).addQuarters(amount);
173
- case 'year':
174
- return new GanttDate(this.value).addYears(amount);
175
- default:
176
- return new GanttDate(this.value).addSeconds(amount);
177
- }
178
- }
179
-
180
- addSeconds(amount: number): GanttDate {
181
- return new GanttDate(addSeconds(this.value, amount));
182
- }
183
-
184
- addMinutes(amount: number): GanttDate {
185
- return new GanttDate(addMinutes(this.value, amount));
186
- }
187
-
188
- addHours(amount: number): GanttDate {
189
- return new GanttDate(addHours(this.value, amount));
190
- }
191
-
192
- addDays(amount: number): GanttDate {
193
- return new GanttDate(addDays(this.value, amount));
194
- }
195
-
196
- addWeeks(amount: number) {
197
- return new GanttDate(addWeeks(this.value, amount));
198
- }
199
-
200
- addMonths(amount: number): GanttDate {
201
- return new GanttDate(addMonths(this.value, amount));
202
- }
203
-
204
- addQuarters(amount: number): GanttDate {
205
- return new GanttDate(addQuarters(this.value, amount));
206
- }
207
-
208
- addYears(amount: number): GanttDate {
209
- return new GanttDate(addYears(this.value, amount));
210
- }
211
-
212
- startOfDay(): GanttDate {
213
- return new GanttDate(startOfDay(this.value));
214
- }
215
-
216
- startOfWeek(options?: { locale?: Locale; weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6 }): GanttDate {
217
- return new GanttDate(startOfWeek(this.value, options));
218
- }
219
-
220
- startOfMonth(): GanttDate {
221
- return new GanttDate(startOfMonth(this.value));
222
- }
223
-
224
- startOfQuarter(): GanttDate {
225
- return new GanttDate(startOfQuarter(this.value));
226
- }
227
-
228
- startOfYear(): GanttDate {
229
- return new GanttDate(startOfYear(this.value));
230
- }
231
-
232
- endOfDay(): GanttDate {
233
- return new GanttDate(endOfDay(this.value));
234
- }
235
-
236
- endOfWeek(options?: { locale?: Locale; weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6 }): GanttDate {
237
- return new GanttDate(endOfWeek(this.value, options));
238
- }
239
-
240
- endOfMonth(): GanttDate {
241
- return new GanttDate(endOfMonth(this.value));
242
- }
243
-
244
- endOfQuarter(): GanttDate {
245
- return new GanttDate(endOfQuarter(this.value));
246
- }
247
-
248
- endOfYear(): GanttDate {
249
- return new GanttDate(endOfYear(this.value));
250
- }
251
-
252
- getUnixTime(): number {
253
- return getUnixTime(this.value);
254
- }
255
-
256
- format(
257
- mat: string,
258
- options?: {
259
- locale?: Locale;
260
- weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
261
- firstWeekContainsDate?: number;
262
- useAdditionalWeekYearTokens?: boolean;
263
- useAdditionalDayOfYearTokens?: boolean;
264
- }
265
- ) {
266
- return format(this.value, mat, options);
267
- }
268
-
269
- isWeekend() {
270
- return isWeekend(this.value);
271
- }
272
-
273
- isToday() {
274
- return isToday(this.value);
275
- }
276
- }
@@ -1,66 +0,0 @@
1
- import { GanttItem, GanttItemInternal } from '../class/item';
2
-
3
- export interface Dictionary<T = unknown> {
4
- [key: string]: T;
5
- }
6
-
7
- export function isNumber(value: any) {
8
- return typeof value === 'number';
9
- }
10
-
11
- export function isString(value: any) {
12
- return typeof value === 'string';
13
- }
14
-
15
- export function isUndefined(value: any) {
16
- return value === undefined;
17
- }
18
-
19
- export function hexToRgb(color: string, opacity = 1) {
20
- if (/^#/g.test(color)) {
21
- return `rgba(${parseInt(color.slice(1, 3), 16)},${parseInt(color.slice(3, 5), 16)},${parseInt(color.slice(5, 7), 16)},${opacity})`;
22
- } else {
23
- return color;
24
- }
25
- }
26
-
27
- export function uniqBy<T = unknown>(array: T[], key: keyof T) {
28
- const valuesMap: Dictionary<T> = {};
29
- const result = [];
30
- (array || []).forEach((value) => {
31
- const _key = value[key as string];
32
- if (!valuesMap[_key]) {
33
- valuesMap[_key] = value;
34
- result.push(value);
35
- }
36
- });
37
- return result;
38
- }
39
-
40
- export function flatten<T = unknown>(array: T[]) {
41
- return array.reduce((pre, cur) => {
42
- return pre.concat(Array.isArray(cur) ? flatten(cur) : cur);
43
- }, []);
44
- }
45
-
46
- export function recursiveItems(items: GanttItemInternal[]) {
47
- const result = [];
48
- (items || []).forEach((item) => {
49
- result.push(item);
50
- if (item.expanded && item.children) {
51
- result.push(...recursiveItems(item.children));
52
- }
53
- });
54
- return result;
55
- }
56
-
57
- export function getFlatItems(items: GanttItem[]) {
58
- const result = [];
59
- (items || []).forEach((item) => {
60
- result.push(item);
61
- if (item.children) {
62
- result.push(...getFlatItems(item.children));
63
- }
64
- });
65
- return result;
66
- }