From 4f461dfb95910e21b686603f50d343ee7fe08b99 Mon Sep 17 00:00:00 2001 From: Stuart Date: Fri, 17 Jan 2020 15:17:06 -0500 Subject: [PATCH] accepted patch --- bower.json | 2 +- dist/locale/es.js | 2 +- dist/locale/fa.js | 2 +- dist/locale/fr.js | 2 +- dist/locale/id.js | 2 +- dist/locale/min/es.min.js | 2 +- dist/locale/min/fa.min.js | 2 +- dist/locale/min/fr.min.js | 2 +- dist/locale/min/id.min.js | 2 +- dist/locale/min/sl.min.js | 2 +- dist/locale/min/sr.min.js | 2 +- dist/locale/min/tr.min.js | 2 +- dist/locale/sl.js | 2 +- dist/locale/sr.js | 2 +- dist/locale/tr.js | 2 +- dist/simple-react-validator.js | 8 +++++--- dist/simple-react-validator.min.js | 4 ++-- gulpfile.js | 2 +- package-lock.json | 2 +- package.json | 2 +- src/simple-react-validator.js | 4 ++-- 21 files changed, 27 insertions(+), 25 deletions(-) diff --git a/bower.json b/bower.json index 993c64a..6fd7075 100644 --- a/bower.json +++ b/bower.json @@ -2,7 +2,7 @@ "name": "simple-react-validator", "description": "A simple react form validator inspired by Laravel validation.", "main": "dist/simple-react-validator.min.js", - "version": "1.4.3", + "version": "1.4.4", "authors": [ "Stuart Yamartino" ], diff --git a/dist/locale/es.js b/dist/locale/es.js index 5ebf6f1..9e504fd 100644 --- a/dist/locale/es.js +++ b/dist/locale/es.js @@ -1,4 +1,4 @@ -// Simple React Validator v1.4.3 | Created By Dockwa | MIT License | 2017 - Present +// Simple React Validator v1.4.4 | Created By Dockwa | MIT License | 2017 - Present ;(function(root, factory) { if (typeof define === 'function' && define.amd) { define(['simple-react-validator'], factory); diff --git a/dist/locale/fa.js b/dist/locale/fa.js index ae681c1..5afbe9d 100644 --- a/dist/locale/fa.js +++ b/dist/locale/fa.js @@ -1,4 +1,4 @@ -// Simple React Validator v1.4.3 | Created By Dockwa | MIT License | 2017 - Present +// Simple React Validator v1.4.4 | Created By Dockwa | MIT License | 2017 - Present ;(function(root, factory) { if (typeof define === 'function' && define.amd) { define(['simple-react-validator'], factory); diff --git a/dist/locale/fr.js b/dist/locale/fr.js index 9dc5898..ce190e7 100644 --- a/dist/locale/fr.js +++ b/dist/locale/fr.js @@ -1,4 +1,4 @@ -// Simple React Validator v1.4.3 | Created By Dockwa | MIT License | 2017 - Present +// Simple React Validator v1.4.4 | Created By Dockwa | MIT License | 2017 - Present ;(function(root, factory) { if (typeof define === 'function' && define.amd) { define(['simple-react-validator'], factory); diff --git a/dist/locale/id.js b/dist/locale/id.js index 3910893..4112b14 100644 --- a/dist/locale/id.js +++ b/dist/locale/id.js @@ -1,4 +1,4 @@ -// Simple React Validator v1.4.3 | Created By Dockwa | MIT License | 2017 - Present +// Simple React Validator v1.4.4 | Created By Dockwa | MIT License | 2017 - Present ;(function(root, factory) { if (typeof define === 'function' && define.amd) { define(['simple-react-validator'], factory); diff --git a/dist/locale/min/es.min.js b/dist/locale/min/es.min.js index 778e53b..5a4b856 100644 --- a/dist/locale/min/es.min.js +++ b/dist/locale/min/es.min.js @@ -1,2 +1,2 @@ -// Simple React Validator v1.4.3 | Created By Dockwa | MIT License | 2017 - Present +// Simple React Validator v1.4.4 | Created By Dockwa | MIT License | 2017 - Present !function(e,t){"function"==typeof define&&define.amd?define(["simple-react-validator"],t):"object"==typeof exports?module.exports=t(require("simple-react-validator")):e.SimpleReactValidatorLocaleEs=t(e.SimpleReactValidator)}(this,function(e){"use strict";return e.addLocale("es",{accepted:":attribute debe ser aceptado.",after:":attribute debe ser una fecha posterior a :date.",after_or_equal:":attribute debe ser una fecha posterior o igual a :date.",alpha:":attribute sólo debe contener letras.",array:":attribute debe ser un conjunto.",before:":attribute debe ser una fecha anterior a :date.",before_or_equal:":attribute debe ser una fecha anterior o igual a :date.",between:":attribute tiene que estar entre :min - :max:type.",boolean:"El campo :attribute debe tener un valor verdadero o falso.",date:":attribute no es una fecha válida.",date_equals:":attribute debe ser una fecha igual a :date.",email:":attribute no es un correo válido",in:":attribute es inválido :values.",integer:":attribute debe ser un número entero.",max:":attribute no debe ser mayor a :max:type.",min:"El tamaño de :attribute debe ser de al menos :min:type.",not_in:":attribute es inválido :values.",not_regex:"El formato del campo :attribute no es válido.",numeric:":attribute debe ser numérico.",regex:"El formato de :attribute es inválido.",required:"El campo :attribute es obligatorio.",size:"El tamaño de :attribute debe ser :size:type.",string:"El campo :attribute debe ser una cadena de caracteres.",url:"El formato :attribute es inválido."}),null}); \ No newline at end of file diff --git a/dist/locale/min/fa.min.js b/dist/locale/min/fa.min.js index bbb7019..2d0c0cc 100644 --- a/dist/locale/min/fa.min.js +++ b/dist/locale/min/fa.min.js @@ -1,2 +1,2 @@ -// Simple React Validator v1.4.3 | Created By Dockwa | MIT License | 2017 - Present +// Simple React Validator v1.4.4 | Created By Dockwa | MIT License | 2017 - Present !function(t,e){"function"==typeof define&&define.amd?define(["simple-react-validator"],e):"object"==typeof exports?module.exports=e(require("simple-react-validator")):t.SimpleReactValidatorLocaleFa=e(t.SimpleReactValidator)}(this,function(t){"use strict";return t.addLocale("fa",{accepted:":attribute مورد قبول قرار نگرفت",after:":attribute باید تاریخی بعد از :date باشد.",after_or_equal:":attribute باید تاریخی برابر یا بعد از :date باشد.",alpha:":attribute باید شامل حروف انگلیسی باشد.",alpha_space:":attribute باید شامل حروف انگلیسی و فاصله باشد.",alpha_num:":attribute باید شامل اعداد و حروف انگلیسی باشد.",alpha_num_space:":attribute باید شامل اعداد و حروف انگلیسی و فاصله باشد.",alpha_num_dash:":attribute باید شامل اعداد و حروف انگلیسی و خط تیره.",alpha_num_dash_space:":attribute باید شامل اعداد و حروف انگلیسی، خط تیره و فاصله باشد.",array:":attribute باید یک آرایه باشد.",before:":attribute باید قبل از :date باشد.",before_or_equal:":attribute باید قبل یا برابر با :date باشد.",between:":attribute باید بین :min و :max:type باشد.",boolean:":attribute باید یک بول باشد.",card_exp:":attribute باید یک تاریخ انقضا معتبر باشد.",card_num:":attribute باید یک شماره کارت اعتباری معتبر باشد.",currency:":attribute باید یک ارز معتبر باشد.",date:":attribute باید تاریخ باشد.",date_equals:":attribute باید در :date بازه باشد.",email:":attribute بایدآدرس ایمیل معتبر باشد.",in:":attribute باید یکی از :values باشد.",integer:":attribute باید یک عدد صحیح باشد.",max:":attribute باید کمتر از :max:type باشد.",min:":attribute باید بیشتر از :min:type باشد.",not_in:":attribute نباید مشابه با :values باشد.",not_regex:":attribute نباید با الگوی مورد نیاز مطابقت داشته باشد.",numeric:":attribute باید عدد باشد.",phone:":attribute باید یک شماره تلفن معتبر باشد.",regex:":attribute باید با الگوی مورد نیاز مطابقت داشته باشد.",required:"قسمت :attribute الزامی است.",size:":attribute باید تبدیل شود به size:type:.",string:":attribute باید یک رشته باشد.",typeof:":attribute نوع صحیح :type نوع نیست.",url:":attribute باید یک آدرس اینترنتی باشد."}),null}); \ No newline at end of file diff --git a/dist/locale/min/fr.min.js b/dist/locale/min/fr.min.js index 5a6beb6..757f01a 100644 --- a/dist/locale/min/fr.min.js +++ b/dist/locale/min/fr.min.js @@ -1,2 +1,2 @@ -// Simple React Validator v1.4.3 | Created By Dockwa | MIT License | 2017 - Present +// Simple React Validator v1.4.4 | Created By Dockwa | MIT License | 2017 - Present !function(e,t){"function"==typeof define&&define.amd?define(["simple-react-validator"],t):"object"==typeof exports?module.exports=t(require("simple-react-validator")):e.SimpleReactValidatorLocaleFr=t(e.SimpleReactValidator)}(this,function(e){"use strict";return e.addLocale("fr",{accepted:"Le champ :attribute doit être accepté.",after:"Le champ :attribute doit être après :date.",after_or_equal:"Le champ :attribute doit correspondre ou bien être après :date.",alpha:"Le champ :attribute ne peut contenir que des lettres.",alpha_space:"Le champ :attribute ne peut contenir que des lettres et des espaces.",alpha_num:"Le champ :attribute ne peut contenir que des lettres et des chiffres.",alpha_num_space:"Le champ :attribute ne peut contenir que des lettres, chiffres, et espaces.",alpha_num_dash:"Le champ :attribute ne peut contenir que des lettres, chiffres, et tirets.",alpha_num_dash_space:"Le champ :attribute ne peut contenir que des lettres, chiffres, tirets, et espaces.",array:"Le champ :attribute doit êttre un tableau.",before:"Le champ :attribute doit être avant :date.",before_or_equal:"Le champ :attribute doit correspondre ou bien être avant :date.",between:"Le champ :attribute doit être entre :min et :max:type.",boolean:"Le champ :attribute doit être booléen.",card_exp:"Le champ :attribute doit être une date d'expiration valide.",card_num:"Le champ :attribute doit être un numéro valide de carte de crédit .",currency:"Le champ :attribute doit être une devise valide.",date:"Le champ :attribute doit être une date.",date_equals:"Le champ :attribute doit correspondre à :date.",email:"Le champ :attribute doit êre une adresse email valide.",in:"Le champ selectionné :attribute doit être :values.",integer:"Le champ :attribute doit être un entier.",max:"Le champ :attribute ne doit pas dépasser :max:type.",min:"Le champ :attribute doit au moins être :min:type.",not_in:"Le champ selectionné :attribute ne doit pas être :values.",not_regex:"Le champ :attribute ne doit pas correspondre au motif requis.",numeric:"Le champ :attribute doit être un chiffre.",phone:"Le champ :attribute doit être un numéro de téléphone valide.",regex:"Le champ :attribute doit correspondre au motif requis.",required:"Le champ :attribute est requis.",size:"Le champ :attribute doit être :size:type.",string:"Le champ :attribute doit être une chaîne.",typeof:"Le champ :attribute n'est pas le type correcte de :type.",url:"Le champ :attribute doit être un url."}),null}); \ No newline at end of file diff --git a/dist/locale/min/id.min.js b/dist/locale/min/id.min.js index 97f6a5d..c596a21 100644 --- a/dist/locale/min/id.min.js +++ b/dist/locale/min/id.min.js @@ -1,2 +1,2 @@ -// Simple React Validator v1.4.3 | Created By Dockwa | MIT License | 2017 - Present +// Simple React Validator v1.4.4 | Created By Dockwa | MIT License | 2017 - Present !function(a,t){"function"==typeof define&&define.amd?define(["simple-react-validator"],t):"object"==typeof exports?module.exports=t(require("simple-react-validator")):a.SimpleReactValidatorLocaleId=t(a.SimpleReactValidator)}(this,function(a){"use strict";return a.addLocale("id",{accepted:":attribute harus diterima.",after:":attribute harus lebih dari :date.",after_or_equal:":attribute harus lebih dari atau sama dengan :date.",alpha:":attribute hanya boleh berisikan teks.",alpha_space:":attribute hanya boleh berisikan teks dan spasi.",alpha_num:":attribute hanya boleh berisikan teks dan angka.",alpha_num_space:":attribute hanya boleh berisikan teks, angka, dan spasi.",alpha_num_dash:":attribute hanya boleh berisikan teks, angka, dan garis datar.",alpha_num_dash_space:":attribute hanya boleh berisikan teks, angka, garis datar dan spasi.",array:":attribute harus berupa array.",before:":attribute harus kurang dari :date.",before_or_equal:":attribute harus kurang dari atau sama dengan :date.",between:":attribute harus diantara :min dan :max:type.",boolean:":attribute harus berupa boolean.",card_exp:":attribute harus berupa tanggal expire yang valid valid expiration date.",card_num:":attribute harus berupa nomor kartu kredit.",currency:":attribute harus berupa mata uang yang valid.",date:":attribute harus berupa tanggal.",date_equals:":attribute harus sama dengan :date.",email:":attribute harus berupa alamat email yang valid.",in:":attribute terpilih harus :values.",integer:":attribute harus berupa integer.",max:":attribute harus kurang dari :max:type.",min:":attribute harus lebih dari :min:type.",not_in:":attribute terpilih tidak boleh sama dngan :values.",not_regex:":attribute tidak boleh cocok dengan pola yang ditentukan.",numeric:":attribute harus berupa angka.",phone:":attribute harus berupa nomor ponsel yang valid.",regex:":attribute harus cocok dengan pola yang ditentukan.",required:":attribute tidak boleh kosong.",size:":attribute harus :size:type.",string:":attribute harus berupa string.",typeof:":attribute tida cocok dengan tiipe :type.",url:":attribute harus berupa url."}),null}); \ No newline at end of file diff --git a/dist/locale/min/sl.min.js b/dist/locale/min/sl.min.js index d27b780..97cb2c2 100644 --- a/dist/locale/min/sl.min.js +++ b/dist/locale/min/sl.min.js @@ -1,2 +1,2 @@ -// Simple React Validator v1.4.3 | Created By Dockwa | MIT License | 2017 - Present +// Simple React Validator v1.4.4 | Created By Dockwa | MIT License | 2017 - Present !function(e,t){"function"==typeof define&&define.amd?define(["simple-react-validator"],t):"object"==typeof exports?module.exports=t(require("simple-react-validator")):e.SimpleReactValidatorLocaleSl=t(e.SimpleReactValidator)}(this,function(e){"use strict";return e.addLocale("sl",{accepted:"Polje :attribute mora biti izbrano.",after:"Polje :attribute mora biti večje od :date.",after_or_equal:"Polje :attribute mora biti večje ali enako :date.",alpha:"Polje :attribute lahko vsebuje samo črke.",alpha_space:"Polje :attribute lahko vsebuje samo črke in presledke.",alpha_num:"Polje :attribute lahko vsebuje samo črke in številke.",alpha_num_space:"Polje :attribute lahko vsebuje samo, številke in presledke.",alpha_num_dash:"Polje :attribute lahko vsebuje samo črke, številke in vezaje.",alpha_num_dash_space:"Polje :attribute lahko vsebuje samo črke, številke, vezaje in presledke.",array:"Polje :attribute mora biti niz.",before:"Polje :attribute mora biti manjše od :date.",before_or_equal:"Polje :attribute mora biti manjše ali enako :date.",between:"Polje :attribute mora biti med :min in :max:type.",boolean:"Polje :attribute mora biti logična spremenljivka.",card_exp:"Polje :attribute mora biti veljaven datum poteka kreditne kartice.",card_num:"Polje :attribute mora biti veljavna številka kreditne kartice.",currency:"Polje :attribute mora biti veljavna valuta.",date:"Polje :attribute mora biti datum.",date_equals:"Polje :attribute mora biti enak :date.",email:"Polje :attribute mora biti veljaven e-poštni naslov.",in:"Izbrano polje :attribute mora biti :values.",integer:"Polje :attribute mora biti celo število.",max:"Polje :attribute ne sme biti večje od :max:type.",min:"Polje :attribute mora biti večje od :min:type.",not_in:"Izbrano polje :attribute ne sme biti :values.",not_regex:"Polje :attribute ne sme biti v tem formatu.",numeric:"Polje :attribute mora biti število.",phone:"Polje :attribute mora biti veljavna telefonska številka.",regex:"Polje :attribute mora biti v tem formatu.",required:"Polje :attribute je obvezno.",size:"Polje :attribute mora biti :size:type.",string:"Polje :attribute mora biti beseda.",typeof:"Polje :attribute mora biti tipa :type.",url:"Polje :attribute mora biti URL povezava."}),null}); \ No newline at end of file diff --git a/dist/locale/min/sr.min.js b/dist/locale/min/sr.min.js index 7f037d5..25b58b1 100644 --- a/dist/locale/min/sr.min.js +++ b/dist/locale/min/sr.min.js @@ -1,2 +1,2 @@ -// Simple React Validator v1.4.3 | Created By Dockwa | MIT License | 2017 - Present +// Simple React Validator v1.4.4 | Created By Dockwa | MIT License | 2017 - Present !function(e,t){"function"==typeof define&&define.amd?define(["simple-react-validator"],t):"object"==typeof exports?module.exports=t(require("simple-react-validator")):e.SimpleReactValidatorLocaleSr=t(e.SimpleReactValidator)}(this,function(e){"use strict";return e.addLocale("sr",{accepted:"Polje :attribute mora biti prihvaćeno.",after:"Polje :attribute mora biti nakon :date.",after_or_equal:"Polje :attribute mora biti nakon ili na :date.",alpha:"Polje :attribute može sadržati samo slova.",alpha_space:"Polje :attribute može sadržati samo slova i razmake.",alpha_num:"Polje :attribute može sadržati samo slova i brojeve.",alpha_num_space:"Polje :attribute može sadržati samo slova, brojeve i razmake.",alpha_num_dash:"Polje :attribute može sadržati samo slova, brojeve i crte.",alpha_num_dash_space:"Polje :attribute može sadržati samo slova, brojeve, crte i razmake.",array:"Polje :attribute mora biti niz.",before:"Polje :attribute mora biti pre :date.",before_or_equal:"Polje :attribute mora biti pre ili na :date.",between:"Polje :attribute mora biti između :min i :max:type.",boolean:"Polje :attribute mora biti istinitosna vrednost.",card_exp:"Polje :attribute mora biti validan datum isteka.",card_num:"Polje :attribute mora biti validan broj kreditne kartice.",currency:"Polje :attribute mora biti validna valuta.",date:"Polje :attribute mora biti datum.",date_equals:"Polje :attribute mora biti na :date.",email:"Polje :attribute mora biti validna email adresa.",in:"Izabrano polje :attribute mora biti :values.",integer:"Polje :attribute mora biti ceo broj.",max:"Polje :attribute ne sme biti veće od :max:type.",min:"Polje :attribute mora biti veće od :min:type.",not_in:"Izabrano polje :attribute ne sme biti :values.",not_regex:"Polje :attribute ne sme biti u određenom formatu.",numeric:"Polje :attribute mora biti broj.",phone:"Polje :attribute mora biti validan broj telefona.",regex:"Polje :attribute mora biti u određenom formatu.",required:"Polje :attribute je obavezno.",size:"Polje :attribute mora biti :size:type.",string:"Polje :attribute mora biti niska.",typeof:"Polje :attribute nije ispravan tip :type.",url:"Polje :attribute mora biti URL."}),null}); \ No newline at end of file diff --git a/dist/locale/min/tr.min.js b/dist/locale/min/tr.min.js index 73b8f9b..69b1abf 100644 --- a/dist/locale/min/tr.min.js +++ b/dist/locale/min/tr.min.js @@ -1,2 +1,2 @@ -// Simple React Validator v1.4.3 | Created By Dockwa | MIT License | 2017 - Present +// Simple React Validator v1.4.4 | Created By Dockwa | MIT License | 2017 - Present !function(a,e){"function"==typeof define&&define.amd?define(["simple-react-validator"],e):"object"==typeof exports?module.exports=e(require("simple-react-validator")):a.SimpleReactValidatorLocaleTr=e(a.SimpleReactValidator)}(this,function(a){"use strict";return a.addLocale("tr",{accepted:":attribute onaylanmalıdır.",after:":attribute :date tarihinden sonra olmalıdır.",after_or_equal:":attribute :date tarihinde veya sonra olmalıdır.",alpha:":attribute sadece harf içerebilir.",alpha_space:":attribute sadece harf, ve boşluk karakteri içerebilir.",alpha_num:":attribute sadece harf, ve rakam içerebilir.",alpha_num_space:":attribute sadece harf, rakam, ve boşluk karakteri içerebilir.",alpha_num_dash:":attribute sadece harf, rakam, ve tire karakteri içerebilir.",alpha_num_dash_space:":attribute sadece harf, rakam, tire, ve boşluk karakteri içerebilir.",array:":attribute dizi tipinde olmalıdır.",before:":attribute :date tarihinden önce olmalıdır.",before_or_equal:":attribute :date tarihinde veya daha önce olmalıdır.",between:":attribute :min - :max:type aralığında olmalıdır.",boolean:":attribute geçerli bir mantıksal değer olmalıdır.",card_exp:":attribute geçerli bir sonlanma tarihi olmalıdır.",card_num:":attribute geçerli bir kredi kartı numarası olmalıdır.",currency:":attribute geçerli bir para tipi olmalıdır.",date:":attribute tarih formatında olmalıdır.",date_equals:":attribute :date tarihli olmalıdır.",email:":attribute geçerli bir e-posta adresi olmalıdır.",in:"Seçilen :attribute :values olmalıdır.",integer:":attribute sayı olmalıdır.",max:":attribute :max:type dan büyük olamaz.",min:":attribute en az :min:type olmalıdır.",not_in:"Seçilen :attribute :values olamaz.",not_regex:":attribute gerekli formattan farklı olmalıdır.",numeric:":attribute sayı olmalıdır.",phone:":attribute geçerli bir telefon numarası olmalıdır.",regex:":attribute gerekli formatla uyumlu olmalıdır.",required:":attribute alanı doldurulmalıdır.",size:":attribute :size:type tipinde olmalıdır.",string:":attribute karakter dizisi olmalıdır.",typeof:":attribute :type tipinde olmalıdır.",url:":attribute url olmalıdır."}),null}); \ No newline at end of file diff --git a/dist/locale/sl.js b/dist/locale/sl.js index da23147..fd7340f 100644 --- a/dist/locale/sl.js +++ b/dist/locale/sl.js @@ -1,4 +1,4 @@ -// Simple React Validator v1.4.3 | Created By Dockwa | MIT License | 2017 - Present +// Simple React Validator v1.4.4 | Created By Dockwa | MIT License | 2017 - Present ;(function(root, factory) { if (typeof define === 'function' && define.amd) { define(['simple-react-validator'], factory); diff --git a/dist/locale/sr.js b/dist/locale/sr.js index 594e9f3..7761acd 100644 --- a/dist/locale/sr.js +++ b/dist/locale/sr.js @@ -1,4 +1,4 @@ -// Simple React Validator v1.4.3 | Created By Dockwa | MIT License | 2017 - Present +// Simple React Validator v1.4.4 | Created By Dockwa | MIT License | 2017 - Present ;(function(root, factory) { if (typeof define === 'function' && define.amd) { define(['simple-react-validator'], factory); diff --git a/dist/locale/tr.js b/dist/locale/tr.js index 619e1bd..7c771c3 100644 --- a/dist/locale/tr.js +++ b/dist/locale/tr.js @@ -1,4 +1,4 @@ -// Simple React Validator v1.4.3 | Created By Dockwa | MIT License | 2017 - Present +// Simple React Validator v1.4.4 | Created By Dockwa | MIT License | 2017 - Present ;(function(root, factory) { if (typeof define === 'function' && define.amd) { define(['simple-react-validator'], factory); diff --git a/dist/simple-react-validator.js b/dist/simple-react-validator.js index 4e5e261..d37810d 100644 --- a/dist/simple-react-validator.js +++ b/dist/simple-react-validator.js @@ -1,4 +1,4 @@ -// Simple React Validator v1.4.3 | Created By Dockwa | MIT License | 2017 - Present +// Simple React Validator v1.4.4 | Created By Dockwa | MIT License | 2017 - Present ;(function(root, factory) { if (typeof define === 'function' && define.amd) { define(['react'], factory); @@ -167,7 +167,9 @@ function () { this.rules = _objectSpread({ accepted: { message: 'The :attribute must be accepted.', - rule: function rule(val) {}, + rule: function rule(val) { + return val === true; + }, required: true }, after: { @@ -603,7 +605,7 @@ function () { return SimpleReactValidator; }(); -_defineProperty(SimpleReactValidator, "version", '1.4.3'); +_defineProperty(SimpleReactValidator, "version", '1.4.4'); _defineProperty(SimpleReactValidator, "locales", { 'en': {} diff --git a/dist/simple-react-validator.min.js b/dist/simple-react-validator.min.js index 98ea0a8..9e09566 100644 --- a/dist/simple-react-validator.min.js +++ b/dist/simple-react-validator.min.js @@ -1,2 +1,2 @@ -// Simple React Validator v1.4.3 | Created By Dockwa | MIT License | 2017 - Present -!function(e,t){"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?module.exports=t(require("react")):e.SimpleReactValidator=t(e.React)}(this,function(n){"use strict";function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var r=[],s=!0,n=!1,a=void 0;try{for(var i,u=e[Symbol.iterator]();!(s=(i=u.next()).done)&&(r.push(i.value),!t||r.length!==t);s=!0);}catch(e){n=!0,a=e}finally{try{s||null==u.return||u.return()}finally{if(n)throw a}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,s)}return r}function b(t){for(var e=1;e=parseFloat(t[0])&&r.helpers.size(e,t[2])<=parseFloat(t[1])},messageReplace:function(e,t){return e.replace(":min",t[0]).replace(":max",t[1]).replace(":type",r.helpers.sizeText(t[2]))}},boolean:{message:"The :attribute must be a boolean.",rule:function(e){return!1===e||!0===e}},card_exp:{message:"The :attribute must be a valid expiration date.",rule:function(e){return r.helpers.testRegex(e,/^(([0]?[1-9]{1})|([1]{1}[0-2]{1}))\s?\/\s?(\d{2}|\d{4})$/)}},card_num:{message:"The :attribute must be a valid credit card number.",rule:function(e){return r.helpers.testRegex(e,/^\d{4}\s?\d{4,6}\s?\d{4,5}\s?\d{0,8}$/)}},currency:{message:"The :attribute must be a valid currency.",rule:function(e){return r.helpers.testRegex(e,/^\$?(\d{1,3})(\,?\d{3})*\.?\d{0,2}$/)}},date:{message:"The :attribute must be a date.",rule:function(e){return r.helpers.momentInstalled()&&moment.isMoment(e)}},date_equals:{message:"The :attribute must be on :date.",rule:function(e,t){return r.helpers.momentInstalled()&&moment.isMoment(e)&&e.isSame(t[0],"day")},messageReplace:function(e,t){return e.replace(":date",t[0].format("MM/DD/YYYY"))}},email:{message:"The :attribute must be a valid email address.",rule:function(e){return r.helpers.testRegex(e,/^[A-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i)}},in:{message:"The selected :attribute must be :values.",rule:function(e,t){return t.includes(e)},messageReplace:function(e,t){return e.replace(":values",r.helpers.toSentence(t))}},integer:{message:"The :attribute must be an integer.",rule:function(e){return r.helpers.testRegex(e,/^\d*$/)}},max:{message:"The :attribute may not be greater than :max:type.",rule:function(e,t){return r.helpers.size(e,t[1])<=parseFloat(t[0])},messageReplace:function(e,t){return e.replace(":max",t[0]).replace(":type",r.helpers.sizeText(t[1]))}},min:{message:"The :attribute must be at least :min:type.",rule:function(e,t){return r.helpers.size(e,t[1])>=parseFloat(t[0])},messageReplace:function(e,t){return e.replace(":min",t[0]).replace(":type",r.helpers.sizeText(t[1]))}},not_in:{message:"The selected :attribute must not be :values.",rule:function(e,t){return!t.includes(e)},messageReplace:function(e,t){return e.replace(":values",r.helpers.toSentence(t))}},not_regex:{message:"The :attribute must not match the required pattern.",rule:function(e,t){return!r.helpers.testRegex(e,"string"==typeof t[0]||t[0]instanceof String?new RegExp(t[0]):t[0])}},numeric:{message:"The :attribute must be a number.",rule:function(e){return r.helpers.testRegex(e,/^\-?\d*\.?\d+$/)}},phone:{message:"The :attribute must be a valid phone number.",rule:function(e){return r.helpers.testRegex(e,/^(\+?\d{0,4})?\s?-?\s?(\(?\d{3}\)?)\s?-?\s?(\(?\d{3}\)?)\s?-?\s?(\(?\d{4}\)?)$/)&&!r.helpers.testRegex(e,/^\b(\d)\1{8,}\b$/)}},regex:{message:"The :attribute must match the required pattern.",rule:function(e,t){return r.helpers.testRegex(e,"string"==typeof t[0]||t[0]instanceof String?new RegExp(t[0]):t[0])}},required:{message:"The :attribute field is required.",rule:function(e){return!r.helpers.isBlank(e)},required:!0},size:{message:"The :attribute must be :size:type.",rule:function(e,t){return r.helpers.size(e,t[1])==parseFloat(t[0])},messageReplace:function(e,t){return e.replace(":size",t[0]).replace(":type",r.helpers.sizeText(t[1]))}},string:{message:"The :attribute must be a string.",rule:function(e){return a(e)===a("string")}},typeof:{message:"The :attribute is not the correct type of :type.",rule:function(e,t){return a(e)===a(t[0])},messageReplace:function(e,t){return e.replace(":type",a(t[0]))}},url:{message:"The :attribute must be a url.",rule:function(e){return r.helpers.testRegex(e,/^https?:\/\/[-a-z0-9@:%._\+~#=]{1,256}\.[a-z0-9()]{2,6}\b([-a-z0-9()@:%_\+.~#?&//=]*)$/i)}}},e.validators||{}),e.locale&&!s.locales.hasOwnProperty(e.locale)&&console.warn("Locale not found! Make sure it is spelled correctly and the locale file is loaded.");var t=s.locales[e.locale]||{};Object.keys(this.rules).forEach(function(e){r.rules[e].message=t[e]||r.rules[e].message}),this.messages=e.messages||{},this.className=e.className,this.autoForceUpdate=e.autoForceUpdate||!1,!1===e.element?this.element=function(e){return e}:e.hasOwnProperty("element")?this.element=e.element:"object"===("undefined"==typeof navigator?"undefined":a(navigator))&&"ReactNative"===navigator.product?this.element=function(e){return e}:this.element=function(e,t){return n.createElement("div",{className:t||r.className||"srv-validation-message"},e)}}return e(s,null,[{key:"addLocale",value:function(e,t){this.locales[e]=t}}]),e(s,[{key:"getErrorMessages",value:function(){return this.errorMessages}},{key:"showMessages",value:function(){this.messagesShown=!0,this.helpers.forceUpdateIfNeeded()}},{key:"hideMessages",value:function(){this.messagesShown=!1,this.helpers.forceUpdateIfNeeded()}},{key:"allValid",value:function(){for(var e in this.fields)if(!1===this.fieldValid(e))return!1;return!0}},{key:"fieldValid",value:function(e){return this.fields.hasOwnProperty(e)&&!0===this.fields[e]}},{key:"purgeFields",value:function(){this.fields={},this.errorMessages={}}},{key:"messageWhenPresent",value:function(e){var t=1=parseFloat(t[0])&&r.helpers.size(e,t[2])<=parseFloat(t[1])},messageReplace:function(e,t){return e.replace(":min",t[0]).replace(":max",t[1]).replace(":type",r.helpers.sizeText(t[2]))}},boolean:{message:"The :attribute must be a boolean.",rule:function(e){return!1===e||!0===e}},card_exp:{message:"The :attribute must be a valid expiration date.",rule:function(e){return r.helpers.testRegex(e,/^(([0]?[1-9]{1})|([1]{1}[0-2]{1}))\s?\/\s?(\d{2}|\d{4})$/)}},card_num:{message:"The :attribute must be a valid credit card number.",rule:function(e){return r.helpers.testRegex(e,/^\d{4}\s?\d{4,6}\s?\d{4,5}\s?\d{0,8}$/)}},currency:{message:"The :attribute must be a valid currency.",rule:function(e){return r.helpers.testRegex(e,/^\$?(\d{1,3})(\,?\d{3})*\.?\d{0,2}$/)}},date:{message:"The :attribute must be a date.",rule:function(e){return r.helpers.momentInstalled()&&moment.isMoment(e)}},date_equals:{message:"The :attribute must be on :date.",rule:function(e,t){return r.helpers.momentInstalled()&&moment.isMoment(e)&&e.isSame(t[0],"day")},messageReplace:function(e,t){return e.replace(":date",t[0].format("MM/DD/YYYY"))}},email:{message:"The :attribute must be a valid email address.",rule:function(e){return r.helpers.testRegex(e,/^[A-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i)}},in:{message:"The selected :attribute must be :values.",rule:function(e,t){return t.includes(e)},messageReplace:function(e,t){return e.replace(":values",r.helpers.toSentence(t))}},integer:{message:"The :attribute must be an integer.",rule:function(e){return r.helpers.testRegex(e,/^\d*$/)}},max:{message:"The :attribute may not be greater than :max:type.",rule:function(e,t){return r.helpers.size(e,t[1])<=parseFloat(t[0])},messageReplace:function(e,t){return e.replace(":max",t[0]).replace(":type",r.helpers.sizeText(t[1]))}},min:{message:"The :attribute must be at least :min:type.",rule:function(e,t){return r.helpers.size(e,t[1])>=parseFloat(t[0])},messageReplace:function(e,t){return e.replace(":min",t[0]).replace(":type",r.helpers.sizeText(t[1]))}},not_in:{message:"The selected :attribute must not be :values.",rule:function(e,t){return!t.includes(e)},messageReplace:function(e,t){return e.replace(":values",r.helpers.toSentence(t))}},not_regex:{message:"The :attribute must not match the required pattern.",rule:function(e,t){return!r.helpers.testRegex(e,"string"==typeof t[0]||t[0]instanceof String?new RegExp(t[0]):t[0])}},numeric:{message:"The :attribute must be a number.",rule:function(e){return r.helpers.testRegex(e,/^\-?\d*\.?\d+$/)}},phone:{message:"The :attribute must be a valid phone number.",rule:function(e){return r.helpers.testRegex(e,/^(\+?\d{0,4})?\s?-?\s?(\(?\d{3}\)?)\s?-?\s?(\(?\d{3}\)?)\s?-?\s?(\(?\d{4}\)?)$/)&&!r.helpers.testRegex(e,/^\b(\d)\1{8,}\b$/)}},regex:{message:"The :attribute must match the required pattern.",rule:function(e,t){return r.helpers.testRegex(e,"string"==typeof t[0]||t[0]instanceof String?new RegExp(t[0]):t[0])}},required:{message:"The :attribute field is required.",rule:function(e){return!r.helpers.isBlank(e)},required:!0},size:{message:"The :attribute must be :size:type.",rule:function(e,t){return r.helpers.size(e,t[1])==parseFloat(t[0])},messageReplace:function(e,t){return e.replace(":size",t[0]).replace(":type",r.helpers.sizeText(t[1]))}},string:{message:"The :attribute must be a string.",rule:function(e){return a(e)===a("string")}},typeof:{message:"The :attribute is not the correct type of :type.",rule:function(e,t){return a(e)===a(t[0])},messageReplace:function(e,t){return e.replace(":type",a(t[0]))}},url:{message:"The :attribute must be a url.",rule:function(e){return r.helpers.testRegex(e,/^https?:\/\/[-a-z0-9@:%._\+~#=]{1,256}\.[a-z0-9()]{2,6}\b([-a-z0-9()@:%_\+.~#?&//=]*)$/i)}}},e.validators||{}),e.locale&&!s.locales.hasOwnProperty(e.locale)&&console.warn("Locale not found! Make sure it is spelled correctly and the locale file is loaded.");var t=s.locales[e.locale]||{};Object.keys(this.rules).forEach(function(e){r.rules[e].message=t[e]||r.rules[e].message}),this.messages=e.messages||{},this.className=e.className,this.autoForceUpdate=e.autoForceUpdate||!1,!1===e.element?this.element=function(e){return e}:e.hasOwnProperty("element")?this.element=e.element:"object"===("undefined"==typeof navigator?"undefined":a(navigator))&&"ReactNative"===navigator.product?this.element=function(e){return e}:this.element=function(e,t){return n.createElement("div",{className:t||r.className||"srv-validation-message"},e)}}return e(s,null,[{key:"addLocale",value:function(e,t){this.locales[e]=t}}]),e(s,[{key:"getErrorMessages",value:function(){return this.errorMessages}},{key:"showMessages",value:function(){this.messagesShown=!0,this.helpers.forceUpdateIfNeeded()}},{key:"hideMessages",value:function(){this.messagesShown=!1,this.helpers.forceUpdateIfNeeded()}},{key:"allValid",value:function(){for(var e in this.fields)if(!1===this.fieldValid(e))return!1;return!0}},{key:"fieldValid",value:function(e){return this.fields.hasOwnProperty(e)&&!0===this.fields[e]}},{key:"purgeFields",value:function(){this.fields={},this.errorMessages={}}},{key:"messageWhenPresent",value:function(e){var t=1 {}, required: true}, + accepted : {message: 'The :attribute must be accepted.', rule: val => val === true, required: true}, after : {message: 'The :attribute must be after :date.', rule: (val, params) => this.helpers.momentInstalled() && moment.isMoment(val) && val.isAfter(params[0], 'day'), messageReplace: (message, params) => message.replace(':date', params[0].format('MM/DD/YYYY'))}, after_or_equal : {message: 'The :attribute must be after or on :date.', rule: (val, params) => this.helpers.momentInstalled() && moment.isMoment(val) && val.isSameOrAfter(params[0], 'day'), messageReplace: (message, params) => message.replace(':date', params[0].format('MM/DD/YYYY'))}, alpha : {message: 'The :attribute may only contain letters.', rule: val => this.helpers.testRegex(val,/^[A-Z]*$/i)},