semantic-ui-less
Advanced tools
Comparing version 2.2.7 to 2.2.8
@@ -60,2 +60,3 @@ /*! | ||
className, | ||
regExp, | ||
error, | ||
@@ -237,2 +238,16 @@ | ||
determine: { | ||
isValid: function() { | ||
var | ||
allValid = true | ||
; | ||
$.each(validation, function(fieldName, field) { | ||
if( !( module.validate.field(field, fieldName, true) ) ) { | ||
allValid = false; | ||
} | ||
}); | ||
return allValid; | ||
} | ||
}, | ||
is: { | ||
@@ -256,13 +271,19 @@ bracketedRule: function(rule) { | ||
}, | ||
valid: function() { | ||
valid: function(field) { | ||
var | ||
allValid = true | ||
; | ||
module.verbose('Checking if form is valid'); | ||
$.each(validation, function(fieldName, field) { | ||
if( !( module.validate.field(field, fieldName) ) ) { | ||
allValid = false; | ||
} | ||
}); | ||
return allValid; | ||
if(field) { | ||
module.verbose('Checking if field is valid', field); | ||
return module.validate.field(validation[field], field, false); | ||
} | ||
else { | ||
module.verbose('Checking if form is valid'); | ||
$.each(validation, function(fieldName, field) { | ||
if( !module.is.valid(fieldName) ) { | ||
allValid = false; | ||
} | ||
}); | ||
return allValid; | ||
} | ||
} | ||
@@ -344,3 +365,3 @@ }, | ||
; | ||
if(settings.on == 'change' || ( $fieldGroup.hasClass(className.error) && settings.revalidate) ) { | ||
if(validationRules && (settings.on == 'change' || ( $fieldGroup.hasClass(className.error) && settings.revalidate) )) { | ||
clearTimeout(module.timer); | ||
@@ -472,2 +493,3 @@ module.timer = setTimeout(function() { | ||
className = settings.className; | ||
regExp = settings.regExp; | ||
error = settings.error; | ||
@@ -485,3 +507,4 @@ moduleNamespace = 'module-' + namespace; | ||
module.verbose('Finding field with identifier', identifier); | ||
if( $field.filter('#' + identifier).length > 0 ) { | ||
identifier = module.escape.string(identifier); | ||
if($field.filter('#' + identifier).length > 0 ) { | ||
return $field.filter('#' + identifier); | ||
@@ -601,6 +624,7 @@ } | ||
module.verbose('Checking for existence of a field with identifier', identifier); | ||
identifier = module.escape.string(identifier); | ||
if(typeof identifier !== 'string') { | ||
module.error(error.identifier, identifier); | ||
} | ||
if( $field.filter('#' + identifier).length > 0 ) { | ||
if($field.filter('#' + identifier).length > 0 ) { | ||
return true; | ||
@@ -619,2 +643,9 @@ } | ||
escape: { | ||
string: function(text) { | ||
text = String(text); | ||
return text.replace(regExp.escape, '\\$&'); | ||
} | ||
}, | ||
add: { | ||
@@ -805,3 +836,3 @@ prompt: function(identifier, errors) { | ||
formErrors = []; | ||
if( module.is.valid() ) { | ||
if( module.determine.isValid() ) { | ||
module.debug('Form has no validation errors, submitting'); | ||
@@ -830,3 +861,12 @@ module.set.success(); | ||
// takes a validation object and returns whether field passes validation | ||
field: function(field, fieldName) { | ||
field: function(field, fieldName, showErrors) { | ||
showErrors = (showErrors !== undefined) | ||
? showErrors | ||
: true | ||
; | ||
if(typeof field == 'string') { | ||
module.verbose('Validating field', field); | ||
fieldName = field; | ||
field = validation[field]; | ||
} | ||
var | ||
@@ -867,9 +907,13 @@ identifier = field.identifier || fieldName, | ||
if(fieldValid) { | ||
module.remove.prompt(identifier, fieldErrors); | ||
settings.onValid.call($field); | ||
if(showErrors) { | ||
module.remove.prompt(identifier, fieldErrors); | ||
settings.onValid.call($field); | ||
} | ||
} | ||
else { | ||
formErrors = formErrors.concat(fieldErrors); | ||
module.add.prompt(identifier, fieldErrors); | ||
settings.onInvalid.call($field, fieldErrors); | ||
if(showErrors) { | ||
formErrors = formErrors.concat(fieldErrors); | ||
module.add.prompt(identifier, fieldErrors); | ||
settings.onInvalid.call($field, fieldErrors); | ||
} | ||
return false; | ||
@@ -1104,4 +1148,5 @@ } | ||
regExp: { | ||
htmlID : /^[a-zA-Z][\w:.-]*$/g, | ||
bracket : /\[(.*)\]/i, | ||
decimal : /^\d*(\.)\d+/, | ||
decimal : /^\d+\.?\d*$/, | ||
email : /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i, | ||
@@ -1108,0 +1153,0 @@ escape : /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, |
@@ -390,3 +390,7 @@ /*! | ||
if(settings.transition) { | ||
if( $.fn.transition !== undefined ) { | ||
if( $.fn.transition !== undefined) { | ||
if($module.hasClass(className.visible)) { | ||
module.debug('Transition already occurred on this image, skipping animation'); | ||
return; | ||
} | ||
$module.transition(settings.transition, settings.duration, callback); | ||
@@ -1274,3 +1278,4 @@ } | ||
fixed : 'fixed', | ||
placeholder : 'placeholder' | ||
placeholder : 'placeholder', | ||
visible : 'visible' | ||
}, | ||
@@ -1277,0 +1282,0 @@ |
@@ -42,24 +42,25 @@ /*! | ||
className = settings.className, | ||
metadata = settings.metadata, | ||
regExp = settings.regExp, | ||
fields = settings.fields, | ||
selector = settings.selector, | ||
error = settings.error, | ||
namespace = settings.namespace, | ||
className = settings.className, | ||
metadata = settings.metadata, | ||
regExp = settings.regExp, | ||
fields = settings.fields, | ||
selector = settings.selector, | ||
error = settings.error, | ||
namespace = settings.namespace, | ||
eventNamespace = '.' + namespace, | ||
moduleNamespace = namespace + '-module', | ||
eventNamespace = '.' + namespace, | ||
moduleNamespace = namespace + '-module', | ||
$module = $(this), | ||
$prompt = $module.find(selector.prompt), | ||
$searchButton = $module.find(selector.searchButton), | ||
$results = $module.find(selector.results), | ||
$result = $module.find(selector.result), | ||
$category = $module.find(selector.category), | ||
$module = $(this), | ||
$prompt = $module.find(selector.prompt), | ||
$searchButton = $module.find(selector.searchButton), | ||
$results = $module.find(selector.results), | ||
$result = $module.find(selector.result), | ||
$category = $module.find(selector.category), | ||
element = this, | ||
instance = $module.data(moduleNamespace), | ||
element = this, | ||
instance = $module.data(moduleNamespace), | ||
disabledBubbled = false, | ||
disabledBubbled = false, | ||
resultsDismissed = false, | ||
@@ -151,7 +152,8 @@ module | ||
module.set.focus(); | ||
if( module.has.minimumCharacters() ) { | ||
module.query(); | ||
if( module.can.show() ) { | ||
module.showResults(); | ||
} | ||
if(settings.searchOnFocus && module.has.minimumCharacters() ) { | ||
module.query(function() { | ||
if(module.can.show() ) { | ||
module.showResults(); | ||
} | ||
}); | ||
} | ||
@@ -171,2 +173,3 @@ }, | ||
} | ||
resultsDismissed = false; | ||
if(module.resultsClicked) { | ||
@@ -264,3 +267,4 @@ module.debug('Determining if user action caused search to close'); | ||
module.verbose('Escape key pressed, blurring search field'); | ||
module.trigger.blur(); | ||
module.hideResults(); | ||
resultsDismissed = true; | ||
} | ||
@@ -325,3 +329,3 @@ if( module.is.visible() ) { | ||
setup: { | ||
api: function(searchTerm) { | ||
api: function(searchTerm, callback) { | ||
var | ||
@@ -338,8 +342,10 @@ apiSettings = { | ||
module.parse.response.call(element, response, searchTerm); | ||
callback(); | ||
}, | ||
onAbort : function(response) { | ||
}, | ||
onFailure : function() { | ||
module.displayMessage(error.serverError); | ||
callback(); | ||
}, | ||
onAbort : function(response) { | ||
}, | ||
onError : module.error | ||
@@ -395,16 +401,2 @@ }, | ||
trigger: { | ||
blur: function() { | ||
var | ||
events = document.createEvent('HTMLEvents'), | ||
promptElement = $prompt[0] | ||
; | ||
if(promptElement) { | ||
module.verbose('Triggering native blur event'); | ||
events.initEvent('blur', false, false); | ||
promptElement.dispatchEvent(events); | ||
} | ||
} | ||
}, | ||
get: { | ||
@@ -507,3 +499,7 @@ inputEvent: function() { | ||
query: function() { | ||
query: function(callback) { | ||
callback = $.isFunction(callback) | ||
? callback | ||
: function(){} | ||
; | ||
var | ||
@@ -513,2 +509,3 @@ searchTerm = module.get.value(), | ||
; | ||
callback = callback || function() {}; | ||
if( module.has.minimumCharacters() ) { | ||
@@ -520,2 +517,3 @@ if(cache) { | ||
module.inject.id(cache.results); | ||
callback(); | ||
} | ||
@@ -526,8 +524,10 @@ else { | ||
module.search.local(searchTerm); | ||
callback(); | ||
} | ||
else if( module.can.useAPI() ) { | ||
module.search.remote(searchTerm); | ||
module.search.remote(searchTerm, callback); | ||
} | ||
else { | ||
module.error(error.source); | ||
callback(); | ||
} | ||
@@ -563,7 +563,11 @@ } | ||
}, | ||
remote: function(searchTerm) { | ||
remote: function(searchTerm, callback) { | ||
callback = $.isFunction(callback) | ||
? callback | ||
: function(){} | ||
; | ||
if($module.api('is loading')) { | ||
$module.api('abort'); | ||
} | ||
module.setup.api(searchTerm); | ||
module.setup.api(searchTerm, callback); | ||
$module | ||
@@ -695,2 +699,11 @@ .api('query') | ||
return (numCharacters >= settings.minCharacters); | ||
}, | ||
results: function() { | ||
if($results.length === 0) { | ||
return false; | ||
} | ||
var | ||
html = $results.html() | ||
; | ||
return html != ''; | ||
} | ||
@@ -862,8 +875,17 @@ }, | ||
else { | ||
module.hideResults(); | ||
module.hideResults(function() { | ||
$results.empty(); | ||
}); | ||
} | ||
}, | ||
showResults: function() { | ||
if(!module.is.visible()) { | ||
showResults: function(callback) { | ||
callback = $.isFunction(callback) | ||
? callback | ||
: function(){} | ||
; | ||
if(resultsDismissed) { | ||
return; | ||
} | ||
if(!module.is.visible() && module.has.results()) { | ||
if( module.can.transition() ) { | ||
@@ -877,2 +899,5 @@ module.debug('Showing results with css animations'); | ||
duration : settings.duration, | ||
onComplete : function() { | ||
callback(); | ||
}, | ||
queue : true | ||
@@ -892,3 +917,7 @@ }) | ||
}, | ||
hideResults: function() { | ||
hideResults: function(callback) { | ||
callback = $.isFunction(callback) | ||
? callback | ||
: function(){} | ||
; | ||
if( module.is.visible() ) { | ||
@@ -903,2 +932,5 @@ if( module.can.transition() ) { | ||
duration : settings.duration, | ||
onComplete : function() { | ||
callback(); | ||
}, | ||
queue : true | ||
@@ -1164,2 +1196,5 @@ }) | ||
// Whether search should query current term on focus | ||
searchOnFocus : true, | ||
// fields to search | ||
@@ -1166,0 +1201,0 @@ searchFields : [ |
@@ -479,3 +479,6 @@ /*! | ||
if(typeof settings.cacheType == 'string' && settings.cacheType.toLowerCase() == 'dom' && $tab.children().length > 0) { | ||
if(settings.loadOnce) { | ||
module.cache.add(fullTabPath, true); | ||
} | ||
else if(typeof settings.cacheType == 'string' && settings.cacheType.toLowerCase() == 'dom' && $tab.children().length > 0) { | ||
setTimeout(function() { | ||
@@ -510,8 +513,10 @@ var | ||
module.debug('Adding cached content', fullTabPath); | ||
if(settings.evaluateScripts == 'once') { | ||
module.update.content(tabPath, cachedContent, false); | ||
if(!settings.loadOnce) { | ||
if(settings.evaluateScripts == 'once') { | ||
module.update.content(tabPath, cachedContent, false); | ||
} | ||
else { | ||
module.update.content(tabPath, cachedContent); | ||
} | ||
} | ||
else { | ||
module.update.content(tabPath, cachedContent); | ||
} | ||
settings.onLoad.call($tab[0], tabPath, parameterArray, historyEvent); | ||
@@ -903,2 +908,3 @@ } | ||
cache : true, // cache the content requests to pull locally | ||
loadOnce : false, // Whether tab data should only be loaded once when using remote content | ||
cacheType : 'response', // Whether to cache exact response, or to html cache contents after scripts execute | ||
@@ -905,0 +911,0 @@ ignoreFirstLoad : false, // don't load remote content on first load |
@@ -8,3 +8,3 @@ var | ||
summary : 'Semantic UI - LESS Release of Semantic UI', | ||
version : '2.2.7', | ||
version : '2.2.8', | ||
git : 'git://github.com/Semantic-Org/Semantic-UI-LESS.git', | ||
@@ -11,0 +11,0 @@ }); |
{ | ||
"name": "semantic-ui-less", | ||
"version": "2.2.7", | ||
"version": "2.2.8", | ||
"title": "Semantic UI", | ||
@@ -5,0 +5,0 @@ "description": "LESS Only distribution of Semantic UI", |
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 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
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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
3757278
22117
8