@progress/kendo-react-gantt 6.1.1 → 7.0.0-develop.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 (292) hide show
  1. package/{dist/npm/Gantt.d.ts → Gantt.d.ts} +4 -0
  2. package/LICENSE.md +1 -1
  3. package/{dist/es/cells → cells}/FilterCells/GanttBooleanFilter.d.ts +4 -0
  4. package/{dist/npm/cells → cells}/FilterCells/GanttDateFilter.d.ts +4 -0
  5. package/{dist/es/cells → cells}/FilterCells/GanttNumericFilter.d.ts +4 -0
  6. package/{dist/npm/cells → cells}/FilterCells/GanttTextFilter.d.ts +4 -0
  7. package/{dist/npm/cells → cells}/FilterCells/utils.d.ts +4 -0
  8. package/{dist/npm/components → components}/BaseView.d.ts +4 -0
  9. package/components/GanttDependency.d.ts +13 -0
  10. package/{dist/npm/components → components}/GanttTask.d.ts +4 -0
  11. package/{dist/npm/components → components}/GanttTreelist.d.ts +6 -2
  12. package/{dist/npm/components → components}/toolbar/AddButton.d.ts +4 -0
  13. package/{dist/npm/components → components}/toolbar/Toolbar.d.ts +4 -0
  14. package/{dist/es/components → components}/toolbar/view-selector/ViewSelector.d.ts +4 -0
  15. package/components/toolbar/view-selector/ViewSelectorItem.d.ts +15 -0
  16. package/components/toolbar/view-selector/ViewSelectorList.d.ts +7 -0
  17. package/{dist/npm/constants → constants}/index.d.ts +4 -0
  18. package/{dist/es/context → context}/GanttContext.d.ts +17 -13
  19. package/{dist/npm/context → context}/GanttViewContext.d.ts +8 -4
  20. package/dist/cdn/js/kendo-react-gantt.js +5 -1
  21. package/editors/FormDateTimePicker.d.ts +8 -0
  22. package/editors/FormInput.d.ts +8 -0
  23. package/editors/FormNumericTextBox.d.ts +8 -0
  24. package/editors/GanttEditor.d.ts +8 -0
  25. package/{dist/npm/editors → editors}/GanttForm.d.ts +4 -0
  26. package/{dist/es/editors → editors}/GanttRemoveDialog.d.ts +4 -0
  27. package/hooks/useControlledState.d.ts +8 -0
  28. package/{dist/es/hooks → hooks}/useDictionaryStore.d.ts +5 -1
  29. package/hooks/useGanttTask.d.ts +8 -0
  30. package/index.d.ts +30 -0
  31. package/index.js +5 -0
  32. package/index.mjs +2582 -0
  33. package/interfaces/AddDirection.d.ts +10 -0
  34. package/interfaces/DataItem.d.ts +10 -0
  35. package/interfaces/DateRange.d.ts +12 -0
  36. package/{dist/es/interfaces → interfaces}/DependencyModelFields.d.ts +4 -0
  37. package/{dist/npm/interfaces → interfaces}/GanttBaseProps.d.ts +4 -1
  38. package/{dist/es/interfaces → interfaces}/GanttCellProps.d.ts +4 -1
  39. package/{dist/npm/interfaces → interfaces}/GanttColumnProps.d.ts +4 -0
  40. package/{dist/npm/interfaces → interfaces}/GanttDependencyModelFields.d.ts +4 -0
  41. package/interfaces/GanttFilterCellProps.d.ts +10 -0
  42. package/interfaces/GanttFilterOperator.d.ts +10 -0
  43. package/interfaces/GanttHeaderCellProps.d.ts +10 -0
  44. package/interfaces/GanttNoRecordsProps.d.ts +13 -0
  45. package/{dist/npm/interfaces → interfaces}/GanttProps.d.ts +4 -1
  46. package/{dist/es/interfaces → interfaces}/GanttRowProps.d.ts +4 -1
  47. package/{dist/es/interfaces → interfaces}/GanttSelectableSettings.d.ts +5 -1
  48. package/interfaces/GanttSlotType.d.ts +8 -0
  49. package/interfaces/GanttSortSettings.d.ts +17 -0
  50. package/{dist/es/interfaces → interfaces}/GanttTaskModelFields.d.ts +4 -0
  51. package/{dist/npm/interfaces → interfaces}/GanttView.d.ts +6 -3
  52. package/{dist/es/interfaces → interfaces}/GanttViewTimelineHeaderCellProps.d.ts +4 -0
  53. package/interfaces/Rectangle.d.ts +10 -0
  54. package/interfaces/Slot.d.ts +16 -0
  55. package/interfaces/TaskModelFields.d.ts +19 -0
  56. package/{dist/npm/interfaces → interfaces}/events.d.ts +4 -0
  57. package/{dist/es/messages → messages}/index.d.ts +4 -0
  58. package/package-metadata.d.ts +9 -0
  59. package/package.json +40 -57
  60. package/rows/GanttRow.d.ts +8 -0
  61. package/{dist/es/utils → utils}/data-operations.d.ts +4 -0
  62. package/{dist/es/utils → utils}/index.d.ts +11 -7
  63. package/{dist/npm/views → views}/GanttDayView.d.ts +4 -0
  64. package/{dist/npm/views → views}/GanttMonthView.d.ts +4 -0
  65. package/{dist/es/views → views}/GanttWeekView.d.ts +4 -0
  66. package/{dist/npm/views → views}/GanttYearView.d.ts +4 -0
  67. package/about.md +0 -3
  68. package/dist/es/Gantt.d.ts +0 -25
  69. package/dist/es/Gantt.js +0 -332
  70. package/dist/es/GanttNoRecords.d.ts +0 -12
  71. package/dist/es/GanttNoRecords.js +0 -37
  72. package/dist/es/cells/FilterCells/GanttBooleanFilter.js +0 -31
  73. package/dist/es/cells/FilterCells/GanttDateFilter.d.ts +0 -10
  74. package/dist/es/cells/FilterCells/GanttDateFilter.js +0 -31
  75. package/dist/es/cells/FilterCells/GanttNumericFilter.js +0 -31
  76. package/dist/es/cells/FilterCells/GanttTextFilter.d.ts +0 -10
  77. package/dist/es/cells/FilterCells/GanttTextFilter.js +0 -31
  78. package/dist/es/cells/FilterCells/utils.d.ts +0 -38
  79. package/dist/es/cells/FilterCells/utils.js +0 -66
  80. package/dist/es/components/BaseView.d.ts +0 -20
  81. package/dist/es/components/BaseView.js +0 -253
  82. package/dist/es/components/GanttDependency.d.ts +0 -10
  83. package/dist/es/components/GanttDependency.js +0 -56
  84. package/dist/es/components/GanttTask.d.ts +0 -12
  85. package/dist/es/components/GanttTask.js +0 -164
  86. package/dist/es/components/GanttTreelist.d.ts +0 -138
  87. package/dist/es/components/GanttTreelist.js +0 -607
  88. package/dist/es/components/toolbar/AddButton.d.ts +0 -12
  89. package/dist/es/components/toolbar/AddButton.js +0 -47
  90. package/dist/es/components/toolbar/Toolbar.d.ts +0 -21
  91. package/dist/es/components/toolbar/Toolbar.js +0 -41
  92. package/dist/es/components/toolbar/view-selector/ViewSelector.js +0 -38
  93. package/dist/es/components/toolbar/view-selector/ViewSelectorItem.d.ts +0 -12
  94. package/dist/es/components/toolbar/view-selector/ViewSelectorItem.js +0 -17
  95. package/dist/es/components/toolbar/view-selector/ViewSelectorList.d.ts +0 -3
  96. package/dist/es/components/toolbar/view-selector/ViewSelectorList.js +0 -42
  97. package/dist/es/constants/index.d.ts +0 -53
  98. package/dist/es/constants/index.js +0 -63
  99. package/dist/es/context/GanttContext.js +0 -105
  100. package/dist/es/context/GanttViewContext.d.ts +0 -40
  101. package/dist/es/context/GanttViewContext.js +0 -31
  102. package/dist/es/editors/FormAssingmentsEditor.d.ts +0 -5
  103. package/dist/es/editors/FormAssingmentsEditor.js +0 -20
  104. package/dist/es/editors/FormDateTimePicker.d.ts +0 -5
  105. package/dist/es/editors/FormDateTimePicker.js +0 -45
  106. package/dist/es/editors/FormInput.d.ts +0 -5
  107. package/dist/es/editors/FormInput.js +0 -44
  108. package/dist/es/editors/FormNumericTextBox.d.ts +0 -5
  109. package/dist/es/editors/FormNumericTextBox.js +0 -44
  110. package/dist/es/editors/GanttEditor.d.ts +0 -5
  111. package/dist/es/editors/GanttEditor.js +0 -39
  112. package/dist/es/editors/GanttForm.d.ts +0 -44
  113. package/dist/es/editors/GanttForm.js +0 -72
  114. package/dist/es/editors/GanttRemoveDialog.js +0 -61
  115. package/dist/es/hooks/useControlledState.d.ts +0 -4
  116. package/dist/es/hooks/useControlledState.js +0 -23
  117. package/dist/es/hooks/useDictionaryStore.js +0 -24
  118. package/dist/es/hooks/useGanttTask.d.ts +0 -4
  119. package/dist/es/hooks/useGanttTask.js +0 -27
  120. package/dist/es/interfaces/AddDirection.d.ts +0 -6
  121. package/dist/es/interfaces/AddDirection.js +0 -1
  122. package/dist/es/interfaces/DataAction.d.ts +0 -25
  123. package/dist/es/interfaces/DataAction.js +0 -9
  124. package/dist/es/interfaces/DataItem.d.ts +0 -6
  125. package/dist/es/interfaces/DataItem.js +0 -1
  126. package/dist/es/interfaces/DateRange.d.ts +0 -8
  127. package/dist/es/interfaces/DateRange.js +0 -1
  128. package/dist/es/interfaces/DependencyModelFields.js +0 -1
  129. package/dist/es/interfaces/DragEvent.d.ts +0 -14
  130. package/dist/es/interfaces/DragEvent.js +0 -1
  131. package/dist/es/interfaces/GanttBaseProps.d.ts +0 -63
  132. package/dist/es/interfaces/GanttBaseProps.js +0 -1
  133. package/dist/es/interfaces/GanttCellProps.js +0 -1
  134. package/dist/es/interfaces/GanttColumnProps.d.ts +0 -36
  135. package/dist/es/interfaces/GanttColumnProps.js +0 -1
  136. package/dist/es/interfaces/GanttDependencyModelFields.d.ts +0 -25
  137. package/dist/es/interfaces/GanttDependencyModelFields.js +0 -1
  138. package/dist/es/interfaces/GanttFilterCellProps.d.ts +0 -6
  139. package/dist/es/interfaces/GanttFilterCellProps.js +0 -1
  140. package/dist/es/interfaces/GanttFilterOperator.d.ts +0 -6
  141. package/dist/es/interfaces/GanttFilterOperator.js +0 -1
  142. package/dist/es/interfaces/GanttHeaderCellProps.d.ts +0 -6
  143. package/dist/es/interfaces/GanttHeaderCellProps.js +0 -1
  144. package/dist/es/interfaces/GanttNoRecordsProps.d.ts +0 -10
  145. package/dist/es/interfaces/GanttNoRecordsProps.js +0 -1
  146. package/dist/es/interfaces/GanttProps.d.ts +0 -147
  147. package/dist/es/interfaces/GanttProps.js +0 -1
  148. package/dist/es/interfaces/GanttRowProps.js +0 -1
  149. package/dist/es/interfaces/GanttSelectableSettings.js +0 -2
  150. package/dist/es/interfaces/GanttSlotType.d.ts +0 -4
  151. package/dist/es/interfaces/GanttSlotType.js +0 -1
  152. package/dist/es/interfaces/GanttSortSettings.d.ts +0 -13
  153. package/dist/es/interfaces/GanttSortSettings.js +0 -19
  154. package/dist/es/interfaces/GanttTaskModelFields.js +0 -1
  155. package/dist/es/interfaces/GanttView.d.ts +0 -77
  156. package/dist/es/interfaces/GanttView.js +0 -1
  157. package/dist/es/interfaces/GanttViewTimelineHeaderCellProps.js +0 -1
  158. package/dist/es/interfaces/Rectangle.d.ts +0 -6
  159. package/dist/es/interfaces/Rectangle.js +0 -1
  160. package/dist/es/interfaces/Slot.d.ts +0 -12
  161. package/dist/es/interfaces/Slot.js +0 -1
  162. package/dist/es/interfaces/TaskModelFields.d.ts +0 -15
  163. package/dist/es/interfaces/TaskModelFields.js +0 -1
  164. package/dist/es/interfaces/events.d.ts +0 -294
  165. package/dist/es/interfaces/events.js +0 -84
  166. package/dist/es/main.d.ts +0 -26
  167. package/dist/es/main.js +0 -17
  168. package/dist/es/messages/index.js +0 -138
  169. package/dist/es/package-metadata.d.ts +0 -5
  170. package/dist/es/package-metadata.js +0 -11
  171. package/dist/es/rows/GanttRow.d.ts +0 -5
  172. package/dist/es/rows/GanttRow.js +0 -5
  173. package/dist/es/utils/data-operations.js +0 -319
  174. package/dist/es/utils/index.js +0 -455
  175. package/dist/es/views/GanttDayView.d.ts +0 -17
  176. package/dist/es/views/GanttDayView.js +0 -102
  177. package/dist/es/views/GanttMonthView.d.ts +0 -13
  178. package/dist/es/views/GanttMonthView.js +0 -78
  179. package/dist/es/views/GanttWeekView.js +0 -84
  180. package/dist/es/views/GanttYearView.d.ts +0 -13
  181. package/dist/es/views/GanttYearView.js +0 -70
  182. package/dist/npm/Gantt.js +0 -335
  183. package/dist/npm/GanttNoRecords.d.ts +0 -12
  184. package/dist/npm/GanttNoRecords.js +0 -40
  185. package/dist/npm/cells/FilterCells/GanttBooleanFilter.d.ts +0 -10
  186. package/dist/npm/cells/FilterCells/GanttBooleanFilter.js +0 -35
  187. package/dist/npm/cells/FilterCells/GanttDateFilter.js +0 -35
  188. package/dist/npm/cells/FilterCells/GanttNumericFilter.d.ts +0 -10
  189. package/dist/npm/cells/FilterCells/GanttNumericFilter.js +0 -35
  190. package/dist/npm/cells/FilterCells/GanttTextFilter.js +0 -35
  191. package/dist/npm/cells/FilterCells/utils.js +0 -70
  192. package/dist/npm/components/BaseView.js +0 -256
  193. package/dist/npm/components/GanttDependency.d.ts +0 -10
  194. package/dist/npm/components/GanttDependency.js +0 -60
  195. package/dist/npm/components/GanttTask.js +0 -167
  196. package/dist/npm/components/GanttTreelist.js +0 -610
  197. package/dist/npm/components/toolbar/AddButton.js +0 -50
  198. package/dist/npm/components/toolbar/Toolbar.js +0 -44
  199. package/dist/npm/components/toolbar/view-selector/ViewSelector.d.ts +0 -24
  200. package/dist/npm/components/toolbar/view-selector/ViewSelector.js +0 -41
  201. package/dist/npm/components/toolbar/view-selector/ViewSelectorItem.d.ts +0 -12
  202. package/dist/npm/components/toolbar/view-selector/ViewSelectorItem.js +0 -21
  203. package/dist/npm/components/toolbar/view-selector/ViewSelectorList.d.ts +0 -3
  204. package/dist/npm/components/toolbar/view-selector/ViewSelectorList.js +0 -45
  205. package/dist/npm/constants/index.js +0 -67
  206. package/dist/npm/context/GanttContext.d.ts +0 -121
  207. package/dist/npm/context/GanttContext.js +0 -121
  208. package/dist/npm/context/GanttViewContext.js +0 -38
  209. package/dist/npm/editors/FormAssingmentsEditor.d.ts +0 -5
  210. package/dist/npm/editors/FormAssingmentsEditor.js +0 -24
  211. package/dist/npm/editors/FormDateTimePicker.d.ts +0 -5
  212. package/dist/npm/editors/FormDateTimePicker.js +0 -49
  213. package/dist/npm/editors/FormInput.d.ts +0 -5
  214. package/dist/npm/editors/FormInput.js +0 -48
  215. package/dist/npm/editors/FormNumericTextBox.d.ts +0 -5
  216. package/dist/npm/editors/FormNumericTextBox.js +0 -48
  217. package/dist/npm/editors/GanttEditor.d.ts +0 -5
  218. package/dist/npm/editors/GanttEditor.js +0 -43
  219. package/dist/npm/editors/GanttForm.js +0 -76
  220. package/dist/npm/editors/GanttRemoveDialog.d.ts +0 -44
  221. package/dist/npm/editors/GanttRemoveDialog.js +0 -65
  222. package/dist/npm/hooks/useControlledState.d.ts +0 -4
  223. package/dist/npm/hooks/useControlledState.js +0 -27
  224. package/dist/npm/hooks/useDictionaryStore.d.ts +0 -18
  225. package/dist/npm/hooks/useDictionaryStore.js +0 -28
  226. package/dist/npm/hooks/useGanttTask.d.ts +0 -4
  227. package/dist/npm/hooks/useGanttTask.js +0 -31
  228. package/dist/npm/interfaces/AddDirection.d.ts +0 -6
  229. package/dist/npm/interfaces/AddDirection.js +0 -2
  230. package/dist/npm/interfaces/DataAction.d.ts +0 -25
  231. package/dist/npm/interfaces/DataAction.js +0 -12
  232. package/dist/npm/interfaces/DataItem.d.ts +0 -6
  233. package/dist/npm/interfaces/DataItem.js +0 -2
  234. package/dist/npm/interfaces/DateRange.d.ts +0 -8
  235. package/dist/npm/interfaces/DateRange.js +0 -2
  236. package/dist/npm/interfaces/DependencyModelFields.d.ts +0 -25
  237. package/dist/npm/interfaces/DependencyModelFields.js +0 -2
  238. package/dist/npm/interfaces/DragEvent.d.ts +0 -14
  239. package/dist/npm/interfaces/DragEvent.js +0 -2
  240. package/dist/npm/interfaces/GanttBaseProps.js +0 -2
  241. package/dist/npm/interfaces/GanttCellProps.d.ts +0 -42
  242. package/dist/npm/interfaces/GanttCellProps.js +0 -2
  243. package/dist/npm/interfaces/GanttColumnProps.js +0 -2
  244. package/dist/npm/interfaces/GanttDependencyModelFields.js +0 -2
  245. package/dist/npm/interfaces/GanttFilterCellProps.d.ts +0 -6
  246. package/dist/npm/interfaces/GanttFilterCellProps.js +0 -2
  247. package/dist/npm/interfaces/GanttFilterOperator.d.ts +0 -6
  248. package/dist/npm/interfaces/GanttFilterOperator.js +0 -2
  249. package/dist/npm/interfaces/GanttHeaderCellProps.d.ts +0 -6
  250. package/dist/npm/interfaces/GanttHeaderCellProps.js +0 -2
  251. package/dist/npm/interfaces/GanttNoRecordsProps.d.ts +0 -10
  252. package/dist/npm/interfaces/GanttNoRecordsProps.js +0 -2
  253. package/dist/npm/interfaces/GanttProps.js +0 -2
  254. package/dist/npm/interfaces/GanttRowProps.d.ts +0 -92
  255. package/dist/npm/interfaces/GanttRowProps.js +0 -2
  256. package/dist/npm/interfaces/GanttSelectableSettings.d.ts +0 -18
  257. package/dist/npm/interfaces/GanttSelectableSettings.js +0 -3
  258. package/dist/npm/interfaces/GanttSlotType.d.ts +0 -4
  259. package/dist/npm/interfaces/GanttSlotType.js +0 -2
  260. package/dist/npm/interfaces/GanttSortSettings.d.ts +0 -13
  261. package/dist/npm/interfaces/GanttSortSettings.js +0 -23
  262. package/dist/npm/interfaces/GanttTaskModelFields.d.ts +0 -55
  263. package/dist/npm/interfaces/GanttTaskModelFields.js +0 -2
  264. package/dist/npm/interfaces/GanttView.js +0 -2
  265. package/dist/npm/interfaces/GanttViewTimelineHeaderCellProps.d.ts +0 -19
  266. package/dist/npm/interfaces/GanttViewTimelineHeaderCellProps.js +0 -2
  267. package/dist/npm/interfaces/Rectangle.d.ts +0 -6
  268. package/dist/npm/interfaces/Rectangle.js +0 -2
  269. package/dist/npm/interfaces/Slot.d.ts +0 -12
  270. package/dist/npm/interfaces/Slot.js +0 -2
  271. package/dist/npm/interfaces/TaskModelFields.d.ts +0 -15
  272. package/dist/npm/interfaces/TaskModelFields.js +0 -2
  273. package/dist/npm/interfaces/events.js +0 -85
  274. package/dist/npm/main.d.ts +0 -26
  275. package/dist/npm/main.js +0 -46
  276. package/dist/npm/messages/index.d.ts +0 -137
  277. package/dist/npm/messages/index.js +0 -141
  278. package/dist/npm/package-metadata.d.ts +0 -5
  279. package/dist/npm/package-metadata.js +0 -14
  280. package/dist/npm/rows/GanttRow.d.ts +0 -5
  281. package/dist/npm/rows/GanttRow.js +0 -8
  282. package/dist/npm/utils/data-operations.d.ts +0 -43
  283. package/dist/npm/utils/data-operations.js +0 -326
  284. package/dist/npm/utils/index.d.ts +0 -178
  285. package/dist/npm/utils/index.js +0 -485
  286. package/dist/npm/views/GanttDayView.js +0 -105
  287. package/dist/npm/views/GanttMonthView.js +0 -81
  288. package/dist/npm/views/GanttWeekView.d.ts +0 -13
  289. package/dist/npm/views/GanttWeekView.js +0 -87
  290. package/dist/npm/views/GanttYearView.js +0 -73
  291. package/dist/systemjs/kendo-react-gantt.js +0 -1
  292. package/e2e-next/gantt.basic.tests.ts +0 -24
