FIX: fields validation min-max length

This commit is contained in:
Tony Air 2020-11-05 14:57:23 +07:00
parent fbd8b8d6d9
commit 95dbd0a6a7
7 changed files with 36 additions and 34 deletions

2
dist/css/app.css vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
dist/js/app.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,59 +1,59 @@
/*!
* Bootstrap alert.js v4.5.2 (https://getbootstrap.com/)
* Bootstrap alert.js v4.5.3 (https://getbootstrap.com/)
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
/*!
* Bootstrap button.js v4.5.2 (https://getbootstrap.com/)
* Bootstrap button.js v4.5.3 (https://getbootstrap.com/)
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
/*!
* Bootstrap carousel.js v4.5.2 (https://getbootstrap.com/)
* Bootstrap carousel.js v4.5.3 (https://getbootstrap.com/)
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
/*!
* Bootstrap collapse.js v4.5.2 (https://getbootstrap.com/)
* Bootstrap collapse.js v4.5.3 (https://getbootstrap.com/)
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
/*!
* Bootstrap modal.js v4.5.2 (https://getbootstrap.com/)
* Bootstrap modal.js v4.5.3 (https://getbootstrap.com/)
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
/*!
* Bootstrap popover.js v4.5.2 (https://getbootstrap.com/)
* Bootstrap popover.js v4.5.3 (https://getbootstrap.com/)
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
/*!
* Bootstrap scrollspy.js v4.5.2 (https://getbootstrap.com/)
* Bootstrap scrollspy.js v4.5.3 (https://getbootstrap.com/)
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
/*!
* Bootstrap tab.js v4.5.2 (https://getbootstrap.com/)
* Bootstrap tab.js v4.5.3 (https://getbootstrap.com/)
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
/*!
* Bootstrap tooltip.js v4.5.2 (https://getbootstrap.com/)
* Bootstrap tooltip.js v4.5.3 (https://getbootstrap.com/)
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
/*!
* Bootstrap util.js v4.5.2 (https://getbootstrap.com/)
* Bootstrap util.js v4.5.3 (https://getbootstrap.com/)
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/

2
dist/js/app.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"name": "@a2nt/ss-bootstrap-ui-webpack-boilerplate",
"version": "2.6.0",
"version": "2.6.1",
"author": "Tony Air <tony@twma.pro>",
"license": "MIT",
"description": "This UI Kit allows you to build Bootstrap 4 webapp with some extra UI features. It's easy to extend and easy to convert HTML templates to CMS templates.",
@ -35,7 +35,7 @@
"dependencies": {
"@a2nt/meta-lightbox": "^2.3.9",
"bootbox": "^5.5.1",
"bootstrap": "^4.5.2",
"bootstrap": "^4.5.3",
"bootstrap-confirmation2": "^4.1.0",
"bootstrap-datepicker": "^1.9.0",
"bootstrap-offcanvas": "^1.0.0",
@ -59,10 +59,10 @@
},
"devDependencies": {
"@a2nt/image-sprite-webpack-plugin": "^0.2.5",
"@babel/core": "^7.11.6",
"@babel/plugin-proposal-object-rest-spread": "^7.11.0",
"@babel/plugin-transform-react-jsx": "^7.10.4",
"@babel/preset-env": "^7.11.5",
"@babel/core": "^7.12.3",
"@babel/plugin-proposal-object-rest-spread": "^7.12.1",
"@babel/plugin-transform-react-jsx": "^7.12.5",
"@babel/preset-env": "^7.12.1",
"@google/markerclusterer": "^2.0.9",
"animate.css": "^4.1.1",
"ansi-html": "^0.0.7",
@ -70,17 +70,17 @@
"autoprefixer": "^9.8.6",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.1.0",
"copy-webpack-plugin": "^6.2.1",
"copy-webpack-plugin": "^6.3.0",
"croppie": "^2.6.5",
"cross-env": "^7.0.2",
"css-loader": "^4.3.0",
"eslint": "^7.11.0",
"eslint": "^7.12.1",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jquery": "^1.5.1",
"eslint-plugin-react": "^7.21.4",
"eslint-plugin-react": "^7.21.5",
"exports-loader": "^1.1.1",
"favicons-webpack-plugin": "4.2.0",
"file-loader": "^6.1.1",
"file-loader": "^6.2.0",
"font-awesome": "^4.7.0",
"hard-source-webpack-plugin": "^0.13.1",
"html-entities": "^1.3.1",
@ -97,13 +97,13 @@
"optimize-css-assets-webpack-plugin": "^5.0.4",
"postcss-loader": "^4.0.4",
"react-hot-loader": "^4.13.0",
"resolve-url-loader": "^3.1.1",
"resolve-url-loader": "^3.1.2",
"rimraf": "^3.0.2",
"routie": "0.0.1",
"sass-lint": "^1.13.1",
"sass-lint-fix": "^1.12.1",
"sass-loader": "^10.0.3",
"script-ext-html-webpack-plugin": "^2.1.4",
"sass-loader": "^10.0.5",
"script-ext-html-webpack-plugin": "^2.1.5",
"sockjs-client": "^1.5.0",
"strip-ansi": "^6.0.0",
"style-loader": "^1.3.0",
@ -114,7 +114,7 @@
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.0",
"webpack-manifest-plugin": "^2.2.0",
"webpack-merge": "^5.2.0"
"webpack-merge": "^5.3.0"
},
"stylelint": {
"rules": {

View File

@ -53,11 +53,13 @@ const FormValidateField = (($) => {
// browser checks
if (!ui.$el[0].checkValidity()) {
valid = false;
console.warn(`${NAME}: Browser check validity is failed #${$el.attr('id')}`);
console.warn(
`${NAME}: Browser check validity is failed #${$el.attr('id')}`,
);
}
let unmaskedVal = val;
if(typeof $el.inputmask === 'function'){
if (typeof $el.inputmask === 'function') {
unmaskedVal = $el.inputmask('unmaskedvalue');
}
@ -83,8 +85,8 @@ const FormValidateField = (($) => {
// maxlength
const maxLength = $el.attr('maxlength');
if(maxLength && maxLength.length) {
if(unmaskedVal.length > maxLength){
if (unmaskedVal.length && maxLength && maxLength.length) {
if (unmaskedVal.length > maxLength) {
valid = false;
msg = `The value is limited to ${maxLength} chars`;
@ -94,8 +96,8 @@ const FormValidateField = (($) => {
// minlength
const minLength = $el.attr('minlength');
if(minLength && minLength.length) {
if(unmaskedVal.length < minLength){
if (unmaskedVal.length && minLength && minLength.length) {
if (unmaskedVal.length < minLength) {
valid = false;
msg = `The value should contain more than ${minLength} chars`;