{"version":3,"sources":["webpack:///./LeLab.Gcv.Web/src/atomic/molecule/m-form-group/m-form-group.chunk.js","webpack:///./LeLab.Gcv.Web/src/atomic/molecule/m-form-group/m-form-group.scss"],"names":["require","$","$document","document","getErrorMessage","e","obj","error","currentTarget","data","bindFormGroupValidateEvent","each","off","on","$validationTarget","target","is","$elm","inputName","attr","remove","errorMsg","addClass","append","length","removeClass","init"],"mappings":";;;;;;;;AAAA,mBAAAA,CAAQ,GAAR;;AAEA,IAAIC,IAAI,mBAAAD,CAAQ,CAAR,CAAR;AACA,IAAIE,YAAYD,EAAEE,QAAF,CAAhB;;AAEA,IAAIC,kBAAkB,SAAlBA,eAAkB,CAAUC,CAAV,EAAaC,GAAb,EAAkB;;AAEpC,QAAIA,OAAOA,IAAIC,KAAX,IAAoB,OAAOD,IAAIC,KAAX,KAAqB,QAA7C,EAAuD;;AAEnD,YAAIF,EAAEG,aAAF,IAAmBP,EAAEI,EAAEG,aAAJ,EAAmBC,IAAnB,CAAwB,6BAAxB,CAAvB,EAA+E;AAC3E,mBAAOR,EAAEI,EAAEG,aAAJ,EAAmBC,IAAnB,CAAwB,6BAAxB,CAAP;AACH;;AAED,eAAOH,IAAIC,KAAX;AACH;;AAED,WAAO,EAAP;AAEH,CAbD;;AAeA,IAAIG,6BAA6B,SAA7BA,0BAA6B,GAAY;;AAEzCT,MAAE,eAAF,EAAmBU,IAAnB,CAAwB,YAAY;AAChCV,UAAE,IAAF,EAAQW,GAAR,CAAY,oBAAZ;AACAX,UAAE,IAAF,EAAQY,EAAR,CAAW,oBAAX,EAAiC,UAAUR,CAAV,EAAaC,GAAb,EAAkB;;AAE/C,gBAAIQ,oBAAoBb,EAAEI,EAAEU,MAAJ,CAAxB;;AAEA;AACA;AACA,gBAAID,kBAAkBE,EAAlB,CAAqB,mBAArB,CAAJ,EAA+C;AAC3C;AACH;;AAED,gBAAIC,OAAOhB,EAAE,IAAF,CAAX;AACA,gBAAIiB,YAAYJ,kBAAkBK,IAAlB,CAAuB,MAAvB,CAAhB;;AAEAlB,cAAE,2CAA2CiB,SAA3C,GAAuD,IAAzD,EAA+DD,IAA/D,EAAqEG,MAArE;;AAEA,gBAAIC,WAAWjB,gBAAgBC,CAAhB,EAAmBC,GAAnB,CAAf;;AAEA,gBAAIe,QAAJ,EAAc;;AAEV,oBAAIP,kBAAkBE,EAAlB,CAAqB,QAArB,CAAJ,EAAoC;AAChCF,sCAAkBQ,QAAlB,CAA2B,uBAA3B;AACH;;AAEDL,qBAAKK,QAAL,CAAc,qBAAd;AACAL,qBAAKM,MAAL,CAAY,wDAAwDL,SAAxD,GAAoE,IAApE,GAA2EG,QAA3E,GAAsF,SAAlG;AACH;;AAED,gBAAIpB,EAAE,sBAAF,EAA0BgB,IAA1B,EAAgCO,MAAhC,IAA0C,CAA9C,EAAiD;;AAE7C,oBAAIV,kBAAkBE,EAAlB,CAAqB,QAArB,CAAJ,EAAoC;AAChCF,sCAAkBW,WAAlB,CAA8B,uBAA9B;AACH;;AAEDR,qBAAKQ,WAAL,CAAiB,qBAAjB;AACH;AAEJ,SApCD;AAqCH,KAvCD;AAyCH,CA3CD;;AA6CA,IAAIC,OAAO,SAAPA,IAAO,GAAY;AACnBhB;AACH,CAFD;;AAIAgB;;AAEAxB,UAAUU,GAAV,CAAc,4BAAd;AACAV,UAAUW,EAAV,CAAa,4BAAb,EAA2C,YAAY;AACnDa;AACH,CAFD;;AAIAxB,UAAUU,GAAV,CAAc,2BAAd;AACAV,UAAUW,EAAV,CAAa,2BAAb,EAA0C,YAAY;AAClDa;AACH,CAFD,E;;;;;;;AC7EA,yC","file":"m-form-group.js","sourcesContent":["require(\"./m-form-group.scss\");\r\n\r\nvar $ = require(\"jquery\");\r\nvar $document = $(document);\r\n\r\nvar getErrorMessage = function (e, obj) {\r\n\r\n if (obj && obj.error && typeof obj.error === \"string\") {\r\n\r\n if (e.currentTarget && $(e.currentTarget).data('validation-required-message')) {\r\n return $(e.currentTarget).data('validation-required-message');\r\n }\r\n\r\n return obj.error;\r\n }\r\n\r\n return \"\";\r\n\r\n};\r\n\r\nvar bindFormGroupValidateEvent = function () {\r\n\r\n $('.m-form-group').each(function () {\r\n $(this).off(\"validate.formgroup\");\r\n $(this).on(\"validate.formgroup\", function (e, obj) {\r\n\r\n let $validationTarget = $(e.target);\r\n\r\n // S'il s'agit d'un checkbox, ne pas gérer\r\n // ce cas de validation\r\n if ($validationTarget.is('[type=\"checkbox\"]')) {\r\n return;\r\n }\r\n\r\n var $elm = $(this);\r\n var inputName = $validationTarget.attr(\"name\");\r\n\r\n $('.m-form-group__error[data-input-name=\"' + inputName + '\"]', $elm).remove();\r\n\r\n var errorMsg = getErrorMessage(e, obj);\r\n\r\n if (errorMsg) {\r\n\r\n if ($validationTarget.is('select')) {\r\n $validationTarget.addClass(\"a-form-control--error\");\r\n }\r\n\r\n $elm.addClass(\"m-form-group--error\");\r\n $elm.append('' + errorMsg + '');\r\n }\r\n\r\n if ($('.m-form-group__error', $elm).length <= 0) {\r\n\r\n if ($validationTarget.is('select')) {\r\n $validationTarget.removeClass(\"a-form-control--error\");\r\n }\r\n\r\n $elm.removeClass(\"m-form-group--error\");\r\n }\r\n\r\n });\r\n });\r\n\r\n};\r\n\r\nvar init = function () {\r\n bindFormGroupValidateEvent();\r\n};\r\n\r\ninit();\r\n\r\n$document.off('jsInitAllScripts.formgroup');\r\n$document.on('jsInitAllScripts.formgroup', function () {\r\n init();\r\n});\r\n\r\n$document.off('jsInitFormGroup.formgroup');\r\n$document.on('jsInitFormGroup.formgroup', function () {\r\n init();\r\n});\n\n\n// WEBPACK FOOTER //\n// ./LeLab.Gcv.Web/src/atomic/molecule/m-form-group/m-form-group.chunk.js","// removed by extract-text-webpack-plugin\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./LeLab.Gcv.Web/src/atomic/molecule/m-form-group/m-form-group.scss\n// module id = 396\n// module chunks = 136"],"sourceRoot":""}