2 lines
12 KiB
JavaScript
2 lines
12 KiB
JavaScript
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),e=require("primereact/utils"),i=require("primereact/inputtext"),n=require("primereact/tooltip");function s(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var r=s(t);function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function a(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function l(t,e){return l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},l(t,e)}function h(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e)}function p(t){return p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},p(t)}function f(t,e){if(e&&("object"===p(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return a(t)}function c(t){return c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},c(t)}function d(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function v(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function y(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?v(Object(i),!0).forEach((function(e){d(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):v(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function b(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}var g=function(s){h(k,t.Component);var l,p,d,v,g,m=(l=k,p=b(),function(){var t,e=c(l);if(p){var i=c(this).constructor;t=Reflect.construct(e,arguments,i)}else t=e.apply(this,arguments);return f(this,t)});function k(e){var i;return o(this,k),(i=m.call(this,e)).onFocus=i.onFocus.bind(a(i)),i.onBlur=i.onBlur.bind(a(i)),i.onKeyDown=i.onKeyDown.bind(a(i)),i.onKeyPress=i.onKeyPress.bind(a(i)),i.onInput=i.onInput.bind(a(i)),i.handleInputChange=i.handleInputChange.bind(a(i)),i.inputRef=t.createRef(i.props.inputRef),i}return d=k,(v=[{key:"caret",value:function(t,e){var i,n,s,r=this.inputRef&&this.inputRef.current;if(r&&r.offsetParent&&r===document.activeElement)return"number"!=typeof t?(r.setSelectionRange?(n=r.selectionStart,s=r.selectionEnd):document.selection&&document.selection.createRange&&(s=(n=0-(i=document.selection.createRange()).duplicate().moveStart("character",-1e5))+i.text.length),{begin:n,end:s}):(n=t,s="number"==typeof e?e:n,void(r.setSelectionRange?r.setSelectionRange(n,s):r.createTextRange&&((i=r.createTextRange()).collapse(!0),i.moveEnd("character",s),i.moveStart("character",n),i.select())))}},{key:"isCompleted",value:function(){for(var t=this.firstNonMaskPos;t<=this.lastRequiredNonMaskPos;t++)if(this.tests[t]&&this.buffer[t]===this.getPlaceholder(t))return!1;return!0}},{key:"getPlaceholder",value:function(t){return this.props.slotChar.charAt(t<this.props.slotChar.length?t:0)}},{key:"getValue",value:function(){return this.props.unmask?this.getUnmaskedValue():this.inputRef&&this.inputRef.current&&this.inputRef.current.value}},{key:"seekNext",value:fu
|