This commit is contained in:
2023-08-14 15:18:42 +03:00
parent eb896b0a24
commit ec646fad15
3 changed files with 52 additions and 14 deletions
+17 -10
View File
@@ -341,7 +341,7 @@ kit.PluginManager.register('toolkit', function(module, exports, require, global)
// изменение инпута
function changeHandler(e) {
var select = e.target;
var select = e.target || e;
changeSelect(select);
}
@@ -561,7 +561,7 @@ kit.PluginManager.register('toolkit', function(module, exports, require, global)
}
function escapeKeyHandler(e) {
if (e.keyCode == 27) {
if (e.keyCode === 27) {
closeAll(null);
}
}
@@ -752,8 +752,9 @@ kit.PluginManager.register('toolkit', function(module, exports, require, global)
Inputs.prototype.changeFiled = function changeFiled(e) {
var _this2 = this;
var target = e.target || e;
var isInput = target.tagName === 'INPUT', isTextarea = target.tagName === 'TEXTAREA';
if (target.classList.contains('kit-field__input')) {
if (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA') {
if (isInput || isTextarea) {
this.setDirty(target);
var value_min = $(target).attr('value_min');
@@ -791,15 +792,21 @@ kit.PluginManager.register('toolkit', function(module, exports, require, global)
});
};
Inputs.prototype.calcAutoHeight = function calcAutoHeight(target) {
target.style.height = target.style.minHeight = 'auto';
var h;
if (target.scrollHeight < 30) {
h = '30' + 'px';
Inputs.prototype.calcAutoHeight = function calcAutoHeight(node) {
node.style.height = node.style.minHeight = 'auto';
node.rows = 1;
var h, styles = getComputedStyle(node);
var minH = support.toNumber(styles.getPropertyValue('padding-top').trim().replace('px', ''))
+ support.toNumber(styles.getPropertyValue('padding-bottom').trim().replace('px', ''))
+ support.toNumber(styles.getPropertyValue('line-height').trim().replace('px', ''));
if (node.scrollHeight < minH) {
h = '' + minH + 'px';
} else {
h = target.scrollHeight + 'px';
h = node.scrollHeight + 'px';
}
target.style.height = target.style.minHeight = h;
node.style.height = node.style.minHeight = h;
};