42 lines
		
	
	
		
			940 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
		
		
			
		
	
	
			42 lines
		
	
	
		
			940 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| 
								 | 
							
								// jamsh 
							 | 
						||
| 
								 | 
							
								var ui = UI.UI({
							 | 
						||
| 
								 | 
							
								    pages   : 1,
							 | 
						||
| 
								 | 
							
								    styles  : {},
							 | 
						||
| 
								 | 
							
								    terminal: '',
							 | 
						||
| 
								 | 
							
								    title   : 'Test APP'
							 | 
						||
| 
								 | 
							
								});
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								function exit2() {
							 | 
						||
| 
								 | 
							
								  process.exit();
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								print(ui)
							 | 
						||
| 
								 | 
							
								ui.init();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								var data =  [
							 | 
						||
| 
								 | 
							
								  ['X','Y','Z'],
							 | 
						||
| 
								 | 
							
								  ['0','0','0'],
							 | 
						||
| 
								 | 
							
								  ['0','1','1'],
							 | 
						||
| 
								 | 
							
								  ['1','0','1'],
							 | 
						||
| 
								 | 
							
								  ['1','1','0'],
							 | 
						||
| 
								 | 
							
								]
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								ui.pages[1]={
							 | 
						||
| 
								 | 
							
								  quit    : ui.button({left:1,top:1,content:'QUIT', action:exit2}),
							 | 
						||
| 
								 | 
							
								  label1  : ui.label({right:1,top:2, content:'Table Demo'}),
							 | 
						||
| 
								 | 
							
								  table1  : ui.table({left:1,top:6, width:30, data:data, header:{bold:true}}),
							 | 
						||
| 
								 | 
							
								  info1   : ui.info({right:1, top:6, width:40, height:14,  multiline:true, wrap:true, scrollable:true, label:'Info'}),
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								_logs=[]
							 | 
						||
| 
								 | 
							
								Log = function () {
							 | 
						||
| 
								 | 
							
								  var line = Array.prototype.slice.call(arguments).map(function (arg) { 
							 | 
						||
| 
								 | 
							
								    return inspect(arg) }).join(' ');
							 | 
						||
| 
								 | 
							
								  _logs.push(_logs.length+':'+line);
							 | 
						||
| 
								 | 
							
								  ui.pages[1].info1.setValue(_logs.join('\n'));
							 | 
						||
| 
								 | 
							
								  ui.pages[1].info1.scrollBottom();
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								ui.screen.key(['escape', 'q', 'C-c'], exit2);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								ui.start();
							 |