@@ -5,6 +5,10 @@ import Toolbar from './Components/Menu/toolbar'
55import Stylebar from './Components/Stylebar'
66import StartupBox from './Components/StatupBox'
77
8+ import Navigation from "./Components/Navigation" ;
9+ import ExplorationForm from "./Components/ExplorationForm" ;
10+ import BinCustomizationForm from "./Components/BinCustomizationForm" ;
11+ import HistoryBar from "./Components/HistoryBar"
812
913class App extends Component {
1014
@@ -22,6 +26,16 @@ class App extends Component {
2226 this . onNavFormOpen = this . onNavFormOpen . bind ( this )
2327 this . updateHierFormOption = this . updateHierFormOption . bind ( this )
2428 this . submitHierForm = this . submitHierForm . bind ( this )
29+ //this.onBinFormOpen = this.onBinFormOpen.bind(this)
30+
31+ this . submitNavForm = this . submitNavForm . bind ( this ) ;
32+ this . openBinForm = this . openBinForm . bind ( this ) ;
33+ this . scrollTo = this . scrollTo . bind ( this ) ;
34+ this . updateBreadcrumb = this . updateBreadcrumb . bind ( this ) ;
35+ this . computePath = this . computePath . bind ( this ) ;
36+ this . jumpToHistorialView = this . jumpToHistorialView . bind ( this ) ;
37+ this . brushNlink = this . brushNlink . bind ( this ) ;
38+ this . updateHighlight = this . updateHighlight . bind ( this ) ;
2539 }
2640
2741 onSelectFile ( bookId ) {
@@ -39,7 +53,20 @@ class App extends Component {
3953
4054 onNavFormOpen ( ) {
4155 if ( this . grid !== null ) {
42- this . grid . openNavForm ( ) ;
56+ fetch ( this . grid . urlPrefix + '/api/getSortAttrs/' + this . state . bookId + '/' + this . grid . state . sheetName )
57+ . then ( response => response . json ( ) )
58+ . then ( data => {
59+ console . log ( data )
60+ let options = [ ] ;
61+ for ( let i = 0 ; i < data . data . length ; i ++ ) {
62+ options . push ( {
63+ "text" : data . data [ i ] ,
64+ "value" : i + 1 ,
65+ } )
66+ }
67+ this . navForm . setState ( { options : options , navFormOpen : true } ) ;
68+ this . nav . setState ( { options : data . data } ) ;
69+ } )
4370 }
4471 }
4572
@@ -48,9 +75,85 @@ class App extends Component {
4875 }
4976
5077 submitHierForm ( data ) {
51- this . grid . nav . submitHierForm ( data ) ;
78+ this . nav . submitHierForm ( data ) ;
79+ }
80+
81+ // onBinFormOpen(){
82+ // if (this.grid !== null) {
83+ // this.grid.openBinForm();
84+ // }
85+ // }
86+
87+ submitNavForm ( attribute ) {
88+ if ( attribute ) {
89+ fetch ( this . grid . urlPrefix + '/api/startNav/' + this . state . bookId + '/' + this . grid . state . sheetName + '/' + attribute )
90+ . then ( response => response . json ( ) )
91+ . then ( data => {
92+ console . log ( data ) ;
93+ this . navForm . setState ( { navFormOpen : false , processing : false } ) ;
94+ this . nav . setState ( {
95+ navOpen : true ,
96+ sheetName : this . grid . state . sheetName ,
97+ urlPrefix : this . grid . urlPrefix
98+ } ) ;
99+ this . updateHierFormOption ( this . navForm . state . options ) ;
100+ this . nav . startNav ( data ) ;
101+ this . navBar . setState ( {
102+ breadcrumb_ls : [ ] ,
103+ attribute : 0 ,
104+ open : true ,
105+ navHistoryPathIndex : { } ,
106+ navHistoryTable : { } ,
107+ historyList : [ ] ,
108+ } ) ;
109+ this . grid . setState ( {
110+ exploreCol : attribute - 1 ,
111+ } )
112+ console . log ( this . grid )
113+ this . nav . brushNlink ( this . grid . rowStartIndex , this . grid . rowStopIndex ) ;
114+ } )
115+ }
116+ }
117+
118+ updateBreadcrumb ( breadcrumb_ls , path_index ) {
119+ this . navBar . updateNavPath ( breadcrumb_ls , path_index ) ;
120+ }
121+
122+ jumpToHistorialView ( path ) {
123+ // console.log(path)
124+ this . nav . jumpToHistorialView ( path ) ;
52125 }
53126
127+ computePath ( ) {
128+ return this . nav . computePath ( ) ;
129+ }
130+
131+ openBinForm ( ) {
132+ if ( this . state . navOpen ) {
133+ this . setState ( { binFormOpen : true } ) ;
134+ }
135+ }
136+
137+ scrollTo ( lowerRange ) {
138+ this . grid . grid . scrollToCell ( { columnIndex : 0 , rowIndex : lowerRange } ) ;
139+ }
140+
141+ brushNlink ( lower , upper ) {
142+ if ( this . nav . state . navOpen ) {
143+ this . nav . brushNlink ( lower , upper ) ;
144+ }
145+ }
146+
147+
148+ updateHighlight ( colNum , brushNLinkRows ) {
149+ console . log ( colNum ) ;
150+ console . log ( brushNLinkRows ) ;
151+ this . grid . setState ( {
152+ hierarchicalCol : colNum ,
153+ brushNLinkRows : brushNLinkRows ,
154+ } )
155+
156+ }
54157
55158 render ( ) {
56159 // console.log(this)
@@ -69,9 +172,15 @@ class App extends Component {
69172 < div >
70173 < Toolbar username = { this . state . username } onSelectFile = { this . onSelectFile }
71174 onNavFormOpen = { this . onNavFormOpen } ref = { ref => this . toolBar = ref }
72- submitHierForm = { this . submitHierForm } />
175+ submitHierForm = { this . submitHierForm } />
73176 < Stylebar />
74- < DSGrid bookId = { this . state . bookId } ref = { ref => this . grid = ref }
177+ < HistoryBar ref = { ref => this . navBar = ref } computePath = { this . computePath }
178+ jumpToHistorialView = { this . jumpToHistorialView } />
179+ < Navigation bookId = { this . state . bookId } scrollTo = { this . scrollTo } ref = { ref => this . nav = ref }
180+ updateBreadcrumb = { this . updateBreadcrumb } updateHighlight = { this . updateHighlight } />
181+ < ExplorationForm grid = { this . grid } submitNavForm = { this . submitNavForm }
182+ ref = { ref => this . navForm = ref } />
183+ < DSGrid bookId = { this . state . bookId } ref = { ref => this . grid = ref } brushNlink = { this . brushNlink }
75184 updateHierFormOption = { this . updateHierFormOption } />
76185 </ div >
77186 )
0 commit comments