katoikia-app/web-ui/web-react/node_modules/primereact/inputtext/inputtext.cjs.min.js

2 lines
5.2 KiB
JavaScript

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