获取表格数据字符串
新增于v0.0.1
脚本举例
import { tableContent } from '@tomato-node/ui';
// 二维数组
const data = [
['0A', '0B', '0C'],
['1A', '1B', '1C'],
['2A', '2B', '2C']
];
const result = tableContent(data);
console.log(result);
╔════╤════╤════╗
║ 0A │ 0B │ 0C ║
╟────┼────┼────╢
║ 1A │ 1B │ 1C ║
╟────┼────┼────╢
║ 2A │ 2B │ 2C ║
╚════╧════╧════╝
搜索自动完成选择器
新增于v0.0.5
脚本举例
import { autocomplete } from '@tomato-node/ui'
autocomplete("autocomplete")("Which one?")(['111','222','333']).then(data=>console.log(data));
//? Which one? 222
// { autocomplete: '222}
多选框
新增于v0.0.5
脚本举例
import { checkbox } from '@tomato-node/ui'
checkbox("checkList")("Who are your friend?")(['brizer','seven']).then(data=>console.log(data));
//? Who are your friend? ['brizer','seven']
// { checkList: ['brizer','seven']}
确认
新增于v0.0.5
脚本举例
import { confirm } from '@tomato-node/ui'
confirm("confirm")("Are you sure?").then(data=>console.log(data));
//? Are you sure? Y
// { confirm: true}
logger生成器
新增于v0.0.3
脚本举例
import { createLogger } from '@tomato-node/ui'
const log = createLogger({name:'mocker'});
//绿色mocker INFO hello
log.info('hello')
//黄色mocker WARN hello
log.warn('hello')
//红色mocker ERROR hello
log.error('hello')
//红色mocker FATAL hello
log.fatal('hello')
字符串输入框
新增于v0.0.5
脚本举例
import { input } from '@tomato-node/ui'
input("name")("What is your name?").then(data=>console.log(data));
//? What is your name? brizer
// { name: 'brizer'}
Loading工厂方法
新增于v0.0.6
脚本举例
import { loading } from '@tomato-js/ui'
//快捷用法
(()=>{
const myloading = loading('waiting');
myloading.show();
//⠼ waiting
myloading.show('waiting more time');
//⠼ waiting more time
myloading.hide();
})()
//定制用法
(()=>{
const myloading = loading({color:'red','text':'fetching'}).show();
//⠼(red) fetching
myloading.show({color:'blue','text':'composing'});
//⠼(blue) composing
myloading.hide({type:'succeed',text:'done'});
//✔ done
})()
Loading Instance
数字输入框
新增于v0.0.5
脚本举例
import { numberInput } from '@tomato-node/ui'
numberInput("age")("How old are you?").then(data=>console.log(data));
//? How old are you? 28
// { age: 28}
密码输入框
新增于v0.0.5
脚本举例
import { passwordInput } from '@tomato-node/ui'
passwordInput("password")("What is your password?").then(data=>console.log(data));
//? What is your password? [input is hidden] 123456
// { password: '123456'}
单选框
新增于v0.0.5
脚本举例
import { radio } from '@tomato-node/ui'
radio("radio")("Who is your friend?")(['brizer','seven']).then(data=>console.log(data));
//? Who are your friend? brizer
// { radio: 'brizer}
Generated using TypeDoc
简易Log
新增于v0.0.3
脚本举例
import { logger } from '@tomato-node/ui' //绿色LOGGER INFO hello logger.info('hello') //黄色LOGGER WARN hello logger.warn('hello') //红色LOGGER ERROR hello logger.error('hello') //红色LOGGER FATAL hello logger.fatal('hello')