@@ -1,455 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
13
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
14
- if (ar || !(i in from)) {
15
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
16
- ar[i] = from[i];
17
- }
18
- }
19
- return to.concat(ar || Array.prototype.slice.call(from));
20
- };
21
- import * as React from 'react';
22
- import { classNames, getter } from '@progress/kendo-react-common';
23
- import { getDate, addDays, ZonedDate, addMonths, firstDayInWeek, MS_PER_MINUTE } from '@progress/kendo-date-math';
24
- import { mapTree as mapTreeCommon, extendDataItem as extendDataItemCommon } from '@progress/kendo-react-common';
25
- import { filterBy as filterByCommon, orderBy as orderByCommon } from '@progress/kendo-react-data-tools';
26
- import { createDataTree as treeListCreateDataTree } from '@progress/kendo-react-treelist';
27
- /**
28
- * Orders the specified tree according to the provided sort descriptors.
29
- *
30
- * @param {T[]} data - The data that will be sorted.
31
- * @param {SortDescriptor[]} descriptors - The descriptors by which the data will be sorted.
32
- * @param {string} subItemsField - The field which points to the subitems collection of each data item.
33
- * @returns {T[]} - The sorted data.
34
- */
35
- export var orderBy = orderByCommon;
36
- /**
37
- * Filters the provided data tree according to the specified `Array<FilterDescriptor|CompositeFilterDescriptor>`.
38
- *
39
- * @param {T[]} data - The data that will be filtered.
40
- * @param {FilterDescriptor[]|CompositeFilterDescriptor[]} descriptors - The filter criteria that will be applied.
41
- * @param {string} subItemsField - The field which points to the subitems collection of each data item.
42
- * @returns {T[]} - The filtered data.
43
- */
44
- export var filterBy = filterByCommon;
45
- /**
46
- * Creates a new array with the results of calling the provided callback function
47
- * on every element in the provided data tree.
48
- *
49
- * @param {any[]} tree - The data tree.
50
- * @param {string} subItemsField - The field which points to the subitems collection of each data item.
51
- * @param {(value: any) => any} callback - The callback function.
52
- * @returns {any[]} - The new data tree.
53
- */
54
- export var mapTree = mapTreeCommon;
55
- /**
56
- * Similar to the `Object.assign` function. Additionally, creates a new array for the subitems.
57
- *
58
- * @param {object} item - The source data item.
59
- * @param {string} subItemsField - The field which points to the subitems collection of each data item.
60
- * @param {object} propsToExtend - The props with which the source data item will be extended.
61
- * @returns {object} - The target data item.
62
- */
63
- export var extendDataItem = extendDataItemCommon;
64
- /**
65
- * Creates a tree from the passed dataset.
66
- *
67
- * @param {object[]} dataset - The source dataset of data items.
68
- * @param {(item: object) => any} getId - A function which will return the id of the data item.
69
- * @param {(item: object) => any} getParentId - A function which will return the data item id of its parent data item.
70
- * @param {string} subItemsField - The field which points to the subitems collection of each data item.
71
- * @returns {object[]} - A collection of the generated data items that are structured in a tree.
72
- */
73
- export var createDataTree = treeListCreateDataTree;
74
- import { HOUR_DATE_FORMAT, DAY_DATE_FORMAT, MS_PER_DAY, DAYS_IN_WEEK_COUNT, MONTH_DATE_FORMAT, DEFAULT_TASK_MODEL_FIELDS, DEFAULT_DEPENDENCY_MODEL_FIELDS, YEAR_DATE_FORMAT } from '../constants';
75
- /** @hidden */
76
- export var getTaskModelFields = function (taskModelFields) {
77
- return { fields: __assign(__assign({}, DEFAULT_TASK_MODEL_FIELDS), taskModelFields) };
78
- };
79
- /** @hidden */
80
- export var getDependencyModelFields = function (dependencyModelFields) {
81
- return { fields: __assign(__assign({}, DEFAULT_DEPENDENCY_MODEL_FIELDS), dependencyModelFields) };
82
- };
83
- /** @hidden */
84
- export var getStartDate = function (date) { return getDate(date); };
85
- /** @hidden */
86
- export var getEndDate = function (date, numberOfDays) { return getDate(addDays(date, numberOfDays || 1)); };
87
- /** @hidden */
88
- export var isInRange = function (slotStart, slotEnd, taskStart, taskEnd) { return taskStart < slotEnd && slotStart <= taskEnd; };
89
- /** @hidden */
90
- export function toUTCDateTime(localDate) {
91
- return new Date(Date.UTC(localDate.getFullYear(), localDate.getMonth(), localDate.getDate(), localDate.getHours(), localDate.getMinutes(), localDate.getSeconds(), localDate.getMilliseconds()));
92
- }
93
- /** @hidden */
94
- export var ARROW_SIZE = 4;
95
- /** @hidden */
96
- export var MIN_LINE_WIDTH = 10;
97
- /** @hidden */
98
- // 0 - Finish-Finish
99
- // 1 - Finish-Start
100
- // 2 - Start-Finish
101
- // 3 - Start-Start
102
- export var dependencyCoordinates = function (from, to, rowHeight, type) {
103
- var points = [];
104
- var currentTop = 0;
105
- var currentLeft = 0;
106
- var minTurnWidth = MIN_LINE_WIDTH;
107
- var minTurnHeight = Math.floor(rowHeight / 2);
108
- var drawingDown = from.top < to.top;
109
- var addPoint = function () { return points.push({ left: currentLeft, top: currentTop }); };
110
- if (type === 0 || type === 3) {
111
- var dir = type === 3 ? 'start' : 'end';
112
- currentTop = from.top;
113
- currentLeft = from[dir];
114
- addPoint();
115
- currentLeft = Math[dir === 'start' ? 'min' : 'max'](from[dir], to[dir]);
116
- currentLeft = dir === 'start' ? currentLeft - minTurnWidth : currentLeft + minTurnWidth;
117
- addPoint();
118
- currentTop = to.top;
119
- addPoint();
120
- currentLeft = dir === 'start' ? to[dir] - ARROW_SIZE : to[dir] + ARROW_SIZE;
121
- addPoint();
122
- addArrow(currentTop, currentLeft, points, dir !== 'start');
123
- }
124
- else {
125
- var startDir = type === 2 ? 'start' : 'end';
126
- var endDir = type === 2 ? 'end' : 'start';
127
- var simpleLine = type === 2 ?
128
- from[startDir] - (MIN_LINE_WIDTH * 2) >= to[endDir] :
129
- from[startDir] + (MIN_LINE_WIDTH * 2) <= to[endDir];
130
- currentTop = from.top;
131
- currentLeft = from[startDir];
132
- addPoint();
133
- currentLeft = startDir === 'start' ? currentLeft - minTurnWidth : currentLeft + minTurnWidth;
134
- addPoint();
135
- if (!simpleLine) {
136
- currentTop = drawingDown ? currentTop + minTurnHeight : currentTop - minTurnHeight;
137
- addPoint();
138
- currentLeft = startDir === 'start' ? to[endDir] + minTurnWidth : to[endDir] - minTurnWidth;
139
- addPoint();
140
- }
141
- currentTop = to.top;
142
- addPoint();
143
- currentLeft = endDir === 'start' ? to[endDir] - ARROW_SIZE : to[endDir] + ARROW_SIZE;
144
- addPoint();
145
- addArrow(currentTop, currentLeft, points, endDir !== 'start');
146
- }
147
- return points;
148
- };
149
- /** @hidden */
150
- export var addArrow = function (top, left, points, isArrowWest) {
151
- return isArrowWest ? addArrowWest(top, left, points) : addArrowEast(top, left, points);
152
- };
153
- /** @hidden */
154
- export var addArrowWest = function (top, left, points) {
155
- points.push({
156
- top: top - (ARROW_SIZE / 2),
157
- left: left
158
- });
159
- points.push({
160
- top: top,
161
- left: left - ARROW_SIZE + 1
162
- });
163
- points.push({
164
- top: top + (ARROW_SIZE / 2),
165
- left: left
166
- });
167
- points.push({
168
- top: top,
169
- left: left
170
- });
171
- };
172
- /** @hidden */
173
- export var addArrowEast = function (top, left, points) {
174
- points.push({
175
- top: top + (ARROW_SIZE / 2),
176
- left: left
177
- });
178
- points.push({
179
- top: top,
180
- left: left + ARROW_SIZE - 1
181
- });
182
- points.push({
183
- top: top - (ARROW_SIZE / 2),
184
- left: left
185
- });
186
- points.push({
187
- top: top,
188
- left: left
189
- });
190
- };
191
- /**
192
- * @hidden
193
- */
194
- export var getWorkDays = function (options) {
195
- if (options.workWeekStart === undefined || options.workWeekEnd === undefined) {
196
- return [];
197
- }
198
- var workDays = [];
199
- var dayIndex = options.workWeekStart;
200
- workDays.push(dayIndex);
201
- while (options.workWeekEnd !== dayIndex) {
202
- if (dayIndex > 6) {
203
- dayIndex -= 7;
204
- }
205
- else {
206
- dayIndex++;
207
- }
208
- workDays.push(dayIndex);
209
- }
210
- return workDays;
211
- };
212
- /**
213
- * @hidden
214
- */
215
- export var isWorkDay = function (date, workDays) {
216
- var day = date.getDay();
217
- return workDays.indexOf(day) > -1;
218
- };
219
- /**
220
- * @hidden
221
- */
222
- export var toRanges = function (dateRange, _a) {
223
- var step = _a.step, timezone = _a.timezone;
224
- var ranges = [];
225
- // TODO: not sure we need this conversion here and in Scheduler when dateRange already contains zoned dates
226
- var zonedRangeStart = ZonedDate.fromLocalDate(dateRange.start, timezone);
227
- var zonedRangeEnd = ZonedDate.fromLocalDate(dateRange.end, timezone);
228
- var current = zonedRangeStart.clone();
229
- while (current.getTime() < zonedRangeEnd.getTime()) {
230
- var zonedStart = current.clone();
231
- var zonedEnd = zonedStart.clone().addTime(step);
232
- var start = new Date(zonedStart.getTime());
233
- var end = new Date(zonedEnd.getTime());
234
- var range = {
235
- end: end,
236
- start: start,
237
- zonedStart: zonedStart,
238
- zonedEnd: zonedEnd
239
- };
240
- ranges.push(range);
241
- current = current.addTime(step);
242
- }
243
- return ranges;
244
- };
245
- /**
246
- * @hidden
247
- */
248
- export var toWeekRanges = function (dateRange, _a, intl) {
249
- var timezone = _a.timezone;
250
- var ranges = [];
251
- var zonedRangeStart = ZonedDate.fromLocalDate(dateRange.start, timezone);
252
- var zonedRangeEnd = ZonedDate.fromLocalDate(dateRange.end, timezone);
253
- for (var current = zonedRangeStart.clone(), index = 0; current.getTime() < zonedRangeEnd.getTime(); index++) {
254
- var zonedStart = current.clone();
255
- var endCandidate = getEndDate(firstDayInWeek(getDate(zonedStart), intl.firstDay()), DAYS_IN_WEEK_COUNT);
256
- var zonedEndCandidate = ZonedDate.fromUTCDate(toUTCDateTime(endCandidate), timezone);
257
- var zonedEnd = zonedEndCandidate.getTime() > zonedRangeEnd.getTime() ? zonedRangeEnd.clone() : zonedEndCandidate;
258
- current = zonedEnd.clone();
259
- var start = new Date(zonedStart.getTime());
260
- var end = new Date(zonedEnd.getTime());
261
- var range = {
262
- end: end,
263
- start: start,
264
- zonedStart: zonedStart,
265
- zonedEnd: zonedEnd
266
- };
267
- ranges.push(range);
268
- }
269
- return ranges;
270
- };
271
- /**
272
- * @hidden
273
- */
274
- export var toMonthRanges = function (dateRange, _a) {
275
- var timezone = _a.timezone;
276
- var ranges = [];
277
- var zonedRangeStart = ZonedDate.fromLocalDate(dateRange.start, timezone);
278
- var zonedRangeEnd = ZonedDate.fromLocalDate(dateRange.end, timezone);
279
- for (var current = zonedRangeStart.clone(), index = 0; current.getTime() < zonedRangeEnd.getTime(); index++) {
280
- var zonedStart = current.clone();
281
- var zonedEnd = ZonedDate.fromLocalDate(addMonths(new Date(zonedStart.getTime()), 1), timezone);
282
- current = zonedEnd.clone();
283
- var start = new Date(zonedStart.getTime());
284
- var end = new Date(zonedEnd.getTime());
285
- var range = {
286
- end: end,
287
- start: start,
288
- zonedStart: zonedStart,
289
- zonedEnd: zonedEnd
290
- };
291
- ranges.push(range);
292
- }
293
- return ranges;
294
- };
295
- /**
296
- * @hidden
297
- */
298
- export var toYearRanges = function (dateRange, _a) {
299
- var timezone = _a.timezone;
300
- var ranges = [];
301
- var zonedRangeStart = ZonedDate.fromLocalDate(dateRange.start, timezone);
302
- var zonedRangeEnd = ZonedDate.fromLocalDate(dateRange.end, timezone);
303
- for (var current = zonedRangeStart.clone(), index = 0; current.getTime() < zonedRangeEnd.getTime(); index++) {
304
- var zonedStart = current.clone();
305
- var zonedEnd = ZonedDate.fromLocalDate(addMonths(new Date(zonedStart.getTime()), 12), timezone);
306
- current = zonedEnd.clone();
307
- var start = new Date(zonedStart.getTime());
308
- var end = new Date(zonedEnd.getTime());
309
- var range = {
310
- end: end,
311
- start: start,
312
- zonedStart: zonedStart,
313
- zonedEnd: zonedEnd
314
- };
315
- ranges.push(range);
316
- }
317
- return ranges;
318
- };
319
- /**
320
- * @hidden
321
- */
322
- export var getHourSlots = function (range, options, intl) {
323
- var workDayStart = intl.parseDate(options.workDayStart).getHours();
324
- var workDayEnd = intl.parseDate(options.workDayEnd).getHours();
325
- var ranges = toRanges(range, { step: MS_PER_MINUTE * options.slotDuration, timezone: options.timezone });
326
- return ranges.map(function (currentRange) {
327
- var hours = currentRange.zonedStart.getHours();
328
- return {
329
- range: currentRange,
330
- isWork: hours >= workDayStart && hours < workDayEnd,
331
- span: 1,
332
- text: intl.formatDate(currentRange.zonedStart, HOUR_DATE_FORMAT),
333
- type: 'time'
334
- };
335
- });
336
- };
337
- /**
338
- * @hidden
339
- */
340
- export var getDaySlots = function (range, options, intl) {
341
- var ranges = toRanges(range, { step: MS_PER_DAY, timezone: options.timezone });
342
- return ranges.map(function (currentRange) {
343
- return {
344
- range: currentRange,
345
- isWork: isWorkDay(currentRange.start, options.workDays),
346
- span: 1,
347
- text: intl.formatDate(currentRange.zonedStart, DAY_DATE_FORMAT),
348
- type: 'day'
349
- };
350
- });
351
- };
352
- /**
353
- * @hidden
354
- */
355
- export var getWeekSlots = function (range, options, intl) {
356
- var ranges = toWeekRanges(range, { timezone: options.timezone }, intl);
357
- return ranges.map(function (currentRange) {
358
- var span = Math.round((currentRange.zonedEnd.getTime() - currentRange.zonedStart.getTime()) / MS_PER_DAY);
359
- return {
360
- range: currentRange,
361
- isWork: false,
362
- span: span,
363
- text: "".concat(intl.formatDate(currentRange.zonedStart, DAY_DATE_FORMAT), " - ").concat(intl.formatDate(currentRange.zonedEnd, DAY_DATE_FORMAT)),
364
- type: 'week'
365
- };
366
- });
367
- };
368
- /**
369
- * @hidden
370
- */
371
- export var getMonthSlots = function (range, options, intl) {
372
- var ranges = toMonthRanges(range, { timezone: options.timezone });
373
- return ranges.map(function (currentRange) {
374
- var span = Math.round((currentRange.zonedEnd.getTime() - currentRange.zonedStart.getTime()) / MS_PER_DAY);
375
- return {
376
- range: currentRange,
377
- isWork: false,
378
- span: span,
379
- text: intl.formatDate(currentRange.zonedStart, MONTH_DATE_FORMAT),
380
- type: 'month'
381
- };
382
- });
383
- };
384
- /**
385
- * @hidden
386
- */
387
- export var getYearSlots = function (range, options, intl) {
388
- var ranges = toYearRanges(range, { timezone: options.timezone });
389
- return ranges.map(function (currentRange) {
390
- var span = Math.round((currentRange.zonedEnd.getTime() - currentRange.zonedStart.getTime()) / MS_PER_DAY);
391
- return {
392
- range: currentRange,
393
- isWork: false,
394
- span: span,
395
- text: intl.formatDate(currentRange.zonedStart, YEAR_DATE_FORMAT),
396
- type: 'year'
397
- };
398
- });
399
- };
400
- /**
401
- * @hidden
402
- */
403
- export var getTimelineHeader = function (slotLevels, ref, timelineHeaderCell) {
404
- var HeaderCell = timelineHeaderCell;
405
- return (React.createElement("table", { className: 'k-table k-table-md', ref: ref, "aria-hidden": true },
406
- React.createElement("tbody", { className: 'k-table-tbody' }, slotLevels.map(function (slotLevel, slotLevelIdx) { return (React.createElement("tr", { className: 'k-table-row', key: slotLevelIdx }, slotLevel.map(function (slot, slotIndex) { return (React.createElement("td", { key: slot.range.start.getTime(), colSpan: slot.span, className: classNames('k-table-th', {
407
- 'k-header': true,
408
- 'k-nonwork-hour': !slot.isWork
409
- }) }, HeaderCell ?
410
- (React.createElement(HeaderCell, { rowIndex: slotLevelIdx, index: slotIndex, range: slot.range, text: slot.text, isWork: slot.isWork, type: slot.type })) : slot.text)); }))); }))));
411
- };
412
- /**
413
- * @hidden
414
- */
415
- export var getTimelineContent = function (slotLevels, ref) {
416
- var lastSlotLevel = slotLevels[slotLevels.length - 1];
417
- return (React.createElement("table", { className: 'k-table k-table-md k-gantt-columns', ref: ref, "aria-hidden": true },
418
- React.createElement("tbody", { className: 'k-table-tbody' },
419
- React.createElement("tr", { className: 'k-table-row' }, lastSlotLevel.map(function (slot) { return (React.createElement("td", { key: slot.range.start.getTime(), colSpan: slot.span, className: classNames('k-table-td', {
420
- 'k-nonwork-hour': !slot.isWork
421
- }) })); })))));
422
- };
423
- /**
424
- * @hidden
425
- */
426
- export var getTimelineWidth = function (slotLevels, slotWidth) {
427
- var lastSlotLevel = slotLevels[slotLevels.length - 1];
428
- var maxSpan = 0;
429
- var totalSpan = 0;
430
- lastSlotLevel.forEach(function (slot) {
431
- var currentSpan = slot.span;
432
- totalSpan += currentSpan;
433
- if (currentSpan > maxSpan) {
434
- maxSpan = currentSpan;
435
- }
436
- });
437
- return Math.round((totalSpan * slotWidth) / maxSpan);
438
- };
439
- /**
440
- * @hidden
441
- */
442
- export var isExpanded = function (dataItem, expandedField) { return Boolean(getter(expandedField)(dataItem)); };
443
- /**
444
- * @hidden
445
- */
446
- export var hasChildren = function (dataItem, childrenField) { return Boolean(getter(childrenField)(dataItem)); };
447
- /**
448
- * @hidden
449
- */
450
- export var expandedChildren = function (expandedField, childrenField) { return function (dataItem) {
451
- if (isExpanded(dataItem, expandedField) && hasChildren(dataItem, childrenField)) {
452
- return __spreadArray([], getter(childrenField)(dataItem), true);
453
- }
454
- return [];
455
- }; };
@@ -1,17 +0,0 @@
1
- import * as React from 'react';
2
- import { GanttViewHandle, GanttViewProps } from '../interfaces/GanttView';
3
- /**
4
- * @hidden
5
- */
6
- export interface GanttDayViewProps extends GanttViewProps {
7
- /**
8
- * The span of an hour slot. Defaults to 1.
9
- */
10
- slotDuration?: number;
11
- }
12
- /**
13
- * Represents the KendoReact DayView Component.
14
- */
15
- export declare const GanttDayView: React.ForwardRefExoticComponent<GanttDayViewProps & React.RefAttributes<GanttViewHandle | null>>;
16
- /** @hidden */
17
- export declare const defaultProps: GanttDayViewProps;
@@ -1,102 +0,0 @@
1
- import * as React from 'react';
2
- import * as PropTypes from 'prop-types';
3
- import { ZonedDate } from '@progress/kendo-date-math';
4
- import { BaseView } from '../components/BaseView';
5
- import { toUTCDateTime, getStartDate, getEndDate, getWorkDays, getDaySlots, getHourSlots } from '../utils';
6
- import { useGanttDateRangeContext, useGanttPropsContext } from '../context/GanttContext';
7
- import { messages, dayViewTitle } from '../messages';
8
- import { useInternationalization } from '@progress/kendo-react-intl';
9
- import { DEFAULT_COLUMN_WIDTH } from '../constants';
10
- /**
11
- * Represents the KendoReact DayView Component.
12
- */
13
- export var GanttDayView = React.forwardRef(function (props, ref) {
14
- var _a = props.slotWidth, slotWidth = _a === void 0 ? defaultProps.slotWidth : _a, _b = props.slotDuration, slotDuration = _b === void 0 ? defaultProps.slotDuration : _b, firstSlotRangeRef = props.firstSlotRangeRef, timelineHeaderCell = props.timelineHeaderCell;
15
- var timezone = useGanttPropsContext().timezone;
16
- var intl = useInternationalization();
17
- var dayViewRef = React.useRef(null);
18
- var baseViewRef = React.useRef(null);
19
- var scrollIntoView = React.useCallback(function (options) {
20
- if (baseViewRef.current) {
21
- baseViewRef.current.scrollIntoView(options);
22
- }
23
- }, []);
24
- React.useImperativeHandle(dayViewRef, function () { return ({ scrollIntoView: scrollIntoView }); });
25
- React.useImperativeHandle(ref, function () { return dayViewRef.current; });
26
- var range = useGanttDateRangeContext();
27
- var workWeekStart = props.workWeekStart || defaultProps.workWeekStart;
28
- var workWeekEnd = props.workWeekEnd || defaultProps.workWeekEnd;
29
- var workDayStart = props.workDayStart || defaultProps.workDayStart;
30
- var workDayEnd = props.workDayEnd || defaultProps.workDayEnd;
31
- var slotLevels = React.useMemo(function () {
32
- var workDays = getWorkDays({
33
- workWeekStart: workWeekStart,
34
- workWeekEnd: workWeekEnd
35
- });
36
- var hourSlots = [];
37
- var daySlots = getDaySlots(range, { workDays: workDays, timezone: timezone }, intl);
38
- daySlots.forEach(function (daySlot) {
39
- var hours = getHourSlots(daySlot.range, {
40
- workDayStart: workDayStart,
41
- workDayEnd: workDayEnd,
42
- timezone: timezone,
43
- slotDuration: slotDuration
44
- }, intl);
45
- daySlot.span = hours.length;
46
- hourSlots.push.apply(hourSlots, hours);
47
- });
48
- if (firstSlotRangeRef && hourSlots[0]) {
49
- firstSlotRangeRef.current = hourSlots[0].range;
50
- }
51
- return [daySlots, hourSlots];
52
- }, [timezone, range.start.getTime(), range.end.getTime(), intl, workWeekStart, workWeekEnd, workDayStart, workDayEnd]);
53
- return (React.createElement(BaseView, { ref: baseViewRef, slotWidth: slotWidth, slotLevels: slotLevels, timelineHeaderCell: timelineHeaderCell }));
54
- });
55
- var dayViewDateRange = function (_a) {
56
- // e.g.:
57
- // Gantt timezone: America/New_York (-4h)
58
- // PC timezone: Europe/Sofia (+3h)
59
- // tasksStart: Sun Jun 01 2014 03:00:00 GMT+0300 (Eastern European Summer Time)
60
- var tasksStart = _a.tasksStart, tasksEnd = _a.tasksEnd, timezone = _a.timezone;
61
- // Sat May 31 2014 20:00:00 GMT-0400 (EDT)
62
- var zonedTasksStart = ZonedDate.fromLocalDate(tasksStart, timezone);
63
- var zonedTasksEnd = ZonedDate.fromLocalDate(tasksEnd, timezone);
64
- // Sat May 31 2014 00:00:00 GMT+0300 (Eastern European Summer Time)
65
- var firstDate = getStartDate(zonedTasksStart);
66
- var lastDate = getEndDate(zonedTasksEnd);
67
- var zonedStart = ZonedDate.fromUTCDate(toUTCDateTime(firstDate), timezone);
68
- var zonedEnd = ZonedDate.fromUTCDate(toUTCDateTime(lastDate), timezone);
69
- return {
70
- // Sat May 31 2014 07:00:00 GMT+0300 (Eastern European Summer Time)
71
- start: new Date(zonedStart.getTime()),
72
- end: new Date(zonedEnd.getTime()),
73
- // Sat May 31 2014 00:00:00 GMT-0400 (EDT)
74
- zonedStart: zonedStart,
75
- zonedEnd: zonedEnd
76
- };
77
- };
78
- /** @hidden */
79
- export var defaultProps = {
80
- name: 'day',
81
- dateRange: dayViewDateRange,
82
- title: function (localization) { return localization.toLanguageString(dayViewTitle, messages[dayViewTitle]); },
83
- slotWidth: DEFAULT_COLUMN_WIDTH,
84
- slotDuration: 60,
85
- workWeekStart: 1,
86
- workWeekEnd: 5,
87
- workDayStart: '08:00',
88
- workDayEnd: '17:00'
89
- };
90
- GanttDayView.defaultProps = defaultProps;
91
- GanttDayView.propTypes = {
92
- name: PropTypes.string,
93
- dateRange: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
94
- title: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
95
- slotWidth: PropTypes.number,
96
- slotDuration: PropTypes.number,
97
- workWeekStart: PropTypes.number,
98
- workWeekEnd: PropTypes.number,
99
- workDayStart: PropTypes.string,
100
- workDayEnd: PropTypes.string
101
- };
102
- GanttDayView.displayName = 'KendoReactGanttDayView';
@@ -1,13 +0,0 @@
1
- import * as React from 'react';
2
- import { GanttViewHandle, GanttViewProps } from '../interfaces/GanttView';
3
- /**
4
- * @hidden
5
- */
6
- export interface GanttMonthViewProps extends GanttViewProps {
7
- }
8
- /**
9
- * Represents the KendoReact MonthView Component.
10
- */
11
- export declare const GanttMonthView: React.ForwardRefExoticComponent<GanttMonthViewProps & React.RefAttributes<GanttViewHandle | null>>;
12
- /** @hidden */
13
- export declare const defaultProps: GanttMonthViewProps;
@@ -1,78 +0,0 @@
1
- import * as React from 'react';
2
- import * as PropTypes from 'prop-types';
3
- import { getDate, ZonedDate, addDays, firstDayOfMonth, lastDayOfMonth } from '@progress/kendo-date-math';
4
- import { BaseView } from '../components/BaseView';
5
- import { toUTCDateTime, getMonthSlots, getWeekSlots } from '../utils';
6
- import { useGanttPropsContext, useGanttDateRangeContext } from '../context/GanttContext';
7
- import { DEFAULT_COLUMN_WIDTH } from '../constants';
8
- import { messages, monthViewTitle } from '../messages';
9
- import { useInternationalization } from '@progress/kendo-react-intl';
10
- /**
11
- * Represents the KendoReact MonthView Component.
12
- */
13
- export var GanttMonthView = React.forwardRef(function (props, ref) {
14
- var _a = props.slotWidth, slotWidth = _a === void 0 ? defaultProps.slotWidth : _a, firstSlotRangeRef = props.firstSlotRangeRef, timelineHeaderCell = props.timelineHeaderCell;
15
- var timezone = useGanttPropsContext().timezone;
16
- var intl = useInternationalization();
17
- var monthViewRef = React.useRef(null);
18
- var baseViewRef = React.useRef(null);
19
- var scrollIntoView = React.useCallback(function (options) {
20
- if (baseViewRef.current) {
21
- baseViewRef.current.scrollIntoView(options);
22
- }
23
- }, []);
24
- React.useImperativeHandle(monthViewRef, function () { return ({ scrollIntoView: scrollIntoView }); });
25
- React.useImperativeHandle(ref, function () { return monthViewRef.current; });
26
- var range = useGanttDateRangeContext();
27
- var slotLevels = React.useMemo(function () {
28
- var weekSlots = [];
29
- var monthSlots = getMonthSlots(range, { timezone: timezone }, intl);
30
- monthSlots.forEach(function (monthSlot) {
31
- var weeks = getWeekSlots(monthSlot.range, { timezone: timezone }, intl);
32
- weekSlots.push.apply(weekSlots, weeks);
33
- });
34
- if (firstSlotRangeRef && weekSlots[0]) {
35
- firstSlotRangeRef.current = weekSlots[0].range;
36
- }
37
- return [monthSlots, weekSlots];
38
- }, [timezone, range.start.getTime(), range.end.getTime(), intl]);
39
- return (React.createElement(BaseView, { ref: baseViewRef, slotWidth: slotWidth, slotLevels: slotLevels, timelineHeaderCell: timelineHeaderCell }));
40
- });
41
- var monthViewDateRange = function (_a) {
42
- var tasksStart = _a.tasksStart, tasksEnd = _a.tasksEnd, timezone = _a.timezone;
43
- var zonedTasksStart = ZonedDate.fromLocalDate(tasksStart, timezone);
44
- var zonedTasksEnd = ZonedDate.fromLocalDate(tasksEnd, timezone);
45
- var firstDay = firstDayOfMonth(getDate(zonedTasksStart));
46
- var lastDay = addDays(lastDayOfMonth(getDate(zonedTasksEnd)), 1);
47
- var zonedStart = ZonedDate.fromUTCDate(toUTCDateTime(firstDay), timezone);
48
- var zonedEnd = ZonedDate.fromUTCDate(toUTCDateTime(lastDay), timezone);
49
- return {
50
- start: new Date(zonedStart.getTime()),
51
- end: new Date(zonedEnd.getTime()),
52
- zonedStart: zonedStart,
53
- zonedEnd: zonedEnd
54
- };
55
- };
56
- /** @hidden */
57
- export var defaultProps = {
58
- name: 'month',
59
- dateRange: monthViewDateRange,
60
- title: function (localization) { return localization.toLanguageString(monthViewTitle, messages[monthViewTitle]); },
61
- slotWidth: DEFAULT_COLUMN_WIDTH,
62
- workWeekStart: 1,
63
- workWeekEnd: 5,
64
- workDayStart: '08:00',
65
- workDayEnd: '17:00'
66
- };
67
- GanttMonthView.defaultProps = defaultProps;
68
- GanttMonthView.propTypes = {
69
- name: PropTypes.string,
70
- dateRange: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
71
- title: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
72
- slotWidth: PropTypes.number,
73
- workWeekStart: PropTypes.number,
74
- workWeekEnd: PropTypes.number,
75
- workDayStart: PropTypes.string,
76
- workDayEnd: PropTypes.string
77
- };
78
- GanttMonthView.displayName = 'GanttMonthView';