| Server IP : 85.214.239.14 / Your IP : 216.73.216.178 Web Server : Apache/2.4.65 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Mon Sep 30 15:36:27 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 8.2.29 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/3/task/3/root/proc/3/root/lib/node_modules/pm2/node_modules/enquirer/lib/prompts/ |
Upload File : |
'use strict';
const hint = '(Use <shift>+<up/down> to sort)';
const Prompt = require('./select');
class Sort extends Prompt {
constructor(options) {
super({ ...options, reorder: false, sort: true, multiple: true });
this.state.hint = [this.options.hint, hint].find(this.isValue.bind(this));
}
indicator() {
return '';
}
async renderChoice(choice, i) {
let str = await super.renderChoice(choice, i);
let sym = this.symbols.identicalTo + ' ';
let pre = (this.index === i && this.sorting) ? this.styles.muted(sym) : ' ';
if (this.options.drag === false) pre = '';
if (this.options.numbered === true) {
return pre + `${i + 1} - ` + str;
}
return pre + str;
}
get selected() {
return this.choices;
}
submit() {
this.value = this.choices.map(choice => choice.value);
return super.submit();
}
}
module.exports = Sort;