node_modules updated, buefy add to lib folder
This commit is contained in:
+3
-2
@@ -29,7 +29,6 @@ class CheckboxPrompt extends Base {
|
||||
}
|
||||
|
||||
this.pointer = 0;
|
||||
this.firstRender = true;
|
||||
|
||||
// Make sure no default is set (so it won't be printed)
|
||||
this.opt.default = null;
|
||||
@@ -87,7 +86,7 @@ class CheckboxPrompt extends Base {
|
||||
var message = this.getQuestion();
|
||||
var bottomContent = '';
|
||||
|
||||
if (this.firstRender) {
|
||||
if (!this.spaceKeyPressed) {
|
||||
message +=
|
||||
'(Press ' +
|
||||
chalk.cyan.bold('<space>') +
|
||||
@@ -162,10 +161,12 @@ class CheckboxPrompt extends Base {
|
||||
this.pointer = input - 1;
|
||||
this.toggleChoice(this.pointer);
|
||||
}
|
||||
|
||||
this.render();
|
||||
}
|
||||
|
||||
onSpaceKey() {
|
||||
this.spaceKeyPressed = true;
|
||||
this.toggleChoice(this.pointer);
|
||||
this.render();
|
||||
}
|
||||
|
||||
+1
@@ -21,6 +21,7 @@ class ConfirmPrompt extends Base {
|
||||
if (input != null && input !== '') {
|
||||
value = /^y(es)?/i.test(input);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
});
|
||||
|
||||
+9
@@ -102,6 +102,7 @@ class ExpandPrompt extends Base {
|
||||
if (!input) {
|
||||
input = this.rawDefault;
|
||||
}
|
||||
|
||||
var selected = this.opt.choices.where({ key: input.toLowerCase().trim() })[0];
|
||||
if (!selected) {
|
||||
return null;
|
||||
@@ -130,6 +131,7 @@ class ExpandPrompt extends Base {
|
||||
if (this.selectedKey === choice.key) {
|
||||
choiceStr = chalk.cyan(choiceStr);
|
||||
}
|
||||
|
||||
output += choiceStr;
|
||||
});
|
||||
|
||||
@@ -143,6 +145,7 @@ class ExpandPrompt extends Base {
|
||||
this.render();
|
||||
return;
|
||||
}
|
||||
|
||||
this.render(state.isValid);
|
||||
}
|
||||
|
||||
@@ -188,9 +191,11 @@ class ExpandPrompt extends Base {
|
||||
if (!choice.key || choice.key.length !== 1) {
|
||||
formatError = true;
|
||||
}
|
||||
|
||||
if (keymap[choice.key]) {
|
||||
errors.push(choice.key);
|
||||
}
|
||||
|
||||
keymap[choice.key] = true;
|
||||
choice.key = String(choice.key).toLowerCase();
|
||||
});
|
||||
@@ -200,11 +205,13 @@ class ExpandPrompt extends Base {
|
||||
'Format error: `key` param must be a single letter and is required.'
|
||||
);
|
||||
}
|
||||
|
||||
if (keymap.h) {
|
||||
throw new Error(
|
||||
'Reserved key error: `key` param cannot be `h` - this value is reserved.'
|
||||
);
|
||||
}
|
||||
|
||||
if (errors.length) {
|
||||
throw new Error(
|
||||
'Duplicate key error: `key` param must be unique. Duplicates: ' +
|
||||
@@ -230,6 +237,7 @@ class ExpandPrompt extends Base {
|
||||
);
|
||||
defIndex = index === -1 ? defIndex : index;
|
||||
}
|
||||
|
||||
var defStr = this.opt.choices.pluck('key');
|
||||
this.rawDefault = defStr[defIndex];
|
||||
defStr[defIndex] = String(defStr[defIndex]).toUpperCase();
|
||||
@@ -258,6 +266,7 @@ function renderChoices(choices, pointer) {
|
||||
if (pointer === choice.key) {
|
||||
choiceStr = chalk.cyan(choiceStr);
|
||||
}
|
||||
|
||||
output += choiceStr;
|
||||
});
|
||||
|
||||
|
||||
+1
@@ -75,6 +75,7 @@ class InputPrompt extends Base {
|
||||
if (!input) {
|
||||
return this.opt.default == null ? '' : this.opt.default;
|
||||
}
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -140,6 +140,7 @@ class ListPrompt extends Base {
|
||||
if (input <= this.opt.choices.realLength) {
|
||||
this.selected = input - 1;
|
||||
}
|
||||
|
||||
this.render();
|
||||
}
|
||||
}
|
||||
@@ -173,6 +174,7 @@ function listRender(choices, pointer) {
|
||||
if (isSelected) {
|
||||
line = chalk.cyan(line);
|
||||
}
|
||||
|
||||
output += line + ' \n';
|
||||
});
|
||||
|
||||
|
||||
+1
@@ -20,6 +20,7 @@ class NumberPrompt extends Input {
|
||||
return Number(numberMatch[0]);
|
||||
}
|
||||
}
|
||||
|
||||
// If the input was invalid return the default value.
|
||||
return this.opt.default == null ? NaN : this.opt.default;
|
||||
}
|
||||
|
||||
+4
-5
@@ -37,11 +37,9 @@ class PasswordPrompt extends Base {
|
||||
validation.success.forEach(this.onEnd.bind(this));
|
||||
validation.error.forEach(this.onError.bind(this));
|
||||
|
||||
if (this.opt.mask) {
|
||||
events.keypress
|
||||
.pipe(takeUntil(validation.success))
|
||||
.forEach(this.onKeypress.bind(this));
|
||||
}
|
||||
events.keypress
|
||||
.pipe(takeUntil(validation.success))
|
||||
.forEach(this.onKeypress.bind(this));
|
||||
|
||||
// Init
|
||||
this.render();
|
||||
@@ -83,6 +81,7 @@ class PasswordPrompt extends Base {
|
||||
if (!input) {
|
||||
return this.opt.default == null ? '' : this.opt.default;
|
||||
}
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
|
||||
+36
-1
@@ -67,6 +67,10 @@ class RawListPrompt extends Base {
|
||||
events.keypress
|
||||
.pipe(takeUntil(validation.success))
|
||||
.forEach(this.onKeypress.bind(this));
|
||||
events.normalizedUpKey.pipe(takeUntil(events.line)).forEach(this.onUpKey.bind(this));
|
||||
events.normalizedDownKey
|
||||
.pipe(takeUntil(events.line))
|
||||
.forEach(this.onDownKey.bind(this));
|
||||
|
||||
// Init the prompt
|
||||
this.render();
|
||||
@@ -88,7 +92,8 @@ class RawListPrompt extends Base {
|
||||
message += chalk.cyan(this.answer);
|
||||
} else {
|
||||
var choicesStr = renderChoices(this.opt.choices, this.selected);
|
||||
message += this.paginator.paginate(choicesStr, this.selected, this.opt.pageSize);
|
||||
message +=
|
||||
'\n' + this.paginator.paginate(choicesStr, this.selected, this.opt.pageSize);
|
||||
message += '\n Answer: ';
|
||||
}
|
||||
|
||||
@@ -146,6 +151,35 @@ class RawListPrompt extends Base {
|
||||
|
||||
this.render();
|
||||
}
|
||||
|
||||
/**
|
||||
* When user press up key
|
||||
*/
|
||||
|
||||
onUpKey() {
|
||||
this.onArrowKey('up');
|
||||
}
|
||||
|
||||
/**
|
||||
* When user press down key
|
||||
*/
|
||||
|
||||
onDownKey() {
|
||||
this.onArrowKey('down');
|
||||
}
|
||||
|
||||
/**
|
||||
* When user press up or down key
|
||||
* @param {String} type Arrow type: up or down
|
||||
*/
|
||||
|
||||
onArrowKey(type) {
|
||||
var index = this.rl.line.length ? Number(this.rl.line) - 1 : 0;
|
||||
if (type === 'up') index = index === 0 ? this.opt.choices.length - 1 : index - 1;
|
||||
else index = index === this.opt.choices.length - 1 ? 0 : index + 1;
|
||||
this.rl.line = String(index + 1);
|
||||
this.onKeypress();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -172,6 +206,7 @@ function renderChoices(choices, pointer) {
|
||||
if (index === pointer) {
|
||||
display = chalk.cyan(display);
|
||||
}
|
||||
|
||||
output += display;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user