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

2 lines
24 KiB
JavaScript

import e,{Component as t,createRef as n}from"react";import{InputText as r}from"primereact/inputtext";import{Button as i}from"primereact/button";import{ObjectUtils as o,classNames as s,ZIndexUtils as l,DomHandler as p,ConnectedOverlayScrollHandler as u,UniqueComponentId as a,IconUtils as c}from"primereact/utils";import{Ripple as h}from"primereact/ripple";import{CSSTransition as d}from"primereact/csstransition";import{Portal as f}from"primereact/portal";import{VirtualScroller as m}from"primereact/virtualscroller";import{tip as v}from"primereact/tooltip";import{OverlayService as y}from"primereact/overlayservice";import g from"primereact/api";function b(){return b=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},b.apply(this,arguments)}function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function O(e){if(Array.isArray(e))return k(e)}function C(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function I(e,t){if(e){if("string"==typeof e)return k(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?k(e,t):void 0}}function w(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function E(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function S(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function R(e,t,n){return t&&S(e.prototype,t),n&&S(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function x(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function L(e,t){return L=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},L(e,t)}function D(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&L(e,t)}function M(e){return M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},M(e)}function j(e,t){if(t&&("object"===M(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return x(e)}function P(e){return P=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},P(e)}function T(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function N(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function G(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?N(Object(n),!0).forEach((function(t){T(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):N(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function F(){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(e){return!1}}var B=function(n){D(p,t);var r,i,l=(r=p,i=F(),function(){var e,t=P(r);if(i){var n=P(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return j(this,e)});function p(){return E(this,p),l.apply(this,arguments)}return R(p,[{key:"getOptionGroupRenderKey",value:function(e){return o.resolveFieldData(e,this.props.optionGroupLabel)}},{key:"renderGroupChildren",value:function(t,n){var r=this;return this.props.getOptionGroupChildren(t).map((function(t,i){var s=r.props.itemTemplate?o.getJSXElement(r.props.itemTemplate,t,i):r.props.field?o.resolveFieldData(t,r.props.field):t;return e.createElement("li",{key:i+"_item",role:"option","aria-selected":r.props.ariaSelected===t,className:"p-autocomplete-item",onClick:function(e){return r.props.onItemClick(e,t)},"data-group":n,"data-index":i},s,e.createElement(h,null))}))}},{key:"renderItem",value:function(t,n){var r=this;if(this.props.optionGroupLabel){var i=this.props.optionGroupTemplate?o.getJSXElement(this.props.optionGroupTemplate,t,n):this.props.getOptionGroupLabel(t),s=this.renderGroupChildren(t,n),l=n+"_"+this.getOptionGroupRenderKey(t);return e.createElement(e.Fragment,{key:l},e.createElement("li",{className:"p-autocomplete-item-group"},i),s)}var p=this.props.itemTemplate?o.getJSXElement(this.props.itemTemplate,t,n):this.props.field?o.resolveFieldData(t,this.props.field):t;return e.createElement("li",{key:n+"_item",role:"option","aria-selected":this.props.ariaSelected===t,className:"p-autocomplete-item",onClick:function(e){return r.props.onItemClick(e,t)}},p,e.createElement(h,null))}},{key:"renderItems",value:function(){var e=this;return this.props.suggestions?this.props.suggestions.map((function(t,n){return e.renderItem(t,n)})):null}},{key:"renderContent",value:function(){var t=this;if(this.props.virtualScrollerOptions){var n=G(G({},this.props.virtualScrollerOptions),{style:G(G({},this.props.virtualScrollerOptions.style),{height:this.props.scrollHeight}),items:this.props.suggestions,itemTemplate:function(e,n){return e&&t.renderItem(e,n.index)},contentTemplate:function(n){var r=s("p-autocomplete-items",n.className);return e.createElement("ul",{ref:n.contentRef,className:r,role:"listbox",id:t.props.listId},n.children)}});return e.createElement(m,b({ref:this.props.virtualScrollerRef},n))}var r=this.renderItems();return e.createElement("ul",{className:"p-autocomplete-items",role:"listbox",id:this.props.listId},r)}},{key:"renderElement",value:function(){var t=s("p-autocomplete-panel p-component",this.props.panelClassName),n=G({maxHeight:this.props.scrollHeight},this.props.panelStyle),r=this.renderContent();return e.createElement(d,{nodeRef:this.props.forwardRef,classNames:"p-connected-overlay",in:this.props.in,timeout:{enter:120,exit:100},options:this.props.transitionOptions,unmountOnExit:!0,onEnter:this.props.onEnter,onEntering:this.props.onEntering,onEntered:this.props.onEntered,onExit:this.props.onExit,onExited:this.props.onExited},e.createElement("div",{ref:this.props.forwardRef,className:t,style:n,onClick:this.props.onClick},r))}},{key:"render",value:function(){var t=this.renderElement();return e.createElement(f,{element:t,appendTo:this.props.appendTo})}}]),p}(),H=e.forwardRef((function(t,n){return e.createElement(B,b({forwardRef:n},t))}));function K(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function z(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?K(Object(n),!0).forEach((function(t){T(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):K(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function A(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=V(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){l=!0,o=e},f:function(){try{s||null==n.return||n.return()}finally{if(l)throw o}}}}function V(e,t){if(e){if("string"==typeof e)return _(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_(e,t):void 0}}function _(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function U(){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(e){return!1}}var J=function(h){D(k,t);var d,f,m=(d=k,f=U(),function(){var e,t=P(d);if(f){var n=P(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return j(this,e)});function k(e){var t;return E(this,k),(t=m.call(this,e)).state={id:t.props.id,searching:!1,focused:!1,overlayVisible:!1},t.onInputChange=t.onInputChange.bind(x(t)),t.onInputFocus=t.onInputFocus.bind(x(t)),t.onInputBlur=t.onInputBlur.bind(x(t)),t.onInputKeyDown=t.onInputKeyDown.bind(x(t)),t.onDropdownClick=t.onDropdownClick.bind(x(t)),t.onMultiContainerClick=t.onMultiContainerClick.bind(x(t)),t.onMultiInputFocus=t.onMultiInputFocus.bind(x(t)),t.onMultiInputBlur=t.onMultiInputBlur.bind(x(t)),t.selectItem=t.selectItem.bind(x(t)),t.getOptionGroupLabel=t.getOptionGroupLabel.bind(x(t)),t.getOptionGroupChildren=t.getOptionGroupChildren.bind(x(t)),t.onOverlayEnter=t.onOverlayEnter.bind(x(t)),t.onOverlayEntering=t.onOverlayEntering.bind(x(t)),t.onOverlayEntered=t.onOverlayEntered.bind(x(t)),t.onOverlayExit=t.onOverlayExit.bind(x(t)),t.onOverlayExited=t.onOverlayExited.bind(x(t)),t.onPanelClick=t.onPanelClick.bind(x(t)),t.overlayRef=n(),t.virtualScrollerRef=n(),t.inputRef=n(t.props.inputRef),t}return R(k,[{key:"onInputChange",value:function(e){var t=this;this.timeout&&clearTimeout(this.timeout);var n=e.target.value;this.props.multiple||this.updateModel(e,n),0===n.length?(this.hideOverlay(),this.props.onClear&&this.props.onClear(e)):n.length>=this.props.minLength?this.timeout=setTimeout((function(){t.search(e,n,"input")}),this.props.delay):this.hideOverlay()}},{key:"search",value:function(e,t,n){null!=t&&("input"===n&&0===t.trim().length||this.props.completeMethod&&(this.setState({searching:!0}),this.props.completeMethod({originalEvent:e,query:t})))}},{key:"selectItem",value:function(e,t,n){if(this.props.multiple){if(this.inputRef.current.value="",!this.isSelected(t)){var r=this.props.value?[].concat(O(i=this.props.value)||C(i)||I(i)||w(),[t]):[t];this.updateModel(e,r)}}else this.updateInputField(t),this.updateModel(e,t);var i;this.props.onSelect&&this.props.onSelect({originalEvent:e,value:t}),n||(this.inputRef.current.focus(),this.hideOverlay())}},{key:"updateModel",value:function(e,t){this.props.onChange&&this.props.onChange({originalEvent:e,value:t,stopPropagation:function(){},preventDefault:function(){},target:{name:this.props.name,id:this.state.id,value:t}}),this.ariaSelected=t}},{key:"formatValue",value:function(e){if(e){if(this.props.selectedItemTemplate&&(this.props.multiple?this.isSelected(e):this.findOptionIndex(e)>-1)){var t=o.getJSXElement(this.props.selectedItemTemplate,e);return t||e}if(this.props.field){var n=o.resolveFieldData(e,this.props.field);return null!=n?n:e}return e}return""}},{key:"updateInputField",value:function(e){var t=this.formatValue(e);this.inputRef.current.value=t}},{key:"showOverlay",value:function(){this.setState({overlayVisible:!0})}},{key:"hideOverlay",value:function(){this.setState({overlayVisible:!1,searching:!1})}},{key:"onOverlayEnter",value:function(){l.set("overlay",this.overlayRef.current,g.autoZIndex,g.zIndex.overlay),this.alignOverlay()}},{key:"onOverlayEntering",value:function(){this.props.autoHighlight&&this.props.suggestions&&this.props.suggestions.length&&p.addClass(this.overlayRef.current.firstChild.firstChild,"p-highlight")}},{key:"onOverlayEntered",value:function(){this.bindDocumentClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.props.onShow&&this.props.onShow()}},{key:"onOverlayExit",value:function(){this.unbindDocumentClickListener(),this.unbindScrollListener(),this.unbindResizeListener()}},{key:"onOverlayExited",value:function(){l.clear(this.overlayRef.current),this.props.onHide&&this.props.onHide()}},{key:"alignOverlay",value:function(){p.alignOverlay(this.overlayRef.current,this.props.multiple?this.multiContainer:this.inputRef.current,this.props.appendTo||g.appendTo)}},{key:"onPanelClick",value:function(e){y.emit("overlay-click",{originalEvent:e,target:this.container})}},{key:"onDropdownClick",value:function(e){this.inputRef.current.focus(),"blank"===this.props.dropdownMode?this.search(e,"","dropdown"):"current"===this.props.dropdownMode&&this.search(e,this.inputRef.current.value,"dropdown"),this.props.onDropdownClick&&this.props.onDropdownClick({originalEvent:e,query:this.inputRef.current.value})}},{key:"removeItem",value:function(e,t){var n=this.props.value[t],r=this.props.value.filter((function(e,n){return t!==n}));this.updateModel(e,r),this.props.onUnselect&&this.props.onUnselect({originalEvent:e,value:n})}},{key:"onInputKeyDown",value:function(e){if(this.state.overlayVisible){var t=p.findSingle(this.overlayRef.current,"li.p-highlight");switch(e.which){case 40:if(t){var n=this.findNextItem(t);n&&(p.addClass(n,"p-highlight"),p.removeClass(t,"p-highlight"),p.scrollInView(this.overlayRef.current,n))}else t=p.findSingle(this.overlayRef.current,"li"),p.hasClass(t,"p-autocomplete-item-group")&&(t=this.findNextItem(t)),t&&p.addClass(t,"p-highlight");e.preventDefault();break;case 38:if(t){var r=this.findPrevItem(t);r&&(p.addClass(r,"p-highlight"),p.removeClass(t,"p-highlight"),p.scrollInView(this.overlayRef.current,r))}e.preventDefault();break;case 13:t&&(this.selectHighlightItem(e,t),this.hideOverlay()),e.preventDefault();break;case 27:this.hideOverlay(),e.preventDefault();break;case 9:t&&this.selectHighlightItem(e,t),this.hideOverlay()}}if(this.props.multiple&&8===e.which)if(this.props.value&&this.props.value.length&&!this.inputRef.current.value){var i=this.props.value[this.props.value.length-1],o=this.props.value.slice(0,-1);this.updateModel(e,o),this.props.onUnselect&&this.props.onUnselect({originalEvent:e,value:i})}}},{key:"selectHighlightItem",value:function(e,t){this.props.optionGroupLabel?this.selectItem(e,this.getOptionGroupChildren(this.props.suggestions[t.dataset.group])[t.dataset.index]):this.selectItem(e,this.props.suggestions[p.index(t)])}},{key:"findNextItem",value:function(e){var t=e.nextElementSibling;return t?p.hasClass(t,"p-autocomplete-item-group")?this.findNextItem(t):t:null}},{key:"findPrevItem",value:function(e){var t=e.previousElementSibling;return t?p.hasClass(t,"p-autocomplete-item-group")?this.findPrevItem(t):t:null}},{key:"onInputFocus",value:function(e){var t=this;e.persist(),this.setState({focused:!0},(function(){t.props.onFocus&&t.props.onFocus(e)}))}},{key:"forceItemSelection",value:function(e){var t=!1,n=e.target.value.trim();if(this.props.suggestions){var r,i=A(this.props.suggestions);try{for(i.s();!(r=i.n()).done;){var s=r.value,l=this.props.field?o.resolveFieldData(s,this.props.field):s;if(l&&n===l.trim()){t=!0,this.selectItem(e,s,!0);break}}}catch(e){i.e(e)}finally{i.f()}}t||(this.inputRef.current.value="",this.updateModel(e,null),this.props.onClear&&this.props.onClear(e))}},{key:"onInputBlur",value:function(e){var t=this;e.persist(),this.setState({focused:!1},(function(){t.props.forceSelection&&t.forceItemSelection(e),t.props.onBlur&&t.props.onBlur(e)}))}},{key:"onMultiContainerClick",value:function(e){this.inputRef.current.focus(),this.props.onClick&&this.props.onClick(e)}},{key:"onMultiInputFocus",value:function(e){this.onInputFocus(e),p.addClass(this.multiContainer,"p-focus")}},{key:"onMultiInputBlur",value:function(e){this.onInputBlur(e),p.removeClass(this.multiContainer,"p-focus")}},{key:"isSelected",value:function(e){var t=!1;if(this.props.value&&this.props.value.length)for(var n=0;n<this.props.value.length;n++)if(o.equals(this.props.value[n],e)){t=!0;break}return t}},{key:"findOptionIndex",value:function(e){var t=-1;if(this.props.suggestions)for(var n=0;n<this.props.suggestions.length;n++)if(o.equals(e,this.props.suggestions[n])){t=n;break}return t}},{key:"getOptionGroupLabel",value:function(e){return this.props.optionGroupLabel?o.resolveFieldData(e,this.props.optionGroupLabel):e}},{key:"getOptionGroupChildren",value:function(e){return o.resolveFieldData(e,this.props.optionGroupChildren)}},{key:"bindDocumentClickListener",value:function(){var e=this;this.documentClickListener||(this.documentClickListener=function(t){3!==t.which&&e.state.overlayVisible&&e.isOutsideClicked(t)&&e.hideOverlay()},document.addEventListener("click",this.documentClickListener))}},{key:"unbindDocumentClickListener",value:function(){this.documentClickListener&&(document.removeEventListener("click",this.documentClickListener),this.documentClickListener=null)}},{key:"bindScrollListener",value:function(){var e=this;this.scrollHandler||(this.scrollHandler=new u(this.container,(function(){e.state.overlayVisible&&e.hideOverlay()}))),this.scrollHandler.bindScrollListener()}},{key:"unbindScrollListener",value:function(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()}},{key:"bindResizeListener",value:function(){var e=this;this.resizeListener||(this.resizeListener=function(){e.state.overlayVisible&&!p.isTouchDevice()&&e.hideOverlay()},window.addEventListener("resize",this.resizeListener))}},{key:"unbindResizeListener",value:function(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)}},{key:"isOutsideClicked",value:function(e){return this.container&&this.overlayRef&&this.overlayRef.current&&!this.overlayRef.current.contains(e.target)&&!this.isInputClicked(e)}},{key:"isInputClicked",value:function(e){return this.props.multiple?e.target===this.multiContainer||this.multiContainer.contains(e.target):e.target===this.inputRef.current}},{key:"updateInputRef",value:function(){var e=this.props.inputRef;e&&("function"==typeof e?e(this.inputRef.current):e.current=this.inputRef.current)}},{key:"componentDidMount",value:function(){this.updateInputRef(),this.state.id||this.setState({id:a()}),this.props.autoFocus&&this.inputRef&&this.inputRef.current&&this.inputRef.current.focus(),this.props.tooltip&&this.renderTooltip()}},{key:"componentDidUpdate",value:function(e){e.suggestions!==this.props.suggestions&&this.state.searching&&(this.props.suggestions&&this.props.suggestions.length?this.showOverlay():this.hideOverlay(),this.setState({searching:!1})),this.inputRef&&this.inputRef.current&&!this.props.multiple&&this.updateInputField(this.props.value),e.tooltip===this.props.tooltip&&e.tooltipOptions===this.props.tooltipOptions||(this.tooltip?this.tooltip.update(z({content:this.props.tooltip},this.props.tooltipOptions||{})):this.renderTooltip())}},{key:"componentWillUnmount",value:function(){this.unbindDocumentClickListener(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.tooltip&&(this.tooltip.destroy(),this.tooltip=null),this.timeout&&clearTimeout(this.timeout),l.clear(this.overlayRef.current)}},{key:"renderTooltip",value:function(){this.tooltip=v({target:this.container,content:this.props.tooltip,options:this.props.tooltipOptions})}},{key:"renderSimpleAutoComplete",value:function(){var t=s("p-autocomplete-input",this.props.inputClassName,{"p-autocomplete-dd-input":this.props.dropdown});return e.createElement(r,{ref:this.inputRef,id:this.props.inputId,type:this.props.type,name:this.props.name,defaultValue:this.formatValue(this.props.value),role:"searchbox","aria-autocomplete":"list","aria-controls":this.state.id+"_list","aria-labelledby":this.props.ariaLabelledBy,className:t,style:this.props.inputStyle,autoComplete:"off",readOnly:this.props.readOnly,disabled:this.props.disabled,placeholder:this.props.placeholder,size:this.props.size,maxLength:this.props.maxLength,tabIndex:this.props.tabIndex,onBlur:this.onInputBlur,onFocus:this.onInputFocus,onChange:this.onInputChange,onMouseDown:this.props.onMouseDown,onKeyUp:this.props.onKeyUp,onKeyDown:this.onInputKeyDown,onKeyPress:this.props.onKeyPress,onContextMenu:this.props.onContextMenu,onClick:this.props.onClick,onDoubleClick:this.props.onDblClick})}},{key:"renderChips",value:function(){var t=this;return this.props.value&&this.props.value.length?this.props.value.map((function(n,r){return e.createElement("li",{key:r+"multi-item",className:"p-autocomplete-token p-highlight"},e.createElement("span",{className:"p-autocomplete-token-label"},t.formatValue(n)),!t.props.disabled&&c.getJSXIcon(t.props.removeIcon,{className:"p-autocomplete-token-icon",onClick:function(e){return t.removeItem(e,r)}},{props:t.props}))})):null}},{key:"renderMultiInput",value:function(){return e.createElement("li",{className:"p-autocomplete-input-token"},e.createElement("input",{ref:this.inputRef,type:this.props.type,disabled:this.props.disabled,placeholder:this.props.placeholder,role:"searchbox","aria-autocomplete":"list","aria-controls":this.state.id+"_list","aria-labelledby":this.props.ariaLabelledBy,autoComplete:"off",tabIndex:this.props.tabIndex,onChange:this.onInputChange,id:this.props.inputId,name:this.props.name,style:this.props.inputStyle,className:this.props.inputClassName,maxLength:this.props.maxLength,onKeyUp:this.props.onKeyUp,onKeyDown:this.onInputKeyDown,onKeyPress:this.props.onKeyPress,onFocus:this.onMultiInputFocus,onBlur:this.onMultiInputBlur}))}},{key:"renderMultipleAutoComplete",value:function(){var t=this,n=s("p-autocomplete-multiple-container p-component p-inputtext",{"p-disabled":this.props.disabled}),r=this.renderChips(),i=this.renderMultiInput();return e.createElement("ul",{ref:function(e){t.multiContainer=e},className:n,onContextMenu:this.props.onContextMenu,onMouseDown:this.props.onMouseDown,onClick:this.onMultiContainerClick,onDoubleClick:this.props.onDblClick},r,i)}},{key:"renderDropdown",value:function(){var t=this;return e.createElement(i,{ref:function(e){return t.dropdownButton=e},type:"button",icon:this.props.dropdownIcon,className:"p-autocomplete-dropdown",disabled:this.props.disabled,onClick:this.onDropdownClick})}},{key:"renderLoader",value:function(){return this.state.searching?e.createElement("i",{className:"p-autocomplete-loader pi pi-spinner pi-spin"}):null}},{key:"render",value:function(){var t,n,r=this,i=s("p-autocomplete p-component p-inputwrapper",this.props.className,{"p-autocomplete-dd":this.props.dropdown,"p-autocomplete-multiple":this.props.multiple,"p-inputwrapper-filled":this.props.value,"p-inputwrapper-focus":this.state.focused}),o=this.renderLoader();return t=this.props.multiple?this.renderMultipleAutoComplete():this.renderSimpleAutoComplete(),this.props.dropdown&&(n=this.renderDropdown()),e.createElement("span",{ref:function(e){return r.container=e},id:this.state.id,style:this.props.style,className:i,"aria-haspopup":"listbox","aria-expanded":this.state.overlayVisible,"aria-owns":this.state.id+"_list"},t,o,n,e.createElement(H,b({ref:this.overlayRef,virtualScrollerRef:this.virtualScrollerRef},this.props,{listId:this.state.id+"_list",onItemClick:this.selectItem,ariaSelected:this.ariaSelected,onClick:this.onPanelClick,getOptionGroupLabel:this.getOptionGroupLabel,getOptionGroupChildren:this.getOptionGroupChildren,in:this.state.overlayVisible,onEnter:this.onOverlayEnter,onEntering:this.onOverlayEntering,onEntered:this.onOverlayEntered,onExit:this.onOverlayExit,onExited:this.onOverlayExited})))}}]),k}();T(J,"defaultProps",{id:null,inputRef:null,value:null,name:null,type:"text",suggestions:null,field:null,optionGroupLabel:null,optionGroupChildren:null,optionGroupTemplate:null,forceSelection:!1,autoHighlight:!1,virtualScrollerOptions:null,scrollHeight:"200px",dropdown:!1,dropdownMode:"blank",multiple:!1,minLength:1,delay:300,style:null,className:null,inputId:null,inputStyle:null,inputClassName:null,panelClassName:null,panelStyle:null,placeholder:null,readOnly:!1,disabled:!1,maxLength:null,size:null,appendTo:null,tabIndex:null,autoFocus:!1,tooltip:null,tooltipOptions:null,ariaLabelledBy:null,completeMethod:null,itemTemplate:null,selectedItemTemplate:null,transitionOptions:null,dropdownIcon:"pi pi-chevron-down",removeIcon:"pi pi-times-circle",onChange:null,onFocus:null,onBlur:null,onSelect:null,onUnselect:null,onDropdownClick:null,onClick:null,onDblClick:null,onMouseDown:null,onKeyUp:null,onKeyPress:null,onContextMenu:null,onClear:null,onShow:null,onHide:null});export{J as AutoComplete};