///
import { Prompt } from 'enquirer';
interface ITreeItem {
id: any;
name: string;
children?: Array;
}
interface ITree {
value: ITreeItem;
show: boolean;
checked: boolean;
children?: Array;
}
interface ITreeSelectOptions {
name?: string | (() => string);
type?: string | (() => string);
message?: string | (() => string) | (() => Promise);
initial?: Array;
required?: boolean;
choices: Array;
header?: string;
format?: (value: ITreeItem) => string | Promise;
result?(value: string): string | Promise;
skip?: ((state: object) => boolean | Promise) | boolean;
validate?(value: string): boolean | Promise | string | Promise;
onSubmit?(name: string, value: any, prompt: typeof Prompt): boolean | Promise;
onCancel?(name: string, value: any, prompt: typeof Prompt): boolean | Promise;
stdin?: NodeJS.ReadStream;
stdout?: NodeJS.WriteStream;
}
declare const Base: any;
export declare class TreeSelectPrompt extends Base {
value: Array;
/** 列表 */
tree: Array;
/** 当前活动行在第几行 */
active: number;
/** 分页数据 */
paging: Array<{
node: ITree;
str: string;
}>;
constructor(options: ITreeSelectOptions);
/** 原始选项转化节点树 */
origin2tree(choices: Array, initial: Array): Array;
/** 节点树转化原始选项 */
tree2origin(value: Array): Array;
/** 上 */
up(): void;
/** 下 */
down(): void;
/** 左 | 收起 */
left(): void;
/** 右 | 展开 */
right(): void;
/** 切换选中项 */
space(): void;
/** 生成渲染内容 */
generateList(): string;
/** 渲染 */
render(): Promise;
}
export {};