Tue 27 Aug 00:14:56 CEST 2024
This commit is contained in:
		
							parent
							
								
									2e68b31360
								
							
						
					
					
						commit
						c38fe8d7a2
					
				
							
								
								
									
										41
									
								
								test/test-ui5.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								test/test-ui5.js
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,41 @@
 | 
				
			||||||
 | 
					// 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();
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user