@worktile/gantt 11.0.2 → 12.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.
Files changed (232) hide show
  1. package/.all-contributorsrc +53 -0
  2. package/.angulardoc.json +4 -0
  3. package/.circleci/config.yml +17 -0
  4. package/.coveralls.yml +1 -0
  5. package/.docgenirc.js +64 -0
  6. package/.editorconfig +22 -0
  7. package/.prettierrc +24 -0
  8. package/.travis.yml +23 -0
  9. package/CHANGELOG.md +564 -0
  10. package/Dockerfile +4 -0
  11. package/LICENSE +21 -0
  12. package/README.md +116 -13
  13. package/angular.json +136 -0
  14. package/docs/guides/basic/components.md +54 -0
  15. package/docs/guides/basic/event.md +70 -0
  16. package/docs/guides/basic/index.md +4 -0
  17. package/docs/guides/basic/style.md +68 -0
  18. package/docs/guides/basic/type.md +70 -0
  19. package/docs/guides/basic/usage.md +189 -0
  20. package/docs/guides/index.md +5 -0
  21. package/docs/guides/intro/getting-started.md +79 -0
  22. package/docs/guides/intro/index.md +51 -0
  23. package/docs/index.md +0 -0
  24. package/example/browserslist +12 -0
  25. package/example/src/app/app-routing.module.ts +26 -0
  26. package/example/src/app/app.component.html +2 -0
  27. package/example/src/app/app.component.ts +11 -0
  28. package/example/src/app/app.module.ts +57 -0
  29. package/example/src/app/components/components.component.html +6 -0
  30. package/example/src/app/components/components.component.ts +33 -0
  31. package/example/src/app/configuration/parameters/api/zh-cn.js +350 -0
  32. package/example/src/app/configuration/parameters/doc/zh-cn.md +5 -0
  33. package/example/src/app/gantt/gantt.component.html +51 -0
  34. package/example/src/app/gantt/gantt.component.ts +119 -0
  35. package/example/src/app/gantt-advanced/component/flat.component.html +30 -0
  36. package/example/src/app/gantt-advanced/component/flat.component.ts +72 -0
  37. package/example/src/app/gantt-advanced/component/flat.scss +31 -0
  38. package/example/src/app/gantt-advanced/gantt-advanced.component.html +32 -0
  39. package/example/src/app/gantt-advanced/gantt-advanced.component.ts +34 -0
  40. package/example/src/app/gantt-advanced/mocks.ts +158 -0
  41. package/example/src/app/gantt-groups/gantt-groups.component.html +42 -0
  42. package/example/src/app/gantt-groups/gantt-groups.component.ts +62 -0
  43. package/example/src/app/gantt-range/gantt-range.component.html +66 -0
  44. package/example/src/app/gantt-range/gantt-range.component.ts +67 -0
  45. package/example/src/app/gantt-range/mocks.ts +150 -0
  46. package/example/src/app/helper.ts +38 -0
  47. package/example/src/assets/.gitkeep +0 -0
  48. package/example/src/environments/environment.prod.ts +3 -0
  49. package/example/src/environments/environment.ts +16 -0
  50. package/example/src/favicon.ico +0 -0
  51. package/example/src/index.html +13 -0
  52. package/example/src/main.ts +12 -0
  53. package/example/src/polyfills.ts +63 -0
  54. package/example/src/styles.scss +56 -0
  55. package/example/tsconfig.app.json +18 -0
  56. package/nginx.conf +17 -0
  57. package/package.json +113 -17
  58. package/packages/gantt/README.md +24 -0
  59. package/packages/gantt/karma.conf.js +46 -0
  60. package/packages/gantt/ng-package.json +7 -0
  61. package/packages/gantt/ng-package.prod.json +7 -0
  62. package/packages/gantt/package.json +16 -0
  63. package/packages/gantt/src/class/date-point.ts +14 -0
  64. package/{class/event.d.ts → packages/gantt/src/class/event.ts} +12 -6
  65. package/packages/gantt/src/class/group.ts +36 -0
  66. package/{class/index.d.ts → packages/gantt/src/class/index.ts} +0 -0
  67. package/packages/gantt/src/class/item.ts +129 -0
  68. package/packages/gantt/src/class/test/group.spec.ts +21 -0
  69. package/packages/gantt/src/class/test/item.spec.ts +102 -0
  70. package/packages/gantt/src/class/view-type.ts +7 -0
  71. package/packages/gantt/src/components/bar/bar-drag.ts +298 -0
  72. package/packages/gantt/src/components/bar/bar.component.html +17 -0
  73. package/packages/gantt/src/components/bar/bar.component.scss +169 -0
  74. package/packages/gantt/src/components/bar/bar.component.ts +109 -0
  75. package/packages/gantt/src/components/bar/test/bar.component.spec.ts +54 -0
  76. package/packages/gantt/src/components/bar/test/bar.drag.spec.ts +196 -0
  77. package/packages/gantt/src/components/calendar/calendar.component.html +52 -0
  78. package/packages/gantt/src/components/calendar/calendar.component.scss +77 -0
  79. package/packages/gantt/src/components/calendar/calendar.component.ts +100 -0
  80. package/packages/gantt/src/components/drag-backdrop/drag-backdrop.component.html +6 -0
  81. package/packages/gantt/src/components/drag-backdrop/drag-backdrop.component.scss +48 -0
  82. package/packages/gantt/src/components/drag-backdrop/drag-backdrop.component.ts +13 -0
  83. package/packages/gantt/src/components/icon/icon.component.scss +13 -0
  84. package/packages/gantt/src/components/icon/icon.component.ts +28 -0
  85. package/packages/gantt/src/components/icon/icons.ts +86 -0
  86. package/packages/gantt/src/components/links/links.component.html +19 -0
  87. package/packages/gantt/src/components/links/links.component.scss +27 -0
  88. package/packages/gantt/src/components/links/links.component.ts +263 -0
  89. package/packages/gantt/src/components/main/gantt-main.component.html +35 -0
  90. package/packages/gantt/src/components/main/gantt-main.component.ts +35 -0
  91. package/packages/gantt/src/components/range/range.component.html +8 -0
  92. package/packages/gantt/src/components/range/range.component.scss +35 -0
  93. package/packages/gantt/src/components/range/range.component.ts +27 -0
  94. package/packages/gantt/src/components/range/test/range.component.spec.ts +80 -0
  95. package/packages/gantt/src/components/table/gantt-table.component.html +105 -0
  96. package/packages/gantt/src/components/table/gantt-table.component.scss +144 -0
  97. package/packages/gantt/src/components/table/gantt-table.component.ts +166 -0
  98. package/packages/gantt/src/components/table/test/table.spec.ts +129 -0
  99. package/packages/gantt/src/gantt-abstract.ts +14 -0
  100. package/packages/gantt/src/gantt-dom.service.ts +134 -0
  101. package/packages/gantt/src/gantt-drag-container.ts +73 -0
  102. package/packages/gantt/src/gantt-item-upper.ts +50 -0
  103. package/packages/gantt/src/gantt-print.service.ts +104 -0
  104. package/packages/gantt/src/gantt-upper.ts +289 -0
  105. package/packages/gantt/src/gantt.component.html +18 -0
  106. package/packages/gantt/src/gantt.component.scss +77 -0
  107. package/packages/gantt/src/gantt.component.ts +134 -0
  108. package/packages/gantt/src/gantt.module.ts +47 -0
  109. package/packages/gantt/src/gantt.pipe.ts +31 -0
  110. package/packages/gantt/src/gantt.styles.ts +28 -0
  111. package/{public-api.d.ts → packages/gantt/src/public-api.ts} +6 -0
  112. package/packages/gantt/src/root.component.html +12 -0
  113. package/packages/gantt/src/root.component.ts +121 -0
  114. package/packages/gantt/src/styles/index.scss +9 -0
  115. package/packages/gantt/src/styles/variables.scss +46 -0
  116. package/packages/gantt/src/table/gantt-column.component.ts +25 -0
  117. package/packages/gantt/src/table/gantt-table.component.ts +14 -0
  118. package/packages/gantt/src/table/test/table.spec.ts +56 -0
  119. package/packages/gantt/src/test/gantt.component.spec.ts +404 -0
  120. package/packages/gantt/src/test/mocks/data.ts +303 -0
  121. package/packages/gantt/src/test.ts +21 -0
  122. package/packages/gantt/src/utils/date.ts +276 -0
  123. package/packages/gantt/src/utils/helpers.ts +66 -0
  124. package/packages/gantt/src/utils/test/date.spec.ts +105 -0
  125. package/packages/gantt/src/utils/test/helpers.spec.ts +73 -0
  126. package/packages/gantt/src/utils/testing.ts +64 -0
  127. package/packages/gantt/src/views/day.ts +74 -0
  128. package/packages/gantt/src/views/factory.ts +25 -0
  129. package/packages/gantt/src/views/month.ts +66 -0
  130. package/packages/gantt/src/views/quarter.ts +68 -0
  131. package/packages/gantt/src/views/test/day.spec.ts +45 -0
  132. package/packages/gantt/src/views/test/factory.spec.ts +41 -0
  133. package/packages/gantt/src/views/test/mock.ts +14 -0
  134. package/packages/gantt/src/views/test/month.spec.ts +45 -0
  135. package/packages/gantt/src/views/test/quarter.spec.ts +45 -0
  136. package/packages/gantt/src/views/test/view.spec.ts +144 -0
  137. package/packages/gantt/src/views/test/week.spec.ts +45 -0
  138. package/packages/gantt/src/views/test/year.spec.ts +45 -0
  139. package/packages/gantt/src/views/view.ts +186 -0
  140. package/packages/gantt/src/views/week.ts +66 -0
  141. package/packages/gantt/src/views/year.ts +62 -0
  142. package/packages/gantt/tsconfig.lib.json +20 -0
  143. package/packages/gantt/tsconfig.lib.prod.json +9 -0
  144. package/packages/gantt/tsconfig.schematics.json +25 -0
  145. package/packages/gantt/tsconfig.spec.json +17 -0
  146. package/packages/gantt/tslint.json +18 -0
  147. package/scss-bundle.config.json +7 -0
  148. package/tsconfig.json +26 -0
  149. package/tslint.json +51 -0
  150. package/bundles/worktile-gantt.umd.js +0 -3129
  151. package/bundles/worktile-gantt.umd.js.map +0 -1
  152. package/bundles/worktile-gantt.umd.min.js +0 -16
  153. package/bundles/worktile-gantt.umd.min.js.map +0 -1
  154. package/class/date-point.d.ts +0 -15
  155. package/class/group.d.ts +0 -22
  156. package/class/item.d.ts +0 -70
  157. package/class/view-type.d.ts +0 -7
  158. package/components/bar/bar-drag.d.ts +0 -34
  159. package/components/bar/bar.component.d.ts +0 -23
  160. package/components/calendar/calendar.component.d.ts +0 -25
  161. package/components/drag-backdrop/drag-backdrop.component.d.ts +0 -6
  162. package/components/icon/icon.component.d.ts +0 -10
  163. package/components/icon/icons.d.ts +0 -8
  164. package/components/links/links.component.d.ts +0 -44
  165. package/components/main/gantt-main.component.d.ts +0 -18
  166. package/components/range/range.component.d.ts +0 -10
  167. package/components/table/gantt-table.component.d.ts +0 -31
  168. package/esm2015/class/date-point.js +0 -10
  169. package/esm2015/class/event.js +0 -13
  170. package/esm2015/class/group.js +0 -17
  171. package/esm2015/class/index.js +0 -6
  172. package/esm2015/class/item.js +0 -78
  173. package/esm2015/class/view-type.js +0 -9
  174. package/esm2015/components/bar/bar-drag.js +0 -266
  175. package/esm2015/components/bar/bar.component.js +0 -91
  176. package/esm2015/components/calendar/calendar.component.js +0 -82
  177. package/esm2015/components/drag-backdrop/drag-backdrop.component.js +0 -18
  178. package/esm2015/components/icon/icon.component.js +0 -36
  179. package/esm2015/components/icon/icons.js +0 -87
  180. package/esm2015/components/links/links.component.js +0 -207
  181. package/esm2015/components/main/gantt-main.component.js +0 -35
  182. package/esm2015/components/range/range.component.js +0 -32
  183. package/esm2015/components/table/gantt-table.component.js +0 -128
  184. package/esm2015/gantt-dom.service.js +0 -101
  185. package/esm2015/gantt-drag-container.js +0 -57
  186. package/esm2015/gantt-item-upper.js +0 -55
  187. package/esm2015/gantt-print.service.js +0 -92
  188. package/esm2015/gantt-upper.js +0 -231
  189. package/esm2015/gantt.component.js +0 -105
  190. package/esm2015/gantt.module.js +0 -43
  191. package/esm2015/gantt.pipe.js +0 -33
  192. package/esm2015/gantt.styles.js +0 -15
  193. package/esm2015/public-api.js +0 -16
  194. package/esm2015/root.component.js +0 -111
  195. package/esm2015/table/gantt-column.component.js +0 -28
  196. package/esm2015/table/gantt-table.component.js +0 -18
  197. package/esm2015/utils/date.js +0 -160
  198. package/esm2015/utils/helpers.js +0 -45
  199. package/esm2015/views/day.js +0 -54
  200. package/esm2015/views/factory.js +0 -23
  201. package/esm2015/views/month.js +0 -48
  202. package/esm2015/views/quarter.js +0 -51
  203. package/esm2015/views/view.js +0 -121
  204. package/esm2015/views/week.js +0 -49
  205. package/esm2015/views/year.js +0 -50
  206. package/esm2015/worktile-gantt.js +0 -16
  207. package/fesm2015/worktile-gantt.js +0 -2491
  208. package/fesm2015/worktile-gantt.js.map +0 -1
  209. package/gantt-dom.service.d.ts +0 -29
  210. package/gantt-drag-container.d.ts +0 -20
  211. package/gantt-item-upper.d.ts +0 -17
  212. package/gantt-print.service.d.ts +0 -10
  213. package/gantt-upper.d.ts +0 -62
  214. package/gantt.component.d.ts +0 -28
  215. package/gantt.module.d.ts +0 -2
  216. package/gantt.pipe.d.ts +0 -11
  217. package/gantt.styles.d.ts +0 -15
  218. package/root.component.d.ts +0 -25
  219. package/style.scss +0 -645
  220. package/table/gantt-column.component.d.ts +0 -12
  221. package/table/gantt-table.component.d.ts +0 -7
  222. package/utils/date.d.ts +0 -59
  223. package/utils/helpers.d.ts +0 -11
  224. package/views/day.d.ts +0 -14
  225. package/views/factory.d.ts +0 -8
  226. package/views/month.d.ts +0 -12
  227. package/views/quarter.d.ts +0 -12
  228. package/views/view.d.ts +0 -56
  229. package/views/week.d.ts +0 -12
  230. package/views/year.d.ts +0 -12
  231. package/worktile-gantt.d.ts +0 -15
  232. package/worktile-gantt.metadata.json +0 -1
