mdbootstrap
Advanced tools
Comparing version 4.5.15 to 4.5.16
@@ -1,16 +0,18 @@ | ||
"use strict"; | ||
'use strict'; | ||
var _this = void 0; | ||
(function ($) { | ||
(function ($) { | ||
var inputSelector = "".concat(['text', 'password', 'email', 'url', 'tel', 'number', 'search', 'search-md'].map(function (selector) { | ||
return "input[type=".concat(selector, "]"); | ||
}).join(', '), ", textarea"); | ||
var inputSelector = ['text', 'password', 'email', 'url', 'tel', 'number', 'search', 'search-md'].map(function (selector) { | ||
return 'input[type=' + selector + ']'; | ||
}).join(', ') + ', textarea'; | ||
var textAreaSelector = '.materialize-textarea'; | ||
var updateTextFields = function updateTextFields($input) { | ||
var $labelAndIcon = $input.siblings('label, i'); | ||
var hasValue = $input.val().length; | ||
var hasPlaceholder = $input.attr('placeholder'); | ||
var addOrRemove = "".concat(hasValue || hasPlaceholder ? 'add' : 'remove', "Class"); | ||
var addOrRemove = (hasValue || hasPlaceholder ? 'add' : 'remove') + 'Class'; | ||
$labelAndIcon[addOrRemove]('active'); | ||
@@ -20,3 +22,5 @@ }; | ||
var validateField = function validateField($input) { | ||
if ($input.hasClass('validate')) { | ||
var value = $input.val(); | ||
@@ -27,4 +31,6 @@ var noValue = !value.length; | ||
if (noValue && isValid) { | ||
$input.removeClass('valid').removeClass('invalid'); | ||
} else { | ||
var valid = $input.is(':valid'); | ||
@@ -34,4 +40,6 @@ var length = Number($input.attr('length')) || 0; | ||
if (valid && (!length || length > value.length)) { | ||
$input.removeClass('invalid').addClass('valid'); | ||
} else { | ||
$input.removeClass('valid').addClass('invalid'); | ||
@@ -44,5 +52,6 @@ } | ||
var textAreaAutoResize = function textAreaAutoResize() { | ||
var $textarea = $(_this); | ||
var $textarea = $(undefined); | ||
if ($textarea.val().length) { | ||
var $hiddenDiv = $('.hiddendiv'); | ||
@@ -53,2 +62,3 @@ var fontFamily = $textarea.css('font-family'); | ||
if (fontSize) { | ||
$hiddenDiv.css('font-size', fontSize); | ||
@@ -58,2 +68,3 @@ } | ||
if (fontFamily) { | ||
$hiddenDiv.css('font-family', fontFamily); | ||
@@ -63,10 +74,12 @@ } | ||
if ($textarea.attr('wrap') === 'off') { | ||
$hiddenDiv.css('overflow-wrap', 'normal').css('white-space', 'pre'); | ||
} | ||
$hiddenDiv.text("".concat($textarea.val(), "\n")); | ||
$hiddenDiv.text($textarea.val() + '\n'); | ||
var content = $hiddenDiv.html().replace(/\n/g, '<br>'); | ||
$hiddenDiv.html(content); // When textarea is hidden, width goes crazy. | ||
$hiddenDiv.html(content); | ||
// When textarea is hidden, width goes crazy. | ||
// Approximate with half of window size | ||
$hiddenDiv.css('width', $textarea.is(':visible') ? $textarea.width() : $(window).width() / 2); | ||
@@ -78,2 +91,3 @@ $textarea.css('height', $hiddenDiv.height()); | ||
$(inputSelector).each(function (index, input) { | ||
var $this = $(input); | ||
@@ -83,11 +97,15 @@ var $labelAndIcon = $this.siblings('label, i'); | ||
var isValid = input.validity.badInput; | ||
if (isValid) { | ||
if (isValid) { | ||
$labelAndIcon.addClass('active'); | ||
} | ||
}); | ||
$(document).on('focus', inputSelector, function (e) { | ||
$(e.target).siblings('label, i').addClass('active'); | ||
}); | ||
$(document).on('blur', inputSelector, function (e) { | ||
var $this = $(e.target); | ||
@@ -99,2 +117,3 @@ var noValue = !$this.val(); | ||
if (noValue && invalid && noPlaceholder) { | ||
$this.siblings('label, i').removeClass('active'); | ||
@@ -105,3 +124,5 @@ } | ||
}); | ||
$(document).on('change', inputSelector, function (e) { | ||
var $this = $(e.target); | ||
@@ -111,13 +132,16 @@ updateTextFields($this); | ||
}); | ||
$('input[autofocus]').siblings('label, i').addClass('active'); | ||
$(document).on('reset', function (e) { | ||
var $formReset = $(e.target); | ||
if ($formReset.is('form')) { | ||
if ($formReset.is('form')) { | ||
var $formInputs = $formReset.find(inputSelector); | ||
$formInputs.removeClass('valid').removeClass('invalid').each(function (index, input) { | ||
var $this = $(input); | ||
var noDefaultValue = !$this.val(); | ||
var noPlaceholder = !$this.attr('placeholder'); | ||
if (noDefaultValue && noPlaceholder) { | ||
@@ -127,6 +151,9 @@ $this.siblings('label, i').removeClass('active'); | ||
}); | ||
$formReset.find('select.initialized').each(function (index, select) { | ||
var $select = $(select); | ||
var $visibleInput = $select.siblings('input.select-dropdown'); | ||
var defaultValue = $select.children('[selected]').val(); | ||
$select.val(defaultValue); | ||
@@ -139,13 +166,17 @@ $visibleInput.val(defaultValue); | ||
function init() { | ||
var $text = $('.md-textarea-auto'); | ||
if ($text.length) { | ||
var observe; | ||
var observe = void 0; | ||
if (window.attachEvent) { | ||
observe = function observe(element, event, handler) { | ||
element.attachEvent("on".concat(event), handler); | ||
element.attachEvent('on' + event, handler); | ||
}; | ||
} else { | ||
observe = function observe(element, event, handler) { | ||
element.addEventListener(event, handler, false); | ||
@@ -156,10 +187,13 @@ }; | ||
$text.each(function () { | ||
var self = this; | ||
function resize() { | ||
self.style.height = 'auto'; | ||
self.style.height = "".concat(self.scrollHeight, "px"); | ||
self.style.height = self.scrollHeight + 'px'; | ||
} | ||
function delayedResize() { | ||
window.setTimeout(resize, 0); | ||
@@ -173,2 +207,3 @@ } | ||
observe(self, 'keydown', delayedResize); | ||
resize(); | ||
@@ -178,7 +213,7 @@ }); | ||
} | ||
init(); | ||
init(); | ||
var $body = $('body'); | ||
if (!$('.hiddendiv').first().length) { | ||
if (!$('.hiddendiv').first().length) { | ||
var $hiddenDiv = $('<div class="hiddendiv common"></div>'); | ||
@@ -185,0 +220,0 @@ $body.append($hiddenDiv); |
@@ -1,12 +0,17 @@ | ||
"use strict"; | ||
'use strict'; | ||
(function ($) { | ||
var SCROLLING_NAVBAR_OFFSET_TOP = 50; | ||
$(window).on('scroll', function () { | ||
var $navbar = $('.navbar'); | ||
if ($navbar.length) { | ||
if ($navbar.length) { | ||
if ($navbar.offset().top > SCROLLING_NAVBAR_OFFSET_TOP) { | ||
$('.scrolling-navbar').addClass('top-nav-collapse'); | ||
} else { | ||
$('.scrolling-navbar').removeClass('top-nav-collapse'); | ||
@@ -13,0 +18,0 @@ } |
{ | ||
"name": "mdbootstrap", | ||
"version": "4.5.15", | ||
"version": "4.5.16", | ||
"description": "Material Design for Bootstrap (MDB) is a powerful Material Design UI KIT for most popular HTML, CSS, and JS framework - Bootstrap.", | ||
@@ -5,0 +5,0 @@ "main": "js/mdb.min.js", |
Material Design for Bootstrap | ||
Version: MDB Free 4.5.15 | ||
Version: MDB Free 4.5.16 | ||
@@ -19,3 +19,3 @@ Documentation: | ||
License: | ||
https://mdbootstrap.com/license/ | ||
https://mdbootstrap.com/general/license/ | ||
@@ -22,0 +22,0 @@ Support: |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4981661
111
67746