Server IP : 150.95.80.236 / Your IP : 3.14.246.207 Web Server : Apache System : Linux host-150-95-80-236 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64 User : social-telecare ( 10000) PHP Version : 7.4.33 Disable Function : opcache_get_status MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/vhosts/pcu.in.th/uat.pcu.in.th/demo15/src/plugins/formvalidation/dist/es6/plugins/ |
Upload File : |
import e from"../core/Plugin";export default class t extends e{constructor(e){super(e);this.intlTelInstances=new Map;this.countryChangeHandler=new Map;this.fieldElements=new Map;this.opts=Object.assign({},{autoPlaceholder:"polite",utilsScript:""},e);this.validatePhoneNumber=this.checkPhoneNumber.bind(this);this.fields=typeof this.opts.field==="string"?this.opts.field.split(","):this.opts.field}install(){this.core.registerValidator(t.INT_TEL_VALIDATOR,this.validatePhoneNumber);this.fields.forEach((e=>{this.core.addField(e,{validators:{[t.INT_TEL_VALIDATOR]:{message:this.opts.message}}});const s=this.core.getElements(e)[0];const i=()=>this.core.revalidateField(e);s.addEventListener("countrychange",i);this.countryChangeHandler.set(e,i);this.fieldElements.set(e,s);this.intlTelInstances.set(e,intlTelInput(s,this.opts))}))}uninstall(){this.fields.forEach((e=>{const s=this.countryChangeHandler.get(e);const i=this.fieldElements.get(e);const n=this.intlTelInstances.get(e);if(s&&i&&n){i.removeEventListener("countrychange",s);this.core.disableValidator(e,t.INT_TEL_VALIDATOR);n.destroy()}}))}checkPhoneNumber(){return{validate:e=>{const t=e.value;const s=this.intlTelInstances.get(e.field);if(t===""||!s){return{valid:true}}return{valid:s.isValidNumber()}}}}}t.INT_TEL_VALIDATOR="___InternationalTelephoneInputValidator";