UNPKG

primereact

Version:

PrimeReact is an open source UI library for React featuring a rich set of 90+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with Prime

2 lines (1 loc) 1.74 kB
this.primereact=this.primereact||{},this.primereact.keyfilter=function(t,e){"use strict";function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function n(t){if(Array.isArray(t))return r(t)}function a(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function i(t,e){if(t){if("string"==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}}function o(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u={DEFAULT_MASKS:{pint:/[\d]/,int:/[\d\-]/,pnum:/[\d\.]/,money:/[\d\.\s,]/,num:/[\d\-\.]/,hex:/[0-9a-f]/i,email:/[a-z0-9_\.\-@]/i,alpha:/[a-z_]/i,alphanum:/[a-z0-9_]/i},getRegex:function(t){return u.DEFAULT_MASKS[t]?u.DEFAULT_MASKS[t]:t},onBeforeInput:function(t,r,n){!n&&e.DomHandler.isAndroid()&&this.validateKey(t,t.data,r)},onKeyPress:function(t,r,n){n||e.DomHandler.isAndroid()||t.ctrlKey||t.altKey||t.metaKey||this.validateKey(t,t.key,r)},onPaste:function(t,e,r){if(!r){var u,l=this.getRegex(e),c=t.clipboardData.getData("text");(u=c,n(u)||a(u)||i(u)||o()).forEach((function(e){if(!l.test(e))return t.preventDefault(),!1}))}},validateKey:function(t,e,r){null!=e&&(e.length<=2&&(this.getRegex(r).test(e)||t.preventDefault()))},validate:function(t,e){var r=t.target.value,n=!0,a=this.getRegex(e);return r&&!a.test(r)&&(n=!1),n}};return t.KeyFilter=u,Object.defineProperty(t,"__esModule",{value:!0}),t}({},primereact.utils);