|
|
|
@ -67,7 +67,25 @@ module.exports = { |
|
|
|
|
function prompt (title, text, hidden, inputValue, ok, cancel, focus) { |
|
|
|
|
if (!inputValue) inputValue = '' |
|
|
|
|
var type = hidden ? 'password' : 'text' |
|
|
|
|
var input = yo`<input type=${type} name='prompt_text' id='prompt_text' class="${css['prompt_text']} form-control" value='${inputValue}' data-id="modalDialogCustomPromptText">` |
|
|
|
|
var input = yo` |
|
|
|
|
<input |
|
|
|
|
type=${type} |
|
|
|
|
name='prompt_text' |
|
|
|
|
id='prompt_text' |
|
|
|
|
class="${css['prompt_text']} form-control" |
|
|
|
|
value='${inputValue}' |
|
|
|
|
data-id="modalDialogCustomPromptText" |
|
|
|
|
oninput="${(e) => validateInput(e)}" |
|
|
|
|
> |
|
|
|
|
` |
|
|
|
|
const validateInput = (e) => { |
|
|
|
|
if (e.target.value === '') { |
|
|
|
|
document.getElementById('modal-footer-ok').classList.add('disabled') |
|
|
|
|
} else { |
|
|
|
|
document.getElementById('modal-footer-ok').classList.remove('disabled') |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
modal(title, yo`<div>${text}<div>${input}</div></div>`, |
|
|
|
|
{ |
|
|
|
|
fn: () => { if (typeof ok === 'function') ok(document.getElementById('prompt_text').value) } |
|
|
|
|