Browse Source

修复Nice-validator失效的BUG

Karson 6 years ago
parent
commit
b6d51ee5b6
1 changed files with 133 additions and 137 deletions
  1. 133 137
      public/assets/js/require-backend.min.js

+ 133 - 137
public/assets/js/require-backend.min.js

@@ -6638,8 +6638,8 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
  */
 ;(function(factory) {
     typeof module === 'object' && module.exports ? module.exports = factory( require( 'jquery' ) ) :
-    typeof define === 'function' && define.amd ? define('validator-core',['jquery'], factory) :
-    factory(jQuery);
+        typeof define === 'function' && define.amd ? define('validator-core',['jquery'], factory) :
+            factory(jQuery);
 }(function($, undefined) {
     'use strict';
 
@@ -6746,56 +6746,56 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
 
     /** jQuery Plugin
      * @param {Object} options
-        debug         {Boolean}     0               Whether to enable debug mode
-        timely        {Number}      1               Whether to enable timely validation
-        theme         {String}     'default'        Theme name
-        stopOnError   {Boolean}     false           Whether to stop validate when found an error input
-        focusCleanup  {Boolean}     false           Whether to clean up the field message when focus the field
-        focusInvalid  {Boolean}     true            Whether to focus the field that is invalid
-        ignoreBlank   {Boolean}     false           When the field has no value, whether to ignore validation
-        ignore        {jqSelector}    ''            Ignored fields (Using jQuery selector)
-
-        beforeSubmit  {Function}                    Do something before submit form
-        dataFilter    {Function}                    Convert ajax results
-        valid         {Function}                    Triggered when the form is valid
-        invalid       {Function}                    Triggered when the form is invalid
-        validClass    {String}      'n-valid'       Add this class name to a valid field
-        invalidClass  {String}      'n-invalid'     Add this class name to a invalid field
-        bindClassTo   {jqSelector}  ':verifiable'   Which element should the className binding to
-
-        display       {Function}                    Callback function to get dynamic display
-        target        {Function}                    Callback function to get dynamic target
-        msgShow       {Function}                    Trigger this callback when show message
-        msgHide       {Function}                    Trigger this callback when hide message
-        msgWrapper    {String}      'span'          Message wrapper tag name
-        msgMaker      {Function}                    Callback function to make message HTML
-        msgArrow      {String}                      Message arrow template
-        msgIcon       {String}                      Message icon template
-        msgStyle      {String}                      Custom message css style
-        msgClass      {String}                      Additional added to the message class names
-        formClass     {String}                      Additional added to the form class names
-
-        messages      {Object}                      Custom messages for the current instance
-        rules         {Object}                      Custom rules for the current instance
-        fields        {Object}                      Field validation configuration
-        {String}        key    name|#id
-        {String|Object} value                       Rule string or an object which can pass more arguments
-
-        fields[key][rule]       {String}            Rule string
-        fields[key][display]    {String|Function}
-        fields[key][tip]        {String}            Custom tip message
-        fields[key][ok]         {String}            Custom success message
-        fields[key][msg]        {Object}            Custom error message
-        fields[key][msgStyle]   {String}            Custom message style
-        fields[key][msgClass]   {String}            A className which added to message placeholder element
-        fields[key][msgWrapper] {String}            Tag name of the message placeholder element
-        fields[key][msgMaker]   {Function}          A function to custom message HTML
-        fields[key][dataFilter] {Function}          A function to convert ajax results
-        fields[key][valid]      {Function}          A function triggered when field is valid
-        fields[key][invalid]    {Function}          A function triggered when field is invalid
-        fields[key][must]       {Boolean}           If set true, we always check the field even has remote checking
-        fields[key][timely]     {Boolean}           Whether to enable timely validation
-        fields[key][target]     {jqSelector}        Define placement of a message
+     debug         {Boolean}     0               Whether to enable debug mode
+     timely        {Number}      1               Whether to enable timely validation
+     theme         {String}     'default'        Theme name
+     stopOnError   {Boolean}     false           Whether to stop validate when found an error input
+     focusCleanup  {Boolean}     false           Whether to clean up the field message when focus the field
+     focusInvalid  {Boolean}     true            Whether to focus the field that is invalid
+     ignoreBlank   {Boolean}     false           When the field has no value, whether to ignore validation
+     ignore        {jqSelector}    ''            Ignored fields (Using jQuery selector)
+
+     beforeSubmit  {Function}                    Do something before submit form
+     dataFilter    {Function}                    Convert ajax results
+     valid         {Function}                    Triggered when the form is valid
+     invalid       {Function}                    Triggered when the form is invalid
+     validClass    {String}      'n-valid'       Add this class name to a valid field
+     invalidClass  {String}      'n-invalid'     Add this class name to a invalid field
+     bindClassTo   {jqSelector}  ':verifiable'   Which element should the className binding to
+
+     display       {Function}                    Callback function to get dynamic display
+     target        {Function}                    Callback function to get dynamic target
+     msgShow       {Function}                    Trigger this callback when show message
+     msgHide       {Function}                    Trigger this callback when hide message
+     msgWrapper    {String}      'span'          Message wrapper tag name
+     msgMaker      {Function}                    Callback function to make message HTML
+     msgArrow      {String}                      Message arrow template
+     msgIcon       {String}                      Message icon template
+     msgStyle      {String}                      Custom message css style
+     msgClass      {String}                      Additional added to the message class names
+     formClass     {String}                      Additional added to the form class names
+
+     messages      {Object}                      Custom messages for the current instance
+     rules         {Object}                      Custom rules for the current instance
+     fields        {Object}                      Field validation configuration
+     {String}        key    name|#id
+     {String|Object} value                       Rule string or an object which can pass more arguments
+
+     fields[key][rule]       {String}            Rule string
+     fields[key][display]    {String|Function}
+     fields[key][tip]        {String}            Custom tip message
+     fields[key][ok]         {String}            Custom success message
+     fields[key][msg]        {Object}            Custom error message
+     fields[key][msgStyle]   {String}            Custom message style
+     fields[key][msgClass]   {String}            A className which added to message placeholder element
+     fields[key][msgWrapper] {String}            Tag name of the message placeholder element
+     fields[key][msgMaker]   {Function}          A function to custom message HTML
+     fields[key][dataFilter] {Function}          A function to convert ajax results
+     fields[key][valid]      {Function}          A function triggered when field is valid
+     fields[key][invalid]    {Function}          A function triggered when field is invalid
+     fields[key][must]       {Boolean}           If set true, we always check the field even has remote checking
+     fields[key][timely]     {Boolean}           Whether to enable timely validation
+     fields[key][target]     {jqSelector}        Define placement of a message
      */
     $.fn.validator = function(options) {
         var that = this,
@@ -6865,10 +6865,10 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
             var name = elem.nodeName.toLowerCase();
 
             return ( name === 'input' && !({submit: 1, button: 1, reset: 1, image: 1})[elem.type] ||
-                     name === 'select' ||
-                     name === 'textarea' ||
-                     elem.contentEditable === 'true'
-                    ) && !elem.disabled;
+                name === 'select' ||
+                name === 'textarea' ||
+                elem.contentEditable === 'true'
+            ) && !elem.disabled;
         },
         // any value, but not only whitespace
         filled: function(elem) {
@@ -7038,7 +7038,7 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
                 !key ||
                 // If dataRule and element are diffrent from old's, we use ID mode.
                 (dataRule !== null && (field = me.fields[key]) && dataRule !== field.rule && el.id !== field.key)
-                )
+            )
             ) {
                 key = '#' + el.id;
             }