@@ -0,0 +1,350 @@
1
+ module.exports = [
2
+ {
3
+ type: 'component',
4
+ name: 'ngx-gantt',
5
+ description: '',
6
+ properties: [
7
+ {
8
+ name: 'items',
9
+ description: `设置数据项,如果单独设置items则会以列表形式展示,如果需要分组展示,则需要设置属性groupId对应分组数据`,
10
+ type: 'GanttItem[]'
11
+ },
12
+ {
13
+ name: 'groups',
14
+ description: `设置分组数据`,
15
+ type: 'GanttGroup[]'
16
+ },
17
+ {
18
+ name: 'viewType',
19
+ description: `设置视图类型`,
20
+ type: `day | month | quarter`,
21
+ default: 'month'
22
+ },
23
+ {
24
+ name: 'start',
25
+ description: `设置甘特图开始时间,格式为10位时间戳`,
26
+ type: 'number'
27
+ },
28
+ {
29
+ name: 'end',
30
+ description: `设置甘特图结束时间,格式为10位时间戳`,
31
+ type: 'number'
32
+ },
33
+ {
34
+ name: 'draggable',
35
+ description: `设置是否可拖拽`,
36
+ type: 'boolean',
37
+ default: 'false'
38
+ },
39
+
40
+ {
41
+ name: 'linkable',
42
+ description: `设置是否可连接关联关系`,
43
+ type: 'boolean',
44
+ default: 'false'
45
+ },
46
+
47
+ {
48
+ name: 'maxLevel',
49
+ description: `设置最大展示层级`,
50
+ type: 'number',
51
+ default: 2
52
+ },
53
+
54
+ {
55
+ name: 'async',
56
+ description: `设置是否开始异步`,
57
+ type: 'boolean',
58
+ default: 'false'
59
+ },
60
+ {
61
+ name: 'childrenResolve',
62
+ description: `设置异步数据源返回函数,返回值为 Observable 数据流`,
63
+ type: 'Function'
64
+ },
65
+
66
+ {
67
+ name: 'styles',
68
+ description: `配置内置的样式选项`,
69
+ type: 'GanttStyles'
70
+ },
71
+ {
72
+ name: 'viewOptions',
73
+ description: `配置视图选项`,
74
+ type: 'GanttViewOptions'
75
+ },
76
+ {
77
+ name: 'disabledLoadOnScroll',
78
+ description: `设置是否禁用滚动加载`,
79
+ type: 'boolean',
80
+ default: false
81
+ },
82
+ {
83
+ name: 'loadOnScroll',
84
+ description: `滚动加载事件`,
85
+ type: 'EventEmitter<GanttLoadOnScrollEvent>'
86
+ },
87
+ {
88
+ name: 'dragStarted',
89
+ description: `拖拽开始后事件`,
90
+ type: 'EventEmitter<GanttDragEvent>'
91
+ },
92
+ {
93
+ name: 'dragEnded',
94
+ description: `拖拽结束后事件`,
95
+ type: 'EventEmitter<GanttDragEvent>'
96
+ },
97
+ {
98
+ name: 'linkDragStarted',
99
+ description: `关联关系拖拽开始后事件`,
100
+ type: 'EventEmitter<GanttLinkDragEvent>'
101
+ },
102
+ {
103
+ name: 'linkDragEnded',
104
+ description: `关联关系拖拽结束后事件`,
105
+ type: 'EventEmitter<GanttLinkDragEvent>'
106
+ },
107
+ {
108
+ name: 'barClick',
109
+ description: `右侧时间条点击事件`,
110
+ type: 'EventEmitter<GanttBarClickEvent>'
111
+ },
112
+ {
113
+ name: 'lineClick',
114
+ description: `关联关系线点击时间`,
115
+ type: 'EventEmitter<GanttLinkDragEvent>'
116
+ },
117
+ {
118
+ name: '#group',
119
+ description: `设置分组显示模板`,
120
+ type: 'TemplateRef<any>'
121
+ },
122
+ {
123
+ name: '#bar',
124
+ description: `设置时间条显示模板`,
125
+ type: 'TemplateRef<any>'
126
+ },
127
+ {
128
+ name: '#groupHeader',
129
+ description: `设置分组头部显示模板`,
130
+ type: 'TemplateRef<any>'
131
+ },
132
+ {
133
+ name: '#tableEmpty',
134
+ description: `设置空表格模板`,
135
+ type: 'TemplateRef<any>'
136
+ }
137
+ ]
138
+ },
139
+ {
140
+ type: 'component',
141
+ name: 'ngx-gantt-table',
142
+ description: '甘特图左侧表格',
143
+ properties: [
144
+ {
145
+ name: 'columnChanges',
146
+ description: `列宽变化事件集`,
147
+ type: 'EventEmitter<GanttTableEvent>'
148
+ }
149
+ ]
150
+ },
151
+ {
152
+ type: 'component',
153
+ name: 'ngx-gantt-column',
154
+ description: '甘特图左侧列',
155
+ properties: [
156
+ {
157
+ name: 'name',
158
+ description: `设置列名称`,
159
+ type: 'string'
160
+ },
161
+ {
162
+ name: 'width',
163
+ description: `设置列宽`,
164
+ type: 'string | number'
165
+ },
166
+ {
167
+ name: '#header',
168
+ description: `设置每列头部模板`,
169
+ type: 'TemplateRef<any>'
170
+ },
171
+ {
172
+ name: '#cell',
173
+ description: `设置每列内容模板`,
174
+ type: 'TemplateRef<any>'
175
+ }
176
+ ]
177
+ },
178
+ {
179
+ type: 'component',
180
+ name: 'ngx-gantt-bar',
181
+ description: '数据项条形图展示组件',
182
+ properties: [
183
+ {
184
+ name: 'template',
185
+ description: `设置时间条显示模板`,
186
+ type: 'TemplateRef<any>'
187
+ },
188
+ {
189
+ name: 'item',
190
+ description: `设置时间条显示数据`,
191
+ type: 'GanttItemInternal'
192
+ },
193
+ {
194
+ name: 'barClick',
195
+ description: `数据项条形图点击事件`,
196
+ type: 'EventEmitter<GanttBarClickEvent>'
197
+ }
198
+ ]
199
+ },
200
+ {
201
+ type: 'component',
202
+ name: 'ngx-gantt-range',
203
+ description: '数据项区间展示组件',
204
+ properties: [
205
+ {
206
+ name: 'template',
207
+ description: `设置区间展示模板`,
208
+ type: 'TemplateRef<any>'
209
+ },
210
+ {
211
+ name: 'item',
212
+ description: `设置区间展示数据`,
213
+ type: 'GanttItemInternal'
214
+ }
215
+ ]
216
+ },
217
+ {
218
+ type: 'component',
219
+ name: 'ngx-gantt-root',
220
+ description: '甘特图根组件',
221
+ properties: [
222
+ {
223
+ name: 'sideWidth',
224
+ description: `设置甘特图左侧内容宽度`,
225
+ type: 'number'
226
+ },
227
+ {
228
+ name: 'sideTemplate',
229
+ description: `设置甘特图左侧内容模板`,
230
+ type: 'TemplateRef<any>'
231
+ },
232
+ {
233
+ name: 'mainTemplate',
234
+ description: `设置甘特图右侧主要内容模板`,
235
+ type: 'TemplateRef<any>'
236
+ }
237
+ ]
238
+ }
239
+ // {
240
+ // type: 'class',
241
+ // name: 'GanttItem',
242
+ // description: '数据项格式定义',
243
+ // properties: [
244
+ // {
245
+ // name: 'id',
246
+ // description: `唯一标识`,
247
+ // type: 'string'
248
+ // },
249
+ // {
250
+ // name: 'title',
251
+ // description: `名称`,
252
+ // type: 'string'
253
+ // },
254
+ // {
255
+ // name: 'start',
256
+ // description: `开始时间`,
257
+ // type: 'number'
258
+ // },
259
+ // {
260
+ // name: 'end',
261
+ // description: `截止时间`,
262
+ // type: 'number'
263
+ // },
264
+ // {
265
+ // name: 'group_id',
266
+ // description: `对应分组的Id`,
267
+ // type: 'string'
268
+ // },
269
+ // {
270
+ // name: 'links',
271
+ // description: `关联数据项Ids`,
272
+ // type: 'string[]'
273
+ // },
274
+ // {
275
+ // name: 'color',
276
+ // description: `设置颜色`,
277
+ // type: 'string'
278
+ // },
279
+ // {
280
+ // name: 'draggable',
281
+ // description: `设置是否可拖拽`,
282
+ // type: 'boolean'
283
+ // },
284
+ // {
285
+ // name: 'linkable',
286
+ // description: `设置是否可关联/被关联`,
287
+ // type: 'boolean'
288
+ // },
289
+ // {
290
+ // name: 'expand',
291
+ // description: `设置是否展开`,
292
+ // type: 'boolean',
293
+ // default: 'false'
294
+ // },
295
+ // {
296
+ // name: 'children',
297
+ // description: `设置子数据`,
298
+ // type: 'GanttItem[]',
299
+ // default: ''
300
+ // },
301
+ // {
302
+ // name: 'origin',
303
+ // description: `设置原始数据`,
304
+ // type: 'T',
305
+ // default: ''
306
+ // },
307
+ // {
308
+ // name: 'type',
309
+ // description: `数据展示方式(区间展示和普通展示)`,
310
+ // type: 'GanttItemType',
311
+ // default: ''
312
+ // },
313
+ // {
314
+ // name: 'progress',
315
+ // description: `进度`,
316
+ // type: 'number',
317
+ // default: ''
318
+ // }
319
+ // ]
320
+ // },
321
+ // {
322
+ // type: 'class',
323
+ // name: 'GanttGroup',
324
+ // description: '分组数据格式定义',
325
+ // properties: [
326
+ // {
327
+ // name: 'id',
328
+ // description: `唯一标识`,
329
+ // type: 'string'
330
+ // },
331
+ // {
332
+ // name: 'title',
333
+ // description: `名称`,
334
+ // type: 'string'
335
+ // },
336
+ // {
337
+ // name: 'expand',
338
+ // description: `设置是否展开`,
339
+ // type: 'boolean',
340
+ // default: 'true'
341
+ // },
342
+ // {
343
+ // name: 'origin',
344
+ // description: `设置原始数据`,
345
+ // type: 'T',
346
+ // default: ''
347
+ // }
348
+ // ]
349
+ // }
350
+ ];
@@ -0,0 +1,5 @@
1
+ ---
2
+ category: config
3
+ title: 参数
4
+ subtitle: Parameters
5
+ ---
@@ -0,0 +1,51 @@
1
+ <thy-layout>
2
+ <thy-header>
3
+ <ng-template #headerContent>
4
+ <thy-button-group thySize="sm" thyType="outline-default">
5
+ <button thyButton *ngFor="let view of views" [class.active]="view.value === viewType" (click)="viewType = view.value">
6
+ {{ view.name }}
7
+ </button>
8
+ </thy-button-group>
9
+ &nbsp; &nbsp; &nbsp;
10
+ <thy-button thyType="primary" thySize="sm" (click)="print('gantt-example')"> ↓ 导出为图片 </thy-button>
11
+ </ng-template>
12
+ <ng-template #headerOperation>
13
+ <a href="https://github.com/worktile/ngx-gantt/blob/master/example/src/app/gantt" target="_blank">查看源码</a>
14
+ </ng-template>
15
+ </thy-header>
16
+ <thy-content>
17
+ <ngx-gantt
18
+ #gantt
19
+ [items]="items"
20
+ [viewType]="viewType"
21
+ [async]="true"
22
+ [childrenResolve]="childrenResolve"
23
+ [draggable]="true"
24
+ [linkable]="true"
25
+ (barClick)="barClick($event)"
26
+ (lineClick)="lineClick($event)"
27
+ (dragEnded)="dragEnded($event)"
28
+ (linkDragEnded)="linkDragEnded($event)"
29
+ >
30
+ <ngx-gantt-table>
31
+ <ngx-gantt-column name="标题" width="180px">
32
+ <ng-template #cell let-item="item"> {{ item.title }} </ng-template>
33
+ </ngx-gantt-column>
34
+ <ngx-gantt-column name="开始时间" width="140px">
35
+ <ng-template #cell let-item="item">
36
+ {{ item.start * 1000 | date: 'yyyy-MM-dd' }}
37
+ </ng-template>
38
+ </ngx-gantt-column>
39
+ <ngx-gantt-column name="截止时间" width="140px">
40
+ <ng-template #cell let-item="item">
41
+ {{ item.end * 1000 | date: 'yyyy-MM-dd' }}
42
+ </ng-template>
43
+ </ngx-gantt-column>
44
+ </ngx-gantt-table>
45
+
46
+ <ng-template #bar let-item="item">
47
+ <span style="color: #fff">&nbsp;&nbsp;{{ item.title }} </span>
48
+ </ng-template>
49
+ </ngx-gantt>
50
+ </thy-content>
51
+ </thy-layout>
@@ -0,0 +1,119 @@
1
+ import { GanttPrintService } from './../../../../packages/gantt/src/gantt-print.service';
2
+ import { Component, OnInit, HostBinding } from '@angular/core';
3
+ import {
4
+ GanttBarClickEvent,
5
+ GanttViewType,
6
+ GanttDragEvent,
7
+ GanttLoadOnScrollEvent,
8
+ GanttLineClickEvent,
9
+ GanttLinkDragEvent,
10
+ GanttItem,
11
+ GanttViewOptions,
12
+ GanttDate
13
+ } from 'ngx-gantt';
14
+ import { of } from 'rxjs';
15
+ import { delay } from 'rxjs/operators';
16
+ import { ThyNotifyService } from 'ngx-tethys/notify';
17
+ import { randomItems, random } from '../helper';
18
+
19
+ @Component({
20
+ selector: 'app-gantt-example',
21
+ templateUrl: './gantt.component.html',
22
+ providers: [GanttPrintService]
23
+ })
24
+ export class AppGanttExampleComponent implements OnInit {
25
+ views = [
26
+ {
27
+ name: '日',
28
+ value: GanttViewType.day
29
+ },
30
+ {
31
+ name: '周',
32
+ value: GanttViewType.week
33
+ },
34
+ {
35
+ name: '月',
36
+ value: GanttViewType.month
37
+ },
38
+ {
39
+ name: '季',
40
+ value: GanttViewType.quarter
41
+ },
42
+ {
43
+ name: '年',
44
+ value: GanttViewType.year
45
+ }
46
+ ];
47
+
48
+ viewType: GanttViewType = GanttViewType.month;
49
+
50
+ items: GanttItem[] = [
51
+ { id: '000000', title: 'Task 0', start: 1627729997, end: 1628421197, expandable: true },
52
+ { id: '000001', title: 'Task 1', start: 1617361997, end: 1625483597, links: ['000003', '000004', '000000'], expandable: true },
53
+ { id: '000002', title: 'Task 2', start: 1610536397, end: 1610622797 },
54
+ { id: '000003', title: 'Task 3', start: 1628507597, end: 1633345997, expandable: true },
55
+ { id: '000004', title: 'Task 4', start: 1624705997, expandable: true },
56
+ { id: '000005', title: 'Task 5', start: 1628075597, end: 1629544397, color: '#709dc1' },
57
+ { id: '000006', title: 'Task 6', start: 1641121997, end: 1645528397 },
58
+ { id: '000007', title: 'Task 7', start: 1639393997, end: 1640862797 },
59
+ { id: '000008', title: 'Task 8', end: 1628783999, color:'#709dc1' },
60
+ { id: '000009', title: 'Task 9', start: 1639307597, end: 1640344397 },
61
+ { id: '0000010', title: 'Task 10', start: 1609067597, end: 1617275597 },
62
+ { id: '0000011', title: 'Task 11', start: 1611918797, end: 1611918797 },
63
+ { id: '0000012', title: 'Task 12', start: 1627816397, end: 1631358797 },
64
+ { id: '0000013', title: 'Task 13', start: 1625051597, end: 1630667597, links: ['0000012'] },
65
+ { id: '0000014', title: 'Task 14', start: 1627920000, end: 1629129599 },
66
+ { id: '0000015', title: 'Task 15', start: 1633259597, end: 1639480397 },
67
+ { id: '0000016', title: 'Task 16', start: 1624965197, end: 1627211597 },
68
+ { id: '0000017', title: 'Task 17', start: 1641035597, end: 1649157197 },
69
+ { id: '0000018', title: 'Task 18', start: 1637061197, end: 1642677197 },
70
+ { id: '0000019', title: 'Task 19', start: 1637925197, end: 1646305997 },
71
+ { id: '0000020', title: 'Task 20', start: 1628334797, end: 1629889997 },
72
+ { id: '0000021', title: 'Task 21', start: 1622891597, end: 1627643597 },
73
+ { id: '0000022', title: 'Task 22', start: 1616238797, end: 1620731597 },
74
+ { id: '0000023', title: 'Task 23', start: 1626693197, end: 1630149197 },
75
+ { id: '0000024', title: 'Task 24', start: 1626174797, end: 1626952397 },
76
+ { id: '0000025', title: 'Task 25', start: 1631013197, end: 1637493197 },
77
+ { id: '0000026', title: 'Task 26', start: 1635937997, end: 1643886797 },
78
+ { id: '0000027', title: 'Task 27', start: 1637665997, end: 1644059597 },
79
+ { id: '0000028', title: 'Task 28', start: 1611400397, end: 1615547597 },
80
+ { id: '0000029', title: 'Task 29', start: 1618053197, end: 1619176397 }
81
+ ];
82
+
83
+ options = {
84
+ viewType: GanttViewType.day
85
+ };
86
+
87
+ @HostBinding('class.gantt-example-component') class = true;
88
+
89
+ childrenResolve = (item: GanttItem) => {
90
+ const children = randomItems(random(1, 5), item);
91
+ return of(children).pipe(delay(1000));
92
+ };
93
+
94
+ constructor(private printService: GanttPrintService, private thyNotify: ThyNotifyService) {}
95
+
96
+ ngOnInit(): void {}
97
+
98
+ barClick(event: GanttBarClickEvent) {
99
+ this.thyNotify.info('Event: barClick', `你点击了 [${event.item.title}]`);
100
+ }
101
+
102
+ lineClick(event: GanttLineClickEvent) {
103
+ this.thyNotify.info('Event: lineClick', `你点击了 ${event.source.title} 到 ${event.target.title} 的关联线`);
104
+ }
105
+
106
+ dragEnded(event: GanttDragEvent) {
107
+ this.thyNotify.info('Event: dragEnded', `修改了 [${event.item.title}] 的时间`);
108
+ this.items = [...this.items];
109
+ }
110
+
111
+ linkDragEnded(event: GanttLinkDragEvent) {
112
+ this.items = [...this.items];
113
+ this.thyNotify.info('Event: linkDragEnded', `创建了关联关系`);
114
+ }
115
+
116
+ print(name: string) {
117
+ this.printService.print(name);
118
+ }
119
+ }
@@ -0,0 +1,30 @@
1
+ <ngx-gantt-root [sideWidth]="300">
2
+ <ng-template #sideTemplate>
3
+ <div class="gantt-flat-side-header">项目</div>
4
+ <div class="gantt-flat-side-body">
5
+ <div class="gantt-group" *ngFor="let group of groups; trackBy: trackBy">
6
+ <div class="gantt-group-content" [style.height.px]="group.mergedItems?.length * (styles.lineHeight + 10) - 10">
7
+ {{ group.title }}
8
+ </div>
9
+ </div>
10
+ </div>
11
+ </ng-template>
12
+ <ng-template #mainTemplate>
13
+ <div class="gantt-main-container">
14
+ <!-- groups -->
15
+ <div class="gantt-main-groups" *ngIf="groups && groups.length > 0" [style.width.px]="view.width">
16
+ <ng-container *ngFor="let group of groups; trackBy: trackBy">
17
+ <div class="gantt-main-group" [style.height.px]="group.mergedItems?.length * (styles.lineHeight + 10) - 10">
18
+ <ng-container *ngFor="let items of group.mergedItems">
19
+ <div class="gantt-flat-items" [style.height.px]="styles.lineHeight">
20
+ <ng-container *ngFor="let item of items; trackBy: trackBy">
21
+ <ngx-gantt-bar [item]="item" [template]="barTemplate" (barClick)="barClick.emit($event)"></ngx-gantt-bar>
22
+ </ng-container>
23
+ </div>
24
+ </ng-container>
25
+ </div>
26
+ </ng-container>
27
+ </div>
28
+ </div>
29
+ </ng-template>
30
+ </ngx-gantt-root>
@@ -0,0 +1,72 @@
1
+ import { Component, OnInit, HostBinding, OnChanges, OnDestroy, SimpleChanges, NgZone, ChangeDetectorRef, ElementRef } from '@angular/core';
2
+ import { GANTT_UPPER_TOKEN, GanttUpper, GanttItemInternal, GanttGroupInternal } from 'ngx-gantt';
3
+ import { startWith, takeUntil } from 'rxjs/operators';
4
+
5
+ @Component({
6
+ selector: 'app-gantt-flat',
7
+ templateUrl: './flat.component.html',
8
+ styleUrls: ['./flat.scss'],
9
+ providers: [
10
+ {
11
+ provide: GANTT_UPPER_TOKEN,
12
+ useExisting: AppGanttFlatComponent
13
+ }
14
+ ]
15
+ })
16
+ export class AppGanttFlatComponent extends GanttUpper implements OnInit, OnChanges, OnDestroy {
17
+ mergeIntervalDays = 3;
18
+
19
+ groups: GanttGroupInternal[] = [];
20
+
21
+ @HostBinding('class.gantt-flat') ganttFlatClass = true;
22
+
23
+ constructor(elementRef: ElementRef<HTMLElement>, cdr: ChangeDetectorRef, ngZone: NgZone) {
24
+ super(elementRef, cdr, ngZone);
25
+ }
26
+
27
+ private buildGroupMergedItems(items: GanttItemInternal[]) {
28
+ const mergedItems: GanttItemInternal[][] = [];
29
+ items = items.filter((item) => item.start && item.end).sort((a, b) => a.start.getUnixTime() - b.start.getUnixTime());
30
+ items.forEach((item) => {
31
+ let indexOfMergedItems = -1;
32
+ for (let i = 0; i < mergedItems.length; i++) {
33
+ const subItems = mergedItems[i];
34
+ if (item.start.value > subItems[subItems.length - 1].end.addDays(this.mergeIntervalDays).value) {
35
+ subItems.push(item);
36
+ indexOfMergedItems = i;
37
+ break;
38
+ }
39
+ }
40
+ // 如果没有合适的位置插入,则插入到最后一行
41
+ if (indexOfMergedItems === -1) {
42
+ mergedItems.push([item]);
43
+ indexOfMergedItems = mergedItems.length - 1;
44
+ }
45
+ });
46
+ return mergedItems;
47
+ }
48
+
49
+ ngOnInit() {
50
+ super.onInit();
51
+ this.dragEnded.pipe(startWith(null), takeUntil(this.unsubscribe$)).subscribe(() => {
52
+ this.buildGroupItems();
53
+ });
54
+ }
55
+
56
+ private buildGroupItems() {
57
+ console.log(this.groups);
58
+ this.groups.forEach((group) => {
59
+ group.mergedItems = this.buildGroupMergedItems(group.items);
60
+ // 如果没有数据,默认填充两行空行
61
+ group.mergedItems = group.mergedItems.length === 0 ? [[]] : group.mergedItems;
62
+ });
63
+ }
64
+
65
+ ngOnChanges(changes: SimpleChanges) {
66
+ super.onChanges(changes);
67
+ }
68
+
69
+ ngOnDestroy() {
70
+ super.onDestroy();
71
+ }
72
+ }
@@ -0,0 +1,31 @@
1
+ :host {
2
+ .gantt-flat-side-header {
3
+ text-align: center;
4
+ position: sticky;
5
+ top: 0;
6
+ background: #fff;
7
+ height: 44px;
8
+ line-height: 44px;
9
+ z-index: 1;
10
+ border-bottom: 1px solid #eee;
11
+ box-sizing: border-box;
12
+ }
13
+
14
+ .gantt-group {
15
+ .gantt-group-content {
16
+ border-bottom: 1px solid #eee;
17
+ display: flex;
18
+ align-items: center;
19
+ padding: 15px;
20
+ }
21
+ }
22
+
23
+ .gantt-main-group {
24
+ border-bottom: 1px solid #eee;
25
+ padding: 15px 0;
26
+
27
+ .gantt-flat-items {
28
+ position: relative;
29
+ }
30
+ }
31
+ }