From 197609466f2b72dc857ccdbdfedfcb937448da91 Mon Sep 17 00:00:00 2001 From: "Duc Doan Hoang Minh (IT - ONL)" Date: Wed, 16 Oct 2019 15:17:03 +0700 Subject: [PATCH] v1.0.6 --- dist/jquery.niceform.js | 4 +- dist/jquery.niceform.js.map | 2 +- dist/locale/en-VN.js | 4 +- dist/locale/en-VN.js.map | 2 +- dist/locale/vi-VN.js | 4 +- dist/locale/vi-VN.js.map | 2 +- package-lock.json | 1443 ++++++++++++++++------------------- package.json | 22 +- 8 files changed, 686 insertions(+), 797 deletions(-) diff --git a/dist/jquery.niceform.js b/dist/jquery.niceform.js index d2e0512..6f74412 100644 --- a/dist/jquery.niceform.js +++ b/dist/jquery.niceform.js @@ -1,3 +1,3 @@ -/*! NiceForm v1.0.5 | Copyright (c) 2014-present Duc Doan (ducdhm@gmail.com) */ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("jquery")):"function"==typeof define&&define.amd?define("NiceForm",["jquery"],t):"object"==typeof exports?exports.NiceForm=t(require("jquery")):e.NiceForm=t(e.$)}("undefined"!=typeof self?self:this,function(e){return function(e){var t={};function r(a){if(t[a])return t[a].exports;var n=t[a]={i:a,l:!1,exports:{}};return e[a].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,a){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(a,n,function(t){return e[t]}.bind(null,n));return a},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=7)}([function(t,r){t.exports=e},function(e,t,r){"use strict";t.a={date:"DD/MM/YYYY",time:"HH:mm",datetime:"DD/MM/YYYY HH:mm",successTitle:"Success!",successMessage:"The form has been successfully submitted",errorTitle:"Error!",invalidErrorMessage:"Please correct your invalid fields!",requiredErrorMessage:"This field is required",dateErrorMessage:"Please check the format of your date, it should be like 14/02/2000",timeErrorMessage:"Please check the format of your time, it should be like 14:02",datetimeErrorMessage:"Please check the format of your date time, it should be like 14/02/2000 14:02",emailErrorMessage:"Please check the format of your email address, it should read like someone@somewhere.com",numberErrorMessage:"Please enter only numbers",urlErrorMessage:"Please enter valid website address",passwordErrorMessage:"Your password must be at least 6 characters and it must contain numbers, letters (lowercase and uppercase) and at least 1 special character",repasswordErrorMessage:"Please confirm your password",simpleErrorMessage:"Please enter only letters, numbers and only 1 underscore or dash or space between letters and numbers",reallySimpleErrorMessage:"Please enter only letters and numbers, no punctuation, dots, etc",unknownErrorMessage:"Sorry, an error occurred attempting to submit the form. Please contact the site administrator to resolve!"}},,function(e,t){!function(e){function t(){this.fake=!0,this.boundary="--------FormData"+Math.random(),this._fields=[]}e.FormData||(t.prototype.append=function(e,t){this._fields.push([e,t])},t.prototype.toString=function(){var e=this.boundary,t="";return this._fields.forEach(function(r){if(t+="--"+e+"\r\n",r[1].name){var a=r[1];t+="Content-Disposition: form-data; name='"+r[0]+"'; filename='"+a.name+"'\r\n",t+="Content-Type: "+a.type+"\r\n\r\n",t+=a.getAsBinary()+"\r\n"}else t+="Content-Disposition: form-data; name='"+r[0]+"';\r\n\r\n",t+=r[1]+"\r\n"}),t+="--"+e+"--"},e.FormData=t)}(window)},function(e,t){var r;(r=jQuery).fn.serializeWithFiles=function(){var e=r(this),t=new FormData;e.find("input[type=file]").each(function(e,a){r.each(a.files,function(e,r){t.append(a.name,r)})});var a=e.serializeArray();return r.each(a,function(e,r){t.append(r.name,r.value)}),t}},,,function(e,t,r){"use strict";r.r(t);var a,n=r(0),o=r.n(n),i=function(e,t,r){var a=t.closest(".form-group");t.addClass("is-invalid"),a.addClass("has-error");var n=a.find(".nf-error-message");0===n.length&&(n=$(''),t.after(n)),n.html(r),e.niceform("showElement",n)},s=r(1);window.__NICEFORM_DEBUG__=!0;var l={postFormEnabled:!0,postUrl:null,ajax:{type:"POST",dataType:"JSON"},password:{min:6,max:32,specialLength:1,uppercaseLength:1,numberLength:1},regex:{email:/^(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/,url:/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/,simple:/^[a-zA-Z0-9]+(?:[-_\s][a-zA-Z0-9]+)*$/,reallySimple:/^[a-zA-Z0-9]+$/},animationDuration:200,locale:s.a,validate:null,showError:function(e,t,r){e.niceform("showErrorMessage",r.locale.invalidErrorMessage),t.forEach(function(t){i(e,t,t.attr("data-error-message"))})},hideError:function(e,t){e.find(".has-error").removeClass("has-error"),e.find(".is-invalid").removeClass("is-invalid").attr("data-error-message",""),e.niceform("hideElement",e.find(".nf-error-message")),e.niceform("hideMessage")},processAjaxResponse:function(e,t,r){return e&&e.status},onValid:null,onInvalid:null,onBeforeSerializeForm:null,onBeforePostForm:null,onAjaxSuccess:function(e,t,r){t.niceform("showSuccessMessage",e.message||r.locale.successMessage),clearTimeout(a),a=setTimeout(function(){return t.niceform("hideMessage")},5e3)},onAjaxError:function(e,t,r){e.responseJSON?(t.niceform("showErrorMessage",e.responseJSON.message||r.locale.unknownErrorMessage),e.responseJSON.errorFields&&e.responseJSON.errorFields.forEach(function(e){i(t,t.find('[name="'.concat(e.name,'"]')),e.message)})):t.niceform("showErrorMessage",r.locale.unknownErrorMessage)}},c=function(e){return!e.is('[data-ignore="validate"]')&&(!e.attr("data-error-message")&&(!!e.hasClass("required")||(e.val()||"").length>0))},u=function(e,t){return e.test(t)},f=function(e,t){var r=[];return e.find(".number").each(function(){var e,a=$(this);c(a)&&(e=this.value,isNaN(e)||"boolean"==typeof e)&&(a.attr("data-error-message",a.attr("data-number-message")||t),r.push(a))}),r};var d=function(e,t){var r={lower:0,upper:0,alpha:0,numeric:0,special:0,length:[0,1/0],custom:[],badWords:[],badSequenceLength:0,noQwertySequences:!1,noSequential:!1};for(var a in t)r[a]=t[a];var n,o,i={lower:/[a-z]/g,upper:/[A-Z]/g,alpha:/[A-Z]/gi,numeric:/[0-9]/g,special:/[\W_]/g};if(e.lengthr.length[1])return!1;for(n in i)if((e.match(i[n])||[]).length-1)return!1;if(r.noSequential&&/([\S\s])\1/.test(e))return!1;if(r.badSequenceLength){var s="abcdefghijklmnopqrstuvwxyz",l=s.toUpperCase(),c=r.badSequenceLength-1,u="_"+e.slice(0,c);for(o=c;o-1||l.indexOf(u)>-1||"0123456789".indexOf(u)>-1||r.noQwertySequences&&"qwertyuiopasdfghjklzxcvbnm".indexOf(u)>-1)return!1}for(o=0;o0&&(r=r.concat(a)),void 0===window.moment)!function(){if(window.__NICEFORM_DEBUG__&&console&&"function"==typeof console.log){for(var e=arguments.length,t=new Array(e),r=0;r0&&(r=r.concat(n));var o=function(e,t,r){var a=[];return e.find(".date").each(function(){var e=$(this);c(e)&&!moment(this.value,t,!0).isValid()&&(e.attr("data-error-message",e.attr("data-date-message")||r),a.push(e))}),a}(e,t.locale.date,t.locale.dateErrorMessage);o.length>0&&(r=r.concat(o));var i=function(e,t,r){var a=[];return e.find(".time").each(function(){var e=$(this);c(e)&&!moment(this.value,t,!0).isValid()&&(e.attr("data-error-message",e.attr("data-time-message")||r),a.push(e))}),a}(e,t.locale.time,t.locale.timeErrorMessage);i.length>0&&(r=r.concat(i))}var s=function(e,t,r){var a=[];return e.find(".email").each(function(){var e=$(this);c(e)&&!u(t,this.value)&&(e.attr("data-error-message",e.attr("data-email-message")||r),a.push(e))}),a}(e,t.regex.email,t.locale.emailErrorMessage);s.length>0&&(r=r.concat(s));var l=f(e,t.locale.numberErrorMessage);l.length>0&&(r=r.concat(l));var d=function(e,t,r){var a=[];return e.find(".url").each(function(){var e=$(this);c(e)&&!u(t,this.value)&&(e.attr("data-error-message",e.attr("data-url-message")||r),a.push(e))}),a}(e,t.regex.url,t.locale.urlErrorMessage);d.length>0&&(r=r.concat(d));var h=m(e,t.password,t.locale.passwordErrorMessage);h.length>0&&(r=r.concat(h));var p=function(e,t){var r=[],a=e.find(".password");return e.find(".repassword").each(function(){var e=$(this);e.val()!==a.val()&&(e.attr("data-error-message",e.attr("data-repassword-message")||t),r.push(e))}),r}(e,t.locale.repasswordErrorMessage);p.length>0&&(r=r.concat(p));var g=function(e,t,r){var a=[];return e.find(".simple").each(function(){var e=$(this);c(e)&&!u(t,this.value)&&(e.attr("data-error-message",e.attr("data-simple-message")||r),a.push(e))}),a}(e,t.regex.simple,t.locale.simpleErrorMessage);g.length>0&&(r=r.concat(g));var v=function(e,t,r){var a=[];return e.find(".really-simple").each(function(){var e=$(this);c(e)&&!u(t,this.value)&&(e.attr("data-error-message",e.attr("data-really-simple-message")||r),a.push(e))}),a}(e,t.regex.reallySimple,t.locale.reallySimpleErrorMessage);v.length>0&&(r=r.concat(v));var y=function(e){var t=[];return e.find(".regex").each(function(){var e=$(this),r=e.attr("data-regex");c(e)&&!u(new RegExp(r),this.value)&&(e.attr("data-error-message",e.attr("data-message")||e.attr("data-regex-message")),t.push(e))}),t}(e);if(y.length>0&&(r=r.concat(y)),"function"==typeof t.validate){var b=t.validate(e,t);b&&b.length>0&&(r=r.concat(b))}return!(r.length>0)||("function"==typeof t.showError&&t.showError(e,r,t),!1)},p=function(e){e.find("select, input, textarea").each(function(){this.readOnly&&this.setAttribute("data-origin-readonly",!0),this.readOnly=!0}),e.find("button").each(function(){this.disabled&&this.setAttribute("data-origin-disabled",!0),this.disabled=!0})},g=function(e){e.find("select, input, textarea").each(function(){this.getAttribute("data-origin-readonly")||(this.readOnly=!1)}),e.find("button").each(function(){this.getAttribute("data-origin-disabled")||(this.disabled=!1)})};function v(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var y=function(e,t){var r="multipart/form-data"===e.attr("enctype"),a=t.postUrl||e.attr("action")||window.location.pathname;"function"==typeof t.onBeforeSerializeForm&&t.onBeforeSerializeForm.call(void 0,e,t);var n=r?e.serializeWithFiles():e.serialize();"function"==typeof t.onBeforePostForm&&(n=t.onBeforePostForm.call(void 0,e,t,n)||n);try{p(e);var o=function(e){for(var t=1;t