@@ -4,6 +4,7 @@ import DataTask from 'libs/components/viewport/DataTask';
4
4
import DateHelper from 'libs/helpers/DateHelper' ;
5
5
import sizeMe from 'react-sizeme' ;
6
6
import Config from 'libs/helpers/config/Config' ;
7
+ import Registry from 'libs/helpers/registry/Registry' ;
7
8
8
9
export class DataRow extends Component {
9
10
constructor ( props ) {
@@ -36,37 +37,41 @@ export class DataViewPort extends Component {
36
37
37
38
renderRows = ( ) => {
38
39
let result = [ ] ;
39
- for ( let i = this . props . startRow ; i < this . props . endRow + 1 ; i ++ ) {
40
- let item = this . props . data [ i ] ;
41
- if ( ! item ) break ;
42
- //FIXME PAINT IN BOUNDARIES
40
+ const groups = Registry . groupData ( this . props . data , this . props . startRow , this . props . endRow + 1 ) ;
43
41
44
- let new_position = DateHelper . dateToPixel ( item . start , this . props . nowposition , this . props . dayWidth ) ;
45
- let new_width = DateHelper . dateToPixel ( item . end , this . props . nowposition , this . props . dayWidth ) - new_position ;
42
+ Object . keys ( groups ) . forEach ( ( key , i ) => {
43
+ const group = groups [ key ] ;
46
44
result . push (
47
- < DataRow key = { i } label = { item . name } top = { i * this . props . itemheight } left = { 20 } itemheight = { this . props . itemheight } >
48
- < DataTask
49
- item = { item }
50
- label = { item . name }
51
- nowposition = { this . props . nowposition }
52
- dayWidth = { this . props . dayWidth }
53
- color = { item . color }
54
- left = { new_position }
55
- width = { new_width }
56
- height = { this . props . itemheight }
57
- onChildDrag = { this . onChildDrag }
58
- isSelected = { this . props . selectedItem == item }
59
- onSelectItem = { this . props . onSelectItem }
60
- onStartCreateLink = { this . props . onStartCreateLink }
61
- onFinishCreateLink = { this . props . onFinishCreateLink }
62
- onTaskChanging = { this . props . onTaskChanging }
63
- onUpdateTask = { this . props . onUpdateTask }
64
- >
65
- { ' ' }
66
- </ DataTask >
45
+ < DataRow key = { key } label = { key } top = { i * this . props . itemheight } left = { 20 } itemheight = { this . props . itemheight } >
46
+ {
47
+ group . map ( item => {
48
+ let new_position = DateHelper . dateToPixel ( item . start , this . props . nowposition , this . props . dayWidth ) ;
49
+ let new_width = DateHelper . dateToPixel ( item . end , this . props . nowposition , this . props . dayWidth ) - new_position ;
50
+ return < DataTask
51
+ key = { item . id }
52
+ item = { item }
53
+ label = { item . name }
54
+ nowposition = { this . props . nowposition }
55
+ dayWidth = { this . props . dayWidth }
56
+ color = { item . color }
57
+ left = { new_position }
58
+ width = { new_width }
59
+ height = { this . props . itemheight }
60
+ onChildDrag = { this . onChildDrag }
61
+ isSelected = { this . props . selectedItem == item }
62
+ onSelectItem = { this . props . onSelectItem }
63
+ onStartCreateLink = { this . props . onStartCreateLink }
64
+ onFinishCreateLink = { this . props . onFinishCreateLink }
65
+ onTaskChanging = { this . props . onTaskChanging }
66
+ onUpdateTask = { this . props . onUpdateTask }
67
+ >
68
+ { ' ' }
69
+ </ DataTask >
70
+ } )
71
+ }
67
72
</ DataRow >
68
73
) ;
69
- }
74
+ } ) ;
70
75
return result ;
71
76
} ;
72
77
0 commit comments