@@ -7295,9 +7295,6 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
             elem = el.name && _checkable(el) ? me.$el.find('input[name="'+ el.name +'"]').get(0) : el;
             // Get field
             if (!(field = me.getField(elem)) || !field.rule) {
-                if(!field.rule){
-                    me.hideMsg(el);
-                }
                 return;
             }
             // Cache event type
@@ -7466,7 +7463,7 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
 
             // trigger event
             $(el).attr( ARIA_INVALID, isValid ? null : true )
-                 .trigger( callback + CLS_NS_FIELD, [ret, me] );
+                .trigger( callback + CLS_NS_FIELD, [ret, me] );
             me.$el.triggerHandler('validation', [ret, me]);
 
             if (me.checkOnly) return;
@@ -8288,34 +8285,34 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
     });
 
     $(document)
-    .on('click', ':submit', function(){
-        var input = this, attrNode;
-        if (!input.form) return;
-        // Shim for "formnovalidate"
-        attrNode = input.getAttributeNode('formnovalidate');
-        if (attrNode && attrNode.nodeValue !== null || attr(input, NOVALIDATE)!== null) {
-            novalidateonce = true;
-        }
-    })
-    // Automatic initializing form validation
-    .on('focusin submit validate', 'form,.'+CLS_WRAPPER, function(e) {
-        if ( attr(this, NOVALIDATE) !== null ) return;
-        var $form = $(this), me;
-
-        if ( !$form.data(NS) && (me = _getInstance(this)) ) {
-            if ( !$.isEmptyObject(me.fields) ) {
-                // Execute event handler
-                if (e.type === 'focusin') {
-                    me._focusin(e);
+        .on('click', ':submit', function(){
+            var input = this, attrNode;
+            if (!input.form) return;
+            // Shim for "formnovalidate"
+            attrNode = input.getAttributeNode('formnovalidate');
+            if (attrNode && attrNode.nodeValue !== null || attr(input, NOVALIDATE)!== null) {
+                novalidateonce = true;
+            }
+        })
+        // Automatic initializing form validation
+        .on('focusin submit validate', 'form,.'+CLS_WRAPPER, function(e) {
+            if ( attr(this, NOVALIDATE) !== null ) return;
+            var $form = $(this), me;
+
+            if ( !$form.data(NS) && (me = _getInstance(this)) ) {
+                if ( !$.isEmptyObject(me.fields) ) {
+                    // Execute event handler
+                    if (e.type === 'focusin') {
+                        me._focusin(e);
+                    } else {
+                        me._submit(e);
+                    }
                 } else {
-                    me._submit(e);
+                    attr(this, NOVALIDATE, NOVALIDATE);
+                    $form.off(CLS_NS).removeData(NS);
                 }
-            } else {
-                attr(this, NOVALIDATE, NOVALIDATE);
-                $form.off(CLS_NS).removeData(NS);
             }
-        }
-    });
+        });
 
     new Messages({
         fallback: 'This field is not valid.',
@@ -8330,11 +8327,11 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
          * required
          *
          * @example:
-            required
-            required(jqSelector)
-            required(anotherRule)
-            required(not, -1)
-            required(from, .contact)
+         required
+         required(jqSelector)
+         required(anotherRule)
+         required(not, -1)
+         required(from, .contact)
          */
         required: function(element, params) {
             var me = this,
@@ -8394,11 +8391,11 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
          * integer
          *
          * @example:
-            integer
-            integer[+]
-            integer[+0]
-            integer[-]
-            integer[-0]
+         integer
+         integer[+]
+         integer[+0]
+         integer[-]
+         integer[-0]
          */
         integer: function(element, params) {
             var re, z = '0|',
@@ -8430,15 +8427,15 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
          * match another field
          *
          * @example:
-            match[password]    Match the password field (two values ​​must be the same)
-            match[eq, password]  Ditto
-            match[neq, count]  The value must be not equal to the value of the count field
-            match[lt, count]   The value must be less than the value of the count field
-            match[lte, count]  The value must be less than or equal to the value of the count field
-            match[gt, count]   The value must be greater than the value of the count field
-            match[gte, count]  The value must be greater than or equal to the value of the count field
-            match[gte, startDate, date]
-            match[gte, startTime, time]
+         match[password]    Match the password field (two values ​​must be the same)
+         match[eq, password]  Ditto
+         match[neq, count]  The value must be not equal to the value of the count field
+         match[lt, count]   The value must be less than the value of the count field
+         match[lte, count]  The value must be less than or equal to the value of the count field
+         match[gt, count]   The value must be greater than the value of the count field
+         match[gte, count]  The value must be greater than or equal to the value of the count field
+         match[gte, startDate, date]
+         match[gte, startTime, time]
          **/
         match: function(element, params) {
             if (!params) return;
@@ -8517,9 +8514,9 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
          * range numbers
          *
          * @example:
-            range[0~99]    Number 0-99
-            range[0~]      Number greater than or equal to 0
-            range[~100]    Number less than or equal to 100
+         range[0~99]    Number 0-99
+         range[0~]      Number greater than or equal to 0
+         range[~100]    Number less than or equal to 100
          **/
         range: function(element, params) {
             return this.getRangeMsg(this.value, params);
@@ -8529,11 +8526,11 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
          * how many checkbox or radio inputs that checked
          *
          * @example:
-            checked;       no empty, same to required
-            checked[1~3]   1-3 items
-            checked[1~]    greater than 1 item
-            checked[~3]    less than 3 items
-            checked[3]     3 items
+         checked;       no empty, same to required
+         checked[1~3]   1-3 items
+         checked[1~]    greater than 1 item
+         checked[~3]    less than 3 items
+         checked[3]     3 items
          **/
         checked: function(element, params) {
             if ( !_checkable(element) ) return;
@@ -8563,10 +8560,10 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
          * length of a characters (You can pass the second parameter "true", will calculate the length in bytes)
          *
          * @example:
-            length[6~16]        6-16 characters
-            length[6~]          Greater than 6 characters
-            length[~16]         Less than 16 characters
-            length[~16, true]   Less than 16 characters, non-ASCII characters calculating two-character
+         length[6~16]        6-16 characters
+         length[6~]          Greater than 6 characters
+         length[~16]         Less than 16 characters
+         length[~16, true]   Less than 16 characters, non-ASCII characters calculating two-character
          **/
         length: function(element, params) {
             var value = this.value,
@@ -8581,20 +8578,20 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
          * @description
          *  remote([get:]url [, name1, [name2 ...]]);
          *  Adaptation three kinds of results (Front for the successful, followed by a failure):
-                1. text:
-                    ''  'Error Message'
-                2. json:
-                    {"ok": ""}  {"error": "Error Message"}
-                3. json wrapper:
-                    {"status": 1, "data": {"ok": ""}}  {"status": 1, "data": {"error": "Error Message"}}
+         1. text:
+         ''  'Error Message'
+         2. json:
+         {"ok": ""}  {"error": "Error Message"}
+         3. json wrapper:
+         {"status": 1, "data": {"ok": ""}}  {"status": 1, "data": {"error": "Error Message"}}
          * @example
-            The simplest:       remote(path/to/server);
-            With parameters:    remote(path/to/server, name1, name2, ...);
-            By GET:             remote(get:path/to/server, name1, name2, ...);
-            Name proxy:         remote(path/to/server, name1, proxyname2:name2, proxyname3:#id3, ...)
-            Query String        remote(path/to/server, foo=1&bar=2, name1, name2, ...)
-            CORS                remote(cors:path/to/server)
-            JSONP               remote(jsonp:path/to/server)
+         The simplest:       remote(path/to/server);
+         With parameters:    remote(path/to/server, name1, name2, ...);
+         By GET:             remote(get:path/to/server, name1, name2, ...);
+         Name proxy:         remote(path/to/server, name1, proxyname2:name2, proxyname3:#id3, ...)
+         Query String        remote(path/to/server, foo=1&bar=2, name1, name2, ...)
+         CORS                remote(cors:path/to/server)
+         JSONP               remote(jsonp:path/to/server)
          */
         remote: function(element, params) {
             if (!params) return;
@@ -8698,8 +8695,8 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
      * @param {String|Object} name
      * @param {Object} obj
      * @example
-        .setTheme( themeName, themeOptions )
-        .setTheme( multiThemes )
+     .setTheme( themeName, themeOptions )
+     .setTheme( multiThemes )
      */
     Validator.setTheme = function(name, obj) {
         if ( isObject(name) ) {
@@ -8716,10 +8713,10 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
      * @static load
      * @param {String} str
      * @example
-        .load('local=zh-CN')        // load: local/zh-CN.js and jquery.validator.css
-        .load('local=zh-CN&css=')   // load: local/zh-CN.js
-        .load('local&css')          // load: local/en.js (set <html lang="en">) and jquery.validator.css
-        .load('local')              // dito
+     .load('local=zh-CN')        // load: local/zh-CN.js and jquery.validator.css
+     .load('local=zh-CN&css=')   // load: local/zh-CN.js
+     .load('local&css')          // load: local/en.js (set <html lang="en">) and jquery.validator.css
+     .load('local')              // dito
      */
     Validator.load = function(str) {
         if (!str) return;
@@ -8775,7 +8772,6 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
 
     return $[NS] = Validator;
 }));
-
 /*********************************
  * Themes, rules, and i18n support
  * Locale: Chinese; 中文