2 lines
5.3 KiB
JavaScript
2 lines
5.3 KiB
JavaScript
this.primereact=this.primereact||{},this.primereact.inputtext=function(t,e,r,n,o){"use strict";function i(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var p=i(e);function l(){return l=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},l.apply(this,arguments)}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function f(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function c(t,e){return c=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},c(t,e)}function a(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&&c(t,e)}function y(t){return y="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},y(t)}function h(t,e){if(e&&("object"===y(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return f(t)}function d(t){return d=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},d(t)}function b(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function m(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function v(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?m(Object(r),!0).forEach((function(e){b(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function O(){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 P=function(t){a(g,t);var i,c,y,b,m,P=(i=g,c=O(),function(){var t,e=d(i);if(c){var r=d(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return h(this,t)});function g(t){var r;return s(this,g),(r=P.call(this,t)).onInput=r.onInput.bind(f(r)),r.onKeyPress=r.onKeyPress.bind(f(r)),r.elementRef=e.createRef(r.props.forwardRef),r}return y=g,(b=[{key:"isFilled",value:function(){return null!=this.props.value&&this.props.value.toString().length>0||null!=this.props.defaultValue&&this.props.defaultValue.toString().length>0||this.elementRef&&this.elementRef.current&&null!=this.elementRef.current.value&&this.elementRef.current.value.toString().length>0}},{key:"onKeyPress",value:function(t){this.props.onKeyPress&&this.props.onKeyPress(t),this.props.keyfilter&&n.KeyFilter.onKeyPress(t,this.props.keyfilter,this.props.validateOnly)}},{key:"onInput",value:function(t){var e=!0;this.props.keyfilter&&this.props.validateOnly&&(e=n.KeyFilter.validate(t,this.props.keyfilter)),this.props.onInput&&this.props.onInput(t,e),this.props.onChange||(t.target.value.length>0?r.DomHandler.addClass(t.target,"p-filled"):r.DomHandler.removeClass(t.target,"p-filled"))}},{key:"updateForwardRef",value:function(){var t=this.props.forwardRef;t&&("function"==typeof t?t(this.elementRef.current):t.current=this.elementRef.current)}},{key:"componentDidMount",value:function(){this.updateForwardRef(),this.props.tooltip&&this.renderTooltip()}},{key:"componentDidUpdate",value:function(t){t.tooltip===this.props.tooltip&&t.tooltipOptions===this.props.tooltipOptions||(this.tooltip?this.tooltip.update(v({content:this.props.tooltip},this.props.tooltipOptions||{})):this.renderTooltip())}},{key:"componentWillUnmount",value:function(){this.tooltip&&(this.tooltip.destroy(),this.tooltip=null)}},{key:"renderTooltip",value:function(){this.tooltip=o.tip({target:this.elementRef.current,content:this.props.tooltip,options:this.props.tooltipOptions})}},{key:"render",value:function(){var t=r.classNames("p-inputtext p-component",{"p-disabled":this.props.disabled,"p-filled":this.isFilled()},this.props.className),e=r.ObjectUtils.findDiffKeys(this.props,g.defaultProps);return p.default.createElement("input",l({ref:this.elementRef},e,{className:t,onInput:this.onInput,onKeyPress:this.onKeyPress}))}}])&&u(y.prototype,b),m&&u(y,m),Object.defineProperty(y,"prototype",{writable:!1}),g}(e.Component);return b(P,"defaultProps",{keyfilter:null,validateOnly:!1,tooltip:null,tooltipOptions:null,onInput:null,onKeyPress:null,forwardRef:null}),t.InputText=p.default.forwardRef((function(t,e){return p.default.createElement(P,l({forwardRef:e},t))})),Object.defineProperty(t,"__esModule",{value:!0}),t}({},React,primereact.utils,primereact.keyfilter,primereact.tooltip);
|