自动排除了 lib,导致js 不全
This commit is contained in:
78
static/src/js/lib/formValidation/framework/pure.js
Executable file
78
static/src/js/lib/formValidation/framework/pure.js
Executable file
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
* FormValidation (http://formvalidation.io)
|
||||
* The best jQuery plugin to validate form fields. Support Bootstrap, Foundation, Pure, SemanticUI, UIKit frameworks
|
||||
*
|
||||
* @author https://twitter.com/nghuuphuoc
|
||||
* @copyright (c) 2013 - 2015 Nguyen Huu Phuoc
|
||||
* @license http://formvalidation.io/license/
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class supports validating Pure framework (http://purecss.io/)
|
||||
*/
|
||||
(function(root, factory) {
|
||||
|
||||
"use strict";
|
||||
|
||||
// AMD module is defined
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define("framework/pure", ["jquery", "base"], factory);
|
||||
} else {
|
||||
// planted over the root!
|
||||
factory(root.jQuery, root.FormValidation);
|
||||
}
|
||||
|
||||
}(this, function ($, FormValidation) {
|
||||
FormValidation.Framework.Pure = function(element, options) {
|
||||
options = $.extend(true, {
|
||||
button: {
|
||||
selector: '[type="submit"]',
|
||||
// The class of disabled button
|
||||
// http://purecss.io/buttons/#disabled-buttons
|
||||
disabled: 'pure-button-disabled'
|
||||
},
|
||||
err: {
|
||||
clazz: 'fv-help-block',
|
||||
parent: '^.*pure-control-group.*$'
|
||||
},
|
||||
// Pure doesn't support feedback icon
|
||||
icon: {
|
||||
valid: null,
|
||||
invalid: null,
|
||||
validating: null,
|
||||
feedback: 'fv-control-feedback'
|
||||
},
|
||||
row: {
|
||||
// http://purecss.io/forms/#aligned-form
|
||||
selector: '.pure-control-group',
|
||||
valid: 'fv-has-success',
|
||||
invalid: 'fv-has-error',
|
||||
feedback: 'fv-has-feedback'
|
||||
}
|
||||
}, options);
|
||||
|
||||
FormValidation.Base.apply(this, [element, options]);
|
||||
};
|
||||
|
||||
FormValidation.Framework.Pure.prototype = $.extend({}, FormValidation.Base.prototype, {
|
||||
/**
|
||||
* Specific framework might need to adjust the icon position
|
||||
*
|
||||
* @param {jQuery} $field The field element
|
||||
* @param {jQuery} $icon The icon element
|
||||
*/
|
||||
_fixIcon: function($field, $icon) {
|
||||
var ns = this._namespace,
|
||||
type = $field.attr('type'),
|
||||
field = $field.attr('data-' + ns + '-field'),
|
||||
row = this.options.fields[field].row || this.options.row.selector,
|
||||
$parent = $field.closest(row);
|
||||
|
||||
if ($parent.find('label').length === 0) {
|
||||
$icon.addClass('fv-icon-no-label');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return FormValidation.Framework.Pure;
|
||||
}));
|
||||
Reference in New Issue
Block a user