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

2 lines
6.0 KiB
JavaScript

this.primereact=this.primereact||{},this.primereact.inputtextarea=function(t,e,o,r){"use strict";function n(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var i=n(e);function s(){return s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var o=arguments[e];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(t[r]=o[r])}return t},s.apply(this,arguments)}function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function p(t,e){for(var o=0;o<e.length;o++){var r=e[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function u(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 f(t){return f="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},f(t)}function h(t,e){if(e&&("object"===f(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 y(t){return y=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},y(t)}function d(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function b(t,e){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),o.push.apply(o,r)}return o}function m(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?b(Object(o),!0).forEach((function(e){d(t,e,o[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):b(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}function v(){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 O=function(t){a(g,t);var n,c,f,d,b,O=(n=g,c=v(),function(){var t,e=y(n);if(c){var o=y(this).constructor;t=Reflect.construct(e,arguments,o)}else t=e.apply(this,arguments);return h(this,t)});function g(t){var o;return l(this,g),(o=O.call(this,t)).onFocus=o.onFocus.bind(u(o)),o.onBlur=o.onBlur.bind(u(o)),o.onKeyUp=o.onKeyUp.bind(u(o)),o.onInput=o.onInput.bind(u(o)),o.elementRef=e.createRef(o.props.forwardRef),o}return f=g,(d=[{key:"onFocus",value:function(t){this.props.autoResize&&this.resize(),this.props.onFocus&&this.props.onFocus(t)}},{key:"onBlur",value:function(t){this.props.autoResize&&this.resize(),this.props.onBlur&&this.props.onBlur(t)}},{key:"onKeyUp",value:function(t){this.props.autoResize&&this.resize(),this.props.onKeyUp&&this.props.onKeyUp(t)}},{key:"onInput",value:function(t){this.props.autoResize&&this.resize(),t.target.value.length>0?o.DomHandler.addClass(t.target,"p-filled"):o.DomHandler.removeClass(t.target,"p-filled"),this.props.onInput&&this.props.onInput(t)}},{key:"resize",value:function(t){var e=this.elementRef&&this.elementRef.current;e&&o.DomHandler.isVisible(e)&&(this.cachedScrollHeight||(this.cachedScrollHeight=e.scrollHeight,e.style.overflow="hidden"),(this.cachedScrollHeight!==e.scrollHeight||t)&&(e.style.height="",e.style.height=e.scrollHeight+"px",parseFloat(e.style.height)>=parseFloat(e.style.maxHeight)?(e.style.overflowY="scroll",e.style.height=e.style.maxHeight):e.style.overflow="hidden",this.cachedScrollHeight=e.scrollHeight))}},{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&&this.elementRef.current.value.toString().length>0}},{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(),this.props.autoResize&&this.resize(!0)}},{key:"componentDidUpdate",value:function(t){t.tooltip===this.props.tooltip&&t.tooltipOptions===this.props.tooltipOptions||(this.tooltip?this.tooltip.update(m({content:this.props.tooltip},this.props.tooltipOptions||{})):this.renderTooltip()),this.props.autoResize&&this.resize(!0)}},{key:"componentWillUnmount",value:function(){this.tooltip&&(this.tooltip.destroy(),this.tooltip=null)}},{key:"renderTooltip",value:function(){this.tooltip=r.tip({target:this.elementRef.current,content:this.props.tooltip,options:this.props.tooltipOptions})}},{key:"render",value:function(){var t=o.classNames("p-inputtextarea p-inputtext p-component",{"p-disabled":this.props.disabled,"p-filled":this.isFilled(),"p-inputtextarea-resizable":this.props.autoResize},this.props.className),e=o.ObjectUtils.findDiffKeys(this.props,g.defaultProps);return i.default.createElement("textarea",s({ref:this.elementRef},e,{className:t,onFocus:this.onFocus,onBlur:this.onBlur,onKeyUp:this.onKeyUp,onInput:this.onInput}))}}])&&p(f.prototype,d),b&&p(f,b),Object.defineProperty(f,"prototype",{writable:!1}),g}(e.Component);return d(O,"defaultProps",{autoResize:!1,tooltip:null,tooltipOptions:null,onInput:null,forwardRef:null}),t.InputTextarea=i.default.forwardRef((function(t,e){return i.default.createElement(O,s({forwardRef:e},t))})),Object.defineProperty(t,"__esModule",{value:!0}),t}({},React,primereact.utils,primereact.tooltip);