Ability to provide a dropdown container to a text input. Applied to framework export.

This commit is contained in:
yflory
2020-01-16 14:52:04 +01:00
parent 9abeada1f0
commit b80d3cf24f
6 changed files with 76 additions and 7 deletions

View File

@@ -161,6 +161,17 @@ define([
return h('p.msg', h('input', attrs));
};
dialog.textTypeInput = function (dropdown) {
var attrs = {
type: 'text',
'class': 'cp-text-type-input',
};
return h('p.msg.cp-alertify-type-container', h('div.cp-alertify-type', [
h('input', attrs),
dropdown // must be a "span"
]));
};
dialog.nav = function (content) {
return h('nav', content || [
dialog.cancelButton(),
@@ -186,6 +197,7 @@ define([
});
};
return $frame.click(function (e) {
$frame.find('.cp-dropdown-content').hide();
e.stopPropagation();
})[0];
};
@@ -480,7 +492,8 @@ define([
cb = cb || function () {};
opt = opt || {};
var inputBlock = opt.password ? UI.passwordInput() : dialog.textInput();
var inputBlock = opt.password ? UI.passwordInput() :
(opt.typeInput ? dialog.textTypeInput(opt.typeInput) : dialog.textInput());
var input = $(inputBlock).is('input') ? inputBlock : $(inputBlock).find('input')[0];
input.value = typeof(def) === 'string'? def: '';