3 const hint = '(Use <shift>+<up/down> to sort)';
4 const Prompt = require('./select');
6 class Sort extends Prompt {
8 super({ ...options, reorder: false, sort: true, multiple: true });
9 this.state.hint = [this.options.hint, hint].find(this.isValue.bind(this));
16 async renderChoice(choice, i) {
17 let str = await super.renderChoice(choice, i);
18 let sym = this.symbols.identicalTo + ' ';
19 let pre = (this.index === i && this.sorting) ? this.styles.muted(sym) : ' ';
20 if (this.options.drag === false) pre = '';
21 if (this.options.numbered === true) {
22 return pre + `${i + 1} - ` + str;
32 this.value = this.choices.map(choice => choice.value);
33 return super.submit();
37 module.exports = Sort;