2 lines
6.4 KiB
JavaScript
2 lines
6.4 KiB
JavaScript
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),e=require("primereact/utils"),o=require("primereact/tooltip");function n(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var i=n(t);function r(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 n=e[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function s(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 u(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 c(t){return c="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},c(t)}function a(t,e){if(e&&("object"===c(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return s(t)}function f(t){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},f(t)}function h(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function d(t,e){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),o.push.apply(o,n)}return o}function y(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?d(Object(o),!0).forEach((function(e){h(t,e,o[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):d(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,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 m=function(n){u(g,t.Component);var l,c,d,m,v,O=(l=g,c=b(),function(){var t,e=f(l);if(c){var o=f(this).constructor;t=Reflect.construct(e,arguments,o)}else t=e.apply(this,arguments);return a(this,t)});function g(e){var o;return r(this,g),(o=O.call(this,e)).state={focused:!1},o.onClick=o.onClick.bind(s(o)),o.onFocus=o.onFocus.bind(s(o)),o.onBlur=o.onBlur.bind(s(o)),o.inputRef=t.createRef(o.props.inputRef),o}return d=g,(m=[{key:"onClick",value:function(t){this.props.disabled||this.props.readOnly||(this.toggle(t),this.inputRef.current.focus())}},{key:"getOptionValue",value:function(t){return this.props.optionValue?e.ObjectUtils.resolveFieldData(t,this.props.optionValue):t}},{key:"equalityKey",value:function(){return this.props.optionValue?null:this.props.dataKey}},{key:"findSelectedOptionMap",value:function(){var t,o,n=this;if(this.props.options){var i=this.equalityKey();o=this.props.options.findIndex((function(t){return e.ObjectUtils.equals(n.props.value,n.getOptionValue(t),i)})),t=this.props.options[o]}return{option:t,index:o}}},{key:"findNextOption",value:function(){if(this.props.options){var t=this.findSelectedOptionMap().index;return t===this.props.options.length-1?this.props.empty?null:this.props.options[0]:this.props.options[t+1]}return null}},{key:"toggle",value:function(t){var e=this.getOptionValue(this.findNextOption());this.props.onChange&&this.props.onChange({originalEvent:t,value:e,stopPropagation:function(){},preventDefault:function(){},target:{name:this.props.name,id:this.props.id,value:e}})}},{key:"onFocus",value:function(){this.setState({focused:!0})}},{key:"onBlur",value:fu
|